{"id":14983590,"url":"https://github.com/akarneliuk/pygnmi","last_synced_at":"2025-05-15T17:04:03.176Z","repository":{"id":40333249,"uuid":"295507733","full_name":"akarneliuk/pygnmi","owner":"akarneliuk","description":"The pure Python implementation of the gNMI client.","archived":false,"fork":false,"pushed_at":"2025-03-10T22:21:02.000Z","size":1315,"stargazers_count":136,"open_issues_count":18,"forks_count":47,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-04-07T23:02:20.764Z","etag":null,"topics":["automation","gnmi","grpc","network","network-automation","pygnmi","python","telemetry"],"latest_commit_sha":null,"homepage":"https://training.karneliuk.com","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/akarneliuk.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-09-14T18:44:03.000Z","updated_at":"2025-03-25T14:05:41.000Z","dependencies_parsed_at":"2023-10-16T12:32:27.125Z","dependency_job_id":"9b665d46-7ef1-48a1-bfe8-7d464b2bc874","html_url":"https://github.com/akarneliuk/pygnmi","commit_stats":{"total_commits":198,"total_committers":28,"mean_commits":7.071428571428571,"dds":"0.35858585858585856","last_synced_commit":"18550b1bc9fe2ed4c4bd6a23841d3b749b8bac7b"},"previous_names":[],"tags_count":76,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akarneliuk%2Fpygnmi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akarneliuk%2Fpygnmi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akarneliuk%2Fpygnmi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akarneliuk%2Fpygnmi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akarneliuk","download_url":"https://codeload.github.com/akarneliuk/pygnmi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254384983,"owners_count":22062422,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","gnmi","grpc","network","network-automation","pygnmi","python","telemetry"],"created_at":"2024-09-24T14:07:33.463Z","updated_at":"2025-05-15T17:04:03.148Z","avatar_url":"https://github.com/akarneliuk.png","language":"Python","funding_links":[],"categories":["Library"],"sub_categories":["NETCONF"],"readme":"==========================\npyGNMI: Python gNMI client\n==========================\n\n.. image:: https://github.com/akarneliuk/pygnmi/blob/master/logo.png\n   :width: 300\n   :height: 300\n   :alt: pyGNMI logo\n   :align: center\n\n|project|_ |version|_ |coverage|_ |tag|_ |license|_\n\nThis repository contains pure Python implementation of the gNMI client to interact with the network functions.\n\n=====\nUsage\n=====\nSample code example:\n\n.. code-block:: python3\n\n  # Modules\n  from pygnmi.client import gNMIclient\n\n  # Variables\n  host = ('169.254.255.64', '57400')\n\n  # Body\n  if __name__ == '__main__':\n      with gNMIclient(target=host, username='admin', password='admin', insecure=True) as gc:\n           result = gc.get(path=['openconfig-interfaces:interfaces', 'openconfig-acl:acl'])\n\n      print(result)\n\nAlso integration with Nornir is supported (`refer to examples \u003cexamples/nornir\u003e`_).\n\nVideo tutorial\n--------------\nWatch the detailed explanation how to use pyGNMI `in our YouTube channel \u003chttps://www.youtube.com/watch?v=NooE_uHIgys\u0026list=PLsTgo2tBPnTwmeP9zsd8B_tZR-kbguvla\u003e`_.\n\n\nAll gNMI RPCs supported\n-----------------------\n- Capabilities\n- Get\n- Set\n- Subscribe\n\nSupported operation modes\n-------------------------\n- insecure gRPC channel (without encryption)\n- secure gRPC channel (with encryption and authentication based on certificate)\n\nTested Network Operating Systems (NOS)\n--------------------------------------\n- Arista EOS\n- Nokia SR OS\n- Cisco IOS XR\n- Juniper JUNOS\n- Nokia SRLinux\n- Cisco NX-OS\n\nNetwork Operating Systems (NOS) in test\n---------------------------------------\n- Broadcom SONiC\n\n=======\nLicense\n=======\nBy using the pyGNMI tool you agree with `the license \u003cLICENSE.txt\u003e`_.\n\n============\nContributors\n============\n\n- `Anton Karneliuk \u003chttps://github.com/akarneliuk\u003e`_\n- `Stefan Lieberth \u003chttps://github.com/slieberth\u003e`_\n- `Prem Anand Haridoss \u003chttps://github.com/hprem\u003e`_\n- `Andrew Southard \u003chttps://github.com/andsouth44\u003e`_\n- `Jeroen van Bemme \u003chttps://github.com/jbemmel\u003e`_\n- `Frédéric Perrin \u003chttps://github.com/fperrin\u003e`_\n- `Malanovo \u003chttps://github.com/malanovo\u003e`_\n- `Sebastian Lohff \u003chttps://github.com/sebageek\u003e`_\n\n=======\nDev Log\n=======\n\nRelease **0.8.15**:\n\n- IPv6 support: `Issue 166 \u003chttps://github.com/akarneliuk/pygnmi/pull/166\u003e`_.\n- Double support: `Issue 165 \u003chttps://github.com/akarneliuk/pygnmi/pull/165\u003e`_.\n\nRelease **0.8.14**:\n\n- Number of minor bug fixes and improvements.\n- Adding support of `prefix` to `pygnmicli`.\n- `Adding error propagation from child thread to main thread \u003chttps://github.com/akarneliuk/pygnmi/pull/142\u003e`_\n- `Changes to u_val \u003chttps://github.com/akarneliuk/pygnmi/pull/144\u003e`_\n- `Adding Master Arbitration support for Set \u003chttps://github.com/akarneliuk/pygnmi/pull/146\u003e`_\n- `Adding bytes_val and leaflist_val with string_val parsing \u003chttps://github.com/akarneliuk/pygnmi/pull/151\u003e`_\n\nRelease **0.8.13**:\n\n- Number of minor bug fixes and improvements.\n\nRelease **0.8.12**:\n\n- Fixed operation of `no_qos_marking` flag for `pygnmicli`.\n\nRelease **0.8.11**:\n\n- Previous release introduced break for telemetry in `Juniper` due to inconsistency of communicated encoudings in `Capabilities()` and what is really supported in `Subscribe()`.\n\nRelease **0.8.10**:\n\n- Automatic detection of supported encoding and using it where applicable (e.g., in `subscribe2` method).\n- Possibility to remove `qos` from `Subscribe` for platforms, which doesn't support it (e.g., `Juniper`).\n\nRelease **0.8.9**:\n\n- Default value for ``encoding`` everywhere is set to ``None``.\n- Method ``capabilities()`` now is called as part of ``connect()`` to collect supported encoding as part of session establishing.\n- If ``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``.\n\nRelease **0.8.8**:\n\n- Added new argument ``-e / --encoding`` to ``pygnmicli`` to specify the encoding, which overrides the default one. Fix for `Issue 58 \u003chttps://github.com/akarneliuk/pygnmi/issues/58\u003e`_.\n- Fixed minor bug with encoding handling inside ``get()`` and ``subscribe2()`` methods.\n- Simplified the code.\n\nRelease **0.8.7**:\n\n- Fixed bug, when returned ``json_val`` or ``json_ietf_val`` is not processed correctly if the value is empty string.  Fix for `Issue 58 \u003chttps://github.com/akarneliuk/pygnmi/issues/58\u003e`_.\n\nRelease **0.8.6**:\n\n- Fixed minor issue with establishing ``insecure`` channel.\n- Fixed bug with inabillity to specify ``prefix`` in Subscribe messages for ``subscribe2()`` method.\n- **Important**: It is recommended to use 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.\n- Functionality ``qos`` is now properly supported in ``subscribe2()`` method.\n\nRelease **0.8.5**:\n\n- Fixed some issues with telemetry representation with ``pygnmicli``.\n\nRelease **0.8.4**:\n\n- Change logic of setting default values for some parameters to improve user experience.\n- Added ``token`` authentication to ``pygnmicli``.\n\nRelease **0.8.3**:\n\n- Changed behaviour of ``subscribe2()`` to RPC to avoid adding the empty ``Extension`` field for no extensions presenting. Fix for `Issue 83 \u003chttps://github.com/akarneliuk/pygnmi/issues/83\u003e`_.\n- Uppdated documentation with examples in GitHub.\n- Added support of History extensions to ``pygnmicli``.\n\nRelease **0.8.2**:\n\n- Implemented `History Extension \u003chttps://github.com/openconfig/reference/blob/master/rpc/gnmi/gnmi-history.md#1-purpose\u003e`_.\n- Implemented handling of corner case, where ``--skip-verify`` was failing trying to parse certificate, `which doesn't have CN and SARs \u003chttps://github.com/akarneliuk/pygnmi/issues/71\u003e`_.\n\nRelease **0.8.1**:\n\n- Removed the need for ``--no-binary=protobuf`` for operation.\n\nRelease **0.8.0**:\n\n- **Important**: potentially breaking change. The dependency is moved from ``grpcio-tools`` to ``protobuf``, which as a standalone package has a much newer serion.\n- Spec is rebuilt and updated to support gNMI of version ``0.8.0``.\n\nRelease **0.7.5**:\n\n- Amended the logic of ``ONCE`` telemetry mode to automatically terminate on receiving ``{\"sync_response\": True}`` message.\n\nRelease **0.7.4**:\n\n- Feature ``skip_verify`` is now stabilised and doesn't require subject alternative names any more.\n\nRelease **0.7.3**:\n\n- Amended the logic of ``target`` functionality to be more inline with gNMI Reference.\n\nRelease **0.7.2**:\n\n- Minor bug fixing in the ``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.\n\nRelease **0.7.1**:\n\n- Added new argument ``skip_verify`` to ``gNMIclient``, which removes a need to set the ``override`` argument manually. However, the latter one still stays for the backward compatibility.\n- Changed default values for arguments ``username`` and ``password`` from ``None`` to ``\"\"``, as with token-based authentication they don't need to be specified.\n- Added new argument ``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 \u003chttps://github.com/openconfig/reference/blob/master/rpc/gnmi/gnmi-specification.md#2221-path-target\u003e`_.\n\nRelease **0.7.0**:\n\n- Added authentication with Token using ``Authorization: Bearer TOKEN``, where ``TOKEN`` is a variable provided as ``gNMIclient(token=TOKEN)`` key (needed for Arista CVP).\n- Added functionality to change  ``GRPC_SSL_CIPHER_SUITES`` dynamically to ``HIGH`` value (needed for Nokia SR OS).\n\nRelease **0.6.9**:\n\n- Adding new documentation for mutual TLS feature.\n\nRelease **0.6.8**:\n\n- Minor bug-fixing.\n\nRelease **0.6.7**:\n\n- Added new ``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.\n- Added an optional timeout to ``connect()`` method.\n- Minor bug-fixing.\n\nRelease **0.6.6**:\n\n- Minor bug-fixing.\n\nRelease **0.6.5**:\n\n- Implemented ``prefix`` and ``timestamp`` in ``SetResponse`` message.\n- Implemented ``alias`` and ``atomic`` in ``Notification`` message.\n- Minor bug-fixing.\n\nRelease **0.6.4**:\n\n- Minor bug-fixing.\n\nRelease **0.6.3**:\n\n- Implemented ``prefix`` key in the ``Update`` message.\n- Added possibility to provide password in STDIN rather than key.\n- Minor bug-fixing.\n\nRelease **0.6.2**:\n\n- Added support of keepalive timer for gRPC session to prevent automatic closure each 2 hours.\n- Fixed issue with ``Subscribe`` RPC not sending delete notification in case of a path is removed from the node.\n- Added the CLI based tool.\n- Minor bug-fixing.\n\nRelease **0.6.1**:\n\n- Added support of origin per RFC7951.\n- Added timeout to the initial setup useful for long-living connections.\n- Minor bug-fixing.\n\nRelease **0.6.0**:\n\n- Significant improvements in telemetry capabilities of the pygnmi. Now you can use ``subscribe2`` method by simply providing the a corredponding dictionary at input and all modes (STREA, ONCE, POLL) are working correctly.\n- Function ``telemetryParser`` is now automatically used inside ``subscribe2``.\n- Telemetry is now implemeted using ``threading``.\n- Added new unit tests with ``pytest`` and added code coverage with ``coverage.py``.\n\nRelease **0.5.3**:\n\n- Minor improvements and bug fixing.\n- Full coverage of unit tests for all operations (Capabilities, Get, Set(Update, Replace, Delete), Subscribe) and all notations of GNMI Path.\n\nRelease **0.5.2**:\n\n- Minor bug fixing.\n- First release with unit tests.\n\nRelease **0.5.1**:\n\n- Added example for non-blocking iterator for telemetry.\n- Added the extra support for Juniper TLS certificates.\n- Fixed regexp warnings.\n- Changed the logging functionality.\n- Enabled Unix domain socket.\n- Added ``close()``\n- Many thanks for all contributors to make this release happen.\n\nRelease **0.5.0**:\n\n- Added possibility to extract certificate from the destination network function.\n\nRelease **0.4.8**:\n\n- Added documentation in module regading supported the different paths naming conventions. Supported options: ``yang-module:container/container[key=value]``, ``/yang-module:container/container[key=value]``, ``/yang-module:/container/container[key=value]``, ``/container/container[key=value]``\n\nRelease **0.4.6**:\n\n- Fixed `gNMI Path issue \u003chttps://github.com/akarneliuk/pygnmi/issues/13\u003e`_.\n\nRelease **0.4.6**:\n\n- Replaced the ``sys.exit`` with raising exceptions.\n- Minor bug fix.\n- Brought the gNMI path to the canonical format: ``/origin:element1/element2...``.\n- Added possibility to omit the YANG module name, as some vendors doesn't include that in the request per their gNMI implementation: ``/element1/element2...``.\n\nRelease **0.4.5**:\n\n- Minor bug fix.\n\nRelease **0.4.4**:\n\n- Minor bug fix.\n\nRelease **0.4.3**:\n\n- Added possibility to modify the timeout (default value is 5 seconds) for the session using ``gnmi_timeout`` key for ``gNMIclient`` class.\n\nRelease **0.4.2**:\n\n- Modified the path generation to comply with `gNMI Path encoding conventions \u003chttps://github.com/openconfig/reference/blob/master/rpc/gnmi/gnmi-path-conventions.md\u003e`_.\n- Fixed the problem ``debug`` output, where the requests where not printed in case of response failing.\n\nRelease **0.4.1**:\n\n- Minor bug fix.\n\nRelease **0.4.0**:\n\n- Added support for Juniper JUNOS\n- Fixed the issue with ``override`` for PKI-based certificates\n\nRelease **0.3.12**:\n\n- Minor bug fix.\n\nRelease **0.3.11**:\n\n- Minor bug fix.\n\nRelease **0.3.10**:\n\n- Renamed the debug mode. Add argument ``debug=True`` upon object creation to see the Protobuf messages.\n\nRelease **0.3.9**:\n\n- Added functionality to list the full the device configuration in case the path is empty: ``get(path[])``.\n\nRelease **0.3.8**:\n\n- Merged the proposal how to implement TLS with override for Cisco IOS XR (tested for Cisco IOS XR, to be tested for other vendors yet)\n- Merged examples with TLS\n\nRelease **0.3.7**:\n\n- Added the argument ``encoding`` as an extra key to ``Set`` operation\n\nRelease **0.3.6**:\n\n- Added the argument ``encoding`` to ``Get`` operation\n\nRelease **0.3.5**:\n\n- Added the example for Nornir Integration\n- Added the topology diagram\n- Added links to the video tutorial\n\nRelease **0.3.4**:\n\n- Added the ``close`` method to ``gNMIClient`` class for those, who doesn't use ``with ... as ...`` context manager.\n\nRelease **0.3.3**:\n\n- Added the functionality to pass gRPC messages to the code execution\n\nRelease **0.3.2**:\n\n- Minor bugs fixed.\n\nRelease **0.3.1**:\n\n- Minor bugs fixed.\n- Added examples of gNMI operations.\n\nRelease **0.3.0**:\n\n- Added new function ``telemetryParser``, which converts Protobuf messages in Python dictionary.\n- Fixed the errors with the telemetry parsing.\n\nRelease **0.2.7**:\n\n- Modified core so that telemetry is working in ``once`` and ``stream`` mode.\n\nRelease **0.2.6**:\n\n- Added alpha version of the ``Subscribe`` operation.\n\nRelease **0.2.5**:\n\n- Added typing hints.\n\nRelease **0.2.4**:\n\n- Minor bugfixing.\n\nRelease **0.2.3**:\n\n- Added support for IPv6 transport (now you can connect to the network function over IPv6).\n\nRelease **0.2.2**:\n\n- Added conversion of the collected information over the gNMI into a Python dictionary for Set operation.\n\nRelease **0.2.1**:\n\n- Fixing the bugs with improper Protobuf paths generation.\n- Now all ``Set`` operations (``delete``, ``replace``, and ``update``) are working properly.\n\nReleast **0.2.0**:\n\n- Added the ``Set`` operation from gNMI specification.\n\nReleast **0.1.9**:\n\n- Added the property ``datatype='all'`` to the get() request. The values are per the gNMI specification: all, config, state, operatonal.\n\nRelease **0.1.8**:\n\n- Added conversion of the collected information over the gNMI into a Python dictionary for Get operation.\n\nRelease **0.1.7**:\n\n- Changing packages modules.\n\nRelease **0.1.6**:\n\n- Restructuring internal context.\n\nRelease **0.1.5**:\n\n- Minor bugfixing.\n\nRelease **0.1.4**:\n\n- Minor bugfixing.\n\nRelease **0.1.3**:\n\n- Minor bugfixing.\n\nRelease **0.1.2**:\n\n- The gNMIClient is recreated as context manger.\n- Tests with Nokia SR OS done, the module is working nice for insecure channel.\n\nRelease **0.1.1**:\n\n- Added the ``Get`` operation out of gNMI specification.\n\nRelease **0.1.0**:\n\n- The first release.\n\n(c)2020-2022, karneliuk.com\n\n.. |version| image:: https://img.shields.io/static/v1?label=latest\u0026message=v0.8.15\u0026color=success\n.. _version: https://pypi.org/project/pygnmi/\n.. |tag| image:: https://img.shields.io/static/v1?label=status\u0026message=stable\u0026color=success\n.. _tag: https://pypi.org/project/pygnmi/\n.. |license| image:: https://img.shields.io/static/v1?label=license\u0026message=BSD-3-clause\u0026color=success\n.. _license: https://github.com/akarneliuk/pygnmi/blob/master/LICENSE.txt\n.. |project| image:: https://img.shields.io/badge/akarneliuk%2Fpygnmi-blueviolet.svg?logo=github\u0026color=success\n.. _project: https://github.com/akarneliuk/pygnmi/\n.. |coverage| image:: https://img.shields.io/static/v1?label=coverage\u0026message=68%\u0026color=yellow\n.. _coverage: https://github.com/nedbat/coveragepy\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakarneliuk%2Fpygnmi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakarneliuk%2Fpygnmi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakarneliuk%2Fpygnmi/lists"}