.. image:: https://github.com/akarneliuk/pygnmi/blob/master/logo.png :width: 300 :height: 300 :alt: pyGNMI logo :align: center
|project| |version| |coverage| |tag| |license|_
This repository contains pure Python implementation of the gNMI client to interact with the network functions.
Sample code example:
.. code-block:: python3
from pygnmi.client import gNMIclient
host = ('169.254.255.64', '57400')
if name == 'main': with gNMIclient(target=host, username='admin', password='admin', insecure=True) as gc: result = gc.get(path=['openconfig-interfaces:interfaces', 'openconfig-acl:acl'])
print(result)
Also integration with Nornir is supported (refer to examples <examples/nornir>
_).
Watch the detailed explanation how to use pyGNMI in our YouTube channel <https://www.youtube.com/watch?v=NooE_uHIgys&list=PLsTgo2tBPnTwmeP9zsd8B_tZR-kbguvla>
_.
By using the pyGNMI tool you agree with the license <LICENSE.txt>
_.
Anton Karneliuk <https://github.com/akarneliuk>
_Stefan Lieberth <https://github.com/slieberth>
_Prem Anand Haridoss <https://github.com/hprem>
_Andrew Southard <https://github.com/andsouth44>
_Jeroen van Bemme <https://github.com/jbemmel>
_Frédéric Perrin <https://github.com/fperrin>
_Malanovo <https://github.com/malanovo>
_Sebastian Lohff <https://github.com/sebageek>
_Release 0.8.14:
prefix
to pygnmicli
.Adding error propagation from child thread to main thread <https://github.com/akarneliuk/pygnmi/pull/142>
Changes to u_val <https://github.com/akarneliuk/pygnmi/pull/144>
Adding Master Arbitration support for Set <https://github.com/akarneliuk/pygnmi/pull/146>
Adding bytes_val and leaflist_val with string_val parsing <https://github.com/akarneliuk/pygnmi/pull/151>
Release 0.8.13:
Release 0.8.12:
no_qos_marking
flag for pygnmicli
.Release 0.8.11:
Juniper
due to inconsistency of communicated encoudings in Capabilities()
and what is really supported in Subscribe()
.Release 0.8.10:
subscribe2
method).qos
from Subscribe
for platforms, which doesn't support it (e.g., Juniper
).Release 0.8.9:
encoding
everywhere is set to None
.capabilities()
now is called as part of connect()
to collect supported encoding as part of session establishing.encoding
is not specified by user, then it is auto-set based on the list collected via capabilites()
with json
having the first priority follwed by json_ietf
.Release 0.8.8:
-e / --encoding
to pygnmicli
to specify the encoding, which overrides the default one. Fix for Issue 58 <https://github.com/akarneliuk/pygnmi/issues/58>
_.get()
and subscribe2()
methods.Release 0.8.7:
json_val
or json_ietf_val
is not processed correctly if the value is empty string. Fix for Issue 58 <https://github.com/akarneliuk/pygnmi/issues/58>
_.Release 0.8.6:
insecure
channel.prefix
in Subscribe messages for subscribe2()
method.subscribe2()
instead of subscribe()
for building telemetry collectors with pygnmi
as this method is further developed and throroughle tested. The method subscribe()
will be deprecated in future releases.qos
is now properly supported in subscribe2()
method.Release 0.8.5:
pygnmicli
.Release 0.8.4:
token
authentication to pygnmicli
.Release 0.8.3:
subscribe2()
to RPC to avoid adding the empty Extension
field for no extensions presenting. Fix for Issue 83 <https://github.com/akarneliuk/pygnmi/issues/83>
_.pygnmicli
.Release 0.8.2:
History Extension <https://github.com/openconfig/reference/blob/master/rpc/gnmi/gnmi-history.md#1-purpose>
_.--skip-verify
was failing trying to parse certificate, which doesn't have CN and SARs <https://github.com/akarneliuk/pygnmi/issues/71>
_.Release 0.8.1:
--no-binary=protobuf
for operation.Release 0.8.0:
grpcio-tools
to protobuf
, which as a standalone package has a much newer serion.0.8.0
.Release 0.7.5:
ONCE
telemetry mode to automatically terminate on receiving {"sync_response": True}
message.Release 0.7.4:
skip_verify
is now stabilised and doesn't require subject alternative names any more.Release 0.7.3:
target
functionality to be more inline with gNMI Reference.Release 0.7.2:
skip_verify
logic. Impotant: for this feature to work, you need at least one subject alternative name filed (DNS, IP address, email, - any will work). It also doesn't matter which value it has, but at least one item shall present.Release 0.7.1:
skip_verify
to gNMIclient
, which removes a need to set the override
argument manually. However, the latter one still stays for the backward compatibility.username
and password
from None
to ""
, as with token-based authentication they don't need to be specified.target
to gNMIclient.get()
, gNMIclient.set()
, and gNMIclient.subscribe2()
methods. If provided, it adds target
key to Path()
per GNMI Specification 2.2.2.1 <https://github.com/openconfig/reference/blob/master/rpc/gnmi/gnmi-specification.md#2221-path-target>
_.Release 0.7.0:
Authorization: Bearer TOKEN
, where TOKEN
is a variable provided as gNMIclient(token=TOKEN)
key (needed for Arista CVP).GRPC_SSL_CIPHER_SUITES
dynamically to HIGH
value (needed for Nokia SR OS).Release 0.6.9:
Release 0.6.8:
Release 0.6.7:
show_diff
key to gNMIclient
object (supported values print
and get
). When applied, it shows the changes happened to all keys following XPath from all arguments to Set()
RPC at the network devices. It is so fair tailored to OpenConfig YANG modules as it uses some architectural principles of OpenConfig YANG module to re-construct XPath.connect()
method.Release 0.6.6:
Release 0.6.5:
prefix
and timestamp
in SetResponse
message.alias
and atomic
in Notification
message.Release 0.6.4:
Release 0.6.3:
prefix
key in the Update
message.Release 0.6.2:
Subscribe
RPC not sending delete notification in case of a path is removed from the node.Release 0.6.1:
Release 0.6.0:
subscribe2
method by simply providing the a corredponding dictionary at input and all modes (STREA, ONCE, POLL) are working correctly.telemetryParser
is now automatically used inside subscribe2
.threading
.pytest
and added code coverage with coverage.py
.Release 0.5.3:
Release 0.5.2:
Release 0.5.1:
close()
Release 0.5.0:
Release 0.4.8:
yang-module:container/container[key=value]
, /yang-module:container/container[key=value]
, /yang-module:/container/container[key=value]
, /container/container[key=value]
Release 0.4.6:
gNMI Path issue <https://github.com/akarneliuk/pygnmi/issues/13>
_.Release 0.4.6:
sys.exit
with raising exceptions./origin:element1/element2...
./element1/element2...
.Release 0.4.5:
Release 0.4.4:
Release 0.4.3:
gnmi_timeout
key for gNMIclient
class.Release 0.4.2:
gNMI Path encoding conventions <https://github.com/openconfig/reference/blob/master/rpc/gnmi/gnmi-path-conventions.md>
_.debug
output, where the requests where not printed in case of response failing.Release 0.4.1:
Release 0.4.0:
override
for PKI-based certificatesRelease 0.3.12:
Release 0.3.11:
Release 0.3.10:
debug=True
upon object creation to see the Protobuf messages.Release 0.3.9:
get(path[])
.Release 0.3.8:
Release 0.3.7:
encoding
as an extra key to Set
operationRelease 0.3.6:
encoding
to Get
operationRelease 0.3.5:
Release 0.3.4:
close
method to gNMIClient
class for those, who doesn't use with ... as ...
context manager.Release 0.3.3:
Release 0.3.2:
Release 0.3.1:
Release 0.3.0:
telemetryParser
, which converts Protobuf messages in Python dictionary.Release 0.2.7:
once
and stream
mode.Release 0.2.6:
Subscribe
operation.Release 0.2.5:
Release 0.2.4:
Release 0.2.3:
Release 0.2.2:
Release 0.2.1:
Set
operations (delete
, replace
, and update
) are working properly.Releast 0.2.0:
Set
operation from gNMI specification.Releast 0.1.9:
datatype='all'
to the get() request. The values are per the gNMI specification: all, config, state, operatonal.Release 0.1.8:
Release 0.1.7:
Release 0.1.6:
Release 0.1.5:
Release 0.1.4:
Release 0.1.3:
Release 0.1.2:
Release 0.1.1:
Get
operation out of gNMI specification.Release 0.1.0:
(c)2020-2022, karneliuk.com
.. |version| image:: https://img.shields.io/static/v1?label=latest&message=v0.8.14&color=success .. _version: https://pypi.org/project/pygnmi/ .. |tag| image:: https://img.shields.io/static/v1?label=status&message=stable&color=success .. _tag: https://pypi.org/project/pygnmi/ .. |license| image:: https://img.shields.io/static/v1?label=license&message=BSD-3-clause&color=success .. _license: https://github.com/akarneliuk/pygnmi/blob/master/LICENSE.txt .. |project| image:: https://img.shields.io/badge/akarneliuk%2Fpygnmi-blueviolet.svg?logo=github&color=success .. _project: https://github.com/akarneliuk/pygnmi/ .. |coverage| image:: https://img.shields.io/static/v1?label=coverage&message=68%&color=yellow .. _coverage: https://github.com/nedbat/coveragepy