GithubHelp home page GithubHelp logo

longbeachhxc / netdev Goto Github PK

View Code? Open in Web Editor NEW

This project forked from selfuryon/netdev

0.0 0.0 0.0 339 KB

Asynchronous multi-vendor library for interacting with network devices

Home Page: http://netdev.readthedocs.io/

License: Apache License 2.0

Python 100.00%

netdev's Introduction

Netdev

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())

netdev's People

Contributors

selfuryon avatar zklevsha avatar brechtold avatar danielolson13 avatar longbeachhxc avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.