Search in sources :

Example 1 with SwitchPropertiesDto

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

the class SwitchOperationsServiceTest method shouldValidateSupportedEncapsulationTypeWhenUpdatingSwitchProperties.

@Test(expected = IllegalSwitchPropertiesException.class)
public void shouldValidateSupportedEncapsulationTypeWhenUpdatingSwitchProperties() {
    Switch sw = Switch.builder().switchId(TEST_SWITCH_ID).status(SwitchStatus.ACTIVE).build();
    switchRepository.add(sw);
    createSwitchProperties(sw, Collections.singleton(FlowEncapsulationType.TRANSIT_VLAN), false, false, false);
    switchOperationsService.updateSwitchProperties(TEST_SWITCH_ID, new SwitchPropertiesDto());
}
Also used : SwitchPropertiesDto(org.openkilda.messaging.model.SwitchPropertiesDto) Switch(org.openkilda.model.Switch) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Example 2 with SwitchPropertiesDto

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

the class SwitchOperationsServiceTest method shouldValidateServer42MacAddressWhenEnableFlowRttInSwitchProperties.

@Test(expected = IllegalSwitchPropertiesException.class)
public void shouldValidateServer42MacAddressWhenEnableFlowRttInSwitchProperties() {
    // user can't enable server42FlowRtt and do not specify server42MacAddress
    SwitchPropertiesDto properties = new SwitchPropertiesDto();
    properties.setServer42FlowRtt(true);
    properties.setServer42Port(SERVER_42_PORT_2);
    properties.setServer42Vlan(SERVER_42_VLAN_2);
    properties.setServer42MacAddress(null);
    runInvalidServer42PropsTest(properties);
}
Also used : SwitchPropertiesDto(org.openkilda.messaging.model.SwitchPropertiesDto) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Example 3 with SwitchPropertiesDto

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

the class SwitchOperationsServiceTest method shouldValidateServer42VlanWhenEnableIslRttInSwitchProperties.

@Test(expected = IllegalSwitchPropertiesException.class)
public void shouldValidateServer42VlanWhenEnableIslRttInSwitchProperties() {
    // user can't enable server42FlowRtt and do not specify server42Vlan
    SwitchPropertiesDto properties = new SwitchPropertiesDto();
    properties.setServer42IslRtt(SwitchPropertiesDto.RttState.ENABLED);
    properties.setServer42Port(SERVER_42_PORT_2);
    properties.setServer42Vlan(null);
    properties.setServer42MacAddress(SERVER_42_MAC_ADDRESS_2);
    runInvalidServer42PropsTest(properties);
}
Also used : SwitchPropertiesDto(org.openkilda.messaging.model.SwitchPropertiesDto) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Example 4 with SwitchPropertiesDto

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

the class SwitchOperationsServiceTest method shouldValidateServer42PortWhenEnableFlowRttInSwitchProperties.

@Test(expected = IllegalSwitchPropertiesException.class)
public void shouldValidateServer42PortWhenEnableFlowRttInSwitchProperties() {
    // user can't enable server42FlowRtt and do not specify server42Port
    SwitchPropertiesDto properties = new SwitchPropertiesDto();
    properties.setServer42FlowRtt(true);
    properties.setServer42Port(null);
    properties.setServer42Vlan(SERVER_42_VLAN_2);
    properties.setServer42MacAddress(SERVER_42_MAC_ADDRESS_2);
    runInvalidServer42PropsTest(properties);
}
Also used : SwitchPropertiesDto(org.openkilda.messaging.model.SwitchPropertiesDto) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Example 5 with SwitchPropertiesDto

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

the class SwitchOperationsServiceTest method shouldUpdateServer42IslRttSwitchPropertiesToAuto.

@Test
public void shouldUpdateServer42IslRttSwitchPropertiesToAuto() {
    Switch sw = Switch.builder().switchId(TEST_SWITCH_ID).status(SwitchStatus.ACTIVE).features(Collections.singleton(SwitchFeature.MULTI_TABLE)).build();
    switchRepository.add(sw);
    SwitchProperties switchProperties = SwitchProperties.builder().switchObj(sw).supportedTransitEncapsulation(Collections.singleton(FlowEncapsulationType.TRANSIT_VLAN)).multiTable(false).server42IslRtt(SwitchProperties.RttState.DISABLED).server42Port(SERVER_42_PORT_1).server42Vlan(SERVER_42_VLAN_1).server42MacAddress(SERVER_42_MAC_ADDRESS_1).build();
    switchPropertiesRepository.add(switchProperties);
    SwitchPropertiesDto update = new SwitchPropertiesDto();
    update.setSupportedTransitEncapsulation(Collections.singleton(org.openkilda.messaging.payload.flow.FlowEncapsulationType.TRANSIT_VLAN));
    update.setServer42IslRtt(RttState.AUTO);
    update.setServer42Port(SERVER_42_PORT_2);
    update.setServer42Vlan(SERVER_42_VLAN_2);
    update.setServer42MacAddress(SERVER_42_MAC_ADDRESS_2);
    switchOperationsService.updateSwitchProperties(TEST_SWITCH_ID, update);
    Optional<SwitchProperties> updated = switchPropertiesRepository.findBySwitchId(TEST_SWITCH_ID);
    assertTrue(updated.isPresent());
    assertEquals(SwitchProperties.RttState.AUTO, updated.get().getServer42IslRtt());
    assertEquals(SERVER_42_PORT_2, updated.get().getServer42Port());
    assertEquals(SERVER_42_VLAN_2, updated.get().getServer42Vlan());
    assertEquals(SERVER_42_MAC_ADDRESS_2, updated.get().getServer42MacAddress());
}
Also used : SwitchPropertiesDto(org.openkilda.messaging.model.SwitchPropertiesDto) Switch(org.openkilda.model.Switch) SwitchProperties(org.openkilda.model.SwitchProperties) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)18 SwitchPropertiesDto (org.openkilda.messaging.model.SwitchPropertiesDto)18 InMemoryGraphBasedTest (org.openkilda.persistence.inmemory.InMemoryGraphBasedTest)18 Switch (org.openkilda.model.Switch)12 DetectConnectedDevices (org.openkilda.model.DetectConnectedDevices)3 Flow (org.openkilda.model.Flow)3 PathId (org.openkilda.model.PathId)3 SwitchProperties (org.openkilda.model.SwitchProperties)3 FlowMirrorPoints (org.openkilda.model.FlowMirrorPoints)2 GroupId (org.openkilda.model.GroupId)2 MirrorGroup (org.openkilda.model.MirrorGroup)2 FlowMirrorPath (org.openkilda.model.FlowMirrorPath)1