Last active
August 16, 2024 23:32
-
-
Save nitrocode/ce888d3eb529cf78f4e0 to your computer and use it in GitHub Desktop.
Run an ssh command on Enterasys or Extreme switches using netmiko
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@fescalero this script is very basic as it passes the
usernameargument directly intonetmiko. Have you considered opening up an issue withnetmiko?