use of org.openkilda.pce.model.FindPathResult in project open-kilda by telstra.
the class BestWeightAndShortestPathFinderTest method shouldAddIntermediateSwitchWeightOnceMaxWeightStrategyBackUpWay.
@Test
public void shouldAddIntermediateSwitchWeightOnceMaxWeightStrategyBackUpWay() throws UnroutableFlowException {
// a path with backUpMaxWeight 201
FindPathResult pathResult = addIntermediateSwitchWeightOnceMaxWeightStrategy(100L, 201L);
assertTrue(pathResult.isBackUpPathComputationWayUsed());
}
use of org.openkilda.pce.model.FindPathResult in project open-kilda by telstra.
the class BestWeightAndShortestPathFinderTest method shouldReturnThePathBottomClosestToMaxWeight.
/**
* Ensure system picks path closest to maxWeight from the bottom. Omit closest path from the top even if it is
* closer than the one from the bottom
*/
@Test
public void shouldReturnThePathBottomClosestToMaxWeight() throws UnroutableFlowException {
// a path with maxWeight 200
FindPathResult pathResult = findThePathBottomClosestToMaxWeight(200L, Long.MAX_VALUE);
assertFalse(pathResult.isBackUpPathComputationWayUsed());
}
use of org.openkilda.pce.model.FindPathResult in project open-kilda by telstra.
the class BestWeightAndShortestPathFinderTest method findThePathClosestToMaxWeight.
private FindPathResult findThePathClosestToMaxWeight(long maxWeight, long backUpMaxWeight) throws UnroutableFlowException {
// given 3 paths that cost: 198, 200, 201
AvailableNetwork network = buildThreePathsNetwork();
BestWeightAndShortestPathFinder pathFinder = new BestWeightAndShortestPathFinder(ALLOWED_DEPTH);
// when: request a path with maxWeight 201
FindPathResult pathResult = pathFinder.findPathWithWeightCloseToMaxWeight(network, SWITCH_ID_1, SWITCH_ID_5, WEIGHT_FUNCTION, maxWeight, backUpMaxWeight);
Pair<List<Edge>, List<Edge>> pairPath = pathResult.getFoundPath();
// then: system picks 200 path
List<SwitchId> forwardSwitches = getInvolvedSwitches(pairPath.getLeft());
assertThat(forwardSwitches, equalTo(Arrays.asList(SWITCH_ID_1, SWITCH_ID_3, SWITCH_ID_5)));
assertThat(getInvolvedSwitches(pairPath.getRight()), equalTo(Lists.reverse(forwardSwitches)));
return pathResult;
}
use of org.openkilda.pce.model.FindPathResult in project open-kilda by telstra.
the class BestWeightAndShortestPathFinderTest method shouldCreatePathThrowMoreExpensiveBackUpWayMaxLatencyStrategy.
@Test
public void shouldCreatePathThrowMoreExpensiveBackUpWayMaxLatencyStrategy() throws UnroutableFlowException {
FindPathResult pathResult = findPathThrowMoreExpensiveWayMaxLatencyStrategy(100L, 10201L);
assertTrue(pathResult.isBackUpPathComputationWayUsed());
}
use of org.openkilda.pce.model.FindPathResult in project open-kilda by telstra.
the class BestWeightAndShortestPathFinderTest method shouldAddIntermediateSwitchWeightOnceMaxWeightStrategy.
@Test
public void shouldAddIntermediateSwitchWeightOnceMaxWeightStrategy() throws UnroutableFlowException {
// a path with maxWeight 201
FindPathResult pathResult = addIntermediateSwitchWeightOnceMaxWeightStrategy(201L, Long.MAX_VALUE);
assertFalse(pathResult.isBackUpPathComputationWayUsed());
}
Aggregations