@Test public void synchronizeEp() throws Exception { Endpoint testEndpoint = buildEndpoint(IPV4_0, MAC_1, 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 reg0 = FlowUtils.nxLoadRegAction(NxmNxReg0.class, BigInteger.valueOf(1)); Action reg1 = FlowUtils.nxLoadRegAction(NxmNxReg1.class, BigInteger.valueOf(0)); 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)); Action tunnelId = FlowUtils.nxLoadTunIdAction(BigInteger.valueOf(ordinals.getTunnelId()), false); InstructionsBuilder instructionsBuilder = new InstructionsBuilder(); List<Instruction> instructions = new ArrayList<>(); InstructionBuilder ordinalsInstruction = new InstructionBuilder(); ordinalsInstruction.setInstruction(FlowUtils.applyActionIns(reg0, reg1, reg4, reg5, reg6, tunnelId)).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.setEthernetMatch(FlowUtils.ethernetMatch(new MacAddress(MAC_1), null, null)) .setInPort(new NodeConnectorId(CONNECTOR_1)); Match match = matchBuilder.build(); Flow testFlow = buildFlow(FlowIdUtils.newFlowId(tableId, "ep", match), tableId, 90, match, instructionsBuilder.build()).build(); flows.synchronizeEp((short) 3, 90, ordinals, new MacAddress(MAC_1), new NodeConnectorId(CONNECTOR_1), ofWriter); verify(ofWriter, times(1)).writeFlow(NODE_ID, tableId, testFlow); }
public void synchronizeEp(short goToTable, int priority, OrdinalFactory.EndpointFwdCtxOrdinals ordinals, MacAddress macAddress, NodeConnectorId nodeConnectorId, OfWriter ofWriter) { int egId = ordinals.getEpgId(); int bdId = ordinals.getBdId(); int fdId = ordinals.getFdId(); int l3Id = ordinals.getL3Id(); int cgId = ordinals.getCgId(); int tunnelId = ordinals.getTunnelId(); Action segReg = nxLoadRegAction(NxmNxReg0.class, BigInteger.valueOf(egId)); Action scgReg = nxLoadRegAction(NxmNxReg1.class, BigInteger.valueOf(cgId)); Action bdReg = nxLoadRegAction(NxmNxReg4.class, BigInteger.valueOf(bdId)); Action fdReg = nxLoadRegAction(NxmNxReg5.class, BigInteger.valueOf(fdId)); Action vrfReg = nxLoadRegAction(NxmNxReg6.class, BigInteger.valueOf(l3Id)); Action tunIdAction = nxLoadTunIdAction(BigInteger.valueOf(tunnelId), false); Match match = new MatchBuilder().setEthernetMatch(ethernetMatch(macAddress, null, null)) .setInPort(nodeConnectorId) .build(); FlowId flowid = FlowIdUtils.newFlowId(tableId, "ep", match); FlowBuilder flowBuilder = base(tableId).setPriority(priority) .setId(flowid) .setMatch(match) .setInstructions( instructions(applyActionIns(segReg, scgReg, bdReg, fdReg, vrfReg, tunIdAction), gotoTableIns(goToTable))); ofWriter.writeFlow(nodeId, tableId, flowBuilder.build()); }
SourceMapperFlows { public void synchronizeEp(short goToTable, int priority, OrdinalFactory.EndpointFwdCtxOrdinals ordinals, MacAddress macAddress, NodeConnectorId nodeConnectorId, OfWriter ofWriter) { int egId = ordinals.getEpgId(); int bdId = ordinals.getBdId(); int fdId = ordinals.getFdId(); int l3Id = ordinals.getL3Id(); int cgId = ordinals.getCgId(); int tunnelId = ordinals.getTunnelId(); Action segReg = nxLoadRegAction(NxmNxReg0.class, BigInteger.valueOf(egId)); Action scgReg = nxLoadRegAction(NxmNxReg1.class, BigInteger.valueOf(cgId)); Action bdReg = nxLoadRegAction(NxmNxReg4.class, BigInteger.valueOf(bdId)); Action fdReg = nxLoadRegAction(NxmNxReg5.class, BigInteger.valueOf(fdId)); Action vrfReg = nxLoadRegAction(NxmNxReg6.class, BigInteger.valueOf(l3Id)); Action tunIdAction = nxLoadTunIdAction(BigInteger.valueOf(tunnelId), false); Match match = new MatchBuilder().setEthernetMatch(ethernetMatch(macAddress, null, null)) .setInPort(nodeConnectorId) .build(); FlowId flowid = FlowIdUtils.newFlowId(tableId, "ep", match); FlowBuilder flowBuilder = base(tableId).setPriority(priority) .setId(flowid) .setMatch(match) .setInstructions( instructions(applyActionIns(segReg, scgReg, bdReg, fdReg, vrfReg, tunIdAction), gotoTableIns(goToTable))); ofWriter.writeFlow(nodeId, tableId, flowBuilder.build()); } }
SourceMapperFlows { public void synchronizeEp(short goToTable, int priority, OrdinalFactory.EndpointFwdCtxOrdinals ordinals, MacAddress macAddress, NodeConnectorId nodeConnectorId, OfWriter ofWriter) { int egId = ordinals.getEpgId(); int bdId = ordinals.getBdId(); int fdId = ordinals.getFdId(); int l3Id = ordinals.getL3Id(); int cgId = ordinals.getCgId(); int tunnelId = ordinals.getTunnelId(); Action segReg = nxLoadRegAction(NxmNxReg0.class, BigInteger.valueOf(egId)); Action scgReg = nxLoadRegAction(NxmNxReg1.class, BigInteger.valueOf(cgId)); Action bdReg = nxLoadRegAction(NxmNxReg4.class, BigInteger.valueOf(bdId)); Action fdReg = nxLoadRegAction(NxmNxReg5.class, BigInteger.valueOf(fdId)); Action vrfReg = nxLoadRegAction(NxmNxReg6.class, BigInteger.valueOf(l3Id)); Action tunIdAction = nxLoadTunIdAction(BigInteger.valueOf(tunnelId), false); Match match = new MatchBuilder().setEthernetMatch(ethernetMatch(macAddress, null, null)) .setInPort(nodeConnectorId) .build(); FlowId flowid = FlowIdUtils.newFlowId(tableId, "ep", match); FlowBuilder flowBuilder = base(tableId).setPriority(priority) .setId(flowid) .setMatch(match) .setInstructions( instructions(applyActionIns(segReg, scgReg, bdReg, fdReg, vrfReg, tunIdAction), gotoTableIns(goToTable))); ofWriter.writeFlow(nodeId, tableId, flowBuilder.build()); } SourceMapperFlows(NodeId nodeId, short tableId); }
SourceMapperFlows { public void synchronizeEp(short goToTable, int priority, OrdinalFactory.EndpointFwdCtxOrdinals ordinals, MacAddress macAddress, NodeConnectorId nodeConnectorId, OfWriter ofWriter) { int egId = ordinals.getEpgId(); int bdId = ordinals.getBdId(); int fdId = ordinals.getFdId(); int l3Id = ordinals.getL3Id(); int cgId = ordinals.getCgId(); int tunnelId = ordinals.getTunnelId(); Action segReg = nxLoadRegAction(NxmNxReg0.class, BigInteger.valueOf(egId)); Action scgReg = nxLoadRegAction(NxmNxReg1.class, BigInteger.valueOf(cgId)); Action bdReg = nxLoadRegAction(NxmNxReg4.class, BigInteger.valueOf(bdId)); Action fdReg = nxLoadRegAction(NxmNxReg5.class, BigInteger.valueOf(fdId)); Action vrfReg = nxLoadRegAction(NxmNxReg6.class, BigInteger.valueOf(l3Id)); Action tunIdAction = nxLoadTunIdAction(BigInteger.valueOf(tunnelId), false); Match match = new MatchBuilder().setEthernetMatch(ethernetMatch(macAddress, null, null)) .setInPort(nodeConnectorId) .build(); FlowId flowid = FlowIdUtils.newFlowId(tableId, "ep", match); FlowBuilder flowBuilder = base(tableId).setPriority(priority) .setId(flowid) .setMatch(match) .setInstructions( instructions(applyActionIns(segReg, scgReg, bdReg, fdReg, vrfReg, tunIdAction), 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 synchronizeEp(short goToTable, int priority, OrdinalFactory.EndpointFwdCtxOrdinals ordinals, MacAddress macAddress, NodeConnectorId nodeConnectorId, OfWriter ofWriter) { int egId = ordinals.getEpgId(); int bdId = ordinals.getBdId(); int fdId = ordinals.getFdId(); int l3Id = ordinals.getL3Id(); int cgId = ordinals.getCgId(); int tunnelId = ordinals.getTunnelId(); Action segReg = nxLoadRegAction(NxmNxReg0.class, BigInteger.valueOf(egId)); Action scgReg = nxLoadRegAction(NxmNxReg1.class, BigInteger.valueOf(cgId)); Action bdReg = nxLoadRegAction(NxmNxReg4.class, BigInteger.valueOf(bdId)); Action fdReg = nxLoadRegAction(NxmNxReg5.class, BigInteger.valueOf(fdId)); Action vrfReg = nxLoadRegAction(NxmNxReg6.class, BigInteger.valueOf(l3Id)); Action tunIdAction = nxLoadTunIdAction(BigInteger.valueOf(tunnelId), false); Match match = new MatchBuilder().setEthernetMatch(ethernetMatch(macAddress, null, null)) .setInPort(nodeConnectorId) .build(); FlowId flowid = FlowIdUtils.newFlowId(tableId, "ep", match); FlowBuilder flowBuilder = base(tableId).setPriority(priority) .setId(flowid) .setMatch(match) .setInstructions( instructions(applyActionIns(segReg, scgReg, bdReg, fdReg, vrfReg, tunIdAction), 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);  }