Search in sources :

Example 51 with FlowPath

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);
}
Also used : FlowPath(org.openkilda.model.FlowPath)

Example 52 with FlowPath

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;
}
Also used : PathId(org.openkilda.model.PathId) FlowSegmentCookie(org.openkilda.model.cookie.FlowSegmentCookie) PathSegment(org.openkilda.model.PathSegment) FlowPath(org.openkilda.model.FlowPath) Flow(org.openkilda.model.Flow) MeterId(org.openkilda.model.MeterId)

Example 53 with FlowPath

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));
}
Also used : FlowPath(org.openkilda.model.FlowPath) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Example 54 with 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);
}
Also used : FlowPath(org.openkilda.model.FlowPath)

Example 55 with 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());
}
Also used : PathSegment(org.openkilda.model.PathSegment) FlowPath(org.openkilda.model.FlowPath) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Aggregations

FlowPath (org.openkilda.model.FlowPath)229 Flow (org.openkilda.model.Flow)128 Test (org.junit.Test)108 PathId (org.openkilda.model.PathId)65 PathSegment (org.openkilda.model.PathSegment)42 SwitchId (org.openkilda.model.SwitchId)40 ArrayList (java.util.ArrayList)39 FlowSegmentCookie (org.openkilda.model.cookie.FlowSegmentCookie)33 InMemoryGraphBasedTest (org.openkilda.persistence.inmemory.InMemoryGraphBasedTest)29 Switch (org.openkilda.model.Switch)28 FlowSpeakerData (org.openkilda.rulemanager.FlowSpeakerData)27 SpeakerData (org.openkilda.rulemanager.SpeakerData)27 Action (org.openkilda.rulemanager.action.Action)26 PopVlanAction (org.openkilda.rulemanager.action.PopVlanAction)26 PopVxlanAction (org.openkilda.rulemanager.action.PopVxlanAction)26 PortOutAction (org.openkilda.rulemanager.action.PortOutAction)26 PushVlanAction (org.openkilda.rulemanager.action.PushVlanAction)26 SetFieldAction (org.openkilda.rulemanager.action.SetFieldAction)26 MeterId (org.openkilda.model.MeterId)20 YFlow (org.openkilda.model.YFlow)19