Sure, I'll do that.

On Mon, Aug 5, 2013 at 3:52 PM, Ethan Jackson <et...@nicira.com> wrote:

> Let's just fold this into the bfd decay patch?  I haven't read it yet.
>
> Ethan
>
> On Mon, Aug 5, 2013 at 2:04 PM, Alex Wang <al...@nicira.com> wrote:
> > This commit adds unit tests for BFD decay feature.
> >
> > Signed-off-by: Alex Wang <al...@nicira.com>
> > ---
> >  tests/bfd.at |  189
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++---
> >  1 file changed, 180 insertions(+), 9 deletions(-)
> >
> > diff --git a/tests/bfd.at b/tests/bfd.at
> > index c54fff0..c1f78d2 100644
> > --- a/tests/bfd.at
> > +++ b/tests/bfd.at
> > @@ -20,9 +20,9 @@ AT_CHECK([ovs-appctl bfd/show $1 | sed -e '/Time:/d' |
> sed -e '/Discriminator/d'
> >  m4_define([BFD_CHECK_TX], [
> >  AT_CHECK([ovs-appctl bfd/show $1 | sed -n '/TX Interval/p'],[0],
> >  [dnl
> > -       TX Interval: Approx 1000ms
> > -       Local Minimum TX Interval: $2
> > -       Remote Minimum TX Interval: $3
> > +       TX Interval: Approx $2
> > +       Local Minimum TX Interval: $3
> > +       Remote Minimum TX Interval: $4
> >  ])
> >  ])
> >
> > @@ -30,8 +30,8 @@ m4_define([BFD_CHECK_RX], [
> >  AT_CHECK([ovs-appctl bfd/show $1 | sed -n '/RX Interval/p'],[0],
> >  [dnl
> >         RX Interval: Approx $2
> > -       Local Minimum RX Interval: $2
> > -       Remote Minimum RX Interval: $3
> > +       Local Minimum RX Interval: $3
> > +       Remote Minimum RX Interval: $4
> >  ])
> >  ])
> >  AT_SETUP([bfd - basic config on different bridges])
> > @@ -202,14 +202,185 @@ BFD_CHECK([p0], [true], [false], [none], [up],
> [No Diagnostic], [none], [up], [N
> >  #Edit the min Tx value.
> >  AT_CHECK([ovs-vsctl set interface p0 bfd:min_tx=200])
> >  for i in `seq 0 20`; do ovs-appctl time/warp 100; done
> > -BFD_CHECK_TX([p0], [200ms], [100ms])
> > -BFD_CHECK_TX([p1], [100ms], [200ms])
> > +BFD_CHECK_TX([p0], [1000ms], [200ms], [100ms])
> > +BFD_CHECK_TX([p1], [1000ms], [100ms], [200ms])
> >
> >  #Edit the min Rx value.
> >  AT_CHECK([ovs-vsctl set interface p1 bfd:min_rx=300])
> >  for i in `seq 0 20`; do ovs-appctl time/warp 100; done
> > -BFD_CHECK_RX([p1], [300ms], [1000ms])
> > -BFD_CHECK_RX([p0], [1000ms], [300ms])
> > +BFD_CHECK_RX([p1], [300ms], [300ms], [1000ms])
> > +BFD_CHECK_RX([p0], [1000ms], [1000ms], [300ms])
> >
> >  OVS_VSWITCHD_STOP
> >  AT_CLEANUP
> > +
> > +# Tests below are for bfd decay features.
> > +AT_SETUP([bfd - bfd decay])
> > +OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy --
> \
> > +                    add-port br1 p1 -- set Interface p1 type=patch \
> > +                    options:peer=p0 ofport_request=2 -- \
> > +                    add-port br0 p0 -- set Interface p0 type=patch \
> > +                    options:peer=p1 ofport_request=1 -- \
> > +                    set Interface p0 bfd:enable=true bfd:min_tx=300
> bfd:min_rx=300 bfd:decay_min_rx=3000 -- \
> > +                    set Interface p1 bfd:enable=true bfd:min_tx=500
> bfd:min_rx=500 -- \
> > +                    add-port br1 p2 -- set Interface p2 type=internal
> ofport_request=3])
> > +
> > +ovs-appctl time/stop
> > +
> > +
> > +# Test-1 BFD decay to 3000ms
> > +# bfd:decay_min_rx is set to 3000ms after the first 2500ms,
> > +# the bfd should up.
> > +for i in `seq 0 4`; do ovs-appctl time/warp 500; done
> > +BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic], [none],
> [up], [No Diagnostic])
> > +BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
> > +BFD_CHECK_RX([p0], [500ms], [300ms], [500ms])
> > +
> > +# advance the clock by 500ms.
> > +ovs-appctl time/warp 500
> > +# now at 3000ms, expect to see poll related flags at p0 and p1
> > +BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic],
> [final], [up], [No Diagnostic])
> > +BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic], [poll],
> [up], [No Diagnostic])
> > +BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
> > +BFD_CHECK_RX([p0], [3000ms], [3000ms], [500ms])
> > +
> > +# since the tx_min of p0 is still 500ms, after 500ms from decay,
> > +# the control message will be sent p1 and p1 flag will back to none.
> > +ovs-appctl time/warp 500
> > +BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic], [none],
> [up], [No Diagnostic])
> > +# the rx_min of p0 is 3000ms now. and p1 will send next control message
> > +# 3000ms after decay.
> > +for i in `seq 0 4`; do ovs-appctl time/warp 500; done
> > +BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic], [none],
> [up], [No Diagnostic])
> > +BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
> > +BFD_CHECK_RX([p0], [3000ms], [3000ms], [500ms])
> > +
> > +
> > +# Test-2 BFD decay go back to cfg_min_rx when there is traffic
> > +# receive packet at 1/100ms rate for 3000ms.
> > +for i in `seq 0 30`
> > +do
> > +    ovs-appctl time/warp 100
> > +    AT_CHECK([ovs-ofctl packet-out br1 3 2
>  
> "90e2ba01475000101856b2e80806000108000604000100101856b2e80202020300000000000002020202"],
> > +             [0], [stdout], [])
> > +done
> > +# after a decay interval (3000ms), the p0 min_rx will go back to
> > +# cfg_min_rx.
> > +BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic], [none],
> [up], [No Diagnostic])
> > +BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
> > +BFD_CHECK_RX([p0], [500ms], [300ms], [500ms])
> > +
> > +
> > +# Test-3 BFD decay go back to cfg_min_rx when decay_min_rx is changed.
> > +# advance the clock by 4000ms, so p0 is decayed.
> > +for i in `seq 0 5`; do ovs-appctl time/warp 500; done
> > +BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic], [none],
> [up], [No Diagnostic])
> > +BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic], [none],
> [up], [No Diagnostic])
> > +BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
> > +BFD_CHECK_RX([p0], [3000ms], [3000ms], [500ms])
> > +
> > +# change decay_min_rx to 1000ms.
> > +# for decay_min_rx < 2000ms, the decay detection time is set to 2000ms.
> > +# this should firstly reset the min_rx and then start poll.
> > +AT_CHECK([ovs-vsctl set Interface p0 bfd:decay_min_rx=1000])
> > +BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic],
> [final], [up], [No Diagnostic])
> > +BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic], [poll],
> [up], [No Diagnostic])
> > +BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
> > +BFD_CHECK_RX([p0], [500ms], [300ms], [500ms])
> > +
> > +# for the following 1500ms, there should be no decay,
> > +# since the decay_detect_time is set to 2000ms.
> > +for i in `seq 0 2`
> > +do
> > +    ovs-appctl time/warp 500
> > +    BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic],
> [none], [up], [No Diagnostic])
> > +    BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic],
> [none], [up], [No Diagnostic])
> > +    BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
> > +    BFD_CHECK_RX([p0], [500ms], [300ms], [500ms])
> > +done
> > +
> > +ovs-appctl time/warp 500
> > +# at 2000ms, decay should happen and there should be the poll.
> > +BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic],
> [final], [up], [No Diagnostic])
> > +BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic], [poll],
> [up], [No Diagnostic])
> > +BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
> > +BFD_CHECK_RX([p0], [1000ms], [1000ms], [500ms])
> > +for i in `seq 0 4`; do ovs-appctl time/warp 500; done
> > +
> > +# Test-4 set min_rx to 800ms.
> > +# This should firstly reset the min_rx and then re-decay to 2000ms.
> > +AT_CHECK([ovs-vsctl set Interface p0 bfd:min_rx=800])
> > +BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic],
> [final], [up], [No Diagnostic])
> > +BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic], [poll],
> [up], [No Diagnostic])
> > +BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
> > +BFD_CHECK_RX([p0], [800ms], [800ms], [500ms])
> > +
> > +# for the following 1600ms, there should be no decay,
> > +# since the decay detection time is set to 2000ms.
> > +for i in `seq 0 1`
> > +do
> > +    ovs-appctl time/warp 800
> > +    BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic],
> [none], [up], [No Diagnostic])
> > +    BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic],
> [none], [up], [No Diagnostic])
> > +    BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
> > +    BFD_CHECK_RX([p0], [800ms], [800ms], [500ms])
> > +done
> > +
> > +ovs-appctl time/warp 500
> > +# at 2000ms, decay should happen and there should be the poll.
> > +BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic],
> [final], [up], [No Diagnostic])
> > +BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic], [poll],
> [up], [No Diagnostic])
> > +BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
> > +BFD_CHECK_RX([p0], [1000ms], [1000ms], [500ms])
> > +for i in `seq 0 4`; do ovs-appctl time/warp 500; done
> > +
> > +
> > +# Test-5 set min_rx to 300ms and decay_min_rx to 5000ms.
> > +AT_CHECK([ovs-vsctl set Interface p0 bfd:min_rx=300
> bfd:decay_min_rx=5000])
> > +BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic],
> [final], [up], [No Diagnostic])
> > +BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic], [poll],
> [up], [No Diagnostic])
> > +BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
> > +BFD_CHECK_RX([p0], [500ms], [300ms], [500ms])
> > +
> > +# for decay_min_rx > 2000ms, the decay detection time is set to
> > +# decay_min_rx.
> > +# for the following 4500ms, there should be no decay,
> > +# since the decay detection time is set to 5000ms.
> > +for i in `seq 0 8`
> > +do
> > +    ovs-appctl time/warp 500
> > +    BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic],
> [none], [up], [No Diagnostic])
> > +    BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic],
> [none], [up], [No Diagnostic])
> > +    BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
> > +    BFD_CHECK_RX([p0], [500ms], [300ms], [500ms])
> > +done
> > +
> > +ovs-appctl time/warp 500
> > +# at 5000ms, decay should happen and there should be the poll.
> > +BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic],
> [final], [up], [No Diagnostic])
> > +BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic], [poll],
> [up], [No Diagnostic])
> > +BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
> > +BFD_CHECK_RX([p0], [5000ms], [5000ms], [500ms])
> > +for i in `seq 0 9`; do ovs-appctl time/warp 500; done
> > +
> > +
> > +# Test-6 set decay_min_rx to 0 to disable bfd decay.
> > +AT_CHECK([ovs-vsctl set Interface p0 bfd:decay_min_rx=0])
> > +AT_CHECK([ovs-appctl bfd/show], [0], [stdout], [])
> > +# The final flag must be set, since the configuration of bfd related
> variables triggers a bfd poll.
> > +BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic],
> [final], [up], [No Diagnostic])
> > +BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic], [poll],
> [up], [No Diagnostic])
> > +BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
> > +BFD_CHECK_RX([p0], [500ms], [300ms], [500ms])
> > +for i in `seq 0 20`
> > +do
> > +    ovs-appctl time/warp 500
> > +    BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic],
> [none], [up], [No Diagnostic])
> > +    BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic],
> [none], [up], [No Diagnostic])
> > +    BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
> > +    BFD_CHECK_RX([p0], [500ms], [300ms], [500ms])
> > +done
> > +
> > +AT_CHECK([ovs-vsctl del-br br1], [0], [ignore])
> > +AT_CLEANUP
> > +
> > --
> > 1.7.9.5
> >
> > _______________________________________________
> > dev mailing list
> > dev@openvswitch.org
> > http://openvswitch.org/mailman/listinfo/dev
>
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to