OPNFLWPLUG-1032: Neon-MRI: Bump odlparent, yangtools, mdsal
[openflowplugin.git] / test-provider / src / main / java / org / opendaylight / openflowplugin / test / OpenflowpluginTestCommandProvider.java
index 29fd07aa95837d5b00a30cadfe3256ec89ec1d9c..f8a7081648199553b9f0511d9502c762f94e0a54 100644 (file)
@@ -8,12 +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;
@@ -23,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;
@@ -139,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;
@@ -180,13 +176,13 @@ import org.osgi.framework.BundleContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+@SuppressWarnings("checkstyle:MethodName")
 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";
@@ -194,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);
     }
@@ -221,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) {
@@ -703,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;
     }
 
@@ -747,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;
     }
 
@@ -762,34 +757,35 @@ 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 (final Exception ex) {
+        } catch (NumberFormatException ex) {
             LOG.info("Parsing String tableId {} failed. Continuing with default tableId {}.",
                     tableId, table);
         }
         return table;
     }
 
-    /**
-     * @return
-     */
     private static InstructionsBuilder createDecNwTtlInstructions() {
         final DecNwTtlBuilder ta = new DecNwTtlBuilder();
         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<Action>();
+        final List<Action> actionList = new ArrayList<>();
         actionList.add(ab.build());
 
         // Create an Apply Action
@@ -799,21 +795,18 @@ 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<Instruction>();
+        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;
     }
 
-    /**
-     * @return
-     */
     private static InstructionsBuilder createMeterInstructions() {
 
         final MeterBuilder aab = new MeterBuilder();
@@ -824,8 +817,8 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
-        ib.setKey(new InstructionKey(0));
+        final List<Instruction> instructions = new ArrayList<>();
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -842,8 +835,8 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
-        ib.setKey(new InstructionKey(0));
+        final List<Instruction> instructions = new ArrayList<>();
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -859,8 +852,8 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
-        ib.setKey(new InstructionKey(0));
+        final List<Instruction> instructions = new ArrayList<>();
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -871,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<Action>();
+        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);
@@ -886,8 +879,8 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
-        ib.setKey(new InstructionKey(0));
+        final List<Instruction> instructions = new ArrayList<>();
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -895,12 +888,12 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
         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();
@@ -912,8 +905,8 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
-        ib.setKey(new InstructionKey(0));
+        final List<Instruction> instructions = new ArrayList<>();
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -921,7 +914,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction1() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
 
         final OutputActionBuilder output = new OutputActionBuilder();
@@ -929,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();
@@ -941,8 +934,8 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
-        ib.setKey(new InstructionKey(0));
+        final List<Instruction> instructions = new ArrayList<>();
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -953,7 +946,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         // test case for Output Port works if the particular port exists
         // this particular test-case is for Port : 1
         // tested as (addMDFlow openflow:<dpid> f82)
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
         final OutputActionBuilder output = new OutputActionBuilder();
 
@@ -961,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();
@@ -971,27 +964,27 @@ 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();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
+        final List<Instruction> instructions = new ArrayList<>();
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
     }
 
-    private static InstructionsBuilder createSentToControllerInstructions() {
-        final List<Action> actionList = new ArrayList<Action>();
+    private static InstructionsBuilder createOutputInstructions(final String outputType, final int outputValue) {
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
 
         final OutputActionBuilder output = new OutputActionBuilder();
-        output.setMaxLength(Integer.valueOf(0xffff));
-        final Uri value = new Uri(OutputPortValues.CONTROLLER.toString());
+        output.setMaxLength(outputValue);
+        final Uri value = new Uri(outputType);
         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();
@@ -1001,27 +994,27 @@ 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();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
+        final List<Instruction> instructions = new ArrayList<>();
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
     }
 
-    private static InstructionsBuilder createOutputInstructions(final String outputType, final int outputValue) {
-        final List<Action> actionList = new ArrayList<Action>();
+    private static InstructionsBuilder createSentToControllerInstructions() {
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
 
         final OutputActionBuilder output = new OutputActionBuilder();
-        output.setMaxLength(outputValue);
-        final Uri value = new Uri(outputType);
+        output.setMaxLength(Integer.valueOf(0xffff));
+        final Uri value = new Uri(OutputPortValues.CONTROLLER.toString());
         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();
@@ -1031,24 +1024,25 @@ 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();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
+        final List<Instruction> instructions = new ArrayList<>();
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
     }
 
+
     private static InstructionsBuilder createStripVlanInstructions() {
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
 
         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();
@@ -1058,11 +1052,11 @@ 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();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
+        final List<Instruction> instructions = new ArrayList<>();
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1070,13 +1064,13 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction2() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
 
         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();
@@ -1088,8 +1082,8 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
-        ib.setKey(new InstructionKey(0));
+        final List<Instruction> instructions = new ArrayList<>();
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1097,13 +1091,13 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction3() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
 
         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();
@@ -1115,8 +1109,8 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
-        ib.setKey(new InstructionKey(0));
+        final List<Instruction> instructions = new ArrayList<>();
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1124,13 +1118,13 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction4() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
 
         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
@@ -1143,8 +1137,8 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
-        ib.setKey(new InstructionKey(0));
+        final List<Instruction> instructions = new ArrayList<>();
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1152,13 +1146,13 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction5() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
 
         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();
@@ -1170,8 +1164,8 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
-        ib.setKey(new InstructionKey(0));
+        final List<Instruction> instructions = new ArrayList<>();
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1179,13 +1173,13 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction6() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
 
         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
@@ -1198,8 +1192,8 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
-        ib.setKey(new InstructionKey(0));
+        final List<Instruction> instructions = new ArrayList<>();
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1207,14 +1201,14 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction7() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
 
         final SetVlanIdActionBuilder vl = new SetVlanIdActionBuilder();
         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();
@@ -1226,8 +1220,8 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
-        ib.setKey(new InstructionKey(0));
+        final List<Instruction> instructions = new ArrayList<>();
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1235,14 +1229,14 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction8() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
 
         final SetVlanPcpActionBuilder pcp = new SetVlanPcpActionBuilder();
         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();
@@ -1254,8 +1248,8 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
-        ib.setKey(new InstructionKey(0));
+        final List<Instruction> instructions = new ArrayList<>();
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1263,7 +1257,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction88() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
 
         final SetVlanPcpActionBuilder pcp = new SetVlanPcpActionBuilder();
@@ -1271,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();
@@ -1283,8 +1277,8 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
-        ib.setKey(new InstructionKey(0));
+        final List<Instruction> instructions = new ArrayList<>();
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1292,12 +1286,12 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction9() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
 
         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();
@@ -1309,8 +1303,8 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
-        ib.setKey(new InstructionKey(0));
+        final List<Instruction> instructions = new ArrayList<>();
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1318,12 +1312,12 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction10() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
 
         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();
@@ -1335,8 +1329,8 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
-        ib.setKey(new InstructionKey(0));
+        final List<Instruction> instructions = new ArrayList<>();
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1344,12 +1338,12 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction11() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
 
         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();
@@ -1358,12 +1352,12 @@ 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
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
+        final List<Instruction> instructions = new ArrayList<>();
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1371,12 +1365,12 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction12() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
 
         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
@@ -1389,8 +1383,8 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
-        ib.setKey(new InstructionKey(0));
+        final List<Instruction> instructions = new ArrayList<>();
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1398,12 +1392,12 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction13() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
 
         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
@@ -1416,8 +1410,8 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
-        ib.setKey(new InstructionKey(0));
+        final List<Instruction> instructions = new ArrayList<>();
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1425,12 +1419,12 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction14() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
 
         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();
@@ -1442,8 +1436,8 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
-        ib.setKey(new InstructionKey(0));
+        final List<Instruction> instructions = new ArrayList<>();
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1451,12 +1445,12 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction15() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
 
         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();
@@ -1468,8 +1462,8 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
-        ib.setKey(new InstructionKey(0));
+        final List<Instruction> instructions = new ArrayList<>();
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1477,14 +1471,14 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction16() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
 
         final GroupActionBuilder groupActionB = new GroupActionBuilder();
         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
@@ -1497,8 +1491,8 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
-        ib.setKey(new InstructionKey(0));
+        final List<Instruction> instructions = new ArrayList<>();
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1506,12 +1500,12 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction17() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
 
         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();
@@ -1523,8 +1517,8 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
-        ib.setKey(new InstructionKey(0));
+        final List<Instruction> instructions = new ArrayList<>();
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1532,12 +1526,12 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction18() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
 
         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
@@ -1550,8 +1544,8 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
-        ib.setKey(new InstructionKey(0));
+        final List<Instruction> instructions = new ArrayList<>();
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1559,13 +1553,13 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction19() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
 
         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();
@@ -1577,8 +1571,8 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
-        ib.setKey(new InstructionKey(0));
+        final List<Instruction> instructions = new ArrayList<>();
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1586,12 +1580,12 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction20() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
 
         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();
@@ -1603,8 +1597,8 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
-        ib.setKey(new InstructionKey(0));
+        final List<Instruction> instructions = new ArrayList<>();
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1612,12 +1606,12 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction21() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
 
         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
@@ -1630,8 +1624,8 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
-        ib.setKey(new InstructionKey(0));
+        final List<Instruction> instructions = new ArrayList<>();
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1639,13 +1633,13 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction22() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
 
         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
@@ -1658,8 +1652,8 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
-        ib.setKey(new InstructionKey(0));
+        final List<Instruction> instructions = new ArrayList<>();
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1667,12 +1661,12 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction23(final NodeId nodeId) {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
 
         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
@@ -1685,8 +1679,8 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
-        ib.setKey(new InstructionKey(0));
+        final List<Instruction> instructions = new ArrayList<>();
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1694,13 +1688,13 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction24() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
 
         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
@@ -1713,8 +1707,8 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
-        ib.setKey(new InstructionKey(0));
+        final List<Instruction> instructions = new ArrayList<>();
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1722,7 +1716,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction25() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
 
         final SetNextHopActionBuilder setNextHopActionBuilder = new SetNextHopActionBuilder();
@@ -1731,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
@@ -1744,8 +1738,8 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
-        ib.setKey(new InstructionKey(0));
+        final List<Instruction> instructions = new ArrayList<>();
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1753,7 +1747,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction26() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
 
         final SetNwDstActionBuilder setNwDstActionBuilder = new SetNwDstActionBuilder();
@@ -1762,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
@@ -1775,8 +1769,8 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
-        ib.setKey(new InstructionKey(0));
+        final List<Instruction> instructions = new ArrayList<>();
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1784,7 +1778,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction27() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
 
         final SetNwSrcActionBuilder setNwsrcActionBuilder = new SetNwSrcActionBuilder();
@@ -1793,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
@@ -1806,8 +1800,8 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
-        ib.setKey(new InstructionKey(0));
+        final List<Instruction> instructions = new ArrayList<>();
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1815,13 +1809,13 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction28() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
 
         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();
@@ -1833,8 +1827,8 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
-        ib.setKey(new InstructionKey(0));
+        final List<Instruction> instructions = new ArrayList<>();
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1842,13 +1836,13 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction29() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
 
         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
@@ -1861,8 +1855,8 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
-        ib.setKey(new InstructionKey(0));
+        final List<Instruction> instructions = new ArrayList<>();
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1870,13 +1864,13 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction30() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
 
         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();
@@ -1888,8 +1882,8 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
-        ib.setKey(new InstructionKey(0));
+        final List<Instruction> instructions = new ArrayList<>();
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1897,14 +1891,14 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction31() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
 
         final SetTpDstActionBuilder setTpDstActionBuilder = new SetTpDstActionBuilder();
         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();
@@ -1916,8 +1910,8 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
-        ib.setKey(new InstructionKey(0));
+        final List<Instruction> instructions = new ArrayList<>();
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1925,13 +1919,13 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction32() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
 
         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
@@ -1944,8 +1938,8 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
-        ib.setKey(new InstructionKey(0));
+        final List<Instruction> instructions = new ArrayList<>();
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1953,13 +1947,13 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction33() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
 
         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
@@ -1972,8 +1966,8 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
-        ib.setKey(new InstructionKey(0));
+        final List<Instruction> instructions = new ArrayList<>();
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -1981,12 +1975,12 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction34() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
 
         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
@@ -1999,8 +1993,8 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         // Put our Instruction in a list of Instructions
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
-        ib.setKey(new InstructionKey(0));
+        final List<Instruction> instructions = new ArrayList<>();
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -2008,7 +2002,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction35() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
         final ActionBuilder ab1 = new ActionBuilder();
         final ActionBuilder ab2 = new ActionBuilder();
@@ -2035,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<Instruction>();
-        ib.setKey(new InstructionKey(0));
+        final List<Instruction> instructions = new ArrayList<>();
+        ib.withKey(new InstructionKey(0));
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -2064,7 +2058,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction36() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
         final ActionBuilder ab1 = new ActionBuilder();
 
@@ -2082,22 +2076,22 @@ 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
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
+        final List<Instruction> instructions = new ArrayList<>();
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -2105,7 +2099,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction37() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
         final ActionBuilder ab1 = new ActionBuilder();
         final ActionBuilder ab2 = new ActionBuilder();
@@ -2123,29 +2117,29 @@ 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
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
+        final List<Instruction> instructions = new ArrayList<>();
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -2153,7 +2147,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction38() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
         final ActionBuilder ab1 = new ActionBuilder();
 
@@ -2168,24 +2162,24 @@ 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
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
+        final List<Instruction> instructions = new ArrayList<>();
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -2193,7 +2187,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction39() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
         final ActionBuilder ab1 = new ActionBuilder();
 
@@ -2209,24 +2203,24 @@ 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
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
+        final List<Instruction> instructions = new ArrayList<>();
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -2234,7 +2228,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction40() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
         final ActionBuilder ab1 = new ActionBuilder();
 
@@ -2250,24 +2244,24 @@ 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
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
+        final List<Instruction> instructions = new ArrayList<>();
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -2275,7 +2269,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction41() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
         final ActionBuilder ab1 = new ActionBuilder();
 
@@ -2291,24 +2285,24 @@ 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
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
+        final List<Instruction> instructions = new ArrayList<>();
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -2316,7 +2310,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction42() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
         final ActionBuilder ab1 = new ActionBuilder();
         final SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
@@ -2329,24 +2323,24 @@ 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
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
+        final List<Instruction> instructions = new ArrayList<>();
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -2354,7 +2348,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction43() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
         final ActionBuilder ab1 = new ActionBuilder();
         final ActionBuilder ab2 = new ActionBuilder();
@@ -2389,39 +2383,39 @@ 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
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
+        final List<Instruction> instructions = new ArrayList<>();
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -2429,7 +2423,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction44() {
 
-        final List<Action> actionLists = new ArrayList<Action>();
+        final List<Action> actionLists = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
         final SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
         final ActionBuilder ab1 = new ActionBuilder();
@@ -2460,34 +2454,34 @@ 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
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
+        final List<Instruction> instructions = new ArrayList<>();
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -2495,7 +2489,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction45() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
         final SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
         final ActionBuilder ab1 = new ActionBuilder();
@@ -2508,24 +2502,24 @@ 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
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
+        final List<Instruction> instructions = new ArrayList<>();
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -2533,7 +2527,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction46() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
         final SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
         final ActionBuilder ab1 = new ActionBuilder();
@@ -2550,29 +2544,29 @@ 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
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
+        final List<Instruction> instructions = new ArrayList<>();
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -2580,12 +2574,13 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction47() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
         final SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
         // PBB
         final ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder();
-        protomatch.setPbb(new PbbBuilder().setPbbIsid(4L).setPbbMask((new BigInteger(new byte[]{0, 1, 0, 0}).longValue())).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());
@@ -2594,12 +2589,12 @@ 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
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
+        final List<Instruction> instructions = new ArrayList<>();
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -2607,7 +2602,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createAppyActionInstruction48() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
         final SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
         // Tunnel
@@ -2615,19 +2610,19 @@ 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
         final InstructionsBuilder isb = new InstructionsBuilder();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
+        final List<Instruction> instructions = new ArrayList<>();
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -2635,7 +2630,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createTunnelIpv4DstInstructions() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
         // Build the tunnel endpoint destination IPv4 address
         final SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
@@ -2647,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();
@@ -2655,11 +2650,11 @@ 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();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
+        final List<Instruction> instructions = new ArrayList<>();
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -2667,7 +2662,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     private static InstructionsBuilder createTunnelIpv4SrcInstructions() {
 
-        final List<Action> actionList = new ArrayList<Action>();
+        final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
         // Build the tunnel endpoint source IPv4 address
         final SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
@@ -2679,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();
@@ -2687,11 +2682,11 @@ 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();
-        final List<Instruction> instructions = new ArrayList<Instruction>();
+        final List<Instruction> instructions = new ArrayList<>();
         instructions.add(ib.build());
         isb.setInstruction(instructions);
         return isb;
@@ -2707,13 +2702,10 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         return match;
     }
 
-    /**
-     * @return
-     */
     private static MatchBuilder createMatch1() {
         final MatchBuilder match = new MatchBuilder();
         final Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
-        final Ipv4Prefix prefix = new Ipv4Prefix(IPV4_PREFIX);;
+        final Ipv4Prefix prefix = new Ipv4Prefix(IPV4_PREFIX);
         ipv4Match.setIpv4Destination(prefix);
         final Ipv4Match i4m = ipv4Match.build();
         match.setLayer3Match(i4m);
@@ -2726,10 +2718,6 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         return match;
     }
 
-
-    /**
-     * @return
-     */
     private static MatchBuilder createMatch2() {
         final MatchBuilder match = new MatchBuilder();
         final Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
@@ -2746,9 +2734,6 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         return match;
     }
 
-    /**
-     * @return
-     */
     private static MatchBuilder createMatch3() {
         final MatchBuilder match = new MatchBuilder();
         final EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
@@ -2760,9 +2745,6 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         return match;
     }
 
-    /**
-     * @return
-     */
     private static MatchBuilder createICMPv6Match1() {
 
         final MatchBuilder match = new MatchBuilder();
@@ -2840,10 +2822,6 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     }
 
-    /**
-     * @return
-     */
-
     private static MatchBuilder createVlanMatch() {
         final MatchBuilder match = new MatchBuilder();
         // vlan match
@@ -2859,9 +2837,6 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         return match;
     }
 
-    /**
-     * @return
-     */
     private static MatchBuilder createArpMatch() {
         final MatchBuilder match = new MatchBuilder();
 
@@ -2897,35 +2872,6 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         return match;
     }
 
-
-    /**
-     * @return
-     */
-    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;
-
-    }
-
-    /**
-     * @return
-     */
     private static MatchBuilder createL3IPv6Match() {
         final MatchBuilder match = new MatchBuilder();
 
@@ -2935,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();
@@ -2967,10 +2910,6 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         return match;
     }
 
-    /**
-     * @return
-     */
-
     private static MatchBuilder createICMPv4Match() {
         final MatchBuilder match = new MatchBuilder();
         final EthernetMatchBuilder eth = new EthernetMatchBuilder();
@@ -2991,9 +2930,6 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         return match;
     }
 
-    /**
-     * @return
-     */
     private static MatchBuilder createICMPv6Match() {
 
         final MatchBuilder match = new MatchBuilder();
@@ -3016,9 +2952,6 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         return match;
     }
 
-    /**
-     * @return
-     */
     private static MatchBuilder createToSMatch() {
         final MatchBuilder match = new MatchBuilder();
         final EthernetMatchBuilder ethmatch = new EthernetMatchBuilder();
@@ -3035,10 +2968,6 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         return match;
     }
 
-    /**
-     * @return
-     */
-
     private static MatchBuilder createL4TCPMatch() {
         final MatchBuilder match = new MatchBuilder();
 
@@ -3062,9 +2991,6 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         return match;
     }
 
-    /**
-     * @return
-     */
     private static MatchBuilder createL4UDPMatch() {
         final MatchBuilder match = new MatchBuilder();
 
@@ -3088,9 +3014,6 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         return match;
     }
 
-    /**
-     * @return
-     */
     private static MatchBuilder createL4SCTPMatch() {
         final MatchBuilder match = new MatchBuilder();
 
@@ -3114,9 +3037,6 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         return match;
     }
 
-    /**
-     * @return
-     */
     private static MatchBuilder createMetadataMatch() {
         final MatchBuilder match = new MatchBuilder();
         final byte[] metamask = new byte[]{(byte) -1, (byte) -1, (byte) -1, 0, 0, 0, (byte) 1, (byte) 1};
@@ -3128,9 +3048,6 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         return match;
     }
 
-    /**
-     * @return
-     */
     private static MatchBuilder createMplsMatch() {
         final MatchBuilder match = new MatchBuilder();
 
@@ -3151,9 +3068,6 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
     }
 
-    /**
-     * @return
-     */
     private static MatchBuilder createPbbMatch() {
         final MatchBuilder match = new MatchBuilder();
 
@@ -3165,16 +3079,14 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         final ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder(); // mpls
         // match
-        protomatch.setPbb(new PbbBuilder().setPbbIsid(4L).setPbbMask(new BigInteger(new byte[]{0, 1, 0, 0}).longValue()).build());
+        protomatch.setPbb(new PbbBuilder().setPbbIsid(4L).setPbbMask(
+                new BigInteger(new byte[]{0, 1, 0, 0}).longValue()).build());
         match.setProtocolMatchFields(protomatch.build());
 
         return match;
 
     }
 
-    /**
-     * @return
-     */
     private static MatchBuilder createTunnelIDMatch() {
         final MatchBuilder match = new MatchBuilder();
         final TunnelBuilder tunnel = new TunnelBuilder(); // tunnel id match
@@ -3187,7 +3099,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
     }
 
     /**
-     * Test match for TCP_Flags
+     * Test match for TCP_Flags.
      *
      * @return match containing Ethertype (0x0800), IP Protocol (TCP), TCP_Flag (SYN)
      */
@@ -3235,31 +3147,29 @@ 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 aVoid) {
+            public void onSuccess(final Void notUsed) {
                 ci.println("Status of Group Data Loaded Transaction: success.");
             }
 
             @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());
     }
 
     /**
-     * @param ci arguments: switchId flowType tableNum
-     *           <p>
-     *           <pre>
-     *                     e.g.: addMDFlow openflow:1 f1 42
-     *                     </pre>
+     * Adds a flow.
+     *
+     * @param ci arguments: switchId flowType tableNum, e.g.: addMDFlow openflow:1 f1 42
      */
     public void _addMDFlow(final CommandInterpreter ci) {
         final NodeBuilder tn = createTestNode(ci.nextArgument());
@@ -3276,23 +3186,24 @@ 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());
-        modification.merge(LogicalDatastoreType.CONFIGURATION, nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build(), true);
+                .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 aVoid) {
+            public void onSuccess(final Void notUsed) {
                 ci.println("Status of Group Data Loaded Transaction: success.");
             }
 
             @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());
     }
 
     public void _modifyMDFlow(final CommandInterpreter ci) {
@@ -3304,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";
@@ -3328,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<String>();
-        }
-
         int numberOfSwtiches = 0;
         int numberOfFlows = 0;
         int warmupIterations = 0;
@@ -3403,7 +3302,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
             }
             executor.shutdown();
             executor.awaitTermination(1, TimeUnit.SECONDS);
-        } catch (final Exception e) {
+        } catch (InterruptedException e) {
             ci.println("Exception:" + e.getMessage());
         }
     }
@@ -3412,18 +3311,16 @@ 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, final int t, final int tableID) {
+        TestFlowThread(final int numberOfSwtiches, final int numberOfFlows, final CommandInterpreter ci,
+                final int threadNumber, final int tableID) {
             this.numberOfSwitches = numberOfSwtiches;
             this.numberOfFlows = numberOfFlows;
             this.ci = ci;
-            this.theadNumber = t;
+            this.theadNumber = threadNumber;
             this.tableID = tableID;
         }
 
@@ -3454,9 +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));
+                ci.println("Total flows added in Thread:" + this.theadNumber + ": Flows/Sec::"
+                    + Math.round((float)totalNumberOfFlows / timeInSeconds));
             } else {
                 ci.println("Total flows added in Thread:" + this.theadNumber + ": Flows/Sec::" + totalNumberOfFlows);
             }
@@ -3468,13 +3366,14 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
      * usage testAllFlows <dp>
      * ex: _perfFlowTest 1
      */
+    @SuppressWarnings("checkstyle:IllegalCatch")
     public void _testAllFlows(final CommandInterpreter ci) {
         String dataPathID = ci.nextArgument();
         final int numberOfFlows = 82;
         if (dataPathID == null || dataPathID.trim().equals("")) {
             dataPathID = "1";
         }
-        ci.println("*     Test All Flows       *");
+        ci.println("*     Test All Flows    *");
         ci.println("*     dataPathID:::" + dataPathID + "");
         final String dataPath = "openflow:" + dataPathID;
         final String tableId = "0";
@@ -3485,7 +3384,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
             try {
                 tf = createTestFlow(tn, flowID, tableId);
                 writeFlow(ci, tf, tn);
-            } catch (final Exception e) {
+            } catch (RuntimeException e) {
                 ci.println("--Test Failed--Issue found while adding flow" + flow);
                 break;
             }