Bump upstreams
[openflowplugin.git] / openflowplugin-impl / src / test / java / org / opendaylight / openflowplugin / impl / protocol / serialization / messages / PortMessageSerializerTest.java
index 9cb7c2a80a2d1b62d4c98f6a7068e8e4d0b39d06..6604f6590579365676cbf07629cdc4e0c8ea51c6 100644 (file)
@@ -5,7 +5,6 @@
  * 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.openflowplugin.impl.protocol.serialization.messages;
 
 import static org.junit.Assert.assertEquals;
@@ -19,6 +18,7 @@ import org.opendaylight.openflowjava.protocol.api.util.BinContent;
 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
 import org.opendaylight.openflowjava.util.ByteBufUtils;
 import org.opendaylight.openflowplugin.impl.protocol.serialization.AbstractSerializerTest;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.IetfYangUtil;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortConfig;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortFeatures;
@@ -27,6 +27,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.P
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortNumberUni;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.OutputPortValues;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumberValues;
+import org.opendaylight.yangtools.yang.common.Uint32;
+import org.opendaylight.yangtools.yang.common.Uint8;
 
 public class PortMessageSerializerTest extends AbstractSerializerTest {
 
@@ -34,11 +36,11 @@ public class PortMessageSerializerTest extends AbstractSerializerTest {
     private static final byte PADDING_IN_PORT_MOD_MESSAGE_02 = 2;
     private static final byte PADDING_IN_PORT_MOD_MESSAGE_03 = 4;
     private static final short LENGTH = 40;
-    private static final Long XID = 42L;
-    private static final short VERSION = EncodeConstants.OF13_VERSION_ID;
+    private static final Uint32 XID = Uint32.valueOf(42);
+    private static final Uint8 VERSION = EncodeConstants.OF_VERSION_1_3;
     private static final String PORT_NUMBER = OutputPortValues.ALL.toString();
     private static final Long PORT_NUMBER_VAL = BinContent.intToUnsignedLong(PortNumberValues.ALL.getIntValue());
-    private static final String MAC_ADDRESS = "E9:2A:55:BA:FA:4D";
+    private static final String MAC_ADDRESS = "e9:2a:55:ba:fa:4d";
 
     // Port config
     private static final Boolean IS_NOFWD = false;
@@ -95,16 +97,16 @@ public class PortMessageSerializerTest extends AbstractSerializerTest {
     @Override
     protected void init() {
         serializer = getRegistry()
-                .getSerializer(new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, PortMessage.class));
+                .getSerializer(new MessageTypeKey<>(EncodeConstants.OF_VERSION_1_3, PortMessage.class));
     }
 
     @Test
-    public void testSerialize() throws Exception {
+    public void testSerialize() {
         final ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
         serializer.serialize(MESSAGE, out);
 
         // Header
-        assertEquals(out.readByte(), VERSION);
+        assertEquals(out.readByte(), VERSION.byteValue());
         assertEquals(out.readByte(), serializer.getMessageType());
         assertEquals(out.readShort(), LENGTH);
         assertEquals(out.readInt(), XID.intValue());
@@ -114,9 +116,7 @@ public class PortMessageSerializerTest extends AbstractSerializerTest {
         out.skipBytes(PADDING_IN_PORT_MOD_MESSAGE_01);
         byte[] address = new byte[6];
         out.readBytes(address);
-        assertEquals(
-                new MacAddress(ByteBufUtils.macAddressToString(address)).getValue(),
-                new MacAddress(MAC_ADDRESS).getValue());
+        assertEquals(new MacAddress(MAC_ADDRESS), IetfYangUtil.macAddressFor(address));
         out.skipBytes(PADDING_IN_PORT_MOD_MESSAGE_02);
 
         // Port config