Git Product home page Git Product logo

panix's Introduction

Panix, an NXAPI library

Panix is a python3 NXAPI convenience library. It internally uses json and returns the user python native data structures. It leverages requests for the json-rpc handling.

NXAPI is a Cisco Systems Inc. feature on recent NX-OS devices running a supported firmware that opens a http(s) API interface using JSON-RPC to execute commands on the device.

Panix offers some helper classes to make the structured output more workable.

Quickstart

First, make sure that on your target device, feature nxapi is supported and active.

# show feature
Feature Name         Instance State
-------------------- -------- -----
...
nxapi                1        enabled
...

You will want to check the programmability guide of your platform on Cisco.com on how to properly enable nxapi on it, if it is not already.

Once you have activated it, you can use Panix to execute commands on the device:

from panix import NXAPI

nxos = NXAPI('nxos_switch', username='admin', password='secret', scheme='https', port=8080)


# Text output of the command
sh_ver_text = nxos('show version')

# Some commands have structured output
sh_ver_data = nxos('show version', parsed=True)

# The structure isn't that great, Panix has helpers
from panix.helpers.version import version_helper

sh_ver_data = version_helper(sh_ver_data)

print(sh_ver_data['system_version'])
# '8.1(1)'

Acknowledgements

Thanks to MaartenD for coming up with the name

panix's People

Contributors

djoek avatar kvandecr avatar

Stargazers

 avatar  avatar  avatar

Watchers

 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.