use of org.opendaylight.netconf.impl.osgi.AggregatedNetconfOperationServiceFactory in project netconf by opendaylight.
the class ConcurrentClientsTest method setUp.
@Before
public void setUp() throws Exception {
hashedWheelTimer = new HashedWheelTimer();
nettyGroup = new NioEventLoopGroup(nettyThreads);
netconfClientDispatcher = new NetconfClientDispatcherImpl(nettyGroup, nettyGroup, hashedWheelTimer);
AggregatedNetconfOperationServiceFactory factoriesListener = new AggregatedNetconfOperationServiceFactory();
testingNetconfOperation = new TestingNetconfOperation();
factoriesListener.onAddNetconfOperationServiceFactory(new TestingOperationServiceFactory(testingNetconfOperation));
SessionIdProvider idProvider = new SessionIdProvider();
NetconfServerSessionNegotiatorFactory serverNegotiatorFactory = new NetconfServerSessionNegotiatorFactoryBuilder().setTimer(hashedWheelTimer).setAggregatedOpService(factoriesListener).setIdProvider(idProvider).setConnectionTimeoutMillis(5000).setMonitoringService(createMockedMonitoringService()).setBaseCapabilities(serverCaps).build();
ServerChannelInitializer serverChannelInitializer = new ServerChannelInitializer(serverNegotiatorFactory);
final NetconfServerDispatcherImpl dispatch = new NetconfServerDispatcherImpl(serverChannelInitializer, nettyGroup, nettyGroup);
ChannelFuture server = dispatch.createServer(NETCONF_ADDRESS);
server.await();
}
use of org.opendaylight.netconf.impl.osgi.AggregatedNetconfOperationServiceFactory in project netconf by opendaylight.
the class NetconfDispatcherImplTest method setUp.
@Before
public void setUp() throws Exception {
nettyGroup = new NioEventLoopGroup();
AggregatedNetconfOperationServiceFactory factoriesListener = new AggregatedNetconfOperationServiceFactory();
SessionIdProvider idProvider = new SessionIdProvider();
hashedWheelTimer = new HashedWheelTimer();
NetconfServerSessionNegotiatorFactory serverNegotiatorFactory = new NetconfServerSessionNegotiatorFactoryBuilder().setAggregatedOpService(factoriesListener).setTimer(hashedWheelTimer).setIdProvider(idProvider).setMonitoringService(ConcurrentClientsTest.createMockedMonitoringService()).setConnectionTimeoutMillis(5000).build();
ServerChannelInitializer serverChannelInitializer = new ServerChannelInitializer(serverNegotiatorFactory);
dispatch = new NetconfServerDispatcherImpl(serverChannelInitializer, nettyGroup, nettyGroup);
}
use of org.opendaylight.netconf.impl.osgi.AggregatedNetconfOperationServiceFactory in project netconf by opendaylight.
the class NetconfDeviceSimulator method createDispatcher.
private NetconfServerDispatcherImpl createDispatcher(final Set<Capability> capabilities, final SchemaSourceProvider<YangTextSchemaSource> sourceProvider) {
final Set<Capability> transformedCapabilities = new HashSet<>(Collections2.transform(capabilities, input -> {
if (sendFakeSchema) {
sendFakeSchema = false;
return new FakeCapability((YangModuleCapability) input);
} else {
return input;
}
}));
transformedCapabilities.add(new BasicCapability("urn:ietf:params:netconf:capability:candidate:1.0"));
final NetconfMonitoringService monitoringService1 = new DummyMonitoringService(transformedCapabilities);
final SessionIdProvider idProvider = new SessionIdProvider();
final NetconfOperationServiceFactory aggregatedNetconfOperationServiceFactory = createOperationServiceFactory(sourceProvider, transformedCapabilities, monitoringService1, idProvider);
final Set<String> serverCapabilities = configuration.getCapabilities();
final NetconfServerSessionNegotiatorFactory serverNegotiatorFactory = new TesttoolNegotiationFactory(hashedWheelTimer, aggregatedNetconfOperationServiceFactory, idProvider, configuration.getGenerateConfigsTimeout(), monitoringService1, serverCapabilities);
final ServerChannelInitializer serverChannelInitializer = new ServerChannelInitializer(serverNegotiatorFactory);
return new NetconfServerDispatcherImpl(serverChannelInitializer, nettyThreadgroup, nettyThreadgroup);
}
use of org.opendaylight.netconf.impl.osgi.AggregatedNetconfOperationServiceFactory 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