use of org.openkilda.model.PathId 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.PathId in project open-kilda by telstra.
the class FermaMirrorGroupRepositoryTest method shouldGetZeroMirrorGroupsForPath.
@Test
public void shouldGetZeroMirrorGroupsForPath() {
Collection<MirrorGroup> meters = mirrorGroupRepository.findByPathId(new PathId(TEST_PATH_ID));
assertTrue(meters.isEmpty());
}
use of org.openkilda.model.PathId in project open-kilda by telstra.
the class FermaFlowMeterRepositoryTest method shouldNotGetMoreThanOneMetersForPath.
@Ignore("InMemoryGraph doesn't enforce constraint")
@Test(expected = PersistenceException.class)
public void shouldNotGetMoreThanOneMetersForPath() {
createFlowMeter(1, new PathId(TEST_PATH_ID));
createFlowMeter(2, new PathId(TEST_PATH_ID));
flowMeterRepository.findByPathId(new PathId(TEST_PATH_ID));
}
use of org.openkilda.model.PathId in project open-kilda by telstra.
the class FermaFlowMeterRepositoryTest method findUnassignedMeterAndCreate.
private long findUnassignedMeterAndCreate(String flowId, String pathId) {
MeterId availableMeterId = flowMeterRepository.findFirstUnassignedMeter(theSwitch.getSwitchId(), MIN_METER_ID, MAX_METER_ID).get();
FlowMeter flowMeterId = FlowMeter.builder().switchId(theSwitch.getSwitchId()).meterId(availableMeterId).pathId(new PathId(flowId + "_" + pathId)).flowId(flowId).build();
flowMeterRepository.add(flowMeterId);
return availableMeterId.getValue();
}
use of org.openkilda.model.PathId in project open-kilda by telstra.
the class FermaIslRepositoryTest method createFlowWithPath.
private Flow createFlowWithPath(int forwardBandwidth, int reverseBandwidth) {
Flow flow = Flow.builder().flowId(TEST_FLOW_ID).srcSwitch(switchA).destSwitch(switchB).status(FlowStatus.UP).build();
FlowPath forwardPath = FlowPath.builder().srcSwitch(switchA).destSwitch(switchB).pathId(new PathId(TEST_FLOW_ID + "_forward_path")).cookie(new FlowSegmentCookie(1)).meterId(new MeterId(1)).status(FlowPathStatus.ACTIVE).bandwidth(forwardBandwidth).ignoreBandwidth(false).build();
flow.setForwardPath(forwardPath);
PathSegment forwardSegment = PathSegment.builder().pathId(forwardPath.getPathId()).srcSwitch(switchA).srcPort(1).destSwitch(switchB).destPort(2).build();
forwardPath.setSegments(Collections.singletonList(forwardSegment));
FlowPath reversePath = FlowPath.builder().srcSwitch(switchB).destSwitch(switchA).pathId(new PathId(TEST_FLOW_ID + "_reverse_path")).cookie(new FlowSegmentCookie(2)).meterId(new MeterId(2)).status(FlowPathStatus.ACTIVE).bandwidth(reverseBandwidth).ignoreBandwidth(false).build();
flow.setReversePath(reversePath);
PathSegment reverseSegment = PathSegment.builder().pathId(reversePath.getPathId()).srcSwitch(switchB).srcPort(2).destSwitch(switchA).destPort(1).build();
reversePath.setSegments(Collections.singletonList(reverseSegment));
flowRepository.add(flow);
return flow;
}
Aggregations