Act on sonar reported issues / technical debt 61/51261/5
authorMiguel Duarte <miguel.duarte.de.mora.barroso@ericsson.com>
Mon, 30 Jan 2017 14:14:39 +0000 (15:14 +0100)
committerBrady Johnson <brady.allen.johnson@ericsson.com>
Wed, 1 Feb 2017 15:46:39 +0000 (15:46 +0000)
Stop using the 'order' local variable in the SfcOfFlowProgrammerImpl
methods; since we're only appending the action to the action list, I
think it is more explicit / less error-prone to indicate the 'order' as
the current-list size (always append to the end of the list)

The configureNshNscTransportEgressFlow in the SfcOfFlowProgrammerImpl
class had a bug; the next protocol was not deing correctly defined as
NSH - as a result, that action list only featured a single action, which
is to set the output port. Now it has an action setting the next
protocol to NSH, and another setting the output protocol.

Tests are updated accordingly.

Used a StringBuilder instead of a StringBuffer in the SfcOfRspProcessor
because the StringBuffer is thread safe, which, in this scenario only
leads to throttled performance.

Removed the TUN_GPE_NP_NSH constant from yet another class.

Change-Id: Ie66ba64f4ec015e97856da5289c19f10efdf3566
Signed-off-by: Miguel Duarte <miguel.duarte.de.mora.barroso@ericsson.com>
sfc-classifiers/sfc-scf-openflow/src/main/java/org/opendaylight/sfc/scfofrenderer/logicalclassifier/LogicalClassifierDataGetter.java
sfc-renderers/sfc-openflow-renderer/src/main/java/org/opendaylight/sfc/ofrenderer/openflow/SfcOfFlowProgrammerImpl.java
sfc-renderers/sfc-openflow-renderer/src/main/java/org/opendaylight/sfc/ofrenderer/processors/SfcOfRspProcessor.java
sfc-renderers/sfc-openflow-renderer/src/test/java/org/opendaylight/sfc/ofrenderer/SfcOfFlowProgrammerTest.java
sfc-renderers/sfc-openflow-renderer/src/test/java/org/opendaylight/sfc/ofrenderer/processors/SfcOfLogicalSffRspProcessorTest.java

index 31e35f58ce8ab96adcbec8a3ed28371c1922f6cb..ff05347fea1d97635c66c525e396ebd4715aedaf 100644 (file)
@@ -72,8 +72,7 @@ public class LogicalClassifierDataGetter {
      */
     public Optional<DpnIdType> getFirstHopDataplaneId(RenderedServicePath theRsp) {
         return Optional.ofNullable(theRsp.getRenderedServicePathHop().get(0))
-                .map(this::getHopDataplaneId)
-                .orElse(Optional.empty());
+                .flatMap(this::getHopDataplaneId);
     }
 
     /**
index 8639f52e03bb81c48169fe02daeeff2f1e4e34bb..f9f6cd7a86c9939f99e364273e9d5f1a15d47a03 100644 (file)
@@ -20,6 +20,7 @@ import org.opendaylight.genius.mdsalutil.NwConstants;
 import org.opendaylight.sfc.genius.util.appcoexistence.SfcTableIndexMapper;
 import org.opendaylight.sfc.ofrenderer.sfg.GroupBucketInfo;
 import org.opendaylight.sfc.sfc_ovs.provider.SfcOvsUtil;
+import org.opendaylight.sfc.util.openflow.OpenflowConstants;
 import org.opendaylight.sfc.util.openflow.SfcOpenflowUtils;
 import org.opendaylight.sfc.util.openflow.transactional_writer.SfcOfFlowWriterInterface;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
@@ -84,6 +85,9 @@ public class SfcOfFlowProgrammerImpl implements SfcOfFlowProgrammerInterface {
     public static final String TRANSPORT_EGRESS_MPLS_LASTHOP_COOKIE = "00000402";
     public static final String TRANSPORT_EGRESS_MAX_COOKIE          = "00000FFF";
 
+    private static final String INGRESS_TRANSPORT_ARP_FLOW_NAME_LITERAL = "ingress_Transport_Arp_Flow";
+    private static final String NEXT_HOP_FLOW_NAME_LITERAL = "nextHop";
+
     // Which bits in the metadata field to set, Assuming 4095 PathId's
     public static final BigInteger METADATA_MASK_SFP_MATCH =
             new BigInteger("FFFFFFFFFFFFFFFF", COOKIE_BIGINT_HEX_RADIX);
@@ -108,7 +112,6 @@ public class SfcOfFlowProgrammerImpl implements SfcOfFlowProgrammerInterface {
     private static final int PKTIN_IDLE_TIMEOUT = 60;
     private static final String EMPTY_SWITCH_PORT = "";
     public static final short APP_COEXISTENCE_NOT_SET = -1;
-    private static final short TUN_GPE_NP_NSH = 0x4;
 
     // Instance variables
     private short tableBase;
@@ -135,7 +138,7 @@ public class SfcOfFlowProgrammerImpl implements SfcOfFlowProgrammerInterface {
     @Override
     public void setFlowWriter(SfcOfFlowWriterInterface sfcOfFlowWriter) {
         this.sfcOfFlowWriter = sfcOfFlowWriter;
-    };
+    }
 
     // This method should only be called by SfcOfRenderer.close()
     @Override
@@ -602,7 +605,7 @@ public class SfcOfFlowProgrammerImpl implements SfcOfFlowProgrammerInterface {
                 SfcOpenflowUtils.createFlowBuilder(
                         getTableId(TABLE_INDEX_TRANSPORT_INGRESS),
                         FLOW_PRIORITY_ARP_TRANSPORT_INGRESS,
-                        "ingress_Transport_Arp_Flow",
+                        INGRESS_TRANSPORT_ARP_FLOW_NAME_LITERAL,
                         match, isb);
 
         sfcOfFlowWriter.writeFlow(flowRspId, sffNodeName, arpTransportIngressFlow);
@@ -629,7 +632,7 @@ public class SfcOfFlowProgrammerImpl implements SfcOfFlowProgrammerInterface {
                 SfcOpenflowUtils.createFlowBuilder(
                         getTableId(TABLE_INDEX_TRANSPORT_INGRESS),
                         FLOW_PRIORITY_ARP_TRANSPORT_INGRESS,
-                        "ingress_Transport_Arp_Flow",
+                        INGRESS_TRANSPORT_ARP_FLOW_NAME_LITERAL,
                         match, isb);
 
         sfcOfFlowWriter.writeFlow(flowRspId, sffNodeName, sfFlow);
@@ -654,7 +657,7 @@ public class SfcOfFlowProgrammerImpl implements SfcOfFlowProgrammerInterface {
                 SfcOpenflowUtils.createFlowBuilder(
                         getTableId(TABLE_INDEX_TRANSPORT_INGRESS),
                         FLOW_PRIORITY_ARP_TRANSPORT_INGRESS,
-                        "ingress_Transport_Arp_Flow",
+                        INGRESS_TRANSPORT_ARP_FLOW_NAME_LITERAL,
                         match, isb);
 
         sfcOfFlowWriter.writeFlow(flowRspId, sffNodeName, sfFlow);
@@ -767,7 +770,7 @@ public class SfcOfFlowProgrammerImpl implements SfcOfFlowProgrammerInterface {
         return SfcOpenflowUtils.createFlowBuilder(
                 getTableId(TABLE_INDEX_PATH_MAPPER),
                 flowPriority,
-                "nextHop", match, isb);
+                NEXT_HOP_FLOW_NAME_LITERAL, match, isb);
     }
 
     //
@@ -802,7 +805,7 @@ public class SfcOfFlowProgrammerImpl implements SfcOfFlowProgrammerInterface {
         FlowBuilder ingressFlow = SfcOpenflowUtils.createFlowBuilder(
                 getTableId(TABLE_INDEX_PATH_MAPPER_ACL),
                 FLOW_PRIORITY_PATH_MAPPER_ACL,
-                "nextHop",
+                NEXT_HOP_FLOW_NAME_LITERAL,
                 match, isb);
         // Set an idle timeout on this flow
         ingressFlow.setIdleTimeout(PKTIN_IDLE_TIMEOUT);
@@ -840,7 +843,7 @@ public class SfcOfFlowProgrammerImpl implements SfcOfFlowProgrammerInterface {
         List<Action> actionList = new ArrayList<>();
         if (dstMac != null) {
             // Set the DL (Data Link) Dest Mac Address
-            actionList.add(SfcOpenflowUtils.createActionSetDlDst(dstMac, 0));
+            actionList.add(SfcOpenflowUtils.createActionSetDlDst(dstMac, actionList.size()));
         }
 
         FlowBuilder nextHopFlow = configureNextHopFlow(match, actionList, flowPriority);
@@ -861,10 +864,9 @@ public class SfcOfFlowProgrammerImpl implements SfcOfFlowProgrammerInterface {
             final short nshNsi) {
         MatchBuilder match = SfcOpenflowUtils.getNshMatches(nshNsp, nshNsi);
 
-        int order = 0;
         List<Action> actionList = new ArrayList<>();
         if (dstIp != null) {
-            Action actionSetNwDst = SfcOpenflowUtils.createActionNxSetTunIpv4Dst(dstIp, order++);
+            Action actionSetNwDst = SfcOpenflowUtils.createActionNxSetTunIpv4Dst(dstIp, actionList.size());
             actionList.add(actionSetNwDst);
         }
 
@@ -890,12 +892,12 @@ public class SfcOfFlowProgrammerImpl implements SfcOfFlowProgrammerInterface {
     @Override
     public void configureNshEthNextHopFlow(String sffNodeName, String srcMac, String dstMac, long nsp, short nsi) {
         MatchBuilder match = SfcOpenflowUtils.getNshMatches(nsp, nsi);
-        int order = 0;
+
         List<Action> actionList = new ArrayList<>();
         actionList.add(SfcOpenflowUtils.createActionNxLoadEncapEthSrc(srcMac,
-                order++));
+                actionList.size()));
         actionList.add(SfcOpenflowUtils.createActionNxLoadEncapEthDst(dstMac,
-                order++));
+                actionList.size()));
 
         FlowBuilder nextHopFlow = configureNextHopFlow(match, actionList);
         sfcOfFlowWriter.writeFlow(flowRspId, sffNodeName, nextHopFlow);
@@ -933,7 +935,7 @@ public class SfcOfFlowProgrammerImpl implements SfcOfFlowProgrammerInterface {
         // Create and configure the FlowBuilder
         return SfcOpenflowUtils.createFlowBuilder(
                 getTableId(TABLE_INDEX_NEXT_HOP),
-                flowPriority, "nextHop", match, isb);
+                flowPriority, NEXT_HOP_FLOW_NAME_LITERAL, match, isb);
     }
 
 
@@ -950,21 +952,20 @@ public class SfcOfFlowProgrammerImpl implements SfcOfFlowProgrammerInterface {
         // In order to set the IP DSCP, we need to match IPv4
         SfcOpenflowUtils.addMatchEtherType(match, SfcOpenflowUtils.ETHERTYPE_IPV4);
 
-        int order = 0;
         List<Action> actionList = new ArrayList<>();
-        actionList.add(SfcOpenflowUtils.createActionWriteDscp((short) pathId, order++));
-        actionList.add(SfcOpenflowUtils.createActionPushVlan(order++));
-        actionList.add(SfcOpenflowUtils.createActionSetVlanId(dstVlan, order++));
+        actionList.add(SfcOpenflowUtils.createActionWriteDscp((short) pathId, actionList.size()));
+        actionList.add(SfcOpenflowUtils.createActionPushVlan(actionList.size()));
+        actionList.add(SfcOpenflowUtils.createActionSetVlanId(dstVlan, actionList.size()));
 
         if(doPktin) {
             // Notice TCP SYN matching is only supported in OpenFlow 1.5
             SfcOpenflowUtils.addMatchTcpSyn(match);
-            actionList.add(SfcOpenflowUtils.createActionPktIn(SfcOpenflowUtils.PKT_LENGTH_IP_HEADER, order++));
+            actionList.add(SfcOpenflowUtils.createActionPktIn(SfcOpenflowUtils.PKT_LENGTH_IP_HEADER, actionList.size()));
         }
 
         FlowBuilder transportEgressFlow =
                 configureMacTransportEgressFlow(
-                        match, actionList, port, order, pathId, srcMac, dstMac,
+                        match, actionList, port, pathId, srcMac, dstMac,
                         TRANSPORT_EGRESS_VLAN_SF_COOKIE);
         sfcOfFlowWriter.writeFlow(flowRspId, sffNodeName, transportEgressFlow);
     }
@@ -1034,14 +1035,13 @@ public class SfcOfFlowProgrammerImpl implements SfcOfFlowProgrammerInterface {
         MatchBuilder match = new MatchBuilder();
         SfcOpenflowUtils.addMatchMetada(match, getMetadataSFP(pathId), METADATA_MASK_SFP_MATCH);
 
-        int order = 0;
         List<Action> actionList = new ArrayList<>();
-        actionList.add(SfcOpenflowUtils.createActionPushVlan(order++));
-        actionList.add(SfcOpenflowUtils.createActionSetVlanId(dstVlan, order++));
+        actionList.add(SfcOpenflowUtils.createActionPushVlan(actionList.size()));
+        actionList.add(SfcOpenflowUtils.createActionSetVlanId(dstVlan, actionList.size()));
 
         FlowBuilder transportEgressFlow =
                 configureMacTransportEgressFlow(
-                        match, actionList, port, order, pathId, srcMac, dstMac, cookieStr);
+                        match, actionList, port, pathId, srcMac, dstMac, cookieStr);
         sfcOfFlowWriter.writeFlow(flowRspId, sffNodeName, transportEgressFlow);
     }
 
@@ -1109,14 +1109,13 @@ public class SfcOfFlowProgrammerImpl implements SfcOfFlowProgrammerInterface {
         MatchBuilder match = new MatchBuilder();
         SfcOpenflowUtils.addMatchMetada(match, getMetadataSFP(pathId), METADATA_MASK_SFP_MATCH);
 
-        int order = 0;
         List<Action> actionList = new ArrayList<>();
-        actionList.add(SfcOpenflowUtils.createActionPushMpls(order++));
-        actionList.add(SfcOpenflowUtils.createActionSetMplsLabel(mplsLabel, order++));
+        actionList.add(SfcOpenflowUtils.createActionPushMpls(actionList.size()));
+        actionList.add(SfcOpenflowUtils.createActionSetMplsLabel(mplsLabel, actionList.size()));
 
         FlowBuilder transportEgressFlow =
                 configureMacTransportEgressFlow(
-                        match, actionList, port, order, pathId, srcMac, dstMac, cookieStr);
+                        match, actionList, port, pathId, srcMac, dstMac, cookieStr);
         sfcOfFlowWriter.writeFlow(flowRspId, sffNodeName, transportEgressFlow);
     }
 
@@ -1135,20 +1134,19 @@ public class SfcOfFlowProgrammerImpl implements SfcOfFlowProgrammerInterface {
         MatchBuilder match = SfcOpenflowUtils.getNshMatches(nshNsp, nshNsi);
 
         // On the last hop Copy/Move Nsi, Nsp, Nsc1=>TunIpv4Dst, and Nsc2=>TunId(Vnid)
-        int order = 0;
         List<Action> actionList = new ArrayList<>();
-        actionList.add(SfcOpenflowUtils.createActionNxMoveNshMdtype(order++));
-        actionList.add(SfcOpenflowUtils.createActionNxMoveNshNp(order++));
-        actionList.add(SfcOpenflowUtils.createActionNxMoveNsi(order++));
-        actionList.add(SfcOpenflowUtils.createActionNxMoveNsp(order++));
-        actionList.add(SfcOpenflowUtils.createActionNxMoveNsc1ToTunIpv4DstRegister(order++));
-        actionList.add(SfcOpenflowUtils.createActionNxMoveNsc2ToTunIdRegister(order++));
+        actionList.add(SfcOpenflowUtils.createActionNxMoveNshMdtype(actionList.size()));
+        actionList.add(SfcOpenflowUtils.createActionNxMoveNshNp(actionList.size()));
+        actionList.add(SfcOpenflowUtils.createActionNxMoveNsi(actionList.size()));
+        actionList.add(SfcOpenflowUtils.createActionNxMoveNsp(actionList.size()));
+        actionList.add(SfcOpenflowUtils.createActionNxMoveNsc1ToTunIpv4DstRegister(actionList.size()));
+        actionList.add(SfcOpenflowUtils.createActionNxMoveNsc2ToTunIdRegister(actionList.size()));
 
         /* Need to set TUN_GPE_NP for VxLAN-gpe port */
-        actionList.add(SfcOpenflowUtils.createActionNxLoadTunGpeNp(TUN_GPE_NP_NSH, order++));
+        actionList.add(SfcOpenflowUtils.createActionNxLoadTunGpeNp(OpenflowConstants.TUN_GPE_NP_NSH, actionList.size()));
 
         FlowBuilder transportEgressFlow =
-                configureTransportEgressFlow(match, actionList, port, order,
+                configureTransportEgressFlow(match, actionList, port,
                         FLOW_PRIORITY_TRANSPORT_EGRESS,
                         TRANSPORT_EGRESS_NSH_VXGPE_LASTHOP_COOKIE);
         sfcOfFlowWriter.writeFlow(flowRspId, sffNodeName, transportEgressFlow);
@@ -1173,20 +1171,19 @@ public class SfcOfFlowProgrammerImpl implements SfcOfFlowProgrammerInterface {
         // 1. remove nsh header
         // 2. Change src mac to the mac of the last SF
         // 3. resubmit to the dispatcher table
-        int order = 0;
         List<Action> actionList = new ArrayList<>();
 
         // Pop NSH
-        Action popNsh = SfcOpenflowUtils.createActionNxPopNsh(order++);
+        Action popNsh = SfcOpenflowUtils.createActionNxPopNsh(actionList.size());
         actionList.add(popNsh);
 
         // Change source address
         Action changeSourceMac = SfcOpenflowUtils
-                .createActionSetDlSrc(macAddress.getValue(), order++);
+                .createActionSetDlSrc(macAddress.getValue(), actionList.size());
         actionList.add(changeSourceMac);
 
         // Proceed with other services
-        actionList.add(SfcOpenflowUtils.createActionResubmitTable(NwConstants.LPORT_DISPATCHER_TABLE, order++));
+        actionList.add(SfcOpenflowUtils.createActionResubmitTable(NwConstants.LPORT_DISPATCHER_TABLE, actionList.size()));
 
         InstructionsBuilder isb = SfcOpenflowUtils.wrapActionsIntoApplyActionsInstruction(actionList);
 
@@ -1239,29 +1236,29 @@ public class SfcOfFlowProgrammerImpl implements SfcOfFlowProgrammerInterface {
     private void configureNshVxgpeTransportEgressFlowPorts(
             final String sffNodeName, final long nshNsp, final short nshNsi, String inport, String outport) {
         int flowPriority = FLOW_PRIORITY_TRANSPORT_EGRESS;
+        String theOutPortToSet = outport;
 
         MatchBuilder match = SfcOpenflowUtils.getNshMatches(nshNsp, nshNsi);
         if(!inport.startsWith(OutputPortValues.INPORT.toString())) {
             // if we output to a port that's the same as the inport, the pkt will be dropped
             SfcOpenflowUtils.addMatchInPort(match, new NodeConnectorId(inport));
-            outport = OutputPortValues.INPORT.toString();
+            theOutPortToSet = OutputPortValues.INPORT.toString();
             flowPriority += 5;
         }
 
-        int order = 0;
         List<Action> actionList = new ArrayList<>();
         // Copy/Move Nsc1/Nsc2 to the next hop
-        actionList.add(SfcOpenflowUtils.createActionNxMoveNshMdtype(order++));
-        actionList.add(SfcOpenflowUtils.createActionNxMoveNshNp(order++));
-        actionList.add(SfcOpenflowUtils.createActionNxMoveNsc1(order++));
-        actionList.add(SfcOpenflowUtils.createActionNxMoveNsc2(order++));
-        actionList.add(SfcOpenflowUtils.createActionNxMoveTunIdRegister(order++));
+        actionList.add(SfcOpenflowUtils.createActionNxMoveNshMdtype(actionList.size()));
+        actionList.add(SfcOpenflowUtils.createActionNxMoveNshNp(actionList.size()));
+        actionList.add(SfcOpenflowUtils.createActionNxMoveNsc1(actionList.size()));
+        actionList.add(SfcOpenflowUtils.createActionNxMoveNsc2(actionList.size()));
+        actionList.add(SfcOpenflowUtils.createActionNxMoveTunIdRegister(actionList.size()));
 
         /* Need to set TUN_GPE_NP for VxLAN-gpe port */
-        actionList.add(SfcOpenflowUtils.createActionNxLoadTunGpeNp(TUN_GPE_NP_NSH, order++));
+        actionList.add(SfcOpenflowUtils.createActionNxLoadTunGpeNp(OpenflowConstants.TUN_GPE_NP_NSH,actionList.size()));
 
         FlowBuilder transportEgressFlow =
-                configureTransportEgressFlow(match, actionList, outport, order,
+                configureTransportEgressFlow(match, actionList, theOutPortToSet,
                         flowPriority,
                         TRANSPORT_EGRESS_NSH_VXGPE_COOKIE);
         sfcOfFlowWriter.writeFlow(flowRspId, sffNodeName, transportEgressFlow);
@@ -1288,14 +1285,13 @@ public class SfcOfFlowProgrammerImpl implements SfcOfFlowProgrammerInterface {
         SfcOpenflowUtils.addMatchNshNsc1(match, 0l);
 
         /* Need to set TUN_GPE_NP for VxLAN-gpe port */
-        int order = 0;
         List<Action> actionList = new ArrayList<>();
-        actionList.add(SfcOpenflowUtils.createActionNxLoadTunGpeNp(TUN_GPE_NP_NSH, order++));
+        actionList.add(SfcOpenflowUtils.createActionNxLoadTunGpeNp(OpenflowConstants.TUN_GPE_NP_NSH, actionList.size()));
 
         FlowBuilder transportEgressFlow =
                 configureTransportEgressFlow(
-                        match, new ArrayList<>(), port,
-                        order, FLOW_PRIORITY_TRANSPORT_EGRESS + 10,
+                        match, actionList, port,
+                        FLOW_PRIORITY_TRANSPORT_EGRESS + 10,
                         TRANSPORT_EGRESS_NSH_VXGPE_NSC_COOKIE);
         sfcOfFlowWriter.writeFlow(flowRspId, sffNodeName, transportEgressFlow);
     }
@@ -1319,22 +1315,21 @@ public class SfcOfFlowProgrammerImpl implements SfcOfFlowProgrammerInterface {
         SfcOpenflowUtils.addMatchNshNsc1(match, ipl);
 
         // Copy/Move Nsi, Nsp, Nsc1=>TunIpv4Dst, and Nsc2=>TunId(Vnid)
-        int order = 0;
         List<Action> actionList = new ArrayList<>();
-        actionList.add(SfcOpenflowUtils.createActionNxMoveNshMdtype(order++));
-        actionList.add(SfcOpenflowUtils.createActionNxMoveNshNp(order++));
-        actionList.add(SfcOpenflowUtils.createActionNxMoveNsi(order++));
-        actionList.add(SfcOpenflowUtils.createActionNxMoveNsp(order++));
-        actionList.add(SfcOpenflowUtils.createActionNxMoveNsc1ToTunIpv4DstRegister(order++));
-        actionList.add(SfcOpenflowUtils.createActionNxMoveNsc2ToTunIdRegister(order++));
+        actionList.add(SfcOpenflowUtils.createActionNxMoveNshMdtype(actionList.size()));
+        actionList.add(SfcOpenflowUtils.createActionNxMoveNshNp(actionList.size()));
+        actionList.add(SfcOpenflowUtils.createActionNxMoveNsi(actionList.size()));
+        actionList.add(SfcOpenflowUtils.createActionNxMoveNsp(actionList.size()));
+        actionList.add(SfcOpenflowUtils.createActionNxMoveNsc1ToTunIpv4DstRegister(actionList.size()));
+        actionList.add(SfcOpenflowUtils.createActionNxMoveNsc2ToTunIdRegister(actionList.size()));
 
         /* Need to set TUN_GPE_NP for VxLAN-gpe port */
-        actionList.add(SfcOpenflowUtils.createActionNxLoadTunGpeNp(TUN_GPE_NP_NSH, order++));
+        actionList.add(SfcOpenflowUtils.createActionNxLoadTunGpeNp(OpenflowConstants.TUN_GPE_NP_NSH, actionList.size()));
 
         FlowBuilder transportEgressFlow =
                 configureTransportEgressFlow(
                         match, actionList, EMPTY_SWITCH_PORT,
-                        order, FLOW_PRIORITY_TRANSPORT_EGRESS + 10,
+                        FLOW_PRIORITY_TRANSPORT_EGRESS + 10,
                         TRANSPORT_EGRESS_NSH_VXGPE_APPCOEXIST_COOKIE);
         sfcOfFlowWriter.writeFlow(flowRspId, sffNodeName, transportEgressFlow);
     }
@@ -1352,18 +1347,17 @@ public class SfcOfFlowProgrammerImpl implements SfcOfFlowProgrammerInterface {
     public void configureNshEthTransportEgressFlow(String sffNodeName, long nshNsp, short nshNsi, String port) {
         MatchBuilder match = SfcOpenflowUtils.getNshMatches(nshNsp, nshNsi);
 
-        int order = 0;
         List<Action> actionList = new ArrayList<>();
         // Copy/Move Nsc1/Nsc2 to the next hop
-        actionList.add(SfcOpenflowUtils.createActionNxMoveNsc1(order++));
-        actionList.add(SfcOpenflowUtils.createActionNxMoveNsc2(order++));
-        actionList.add(SfcOpenflowUtils.createActionNxMoveTunIdRegister(order++));
+        actionList.add(SfcOpenflowUtils.createActionNxMoveNsc1(actionList.size()));
+        actionList.add(SfcOpenflowUtils.createActionNxMoveNsc2(actionList.size()));
+        actionList.add(SfcOpenflowUtils.createActionNxMoveTunIdRegister(actionList.size()));
 
         // TODO need to encap the Ethernet transport
 
         FlowBuilder transportEgressFlow =
                 configureTransportEgressFlow(
-                        match, actionList, port, order,
+                        match, actionList, port,
                         FLOW_PRIORITY_TRANSPORT_EGRESS,
                         TRANSPORT_EGRESS_NSH_ETH_COOKIE);
         sfcOfFlowWriter.writeFlow(flowRspId, sffNodeName, transportEgressFlow);
@@ -1375,7 +1369,6 @@ public class SfcOfFlowProgrammerImpl implements SfcOfFlowProgrammerInterface {
      * @param match -already created matches
      * @param actionList - a list of actions already created
      * @param port - the switch port to send the packet out on
-     * @param order - order to use when writing to the actionList
      * @param pathId - the RSP path id to match on
      * @param srcMac - the source MAC to write to the packet
      * @param dstMac - the dest MAC to match against
@@ -1383,8 +1376,8 @@ public class SfcOfFlowProgrammerImpl implements SfcOfFlowProgrammerInterface {
      * @return a FlowBuilder with the created Path Mapper flow
      */
     private FlowBuilder configureMacTransportEgressFlow(MatchBuilder match, List<Action> actionList,
-            String port, int order, final long pathId, final String srcMac, final String dstMac,
-            String cookieStr) {
+                                                        String port, final long pathId, final String srcMac,
+                                                        final String dstMac, String cookieStr) {
 
         //Optionally match on the dstMac
         int flowPriority = FLOW_PRIORITY_TRANSPORT_EGRESS;
@@ -1397,11 +1390,11 @@ public class SfcOfFlowProgrammerImpl implements SfcOfFlowProgrammerInterface {
 
         // Set the macSrc
         if (srcMac != null) {
-            actionList.add(SfcOpenflowUtils.createActionSetDlSrc(srcMac, order++));
+            actionList.add(SfcOpenflowUtils.createActionSetDlSrc(srcMac, actionList.size()));
         }
 
         return configureTransportEgressFlow(
-                match, actionList, port, order,
+                match, actionList, port,
                 flowPriority,
                 cookieStr);
     }
@@ -1413,23 +1406,22 @@ public class SfcOfFlowProgrammerImpl implements SfcOfFlowProgrammerInterface {
      * @param match -already created matches
      * @param actionList - a list of actions already created
      * @param port - the switch port to send the packet out on
-     * @param order - order to use when writing to the actionList
      * @param flowPriority - the priority to set on the flow
      *
      * @return a FlowBuilder with the created Path Mapper flow
      */
     private FlowBuilder configureTransportEgressFlow(
-            MatchBuilder match, List<Action> actionList, String port, int order, int flowPriority, String cookieStr) {
+            MatchBuilder match, List<Action> actionList, String port, int flowPriority, String cookieStr) {
         LOG.debug("SfcProviderSffFlowWriter.ConfigureTransportEgressFlow");
 
         if(port.equals(EMPTY_SWITCH_PORT) && getTableEgress() > APP_COEXISTENCE_NOT_SET) {
             // Application Coexistence:
             // Instead of egressing the packet out a port, send it to
             // a different application pipeline on this same switch
-            actionList.add(SfcOpenflowUtils.createActionResubmitTable(getTableEgress(), order++));
+            actionList.add(SfcOpenflowUtils.createActionResubmitTable(getTableEgress(), actionList.size()));
 
         } else {
-            actionList.add(SfcOpenflowUtils.createActionOutPort(port, order++));
+            actionList.add(SfcOpenflowUtils.createActionOutPort(port, actionList.size()));
         }
 
         InstructionsBuilder isb = SfcOpenflowUtils.wrapActionsIntoApplyActionsInstruction(actionList);
@@ -1552,7 +1544,7 @@ public class SfcOfFlowProgrammerImpl implements SfcOfFlowProgrammerInterface {
         FlowBuilder nextHopFlow =
                 SfcOpenflowUtils.createFlowBuilder(
                         getTableId(TABLE_INDEX_NEXT_HOP),
-                        flowPriority, "nextHop", match, isb);
+                        flowPriority, NEXT_HOP_FLOW_NAME_LITERAL, match, isb);
         sfcOfFlowWriter.writeFlow(flowRspId, sffNodeName, nextHopFlow);
     }
 
@@ -1608,7 +1600,7 @@ public class SfcOfFlowProgrammerImpl implements SfcOfFlowProgrammerInterface {
         // Make the cookie
         BigInteger cookie =
                 new BigInteger(
-                        new String(TRANSPORT_EGRESS_COOKIE_STR_BASE + cookieStr),
+                        TRANSPORT_EGRESS_COOKIE_STR_BASE + cookieStr,
                         COOKIE_BIGINT_HEX_RADIX);
 
         FlowBuilder transportEgressFlowBuilder = SfcOpenflowUtils.createFlowBuilder(
index 215e139cbe4b6c6d1c1dd88d6c4a069b040392ff..be652f7fc97380588e44e1724afc98272737dece 100644 (file)
@@ -197,7 +197,7 @@ public class SfcOfRspProcessor {
     *
     * @return an RSP Transport Processor for the RSP.
     */
-    private SfcRspTransportProcessorBase getReusableTransporProcessor(SffGraph sffGraph, RenderedServicePath rsp) {
+    private SfcRspTransportProcessorBase getReusableTransportProcessor(SffGraph sffGraph, RenderedServicePath rsp) {
         String transportProcessorKey = sffGraph.isUsingLogicalSFF() ?
                 LOGICAL_SFF_TRANSPORT_PROCESSOR_KEY :
                 getTransportEncapName(
@@ -225,7 +225,7 @@ public class SfcOfRspProcessor {
      * @return an RSP Transport Processor for the RSP.
      */
     public SfcRspTransportProcessorBase getTransportProcessor(SffGraph sffGraph, RenderedServicePath rsp) {
-        SfcRspTransportProcessorBase transportProcessor = getReusableTransporProcessor(sffGraph, rsp);
+        SfcRspTransportProcessorBase transportProcessor = getReusableTransportProcessor(sffGraph, rsp);
         transportProcessor.setRsp(rsp);
         transportProcessor.setSffGraph(sffGraph);
         return transportProcessor;
@@ -575,12 +575,10 @@ public class SfcOfRspProcessor {
     }
 
     private String getTransportEncapName(final String transportName, final String encapName) {
-        StringBuffer sb =
-                new StringBuffer(transportName).
-                append(TRANSPORT_ENCAP_SEPARATOR_STRING).
-                append(encapName);
-        LOG.info("getTransportEncapName :: transport [{}] encap [{}] result [{}]", transportName, encapName, sb.toString());
-        return sb.toString();
+        return new StringBuilder(transportName)
+                .append(TRANSPORT_ENCAP_SEPARATOR_STRING)
+                .append(encapName)
+                .toString();
     }
 
     /**
index 7e2535d8b3f1dd9f05ca4ae5e22ad4850275fdfc..7078689b479eb0a96eb58315411a9072f74b21b6 100644 (file)
@@ -14,6 +14,7 @@ import org.junit.Test;
 import org.mockito.invocation.InvocationOnMock;
 import org.mockito.stubbing.Answer;
 import org.opendaylight.sfc.ofrenderer.openflow.SfcOfFlowProgrammerImpl;
+import org.opendaylight.sfc.util.openflow.OpenflowConstants;
 import org.opendaylight.sfc.util.openflow.transactional_writer.SfcOfFlowWriterInterface;
 import org.opendaylight.sfc.util.openflow.SfcOpenflowUtils;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DropActionCase;
@@ -96,9 +97,9 @@ public class SfcOfFlowProgrammerTest {
     private static final short TABLE_BASE = 30;
     private static final short TABLE_EGRESS = 80;
 
-    SfcOfFlowWriterInterface sfcOfFlowWriter;
-    SfcOfFlowProgrammerImpl sfcOfFlowProgrammer;
-    FlowBuilder flowBuilder;
+    private SfcOfFlowWriterInterface sfcOfFlowWriter;
+    private SfcOfFlowProgrammerImpl sfcOfFlowProgrammer;
+    private FlowBuilder flowBuilder;
 
     public SfcOfFlowProgrammerTest() {
         this.flowBuilder = null;
@@ -182,7 +183,7 @@ public class SfcOfFlowProgrammerTest {
 
     /**
      * Unit test to check match and action fields from flows generated by:
-     * {@link org.opendaylight.sfc.ofrenderer.openflow.SfcOfFlowProgrammerImpl#configureNshVxgpeTransportIngressFlow(String)}
+     * {@link org.opendaylight.sfc.ofrenderer.openflow.SfcOfFlowProgrammerImpl#configureNshVxgpeTransportIngressFlow(String, long, short)}
      */
     @Test
     public void configureNshVxgpeTransportIngressFlow() {
@@ -273,7 +274,7 @@ public class SfcOfFlowProgrammerTest {
                 DstOfArpSpaCase arpSpa = (DstOfArpSpaCase) regMove5.getNxRegMove().getDst().getDstChoice();
 
                 assertTrue(regMove.getNxRegMove().getDst().getDstChoice() != null);
-                assertEquals(setField.getSetField().getEthernetMatch().getEthernetSource().getAddress().getValue().toString(), MAC_SRC);
+                assertEquals(setField.getSetField().getEthernetMatch().getEthernetSource().getAddress().getValue(), MAC_SRC);
                 assertEquals(regLoad.getNxRegLoad().getValue().intValue(), SfcOpenflowUtils.ARP_REPLY);
                 assertTrue(arpSha.isNxArpSha());
                 assertTrue(arpTha.isNxArpTha());
@@ -284,7 +285,7 @@ public class SfcOfFlowProgrammerTest {
 
                 LOG.info("configureArpTransportIngressFlow() Action ArpOp: [{}], SrcMac: [{}], Output port: [{}]",
                         regLoad.getNxRegLoad().getValue().intValue(),
-                        setField.getSetField().getEthernetMatch().getEthernetSource().getAddress().getValue().toString(),
+                        setField.getSetField().getEthernetMatch().getEthernetSource().getAddress().getValue(),
                         output.getOutputAction().getOutputNodeConnector().getValue());
 
             }
@@ -309,7 +310,7 @@ public class SfcOfFlowProgrammerTest {
         assertEquals(match.getProtocolMatchFields().getMplsLabel().longValue(), MPLS_LABEL);
         LOG.info("configureMplsPathMapperFlow() Match EtherType: [{}], Mpls Label: [{}]",
                 match.getEthernetMatch().getEthernetType().getType().getValue(),
-                match.getProtocolMatchFields().getMplsLabel().longValue());
+                match.getProtocolMatchFields().getMplsLabel());
         //TODO Two test cases for MPLS UCAST/MCAST shall be done
 
         Instructions isb = flowBuilder.getInstructions();
@@ -390,10 +391,10 @@ public class SfcOfFlowProgrammerTest {
         assertEquals(flowBuilder.getPriority().intValue(), SfcOfFlowProgrammerImpl.FLOW_PRIORITY_NEXT_HOP);
 
         Match match = flowBuilder.getMatch();
-        assertEquals(match.getEthernetMatch().getEthernetSource().getAddress().getValue().toString(), MAC_SRC);
+        assertEquals(match.getEthernetMatch().getEthernetSource().getAddress().getValue(), MAC_SRC);
         assertEquals(match.getMetadata().getMetadata().longValue(), SFP);
         LOG.info("configureNextHopFlow() Match SrcMac: [{}], Sfp: [{}]",
-                match.getEthernetMatch().getEthernetSource().getAddress().getValue().toString(),
+                match.getEthernetMatch().getEthernetSource().getAddress().getValue(),
                 match.getMetadata().getMetadata().longValue());
 
 
@@ -406,9 +407,9 @@ public class SfcOfFlowProgrammerTest {
 
                 ApplyActionsCase action = (ApplyActionsCase) curInstruction;
                 SetFieldCase setField = (SetFieldCase) action.getApplyActions().getAction().get(0).getAction();
-                assertEquals(setField.getSetField().getEthernetMatch().getEthernetDestination().getAddress().getValue().toString(), MAC_DST);
+                assertEquals(setField.getSetField().getEthernetMatch().getEthernetDestination().getAddress().getValue(), MAC_DST);
                 LOG.info("configureNextHopFlow() Action Set DstMac: [{}]",
-                        setField.getSetField().getEthernetMatch().getEthernetDestination().getAddress().getValue().toString());
+                        setField.getSetField().getEthernetMatch().getEthernetDestination().getAddress().getValue());
             }
 
             checkGoToTable(curInstruction, SfcOfFlowProgrammerImpl.TABLE_INDEX_TRANSPORT_EGRESS);
@@ -431,10 +432,10 @@ public class SfcOfFlowProgrammerTest {
         assertEquals(flowBuilder.getPriority().intValue(), SfcOfFlowProgrammerImpl.FLOW_PRIORITY_NEXT_HOP);
 
         Match match = flowBuilder.getMatch();
-        assertEquals(match.getEthernetMatch().getEthernetSource().getAddress().getValue().toString(), MAC_SRC);
+        assertEquals(match.getEthernetMatch().getEthernetSource().getAddress().getValue(), MAC_SRC);
         assertEquals(match.getMetadata().getMetadata().longValue(), SFP);
         LOG.info("configureGroupNextHopFlow() Match SrcMac: [{}], Sfp: [{}]",
-                match.getEthernetMatch().getEthernetSource().getAddress().getValue().toString(),
+                match.getEthernetMatch().getEthernetSource().getAddress().getValue(),
                 match.getMetadata().getMetadata().longValue());
 
         Instructions isb = flowBuilder.getInstructions();
@@ -511,7 +512,7 @@ public class SfcOfFlowProgrammerTest {
         assertEquals(match.getEthernetMatch().getEthernetDestination().getAddress().getValue(), MAC_DST);
         assertEquals(match.getMetadata().getMetadata().longValue(), PATH_ID_SMALL);
         LOG.info("configureMacTransportEgressFlow() Match DstMac: [{}], Sfp: [{}]",
-                match.getEthernetMatch().getEthernetDestination().getAddress().getValue().toString(),
+                match.getEthernetMatch().getEthernetDestination().getAddress().getValue(),
                 match.getMetadata().getMetadata().longValue());
 
         Instructions isb = flowBuilder.getInstructions();
@@ -531,12 +532,12 @@ public class SfcOfFlowProgrammerTest {
                 assertEquals(dscp.getSetField().getIpMatch().getIpDscp().getValue().shortValue(), PATH_ID_SMALL);
                 assertEquals(pushVlan.getPushVlanAction().getEthernetType().intValue(), SfcOpenflowUtils.ETHERTYPE_VLAN);
                 assertEquals(vlanId.getSetField().getVlanMatch().getVlanId().getVlanId().getValue().intValue(), VLAN_ID);
-                assertEquals(setField.getSetField().getEthernetMatch().getEthernetSource().getAddress().getValue().toString(), MAC_SRC);
-                assertEquals(output.getOutputAction().getOutputNodeConnector().getValue().toString(), PORT);
+                assertEquals(setField.getSetField().getEthernetMatch().getEthernetSource().getAddress().getValue(), MAC_SRC);
+                assertEquals(output.getOutputAction().getOutputNodeConnector().getValue(), PORT);
 
                 LOG.info("configureMacTransportEgressFlow() Action SrcMac: [{}], OutputPort: [{}]",
-                        setField.getSetField().getEthernetMatch().getEthernetSource().getAddress().getValue().toString(),
-                        output.getOutputAction().getOutputNodeConnector().getValue().toString());
+                        setField.getSetField().getEthernetMatch().getEthernetSource().getAddress().getValue(),
+                        output.getOutputAction().getOutputNodeConnector().getValue());
             }
         }
     }
@@ -576,10 +577,10 @@ public class SfcOfFlowProgrammerTest {
                 assertEquals(vlanId.getSetField().getVlanMatch().getVlanId().getVlanId().getValue().intValue(), VLAN_ID);
                 assertEquals(output.getOutputAction().getOutputNodeConnector().getValue(), PORT);
                 LOG.info("configureVlanTransportEgressFlow() Action SrcMac is: [{}], PushVlan Ethertype: [{}], VlanId: [{}], OuputPort: [{}]",
-                        setField.getSetField().getEthernetMatch().getEthernetSource().getAddress().getValue().toString(),
+                        setField.getSetField().getEthernetMatch().getEthernetSource().getAddress().getValue(),
                         pushVlan.getPushVlanAction().getEthernetType().toString(),
                         vlanId.getSetField().getVlanMatch().getVlanId().getVlanId().getValue(),
-                        output.getOutputAction().getOutputNodeConnector().getValue().toString());
+                        output.getOutputAction().getOutputNodeConnector().getValue());
             }
         }
     }
@@ -595,7 +596,7 @@ public class SfcOfFlowProgrammerTest {
         flowBuilder = sfcOfFlowWriter.getFlowBuilder();
 
         assertEquals(flowBuilder.getTableId().shortValue(), SfcOfFlowProgrammerImpl.TABLE_INDEX_TRANSPORT_EGRESS);
-        int priority = flowBuilder.getPriority().intValue();
+        int priority = flowBuilder.getPriority();
         assertTrue((priority == SfcOfFlowProgrammerImpl.FLOW_PRIORITY_TRANSPORT_EGRESS) ||
                    (priority == SfcOfFlowProgrammerImpl.FLOW_PRIORITY_TRANSPORT_EGRESS+5));
         checkMatchNsh(flowBuilder.build(), NSP, NSI);
@@ -680,7 +681,7 @@ public class SfcOfFlowProgrammerTest {
                 assertTrue(gpeNp.isNxTunGpeNp());
                 assertEquals(output.getOutputAction().getOutputNodeConnector().getValue(), PORT);
                 LOG.info("configureNshVxgpeTransportEgressFlow() Action OutputPort: [{}]",
-                        output.getOutputAction().getOutputNodeConnector().getValue().toString());
+                        output.getOutputAction().getOutputNodeConnector().getValue());
             }
         }
     }
@@ -715,15 +716,15 @@ public class SfcOfFlowProgrammerTest {
                 SetFieldCase setField = (SetFieldCase) action.getApplyActions().getAction().get(2).getAction();
                 OutputActionCase output = (OutputActionCase) action.getApplyActions().getAction().get(3).getAction();
 
-                assertEquals(setField.getSetField().getEthernetMatch().getEthernetSource().getAddress().getValue().toString(), MAC_SRC);
+                assertEquals(setField.getSetField().getEthernetMatch().getEthernetSource().getAddress().getValue(), MAC_SRC);
                 assertEquals(pushMpls.getPushMplsAction().getEthernetType().intValue(), SfcOpenflowUtils.ETHERTYPE_MPLS_UCAST);
                 assertEquals(mplsLabel.getSetField().getProtocolMatchFields().getMplsLabel().longValue(), MPLS_LABEL);
                 assertEquals(output.getOutputAction().getOutputNodeConnector().getValue(), PORT);
                 LOG.info("configureMplsTransportEgressFlow() Action SrcMac: [{}], PushMplsEthertype: [{}], LabelId: [{}], OutputPort: [{}]",
-                        setField.getSetField().getEthernetMatch().getEthernetSource().getAddress().getValue().toString(),
+                        setField.getSetField().getEthernetMatch().getEthernetSource().getAddress().getValue(),
                         pushMpls.getPushMplsAction().getEthernetType().toString(),
                         mplsLabel.getSetField().getProtocolMatchFields().getMplsLabel(),
-                        output.getOutputAction().getOutputNodeConnector().getValue().toString());
+                        output.getOutputAction().getOutputNodeConnector().getValue());
             }
         }
     }
@@ -750,10 +751,14 @@ public class SfcOfFlowProgrammerTest {
 
             if (curInstruction instanceof ApplyActionsCase) {
                 ApplyActionsCase action = (ApplyActionsCase) curInstruction;
-                OutputActionCase output = (OutputActionCase) action.getApplyActions().getAction().get(0).getAction();
+                assertEquals(2, action.getApplyActions().getAction().size());
+                NxActionRegLoadNodesNodeTableFlowApplyActionsCase loadNextProtocol =
+                        (NxActionRegLoadNodesNodeTableFlowApplyActionsCase) action.getApplyActions().getAction().get(0).getAction();
+                OutputActionCase output = (OutputActionCase) action.getApplyActions().getAction().get(1).getAction();
+                assertEquals(Short.toString(OpenflowConstants.TUN_GPE_NP_NSH), loadNextProtocol.getNxRegLoad().getValue().toString());
                 assertEquals(output.getOutputAction().getOutputNodeConnector().getValue(), PORT);
                 LOG.info("configureNshNscTransportEgressFlow() Action OutputPort is: [{}]",
-                        output.getOutputAction().getOutputNodeConnector().getValue().toString());
+                        output.getOutputAction().getOutputNodeConnector().getValue());
             }
         }
     }
@@ -1150,7 +1155,7 @@ public class SfcOfFlowProgrammerTest {
     public void appCoexistencePathMapperAcl() {
         sfcOfFlowProgrammer.setTableBase(TABLE_BASE);
         sfcOfFlowProgrammer.setTableEgress(TABLE_EGRESS);
-        ((SfcOfFlowProgrammerImpl) sfcOfFlowProgrammer).configurePathMapperAclFlow(SFF_NAME, IP_SRC, IP_DST, (short) PATH_ID);
+        sfcOfFlowProgrammer.configurePathMapperAclFlow(SFF_NAME, IP_SRC, IP_DST, (short) PATH_ID);
         flowBuilder = sfcOfFlowWriter.getFlowBuilder();
         assertEquals(flowBuilder.getTableId().shortValue(),
                 SfcOfFlowProgrammerImpl.TABLE_INDEX_PATH_MAPPER_ACL + TABLE_BASE - 2);
@@ -1158,11 +1163,11 @@ public class SfcOfFlowProgrammerTest {
         checkGoToTable(curInstruction, (short)(SfcOfFlowProgrammerImpl.TABLE_INDEX_NEXT_HOP + TABLE_BASE - 2), true);
     }
 
-    public void checkGoToTable(Instruction curInstruction, short nextTableId) {
+    private void checkGoToTable(Instruction curInstruction, short nextTableId) {
         checkGoToTable(curInstruction, nextTableId, false);
     }
 
-    public void checkGoToTable(Instruction curInstruction, short nextTableId, boolean mustExist) {
+    private void checkGoToTable(Instruction curInstruction, short nextTableId, boolean mustExist) {
 
         if (curInstruction instanceof GoToTableCase) {
             GoToTableCase goToTablecase = (GoToTableCase) curInstruction;
@@ -1175,7 +1180,7 @@ public class SfcOfFlowProgrammerTest {
         }
     }
 
-    public void checkActionHasResubmit(Instruction curInstruction, short nextTableId) {
+    private void checkActionHasResubmit(Instruction curInstruction, short nextTableId) {
         assertTrue(curInstruction instanceof ApplyActionsCase);
         boolean resubmitActionFound = false;
         for(Action action : ((ApplyActionsCase) curInstruction).getApplyActions().getAction()){
@@ -1192,11 +1197,7 @@ public class SfcOfFlowProgrammerTest {
         assertTrue(resubmitActionFound);
     }
 
-    public void checkDrop(Instruction curInstruction) {
-        checkDrop(curInstruction, false);
-    }
-
-    public void checkDrop(Instruction curInstruction, boolean mustExist) {
+    private void checkDrop(Instruction curInstruction, boolean mustExist) {
 
         if (curInstruction instanceof ApplyActionsCase) {
             ApplyActionsCase action = (ApplyActionsCase) curInstruction;
@@ -1210,7 +1211,7 @@ public class SfcOfFlowProgrammerTest {
         }
     }
 
-    public void checkMetadata(Instruction curInstruction, long pathId) {
+    private void checkMetadata(Instruction curInstruction, long pathId) {
 
         if (curInstruction instanceof WriteMetadataCase) {
             WriteMetadataCase metadata = (WriteMetadataCase) curInstruction;
@@ -1218,7 +1219,7 @@ public class SfcOfFlowProgrammerTest {
         }
     }
 
-    public void checkMatchNsh(Flow flow, long nsp, short nsi) {
+    private void checkMatchNsh(Flow flow, long nsp, short nsi) {
 
         GeneralAugMatchNodesNodeTableFlow genAug = flow.getMatch().getAugmentation(
                 GeneralAugMatchNodesNodeTableFlow.class);
index 698700a769aa2d40e3d8d94270cc166022df7f32..2f3047ca3eb4ff9d5ede1d226230432cb6fd3d5d 100644 (file)
@@ -175,7 +175,7 @@ public class SfcOfLogicalSffRspProcessorTest {
         PowerMockito.mockStatic(SfcGeniusDataUtils.class);
         Mockito.when(dataBroker.newWriteOnlyTransaction()).thenReturn(Mockito.mock(WriteTransaction.class));
         PowerMockito.when(sfcOfRspProcessor, "getGeniusRpcClient").thenReturn(geniusClient);
-        PowerMockito.doReturn(logicalSffProcessor).when(sfcOfRspProcessor, "getReusableTransporProcessor", any(), any());
+        PowerMockito.doReturn(logicalSffProcessor).when(sfcOfRspProcessor, "getReusableTransportProcessor", any(), any());
         PowerMockito.when(geniusClient, "getInterfaceManagerRpcService").thenReturn(interfaceManagerRpcService);
         PowerMockito.when(geniusClient, "getItmRpcService").thenReturn(itmRpcService);