odp-util: Format and scan multiple MPLS labels.
[cascardo/ovs.git] / tests / bfd.at
index f6f5592..925af77 100644 (file)
@@ -55,18 +55,18 @@ OVS_VSWITCHD_START(
     set Interface p0 bfd:enable=true -- \
     set Interface p1 bfd:enable=true ])
 ovs-appctl time/stop
-for i in `seq 0 40`; do ovs-appctl time/warp 100; done
+ovs-appctl time/warp 4100 100
 
 #Verify that BFD has been enabled on both interfaces.
 BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic], [none], [up], [No Diagnostic])
 BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic], [none], [up], [No Diagnostic])
 
 AT_CHECK([ ovs-vsctl set interface p0 bfd:enable=false])
-for i in `seq 0 40`; do ovs-appctl time/warp 100; done
+ovs-appctl time/warp 4100 100
 BFD_CHECK([p1], [false], [false], [none], [down], [Control Detection Time Expired], [none], [down], [No Diagnostic])
 
 AT_CHECK([ ovs-vsctl set interface p0 bfd:enable=true])
-for i in `seq 0 40`; do ovs-appctl time/warp 100; done
+ovs-appctl time/warp 4100 100
 BFD_CHECK([p1], [true], [false], [none], [up], [Control Detection Time Expired], [none], [up], [No Diagnostic])
 BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic], [none], [up], [Control Detection Time Expired])
 
@@ -115,13 +115,13 @@ ovs-appctl time/stop
 
 AT_CHECK([ovs-ofctl add-flow br-sw 'priority=0,actions=NORMAL'])
 #Verify that BFD is enabled.
-for i in `seq 0 40`; do ovs-appctl time/warp 100; done
+ovs-appctl time/warp 4100 100
 BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic], [none], [up], [No Diagnostic])
 BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic], [none], [up], [No Diagnostic])
 
 #Drop all packets in the br-sw bridge so that the tunnel is down.
 AT_CHECK([ ovs-ofctl add-flow br-sw 'priority=5,actions=drop' ])
-for i in `seq 0 40`; do ovs-appctl time/warp 100; done
+ovs-appctl time/warp 4100 100
 BFD_CHECK([p1], [false], [false], [none], [down], [Control Detection Time Expired], [none], [down], [No Diagnostic])
 BFD_CHECK([p0], [false], [false], [none], [down], [Control Detection Time Expired], [none], [down], [No Diagnostic])
 
@@ -129,7 +129,7 @@ BFD_CHECK([p0], [false], [false], [none], [down], [Control Detection Time Expire
 AT_CHECK([ovs-ofctl del-flows br-sw], [0])
 AT_CHECK([ovs-ofctl add-flow br-sw 'priority=0,actions=NORMAL'])
 #Verify that BFD is back up again.
-for i in `seq 0 40`; do ovs-appctl time/warp 100; done
+ovs-appctl time/warp 4100 100
 
 BFD_CHECK([p1], [true], [false], [none], [up], [Control Detection Time Expired], [none], [up], [Control Detection Time Expired])
 BFD_CHECK([p0], [true], [false], [none], [up], [Control Detection Time Expired], [none], [up], [Control Detection Time Expired])
@@ -142,10 +142,11 @@ BFD_CHECK([p0], [true], [false], [none], [up], [Control Detection Time Expired],
 # but not received by p1. p0 will receive all BFD packets from p1.
 
 AT_CHECK([ ovs-ofctl add-flow br-sw 'in_port=1,priority=5,actions=drop'])
-for i in `seq 0 40`; do ovs-appctl time/warp 100; done
+ovs-appctl time/warp 4100 100
 # Make sure p1 BFD state is down since it received no BFD packets.
 BFD_CHECK([p1], [false], [false], [none], [down], [Control Detection Time Expired], [none], [down], [No Diagnostic])
-for i in `seq 0 40`; do ovs-appctl time/warp 100; done
+ovs-appctl time/warp 4100 100
+
 # p0 will be in init state once it receives "down" BFD message from p1.
 BFD_CHECK([p0], [false], [false], [none], [init], [Neighbor Signaled Session Down], [none], [down], [Control Detection Time Expired])
 
@@ -153,12 +154,12 @@ AT_CHECK([ovs-ofctl del-flows br-sw])
 AT_CHECK([ovs-ofctl add-flow br-sw 'priority=0,actions=NORMAL'])
 #Ensure that BFD is back up again.
 
-for i in `seq 0 10`; do ovs-appctl time/warp 100; done
+ovs-appctl time/warp 1100 100
 #Bring down the br-bfd0 - br-sw link
 AT_CHECK([ ovs-ofctl add-flow br-sw 'in_port=2,priority=5,actions=drop'])
-for i in `seq 0 40`; do ovs-appctl time/warp 100; done
+ovs-appctl time/warp 4100 100
 BFD_CHECK([p0], [false], [false], [none], [down], [Control Detection Time Expired], [none], [down], [No Diagnostic])
-for i in `seq 0 40`; do ovs-appctl time/warp 100; done
+ovs-appctl time/warp 4100 100
 BFD_CHECK([p1], [false], [false], [none], [init], [Neighbor Signaled Session Down], [none], [down], [Control Detection Time Expired])
 OVS_VSWITCHD_STOP
 AT_CLEANUP
@@ -177,7 +178,7 @@ AT_CHECK([ ovs-vsctl -- add-port br0 p0 -- set Interface p0 type=patch \
            options:peer=p1 ])
 AT_CHECK([ ovs-vsctl -- set interface p0 bfd:enable=true ])
 AT_CHECK([ ovs-vsctl -- set interface p1 bfd:enable=true ])
-for i in `seq 0 40`; do ovs-appctl time/warp 100; done
+ovs-appctl time/warp 4100 100
 
 #Verify that BFD has been enabled on both interfaces.
 BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic], [none], [up], [No Diagnostic])
@@ -185,7 +186,7 @@ BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic], [none], [up], [N
 
 #Set cpath_down to true on one interface, make sure the remote interface updates its values.
 AT_CHECK([ovs-vsctl set interface p0 bfd:cpath_down=true])
-for i in `seq 0 40`; do ovs-appctl time/warp 100; done
+ovs-appctl time/warp 4100 100
 BFD_CHECK([p1], [false], [false], [none], [up], [No Diagnostic], [none], [up], [Concatenated Path Down])
 OVS_VSWITCHD_STOP
 AT_CLEANUP
@@ -203,19 +204,19 @@ AT_CHECK([ ovs-vsctl -- add-port br0 p0 -- set Interface p0 type=patch \
            options:peer=p1 ])
 AT_CHECK([ ovs-vsctl -- set interface p0 bfd:enable=true ])
 AT_CHECK([ ovs-vsctl -- set interface p1 bfd:enable=true ])
-for i in `seq 0 30`; do ovs-appctl time/warp 100; done
+ovs-appctl time/warp 3100 100
 #Verify that BFD has been enabled on both interfaces.
 BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic], [none], [up], [No Diagnostic])
 BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic], [none], [up], [No Diagnostic])
 #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
+ovs-appctl time/warp 2100 100
 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
+ovs-appctl time/warp 2100 100
 BFD_CHECK_RX([p1], [300ms], [300ms], [1000ms])
 BFD_CHECK_RX([p0], [1000ms], [1000ms], [300ms])
 
@@ -229,7 +230,7 @@ OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
                     set bridge br0 fail-mode=standalone])
 
 # by default check_tnl_key is false. so we should process a bfd packet with tun_id=1.
-AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'tunnel(tun_id=0x1,src=2.2.2.2,dst=2.2.2.1,tos=0x0,ttl=64,flags(key)),in_port(1),skb_mark(0/0),eth(src=00:11:22:33:44:55,dst=00:23:20:00:00:01),eth_type(0x0800),ipv4(src=169.254.1.0/0.0.0.0,dst=169.254.1.1/0.0.0.0,proto=17/0xff,tos=0/0,ttl=255/0,frag=no/0xff),udp(src=49152/0,dst=3784/0xffff)' -generate], [0], [stdout])
+AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'tunnel(tun_id=0x1,src=2.2.2.2,dst=2.2.2.1,tos=0x0,ttl=64,tp_src=0,tp_dst=0,flags(key)),in_port(1),skb_mark(0/0),eth(src=00:11:22:33:44:55,dst=00:23:20:00:00:01),eth_type(0x0800),ipv4(src=169.254.1.0/0.0.0.0,dst=169.254.1.1/0.0.0.0,proto=17/0xff,tos=0/0,ttl=255/0,frag=no),udp(src=49152/0,dst=3784/0xffff)' -generate], [0], [stdout])
 # check that the packet should be handled as BFD packet.
 AT_CHECK([tail -2 stdout], [0], [dnl
 This flow is handled by the userspace slow path because it:
@@ -238,7 +239,7 @@ This flow is handled by the userspace slow path because it:
 
 # turn on the check_tnl_key.
 AT_CHECK([ovs-vsctl set interface p1 bfd:check_tnl_key=true])
-AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'tunnel(tun_id=0x1,src=2.2.2.2,dst=2.2.2.1,tos=0x0,ttl=64,flags(key)),in_port(1),skb_mark(0/0),eth(src=00:11:22:33:44:55,dst=00:23:20:00:00:01),eth_type(0x0800),ipv4(src=169.254.1.0/0.0.0.0,dst=169.254.1.1/0.0.0.0,proto=17/0xff,tos=0/0,ttl=255/0,frag=no/0xff),udp(src=49152/0,dst=3784/0xffff)' -generate], [0], [stdout])
+AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'tunnel(tun_id=0x1,src=2.2.2.2,dst=2.2.2.1,tos=0x0,ttl=64,tp_src=0,tp_dst=0,flags(key)),in_port(1),skb_mark(0/0),eth(src=00:11:22:33:44:55,dst=00:23:20:00:00:01),eth_type(0x0800),ipv4(src=169.254.1.0/0.0.0.0,dst=169.254.1.1/0.0.0.0,proto=17/0xff,tos=0/0,ttl=255/0,frag=no),udp(src=49152/0,dst=3784/0xffff)' -generate], [0], [stdout])
 # check that the packet should be handled as normal packet.
 AT_CHECK([tail -1 stdout], [0],[dnl
 Datapath actions: 100
@@ -246,7 +247,7 @@ Datapath actions: 100
 
 # set the tunnel key to 0.
 AT_CHECK([ovs-vsctl set interface p1 options:key=0])
-AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'tunnel(tun_id=0x0,src=2.2.2.2,dst=2.2.2.1,tos=0x0,ttl=64,flags(key)),in_port(1),skb_mark(0/0),eth(src=00:11:22:33:44:55,dst=00:23:20:00:00:01),eth_type(0x0800),ipv4(src=169.254.1.0/0.0.0.0,dst=169.254.1.1/0.0.0.0,proto=17/0xff,tos=0/0,ttl=255/0,frag=no/0xff),udp(src=49152/0,dst=3784/0xffff)' -generate], [0], [stdout])
+AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'tunnel(tun_id=0x0,src=2.2.2.2,dst=2.2.2.1,tos=0x0,ttl=64,tp_src=0,tp_dst=0,flags(key)),in_port(1),skb_mark(0/0),eth(src=00:11:22:33:44:55,dst=00:23:20:00:00:01),eth_type(0x0800),ipv4(src=169.254.1.0/0.0.0.0,dst=169.254.1.1/0.0.0.0,proto=17/0xff,tos=0/0,ttl=255/0,frag=no),udp(src=49152/0,dst=3784/0xffff)' -generate], [0], [stdout])
 # check that the packet should be handled as BFD packet.
 AT_CHECK([tail -2 stdout], [0], [dnl
 This flow is handled by the userspace slow path because it:
@@ -269,7 +270,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 19`; do ovs-appctl time/warp 500; done
+ovs-appctl time/warp 10000 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])
@@ -279,18 +280,18 @@ BFD_CHECK_RX([p0], [500ms], [300ms], [500ms])
 AT_CHECK([ovs-vsctl set interface p0 bfd:decay_min_rx=3000])
 # bfd:decay_min_rx is set to 3000ms after the local state of p0 goes up,
 # so for the first 2000ms, there should be no change.
-for i in `seq 0 3`; do ovs-appctl time/warp 500; done
+ovs-appctl time/warp 2000 500
 BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
 BFD_CHECK_RX([p0], [500ms], [300ms], [500ms])
 
 # advance the clock by 5000ms.
-for i in `seq 0 9`; do ovs-appctl time/warp 500; done
+ovs-appctl time/warp 5000 500
 # now, min_rx should decay to 3000ms.
 BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
 BFD_CHECK_RX([p0], [3000ms], [3000ms], [500ms])
 
-# 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
+# advance clock by 5000ms and check the flags are all 'none'.
+ovs-appctl time/warp 5000 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])
@@ -317,7 +318,7 @@ BFD_CHECK_RX([p0], [500ms], [300ms], [500ms])
 # 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
+ovs-appctl time/warp 10000 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])
@@ -328,7 +329,7 @@ BFD_CHECK_RX([p0], [1000ms], [1000ms], [500ms])
 # 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
+ovs-appctl time/warp 10000 500
 # min_rx is reset.
 BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
 BFD_CHECK_RX([p0], [500ms], [300ms], [500ms])
@@ -347,7 +348,7 @@ done
 # 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])
 # advance the clock by 10000ms to stable everything.
-for i in `seq 0 19`; do ovs-appctl time/warp 500; done
+ovs-appctl time/warp 10000 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])
 # p0 rx should show 5000ms even if it is in decay.
@@ -366,7 +367,7 @@ done
 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
+ovs-appctl time/warp 20000 500
 BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
 BFD_CHECK_RX([p0], [3000ms], [3000ms], [500ms])
 # End of Test-5 ###############################################################
@@ -377,19 +378,19 @@ BFD_CHECK_RX([p0], [3000ms], [3000ms], [500ms])
 AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=false])
 
 # advance the clock by 15000ms to stable everything.
-for i in `seq 0 14`; do ovs-appctl time/warp 1000; done
+ovs-appctl time/warp 15000 1000
 BFD_CHECK([p0], [false], [false], [none], [down], [Control Detection Time Expired], [none], [down], [No Diagnostic])
 BFD_CHECK_TX([p0], [1000ms], [1000ms], [0ms])
 BFD_CHECK_RX([p0], [300ms], [300ms], [1ms])
 
 # resume the bfd on p1. the bfd should not go to decay mode direclty.
 AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=true])
-for i in `seq 0 3`; do ovs-appctl time/warp 500; done
+ovs-appctl time/warp 1500 500
 BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
 BFD_CHECK_RX([p0], [500ms], [300ms], [500ms])
 
 # since the decay_min_rx is still 3000ms, so after 5000ms, p0 should have decayed.
-for i in `seq 0 9`; do ovs-appctl time/warp 500; done
+ovs-appctl time/warp 5000 500
 BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
 BFD_CHECK_RX([p0], [3000ms], [3000ms], [500ms])
 # End of Test-6 ################################################################
@@ -441,6 +442,7 @@ done
 BFD_CHECK([p0], [false], [false], [none], [down], [No Diagnostic], [none], [down], [No Diagnostic])
 
 AT_CHECK([ovs-vsctl del-br br1], [0], [ignore])
+OVS_VSWITCHD_STOP
 AT_CLEANUP
 
 
@@ -460,7 +462,7 @@ OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy -- \
 
 ovs-appctl time/stop
 # advance the clock, to stablize the states.
-for i in `seq 0 9`; do ovs-appctl time/warp 500; done
+ovs-appctl time/warp 5000 500
 
 # enable forwarding_if_rx.
 AT_CHECK([ovs-vsctl set Interface p0 bfd:forwarding_if_rx=true], [0])
@@ -501,13 +503,14 @@ BFD_CHECK([p0], [false], [false], [none], [down], [Control Detection Time Expire
 # re-enable bfd on the other end. the states should be up.
 AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=true bfd:min_tx=300 bfd:min_rx=300])
 # advance the clock, to stablize the states.
-for i in `seq 0 9`; do ovs-appctl time/warp 500; done
+ovs-appctl time/warp 5000 500
 BFD_CHECK([p0], [true], [false], [none], [up], [Control Detection Time Expired], [none], [up], [No Diagnostic])
 BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic], [none], [up], [Control Detection Time Expired])
 BFD_CHECK_TX([p0], [500ms], [500ms], [300ms])
 BFD_CHECK_RX([p0], [500ms], [500ms], [300ms])
 
 AT_CHECK([ovs-vsctl del-br br1], [0], [ignore])
+OVS_VSWITCHD_STOP
 AT_CLEANUP
 
 # forwarding_if_rx Test3
@@ -524,7 +527,7 @@ OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy -- \
 
 ovs-appctl time/stop
 # advance the clock, to stablize the states.
-for i in `seq 0 19`; do ovs-appctl time/warp 500; done
+ovs-appctl time/warp 10000 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])
@@ -545,7 +548,7 @@ done
 AT_CHECK([ovs-vsctl set interface p0 bfd:decay_min_rx=1000])
 
 # wait for 5000ms to decay.
-for i in `seq 0 9`; do ovs-appctl time/warp 500; done
+ovs-appctl time/warp 5000 500
 BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic], [none], [up], [No Diagnostic])
 BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
 BFD_CHECK_RX([p0], [1000ms], [1000ms], [500ms])
@@ -575,7 +578,7 @@ do
 done
 
 # stop receiving for 5000ms.
-for i in `seq 0 49`; do ovs-appctl time/warp 100; done
+ovs-appctl time/warp 5000 100
 BFD_CHECK([p0], [false], [false], [none], [down], [Control Detection Time Expired], [none], [down], [No Diagnostic])
 
 # reset bfd forwarding_if_rx.
@@ -588,13 +591,14 @@ BFD_CHECK([p0], [false], [false], [none], [down], [Control Detection Time Expire
 # re-enable bfd on the other end. the states should be up.
 AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=true bfd:min_tx=300 bfd:min_rx=300])
 # advance the clock, to stablize the states.
-for i in `seq 0 19`; do ovs-appctl time/warp 500; done
+ovs-appctl time/warp 10000 500
 BFD_CHECK([p0], [true], [false], [none], [up], [Control Detection Time Expired], [none], [up], [No Diagnostic])
 BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic], [none], [up], [Control Detection Time Expired])
 BFD_CHECK_TX([p0], [300ms], [300ms], [300ms])
 BFD_CHECK_RX([p0], [1000ms], [1000ms], [300ms])
 
 AT_CHECK([ovs-vsctl del-br br1], [0], [ignore])
+OVS_VSWITCHD_STOP
 AT_CLEANUP
 
 # forwarding_if_rx Test4
@@ -611,7 +615,7 @@ OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy -- \
 
 ovs-appctl time/stop
 # advance the clock, to stablize the states.
-for i in `seq 0 19`; do ovs-appctl time/warp 500; done
+ovs-appctl time/warp 10000 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])
@@ -644,7 +648,7 @@ BFD_CHECK([p0], [false], [false], [none], [down], [Control Detection Time Expire
 # now enable the bfd on p1 again.
 AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=true], [0])
 # advance clock by 5000ms.  and p1 and p0 should be all up.
-for i in `seq 0 9`; do ovs-appctl time/warp 500; done
+ovs-appctl time/warp 5000 500
 BFD_CHECK([p0], [true], [false], [none], [up], [Control Detection Time Expired], [none], [up], [No Diagnostic])
 BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic], [none], [up], [Control Detection Time Expired])
 BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
@@ -663,6 +667,7 @@ done
 BFD_CHECK([p0], [false], [false], [none], [down], [Control Detection Time Expired], [none], [down], [No Diagnostic])
 
 AT_CHECK([ovs-vsctl del-br br1], [0], [ignore])
+OVS_VSWITCHD_STOP
 AT_CLEANUP
 
 # test bfd:flap_count.
@@ -683,9 +688,12 @@ OVS_VSWITCHD_START([add-br br1 -- \
                     set Interface p1 bfd:enable=true bfd:min_tx=100 bfd:min_rx=100])
 
 ovs-appctl time/stop
+# Disable the stats update to prevent the race between ovsdb updating
+# stats and ovs-vsctl cmd closing the jsonrpc session.
+AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:stats-update-interval=50000000])
 
 # Part-1 wait for a while to stablize bfd.
-for i in `seq 0 100`; do ovs-appctl time/warp 100; done
+ovs-appctl time/warp 10100 100
 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], [100ms], [100ms], [100ms])
@@ -696,7 +704,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 49`; do ovs-appctl time/warp 100; done
+ovs-appctl time/warp 5000 100
 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"])
@@ -704,7 +712,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 49`; do ovs-appctl time/warp 100; done
+ovs-appctl time/warp 5000 100
 BFD_VSCTL_LIST_IFACE([p0], ["s/^.*flap_count=\(.*\), forwarding.*$/\1/p"], ["3"])
 BFD_VSCTL_LIST_IFACE([p1], ["s/^.*flap_count=\(.*\), forwarding.*$/\1/p"], ["1"])
 
@@ -716,7 +724,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 49`; do ovs-appctl time/warp 100; done
+ovs-appctl time/warp 5000 100
 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"])
@@ -724,7 +732,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 49`; do ovs-appctl time/warp 100; done
+ovs-appctl time/warp 5000 100
 BFD_VSCTL_LIST_IFACE([p0], ["s/^.*flap_count=\(.*\), forwarding.*$/\1/p"], ["3"])
 BFD_VSCTL_LIST_IFACE([p1], ["s/^.*flap_count=\(.*\), forwarding.*$/\1/p"], ["1"])
 
@@ -735,15 +743,15 @@ 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 49`; do ovs-appctl time/warp 100; done
+ovs-appctl time/warp 5000 100
 AT_CHECK([ovs-vsctl set interface p1 bfd:enable=true])
-for i in `seq 0 49`; do ovs-appctl time/warp 100; done
+ovs-appctl time/warp 5000 100
 BFD_VSCTL_LIST_IFACE([p0], ["s/^.*flap_count=\(.*\), forwarding.*$/\1/p"], ["5"])
 BFD_VSCTL_LIST_IFACE([p1], ["s/^.*flap_count=\(.*\), forwarding.*$/\1/p"], ["1"])
 
 # Part-3 now turn on forwarding_if_rx.
 AT_CHECK([ovs-vsctl set Interface p0 bfd:forwarding_if_rx=true], [0])
-for i in `seq 0 10`; do ovs-appctl time/warp 100; done
+ovs-appctl time/warp 1100 100
 # disable the bfd on p1.
 AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=false], [0])
 
@@ -762,7 +770,7 @@ BFD_VSCTL_LIST_IFACE([p0], ["s/^.*flap_count=\(.*\), forwarding.*$/\1/p"], ["5"]
 
 # stop the traffic for more than 100 * bfd->cfm_min_rx ms, the forwarding flag of p0 should turn false.
 # and there should be the increment of flap_count.
-for i in `seq 0 120`; do ovs-appctl time/warp 100; done
+ovs-appctl time/warp 12100 100
 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"], ["6"])
 
@@ -779,10 +787,10 @@ BFD_VSCTL_LIST_IFACE([p0], ["s/^.*flap_count=\(.*\), forwarding.*$/\1/p"], ["6"]
 
 # turn on the bfd on p1.
 AT_CHECK([ovs-vsctl set interface p1 bfd:enable=true])
-for i in `seq 0 49`; do ovs-appctl time/warp 100; done
+ovs-appctl time/warp 5000 100
 # 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"], ["7"])
 BFD_VSCTL_LIST_IFACE([p1], ["s/^.*flap_count=\(.*\), forwarding.*$/\1/p"], ["1"])
 
 OVS_VSWITCHD_STOP
-AT_CLEANUP
\ No newline at end of file
+AT_CLEANUP