[P4-dev] Deleting all entries in a match table

David Hancock dhancock at cs.utah.edu
Thu Mar 10 13:59:31 EST 2016


Leonid,

No, there is no easy way/command that deletes all match entries in a 
table in bmv2.  Yes, you can alternatively list all match entries via 
the CLI with: "table_dump <table_name>".  Entry handles are displayed as 
part of the output.

If you want to try a non-easy way to get all match entries handles for a 
table, you have a few options, listed here in increasing order of 
difficulty:
- python script that invokes the CLI via subprocess.popen, feeding the 
switch commands via stdin, tracking handle entries itself as entries are 
added, which enables easy deleting later (alternatively you can parse 
the string returned by the table_dump command to extract the entry handles)
- python script that interfaces directly with the switch (just like 
runtime_CLI.py does).  Not much advantage to this approach for your 
requirement; you'll still be getting back a string that you have to 
parse yourself to extract entry handles.
- modify bmv2 and bm_runtime's standard client to implement a new command

At least, that's my take on the situation...

--David


On 03/09/2016 11:35 PM, Leonid Ryzhyk wrote:
> I am working with bmv2 via the CLI tool (tools/runtime_CLI.py), 
> invoked from a python script.  My setting is similar to the SIGCOMM 
> 2015 tutorial (the python script is derived 
> from tutorials/SIGCOMM_2015/source_routing/topo.py).
>
> I am wondering if there exists an easy way to delete all match entries 
> in a table. Alternatively, is there a way to list all match entry 
> handles so that I could then delete them one by one via table_delete?
>
> Thank you!
> Leonid
>
>
> _______________________________________________
> P4-dev mailing list
> P4-dev at lists.p4.org
> http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org

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


More information about the P4-dev mailing list