use of org.openkilda.messaging.model.SwitchPropertiesDto in project open-kilda by telstra.
the class SwitchOperationsServiceTest method shouldValidateFlowWithLldpFlagWhenUpdatingSwitchProperties.
@Test(expected = IllegalSwitchPropertiesException.class)
public void shouldValidateFlowWithLldpFlagWhenUpdatingSwitchProperties() {
Switch firstSwitch = Switch.builder().switchId(TEST_SWITCH_ID).status(SwitchStatus.ACTIVE).build();
Switch secondSwitch = Switch.builder().switchId(TEST_SWITCH_ID_2).status(SwitchStatus.ACTIVE).build();
switchRepository.add(firstSwitch);
switchRepository.add(secondSwitch);
Flow flow = Flow.builder().flowId(TEST_FLOW_ID_1).srcSwitch(firstSwitch).destSwitch(secondSwitch).detectConnectedDevices(new DetectConnectedDevices(true, false, true, false, false, false, false, false)).build();
flowRepository.add(flow);
createSwitchProperties(firstSwitch, Collections.singleton(FlowEncapsulationType.TRANSIT_VLAN), true, false, false);
// user can't disable multiTable if some flows has enabled detect connected devices via LLDP
SwitchPropertiesDto update = new SwitchPropertiesDto();
update.setSupportedTransitEncapsulation(Collections.singleton(org.openkilda.messaging.payload.flow.FlowEncapsulationType.TRANSIT_VLAN));
update.setMultiTable(false);
update.setSwitchLldp(false);
switchOperationsService.updateSwitchProperties(TEST_SWITCH_ID, update);
}
use of org.openkilda.messaging.model.SwitchPropertiesDto in project open-kilda by telstra.
the class SwitchOperationsServiceTest method shouldUpdateServer42FlowRttSwitchProperties.
@Test
public void shouldUpdateServer42FlowRttSwitchProperties() {
Switch sw = Switch.builder().switchId(TEST_SWITCH_ID).status(SwitchStatus.ACTIVE).features(Collections.singleton(SwitchFeature.MULTI_TABLE)).build();
switchRepository.add(sw);
createServer42SwitchProperties(sw, false, SERVER_42_PORT_1, SERVER_42_VLAN_1, SERVER_42_MAC_ADDRESS_1);
SwitchPropertiesDto update = new SwitchPropertiesDto();
update.setSupportedTransitEncapsulation(Collections.singleton(org.openkilda.messaging.payload.flow.FlowEncapsulationType.TRANSIT_VLAN));
update.setMultiTable(true);
update.setServer42FlowRtt(true);
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());
assertTrue(updated.get().isServer42FlowRtt());
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());
}
use of org.openkilda.messaging.model.SwitchPropertiesDto in project open-kilda by telstra.
the class SwitchOperationsServiceTest method shouldUpdateServer42IslRttSwitchProperties.
@Test
public void shouldUpdateServer42IslRttSwitchProperties() {
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.ENABLED);
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.ENABLED, 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());
}
Aggregations