Bump MRI upstreams
[openflowplugin.git] / openflowjava / openflow-protocol-impl / src / test / java / org / opendaylight / openflowjava / protocol / impl / deserialization / factories / multipart / MultipartReplyFlowTest.java
index 317f8e9221c44b28414fc8705c7da9a89a4b7aa4..7fbeff4b1d404f889889031b749e685b485ea363 100644 (file)
@@ -5,11 +5,9 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.openflowjava.protocol.impl.deserialization.factories.multipart;
 
 import io.netty.buffer.ByteBuf;
-import java.math.BigInteger;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -26,6 +24,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyFlowCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.flow._case.MultipartReplyFlow;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.flow._case.multipart.reply.flow.FlowStats;
+import org.opendaylight.yangtools.yang.common.Uint64;
 
 /**
  * Unit tests for MultipartReplyFlow.
@@ -44,7 +43,7 @@ public class MultipartReplyFlowTest {
         DeserializerRegistry registry = new DeserializerRegistryImpl();
         registry.init();
         factory = registry.getDeserializer(
-                new MessageCodeKey(EncodeConstants.OF13_VERSION_ID, 19, MultipartReplyMessage.class));
+                new MessageCodeKey(EncodeConstants.OF_VERSION_1_3, 19, MultipartReplyMessage.class));
     }
 
     /**
@@ -57,10 +56,10 @@ public class MultipartReplyFlowTest {
 
         BufferHelper.checkHeaderV13(builtByFactory);
         Assert.assertEquals("Wrong type", 0x01, builtByFactory.getType().getIntValue());
-        Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
+        Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().getOFPMPFREQMORE());
         MultipartReplyFlowCase messageCase = (MultipartReplyFlowCase) builtByFactory.getMultipartReplyBody();
         MultipartReplyFlow message = messageCase.getMultipartReplyFlow();
-        Assert.assertEquals("Wrong flow stats size", 0, message.getFlowStats().size());
+        Assert.assertEquals("Wrong flow stats size", 0, message.nonnullFlowStats().size());
     }
 
     /**
@@ -68,36 +67,36 @@ public class MultipartReplyFlowTest {
      */
     @Test
     public void testMultipartReplyFlowBody() {
-        ByteBuf bb = BufferHelper.buildBuffer("00 01 00 01 00 00 00 00 " //
+        ByteBuf bb = BufferHelper.buildBuffer("00 01 00 01 00 00 00 00 " //
                                               // first flow stat
-                                              "00 48 08 00 " + // length, tableId, padding
-                                              "00 00 00 09 " + //durationSec
-                                              "00 00 00 07 " + //durationNsec
-                                              "00 0C 00 0E 00 0F 00 1F " + //priority, idleTimeout, hardTimeout, flags
-                                              "00 00 00 00 " + //pad_02
-                                              "FF 01 01 01 01 01 01 01 " + //cookie
-                                              "EF 01 01 01 01 01 01 01 " + //packetCount
-                                              "7F 01 01 01 01 01 01 01 " + //byteCount
-                                              "00 01 00 04 00 00 00 00 " + //empty match
-                                              "00 01 00 08 06 00 00 00 " + //
-                                              "00 01 00 08 06 00 00 00 " + //
+                                              + "00 48 08 00 " // length, tableId, padding
+                                              + "00 00 00 09 " //durationSec
+                                              + "00 00 00 07 " //durationNsec
+                                              + "00 0C 00 0E 00 0F 00 1F " //priority, idleTimeout, hardTimeout, flags
+                                              + "00 00 00 00 " //pad_02
+                                              + "FF 01 01 01 01 01 01 01 " //cookie
+                                              + "EF 01 01 01 01 01 01 01 " //packetCount
+                                              + "7F 01 01 01 01 01 01 01 " //byteCount
+                                              + "00 01 00 04 00 00 00 00 " //empty match
+                                              + "00 01 00 08 06 00 00 00 " //
+                                              + "00 01 00 08 06 00 00 00 " //
                                               // second flow stat
-                                              "00 48 08 00 " + // length, tableId, padding
-                                              "00 00 00 09 " + //durationSec
-                                              "00 00 00 07 " + //durationNsec
-                                              "00 0C 00 0E 00 0F 00 00 " + // priority, idleTimeout, hardTimeout, flags
-                                              "00 00 00 00 " + //pad_02
-                                              "FF 01 01 01 01 01 01 01 " + //cookie
-                                              "EF 01 01 01 01 01 01 01 " + //packetCount
-                                              "7F 01 01 01 01 01 01 01 " + //byteCount
-                                              "00 01 00 04 00 00 00 00 " + //empty match
-                                              "00 01 00 08 06 00 00 00 " + //
-                                              "00 01 00 08 06 00 00 00");
+                                              + "00 48 08 00 " // length, tableId, padding
+                                              + "00 00 00 09 " //durationSec
+                                              + "00 00 00 07 " //durationNsec
+                                              + "00 0C 00 0E 00 0F 00 00 " // priority, idleTimeout, hardTimeout, flags
+                                              + "00 00 00 00 " //pad_02
+                                              + "FF 01 01 01 01 01 01 01 " //cookie
+                                              + "EF 01 01 01 01 01 01 01 " //packetCount
+                                              + "7F 01 01 01 01 01 01 01 " //byteCount
+                                              + "00 01 00 04 00 00 00 00 " //empty match
+                                              + "00 01 00 08 06 00 00 00 " //
+                                              "00 01 00 08 06 00 00 00");
         MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);
 
         BufferHelper.checkHeaderV13(builtByFactory);
         Assert.assertEquals("Wrong type", 0x01, builtByFactory.getType().getIntValue());
-        Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
+        Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().getOFPMPFREQMORE());
         MultipartReplyFlowCase messageCase = (MultipartReplyFlowCase) builtByFactory.getMultipartReplyBody();
         MultipartReplyFlow message = messageCase.getMultipartReplyFlow();
         Assert.assertEquals("Wrong flow stats size", 2, message.getFlowStats().size());
@@ -109,12 +108,9 @@ public class MultipartReplyFlowTest {
         Assert.assertEquals("Wrong idleTimeOut", 14, flowStats1.getIdleTimeout().intValue());
         Assert.assertEquals("Wrong hardTimeOut", 15, flowStats1.getHardTimeout().intValue());
         Assert.assertEquals("Wrong flags", new FlowModFlags(true, true, true, true, true), flowStats1.getFlags());
-        Assert.assertEquals("Wrong cookie", new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01,
-            0x01, 0x01, 0x01}), flowStats1.getCookie());
-        Assert.assertEquals("Wrong packetCount", new BigInteger(1, new byte[]{(byte) 0xEF, 0x01, 0x01, 0x01,
-            0x01, 0x01, 0x01, 0x01}), flowStats1.getPacketCount());
-        Assert.assertEquals("Wrong byteCount", new BigInteger(1, new byte[]{(byte) 0x7F, 0x01, 0x01, 0x01,
-            0x01, 0x01, 0x01, 0x01}), flowStats1.getByteCount());
+        Assert.assertEquals("Wrong cookie", Uint64.valueOf("FF01010101010101", 16), flowStats1.getCookie());
+        Assert.assertEquals("Wrong packetCount",  Uint64.valueOf("EF01010101010101", 16), flowStats1.getPacketCount());
+        Assert.assertEquals("Wrong byteCount",  Uint64.valueOf("7F01010101010101", 16), flowStats1.getByteCount());
         Assert.assertEquals("Wrong match type", OxmMatchType.class, flowStats1.getMatch().getType());
         flowStats1 = message.getFlowStats().get(1);
         Assert.assertEquals("Wrong tableId", 8, flowStats1.getTableId().intValue());
@@ -124,12 +120,9 @@ public class MultipartReplyFlowTest {
         Assert.assertEquals("Wrong idleTimeOut", 14, flowStats1.getIdleTimeout().intValue());
         Assert.assertEquals("Wrong hardTimeOut", 15, flowStats1.getHardTimeout().intValue());
         Assert.assertEquals("Wrong flags", new FlowModFlags(false, false, false, false, false), flowStats1.getFlags());
-        Assert.assertEquals("Wrong cookie", new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01,
-            0x01, 0x01, 0x01}), flowStats1.getCookie());
-        Assert.assertEquals("Wrong packetCount", new BigInteger(1, new byte[]{(byte) 0xEF, 0x01, 0x01, 0x01,
-            0x01, 0x01, 0x01, 0x01}), flowStats1.getPacketCount());
-        Assert.assertEquals("Wrong byteCount", new BigInteger(1, new byte[]{(byte) 0x7F, 0x01, 0x01, 0x01,
-            0x01, 0x01, 0x01, 0x01}), flowStats1.getByteCount());
+        Assert.assertEquals("Wrong cookie", Uint64.valueOf("FF01010101010101", 16), flowStats1.getCookie());
+        Assert.assertEquals("Wrong packetCount", Uint64.valueOf("EF01010101010101", 16), flowStats1.getPacketCount());
+        Assert.assertEquals("Wrong byteCount", Uint64.valueOf("7F01010101010101", 16), flowStats1.getByteCount());
         Assert.assertEquals("Wrong match type", OxmMatchType.class, flowStats1.getMatch().getType());
     }
 }