Fix - bug 270
[openflowjava.git] / openflow-protocol-impl / src / test / java / org / opendaylight / openflowjava / protocol / impl / deserialization / factories / OF10StatsReplyMessageFactoryTest.java
index 438f9b2ea78ac1dfe7b0250a66fc1c1cf183b81e..d1f3de31a940c262054b60e7e6c85ce34877ad06 100644 (file)
@@ -105,7 +105,7 @@ public class OF10StatsReplyMessageFactoryTest {
                 + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 "\r
                 + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 "\r
                 + "00 00 00 02 00 00 00 03 00 04 00 05 00 06 00 00 00 00 00 00 "\r
-                + "00 01 02 03 04 05 06 07 00 01 02 03 04 05 06 07 00 00 00 00 00 00 00 20 "\r
+                + "FF 01 02 03 04 05 06 07 FF 01 02 03 04 05 06 07 FF 00 00 00 00 00 00 20 "\r
                 + "00 00 00 08 00 01 00 02 00 01 00 08 00 03 00 00");\r
         \r
         MultipartReplyMessage builtByFactory = \r
@@ -123,13 +123,13 @@ public class OF10StatsReplyMessageFactoryTest {
         Assert.assertEquals("Wrong idleTimeOut", 5, message.getFlowStats().get(0).getIdleTimeout().intValue());\r
         Assert.assertEquals("Wrong hardTimeOut", 6, message.getFlowStats().get(0).getHardTimeout().intValue());\r
         Assert.assertEquals("Wrong cookie",\r
-                new BigInteger(new byte[]{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}), \r
+                new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}), \r
                 message.getFlowStats().get(0).getCookie());\r
         Assert.assertEquals("Wrong packetCount",\r
-                new BigInteger(new byte[]{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}), \r
+                new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}), \r
                 message.getFlowStats().get(0).getPacketCount());\r
         Assert.assertEquals("Wrong byteCount",\r
-                new BigInteger(new byte[]{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20}), \r
+                new BigInteger(1, new byte[]{(byte) 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20}), \r
                 message.getFlowStats().get(0).getByteCount());\r
         Action action1 = message.getFlowStats().get(0).getActionsList().get(0).getAction();\r
         Assert.assertEquals("Wrong action type", Output.class, action1.getType());\r
@@ -150,7 +150,7 @@ public class OF10StatsReplyMessageFactoryTest {
     @Test\r
     public void testAggregate() {\r
         ByteBuf bb = BufferHelper.buildBuffer("00 02 00 01 "\r
-                + "00 01 02 03 04 05 06 07 00 00 00 00 00 00 00 20 00 00 00 30 00 00 00 00");\r
+                + "FF 01 02 03 04 05 06 07 FF 00 00 00 00 00 00 20 00 00 00 30 00 00 00 00");\r
         \r
         MultipartReplyMessage builtByFactory = \r
                 BufferHelper.decodeV10(OF10StatsReplyMessageFactory.getInstance(), bb);\r
@@ -161,10 +161,10 @@ public class OF10StatsReplyMessageFactoryTest {
         MultipartReplyAggregateCase messageCase = (MultipartReplyAggregateCase) builtByFactory.getMultipartReplyBody();\r
         MultipartReplyAggregate message = messageCase.getMultipartReplyAggregate();\r
         Assert.assertEquals("Wrong packet-count",\r
-                new BigInteger(new byte[]{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}), \r
+                new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}), \r
                 message.getPacketCount());\r
         Assert.assertEquals("Wrong byte-count",\r
-                new BigInteger(new byte[]{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20}), \r
+                new BigInteger(1, new byte[]{(byte) 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20}), \r
                 message.getByteCount());\r
         Assert.assertEquals("Wrong flow-count", 48, message.getFlowCount().intValue());\r
         Assert.assertTrue("Unread data", bb.readableBytes() == 0);\r
@@ -178,7 +178,7 @@ public class OF10StatsReplyMessageFactoryTest {
         ByteBuf bb = BufferHelper.buildBuffer("00 03 00 01 "\r
                 + "08 00 00 00 4A 41 4D 45 53 20 42 4F 4E 44 00 00 00 00 00 00 00 00 00 "\r
                 + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 "\r
-                + "00 00 00 30 00 00 00 10 00 01 01 01 01 01 01 01 02 01 01 01 01 01 01 00");\r
+                + "00 00 00 30 00 00 00 10 FF 01 01 01 01 01 01 01 FF 01 01 01 01 01 01 00");\r
 \r
         MultipartReplyMessage builtByFactory = BufferHelper.decodeV10(OF10StatsReplyMessageFactory.getInstance(), bb);\r
 \r
@@ -197,10 +197,10 @@ public class OF10StatsReplyMessageFactoryTest {
         Assert.assertEquals("Wrong max-entries", 48, message.getTableStats().get(0).getMaxEntries().longValue());\r
         Assert.assertEquals("Wrong activeCount", 16, message.getTableStats().get(0).getActiveCount().longValue());\r
         Assert.assertEquals("Wrong lookupCount", \r
-                new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}), \r
+                new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}), \r
                 message.getTableStats().get(0).getLookupCount());\r
         Assert.assertEquals("Wrong matchedCount", \r
-                new BigInteger(new byte[]{0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00}), \r
+                new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00}), \r
                 message.getTableStats().get(0).getMatchedCount());\r
         Assert.assertTrue("Unread data", bb.readableBytes() == 0);\r
     }\r
@@ -212,12 +212,12 @@ public class OF10StatsReplyMessageFactoryTest {
     public void testPort() {\r
         ByteBuf bb = BufferHelper.buildBuffer("00 04 00 01 "\r
                 + "00 FF 00 00 00 00 00 00 "\r
-                + "00 01 01 01 01 01 01 01 00 02 02 02 02 02 02 02 "\r
-                + "00 02 03 02 03 02 03 02 00 02 03 02 03 02 03 02 "\r
-                + "00 02 03 02 03 02 03 02 00 02 03 02 03 02 03 02 "\r
-                + "00 02 03 02 03 02 03 02 00 02 03 02 03 02 03 02 "\r
-                + "00 02 03 02 03 02 03 02 00 02 03 02 03 02 03 02 00 02 03 02 03 02 03 02 "\r
-                + "00 02 03 02 03 02 03 02 ");\r
+                + "FF 01 01 01 01 01 01 01 FF 02 02 02 02 02 02 02 "\r
+                + "FF 02 03 02 03 02 03 02 FF 02 03 02 03 02 03 02 "\r
+                + "FF 02 03 02 03 02 03 02 FF 02 03 02 03 02 03 02 "\r
+                + "FF 02 03 02 03 02 03 02 FF 02 03 02 03 02 03 02 "\r
+                + "FF 02 03 02 03 02 03 02 FF 02 03 02 03 02 03 02 FF 02 03 02 03 02 03 02 "\r
+                + "FF 02 03 02 03 02 03 02 ");\r
 \r
         MultipartReplyMessage builtByFactory = BufferHelper.decodeV10(OF10StatsReplyMessageFactory.getInstance(), bb);\r
 \r
@@ -228,40 +228,40 @@ public class OF10StatsReplyMessageFactoryTest {
         MultipartReplyPortStats message = messageCase.getMultipartReplyPortStats();\r
         Assert.assertEquals("Wrong portNo", 255, message.getPortStats().get(0).getPortNo().intValue());\r
         Assert.assertEquals("Wrong rxPackets", \r
-                new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}), \r
+                new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}), \r
                 message.getPortStats().get(0).getRxPackets());\r
         Assert.assertEquals("Wrong txPackets", \r
-                new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}), \r
+                new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}), \r
                 message.getPortStats().get(0).getTxPackets());\r
         Assert.assertEquals("Wrong rxBytes", \r
-                new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
+                new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
                 message.getPortStats().get(0).getRxBytes());\r
         Assert.assertEquals("Wrong txBytes", \r
-                new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
+                new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
                 message.getPortStats().get(0).getTxBytes());\r
         Assert.assertEquals("Wrong rxDropped", \r
-                new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
+                new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
                 message.getPortStats().get(0).getRxDropped());\r
         Assert.assertEquals("Wrong txDropped", \r
-                new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
+                new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
                 message.getPortStats().get(0).getTxDropped());\r
         Assert.assertEquals("Wrong rxErrors", \r
-                new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
+                new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
                 message.getPortStats().get(0).getRxErrors());\r
         Assert.assertEquals("Wrong txErrors", \r
-                new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
+                new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
                 message.getPortStats().get(0).getTxErrors());\r
         Assert.assertEquals("Wrong rxFrameErr", \r
-                new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
+                new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
                 message.getPortStats().get(0).getRxFrameErr());\r
         Assert.assertEquals("Wrong rxOverErr", \r
-                new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
+                new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
                 message.getPortStats().get(0).getRxOverErr());\r
         Assert.assertEquals("Wrong rxCrcErr", \r
-                new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
+                new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
                 message.getPortStats().get(0).getRxCrcErr());\r
         Assert.assertEquals("Wrong collisions", \r
-                new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
+                new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
                 message.getPortStats().get(0).getCollisions());\r
         Assert.assertTrue("Unread data", bb.readableBytes() == 0);\r
     }\r
@@ -273,9 +273,9 @@ public class OF10StatsReplyMessageFactoryTest {
     public void testQueue() {\r
         ByteBuf bb = BufferHelper.buildBuffer("00 05 00 00 "\r
                 + "00 FF 00 00 00 00 00 10 "\r
-                + "00 02 03 02 03 02 03 02 "\r
-                + "00 02 02 02 02 02 02 02 "\r
-                + "00 02 03 02 03 02 03 02 ");\r
+                + "FF 02 03 02 03 02 03 02 "\r
+                + "FF 02 02 02 02 02 02 02 "\r
+                + "FF 02 03 02 03 02 03 02 ");\r
 \r
         MultipartReplyMessage builtByFactory = BufferHelper.decodeV10(OF10StatsReplyMessageFactory.getInstance(), bb);\r
 \r
@@ -287,13 +287,13 @@ public class OF10StatsReplyMessageFactoryTest {
         Assert.assertEquals("Wrong portNo", 255, message.getQueueStats().get(0).getPortNo().intValue());\r
         Assert.assertEquals("Wrong queueId", 16, message.getQueueStats().get(0).getQueueId().intValue());\r
         Assert.assertEquals("Wrong txBytes", \r
-                new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
+                new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
                 message.getQueueStats().get(0).getTxBytes());\r
         Assert.assertEquals("Wrong txPackets", \r
-                new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}), \r
+                new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}), \r
                 message.getQueueStats().get(0).getTxPackets());\r
         Assert.assertEquals("Wrong txErrors", \r
-                new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
+                new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
                 message.getQueueStats().get(0).getTxErrors());\r
         Assert.assertTrue("Unread data", bb.readableBytes() == 0);\r
     }\r