Netrunner
An async network command runner built using Scrapli. You provide and inventory and tasks (functions), and the runner does the rest.
Currently only working with Cisco IOS and NXOS devices, but I will be adding others.
Installation
pip install netrunner
Basic Usage
Here is a basic example. More examples can be found in the examples folder.
import asyncio
from netrunner import Runner
hosts = [
{"hostname": "SW1021", "ip": "10.0.0.9", "platform": "ios"},
{"hostname": "SW1031", "ip": "10.0.0.10", "platform": "ios"},
{"hostname": "NX1001", "ip": "10.0.0.11", "platform": "nxos"},
{"hostname": "NX2001", "ip": "10.0.0.12", "platform": "nxos"},
]
# Here is a task. The first parameter is the host and must be provided.
# Other parameters can also be passed into the tasks/functions.
# Please see the examples in the example folder.
async def first_task(host):
# Commands must be passed in via a list. By default the output is parsed using
# Genie, but parse can be set to False if raw output is required
result = await host.send_command(["show version", "show vlan"])
return result
async def main():
# Hosts can either be passed here to be used globally, or can be passed per task
runner = Runner(username="test_user", password="T3stpass", hosts=hosts)
result = await runner.run(name="Check Version and Vlan", task=first_task)
print(result.run_time)
print(result.result["show version"])
print(result.result["show vlan"])
print(result.failed)
if __name__ == "__main__":
asyncio.run(main())
Metadata
Release files for netrunner 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| netrunner-0.1.6.tar.gz | 6.8 kB | Without provenance | Details for netrunner-0.1.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| netrunner-0.1.6-py3-none-any.whl | Python 3 | none | any | Details for netrunner-0.1.6-py3-none-any.whl |
Total release size: 15.1 kB
Release files / netrunner-0.1.6.tar.gz
| Download URL | netrunner-0.1.6.tar.gz |
|---|---|
| Size | 6.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
832c6e4775da2d969c780c18455048db6956ad1d056f47d1afe70657e95bd22b
|
|
BLAKE2b-256 checksum How to use checksums |
113d404afb680a955d4ac09110dcf38705c25f5f9bb0be34fdb0274aed5e529f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.8 CPython/3.8.10 Linux/5.4.0-84-generic
|
Release files / netrunner-0.1.6-py3-none-any.whl
| Download URL | netrunner-0.1.6-py3-none-any.whl |
|---|---|
| Size | 8.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f8ca3d9cea54520785d6b584d1c912ac84c12fe88b33dcba31a6be23d41133b7
|
|
BLAKE2b-256 checksum How to use checksums |
cb2b0739545a3555544090dc9c199b21778e1ea5815c47eddf53d136f5b93338
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.8 CPython/3.8.10 Linux/5.4.0-84-generic
|
Security for netrunner 0.1.6
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.