From 83efb0ff929801a5a2ab89f6b66c07ed940a309d Mon Sep 17 00:00:00 2001 From: Maros Marsalek Date: Thu, 11 Aug 2016 13:04:56 +0200 Subject: HONEYCOMB-19 Minimal distro ans wiring for hc infra Change-Id: I8f0e577ac91106e6025f7f2f27811f850e1c5253 Signed-off-by: Maros Marsalek --- .../HoneycombNotification2NetconfProvider.groovy | 94 +++++++++++++++ .../netconf/NetconfBindingBrokerProvider.groovy | 41 +++++++ .../netconf/NetconfMdsalMapperProvider.groovy | 55 +++++++++ .../infra/distro/netconf/NetconfModule.groovy | 130 +++++++++++++++++++++ .../netconf/NetconfMonitoringMapperProvider.groovy | 55 +++++++++ .../NetconfMonitoringReaderFactoryProvider.groovy | 37 ++++++ .../NetconfMonitoringServiceProvider.groovy | 42 +++++++ .../NetconfNotificationMapperProvider.groovy | 72 ++++++++++++ ...etconfNotificationsReaderFactoryProvider.groovy | 53 +++++++++ .../distro/netconf/NetconfReadersModule.groovy | 36 ++++++ .../netconf/NetconfServerDispatcherProvider.groovy | 68 +++++++++++ .../distro/netconf/NetconfSshServerProvider.groovy | 98 ++++++++++++++++ .../distro/netconf/NetconfTcpServerProvider.groovy | 65 +++++++++++ .../distro/netconf/NettyThreadGroupProvider.groovy | 42 +++++++ .../infra/distro/netconf/NettyTimerProvider.groovy | 41 +++++++ 15 files changed, 929 insertions(+) create mode 100644 infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/HoneycombNotification2NetconfProvider.groovy create mode 100644 infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfBindingBrokerProvider.groovy create mode 100644 infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfMdsalMapperProvider.groovy create mode 100644 infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfModule.groovy create mode 100644 infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfMonitoringMapperProvider.groovy create mode 100644 infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfMonitoringReaderFactoryProvider.groovy create mode 100644 infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfMonitoringServiceProvider.groovy create mode 100644 infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfNotificationMapperProvider.groovy create mode 100644 infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfNotificationsReaderFactoryProvider.groovy create mode 100644 infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfReadersModule.groovy create mode 100644 infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfServerDispatcherProvider.groovy create mode 100644 infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfSshServerProvider.groovy create mode 100644 infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfTcpServerProvider.groovy create mode 100644 infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NettyThreadGroupProvider.groovy create mode 100644 infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NettyTimerProvider.groovy (limited to 'infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf') diff --git a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/HoneycombNotification2NetconfProvider.groovy b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/HoneycombNotification2NetconfProvider.groovy new file mode 100644 index 000000000..a18d2c4f0 --- /dev/null +++ b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/HoneycombNotification2NetconfProvider.groovy @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2016 Cisco and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.fd.honeycomb.infra.distro.netconf + +import com.google.inject.Inject +import com.google.inject.name.Named +import groovy.transform.ToString +import groovy.util.logging.Slf4j +import io.fd.honeycomb.infra.distro.cfgattrs.HoneycombConfiguration +import io.fd.honeycomb.infra.distro.ProviderTrait +import io.fd.honeycomb.notification.NotificationCollector +import io.fd.honeycomb.notification.impl.NotificationProducerRegistry +import org.opendaylight.controller.md.sal.dom.broker.impl.DOMNotificationRouter +import org.opendaylight.controller.sal.core.api.model.SchemaService +import org.opendaylight.netconf.notifications.NetconfNotificationCollector +import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.notification.impl.rev160601.HoneycombNotificationToNetconfTranslatorModule as Mirror +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.StreamNameType +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netmod.notification.rev080714.netconf.streams.StreamBuilder +import org.opendaylight.yangtools.yang.model.api.SchemaPath +/** + * Mirror of org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.notification.impl.rev160601.HoneycombNotificationToNetconfTranslatorModule + */ +@Slf4j +@ToString +class HoneycombNotification2NetconfProvider extends ProviderTrait { + + @Inject + @Named("honeycomb") + DOMNotificationRouter notificationRouter + @Inject + SchemaService schemaService + @Inject + HoneycombConfiguration cfgAttributes + @Inject + NotificationCollector hcNotificationCollector + @Inject + NetconfNotificationCollector netconfNotificationCollector + + // TODO refactor HoneycombNotificationToNetconfTranslatorModule for easier reuse here + + @Override + def create() { + def streamType = new StreamNameType(cfgAttributes.netconfNotificationStreamName); + + // Register as NETCONF notification publisher under configured name + def netconfNotifReg = netconfNotificationCollector.registerNotificationPublisher(new StreamBuilder() + .setName(streamType) + .setReplaySupport(false) + .setDescription(cfgAttributes.netconfNotificationStreamName).build()); + + // Notification Translator, get notification from HC producers and put into NETCONF notification collector + def domNotificationListener = { notif -> + log.debug "Propagating notification: {} into NETCONF", notif.type + netconfNotifReg.onNotification(streamType, Mirror.notificationToXml(notif, schemaService.globalContext)) + } + + // NotificationManager is used to provide list of available notifications (which are all of the notifications registered) + // TODO make available notifications configurable here so that any number of notification streams for NETCONF + // can be configured on top of a single notification manager + log.debug "Current notifications to be exposed over NETCONF: {}", hcNotificationCollector.notificationTypes + def currentNotificationSchemaPaths = hcNotificationCollector.notificationTypes + .collect {SchemaPath.create(true, NotificationProducerRegistry.getQName(it))} + + // Register as listener to HC'OPERATIONAL DOM notification service + // TODO This should only be triggered when NETCONF notifications are activated + // Because this way we actually start all notification producers + // final Collection notificationQNames = + def domNotifListenerReg = notificationRouter + .registerNotificationListener(domNotificationListener, currentNotificationSchemaPaths); + + log.info "Exposing NETCONF notification stream: {}", streamType.value + + new HoneycombNotification2Netconf(domNotifListenerReg: domNotifListenerReg, netconfNotifReg: netconfNotifReg) + } + + static class HoneycombNotification2Netconf { + def domNotifListenerReg + def netconfNotifReg + } +} diff --git a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfBindingBrokerProvider.groovy b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfBindingBrokerProvider.groovy new file mode 100644 index 000000000..8226c8d9e --- /dev/null +++ b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfBindingBrokerProvider.groovy @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2016 Cisco and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.fd.honeycomb.infra.distro.netconf + +import com.google.inject.Inject +import com.google.inject.name.Named +import groovy.transform.ToString +import groovy.util.logging.Slf4j +import io.fd.honeycomb.infra.distro.ProviderTrait +import org.opendaylight.controller.md.sal.binding.api.DataBroker +import org.opendaylight.controller.sal.binding.api.BindingAwareBroker +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.honeycomb.impl.rev141210.NetconfBindingBrokerModule + +/** + * Mirror of {@link org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.honeycomb.impl.rev141210.NetconfBindingBrokerModule} + */ +@Slf4j +@ToString +class NetconfBindingBrokerProvider extends ProviderTrait { + + @Inject + @Named(NetconfModule.NETCONF) + DataBroker dataBroker + + @Override + def create() { new NetconfBindingBrokerModule.FakeBindingAwareBroker(dataBroker) } +} diff --git a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfMdsalMapperProvider.groovy b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfMdsalMapperProvider.groovy new file mode 100644 index 000000000..d84af61a8 --- /dev/null +++ b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfMdsalMapperProvider.groovy @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2016 Cisco and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.fd.honeycomb.infra.distro.netconf + +import com.google.inject.Inject +import com.google.inject.name.Named +import groovy.transform.ToString +import groovy.util.logging.Slf4j +import io.fd.honeycomb.infra.distro.ProviderTrait +import org.opendaylight.controller.sal.core.api.Broker +import org.opendaylight.controller.sal.core.api.model.SchemaService +import org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactory +import org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactoryListener +import org.opendaylight.netconf.mdsal.connector.MdsalNetconfOperationServiceFactory +import org.opendaylight.yangtools.sal.binding.generator.impl.ModuleInfoBackedContext +/** + * Mirror of org.opendaylight.controller.config.yang.netconf.mdsal.mapper.NetconfMdsalMapperModule + */ +@Slf4j +@ToString +class NetconfMdsalMapperProvider extends ProviderTrait { + + @Inject + SchemaService schemaService + @Inject + NetconfOperationServiceFactoryListener aggregator + @Inject + ModuleInfoBackedContext moduleInfoBackedContext + + @Inject + @Named("honeycomb") + Broker domBroker + + def create() { + def mdsalNetconfOperationServiceFactory = + new MdsalNetconfOperationServiceFactory(schemaService, moduleInfoBackedContext) + domBroker.registerConsumer(mdsalNetconfOperationServiceFactory); + aggregator.onAddNetconfOperationServiceFactory(mdsalNetconfOperationServiceFactory); + return mdsalNetconfOperationServiceFactory; + } +} diff --git a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfModule.groovy b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfModule.groovy new file mode 100644 index 000000000..effa50cfd --- /dev/null +++ b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfModule.groovy @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2016 Cisco and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.fd.honeycomb.infra.distro.netconf + +import com.google.inject.PrivateModule +import com.google.inject.Singleton +import com.google.inject.name.Names +import io.fd.honeycomb.infra.distro.data.BindingDataBrokerProvider +import io.fd.honeycomb.infra.distro.data.DataStoreProvider +import io.fd.honeycomb.infra.distro.data.HoneycombNotificationManagerProvider +import io.fd.honeycomb.infra.distro.data.InmemoryDOMDataBrokerProvider +import io.fd.honeycomb.notification.NotificationCollector +import io.netty.channel.nio.NioEventLoopGroup +import io.netty.util.Timer +import org.opendaylight.controller.md.sal.binding.api.DataBroker +import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType +import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker +import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore +import org.opendaylight.controller.sal.binding.api.BindingAwareBroker +import org.opendaylight.netconf.api.NetconfServerDispatcher +import org.opendaylight.netconf.api.monitoring.NetconfMonitoringService +import org.opendaylight.netconf.impl.osgi.AggregatedNetconfOperationServiceFactory +import org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactory +import org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactoryListener +import org.opendaylight.netconf.notifications.NetconfNotificationCollector +import org.opendaylight.netconf.notifications.NetconfNotificationListener +import org.opendaylight.netconf.notifications.NetconfNotificationRegistry +import org.opendaylight.netconf.notifications.impl.NetconfNotificationManager + +import static InmemoryDOMDataBrokerProvider.CONFIG +import static InmemoryDOMDataBrokerProvider.OPERATIONAL + +class NetconfModule extends PrivateModule { + + public static final String NETCONF = "netconf" + public static final String NETCONF_MAPPER_AGGREGATOR = "netconf-mapper-aggregator" + public static final String NETCONF_MAPPER_NOTIFICATION = "netconf-mapper-notification" + public static final String NETCONF_MAPPER_MONITORING = "netconf-mapper-monitoring" + public static final String NETCONF_MAPPER_HONEYCOMB = "netconf-mapper-honeycomb" + + @Override + protected void configure() { + bind(InMemoryDOMDataStore) + .annotatedWith(Names.named(CONFIG)) + .toProvider(new DataStoreProvider(type: LogicalDatastoreType.CONFIGURATION, name: CONFIG)) + .in(Singleton) + bind(InMemoryDOMDataStore) + .annotatedWith(Names.named(OPERATIONAL)) + .toProvider(new DataStoreProvider(type: LogicalDatastoreType.OPERATIONAL, name: OPERATIONAL)) + .in(Singleton) + bind(DOMDataBroker).toProvider(InmemoryDOMDataBrokerProvider).in(Singleton) + + bind(DataBroker) + .annotatedWith(Names.named(NETCONF)) + .toProvider(BindingDataBrokerProvider) + .in(Singleton) + expose(DataBroker).annotatedWith(Names.named(NETCONF)) + bind(BindingAwareBroker) + .annotatedWith(Names.named(NETCONF)) + .toProvider(NetconfBindingBrokerProvider) + .in(Singleton) + + // Mirror of org.opendaylight.controller.config.yang.config.netconf.northbound.impl.NetconfMapperAggregatorModule + def factory = new AggregatedNetconfOperationServiceFactory() + bind(NetconfOperationServiceFactory) + .annotatedWith(Names.named(NETCONF_MAPPER_AGGREGATOR)) + .toInstance(factory) + bind(NetconfOperationServiceFactoryListener).toInstance(factory) + + // Mirror of org.opendaylight.controller.config.yang.netconf.northbound.notification.impl.NetconfNotificationManagerModule + def manager = new NetconfNotificationManager() + bind(NetconfNotificationCollector).toInstance(manager) + bind(NetconfNotificationRegistry).toInstance(manager) + bind(NetconfNotificationListener).toInstance(manager) + + // Netconf notification part + bind(NetconfOperationServiceFactory) + .annotatedWith(Names.named(NETCONF_MAPPER_NOTIFICATION)) + .toProvider(NetconfNotificationMapperProvider) + .in(Singleton) + expose(NetconfOperationServiceFactory).annotatedWith(Names.named(NETCONF_MAPPER_NOTIFICATION)) + + // Netconf core part - mapping between Honeycomb and Netconf + bind(NetconfOperationServiceFactory) + .annotatedWith(Names.named(NETCONF_MAPPER_HONEYCOMB)) + .toProvider(NetconfMdsalMapperProvider) + .in(Singleton) + expose(NetconfOperationServiceFactory).annotatedWith(Names.named(NETCONF_MAPPER_HONEYCOMB)) + + // Netconf monitoring part + bind(NetconfMonitoringService).toProvider(NetconfMonitoringServiceProvider).in(Singleton) + bind(NetconfOperationServiceFactory) + .annotatedWith(Names.named(NETCONF_MAPPER_MONITORING)) + .toProvider(NetconfMonitoringMapperProvider) + .in(Singleton) + expose(NetconfOperationServiceFactory).annotatedWith(Names.named(NETCONF_MAPPER_MONITORING)) + + bind(NotificationCollector).toProvider(HoneycombNotificationManagerProvider).in(Singleton) + bind(HoneycombNotification2NetconfProvider.HoneycombNotification2Netconf) + .toProvider(HoneycombNotification2NetconfProvider) + .in(Singleton) + expose(HoneycombNotification2NetconfProvider.HoneycombNotification2Netconf) + + configureServer() + } + + def configureServer() { + bind(NioEventLoopGroup).toProvider(NettyThreadGroupProvider).in(Singleton) + bind(Timer).toProvider(NettyTimerProvider).in(Singleton) + bind(NetconfServerDispatcher).toProvider(NetconfServerDispatcherProvider).in(Singleton) + bind(NetconfTcpServerProvider.NetconfTcpServer).toProvider(NetconfTcpServerProvider).in(Singleton) + expose(NetconfTcpServerProvider.NetconfTcpServer) + bind(NetconfSshServerProvider.NetconfSshServer).toProvider(NetconfSshServerProvider).in(Singleton) + expose(NetconfSshServerProvider.NetconfSshServer) + } +} diff --git a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfMonitoringMapperProvider.groovy b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfMonitoringMapperProvider.groovy new file mode 100644 index 000000000..8f53c9d83 --- /dev/null +++ b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfMonitoringMapperProvider.groovy @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2016 Cisco and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.fd.honeycomb.infra.distro.netconf + +import com.google.inject.Inject +import com.google.inject.name.Named +import groovy.transform.ToString +import groovy.util.logging.Slf4j +import io.fd.honeycomb.infra.distro.ProviderTrait +import org.opendaylight.controller.config.yang.netconf.mdsal.monitoring.MonitoringToMdsalWriter +import org.opendaylight.controller.config.yang.netconf.mdsal.monitoring.NetconfMdsalMonitoringMapperModule +import org.opendaylight.controller.sal.binding.api.BindingAwareBroker +import org.opendaylight.netconf.api.monitoring.NetconfMonitoringService +import org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactory +import org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactoryListener +/** + * Mirror of org.opendaylight.controller.config.yang.netconf.mdsal.monitoring.NetconfMdsalMonitoringMapperModule + */ +@Slf4j +@ToString +class NetconfMonitoringMapperProvider extends ProviderTrait { + + @Inject + @Named(NetconfModule.NETCONF) + BindingAwareBroker bindingAwareBroker + @Inject + NetconfOperationServiceFactoryListener aggregator + @Inject + NetconfMonitoringService monitoringService + + def create() { + def monitoringToMdsalWriter = new MonitoringToMdsalWriter(monitoringService) + bindingAwareBroker.registerProvider(monitoringToMdsalWriter) + + def mdSalMonitoringMapperFactory = new NetconfMdsalMonitoringMapperModule.MdSalMonitoringMapperFactory( + new NetconfMdsalMonitoringMapperModule.MdsalMonitoringMapper(monitoringService)) + + aggregator.onAddNetconfOperationServiceFactory(mdSalMonitoringMapperFactory) + return mdSalMonitoringMapperFactory + } +} diff --git a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfMonitoringReaderFactoryProvider.groovy b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfMonitoringReaderFactoryProvider.groovy new file mode 100644 index 000000000..2945ae6d8 --- /dev/null +++ b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfMonitoringReaderFactoryProvider.groovy @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2016 Cisco and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.fd.honeycomb.infra.distro.netconf + +import com.google.inject.Inject +import com.google.inject.name.Named +import groovy.transform.ToString +import groovy.util.logging.Slf4j +import io.fd.honeycomb.infra.distro.ProviderTrait +import io.fd.honeycomb.translate.read.ReaderFactory +import org.opendaylight.controller.md.sal.binding.api.DataBroker +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.honeycomb.impl.rev141210.NetconfMonitoringReaderModule + +@Slf4j +@ToString +class NetconfMonitoringReaderFactoryProvider extends ProviderTrait { + + @Inject + @Named(NetconfModule.NETCONF) + DataBroker netconfDataBroker + + def create() { new NetconfMonitoringReaderModule.NetconfMonitoringReaderFactory(netconfDataBroker) } +} diff --git a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfMonitoringServiceProvider.groovy b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfMonitoringServiceProvider.groovy new file mode 100644 index 000000000..5762a0a7f --- /dev/null +++ b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfMonitoringServiceProvider.groovy @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2016 Cisco and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.fd.honeycomb.infra.distro.netconf + +import com.google.inject.Inject +import com.google.inject.name.Named +import groovy.transform.ToString +import groovy.util.logging.Slf4j +import io.fd.honeycomb.infra.distro.ProviderTrait +import org.opendaylight.netconf.api.monitoring.NetconfMonitoringService +import org.opendaylight.netconf.impl.osgi.NetconfMonitoringServiceImpl +import org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactory +/** + * Mirror of org.opendaylight.controller.config.yang.config.netconf.northbound.impl.NetconfServerMonitoringModule + */ +@Slf4j +@ToString +class NetconfMonitoringServiceProvider extends ProviderTrait { + + @Inject + @Named(NetconfModule.NETCONF_MAPPER_AGGREGATOR) + NetconfOperationServiceFactory aggregator + + @Override + def create() { + new NetconfMonitoringServiceImpl(aggregator) + } +} diff --git a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfNotificationMapperProvider.groovy b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfNotificationMapperProvider.groovy new file mode 100644 index 000000000..57f7038ab --- /dev/null +++ b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfNotificationMapperProvider.groovy @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2016 Cisco and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.fd.honeycomb.infra.distro.netconf + +import com.google.inject.Inject +import com.google.inject.name.Named +import groovy.transform.ToString +import groovy.util.logging.Slf4j +import io.fd.honeycomb.infra.distro.ProviderTrait +import org.opendaylight.controller.config.yang.netconf.mdsal.notification.BaseCapabilityChangeNotificationPublisher +import org.opendaylight.controller.config.yang.netconf.mdsal.notification.NotificationToMdsalWriter +import org.opendaylight.controller.md.sal.binding.api.DataBroker +import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker +import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType +import org.opendaylight.controller.sal.binding.api.BindingAwareBroker +import org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactory +import org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactoryListener +import org.opendaylight.netconf.mdsal.notification.NetconfNotificationOperationServiceFactory +import org.opendaylight.netconf.notifications.NetconfNotificationCollector +import org.opendaylight.netconf.notifications.NetconfNotificationRegistry +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.NetconfState +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.Capabilities +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier +/** + * Mirror of org.opendaylight.controller.config.yang.netconf.mdsal.notification.NetconfMdsalNotificationMapperModule + */ +@Slf4j +@ToString +class NetconfNotificationMapperProvider extends ProviderTrait { + + public static final capabilitiesIdentifier = + InstanceIdentifier.create(NetconfState.class).child(Capabilities.class).builder().build() + + @Inject + NetconfNotificationCollector notificationCollector + @Inject + NetconfNotificationRegistry notificationRegistry + @Inject + @Named(NetconfModule.NETCONF) + BindingAwareBroker bindingAwareBroker + @Inject + @Named(NetconfModule.NETCONF) + DataBroker dataBroker + @Inject + NetconfOperationServiceFactoryListener aggregator + + def create() { + def notificationToMdsalWriter = new NotificationToMdsalWriter(notificationCollector) + bindingAwareBroker.registerProvider(notificationToMdsalWriter) + + def capabilityChangeListenerRegistration = dataBroker.registerDataChangeListener(LogicalDatastoreType.OPERATIONAL, capabilitiesIdentifier, + new BaseCapabilityChangeNotificationPublisher(notificationCollector.registerBaseNotificationPublisher()), AsyncDataBroker.DataChangeScope.SUBTREE) + + def netconfNotificationOperationServiceFactory = new NetconfNotificationOperationServiceFactory(notificationRegistry) + aggregator.onAddNetconfOperationServiceFactory(netconfNotificationOperationServiceFactory) + netconfNotificationOperationServiceFactory + } +} diff --git a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfNotificationsReaderFactoryProvider.groovy b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfNotificationsReaderFactoryProvider.groovy new file mode 100644 index 000000000..45b7a1c7e --- /dev/null +++ b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfNotificationsReaderFactoryProvider.groovy @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2016 Cisco and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.fd.honeycomb.infra.distro.netconf + +import com.google.inject.Inject +import com.google.inject.name.Named +import groovy.transform.ToString +import groovy.util.logging.Slf4j +import io.fd.honeycomb.infra.distro.ProviderTrait +import io.fd.honeycomb.translate.read.ReaderFactory +import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder +import io.fd.honeycomb.translate.util.read.BindingBrokerReader +import org.opendaylight.controller.md.sal.binding.api.DataBroker +import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netmod.notification.rev080714.Netconf +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netmod.notification.rev080714.NetconfBuilder +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier + +import javax.annotation.Nonnull + +// TODO backport to karaf distro +@Slf4j +@ToString +class NetconfNotificationsReaderFactoryProvider extends ProviderTrait { + + @Inject + @Named(NetconfModule.NETCONF) + DataBroker netconfDataBroker + + def create() { + new ReaderFactory() { + @Override + void init(@Nonnull final ModifiableReaderRegistryBuilder registry) { + registry.add(new BindingBrokerReader<>(InstanceIdentifier.create(Netconf.class), + netconfDataBroker, LogicalDatastoreType.OPERATIONAL, NetconfBuilder.class)); + } + } + } +} diff --git a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfReadersModule.groovy b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfReadersModule.groovy new file mode 100644 index 000000000..91a280857 --- /dev/null +++ b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfReadersModule.groovy @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2016 Cisco and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.fd.honeycomb.infra.distro.netconf + +import com.google.inject.AbstractModule +import com.google.inject.Singleton +import com.google.inject.multibindings.Multibinder +import groovy.util.logging.Slf4j +import io.fd.honeycomb.translate.read.ReaderFactory + +@Slf4j +class NetconfReadersModule extends AbstractModule { + + protected void configure() { + // This should be part of NetconfModule, but that one is Private and Multibinders + private BASE_MODULES + // do not work together, that's why there's a dedicated module here + Multibinder.newSetBinder(binder(), ReaderFactory.class).with { + addBinding().toProvider(NetconfMonitoringReaderFactoryProvider).in(Singleton) + addBinding().toProvider(NetconfNotificationsReaderFactoryProvider).in(Singleton) + } + } +} diff --git a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfServerDispatcherProvider.groovy b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfServerDispatcherProvider.groovy new file mode 100644 index 000000000..072a7f6ae --- /dev/null +++ b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfServerDispatcherProvider.groovy @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2016 Cisco and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.fd.honeycomb.infra.distro.netconf + +import com.google.inject.Inject +import com.google.inject.name.Named +import groovy.transform.ToString +import groovy.util.logging.Slf4j +import io.fd.honeycomb.infra.distro.ProviderTrait +import io.netty.channel.nio.NioEventLoopGroup +import io.netty.util.Timer +import org.opendaylight.netconf.api.NetconfServerDispatcher +import org.opendaylight.netconf.api.monitoring.NetconfMonitoringService +import org.opendaylight.netconf.impl.NetconfServerDispatcherImpl +import org.opendaylight.netconf.impl.NetconfServerSessionNegotiatorFactory +import org.opendaylight.netconf.impl.SessionIdProvider +import org.opendaylight.netconf.impl.osgi.AggregatedNetconfOperationServiceFactory +import org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactory + +import java.util.concurrent.TimeUnit +/** + * Mirror of org.opendaylight.controller.config.yang.config.netconf.northbound.impl.NetconfServerDispatcherModule + */ +@Slf4j +@ToString +class NetconfServerDispatcherProvider extends ProviderTrait { + + // TODO make configurable + private static final long CONNECTION_TIMEOUT_MILLIS = TimeUnit.SECONDS.toMillis(20) + + @Inject + @Named(NetconfModule.NETCONF_MAPPER_AGGREGATOR) + NetconfOperationServiceFactory aggregator + @Inject + NetconfMonitoringService monitoringService + @Inject + Timer timer + @Inject + NioEventLoopGroup nettyThreadgroup + + + def create() { + def netconfOperationProvider = new AggregatedNetconfOperationServiceFactory() + netconfOperationProvider.onAddNetconfOperationServiceFactory(aggregator) + + def serverNegotiatorFactory = new NetconfServerSessionNegotiatorFactory( + timer, netconfOperationProvider, new SessionIdProvider(), CONNECTION_TIMEOUT_MILLIS, monitoringService); + def serverChannelInitializer = new NetconfServerDispatcherImpl.ServerChannelInitializer( + serverNegotiatorFactory); + + new NetconfServerDispatcherImpl(serverChannelInitializer, nettyThreadgroup, nettyThreadgroup) + } + +} diff --git a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfSshServerProvider.groovy b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfSshServerProvider.groovy new file mode 100644 index 000000000..bce4f261a --- /dev/null +++ b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfSshServerProvider.groovy @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2016 Cisco and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.fd.honeycomb.infra.distro.netconf + +import com.google.inject.Inject +import groovy.transform.ToString +import groovy.util.logging.Slf4j +import io.fd.honeycomb.infra.distro.cfgattrs.HoneycombConfiguration +import io.fd.honeycomb.infra.distro.ProviderTrait +import io.netty.channel.ChannelFuture +import io.netty.channel.local.LocalAddress +import io.netty.channel.nio.NioEventLoopGroup +import io.netty.util.concurrent.GenericFutureListener +import io.netty.util.concurrent.GlobalEventExecutor +import org.apache.sshd.server.keyprovider.PEMGeneratorHostKeyProvider +import org.opendaylight.netconf.api.NetconfServerDispatcher +import org.opendaylight.netconf.ssh.SshProxyServer +import org.opendaylight.netconf.ssh.SshProxyServerConfigurationBuilder + +import java.util.concurrent.Executors +import java.util.concurrent.ScheduledExecutorService +/** + * Mirror of org.opendaylight.controller.config.yang.netconf.northbound.ssh.NetconfNorthboundSshModule + */ +@Slf4j +@ToString +class NetconfSshServerProvider extends ProviderTrait { + + @Inject + NetconfServerDispatcher dispatcher + @Inject + HoneycombConfiguration cfgAttributes + @Inject + NioEventLoopGroup nettyThreadgroup + + // TODO merge with other executors .. one of the brokers creates also 2 internal executors + private ScheduledExecutorService pool = Executors.newScheduledThreadPool(1) + + @Override + def create() { + def name = InetAddress.getByName(cfgAttributes.netconfSshBindingAddress) + def bindingAddress = new InetSocketAddress(name, cfgAttributes.netconfSshBindingPort) + + def localAddress = new LocalAddress(cfgAttributes.netconfSshBindingPort.toString()) + def localServer = dispatcher.createLocalServer(localAddress) + + def sshProxyServer = new SshProxyServer(pool, nettyThreadgroup, GlobalEventExecutor.INSTANCE) + + def sshConfigBuilder = new SshProxyServerConfigurationBuilder() + sshConfigBuilder.bindingAddress = bindingAddress + sshConfigBuilder.localAddress = localAddress + // TODO only simple authProvider checking ConfigAttributes + sshConfigBuilder.authenticator = { String uname, String passwd -> + cfgAttributes.username == uname && cfgAttributes.password == passwd + } + sshConfigBuilder.idleTimeout = Integer.MAX_VALUE + sshConfigBuilder.keyPairProvider = new PEMGeneratorHostKeyProvider() + + localServer.addListener(new GenericFutureListener() { + + @Override + public void operationComplete(final ChannelFuture future) { + if(future.isDone() && !future.isCancelled()) { + try { + sshProxyServer.bind(sshConfigBuilder.createSshProxyServerConfiguration()) + log.info "Netconf SSH endpoint started successfully at {}", bindingAddress + } catch (final IOException e) { + throw new RuntimeException("Unable to start SSH netconf server", e) + } + } else { + log.warn "Unable to start SSH netconf server at {}", bindingAddress, future.cause() + throw new RuntimeException("Unable to start SSH netconf server", future.cause()) + } + } + }) + + return new NetconfSshServer(localServer: localServer, sshProxyServer: sshProxyServer) + } + + static class NetconfSshServer { + def localServer + def sshProxyServer + } +} diff --git a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfTcpServerProvider.groovy b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfTcpServerProvider.groovy new file mode 100644 index 000000000..c4e3523d0 --- /dev/null +++ b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfTcpServerProvider.groovy @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2016 Cisco and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.fd.honeycomb.infra.distro.netconf + +import com.google.inject.Inject +import groovy.transform.ToString +import groovy.util.logging.Slf4j +import io.fd.honeycomb.infra.distro.cfgattrs.HoneycombConfiguration +import io.fd.honeycomb.infra.distro.ProviderTrait +import io.netty.channel.ChannelFuture +import io.netty.util.concurrent.GenericFutureListener +import org.opendaylight.netconf.api.NetconfServerDispatcher +/** + * Mirror of org.opendaylight.controller.config.yang.netconf.northbound.tcp.NetconfNorthboundTcpModule + */ +@Slf4j +@ToString +class NetconfTcpServerProvider extends ProviderTrait { + + @Inject + NetconfServerDispatcher dispatcher + @Inject + HoneycombConfiguration cfgAttributes + + @Override + def create() { + + def name = InetAddress.getByName(cfgAttributes.netconfTcpBindingAddress.get()) + def unresolved = new InetSocketAddress(name, cfgAttributes.netconfTcpBindingPort.get()) + + def tcpServer = dispatcher.createServer(unresolved) + + tcpServer.addListener(new GenericFutureListener() { + @Override + public void operationComplete(ChannelFuture future) throws Exception { + if (future.isDone() && future.isSuccess()) { + log.info("Netconf TCP endpoint started successfully at {}", unresolved) + } else { + log.warn("Unable to start TCP netconf server at {}", unresolved, future.cause()) + throw new RuntimeException("Unable to start TCP netconf server", future.cause()) + } + } + }) + + new NetconfTcpServer(tcpServer: tcpServer) + } + + static class NetconfTcpServer { + def tcpServer + } +} diff --git a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NettyThreadGroupProvider.groovy b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NettyThreadGroupProvider.groovy new file mode 100644 index 000000000..da5f3d5b2 --- /dev/null +++ b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NettyThreadGroupProvider.groovy @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2016 Cisco and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.fd.honeycomb.infra.distro.netconf + +import com.google.inject.Inject +import groovy.transform.ToString +import groovy.util.logging.Slf4j +import io.fd.honeycomb.infra.distro.cfgattrs.HoneycombConfiguration +import io.fd.honeycomb.infra.distro.ProviderTrait +import io.netty.channel.nio.NioEventLoopGroup + +/** + * Mirror of org.opendaylight.controller.config.yang.netty.threadgroup.NettyThreadgroupModule + */ +@Slf4j +@ToString +class NettyThreadGroupProvider extends ProviderTrait { + + @Inject + HoneycombConfiguration cfgAttributes + + @Override + def create() { + cfgAttributes.netconfNettyThreads.isPresent() ? + new NioEventLoopGroup(cfgAttributes.netconfNettyThreads.get()) : + new NioEventLoopGroup() + } +} diff --git a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NettyTimerProvider.groovy b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NettyTimerProvider.groovy new file mode 100644 index 000000000..347417bd2 --- /dev/null +++ b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NettyTimerProvider.groovy @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2016 Cisco and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.fd.honeycomb.infra.distro.netconf + +import com.google.inject.Inject +import groovy.transform.ToString +import groovy.util.logging.Slf4j +import io.fd.honeycomb.infra.distro.cfgattrs.HoneycombConfiguration +import io.fd.honeycomb.infra.distro.ProviderTrait +import io.netty.util.HashedWheelTimer +import io.netty.util.Timer +/** + * Mirror of org.opendaylight.controller.config.yang.netty.timer.HashedWheelTimerModule + */ +@Slf4j +@ToString +class NettyTimerProvider extends ProviderTrait { + + @Inject + HoneycombConfiguration cfgAttributes + + @Override + def create() { + // TODO expose configuration, + new HashedWheelTimer() + } +} -- cgit 1.2.3-korg