On 08/12/2015 06:51 PM, Alex Wang wrote:
> Thx a lot for the refinement,
> 
> Minor comments below,
> 
> 
> On Wed, Aug 12, 2015 at 3:04 PM, Russell Bryant <rbry...@redhat.com
> <mailto:rbry...@redhat.com>> wrote:
> 
>     I frequently view the contents of the Logical_Flow table while working
>     on OVN.  Add a command that can output the contents of this table in a
>     sorted way that makes it easier to read through.  It's sorted by
>     logical datapath, pipeline, table id, priority, and match.
> 
>     Signed-off-by: Russell Bryant <rbry...@redhat.com
>     <mailto:rbry...@redhat.com>>
>     ---
>      ovn/utilities/ovn-sbctl.8.in <http://ovn-sbctl.8.in> |   6 +++
>      ovn/utilities/ovn-sbctl.c    | 116
>     +++++++++++++++++++++++++++++++++++++++++++
>      2 files changed, 122 insertions(+)
> 
> 
>     v1->v2
>      - Address Alex's review feedback
>      - Add a friendly "dump-flows" alias
> 
>     Example output:
> 
>     $ ./ovn-2port-setup.sh
>     + ovn-nbctl lswitch-add sw0
>     + ovn-nbctl lport-add sw0 sw0-port1
>     + ovn-nbctl lport-add sw0 sw0-port2
>     + ovn-nbctl lport-set-macs sw0-port1 00:00:00:00:00:01
>     + ovn-nbctl lport-set-macs sw0-port2 00:00:00:00:00:02
>     + ovn-nbctl lport-set-port-security sw0-port1 00:00:00:00:00:01
>     + ovn-nbctl lport-set-port-security sw0-port2 00:00:00:00:00:02
>     + ovs-vsctl add-port br-int lport1 -- set Interface lport1
>     external_ids:iface-id=sw0-port1
>     + ovs-vsctl add-port br-int lport2 -- set Interface lport2
>     external_ids:iface-id=sw0-port2
>     $ ovn-sbctl lflow-list
>     Datapath: 0f9a9e4e-0ef0-4afb-bed4-09887387fd10  Pipeline: ingress
>       table_id=0, priority=100, match=(eth.src[40]), action=(drop;)
>       table_id=0, priority=100, match=(vlan.present), action=(drop;)
>       table_id=0, priority= 50, match=(inport == "sw0-port1" && eth.src
>     == {00:00:00:00:00:01}), action=(next;)
>       table_id=0, priority= 50, match=(inport == "sw0-port2" && eth.src
>     == {00:00:00:00:00:02}), action=(next;)
>       table_id=0, priority=  0, match=(1), action=(drop;)
>       table_id=1, priority=100, match=(eth.dst[40]), action=(outport =
>     "_MC_flood"; output;)
>       table_id=1, priority= 50, match=(eth.dst == 00:00:00:00:00:01),
>     action=(outport = "sw0-port1"; output;)
>       table_id=1, priority= 50, match=(eth.dst == 00:00:00:00:00:02),
>     action=(outport = "sw0-port2"; output;)
>     Datapath: 0f9a9e4e-0ef0-4afb-bed4-09887387fd10  Pipeline: egress
>       table_id=0, priority=  0, match=(1), action=(next;)
>       table_id=1, priority=100, match=(eth.dst[40]), action=(output;)
>       table_id=1, priority= 50, match=(outport == "sw0-port1" && eth.dst
>     == {00:00:00:00:00:01}), action=(output;)
>       table_id=1, priority= 50, match=(outport == "sw0-port2" && eth.dst
>     == {00:00:00:00:00:02}), action=(output;)
> 
> 
> 
>     diff --git a/ovn/utilities/ovn-sbctl.8.in <http://ovn-sbctl.8.in>
>     b/ovn/utilities/ovn-sbctl.8.in <http://ovn-sbctl.8.in>
>     index b5c796e..9f9168e 100644
>     --- a/ovn/utilities/ovn-sbctl.8.in <http://ovn-sbctl.8.in>
>     +++ b/ovn/utilities/ovn-sbctl.8.in <http://ovn-sbctl.8.in>
>     @@ -146,6 +146,12 @@ Without \fB\-\-if\-exists\fR, attempting to
>     unbind a logical port
>      that is not bound is an error.  With \fB\-\-if\-exists\fR, attempting
>      to unbind logical port that is not bound has no effect.
>      .
>     +.SS "Logical Flow Commands"
>     +.
>     +.IP "\fBlflow\-list\fR [\fIlogical\-datapath\fR]"
>     +List logical flows. If \fIlogical\-datapath\fR is specified, only
>     list flows for
>     +that logical datapath.
>     +.
>      .so lib/db-ctl-base.man
>      .SH "EXIT STATUS"
>      .IP "0"
>     diff --git a/ovn/utilities/ovn-sbctl.c b/ovn/utilities/ovn-sbctl.c
>     index cbde60a..5d988f5 100644
>     --- a/ovn/utilities/ovn-sbctl.c
>     +++ b/ovn/utilities/ovn-sbctl.c
>     @@ -300,6 +300,9 @@ Port binding commands:\n\
>        lport-bind LPORT CHASSIS    bind logical port LPORT to CHASSIS\n\
>        lport-unbind LPORT          reset the port binding of logical
>     port LPORT\n\
>      \n\
>     +Logical flow commands:\n\
>     +  lflow-list [DATAPATH]       List logical flows for all or a
>     single datapath\n\
>     +\n\
> 
> 
> 
> Could we also add usage for the alias 'dump-flows'

I excluded on purpose because I thought we might want to keep it hidden.
 It doesn't matter to me though.  I'll add it.

-- 
Russell Bryant
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to