<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>
- <config.netconf.console.configfile>100-netconf-console.xml</config.netconf.console.configfile>
</properties>
<dependencyManagement>
<type>xml</type>
<classifier>config</classifier>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>netconf-config-dispatcher</artifactId>
- </dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>netconf-console</artifactId>
- <version>${project.version}</version>
- </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netconf-console</artifactId>
<version>${project.version}</version>
- <classifier>config</classifier>
- <type>xml</type>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<bundle>mvn:org.opendaylight.controller.model/model-inventory/{{VERSION}}</bundle>
<bundle>mvn:org.opendaylight.netconf/netconf-topology/{{VERSION}}</bundle>
<bundle>mvn:org.opendaylight.netconf/sal-netconf-connector/{{VERSION}}</bundle>
- <bundle>mvn:org.opendaylight.netconf/netconf-config-dispatcher/{{VERSION}}</bundle>
<configfile finalname='${config.configfile.directory}/${config.netconf.client.configfile}'>mvn:org.opendaylight.netconf/netconf-config/{{VERSION}}/xml/config</configfile>
</feature>
<feature version='${project.version}'>odl-netconf-connector-all</feature>
<feature version='${project.version}'>odl-netconf-topology</feature>
<bundle>mvn:org.opendaylight.netconf/netconf-console/{{VERSION}}</bundle>
- <configfile finalname='${config.configfile.directory}/${config.netconf.console.configfile}'>mvn:org.opendaylight.netconf/netconf-console/{{VERSION}}/xml/config</configfile>
</feature>
</features>
<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-impl</artifactId>
</dependency>
- <dependency>
- <groupId>org.opendaylight.netconf</groupId>
- <artifactId>netconf-config-dispatcher</artifactId>
- </dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>config-manager-facade-xml</artifactId>
<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>
<feature version='${config.version}'>odl-config-netty</feature>
<feature version='${project.version}'>odl-netconf-netty-util</feature>
<bundle>mvn:org.opendaylight.netconf/netconf-client/{{VERSION}}</bundle>
- <bundle>mvn:org.opendaylight.netconf/netconf-config-dispatcher/{{VERSION}}</bundle>
<configfile finalname='${config.configfile.directory}/${config.netconf.client.configfile}'>mvn:org.opendaylight.netconf/netconf-config/{{VERSION}}/xml/config</configfile>
</feature>
<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'
return true;
}
+ /**
+ * Invoke by blueprint
+ */
@Override
- public void close() throws Exception {
+ public void close() {
listenerTracker.close();
nullableCredService = null;
}
+++ /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.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);
- }
-
-}
+++ /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: 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));
- }
-}
--- /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">
+
+ <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
+++ /dev/null
-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
- }
- }
-}
+++ /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.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;
- }
-
-}
+++ /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-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 {
-
-}
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;
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
}
@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
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();
- }
}
--- /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="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>
+++ /dev/null
-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;
- }
- }
- }
- }
- }
-
-}
--- /dev/null
+<?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>
--- /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"
+ 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>
--- /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.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
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;
/**
* 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);
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)));
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);
}
+++ /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.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
- }
- }
-}
+++ /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-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 {
-
-}
--- /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="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>
+++ /dev/null
-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;
- }
- }
- }
- }
- }
-
-}
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;
@Mock
private NetconfMonitoringService monitoring;
@Mock
- private BindingAwareBroker.ProviderContext context;
- @Mock
private DataBroker dataBroker;
@Mock
private WriteTransaction writeTransaction;
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);
@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);
@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);
.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);
.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);
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);
@Test
public void testOnSessionInitiated() throws Exception {
- writer.onSessionInitiated(context);
+ writer.start();
verify(monitoring).registerCapabilitiesListener(writer);
}
}
\ No newline at end of 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>
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;
* 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
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();
+ }
+ }
}
+++ /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.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;
- }
-}
+++ /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-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 {
-
-}
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;
* 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
notificationRegistration.close();
}
- @Override
- public void onSessionInitiated(BindingAwareBroker.ProviderContext session) {
- dataBroker = session.getSALService(DataBroker.class);
+ /**
+ * Invoke by blueprint
+ */
+ public void start() {
notificationRegistration = netconfNotificationCollector.registerStreamListener(this);
}
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;
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;
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
baseNotificationPublisherRegistration.onSessionEnded(sessionEnd);
}
+
+ /**
+ * Invoke by blueprint
+ */
+ public void close() {
+ if (baseNotificationPublisherRegistration != null) {
+ baseNotificationPublisherRegistration.close();
+ }
+ if (sessionListenerRegistration != null) {
+ sessionListenerRegistration.close();
+ }
+ }
}
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
@Override
public AutoCloseable registerCapabilityListener(final CapabilityListener listener) {
- return AUTO_CLOSEABLE;
+ return NoopAutoCloseable.INSTANCE;
}
@Override
public void close() {
+ this.netconfOperationServiceFactoryListener.onRemoveNetconfOperationServiceFactory(this);
}
}
--- /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: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>
+++ /dev/null
-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
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;
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
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
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
--- /dev/null
+<?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>
--- /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"
+ 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>
+++ /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.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;
- }
-
-}
+++ /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-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 {
-
-}
* 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);
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);
}
// 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);
}
--- /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="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>
+++ /dev/null
-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
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()));
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
<artifactId>aaa-authn-odl-plugin</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>netconf-config-dispatcher</artifactId>
- <version>${project.version}</version>
- </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>config-netconf-connector</artifactId>
<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>
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
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.opendaylight.odlparent</groupId>
- <artifactId>bundle-parent</artifactId>
- <version>1.8.0-SNAPSHOT</version>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>config-parent</artifactId>
+ <version>0.6.0-SNAPSHOT</version>
<relativePath/>
</parent>
--- /dev/null
+/*
+ * 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.config.netconf.client.dispatcher;
+
+import com.google.common.reflect.AbstractInvocationHandler;
+import com.google.common.reflect.Reflection;
+import java.lang.reflect.Method;
+import org.opendaylight.controller.config.api.osgi.WaitingServiceTracker;
+import org.opendaylight.netconf.client.NetconfClientDispatcher;
+import org.osgi.framework.BundleContext;
+
+/**
+ * @deprecated Replaced by blueprint wiring
+ */
+@Deprecated
+public final class NetconfClientDispatcherModule extends org.opendaylight.controller.config.yang.config.netconf.client.dispatcher.AbstractNetconfClientDispatcherModule {
+
+ private BundleContext bundleContext;
+
+ public NetconfClientDispatcherModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+ super(identifier, dependencyResolver);
+ }
+
+ public NetconfClientDispatcherModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
+ NetconfClientDispatcherModule oldModule, java.lang.AutoCloseable oldInstance) {
+
+ super(identifier, dependencyResolver, oldModule, oldInstance);
+ }
+
+ @Override
+ protected void customValidation(){
+ }
+
+ @Override
+ public java.lang.AutoCloseable createInstance() {
+ final WaitingServiceTracker<NetconfClientDispatcher> tracker =
+ WaitingServiceTracker.create(NetconfClientDispatcher.class, bundleContext, "(type=netconf-client-dispatcher)");
+ final NetconfClientDispatcher service = tracker.waitForService(WaitingServiceTracker.FIVE_MINUTES);
+
+ return Reflection.newProxy(AutoCloseableNetconfClientDispatcher.class, new AbstractInvocationHandler() {
+ @Override
+ protected Object handleInvocation(Object proxy, Method method, Object[] args) throws Throwable {
+ if (method.getName().equals("close")) {
+ tracker.close();
+ return null;
+ } else {
+ return method.invoke(service, args);
+ }
+ }
+ });
+ }
+
+ void setBundleContext(BundleContext bundleContext) {
+ this.bundleContext = bundleContext;
+ }
+
+ private static interface AutoCloseableNetconfClientDispatcher extends NetconfClientDispatcher, AutoCloseable {
+ }
+}
--- /dev/null
+/*
+ * 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.config.netconf.client.dispatcher;
+
+import org.opendaylight.controller.config.api.DependencyResolver;
+import org.osgi.framework.BundleContext;
+
+/**
+ * @deprecated Replaced by blueprint wiring
+ */
+@Deprecated
+public class NetconfClientDispatcherModuleFactory extends AbstractNetconfClientDispatcherModuleFactory {
+ @Override
+ public NetconfClientDispatcherModule instantiateModule(String instanceName, DependencyResolver dependencyResolver,
+ NetconfClientDispatcherModule oldModule, AutoCloseable oldInstance, BundleContext bundleContext) {
+ NetconfClientDispatcherModule module = super.instantiateModule(instanceName, dependencyResolver, oldModule,
+ oldInstance, bundleContext);
+ module.setBundleContext(bundleContext);
+ return module;
+ }
+
+ @Override
+ public NetconfClientDispatcherModule instantiateModule(String instanceName, DependencyResolver dependencyResolver,
+ BundleContext bundleContext) {
+ NetconfClientDispatcherModule module = super.instantiateModule(instanceName, dependencyResolver, bundleContext);
+ module.setBundleContext(bundleContext);
+ return module;
+ }
+}
--- /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="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="timer" interface="io.netty.util.Timer" odl:type="global-timer"/>
+
+ <bean id="netconfClientDispatcherImpl"
+ class="org.opendaylight.netconf.client.NetconfClientDispatcherImpl">
+ <argument ref="globalBossGroup"/>
+ <argument ref="globalWorkerGroup"/>
+ <argument ref="timer"/>
+ </bean>
+ <service ref="netconfClientDispatcherImpl"
+ interface="org.opendaylight.netconf.client.NetconfClientDispatcher"
+ odl:type="netconf-client-dispatcher">
+ <service-properties>
+ <entry key="config-module-namespace" value="urn:opendaylight:params:xml:ns:yang:controller:config:netconf"/>
+ <entry key="config-module-name" value="netconf-client-dispatcher"/>
+ <entry key="config-instance-name" value="global-netconf-dispatcher"/>
+ </service-properties>
+ </service>
+
+</blueprint>
--- /dev/null
+// vi: set smarttab et sw=4 tabstop=4:
+module odl-netconf-cfg {
+
+ yang-version 1;
+ namespace "urn:opendaylight:params:xml:ns:yang:controller:config:netconf";
+ prefix "cfg-net";
+
+ import config { prefix config; revision-date 2013-04-05; }
+
+ description
+ "This module contains the base YANG definitions for
+ netconf related services.
+
+ 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 "2014-04-08" {
+ description
+ "Initial revision.";
+ }
+
+ // We keep this as sal-netconf-connector and netconf-topology need it.
+ // Once they will be moved to blueprint, it will be safe to delete all
+ // together the netconf-config-dispatcher bundle.
+ identity netconf-client-dispatcher {
+ base "config:service-type";
+ config:java-class "org.opendaylight.netconf.client.NetconfClientDispatcher";
+ config:disable-osgi-service-registration;
+ status deprecated;
+ }
+}
\ No newline at end of file
--- /dev/null
+// vi: set smarttab et sw=4 tabstop=4:
+module odl-netconfig-client-cfg {
+
+ yang-version 1;
+ namespace "urn:opendaylight:params:xml:ns:yang:controller:config:netconf:client:dispatcher";
+ prefix "cfg-net-client";
+
+ import config { prefix config; revision-date 2013-04-05; }
+ import odl-netconf-cfg { prefix cfg-net; revision-date 2014-04-08; }
+ import netty {prefix netty; }
+
+ description
+ "This module contains the base YANG definitions for
+ netconf-client-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 "2014-04-08" {
+ description
+ "Initial revision.";
+ }
+
+ identity netconf-client-dispatcher {
+ base config:module-type;
+ config:provided-service cfg-net:netconf-client-dispatcher;
+ config:java-name-prefix NetconfClientDispatcher;
+ }
+
+ augment "/config:modules/config:module/config:configuration" {
+ case netconf-client-dispatcher {
+ when "/config:modules/config:module/config:type = 'netconf-client-dispatcher'";
+ }
+ }
+
+}
\ No newline at end of file
<capability>urn:ietf:params:xml:ns:yang:ietf-network-topology?module=ietf-network-topology&revision=2015-06-08</capability>
<capability>urn:ietf:params:xml:ns:yang:ietf-netconf-notifications?module=ietf-netconf-notifications&revision=2012-02-06</capability>
<capability>urn:TBD:params:xml:ns:yang:ospf-topology?module=ospf-topology&revision=2013-10-21</capability>
- <capability>config:aaa:authn:netconf:plugin?module=aaa-authn-netconf-plugin&revision=2015-07-15</capability>
<capability>urn:opendaylight:params:xml:ns:yang:controller:config:netconf:auth?module=netconf-auth&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&revision=2014-06-17</capability>
<capability>urn:ietf:params:xml:ns:yang:ospf-topology?module=ospf-topology&revision=2013-07-12</capability>
-->
<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/maven-v4_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>
+ <parent>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>binding-parent</artifactId>
+ <version>0.10.0-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+
+ <!--TODO Delete this bundle as soon as https://git.opendaylight.org/gerrit/#/c/46621/ is merged.-->
<groupId>org.opendaylight.netconf</groupId>
<artifactId>netconf-config-dispatcher</artifactId>
+++ /dev/null
-/*
- * 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.config.netconf.client.dispatcher;
-
-import org.opendaylight.netconf.client.NetconfClientDispatcherImpl;
-
-/**
-*
-*/
-public final class NetconfClientDispatcherModule extends org.opendaylight.controller.config.yang.config.netconf.client.dispatcher.AbstractNetconfClientDispatcherModule {
-
- public NetconfClientDispatcherModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
- super(identifier, dependencyResolver);
- }
-
- public NetconfClientDispatcherModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
- NetconfClientDispatcherModule oldModule, java.lang.AutoCloseable oldInstance) {
-
- super(identifier, dependencyResolver, oldModule, oldInstance);
- }
-
- @Override
- protected void customValidation(){
- }
-
- @Override
- public java.lang.AutoCloseable createInstance() {
- return new NetconfClientDispatcherImpl(getBossThreadGroupDependency(), getWorkerThreadGroupDependency(), getTimerDependency());
- }
-}
+++ /dev/null
-/*
- * 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.config.netconf.client.dispatcher;
-
-/**
-*
-*/
-public class NetconfClientDispatcherModuleFactory extends org.opendaylight.controller.config.yang.config.netconf.client.dispatcher.AbstractNetconfClientDispatcherModuleFactory
-{
-
-
-}
// vi: set smarttab et sw=4 tabstop=4:
module odl-netconf-cfg {
+/**
+* TODO Delete this YANG file as soon as https://git.opendaylight.org/gerrit/#/c/46621/ is merged.
+*/
+
yang-version 1;
namespace "urn:opendaylight:params:xml:ns:yang:controller:config:netconf";
prefix "cfg-net";
}
identity netconf-client-dispatcher {
-
base "config:service-type";
config:java-class "org.opendaylight.netconf.client.NetconfClientDispatcher";
}
// vi: set smarttab et sw=4 tabstop=4:
module odl-netconfig-client-cfg {
+/**
+* TODO Delete this YANG file as soon as https://git.opendaylight.org/gerrit/#/c/46621/ is merged.
+*/
+
yang-version 1;
namespace "urn:opendaylight:params:xml:ns:yang:controller:config:netconf:client:dispatcher";
prefix "cfg-net-client";
augment "/config:modules/config:module/config:configuration" {
case netconf-client-dispatcher {
when "/config:modules/config:module/config:type = 'netconf-client-dispatcher'";
-
- 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;
- }
- }
- }
-
- container timer {
- uses config:service-ref {
- refine type {
- config:required-identity netty:netty-timer;
- }
- }
- }
}
}
+++ /dev/null
-/*
- * 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.config.netconf.client.dispatcher;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Matchers.contains;
-import static org.mockito.Mockito.doAnswer;
-import static org.mockito.Mockito.doNothing;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-import javax.management.InstanceAlreadyExistsException;
-import javax.management.InstanceNotFoundException;
-import javax.management.ObjectName;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
-import org.opendaylight.controller.config.api.ConflictingVersionException;
-import org.opendaylight.controller.config.api.ValidationException;
-import org.opendaylight.controller.config.api.jmx.CommitStatus;
-import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;
-import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;
-import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
-import org.opendaylight.controller.config.yang.netty.threadgroup.NettyThreadgroupModuleFactory;
-import org.opendaylight.controller.config.yang.netty.threadgroup.NettyThreadgroupModuleMXBean;
-import org.opendaylight.controller.config.yang.netty.timer.HashedWheelTimerModuleFactory;
-import org.osgi.framework.Filter;
-import org.osgi.framework.ServiceListener;
-import org.osgi.framework.ServiceReference;
-import io.netty.channel.EventLoopGroup;
-import io.netty.util.Timer;
-
-public class NetconfClientDispatcherModuleTest extends AbstractConfigTest{
-
- private NetconfClientDispatcherModuleFactory factory;
- private final String instanceName = "dispatch";
-
- @Before
- public void setUp() throws Exception {
- factory = new NetconfClientDispatcherModuleFactory();
- super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(mockedContext,factory,
- new NettyThreadgroupModuleFactory(),
- new HashedWheelTimerModuleFactory()));
-
- doAnswer(new Answer<Filter>() {
- @Override
- public Filter answer(InvocationOnMock invocation) {
- String str = invocation.getArgumentAt(0, String.class);
- Filter mockFilter = mock(Filter.class);
- doReturn(str).when(mockFilter).toString();
- return mockFilter;
- }
- }).when(mockedContext).createFilter(anyString());
- doNothing().when(mockedContext).addServiceListener(any(ServiceListener.class), anyString());
-
- setupMockService(EventLoopGroup.class);
- setupMockService(Timer.class);
- }
-
- private void setupMockService(Class<?> serviceInterface) throws Exception {
- ServiceReference<?> mockServiceRef = mock(ServiceReference.class);
- doReturn(new ServiceReference[]{mockServiceRef}).when(mockedContext).
- getServiceReferences(anyString(), contains(serviceInterface.getName()));
- doReturn(mock(serviceInterface)).when(mockedContext).getService(mockServiceRef);
- }
-
- @Test
- public void testCreateBean() throws InstanceAlreadyExistsException, ValidationException, ConflictingVersionException {
- ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
-
- createInstance(transaction, instanceName, "timer", "thGroup");
- createInstance(transaction, instanceName + 2, "timer2", "thGroup2");
- transaction.validateConfig();
- CommitStatus status = transaction.commit();
-
- assertBeanCount(2, factory.getImplementationName());
- assertStatus(status, 2 + 4, 0, 0);
- }
-
- @Test
- public void testReusingOldInstance() throws InstanceAlreadyExistsException, ConflictingVersionException, ValidationException {
-
- ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
- createInstance(transaction, instanceName, "timer", "thGroup");
-
- transaction.commit();
-
- transaction = configRegistryClient.createTransaction();
- assertBeanCount(1, factory.getImplementationName());
- CommitStatus status = transaction.commit();
-
- assertBeanCount(1, factory.getImplementationName());
- assertStatus(status, 0, 0, 3);
- }
-
- @Test
- public void testReconfigure() throws InstanceAlreadyExistsException, ConflictingVersionException,
- ValidationException, InstanceNotFoundException {
-
- ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
- createInstance(transaction, instanceName, "timer", "thGroup");
-
- transaction.commit();
-
- transaction = configRegistryClient.createTransaction();
- assertBeanCount(1, factory.getImplementationName());
- NetconfClientDispatcherModuleMXBean mxBean = transaction.newMBeanProxy(
- transaction.lookupConfigBean(NetconfClientDispatcherModuleFactory.NAME, instanceName),
- NetconfClientDispatcherModuleMXBean.class);
- mxBean.setBossThreadGroup(getThreadGroup(transaction, "group2"));
- CommitStatus status = transaction.commit();
-
- assertBeanCount(1, factory.getImplementationName());
- assertStatus(status, 1, 1, 2);
- }
-
- private ObjectName createInstance(ConfigTransactionJMXClient transaction, String instanceName, String timerName, String threadGroupName)
- throws InstanceAlreadyExistsException {
- ObjectName nameCreated = transaction.createModule(factory.getImplementationName(), instanceName);
- NetconfClientDispatcherModuleMXBean mxBean = transaction.newMBeanProxy(nameCreated, NetconfClientDispatcherModuleMXBean.class);
- ObjectName thGroup = getThreadGroup(transaction, threadGroupName);
- mxBean.setBossThreadGroup(thGroup);
- mxBean.setWorkerThreadGroup(thGroup);
- mxBean.setTimer(getTimer(transaction, timerName));
- return nameCreated;
- }
-
- private ObjectName getTimer(ConfigTransactionJMXClient transaction, String name) throws InstanceAlreadyExistsException {
- return transaction.createModule(HashedWheelTimerModuleFactory.NAME, name);
- }
-
- private ObjectName getThreadGroup(ConfigTransactionJMXClient transaction, String name) throws InstanceAlreadyExistsException {
- ObjectName nameCreated = transaction.createModule(NettyThreadgroupModuleFactory.NAME, name);
- NettyThreadgroupModuleMXBean mxBean = transaction.newMXBeanProxy(nameCreated, NettyThreadgroupModuleMXBean.class);
- mxBean.setThreadCount(1);
- return nameCreated;
- }
-}
<module>
<type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:netconf:client:dispatcher">prefix:netconf-client-dispatcher</type>
<name>global-netconf-dispatcher</name>
- <boss-thread-group xmlns="urn:opendaylight:params:xml:ns:yang:controller:config:netconf:client:dispatcher">
- <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:client:dispatcher">
- <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:client:dispatcher">
- <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netty">prefix:netty-timer</type>
- <name>global-timer</name>
- </timer>
</module>
<!-- Thread factory to be used by all threadpools in netconf-connectors -->
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (c) 2016 Inocybe Technologies. 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 INTERNAL
--->
-<snapshot>
- <required-capabilities>
- <capability>urn:opendaylight:netconf:console:provider:impl?module=netconf-console-provider-impl&revision=2016-03-23</capability>
- <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding?module=opendaylight-md-sal-binding&revision=2013-10-28</capability>
- </required-capabilities>
-
- <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:netconf:console:provider:impl">prefix:netconf-console-provider-impl</type>
- <name>netconf-console-default</name>
- <broker>
- <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-broker-osgi-registry</type>
- <name>binding-osgi-broker</name>
- </broker>
- </module>
- </modules>
- </data>
- </configuration>
-</snapshot>
\ No newline at end of file
package org.opendaylight.netconf.console.commands;
+import com.google.common.base.Strings;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import com.google.common.base.Strings;
-
public class NetconfCommandUtils {
private static final Pattern IP_PATTERN = Pattern.compile(
package org.opendaylight.netconf.console.commands;
import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Strings;
import org.apache.karaf.shell.commands.Command;
import org.apache.karaf.shell.commands.Option;
import org.apache.karaf.shell.console.AbstractAction;
import org.opendaylight.netconf.console.api.NetconfCommands;
-import com.google.common.base.Strings;
-
@Command(name = "netconf:disconnect-device", scope = "netconf", description = "Disconnect netconf device.")
public class NetconfDisconnectDeviceCommand extends AbstractAction {
package org.opendaylight.netconf.console.commands;
import java.util.Map;
-
import javax.annotation.Nonnull;
-
import org.apache.karaf.shell.commands.Command;
import org.apache.karaf.shell.console.AbstractAction;
import org.apache.karaf.shell.table.ShellTable;
import com.google.common.annotations.VisibleForTesting;
import java.util.HashMap;
import java.util.Map;
-
import org.apache.karaf.shell.commands.Command;
import org.apache.karaf.shell.commands.Option;
import org.apache.karaf.shell.console.AbstractAction;
import java.util.UUID;
import java.util.stream.Collectors;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.MountPointService;
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;
private static final Logger LOG = LoggerFactory.getLogger(NetconfCommandsImpl.class);
private final DataBroker dataBroker;
- private final MountPointService mountPointService;
- public NetconfCommandsImpl(final DataBroker db, final MountPointService mountPointService) {
+ public NetconfCommandsImpl(final DataBroker db) {
LOG.debug("NetconfConsoleProviderImpl initialized");
this.dataBroker = db;
- this.mountPointService = mountPointService;
}
@Override
public Map<String, Map<String, String>> listDevices() {
final Topology topology = NetconfConsoleUtils.read(LogicalDatastoreType.OPERATIONAL, NetconfIidFactory.NETCONF_TOPOLOGY_IID, dataBroker);
+ if (topology == null) {
+ return new HashMap<>();
+ }
final Map<String, Map<String, String>> netconfNodes = new HashMap<>();
for (final Node node : topology.getNode()) {
final NetconfNode netconfNode = node.getAugmentation(NetconfNode.class);
+++ /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.console.impl;
-
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.MountPointService;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
-import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
-import org.opendaylight.netconf.console.api.NetconfCommands;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.FrameworkUtil;
-import org.osgi.framework.ServiceRegistration;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class NetconfConsoleProvider implements BindingAwareProvider, AutoCloseable {
-
- private static final Logger LOG = LoggerFactory.getLogger(NetconfConsoleProvider.class);
- private ServiceRegistration<NetconfCommands> netconfConsoleRegistration;
-
- @Override
- public void onSessionInitiated(ProviderContext session) {
- LOG.info("NetconfProvider Session Initiated");
-
- // Retrieve DataBroker service to interact with md-sal
- final DataBroker dataBroker = session.getSALService(DataBroker.class);
-
- // Retrieve MountPointService to interact with NETCONF remote devices connected to ODL and register it
- final MountPointService mountService = session.getSALService(MountPointService.class);
- final BundleContext context = FrameworkUtil.getBundle(this.getClass()).getBundleContext();
-
- // Initialization of NETCONF Console Provider service implementation
- initializeNetconfConsoleProvider(dataBroker, context, mountService);
- }
-
- private void initializeNetconfConsoleProvider(DataBroker dataBroker, BundleContext context, MountPointService mountService) {
- // Initialize NetconfConsoleProviderImpl class
- final NetconfCommandsImpl consoleProvider = new NetconfCommandsImpl(dataBroker, mountService);
-
- // Register the NetconfConsoleProvider service
- netconfConsoleRegistration = context.registerService(NetconfCommands.class, consoleProvider, null);
- }
-
- @Override
- public void close() throws Exception {
- LOG.info("NetconfProvider closed.");
- netconfConsoleRegistration.unregister();
- }
-}
+++ /dev/null
-package org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.console.provider.impl.rev160323;
-
-import org.opendaylight.netconf.console.impl.NetconfConsoleProvider;
-
-public class NetconfConsoleProviderModule extends org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.console.provider.impl.rev160323.AbstractNetconfConsoleProviderModule {
- public NetconfConsoleProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
- super(identifier, dependencyResolver);
- }
-
- public NetconfConsoleProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.console.provider.impl.rev160323.NetconfConsoleProviderModule 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 NetconfConsoleProvider provider = new NetconfConsoleProvider();
- getBrokerDependency().registerProvider(provider);
- return provider;
- }
-}
+++ /dev/null
-/*
-* Generated file
-*
-* Generated from: yang module name: netconf-console-provider-impl yang module local name: netconf-console-provider-impl
-* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
-* Generated at: Wed Mar 23 18:01:12 EDT 2016
-*
-* Do not modify this file unless it is present under src/main directory
-*/
-package org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.console.provider.impl.rev160323;
-public class NetconfConsoleProviderModuleFactory extends org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.console.provider.impl.rev160323.AbstractNetconfConsoleProviderModuleFactory {
-
-}
+++ /dev/null
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
- <reference id="netconfConsoleProvider" availability="mandatory"
- activation="eager" interface="org.opendaylight.netconf.console.api.NetconfCommands">
- </reference>
- <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.0.0">
- <command name="netconf:connect-device">
- <action class="org.opendaylight.netconf.console.commands.NetconfConnectDeviceCommand">
- <argument ref="netconfConsoleProvider"/>
- </action>
- </command>
- <command name="netconf:list-devices">
- <action class="org.opendaylight.netconf.console.commands.NetconfListDevicesCommand">
- <argument ref="netconfConsoleProvider"/>
- </action>
- </command>
- <command name="netconf:show-device">
- <action class="org.opendaylight.netconf.console.commands.NetconfShowDeviceCommand">
- <argument ref="netconfConsoleProvider"/>
- </action>
- </command>
- <command name="netconf:disconnect-device">
- <action class="org.opendaylight.netconf.console.commands.NetconfDisconnectDeviceCommand">
- <argument ref="netconfConsoleProvider"/>
- </action>
- </command>
- <command name="netconf:update-device">
- <action class="org.opendaylight.netconf.console.commands.NetconfUpdateDeviceCommand">
- <argument ref="netconfConsoleProvider"/>
- </action>
- </command>
- </command-bundle>
-</blueprint>
\ 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="dataBroker"
+ interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"
+ odl:type="default"/>
+
+ <bean id="netconfCommandsImpl" class="org.opendaylight.netconf.console.impl.NetconfCommandsImpl">
+ <argument ref="dataBroker"/>
+ </bean>
+ <service ref="netconfCommandsImpl" interface="org.opendaylight.netconf.console.api.NetconfCommands" />
+
+ <!--Karaf CLI-->
+
+ <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.0.0">
+ <command name="netconf:connect-device">
+ <action class="org.opendaylight.netconf.console.commands.NetconfConnectDeviceCommand">
+ <argument ref="netconfCommandsImpl"/>
+ </action>
+ </command>
+ <command name="netconf:list-devices">
+ <action class="org.opendaylight.netconf.console.commands.NetconfListDevicesCommand">
+ <argument ref="netconfCommandsImpl"/>
+ </action>
+ </command>
+ <command name="netconf:show-device">
+ <action class="org.opendaylight.netconf.console.commands.NetconfShowDeviceCommand">
+ <argument ref="netconfCommandsImpl"/>
+ </action>
+ </command>
+ <command name="netconf:disconnect-device">
+ <action class="org.opendaylight.netconf.console.commands.NetconfDisconnectDeviceCommand">
+ <argument ref="netconfCommandsImpl"/>
+ </action>
+ </command>
+ <command name="netconf:update-device">
+ <action class="org.opendaylight.netconf.console.commands.NetconfUpdateDeviceCommand">
+ <argument ref="netconfCommandsImpl"/>
+ </action>
+ </command>
+ </command-bundle>
+
+</blueprint>
+++ /dev/null
-module netconf-console-provider-impl {
- namespace "urn:opendaylight:netconf:console:provider:impl";
- prefix "netconf-console-provider-impl";
-
- import config { prefix config; revision-date 2013-04-05; }
- import opendaylight-md-sal-binding { prefix mdsal; revision-date 2013-10-28; }
-
- revision 2016-03-23 {
- description "Initial revision";
- }
-
- identity netconf-console-provider-impl {
- base config:module-type;
- config:java-name-prefix NetconfConsoleProvider;
- }
-
- augment "/config:modules/config:module/config:configuration" {
- case netconf-console-provider-impl {
- when "/config:modules/config:module/config:type = 'netconf-console-provider-impl'";
- container broker {
- uses config:service-ref {
- refine type {
- mandatory true;
- config:required-identity mdsal:binding-broker-osgi-registry;
- }
- }
- }
- }
- }
-}
\ No newline at end of file
bindingToNormalized.onGlobalContextUpdated(schemaContext);
dataBroker = new BindingDOMDataBrokerAdapter(cDOMDataBroker, bindingToNormalized);
- final MountPointService mountPointService = mock(MountPointService.class);
- netconfCommands = new NetconfCommandsImpl(dataBroker, mountPointService);
+ netconfCommands = new NetconfCommandsImpl(dataBroker);
}
@Test
+++ /dev/null
-/*
- * 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.netconf.console.impl;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.powermock.api.mockito.PowerMockito.when;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.BDDMockito;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.MountPointService;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
-import org.opendaylight.netconf.console.api.NetconfCommands;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.FrameworkUtil;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-@RunWith(PowerMockRunner.class)
-@PrepareForTest(FrameworkUtil.class)
-public class NetconfConsoleProviderTest {
-
- @Test
- public void testProvider() throws Exception {
- final NetconfConsoleProvider netconfConsoleProvider = new NetconfConsoleProvider();
-
- PowerMockito.mockStatic(FrameworkUtil.class);
-
- final BindingAwareBroker.ProviderContext session = mock(BindingAwareBroker.ProviderContext.class);
- final MountPointService mountPointService = mock(MountPointService.class);
- final BundleContext bundleContext = mock(BundleContext.class);
- final DataBroker dataBroker = mock(DataBroker.class);
- final Bundle bundle = mock(Bundle.class);
-
- doReturn(dataBroker).when(session).getSALService(DataBroker.class);
- doReturn(mountPointService).when(session).getSALService(MountPointService.class);
- BDDMockito.given(FrameworkUtil.getBundle(any())).willReturn(bundle);
- when(bundle.getBundleContext()).thenReturn(bundleContext);
-
- netconfConsoleProvider.onSessionInitiated(session);
-
- verify(bundleContext, times(1)).registerService(eq(NetconfCommands.class), any(NetconfCommandsImpl.class), eq(null));
-
- }
-}
+++ /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.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();
- }
-
-}
+++ /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-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 {
-
-}
+++ /dev/null
-/*
- * 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;
- }
-
-
-}
+++ /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-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 {
-
-}
+++ /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.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());
- }
-
-}
+++ /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-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 {
-
-}
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;
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;
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) {
}
@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());
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;
}
};
- 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) {
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) {
+++ /dev/null
-// 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
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
+++ /dev/null
-<?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>
+++ /dev/null
-<?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&revision=2015-01-14</capability>
- <capability>urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:monitoring?module=netconf-mdsal-monitoring&revision=2015-02-18</capability>
- <capability>urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:ssh?module=netconf-northbound-ssh&revision=2015-01-14</capability>
- <capability>urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:tcp?module=netconf-northbound-tcp&revision=2015-04-23</capability>
- <capability>urn:opendaylight:params:xml:ns:yang:controller:config:netconf:northbound:impl?module=netconf-northbound-impl&revision=2015-01-12</capability>
- <capability>urn:opendaylight:params:xml:ns:yang:controller:threadpool:impl:scheduled?module=threadpool-impl-scheduled&revision=2013-12-01</capability>
- <capability>urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:notification?module=netconf-mdsal-notification&revision=2015-08-03</capability>
- <capability>urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:yang:library?module=netconf-mdsal-yang-library&revision=2016-06-17</capability>
- </required-capabilities>
-</snapshot>
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
+++ /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.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();
- }
-
-}
+++ /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-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 {
-
-}
+++ /dev/null
-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
+++ /dev/null
-/*
- * 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);
- }
- }
- }
-}
+++ /dev/null
-/*
- * 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 {
-
-}
--- /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.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);
+ }
+ }
+}
+++ /dev/null
-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;
- }
- }
- }
-
- }
- }
-
-}
LOG.trace("{}: Submit[{}} via NETCONF", id, writeTx.getIdentifier());
final CheckedFuture<Void, TransactionCommitFailedException> submitFuture = writeTx.submit();
+ writeTx = null;
+
final DefaultPromise<Void> promise = new DefaultPromise<>();
Futures.addCallback(submitFuture, new FutureCallback<Void>() {
@Override
public void onSuccess(final Void result) {
promise.success(result);
- writeTx = null;
}
@Override
public void onFailure(@Nonnull final Throwable throwable) {
promise.failure(throwable);
- writeTx = null;
}
});
return promise.future();
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>mdsal-binding-generator-impl</artifactId>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>netconf-config-dispatcher</artifactId>
- </dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>sal-core-api</artifactId>
+++ /dev/null
-/*
- * 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.netconf.util;
-
-public class NetconfTopologyPathCreator {
-
- public static final String CLUSTERED_DEVICE_SOURCES_RESOLVER = "clusteredDeviceSourcesResolver";
- public static final String MASTER_SOURCE_PROVIDER
- = "masterSourceProvider";
-
- private static final String USER = "/user/";
-
- private String mainPath;
-
- public NetconfTopologyPathCreator(final String topologyId) {
- mainPath = createMainPath("", topologyId);
- }
-
- public NetconfTopologyPathCreator(final String memberAddress, final String topologyId) {
- mainPath = createMainPath(memberAddress, topologyId);
- }
-
- private String createMainPath(final String memberAddress, final String topologyId) {
- return memberAddress + USER + topologyId;
- }
-
- public NetconfTopologyPathCreator withSuffix(final String suffix) {
- mainPath += "/"+suffix;
- return this;
- }
-
- public String build(){
- return mainPath;
- }
-
-}
+++ /dev/null
-/*
- * Copyright (c) 2013 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.netconf.util.xml;
-
-import com.google.common.base.Preconditions;
-import java.io.IOException;
-import java.io.InputStream;
-import javax.xml.transform.Source;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.validation.Schema;
-import javax.xml.validation.Validator;
-import org.opendaylight.controller.config.util.xml.XmlUtil;
-import org.w3c.dom.Document;
-import org.xml.sax.SAXException;
-
-public final class XmlNetconfValidator {
-
- private static final Schema SCHEMA;
-
- private XmlNetconfValidator() {}
-
- static {
- final InputStream xmlSchema = XmlNetconfValidator.class.getResourceAsStream("/xml.xsd");
- Preconditions.checkNotNull(xmlSchema, "Cannot find xml.xsd");
-
- final InputStream rfc4714Schema = XmlNetconfValidator.class.getResourceAsStream("/rfc4741.xsd");
- Preconditions.checkNotNull(rfc4714Schema, "Cannot find rfc4741.xsd");
- SCHEMA = XmlUtil.loadSchema(xmlSchema, rfc4714Schema);
- }
-
- public static void validate(Document inputDocument) throws SAXException, IOException {
- final Validator validator = SCHEMA.newValidator();
- final Source source = new DOMSource(inputDocument);
- validator.validate(source);
- }
-}
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
+import java.util.Collections;
+import javax.xml.transform.dom.DOMResult;
+import org.custommonkey.xmlunit.Diff;
+import org.custommonkey.xmlunit.XMLUnit;
+import org.junit.Assert;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.opendaylight.controller.config.util.xml.XmlUtil;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.$YangModuleInfoImpl;
+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;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.sessions.Session;
+import org.opendaylight.yangtools.sal.binding.generator.impl.ModuleInfoBackedContext;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
+import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
+import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
+import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
+import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.SchemaPath;
import org.w3c.dom.Document;
public class NetconfUtilTest {
+ @BeforeClass
+ public static void classSetUp() {
+ XMLUnit.setIgnoreWhitespace(true);
+ }
+
@Test
public void testConflictingVersionDetection() throws Exception {
- Document document = XmlUtil.readXmlToDocument(getClass().getResourceAsStream("/netconfMessages/conflictingversion/conflictingVersionResponse.xml"));
+ final Document document = XmlUtil.readXmlToDocument(getClass().getResourceAsStream("/netconfMessages/conflictingversion/conflictingVersionResponse.xml"));
try{
NetconfUtil.checkIsMessageOk(document);
fail();
- }catch(IllegalStateException e){
+ } catch (final IllegalStateException e) {
assertThat(e.getMessage(), containsString("Optimistic lock failed. Expected parent version 21, was 18"));
}
}
+
+ @Test
+ public void testWriteNormalizedNode() throws Exception {
+ final ModuleInfoBackedContext moduleInfoBackedContext = ModuleInfoBackedContext.create();
+ moduleInfoBackedContext.addModuleInfos(Collections.singletonList($YangModuleInfoImpl.getInstance()));
+ final SchemaContext context = moduleInfoBackedContext.getSchemaContext();
+ final LeafNode username = Builders.leafBuilder()
+ .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(QName.create(Session.QNAME, "username")))
+ .withValue("admin")
+ .build();
+ final MapEntryNode session1 = Builders.mapEntryBuilder()
+ .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifierWithPredicates(Session.QNAME, QName.create(Session.QNAME, "session-id"), 1L))
+ .withChild(username)
+ .build();
+ final MapNode sessionList = Builders.mapBuilder()
+ .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(Session.QNAME))
+ .withChild(session1)
+ .build();
+ final ContainerNode sessions = Builders.containerBuilder()
+ .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(Sessions.QNAME))
+ .withChild(sessionList)
+ .build();
+ final DOMResult result = new DOMResult(XmlUtil.newDocument());
+ final SchemaPath path = SchemaPath.create(true, NetconfState.QNAME);
+ NetconfUtil.writeNormalizedNode(sessions, result, path, context);
+ final Document expected = XmlUtil.readXmlToDocument(getClass().getResourceAsStream("/sessions.xml"));
+ final Document actual = (Document) result.getNode();
+ final Diff diff = XMLUnit.compareXML(expected, actual);
+ Assert.assertTrue(diff.toString(), diff.similar());
+ }
}
--- /dev/null
+<!--
+ ~ 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
+ -->
+
+<sessions xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring">
+ <session>
+ <session-id>1</session-id>
+ <username>admin</username>
+ </session>
+</sessions>
\ No newline at end of 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>
<module>netconf-client</module>
+ <!--TODO Delete netconf-config-dispatcher bundle as soon as https://git.opendaylight.org/gerrit/#/c/46621/ is merged.-->
<module>netconf-config-dispatcher</module>
<module>netconf-ssh</module>
<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>
</dependencyManagement>
<dependencies>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>netconf-config-dispatcher</artifactId>
- </dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>sal-common-util</artifactId>