p4lang / p4runtime

Specification documents for the P4Runtime control-plane API
Apache License 2.0
142 stars 88 forks source link

Question: Does P4Runtime modify action on table entries allow modifying some but not all parameters of an action? #376

Open jafingerhut opened 2 years ago

jafingerhut commented 2 years ago

I will answer this question myself soon if someone does not respond within a few days, but wanted to see if someone knew off the top of their head.

Suppose you add an entry to a table with key K, action A1 with 5 parameters, and parameters values (v1, v2, v3, v4, v5).

Does a P4Runtime API modify operation support the ability to modify that entry with key K, with the action remaining A1, and specifying only one of the parameters, e.g. only the 2nd one, overwriting the current value of v2 with v2b, but leaving the other 4 parameter values unchanged?

My guess is that the answer according to the current P4Runtime spec is no, this is not supported. If you want to modify an existing entry, the message must specify new values for all parameters.

jafingerhut commented 2 years ago

OK, that was quicker than I expected. I believe the correct answer is "no", based upon this text in Section 9.1.2 "Action Specification":

"The P4Runtime client must provide a valid value for each parameter of the P4 action; we do not support default values for action parameters. The server must return an INVALID_ARGUMENT error code if a parameter id is missing, if an extra parameter — id not found in the P4Info — was provided by the client, if a parameter value is missing, or if the value provided for one of the parameters does not conform to the Bytestrings format."

jfingerh commented 1 year ago

@jameschoi I will ping you on several public p4runtime issues to call your attention to them. For others, sorry for the comment noise.

jafingerhut commented 1 year ago

This issue is at least related to https://github.com/p4lang/p4runtime/issues/433 but depending upon the precise desires of the other issue, might not be the same issue.