p4lang / p4runtime

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

Consider simplifying wildcard reads #229

Open stefanheule opened 5 years ago

stefanheule commented 5 years ago

We might want to consider simplifying wildcard read requests. We have found that we only ever read ALL entities of a particular kind, but the specification allows for very complicated filtering based on partial entities. It might be worth evaluating if that's actually used by anybody.

This has caused all kinds of issues, e.g. clone_sessions that can have id 0 and thus can't be wildcard-read in the same way (#226), or the ambiguity w.r.t. to wildcard reads and wildcard matches:

(from the spec): The canonical representation of “don't care” matches, combined with the ability to do a wildcard read on all table entries by leaving the match field unset, means that there exists a specific ambiguous case in which the same message could be used to either read a single “don't care” entry or to do a wildcard read. If a table has no fields with match kind EXACT, it is possible via P4Runtime to add an entry that is “don't care” for all fields (i.e. has an empty match field) but is not the default entry (i.e. is_default_action is false). When reading this entry from the table, there is no way to read only that entry from the table, because it would require providing an unset match field in the request, which in turn indicates that the client wishes to perform a wildcard read on all non-default entries.

antoninbas commented 5 years ago

@stefanheule if I recommend correctly there was an explicit request from Waqar (or someone else from the team) to be able to filter based on the controller metadata field. Maybe I am making this up but regardless it would be great to confirm that it is actually not a requirement.