Nexial Automation

Test Automation Platform for everyone!

X

ssh

Description

SSH, stands for Secure Shell, is a popular and well-regarded form of accessing and controlling remote compute and I/O resources.  While being known mostly amongsts the *NIX and Mac users, it is recently gaining popularity and acceptance in the Windows/PC world.  Using the ssh protocol, one can securely transfer files between a remote and local location, as well as access and control compute resources remotely. 

For more introductory information, check  herehere, and  here

ssh is the base protocol of various secure-remote commands.  Nexial currently supports 2 of such commands - SCP and SFTP.

SCP - secure copy - is the replacement for rcp (remote copy).  Using ssh as the protocol, it provides a secure way to copy files between 2 hosts.  Nexial supports SCP via these commands:

SFTP - secure FTP - is the replacement for ftp (file transfer protocol).  Via ssh, SFTP provides the same base functionality as ftp, but with added security in place.  Nexial supports SFTP via the following commands:

Connection Setup

All the ssh commands in Nexial uses the concept of profile to specify the connectivity and security context.  For example, let’s suppose a profile named as “MyServer”:

data name data value(s) description
MyServer.username [REQUIRED] username to access remote host This is the username to access the specified remote host. Note that all commands will be propagated through the security context of this user
MyServer.password credential to access remote host This is the password for the specified username. It is recommended to consider encrypt sensitive information before storing them in data file
MyServer.host [REQUIRED] the remote host, either as IP or hostname  
MyServer.port the remote port, default is 22  
MyServer.strictHostKeyChecking true (default) or false true means that only “known” hosts will be permitted to engage in ssh communication (see next line). Use false to indicate that the specified host is already known
MyServer.knownHosts fully qualified location of a known_hostsfile The known_hosts file is a file that contains the digital identity signature of all “known” hosts, commonly stored in ~/.ssh/known_hosts. The hosts specified in this file have been individually identified and acknowledged, usually via one of the ssh-implemented commands. Example of such file:

Feel free to substitute MyServer with another name of your choice, to make your script/data more meaningful and readable.

Command Output Processing

Both the ssh commands and aws.s3 commands store the automation output to a variable (denote as var and usually the first command parameter). One can use this var for further automation such as validation or use it as parameter to subsequent commands. The command output has the following properties:

output property value explanation
${var}.protocol SFTP, SCP, AWS capture the protocol used in the command
${var}.action copy to, copy from, move to, move from, list, delete textual description of the action carried via the command
${var}.remotePath   the target remote location/path
${var}.localPath   the target local location/path
${var}.startTime   the starting time, in millisecond (i.e. epoch) when this command was executed
${var}.elapsedTime   the number of milliseconds for this command to complete, and subsequent response received by Nexial
${var}.affected   a list of fully qualified file paths that were (successfully) affected by the command
${var}.failed   a list of fully qualified file paths that failed to be affected by the command
${var}.errors   error text, if any, issued by the target server due to the execution of a command

Note that:

  • .errors would return null when none is found

Note that while some ssh-implemented commands such as SCP supports copy from one remote location to another remote location, Nexial currently does not support this on the account that it is not considered as a command test automation requirement (unless you think you really need it? Comment below)

Available Commands