Search in sources :

Example 41 with Switch

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());
}
Also used : Switch(org.openkilda.model.Switch) SwitchProperties(org.openkilda.model.SwitchProperties) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Example 42 with Switch

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());
}
Also used : Switch(org.openkilda.model.Switch) SwitchProperties(org.openkilda.model.SwitchProperties) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Example 43 with Switch

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);
}
Also used : Switch(org.openkilda.model.Switch) Instant(java.time.Instant) SwitchId(org.openkilda.model.SwitchId) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Example 44 with Switch

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());
}
Also used : Switch(org.openkilda.model.Switch) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Example 45 with Switch

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());
}
Also used : Switch(org.openkilda.model.Switch) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Aggregations

Switch (org.openkilda.model.Switch)230 Test (org.junit.Test)126 Flow (org.openkilda.model.Flow)68 SwitchId (org.openkilda.model.SwitchId)67 InMemoryGraphBasedTest (org.openkilda.persistence.inmemory.InMemoryGraphBasedTest)46 FlowPath (org.openkilda.model.FlowPath)34 PathId (org.openkilda.model.PathId)32 Utils.buildSwitch (org.openkilda.rulemanager.Utils.buildSwitch)32 PathComputer (org.openkilda.pce.PathComputer)28 GetPathsResult (org.openkilda.pce.GetPathsResult)23 List (java.util.List)22 SwitchProperties (org.openkilda.model.SwitchProperties)21 FlowSpeakerData (org.openkilda.rulemanager.FlowSpeakerData)20 SpeakerData (org.openkilda.rulemanager.SpeakerData)19 String.format (java.lang.String.format)17 Set (java.util.Set)17 Isl (org.openkilda.model.Isl)15 HashSet (java.util.HashSet)14 ArrayList (java.util.ArrayList)13 Collections (java.util.Collections)13