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 23b039c..e0b774f 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();

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.