Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

aio-nxapi

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aio-nxapi

Cisco NX-API asyncio client

  • 0.6.0
  • PyPI
  • Socket score

Maintainers
1

Cisco NX-API asyncio Client

This repository contains a Cisco NX-API asyncio based client that uses the httpx as an underlying transport and lxml as the basis for handling XML.

Note: This client does not support the NETCONF interface.

WORK IN PROGESS

Quick Example

Thie following shows how to create a Device instance and run a list of commands.

By default the Device instance will use HTTPS transport. The Device instance supports the following settings:

  • host - The device hostname or IP address
  • username - The login user-name
  • password - The login password
  • proto - (Optional) Choose either "https" or "http", defaults to "https"
  • port - (Optional) Chose the protocol port to override proto default

The result of command execution is a list of CommandResults (namedtuple). The output field will be:

  • lxml.Element when output format is 'xml'
  • dict when output format is 'json'
  • str when output format is 'text'
from asyncnxapi import Device

username = 'dummy-user'
password = 'dummy-password'

async def run_test(host):
    dev = Device(host=host, creds=(username, password))
    res = await dev.exec(['show hostname', 'show version'], ofmt='json')
    for cmd in res:
       if not cmd.ok:
          print(f"{cmd.command} failed")
          continue

       # do something with cmd.output as dict since ofmt was 'json'

Limitations

  • Chunking is not currently supported. If anyone has need of this feature please open an issue requesting support.

References

Cisco DevNet NX-API Rerefence:

Cisco platform specific NX-API references:

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc