OPNFLWPLUG-1032: Neon-MRI: Bump odlparent, yangtools, mdsal
[openflowplugin.git] / test-provider / src / main / java / org / opendaylight / openflowplugin / test / OpenflowpluginTestCommandProvider.java
index 8f6161cf2d95ecaf9cd211915b5fde1455923ad9..f8a7081648199553b9f0511d9502c762f94e0a54 100644 (file)
@@ -8,13 +8,12 @@
 
 package org.opendaylight.openflowplugin.test;
 
-import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
 import java.math.BigInteger;
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.List;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
@@ -24,12 +23,9 @@ import org.eclipse.osgi.framework.console.CommandProvider;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
 import org.opendaylight.controller.sal.binding.api.NotificationService;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Dscp;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6FlowLabel;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
@@ -140,7 +136,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instru
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder;
@@ -186,9 +181,8 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static final Logger LOG = LoggerFactory.getLogger(OpenflowpluginTestCommandProvider.class);
 
-    private DataBroker dataBroker;
+    private final DataBroker dataBroker;
     private final BundleContext ctx;
-    private FlowBuilder testFlow;
     private static final String ORIGINAL_FLOW_NAME = "Foo";
     private static final String UPDATED_FLOW_NAME = "Bar";
     private static final String IPV4_PREFIX = "10.0.0.1/24";
@@ -196,18 +190,19 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
     private static final String SRC_MAC_ADDRESS = "00:00:00:00:23:ae";
     private final SalFlowListener flowEventListener = new FlowEventListenerLoggingImpl();
     private final NodeErrorListener nodeErrorListener = new NodeErrorListenerLoggingImpl();
-    private static NotificationService notificationService;
+    private final NotificationService notificationService;
 
-    public OpenflowpluginTestCommandProvider(final BundleContext ctx) {
+    public OpenflowpluginTestCommandProvider(final DataBroker dataBroker, final NotificationService notificationService,
+            final BundleContext ctx) {
+        this.dataBroker = dataBroker;
+        this.notificationService = notificationService;
         this.ctx = ctx;
     }
 
-    public void onSessionInitiated(final ProviderContext session) {
-        notificationService = session.getSALService(NotificationService.class);
+    public void init() {
         // For switch events
         notificationService.registerNotificationListener(flowEventListener);
         notificationService.registerNotificationListener(nodeErrorListener);
-        dataBroker = session.getSALService(DataBroker.class);
         ctx.registerService(CommandProvider.class.getName(), this, null);
         createTestFlow(createTestNode(null), null, null);
     }
@@ -223,12 +218,12 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         final NodeBuilder builder = new NodeBuilder();
         builder.setId(new NodeId(localNodeId));
-        builder.setKey(new NodeKey(builder.getId()));
+        builder.withKey(new NodeKey(builder.getId()));
         return builder;
     }
 
     private InstanceIdentifier<Node> nodeBuilderToInstanceId(final NodeBuilder node) {
-        return InstanceIdentifier.create(Nodes.class).child(Node.class, node.getKey());
+        return InstanceIdentifier.create(Nodes.class).child(Node.class, node.key());
     }
 
     private FlowBuilder createTestFlow(final NodeBuilder nodeBuilder, final String flowTypeArg, final String tableId) {
@@ -705,9 +700,8 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         flow.setId(new FlowId("12"));
         flow.setTableId(getTableId(tableId));
 
-        flow.setKey(key);
+        flow.withKey(key);
         flow.setFlowName(ORIGINAL_FLOW_NAME + "X" + flowType);
-        testFlow = flow;
         return flow;
     }
 
@@ -749,9 +743,8 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         flow.setId(new FlowId("12"));
         flow.setTableId(getTableId(tableId));
 
-        flow.setKey(key);
+        flow.withKey(key);
         flow.setFlowName(ORIGINAL_FLOW_NAME + "X" + flowType);
-        testFlow = flow;
         return flow;
     }
 
@@ -764,14 +757,18 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         flow.setPriority(0);
         flow.setTableId((short) 0);
         final FlowKey key = new FlowKey(new FlowId(Long.toString(id)));
-        flow.setKey(key);
-        testFlow = flow;
+        flow.withKey(key);
         return flow;
     }
 
     private short getTableId(final String tableId) {
         final short TABLE_ID = 2;
         short table = TABLE_ID;
+
+        if (tableId == null) {
+            return table;
+        }
+
         try {
             table = Short.parseShort(tableId);
         } catch (NumberFormatException ex) {
@@ -786,7 +783,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         final DecNwTtl decNwTtl = ta.build();
         final ActionBuilder ab = new ActionBuilder();
         ab.setAction(new DecNwTtlCaseBuilder().setDecNwTtl(decNwTtl).build());
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         // Add our drop action to a list
         final List<Action> actionList = new ArrayList<>();
         actionList.add(ab.build());
@@ -798,14 +795,14 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Wrap our Apply Action in an Instruction
         final InstructionBuilder ib = new InstructionBuilder();
         ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         ib.setOrder(0);
 
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
         final List<Instruction> instructions = new ArrayList<>();
         instructions.add(ib.build());
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         isb.setInstruction(instructions);
         return isb;
     }
@@ -821,7 +818,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
         final List<Instruction> instructions = new ArrayList<>();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -839,7 +836,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
         final List<Instruction> instructions = new ArrayList<>();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -856,7 +853,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
         final List<Instruction> instructions = new ArrayList<>();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -867,11 +864,11 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         final DropAction dropAction = dab.build();
         final ActionBuilder ab = new ActionBuilder();
         ab.setAction(new DropActionCaseBuilder().setDropAction(dropAction).build());
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         // Add our drop action to a list
         final List<Action> actionList = new ArrayList<>();
         actionList.add(ab.build());
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         // Create an Apply Action
         final ApplyActionsBuilder aab = new ApplyActionsBuilder();
         aab.setAction(actionList);
@@ -883,7 +880,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
         final List<Instruction> instructions = new ArrayList<>();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -896,7 +893,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         final ControllerActionBuilder controller = new ControllerActionBuilder();
         controller.setMaxLength(5);
         ab.setAction(new ControllerActionCaseBuilder().setControllerAction(controller.build()).build());
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
         // Create an Apply Action
         final ApplyActionsBuilder aab = new ApplyActionsBuilder();
@@ -909,7 +906,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
         final List<Instruction> instructions = new ArrayList<>();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -925,7 +922,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         final Uri value = new Uri("PCEP");
         output.setOutputNodeConnector(value);
         ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
         // Create an Apply Action
         final ApplyActionsBuilder aab = new ApplyActionsBuilder();
@@ -938,7 +935,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
         final List<Instruction> instructions = new ArrayList<>();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -957,7 +954,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         output.setOutputNodeConnector(value);
         ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
         ab.setOrder(0);
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
         // Create an Apply Action
         final ApplyActionsBuilder aab = new ApplyActionsBuilder();
@@ -967,7 +964,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         final InstructionBuilder ib = new InstructionBuilder();
         ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
         ib.setOrder(0);
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
 
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
@@ -987,7 +984,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         output.setOutputNodeConnector(value);
         ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
         ab.setOrder(0);
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
         // Create an Apply Action
         final ApplyActionsBuilder aab = new ApplyActionsBuilder();
@@ -997,7 +994,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         final InstructionBuilder ib = new InstructionBuilder();
         ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
         ib.setOrder(0);
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
 
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
@@ -1017,7 +1014,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         output.setOutputNodeConnector(value);
         ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
         ab.setOrder(0);
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
         // Create an Apply Action
         final ApplyActionsBuilder aab = new ApplyActionsBuilder();
@@ -1027,7 +1024,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         final InstructionBuilder ib = new InstructionBuilder();
         ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
         ib.setOrder(0);
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
 
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
@@ -1045,7 +1042,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         final StripVlanActionBuilder stripActionBuilder = new StripVlanActionBuilder();
         ab.setAction(new StripVlanActionCaseBuilder().setStripVlanAction(stripActionBuilder.build()).build());
         ab.setOrder(0);
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
         // Create an Apply Action
         final ApplyActionsBuilder aab = new ApplyActionsBuilder();
@@ -1055,7 +1052,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         final InstructionBuilder ib = new InstructionBuilder();
         ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
         ib.setOrder(0);
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
 
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
@@ -1073,7 +1070,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         final PushMplsActionBuilder push = new PushMplsActionBuilder();
         push.setEthernetType(Integer.valueOf(0x8847));
         ab.setAction(new PushMplsActionCaseBuilder().setPushMplsAction(push.build()).build());
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
         // Create an Apply Action
         final ApplyActionsBuilder aab = new ApplyActionsBuilder();
@@ -1086,7 +1083,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
         final List<Instruction> instructions = new ArrayList<>();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1100,7 +1097,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         final PushPbbActionBuilder pbb = new PushPbbActionBuilder();
         pbb.setEthernetType(Integer.valueOf(0x88E7));
         ab.setAction(new PushPbbActionCaseBuilder().setPushPbbAction(pbb.build()).build());
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
         // Create an Apply Action
         final ApplyActionsBuilder aab = new ApplyActionsBuilder();
@@ -1113,7 +1110,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
         final List<Instruction> instructions = new ArrayList<>();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1127,7 +1124,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         final PushVlanActionBuilder vlan = new PushVlanActionBuilder();
         vlan.setEthernetType(Integer.valueOf(0x8100));
         ab.setAction(new PushVlanActionCaseBuilder().setPushVlanAction(vlan.build()).build());
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
 
         // Create an Apply Action
@@ -1141,7 +1138,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
         final List<Instruction> instructions = new ArrayList<>();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1155,7 +1152,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         final 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));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
         // Create an Apply Action
         final ApplyActionsBuilder aab = new ApplyActionsBuilder();
@@ -1168,7 +1165,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
         final List<Instruction> instructions = new ArrayList<>();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1182,7 +1179,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         final 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));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
 
         // Create an Apply Action
@@ -1196,7 +1193,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
         final List<Instruction> instructions = new ArrayList<>();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1211,7 +1208,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         final VlanId a = new VlanId(4000);
         vl.setVlanId(a);
         ab.setAction(new SetVlanIdActionCaseBuilder().setSetVlanIdAction(vl.build()).build());
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
         // Create an Apply Action
         final ApplyActionsBuilder aab = new ApplyActionsBuilder();
@@ -1224,7 +1221,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
         final List<Instruction> instructions = new ArrayList<>();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1239,7 +1236,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         final VlanPcp pcp1 = new VlanPcp((short) 2);
         pcp.setVlanPcp(pcp1);
         ab.setAction(new SetVlanPcpActionCaseBuilder().setSetVlanPcpAction(pcp.build()).build());
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
         // Create an Apply Action
         final ApplyActionsBuilder aab = new ApplyActionsBuilder();
@@ -1252,7 +1249,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
         final List<Instruction> instructions = new ArrayList<>();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1268,7 +1265,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         final VlanPcp pcp1 = new VlanPcp((short) 4);
         pcp.setVlanPcp(pcp1);
         ab.setAction(new SetVlanPcpActionCaseBuilder().setSetVlanPcpAction(pcp.build()).build());
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
         // Create an Apply Action
         final ApplyActionsBuilder aab = new ApplyActionsBuilder();
@@ -1281,7 +1278,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
         final List<Instruction> instructions = new ArrayList<>();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1294,7 +1291,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         final CopyTtlInBuilder ttlin = new CopyTtlInBuilder();
         ab.setAction(new CopyTtlInCaseBuilder().setCopyTtlIn(ttlin.build()).build());
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
         // Create an Apply Action
         final ApplyActionsBuilder aab = new ApplyActionsBuilder();
@@ -1307,7 +1304,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
         final List<Instruction> instructions = new ArrayList<>();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1320,7 +1317,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         final CopyTtlOutBuilder ttlout = new CopyTtlOutBuilder();
         ab.setAction(new CopyTtlOutCaseBuilder().setCopyTtlOut(ttlout.build()).build());
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
         // Create an Apply Action
         final ApplyActionsBuilder aab = new ApplyActionsBuilder();
@@ -1333,7 +1330,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
         final List<Instruction> instructions = new ArrayList<>();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1346,7 +1343,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         final DecMplsTtlBuilder mpls = new DecMplsTtlBuilder();
         ab.setAction(new DecMplsTtlCaseBuilder().setDecMplsTtl(mpls.build()).build());
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
         // Create an Apply Action
         final ApplyActionsBuilder aab = new ApplyActionsBuilder();
@@ -1355,7 +1352,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Wrap our Apply Action in an Instruction
         final InstructionBuilder ib = new InstructionBuilder();
         ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         ib.setOrder(0);
 
         // Put our Instruction in a list of Instruction
@@ -1373,7 +1370,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         final DecNwTtlBuilder nwttl = new DecNwTtlBuilder();
         ab.setAction(new DecNwTtlCaseBuilder().setDecNwTtl(nwttl.build()).build());
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
 
         // Create an Apply Action
@@ -1387,7 +1384,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
         final List<Instruction> instructions = new ArrayList<>();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1400,7 +1397,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         final DropActionBuilder drop = new DropActionBuilder();
         ab.setAction(new DropActionCaseBuilder().setDropAction(drop.build()).build());
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
 
         // Create an Apply Action
@@ -1414,7 +1411,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
         final List<Instruction> instructions = new ArrayList<>();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1427,7 +1424,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         final FloodActionBuilder fld = new FloodActionBuilder();
         ab.setAction(new FloodActionCaseBuilder().setFloodAction(fld.build()).build());
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
         // Create an Apply Action
         final ApplyActionsBuilder aab = new ApplyActionsBuilder();
@@ -1440,7 +1437,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
         final List<Instruction> instructions = new ArrayList<>();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1453,7 +1450,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         final FloodAllActionBuilder fldall = new FloodAllActionBuilder();
         ab.setAction(new FloodAllActionCaseBuilder().setFloodAllAction(fldall.build()).build());
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
         // Create an Apply Action
         final ApplyActionsBuilder aab = new ApplyActionsBuilder();
@@ -1466,7 +1463,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
         final List<Instruction> instructions = new ArrayList<>();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1481,7 +1478,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));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
 
         // Create an Apply Action
@@ -1495,7 +1492,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
         final List<Instruction> instructions = new ArrayList<>();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1508,7 +1505,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         final HwPathActionBuilder hwPathB = new HwPathActionBuilder();
         ab.setAction(new HwPathActionCaseBuilder().setHwPathAction(hwPathB.build()).build());
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
         // Create an Apply Action
         final ApplyActionsBuilder aab = new ApplyActionsBuilder();
@@ -1521,7 +1518,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
         final List<Instruction> instructions = new ArrayList<>();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1534,7 +1531,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         final LoopbackActionBuilder loopbackActionBuilder = new LoopbackActionBuilder();
         ab.setAction(new LoopbackActionCaseBuilder().setLoopbackAction(loopbackActionBuilder.build()).build());
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
 
         // Create an Apply Action
@@ -1548,7 +1545,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
         final List<Instruction> instructions = new ArrayList<>();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1562,7 +1559,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         final PopMplsActionBuilder popMplsActionBuilder = new PopMplsActionBuilder();
         popMplsActionBuilder.setEthernetType(0XB);
         ab.setAction(new PopMplsActionCaseBuilder().setPopMplsAction(popMplsActionBuilder.build()).build());
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
         // Create an Apply Action
         final ApplyActionsBuilder aab = new ApplyActionsBuilder();
@@ -1575,7 +1572,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
         final List<Instruction> instructions = new ArrayList<>();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1588,7 +1585,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         final PopPbbActionBuilder popPbbActionBuilder = new PopPbbActionBuilder();
         ab.setAction(new PopPbbActionCaseBuilder().setPopPbbAction(popPbbActionBuilder.build()).build());
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
         // Create an Apply Action
         final ApplyActionsBuilder aab = new ApplyActionsBuilder();
@@ -1601,7 +1598,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
         final List<Instruction> instructions = new ArrayList<>();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1614,7 +1611,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         final PopVlanActionBuilder popVlanActionBuilder = new PopVlanActionBuilder();
         ab.setAction(new PopVlanActionCaseBuilder().setPopVlanAction(popVlanActionBuilder.build()).build());
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
 
         // Create an Apply Action
@@ -1628,7 +1625,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
         final List<Instruction> instructions = new ArrayList<>();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1642,7 +1639,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         final SetDlTypeActionBuilder setDlTypeActionBuilder = new SetDlTypeActionBuilder();
         setDlTypeActionBuilder.setDlType(new EtherType(8L));
         ab.setAction(new SetDlTypeActionCaseBuilder().setSetDlTypeAction(setDlTypeActionBuilder.build()).build());
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
 
         // Create an Apply Action
@@ -1656,7 +1653,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
         final List<Instruction> instructions = new ArrayList<>();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1669,7 +1666,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         final SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
         setFieldBuilder.setInPort(new NodeConnectorId(nodeId + ":2"));
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
 
         // Create an Apply Action
@@ -1683,7 +1680,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
         final List<Instruction> instructions = new ArrayList<>();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1697,7 +1694,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         final SetMplsTtlActionBuilder setMplsTtlActionBuilder = new SetMplsTtlActionBuilder();
         setMplsTtlActionBuilder.setMplsTtl((short) 0X1);
         ab.setAction(new SetMplsTtlActionCaseBuilder().setSetMplsTtlAction(setMplsTtlActionBuilder.build()).build());
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
 
         // Create an Apply Action
@@ -1711,7 +1708,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
         final List<Instruction> instructions = new ArrayList<>();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1728,7 +1725,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));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
 
         // Create an Apply Action
@@ -1742,7 +1739,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
         final List<Instruction> instructions = new ArrayList<>();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1759,7 +1756,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));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
 
         // Create an Apply Action
@@ -1773,7 +1770,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
         final List<Instruction> instructions = new ArrayList<>();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1790,7 +1787,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));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
 
         // Create an Apply Action
@@ -1804,7 +1801,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
         final List<Instruction> instructions = new ArrayList<>();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1818,7 +1815,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         final SetNwTosActionBuilder setNwTosActionBuilder = new SetNwTosActionBuilder();
         setNwTosActionBuilder.setTos(8);
         ab.setAction(new SetNwTosActionCaseBuilder().setSetNwTosAction(setNwTosActionBuilder.build()).build());
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
         // Create an Apply Action
         final ApplyActionsBuilder aab = new ApplyActionsBuilder();
@@ -1831,7 +1828,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
         final List<Instruction> instructions = new ArrayList<>();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1845,7 +1842,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         final SetNwTtlActionBuilder setNwTtlActionBuilder = new SetNwTtlActionBuilder();
         setNwTtlActionBuilder.setNwTtl((short) 1);
         ab.setAction(new SetNwTtlActionCaseBuilder().setSetNwTtlAction(setNwTtlActionBuilder.build()).build());
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
 
         // Create an Apply Action
@@ -1859,7 +1856,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
         final List<Instruction> instructions = new ArrayList<>();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1873,7 +1870,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         final SetQueueActionBuilder setQueueActionBuilder = new SetQueueActionBuilder();
         setQueueActionBuilder.setQueueId(1L);
         ab.setAction(new SetQueueActionCaseBuilder().setSetQueueAction(setQueueActionBuilder.build()).build());
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
         // Create an Apply Action
         final ApplyActionsBuilder aab = new ApplyActionsBuilder();
@@ -1886,7 +1883,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
         final List<Instruction> instructions = new ArrayList<>();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1901,7 +1898,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         setTpDstActionBuilder.setPort(new PortNumber(109));
 
         ab.setAction(new SetTpDstActionCaseBuilder().setSetTpDstAction(setTpDstActionBuilder.build()).build());
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
         // Create an Apply Action
         final ApplyActionsBuilder aab = new ApplyActionsBuilder();
@@ -1914,7 +1911,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
         final List<Instruction> instructions = new ArrayList<>();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1928,7 +1925,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         final SetTpSrcActionBuilder setTpSrcActionBuilder = new SetTpSrcActionBuilder();
         setTpSrcActionBuilder.setPort(new PortNumber(109));
         ab.setAction(new SetTpSrcActionCaseBuilder().setSetTpSrcAction(setTpSrcActionBuilder.build()).build());
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
 
         // Create an Apply Action
@@ -1942,7 +1939,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
         final List<Instruction> instructions = new ArrayList<>();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1956,7 +1953,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         final SetVlanCfiActionBuilder setVlanCfiActionBuilder = new SetVlanCfiActionBuilder();
         setVlanCfiActionBuilder.setVlanCfi(new VlanCfi(2));
         ab.setAction(new SetVlanCfiActionCaseBuilder().setSetVlanCfiAction(setVlanCfiActionBuilder.build()).build());
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
 
         // Create an Apply Action
@@ -1970,7 +1967,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
         final List<Instruction> instructions = new ArrayList<>();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1983,7 +1980,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         final SwPathActionBuilder swPathAction = new SwPathActionBuilder();
         ab.setAction(new SwPathActionCaseBuilder().setSwPathAction(swPathAction.build()).build());
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
 
         // Create an Apply Action
@@ -1997,7 +1994,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
         final List<Instruction> instructions = new ArrayList<>();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -2032,28 +2029,28 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         setFieldBuilder1.setEthernetMatch(ethernetMatch1.build());
         setFieldBuilder2.setEthernetMatch(ethernetMatch2.build());
         ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
 
         ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
-        ab1.setKey(new ActionKey(1));
+        ab1.withKey(new ActionKey(1));
         actionList.add(ab1.build());
 
         ab2.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
-        ab2.setKey(new ActionKey(2));
+        ab2.withKey(new ActionKey(2));
         actionList.add(ab2.build());
 
         final ApplyActionsBuilder aab = new ApplyActionsBuilder();
         aab.setAction(actionList);
 
         final InstructionBuilder ib = new InstructionBuilder();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
 
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
         final List<Instruction> instructions = new ArrayList<>();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -2079,17 +2076,17 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         setFieldBuilder.setVlanMatch(vlanBuilder.build());
         setFieldBuilder1.setVlanMatch(vlanBuilder1.build());
         ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
         ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
-        ab1.setKey(new ActionKey(1));
+        ab1.withKey(new ActionKey(1));
         actionList.add(ab1.build());
 
         final ApplyActionsBuilder aab = new ApplyActionsBuilder();
         aab.setAction(actionList);
 
         final InstructionBuilder ib = new InstructionBuilder();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
 
         // Put our Instruction in a list of Instructions
@@ -2120,24 +2117,24 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         ipmatch2.setIpProtocol((short) 120);
         setFieldBuilder.setIpMatch(ipmatch.build());
         ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
 
         setFieldBuilder1.setIpMatch(ipmatch1.build());
         ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
-        ab1.setKey(new ActionKey(1));
+        ab1.withKey(new ActionKey(1));
         actionList.add(ab1.build());
 
         setFieldBuilder2.setIpMatch(ipmatch2.build());
         ab2.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
-        ab2.setKey(new ActionKey(2));
+        ab2.withKey(new ActionKey(2));
         actionList.add(ab2.build());
 
         final ApplyActionsBuilder aab = new ApplyActionsBuilder();
         aab.setAction(actionList);
 
         final InstructionBuilder ib = new InstructionBuilder();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
 
         // Put our Instruction in a list of Instructions
@@ -2165,19 +2162,19 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         ipv4Match.setIpv4Source(srcip);
         setFieldBuilder.setLayer3Match(ipv4Match.build());
         ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
 
         setFieldBuilder1.setLayer3Match(ipv4Match1.build());
         ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
-        ab1.setKey(new ActionKey(1));
+        ab1.withKey(new ActionKey(1));
         actionList.add(ab1.build());
 
         final ApplyActionsBuilder aab = new ApplyActionsBuilder();
         aab.setAction(actionList);
 
         final InstructionBuilder ib = new InstructionBuilder();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
 
         // Put our Instruction in a list of Instructions
@@ -2206,19 +2203,19 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         tcpmatch1.setTcpDestinationPort(tcpdstport);
         setFieldBuilder.setLayer4Match(tcpmatch.build());
         ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
 
         setFieldBuilder1.setLayer4Match(tcpmatch1.build());
         ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
-        ab1.setKey(new ActionKey(1));
+        ab1.withKey(new ActionKey(1));
         actionList.add(ab.build());
 
         final ApplyActionsBuilder aab = new ApplyActionsBuilder();
         aab.setAction(actionList);
 
         final InstructionBuilder ib = new InstructionBuilder();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
 
         // Put our Instruction in a list of Instructions
@@ -2247,19 +2244,19 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         udpmatch1.setUdpSourcePort(udpsrcport);
         setFieldBuilder.setLayer4Match(udpmatch.build());
         ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
 
         setFieldBuilder1.setLayer4Match(udpmatch1.build());
         ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
-        ab1.setKey(new ActionKey(1));
+        ab1.withKey(new ActionKey(1));
         actionList.add(ab1.build());
 
         final ApplyActionsBuilder aab = new ApplyActionsBuilder();
         aab.setAction(actionList);
 
         final InstructionBuilder ib = new InstructionBuilder();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
 
         // Put our Instruction in a list of Instructions
@@ -2288,19 +2285,19 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         sctpmatch1.setSctpDestinationPort(dstport);
         setFieldBuilder.setLayer4Match(sctpmatch.build());
         ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
 
         setFieldBuilder1.setLayer4Match(sctpmatch1.build());
         ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
-        ab1.setKey(new ActionKey(1));
+        ab1.withKey(new ActionKey(1));
         actionList.add(ab1.build());
 
         final ApplyActionsBuilder aab = new ApplyActionsBuilder();
         aab.setAction(actionList);
 
         final InstructionBuilder ib = new InstructionBuilder();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
 
         // Put our Instruction in a list of Instructions
@@ -2326,19 +2323,19 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         icmpv4match1.setIcmpv4Code((short) 0);
         setFieldBuilder.setIcmpv4Match(icmpv4match.build());
         ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
 
         setFieldBuilder1.setIcmpv4Match(icmpv4match1.build());
         ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
-        ab1.setKey(new ActionKey(1));
+        ab1.withKey(new ActionKey(1));
         actionList.add(ab1.build());
 
         final ApplyActionsBuilder aab = new ApplyActionsBuilder();
         aab.setAction(actionList);
 
         final InstructionBuilder ib = new InstructionBuilder();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
 
         // Put our Instruction in a list of Instructions
@@ -2386,34 +2383,34 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         arpmatch4.setArpTargetTransportAddress(dstiparp);
         setFieldBuilder.setLayer3Match(arpmatch.build());
         ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
 
         setFieldBuilder1.setLayer3Match(arpmatch1.build());
         ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
-        ab1.setKey(new ActionKey(1));
+        ab1.withKey(new ActionKey(1));
         actionList.add(ab1.build());
 
         setFieldBuilder2.setLayer3Match(arpmatch2.build());
         ab2.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
-        ab2.setKey(new ActionKey(2));
+        ab2.withKey(new ActionKey(2));
         actionList.add(ab2.build());
 
         setFieldBuilder3.setLayer3Match(arpmatch3.build());
         ab3.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder3.build()).build());
-        ab3.setKey(new ActionKey(3));
+        ab3.withKey(new ActionKey(3));
         actionList.add(ab3.build());
 
         setFieldBuilder4.setLayer3Match(arpmatch4.build());
         ab4.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder4.build()).build());
-        ab4.setKey(new ActionKey(4));
+        ab4.withKey(new ActionKey(4));
         actionList.add(ab4.build());
 
         final ApplyActionsBuilder aab = new ApplyActionsBuilder();
         aab.setAction(actionList);
 
         final InstructionBuilder ib = new InstructionBuilder();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
 
         // Put our Instruction in a list of Instructions
@@ -2457,29 +2454,29 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         setFieldBuilder.setLayer3Match(ipv6Builder.build());
         ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         actionLists.add(ab.build());
 
         setFieldBuilder1.setLayer3Match(ipv6Builder1.build());
         ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
-        ab1.setKey(new ActionKey(1));
+        ab1.withKey(new ActionKey(1));
         actionLists.add(ab1.build());
 
         setFieldBuilder5.setLayer3Match(ipv6Builder5.build());
         ab5.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder5.build()).build());
-        ab5.setKey(new ActionKey(5));
+        ab5.withKey(new ActionKey(5));
         actionLists.add(ab5.build());
 
         setFieldBuilder6.setLayer3Match(ipv6Builder6.build());
         ab6.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder6.build()).build());
-        ab6.setKey(new ActionKey(6));
+        ab6.withKey(new ActionKey(6));
         actionLists.add(ab6.build());
 
         final ApplyActionsBuilder aab = new ApplyActionsBuilder();
         aab.setAction(actionLists);
 
         final InstructionBuilder ib = new InstructionBuilder();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
 
         // Put our Instruction in a list of Instructions
@@ -2505,19 +2502,19 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         icmpv6match1.setIcmpv6Code((short) 0);
         setFieldBuilder.setIcmpv6Match(icmpv6match.build());
         ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
 
         setFieldBuilder1.setIcmpv6Match(icmpv6match1.build());
         ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
-        ab1.setKey(new ActionKey(1));
+        ab1.withKey(new ActionKey(1));
         actionList.add(ab1.build());
 
         final ApplyActionsBuilder aab = new ApplyActionsBuilder();
         aab.setAction(actionList);
 
         final InstructionBuilder ib = new InstructionBuilder();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
 
         // Put our Instruction in a list of Instructions
@@ -2547,24 +2544,24 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         protomatch2.setMplsBos((short) 1);
         setFieldBuilder.setProtocolMatchFields(protomatch.build());
         ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
-        ab.setKey(new ActionKey(0));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
 
         setFieldBuilder1.setProtocolMatchFields(protomatch1.build());
         ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
-        ab1.setKey(new ActionKey(1));
+        ab1.withKey(new ActionKey(1));
         actionList.add(ab1.build());
 
         setFieldBuilder2.setProtocolMatchFields(protomatch2.build());
         ab2.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
-        ab2.setKey(new ActionKey(2));
+        ab2.withKey(new ActionKey(2));
         actionList.add(ab2.build());
 
         final ApplyActionsBuilder aab = new ApplyActionsBuilder();
         aab.setAction(actionList);
 
         final InstructionBuilder ib = new InstructionBuilder();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
 
         // Put our Instruction in a list of Instructions
@@ -2592,7 +2589,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         aab.setAction(actionList);
 
         final InstructionBuilder ib = new InstructionBuilder();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
 
         // Put our Instruction in a list of Instructions
@@ -2613,14 +2610,14 @@ 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));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
 
         final ApplyActionsBuilder aab = new ApplyActionsBuilder();
         aab.setAction(actionList);
 
         final InstructionBuilder ib = new InstructionBuilder();
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
 
         // Put our Instruction in a list of Instructions
@@ -2645,7 +2642,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // 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));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
         // Resulting action is a per/flow src TEP (set_field:172.16.100.100->tun_dst)
         final ApplyActionsBuilder aab = new ApplyActionsBuilder();
@@ -2653,7 +2650,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Add the action to the ordered list of Instructions
         final InstructionBuilder ib = new InstructionBuilder();
         ib.setOrder(0);
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
         // Add the Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
@@ -2677,7 +2674,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // 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));
+        ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
         // Resulting action is a per/flow src TEP (set_field:172.16.100.100->tun_src)
         final ApplyActionsBuilder aab = new ApplyActionsBuilder();
@@ -2685,7 +2682,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // Add the action to the ordered list of Instructions
         final InstructionBuilder ib = new InstructionBuilder();
         ib.setOrder(0);
-        ib.setKey(new InstructionKey(0));
+        ib.withKey(new InstructionKey(0));
         ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
@@ -2875,28 +2872,6 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         return match;
     }
 
-    private static MatchBuilder createL3IPv4Match() {
-        final MatchBuilder match = new MatchBuilder();
-
-        final EthernetMatchBuilder eth = new EthernetMatchBuilder();
-        final EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
-        ethTypeBuilder.setType(new EtherType(0x0800L));
-        eth.setEthernetType(ethTypeBuilder.build());
-        match.setEthernetMatch(eth.build());
-
-        final Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
-        // ipv4 match
-        final Ipv4Prefix dstip = new Ipv4Prefix("200.71.9.52/10");
-        final Ipv4Prefix srcip = new Ipv4Prefix("100.1.1.1/8");
-        final Ipv4MatchBuilder ipv4match = new Ipv4MatchBuilder();
-        ipv4match.setIpv4Destination(dstip);
-        ipv4match.setIpv4Source(srcip);
-        match.setLayer3Match(ipv4match.build());
-
-        return match;
-
-    }
-
     private static MatchBuilder createL3IPv6Match() {
         final MatchBuilder match = new MatchBuilder();
 
@@ -2906,9 +2881,6 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         eth.setEthernetType(ethTypeBuilder.build());
         match.setEthernetMatch(eth.build());
 
-        final Ipv6Prefix dstip6 = new Ipv6Prefix("2002::2/64");
-        final Ipv6Prefix srcip6 = new Ipv6Prefix("2001:0:0:0:0:0:0:1/56");
-        final Ipv6Address ndtarget = new Ipv6Address("2001:db8:0:1:fd97:f9f0:a810:782e");
         final MacAddress ndsll = new MacAddress("c2:00:54:f5:00:00");
         final MacAddress ndtll = new MacAddress("00:0c:29:0e:4c:67");
         final Ipv6ExtHeaderBuilder nextheader = new Ipv6ExtHeaderBuilder();
@@ -3175,11 +3147,11 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         } else {
             tf = createTestFlow(tn, flowtype, ci.nextArgument());
         }
-        final InstanceIdentifier<Flow> path1 = InstanceIdentifier.create(Nodes.class).child(Node.class, tn.getKey())
+        final InstanceIdentifier<Flow> path1 = InstanceIdentifier.create(Nodes.class).child(Node.class, tn.key())
                 .augmentation(FlowCapableNode.class).child(Table.class, new TableKey(tf.getTableId()))
-                .child(Flow.class, tf.getKey());
+                .child(Flow.class, tf.key());
         modification.delete(LogicalDatastoreType.CONFIGURATION, path1);
-        final CheckedFuture<Void, TransactionCommitFailedException> commitFuture = modification.submit();
+        final ListenableFuture<Void> commitFuture = modification.submit();
         Futures.addCallback(commitFuture, new FutureCallback<Void>() {
             @Override
             public void onSuccess(final Void notUsed) {
@@ -3188,7 +3160,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
             @Override
             public void onFailure(final Throwable throwable) {
-                LOG.error(throwable.getMessage(), throwable);
+                LOG.error("Status of Group Data Loaded Transaction : failure. Reason : {}", throwable);
                 ci.println(String.format("Status of Group Data Loaded Transaction : failure. Reason : %s", throwable));
             }
         }, MoreExecutors.directExecutor());
@@ -3214,12 +3186,12 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
     private void writeFlow(final CommandInterpreter ci, final FlowBuilder flow, final NodeBuilder nodeBuilder) {
         final ReadWriteTransaction modification = dataBroker.newReadWriteTransaction();
         final InstanceIdentifier<Flow> path1 = InstanceIdentifier.create(Nodes.class)
-                .child(Node.class, nodeBuilder.getKey()).augmentation(FlowCapableNode.class)
-                .child(Table.class, new TableKey(flow.getTableId())).child(Flow.class, flow.getKey());
+                .child(Node.class, nodeBuilder.key()).augmentation(FlowCapableNode.class)
+                .child(Table.class, new TableKey(flow.getTableId())).child(Flow.class, flow.key());
         modification.merge(LogicalDatastoreType.CONFIGURATION,
                 nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build(), true);
         modification.merge(LogicalDatastoreType.CONFIGURATION, path1, flow.build(), true);
-        final CheckedFuture<Void, TransactionCommitFailedException> commitFuture = modification.submit();
+        final ListenableFuture<Void> commitFuture = modification.submit();
         Futures.addCallback(commitFuture, new FutureCallback<Void>() {
             @Override
             public void onSuccess(final Void notUsed) {
@@ -3228,7 +3200,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
             @Override
             public void onFailure(final Throwable throwable) {
-                LOG.error(throwable.getMessage(), throwable);
+                LOG.error("Status of Group Data Loaded Transaction : failure. Reason : {}", throwable);
                 ci.println(String.format("Status of Group Data Loaded Transaction : failure. Reason : %s", throwable));
             }
         }, MoreExecutors.directExecutor());
@@ -3243,13 +3215,6 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         writeFlow(ci, tf, tn);
     }
 
-    private static NodeRef createNodeRef(final String string) {
-        final NodeKey key = new NodeKey(new NodeId(string));
-        final InstanceIdentifier<Node> path = InstanceIdentifier.create(Nodes.class).child(Node.class, key);
-
-        return new NodeRef(path);
-    }
-
     @Override
     public String getHelp() {
         return "No help";
@@ -3267,11 +3232,6 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         final String threadCountStr = ci.nextArgument();
         final String warmUpStr = ci.nextArgument();
 
-        Collection<String> testResults = null;
-        if (testResults == null) {
-            testResults = new ArrayList<>();
-        }
-
         int numberOfSwtiches = 0;
         int numberOfFlows = 0;
         int warmupIterations = 0;
@@ -3351,11 +3311,8 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         int numberOfSwitches;
         int numberOfFlows;
-        int testTime;
         CommandInterpreter ci;
-        int testFlowsAdded;
         int theadNumber;
-        Collection<String> testResults = null;
         int tableID = 0;
 
         TestFlowThread(final int numberOfSwtiches, final int numberOfFlows, final CommandInterpreter ci,
@@ -3394,10 +3351,10 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
                 }
             }
             final long endTime = System.currentTimeMillis();
-            final long timeInSeconds = Math.round((endTime - startTime) / 1000);
+            final long timeInSeconds = Math.round((endTime - startTime) / 1000.0F);
             if (timeInSeconds > 0) {
                 ci.println("Total flows added in Thread:" + this.theadNumber + ": Flows/Sec::"
-                    + Math.round(totalNumberOfFlows / timeInSeconds));
+                    + Math.round((float)totalNumberOfFlows / timeInSeconds));
             } else {
                 ci.println("Total flows added in Thread:" + this.theadNumber + ": Flows/Sec::" + totalNumberOfFlows);
             }