Bug correction in RendererNotificationImpl 25/74125/7
authorMartial COULIBALY <martial.coulibaly@gfi.fr>
Tue, 17 Jul 2018 14:50:22 +0000 (16:50 +0200)
committerMartial COULIBALY <martial.coulibaly@gfi.fr>
Wed, 18 Jul 2018 08:35:52 +0000 (08:35 +0000)
JIRA : TRNSPRTPCE-18

Change-Id: I9d608b400945ee29cf1dab74af7b1cd926f9de15
Signed-off-by: Martial COULIBALY <martial.coulibaly@gfi.fr>
renderer/src/main/java/org/opendaylight/transportpce/renderer/RendererNotificationsImpl.java

index efcc3d9fc8ec725523ac942a8bb0a2be62839003..6231c88732cd4b41335ee55daa96c0026a24cbd4 100644 (file)
@@ -94,7 +94,7 @@ public class RendererNotificationsImpl implements DataTreeChangeListener<Node> {
 
     private void registerNotificationListener(final NodeId nodeId) {
 
-        MountPoint mountPoint = PortMapping.getDeviceMountPoint(nodeId.getValue(), mountService);
+        MountPoint mountPoint = PortMapping.getDeviceMountPoint(nodeId.getValue(), this.mountService);
 
         // Register notification service
         final Optional<NotificationService> notificationService = mountPoint.getService(
@@ -145,8 +145,8 @@ public class RendererNotificationsImpl implements DataTreeChangeListener<Node> {
     public void close() {
         LOG.info("RenderernotificationsImpl Closed");
         // Clean up the Data Change Listener registration
-        if (dataTreeChangeListenerRegistration != null) {
-            dataTreeChangeListenerRegistration.close();
+        if (this.dataTreeChangeListenerRegistration != null) {
+            this.dataTreeChangeListenerRegistration.close();
         }
     }
 
@@ -167,8 +167,8 @@ public class RendererNotificationsImpl implements DataTreeChangeListener<Node> {
             if (rootNode.getModificationType() == ModificationType.DELETE) {
                 String nodeid = rootNode.getDataBefore().getKey().getNodeId().getValue();
                 LOG.info("Node {} removed...", nodeid);
-                currentMountedDevice.remove(nodeid);
-                new PortMapping(dataBroker, mountService, nodeid).deleteMappingData();
+                this.currentMountedDevice.remove(nodeid);
+                new PortMapping(this.dataBroker, this.mountService, nodeid).deleteMappingData();
             }
 
             if (nnode != null) {
@@ -177,12 +177,9 @@ public class RendererNotificationsImpl implements DataTreeChangeListener<Node> {
                     LOG.info("{} ignored: org-openroadm-device advertised but not a real ROADM device", nodeId);
                     return;
                 }
-                if (rootNode.getModificationType() == ModificationType.WRITE) {
-                    LOG.info("Node added {}", nodeId);
-
-                } else if (rootNode.getModificationType() == ModificationType.SUBTREE_MODIFIED) {
-
-                    LOG.info("Node modified {}", nodeId);
+                if ((rootNode.getModificationType() == ModificationType.WRITE) ||
+                        (rootNode.getModificationType() == ModificationType.SUBTREE_MODIFIED)) {
+                    LOG.info("Node added or modified {}", nodeId);
                     ConnectionStatus csts = nnode.getConnectionStatus();
 
                     switch (csts) {
@@ -196,12 +193,12 @@ public class RendererNotificationsImpl implements DataTreeChangeListener<Node> {
                              * for notifications
                              */
                             registerNotificationListener(rootNode.getDataAfter().getNodeId());
-                            currentMountedDevice.add(nodeId);
-                            new PortMapping(dataBroker, mountService, nodeId).createMappingData();
+                            this.currentMountedDevice.add(nodeId);
+                            new PortMapping(this.dataBroker, this.mountService, nodeId).createMappingData();
                             break;
                         }
                         case Connecting: {
-                            LOG.info("NETCONF Node: {} was disconnected", nodeId);
+                            LOG.info("NETCONF Node: {} is (dis)connecting", nodeId);
                             break;
                         }
                         case UnableToConnect: {
@@ -214,6 +211,6 @@ public class RendererNotificationsImpl implements DataTreeChangeListener<Node> {
                 }
             }
         }
-        LOG.info("Netconf devices currently mounted are : {}", currentMountedDevice.toString());
+        LOG.info("Netconf devices currently mounted are : {}", this.currentMountedDevice.toString());
     }
 }