Skip to main content

simply its Netdev with textFSM

Project description

AsyncNetFSM


Asynchronous multi-vendor library for interacting with network devices

Support Telnet

Requires:

  • asyncio
  • AsyncSSH
  • Python >=3.5
  • pyYAML

Supports:

  • Cisco IOS
  • Cisco IOS XE
  • Cisco IOS XR
  • Cisco ASA
  • Cisco NX-OS
  • Cisco FTD
  • HP Comware (like V1910 too)
  • Fujitsu Blade Switches
  • Mikrotik RouterOS
  • Arista EOS
  • Juniper JunOS
  • Aruba AOS 6.X
  • Aruba AOS 8.X
  • Terminal
  • Fortinet

Examples:

Example of interacting with Cisco IOS devices:

.. code-block:: python

import asyncio
import asyncnetfsm

async def task(param):
    async with asyncnetfsm.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',
             'ip': 'ip address',
    }
    dev2 = { 'username' : 'user',
             'password' : 'pass',
             'device_type': 'cisco_ios',
             'ip': '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

asyncnetfsm-0.1.4.tar.gz (23.1 kB view details)

Uploaded Source

File details

Details for the file asyncnetfsm-0.1.4.tar.gz.

File metadata

  • Download URL: asyncnetfsm-0.1.4.tar.gz
  • Upload date:
  • Size: 23.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.4

File hashes

Hashes for asyncnetfsm-0.1.4.tar.gz
Algorithm Hash digest
SHA256 a05c9cf8df16c474f601982a4f25317481941dac697653017c8138736d15a7a1
MD5 c63f7bcd8e38085dbaa784d76414ffc8
BLAKE2b-256 de4da09121a602a1385a2b4b697079c5c74754b867f5f2bbe6f48a74fc73eb7c

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