Skip to content

Instantly share code, notes, and snippets.

@nitrocode
Last active August 16, 2024 23:32
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 "[email protected]". I have tried to solve this using "user\@mydomain.com" or "'[email protected]'" .
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.

@nitrocode
Copy link
Author

@fescalero this script is very basic as it passes the username argument directly into netmiko. Have you considered opening up an issue with netmiko ?

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