Skip to content

Instantly share code, notes, and snippets.

@nitrocode
Last active March 18, 2024 11:40
Show Gist options
  • Save nitrocode/ce888d3eb529cf78f4e0 to your computer and use it in GitHub Desktop.
Save nitrocode/ce888d3eb529cf78f4e0 to your computer and use it in GitHub Desktop.
Run an ssh command on Enterasys or Extreme switches using netmiko
#!/usr/bin/env python
# This will run an ssh command successfully on an enterasys SSA and so SSH must be enabled on the device(s).
# paramiko can be used but netmiko simplifies the code for these switches if you set the device_type to "a10"
from netmiko import ConnectHandler
#enterasyshandle = {'device_type':'a10', 'ip' : '10.54.116.175', 'username':'admin', 'password':''}
enterasyshandle = {'device_type':'enterasys', 'ip' : '10.54.116.175', 'username':'admin', 'password':''}
net_connect = ConnectHandler(**enterasyshandle)
output = net_connect.send_command('show config policy')
print(output)
#extremehandle = {'device_type':'a10', 'ip' : '10.54.149.80', 'username':'admin', 'password':''}
extremehandle = {'device_type':'extreme', 'ip' : '10.54.116.175', 'username':'admin', 'password':''}
net_connect = ConnectHandler(**extremehandle)
output = net_connect.send_command('show config vlan')
print(output)
@fescalero
Copy link

I have a problem with this code. First if we have a username like "user@mydomain.com". I have tried to solve this using "user\@mydomain.com" or "'user@mydomain.com'" .
Also I have a error like "Error reading SSH protocol banner" . I have tried to solve with 'banner_timeout': 200 and also with 'ssh_strict': False , but it doesn't work.
The device is a C5 model.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment