Search in sources :

Example 76 with Isl

use of org.openkilda.model.Isl in project open-kilda by telstra.

the class FermaIslRepositoryTest method shouldUpdateAvailableBandwidthForDifferentSharedBandwidthGroups.

@Test
public void shouldUpdateAvailableBandwidthForDifferentSharedBandwidthGroups() {
    Isl isl = createIsl(switchA, 1, switchB, 2, IslStatus.ACTIVE, 100L);
    isl.setMaxBandwidth(100L);
    createPathWithSegment("path1", switchA, 1, switchB, 2, 30L, "path1group");
    createPathWithSegment("path2", switchA, 1, switchB, 2, 40L, "path2group");
    islRepository.updateAvailableBandwidth(TEST_SWITCH_A_ID, 1, TEST_SWITCH_B_ID, 2);
    Isl islAfter = islRepository.findByEndpoints(TEST_SWITCH_A_ID, 1, TEST_SWITCH_B_ID, 2).get();
    assertEquals(30, islAfter.getAvailableBandwidth());
}
Also used : Isl(org.openkilda.model.Isl) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Example 77 with Isl

use of org.openkilda.model.Isl in project open-kilda by telstra.

the class FermaIslRepositoryTest method shouldUpdateAvailableBandwidthForSameSharedBandwidthGroupAndIgnoredBandwidth.

@Test
public void shouldUpdateAvailableBandwidthForSameSharedBandwidthGroupAndIgnoredBandwidth() {
    Isl isl = createIsl(switchA, 1, switchB, 2, IslStatus.ACTIVE, 100L);
    isl.setMaxBandwidth(100L);
    createPathWithSegment("path1", switchA, 1, switchB, 2, 30L, TEST_FLOW_ID);
    FlowPath path2 = createPathWithSegment("path2", switchA, 1, switchB, 2, 70L, TEST_FLOW_ID);
    path2.setIgnoreBandwidth(true);
    islRepository.updateAvailableBandwidth(TEST_SWITCH_A_ID, 1, TEST_SWITCH_B_ID, 2);
    Isl islAfter = islRepository.findByEndpoints(TEST_SWITCH_A_ID, 1, TEST_SWITCH_B_ID, 2).get();
    assertEquals(70, islAfter.getAvailableBandwidth());
}
Also used : Isl(org.openkilda.model.Isl) FlowPath(org.openkilda.model.FlowPath) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Example 78 with Isl

use of org.openkilda.model.Isl in project open-kilda by telstra.

the class FermaIslRepositoryTest method shouldCreateAndFindIslByEndpoints.

@Test
public void shouldCreateAndFindIslByEndpoints() {
    Isl isl = createIsl(switchA, 1, switchB, 1);
    assertThat(islRepository.findAll(), Matchers.hasSize(1));
    Isl foundIsl = islRepository.findByEndpoints(TEST_SWITCH_A_ID, 1, TEST_SWITCH_B_ID, 1).get();
    assertEquals(isl, foundIsl);
}
Also used : Isl(org.openkilda.model.Isl) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Example 79 with Isl

use of org.openkilda.model.Isl in project open-kilda by telstra.

the class FermaIslRepositoryTest method shouldFindIslByPathId.

@Test
public void shouldFindIslByPathId() {
    Isl isl = createIsl(switchA, 111, switchB, 112);
    PathId pathId = new PathId("test_path_id");
    PathSegment segment = PathSegment.builder().pathId(pathId).srcSwitch(isl.getSrcSwitch()).srcPort(isl.getSrcPort()).destSwitch(isl.getDestSwitch()).destPort(isl.getDestPort()).build();
    FlowPath path = FlowPath.builder().pathId(pathId).srcSwitch(switchA).destSwitch(switchB).segments(Collections.singletonList(segment)).build();
    flowPathRepository.add(path);
    List<Isl> foundIsls = Lists.newArrayList(islRepository.findByPathIds(Collections.singletonList(pathId)));
    assertThat(foundIsls, Matchers.hasSize(1));
    assertThat(foundIsls, Matchers.contains(isl));
}
Also used : PathId(org.openkilda.model.PathId) Isl(org.openkilda.model.Isl) PathSegment(org.openkilda.model.PathSegment) FlowPath(org.openkilda.model.FlowPath) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Example 80 with Isl

use of org.openkilda.model.Isl in project open-kilda by telstra.

the class FermaIslRepositoryTest method shouldUpdateAvailableBandwidthForSameSharedBandwidthGroup.

@Test
public void shouldUpdateAvailableBandwidthForSameSharedBandwidthGroup() {
    Isl isl = createIsl(switchA, 1, switchB, 2, IslStatus.ACTIVE, 100L);
    isl.setMaxBandwidth(100L);
    createPathWithSegment("path1", switchA, 1, switchB, 2, 60L, TEST_FLOW_ID);
    createPathWithSegment("path2", switchA, 1, switchB, 2, 70L, TEST_FLOW_ID);
    islRepository.updateAvailableBandwidth(TEST_SWITCH_A_ID, 1, TEST_SWITCH_B_ID, 2);
    Isl islAfter = islRepository.findByEndpoints(TEST_SWITCH_A_ID, 1, TEST_SWITCH_B_ID, 2).get();
    assertEquals(30, islAfter.getAvailableBandwidth());
}
Also used : Isl(org.openkilda.model.Isl) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Aggregations

Isl (org.openkilda.model.Isl)83 Test (org.junit.Test)49 InMemoryGraphBasedTest (org.openkilda.persistence.inmemory.InMemoryGraphBasedTest)25 Endpoint (org.openkilda.wfm.share.model.Endpoint)18 Switch (org.openkilda.model.Switch)17 IslReference (org.openkilda.wfm.share.model.IslReference)11 SwitchId (org.openkilda.model.SwitchId)10 IslInfoData (org.openkilda.messaging.info.event.IslInfoData)9 IslDataHolder (org.openkilda.wfm.topology.network.model.IslDataHolder)8 ArrayList (java.util.ArrayList)6 PathId (org.openkilda.model.PathId)6 Flow (org.openkilda.model.Flow)5 IslRepository (org.openkilda.persistence.repositories.IslRepository)5 Collection (java.util.Collection)4 HashMap (java.util.HashMap)4 List (java.util.List)4 Map (java.util.Map)4 FlowPath (org.openkilda.model.FlowPath)4 PersistenceException (org.openkilda.persistence.exceptions.PersistenceException)4 IslFrame (org.openkilda.persistence.ferma.frames.IslFrame)4