Merge changes from topic 'blueprint'
authorJakub Morvay <jmorvay@cisco.com>
Wed, 2 Nov 2016 17:32:40 +0000 (17:32 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Wed, 2 Nov 2016 17:32:40 +0000 (17:32 +0000)
* changes:
  Remove remaining yang and xml config system files
  Add blueprint wiring for mdsal-netconf-yang-library
  Add blueprint wiring for mdsal-netconf-monitoring
  Add blueprint wiring to mdsal-netconf-notification
  Add blueprint wiring to netconf-notification-impl
  Add blueprint wiring for mdsal-netconf-connector
  Add blueprint wiring for netconf-impl
  Add blueprint wiring for netconf-ssh
  Add blueprint wiring for aaa-authn-odl-plugin

68 files changed:
features/netconf/pom.xml
features/netconf/src/main/features/features.xml
netconf/aaa-authn-odl-plugin/src/main/java/org/opendaylight/aaa/odl/CredentialServiceAuthProvider.java
netconf/aaa-authn-odl-plugin/src/main/java/org/opendaylight/yang/gen/v1/config/aaa/authn/netconf/plugin/rev150715/AuthProviderModule.java [deleted file]
netconf/aaa-authn-odl-plugin/src/main/java/org/opendaylight/yang/gen/v1/config/aaa/authn/netconf/plugin/rev150715/AuthProviderModuleFactory.java [deleted file]
netconf/aaa-authn-odl-plugin/src/main/resources/org/opendaylight/blueprint/aaa-authn-netconf.xml [new file with mode: 0644]
netconf/aaa-authn-odl-plugin/src/main/yang/aaa-authn-netconf-plugin.yang [deleted file]
netconf/mdsal-netconf-connector/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/mapper/NetconfMdsalMapperModule.java [deleted file]
netconf/mdsal-netconf-connector/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/mapper/NetconfMdsalMapperModuleFactory.java [deleted file]
netconf/mdsal-netconf-connector/src/main/java/org/opendaylight/netconf/mdsal/connector/MdsalNetconfOperationServiceFactory.java
netconf/mdsal-netconf-connector/src/main/resources/org/opendaylight/blueprint/mdsal-netconf-connector.xml [new file with mode: 0644]
netconf/mdsal-netconf-connector/src/main/yang/netconf-mdsal-mapper.yang [deleted file]
netconf/mdsal-netconf-impl/pom.xml [new file with mode: 0644]
netconf/mdsal-netconf-impl/src/main/resources/org/opendaylight/blueprint/mdsal-netconf-impl.xml [new file with mode: 0755]
netconf/mdsal-netconf-monitoring/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/monitoring/MdSalMonitoringMapperFactory.java [new file with mode: 0644]
netconf/mdsal-netconf-monitoring/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/monitoring/MonitoringToMdsalWriter.java
netconf/mdsal-netconf-monitoring/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/monitoring/NetconfMdsalMonitoringMapperModule.java [deleted file]
netconf/mdsal-netconf-monitoring/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/monitoring/NetconfMdsalMonitoringMapperModuleFactory.java [deleted file]
netconf/mdsal-netconf-monitoring/src/main/resources/org/opendaylight/blueprint/mdsal-netconf-monitoring.xml [new file with mode: 0644]
netconf/mdsal-netconf-monitoring/src/main/yang/netconf-mdsal-monitoring.yang [deleted file]
netconf/mdsal-netconf-monitoring/src/test/java/org/opendaylight/controller/config/yang/netconf/mdsal/monitoring/MonitoringToMdsalWriterTest.java
netconf/mdsal-netconf-notification/pom.xml
netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/CapabilityChangeNotificationProducer.java
netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/NetconfMdsalNotificationMapperModule.java [deleted file]
netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/NetconfMdsalNotificationMapperModuleFactory.java [deleted file]
netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/NotificationToMdsalWriter.java
netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/SessionNotificationProducer.java
netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/netconf/mdsal/notification/NetconfNotificationOperationServiceFactory.java
netconf/mdsal-netconf-notification/src/main/resources/org/opendaylight/blueprint/mdsal-netconf-notification.xml [new file with mode: 0755]
netconf/mdsal-netconf-notification/src/main/yang/netconf-mdsal-notification.yang [deleted file]
netconf/mdsal-netconf-notification/src/test/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/CapabilityChangeNotificationProducerTest.java
netconf/mdsal-netconf-notification/src/test/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/NotificationToMdsalWriterTest.java
netconf/mdsal-netconf-notification/src/test/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/SessionNotificationProducerTest.java
netconf/mdsal-netconf-ssh/pom.xml [new file with mode: 0644]
netconf/mdsal-netconf-ssh/src/main/resources/org/opendaylight/blueprint/netconf-ssh.xml [new file with mode: 0755]
netconf/mdsal-netconf-yang-library/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/yang/library/NetconfMdsalYanglibModule.java [deleted file]
netconf/mdsal-netconf-yang-library/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/yang/library/NetconfMdsalYanglibModuleFactory.java [deleted file]
netconf/mdsal-netconf-yang-library/src/main/java/org/opendaylight/netconf/mdsal/yang/library/SchemaServiceToMdsalWriter.java
netconf/mdsal-netconf-yang-library/src/main/resources/org/opendaylight/blueprint/mdsal-netconf-yang-library.xml [new file with mode: 0755]
netconf/mdsal-netconf-yang-library/src/main/yang/netconf-mdsal-yang-library.yang [deleted file]
netconf/mdsal-netconf-yang-library/src/test/java/org/opendaylight/netconf/mdsal/yang/library/SchemaServiceToMdsalWriterTest.java
netconf/netconf-api/src/main/yang/netconf-northbound.yang
netconf/netconf-artifacts/pom.xml
netconf/netconf-auth/src/main/yang/netconf-auth.yang
netconf/netconf-client/src/test/resources/helloMessage1.xml
netconf/netconf-impl/src/main/java/org/opendaylight/controller/config/yang/config/netconf/northbound/impl/NetconfMapperAggregatorModule.java [deleted file]
netconf/netconf-impl/src/main/java/org/opendaylight/controller/config/yang/config/netconf/northbound/impl/NetconfMapperAggregatorModuleFactory.java [deleted file]
netconf/netconf-impl/src/main/java/org/opendaylight/controller/config/yang/config/netconf/northbound/impl/NetconfServerDispatcherModule.java [deleted file]
netconf/netconf-impl/src/main/java/org/opendaylight/controller/config/yang/config/netconf/northbound/impl/NetconfServerDispatcherModuleFactory.java [deleted file]
netconf/netconf-impl/src/main/java/org/opendaylight/controller/config/yang/config/netconf/northbound/impl/NetconfServerMonitoringModule.java [deleted file]
netconf/netconf-impl/src/main/java/org/opendaylight/controller/config/yang/config/netconf/northbound/impl/NetconfServerMonitoringModuleFactory.java [deleted file]
netconf/netconf-impl/src/main/java/org/opendaylight/netconf/impl/NetconfServerSessionNegotiatorFactory.java
netconf/netconf-impl/src/main/java/org/opendaylight/netconf/impl/osgi/AggregatedNetconfOperationServiceFactory.java
netconf/netconf-impl/src/main/java/org/opendaylight/netconf/impl/osgi/NetconfCapabilityMonitoringService.java
netconf/netconf-impl/src/main/java/org/opendaylight/netconf/impl/osgi/NetconfMonitoringServiceImpl.java
netconf/netconf-impl/src/main/yang/netconf-northbound-impl.yang [deleted file]
netconf/netconf-mapping-api/src/main/yang/netconf-northbound-mapper.yang
netconf/netconf-mdsal-config/pom.xml [deleted file]
netconf/netconf-mdsal-config/src/main/resources/initial/08-netconf-mdsal.xml [deleted file]
netconf/netconf-notifications-api/src/main/yang/netconf-northbound-notification.yang
netconf/netconf-notifications-impl/src/main/java/org/opendaylight/controller/config/yang/netconf/northbound/notification/impl/NetconfNotificationManagerModule.java [deleted file]
netconf/netconf-notifications-impl/src/main/java/org/opendaylight/controller/config/yang/netconf/northbound/notification/impl/NetconfNotificationManagerModuleFactory.java [deleted file]
netconf/netconf-notifications-impl/src/main/yang/netconf-northbound-notification-impl.yang [deleted file]
netconf/netconf-ssh/src/main/java/org/opendaylight/controller/config/yang/netconf/northbound/ssh/NetconfNorthboundSshModule.java [deleted file]
netconf/netconf-ssh/src/main/java/org/opendaylight/controller/config/yang/netconf/northbound/ssh/NetconfNorthboundSshModuleFactory.java [deleted file]
netconf/netconf-ssh/src/main/java/org/opendaylight/netconf/ssh/NetconfNorthboundSshServer.java [new file with mode: 0644]
netconf/netconf-ssh/src/main/yang/netconf-northbound-ssh.yang [deleted file]
netconf/pom.xml

index b413f6b838d807eb4f1cc2fd2eb1e545b8db83e6..2839b04f2fdbe08fd9e327f77fc7aa5c9cbcc7e5 100644 (file)
@@ -34,7 +34,6 @@
 
     <config.configfile.directory>etc/opendaylight/karaf</config.configfile.directory>
     <config.netconf.client.configfile>01-netconf.xml</config.netconf.client.configfile>
-    <config.netconf.mdsal.configfile>08-mdsal-netconf.xml</config.netconf.mdsal.configfile>
   </properties>
 
   <dependencyManagement>
       <groupId>${project.groupId}</groupId>
       <artifactId>netconf-monitoring</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.opendaylight.netconf</groupId>
+      <artifactId>mdsal-netconf-ssh</artifactId>
+    </dependency>
     <dependency>
       <groupId>${project.groupId}</groupId>
       <artifactId>mdsal-netconf-monitoring</artifactId>
       <artifactId>mdsal-netconf-yang-library</artifactId>
     </dependency>
     <dependency>
-      <groupId>${project.groupId}</groupId>
-      <artifactId>netconf-mdsal-config</artifactId>
-      <classifier>config</classifier>
-      <type>xml</type>
+      <groupId>org.opendaylight.netconf</groupId>
+      <artifactId>mdsal-netconf-impl</artifactId>
     </dependency>
   </dependencies>
 
index b43653d2a05fd2c75bfdc294fe6b2d32c9dac2cf..52ebacd94728420b9c0fa73c393c53e7f061f266 100644 (file)
     <feature version='${project.version}'>odl-netconf-ssh</feature>
     <feature version='${project.version}'>odl-netconf-client</feature>
     <feature version='${controller.mdsal.version}'>odl-mdsal-broker</feature>
+    <bundle>mvn:org.opendaylight.netconf/mdsal-netconf-ssh/{{VERSION}}</bundle>
     <bundle>mvn:org.opendaylight.netconf/mdsal-netconf-notification/{{VERSION}}</bundle>
     <bundle>mvn:org.opendaylight.netconf/mdsal-netconf-connector/{{VERSION}}</bundle>
     <bundle>mvn:org.opendaylight.netconf/mdsal-netconf-monitoring/{{VERSION}}</bundle>
     <bundle>mvn:org.opendaylight.netconf/mdsal-netconf-yang-library/{{VERSION}}</bundle>
-    <configfile finalname='${config.configfile.directory}/${config.netconf.mdsal.configfile}'>mvn:org.opendaylight.netconf/netconf-mdsal-config/{{VERSION}}/xml/config</configfile>
+    <bundle>mvn:org.opendaylight.netconf/mdsal-netconf-impl/{{VERSION}}</bundle>
   </feature>
 
   <feature name='odl-aaa-netconf-plugin' description='OpenDaylight :: AAA :: ODL NETCONF Plugin'
index fe1f21c064e6cdc6a94463302cccb174ad072f7c..67ad6ebc572475dce506bc4aee96bdbf6b00254d 100644 (file)
@@ -88,8 +88,11 @@ public final class CredentialServiceAuthProvider implements AuthProvider, AutoCl
         return true;
     }
 
+    /**
+     * Invoke by blueprint
+     */
     @Override
-    public void close() throws Exception {
+    public void close() {
         listenerTracker.close();
         nullableCredService = null;
     }
diff --git a/netconf/aaa-authn-odl-plugin/src/main/java/org/opendaylight/yang/gen/v1/config/aaa/authn/netconf/plugin/rev150715/AuthProviderModule.java b/netconf/aaa-authn-odl-plugin/src/main/java/org/opendaylight/yang/gen/v1/config/aaa/authn/netconf/plugin/rev150715/AuthProviderModule.java
deleted file mode 100644 (file)
index e264881..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.yang.gen.v1.config.aaa.authn.netconf.plugin.rev150715;
-
-import com.google.common.base.Preconditions;
-import org.opendaylight.aaa.odl.CredentialServiceAuthProvider;
-import org.opendaylight.controller.config.api.DependencyResolver;
-import org.opendaylight.controller.config.api.ModuleIdentifier;
-import org.osgi.framework.BundleContext;
-
-public class AuthProviderModule extends org.opendaylight.yang.gen.v1.config.aaa.authn.netconf.plugin.rev150715.AbstractAuthProviderModule {
-
-    private BundleContext bundleContext;
-
-    public AuthProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
-        super(identifier, dependencyResolver);
-    }
-
-    public AuthProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.config.aaa.authn.netconf.plugin.rev150715.AuthProviderModule oldModule, AutoCloseable oldInstance) {
-        super(identifier, dependencyResolver, oldModule, oldInstance);
-    }
-
-    public AuthProviderModule(final ModuleIdentifier moduleIdentifier, final DependencyResolver dependencyResolver, final AuthProviderModule oldModule, final AutoCloseable oldInstance, final BundleContext bundleContext) {
-        this(moduleIdentifier, dependencyResolver, oldModule, oldInstance);
-        this.bundleContext = bundleContext;
-    }
-
-    public AuthProviderModule(final ModuleIdentifier moduleIdentifier, final DependencyResolver dependencyResolver, final BundleContext bundleContext) {
-        this(moduleIdentifier, dependencyResolver);
-        this.bundleContext = bundleContext;
-    }
-
-    @Override
-    public void customValidation() {
-        Preconditions.checkNotNull(bundleContext, "BundleContext was not properly set up");
-    }
-
-    @Override
-    public AutoCloseable createInstance() {
-       return new CredentialServiceAuthProvider(bundleContext);
-    }
-
-}
diff --git a/netconf/aaa-authn-odl-plugin/src/main/java/org/opendaylight/yang/gen/v1/config/aaa/authn/netconf/plugin/rev150715/AuthProviderModuleFactory.java b/netconf/aaa-authn-odl-plugin/src/main/java/org/opendaylight/yang/gen/v1/config/aaa/authn/netconf/plugin/rev150715/AuthProviderModuleFactory.java
deleted file mode 100644 (file)
index 495ac42..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-/*
-* Generated file
-*
-* Generated from: yang module name: aaa-authn-netconf-plugin yang module local name: aaa-authn-netconf-plugin
-* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
-* Generated at: Wed Jul 15 15:16:51 CEST 2015
-*
-* Do not modify this file unless it is present under src/main directory
-*/
-package org.opendaylight.yang.gen.v1.config.aaa.authn.netconf.plugin.rev150715;
-
-import java.util.Collections;
-import java.util.Set;
-import org.opendaylight.controller.config.api.DependencyResolver;
-import org.opendaylight.controller.config.api.DependencyResolverFactory;
-import org.opendaylight.controller.config.api.ModuleIdentifier;
-import org.osgi.framework.BundleContext;
-
-public class AuthProviderModuleFactory extends org.opendaylight.yang.gen.v1.config.aaa.authn.netconf.plugin.rev150715.AbstractAuthProviderModuleFactory {
-
-    private static final ModuleIdentifier DEFAULT_INSTANCE_ID = new ModuleIdentifier(NAME, "default-auth-provider");
-
-    @Override
-    public AuthProviderModule instantiateModule(final String instanceName, final DependencyResolver dependencyResolver, final AuthProviderModule oldModule, final AutoCloseable oldInstance, final BundleContext bundleContext) {
-        return new AuthProviderModule(
-                new ModuleIdentifier(NAME, instanceName), dependencyResolver, oldModule, oldInstance, bundleContext);
-    }
-
-    @Override
-    public AuthProviderModule instantiateModule(final String instanceName, final DependencyResolver dependencyResolver, final BundleContext bundleContext) {
-        return new AuthProviderModule(
-                new ModuleIdentifier(NAME, instanceName), dependencyResolver, bundleContext);
-    }
-
-    @Override
-    public Set<AuthProviderModule> getDefaultModules(final DependencyResolverFactory dependencyResolverFactory, final BundleContext bundleContext) {
-        // Config subsystem puts this instance into OSGi service registry automatically
-        final DependencyResolver dependencyResolver = dependencyResolverFactory.createDependencyResolver(DEFAULT_INSTANCE_ID);
-        return Collections.singleton(new AuthProviderModule(DEFAULT_INSTANCE_ID, dependencyResolver, bundleContext));
-    }
-}
diff --git a/netconf/aaa-authn-odl-plugin/src/main/resources/org/opendaylight/blueprint/aaa-authn-netconf.xml b/netconf/aaa-authn-odl-plugin/src/main/resources/org/opendaylight/blueprint/aaa-authn-netconf.xml
new file mode 100644 (file)
index 0000000..6e55371
--- /dev/null
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2016 Inocybe Technologies Inc. and others.  All rights reserved.
+
+ This program and the accompanying materials are made available under the
+ terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+           odl:use-default-for-reference-types="true">
+
+    <bean id="credentialServiceAuthProvider"
+          class="org.opendaylight.aaa.odl.CredentialServiceAuthProvider"
+          destroy-method="close">
+        <argument ref="blueprintBundleContext"/>
+    </bean>
+    <service ref="credentialServiceAuthProvider" interface="org.opendaylight.netconf.auth.AuthProvider"
+             odl:type="netconf-auth-provider"/>
+
+</blueprint>
\ No newline at end of file
diff --git a/netconf/aaa-authn-odl-plugin/src/main/yang/aaa-authn-netconf-plugin.yang b/netconf/aaa-authn-odl-plugin/src/main/yang/aaa-authn-netconf-plugin.yang
deleted file mode 100644 (file)
index ffa6d98..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-module aaa-authn-netconf-plugin {
-
-    yang-version 1;
-    namespace "config:aaa:authn:netconf:plugin";
-    prefix "aaa-authn-store-cfg";
-
-    import config { prefix config; revision-date 2013-04-05; }
-    import netconf-auth { prefix na; revision-date 2015-07-15; }
-
-    revision "2015-07-15" {
-        description
-            "Initial revision.";
-    }
-
-    identity aaa-authn-netconf-plugin {
-            base config:module-type;
-            config:java-name-prefix AuthProvider;
-            config:provided-service na:netconf-auth-provider;
-    }
-
-    augment "/config:modules/config:module/config:configuration" {
-        case aaa-authn-netconf-plugin {
-            when "/config:modules/config:module/config:type = 'aaa-authn-netconf-plugin'";
-            // no config yet
-       }
-    }
-}
diff --git a/netconf/mdsal-netconf-connector/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/mapper/NetconfMdsalMapperModule.java b/netconf/mdsal-netconf-connector/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/mapper/NetconfMdsalMapperModule.java
deleted file mode 100644 (file)
index 23993cf..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.controller.config.yang.netconf.mdsal.mapper;
-
-import org.opendaylight.netconf.mdsal.connector.MdsalNetconfOperationServiceFactory;
-
-public class NetconfMdsalMapperModule extends org.opendaylight.controller.config.yang.netconf.mdsal.mapper.AbstractNetconfMdsalMapperModule{
-    public NetconfMdsalMapperModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
-        super(identifier, dependencyResolver);
-    }
-
-    public NetconfMdsalMapperModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.controller.config.yang.netconf.mdsal.mapper.NetconfMdsalMapperModule oldModule, java.lang.AutoCloseable oldInstance) {
-        super(identifier, dependencyResolver, oldModule, oldInstance);
-    }
-
-    @Override
-    public void customValidation() {
-        // add custom validation form module attributes here.
-    }
-
-    @Override
-    public java.lang.AutoCloseable createInstance() {
-        final MdsalNetconfOperationServiceFactory mdsalNetconfOperationServiceFactory =
-            new MdsalNetconfOperationServiceFactory(getRootSchemaServiceDependency(), getRootSchemaSourceProviderDependency()) {
-                @Override
-                public void close() throws Exception {
-                    super.close();
-                    getMapperAggregatorDependency().onRemoveNetconfOperationServiceFactory(this);
-                }
-            };
-        getDomBrokerDependency().registerConsumer(mdsalNetconfOperationServiceFactory);
-        getMapperAggregatorDependency().onAddNetconfOperationServiceFactory(mdsalNetconfOperationServiceFactory);
-        return mdsalNetconfOperationServiceFactory;
-    }
-
-}
diff --git a/netconf/mdsal-netconf-connector/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/mapper/NetconfMdsalMapperModuleFactory.java b/netconf/mdsal-netconf-connector/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/mapper/NetconfMdsalMapperModuleFactory.java
deleted file mode 100644 (file)
index 4eb0563..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-/*
-* Generated file
-*
-* Generated from: yang module name: netconf-mdsal-mapper yang module local name: netconf-mdsal-mapper
-* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
-* Generated at: Wed Jan 14 14:58:42 CET 2015
-*
-* Do not modify this file unless it is present under src/main directory
-*/
-package org.opendaylight.controller.config.yang.netconf.mdsal.mapper;
-public class NetconfMdsalMapperModuleFactory extends org.opendaylight.controller.config.yang.netconf.mdsal.mapper.AbstractNetconfMdsalMapperModuleFactory {
-
-}
index b450a9d0c8310cc5fd9a738d5b179f8372eaa9ec..ef3bbf03e7c6eb75a03d33ef254efa8440779a71 100644 (file)
@@ -15,19 +15,16 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.nio.charset.StandardCharsets;
-import java.util.Collection;
-import java.util.Collections;
 import java.util.HashSet;
 import java.util.Set;
 import org.opendaylight.controller.config.util.capability.Capability;
 import org.opendaylight.controller.config.util.capability.YangModuleCapability;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcService;
-import org.opendaylight.controller.sal.core.api.Broker.ConsumerSession;
-import org.opendaylight.controller.sal.core.api.Consumer;
 import org.opendaylight.controller.sal.core.api.model.SchemaService;
 import org.opendaylight.netconf.api.monitoring.CapabilityListener;
 import org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactory;
+import org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactoryListener;
 import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
@@ -38,19 +35,30 @@ import org.opendaylight.yangtools.yang.model.repo.spi.SchemaSourceProvider;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class MdsalNetconfOperationServiceFactory implements NetconfOperationServiceFactory, Consumer, AutoCloseable {
+public class MdsalNetconfOperationServiceFactory implements NetconfOperationServiceFactory, AutoCloseable {
 
     private static final Logger LOG = LoggerFactory.getLogger(MdsalNetconfOperationServiceFactory.class);
 
-    private ConsumerSession session = null;
-    private DOMDataBroker dataBroker = null;
-    private DOMRpcService rpcService = null;
+    private final DOMDataBroker dataBroker;
+    private final DOMRpcService rpcService;
+
     private final CurrentSchemaContext currentSchemaContext;
     private final SchemaSourceProvider<YangTextSchemaSource> rootSchemaSourceProviderDependency;
+    private final NetconfOperationServiceFactoryListener netconfOperationServiceFactoryListener;
+
+    public MdsalNetconfOperationServiceFactory(final SchemaService schemaService,
+                                               final SchemaSourceProvider<YangTextSchemaSource> rootSchemaSourceProviderDependency,
+                                               final NetconfOperationServiceFactoryListener netconfOperationServiceFactoryListener,
+                                               final DOMDataBroker dataBroker,
+                                               final DOMRpcService rpcService) {
+
+        this.dataBroker = dataBroker;
+        this.rpcService = rpcService;
 
-    public MdsalNetconfOperationServiceFactory(final SchemaService schemaService, final SchemaSourceProvider<YangTextSchemaSource> rootSchemaSourceProviderDependency) {
         this.rootSchemaSourceProviderDependency = rootSchemaSourceProviderDependency;
         this.currentSchemaContext = new CurrentSchemaContext(Preconditions.checkNotNull(schemaService), rootSchemaSourceProviderDependency);
+        this.netconfOperationServiceFactoryListener = netconfOperationServiceFactoryListener;
+        this.netconfOperationServiceFactoryListener.onAddNetconfOperationServiceFactory(this);
     }
 
     @Override
@@ -60,8 +68,15 @@ public class MdsalNetconfOperationServiceFactory implements NetconfOperationServ
     }
 
     @Override
-    public void close() throws Exception {
-        currentSchemaContext.close();
+    public void close() {
+        try {
+            currentSchemaContext.close();
+            if (netconfOperationServiceFactoryListener != null) {
+                netconfOperationServiceFactoryListener.onRemoveNetconfOperationServiceFactory(this);
+            }
+        } catch(Exception e) {
+            LOG.error("Failed to close resources correctly - ignore", e);
+        }
     }
 
     @Override
@@ -130,16 +145,4 @@ public class MdsalNetconfOperationServiceFactory implements NetconfOperationServ
     public AutoCloseable registerCapabilityListener(final CapabilityListener listener) {
         return currentSchemaContext.registerCapabilityListener(listener);
     }
-
-    @Override
-    public void onSessionInitiated(ConsumerSession session) {
-        this.session = Preconditions.checkNotNull(session);
-        this.dataBroker = this.session.getService(DOMDataBroker.class);
-        this.rpcService = this.session.getService(DOMRpcService.class);
-    }
-
-    @Override
-    public Collection<ConsumerFunctionality> getConsumerFunctionality() {
-        return Collections.emptySet();
-    }
 }
diff --git a/netconf/mdsal-netconf-connector/src/main/resources/org/opendaylight/blueprint/mdsal-netconf-connector.xml b/netconf/mdsal-netconf-connector/src/main/resources/org/opendaylight/blueprint/mdsal-netconf-connector.xml
new file mode 100644 (file)
index 0000000..63505e7
--- /dev/null
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2016 Inocybe Technologies Inc. and others.  All rights reserved.
+
+ This program and the accompanying materials are made available under the
+ terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+           odl:use-default-for-reference-types="true">
+
+    <reference id="domDataBroker" interface="org.opendaylight.controller.md.sal.dom.api.DOMDataBroker"/>
+    <reference id="domRpcService" interface="org.opendaylight.controller.md.sal.dom.api.DOMRpcService"/>
+    <reference id="schemaService"
+               interface="org.opendaylight.controller.sal.core.api.model.SchemaService"/>
+    <reference id="rootSchemaSourceProviderDependency"
+               interface="org.opendaylight.controller.sal.core.api.model.YangTextSourceProvider"/>
+    <reference id="netconfOperationServiceFactoryListener"
+               interface="org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactoryListener"
+               odl:type="mapper-aggregator-registry"/>
+
+    <bean id="mdsalNetconfOperationServiceFactory"
+          class="org.opendaylight.netconf.mdsal.connector.MdsalNetconfOperationServiceFactory"
+          destroy-method="close">
+        <argument ref="schemaService"/>
+        <argument ref="rootSchemaSourceProviderDependency"/>
+        <argument ref="netconfOperationServiceFactoryListener"/>
+        <argument ref="domDataBroker"/>
+        <argument ref="domRpcService"/>
+    </bean>
+    <service ref="mdsalNetconfOperationServiceFactory"
+             interface="org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactory"
+             odl:type="mdsal-netconf-connector"/>
+
+</blueprint>
diff --git a/netconf/mdsal-netconf-connector/src/main/yang/netconf-mdsal-mapper.yang b/netconf/mdsal-netconf-connector/src/main/yang/netconf-mdsal-mapper.yang
deleted file mode 100644 (file)
index 633a930..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-module netconf-mdsal-mapper {
-    yang-version 1;
-    namespace "urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:mapper";
-    prefix "nmm";
-
-    import netconf-northbound-mapper { prefix nnm; revision-date 2015-01-14; }
-    import opendaylight-md-sal-dom { prefix md-sal-dom; revision-date 2013-10-28; }
-    import config { prefix config; revision-date 2013-04-05; }
-
-    organization "Cisco Systems, Inc.";
-
-    description
-        "This module contains the base YANG definitions for
-         an MD-SAL mapper implementation";
-
-    revision "2015-01-14" {
-        description
-            "Initial revision.";
-    }
-
-    identity netconf-mdsal-mapper {
-        base config:module-type;
-        config:provided-service nnm:netconf-northbound-mapper;
-    }
-
-    augment "/config:modules/config:module/config:configuration" {
-        case netconf-mdsal-mapper {
-            when "/config:modules/config:module/config:type = 'netconf-mdsal-mapper'";
-
-            container root-schema-service {
-                uses config:service-ref {
-                    refine type {
-                        mandatory false;
-                        config:required-identity md-sal-dom:schema-service;
-                    }
-                }
-            }
-
-            container root-schema-source-provider {
-                uses config:service-ref {
-                    refine type {
-                        mandatory false;
-                        config:required-identity md-sal-dom:yang-text-source-provider;
-                    }
-                }
-            }
-
-            container dom-broker {
-                uses config:service-ref {
-                    refine type {
-                        mandatory true;
-                        config:required-identity md-sal-dom:dom-broker-osgi-registry;
-                    }
-                }
-            }
-
-            container mapper-aggregator {
-                uses config:service-ref {
-                    refine type {
-                        mandatory true;
-                        config:required-identity nnm:netconf-mapper-registry;
-                    }
-                }
-            }
-        }
-    }
-
-}
diff --git a/netconf/mdsal-netconf-impl/pom.xml b/netconf/mdsal-netconf-impl/pom.xml
new file mode 100644 (file)
index 0000000..882f939
--- /dev/null
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2016 Inocybe Technologies and others.  All rights reserved.
+
+ This program and the accompanying materials are made available under the
+ terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.opendaylight.controller</groupId>
+    <artifactId>config-parent</artifactId>
+    <version>0.6.0-SNAPSHOT</version>
+    <relativePath/>
+  </parent>
+
+  <groupId>org.opendaylight.netconf</groupId>
+  <artifactId>mdsal-netconf-impl</artifactId>
+  <version>1.2.0-SNAPSHOT</version>
+  <name>${project.artifactId}</name>
+  <packaging>bundle</packaging>
+
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>org.opendaylight.netconf</groupId>
+        <artifactId>netconf-subsystem</artifactId>
+        <version>${project.version}</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+
+  <dependencies>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>netconf-impl</artifactId>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
+            <Embed-Dependency>netconf-impl</Embed-Dependency>
+          </instructions>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/netconf/mdsal-netconf-impl/src/main/resources/org/opendaylight/blueprint/mdsal-netconf-impl.xml b/netconf/mdsal-netconf-impl/src/main/resources/org/opendaylight/blueprint/mdsal-netconf-impl.xml
new file mode 100755 (executable)
index 0000000..f75383c
--- /dev/null
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2016 Inocybe Technologies Inc. and others.  All rights reserved.
+
+ This program and the accompanying materials are made available under the
+ terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+           xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.3.0"
+           odl:restart-dependents-on-updates="true"
+           odl:use-default-for-reference-types="true">
+
+    <!--This is the MD-SAL netconf server implementation blueprint xml file-->
+
+    <reference id="globalBossGroup" interface="io.netty.channel.EventLoopGroup" odl:type="global-boss-group"/>
+    <reference id="globalWorkerGroup" interface="io.netty.channel.EventLoopGroup" odl:type="global-worker-group"/>
+    <reference id="global-timer" interface="io.netty.util.Timer" odl:type="global-timer"/>
+    <reference id="scheduledThreadPool" interface="org.opendaylight.controller.config.threadpool.ScheduledThreadPool"/>
+
+    <cm:property-placeholder persistent-id="org.opendaylight.netconf.impl" update-strategy="none">
+        <cm:default-properties>
+            <cm:property name="connection-timeout-millis" value="20000"/>
+            <cm:property name="monitoring-update-interval" value="6"/>
+        </cm:default-properties>
+    </cm:property-placeholder>
+
+    <!--NetconfMapperAggregator -->
+
+    <bean id="aggregatedNetconfOperationServiceFactory"
+          class="org.opendaylight.netconf.impl.osgi.AggregatedNetconfOperationServiceFactory"
+          destroy-method="close">
+    </bean>
+    <service ref="aggregatedNetconfOperationServiceFactory"
+             interface="org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactoryListener"
+             odl:type="mapper-aggregator-registry">
+    </service>
+
+    <!--NetconfServerDispatcher -->
+
+    <bean id="sessionIdProvider"
+          class="org.opendaylight.netconf.impl.SessionIdProvider"/>
+
+    <bean id="aggregatedNetconfOperationServiceFactoryMappers"
+          class="org.opendaylight.netconf.impl.osgi.AggregatedNetconfOperationServiceFactory"
+          destroy-method="close">
+        <argument>
+            <list value-type="org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactory">
+                <ref component-id="aggregatedNetconfOperationServiceFactory"/>
+            </list>
+        </argument>
+    </bean>
+
+    <bean id="netconfServerSessionNegotiatorFactory"
+          class="org.opendaylight.netconf.impl.NetconfServerSessionNegotiatorFactory">
+        <argument ref="global-timer"/>
+        <argument ref="aggregatedNetconfOperationServiceFactoryMappers"/>
+        <argument ref="sessionIdProvider"/>
+        <argument value="${connection-timeout-millis}"/>
+        <argument ref="netconfMonitoringService"/>
+        <argument><null/></argument><!--Base capabilities-->
+    </bean>
+
+    <bean id="serverChannelInitializer"
+          class="org.opendaylight.netconf.impl.NetconfServerDispatcherImpl.ServerChannelInitializer">
+        <argument ref="netconfServerSessionNegotiatorFactory"/>
+    </bean>
+
+    <bean id="netconfServerDispatcherImpl"
+          class="org.opendaylight.netconf.impl.NetconfServerDispatcherImpl">
+        <argument ref="serverChannelInitializer"/>
+        <argument ref="globalBossGroup"/>
+        <argument ref="globalWorkerGroup"/>
+    </bean>
+    <service ref="netconfServerDispatcherImpl"
+             interface="org.opendaylight.netconf.api.NetconfServerDispatcher"
+             odl:type="netconf-server-dispatcher">
+    </service>
+
+    <!--NetconfServerMonitoring -->
+
+    <bean id="netconfMonitoringService"
+          class="org.opendaylight.netconf.impl.osgi.NetconfMonitoringServiceImpl">
+        <argument ref="aggregatedNetconfOperationServiceFactory"/>
+        <argument ref="scheduledThreadPool"/>
+        <argument value="${monitoring-update-interval}"/>
+    </bean>
+    <service ref="netconfMonitoringService"
+             interface="org.opendaylight.netconf.api.monitoring.NetconfMonitoringService"
+             odl:type="netconf-server-monitoring">
+    </service>
+
+</blueprint>
diff --git a/netconf/mdsal-netconf-monitoring/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/monitoring/MdSalMonitoringMapperFactory.java b/netconf/mdsal-netconf-monitoring/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/monitoring/MdSalMonitoringMapperFactory.java
new file mode 100644 (file)
index 0000000..a80275d
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.config.yang.netconf.mdsal.monitoring;
+
+import org.opendaylight.controller.config.util.capability.Capability;
+import org.opendaylight.controller.sal.common.util.NoopAutoCloseable;
+import org.opendaylight.netconf.api.monitoring.CapabilityListener;
+import org.opendaylight.netconf.api.monitoring.NetconfMonitoringService;
+import org.opendaylight.netconf.mapping.api.NetconfOperation;
+import org.opendaylight.netconf.mapping.api.NetconfOperationService;
+import org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactory;
+import org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactoryListener;
+import org.opendaylight.netconf.monitoring.GetSchema;
+
+import java.util.Collections;
+import java.util.Set;
+
+public class MdSalMonitoringMapperFactory implements NetconfOperationServiceFactory, AutoCloseable {
+
+    private final NetconfOperationService operationService;
+    private final MonitoringToMdsalWriter monitoringToMdsalWriter;
+    private final NetconfOperationServiceFactoryListener netconfOperationServiceFactoryListener;
+
+    private static final Set<Capability> CAPABILITIES = Collections.emptySet();
+
+    public MdSalMonitoringMapperFactory(final NetconfOperationServiceFactoryListener netconfOperationServiceFactoryListener,
+                                        final NetconfMonitoringService netconfMonitoringService,
+                                        final MonitoringToMdsalWriter monitoringToMdsalWriter) {
+
+        this.netconfOperationServiceFactoryListener = netconfOperationServiceFactoryListener;
+        this.monitoringToMdsalWriter = monitoringToMdsalWriter;
+
+        this.operationService = new NetconfOperationService() {
+            @Override
+            public Set<NetconfOperation> getNetconfOperations() {
+                return Collections.singleton(new GetSchema(netconfMonitoringService));
+            }
+
+            @Override
+            public void close() {
+                // NOOP
+            }
+        };
+
+        this.netconfOperationServiceFactoryListener.onAddNetconfOperationServiceFactory(this);
+    }
+
+    @Override
+    public NetconfOperationService createService(final String netconfSessionIdForReporting) {
+        return operationService;
+    }
+
+    @Override
+    public Set<Capability> getCapabilities() {
+        // TODO
+        // No capabilities exposed to prevent clashes with schemas from mdsal-netconf-connector (it exposes all the schemas)
+        // If the schemas exposed by mdsal-netconf-connector are filtered, this class would expose monitoring related models
+        return CAPABILITIES;
+    }
+
+    @Override
+    public AutoCloseable registerCapabilityListener(final CapabilityListener listener) {
+        return NoopAutoCloseable.INSTANCE;
+    }
+
+    /**
+     * Invoke using blueprint
+     */
+    @Override
+    public void close() {
+        monitoringToMdsalWriter.close();
+        netconfOperationServiceFactoryListener.onRemoveNetconfOperationServiceFactory(this);
+    }
+
+}
\ No newline at end of file
index 7c434f2813eae2916abd909a6f4d7882c440a6a8..3e487b4db6045c248891122be3a8336c6fe826f9 100644 (file)
@@ -17,8 +17,6 @@ import javax.annotation.Nullable;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
-import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
 import org.opendaylight.netconf.api.monitoring.NetconfMonitoringService;
 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;
@@ -32,8 +30,8 @@ import org.slf4j.LoggerFactory;
 /**
  * Writes netconf server state changes received from NetconfMonitoringService to netconf-state datastore subtree.
  */
-final class MonitoringToMdsalWriter implements AutoCloseable, NetconfMonitoringService.CapabilitiesListener,
-        NetconfMonitoringService.SessionsListener, BindingAwareProvider {
+public final class MonitoringToMdsalWriter implements AutoCloseable, NetconfMonitoringService.CapabilitiesListener,
+        NetconfMonitoringService.SessionsListener {
 
     private static final Logger LOG = LoggerFactory.getLogger(MonitoringToMdsalWriter.class);
 
@@ -45,12 +43,17 @@ final class MonitoringToMdsalWriter implements AutoCloseable, NetconfMonitoringS
             InstanceIdentifier.create(NetconfState.class).child(Sessions.class);
 
     private final NetconfMonitoringService serverMonitoringDependency;
-    private DataBroker dataBroker;
+    private final DataBroker dataBroker;
 
-    public MonitoringToMdsalWriter(final NetconfMonitoringService serverMonitoringDependency) {
+    public MonitoringToMdsalWriter(final NetconfMonitoringService serverMonitoringDependency,
+                                   final DataBroker dataBroker) {
         this.serverMonitoringDependency = serverMonitoringDependency;
+        this.dataBroker = dataBroker;
     }
 
+    /**
+     * Invoke using blueprint
+     */
     @Override
     public void close() {
         runTransaction((tx) -> tx.delete(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.create(NetconfState.class)));
@@ -85,9 +88,10 @@ final class MonitoringToMdsalWriter implements AutoCloseable, NetconfMonitoringS
         runTransaction((tx) -> tx.put(LogicalDatastoreType.OPERATIONAL, SCHEMAS_INSTANCE_IDENTIFIER, schemas));
     }
 
-    @Override
-    public void onSessionInitiated(final BindingAwareBroker.ProviderContext providerContext) {
-        dataBroker = providerContext.getSALService(DataBroker.class);
+    /**
+     * Invoke using blueprint
+     */
+    public void start() {
         serverMonitoringDependency.registerCapabilitiesListener(this);
         serverMonitoringDependency.registerSessionsListener(this);
     }
diff --git a/netconf/mdsal-netconf-monitoring/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/monitoring/NetconfMdsalMonitoringMapperModule.java b/netconf/mdsal-netconf-monitoring/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/monitoring/NetconfMdsalMonitoringMapperModule.java
deleted file mode 100644 (file)
index d335a28..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.controller.config.yang.netconf.mdsal.monitoring;
-
-import java.util.Collections;
-import java.util.Set;
-import org.opendaylight.controller.config.util.capability.Capability;
-import org.opendaylight.netconf.api.monitoring.CapabilityListener;
-import org.opendaylight.netconf.api.monitoring.NetconfMonitoringService;
-import org.opendaylight.netconf.mapping.api.NetconfOperation;
-import org.opendaylight.netconf.mapping.api.NetconfOperationService;
-import org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactory;
-import org.opendaylight.netconf.monitoring.GetSchema;
-
-public class NetconfMdsalMonitoringMapperModule extends org.opendaylight.controller.config.yang.netconf.mdsal.monitoring.AbstractNetconfMdsalMonitoringMapperModule {
-    public NetconfMdsalMonitoringMapperModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
-        super(identifier, dependencyResolver);
-    }
-
-    public NetconfMdsalMonitoringMapperModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, final org.opendaylight.controller.config.yang.netconf.mdsal.monitoring.NetconfMdsalMonitoringMapperModule oldModule, final java.lang.AutoCloseable oldInstance) {
-        super(identifier, dependencyResolver, oldModule, oldInstance);
-    }
-
-    @Override
-    public void customValidation() {
-        // add custom validation form module attributes here.
-    }
-
-    @Override
-    public java.lang.AutoCloseable createInstance() {
-        final NetconfMonitoringService serverMonitoringDependency = getServerMonitoringDependency();
-
-        final MonitoringToMdsalWriter monitoringToMdsalWriter = new MonitoringToMdsalWriter(serverMonitoringDependency);
-        getBindingAwareBrokerDependency().registerProvider(monitoringToMdsalWriter);
-
-        final MdSalMonitoringMapperFactory mdSalMonitoringMapperFactory = new MdSalMonitoringMapperFactory(new MdsalMonitoringMapper(serverMonitoringDependency),
-                this, monitoringToMdsalWriter);
-
-        getAggregatorDependency().onAddNetconfOperationServiceFactory(mdSalMonitoringMapperFactory);
-        return mdSalMonitoringMapperFactory;
-
-    }
-
-    private static class MdSalMonitoringMapperFactory implements NetconfOperationServiceFactory, AutoCloseable {
-
-        private final NetconfOperationService operationService;
-        private final NetconfMdsalMonitoringMapperModule module;
-        private final MonitoringToMdsalWriter monitoringToMdsalWriter;
-
-        private static final Set<Capability> CAPABILITIES = Collections.emptySet();
-        private static final AutoCloseable AUTO_CLOSEABLE = new AutoCloseable() {
-            @Override
-            public void close() throws Exception {
-                // NOOP
-            }
-        };
-
-        public MdSalMonitoringMapperFactory(
-                final NetconfOperationService operationService,
-                final NetconfMdsalMonitoringMapperModule module,
-                final MonitoringToMdsalWriter monitoringToMdsalWriter
-        ) {
-            this.operationService = operationService;
-            this.module = module;
-            this.monitoringToMdsalWriter = monitoringToMdsalWriter;
-        }
-
-        @Override
-        public NetconfOperationService createService(final String netconfSessionIdForReporting) {
-            return operationService;
-        }
-
-        @Override
-        public Set<Capability> getCapabilities() {
-            // TODO
-            // No capabilities exposed to prevent clashes with schemas from mdsal-netconf-connector (it exposes all the schemas)
-            // If the schemas exposed by mdsal-netconf-connector are filtered, this class would expose monitoring related models
-            return CAPABILITIES;
-        }
-
-        @Override
-        public AutoCloseable registerCapabilityListener(final CapabilityListener listener) {
-            return AUTO_CLOSEABLE;
-        }
-
-        @Override
-        public void close() {
-            monitoringToMdsalWriter.close();
-            module.getAggregatorDependency().onRemoveNetconfOperationServiceFactory(this);
-        }
-
-    }
-
-
-    private static class MdsalMonitoringMapper implements NetconfOperationService {
-
-        private final NetconfMonitoringService serverMonitoringDependency;
-
-        public MdsalMonitoringMapper(final NetconfMonitoringService serverMonitoringDependency) {
-            this.serverMonitoringDependency = serverMonitoringDependency;
-        }
-
-        @Override
-        public Set<NetconfOperation> getNetconfOperations() {
-            return Collections.<NetconfOperation>singleton(new GetSchema(serverMonitoringDependency));
-        }
-
-        @Override
-        public void close() {
-            // NOOP
-        }
-    }
-}
diff --git a/netconf/mdsal-netconf-monitoring/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/monitoring/NetconfMdsalMonitoringMapperModuleFactory.java b/netconf/mdsal-netconf-monitoring/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/monitoring/NetconfMdsalMonitoringMapperModuleFactory.java
deleted file mode 100644 (file)
index 026b415..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-/*
-* Generated file
-*
-* Generated from: yang module name: netconf-mdsal-monitoring yang module local name: netconf-mdsal-monitoring-mapper
-* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
-* Generated at: Wed Feb 18 10:22:17 CET 2015
-*
-* Do not modify this file unless it is present under src/main directory
-*/
-package org.opendaylight.controller.config.yang.netconf.mdsal.monitoring;
-public class NetconfMdsalMonitoringMapperModuleFactory extends org.opendaylight.controller.config.yang.netconf.mdsal.monitoring.AbstractNetconfMdsalMonitoringMapperModuleFactory {
-
-}
diff --git a/netconf/mdsal-netconf-monitoring/src/main/resources/org/opendaylight/blueprint/mdsal-netconf-monitoring.xml b/netconf/mdsal-netconf-monitoring/src/main/resources/org/opendaylight/blueprint/mdsal-netconf-monitoring.xml
new file mode 100644 (file)
index 0000000..13b2633
--- /dev/null
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2016 Inocybe Technologies Inc. and others.  All rights reserved.
+
+ This program and the accompanying materials are made available under the
+ terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+           odl:use-default-for-reference-types="true">
+
+    <reference id="dataBroker"
+               interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"
+               odl:type="default"/>
+    <reference id="netconfMonitoringService"
+               interface="org.opendaylight.netconf.api.monitoring.NetconfMonitoringService"
+               odl:type="netconf-server-monitoring"/>
+    <reference id="netconfOperationServiceFactoryListener"
+               interface="org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactoryListener"
+               odl:type="mapper-aggregator-registry"/>
+
+    <bean id="monitoringToMdsalWriter"
+          class="org.opendaylight.controller.config.yang.netconf.mdsal.monitoring.MonitoringToMdsalWriter"
+          init-method="start"
+          destroy-method="close">
+        <argument ref="netconfMonitoringService"/>
+        <argument ref="dataBroker"/>
+    </bean>
+
+    <bean id="mdsalMonitoringMapperFactory"
+          class="org.opendaylight.controller.config.yang.netconf.mdsal.monitoring.MdSalMonitoringMapperFactory"
+          destroy-method="close">
+        <argument ref="netconfOperationServiceFactoryListener"/>
+        <argument ref="netconfMonitoringService"/>
+        <argument ref="monitoringToMdsalWriter"/>
+    </bean>
+
+</blueprint>
diff --git a/netconf/mdsal-netconf-monitoring/src/main/yang/netconf-mdsal-monitoring.yang b/netconf/mdsal-netconf-monitoring/src/main/yang/netconf-mdsal-monitoring.yang
deleted file mode 100644 (file)
index 68a248e..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-module netconf-mdsal-monitoring {
-    yang-version 1;
-    namespace "urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:monitoring";
-    prefix "nmmonitor";
-
-    import netconf-northbound-mapper { prefix nnm; revision-date 2015-01-14; }
-    import opendaylight-md-sal-binding {prefix md-sal-binding; revision-date 2013-10-28;}
-    import netconf-northbound { prefix nn; revision-date 2015-01-14; }
-    import config { prefix config; revision-date 2013-04-05; }
-
-    organization "Cisco Systems, Inc.";
-
-    description
-        "This module contains the base YANG definitions for
-         an MD-SAL monitoring mapper implementation";
-
-    revision "2015-02-18" {
-        description
-            "Initial revision.";
-    }
-
-    identity netconf-mdsal-monitoring-mapper {
-        base config:module-type;
-        config:provided-service nnm:netconf-northbound-mapper;
-    }
-
-    augment "/config:modules/config:module/config:configuration" {
-        case netconf-mdsal-monitoring-mapper {
-            when "/config:modules/config:module/config:type = 'netconf-mdsal-monitoring-mapper'";
-
-            container server-monitoring {
-                uses config:service-ref {
-                    refine type {
-                        mandatory true;
-                        config:required-identity nn:netconf-server-monitoring;
-                    }
-                }
-            }
-
-            container aggregator {
-                uses config:service-ref {
-                    refine type {
-                        mandatory true;
-                        config:required-identity nnm:netconf-mapper-registry;
-                    }
-                }
-            }
-
-            container binding-aware-broker {
-                uses config:service-ref {
-                    refine type {
-                        mandatory true;
-                        config:required-identity md-sal-binding:binding-broker-osgi-registry;
-                    }
-                }
-            }
-        }
-    }
-
-}
index ce52b2508e9e1b68357d630e1010ee714989e857..62551b4896f4e92a0f15086eb1c1d3665a9e2a86 100644 (file)
@@ -27,7 +27,6 @@ import org.mockito.MockitoAnnotations;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
 import org.opendaylight.netconf.api.monitoring.NetconfMonitoringService;
 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;
@@ -46,8 +45,6 @@ public class MonitoringToMdsalWriterTest {
     @Mock
     private NetconfMonitoringService monitoring;
     @Mock
-    private BindingAwareBroker.ProviderContext context;
-    @Mock
     private DataBroker dataBroker;
     @Mock
     private WriteTransaction writeTransaction;
@@ -61,20 +58,18 @@ public class MonitoringToMdsalWriterTest {
         doReturn(null).when(monitoring).registerCapabilitiesListener(any());
         doReturn(null).when(monitoring).registerSessionsListener(any());
 
-        doReturn(dataBroker).when(context).getSALService(DataBroker.class);
-
         doReturn(writeTransaction).when(dataBroker).newWriteOnlyTransaction();
 
         doNothing().when(writeTransaction).put(eq(LogicalDatastoreType.OPERATIONAL), any(), any());
         doNothing().when(writeTransaction).delete(eq(LogicalDatastoreType.OPERATIONAL), any());
         doReturn(Futures.immediateCheckedFuture(null)).when(writeTransaction).submit();
 
-        writer = new MonitoringToMdsalWriter(monitoring);
+        writer = new MonitoringToMdsalWriter(monitoring, dataBroker);
     }
 
     @Test
     public void testClose() throws Exception {
-        writer.onSessionInitiated(context);
+        writer.start();
         writer.close();
         InOrder inOrder = inOrder(writeTransaction);
         inOrder.verify(writeTransaction).delete(LogicalDatastoreType.OPERATIONAL, INSTANCE_IDENTIFIER);
@@ -84,7 +79,7 @@ public class MonitoringToMdsalWriterTest {
     @Test
     public void testOnCapabilityChanged() throws Exception {
         final InstanceIdentifier<Capabilities> capabilitiesId = InstanceIdentifier.create(NetconfState.class).child(Capabilities.class);
-        writer.onSessionInitiated(context);
+        writer.start();
         final Capabilities capabilities = new CapabilitiesBuilder().build();
         writer.onCapabilitiesChanged(capabilities);
         InOrder inOrder = inOrder(writeTransaction);
@@ -95,7 +90,7 @@ public class MonitoringToMdsalWriterTest {
     @Test
     public void testOnSchemasChanged() throws Exception {
         final InstanceIdentifier<Schemas> schemasId = InstanceIdentifier.create(NetconfState.class).child(Schemas.class);
-        writer.onSessionInitiated(context);
+        writer.start();
         final Schemas schemas = new SchemasBuilder().build();
         writer.onSchemasChanged(schemas);
         InOrder inOrder = inOrder(writeTransaction);
@@ -109,7 +104,7 @@ public class MonitoringToMdsalWriterTest {
                 .setSessionId(1L)
                 .build();
         final InstanceIdentifier<Session> id = InstanceIdentifier.create(NetconfState.class).child(Sessions.class).child(Session.class, session.getKey());
-        writer.onSessionInitiated(context);
+        writer.start();
         writer.onSessionStarted(session);
         InOrder inOrder = inOrder(writeTransaction);
         inOrder.verify(writeTransaction).put(LogicalDatastoreType.OPERATIONAL, id, session);
@@ -122,7 +117,7 @@ public class MonitoringToMdsalWriterTest {
                 .setSessionId(1L)
                 .build();
         final InstanceIdentifier<Session> id = InstanceIdentifier.create(NetconfState.class).child(Sessions.class).child(Session.class, session.getKey());
-        writer.onSessionInitiated(context);
+        writer.start();
         writer.onSessionEnded(session);
         InOrder inOrder = inOrder(writeTransaction);
         inOrder.verify(writeTransaction).delete(LogicalDatastoreType.OPERATIONAL, id);
@@ -142,7 +137,7 @@ public class MonitoringToMdsalWriterTest {
         sessions.add(session2);
         final InstanceIdentifier<Session> id1 = InstanceIdentifier.create(NetconfState.class).child(Sessions.class).child(Session.class, session1.getKey());
         final InstanceIdentifier<Session> id2 = InstanceIdentifier.create(NetconfState.class).child(Sessions.class).child(Session.class, session2.getKey());
-        writer.onSessionInitiated(context);
+        writer.start();
         writer.onSessionsUpdated(sessions);
         InOrder inOrder = inOrder(writeTransaction);
         inOrder.verify(writeTransaction).put(LogicalDatastoreType.OPERATIONAL, id1, session1);
@@ -152,7 +147,7 @@ public class MonitoringToMdsalWriterTest {
 
     @Test
     public void testOnSessionInitiated() throws Exception {
-        writer.onSessionInitiated(context);
+        writer.start();
         verify(monitoring).registerCapabilitiesListener(writer);
     }
 }
\ No newline at end of file
index d229c316a3cf6fa0467483a678ebaef14e8ea2ea..40b561c2a3901c727dec27a2a356ddb332755e7a 100644 (file)
             <artifactId>mockito-configuration</artifactId>
         </dependency>
     </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
+                        <Embed-Dependency>netconf-notifications-impl</Embed-Dependency>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
 </project>
index 2fd48091e9d1934214f47c88062ff879afb050e3..35f5c805aecbfdf39cfdafb19db7751989439b13 100644 (file)
@@ -15,15 +15,18 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.Set;
 import javax.annotation.Nonnull;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.DataObjectModification;
 import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
 import org.opendaylight.netconf.notifications.BaseNotificationPublisherRegistration;
+import org.opendaylight.netconf.notifications.NetconfNotificationCollector;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri;
 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.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.NetconfCapabilityChangeBuilder;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.changed.by.parms.ChangedByBuilder;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.changed.by.parms.changed.by.server.or.user.ServerBuilder;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
 
@@ -31,15 +34,19 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
  * Listens on capabilities changes in data store and publishes them to base
  * netconf notification stream listener.
  */
-final class CapabilityChangeNotificationProducer extends OperationalDatastoreListener<Capabilities> {
+public final class CapabilityChangeNotificationProducer extends OperationalDatastoreListener<Capabilities> {
 
     private static final InstanceIdentifier<Capabilities> CAPABILITIES_INSTANCE_IDENTIFIER =
             InstanceIdentifier.create(NetconfState.class).child(Capabilities.class);
+
     private final BaseNotificationPublisherRegistration baseNotificationPublisherRegistration;
+    private final ListenerRegistration capabilityChangeListenerRegistration;
 
-    public CapabilityChangeNotificationProducer(BaseNotificationPublisherRegistration baseNotificationPublisherRegistration) {
+    public CapabilityChangeNotificationProducer(final NetconfNotificationCollector netconfNotificationCollector,
+                                                final DataBroker dataBroker) {
         super(CAPABILITIES_INSTANCE_IDENTIFIER);
-        this.baseNotificationPublisherRegistration = baseNotificationPublisherRegistration;
+        this.baseNotificationPublisherRegistration = netconfNotificationCollector.registerBaseNotificationPublisher();
+        this.capabilityChangeListenerRegistration = registerOnChanges(dataBroker);
     }
 
     @Override
@@ -80,4 +87,16 @@ final class CapabilityChangeNotificationProducer extends OperationalDatastoreLis
         netconfCapabilityChangeBuilder.setModifiedCapability(Collections.<Uri>emptyList());
         baseNotificationPublisherRegistration.onCapabilityChanged(netconfCapabilityChangeBuilder.build());
     }
+
+    /**
+     * Invoke by blueprint
+     */
+    public void close() {
+        if (baseNotificationPublisherRegistration != null) {
+            baseNotificationPublisherRegistration.close();
+        }
+        if (capabilityChangeListenerRegistration != null) {
+            capabilityChangeListenerRegistration.close();
+        }
+    }
 }
diff --git a/netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/NetconfMdsalNotificationMapperModule.java b/netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/NetconfMdsalNotificationMapperModule.java
deleted file mode 100644 (file)
index 685e80f..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.controller.config.yang.netconf.mdsal.notification;
-
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.netconf.mdsal.notification.NetconfNotificationOperationServiceFactory;
-import org.opendaylight.netconf.notifications.NetconfNotificationCollector;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
-
-public class NetconfMdsalNotificationMapperModule extends org.opendaylight.controller.config.yang.netconf.mdsal.notification.AbstractNetconfMdsalNotificationMapperModule {
-    public NetconfMdsalNotificationMapperModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
-        super(identifier, dependencyResolver);
-    }
-
-    public NetconfMdsalNotificationMapperModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.controller.config.yang.netconf.mdsal.notification.NetconfMdsalNotificationMapperModule oldModule, java.lang.AutoCloseable oldInstance) {
-        super(identifier, dependencyResolver, oldModule, oldInstance);
-    }
-
-    @Override
-    public void customValidation() {
-        // add custom validation form module attributes here.
-    }
-
-    @Override
-    public java.lang.AutoCloseable createInstance() {
-        final NetconfNotificationCollector notificationCollector = getNotificationCollectorDependency();
-
-        final NotificationToMdsalWriter notificationToMdsalWriter = new NotificationToMdsalWriter(notificationCollector);
-        getBindingAwareBrokerDependency().registerProvider(notificationToMdsalWriter);
-        final DataBroker dataBroker = getDataBrokerDependency();
-
-        final OperationalDatastoreListener capabilityNotificationProducer =
-                new CapabilityChangeNotificationProducer(notificationCollector.registerBaseNotificationPublisher());
-        final ListenerRegistration capabilityChangeListenerRegistration = capabilityNotificationProducer.registerOnChanges(dataBroker);
-
-        final OperationalDatastoreListener sessionNotificationProducer =
-                new SessionNotificationProducer(notificationCollector.registerBaseNotificationPublisher());
-        final ListenerRegistration sessionListenerRegistration = sessionNotificationProducer.registerOnChanges(dataBroker);
-
-        final NetconfNotificationOperationServiceFactory netconfNotificationOperationServiceFactory =
-            new NetconfNotificationOperationServiceFactory(getNotificationRegistryDependency()) {
-                @Override
-                public void close() {
-                    super.close();
-                    notificationToMdsalWriter.close();
-                    capabilityChangeListenerRegistration.close();
-                    sessionListenerRegistration.close();
-                    getAggregatorDependency().onRemoveNetconfOperationServiceFactory(this);
-                }
-            };
-
-        getAggregatorDependency().onAddNetconfOperationServiceFactory(netconfNotificationOperationServiceFactory);
-
-        return netconfNotificationOperationServiceFactory;
-    }
-}
diff --git a/netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/NetconfMdsalNotificationMapperModuleFactory.java b/netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/NetconfMdsalNotificationMapperModuleFactory.java
deleted file mode 100644 (file)
index c87382c..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-/*
-* Generated file
-*
-* Generated from: yang module name: netconf-mdsal-notification yang module local name: netconf-mdsal-notification-mapper
-* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
-* Generated at: Wed Aug 05 10:21:08 CEST 2015
-*
-* Do not modify this file unless it is present under src/main directory
-*/
-package org.opendaylight.controller.config.yang.netconf.mdsal.notification;
-
-public class NetconfMdsalNotificationMapperModuleFactory extends org.opendaylight.controller.config.yang.netconf.mdsal.notification.AbstractNetconfMdsalNotificationMapperModuleFactory {
-
-}
index 4a8c09ee24ee1ad9dd77a0e606598664dc0f099f..5ffe2c9ecddf383f51a37d44e4a141d5ceaac899 100644 (file)
@@ -15,8 +15,6 @@ import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
-import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
 import org.opendaylight.netconf.notifications.NetconfNotificationCollector;
 import org.opendaylight.netconf.notifications.NotificationRegistration;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.StreamNameType;
@@ -32,16 +30,18 @@ import org.slf4j.LoggerFactory;
  * Listens on changes in netconf notification stream availability and writes
  * changes to the data store.
  */
-final class NotificationToMdsalWriter implements AutoCloseable, NetconfNotificationCollector.NetconfNotificationStreamListener, BindingAwareProvider {
+public final class NotificationToMdsalWriter implements AutoCloseable, NetconfNotificationCollector.NetconfNotificationStreamListener {
 
     private static final Logger LOG = LoggerFactory.getLogger(NotificationToMdsalWriter.class);
 
     private final NetconfNotificationCollector netconfNotificationCollector;
+    private final DataBroker dataBroker;
     private NotificationRegistration notificationRegistration;
-    private DataBroker dataBroker;
 
-    public NotificationToMdsalWriter(NetconfNotificationCollector netconfNotificationCollector) {
+    public NotificationToMdsalWriter(final NetconfNotificationCollector netconfNotificationCollector,
+                                     final DataBroker dataBroker) {
         this.netconfNotificationCollector = netconfNotificationCollector;
+        this.dataBroker = dataBroker;
     }
 
     @Override
@@ -65,9 +65,10 @@ final class NotificationToMdsalWriter implements AutoCloseable, NetconfNotificat
         notificationRegistration.close();
     }
 
-    @Override
-    public void onSessionInitiated(BindingAwareBroker.ProviderContext session) {
-        dataBroker = session.getSALService(DataBroker.class);
+    /**
+     * Invoke by blueprint
+     */
+    public void start() {
         notificationRegistration = netconfNotificationCollector.registerStreamListener(this);
     }
 
index 54f67d39789233959e2b481723788bd2dc9699d3..f8d1b0edb6e7bb82f33f806daa419c1315fbe5f2 100644 (file)
@@ -10,9 +10,11 @@ package org.opendaylight.controller.config.yang.netconf.mdsal.notification;
 import com.google.common.base.Preconditions;
 import java.util.Collection;
 import javax.annotation.Nonnull;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.DataObjectModification;
 import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
 import org.opendaylight.netconf.notifications.BaseNotificationPublisherRegistration;
+import org.opendaylight.netconf.notifications.NetconfNotificationCollector;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.base._1._0.rev110601.SessionIdOrZeroType;
 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.Sessions;
@@ -21,6 +23,7 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.not
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.NetconfSessionEndBuilder;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.NetconfSessionStart;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.NetconfSessionStartBuilder;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
@@ -31,11 +34,16 @@ public class SessionNotificationProducer extends OperationalDatastoreListener<Se
 
     private static final InstanceIdentifier<Session> SESSION_INSTANCE_IDENTIFIER =
             InstanceIdentifier.create(NetconfState.class).child(Sessions.class).child(Session.class);
+
     private final BaseNotificationPublisherRegistration baseNotificationPublisherRegistration;
+    private final ListenerRegistration sessionListenerRegistration;
 
-    public SessionNotificationProducer(BaseNotificationPublisherRegistration baseNotificationPublisherRegistration) {
+    public SessionNotificationProducer(final NetconfNotificationCollector netconfNotificationCollector,
+                                       final DataBroker dataBroker) {
         super(SESSION_INSTANCE_IDENTIFIER);
-        this.baseNotificationPublisherRegistration = baseNotificationPublisherRegistration;
+
+        this.baseNotificationPublisherRegistration = netconfNotificationCollector.registerBaseNotificationPublisher();
+        this.sessionListenerRegistration = registerOnChanges(dataBroker);
     }
 
     @Override
@@ -82,4 +90,16 @@ public class SessionNotificationProducer extends OperationalDatastoreListener<Se
         baseNotificationPublisherRegistration.onSessionEnded(sessionEnd);
     }
 
+
+    /**
+     * Invoke by blueprint
+     */
+    public void close() {
+        if (baseNotificationPublisherRegistration != null) {
+            baseNotificationPublisherRegistration.close();
+        }
+        if (sessionListenerRegistration != null) {
+            sessionListenerRegistration.close();
+        }
+    }
 }
index 7c82d640d73f51fe66a7db4014c8202daacbe9f7..41ae98e1a2822505f79cc314a11964784bcfa53d 100644 (file)
@@ -11,24 +11,24 @@ package org.opendaylight.netconf.mdsal.notification;
 import java.util.Collections;
 import java.util.Set;
 import org.opendaylight.controller.config.util.capability.Capability;
+import org.opendaylight.controller.sal.common.util.NoopAutoCloseable;
 import org.opendaylight.netconf.api.monitoring.CapabilityListener;
 import org.opendaylight.netconf.mapping.api.NetconfOperationService;
 import org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactory;
+import org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactoryListener;
 import org.opendaylight.netconf.notifications.NetconfNotificationRegistry;
 
 public class NetconfNotificationOperationServiceFactory implements NetconfOperationServiceFactory, AutoCloseable {
 
     private final NetconfNotificationRegistry netconfNotificationRegistry;
+    private final NetconfOperationServiceFactoryListener netconfOperationServiceFactoryListener;
 
-    private static final AutoCloseable AUTO_CLOSEABLE = new AutoCloseable() {
-        @Override
-        public void close() throws Exception {
-            // NOOP
-        }
-    };
-
-    public NetconfNotificationOperationServiceFactory(NetconfNotificationRegistry netconfNotificationRegistry) {
+    public NetconfNotificationOperationServiceFactory(final NetconfNotificationRegistry netconfNotificationRegistry,
+                                                      final NetconfOperationServiceFactoryListener netconfOperationServiceFactoryListener) {
         this.netconfNotificationRegistry = netconfNotificationRegistry;
+        this.netconfOperationServiceFactoryListener = netconfOperationServiceFactoryListener;
+
+        this.netconfOperationServiceFactoryListener.onAddNetconfOperationServiceFactory(this);
     }
 
     @Override
@@ -46,10 +46,11 @@ public class NetconfNotificationOperationServiceFactory implements NetconfOperat
 
     @Override
     public AutoCloseable registerCapabilityListener(final CapabilityListener listener) {
-        return AUTO_CLOSEABLE;
+        return NoopAutoCloseable.INSTANCE;
     }
 
     @Override
     public void close() {
+        this.netconfOperationServiceFactoryListener.onRemoveNetconfOperationServiceFactory(this);
     }
 }
diff --git a/netconf/mdsal-netconf-notification/src/main/resources/org/opendaylight/blueprint/mdsal-netconf-notification.xml b/netconf/mdsal-netconf-notification/src/main/resources/org/opendaylight/blueprint/mdsal-netconf-notification.xml
new file mode 100755 (executable)
index 0000000..5550de8
--- /dev/null
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2016 Inocybe Technologies Inc. and others.  All rights reserved.
+
+ This program and the accompanying materials are made available under the
+ terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+           odl:restart-dependents-on-updates="true">
+
+    <reference id="dataBroker"
+               interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"
+               odl:type="default"/>
+    <reference id="netconfOperationServiceFactoryListener"
+               interface="org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactoryListener"
+               odl:type="mapper-aggregator-registry"/>
+
+    <!--This is the MD-SAL netconf server notification blueprint xml file-->
+
+    <bean id="netconfNotificationManager"
+          class="org.opendaylight.netconf.notifications.impl.NetconfNotificationManager"
+          destroy-method="close">
+    </bean>
+    <service ref="netconfNotificationManager"
+             interface="org.opendaylight.netconf.notifications.NetconfNotificationRegistry"
+             odl:type="netconf-notification-manager">
+    </service>
+    <service ref="netconfNotificationManager"
+             interface="org.opendaylight.netconf.notifications.NetconfNotificationCollector"
+             odl:type="netconf-notification-manager">
+    </service>
+
+    <bean id="notificationToMdsalWriter"
+          class="org.opendaylight.controller.config.yang.netconf.mdsal.notification.NotificationToMdsalWriter"
+          init-method="start"
+          destroy-method="close">
+        <argument ref="netconfNotificationManager"/>
+        <argument ref="dataBroker"/>
+    </bean>
+
+    <bean id="capabilityChangeNotificationProducer"
+          class="org.opendaylight.controller.config.yang.netconf.mdsal.notification.CapabilityChangeNotificationProducer"
+          destroy-method="close">
+        <argument ref="netconfNotificationManager"/>
+        <argument ref="dataBroker"/>
+    </bean>
+
+    <bean id="sessionNotificationProducer"
+          class="org.opendaylight.controller.config.yang.netconf.mdsal.notification.SessionNotificationProducer"
+          destroy-method="close">
+        <argument ref="netconfNotificationManager"/>
+        <argument ref="dataBroker"/>
+    </bean>
+
+    <bean id="netconfNotificationOperationServiceFactory"
+          class="org.opendaylight.netconf.mdsal.notification.NetconfNotificationOperationServiceFactory"
+          destroy-method="close">
+        <argument ref="netconfNotificationManager"/>
+        <argument ref="netconfOperationServiceFactoryListener"/>
+    </bean>
+    <service ref="netconfNotificationOperationServiceFactory"
+             interface="org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactory"
+             odl:type="mdsal-netconf-notification"/>
+</blueprint>
diff --git a/netconf/mdsal-netconf-notification/src/main/yang/netconf-mdsal-notification.yang b/netconf/mdsal-netconf-notification/src/main/yang/netconf-mdsal-notification.yang
deleted file mode 100644 (file)
index db4e8be..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-module netconf-mdsal-notification {
-     yang-version 1;
-     namespace "urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:notification";
-     prefix "nnotification";
-
-     import netconf-northbound-mapper { prefix nnm; revision-date 2015-01-14; }
-     import opendaylight-md-sal-dom { prefix md-sal-dom; revision-date 2013-10-28; }
-     import opendaylight-md-sal-binding {prefix md-sal-binding; revision-date 2013-10-28;}
-     import netconf-northbound-notification {prefix nnn; revision-date 2015-08-06;}
-     import config { prefix config; revision-date 2013-04-05; }
-
-
-     organization "Cisco Systems, Inc.";
-
-     description
-         "This module contains the base YANG definitions for
-         an SAL notification mapper implementation";
-
-     revision "2015-08-03" {
-         description
-         "Initial revision.";
-     }
-
-     identity netconf-mdsal-notification-mapper {
-         base config:module-type;
-         config:provided-service nnm:netconf-northbound-mapper;
-     }
-
-     augment "/config:modules/config:module/config:configuration" {
-         case netconf-mdsal-notification-mapper {
-             when "/config:modules/config:module/config:type = 'netconf-mdsal-notification-mapper'";
-
-             container aggregator {
-                 uses config:service-ref {
-                     refine type {
-                         mandatory true;
-                         config:required-identity nnm:netconf-mapper-registry;
-                         }
-                 }
-             }
-
-             container binding-aware-broker {
-                 uses config:service-ref {
-                     refine type {
-                         mandatory true;
-                         config:required-identity md-sal-binding:binding-broker-osgi-registry;
-                     }
-                 }
-             }
-
-             container data-broker {
-                uses config:service-ref {
-                    refine type {
-                        mandatory true;
-                        config:required-identity md-sal-binding:binding-async-data-broker;
-                    }
-                }
-             }
-
-             container notification-collector {
-                uses config:service-ref {
-                    refine type {
-                        mandatory true;
-                        config:required-identity nnn:netconf-notification-collector;
-                    }
-                }
-             }
-
-            container notification-registry {
-                uses config:service-ref {
-                    refine type {
-                        mandatory true;
-                        config:required-identity nnn:netconf-notification-registry;
-                    }
-                }
-            }
-        }
-    }
-}
\ No newline at end of file
index e2156413bcd178af85de108ff27ff84682940d60..2f9ae073c1818403f890d72d7762b7f863f756af 100644 (file)
@@ -23,9 +23,13 @@ import org.junit.Before;
 import org.junit.Test;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.DataObjectModification;
+import org.opendaylight.controller.md.sal.binding.api.DataTreeChangeListener;
+import org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier;
 import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
 import org.opendaylight.netconf.notifications.BaseNotificationPublisherRegistration;
+import org.opendaylight.netconf.notifications.NetconfNotificationCollector;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri;
 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;
@@ -34,20 +38,35 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.not
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.NetconfCapabilityChangeBuilder;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.changed.by.parms.ChangedByBuilder;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.changed.by.parms.changed.by.server.or.user.ServerBuilder;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
 public class CapabilityChangeNotificationProducerTest {
 
+    private CapabilityChangeNotificationProducer capabilityChangeNotificationProducer;
+
     @Mock
     private BaseNotificationPublisherRegistration baseNotificationPublisherRegistration;
-    private CapabilityChangeNotificationProducer capabilityChangeNotificationProducer;
+    @Mock
+    private ListenerRegistration listenerRegistration;
+
+    @Mock
+    private NetconfNotificationCollector netconfNotificationCollector;
+    @Mock
+    private DataBroker dataBroker;
 
     @Before
     public void setUp() throws Exception {
         MockitoAnnotations.initMocks(this);
+
+        doReturn(listenerRegistration).when(dataBroker).registerDataTreeChangeListener(any(DataTreeIdentifier.class), any(DataTreeChangeListener.class));
+
         doNothing().when(baseNotificationPublisherRegistration).onCapabilityChanged(any(NetconfCapabilityChange.class));
-        capabilityChangeNotificationProducer = new CapabilityChangeNotificationProducer(baseNotificationPublisherRegistration);
+
+        doReturn(baseNotificationPublisherRegistration).when(netconfNotificationCollector).registerBaseNotificationPublisher();
+
+        capabilityChangeNotificationProducer = new CapabilityChangeNotificationProducer(netconfNotificationCollector, dataBroker);
     }
 
     @Test
index 6084d92cca0a62952a1b2b9bbc19e06668f015d4..316d56c0d1f18b22010928ba501caadaaf5b4581 100644 (file)
@@ -61,8 +61,8 @@ public class NotificationToMdsalWriterTest {
         doReturn(Futures.immediateCheckedFuture(null)).when(tx).submit();
         doReturn(tx).when(dataBroker).newWriteOnlyTransaction();
 
-        writer = new NotificationToMdsalWriter(notificationCollector);
-        writer.onSessionInitiated(session);
+        writer = new NotificationToMdsalWriter(notificationCollector, dataBroker);
+        writer.start();
     }
 
     @Test
index 8e29ea79717c26da638bf19b9b82305d68f5fba2..cedebb4eeaca0fd97f22d416449b46bf62d80853 100644 (file)
@@ -21,28 +21,49 @@ import org.junit.Test;
 import org.mockito.ArgumentCaptor;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.DataObjectModification;
+import org.opendaylight.controller.md.sal.binding.api.DataTreeChangeListener;
+import org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier;
 import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
 import org.opendaylight.netconf.notifications.BaseNotificationPublisherRegistration;
+import org.opendaylight.netconf.notifications.NetconfNotificationCollector;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Host;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.sessions.Session;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.sessions.SessionBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.NetconfCapabilityChange;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.NetconfSessionEnd;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.NetconfSessionStart;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.ZeroBasedCounter32;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
 
 public class SessionNotificationProducerTest {
 
     private SessionNotificationProducer publisher;
+
     @Mock
     private BaseNotificationPublisherRegistration registration;
+    @Mock
+    private ListenerRegistration listenerRegistration;
+
+    @Mock
+    private NetconfNotificationCollector netconfNotificationCollector;
+    @Mock
+    private DataBroker dataBroker;
 
     @Before
     public void setUp() throws Exception {
         MockitoAnnotations.initMocks(this);
-        publisher = new SessionNotificationProducer(registration);
+
+        doReturn(listenerRegistration).when(dataBroker).registerDataTreeChangeListener(any(DataTreeIdentifier.class), any(DataTreeChangeListener.class));
+
+        doNothing().when(registration).onCapabilityChanged(any(NetconfCapabilityChange.class));
         doNothing().when(registration).onSessionStarted(any());
         doNothing().when(registration).onSessionEnded(any());
+
+        doReturn(registration).when(netconfNotificationCollector).registerBaseNotificationPublisher();
+
+        publisher = new SessionNotificationProducer(netconfNotificationCollector, dataBroker);
     }
 
     @Test
diff --git a/netconf/mdsal-netconf-ssh/pom.xml b/netconf/mdsal-netconf-ssh/pom.xml
new file mode 100644 (file)
index 0000000..82c3292
--- /dev/null
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2016 Inocybe Technologies and others.  All rights reserved.
+
+ This program and the accompanying materials are made available under the
+ terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.opendaylight.controller</groupId>
+    <artifactId>config-parent</artifactId>
+    <version>0.6.0-SNAPSHOT</version>
+    <relativePath/>
+  </parent>
+
+  <groupId>org.opendaylight.netconf</groupId>
+  <artifactId>mdsal-netconf-ssh</artifactId>
+  <version>1.2.0-SNAPSHOT</version>
+  <name>${project.artifactId}</name>
+  <packaging>bundle</packaging>
+
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>org.opendaylight.netconf</groupId>
+        <artifactId>netconf-subsystem</artifactId>
+        <version>${project.version}</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+
+  <dependencies>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>netconf-ssh</artifactId>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
+            <Embed-Dependency>netconf-ssh</Embed-Dependency>
+          </instructions>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/netconf/mdsal-netconf-ssh/src/main/resources/org/opendaylight/blueprint/netconf-ssh.xml b/netconf/mdsal-netconf-ssh/src/main/resources/org/opendaylight/blueprint/netconf-ssh.xml
new file mode 100755 (executable)
index 0000000..9d5d3ed
--- /dev/null
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2016 Inocybe Technologies Inc. and others.  All rights reserved.
+
+ This program and the accompanying materials are made available under the
+ terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+           xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.3.0"
+           odl:restart-dependents-on-updates="true">
+
+    <reference id="netconfServerDispatcher" interface="org.opendaylight.netconf.api.NetconfServerDispatcher"/>
+    <reference id="globalWorkerGroup" interface="io.netty.channel.EventLoopGroup" odl:type="global-worker-group"/>
+    <reference id="executor" interface="io.netty.util.concurrent.EventExecutor" odl:type="global-event-executor"/>
+    <reference id="authProvider" interface="org.opendaylight.netconf.auth.AuthProvider" odl:type="netconf-auth-provider"/>
+
+    <!--    NETCONF server for MD-SAL (listening by default on port 2830)-->
+
+    <cm:property-placeholder persistent-id="org.opendaylight.netconf.ssh" update-strategy="none">
+        <cm:default-properties>
+            <cm:property name="bindingAddress" value="0.0.0.0"/>
+            <cm:property name="portNumber" value="2830"/>
+        </cm:default-properties>
+    </cm:property-placeholder>
+
+    <bean id="netconfMdsalServer"
+          class="org.opendaylight.netconf.ssh.NetconfNorthboundSshServer"
+          destroy-method="close">
+        <argument ref="netconfServerDispatcher"/>
+        <argument ref="globalWorkerGroup"/>
+        <argument ref="executor"/>
+        <argument value="${bindingAddress}"/>
+        <argument value="${portNumber}"/>
+        <argument ref="authProvider"/>
+    </bean>
+
+</blueprint>
diff --git a/netconf/mdsal-netconf-yang-library/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/yang/library/NetconfMdsalYanglibModule.java b/netconf/mdsal-netconf-yang-library/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/yang/library/NetconfMdsalYanglibModule.java
deleted file mode 100644 (file)
index 77492cb..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.controller.config.yang.netconf.mdsal.yang.library;
-
-import org.opendaylight.netconf.mdsal.yang.library.SchemaServiceToMdsalWriter;
-
-public class NetconfMdsalYanglibModule extends org.opendaylight.controller.config.yang.netconf.mdsal.yang.library.AbstractNetconfMdsalYanglibModule {
-    public NetconfMdsalYanglibModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
-        super(identifier, dependencyResolver);
-    }
-
-    public NetconfMdsalYanglibModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.controller.config.yang.netconf.mdsal.yang.library.NetconfMdsalYanglibModule oldModule, java.lang.AutoCloseable oldInstance) {
-        super(identifier, dependencyResolver, oldModule, oldInstance);
-    }
-
-    @Override
-    public void customValidation() {
-        // add custom validation form module attributes here.
-    }
-
-    @Override
-    public java.lang.AutoCloseable createInstance() {
-        // TODO Implement also yang-library-change notfication
-        final SchemaServiceToMdsalWriter schemaServiceToMdsalWriter =
-                new SchemaServiceToMdsalWriter(getRootSchemaServiceDependency());
-
-        getBindingAwareBrokerDependency().registerProvider(schemaServiceToMdsalWriter);
-
-        return schemaServiceToMdsalWriter;
-    }
-
-}
diff --git a/netconf/mdsal-netconf-yang-library/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/yang/library/NetconfMdsalYanglibModuleFactory.java b/netconf/mdsal-netconf-yang-library/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/yang/library/NetconfMdsalYanglibModuleFactory.java
deleted file mode 100644 (file)
index 739485b..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-/*
-* Generated file
-*
-* Generated from: yang module name: netconf-mdsal-yang-library yang module local name: netconf-mdsal-yanglib
-* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
-* Generated at: Sun Jun 19 15:28:13 CEST 2016
-*
-* Do not modify this file unless it is present under src/main directory
-*/
-package org.opendaylight.controller.config.yang.netconf.mdsal.yang.library;
-public class NetconfMdsalYanglibModuleFactory extends org.opendaylight.controller.config.yang.netconf.mdsal.yang.library.AbstractNetconfMdsalYanglibModuleFactory {
-
-}
index 44dbdc7cf2d06bc438ac4bb17318c66ec829b1ca..2360369e6af354a1a934dfde79f3867a927c0957 100644 (file)
@@ -44,7 +44,7 @@ import org.slf4j.LoggerFactory;
  * Listens for updates on global schema context, transforms context to ietf-yang-library:modules-state and
  * writes this state to operational data store
  */
-public class SchemaServiceToMdsalWriter implements SchemaContextListener, BindingAwareProvider, AutoCloseable {
+public class SchemaServiceToMdsalWriter implements SchemaContextListener, AutoCloseable {
 
     private static final Logger LOG = LoggerFactory.getLogger(SchemaServiceToMdsalWriter.class);
 
@@ -53,10 +53,12 @@ public class SchemaServiceToMdsalWriter implements SchemaContextListener, Bindin
 
     private final SchemaService schemaService;
     private final AtomicInteger moduleSetId;
-    private DataBroker dataBroker;
+    private final DataBroker dataBroker;
 
-    public SchemaServiceToMdsalWriter(final SchemaService schemaService) {
+    public SchemaServiceToMdsalWriter(final SchemaService schemaService,
+                                      final DataBroker dataBroker) {
         this.schemaService = schemaService;
+        this.dataBroker = dataBroker;
         this.moduleSetId = new AtomicInteger(0);
     }
 
@@ -65,9 +67,10 @@ public class SchemaServiceToMdsalWriter implements SchemaContextListener, Bindin
         // TODO Delete modules-state from operational data store
     }
 
-    @Override
-    public void onSessionInitiated(final BindingAwareBroker.ProviderContext providerContext) {
-        dataBroker = providerContext.getSALService(DataBroker.class);
+    /**
+     * Invoke by blueprint
+     */
+    public void start() {
         schemaService.registerSchemaContextListener(this);
     }
 
diff --git a/netconf/mdsal-netconf-yang-library/src/main/resources/org/opendaylight/blueprint/mdsal-netconf-yang-library.xml b/netconf/mdsal-netconf-yang-library/src/main/resources/org/opendaylight/blueprint/mdsal-netconf-yang-library.xml
new file mode 100755 (executable)
index 0000000..a4a2bf1
--- /dev/null
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2016 Inocybe Technologies Inc. and others.  All rights reserved.
+
+ This program and the accompanying materials are made available under the
+ terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+           odl:use-default-for-reference-types="true">
+
+    <reference id="dataBroker"
+               interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"
+               odl:type="default"/>
+    <reference id="schemaService"
+               interface="org.opendaylight.controller.sal.core.api.model.SchemaService" />
+
+    <bean id="schemaServiceToMdsalWriter"
+          class="org.opendaylight.netconf.mdsal.yang.library.SchemaServiceToMdsalWriter"
+          init-method="start"
+          destroy-method="close">
+        <argument ref="schemaService" />
+        <argument ref="dataBroker" />
+    </bean>
+
+</blueprint>
diff --git a/netconf/mdsal-netconf-yang-library/src/main/yang/netconf-mdsal-yang-library.yang b/netconf/mdsal-netconf-yang-library/src/main/yang/netconf-mdsal-yang-library.yang
deleted file mode 100644 (file)
index 407a76d..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-module netconf-mdsal-yang-library {
-    yang-version 1;
-    namespace "urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:yang:library";
-    prefix "nmyanglib";
-
-    import opendaylight-md-sal-dom { prefix md-sal-dom; revision-date 2013-10-28; }
-    import opendaylight-md-sal-binding {prefix md-sal-binding; revision-date 2013-10-28;}
-    import config { prefix config; revision-date 2013-04-05; }
-
-    organization "Cisco Systems, Inc.";
-
-    description
-        "This module contains the base YANG definitions for
-         MDSAL netconf yang module library implementation";
-
-    revision "2016-06-17" {
-        description
-            "Initial revision.";
-    }
-
-    identity netconf-mdsal-yanglib {
-        base config:module-type;
-    }
-
-    augment "/config:modules/config:module/config:configuration" {
-        case netconf-mdsal-yanglib {
-            when "/config:modules/config:module/config:type = 'netconf-mdsal-yanglib'";
-
-            container root-schema-service {
-                uses config:service-ref {
-                    refine type {
-                        mandatory false;
-                        config:required-identity md-sal-dom:schema-service;
-                    }
-                }
-            }
-
-            container binding-aware-broker {
-                uses config:service-ref {
-                    refine type {
-                        mandatory true;
-                        config:required-identity md-sal-binding:binding-broker-osgi-registry;
-                    }
-                }
-            }
-        }
-    }
-}
\ No newline at end of file
index 0e6e60907add2ef8d5c35595ed0fcc0c61afa73f..d531eb63caa4fa1e16bb7038047bde6099b14125 100644 (file)
@@ -81,12 +81,12 @@ public class SchemaServiceToMdsalWriterTest {
                 return null;
             }
         });
-        schemaServiceToMdsalWriter = new SchemaServiceToMdsalWriter(schemaService);
+        schemaServiceToMdsalWriter = new SchemaServiceToMdsalWriter(schemaService, dataBroker);
     }
 
     @Test
     public void testOnGlobalContextUpdated() {
-        schemaServiceToMdsalWriter.onSessionInitiated(context);
+        schemaServiceToMdsalWriter.start();
 
         schemaServiceToMdsalWriter.onGlobalContextUpdated(getSchema());
         verify(writeTransaction).put(eq(LogicalDatastoreType.OPERATIONAL), eq(MODULES_STATE_INSTANCE_IDENTIFIER), eq(createTestModuleState()));
index 658b2cab2774885709ea0565a1335561b9981a05..121a4d6fc8d916cd0fdc292f891197cd2c9e43c3 100644 (file)
@@ -17,11 +17,15 @@ module netconf-northbound {
     identity netconf-server-dispatcher {
         base "config:service-type";
         config:java-class "org.opendaylight.netconf.api.NetconfServerDispatcher";
+        config:disable-osgi-service-registration;
+        status deprecated;
     }
 
     identity netconf-server-monitoring {
         base "config:service-type";
         config:java-class "org.opendaylight.netconf.api.monitoring.NetconfMonitoringService";
+        config:disable-osgi-service-registration;
+        status deprecated;
     }
 
 }
\ No newline at end of file
index 7102db1cb25db4a9b25fc1c357d57b50a4153631..25383e24016fd30463ac854c6a6bec5ef6e3cae6 100644 (file)
                 <type>xml</type>
                 <classifier>config</classifier>
             </dependency>
-            <dependency>
-                <groupId>${project.groupId}</groupId>
-                <artifactId>netconf-mdsal-config</artifactId>
-                <version>${project.version}</version>
-            </dependency>
             <dependency>
                 <groupId>${project.groupId}</groupId>
                 <artifactId>mdsal-netconf-connector</artifactId>
                 <artifactId>mdsal-netconf-yang-library</artifactId>
                 <version>${project.version}</version>
             </dependency>
+            <dependency>
+                <groupId>org.opendaylight.netconf</groupId>
+                <artifactId>mdsal-netconf-impl</artifactId>
+                <version>${project.version}</version>
+            </dependency>
             <dependency>
                 <groupId>${project.groupId}</groupId>
                 <artifactId>netconf-netty-util</artifactId>
                 <classifier>config</classifier>
                 <type>cfg</type>
             </dependency>
-            <dependency>
-                <groupId>${project.groupId}</groupId>
-                <artifactId>netconf-mdsal-config</artifactId>
-                <version>${project.version}</version>
-                <classifier>config</classifier>
-                <type>xml</type>
-            </dependency>
             <dependency>
                 <groupId>${project.groupId}</groupId>
                 <artifactId>sal-netconf-connector</artifactId>
             </dependency>
             <dependency>
                 <groupId>${project.groupId}</groupId>
-                <artifactId>netconf-topology</artifactId>
+                <artifactId>mdsal-netconf-ssh</artifactId>
                 <version>${project.version}</version>
             </dependency>
             <dependency>
                 <groupId>${project.groupId}</groupId>
-                <artifactId>netconf-topology-config</artifactId>
+                <artifactId>netconf-topology</artifactId>
                 <version>${project.version}</version>
-                <classifier>config</classifier>
-                <type>xml</type>
             </dependency>
             <dependency>
                 <groupId>${project.groupId}</groupId>
-                <artifactId>yanglib-config</artifactId>
+                <artifactId>netconf-topology-config</artifactId>
                 <version>${project.version}</version>
                 <classifier>config</classifier>
                 <type>xml</type>
index 8f975ced2be7c491a09d42bbe45320ab1abf7a56..97213b5d466ebb229c6c5a8fffd7e9a45fb7bcf1 100644 (file)
@@ -17,6 +17,8 @@ module netconf-auth {
     identity netconf-auth-provider {
         base "config:service-type";
         config:java-class "org.opendaylight.netconf.auth.AuthProvider";
+        config:disable-osgi-service-registration;
+        status deprecated;
     }
 
 }
\ No newline at end of file
index 9cc3feb8494e30cb3f455119f320de279a87852c..7179c8de25aad4c4efd5afc2b3e15b2a9a7687ce 100644 (file)
@@ -24,7 +24,6 @@
         <capability>urn:ietf:params:xml:ns:yang:ietf-network-topology?module=ietf-network-topology&amp;revision=2015-06-08</capability>
         <capability>urn:ietf:params:xml:ns:yang:ietf-netconf-notifications?module=ietf-netconf-notifications&amp;revision=2012-02-06</capability>
         <capability>urn:TBD:params:xml:ns:yang:ospf-topology?module=ospf-topology&amp;revision=2013-10-21</capability>
-        <capability>config:aaa:authn:netconf:plugin?module=aaa-authn-netconf-plugin&amp;revision=2015-07-15</capability>
         <capability>urn:opendaylight:params:xml:ns:yang:controller:config:netconf:auth?module=netconf-auth&amp;revision=2015-07-15</capability>
         <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:core:spi:operational-dom-store?module=opendaylight-operational-dom-datastore&amp;revision=2014-06-17</capability>
         <capability>urn:ietf:params:xml:ns:yang:ospf-topology?module=ospf-topology&amp;revision=2013-07-12</capability>
diff --git a/netconf/netconf-impl/src/main/java/org/opendaylight/controller/config/yang/config/netconf/northbound/impl/NetconfMapperAggregatorModule.java b/netconf/netconf-impl/src/main/java/org/opendaylight/controller/config/yang/config/netconf/northbound/impl/NetconfMapperAggregatorModule.java
deleted file mode 100644 (file)
index 4b49941..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.controller.config.yang.config.netconf.northbound.impl;
-
-import org.opendaylight.netconf.impl.osgi.AggregatedNetconfOperationServiceFactory;
-
-public class NetconfMapperAggregatorModule extends org.opendaylight.controller.config.yang.config.netconf.northbound.impl.AbstractNetconfMapperAggregatorModule {
-    public NetconfMapperAggregatorModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
-        super(identifier, dependencyResolver);
-    }
-
-    public NetconfMapperAggregatorModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, final org.opendaylight.controller.config.yang.config.netconf.northbound.impl.NetconfMapperAggregatorModule oldModule, final java.lang.AutoCloseable oldInstance) {
-        super(identifier, dependencyResolver, oldModule, oldInstance);
-    }
-
-    @Override
-    public void customValidation() {}
-
-    @Override
-    public java.lang.AutoCloseable createInstance() {
-        return new AggregatedNetconfOperationServiceFactory();
-    }
-
-}
diff --git a/netconf/netconf-impl/src/main/java/org/opendaylight/controller/config/yang/config/netconf/northbound/impl/NetconfMapperAggregatorModuleFactory.java b/netconf/netconf-impl/src/main/java/org/opendaylight/controller/config/yang/config/netconf/northbound/impl/NetconfMapperAggregatorModuleFactory.java
deleted file mode 100644 (file)
index 8a8ffb7..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-/*
-* Generated file
-*
-* Generated from: yang module name: netconf-northbound-impl yang module local name: netconf-mapper-aggregator
-* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
-* Generated at: Tue Feb 17 17:24:19 CET 2015
-*
-* Do not modify this file unless it is present under src/main directory
-*/
-package org.opendaylight.controller.config.yang.config.netconf.northbound.impl;
-public class NetconfMapperAggregatorModuleFactory extends org.opendaylight.controller.config.yang.config.netconf.northbound.impl.AbstractNetconfMapperAggregatorModuleFactory {
-
-}
diff --git a/netconf/netconf-impl/src/main/java/org/opendaylight/controller/config/yang/config/netconf/northbound/impl/NetconfServerDispatcherModule.java b/netconf/netconf-impl/src/main/java/org/opendaylight/controller/config/yang/config/netconf/northbound/impl/NetconfServerDispatcherModule.java
deleted file mode 100644 (file)
index 6383b18..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.controller.config.yang.config.netconf.northbound.impl;
-
-import org.opendaylight.controller.config.api.JmxAttributeValidationException;
-import org.opendaylight.netconf.impl.NetconfServerSessionNegotiatorFactoryBuilder;
-import org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactory;
-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;
-
-public class NetconfServerDispatcherModule extends AbstractNetconfServerDispatcherModule {
-    public NetconfServerDispatcherModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
-        super(identifier, dependencyResolver);
-    }
-
-    public NetconfServerDispatcherModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, NetconfServerDispatcherModule oldModule, AutoCloseable oldInstance) {
-        super(identifier, dependencyResolver, oldModule, oldInstance);
-    }
-
-    @Override
-    public void customValidation() {
-        JmxAttributeValidationException.checkCondition(getConnectionTimeoutMillis() > 0, "Invalid connection timeout", connectionTimeoutMillisJmxAttribute);
-    }
-
-    @Override
-    public AutoCloseable createInstance() {
-
-        final AggregatedNetconfOperationServiceFactory aggregatedOpProvider = getAggregatedOpProvider();
-        final NetconfMonitoringService monitoringService = getServerMonitorDependency();
-
-        final NetconfServerSessionNegotiatorFactory serverNegotiatorFactory = new NetconfServerSessionNegotiatorFactoryBuilder()
-                .setAggregatedOpService(aggregatedOpProvider)
-                .setTimer(getTimerDependency())
-                .setIdProvider(new SessionIdProvider())
-                .setMonitoringService(monitoringService)
-                .setConnectionTimeoutMillis(getConnectionTimeoutMillis())
-                .build();
-        final NetconfServerDispatcherImpl.ServerChannelInitializer serverChannelInitializer = new NetconfServerDispatcherImpl.ServerChannelInitializer(
-                serverNegotiatorFactory);
-
-        return new NetconfServerDispatcherImpl(serverChannelInitializer, getBossThreadGroupDependency(), getWorkerThreadGroupDependency()) {
-
-            @Override
-            public void close() {
-                // NOOP, close should not be present here, the deprecated method closes injected evet loop groups
-            }
-        };
-
-    }
-
-    private AggregatedNetconfOperationServiceFactory getAggregatedOpProvider() {
-        final AggregatedNetconfOperationServiceFactory netconfOperationProvider = new AggregatedNetconfOperationServiceFactory();
-        for (final NetconfOperationServiceFactory netconfOperationServiceFactory : getMappersDependency()) {
-            netconfOperationProvider.onAddNetconfOperationServiceFactory(netconfOperationServiceFactory);
-        }
-        return netconfOperationProvider;
-    }
-
-
-}
diff --git a/netconf/netconf-impl/src/main/java/org/opendaylight/controller/config/yang/config/netconf/northbound/impl/NetconfServerDispatcherModuleFactory.java b/netconf/netconf-impl/src/main/java/org/opendaylight/controller/config/yang/config/netconf/northbound/impl/NetconfServerDispatcherModuleFactory.java
deleted file mode 100644 (file)
index 61c0c71..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-/*
-* Generated file
-*
-* Generated from: yang module name: netconf-northbound-impl yang module local name: netconf-server-dispatcher-impl
-* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
-* Generated at: Thu Feb 12 11:32:29 CET 2015
-*
-* Do not modify this file unless it is present under src/main directory
-*/
-package org.opendaylight.controller.config.yang.config.netconf.northbound.impl;
-public class NetconfServerDispatcherModuleFactory extends org.opendaylight.controller.config.yang.config.netconf.northbound.impl.AbstractNetconfServerDispatcherModuleFactory {
-
-}
diff --git a/netconf/netconf-impl/src/main/java/org/opendaylight/controller/config/yang/config/netconf/northbound/impl/NetconfServerMonitoringModule.java b/netconf/netconf-impl/src/main/java/org/opendaylight/controller/config/yang/config/netconf/northbound/impl/NetconfServerMonitoringModule.java
deleted file mode 100644 (file)
index 02521e8..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.controller.config.yang.config.netconf.northbound.impl;
-
-import com.google.common.base.Optional;
-import org.opendaylight.netconf.impl.osgi.NetconfMonitoringServiceImpl;
-
-public class NetconfServerMonitoringModule extends org.opendaylight.controller.config.yang.config.netconf.northbound.impl.AbstractNetconfServerMonitoringModule {
-    public NetconfServerMonitoringModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
-        super(identifier, dependencyResolver);
-    }
-
-    public NetconfServerMonitoringModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.controller.config.yang.config.netconf.northbound.impl.NetconfServerMonitoringModule oldModule, java.lang.AutoCloseable oldInstance) {
-        super(identifier, dependencyResolver, oldModule, oldInstance);
-    }
-
-    @Override
-    public void customValidation() {
-        // add custom validation form module attributes here.
-    }
-
-    @Override
-    public java.lang.AutoCloseable createInstance() {
-        return new NetconfMonitoringServiceImpl(getAggregatorDependency(),
-                Optional.fromNullable(getScheduledThreadpoolDependency()),
-                getMonitoringUpdateInterval());
-    }
-
-}
diff --git a/netconf/netconf-impl/src/main/java/org/opendaylight/controller/config/yang/config/netconf/northbound/impl/NetconfServerMonitoringModuleFactory.java b/netconf/netconf-impl/src/main/java/org/opendaylight/controller/config/yang/config/netconf/northbound/impl/NetconfServerMonitoringModuleFactory.java
deleted file mode 100644 (file)
index 8b4cb65..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-/*
-* Generated file
-*
-* Generated from: yang module name: netconf-northbound-impl yang module local name: netconf-server-monitoring-impl
-* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
-* Generated at: Tue Feb 17 17:24:19 CET 2015
-*
-* Do not modify this file unless it is present under src/main directory
-*/
-package org.opendaylight.controller.config.yang.config.netconf.northbound.impl;
-public class NetconfServerMonitoringModuleFactory extends org.opendaylight.controller.config.yang.config.netconf.northbound.impl.AbstractNetconfServerMonitoringModuleFactory {
-
-}
index bd26baa6190e8d3080072df10e66e6c339dbd367..44e2d4e8145e6a0124271da2af1635d6f94e20da 100644 (file)
@@ -52,7 +52,7 @@ public class NetconfServerSessionNegotiatorFactory implements SessionNegotiatorF
     private static final Logger LOG = LoggerFactory.getLogger(NetconfServerSessionNegotiatorFactory.class);
     private final Set<String> baseCapabilities;
 
-    protected NetconfServerSessionNegotiatorFactory(final Timer timer, final NetconfOperationServiceFactory netconfOperationProvider,
+    public NetconfServerSessionNegotiatorFactory(final Timer timer, final NetconfOperationServiceFactory netconfOperationProvider,
                                                  final SessionIdProvider idProvider, final long connectionTimeoutMillis,
                                                  final NetconfMonitoringService monitoringService, final Set<String> baseCapabilities) {
         this.timer = timer;
index d526678fde739cc4e3456ef63fa33f609570fc12..938aec869f9cee8ebf4a355dcf8fa03008c48f66 100644 (file)
@@ -13,8 +13,11 @@ import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.ImmutableSet.Builder;
 import com.google.common.collect.Maps;
 import com.google.common.collect.Multimap;
+import com.google.common.collect.Multimaps;
 import com.google.common.collect.Sets;
+import io.netty.util.internal.ConcurrentSet;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import org.opendaylight.controller.config.util.capability.Capability;
@@ -34,9 +37,16 @@ public class AggregatedNetconfOperationServiceFactory implements NetconfOperatio
 
     private static final Logger LOG = LoggerFactory.getLogger(AggregatedNetconfOperationServiceFactory.class);
 
-    private final Set<NetconfOperationServiceFactory> factories = new HashSet<>();
-    private final Multimap<NetconfOperationServiceFactory, AutoCloseable> registrations = HashMultimap.create();
-    private final Set<CapabilityListener> listeners = Sets.newHashSet();
+    private final Set<NetconfOperationServiceFactory> factories = new ConcurrentSet<>();
+    private final Multimap<NetconfOperationServiceFactory, AutoCloseable> registrations = Multimaps.synchronizedMultimap(HashMultimap.create());
+    private final Set<CapabilityListener> listeners = new ConcurrentSet<>();
+
+    public AggregatedNetconfOperationServiceFactory() {
+    }
+
+    public AggregatedNetconfOperationServiceFactory(final List<NetconfOperationServiceFactory> mappers) {
+        mappers.forEach(this::onAddNetconfOperationServiceFactory);
+    }
 
     @Override
     public synchronized void onAddNetconfOperationServiceFactory(NetconfOperationServiceFactory service) {
@@ -64,7 +74,7 @@ public class AggregatedNetconfOperationServiceFactory implements NetconfOperatio
     }
 
     @Override
-    public synchronized Set<Capability> getCapabilities() {
+    public Set<Capability> getCapabilities() {
         final HashSet<Capability> capabilities = Sets.newHashSet();
         for (final NetconfOperationServiceFactory factory : factories) {
             capabilities.addAll(factory.getCapabilities());
index 59d9a56276e4305aa09c6177abdeec943db0c650..edd3c36bde39ae97b33b5fa1daa8befb6ce97892 100644 (file)
@@ -16,14 +16,15 @@ import com.google.common.collect.ImmutableList.Builder;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.google.common.collect.Sets;
+import io.netty.util.internal.ConcurrentSet;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
 import org.opendaylight.controller.config.util.capability.BasicCapability;
 import org.opendaylight.controller.config.util.capability.Capability;
 import org.opendaylight.netconf.api.monitoring.CapabilityListener;
@@ -57,13 +58,13 @@ class NetconfCapabilityMonitoringService implements CapabilityListener, AutoClos
         }
     };
 
-    private final Set<NetconfManagementSession> sessions = new HashSet<>();
+    private final Set<NetconfManagementSession> sessions = new ConcurrentSet<>();
     private final NetconfOperationServiceFactory netconfOperationProvider;
-    private final Map<Uri, Capability> capabilities = new HashMap<>();
-    private final Map<String, Map<String, String>> mappedModulesToRevisionToSchema = Maps.newHashMap();
+    private final Map<Uri, Capability> capabilities = new ConcurrentHashMap<>();
+    private final Map<String, Map<String, String>> mappedModulesToRevisionToSchema = new ConcurrentHashMap<>();
 
 
-    private final Set<NetconfMonitoringService.CapabilitiesListener> listeners = Sets.newHashSet();
+    private final Set<NetconfMonitoringService.CapabilitiesListener> listeners = new ConcurrentSet<>();
     private volatile BaseNotificationPublisherRegistration notificationPublisher;
 
     NetconfCapabilityMonitoringService(final NetconfOperationServiceFactory netconfOperationProvider) {
index 9c8905afffc451e1b809c8f2d5ec7258d8812414..5c4c508f31b6d4e422af4b0954191f80ccd5622d 100644 (file)
@@ -26,6 +26,12 @@ public class NetconfMonitoringServiceImpl implements NetconfMonitoringService, A
         this(opProvider, Optional.absent(), 0);
     }
 
+    public NetconfMonitoringServiceImpl(NetconfOperationServiceFactory opProvider,
+                                        ScheduledThreadPool threadPool,
+                                        long updateInterval) {
+        this(opProvider, Optional.fromNullable(threadPool), updateInterval);
+    }
+
     public NetconfMonitoringServiceImpl(NetconfOperationServiceFactory opProvider,
                                         Optional<ScheduledThreadPool> threadPool,
                                         long updateInterval) {
diff --git a/netconf/netconf-impl/src/main/yang/netconf-northbound-impl.yang b/netconf/netconf-impl/src/main/yang/netconf-northbound-impl.yang
deleted file mode 100644 (file)
index aa6485a..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-// vi: set smarttab et sw=4 tabstop=4:
-module netconf-northbound-impl {
-
-    yang-version 1;
-    namespace "urn:opendaylight:params:xml:ns:yang:controller:config:netconf:northbound:impl";
-    prefix "cfg-net-s-i";
-
-    import config { prefix config; revision-date 2013-04-05; }
-    import netconf-northbound-mapper { prefix nnm; revision-date 2015-01-14; }
-    import netconf-northbound { prefix nn; revision-date 2015-01-14; }
-    import netty {prefix netty; }
-    import threadpool {prefix th;}
-
-    description
-        "This module contains the base YANG definitions for
-        netconf-server-dispatcher implementation.
-
-        Copyright (c)2013 Cisco Systems, Inc. All rights reserved.;
-
-        This program and the accompanying materials are made available
-        under the terms of the Eclipse Public License v1.0 which
-        accompanies this distribution, and is available at
-        http://www.eclipse.org/legal/epl-v10.html";
-
-    revision "2015-01-12" {
-        description
-            "Initial revision.";
-    }
-
-    identity netconf-server-dispatcher-impl {
-            base config:module-type;
-            config:provided-service nn:netconf-server-dispatcher;
-            config:java-name-prefix NetconfServerDispatcher;
-    }
-
-    augment "/config:modules/config:module/config:configuration" {
-        case netconf-server-dispatcher-impl {
-            when "/config:modules/config:module/config:type = 'netconf-server-dispatcher-impl'";
-
-            leaf connection-timeout-millis {
-                description "Specifies timeout in milliseconds after which connection must be established.";
-                type uint32;
-                default 20000;
-            }
-
-            container boss-thread-group {
-                uses config:service-ref {
-                    refine type {
-                        config:required-identity netty:netty-threadgroup;
-                    }
-                }
-            }
-
-            container worker-thread-group {
-                uses config:service-ref {
-                    refine type {
-                        config:required-identity netty:netty-threadgroup;
-                    }
-                }
-            }
-
-            list mappers {
-                uses config:service-ref {
-                    refine type {
-                        mandatory true;
-                        config:required-identity nnm:netconf-northbound-mapper;
-                    }
-                }
-            }
-
-            container server-monitor {
-                uses config:service-ref {
-                    refine type {
-                        mandatory true;
-                        config:required-identity nn:netconf-server-monitoring;
-                    }
-                }
-            }
-
-            container timer {
-                uses config:service-ref {
-                    refine type {
-                        config:required-identity netty:netty-timer;
-                    }
-                }
-            }
-        }
-    }
-
-
-    identity netconf-server-monitoring-impl {
-            base config:module-type;
-            config:provided-service nn:netconf-server-monitoring;
-            config:java-name-prefix NetconfServerMonitoring;
-    }
-
-    // TODO Monitoring could expose the monitoring data over JMX...
-
-    augment "/config:modules/config:module/config:configuration" {
-        case netconf-server-monitoring-impl {
-            when "/config:modules/config:module/config:type = 'netconf-server-monitoring-impl'";
-
-            container aggregator {
-                uses config:service-ref {
-                    refine type {
-                        config:required-identity nnm:netconf-northbound-mapper;
-                    }
-                }
-            }
-            container scheduled-threadpool {
-                uses config:service-ref {
-                    refine type {
-                        mandatory false;
-                        config:required-identity th:scheduled-threadpool;
-                    }
-                }
-                description "Dedicated to update netconf-state/sessions subtree on session change.";
-            }
-            leaf monitoring-update-interval {
-                description "Specifies interval in seconds after which session stats are updated. If zero, stats won't be updated.";
-                type uint32;
-                default 0;
-            }
-
-        }
-    }
-
-    identity netconf-mapper-aggregator {
-        base config:module-type;
-        config:provided-service nnm:netconf-northbound-mapper;
-        config:provided-service nnm:netconf-mapper-registry;
-        config:java-name-prefix NetconfMapperAggregator;
-        description "Aggregated operation provider for netconf servers. Joins all the operations and capabilities of all the mappers it aggregates and exposes them as a single service. The dependency orientation is reversed in order to prevent cyclic dependencies when monitoring service is considered";
-    }
-
-    augment "/config:modules/config:module/config:configuration" {
-        case netconf-mapper-aggregator {
-            when "/config:modules/config:module/config:type = 'netconf-mapper-aggregator'";
-
-        }
-    }
-
-}
\ No newline at end of file
index b4ec7eca3a7c6c494fe66891b1d3365f5f2eebcf..211f1f88b554dd3ceb905b32dc764a4747c0b921 100644 (file)
@@ -17,11 +17,15 @@ module netconf-northbound-mapper {
     identity netconf-northbound-mapper {
         base "config:service-type";
         config:java-class "org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactory";
+        config:disable-osgi-service-registration;
+        status deprecated;
     }
 
     identity netconf-mapper-registry {
         base "config:service-type";
         config:java-class "org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactoryListener";
+        config:disable-osgi-service-registration;
+        status deprecated;
     }
 
 }
\ No newline at end of file
diff --git a/netconf/netconf-mdsal-config/pom.xml b/netconf/netconf-mdsal-config/pom.xml
deleted file mode 100644 (file)
index 3a45520..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
-  ~
-  ~ This program and the accompanying materials are made available under the
-  ~ terms of the Eclipse Public License v1.0 which accompanies this distribution,
-  ~ and is available at http://www.eclipse.org/legal/epl-v10.html
-  -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
-  <modelVersion>4.0.0</modelVersion>
-  <parent>
-    <groupId>org.opendaylight.odlparent</groupId>
-    <artifactId>odlparent-lite</artifactId>
-    <version>1.8.0-SNAPSHOT</version>
-    <relativePath/>
-  </parent>
-
-  <groupId>org.opendaylight.netconf</groupId>
-  <artifactId>netconf-mdsal-config</artifactId>
-  <version>1.2.0-SNAPSHOT</version>
-  <description>Configuration files for netconf for mdsal</description>
-  <packaging>jar</packaging>
-
-  <build>
-    <plugins>
-        <plugin>
-        <groupId>org.codehaus.mojo</groupId>
-        <artifactId>build-helper-maven-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>attach-artifacts</id>
-            <goals>
-              <goal>attach-artifact</goal>
-            </goals>
-            <phase>package</phase>
-            <configuration>
-              <artifacts>
-                <artifact>
-                  <file>${project.build.directory}/classes/initial/08-netconf-mdsal.xml</file>
-                  <type>xml</type>
-                  <classifier>config</classifier>
-                </artifact>
-              </artifacts>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-</project>
diff --git a/netconf/netconf-mdsal-config/src/main/resources/initial/08-netconf-mdsal.xml b/netconf/netconf-mdsal-config/src/main/resources/initial/08-netconf-mdsal.xml
deleted file mode 100644 (file)
index 4826035..0000000
+++ /dev/null
@@ -1,253 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
-  ~
-  ~ This program and the accompanying materials are made available under the
-  ~ terms of the Eclipse Public License v1.0 which accompanies this distribution,
-  ~ and is available at http://www.eclipse.org/legal/epl-v10.html
-  -->
-
-<!-- vi: set et smarttab sw=4 tabstop=4: -->
-
-<snapshot>
-  <configuration>
-    <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
-      <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
-
-          <module>
-              <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:mapper">prefix:netconf-mdsal-mapper</type>
-              <name>netconf-mdsal-mapper</name>
-              <root-schema-service>
-                  <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:schema-service</type>
-                  <name>yang-schema-service</name>
-              </root-schema-service>
-              <root-schema-source-provider>
-                  <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:yang-text-source-provider</type>
-                  <name>yang-text-source-provider</name>
-              </root-schema-source-provider>
-              <dom-broker xmlns="urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:mapper">
-                  <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:dom-broker-osgi-registry</type>
-                  <name>dom-broker</name>
-              </dom-broker>
-              <mapper-aggregator xmlns="urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:mapper">
-                  <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:north:mapper">prefix:netconf-mapper-registry</type>
-                  <name>mapper-aggregator-registry</name>
-              </mapper-aggregator>
-          </module>
-
-          <module>
-              <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:netconf:northbound:impl">prefix:netconf-server-dispatcher-impl</type>
-              <name>netconf-mdsal-server-dispatcher</name>
-              <mappers xmlns="urn:opendaylight:params:xml:ns:yang:controller:config:netconf:northbound:impl">
-                  <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:netconf:north:mapper">dom:netconf-northbound-mapper</type>
-                  <name>mapper-aggregator</name>
-              </mappers>
-              <server-monitor xmlns="urn:opendaylight:params:xml:ns:yang:controller:config:netconf:northbound:impl">
-                  <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:netconf:northbound">prefix:netconf-server-monitoring</type>
-                  <name>server-monitor</name>
-              </server-monitor>
-              <boss-thread-group xmlns="urn:opendaylight:params:xml:ns:yang:controller:config:netconf:northbound:impl">
-                  <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netty">prefix:netty-threadgroup</type>
-                  <name>global-boss-group</name>
-              </boss-thread-group>
-              <worker-thread-group xmlns="urn:opendaylight:params:xml:ns:yang:controller:config:netconf:northbound:impl">
-                  <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netty">prefix:netty-threadgroup</type>
-                  <name>global-worker-group</name>
-              </worker-thread-group>
-              <timer xmlns="urn:opendaylight:params:xml:ns:yang:controller:config:netconf:northbound:impl">
-                  <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netty">prefix:netty-timer</type>
-                  <name>global-timer</name>
-              </timer>
-          </module>
-
-          <module>
-              <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:monitoring">prefix:netconf-mdsal-monitoring-mapper</type>
-              <name>netconf-mdsal-monitoring-mapper</name>
-              <server-monitoring xmlns="urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:monitoring">
-                  <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:netconf:northbound">prefix:netconf-server-monitoring</type>
-                  <name>server-monitor</name>
-              </server-monitoring>
-              <binding-aware-broker xmlns="urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:monitoring">
-                  <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">prefix:binding-broker-osgi-registry</type>
-                  <name>binding-osgi-broker</name>
-              </binding-aware-broker>
-              <aggregator xmlns="urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:monitoring">
-                  <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:north:mapper">prefix:netconf-mapper-registry</type>
-                  <name>mapper-aggregator-registry</name>
-              </aggregator>
-          </module>
-
-          <module>
-              <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:netconf:northbound:impl">prefix:netconf-mapper-aggregator</type>
-              <name>mapper-aggregator</name>
-          </module>
-
-          <module>
-              <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:netconf:northbound:impl">prefix:netconf-server-monitoring-impl</type>
-              <name>server-monitor</name>
-              <aggregator xmlns="urn:opendaylight:params:xml:ns:yang:controller:config:netconf:northbound:impl">
-                  <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:netconf:north:mapper">dom:netconf-northbound-mapper</type>
-                  <name>mapper-aggregator</name>
-              </aggregator>
-              <scheduled-threadpool xmlns="urn:opendaylight:params:xml:ns:yang:controller:config:netconf:northbound:impl">
-                  <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:threadpool">prefix:threadpool</type>
-                  <name>global-netconf-ssh-scheduled-executor</name>
-              </scheduled-threadpool>
-              <monitoring-update-interval xmlns="urn:opendaylight:params:xml:ns:yang:controller:config:netconf:northbound:impl">6</monitoring-update-interval>
-          </module>
-
-          <module>
-              <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:ssh">prefix:netconf-northbound-ssh</type>
-              <name>netconf-mdsal-ssh-server</name>
-
-              <event-executor xmlns="urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:ssh">
-                  <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netty">prefix:netty-event-executor</type>
-                  <name>global-event-executor</name>
-              </event-executor>
-              <worker-thread-group xmlns="urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:ssh">
-                  <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netty">prefix:netty-threadgroup</type>
-                  <name>global-worker-group</name>
-              </worker-thread-group>
-              <processing-executor xmlns="urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:ssh">
-                  <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:threadpool">prefix:threadpool</type>
-                  <name>global-netconf-ssh-scheduled-executor</name>
-              </processing-executor>
-              <dispatcher xmlns="urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:ssh">
-                  <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:netconf:northbound">prefix:netconf-server-dispatcher</type>
-                  <name>netconf-mdsal-server-dispatcher</name>
-              </dispatcher>
-              <auth-provider xmlns="urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:ssh">
-                  <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:netconf:auth">prefix:netconf-auth-provider</type>
-                  <name>default-auth-provider</name>
-              </auth-provider>
-          </module>
-
-          <module>
-              <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:notification:impl">prefix:netconf-notification-manager</type>
-              <name>netconf-notification-manager</name>
-          </module>
-
-          <module>
-              <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:notification">prefix:netconf-mdsal-notification-mapper</type>
-              <name>netconf-mdsal-notification-mapper</name>
-              <data-broker xmlns="urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:notification">
-                  <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-async-data-broker</type>
-                  <name>binding-data-broker</name>
-              </data-broker>
-              <binding-aware-broker xmlns="urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:notification">
-                  <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">prefix:binding-broker-osgi-registry</type>
-                  <name>binding-osgi-broker</name>
-              </binding-aware-broker>
-              <aggregator xmlns="urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:notification">
-                  <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:north:mapper">prefix:netconf-mapper-registry</type>
-                  <name>mapper-aggregator-registry</name>
-              </aggregator>
-              <notification-registry xmlns="urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:notification">
-                  <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:notification">prefix:netconf-notification-registry</type>
-                  <name>netconf-notification-manager</name>
-              </notification-registry>
-              <notification-collector>
-                  <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:notification">prefix:netconf-notification-collector</type>
-                  <name>netconf-notification-manager</name>
-              </notification-collector>
-          </module>
-
-          <module>
-              <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:yang:library">prefix:netconf-mdsal-yanglib</type>
-              <name>netconf-mdsal-yanglib</name>
-              <binding-aware-broker xmlns="urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:yang:library">
-                  <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">prefix:binding-broker-osgi-registry</type>
-                  <name>binding-osgi-broker</name>
-              </binding-aware-broker>
-              <root-schema-service xmlns="urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:yang:library">
-              <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:schema-service</type>
-              <name>yang-schema-service</name>
-          </root-schema-service>
-          </module>
-
-
-
-          <!--TCP endpoint for MD-SAL netconf server -->
-          <!--<module>-->
-              <!--<type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:tcp">prefix:netconf-northbound-tcp</type>-->
-              <!--<name>netconf-mdsal-tcp-server</name>-->
-              <!--<dispatcher xmlns="urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:tcp">-->
-                  <!--<type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:netconf:northbound">prefix:netconf-server-dispatcher</type>-->
-                  <!--<name>netconf-mdsal-server-dispatcher</name>-->
-              <!--</dispatcher>-->
-          <!--</module>-->
-
-      </modules>
-
-        <services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
-            <service>
-                <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:netconf:northbound">prefix:netconf-server-monitoring</type>
-                <instance>
-                    <name>server-monitor</name>
-                    <provider>/modules/module[type='netconf-server-monitoring-impl'][name='server-monitor']</provider>
-                </instance>
-            </service>
-            <service>
-                <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:north:mapper">prefix:netconf-northbound-mapper</type>
-                <instance>
-                    <name>netconf-mdsal-mapper</name>
-                    <provider>/modules/module[type='netconf-mdsal-mapper'][name='netconf-mdsal-mapper']</provider>
-                </instance>
-            </service>
-            <service>
-                <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:north:mapper">prefix:netconf-northbound-mapper</type>
-                <instance>
-                    <name>mapper-aggregator</name>
-                    <provider>/modules/module[type='netconf-mapper-aggregator'][name='mapper-aggregator']</provider>
-                </instance>
-            </service>
-            <service>
-                <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:north:mapper">prefix:netconf-mapper-registry</type>
-                <instance>
-                    <name>mapper-aggregator-registry</name>
-                    <provider>/modules/module[type='netconf-mapper-aggregator'][name='mapper-aggregator']</provider>
-                </instance>
-            </service>
-            <service>
-                <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:netconf:northbound">prefix:netconf-server-dispatcher</type>
-                <instance>
-                    <name>netconf-mdsal-server-dispatcher</name>
-                    <provider>/modules/module[type='netconf-server-dispatcher-impl'][name='netconf-mdsal-server-dispatcher']</provider>
-                </instance>
-            </service>
-            <service>
-                <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:north:mapper">prefix:netconf-northbound-mapper</type>
-                <instance>
-                    <name>netconf-mdsal-notification-mapper</name>
-                    <provider>/modules/module[type='netconf-mdsal-notification-mapper'][name='netconf-mdsal-notification-mapper']</provider>
-                </instance>
-            </service>
-            <service>
-                <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:notification">prefix:netconf-notification-collector</type>
-                <instance>
-                    <name>netconf-notification-manager</name>
-                    <provider>/modules/module[type='netconf-notification-manager'][name='netconf-notification-manager']</provider>
-                </instance>
-            </service>
-            <service>
-                <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:notification">prefix:netconf-notification-registry</type>
-                <instance>
-                    <name>netconf-notification-manager</name>
-                    <provider>/modules/module[type='netconf-notification-manager'][name='netconf-notification-manager']</provider>
-                </instance>
-            </service>
-        </services>
-
-    </data>
-  </configuration>
-  <required-capabilities>
-      <capability>urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:mapper?module=netconf-mdsal-mapper&amp;revision=2015-01-14</capability>
-      <capability>urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:monitoring?module=netconf-mdsal-monitoring&amp;revision=2015-02-18</capability>
-      <capability>urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:ssh?module=netconf-northbound-ssh&amp;revision=2015-01-14</capability>
-      <capability>urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:tcp?module=netconf-northbound-tcp&amp;revision=2015-04-23</capability>
-      <capability>urn:opendaylight:params:xml:ns:yang:controller:config:netconf:northbound:impl?module=netconf-northbound-impl&amp;revision=2015-01-12</capability>
-      <capability>urn:opendaylight:params:xml:ns:yang:controller:threadpool:impl:scheduled?module=threadpool-impl-scheduled&amp;revision=2013-12-01</capability>
-      <capability>urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:notification?module=netconf-mdsal-notification&amp;revision=2015-08-03</capability>
-      <capability>urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:yang:library?module=netconf-mdsal-yang-library&amp;revision=2016-06-17</capability>
-  </required-capabilities>
-</snapshot>
index fe0e09e8a787d6ca27777eec0c3d790dc3034bd3..f821a31dc88d83068de697dd0e276faa565338fe 100644 (file)
@@ -16,10 +16,14 @@ module netconf-northbound-notification {
     identity netconf-notification-collector {
             base "config:service-type";
             config:java-class "org.opendaylight.netconf.notifications.NetconfNotificationCollector";
+            config:disable-osgi-service-registration;
+            status deprecated;
         }
 
     identity netconf-notification-registry {
            base "config:service-type";
            config:java-class "org.opendaylight.netconf.notifications.NetconfNotificationRegistry";
+           config:disable-osgi-service-registration;
+           status deprecated;
     }
 }
\ No newline at end of file
diff --git a/netconf/netconf-notifications-impl/src/main/java/org/opendaylight/controller/config/yang/netconf/northbound/notification/impl/NetconfNotificationManagerModule.java b/netconf/netconf-notifications-impl/src/main/java/org/opendaylight/controller/config/yang/netconf/northbound/notification/impl/NetconfNotificationManagerModule.java
deleted file mode 100644 (file)
index d9dce4b..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.controller.config.yang.netconf.northbound.notification.impl;
-
-import org.opendaylight.netconf.notifications.impl.NetconfNotificationManager;
-
-public class NetconfNotificationManagerModule extends org.opendaylight.controller.config.yang.netconf.northbound.notification.impl.AbstractNetconfNotificationManagerModule {
-    public NetconfNotificationManagerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
-        super(identifier, dependencyResolver);
-    }
-
-    public NetconfNotificationManagerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.controller.config.yang.netconf.northbound.notification.impl.NetconfNotificationManagerModule oldModule, java.lang.AutoCloseable oldInstance) {
-        super(identifier, dependencyResolver, oldModule, oldInstance);
-    }
-
-    @Override
-    public void customValidation() {
-        // add custom validation form module attributes here.
-    }
-
-    @Override
-    public java.lang.AutoCloseable createInstance() {
-        return new NetconfNotificationManager();
-    }
-
-}
diff --git a/netconf/netconf-notifications-impl/src/main/java/org/opendaylight/controller/config/yang/netconf/northbound/notification/impl/NetconfNotificationManagerModuleFactory.java b/netconf/netconf-notifications-impl/src/main/java/org/opendaylight/controller/config/yang/netconf/northbound/notification/impl/NetconfNotificationManagerModuleFactory.java
deleted file mode 100644 (file)
index dadf756..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-/*
-* Generated file
-*
-* Generated from: yang module name: netconf-northbound-notification-impl yang module local name: netconf-notification-manager
-* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
-* Generated at: Fri Aug 07 17:09:20 CEST 2015
-*
-* Do not modify this file unless it is present under src/main directory
-*/
-package org.opendaylight.controller.config.yang.netconf.northbound.notification.impl;
-public class NetconfNotificationManagerModuleFactory extends org.opendaylight.controller.config.yang.netconf.northbound.notification.impl.AbstractNetconfNotificationManagerModuleFactory {
-
-}
diff --git a/netconf/netconf-notifications-impl/src/main/yang/netconf-northbound-notification-impl.yang b/netconf/netconf-notifications-impl/src/main/yang/netconf-northbound-notification-impl.yang
deleted file mode 100644 (file)
index 4b5fb35..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-module netconf-northbound-notification-impl {
-    yang-version 1;
-    namespace "urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:notification:impl";
-    prefix "nnnimpl";
-
-    import config { prefix config; revision-date 2013-04-05; }
-    import netconf-northbound-notification { prefix nnn; revision-date 2015-08-06; }
-
-    description
-        "This module contains the base YANG definitions for
-         netconf northbound notifications implementation";
-
-    revision "2015-08-07"{
-        description "Initial revision.";
-    }
-
-    identity netconf-notification-manager {
-        base config:module-type;
-        config:provided-service nnn:netconf-notification-collector;
-        config:provided-service nnn:netconf-notification-registry;
-        config:java-name-prefix NetconfNotificationManager;
-    }
-
-    augment "/config:modules/config:module/config:configuration" {
-        case netconf-notification-manager {
-            when "/config:modules/config:module/config:type = 'netconf-notification-manager'";
-        }
-    }
-}
\ No newline at end of file
diff --git a/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/config/yang/netconf/northbound/ssh/NetconfNorthboundSshModule.java b/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/config/yang/netconf/northbound/ssh/NetconfNorthboundSshModule.java
deleted file mode 100644 (file)
index be457f9..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.controller.config.yang.netconf.northbound.ssh;
-
-import io.netty.channel.ChannelFuture;
-import io.netty.channel.local.LocalAddress;
-import io.netty.util.concurrent.GenericFutureListener;
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.net.UnknownHostException;
-import java.util.concurrent.Executors;
-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 org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class NetconfNorthboundSshModule extends org.opendaylight.controller.config.yang.netconf.northbound.ssh.AbstractNetconfNorthboundSshModule {
-
-    private static final Logger LOG = LoggerFactory.getLogger(NetconfNorthboundSshModule.class);
-
-    public NetconfNorthboundSshModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
-        super(identifier, dependencyResolver);
-    }
-
-    public NetconfNorthboundSshModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, final org.opendaylight.controller.config.yang.netconf.northbound.ssh.NetconfNorthboundSshModule oldModule, final java.lang.AutoCloseable oldInstance) {
-        super(identifier, dependencyResolver, oldModule, oldInstance);
-    }
-
-    @Override
-    public void customValidation() {
-        // add custom validation form module attributes here.
-    }
-
-    @Override
-    public java.lang.AutoCloseable createInstance() {
-        final NetconfServerDispatcher dispatch = getDispatcherDependency();
-
-        final LocalAddress localAddress = new LocalAddress(getPort().toString());
-        final ChannelFuture localServer = dispatch.createLocalServer(localAddress);
-
-        final SshProxyServer sshProxyServer = new SshProxyServer(Executors.newScheduledThreadPool(1), getWorkerThreadGroupDependency(), getEventExecutorDependency());
-
-        final InetSocketAddress bindingAddress = getInetAddress();
-        final SshProxyServerConfigurationBuilder sshProxyServerConfigurationBuilder = new SshProxyServerConfigurationBuilder();
-        sshProxyServerConfigurationBuilder.setBindingAddress(bindingAddress);
-        sshProxyServerConfigurationBuilder.setLocalAddress(localAddress);
-        sshProxyServerConfigurationBuilder.setAuthenticator(getAuthProviderDependency());
-        sshProxyServerConfigurationBuilder.setIdleTimeout(Integer.MAX_VALUE);
-        sshProxyServerConfigurationBuilder.setKeyPairProvider(new PEMGeneratorHostKeyProvider());
-
-        localServer.addListener(new GenericFutureListener<ChannelFuture>() {
-
-            @Override
-            public void operationComplete(final ChannelFuture future) {
-                if(future.isDone() && !future.isCancelled()) {
-                    try {
-                        sshProxyServer.bind(sshProxyServerConfigurationBuilder.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 NetconfServerCloseable(localServer, sshProxyServer);
-    }
-
-    private InetSocketAddress getInetAddress() {
-        try {
-            final InetAddress inetAd = InetAddress.getByName(getBindingAddress().getIpv4Address() == null ? getBindingAddress().getIpv6Address().getValue() : getBindingAddress().getIpv4Address().getValue());
-            return new InetSocketAddress(inetAd, getPort().getValue());
-        } catch (final UnknownHostException e) {
-            throw new IllegalArgumentException("Unable to bind netconf endpoint to address " + getBindingAddress(), e);
-        }
-    }
-
-    private static final class NetconfServerCloseable implements AutoCloseable {
-        private final ChannelFuture localServer;
-        private final SshProxyServer sshProxyServer;
-
-        public NetconfServerCloseable(final ChannelFuture localServer, final SshProxyServer sshProxyServer) {
-            this.localServer = localServer;
-            this.sshProxyServer = sshProxyServer;
-        }
-
-        @Override
-        public void close() throws Exception {
-            sshProxyServer.close();
-
-            if(localServer.isDone()) {
-                localServer.channel().close();
-            } else {
-                localServer.cancel(true);
-            }
-        }
-    }
-}
diff --git a/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/config/yang/netconf/northbound/ssh/NetconfNorthboundSshModuleFactory.java b/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/config/yang/netconf/northbound/ssh/NetconfNorthboundSshModuleFactory.java
deleted file mode 100644 (file)
index 88ad64b..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-/*
-* Generated file
-*
-* Generated from: yang module name: netconf-northbound-ssh yang module local name: netconf-northbound-ssh
-* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
-* Generated at: Mon Feb 09 14:09:07 CET 2015
-*
-* Do not modify this file unless it is present under src/main directory
-*/
-package org.opendaylight.controller.config.yang.netconf.northbound.ssh;
-public class NetconfNorthboundSshModuleFactory extends org.opendaylight.controller.config.yang.netconf.northbound.ssh.AbstractNetconfNorthboundSshModuleFactory {
-
-}
diff --git a/netconf/netconf-ssh/src/main/java/org/opendaylight/netconf/ssh/NetconfNorthboundSshServer.java b/netconf/netconf-ssh/src/main/java/org/opendaylight/netconf/ssh/NetconfNorthboundSshServer.java
new file mode 100644 (file)
index 0000000..fca99e0
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2016 Inocybe Technologies and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.netconf.ssh;
+
+import io.netty.channel.ChannelFuture;
+import io.netty.channel.EventLoopGroup;
+import io.netty.channel.local.LocalAddress;
+import io.netty.util.concurrent.EventExecutor;
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.UnknownHostException;
+import java.util.concurrent.Executors;
+import org.apache.sshd.server.keyprovider.PEMGeneratorHostKeyProvider;
+import org.opendaylight.netconf.api.NetconfServerDispatcher;
+import org.opendaylight.netconf.auth.AuthProvider;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class NetconfNorthboundSshServer {
+
+    private static final Logger LOG = LoggerFactory.getLogger(NetconfNorthboundSshServer.class);
+
+    private final ChannelFuture localServer;
+    private final SshProxyServer sshProxyServer;
+
+    public NetconfNorthboundSshServer(final NetconfServerDispatcher netconfServerDispatcher,
+                                      final EventLoopGroup workerGroup,
+                                      final EventExecutor eventExecutor,
+                                      final String bindingAddress,
+                                      final String portNumber,
+                                      final AuthProvider authProvider) {
+
+        final LocalAddress localAddress = new LocalAddress(portNumber);
+
+        localServer = netconfServerDispatcher.createLocalServer(localAddress);
+        sshProxyServer = new SshProxyServer(Executors.newScheduledThreadPool(1), workerGroup, eventExecutor);
+
+        final InetSocketAddress inetAddress = getInetAddress(bindingAddress, portNumber);
+        final SshProxyServerConfigurationBuilder sshProxyServerConfigurationBuilder = new SshProxyServerConfigurationBuilder();
+        sshProxyServerConfigurationBuilder.setBindingAddress(inetAddress);
+        sshProxyServerConfigurationBuilder.setLocalAddress(localAddress);
+        sshProxyServerConfigurationBuilder.setAuthenticator(authProvider);
+        sshProxyServerConfigurationBuilder.setIdleTimeout(Integer.MAX_VALUE);
+        sshProxyServerConfigurationBuilder.setKeyPairProvider(new PEMGeneratorHostKeyProvider());
+
+        localServer.addListener(future -> {
+            if (future.isDone() && !future.isCancelled()) {
+                try {
+                    sshProxyServer.bind(sshProxyServerConfigurationBuilder.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());
+            }
+        });
+    }
+
+    private InetSocketAddress getInetAddress(final String bindingAddress, final String portNumber) {
+        try {
+            IpAddress ipAddress= IpAddressBuilder.getDefaultInstance(bindingAddress);
+            final InetAddress inetAd = InetAddress.getByName(ipAddress.getIpv4Address() == null ? ipAddress.getIpv6Address().getValue() : ipAddress.getIpv4Address().getValue());
+            return new InetSocketAddress(inetAd, Integer.valueOf(portNumber));
+        } catch (final UnknownHostException e) {
+            throw new IllegalArgumentException("Unable to bind netconf endpoint to address " + bindingAddress, e);
+        }
+    }
+
+    public void close() {
+        sshProxyServer.close();
+
+        if (localServer.isDone()) {
+            localServer.channel().close();
+        } else {
+            localServer.cancel(true);
+        }
+    }
+}
diff --git a/netconf/netconf-ssh/src/main/yang/netconf-northbound-ssh.yang b/netconf/netconf-ssh/src/main/yang/netconf-northbound-ssh.yang
deleted file mode 100644 (file)
index 0f4da44..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-module netconf-northbound-ssh {
-    yang-version 1;
-    namespace "urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:ssh";
-    prefix "nni";
-
-    import netconf-northbound-mapper { prefix nnm; revision-date 2015-01-14; }
-    import netconf-northbound { prefix nn; revision-date 2015-01-14; }
-    import config { prefix config; revision-date 2013-04-05; }
-    import threadpool {prefix th;}
-    import netty {prefix netty;}
-    import ietf-inet-types { prefix inet; revision-date 2013-07-15; }
-    import netconf-auth { prefix na; revision-date 2015-07-15; }
-
-    organization "Cisco Systems, Inc.";
-
-    description
-        "This module contains the base YANG definitions for
-         a default implementation of netconf northbound server";
-
-    revision "2015-01-14" {
-        description
-            "Initial revision.";
-    }
-
-    identity netconf-northbound-ssh {
-        base config:module-type;
-        config:java-name-prefix NetconfNorthboundSsh;
-    }
-
-    augment "/config:modules/config:module/config:configuration" {
-        case netconf-northbound-ssh {
-            when "/config:modules/config:module/config:type = 'netconf-northbound-ssh'";
-
-            leaf port {
-                type inet:port-number;
-                default 2830;
-            }
-
-            leaf binding-address {
-                type inet:ip-address;
-                default "0.0.0.0";
-            }
-
-            container processing-executor {
-                uses config:service-ref {
-                    refine type {
-                        mandatory true;
-                        config:required-identity th:scheduled-threadpool;
-                    }
-                }
-
-                description "Required by the mina-ssh library used in SSH endpoint";
-            }
-
-            container event-executor {
-                uses config:service-ref {
-                    refine type {
-                        mandatory true;
-                        config:required-identity netty:netty-event-executor;
-                    }
-                }
-            }
-
-            container worker-thread-group {
-                uses config:service-ref {
-                    refine type {
-                        config:required-identity netty:netty-threadgroup;
-                    }
-                }
-            }
-
-            container dispatcher {
-                uses config:service-ref {
-                    refine type {
-                        config:required-identity nn:netconf-server-dispatcher;
-                    }
-                }
-            }
-
-            container auth-provider {
-                uses config:service-ref {
-                    refine type {
-                        config:required-identity na:netconf-auth-provider;
-                    }
-                }
-            }
-
-        }
-    }
-
-}
index 925488cc637dd78e57a7df7336610a538a216089..dcecd0a57d3a2f3b55476362ca9c6e724e1703c6 100644 (file)
     <module>netconf-config</module>
     <module>netconf-impl</module>
     <module>config-netconf-connector</module>
+    <module>mdsal-netconf-ssh</module>
     <module>mdsal-netconf-connector</module>
     <module>mdsal-netconf-monitoring</module>
     <module>mdsal-netconf-notification</module>
     <module>mdsal-netconf-yang-library</module>
+    <module>mdsal-netconf-impl</module>
     <module>netconf-util</module>
     <module>netconf-netty-util</module>
     <module>netconf-mapping-api</module>
@@ -41,7 +43,6 @@
     <module>netconf-tcp</module>
     <module>netconf-monitoring</module>
     <module>netconf-connector-config</module>
-    <module>netconf-mdsal-config</module>
     <module>netconf-auth</module>
     <module>aaa-authn-odl-plugin</module>
     <module>netconf-notifications-impl</module>