BUG-732 Fix netconf-connector unable to detect monitoring capability 34/6234/2
authorMaros Marsalek <mmarsale@cisco.com>
Wed, 16 Apr 2014 12:36:20 +0000 (14:36 +0200)
committerMaros Marsalek <mmarsale@cisco.com>
Thu, 17 Apr 2014 10:15:54 +0000 (12:15 +0200)
Change-Id: I6d84db9994a85116d6159d960908c0816f31461b
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfDevice.xtend
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfDeviceListener.java

index 12e8b55..0b88c66 100644 (file)
@@ -167,8 +167,10 @@ AutoCloseable {
             commitHandlerReg = mountInstance.registerCommitHandler(ROOT_PATH, this);
 
             val rpcs = new ArrayList<RpcRegistration>();
-            for (rpc : mountInstance.schemaContext.operations) {
-                rpcs.add(mountInstance.addRpcImplementation(rpc.QName, this));
+            if (mountInstance != null && schemaContext.isPresent) {
+                for (rpc : mountInstance.schemaContext.operations) {
+                    rpcs.add(mountInstance.addRpcImplementation(rpc.QName, this));
+                }
             }
             rpcReg = rpcs
         }
index d5e1d35..8c65aa3 100644 (file)
@@ -63,6 +63,7 @@ class NetconfDeviceListener implements NetconfClientSessionListener {
         LOG.debug("Session with {} established as address {} session-id {}",
                 device.getName(), device.getSocketAddress(), session.getSessionId());
 
+        this.session = session;
         final Set<QName> caps = device.getCapabilities(session.getServerCapabilities());
         LOG.trace("Server {} advertized capabilities {}", device.getName(), caps);
 
@@ -70,7 +71,8 @@ class NetconfDeviceListener implements NetconfClientSessionListener {
         final SchemaSourceProvider<String> delegate;
         if (NetconfRemoteSchemaSourceProvider.isSupportedFor(caps)) {
             delegate = new NetconfRemoteSchemaSourceProvider(device);
-        } else if(caps.contains(NetconfRemoteSchemaSourceProvider.IETF_NETCONF_MONITORING.getNamespace().toString())) {
+            // FIXME parsed caps contain only module-based capabilities
+        } else if(session.getServerCapabilities().contains(NetconfRemoteSchemaSourceProvider.IETF_NETCONF_MONITORING.getNamespace().toString())) {
             delegate = new NetconfRemoteSchemaSourceProvider(device);
         } else {
             LOG.info("Netconf server {} does not support IETF Netconf Monitoring", device.getName());
@@ -79,7 +81,6 @@ class NetconfDeviceListener implements NetconfClientSessionListener {
 
         device.bringUp(delegate, caps);
 
-        this.session = session;
     }
 
     private synchronized void tearDown(final Exception e) {