private static MatchBuilder createInphyportMatch(NodeId nodeId) { MatchBuilder match = new MatchBuilder(); match.setInPort(new NodeConnectorId(nodeId + ":202")); match.setInPhyPort(new NodeConnectorId(nodeId + ":10122")); return match; }
@Override public Optional<Action> process(@Nonnull final SetFieldCase source, final ActionResponseConvertorData data, ConvertorExecutor convertorExecutor) { final VersionDatapathIdConvertorData datapathIdConvertorData = new VersionDatapathIdConvertorData(data.getVersion()); final SetFieldAction setFieldAction = source.getSetFieldAction(); final SetFieldBuilder setField = new SetFieldBuilder(); final Optional<MatchBuilder> matchOptional = convertorExecutor.convert(setFieldAction, datapathIdConvertorData); setField.fieldsFrom(matchOptional.orElse(new MatchBuilder()).build()); return Optional.of(new SetFieldCaseBuilder().setSetField(setField.build()).build()); } }
private void programConntrackInvDropRule(Long dpidLong, String segmentationId, long localPort, String attachMac, Integer priority, boolean write) { MatchBuilder matchBuilder = new MatchBuilder(); String flowName = "Ingress_Fixed_Conntrk_InvDrop_" + segmentationId + "_" + localPort + "_"; matchBuilder = MatchUtils.createV4EtherMatchWithType(matchBuilder,null,attachMac, MatchUtils.ETHERTYPE_IPV4); matchBuilder = MatchUtils.addCtState(matchBuilder,MatchUtils.TRACKED_INV_CT_STATE, MatchUtils.TRACKED_INV_CT_STATE_MASK); FlowBuilder flowBuilder = FlowUtils.createFlowBuilder(flowName, priority, matchBuilder, getTable()); addPipelineInstruction(flowBuilder, null, true); NodeBuilder nodeBuilder = FlowUtils.createNodeBuilder(dpidLong); syncFlow(flowBuilder ,nodeBuilder, write); }
private void programArpRule(Long dpid, String segmentationId, long localPort, String attachedMac, boolean write) { MatchBuilder matchBuilder = new MatchBuilder(); String flowId = "Egress_ARP_" + segmentationId + "_" + localPort + "_"; MatchUtils.createV4EtherMatchWithType(matchBuilder,null,null,MatchUtils.ETHERTYPE_ARP); MatchUtils.addArpMacMatch(matchBuilder, attachedMac, null); FlowBuilder flowBuilder = FlowUtils.createFlowBuilder(flowId, Constants.PROTO_MATCH_PRIORITY, matchBuilder, getTable()); addPipelineInstruction(flowBuilder, null, false); NodeBuilder nodeBuilder = FlowUtils.createNodeBuilder(dpid); syncFlow(flowBuilder ,nodeBuilder, write); }
private void addTcpSynFlagMatchIpv4Drop(Long dpidLong, String segmentationId, String dstMac, boolean write, Integer priority) { String flowId = "Ingress_TCP_Ipv4_" + segmentationId + "_" + dstMac + "_DROP"; MatchBuilder matchBuilder = new MatchBuilder(); matchBuilder = MatchUtils.createV4EtherMatchWithType(matchBuilder,null,dstMac,MatchUtils.ETHERTYPE_IPV4); matchBuilder = MatchUtils.addTcpSynMatch(matchBuilder); FlowBuilder flowBuilder = FlowUtils.createFlowBuilder(flowId, priority, matchBuilder, getTable()); addPipelineInstruction(flowBuilder, null, true); NodeBuilder nodeBuilder = FlowUtils.createNodeBuilder(dpidLong); syncFlow(flowBuilder, nodeBuilder, write); }
private void programConntrackNewDropRule(Long dpidLong, String segmentationId, long localPort, String attachMac, Integer priority, boolean write) { MatchBuilder matchBuilder = new MatchBuilder(); String flowName = "Ingress_Fixed_Conntrk_NewDrop_" + segmentationId + "_" + localPort + "_"; matchBuilder = MatchUtils.createV4EtherMatchWithType(matchBuilder,null,attachMac,0x0800L); matchBuilder = MatchUtils.addCtState(matchBuilder,MatchUtils.TRACKED_NEW_CT_STATE, MatchUtils.TRACKED_NEW_CT_STATE_MASK); FlowBuilder flowBuilder = FlowUtils.createFlowBuilder(flowName, priority, matchBuilder, getTable()); addPipelineInstruction(flowBuilder, null, true); NodeBuilder nodeBuilder = FlowUtils.createNodeBuilder(dpidLong); syncFlow(flowBuilder ,nodeBuilder, write); }
private void addTcpSynFlagMatchIpv4Drop(Long dpidLong, String segmentationId, String srcMac, boolean write, Integer priority) { String flowName = "Egress_TCP_Ipv4_" + segmentationId + "_" + srcMac + "_DROP"; MatchBuilder matchBuilder = new MatchBuilder(); matchBuilder = MatchUtils.createV4EtherMatchWithType(matchBuilder,srcMac,null,MatchUtils.ETHERTYPE_IPV4); matchBuilder = MatchUtils.addTcpSynMatch(matchBuilder); FlowBuilder flowBuilder = FlowUtils.createFlowBuilder(flowName, priority, matchBuilder, getTable()); addPipelineInstruction(flowBuilder, null, true); NodeBuilder nodeBuilder = FlowUtils.createNodeBuilder(dpidLong); syncFlow(flowBuilder, nodeBuilder, write); }
private void programConntrackUntrackRule(Long dpidLong, String segmentationId, long localPort, String attachMac, Integer priority, boolean write) { MatchBuilder matchBuilder = new MatchBuilder(); String flowName = "Egress_Fixed_Conntrk_Untrk_" + segmentationId + "_" + localPort + "_"; matchBuilder = MatchUtils.createV4EtherMatchWithType(matchBuilder, attachMac, null,MatchUtils.ETHERTYPE_IPV4); matchBuilder = MatchUtils.addCtState(matchBuilder,MatchUtils.UNTRACKED_CT_STATE, MatchUtils.UNTRACKED_CT_STATE_MASK); FlowBuilder flowBuilder = FlowUtils.createFlowBuilder(flowName, priority, matchBuilder, getTable()); addInstructionWithConntrackRecirc(flowBuilder); NodeBuilder nodeBuilder = FlowUtils.createNodeBuilder(dpidLong); syncFlow(flowBuilder ,nodeBuilder, write); }
private void programConntrackTrackedPlusEstRule(Long dpidLong, String segmentationId, long localPort,Integer priority, boolean write) { MatchBuilder matchBuilder = new MatchBuilder(); String flowName = "Egress_Fixed_Conntrk_TrkEst_" + segmentationId + "_" + localPort + "_"; matchBuilder = MatchUtils.createInPortMatch(matchBuilder, dpidLong, localPort); matchBuilder = MatchUtils.addCtState(matchBuilder,MatchUtils.TRACKED_EST_CT_STATE, MatchUtils.TRACKED_CT_STATE_MASK); FlowBuilder flowBuilder = FlowUtils.createFlowBuilder(flowName, priority, matchBuilder, getTable()); addPipelineInstruction(flowBuilder, null, false); NodeBuilder nodeBuilder = FlowUtils.createNodeBuilder(dpidLong); syncFlow(flowBuilder ,nodeBuilder, write); }
private void programConntrackTrackedPlusRelRule(Long dpidLong, String segmentationId, long localPort,Integer priority, boolean write) { MatchBuilder matchBuilder = new MatchBuilder(); String flowName = "Egress_Fixed_Conntrk_TrkRel_" + segmentationId + "_" + localPort + "_"; matchBuilder = MatchUtils.createInPortMatch(matchBuilder, dpidLong, localPort); matchBuilder = MatchUtils.addCtState(matchBuilder,MatchUtils.TRACKED_REL_CT_STATE, MatchUtils.TRACKED_CT_STATE_MASK); FlowBuilder flowBuilder = FlowUtils.createFlowBuilder(flowName, priority, matchBuilder, getTable()); addPipelineInstruction(flowBuilder, null, false); NodeBuilder nodeBuilder = FlowUtils.createNodeBuilder(dpidLong); syncFlow(flowBuilder ,nodeBuilder, write); }
private void programConntrackInvDropRule(Long dpidLong, String segmentationId, long localPort, Integer priority, boolean write) { MatchBuilder matchBuilder = new MatchBuilder(); String flowName = "Egress_Fixed_Conntrk_InvDrop_" + segmentationId + "_" + localPort + "_"; matchBuilder = MatchUtils.createInPortMatch(matchBuilder, dpidLong, localPort); matchBuilder = MatchUtils.addCtState(matchBuilder,MatchUtils.TRACKED_INV_CT_STATE, MatchUtils.TRACKED_INV_CT_STATE_MASK); FlowBuilder flowBuilder = FlowUtils.createFlowBuilder(flowName, priority, matchBuilder, getTable()); addPipelineInstruction(flowBuilder, null, true); NodeBuilder nodeBuilder = FlowUtils.createNodeBuilder(dpidLong); syncFlow(flowBuilder ,nodeBuilder, write); }
private void programConntrackTrackedPlusEstRule(Long dpidLong, String segmentationId, long localPort, String attachMac,Integer priority, boolean write) { MatchBuilder matchBuilder = new MatchBuilder(); String flowName = "Ingress_Fixed_Conntrk_TrkEst_" + segmentationId + "_" + localPort + "_"; matchBuilder = MatchUtils.createV4EtherMatchWithType(matchBuilder,null,attachMac,MatchUtils.ETHERTYPE_IPV4); matchBuilder = MatchUtils.addCtState(matchBuilder,MatchUtils.TRACKED_EST_CT_STATE, MatchUtils.TRACKED_CT_STATE_MASK); FlowBuilder flowBuilder = FlowUtils.createFlowBuilder(flowName, priority, matchBuilder, getTable()); addPipelineInstruction(flowBuilder, null, false); NodeBuilder nodeBuilder = FlowUtils.createNodeBuilder(dpidLong); syncFlow(flowBuilder ,nodeBuilder, write); }
private void addTcpSynFlagMatchIpv6Drop(Long dpidLong, String segmentationId, String srcMac, boolean write, Integer priority) { String flowName = "Egress_TCP_Ipv6_" + segmentationId + "_" + srcMac + "_DROP"; MatchBuilder matchBuilder = new MatchBuilder(); matchBuilder = MatchUtils.createV6EtherMatchWithType(matchBuilder,srcMac,null); matchBuilder = MatchUtils.addTcpSynMatch(matchBuilder); FlowBuilder flowBuilder = FlowUtils.createFlowBuilder(flowName, priority, matchBuilder, getTable()); addPipelineInstruction(flowBuilder, null, true); NodeBuilder nodeBuilder = FlowUtils.createNodeBuilder(dpidLong); syncFlow(flowBuilder, nodeBuilder, write); }
private static MatchBuilder createLLDPMatch() { final MatchBuilder match = new MatchBuilder(); final EthernetMatchBuilder eth = new EthernetMatchBuilder(); final EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder(); ethTypeBuilder.setType(new EtherType(0x88ccL)); eth.setEthernetType(ethTypeBuilder.build()); match.setEthernetMatch(eth.build()); return match; }
/** * @return */ private static MatchBuilder createMatch3() { final MatchBuilder match = new MatchBuilder(); final EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder(); final EthernetSourceBuilder ethSourceBuilder = new EthernetSourceBuilder(); ethSourceBuilder.setAddress(new MacAddress("00:00:00:00:00:01")); ethernetMatch.setEthernetSource(ethSourceBuilder.build()); match.setEthernetMatch(ethernetMatch.build()); return match; }
private static MatchBuilder createLLDPMatch() { MatchBuilder match = new MatchBuilder(); EthernetMatchBuilder eth = new EthernetMatchBuilder(); EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder(); ethTypeBuilder.setType(new EtherType(0x88ccL)); eth.setEthernetType(ethTypeBuilder.build()); match.setEthernetMatch(eth.build()); return match; }
/** * @return */ private static MatchBuilder createMatch3() { MatchBuilder match = new MatchBuilder(); EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder(); EthernetSourceBuilder ethSourceBuilder = new EthernetSourceBuilder(); ethSourceBuilder.setAddress(new MacAddress("00:00:00:00:00:01")); ethernetMatch.setEthernetSource(ethSourceBuilder.build()); match.setEthernetMatch(ethernetMatch.build()); return match; }
private Flow allowFromTunnel(NodeConnectorId tunPort) { MatchBuilder mb = new MatchBuilder().setInPort(tunPort); addNxRegMatch(mb, RegMatch.of(NxmNxReg1.class, 0xffffffL)); Match match = mb.build(); FlowId flowId = FlowIdUtils.newFlowId(TABLE_ID, "tunnelallow", match); FlowBuilder flow = base().setId(flowId).setMatch(match).setPriority(65000).setInstructions( instructions(applyActionIns(nxOutputRegAction(NxmNxReg7.class)))); return flow.build(); }
private Flow allowSameEpg(int epgId) { MatchBuilder mb = new MatchBuilder(); addNxRegMatch(mb, RegMatch.of(NxmNxReg0.class, (long) epgId), RegMatch.of(NxmNxReg2.class, (long) epgId)); Match match = mb.build(); FlowId flowId = FlowIdUtils.newFlowId(TABLE_ID, "intraallow", match); FlowBuilder flow = base().setId(flowId).setMatch(match).setPriority(65000).setInstructions( instructions(applyActionIns(nxOutputRegAction(NxmNxReg7.class)))); return flow.build(); }
private static Flow allowFromChainTunnel(NodeConnectorId tunPort, short tableId) { MatchBuilder mb = new MatchBuilder().setInPort(tunPort); addNxRegMatch(mb, RegMatch.of(NxmNxReg1.class, 0xffffffL)); Match match = mb.build(); FlowId flowId = FlowIdUtils.newFlowId(tableId, "chainport", match); FlowBuilder flow = base(tableId).setId(flowId).setMatch(match).setPriority(65000).setInstructions( instructions(applyActionIns(nxPopNshAction(), nxOutputRegAction(NxmNxReg7.class)))); return flow.build(); }