Package com.tailf.ned

Interface SSHClient


public interface SSHClient
  • Field Details

  • Method Details

    • createClient

      static SSHClient createClient(NedWorker worker, NedConnectionBase ned) throws IOException
      SSHClient default factory method. Instantiate a new SSH Client. This can only be done when the NED is in state connect.
      Parameters:
      worker - - The NED worker thread.
      ned - - The NED instance
      Returns:
      - SSHClient instance
      Throws:
      IOException
    • clone

      static SSHClient clone(SSHClient original) throws IOException
      Clone a new SSHClient instance from an existing instance. This method can be called without restrictions.
      Parameters:
      original - - The SSHClient to clone
      Returns:
      A new SSHClient instance
      Throws:
      IOException
    • getProviderName

      String getProviderName()
      Get name and version of underlying SSH implementation.
      Returns:
      name and version
    • connect

      void connect() throws IOException
      Establish the SSH connection using default configuration or cloned setup.
      Throws:
      IOException
    • connect

      void connect(int connectTimeout, int idleTimeout) throws IOException
      Establish the SSH connection with specific timeouts.
      Parameters:
      connectTimeout - - Connect timeout
      idleTimeout - - Idle timeout
      Throws:
      IOException
    • connect

      void connect(int connectTimeout, int idleTimeout, InetAddress address, int port) throws IOException
      Establish the SSH connection with timeout and address info specified.
      Parameters:
      connectTimeout - - Connect timeout
      idleTimeout - - Idle timeout
      address - - Peer address
      port - - Peer port
      Throws:
      IOException
    • getConnectionInfo

      String getConnectionInfo()
      Get info about the negotiated algorithms etc used for the connection. Relevant only after connect.
      Returns:
      A string with connection info
    • disableHostKeyVerification

      void disableHostKeyVerification()
      Explicitly disable host key checking on this connection-
    • setRemoteCharset

      void setRemoteCharset(Charset remoteCharset)
      Set charset for sessions started from this connection
      Parameters:
      remoteCharset - - Specified charset
    • authenticate

      void authenticate() throws IOException
      Authenticate using the methods specified by NSO or from a cloned connection.
      Throws:
      IOException
    • authenticate

      void authenticate(String[] methods) throws IOException
      Authenticate using a custom list of methods.
      Parameters:
      methods - - Authentication methods to use in priority order.
      Throws:
      IOException
    • authenticate

      void authenticate(String[] methods, String user, String password) throws IOException
      Authenticate using a custom list of methods, with explicitly configured authentication parameters.
      Parameters:
      methods - - Authentication methods to use in priority order. Set to null if the methods specified by NSO or from a cloned connection shall be used.
      user - - User
      password - - Password
      Throws:
      IOException
    • close

      void close() throws IOException
      Close SSH connection
      Throws:
      IOException
    • isConnected

      boolean isConnected()
      Connection status check
      Returns:
      true | false
    • isAuthenticated

      boolean isAuthenticated()
      Authentication status check
      Returns:
      true | false
    • useCompression

      void useCompression() throws IOException
      Enable compression on the SSH channel
      Throws:
      IOException
    • setTrafficClass

      void setTrafficClass(int tc) throws SocketException
      Set traffic class on the socket used by the SSH client.
      Parameters:
      tc - - Traffic class
      Throws:
      SocketException
    • createSession

      SSHClient.CliSession createSession() throws IOException
      Instantiate a CLI session, default settings
      Returns:
      A ClI session instance
      Throws:
      IOException
    • createSession

      SSHClient.CliSession createSession(int width, int height) throws IOException
      Instantiate a CLI session with specific terminal size parameters
      Parameters:
      width - - Terminal width
      height - - Terminal height
      Returns:
      A ClI session instance
      Throws:
      IOException
    • createSFTP

      Instantiate a SFTP handler
      Returns:
      SFTP handler instance
      Throws:
      IOException
    • createSCP

      Instantiate a SCP handler
      Returns:
      SCP handler instance
      Throws:
      IOException
    • createSubsystem

      SSHClient.Subsystem createSubsystem(String name) throws IOException
      Instantiate a subsystem, such as 'netconf'
      Parameters:
      name - - Name of subsystem.
      Returns:
      Subsystem instance
      Throws:
      IOException