<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>
* 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;
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,
@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
public Class<? extends OxmClassBase> getOxmClass() {
return EricExpClass.class;
}
-
}
\ No newline at end of file
* 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;
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;
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,
@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
public Class<? extends OxmClassBase> getOxmClass() {
return EricExpClass.class;
}
-
}
\ No newline at end of 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>
*/
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;
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) {
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);
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();
deserializeCtHeaderWithoutSubtype(message);
NxActionCtMarkBuilder nxActionCtMarkBuilder = new NxActionCtMarkBuilder();
- nxActionCtMarkBuilder.setCtMark(message.readUnsignedInt());
+ nxActionCtMarkBuilder.setCtMark(readUint32(message));
NxActionCtMarkCaseBuilder caseBuilder = new NxActionCtMarkCaseBuilder();
caseBuilder.setNxActionCtMark(nxActionCtMarkBuilder.build());
* 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;
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 {
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
*/
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;
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();
* 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;
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();
}
-
}
*/
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;
*/
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,
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;
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;
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;
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;
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;
* 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;
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());
* 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;
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());
*/
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;
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());
*/
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;
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());
*/
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;
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);
* 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;
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());
*/
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;
@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();
}
* 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;
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
@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()) {
*/
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;
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;
@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
*/
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;
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;
@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
*/
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;
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;
@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
* 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;
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();
public Class<? extends OxmClassBase> getOxmClass() {
return Nxm1Class.class;
}
-
}
* 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;
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;
@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
public Class<? extends OxmClassBase> getOxmClass() {
return Nxm1Class.class;
}
-
}
* 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;
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;
@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
* 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;
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;
@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
* 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;
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;
@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
public Class<? extends OxmClassBase> getOxmClass() {
return Nxm1Class.class;
}
-
}
*/
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;
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;
@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
*/
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;
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;
@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
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;
@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
*/
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;
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;
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
*/
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;
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;
@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
*/
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;
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;
@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
*/
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;
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;
@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
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;
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 {
@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
* 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;
@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
*/
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;
@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
*/
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;
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 {
@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();
}
*/
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;
@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
* 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;
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;
@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
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.
@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
*/
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;
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;
@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
* 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;
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;
@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
* 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;
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;
@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
*/
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;
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;
@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
*/
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;
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;
@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
<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>
* 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;
* @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();
}
-
}
* 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;
* @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();
protected ActionChoice getType() {
return new OutputActionCaseBuilder().build();
}
-
}
* 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;
* @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);
protected ActionChoice getType() {
return new SetNwTosCaseBuilder().build();
}
-
}
* 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;
* @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);
protected ActionChoice getType() {
return new SetTpDstCaseBuilder().build();
}
-
}
* 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;
* @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);
* 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;
* @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
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);
protected ActionChoice getType() {
return new SetVlanPcpCaseBuilder().build();
}
-
}
* 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;
@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();
}
* 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;
* @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();
}
-
}
* 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;
* @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
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);
protected ActionChoice getType() {
return new OutputActionCaseBuilder().build();
}
-
}
* 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;
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.
* @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();
}
protected ActionChoice getType() {
return new PopMplsCaseBuilder().build();
}
-
}
* 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;
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.
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);
protected ActionChoice getType() {
return new PushMplsCaseBuilder().build();
}
-
}
* 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;
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.
* @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();
}
protected ActionChoice getType() {
return new PushPbbCaseBuilder().build();
}
-
}
* 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;
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.
* @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();
}
protected ActionChoice getType() {
return new PushVlanCaseBuilder().build();
}
-
}
* 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;
* @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);
protected ActionChoice getType() {
return new SetMplsTtlCaseBuilder().build();
}
-
}
* 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;
* @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);
protected ActionChoice getType() {
return new SetNwTtlCaseBuilder().build();
}
-
}
* 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;
* @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();
protected ActionChoice getType() {
return new SetQueueCaseBuilder().build();
}
-
}
*/
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;
@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();
}
-
}
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;
@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();
}
}
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;
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];
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;
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);
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;
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)) {
* 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;
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.
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();
* 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;
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();
}
*/
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;
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(
* 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;
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));
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;
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));
*/
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;
* @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();
}
}
*/
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;
* @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();
}
-
}
* 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;
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();
}
}
*/
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;
@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
*/
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;
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();
}
*/
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;
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,
builder.setBucketsList(bucketsList);
return builder.build();
}
-
}
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;
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));
}
*/
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;
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();
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());
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());
final Boolean mfSTATS = (input & 1 << 3) != 0;
return new MeterFlags(mfBURST, mfKBPS, mfPKTPS, mfSTATS);
}
-
}
* 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;
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));
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));
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();
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);
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];
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());
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--;
}
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);
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);
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;
}
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();
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;
}
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) {
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());
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());
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);
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);
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,
*/
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;
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()));
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());
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--;
}
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));
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));
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();
}
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();
}
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();
}
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();
}
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();
}
* 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;
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);
* 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;
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()));
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()));
*/
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;
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();
}
}
*/
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;
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);
final Boolean _oFPFFEMERG = (input & 1 << 2) != 0;
return new FlowModFlagsV10(_oFPFFCHECKOVERLAP, _oFPFFEMERG, _oFPFFSENDFLOWREM);
}
-
}
* 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;
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();
}
*/
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;
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();
}
}
* 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;
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();
}
-
}
* 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;
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();
*/
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;
* @author giuseppex.petralia@intel.com
*/
public class OF10PacketOutInputMessageFactory implements OFDeserializer<PacketOutInput>, DeserializerRegistryInjector {
-
private DeserializerRegistry registry;
@Override
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,
builder.setData(data);
return builder.build();
}
-
}
*/
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;
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()));
* 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;
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);
}
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()));
* 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;
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();
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));
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);
}
* 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;
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));
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);
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();
// 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());
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);
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);
*/
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;
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()));
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();
}
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();
}
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();
}
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();
}
* 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;
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);
*/
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;
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);
*/
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;
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);
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;
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);
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();
}
* 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;
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();
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));
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)) {
* 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;
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();
}
}
*/
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;
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();
}
}
*/
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;
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));
*/
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;
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();
}
*/
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;
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();
* 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;
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.
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(
* 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;
@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();
}
}
* 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;
@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();
}
-
}
*/
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;
}
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
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.
}
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
*/
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;
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;
@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
protected Class<? extends OxmClassBase> getOxmClass() {
return OpenflowBasicClass.class;
}
-
}
*/
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;
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;
@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
*/
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;
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;
@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
*/
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;
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;
@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
*/
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;
}
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
*/
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;
}
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
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.
}
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
*/
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;
}
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
*/
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;
}
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
*/
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;
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));
*/
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;
}
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
*/
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;
}
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
* 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;
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();
*/
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;
}
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
*/
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;
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;
@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
*/
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;
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;
@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
protected Class<? extends OxmClassBase> getOxmClass() {
return OpenflowBasicClass.class;
}
-
}
*/
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;
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;
@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
*/
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;
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;
@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
*/
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;
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;
@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
*/
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;
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;
@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
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.
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));
*/
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;
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;
}
*/
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;
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);
* 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;
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();
}
<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>
* 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;
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);
*/
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;
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());