X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=openflow-protocol-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fopenflowjava%2Fprotocol%2Fimpl%2Fdeserialization%2Ffactories%2FMultipartReplyMessageFactory.java;h=f03563bdf5dd50afe47127096eef7aadf1989789;hb=469250a7335c48547b0765d3c070c16c43c60589;hp=8a078d1b8d671db79ece2c8df120f05e1961a69e;hpb=8d785e650476b80189b86f6ad44c5a24d5ccbf6d;p=openflowjava.git diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/MultipartReplyMessageFactory.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/MultipartReplyMessageFactory.java index 8a078d1b..f03563bd 100644 --- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/MultipartReplyMessageFactory.java +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/MultipartReplyMessageFactory.java @@ -168,7 +168,6 @@ public class MultipartReplyMessageFactory implements OFDeserializer 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); @@ -301,7 +301,7 @@ public class MultipartReplyMessageFactory implements OFDeserializer 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); + tableFeaturesLength -= EncodeConstants.PADDING - paddingRemainder; + } properties.add(builder.build()); } return properties; @@ -445,42 +453,42 @@ public class MultipartReplyMessageFactory implements OFDeserializer 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; } @@ -593,24 +601,24 @@ public class MultipartReplyMessageFactory implements OFDeserializer 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; } @@ -708,10 +716,7 @@ public class MultipartReplyMessageFactory implements OFDeserializer