p4runtime icon indicating copy to clipboard operation
p4runtime copied to clipboard

device_id discovery

Open blp opened this issue 3 years ago • 2 comments

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.

blp avatar Mar 16 '22 17:03 blp

  • A device_id of 0 may be considered bad practice at there is no way in Protobuf messages to distinguish between a device_id explicitly set to 0 and a device_id omitted by mistake in client code. However, it is still a valid value at the moment.
  • bmv2 lets you specify a device_id other 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.

antoninbas avatar Mar 16 '22 19:03 antoninbas

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.

blp avatar Mar 16 '22 19:03 blp