akarneliuk / pygnmi

The pure Python implementation of the gNMI client.
https://training.karneliuk.com
BSD 3-Clause "New" or "Revised" License
129 stars 44 forks source link

pygnmi 0.7.1 reporting an incorrect version (0.7.0) #70

Closed ksator closed 2 years ago

ksator commented 2 years ago
arista@devbox:~$ pip freeze | grep pygnmi
pygnmi==0.7.1
arista@devbox:~$ pip show pygnmi
Name: pygnmi
Version: 0.7.1
Summary: Pure Python gNMI client to manage network functions and collect telemetry.
Home-page: https://github.com/akarneliuk/pygnmi
Author: Anton Karneliuk
Author-email: anton@karneliuk.com
License: bsd-3-clause
Location: /home/arista/.local/lib/python3.9/site-packages
Requires: dictdiffer, cryptography, grpcio-tools, grpcio
Required-by: 
arista@devbox:~$ cat test2.py 
from pprint import pprint as pp
import json
from pygnmi.client import gNMIclient

with open("token.tok") as f:
    TOKEN = f.read().strip('\n')

host = ('192.168.0.5', '443')
with gNMIclient(target=host, token=TOKEN, skip_verify=False) as gc:
    result = gc.capabilities()

pp(result['gnmi_version'])
arista@devbox:~$ python test2.py 
'0.7.0'
arista@devbox:~$ 

Is it expected?

akarneliuk commented 2 years ago

Hey @ksator ,

yes, it is. What you try to print is the version of the GNMI running on the destination node (CVP in your case). GNMI 0.7.0 is one the most wide spread these days.

For example here is the output from Nokia SR OS:

A:pygnmi_dev@dev-pygnmi-sros-001# show system grpc 

===============================================================================
gRPC Server
===============================================================================
Administrative State      : Enabled
Operational State         : Up

Supported services          Version      Admin State
-------------------------------------------------------------------------------
gNMI                        0.7.0        Enabled
gNOI CertificateManagement  0.1.0        Disabled
gNOI File                   0.1.0        Disabled
gNOI System                 1.0.0        Disabled
mdCli                       22.2.0       Disabled
RibApi                      1.1.0        Disabled
===============================================================================

Please, let me know if further information is needed.

Best, Anton

ksator commented 2 years ago

Thank you so much Anton! I see now https://github.com/openconfig/reference/blob/master/rpc/gnmi/gnmi-specification.md#322-the-capabilityresponse-message