use of org.opendaylight.netconf.test.tool.monitoring.NetconfMonitoringOperationService in project netconf by opendaylight.
the class NetconfDeviceSimulator method createOperationServiceFactory.
private NetconfOperationServiceFactory createOperationServiceFactory(final SchemaSourceProvider<YangTextSchemaSource> sourceProvider, final Set<Capability> transformedCapabilities, final NetconfMonitoringService monitoringService1, final SessionIdProvider idProvider) {
final AggregatedNetconfOperationServiceFactory aggregatedNetconfOperationServiceFactory = new AggregatedNetconfOperationServiceFactory();
final NetconfOperationServiceFactory operationProvider;
if (configuration.isMdSal()) {
LOG.info("using MdsalOperationProvider.");
operationProvider = new MdsalOperationProvider(idProvider, transformedCapabilities, schemaContext, sourceProvider);
} else if (configuration.isXmlConfigurationProvided()) {
LOG.info("using SimulatedOperationProvider.");
operationProvider = new SimulatedOperationProvider(idProvider, transformedCapabilities, Optional.ofNullable(configuration.getNotificationFile()), Optional.ofNullable(configuration.getInitialConfigXMLFile()));
} else {
LOG.info("using OperationsProvider.");
operationProvider = new OperationsProvider(idProvider, transformedCapabilities, configuration.getOperationsCreator() != null ? configuration.getOperationsCreator() : DefaultOperationsCreator.getDefaultOperationServiceCreator(idProvider.getCurrentSessionId()));
}
final NetconfMonitoringOperationServiceFactory monitoringService = new NetconfMonitoringOperationServiceFactory(new NetconfMonitoringOperationService(monitoringService1));
aggregatedNetconfOperationServiceFactory.onAddNetconfOperationServiceFactory(operationProvider);
aggregatedNetconfOperationServiceFactory.onAddNetconfOperationServiceFactory(monitoringService);
if (configuration.getRpcConfigFile() != null) {
final SettableOperationProvider settableService = new SettableOperationProvider(configuration.getRpcConfigFile());
aggregatedNetconfOperationServiceFactory.onAddNetconfOperationServiceFactory(settableService);
} else {
final SettableOperationRpcProvider settableService = new SettableOperationRpcProvider(configuration.getRpcHandler());
aggregatedNetconfOperationServiceFactory.onAddNetconfOperationServiceFactory(settableService);
}
return aggregatedNetconfOperationServiceFactory;
}
Aggregations