use of org.openkilda.model.Isl in project open-kilda by telstra.
the class FermaIslRepositoryTest method shouldUpdateAvailableBandwidthForAllKindsOfSharedBandwidthGroups.
@Test
public void shouldUpdateAvailableBandwidthForAllKindsOfSharedBandwidthGroups() {
Isl isl = createIsl(switchA, 1, switchB, 2, IslStatus.ACTIVE, 100L);
isl.setMaxBandwidth(100L);
createPathWithSegment("path1", switchA, 1, switchB, 2, 10L, "path12group");
createPathWithSegment("path2", switchA, 1, switchB, 2, 30L, "path12group");
createPathWithSegment("path3", switchA, 1, switchB, 2, 50L, "path3group");
createPathWithSegment("path4", switchA, 1, switchB, 2, 5L);
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(15, islAfter.getAvailableBandwidth());
}
use of org.openkilda.model.Isl in project open-kilda by telstra.
the class FermaIslRepositoryTest method shouldFindIslOccupiedByFlowWithAvailableBandwidth.
@Test
public void shouldFindIslOccupiedByFlowWithAvailableBandwidth() {
Isl isl = createIsl(switchA, 1, switchB, 2, IslStatus.ACTIVE, 101L);
Flow flow = createFlowWithPath(0, 0);
PathId pathId = flow.getPaths().stream().filter(path -> path.getSegments().get(0).getSrcPort() == isl.getSrcPort()).findAny().map(FlowPath::getPathId).orElseThrow(AssertionFailedError::new);
List<IslImmutableView> foundIsls = Lists.newArrayList(islRepository.findActiveByPathAndBandwidthAndEncapsulationType(pathId, 100, FlowEncapsulationType.TRANSIT_VLAN));
assertThat(foundIsls, Matchers.hasSize(1));
}
use of org.openkilda.model.Isl in project open-kilda by telstra.
the class FermaIslRepositoryTest method shouldNotUpdateAvailableBandwidthByPathIfDoesntMatch.
@Test
public void shouldNotUpdateAvailableBandwidthByPathIfDoesntMatch() {
Isl isl = createIsl(switchA, 1, switchB, 2, IslStatus.ACTIVE, 100L);
isl.setMaxBandwidth(100L);
createPathWithSegment(TEST_FLOW_ID + "_1", switchA, 1, switchB, 2, 33L);
Collection<?> updatedIsls = islRepository.updateAvailableBandwidthOnIslsOccupiedByPath(new PathId(TEST_FLOW_ID + "_faked")).values();
assertThat(updatedIsls, Matchers.empty());
Isl islAfter = islRepository.findByEndpoints(TEST_SWITCH_A_ID, 1, TEST_SWITCH_B_ID, 2).get();
assertEquals(100, islAfter.getAvailableBandwidth());
}
use of org.openkilda.model.Isl in project open-kilda by telstra.
the class FermaIslRepositoryTest method shouldUpdateAvailableBandwidth.
@Test
public void shouldUpdateAvailableBandwidth() {
Isl isl = createIsl(switchA, 1, switchB, 2, IslStatus.ACTIVE, 100L);
isl.setMaxBandwidth(100L);
createPathWithSegment(TEST_FLOW_ID, switchA, 1, switchB, 2, 33L);
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(67, islAfter.getAvailableBandwidth());
}
use of org.openkilda.model.Isl in project open-kilda by telstra.
the class FermaIslRepositoryTest method shouldFindActiveIslWithAvailableBandwidth.
@Test
public void shouldFindActiveIslWithAvailableBandwidth() {
Isl isl = createIsl(switchA, 111, switchB, 112, IslStatus.ACTIVE, 101L);
List<IslImmutableView> foundIsls = Lists.newArrayList(islRepository.findActiveByBandwidthAndEncapsulationType(100, FlowEncapsulationType.TRANSIT_VLAN));
assertThat(foundIsls, Matchers.hasSize(1));
assertEquals(isl.getAvailableBandwidth(), foundIsls.get(0).getAvailableBandwidth());
}
Aggregations