BUG 392: Resolved translation to JSON behind mount point
[controller.git] / opendaylight / md-sal / sal-rest-connector / src / main / java / org / opendaylight / controller / sal / restconf / impl / ControllerContext.xtend
index 7d32194b1f386ca1a7e228ea25de24dbf6dc15e1..2dfe5062c89af5b2f0151dfee3721d0ba7486521 100644 (file)
@@ -216,13 +216,20 @@ class ControllerContext implements SchemaServiceListener {
         var module = uriToModuleName.get(qname.namespace)
         if (module === null) {
             val moduleSchema = globalSchema.findModuleByNamespaceAndRevision(qname.namespace, qname.revision);
-            if(moduleSchema === null) throw new IllegalArgumentException()
+            if(moduleSchema === null) return null
             uriToModuleName.put(qname.namespace, moduleSchema.name)
             module = moduleSchema.name;
         }
         return '''«module»:«qname.localName»''';
     }
 
+    def CharSequence toRestconfIdentifier(MountInstance mountPoint, QName qname) {
+        val moduleSchema = mountPoint?.schemaContext.findModuleByNamespaceAndRevision(qname.namespace, qname.revision);
+        if(moduleSchema === null) return null
+        val module = moduleSchema.name;
+        return '''«module»:«qname.localName»''';
+    }
+
     private static dispatch def DataSchemaNode childByQName(ChoiceNode container, QName name) {
         for (caze : container.cases) {
             val ret = caze.childByQName(name)