Skip to main content

netmiko_multihop is an out of tree netmiko monkeypatch which adds multihop capability. Currently following platforms are supported as intermediate hop:

  • linux

  • cisco_nxos

  • cisco_ios

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,
}

# If the next hop is reachable via vrf on the current hop, add the vrf parameter to the destination configuration.
# Eg.: Target1 is reachable via vrf mgmt from target2.
#      You want to jump from target1 to target2.
#      Add the parameter vrf='mgmt' to target2 configuration before you jump from target1 to target2.

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"))
ssh.jump_back()

Contribute

License

This project is licensed under the Apache License Version 2.0

Metadata

Release files for netmiko-multihop 0.3.6.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for netmiko-multihop 0.3.6.1
File Interpreter ABI Platform Actions
netmiko_multihop-0.3.6.1-py3-none-any.whl Python 3 none any Details for netmiko_multihop-0.3.6.1-py3-none-any.whl

Release files / netmiko_multihop-0.3.6.1-py3-none-any.whl

Download URL netmiko_multihop-0.3.6.1-py3-none-any.whl
Size 7.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6d8370982a644dc550ea4963029b603fcd05c0249767f7a7747ea2168129cb1b
BLAKE2b-256 checksum
How to use checksums
148d92b80da2f13d36bc5b42a5660b45c3f9c3e307891f4a30bcca574416992f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Security for netmiko-multihop 0.3.6.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page