Package dev.galasa.ipnetwork.spi
Class SSHClient
java.lang.Object
dev.galasa.ipnetwork.spi.SSHClient
- All Implemented Interfaces:
 ICommandShell
SSH client for Galasa
- 
Constructor Summary
ConstructorsConstructorDescriptionSSHClient(String hostname, int port, ICredentials credentials, long defaultTimeoutInMillis)  - 
Method Summary
Modifier and TypeMethodDescriptionvoidconnect()voidDisconnect the clientissueCommand(String command) Issue a command using SSH.issueCommand(String command, boolean newShell) Issue a command using SSH.issueCommand(String command, boolean newShell, long timeoutInMillis) Issue a command using SSHissueCommand(String command, long timeoutInMillis) Issue a command using SSH.issueCommandToShell(String command) Issue a command using SSH shell.issueCommandToShell(String command, boolean newShell) Issue a command using SSH shell.issueCommandToShell(String command, boolean newShell, long timeoutInMillis) Issue a command using SSH shellissueCommandToShell(String command, long timeoutInMillis) Issue a command using SSH shell.voidreportResultStrings(boolean report) Ask the shell to log the result strings for all shell commandsvoidvoidsetChangePromptCommand(String command) Define the right command used to change the shell promptvoidsetRemoveAnsiEscapeCodes(boolean remoteAnsiEscapeCodes) Instruct the command shell to remove ANSI escape codes from the output of commands to the shell 
- 
Constructor Details
- 
SSHClient
public SSHClient(String hostname, int port, ICredentials credentials, long defaultTimeoutInMillis) throws SSHException - Throws:
 SSHException
 
 - 
 - 
Method Details
- 
issueCommand
Issue a command using SSH. Equivalent toissueCommand(String, boolean, long)- Specified by:
 issueCommandin interfaceICommandShell- Parameters:
 command- - command to issue- Returns:
 - the output of the command (stdout and stderr)
 - Throws:
 SSHException
 - 
issueCommand
Issue a command using SSH. Equivalent toissueCommand(String, boolean, long)- Specified by:
 issueCommandin interfaceICommandShell- Parameters:
 command- - command to issuetimeoutInMillis- - time (in milliseconds) to wait with no new output appearing before timing out- Returns:
 - the output of the command (stdout and stderr)
 - Throws:
 SSHException
 - 
issueCommand
Issue a command using SSH. Equivalent toissueCommand(String, boolean, long)- Specified by:
 issueCommandin interfaceICommandShell- Parameters:
 command- - command to issuenewShell- - if true will start a new- Returns:
 - the output of the command (stdout and stderr)
 - Throws:
 SSHException
 - 
issueCommand
public String issueCommand(String command, boolean newShell, long timeoutInMillis) throws SSHException Issue a command using SSH- Specified by:
 issueCommandin interfaceICommandShell- Parameters:
 command- - command to issuenewShell- - if true will start a newtimeoutInMillis- - time (in milliseconds) to wait with no new output appearing before timing out- Returns:
 - the output of the command (stdout and stderr)
 - Throws:
 SSHException
 - 
setChangePromptCommand
Define the right command used to change the shell prompt- Specified by:
 setChangePromptCommandin interfaceICommandShell
 - 
issueCommandToShell
Issue a command using SSH shell. Equivalent toissueCommandToShell(String, boolean, long)- Specified by:
 issueCommandToShellin interfaceICommandShell- Parameters:
 command- - command to issue- Returns:
 - the output of the command
 - Throws:
 SSHException
 - 
issueCommandToShell
Issue a command using SSH shell. Equivalent toissueCommandToShell(String, boolean, long)- Specified by:
 issueCommandToShellin interfaceICommandShell- Parameters:
 command- - command to issuetimeoutInMillis- - time (in milliseconds) to wait with no new output appearing before timing out- Returns:
 - the output of the command
 - Throws:
 SSHException
 - 
issueCommandToShell
Issue a command using SSH shell. Equivalent toissueCommandToShell(String, boolean, long)- Specified by:
 issueCommandToShellin interfaceICommandShell- Parameters:
 command- - command to issuenewShell- - if true will start a new- Returns:
 - the output of the command
 - Throws:
 SSHException
 - 
issueCommandToShell
public String issueCommandToShell(String command, boolean newShell, long timeoutInMillis) throws SSHException Issue a command using SSH shell- Specified by:
 issueCommandToShellin interfaceICommandShell- Parameters:
 command- - command to issuenewShell- - if true will start a newtimeoutInMillis- - time (in milliseconds) to wait with no new output appearing before timing out- Returns:
 - the output of the command
 - Throws:
 SSHException
 - 
connect
- Specified by:
 connectin interfaceICommandShell- Throws:
 SSHException
 - 
restartShell
- Specified by:
 restartShellin interfaceICommandShell- Throws:
 SSHException
 - 
disconnect
Disconnect the client- Specified by:
 disconnectin interfaceICommandShell- Throws:
 IOExceptionSSHException
 - 
reportResultStrings
public void reportResultStrings(boolean report) Description copied from interface:ICommandShellAsk the shell to log the result strings for all shell commands- Specified by:
 reportResultStringsin interfaceICommandShell- Parameters:
 report- whether the shell should log the results of the shell commands
 - 
setRemoveAnsiEscapeCodes
public void setRemoveAnsiEscapeCodes(boolean remoteAnsiEscapeCodes) Description copied from interface:ICommandShellInstruct the command shell to remove ANSI escape codes from the output of commands to the shell- Specified by:
 setRemoveAnsiEscapeCodesin interfaceICommandShell
 
 -