2 * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.netconf.sal.connect.netconf;
11 import org.opendaylight.netconf.sal.connect.api.NetconfDeviceSchemas;
12 import org.opendaylight.netconf.sal.connect.api.NetconfDeviceSchemasResolver;
13 import org.opendaylight.netconf.sal.connect.netconf.listener.NetconfSessionPreferences;
14 import org.opendaylight.netconf.sal.connect.netconf.sal.NetconfDeviceRpc;
15 import org.opendaylight.netconf.sal.connect.util.RemoteDeviceId;
16 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.library.rev160409.ModulesState;
17 import org.opendaylight.yangtools.yang.common.QName;
20 * Default implementation resolving schemas QNames from netconf-state or from modules-state.
22 public final class NetconfStateSchemasResolverImpl implements NetconfDeviceSchemasResolver {
25 public NetconfDeviceSchemas resolve(final NetconfDeviceRpc deviceRpc,
26 final NetconfSessionPreferences remoteSessionCapabilities,
27 final RemoteDeviceId id) {
28 if (remoteSessionCapabilities.isMonitoringSupported()) {
29 return NetconfStateSchemas.create(deviceRpc, remoteSessionCapabilities, id);
30 } else if (remoteSessionCapabilities.containsModuleCapability(QName.create(ModulesState.QNAME,
31 "ietf-yang-library"))) {
32 return LibraryModulesSchemas.create(deviceRpc, id);
34 return NetconfStateSchemas.EMPTY;