SSH protocol is used for communicating with remote devices in a secured mode. The SSH protocol enables you to log into a remote system from a terminal and to use the system's resources as though it were directly connected to the terminal.
The com.adventnet.cli.transport.ssh
package contains the implementation of SshTransportProvider
and SshProtocolOptions for SSH
communication.
SshTransportProviderImpl
The SshTransportProviderImpl class is for sending commands through SSH. The various SSH commands include opening and closing of the SSH connection to the remote device, sending and receiving messages from the opened connection.
SshProtocolOptionsImpl
The SshProtocolOptionsImpl class provides the SSH implementation of the CLIProtocolOptions interface. It contains
parameters, such as the Remote Host Address, Port, login parameters, and
others. In order to establish a CLI session over SSH with a particular
device, the appropriate parameters have to be set on an instance of this
class and passed to the CLISession's constructor. Subsequent call to the
open method in CLISession will
establish the SSH connection based on the parameters set here.
|
SshProtocolOptionsImpl spoi = new SshProtocolOptionsImpl(); spoi.setRemotePort(22); spoi.setPrompt("$"); spoi.setLoginName("login name"); spoi.setPassword("password"); spoi.setRemoteHost("host name"); CLISession clisession = new CLISession(tpoi); clisession.setTransportProviderClassName (com.adventnet.cli.transport.ssh.SshTransportImpl); clisession.open(); |
Please refer to Java documentation for complete details.