10-03-2019 04:19 PM
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!
02-13-2020 09:25 PM
Why don't you show us what you've got and we can walk through it with you.
02-13-2020 08:42 PM
I'm a noob on python and I can't seem to make any of those work. Any more help or explanation?
11-01-2019 02:52 PM
It's been used internally for a while, but decided to get it out into the world, due in part to seeing this question.
11-01-2019 02:45 PM
Andy - this is awesome! Did you just create this? Nice work!!
Good call on the Nornir, we had discussed using for this reason!
11-01-2019 02:36 PM
See also: https://github.com/andytruett/aeromiko
We pair it with Nornir to get information from many APs and make batch changes with concurrency.