2 * Copyright (c) 2023 PANTHEON.tech s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.netconf.server;
10 import static java.util.Objects.requireNonNull;
12 import com.google.common.util.concurrent.ListenableFuture;
13 import org.opendaylight.netconf.server.api.NetconfServerFactory;
14 import org.opendaylight.netconf.transport.api.UnsupportedConfigurationException;
15 import org.opendaylight.netconf.transport.ssh.SSHServer;
16 import org.opendaylight.netconf.transport.ssh.SSHTransportStackFactory;
17 import org.opendaylight.netconf.transport.ssh.ServerFactoryManagerConfigurator;
18 import org.opendaylight.netconf.transport.tcp.TCPServer;
19 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ssh.server.rev230417.SshServerGrouping;
20 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.tcp.server.rev230417.TcpServerGrouping;
22 public final class NetconfServerFactoryImpl implements NetconfServerFactory {
23 private final SSHTransportStackFactory factory;
24 private final ServerChannelInitializer channelInitializer;
26 public NetconfServerFactoryImpl(final ServerChannelInitializer channelInitializer,
27 final SSHTransportStackFactory factory) {
28 this.factory = requireNonNull(factory);
29 this.channelInitializer = requireNonNull(channelInitializer);
33 public ListenableFuture<TCPServer> createTcpServer(final TcpServerGrouping params)
34 throws UnsupportedConfigurationException {
35 return TCPServer.listen(new ServerTransportInitializer(channelInitializer), factory.newServerBootstrap(),
40 public ListenableFuture<SSHServer> createSshServer(final TcpServerGrouping tcpParams,
41 final SshServerGrouping sshParams, final ServerFactoryManagerConfigurator configurator)
42 throws UnsupportedConfigurationException {
43 return factory.listenServer("netconf", new ServerTransportInitializer(channelInitializer), tcpParams, sshParams,