use of org.openkilda.model.FlowPath in project open-kilda by telstra.
the class FermaFlowPathRepositoryTest method shouldFindPathBySegmentSwitch.
@Test
public void shouldFindPathBySegmentSwitch() {
FlowPath flowPath = createTestFlowPathWithIntermediate(switchC, 100);
flow.setForwardPath(flowPath);
Collection<FlowPath> foundPaths = flowPathRepository.findBySegmentSwitch(switchC.getSwitchId());
assertThat(foundPaths, hasSize(1));
}
use of org.openkilda.model.FlowPath in project open-kilda by telstra.
the class FermaFlowPathRepositoryTest method shouldFlowPathUpdateKeepFlowRelations.
@Test
public void shouldFlowPathUpdateKeepFlowRelations() {
createTestFlowPathPair();
Flow foundFlow = flowRepository.findById(TEST_FLOW_ID).get();
assertThat(foundFlow.getPaths(), hasSize(2));
FlowPath flowPath = foundFlow.getPaths().stream().filter(path -> path.getPathId().equals(flow.getReversePathId())).findAny().get();
flowPath.setStatus(FlowPathStatus.INACTIVE);
foundFlow = flowRepository.findById(TEST_FLOW_ID).get();
assertThat(foundFlow.getPaths(), hasSize(2));
}
use of org.openkilda.model.FlowPath in project open-kilda by telstra.
the class FermaFlowPathRepositoryTest method shouldCreateFlowPaths.
@Test
public void shouldCreateFlowPaths() {
createTestFlowPathPair();
Collection<FlowPath> allPaths = flowPathRepository.findAll();
assertThat(allPaths, hasSize(2));
FlowPath foundForwardPath = flowPathRepository.findById(flow.getForwardPathId()).get();
assertEquals(switchA.getSwitchId(), foundForwardPath.getSrcSwitchId());
assertEquals(switchB.getSwitchId(), foundForwardPath.getDestSwitchId());
Flow foundFlow = flowRepository.findById(TEST_FLOW_ID).get();
assertThat(foundFlow.getPaths(), hasSize(2));
assertEquals(foundFlow.getFlowId(), foundForwardPath.getFlow().getFlowId());
}
use of org.openkilda.model.FlowPath in project open-kilda by telstra.
the class FermaFlowPathRepositoryTest method buildTestProtectedFlow.
private Flow buildTestProtectedFlow(String flowId, Switch srcSwitch, int srcPort, int srcVlan, Switch destSwitch, int destPort, int destVlan) {
Flow flow = buildTestFlow(flowId, srcSwitch, srcPort, srcVlan, destSwitch, destPort, destVlan);
FlowPath forwardProtectedFlowPath = FlowPath.builder().pathId(new PathId(flowId + "_forward_protected_path")).cookie(new FlowSegmentCookie(FlowPathDirection.FORWARD, 2L)).srcSwitch(srcSwitch).destSwitch(destSwitch).status(FlowPathStatus.ACTIVE).build();
flow.setProtectedForwardPath(forwardProtectedFlowPath);
PathSegment forwardSegment = PathSegment.builder().pathId(forwardProtectedFlowPath.getPathId()).srcSwitch(srcSwitch).srcPort(srcPort).destSwitch(destSwitch).destPort(destPort).build();
forwardProtectedFlowPath.setSegments(Collections.singletonList(forwardSegment));
FlowPath reverseProtectedFlowPath = FlowPath.builder().pathId(new PathId(flowId + "_reverse_protected_path")).cookie(new FlowSegmentCookie(FlowPathDirection.REVERSE, 2L)).srcSwitch(destSwitch).destSwitch(srcSwitch).status(FlowPathStatus.ACTIVE).build();
flow.setProtectedReversePath(reverseProtectedFlowPath);
PathSegment reverseSegment = PathSegment.builder().pathId(reverseProtectedFlowPath.getPathId()).srcSwitch(destSwitch).srcPort(destPort).destSwitch(srcSwitch).destPort(srcPort).build();
reverseProtectedFlowPath.setSegments(Collections.singletonList(reverseSegment));
return flow;
}
use of org.openkilda.model.FlowPath in project open-kilda by telstra.
the class FermaFlowPathRepositoryTest method createTestFlowPath.
private FlowPath createTestFlowPath() {
FlowPath flowPath = createFlowPath(flow, "_path", 1, 1, switchA, switchB);
flow.setForwardPath(flowPath);
return flowPath;
}
Aggregations