import org.opendaylight.netconf.shaded.sshd.client.session.ClientSessionImpl;
import org.opendaylight.netconf.shaded.sshd.client.session.SessionFactory;
import org.opendaylight.netconf.shaded.sshd.common.io.IoHandler;
+import org.opendaylight.netconf.shaded.sshd.netty.NettyIoServiceFactoryFactory;
import org.opendaylight.netconf.transport.api.TransportChannelListener;
import org.opendaylight.netconf.transport.api.TransportStack;
import org.opendaylight.netconf.transport.api.UnsupportedConfigurationException;
sessionFactory);
}
- static SSHClient of(final EventLoopGroup group, final TransportChannelListener listener,
- final SshClientGrouping clientParams) throws UnsupportedConfigurationException {
+ static SSHClient of(final NettyIoServiceFactoryFactory ioServiceFactory, final EventLoopGroup group,
+ final TransportChannelListener listener, final SshClientGrouping clientParams)
+ throws UnsupportedConfigurationException {
final var clientIdentity = clientParams.getClientIdentity();
final var username = clientIdentity == null ? "" : clientIdentity.getUsername();
- return new SSHClient(listener, new TransportSshClient.Builder(group)
+ return new SSHClient(listener, new TransportSshClient.Builder(ioServiceFactory, group)
.transportParams(clientParams.getTransportParams())
.keepAlives(clientParams.getKeepalives())
.clientIdentity(clientParams.getClientIdentity())
import io.netty.util.concurrent.GlobalEventExecutor;
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.netconf.shaded.sshd.common.io.IoHandler;
+import org.opendaylight.netconf.shaded.sshd.netty.NettyIoServiceFactoryFactory;
import org.opendaylight.netconf.shaded.sshd.server.ServerFactoryManager;
import org.opendaylight.netconf.shaded.sshd.server.session.SessionFactory;
import org.opendaylight.netconf.shaded.sshd.server.subsystem.SubsystemFactory;
serverSessionFactory);
}
- static SSHServer of(final EventLoopGroup group, final TransportChannelListener listener,
- final SubsystemFactory subsystemFactory, final SshServerGrouping serverParams,
- final ServerFactoryManagerConfigurator configurator) throws UnsupportedConfigurationException {
- return new SSHServer(listener, new TransportSshServer.Builder(group, subsystemFactory)
+ static SSHServer of(final NettyIoServiceFactoryFactory ioServiceFactory, final EventLoopGroup group,
+ final TransportChannelListener listener, final SubsystemFactory subsystemFactory,
+ final SshServerGrouping serverParams, final ServerFactoryManagerConfigurator configurator)
+ throws UnsupportedConfigurationException {
+ return new SSHServer(listener, new TransportSshServer.Builder(ioServiceFactory, group, subsystemFactory)
.serverParams(serverParams)
.configurator(configurator)
.buildChecked());
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.EventLoopGroup;
import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.netconf.shaded.sshd.netty.NettyIoServiceFactoryFactory;
import org.opendaylight.netconf.shaded.sshd.server.subsystem.SubsystemFactory;
import org.opendaylight.netconf.transport.api.TransportChannelListener;
import org.opendaylight.netconf.transport.api.UnsupportedConfigurationException;
public final class SSHTransportStackFactory implements AutoCloseable {
private final EventLoopGroup group;
private final EventLoopGroup parentGroup;
+ private final NettyIoServiceFactoryFactory ioServiceFactory;
private SSHTransportStackFactory(final EventLoopGroup group, final EventLoopGroup parentGroup) {
this.group = requireNonNull(group);
this.parentGroup = parentGroup;
- // FIXME: factoryFactory = new NettyIoServiceFactoryFactory(group);
+ ioServiceFactory = new NettyIoServiceFactoryFactory(group);
}
public SSHTransportStackFactory(final @NonNull String groupName, final int groupThreads) {
public @NonNull ListenableFuture<SSHClient> connectClient(final TransportChannelListener listener,
final TcpClientGrouping connectParams, final SshClientGrouping clientParams)
throws UnsupportedConfigurationException {
- return SSHClient.of(group, listener, clientParams).connect(newBootstrap(), connectParams);
+ return SSHClient.of(ioServiceFactory, group, listener, clientParams).connect(newBootstrap(), connectParams);
}
public @NonNull ListenableFuture<SSHClient> listenClient(final TransportChannelListener listener,
final TcpServerGrouping listenParams, final SshClientGrouping clientParams)
throws UnsupportedConfigurationException {
- return SSHClient.of(group, listener, clientParams).listen(newServerBootstrap(), listenParams);
+ return SSHClient.of(ioServiceFactory, group, listener, clientParams).listen(newServerBootstrap(), listenParams);
}
public @NonNull ListenableFuture<SSHServer> connectServer(final TransportChannelListener listener,
final SubsystemFactory subsystemFactory, final TcpClientGrouping connectParams,
final SshServerGrouping serverParams) throws UnsupportedConfigurationException {
- return SSHServer.of(group, listener, subsystemFactory, requireNonNull(serverParams), null)
+ return SSHServer.of(ioServiceFactory, group, listener, subsystemFactory, requireNonNull(serverParams), null)
.connect(newBootstrap(), connectParams);
}
throws UnsupportedConfigurationException {
checkArgument(serverParams != null || configurator != null,
"Neither server parameters nor factory configurator is defined");
- return SSHServer.of(group, listener, subsystemFactory, serverParams, configurator)
+ return SSHServer.of(ioServiceFactory, group, listener, subsystemFactory, serverParams, configurator)
.listen(newServerBootstrap(), listenParams);
}
import org.opendaylight.netconf.shaded.sshd.client.auth.pubkey.UserAuthPublicKeyFactory;
import org.opendaylight.netconf.shaded.sshd.client.keyverifier.ServerKeyVerifier;
import org.opendaylight.netconf.shaded.sshd.common.keyprovider.KeyIdentityProvider;
+import org.opendaylight.netconf.shaded.sshd.netty.NettyIoServiceFactoryFactory;
import org.opendaylight.netconf.transport.api.UnsupportedConfigurationException;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.crypto.types.rev230417.password.grouping.password.type.CleartextPassword;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ssh.client.rev230417.ssh.client.grouping.ClientIdentity;
* {@code ietf-netconf-client.yang} configuration.
*/
static final class Builder extends ClientBuilder {
+ private final NettyIoServiceFactoryFactory ioServiceFactory;
private final EventLoopGroup group;
private Keepalives keepAlives;
private ClientIdentity clientIdentity;
- Builder(final EventLoopGroup group) {
+ Builder(final NettyIoServiceFactoryFactory ioServiceFactory, final EventLoopGroup group) {
+ this.ioServiceFactory = requireNonNull(ioServiceFactory);
this.group = requireNonNull(group);
}
if (clientIdentity != null && clientIdentity.getNone() == null) {
setClientIdentity(ret, clientIdentity);
}
+ ret.setIoServiceFactoryFactory(ioServiceFactory);
ret.setScheduledExecutorService(group);
try {
import java.security.PublicKey;
import java.util.List;
import org.opendaylight.netconf.shaded.sshd.common.keyprovider.KeyPairProvider;
+import org.opendaylight.netconf.shaded.sshd.netty.NettyIoServiceFactoryFactory;
import org.opendaylight.netconf.shaded.sshd.server.ServerBuilder;
import org.opendaylight.netconf.shaded.sshd.server.SshServer;
import org.opendaylight.netconf.shaded.sshd.server.auth.UserAuthFactory;
* {@code ietf-netconf-server.yang} configuration.
*/
static final class Builder extends ServerBuilder {
+ private final NettyIoServiceFactoryFactory ioServiceFactory;
private final EventLoopGroup group;
private final SubsystemFactory subsystemFactory;
private ServerIdentity serverIdentity;
private Keepalives keepAlives;
- Builder(final EventLoopGroup group, final SubsystemFactory subsystemFactory) {
+ Builder(final NettyIoServiceFactoryFactory ioServiceFactory, final EventLoopGroup group,
+ final SubsystemFactory subsystemFactory) {
+ this.ioServiceFactory = requireNonNull(ioServiceFactory);
this.group = requireNonNull(group);
this.subsystemFactory = requireNonNull(subsystemFactory);
}
}
ret.setSubsystemFactories(List.of(subsystemFactory));
+ ret.setIoServiceFactoryFactory(ioServiceFactory);
ret.setScheduledExecutorService(group);
-
try {
ret.checkConfig();
} catch (IllegalArgumentException e) {