@Test public void createTunnelFlow() throws Exception { Endpoint testEndpoint = buildEndpoint(IPV4_0, MAC_0, CONNECTOR_0).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 reg0 = FlowUtils.nxLoadRegAction(NxmNxReg0.class, BigInteger.valueOf(1)); Action reg1 = FlowUtils.nxLoadRegAction(NxmNxReg1.class, BigInteger.valueOf(0xffffff)); Action reg4 = FlowUtils.nxLoadRegAction(NxmNxReg4.class, BigInteger.valueOf(3)); Action reg5 = FlowUtils.nxLoadRegAction(NxmNxReg5.class, BigInteger.valueOf(4)); Action reg6 = FlowUtils.nxLoadRegAction(NxmNxReg6.class, BigInteger.valueOf(5)); InstructionsBuilder instructionsBuilder = new InstructionsBuilder(); List<Instruction> instructions = new ArrayList<>(); InstructionBuilder ordinalsInstruction = new InstructionBuilder(); ordinalsInstruction.setInstruction(FlowUtils.applyActionIns(reg0, reg1, reg4, reg5, reg6)).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_0)); FlowUtils.addNxTunIdMatch(matchBuilder, ordinals.getTunnelId()); Match match = matchBuilder.build(); Flow testFlow = buildFlow(FlowIdUtils.newFlowId(tableId, "tunnel", match), tableId, 80, match, instructionsBuilder.build()).build(); flows.createTunnelFlow((short) 3, 80, new NodeConnectorId(CONNECTOR_0), ordinals, ofWriter); verify(ofWriter, times(1)).writeFlow(NODE_ID, tableId, testFlow); }
public void createTunnelFlow(short goToTable, int priority, NodeConnectorId tunnel, OrdinalFactory.EndpointFwdCtxOrdinals remoteOrdinals, OfWriter ofWriter) { int egId = remoteOrdinals.getEpgId(); int bdId = remoteOrdinals.getBdId(); int fdId = remoteOrdinals.getFdId(); int l3Id = remoteOrdinals.getL3Id(); int tunnelId = remoteOrdinals.getTunnelId(); MatchBuilder matchBuilder = new MatchBuilder().setInPort(tunnel); addNxTunIdMatch(matchBuilder, tunnelId); Action segReg = nxLoadRegAction(NxmNxReg0.class, BigInteger.valueOf(egId)); Action scgReg = nxLoadRegAction(NxmNxReg1.class, BigInteger.valueOf(0xffffff)); Action bdReg = nxLoadRegAction(NxmNxReg4.class, BigInteger.valueOf(bdId)); Action fdReg = nxLoadRegAction(NxmNxReg5.class, BigInteger.valueOf(fdId)); Action vrfReg = nxLoadRegAction(NxmNxReg6.class, BigInteger.valueOf(l3Id)); Match match = matchBuilder.build(); FlowId flowId = FlowIdUtils.newFlowId(tableId, "tunnel", match); FlowBuilder flowBuilder = base(tableId).setId(flowId) .setPriority(priority) .setMatch(match) .setInstructions( instructions(applyActionIns(segReg, scgReg, bdReg, fdReg, vrfReg), gotoTableIns(goToTable))); ofWriter.writeFlow(nodeId, tableId, flowBuilder.build()); }
SourceMapperFlows { public void createTunnelFlow(short goToTable, int priority, NodeConnectorId tunnel, OrdinalFactory.EndpointFwdCtxOrdinals remoteOrdinals, OfWriter ofWriter) { int egId = remoteOrdinals.getEpgId(); int bdId = remoteOrdinals.getBdId(); int fdId = remoteOrdinals.getFdId(); int l3Id = remoteOrdinals.getL3Id(); int tunnelId = remoteOrdinals.getTunnelId(); MatchBuilder matchBuilder = new MatchBuilder().setInPort(tunnel); addNxTunIdMatch(matchBuilder, tunnelId); Action segReg = nxLoadRegAction(NxmNxReg0.class, BigInteger.valueOf(egId)); Action scgReg = nxLoadRegAction(NxmNxReg1.class, BigInteger.valueOf(0xffffff)); Action bdReg = nxLoadRegAction(NxmNxReg4.class, BigInteger.valueOf(bdId)); Action fdReg = nxLoadRegAction(NxmNxReg5.class, BigInteger.valueOf(fdId)); Action vrfReg = nxLoadRegAction(NxmNxReg6.class, BigInteger.valueOf(l3Id)); Match match = matchBuilder.build(); FlowId flowId = FlowIdUtils.newFlowId(tableId, "tunnel", match); FlowBuilder flowBuilder = base(tableId).setId(flowId) .setPriority(priority) .setMatch(match) .setInstructions( instructions(applyActionIns(segReg, scgReg, bdReg, fdReg, vrfReg), gotoTableIns(goToTable))); ofWriter.writeFlow(nodeId, tableId, flowBuilder.build()); } }
SourceMapperFlows { public void createTunnelFlow(short goToTable, int priority, NodeConnectorId tunnel, OrdinalFactory.EndpointFwdCtxOrdinals remoteOrdinals, OfWriter ofWriter) { int egId = remoteOrdinals.getEpgId(); int bdId = remoteOrdinals.getBdId(); int fdId = remoteOrdinals.getFdId(); int l3Id = remoteOrdinals.getL3Id(); int tunnelId = remoteOrdinals.getTunnelId(); MatchBuilder matchBuilder = new MatchBuilder().setInPort(tunnel); addNxTunIdMatch(matchBuilder, tunnelId); Action segReg = nxLoadRegAction(NxmNxReg0.class, BigInteger.valueOf(egId)); Action scgReg = nxLoadRegAction(NxmNxReg1.class, BigInteger.valueOf(0xffffff)); Action bdReg = nxLoadRegAction(NxmNxReg4.class, BigInteger.valueOf(bdId)); Action fdReg = nxLoadRegAction(NxmNxReg5.class, BigInteger.valueOf(fdId)); Action vrfReg = nxLoadRegAction(NxmNxReg6.class, BigInteger.valueOf(l3Id)); Match match = matchBuilder.build(); FlowId flowId = FlowIdUtils.newFlowId(tableId, "tunnel", match); FlowBuilder flowBuilder = base(tableId).setId(flowId) .setPriority(priority) .setMatch(match) .setInstructions( instructions(applyActionIns(segReg, scgReg, bdReg, fdReg, vrfReg), gotoTableIns(goToTable))); ofWriter.writeFlow(nodeId, tableId, flowBuilder.build()); } SourceMapperFlows(NodeId nodeId, short tableId); }
SourceMapperFlows { public void createTunnelFlow(short goToTable, int priority, NodeConnectorId tunnel, OrdinalFactory.EndpointFwdCtxOrdinals remoteOrdinals, OfWriter ofWriter) { int egId = remoteOrdinals.getEpgId(); int bdId = remoteOrdinals.getBdId(); int fdId = remoteOrdinals.getFdId(); int l3Id = remoteOrdinals.getL3Id(); int tunnelId = remoteOrdinals.getTunnelId(); MatchBuilder matchBuilder = new MatchBuilder().setInPort(tunnel); addNxTunIdMatch(matchBuilder, tunnelId); Action segReg = nxLoadRegAction(NxmNxReg0.class, BigInteger.valueOf(egId)); Action scgReg = nxLoadRegAction(NxmNxReg1.class, BigInteger.valueOf(0xffffff)); Action bdReg = nxLoadRegAction(NxmNxReg4.class, BigInteger.valueOf(bdId)); Action fdReg = nxLoadRegAction(NxmNxReg5.class, BigInteger.valueOf(fdId)); Action vrfReg = nxLoadRegAction(NxmNxReg6.class, BigInteger.valueOf(l3Id)); Match match = matchBuilder.build(); FlowId flowId = FlowIdUtils.newFlowId(tableId, "tunnel", match); FlowBuilder flowBuilder = base(tableId).setId(flowId) .setPriority(priority) .setMatch(match) .setInstructions( instructions(applyActionIns(segReg, scgReg, bdReg, fdReg, vrfReg), 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 createTunnelFlow(short goToTable, int priority, NodeConnectorId tunnel, OrdinalFactory.EndpointFwdCtxOrdinals remoteOrdinals, OfWriter ofWriter) { int egId = remoteOrdinals.getEpgId(); int bdId = remoteOrdinals.getBdId(); int fdId = remoteOrdinals.getFdId(); int l3Id = remoteOrdinals.getL3Id(); int tunnelId = remoteOrdinals.getTunnelId(); MatchBuilder matchBuilder = new MatchBuilder().setInPort(tunnel); addNxTunIdMatch(matchBuilder, tunnelId); Action segReg = nxLoadRegAction(NxmNxReg0.class, BigInteger.valueOf(egId)); Action scgReg = nxLoadRegAction(NxmNxReg1.class, BigInteger.valueOf(0xffffff)); Action bdReg = nxLoadRegAction(NxmNxReg4.class, BigInteger.valueOf(bdId)); Action fdReg = nxLoadRegAction(NxmNxReg5.class, BigInteger.valueOf(fdId)); Action vrfReg = nxLoadRegAction(NxmNxReg6.class, BigInteger.valueOf(l3Id)); Match match = matchBuilder.build(); FlowId flowId = FlowIdUtils.newFlowId(tableId, "tunnel", match); FlowBuilder flowBuilder = base(tableId).setId(flowId) .setPriority(priority) .setMatch(match) .setInstructions( instructions(applyActionIns(segReg, scgReg, bdReg, fdReg, vrfReg), 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);  }