akarneliuk / pygnmi

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

grpc.FutureTimeoutError() #8

Closed baijuw closed 3 years ago

baijuw commented 3 years ago

Hi @akarneliuk ,

This could quite possibly be me doing something wrong as I am new to gNMI configuration. Nevertheless, I get the following error upon trying a basic get request using pygnmi. Here are some of my details.

Target: Nokia SR Linux which supports gNMI.
local host : 
(gnmi) [root@grpc gnmi]# python3 --version
Python 3.6.8
(gnmi) [root@grpc gnmi]# python3 -m pip list
Package                  Version
------------------------ ---------
cachetools               4.2.1
certifi                  2020.12.5
chardet                  4.0.0
google                   3.0.0
google-api-core          1.26.2
google-api-python-client 2.0.2
google-auth              1.28.0
google-auth-httplib2     0.1.0
googleapis-common-protos 1.53.0
grpcio                   1.36.1
grpcio-tools             1.36.1
httplib2                 0.19.0
idna                     2.10
packaging                20.9
pip                      21.0.1
protobuf                 3.15.6
pyasn1                   0.4.8
pyasn1-modules           0.2.8
pygnmi                   0.4.5
pyparsing                2.4.7
pytz                     2021.1
requests                 2.25.1
rsa                      4.7.2
setuptools               54.1.2
six                      1.15.0
soupsieve                2.2.1
uritemplate              3.0.1
urllib3                  1.26.4
wheel                    0.36.2

The error is as follows:-

(gnmi) [root@grpc gnmi]# python3
Python 3.6.8 (default, Nov 16 2020, 16:55:22)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pygnmi.client import gNMIclient
>>> host = ('172.20.20.19', '57400')
>>> with gNMIclient(target=host, username='admin', password='admin', insecure=True) as gc:
...     result = gc.get(path=['interface'])
...
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/root/gnmi/lib/python3.6/site-packages/pygnmi/client.py", line 51, in __enter__
    grpc.channel_ready_future(self.__channel).result(timeout=self.__gnmi_timeout)
  File "/root/gnmi/lib64/python3.6/site-packages/grpc/_utilities.py", line 140, in result
    self._block(timeout)
  File "/root/gnmi/lib64/python3.6/site-packages/grpc/_utilities.py", line 86, in _block
    raise grpc.FutureTimeoutError()
grpc.FutureTimeoutError

I can hit the same target using the openconfig gnmi_get cli which is written in go.

akarneliuk commented 3 years ago

Hello @baijuw,

the grpc.FutureTimeoutError means that the host doesn't respond or respond in the suitable format. The implementation of grpc libraries in Go and in Python are different, but before to figure that out, could you please share the configuration from SR Linux related to the gNMI (e.g., where you enable that)?

Thanks, Anton

baijuw commented 3 years ago

Hello @baijuw,

the grpc.FutureTimeoutError means that the host doesn't respond or respond in the suitable format. The implementation of grpc libraries in Go and in Python are different, but before to figure that out, could you please share the configuration from SR Linux related to the gNMI (e.g., where you enable that)?

Thanks, Anton

Here is the configuration for GNMI:-

leaf# info from state system gnmi-server 
    system {
        gnmi-server {
            admin-state enable
            timeout 7200
            rate-limit 60
            session-limit 20
            commit-confirmed-timeout 0
            include-defaults-in-config-only-responses false
            network-instance mgmt {
                admin-state enable
                oper-state up
                use-authentication true
                port 57400
                tls-profile gnmi
                source-address [
                    ::
                ]
            }
            unix-socket {
                admin-state disable
                oper-state down
                use-authentication true
                socket-path ""
            }
        }
    }
akarneliuk commented 3 years ago

Hello @baijuw, the grpc.FutureTimeoutError means that the host doesn't respond or respond in the suitable format. The implementation of grpc libraries in Go and in Python are different, but before to figure that out, could you please share the configuration from SR Linux related to the gNMI (e.g., where you enable that)? Thanks, Anton

Here is the configuration for GNMI:-

leaf# info from state system gnmi-server 
    system {
        gnmi-server {
            admin-state enable
            timeout 7200
            rate-limit 60
            session-limit 20
            commit-confirmed-timeout 0
            include-defaults-in-config-only-responses false
            network-instance mgmt {
                admin-state enable
                oper-state up
                use-authentication true
                port 57400
                tls-profile gnmi
                source-address [
                    ::
                ]
            }
            unix-socket {
                admin-state disable
                oper-state down
                use-authentication true
                socket-path ""
            }
        }
    }

Right, could show please tls-profile gnmi?

baijuw commented 3 years ago

Hi @akarneliuk , You could close this for now. SRL does not offer insecure connection as of now. Thanks for your help.

Regards Baiju