Created
July 9, 2019 08:11
-
-
Save nielskou/3d2a79000d927322df464ccb29af7a0e 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 python3 | |
from ncclient.manager import connect_ssh | |
# use unencrypted keys from ssh-agent or ~/.ssh keys, and rely on known_hosts | |
with connect_ssh("192.168.3.3", username="stuart") as manager: | |
assert(":url" in manager.server_capabilities) | |
with manager.locked("running"): | |
# create a new checkpoint | |
manager.copy_config(source="running", target="file:///new_checkpoint.conf") | |
# load an old checkpoint | |
manager.copy_config(source="file:///old_checkpoint.conf", target="running") | |
# dispatch a command | |
manager.dispatch('clear-arp-table') | |
# commit | |
manager.commit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment