Merge "Bug 1072 -Add OF13 pre-req for PCP match in TestCommandProvider"
[openflowplugin.git] / drop-test / src / main / java / org / opendaylight / openflowplugin / outputtest / OutputTestUtil.java
index 975e0942b042ba778482e04145b3e41c8557a999..8a287a92ba138f3834cb8a6a4498fdb5d649b2bf 100644 (file)
@@ -30,6 +30,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.ta
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.InstructionsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
@@ -53,7 +54,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.Tr
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 
-@SuppressWarnings("all")
 public class OutputTestUtil {
 
     private OutputTestUtil() {
@@ -72,7 +72,7 @@ public class OutputTestUtil {
         }
 
         while (index < 8) {
-            list.add(new Byte("0"));
+            list.add((byte)0);
             index++;
         }
         NodeRef ref = createNodeRef(nodeId);
@@ -82,13 +82,13 @@ public class OutputTestUtil {
 
         TransmitPacketInputBuilder tPackBuilder = new TransmitPacketInputBuilder();
 
-        final ArrayList<Byte> _converted_list = (ArrayList<Byte>) list;
+        final ArrayList<Byte> _converted_list = list;
         byte[] _primitive = ArrayUtils.toPrimitive(_converted_list.toArray(new Byte[0]));
         tPackBuilder.setPayload(_primitive);
 
         tPackBuilder.setNode(ref);
         // TODO VD P2 missing cookies in Test
-        tPackBuilder.setCookie(null);
+        tPackBuilder.setConnectionCookie(null);
         tPackBuilder.setEgress(nEgressConfRef);
         tPackBuilder.setIngress(nIngressConRef);
         return tPackBuilder.build();
@@ -134,7 +134,7 @@ public class OutputTestUtil {
     }
 
     public static NodeConnectorRef createNodeConnRef(final String nodeId, final String port) {
-        StringBuilder sBuild = new StringBuilder(nodeId).append(":").append(port);
+        StringBuilder sBuild = new StringBuilder(nodeId).append(':').append(port);
         NodeConnectorId _nodeConnectorId = new NodeConnectorId(sBuild.toString());
 
         NodeConnectorKey nConKey = new NodeConnectorKey(new NodeConnectorId(sBuild.toString()));
@@ -163,9 +163,9 @@ public class OutputTestUtil {
         FlowKey key = new FlowKey(new FlowId(Long.toString(flowId)));
         fBuild.setBarrier(false);
         // flow.setBufferId(new Long(12));
-        BigInteger value = new BigInteger("10", 10);
-        fBuild.setCookie(value);
-        fBuild.setCookieMask(value);
+        final BigInteger value = BigInteger.valueOf(10);
+        fBuild.setCookie(new FlowCookie(value));
+        fBuild.setCookieMask(new FlowCookie(value));
         fBuild.setHardTimeout(0);
         fBuild.setIdleTimeout(0);
         fBuild.setInstallHw(false);
@@ -174,7 +174,7 @@ public class OutputTestUtil {
         fBuild.setFlags(new FlowModFlags(false, false, false, false, false));
         fBuild.setId(new FlowId("12"));
         fBuild.setTableId(checkTableId(tableId));
-        fBuild.setOutGroup(new Long(2));
+        fBuild.setOutGroup(2L);
         fBuild.setOutPort(value);
 
         fBuild.setKey(key);
@@ -212,7 +212,7 @@ public class OutputTestUtil {
         try {
             return Short.parseShort(tableId);
         } catch (Exception ex) {
-            return Short.parseShort("2");
+            return 2;
         }
     }
 }