- NetconfServerSessionListenerFactory listenerFactory = new NetconfServerSessionListenerFactory(
- factoriesListener, commitNot, idProvider);
-
- if (maybeTCPAddress.isPresent()) {
- Optional<SSLContext> maybeSSLContext = Optional.absent();
- InetSocketAddress address = maybeTCPAddress.get();
- dispatch = new NetconfServerDispatcher(maybeSSLContext, serverNegotiatorFactory, listenerFactory);
-
- logger.info("Starting TCP netconf server at {}", address);
- dispatch.createServer(address);
- }
- if (maybeTLSConfiguration.isPresent()) {
- Optional<SSLContext> maybeSSLContext = Optional.of(maybeTLSConfiguration.get().getSslContext());
- InetSocketAddress address = maybeTLSConfiguration.get().getAddress();
- dispatch = new NetconfServerDispatcher(maybeSSLContext, serverNegotiatorFactory, listenerFactory);
-
- logger.info("Starting TLS netconf server at {}", address);
- dispatch.createServer(address);
- }
+ SessionMonitoringService monitoringService = startMonitoringService(context, factoriesListener);
+
+ NetconfServerSessionNegotiatorFactory serverNegotiatorFactory = new NetconfServerSessionNegotiatorFactory(
+ timer, factoriesListener, idProvider, connectionTimeoutMillis, commitNot, monitoringService);
+
+ eventLoopGroup = new NioEventLoopGroup();
+
+ NetconfServerDispatcher.ServerChannelInitializer serverChannelInitializer = new NetconfServerDispatcher.ServerChannelInitializer(
+ serverNegotiatorFactory);
+ NetconfServerDispatcher dispatch = new NetconfServerDispatcher(serverChannelInitializer, eventLoopGroup, eventLoopGroup);
+
+ LocalAddress address = NetconfConfigUtil.getNetconfLocalAddress();
+ LOG.trace("Starting local netconf server at {}", address);
+ dispatch.createLocalServer(address);
+
+ context.registerService(NetconfOperationProvider.class, factoriesListener, null);
+
+ }
+
+ private void startOperationServiceFactoryTracker(BundleContext context, NetconfOperationServiceFactoryListenerImpl factoriesListener) {
+ factoriesTracker = new NetconfOperationServiceFactoryTracker(context, factoriesListener);
+ factoriesTracker.open();
+ }
+
+ private NetconfMonitoringServiceImpl startMonitoringService(BundleContext context, NetconfOperationServiceFactoryListenerImpl factoriesListener) {
+ NetconfMonitoringServiceImpl netconfMonitoringServiceImpl = new NetconfMonitoringServiceImpl(factoriesListener);
+ Dictionary<String, ?> dic = new Hashtable<>();
+ regMonitoring = context.registerService(NetconfMonitoringService.class, netconfMonitoringServiceImpl, dic);
+
+ return netconfMonitoringServiceImpl;