use of org.openkilda.model.MeterId in project open-kilda by telstra.
the class FlowValidationTestBase method buildOneSwitchPortFlow.
protected void buildOneSwitchPortFlow() {
Switch switchD = Switch.builder().switchId(TEST_SWITCH_ID_D).description("").build();
switchRepository.add(switchD);
Flow flow = Flow.builder().flowId(TEST_FLOW_ID_B).srcSwitch(switchD).srcPort(FLOW_B_SRC_PORT).srcVlan(FLOW_B_SRC_VLAN).destSwitch(switchD).destPort(FLOW_B_SRC_PORT).destVlan(FLOW_B_DST_VLAN).bandwidth(FLOW_B_BANDWIDTH).encapsulationType(FlowEncapsulationType.TRANSIT_VLAN).status(FlowStatus.UP).build();
FlowPath forwardFlowPath = FlowPath.builder().pathId(new PathId(TEST_FLOW_ID_B + "_forward_path")).cookie(new FlowSegmentCookie(FLOW_B_FORWARD_COOKIE)).meterId(new MeterId(FLOW_B_FORWARD_METER_ID)).srcSwitch(switchD).destSwitch(switchD).bandwidth(FLOW_B_BANDWIDTH).status(FlowPathStatus.ACTIVE).build();
flow.setForwardPath(forwardFlowPath);
FlowPath reverseFlowPath = FlowPath.builder().pathId(new PathId(TEST_FLOW_ID_B + "_reverse_path")).cookie(new FlowSegmentCookie(FLOW_B_REVERSE_COOKIE)).meterId(new MeterId(FLOW_B_REVERSE_METER_ID)).srcSwitch(switchD).destSwitch(switchD).bandwidth(FLOW_B_BANDWIDTH).status(FlowPathStatus.ACTIVE).build();
flow.setReversePath(reverseFlowPath);
flowRepository.add(flow);
}
use of org.openkilda.model.MeterId in project open-kilda by telstra.
the class FermaFlowPathRepositoryTest method createFlowPath.
private FlowPath createFlowPath(Flow flow, String suffixName, long cookie, long meterId, Switch srcSwitch, Switch dstSwitch) {
FlowPath flowPath = FlowPath.builder().pathId(new PathId(flow.getFlowId() + suffixName)).cookie(new FlowSegmentCookie(cookie)).meterId(new MeterId(meterId)).srcSwitch(srcSwitch).destSwitch(dstSwitch).status(FlowPathStatus.ACTIVE).build();
flowPathRepository.add(flowPath);
return flowPath;
}
use of org.openkilda.model.MeterId in project open-kilda by telstra.
the class SpeakerFlowSegmentRequestBuilderTest method buildFlowPath.
private FlowPath buildFlowPath(Flow flow, Switch srcSwitch, Switch dstSwitch, FlowSegmentCookie cookie) {
PathId forwardPathId = new PathId(UUID.randomUUID().toString());
TransitVlan forwardVlan = TransitVlan.builder().flowId(flow.getFlowId()).pathId(forwardPathId).vlan(vlanFactory.next()).build();
vlanRepository.add(forwardVlan);
return FlowPath.builder().bandwidth(flow.getBandwidth()).cookie(cookie).meterId(flow.getBandwidth() != 0 ? new MeterId(meterFactory.next()) : null).srcSwitch(srcSwitch).destSwitch(dstSwitch).pathId(forwardPathId).build();
}
use of org.openkilda.model.MeterId in project open-kilda by telstra.
the class SimpleSwitchRuleConverterTest method buildFlow.
private Flow buildFlow(FlowEncapsulationType flowEncapsulationType, boolean checkWithGroup) {
Switch switchA = Switch.builder().switchId(TEST_SWITCH_ID_A).description("").build();
Switch switchB = Switch.builder().switchId(TEST_SWITCH_ID_B).description("").build();
Switch switchC = Switch.builder().switchId(TEST_SWITCH_ID_C).description("").build();
Flow flow = Flow.builder().flowId(TEST_FLOW_ID_A).srcSwitch(switchA).srcPort(FLOW_A_SRC_PORT).srcVlan(FLOW_A_SRC_VLAN).destSwitch(switchC).destPort(FLOW_A_DST_PORT).destVlan(FLOW_A_DST_VLAN).allocateProtectedPath(true).encapsulationType(flowEncapsulationType).bandwidth(FLOW_A_BANDWIDTH).status(FlowStatus.UP).build();
FlowPath forwardFlowPath = FlowPath.builder().pathId(FLOW_A_FORWARD_PATH_ID).cookie(new FlowSegmentCookie(FLOW_A_FORWARD_COOKIE_VALUE)).meterId(new MeterId(FLOW_A_FORWARD_METER_ID)).srcSwitch(switchA).destSwitch(switchC).status(FlowPathStatus.ACTIVE).bandwidth(FLOW_A_BANDWIDTH).build();
flow.setForwardPath(forwardFlowPath);
PathSegment forwardSegmentA = PathSegment.builder().pathId(forwardFlowPath.getPathId()).srcSwitch(switchA).srcPort(FLOW_A_SEGMENT_A_SRC_PORT).destSwitch(switchB).destPort(FLOW_A_SEGMENT_A_DST_PORT).build();
PathSegment forwardSegmentB = PathSegment.builder().pathId(forwardFlowPath.getPathId()).srcSwitch(switchB).srcPort(FLOW_A_SEGMENT_B_SRC_PORT).destSwitch(switchC).destPort(FLOW_A_SEGMENT_B_DST_PORT).build();
forwardFlowPath.setSegments(Lists.newArrayList(forwardSegmentA, forwardSegmentB));
if (checkWithGroup) {
FlowMirrorPoints flowMirrorPoints = FlowMirrorPoints.builder().mirrorSwitch(switchA).mirrorGroup(MirrorGroup.builder().switchId(TEST_SWITCH_ID_A).groupId(new GroupId(FLOW_GROUP_ID_A)).pathId(FLOW_A_FORWARD_PATH_ID).flowId(TEST_FLOW_ID_A).mirrorGroupType(MirrorGroupType.TRAFFIC_INTEGRITY).mirrorDirection(MirrorDirection.INGRESS).build()).build();
FlowMirrorPath flowMirrorPath = FlowMirrorPath.builder().pathId(new PathId("mirror_path")).mirrorSwitch(switchA).egressSwitch(switchA).egressPort(FLOW_GROUP_ID_A_OUT_PORT).egressOuterVlan(FLOW_GROUP_ID_A_OUT_VLAN).build();
flowMirrorPoints.addPaths(flowMirrorPath);
forwardFlowPath.addFlowMirrorPoints(flowMirrorPoints);
}
return flow;
}
use of org.openkilda.model.MeterId in project open-kilda by telstra.
the class SimpleSwitchRuleConverterTest method buildOneSwitchPortFlow.
private Flow buildOneSwitchPortFlow() {
Switch switchD = Switch.builder().switchId(TEST_SWITCH_ID_D).description("").build();
Flow flow = Flow.builder().flowId(TEST_FLOW_ID_B).srcSwitch(switchD).srcPort(FLOW_B_SRC_PORT).srcVlan(FLOW_B_SRC_VLAN).destSwitch(switchD).destPort(FLOW_B_SRC_PORT).destVlan(FLOW_B_DST_VLAN).encapsulationType(FlowEncapsulationType.TRANSIT_VLAN).bandwidth(FLOW_B_BANDWIDTH).status(FlowStatus.UP).build();
FlowPath forwardFlowPath = FlowPath.builder().pathId(new PathId(TEST_FLOW_ID_B + "_forward_path")).cookie(new FlowSegmentCookie(FLOW_B_FORWARD_COOKIE_VALUE)).meterId(new MeterId(FLOW_B_FORWARD_METER_ID)).srcSwitch(switchD).destSwitch(switchD).status(FlowPathStatus.ACTIVE).bandwidth(FLOW_B_BANDWIDTH).build();
flow.setForwardPath(forwardFlowPath);
return flow;
}
Aggregations