Merge "OPNFLWPLUG-898 : remove deprecated checkedfuture"
authorAnil Vishnoi <vishnoianil@gmail.com>
Sun, 3 Jun 2018 19:54:46 +0000 (19:54 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Sun, 3 Jun 2018 19:54:46 +0000 (19:54 +0000)
15 files changed:
applications/forwardingrules-manager/src/main/java/org/opendaylight/openflowplugin/applications/frm/impl/FlowNodeReconciliationImpl.java
applications/topology-lldp-discovery/src/main/java/org/opendaylight/openflowplugin/applications/topology/lldp/utils/LLDPDiscoveryUtils.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/LearnCodecUtil.java
libraries/liblldp/src/main/java/org/opendaylight/openflowplugin/libraries/liblldp/BitBufferHelper.java
libraries/liblldp/src/main/java/org/opendaylight/openflowplugin/libraries/liblldp/CustomTLVKey.java
libraries/liblldp/src/main/java/org/opendaylight/openflowplugin/libraries/liblldp/EtherTypes.java
libraries/liblldp/src/main/java/org/opendaylight/openflowplugin/libraries/liblldp/EthernetAddress.java
libraries/liblldp/src/main/java/org/opendaylight/openflowplugin/libraries/liblldp/HexEncode.java
libraries/liblldp/src/main/java/org/opendaylight/openflowplugin/libraries/liblldp/LLDP.java
libraries/liblldp/src/main/java/org/opendaylight/openflowplugin/libraries/liblldp/LLDPTLV.java
libraries/liblldp/src/main/java/org/opendaylight/openflowplugin/libraries/liblldp/NetUtils.java
libraries/liblldp/src/main/java/org/opendaylight/openflowplugin/libraries/liblldp/Packet.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/connection/HandshakeManagerImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/registry/flow/DeviceFlowRegistryImpl.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/GroupConvertorTest.java

index d408bc4ee35f799ed549e36cbedc2aed203a25c8..417e56e18487bd4cf72b437c4ff3d4f6519a7e4d 100644 (file)
@@ -157,8 +157,6 @@ public class FlowNodeReconciliationImpl implements FlowNodeReconciliation {
                     connectedNode.toString());
             reconciliationPreProcess(connectedNode);
         }
-        LOG.debug("Bundle based reconciliation status : {}",
-                provider.isBundleBasedReconciliationEnabled() ? "Enable" : "Disable");
         if (provider.isBundleBasedReconciliationEnabled()) {
             BundleBasedReconciliationTask bundleBasedReconTask = new BundleBasedReconciliationTask(connectedNode);
             return JdkFutureAdapters.listenInPoolThread(executor.submit(bundleBasedReconTask));
@@ -181,7 +179,7 @@ public class FlowNodeReconciliationImpl implements FlowNodeReconciliation {
             Optional<FlowCapableNode> flowNode = Optional.absent();
             BundleId bundleIdValue = new BundleId(BUNDLE_ID.getAndIncrement());
             BigInteger dpnId = getDpnIdFromNodeName(node);
-            LOG.debug("Triggering bundle based reconciliation for device :{}", dpnId);
+            LOG.info("Triggering bundle based reconciliation for device : {}", dpnId);
             ReadOnlyTransaction trans = provider.getReadTranaction();
             try {
                 flowNode = trans.read(LogicalDatastoreType.CONFIGURATION, nodeIdentity).get();
@@ -193,6 +191,10 @@ public class FlowNodeReconciliationImpl implements FlowNodeReconciliation {
                 LOG.debug("FlowNode present for Datapath ID {}", dpnId);
                 final NodeRef nodeRef = new NodeRef(nodeIdentity.firstIdentifierOf(Node.class));
 
+                final ControlBundleInput closeBundleInput = new ControlBundleInputBuilder().setNode(nodeRef)
+                        .setBundleId(bundleIdValue).setFlags(BUNDLE_FLAGS)
+                        .setType(BundleControlType.ONFBCTCLOSEREQUEST).build();
+
                 final ControlBundleInput openBundleInput = new ControlBundleInputBuilder().setNode(nodeRef)
                         .setBundleId(bundleIdValue).setFlags(BUNDLE_FLAGS).setType(BundleControlType.ONFBCTOPENREQUEST)
                         .build();
@@ -205,22 +207,30 @@ public class FlowNodeReconciliationImpl implements FlowNodeReconciliation {
                         .setNode(nodeRef).setBundleId(bundleIdValue).setFlags(BUNDLE_FLAGS)
                         .setMessages(createMessages(nodeRef, flowNode)).build();
 
-                ListenableFuture<RpcResult<ControlBundleOutput>> openBundle
-                        = salBundleService.controlBundle(openBundleInput);
+                /* Close previously opened bundle on the openflow switch if any */
+                ListenableFuture<RpcResult<ControlBundleOutput>> closeBundle
+                        = salBundleService.controlBundle(closeBundleInput);
 
-                ListenableFuture<RpcResult<AddBundleMessagesOutput>> addBundleMessagesFuture = Futures
-                        .transformAsync(JdkFutureAdapters.listenInPoolThread(openBundle), rpcResult -> {
+                /* Open a new bundle on the switch */
+                ListenableFuture<RpcResult<ControlBundleOutput>> openBundle =
+                        Futures.transformAsync(closeBundle,
+                            rpcResult -> salBundleService.controlBundle(openBundleInput),
+                            MoreExecutors.directExecutor());
+
+                /* Push groups and flows via bundle add messages */
+                ListenableFuture<RpcResult<AddBundleMessagesOutput>> addBundleMessagesFuture
+                        = Futures.transformAsync(openBundle, rpcResult -> {
                             if (rpcResult.isSuccessful()) {
-                                return JdkFutureAdapters
-                                        .listenInPoolThread(salBundleService.addBundleMessages(addBundleMessagesInput));
+                                return salBundleService.addBundleMessages(addBundleMessagesInput);
                             }
                             return Futures.immediateFuture(null);
                         }, MoreExecutors.directExecutor());
+
+                /* Commit the bundle on the openflow switch */
                 ListenableFuture<RpcResult<ControlBundleOutput>> commitBundleFuture
                         = Futures.transformAsync(addBundleMessagesFuture, rpcResult -> {
                             if (rpcResult.isSuccessful()) {
-                                return JdkFutureAdapters
-                                        .listenInPoolThread(salBundleService.controlBundle(commitBundleInput));
+                                return salBundleService.controlBundle(commitBundleInput);
                             }
                             return Futures.immediateFuture(null);
                         }, MoreExecutors.directExecutor());
index f7d2e475dcf910865e1b3189993e4ad9ef6bc335..39288e64ba51ac8dc059c0e1754a9609bccbd9ce 100644 (file)
@@ -130,7 +130,7 @@ public final class LLDPDiscoveryUtils {
                 InstanceIdentifier<NodeConnector> srcInstanceId = InstanceIdentifier.builder(Nodes.class)
                         .child(Node.class, new NodeKey(srcNodeId))
                         .child(NodeConnector.class, new NodeConnectorKey(srcNodeConnectorId))
-                        .toInstance();
+                        .build();
                 nodeConnectorRef = new NodeConnectorRef(srcInstanceId);
             } catch (Exception e) {
                 LOG.debug("Caught exception while parsing out lldp optional and custom fields", e);
index 3da7e8a86bfc5ba6bcfd473464ad73be8161cfff..a453440a2001ea41ea2d19b934ef5d886340ef18 100644 (file)
@@ -252,9 +252,9 @@ public final class LearnCodecUtil {
 
     private static FlowMods readFlowModAddMatchFromField(ByteBuf message, short numBits) {
         FlowModAddMatchFromFieldBuilder builder = new FlowModAddMatchFromFieldBuilder();
-        builder.setSrcField((long) message.readInt());
+        builder.setSrcField(message.readUnsignedInt());
         builder.setSrcOfs((int) message.readShort());
-        builder.setDstField((long) message.readInt());
+        builder.setDstField(message.readUnsignedInt());
         builder.setDstOfs((int) message.readShort());
         builder.setFlowModNumBits((int) numBits);
         length -= FROM_FIELD_LENGTH - EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
@@ -269,7 +269,7 @@ public final class LearnCodecUtil {
     private static FlowMods readFlowModAddMatchFromValue(ByteBuf message, short numBits) {
         FlowModAddMatchFromValueBuilder builder = new FlowModAddMatchFromValueBuilder();
         builder.setValue(message.readUnsignedShort());
-        builder.setSrcField((long) message.readInt());
+        builder.setSrcField(message.readUnsignedInt());
         builder.setSrcOfs((int) message.readShort());
         builder.setFlowModNumBits((int) numBits);
         length -= FROM_VALUE_LENGTH - EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
@@ -283,9 +283,9 @@ public final class LearnCodecUtil {
 
     private static FlowMods readFlowModCopyFromField(ByteBuf message, short numBits) {
         FlowModCopyFieldIntoFieldBuilder builder = new FlowModCopyFieldIntoFieldBuilder();
-        builder.setSrcField((long) message.readInt());
+        builder.setSrcField(message.readUnsignedInt());
         builder.setSrcOfs((int) message.readShort());
-        builder.setDstField((long) message.readInt());
+        builder.setDstField(message.readUnsignedInt());
         builder.setDstOfs((int) message.readShort());
         builder.setFlowModNumBits((int) numBits);
         length -= FROM_FIELD_LENGTH - EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
@@ -300,7 +300,7 @@ public final class LearnCodecUtil {
     private static FlowMods readFlowModCopyFromValue(ByteBuf message, short numBits) {
         FlowModCopyValueIntoFieldBuilder builder = new FlowModCopyValueIntoFieldBuilder();
         builder.setValue(message.readUnsignedShort());
-        builder.setDstField((long) message.readInt());
+        builder.setDstField(message.readUnsignedInt());
         builder.setDstOfs((int) message.readShort());
         builder.setFlowModNumBits((int) numBits);
         length -= FROM_VALUE_LENGTH - EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
@@ -314,7 +314,7 @@ public final class LearnCodecUtil {
 
     private static FlowMods readFlowToPort(ByteBuf message, short numBits) {
         FlowModOutputToPortBuilder builder = new FlowModOutputToPortBuilder();
-        builder.setSrcField((long) message.readInt());
+        builder.setSrcField(message.readUnsignedInt());
         builder.setSrcOfs((int) message.readShort());
         builder.setFlowModNumBits((int) numBits);
         length -= TO_PORT_LENGTH - EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
index 07d1e618dbaf43cebd711aee8942cf51832491ce..6d9ff899c7534cb44b939fc20ad91c0690514b3a 100644 (file)
@@ -169,7 +169,7 @@ public abstract class BitBufferHelper {
      */
     @Nonnull
     public static byte[] getBits(final byte[] data, final int startOffset, final int numBits) throws BufferException {
-        int startByteOffset = 0;
+        int startByteOffset;
         int extranumBits = numBits % NetUtils.NUM_BITS_IN_A_BYTE;
         final int extraOffsetBits = startOffset % NetUtils.NUM_BITS_IN_A_BYTE;
         int numBytes = numBits % NetUtils.NUM_BITS_IN_A_BYTE != 0 ? 1 + numBits / NetUtils.NUM_BITS_IN_A_BYTE
@@ -305,7 +305,7 @@ public abstract class BitBufferHelper {
     public static long toNumber(final byte[] array) {
         long ret = 0;
         long length = array.length;
-        int value = 0;
+        int value;
         for (int i = 0; i < length; i++) {
             value = array[i];
             if (value < 0) {
@@ -326,7 +326,7 @@ public abstract class BitBufferHelper {
         int bitsRest = numBits % NetUtils.NUM_BITS_IN_A_BYTE;
         int startOffset = array.length - length;
         long ret = 0;
-        int value = 0;
+        int value;
 
         value = array[startOffset - 1] & getLSBMask(bitsRest);
         value = array[startOffset - 1] < 0 ? array[startOffset - 1] + 256 : array[startOffset - 1];
@@ -350,7 +350,7 @@ public abstract class BitBufferHelper {
      */
     public static byte[] toByteArray(final Number input) {
         Class<? extends Number> dataType = input.getClass();
-        short size = 0;
+        short size;
         long longValue = input.longValue();
 
         if (dataType == Byte.class || dataType == byte.class) {
@@ -387,7 +387,7 @@ public abstract class BitBufferHelper {
      */
     public static byte[] toByteArray(final Number input, final int numBits) {
         Class<? extends Number> dataType = input.getClass();
-        short size = 0;
+        short size;
         long longValue = input.longValue();
 
         if (dataType == Short.class) {
@@ -411,7 +411,7 @@ public abstract class BitBufferHelper {
         }
 
         if (bytes[0] == 0 && dataType == Long.class || bytes[0] == 0 && dataType == Integer.class) {
-            int index = 0;
+            int index;
             for (index = 0; index < length; ++index) {
                 if (bytes[index] != 0) {
                     bytes[0] = bytes[index];
@@ -446,9 +446,9 @@ public abstract class BitBufferHelper {
      * @return byte[]
      */
     public static byte[] shiftBitsToMSB(final byte[] inputBytes, final int numBits) {
-        int numBitstoShiftBy = 0;
+        int numBitstoShiftBy;
         int leadZeroesMSB = 8;
-        int numEndRestBits = 0;
+        int numEndRestBits;
         int size = inputBytes.length;
         byte[] shiftedBytes = new byte[size];
 
@@ -517,8 +517,8 @@ public abstract class BitBufferHelper {
         int numBytes = inputBytes.length;
         int numBitstoShift = numBits % NetUtils.NUM_BITS_IN_A_BYTE;
         byte[] shiftedBytes = new byte[numBytes];
-        int inputLsb = 0;
-        int inputMsb = 0;
+        int inputLsb;
+        int inputMsb;
 
         if (numBitstoShift == 0) {
             return inputBytes;
@@ -555,7 +555,7 @@ public abstract class BitBufferHelper {
         int extraOffsetBits = startOffset % NetUtils.NUM_BITS_IN_A_BYTE;
         int extranumBits = numBits % NetUtils.NUM_BITS_IN_A_BYTE;
         int restBits = numBits % NetUtils.NUM_BITS_IN_A_BYTE;
-        int inputMSBbits = 0;
+        int inputMSBbits;
         int inputLSBbits = 0;
 
         if (numBits == 0) {
index 279446ae80e6c0d062daf988a9c2f23a81fbad3b..8f884fc9d6b8c881caca9ca9657a11d62f73f197 100644 (file)
@@ -56,15 +56,7 @@ public class CustomTLVKey {
         }
 
         CustomTLVKey other = (CustomTLVKey) obj;
-        if (oui != other.oui) {
-            return false;
-        }
-
-        if (subtype != other.subtype) {
-            return false;
-        }
-
-        return true;
+        return oui == other.oui && subtype == other.subtype;
     }
 
 }
index 21ca56a2408f8e2498269746d115105182e83b8e..a6e98d153a4b910623f0cf96044ef11e92695a7f 100644 (file)
@@ -26,8 +26,8 @@ public enum EtherTypes {
     CISCOQINQ("Cisco QINQ", 0x9200); // Cisco non-standard QinQ
 
     private static final String REGEX_NUMBER_STRING = "^[0-9]+$";
-    private String description;
-    private int number;
+    private final String description;
+    private final int number;
 
     EtherTypes(final String description, final int number) {
         this.description = description;
index 72433a6d89118d0a85cf16fe20ed168f0b856a6d..9cce96e0caf6be656142f80c6bc158dd029f5d7d 100644 (file)
@@ -94,10 +94,7 @@ public class EthernetAddress extends DataLinkAddress {
             return false;
         }
         EthernetAddress other = (EthernetAddress) obj;
-        if (!Arrays.equals(macAddress, other.macAddress)) {
-            return false;
-        }
-        return true;
+        return Arrays.equals(macAddress, other.macAddress);
     }
 
     @Override
index 02bc634653152d61c7feb1f98600bbddd1f17c30..f003b7a4987f1de3b1b02d6576291c0cd1f9b7b5 100644 (file)
@@ -79,8 +79,7 @@ public final class HexEncode {
     }
 
     public static long stringToLong(final String values) {
-        long value = new BigInteger(values.replaceAll(":", ""), 16).longValue();
-        return value;
+        return new BigInteger(values.replaceAll(":", ""), 16).longValue();
     }
 
     /**
index 56a02443dc632180b78e4784ce4b9ba880d0d6cf..0e10b316f112a9113c2fefec7568d816144ad335 100644 (file)
@@ -55,25 +55,26 @@ public class LLDP extends Packet {
     /**
      * Returns the TLV byte type.
      *
-     * @param String description of the type of TLV
+     * @param typeDesc description of the type of TLV
      * @return byte type of TLV
      */
     private byte getType(final String typeDesc) {
-        if (typeDesc.equals(CHASSISID)) {
-            return LLDPTLV.TLVType.ChassisID.getValue();
-        } else if (typeDesc.equals(PORTID)) {
-            return LLDPTLV.TLVType.PortID.getValue();
-        } else if (typeDesc.equals(TTL)) {
-            return LLDPTLV.TLVType.TTL.getValue();
-        } else if (typeDesc.equals(SYSTEMNAMEID)) {
-            return LLDPTLV.TLVType.SystemName.getValue();
-        } else {
-            return LLDPTLV.TLVType.Unknown.getValue();
+        switch (typeDesc) {
+            case CHASSISID:
+                return LLDPTLV.TLVType.ChassisID.getValue();
+            case PORTID:
+                return LLDPTLV.TLVType.PortID.getValue();
+            case TTL:
+                return LLDPTLV.TLVType.TTL.getValue();
+            case SYSTEMNAMEID:
+                return LLDPTLV.TLVType.SystemName.getValue();
+            default:
+                return LLDPTLV.TLVType.Unknown.getValue();
         }
     }
 
     private LLDPTLV getFromTLVs(final Byte type) {
-        LLDPTLV tlv = null;
+        LLDPTLV tlv;
         tlv = mandatoryTLVs.get(type);
         if (tlv == null) {
             tlv = optionalTLVs.get(type);
@@ -197,8 +198,7 @@ public class LLDP extends Packet {
         int lldpSize = size; // LLDP size
 
         if (LOG.isTraceEnabled()) {
-            LOG.trace("LLDP: {} (offset {} bitsize {})", new Object[] { HexEncode.bytesToHexString(data),
-                lldpOffset, lldpSize });
+            LOG.trace("LLDP: {} (offset {} bitsize {})", HexEncode.bytesToHexString(data), lldpOffset, lldpSize);
         }
         /*
          * Deserialize the TLVs until we reach the end of the packet
index 9af1e74130a68ea84ee578aecbcf86bbeff56ca3..6f3bfd339d78d721cde4a054d1580e80ec06d8c1 100644 (file)
@@ -50,7 +50,7 @@ public class LLDPTLV extends Packet {
                 (byte) 4), SystemName((byte) 5), SystemDesc((byte) 6), Custom(
                         (byte) 127);
 
-        private byte value;
+        private final byte value;
 
         TLVType(final byte value) {
             this.value = value;
@@ -95,7 +95,7 @@ public class LLDPTLV extends Packet {
      */
     public int getLength() {
         return (int) BitBufferHelper.toNumber(fieldValues.get(LENGTH),
-                FIELD_COORDINATES.get(LENGTH).getRight().intValue());
+                FIELD_COORDINATES.get(LENGTH).getRight());
     }
 
     /**
@@ -186,8 +186,7 @@ public class LLDPTLV extends Packet {
     public int getfieldnumBits(final String fieldName) {
         if (fieldName.equals(VALUE)) {
             return NetUtils.NUM_BITS_IN_A_BYTE * BitBufferHelper.getShort(
-                    fieldValues.get(LENGTH), FIELD_COORDINATES.get(LENGTH)
-                    .getRight().intValue());
+                    fieldValues.get(LENGTH), FIELD_COORDINATES.get(LENGTH).getRight());
         }
         return FIELD_COORDINATES.get(fieldName).getRight();
     }
index 59d135a5ae6a3702ae659fffbbbf0b2839e17abe..1425f0b7b385b8240dc96c54bfe71b1ed549c7d0 100644 (file)
@@ -360,10 +360,7 @@ public abstract class NetUtils {
     }
 
     public static boolean fieldsConflict(final int field1, final int field2) {
-        if (field1 == 0 || field2 == 0 || field1 == field2) {
-            return false;
-        }
-        return true;
+        return field1 != 0 && field2 != 0 && field1 != field2;
     }
 
     public static InetAddress parseInetAddress(final String addressString) {
index 4183cc7c5d4455b293354eb899e80e405aea47bc..7b1ffa6070c0336ea131caaba9ab454b7b511f1a 100644 (file)
@@ -93,7 +93,7 @@ public abstract class Packet {
             startOffset = bitOffset + this.getfieldOffset(hdrField);
             numBits = this.getfieldnumBits(hdrField);
 
-            byte[] hdrFieldBytes = null;
+            byte[] hdrFieldBytes;
             try {
                 hdrFieldBytes = BitBufferHelper.getBits(data, startOffset,
                         numBits);
index e2f9d91f973129315acd441c4d77579eab1e5a6a..e2107dfb73265d0df8be274324330ca1f64e991e 100644 (file)
@@ -169,7 +169,7 @@ public class HandshakeManagerImpl implements HandshakeManager {
     }
 
     private void stepByStepVersionSubStep(Short remoteVersion) throws Exception {
-        if (remoteVersion.equals(lastProposedVersion)) {
+        if (remoteVersion >= lastProposedVersion) {
             postHandshake(lastProposedVersion, getNextXid());
             LOG.trace("ret - OK - switch answered with lastProposedVersion");
         } else {
index 67e113edf7fe11adca681668d39fe4d9a0b987a4..f5f812157ee3f1dc0078a0c1ecec4946d410746a 100644 (file)
@@ -290,9 +290,11 @@ public class DeviceFlowRegistryImpl implements DeviceFlowRegistry {
                 return flowRegistryKey;
             }
         } else {
-            for (Map.Entry<FlowRegistryKey, FlowDescriptor> keyValueSet : flowRegistry.entrySet()) {
-                if (keyValueSet.getKey().equals(flowRegistryKey)) {
-                    return keyValueSet.getKey();
+            synchronized (flowRegistry) {
+                for (Map.Entry<FlowRegistryKey, FlowDescriptor> keyValueSet : flowRegistry.entrySet()) {
+                    if (keyValueSet.getKey().equals(flowRegistryKey)) {
+                        return keyValueSet.getKey();
+                    }
                 }
             }
         }
index 1209c264c95ee371ce781ce7380af39ebe232d2f..0a5ac4408cfa894f2996a788b09e66453e6f9bea 100644 (file)
@@ -20,7 +20,6 @@ import org.junit.Test;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlInCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.GroupActionCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.GroupActionCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.OutputActionCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetMplsTtlActionCaseBuilder;
@@ -42,6 +41,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group
 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.openflow.common.action.rev150203.action.grouping.action.choice.GroupCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetMplsTtlCaseBuilder;
 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.types.rev130731.GroupModCommand;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupType;
@@ -155,32 +156,30 @@ public class GroupConvertorTest {
         assertEquals((Long) 22L, outAddGroupInput.getBucketsList().get(0).getWatchGroup());
 
         final List<Action> outActionList = outAddGroupInput.getBucketsList().get(0).getAction();
-        for (int outItem = 0; outItem < outActionList.size(); outItem++) {
-            final Action action = outActionList
-                    .get(outItem);
-            if (action.getActionChoice() instanceof GroupActionCase) {
-                assertEquals((Long) 5L, ((GroupActionCase) action.getActionChoice()).getGroupAction().getGroupId());
-
-            }
-            // TODO:setMplsTTL :OF layer doesnt have get();
-        }
+        assertEquals(ImmutableList.of(new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action
+                    .rev150203.actions.grouping.ActionBuilder().setActionChoice(new GroupCaseBuilder().setGroupAction(
+                new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping
+                        .action.choice.group._case.GroupActionBuilder().setGroupId(5L).build()).build()).build(),
+                    new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping
+                    .ActionBuilder().setActionChoice(new GroupCaseBuilder().setGroupAction(
+                            new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action
+                            .grouping.action.choice.group._case.GroupActionBuilder().setGroupId(5L).build()).build())
+                    .build()), outActionList);
 
         assertEquals((Integer) 50, outAddGroupInput.getBucketsList().get(1).getWeight());
         assertEquals((long) 60, (long) outAddGroupInput.getBucketsList().get(1).getWatchPort().getValue());
         assertEquals((Long) 70L, outAddGroupInput.getBucketsList().get(1).getWatchGroup());
-        final List<Action> outActionList1 = outAddGroupInput.getBucketsList().get(1).getAction();
-        for (int outItem = 0; outItem < outActionList1.size(); outItem++) {
-            final Action action = outActionList1
-                    .get(outItem);
-            if (action.getActionChoice() instanceof GroupActionCase) {
-
-                assertEquals((Long) 6L, ((GroupActionCase) action.getActionChoice()).getGroupAction().getGroupId());
-
-
-            }
-            // TODO:setMplsTTL :OF layer doesnt have get();
-        }
 
+        final List<Action> outActionList1 = outAddGroupInput.getBucketsList().get(1).getAction();
+        assertEquals(ImmutableList.of(new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action
+                    .rev150203.actions.grouping.ActionBuilder().setActionChoice(new GroupCaseBuilder().setGroupAction(
+                new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping
+                        .action.choice.group._case.GroupActionBuilder().setGroupId(5L).build()).build()).build(),
+                    new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping
+                    .ActionBuilder().setActionChoice(new GroupCaseBuilder().setGroupAction(
+                            new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action
+                            .grouping.action.choice.group._case.GroupActionBuilder().setGroupId(5L).build()).build())
+                    .build()), outActionList1);
     }
 
     /**
@@ -266,22 +265,27 @@ public class GroupConvertorTest {
         assertEquals(10L, outAddGroupInput.getGroupId().getValue().longValue());
 
         final List<Action> outActionList = outAddGroupInput.getBucketsList().get(0).getAction();
-        for (int outItem = 0; outItem < outActionList.size(); outItem++) {
-            final Action action = outActionList
-                    .get(outItem);
-            if (action.getActionChoice() instanceof GroupActionCase) {
-                assertEquals((Long) 5L, ((GroupActionCase) action.getActionChoice()).getGroupAction().getGroupId());
-            }
-        }
+        assertEquals(ImmutableList.of(new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203
+                    .actions.grouping.ActionBuilder().setActionChoice(new GroupCaseBuilder().setGroupAction(
+                            new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action
+                            .grouping.action.choice.group._case.GroupActionBuilder().setGroupId(5L).build()).build())
+                    .build(),
+                    new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping
+                            .ActionBuilder().setActionChoice(new GroupCaseBuilder().setGroupAction(
+                                    new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203
+                                    .action.grouping.action.choice.group._case.GroupActionBuilder().setGroupId(6L)
+                                    .build()).build()).build()), outActionList);
 
         final List<Action> outActionList1 = outAddGroupInput.getBucketsList().get(1).getAction();
-        for (int outItem = 0; outItem < outActionList1.size(); outItem++) {
-            final Action action = outActionList1
-                    .get(outItem);
-            if (action.getActionChoice() instanceof GroupActionCase) {
-                assertEquals((Long) 6L, ((GroupActionCase) action.getActionChoice()).getGroupAction().getGroupId());
-            }
-        }
+        assertEquals(ImmutableList.of(new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203
+                    .actions.grouping.ActionBuilder().setActionChoice(
+                            new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action
+                            .grouping.action.choice.CopyTtlInCaseBuilder().build()).build(),
+                    new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping
+                            .ActionBuilder().setActionChoice(new SetMplsTtlCaseBuilder().setSetMplsTtlAction(
+                                    new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203
+                                            .action.grouping.action.choice.set.mpls.ttl._case.SetMplsTtlActionBuilder()
+                                            .setMplsTtl((short) 1).build()).build()).build()), outActionList1);
     }
 
     /**
@@ -488,31 +492,31 @@ public class GroupConvertorTest {
         assertEquals(10L, outAddGroupInput.getGroupId().getValue().longValue());
 
         final List<Action> outActionList = outAddGroupInput.getBucketsList().get(0).getAction();
-        for (int outItem = 0; outItem < outActionList.size(); outItem++) {
-            final Action action = outActionList
-                    .get(outItem);
-            if (action.getActionChoice() instanceof GroupActionCase) {
-                assertEquals((Long) 5L, ((GroupActionCase) action.getActionChoice()).getGroupAction().getGroupId());
-
-            }
-
-        }
+        assertEquals(ImmutableList.of(new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203
+                    .actions.grouping.ActionBuilder().setActionChoice(new GroupCaseBuilder().setGroupAction(
+                            new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action
+                                    .grouping.action.choice.group._case.GroupActionBuilder().setGroupId(5L).build())
+                        .build()).build(),
+                    new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping
+                            .ActionBuilder().setActionChoice(new GroupCaseBuilder().setGroupAction(
+                                    new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203
+                                            .action.grouping.action.choice.group._case.GroupActionBuilder()
+                                            .setGroupId(6L).build()).build()).build()), outActionList);
 
         final List<Action> outActionList1 = outAddGroupInput.getBucketsList().get(1).getAction();
-        for (int outItem = 0; outItem < outActionList1.size(); outItem++) {
-            final Action action = outActionList1
-                    .get(outItem);
-            if (action.getActionChoice() instanceof GroupActionCase) {
-
-                assertEquals((Long) 6L, ((GroupActionCase) action.getActionChoice()).getGroupAction().getGroupId());
-
-            }
-
-        }
-
+        assertEquals(ImmutableList.of(new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203
+                    .actions.grouping.ActionBuilder().setActionChoice(new GroupCaseBuilder().setGroupAction(
+                            new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action
+                                    .grouping.action.choice.group._case.GroupActionBuilder().setGroupId(5L).build())
+                        .build()).build(),
+                    new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping
+                            .ActionBuilder().setActionChoice(new GroupCaseBuilder().setGroupAction(
+                                    new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203
+                                            .action.grouping.action.choice.group._case.GroupActionBuilder()
+                                            .setGroupId(6L).build()).build()).build()), outActionList1);
     }
 
-    private GroupModInputBuilder convert(Group group, VersionDatapathIdConvertorData data) {
+    private GroupModInputBuilder convert(final Group group, final VersionDatapathIdConvertorData data) {
         final Optional<GroupModInputBuilder> outAddGroupInputOptional = convertorManager.convert(group, data);
         assertTrue("Group convertor not found", outAddGroupInputOptional.isPresent());
         return outAddGroupInputOptional.get();