use of org.opendaylight.netconf.api.monitoring.NetconfMonitoringService 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.api.monitoring.NetconfMonitoringService in project netconf by opendaylight.
the class ConcurrentClientsTest method createMockedMonitoringService.
public static NetconfMonitoringService createMockedMonitoringService() {
NetconfMonitoringService monitoring = mock(NetconfMonitoringService.class);
final SessionListener sessionListener = mock(SessionListener.class);
doNothing().when(sessionListener).onSessionUp(any(NetconfServerSession.class));
doNothing().when(sessionListener).onSessionDown(any(NetconfServerSession.class));
doNothing().when(sessionListener).onSessionEvent(any(SessionEvent.class));
doReturn((AutoCloseable) () -> {
}).when(monitoring).registerCapabilitiesListener(any(NetconfMonitoringService.CapabilitiesListener.class));
doReturn(sessionListener).when(monitoring).getSessionListener();
doReturn(new CapabilitiesBuilder().setCapability(Collections.emptyList()).build()).when(monitoring).getCapabilities();
return monitoring;
}
Aggregations