Remove EncodeConstants.SIZE_OF_{BYTE,SHORT,INT,LONG}_IN_BYTES
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / protocol / deserialization / multipart / MultipartReplyFlowStatsDeserializer.java
index 8f944e0532e642811a380892294bc67fe7a9e23f..b9560995593ecf3b0bf933adea242bd2f73d4103 100644 (file)
@@ -25,10 +25,8 @@ import org.opendaylight.openflowplugin.impl.protocol.deserialization.util.Instru
 import org.opendaylight.openflowplugin.impl.util.MatchUtil;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter32;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter64;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapList;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapListBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapListKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.multipart.reply.multipart.reply.body.MultipartReplyFlowStatsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags;
@@ -54,12 +52,11 @@ public class MultipartReplyFlowStatsDeserializer implements OFDeserializer<Multi
     public MultipartReplyBody deserialize(ByteBuf message) {
         final MultipartReplyFlowStatsBuilder builder = new MultipartReplyFlowStatsBuilder();
         final List<FlowAndStatisticsMapList> items = new ArrayList<>();
-        int key = 0;
 
         while (message.readableBytes() > 0) {
             final FlowAndStatisticsMapListBuilder itemBuilder = new FlowAndStatisticsMapListBuilder();
             final int itemLength = message.readUnsignedShort();
-            final ByteBuf itemMessage = message.readSlice(itemLength - EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+            final ByteBuf itemMessage = message.readSlice(itemLength - Short.BYTES);
 
             itemBuilder.setTableId(itemMessage.readUnsignedByte());
             itemMessage.skipBytes(PADDING_IN_FLOW_STATS_HEADER_01);
@@ -76,11 +73,11 @@ public class MultipartReplyFlowStatsDeserializer implements OFDeserializer<Multi
 
             itemMessage.skipBytes(PADDING_IN_FLOW_STATS_HEADER_02);
 
-            final byte[] cookie = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+            final byte[] cookie = new byte[Long.BYTES];
             itemMessage.readBytes(cookie);
-            final byte[] packetCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+            final byte[] packetCount = new byte[Long.BYTES];
             itemMessage.readBytes(packetCount);
-            final byte[] byteCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+            final byte[] byteCount = new byte[Long.BYTES];
             itemMessage.readBytes(byteCount);
 
             itemBuilder
@@ -118,7 +115,6 @@ public class MultipartReplyFlowStatsDeserializer implements OFDeserializer<Multi
                         .build());
             }
 
-            itemBuilder.withKey(new FlowAndStatisticsMapListKey(new FlowId(String.valueOf(key++))));
             items.add(itemBuilder.build());
         }