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(); }
static { ApplyActions applyActions = new ApplyActionsBuilder() .setAction(ImmutableList.of(ArpFlowFactory.createSendToControllerAction(0))) .build(); SEND_TO_CONTROLLER_INSTRUCTION = new InstructionBuilder() .setOrder(0) .setInstruction(new ApplyActionsCaseBuilder().setApplyActions(applyActions).build()) .build(); }