Revert "Convert anyxml nodes lazily"
[netconf.git] / netconf / sal-netconf-connector / src / main / java / org / opendaylight / netconf / sal / connect / netconf / NetconfStateSchemasResolverImpl.java
index c2947d9860a8a50b981e4787e5479da283155411..089869899ac9209c7445c7b9025fd266d2b14859 100644 (file)
@@ -5,7 +5,6 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.netconf.sal.connect.netconf;
 
 import org.opendaylight.netconf.sal.connect.api.NetconfDeviceSchemas;
@@ -13,13 +12,14 @@ import org.opendaylight.netconf.sal.connect.api.NetconfDeviceSchemasResolver;
 import org.opendaylight.netconf.sal.connect.netconf.listener.NetconfSessionPreferences;
 import org.opendaylight.netconf.sal.connect.netconf.sal.NetconfDeviceRpc;
 import org.opendaylight.netconf.sal.connect.util.RemoteDeviceId;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.library.rev160409.ModulesState;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.library.rev160621.ModulesState;
 import org.opendaylight.yangtools.yang.common.QName;
 
 /**
  * Default implementation resolving schemas QNames from netconf-state or from modules-state.
  */
 public final class NetconfStateSchemasResolverImpl implements NetconfDeviceSchemasResolver {
+    private static final QName YANG_LIBRARY_CAPABILITY = QName.create(ModulesState.QNAME, "ietf-yang-library").intern();
 
     @Override
     public NetconfDeviceSchemas resolve(final NetconfDeviceRpc deviceRpc,
@@ -27,10 +27,10 @@ public final class NetconfStateSchemasResolverImpl implements NetconfDeviceSchem
                                         final RemoteDeviceId id) {
         if (remoteSessionCapabilities.isMonitoringSupported()) {
             return NetconfStateSchemas.create(deviceRpc, remoteSessionCapabilities, id);
-        } else if (remoteSessionCapabilities.containsModuleCapability(QName.create(ModulesState.QNAME,
-                "ietf-yang-library"))) {
-            return LibraryModulesSchemas.create(deviceRpc, id);
         }
-        return NetconfStateSchemas.EMPTY;
+
+        // FIXME: I think we should prefer YANG library here
+        return remoteSessionCapabilities.containsModuleCapability(YANG_LIBRARY_CAPABILITY)
+            ? LibraryModulesSchemas.create(deviceRpc, id) : NetconfStateSchemas.EMPTY;
     }
 }