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());
}
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());
}
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);
}
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));
}
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());
}
Aggregations