@Test public void testPopVlanTagsOnExternalPortFlow() { NodeConnectorId connectorId = new NodeConnectorId(CONNECTOR_0); MatchBuilder matchBuilder = new MatchBuilder(); matchBuilder.setVlanMatch(FlowUtils.vlanMatch(1, true)) .setInPort(connectorId); Match match = matchBuilder.build(); List<Instruction> instructions = new ArrayList<>(); instructions.add(FlowUtils.popVlanInstruction(0)); instructions.add(new InstructionBuilder().setOrder(1) .setInstruction(FlowUtils.gotoTableIns((short) 0)) .build()); InstructionsBuilder instructionsBuilder = new InstructionsBuilder(); instructionsBuilder.setInstruction(instructions); List<L2FloodDomain> l2FloodDomains = getL2FloodDomainList(false); Flow testFlow = buildFlow(FlowIdUtils.newFlowId(tableId, "allowExternalPopVlan", match), tableId, 200, match, instructionsBuilder.build()).build(); flows.popVlanTagsOnExternalPortFlows((short) 0, connectorId, l2FloodDomains, 200, ofWriter); verify(ofWriter, times(1)).writeFlow(NODE_ID, tableId, testFlow); }
void popVlanTagsOnExternalPortFlows(short goToTable, NodeConnectorId connectorId, List<L2FloodDomain> l2FloodDomains, int priority, OfWriter ofWriter) { for (L2FloodDomain l2Fd : l2FloodDomains) { Segmentation segmentation = l2Fd.getAugmentation(Segmentation.class); if (segmentation != null) { Integer vlanId = segmentation.getSegmentationId(); Match match = new MatchBuilder() .setVlanMatch(FlowUtils.vlanMatch(vlanId, true)) .setInPort(connectorId) .build(); List<Instruction> instructions = new ArrayList<>(); instructions.add(FlowUtils.popVlanInstruction(0)); instructions.add(new InstructionBuilder().setOrder(1) .setInstruction(FlowUtils.gotoTableIns(goToTable)) .build()); FlowId flowid = FlowIdUtils.newFlowId(tableId, "allowExternalPopVlan", match); Flow flow = FlowUtils.base(tableId).setPriority(priority) .setId(flowid) .setMatch(match) .setInstructions(new InstructionsBuilder().setInstruction(instructions).build()) .build(); ofWriter.writeFlow(nodeId, tableId, flow); } } }
PortSecurityFlows { void popVlanTagsOnExternalPortFlows(short goToTable, NodeConnectorId connectorId, List<L2FloodDomain> l2FloodDomains, int priority, OfWriter ofWriter) { for (L2FloodDomain l2Fd : l2FloodDomains) { Segmentation segmentation = l2Fd.getAugmentation(Segmentation.class); if (segmentation != null) { Integer vlanId = segmentation.getSegmentationId(); Match match = new MatchBuilder() .setVlanMatch(FlowUtils.vlanMatch(vlanId, true)) .setInPort(connectorId) .build(); List<Instruction> instructions = new ArrayList<>(); instructions.add(FlowUtils.popVlanInstruction(0)); instructions.add(new InstructionBuilder().setOrder(1) .setInstruction(FlowUtils.gotoTableIns(goToTable)) .build()); FlowId flowid = FlowIdUtils.newFlowId(tableId, "allowExternalPopVlan", match); Flow flow = FlowUtils.base(tableId).setPriority(priority) .setId(flowid) .setMatch(match) .setInstructions(new InstructionsBuilder().setInstruction(instructions).build()) .build(); ofWriter.writeFlow(nodeId, tableId, flow); } } } }
PortSecurityFlows { void popVlanTagsOnExternalPortFlows(short goToTable, NodeConnectorId connectorId, List<L2FloodDomain> l2FloodDomains, int priority, OfWriter ofWriter) { for (L2FloodDomain l2Fd : l2FloodDomains) { Segmentation segmentation = l2Fd.getAugmentation(Segmentation.class); if (segmentation != null) { Integer vlanId = segmentation.getSegmentationId(); Match match = new MatchBuilder() .setVlanMatch(FlowUtils.vlanMatch(vlanId, true)) .setInPort(connectorId) .build(); List<Instruction> instructions = new ArrayList<>(); instructions.add(FlowUtils.popVlanInstruction(0)); instructions.add(new InstructionBuilder().setOrder(1) .setInstruction(FlowUtils.gotoTableIns(goToTable)) .build()); FlowId flowid = FlowIdUtils.newFlowId(tableId, "allowExternalPopVlan", match); Flow flow = FlowUtils.base(tableId).setPriority(priority) .setId(flowid) .setMatch(match) .setInstructions(new InstructionsBuilder().setInstruction(instructions).build()) .build(); ofWriter.writeFlow(nodeId, tableId, flow); } } } PortSecurityFlows(NodeId nodeId, Short tableId); }
PortSecurityFlows { void popVlanTagsOnExternalPortFlows(short goToTable, NodeConnectorId connectorId, List<L2FloodDomain> l2FloodDomains, int priority, OfWriter ofWriter) { for (L2FloodDomain l2Fd : l2FloodDomains) { Segmentation segmentation = l2Fd.getAugmentation(Segmentation.class); if (segmentation != null) { Integer vlanId = segmentation.getSegmentationId(); Match match = new MatchBuilder() .setVlanMatch(FlowUtils.vlanMatch(vlanId, true)) .setInPort(connectorId) .build(); List<Instruction> instructions = new ArrayList<>(); instructions.add(FlowUtils.popVlanInstruction(0)); instructions.add(new InstructionBuilder().setOrder(1) .setInstruction(FlowUtils.gotoTableIns(goToTable)) .build()); FlowId flowid = FlowIdUtils.newFlowId(tableId, "allowExternalPopVlan", match); Flow flow = FlowUtils.base(tableId).setPriority(priority) .setId(flowid) .setMatch(match) .setInstructions(new InstructionsBuilder().setInstruction(instructions).build()) .build(); ofWriter.writeFlow(nodeId, tableId, flow); } } } PortSecurityFlows(NodeId nodeId, Short tableId);  }
PortSecurityFlows { void popVlanTagsOnExternalPortFlows(short goToTable, NodeConnectorId connectorId, List<L2FloodDomain> l2FloodDomains, int priority, OfWriter ofWriter) { for (L2FloodDomain l2Fd : l2FloodDomains) { Segmentation segmentation = l2Fd.getAugmentation(Segmentation.class); if (segmentation != null) { Integer vlanId = segmentation.getSegmentationId(); Match match = new MatchBuilder() .setVlanMatch(FlowUtils.vlanMatch(vlanId, true)) .setInPort(connectorId) .build(); List<Instruction> instructions = new ArrayList<>(); instructions.add(FlowUtils.popVlanInstruction(0)); instructions.add(new InstructionBuilder().setOrder(1) .setInstruction(FlowUtils.gotoTableIns(goToTable)) .build()); FlowId flowid = FlowIdUtils.newFlowId(tableId, "allowExternalPopVlan", match); Flow flow = FlowUtils.base(tableId).setPriority(priority) .setId(flowid) .setMatch(match) .setInstructions(new InstructionsBuilder().setInstruction(instructions).build()) .build(); ofWriter.writeFlow(nodeId, tableId, flow); } } } PortSecurityFlows(NodeId nodeId, Short tableId);   }