*/
static NetconfDeviceRpc getRpcForInitialization(final NetconfDeviceCommunicator listener,
final boolean notificationSupport) {
- final BaseSchema baseSchema = notificationSupport
- ? BaseSchema.BASE_NETCONF_CTX_WITH_NOTIFICATIONS
- : BaseSchema.BASE_NETCONF_CTX;
+ final BaseSchema baseSchema = resolveBaseSchema(notificationSupport);
return new NetconfDeviceRpc(baseSchema.getSchemaContext(), listener,
new NetconfMessageTransformer(baseSchema.getSchemaContext(), false, baseSchema));
}
+ private static BaseSchema resolveBaseSchema(final boolean notificationSupport) {
+ return notificationSupport ? BaseSchema.BASE_NETCONF_CTX_WITH_NOTIFICATIONS : BaseSchema.BASE_NETCONF_CTX;
+ }
+
public NetconfDevice(final SchemaResourcesDTO schemaResourcesDTO, final RemoteDeviceId id,
final RemoteDeviceHandler<NetconfSessionPreferences> salFacade,
final ListeningExecutorService globalProcessingExecutor,
final NetconfDeviceRpc initRpc =
getRpcForInitialization(listener, remoteSessionCapabilities.isNotificationsSupported());
final DeviceSourcesResolver task =
- new DeviceSourcesResolver(remoteSessionCapabilities, id, stateSchemasResolver, initRpc);
+ new DeviceSourcesResolver(remoteSessionCapabilities, id, stateSchemasResolver, initRpc,
+ resolveBaseSchema(remoteSessionCapabilities.isNotificationsSupported()).getSchemaContext());
final ListenableFuture<DeviceSources> sourceResolverFuture = processingExecutor.submit(task);
if (shouldListenOnSchemaChange(remoteSessionCapabilities)) {
private final NetconfSessionPreferences remoteSessionCapabilities;
private final RemoteDeviceId id;
private final NetconfDeviceSchemasResolver stateSchemasResolver;
+ private final SchemaContext schemaContext;
DeviceSourcesResolver(final NetconfDeviceRpc deviceRpc,
final NetconfSessionPreferences remoteSessionCapabilities,
- final RemoteDeviceId id, final NetconfDeviceSchemasResolver stateSchemasResolver) {
+ final RemoteDeviceId id, final NetconfDeviceSchemasResolver stateSchemasResolver,
+ final SchemaContext schemaContext) {
this.deviceRpc = deviceRpc;
this.remoteSessionCapabilities = remoteSessionCapabilities;
this.id = id;
this.stateSchemasResolver = stateSchemasResolver;
+ this.schemaContext = schemaContext;
}
DeviceSourcesResolver(final NetconfSessionPreferences remoteSessionCapabilities, final RemoteDeviceId id,
final NetconfDeviceSchemasResolver stateSchemasResolver,
- final NetconfDeviceRpc rpcForMonitoring) {
- this(rpcForMonitoring, remoteSessionCapabilities, id, stateSchemasResolver);
+ final NetconfDeviceRpc rpcForMonitoring, final SchemaContext schemaCtx) {
+ this(rpcForMonitoring, remoteSessionCapabilities, id, stateSchemasResolver, schemaCtx);
}
@Override
public DeviceSources call() {
final NetconfDeviceSchemas availableSchemas =
- stateSchemasResolver.resolve(deviceRpc, remoteSessionCapabilities, id);
+ stateSchemasResolver.resolve(deviceRpc, remoteSessionCapabilities, id, schemaContext);
LOG.debug("{}: Schemas exposed by ietf-netconf-monitoring: {}", id,
availableSchemas.getAvailableYangSchemasQNames());