import java.util.Set;
import java.util.concurrent.ExecutionException;
import org.opendaylight.controller.md.sal.dom.api.DOMRpcResult;
+import org.opendaylight.netconf.sal.connect.api.NetconfDeviceSchemas;
import org.opendaylight.netconf.sal.connect.netconf.listener.NetconfSessionPreferences;
import org.opendaylight.netconf.sal.connect.netconf.sal.NetconfDeviceRpc;
import org.opendaylight.netconf.sal.connect.netconf.schema.mapping.BaseSchema;
/**
* Holds QNames for all yang modules reported by ietf-netconf-monitoring/state/schemas
*/
-public final class NetconfStateSchemas {
+public final class NetconfStateSchemas implements NetconfDeviceSchemas {
private static final Logger LOG = LoggerFactory.getLogger(NetconfStateSchemas.class);
- /**
- * Factory for NetconfStateSchemas
- */
- public interface NetconfStateSchemasResolver {
- NetconfStateSchemas resolve(final NetconfDeviceRpc deviceRpc, final NetconfSessionPreferences remoteSessionCapabilities, final RemoteDeviceId id);
- }
-
- /**
- * Default implementation resolving schemas QNames from netconf-state
- */
- public static final class NetconfStateSchemasResolverImpl implements NetconfStateSchemasResolver {
-
- @Override
- public NetconfStateSchemas resolve(final NetconfDeviceRpc deviceRpc, final NetconfSessionPreferences remoteSessionCapabilities, final RemoteDeviceId id) {
- return NetconfStateSchemas.create(deviceRpc, remoteSessionCapabilities, id);
- }
- }
-
public static final NetconfStateSchemas EMPTY = new NetconfStateSchemas(Collections.<RemoteYangSchema>emptySet());
private static final YangInstanceIdentifier STATE_SCHEMAS_IDENTIFIER =
return availableYangSchemas;
}
+ @Override
public Set<QName> getAvailableYangSchemasQNames() {
return Sets.newHashSet(Collections2.transform(getAvailableYangSchemas(), new Function<RemoteYangSchema, QName>() {
@Override
/**
* Issue get request to remote device and parse response to find all schemas under netconf-state/schemas
*/
- private static NetconfStateSchemas create(final NetconfDeviceRpc deviceRpc, final NetconfSessionPreferences remoteSessionCapabilities, final RemoteDeviceId id) {
+ static NetconfStateSchemas create(final NetconfDeviceRpc deviceRpc, final NetconfSessionPreferences remoteSessionCapabilities, final RemoteDeviceId id) {
if(remoteSessionCapabilities.isMonitoringSupported() == false) {
// TODO - need to search for get-schema support, not just ietf-netconf-monitoring support
// issue might be a deviation to ietf-netconf-monitoring where get-schema is unsupported...
QName childNode = NetconfMessageTransformUtil.IETF_NETCONF_MONITORING_SCHEMA_FORMAT;
- String formatAsString = getSingleChildNodeValue(schemaNode, childNode).get();
+ final String formatAsString = getSingleChildNodeValue(schemaNode, childNode).get();
if(formatAsString.equals(Yang.QNAME.toString()) == false) {
LOG.debug("{}: Ignoring schema due to unsupported format: {}", id, formatAsString);