Update MRI projects for Aluminium
[openflowplugin.git] / openflowplugin / src / test / java / org / opendaylight / openflowplugin / openflow / md / core / sal / convertor / GroupDescStatsResponseConvertorTest.java
index 7bff29521c9019ca85cf6c53f9f48e93bc878afb..6e51f5d770a55c996b3ea425b313e2d3d121173b 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collections;\r
-import java.util.List;\r
-import java.util.Optional;\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowplugin.api.OFConstants;\r
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupTypes;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.desc.stats.reply.GroupDescStats;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.CopyTtlInCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.CopyTtlOutCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.DecNwTtlCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PopPbbCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupId;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.buckets.grouping.BucketsList;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.buckets.grouping.BucketsListBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.desc._case.multipart.reply.group.desc.GroupDesc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.desc._case.multipart.reply.group.desc.GroupDescBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class GroupDescStatsResponseConvertorTest {\r
-    private ConvertorManager convertorManager;\r
-\r
-    @Before\r
-    public void setUp() {\r
-        convertorManager = ConvertorManagerFactory.createDefaultManager();\r
-    }\r
-\r
-    /**\r
-     * Test empty GroupDescStats conversion\r
-     */\r
-    @Test\r
-    public void test() {\r
-        List<GroupDesc> groupDescStats = new ArrayList<>();\r
-\r
-        VersionConvertorData data = new VersionConvertorData(OFConstants.OFP_VERSION_1_3);\r
-        List<GroupDescStats> statsList = convert(groupDescStats, data);\r
-        Assert.assertEquals("Wrong groupDesc stats size", 0, statsList.size());\r
-    }\r
-\r
-    /**\r
-     * Test single GroupDescStat conversion without buckets\r
-     */\r
-    @Test\r
-    public void testSingleGroupDescStat() {\r
-        List<GroupDesc> groupDescStats = new ArrayList<>();\r
-        GroupDescBuilder builder = new GroupDescBuilder();\r
-        builder.setType(GroupType.OFPGTALL);\r
-        builder.setGroupId(new GroupId(42L));\r
-        builder.setBucketsList(new ArrayList<>());\r
-        groupDescStats.add(builder.build());\r
-\r
-        VersionConvertorData data = new VersionConvertorData(OFConstants.OFP_VERSION_1_3);\r
-        List<GroupDescStats> statsList = convert(groupDescStats, data);\r
-\r
-        Assert.assertEquals("Wrong groupDesc stats size", 1, statsList.size());\r
-        GroupDescStats stat = statsList.get(0);\r
-        Assert.assertEquals("Wrong type", GroupTypes.GroupAll, stat.getGroupType());\r
-        Assert.assertEquals("Wrong group-id", 42, stat.getGroupId().getValue().intValue());\r
-        Assert.assertEquals("Wrong key", 42, stat.getKey().getGroupId().getValue().intValue());\r
-        Assert.assertEquals("Wrong buckets size", 0, stat.getBuckets().getBucket().size());\r
-    }\r
-\r
-    /**\r
-     * Test single GroupDescStats conversion\r
-     */\r
-    @Test\r
-    public void testGroupDescStats() {\r
-        List<GroupDesc> groupDescStats = new ArrayList<>();\r
-\r
-        // **********************************************\r
-        // First group desc\r
-        // **********************************************\r
-        GroupDescBuilder builder = new GroupDescBuilder();\r
-        builder.setType(GroupType.OFPGTFF);\r
-        builder.setGroupId(new GroupId(42L));\r
-\r
-        // Buckets for first group desc\r
-        List<BucketsList> bucketsList = new ArrayList<>();\r
-        BucketsListBuilder bucketsBuilder = new BucketsListBuilder();\r
-        bucketsBuilder.setWeight(16);\r
-        bucketsBuilder.setWatchPort(new PortNumber(84L));\r
-        bucketsBuilder.setWatchGroup(168L);\r
-\r
-        // Actions for buckets for first group desc\r
-        List<Action> actions = new ArrayList<>();\r
-        ActionBuilder actionBuilder = new ActionBuilder();\r
-        actionBuilder.setActionChoice(new CopyTtlInCaseBuilder().build());\r
-        actions.add(actionBuilder.build());\r
-\r
-        // Build bucket with actions\r
-        bucketsBuilder.setAction(actions);\r
-        bucketsList.add(bucketsBuilder.build());\r
-\r
-        // Build first group desc\r
-        builder.setBucketsList(bucketsList);\r
-        groupDescStats.add(builder.build());\r
-\r
-        // **********************************************\r
-        // Second group desc\r
-        // **********************************************\r
-        builder = new GroupDescBuilder();\r
-        builder.setType(GroupType.OFPGTINDIRECT);\r
-        builder.setGroupId(new GroupId(50L));\r
-\r
-        // First buckets for second group desc\r
-        bucketsList = new ArrayList<>();\r
-        bucketsBuilder = new BucketsListBuilder();\r
-        bucketsBuilder.setWeight(100);\r
-        bucketsBuilder.setWatchPort(new PortNumber(200L));\r
-        bucketsBuilder.setWatchGroup(400L);\r
-\r
-        // Actions for first buckets for second group desc\r
-        actions = new ArrayList<>();\r
-\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setActionChoice(new CopyTtlOutCaseBuilder().build());\r
-        actions.add(actionBuilder.build());\r
-\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setActionChoice(new DecNwTtlCaseBuilder().build());\r
-        actions.add(actionBuilder.build());\r
-\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setActionChoice(new PopPbbCaseBuilder().build());\r
-        actions.add(actionBuilder.build());\r
-\r
-        // Build first bucket with actions\r
-        bucketsBuilder.setAction(actions);\r
-        bucketsList.add(bucketsBuilder.build());\r
-\r
-        // Second buckets for second group desc\r
-        bucketsBuilder = new BucketsListBuilder();\r
-        bucketsBuilder.setWeight(5);\r
-        bucketsBuilder.setWatchPort(new PortNumber(10L));\r
-        bucketsBuilder.setWatchGroup(15L);\r
-\r
-        // Actions for second buckets for second group desc\r
-        actions = new ArrayList<>();\r
-\r
-        // Build second bucket with actions\r
-        bucketsBuilder.setAction(actions);\r
-        bucketsList.add(bucketsBuilder.build());\r
-\r
-        // Build second group desc\r
-        builder.setBucketsList(bucketsList);\r
-        groupDescStats.add(builder.build());\r
-\r
-\r
-        VersionConvertorData data = new VersionConvertorData(OFConstants.OFP_VERSION_1_3);\r
-        List<GroupDescStats> statsList = convert(groupDescStats, data);\r
-        Assert.assertEquals("Wrong groupDesc stats size", 2, statsList.size());\r
-\r
-        // **********************************************\r
-        // Test first group desc\r
-        // **********************************************\r
-        GroupDescStats stat = statsList.get(0);\r
-        Assert.assertEquals("Wrong type", GroupTypes.GroupFf, stat.getGroupType());\r
-        Assert.assertEquals("Wrong group-id", 42, stat.getGroupId().getValue().intValue());\r
-        Assert.assertEquals("Wrong key", 42, stat.getKey().getGroupId().getValue().intValue());\r
-        Assert.assertEquals("Wrong buckets size", 1, stat.getBuckets().getBucket().size());\r
-\r
-        // Test first bucket for first group desc\r
-        Bucket bucket = stat.getBuckets().getBucket().get(0);\r
-        Assert.assertEquals("Wrong type", 0, bucket.getKey().getBucketId().getValue().intValue());\r
-        Assert.assertEquals("Wrong type", 0, bucket.getBucketId().getValue().intValue());\r
-        Assert.assertEquals("Wrong type", 16, bucket.getWeight().intValue());\r
-        Assert.assertEquals("Wrong type", 168, bucket.getWatchGroup().intValue());\r
-        Assert.assertEquals("Wrong type", 84, bucket.getWatchPort().intValue());\r
-        Assert.assertEquals("Wrong type", 1, bucket.getAction().size());\r
-\r
-        // Test first action for first bucket for first group desc\r
-        org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list\r
-                .Action action = bucket.getAction().get(0);\r
-        Assert.assertEquals("Wrong type", 0, action.getOrder().intValue());\r
-        Assert.assertEquals("Wrong type", "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112"\r
-                + ".action.action.CopyTtlInCase", action.getAction().getImplementedInterface().getName());\r
-\r
-        // **********************************************\r
-        // Test second group desc\r
-        // **********************************************\r
-        stat = statsList.get(1);\r
-        Assert.assertEquals("Wrong type", GroupTypes.GroupIndirect, stat.getGroupType());\r
-        Assert.assertEquals("Wrong group-id", 50, stat.getGroupId().getValue().intValue());\r
-        Assert.assertEquals("Wrong key", 50, stat.getKey().getGroupId().getValue().intValue());\r
-        Assert.assertEquals("Wrong buckets size", 2, stat.getBuckets().getBucket().size());\r
-\r
-        // Test first bucket for second group desc\r
-        bucket = stat.getBuckets().getBucket().get(0);\r
-        Assert.assertEquals("Wrong type", 0, bucket.getKey().getBucketId().getValue().intValue());\r
-        Assert.assertEquals("Wrong type", 0, bucket.getBucketId().getValue().intValue());\r
-        Assert.assertEquals("Wrong type", 100, bucket.getWeight().intValue());\r
-        Assert.assertEquals("Wrong type", 400, bucket.getWatchGroup().intValue());\r
-        Assert.assertEquals("Wrong type", 200, bucket.getWatchPort().intValue());\r
-        Assert.assertEquals("Wrong type", 3, bucket.getAction().size());\r
-\r
-        // Test first action for first bucket of second group desc\r
-        action = bucket.getAction().get(0);\r
-        Assert.assertEquals("Wrong type", 0, action.getOrder().intValue());\r
-        Assert.assertEquals("Wrong type", "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112"\r
-                + ".action.action.CopyTtlOutCase", action.getAction().getImplementedInterface().getName());\r
-\r
-        // Test second action for first bucket of second group desc\r
-        action = bucket.getAction().get(1);\r
-        Assert.assertEquals("Wrong type", 1, action.getOrder().intValue());\r
-        Assert.assertEquals("Wrong type", "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112"\r
-                + ".action.action.DecNwTtlCase", action.getAction().getImplementedInterface().getName());\r
-\r
-        // Test third action for first bucket of second group desc\r
-        action = bucket.getAction().get(2);\r
-        Assert.assertEquals("Wrong type", 2, action.getOrder().intValue());\r
-        Assert.assertEquals("Wrong type", "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112"\r
-                + ".action.action.PopPbbActionCase", action.getAction().getImplementedInterface().getName());\r
-\r
-        // Test second bucket for second group desc\r
-        bucket = stat.getBuckets().getBucket().get(1);\r
-        Assert.assertEquals("Wrong type", 1, bucket.getKey().getBucketId().getValue().intValue());\r
-        Assert.assertEquals("Wrong type", 1, bucket.getBucketId().getValue().intValue());\r
-        Assert.assertEquals("Wrong type", 5, bucket.getWeight().intValue());\r
-        Assert.assertEquals("Wrong type", 15, bucket.getWatchGroup().intValue());\r
-        Assert.assertEquals("Wrong type", 10, bucket.getWatchPort().intValue());\r
-        Assert.assertEquals("Wrong type", 0, bucket.getAction().size());\r
-    }\r
-\r
-    private List<GroupDescStats> convert(List<GroupDesc> groupDescStats,VersionConvertorData data) {\r
-        Optional<List<GroupDescStats>> statsListOptional = convertorManager.convert(groupDescStats, data);\r
-        return  statsListOptional.orElse(Collections.emptyList());\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * 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.openflow.md.core.sal.convertor;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Optional;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupTypes;
+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.desc.stats.reply.GroupDescStats;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.CopyTtlInCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.CopyTtlOutCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.DecNwTtlCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PopPbbCaseBuilder;
+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.GroupId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.buckets.grouping.BucketsList;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.buckets.grouping.BucketsListBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.desc._case.multipart.reply.group.desc.GroupDesc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.desc._case.multipart.reply.group.desc.GroupDescBuilder;
+
+/**
+ * Unit tests for GroupDescStats conversion.
+ *
+ * @author michal.polkorab
+ */
+public class GroupDescStatsResponseConvertorTest {
+    private ConvertorManager convertorManager;
+
+    @Before
+    public void setUp() {
+        convertorManager = ConvertorManagerFactory.createDefaultManager();
+    }
+
+    /**
+     * Test empty GroupDescStats conversion.
+     */
+    @Test
+    public void test() {
+        List<GroupDesc> groupDescStats = new ArrayList<>();
+
+        VersionConvertorData data = new VersionConvertorData(OFConstants.OFP_VERSION_1_3);
+        List<GroupDescStats> statsList = convert(groupDescStats, data);
+        Assert.assertEquals("Wrong groupDesc stats size", 0, statsList.size());
+    }
+
+    /**
+     * Test single GroupDescStat conversion without buckets.
+     */
+    @Test
+    public void testSingleGroupDescStat() {
+        GroupDescBuilder builder = new GroupDescBuilder();
+        builder.setType(GroupType.OFPGTALL);
+        builder.setGroupId(new GroupId(42L));
+        builder.setBucketsList(new ArrayList<>());
+        List<GroupDesc> groupDescStats = new ArrayList<>();
+        groupDescStats.add(builder.build());
+
+        VersionConvertorData data = new VersionConvertorData(OFConstants.OFP_VERSION_1_3);
+        List<GroupDescStats> statsList = convert(groupDescStats, data);
+
+        Assert.assertEquals("Wrong groupDesc stats size", 1, statsList.size());
+        GroupDescStats stat = statsList.get(0);
+        Assert.assertEquals("Wrong type", GroupTypes.GroupAll, stat.getGroupType());
+        Assert.assertEquals("Wrong group-id", 42, stat.getGroupId().getValue().intValue());
+        Assert.assertEquals("Wrong key", 42, stat.key().getGroupId().getValue().intValue());
+        Assert.assertEquals("Wrong buckets size", 0, stat.getBuckets().nonnullBucket().size());
+    }
+
+    /**
+     * Test single GroupDescStats conversion.
+     */
+    @Test
+    public void testGroupDescStats() {
+
+        // **********************************************
+        // First group desc
+        // **********************************************
+        GroupDescBuilder builder = new GroupDescBuilder();
+        builder.setType(GroupType.OFPGTFF);
+        builder.setGroupId(new GroupId(42L));
+
+        // Buckets for first group desc
+        BucketsListBuilder bucketsBuilder = new BucketsListBuilder();
+        bucketsBuilder.setWeight(16);
+        bucketsBuilder.setWatchPort(new PortNumber(84L));
+        bucketsBuilder.setWatchGroup(168L);
+
+        // Actions for buckets for first group desc
+        List<Action> actions = new ArrayList<>();
+        ActionBuilder actionBuilder = new ActionBuilder();
+        actionBuilder.setActionChoice(new CopyTtlInCaseBuilder().build());
+        actions.add(actionBuilder.build());
+
+        // Build bucket with actions
+        bucketsBuilder.setAction(actions);
+        List<BucketsList> bucketsList = new ArrayList<>();
+        bucketsList.add(bucketsBuilder.build());
+
+        // Build first group desc
+        builder.setBucketsList(bucketsList);
+        List<GroupDesc> groupDescStats = new ArrayList<>();
+        groupDescStats.add(builder.build());
+
+        // **********************************************
+        // Second group desc
+        // **********************************************
+        builder = new GroupDescBuilder();
+        builder.setType(GroupType.OFPGTINDIRECT);
+        builder.setGroupId(new GroupId(50L));
+
+        // First buckets for second group desc
+        bucketsList = new ArrayList<>();
+        bucketsBuilder = new BucketsListBuilder();
+        bucketsBuilder.setWeight(100);
+        bucketsBuilder.setWatchPort(new PortNumber(200L));
+        bucketsBuilder.setWatchGroup(400L);
+
+        // Actions for first buckets for second group desc
+        actions = new ArrayList<>();
+
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setActionChoice(new CopyTtlOutCaseBuilder().build());
+        actions.add(actionBuilder.build());
+
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setActionChoice(new DecNwTtlCaseBuilder().build());
+        actions.add(actionBuilder.build());
+
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setActionChoice(new PopPbbCaseBuilder().build());
+        actions.add(actionBuilder.build());
+
+        // Build first bucket with actions
+        bucketsBuilder.setAction(actions);
+        bucketsList.add(bucketsBuilder.build());
+
+        // Second buckets for second group desc
+        bucketsBuilder = new BucketsListBuilder();
+        bucketsBuilder.setWeight(5);
+        bucketsBuilder.setWatchPort(new PortNumber(10L));
+        bucketsBuilder.setWatchGroup(15L);
+
+        // Actions for second buckets for second group desc
+        actions = new ArrayList<>();
+
+        // Build second bucket with actions
+        bucketsBuilder.setAction(actions);
+        bucketsList.add(bucketsBuilder.build());
+
+        // Build second group desc
+        builder.setBucketsList(bucketsList);
+        groupDescStats.add(builder.build());
+
+
+        VersionConvertorData data = new VersionConvertorData(OFConstants.OFP_VERSION_1_3);
+        List<GroupDescStats> statsList = convert(groupDescStats, data);
+        Assert.assertEquals("Wrong groupDesc stats size", 2, statsList.size());
+
+        // **********************************************
+        // Test first group desc
+        // **********************************************
+        GroupDescStats stat = statsList.get(0);
+        Assert.assertEquals("Wrong type", GroupTypes.GroupFf, stat.getGroupType());
+        Assert.assertEquals("Wrong group-id", 42, stat.getGroupId().getValue().intValue());
+        Assert.assertEquals("Wrong key", 42, stat.key().getGroupId().getValue().intValue());
+        Assert.assertEquals("Wrong buckets size", 1, stat.getBuckets().nonnullBucket().size());
+
+        // Test first bucket for first group desc
+        Iterator<Bucket> bucketIt = stat.getBuckets().nonnullBucket().values().iterator();
+        Bucket bucket = bucketIt.next();
+        Assert.assertEquals("Wrong type", 0, bucket.key().getBucketId().getValue().intValue());
+        Assert.assertEquals("Wrong type", 0, bucket.getBucketId().getValue().intValue());
+        Assert.assertEquals("Wrong type", 16, bucket.getWeight().intValue());
+        Assert.assertEquals("Wrong type", 168, bucket.getWatchGroup().intValue());
+        Assert.assertEquals("Wrong type", 84, bucket.getWatchPort().intValue());
+        Assert.assertEquals("Wrong type", 1, bucket.getAction().size());
+
+        // Test first action for first bucket for first group desc
+        org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list
+                .Action action = bucket.nonnullAction().values().iterator().next();
+        Assert.assertEquals("Wrong type", 0, action.getOrder().intValue());
+        Assert.assertEquals("Wrong type", "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112"
+                + ".action.action.CopyTtlInCase", action.getAction().implementedInterface().getName());
+
+        // **********************************************
+        // Test second group desc
+        // **********************************************
+        stat = statsList.get(1);
+        Assert.assertEquals("Wrong type", GroupTypes.GroupIndirect, stat.getGroupType());
+        Assert.assertEquals("Wrong group-id", 50, stat.getGroupId().getValue().intValue());
+        Assert.assertEquals("Wrong key", 50, stat.key().getGroupId().getValue().intValue());
+        Assert.assertEquals("Wrong buckets size", 2, stat.getBuckets().nonnullBucket().size());
+
+        // Test first bucket for second group desc
+        bucketIt = stat.getBuckets().nonnullBucket().values().iterator();
+        bucket = bucketIt.next();
+        Assert.assertEquals("Wrong type", 0, bucket.key().getBucketId().getValue().intValue());
+        Assert.assertEquals("Wrong type", 0, bucket.getBucketId().getValue().intValue());
+        Assert.assertEquals("Wrong type", 100, bucket.getWeight().intValue());
+        Assert.assertEquals("Wrong type", 400, bucket.getWatchGroup().intValue());
+        Assert.assertEquals("Wrong type", 200, bucket.getWatchPort().intValue());
+        Assert.assertEquals("Wrong type", 3, bucket.nonnullAction().size());
+
+        // Test first action for first bucket of second group desc
+        var actionIt = bucket.nonnullAction().values().iterator();
+        action = actionIt.next();
+        Assert.assertEquals("Wrong type", 0, action.getOrder().intValue());
+        Assert.assertEquals("Wrong type", "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112"
+                + ".action.action.CopyTtlOutCase", action.getAction().implementedInterface().getName());
+
+        // Test second action for first bucket of second group desc
+        action = actionIt.next();
+        Assert.assertEquals("Wrong type", 1, action.getOrder().intValue());
+        Assert.assertEquals("Wrong type", "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112"
+                + ".action.action.DecNwTtlCase", action.getAction().implementedInterface().getName());
+
+        // Test third action for first bucket of second group desc
+        action = actionIt.next();
+        Assert.assertEquals("Wrong type", 2, action.getOrder().intValue());
+        Assert.assertEquals("Wrong type", "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112"
+                + ".action.action.PopPbbActionCase", action.getAction().implementedInterface().getName());
+
+        // Test second bucket for second group desc
+        bucket = bucketIt.next();
+        Assert.assertEquals("Wrong type", 1, bucket.key().getBucketId().getValue().intValue());
+        Assert.assertEquals("Wrong type", 1, bucket.getBucketId().getValue().intValue());
+        Assert.assertEquals("Wrong type", 5, bucket.getWeight().intValue());
+        Assert.assertEquals("Wrong type", 15, bucket.getWatchGroup().intValue());
+        Assert.assertEquals("Wrong type", 10, bucket.getWatchPort().intValue());
+        Assert.assertEquals("Wrong type", 0, bucket.nonnullAction().size());
+    }
+
+    private List<GroupDescStats> convert(List<GroupDesc> groupDescStats,VersionConvertorData data) {
+        Optional<List<GroupDescStats>> statsListOptional = convertorManager.convert(groupDescStats, data);
+        return  statsListOptional.orElse(Collections.emptyList());
+    }
+}