/** * Construct a new {@link FlowModFlags} instance. * * @return A {@link FlowModFlags} instance. */ public FlowModFlags build() { return new FlowModFlags(checkOverlap, noBytCounts, noPktCounts, resetCounts, sendFlowRem); } }
public static FlowModFlags getDefaultInstance(String defaultValue) { List<java.lang.String> properties = Lists.newArrayList("cHECKOVERLAP", "nOBYTCOUNTS", "nOPKTCOUNTS", "rESETCOUNTS", "sENDFLOWREM" ); if (!properties.contains(defaultValue)) { throw new java.lang.IllegalArgumentException("invalid default parameter"); } int i = 0; return new FlowModFlags( properties.get(i++).equals(defaultValue) ? java.lang.Boolean.TRUE : null, properties.get(i++).equals(defaultValue) ? java.lang.Boolean.TRUE : null, properties.get(i++).equals(defaultValue) ? java.lang.Boolean.TRUE : null, properties.get(i++).equals(defaultValue) ? java.lang.Boolean.TRUE : null, properties.get(i++).equals(defaultValue) ? java.lang.Boolean.TRUE : null ); }
private static FlowBuilder internalToMDFlow(final Flow sourceFlow) { Preconditions.checkArgument(sourceFlow != null); // Instruct switch to let controller know when flow is removed. FlowModFlags flags = new FlowModFlags(false, false, false, false, true); return new FlowBuilder() .setHardTimeout(Integer.valueOf(sourceFlow.getHardTimeout())) .setIdleTimeout(Integer.valueOf(sourceFlow.getIdleTimeout())) .setCookie(new FlowCookie(BigInteger.valueOf(sourceFlow.getId()))) .setPriority(Integer.valueOf((sourceFlow.getPriority()))) .setFlags(flags) .setInstructions(MDFlowMapping.toApplyInstruction(toMDActions(sourceFlow.getActions()))) .setMatch(FromSalConversionsUtils.toMatch(sourceFlow.getMatch())); }
private FlowBuilder createBaseFlowForPortMatch(NodeConnector nc) { FlowBuilder floodFlow = new FlowBuilder().setTableId(flowTableId).setFlowName("flood"); floodFlow.setId(new FlowId(Long.toString(floodFlow.hashCode()))); Match match = new MatchBuilder().setInPort(nc.getId()).build(); floodFlow.setMatch(match) // .setPriority(flowPriority) // .setBufferId(OFConstants.OFP_NO_BUFFER) // .setHardTimeout(flowHardTimeout) // .setIdleTimeout(flowIdleTimeout) // .setCookie(new FlowCookie(BigInteger.valueOf(flowCookieInc.getAndIncrement()))) .setFlags(new FlowModFlags(false, false, false, false, false)); return floodFlow; }
private Flow createFlow(FlowId flowId, String flowName, Short tableId, int priority, Match match, Instructions instructions) { return new FlowBuilder() .setId(flowId) .setFlowName(flowName) .setTableId(tableId) .setMatch(match) .setInstructions(instructions) .setPriority(priority) .setBufferId(OFP_NO_BUFFER) .setHardTimeout(DEFAULT_HARD_TIMEOUT) .setIdleTimeout(DEFAULT_IDLE_TIMEOUT) .setFlags(new FlowModFlags(false,false,false,false,false)) .setCookie(new FlowCookie(BigInteger.valueOf(flowCookieInc.getAndIncrement()))) .build(); }
private Flow createArpReplyToControllerFlow(final ArpMessageAddress senderAddress, final Ipv4Address ipForRequestedMac) { checkNotNull(senderAddress); checkNotNull(ipForRequestedMac); FlowBuilder arpFlow = new FlowBuilder().setTableId(Service.CLASSIFIER.getTable()) .setFlowName(ARP_REPLY_TO_CONTROLLER_FLOW_NAME) .setPriority(ARP_REPLY_TO_CONTROLLER_FLOW_PRIORITY) .setBufferId(OFConstants.OFP_NO_BUFFER) .setIdleTimeout(0) .setHardTimeout(0) .setCookie(new FlowCookie(BigInteger.valueOf(flowCookie.incrementAndGet()))) .setFlags(new FlowModFlags(false, false, false, false, false)); EthernetMatch ethernetMatch = ArpFlowFactory.createEthernetMatch(senderAddress.getHardwareAddress()); ArpMatch arpMatch = ArpFlowFactory.createArpMatch(senderAddress, ipForRequestedMac); Match match = new MatchBuilder().setEthernetMatch(ethernetMatch).setLayer3Match(arpMatch).build(); arpFlow.setMatch(match); arpFlow.setInstructions(new InstructionsBuilder().setInstruction( ImmutableList.of(SEND_TO_CONTROLLER_INSTRUCTION)).build()); arpFlow.setId(createFlowId(ipForRequestedMac)); return arpFlow.build(); }
@Override protected AddFlowInputBuilder initialValue() { final AddFlowInputBuilder fb = new AddFlowInputBuilder(); fb.setPriority(PRIORITY); fb.setBufferId(BUFFER_ID); final FlowCookie cookie = new FlowCookie(BigInteger.TEN); fb.setCookie(cookie); fb.setCookieMask(cookie); fb.setTableId(TABLE_ID); fb.setHardTimeout(HARD_TIMEOUT); fb.setIdleTimeout(IDLE_TIMEOUT); fb.setFlags(new FlowModFlags(false, false, false, false, false)); return fb; } };
@Override protected FlowBuilder initialValue() { final FlowBuilder fb = new FlowBuilder(); fb.setPriority(PRIORITY); fb.setBufferId(BUFFER_ID); final FlowCookie cookie = new FlowCookie(BigInteger.TEN); fb.setCookie(cookie); fb.setCookieMask(cookie); fb.setTableId(TABLE_ID); fb.setHardTimeout(HARD_TIMEOUT); fb.setIdleTimeout(IDLE_TIMEOUT); fb.setFlags(new FlowModFlags(false, false, false, false, false)); return fb; } };
private Flow createArpReplyToControllerFlow(ArpMessageAddress senderAddress, Ipv4Address ipForRequestedMac, NodeConnectorId inPort) { checkNotNull(senderAddress); checkNotNull(ipForRequestedMac); FlowBuilder arpFlow = new FlowBuilder().setTableId(TABEL_FOR_ARP_FLOW) .setFlowName(ARP_REPLY_TO_CONTROLLER_FLOW_NAME) .setPriority(ARP_REPLY_TO_CONTROLLER_FLOW_PRIORITY) .setBufferId(OFConstants.OFP_NO_BUFFER) .setIdleTimeout(0) .setHardTimeout(0) .setFlags(new FlowModFlags(false, false, false, false, false)); EthernetMatch ethernetMatch = ArpFlowFactory.createEthernetMatch(); ArpMatch arpMatch = ArpFlowFactory.createArpMatch(senderAddress, ipForRequestedMac); Match match = new MatchBuilder().setEthernetMatch(ethernetMatch).setLayer3Match(arpMatch).setInPort(inPort).build(); arpFlow.setMatch(match); arpFlow.setInstructions(new InstructionsBuilder().setInstruction( ImmutableList.of(SEND_TO_CONTROLLER_INSTRUCTION)).build()); arpFlow.setId(createFlowId(ethernetMatch, arpMatch)); return arpFlow.build(); }
.setFlags(new FlowModFlags(false, false, false, false, false));
private FlowBuilder createLldpReplyToControllerFlow() { FlowBuilder lldpFlow = new FlowBuilder().setFlowName(createFlowName()) .setIdleTimeout(0) .setHardTimeout(0) .setCookie(new FlowCookie(BigInteger.valueOf(flowCookie.incrementAndGet()))) .setFlags(new FlowModFlags(false, false, false, false, false)) .setPriority(OFRendererConstants.LLDP_REPLY_TO_CONTROLLER_FLOW_PRIORITY); EthernetMatchBuilder ethernetMatchBuilder = new EthernetMatchBuilder() .setEthernetType(new EthernetTypeBuilder() .setType(new EtherType(Long.valueOf(OFRendererConstants.LLDP_ETHER_TYPE))).build()); Match match = new MatchBuilder().setEthernetMatch(ethernetMatchBuilder.build()).build(); lldpFlow.setMatch(match); Instructions instructions = createOutputInstructions(OutputPortValues.CONTROLLER); lldpFlow.setInstructions(instructions); FlowId flowId = new FlowId(createFlowName()); lldpFlow.setId(flowId); lldpFlow.setKey(new FlowKey(flowId)); return lldpFlow; } }
protected FlowBuilder createArpReplyToControllerFlow() { final FlowBuilder arpFlow = new FlowBuilder() .setPriority(OFRendererConstants.ARP_REPLY_TO_CONTROLLER_FLOW_PRIORITY) .setIdleTimeout(0) .setHardTimeout(0) .setCookie(new FlowCookie(BigInteger.valueOf(flowCookie.incrementAndGet()))) .setFlags(new FlowModFlags(false, false, false, false, false)); final EthernetMatch ethernetMatch = FlowUtils.createEthernetMatch(); /** NOTE: * Setting layer 3 match seems to be messing with the flow ID * check for possible bug on openflow plugin side. * Use following code for specific ARP REQUEST or REPLY packet capture * ArpMatch arpMatch = FlowUtils.createArpMatch(); */ final Match match = new MatchBuilder().setEthernetMatch(ethernetMatch).build();//.setLayer3Match(arpMatch).build(); arpFlow.setMatch(match); final Instructions instructions = createOutputInstructions(OutputPortValues.CONTROLLER, OutputPortValues.NORMAL); arpFlow.setInstructions(instructions); final String flowName = createFlowName(); arpFlow.setFlowName(flowName); final FlowId flowId = new FlowId(flowName); arpFlow.setId(flowId); arpFlow.setKey(new FlowKey(flowId)); return arpFlow; }
.setFlags(new FlowModFlags(false, false, false, false, false));
public static FlowBuilder createFlowBuilder( final short table, final int priority, final BigInteger cookieValue, final String flowName, MatchBuilder match, InstructionsBuilder isb) { FlowBuilder flow = new FlowBuilder(); String idStr = String.valueOf(flowIdInc.getAndIncrement()); flow.setId(new FlowId(idStr)); flow.setKey(new FlowKey(new FlowId(idStr))); flow.setTableId(table); flow.setFlowName(flowName); flow.setCookie(new FlowCookie(cookieValue)); flow.setCookieMask(new FlowCookie(cookieValue)); flow.setContainerName(null); flow.setStrict(false); flow.setMatch(match.build()); flow.setInstructions(isb.build()); flow.setPriority(priority); flow.setHardTimeout(0); flow.setIdleTimeout(0); flow.setFlags(new FlowModFlags(false, false, false, false, false)); if (null == flow.isBarrier()) { flow.setBarrier(Boolean.FALSE); } return flow; }
private Flow createLacpFlow () { FlowBuilder lFlow = new FlowBuilder().setTableId(flowTableId).setFlowName("lacpToCntrl"); lFlow.setId(new FlowId(Long.toString(lFlow.hashCode()))); EthernetMatchBuilder ethernetMatchBuilder = new EthernetMatchBuilder() .setEthernetType(new EthernetTypeBuilder() .setType(new EtherType(Long.valueOf(LacpUtil.LACP_ETHTYPE))).build()) .setEthernetDestination(new EthernetDestinationBuilder() .setAddress(LacpUtil.LACP_MAC).build()); Match match = new MatchBuilder() .setEthernetMatch(ethernetMatchBuilder.build()).build(); Action action = new ActionBuilder().setOrder(0).setKey(new ActionKey(0)) .setAction(new OutputActionCaseBuilder() .setOutputAction(new OutputActionBuilder() .setMaxLength(Integer.valueOf(0xffff)) .setOutputNodeConnector(new Uri(OutputPortValues.CONTROLLER.toString())) .build()).build()).build(); ApplyActions applyActions = new ApplyActionsBuilder().setAction(ImmutableList.of(action)).build(); Instruction applyActionsInstruction = new InstructionBuilder().setOrder(0) .setInstruction(new ApplyActionsCaseBuilder() .setApplyActions(applyActions) .build()).build(); lFlow.setMatch(match).setInstructions(new InstructionsBuilder() .setInstruction(ImmutableList.of(applyActionsInstruction)).build()) .setPriority(flowPriority).setBufferId(OFConstants.OFP_NO_BUFFER) .setHardTimeout(0).setIdleTimeout(0) .setCookie(new FlowCookie(BigInteger.valueOf(lacpCookie.getAndIncrement()))) .setFlags(new FlowModFlags(false, false, false, false, false)); return lFlow.build(); }
flow.setStrict(false); flow.setContainerName(null); flow.setFlags(new FlowModFlags(false, false, false, false, true)); flow.setId(new FlowId("12")); flow.setTableId(getTableId(tableId));
private static FlowBuilder createFlowBuilder(final long flowId, final String tableId, final String flowName) { FlowBuilder fBuild = new FlowBuilder(); fBuild.setMatch(new MatchBuilder().build()); fBuild.setInstructions(createPingInstructionsBuilder().build()); FlowKey key = new FlowKey(new FlowId(Long.toString(flowId))); fBuild.setBarrier(false); final BigInteger value = BigInteger.valueOf(10); fBuild.setCookie(new FlowCookie(value)); fBuild.setCookieMask(new FlowCookie(value)); fBuild.setHardTimeout(0); fBuild.setIdleTimeout(0); fBuild.setInstallHw(false); fBuild.setStrict(false); fBuild.setContainerName(null); fBuild.setFlags(new FlowModFlags(false, false, false, false, false)); fBuild.setId(new FlowId("12")); fBuild.setTableId(checkTableId(tableId)); fBuild.setOutGroup(2L); fBuild.setOutPort(value); fBuild.setKey(key); fBuild.setPriority(2); fBuild.setFlowName(flowName); return fBuild; }
@Override public Future<RpcResult<Void>> testFlow(TestFlowInput input) { AddFlowInputBuilder flow = new AddFlowInputBuilder(); flow.setPriority(2); flow.setMatch(createMatchBld().build()); flow.setInstructions(createDecNwTtlInstructionsBld().build()); flow.setBarrier(Boolean.FALSE); BigInteger value = BigInteger.valueOf(10L); flow.setCookie(new FlowCookie(value)); flow.setCookieMask(new FlowCookie(value)); flow.setHardTimeout(0); flow.setIdleTimeout(0); flow.setInstallHw(false); flow.setStrict(false); flow.setContainerName(null); flow.setFlags(new FlowModFlags(false, false, false, false, true)); flow.setTableId((short) 0); flow.setFlowName("NiciraFLOW"); // Construct the flow instance id final InstanceIdentifier<Node> flowInstanceId = InstanceIdentifier .builder(Nodes.class) // File under nodes .child(Node.class, new NodeKey(new NodeId("openflow:1"))).build(); // A particular node identified by nodeKey flow.setNode(new NodeRef(flowInstanceId)); pushFlowViaRpc(flow.build()); return Futures.immediateFuture(RpcResultBuilder.<Void>status(true).build()); }
static Flow createFlow() { FlowBuilder flowBuilder = new FlowBuilder(); flowBuilder.setMatch(new MatchBuilder().build()); flowBuilder.setInstructions(createSendToControllerInstructions().build()); flowBuilder.setPriority(0); FlowKey key = new FlowKey(new FlowId(DEFAULT_FLOW_ID)); flowBuilder.setBarrier(Boolean.FALSE); flowBuilder.setBufferId(OFConstants.OFP_NO_BUFFER); BigInteger value = BigInteger.valueOf(10L); flowBuilder.setCookie(new FlowCookie(value)); flowBuilder.setCookieMask(new FlowCookie(value)); flowBuilder.setHardTimeout(0); flowBuilder.setIdleTimeout(0); flowBuilder.setInstallHw(false); flowBuilder.setStrict(false); flowBuilder.setContainerName(null); flowBuilder.setFlags(new FlowModFlags(false, false, false, false, true)); flowBuilder.setId(new FlowId("12")); flowBuilder.setTableId(TABLE_ID); flowBuilder.setKey(key); flowBuilder.setFlowName(LLDP_PUNT_WHOLE_PACKET_FLOW); return flowBuilder.build(); }
flowBuilder.setStrict(false); flowBuilder.setContainerName(null); flowBuilder.setFlags(new FlowModFlags(false, false, false, false, true)); flowBuilder.setId(new FlowId(DEFAULT_FLOW_ID)); flowBuilder.setTableId(TABLE_ID);