Forum Discussion

Eashan's avatar
Eashan
Icon for Nimbostratus rankNimbostratus
Sep 17, 2019

Issues accessing Show Sys Version output on F5 Viprion using Paramiko

import paramiko
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy)
ssh.connect('IPAddress', port=22, 'username', 'password')
my_command = "show sys version | grep Version"
stdin, stdout, stderr = ssh.exec_command(my_command)
output = stdout.readlines()
print("\n".join(output))
print(stderr.readlines)
ssh.close()

The following scripts run successfully but fails to display any output. But if I remove the grep and run only the show sys version I'm receiving the output without any issues.

1 Reply

  • Eashan's avatar
    Eashan
    Icon for Nimbostratus rankNimbostratus

    This is the output of my script with grep command

     

    <bound method BufferedFile.readlines of <paramiko.ChannelFile from <paramiko.Channel 0 (EOF received) (open) window=2097152 -> <paramiko.Transport at 0xb6d757b8 (cipher aes128-ctr, 128 bits) (active; 1 open channel(s))>>>>

     

    Process finished with exit code 0

     

    Without grep command

    Sys::Version

     

    Main Package

     

     Product   BIG-IP

     

     Version   14.1.0.6

     

     Build    0.0.9

     

     Edition   Point Release 6

     

     Date    Fri Jun 21 21:06:44 PDT 2019

     

     

     

    <bound method BufferedFile.readlines of <paramiko.ChannelFile from <paramiko.Channel 0 (EOF received) (open) window=2097152 -> <paramiko.Transport at 0x1005748 (cipher aes128-ctr, 128 bits) (active; 1 open channel(s))>>>>

     

    Process finished with exit code 0