Hi ,
Like we fill device_id as request.set_device_id(1); , similarly How to fill request like p4info and p4_device_config. (i am using opensource p4runtime.proto).
The precise answer depends upon which programming language you are using to create and send P4Runtime API messages. Many programming languages are supported by the Google Protobuf library (e.g. C++, Java, Go, Python, …), which is what most people use to create Protobuf messages, whether P4Runtime API messages or any other message formats defined using Protobuf.
There is some sample code for creating P4Runtime API messages in Python in multiple repositories, including the P4 tutorials repository here: GitHub - p4lang/tutorials: P4 language tutorials. It may take some work to find exactly what you are looking for, but the Python code in the utils directory of that repo is especially relevant.
I am hoping someone else reading this knows where to find open source and public examples of construction and/or “parsing” of P4Runtime API messages from the controller software side, using C++. I have not written such code before, nor looked for it, but I suspect such example code is out there in the public somewhere.