@Test public void testCreateClassifierInFlow() { SfcNshHeader nsh = mock(SfcNshHeader.class); Ipv4Address ip = mock(Ipv4Address.class); nsh.setVxlanIpDst(ip); assertNull(SfcScfOfUtils.createClassifierInFlow(null, null, 0L)); assertNull(SfcScfOfUtils.createClassifierInFlow(null, null, 0L)); assertNull(SfcScfOfUtils.createClassifierInFlow("flow", null, 0L)); assertNull(SfcScfOfUtils.createClassifierInFlow(null, null, 0L)); assertNull(SfcScfOfUtils.createClassifierInFlow(null, nsh, 0L)); }
public static FlowBuilder createClassifierInFlow(String flowKey, SfcNshHeader sfcNshHeader, Long outPort) { if ((flowKey == null) || (sfcNshHeader == null) || (sfcNshHeader.getVxlanIpDst()==null)) { return null; } MatchBuilder mb = SfcOpenflowUtils.getNshMatches(sfcNshHeader.getNshNsp(), sfcNshHeader.getNshEndNsi()); List<Action> theActions = new ArrayList<Action>() {{ int order = 0; add(SfcOpenflowUtils.createActionNxPopNsh(order++)); add(outPort == null ? SfcOpenflowUtils.createActionOutPort(OutputPortValues.INPORT.toString(), order++) : SfcOpenflowUtils.createActionOutPort(outPort.intValue(), order++)); }}; InstructionsBuilder isb = SfcOpenflowUtils.wrapActionsIntoApplyActionsInstruction(theActions); FlowBuilder flowb = new FlowBuilder(); flowb.setId(new FlowId(flowKey)) .setTableId(TABLE_INDEX_CLASSIFIER) .setKey(new FlowKey(new FlowId(flowKey))) .setPriority(FLOW_PRIORITY_CLASSIFIER) .setMatch(mb.build()) .setInstructions(isb.build()); return flowb; }
SfcScfOfUtils { public static FlowBuilder createClassifierInFlow(String flowKey, SfcNshHeader sfcNshHeader, Long outPort) { if ((flowKey == null) || (sfcNshHeader == null) || (sfcNshHeader.getVxlanIpDst()==null)) { return null; } MatchBuilder mb = SfcOpenflowUtils.getNshMatches(sfcNshHeader.getNshNsp(), sfcNshHeader.getNshEndNsi()); List<Action> theActions = new ArrayList<Action>() {{ int order = 0; add(SfcOpenflowUtils.createActionNxPopNsh(order++)); add(outPort == null ? SfcOpenflowUtils.createActionOutPort(OutputPortValues.INPORT.toString(), order++) : SfcOpenflowUtils.createActionOutPort(outPort.intValue(), order++)); }}; InstructionsBuilder isb = SfcOpenflowUtils.wrapActionsIntoApplyActionsInstruction(theActions); FlowBuilder flowb = new FlowBuilder(); flowb.setId(new FlowId(flowKey)) .setTableId(TABLE_INDEX_CLASSIFIER) .setKey(new FlowKey(new FlowId(flowKey))) .setPriority(FLOW_PRIORITY_CLASSIFIER) .setMatch(mb.build()) .setInstructions(isb.build()); return flowb; } }
SfcScfOfUtils { public static FlowBuilder createClassifierInFlow(String flowKey, SfcNshHeader sfcNshHeader, Long outPort) { if ((flowKey == null) || (sfcNshHeader == null) || (sfcNshHeader.getVxlanIpDst()==null)) { return null; } MatchBuilder mb = SfcOpenflowUtils.getNshMatches(sfcNshHeader.getNshNsp(), sfcNshHeader.getNshEndNsi()); List<Action> theActions = new ArrayList<Action>() {{ int order = 0; add(SfcOpenflowUtils.createActionNxPopNsh(order++)); add(outPort == null ? SfcOpenflowUtils.createActionOutPort(OutputPortValues.INPORT.toString(), order++) : SfcOpenflowUtils.createActionOutPort(outPort.intValue(), order++)); }}; InstructionsBuilder isb = SfcOpenflowUtils.wrapActionsIntoApplyActionsInstruction(theActions); FlowBuilder flowb = new FlowBuilder(); flowb.setId(new FlowId(flowKey)) .setTableId(TABLE_INDEX_CLASSIFIER) .setKey(new FlowKey(new FlowId(flowKey))) .setPriority(FLOW_PRIORITY_CLASSIFIER) .setMatch(mb.build()) .setInstructions(isb.build()); return flowb; }  }
SfcScfOfUtils { public static FlowBuilder createClassifierInFlow(String flowKey, SfcNshHeader sfcNshHeader, Long outPort) { if ((flowKey == null) || (sfcNshHeader == null) || (sfcNshHeader.getVxlanIpDst()==null)) { return null; } MatchBuilder mb = SfcOpenflowUtils.getNshMatches(sfcNshHeader.getNshNsp(), sfcNshHeader.getNshEndNsi()); List<Action> theActions = new ArrayList<Action>() {{ int order = 0; add(SfcOpenflowUtils.createActionNxPopNsh(order++)); add(outPort == null ? SfcOpenflowUtils.createActionOutPort(OutputPortValues.INPORT.toString(), order++) : SfcOpenflowUtils.createActionOutPort(outPort.intValue(), order++)); }}; InstructionsBuilder isb = SfcOpenflowUtils.wrapActionsIntoApplyActionsInstruction(theActions); FlowBuilder flowb = new FlowBuilder(); flowb.setId(new FlowId(flowKey)) .setTableId(TABLE_INDEX_CLASSIFIER) .setKey(new FlowKey(new FlowId(flowKey))) .setPriority(FLOW_PRIORITY_CLASSIFIER) .setMatch(mb.build()) .setInstructions(isb.build()); return flowb; }  static FlowBuilder initClassifierTable(); static FlowBuilder initClassifierDpdkOutputFlow(Long outPort); static FlowBuilder initClassifierDpdkInputFlow(String nodeName, Long inPort); static FlowBuilder createClassifierOutFlow(String flowKey, Match match, SfcNshHeader sfcNshHeader,
                                                  Long outPort); static FlowBuilder createClassifierInFlow(String flowKey, SfcNshHeader sfcNshHeader, Long outPort); static FlowBuilder createClassifierRelayFlow(String flowKey, SfcNshHeader sfcNshHeader); static boolean deleteClassifierFlow(String nodeName, String flowKey); }
SfcScfOfUtils { public static FlowBuilder createClassifierInFlow(String flowKey, SfcNshHeader sfcNshHeader, Long outPort) { if ((flowKey == null) || (sfcNshHeader == null) || (sfcNshHeader.getVxlanIpDst()==null)) { return null; } MatchBuilder mb = SfcOpenflowUtils.getNshMatches(sfcNshHeader.getNshNsp(), sfcNshHeader.getNshEndNsi()); List<Action> theActions = new ArrayList<Action>() {{ int order = 0; add(SfcOpenflowUtils.createActionNxPopNsh(order++)); add(outPort == null ? SfcOpenflowUtils.createActionOutPort(OutputPortValues.INPORT.toString(), order++) : SfcOpenflowUtils.createActionOutPort(outPort.intValue(), order++)); }}; InstructionsBuilder isb = SfcOpenflowUtils.wrapActionsIntoApplyActionsInstruction(theActions); FlowBuilder flowb = new FlowBuilder(); flowb.setId(new FlowId(flowKey)) .setTableId(TABLE_INDEX_CLASSIFIER) .setKey(new FlowKey(new FlowId(flowKey))) .setPriority(FLOW_PRIORITY_CLASSIFIER) .setMatch(mb.build()) .setInstructions(isb.build()); return flowb; }  static FlowBuilder initClassifierTable(); static FlowBuilder initClassifierDpdkOutputFlow(Long outPort); static FlowBuilder initClassifierDpdkInputFlow(String nodeName, Long inPort); static FlowBuilder createClassifierOutFlow(String flowKey, Match match, SfcNshHeader sfcNshHeader,
                                                  Long outPort); static FlowBuilder createClassifierInFlow(String flowKey, SfcNshHeader sfcNshHeader, Long outPort); static FlowBuilder createClassifierRelayFlow(String flowKey, SfcNshHeader sfcNshHeader); static boolean deleteClassifierFlow(String nodeName, String flowKey); static final int FLOW_PRIORITY_CLASSIFIER; static final int FLOW_PRIORITY_MATCH_ANY; static final short NSH_MDTYPE_ONE; static final short NSH_NP_ETH; static final short TUN_GPE_NP_NSH; }