@Test public void createBroadcastFlow() throws Exception { Endpoint testEndpoint = buildEndpoint(IPV4_0, MAC_0, CONNECTOR_1).build(); when(ctx.getEndpointManager()).thenReturn(endpointManager); when(ctx.getTenant(Mockito.any(TenantId.class))).thenReturn(getTestIndexedTenant()); when(ctx.getCurrentPolicy()).thenReturn(policyInfo); OrdinalFactory.EndpointFwdCtxOrdinals ordinals = OrdinalFactory.getEndpointFwdCtxOrdinals(ctx, testEndpoint); InOrder order = inOrder(ctx); order.verify(ctx, times(1)).getEndpointManager(); order.verify(ctx, times(1)).getCurrentPolicy(); verify(ctx, times(3)).getTenant(TENANT_ID); assertNotNull(ordinals); Action reg5 = FlowUtils.nxLoadRegAction(NxmNxReg5.class, BigInteger.valueOf(4)); InstructionsBuilder instructionsBuilder = new InstructionsBuilder(); List<Instruction> instructions = new ArrayList<>(); InstructionBuilder ordinalsInstruction = new InstructionBuilder(); ordinalsInstruction.setInstruction(FlowUtils.applyActionIns(reg5)).setOrder(0); InstructionBuilder goToInstruction = new InstructionBuilder(); goToInstruction.setInstruction(FlowUtils.gotoTableIns((short) 3)).setOrder(1); instructions.add(ordinalsInstruction.build()); instructions.add(goToInstruction.build()); instructionsBuilder.setInstruction(instructions); MatchBuilder matchBuilder = new MatchBuilder(); matchBuilder.setInPort(new NodeConnectorId(CONNECTOR_1)); FlowUtils.addNxTunIdMatch(matchBuilder, 4); Match match = matchBuilder.build(); Flow testFlow = buildFlow(FlowIdUtils.newFlowId(tableId, "tunnelFdId", match), tableId, 80, match, instructionsBuilder.build()).build(); flows.createBroadcastFlow((short) 3, 80, new NodeConnectorId(CONNECTOR_1), ordinals, ofWriter); verify(ofWriter, times(1)).writeFlow(NODE_ID, tableId, testFlow); }
public void createBroadcastFlow(short goToTable, int priority, NodeConnectorId tunnel, OrdinalFactory.EndpointFwdCtxOrdinals remoteOrdinals, OfWriter ofWriter) { int fdId = remoteOrdinals.getFdId(); MatchBuilder matchBuilder = new MatchBuilder().setInPort(tunnel); addNxTunIdMatch(matchBuilder, fdId); Action fdReg = nxLoadRegAction(NxmNxReg5.class, BigInteger.valueOf(fdId)); Match match = matchBuilder.build(); FlowId flowId = FlowIdUtils.newFlowId(tableId, "tunnelFdId", match); FlowBuilder flowBuilder = base(tableId).setId(flowId) .setPriority(priority) .setMatch(match) .setInstructions(instructions(applyActionIns(fdReg), gotoTableIns(goToTable))); ofWriter.writeFlow(nodeId, tableId, flowBuilder.build()); }
SourceMapperFlows { public void createBroadcastFlow(short goToTable, int priority, NodeConnectorId tunnel, OrdinalFactory.EndpointFwdCtxOrdinals remoteOrdinals, OfWriter ofWriter) { int fdId = remoteOrdinals.getFdId(); MatchBuilder matchBuilder = new MatchBuilder().setInPort(tunnel); addNxTunIdMatch(matchBuilder, fdId); Action fdReg = nxLoadRegAction(NxmNxReg5.class, BigInteger.valueOf(fdId)); Match match = matchBuilder.build(); FlowId flowId = FlowIdUtils.newFlowId(tableId, "tunnelFdId", match); FlowBuilder flowBuilder = base(tableId).setId(flowId) .setPriority(priority) .setMatch(match) .setInstructions(instructions(applyActionIns(fdReg), gotoTableIns(goToTable))); ofWriter.writeFlow(nodeId, tableId, flowBuilder.build()); } }
SourceMapperFlows { public void createBroadcastFlow(short goToTable, int priority, NodeConnectorId tunnel, OrdinalFactory.EndpointFwdCtxOrdinals remoteOrdinals, OfWriter ofWriter) { int fdId = remoteOrdinals.getFdId(); MatchBuilder matchBuilder = new MatchBuilder().setInPort(tunnel); addNxTunIdMatch(matchBuilder, fdId); Action fdReg = nxLoadRegAction(NxmNxReg5.class, BigInteger.valueOf(fdId)); Match match = matchBuilder.build(); FlowId flowId = FlowIdUtils.newFlowId(tableId, "tunnelFdId", match); FlowBuilder flowBuilder = base(tableId).setId(flowId) .setPriority(priority) .setMatch(match) .setInstructions(instructions(applyActionIns(fdReg), gotoTableIns(goToTable))); ofWriter.writeFlow(nodeId, tableId, flowBuilder.build()); } SourceMapperFlows(NodeId nodeId, short tableId); }
SourceMapperFlows { public void createBroadcastFlow(short goToTable, int priority, NodeConnectorId tunnel, OrdinalFactory.EndpointFwdCtxOrdinals remoteOrdinals, OfWriter ofWriter) { int fdId = remoteOrdinals.getFdId(); MatchBuilder matchBuilder = new MatchBuilder().setInPort(tunnel); addNxTunIdMatch(matchBuilder, fdId); Action fdReg = nxLoadRegAction(NxmNxReg5.class, BigInteger.valueOf(fdId)); Match match = matchBuilder.build(); FlowId flowId = FlowIdUtils.newFlowId(tableId, "tunnelFdId", match); FlowBuilder flowBuilder = base(tableId).setId(flowId) .setPriority(priority) .setMatch(match) .setInstructions(instructions(applyActionIns(fdReg), gotoTableIns(goToTable))); ofWriter.writeFlow(nodeId, tableId, flowBuilder.build()); } SourceMapperFlows(NodeId nodeId, short tableId); void synchronizeEp(short goToTable, int priority, OrdinalFactory.EndpointFwdCtxOrdinals ordinals,
                              MacAddress macAddress, NodeConnectorId nodeConnectorId, OfWriter ofWriter); void createTunnelFlow(short goToTable, int priority, NodeConnectorId tunnel,
                                 OrdinalFactory.EndpointFwdCtxOrdinals remoteOrdinals, OfWriter ofWriter); void createBroadcastFlow(short goToTable, int priority, NodeConnectorId tunnel,
                                    OrdinalFactory.EndpointFwdCtxOrdinals remoteOrdinals, OfWriter ofWriter); }
SourceMapperFlows { public void createBroadcastFlow(short goToTable, int priority, NodeConnectorId tunnel, OrdinalFactory.EndpointFwdCtxOrdinals remoteOrdinals, OfWriter ofWriter) { int fdId = remoteOrdinals.getFdId(); MatchBuilder matchBuilder = new MatchBuilder().setInPort(tunnel); addNxTunIdMatch(matchBuilder, fdId); Action fdReg = nxLoadRegAction(NxmNxReg5.class, BigInteger.valueOf(fdId)); Match match = matchBuilder.build(); FlowId flowId = FlowIdUtils.newFlowId(tableId, "tunnelFdId", match); FlowBuilder flowBuilder = base(tableId).setId(flowId) .setPriority(priority) .setMatch(match) .setInstructions(instructions(applyActionIns(fdReg), gotoTableIns(goToTable))); ofWriter.writeFlow(nodeId, tableId, flowBuilder.build()); } SourceMapperFlows(NodeId nodeId, short tableId); void synchronizeEp(short goToTable, int priority, OrdinalFactory.EndpointFwdCtxOrdinals ordinals,
                              MacAddress macAddress, NodeConnectorId nodeConnectorId, OfWriter ofWriter); void createTunnelFlow(short goToTable, int priority, NodeConnectorId tunnel,
                                 OrdinalFactory.EndpointFwdCtxOrdinals remoteOrdinals, OfWriter ofWriter); void createBroadcastFlow(short goToTable, int priority, NodeConnectorId tunnel,
                                    OrdinalFactory.EndpointFwdCtxOrdinals remoteOrdinals, OfWriter ofWriter);  }