use of org.openkilda.model.Switch in project open-kilda by telstra.
the class SwitchOperationsServiceTest method runInvalidServer42PropsTest.
private void runInvalidServer42PropsTest(SwitchPropertiesDto invalidProperties) {
invalidProperties.setMultiTable(true);
invalidProperties.setSupportedTransitEncapsulation(Collections.singleton(org.openkilda.messaging.payload.flow.FlowEncapsulationType.TRANSIT_VLAN));
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);
switchOperationsService.updateSwitchProperties(TEST_SWITCH_ID, invalidProperties);
}
use of org.openkilda.model.Switch 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());
}
use of org.openkilda.model.Switch in project open-kilda by telstra.
the class SwitchOperationsServiceTest method shouldValidateMultiTableFlagWhenUpdatingSwitchPropertiesWithArp.
@Test(expected = IllegalSwitchPropertiesException.class)
public void shouldValidateMultiTableFlagWhenUpdatingSwitchPropertiesWithArp() {
Switch sw = Switch.builder().switchId(TEST_SWITCH_ID).status(SwitchStatus.ACTIVE).build();
switchRepository.add(sw);
createSwitchProperties(sw, Collections.singleton(FlowEncapsulationType.TRANSIT_VLAN), true, false, true);
// user can't disable multiTable without disabling ARP
SwitchPropertiesDto update = new SwitchPropertiesDto();
update.setSupportedTransitEncapsulation(Collections.singleton(org.openkilda.messaging.payload.flow.FlowEncapsulationType.TRANSIT_VLAN));
update.setMultiTable(false);
update.setSwitchArp(true);
switchOperationsService.updateSwitchProperties(TEST_SWITCH_ID, update);
}
use of org.openkilda.model.Switch in project open-kilda by telstra.
the class SwitchOperationsServiceTest method shouldValidateFlowWhenUpdatingServer42PortSwitchProperties.
@Test(expected = IllegalSwitchPropertiesException.class)
public void shouldValidateFlowWhenUpdatingServer42PortSwitchProperties() {
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).srcPort(TEST_FLOW_SRC_PORT).destSwitch(secondSwitch).detectConnectedDevices(new DetectConnectedDevices(false, true, false, true, false, false, false, false)).build();
flowRepository.add(flow);
createSwitchProperties(firstSwitch, Collections.singleton(FlowEncapsulationType.TRANSIT_VLAN), true, false, false);
SwitchPropertiesDto update = new SwitchPropertiesDto();
update.setSupportedTransitEncapsulation(Collections.singleton(org.openkilda.messaging.payload.flow.FlowEncapsulationType.TRANSIT_VLAN));
update.setServer42Port(TEST_FLOW_SRC_PORT);
switchOperationsService.updateSwitchProperties(TEST_SWITCH_ID, update);
}
use of org.openkilda.model.Switch in project open-kilda by telstra.
the class SwitchOperationsServiceTest method shouldDeletePortPropertiesWhenDeletingSwitch.
@Test
public void shouldDeletePortPropertiesWhenDeletingSwitch() throws SwitchNotFoundException {
Switch sw = Switch.builder().switchId(TEST_SWITCH_ID).status(SwitchStatus.ACTIVE).build();
switchRepository.add(sw);
PortProperties portProperties = PortProperties.builder().switchObj(sw).port(7).discoveryEnabled(false).build();
portPropertiesRepository.add(portProperties);
switchOperationsService.deleteSwitch(TEST_SWITCH_ID, false);
assertFalse(switchRepository.findById(TEST_SWITCH_ID).isPresent());
assertTrue(portPropertiesRepository.findAll().isEmpty());
}
Aggregations