[P4-dev] Delete or modify table entries using a match instead of the entry handle (bmv2)

Antonin Bas antonin at barefootnetworks.com
Sat Dec 30 19:24:27 EST 2017


Hi Fabian,

The table_dump_entry_from_key CLI command takes the match key as a
parameter and will print the entire table entry to stdout (match key,
handle, action, action data, priority). You can parse the output to
retrieve the handle.
If this does not work for you, feel free to submit a pull request to the
bmv2 repo adding a CLI command that prints the handle and nothing else
(easier to parse the output...). You can also create a more complex pull
request which adds a match key-based version of each relevant command (e.g.
table_delete_wkey). You will probably need to write a few unit tests if you
want to get this merged in.

Finally I'll point out that the recommended way to write new control-plane
applications for bmv2 (or other P4-programmable targets) is to use P4
Runtime. In the protobuf/gRPC P4Runtime interface (
https://github.com/p4lang/PI/blob/master/proto/p4/p4runtime.proto), all the
table operations are key-based and there is no notion of application-facing
handle.
They are a few caveats at the moment if you want to use P4 Runtime: you
need to use simple_switch_grpc (instead of simple_switch) and there is no
CLI available yet.

Best,

Antonin

On Sat, Dec 30, 2017 at 3:21 AM, Schleiss Fabian <fschleiss at student.ethz.ch>
wrote:

> Dear all,
>
> Is there a possibility to delete or modify table entries using a match on
> the key fields, instead of the entry handle (“table_delete <table name>
> <entry handle>”)? We are using the behavioral model (bmv2) and the
> simple_switch_CLI.
>
> Or, if this is not possible, is there a way to get the entry handle from
> the match fields?
>
> Thanks in advance for any help.
>
> Best wishes,
> Fabian
>
> _______________________________________________
> P4-dev mailing list
> P4-dev at lists.p4.org
> http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org
>



-- 
Antonin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20171230/bf2c8e40/attachment-0002.html>


More information about the P4-dev mailing list