Skip to content

Instantly share code, notes, and snippets.

@Zweedeend Zweedeend/stuart.py
Created Jul 9, 2019

Embed
What would you like to do?
#!/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
You can’t perform that action at this time.