]> git.proxmox.com Git - mirror_ovs.git/blob - tests/cfm.at
conntrack: Rename "master" connection to "parent" connection.
[mirror_ovs.git] / tests / cfm.at
1 AT_BANNER([cfm])
2
3 m4_define([CFM_CHECK_EXTENDED], [
4 AT_CHECK([ovs-appctl cfm/show $1 | sed -e '/next CCM tx:/d' | sed -e '/next fault check:/d' | sed -e '/recv since check:/d'],[0],
5 [dnl
6 ---- $1 ----
7 MPID $2: extended
8 average health: $3
9 opstate: $4
10 remote_opstate: $5
11 interval: $6
12 Remote MPID $7
13 opstate: $8
14 ])
15 ])
16
17 m4_define([CFM_CHECK_EXTENDED_FAULT], [
18 AT_CHECK([ovs-appctl cfm/show $1 | sed -e '/next CCM tx:/d' | sed -e '/next fault check:/d' | sed -e '/recv since check:/d'],[0],
19 [dnl
20 ---- $1 ----
21 MPID $2: extended
22 fault: $3
23 average health: $4
24 opstate: $5
25 remote_opstate: $6
26 interval: $7
27 ])
28 ])
29
30 m4_define([CFM_VSCTL_LIST_IFACE], [
31 AT_CHECK([ovs-vsctl list interface $1 | sed -n '/$2 /p'],[0],
32 [dnl
33 $3
34 ])
35 ])
36
37 m4_define([CFM_CHECK_DB], [
38 CFM_VSCTL_LIST_IFACE([$1], [cfm_fault], [cfm_fault : $2])
39 CFM_VSCTL_LIST_IFACE([$1], [cfm_fault_status], [cfm_fault_status : [[$3]]])
40 CFM_VSCTL_LIST_IFACE([$1], [cfm_flap_count], [cfm_flap_count : $4])
41 CFM_VSCTL_LIST_IFACE([$1], [cfm_health], [cfm_health : [[$5]]])
42 CFM_VSCTL_LIST_IFACE([$1], [cfm_remote_mpids], [cfm_remote_mpids : [[$6]]])
43 CFM_VSCTL_LIST_IFACE([$1], [cfm_remote_opstate], [cfm_remote_opstate : $7])
44 ])
45
46 # These two tests check the update of cfm status at different scenarios.
47
48 # Test cfm status update at startup and removal.
49 AT_SETUP([cfm - check update ovsdb 1])
50 OVS_VSWITCHD_START([add-port br0 p0 -- set Interface p0 type=gre \
51 options:remote_ip=1.2.3.4 -- \
52 set Interface p0 other_config:cfm_interval=300 other_config:cfm_extended=true])
53
54 ovs-appctl time/stop
55 AT_CHECK([ovs-appctl ofproto/list-tunnels], [0], [dnl
56 port 1: p0 (gre: ::->1.2.3.4, key=0, legacy_l2, dp port=1, ttl=64)
57 ])
58
59 AT_CHECK([ovs-vsctl set Interface p0 cfm_mpid=1])
60 # at beginning, since the first fault check timeout is not reached
61 # cfm_fault should be false.
62 for i in `seq 0 4`; do
63 ovs-appctl time/warp 100
64 CFM_CHECK_DB([p0], [false], [], [0], [], [], [up])
65 done
66
67 # advance clock to pass the fault check timeout and check cfm
68 # status update in OVSDB.
69 ovs-appctl time/warp 1500 100
70 CFM_CHECK_DB([p0], [true], [recv], [1], [], [], [up])
71
72 # remove the cfm on p0 and status should be all empty.
73 AT_CHECK([ovs-vsctl remove int p0 cfm_mpid 1])
74 ovs-appctl time/warp 500 100
75 CFM_CHECK_DB([p0], [[[]]], [], [[[]]], [], [], [[[]]])
76
77 OVS_VSWITCHD_STOP
78 AT_CLEANUP
79
80 # Test cfm status update in normal case.
81 AT_SETUP([cfm - check update ovsdb 2])
82 #Create 2 bridges connected by patch ports and enable cfm
83 OVS_VSWITCHD_START([add-br br1 -- \
84 set bridge br1 datapath-type=dummy \
85 other-config:hwaddr=aa:55:aa:56:00:00 -- \
86 add-port br1 p1 -- set Interface p1 type=patch \
87 options:peer=p0 -- \
88 add-port br0 p0 -- set Interface p0 type=patch \
89 options:peer=p1 -- \
90 set Interface p0 other_config:cfm_interval=300 other_config:cfm_extended=true -- \
91 set Interface p1 other_config:cfm_interval=300 other_config:cfm_extended=true])
92
93 ovs-appctl time/stop
94
95 AT_CHECK([ovs-vsctl set Interface p0 cfm_mpid=1])
96 # check cfm status update in OVSDB.
97 ovs-appctl time/warp 1500 100
98 CFM_CHECK_DB([p0], [true], [recv], [1], [], [], [up])
99
100 # turn cfm on p1 on, cfm status of p0 and p1 should all go up.
101 AT_CHECK([ovs-vsctl set interface p1 cfm_mpid=2])
102 ovs-appctl time/warp 1500 100
103 CFM_CHECK_DB([p0], [false], [], [2], [], [2], [up])
104 CFM_CHECK_DB([p1], [false], [], [0], [], [1], [up])
105
106 # turn cfm on p1 off, cfm status of p0 should go down again.
107 AT_CHECK([ovs-vsctl remove int p1 cfm_mpid 2])
108 ovs-appctl time/warp 1500 100
109 CFM_CHECK_DB([p0], [true], [recv], [3], [], [], [up])
110
111 OVS_VSWITCHD_STOP
112 AT_CLEANUP
113
114 # test cfm under demand mode.
115 AT_SETUP([cfm - demand mode])
116 #Create 2 bridges connected by patch ports and enable cfm
117 OVS_VSWITCHD_START([add-br br1 -- \
118 set bridge br1 datapath-type=dummy \
119 other-config:hwaddr=aa:55:aa:56:00:00 -- \
120 add-port br1 p1 -- set Interface p1 type=patch \
121 options:peer=p0 -- \
122 add-port br0 p0 -- set Interface p0 type=patch \
123 options:peer=p1 -- \
124 set Interface p0 cfm_mpid=1 other_config:cfm_interval=300 other_config:cfm_extended=true -- \
125 set Interface p1 cfm_mpid=2 other_config:cfm_interval=300 other_config:cfm_extended=true ])
126
127 ovs-appctl time/stop
128 # wait for a while to stablize cfm.
129 ovs-appctl time/warp 10100 100
130 CFM_CHECK_EXTENDED([p0], [1], [100], [up], [up], [300ms], [2], [up])
131 CFM_CHECK_EXTENDED([p1], [2], [100], [up], [up], [300ms], [1], [up])
132
133 # turn on demand mode on one end.
134 AT_CHECK([ovs-vsctl set interface p0 other_config:cfm_demand=true])
135
136 # cfm should never go down.
137 for i in `seq 0 100`
138 do
139 ovs-appctl time/warp 100
140 CFM_CHECK_EXTENDED([p0], [1], [100], [up], [up], [300ms], [2], [up])
141 CFM_CHECK_EXTENDED([p1], [2], [100], [up], [up], [300ms], [1], [up])
142 done
143
144 # turn on demand mode on the other end.
145 AT_CHECK([ovs-vsctl set interface p1 other_config:cfm_demand=true])
146 for i in `seq 0 100`
147 do
148 ovs-appctl time/warp 100
149 CFM_CHECK_EXTENDED([p0], [1], [100], [up], [up], [300ms], [2], [up])
150 CFM_CHECK_EXTENDED([p1], [2], [100], [up], [up], [300ms], [1], [up])
151 done
152
153 OVS_VSWITCHD_STOP
154 AT_CLEANUP
155
156 # test demand_rx_ccm under demand mode.
157 AT_SETUP([cfm - demand_rx_ccm])
158 #Create 2 bridges connected by patch ports and enable cfm
159 OVS_VSWITCHD_START([add-br br1 -- \
160 set bridge br1 datapath-type=dummy \
161 other-config:hwaddr=aa:55:aa:56:00:00 -- \
162 add-port br1 p1 -- set Interface p1 type=patch \
163 options:peer=p0 ofport_request=2 -- \
164 add-port br0 p0 -- set Interface p0 type=patch \
165 options:peer=p1 ofport_request=1 -- \
166 set Interface p0 cfm_mpid=1 other_config:cfm_interval=300 other_config:cfm_extended=true other_config:cfm_demand=true -- \
167 set Interface p1 cfm_mpid=2 other_config:cfm_interval=300 other_config:cfm_extended=true other_config:cfm_demand=true])
168
169 ovs-appctl time/stop
170 # wait for a while to stablize cfm. (need a longer time, since in demand mode
171 # the fault interval is (MAX(ccm_interval_ms, 500) * 3.5) ms)
172 ovs-appctl time/warp 20100 100
173 CFM_CHECK_EXTENDED([p0], [1], [100], [up], [up], [300ms], [2], [up])
174 CFM_CHECK_EXTENDED([p1], [2], [100], [up], [up], [300ms], [1], [up])
175
176 # turn off the cfm on p1.
177 AT_CHECK([ovs-vsctl clear Interface p1 cfm_mpid])
178 # cfm should never go down while receiving data packets.
179 for i in `seq 0 200`
180 do
181 ovs-appctl time/warp 100
182 AT_CHECK([ovs-ofctl packet-out br1 "in_port=3 packet=90e2ba01475000101856b2e80806000108000604000100101856b2e80202020300000000000002020202 actions=2"],
183 [0], [stdout], [])
184 done
185 CFM_CHECK_EXTENDED([p0], [1], [0], [up], [up], [300ms], [2], [up])
186
187 # wait longer, since the demand_rx_ccm interval is 100 * 300 ms.
188 # since there is no ccm received, the [recv] fault should be raised.
189 for i in `seq 0 200`
190 do
191 ovs-appctl time/warp 100
192 AT_CHECK([ovs-ofctl packet-out br1 "in_port=3 packet=90e2ba01475000101856b2e80806000108000604000100101856b2e80202020300000000000002020202 actions=2"],
193 [0], [stdout], [])
194 done
195 CFM_CHECK_EXTENDED_FAULT([p0], [1], [recv], [0], [up], [up], [300ms])
196
197 # now turn on the cfm on p1 again,
198 AT_CHECK([ovs-vsctl set Interface p1 cfm_mpid=2])
199 # cfm should be up for both p0 and p1
200 ovs-appctl time/warp 20100 100
201 CFM_CHECK_EXTENDED([p0], [1], [100], [up], [up], [300ms], [2], [up])
202 CFM_CHECK_EXTENDED([p1], [2], [100], [up], [up], [300ms], [1], [up])
203
204 # now turn off the cfm on p1 again
205 AT_CHECK([ovs-vsctl clear Interface p1 cfm_mpid])
206 # since there is no ccm received, the [recv] fault should be raised.
207 for i in `seq 0 400`
208 do
209 ovs-appctl time/warp 100
210 AT_CHECK([ovs-ofctl packet-out br1 "in_port=3 packet=90e2ba01475000101856b2e80806000108000604000100101856b2e80202020300000000000002020202 actions=2"],
211 [0], [stdout], [])
212 done
213 CFM_CHECK_EXTENDED_FAULT([p0], [1], [recv], [0], [up], [up], [300ms])
214
215 OVS_VSWITCHD_STOP
216 AT_CLEANUP
217
218 # test cfm_flap_count.
219 AT_SETUP([cfm - flap_count])
220 #Create 2 bridges connected by patch ports and enable cfm
221 OVS_VSWITCHD_START([add-br br1 -- \
222 set bridge br1 datapath-type=dummy \
223 other-config:hwaddr=aa:55:aa:56:00:00 -- \
224 add-port br1 p1 -- set Interface p1 type=patch \
225 options:peer=p0 -- \
226 add-port br0 p0 -- set Interface p0 type=patch \
227 options:peer=p1 -- \
228 set Interface p0 cfm_mpid=1 other_config:cfm_interval=100 other_config:cfm_extended=true -- \
229 set Interface p1 cfm_mpid=2 other_config:cfm_interval=100 other_config:cfm_extended=true])
230
231 ovs-appctl time/stop
232
233 # wait for a while to stablize cfm.
234 ovs-appctl time/warp 10100 100
235 CFM_CHECK_EXTENDED([p0], [1], [100], [up], [up], [100ms], [2], [up])
236 CFM_CHECK_EXTENDED([p1], [2], [100], [up], [up], [100ms], [1], [up])
237
238 # turn cfm on p1 off, should increment the cfm_flap_count on p0.
239 AT_CHECK([ovs-vsctl remove interface p1 cfm_mpid 2])
240 ovs-appctl time/warp 1100 100
241 CFM_VSCTL_LIST_IFACE([p0], [cfm_flap_count], [cfm_flap_count : 1])
242 CFM_VSCTL_LIST_IFACE([p1], [cfm_flap_count], [cfm_flap_count : [[]]])
243
244 # turn cfm on p1 on again, should increment the cfm_flap_count on p0.
245 AT_CHECK([ovs-vsctl set interface p1 cfm_mpid=2])
246 ovs-appctl time/warp 1100 100
247 CFM_VSCTL_LIST_IFACE([p0], [cfm_flap_count], [cfm_flap_count : 2])
248
249 OVS_VSWITCHD_STOP
250 AT_CLEANUP
251
252 AT_SETUP([cfm - fault_override])
253 OVS_VSWITCHD_START([add-br br1 -- \
254 set bridge br1 datapath-type=dummy \
255 other-config:hwaddr=aa:55:aa:56:00:00 -- \
256 add-port br1 p1 -- set Interface p1 type=patch \
257 options:peer=p0 -- \
258 add-port br0 p0 -- set Interface p0 type=patch \
259 options:peer=p1 -- \
260 set Interface p0 cfm_mpid=1 other_config:cfm_interval=100 other_config:cfm_extended=true -- \
261 set Interface p1 cfm_mpid=2 other_config:cfm_interval=100 other_config:cfm_extended=true])
262
263 ovs-appctl time/stop
264 # wait for a while to stablize cfm.
265 ovs-appctl time/warp 10100 100
266 CFM_CHECK_EXTENDED([p0], [1], [100], [up], [up], [100ms], [2], [up])
267 CFM_CHECK_EXTENDED([p1], [2], [100], [up], [up], [100ms], [1], [up])
268 AT_CHECK([ovs-appctl cfm/show p1 | grep 'fault_override'], [1], [ignore])
269 CFM_VSCTL_LIST_IFACE([p1], [cfm_fault_status], [cfm_fault_status : [[]]])
270
271 # set a fault and see that this is shown in the CFM module and the database
272 AT_CHECK([ovs-appctl cfm/set-fault p1 true], [0], [OK
273 ])
274 AT_CHECK([ovs-appctl time/warp 100], [0], [ignore])
275 AT_CHECK([ovs-appctl cfm/show p1 | grep 'fault_override' | sed -e 's/MPID [[0-9]]*: extended //'], [0], [dnl
276 fault_override
277 ])
278 CFM_VSCTL_LIST_IFACE([p1], [cfm_fault_status], [cfm_fault_status : [[override]]])
279
280 # reset and see that it returned to normal
281 AT_CHECK([ovs-appctl cfm/set-fault normal], [0], [OK
282 ])
283 AT_CHECK([ovs-appctl time/warp 100], [0], [ignore])
284 AT_CHECK([ovs-appctl cfm/show p1 | grep 'fault_override'], [1], [ignore])
285 CFM_VSCTL_LIST_IFACE([p1], [cfm_fault_status], [cfm_fault_status : [[]]])
286
287 OVS_VSWITCHD_STOP
288 AT_CLEANUP
289
290 AT_SETUP([cfm - check that CFM works together with RSTP])
291 # Create br0 with interfaces p1
292 # and br1 with interfaces p2
293 # with p1 and p2 connected via unix domain socket
294 OVS_VSWITCHD_START(
295 [set bridge br0 rstp_enable=true -- \
296 add-br br1 -- \
297 set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
298 set bridge br1 datapath-type=dummy -- \
299 set bridge br1 rstp_enable=true -- \
300 ])
301
302 AT_CHECK([ovs-vsctl add-port br0 p0 -- \
303 set interface p0 type=dummy options:pstream=punix:$OVS_RUNDIR/p0.sock cfm_mpid=1 other_config:cfm_interval=300 other_config:cfm_extended=true -- \
304 ])
305
306 AT_CHECK([ovs-vsctl add-port br1 p1 -- \
307 set interface p1 type=dummy options:stream=unix:$OVS_RUNDIR/p0.sock cfm_mpid=2 other_config:cfm_interval=300 other_config:cfm_extended=true -- \
308 ])
309
310 ovs-appctl time/stop
311 ovs-appctl time/warp 10100 100
312
313 # Forwarding should be true
314 CFM_CHECK_EXTENDED([p0], [1], [100], [up], [up], [300ms], [2], [up])
315 CFM_CHECK_EXTENDED([p1], [2], [100], [up], [up], [300ms], [1], [up])
316
317 # Disable cfm on p1, cfm should receive fault.
318 AT_CHECK([ovs-vsctl set interface p1 other_config:cfm_extended=false])
319
320 ovs-appctl time/warp 5000 100
321 CFM_CHECK_EXTENDED_FAULT([p0], [1], [recv], [0], [up], [up], [300ms])
322
323 OVS_VSWITCHD_STOP
324 AT_CLEANUP
325
326 # test cfm liveness propagation - OF1.3.
327 AT_SETUP([cfm - liveness propagation - OF1.3])
328 OVS_VSWITCHD_START
329 AT_CHECK([ovs-ofctl -O OpenFlow13 -P standard monitor br0 --detach --no-chdir --pidfile])
330 check_liveness () {
331 printf '\n\n--- check_liveness %d ---\n\n\n' $1
332 shift
333
334 echo >>expout "OFPT_PORT_STATUS (OF1.3): MOD: 1(p0): addr:
335 config: 0
336 state: $1
337 speed: 0 Mbps now, 0 Mbps max"
338
339 AT_CHECK(
340 [[sed '
341 s/ (xid=0x[0-9a-fA-F]*)//
342 s/ *duration.*//
343 s/addr:[0-9a-fA-F:]*/addr:/' < monitor.log|grep -A3 "MOD: 1(p0)"|grep -ve --]],
344 [0], [expout])
345 }
346 : > expout
347 ovs-appctl -t ovs-ofctl ofctl/barrier
348 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
349 # Set miss_send_len to 128, enabling port_status messages to our service connection.
350 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
351
352 #Create 2 bridges connected by patch ports and enable cfm
353 AT_CHECK([ovs-vsctl add-br br1 -- \
354 set bridge br1 datapath-type=dummy \
355 other-config:hwaddr=aa:55:aa:56:00:00 -- \
356 add-port br1 p1 -- set Interface p1 type=patch \
357 options:peer=p0 -- \
358 add-port br0 p0 -- set Interface p0 type=patch \
359 options:peer=p1])
360 check_liveness 1 LIVE
361
362 AT_CHECK([ovs-vsctl \
363 set Interface p0 cfm_mpid=1 other_config:cfm_interval=100 other_config:cfm_extended=true -- \
364 set Interface p1 cfm_mpid=2 other_config:cfm_interval=100 other_config:cfm_extended=true])
365 ovs-appctl time/stop
366 # wait for a while to stablize cfm.
367 ovs-appctl time/warp 10100 100
368 CFM_CHECK_EXTENDED([p0], [1], [100], [up], [up], [100ms], [2], [up])
369 CFM_CHECK_EXTENDED([p1], [2], [100], [up], [up], [100ms], [1], [up])
370
371 # turn cfm on p1 off, should increment the cfm_flap_count on p0.
372 AT_CHECK([ovs-vsctl remove interface p1 cfm_mpid 2])
373 ovs-appctl time/warp 1100 100
374 CFM_VSCTL_LIST_IFACE([p0], [cfm_flap_count], [cfm_flap_count : 1])
375 CFM_VSCTL_LIST_IFACE([p1], [cfm_flap_count], [cfm_flap_count : [[]]])
376 check_liveness 2 0
377
378 # turn cfm on p1 on again, should increment the cfm_flap_count on p0.
379 AT_CHECK([ovs-vsctl set interface p1 cfm_mpid=2])
380 ovs-appctl time/warp 1100 100
381 check_liveness 3 LIVE
382
383 CFM_VSCTL_LIST_IFACE([p0], [cfm_flap_count], [cfm_flap_count : 2])
384
385 OVS_VSWITCHD_STOP
386 AT_CLEANUP
387
388 # test cfm liveness propagation - OF1.4.
389 AT_SETUP([cfm - liveness propagation - OF1.4])
390 OVS_VSWITCHD_START
391 AT_CHECK([ovs-ofctl -O OpenFlow14 -P standard monitor br0 --detach --no-chdir --pidfile])
392 check_liveness () {
393 printf '\n\n--- check_liveness %d ---\n\n\n' $1
394 shift
395
396 echo >>expout "OFPT_PORT_STATUS (OF1.4): MOD: 1(p0): addr:
397 config: 0
398 state: $1
399 speed: 0 Mbps now, 0 Mbps max"
400
401 AT_CHECK(
402 [[sed '
403 s/ (xid=0x[0-9a-fA-F]*)//
404 s/ *duration.*//
405 s/addr:[0-9a-fA-F:]*/addr:/' < monitor.log|grep -A3 "MOD: 1(p0)"|grep -ve --]],
406 [0], [expout])
407 }
408 : > expout
409 ovs-appctl -t ovs-ofctl ofctl/barrier
410 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
411 # Set miss_send_len to 128, enabling port_status messages to our service connection.
412 ovs-appctl -t ovs-ofctl ofctl/send 0509000c0123456700000080
413
414 #Create 2 bridges connected by patch ports and enable cfm
415 AT_CHECK([ovs-vsctl add-br br1 -- \
416 set bridge br1 datapath-type=dummy \
417 other-config:hwaddr=aa:55:aa:56:00:00 -- \
418 add-port br1 p1 -- set Interface p1 type=patch \
419 options:peer=p0 -- \
420 add-port br0 p0 -- set Interface p0 type=patch \
421 options:peer=p1])
422 check_liveness 1 LIVE
423
424 AT_CHECK([ovs-vsctl \
425 set Interface p0 cfm_mpid=1 other_config:cfm_interval=100 other_config:cfm_extended=true -- \
426 set Interface p1 cfm_mpid=2 other_config:cfm_interval=100 other_config:cfm_extended=true])
427 ovs-appctl time/stop
428 # wait for a while to stablize cfm.
429 ovs-appctl time/warp 10100 100
430 CFM_CHECK_EXTENDED([p0], [1], [100], [up], [up], [100ms], [2], [up])
431 CFM_CHECK_EXTENDED([p1], [2], [100], [up], [up], [100ms], [1], [up])
432
433 # turn cfm on p1 off, should increment the cfm_flap_count on p0.
434 AT_CHECK([ovs-vsctl remove interface p1 cfm_mpid 2])
435 ovs-appctl time/warp 1100 100
436 CFM_VSCTL_LIST_IFACE([p0], [cfm_flap_count], [cfm_flap_count : 1])
437 CFM_VSCTL_LIST_IFACE([p1], [cfm_flap_count], [cfm_flap_count : [[]]])
438 check_liveness 2 0
439
440 # turn cfm on p1 on again, should increment the cfm_flap_count on p0.
441 AT_CHECK([ovs-vsctl set interface p1 cfm_mpid=2])
442 ovs-appctl time/warp 1100 100
443 check_liveness 3 LIVE
444
445 CFM_VSCTL_LIST_IFACE([p0], [cfm_flap_count], [cfm_flap_count : 2])
446
447 OVS_VSWITCHD_STOP
448 AT_CLEANUP
449
450 # test cfm liveness propagation - OF1.5.
451 AT_SETUP([cfm - liveness propagation - OF1.5])
452 OVS_VSWITCHD_START
453 AT_CHECK([ovs-ofctl -O OpenFlow15 -P standard monitor br0 --detach --no-chdir --pidfile])
454 check_liveness () {
455 printf '\n\n--- check_liveness %d ---\n\n\n' $1
456 shift
457
458 echo >>expout "OFPT_PORT_STATUS (OF1.5): MOD: 1(p0): addr:
459 config: 0
460 state: $1
461 speed: 0 Mbps now, 0 Mbps max"
462
463 AT_CHECK(
464 [[sed '
465 s/ (xid=0x[0-9a-fA-F]*)//
466 s/ *duration.*//
467 s/addr:[0-9a-fA-F:]*/addr:/' < monitor.log|grep -A3 "MOD: 1(p0)"|grep -ve --]],
468 [0], [expout])
469 }
470 : > expout
471 ovs-appctl -t ovs-ofctl ofctl/barrier
472 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
473 # Set miss_send_len to 128, enabling port_status messages to our service connection.
474 ovs-appctl -t ovs-ofctl ofctl/send 0609000c0123456700000080
475
476 #Create 2 bridges connected by patch ports and enable cfm
477 AT_CHECK([ovs-vsctl add-br br1 -- \
478 set bridge br1 datapath-type=dummy \
479 other-config:hwaddr=aa:55:aa:56:00:00 -- \
480 add-port br1 p1 -- set Interface p1 type=patch \
481 options:peer=p0 -- \
482 add-port br0 p0 -- set Interface p0 type=patch \
483 options:peer=p1])
484 check_liveness 1 LIVE
485
486 AT_CHECK([ovs-vsctl \
487 set Interface p0 cfm_mpid=1 other_config:cfm_interval=100 other_config:cfm_extended=true -- \
488 set Interface p1 cfm_mpid=2 other_config:cfm_interval=100 other_config:cfm_extended=true])
489 ovs-appctl time/stop
490 # wait for a while to stablize cfm.
491 ovs-appctl time/warp 10100 100
492 CFM_CHECK_EXTENDED([p0], [1], [100], [up], [up], [100ms], [2], [up])
493 CFM_CHECK_EXTENDED([p1], [2], [100], [up], [up], [100ms], [1], [up])
494
495 # turn cfm on p1 off, should increment the cfm_flap_count on p0.
496 AT_CHECK([ovs-vsctl remove interface p1 cfm_mpid 2])
497 ovs-appctl time/warp 1100 100
498 CFM_VSCTL_LIST_IFACE([p0], [cfm_flap_count], [cfm_flap_count : 1])
499 CFM_VSCTL_LIST_IFACE([p1], [cfm_flap_count], [cfm_flap_count : [[]]])
500 check_liveness 2 0
501
502 # turn cfm on p1 on again, should increment the cfm_flap_count on p0.
503 AT_CHECK([ovs-vsctl set interface p1 cfm_mpid=2])
504 ovs-appctl time/warp 1100 100
505 check_liveness 3 LIVE
506
507 CFM_VSCTL_LIST_IFACE([p0], [cfm_flap_count], [cfm_flap_count : 2])
508
509 OVS_VSWITCHD_STOP
510 AT_CLEANUP