use of org.openkilda.model.Switch 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());
}
use of org.openkilda.model.Switch 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.Switch in project open-kilda by telstra.
the class TimeModifyPropertyOnFramesTest method shouldNotUpdateTimeModifyOnAnnotatedPropertyWithConverterAndSameValueChange.
@Test
public void shouldNotUpdateTimeModifyOnAnnotatedPropertyWithConverterAndSameValueChange() {
Instant timeModifyBefore = transactionManager.doInTransaction(() -> createTestSwitch(1).getTimeModify());
waitUntilNowIsAfter(timeModifyBefore);
transactionManager.doInTransaction(() -> {
Switch sw = switchRepository.findById(new SwitchId(1)).get();
sw.setStatus(sw.getStatus());
});
Instant timeModifyAfter = switchRepository.findById(new SwitchId(1)).get().getTimeModify();
assertEquals(timeModifyBefore, timeModifyAfter);
}
use of org.openkilda.model.Switch in project open-kilda by telstra.
the class FermaSwitchRepositoryTest method shouldFindSwitchById.
@Test
public void shouldFindSwitchById() {
Switch origSwitch = Switch.builder().switchId(TEST_SWITCH_ID_A).description("Some description").build();
switchRepository.add(origSwitch);
Switch foundSwitch = switchRepository.findById(TEST_SWITCH_ID_A).get();
assertEquals(origSwitch.getDescription(), foundSwitch.getDescription());
}
use of org.openkilda.model.Switch in project open-kilda by telstra.
the class FermaSwitchRepositoryTest method shouldDeleteSwitch.
@Test
public void shouldDeleteSwitch() {
Switch origSwitch = Switch.builder().switchId(TEST_SWITCH_ID_A).description("Some description").build();
switchRepository.add(origSwitch);
transactionManager.doInTransaction(() -> switchRepository.remove(origSwitch));
assertEquals(0, switchRepository.findAll().size());
}
Aggregations