[P4-dev] Deleting all entries in a match table
carmelo at onlab.us
Thu Mar 10 14:07:18 EST 2016
Hi Leonid, David,
Another solution could be to use the CLI command “reset_state” which in my understanding completely reset the state of the switch, including table entries, while maintaining the running configuration (.json).
> On Mar 10, 2016, at 10:59 AM, David Hancock <dhancock at cs.utah.edu> wrote:
> 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...
> 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!
>> P4-dev mailing list
>> P4-dev at lists.p4.org
> P4-dev mailing list
> P4-dev at lists.p4.org
More information about the P4-dev