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

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

Uploaded Source

Built Distribution

netdev-0.7.1-py3-none-any.whl (26.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: netdev-0.7.1.tar.gz
  • Upload date:
  • Size: 13.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for netdev-0.7.1.tar.gz
Algorithm Hash digest
SHA256 be390d592e2954dd22160a09d1b92e932d06c57c1fd6e492d5f3a737d9338d93
MD5 ae7d3f41e34ebcfdfbd57cf97cb09aa0
BLAKE2b-256 38afd8856f3018bde64f32cb61f1a0be7fbe514ed1fc6ed7b31c9c295aeee68c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for netdev-0.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a41628e2cc16e06ade459cfd295d5d59586004746925193dce94b980af72e617
MD5 9017203782da1bab3fd0cc109618942d
BLAKE2b-256 6354a0b8d7132b6e2cd8fb6324b0c23c3f23d22ac1b4ef4bdf392110e2a65d78

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