Search in sources :

Example 6 with Segment

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());
}
Also used : PathComputer(org.openkilda.pce.PathComputer) SwitchId(org.openkilda.model.SwitchId) Segment(org.openkilda.pce.Path.Segment) PathSegment(org.openkilda.model.PathSegment) Flow(org.openkilda.model.Flow) GetPathsResult(org.openkilda.pce.GetPathsResult)

Aggregations

Segment (org.openkilda.pce.Path.Segment)6 PathSegment (org.openkilda.model.PathSegment)5 SwitchId (org.openkilda.model.SwitchId)4 Flow (org.openkilda.model.Flow)3 GetPathsResult (org.openkilda.pce.GetPathsResult)3 Path (org.openkilda.pce.Path)3 PathComputer (org.openkilda.pce.PathComputer)3 ArrayList (java.util.ArrayList)2 FlowPath (org.openkilda.model.FlowPath)2 PathNodePayload (org.openkilda.messaging.payload.flow.PathNodePayload)1 SwitchProperties (org.openkilda.model.SwitchProperties)1