use of org.openkilda.model.FlowPath in project open-kilda by telstra.
the class FermaFlowPathRepositoryTest method createTestFlowPathPair.
private void createTestFlowPathPair() {
FlowPath forwardPath = createFlowPath(flow, "_forward", 1, 1, switchA, switchB);
flow.setForwardPath(forwardPath);
FlowPath reversePath = createFlowPath(flow, "_reverse", 2, 2, switchB, switchA);
flow.setReversePath(reversePath);
}
use of org.openkilda.model.FlowPath in project open-kilda by telstra.
the class FermaFlowPathRepositoryTest method buildTestFlow.
private Flow buildTestFlow(String flowId, Switch srcSwitch, int srcPort, int srcVlan, Switch destSwitch, int destPort, int destVlan) {
Flow flow = Flow.builder().flowId(flowId).srcSwitch(srcSwitch).srcPort(srcPort).srcVlan(srcVlan).destSwitch(destSwitch).destPort(destPort).destVlan(destVlan).encapsulationType(FlowEncapsulationType.TRANSIT_VLAN).status(FlowStatus.UP).build();
FlowPath forwardFlowPath = FlowPath.builder().pathId(new PathId(flowId + "_forward_path")).cookie(new FlowSegmentCookie(FlowPathDirection.FORWARD, 1L)).meterId(new MeterId(1)).srcSwitch(srcSwitch).destSwitch(destSwitch).status(FlowPathStatus.ACTIVE).build();
flow.setForwardPath(forwardFlowPath);
PathSegment forwardSegment = PathSegment.builder().pathId(forwardFlowPath.getPathId()).srcSwitch(srcSwitch).srcPort(srcPort).destSwitch(destSwitch).destPort(destPort).build();
forwardFlowPath.setSegments(Collections.singletonList(forwardSegment));
FlowPath reverseFlowPath = FlowPath.builder().pathId(new PathId(flowId + "_reverse_path")).cookie(new FlowSegmentCookie(FlowPathDirection.REVERSE, 1L)).meterId(new MeterId(2)).srcSwitch(destSwitch).destSwitch(srcSwitch).status(FlowPathStatus.ACTIVE).build();
flow.setReversePath(reverseFlowPath);
PathSegment reverseSegment = PathSegment.builder().pathId(reverseFlowPath.getPathId()).srcSwitch(destSwitch).srcPort(destPort).destSwitch(srcSwitch).destPort(srcPort).build();
reverseFlowPath.setSegments(Collections.singletonList(reverseSegment));
return flow;
}
use of org.openkilda.model.FlowPath in project open-kilda by telstra.
the class FermaFlowPathRepositoryTest method shouldFindActiveAffectedPaths.
@Test
public void shouldFindActiveAffectedPaths() {
FlowPath flowPath = createTestFlowPathWithIntermediate(switchC, 100);
flow.setForwardPath(flowPath);
Collection<FlowPath> paths = flowPathRepository.findBySegmentEndpoint(switchC.getSwitchId(), 100);
assertThat(paths, containsInAnyOrder(flowPath));
}
use of org.openkilda.model.FlowPath in project open-kilda by telstra.
the class FermaFlowMirrorPointsRepositoryTest method createFlowPathWithFlowMirrorPoints.
private void createFlowPathWithFlowMirrorPoints() {
FlowPath flowPath = FlowPath.builder().pathId(TEST_PATH_ID).srcSwitch(switchA).destSwitch(switchB).build();
flowPath.addFlowMirrorPoints(createTestFlowMirrorPoints());
flowPathRepository.add(flowPath);
}
use of org.openkilda.model.FlowPath in project open-kilda by telstra.
the class FermaFlowPathRepositoryTest method shouldKeepSegmentsOrdered.
@Test
public void shouldKeepSegmentsOrdered() {
FlowPath flowPath = createTestFlowPath();
List<PathSegment> segments = asList(PathSegment.builder().pathId(flowPath.getPathId()).srcSwitch(switchA).destSwitch(switchC).build(), PathSegment.builder().pathId(flowPath.getPathId()).srcSwitch(switchC).destSwitch(switchB).build());
flowPath.setSegments(segments);
Optional<FlowPath> foundPath = flowPathRepository.findById(flowPath.getPathId());
assertEquals(foundPath.get().getSegments().get(0).getDestSwitchId(), switchC.getSwitchId());
}
Aggregations