Coder Social home page Coder Social logo

ios-xr-grpc-python's Introduction

gRPC for Cisco IOS-XR in Python

Author: Karthik Kumaravel

This package contains a library with the methods that are available to use over gRPC with IOS-XR boxes after 6.0.0. The API has several methods which allows a user to send simple RPC commands such as get and push using YANG and JSON.

The repo consists of two main components:

  1. The compiled pb2 file from the proto definition.
  2. A Python module accessing the pb2 file with the library bindings.

The repo also includes examples on how to use the library to interact with an IOS-XR device. If you want to create your own client, there is a walkthrough at the bottom of this page.

If you find any problems or need help, create an issue!

Installation

Either download this repository or install with pip install iosxr_grpc

It is always recommended to work in a virtual environment with something like virtualenv or pipenv.

gRPC Calls

Enable gRPC

SSH in to the router and turn on gRPC, below is an example configuration:

interface GigabitEthernet 0/0/0/0
 ipv4 address 192.168.1.2 255.255.255.0
 no shut

grpc
 port 57777
 !
!

Note: Default port is 57400, and IPv4 only.

Using TLS

  1. Enable TLS in configuration, example:
grpc
  tls
  port 57777
  !
!
  1. Copy the autogenerated .pem file to the 'keys' folder in the client directory.
scp [email protected]:/misc/config/grpc/ems.pem ./

Usage

from iosxr_grpc.cisco_grpc_client import CiscoGRPCClient

from iosxr_grpc.cisco_grpc_client import CiscoGRPCClient
client = CiscoGRPCClient(
    <ip address>,
    <port>,
    <timeout>,
    <username>,
    <password>,
    <optional: tls key>,
    <optional: tls server name ('ems.cisco.com')>)
path = <yang path> # '{"openconfig-interfaces:interfaces": [null]}')
err, result = client.<operation>(path) # client.getconfig(path)

For a more in-depth look, check out the wiki!

Creating your own Client

To create a client of your own there are a few steps to follow.

Useful Links

If you would like to test this all out with IOS-XRv, use the following link to request access to the vagrant box.

https://xrdocs.github.io/

Projects that use the python client

Solenoid - App that injects routes directly into Cisco's IOS-XR RIB table.

Pipedown - CDN router monitoring tool for data center connectivity.

ios-xr-grpc-python's People

Contributors

brmcdoug avatar dcarrier avatar dependabot[bot] avatar flombardi avatar rahusha7 avatar remingtonc avatar skkumaravel 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.