openconfig / gnmic

gNMIc is a gNMI CLI client and collector
https://gnmic.openconfig.net
Apache License 2.0
190 stars 57 forks source link

Poll implementation might be non-compliant with the gNMI specification #456

Open jvijtiuk opened 5 months ago

jvijtiuk commented 5 months ago

Hello,

I am working on a gNMI server implementation, and while testing the POLL subscription mode, I noticed that the gnmic client hangs after establishing the subscription.

The reason for that seems to be that it requires subscription data to be sent after the initial SubscribeRequest, which I don't think complies with the specification. This seems to happen for versions above 0.34.3 or more specifically after the poll subscriptions were refactored in #331 and #332. I think the specification clearly states that data for POLL subscriptions is to be returned only when the SubscribeRequest with an empty Poll field is sent. The first message can not have a Poll field since a SubscriptionRequest contains a union/oneof of either Poll or SubscriptionList. Since SubscriptionList is used to configure the subscription, the first message will never be a Poll. I managed to work around this by updating the server to return poll data even for the first SubscriptionRequest, but as I said, I don't think this is compliant with the spec. The relevant part of the specification is here in the second paragraph which states the following:

To retrieve data from the target, a client sends a SubscribeRequest message to the target,
containing a poll field, specified to be an empty Poll message. 
On reception of such a message, the target MUST generate updates for
all the corresponding paths within the SubscriptionList. 
Updates MUST be generated according to Section 3.5.2.3.

If there's any additional information I can provide, please let me know.

karimra commented 5 months ago

The implementation is based on this comment: https://github.com/openconfig/reference/issues/89#issuecomment-1218222727

If you think this is not right or needs to be clarified I suggest starting a discussion in openconfig/reference