ofproto: Inline trivial functions.
[sliver-openvswitch.git] / tests / bfd.at
index 83b4249..3723d60 100644 (file)
@@ -101,9 +101,9 @@ OVS_VSWITCHD_START(
        set bridge br-sw datapath-type=dummy \
        other-config:hwaddr=aa:55:aa:58:00:00 -- \
     add-port br-sw p1-sw -- set Interface p1-sw type=patch \
-       options:peer=p1 -- \
+       options:peer=p1 ofport_request=2 -- \
     add-port br-sw p0-sw -- set Interface p0-sw type=patch \
-       options:peer=p0 -- \
+       options:peer=p0 ofport_request=1 -- \
     add-port br-bfd1 p1 -- set Interface p1 type=patch \
        options:peer=p1-sw bfd:enable=true -- \
     add-port br-bfd0 p0 -- set Interface p0 type=patch \
@@ -269,7 +269,7 @@ OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy -- \
 ovs-appctl time/stop
 
 # wait for a while to stablize everything.
-for i in `seq 0 9`; do ovs-appctl time/warp 500; done
+for i in `seq 0 19`; 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])
@@ -277,25 +277,19 @@ BFD_CHECK_RX([p0], [500ms], [300ms], [500ms])
 
 # Test-1 BFD decay: decay to decay_min_rx
 AT_CHECK([ovs-vsctl set interface p0 bfd:decay_min_rx=3000])
-# set the bfd:decay_min_rx of p0 to 3000ms.
-BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
-BFD_CHECK_RX([p0], [500ms], [300ms], [500ms])
-
 # bfd:decay_min_rx is set to 3000ms after the local state of p0 goes up,
-# so for the first 2500ms, there should be no change.
-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])
+# so for the first 2000ms, there should be no change.
+for i in `seq 0 3`; do ovs-appctl time/warp 500; done
 BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
 BFD_CHECK_RX([p0], [500ms], [300ms], [500ms])
 
-# advance the clock by 2000ms.
-for i in `seq 0 3`; do ovs-appctl time/warp 500; done
+# advance the clock by 5000ms.
+for i in `seq 0 9`; do ovs-appctl time/warp 500; done
 # now, min_rx should decay to 3000ms.
 BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
 BFD_CHECK_RX([p0], [3000ms], [3000ms], [500ms])
 
-# the rx_min of p0 is 3000ms now, and p1 will send next control message
-# 3000ms after decay. so, advance clock by 5000ms to make that happen.
+# advance clock by 5000ms and check the the flags are all 'none'.
 for i in `seq 0 9`; 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])
@@ -304,7 +298,7 @@ BFD_CHECK_RX([p0], [3000ms], [3000ms], [500ms])
 # End of Test-1 ###############################################################
 
 
-# Test-2 BFD decay: go back to cfg_min_rx when there is traffic
+# Test-2 BFD decay: go back to min_rx when there is traffic
 # receive packet at 1/100ms rate for 5000ms.
 for i in `seq 0 49`
 do
@@ -313,108 +307,32 @@ do
              [0], [stdout], [])
 done
 # after a decay interval (3000ms), the p0 min_rx will go back to
-# cfg_min_rx.
+# min_rx.
 BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
 BFD_CHECK_RX([p0], [500ms], [300ms], [500ms])
 # End of Test-2 ###############################################################
 
 
-# Test-3 BFD decay: go back to cfg_min_rx when decay_min_rx is changed
-# advance the clock by 5000m. p0 shoud decay.
-for i in `seq 0 9`; do ovs-appctl time/warp 500; done
-BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
-BFD_CHECK_RX([p0], [3000ms], [3000ms], [500ms])
-
-# advance the clock, to make 'flag' go back to none.
-for i in `seq 0 5`; do ovs-appctl time/warp 500; done
+# Test-3 BFD decay: set decay_min_rx to 1000ms.
+# this should firstly reset the min_rx and then re-decay to 1000ms.
+AT_CHECK([ovs-vsctl set Interface p0 bfd:decay_min_rx=1000])
+# advance the clock by 10000ms, decay should have happened.
+for i in `seq 0 19`; 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])
-
-# change decay_min_rx to 1000ms.
-# for decay_min_rx < 2000ms, the decay detection time is set to 2000ms.
-# this should reset the min_rx.
-AT_CHECK([ovs-vsctl set Interface p0 bfd:decay_min_rx=1000])
-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
-
-# advance the clock by 2000ms, decay should have happened.
-for i in `seq 0 3`; do ovs-appctl time/warp 500; done
 BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
 BFD_CHECK_RX([p0], [1000ms], [1000ms], [500ms])
-# advance the clock, so 'flag' go back to none.
-for i in `seq 0 9`; do ovs-appctl time/warp 500; done
 # End of Test-3 ###############################################################
 
 
-# Test-4 BFD decay: set min_rx to 800ms.
-# this should firstly reset the min_rx and then re-decay to 1000ms.
-AT_CHECK([ovs-vsctl set Interface p0 bfd:min_rx=800])
-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
-
-# advance the clock by 2000ms, decay should have happened.
-for i in `seq 0 3`; do ovs-appctl time/warp 500; done
-BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
-BFD_CHECK_RX([p0], [1000ms], [1000ms], [500ms])
-# advance the clock, so 'flag' go back to none.
-for i in `seq 0 9`; do ovs-appctl time/warp 500; done
-# End of Test-4 ###############################################################
-
-
-# Test-5 BFD decay: set min_rx to 300ms and decay_min_rx to 5000ms together.
-AT_CHECK([ovs-vsctl set Interface p0 bfd:min_rx=300 bfd:decay_min_rx=5000])
-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 (5000ms).
-# 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
-
-# advance the clock by 2000ms, decay should have happened.
-for i in `seq 0 3`; do ovs-appctl time/warp 500; done
-BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
-BFD_CHECK_RX([p0], [5000ms], [5000ms], [500ms])
-# advance the clock, to make 'flag' go back to none.
-for i in `seq 0 9`; do ovs-appctl time/warp 500; done
-# End of Test-5 ###############################################################
-
-
-# Test-6 BFD decay: set decay_min_rx to 0 to disable bfd decay.
+# Test-4 BFD decay: set decay_min_rx to 0 to disable bfd decay.
 AT_CHECK([ovs-vsctl set Interface p0 bfd:decay_min_rx=0])
+# advance the clock by 5000ms.
+for i in `seq 0 9`; do ovs-appctl time/warp 500; done
 # min_rx is reset.
 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
@@ -423,18 +341,20 @@ do
     BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
     BFD_CHECK_RX([p0], [500ms], [300ms], [500ms])
 done
-# End of Test-6 ################################################################
+# End of Test-4 ################################################################
 
 
-# Test-7 BFD decay: rmt_min_tx is greater than decay_min_rx
+# Test-5 BFD decay: rmt_min_tx is greater than decay_min_rx
 AT_CHECK([ovs-vsctl set Interface p0 bfd:decay_min_rx=3000 -- set interface p1 bfd:min_tx=5000])
-# there will be poll sequences from both sides. and it is hard to determine the
-# order. so just skip 10000ms and check the RX/TX. at that time, p0 should be in decay already.
+# advance the clock by 10000ms to stable everything.
 for i in `seq 0 19`; 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])
+# p0 rx should show 5000ms even if it is in decay.
 BFD_CHECK_TX([p0], [500ms], [300ms], [5000ms])
 BFD_CHECK_RX([p0], [5000ms], [3000ms], [500ms])
 # then, there should be no change of status,
-for i in `seq 0 9`
+for i in `seq 0 19`
 do
     ovs-appctl time/warp 500
     BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic], [none], [up], [No Diagnostic])
@@ -444,17 +364,19 @@ do
 done
 # reset the p1's min_tx to 500ms.
 AT_CHECK([ovs-vsctl set Interface p1 bfd:min_tx=500])
+# advance the clock by 20000ms to stable everything.
 # since p0 has been in decay, now the RX will show 3000ms.
+for i in `seq 0 39`; do ovs-appctl time/warp 500; done
 BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
 BFD_CHECK_RX([p0], [3000ms], [3000ms], [500ms])
-# End of Test-7 ###############################################################
+# End of Test-5 ###############################################################
 
 
-# Test-8 BFD decay: state up->down->up.
+# Test-6 BFD decay: state up->down->up.
 # turn bfd off on p1
 AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=false])
 
-# check the state change of bfd on p0. After 15000 ms (> 3 min_rx intervals)
+# advance the clock by 15000ms to stable everything.
 for i in `seq 0 14`; do ovs-appctl time/warp 1000; done
 BFD_CHECK([p0], [false], [false], [none], [down], [Control Detection Time Expired], [none], [down], [No Diagnostic])
 BFD_CHECK_TX([p0], [1000ms], [1000ms], [0ms])
@@ -470,7 +392,7 @@ BFD_CHECK_RX([p0], [500ms], [300ms], [500ms])
 for i in `seq 0 9`; do ovs-appctl time/warp 500; done
 BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
 BFD_CHECK_RX([p0], [3000ms], [3000ms], [500ms])
-# End of Test-8 ################################################################
+# End of Test-6 ################################################################
 
 OVS_VSWITCHD_STOP
 AT_CLEANUP
@@ -629,8 +551,6 @@ done
 
 # reconfigure the decay_min_rx to 1000ms.
 AT_CHECK([ovs-vsctl set interface p0 bfd:decay_min_rx=1000])
-BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
-BFD_CHECK_RX([p0], [500ms], [300ms], [500ms])
 
 # wait for 5000ms to decay.
 for i in `seq 0 9`; do ovs-appctl time/warp 500; done
@@ -716,7 +636,7 @@ BFD_VSCTL_LIST_IFACE([p1], ["s/^.*flap_count=\(.*\), forwarding.*$/\1/p"], ["1"]
 
 # turn bfd on p1 off, should increment the bfd:flap_count on p0.
 AT_CHECK([ovs-vsctl set interface p1 bfd:enable=false])
-for i in `seq 0 19`; do ovs-appctl time/warp 100; done
+for i in `seq 0 49`; do ovs-appctl time/warp 100; done
 BFD_CHECK([p0], [false], [false], [none], [down], [Control Detection Time Expired], [none], [down], [No Diagnostic])
 BFD_VSCTL_LIST_IFACE([p0], ["s/^.*flap_count=\(.*\), forwarding.*$/\1/p"], ["2"])
 AT_CHECK([ovs-vsctl list interface p1 | sed -n "s/^.*flap_count=\(.*\), forwarding.*$/\1/p"])
@@ -724,7 +644,7 @@ AT_CHECK([ovs-vsctl list interface p1 | sed -n "s/^.*flap_count=\(.*\), forwardi
 # turn bfd on p1 on again, should increment the bfd:flap_count on p0.
 # p1 should still have flap_count = "1", since it is reset.
 AT_CHECK([ovs-vsctl set interface p1 bfd:enable=true])
-for i in `seq 0 19`; do ovs-appctl time/warp 100; done
+for i in `seq 0 49`; do ovs-appctl time/warp 100; done
 BFD_VSCTL_LIST_IFACE([p0], ["s/^.*flap_count=\(.*\), forwarding.*$/\1/p"], ["3"])
 BFD_VSCTL_LIST_IFACE([p1], ["s/^.*flap_count=\(.*\), forwarding.*$/\1/p"], ["1"])
 
@@ -736,7 +656,7 @@ OK
 
 # turn bfd on p1 off, should not increment the bfd:flap_count on p0, since forwarding_override is on.
 AT_CHECK([ovs-vsctl set interface p1 bfd:enable=false])
-for i in `seq 0 19`; do ovs-appctl time/warp 100; done
+for i in `seq 0 49`; do ovs-appctl time/warp 100; done
 BFD_CHECK([p0], [true], [false], [none], [down], [Control Detection Time Expired], [none], [down], [No Diagnostic])
 BFD_VSCTL_LIST_IFACE([p0], ["s/^.*flap_count=\(.*\), forwarding.*$/\1/p"], ["3"])
 AT_CHECK([ovs-vsctl list interface p1 | sed -n "s/^.*flap_count=\(.*\), forwarding.*$/\1/p"])
@@ -744,7 +664,7 @@ AT_CHECK([ovs-vsctl list interface p1 | sed -n "s/^.*flap_count=\(.*\), forwardi
 # turn bfd on p1 on again, should not increment the bfd:flap_count on p0, since forwarding override is on.
 # p1 should still have flap_count = "1", since it is reset.
 AT_CHECK([ovs-vsctl set interface p1 bfd:enable=true])
-for i in `seq 0 19`; do ovs-appctl time/warp 100; done
+for i in `seq 0 49`; do ovs-appctl time/warp 100; done
 BFD_VSCTL_LIST_IFACE([p0], ["s/^.*flap_count=\(.*\), forwarding.*$/\1/p"], ["3"])
 BFD_VSCTL_LIST_IFACE([p1], ["s/^.*flap_count=\(.*\), forwarding.*$/\1/p"], ["1"])
 
@@ -755,9 +675,9 @@ OK
 
 # turn bfd on p1 off and on, should increment the bfd:flap_count on p0.
 AT_CHECK([ovs-vsctl set interface p1 bfd:enable=false])
-for i in `seq 0 19`; do ovs-appctl time/warp 100; done
+for i in `seq 0 49`; do ovs-appctl time/warp 100; done
 AT_CHECK([ovs-vsctl set interface p1 bfd:enable=true])
-for i in `seq 0 19`; do ovs-appctl time/warp 100; done
+for i in `seq 0 49`; do ovs-appctl time/warp 100; done
 BFD_VSCTL_LIST_IFACE([p0], ["s/^.*flap_count=\(.*\), forwarding.*$/\1/p"], ["5"])
 BFD_VSCTL_LIST_IFACE([p1], ["s/^.*flap_count=\(.*\), forwarding.*$/\1/p"], ["1"])
 
@@ -804,7 +724,7 @@ BFD_VSCTL_LIST_IFACE([p0], ["s/^.*flap_count=\(.*\), forwarding.*$/\1/p"], ["8"]
 
 # turn on the bfd on p1.
 AT_CHECK([ovs-vsctl set interface p1 bfd:enable=true])
-for i in `seq 0 19`; do ovs-appctl time/warp 100; done
+for i in `seq 0 49`; do ovs-appctl time/warp 100; done
 # even though there is no data traffic, since p1 bfd is on again, should increment the flap_count.
 BFD_VSCTL_LIST_IFACE([p0], ["s/^.*flap_count=\(.*\), forwarding.*$/\1/p"], ["9"])
 BFD_VSCTL_LIST_IFACE([p1], ["s/^.*flap_count=\(.*\), forwarding.*$/\1/p"], ["1"])