Asynchronous multi-vendor library for interacting with network devices
Project description
Asynchronous multi-vendor library for interacting with network devices
Inspired by netmiko
Requires:
asyncio
AsyncSSH
Python >=3.5
pyYAML
Supports:
Cisco IOS
Cisco IOS XE
Cisco ASA
Cisco NX-OS
HP Comware (like V1910 too)
Fujitsu Blade Switches
Mikrotik RouterOS
Arista EOS
Juniper JunOS
Examples:
Example of interacting with Cisco IOS devices:
import asyncio
import netdev
async def task(param):
async with netdev.create(**param) as ios:
# Testing sending simple command
out = await ios.send_command("show ver")
print(out)
# Testing sending configuration set
commands = ["line console 0", "exit"]
out = await ios.send_config_set(commands)
print(out)
# Testing sending simple command with long output
out = await ios.send_command("show run")
print(out)
# Testing interactive dialog
out = await ios.send_command("conf", pattern=r'\[terminal\]\?', strip_command=False)
out += await ios.send_command("term", strip_command=False)
out += await ios.send_command("exit", strip_command=False, strip_prompt=False)
print(out)
async def run():
dev1 = { 'username' : 'user,
'password' : 'pass',
'device_type': 'cisco_ios',
'host': 'ip address',
}
dev2 = { 'username' : 'user,
'password' : 'pass',
'device_type': 'cisco_ios',
'host': 'ip address',
}
devices = [dev1, dev2]
tasks = [task(dev) for dev in devices]
await asyncio.wait(tasks)
loop = asyncio.get_event_loop()
loop.run_until_complete(run())
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
netdev-0.7.0.tar.gz
(13.6 kB
view details)
Built Distribution
netdev-0.7.0-py3-none-any.whl
(25.5 kB
view details)
File details
Details for the file netdev-0.7.0.tar.gz
.
File metadata
- Download URL: netdev-0.7.0.tar.gz
- Upload date:
- Size: 13.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e69999b9b33576a05c0cc470cba6e692d9df808a9a4ea644874c51ed166b96b |
|
MD5 | 92c62189e179dfcd4b751c03c8b9762d |
|
BLAKE2b-256 | a5c241673a43e60f67791b649621c3b45bcdb3d3e900666a9d335c26a18d7f19 |
File details
Details for the file netdev-0.7.0-py3-none-any.whl
.
File metadata
- Download URL: netdev-0.7.0-py3-none-any.whl
- Upload date:
- Size: 25.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f56df36c3ebd8390ab222c96ea6ac74b6a8419a6b6bb7f80491e8571d602e907 |
|
MD5 | 7c850513f308f31a4507bab060a23c44 |
|
BLAKE2b-256 | 3865f779c37b9b055256cf46e3fe5e013366bc8ca5cb1c41e8505a007832b935 |