cancel
Showing results for 
Search instead for 
Did you mean: 

Assistance with automating cli commands on AP using Python/Paramiko

Assistance with automating cli commands on AP using Python/Paramiko

chris_krieter
New Contributor

I am trying to build a python script to connect to the APs cli via SSH using Paramiko, issue commands and collect the output. Ultimately, I want to develop a more automated and reliable method to upgrading the APs software in the field.

 

I am able to connect to the AP using paramiko.SSHClient() and .connect() and this appears to be successful. When I issue .exec_command("show version") for example, I get nothing back in the stdout buffer. Code example below:

 

ssh = paramiko.SSHClient()

   ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())

   print("Connecting to AP")

   ssh.connect(hostname=ap_ip, username="admin", password="1234")

   print("Connected -sending command to AP")

   stdin, stdout, stderr = ssh.exec_command("show version")

   print("command issued")

   data_out = stdout.readlines()

   print(data_out)

   stdin.flush()

   ssh.close()

 

Has anyone successfully been able to script against the Aerohive APs? Any direction would be appreciated as I am not making progress with this effort. Thanks!

13 REPLIES 13

bobby_clowers
New Contributor

I tried using it and this is the message I get. Where do i put in the ip address?

usage: Data_Extraction.py [-h] ip_addresses [ip_addresses ...]

Data_Extraction.py: error: the following arguments are required: ip_addresses

andy_truett
New Contributor

Take a look at https://github.com/andytruett/aeromiko/blob/master/example/example.py and see if you can do anything with it.

andy_truett
New Contributor

Take look here and see if this script makes any sense for you:

 

https://github.com/andytruett/Aeromiko/tree/master/example

bobby_clowers
New Contributor

I was trying to use what you had. know very little about python. If its to much i understand.

GTM-P2G8KFN