Skip to main content

Fork of netdev: Asynchronous multi-vendor library for interacting with network devices

Project description

Asynchronet (Under Construction)

Inspired by Netmiko, Asynchronet is a multi-vendor library for asynchronously interacting with network devices through the CLI.

Asynchronet is a fork of Netdev, which is no longer maintained. This project was forked to continue to expand and enhance the existing capabilities while enabling community contribution.

The key features are:

  • Asynchronous CLI Interactions: Thanks to asyncssh, which powers asynchronet provides support for multiple SSH connections within a single event loop.
  • Multi-Vendor Support: Currently twelve of the most popular networking hardware vendors are supported, with more to be added in the future.
  • Autodetect Device Type: By porting Netmiko's battle-tested SSHDetect class to work asynchronously with asyncssh, asynchronet makes automatic device type detection a breeze.
  • Simple: Intuitive classes make it easy to interact with your favorite flavor of device.

Requirements

Python 3.10+

Installation

pip install asynchronet

Example

import asyncio

import asynchronet

async def task(param):
    async with asynchronet.create(**param) as ios:
        # Send a simple command
        out = await ios.send_command("show ver")
        print(out)
        # Send a full configuration set
        commands = ["line console 0", "exit"]
        out = await ios.send_config_set(commands)
        print(out)
        # Send a command with a long output
        out = await ios.send_command("show run")
        print(out)
        # 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():
    device_1 = {
        "username": "user",
        "password": "pass",
        "device_type": "cisco_ios",
        "host": "ip address",
    }
    device_2 = {
        "username": "user",
        "password": "pass",
        "device_type": "cisco_ios",
        "host": "ip address",
    }
    devices = [device_1, device_2]
    tasks = [task(device) for device in devices]
    await asyncio.wait(tasks)


loop = asyncio.get_event_loop()
loop.run_until_complete(run())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

asynchronet-0.1.0.tar.gz (29.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

asynchronet-0.1.0-py3-none-any.whl (49.2 kB view details)

Uploaded Python 3

File details

Details for the file asynchronet-0.1.0.tar.gz.

File metadata

  • Download URL: asynchronet-0.1.0.tar.gz
  • Upload date:
  • Size: 29.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.9.10 Linux/5.10.16.3-microsoft-standard-WSL2

File hashes

Hashes for asynchronet-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cb3d3410c6d8b0f988ea90dc95f864eb9477a70753c18413554eabafa8ea6696
MD5 095c3e8567877dd289e77a9c20e515ca
BLAKE2b-256 aeb31f44df0af4c77b93d680e82ed17df376068e614d486125908780dec7d516

See more details on using hashes here.

File details

Details for the file asynchronet-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: asynchronet-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 49.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.9.10 Linux/5.10.16.3-microsoft-standard-WSL2

File hashes

Hashes for asynchronet-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2b46f705058c557b027cbecb68a21e2cfa06dcd1a2e9dedb23d0dd7b02c28c69
MD5 93e83fd71c225d535baf2339e326081c
BLAKE2b-256 3ad8d3de991d36ade969fd87f513aeffe16d7ba832d14316e2fc815e99964a1f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page