Added support to register of RPC Implementation. 49/5449/1
authorLukas Sedlak <lsedlak@cisco.com>
Mon, 24 Feb 2014 10:00:40 +0000 (11:00 +0100)
committerLukas Sedlak <lsedlak@cisco.com>
Mon, 24 Feb 2014 10:00:40 +0000 (11:00 +0100)
NetconfDevice has now has capability to support of rpc implementation which adds support for ODL to send rpcs towards netconf server.
Added fix for commit handler registration. Now the commit handler is registered only and only when mount instance is availible.

Change-Id: I11eced0fda40b3c0cd66fd6477c4df45304d3e18
Signed-off-by: Lukas Sedlak <lsedlak@cisco.com>
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfDevice.xtend

index c9fb1fc0b895ffabcd609eed14424e7411856413..4ae84c7d310c4c4d7b54c7dffa403ec2f8fff5ce 100644 (file)
@@ -127,12 +127,8 @@ AutoCloseable {
 
         val listener = new NetconfDeviceListener(this);
         val task = startClientTask(dispatcher, listener)
 
         val listener = new NetconfDeviceListener(this);
         val task = startClientTask(dispatcher, listener)
-        if (mountInstance != null) {
-            commitHandlerReg = mountInstance.registerCommitHandler(ROOT_PATH, this)
-        }
         return processingExecutor.submit(task) as Future<Void>;
 
         return processingExecutor.submit(task) as Future<Void>;
 
-    //commitHandlerReg = mountInstance.registerCommitHandler(path,this);
     }
 
     def Optional<SchemaContext> getSchemaContext() {
     }
 
     def Optional<SchemaContext> getSchemaContext() {
@@ -162,11 +158,16 @@ AutoCloseable {
                 deviceContextProvider.createContextFromCapabilities(initialCapabilities);
                 if (mountInstance != null && schemaContext.isPresent) {
                     mountInstance.schemaContext = schemaContext.get();
                 deviceContextProvider.createContextFromCapabilities(initialCapabilities);
                 if (mountInstance != null && schemaContext.isPresent) {
                     mountInstance.schemaContext = schemaContext.get();
+                    val operations = schemaContext.get().operations;
+                    for (rpc : operations) {
+                        mountInstance.addRpcImplementation(rpc.QName, this);
+                    }
                 }
                 updateDeviceState()
                 if (mountInstance != null && confReaderReg == null && operReaderReg == null) {
                     confReaderReg = mountInstance.registerConfigurationReader(ROOT_PATH, this);
                     operReaderReg = mountInstance.registerOperationalReader(ROOT_PATH, this);
                 }
                 updateDeviceState()
                 if (mountInstance != null && confReaderReg == null && operReaderReg == null) {
                     confReaderReg = mountInstance.registerConfigurationReader(ROOT_PATH, this);
                     operReaderReg = mountInstance.registerOperationalReader(ROOT_PATH, this);
+                    commitHandlerReg = mountInstance.registerCommitHandler(ROOT_PATH, this);
                 }
             } catch (Exception e) {
                 logger.error("Netconf client NOT started. ", e)
                 }
             } catch (Exception e) {
                 logger.error("Netconf client NOT started. ", e)