fix some karaf runtime errors 95/74395/6
authorMartial COULIBALY <martial.coulibaly@gfi.fr>
Tue, 24 Jul 2018 13:08:30 +0000 (15:08 +0200)
committerGuillaume Lambert <guillaume.lambert@orange.com>
Tue, 24 Jul 2018 15:33:41 +0000 (15:33 +0000)
remove the following errors :
- netconf-monitoring already start error
- netconf-impl completion error cause by netconf-console
the netconf CLI is still broken at startup but works again after one
Netconf device has been connected (through the REST API)

JIRA: NETCONF-534
JIRA: TRNSPRTPCE-6
Change-Id: Idec350c7679891098bd8b94448292468a787fa1c
Signed-off-by: Martial COULIBALY <martial.coulibaly@gfi.fr>
features/odl-transportpce/pom.xml
networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/NetConfTopologyListener.java
tests/stubpce/src/main/java/org/opendaylight/transportpce/stubpce/impl/StubpceProvider.java
tests/stubrenderer/src/main/java/org/opendaylight/transportpce/stubrenderer/impl/StubrendererProvider.java

index f5fd17c9acb4c34fb6f90d21d070c25eb41e2197..cbe1e43a7a67b17c6fcd609062c11e85f7e69088 100644 (file)
@@ -56,10 +56,8 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL
     </dependency>
     <dependency>
       <groupId>org.opendaylight.netconf</groupId>
-      <artifactId>odl-netconf-console</artifactId>
+      <artifactId>netconf-console</artifactId>
       <version>${netconf.version}</version>
-      <classifier>features</classifier>
-      <type>xml</type>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.netconf</groupId>
index 15f67bf5c42cae9959e5b8caf0da48ecf41f9054..5f1882af87c881a5bdd3b8873659ddc25431e8a1 100644 (file)
@@ -11,9 +11,7 @@ import java.util.Collection;
 import java.util.Map;
 import java.util.Optional;
 import java.util.concurrent.ConcurrentHashMap;
-
 import javax.annotation.Nonnull;
-
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.DataObjectModification;
 import org.opendaylight.controller.md.sal.binding.api.DataObjectModification.ModificationType;
@@ -183,25 +181,29 @@ public class NetConfTopologyListener implements DataTreeChangeListener<Node> {
                     case SUBTREE_MODIFIED:
                         NetconfNodeConnectionStatus.ConnectionStatus connectionStatus =
                                 netconfNode.getConnectionStatus();
-                        long count = netconfNode.getAvailableCapabilities().getAvailableCapability().stream()
-                                .filter(cp -> cp.getCapability().contains(StringConstants.OPENROADM_DEVICE_MODEL_NAME))
-                                .count();
-                        if (count > 0) {
-                            LOG.info("OpenROADM node detected: {} {}", nodeId, connectionStatus.name());
-                            switch (connectionStatus) {
-                                case Connected:
-                                    this.networkModelService.createOpenROADMnode(nodeId);
-                                    onDeviceConnected(nodeId);
-                                    break;
-                                case Connecting:
-                                case UnableToConnect:
-                                    this.networkModelService.setOpenROADMnodeStatus(nodeId, connectionStatus);
-                                    onDeviceDisConnected(nodeId);
-                                    break;
-                                default:
-                                    LOG.warn("Unsupported device state {}", connectionStatus.getName());
-                                    break;
+                        try {
+                            long count = netconfNode.getAvailableCapabilities().getAvailableCapability().stream()
+                                    .filter(cp -> cp.getCapability().contains(StringConstants.OPENROADM_DEVICE_MODEL_NAME))
+                                    .count();
+                            if (count > 0) {
+                                LOG.info("OpenROADM node detected: {} {}", nodeId, connectionStatus.name());
+                                switch (connectionStatus) {
+                                    case Connected:
+                                        this.networkModelService.createOpenROADMnode(nodeId);
+                                        onDeviceConnected(nodeId);
+                                        break;
+                                    case Connecting:
+                                    case UnableToConnect:
+                                        this.networkModelService.setOpenROADMnodeStatus(nodeId, connectionStatus);
+                                        onDeviceDisConnected(nodeId);
+                                        break;
+                                    default:
+                                        LOG.warn("Unsupported device state {}", connectionStatus.getName());
+                                        break;
+                                }
                             }
+                        } catch (NullPointerException e) {
+                            LOG.error("Cannot get available Capabilities");
                         }
                         break;
                     default:
index 99163c31465a38f3ada1dd63216d13cc8fbd7b27..7377fa925bb69b7cef898ef20f98bc1440b59ac9 100644 (file)
@@ -48,8 +48,8 @@ public class StubpceProvider {
      */
     public void init() {
         LOG.info("StubpceProvider Session Initiated");
-        final StubpceImpl consumer = new StubpceImpl(notificationPublishService,dataBroker);
-        rpcRegistration = rpcRegistry.addRpcImplementation(StubpceService.class, consumer);
+        final StubpceImpl consumer = new StubpceImpl(this.notificationPublishService,this.dataBroker);
+        this.rpcRegistration = this.rpcRegistry.addRpcImplementation(StubpceService.class, consumer);
     }
 
     /**
@@ -57,7 +57,6 @@ public class StubpceProvider {
      */
     public void close() {
         LOG.info("StubpceProvider Closed");
-        rpcRegistration.close();
-        stubPcelistenerRegistration.close();
+        this.rpcRegistration.close();
     }
 }
index 6dcdb8ebc2e87185de46049184eec92aa21d1bef..0beb0873a64129c48767494507898c17fe318d74 100644 (file)
@@ -45,8 +45,8 @@ public class StubrendererProvider {
      */
     public void init() {
         LOG.info("StubrendererProvider Session Initiated");
-        final StubrendererImpl consumer = new StubrendererImpl(notificationPublishService);
-        rpcRegistration = rpcRegistry.addRpcImplementation(StubrendererService.class, consumer);
+        final StubrendererImpl consumer = new StubrendererImpl(this.notificationPublishService);
+        this.rpcRegistration = this.rpcRegistry.addRpcImplementation(StubrendererService.class, consumer);
     }
 
     /**
@@ -54,7 +54,6 @@ public class StubrendererProvider {
      */
     public void close() {
         LOG.info("StubrendererProvider Closed");
-        rpcRegistration.close();
-        stubRendererlistenerRegistration.close();
+        this.rpcRegistration.close();
     }
 }