Search in sources :

Example 6 with SwitchProperties

use of org.openkilda.model.SwitchProperties in project open-kilda by telstra.

the class FlowValidatorTest method checkForEncapsulationTypeRequirementDifferentTypeTest.

@Test(expected = InvalidFlowException.class)
public void checkForEncapsulationTypeRequirementDifferentTypeTest() throws InvalidFlowException {
    SwitchProperties properties = SwitchProperties.builder().supportedTransitEncapsulation(Sets.newHashSet(VXLAN)).build();
    flowValidator.checkForEncapsulationTypeRequirement(SRC_ENDPOINT, properties, TRANSIT_VLAN);
}
Also used : SwitchProperties(org.openkilda.model.SwitchProperties) Test(org.junit.Test)

Example 7 with SwitchProperties

use of org.openkilda.model.SwitchProperties in project open-kilda by telstra.

the class FlowValidatorTest method checkForEncapsulationTypeRequirementCorrectTypeTest.

@Test
public void checkForEncapsulationTypeRequirementCorrectTypeTest() throws InvalidFlowException {
    SwitchProperties properties = SwitchProperties.builder().supportedTransitEncapsulation(Sets.newHashSet(VXLAN, TRANSIT_VLAN)).build();
    flowValidator.checkForEncapsulationTypeRequirement(SRC_ENDPOINT, properties, TRANSIT_VLAN);
}
Also used : SwitchProperties(org.openkilda.model.SwitchProperties) Test(org.junit.Test)

Example 8 with SwitchProperties

use of org.openkilda.model.SwitchProperties in project open-kilda by telstra.

the class InMemoryPathComputerBaseTest method createSwitch.

Switch createSwitch(String name) {
    Switch sw = Switch.builder().switchId(new SwitchId(name)).status(SwitchStatus.ACTIVE).build();
    switchRepository.add(sw);
    SwitchProperties switchProperties = SwitchProperties.builder().switchObj(sw).supportedTransitEncapsulation(SwitchProperties.DEFAULT_FLOW_ENCAPSULATION_TYPES).build();
    switchPropertiesRepository.add(switchProperties);
    return sw;
}
Also used : Switch(org.openkilda.model.Switch) SwitchId(org.openkilda.model.SwitchId) SwitchProperties(org.openkilda.model.SwitchProperties)

Example 9 with SwitchProperties

use of org.openkilda.model.SwitchProperties in project open-kilda by telstra.

the class FermaIslRepositoryTest method setUp.

@Before
public void setUp() {
    islRepository = repositoryFactory.createIslRepository();
    switchRepository = repositoryFactory.createSwitchRepository();
    flowRepository = repositoryFactory.createFlowRepository();
    flowPathRepository = repositoryFactory.createFlowPathRepository();
    switchPropertiesRepository = repositoryFactory.createSwitchPropertiesRepository();
    switchA = createTestSwitch(TEST_SWITCH_A_ID);
    SwitchProperties switchAFeatures = SwitchProperties.builder().switchObj(switchA).supportedTransitEncapsulation(SwitchProperties.DEFAULT_FLOW_ENCAPSULATION_TYPES).build();
    switchPropertiesRepository.add(switchAFeatures);
    switchB = createTestSwitch(TEST_SWITCH_B_ID);
    SwitchProperties switchBFeatures = SwitchProperties.builder().switchObj(switchB).supportedTransitEncapsulation(SwitchProperties.DEFAULT_FLOW_ENCAPSULATION_TYPES).build();
    switchPropertiesRepository.add(switchBFeatures);
    switchC = createTestSwitch(TEST_SWITCH_C_ID);
    SwitchProperties switchCFeatures = SwitchProperties.builder().switchObj(switchC).supportedTransitEncapsulation(SwitchProperties.DEFAULT_FLOW_ENCAPSULATION_TYPES).build();
    switchPropertiesRepository.add(switchCFeatures);
    assertEquals(3, switchRepository.findAll().size());
}
Also used : SwitchProperties(org.openkilda.model.SwitchProperties) Before(org.junit.Before)

Example 10 with SwitchProperties

use of org.openkilda.model.SwitchProperties in project open-kilda by telstra.

the class FermaSwitchPropertiesRepositoryTest method shouldCreatePropertiesWithNullServer42Props.

@Test
public void shouldCreatePropertiesWithNullServer42Props() {
    Switch origSwitch = Switch.builder().switchId(TEST_SWITCH_ID).description("Some description").build();
    switchRepository.add(origSwitch);
    SwitchProperties switchProperties = SwitchProperties.builder().switchObj(origSwitch).server42Port(null).server42Vlan(null).server42MacAddress(null).supportedTransitEncapsulation(SwitchProperties.DEFAULT_FLOW_ENCAPSULATION_TYPES).build();
    switchPropertiesRepository.add(switchProperties);
    Optional<SwitchProperties> switchPropertiesOptional = switchPropertiesRepository.findBySwitchId(TEST_SWITCH_ID);
    assertTrue(switchPropertiesOptional.isPresent());
    assertFalse(switchPropertiesOptional.get().isServer42FlowRtt());
    assertNull(switchPropertiesOptional.get().getServer42Port());
    assertNull(switchPropertiesOptional.get().getServer42MacAddress());
}
Also used : Switch(org.openkilda.model.Switch) SwitchProperties(org.openkilda.model.SwitchProperties) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Aggregations

SwitchProperties (org.openkilda.model.SwitchProperties)45 Switch (org.openkilda.model.Switch)19 SwitchId (org.openkilda.model.SwitchId)19 Test (org.junit.Test)17 ArrayList (java.util.ArrayList)9 HashMap (java.util.HashMap)8 HashSet (java.util.HashSet)8 List (java.util.List)8 Set (java.util.Set)7 InMemoryGraphBasedTest (org.openkilda.persistence.inmemory.InMemoryGraphBasedTest)7 KildaFeatureToggles (org.openkilda.model.KildaFeatureToggles)6 Utils.buildSwitch (org.openkilda.rulemanager.Utils.buildSwitch)6 Utils.buildSwitchProperties (org.openkilda.rulemanager.Utils.buildSwitchProperties)6 Sets (com.google.common.collect.Sets)5 Map (java.util.Map)5 Before (org.junit.Before)5 Collections (java.util.Collections)4 Assert.assertEquals (org.junit.Assert.assertEquals)4 Assert.assertTrue (org.junit.Assert.assertTrue)4 Mockito.mock (org.mockito.Mockito.mock)4