Fixes in interface manager and aliveness monitor
[vpnservice.git] / interfacemgr / interfacemgr-impl / src / main / java / org / opendaylight / vpnservice / interfacemgr / commons / InterfaceMetaUtils.java
index b768b406eadfb2df1fc865400653221c5ca81850..82ff6cfbbae536604113d25236a25e921e0475e6 100644 (file)
@@ -99,6 +99,7 @@ public class InterfaceMetaUtils {
         BridgeEntryKey bridgeEntryKey = new BridgeEntryKey(dpnId);
         InstanceIdentifier<BridgeEntry> bridgeEntryInstanceIdentifier =
                 InterfaceMetaUtils.getBridgeEntryIdentifier(bridgeEntryKey);
+        LOG.debug("Trying to retrieve bridge entry from config for Id: {}", bridgeEntryInstanceIdentifier);
         return getBridgeEntryFromConfigDS(bridgeEntryInstanceIdentifier,
                         dataBroker);
     }
@@ -121,17 +122,6 @@ public class InterfaceMetaUtils {
 
     }
 
-    public static BridgeInterfaceEntry getBridgeInterfaceEntryFromConfigDS(
-            InstanceIdentifier<BridgeInterfaceEntry> bridgeInterfaceEntryInstanceIdentifier, DataBroker dataBroker) {
-        Optional<BridgeInterfaceEntry> bridgeInterfaceEntryOptional =
-                IfmUtil.read(LogicalDatastoreType.CONFIGURATION, bridgeInterfaceEntryInstanceIdentifier, dataBroker);
-        if (!bridgeInterfaceEntryOptional.isPresent()) {
-            return null;
-        }
-        return bridgeInterfaceEntryOptional.get();
-    }
-
-
     public static void createBridgeInterfaceEntryInConfigDS(BridgeEntryKey bridgeEntryKey,
                                                              BridgeInterfaceEntryKey bridgeInterfaceEntryKey,
                                                              String childInterface,
@@ -160,6 +150,14 @@ public class InterfaceMetaUtils {
         return intfIdBuilder.build();
     }
 
+    public static InterfaceParentEntry getInterfaceParentEntryFromConfigDS(
+            String interfaceName, DataBroker dataBroker) {
+        InterfaceParentEntryKey interfaceParentEntryKey = new InterfaceParentEntryKey(interfaceName);
+        InterfaceParentEntry interfaceParentEntry =
+                InterfaceMetaUtils.getInterfaceParentEntryFromConfigDS(interfaceParentEntryKey, dataBroker);
+        return interfaceParentEntry;
+    }
+
     public static InterfaceParentEntry getInterfaceParentEntryFromConfigDS(
             InterfaceParentEntryKey interfaceParentEntryKey, DataBroker dataBroker) {
         InstanceIdentifier<InterfaceParentEntry> intfParentIid =
@@ -204,16 +202,6 @@ public class InterfaceMetaUtils {
         t.put(LogicalDatastoreType.OPERATIONAL, id, ifIndexInterface, true);
     }
 
-    public static void removeLportTagInterfaceMap(WriteTransaction t, IdManagerService idManager, DataBroker broker, String infName, Integer ifIndex) {
-        InstanceIdentifier<IfIndexInterface> id = InstanceIdentifier.builder(IfIndexesInterfaceMap.class).child(IfIndexInterface.class, new IfIndexInterfaceKey(ifIndex)).build();
-        Optional<IfIndexInterface> ifIndexesInterface = IfmUtil.read(LogicalDatastoreType.OPERATIONAL, id, broker);
-        if(ifIndexesInterface.isPresent()) {
-           LOG.debug("removing lport tag to interface map for {}",infName);
-           t.delete(LogicalDatastoreType.OPERATIONAL, id);
-        }
-        IfmUtil.releaseId(idManager, IfmConstants.IFM_IDPOOL_NAME, infName);
-    }
-
     public static void createBridgeRefEntry(BigInteger dpnId, InstanceIdentifier<?> bridgeIid,
                                             WriteTransaction tx){
         LOG.debug("Creating bridge ref entry for dpn: {} bridge: {}",