Skip to content

Instantly share code, notes, and snippets.

@ktbyers
Created August 7, 2017 16:36
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 ktbyers/cdb774172a5c87072d9d00735bd9a0c3 to your computer and use it in GitHub Desktop.
Save ktbyers/cdb774172a5c87072d9d00735bd9a0c3 to your computer and use it in GitHub Desktop.
napalm nxos_ssh testing
# Create new virtual environment
# Activate virtual environment
source nxos_ssh_test/bin/activate
# Install napalm libraries
pip install -q napalm-base
pip install git+https://github.com/napalm-automation/napalm-nxos@nxos_ssh
# If using napalm-ansible
git clone https://github.com/napalm-automation/napalm-ansible
# Edit .ansible.cfg
[defaults]
# Add this line
library = /path/to/napalm-ansible/library
# Test script for config operations
-----
from __future__ import print_function
from napalm_base import get_network_driver
from getpass import getpass
driver = get_network_driver('nxos_ssh')
optional_args = {'port': 22}
device = driver(hostname='bogus.domain.com', username='admin', password=getpass(),
optional_args=optional_args)
device.open()
device.load_merge_candidate(filename='merge.conf')
print(device.compare_config())
#device.discard_config()
#device.commit_config()
device.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment