device_id discovery
It's not clear to me whether there's a way for a P4Runtime client to discover the device_id (or IDs) supported by the P4Runtime server that it is talking to. I had assumed that a device_id of 0 was the common convention, since that is the default in bmv2's p4runtime server, but Issue #291 implies that device_id should not be used and will be disallowed in P4Runtime 2.0.
I'd appreciate a clear statement in the specification.
- A
device_idof 0 may be considered bad practice at there is no way in Protobuf messages to distinguish between adevice_idexplicitly set to 0 and adevice_idomitted by mistake in client code. However, it is still a valid value at the moment. - bmv2 lets you specify a
device_idother than 0 with--device-id. It has to match the value used by the P4Runtime client. - Discovery of the IDs managed by a P4Runtime server is out-of-band of the P4Runtime protocol. I wrote a post in the P4 forum recently about this topic (https://forum.p4.org/t/device-id-assignment-for-server-with-multiple-devices/240/7?u=antonin) and about how this is handled in Stratum. They use gNMI to "exchange" device IDs between switch and controller.
Thanks, you confirmed what I guessed. Extra thanks for the forum URL!
Still would appreciate something in the spec, perhaps just a sentence saying that device_ids are managed out-of-band. Bonus points for suggesting gNMI.