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

How to send set request with proto encoding? #126

Open ganglyu opened 1 year ago

ganglyu commented 1 year ago

I'm trying to send set request with proto encoding. But it's impossible to send binary bytes with proto encoding, because pygnmi uses json.dumps: https://github.com/akarneliuk/pygnmi/blob/master/pygnmi/client.py#L1302 Does pygnmi support set request with proto encoding? Please let me know what you think.

akarneliuk commented 1 year ago

Hello @ganglyu ,

Could you talk more about use case? I started seeing some vendors coming with proto encoding, but mainly for telemetry. The main issue with protobuf is that there is no vendor neutral proto-files. As such, you need to encode message using the proto file from vendor before putting into the wire. We can work on this use case, though.

Best, Anton

ganglyu commented 1 year ago

Hi, I'm trying to use pygnmi to set and get data with proto encoding data, and set request failed because pygnmi uses json.dumps. You can use ygot to convert YANG model into Protobuf format. https://karneliuk.com/2020/05/gnmi-part-1-intro-to-protobuf/