Infrautils DiagStatus Integration For ELAN
[netvirt.git] / vpnservice / elanmanager / elanmanager-impl / src / main / java / org / opendaylight / netvirt / elan / utils / CacheElanInterfaceListener.java
index 83de20890a80b79c1511bee14439366a3051d9bc..4208c6575a586632dbfbd12a18d7c4f83ee3602d 100644 (file)
@@ -38,12 +38,8 @@ public class CacheElanInterfaceListener implements ClusteredDataTreeChangeListen
     private void registerListener() {
         final DataTreeIdentifier<ElanInterface> treeId =
                 new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION, getWildcardPath());
-        try {
-            LOG.trace("Registering on path: {}", treeId);
-            registration = broker.registerDataTreeChangeListener(treeId, CacheElanInterfaceListener.this);
-        } catch (final Exception e) {
-            LOG.warn("CacheInterfaceConfigListener registration failed", e);
-        }
+        LOG.trace("Registering on path: {}", treeId);
+        registration = broker.registerDataTreeChangeListener(treeId, CacheElanInterfaceListener.this);
     }
 
     protected InstanceIdentifier<ElanInterface> getWildcardPath() {
@@ -63,11 +59,15 @@ public class CacheElanInterfaceListener implements ClusteredDataTreeChangeListen
             switch (mod.getModificationType()) {
                 case DELETE:
                     ElanUtils.removeElanInterfaceFromCache(mod.getDataBefore().getName());
+                    ElanUtils.removeElanInterfaceToElanInstanceCache(mod.getDataBefore().getElanInstanceName(),
+                            mod.getDataBefore().getName());
                     break;
                 case SUBTREE_MODIFIED:
                 case WRITE:
                     ElanInterface elanInterface = mod.getDataAfter();
                     ElanUtils.addElanInterfaceIntoCache(elanInterface.getName(), elanInterface);
+                    ElanUtils.addElanInterfaceToElanInstanceCache(elanInterface.getElanInstanceName(),
+                            elanInterface.getName());
                     break;
                 default:
                     throw new IllegalArgumentException("Unhandled modification type " + mod.getModificationType());