Add blueprint wiring for netconf-topology 58/47858/15
authorAlexis de Talhouët <adetalhouet@inocybe.com>
Wed, 2 Nov 2016 20:26:15 +0000 (16:26 -0400)
committerJakub Morvay <jmorvay@cisco.com>
Mon, 28 Nov 2016 09:40:06 +0000 (09:40 +0000)
This patch also moves api interface under the api
package. So api and impl are seperated, package-wise

Change-Id: Id80290e108b30e524f985044c66a1bea057c24c5
Signed-off-by: Alexis de Talhouët <adetalhouet@inocybe.com>
18 files changed:
features/netconf-connector/pom.xml
features/netconf-connector/src/main/features/features.xml
netconf/netconf-artifacts/pom.xml
netconf/netconf-topology-config/pom.xml
netconf/netconf-topology-config/src/main/resources/initial/02-netconf-topology.xml [deleted file]
netconf/netconf-topology-config/src/main/resources/org/opendaylight/blueprint/netconf-topology.xml [new file with mode: 0755]
netconf/netconf-topology/src/main/java/org/opendaylight/controller/config/yang/netconf/topology/NetconfTopologyModule.java [deleted file]
netconf/netconf-topology/src/main/java/org/opendaylight/controller/config/yang/netconf/topology/NetconfTopologyModuleFactory.java [deleted file]
netconf/netconf-topology/src/main/java/org/opendaylight/controller/config/yang/netconf/topology/shared/schema/repository/SchemaRepositoryImplModule.java [deleted file]
netconf/netconf-topology/src/main/java/org/opendaylight/controller/config/yang/netconf/topology/shared/schema/repository/SchemaRepositoryImplModuleFactory.java [deleted file]
netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/AbstractNetconfTopology.java
netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/api/NetconfTopology.java [moved from netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/NetconfTopology.java with 94% similarity]
netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/api/SchemaRepositoryProvider.java [moved from netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/SchemaRepositoryProvider.java with 91% similarity]
netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/impl/NetconfTopologyImpl.java
netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/impl/SchemaRepositoryProviderImpl.java [new file with mode: 0644]
netconf/netconf-topology/src/main/yang/netconf-topology.yang [deleted file]
netconf/netconf-topology/src/main/yang/shared-schema-repository.yang [deleted file]
netconf/netconf-topology/src/test/java/org/opendaylight/netconf/topology/impl/NetconfTopologyImplTest.java

index 681047f6600ddbfa5eb2f20758e33866150603f9..ecd3e5abe631bf4d5a886a66d11f64c101ded35c 100644 (file)
@@ -34,7 +34,6 @@
     <features.file>features.xml</features.file>
     <config.configfile.directory>etc/opendaylight/karaf</config.configfile.directory>
     <config.netconf.client.configfile>01-netconf.xml</config.netconf.client.configfile>
-    <config.netconf.topology.configfile>02-netconf-topology.xml</config.netconf.topology.configfile>
     <config.netconf.connector.configfile>99-netconf-connector.xml</config.netconf.connector.configfile>
   </properties>
 
     <dependency>
       <groupId>${project.groupId}</groupId>
       <artifactId>netconf-topology-config</artifactId>
-      <classifier>config</classifier>
-      <type>xml</type>
     </dependency>
     <dependency>
       <groupId>${project.groupId}</groupId>
index 10fbb4f03a59a5d19b5363259a70ae8acc77ca3c..a911dcf56585b349936af25e26966e3f727166cd 100644 (file)
@@ -49,7 +49,7 @@
     <feature name='odl-netconf-topology' version='${project.version}' description="OpenDaylight :: Netconf Topology :: Netconf Connector + Netconf SSH Server + Netconf configuration via config topology datastore">
         <feature version='${project.version}'>odl-netconf-ssh</feature>
         <feature version='${project.version}'>odl-netconf-connector</feature>
-        <configfile finalname='${config.configfile.directory}/${config.netconf.topology.configfile}'>mvn:org.opendaylight.netconf/netconf-topology-config/{{VERSION}}/xml/config</configfile>
+        <bundle>mvn:org.opendaylight.netconf/netconf-topology-config/{{VERSION}}</bundle>
     </feature>
 
     <feature name='odl-netconf-clustered-topology' version='${project.version}' description="OpenDaylight :: Clustered Netconf Topology :: Netconf Connector + Netconf SSH Server">
index a2c0ee79e12dc811ba41614b272c523bdfb137c5..32bcf637d3bbb56e4026b18fe168109c59d8877a 100644 (file)
                 <groupId>${project.groupId}</groupId>
                 <artifactId>netconf-topology-config</artifactId>
                 <version>${project.version}</version>
-                <classifier>config</classifier>
-                <type>xml</type>
             </dependency>
             <dependency>
                 <groupId>${project.groupId}</groupId>
index 75113816f39a41908befb264f29907ade9f2b074..2a0e0d982d98afe38dc7cbd09a6789d46c83fcbf 100644 (file)
@@ -13,7 +13,7 @@
 
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
-        <artifactId>odlparent-lite</artifactId>
+        <artifactId>bundle-parent</artifactId>
         <version>1.8.0-SNAPSHOT</version>
         <relativePath/>
     </parent>
     <artifactId>netconf-topology-config</artifactId>
     <version>1.2.0-SNAPSHOT</version>
     <description>Configuration files for netconf topology</description>
-    <packaging>jar</packaging>
+    <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-topology</artifactId>
+        </dependency>
+    </dependencies>
 
     <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/02-netconf-topology.xml</file>
-                                    <type>xml</type>
-                                    <classifier>config</classifier>
-                                </artifact>
-                            </artifacts>
-                        </configuration>
-                    </execution>
-                </executions>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
+                        <Embed-Dependency>netconf-topology</Embed-Dependency>
+                    </instructions>
+                </configuration>
             </plugin>
         </plugins>
     </build>
-
 </project>
diff --git a/netconf/netconf-topology-config/src/main/resources/initial/02-netconf-topology.xml b/netconf/netconf-topology-config/src/main/resources/initial/02-netconf-topology.xml
deleted file mode 100644 (file)
index 27e0617..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- vi: set et smarttab sw=4 tabstop=4: -->
-<!--
- 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
--->
-<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:topology">prefix:netconf-topology-impl</type>
-                    <name>default-netconf-topology</name>
-                    <topology-id xmlns="urn:opendaylight:params:xml:ns:yang:controller:netconf:topology">topology-netconf</topology-id>
-                    <event-executor xmlns="urn:opendaylight:params:xml:ns:yang:controller:netconf:topology">
-                        <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netty">prefix:netty-event-executor</type>
-                        <name>global-event-executor</name>
-                    </event-executor>
-                    <binding-registry xmlns="urn:opendaylight:params:xml:ns:yang:controller:netconf:topology">
-                        <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-registry>
-                    <dom-registry xmlns="urn:opendaylight:params:xml:ns:yang:controller:netconf:topology">
-                        <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">prefix:dom-broker-osgi-registry</type>
-                        <name>dom-broker</name>
-                    </dom-registry>
-                    <client-dispatcher xmlns="urn:opendaylight:params:xml:ns:yang:controller:netconf:topology">
-                        <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:netconf">prefix:netconf-client-dispatcher</type>
-                        <name>global-netconf-dispatcher</name>
-                    </client-dispatcher>
-                    <processing-executor xmlns="urn:opendaylight:params:xml:ns:yang:controller:netconf:topology">
-                        <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:threadpool">prefix:threadpool</type>
-                        <name>global-netconf-processing-executor</name>
-                    </processing-executor>
-                    <keepalive-executor xmlns="urn:opendaylight:params:xml:ns:yang:controller:netconf:topology">
-                        <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:threadpool">prefix:scheduled-threadpool</type>
-                        <name>global-netconf-ssh-scheduled-executor</name>
-                    </keepalive-executor>
-                    <shared-schema-repository xmlns="urn:opendaylight:params:xml:ns:yang:controller:netconf:topology">
-                        <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:topology:shared:schema:repository">prefix:shared-schema-repository</type>
-                        <name>default-shared-schema-repository</name>
-                    </shared-schema-repository>
-                </module>
-            </modules>
-
-            <services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
-                <service>
-                    <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:topology">prefix:netconf-topology</type>
-                    <instance>
-                        <name>default-netconf-topology</name>
-                        <provider>/modules/module[type='netconf-topology-impl'][name='default-netconf-topology']</provider>
-                    </instance>
-                </service>
-            </services>
-        </data>
-    </configuration>
-    <required-capabilities>
-        <capability>urn:opendaylight:params:xml:ns:yang:controller:netconf:topology?module=netconf-topology&amp;revision=2015-07-27</capability>
-    </required-capabilities>
-</snapshot>
\ No newline at end of file
diff --git a/netconf/netconf-topology-config/src/main/resources/org/opendaylight/blueprint/netconf-topology.xml b/netconf/netconf-topology-config/src/main/resources/org/opendaylight/blueprint/netconf-topology.xml
new file mode 100755 (executable)
index 0000000..cf04017
--- /dev/null
@@ -0,0 +1,51 @@
+<?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="clientDispatcherDependency"
+               interface="org.opendaylight.netconf.client.NetconfClientDispatcher"
+               odl:type="netconf-client-dispatcher"/>
+    <reference id="bindingAwareBroker"
+               interface="org.opendaylight.controller.sal.binding.api.BindingAwareBroker"/>
+    <reference id="keepAliveExecutor"
+               interface="org.opendaylight.controller.config.threadpool.ScheduledThreadPool"/>
+    <reference id="processingExecutor"
+               interface="org.opendaylight.controller.config.threadpool.ThreadPool"/>
+    <reference id="domBroker"
+               interface="org.opendaylight.controller.sal.core.api.Broker"/>
+    <reference id="eventExecutor"
+               interface="io.netty.util.concurrent.EventExecutor"
+               odl:type="global-event-executor"/>
+    <reference id="dataBroker"
+               interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"/>
+    <reference id="domMountPointService"
+               interface="org.opendaylight.controller.md.sal.dom.api.DOMMountPointService"/>
+
+    <bean id="schemaRepository" class="org.opendaylight.netconf.topology.impl.SchemaRepositoryProviderImpl">
+        <argument value="shared-schema-repository-impl"/>
+    </bean>
+
+    <bean id="netconfTopology" class="org.opendaylight.netconf.topology.impl.NetconfTopologyImpl"
+          init-method="init"
+          destroy-method="close">
+        <argument value="topology-netconf"/>
+        <argument ref="clientDispatcherDependency"/>
+        <argument ref="bindingAwareBroker"/>
+        <argument ref="domBroker"/>
+        <argument ref="eventExecutor"/>
+        <argument ref="keepAliveExecutor"/>
+        <argument ref="processingExecutor"/>
+        <argument ref="schemaRepository"/>
+        <argument ref="dataBroker"/>
+        <argument ref="domMountPointService"/>
+    </bean>
+
+</blueprint>
\ No newline at end of file
diff --git a/netconf/netconf-topology/src/main/java/org/opendaylight/controller/config/yang/netconf/topology/NetconfTopologyModule.java b/netconf/netconf-topology/src/main/java/org/opendaylight/controller/config/yang/netconf/topology/NetconfTopologyModule.java
deleted file mode 100644 (file)
index e4321b7..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.netconf.topology;
-
-import org.opendaylight.netconf.topology.impl.NetconfTopologyImpl;
-
-public class NetconfTopologyModule extends org.opendaylight.controller.config.yang.netconf.topology.AbstractNetconfTopologyModule {
-    public NetconfTopologyModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
-        super(identifier, dependencyResolver);
-    }
-
-    public NetconfTopologyModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.controller.config.yang.netconf.topology.NetconfTopologyModule oldModule, AutoCloseable oldInstance) {
-        super(identifier, dependencyResolver, oldModule, oldInstance);
-    }
-
-    @Override
-    public void customValidation() {
-        // add custom validation form module attributes here.
-        this.getClientDispatcherDependency();
-    }
-
-    @Override
-    public AutoCloseable createInstance() {
-        return new NetconfTopologyImpl(getTopologyId(), getClientDispatcherDependency(), getBindingRegistryDependency(),
-                getDomRegistryDependency(), getEventExecutorDependency(), getKeepaliveExecutorDependency(),
-                getProcessingExecutorDependency(), getSharedSchemaRepositoryDependency());
-    }
-
-}
diff --git a/netconf/netconf-topology/src/main/java/org/opendaylight/controller/config/yang/netconf/topology/NetconfTopologyModuleFactory.java b/netconf/netconf-topology/src/main/java/org/opendaylight/controller/config/yang/netconf/topology/NetconfTopologyModuleFactory.java
deleted file mode 100644 (file)
index f8dd199..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-topology yang module local name: netconf-topology-impl
-* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
-* Generated at: Tue Jul 28 15:33:44 CEST 2015
-*
-* Do not modify this file unless it is present under src/main directory
-*/
-package org.opendaylight.controller.config.yang.netconf.topology;
-
-public class NetconfTopologyModuleFactory extends org.opendaylight.controller.config.yang.netconf.topology.AbstractNetconfTopologyModuleFactory {
-
-}
diff --git a/netconf/netconf-topology/src/main/java/org/opendaylight/controller/config/yang/netconf/topology/shared/schema/repository/SchemaRepositoryImplModule.java b/netconf/netconf-topology/src/main/java/org/opendaylight/controller/config/yang/netconf/topology/shared/schema/repository/SchemaRepositoryImplModule.java
deleted file mode 100644 (file)
index c4f5f98..0000000
+++ /dev/null
@@ -1,51 +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.topology.shared.schema.repository;
-
-import org.opendaylight.netconf.topology.SchemaRepositoryProvider;
-import org.opendaylight.yangtools.yang.parser.repo.SharedSchemaRepository;
-
-public class SchemaRepositoryImplModule extends org.opendaylight.controller.config.yang.netconf.topology.shared.schema.repository.AbstractSchemaRepositoryImplModule {
-    public SchemaRepositoryImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
-        super(identifier, dependencyResolver);
-    }
-
-    public SchemaRepositoryImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.controller.config.yang.netconf.topology.shared.schema.repository.SchemaRepositoryImplModule 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 SchemaRepositoryProviderAutoCloseAble(this);
-    }
-
-    private static class SchemaRepositoryProviderAutoCloseAble implements SchemaRepositoryProvider, AutoCloseable {
-
-        private final SharedSchemaRepository schemaRepository;
-
-        public SchemaRepositoryProviderAutoCloseAble(SchemaRepositoryImplModule module) {
-            schemaRepository = new SharedSchemaRepository(module.getIdentifier().getInstanceName());
-        }
-
-        @Override
-        public void close() throws Exception {
-            //NOOP
-        }
-
-        @Override
-        public SharedSchemaRepository getSharedSchemaRepository() {
-            return schemaRepository;
-        }
-    }
-}
diff --git a/netconf/netconf-topology/src/main/java/org/opendaylight/controller/config/yang/netconf/topology/shared/schema/repository/SchemaRepositoryImplModuleFactory.java b/netconf/netconf-topology/src/main/java/org/opendaylight/controller/config/yang/netconf/topology/shared/schema/repository/SchemaRepositoryImplModuleFactory.java
deleted file mode 100644 (file)
index 9cf6e1c..0000000
+++ /dev/null
@@ -1,36 +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: shared-schema-repository yang module local name: shared-schema-repository-impl
-* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
-* Generated at: Tue Sep 08 13:43:39 CEST 2015
-*
-* Do not modify this file unless it is present under src/main directory
-*/
-package org.opendaylight.controller.config.yang.netconf.topology.shared.schema.repository;
-
-import com.google.common.collect.Sets;
-import java.util.Set;
-import org.opendaylight.controller.config.api.DependencyResolverFactory;
-import org.opendaylight.controller.config.api.ModuleIdentifier;
-import org.osgi.framework.BundleContext;
-
-public class SchemaRepositoryImplModuleFactory extends org.opendaylight.controller.config.yang.netconf.topology.shared.schema.repository.AbstractSchemaRepositoryImplModuleFactory {
-
-    public static final ModuleIdentifier defaultInstanceId = new ModuleIdentifier(NAME, "default-shared-schema-repository");
-
-    @Override
-    public Set<SchemaRepositoryImplModule> getDefaultModules(DependencyResolverFactory dependencyResolverFactory, BundleContext bundleContext) {
-        SchemaRepositoryImplModule defaultModule = new SchemaRepositoryImplModule(
-                defaultInstanceId, dependencyResolverFactory.createDependencyResolver(defaultInstanceId));
-        return Sets.newHashSet(defaultModule);
-    }
-}
index 7174c53be544c628a4d85eb510c870d7a18ea751..997d6cb0117cb63d6a15305b0ae37110c0004b32 100644 (file)
@@ -20,8 +20,6 @@ import java.io.File;
 import java.math.BigDecimal;
 import java.net.InetSocketAddress;
 import java.net.URL;
-import java.util.Collection;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -30,11 +28,7 @@ import org.opendaylight.controller.config.threadpool.ThreadPool;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
-import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
 import org.opendaylight.controller.sal.core.api.Broker;
-import org.opendaylight.controller.sal.core.api.Broker.ProviderSession;
-import org.opendaylight.controller.sal.core.api.Provider;
 import org.opendaylight.netconf.api.NetconfMessage;
 import org.opendaylight.netconf.client.NetconfClientDispatcher;
 import org.opendaylight.netconf.client.NetconfClientSessionListener;
@@ -57,6 +51,8 @@ import org.opendaylight.netconf.sal.connect.netconf.listener.UserPreferences;
 import org.opendaylight.netconf.sal.connect.netconf.sal.KeepaliveSalFacade;
 import org.opendaylight.netconf.sal.connect.netconf.schema.YangLibrarySchemaYangSourceProvider;
 import org.opendaylight.netconf.sal.connect.util.RemoteDeviceId;
+import org.opendaylight.netconf.topology.api.NetconfTopology;
+import org.opendaylight.netconf.topology.api.SchemaRepositoryProvider;
 import org.opendaylight.protocol.framework.ReconnectStrategy;
 import org.opendaylight.protocol.framework.ReconnectStrategyFactory;
 import org.opendaylight.protocol.framework.TimedReconnectStrategy;
@@ -81,7 +77,7 @@ import org.opendaylight.yangtools.yang.parser.util.TextToASTTransformer;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public abstract class AbstractNetconfTopology implements NetconfTopology, BindingAwareProvider, Provider {
+public abstract class AbstractNetconfTopology implements NetconfTopology {
 
     private static final Logger LOG = LoggerFactory.getLogger(AbstractNetconfTopology.class);
 
@@ -164,19 +160,20 @@ public abstract class AbstractNetconfTopology implements NetconfTopology, Bindin
     protected final ScheduledThreadPool keepaliveExecutor;
     protected final ThreadPool processingExecutor;
     protected final SharedSchemaRepository sharedSchemaRepository;
+    protected final DataBroker dataBroker;
+    protected final DOMMountPointService mountPointService;
 
     protected SchemaSourceRegistry schemaRegistry = DEFAULT_SCHEMA_REPOSITORY;
     protected SchemaRepository schemaRepository = DEFAULT_SCHEMA_REPOSITORY;
     protected SchemaContextFactory schemaContextFactory = DEFAULT_SCHEMA_CONTEXT_FACTORY;
 
-    protected DOMMountPointService mountPointService = null;
-    protected DataBroker dataBroker = null;
     protected final HashMap<NodeId, NetconfConnectorDTO> activeConnectors = new HashMap<>();
 
     protected AbstractNetconfTopology(final String topologyId, final NetconfClientDispatcher clientDispatcher,
                                       final BindingAwareBroker bindingAwareBroker, final Broker domBroker,
                                       final EventExecutor eventExecutor, final ScheduledThreadPool keepaliveExecutor,
-                                      final ThreadPool processingExecutor, final SchemaRepositoryProvider schemaRepositoryProvider) {
+                                      final ThreadPool processingExecutor, final SchemaRepositoryProvider schemaRepositoryProvider,
+                                      final DataBroker dataBroker, final DOMMountPointService mountPointService) {
         this.topologyId = topologyId;
         this.clientDispatcher = clientDispatcher;
         this.bindingAwareBroker = bindingAwareBroker;
@@ -185,11 +182,8 @@ public abstract class AbstractNetconfTopology implements NetconfTopology, Bindin
         this.keepaliveExecutor = keepaliveExecutor;
         this.processingExecutor = processingExecutor;
         this.sharedSchemaRepository = schemaRepositoryProvider.getSharedSchemaRepository();
-    }
-
-    protected void registerToSal(BindingAwareProvider baProvider, Provider provider) {
-        domBroker.registerProvider(provider);
-        bindingAwareBroker.registerProvider(baProvider);
+        this.dataBroker = dataBroker;
+        this.mountPointService = mountPointService;
     }
 
     public void setSchemaRegistry(final SchemaSourceRegistry schemaRegistry) {
@@ -200,9 +194,6 @@ public abstract class AbstractNetconfTopology implements NetconfTopology, Bindin
         this.schemaContextFactory = schemaContextFactory;
     }
 
-    @Override
-    public abstract void onSessionInitiated(ProviderContext session);
-
     @Override
     public ListenableFuture<NetconfDeviceCapabilities> connectNode(NodeId nodeId, Node configNode) {
         LOG.info("Connecting RemoteDevice{{}} , with config {}", nodeId, configNode);
@@ -438,16 +429,6 @@ public abstract class AbstractNetconfTopology implements NetconfTopology, Bindin
 
     protected abstract RemoteDeviceHandler<NetconfSessionPreferences> createSalFacade(final RemoteDeviceId id, final Broker domBroker, final BindingAwareBroker bindingBroker);
 
-    @Override
-    public void onSessionInitiated(ProviderSession session) {
-         mountPointService = session.getService(DOMMountPointService.class);
-    }
-
-    @Override
-    public Collection<ProviderFunctionality> getProviderFunctionality() {
-        return Collections.emptySet();
-    }
-
     private InetSocketAddress getSocketAddress(final Host host, int port) {
         if(host.getDomainName() != null) {
             return new InetSocketAddress(host.getDomainName().getValue(), port);
similarity index 94%
rename from netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/NetconfTopology.java
rename to netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/api/NetconfTopology.java
index b275c7584da82dd8db87cc986d64a15da00ca563..d69e2e272b14ee85f1726030015fcb704598bdbb 100644 (file)
@@ -6,7 +6,7 @@
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.netconf.topology;
+package org.opendaylight.netconf.topology.api;
 
 import com.google.common.util.concurrent.ListenableFuture;
 import org.opendaylight.netconf.sal.connect.netconf.listener.NetconfDeviceCapabilities;
similarity index 91%
rename from netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/SchemaRepositoryProvider.java
rename to netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/api/SchemaRepositoryProvider.java
index e4664d6f3bf160d631511ef46bd6a744cea3c16b..2ceee2bd072dd7e829d2e671402c3f3c520a449a 100644 (file)
@@ -6,7 +6,7 @@
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.netconf.topology;
+package org.opendaylight.netconf.topology.api;
 
 import org.opendaylight.yangtools.yang.parser.repo.SharedSchemaRepository;
 
index 0553a5aa5b4753ccf1af8c94a26c331cefda5177..9b02f0b3d15c82904e4f52c9b0931eabcc1b5b01 100644 (file)
@@ -22,8 +22,8 @@ import org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier;
 import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
 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.dom.api.DOMMountPointService;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
 import org.opendaylight.controller.sal.core.api.Broker;
 import org.opendaylight.netconf.client.NetconfClientDispatcher;
 import org.opendaylight.netconf.sal.connect.api.RemoteDeviceHandler;
@@ -31,7 +31,7 @@ import org.opendaylight.netconf.sal.connect.netconf.listener.NetconfSessionPrefe
 import org.opendaylight.netconf.sal.connect.netconf.sal.NetconfDeviceSalFacade;
 import org.opendaylight.netconf.sal.connect.util.RemoteDeviceId;
 import org.opendaylight.netconf.topology.AbstractNetconfTopology;
-import org.opendaylight.netconf.topology.SchemaRepositoryProvider;
+import org.opendaylight.netconf.topology.api.SchemaRepositoryProvider;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopologyBuilder;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId;
@@ -48,16 +48,16 @@ public class NetconfTopologyImpl extends AbstractNetconfTopology implements Data
 
     private static final Logger LOG = LoggerFactory.getLogger(NetconfTopologyImpl.class);
 
-        private ListenerRegistration<NetconfTopologyImpl> datastoreListenerRegistration = null;
+    private ListenerRegistration<NetconfTopologyImpl> datastoreListenerRegistration = null;
 
     public NetconfTopologyImpl(final String topologyId, final NetconfClientDispatcher clientDispatcher,
                                final BindingAwareBroker bindingAwareBroker, final Broker domBroker,
                                final EventExecutor eventExecutor, final ScheduledThreadPool keepaliveExecutor,
-                               final ThreadPool processingExecutor, final SchemaRepositoryProvider schemaRepositoryProvider) {
+                               final ThreadPool processingExecutor, final SchemaRepositoryProvider schemaRepositoryProvider,
+                               final DataBroker dataBroker, final DOMMountPointService mountPointService) {
         super(topologyId, clientDispatcher,
                 bindingAwareBroker, domBroker, eventExecutor,
-                keepaliveExecutor, processingExecutor, schemaRepositoryProvider);
-        registerToSal(this, this);
+                keepaliveExecutor, processingExecutor, schemaRepositoryProvider, dataBroker, mountPointService);
     }
 
     @Override
@@ -79,10 +79,10 @@ public class NetconfTopologyImpl extends AbstractNetconfTopology implements Data
         return new NetconfDeviceSalFacade(id, domBroker, bindingAwareBroker);
     }
 
-    @Override
-    public void onSessionInitiated(ProviderContext session) {
-        dataBroker = session.getSALService(DataBroker.class);
-
+    /**
+     * Invoke by blueprint
+     */
+    public void init() {
         final WriteTransaction wtx = dataBroker.newWriteOnlyTransaction();
         initTopology(wtx, LogicalDatastoreType.CONFIGURATION);
         initTopology(wtx, LogicalDatastoreType.OPERATIONAL);
diff --git a/netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/impl/SchemaRepositoryProviderImpl.java b/netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/impl/SchemaRepositoryProviderImpl.java
new file mode 100644 (file)
index 0000000..9fc5bee
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * 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.topology.impl;
+
+import org.opendaylight.netconf.topology.api.SchemaRepositoryProvider;
+import org.opendaylight.yangtools.yang.parser.repo.SharedSchemaRepository;
+
+public class SchemaRepositoryProviderImpl implements SchemaRepositoryProvider {
+
+    private final SharedSchemaRepository schemaRepository;
+
+    public SchemaRepositoryProviderImpl(final String moduleName) {
+        schemaRepository = new SharedSchemaRepository(moduleName);
+    }
+
+    @Override
+    public SharedSchemaRepository getSharedSchemaRepository() {
+        return schemaRepository;
+    }
+}
\ No newline at end of file
diff --git a/netconf/netconf-topology/src/main/yang/netconf-topology.yang b/netconf/netconf-topology/src/main/yang/netconf-topology.yang
deleted file mode 100644 (file)
index 8f55e63..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-module netconf-topology {
-
-    yang-version 1;
-    namespace "urn:opendaylight:params:xml:ns:yang:controller:netconf:topology";
-    prefix "nt";
-
-    import config { prefix config; revision-date 2013-04-05; }
-    import threadpool {prefix th;}
-    import netty {prefix netty;}
-    import opendaylight-md-sal-dom {prefix dom;}
-    import opendaylight-md-sal-binding {prefix md-sal-binding; revision-date 2013-10-28;}
-    import odl-netconf-cfg { prefix cfg-net; revision-date 2014-04-08; }
-    import shared-schema-repository { prefix sh; revision-date 2015-07-27; }
-
-    description
-            "Module definition for Netconf topolgy. Netconf topology provides a set of common configuration ";
-
-    revision "2015-07-27" {
-        description
-            "Initial revision";
-    }
-
-    identity netconf-topology {
-        base config:service-type;
-        config:java-class "org.opendaylight.netconf.topology.NetconfTopology";
-    }
-
-    identity netconf-topology-impl {
-        base config:module-type;
-        config:java-name-prefix NetconfTopology;
-        config:provided-service netconf-topology;
-    }
-
-    augment "/config:modules/config:module/config:configuration" {
-        case netconf-topology-impl {
-            when "/config:modules/config:module/config:type = 'netconf-topology-impl'";
-
-            leaf topology-id {
-                mandatory true;
-                type string;
-            }
-
-            container dom-registry {
-                uses config:service-ref {
-                    refine type {
-                        mandatory true;
-                        config:required-identity dom:dom-broker-osgi-registry;
-                    }
-                }
-            }
-
-            container binding-registry {
-                uses config:service-ref {
-                    refine type {
-                        mandatory true;
-                        config:required-identity md-sal-binding:binding-broker-osgi-registry;
-                    }
-                }
-            }
-
-            container event-executor {
-                uses config:service-ref {
-                    refine type {
-                        mandatory true;
-                        config:required-identity netty:netty-event-executor;
-                    }
-                }
-            }
-
-            container processing-executor {
-                uses config:service-ref {
-                    refine type {
-                        mandatory true;
-                        config:required-identity th:threadpool;
-                    }
-                }
-
-                description "Makes up for flaws in netty threading design";
-            }
-
-            container client-dispatcher {
-                uses config:service-ref {
-                    refine type {
-                        mandatory false;
-                        config:required-identity cfg-net:netconf-client-dispatcher;
-                    }
-                }
-            }
-
-            container keepalive-executor {
-                uses config:service-ref {
-                    refine type {
-                        mandatory false;
-                        config:required-identity th:scheduled-threadpool;
-                    }
-                }
-
-                description "Dedicated solely to keepalive execution";
-            }
-
-            container shared-schema-repository {
-                uses config:service-ref {
-                    refine type {
-                        mandatory true;
-                        config:required-identity sh:shared-schema-repository;
-                    }
-                }
-            }
-        }
-    }
-}
\ No newline at end of file
diff --git a/netconf/netconf-topology/src/main/yang/shared-schema-repository.yang b/netconf/netconf-topology/src/main/yang/shared-schema-repository.yang
deleted file mode 100644 (file)
index e5d1f07..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-module shared-schema-repository {
-
-    yang-version 1;
-    namespace "urn:opendaylight:params:xml:ns:yang:controller:netconf:topology:shared:schema:repository";
-    prefix "ssr";
-
-    import config { prefix config; revision-date 2013-04-05; }
-
-    description
-            "Module definition for Shared schema repository.";
-
-    revision "2015-07-27" {
-        description
-            "Initial revision";
-    }
-
-    identity shared-schema-repository {
-        base "config:service-type";
-        config:java-class "org.opendaylight.netconf.topology.SchemaRepositoryProvider";
-    }
-
-    identity shared-schema-repository-impl {
-        base "config:module-type";
-        config:provided-service shared-schema-repository;
-        config:java-name-prefix SchemaRepositoryImpl;
-    }
-
-    augment "/config:modules/config:module/config:configuration" {
-        case shared-schema-repository-impl {
-            when "/config:modules/config:module/config:type = 'shared-schema-repository-impl'";
-
-            container schema-repository-fallbacks {
-                list schema-repository-fallback {
-                    leaf repository-url {
-                        type string;
-                    }
-                }
-            }
-        }
-    }
-}
\ No newline at end of file
index 2a2f2f4125c6d1fd1e3125972e5de531c199eb80..ceb5cf078453b09293b451d8068da4b5d62fcbac 100644 (file)
@@ -37,12 +37,13 @@ import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
 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.md.sal.dom.api.DOMMountPointService;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
 import org.opendaylight.controller.sal.core.api.Broker;
 import org.opendaylight.netconf.client.NetconfClientDispatcher;
 import org.opendaylight.netconf.client.conf.NetconfReconnectingClientConfiguration;
 import org.opendaylight.netconf.sal.connect.netconf.listener.NetconfDeviceCapabilities;
-import org.opendaylight.netconf.topology.SchemaRepositoryProvider;
+import org.opendaylight.netconf.topology.api.SchemaRepositoryProvider;
 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.inet.types.rev130715.IpAddress;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
@@ -90,6 +91,11 @@ public class NetconfTopologyImplTest {
     @Mock
     private SchemaRepositoryProvider mockedSchemaRepositoryProvider;
 
+    @Mock
+    private DataBroker dataBroker;
+
+    @Mock
+    private DOMMountPointService domMountPointService;
 
     private TestingNetconfTopologyImpl topology;
     private TestingNetconfTopologyImpl spyTopology;
@@ -104,21 +110,19 @@ public class NetconfTopologyImplTest {
         when(mockedClientDispatcher.createReconnectingClient(any(NetconfReconnectingClientConfiguration.class))).thenReturn(future);
 
         topology = new TestingNetconfTopologyImpl(TOPOLOGY_ID, mockedClientDispatcher, mockedBindingAwareBroker,
-                mockedDataBroker, mockedEventExecutor, mockedKeepaliveExecutor, mockedProcessingExecutor, mockedSchemaRepositoryProvider);
+                mockedDataBroker, mockedEventExecutor, mockedKeepaliveExecutor, mockedProcessingExecutor, mockedSchemaRepositoryProvider,
+                dataBroker, domMountPointService);
 
         spyTopology = spy(topology);
     }
 
     @Test
-    public void testOnSessionInitiated() {
-        BindingAwareBroker.ProviderContext session = mock(BindingAwareBroker.ProviderContext.class);
-        DataBroker dataBroker = mock(DataBroker.class);
-        when(session.getSALService(DataBroker.class)).thenReturn(dataBroker);
+    public void testInit() {
         WriteTransaction wtx = mock(WriteTransaction.class);
         when(dataBroker.newWriteOnlyTransaction()).thenReturn(wtx);
         doNothing().when(wtx).merge(any(LogicalDatastoreType.class), any(InstanceIdentifier.class), any(DataObject.class));
         when(wtx.submit()).thenReturn(Futures.<Void, TransactionCommitFailedException>immediateCheckedFuture(null));
-        topology.onSessionInitiated(session);
+        topology.init();
 
         //verify initialization of topology
         final InstanceIdentifier<NetworkTopology> networkTopologyId = InstanceIdentifier.builder(NetworkTopology.class).build();
@@ -185,8 +189,13 @@ public class NetconfTopologyImplTest {
 
     public static class TestingNetconfTopologyImpl extends NetconfTopologyImpl {
 
-        public TestingNetconfTopologyImpl(String topologyId, NetconfClientDispatcher clientDispatcher, BindingAwareBroker bindingAwareBroker, Broker domBroker, EventExecutor eventExecutor, ScheduledThreadPool keepaliveExecutor, ThreadPool processingExecutor, SchemaRepositoryProvider schemaRepositoryProvider) {
-            super(topologyId, clientDispatcher, bindingAwareBroker, domBroker, eventExecutor, keepaliveExecutor, processingExecutor, schemaRepositoryProvider);
+        public TestingNetconfTopologyImpl(String topologyId, NetconfClientDispatcher clientDispatcher,
+                                          BindingAwareBroker bindingAwareBroker, Broker domBroker,
+                                          EventExecutor eventExecutor, ScheduledThreadPool keepaliveExecutor,
+                                          ThreadPool processingExecutor, SchemaRepositoryProvider schemaRepositoryProvider,
+                                          DataBroker dataBroker, DOMMountPointService domMountPointService) {
+            super(topologyId, clientDispatcher, bindingAwareBroker, domBroker, eventExecutor, keepaliveExecutor,
+                    processingExecutor, schemaRepositoryProvider, dataBroker, domMountPointService);
         }
 
         @Override