<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>
<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>
--- /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>
<artifactId>mdsal-netconf-notification</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>mdsal-netconf-ssh</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netconf-topology</artifactId>
<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>
<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>
+++ /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;
- }
- }
- }
-
- }
- }
-
-}
<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>