]> git.proxmox.com Git - mirror_ovs.git/blame - tests/lacp.at
tests: Add missing banner.
[mirror_ovs.git] / tests / lacp.at
CommitLineData
742468d9
EJ
1AT_BANNER([lacp])
2
3AT_SETUP([lacp - config])
4OVS_VSWITCHD_START([\
5 add-port br0 p1 --\
6 set Port p1 lacp=active --\
7 set Interface p1 type=dummy ])
8
bf24a5f9
BP
9ovs-appctl time/stop
10ovs-appctl time/warp 100
11ovs-appctl time/warp 100
12ovs-appctl time/warp 100
13
a2a57624 14AT_CHECK([ovs-appctl lacp/show], [0], [dnl
742468d9
EJ
15---- p1 ----
16 status: active negotiated
17 sys_id: aa:55:aa:55:00:00
18 sys_priority: 65535
19 aggregation key: 1
20 lacp_time: slow
21
22slave: p1: expired attached
23 port_id: 1
24 port_priority: 65535
29985e75 25 may_enable: false
742468d9
EJ
26
27 actor sys_id: aa:55:aa:55:00:00
28 actor sys_priority: 65535
29 actor port_id: 1
30 actor port_priority: 65535
31 actor key: 1
32 actor state: activity synchronized collecting distributing expired
33
34 partner sys_id: 00:00:00:00:00:00
35 partner sys_priority: 0
36 partner port_id: 0
37 partner port_priority: 0
38 partner key: 0
39 partner state: timeout
40])
a2a57624 41AT_CHECK([ovs-appctl bond/show])
742468d9
EJ
42OVS_VSWITCHD_STOP
43AT_CLEANUP
44
a2a57624 45AT_SETUP([lacp - multi port config])
742468d9
EJ
46OVS_VSWITCHD_START([dnl
47 add-bond br0 bond p1 p2 --\
1f76f3b7 48 set Port bond lacp=active bond-mode=active-backup \
742468d9
EJ
49 other_config:lacp-time="fast" \
50 other_config:lacp-system-id=11:22:33:44:55:66 \
51 other_config:lacp-system-priority=54321 --\
52 set Interface p1 type=dummy \
53 other_config:lacp-port-id=11 \
54 other_config:lacp-port-priority=111 \
55 other_config:lacp-aggregation-key=3333 --\
56 set Interface p2 type=dummy \
57 other_config:lacp-port-id=22 \
58 other_config:lacp-port-priority=222 \
59 other_config:lacp-aggregation-key=3333 ])
60
bf24a5f9
BP
61ovs-appctl time/stop
62ovs-appctl time/warp 100
63ovs-appctl time/warp 100
64ovs-appctl time/warp 100
65
742468d9
EJ
66AT_CHECK([ovs-appctl lacp/show], [0], [stdout])
67AT_CHECK([sed -e 's/aggregation key:.*/aggregation key: <omitted>/' < stdout], [0], [dnl
68---- bond ----
69 status: active negotiated
70 sys_id: 11:22:33:44:55:66
71 sys_priority: 54321
72 aggregation key: <omitted>
73 lacp_time: fast
74
75slave: p1: expired attached
76 port_id: 11
77 port_priority: 111
29985e75 78 may_enable: false
742468d9
EJ
79
80 actor sys_id: 11:22:33:44:55:66
81 actor sys_priority: 54321
82 actor port_id: 11
83 actor port_priority: 111
84 actor key: 3333
85 actor state: activity timeout aggregation synchronized collecting distributing expired
86
87 partner sys_id: 00:00:00:00:00:00
88 partner sys_priority: 0
89 partner port_id: 0
90 partner port_priority: 0
91 partner key: 0
92 partner state: timeout
93
94slave: p2: expired attached
95 port_id: 22
96 port_priority: 222
29985e75 97 may_enable: false
742468d9
EJ
98
99 actor sys_id: 11:22:33:44:55:66
100 actor sys_priority: 54321
101 actor port_id: 22
102 actor port_priority: 222
103 actor key: 3333
104 actor state: activity timeout aggregation synchronized collecting distributing expired
105
106 partner sys_id: 00:00:00:00:00:00
107 partner sys_priority: 0
108 partner port_id: 0
109 partner port_priority: 0
110 partner key: 0
111 partner state: timeout
112])
a2a57624
EJ
113AT_CHECK([ovs-appctl bond/show], [0], [dnl
114---- bond ----
115bond_mode: active-backup
116bond-hash-basis: 0
117updelay: 0 ms
118downdelay: 0 ms
bdebeece 119lacp_status: negotiated
a2a57624
EJ
120
121slave p1: disabled
122 may_enable: false
123
124slave p2: disabled
125 may_enable: false
126
127])
742468d9
EJ
128OVS_VSWITCHD_STOP
129AT_CLEANUP
f72f0c47
BP
130
131AT_SETUP([lacp - negotiation])
132# Create bond0 on br0 with interfaces p0 and p1
133# and bond1 on br1 with interfaces p2 and p3
134# with p0 patched to p2 and p1 patched to p3.
135OVS_VSWITCHD_START(
136 [add-bond br0 bond0 p0 p1 bond_mode=balance-tcp lacp=active \
137 other-config:lacp-time=fast \
138 other-config:bond-rebalance-interval=0 -- \
b369c233
BP
139 set interface p0 type=patch options:peer=p2 ofport_request=1 \
140 other-config:lacp-aggregation-key=2 -- \
141 set interface p1 type=patch options:peer=p3 ofport_request=2 \
142 other-config:lacp-aggregation-key=2 -- \
f72f0c47
BP
143 add-br br1 -- \
144 set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
145 set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
146 fail-mode=secure -- \
147 add-bond br1 bond1 p2 p3 bond_mode=balance-tcp lacp=active \
148 other-config:lacp-time=fast \
149 other-config:bond-rebalance-interval=0 -- \
b369c233
BP
150 set interface p2 type=patch options:peer=p0 ofport_request=3 \
151 other-config:lacp-aggregation-key=4 -- \
152 set interface p3 type=patch options:peer=p1 ofport_request=4 \
153 other-config:lacp-aggregation-key=4 --])
f72f0c47
BP
154
155AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
156])
157
8e63fd14
BP
158ovs-appctl time/stop
159
f72f0c47
BP
160# Wait for up to 5 (simulated) seconds, until LACP negotiation finishes.
161i=0
162while :; do
163 ovs-appctl lacp/show bond0 > bond0
164 AT_CAPTURE_FILE([bond0])
165 ovs-appctl lacp/show bond1 > bond1
166 AT_CAPTURE_FILE([bond1])
167 if grep negotiated bond0 && grep negotiated bond1; then
168 if grep expired bond0 || grep expired bond1; then
169 :
170 else
171 break
172 fi
173 fi
174 i=`expr $i + 1`
175 if test $i = 50; then
176 AT_FAIL_IF([:])
177 fi
178 ovs-appctl time/warp 100
179done
180
181# Now check the correctly negotiated configuration.
182AT_CHECK(
183 [ovs-appctl lacp/show bond0
184ovs-appctl lacp/show bond1
185ovs-appctl bond/show bond0
186ovs-appctl bond/show bond1], [0], [stdout])
187AT_CHECK([sed '/active slave/d' stdout], [0], [dnl
188---- bond0 ----
189 status: active negotiated
190 sys_id: aa:55:aa:55:00:00
191 sys_priority: 65534
192 aggregation key: 2
193 lacp_time: fast
194
195slave: p0: current attached
196 port_id: 1
197 port_priority: 65535
198 may_enable: true
199
200 actor sys_id: aa:55:aa:55:00:00
201 actor sys_priority: 65534
202 actor port_id: 1
203 actor port_priority: 65535
204 actor key: 2
205 actor state: activity timeout aggregation synchronized collecting distributing
206
207 partner sys_id: aa:66:aa:66:00:00
208 partner sys_priority: 65534
209 partner port_id: 3
210 partner port_priority: 65535
211 partner key: 4
212 partner state: activity timeout aggregation synchronized collecting distributing
213
214slave: p1: current attached
215 port_id: 2
216 port_priority: 65535
217 may_enable: true
218
219 actor sys_id: aa:55:aa:55:00:00
220 actor sys_priority: 65534
221 actor port_id: 2
222 actor port_priority: 65535
223 actor key: 2
224 actor state: activity timeout aggregation synchronized collecting distributing
225
226 partner sys_id: aa:66:aa:66:00:00
227 partner sys_priority: 65534
228 partner port_id: 4
229 partner port_priority: 65535
230 partner key: 4
231 partner state: activity timeout aggregation synchronized collecting distributing
232---- bond1 ----
233 status: active negotiated
234 sys_id: aa:66:aa:66:00:00
235 sys_priority: 65534
236 aggregation key: 4
237 lacp_time: fast
238
239slave: p2: current attached
240 port_id: 3
241 port_priority: 65535
242 may_enable: true
243
244 actor sys_id: aa:66:aa:66:00:00
245 actor sys_priority: 65534
246 actor port_id: 3
247 actor port_priority: 65535
248 actor key: 4
249 actor state: activity timeout aggregation synchronized collecting distributing
250
251 partner sys_id: aa:55:aa:55:00:00
252 partner sys_priority: 65534
253 partner port_id: 1
254 partner port_priority: 65535
255 partner key: 2
256 partner state: activity timeout aggregation synchronized collecting distributing
257
258slave: p3: current attached
259 port_id: 4
260 port_priority: 65535
261 may_enable: true
262
263 actor sys_id: aa:66:aa:66:00:00
264 actor sys_priority: 65534
265 actor port_id: 4
266 actor port_priority: 65535
267 actor key: 4
268 actor state: activity timeout aggregation synchronized collecting distributing
269
270 partner sys_id: aa:55:aa:55:00:00
271 partner sys_priority: 65534
272 partner port_id: 2
273 partner port_priority: 65535
274 partner key: 2
275 partner state: activity timeout aggregation synchronized collecting distributing
276---- bond0 ----
277bond_mode: balance-tcp
278bond-hash-basis: 0
279updelay: 0 ms
280downdelay: 0 ms
281lacp_status: negotiated
282
283slave p0: enabled
284 may_enable: true
285
286slave p1: enabled
287 may_enable: true
288
289---- bond1 ----
290bond_mode: balance-tcp
291bond-hash-basis: 0
292updelay: 0 ms
293downdelay: 0 ms
294lacp_status: negotiated
295
296slave p2: enabled
297 may_enable: true
298
299slave p3: enabled
300 may_enable: true
301
302])
303AT_CHECK([grep 'active slave' stdout], [0], [dnl
304 active slave
305 active slave
306])
307
308# Redirect the patch link between p0 and p2 so that no packets get
0239c860 309# back and forth across them anymore. Then wait 4 simulated
f72f0c47
BP
310# seconds. The LACP state should become "expired" for p0 and p2.
311AT_CHECK([ovs-vsctl \
312-- add-port br0 null0 -- set int null0 type=patch options:peer=p2 -- set int p2 options:peer=null0 \
313-- add-port br1 null1 -- set int null1 type=patch options:peer=p0 -- set int p0 options:peer=null1])
314
8e63fd14 315for i in `seq 0 40`; do ovs-appctl time/warp 100; done
f72f0c47
BP
316AT_CHECK(
317 [ovs-appctl lacp/show bond0
318ovs-appctl lacp/show bond1
319ovs-appctl bond/show bond0
320ovs-appctl bond/show bond1], [0], [dnl
321---- bond0 ----
322 status: active negotiated
323 sys_id: aa:55:aa:55:00:00
324 sys_priority: 65534
325 aggregation key: 2
326 lacp_time: fast
327
328slave: p0: expired attached
329 port_id: 1
330 port_priority: 65535
331 may_enable: false
332
333 actor sys_id: aa:55:aa:55:00:00
334 actor sys_priority: 65534
335 actor port_id: 1
336 actor port_priority: 65535
337 actor key: 2
338 actor state: activity timeout aggregation synchronized collecting distributing expired
339
340 partner sys_id: aa:66:aa:66:00:00
341 partner sys_priority: 65534
342 partner port_id: 3
343 partner port_priority: 65535
344 partner key: 4
345 partner state: activity timeout aggregation collecting distributing
346
347slave: p1: current attached
348 port_id: 2
349 port_priority: 65535
350 may_enable: true
351
352 actor sys_id: aa:55:aa:55:00:00
353 actor sys_priority: 65534
354 actor port_id: 2
355 actor port_priority: 65535
356 actor key: 2
357 actor state: activity timeout aggregation synchronized collecting distributing
358
359 partner sys_id: aa:66:aa:66:00:00
360 partner sys_priority: 65534
361 partner port_id: 4
362 partner port_priority: 65535
363 partner key: 4
364 partner state: activity timeout aggregation synchronized collecting distributing
365---- bond1 ----
366 status: active negotiated
367 sys_id: aa:66:aa:66:00:00
368 sys_priority: 65534
369 aggregation key: 4
370 lacp_time: fast
371
372slave: p2: expired attached
373 port_id: 3
374 port_priority: 65535
375 may_enable: false
376
377 actor sys_id: aa:66:aa:66:00:00
378 actor sys_priority: 65534
379 actor port_id: 3
380 actor port_priority: 65535
381 actor key: 4
382 actor state: activity timeout aggregation synchronized collecting distributing expired
383
384 partner sys_id: aa:55:aa:55:00:00
385 partner sys_priority: 65534
386 partner port_id: 1
387 partner port_priority: 65535
388 partner key: 2
389 partner state: activity timeout aggregation collecting distributing
390
391slave: p3: current attached
392 port_id: 4
393 port_priority: 65535
394 may_enable: true
395
396 actor sys_id: aa:66:aa:66:00:00
397 actor sys_priority: 65534
398 actor port_id: 4
399 actor port_priority: 65535
400 actor key: 4
401 actor state: activity timeout aggregation synchronized collecting distributing
402
403 partner sys_id: aa:55:aa:55:00:00
404 partner sys_priority: 65534
405 partner port_id: 2
406 partner port_priority: 65535
407 partner key: 2
408 partner state: activity timeout aggregation synchronized collecting distributing
409---- bond0 ----
410bond_mode: balance-tcp
411bond-hash-basis: 0
412updelay: 0 ms
413downdelay: 0 ms
414lacp_status: negotiated
415
416slave p0: disabled
417 may_enable: false
418
419slave p1: enabled
420 active slave
421 may_enable: true
422
423---- bond1 ----
424bond_mode: balance-tcp
425bond-hash-basis: 0
426updelay: 0 ms
427downdelay: 0 ms
428lacp_status: negotiated
429
430slave p2: disabled
431 may_enable: false
432
433slave p3: enabled
434 active slave
435 may_enable: true
436
437])
438
439# Wait 4 more simulated seconds. The LACP state should become
440# "defaulted" for p0 and p2.
441for i in `seq 0 40`; do ovs-appctl time/warp 100; done
442AT_CHECK(
443 [ovs-appctl lacp/show bond0
444ovs-appctl lacp/show bond1
445ovs-appctl bond/show bond0
446ovs-appctl bond/show bond1], [0], [dnl
447---- bond0 ----
448 status: active negotiated
449 sys_id: aa:55:aa:55:00:00
450 sys_priority: 65534
451 aggregation key: 2
452 lacp_time: fast
453
454slave: p0: defaulted detached
455 port_id: 1
456 port_priority: 65535
457 may_enable: false
458
459 actor sys_id: aa:55:aa:55:00:00
460 actor sys_priority: 65534
461 actor port_id: 1
462 actor port_priority: 65535
463 actor key: 2
464 actor state: activity timeout aggregation defaulted
465
466 partner sys_id: 00:00:00:00:00:00
467 partner sys_priority: 0
468 partner port_id: 0
469 partner port_priority: 0
470 partner key: 0
471 partner state:
472
473slave: p1: current attached
474 port_id: 2
475 port_priority: 65535
476 may_enable: true
477
478 actor sys_id: aa:55:aa:55:00:00
479 actor sys_priority: 65534
480 actor port_id: 2
481 actor port_priority: 65535
482 actor key: 2
483 actor state: activity timeout aggregation synchronized collecting distributing
484
485 partner sys_id: aa:66:aa:66:00:00
486 partner sys_priority: 65534
487 partner port_id: 4
488 partner port_priority: 65535
489 partner key: 4
490 partner state: activity timeout aggregation synchronized collecting distributing
491---- bond1 ----
492 status: active negotiated
493 sys_id: aa:66:aa:66:00:00
494 sys_priority: 65534
495 aggregation key: 4
496 lacp_time: fast
497
498slave: p2: defaulted detached
499 port_id: 3
500 port_priority: 65535
501 may_enable: false
502
503 actor sys_id: aa:66:aa:66:00:00
504 actor sys_priority: 65534
505 actor port_id: 3
506 actor port_priority: 65535
507 actor key: 4
508 actor state: activity timeout aggregation defaulted
509
510 partner sys_id: 00:00:00:00:00:00
511 partner sys_priority: 0
512 partner port_id: 0
513 partner port_priority: 0
514 partner key: 0
515 partner state:
516
517slave: p3: current attached
518 port_id: 4
519 port_priority: 65535
520 may_enable: true
521
522 actor sys_id: aa:66:aa:66:00:00
523 actor sys_priority: 65534
524 actor port_id: 4
525 actor port_priority: 65535
526 actor key: 4
527 actor state: activity timeout aggregation synchronized collecting distributing
528
529 partner sys_id: aa:55:aa:55:00:00
530 partner sys_priority: 65534
531 partner port_id: 2
532 partner port_priority: 65535
533 partner key: 2
534 partner state: activity timeout aggregation synchronized collecting distributing
535---- bond0 ----
536bond_mode: balance-tcp
537bond-hash-basis: 0
538updelay: 0 ms
539downdelay: 0 ms
540lacp_status: negotiated
541
542slave p0: disabled
543 may_enable: false
544
545slave p1: enabled
546 active slave
547 may_enable: true
548
549---- bond1 ----
550bond_mode: balance-tcp
551bond-hash-basis: 0
552updelay: 0 ms
553downdelay: 0 ms
554lacp_status: negotiated
555
556slave p2: disabled
557 may_enable: false
558
559slave p3: enabled
560 active slave
561 may_enable: true
562
563])
564OVS_VSWITCHD_STOP
565AT_CLEANUP