TSC-99 Adjust to RPC method signature update
[genius.git] / interfacemanager / interfacemanager-impl / src / main / java / org / opendaylight / genius / interfacemanager / IfmUtil.java
index 8ed7448d74ebdc4f8ee968ffda8e5e68599fab37..538b8fc93f30d972e2e65e4ea20968c8dd1bb853 100755 (executable)
@@ -8,6 +8,7 @@
 package org.opendaylight.genius.interfacemanager;
 
 import static org.opendaylight.genius.interfacemanager.globals.InterfaceInfo.InterfaceType.GRE_TRUNK_INTERFACE;
+import static org.opendaylight.genius.interfacemanager.globals.InterfaceInfo.InterfaceType.LOGICAL_GROUP_INTERFACE;
 import static org.opendaylight.genius.interfacemanager.globals.InterfaceInfo.InterfaceType.MPLS_OVER_GRE;
 import static org.opendaylight.genius.interfacemanager.globals.InterfaceInfo.InterfaceType.VLAN_INTERFACE;
 import static org.opendaylight.genius.interfacemanager.globals.InterfaceInfo.InterfaceType.VXLAN_TRUNK_INTERFACE;
@@ -15,8 +16,10 @@ import static org.opendaylight.genius.interfacemanager.globals.InterfaceInfo.Int
 import com.google.common.base.Optional;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.util.concurrent.ListenableFuture;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.math.BigInteger;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
@@ -25,15 +28,17 @@ import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.genius.datastoreutils.DataStoreJobCoordinator;
+import org.opendaylight.genius.datastoreutils.SingleTransactionDataBroker;
+import org.opendaylight.genius.infra.ManagedNewTransactionRunner;
+import org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl;
 import org.opendaylight.genius.interfacemanager.commons.InterfaceManagerCommonUtils;
 import org.opendaylight.genius.interfacemanager.globals.InterfaceInfo;
 import org.opendaylight.genius.interfacemanager.globals.VlanInterfaceInfo;
-import org.opendaylight.genius.interfacemanager.servicebindings.flowbased.utilities.FlowBasedServicesUtils;
 import org.opendaylight.genius.mdsalutil.ActionInfo;
 import org.opendaylight.genius.mdsalutil.MDSALUtil;
 import org.opendaylight.genius.mdsalutil.MetaDataUtil;
 import org.opendaylight.genius.mdsalutil.NwConstants;
+import org.opendaylight.genius.mdsalutil.actions.ActionGroup;
 import org.opendaylight.genius.mdsalutil.actions.ActionNxResubmit;
 import org.opendaylight.genius.mdsalutil.actions.ActionOutput;
 import org.opendaylight.genius.mdsalutil.actions.ActionPushVlan;
@@ -42,6 +47,7 @@ import org.opendaylight.genius.mdsalutil.actions.ActionSetFieldTunnelId;
 import org.opendaylight.genius.mdsalutil.actions.ActionSetFieldVlanVid;
 import org.opendaylight.genius.mdsalutil.actions.ActionSetTunnelDestinationIp;
 import org.opendaylight.genius.mdsalutil.actions.ActionSetTunnelSourceIp;
+import org.opendaylight.infrautils.jobcoordinator.JobCoordinator;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.L2vlan;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.Tunnel;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri;
@@ -62,6 +68,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdPools;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.ReleaseIdInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.ReleaseIdInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.ReleaseIdOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.id.pools.IdPool;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.id.pools.IdPoolKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan;
@@ -71,6 +78,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeBase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeGre;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeLogicalGroup;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeMplsOverGre;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeVxlan;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeVxlanGpe;
@@ -82,11 +90,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.ser
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServicesKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxReg6;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.DatapathId;
 import org.opendaylight.yangtools.yang.binding.DataObject;
@@ -96,14 +99,20 @@ import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class IfmUtil {
+public final class IfmUtil {
+
     private static final Logger LOG = LoggerFactory.getLogger(IfmUtil.class);
     private static final int INVALID_ID = 0;
 
+    private IfmUtil() {
+        throw new IllegalStateException("Utility class");
+    }
+
     private static final ImmutableMap<Class<? extends TunnelTypeBase>, InterfaceInfo.InterfaceType>
         TUNNEL_TYPE_MAP = new ImmutableMap.Builder<Class<? extends TunnelTypeBase>, InterfaceInfo.InterfaceType>()
             .put(TunnelTypeGre.class, GRE_TRUNK_INTERFACE).put(TunnelTypeMplsOverGre.class, MPLS_OVER_GRE)
             .put(TunnelTypeVxlan.class, VXLAN_TRUNK_INTERFACE).put(TunnelTypeVxlanGpe.class, VXLAN_TRUNK_INTERFACE)
+            .put(TunnelTypeLogicalGroup.class, LOGICAL_GROUP_INTERFACE)
             .build();
 
     public static BigInteger getDpnFromNodeConnectorId(NodeConnectorId portId) {
@@ -124,21 +133,6 @@ public class IfmUtil {
         return null;
     }
 
-    public static String getPortNoFromInterfaceName(String ifaceName, DataBroker broker) {
-        org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
-            .ietf.interfaces.rev140508.interfaces.state.Interface ifState = InterfaceManagerCommonUtils
-                .getInterfaceStateFromOperDS(ifaceName, broker);
-
-        if (ifState == null) {
-            throw new NullPointerException("Interface information not present in oper DS for " + ifaceName);
-        }
-        String lowerLayerIf = ifState.getLowerLayerIf().get(0);
-        NodeConnectorId nodeConnectorId = new NodeConnectorId(lowerLayerIf);
-        String portNo = IfmUtil.getPortNoFromNodeConnectorId(nodeConnectorId);
-
-        return portNo;
-    }
-
     public static String getPortNoFromNodeConnectorId(NodeConnectorId portId) {
         /*
          * NodeConnectorId is of form 'openflow:dpnid:portnum'
@@ -181,10 +175,7 @@ public class IfmUtil {
                         new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
                             .ietf.interfaces.rev140508.interfaces.state.InterfaceKey(
                                 interfaceName));
-        InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
-            .ietf.interfaces.rev140508.interfaces.state.Interface> id = idBuilder
-                .build();
-        return id;
+        return idBuilder.build();
     }
 
     public static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
@@ -199,43 +190,21 @@ public class IfmUtil {
         return InstanceIdentifier.builder(IdPools.class).child(IdPool.class, new IdPoolKey(poolName)).build();
     }
 
-    public static List<String> getPortNameAndSuffixFromInterfaceName(String intfName) {
-        List<String> strList = new ArrayList<>(2);
-        int index = intfName.indexOf(":");
-        if (index != -1) {
-            strList.add(0, intfName.substring(0, index));
-            strList.add(1, intfName.substring(index));
-        }
-        return strList;
-    }
-
-    public static long getGroupId(long ifIndex, InterfaceInfo.InterfaceType infType) {
-        if (infType == InterfaceInfo.InterfaceType.LOGICAL_GROUP_INTERFACE) {
-            return ifIndex + IfmConstants.LOGICAL_GROUP_START;
-        } else if (infType == VLAN_INTERFACE) {
-            return ifIndex + IfmConstants.VLAN_GROUP_START;
-        } else {
-            return ifIndex + IfmConstants.TRUNK_GROUP_START;
-        }
-    }
-
-    public static List<String> getDpIdPortNameAndSuffixFromInterfaceName(String intfName) {
-        List<String> strList = new ArrayList<>(3);
-        int index1 = intfName.indexOf(":");
-        if (index1 != -1) {
-            int index2 = intfName.indexOf(":", index1 + 1);
-            strList.add(0, intfName.substring(0, index1));
-            if (index2 != -1) {
-                strList.add(1, intfName.substring(index1, index2));
-                strList.add(2, intfName.substring(index2));
-            } else {
-                strList.add(1, intfName.substring(index1));
-                strList.add(2, "");
-            }
+    public static long getGroupId(int ifIndex, InterfaceInfo.InterfaceType infType) {
+        if (infType == LOGICAL_GROUP_INTERFACE) {
+            return getLogicalTunnelSelectGroupId(ifIndex);
         }
-        return strList;
+        return 0;
     }
 
+    /**
+     * Synchronous blocking read from data store.
+     *
+     * @deprecated Use
+     * {@link SingleTransactionDataBroker#syncReadOptional(DataBroker, LogicalDatastoreType, InstanceIdentifier)}
+     *             instead of this.
+     */
+    @Deprecated
     public static <T extends DataObject> Optional<T> read(LogicalDatastoreType datastoreType,
             InstanceIdentifier<T> path, DataBroker broker) {
         try (ReadOnlyTransaction tx = broker.newReadOnlyTransaction()) {
@@ -247,9 +216,9 @@ public class IfmUtil {
     }
 
     public static List<Action> getEgressActionsForInterface(String interfaceName, Long tunnelKey, Integer actionKey,
-            DataBroker dataBroker, Boolean isDefaultEgress) {
+            InterfaceManagerCommonUtils interfaceUtils, Boolean isDefaultEgress) {
         List<ActionInfo> listActionInfo = getEgressActionInfosForInterface(interfaceName, tunnelKey,
-                actionKey == null ? 0 : actionKey, dataBroker, isDefaultEgress);
+                actionKey == null ? 0 : actionKey, interfaceUtils, isDefaultEgress);
         List<Action> actionsList = new ArrayList<>();
         for (ActionInfo actionInfo : listActionInfo) {
             actionsList.add(actionInfo.buildAction());
@@ -258,27 +227,29 @@ public class IfmUtil {
     }
 
     public static List<Instruction> getEgressInstructionsForInterface(String interfaceName, Long tunnelKey,
-            DataBroker dataBroker, Boolean isDefaultEgress) {
+            InterfaceManagerCommonUtils interfaceUtils, Boolean isDefaultEgress) {
         List<Instruction> instructions = new ArrayList<>();
         List<Action> actionList = MDSALUtil.buildActions(
-                getEgressActionInfosForInterface(interfaceName, tunnelKey, 0, dataBroker, isDefaultEgress));
+                getEgressActionInfosForInterface(interfaceName, tunnelKey, 0, interfaceUtils, isDefaultEgress));
         instructions.add(MDSALUtil.buildApplyActionsInstruction(actionList));
         return instructions;
     }
 
     public static List<Instruction> getEgressInstructionsForInterface(Interface interfaceInfo, String portNo,
-            Long tunnelKey, boolean isDefaultEgress, int ifIndex) {
+                                                                      Long tunnelKey, boolean isDefaultEgress,
+                                                                      int ifIndex, long groupId) {
         List<Instruction> instructions = new ArrayList<>();
         InterfaceInfo.InterfaceType ifaceType = getInterfaceType(interfaceInfo);
-        List<Action> actionList = MDSALUtil.buildActions(getEgressActionInfosForInterface(interfaceInfo, portNo,
-                ifaceType, tunnelKey, 0, isDefaultEgress, ifIndex));
+        List<Action> actionList = MDSALUtil.buildActions(
+                getEgressActionInfosForInterface(interfaceInfo, portNo, ifaceType, tunnelKey, 0,
+                                                 isDefaultEgress, ifIndex, groupId));
         instructions.add(MDSALUtil.buildApplyActionsInstruction(actionList));
         return instructions;
     }
 
     public static List<ActionInfo> getEgressActionInfosForInterface(String interfaceName, int actionKeyStart,
-            DataBroker dataBroker, Boolean isDefaultEgress) {
-        return getEgressActionInfosForInterface(interfaceName, null, actionKeyStart, dataBroker, isDefaultEgress);
+            InterfaceManagerCommonUtils interfaceUtils, Boolean isDefaultEgress) {
+        return getEgressActionInfosForInterface(interfaceName, null, actionKeyStart, interfaceUtils, isDefaultEgress);
     }
 
     /**
@@ -291,20 +262,19 @@ public class IfmUtil {
      *            Optional.
      * @param actionKeyStart
      *            action key
-     * @param dataBroker
-     *            databroker
+     * @param interfaceUtils
+     *            InterfaceManagerCommonUtils
      * @return list of actions
      */
     public static List<ActionInfo> getEgressActionInfosForInterface(String interfaceName, Long tunnelKey,
-            int actionKeyStart, DataBroker dataBroker, Boolean isDefaultEgress) {
-        Interface interfaceInfo = InterfaceManagerCommonUtils.getInterfaceFromConfigDS(new InterfaceKey(interfaceName),
-                dataBroker);
+            int actionKeyStart, InterfaceManagerCommonUtils interfaceUtils, Boolean isDefaultEgress) {
+        Interface interfaceInfo = interfaceUtils.getInterfaceFromConfigDS(new InterfaceKey(interfaceName));
         if (interfaceInfo == null) {
             throw new NullPointerException("Interface information not present in config DS for " + interfaceName);
         }
         org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
-            .ietf.interfaces.rev140508.interfaces.state.Interface ifState = InterfaceManagerCommonUtils
-                .getInterfaceStateFromOperDS(interfaceName, dataBroker);
+                .ietf.interfaces.rev140508.interfaces.state.Interface ifState =
+            interfaceUtils.getInterfaceState(interfaceName);
         if (ifState == null) {
             throw new NullPointerException("Interface information not present in oper DS for " + interfaceName);
         }
@@ -314,7 +284,7 @@ public class IfmUtil {
 
         InterfaceInfo.InterfaceType ifaceType = getInterfaceType(interfaceInfo);
         return getEgressActionInfosForInterface(interfaceInfo, portNo, ifaceType, tunnelKey, actionKeyStart,
-                isDefaultEgress, ifState.getIfIndex());
+                isDefaultEgress, ifState.getIfIndex(), 0);
     }
 
     /**
@@ -327,13 +297,15 @@ public class IfmUtil {
      * @param actionKeyStart the start for the first key assigned for the new actions
      * @param isDefaultEgress if it is the default egress
      * @param ifIndex interface index
+     * @param groupId group Id
      * @return list of actions for the interface
      */
     // The following suppression is for javac, not for checkstyle
     @SuppressWarnings("fallthrough")
+    @SuppressFBWarnings("SF_SWITCH_FALLTHROUGH")
     public static List<ActionInfo> getEgressActionInfosForInterface(Interface interfaceInfo, String portNo,
             InterfaceInfo.InterfaceType ifaceType, Long tunnelKey, int actionKeyStart, boolean isDefaultEgress,
-            int ifIndex) {
+            int ifIndex, long groupId) {
         List<ActionInfo> result = new ArrayList<>();
         switch (ifaceType) {
             case MPLS_OVER_GRE:
@@ -353,12 +325,15 @@ public class IfmUtil {
                     if (tunnelKey != null) {
                         result.add(new ActionSetFieldTunnelId(actionKeyStart++, BigInteger.valueOf(tunnelKey)));
                     }
-
+                } else {
+                    // For OF Tunnels default egress actions need to set tunnelIps
                     IfTunnel ifTunnel = interfaceInfo.getAugmentation(IfTunnel.class);
-                    if (BooleanUtils.isTrue(ifTunnel.isTunnelRemoteIpFlow())) {
+                    if (BooleanUtils.isTrue(ifTunnel.isTunnelRemoteIpFlow()
+                            && ifTunnel.getTunnelDestination() != null)) {
                         result.add(new ActionSetTunnelDestinationIp(actionKeyStart++, ifTunnel.getTunnelDestination()));
                     }
-                    if (BooleanUtils.isTrue(ifTunnel.isTunnelSourceIpFlow())) {
+                    if (BooleanUtils.isTrue(ifTunnel.isTunnelSourceIpFlow()
+                            && ifTunnel.getTunnelSource() != null)) {
                         result.add(new ActionSetTunnelSourceIp(actionKeyStart++, ifTunnel.getTunnelSource()));
                     }
                 }
@@ -366,7 +341,7 @@ public class IfmUtil {
             case VLAN_INTERFACE:
                 if (isDefaultEgress) {
                     IfL2vlan vlanIface = interfaceInfo.getAugmentation(IfL2vlan.class);
-                    LOG.trace("L2Vlan: {}", vlanIface);
+                    LOG.trace("get egress actions for l2vlan interface: {}", vlanIface);
                     boolean isVlanTransparent = false;
                     int vlanVid = 0;
                     if (vlanIface != null) {
@@ -379,13 +354,17 @@ public class IfmUtil {
                     }
                     result.add(new ActionOutput(actionKeyStart++, new Uri(portNo)));
                 } else {
-                    long regValue =
-                        MetaDataUtil.getReg6ValueForLPortDispatcher(ifIndex, NwConstants.DEFAULT_SERVICE_INDEX);
-                    result.add(new ActionRegLoad(actionKeyStart++, NxmNxReg6.class, IfmConstants.REG6_START_INDEX,
-                            IfmConstants.REG6_END_INDEX, regValue));
-                    result.add(new ActionNxResubmit(actionKeyStart++, NwConstants.EGRESS_LPORT_DISPATCHER_TABLE));
+                    addEgressActionInfosForInterface(ifIndex, actionKeyStart, result);
+                }
+                break;
+            case LOGICAL_GROUP_INTERFACE:
+                if (isDefaultEgress) {
+                    result.add(new ActionGroup(groupId));
+                } else {
+                    addEgressActionInfosForInterface(ifIndex, actionKeyStart, result);
                 }
                 break;
+
             default:
                 LOG.warn("Interface Type {} not handled yet", ifaceType);
                 break;
@@ -393,8 +372,15 @@ public class IfmUtil {
         return result;
     }
 
+    public static void addEgressActionInfosForInterface(int ifIndex, int actionKeyStart, List<ActionInfo> result) {
+        long regValue = MetaDataUtil.getReg6ValueForLPortDispatcher(ifIndex, NwConstants.DEFAULT_SERVICE_INDEX);
+        result.add(new ActionRegLoad(actionKeyStart++, NxmNxReg6.class, IfmConstants.REG6_START_INDEX,
+                IfmConstants.REG6_END_INDEX, regValue));
+        result.add(new ActionNxResubmit(actionKeyStart, NwConstants.EGRESS_LPORT_DISPATCHER_TABLE));
+    }
+
     public static NodeId getNodeIdFromNodeConnectorId(NodeConnectorId ncId) {
-        return new NodeId(ncId.getValue().substring(0, ncId.getValue().lastIndexOf(":")));
+        return new NodeId(ncId.getValue().substring(0, ncId.getValue().lastIndexOf(':')));
     }
 
     public static BigInteger[] mergeOpenflowMetadataWriteInstructions(List<Instruction> instructions) {
@@ -436,10 +422,10 @@ public class IfmUtil {
     public static void releaseId(IdManagerService idManager, String poolName, String idKey) {
         ReleaseIdInput idInput = new ReleaseIdInputBuilder().setPoolName(poolName).setIdKey(idKey).build();
         try {
-            Future<RpcResult<Void>> result = idManager.releaseId(idInput);
-            RpcResult<Void> rpcResult = result.get();
+            ListenableFuture<RpcResult<ReleaseIdOutput>> result = idManager.releaseId(idInput);
+            RpcResult<ReleaseIdOutput> rpcResult = result.get();
             if (!rpcResult.isSuccessful()) {
-                LOG.warn("RPC Call to release Id {} with Key {} returned with Errors {}", idKey, rpcResult.getErrors());
+                LOG.warn("RPC Call to release Id with Key {} returned with Errors {}", idKey, rpcResult.getErrors());
             }
         } catch (InterruptedException | ExecutionException e) {
             LOG.warn("Exception when releasing Id for key {}", idKey, e);
@@ -456,10 +442,6 @@ public class IfmUtil {
         return null;
     }
 
-    public static NodeConnectorId getNodeConnectorIdFromInterface(String interfaceName, DataBroker dataBroker) {
-        return FlowBasedServicesUtils.getNodeConnectorIdFromInterface(interfaceName, dataBroker);
-    }
-
     public static NodeConnectorId getNodeConnectorIdFromInterface(
             org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
                 .ietf.interfaces.rev140508.interfaces.state.Interface ifState) {
@@ -470,14 +452,6 @@ public class IfmUtil {
         return null;
     }
 
-    public static String getPortName(DataBroker dataBroker, NodeConnectorId ncId) {
-        InstanceIdentifier<NodeConnector> ncIdentifier = InstanceIdentifier.builder(Nodes.class)
-                .child(Node.class, new NodeKey(getNodeIdFromNodeConnectorId(ncId)))
-                .child(NodeConnector.class, new NodeConnectorKey(ncId)).build();
-        return read(LogicalDatastoreType.OPERATIONAL, ncIdentifier, dataBroker)
-                .transform(nc -> nc.getAugmentation(FlowCapableNodeConnector.class).getName()).orNull();
-    }
-
     public static InterfaceInfo.InterfaceType getInterfaceType(Interface iface) {
         InterfaceInfo.InterfaceType interfaceType = org.opendaylight
                 .genius.interfacemanager.globals.InterfaceInfo.InterfaceType.UNKNOWN_INTERFACE;
@@ -492,12 +466,13 @@ public class IfmUtil {
             Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight
                     .genius.interfacemanager.rev160406.TunnelTypeBase> tunnelType = ifTunnel
                     .getTunnelInterfaceType();
-            interfaceType = TUNNEL_TYPE_MAP.get(tunnelType);
+            interfaceType = tunnelType.isAssignableFrom(TunnelTypeLogicalGroup.class)
+                    ? InterfaceInfo.InterfaceType.LOGICAL_GROUP_INTERFACE :  TUNNEL_TYPE_MAP.get(tunnelType);
         }
         return interfaceType;
     }
 
-    public static VlanInterfaceInfo getVlanInterfaceInfo(String interfaceName, Interface iface, BigInteger dpId) {
+    public static VlanInterfaceInfo getVlanInterfaceInfo(Interface iface, BigInteger dpId) {
         short vlanId = 0;
         String portName = null;
         IfL2vlan vlanIface = iface.getAugmentation(IfL2vlan.class);
@@ -576,16 +551,26 @@ public class IfmUtil {
         writeTransaction.put(LogicalDatastoreType.CONFIGURATION, boundServicesInstanceIdentifier, serviceInfo, true);
     }
 
-    public static void unbindService(DataBroker dataBroker, String interfaceName,
+    public static void unbindService(DataBroker dataBroker, JobCoordinator coordinator, String interfaceName,
+            InstanceIdentifier<BoundServices> boundServicesInstanceIdentifier) {
+        unbindService(new ManagedNewTransactionRunnerImpl(dataBroker), coordinator, interfaceName,
+                boundServicesInstanceIdentifier);
+    }
+
+    public static void unbindService(ManagedNewTransactionRunner txRunner, JobCoordinator coordinator,
+            String interfaceName, InstanceIdentifier<BoundServices> boundServicesInstanceIdentifier) {
+        coordinator.enqueueJob(interfaceName, () -> Collections.singletonList(
+                txRunner.callWithNewWriteOnlyTransactionAndSubmit(
+                    tx -> unbindService(tx, interfaceName, boundServicesInstanceIdentifier))));
+    }
+
+    public static void unbindService(WriteTransaction tx, String interfaceName,
             InstanceIdentifier<BoundServices> boundServicesInstanceIdentifier) {
         LOG.info("Unbinding Service from : {}", interfaceName);
-        DataStoreJobCoordinator dataStoreJobCoordinator = DataStoreJobCoordinator.getInstance();
-        dataStoreJobCoordinator.enqueueJob(interfaceName, () -> {
-            WriteTransaction writeTransaction = dataBroker.newWriteOnlyTransaction();
-            writeTransaction.delete(LogicalDatastoreType.CONFIGURATION, boundServicesInstanceIdentifier);
-            List<ListenableFuture<Void>> futures = new ArrayList<>();
-            futures.add(writeTransaction.submit());
-            return futures;
-        });
+        tx.delete(LogicalDatastoreType.CONFIGURATION, boundServicesInstanceIdentifier);
+    }
+
+    public static long getLogicalTunnelSelectGroupId(int lportTag) {
+        return org.opendaylight.genius.interfacemanager.globals.IfmConstants.VXLAN_GROUPID_MIN + lportTag;
     }
 }