openconfig / gnmi

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

Serialization method for gnmi_ext.registered_ext.msg #46

Closed amanand closed 2 years ago

amanand commented 5 years ago

The gnmi_ext.proto file mentions the following for msg attribute: "The binary-marshalled protobuf extension payload." As there are quite a few methods to serialize a message e.g SerializeToString or SerializeToArray, which one should the server choose to serialize the message? If the message is serialized using SerializeToArray, then on the client side, the collector will need to know the actual size of the array to deserialize. Moreover, AFAIK, there is no method to deserialize array in Python. Also, in Go, we have Marshall and UnMarshall methods. Can you please suggest the best way to populate the extension payload on the server side?

robshakir commented 5 years ago

This should be the binary wire-format which is produced by Marshal in Go, Python produces this same output using SerializeToString(), just the str type is used as a container as described in this document. This is the standard binary encoding for protos.