Created
August 7, 2017 16:36
-
-
Save ktbyers/cdb774172a5c87072d9d00735bd9a0c3 to your computer and use it in GitHub Desktop.
napalm nxos_ssh testing
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
# 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