Quickfix - TableMod message (now correct config)
[openflowjava.git] / openflow-protocol-impl / src / test / java / org / opendaylight / openflowjava / protocol / impl / serialization / factories / TableModInputMessageFactoryTest.java
index 501453bd02066badc21bf313fe98b4a5617a20eb..ddcdb27c664daf0897928fc2fcafb7cd65f09270 100644 (file)
@@ -8,7 +8,7 @@ import junit.framework.Assert;
 import org.junit.Test;\r
 import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.HelloMessageFactoryTest;\r
 import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfig;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableConfig;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableId;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.TableModInput;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.TableModInputBuilder;\r
@@ -30,7 +30,7 @@ public class TableModInputMessageFactoryTest {
         TableModInputBuilder builder = new TableModInputBuilder();\r
         BufferHelper.setupHeader(builder);\r
         builder.setTableId(new TableId(9L));\r
-        builder.setConfig(new PortConfig(true, false, true, false));\r
+        builder.setConfig(new TableConfig(true));\r
         TableModInput message = builder.build();\r
         \r
         ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
@@ -38,16 +38,9 @@ public class TableModInputMessageFactoryTest {
         factory.messageToBuffer(HelloMessageFactoryTest.VERSION_YET_SUPPORTED, out, message);\r
         \r
         BufferHelper.checkHeaderV13(out, MESSAGE_TYPE, 16);\r
-        Assert.assertEquals("Wrong TableID", message.getTableId().getValue().intValue(), out.readByte());\r
+        Assert.assertEquals("Wrong TableID", message.getTableId().getValue().intValue(), out.readUnsignedByte());\r
         out.skipBytes(PADDING_IN_TABLE_MOD_MESSAGE);\r
-        Assert.assertEquals("Wrong PortConfig", message.getConfig(), createPortConfig(out.readInt()));\r
+        Assert.assertEquals("Wrong TableConfig", 8, out.readUnsignedInt());\r
     }\r
     \r
-    private static PortConfig createPortConfig(long input){\r
-        final Boolean _portDown   = ((input) & (1<<0)) > 0;\r
-        final Boolean _noRecv    = ((input) & (1<<2)) > 0;\r
-        final Boolean _noFwd       = ((input) & (1<<5)) > 0;\r
-        final Boolean _noPacketIn = ((input) & (1<<6)) > 0;\r
-        return new PortConfig(_noFwd, _noPacketIn, _noRecv, _portDown);\r
-    }\r
 }\r