Skip to main content

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 IOS XR

  • Cisco ASA

  • Cisco NX-OS

  • HP Comware (like V1910 too)

  • Fujitsu Blade Switches

  • Mikrotik RouterOS

  • Arista EOS

  • Juniper JunOS

  • Aruba AOS 6.X

  • Aruba AOS 8.X

  • Terminal

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


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.9.2.tar.gz (22.0 kB view details)

Uploaded Source

Built Distribution

netdev-0.9.2-py3-none-any.whl (37.1 kB view details)

Uploaded Python 3

File details

Details for the file netdev-0.9.2.tar.gz.

File metadata

  • Download URL: netdev-0.9.2.tar.gz
  • Upload date:
  • Size: 22.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.15 CPython/3.7.3 Linux/4.4.0-17134-Microsoft

File hashes

Hashes for netdev-0.9.2.tar.gz
Algorithm Hash digest
SHA256 570370daf3299647ed14044217827dcdf05f40bef3ed5e36e20bb23297ca5be3
MD5 d0b05fff624283ed07cf47388a541847
BLAKE2b-256 c896e0f292b264ca2e144db703f934173fe9e6370e8cd2d2537ff1d9e37c17c2

See more details on using hashes here.

File details

Details for the file netdev-0.9.2-py3-none-any.whl.

File metadata

  • Download URL: netdev-0.9.2-py3-none-any.whl
  • Upload date:
  • Size: 37.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.15 CPython/3.7.3 Linux/4.4.0-17134-Microsoft

File hashes

Hashes for netdev-0.9.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5687fe9bb6b134778a91ea377dcc2cd238f68f7eddcee7b224c369f563b88fc3
MD5 3e8e940770aa0f519258c2d89f7151a4
BLAKE2b-256 916669d5dc0b6a725023a7783df2abfda315cad3504dccb10e9ff978b9310d84

See more details on using hashes here.

Supported by

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