Bump MRI upstreams
[openflowplugin.git] / openflowjava / openflow-protocol-impl / src / main / java / org / opendaylight / openflowjava / protocol / impl / deserialization / factories / OF10PortModInputMessageFactory.java
index 2dd19bbaac361b639eb2de92ff07a21855ca547c..dce173fd36b52db36539932e57b4ed7dd287e401 100644 (file)
@@ -7,6 +7,9 @@
  */
 package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint16;
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
@@ -26,15 +29,15 @@ public class OF10PortModInputMessageFactory implements OFDeserializer<PortModInp
 
     @Override
     public PortModInput deserialize(final ByteBuf rawMessage) {
-        PortModInputBuilder builder = new PortModInputBuilder();
-        builder.setVersion((short) EncodeConstants.OF10_VERSION_ID);
-        builder.setXid(rawMessage.readUnsignedInt());
-        builder.setPortNo(new PortNumber((long) rawMessage.readUnsignedShort()));
-        builder.setHwAddress(ByteBufUtils.readIetfMacAddress(rawMessage));
-        builder.setConfigV10(createPortConfig(rawMessage.readUnsignedInt()));
-        builder.setMaskV10(createPortConfig(rawMessage.readUnsignedInt()));
-        builder.setAdvertiseV10(createPortFeatures(rawMessage.readUnsignedInt()));
-        return builder.build();
+        return new PortModInputBuilder()
+                .setVersion(EncodeConstants.OF_VERSION_1_0)
+                .setXid(readUint32(rawMessage))
+                .setPortNo(new PortNumber(readUint16(rawMessage).toUint32()))
+                .setHwAddress(ByteBufUtils.readIetfMacAddress(rawMessage))
+                .setConfigV10(createPortConfig(rawMessage.readUnsignedInt()))
+                .setMaskV10(createPortConfig(rawMessage.readUnsignedInt()))
+                .setAdvertiseV10(createPortFeatures(rawMessage.readUnsignedInt()))
+                .build();
     }
 
     private static PortConfigV10 createPortConfig(final long input) {