import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionRelatedTableFeatureProperty;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionRelatedTableFeaturePropertyBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterRelatedTableFeatureProperty;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterRelatedTableFeaturePropertyBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.InstructionRelatedTableFeatureProperty;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.InstructionRelatedTableFeaturePropertyBuilder;
List<FlowStats> flowStatsList = new ArrayList<>();
while (input.readableBytes() > 0) {
FlowStatsBuilder flowStatsBuilder = new FlowStatsBuilder();
- input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
- flowStatsBuilder.setTableId(input.readUnsignedByte());
- input.skipBytes(PADDING_IN_FLOW_STATS_HEADER_01);
- flowStatsBuilder.setDurationSec(input.readUnsignedInt());
- flowStatsBuilder.setDurationNsec(input.readUnsignedInt());
- flowStatsBuilder.setPriority(input.readUnsignedShort());
- flowStatsBuilder.setIdleTimeout(input.readUnsignedShort());
- flowStatsBuilder.setHardTimeout(input.readUnsignedShort());
- flowStatsBuilder.setFlags(createFlowModFlagsFromBitmap(input.readShort()));
- input.skipBytes(PADDING_IN_FLOW_STATS_HEADER_02);
- byte[] cookie = new byte[Long.SIZE/Byte.SIZE];
- input.readBytes(cookie);
- flowStatsBuilder.setCookie(new BigInteger(cookie));
- byte[] packetCount = new byte[Long.SIZE/Byte.SIZE];
- input.readBytes(packetCount);
- flowStatsBuilder.setPacketCount(new BigInteger(packetCount));
- byte[] byteCount = new byte[Long.SIZE/Byte.SIZE];
- input.readBytes(byteCount);
- flowStatsBuilder.setByteCount(new BigInteger(byteCount));
- flowStatsBuilder.setMatch(MatchDeserializer.createMatch(input));
- flowStatsBuilder.setInstructions(InstructionsDeserializer.createInstructions(input, input.readableBytes()));
+ int flowRecordLength = input.readUnsignedShort();
+ ByteBuf subInput = input.readSlice(flowRecordLength - EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ flowStatsBuilder.setTableId(subInput.readUnsignedByte());
+ 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.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.setMatch(MatchDeserializer.createMatch(subInput));
+ flowStatsBuilder.setInstructions(InstructionsDeserializer.createInstructions(subInput, subInput.readableBytes()));
flowStatsList.add(flowStatsBuilder.build());
}
flowBuilder.setFlowStats(flowStatsList);
return caseBuilder.build();
}
- private static FlowModFlags createFlowModFlagsFromBitmap(short input){
+ private static FlowModFlags createFlowModFlagsFromBitmap(int input){
final Boolean _oFPFFSENDFLOWREM = (input & (1 << 0)) != 0;
final Boolean _oFPFFCHECKOVERLAP = (input & (1 << 1)) != 0;
final Boolean _oFPFFRESETCOUNTS = (input & (1 << 2)) != 0;
private static MultipartReplyAggregateCase setAggregate(ByteBuf input) {
MultipartReplyAggregateCaseBuilder caseBuilder = new MultipartReplyAggregateCaseBuilder();
MultipartReplyAggregateBuilder builder = new MultipartReplyAggregateBuilder();
- byte[] packetCount = new byte[Long.SIZE/Byte.SIZE];
+ byte[] packetCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(packetCount);
- builder.setPacketCount(new BigInteger(packetCount));
- byte[] byteCount = new byte[Long.SIZE/Byte.SIZE];
+ builder.setPacketCount(new BigInteger(1, packetCount));
+ byte[] byteCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(byteCount);
- builder.setByteCount(new BigInteger(byteCount));
+ builder.setByteCount(new BigInteger(1, byteCount));
builder.setFlowCount(input.readUnsignedInt());
input.skipBytes(PADDING_IN_AGGREGATE_HEADER);
caseBuilder.setMultipartReplyAggregate(builder.build());
tableStatsBuilder.setTableId(input.readUnsignedByte());
input.skipBytes(PADDING_IN_TABLE_HEADER);
tableStatsBuilder.setActiveCount(input.readUnsignedInt());
- byte[] lookupCount = new byte[Long.SIZE/Byte.SIZE];
+ byte[] lookupCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(lookupCount);
- tableStatsBuilder.setLookupCount(new BigInteger(lookupCount));
- byte[] matchedCount = new byte[Long.SIZE/Byte.SIZE];
+ tableStatsBuilder.setLookupCount(new BigInteger(1, lookupCount));
+ byte[] matchedCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(matchedCount);
- tableStatsBuilder.setMatchedCount(new BigInteger(matchedCount));
+ tableStatsBuilder.setMatchedCount(new BigInteger(1, matchedCount));
tableStatsList.add(tableStatsBuilder.build());
}
builder.setTableStats(tableStatsList);
ExperimenterRelatedTableFeaturePropertyBuilder expBuilder = new ExperimenterRelatedTableFeaturePropertyBuilder();
expBuilder.setExperimenter(input.readUnsignedInt());
expBuilder.setExpType(input.readUnsignedInt());
+ int dataLength = propertyLength - COMMON_PROPERTY_LENGTH - 2 * EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ if (dataLength > 0) {
+ byte[] data = new byte[dataLength];
+ input.readBytes(data);
+ expBuilder.setData(data);
+ }
+ builder.addAugmentation(ExperimenterRelatedTableFeatureProperty.class, expBuilder.build());
}
if (paddingRemainder != 0) {
input.skipBytes(EncodeConstants.PADDING - paddingRemainder);
PortStatsBuilder portStatsBuilder = new PortStatsBuilder();
portStatsBuilder.setPortNo(input.readUnsignedInt());
input.skipBytes(PADDING_IN_PORT_STATS_HEADER);
- byte[] rxPackets = new byte[Long.SIZE/Byte.SIZE];
+ byte[] rxPackets = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(rxPackets);
- portStatsBuilder.setRxPackets(new BigInteger(rxPackets));
- byte[] txPackets = new byte[Long.SIZE/Byte.SIZE];
+ portStatsBuilder.setRxPackets(new BigInteger(1, rxPackets));
+ byte[] txPackets = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(txPackets);
- portStatsBuilder.setTxPackets(new BigInteger(txPackets));
- byte[] rxBytes = new byte[Long.SIZE/Byte.SIZE];
+ portStatsBuilder.setTxPackets(new BigInteger(1, txPackets));
+ byte[] rxBytes = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(rxBytes);
- portStatsBuilder.setRxBytes(new BigInteger(rxBytes));
- byte[] txBytes = new byte[Long.SIZE/Byte.SIZE];
+ portStatsBuilder.setRxBytes(new BigInteger(1, rxBytes));
+ byte[] txBytes = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(txBytes);
- portStatsBuilder.setTxBytes(new BigInteger(txBytes));
- byte[] rxDropped = new byte[Long.SIZE/Byte.SIZE];
+ portStatsBuilder.setTxBytes(new BigInteger(1, txBytes));
+ byte[] rxDropped = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(rxDropped);
- portStatsBuilder.setRxDropped(new BigInteger(rxDropped));
- byte[] txDropped = new byte[Long.SIZE/Byte.SIZE];
+ portStatsBuilder.setRxDropped(new BigInteger(1, rxDropped));
+ byte[] txDropped = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(txDropped);
- portStatsBuilder.setTxDropped(new BigInteger(txDropped));
- byte[] rxErrors = new byte[Long.SIZE/Byte.SIZE];
+ portStatsBuilder.setTxDropped(new BigInteger(1, txDropped));
+ byte[] rxErrors = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(rxErrors);
- portStatsBuilder.setRxErrors(new BigInteger(rxErrors));
- byte[] txErrors = new byte[Long.SIZE/Byte.SIZE];
+ portStatsBuilder.setRxErrors(new BigInteger(1, rxErrors));
+ byte[] txErrors = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(txErrors);
- portStatsBuilder.setTxErrors(new BigInteger(txErrors));
- byte[] rxFrameErr = new byte[Long.SIZE/Byte.SIZE];
+ portStatsBuilder.setTxErrors(new BigInteger(1, txErrors));
+ byte[] rxFrameErr = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(rxFrameErr);
- portStatsBuilder.setRxFrameErr(new BigInteger(rxFrameErr));
- byte[] rxOverErr = new byte[Long.SIZE/Byte.SIZE];
+ portStatsBuilder.setRxFrameErr(new BigInteger(1, rxFrameErr));
+ byte[] rxOverErr = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(rxOverErr);
- portStatsBuilder.setRxOverErr(new BigInteger(rxOverErr));
- byte[] rxCrcErr = new byte[Long.SIZE/Byte.SIZE];
+ portStatsBuilder.setRxOverErr(new BigInteger(1, rxOverErr));
+ byte[] rxCrcErr = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(rxCrcErr);
- portStatsBuilder.setRxCrcErr(new BigInteger(rxCrcErr));
- byte[] collisions = new byte[Long.SIZE/Byte.SIZE];
+ portStatsBuilder.setRxCrcErr(new BigInteger(1, rxCrcErr));
+ byte[] collisions = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(collisions);
- portStatsBuilder.setCollisions(new BigInteger(collisions));
+ portStatsBuilder.setCollisions(new BigInteger(1, collisions));
portStatsBuilder.setDurationSec(input.readUnsignedInt());
portStatsBuilder.setDurationNsec(input.readUnsignedInt());
portStatsList.add(portStatsBuilder.build());
QueueStatsBuilder queueStatsBuilder = new QueueStatsBuilder();
queueStatsBuilder.setPortNo(input.readUnsignedInt());
queueStatsBuilder.setQueueId(input.readUnsignedInt());
- byte[] txBytes = new byte[Long.SIZE/Byte.SIZE];
+ byte[] txBytes = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(txBytes);
- queueStatsBuilder.setTxBytes(new BigInteger(txBytes));
- byte[] txPackets = new byte[Long.SIZE/Byte.SIZE];
+ queueStatsBuilder.setTxBytes(new BigInteger(1, txBytes));
+ byte[] txPackets = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(txPackets);
- queueStatsBuilder.setTxPackets(new BigInteger(txPackets));
- byte[] txErrors = new byte[Long.SIZE/Byte.SIZE];
+ queueStatsBuilder.setTxPackets(new BigInteger(1, txPackets));
+ byte[] txErrors = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(txErrors);
- queueStatsBuilder.setTxErrors(new BigInteger(txErrors));
+ queueStatsBuilder.setTxErrors(new BigInteger(1, txErrors));
queueStatsBuilder.setDurationSec(input.readUnsignedInt());
queueStatsBuilder.setDurationNsec(input.readUnsignedInt());
queueStatsList.add(queueStatsBuilder.build());
groupStatsBuilder.setGroupId(new GroupId(input.readUnsignedInt()));
groupStatsBuilder.setRefCount(input.readUnsignedInt());
input.skipBytes(PADDING_IN_GROUP_HEADER_02);
- byte[] packetCount = new byte[Long.SIZE/Byte.SIZE];
+ byte[] packetCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(packetCount);
- groupStatsBuilder.setPacketCount(new BigInteger(packetCount));
- byte[] byteCount = new byte[Long.SIZE/Byte.SIZE];
+ groupStatsBuilder.setPacketCount(new BigInteger(1, packetCount));
+ byte[] byteCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(byteCount);
- groupStatsBuilder.setByteCount(new BigInteger(byteCount));
+ groupStatsBuilder.setByteCount(new BigInteger(1, byteCount));
groupStatsBuilder.setDurationSec(input.readUnsignedInt());
groupStatsBuilder.setDurationNsec(input.readUnsignedInt());
int actualLength = GROUP_BODY_LENGTH;
List<BucketStats> bucketStatsList = new ArrayList<>();
while (actualLength < bodyLength) {
BucketStatsBuilder bucketStatsBuilder = new BucketStatsBuilder();
- byte[] packetCountBucket = new byte[Long.SIZE/Byte.SIZE];
+ byte[] packetCountBucket = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(packetCountBucket);
- bucketStatsBuilder.setPacketCount(new BigInteger(packetCountBucket));
- byte[] byteCountBucket = new byte[Long.SIZE/Byte.SIZE];
+ bucketStatsBuilder.setPacketCount(new BigInteger(1, packetCountBucket));
+ byte[] byteCountBucket = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(byteCountBucket);
- bucketStatsBuilder.setByteCount(new BigInteger(byteCountBucket));
+ bucketStatsBuilder.setByteCount(new BigInteger(1, byteCountBucket));
bucketStatsList.add(bucketStatsBuilder.build());
actualLength += BUCKET_COUNTER_LENGTH;
}
int meterStatsBodyLength = input.readUnsignedShort();
input.skipBytes(PADDING_IN_METER_STATS_HEADER);
meterStatsBuilder.setFlowCount(input.readUnsignedInt());
- byte[] packetInCount = new byte[Long.SIZE/Byte.SIZE];
+ byte[] packetInCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(packetInCount);
- meterStatsBuilder.setPacketInCount(new BigInteger(packetInCount));
- byte[] byteInCount = new byte[Long.SIZE/Byte.SIZE];
+ meterStatsBuilder.setPacketInCount(new BigInteger(1, packetInCount));
+ byte[] byteInCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(byteInCount);
- meterStatsBuilder.setByteInCount(new BigInteger(byteInCount));
+ meterStatsBuilder.setByteInCount(new BigInteger(1, byteInCount));
meterStatsBuilder.setDurationSec(input.readUnsignedInt());
meterStatsBuilder.setDurationNsec(input.readUnsignedInt());
int actualLength = METER_BODY_LENGTH;
List<MeterBandStats> meterBandStatsList = new ArrayList<>();
while (actualLength < meterStatsBodyLength) {
MeterBandStatsBuilder meterBandStatsBuilder = new MeterBandStatsBuilder();
- byte[] packetBandCount = new byte[Long.SIZE/Byte.SIZE];
+ byte[] packetBandCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(packetBandCount);
- meterBandStatsBuilder.setPacketBandCount(new BigInteger(packetBandCount));
- byte[] byteBandCount = new byte[Long.SIZE/Byte.SIZE];
+ meterBandStatsBuilder.setPacketBandCount(new BigInteger(1, packetBandCount));
+ byte[] byteBandCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(byteBandCount);
- meterBandStatsBuilder.setByteBandCount(new BigInteger(byteBandCount));
+ meterBandStatsBuilder.setByteBandCount(new BigInteger(1, byteBandCount));
meterBandStatsList.add(meterBandStatsBuilder.build());
actualLength += METER_BAND_STATS_LENGTH;
}