Created
May 13, 2016 17:27
-
-
Save ktbyers/da301f426f3d2c6d1f4f620f5838c552 to your computer and use it in GitHub Desktop.
This file contains 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 | |
from getpass import getpass | |
from pprint import pprint as pp | |
from napalm import get_network_driver | |
#from napalm_base import get_network_driver | |
#import napalm_ios | |
from netmiko import ConnectHandler | |
def main(): | |
ip_addr = '10.10.10.10' | |
username = 'admin' | |
optional_args = {} | |
optional_args['port'] = 22 | |
password = getpass() | |
driver = get_network_driver('ios') | |
device = driver(ip_addr, username, password, optional_args=optional_args) | |
print ">>>Test device open" | |
device.open() | |
print ">>>Test get facts" | |
device_facts = device.get_facts() | |
pp(device_facts) | |
if False: | |
print ">>>Load config change" | |
device.load_merge_candidate(filename='merge.conf') | |
print device.compare_config() | |
#device.discard_config() | |
#device.commit_config() | |
else: | |
print ">>>Load replace config " | |
device.load_replace_candidate(filename='initial.conf') | |
print device.compare_config() | |
#device.commit_config() | |
#device.discard_config() | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment