Giter Club home page Giter Club logo

pyiosxr's Introduction

pyIOSXR

In the spirit of pyEOS for Arista EOS devices and pyEZ for JUNOS devices, pyIOSXR is a python library to help interact with Cisco devices running IOS-XR.

Install

To install, execute:

pip install pyIOSXR

Documentation

Connect

Connect to an IOS-XR device:

>>> from pyIOSXR import IOSXR
>>> device = IOSXR(hostname='lab001', username='ejasinska', password='passwd', port=22, timeout=120)
>>> device.open()

Load and Compare Config

Load a candidate configuration from a file and show the diff that is going to be applied when committing the config:

>>> device.load_candidate_config(filename='unit/test/config.txt')
>>> device.compare_config()
---
+++
@@ -704,0 +705,3 @@
+interface TenGigE0/0/0/21
+ description testing-xml-from-file
+!

Discard Candidate Config

If an already loaded configuration should be discarded without committing it, call discard_config():

>>> device.discard_config()
>>> device.compare_config()
>>>

Load, Compare and Merge Config

If you want to commit the loaded configuration and merge it with the existing configuration, call commit_config():

>>> device.load_candidate_config(filename='unit/test/other_config.txt')
>>> device.compare_config()
---
+++
@@ -704,0 +705,3 @@
+interface TenGigE0/0/0/21
+ description testing-xml-from-the-other-file
+!
>>> device.commit_config()

Commit Replace Config

If you would rather commit the config by replacing the existing configuration, call commit_replace_config():

>>> device.load_candidate_config(filename='unit/test/full_config.txt')
>>> device.compare_replace_config()
>>> device.commit_replace_config()

Rollback Config

After a previous commit, rollback() will return to the configuration prior to the commit:

>>> device.rollback()

Running Show Commands

Any show command can be executed in the following fashion, with the command embedded into the call:

>>> device.show_bgp_summary()
...
>>> device.show_interfaces()
...

Running XML Commands

An arbitrary XML command can be executed with the command:

>>> device.make_rpc_call("<Get><Operational><LLDP><NodeTable></NodeTable></LLDP></Operational></Get>")
...

Close Connection

Call close() to close the connection to the device:

>>> device.close()

Thanks

A special thanks to David Barroso! This library is entirely based on David's pyEOS, which is a wrapper around Arista's eAPI for EOS.

Also, many thanks go out to Brady Walsh, without whom staying sane while digging through Cisco docs and XML would have been impossible.

License

Copyright 2015-2016 Netflix, Inc.

Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0

pyiosxr's People

Contributors

dbarrosop avatar fooelisa avatar ogenstad avatar

Stargazers

 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.