X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=netconf%2Fnetconf-topology%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fnetconf%2Ftopology%2FAbstractNetconfTopology.java;h=f0c56f3ca79301defcca62328ba63378083dbf84;hb=57f2e5cc5a34fbecd7a492f3180e9a54d9cd8d17;hp=477c3b661f36c544873cafb06c529ccf0cf12151;hpb=433a4e027d11f43358321c9d75d2ffddacb90c05;p=netconf.git diff --git a/netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/AbstractNetconfTopology.java b/netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/AbstractNetconfTopology.java index 477c3b661f..f0c56f3ca7 100644 --- a/netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/AbstractNetconfTopology.java +++ b/netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/AbstractNetconfTopology.java @@ -48,7 +48,7 @@ import org.opendaylight.netconf.sal.connect.api.RemoteDeviceHandler; import org.opendaylight.netconf.sal.connect.netconf.LibraryModulesSchemas; import org.opendaylight.netconf.sal.connect.netconf.NetconfDevice; import org.opendaylight.netconf.sal.connect.netconf.NetconfDeviceBuilder; -import org.opendaylight.netconf.sal.connect.netconf.NetconfStateSchemas; +import org.opendaylight.netconf.sal.connect.netconf.NetconfStateSchemasResolverImpl; import org.opendaylight.netconf.sal.connect.netconf.SchemalessNetconfDevice; import org.opendaylight.netconf.sal.connect.netconf.listener.NetconfDeviceCapabilities; import org.opendaylight.netconf.sal.connect.netconf.listener.NetconfDeviceCommunicator; @@ -61,8 +61,8 @@ import org.opendaylight.netconf.topology.pipeline.TopologyMountPointFacade.Conne import org.opendaylight.protocol.framework.ReconnectStrategy; import org.opendaylight.protocol.framework.ReconnectStrategyFactory; import org.opendaylight.protocol.framework.TimedReconnectStrategy; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Host; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Host; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode; import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.credentials.Credentials; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; @@ -88,6 +88,7 @@ public abstract class AbstractNetconfTopology implements NetconfTopology, Bindin protected static final long DEFAULT_REQUEST_TIMEOUT_MILLIS = 60000L; protected static final int DEFAULT_KEEPALIVE_DELAY = 0; protected static final boolean DEFAULT_RECONNECT_ON_CHANGED_SCHEMA = false; + protected static final int DEFAULT_CONCURRENT_RPC_LIMIT = 0; private static final int DEFAULT_MAX_CONNECTION_ATTEMPTS = 0; private static final int DEFAULT_BETWEEN_ATTEMPTS_TIMEOUT_MILLIS = 2000; private static final long DEFAULT_CONNECTION_TIMEOUT_MILLIS = 20000L; @@ -147,9 +148,9 @@ public abstract class AbstractNetconfTopology implements NetconfTopology, Bindin // directory cache/schema is used. static { schemaResourcesDTOs.put(DEFAULT_CACHE_DIRECTORY, - new NetconfDevice.SchemaResourcesDTO(DEFAULT_SCHEMA_REPOSITORY, + new NetconfDevice.SchemaResourcesDTO(DEFAULT_SCHEMA_REPOSITORY, DEFAULT_SCHEMA_REPOSITORY, DEFAULT_SCHEMA_CONTEXT_FACTORY, - new NetconfStateSchemas.NetconfStateSchemasResolverImpl())); + new NetconfStateSchemasResolverImpl())); DEFAULT_SCHEMA_REPOSITORY.registerSchemaSourceListener(DEFAULT_CACHE); DEFAULT_SCHEMA_REPOSITORY.registerSchemaSourceListener( TextToASTTransformer.create(DEFAULT_SCHEMA_REPOSITORY, DEFAULT_SCHEMA_REPOSITORY)); @@ -165,6 +166,7 @@ public abstract class AbstractNetconfTopology implements NetconfTopology, Bindin protected final SharedSchemaRepository sharedSchemaRepository; protected SchemaSourceRegistry schemaRegistry = DEFAULT_SCHEMA_REPOSITORY; + protected SchemaRepository schemaRepository = DEFAULT_SCHEMA_REPOSITORY; protected SchemaContextFactory schemaContextFactory = DEFAULT_SCHEMA_CONTEXT_FACTORY; protected DOMMountPointService mountPointService = null; @@ -325,13 +327,18 @@ public abstract class AbstractNetconfTopology implements NetconfTopology, Bindin } final Optional userCapabilities = getUserCapabilities(node); + final int rpcMessageLimit = + node.getConcurrentRpcLimit() == null ? DEFAULT_CONCURRENT_RPC_LIMIT : node.getConcurrentRpcLimit(); + + if (rpcMessageLimit < 1) { + LOG.info("Concurrent rpc limit is smaller than 1, no limit will be enforced for device {}", remoteDeviceId); + } return new NetconfConnectorDTO( userCapabilities.isPresent() ? new NetconfDeviceCommunicator( - remoteDeviceId, device, new UserPreferences(userCapabilities.get(), node.getYangModuleCapabilities().isOverride())): - new NetconfDeviceCommunicator(remoteDeviceId, device) - , salFacade); + remoteDeviceId, device, new UserPreferences(userCapabilities.get(), node.getYangModuleCapabilities().isOverride()), rpcMessageLimit): + new NetconfDeviceCommunicator(remoteDeviceId, device, rpcMessageLimit), salFacade); } protected NetconfDevice.SchemaResourcesDTO setupSchemaCacheDTO(final NodeId nodeId, final NetconfNode node) { @@ -365,8 +372,8 @@ public abstract class AbstractNetconfTopology implements NetconfTopology, Bindin } if (schemaResourcesDTO == null) { - schemaResourcesDTO = new NetconfDevice.SchemaResourcesDTO(schemaRegistry, schemaContextFactory, - new NetconfStateSchemas.NetconfStateSchemasResolverImpl()); + schemaResourcesDTO = new NetconfDevice.SchemaResourcesDTO(schemaRegistry, schemaRepository, schemaContextFactory, + new NetconfStateSchemasResolverImpl()); } return schemaResourcesDTO; @@ -387,8 +394,8 @@ public abstract class AbstractNetconfTopology implements NetconfTopology, Bindin final FilesystemSchemaSourceCache deviceCache = createDeviceFilesystemCache(moduleSchemaCacheDirectory); repository.registerSchemaSourceListener(deviceCache); - return new NetconfDevice.SchemaResourcesDTO(repository, schemaContextFactory, - new NetconfStateSchemas.NetconfStateSchemasResolverImpl()); + return new NetconfDevice.SchemaResourcesDTO(repository, repository, schemaContextFactory, + new NetconfStateSchemasResolverImpl()); } /**