In a network device for a script I am building, Robot Framework's SSHLibrary produced the identical result when typing the command manually in the device.
But when writing the code with paramiko:
_stdin, _stdout, _stderr = connection.exec_command(f"scm {mac_address}")
output = _stdout.readlines()
It skips the headers for some reason. Shouldn't the output be indentical as apparently SSHLibrary is built on top of paramiko (if AI can be believed)?
Output with Paramiko:
I checked _stderr
and it is an empty array ([]
).
When you manually ssh to the device and interact with it, the commands are running with a pty. But exec_command()
by default would not run commands with a pty. I guess you can fix it like this:
connection.exec_command(f"scm {mac_address}", get_pty=True)