@Test public void createLocalL2Flow() { NodeConnectorId connectorId = new NodeConnectorId(OPENFLOW + CONNECTOR_0.getValue()); EndpointBuilder endpointBuilder = buildEndpoint(IPV6_1, MAC_0, connectorId); endpointBuilder.setNetworkContainment(SUBNET_0); Endpoint endpoint = endpointBuilder.setTenant(tenant.getId()).build(); List<Action> applyActions = new ArrayList<>(); applyActions.add(nxLoadRegAction(NxmNxReg2.class, BigInteger.valueOf(1))); applyActions.add(nxLoadRegAction(NxmNxReg3.class, BigInteger.valueOf(0))); applyActions.add(nxLoadRegAction(NxmNxReg7.class, BigInteger.valueOf(0))); int order = 0; Instruction applyActionsIns = new InstructionBuilder().setOrder(order++) .setInstruction(applyActionIns(applyActions.toArray(new Action[applyActions.size()]))) .build(); Instruction gotoTable = new InstructionBuilder().setOrder(order).setInstruction(gotoTableIns(tableId)).build(); ArrayList<Instruction> instructions = new ArrayList<>(); instructions.add(applyActionsIns); instructions.add(gotoTable); InstructionsBuilder instructionsBuilder = new InstructionsBuilder(); instructionsBuilder.setInstruction(instructions); MatchBuilder matchBuilder = new MatchBuilder().setEthernetMatch(ethernetMatch(null, endpoint.getMacAddress(), null)); OrdinalFactory.EndpointFwdCtxOrdinals ord = utils.getEndpointOrdinals(endpoint); addNxRegMatch(matchBuilder, RegMatch.of(NxmNxReg4.class, (long) ord.getBdId())); Match match = matchBuilder.build(); Flow flow = buildFlow(FlowIdUtils.newFlowId(tableId, "localL2", match), tableId, 80, match, instructionsBuilder.build()).build(); flows.createLocalL2Flow(tableId, 80, endpoint, ofWriter); verify(ofWriter, times(1)).writeFlow(eq(NODE_ID), eq(tableId), eq(flow)); }
void createLocalL2Flow(short goToTable, int priority, Endpoint endpoint, OfWriter ofWriter) { OfOverlayContext context = endpoint.getAugmentation(OfOverlayContext.class); OrdinalFactory.EndpointFwdCtxOrdinals ordinals = utils.getEndpointOrdinals(endpoint); Action setNextHop; try { setNextHop = nxLoadRegAction(NxmNxReg7.class, BigInteger.valueOf(getOfPortNum(context.getNodeConnectorId()))); } catch (NumberFormatException ex) { LOG.warn("Could not parse port number {}", context.getNodeConnectorId(), ex); return; } List<Action> applyActions = new ArrayList<>(); applyActions.add(nxLoadRegAction(NxmNxReg2.class, BigInteger.valueOf(ordinals.getEpgId()))); applyActions.add(nxLoadRegAction(NxmNxReg3.class, BigInteger.valueOf(ordinals.getCgId()))); applyActions.add(setNextHop); int order = 0; Instruction applyActionsIns = new InstructionBuilder().setOrder(order++) .setInstruction(applyActionIns(applyActions.toArray(new Action[applyActions.size()]))) .build(); Instruction gotoTable = new InstructionBuilder().setOrder(order) .setInstruction(gotoTableIns(goToTable)) .build(); ArrayList<Instruction> instructions = new ArrayList<>(); instructions.add(applyActionsIns); instructions.add(gotoTable); MatchBuilder matchBuilder = new MatchBuilder() .setEthernetMatch(ethernetMatch(null, endpoint.getMacAddress(), null)); addNxRegMatch(matchBuilder, RegMatch.of(NxmNxReg4.class, (long) ordinals.getBdId())); Match match = matchBuilder.build(); FlowId flowId = FlowIdUtils.newFlowId(tableId, "localL2", match); FlowBuilder flowBuilder = base(tableId).setId(flowId) .setPriority(priority) .setMatch(match) .setInstructions(new InstructionsBuilder().setInstruction(instructions).build()); ofWriter.writeFlow(nodeId, tableId, flowBuilder.build()); }
DestinationMapperFlows { void createLocalL2Flow(short goToTable, int priority, Endpoint endpoint, OfWriter ofWriter) { OfOverlayContext context = endpoint.getAugmentation(OfOverlayContext.class); OrdinalFactory.EndpointFwdCtxOrdinals ordinals = utils.getEndpointOrdinals(endpoint); Action setNextHop; try { setNextHop = nxLoadRegAction(NxmNxReg7.class, BigInteger.valueOf(getOfPortNum(context.getNodeConnectorId()))); } catch (NumberFormatException ex) { LOG.warn("Could not parse port number {}", context.getNodeConnectorId(), ex); return; } List<Action> applyActions = new ArrayList<>(); applyActions.add(nxLoadRegAction(NxmNxReg2.class, BigInteger.valueOf(ordinals.getEpgId()))); applyActions.add(nxLoadRegAction(NxmNxReg3.class, BigInteger.valueOf(ordinals.getCgId()))); applyActions.add(setNextHop); int order = 0; Instruction applyActionsIns = new InstructionBuilder().setOrder(order++) .setInstruction(applyActionIns(applyActions.toArray(new Action[applyActions.size()]))) .build(); Instruction gotoTable = new InstructionBuilder().setOrder(order) .setInstruction(gotoTableIns(goToTable)) .build(); ArrayList<Instruction> instructions = new ArrayList<>(); instructions.add(applyActionsIns); instructions.add(gotoTable); MatchBuilder matchBuilder = new MatchBuilder() .setEthernetMatch(ethernetMatch(null, endpoint.getMacAddress(), null)); addNxRegMatch(matchBuilder, RegMatch.of(NxmNxReg4.class, (long) ordinals.getBdId())); Match match = matchBuilder.build(); FlowId flowId = FlowIdUtils.newFlowId(tableId, "localL2", match); FlowBuilder flowBuilder = base(tableId).setId(flowId) .setPriority(priority) .setMatch(match) .setInstructions(new InstructionsBuilder().setInstruction(instructions).build()); ofWriter.writeFlow(nodeId, tableId, flowBuilder.build()); } }
DestinationMapperFlows { void createLocalL2Flow(short goToTable, int priority, Endpoint endpoint, OfWriter ofWriter) { OfOverlayContext context = endpoint.getAugmentation(OfOverlayContext.class); OrdinalFactory.EndpointFwdCtxOrdinals ordinals = utils.getEndpointOrdinals(endpoint); Action setNextHop; try { setNextHop = nxLoadRegAction(NxmNxReg7.class, BigInteger.valueOf(getOfPortNum(context.getNodeConnectorId()))); } catch (NumberFormatException ex) { LOG.warn("Could not parse port number {}", context.getNodeConnectorId(), ex); return; } List<Action> applyActions = new ArrayList<>(); applyActions.add(nxLoadRegAction(NxmNxReg2.class, BigInteger.valueOf(ordinals.getEpgId()))); applyActions.add(nxLoadRegAction(NxmNxReg3.class, BigInteger.valueOf(ordinals.getCgId()))); applyActions.add(setNextHop); int order = 0; Instruction applyActionsIns = new InstructionBuilder().setOrder(order++) .setInstruction(applyActionIns(applyActions.toArray(new Action[applyActions.size()]))) .build(); Instruction gotoTable = new InstructionBuilder().setOrder(order) .setInstruction(gotoTableIns(goToTable)) .build(); ArrayList<Instruction> instructions = new ArrayList<>(); instructions.add(applyActionsIns); instructions.add(gotoTable); MatchBuilder matchBuilder = new MatchBuilder() .setEthernetMatch(ethernetMatch(null, endpoint.getMacAddress(), null)); addNxRegMatch(matchBuilder, RegMatch.of(NxmNxReg4.class, (long) ordinals.getBdId())); Match match = matchBuilder.build(); FlowId flowId = FlowIdUtils.newFlowId(tableId, "localL2", match); FlowBuilder flowBuilder = base(tableId).setId(flowId) .setPriority(priority) .setMatch(match) .setInstructions(new InstructionsBuilder().setInstruction(instructions).build()); ofWriter.writeFlow(nodeId, tableId, flowBuilder.build()); } DestinationMapperFlows(DestinationMapperUtils utils, NodeId nodeId, short tableId); }
DestinationMapperFlows { void createLocalL2Flow(short goToTable, int priority, Endpoint endpoint, OfWriter ofWriter) { OfOverlayContext context = endpoint.getAugmentation(OfOverlayContext.class); OrdinalFactory.EndpointFwdCtxOrdinals ordinals = utils.getEndpointOrdinals(endpoint); Action setNextHop; try { setNextHop = nxLoadRegAction(NxmNxReg7.class, BigInteger.valueOf(getOfPortNum(context.getNodeConnectorId()))); } catch (NumberFormatException ex) { LOG.warn("Could not parse port number {}", context.getNodeConnectorId(), ex); return; } List<Action> applyActions = new ArrayList<>(); applyActions.add(nxLoadRegAction(NxmNxReg2.class, BigInteger.valueOf(ordinals.getEpgId()))); applyActions.add(nxLoadRegAction(NxmNxReg3.class, BigInteger.valueOf(ordinals.getCgId()))); applyActions.add(setNextHop); int order = 0; Instruction applyActionsIns = new InstructionBuilder().setOrder(order++) .setInstruction(applyActionIns(applyActions.toArray(new Action[applyActions.size()]))) .build(); Instruction gotoTable = new InstructionBuilder().setOrder(order) .setInstruction(gotoTableIns(goToTable)) .build(); ArrayList<Instruction> instructions = new ArrayList<>(); instructions.add(applyActionsIns); instructions.add(gotoTable); MatchBuilder matchBuilder = new MatchBuilder() .setEthernetMatch(ethernetMatch(null, endpoint.getMacAddress(), null)); addNxRegMatch(matchBuilder, RegMatch.of(NxmNxReg4.class, (long) ordinals.getBdId())); Match match = matchBuilder.build(); FlowId flowId = FlowIdUtils.newFlowId(tableId, "localL2", match); FlowBuilder flowBuilder = base(tableId).setId(flowId) .setPriority(priority) .setMatch(match) .setInstructions(new InstructionsBuilder().setInstruction(instructions).build()); ofWriter.writeFlow(nodeId, tableId, flowBuilder.build()); } DestinationMapperFlows(DestinationMapperUtils utils, NodeId nodeId, short tableId);  }
DestinationMapperFlows { void createLocalL2Flow(short goToTable, int priority, Endpoint endpoint, OfWriter ofWriter) { OfOverlayContext context = endpoint.getAugmentation(OfOverlayContext.class); OrdinalFactory.EndpointFwdCtxOrdinals ordinals = utils.getEndpointOrdinals(endpoint); Action setNextHop; try { setNextHop = nxLoadRegAction(NxmNxReg7.class, BigInteger.valueOf(getOfPortNum(context.getNodeConnectorId()))); } catch (NumberFormatException ex) { LOG.warn("Could not parse port number {}", context.getNodeConnectorId(), ex); return; } List<Action> applyActions = new ArrayList<>(); applyActions.add(nxLoadRegAction(NxmNxReg2.class, BigInteger.valueOf(ordinals.getEpgId()))); applyActions.add(nxLoadRegAction(NxmNxReg3.class, BigInteger.valueOf(ordinals.getCgId()))); applyActions.add(setNextHop); int order = 0; Instruction applyActionsIns = new InstructionBuilder().setOrder(order++) .setInstruction(applyActionIns(applyActions.toArray(new Action[applyActions.size()]))) .build(); Instruction gotoTable = new InstructionBuilder().setOrder(order) .setInstruction(gotoTableIns(goToTable)) .build(); ArrayList<Instruction> instructions = new ArrayList<>(); instructions.add(applyActionsIns); instructions.add(gotoTable); MatchBuilder matchBuilder = new MatchBuilder() .setEthernetMatch(ethernetMatch(null, endpoint.getMacAddress(), null)); addNxRegMatch(matchBuilder, RegMatch.of(NxmNxReg4.class, (long) ordinals.getBdId())); Match match = matchBuilder.build(); FlowId flowId = FlowIdUtils.newFlowId(tableId, "localL2", match); FlowBuilder flowBuilder = base(tableId).setId(flowId) .setPriority(priority) .setMatch(match) .setInstructions(new InstructionsBuilder().setInstruction(instructions).build()); ofWriter.writeFlow(nodeId, tableId, flowBuilder.build()); } DestinationMapperFlows(DestinationMapperUtils utils, NodeId nodeId, short tableId);   }