BUG-432 Registration change
[openflowplugin.git] / test-provider / src / main / java / org / opendaylight / openflowplugin / test / OpenflowpluginTestCommandProvider.java
index fd06be13efd82f58156df01d42a083984074507b..290460b896fd815bfed931682e79b66336e5fd58 100644 (file)
@@ -13,6 +13,14 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.Collection;
+import java.util.Iterator;
 
 import org.eclipse.osgi.framework.console.CommandInterpreter;
 import org.eclipse.osgi.framework.console.CommandProvider;
@@ -115,13 +123,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.ta
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowAdded;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowRemoved;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowUpdated;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.NodeErrorNotification;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.NodeExperimenterErrorNotification;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowListener;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SwitchFlowRemoved;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.OutputPortValues;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.InstructionsBuilder;
@@ -161,17 +164,20 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.MetadataBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.ProtocolMatchFieldsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.TcpFlagMatchBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.TunnelBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatchBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4Match;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.TunnelIpv4MatchBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatchBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatchBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.protocol.match.fields.PbbBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.vlan.match.fields.VlanIdBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.node.error.service.rev140410.NodeErrorListener;
 import org.opendaylight.yangtools.concepts.Registration;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
@@ -191,9 +197,11 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
     private NodeBuilder testNode;
     private final String originalFlowName = "Foo";
     private final String updatedFlowName = "Bar";
-    private final FlowEventListener flowEventListener = new FlowEventListener();
+    private final SalFlowListener flowEventListener = new FlowEventListenerLoggingImpl();
+    private final NodeErrorListener nodeErrorListener = new NodeErrorListenerLoggingImpl();
     private static NotificationService notificationService;
-    private Registration<org.opendaylight.yangtools.yang.binding.NotificationListener> listener1Reg;
+    private Registration listener1Reg;
+    private Registration listener2Reg;
 
     public OpenflowpluginTestCommandProvider(BundleContext ctx) {
         this.ctx = ctx;
@@ -204,6 +212,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         notificationService = session.getSALService(NotificationService.class);
         // For switch events
         listener1Reg = notificationService.registerNotificationListener(flowEventListener);
+        listener2Reg = notificationService.registerNotificationListener(nodeErrorListener);
         dataBrokerService = session.getSALService(DataBrokerService.class);
         ctx.registerService(CommandProvider.class.getName(), this, null);
         createTestFlow(createTestNode(null), null, null);
@@ -221,56 +230,6 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         return builder;
     }
 
-    final class FlowEventListener implements SalFlowListener {
-
-        List<FlowAdded> addedFlows = new ArrayList<>();
-        List<FlowRemoved> removedFlows = new ArrayList<>();
-        List<FlowUpdated> updatedFlows = new ArrayList<>();
-
-        @Override
-        public void onFlowAdded(FlowAdded notification) {
-            LOG.info("flow to be added.........................." + notification.toString());
-            LOG.info("added flow Xid........................." + notification.getTransactionId().getValue());
-            LOG.info("-----------------------------------------------------------------------------------");
-            addedFlows.add(notification);
-        }
-
-        @Override
-        public void onFlowRemoved(FlowRemoved notification) {
-            LOG.debug("removed flow.........................." + notification.toString());
-            LOG.debug("remove flow Xid........................." + notification.getTransactionId().getValue());
-            LOG.debug("-----------------------------------------------------------------------------------");
-            removedFlows.add(notification);
-        };
-
-        @Override
-        public void onFlowUpdated(FlowUpdated notification) {
-            LOG.debug("updated flow.........................." + notification.toString());
-            LOG.debug("updated flow Xid........................." + notification.getTransactionId().getValue());
-            LOG.debug("-----------------------------------------------------------------------------------");
-            updatedFlows.add(notification);
-        }
-
-        @Override
-        public void onNodeErrorNotification(NodeErrorNotification notification) {
-            LOG.error("Error notification  flow Xid........................."
-                    + notification.getTransactionId().getValue());
-            LOG.debug("-----------------------------------------------------------------------------------");
-        }
-
-        @Override
-        public void onNodeExperimenterErrorNotification(NodeExperimenterErrorNotification notification) {
-            // TODO Auto-generated method stub
-
-        }
-
-        @Override
-        public void onSwitchFlowRemoved(SwitchFlowRemoved notification) {
-            LOG.debug("Switch flow removed : Cookies..................." + notification.getCookie().toString());
-            LOG.debug("-----------------------------------------------------------------------------------");
-        }
-    }
-
     private InstanceIdentifier<Node> nodeBuilderToInstanceId(NodeBuilder node) {
         return InstanceIdentifier.builder(Nodes.class).child(Node.class, node.getKey()).toInstance();
     }
@@ -284,6 +243,8 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         if (flowType == null) {
             flowType = "f1";
         }
+        
+        flow.setPriority(2);
 
         switch (flowType) {
         case "f1":
@@ -558,6 +519,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
             id += 54;
             flow.setMatch(new MatchBuilder().build());
             flow.setInstructions(createSentToControllerInstructions().build());
+            flow.setPriority(0);
             break;
         case "f55":
             id += 55;
@@ -687,7 +649,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
             break;
         case "f80":
             id += 80;
-            flow.setMatch(createMatch1().build());
+            flow.setMatch(createVlanMatch().build());
             flow.setInstructions(createAppyActionInstruction88().build());
             break;
         case "f81":
@@ -700,6 +662,26 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
             flow.setMatch(createToSMatch().build());
             flow.setInstructions(createOutputInstructions().build());
             break;
+        case "f83":
+            id += 83; // Test TCP_Flag Match
+            flow.setMatch(createTcpFlagMatch().build());
+            flow.setInstructions(createDropInstructions().build());
+            break;
+        case "f84":
+            id += 84;
+            flow.setMatch(createVlanMatch().build()); // match vlan=10,dl_vlan_pcp=3
+            flow.setInstructions(createAppyActionInstruction88().build()); // vlan_pcp=4
+            break;
+        case "f85":
+            id += 85; // Test Tunnel IPv4 Src (e.g. set_field:172.16.100.200->tun_src)
+            flow.setMatch(createMatch3().build());
+            flow.setInstructions(createTunnelIpv4SrcInstructions().build());
+            break;
+        case "f86":
+            id += 86; // Test Tunnel IPv4 Dst (e.g. set_field:172.16.100.100->tun_dst)
+            flow.setMatch(createMatch1().build());
+            flow.setInstructions(createTunnelIpv4DstInstructions().build());
+            break;
         default:
             LOG.warn("flow type not understood: {}", flowType);
         }
@@ -711,8 +693,8 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // flow.setBufferId(new Long(12));
         BigInteger value = new BigInteger("10", 10);
         // BigInteger outputPort = new BigInteger("65535", 10);
-        flow.setCookie(value);
-        flow.setCookieMask(value);
+        flow.setCookie(new FlowCookie(value));
+        flow.setCookieMask(new FlowCookie(value));
         flow.setHardTimeout(0);
         flow.setIdleTimeout(0);
         flow.setInstallHw(false);
@@ -730,12 +712,64 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // flow.setOutPort(outputPort);
 
         flow.setKey(key);
-        flow.setPriority(2);
         flow.setFlowName(originalFlowName + "X" + flowType);
         testFlow = flow;
         return flow;
     }
 
+    
+    private FlowBuilder createTestFlow_perfTest(NodeBuilder nodeBuilder, String flowTypeArg, String tableId, int id) {
+
+        FlowBuilder flow = new FlowBuilder();
+        //long id = 123;
+
+        String flowType = flowTypeArg;
+        if (flowType == null) {
+            flowType = "f1";
+        }
+        
+        flow.setPriority(id);
+
+        switch (flowType) {
+        case "f1":
+            id += 1;
+            flow.setMatch(createMatch1().build());
+            flow.setInstructions(createDecNwTtlInstructions().build());
+            break;
+        default:
+            LOG.warn("flow type not understood: {}", flowType);
+        }
+
+        FlowKey key = new FlowKey(new FlowId(Long.toString(id)));
+        if (null == flow.isBarrier()) {
+            flow.setBarrier(Boolean.FALSE);
+        }
+        // flow.setBufferId(new Long(12));
+        BigInteger value = new BigInteger("10", 10);
+        // BigInteger outputPort = new BigInteger("65535", 10);
+        flow.setCookie(new FlowCookie(value));
+        flow.setCookieMask(new FlowCookie(value));
+        flow.setHardTimeout(0);
+        flow.setIdleTimeout(0);
+        flow.setInstallHw(false);
+        flow.setStrict(false);
+        flow.setContainerName(null);
+        flow.setFlags(new FlowModFlags(false, false, false, false, true));
+        flow.setId(new FlowId("12"));
+        flow.setTableId(getTableId(tableId));
+        // commenting setOutGroup and setOutPort, as by default
+        // OFPG_ANY is send
+        // enable setOutGroup and setOutPort to enable output filtering
+        // flow.setOutGroup(new Long(2));
+        // set outport to OFPP_NONE (65535) to disable remove restriction for
+        // flow
+        // flow.setOutPort(outputPort);
+
+        flow.setKey(key);
+        flow.setFlowName(originalFlowName + "X" + flowType);
+        testFlow = flow;
+        return flow;
+    }
     private FlowBuilder createtablemiss(NodeBuilder nodeBuilder, String flowTypeArg, String tableId) {
         FlowBuilder flow = new FlowBuilder();
         long id = 456;
@@ -770,7 +804,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         DecNwTtl decNwTtl = ta.build();
         ActionBuilder ab = new ActionBuilder();
         ab.setAction(new DecNwTtlCaseBuilder().setDecNwTtl(decNwTtl).build());
-
+        ab.setKey(new ActionKey(0));
         // Add our drop action to a list
         List<Action> actionList = new ArrayList<Action>();
         actionList.add(ab.build());
@@ -778,7 +812,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Create an Apply Action
         ApplyActionsBuilder aab = new ApplyActionsBuilder();
         aab.setAction(actionList);
-
+       
         // Wrap our Apply Action in an Instruction
         InstructionBuilder ib = new InstructionBuilder();
         ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
@@ -789,6 +823,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         InstructionsBuilder isb = new InstructionsBuilder();
         List<Instruction> instructions = new ArrayList<Instruction>();
         instructions.add(ib.build());
+        ib.setKey(new InstructionKey(0));
         isb.setInstruction(instructions);
         return isb;
     }
@@ -807,6 +842,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         InstructionsBuilder isb = new InstructionsBuilder();
         List<Instruction> instructions = new ArrayList<Instruction>();
+        ib.setKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -824,6 +860,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         InstructionsBuilder isb = new InstructionsBuilder();
         List<Instruction> instructions = new ArrayList<Instruction>();
+        ib.setKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -832,7 +869,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
     private static InstructionsBuilder createGotoTableInstructions() {
 
         GoToTableBuilder aab = new GoToTableBuilder();
-        aab.setTableId((short) 2);
+        aab.setTableId((short) 5);
 
         InstructionBuilder ib = new InstructionBuilder();
         ib.setInstruction(new GoToTableCaseBuilder().setGoToTable(aab.build()).build());
@@ -840,6 +877,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         InstructionsBuilder isb = new InstructionsBuilder();
         List<Instruction> instructions = new ArrayList<Instruction>();
+        ib.setKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -850,11 +888,11 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         DropAction dropAction = dab.build();
         ActionBuilder ab = new ActionBuilder();
         ab.setAction(new DropActionCaseBuilder().setDropAction(dropAction).build());
-
+        ab.setKey(new ActionKey(0));
         // Add our drop action to a list
         List<Action> actionList = new ArrayList<Action>();
         actionList.add(ab.build());
-
+        ab.setKey(new ActionKey(0));
         // Create an Apply Action
         ApplyActionsBuilder aab = new ApplyActionsBuilder();
         aab.setAction(actionList);
@@ -866,6 +904,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         InstructionsBuilder isb = new InstructionsBuilder();
         List<Instruction> instructions = new ArrayList<Instruction>();
+        ib.setKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -878,6 +917,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         ControllerActionBuilder controller = new ControllerActionBuilder();
         controller.setMaxLength(5);
         ab.setAction(new ControllerActionCaseBuilder().setControllerAction(controller.build()).build());
+        ab.setKey(new ActionKey(0));
         actionList.add(ab.build());
         // Create an Apply Action
         ApplyActionsBuilder aab = new ApplyActionsBuilder();
@@ -890,6 +930,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         InstructionsBuilder isb = new InstructionsBuilder();
         List<Instruction> instructions = new ArrayList<Instruction>();
+        ib.setKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -905,6 +946,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         Uri value = new Uri("PCEP");
         output.setOutputNodeConnector(value);
         ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
+        ab.setKey(new ActionKey(0));
         actionList.add(ab.build());
         // Create an Apply Action
         ApplyActionsBuilder aab = new ApplyActionsBuilder();
@@ -917,6 +959,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         InstructionsBuilder isb = new InstructionsBuilder();
         List<Instruction> instructions = new ArrayList<Instruction>();
+        ib.setKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1050,6 +1093,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         PushMplsActionBuilder push = new PushMplsActionBuilder();
         push.setEthernetType(new Integer(0x8847));
         ab.setAction(new PushMplsActionCaseBuilder().setPushMplsAction(push.build()).build());
+        ab.setKey(new ActionKey(0));
         actionList.add(ab.build());
         // Create an Apply Action
         ApplyActionsBuilder aab = new ApplyActionsBuilder();
@@ -1062,6 +1106,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         InstructionsBuilder isb = new InstructionsBuilder();
         List<Instruction> instructions = new ArrayList<Instruction>();
+        ib.setKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1075,6 +1120,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         PushPbbActionBuilder pbb = new PushPbbActionBuilder();
         pbb.setEthernetType(new Integer(0x88E7));
         ab.setAction(new PushPbbActionCaseBuilder().setPushPbbAction(pbb.build()).build());
+        ab.setKey(new ActionKey(0));
         actionList.add(ab.build());
         // Create an Apply Action
         ApplyActionsBuilder aab = new ApplyActionsBuilder();
@@ -1087,6 +1133,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         InstructionsBuilder isb = new InstructionsBuilder();
         List<Instruction> instructions = new ArrayList<Instruction>();
+        ib.setKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1100,6 +1147,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         PushVlanActionBuilder vlan = new PushVlanActionBuilder();
         vlan.setEthernetType(new Integer(0x8100));
         ab.setAction(new PushVlanActionCaseBuilder().setPushVlanAction(vlan.build()).build());
+        ab.setKey(new ActionKey(0));
         actionList.add(ab.build());
 
         // Create an Apply Action
@@ -1113,6 +1161,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         InstructionsBuilder isb = new InstructionsBuilder();
         List<Instruction> instructions = new ArrayList<Instruction>();
+        ib.setKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1126,6 +1175,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         SetDlDstActionBuilder setdl = new SetDlDstActionBuilder();
         setdl.setAddress(new MacAddress("00:05:b9:7c:81:5f"));
         ab.setAction(new SetDlDstActionCaseBuilder().setSetDlDstAction(setdl.build()).build());
+        ab.setKey(new ActionKey(0));
         actionList.add(ab.build());
         // Create an Apply Action
         ApplyActionsBuilder aab = new ApplyActionsBuilder();
@@ -1138,6 +1188,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         InstructionsBuilder isb = new InstructionsBuilder();
         List<Instruction> instructions = new ArrayList<Instruction>();
+        ib.setKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1151,6 +1202,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         SetDlSrcActionBuilder src = new SetDlSrcActionBuilder();
         src.setAddress(new MacAddress("00:05:b9:7c:81:5f"));
         ab.setAction(new SetDlSrcActionCaseBuilder().setSetDlSrcAction(src.build()).build());
+        ab.setKey(new ActionKey(0));
         actionList.add(ab.build());
 
         // Create an Apply Action
@@ -1164,6 +1216,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         InstructionsBuilder isb = new InstructionsBuilder();
         List<Instruction> instructions = new ArrayList<Instruction>();
+        ib.setKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1178,6 +1231,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         VlanId a = new VlanId(4000);
         vl.setVlanId(a);
         ab.setAction(new SetVlanIdActionCaseBuilder().setSetVlanIdAction(vl.build()).build());
+        ab.setKey(new ActionKey(0));
         actionList.add(ab.build());
         // Create an Apply Action
         ApplyActionsBuilder aab = new ApplyActionsBuilder();
@@ -1190,6 +1244,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         InstructionsBuilder isb = new InstructionsBuilder();
         List<Instruction> instructions = new ArrayList<Instruction>();
+        ib.setKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1204,6 +1259,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         VlanPcp pcp1 = new VlanPcp((short) 2);
         pcp.setVlanPcp(pcp1);
         ab.setAction(new SetVlanPcpActionCaseBuilder().setSetVlanPcpAction(pcp.build()).build());
+        ab.setKey(new ActionKey(0));
         actionList.add(ab.build());
         // Create an Apply Action
         ApplyActionsBuilder aab = new ApplyActionsBuilder();
@@ -1216,6 +1272,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         InstructionsBuilder isb = new InstructionsBuilder();
         List<Instruction> instructions = new ArrayList<Instruction>();
+        ib.setKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1227,9 +1284,11 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         ActionBuilder ab = new ActionBuilder();
 
         SetVlanPcpActionBuilder pcp = new SetVlanPcpActionBuilder();
-        VlanPcp pcp1 = new VlanPcp((short) 9);
+        // the code point is a 3-bit(0-7) field representing the frame priority level
+        VlanPcp pcp1 = new VlanPcp((short) 4);
         pcp.setVlanPcp(pcp1);
         ab.setAction(new SetVlanPcpActionCaseBuilder().setSetVlanPcpAction(pcp.build()).build());
+        ab.setKey(new ActionKey(0));
         actionList.add(ab.build());
         // Create an Apply Action
         ApplyActionsBuilder aab = new ApplyActionsBuilder();
@@ -1242,6 +1301,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         InstructionsBuilder isb = new InstructionsBuilder();
         List<Instruction> instructions = new ArrayList<Instruction>();
+        ib.setKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1254,6 +1314,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         CopyTtlInBuilder ttlin = new CopyTtlInBuilder();
         ab.setAction(new CopyTtlInCaseBuilder().setCopyTtlIn(ttlin.build()).build());
+        ab.setKey(new ActionKey(0));
         actionList.add(ab.build());
         // Create an Apply Action
         ApplyActionsBuilder aab = new ApplyActionsBuilder();
@@ -1266,6 +1327,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         InstructionsBuilder isb = new InstructionsBuilder();
         List<Instruction> instructions = new ArrayList<Instruction>();
+        ib.setKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1278,6 +1340,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         CopyTtlOutBuilder ttlout = new CopyTtlOutBuilder();
         ab.setAction(new CopyTtlOutCaseBuilder().setCopyTtlOut(ttlout.build()).build());
+        ab.setKey(new ActionKey(0));
         actionList.add(ab.build());
         // Create an Apply Action
         ApplyActionsBuilder aab = new ApplyActionsBuilder();
@@ -1290,6 +1353,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         InstructionsBuilder isb = new InstructionsBuilder();
         List<Instruction> instructions = new ArrayList<Instruction>();
+        ib.setKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1302,6 +1366,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         DecMplsTtlBuilder mpls = new DecMplsTtlBuilder();
         ab.setAction(new DecMplsTtlCaseBuilder().setDecMplsTtl(mpls.build()).build());
+        ab.setKey(new ActionKey(0));
         actionList.add(ab.build());
         // Create an Apply Action
         ApplyActionsBuilder aab = new ApplyActionsBuilder();
@@ -1328,6 +1393,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         DecNwTtlBuilder nwttl = new DecNwTtlBuilder();
         ab.setAction(new DecNwTtlCaseBuilder().setDecNwTtl(nwttl.build()).build());
+        ab.setKey(new ActionKey(0));
         actionList.add(ab.build());
 
         // Create an Apply Action
@@ -1341,6 +1407,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         InstructionsBuilder isb = new InstructionsBuilder();
         List<Instruction> instructions = new ArrayList<Instruction>();
+        ib.setKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1353,6 +1420,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         DropActionBuilder drop = new DropActionBuilder();
         ab.setAction(new DropActionCaseBuilder().setDropAction(drop.build()).build());
+        ab.setKey(new ActionKey(0));
         actionList.add(ab.build());
 
         // Create an Apply Action
@@ -1366,6 +1434,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         InstructionsBuilder isb = new InstructionsBuilder();
         List<Instruction> instructions = new ArrayList<Instruction>();
+        ib.setKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1378,6 +1447,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         FloodActionBuilder fld = new FloodActionBuilder();
         ab.setAction(new FloodActionCaseBuilder().setFloodAction(fld.build()).build());
+        ab.setKey(new ActionKey(0));
         actionList.add(ab.build());
         // Create an Apply Action
         ApplyActionsBuilder aab = new ApplyActionsBuilder();
@@ -1390,6 +1460,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         InstructionsBuilder isb = new InstructionsBuilder();
         List<Instruction> instructions = new ArrayList<Instruction>();
+        ib.setKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1402,6 +1473,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         FloodAllActionBuilder fldall = new FloodAllActionBuilder();
         ab.setAction(new FloodAllActionCaseBuilder().setFloodAllAction(fldall.build()).build());
+        ab.setKey(new ActionKey(0));
         actionList.add(ab.build());
         // Create an Apply Action
         ApplyActionsBuilder aab = new ApplyActionsBuilder();
@@ -1414,6 +1486,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         InstructionsBuilder isb = new InstructionsBuilder();
         List<Instruction> instructions = new ArrayList<Instruction>();
+        ib.setKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1428,6 +1501,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         groupActionB.setGroupId(1L);
         groupActionB.setGroup("0");
         ab.setAction(new GroupActionCaseBuilder().setGroupAction(groupActionB.build()).build());
+        ab.setKey(new ActionKey(0));
         actionList.add(ab.build());
 
         // Create an Apply Action
@@ -1441,6 +1515,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         InstructionsBuilder isb = new InstructionsBuilder();
         List<Instruction> instructions = new ArrayList<Instruction>();
+        ib.setKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1453,6 +1528,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         HwPathActionBuilder hwPathB = new HwPathActionBuilder();
         ab.setAction(new HwPathActionCaseBuilder().setHwPathAction(hwPathB.build()).build());
+        ab.setKey(new ActionKey(0));
         actionList.add(ab.build());
         // Create an Apply Action
         ApplyActionsBuilder aab = new ApplyActionsBuilder();
@@ -1465,6 +1541,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         InstructionsBuilder isb = new InstructionsBuilder();
         List<Instruction> instructions = new ArrayList<Instruction>();
+        ib.setKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1477,6 +1554,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         LoopbackActionBuilder loopbackActionBuilder = new LoopbackActionBuilder();
         ab.setAction(new LoopbackActionCaseBuilder().setLoopbackAction(loopbackActionBuilder.build()).build());
+        ab.setKey(new ActionKey(0));
         actionList.add(ab.build());
 
         // Create an Apply Action
@@ -1490,6 +1568,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         InstructionsBuilder isb = new InstructionsBuilder();
         List<Instruction> instructions = new ArrayList<Instruction>();
+        ib.setKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1503,6 +1582,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         PopMplsActionBuilder popMplsActionBuilder = new PopMplsActionBuilder();
         popMplsActionBuilder.setEthernetType(0XB);
         ab.setAction(new PopMplsActionCaseBuilder().setPopMplsAction(popMplsActionBuilder.build()).build());
+        ab.setKey(new ActionKey(0));
         actionList.add(ab.build());
         // Create an Apply Action
         ApplyActionsBuilder aab = new ApplyActionsBuilder();
@@ -1515,6 +1595,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         InstructionsBuilder isb = new InstructionsBuilder();
         List<Instruction> instructions = new ArrayList<Instruction>();
+        ib.setKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1527,6 +1608,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         PopPbbActionBuilder popPbbActionBuilder = new PopPbbActionBuilder();
         ab.setAction(new PopPbbActionCaseBuilder().setPopPbbAction(popPbbActionBuilder.build()).build());
+        ab.setKey(new ActionKey(0));
         actionList.add(ab.build());
         // Create an Apply Action
         ApplyActionsBuilder aab = new ApplyActionsBuilder();
@@ -1539,6 +1621,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         InstructionsBuilder isb = new InstructionsBuilder();
         List<Instruction> instructions = new ArrayList<Instruction>();
+        ib.setKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1551,6 +1634,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         PopVlanActionBuilder popVlanActionBuilder = new PopVlanActionBuilder();
         ab.setAction(new PopVlanActionCaseBuilder().setPopVlanAction(popVlanActionBuilder.build()).build());
+        ab.setKey(new ActionKey(0));
         actionList.add(ab.build());
 
         // Create an Apply Action
@@ -1564,6 +1648,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         InstructionsBuilder isb = new InstructionsBuilder();
         List<Instruction> instructions = new ArrayList<Instruction>();
+        ib.setKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1577,6 +1662,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         SetDlTypeActionBuilder setDlTypeActionBuilder = new SetDlTypeActionBuilder();
         setDlTypeActionBuilder.setDlType(new EtherType(8L));
         ab.setAction(new SetDlTypeActionCaseBuilder().setSetDlTypeAction(setDlTypeActionBuilder.build()).build());
+        ab.setKey(new ActionKey(0));
         actionList.add(ab.build());
 
         // Create an Apply Action
@@ -1590,6 +1676,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         InstructionsBuilder isb = new InstructionsBuilder();
         List<Instruction> instructions = new ArrayList<Instruction>();
+        ib.setKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1602,6 +1689,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
         setFieldBuilder.setInPort(new NodeConnectorId(nodeId + ":2"));
+        ab.setKey(new ActionKey(0));
         actionList.add(ab.build());
 
         // Create an Apply Action
@@ -1615,6 +1703,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         InstructionsBuilder isb = new InstructionsBuilder();
         List<Instruction> instructions = new ArrayList<Instruction>();
+        ib.setKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1628,6 +1717,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         SetMplsTtlActionBuilder setMplsTtlActionBuilder = new SetMplsTtlActionBuilder();
         setMplsTtlActionBuilder.setMplsTtl((short) 0X1);
         ab.setAction(new SetMplsTtlActionCaseBuilder().setSetMplsTtlAction(setMplsTtlActionBuilder.build()).build());
+        ab.setKey(new ActionKey(0));
         actionList.add(ab.build());
 
         // Create an Apply Action
@@ -1641,6 +1731,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         InstructionsBuilder isb = new InstructionsBuilder();
         List<Instruction> instructions = new ArrayList<Instruction>();
+        ib.setKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1657,6 +1748,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         ipnext.setIpv4Address(prefix);
         setNextHopActionBuilder.setAddress(ipnext.build());
         ab.setAction(new SetNextHopActionCaseBuilder().setSetNextHopAction(setNextHopActionBuilder.build()).build());
+        ab.setKey(new ActionKey(0));
         actionList.add(ab.build());
 
         // Create an Apply Action
@@ -1670,6 +1762,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         InstructionsBuilder isb = new InstructionsBuilder();
         List<Instruction> instructions = new ArrayList<Instruction>();
+        ib.setKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1686,6 +1779,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         ipdst.setIpv4Address(prefixdst);
         setNwDstActionBuilder.setAddress(ipdst.build());
         ab.setAction(new SetNwDstActionCaseBuilder().setSetNwDstAction(setNwDstActionBuilder.build()).build());
+        ab.setKey(new ActionKey(0));
         actionList.add(ab.build());
 
         // Create an Apply Action
@@ -1699,6 +1793,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         InstructionsBuilder isb = new InstructionsBuilder();
         List<Instruction> instructions = new ArrayList<Instruction>();
+        ib.setKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1715,6 +1810,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         ipsrc.setIpv4Address(prefixsrc);
         setNwsrcActionBuilder.setAddress(ipsrc.build());
         ab.setAction(new SetNwSrcActionCaseBuilder().setSetNwSrcAction(setNwsrcActionBuilder.build()).build());
+        ab.setKey(new ActionKey(0));
         actionList.add(ab.build());
 
         // Create an Apply Action
@@ -1728,6 +1824,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         InstructionsBuilder isb = new InstructionsBuilder();
         List<Instruction> instructions = new ArrayList<Instruction>();
+        ib.setKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1741,6 +1838,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         SetNwTosActionBuilder setNwTosActionBuilder = new SetNwTosActionBuilder();
         setNwTosActionBuilder.setTos(8);
         ab.setAction(new SetNwTosActionCaseBuilder().setSetNwTosAction(setNwTosActionBuilder.build()).build());
+        ab.setKey(new ActionKey(0));
         actionList.add(ab.build());
         // Create an Apply Action
         ApplyActionsBuilder aab = new ApplyActionsBuilder();
@@ -1753,6 +1851,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         InstructionsBuilder isb = new InstructionsBuilder();
         List<Instruction> instructions = new ArrayList<Instruction>();
+        ib.setKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1766,6 +1865,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         SetNwTtlActionBuilder setNwTtlActionBuilder = new SetNwTtlActionBuilder();
         setNwTtlActionBuilder.setNwTtl((short) 1);
         ab.setAction(new SetNwTtlActionCaseBuilder().setSetNwTtlAction(setNwTtlActionBuilder.build()).build());
+        ab.setKey(new ActionKey(0));
         actionList.add(ab.build());
 
         // Create an Apply Action
@@ -1779,6 +1879,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         InstructionsBuilder isb = new InstructionsBuilder();
         List<Instruction> instructions = new ArrayList<Instruction>();
+        ib.setKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1792,6 +1893,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         SetQueueActionBuilder setQueueActionBuilder = new SetQueueActionBuilder();
         setQueueActionBuilder.setQueueId(1L);
         ab.setAction(new SetQueueActionCaseBuilder().setSetQueueAction(setQueueActionBuilder.build()).build());
+        ab.setKey(new ActionKey(0));
         actionList.add(ab.build());
         // Create an Apply Action
         ApplyActionsBuilder aab = new ApplyActionsBuilder();
@@ -1804,6 +1906,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         InstructionsBuilder isb = new InstructionsBuilder();
         List<Instruction> instructions = new ArrayList<Instruction>();
+        ib.setKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1818,6 +1921,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         setTpDstActionBuilder.setPort(new PortNumber(109));
 
         ab.setAction(new SetTpDstActionCaseBuilder().setSetTpDstAction(setTpDstActionBuilder.build()).build());
+        ab.setKey(new ActionKey(0));
         actionList.add(ab.build());
         // Create an Apply Action
         ApplyActionsBuilder aab = new ApplyActionsBuilder();
@@ -1830,6 +1934,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         InstructionsBuilder isb = new InstructionsBuilder();
         List<Instruction> instructions = new ArrayList<Instruction>();
+        ib.setKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1843,6 +1948,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         SetTpSrcActionBuilder setTpSrcActionBuilder = new SetTpSrcActionBuilder();
         setTpSrcActionBuilder.setPort(new PortNumber(109));
         ab.setAction(new SetTpSrcActionCaseBuilder().setSetTpSrcAction(setTpSrcActionBuilder.build()).build());
+        ab.setKey(new ActionKey(0));
         actionList.add(ab.build());
 
         // Create an Apply Action
@@ -1856,6 +1962,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         InstructionsBuilder isb = new InstructionsBuilder();
         List<Instruction> instructions = new ArrayList<Instruction>();
+        ib.setKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1869,6 +1976,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         SetVlanCfiActionBuilder setVlanCfiActionBuilder = new SetVlanCfiActionBuilder();
         setVlanCfiActionBuilder.setVlanCfi(new VlanCfi(2));
         ab.setAction(new SetVlanCfiActionCaseBuilder().setSetVlanCfiAction(setVlanCfiActionBuilder.build()).build());
+        ab.setKey(new ActionKey(0));
         actionList.add(ab.build());
 
         // Create an Apply Action
@@ -1882,6 +1990,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         InstructionsBuilder isb = new InstructionsBuilder();
         List<Instruction> instructions = new ArrayList<Instruction>();
+        ib.setKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1894,6 +2003,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         SwPathActionBuilder swPathAction = new SwPathActionBuilder();
         ab.setAction(new SwPathActionCaseBuilder().setSwPathAction(swPathAction.build()).build());
+        ab.setKey(new ActionKey(0));
         actionList.add(ab.build());
 
         // Create an Apply Action
@@ -1907,6 +2017,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         InstructionsBuilder isb = new InstructionsBuilder();
         List<Instruction> instructions = new ArrayList<Instruction>();
+        ib.setKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1962,6 +2073,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         InstructionsBuilder isb = new InstructionsBuilder();
         List<Instruction> instructions = new ArrayList<Instruction>();
+        ib.setKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -2523,7 +2635,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
         // PBB
         ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder();
-        protomatch.setPbb(new PbbBuilder().setPbbIsid(4L).setPbbMask(new byte[] { 0, 1, 0, 0 }).build());
+        protomatch.setPbb(new PbbBuilder().setPbbIsid(4L).setPbbMask((new BigInteger(new byte[] { 0, 1, 0, 0 }).longValue())).build());
         setFieldBuilder.setProtocolMatchFields(protomatch.build());
         ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
         actionList.add(ab.build());
@@ -2553,6 +2665,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         tunnel.setTunnelId(BigInteger.valueOf(10668));
         setFieldBuilder.setTunnel(tunnel.build());
         ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
+        ab.setKey(new ActionKey(0));
         actionList.add(ab.build());
 
         ApplyActionsBuilder aab = new ApplyActionsBuilder();
@@ -2570,6 +2683,70 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         return isb;
     }
 
+    private static InstructionsBuilder createTunnelIpv4DstInstructions() {
+
+        List<Action> actionList = new ArrayList<Action>();
+        ActionBuilder ab = new ActionBuilder();
+        // Build the tunnel endpoint destination IPv4 address
+        SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
+        Ipv4Prefix dstIp = new Ipv4Prefix("172.16.100.100");
+        // Add the mew IPv4 object as the tunnel destination
+        TunnelIpv4MatchBuilder tunnelIpv4DstMatchBuilder = new TunnelIpv4MatchBuilder();
+        tunnelIpv4DstMatchBuilder.setTunnelIpv4Destination(dstIp);
+        setFieldBuilder.setLayer3Match(tunnelIpv4DstMatchBuilder.build());
+        // Add the IPv4 tunnel dst to the set_field value
+        ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
+        ab.setOrder(0);
+        ab.setKey(new ActionKey(0));
+        actionList.add(ab.build());
+        // Resulting action is a per/flow src TEP (set_field:172.16.100.100->tun_dst)
+        ApplyActionsBuilder aab = new ApplyActionsBuilder();
+        aab.setAction(actionList);
+        // Add the action to the ordered list of Instructions
+        InstructionBuilder ib = new InstructionBuilder();
+        ib.setOrder(0);
+        ib.setKey(new InstructionKey(0));
+        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
+        // Add the Instruction in a list of Instructions
+        InstructionsBuilder isb = new InstructionsBuilder();
+        List<Instruction> instructions = new ArrayList<Instruction>();
+        instructions.add(ib.build());
+        isb.setInstruction(instructions);
+        return isb;
+    }
+
+    private static InstructionsBuilder createTunnelIpv4SrcInstructions() {
+
+        List<Action> actionList = new ArrayList<Action>();
+        ActionBuilder ab = new ActionBuilder();
+        // Build the tunnel endpoint source IPv4 address
+        SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
+        Ipv4Prefix dstIp = new Ipv4Prefix("172.16.100.200");
+        // Add the new IPv4 object as the tunnel destination
+        TunnelIpv4MatchBuilder tunnelIpv4MatchBuilder = new TunnelIpv4MatchBuilder();
+        tunnelIpv4MatchBuilder.setTunnelIpv4Source(dstIp);
+        setFieldBuilder.setLayer3Match(tunnelIpv4MatchBuilder.build());
+        // Add the IPv4 tunnel src to the set_field value
+        ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
+        ab.setOrder(0);
+        ab.setKey(new ActionKey(0));
+        actionList.add(ab.build());
+        // Resulting action is a per/flow src TEP (set_field:172.16.100.100->tun_src)
+        ApplyActionsBuilder aab = new ApplyActionsBuilder();
+        aab.setAction(actionList);
+        // Add the action to the ordered list of Instructions
+        InstructionBuilder ib = new InstructionBuilder();
+        ib.setOrder(0);
+        ib.setKey(new InstructionKey(0));
+        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
+        // Put our Instruction in a list of Instructions
+        InstructionsBuilder isb = new InstructionsBuilder();
+        List<Instruction> instructions = new ArrayList<Instruction>();
+        instructions.add(ib.build());
+        isb.setInstruction(instructions);
+        return isb;
+    }
+
     private static MatchBuilder createLLDPMatch() {
         MatchBuilder match = new MatchBuilder();
         EthernetMatchBuilder eth = new EthernetMatchBuilder();
@@ -2731,14 +2908,14 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
                                                                                // match
         MacAddress macdest = new MacAddress("ff:ff:ff:ff:ff:ff");
         ethdest.setAddress(macdest);
-        ethdest.setMask(mask1);
+        ethdest.setMask(new MacAddress("ff:ff:ff:00:00:00"));
 
         ethmatch.setEthernetDestination(ethdest.build());
 
         EthernetSourceBuilder ethsrc = new EthernetSourceBuilder();
         MacAddress macsrc = new MacAddress("00:00:00:00:23:ae");
         ethsrc.setAddress(macsrc);
-        ethsrc.setMask(mask2);
+        ethsrc.setMask(new MacAddress("ff:ff:00:00:00:00"));
 
         ethmatch.setEthernetSource(ethsrc.build());
         match.setEthernetMatch(ethmatch.build());
@@ -2787,10 +2964,10 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         ArpMatchBuilder arpmatch = new ArpMatchBuilder(); // arp match
         ArpSourceHardwareAddressBuilder arpsrc = new ArpSourceHardwareAddressBuilder();
         arpsrc.setAddress(macsrc);
-        arpsrc.setMask(mask);
+        arpsrc.setMask(new MacAddress("ff:ff:ff:00:00:00"));
         ArpTargetHardwareAddressBuilder arpdst = new ArpTargetHardwareAddressBuilder();
         arpdst.setAddress(macdest);
-        arpdst.setMask(mask2);
+        arpdst.setMask(new MacAddress("ff:ff:00:00:00:00"));
         arpmatch.setArpOp(2);
         arpmatch.setArpSourceHardwareAddress(arpsrc.build());
         arpmatch.setArpTargetHardwareAddress(arpdst.build());
@@ -2869,7 +3046,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         Ipv6LabelBuilder ipv6label = new Ipv6LabelBuilder();
         Ipv6FlowLabel label = new Ipv6FlowLabel(10028L);
         ipv6label.setIpv6Flabel(label);
-        ipv6label.setFlabelMask(new byte[] { 0, 1, -1, -1 });
+        ipv6label.setFlabelMask(new Ipv6FlowLabel(1L));
 
         Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder(); // icmpv6
                                                                    // match
@@ -3046,7 +3223,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         byte[] metamask = new byte[] { (byte) -1, (byte) -1, (byte) -1, 0, 0, 0, (byte) 1, (byte) 1 };
         MetadataBuilder metadata = new MetadataBuilder(); // metadata match
         metadata.setMetadata(BigInteger.valueOf(500L));
-        metadata.setMetadataMask(metamask);
+        metadata.setMetadataMask(new BigInteger(metamask));
         match.setMetadata(metadata.build());
 
         return match;
@@ -3089,7 +3266,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder(); // mpls
         // match
-        protomatch.setPbb(new PbbBuilder().setPbbIsid(4L).setPbbMask(new byte[] { 0, 1, 0, 0 }).build());
+        protomatch.setPbb(new PbbBuilder().setPbbIsid(4L).setPbbMask(new BigInteger(new byte[] { 0, 1, 0, 0 }).longValue()).build());
         match.setProtocolMatchFields(protomatch.build());
 
         return match;
@@ -3103,13 +3280,51 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         MatchBuilder match = new MatchBuilder();
         TunnelBuilder tunnel = new TunnelBuilder(); // tunnel id match
         tunnel.setTunnelId(BigInteger.valueOf(10668));
-        byte[] mask = new byte[] { (byte) -1, (byte) -1, (byte) -1, 0, 0, 0, (byte) 1, (byte) 1 };
-        tunnel.setTunnelMask(mask);
+        byte[] mask = new byte[] {(byte) -1, (byte) -1, (byte) -1, 0, 0, 0, (byte) 1, (byte) 1 };
+        tunnel.setTunnelMask(new BigInteger(1, mask));
         match.setTunnel(tunnel.build());
 
         return match;
     }
 
+    /**
+     * Test match for TCP_Flags
+     * @return match containing Ethertype (0x0800), IP Protocol (TCP), TCP_Flag (SYN)
+     */
+    //FIXME: move to extensible support
+    private static MatchBuilder createTcpFlagMatch() {
+        MatchBuilder match = new MatchBuilder();
+
+        // Ethertype match
+        EthernetMatchBuilder ethernetType = new EthernetMatchBuilder();
+        EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
+        ethTypeBuilder.setType(new EtherType(0x0800L));
+        ethernetType.setEthernetType(ethTypeBuilder.build());
+        match.setEthernetMatch(ethernetType.build());
+
+        // TCP Protocol Match
+        IpMatchBuilder ipMatch = new IpMatchBuilder(); // ipv4 version
+        ipMatch.setIpProtocol((short) 6);
+        match.setIpMatch(ipMatch.build());
+
+        // TCP Port Match
+        PortNumber dstPort = new PortNumber(80);
+        TcpMatchBuilder tcpMatch = new TcpMatchBuilder();
+        tcpMatch.setTcpDestinationPort(dstPort);
+        match.setLayer4Match(tcpMatch.build());
+        /**
+        * Defined TCP Flag values in OVS v2.1+
+        * TCP_FIN 0x001 / TCP_SYN 0x002 / TCP_RST 0x004
+        * TCP_PSH 0x008 / TCP_ACK 0x010 / TCP_URG 0x020
+        * TCP_ECE 0x040 / TCP_CWR 0x080 / TCP_NS  0x100
+        */
+        TcpFlagMatchBuilder tcpFlagMatch = new TcpFlagMatchBuilder();
+        tcpFlagMatch.setTcpFlag(0x002);
+        match.setTcpFlagMatch(tcpFlagMatch.build());
+
+        return match;
+    }
+
     public void _removeMDFlow(CommandInterpreter ci) {
         DataModification<InstanceIdentifier<?>, DataObject> modification = dataBrokerService.beginTransaction();
         NodeBuilder tn = createTestNode(ci.nextArgument());
@@ -3123,9 +3338,6 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         InstanceIdentifier<Flow> path1 = InstanceIdentifier.builder(Nodes.class).child(Node.class, tn.getKey())
                 .augmentation(FlowCapableNode.class).child(Table.class, new TableKey(tf.getTableId()))
                 .child(Flow.class, tf.getKey()).build();
-        modification.removeOperationalData(nodeBuilderToInstanceId(tn));
-        modification.removeOperationalData(path1);
-        modification.removeConfigurationData(nodeBuilderToInstanceId(tn));
         modification.removeConfigurationData(path1);
         Future<RpcResult<TransactionStatus>> commitFuture = modification.commit();
         try {
@@ -3140,6 +3352,13 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         }
     }
 
+    /**
+     * @param ci arguments: switchId flowType tableNum
+     * 
+     * <pre>
+     * e.g.: addMDFlow openflow:1 f1 42
+     * </pre>
+     */
     public void _addMDFlow(CommandInterpreter ci) {
         NodeBuilder tn = createTestNode(ci.nextArgument());
         String flowtype = ci.nextArgument();
@@ -3157,8 +3376,6 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         InstanceIdentifier<Flow> path1 = InstanceIdentifier.builder(Nodes.class)
                 .child(Node.class, nodeBuilder.getKey()).augmentation(FlowCapableNode.class)
                 .child(Table.class, new TableKey(flow.getTableId())).child(Flow.class, flow.getKey()).build();
-        modification.putOperationalData(nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build());
-        modification.putOperationalData(path1, flow.build());
         modification.putConfigurationData(nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build());
         modification.putConfigurationData(path1, flow.build());
         Future<RpcResult<TransactionStatus>> commitFuture = modification.commit();
@@ -3185,7 +3402,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static NodeRef createNodeRef(String string) {
         NodeKey key = new NodeKey(new NodeId(string));
-        InstanceIdentifier<Node> path = InstanceIdentifier.builder().node(Nodes.class).node(Node.class, key)
+        InstanceIdentifier<Node> path = InstanceIdentifier.builder(Nodes.class).child(Node.class, key)
                 .toInstance();
 
         return new NodeRef(path);
@@ -3195,4 +3412,182 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
     public String getHelp() {
         return "No help";
     }
+    
+    /*
+     * usage testSwitchFlows <numberOfSwitches> <numberOfFlows> <warmup iterations> <Number Of Threads>
+     * ex: _perfFlowTest 10 5 1 2
+     */
+    public void _perfFlowTest(CommandInterpreter ci) {
+       
+        String numberOfSwtichesStr = ci.nextArgument();
+        String numberOfFlowsStr = ci.nextArgument();
+        String warmupIterationsStr = ci.nextArgument();
+        String threadCountStr = ci.nextArgument();
+        String warmUpStr = ci.nextArgument();
+        
+        Collection<String> testResults = null;
+        if(testResults == null){
+               testResults = new ArrayList<String>();
+        }
+         
+        int numberOfSwtiches = 0;
+        int numberOfFlows = 0;
+        int warmupIterations = 0;
+        boolean warmUpIterations = false;
+
+        int threadCount = 0;
+        if(numberOfSwtichesStr !=null && !numberOfSwtichesStr.trim().equals("")){
+               numberOfSwtiches = new Integer(numberOfSwtichesStr).intValue();
+        }else {
+               numberOfSwtiches = 2;
+        }
+        
+        if(numberOfFlowsStr !=null && !numberOfFlowsStr.trim().equals("")){
+               numberOfFlows = new Integer(numberOfFlowsStr).intValue();
+        }else {
+               numberOfFlows = 2;
+        }
+        
+        if(warmupIterationsStr !=null && !warmupIterationsStr.trim().equals("")){
+               warmupIterations = new Integer(warmupIterationsStr).intValue();
+        }else {
+               warmupIterations = 2;
+        }
+        
+        if(threadCountStr !=null && !threadCountStr.trim().equals("")){
+               threadCount = new Integer(threadCountStr).intValue();
+        }else {
+               threadCount = 2; 
+        }
+         if(warmUpStr !=null && !warmUpStr.trim().equals("") && warmUpStr.trim().equals("true")){
+             warmUpIterations = true;
+         }else {
+             warmUpIterations = false;
+         }    
+        ci.println("*     Test Configurations*");
+        ci.println("*     numberOfSwtiches:::"+numberOfSwtiches+"");
+        ci.println("*     numberOfFlows:::"+numberOfFlows+"");
+        ci.println("*     warmupIterations:::"+warmupIterations+"");
+        ci.println("*     Number of Threads :::"+threadCount+"");
+        ci.println("*     Warmup Required? :::"+warmUpIterations+"");
+        
+        String dataPath="openflow:1";
+        String flowType = "fTM";
+        NodeBuilder tn;
+        FlowBuilder tf;
+        String tableId = "0";
+        if(warmUpIterations){
+        ci.println("----Warmup Started-----");
+        for(int j =1; j<= warmupIterations; j++){
+               for(int i =1;i<=numberOfSwtiches;i++){
+                        dataPath = "openflow:"+i;
+                        tn = createTestNode(dataPath);
+                       for (int flow=1;flow<numberOfFlows;flow++){
+                                tf = createTestFlow_perfTest(tn, "f1", tableId, flow);
+                                writeFlow(ci, tf, tn);
+                       }
+               }
+         }
+
+       ci.println("----Warmup Done-----");
+        }
+       try{
+              ExecutorService executor = Executors.newFixedThreadPool(threadCount);
+              int flowID = 0;
+               int tableID = 0;
+              for ( int t=0;t< threadCount;t++){
+                  tableID = t+1;
+                  Runnable tRunnable = new TestFlowThread(numberOfSwtiches, numberOfFlows, ci, t, tableID);
+                  executor.execute(tRunnable);
+              }
+              executor.shutdown();
+              executor.awaitTermination(1, TimeUnit.SECONDS);
+       } catch(Exception e){
+         ci.println("Exception:"+e.getMessage());
+       }
+    }
+    
+    public class TestFlowThread implements Runnable {
+
+        int numberOfSwitches;
+        int numberOfFlows;
+        int testTime;
+        CommandInterpreter ci;
+        int testFlowsAdded;
+        int theadNumber;
+        Collection<String> testResults = null;
+        int tableID = 0;
+
+        TestFlowThread(int numberOfSwtiches, int numberOfFlows, CommandInterpreter ci, int t, int tableID) {
+            this.numberOfSwitches = numberOfSwtiches;
+            this.numberOfFlows = numberOfFlows;
+            this.ci = ci;
+            this.theadNumber = t;
+            this.tableID = tableID;
+        }
+
+        @Override
+        public void run() {
+            executeFlow();
+        }
+
+        public void executeFlow() {
+
+            String dataPath = "openflow:1";
+            NodeBuilder tn;
+            FlowBuilder tf;
+            //String tableId = "0";
+
+            ci.println("New Thread started with id:  ID_"
+                    + this.theadNumber);
+            int totalNumberOfFlows = 0;
+            long startTime = System.currentTimeMillis();
+
+            for (int i = 1; i <= this.numberOfSwitches; i++) {
+                dataPath = "openflow:" + i;
+                tn = createTestNode(dataPath);
+                for (int flow2 = 1; flow2 <= this.numberOfFlows; flow2++) {
+                    tf = createTestFlow_perfTest(tn, "f1", ""+this.tableID, flow2);
+                    writeFlow(this.ci, tf, tn);
+                    totalNumberOfFlows++;
+                }
+            }
+            long endTime = System.currentTimeMillis();
+            long timeInSeconds = Math.round((endTime - startTime) / 1000);
+            if (timeInSeconds > 0) {
+                ci.println("Total flows added in Thread:" + this.theadNumber + ": Flows/Sec::" + Math.round(totalNumberOfFlows / timeInSeconds));
+            } else {
+                ci.println("Total flows added in Thread:" + this.theadNumber + ": Flows/Sec::" + totalNumberOfFlows);
+            }
+        }
+
+    }
+    /*
+     * usage testAllFlows <dp>
+     * ex: _perfFlowTest 1
+     */
+    public void _testAllFlows(CommandInterpreter ci) {
+       String dataPathID = ci.nextArgument();
+       int numberOfFlows = 82;
+        int threadCount = 0;
+        if(dataPathID ==null || dataPathID.trim().equals("")){
+               dataPathID = "1";
+        }
+        ci.println("*     Test All Flows       *");
+        ci.println("*     dataPathID:::"+dataPathID+"");
+        String dataPath="openflow:"+dataPathID;
+        String tableId = "0";
+        NodeBuilder tn = createTestNode(dataPath);
+        FlowBuilder tf;
+               for (int flow=1;flow<numberOfFlows;flow++){
+                       String flowID = "f"+flow;
+                       try{
+                               tf = createTestFlow(tn, flowID, tableId);
+                               writeFlow(ci, tf, tn);
+                       } catch(Exception e){
+                               ci.println("--Test Failed--Issue found while adding flow"+ flow);
+                               break;
+                       }
+               }
+    }
 }