]> git.proxmox.com Git - mirror_ovs.git/blame - tests/bfd.at
check-kmod: Remove all OVS modules in this target.
[mirror_ovs.git] / tests / bfd.at
CommitLineData
015cf297
PR
1AT_BANNER([bfd])
2
3m4_define([BFD_CHECK], [
4AT_CHECK([ovs-appctl bfd/show $1 | sed -e '/Time:/d' | sed -e '/Discriminator/d' | sed -e '/Interval:/d'],[0],
5[dnl
6 Forwarding: $2
7 Detect Multiplier: 3
8 Concatenated Path Down: $3
9
10 Local Flags: $4
11 Local Session State: $5
12 Local Diagnostic: $6
13
14 Remote Flags: $7
15 Remote Session State: $8
16 Remote Diagnostic: $9
17])
18])
19
20m4_define([BFD_CHECK_TX], [
21AT_CHECK([ovs-appctl bfd/show $1 | sed -n '/TX Interval/p'],[0],
22[dnl
c1c4e8c7
AW
23 TX Interval: Approx $2
24 Local Minimum TX Interval: $3
25 Remote Minimum TX Interval: $4
015cf297
PR
26])
27])
28
29m4_define([BFD_CHECK_RX], [
30AT_CHECK([ovs-appctl bfd/show $1 | sed -n '/RX Interval/p'],[0],
31[dnl
32 RX Interval: Approx $2
c1c4e8c7
AW
33 Local Minimum RX Interval: $3
34 Remote Minimum RX Interval: $4
015cf297
PR
35])
36])
4905e2df
AW
37
38m4_define([BFD_VSCTL_LIST_IFACE], [
39AT_CHECK([ovs-vsctl list interface $1 | sed -n $2],[0],
40[dnl
41$3
42])
43])
44
015cf297 45AT_SETUP([bfd - basic config on different bridges])
015cf297
PR
46#Create 2 bridges connected by patch ports and enable BFD
47OVS_VSWITCHD_START(
48 [add-br br1 -- \
49 set bridge br1 datapath-type=dummy \
50 other-config:hwaddr=aa:55:aa:56:00:00 -- \
51 add-port br1 p1 -- set Interface p1 type=patch \
52 options:peer=p0 -- \
53 add-port br0 p0 -- set Interface p0 type=patch \
54 options:peer=p1 -- \
55 set Interface p0 bfd:enable=true -- \
56 set Interface p1 bfd:enable=true ])
43d66d3b 57ovs-appctl time/stop
8661af79 58ovs-appctl time/warp 4100 100
015cf297
PR
59
60#Verify that BFD has been enabled on both interfaces.
61BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic], [none], [up], [No Diagnostic])
62BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic], [none], [up], [No Diagnostic])
63
64AT_CHECK([ ovs-vsctl set interface p0 bfd:enable=false])
8661af79 65ovs-appctl time/warp 4100 100
015cf297
PR
66BFD_CHECK([p1], [false], [false], [none], [down], [Control Detection Time Expired], [none], [down], [No Diagnostic])
67
68AT_CHECK([ ovs-vsctl set interface p0 bfd:enable=true])
8661af79 69ovs-appctl time/warp 4100 100
015cf297
PR
70BFD_CHECK([p1], [true], [false], [none], [up], [Control Detection Time Expired], [none], [up], [No Diagnostic])
71BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic], [none], [up], [Control Detection Time Expired])
72
73ovs-vsctl del-br br0
74AT_CHECK([ovs-appctl bfd/show p0], [2],[ignore], [no such bfd object
75ovs-appctl: ovs-vswitchd: server returned an error
76])
77ovs-vsctl del-br br1
78#Check that the entries are gone.
79AT_CHECK([ovs-appctl bfd/show p1], [2],[ignore], [no such bfd object
80ovs-appctl: ovs-vswitchd: server returned an error
81])
82
83OVS_VSWITCHD_STOP
84AT_CLEANUP
85
86
87AT_SETUP([bfd - Verify tunnel down detection])
88#Create 3 bridges - br-bfd0, br-bfd1 and br-sw which is midway between the two. br2 is
89#connected to br-bfd0 and br-bfd1 through patch ports p0-2 and p1-2. Enable BFD on
90#interfaces in br-bfd0 and br-bfd1. When br-sw is dropping all packets, BFD should detect
91# that the tunnel is down, and come back up when br-sw is working fine.
92
015cf297
PR
93OVS_VSWITCHD_START(
94 [add-br br-bfd0 -- \
95 set bridge br-bfd0 datapath-type=dummy \
96 other-config:hwaddr=aa:55:aa:56:00:00 -- \
97 add-br br-bfd1 -- \
98 set bridge br-bfd1 datapath-type=dummy \
99 other-config:hwaddr=aa:55:aa:57:00:00 -- \
100 add-br br-sw -- \
101 set bridge br-sw datapath-type=dummy \
102 other-config:hwaddr=aa:55:aa:58:00:00 -- \
103 add-port br-sw p1-sw -- set Interface p1-sw type=patch \
125bf01d 104 options:peer=p1 ofport_request=2 -- \
015cf297 105 add-port br-sw p0-sw -- set Interface p0-sw type=patch \
125bf01d 106 options:peer=p0 ofport_request=1 -- \
015cf297
PR
107 add-port br-bfd1 p1 -- set Interface p1 type=patch \
108 options:peer=p1-sw bfd:enable=true -- \
109 add-port br-bfd0 p0 -- set Interface p0 type=patch \
110 options:peer=p0-sw bfd:enable=true --])
111
43d66d3b 112ovs-appctl time/stop
015cf297
PR
113
114#Create 2 bridges connected by patch ports and enable BFD
115
116AT_CHECK([ovs-ofctl add-flow br-sw 'priority=0,actions=NORMAL'])
117#Verify that BFD is enabled.
8661af79 118ovs-appctl time/warp 4100 100
015cf297
PR
119BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic], [none], [up], [No Diagnostic])
120BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic], [none], [up], [No Diagnostic])
121
122#Drop all packets in the br-sw bridge so that the tunnel is down.
123AT_CHECK([ ovs-ofctl add-flow br-sw 'priority=5,actions=drop' ])
8661af79 124ovs-appctl time/warp 4100 100
015cf297
PR
125BFD_CHECK([p1], [false], [false], [none], [down], [Control Detection Time Expired], [none], [down], [No Diagnostic])
126BFD_CHECK([p0], [false], [false], [none], [down], [Control Detection Time Expired], [none], [down], [No Diagnostic])
127
128#Delete the added flow
129AT_CHECK([ovs-ofctl del-flows br-sw], [0])
130AT_CHECK([ovs-ofctl add-flow br-sw 'priority=0,actions=NORMAL'])
131#Verify that BFD is back up again.
8661af79 132ovs-appctl time/warp 4100 100
015cf297
PR
133
134BFD_CHECK([p1], [true], [false], [none], [up], [Control Detection Time Expired], [none], [up], [Control Detection Time Expired])
135BFD_CHECK([p0], [true], [false], [none], [up], [Control Detection Time Expired], [none], [up], [Control Detection Time Expired])
136
137#Now, Verify one-side tunnel down detection
138#When br-sw is dropping packets from one end, BFD should detect
139# that the tunnel is down, and come back up when br-sw is working fine.
140
141#Bring down the br-bfd1 - br-sw link. So BFD packets will be sent from p0,
142# but not received by p1. p0 will receive all BFD packets from p1.
143
144AT_CHECK([ ovs-ofctl add-flow br-sw 'in_port=1,priority=5,actions=drop'])
8661af79 145ovs-appctl time/warp 4100 100
015cf297
PR
146# Make sure p1 BFD state is down since it received no BFD packets.
147BFD_CHECK([p1], [false], [false], [none], [down], [Control Detection Time Expired], [none], [down], [No Diagnostic])
8661af79
GS
148ovs-appctl time/warp 4100 100
149
015cf297
PR
150# p0 will be in init state once it receives "down" BFD message from p1.
151BFD_CHECK([p0], [false], [false], [none], [init], [Neighbor Signaled Session Down], [none], [down], [Control Detection Time Expired])
152
153AT_CHECK([ovs-ofctl del-flows br-sw])
154AT_CHECK([ovs-ofctl add-flow br-sw 'priority=0,actions=NORMAL'])
155#Ensure that BFD is back up again.
156
8661af79 157ovs-appctl time/warp 1100 100
015cf297
PR
158#Bring down the br-bfd0 - br-sw link
159AT_CHECK([ ovs-ofctl add-flow br-sw 'in_port=2,priority=5,actions=drop'])
8661af79 160ovs-appctl time/warp 4100 100
015cf297 161BFD_CHECK([p0], [false], [false], [none], [down], [Control Detection Time Expired], [none], [down], [No Diagnostic])
8661af79 162ovs-appctl time/warp 4100 100
015cf297
PR
163BFD_CHECK([p1], [false], [false], [none], [init], [Neighbor Signaled Session Down], [none], [down], [Control Detection Time Expired])
164OVS_VSWITCHD_STOP
165AT_CLEANUP
166
167
168AT_SETUP([bfd - concatenated path down])
169#Create 2 bridges connected by patch ports and enable BFD
015cf297 170OVS_VSWITCHD_START()
43d66d3b 171ovs-appctl time/stop
015cf297
PR
172AT_CHECK([ ovs-vsctl -- add-br br1 -- \
173 set bridge br1 datapath-type=dummy \
174 other-config:hwaddr=aa:55:aa:56:00:00 ])
015cf297
PR
175AT_CHECK([ ovs-vsctl -- add-port br1 p1 -- set Interface p1 type=patch \
176 options:peer=p0 ])
177AT_CHECK([ ovs-vsctl -- add-port br0 p0 -- set Interface p0 type=patch \
178 options:peer=p1 ])
179AT_CHECK([ ovs-vsctl -- set interface p0 bfd:enable=true ])
180AT_CHECK([ ovs-vsctl -- set interface p1 bfd:enable=true ])
8661af79 181ovs-appctl time/warp 4100 100
015cf297
PR
182
183#Verify that BFD has been enabled on both interfaces.
184BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic], [none], [up], [No Diagnostic])
185BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic], [none], [up], [No Diagnostic])
186
187#Set cpath_down to true on one interface, make sure the remote interface updates its values.
188AT_CHECK([ovs-vsctl set interface p0 bfd:cpath_down=true])
8661af79 189ovs-appctl time/warp 4100 100
015cf297
PR
190BFD_CHECK([p1], [false], [false], [none], [up], [No Diagnostic], [none], [up], [Concatenated Path Down])
191OVS_VSWITCHD_STOP
192AT_CLEANUP
193
194
195AT_SETUP([bfd - Edit the Min Tx/Rx values])
196#Create 2 bridges connected by patch ports and enable BFD
015cf297 197OVS_VSWITCHD_START()
43d66d3b 198ovs-appctl time/stop
015cf297
PR
199AT_CHECK([ ovs-vsctl -- add-br br1 -- \
200 set bridge br1 datapath-type=dummy ])
201AT_CHECK([ ovs-vsctl -- add-port br1 p1 -- set Interface p1 type=patch \
202 options:peer=p0 ])
203AT_CHECK([ ovs-vsctl -- add-port br0 p0 -- set Interface p0 type=patch \
204 options:peer=p1 ])
205AT_CHECK([ ovs-vsctl -- set interface p0 bfd:enable=true ])
206AT_CHECK([ ovs-vsctl -- set interface p1 bfd:enable=true ])
8661af79 207ovs-appctl time/warp 3100 100
015cf297
PR
208#Verify that BFD has been enabled on both interfaces.
209BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic], [none], [up], [No Diagnostic])
210BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic], [none], [up], [No Diagnostic])
211#Edit the min Tx value.
212AT_CHECK([ovs-vsctl set interface p0 bfd:min_tx=200])
8661af79 213ovs-appctl time/warp 2100 100
c1c4e8c7
AW
214BFD_CHECK_TX([p0], [1000ms], [200ms], [100ms])
215BFD_CHECK_TX([p1], [1000ms], [100ms], [200ms])
015cf297
PR
216
217#Edit the min Rx value.
218AT_CHECK([ovs-vsctl set interface p1 bfd:min_rx=300])
8661af79 219ovs-appctl time/warp 2100 100
c1c4e8c7
AW
220BFD_CHECK_RX([p1], [300ms], [300ms], [1000ms])
221BFD_CHECK_RX([p0], [1000ms], [1000ms], [300ms])
015cf297
PR
222
223OVS_VSWITCHD_STOP
224AT_CLEANUP
2d21cf72
AW
225
226AT_SETUP([bfd - check_tnl_key])
227OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
228 options:remote_ip=2.2.2.2 options:key=1 ofport_request=1 -- \
229 set interface p1 bfd:enable=true -- \
230 set bridge br0 fail-mode=standalone])
231
232# by default check_tnl_key is false. so we should process a bfd packet with tun_id=1.
2d18eae8 233AT_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])
2d21cf72
AW
234# check that the packet should be handled as BFD packet.
235AT_CHECK([tail -2 stdout], [0], [dnl
236This flow is handled by the userspace slow path because it:
237 - Consists of BFD packets.
238], [])
239
240# turn on the check_tnl_key.
241AT_CHECK([ovs-vsctl set interface p1 bfd:check_tnl_key=true])
2d18eae8 242AT_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])
2d21cf72
AW
243# check that the packet should be handled as normal packet.
244AT_CHECK([tail -1 stdout], [0],[dnl
245Datapath actions: 100
246], [])
247
248# set the tunnel key to 0.
249AT_CHECK([ovs-vsctl set interface p1 options:key=0])
2d18eae8 250AT_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])
2d21cf72
AW
251# check that the packet should be handled as BFD packet.
252AT_CHECK([tail -2 stdout], [0], [dnl
253This flow is handled by the userspace slow path because it:
254 - Consists of BFD packets.
255], [])
256
257OVS_VSWITCHD_STOP
258AT_CLEANUP
c1c4e8c7
AW
259
260# Tests below are for bfd decay features.
261AT_SETUP([bfd - bfd decay])
262OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy -- \
263 add-port br1 p1 -- set Interface p1 type=patch \
264 options:peer=p0 ofport_request=2 -- \
265 add-port br0 p0 -- set Interface p0 type=patch \
266 options:peer=p1 ofport_request=1 -- \
3688ce7a 267 set Interface p0 bfd:enable=true bfd:min_tx=300 bfd:min_rx=300 -- \
c1c4e8c7
AW
268 set Interface p1 bfd:enable=true bfd:min_tx=500 bfd:min_rx=500])
269
270ovs-appctl time/stop
c1c4e8c7 271
3688ce7a 272# wait for a while to stablize everything.
8661af79 273ovs-appctl time/warp 10000 500
3688ce7a
AW
274BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic], [none], [up], [No Diagnostic])
275BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic], [none], [up], [No Diagnostic])
276BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
277BFD_CHECK_RX([p0], [500ms], [300ms], [500ms])
c1c4e8c7
AW
278
279# Test-1 BFD decay: decay to decay_min_rx
3688ce7a 280AT_CHECK([ovs-vsctl set interface p0 bfd:decay_min_rx=3000])
c1c4e8c7 281# bfd:decay_min_rx is set to 3000ms after the local state of p0 goes up,
27e26e59 282# so for the first 2000ms, there should be no change.
8661af79 283ovs-appctl time/warp 2000 500
c1c4e8c7
AW
284BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
285BFD_CHECK_RX([p0], [500ms], [300ms], [500ms])
286
27e26e59 287# advance the clock by 5000ms.
8661af79 288ovs-appctl time/warp 5000 500
3688ce7a 289# now, min_rx should decay to 3000ms.
c1c4e8c7
AW
290BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
291BFD_CHECK_RX([p0], [3000ms], [3000ms], [500ms])
292
898dcef1 293# advance clock by 5000ms and check the flags are all 'none'.
8661af79 294ovs-appctl time/warp 5000 500
c1c4e8c7 295BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic], [none], [up], [No Diagnostic])
3688ce7a 296BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic], [none], [up], [No Diagnostic])
c1c4e8c7
AW
297BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
298BFD_CHECK_RX([p0], [3000ms], [3000ms], [500ms])
299# End of Test-1 ###############################################################
300
301
27e26e59 302# Test-2 BFD decay: go back to min_rx when there is traffic
3688ce7a
AW
303# receive packet at 1/100ms rate for 5000ms.
304for i in `seq 0 49`
c1c4e8c7
AW
305do
306 ovs-appctl time/warp 100
307 AT_CHECK([ovs-ofctl packet-out br1 3 2 "90e2ba01475000101856b2e80806000108000604000100101856b2e80202020300000000000002020202"],
308 [0], [stdout], [])
309done
310# after a decay interval (3000ms), the p0 min_rx will go back to
27e26e59 311# min_rx.
c1c4e8c7
AW
312BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
313BFD_CHECK_RX([p0], [500ms], [300ms], [500ms])
314# End of Test-2 ###############################################################
315
316
27e26e59
AW
317# Test-3 BFD decay: set decay_min_rx to 1000ms.
318# this should firstly reset the min_rx and then re-decay to 1000ms.
319AT_CHECK([ovs-vsctl set Interface p0 bfd:decay_min_rx=1000])
320# advance the clock by 10000ms, decay should have happened.
8661af79 321ovs-appctl time/warp 10000 500
c1c4e8c7
AW
322BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic], [none], [up], [No Diagnostic])
323BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic], [none], [up], [No Diagnostic])
c1c4e8c7
AW
324BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
325BFD_CHECK_RX([p0], [1000ms], [1000ms], [500ms])
c1c4e8c7
AW
326# End of Test-3 ###############################################################
327
328
27e26e59
AW
329# Test-4 BFD decay: set decay_min_rx to 0 to disable bfd decay.
330AT_CHECK([ovs-vsctl set Interface p0 bfd:decay_min_rx=0])
331# advance the clock by 5000ms.
8661af79 332ovs-appctl time/warp 10000 500
27e26e59 333# min_rx is reset.
c1c4e8c7 334BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
27e26e59 335BFD_CHECK_RX([p0], [500ms], [300ms], [500ms])
881d47a9 336
c1c4e8c7
AW
337for i in `seq 0 20`
338do
339 ovs-appctl time/warp 500
340 BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic], [none], [up], [No Diagnostic])
341 BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic], [none], [up], [No Diagnostic])
342 BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
343 BFD_CHECK_RX([p0], [500ms], [300ms], [500ms])
344done
27e26e59 345# End of Test-4 ################################################################
c1c4e8c7
AW
346
347
27e26e59 348# Test-5 BFD decay: rmt_min_tx is greater than decay_min_rx
c1c4e8c7 349AT_CHECK([ovs-vsctl set Interface p0 bfd:decay_min_rx=3000 -- set interface p1 bfd:min_tx=5000])
27e26e59 350# advance the clock by 10000ms to stable everything.
8661af79 351ovs-appctl time/warp 10000 500
27e26e59
AW
352BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic], [none], [up], [No Diagnostic])
353BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic], [none], [up], [No Diagnostic])
354# p0 rx should show 5000ms even if it is in decay.
c1c4e8c7
AW
355BFD_CHECK_TX([p0], [500ms], [300ms], [5000ms])
356BFD_CHECK_RX([p0], [5000ms], [3000ms], [500ms])
357# then, there should be no change of status,
27e26e59 358for i in `seq 0 19`
c1c4e8c7
AW
359do
360 ovs-appctl time/warp 500
361 BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic], [none], [up], [No Diagnostic])
362 BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic], [none], [up], [No Diagnostic])
363 BFD_CHECK_TX([p0], [500ms], [300ms], [5000ms])
364 BFD_CHECK_RX([p0], [5000ms], [3000ms], [500ms])
365done
366# reset the p1's min_tx to 500ms.
367AT_CHECK([ovs-vsctl set Interface p1 bfd:min_tx=500])
27e26e59 368# advance the clock by 20000ms to stable everything.
3688ce7a 369# since p0 has been in decay, now the RX will show 3000ms.
8661af79 370ovs-appctl time/warp 20000 500
c1c4e8c7
AW
371BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
372BFD_CHECK_RX([p0], [3000ms], [3000ms], [500ms])
27e26e59 373# End of Test-5 ###############################################################
c1c4e8c7
AW
374
375
27e26e59 376# Test-6 BFD decay: state up->down->up.
c1c4e8c7
AW
377# turn bfd off on p1
378AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=false])
379
27e26e59 380# advance the clock by 15000ms to stable everything.
8661af79 381ovs-appctl time/warp 15000 1000
c1c4e8c7
AW
382BFD_CHECK([p0], [false], [false], [none], [down], [Control Detection Time Expired], [none], [down], [No Diagnostic])
383BFD_CHECK_TX([p0], [1000ms], [1000ms], [0ms])
384BFD_CHECK_RX([p0], [300ms], [300ms], [1ms])
385
386# resume the bfd on p1. the bfd should not go to decay mode direclty.
387AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=true])
8661af79 388ovs-appctl time/warp 1500 500
c1c4e8c7
AW
389BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
390BFD_CHECK_RX([p0], [500ms], [300ms], [500ms])
391
3688ce7a 392# since the decay_min_rx is still 3000ms, so after 5000ms, p0 should have decayed.
8661af79 393ovs-appctl time/warp 5000 500
c1c4e8c7
AW
394BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
395BFD_CHECK_RX([p0], [3000ms], [3000ms], [500ms])
27e26e59 396# End of Test-6 ################################################################
c1c4e8c7
AW
397
398OVS_VSWITCHD_STOP
01d18a3a
AW
399AT_CLEANUP
400
401# Tests below are for bfd forwarding_if_rx feature.
309d9dac
AW
402
403# forwarding_if_rx Test1
404# Test1 tests the case when bfd is only enabled on one end of the link.
34c88624
AW
405# Under this situation, the forwarding flag should always be false, even
406# though there is data packet received, since there is no bfd control
407# packet received during the demand_rx_bfd interval.
309d9dac 408AT_SETUP([bfd - bfd forwarding_if_rx - bfd on one side])
01d18a3a
AW
409OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy -- \
410 add-port br1 p1 -- set Interface p1 type=patch \
411 options:peer=p0 ofport_request=2 -- \
412 add-port br0 p0 -- set Interface p0 type=patch \
413 options:peer=p1 ofport_request=1 -- \
414 set Interface p0 bfd:enable=true bfd:min_tx=500 bfd:min_rx=500 -- \
415 add-port br1 p2 -- set Interface p2 type=internal ofport_request=3])
416
417ovs-appctl time/stop
418# check the inital status.
419BFD_CHECK([p0], [false], [false], [none], [down], [No Diagnostic], [none], [down], [No Diagnostic])
420BFD_CHECK_TX([p0], [1000ms], [1000ms], [0ms])
421BFD_CHECK_RX([p0], [500ms], [500ms], [1ms])
422
423# enable forwarding_if_rx.
424AT_CHECK([ovs-vsctl set Interface p0 bfd:forwarding_if_rx=true], [0])
425
426# there should be no change of forwarding flag, since
427# there is no traffic.
428for i in `seq 0 3`
429do
430 ovs-appctl time/warp 500
431 BFD_CHECK([p0], [false], [false], [none], [down], [No Diagnostic], [none], [down], [No Diagnostic])
432done
433
3688ce7a
AW
434# receive packet at 1/100ms rate for 2000ms.
435for i in `seq 0 19`
01d18a3a
AW
436do
437 ovs-appctl time/warp 100
438 AT_CHECK([ovs-ofctl packet-out br1 3 2 "90e2ba01475000101856b2e80806000108000604000100101856b2e80202020300000000000002020202"],
439 [0], [stdout], [])
440done
34c88624 441# the forwarding flag should be false, due to the demand_rx_bfd.
01d18a3a 442BFD_CHECK([p0], [false], [false], [none], [down], [No Diagnostic], [none], [down], [No Diagnostic])
01d18a3a
AW
443
444AT_CHECK([ovs-vsctl del-br br1], [0], [ignore])
2f2695a2 445OVS_VSWITCHD_STOP
01d18a3a
AW
446AT_CLEANUP
447
309d9dac
AW
448
449# forwarding_if_rx Test2
450# Test2 is for testing that the enable of forwarding_if_rx will not
451# affect the normal bfd communication. bfd is enabled on both ends of
452# the link.
453AT_SETUP([bfd - bfd forwarding_if_rx - bfd on both sides])
01d18a3a
AW
454OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy -- \
455 add-port br1 p1 -- set Interface p1 type=patch \
456 options:peer=p0 ofport_request=2 -- \
457 add-port br0 p0 -- set Interface p0 type=patch \
458 options:peer=p1 ofport_request=1 -- \
459 set Interface p0 bfd:enable=true bfd:min_tx=500 bfd:min_rx=500 -- \
460 set Interface p1 bfd:enable=true bfd:min_tx=300 bfd:min_rx=300 -- \
461 add-port br1 p2 -- set Interface p2 type=internal ofport_request=3])
462
463ovs-appctl time/stop
464# advance the clock, to stablize the states.
8661af79 465ovs-appctl time/warp 5000 500
01d18a3a
AW
466
467# enable forwarding_if_rx.
468AT_CHECK([ovs-vsctl set Interface p0 bfd:forwarding_if_rx=true], [0])
469
470# there should be no change of the forwarding flag, since
471# the bfd on both ends is already up.
472for i in `seq 0 5`
473do
474 ovs-appctl time/warp 500
475 BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic], [none], [up], [No Diagnostic])
476done
477
478# stop the bfd on one side.
479AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=false], [0])
480# for within 1500ms, the detection timer is not out.
481# there is no change to status.
482for i in `seq 0 1`
483do
484 ovs-appctl time/warp 500
485 BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic], [none], [up], [No Diagnostic])
3688ce7a 486 for i in `seq 0 4`
01d18a3a
AW
487 do
488 AT_CHECK([ovs-ofctl packet-out br1 3 2 "90e2ba01475000101856b2e80806000108000604000100101856b2e80202020300000000000002020202"],
489 [0], [stdout], [])
490 done
491done
492
493# at 1500ms, the STATE should go DOWN, due to Control Detection Time Expired.
494# but forwarding flag should be still true.
495ovs-appctl time/warp 500
496BFD_CHECK([p0], [true], [false], [none], [down], [Control Detection Time Expired], [none], [down], [No Diagnostic])
497
01d18a3a
AW
498# reset bfd forwarding_if_rx.
499AT_CHECK([ovs-vsctl set Interface p0 bfd:forwarding_if_rx=false], [0])
500# forwarding flag should turn to false since the STATE is DOWN.
501BFD_CHECK([p0], [false], [false], [none], [down], [Control Detection Time Expired], [none], [down], [No Diagnostic])
01d18a3a
AW
502
503# re-enable bfd on the other end. the states should be up.
504AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=true bfd:min_tx=300 bfd:min_rx=300])
505# advance the clock, to stablize the states.
8661af79 506ovs-appctl time/warp 5000 500
01d18a3a
AW
507BFD_CHECK([p0], [true], [false], [none], [up], [Control Detection Time Expired], [none], [up], [No Diagnostic])
508BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic], [none], [up], [Control Detection Time Expired])
509BFD_CHECK_TX([p0], [500ms], [500ms], [300ms])
510BFD_CHECK_RX([p0], [500ms], [500ms], [300ms])
511
512AT_CHECK([ovs-vsctl del-br br1], [0], [ignore])
2f2695a2 513OVS_VSWITCHD_STOP
01d18a3a
AW
514AT_CLEANUP
515
309d9dac
AW
516# forwarding_if_rx Test3
517# Test3 is for testing that the enable of forwarding_if_rx will not
518# affect the bfd decay feature. bfd is enabled on both ends of the link.
519AT_SETUP([bfd - bfd forwarding_if_rx - with bfd decay])
01d18a3a
AW
520OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy -- \
521 add-port br1 p1 -- set Interface p1 type=patch \
522 options:peer=p0 ofport_request=2 -- \
523 add-port br0 p0 -- set Interface p0 type=patch \
524 options:peer=p1 ofport_request=1 -- \
525 set Interface p0 bfd:enable=true bfd:min_tx=300 bfd:min_rx=300 bfd:decay_min_rx=3000 -- \
526 set Interface p1 bfd:enable=true bfd:min_tx=500 bfd:min_rx=500])
527
528ovs-appctl time/stop
529# advance the clock, to stablize the states.
8661af79 530ovs-appctl time/warp 10000 500
01d18a3a
AW
531BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic], [none], [up], [No Diagnostic])
532BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic], [none], [up], [No Diagnostic])
533BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
534BFD_CHECK_RX([p0], [3000ms], [3000ms], [500ms])
535
536# enable forwarding_if_rx.
537AT_CHECK([ovs-vsctl set Interface p0 bfd:forwarding_if_rx=true], [0])
538
539# there should be no change of the forwarding flag, since
540# the bfd on both ends is already up.
541for i in `seq 0 9`
542do
543 ovs-appctl time/warp 500
544 BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic], [none], [up], [No Diagnostic])
545done
546
3688ce7a 547# reconfigure the decay_min_rx to 1000ms.
01d18a3a 548AT_CHECK([ovs-vsctl set interface p0 bfd:decay_min_rx=1000])
01d18a3a 549
3688ce7a 550# wait for 5000ms to decay.
8661af79 551ovs-appctl time/warp 5000 500
309d9dac 552BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic], [none], [up], [No Diagnostic])
01d18a3a
AW
553BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
554BFD_CHECK_RX([p0], [1000ms], [1000ms], [500ms])
555
556# stop the bfd on one side.
557AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=false], [0])
3688ce7a
AW
558
559# advance clock by 4000ms, while receiving packets.
560# the STATE should go DOWN, due to Control Detection Time Expired.
561# but forwarding flag should be still true.
562for i in `seq 0 7`
01d18a3a
AW
563do
564 ovs-appctl time/warp 500
01d18a3a
AW
565 AT_CHECK([ovs-ofctl packet-out br1 3 2 "90e2ba01475000101856b2e80806000108000604000100101856b2e80202020300000000000002020202"],
566 [0], [stdout], [])
567done
01d18a3a
AW
568BFD_CHECK([p0], [true], [false], [none], [down], [Control Detection Time Expired], [none], [down], [No Diagnostic])
569
570# receive packet at 1/100ms rate for 1000ms.
571for i in `seq 0 9`
572do
573 AT_CHECK([ovs-ofctl packet-out br1 3 2 "90e2ba01475000101856b2e80806000108000604000100101856b2e80202020300000000000002020202"],
574 [0], [stdout], [])
575 ovs-appctl time/warp 100
576 # the forwarding flag should always be true during this time.
577 BFD_CHECK([p0], [true], [false], [none], [down], [Control Detection Time Expired], [none], [down], [No Diagnostic])
578done
579
309d9dac 580# stop receiving for 5000ms.
8661af79 581ovs-appctl time/warp 5000 100
01d18a3a
AW
582BFD_CHECK([p0], [false], [false], [none], [down], [Control Detection Time Expired], [none], [down], [No Diagnostic])
583
584# reset bfd forwarding_if_rx.
585AT_CHECK([ovs-vsctl set Interface p0 bfd:forwarding_if_rx=false])
01d18a3a 586BFD_CHECK([p0], [false], [false], [none], [down], [Control Detection Time Expired], [none], [down], [No Diagnostic])
01d18a3a
AW
587# re-enable bfd forwarding_if_rx.
588AT_CHECK([ovs-vsctl set Interface p0 bfd:forwarding_if_rx=true])
01d18a3a 589BFD_CHECK([p0], [false], [false], [none], [down], [Control Detection Time Expired], [none], [down], [No Diagnostic])
01d18a3a
AW
590
591# re-enable bfd on the other end. the states should be up.
592AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=true bfd:min_tx=300 bfd:min_rx=300])
593# advance the clock, to stablize the states.
8661af79 594ovs-appctl time/warp 10000 500
01d18a3a
AW
595BFD_CHECK([p0], [true], [false], [none], [up], [Control Detection Time Expired], [none], [up], [No Diagnostic])
596BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic], [none], [up], [Control Detection Time Expired])
597BFD_CHECK_TX([p0], [300ms], [300ms], [300ms])
598BFD_CHECK_RX([p0], [1000ms], [1000ms], [300ms])
599
600AT_CHECK([ovs-vsctl del-br br1], [0], [ignore])
2f2695a2 601OVS_VSWITCHD_STOP
4905e2df
AW
602AT_CLEANUP
603
34c88624
AW
604# forwarding_if_rx Test4
605# Test4 is for testing the demand_rx_bfd feature.
606# bfd is enabled on both ends of the link.
607AT_SETUP([bfd - bfd forwarding_if_rx - demand_rx_bfd])
608OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy -- \
609 add-port br1 p1 -- set Interface p1 type=patch \
610 options:peer=p0 ofport_request=2 -- \
611 add-port br0 p0 -- set Interface p0 type=patch \
612 options:peer=p1 ofport_request=1 -- \
613 set Interface p0 bfd:enable=true bfd:min_tx=300 bfd:min_rx=300 bfd:forwarding_if_rx=true -- \
614 set Interface p1 bfd:enable=true bfd:min_tx=500 bfd:min_rx=500])
615
616ovs-appctl time/stop
617# advance the clock, to stablize the states.
8661af79 618ovs-appctl time/warp 10000 500
34c88624
AW
619BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic], [none], [up], [No Diagnostic])
620BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic], [none], [up], [No Diagnostic])
621BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
622
623# disable the bfd on p1.
624AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=false], [0])
625
626# advance clock by 4000ms, while receiving packets.
627# the STATE should go DOWN, due to Control Detection Time Expired.
628# but forwarding flag should be still true.
629for i in `seq 0 7`
630do
631 ovs-appctl time/warp 500
632 AT_CHECK([ovs-ofctl packet-out br1 3 2 "90e2ba01475000101856b2e80806000108000604000100101856b2e80202020300000000000002020202"],
633 [0], [stdout], [])
634done
635BFD_CHECK([p0], [true], [false], [none], [down], [Control Detection Time Expired], [none], [down], [No Diagnostic])
636
637# advance clock long enough to trigger the demand_bfd_rx interval
638# (100 * bfd->cfm_min_rx), forwarding flag should go down since there
639# is no bfd control packet received during the demand_rx_bfd.
640for i in `seq 0 120`
641do
642 ovs-appctl time/warp 300
643 AT_CHECK([ovs-ofctl packet-out br1 3 2 "90e2ba01475000101856b2e80806000108000604000100101856b2e80202020300000000000002020202"],
644 [0], [stdout], [])
645done
646BFD_CHECK([p0], [false], [false], [none], [down], [Control Detection Time Expired], [none], [down], [No Diagnostic])
647
648# now enable the bfd on p1 again.
649AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=true], [0])
650# advance clock by 5000ms. and p1 and p0 should be all up.
8661af79 651ovs-appctl time/warp 5000 500
34c88624
AW
652BFD_CHECK([p0], [true], [false], [none], [up], [Control Detection Time Expired], [none], [up], [No Diagnostic])
653BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic], [none], [up], [Control Detection Time Expired])
654BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
655
656# disable the bfd on p1 again.
657AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=false], [0])
658# advance clock long enough to trigger the demand_rx_bfd,
659# forwarding flag should go down since there is no bfd control packet
660# received during the demand_rx_bfd.
661for i in `seq 0 120`
662do
663 ovs-appctl time/warp 300
664 AT_CHECK([ovs-ofctl packet-out br1 3 2 "90e2ba01475000101856b2e80806000108000604000100101856b2e80202020300000000000002020202"],
665 [0], [stdout], [])
666done
667BFD_CHECK([p0], [false], [false], [none], [down], [Control Detection Time Expired], [none], [down], [No Diagnostic])
668
669AT_CHECK([ovs-vsctl del-br br1], [0], [ignore])
2f2695a2 670OVS_VSWITCHD_STOP
34c88624
AW
671AT_CLEANUP
672
4905e2df 673# test bfd:flap_count.
309d9dac
AW
674# This test contains three part:
675# part 1. tests the flap_count on normal bfd monitored link.
676# part 2. tests the flap_count when forwarding override is used.
677# part 3. tests the flap_count when forwarding_if_rx is enabled.
4905e2df
AW
678AT_SETUP([bfd - flap_count])
679#Create 2 bridges connected by patch ports and enable bfd
680OVS_VSWITCHD_START([add-br br1 -- \
681 set bridge br1 datapath-type=dummy \
682 other-config:hwaddr=aa:55:aa:56:00:00 -- \
683 add-port br1 p1 -- set Interface p1 type=patch \
684 options:peer=p0 ofport_request=2 -- \
685 add-port br0 p0 -- set Interface p0 type=patch \
686 options:peer=p1 ofport_request=1 -- \
687 set Interface p0 bfd:enable=true bfd:min_tx=100 bfd:min_rx=100 -- \
688 set Interface p1 bfd:enable=true bfd:min_tx=100 bfd:min_rx=100])
689
690ovs-appctl time/stop
5eca22a2
AW
691# Disable the stats update to prevent the race between ovsdb updating
692# stats and ovs-vsctl cmd closing the jsonrpc session.
693AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:stats-update-interval=50000000])
4905e2df
AW
694
695# Part-1 wait for a while to stablize bfd.
8661af79 696ovs-appctl time/warp 10100 100
4905e2df
AW
697BFD_CHECK([p0], [true], [false], [none], [up], [No Diagnostic], [none], [up], [No Diagnostic])
698BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic], [none], [up], [No Diagnostic])
699BFD_CHECK_TX([p0], [100ms], [100ms], [100ms])
700BFD_CHECK_RX([p0], [100ms], [100ms], [100ms])
701# both p0 and p1 should have flap_count = "1". since down->up.
702BFD_VSCTL_LIST_IFACE([p0], ["s/^.*flap_count=\(.*\), forwarding.*$/\1/p"], ["1"])
703BFD_VSCTL_LIST_IFACE([p1], ["s/^.*flap_count=\(.*\), forwarding.*$/\1/p"], ["1"])
704
705# turn bfd on p1 off, should increment the bfd:flap_count on p0.
706AT_CHECK([ovs-vsctl set interface p1 bfd:enable=false])
8661af79 707ovs-appctl time/warp 5000 100
4905e2df
AW
708BFD_CHECK([p0], [false], [false], [none], [down], [Control Detection Time Expired], [none], [down], [No Diagnostic])
709BFD_VSCTL_LIST_IFACE([p0], ["s/^.*flap_count=\(.*\), forwarding.*$/\1/p"], ["2"])
710AT_CHECK([ovs-vsctl list interface p1 | sed -n "s/^.*flap_count=\(.*\), forwarding.*$/\1/p"])
711
712# turn bfd on p1 on again, should increment the bfd:flap_count on p0.
713# p1 should still have flap_count = "1", since it is reset.
714AT_CHECK([ovs-vsctl set interface p1 bfd:enable=true])
8661af79 715ovs-appctl time/warp 5000 100
4905e2df
AW
716BFD_VSCTL_LIST_IFACE([p0], ["s/^.*flap_count=\(.*\), forwarding.*$/\1/p"], ["3"])
717BFD_VSCTL_LIST_IFACE([p1], ["s/^.*flap_count=\(.*\), forwarding.*$/\1/p"], ["1"])
718
719
720# Part-2 now turn on the forwarding_override.
721AT_CHECK([ovs-appctl bfd/set-forwarding p0 true], [0], [dnl
722OK
723])
724
725# turn bfd on p1 off, should not increment the bfd:flap_count on p0, since forwarding_override is on.
726AT_CHECK([ovs-vsctl set interface p1 bfd:enable=false])
8661af79 727ovs-appctl time/warp 5000 100
4905e2df
AW
728BFD_CHECK([p0], [true], [false], [none], [down], [Control Detection Time Expired], [none], [down], [No Diagnostic])
729BFD_VSCTL_LIST_IFACE([p0], ["s/^.*flap_count=\(.*\), forwarding.*$/\1/p"], ["3"])
730AT_CHECK([ovs-vsctl list interface p1 | sed -n "s/^.*flap_count=\(.*\), forwarding.*$/\1/p"])
731
732# turn bfd on p1 on again, should not increment the bfd:flap_count on p0, since forwarding override is on.
733# p1 should still have flap_count = "1", since it is reset.
734AT_CHECK([ovs-vsctl set interface p1 bfd:enable=true])
8661af79 735ovs-appctl time/warp 5000 100
4905e2df
AW
736BFD_VSCTL_LIST_IFACE([p0], ["s/^.*flap_count=\(.*\), forwarding.*$/\1/p"], ["3"])
737BFD_VSCTL_LIST_IFACE([p1], ["s/^.*flap_count=\(.*\), forwarding.*$/\1/p"], ["1"])
738
739# turn the forwarding_override back to normal.
740AT_CHECK([ovs-appctl bfd/set-forwarding p0 normal], [0], [dnl
741OK
742])
743
744# turn bfd on p1 off and on, should increment the bfd:flap_count on p0.
745AT_CHECK([ovs-vsctl set interface p1 bfd:enable=false])
8661af79 746ovs-appctl time/warp 5000 100
4905e2df 747AT_CHECK([ovs-vsctl set interface p1 bfd:enable=true])
8661af79 748ovs-appctl time/warp 5000 100
4905e2df
AW
749BFD_VSCTL_LIST_IFACE([p0], ["s/^.*flap_count=\(.*\), forwarding.*$/\1/p"], ["5"])
750BFD_VSCTL_LIST_IFACE([p1], ["s/^.*flap_count=\(.*\), forwarding.*$/\1/p"], ["1"])
751
752# Part-3 now turn on forwarding_if_rx.
753AT_CHECK([ovs-vsctl set Interface p0 bfd:forwarding_if_rx=true], [0])
8661af79 754ovs-appctl time/warp 1100 100
4905e2df
AW
755# disable the bfd on p1.
756AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=false], [0])
757
758# advance clock by 4000ms, while receiving packets.
759# the STATE should go DOWN, due to Control Detection Time Expired.
760# but forwarding flag should be true.
761for i in `seq 0 39`
762do
763 ovs-appctl time/warp 100
764 AT_CHECK([ovs-ofctl packet-out br1 3 2 "90e2ba01475000101856b2e80806000108000604000100101856b2e80202020300000000000002020202"],
765 [0], [stdout], [])
766done
767BFD_CHECK([p0], [true], [false], [none], [down], [Control Detection Time Expired], [none], [down], [No Diagnostic])
768# flap_count should remain unchanged.
769BFD_VSCTL_LIST_IFACE([p0], ["s/^.*flap_count=\(.*\), forwarding.*$/\1/p"], ["5"])
770
34c88624 771# stop the traffic for more than 100 * bfd->cfm_min_rx ms, the forwarding flag of p0 should turn false.
4905e2df 772# and there should be the increment of flap_count.
8661af79 773ovs-appctl time/warp 12100 100
4905e2df
AW
774BFD_CHECK([p0], [false], [false], [none], [down], [Control Detection Time Expired], [none], [down], [No Diagnostic])
775BFD_VSCTL_LIST_IFACE([p0], ["s/^.*flap_count=\(.*\), forwarding.*$/\1/p"], ["6"])
776
777# advance clock by 4000ms, and resume the traffic.
778for i in `seq 0 39`
779do
780 ovs-appctl time/warp 100
781 AT_CHECK([ovs-ofctl packet-out br1 3 2 "90e2ba01475000101856b2e80806000108000604000100101856b2e80202020300000000000002020202"],
782 [0], [stdout], [])
783done
34c88624 784# forwarding should be false, since there is still no bfd control packet received.
4905e2df 785BFD_CHECK([p0], [false], [false], [none], [down], [Control Detection Time Expired], [none], [down], [No Diagnostic])
34c88624 786BFD_VSCTL_LIST_IFACE([p0], ["s/^.*flap_count=\(.*\), forwarding.*$/\1/p"], ["6"])
4905e2df
AW
787
788# turn on the bfd on p1.
789AT_CHECK([ovs-vsctl set interface p1 bfd:enable=true])
8661af79 790ovs-appctl time/warp 5000 100
4905e2df 791# even though there is no data traffic, since p1 bfd is on again, should increment the flap_count.
34c88624 792BFD_VSCTL_LIST_IFACE([p0], ["s/^.*flap_count=\(.*\), forwarding.*$/\1/p"], ["7"])
4905e2df
AW
793BFD_VSCTL_LIST_IFACE([p1], ["s/^.*flap_count=\(.*\), forwarding.*$/\1/p"], ["1"])
794
795OVS_VSWITCHD_STOP
8661af79 796AT_CLEANUP