Search in sources :

Example 1 with NetconfMonitoringOperationServiceFactory

use of org.opendaylight.netconf.test.tool.monitoring.NetconfMonitoringOperationServiceFactory 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;
}
Also used : NetconfMonitoringOperationService(org.opendaylight.netconf.test.tool.monitoring.NetconfMonitoringOperationService) SettableOperationRpcProvider(org.opendaylight.netconf.test.tool.rpchandler.SettableOperationRpcProvider) AggregatedNetconfOperationServiceFactory(org.opendaylight.netconf.impl.osgi.AggregatedNetconfOperationServiceFactory) OperationsProvider(org.opendaylight.netconf.test.tool.operations.OperationsProvider) NetconfMonitoringOperationServiceFactory(org.opendaylight.netconf.test.tool.monitoring.NetconfMonitoringOperationServiceFactory) SettableOperationProvider(org.opendaylight.netconf.test.tool.customrpc.SettableOperationProvider) AggregatedNetconfOperationServiceFactory(org.opendaylight.netconf.impl.osgi.AggregatedNetconfOperationServiceFactory) NetconfOperationServiceFactory(org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactory)

Aggregations

AggregatedNetconfOperationServiceFactory (org.opendaylight.netconf.impl.osgi.AggregatedNetconfOperationServiceFactory)1 NetconfOperationServiceFactory (org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactory)1 SettableOperationProvider (org.opendaylight.netconf.test.tool.customrpc.SettableOperationProvider)1 NetconfMonitoringOperationService (org.opendaylight.netconf.test.tool.monitoring.NetconfMonitoringOperationService)1 NetconfMonitoringOperationServiceFactory (org.opendaylight.netconf.test.tool.monitoring.NetconfMonitoringOperationServiceFactory)1 OperationsProvider (org.opendaylight.netconf.test.tool.operations.OperationsProvider)1 SettableOperationRpcProvider (org.opendaylight.netconf.test.tool.rpchandler.SettableOperationRpcProvider)1