Coder Social home page Coder Social logo

ciscodevnet / xr-gnmi-lab Goto Github PK

View Code? Open in Web Editor NEW
5.0 4.0 0.0 262 KB

Understand gNMI and how to build your first gNMI client with Python to interwork with IOS-XR

License: Apache License 2.0

Jupyter Notebook 100.00%
ios-xr gnmi jupyter-notebook cisco cisco-ios-xr yang

xr-gnmi-lab's Introduction

xr-gnmi-lab

published Run in Cisco Cloud IDE

Understand gNMI and how to build your first gNMI client with Python to interwork with IOS-XR

Use Case Description

This laboratory comes with two Jupyter notebooks for practising the gNMI functionalities of Cisco IOS XR. A set of Docker containers is used for collecting and monitoring model-driven telemetry data.

Installation

Dependencies

Configure

  1. Deploy the stack of containers for monitoring of telemetry data by following these instructions.

  2. Load the Traffic Monitoring dashboard in Chronograf.

Configuration

The details for the connection and authentication to the IOS XR can be found in each notebook.

This laboratory assumes the following:

  • the host of the Jupyter notebook and the docker containers is 198.18.134.50
  • the Jupyter notebook is exposed on port 8080
  • the Chronograf web application is exposed on port 8888
  • the IOS XR is reachable at 198.18.134.72 with username cisco and password cisco
  • the IOS XR has the following gRPC configuration:
    grpc
     port 57777
    !
    

Usage

Access the notebook at https://198.18.134.50:8080.

Start with the cisco-gNMI-main notebook. To run a section of the laboratory, select the cell and press Shift+Enter.

How to test the software

This laboratory was tested in an environment that had the following software installed:

Software version
Python 3.6.8
Cisco-gnmi 1.0.4
Jupyter-notebook 6.0.2
Docker 19.03.5
Docker-compose 1.25.1
IOS XR 7.0.x

Getting help

If you have questions, concerns, bug reports, etc., please create an issue against this repository.

Getting involved

Feedback, bug fixes and feature enhancements or additions are encouraged. Please see the CONTRIBUTING file for more information.

Author(s)

This project was written and is maintained by the following individuals:

xr-gnmi-lab's People

Contributors

cprecup avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

xr-gnmi-lab's Issues

from cisco_gnmi import ClientBuilder

This import generates the following error in Jupyter notebook with python 3.9.5 installed, with a suggestion to downgrade the protobuf package to 3.20.x or lower.

Package Version


cisco-gnmi 1.0.16
grpcio 1.50.0
protobuf 4.21.9


TypeError Traceback (most recent call last)
Cell In [2], line 1
----> 1 from cisco_gnmi import ClientBuilder

File ~/code/xr-gnmi-lab/venv/lib/python3.9/site-packages/cisco_gnmi/init.py:27
1 """Copyright 2019 Cisco Systems
2 All rights reserved.
3
(...)
21 the License.
22 """
24 """This library wraps gNMI functionality to ease usage in Python programs."""
---> 27 from .client import Client
28 from .xr import XRClient
29 from .nx import NXClient

File ~/code/xr-gnmi-lab/venv/lib/python3.9/site-packages/cisco_gnmi/client.py:30
27 from xml.etree.ElementPath import xpath_tokenizer_re
28 from six import string_types
---> 30 from . import proto
31 from . import util
34 LOGGER = logging.getLogger(name)

File ~/code/xr-gnmi-lab/venv/lib/python3.9/site-packages/cisco_gnmi/proto/init.py:25
1 """Copyright 2019 Cisco Systems
2 All rights reserved.
3
(...)
21 the License.
22 """
---> 25 from . import gnmi_pb2_grpc
26 from . import gnmi_pb2

File ~/code/xr-gnmi-lab/venv/lib/python3.9/site-packages/cisco_gnmi/proto/gnmi_pb2_grpc.py:4
1 # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
2 import grpc
----> 4 from . import gnmi_pb2 as gnmi__pb2
7 class gNMIStub(object):
8 # missing associated documentation comment in .proto file
9 pass

File ~/code/xr-gnmi-lab/venv/lib/python3.9/site-packages/cisco_gnmi/proto/gnmi_pb2.py:19
17 from google.protobuf import any_pb2 as google_dot_protobuf_dot_any__pb2
18 from google.protobuf import descriptor_pb2 as google_dot_protobuf_dot_descriptor__pb2
---> 19 from . import gnmi_ext_pb2 as gnmi__ext__pb2
22 DESCRIPTOR = _descriptor.FileDescriptor(
23 name='gnmi.proto',
24 package='gnmi',
(...)
28 ,
29 dependencies=[google_dot_protobuf_dot_any__pb2.DESCRIPTOR,google_dot_protobuf_dot_descriptor__pb2.DESCRIPTOR,gnmi__ext__pb2.DESCRIPTOR,])
31 _ENCODING = _descriptor.EnumDescriptor(
32 name='Encoding',
33 full_name='gnmi.Encoding',
(...)
61 serialized_end=3485,
62 )

File ~/code/xr-gnmi-lab/venv/lib/python3.9/site-packages/cisco_gnmi/proto/gnmi_ext_pb2.py:33
14 _sym_db = _symbol_database.Default()
19 DESCRIPTOR = _descriptor.FileDescriptor(
20 name='gnmi_ext.proto',
21 package='gnmi_ext',
(...)
24 serialized_pb=_b('\n\x0egnmi_ext.proto\x12\x08gnmi_ext"\x86\x01\n\tExtension\x12\x37\n\x0eregistered_ext\x18\x01 \x01(\x0b\x32\x1d.gnmi_ext.RegisteredExtensionH\x00\x12\x39\n\x12master_arbitration\x18\x02 \x01(\x0b\x32\x1b.gnmi_ext.MasterArbitrationH\x00\x42\x05\n\x03\x65xt"E\n\x13RegisteredExtension\x12!\n\x02id\x18\x01 \x01(\x0e\x32\x15.gnmi_ext.ExtensionID\x12\x0b\n\x03msg\x18\x02 \x01(\x0c"Y\n\x11MasterArbitration\x12\x1c\n\x04role\x18\x01 \x01(\x0b\x32\x0e.gnmi_ext.Role\x12&\n\x0b\x65lection_id\x18\x02 \x01(\x0b\x32\x11.gnmi_ext.Uint128"$\n\x07Uint128\x12\x0c\n\x04high\x18\x01 \x01(\x04\x12\x0b\n\x03low\x18\x02 \x01(\x04"\x12\n\x04Role\x12\n\n\x02id\x18\x01 \x01(\t*3\n\x0b\x45xtensionID\x12\r\n\tEID_UNSET\x10\x00\x12\x15\n\x10\x45ID_EXPERIMENTAL\x10\xe7\x07\x62\x06proto3')
25 )
27 _EXTENSIONID = _descriptor.EnumDescriptor(
28 name='ExtensionID',
29 full_name='gnmi_ext.ExtensionID',
30 filename=None,
31 file=DESCRIPTOR,
32 values=[
---> 33 _descriptor.EnumValueDescriptor(
34 name='EID_UNSET', index=0, number=0,
35 serialized_options=None,
36 type=None),
37 _descriptor.EnumValueDescriptor(
38 name='EID_EXPERIMENTAL', index=1, number=999,
39 serialized_options=None,
40 type=None),
41 ],
42 containing_type=None,
43 serialized_options=None,
44 serialized_start=385,
45 serialized_end=436,
46 )
47 _sym_db.RegisterEnumDescriptor(_EXTENSIONID)
49 ExtensionID = enum_type_wrapper.EnumTypeWrapper(_EXTENSIONID)

File ~/code/xr-gnmi-lab/venv/lib/python3.9/site-packages/google/protobuf/descriptor.py:755, in EnumValueDescriptor.new(cls, name, index, number, type, options, serialized_options, create_key)
752 def new(cls, name, index, number,
753 type=None, # pylint: disable=redefined-builtin
754 options=None, serialized_options=None, create_key=None):
--> 755 _message.Message._CheckCalledFromGeneratedFile()
756 # There is no way we can build a complete EnumValueDescriptor with the
757 # given parameters (the name of the Enum is not known, for example).
758 # Fortunately generated files just pass it to the EnumDescriptor()
759 # constructor, which will ignore it, so returning None is good enough.
760 return None

TypeError: Descriptors cannot not be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:

  1. Downgrade the protobuf package to 3.20.x or lower.
  2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).

More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates

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.