p4lang / p4runtime

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

Should priority be required for TableEntry objects where `is_default_action` is true? #332

Closed jafingerhut closed 3 years ago

jafingerhut commented 3 years ago

This is a minor corner case, not a big issue. I just happened to be looking at what the spec says about when you need to specify a priority value for a TableEntry, and I could have missed something, but it currently seems to imply that a priority must be provided if the table has at least one ternary, range, or optional key field.

For non-default table entries, I am in complete agreement.

The priority isn't really needed when modifying a default action for a table, though, is it?

Maybe the spec already mentions that corner case, not sure. If not, is it worth adding a sentence for this case?

antoninbas commented 3 years ago

Hi @jafingerhut - this is from the Default Entry section in the current spec:

The default entry is identified by setting the is_default_action boolean field to true. When this flag is set to true, the repeated match field must be empty and the priority field must be set to zero, otherwise the P4Runtime server must return an INVALID_ARGUMENT error code.

jafingerhut commented 3 years ago

@antoninbas Thanks for pointing that out. Glad it is already covered in the spec, then. Closing this issue.