Skip to content

Instantly share code, notes, and snippets.

@natenka
Created February 18, 2017 05:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save natenka/dcaf5427cd1cf4b523d9135a0af70d8e to your computer and use it in GitHub Desktop.
Save natenka/dcaf5427cd1cf4b523d9135a0af70d8e to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
# https://github.com/ktbyers/netmiko/issues/322
from netmiko import ConnectHandler
from getpass import getpass
ip_addr = input("Enter IP Address: ")
device = {
'device_type': 'cisco_ios',
'ip': ip_addr,
'username': 'testuser',
'use_keys': True,
'key_file': '/home/gituser/.ssh/test_rsa',
'port': 22,
}
net_connect = ConnectHandler(**device)
output = net_connect.send_command_expect("show version")
print(output)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment