cannon
Project description
Introduction
cannon is a wrapper around pexpect to connect with remote server or network devices with ssh.
Example Usage
from cannon import Shell, Account
sess = Shell(
host='route-views.oregon-ix.net',
credentials=(
Account(user='rviews', passwd=''),
),
log_screen=False,
log_file="~/mylog.txt",
debug=False,
)
sess.execute('term len 0')
# Manually sync prompts... sometimes this is reqd
sess.sync_prompt(require_detect_prompt=False)
# template is a TextFSM template
values = sess.execute('show ip int brief',
template="""Value INTF (\S+)\nValue IPADDR (\S+)\nValue STATUS (up|down|administratively down)\nValue PROTO (up|down)\n\nStart\n ^${INTF}\s+${IPADDR}\s+\w+\s+\w+\s+${STATUS}\s+${PROTO} -> Record""")
print("VALUES "+str(values))
sess.close()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cannon-0.0.24.tar.gz
(22.9 kB
view hashes)
Built Distribution
cannon-0.0.24-py3-none-any.whl
(11.2 kB
view hashes)