use of org.openkilda.pce.Path.Segment in project open-kilda by telstra.
the class InMemoryPathComputerBaseTest method affinityPathShouldPreferIslsUsedByMainPath.
void affinityPathShouldPreferIslsUsedByMainPath(PathComputationStrategy pathComputationStrategy) throws Exception {
createTestTopologyForAffinityTesting();
Flow flow = Flow.builder().flowId("new-flow").affinityGroupId(TEST_FLOW_ID).bandwidth(10).srcSwitch(getSwitchById("00:0E")).destSwitch(getSwitchById("00:0F")).encapsulationType(FlowEncapsulationType.TRANSIT_VLAN).pathComputationStrategy(pathComputationStrategy).build();
PathComputer pathComputer = pathComputerFactory.getPathComputer();
GetPathsResult affinityPath = pathComputer.getPath(flow);
List<Segment> segments = affinityPath.getForward().getSegments();
assertEquals(3, segments.size());
assertEquals(new SwitchId("00:0E"), segments.get(0).getSrcSwitchId());
assertEquals(new SwitchId("00:0A"), segments.get(1).getSrcSwitchId());
assertEquals(new SwitchId("00:0B"), segments.get(2).getSrcSwitchId());
assertEquals(new SwitchId("00:0A"), segments.get(0).getDestSwitchId());
assertEquals(new SwitchId("00:0B"), segments.get(1).getDestSwitchId());
assertEquals(new SwitchId("00:0F"), segments.get(2).getDestSwitchId());
}
Aggregations