Migrate uint/ByteBuf interactions 21/91421/15
authorRobert Varga <robert.varga@pantheon.tech>
Sat, 18 Jul 2020 14:31:13 +0000 (16:31 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 28 Jul 2020 11:29:41 +0000 (13:29 +0200)
Migrate use of Uint helpers provided by yangtools, which offer
better performance and ergonomics. This is the first step, migrating
production code, so that it is validated using existing tests.

JIRA: OPNFLWPLUG-1099
Change-Id: I5f396bff3b7d2eaff25c4b3bf6d5eab28add4b44
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
137 files changed:
extension/openflowjava-extension-eric/pom.xml
extension/openflowjava-extension-eric/src/main/java/org/opendaylight/openflowjava/eric/codec/match/Icmpv6NDOptionsTypeCodec.java
extension/openflowjava-extension-eric/src/main/java/org/opendaylight/openflowjava/eric/codec/match/Icmpv6NDReservedCodec.java
extension/openflowjava-extension-nicira/pom.xml
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/ConntrackCodec.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/DecapCodec.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/EncapCodec.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/FinTimeoutCodec.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/LearnCodecUtil.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/MultipathCodec.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/OutputReg2Codec.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/OutputRegCodec.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/RegLoadCodec.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/RegMoveCodec.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/ResubmitCodec.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/AbstractNshcCodec.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/AbstractRegCodec.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/ArpOpCodec.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/ArpSpaCodec.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/ArpTpaCodec.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/CtMarkCodec.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/CtStateCodec.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/CtTpDstCodec.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/CtTpSrcCodec.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/CtZoneCodec.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/EthTypeCodec.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/IcmpTypeCodec.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/InPortCodec.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/IpDstCodec.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/IpSrcCodec.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/Ipv6DstCodec.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/Ipv6SrcCodec.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/NshFlagsCodec.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/NshMdtypeCodec.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/NshNpCodec.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/NsiCodec.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/NspCodec.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/PktMarkCodec.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/TcpDstCodec.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/TcpSrcCodec.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/TunIpv4DstCodec.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/TunIpv4SrcCodec.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/UdpDstCodec.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/UdpSrcCodec.java
openflowjava/openflow-protocol-impl/pom.xml
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF10EnqueueActionDeserializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF10OutputActionDeserializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF10SetNwTosActionDeserializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF10SetTpDstActionDeserializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF10SetTpSrcActionDeserializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF10SetVlanPcpActionDeserializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF10SetVlanVidActionDeserializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF13GroupActionDeserializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF13OutputActionDeserializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF13PopMplsActionDeserializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF13PushMplsActionDeserializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF13PushPbbActionDeserializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF13PushVlanActionDeserializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF13SetMplsTtlActionDeserializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF13SetNwTtlActionDeserializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF13SetQueueActionDeserializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/BarrierInputMessageFactory.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/BarrierReplyMessageFactory.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/EchoReplyMessageFactory.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/EchoRequestMessageFactory.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/ErrorMessageFactory.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/ExperimenterMessageFactory.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/FeaturesReplyMessageFactory.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/FlowModInputMessageFactory.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/FlowRemovedMessageFactory.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/GetAsyncReplyMessageFactory.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/GetAsyncRequestMessageFactory.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/GetConfigInputMessageFactory.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/GetConfigReplyMessageFactory.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/GetFeaturesInputMessageFactory.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/GetQueueConfigInputMessageFactory.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/GroupModInputMessageFactory.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/HelloMessageFactory.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/MeterModInputMessageFactory.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/MultipartReplyMessageFactory.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/MultipartRequestInputMessageFactory.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/OF10ErrorMessageFactory.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/OF10FeaturesReplyMessageFactory.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/OF10FeaturesRequestMessageFactory.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/OF10FlowModInputMessageFactory.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/OF10FlowRemovedMessageFactory.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/OF10GetQueueConfigInputMessageFactory.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/OF10HelloMessageFactory.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/OF10PacketInMessageFactory.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/OF10PacketOutInputMessageFactory.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/OF10PortModInputMessageFactory.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/OF10PortStatusMessageFactory.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/OF10QueueGetConfigReplyMessageFactory.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/OF10StatsReplyMessageFactory.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/OF10StatsRequestInputFactory.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/PacketInMessageFactory.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/PacketOutInputMessageFactory.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/PortModInputMessageFactory.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/PortStatusMessageFactory.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/QueueGetConfigReplyMessageFactory.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/RoleReplyMessageFactory.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/RoleRequestInputMessageFactory.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/SetAsyncInputMessageFactory.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/SetConfigInputMessageFactory.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/TableModInputMessageFactory.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/VendorMessageFactory.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/instruction/GoToTableInstructionDeserializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/instruction/MeterInstructionDeserializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmArpOpDeserializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmEthTypeDeserializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmIcmpv4CodeDeserializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmIcmpv4TypeDeserializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmIcmpv6CodeDeserializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmIcmpv6TypeDeserializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmInPhyPortDeserializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmInPortDeserializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmIpDscpDeserializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmIpEcnDeserializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmIpProtoDeserializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmIpv6FlabelDeserializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmMplsLabelDeserializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmMplsTcDeserializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmPacketTypeDeserializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmSctpDstDeserializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmSctpSrcDeserializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmTcpDstDeserializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmTcpSrcDeserializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmUdpDstDeserializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmUdpSrcDeserializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmVlanPcpDeserializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmVlanVidDeserializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/ext/AbstractOxmExperimenterMatchEntryDeserializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/ext/OnfOxmTcpFlagsDeserializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/OF10MatchDeserializer.java
openflowplugin-impl/pom.xml
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/messages/FlowMessageDeserializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/multipart/MultipartReplyTableFeaturesDeserializer.java

index 613f025be20974622b2850fff961a378c7ef3efb..b600255a72cec114580ef7a57850671b93c20422 100644 (file)
             <groupId>io.netty</groupId>
             <artifactId>netty-buffer</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.opendaylight.yangtools</groupId>
+            <artifactId>yang-common-netty</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-log4j12</artifactId>
index ade88aa5b5c8ea89461711a4823e165bb56085b7..1d24d6faa8fcc7143aea55382eb3b6061a4fa552 100644 (file)
@@ -5,9 +5,10 @@
  * 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.eric.codec.match;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint8;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.eric.api.EricConstants;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;
@@ -17,16 +18,14 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Eric
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.MatchField;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.eric.match.rev180730.Icmpv6NdOptionsType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.eric.match.rev180730.icmpv6.nd.options.type.grouping.Icmpv6NdOptionsTypeValuesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.eric.match.rev180730.oxm.container.match.entry.value.Icmpv6NdOptionsTypeCaseValue;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.eric.match.rev180730.oxm.container.match.entry.value.Icmpv6NdOptionsTypeCaseValueBuilder;
 
 public class Icmpv6NDOptionsTypeCodec extends AbstractMatchCodec {
-
     private static final int VALUE_LENGTH = 1;
-    public static final MatchEntrySerializerKey SERIALIZER_KEY = new MatchEntrySerializerKey(
+    public static final MatchEntrySerializerKey<?, ?> SERIALIZER_KEY = new MatchEntrySerializerKey<>(
             EncodeConstants.OF13_VERSION_ID, EricExpClass.class, Icmpv6NdOptionsType.class);
     public static final MatchEntryDeserializerKey DESERIALIZER_KEY = new MatchEntryDeserializerKey(
             EncodeConstants.OF13_VERSION_ID, EricConstants.ERICOXM_OF_EXPERIMENTER_ID,
@@ -41,12 +40,13 @@ public class Icmpv6NDOptionsTypeCodec extends AbstractMatchCodec {
 
     @Override
     public MatchEntry deserialize(ByteBuf message) {
-        MatchEntryBuilder matchEntryBuilder = deserializeHeaderToBuilder(message);
-        Icmpv6NdOptionsTypeCaseValueBuilder caseBuilder = new Icmpv6NdOptionsTypeCaseValueBuilder();
-        caseBuilder.setIcmpv6NdOptionsTypeValues(new Icmpv6NdOptionsTypeValuesBuilder()
-                .setIcmpv6NdOptionsType(message.readUnsignedByte()).build());
-        matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
-        return matchEntryBuilder.build();
+        return deserializeHeaderToBuilder(message)
+                .setMatchEntryValue(new Icmpv6NdOptionsTypeCaseValueBuilder()
+                    .setIcmpv6NdOptionsTypeValues(new Icmpv6NdOptionsTypeValuesBuilder()
+                        .setIcmpv6NdOptionsType(readUint8(message))
+                        .build())
+                    .build())
+                .build();
     }
 
     @Override
@@ -73,5 +73,4 @@ public class Icmpv6NDOptionsTypeCodec extends AbstractMatchCodec {
     public Class<? extends OxmClassBase> getOxmClass() {
         return EricExpClass.class;
     }
-
 }
\ No newline at end of file
index 722a246c260af19d2139c9f79bebcf2e0155f376..0c6ab130627008fd4f9810ca8684edbc8a23e030 100644 (file)
@@ -5,9 +5,10 @@
  * 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.eric.codec.match;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.eric.api.EricConstants;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;
@@ -17,7 +18,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Eric
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.MatchField;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.eric.match.rev180730.Icmpv6NdReserved;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.eric.match.rev180730.icmpv6.nd.reserved.grouping.Icmpv6NdReservedValuesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.eric.match.rev180730.oxm.container.match.entry.value.Icmpv6NdReservedCaseValue;
@@ -26,7 +26,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.eric.match.rev
 public class Icmpv6NDReservedCodec extends AbstractMatchCodec {
 
     private static final int VALUE_LENGTH = 4;
-    public static final MatchEntrySerializerKey SERIALIZER_KEY = new MatchEntrySerializerKey(
+    public static final MatchEntrySerializerKey<?, ?> SERIALIZER_KEY = new MatchEntrySerializerKey<>(
              EncodeConstants.OF13_VERSION_ID, EricExpClass.class, Icmpv6NdReserved.class);
     public static final MatchEntryDeserializerKey DESERIALIZER_KEY = new MatchEntryDeserializerKey(
             EncodeConstants.OF13_VERSION_ID, EricConstants.ERICOXM_OF_EXPERIMENTER_ID,
@@ -35,18 +35,19 @@ public class Icmpv6NDReservedCodec extends AbstractMatchCodec {
     @Override
     public void serialize(MatchEntry input, ByteBuf outBuffer) {
         serializeHeader(input, outBuffer);
-        Icmpv6NdReservedCaseValue caseValue = ((Icmpv6NdReservedCaseValue) input.getMatchEntryValue());
+        Icmpv6NdReservedCaseValue caseValue = (Icmpv6NdReservedCaseValue) input.getMatchEntryValue();
         outBuffer.writeInt(caseValue.getIcmpv6NdReservedValues().getIcmpv6NdReserved().intValue());
     }
 
     @Override
     public MatchEntry deserialize(ByteBuf message) {
-        MatchEntryBuilder matchEntryBuilder = deserializeHeaderToBuilder(message);
-        Icmpv6NdReservedCaseValueBuilder caseBuilder = new Icmpv6NdReservedCaseValueBuilder();
-        caseBuilder.setIcmpv6NdReservedValues(new Icmpv6NdReservedValuesBuilder()
-                .setIcmpv6NdReserved(message.readUnsignedInt()).build());
-        matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
-        return matchEntryBuilder.build();
+        return deserializeHeaderToBuilder(message)
+                .setMatchEntryValue(new Icmpv6NdReservedCaseValueBuilder()
+                    .setIcmpv6NdReservedValues(new Icmpv6NdReservedValuesBuilder()
+                        .setIcmpv6NdReserved(readUint32(message))
+                        .build())
+                    .build())
+                .build();
     }
 
     @Override
@@ -73,5 +74,4 @@ public class Icmpv6NDReservedCodec extends AbstractMatchCodec {
     public Class<? extends OxmClassBase> getOxmClass() {
         return EricExpClass.class;
     }
-
 }
\ No newline at end of file
index 8da1ce15ee22d32ad2c24751ee97688ff6257ddd..9b4b1c2df14ce39ac48a5015157f5e19f4ead499 100644 (file)
             <groupId>io.netty</groupId>
             <artifactId>netty-buffer</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.opendaylight.yangtools</groupId>
+            <artifactId>yang-common-netty</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-log4j12</artifactId>
index 1545338ad68914747c2ccfc3d17955b37fde1c51..07735f5661c839e28a8bee985a731ce0676bf88e 100644 (file)
@@ -7,6 +7,10 @@
  */
 package org.opendaylight.openflowjava.nx.codec.action;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint16;
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint8;
+
 import com.google.common.net.InetAddresses;
 import io.netty.buffer.ByteBuf;
 import java.net.InetAddress;
@@ -177,10 +181,10 @@ public class ConntrackCodec extends AbstractActionCodec {
     public Action deserialize(final ByteBuf message) {
         final short length = deserializeCtHeader(message);
         NxActionConntrackBuilder nxActionConntrackBuilder = new NxActionConntrackBuilder();
-        nxActionConntrackBuilder.setFlags(message.readUnsignedShort());
-        nxActionConntrackBuilder.setZoneSrc(message.readUnsignedInt());
-        nxActionConntrackBuilder.setConntrackZone(message.readUnsignedShort());
-        nxActionConntrackBuilder.setRecircTable(message.readUnsignedByte());
+        nxActionConntrackBuilder.setFlags(readUint16(message));
+        nxActionConntrackBuilder.setZoneSrc(readUint32(message));
+        nxActionConntrackBuilder.setConntrackZone(readUint16(message));
+        nxActionConntrackBuilder.setRecircTable(readUint8(message));
         message.skipBytes(5);
 
         if  (length > CT_LENGTH) {
@@ -213,7 +217,7 @@ public class ConntrackCodec extends AbstractActionCodec {
                 processedCtActionsLength = processedCtActionsLength - length;
                 NxActionNatBuilder nxActionNatBuilder = new NxActionNatBuilder();
                 message.skipBytes(2);
-                nxActionNatBuilder.setFlags(message.readUnsignedShort());
+                nxActionNatBuilder.setFlags(readUint16(message));
 
                 int rangePresent = message.readUnsignedShort();
                 nxActionNatBuilder.setRangePresent(rangePresent);
@@ -226,10 +230,10 @@ public class ConntrackCodec extends AbstractActionCodec {
                     nxActionNatBuilder.setIpAddressMax(IpAddressBuilder.getDefaultInstance(address.getHostAddress()));
                 }
                 if (0 != (rangePresent & NxActionNatRangePresent.NXNATRANGEPROTOMIN.getIntValue())) {
-                    nxActionNatBuilder.setPortMin(message.readUnsignedShort());
+                    nxActionNatBuilder.setPortMin(readUint16(message));
                 }
                 if (0 != (rangePresent & NxActionNatRangePresent.NXNATRANGEPROTOMAX.getIntValue())) {
-                    nxActionNatBuilder.setPortMax(message.readUnsignedShort());
+                    nxActionNatBuilder.setPortMax(readUint16(message));
                 }
 
                 NxActionNatCaseBuilder caseBuilder = new NxActionNatCaseBuilder();
@@ -248,7 +252,7 @@ public class ConntrackCodec extends AbstractActionCodec {
                 deserializeCtHeaderWithoutSubtype(message);
 
                 NxActionCtMarkBuilder nxActionCtMarkBuilder = new NxActionCtMarkBuilder();
-                nxActionCtMarkBuilder.setCtMark(message.readUnsignedInt());
+                nxActionCtMarkBuilder.setCtMark(readUint32(message));
 
                 NxActionCtMarkCaseBuilder caseBuilder = new NxActionCtMarkCaseBuilder();
                 caseBuilder.setNxActionCtMark(nxActionCtMarkBuilder.build());
index f02835afb63131ee8d464b59cd58ea95d17fa2e3..1979c6f9a6c88458f812eec90cb4327ed3040f9c 100644 (file)
@@ -5,9 +5,10 @@
  * 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.nx.codec.action;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.nx.api.NiciraActionDeserializerKey;
 import org.opendaylight.openflowjava.nx.api.NiciraActionSerializerKey;
@@ -16,7 +17,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev1
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionDecap;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionDecapBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.decap.grouping.NxActionDecap;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.decap.grouping.NxActionDecapBuilder;
 
 public class DecapCodec extends AbstractActionCodec {
@@ -35,11 +35,11 @@ public class DecapCodec extends AbstractActionCodec {
         final ActionBuilder actionBuilder = deserializeHeader(message);
         // skip padding
         message.skipBytes(PADDING);
-        long packetType = message.readUnsignedInt();
-        NxActionDecap nxActionDecap = new NxActionDecapBuilder().setPacketType(packetType).build();
-        ActionDecap actionDecap = new ActionDecapBuilder().setNxActionDecap(nxActionDecap).build();
-        actionBuilder.setActionChoice(actionDecap);
-        return actionBuilder.build();
+        return actionBuilder
+                .setActionChoice(new ActionDecapBuilder()
+                    .setNxActionDecap(new NxActionDecapBuilder().setPacketType(readUint32(message)).build())
+                    .build())
+                .build();
     }
 
     @Override
index 68f87e0e8944f79ddf69b1f122cb5e777913d956..cc2801b970ca0f14595a6ad16bedc7776e663197 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.openflowjava.nx.codec.action;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.nx.api.NiciraActionDeserializerKey;
 import org.opendaylight.openflowjava.nx.api.NiciraActionSerializerKey;
@@ -34,8 +36,7 @@ public class EncapCodec extends AbstractActionCodec {
         final ActionBuilder actionBuilder = deserializeHeader(message);
         // skip header size, not used
         message.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
-        final long packetType = message.readUnsignedInt();
-        NxActionEncap nxActionEncap = new NxActionEncapBuilder().setPacketType(packetType).build();
+        NxActionEncap nxActionEncap = new NxActionEncapBuilder().setPacketType(readUint32(message)).build();
         ActionEncap actionEncap = new ActionEncapBuilder().setNxActionEncap(nxActionEncap).build();
         actionBuilder.setActionChoice(actionEncap);
         return actionBuilder.build();
index e07052231099242294b71c161808d49028b7caa0..63ae37bd1bf4db70f4b48a3bec22bc126a9f81f7 100644 (file)
@@ -5,9 +5,10 @@
  * 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.nx.codec.action;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint16;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.nx.api.NiciraActionDeserializerKey;
 import org.opendaylight.openflowjava.nx.api.NiciraActionSerializerKey;
@@ -56,15 +57,14 @@ public class FinTimeoutCodec extends AbstractActionCodec {
     public Action deserialize(final ByteBuf message) {
         final ActionBuilder actionBuilder = deserializeHeader(message);
 
-        ActionFinTimeoutBuilder builder = new ActionFinTimeoutBuilder();
-        NxActionFinTimeoutBuilder nxActionFinTimeoutBuilder = new NxActionFinTimeoutBuilder();
-        nxActionFinTimeoutBuilder.setFinIdleTimeout(message.readUnsignedShort());
-        nxActionFinTimeoutBuilder.setFinHardTimeout(message.readUnsignedShort());
-        builder.setNxActionFinTimeout(nxActionFinTimeoutBuilder.build());
+        ActionFinTimeoutBuilder builder = new ActionFinTimeoutBuilder()
+                .setNxActionFinTimeout(new NxActionFinTimeoutBuilder()
+                    .setFinIdleTimeout(readUint16(message))
+                    .setFinHardTimeout(readUint16(message))
+                    .build());
         message.skipBytes(PADDING);
 
         actionBuilder.setActionChoice(builder.build());
         return actionBuilder.build();
     }
-
 }
index d2a7b0d111f4f97418619d25a9a7dcbdf795f256..65e019e8dd4b9aae05480fa3e12f95e249bb49aa 100644 (file)
@@ -7,6 +7,10 @@
  */
 package org.opendaylight.openflowjava.nx.codec.action;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint16;
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint8;
+
 import io.netty.buffer.ByteBuf;
 import java.math.BigInteger;
 import java.util.ArrayList;
@@ -187,15 +191,15 @@ public final class LearnCodecUtil {
     */
 
     static void deserializeLearnHeader(final ByteBuf message, NxActionLearnBuilder nxActionLearnBuilder) {
-        nxActionLearnBuilder.setIdleTimeout(message.readUnsignedShort());
-        nxActionLearnBuilder.setHardTimeout(message.readUnsignedShort());
-        nxActionLearnBuilder.setPriority(message.readUnsignedShort());
+        nxActionLearnBuilder.setIdleTimeout(readUint16(message));
+        nxActionLearnBuilder.setHardTimeout(readUint16(message));
+        nxActionLearnBuilder.setPriority(readUint16(message));
         nxActionLearnBuilder.setCookie(BigInteger.valueOf(message.readLong()));
-        nxActionLearnBuilder.setFlags(message.readUnsignedShort());
-        nxActionLearnBuilder.setTableId(message.readUnsignedByte());
+        nxActionLearnBuilder.setFlags(readUint16(message));
+        nxActionLearnBuilder.setTableId(readUint8(message));
         message.skipBytes(1);
-        nxActionLearnBuilder.setFinIdleTimeout(message.readUnsignedShort());
-        nxActionLearnBuilder.setFinHardTimeout(message.readUnsignedShort());
+        nxActionLearnBuilder.setFinIdleTimeout(readUint16(message));
+        nxActionLearnBuilder.setFinHardTimeout(readUint16(message));
     }
 
     static synchronized void buildFlowModSpecs(NxActionLearnBuilder nxActionLearnBuilder, ByteBuf message,
@@ -252,9 +256,9 @@ public final class LearnCodecUtil {
 
     private static FlowMods readFlowModAddMatchFromField(ByteBuf message, short numBits) {
         FlowModAddMatchFromFieldBuilder builder = new FlowModAddMatchFromFieldBuilder();
-        builder.setSrcField(message.readUnsignedInt());
+        builder.setSrcField(readUint32(message));
         builder.setSrcOfs((int) message.readShort());
-        builder.setDstField(message.readUnsignedInt());
+        builder.setDstField(readUint32(message));
         builder.setDstOfs((int) message.readShort());
         builder.setFlowModNumBits((int) numBits);
         length -= FROM_FIELD_LENGTH - EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
@@ -268,8 +272,8 @@ public final class LearnCodecUtil {
 
     private static FlowMods readFlowModAddMatchFromValue(ByteBuf message, short numBits) {
         FlowModAddMatchFromValueBuilder builder = new FlowModAddMatchFromValueBuilder();
-        builder.setValue(message.readUnsignedShort());
-        builder.setSrcField(message.readUnsignedInt());
+        builder.setValue(readUint16(message));
+        builder.setSrcField(readUint32(message));
         builder.setSrcOfs((int) message.readShort());
         builder.setFlowModNumBits((int) numBits);
         length -= FROM_VALUE_LENGTH - EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
@@ -283,9 +287,9 @@ public final class LearnCodecUtil {
 
     private static FlowMods readFlowModCopyFromField(ByteBuf message, short numBits) {
         FlowModCopyFieldIntoFieldBuilder builder = new FlowModCopyFieldIntoFieldBuilder();
-        builder.setSrcField(message.readUnsignedInt());
+        builder.setSrcField(readUint32(message));
         builder.setSrcOfs((int) message.readShort());
-        builder.setDstField(message.readUnsignedInt());
+        builder.setDstField(readUint32(message));
         builder.setDstOfs((int) message.readShort());
         builder.setFlowModNumBits((int) numBits);
         length -= FROM_FIELD_LENGTH - EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
@@ -299,8 +303,8 @@ public final class LearnCodecUtil {
 
     private static FlowMods readFlowModCopyFromValue(ByteBuf message, short numBits) {
         FlowModCopyValueIntoFieldBuilder builder = new FlowModCopyValueIntoFieldBuilder();
-        builder.setValue(message.readUnsignedShort());
-        builder.setDstField(message.readUnsignedInt());
+        builder.setValue(readUint16(message));
+        builder.setDstField(readUint32(message));
         builder.setDstOfs((int) message.readShort());
         builder.setFlowModNumBits((int) numBits);
         length -= FROM_VALUE_LENGTH - EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
@@ -314,7 +318,7 @@ public final class LearnCodecUtil {
 
     private static FlowMods readFlowToPort(ByteBuf message, short numBits) {
         FlowModOutputToPortBuilder builder = new FlowModOutputToPortBuilder();
-        builder.setSrcField(message.readUnsignedInt());
+        builder.setSrcField(readUint32(message));
         builder.setSrcOfs((int) message.readShort());
         builder.setFlowModNumBits((int) numBits);
         length -= TO_PORT_LENGTH - EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
index 01e7e18cc25053ee0982e70a25da13285badaab7..4662aa99e9d4a418bb6f3cb8ae4c910f943cc813 100644 (file)
@@ -5,9 +5,11 @@
  * 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.nx.codec.action;
 
+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.nx.api.NiciraActionDeserializerKey;
 import org.opendaylight.openflowjava.nx.api.NiciraActionSerializerKey;
@@ -56,16 +58,16 @@ public class MultipathCodec extends AbstractActionCodec {
 
         NxActionMultipathBuilder nxActionMultipathBuilder = new NxActionMultipathBuilder();
         nxActionMultipathBuilder.setFields(OfjNxHashFields.forValue(message.readUnsignedShort()));
-        nxActionMultipathBuilder.setBasis(message.readUnsignedShort());
+        nxActionMultipathBuilder.setBasis(readUint16(message));
         message.skipBytes(2); //two bytes
 
         nxActionMultipathBuilder.setAlgorithm(OfjNxMpAlgorithm.forValue(message.readUnsignedShort()));
-        nxActionMultipathBuilder.setMaxLink(message.readUnsignedShort());
-        nxActionMultipathBuilder.setArg(message.readUnsignedInt());
+        nxActionMultipathBuilder.setMaxLink(readUint16(message));
+        nxActionMultipathBuilder.setArg(readUint32(message));
         message.skipBytes(2); //two bytes
 
-        nxActionMultipathBuilder.setOfsNbits(message.readUnsignedShort());
-        nxActionMultipathBuilder.setDst(message.readUnsignedInt());
+        nxActionMultipathBuilder.setOfsNbits(readUint16(message));
+        nxActionMultipathBuilder.setDst(readUint32(message));
         actionMultipathBuilder.setNxActionMultipath(nxActionMultipathBuilder.build());
         actionBuilder.setActionChoice(actionMultipathBuilder.build());
 
index f945bb6171f4a6622aa1553f897e4c09b380c7e5..fa5cc3061444ca7e6394d3a7d0a01f6d19b90c5f 100644 (file)
@@ -5,9 +5,10 @@
  * 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.nx.codec.action;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint16;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.nx.api.NiciraActionDeserializerKey;
 import org.opendaylight.openflowjava.nx.api.NiciraActionSerializerKey;
@@ -32,8 +33,8 @@ public class OutputReg2Codec extends AbstractActionCodec {
         final ActionBuilder actionBuilder = deserializeHeader(message);
         final ActionOutputReg2Builder builder = new ActionOutputReg2Builder();
         NxActionOutputReg2Builder nxActionOutputReg2Builder = new NxActionOutputReg2Builder();
-        nxActionOutputReg2Builder.setNBits(message.readUnsignedShort());
-        nxActionOutputReg2Builder.setMaxLen(message.readUnsignedShort());
+        nxActionOutputReg2Builder.setNBits(readUint16(message));
+        nxActionOutputReg2Builder.setMaxLen(readUint16(message));
         nxActionOutputReg2Builder.setSrc(readNxmHeader(message));
         skipPadding(message, startIndex);
         builder.setNxActionOutputReg2(nxActionOutputReg2Builder.build());
index e9634b7955453379bd5846ff1445ea65dacba33a..a10fcf026e7720a84ebc7806df444e33adc0f482 100644 (file)
@@ -7,6 +7,9 @@
  */
 package org.opendaylight.openflowjava.nx.codec.action;
 
+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.nx.api.NiciraActionDeserializerKey;
 import org.opendaylight.openflowjava.nx.api.NiciraActionSerializerKey;
@@ -46,9 +49,9 @@ public class OutputRegCodec extends AbstractActionCodec {
         final ActionBuilder actionBuilder = deserializeHeader(message);
         final ActionOutputRegBuilder builder = new ActionOutputRegBuilder();
         NxActionOutputRegBuilder nxActionOutputRegBuilder = new NxActionOutputRegBuilder();
-        nxActionOutputRegBuilder.setNBits(message.readUnsignedShort());
-        nxActionOutputRegBuilder.setSrc(message.readUnsignedInt());
-        nxActionOutputRegBuilder.setMaxLen(message.readUnsignedShort());
+        nxActionOutputRegBuilder.setNBits(readUint16(message));
+        nxActionOutputRegBuilder.setSrc(readUint32(message));
+        nxActionOutputRegBuilder.setMaxLen(readUint16(message));
         message.skipBytes(PADDING_IN_OUTPUT_REG_ACTION);
         builder.setNxActionOutputReg(nxActionOutputRegBuilder.build());
         actionBuilder.setActionChoice(builder.build());
index 7f6fce66c5b8bec183467614299ed960747d59a3..922ffbc9a5bab5a41e2d4889cd80b0df3074076f 100644 (file)
@@ -7,6 +7,9 @@
  */
 package org.opendaylight.openflowjava.nx.codec.action;
 
+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 java.math.BigInteger;
 import org.opendaylight.openflowjava.nx.api.NiciraActionDeserializerKey;
@@ -41,8 +44,8 @@ public class RegLoadCodec extends AbstractActionCodec {
         final ActionBuilder actionBuilder = deserializeHeader(message);
         NxActionRegLoadBuilder nxActionRegLoadBuilder = new NxActionRegLoadBuilder();
         final ActionRegLoadBuilder actionRegLoadBuilder = new ActionRegLoadBuilder();
-        nxActionRegLoadBuilder.setOfsNbits(message.readUnsignedShort());
-        nxActionRegLoadBuilder.setDst(message.readUnsignedInt());
+        nxActionRegLoadBuilder.setOfsNbits(readUint16(message));
+        nxActionRegLoadBuilder.setDst(readUint32(message));
         nxActionRegLoadBuilder.setValue(BigInteger.valueOf(message.readLong()));
         actionRegLoadBuilder.setNxActionRegLoad(nxActionRegLoadBuilder.build());
         actionBuilder.setActionChoice(actionRegLoadBuilder.build());
index d97ffb80bdab867363e518d7b478945f885f9a09..f00a0c6a81ccb3dd34f86f5ecd975639c4e7ed90 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.openflowjava.nx.codec.action;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint16;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.nx.api.NiciraActionDeserializerKey;
 import org.opendaylight.openflowjava.nx.api.NiciraActionSerializerKey;
@@ -44,9 +46,9 @@ public class RegMoveCodec extends AbstractActionCodec {
         final ActionBuilder actionBuilder = deserializeHeader(message);
         final ActionRegMoveBuilder actionRegMoveBuilder = new ActionRegMoveBuilder();
         NxActionRegMoveBuilder nxActionRegMoveBuilder = new NxActionRegMoveBuilder();
-        nxActionRegMoveBuilder.setNBits(message.readUnsignedShort());
-        nxActionRegMoveBuilder.setSrcOfs(message.readUnsignedShort());
-        nxActionRegMoveBuilder.setDstOfs(message.readUnsignedShort());
+        nxActionRegMoveBuilder.setNBits(readUint16(message));
+        nxActionRegMoveBuilder.setSrcOfs(readUint16(message));
+        nxActionRegMoveBuilder.setDstOfs(readUint16(message));
         nxActionRegMoveBuilder.setSrc(readNxmHeader(message));
         nxActionRegMoveBuilder.setDst(readNxmHeader(message));
         skipPadding(message, startIndex);
index ade0947bc74a7238cc781f44112754d220dfa805..cb8ef1726751060d6ab2f6e8b28624a995f3b125 100644 (file)
@@ -5,9 +5,11 @@
  * 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.nx.codec.action;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint16;
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint8;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.nx.api.NiciraActionDeserializerKey;
 import org.opendaylight.openflowjava.nx.api.NiciraActionSerializerKey;
@@ -68,11 +70,11 @@ public class ResubmitCodec extends AbstractActionCodec {
     public Action deserialize(final ByteBuf message) {
         final ActionBuilder actionBuilder = deserializeHeader(message);
 
-        ActionResubmitBuilder builder = new ActionResubmitBuilder();
-        NxActionResubmitBuilder nxActionResubmitBuilder = new NxActionResubmitBuilder();
-        nxActionResubmitBuilder.setInPort(message.readUnsignedShort());
-        nxActionResubmitBuilder.setTable(message.readUnsignedByte());
-        builder.setNxActionResubmit(nxActionResubmitBuilder.build());
+        ActionResubmitBuilder builder = new ActionResubmitBuilder()
+                .setNxActionResubmit(new NxActionResubmitBuilder()
+                    .setInPort(readUint16(message))
+                    .setTable(readUint8(message))
+                    .build());
         message.skipBytes(PADDING);
 
         actionBuilder.setActionChoice(builder.build());
index 8b571edd8e732dbbc062a3856d747462e0837f12..ad068b2f8b928191a9732bf3ba15af6b453489a6 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.openflowjava.nx.codec.match;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.nx.api.NiciraConstants;
 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
@@ -30,8 +32,8 @@ public abstract class AbstractNshcCodec extends AbstractExperimenterMatchCodec {
 
     @Override
     protected NxExpMatchEntryValue deserializeValue(ByteBuf message, boolean hasMask) {
-        Long nshc = message.readUnsignedInt();
-        Long mask = hasMask ? message.readUnsignedInt() : null;
+        Uint32 nshc = readUint32(message);
+        Uint32 mask = hasMask ? readUint32(message) : null;
         return new NshcCaseValueBuilder().setNshc(nshc).setMask(mask).build();
     }
 
index 5d3156d289b4576e2659cfee89e703d685d4ed1e..062b3dab7922d0faa9c4a572b82f49d817cd7c71 100644 (file)
@@ -5,9 +5,10 @@
  * 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.nx.codec.match;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm1Class;
@@ -25,10 +26,10 @@ public abstract class AbstractRegCodec extends AbstractMatchCodec {
     public MatchEntry deserialize(ByteBuf message) {
         final MatchEntryBuilder matchEntriesBuilder = deserializeHeaderToBuilder(message);
         final RegValuesBuilder regValuesBuilder = new RegValuesBuilder();
-        regValuesBuilder.setValue(message.readUnsignedInt());
+        regValuesBuilder.setValue(readUint32(message));
 
         if (matchEntriesBuilder.isHasMask()) {
-            regValuesBuilder.setMask(message.readUnsignedInt());
+            regValuesBuilder.setMask(readUint32(message));
         }
 
         return matchEntriesBuilder
@@ -41,7 +42,7 @@ public abstract class AbstractRegCodec extends AbstractMatchCodec {
     @Override
     public void serialize(MatchEntry input, ByteBuf outBuffer) {
         serializeHeader(input, outBuffer);
-        final RegCaseValue regCase = ((RegCaseValue) input.getMatchEntryValue());
+        final RegCaseValue regCase = (RegCaseValue) input.getMatchEntryValue();
         outBuffer.writeInt(regCase.getRegValues().getValue().intValue());
 
         if (input.isHasMask()) {
index 5a4120254cc058165ddb246428d02b9b250aae8a..f747a74a1a05c7f495fc8903d956002d336cf663 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.openflowjava.nx.codec.match;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint16;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;
@@ -16,7 +18,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Matc
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm0Class;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmOfArpOp;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.of.match.arp.op.grouping.ArpOpValuesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.ArpOpCaseValue;
@@ -33,17 +34,17 @@ public class ArpOpCodec extends AbstractMatchCodec {
     @Override
     public void serialize(MatchEntry input, ByteBuf outBuffer) {
         serializeHeader(input, outBuffer);
-        ArpOpCaseValue arpOpCase = ((ArpOpCaseValue) input.getMatchEntryValue());
+        ArpOpCaseValue arpOpCase = (ArpOpCaseValue) input.getMatchEntryValue();
         outBuffer.writeShort(arpOpCase.getArpOpValues().getValue().toJava());
     }
 
     @Override
     public MatchEntry deserialize(ByteBuf message) {
-        MatchEntryBuilder matchEntryBuilder = deserializeHeaderToBuilder(message);
-        ArpOpCaseValueBuilder caseBuilder = new ArpOpCaseValueBuilder();
-        caseBuilder.setArpOpValues(new ArpOpValuesBuilder().setValue(message.readUnsignedShort()).build());
-        matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
-        return matchEntryBuilder.build();
+        return deserializeHeaderToBuilder(message)
+                .setMatchEntryValue(new ArpOpCaseValueBuilder()
+                    .setArpOpValues(new ArpOpValuesBuilder().setValue(readUint16(message)).build())
+                    .build())
+                .build();
     }
 
     @Override
index af9f8cffac4eff0afe1d1b65763a464354407e87..d4e9069af5fe5cbba2f4188d2a4645795f58ec07 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.openflowjava.nx.codec.match;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;
@@ -16,7 +18,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Matc
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm0Class;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmOfArpSpa;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.of.match.arp.spa.grouping.ArpSpaValuesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.ArpSpaCaseValue;
@@ -33,17 +34,17 @@ public class ArpSpaCodec extends AbstractMatchCodec {
     @Override
     public void serialize(MatchEntry input, ByteBuf outBuffer) {
         serializeHeader(input, outBuffer);
-        ArpSpaCaseValue arpSpaCase = ((ArpSpaCaseValue) input.getMatchEntryValue());
+        ArpSpaCaseValue arpSpaCase = (ArpSpaCaseValue) input.getMatchEntryValue();
         outBuffer.writeInt(arpSpaCase.getArpSpaValues().getValue().intValue());
     }
 
     @Override
     public MatchEntry deserialize(ByteBuf message) {
-        MatchEntryBuilder matchEntryBuilder = deserializeHeaderToBuilder(message);
-        ArpSpaCaseValueBuilder caseBuilder = new ArpSpaCaseValueBuilder();
-        caseBuilder.setArpSpaValues(new ArpSpaValuesBuilder().setValue(message.readUnsignedInt()).build());
-        matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
-        return matchEntryBuilder.build();
+        return deserializeHeaderToBuilder(message)
+                .setMatchEntryValue(new ArpSpaCaseValueBuilder()
+                    .setArpSpaValues(new ArpSpaValuesBuilder().setValue(readUint32(message)).build())
+                    .build())
+                .build();
     }
 
     @Override
index cf5eecfa57690779e5cf8a8ce1cac9d0dd39b8a2..e47f34676a9f197b472efbe1c7dea0e8161b22e7 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.openflowjava.nx.codec.match;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;
@@ -16,7 +18,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Matc
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm0Class;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmOfArpTpa;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.of.match.arp.tpa.grouping.ArpTpaValuesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.ArpTpaCaseValue;
@@ -33,17 +34,17 @@ public class ArpTpaCodec extends AbstractMatchCodec {
     @Override
     public void serialize(MatchEntry input, ByteBuf outBuffer) {
         serializeHeader(input, outBuffer);
-        ArpTpaCaseValue arpTpaCase = ((ArpTpaCaseValue) input.getMatchEntryValue());
+        ArpTpaCaseValue arpTpaCase = (ArpTpaCaseValue) input.getMatchEntryValue();
         outBuffer.writeInt(arpTpaCase.getArpTpaValues().getValue().intValue());
     }
 
     @Override
     public MatchEntry deserialize(ByteBuf message) {
-        MatchEntryBuilder matchEntriesBuilder = deserializeHeaderToBuilder(message);
-        ArpTpaCaseValueBuilder caseBuilder = new ArpTpaCaseValueBuilder();
-        caseBuilder.setArpTpaValues(new ArpTpaValuesBuilder().setValue(message.readUnsignedInt()).build());
-        matchEntriesBuilder.setMatchEntryValue(caseBuilder.build());
-        return matchEntriesBuilder.build();
+        return deserializeHeaderToBuilder(message)
+                .setMatchEntryValue(new ArpTpaCaseValueBuilder()
+                    .setArpTpaValues(new ArpTpaValuesBuilder().setValue(readUint32(message)).build())
+                    .build())
+                .build();
     }
 
     @Override
index 012ba76667115e1da0c3388ffd5abc8eb5af2fac..b318f186d1bab2141158b7f2f0a6ddb260d94b5f 100755 (executable)
@@ -5,9 +5,10 @@
  * 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.nx.codec.match;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;
@@ -51,9 +52,9 @@ public class CtMarkCodec extends AbstractMatchCodec {
         CtMarkCaseValueBuilder caseBuilder = new CtMarkCaseValueBuilder();
         CtMarkValuesBuilder ctMarkValuesBuilder = new CtMarkValuesBuilder();
         if (matchEntryBuilder.isHasMask()) {
-            ctMarkValuesBuilder.setMask(message.readUnsignedInt());
+            ctMarkValuesBuilder.setMask(readUint32(message));
         }
-        ctMarkValuesBuilder.setCtMark(message.readUnsignedInt());
+        ctMarkValuesBuilder.setCtMark(readUint32(message));
         caseBuilder.setCtMarkValues(ctMarkValuesBuilder.build());
         matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
         return matchEntryBuilder.build();
@@ -83,5 +84,4 @@ public class CtMarkCodec extends AbstractMatchCodec {
     public Class<? extends OxmClassBase> getOxmClass() {
         return Nxm1Class.class;
     }
-
 }
index 4b8b26dea63ab40da5985ed12f06e6c4ead797a1..1508e58027e5191b2a23d73c3dff62faa69e01f6 100644 (file)
@@ -5,9 +5,10 @@
  * 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.nx.codec.match;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;
@@ -17,7 +18,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Matc
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm1Class;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxCtState;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.ct.state.grouping.CtStateValuesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.CtStateCaseValue;
@@ -47,15 +47,15 @@ public class CtStateCodec extends AbstractMatchCodec {
 
     @Override
     public MatchEntry deserialize(ByteBuf message) {
-        final MatchEntryBuilder matchEntryBuilder = deserializeHeaderToBuilder(message);
-        CtStateCaseValueBuilder caseBuilder = new CtStateCaseValueBuilder();
-        CtStateValuesBuilder ctStateValuesBuilder = new CtStateValuesBuilder();
-        ctStateValuesBuilder.setCtState(message.readUnsignedInt());
-        ctStateValuesBuilder.setMask(message.readUnsignedInt());
-        caseBuilder.setCtStateValues(ctStateValuesBuilder.build());
-        matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
-        matchEntryBuilder.setHasMask(true);
-        return matchEntryBuilder.build();
+        return deserializeHeaderToBuilder(message)
+                .setHasMask(true)
+                .setMatchEntryValue(new CtStateCaseValueBuilder()
+                    .setCtStateValues(new CtStateValuesBuilder()
+                        .setCtState(readUint32(message))
+                        .setMask(readUint32(message))
+                        .build())
+                    .build())
+                .build();
     }
 
     @Override
@@ -82,5 +82,4 @@ public class CtStateCodec extends AbstractMatchCodec {
     public Class<? extends OxmClassBase> getOxmClass() {
         return Nxm1Class.class;
     }
-
 }
index 0e4dd1b386878840d839c87a559bc8b06a56d6ac..f401244a768259731641027b4d890add17baba37 100644 (file)
@@ -5,9 +5,10 @@
  * 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.nx.codec.match;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint16;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;
@@ -17,7 +18,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Matc
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm1Class;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxCtTpDst;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.ct.tp.dst.grouping.CtTpDstValuesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.CtTpDstCaseValue;
@@ -41,13 +41,11 @@ public class CtTpDstCodec extends AbstractMatchCodec {
 
     @Override
     public MatchEntry deserialize(ByteBuf message) {
-        final MatchEntryBuilder matchEntryBuilder = deserializeHeaderToBuilder(message);
-        CtTpDstCaseValueBuilder ctTpSrcCaseValueBuilder = new CtTpDstCaseValueBuilder();
-        CtTpDstValuesBuilder ctTpSrcValuesBuilder = new CtTpDstValuesBuilder();
-        ctTpSrcValuesBuilder.setCtTpDst(message.readUnsignedShort());
-        ctTpSrcCaseValueBuilder.setCtTpDstValues(ctTpSrcValuesBuilder.build());
-        matchEntryBuilder.setMatchEntryValue(ctTpSrcCaseValueBuilder.build());
-        return matchEntryBuilder.build();
+        return deserializeHeaderToBuilder(message)
+                .setMatchEntryValue(new CtTpDstCaseValueBuilder()
+                    .setCtTpDstValues(new CtTpDstValuesBuilder().setCtTpDst(readUint16(message)).build())
+                    .build())
+                .build();
     }
 
     @Override
index 3e710fb54c34c79ecf8dd3ad67d7a6423ae1c414..2a15df91cb20379e02207a656b0b421171507d4e 100644 (file)
@@ -5,9 +5,10 @@
  * 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.nx.codec.match;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint16;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;
@@ -17,7 +18,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Matc
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm1Class;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxCtTpSrc;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.ct.tp.src.grouping.CtTpSrcValuesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.CtTpSrcCaseValue;
@@ -41,13 +41,11 @@ public class CtTpSrcCodec extends AbstractMatchCodec {
 
     @Override
     public MatchEntry deserialize(ByteBuf message) {
-        final MatchEntryBuilder matchEntryBuilder = deserializeHeaderToBuilder(message);
-        CtTpSrcCaseValueBuilder ctTpSrcCaseValueBuilder = new CtTpSrcCaseValueBuilder();
-        CtTpSrcValuesBuilder ctTpSrcValuesBuilder = new CtTpSrcValuesBuilder();
-        ctTpSrcValuesBuilder.setCtTpSrc(message.readUnsignedShort());
-        ctTpSrcCaseValueBuilder.setCtTpSrcValues(ctTpSrcValuesBuilder.build());
-        matchEntryBuilder.setMatchEntryValue(ctTpSrcCaseValueBuilder.build());
-        return matchEntryBuilder.build();
+        return deserializeHeaderToBuilder(message)
+                .setMatchEntryValue(new CtTpSrcCaseValueBuilder()
+                    .setCtTpSrcValues(new CtTpSrcValuesBuilder().setCtTpSrc(readUint16(message)).build())
+                    .build())
+                .build();
     }
 
     @Override
index 729d8d22db016a578c0fe9e1544a17f916807d3f..cb452331f932a81a8ec999bb15a239a6cca0ee2a 100644 (file)
@@ -5,9 +5,10 @@
  * 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.nx.codec.match;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint16;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;
@@ -17,7 +18,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Matc
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm1Class;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxCtZone;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.ct.zone.grouping.CtZoneValuesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.CtZoneCaseValue;
@@ -46,13 +46,11 @@ public class CtZoneCodec extends AbstractMatchCodec {
 
     @Override
     public MatchEntry deserialize(ByteBuf message) {
-        MatchEntryBuilder matchEntryBuilder = deserializeHeaderToBuilder(message);
-        CtZoneCaseValueBuilder caseBuilder = new CtZoneCaseValueBuilder();
-        CtZoneValuesBuilder ctZoneValuesBuilder = new CtZoneValuesBuilder();
-        ctZoneValuesBuilder.setCtZone(message.readUnsignedShort());
-        caseBuilder.setCtZoneValues(ctZoneValuesBuilder.build());
-        matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
-        return matchEntryBuilder.build();
+        return deserializeHeaderToBuilder(message)
+                .setMatchEntryValue(new CtZoneCaseValueBuilder()
+                    .setCtZoneValues(new CtZoneValuesBuilder().setCtZone(readUint16(message)).build())
+                    .build())
+                .build();
     }
 
     @Override
@@ -79,5 +77,4 @@ public class CtZoneCodec extends AbstractMatchCodec {
     public Class<? extends OxmClassBase> getOxmClass() {
         return Nxm1Class.class;
     }
-
 }
index c29da7592d9809e90819551dcf359356c3d530d4..d5b6494a0a34c3702d3d2667060545c56d16ca36 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.openflowjava.nx.codec.match;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint16;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;
@@ -16,7 +18,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Matc
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm0Class;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmOfEthType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.of.match.eth.type.grouping.EthTypeValuesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.EthTypeCaseValue;
@@ -39,13 +40,11 @@ public class EthTypeCodec extends AbstractMatchCodec {
 
     @Override
     public MatchEntry deserialize(ByteBuf message) {
-        MatchEntryBuilder matchEntryBuilder = deserializeHeaderToBuilder(message);
-        EthTypeCaseValueBuilder caseBuilder = new EthTypeCaseValueBuilder();
-        EthTypeValuesBuilder valuesBuilder = new EthTypeValuesBuilder();
-        valuesBuilder.setValue(message.readUnsignedShort()).build();
-        caseBuilder.setEthTypeValues(valuesBuilder.build());
-        matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
-        return matchEntryBuilder.build();
+        return deserializeHeaderToBuilder(message)
+                .setMatchEntryValue(new EthTypeCaseValueBuilder()
+                    .setEthTypeValues(new EthTypeValuesBuilder().setValue(readUint16(message)).build())
+                    .build())
+                .build();
     }
 
     @Override
index c405cbfd22c5db3545fa73503519906bab30c46b..d52e7ef1e21c7dcbc5e9d2fca681464fd3ac01be 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.openflowjava.nx.codec.match;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint8;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;
@@ -16,7 +18,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Matc
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm0Class;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmOfIcmpType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.of.match.icmp.type.grouping.IcmpTypeValuesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.IcmpTypeCaseValue;
@@ -37,13 +38,12 @@ public class IcmpTypeCodec extends AbstractMatchCodec {
 
     @Override
     public MatchEntry deserialize(ByteBuf message) {
-        MatchEntryBuilder matchEntriesBuilder = deserializeHeaderToBuilder(message);
-        IcmpTypeCaseValueBuilder icmpTypeCaseValueBuilder = new IcmpTypeCaseValueBuilder();
-        icmpTypeCaseValueBuilder.setIcmpTypeValues(new IcmpTypeValuesBuilder()
-                .setValue(message.readUnsignedByte()).build());
-        matchEntriesBuilder.setMatchEntryValue(icmpTypeCaseValueBuilder.build());
-        matchEntriesBuilder.setHasMask(false);
-        return matchEntriesBuilder.build();
+        return deserializeHeaderToBuilder(message)
+                .setMatchEntryValue(new IcmpTypeCaseValueBuilder()
+                    .setIcmpTypeValues(new IcmpTypeValuesBuilder().setValue(readUint8(message)).build())
+                    .build())
+                .setHasMask(false)
+                .build();
     }
 
     @Override
index e5b9483e99092c9bae581640147f20f3176902a5..a6e164b1fbad8a7f2adb2ed1c847d24694d8f79f 100644 (file)
@@ -16,7 +16,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Matc
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm0Class;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmOfInPort;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.of.in.port.type.grouping.NxmOfInPortValuesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.OfInPortCaseValue;
@@ -44,13 +43,11 @@ public class InPortCodec extends AbstractMatchCodec {
 
     @Override
     public MatchEntry deserialize(ByteBuf message) {
-        MatchEntryBuilder matchEntryBuilder = deserializeHeaderToBuilder(message);
-        OfInPortCaseValueBuilder caseBuilder = new OfInPortCaseValueBuilder();
-        NxmOfInPortValuesBuilder valuesBuilder = new NxmOfInPortValuesBuilder();
-        valuesBuilder.setValue(message.readInt()).build();
-        caseBuilder.setNxmOfInPortValues(valuesBuilder.build());
-        matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
-        return matchEntryBuilder.build();
+        return deserializeHeaderToBuilder(message)
+                .setMatchEntryValue(new OfInPortCaseValueBuilder()
+                    .setNxmOfInPortValues(new NxmOfInPortValuesBuilder().setValue(message.readInt()).build())
+                    .build())
+                .build();
     }
 
     @Override
index 4f60c526d7f97a64a31ef0032c0e0404a9b8c114..4e72293734910eebf1eab0e5a4bcb2c1e76f607d 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.openflowjava.nx.codec.match;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;
@@ -16,7 +18,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Matc
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm0Class;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmOfIpDst;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.of.match.ip.dst.grouping.IpDstValuesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.IpDstCaseValue;
@@ -36,14 +37,13 @@ public class IpDstCodec extends AbstractMatchCodec {
     public static final MatchEntryDeserializerKey DESERIALIZER_KEY = new MatchEntryDeserializerKey(
             EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_0_CLASS, NXM_FIELD_CODE);
 
-
     @Override
     public MatchEntry deserialize(ByteBuf message) {
-        MatchEntryBuilder matchEntriesBuilder = deserializeHeaderToBuilder(message);
-        IpDstCaseValueBuilder caseBuilder = new IpDstCaseValueBuilder();
-        caseBuilder.setIpDstValues(new IpDstValuesBuilder().setValue(message.readUnsignedInt()).build());
-        matchEntriesBuilder.setMatchEntryValue(caseBuilder.build());
-        return matchEntriesBuilder.build();
+        return deserializeHeaderToBuilder(message)
+                .setMatchEntryValue(new IpDstCaseValueBuilder()
+                    .setIpDstValues(new IpDstValuesBuilder().setValue(readUint32(message)).build())
+                    .build())
+                .build();
     }
 
     @Override
index 6e5cf893ff266d919ddc6b00f1c21f98b92c372d..1aae00a60e2638099818b6a02ce9f6cf8dcff21a 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.openflowjava.nx.codec.match;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;
@@ -16,7 +18,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Matc
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm0Class;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmOfIpSrc;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.of.match.ip.src.grouping.IpSrcValuesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.IpSrcCaseValue;
@@ -39,11 +40,11 @@ public class IpSrcCodec extends AbstractMatchCodec {
 
     @Override
     public MatchEntry deserialize(ByteBuf message) {
-        MatchEntryBuilder matchEntriesBuilder = deserializeHeaderToBuilder(message);
-        IpSrcCaseValueBuilder caseBuilder = new IpSrcCaseValueBuilder();
-        caseBuilder.setIpSrcValues(new IpSrcValuesBuilder().setValue(message.readUnsignedInt()).build());
-        matchEntriesBuilder.setMatchEntryValue(caseBuilder.build());
-        return matchEntriesBuilder.build();
+        return deserializeHeaderToBuilder(message)
+                .setMatchEntryValue(new IpSrcCaseValueBuilder()
+                    .setIpSrcValues(new IpSrcValuesBuilder().setValue(readUint32(message)).build())
+                    .build())
+                .build();
     }
 
     @Override
index 40957be303b579ef951e8228597fe9e9f8f489f7..7e20b3ad8b513e88e3e97d97eeb3c78beed2aa0f 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.openflowjava.nx.codec.match;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;
@@ -16,7 +18,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Matc
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm1Class;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmOfIpDst;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.of.match.ip.dst.grouping.IpDstValuesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.IpDstCaseValue;
@@ -39,11 +40,11 @@ public class Ipv6DstCodec extends AbstractMatchCodec {
 
     @Override
     public MatchEntry deserialize(ByteBuf message) {
-        MatchEntryBuilder matchEntriesBuilder = deserializeHeaderToBuilder(message);
-        IpDstCaseValueBuilder caseBuilder = new IpDstCaseValueBuilder();
-        caseBuilder.setIpDstValues(new IpDstValuesBuilder().setValue(message.readUnsignedInt()).build());
-        matchEntriesBuilder.setMatchEntryValue(caseBuilder.build());
-        return matchEntriesBuilder.build();
+        return deserializeHeaderToBuilder(message)
+                .setMatchEntryValue(new IpDstCaseValueBuilder()
+                    .setIpDstValues(new IpDstValuesBuilder().setValue(readUint32(message)).build())
+                    .build())
+                .build();
     }
 
     @Override
index 761065cf0e6e08121e725556b9576e2eaba28ff0..b98cc75a90fc44f12a8795c50ce99c9cf5f042ce 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.openflowjava.nx.codec.match;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;
@@ -16,7 +18,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Matc
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm1Class;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmOfIpSrc;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.of.match.ip.src.grouping.IpSrcValuesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.IpSrcCaseValue;
@@ -39,11 +40,11 @@ public class Ipv6SrcCodec extends AbstractMatchCodec {
 
     @Override
     public MatchEntry deserialize(ByteBuf message) {
-        MatchEntryBuilder matchEntriesBuilder = deserializeHeaderToBuilder(message);
-        IpSrcCaseValueBuilder caseBuilder = new IpSrcCaseValueBuilder();
-        caseBuilder.setIpSrcValues(new IpSrcValuesBuilder().setValue(message.readUnsignedInt()).build());
-        matchEntriesBuilder.setMatchEntryValue(caseBuilder.build());
-        return matchEntriesBuilder.build();
+        return deserializeHeaderToBuilder(message)
+                .setMatchEntryValue(new IpSrcCaseValueBuilder()
+                    .setIpSrcValues(new IpSrcValuesBuilder().setValue(readUint32(message)).build())
+                    .build())
+                .build();
     }
 
     @Override
index 719b70141cb0a6a843e36ba00f4aac57afb3f2ef..7fb4772b41e6944434c1c95b4ea7b6de4da66099 100644 (file)
@@ -8,6 +8,8 @@
 
 package org.opendaylight.openflowjava.nx.codec.match;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint8;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.nx.api.NiciraConstants;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;
@@ -22,6 +24,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev14
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.experimenter.id._case.nx.exp.match.entry.value.NshFlagsCaseValue;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.experimenter.id._case.nx.exp.match.entry.value.NshFlagsCaseValueBuilder;
 import org.opendaylight.yangtools.yang.common.Uint32;
+import org.opendaylight.yangtools.yang.common.Uint8;
 
 public class NshFlagsCodec extends AbstractExperimenterMatchCodec {
 
@@ -55,10 +58,11 @@ public class NshFlagsCodec extends AbstractExperimenterMatchCodec {
 
     @Override
     protected NxExpMatchEntryValue deserializeValue(ByteBuf message, boolean hasMask) {
-        Short flagsValue = message.readUnsignedByte();
-        Short maskValue = hasMask ? message.readUnsignedByte() : null;
-        NshFlagsValues flagsValues = new NshFlagsValuesBuilder().setNshFlags(flagsValue).setMask(maskValue).build();
-        return new NshFlagsCaseValueBuilder().setNshFlagsValues(flagsValues).build();
+        Uint8 flagsValue = readUint8(message);
+        Uint8 maskValue = hasMask ? readUint8(message) : null;
+        return new NshFlagsCaseValueBuilder()
+                .setNshFlagsValues(new NshFlagsValuesBuilder().setNshFlags(flagsValue).setMask(maskValue).build())
+                .build();
     }
 
     @Override
index 2471846e1871a09d24e7df09ce387e2e68c43961..1d0594deb96bb2738830859e656b578b261988b6 100644 (file)
@@ -5,9 +5,10 @@
  * 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.nx.codec.match;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint8;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.nx.api.NiciraConstants;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;
@@ -47,9 +48,9 @@ public class NshMdtypeCodec extends AbstractExperimenterMatchCodec {
 
     @Override
     protected NxExpMatchEntryValue deserializeValue(ByteBuf message, boolean hasMask) {
-        Short value = message.readUnsignedByte();
-        NshMdtypeValues nshMdtypeValues = new NshMdtypeValuesBuilder().setValue(value).build();
-        return new NshMdtypeCaseValueBuilder().setNshMdtypeValues(nshMdtypeValues).build();
+        return new NshMdtypeCaseValueBuilder()
+                .setNshMdtypeValues(new NshMdtypeValuesBuilder().setValue(readUint8(message)).build())
+                .build();
     }
 
     @Override
index c21df1d9963bc22d35869b6bf8e1529e2fb4377b..e7ce6ca1a3a025185689aab67580c26e83f461f7 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.openflowjava.nx.codec.match;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint8;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.nx.api.NiciraConstants;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;
@@ -46,9 +48,9 @@ public class NshNpCodec extends AbstractExperimenterMatchCodec {
 
     @Override
     protected NxExpMatchEntryValue deserializeValue(ByteBuf message, boolean hasMask) {
-        Short value = message.readUnsignedByte();
-        NshNpValues nshNpValues = new NshNpValuesBuilder().setValue(value).build();
-        return new NshNpCaseValueBuilder().setNshNpValues(nshNpValues).build();
+        return new NshNpCaseValueBuilder()
+                .setNshNpValues(new NshNpValuesBuilder().setValue(readUint8(message)).build())
+                .build();
     }
 
     @Override
index df047cc05e0d04db9a68da7ea0dd8041cc6ba9bf..de4393c2bd863f666f2491bd0af8d112d48851e3 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.openflowjava.nx.codec.match;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint8;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.nx.api.NiciraConstants;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;
@@ -21,6 +23,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev14
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.experimenter.id._case.nx.exp.match.entry.value.NsiCaseValue;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.experimenter.id._case.nx.exp.match.entry.value.NsiCaseValueBuilder;
 import org.opendaylight.yangtools.yang.common.Uint32;
+import org.opendaylight.yangtools.yang.common.Uint8;
 
 public class NsiCodec extends AbstractExperimenterMatchCodec {
 
@@ -49,8 +52,8 @@ public class NsiCodec extends AbstractExperimenterMatchCodec {
 
     @Override
     protected NxExpMatchEntryValue deserializeValue(final ByteBuf message, final boolean hasMask) {
-        Short value = message.readUnsignedByte();
-        Short mask = hasMask ? message.readUnsignedByte() : null;
+        Uint8 value = readUint8(message);
+        Uint8 mask = hasMask ? readUint8(message) : null;
         NsiValues nsiValues = new NsiValuesBuilder().setNsi(value).setMask(mask).build();
         return new NsiCaseValueBuilder().setNsiValues(nsiValues).build();
     }
index ba7353cbf9547555f0c1363c55a1503426a3e81c..759dc4ad55ff811fde1e8c09c6d8360ac732d0bb 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.openflowjava.nx.codec.match;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.nx.api.NiciraConstants;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;
@@ -49,10 +51,11 @@ public class NspCodec extends AbstractExperimenterMatchCodec {
 
     @Override
     protected NxExpMatchEntryValue deserializeValue(ByteBuf message, boolean hasMask) {
-        Long nspValue = message.readUnsignedInt();
-        Long maskValue = hasMask ? message.readUnsignedInt() : null;
-        NspValues nspValues = new NspValuesBuilder().setNsp(nspValue).setMask(maskValue).build();
-        return new NspCaseValueBuilder().setNspValues(nspValues).build();
+        Uint32 nspValue = readUint32(message);
+        Uint32 maskValue = hasMask ? readUint32(message) : null;
+        return new NspCaseValueBuilder()
+                .setNspValues(new NspValuesBuilder().setNsp(nspValue).setMask(maskValue).build())
+                .build();
     }
 
     @Override
index 99183724accff6ac00b51df35bb9c9e8d4f23b9c..0692bb05361169d5c724908b6de933f3b42a30b4 100644 (file)
@@ -5,9 +5,10 @@
  * 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.nx.codec.match;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;
@@ -17,7 +18,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Matc
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm1Class;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxPktMark;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.pkt.mark.grouping.PktMarkValuesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.PktMarkCaseValue;
@@ -42,13 +42,11 @@ public class PktMarkCodec extends AbstractMatchCodec {
 
     @Override
     public MatchEntry deserialize(ByteBuf message) {
-        final MatchEntryBuilder matchEntryBuilder = deserializeHeaderToBuilder(message);
-        PktMarkCaseValueBuilder pktMarkCaseValueBuilder = new PktMarkCaseValueBuilder();
-        PktMarkValuesBuilder pktMarkValuesBuilder = new PktMarkValuesBuilder();
-        pktMarkValuesBuilder.setPktMark(message.readUnsignedInt());
-        pktMarkCaseValueBuilder.setPktMarkValues(pktMarkValuesBuilder.build());
-        matchEntryBuilder.setMatchEntryValue(pktMarkCaseValueBuilder.build());
-        return matchEntryBuilder.build();
+        return deserializeHeaderToBuilder(message)
+                .setMatchEntryValue(new PktMarkCaseValueBuilder()
+                    .setPktMarkValues(new PktMarkValuesBuilder().setPktMark(readUint32(message)).build())
+                    .build())
+                .build();
     }
 
     @Override
index 4254304fa8cc16bbefa511a016027d6b0c6a2d85..f9202f51cd7ae7f075757d17ff0211e042fcd22c 100644 (file)
@@ -17,11 +17,11 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Matc
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm0Class;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmOfTcpDst;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.of.match.tcp.dst.grouping.TcpDstValuesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TcpDstCaseValue;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TcpDstCaseValueBuilder;
+import org.opendaylight.yangtools.yang.common.netty.ByteBufUtils;
 
 /**
  * Codec for the TcpDst message.
@@ -47,17 +47,15 @@ public class TcpDstCodec extends AbstractMatchCodec {
 
     @Override
     public MatchEntry deserialize(final ByteBuf message) {
-        MatchEntryBuilder matchEntryBuilder = deserializeHeaderToBuilder(message);
-        matchEntryBuilder.setHasMask(true);
-        int portNo = message.readUnsignedShort();
-        int mask = message.readUnsignedShort();
-        TcpDstCaseValueBuilder caseBuilder = new TcpDstCaseValueBuilder();
-        TcpDstValuesBuilder tcpDstValuesBuilder = new TcpDstValuesBuilder();
-        tcpDstValuesBuilder.setPort(new PortNumber(portNo));
-        tcpDstValuesBuilder.setMask(mask);
-        caseBuilder.setTcpDstValues(tcpDstValuesBuilder.build());
-        matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
-        return matchEntryBuilder.build();
+        return deserializeHeaderToBuilder(message)
+                .setHasMask(true)
+                .setMatchEntryValue(new TcpDstCaseValueBuilder()
+                    .setTcpDstValues(new TcpDstValuesBuilder()
+                        .setPort(new PortNumber(ByteBufUtils.readUint16(message)))
+                        .setMask(ByteBufUtils.readUint16(message))
+                        .build())
+                    .build())
+                .build();
     }
 
     @Override
index 8914d711261fdb4b0ea10ad5ac15c271df0d8521..0ac34ab066d48e06f44f11286934e581f2fb8041 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.openflowjava.nx.codec.match;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint16;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;
@@ -17,7 +19,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Matc
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm0Class;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmOfTcpSrc;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.of.match.tcp.src.grouping.TcpSrcValuesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TcpSrcCaseValue;
@@ -47,17 +48,15 @@ public class TcpSrcCodec extends AbstractMatchCodec {
 
     @Override
     public MatchEntry deserialize(ByteBuf message) {
-        MatchEntryBuilder matchEntryBuilder = deserializeHeaderToBuilder(message);
-        matchEntryBuilder.setHasMask(true);
-        int portNo = message.readUnsignedShort();
-        int mask = message.readUnsignedShort();
-        TcpSrcCaseValueBuilder caseBuilder = new TcpSrcCaseValueBuilder();
-        TcpSrcValuesBuilder tcpSrcValuesBuilder = new TcpSrcValuesBuilder();
-        tcpSrcValuesBuilder.setPort(new PortNumber(portNo));
-        tcpSrcValuesBuilder.setMask(mask);
-        caseBuilder.setTcpSrcValues(tcpSrcValuesBuilder.build());
-        matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
-        return matchEntryBuilder.build();
+        return deserializeHeaderToBuilder(message)
+                .setHasMask(true)
+                .setMatchEntryValue(new TcpSrcCaseValueBuilder()
+                    .setTcpSrcValues(new TcpSrcValuesBuilder()
+                        .setPort(new PortNumber(readUint16(message)))
+                        .setMask(readUint16(message))
+                        .build())
+                    .build())
+                .build();
     }
 
     @Override
index d1b4a3d4e70fd446cb22ffb95d0b41e39ec11907..90c8af24b4fcdb76ff07b27fab634e7f19689a8d 100644 (file)
@@ -5,9 +5,10 @@
  * 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.nx.codec.match;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;
@@ -17,7 +18,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Matc
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm1Class;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxTunIpv4Dst;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.tun.ipv4.dst.grouping.TunIpv4DstValuesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TunIpv4DstCaseValue;
@@ -41,13 +41,11 @@ public class TunIpv4DstCodec extends AbstractMatchCodec {
 
     @Override
     public MatchEntry deserialize(ByteBuf message) {
-        MatchEntryBuilder matchEntriesBuilder = deserializeHeaderToBuilder(message);
-        TunIpv4DstCaseValueBuilder caseBuilder = new TunIpv4DstCaseValueBuilder();
-        TunIpv4DstValuesBuilder valuesBuilder = new TunIpv4DstValuesBuilder();
-        valuesBuilder.setValue(message.readUnsignedInt());
-        caseBuilder.setTunIpv4DstValues(valuesBuilder.build());
-        matchEntriesBuilder.setMatchEntryValue(caseBuilder.build());
-        return matchEntriesBuilder.build();
+        return deserializeHeaderToBuilder(message)
+                .setMatchEntryValue(new TunIpv4DstCaseValueBuilder()
+                    .setTunIpv4DstValues(new TunIpv4DstValuesBuilder().setValue(readUint32(message)).build())
+                    .build())
+                .build();
     }
 
     @Override
index 166f675f4418bc6a2011512d504aadb2355deccb..a1b6877ebc312bdc44e0e8a5710329de275ab7b1 100644 (file)
@@ -5,9 +5,10 @@
  * 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.nx.codec.match;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;
@@ -17,7 +18,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Matc
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm1Class;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxTunIpv4Src;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.tun.ipv4.src.grouping.TunIpv4SrcValuesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TunIpv4SrcCaseValue;
@@ -41,13 +41,11 @@ public class TunIpv4SrcCodec extends AbstractMatchCodec {
 
     @Override
     public MatchEntry deserialize(ByteBuf message) {
-        MatchEntryBuilder matchEntriesBuilder = deserializeHeaderToBuilder(message);
-        TunIpv4SrcCaseValueBuilder caseBuilder = new TunIpv4SrcCaseValueBuilder();
-        TunIpv4SrcValuesBuilder valuesBuilder = new TunIpv4SrcValuesBuilder();
-        valuesBuilder.setValue(message.readUnsignedInt());
-        caseBuilder.setTunIpv4SrcValues(valuesBuilder.build());
-        matchEntriesBuilder.setMatchEntryValue(caseBuilder.build());
-        return matchEntriesBuilder.build();
+        return deserializeHeaderToBuilder(message)
+                .setMatchEntryValue(new TunIpv4SrcCaseValueBuilder()
+                    .setTunIpv4SrcValues(new TunIpv4SrcValuesBuilder().setValue(readUint32(message)).build())
+                    .build())
+                .build();
     }
 
     @Override
index 8174e18ee619a407c0addde12b6a7d6207226980..ec732adf3e7246670bbbd690079275d78cf86a4c 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.openflowjava.nx.codec.match;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint16;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;
@@ -17,7 +19,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Matc
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm0Class;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmOfUdpDst;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.of.match.udp.dst.grouping.UdpDstValuesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.UdpDstCaseValue;
@@ -47,17 +48,15 @@ public class UdpDstCodec extends AbstractMatchCodec {
 
     @Override
     public MatchEntry deserialize(ByteBuf message) {
-        MatchEntryBuilder matchEntryBuilder = deserializeHeaderToBuilder(message);
-        matchEntryBuilder.setHasMask(true);
-        int portNo = message.readUnsignedShort();
-        int mask = message.readUnsignedShort();
-        UdpDstCaseValueBuilder caseBuilder = new UdpDstCaseValueBuilder();
-        UdpDstValuesBuilder udpDstValuesBuilder = new UdpDstValuesBuilder();
-        udpDstValuesBuilder.setPort(new PortNumber(portNo));
-        udpDstValuesBuilder.setMask(mask);
-        caseBuilder.setUdpDstValues(udpDstValuesBuilder.build());
-        matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
-        return matchEntryBuilder.build();
+        return deserializeHeaderToBuilder(message)
+                .setHasMask(true)
+                .setMatchEntryValue(new UdpDstCaseValueBuilder()
+                    .setUdpDstValues(new UdpDstValuesBuilder()
+                        .setPort(new PortNumber(readUint16(message)))
+                        .setMask(readUint16(message))
+                        .build())
+                    .build())
+                .build();
     }
 
     @Override
index 21870f877d3e038d90bf35b35f9fe7b08299c8d4..da0f41790b840f0c5f836d128604d9cb62d71cd3 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.openflowjava.nx.codec.match;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint16;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;
@@ -17,7 +19,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Matc
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm0Class;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmOfUdpSrc;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.of.match.udp.src.grouping.UdpSrcValuesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.UdpSrcCaseValue;
@@ -47,17 +48,15 @@ public class UdpSrcCodec extends AbstractMatchCodec {
 
     @Override
     public MatchEntry deserialize(ByteBuf message) {
-        MatchEntryBuilder matchEntryBuilder = deserializeHeaderToBuilder(message);
-        matchEntryBuilder.setHasMask(true);
-        int portNo = message.readUnsignedShort();
-        int mask = message.readUnsignedShort();
-        UdpSrcCaseValueBuilder caseBuilder = new UdpSrcCaseValueBuilder();
-        UdpSrcValuesBuilder udpSrcValuesBuilder = new UdpSrcValuesBuilder();
-        udpSrcValuesBuilder.setPort(new PortNumber(portNo));
-        udpSrcValuesBuilder.setMask(mask);
-        caseBuilder.setUdpSrcValues(udpSrcValuesBuilder.build());
-        matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
-        return matchEntryBuilder.build();
+        return deserializeHeaderToBuilder(message)
+                .setHasMask(true)
+                .setMatchEntryValue(new UdpSrcCaseValueBuilder()
+                    .setUdpSrcValues(new UdpSrcValuesBuilder()
+                        .setPort(new PortNumber(readUint16(message)))
+                        .setMask(readUint16(message))
+                        .build())
+                    .build())
+                .build();
     }
 
     @Override
index bd9a9ed34613ca2d838e3ca21f0692503a0cd27e..28ab9676b596a5b05430c7d02e816c942369d9f5 100644 (file)
             <groupId>org.opendaylight.infrautils</groupId>
             <artifactId>diagstatus-api</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.opendaylight.yangtools</groupId>
+            <artifactId>yang-common-netty</artifactId>
+        </dependency>
         <dependency>
             <groupId>io.netty</groupId>
             <artifactId>netty-transport-native-epoll</artifactId>
index abbfc4072746e6276dec326d0cb14dee4b971684..969cff2f4d15809b5167475547d40e14d22fbf85 100644 (file)
@@ -5,9 +5,11 @@
  * 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.action;
 
+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.util.EncodeConstants;
 import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
@@ -26,24 +28,20 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev13
  * @author michal.polkorab
  */
 public class OF10EnqueueActionDeserializer extends AbstractActionDeserializer {
-
     @Override
     public Action deserialize(ByteBuf input) {
-        final ActionBuilder builder = new ActionBuilder();
         input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
-        final EnqueueCaseBuilder caseBuilder = new EnqueueCaseBuilder();
         EnqueueActionBuilder actionBuilder = new EnqueueActionBuilder();
-        actionBuilder.setPort(new PortNumber((long) input.readUnsignedShort()));
+        actionBuilder.setPort(new PortNumber(readUint16(input).toUint32()));
         input.skipBytes(ActionConstants.PADDING_IN_ENQUEUE_ACTION);
-        actionBuilder.setQueueId(new QueueId(input.readUnsignedInt()));
-        caseBuilder.setEnqueueAction(actionBuilder.build());
-        builder.setActionChoice(caseBuilder.build());
-        return builder.build();
+        actionBuilder.setQueueId(new QueueId(readUint32(input)));
+        return new ActionBuilder()
+                .setActionChoice(new EnqueueCaseBuilder().setEnqueueAction(actionBuilder.build()).build())
+                .build();
     }
 
     @Override
     protected ActionChoice getType() {
         return new OutputActionCaseBuilder().build();
     }
-
 }
index f4eb99286f6a7af118b5e9b732b0d2e834c757eb..81e764779652674d0a46fc80eb19ced74b6f76de 100644 (file)
@@ -5,9 +5,10 @@
  * 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.action;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint16;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.ActionChoice;
@@ -23,15 +24,14 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev13
  * @author michal.polkorab
  */
 public class OF10OutputActionDeserializer extends AbstractActionDeserializer {
-
     @Override
     public Action deserialize(ByteBuf input) {
         final ActionBuilder builder = new ActionBuilder();
         input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
         OutputActionCaseBuilder caseBuilder = new OutputActionCaseBuilder();
         OutputActionBuilder actionBuilder = new OutputActionBuilder();
-        actionBuilder.setPort(new PortNumber((long) input.readUnsignedShort()));
-        actionBuilder.setMaxLength(input.readUnsignedShort());
+        actionBuilder.setPort(new PortNumber(readUint16(input).toUint32()));
+        actionBuilder.setMaxLength(readUint16(input));
         caseBuilder.setOutputAction(actionBuilder.build());
         builder.setActionChoice(caseBuilder.build());
         return builder.build();
@@ -41,5 +41,4 @@ public class OF10OutputActionDeserializer extends AbstractActionDeserializer {
     protected ActionChoice getType() {
         return new OutputActionCaseBuilder().build();
     }
-
 }
index 6e0c0ac329d4e4e858d75d727b652f8e9a4d133d..be0554b2d81307227113a2c6f44e44e56b17ad38 100644 (file)
@@ -5,9 +5,10 @@
  * 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.action;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint8;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
 import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
@@ -23,14 +24,13 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev1
  * @author michal.polkorab
  */
 public class OF10SetNwTosActionDeserializer extends AbstractActionDeserializer {
-
     @Override
     public Action deserialize(ByteBuf input) {
         final ActionBuilder builder = new ActionBuilder();
         input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
         SetNwTosCaseBuilder caseBuilder = new SetNwTosCaseBuilder();
         SetNwTosActionBuilder tosBuilder = new SetNwTosActionBuilder();
-        tosBuilder.setNwTos(input.readUnsignedByte());
+        tosBuilder.setNwTos(readUint8(input));
         caseBuilder.setSetNwTosAction(tosBuilder.build());
         builder.setActionChoice(caseBuilder.build());
         input.skipBytes(ActionConstants.PADDING_IN_SET_NW_TOS_ACTION);
@@ -41,5 +41,4 @@ public class OF10SetNwTosActionDeserializer extends AbstractActionDeserializer {
     protected ActionChoice getType() {
         return new SetNwTosCaseBuilder().build();
     }
-
 }
index 65c2ac5083df8c39118650b97a3b7d46d088d088..91d8bf0f81cc48cef14bab75d74a084932e3368f 100644 (file)
@@ -5,9 +5,10 @@
  * 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.action;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint16;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
 import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
@@ -24,14 +25,13 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev13
  * @author michal.polkorab
  */
 public class OF10SetTpDstActionDeserializer extends AbstractActionDeserializer {
-
     @Override
     public Action deserialize(ByteBuf input) {
         final ActionBuilder builder = new ActionBuilder();
         input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
         SetTpDstCaseBuilder caseBuilder = new SetTpDstCaseBuilder();
         SetTpDstActionBuilder actionBuilder = new SetTpDstActionBuilder();
-        actionBuilder.setPort(new PortNumber((long) input.readUnsignedShort()));
+        actionBuilder.setPort(new PortNumber(readUint16(input).toUint32()));
         caseBuilder.setSetTpDstAction(actionBuilder.build());
         builder.setActionChoice(caseBuilder.build());
         input.skipBytes(ActionConstants.PADDING_IN_TP_PORT_ACTION);
@@ -42,5 +42,4 @@ public class OF10SetTpDstActionDeserializer extends AbstractActionDeserializer {
     protected ActionChoice getType() {
         return new SetTpDstCaseBuilder().build();
     }
-
 }
index 210016d73e7a22f2b2abd8ebf211c7138c45cf9a..95139c92a31b52d63736da554d9e670bf516b23e 100644 (file)
@@ -5,9 +5,10 @@
  * 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.action;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint16;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
 import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
@@ -24,14 +25,13 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev13
  * @author michal.polkorab
  */
 public class OF10SetTpSrcActionDeserializer extends AbstractActionDeserializer {
-
     @Override
     public Action deserialize(ByteBuf input) {
         final ActionBuilder builder = new ActionBuilder();
         input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
         SetTpSrcCaseBuilder caseBuilder = new SetTpSrcCaseBuilder();
         SetTpSrcActionBuilder actionBuilder = new SetTpSrcActionBuilder();
-        actionBuilder.setPort(new PortNumber((long) input.readUnsignedShort()));
+        actionBuilder.setPort(new PortNumber(readUint16(input).toUint32()));
         caseBuilder.setSetTpSrcAction(actionBuilder.build());
         builder.setActionChoice(caseBuilder.build());
         input.skipBytes(ActionConstants.PADDING_IN_TP_PORT_ACTION);
index ed2e8c0bb732a69a8ef45a5afd70ed6ac34b0c27..15a3bcc691e4725950184d2a5747bc737d79816e 100644 (file)
@@ -5,9 +5,10 @@
  * 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.action;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint8;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
 import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
@@ -23,7 +24,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev1
  * @author michal.polkorab
  */
 public class OF10SetVlanPcpActionDeserializer extends AbstractActionDeserializer {
-
     @Override
     public Action deserialize(ByteBuf input) {
         final org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping
@@ -31,7 +31,7 @@ public class OF10SetVlanPcpActionDeserializer extends AbstractActionDeserializer
         input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
         SetVlanPcpCaseBuilder caseBuilder = new SetVlanPcpCaseBuilder();
         SetVlanPcpActionBuilder actionBuilder = new SetVlanPcpActionBuilder();
-        actionBuilder.setVlanPcp(input.readUnsignedByte());
+        actionBuilder.setVlanPcp(readUint8(input));
         caseBuilder.setSetVlanPcpAction(actionBuilder.build());
         builder.setActionChoice(caseBuilder.build());
         input.skipBytes(ActionConstants.PADDING_IN_SET_VLAN_PCP_ACTION);
@@ -42,5 +42,4 @@ public class OF10SetVlanPcpActionDeserializer extends AbstractActionDeserializer
     protected ActionChoice getType() {
         return new SetVlanPcpCaseBuilder().build();
     }
-
 }
index 3bf0810265206f14e1264c10a4c839c0f245bb2e..223cbaee94fe20445e8abbb28dc57035eef73fea 100644 (file)
@@ -5,9 +5,10 @@
  * 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.action;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint16;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
 import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
@@ -26,14 +27,11 @@ public class OF10SetVlanVidActionDeserializer extends AbstractActionDeserializer
 
     @Override
     public Action deserialize(ByteBuf input) {
-        final org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping
-            .ActionBuilder builder = new ActionBuilder();
         input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
-        SetVlanVidCaseBuilder caseBuilder = new SetVlanVidCaseBuilder();
-        SetVlanVidActionBuilder actionBuilder = new SetVlanVidActionBuilder();
-        actionBuilder.setVlanVid(input.readUnsignedShort());
-        caseBuilder.setSetVlanVidAction(actionBuilder.build());
-        builder.setActionChoice(caseBuilder.build());
+        final ActionBuilder builder = new ActionBuilder()
+                .setActionChoice(new SetVlanVidCaseBuilder()
+                    .setSetVlanVidAction(new SetVlanVidActionBuilder().setVlanVid(readUint16(input)).build())
+                    .build());
         input.skipBytes(ActionConstants.PADDING_IN_SET_VLAN_VID_ACTION);
         return builder.build();
     }
index 9f9683882d7821505a2136f371398fac012c937b..be361a02df430ffa5207c463ac94cd418ec232e3 100644 (file)
@@ -5,9 +5,10 @@
  * 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.action;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.ActionChoice;
@@ -22,23 +23,18 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev1
  * @author michal.polkorab
  */
 public class OF13GroupActionDeserializer extends AbstractActionDeserializer {
-
     @Override
     public Action deserialize(ByteBuf input) {
-        final org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping
-            .ActionBuilder builder = new ActionBuilder();
         input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
-        GroupCaseBuilder caseBuilder = new GroupCaseBuilder();
-        GroupActionBuilder actionBuilder = new GroupActionBuilder();
-        actionBuilder.setGroupId(input.readUnsignedInt());
-        caseBuilder.setGroupAction(actionBuilder.build());
-        builder.setActionChoice(caseBuilder.build());
-        return builder.build();
+        return new ActionBuilder()
+                .setActionChoice(new GroupCaseBuilder()
+                    .setGroupAction(new GroupActionBuilder().setGroupId(readUint32(input)).build())
+                    .build())
+                .build();
     }
 
     @Override
     protected ActionChoice getType() {
         return new GroupCaseBuilder().build();
     }
-
 }
index 4f41f4b1359b3c28ee1a9c019acc99bb80cafe0b..4d57adc980e1f9608e93a1259af6c8c37d471329 100644 (file)
@@ -5,9 +5,11 @@
  * 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.action;
 
+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.util.EncodeConstants;
 import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
@@ -24,7 +26,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev13
  * @author michal.polkorab
  */
 public class OF13OutputActionDeserializer extends AbstractActionDeserializer {
-
     @Override
     public Action deserialize(ByteBuf input) {
         final org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping
@@ -32,8 +33,8 @@ public class OF13OutputActionDeserializer extends AbstractActionDeserializer {
         input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
         OutputActionCaseBuilder caseBuilder = new OutputActionCaseBuilder();
         OutputActionBuilder actionBuilder = new OutputActionBuilder();
-        actionBuilder.setPort(new PortNumber(input.readUnsignedInt()));
-        actionBuilder.setMaxLength(input.readUnsignedShort());
+        actionBuilder.setPort(new PortNumber(readUint32(input)));
+        actionBuilder.setMaxLength(readUint16(input));
         caseBuilder.setOutputAction(actionBuilder.build());
         builder.setActionChoice(caseBuilder.build());
         input.skipBytes(ActionConstants.OUTPUT_PADDING);
@@ -44,5 +45,4 @@ public class OF13OutputActionDeserializer extends AbstractActionDeserializer {
     protected ActionChoice getType() {
         return new OutputActionCaseBuilder().build();
     }
-
 }
index c414de406ea658fad1f116540ca875085ae48241..f4c15c7d6b0634e9c0dfa6a87014e623b152897e 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.openflowjava.protocol.impl.deserialization.action;
 
 import io.netty.buffer.ByteBuf;
@@ -17,6 +16,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev1
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.EtherType;
+import org.opendaylight.yangtools.yang.common.netty.ByteBufUtils;
 
 /**
  * OF13PopMplsActionDeserializer.
@@ -24,16 +24,15 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev13
  * @author michal.polkorab
  */
 public class OF13PopMplsActionDeserializer extends AbstractActionDeserializer {
-
     @Override
     public Action deserialize(ByteBuf input) {
-        final ActionBuilder builder = new ActionBuilder();
         input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
-        PopMplsCaseBuilder caseBuilder = new PopMplsCaseBuilder();
-        PopMplsActionBuilder mplsBuilder = new PopMplsActionBuilder();
-        mplsBuilder.setEthertype(new EtherType(input.readUnsignedShort()));
-        caseBuilder.setPopMplsAction(mplsBuilder.build());
-        builder.setActionChoice(caseBuilder.build());
+        final ActionBuilder builder = new ActionBuilder()
+                .setActionChoice(new PopMplsCaseBuilder()
+                    .setPopMplsAction(new PopMplsActionBuilder()
+                        .setEthertype(new EtherType(ByteBufUtils.readUint16(input)))
+                        .build())
+                    .build());
         input.skipBytes(ActionConstants.ETHERTYPE_ACTION_PADDING);
         return builder.build();
     }
@@ -42,5 +41,4 @@ public class OF13PopMplsActionDeserializer extends AbstractActionDeserializer {
     protected ActionChoice getType() {
         return new PopMplsCaseBuilder().build();
     }
-
 }
index 681f65ed78b6d612c131d08f9341623a1db0dfad..abd1284b88e32568a8580b3333ffc744516d4da7 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.openflowjava.protocol.impl.deserialization.action;
 
 import io.netty.buffer.ByteBuf;
@@ -17,6 +16,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev1
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.EtherType;
+import org.opendaylight.yangtools.yang.common.netty.ByteBufUtils;
 
 /**
  * OF13PushMplsActionDeserializer.
@@ -31,7 +31,7 @@ public class OF13PushMplsActionDeserializer extends AbstractActionDeserializer {
         input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
         PushMplsCaseBuilder caseBuilder = new PushMplsCaseBuilder();
         PushMplsActionBuilder mplsBuilder = new PushMplsActionBuilder();
-        mplsBuilder.setEthertype(new EtherType(input.readUnsignedShort()));
+        mplsBuilder.setEthertype(new EtherType(ByteBufUtils.readUint16(input)));
         caseBuilder.setPushMplsAction(mplsBuilder.build());
         builder.setActionChoice(caseBuilder.build());
         input.skipBytes(ActionConstants.ETHERTYPE_ACTION_PADDING);
@@ -42,5 +42,4 @@ public class OF13PushMplsActionDeserializer extends AbstractActionDeserializer {
     protected ActionChoice getType() {
         return new PushMplsCaseBuilder().build();
     }
-
 }
index 01ed3bf9affffa1733030cb37150edc3cb81bf8f..33c81495807f323aafcf5f6daec256ec9436ff3e 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.openflowjava.protocol.impl.deserialization.action;
 
 import io.netty.buffer.ByteBuf;
@@ -17,6 +16,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev1
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.EtherType;
+import org.opendaylight.yangtools.yang.common.netty.ByteBufUtils;
 
 /**
  * OF13PushPbbActionDeserializer.
@@ -24,16 +24,15 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev13
  * @author michal.polkorab
  */
 public class OF13PushPbbActionDeserializer extends AbstractActionDeserializer {
-
     @Override
     public Action deserialize(ByteBuf input) {
-        final ActionBuilder builder = new ActionBuilder();
         input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
-        PushPbbCaseBuilder caseBuilder = new PushPbbCaseBuilder();
-        PushPbbActionBuilder pbbBuilder = new PushPbbActionBuilder();
-        pbbBuilder.setEthertype(new EtherType(input.readUnsignedShort()));
-        caseBuilder.setPushPbbAction(pbbBuilder.build());
-        builder.setActionChoice(caseBuilder.build());
+        final ActionBuilder builder = new ActionBuilder()
+                .setActionChoice(new PushPbbCaseBuilder()
+                    .setPushPbbAction(new PushPbbActionBuilder()
+                        .setEthertype(new EtherType(ByteBufUtils.readUint16(input)))
+                        .build())
+                    .build());
         input.skipBytes(ActionConstants.ETHERTYPE_ACTION_PADDING);
         return builder.build();
     }
@@ -42,5 +41,4 @@ public class OF13PushPbbActionDeserializer extends AbstractActionDeserializer {
     protected ActionChoice getType() {
         return new PushPbbCaseBuilder().build();
     }
-
 }
index 63792a5b97781f959694c154cbdc763ac9e82f72..f7ad0c92dcf533672f9853099cb4bc7788f27c41 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.openflowjava.protocol.impl.deserialization.action;
 
 import io.netty.buffer.ByteBuf;
@@ -17,6 +16,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev1
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.EtherType;
+import org.opendaylight.yangtools.yang.common.netty.ByteBufUtils;
 
 /**
  * OF13PushVlanActionDeserializer.
@@ -24,16 +24,15 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev13
  * @author michal.polkorab
  */
 public class OF13PushVlanActionDeserializer extends AbstractActionDeserializer {
-
     @Override
     public Action deserialize(ByteBuf input) {
-        final ActionBuilder builder = new ActionBuilder();
         input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
-        PushVlanCaseBuilder caseBuilder = new PushVlanCaseBuilder();
-        PushVlanActionBuilder vlanBuilder = new PushVlanActionBuilder();
-        vlanBuilder.setEthertype(new EtherType(input.readUnsignedShort()));
-        caseBuilder.setPushVlanAction(vlanBuilder.build());
-        builder.setActionChoice(caseBuilder.build());
+        final ActionBuilder builder = new ActionBuilder()
+                .setActionChoice(new PushVlanCaseBuilder()
+                    .setPushVlanAction(new PushVlanActionBuilder()
+                        .setEthertype(new EtherType(ByteBufUtils.readUint16(input)))
+                        .build())
+                    .build());
         input.skipBytes(ActionConstants.ETHERTYPE_ACTION_PADDING);
         return builder.build();
     }
@@ -42,5 +41,4 @@ public class OF13PushVlanActionDeserializer extends AbstractActionDeserializer {
     protected ActionChoice getType() {
         return new PushVlanCaseBuilder().build();
     }
-
 }
index f833bd9cee35a1e274f99d44ae9ef10503ea4143..150d58a5f99a4ced0c5463622b76da553d009257 100644 (file)
@@ -5,9 +5,10 @@
  * 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.action;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint8;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
 import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
@@ -23,14 +24,13 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev1
  * @author michal.polkorab
  */
 public class OF13SetMplsTtlActionDeserializer extends AbstractActionDeserializer {
-
     @Override
     public Action deserialize(ByteBuf input) {
         final ActionBuilder builder = new ActionBuilder();
         input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
         SetMplsTtlCaseBuilder caseBuilder = new SetMplsTtlCaseBuilder();
         SetMplsTtlActionBuilder actionBuilder = new SetMplsTtlActionBuilder();
-        actionBuilder.setMplsTtl(input.readUnsignedByte());
+        actionBuilder.setMplsTtl(readUint8(input));
         caseBuilder.setSetMplsTtlAction(actionBuilder.build());
         builder.setActionChoice(caseBuilder.build());
         input.skipBytes(ActionConstants.SET_MPLS_TTL_PADDING);
@@ -41,5 +41,4 @@ public class OF13SetMplsTtlActionDeserializer extends AbstractActionDeserializer
     protected ActionChoice getType() {
         return new SetMplsTtlCaseBuilder().build();
     }
-
 }
index 028be4d4bf3f36003a497c3026c37cade634dfe2..ac6408dd1730ba6e9497bb647521bbbeff72c0f8 100644 (file)
@@ -5,9 +5,10 @@
  * 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.action;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint8;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
 import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
@@ -23,14 +24,13 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev1
  * @author michal.polkorab
  */
 public class OF13SetNwTtlActionDeserializer extends AbstractActionDeserializer {
-
     @Override
     public Action deserialize(ByteBuf input) {
         final ActionBuilder builder = new ActionBuilder();
         input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
         SetNwTtlCaseBuilder caseBuilder = new SetNwTtlCaseBuilder();
         SetNwTtlActionBuilder actionBuilder = new SetNwTtlActionBuilder();
-        actionBuilder.setNwTtl(input.readUnsignedByte());
+        actionBuilder.setNwTtl(readUint8(input));
         caseBuilder.setSetNwTtlAction(actionBuilder.build());
         builder.setActionChoice(caseBuilder.build());
         input.skipBytes(ActionConstants.SET_NW_TTL_PADDING);
@@ -41,5 +41,4 @@ public class OF13SetNwTtlActionDeserializer extends AbstractActionDeserializer {
     protected ActionChoice getType() {
         return new SetNwTtlCaseBuilder().build();
     }
-
 }
index 797a2723b72ed41322a9396b1b82a94675a9d818..915296250c7c6c5221302e3ea15a6c8cb20cfad0 100644 (file)
@@ -5,9 +5,10 @@
  * 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.action;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.ActionChoice;
@@ -22,14 +23,13 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev1
  * @author michal.polkorab
  */
 public class OF13SetQueueActionDeserializer extends AbstractActionDeserializer {
-
     @Override
     public Action deserialize(ByteBuf input) {
         final ActionBuilder builder = new ActionBuilder();
         input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
         SetQueueCaseBuilder caseBuilder = new SetQueueCaseBuilder();
         SetQueueActionBuilder actionBuilder = new SetQueueActionBuilder();
-        actionBuilder.setQueueId(input.readUnsignedInt());
+        actionBuilder.setQueueId(readUint32(input));
         caseBuilder.setSetQueueAction(actionBuilder.build());
         builder.setActionChoice(caseBuilder.build());
         return builder.build();
@@ -39,5 +39,4 @@ public class OF13SetQueueActionDeserializer extends AbstractActionDeserializer {
     protected ActionChoice getType() {
         return new SetQueueCaseBuilder().build();
     }
-
 }
index 254a9ea79330c1393c16aee58aafdf8fdf07dc43..04878ac6492865ebbb5768cd228c1d56838b1a81 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
 
+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.impl.util.VersionAssignableFactory;
@@ -22,10 +24,9 @@ public class BarrierInputMessageFactory extends VersionAssignableFactory impleme
 
     @Override
     public BarrierInput deserialize(ByteBuf rawMessage) {
-        BarrierInputBuilder builder = new BarrierInputBuilder();
-        builder.setVersion(getVersion());
-        builder.setXid(rawMessage.readUnsignedInt());
-        return builder.build();
+        return new BarrierInputBuilder()
+                .setVersion(getVersion())
+                .setXid(readUint32(rawMessage))
+                .build();
     }
-
 }
index 4d5cf784bb66a63dfc05cbe3eeee2dfee3e11644..0945f0b00e32b9936f305e3ff14c2d736fb1a974 100644 (file)
@@ -8,6 +8,8 @@
 
 package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
 
+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.impl.util.VersionAssignableFactory;
@@ -24,9 +26,9 @@ public class BarrierReplyMessageFactory extends VersionAssignableFactory impleme
 
     @Override
     public BarrierOutput deserialize(ByteBuf rawMessage) {
-        BarrierOutputBuilder builder = new BarrierOutputBuilder();
-        builder.setVersion(getVersion());
-        builder.setXid(rawMessage.readUnsignedInt());
-        return builder.build();
+        return new BarrierOutputBuilder()
+                .setVersion(getVersion())
+                .setXid(readUint32(rawMessage))
+                .build();
     }
 }
index 217071fb160708fb03a84f62efd6dbc87f2c538f..c8aa2369aa22beba60a8f27d3c94483046d18a19 100644 (file)
@@ -8,6 +8,8 @@
 
 package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
 
+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.impl.util.VersionAssignableFactory;
@@ -26,7 +28,7 @@ public class EchoReplyMessageFactory extends VersionAssignableFactory implements
     public EchoOutput deserialize(ByteBuf rawMessage) {
         EchoOutputBuilder builder = new EchoOutputBuilder();
         builder.setVersion(getVersion());
-        builder.setXid(rawMessage.readUnsignedInt());
+        builder.setXid(readUint32(rawMessage));
         int remainingBytes = rawMessage.readableBytes();
         if (remainingBytes > 0) {
             byte[] data = new byte[remainingBytes];
index ef253977cafede7fc8277ecc2070439a9702dff2..3df9e6049dae542f6dcc64a39ae60cb0a8e790fc 100644 (file)
@@ -8,6 +8,8 @@
 
 package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
 
+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.impl.util.VersionAssignableFactory;
@@ -26,7 +28,7 @@ public class EchoRequestMessageFactory extends VersionAssignableFactory implemen
     public EchoRequestMessage deserialize(ByteBuf rawMessage) {
         EchoRequestMessageBuilder builder = new EchoRequestMessageBuilder();
         builder.setVersion(getVersion());
-        builder.setXid(rawMessage.readUnsignedInt());
+        builder.setXid(readUint32(rawMessage));
         byte[] data = new byte[rawMessage.readableBytes()];
         rawMessage.readBytes(data);
         builder.setData(data);
index b46c46f56628399fc1e82167b5d1176af1421ea4..0024ed34e41b04cf5864dcd05e07cd5fc2cebed3 100644 (file)
@@ -8,6 +8,8 @@
 
 package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import io.netty.buffer.ByteBuf;
 import java.util.Objects;
@@ -55,7 +57,7 @@ public class ErrorMessageFactory implements OFDeserializer<ErrorMessage>,
         int startIndex = rawMessage.readerIndex();
         ErrorMessageBuilder builder = new ErrorMessageBuilder();
         builder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
-        builder.setXid(rawMessage.readUnsignedInt());
+        builder.setXid(readUint32(rawMessage));
         int type = rawMessage.readUnsignedShort();
         ErrorType errorType = ErrorType.forValue(type);
         if (ErrorType.EXPERIMENTER.equals(errorType)) {
index 13995727f8beb123deba0f5d5991a5ddd9669352..4f6c94372b56a38858c0c9cfd44a53dcdb648be7 100644 (file)
@@ -5,9 +5,10 @@
  * 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;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import io.netty.buffer.ByteBuf;
 import java.util.Objects;
@@ -20,6 +21,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev13
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessageBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.experimenter.core.ExperimenterDataOfChoice;
+import org.opendaylight.yangtools.yang.common.Uint32;
 
 /**
  * Implementation of OFDeserializer for ExperimenterMessages.
@@ -36,7 +38,7 @@ public class ExperimenterMessageFactory implements OFDeserializer<ExperimenterMe
     public ExperimenterMessage deserialize(ByteBuf message) {
         Objects.requireNonNull(deserializerRegistry);
 
-        final long xid = message.readUnsignedInt();
+        final Uint32 xid = readUint32(message);
         final long expId = message.readUnsignedInt();
         final long expType = message.readUnsignedInt();
 
index 0fbe33d8b3bfa36f06d9376334659a35848e2e7f..a91b0e449df31b68dcb39e0d06ba258ee0e542ca 100644 (file)
@@ -5,11 +5,13 @@
  * 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;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint64;
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint8;
+
 import io.netty.buffer.ByteBuf;
-import java.math.BigInteger;
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Capabilities;
@@ -30,16 +32,14 @@ public class FeaturesReplyMessageFactory implements OFDeserializer<GetFeaturesOu
     public GetFeaturesOutput deserialize(ByteBuf rawMessage) {
         GetFeaturesOutputBuilder builder = new GetFeaturesOutputBuilder();
         builder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
-        builder.setXid(rawMessage.readUnsignedInt());
-        byte[] datapathId = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-        rawMessage.readBytes(datapathId);
-        builder.setDatapathId(new BigInteger(1, datapathId));
-        builder.setBuffers(rawMessage.readUnsignedInt());
-        builder.setTables(rawMessage.readUnsignedByte());
-        builder.setAuxiliaryId(rawMessage.readUnsignedByte());
+        builder.setXid(readUint32(rawMessage));
+        builder.setDatapathId(readUint64(rawMessage));
+        builder.setBuffers(readUint32(rawMessage));
+        builder.setTables(readUint8(rawMessage));
+        builder.setAuxiliaryId(readUint8(rawMessage));
         rawMessage.skipBytes(PADDING_IN_FEATURES_REPLY_HEADER);
         builder.setCapabilities(createCapabilities(rawMessage.readUnsignedInt()));
-        builder.setReserved(rawMessage.readUnsignedInt());
+        builder.setReserved(readUint32(rawMessage));
         return builder.build();
     }
 
index ad553ce50af9b655d4a4b5646b292d11515a4f2f..642975e49d3fea18516c3463e8f9b1603c0a28db 100644 (file)
@@ -7,9 +7,13 @@
  */
 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 static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint64;
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint8;
+
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import io.netty.buffer.ByteBuf;
-import java.math.BigInteger;
 import java.util.List;
 import java.util.Objects;
 import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
@@ -44,21 +48,17 @@ public class FlowModInputMessageFactory implements OFDeserializer<FlowModInput>,
 
         FlowModInputBuilder builder = new FlowModInputBuilder();
         builder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
-        builder.setXid(rawMessage.readUnsignedInt());
-        byte[] cookie = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-        rawMessage.readBytes(cookie);
-        builder.setCookie(new BigInteger(1, cookie));
-        final byte[] cookieMask = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-        rawMessage.readBytes(cookieMask);
-        builder.setCookieMask(new BigInteger(1, cookieMask));
-        builder.setTableId(new TableId((long) rawMessage.readUnsignedByte()));
+        builder.setXid(readUint32(rawMessage));
+        builder.setCookie(readUint64(rawMessage));
+        builder.setCookieMask(readUint64(rawMessage));
+        builder.setTableId(new TableId(readUint8(rawMessage).toUint32()));
         builder.setCommand(FlowModCommand.forValue(rawMessage.readUnsignedByte()));
-        builder.setIdleTimeout(rawMessage.readUnsignedShort());
-        builder.setHardTimeout(rawMessage.readUnsignedShort());
-        builder.setPriority(rawMessage.readUnsignedShort());
-        builder.setBufferId(rawMessage.readUnsignedInt());
-        builder.setOutPort(new PortNumber(rawMessage.readUnsignedInt()));
-        builder.setOutGroup(rawMessage.readUnsignedInt());
+        builder.setIdleTimeout(readUint16(rawMessage));
+        builder.setHardTimeout(readUint16(rawMessage));
+        builder.setPriority(readUint16(rawMessage));
+        builder.setBufferId(readUint32(rawMessage));
+        builder.setOutPort(new PortNumber(readUint32(rawMessage)));
+        builder.setOutGroup(readUint32(rawMessage));
         builder.setFlags(createFlowModFlagsFromBitmap(rawMessage.readUnsignedShort()));
         rawMessage.skipBytes(PADDING);
         OFDeserializer<Match> matchDeserializer = registry.getDeserializer(
index f8a5667e62dae64d614708e52e2544a5b85991d7..d2a589b7e7691f658ac6198a0112f0da39cdffd6 100644 (file)
@@ -5,12 +5,15 @@
  * 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;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint16;
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint64;
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint8;
+
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import io.netty.buffer.ByteBuf;
-import java.math.BigInteger;
 import java.util.Objects;
 import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
 import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistryInjector;
@@ -41,23 +44,17 @@ public class FlowRemovedMessageFactory implements OFDeserializer<FlowRemovedMess
 
         FlowRemovedMessageBuilder builder = new FlowRemovedMessageBuilder();
         builder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
-        builder.setXid(rawMessage.readUnsignedInt());
-        byte[] cookie = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-        rawMessage.readBytes(cookie);
-        builder.setCookie(new BigInteger(1, cookie));
-        builder.setPriority(rawMessage.readUnsignedShort());
+        builder.setXid(readUint32(rawMessage));
+        builder.setCookie(readUint64(rawMessage));
+        builder.setPriority(readUint16(rawMessage));
         builder.setReason(FlowRemovedReason.forValue(rawMessage.readUnsignedByte()));
-        builder.setTableId(new TableId((long)rawMessage.readUnsignedByte()));
-        builder.setDurationSec(rawMessage.readUnsignedInt());
-        builder.setDurationNsec(rawMessage.readUnsignedInt());
-        builder.setIdleTimeout(rawMessage.readUnsignedShort());
-        builder.setHardTimeout(rawMessage.readUnsignedShort());
-        byte[] packetCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-        rawMessage.readBytes(packetCount);
-        builder.setPacketCount(new BigInteger(1, packetCount));
-        byte[] byteCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-        rawMessage.readBytes(byteCount);
-        builder.setByteCount(new BigInteger(1, byteCount));
+        builder.setTableId(new TableId(readUint8(rawMessage).toUint32()));
+        builder.setDurationSec(readUint32(rawMessage));
+        builder.setDurationNsec(readUint32(rawMessage));
+        builder.setIdleTimeout(readUint16(rawMessage));
+        builder.setHardTimeout(readUint16(rawMessage));
+        builder.setPacketCount(readUint64(rawMessage));
+        builder.setByteCount(readUint64(rawMessage));
         OFDeserializer<Match> matchDeserializer = registry.getDeserializer(new MessageCodeKey(
                 EncodeConstants.OF13_VERSION_ID, EncodeConstants.EMPTY_VALUE, Match.class));
         builder.setMatch(matchDeserializer.deserialize(rawMessage));
index 0e124962b3b94aea37d0b012f990162aa84c11f0..37d05aeee03b49152cff6ac8392b8a9de1866ffa 100644 (file)
@@ -8,6 +8,8 @@
 
 package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+
 import io.netty.buffer.ByteBuf;
 import java.util.ArrayList;
 import java.util.List;
@@ -39,7 +41,7 @@ public class GetAsyncReplyMessageFactory implements OFDeserializer<GetAsyncOutpu
     public GetAsyncOutput deserialize(ByteBuf rawMessage) {
         GetAsyncOutputBuilder builder = new GetAsyncOutputBuilder();
         builder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
-        builder.setXid(rawMessage.readUnsignedInt());
+        builder.setXid(readUint32(rawMessage));
         builder.setPacketInMask(decodePacketInMask(rawMessage));
         builder.setPortStatusMask(decodePortStatusMask(rawMessage));
         builder.setFlowRemovedMask(decodeFlowRemovedMask(rawMessage));
index db8837be23aa715e35ec146d2d46c37edbc9e35d..4637cb58ff0c7d1323ecdf38a4a677611747b782 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
 
+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;
@@ -19,12 +21,11 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
  * @author giuseppex.petralia@intel.com
  */
 public class GetAsyncRequestMessageFactory implements OFDeserializer<GetAsyncInput> {
-
     @Override
     public GetAsyncInput deserialize(ByteBuf rawMessage) {
-        GetAsyncInputBuilder builder = new GetAsyncInputBuilder();
-        builder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
-        builder.setXid(rawMessage.readUnsignedInt());
-        return builder.build();
+        return new GetAsyncInputBuilder()
+                .setVersion((short) EncodeConstants.OF13_VERSION_ID)
+                .setXid(readUint32(rawMessage))
+                .build();
     }
 }
index 84bb66fabae3be342556de859248d74576ae8ced..f2e7e08a6f801d7cb422f5db3e9ad86e21e057e8 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
 
+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.impl.util.VersionAssignableFactory;
@@ -19,13 +21,11 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
  * @author giuseppex.petralia@intel.com
  */
 public class GetConfigInputMessageFactory extends VersionAssignableFactory implements OFDeserializer<GetConfigInput> {
-
     @Override
     public GetConfigInput deserialize(ByteBuf rawMessage) {
-        GetConfigInputBuilder builder = new GetConfigInputBuilder();
-        builder.setVersion(getVersion());
-        builder.setXid(rawMessage.readUnsignedInt());
-        return builder.build();
+        return new GetConfigInputBuilder()
+                .setVersion(getVersion())
+                .setXid(readUint32(rawMessage))
+                .build();
     }
-
 }
index c8c8071cda613e4ea5bcff079f329fc33ce44e6a..f8e4bcc98dfbe4b7e0004340f4a07eb0f486906d 100644 (file)
@@ -5,9 +5,11 @@
  * 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;
 
+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.impl.util.VersionAssignableFactory;
@@ -27,9 +29,9 @@ public class GetConfigReplyMessageFactory extends VersionAssignableFactory imple
     public GetConfigOutput deserialize(ByteBuf rawMessage) {
         GetConfigOutputBuilder builder = new GetConfigOutputBuilder();
         builder.setVersion(getVersion());
-        builder.setXid(rawMessage.readUnsignedInt());
+        builder.setXid(readUint32(rawMessage));
         builder.setFlags(SwitchConfigFlag.forValue(rawMessage.readUnsignedShort()));
-        builder.setMissSendLen(rawMessage.readUnsignedShort());
+        builder.setMissSendLen(readUint16(rawMessage));
         return builder.build();
     }
 }
index 4295644c7c9030f7d98293056aa53ba68ad39305..e3d72996b0231e1371a05a14a4ef60e6f5f9962b 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
 
+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;
@@ -17,9 +19,9 @@ public class GetFeaturesInputMessageFactory implements OFDeserializer<GetFeature
 
     @Override
     public GetFeaturesInput deserialize(ByteBuf rawMessage) {
-        GetFeaturesInputBuilder builder = new GetFeaturesInputBuilder();
-        builder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
-        builder.setXid(rawMessage.readUnsignedInt());
-        return builder.build();
+        return new GetFeaturesInputBuilder()
+                .setVersion((short) EncodeConstants.OF13_VERSION_ID)
+                .setXid(readUint32(rawMessage))
+                .build();
     }
 }
\ No newline at end of file
index 2f2511b4fc28e396fc3b55b25e7acbe0b056fc10..ca0cd35eab939526cd4844399c44b17fc2341364 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
 
+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;
@@ -25,8 +27,8 @@ public class GetQueueConfigInputMessageFactory implements OFDeserializer<GetQueu
     public GetQueueConfigInput deserialize(ByteBuf rawMessage) {
         GetQueueConfigInputBuilder builder = new GetQueueConfigInputBuilder();
         builder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
-        builder.setXid(rawMessage.readUnsignedInt());
-        builder.setPort(new PortNumber(rawMessage.readUnsignedInt()));
+        builder.setXid(readUint32(rawMessage));
+        builder.setPort(new PortNumber(readUint32(rawMessage)));
         return builder.build();
     }
 
index 74689cef6f1b2335a5783766d0fb4c876a290844..85ac3e0344428984785403fc676ce5e155ce862e 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 java.util.ArrayList;
 import java.util.List;
@@ -48,18 +51,18 @@ public class GroupModInputMessageFactory implements OFDeserializer<GroupModInput
     public GroupModInput deserialize(ByteBuf rawMessage) {
         GroupModInputBuilder builder = new GroupModInputBuilder();
         builder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
-        builder.setXid(rawMessage.readUnsignedInt());
+        builder.setXid(readUint32(rawMessage));
         builder.setCommand(GroupModCommand.forValue(rawMessage.readUnsignedShort()));
         builder.setType(GroupType.forValue(rawMessage.readUnsignedByte()));
         rawMessage.skipBytes(PADDING);
-        builder.setGroupId(new GroupId(rawMessage.readUnsignedInt()));
+        builder.setGroupId(new GroupId(readUint32(rawMessage)));
         List<BucketsList> bucketsList = new ArrayList<>();
         while (rawMessage.readableBytes() > 0) {
             BucketsListBuilder bucketsBuilder = new BucketsListBuilder();
             final int bucketsLength = rawMessage.readUnsignedShort();
-            bucketsBuilder.setWeight(rawMessage.readUnsignedShort());
-            bucketsBuilder.setWatchPort(new PortNumber(rawMessage.readUnsignedInt()));
-            bucketsBuilder.setWatchGroup(rawMessage.readUnsignedInt());
+            bucketsBuilder.setWeight(readUint16(rawMessage));
+            bucketsBuilder.setWatchPort(new PortNumber(readUint32(rawMessage)));
+            bucketsBuilder.setWatchGroup(readUint32(rawMessage));
             rawMessage.skipBytes(PADDING_IN_BUCKETS_HEADER);
             CodeKeyMaker keyMaker = CodeKeyMakerFactory.createActionsKeyMaker(EncodeConstants.OF13_VERSION_ID);
             List<Action> actions = ListDeserializer.deserializeList(EncodeConstants.OF13_VERSION_ID,
@@ -70,5 +73,4 @@ public class GroupModInputMessageFactory implements OFDeserializer<GroupModInput
         builder.setBucketsList(bucketsList);
         return builder.build();
     }
-
 }
index 7ee348353607fc1cf5ccf2ccf68c7f505e4b64f6..9627cb9252fae1b59a58c51445621bc47521c825 100644 (file)
@@ -8,6 +8,8 @@
 
 package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+
 import io.netty.buffer.ByteBuf;
 import java.util.ArrayList;
 import java.util.List;
@@ -34,7 +36,7 @@ public class HelloMessageFactory extends VersionAssignableFactory implements OFD
     public HelloMessage deserialize(ByteBuf rawMessage) {
         HelloMessageBuilder builder = new HelloMessageBuilder();
         builder.setVersion(getVersion());
-        builder.setXid(rawMessage.readUnsignedInt());
+        builder.setXid(readUint32(rawMessage));
         if (rawMessage.readableBytes() > 0) {
             builder.setElements(readElement(rawMessage));
         }
index 2a6ab7e314b485d4ec96e41b9180c33080263c15..4d03bee586de0b54d28182047b492c13561e7ac8 100644 (file)
@@ -7,6 +7,9 @@
  */
 package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint8;
+
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import io.netty.buffer.ByteBuf;
 import java.util.ArrayList;
@@ -54,10 +57,10 @@ public class MeterModInputMessageFactory implements OFDeserializer<MeterModInput
 
         MeterModInputBuilder builder = new MeterModInputBuilder();
         builder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
-        builder.setXid(rawMessage.readUnsignedInt());
+        builder.setXid(readUint32(rawMessage));
         builder.setCommand(MeterModCommand.forValue(rawMessage.readUnsignedShort()));
         builder.setFlags(createMeterFlags(rawMessage.readUnsignedShort()));
-        builder.setMeterId(new MeterId(rawMessage.readUnsignedInt()));
+        builder.setMeterId(new MeterId(readUint32(rawMessage)));
         List<Bands> bandsList = new ArrayList<>();
         while (rawMessage.readableBytes() > 0) {
             BandsBuilder bandsBuilder = new BandsBuilder();
@@ -69,8 +72,8 @@ public class MeterModInputMessageFactory implements OFDeserializer<MeterModInput
                     MeterBandDropBuilder bandDropBuilder = new MeterBandDropBuilder();
                     bandDropBuilder.setType(MeterBandType.forValue(bandType));
                     rawMessage.readUnsignedShort();
-                    bandDropBuilder.setRate(rawMessage.readUnsignedInt());
-                    bandDropBuilder.setBurstSize(rawMessage.readUnsignedInt());
+                    bandDropBuilder.setRate(readUint32(rawMessage));
+                    bandDropBuilder.setBurstSize(readUint32(rawMessage));
                     rawMessage.skipBytes(PADDING_IN_METER_BAND_DROP_HEADER);
                     bandDropCaseBuilder.setMeterBandDrop(bandDropBuilder.build());
                     bandsBuilder.setMeterBand(bandDropCaseBuilder.build());
@@ -81,9 +84,9 @@ public class MeterModInputMessageFactory implements OFDeserializer<MeterModInput
                     MeterBandDscpRemarkBuilder bandDscpRemarkBuilder = new MeterBandDscpRemarkBuilder();
                     bandDscpRemarkBuilder.setType(MeterBandType.forValue(bandType));
                     rawMessage.readUnsignedShort();
-                    bandDscpRemarkBuilder.setRate(rawMessage.readUnsignedInt());
-                    bandDscpRemarkBuilder.setBurstSize(rawMessage.readUnsignedInt());
-                    bandDscpRemarkBuilder.setPrecLevel(rawMessage.readUnsignedByte());
+                    bandDscpRemarkBuilder.setRate(readUint32(rawMessage));
+                    bandDscpRemarkBuilder.setBurstSize(readUint32(rawMessage));
+                    bandDscpRemarkBuilder.setPrecLevel(readUint8(rawMessage));
                     rawMessage.skipBytes(PADDING_IN_METER_BAND_DSCP_HEADER);
                     bandDscpRemarkCaseBuilder.setMeterBandDscpRemark(bandDscpRemarkBuilder.build());
                     bandsBuilder.setMeterBand(bandDscpRemarkCaseBuilder.build());
@@ -114,5 +117,4 @@ public class MeterModInputMessageFactory implements OFDeserializer<MeterModInput
         final Boolean mfSTATS = (input & 1 << 3) != 0;
         return new MeterFlags(mfBURST, mfKBPS, mfPKTPS, mfSTATS);
     }
-
 }
index 7d96a51b3ac4cf2725daf1bddd6b5507cc3606df..5c1f3324f4be6ba759edce9b57648add2ed552cc 100644 (file)
@@ -5,11 +5,14 @@
  * 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;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint16;
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint64;
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint8;
+
 import io.netty.buffer.ByteBuf;
-import java.math.BigInteger;
 import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.List;
@@ -182,7 +185,7 @@ public class MultipartReplyMessageFactory implements OFDeserializer<MultipartRep
     public MultipartReplyMessage deserialize(final ByteBuf rawMessage) {
         MultipartReplyMessageBuilder builder = new MultipartReplyMessageBuilder();
         builder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
-        builder.setXid(rawMessage.readUnsignedInt());
+        builder.setXid(readUint32(rawMessage));
         int type = rawMessage.readUnsignedShort();
         builder.setType(MultipartType.forValue(type));
         builder.setFlags(new MultipartRequestFlags((rawMessage.readUnsignedShort() & 0x01) != 0));
@@ -276,24 +279,18 @@ public class MultipartReplyMessageFactory implements OFDeserializer<MultipartRep
             FlowStatsBuilder flowStatsBuilder = new FlowStatsBuilder();
             int flowRecordLength = input.readUnsignedShort();
             ByteBuf subInput = input.readSlice(flowRecordLength - EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
-            flowStatsBuilder.setTableId(subInput.readUnsignedByte());
+            flowStatsBuilder.setTableId(readUint8(subInput));
             subInput.skipBytes(PADDING_IN_FLOW_STATS_HEADER_01);
-            flowStatsBuilder.setDurationSec(subInput.readUnsignedInt());
-            flowStatsBuilder.setDurationNsec(subInput.readUnsignedInt());
-            flowStatsBuilder.setPriority(subInput.readUnsignedShort());
-            flowStatsBuilder.setIdleTimeout(subInput.readUnsignedShort());
-            flowStatsBuilder.setHardTimeout(subInput.readUnsignedShort());
+            flowStatsBuilder.setDurationSec(readUint32(subInput));
+            flowStatsBuilder.setDurationNsec(readUint32(subInput));
+            flowStatsBuilder.setPriority(readUint16(subInput));
+            flowStatsBuilder.setIdleTimeout(readUint16(subInput));
+            flowStatsBuilder.setHardTimeout(readUint16(subInput));
             flowStatsBuilder.setFlags(createFlowModFlagsFromBitmap(subInput.readUnsignedShort()));
             subInput.skipBytes(PADDING_IN_FLOW_STATS_HEADER_02);
-            byte[] cookie = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-            subInput.readBytes(cookie);
-            flowStatsBuilder.setCookie(new BigInteger(1, cookie));
-            byte[] packetCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-            subInput.readBytes(packetCount);
-            flowStatsBuilder.setPacketCount(new BigInteger(1, packetCount));
-            byte[] byteCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-            subInput.readBytes(byteCount);
-            flowStatsBuilder.setByteCount(new BigInteger(1, byteCount));
+            flowStatsBuilder.setCookie(readUint64(subInput));
+            flowStatsBuilder.setPacketCount(readUint64(subInput));
+            flowStatsBuilder.setByteCount(readUint64(subInput));
             OFDeserializer<Match> matchDeserializer = registry.getDeserializer(new MessageCodeKey(
                     EncodeConstants.OF13_VERSION_ID, EncodeConstants.EMPTY_VALUE, Match.class));
             flowStatsBuilder.setMatch(matchDeserializer.deserialize(subInput));
@@ -322,13 +319,9 @@ public class MultipartReplyMessageFactory implements OFDeserializer<MultipartRep
     private static MultipartReplyAggregateCase setAggregate(final ByteBuf input) {
         final MultipartReplyAggregateCaseBuilder caseBuilder = new MultipartReplyAggregateCaseBuilder();
         MultipartReplyAggregateBuilder builder = new MultipartReplyAggregateBuilder();
-        byte[] packetCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-        input.readBytes(packetCount);
-        builder.setPacketCount(new BigInteger(1, packetCount));
-        byte[] byteCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-        input.readBytes(byteCount);
-        builder.setByteCount(new BigInteger(1, byteCount));
-        builder.setFlowCount(input.readUnsignedInt());
+        builder.setPacketCount(readUint64(input));
+        builder.setByteCount(readUint64(input));
+        builder.setFlowCount(readUint32(input));
         input.skipBytes(PADDING_IN_AGGREGATE_HEADER);
         caseBuilder.setMultipartReplyAggregate(builder.build());
         return caseBuilder.build();
@@ -340,15 +333,11 @@ public class MultipartReplyMessageFactory implements OFDeserializer<MultipartRep
         List<TableStats> tableStatsList = new ArrayList<>();
         while (input.readableBytes() > 0) {
             TableStatsBuilder tableStatsBuilder = new TableStatsBuilder();
-            tableStatsBuilder.setTableId(input.readUnsignedByte());
+            tableStatsBuilder.setTableId(readUint8(input));
             input.skipBytes(PADDING_IN_TABLE_HEADER);
-            tableStatsBuilder.setActiveCount(input.readUnsignedInt());
-            byte[] lookupCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-            input.readBytes(lookupCount);
-            tableStatsBuilder.setLookupCount(new BigInteger(1, lookupCount));
-            byte[] matchedCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-            input.readBytes(matchedCount);
-            tableStatsBuilder.setMatchedCount(new BigInteger(1, matchedCount));
+            tableStatsBuilder.setActiveCount(readUint32(input));
+            tableStatsBuilder.setLookupCount(readUint64(input));
+            tableStatsBuilder.setMatchedCount(readUint64(input));
             tableStatsList.add(tableStatsBuilder.build());
         }
         builder.setTableStats(tableStatsList);
@@ -363,7 +352,7 @@ public class MultipartReplyMessageFactory implements OFDeserializer<MultipartRep
         while (input.readableBytes() > 0) {
             TableFeaturesBuilder featuresBuilder = new TableFeaturesBuilder();
             final int length = input.readUnsignedShort();
-            featuresBuilder.setTableId(input.readUnsignedByte());
+            featuresBuilder.setTableId(readUint8(input));
             input.skipBytes(PADDING_IN_MULTIPART_REPLY_TABLE_FEATURES);
             featuresBuilder.setName(ByteBufUtils.decodeNullTerminatedString(input, MAX_TABLE_NAME_LENGTH));
             byte[] metadataMatch = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
@@ -373,7 +362,7 @@ public class MultipartReplyMessageFactory implements OFDeserializer<MultipartRep
             input.readBytes(metadataWrite);
             featuresBuilder.setMetadataWrite(metadataWrite);
             featuresBuilder.setConfig(createTableConfig(input.readUnsignedInt()));
-            featuresBuilder.setMaxEntries(input.readUnsignedInt());
+            featuresBuilder.setMaxEntries(readUint32(input));
             featuresBuilder.setTableFeatureProperties(createTableFeaturesProperties(input,
                     length - MULTIPART_REPLY_TABLE_FEATURES_STRUCTURE_LENGTH));
             features.add(featuresBuilder.build());
@@ -413,7 +402,7 @@ public class MultipartReplyMessageFactory implements OFDeserializer<MultipartRep
                 List<NextTableIds> ids = new ArrayList<>();
                 while (propertyLength > 0) {
                     NextTableIdsBuilder nextTableIdsBuilder = new NextTableIdsBuilder();
-                    nextTableIdsBuilder.setTableId(input.readUnsignedByte());
+                    nextTableIdsBuilder.setTableId(readUint8(input));
                     ids.add(nextTableIdsBuilder.build());
                     propertyLength--;
                 }
@@ -462,46 +451,22 @@ public class MultipartReplyMessageFactory implements OFDeserializer<MultipartRep
         List<PortStats> portStatsList = new ArrayList<>();
         while (input.readableBytes() > 0) {
             PortStatsBuilder portStatsBuilder = new PortStatsBuilder();
-            portStatsBuilder.setPortNo(input.readUnsignedInt());
+            portStatsBuilder.setPortNo(readUint32(input));
             input.skipBytes(PADDING_IN_PORT_STATS_HEADER);
-            byte[] rxPackets = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-            input.readBytes(rxPackets);
-            portStatsBuilder.setRxPackets(new BigInteger(1, rxPackets));
-            byte[] txPackets = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-            input.readBytes(txPackets);
-            portStatsBuilder.setTxPackets(new BigInteger(1, txPackets));
-            byte[] rxBytes = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-            input.readBytes(rxBytes);
-            portStatsBuilder.setRxBytes(new BigInteger(1, rxBytes));
-            byte[] txBytes = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-            input.readBytes(txBytes);
-            portStatsBuilder.setTxBytes(new BigInteger(1, txBytes));
-            byte[] rxDropped = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-            input.readBytes(rxDropped);
-            portStatsBuilder.setRxDropped(new BigInteger(1, rxDropped));
-            byte[] txDropped = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-            input.readBytes(txDropped);
-            portStatsBuilder.setTxDropped(new BigInteger(1, txDropped));
-            byte[] rxErrors = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-            input.readBytes(rxErrors);
-            portStatsBuilder.setRxErrors(new BigInteger(1, rxErrors));
-            byte[] txErrors = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-            input.readBytes(txErrors);
-            portStatsBuilder.setTxErrors(new BigInteger(1, txErrors));
-            byte[] rxFrameErr = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-            input.readBytes(rxFrameErr);
-            portStatsBuilder.setRxFrameErr(new BigInteger(1, rxFrameErr));
-            byte[] rxOverErr = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-            input.readBytes(rxOverErr);
-            portStatsBuilder.setRxOverErr(new BigInteger(1, rxOverErr));
-            byte[] rxCrcErr = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-            input.readBytes(rxCrcErr);
-            portStatsBuilder.setRxCrcErr(new BigInteger(1, rxCrcErr));
-            byte[] collisions = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-            input.readBytes(collisions);
-            portStatsBuilder.setCollisions(new BigInteger(1, collisions));
-            portStatsBuilder.setDurationSec(input.readUnsignedInt());
-            portStatsBuilder.setDurationNsec(input.readUnsignedInt());
+            portStatsBuilder.setRxPackets(readUint64(input));
+            portStatsBuilder.setTxPackets(readUint64(input));
+            portStatsBuilder.setRxBytes(readUint64(input));
+            portStatsBuilder.setTxBytes(readUint64(input));
+            portStatsBuilder.setRxDropped(readUint64(input));
+            portStatsBuilder.setTxDropped(readUint64(input));
+            portStatsBuilder.setRxErrors(readUint64(input));
+            portStatsBuilder.setTxErrors(readUint64(input));
+            portStatsBuilder.setRxFrameErr(readUint64(input));
+            portStatsBuilder.setRxOverErr(readUint64(input));
+            portStatsBuilder.setRxCrcErr(readUint64(input));
+            portStatsBuilder.setCollisions(readUint64(input));
+            portStatsBuilder.setDurationSec(readUint32(input));
+            portStatsBuilder.setDurationNsec(readUint32(input));
             portStatsList.add(portStatsBuilder.build());
         }
         builder.setPortStats(portStatsList);
@@ -515,19 +480,13 @@ public class MultipartReplyMessageFactory implements OFDeserializer<MultipartRep
         List<QueueStats> queueStatsList = new ArrayList<>();
         while (input.readableBytes() > 0) {
             QueueStatsBuilder queueStatsBuilder = new QueueStatsBuilder();
-            queueStatsBuilder.setPortNo(input.readUnsignedInt());
-            queueStatsBuilder.setQueueId(input.readUnsignedInt());
-            byte[] txBytes = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-            input.readBytes(txBytes);
-            queueStatsBuilder.setTxBytes(new BigInteger(1, txBytes));
-            byte[] txPackets = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-            input.readBytes(txPackets);
-            queueStatsBuilder.setTxPackets(new BigInteger(1, txPackets));
-            byte[] txErrors = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-            input.readBytes(txErrors);
-            queueStatsBuilder.setTxErrors(new BigInteger(1, txErrors));
-            queueStatsBuilder.setDurationSec(input.readUnsignedInt());
-            queueStatsBuilder.setDurationNsec(input.readUnsignedInt());
+            queueStatsBuilder.setPortNo(readUint32(input));
+            queueStatsBuilder.setQueueId(readUint32(input));
+            queueStatsBuilder.setTxBytes(readUint64(input));
+            queueStatsBuilder.setTxPackets(readUint64(input));
+            queueStatsBuilder.setTxErrors(readUint64(input));
+            queueStatsBuilder.setDurationSec(readUint32(input));
+            queueStatsBuilder.setDurationNsec(readUint32(input));
             queueStatsList.add(queueStatsBuilder.build());
         }
         builder.setQueueStats(queueStatsList);
@@ -543,27 +502,19 @@ public class MultipartReplyMessageFactory implements OFDeserializer<MultipartRep
             GroupStatsBuilder groupStatsBuilder = new GroupStatsBuilder();
             final int bodyLength = input.readUnsignedShort();
             input.skipBytes(PADDING_IN_GROUP_HEADER_01);
-            groupStatsBuilder.setGroupId(new GroupId(input.readUnsignedInt()));
-            groupStatsBuilder.setRefCount(input.readUnsignedInt());
+            groupStatsBuilder.setGroupId(new GroupId(readUint32(input)));
+            groupStatsBuilder.setRefCount(readUint32(input));
             input.skipBytes(PADDING_IN_GROUP_HEADER_02);
-            byte[] packetCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-            input.readBytes(packetCount);
-            groupStatsBuilder.setPacketCount(new BigInteger(1, packetCount));
-            byte[] byteCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-            input.readBytes(byteCount);
-            groupStatsBuilder.setByteCount(new BigInteger(1, byteCount));
-            groupStatsBuilder.setDurationSec(input.readUnsignedInt());
-            groupStatsBuilder.setDurationNsec(input.readUnsignedInt());
+            groupStatsBuilder.setPacketCount(readUint64(input));
+            groupStatsBuilder.setByteCount(readUint64(input));
+            groupStatsBuilder.setDurationSec(readUint32(input));
+            groupStatsBuilder.setDurationNsec(readUint32(input));
             int actualLength = GROUP_BODY_LENGTH;
             List<BucketStats> bucketStatsList = new ArrayList<>();
             while (actualLength < bodyLength) {
                 BucketStatsBuilder bucketStatsBuilder = new BucketStatsBuilder();
-                byte[] packetCountBucket = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-                input.readBytes(packetCountBucket);
-                bucketStatsBuilder.setPacketCount(new BigInteger(1, packetCountBucket));
-                byte[] byteCountBucket = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-                input.readBytes(byteCountBucket);
-                bucketStatsBuilder.setByteCount(new BigInteger(1, byteCountBucket));
+                bucketStatsBuilder.setPacketCount(readUint64(input));
+                bucketStatsBuilder.setByteCount(readUint64(input));
                 bucketStatsList.add(bucketStatsBuilder.build());
                 actualLength += BUCKET_COUNTER_LENGTH;
             }
@@ -578,11 +529,11 @@ public class MultipartReplyMessageFactory implements OFDeserializer<MultipartRep
     private static MultipartReplyMeterFeaturesCase setMeterFeatures(final ByteBuf input) {
         final MultipartReplyMeterFeaturesCaseBuilder caseBuilder = new MultipartReplyMeterFeaturesCaseBuilder();
         MultipartReplyMeterFeaturesBuilder builder = new MultipartReplyMeterFeaturesBuilder();
-        builder.setMaxMeter(input.readUnsignedInt());
+        builder.setMaxMeter(readUint32(input));
         builder.setBandTypes(createMeterBandsBitmap(input.readUnsignedInt()));
         builder.setCapabilities(createMeterFlags(input.readUnsignedInt()));
-        builder.setMaxBands(input.readUnsignedByte());
-        builder.setMaxColor(input.readUnsignedByte());
+        builder.setMaxBands(readUint8(input));
+        builder.setMaxColor(readUint8(input));
         input.skipBytes(PADDING_IN_METER_FEATURES_HEADER);
         caseBuilder.setMultipartReplyMeterFeatures(builder.build());
         return caseBuilder.build();
@@ -610,28 +561,20 @@ public class MultipartReplyMessageFactory implements OFDeserializer<MultipartRep
         List<MeterStats> meterStatsList = new ArrayList<>();
         while (input.readableBytes() > 0) {
             MeterStatsBuilder meterStatsBuilder = new MeterStatsBuilder();
-            meterStatsBuilder.setMeterId(new MeterId(input.readUnsignedInt()));
+            meterStatsBuilder.setMeterId(new MeterId(readUint32(input)));
             final int meterStatsBodyLength = input.readUnsignedShort();
             input.skipBytes(PADDING_IN_METER_STATS_HEADER);
-            meterStatsBuilder.setFlowCount(input.readUnsignedInt());
-            byte[] packetInCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-            input.readBytes(packetInCount);
-            meterStatsBuilder.setPacketInCount(new BigInteger(1, packetInCount));
-            byte[] byteInCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-            input.readBytes(byteInCount);
-            meterStatsBuilder.setByteInCount(new BigInteger(1, byteInCount));
-            meterStatsBuilder.setDurationSec(input.readUnsignedInt());
-            meterStatsBuilder.setDurationNsec(input.readUnsignedInt());
+            meterStatsBuilder.setFlowCount(readUint32(input));
+            meterStatsBuilder.setPacketInCount(readUint64(input));
+            meterStatsBuilder.setByteInCount(readUint64(input));
+            meterStatsBuilder.setDurationSec(readUint32(input));
+            meterStatsBuilder.setDurationNsec(readUint32(input));
             int actualLength = METER_BODY_LENGTH;
             List<MeterBandStats> meterBandStatsList = new ArrayList<>();
             while (actualLength < meterStatsBodyLength) {
                 MeterBandStatsBuilder meterBandStatsBuilder = new MeterBandStatsBuilder();
-                byte[] packetBandCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-                input.readBytes(packetBandCount);
-                meterBandStatsBuilder.setPacketBandCount(new BigInteger(1, packetBandCount));
-                byte[] byteBandCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-                input.readBytes(byteBandCount);
-                meterBandStatsBuilder.setByteBandCount(new BigInteger(1, byteBandCount));
+                meterBandStatsBuilder.setPacketBandCount(readUint64(input));
+                meterBandStatsBuilder.setByteBandCount(readUint64(input));
                 meterBandStatsList.add(meterBandStatsBuilder.build());
                 actualLength += METER_BAND_STATS_LENGTH;
             }
@@ -651,7 +594,7 @@ public class MultipartReplyMessageFactory implements OFDeserializer<MultipartRep
             MeterConfigBuilder meterConfigBuilder = new MeterConfigBuilder();
             int meterConfigBodyLength = input.readUnsignedShort();
             meterConfigBuilder.setFlags(createMeterFlags(input.readUnsignedShort()));
-            meterConfigBuilder.setMeterId(new MeterId(input.readUnsignedInt()));
+            meterConfigBuilder.setMeterId(new MeterId(readUint32(input)));
             int actualLength = METER_CONFIG_LENGTH;
             List<Bands> bandsList = new ArrayList<>();
             while (actualLength < meterConfigBodyLength) {
@@ -664,8 +607,8 @@ public class MultipartReplyMessageFactory implements OFDeserializer<MultipartRep
                         MeterBandDropBuilder bandDropBuilder = new MeterBandDropBuilder();
                         bandDropBuilder.setType(MeterBandType.forValue(bandType));
                         actualLength += input.readUnsignedShort();
-                        bandDropBuilder.setRate(input.readUnsignedInt());
-                        bandDropBuilder.setBurstSize(input.readUnsignedInt());
+                        bandDropBuilder.setRate(readUint32(input));
+                        bandDropBuilder.setBurstSize(readUint32(input));
                         input.skipBytes(PADDING_IN_METER_BAND_DROP_HEADER);
                         bandDropCaseBuilder.setMeterBandDrop(bandDropBuilder.build());
                         bandsBuilder.setMeterBand(bandDropCaseBuilder.build());
@@ -676,9 +619,9 @@ public class MultipartReplyMessageFactory implements OFDeserializer<MultipartRep
                         MeterBandDscpRemarkBuilder bandDscpRemarkBuilder = new MeterBandDscpRemarkBuilder();
                         bandDscpRemarkBuilder.setType(MeterBandType.forValue(bandType));
                         actualLength += input.readUnsignedShort();
-                        bandDscpRemarkBuilder.setRate(input.readUnsignedInt());
-                        bandDscpRemarkBuilder.setBurstSize(input.readUnsignedInt());
-                        bandDscpRemarkBuilder.setPrecLevel(input.readUnsignedByte());
+                        bandDscpRemarkBuilder.setRate(readUint32(input));
+                        bandDscpRemarkBuilder.setBurstSize(readUint32(input));
+                        bandDscpRemarkBuilder.setPrecLevel(readUint8(input));
                         input.skipBytes(PADDING_IN_METER_BAND_DSCP_HEADER);
                         bandDscpRemarkCaseBuilder.setMeterBandDscpRemark(bandDscpRemarkBuilder.build());
                         bandsBuilder.setMeterBand(bandDscpRemarkCaseBuilder.build());
@@ -729,7 +672,7 @@ public class MultipartReplyMessageFactory implements OFDeserializer<MultipartRep
         List<Ports> portsList = new ArrayList<>();
         while (input.readableBytes() > 0) {
             PortsBuilder portsBuilder = new PortsBuilder();
-            portsBuilder.setPortNo(input.readUnsignedInt());
+            portsBuilder.setPortNo(readUint32(input));
             input.skipBytes(PADDING_IN_PORT_DESC_HEADER_01);
             portsBuilder.setHwAddr(ByteBufUtils.readIetfMacAddress(input));
             input.skipBytes(PADDING_IN_PORT_DESC_HEADER_02);
@@ -740,8 +683,8 @@ public class MultipartReplyMessageFactory implements OFDeserializer<MultipartRep
             portsBuilder.setAdvertisedFeatures(createPortFeatures(input.readUnsignedInt()));
             portsBuilder.setSupportedFeatures(createPortFeatures(input.readUnsignedInt()));
             portsBuilder.setPeerFeatures(createPortFeatures(input.readUnsignedInt()));
-            portsBuilder.setCurrSpeed(input.readUnsignedInt());
-            portsBuilder.setMaxSpeed(input.readUnsignedInt());
+            portsBuilder.setCurrSpeed(readUint32(input));
+            portsBuilder.setMaxSpeed(readUint32(input));
             portsList.add(portsBuilder.build());
         }
         builder.setPorts(portsList);
@@ -854,15 +797,15 @@ public class MultipartReplyMessageFactory implements OFDeserializer<MultipartRep
             final int bodyLength = input.readUnsignedShort();
             groupDescBuilder.setType(GroupType.forValue(input.readUnsignedByte()));
             input.skipBytes(PADDING_IN_GROUP_DESC_HEADER);
-            groupDescBuilder.setGroupId(new GroupId(input.readUnsignedInt()));
+            groupDescBuilder.setGroupId(new GroupId(readUint32(input)));
             int actualLength = GROUP_DESC_HEADER_LENGTH;
             List<BucketsList> bucketsList = new ArrayList<>();
             while (actualLength < bodyLength) {
                 BucketsListBuilder bucketsBuilder = new BucketsListBuilder();
                 final int bucketsLength = input.readUnsignedShort();
-                bucketsBuilder.setWeight(input.readUnsignedShort());
-                bucketsBuilder.setWatchPort(new PortNumber(input.readUnsignedInt()));
-                bucketsBuilder.setWatchGroup(input.readUnsignedInt());
+                bucketsBuilder.setWeight(readUint16(input));
+                bucketsBuilder.setWatchPort(new PortNumber(readUint32(input)));
+                bucketsBuilder.setWatchGroup(readUint32(input));
                 input.skipBytes(PADDING_IN_BUCKETS_HEADER);
                 CodeKeyMaker keyMaker = CodeKeyMakerFactory.createActionsKeyMaker(EncodeConstants.OF13_VERSION_ID);
                 List<Action> actions = ListDeserializer.deserializeList(EncodeConstants.OF13_VERSION_ID,
index 372c4fb0c0b1f7b099bb21c86a0462a5a69e57d9..d8fef1feace931ac5b67fa0ca9369426f0f63348 100644 (file)
@@ -7,9 +7,12 @@
  */
 package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint64;
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint8;
+
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import io.netty.buffer.ByteBuf;
-import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Objects;
@@ -123,7 +126,7 @@ public class MultipartRequestInputMessageFactory
 
         MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
         builder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
-        builder.setXid(rawMessage.readUnsignedInt());
+        builder.setXid(readUint32(rawMessage));
         int type = rawMessage.readUnsignedShort();
         builder.setType(getMultipartType(type));
         builder.setFlags(getMultipartRequestFlags(rawMessage.readUnsignedShort()));
@@ -199,17 +202,13 @@ public class MultipartRequestInputMessageFactory
         while (input.readableBytes() > 0) {
             TableFeaturesBuilder featuresBuilder = new TableFeaturesBuilder();
             final int length = input.readUnsignedShort();
-            featuresBuilder.setTableId(input.readUnsignedByte());
+            featuresBuilder.setTableId(readUint8(input));
             input.skipBytes(PADDING_IN_MULTIPART_REQUEST_TABLE_FEATURES);
             featuresBuilder.setName(ByteBufUtils.decodeNullTerminatedString(input, MAX_TABLE_NAME_LENGTH));
-            byte[] metadataMatch = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-            input.readBytes(metadataMatch);
-            featuresBuilder.setMetadataMatch(new BigInteger(1, metadataMatch));
-            byte[] metadataWrite = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-            input.readBytes(metadataWrite);
-            featuresBuilder.setMetadataWrite(new BigInteger(1, metadataWrite));
+            featuresBuilder.setMetadataMatch(readUint64(input));
+            featuresBuilder.setMetadataWrite(readUint64(input));
             featuresBuilder.setConfig(createTableConfig(input.readUnsignedInt()));
-            featuresBuilder.setMaxEntries(input.readUnsignedInt());
+            featuresBuilder.setMaxEntries(readUint32(input));
             featuresBuilder.setTableFeatureProperties(
                     createTableFeaturesProperties(input, length - MULTIPART_REQUEST_TABLE_FEATURES_STRUCTURE_LENGTH));
             features.add(featuresBuilder.build());
@@ -244,7 +243,7 @@ public class MultipartRequestInputMessageFactory
                 List<NextTableIds> ids = new ArrayList<>();
                 while (propertyLength > 0) {
                     NextTableIdsBuilder nextTableIdsBuilder = new NextTableIdsBuilder();
-                    nextTableIdsBuilder.setTableId(input.readUnsignedByte());
+                    nextTableIdsBuilder.setTableId(readUint8(input));
                     ids.add(nextTableIdsBuilder.build());
                     propertyLength--;
                 }
@@ -303,17 +302,13 @@ public class MultipartRequestInputMessageFactory
     private MultipartRequestFlowCase setFlow(ByteBuf input) {
         final MultipartRequestFlowCaseBuilder caseBuilder = new MultipartRequestFlowCaseBuilder();
         MultipartRequestFlowBuilder flowBuilder = new MultipartRequestFlowBuilder();
-        flowBuilder.setTableId(input.readUnsignedByte());
+        flowBuilder.setTableId(readUint8(input));
         input.skipBytes(FLOW_PADDING_1);
-        flowBuilder.setOutPort(input.readUnsignedInt());
-        flowBuilder.setOutGroup(input.readUnsignedInt());
+        flowBuilder.setOutPort(readUint32(input));
+        flowBuilder.setOutGroup(readUint32(input));
         input.skipBytes(FLOW_PADDING_2);
-        byte[] cookie = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-        input.readBytes(cookie);
-        flowBuilder.setCookie(new BigInteger(1, cookie));
-        final byte[] cookieMask = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-        input.readBytes(cookieMask);
-        flowBuilder.setCookieMask(new BigInteger(1, cookieMask));
+        flowBuilder.setCookie(readUint64(input));
+        flowBuilder.setCookieMask(readUint64(input));
         OFDeserializer<Match> matchDeserializer = registry.getDeserializer(
                 new MessageCodeKey(EncodeConstants.OF13_VERSION_ID, EncodeConstants.EMPTY_VALUE, Match.class));
         flowBuilder.setMatch(matchDeserializer.deserialize(input));
@@ -324,17 +319,13 @@ public class MultipartRequestInputMessageFactory
     private MultipartRequestAggregateCase setAggregate(ByteBuf input) {
         final MultipartRequestAggregateCaseBuilder caseBuilder = new MultipartRequestAggregateCaseBuilder();
         MultipartRequestAggregateBuilder aggregateBuilder = new MultipartRequestAggregateBuilder();
-        aggregateBuilder.setTableId(input.readUnsignedByte());
+        aggregateBuilder.setTableId(readUint8(input));
         input.skipBytes(AGGREGATE_PADDING_1);
-        aggregateBuilder.setOutPort(input.readUnsignedInt());
-        aggregateBuilder.setOutGroup(input.readUnsignedInt());
+        aggregateBuilder.setOutPort(readUint32(input));
+        aggregateBuilder.setOutGroup(readUint32(input));
         input.skipBytes(AGGREGATE_PADDING_2);
-        byte[] cookie = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-        input.readBytes(cookie);
-        aggregateBuilder.setCookie(new BigInteger(1, cookie));
-        final byte[] cookieMask = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-        input.readBytes(cookieMask);
-        aggregateBuilder.setCookieMask(new BigInteger(1, cookieMask));
+        aggregateBuilder.setCookie(readUint64(input));
+        aggregateBuilder.setCookieMask(readUint64(input));
         OFDeserializer<Match> matchDeserializer = registry.getDeserializer(
                 new MessageCodeKey(EncodeConstants.OF13_VERSION_ID, EncodeConstants.EMPTY_VALUE, Match.class));
         aggregateBuilder.setMatch(matchDeserializer.deserialize(input));
@@ -353,7 +344,7 @@ public class MultipartRequestInputMessageFactory
     private static MultipartRequestPortStatsCase setPortStats(ByteBuf input) {
         MultipartRequestPortStatsCaseBuilder caseBuilder = new MultipartRequestPortStatsCaseBuilder();
         MultipartRequestPortStatsBuilder portBuilder = new MultipartRequestPortStatsBuilder();
-        portBuilder.setPortNo(input.readUnsignedInt());
+        portBuilder.setPortNo(readUint32(input));
         caseBuilder.setMultipartRequestPortStats(portBuilder.build());
         return caseBuilder.build();
     }
@@ -361,8 +352,8 @@ public class MultipartRequestInputMessageFactory
     private static MultipartRequestQueueCase setQueue(ByteBuf input) {
         MultipartRequestQueueCaseBuilder caseBuilder = new MultipartRequestQueueCaseBuilder();
         MultipartRequestQueueBuilder queueBuilder = new MultipartRequestQueueBuilder();
-        queueBuilder.setPortNo(input.readUnsignedInt());
-        queueBuilder.setQueueId(input.readUnsignedInt());
+        queueBuilder.setPortNo(readUint32(input));
+        queueBuilder.setQueueId(readUint32(input));
         caseBuilder.setMultipartRequestQueue(queueBuilder.build());
         return caseBuilder.build();
     }
@@ -370,7 +361,7 @@ public class MultipartRequestInputMessageFactory
     private static MultipartRequestGroupCase setGroup(ByteBuf input) {
         MultipartRequestGroupCaseBuilder caseBuilder = new MultipartRequestGroupCaseBuilder();
         MultipartRequestGroupBuilder groupBuilder = new MultipartRequestGroupBuilder();
-        groupBuilder.setGroupId(new GroupId(input.readUnsignedInt()));
+        groupBuilder.setGroupId(new GroupId(readUint32(input)));
         caseBuilder.setMultipartRequestGroup(groupBuilder.build());
         return caseBuilder.build();
     }
@@ -394,7 +385,7 @@ public class MultipartRequestInputMessageFactory
     private static MultipartRequestMeterCase setMeter(ByteBuf input) {
         MultipartRequestMeterCaseBuilder caseBuilder = new MultipartRequestMeterCaseBuilder();
         MultipartRequestMeterBuilder meterBuilder = new MultipartRequestMeterBuilder();
-        meterBuilder.setMeterId(new MeterId(input.readUnsignedInt()));
+        meterBuilder.setMeterId(new MeterId(readUint32(input)));
         caseBuilder.setMultipartRequestMeter(meterBuilder.build());
         return caseBuilder.build();
     }
@@ -402,7 +393,7 @@ public class MultipartRequestInputMessageFactory
     private static MultipartRequestMeterConfigCase setMeterConfig(ByteBuf input) {
         MultipartRequestMeterConfigCaseBuilder caseBuilder = new MultipartRequestMeterConfigCaseBuilder();
         MultipartRequestMeterConfigBuilder meterBuilder = new MultipartRequestMeterConfigBuilder();
-        meterBuilder.setMeterId(new MeterId(input.readUnsignedInt()));
+        meterBuilder.setMeterId(new MeterId(readUint32(input)));
         caseBuilder.setMultipartRequestMeterConfig(meterBuilder.build());
         return caseBuilder.build();
     }
index b9cd3b3dbcedc056f872d78aa04f20d379453250..7b32fb4dd419370323c03ee9f0a487b1fe2268fd 100644 (file)
@@ -5,9 +5,10 @@
  * 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;
 
+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;
@@ -35,7 +36,7 @@ public class OF10ErrorMessageFactory implements OFDeserializer<ErrorMessage> {
     public ErrorMessage deserialize(ByteBuf rawMessage) {
         ErrorMessageBuilder builder = new ErrorMessageBuilder();
         builder.setVersion((short) EncodeConstants.OF10_VERSION_ID);
-        builder.setXid(rawMessage.readUnsignedInt());
+        builder.setXid(readUint32(rawMessage));
         int type = rawMessage.readUnsignedShort();
         ErrorTypeV10 errorType = ErrorTypeV10.forValue(type);
         decodeType(builder, errorType, type);
index 49089f6240feeb607eaecc0b729f14edba6491b6..bfcefa9f7dbb7ed61c75160616cdf4ebd0cb3a55 100644 (file)
@@ -5,11 +5,14 @@
  * 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;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint16;
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint64;
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint8;
+
 import io.netty.buffer.ByteBuf;
-import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.List;
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
@@ -36,12 +39,10 @@ public class OF10FeaturesReplyMessageFactory implements OFDeserializer<GetFeatur
     public GetFeaturesOutput deserialize(final ByteBuf rawMessage) {
         GetFeaturesOutputBuilder builder = new GetFeaturesOutputBuilder();
         builder.setVersion((short) EncodeConstants.OF10_VERSION_ID);
-        builder.setXid(rawMessage.readUnsignedInt());
-        byte[] datapathId = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-        rawMessage.readBytes(datapathId);
-        builder.setDatapathId(new BigInteger(1, datapathId));
-        builder.setBuffers(rawMessage.readUnsignedInt());
-        builder.setTables(rawMessage.readUnsignedByte());
+        builder.setXid(readUint32(rawMessage));
+        builder.setDatapathId(readUint64(rawMessage));
+        builder.setBuffers(readUint32(rawMessage));
+        builder.setTables(readUint8(rawMessage));
         rawMessage.skipBytes(PADDING_IN_FEATURES_REPLY_HEADER);
         builder.setCapabilitiesV10(createCapabilitiesV10(rawMessage.readUnsignedInt()));
         builder.setActionsV10(createActionsV10(rawMessage.readUnsignedInt()));
@@ -87,7 +88,7 @@ public class OF10FeaturesReplyMessageFactory implements OFDeserializer<GetFeatur
 
     private static PhyPort deserializePort(final ByteBuf rawMessage) {
         PhyPortBuilder builder = new PhyPortBuilder();
-        builder.setPortNo((long) rawMessage.readUnsignedShort());
+        builder.setPortNo(readUint16(rawMessage).toUint32());
         builder.setHwAddr(ByteBufUtils.readIetfMacAddress(rawMessage));
         builder.setName(ByteBufUtils.decodeNullTerminatedString(rawMessage, EncodeConstants.MAX_PORT_NAME_LENGTH));
         builder.setConfigV10(OpenflowUtils.createPortConfig(rawMessage.readUnsignedInt()));
index 1e7cdbf72ad73717b10dc361ca3871b8360f9f7c..38282f06d7f0c8b97ff9d3b3c69d92e65f2c9a91 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
 
+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;
@@ -24,7 +26,7 @@ public class OF10FeaturesRequestMessageFactory implements OFDeserializer<GetFeat
     public GetFeaturesInput deserialize(ByteBuf rawMessage) {
         GetFeaturesInputBuilder builder = new GetFeaturesInputBuilder();
         builder.setVersion((short) EncodeConstants.OF10_VERSION_ID);
-        builder.setXid(rawMessage.readUnsignedInt());
+        builder.setXid(readUint32(rawMessage));
         return builder.build();
     }
 }
index 44d4b6985619216d463058017dfabae9fe21b6c9..89102da055848d3df4b3d236361629c6ea783c62 100644 (file)
@@ -7,9 +7,12 @@
  */
 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 static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint64;
+
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import io.netty.buffer.ByteBuf;
-import java.math.BigInteger;
 import java.util.List;
 import java.util.Objects;
 import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
@@ -49,19 +52,17 @@ public class OF10FlowModInputMessageFactory implements OFDeserializer<FlowModInp
 
         FlowModInputBuilder builder = new FlowModInputBuilder();
         builder.setVersion((short) EncodeConstants.OF10_VERSION_ID);
-        builder.setXid(rawMessage.readUnsignedInt());
+        builder.setXid(readUint32(rawMessage));
         OFDeserializer<MatchV10> matchDeserializer = registry.getDeserializer(
                 new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, EncodeConstants.EMPTY_VALUE, MatchV10.class));
         builder.setMatchV10(matchDeserializer.deserialize(rawMessage));
-        byte[] cookie = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-        rawMessage.readBytes(cookie);
-        builder.setCookie(new BigInteger(1, cookie));
+        builder.setCookie(readUint64(rawMessage));
         builder.setCommand(FlowModCommand.forValue(rawMessage.readUnsignedShort()));
-        builder.setIdleTimeout(rawMessage.readUnsignedShort());
-        builder.setHardTimeout(rawMessage.readUnsignedShort());
-        builder.setPriority(rawMessage.readUnsignedShort());
-        builder.setBufferId(rawMessage.readUnsignedInt());
-        builder.setOutPort(new PortNumber((long) rawMessage.readUnsignedShort()));
+        builder.setIdleTimeout(readUint16(rawMessage));
+        builder.setHardTimeout(readUint16(rawMessage));
+        builder.setPriority(readUint16(rawMessage));
+        builder.setBufferId(readUint32(rawMessage));
+        builder.setOutPort(new PortNumber(readUint16(rawMessage).toUint32()));
         builder.setFlagsV10(createFlowModFlagsFromBitmap(rawMessage.readUnsignedShort()));
         CodeKeyMaker keyMaker = CodeKeyMakerFactory.createActionsKeyMaker(EncodeConstants.OF10_VERSION_ID);
 
@@ -78,5 +79,4 @@ public class OF10FlowModInputMessageFactory implements OFDeserializer<FlowModInp
         final Boolean _oFPFFEMERG = (input & 1 << 2) != 0;
         return new FlowModFlagsV10(_oFPFFCHECKOVERLAP, _oFPFFEMERG, _oFPFFSENDFLOWREM);
     }
-
 }
index cfdf52d1602b6f78f3eeab81b6e35f024f9a628d..e758f24c5dab50027f77ffe9df5196ae72a03f40 100644 (file)
@@ -5,12 +5,14 @@
  * 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;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint16;
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint64;
+
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import io.netty.buffer.ByteBuf;
-import java.math.BigInteger;
 import java.util.Objects;
 import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
 import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistryInjector;
@@ -41,26 +43,20 @@ public class OF10FlowRemovedMessageFactory implements OFDeserializer<FlowRemoved
 
         FlowRemovedMessageBuilder builder = new FlowRemovedMessageBuilder();
         builder.setVersion((short) EncodeConstants.OF10_VERSION_ID);
-        builder.setXid(rawMessage.readUnsignedInt());
+        builder.setXid(readUint32(rawMessage));
         OFDeserializer<MatchV10> matchDeserializer = registry.getDeserializer(
                 new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, EncodeConstants.EMPTY_VALUE, MatchV10.class));
         builder.setMatchV10(matchDeserializer.deserialize(rawMessage));
-        byte[] cookie = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-        rawMessage.readBytes(cookie);
-        builder.setCookie(new BigInteger(1, cookie));
-        builder.setPriority(rawMessage.readUnsignedShort());
+        builder.setCookie(readUint64(rawMessage));
+        builder.setPriority(readUint16(rawMessage));
         builder.setReason(FlowRemovedReason.forValue(rawMessage.readUnsignedByte()));
         rawMessage.skipBytes(PADDING_IN_FLOW_REMOVED_MESSAGE);
-        builder.setDurationSec(rawMessage.readUnsignedInt());
-        builder.setDurationNsec(rawMessage.readUnsignedInt());
-        builder.setIdleTimeout(rawMessage.readUnsignedShort());
+        builder.setDurationSec(readUint32(rawMessage));
+        builder.setDurationNsec(readUint32(rawMessage));
+        builder.setIdleTimeout(readUint16(rawMessage));
         rawMessage.skipBytes(PADDING_IN_FLOW_REMOVED_MESSAGE_2);
-        byte[] packetCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-        rawMessage.readBytes(packetCount);
-        builder.setPacketCount(new BigInteger(1, packetCount));
-        byte[] byteCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-        rawMessage.readBytes(byteCount);
-        builder.setByteCount(new BigInteger(1, byteCount));
+        builder.setPacketCount(readUint64(rawMessage));
+        builder.setByteCount(readUint64(rawMessage));
         return builder.build();
     }
 
index 30d739b896d7a31669cf11092840b5774707ffbe..178a238324ec9a926e3521e8767553f9d5d34104 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;
@@ -25,8 +28,8 @@ public class OF10GetQueueConfigInputMessageFactory implements OFDeserializer<Get
     public GetQueueConfigInput deserialize(ByteBuf rawMessage) {
         GetQueueConfigInputBuilder builder = new GetQueueConfigInputBuilder();
         builder.setVersion((short) EncodeConstants.OF10_VERSION_ID);
-        builder.setXid(rawMessage.readUnsignedInt());
-        builder.setPort(new PortNumber((long) rawMessage.readUnsignedShort()));
+        builder.setXid(readUint32(rawMessage));
+        builder.setPort(new PortNumber(readUint16(rawMessage).toUint32()));
         return builder.build();
     }
 }
index 879b88bc797be0e2a54b0f8f2bea55030d404b41..482e499ba0946114c2bb008a1a161b804c5b1fc2 100644 (file)
@@ -5,9 +5,10 @@
  * 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;
 
+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;
@@ -25,11 +26,10 @@ public class OF10HelloMessageFactory implements OFDeserializer<HelloMessage> {
     public HelloMessage deserialize(ByteBuf rawMessage) {
         HelloMessageBuilder builder = new HelloMessageBuilder();
         builder.setVersion((short) EncodeConstants.OF10_VERSION_ID);
-        builder.setXid(rawMessage.readUnsignedInt());
+        builder.setXid(readUint32(rawMessage));
         if (rawMessage.readableBytes() > 0) {
             rawMessage.skipBytes(rawMessage.readableBytes());
         }
         return builder.build();
     }
-
 }
index f1e8bbb5b4a4d31268a061bce1c8ae5640dc3c08..103f9179fc6a404db59f0f30641d3dea97b09248 100644 (file)
@@ -5,9 +5,11 @@
  * 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;
 
+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;
@@ -28,10 +30,10 @@ public class OF10PacketInMessageFactory implements OFDeserializer<PacketInMessag
     public PacketInMessage deserialize(final ByteBuf rawMessage) {
         PacketInMessageBuilder builder = new PacketInMessageBuilder();
         builder.setVersion((short) EncodeConstants.OF10_VERSION_ID);
-        builder.setXid(rawMessage.readUnsignedInt());
-        builder.setBufferId(rawMessage.readUnsignedInt());
-        builder.setTotalLen(rawMessage.readUnsignedShort());
-        builder.setInPort(rawMessage.readUnsignedShort());
+        builder.setXid(readUint32(rawMessage));
+        builder.setBufferId(readUint32(rawMessage));
+        builder.setTotalLen(readUint16(rawMessage));
+        builder.setInPort(readUint16(rawMessage));
         builder.setReason(PacketInReason.forValue(rawMessage.readUnsignedByte()));
         rawMessage.skipBytes(PADDING_IN_PACKET_IN_HEADER);
         int remainingBytes = rawMessage.readableBytes();
index 6e84901a2bab1c6b44bc4a164f56fbe675fbb825..1cd1551f669c7aa85c611cf4e68adbad6f0c4c29 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 java.util.List;
 import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
@@ -27,7 +30,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
  * @author giuseppex.petralia@intel.com
  */
 public class OF10PacketOutInputMessageFactory implements OFDeserializer<PacketOutInput>, DeserializerRegistryInjector {
-
     private DeserializerRegistry registry;
 
     @Override
@@ -39,9 +41,9 @@ public class OF10PacketOutInputMessageFactory implements OFDeserializer<PacketOu
     public PacketOutInput deserialize(ByteBuf rawMessage) {
         PacketOutInputBuilder builder = new PacketOutInputBuilder();
         builder.setVersion((short) EncodeConstants.OF10_VERSION_ID);
-        builder.setXid(rawMessage.readUnsignedInt());
-        builder.setBufferId(rawMessage.readUnsignedInt());
-        builder.setInPort(new PortNumber((long) rawMessage.readUnsignedShort()));
+        builder.setXid(readUint32(rawMessage));
+        builder.setBufferId(readUint32(rawMessage));
+        builder.setInPort(new PortNumber(readUint16(rawMessage).toUint32()));
         final int actions_len = rawMessage.readShort();
         CodeKeyMaker keyMaker = CodeKeyMakerFactory.createActionsKeyMaker(EncodeConstants.OF10_VERSION_ID);
         List<Action> actions = ListDeserializer.deserializeList(EncodeConstants.OF10_VERSION_ID, actions_len,
@@ -54,5 +56,4 @@ public class OF10PacketOutInputMessageFactory implements OFDeserializer<PacketOu
         builder.setData(data);
         return builder.build();
     }
-
 }
index 2dd19bbaac361b639eb2de92ff07a21855ca547c..6008ce4238a641666df17745b05908c452034f3e 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;
@@ -28,8 +31,8 @@ public class OF10PortModInputMessageFactory implements OFDeserializer<PortModInp
     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.setXid(readUint32(rawMessage));
+        builder.setPortNo(new PortNumber(readUint16(rawMessage).toUint32()));
         builder.setHwAddress(ByteBufUtils.readIetfMacAddress(rawMessage));
         builder.setConfigV10(createPortConfig(rawMessage.readUnsignedInt()));
         builder.setMaskV10(createPortConfig(rawMessage.readUnsignedInt()));
index 89df5630fac2a7f1d047205e92b053c62c0be5c6..5669d91d06d8c6a52d7ae765af2ebcb2df74147c 100644 (file)
@@ -5,9 +5,11 @@
  * 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;
 
+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;
@@ -30,7 +32,7 @@ public class OF10PortStatusMessageFactory implements OFDeserializer<PortStatusMe
     public PortStatusMessage deserialize(final ByteBuf rawMessage) {
         PortStatusMessageBuilder builder = new PortStatusMessageBuilder();
         builder.setVersion((short) EncodeConstants.OF10_VERSION_ID);
-        builder.setXid(rawMessage.readUnsignedInt());
+        builder.setXid(readUint32(rawMessage));
         builder.setReason(PortReason.forValue(rawMessage.readUnsignedByte()));
         rawMessage.skipBytes(PADDING_IN_PORT_STATUS_HEADER);
         deserializePort(rawMessage, builder);
@@ -38,7 +40,7 @@ public class OF10PortStatusMessageFactory implements OFDeserializer<PortStatusMe
     }
 
     private static void deserializePort(final ByteBuf rawMessage, final PortStatusMessageBuilder builder) {
-        builder.setPortNo((long) rawMessage.readUnsignedShort());
+        builder.setPortNo(readUint16(rawMessage).toUint32());
         builder.setHwAddr(ByteBufUtils.readIetfMacAddress(rawMessage));
         builder.setName(ByteBufUtils.decodeNullTerminatedString(rawMessage, EncodeConstants.MAX_PORT_NAME_LENGTH));
         builder.setConfigV10(OpenflowUtils.createPortConfig(rawMessage.readUnsignedInt()));
index b6b706425e5aa407d46990b9f5f452f63d8b9a20..25b28584c95f45701ae2b7a0979d3d2699cd8bfc 100644 (file)
@@ -5,9 +5,11 @@
  * 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;
 
+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 java.util.ArrayList;
 import java.util.List;
@@ -41,8 +43,8 @@ public class OF10QueueGetConfigReplyMessageFactory implements OFDeserializer<Get
     public GetQueueConfigOutput deserialize(ByteBuf rawMessage) {
         GetQueueConfigOutputBuilder builder = new GetQueueConfigOutputBuilder();
         builder.setVersion((short) EncodeConstants.OF10_VERSION_ID);
-        builder.setXid(rawMessage.readUnsignedInt());
-        builder.setPort(new PortNumber((long) rawMessage.readUnsignedShort()));
+        builder.setXid(readUint32(rawMessage));
+        builder.setPort(new PortNumber(readUint16(rawMessage).toUint32()));
         rawMessage.skipBytes(PADDING_IN_QUEUE_GET_CONFIG_REPLY_HEADER);
         builder.setQueues(createQueuesList(rawMessage));
         return builder.build();
@@ -52,7 +54,7 @@ public class OF10QueueGetConfigReplyMessageFactory implements OFDeserializer<Get
         List<Queues> queuesList = new ArrayList<>();
         while (input.readableBytes() > 0) {
             QueuesBuilder queueBuilder = new QueuesBuilder();
-            queueBuilder.setQueueId(new QueueId(input.readUnsignedInt()));
+            queueBuilder.setQueueId(new QueueId(readUint32(input)));
             int length = input.readUnsignedShort();
             input.skipBytes(PADDING_IN_PACKET_QUEUE_HEADER);
             queueBuilder.setQueueProperty(createPropertiesList(input, length - PACKET_QUEUE_HEADER_LENGTH));
@@ -72,7 +74,7 @@ public class OF10QueueGetConfigReplyMessageFactory implements OFDeserializer<Get
             input.skipBytes(PADDING_IN_QUEUE_PROPERTY_HEADER);
             if (property.equals(QueueProperties.OFPQTMINRATE)) {
                 propertiesBuilder.addAugmentation(new RateQueuePropertyBuilder()
-                    .setRate(input.readUnsignedShort())
+                    .setRate(readUint16(input))
                     .build());
                 input.skipBytes(PADDING_IN_RATE_QUEUE_PROPERTY);
             }
index 09a1db6424be7b7777c80d3590e52c85244200ba..38106567c271e110627fd10eff234b7e0a19378e 100644 (file)
@@ -5,12 +5,15 @@
  * 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;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint16;
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint64;
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint8;
+
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import io.netty.buffer.ByteBuf;
-import java.math.BigInteger;
 import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.List;
@@ -92,7 +95,7 @@ public class OF10StatsReplyMessageFactory implements OFDeserializer<MultipartRep
 
         MultipartReplyMessageBuilder builder = new MultipartReplyMessageBuilder();
         builder.setVersion((short) EncodeConstants.OF10_VERSION_ID);
-        builder.setXid(rawMessage.readUnsignedInt());
+        builder.setXid(readUint32(rawMessage));
         int type = rawMessage.readUnsignedShort();
         builder.setType(MultipartType.forValue(type));
         builder.setFlags(new MultipartRequestFlags((rawMessage.readUnsignedShort() & 0x01) != 0));
@@ -158,26 +161,20 @@ public class OF10StatsReplyMessageFactory implements OFDeserializer<MultipartRep
         while (input.readableBytes() > 0) {
             FlowStatsBuilder flowStatsBuilder = new FlowStatsBuilder();
             final int length = input.readUnsignedShort();
-            flowStatsBuilder.setTableId(input.readUnsignedByte());
+            flowStatsBuilder.setTableId(readUint8(input));
             input.skipBytes(PADDING_IN_FLOW_STATS_HEADER);
             OFDeserializer<MatchV10> matchDeserializer = registry.getDeserializer(
                     new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, EncodeConstants.EMPTY_VALUE, MatchV10.class));
             flowStatsBuilder.setMatchV10(matchDeserializer.deserialize(input));
-            flowStatsBuilder.setDurationSec(input.readUnsignedInt());
-            flowStatsBuilder.setDurationNsec(input.readUnsignedInt());
-            flowStatsBuilder.setPriority(input.readUnsignedShort());
-            flowStatsBuilder.setIdleTimeout(input.readUnsignedShort());
-            flowStatsBuilder.setHardTimeout(input.readUnsignedShort());
+            flowStatsBuilder.setDurationSec(readUint32(input));
+            flowStatsBuilder.setDurationNsec(readUint32(input));
+            flowStatsBuilder.setPriority(readUint16(input));
+            flowStatsBuilder.setIdleTimeout(readUint16(input));
+            flowStatsBuilder.setHardTimeout(readUint16(input));
             input.skipBytes(PADDING_IN_FLOW_STATS_HEADER_02);
-            byte[] cookie = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-            input.readBytes(cookie);
-            flowStatsBuilder.setCookie(new BigInteger(1, cookie));
-            byte[] packetCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-            input.readBytes(packetCount);
-            flowStatsBuilder.setPacketCount(new BigInteger(1, packetCount));
-            byte[] byteCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-            input.readBytes(byteCount);
-            flowStatsBuilder.setByteCount(new BigInteger(1, byteCount));
+            flowStatsBuilder.setCookie(readUint64(input));
+            flowStatsBuilder.setPacketCount(readUint64(input));
+            flowStatsBuilder.setByteCount(readUint64(input));
             CodeKeyMaker keyMaker = CodeKeyMakerFactory.createActionsKeyMaker(EncodeConstants.OF10_VERSION_ID);
             List<Action> actions = ListDeserializer.deserializeList(EncodeConstants.OF10_VERSION_ID,
                     length - LENGTH_OF_FLOW_STATS, input, keyMaker, registry);
@@ -192,13 +189,9 @@ public class OF10StatsReplyMessageFactory implements OFDeserializer<MultipartRep
     private static MultipartReplyAggregateCase setAggregate(ByteBuf input) {
         final MultipartReplyAggregateCaseBuilder caseBuilder = new MultipartReplyAggregateCaseBuilder();
         MultipartReplyAggregateBuilder builder = new MultipartReplyAggregateBuilder();
-        byte[] packetCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-        input.readBytes(packetCount);
-        builder.setPacketCount(new BigInteger(1, packetCount));
-        byte[] byteCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-        input.readBytes(byteCount);
-        builder.setByteCount(new BigInteger(1, byteCount));
-        builder.setFlowCount(input.readUnsignedInt());
+        builder.setPacketCount(readUint64(input));
+        builder.setByteCount(readUint64(input));
+        builder.setFlowCount(readUint32(input));
         input.skipBytes(PADDING_IN_AGGREGATE_HEADER);
         caseBuilder.setMultipartReplyAggregate(builder.build());
         return caseBuilder.build();
@@ -211,21 +204,17 @@ public class OF10StatsReplyMessageFactory implements OFDeserializer<MultipartRep
         // TODO - replace ">= TABLE_STATS_LENGTH" with "> 0" after fix in OVS switch
         while (input.readableBytes() >= TABLE_STATS_LENGTH) {
             TableStatsBuilder tableStatsBuilder = new TableStatsBuilder();
-            tableStatsBuilder.setTableId(input.readUnsignedByte());
+            tableStatsBuilder.setTableId(readUint8(input));
             input.skipBytes(PADDING_IN_TABLE_HEADER);
             tableStatsBuilder.setName(ByteBufUtils.decodeNullTerminatedString(input, MAX_TABLE_NAME_LENGTH));
             long wildcards = input.readUnsignedInt();
             tableStatsBuilder.setWildcards(OF10MatchDeserializer.createWildcards(wildcards));
             tableStatsBuilder.setNwSrcMask(OF10MatchDeserializer.decodeNwSrcMask(wildcards));
             tableStatsBuilder.setNwDstMask(OF10MatchDeserializer.decodeNwDstMask(wildcards));
-            tableStatsBuilder.setMaxEntries(input.readUnsignedInt());
-            tableStatsBuilder.setActiveCount(input.readUnsignedInt());
-            byte[] lookupCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-            input.readBytes(lookupCount);
-            tableStatsBuilder.setLookupCount(new BigInteger(1, lookupCount));
-            byte[] matchedCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-            input.readBytes(matchedCount);
-            tableStatsBuilder.setMatchedCount(new BigInteger(1, matchedCount));
+            tableStatsBuilder.setMaxEntries(readUint32(input));
+            tableStatsBuilder.setActiveCount(readUint32(input));
+            tableStatsBuilder.setLookupCount(readUint64(input));
+            tableStatsBuilder.setMatchedCount(readUint64(input));
             tableStatsList.add(tableStatsBuilder.build());
         }
         input.skipBytes(input.readableBytes());
@@ -240,44 +229,20 @@ public class OF10StatsReplyMessageFactory implements OFDeserializer<MultipartRep
         List<PortStats> portStatsList = new ArrayList<>();
         while (input.readableBytes() > 0) {
             PortStatsBuilder portStatsBuilder = new PortStatsBuilder();
-            portStatsBuilder.setPortNo((long) input.readUnsignedShort());
+            portStatsBuilder.setPortNo(readUint16(input).toUint32());
             input.skipBytes(PADDING_IN_PORT_STATS_HEADER);
-            byte[] rxPackets = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-            input.readBytes(rxPackets);
-            portStatsBuilder.setRxPackets(new BigInteger(1, rxPackets));
-            byte[] txPackets = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-            input.readBytes(txPackets);
-            portStatsBuilder.setTxPackets(new BigInteger(1, txPackets));
-            byte[] rxBytes = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-            input.readBytes(rxBytes);
-            portStatsBuilder.setRxBytes(new BigInteger(1, rxBytes));
-            byte[] txBytes = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-            input.readBytes(txBytes);
-            portStatsBuilder.setTxBytes(new BigInteger(1, txBytes));
-            byte[] rxDropped = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-            input.readBytes(rxDropped);
-            portStatsBuilder.setRxDropped(new BigInteger(1, rxDropped));
-            byte[] txDropped = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-            input.readBytes(txDropped);
-            portStatsBuilder.setTxDropped(new BigInteger(1, txDropped));
-            byte[] rxErrors = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-            input.readBytes(rxErrors);
-            portStatsBuilder.setRxErrors(new BigInteger(1, rxErrors));
-            byte[] txErrors = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-            input.readBytes(txErrors);
-            portStatsBuilder.setTxErrors(new BigInteger(1, txErrors));
-            byte[] rxFrameErr = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-            input.readBytes(rxFrameErr);
-            portStatsBuilder.setRxFrameErr(new BigInteger(1, rxFrameErr));
-            byte[] rxOverErr = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-            input.readBytes(rxOverErr);
-            portStatsBuilder.setRxOverErr(new BigInteger(1, rxOverErr));
-            byte[] rxCrcErr = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-            input.readBytes(rxCrcErr);
-            portStatsBuilder.setRxCrcErr(new BigInteger(1, rxCrcErr));
-            byte[] collisions = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-            input.readBytes(collisions);
-            portStatsBuilder.setCollisions(new BigInteger(1, collisions));
+            portStatsBuilder.setRxPackets(readUint64(input));
+            portStatsBuilder.setTxPackets(readUint64(input));
+            portStatsBuilder.setRxBytes(readUint64(input));
+            portStatsBuilder.setTxBytes(readUint64(input));
+            portStatsBuilder.setRxDropped(readUint64(input));
+            portStatsBuilder.setTxDropped(readUint64(input));
+            portStatsBuilder.setRxErrors(readUint64(input));
+            portStatsBuilder.setTxErrors(readUint64(input));
+            portStatsBuilder.setRxFrameErr(readUint64(input));
+            portStatsBuilder.setRxOverErr(readUint64(input));
+            portStatsBuilder.setRxCrcErr(readUint64(input));
+            portStatsBuilder.setCollisions(readUint64(input));
             portStatsList.add(portStatsBuilder.build());
         }
         builder.setPortStats(portStatsList);
@@ -291,18 +256,12 @@ public class OF10StatsReplyMessageFactory implements OFDeserializer<MultipartRep
         List<QueueStats> queueStatsList = new ArrayList<>();
         while (input.readableBytes() > 0) {
             QueueStatsBuilder queueStatsBuilder = new QueueStatsBuilder();
-            queueStatsBuilder.setPortNo((long) input.readUnsignedShort());
+            queueStatsBuilder.setPortNo(readUint16(input).toUint32());
             input.skipBytes(PADDING_IN_QUEUE_HEADER);
-            queueStatsBuilder.setQueueId(input.readUnsignedInt());
-            byte[] txBytes = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-            input.readBytes(txBytes);
-            queueStatsBuilder.setTxBytes(new BigInteger(1, txBytes));
-            byte[] txPackets = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-            input.readBytes(txPackets);
-            queueStatsBuilder.setTxPackets(new BigInteger(1, txPackets));
-            byte[] txErrors = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-            input.readBytes(txErrors);
-            queueStatsBuilder.setTxErrors(new BigInteger(1, txErrors));
+            queueStatsBuilder.setQueueId(readUint32(input));
+            queueStatsBuilder.setTxBytes(readUint64(input));
+            queueStatsBuilder.setTxPackets(readUint64(input));
+            queueStatsBuilder.setTxErrors(readUint64(input));
             queueStatsList.add(queueStatsBuilder.build());
         }
         builder.setQueueStats(queueStatsList);
index f59e5423715646c1432e818b6b633225239aed8a..9fa7a55b773900832679324662ab2df2366b81bf 100644 (file)
@@ -7,6 +7,10 @@
  */
 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 static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint8;
+
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import io.netty.buffer.ByteBuf;
 import java.util.Objects;
@@ -61,7 +65,7 @@ public class OF10StatsRequestInputFactory
 
         MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
         builder.setVersion((short) EncodeConstants.OF10_VERSION_ID);
-        builder.setXid(rawMessage.readUnsignedInt());
+        builder.setXid(readUint32(rawMessage));
         int type = rawMessage.readUnsignedShort();
         builder.setType(getMultipartType(type));
         builder.setFlags(getMultipartRequestFlags(rawMessage.readUnsignedShort()));
@@ -103,9 +107,9 @@ public class OF10StatsRequestInputFactory
     private static MultipartRequestQueueCase setQueue(ByteBuf input) {
         final MultipartRequestQueueCaseBuilder caseBuilder = new MultipartRequestQueueCaseBuilder();
         MultipartRequestQueueBuilder queueBuilder = new MultipartRequestQueueBuilder();
-        queueBuilder.setPortNo((long) input.readUnsignedShort());
+        queueBuilder.setPortNo(readUint16(input).toUint32());
         input.skipBytes(2);
-        queueBuilder.setQueueId(input.readUnsignedInt());
+        queueBuilder.setQueueId(readUint32(input));
         caseBuilder.setMultipartRequestQueue(queueBuilder.build());
         return caseBuilder.build();
     }
@@ -113,7 +117,7 @@ public class OF10StatsRequestInputFactory
     private static MultipartRequestPortStatsCase setPortStats(ByteBuf input) {
         MultipartRequestPortStatsCaseBuilder caseBuilder = new MultipartRequestPortStatsCaseBuilder();
         MultipartRequestPortStatsBuilder portBuilder = new MultipartRequestPortStatsBuilder();
-        portBuilder.setPortNo((long) input.readUnsignedShort());
+        portBuilder.setPortNo(readUint16(input).toUint32());
         caseBuilder.setMultipartRequestPortStats(portBuilder.build());
         return caseBuilder.build();
     }
@@ -132,9 +136,9 @@ public class OF10StatsRequestInputFactory
         OFDeserializer<MatchV10> matchDeserializer = registry.getDeserializer(
                 new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, EncodeConstants.EMPTY_VALUE, MatchV10.class));
         aggregateBuilder.setMatchV10(matchDeserializer.deserialize(input));
-        aggregateBuilder.setTableId(input.readUnsignedByte());
+        aggregateBuilder.setTableId(readUint8(input));
         input.skipBytes(AGGREGATE_PADDING_1);
-        aggregateBuilder.setOutPort((long) input.readUnsignedShort());
+        aggregateBuilder.setOutPort(readUint16(input).toUint32());
         caseBuilder.setMultipartRequestAggregate(aggregateBuilder.build());
         return caseBuilder.build();
     }
@@ -145,9 +149,9 @@ public class OF10StatsRequestInputFactory
         OFDeserializer<MatchV10> matchDeserializer = registry.getDeserializer(
                 new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, EncodeConstants.EMPTY_VALUE, MatchV10.class));
         flowBuilder.setMatchV10(matchDeserializer.deserialize(input));
-        flowBuilder.setTableId(input.readUnsignedByte());
+        flowBuilder.setTableId(readUint8(input));
         input.skipBytes(FLOW_PADDING_1);
-        flowBuilder.setOutPort((long) input.readUnsignedShort());
+        flowBuilder.setOutPort(readUint16(input).toUint32());
         caseBuilder.setMultipartRequestFlow(flowBuilder.build());
         return caseBuilder.build();
     }
index b9e7fae677f594695b108c6be54536e639819c1d..cbb353c8aeedffdee040216480f653e44c8cbe15 100644 (file)
@@ -5,12 +5,15 @@
  * 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;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint16;
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint64;
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint8;
+
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import io.netty.buffer.ByteBuf;
-import java.math.BigInteger;
 import java.util.Objects;
 import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
 import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistryInjector;
@@ -44,14 +47,12 @@ public class PacketInMessageFactory implements OFDeserializer<PacketInMessage>,
 
         PacketInMessageBuilder builder = new PacketInMessageBuilder();
         builder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
-        builder.setXid(rawMessage.readUnsignedInt());
-        builder.setBufferId(rawMessage.readUnsignedInt());
-        builder.setTotalLen(rawMessage.readUnsignedShort());
+        builder.setXid(readUint32(rawMessage));
+        builder.setBufferId(readUint32(rawMessage));
+        builder.setTotalLen(readUint16(rawMessage));
         builder.setReason(PacketInReason.forValue(rawMessage.readUnsignedByte()));
-        builder.setTableId(new TableId((long)rawMessage.readUnsignedByte()));
-        byte[] cookie = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-        rawMessage.readBytes(cookie);
-        builder.setCookie(new BigInteger(1, cookie));
+        builder.setTableId(new TableId(readUint8(rawMessage).toUint32()));
+        builder.setCookie(readUint64(rawMessage));
         OFDeserializer<Match> matchDeserializer = registry.getDeserializer(MATCH_KEY);
         builder.setMatch(matchDeserializer.deserialize(rawMessage));
         rawMessage.skipBytes(PADDING_IN_PACKET_IN_HEADER);
index 44449d65c08ab8b4b07f942fc3a6f2462136c773..b43891a3f42f207ff1b53aaf3beed4093ed07b78 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+
 import io.netty.buffer.ByteBuf;
 import java.util.List;
 import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
@@ -30,9 +32,9 @@ public class PacketOutInputMessageFactory implements OFDeserializer<PacketOutInp
     public PacketOutInput deserialize(ByteBuf rawMessage) {
         PacketOutInputBuilder builder = new PacketOutInputBuilder();
         builder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
-        builder.setXid(rawMessage.readUnsignedInt());
-        builder.setBufferId(rawMessage.readUnsignedInt());
-        builder.setInPort(new PortNumber(rawMessage.readUnsignedInt()));
+        builder.setXid(readUint32(rawMessage));
+        builder.setBufferId(readUint32(rawMessage));
+        builder.setInPort(new PortNumber(readUint32(rawMessage)));
         int actionsLen = rawMessage.readShort();
         rawMessage.skipBytes(PADDING);
         CodeKeyMaker keyMaker = CodeKeyMakerFactory.createActionsKeyMaker(EncodeConstants.OF13_VERSION_ID);
index 45b69ef0e2d5cdf64ea5802b855eb4dd604edeb9..9b1dfa0e43d354831bbeaa8cccc3cbfa9a26edf2 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
 
+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;
@@ -32,8 +34,8 @@ public class PortModInputMessageFactory implements OFDeserializer<PortModInput>
     public PortModInput deserialize(final ByteBuf rawMessage) {
         PortModInputBuilder builder = new PortModInputBuilder();
         builder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
-        builder.setXid(rawMessage.readUnsignedInt());
-        builder.setPortNo(new PortNumber(rawMessage.readUnsignedInt()));
+        builder.setXid(readUint32(rawMessage));
+        builder.setPortNo(new PortNumber(readUint32(rawMessage)));
         rawMessage.skipBytes(PADDING_IN_PORT_MOD_MESSAGE_1);
         builder.setHwAddress(ByteBufUtils.readIetfMacAddress(rawMessage));
         rawMessage.skipBytes(PADDING_IN_PORT_MOD_MESSAGE_2);
index 6eb2e23257b5cc6b792fd3cf5e65ee8b6a607fbd..0deb920b05c582f5e82e01a241d5214e574db111 100644 (file)
@@ -8,6 +8,8 @@
 
 package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
 
+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;
@@ -35,10 +37,10 @@ public class PortStatusMessageFactory implements OFDeserializer<PortStatusMessag
     public PortStatusMessage deserialize(final ByteBuf rawMessage) {
         PortStatusMessageBuilder builder = new PortStatusMessageBuilder();
         builder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
-        builder.setXid(rawMessage.readUnsignedInt());
+        builder.setXid(readUint32(rawMessage));
         builder.setReason(PortReason.forValue(rawMessage.readUnsignedByte()));
         rawMessage.skipBytes(PADDING_IN_PORT_STATUS_HEADER);
-        builder.setPortNo(rawMessage.readUnsignedInt());
+        builder.setPortNo(readUint32(rawMessage));
         rawMessage.skipBytes(PADDING_IN_OFP_PORT_HEADER_1);
         builder.setHwAddr(ByteBufUtils.readIetfMacAddress(rawMessage));
         rawMessage.skipBytes(PADDING_IN_OFP_PORT_HEADER_2);
@@ -49,8 +51,8 @@ public class PortStatusMessageFactory implements OFDeserializer<PortStatusMessag
         builder.setAdvertisedFeatures(createPortFeatures(rawMessage.readUnsignedInt()));
         builder.setSupportedFeatures(createPortFeatures(rawMessage.readUnsignedInt()));
         builder.setPeerFeatures(createPortFeatures(rawMessage.readUnsignedInt()));
-        builder.setCurrSpeed(rawMessage.readUnsignedInt());
-        builder.setMaxSpeed(rawMessage.readUnsignedInt());
+        builder.setCurrSpeed(readUint32(rawMessage));
+        builder.setMaxSpeed(readUint32(rawMessage));
         return builder.build();
     }
 
index d3e8c33b41d6f1922b5b7426b61e9d179f224e54..8ff1403c0906dce9798122fd16df320968e927c8 100644 (file)
@@ -5,9 +5,11 @@
  * 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;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint16;
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import io.netty.buffer.ByteBuf;
 import java.util.ArrayList;
@@ -52,8 +54,8 @@ public class QueueGetConfigReplyMessageFactory implements OFDeserializer<GetQueu
 
         GetQueueConfigOutputBuilder builder = new GetQueueConfigOutputBuilder();
         builder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
-        builder.setXid(rawMessage.readUnsignedInt());
-        builder.setPort(new PortNumber(rawMessage.readUnsignedInt()));
+        builder.setXid(readUint32(rawMessage));
+        builder.setPort(new PortNumber(readUint32(rawMessage)));
         rawMessage.skipBytes(PADDING_IN_QUEUE_GET_CONFIG_REPLY_HEADER);
         builder.setQueues(createQueuesList(rawMessage));
         return builder.build();
@@ -63,8 +65,8 @@ public class QueueGetConfigReplyMessageFactory implements OFDeserializer<GetQueu
         List<Queues> queuesList = new ArrayList<>();
         while (input.readableBytes() > 0) {
             QueuesBuilder queueBuilder = new QueuesBuilder();
-            queueBuilder.setQueueId(new QueueId(input.readUnsignedInt()));
-            queueBuilder.setPort(new PortNumber(input.readUnsignedInt()));
+            queueBuilder.setQueueId(new QueueId(readUint32(input)));
+            queueBuilder.setPort(new PortNumber(readUint32(input)));
             int length = input.readUnsignedShort();
             input.skipBytes(PADDING_IN_PACKET_QUEUE_HEADER);
             queueBuilder.setQueueProperty(createPropertiesList(input, length - PACKET_QUEUE_LENGTH));
@@ -86,7 +88,7 @@ public class QueueGetConfigReplyMessageFactory implements OFDeserializer<GetQueu
             input.skipBytes(PADDING_IN_QUEUE_PROPERTY_HEADER);
             if (property.equals(QueueProperties.OFPQTMINRATE) || property.equals(QueueProperties.OFPQTMAXRATE)) {
                 propertiesBuilder.addAugmentation(new RateQueuePropertyBuilder()
-                    .setRate(input.readUnsignedShort())
+                    .setRate(readUint16(input))
                     .build());
                 input.skipBytes(PADDING_IN_RATE_QUEUE_PROPERTY);
             } else if (property.equals(QueueProperties.OFPQTEXPERIMENTER)) {
index ce54a8929df30d30574f6128dec67f5130820b07..16910fa6c4c9b3ff0b37b6a048098e412670489d 100644 (file)
@@ -5,11 +5,12 @@
  * 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;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint64;
+
 import io.netty.buffer.ByteBuf;
-import java.math.BigInteger;
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ControllerRole;
@@ -30,12 +31,10 @@ public class RoleReplyMessageFactory implements OFDeserializer<RoleRequestOutput
     public RoleRequestOutput deserialize(ByteBuf rawMessage) {
         RoleRequestOutputBuilder builder = new RoleRequestOutputBuilder();
         builder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
-        builder.setXid(rawMessage.readUnsignedInt());
+        builder.setXid(readUint32(rawMessage));
         builder.setRole(ControllerRole.forValue((int) rawMessage.readUnsignedInt()));
         rawMessage.skipBytes(PADDING_IN_ROLE_REPLY_HEADER);
-        byte[] generationID = new byte[8];
-        rawMessage.readBytes(generationID);
-        builder.setGenerationId(new BigInteger(1, generationID));
+        builder.setGenerationId(readUint64(rawMessage));
         return builder.build();
     }
 }
index 02f496f66f6566a1a6a79696467155fadb128413..06a2bb25b294d1e5a561c0575e8d2b5fc1f88795 100644 (file)
@@ -7,8 +7,10 @@
  */
 package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint64;
+
 import io.netty.buffer.ByteBuf;
-import java.math.BigInteger;
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ControllerRole;
@@ -28,12 +30,10 @@ public class RoleRequestInputMessageFactory implements OFDeserializer<RoleReques
     public RoleRequestInput deserialize(ByteBuf rawMessage) {
         RoleRequestInputBuilder builder = new RoleRequestInputBuilder();
         builder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
-        builder.setXid(rawMessage.readUnsignedInt());
+        builder.setXid(readUint32(rawMessage));
         builder.setRole(ControllerRole.forValue(rawMessage.readInt()));
         rawMessage.skipBytes(PADDING);
-        byte[] generationId = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-        rawMessage.readBytes(generationId);
-        builder.setGenerationId(new BigInteger(1, generationId));
+        builder.setGenerationId(readUint64(rawMessage));
         return builder.build();
     }
 }
index a1a6270624c3cd7fc669635310a1ef3d360609ce..4f7922d0571591dc9dafa43704104cff12ca622a 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+
 import io.netty.buffer.ByteBuf;
 import java.util.ArrayList;
 import java.util.List;
@@ -37,7 +39,7 @@ public class SetAsyncInputMessageFactory implements OFDeserializer<SetAsyncInput
     public SetAsyncInput deserialize(ByteBuf rawMessage) {
         SetAsyncInputBuilder builder = new SetAsyncInputBuilder();
         builder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
-        builder.setXid(rawMessage.readUnsignedInt());
+        builder.setXid(readUint32(rawMessage));
         builder.setPacketInMask(decodePacketInMask(rawMessage));
         builder.setPortStatusMask(decodePortStatusMask(rawMessage));
         builder.setFlowRemovedMask(decodeFlowRemovedMask(rawMessage));
index 5dc4c9b50717d5c32da225efa44281c27971e57a..ad448d1594cc0b883e21032491cfd7eab4370862 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.impl.util.VersionAssignableFactory;
@@ -25,9 +28,9 @@ public class SetConfigInputMessageFactory extends VersionAssignableFactory imple
     public SetConfigInput deserialize(ByteBuf rawMessage) {
         SetConfigInputBuilder builder = new SetConfigInputBuilder();
         builder.setVersion(getVersion());
-        builder.setXid(rawMessage.readUnsignedInt());
+        builder.setXid(readUint32(rawMessage));
         builder.setFlags(SwitchConfigFlag.forValue(rawMessage.readUnsignedShort()));
-        builder.setMissSendLen(rawMessage.readUnsignedShort());
+        builder.setMissSendLen(readUint16(rawMessage));
         return builder.build();
     }
 
index 2660260184bde55cda4fc67fccdcdc448ee8c000..420a7e0f38efb562f96d1cfc81d4f39bbdbf3112 100644 (file)
@@ -7,6 +7,9 @@
  */
 package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint8;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
@@ -28,8 +31,8 @@ public class TableModInputMessageFactory implements OFDeserializer<TableModInput
     public TableModInput deserialize(ByteBuf rawMessage) {
         TableModInputBuilder builder = new TableModInputBuilder();
         builder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
-        builder.setXid(rawMessage.readUnsignedInt());
-        builder.setTableId(new TableId((long) rawMessage.readUnsignedByte()));
+        builder.setXid(readUint32(rawMessage));
+        builder.setTableId(new TableId(readUint8(rawMessage).toUint32()));
         rawMessage.skipBytes(PADDING_IN_TABLE_MOD_MESSAGE);
         builder.setConfig(createTableConfig(rawMessage.readUnsignedInt()));
         return builder.build();
index 21955b769e01dc83cae45397fbb540e9b7c5c982..b5519f14791752620016f8bd16bebf23ac399d0b 100644 (file)
@@ -5,9 +5,10 @@
  * 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;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import io.netty.buffer.ByteBuf;
 import java.util.Objects;
@@ -20,6 +21,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev13
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessageBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.experimenter.core.ExperimenterDataOfChoice;
+import org.opendaylight.yangtools.yang.common.Uint32;
 
 /**
  * Translates ExperimenterMessages.
@@ -36,7 +38,7 @@ public class VendorMessageFactory implements OFDeserializer<ExperimenterMessage>
     public ExperimenterMessage deserialize(ByteBuf message) {
         Objects.requireNonNull(deserializerRegistry);
 
-        final long xid = message.readUnsignedInt();
+        final Uint32 xid = readUint32(message);
         final long expId = message.readUnsignedInt();
         OFDeserializer<ExperimenterDataOfChoice> deserializer = deserializerRegistry.getDeserializer(
                 ExperimenterDeserializerKeyFactory.createVendorMessageDeserializerKey(
index d58f1a58296060ae78bf9dfe2f57b17097662f46..96038dd744d007b8508ff0bbd53502013d21ad1f 100644 (file)
@@ -5,9 +5,10 @@
  * 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.instruction;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint8;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderDeserializer;
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
@@ -28,22 +29,18 @@ public class GoToTableInstructionDeserializer  implements OFDeserializer<Instruc
 
     @Override
     public Instruction deserialize(ByteBuf input) {
-        final InstructionBuilder builder = new InstructionBuilder();
-        GotoTableCaseBuilder caseBuilder = new GotoTableCaseBuilder();
-        GotoTableBuilder instructionBuilder = new GotoTableBuilder();
         input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
-        instructionBuilder.setTableId(input.readUnsignedByte());
-        caseBuilder.setGotoTable(instructionBuilder.build());
-        builder.setInstructionChoice(caseBuilder.build());
+        final InstructionBuilder builder = new InstructionBuilder()
+                .setInstructionChoice(new GotoTableCaseBuilder()
+                    .setGotoTable(new GotoTableBuilder().setTableId(readUint8(input)).build())
+                    .build());
         input.skipBytes(InstructionConstants.PADDING_IN_GOTO_TABLE);
         return builder.build();
     }
 
     @Override
     public Instruction deserializeHeader(ByteBuf input) {
-        InstructionBuilder builder = new InstructionBuilder();
         input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
-        builder.setInstructionChoice(new GotoTableCaseBuilder().build());
-        return builder.build();
+        return new InstructionBuilder().setInstructionChoice(new GotoTableCaseBuilder().build()).build();
     }
 }
index 25b0b514eacc16a62d09cbc04cc99df66717c195..a8794861219f70eab8b9e351ea62bdfb7d1ca9ef 100644 (file)
@@ -5,9 +5,10 @@
  * 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.instruction;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderDeserializer;
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
@@ -27,22 +28,17 @@ public class MeterInstructionDeserializer implements OFDeserializer<Instruction>
 
     @Override
     public Instruction deserialize(ByteBuf input) {
-        final InstructionBuilder builder = new InstructionBuilder();
         input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
-        MeterCaseBuilder caseBuilder = new MeterCaseBuilder();
-        MeterBuilder instructionBuilder = new MeterBuilder();
-        instructionBuilder.setMeterId(input.readUnsignedInt());
-        caseBuilder.setMeter(instructionBuilder.build());
-        builder.setInstructionChoice(caseBuilder.build());
-        return builder.build();
+        return new InstructionBuilder()
+                .setInstructionChoice(new MeterCaseBuilder()
+                    .setMeter(new MeterBuilder().setMeterId(readUint32(input)).build())
+                    .build())
+                .build();
     }
 
     @Override
     public Instruction deserializeHeader(ByteBuf input) {
-        InstructionBuilder builder = new InstructionBuilder();
         input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
-        builder.setInstructionChoice(new MeterCaseBuilder().build());
-        return builder.build();
+        return new InstructionBuilder().setInstructionChoice(new MeterCaseBuilder().build()).build();
     }
-
 }
index 2db74cb9f217e7ba38145909d376001123029f58..9a0633dec9a1694a032df09f842db337d8525d27 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint16;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.ArpOp;
@@ -34,11 +36,9 @@ public class OxmArpOpDeserializer extends AbstractOxmMatchEntryDeserializer
     }
 
     private static void addArpOpValue(ByteBuf input, MatchEntryBuilder builder) {
-        ArpOpCaseBuilder caseBuilder = new ArpOpCaseBuilder();
-        ArpOpBuilder opBuilder = new ArpOpBuilder();
-        opBuilder.setOpCode(input.readUnsignedShort());
-        caseBuilder.setArpOp(opBuilder.build());
-        builder.setMatchEntryValue(caseBuilder.build());
+        builder.setMatchEntryValue(new ArpOpCaseBuilder()
+            .setArpOp(new ArpOpBuilder().setOpCode(readUint16(input)).build())
+            .build());
     }
 
     @Override
index 19bfdb599b7fecebf458b7fbaa87cd825883b8ce..9f0605abc52efbd7f33abc954357ef0adf081977 100644 (file)
@@ -18,6 +18,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.matc
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.EthTypeCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.eth.type._case.EthTypeBuilder;
+import org.opendaylight.yangtools.yang.common.netty.ByteBufUtils;
 
 /**
  * Translates OxmEthType messages.
@@ -35,11 +36,9 @@ public class OxmEthTypeDeserializer extends AbstractOxmMatchEntryDeserializer
     }
 
     private static void addEthTypeValue(ByteBuf input, MatchEntryBuilder builder) {
-        EthTypeCaseBuilder caseBuilder = new EthTypeCaseBuilder();
-        EthTypeBuilder ethBuilder = new EthTypeBuilder();
-        ethBuilder.setEthType(new EtherType(input.readUnsignedShort()));
-        caseBuilder.setEthType(ethBuilder.build());
-        builder.setMatchEntryValue(caseBuilder.build());
+        builder.setMatchEntryValue(new EthTypeCaseBuilder()
+            .setEthType(new EthTypeBuilder().setEthType(new EtherType(ByteBufUtils.readUint16(input))).build())
+            .build());
     }
 
     @Override
index 4f6ec5a01024a0cd255324a0ff1879b449d3c8c8..aee94b2aff9c1410beb3bc6f5d29eb6b98cd2f43 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint8;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Icmpv4Code;
@@ -14,7 +16,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Matc
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Icmpv4CodeCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.icmpv4.code._case.Icmpv4CodeBuilder;
 
@@ -28,17 +29,11 @@ public class OxmIcmpv4CodeDeserializer extends AbstractOxmMatchEntryDeserializer
 
     @Override
     public MatchEntry deserialize(ByteBuf input) {
-        MatchEntryBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
-        addIcmpv4CodeValue(input, builder);
-        return builder.build();
-    }
-
-    private static void addIcmpv4CodeValue(ByteBuf input, MatchEntryBuilder builder) {
-        Icmpv4CodeCaseBuilder caseBuilder = new Icmpv4CodeCaseBuilder();
-        Icmpv4CodeBuilder icmpBuilder = new Icmpv4CodeBuilder();
-        icmpBuilder.setIcmpv4Code(input.readUnsignedByte());
-        caseBuilder.setIcmpv4Code(icmpBuilder.build());
-        builder.setMatchEntryValue(caseBuilder.build());
+        return processHeader(getOxmClass(), getOxmField(), input)
+                .setMatchEntryValue(new Icmpv4CodeCaseBuilder()
+                    .setIcmpv4Code(new Icmpv4CodeBuilder().setIcmpv4Code(readUint8(input)).build())
+                    .build())
+                .build();
     }
 
     @Override
@@ -50,5 +45,4 @@ public class OxmIcmpv4CodeDeserializer extends AbstractOxmMatchEntryDeserializer
     protected Class<? extends OxmClassBase> getOxmClass() {
         return OpenflowBasicClass.class;
     }
-
 }
index 8341b4bdf86e1d3f8277bdc875f05a6ed0111fe3..7b110387b29d83cda9efc89ec6bed05955b0605e 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint8;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Icmpv4Type;
@@ -14,7 +16,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Matc
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Icmpv4TypeCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.icmpv4.type._case.Icmpv4TypeBuilder;
 
@@ -28,17 +29,11 @@ public class OxmIcmpv4TypeDeserializer extends AbstractOxmMatchEntryDeserializer
 
     @Override
     public MatchEntry deserialize(ByteBuf input) {
-        MatchEntryBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
-        addIcmpv4TypeValue(input, builder);
-        return builder.build();
-    }
-
-    private static void addIcmpv4TypeValue(ByteBuf input, MatchEntryBuilder builder) {
-        Icmpv4TypeCaseBuilder caseBuilder = new Icmpv4TypeCaseBuilder();
-        Icmpv4TypeBuilder icmpBuilder = new Icmpv4TypeBuilder();
-        icmpBuilder.setIcmpv4Type(input.readUnsignedByte());
-        caseBuilder.setIcmpv4Type(icmpBuilder.build());
-        builder.setMatchEntryValue(caseBuilder.build());
+        return processHeader(getOxmClass(), getOxmField(), input)
+                .setMatchEntryValue(new Icmpv4TypeCaseBuilder()
+                    .setIcmpv4Type(new Icmpv4TypeBuilder().setIcmpv4Type(readUint8(input)).build())
+                    .build())
+                .build();
     }
 
     @Override
index 5ce6b1883ff5ba9b51f1b1c655d11f3521c92dff..4e5284b0234b20190ae4426e732122a26547eec9 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint8;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Icmpv6Code;
@@ -14,7 +16,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Matc
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Icmpv6CodeCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.icmpv6.code._case.Icmpv6CodeBuilder;
 
@@ -28,17 +29,11 @@ public class OxmIcmpv6CodeDeserializer extends AbstractOxmMatchEntryDeserializer
 
     @Override
     public MatchEntry deserialize(ByteBuf input) {
-        MatchEntryBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
-        addIcmpv6CodeValue(input, builder);
-        return builder.build();
-    }
-
-    private static void addIcmpv6CodeValue(ByteBuf input, MatchEntryBuilder builder) {
-        Icmpv6CodeCaseBuilder caseBuilder = new Icmpv6CodeCaseBuilder();
-        Icmpv6CodeBuilder icmpBuilder = new Icmpv6CodeBuilder();
-        icmpBuilder.setIcmpv6Code(input.readUnsignedByte());
-        caseBuilder.setIcmpv6Code(icmpBuilder.build());
-        builder.setMatchEntryValue(caseBuilder.build());
+        return processHeader(getOxmClass(), getOxmField(), input)
+                .setMatchEntryValue(new Icmpv6CodeCaseBuilder()
+                    .setIcmpv6Code(new Icmpv6CodeBuilder().setIcmpv6Code(readUint8(input)).build())
+                    .build())
+                .build();
     }
 
     @Override
index 6211f24cdb523574289c47390f28aa1fcf5a8825..c225dfc0cf2b923a6046417bafe72969afd861fa 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint8;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Icmpv6Type;
@@ -14,7 +16,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Matc
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Icmpv6TypeCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.icmpv6.type._case.Icmpv6TypeBuilder;
 
@@ -28,17 +29,11 @@ public class OxmIcmpv6TypeDeserializer extends AbstractOxmMatchEntryDeserializer
 
     @Override
     public MatchEntry deserialize(ByteBuf input) {
-        MatchEntryBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
-        addIcmpv6TypeValue(input, builder);
-        return builder.build();
-    }
-
-    private static void addIcmpv6TypeValue(ByteBuf input, MatchEntryBuilder builder) {
-        Icmpv6TypeCaseBuilder caseBuilder = new Icmpv6TypeCaseBuilder();
-        Icmpv6TypeBuilder icmpBuilder = new Icmpv6TypeBuilder();
-        icmpBuilder.setIcmpv6Type(input.readUnsignedByte());
-        caseBuilder.setIcmpv6Type(icmpBuilder.build());
-        builder.setMatchEntryValue(caseBuilder.build());
+        return processHeader(getOxmClass(), getOxmField(), input)
+                .setMatchEntryValue(new Icmpv6TypeCaseBuilder()
+                    .setIcmpv6Type(new Icmpv6TypeBuilder().setIcmpv6Type(readUint8(input)).build())
+                    .build())
+                .build();
     }
 
     @Override
index 766788c22a33c6292f4b27c45fe8033963ece2f1..6fc4f4dcff394f75b46ff42252d9cbab935521a7 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
 
+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.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;
@@ -35,11 +37,9 @@ public class OxmInPhyPortDeserializer extends AbstractOxmMatchEntryDeserializer
     }
 
     private static void addInPhyPortValue(ByteBuf input, MatchEntryBuilder builder) {
-        InPhyPortCaseBuilder caseBuilder = new InPhyPortCaseBuilder();
-        InPhyPortBuilder inPhyPortBuilder = new InPhyPortBuilder();
-        inPhyPortBuilder.setPortNumber(new PortNumber(input.readUnsignedInt()));
-        caseBuilder.setInPhyPort(inPhyPortBuilder.build());
-        builder.setMatchEntryValue(caseBuilder.build());
+        builder.setMatchEntryValue(new InPhyPortCaseBuilder()
+            .setInPhyPort(new InPhyPortBuilder().setPortNumber(new PortNumber(readUint32(input))).build())
+            .build());
     }
 
     @Override
index 244c9edf8d8ed386c78bbd65c3ae23b0a19288c2..ec25b6e22b9caa6de8b40a4bba9ff0a7d2a599b3 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
 
+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.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;
@@ -35,11 +37,9 @@ public class OxmInPortDeserializer extends AbstractOxmMatchEntryDeserializer
     }
 
     private static void addInPortValue(ByteBuf input, MatchEntryBuilder builder) {
-        InPortCaseBuilder caseBuilder = new InPortCaseBuilder();
-        InPortBuilder inPortBuilder = new InPortBuilder();
-        inPortBuilder.setPortNumber(new PortNumber(input.readUnsignedInt()));
-        caseBuilder.setInPort(inPortBuilder.build());
-        builder.setMatchEntryValue(caseBuilder.build());
+        builder.setMatchEntryValue(new InPortCaseBuilder()
+            .setInPort(new InPortBuilder().setPortNumber(new PortNumber(readUint32(input))).build())
+            .build());
     }
 
     @Override
index 7e79176a59c5627c2baadb3426cf3b4d7d746c2b..3d2161316806bae72d5a30e5de479e4ef9f221d2 100644 (file)
@@ -18,6 +18,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.matc
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.IpDscpCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ip.dscp._case.IpDscpBuilder;
+import org.opendaylight.yangtools.yang.common.netty.ByteBufUtils;
 
 /**
  * Translates OxmIpDscp messages.
@@ -35,11 +36,9 @@ public class OxmIpDscpDeserializer extends AbstractOxmMatchEntryDeserializer
     }
 
     private static void addIpDscpValue(ByteBuf input, MatchEntryBuilder builder) {
-        IpDscpCaseBuilder caseBuilder = new IpDscpCaseBuilder();
-        IpDscpBuilder dscpBuilder = new IpDscpBuilder();
-        dscpBuilder.setDscp(new Dscp(input.readUnsignedByte()));
-        caseBuilder.setIpDscp(dscpBuilder.build());
-        builder.setMatchEntryValue(caseBuilder.build());
+        builder.setMatchEntryValue(new IpDscpCaseBuilder()
+            .setIpDscp(new IpDscpBuilder().setDscp(new Dscp(ByteBufUtils.readUint8(input))).build())
+            .build());
     }
 
     @Override
index 7971cc4117695b83149ad013847716d538bad911..4d38ebe2979dc2eaaad2b66ed521d602059256e7 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint8;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.IpEcn;
@@ -34,11 +36,9 @@ public class OxmIpEcnDeserializer extends AbstractOxmMatchEntryDeserializer
     }
 
     private static void addIpEcnValue(ByteBuf input, MatchEntryBuilder builder) {
-        IpEcnCaseBuilder caseBuilder = new IpEcnCaseBuilder();
-        IpEcnBuilder ecnBuilder = new IpEcnBuilder();
-        ecnBuilder.setEcn(input.readUnsignedByte());
-        caseBuilder.setIpEcn(ecnBuilder.build());
-        builder.setMatchEntryValue(caseBuilder.build());
+        builder.setMatchEntryValue(new IpEcnCaseBuilder()
+            .setIpEcn(new IpEcnBuilder().setEcn(readUint8(input)).build())
+            .build());
     }
 
     @Override
index 7149f7f0d6135b23b56a2e8a41f837865a81ae42..662073d8e11cbcbda266c75a5720afa55cea993f 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint8;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.IpProto;
@@ -34,11 +36,9 @@ public class OxmIpProtoDeserializer extends AbstractOxmMatchEntryDeserializer
     }
 
     private static void addIpProtoValue(ByteBuf input, MatchEntryBuilder builder) {
-        IpProtoCaseBuilder caseBuilder = new IpProtoCaseBuilder();
-        IpProtoBuilder protoBuilder = new IpProtoBuilder();
-        protoBuilder.setProtocolNumber(input.readUnsignedByte());
-        caseBuilder.setIpProto(protoBuilder.build());
-        builder.setMatchEntryValue(caseBuilder.build());
+        builder.setMatchEntryValue(new IpProtoCaseBuilder()
+            .setIpProto(new IpProtoBuilder().setProtocolNumber(readUint8(input)).build())
+            .build());
     }
 
     @Override
index aa588961691143fba5c1d5f18642ac42b610ed9c..b4e97196982246b3d798631880c85000739fb965 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
 
+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;
@@ -38,7 +40,7 @@ public class OxmIpv6FlabelDeserializer extends AbstractOxmMatchEntryDeserializer
     private static void addIpv6FlabelValue(ByteBuf input, MatchEntryBuilder builder) {
         Ipv6FlabelCaseBuilder caseBuilder = new Ipv6FlabelCaseBuilder();
         Ipv6FlabelBuilder labelBuilder = new Ipv6FlabelBuilder();
-        labelBuilder.setIpv6Flabel(new Ipv6FlowLabel(input.readUnsignedInt()));
+        labelBuilder.setIpv6Flabel(new Ipv6FlowLabel(readUint32(input)));
         if (builder.isHasMask()) {
             labelBuilder.setMask(OxmDeserializerHelper.convertMask(input,
                     EncodeConstants.SIZE_OF_INT_IN_BYTES));
index 30c52600fd23a56eee3898726267f822b718267a..64fb826152707bcccc695fd5aeb5cc300dea2858 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
 
+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.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.MatchField;
@@ -34,11 +36,9 @@ public class OxmMplsLabelDeserializer extends AbstractOxmMatchEntryDeserializer
     }
 
     private static void addMplsLabelValue(ByteBuf input, MatchEntryBuilder builder) {
-        MplsLabelCaseBuilder caseBuilder = new MplsLabelCaseBuilder();
-        MplsLabelBuilder labelBuilder = new MplsLabelBuilder();
-        labelBuilder.setMplsLabel(input.readUnsignedInt());
-        caseBuilder.setMplsLabel(labelBuilder.build());
-        builder.setMatchEntryValue(caseBuilder.build());
+        builder.setMatchEntryValue(new MplsLabelCaseBuilder()
+            .setMplsLabel(new MplsLabelBuilder().setMplsLabel(readUint32(input)).build())
+            .build());
     }
 
     @Override
index 46f9db39f2d8f0acf9ab2008905e4b266298ef0e..274ba9fb2d1e1c864181eea747e297af91f8c5a0 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint8;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.MatchField;
@@ -34,11 +36,9 @@ public class OxmMplsTcDeserializer extends AbstractOxmMatchEntryDeserializer
     }
 
     private static void addMplsTcValue(ByteBuf input, MatchEntryBuilder builder) {
-        MplsTcCaseBuilder caseBuilder = new MplsTcCaseBuilder();
-        MplsTcBuilder tcBuilder = new MplsTcBuilder();
-        tcBuilder.setTc(input.readUnsignedByte());
-        caseBuilder.setMplsTc(tcBuilder.build());
-        builder.setMatchEntryValue(caseBuilder.build());
+        builder.setMatchEntryValue(new MplsTcCaseBuilder()
+            .setMplsTc(new MplsTcBuilder().setTc(readUint8(input)).build())
+            .build());
     }
 
     @Override
index c0d30d4f4daee91e66a2d063e3f8d862501b7214..2480f0b0d312c01879e33adaca340d061c7b89c1 100644 (file)
@@ -5,9 +5,10 @@
  * 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.match;
 
+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.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.MatchField;
@@ -35,7 +36,7 @@ public class OxmPacketTypeDeserializer extends AbstractOxmMatchEntryDeserializer
         final MatchEntryBuilder builder = processHeader(getOxmClass(), getOxmField(), message);
         PacketTypeCaseBuilder caseBuilder = new PacketTypeCaseBuilder();
         PacketTypeBuilder packetTypeBuilder = new PacketTypeBuilder();
-        packetTypeBuilder.setPacketType(message.readUnsignedInt());
+        packetTypeBuilder.setPacketType(readUint32(message));
         caseBuilder.setPacketType(packetTypeBuilder.build());
         builder.setMatchEntryValue(caseBuilder.build());
         return builder.build();
index 2b3e4c3830a74ea53be0e4493844caa06acc0618..29d4e534742f3149228199f967b5eb6c86c4ac5b 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint16;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
@@ -35,11 +37,9 @@ public class OxmSctpDstDeserializer extends AbstractOxmMatchEntryDeserializer
     }
 
     private static void addSctpDstValue(ByteBuf input, MatchEntryBuilder builder) {
-        SctpDstCaseBuilder caseBuilder = new SctpDstCaseBuilder();
-        SctpDstBuilder sctpBuilder = new SctpDstBuilder();
-        sctpBuilder.setPort(new PortNumber(input.readUnsignedShort()));
-        caseBuilder.setSctpDst(sctpBuilder.build());
-        builder.setMatchEntryValue(caseBuilder.build());
+        builder.setMatchEntryValue(new SctpDstCaseBuilder()
+            .setSctpDst(new SctpDstBuilder().setPort(new PortNumber(readUint16(input))).build())
+            .build());
     }
 
     @Override
index 12b136b70b23394e4940cdd338403bbf0e02402b..1ccd766a0011ecab8a2de015435e811f9e5ae6c6 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint16;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
@@ -15,7 +17,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Open
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.SctpSrc;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.SctpSrcCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.sctp.src._case.SctpSrcBuilder;
 
@@ -29,17 +30,11 @@ public class OxmSctpSrcDeserializer extends AbstractOxmMatchEntryDeserializer
 
     @Override
     public MatchEntry deserialize(ByteBuf input) {
-        MatchEntryBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
-        addSctpSrcValue(input, builder);
-        return builder.build();
-    }
-
-    private static void addSctpSrcValue(ByteBuf input, MatchEntryBuilder builder) {
-        SctpSrcCaseBuilder caseBuilder = new SctpSrcCaseBuilder();
-        SctpSrcBuilder sctpBuilder = new SctpSrcBuilder();
-        sctpBuilder.setPort(new PortNumber(input.readUnsignedShort()));
-        caseBuilder.setSctpSrc(sctpBuilder.build());
-        builder.setMatchEntryValue(caseBuilder.build());
+        return processHeader(getOxmClass(), getOxmField(), input)
+                .setMatchEntryValue(new SctpSrcCaseBuilder()
+                    .setSctpSrc(new SctpSrcBuilder().setPort(new PortNumber(readUint16(input))).build())
+                    .build())
+                .build();
     }
 
     @Override
index dd9e445a6222269481127861200cb9ad181af4b1..6da8da1e95a10d71df0ba913860d0f6d09b6bac5 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint16;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
@@ -15,7 +17,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Open
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.TcpDst;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.TcpDstCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.tcp.dst._case.TcpDstBuilder;
 
@@ -29,17 +30,11 @@ public class OxmTcpDstDeserializer extends AbstractOxmMatchEntryDeserializer
 
     @Override
     public MatchEntry deserialize(ByteBuf input) {
-        MatchEntryBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
-        addTcpDstValue(input, builder);
-        return builder.build();
-    }
-
-    private static void addTcpDstValue(ByteBuf input, MatchEntryBuilder builder) {
-        TcpDstCaseBuilder caseBuilder = new TcpDstCaseBuilder();
-        TcpDstBuilder tcpBuilder = new TcpDstBuilder();
-        tcpBuilder.setPort(new PortNumber(input.readUnsignedShort()));
-        caseBuilder.setTcpDst(tcpBuilder.build());
-        builder.setMatchEntryValue(caseBuilder.build());
+        return processHeader(getOxmClass(), getOxmField(), input)
+                .setMatchEntryValue(new TcpDstCaseBuilder()
+                    .setTcpDst(new TcpDstBuilder().setPort(new PortNumber(readUint16(input))).build())
+                    .build())
+                .build();
     }
 
     @Override
@@ -51,5 +46,4 @@ public class OxmTcpDstDeserializer extends AbstractOxmMatchEntryDeserializer
     protected Class<? extends OxmClassBase> getOxmClass() {
         return OpenflowBasicClass.class;
     }
-
 }
index ff07d366d2195eca142a76a4cba9989ae5147072..f393e8f7604a32096623962e11fc1e7ff282136e 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint16;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
@@ -15,7 +17,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Open
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.TcpSrc;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.TcpSrcCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.tcp.src._case.TcpSrcBuilder;
 
@@ -29,17 +30,11 @@ public class OxmTcpSrcDeserializer extends AbstractOxmMatchEntryDeserializer
 
     @Override
     public MatchEntry deserialize(ByteBuf input) {
-        MatchEntryBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
-        addTcpSrcValue(input, builder);
-        return builder.build();
-    }
-
-    private static void addTcpSrcValue(ByteBuf input, MatchEntryBuilder builder) {
-        TcpSrcCaseBuilder caseBuilder = new TcpSrcCaseBuilder();
-        TcpSrcBuilder tcpBuilder = new TcpSrcBuilder();
-        tcpBuilder.setPort(new PortNumber(input.readUnsignedShort()));
-        caseBuilder.setTcpSrc(tcpBuilder.build());
-        builder.setMatchEntryValue(caseBuilder.build());
+        return processHeader(getOxmClass(), getOxmField(), input)
+                .setMatchEntryValue(new TcpSrcCaseBuilder()
+                    .setTcpSrc(new TcpSrcBuilder().setPort(new PortNumber(readUint16(input))).build())
+                    .build())
+                .build();
     }
 
     @Override
index edbbcfc9b19f8dc1357c50c3cc633d10176f4c24..e887594f85e46ef0e8654c8e3a4dc7bf15919818 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint16;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
@@ -15,7 +17,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Open
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.UdpDst;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.UdpDstCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.udp.dst._case.UdpDstBuilder;
 
@@ -29,17 +30,11 @@ public class OxmUdpDstDeserializer extends AbstractOxmMatchEntryDeserializer
 
     @Override
     public MatchEntry deserialize(ByteBuf input) {
-        MatchEntryBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
-        addUdpDstValue(input, builder);
-        return builder.build();
-    }
-
-    private static void addUdpDstValue(ByteBuf input, MatchEntryBuilder builder) {
-        UdpDstCaseBuilder caseBuilder = new UdpDstCaseBuilder();
-        UdpDstBuilder udpBuilder = new UdpDstBuilder();
-        udpBuilder.setPort(new PortNumber(input.readUnsignedShort()));
-        caseBuilder.setUdpDst(udpBuilder.build());
-        builder.setMatchEntryValue(caseBuilder.build());
+        return processHeader(getOxmClass(), getOxmField(), input)
+                .setMatchEntryValue(new UdpDstCaseBuilder()
+                    .setUdpDst(new UdpDstBuilder().setPort(new PortNumber(readUint16(input))).build())
+                    .build())
+                .build();
     }
 
     @Override
index bbe970c7ade3fbb043bcb7220e3c8d1fc1d22a73..e5e55128f1a4dc7e3e31297502497f1dbf313e1b 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint16;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
@@ -15,7 +17,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Open
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.UdpSrc;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.UdpSrcCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.udp.src._case.UdpSrcBuilder;
 
@@ -29,17 +30,11 @@ public class OxmUdpSrcDeserializer extends AbstractOxmMatchEntryDeserializer
 
     @Override
     public MatchEntry deserialize(ByteBuf input) {
-        MatchEntryBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
-        addUdpSrcValue(input, builder);
-        return builder.build();
-    }
-
-    private static void addUdpSrcValue(ByteBuf input, MatchEntryBuilder builder) {
-        UdpSrcCaseBuilder caseBuilder = new UdpSrcCaseBuilder();
-        UdpSrcBuilder udpBuilder = new UdpSrcBuilder();
-        udpBuilder.setPort(new PortNumber(input.readUnsignedShort()));
-        caseBuilder.setUdpSrc(udpBuilder.build());
-        builder.setMatchEntryValue(caseBuilder.build());
+        return processHeader(getOxmClass(), getOxmField(), input)
+                .setMatchEntryValue(new UdpSrcCaseBuilder()
+                    .setUdpSrc(new UdpSrcBuilder().setPort(new PortNumber(readUint16(input))).build())
+                    .build())
+                .build();
     }
 
     @Override
index 0bd079be9477d32be58eebd30c999800dcb15235..6e9f4503f9ed461307fbf4bbf164a14fdbd98d18 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint8;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.MatchField;
@@ -14,7 +16,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Open
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.VlanPcp;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.VlanPcpCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.vlan.pcp._case.VlanPcpBuilder;
 
@@ -28,17 +29,11 @@ public class OxmVlanPcpDeserializer extends AbstractOxmMatchEntryDeserializer
 
     @Override
     public MatchEntry deserialize(ByteBuf input) {
-        MatchEntryBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
-        addVlanPcpValue(input, builder);
-        return builder.build();
-    }
-
-    private static void addVlanPcpValue(ByteBuf input, MatchEntryBuilder builder) {
-        VlanPcpCaseBuilder caseBuilder = new VlanPcpCaseBuilder();
-        VlanPcpBuilder vlanBuilder = new VlanPcpBuilder();
-        vlanBuilder.setVlanPcp(input.readUnsignedByte());
-        caseBuilder.setVlanPcp(vlanBuilder.build());
-        builder.setMatchEntryValue(caseBuilder.build());
+        return processHeader(getOxmClass(), getOxmField(), input)
+                .setMatchEntryValue(new VlanPcpCaseBuilder()
+                    .setVlanPcp(new VlanPcpBuilder().setVlanPcp(readUint8(input)).build())
+                    .build())
+                .build();
     }
 
     @Override
index 43758f6d37046c374decd1f1684b039a2ea3ed40..b617180c97cf8f1ae1783cf4e602b1fde41c1234 100644 (file)
@@ -18,6 +18,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.matc
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.VlanVidCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.vlan.vid._case.VlanVidBuilder;
+import org.opendaylight.yangtools.yang.common.Uint16;
 
 /**
  * Translates OxmVlanVid messages.
@@ -39,7 +40,7 @@ public class OxmVlanVidDeserializer extends AbstractOxmMatchEntryDeserializer
         VlanVidBuilder vlanBuilder = new VlanVidBuilder();
         int vidEntryValue = input.readUnsignedShort();
         vlanBuilder.setCfiBit((vidEntryValue & 1 << 12) != 0); // cfi is 13-th bit
-        vlanBuilder.setVlanVid(vidEntryValue & (1 << 12) - 1); // value without 13-th bit
+        vlanBuilder.setVlanVid(Uint16.valueOf(vidEntryValue & (1 << 12) - 1)); // value without 13-th bit
         if (builder.isHasMask()) {
             vlanBuilder.setMask(OxmDeserializerHelper
                     .convertMask(input, EncodeConstants.SIZE_OF_SHORT_IN_BYTES));
index e9535d8e4ae92a381b1f35a2bec904e9bd9a4c06..7bc71456e905510a5dbcbaa7700458e5720cc224 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.openflowjava.protocol.impl.deserialization.match.ext;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.impl.deserialization.match.AbstractOxmMatchEntryDeserializer;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.oxm.container.match.entry.value.ExperimenterIdCaseBuilder;
@@ -22,7 +24,7 @@ public abstract class AbstractOxmExperimenterMatchEntryDeserializer extends Abst
     protected ExperimenterIdCaseBuilder createExperimenterIdCase(MatchEntryBuilder entryBuilder, ByteBuf input) {
         ExperimenterIdCaseBuilder expCaseBuilder = new ExperimenterIdCaseBuilder();
         ExperimenterBuilder expBuilder = new ExperimenterBuilder();
-        expBuilder.setExperimenter(new ExperimenterId(input.readUnsignedInt()));
+        expBuilder.setExperimenter(new ExperimenterId(readUint32(input)));
         expCaseBuilder.setExperimenter(expBuilder.build());
         return expCaseBuilder;
     }
index 57c2c9d74b3fc47ab4df947e8361cdaa0e4a163c..4e1a85d842b0491ca4df73167b56c5f991c0a0ab 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.openflowjava.protocol.impl.deserialization.match.ext;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint16;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
@@ -39,7 +41,7 @@ public class OnfOxmTcpFlagsDeserializer extends AbstractOxmExperimenterMatchEntr
     private static void addTcpFlagsAugmentation(ByteBuf input, ExperimenterIdCaseBuilder expCaseBuilder,
             boolean hasMask) {
         TcpFlagsBuilder flagsBuilder = new TcpFlagsBuilder();
-        flagsBuilder.setFlags(input.readUnsignedShort());
+        flagsBuilder.setFlags(readUint16(input));
         if (hasMask) {
             byte[] mask = new byte[EncodeConstants.SIZE_OF_SHORT_IN_BYTES];
             input.readBytes(mask);
index 7de1ff7b8bd0db8279289b26a5dec22c6e09f477..ed505ccee7cb2abd0394b724e895c1998b91796b 100644 (file)
@@ -5,9 +5,11 @@
  * 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.util;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint16;
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint8;
+
 import io.netty.buffer.ByteBuf;
 import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
@@ -40,21 +42,21 @@ public class OF10MatchDeserializer implements OFDeserializer<MatchV10> {
         builder.setWildcards(createWildcards(wildcards));
         builder.setNwSrcMask(decodeNwSrcMask(wildcards));
         builder.setNwDstMask(decodeNwDstMask(wildcards));
-        builder.setInPort(input.readUnsignedShort());
+        builder.setInPort(readUint16(input));
         builder.setDlSrc(ByteBufUtils.readIetfMacAddress(input));
         builder.setDlDst(ByteBufUtils.readIetfMacAddress(input));
 
-        builder.setDlVlan(input.readUnsignedShort());
-        builder.setDlVlanPcp(input.readUnsignedByte());
+        builder.setDlVlan(readUint16(input));
+        builder.setDlVlanPcp(readUint8(input));
         input.skipBytes(PADDING_IN_MATCH);
-        builder.setDlType(input.readUnsignedShort());
-        builder.setNwTos(input.readUnsignedByte());
-        builder.setNwProto(input.readUnsignedByte());
+        builder.setDlType(readUint16(input));
+        builder.setNwTos(readUint8(input));
+        builder.setNwProto(readUint8(input));
         input.skipBytes(PADDING_IN_MATCH_2);
         builder.setNwSrc(ByteBufUtils.readIetfIpv4Address(input));
         builder.setNwDst(ByteBufUtils.readIetfIpv4Address(input));
-        builder.setTpSrc(input.readUnsignedShort());
-        builder.setTpDst(input.readUnsignedShort());
+        builder.setTpSrc(readUint16(input));
+        builder.setTpDst(readUint16(input));
         return builder.build();
     }
 
index 5b9a5fc740c0df8d905e2e7ea7891b9da0568ccf..7d8ffa1c161ed2e3856ae6417ac82ca2ef279990 100644 (file)
             <groupId>org.opendaylight.controller.model</groupId>
             <artifactId>model-inventory</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.opendaylight.yangtools</groupId>
+            <artifactId>yang-common-netty</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.opendaylight.mdsal</groupId>
             <artifactId>mdsal-binding-api</artifactId>
index 6d9c372891e30ee1116356abc5c685adb2363681..3fa354f0a3982505e1e1eb62473b7b22e9b17519 100644 (file)
@@ -5,9 +5,12 @@
  * 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.deserialization.messages;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint16;
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint8;
+
 import com.google.common.base.Preconditions;
 import io.netty.buffer.ByteBuf;
 import java.math.BigInteger;
@@ -51,17 +54,17 @@ public class FlowMessageDeserializer implements OFDeserializer<FlowMessage>, Des
     public FlowMessage deserialize(ByteBuf message) {
         final FlowMessageBuilder builder = new FlowMessageBuilder()
             .setVersion((short) EncodeConstants.OF13_VERSION_ID)
-            .setXid(message.readUnsignedInt())
+            .setXid(readUint32(message))
             .setCookie(new FlowCookie(BigInteger.valueOf(message.readLong())))
             .setCookieMask(new FlowCookie(BigInteger.valueOf(message.readLong())))
-            .setTableId(message.readUnsignedByte())
+            .setTableId(readUint8(message))
             .setCommand(FlowModCommand.forValue(message.readUnsignedByte()))
-            .setIdleTimeout(message.readUnsignedShort())
-            .setHardTimeout(message.readUnsignedShort())
-            .setPriority(message.readUnsignedShort())
-            .setBufferId(message.readUnsignedInt())
+            .setIdleTimeout(readUint16(message))
+            .setHardTimeout(readUint16(message))
+            .setPriority(readUint16(message))
+            .setBufferId(readUint32(message))
             .setOutPort(BigInteger.valueOf(message.readUnsignedInt()))
-            .setOutGroup(message.readUnsignedInt())
+            .setOutGroup(readUint32(message))
             .setFlags(createFlowModFlagsFromBitmap(message.readUnsignedShort()));
 
         message.skipBytes(PADDING);
index b72893e99cbad652ea38a4674604d92ce4a404ea..8fff86361168d0f7ce16d5a9df994953c8d02bef 100644 (file)
@@ -7,8 +7,11 @@
  */
 package org.opendaylight.openflowplugin.impl.protocol.deserialization.multipart;
 
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint64;
+import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint8;
+
 import io.netty.buffer.ByteBuf;
-import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.List;
 import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
@@ -80,23 +83,17 @@ public class MultipartReplyTableFeaturesDeserializer implements OFDeserializer<M
         while (message.readableBytes() > 0) {
             final int itemLength = message.readUnsignedShort();
             final TableFeaturesBuilder itemBuilder = new TableFeaturesBuilder()
-                    .setTableId(message.readUnsignedByte());
+                    .setTableId(readUint8(message));
 
             message.skipBytes(PADDING_IN_MULTIPART_REPLY_TABLE_FEATURES);
 
-            final String name = ByteBufUtils.decodeNullTerminatedString(message, MAX_TABLE_NAME_LENGTH);
-            final byte[] match = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-            message.readBytes(match);
-            final byte[] write = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
-            message.readBytes(write);
-
             items.add(itemBuilder
                     .withKey(new TableFeaturesKey(itemBuilder.getTableId()))
-                    .setName(name)
-                    .setMetadataMatch(new BigInteger(1, match))
-                    .setMetadataWrite(new BigInteger(1, write))
+                    .setName(ByteBufUtils.decodeNullTerminatedString(message, MAX_TABLE_NAME_LENGTH))
+                    .setMetadataMatch(readUint64(message))
+                    .setMetadataWrite(readUint64(message))
                     .setConfig(readTableConfig(message))
-                    .setMaxEntries(message.readUnsignedInt())
+                    .setMaxEntries(readUint32(message))
                     .setTableProperties(readTableProperties(message,
                             itemLength - MULTIPART_REPLY_TABLE_FEATURES_STRUCTURE_LENGTH))
                     .build());