Allows you to run mutliple commands on a remote host.
def test_fun(duthosts, rand_one_dut_hostname):
duthost = duthosts[rand_one_dut_hostname]
duthost.shell_cmds(cmds=["ls /home", "pwd", "touch /home/test_file.txt", "ls /home"])
cmds- List of commands to be run on the remote host- Required:
True - Type:
ListElement-Type:String
- Required:
continue_on_fail- Whether the remote host should continue to run commands after a failed command- Reguired:
False - Type:
Boolean - Default:
True
- Reguired:
timeout- Specify time limit (in second) for each command. 0 means no limit.- Reguired:
False - Type:
Integer - Default:
0
- Reguired:
A dictionary with results from commands run. The dictionary hierarchy is described below, with each indentation describing a sub-dictionary:
end- Datetime for when the commands finished runningcmds- the list of commands that user input.start- Datetime for when the commands started runningdelta- difference betweenstartandendresults- List of dictionaries, each corresponding to the results for one of the commands runstderr_lines- What was printed to stderr (split by line) during execution of commandstderr- What was printed to stderr (as one string) during execution of commandstdout_lines- What was printed to stdout (split by line) during execution of commandstdout- What was printed to stdout (as one string) during execution of commandcmd- command that user input. It's what actaully ran iftimeout == 0.cmd_with_timeout- command wrapped withtimeout. It's what actually ran iftimeout != 0.rc- return codetimeout- time limit (in second) for each command. 0 means no limit.