use of org.openkilda.model.SwitchProperties in project open-kilda by telstra.
the class FermaSwitchPropertiesRepositoryTest method shouldFindSwitchPropertiesBySwitchId.
@Test
public void shouldFindSwitchPropertiesBySwitchId() {
Switch origSwitch = Switch.builder().switchId(TEST_SWITCH_ID).description("Some description").build();
switchRepository.add(origSwitch);
SwitchProperties switchProperties = SwitchProperties.builder().switchObj(origSwitch).supportedTransitEncapsulation(SwitchProperties.DEFAULT_FLOW_ENCAPSULATION_TYPES).build();
switchPropertiesRepository.add(switchProperties);
Optional<SwitchProperties> switchPropertiesOptional = switchPropertiesRepository.findBySwitchId(TEST_SWITCH_ID);
assertTrue(switchPropertiesOptional.isPresent());
}
use of org.openkilda.model.SwitchProperties 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.SwitchProperties in project open-kilda by telstra.
the class SwitchOperationsServiceTest method createSwitchProperties.
private void createSwitchProperties(Switch sw, Set<FlowEncapsulationType> transitEncapsulation, boolean multiTable, boolean switchLldp, boolean switchArp) {
SwitchProperties switchProperties = SwitchProperties.builder().switchObj(sw).supportedTransitEncapsulation(transitEncapsulation).multiTable(multiTable).switchLldp(switchLldp).switchArp(switchArp).build();
switchPropertiesRepository.add(switchProperties);
}
use of org.openkilda.model.SwitchProperties in project open-kilda by telstra.
the class PathsServiceTest method assertMaxLatencyPaths.
private void assertMaxLatencyPaths(List<PathsInfoData> paths, Duration maxLatency, long expectedCount, FlowEncapsulationType encapsulationType) {
assertEquals(expectedCount, paths.size());
assertPathLength(paths);
for (PathsInfoData path : paths) {
assertTrue(path.getPath().getLatency().minus(maxLatency).isNegative());
Optional<SwitchProperties> properties = switchPropertiesRepository.findBySwitchId(path.getPath().getNodes().get(1).getSwitchId());
assertTrue(properties.isPresent());
assertTrue(properties.get().getSupportedTransitEncapsulation().contains(encapsulationType));
}
}
use of org.openkilda.model.SwitchProperties in project open-kilda by telstra.
the class SwitchFsm method persistSwitchProperties.
private void persistSwitchProperties(Switch sw) {
boolean multiTable = kildaConfigurationRepository.getOrDefault().getUseMultiTable() && sw.getFeatures().contains(SwitchFeature.MULTI_TABLE);
Optional<SwitchProperties> switchPropertiesResult = switchPropertiesRepository.findBySwitchId(sw.getSwitchId());
if (!switchPropertiesResult.isPresent()) {
SwitchProperties switchProperties = SwitchProperties.builder().switchObj(sw).supportedTransitEncapsulation(SwitchProperties.DEFAULT_FLOW_ENCAPSULATION_TYPES).multiTable(multiTable).build();
switchPropertiesRepository.add(switchProperties);
}
}
Aggregations