]> git.proxmox.com Git - mirror_ovs.git/blame - tests/cfm.at
datapath-windows: Add software checksums for nbl which contain multiple nb
[mirror_ovs.git] / tests / cfm.at
CommitLineData
03f209ba
AW
1AT_BANNER([cfm])
2
3m4_define([CFM_CHECK_EXTENDED], [
4AT_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 ----
7MPID $2: extended
8 average health: $3
9 opstate: $4
10 remote_opstate: $5
11 interval: $6
12Remote MPID $7
13 opstate: $8
14])
15])
16
5767a79a
AW
17m4_define([CFM_CHECK_EXTENDED_FAULT], [
18AT_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 ----
21MPID $2: extended
22 fault: $3
23 average health: $4
24 opstate: $5
25 remote_opstate: $6
26 interval: $7
27])
28])
29
76c4290d 30m4_define([CFM_VSCTL_LIST_IFACE], [
7fcd0037 31AT_CHECK([ovs-vsctl list interface $1 | sed -n '/$2 /p'],[0],
76c4290d
AW
32[dnl
33$3
34])
35])
36
5bb8a630 37m4_define([CFM_CHECK_DB], [
7fcd0037
AW
38CFM_VSCTL_LIST_IFACE([$1], [cfm_fault], [cfm_fault : $2])
39CFM_VSCTL_LIST_IFACE([$1], [cfm_fault_status], [cfm_fault_status : [[$3]]])
40CFM_VSCTL_LIST_IFACE([$1], [cfm_flap_count], [cfm_flap_count : $4])
41CFM_VSCTL_LIST_IFACE([$1], [cfm_health], [cfm_health : [[$5]]])
42CFM_VSCTL_LIST_IFACE([$1], [cfm_remote_mpids], [cfm_remote_mpids : [[$6]]])
43CFM_VSCTL_LIST_IFACE([$1], [cfm_remote_opstate], [cfm_remote_opstate : $7])
5bb8a630
AW
44])
45
7fcd0037
AW
46# These two tests check the update of cfm status at different scenarios.
47
48# Test cfm status update at startup and removal.
49AT_SETUP([cfm - check update ovsdb 1])
50OVS_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
54ovs-appctl time/stop
55
56AT_CHECK([ovs-vsctl set Interface p0 cfm_mpid=1])
57# at beginning, since the first fault check timeout is not reached
58# cfm_fault should be false.
59for i in `seq 0 4`; do
60 ovs-appctl time/warp 100
61 CFM_CHECK_DB([p0], [false], [], [0], [], [], [up])
62done
63
64# advance clock to pass the fault check timeout and check cfm
65# status update in OVSDB.
8661af79 66ovs-appctl time/warp 1500 100
7fcd0037
AW
67CFM_CHECK_DB([p0], [true], [recv], [1], [], [], [up])
68
69# remove the cfm on p0 and status should be all empty.
70AT_CHECK([ovs-vsctl remove int p0 cfm_mpid 1])
8661af79 71ovs-appctl time/warp 500 100
7fcd0037
AW
72CFM_CHECK_DB([p0], [[[]]], [], [[[]]], [], [], [[[]]])
73
74OVS_VSWITCHD_STOP
75AT_CLEANUP
76
77# Test cfm status update in normal case.
78AT_SETUP([cfm - check update ovsdb 2])
5bb8a630
AW
79#Create 2 bridges connected by patch ports and enable cfm
80OVS_VSWITCHD_START([add-br br1 -- \
81 set bridge br1 datapath-type=dummy \
82 other-config:hwaddr=aa:55:aa:56:00:00 -- \
83 add-port br1 p1 -- set Interface p1 type=patch \
84 options:peer=p0 -- \
85 add-port br0 p0 -- set Interface p0 type=patch \
86 options:peer=p1 -- \
87 set Interface p0 other_config:cfm_interval=300 other_config:cfm_extended=true -- \
88 set Interface p1 other_config:cfm_interval=300 other_config:cfm_extended=true])
89
90ovs-appctl time/stop
91
92AT_CHECK([ovs-vsctl set Interface p0 cfm_mpid=1])
93# check cfm status update in OVSDB.
8661af79 94ovs-appctl time/warp 1500 100
7fcd0037 95CFM_CHECK_DB([p0], [true], [recv], [1], [], [], [up])
5bb8a630 96
7fcd0037 97# turn cfm on p1 on, cfm status of p0 and p1 should all go up.
5bb8a630 98AT_CHECK([ovs-vsctl set interface p1 cfm_mpid=2])
8661af79 99ovs-appctl time/warp 1500 100
7fcd0037
AW
100CFM_CHECK_DB([p0], [false], [], [2], [], [2], [up])
101CFM_CHECK_DB([p1], [false], [], [0], [], [1], [up])
102
103# turn cfm on p1 off, cfm status of p0 should go down again.
104AT_CHECK([ovs-vsctl remove int p1 cfm_mpid 2])
8661af79 105ovs-appctl time/warp 1500 100
7fcd0037 106CFM_CHECK_DB([p0], [true], [recv], [3], [], [], [up])
5bb8a630
AW
107
108OVS_VSWITCHD_STOP
109AT_CLEANUP
110
03f209ba
AW
111# test cfm under demand mode.
112AT_SETUP([cfm - demand mode])
76c4290d 113#Create 2 bridges connected by patch ports and enable cfm
03f209ba
AW
114OVS_VSWITCHD_START([add-br br1 -- \
115 set bridge br1 datapath-type=dummy \
116 other-config:hwaddr=aa:55:aa:56:00:00 -- \
117 add-port br1 p1 -- set Interface p1 type=patch \
118 options:peer=p0 -- \
119 add-port br0 p0 -- set Interface p0 type=patch \
120 options:peer=p1 -- \
121 set Interface p0 cfm_mpid=1 other_config:cfm_interval=300 other_config:cfm_extended=true -- \
122 set Interface p1 cfm_mpid=2 other_config:cfm_interval=300 other_config:cfm_extended=true ])
123
124ovs-appctl time/stop
125# wait for a while to stablize cfm.
8661af79 126ovs-appctl time/warp 10100 100
03f209ba
AW
127CFM_CHECK_EXTENDED([p0], [1], [100], [up], [up], [300ms], [2], [up])
128CFM_CHECK_EXTENDED([p1], [2], [100], [up], [up], [300ms], [1], [up])
129
130# turn on demand mode on one end.
131AT_CHECK([ovs-vsctl set interface p0 other_config:cfm_demand=true])
132
133# cfm should never go down.
134for i in `seq 0 100`
135do
136 ovs-appctl time/warp 100
137 CFM_CHECK_EXTENDED([p0], [1], [100], [up], [up], [300ms], [2], [up])
138 CFM_CHECK_EXTENDED([p1], [2], [100], [up], [up], [300ms], [1], [up])
139done
140
141# turn on demand mode on the other end.
142AT_CHECK([ovs-vsctl set interface p1 other_config:cfm_demand=true])
143for i in `seq 0 100`
144do
145 ovs-appctl time/warp 100
146 CFM_CHECK_EXTENDED([p0], [1], [100], [up], [up], [300ms], [2], [up])
147 CFM_CHECK_EXTENDED([p1], [2], [100], [up], [up], [300ms], [1], [up])
148done
149
150OVS_VSWITCHD_STOP
151AT_CLEANUP
76c4290d 152
5767a79a
AW
153# test demand_rx_ccm under demand mode.
154AT_SETUP([cfm - demand_rx_ccm])
155#Create 2 bridges connected by patch ports and enable cfm
156OVS_VSWITCHD_START([add-br br1 -- \
157 set bridge br1 datapath-type=dummy \
158 other-config:hwaddr=aa:55:aa:56:00:00 -- \
159 add-port br1 p1 -- set Interface p1 type=patch \
160 options:peer=p0 ofport_request=2 -- \
161 add-port br0 p0 -- set Interface p0 type=patch \
162 options:peer=p1 ofport_request=1 -- \
163 set Interface p0 cfm_mpid=1 other_config:cfm_interval=300 other_config:cfm_extended=true other_config:cfm_demand=true -- \
164 set Interface p1 cfm_mpid=2 other_config:cfm_interval=300 other_config:cfm_extended=true other_config:cfm_demand=true])
165
166ovs-appctl time/stop
167# wait for a while to stablize cfm. (need a longer time, since in demand mode
168# the fault interval is (MAX(ccm_interval_ms, 500) * 3.5) ms)
8661af79 169ovs-appctl time/warp 20100 100
5767a79a
AW
170CFM_CHECK_EXTENDED([p0], [1], [100], [up], [up], [300ms], [2], [up])
171CFM_CHECK_EXTENDED([p1], [2], [100], [up], [up], [300ms], [1], [up])
172
173# turn off the cfm on p1.
174AT_CHECK([ovs-vsctl clear Interface p1 cfm_mpid])
175# cfm should never go down while receiving data packets.
176for i in `seq 0 200`
177do
178 ovs-appctl time/warp 100
6dd3c787 179 AT_CHECK([ovs-ofctl packet-out br1 "in_port=3 packet=90e2ba01475000101856b2e80806000108000604000100101856b2e80202020300000000000002020202 actions=2"],
5767a79a
AW
180 [0], [stdout], [])
181done
182CFM_CHECK_EXTENDED([p0], [1], [0], [up], [up], [300ms], [2], [up])
183
184# wait longer, since the demand_rx_ccm interval is 100 * 300 ms.
185# since there is no ccm received, the [recv] fault should be raised.
186for i in `seq 0 200`
187do
188 ovs-appctl time/warp 100
6dd3c787 189 AT_CHECK([ovs-ofctl packet-out br1 "in_port=3 packet=90e2ba01475000101856b2e80806000108000604000100101856b2e80202020300000000000002020202 actions=2"],
5767a79a
AW
190 [0], [stdout], [])
191done
192CFM_CHECK_EXTENDED_FAULT([p0], [1], [recv], [0], [up], [up], [300ms])
193
194# now turn on the cfm on p1 again,
195AT_CHECK([ovs-vsctl set Interface p1 cfm_mpid=2])
196# cfm should be up for both p0 and p1
8661af79 197ovs-appctl time/warp 20100 100
5767a79a
AW
198CFM_CHECK_EXTENDED([p0], [1], [100], [up], [up], [300ms], [2], [up])
199CFM_CHECK_EXTENDED([p1], [2], [100], [up], [up], [300ms], [1], [up])
200
201# now turn off the cfm on p1 again
202AT_CHECK([ovs-vsctl clear Interface p1 cfm_mpid])
203# since there is no ccm received, the [recv] fault should be raised.
204for i in `seq 0 400`
205do
206 ovs-appctl time/warp 100
6dd3c787 207 AT_CHECK([ovs-ofctl packet-out br1 "in_port=3 packet=90e2ba01475000101856b2e80806000108000604000100101856b2e80202020300000000000002020202 actions=2"],
5767a79a
AW
208 [0], [stdout], [])
209done
210CFM_CHECK_EXTENDED_FAULT([p0], [1], [recv], [0], [up], [up], [300ms])
211
212OVS_VSWITCHD_STOP
213AT_CLEANUP
214
76c4290d
AW
215# test cfm_flap_count.
216AT_SETUP([cfm - flap_count])
217#Create 2 bridges connected by patch ports and enable cfm
218OVS_VSWITCHD_START([add-br br1 -- \
219 set bridge br1 datapath-type=dummy \
220 other-config:hwaddr=aa:55:aa:56:00:00 -- \
221 add-port br1 p1 -- set Interface p1 type=patch \
222 options:peer=p0 -- \
223 add-port br0 p0 -- set Interface p0 type=patch \
224 options:peer=p1 -- \
225 set Interface p0 cfm_mpid=1 other_config:cfm_interval=100 other_config:cfm_extended=true -- \
226 set Interface p1 cfm_mpid=2 other_config:cfm_interval=100 other_config:cfm_extended=true])
227
228ovs-appctl time/stop
229
230# wait for a while to stablize cfm.
8661af79 231ovs-appctl time/warp 10100 100
76c4290d
AW
232CFM_CHECK_EXTENDED([p0], [1], [100], [up], [up], [100ms], [2], [up])
233CFM_CHECK_EXTENDED([p1], [2], [100], [up], [up], [100ms], [1], [up])
234
881d47a9 235# turn cfm on p1 off, should increment the cfm_flap_count on p0.
76c4290d 236AT_CHECK([ovs-vsctl remove interface p1 cfm_mpid 2])
8661af79 237ovs-appctl time/warp 1100 100
76c4290d
AW
238CFM_VSCTL_LIST_IFACE([p0], [cfm_flap_count], [cfm_flap_count : 1])
239CFM_VSCTL_LIST_IFACE([p1], [cfm_flap_count], [cfm_flap_count : [[]]])
240
881d47a9 241# turn cfm on p1 on again, should increment the cfm_flap_count on p0.
76c4290d 242AT_CHECK([ovs-vsctl set interface p1 cfm_mpid=2])
8661af79 243ovs-appctl time/warp 1100 100
76c4290d 244CFM_VSCTL_LIST_IFACE([p0], [cfm_flap_count], [cfm_flap_count : 2])
76c4290d 245
45ebaaf5
JS
246OVS_VSWITCHD_STOP
247AT_CLEANUP
248
249AT_SETUP([cfm - fault_override])
250OVS_VSWITCHD_START([add-br br1 -- \
251 set bridge br1 datapath-type=dummy \
252 other-config:hwaddr=aa:55:aa:56:00:00 -- \
253 add-port br1 p1 -- set Interface p1 type=patch \
254 options:peer=p0 -- \
255 add-port br0 p0 -- set Interface p0 type=patch \
256 options:peer=p1 -- \
257 set Interface p0 cfm_mpid=1 other_config:cfm_interval=100 other_config:cfm_extended=true -- \
258 set Interface p1 cfm_mpid=2 other_config:cfm_interval=100 other_config:cfm_extended=true])
259
260ovs-appctl time/stop
261# wait for a while to stablize cfm.
8661af79 262ovs-appctl time/warp 10100 100
45ebaaf5
JS
263CFM_CHECK_EXTENDED([p0], [1], [100], [up], [up], [100ms], [2], [up])
264CFM_CHECK_EXTENDED([p1], [2], [100], [up], [up], [100ms], [1], [up])
265AT_CHECK([ovs-appctl cfm/show p1 | grep 'fault_override'], [1], [ignore])
266CFM_VSCTL_LIST_IFACE([p1], [cfm_fault_status], [cfm_fault_status : [[]]])
267
268# set a fault and see that this is shown in the CFM module and the database
269AT_CHECK([ovs-appctl cfm/set-fault p1 true], [0], [OK
270])
271AT_CHECK([ovs-appctl time/warp 100], [0], [ignore])
272AT_CHECK([ovs-appctl cfm/show p1 | grep 'fault_override' | sed -e 's/MPID [[0-9]]*: extended //'], [0], [dnl
273fault_override
274])
275CFM_VSCTL_LIST_IFACE([p1], [cfm_fault_status], [cfm_fault_status : [[override]]])
276
277# reset and see that it returned to normal
278AT_CHECK([ovs-appctl cfm/set-fault normal], [0], [OK
279])
280AT_CHECK([ovs-appctl time/warp 100], [0], [ignore])
281AT_CHECK([ovs-appctl cfm/show p1 | grep 'fault_override'], [1], [ignore])
282CFM_VSCTL_LIST_IFACE([p1], [cfm_fault_status], [cfm_fault_status : [[]]])
283
76c4290d 284OVS_VSWITCHD_STOP
8661af79 285AT_CLEANUP
67818616
MV
286
287AT_SETUP([cfm - check that CFM works together with RSTP])
288# Create br0 with interfaces p1
289# and br1 with interfaces p2
290# with p1 and p2 connected via unix domain socket
291OVS_VSWITCHD_START(
292 [set bridge br0 rstp_enable=true -- \
293 add-br br1 -- \
294 set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
295 set bridge br1 datapath-type=dummy -- \
296 set bridge br1 rstp_enable=true -- \
297])
298
299AT_CHECK([ovs-vsctl add-port br0 p0 -- \
300 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 -- \
301])
302
303AT_CHECK([ovs-vsctl add-port br1 p1 -- \
304 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 -- \
305])
306
307ovs-appctl time/stop
308ovs-appctl time/warp 10100 100
309
310# Forwarding should be true
311CFM_CHECK_EXTENDED([p0], [1], [100], [up], [up], [300ms], [2], [up])
312CFM_CHECK_EXTENDED([p1], [2], [100], [up], [up], [300ms], [1], [up])
313
314# Disable cfm on p1, cfm should receive fault.
315AT_CHECK([ovs-vsctl set interface p1 other_config:cfm_extended=false])
316
317ovs-appctl time/warp 5000 100
318CFM_CHECK_EXTENDED_FAULT([p0], [1], [recv], [0], [up], [up], [300ms])
319
320OVS_VSWITCHD_STOP
321AT_CLEANUP