[ovs-dev] [PATCH RESEND v2 3/3] tests/dpif-netdev: Update dpif-netdev meter testcase.

Tonghao Zhang xiangxia.m.yue at gmail.com
Tue Mar 2 13:37:11 UTC 2021


On Fri, Feb 26, 2021 at 4:54 AM Ilya Maximets <i.maximets at ovn.org> wrote:
>
> On 2/24/21 1:21 PM, xiangxia.m.yue at gmail.com wrote:
> > From: Tonghao Zhang <xiangxia.m.yue at gmail.com>
> >
> > The buckets used was changed, and now dpif-netdev support
> > burst_size, change the testcase.
> >
> > Signed-off-by: Tonghao Zhang <xiangxia.m.yue at gmail.com>
> > ---
> >  tests/dpif-netdev.at | 16 ++++++++--------
> >  1 file changed, 8 insertions(+), 8 deletions(-)
> >
> > diff --git a/tests/dpif-netdev.at b/tests/dpif-netdev.at
> > index 2862a3c9b96d..3aa9c0cba518 100644
> > --- a/tests/dpif-netdev.at
> > +++ b/tests/dpif-netdev.at
> > @@ -282,7 +282,7 @@ OVS_VSWITCHD_START(
> >  AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
> >
> >  AT_CHECK([ovs-ofctl -O OpenFlow13 add-meter br0 'meter=1 pktps burst stats bands=type=drop rate=1 burst_size=1'])
> > -AT_CHECK([ovs-ofctl -O OpenFlow13 add-meter br0 'meter=2 kbps burst stats bands=type=drop rate=1 burst_size=2'])
> > +AT_CHECK([ovs-ofctl -O OpenFlow13 add-meter br0 'meter=2 kbps burst stats bands=type=drop rate=1 burst_size=1'])
>
> It's good to have not all ones in tests, so, I think, it's better to
> keep the burst size here and rework the tests instead.
> If you need to send more packets in order to hit meters in these tests
> you could do that.  To avoid too many repeated lines you may use a
> simple 'for' loop like we do in other tests:
>   https://github.com/openvswitch/ovs/blob/master/tests/ofproto-dpif.at#L7415
> This will also be a good cleanup.
Thanks!
> >  AT_CHECK([ovs-ofctl -O OpenFlow13 add-flow br0 'in_port=1 action=meter:1,7'])
> >  AT_CHECK([ovs-ofctl -O OpenFlow13 add-flow br0 'in_port=7 action=meter:2,1'])
> >  AT_CHECK([ovs-ofctl add-flow br1 'in_port=2 action=8'])
> > @@ -295,7 +295,7 @@ meter=1 pktps burst stats bands=
> >  type=drop rate=1 burst_size=1
> >
> >  meter=2 kbps burst stats bands=
> > -type=drop rate=1 burst_size=2
> > +type=drop rate=1 burst_size=1
> >  ])
> >
> >  ovs-appctl time/warp 5000
> > @@ -312,14 +312,14 @@ AT_CHECK([ovs-appctl netdev-dummy/receive p8 'in_port(8),packet_type(ns=0,id=0),
> >  sleep 1  # wait for forwarders process packets
> >
> >  # Meter 1 is measuring packets, allowing one packet per second with
> > -# bursts of one packet, so 4 out of 5 packets should hit the drop
> > +# bursts of one packet, so 3 out of 5 packets should hit the drop
> >  # band.
> > -# Meter 2 is measuring kbps, with burst size 2 (== 2000 bits). 4 packets
> > +# Meter 2 is measuring kbps, with burst size 1 ( = 2000bits). 4 packets
> >  # (240 bytes == 1920 bits) pass, but the last packet should hit the drop band.
> >  AT_CHECK([ovs-ofctl -O OpenFlow13 meter-stats br0 | strip_timers], [0], [dnl
> >  OFPST_METER reply (OF1.3) (xid=0x2):
> >  meter:1 flow_count:1 packet_in_count:5 byte_in_count:300 duration:0.0s bands:
> > -0: packet_count:4 byte_count:240
> > +0: packet_count:3 byte_count:180
> >
> >  meter:2 flow_count:1 packet_in_count:5 byte_in_count:300 duration:0.0s bands:
> >  0: packet_count:1 byte_count:60
> > @@ -343,13 +343,13 @@ sleep 1  # wait for forwarders process packets
> >  # Meter 1 is measuring packets, allowing one packet per second with
> >  # bursts of one packet, so all 5 of the new packets should hit the drop
> >  # band.
> > -# Meter 2 is measuring kbps, with burst size 2 (== 2000 bits). After 500ms
> > +# Meter 2 is measuring kbps, with burst size 1 (== 2000 bits). After 500ms
> >  # there should be space for 80 + 500 bits, so one new 60 byte (480 bit) packet
> >  # should pass, remaining 4 should hit the drop band.
> >  AT_CHECK([ovs-ofctl -O OpenFlow13 meter-stats br0 | strip_timers], [0], [dnl
> >  OFPST_METER reply (OF1.3) (xid=0x2):
> >  meter:1 flow_count:1 packet_in_count:10 byte_in_count:600 duration:0.0s bands:
> > -0: packet_count:9 byte_count:540
> > +0: packet_count:8 byte_count:480
> >
> >  meter:2 flow_count:1 packet_in_count:10 byte_in_count:600 duration:0.0s bands:
> >  0: packet_count:5 byte_count:300
> > @@ -360,7 +360,7 @@ ovs-appctl time/warp 5000
> >  AT_CHECK([
> >  ovs-appctl coverage/read-counter datapath_drop_meter
> >  ], [0], [dnl
> > -14
> > +13
> >  ])
> >
> >  AT_CHECK([cat ovs-vswitchd.log | filter_flow_install | strip_xout_keep_actions], [0], [dnl
> >
>


-- 
Best regards, Tonghao


More information about the dev mailing list