Hotfix for resolving of remote yang schemas. 80/10380/1
authorLukas Sedlak <lsedlak@cisco.com>
Wed, 27 Aug 2014 14:31:52 +0000 (16:31 +0200)
committerLukas Sedlak <lsedlak@cisco.com>
Wed, 27 Aug 2014 14:31:52 +0000 (16:31 +0200)
Added hotfix for proper resolving of yang schemas when they are stated as identities and prefixed.

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

index 23b039c2542540fe39d7af70b8ea0b0129e11aa3..e0b774f53c9008e3d8bd25772128e770b247419a 100644 (file)
@@ -156,7 +156,13 @@ public final class NetconfStateSchemas {
 
             QName childNode = NetconfMessageTransformUtil.IETF_NETCONF_MONITORING_SCHEMA_FORMAT.withoutRevision();
 
-            final String formatAsString = getSingleChildNodeValue(schemaNode, childNode).get();
+            String formatAsString = getSingleChildNodeValue(schemaNode, childNode).get();
+            //This is HotFix for situations where format statement in netconf-monitoring might be passed with prefix.
+            if (formatAsString.contains(":")) {
+                String[] prefixedString = formatAsString.split(":");
+                //FIXME: might be good idea to check prefix against model namespace
+                formatAsString = prefixedString[1];
+            }
             if(formatAsString.equals(Yang.QNAME.getLocalName()) == false) {
                 logger.debug("{}: Ignoring schema due to unsupported format: {}", id, formatAsString);
                 return Optional.absent();