Out of tree netmiko monkeypatch for multihop capability
Project description
netmiko_multihop is an out of tree netmiko monkeypatch which adds multihop capability. Currently just linux is supported as intermediate hop, but other platforms can be added easily if required.
Installation
Install the netmiko_multihop package by running:
pip3 install netmiko-multihop
Usage
import netmiko_multihop
from netmiko import ConnectHandler
jumphost1 = {
'device_type': 'linux',
'ip': <ip_jumphost1>,
'username': <ssh_username_jumphost1>,
'password': <ssh_password_jumphost1>,
'port': 22,
}
jumphost2 = {
'device_type': 'linux',
'ip': <ip_jumphost2>,
'username': <ssh_username_jumphost2>,
'password': <ssh_password_jumphost2>,
'port': 22,
}
target1 = {
'device_type': 'cisco_nxos',
'ip': <ip_target1>,
'username': <ssh_username_target1>,,
'password': <ssh_password_target1>,
'port': 22,
}
target2 = {
'device_type': 'cisco_ios',
'ip': <ip_target2>,
'username': <ssh_username_target2>,
'password': <ssh_password_target2>,
'port': 22,
}
ssh = ConnectHandler(**jumphost1)
# now we are on jumphost1
# this is where the magic starts. as jump_to returns the object instance we can jump multiple hops at once
ssh.jump_to(**jumphost2).jump_to(**target1)
# now we are on target1
print(ssh.send_command("show inventory"))
# lets get back a single jump
ssh.jump_back()
# now we are on jumphost2
ssh.jump_to(**target2)
# now we are on target2
print(ssh.send_command("show inventory"))
Contribute
Issue Tracker: https://github.com/jinjamator/netmiko_multihop/issues
Source Code: https://github.com/jinjamator/netmiko_multihop
License
This project is licensed under the Apache License Version 2.0
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
File details
Details for the file netmiko_multihop-0.1-py3-none-any.whl
.
File metadata
- Download URL: netmiko_multihop-0.1-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.4.2 requests/2.28.0 setuptools/65.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8760169e09399552c665509432bbabdaa7849b496c929357ae74a01ce16635ca |
|
MD5 | a1ea4fa9b2a195020b0d6ab9fa179aa2 |
|
BLAKE2b-256 | 76e4e4a7847ebb23c7c8381d8fe2fd74d8859a65c9ab1359fbf355bd35d21481 |