Hello, I intend to write some testcases that involve sending commands via ssh to a remote server or devices, capturing the output (screenshot the shell output directly or creating a .txt file or similar that can be screenshot and also save the file log) to be post-processed, filtered and piping it to other processes and do the capture process again for the new outputs.
To do so started reading about the SSH and Process libraries, their basic functionality and created a robot file to test the simplest case to establish an ssh session , send a command and log the output.
But for some reason even though it establishes a session, it gives a return code 1
for the log.
I have tested connecting to the server and sending a “show version” command, using a python script with the netmiko library and it works well.
This is the robot framework code and the output.
*** Test Cases ***
Establish SSH connection to EPNM
Open Connection ${epnm_host}
Login ${epnm_username} ${epnm_password}
${output} ${stderr} ${rc} = Execute Command show version return_stderr=True return_rc=True
Log ${rc}
log ${output}
log ${stderr}
close connection
Am I missing something?
I have also thought about writing a custom library that exposes netmiko functionality to the testcases, but would rather try to solve the issue and use the keywords from SSH library.
Other question I had is if it is possible to use first the SSH library to establish the connection and then Process to send the command and extract the info for the same session.
Lastly want to know if it is possible to take a screenshot of the actual CLI output or if it will be necessary to redirect the output to a txt file and take the screenshot from there.
I appreciate any ideas to solve the issue and for the specific testcase.
Thanks in advance.