X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=opendaylight%2Fnetconf%2Fnetconf-ssh%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fssh%2Fosgi%2FNetconfSSHActivator.java;h=b098329e4a01b13c33e737cf7315ad4746f13f92;hb=a2563a94253f9c2603e0ab25b8f412ea07fcf51d;hp=b871d19db8f062d0dbca93cc18ce6c3c6e09ba2d;hpb=139937c2e646894af6a9b2b8a8a1047c6ef82485;p=controller.git diff --git a/opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/osgi/NetconfSSHActivator.java b/opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/osgi/NetconfSSHActivator.java index b871d19db8..b098329e4a 100644 --- a/opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/osgi/NetconfSSHActivator.java +++ b/opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/osgi/NetconfSSHActivator.java @@ -19,10 +19,12 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ThreadFactory; +import java.util.concurrent.TimeUnit; import org.apache.commons.io.FilenameUtils; import org.apache.sshd.common.util.ThreadUtils; import org.apache.sshd.server.keyprovider.PEMGeneratorHostKeyProvider; import org.opendaylight.controller.netconf.ssh.SshProxyServer; +import org.opendaylight.controller.netconf.ssh.SshProxyServerConfigurationBuilder; import org.opendaylight.controller.netconf.util.osgi.NetconfConfigUtil; import org.opendaylight.controller.netconf.util.osgi.NetconfConfigUtil.InfixProp; import org.osgi.framework.BundleActivator; @@ -31,11 +33,12 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class NetconfSSHActivator implements BundleActivator { - private static final Logger logger = LoggerFactory.getLogger(NetconfSSHActivator.class); + private static final Logger LOG = LoggerFactory.getLogger(NetconfSSHActivator.class); private static final java.lang.String ALGORITHM = "RSA"; private static final int KEY_SIZE = 4096; public static final int POOL_SIZE = 8; + private static final int DEFAULT_IDLE_TIMEOUT = (int) TimeUnit.MINUTES.toMillis(20); private ScheduledExecutorService minaTimerExecutor; private NioEventLoopGroup clientGroup; @@ -84,12 +87,12 @@ public class NetconfSSHActivator implements BundleActivator { final Optional maybeSshSocketAddress = NetconfConfigUtil.extractNetconfServerAddress(bundleContext, InfixProp.ssh); if (maybeSshSocketAddress.isPresent() == false) { - logger.trace("SSH bridge not configured"); + LOG.trace("SSH bridge not configured"); return null; } final InetSocketAddress sshSocketAddress = maybeSshSocketAddress.get(); - logger.trace("Starting netconf SSH bridge at {}", sshSocketAddress); + LOG.trace("Starting netconf SSH bridge at {}", sshSocketAddress); final LocalAddress localAddress = NetconfConfigUtil.getNetconfLocalAddress(); @@ -100,7 +103,14 @@ public class NetconfSSHActivator implements BundleActivator { NetconfConfigUtil.getPrivateKeyKey()); final SshProxyServer sshProxyServer = new SshProxyServer(minaTimerExecutor, clientGroup, nioExecutor); - sshProxyServer.bind(sshSocketAddress, localAddress, authProviderTracker, new PEMGeneratorHostKeyProvider(path, ALGORITHM, KEY_SIZE)); + sshProxyServer.bind( + new SshProxyServerConfigurationBuilder() + .setBindingAddress(sshSocketAddress) + .setLocalAddress(localAddress) + .setAuthenticator(authProviderTracker) + .setKeyPairProvider(new PEMGeneratorHostKeyProvider(path, ALGORITHM, KEY_SIZE)) + .setIdleTimeout(DEFAULT_IDLE_TIMEOUT) + .createSshProxyServerConfiguration()); return sshProxyServer; }