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

Leonid Ryzhyk ryzhyk at gmail.com
Thu Mar 10 14:20:23 EST 2016


Hi Carmelo,

Thanks for pointing this out!  Seems like this command was added very
recently. It does have the overhead of clearing all tables, not just the
ones I need to update, but this is not a big deal in my particular settings.

Leonid

On Thu, Mar 10, 2016 at 11:07 AM, Carmelo Cascone <carmelo at onlab.us> wrote:

> 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).
>
> Carmelo
>
>
> > On Mar 10, 2016, at 10:59 AM, David Hancock <dhancock at cs.utah.edu>
> wrote:
> >
> > 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
> >
> > _______________________________________________
> > 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/9d1578af/attachment-0002.html>


More information about the P4-dev mailing list