akarneliuk / pygnmi

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

Add support for empty request / no prefix #154

Closed rao-aneesh closed 4 months ago

rao-aneesh commented 5 months ago

There was previously no way to specify no prefix block before. This adds support for that. The default value of prefix has been changed to None. To specify an empty prefix, "" must be passed to the function.

akarneliuk commented 5 months ago

Hey @rao-aneesh , what issue does it address? I understand your change, but I wonder what problem did you encounter with the existing behaviour?

rao-aneesh commented 5 months ago

Hey @akarneliuk, the issue was with master arbitration. The specification states:

In order to update the election ID as soon as a new master is elected, the client is required to send an empty Set RPC (with the election ID only) as soon as it becomes master. The client also carries the election ID in all subsequent Set requests.

Hence, sending an empty request with just an extension is necessary. Sending a request with an empty prefix with no paths leads to an error response.

rao-aneesh commented 4 months ago

@akarneliuk, can you review and merge this please?