openconfig / gnmi

gRPC Network Management Interface
Apache License 2.0
479 stars 197 forks source link

How to pass the Poll interval for GNMI POLL Subscription #106

Closed pm937925 closed 3 years ago

pm937925 commented 3 years ago

poll_val = 20 subreq = gnmi_pb2.SubscribeRequest(subscribe=sublist, poll=poll_val)

poll updated are getting for no poll value.

pm937925 commented 3 years ago

Observing below error :

subreq = gnmi_pb2.SubscribeRequest(subscribe=sublist, poll=poll_val)

File "C:\Python27\lib\site-packages\google\protobuf\internal\python_message.py", line 563, in init _ReraiseTypeErrorWithFieldName(message_descriptor.name, field_name) File "C:\Python27\lib\site-packages\google\protobuf\internal\python_message.py", line 488, in _ReraiseTypeErrorWithFieldName six.reraise(type(exc), exc, sys.exc_info()[2]) File "C:\Python27\lib\site-packages\google\protobuf\internal\python_message.py", line 561, in init copy.MergeFrom(new_val) File "C:\Python27\lib\site-packages\google\protobuf\internal\python_message.py", line 1322, in MergeFrom 'expected %s got %s.' % (cls.name, msg.class.name)) TypeError: Parameter to MergeFrom() must be instance of same class: expected Poll got int. for field SubscribeRequest.poll

gcsl commented 3 years ago

Polling in gNMI is not server side polling thus there is no time interval to pass. It is a client side trigger message that is sent for each poll. This is what is causing the type error as the message is not an integer.

This client triggered scheme allows a client to dynamically configure a polling scheme that is not time based. A client could send a poll request on a periodic cadence. A client could also trigger the poll based on some other event that isn't a clock, e.g. a config push.