Fix Issues coming up during end to end testing
[transportpce.git] / networkmodel / src / main / java / org / opendaylight / transportpce / networkmodel / NetConfTopologyListener.java
index 5f1882af87c881a5bdd3b8873659ddc25431e8a1..d58b88f36693baf0f00f72d7b5a31fea4e6fbd9f 100644 (file)
@@ -112,31 +112,6 @@ public class NetConfTopologyListener implements DataTreeChangeListener<Node> {
         final ListenerRegistration<OrgOpenroadmTcaListener> accessTcaNotificationListenerRegistration =
                 notificationService.get().registerNotificationListener(tcaListener);
 
-
-
-        String streamName = getSupportedStream(nodeId);
-        if (streamName == null) {
-            streamName = "OPENROADM";
-        }
-        final Optional<RpcConsumerRegistry> service = mountPoint.getService(RpcConsumerRegistry.class).toJavaUtil();
-        if (service.isPresent()) {
-            final NotificationsService rpcService = service.get().getRpcService(NotificationsService.class);
-            if (rpcService == null) {
-                LOG.error("Failed to get RpcService for node {}", nodeId);
-            } else {
-                final CreateSubscriptionInputBuilder createSubscriptionInputBuilder =
-                    new CreateSubscriptionInputBuilder();
-                createSubscriptionInputBuilder.setStream(new StreamNameType(streamName));
-                LOG.info("Triggering notification stream {} for node {}", streamName, nodeId);
-                rpcService.createSubscription(createSubscriptionInputBuilder.build());
-            }
-        } else {
-            LOG.error("Failed to get RpcService for node {}", nodeId);
-        }
-        NodeRegistration nodeRegistration = new NodeRegistration(nodeId, accessAlarmNotificationListenerRegistration,
-                accessDeOperationasNotificationListenerRegistration, accessDeviceNotificationListenerRegistration,
-                accessLldpNotificationListenerRegistration, accessTcaNotificationListenerRegistration);
-        this.registrations.put(nodeId, nodeRegistration);
     }
 
     private void onDeviceDisConnected(final String nodeId) {
@@ -152,6 +127,7 @@ public class NetConfTopologyListener implements DataTreeChangeListener<Node> {
     }
 
     @Override
+    @SuppressWarnings("checkstyle:FallThrough")
     public void onDataTreeChanged(@Nonnull Collection<DataTreeModification<Node>> changes) {
         LOG.info("onDataTreeChanged");
         for (DataTreeModification<Node> change : changes) {
@@ -162,7 +138,7 @@ public class NetConfTopologyListener implements DataTreeChangeListener<Node> {
             }
             if (rootNode.getModificationType() == ModificationType.DELETE) {
                 if (rootNode.getDataBefore() != null) {
-                    String nodeId = rootNode.getDataBefore().getKey().getNodeId().getValue();
+                    String nodeId = rootNode.getDataBefore().key().getNodeId().getValue();
                     LOG.info("Node {} deleted", nodeId);
                     this.networkModelService.deleteOpenROADMnode(nodeId);
                     onDeviceDisConnected(nodeId);
@@ -171,8 +147,8 @@ public class NetConfTopologyListener implements DataTreeChangeListener<Node> {
                 }
                 continue;
             }
-            String nodeId = rootNode.getDataAfter().getKey().getNodeId().getValue();
-            NetconfNode netconfNode = rootNode.getDataAfter().getAugmentation(NetconfNode.class);
+            String nodeId = rootNode.getDataAfter().key().getNodeId().getValue();
+            NetconfNode netconfNode = rootNode.getDataAfter().augmentation(NetconfNode.class);
 
             if ((netconfNode != null) && !StringConstants.DEFAULT_NETCONF_NODEID.equals(nodeId)) {
                 switch (rootNode.getModificationType()) {
@@ -183,8 +159,8 @@ public class NetConfTopologyListener implements DataTreeChangeListener<Node> {
                                 netconfNode.getConnectionStatus();
                         try {
                             long count = netconfNode.getAvailableCapabilities().getAvailableCapability().stream()
-                                    .filter(cp -> cp.getCapability().contains(StringConstants.OPENROADM_DEVICE_MODEL_NAME))
-                                    .count();
+                                .filter(cp -> cp.getCapability().contains(StringConstants.OPENROADM_DEVICE_MODEL_NAME))
+                                .count();
                             if (count > 0) {
                                 LOG.info("OpenROADM node detected: {} {}", nodeId, connectionStatus.name());
                                 switch (connectionStatus) {