Deprecate legacy SSH integration 26/108426/3
authorRobert Varga <robert.varga@pantheon.tech>
Sat, 14 Oct 2023 02:51:27 +0000 (04:51 +0200)
committerRobert Varga <nite@hq.sk>
Sat, 14 Oct 2023 03:24:37 +0000 (03:24 +0000)
transport-api allows for both connect and listen channels, which renders
quite a bit of netconf-netty-util/callhome-protocol obsolete.

Deprecate classes which are used only in legacy wiring, so that clean up
can be focused.

JIRA: NETCONF-1108
Change-Id: I6cd6d351c986b42f6fbb3a0769e8305dc5440704
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 files changed:
netconf/callhome-protocol/src/main/java/org/opendaylight/netconf/callhome/protocol/CallHomeSessionContext.java
netconf/callhome-protocol/src/main/java/org/opendaylight/netconf/callhome/protocol/MinaSshNettyChannel.java
netconf/callhome-protocol/src/test/java/org/opendaylight/netconf/callhome/protocol/MinaSshNettyChannelTest.java
netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/AbstractNetconfDispatcher.java
netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/AsyncSshHandler.java
netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/AsyncSshHandlerReader.java
netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/AsyncSshHandlerWriter.java
netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/AuthenticationFailedException.java
netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/NetconfClientBuilder.java
netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/NetconfClientSessionImpl.java
netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/NetconfSessionFactory.java
netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/NetconfSshClient.java
netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/NettyAwareClientSession.java
netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/NettyChannelSubsystem.java

index 7cdb7bd2696a286c3878824d6e39bd58ceeb0c48..bfaca07c09d533be203e2f05167023ce690937eb 100644 (file)
@@ -138,6 +138,7 @@ class CallHomeSessionContext implements CallHomeProtocolSessionContext {
         return activationPromise;
     }
 
+    @Deprecated(since = "7.0.0", forRemoval = true)
     protected MinaSshNettyChannel newMinaSshNettyChannel() {
         return new MinaSshNettyChannel(this, sshSession);
     }
index 8a65eff04b802a961b33ff4d4c36277fafaa5330..e2602e3132bd6a271729507c34ed4d5f58b5d41a 100644 (file)
@@ -22,6 +22,7 @@ import org.opendaylight.netconf.shaded.sshd.client.session.ClientSession;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+@Deprecated(since = "7.0.0", forRemoval = true)
 // Non-final for testing
 class MinaSshNettyChannel extends AbstractServerChannel {
     private static final Logger LOG = LoggerFactory.getLogger(MinaSshNettyChannel.class);
index da43dda97dc0c22dac618fec923caed6d8fb4882..ebe52ef587fa73fe1a9366f47c51b7810ccd4d54 100644 (file)
@@ -30,6 +30,7 @@ import org.opendaylight.netconf.shaded.sshd.common.io.IoReadFuture;
 import org.opendaylight.netconf.shaded.sshd.common.io.IoWriteFuture;
 import org.opendaylight.netconf.shaded.sshd.common.util.buffer.Buffer;
 
+@Deprecated(since = "7.0.0", forRemoval = true)
 public class MinaSshNettyChannelTest {
     private CallHomeSessionContext mockContext;
     private ClientSession mockSession;
index cdfec0b287992f984dca01883e2558831c5e7e39..b53aafa7a422c69d446f45bc4f990bf299ed95dc 100644 (file)
@@ -38,7 +38,7 @@ import org.slf4j.LoggerFactory;
  * Dispatcher class for creating servers and clients. The idea is to first create servers and clients and the run the
  * start method that will handle sockets in different thread.
  */
-@Deprecated
+@Deprecated(forRemoval = true)
 public abstract class AbstractNetconfDispatcher<S extends NetconfSession, L extends NetconfSessionListener<? super S>> {
     protected interface ChannelPipelineInitializer<C extends Channel, S extends NetconfSession> {
         /**
index f6956d7c5d4e3dc39940bb96d035839c5360254b..32ebf5348e981178d099d7e77599291575a77fda 100644 (file)
@@ -38,6 +38,7 @@ import org.slf4j.LoggerFactory;
 /**
  * Netty SSH handler class. Acts as interface between Netty and SSH library.
  */
+@Deprecated(since = "7.0.0", forRemoval = true)
 public final class AsyncSshHandler extends ChannelOutboundHandlerAdapter {
     private static final Logger LOG = LoggerFactory.getLogger(AsyncSshHandler.class);
     private static final VarHandle DISCONNECTED;
index e6ba03155580090ad5e6fa336cbf2b287238ca69..b123e0b631cd248f3cbaecbd85fe084aab755219 100644 (file)
@@ -22,10 +22,9 @@ import org.slf4j.LoggerFactory;
  * Listener on async input stream from SSH session.
  * This listeners schedules reads in a loop until the session is closed or read fails.
  */
+@Deprecated(since = "7.0.0", forRemoval = true)
 public final class AsyncSshHandlerReader implements SshFutureListener<IoReadFuture>, AutoCloseable {
-
     private static final Logger LOG = LoggerFactory.getLogger(AsyncSshHandlerReader.class);
-
     private static final int BUFFER_SIZE = 2048;
 
     private final AutoCloseable connectionClosedCallback;
index 204f8e5df8a9156a715fb8372bed3752316c997a..412e94d0aedc259f72fc51c188c979809b988512 100644 (file)
@@ -30,6 +30,7 @@ import org.slf4j.LoggerFactory;
  * Async Ssh writer. Takes messages(byte arrays) and sends them encrypted to remote server.
  * Also handles pending writes by caching requests until pending state is over.
  */
+@Deprecated(since = "7.0.0", forRemoval = true)
 public final class AsyncSshHandlerWriter implements AutoCloseable {
     private static final Logger LOG = LoggerFactory.getLogger(AsyncSshHandlerWriter.class);
     private static final Pattern NON_ASCII = Pattern.compile("([^\\x20-\\x7E\\x0D\\x0A])+");
index f5ece86506ced97c00b94e608ea0a8c0fdfd470d..557441e88402b412b9fd62abc256b5ea5fc991a1 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.netconf.nettyutil.handler.ssh.client;
 import static java.util.Objects.requireNonNull;
 
 import com.google.common.annotations.Beta;
-import java.io.Serial;
 import org.opendaylight.netconf.shaded.sshd.common.SshException;
 
 /**
@@ -18,7 +17,7 @@ import org.opendaylight.netconf.shaded.sshd.common.SshException;
  */
 @Beta
 public class AuthenticationFailedException extends SshException {
-    @Serial
+    @java.io.Serial
     private static final long serialVersionUID = 1L;
 
     public AuthenticationFailedException(final String message) {
index 62b292ff339758593196e8a09efd1be0a7366546..1d8ba69a27c7c6d1dce70b7e19b37e7bf1284cdc 100644 (file)
@@ -9,7 +9,6 @@ package org.opendaylight.netconf.nettyutil.handler.ssh.client;
 
 import static com.google.common.base.Verify.verify;
 
-import com.google.common.annotations.Beta;
 import com.google.common.collect.ImmutableList;
 import java.util.List;
 import java.util.stream.Stream;
@@ -24,7 +23,7 @@ import org.opendaylight.netconf.shaded.sshd.common.signature.Signature;
 /**
  * A {@link ClientBuilder} which builds {@link NetconfSshClient} instances.
  */
-@Beta
+@Deprecated(since = "7.0.0", forRemoval = true)
 public class NetconfClientBuilder extends ClientBuilder {
     // RFC8332 rsa-sha2-256/rsa-sha2-512 are not a part of Mina's default set of signatures for clients as of 2.5.1.
     // Add them to ensure interop with modern highly-secured devices.
index 0f8435235a0506172a56ea8e6bf4d4b1ade08bef..26e555dc095607640dfbc8ae1a631209b102df4f 100644 (file)
@@ -9,7 +9,6 @@ package org.opendaylight.netconf.nettyutil.handler.ssh.client;
 
 import static java.util.Objects.requireNonNull;
 
-import com.google.common.annotations.Beta;
 import io.netty.channel.ChannelHandlerContext;
 import io.netty.channel.ChannelPipeline;
 import java.io.IOException;
@@ -22,7 +21,7 @@ import org.opendaylight.netconf.shaded.sshd.common.io.IoSession;
  * A {@link ClientSessionImpl} which additionally allows creation of NETCONF subsystem channel, which is routed to
  * a particular {@link ChannelHandlerContext}.
  */
-@Beta
+@Deprecated(since = "7.0.0", forRemoval = true)
 public final class NetconfClientSessionImpl extends ClientSessionImpl implements NettyAwareClientSession {
     public NetconfClientSessionImpl(final ClientFactoryManager client, final IoSession ioSession) throws Exception {
         super(client, ioSession);
index c3aa99a5395c1ffcb2946db9f62a26ce85e2ea13..22de35a5391ff22d3540a8a8376b20ca4f0d5afd 100644 (file)
@@ -7,7 +7,6 @@
  */
 package org.opendaylight.netconf.nettyutil.handler.ssh.client;
 
-import com.google.common.annotations.Beta;
 import org.opendaylight.netconf.shaded.sshd.client.ClientFactoryManager;
 import org.opendaylight.netconf.shaded.sshd.client.session.SessionFactory;
 import org.opendaylight.netconf.shaded.sshd.common.io.IoSession;
@@ -15,7 +14,7 @@ import org.opendaylight.netconf.shaded.sshd.common.io.IoSession;
 /**
  * A {@link SessionFactory} which creates {@link NetconfClientSessionImpl}s.
  */
-@Beta
+@Deprecated(since = "7.0.0", forRemoval = true)
 public class NetconfSessionFactory extends SessionFactory {
     public NetconfSessionFactory(final ClientFactoryManager client) {
         super(client);
index 1dfac5cc106456c0ce6ef97130ca90df0966ae2d..7efdb268aeccfe9621811e6b200197c8bb55a04e 100644 (file)
@@ -7,14 +7,13 @@
  */
 package org.opendaylight.netconf.nettyutil.handler.ssh.client;
 
-import com.google.common.annotations.Beta;
 import org.opendaylight.netconf.shaded.sshd.client.SshClient;
 
 /**
  * An extension to {@link SshClient} which uses {@link NetconfSessionFactory} to create sessions (leading towards
  * {@link NetconfClientSessionImpl}.
  */
-@Beta
+@Deprecated(since = "7.0.0", forRemoval = true)
 public class NetconfSshClient extends SshClient {
     @Override
     protected NetconfSessionFactory createSessionFactory() {
index ce89f0f39668806f5efb424d234871ecb19d08f5..904d974125b4256e6a9897df08ef01a96f5db8b5 100644 (file)
@@ -7,7 +7,6 @@
  */
 package org.opendaylight.netconf.nettyutil.handler.ssh.client;
 
-import com.google.common.annotations.Beta;
 import io.netty.channel.ChannelHandlerContext;
 import io.netty.channel.ChannelPipeline;
 import java.io.IOException;
@@ -18,7 +17,7 @@ import org.opendaylight.netconf.shaded.sshd.client.session.ClientSession;
  * A {@link ClientSession} which additionally allows subsystem channels which are forwarded to a particular Netty
  * channel context.
  */
-@Beta
+@Deprecated(since = "7.0.0", forRemoval = true)
 public interface NettyAwareClientSession extends ClientSession {
     /**
      * Allocate a channel to the specified subsystem. Incoming data on the channel will be routed to the
index c0eca8bc16224405eea1107fb2d8da63febc4a95..116a9bc53ca0e8cfc453bf0fa3c48636efb34562 100644 (file)
@@ -17,6 +17,7 @@ import org.slf4j.LoggerFactory;
 /**
  * Abstract base class for {@link ChannelSubsystem}s backed by a Netty {@link ChannelHandlerContext}.
  */
+@Deprecated(since = "7.0.0", forRemoval = true)
 abstract class NettyChannelSubsystem extends ChannelSubsystem {
     private static final Logger LOG = LoggerFactory.getLogger(NettyChannelSubsystem.class);