<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>
<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">
<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>
<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>
+++ /dev/null
-<?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&revision=2015-07-27</capability>
- </required-capabilities>
-</snapshot>
\ No newline at end of file
--- /dev/null
+<?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
+++ /dev/null
-/*
- * 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());
- }
-
-}
+++ /dev/null
-/*
- * 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 {
-
-}
+++ /dev/null
-/*
- * 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;
- }
- }
-}
+++ /dev/null
-/*
- * 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);
- }
-}
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;
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;
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;
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);
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;
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) {
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);
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);
* 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;
* 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;
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;
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;
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
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);
--- /dev/null
+/*
+ * 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
+++ /dev/null
-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
+++ /dev/null
-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
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;
@Mock
private SchemaRepositoryProvider mockedSchemaRepositoryProvider;
+ @Mock
+ private DataBroker dataBroker;
+
+ @Mock
+ private DOMMountPointService domMountPointService;
private TestingNetconfTopologyImpl topology;
private TestingNetconfTopologyImpl spyTopology;
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();
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