p4lang / p4runtime

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

Read should return FAILED_PRECONDITION if there is no P4Info #342

Closed stefanheule closed 3 years ago

stefanheule commented 3 years ago

I believe the P4RT spec says nothing about the behavior of the switch for Read if there is no P4Info configured yet. We should clearly specify the desired behavior. I suggest we return FAILED_PRECONDITION, since reading table entries requires to know what tables there are.

antoninbas commented 3 years ago

That works for me. I notice that we already specify this for the Write RPC:

If the Write is attempted before a ForwardingPipelineConfig has been set, the server must return a FAILED_PRECONDITION error.

My current implementation of P4Runtime already enforces that behavior: https://github.com/p4lang/PI/blob/970a2f254bf0aa5bc5366f815d7e8f0f0df789f2/proto/server/pi_server.cpp#L435

Do you want to submit a PR @stefanheule?