use of org.openkilda.persistence.repositories.IslRepository.IslImmutableView in project open-kilda by telstra.
the class FermaIslRepositoryTest method shouldSkipIslOccupiedByFlowWithNoEnoughBandwidth.
@Test
public void shouldSkipIslOccupiedByFlowWithNoEnoughBandwidth() {
createIsl(switchA, 1, switchB, 2, IslStatus.ACTIVE, 99L);
Flow flow = createFlowWithPath(0, 0);
List<IslImmutableView> foundIsls = Lists.newArrayList(islRepository.findActiveByPathAndBandwidthAndEncapsulationType(flow.getPathIds().iterator().next(), 100, FlowEncapsulationType.TRANSIT_VLAN));
assertThat(foundIsls, Matchers.hasSize(0));
}
use of org.openkilda.persistence.repositories.IslRepository.IslImmutableView in project open-kilda by telstra.
the class AvailableNetworkFactoryTest method shouldBuildAvailableNetworkUsingSymmetricCostStrategy.
@Test
public void shouldBuildAvailableNetworkUsingSymmetricCostStrategy() throws RecoverableException {
Flow flow = getFlow(false);
IslImmutableView isl = getIslView(flow);
when(config.getNetworkStrategy()).thenReturn("SYMMETRIC_COST");
when(islRepository.findSymmetricActiveByBandwidthAndEncapsulationType(flow.getBandwidth(), flow.getEncapsulationType())).thenReturn(Collections.singletonList(isl));
AvailableNetwork availableNetwork = availableNetworkFactory.getAvailableNetwork(flow, Collections.emptyList());
assertAvailableNetworkIsCorrect(isl, availableNetwork);
}
use of org.openkilda.persistence.repositories.IslRepository.IslImmutableView in project open-kilda by telstra.
the class AvailableNetworkFactoryTest method shouldBuildAvailableNetworkUsingCostStrategy.
@Test
public void shouldBuildAvailableNetworkUsingCostStrategy() throws RecoverableException {
Flow flow = getFlow(false);
IslImmutableView isl = getIslView(flow);
when(config.getNetworkStrategy()).thenReturn("COST");
when(islRepository.findActiveByBandwidthAndEncapsulationType(flow.getBandwidth(), flow.getEncapsulationType())).thenReturn(Collections.singletonList(isl));
AvailableNetwork availableNetwork = availableNetworkFactory.getAvailableNetwork(flow, Collections.emptyList());
assertAvailableNetworkIsCorrect(isl, availableNetwork);
}
use of org.openkilda.persistence.repositories.IslRepository.IslImmutableView 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.persistence.repositories.IslRepository.IslImmutableView 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