X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=openflowplugin-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fopenflowplugin%2Fimpl%2Fprotocol%2Fdeserialization%2Fmultipart%2FMultipartReplyGroupDescDeserializer.java;h=ab959bea9e37c37c2bfc3a2f30188030af3715d2;hb=137e4d7d86e8f402f3d52fd0fa162792f9ff60eb;hp=9b01d3b01aac38b84d5c5d4b10febc1f2833a188;hpb=fb33411ea295d68c1c887702f706ec6633f6527e;p=openflowplugin.git diff --git a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/multipart/MultipartReplyGroupDescDeserializer.java b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/multipart/MultipartReplyGroupDescDeserializer.java index 9b01d3b01a..ab959bea9e 100644 --- a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/multipart/MultipartReplyGroupDescDeserializer.java +++ b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/multipart/MultipartReplyGroupDescDeserializer.java @@ -20,16 +20,20 @@ import org.opendaylight.openflowplugin.impl.protocol.deserialization.util.Action import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.multipart.reply.multipart.reply.body.MultipartReplyGroupDescBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.BucketId; import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId; import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupTypes; import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.BucketsBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket; import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.BucketBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.BucketKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.desc.stats.reply.GroupDescStats; import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.desc.stats.reply.GroupDescStatsBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.desc.stats.reply.GroupDescStatsKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.multipart.reply.MultipartReplyBody; -public class MultipartReplyGroupDescDeserializer implements OFDeserializer, DeserializerRegistryInjector { +public class MultipartReplyGroupDescDeserializer implements OFDeserializer, + DeserializerRegistryInjector { private static final byte PADDING_IN_GROUP_DESC_HEADER = 1; private static final byte PADDING_IN_BUCKETS_HEADER = 4; @@ -46,59 +50,60 @@ public class MultipartReplyGroupDescDeserializer implements OFDeserializer subItems = new ArrayList<>(); int actualLength = GROUP_DESC_HEADER_LENGTH; + long bucketKey = 0; while (actualLength < itemLength) { final int bucketsLength = message.readUnsignedShort(); final BucketBuilder bucketBuilder = new BucketBuilder() - .setWeight(message.readUnsignedShort()) - .setWatchPort(message.readUnsignedInt()) - .setWatchGroup(message.readUnsignedInt()); + .setBucketId(new BucketId(bucketKey)) + .withKey(new BucketKey(new BucketId(bucketKey))) + .setWeight(message.readUnsignedShort()) + .setWatchPort(message.readUnsignedInt()) + .setWatchGroup(message.readUnsignedInt()); message.skipBytes(PADDING_IN_BUCKETS_HEADER); - - if (message.readableBytes() > 0) { - final List actions = new ArrayList<>(); - final int startIndex = message.readerIndex(); - final int bucketLength = bucketsLength - BUCKETS_HEADER_LENGTH; - int offset = 0; - - while ((message.readerIndex() - startIndex) < bucketLength) { - actions.add(new ActionBuilder() - .setKey(new ActionKey(offset)) - .setOrder(offset) - .setAction(ActionUtil.readAction(EncodeConstants.OF13_VERSION_ID, message, registry, - ActionPath.GROUPDESCSTATSUPDATED_GROUPDESCSTATS_BUCKETS_BUCKET_ACTION)) - .build()); - - offset++; - } - - bucketBuilder.setAction(actions); + final int startIndex = message.readerIndex(); + final int bucketLength = bucketsLength - BUCKETS_HEADER_LENGTH; + int offset = 0; + + while (message.readerIndex() - startIndex < bucketLength) { + actions.add(new ActionBuilder() + .withKey(new ActionKey(offset)) + .setOrder(offset) + .setAction(ActionUtil.readAction(EncodeConstants.OF13_VERSION_ID, message, registry, + ActionPath.GROUP_DESC_STATS_UPDATED_BUCKET_ACTION)) + .build()); + + offset++; } + bucketBuilder.setAction(actions); subItems.add(bucketBuilder.build()); + bucketKey++; actualLength += bucketsLength; } items.add(itemBuilder .setBuckets(new BucketsBuilder() - .setBucket(subItems) - .build()) + .setBucket(subItems) + .build()) .build()); } return builder - .setGroupDescStats(items) - .build(); + .setGroupDescStats(items) + .build(); } @Override