]> git.proxmox.com Git - mirror_ovs.git/blame - tests/lacp.at
ofproto/bond: Drop traffic in balance-tcp mode without lacp.
[mirror_ovs.git] / tests / lacp.at
CommitLineData
742468d9
EJ
1AT_BANNER([lacp])
2
adcf00ba
AZ
3# Strips out Reciulation ID information since it may change over time.
4m4_define([STRIP_RECIRC_ID], [[sed '
5 s/Recirc-ID.*$/<del>/
6' ]])
7
3e5aeeb5
AZ
8# Strips out active slave mac address since it may change over time.
9m4_define([STRIP_ACTIVE_SLAVE_MAC], [[sed '
10 s/active slave mac.*$/<active slave mac del>/
11' ]])
12
742468d9
EJ
13AT_SETUP([lacp - config])
14OVS_VSWITCHD_START([\
15 add-port br0 p1 --\
16 set Port p1 lacp=active --\
17 set Interface p1 type=dummy ])
18
bf24a5f9 19ovs-appctl time/stop
bdba1947 20ovs-appctl time/warp 300 100
bf24a5f9 21
a2a57624 22AT_CHECK([ovs-appctl lacp/show], [0], [dnl
742468d9
EJ
23---- p1 ----
24 status: active negotiated
25 sys_id: aa:55:aa:55:00:00
26 sys_priority: 65535
27 aggregation key: 1
28 lacp_time: slow
29
30slave: p1: expired attached
31 port_id: 1
32 port_priority: 65535
29985e75 33 may_enable: false
742468d9
EJ
34
35 actor sys_id: aa:55:aa:55:00:00
36 actor sys_priority: 65535
37 actor port_id: 1
38 actor port_priority: 65535
39 actor key: 1
40 actor state: activity synchronized collecting distributing expired
41
42 partner sys_id: 00:00:00:00:00:00
43 partner sys_priority: 0
44 partner port_id: 0
45 partner port_priority: 0
46 partner key: 0
47 partner state: timeout
48])
a2a57624 49AT_CHECK([ovs-appctl bond/show])
742468d9
EJ
50OVS_VSWITCHD_STOP
51AT_CLEANUP
52
a2a57624 53AT_SETUP([lacp - multi port config])
742468d9
EJ
54OVS_VSWITCHD_START([dnl
55 add-bond br0 bond p1 p2 --\
1f76f3b7 56 set Port bond lacp=active bond-mode=active-backup \
742468d9
EJ
57 other_config:lacp-time="fast" \
58 other_config:lacp-system-id=11:22:33:44:55:66 \
59 other_config:lacp-system-priority=54321 --\
60 set Interface p1 type=dummy \
61 other_config:lacp-port-id=11 \
62 other_config:lacp-port-priority=111 \
63 other_config:lacp-aggregation-key=3333 --\
64 set Interface p2 type=dummy \
65 other_config:lacp-port-id=22 \
66 other_config:lacp-port-priority=222 \
67 other_config:lacp-aggregation-key=3333 ])
68
bf24a5f9 69ovs-appctl time/stop
bdba1947 70ovs-appctl time/warp 300 100
bf24a5f9 71
742468d9
EJ
72AT_CHECK([ovs-appctl lacp/show], [0], [stdout])
73AT_CHECK([sed -e 's/aggregation key:.*/aggregation key: <omitted>/' < stdout], [0], [dnl
74---- bond ----
75 status: active negotiated
76 sys_id: 11:22:33:44:55:66
77 sys_priority: 54321
78 aggregation key: <omitted>
79 lacp_time: fast
80
81slave: p1: expired attached
82 port_id: 11
83 port_priority: 111
29985e75 84 may_enable: false
742468d9
EJ
85
86 actor sys_id: 11:22:33:44:55:66
87 actor sys_priority: 54321
88 actor port_id: 11
89 actor port_priority: 111
90 actor key: 3333
91 actor state: activity timeout aggregation synchronized collecting distributing expired
92
93 partner sys_id: 00:00:00:00:00:00
94 partner sys_priority: 0
95 partner port_id: 0
96 partner port_priority: 0
97 partner key: 0
98 partner state: timeout
99
100slave: p2: expired attached
101 port_id: 22
102 port_priority: 222
29985e75 103 may_enable: false
742468d9
EJ
104
105 actor sys_id: 11:22:33:44:55:66
106 actor sys_priority: 54321
107 actor port_id: 22
108 actor port_priority: 222
109 actor key: 3333
110 actor state: activity timeout aggregation synchronized collecting distributing expired
111
112 partner sys_id: 00:00:00:00:00:00
113 partner sys_priority: 0
114 partner port_id: 0
115 partner port_priority: 0
116 partner key: 0
117 partner state: timeout
118])
a2a57624
EJ
119AT_CHECK([ovs-appctl bond/show], [0], [dnl
120---- bond ----
121bond_mode: active-backup
adcf00ba 122bond may use recirculation: no, Recirc-ID : -1
a2a57624
EJ
123bond-hash-basis: 0
124updelay: 0 ms
125downdelay: 0 ms
bdebeece 126lacp_status: negotiated
3e5aeeb5 127active slave mac: 00:00:00:00:00:00(none)
a2a57624
EJ
128
129slave p1: disabled
130 may_enable: false
131
132slave p2: disabled
133 may_enable: false
134
135])
742468d9
EJ
136OVS_VSWITCHD_STOP
137AT_CLEANUP
f72f0c47
BP
138
139AT_SETUP([lacp - negotiation])
140# Create bond0 on br0 with interfaces p0 and p1
141# and bond1 on br1 with interfaces p2 and p3
142# with p0 patched to p2 and p1 patched to p3.
143OVS_VSWITCHD_START(
144 [add-bond br0 bond0 p0 p1 bond_mode=balance-tcp lacp=active \
145 other-config:lacp-time=fast \
146 other-config:bond-rebalance-interval=0 -- \
b369c233
BP
147 set interface p0 type=patch options:peer=p2 ofport_request=1 \
148 other-config:lacp-aggregation-key=2 -- \
149 set interface p1 type=patch options:peer=p3 ofport_request=2 \
150 other-config:lacp-aggregation-key=2 -- \
f72f0c47
BP
151 add-br br1 -- \
152 set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
153 set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
154 fail-mode=secure -- \
155 add-bond br1 bond1 p2 p3 bond_mode=balance-tcp lacp=active \
156 other-config:lacp-time=fast \
157 other-config:bond-rebalance-interval=0 -- \
b369c233
BP
158 set interface p2 type=patch options:peer=p0 ofport_request=3 \
159 other-config:lacp-aggregation-key=4 -- \
160 set interface p3 type=patch options:peer=p1 ofport_request=4 \
161 other-config:lacp-aggregation-key=4 --])
f72f0c47
BP
162
163AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
164])
165
8e63fd14
BP
166ovs-appctl time/stop
167
f72f0c47
BP
168# Wait for up to 5 (simulated) seconds, until LACP negotiation finishes.
169i=0
170while :; do
171 ovs-appctl lacp/show bond0 > bond0
172 AT_CAPTURE_FILE([bond0])
173 ovs-appctl lacp/show bond1 > bond1
174 AT_CAPTURE_FILE([bond1])
175 if grep negotiated bond0 && grep negotiated bond1; then
176 if grep expired bond0 || grep expired bond1; then
177 :
178 else
179 break
180 fi
181 fi
182 i=`expr $i + 1`
183 if test $i = 50; then
184 AT_FAIL_IF([:])
185 fi
186 ovs-appctl time/warp 100
187done
188
189# Now check the correctly negotiated configuration.
190AT_CHECK(
191 [ovs-appctl lacp/show bond0
192ovs-appctl lacp/show bond1
3e5aeeb5
AZ
193ovs-appctl bond/show bond0 | STRIP_RECIRC_ID | STRIP_ACTIVE_SLAVE_MAC
194ovs-appctl bond/show bond1 | STRIP_RECIRC_ID | STRIP_ACTIVE_SLAVE_MAC ], [0], [stdout])
f72f0c47
BP
195AT_CHECK([sed '/active slave/d' stdout], [0], [dnl
196---- bond0 ----
197 status: active negotiated
198 sys_id: aa:55:aa:55:00:00
199 sys_priority: 65534
200 aggregation key: 2
201 lacp_time: fast
202
203slave: p0: current attached
204 port_id: 1
205 port_priority: 65535
206 may_enable: true
207
208 actor sys_id: aa:55:aa:55:00:00
209 actor sys_priority: 65534
210 actor port_id: 1
211 actor port_priority: 65535
212 actor key: 2
213 actor state: activity timeout aggregation synchronized collecting distributing
214
215 partner sys_id: aa:66:aa:66:00:00
216 partner sys_priority: 65534
217 partner port_id: 3
218 partner port_priority: 65535
219 partner key: 4
220 partner state: activity timeout aggregation synchronized collecting distributing
221
222slave: p1: current attached
223 port_id: 2
224 port_priority: 65535
225 may_enable: true
226
227 actor sys_id: aa:55:aa:55:00:00
228 actor sys_priority: 65534
229 actor port_id: 2
230 actor port_priority: 65535
231 actor key: 2
232 actor state: activity timeout aggregation synchronized collecting distributing
233
234 partner sys_id: aa:66:aa:66:00:00
235 partner sys_priority: 65534
236 partner port_id: 4
237 partner port_priority: 65535
238 partner key: 4
239 partner state: activity timeout aggregation synchronized collecting distributing
240---- bond1 ----
241 status: active negotiated
242 sys_id: aa:66:aa:66:00:00
243 sys_priority: 65534
244 aggregation key: 4
245 lacp_time: fast
246
247slave: p2: current attached
248 port_id: 3
249 port_priority: 65535
250 may_enable: true
251
252 actor sys_id: aa:66:aa:66:00:00
253 actor sys_priority: 65534
254 actor port_id: 3
255 actor port_priority: 65535
256 actor key: 4
257 actor state: activity timeout aggregation synchronized collecting distributing
258
259 partner sys_id: aa:55:aa:55:00:00
260 partner sys_priority: 65534
261 partner port_id: 1
262 partner port_priority: 65535
263 partner key: 2
264 partner state: activity timeout aggregation synchronized collecting distributing
265
266slave: p3: current attached
267 port_id: 4
268 port_priority: 65535
269 may_enable: true
270
271 actor sys_id: aa:66:aa:66:00:00
272 actor sys_priority: 65534
273 actor port_id: 4
274 actor port_priority: 65535
275 actor key: 4
276 actor state: activity timeout aggregation synchronized collecting distributing
277
278 partner sys_id: aa:55:aa:55:00:00
279 partner sys_priority: 65534
280 partner port_id: 2
281 partner port_priority: 65535
282 partner key: 2
283 partner state: activity timeout aggregation synchronized collecting distributing
284---- bond0 ----
285bond_mode: balance-tcp
adcf00ba 286bond may use recirculation: yes, <del>
f72f0c47
BP
287bond-hash-basis: 0
288updelay: 0 ms
289downdelay: 0 ms
290lacp_status: negotiated
291
292slave p0: enabled
293 may_enable: true
294
295slave p1: enabled
296 may_enable: true
297
298---- bond1 ----
299bond_mode: balance-tcp
adcf00ba 300bond may use recirculation: yes, <del>
f72f0c47
BP
301bond-hash-basis: 0
302updelay: 0 ms
303downdelay: 0 ms
304lacp_status: negotiated
305
306slave p2: enabled
307 may_enable: true
308
309slave p3: enabled
310 may_enable: true
311
312])
3e5aeeb5 313AT_CHECK([grep 'active slave$' stdout], [0], [dnl
f72f0c47
BP
314 active slave
315 active slave
316])
317
318# Redirect the patch link between p0 and p2 so that no packets get
0239c860 319# back and forth across them anymore. Then wait 4 simulated
f72f0c47
BP
320# seconds. The LACP state should become "expired" for p0 and p2.
321AT_CHECK([ovs-vsctl \
322-- add-port br0 null0 -- set int null0 type=patch options:peer=p2 -- set int p2 options:peer=null0 \
323-- add-port br1 null1 -- set int null1 type=patch options:peer=p0 -- set int p0 options:peer=null1])
324
bdba1947 325ovs-appctl time/warp 4100 100
f72f0c47
BP
326AT_CHECK(
327 [ovs-appctl lacp/show bond0
328ovs-appctl lacp/show bond1
3e5aeeb5
AZ
329ovs-appctl bond/show bond0 | STRIP_RECIRC_ID | STRIP_ACTIVE_SLAVE_MAC
330ovs-appctl bond/show bond1 | STRIP_RECIRC_ID | STRIP_ACTIVE_SLAVE_MAC ], [0], [dnl
f72f0c47
BP
331---- bond0 ----
332 status: active negotiated
333 sys_id: aa:55:aa:55:00:00
334 sys_priority: 65534
335 aggregation key: 2
336 lacp_time: fast
337
338slave: p0: expired attached
339 port_id: 1
340 port_priority: 65535
341 may_enable: false
342
343 actor sys_id: aa:55:aa:55:00:00
344 actor sys_priority: 65534
345 actor port_id: 1
346 actor port_priority: 65535
347 actor key: 2
348 actor state: activity timeout aggregation synchronized collecting distributing expired
349
350 partner sys_id: aa:66:aa:66:00:00
351 partner sys_priority: 65534
352 partner port_id: 3
353 partner port_priority: 65535
354 partner key: 4
355 partner state: activity timeout aggregation collecting distributing
356
357slave: p1: current attached
358 port_id: 2
359 port_priority: 65535
360 may_enable: true
361
362 actor sys_id: aa:55:aa:55:00:00
363 actor sys_priority: 65534
364 actor port_id: 2
365 actor port_priority: 65535
366 actor key: 2
367 actor state: activity timeout aggregation synchronized collecting distributing
368
369 partner sys_id: aa:66:aa:66:00:00
370 partner sys_priority: 65534
371 partner port_id: 4
372 partner port_priority: 65535
373 partner key: 4
374 partner state: activity timeout aggregation synchronized collecting distributing
375---- bond1 ----
376 status: active negotiated
377 sys_id: aa:66:aa:66:00:00
378 sys_priority: 65534
379 aggregation key: 4
380 lacp_time: fast
381
382slave: p2: expired attached
383 port_id: 3
384 port_priority: 65535
385 may_enable: false
386
387 actor sys_id: aa:66:aa:66:00:00
388 actor sys_priority: 65534
389 actor port_id: 3
390 actor port_priority: 65535
391 actor key: 4
392 actor state: activity timeout aggregation synchronized collecting distributing expired
393
394 partner sys_id: aa:55:aa:55:00:00
395 partner sys_priority: 65534
396 partner port_id: 1
397 partner port_priority: 65535
398 partner key: 2
399 partner state: activity timeout aggregation collecting distributing
400
401slave: p3: current attached
402 port_id: 4
403 port_priority: 65535
404 may_enable: true
405
406 actor sys_id: aa:66:aa:66:00:00
407 actor sys_priority: 65534
408 actor port_id: 4
409 actor port_priority: 65535
410 actor key: 4
411 actor state: activity timeout aggregation synchronized collecting distributing
412
413 partner sys_id: aa:55:aa:55:00:00
414 partner sys_priority: 65534
415 partner port_id: 2
416 partner port_priority: 65535
417 partner key: 2
418 partner state: activity timeout aggregation synchronized collecting distributing
419---- bond0 ----
420bond_mode: balance-tcp
adcf00ba 421bond may use recirculation: yes, <del>
f72f0c47
BP
422bond-hash-basis: 0
423updelay: 0 ms
424downdelay: 0 ms
425lacp_status: negotiated
3e5aeeb5 426<active slave mac del>
f72f0c47
BP
427
428slave p0: disabled
429 may_enable: false
430
431slave p1: enabled
432 active slave
433 may_enable: true
434
435---- bond1 ----
436bond_mode: balance-tcp
adcf00ba 437bond may use recirculation: yes, <del>
f72f0c47
BP
438bond-hash-basis: 0
439updelay: 0 ms
440downdelay: 0 ms
441lacp_status: negotiated
3e5aeeb5 442<active slave mac del>
f72f0c47
BP
443
444slave p2: disabled
445 may_enable: false
446
447slave p3: enabled
448 active slave
449 may_enable: true
450
451])
452
453# Wait 4 more simulated seconds. The LACP state should become
454# "defaulted" for p0 and p2.
bdba1947 455ovs-appctl time/warp 4100 100
f72f0c47
BP
456AT_CHECK(
457 [ovs-appctl lacp/show bond0
458ovs-appctl lacp/show bond1
3e5aeeb5
AZ
459ovs-appctl bond/show bond0 | STRIP_RECIRC_ID | STRIP_ACTIVE_SLAVE_MAC
460ovs-appctl bond/show bond1 | STRIP_RECIRC_ID | STRIP_ACTIVE_SLAVE_MAC ], [0], [dnl
f72f0c47
BP
461---- bond0 ----
462 status: active negotiated
463 sys_id: aa:55:aa:55:00:00
464 sys_priority: 65534
465 aggregation key: 2
466 lacp_time: fast
467
468slave: p0: defaulted detached
469 port_id: 1
470 port_priority: 65535
471 may_enable: false
472
473 actor sys_id: aa:55:aa:55:00:00
474 actor sys_priority: 65534
475 actor port_id: 1
476 actor port_priority: 65535
477 actor key: 2
478 actor state: activity timeout aggregation defaulted
479
480 partner sys_id: 00:00:00:00:00:00
481 partner sys_priority: 0
482 partner port_id: 0
483 partner port_priority: 0
484 partner key: 0
485 partner state:
486
487slave: p1: current attached
488 port_id: 2
489 port_priority: 65535
490 may_enable: true
491
492 actor sys_id: aa:55:aa:55:00:00
493 actor sys_priority: 65534
494 actor port_id: 2
495 actor port_priority: 65535
496 actor key: 2
497 actor state: activity timeout aggregation synchronized collecting distributing
498
499 partner sys_id: aa:66:aa:66:00:00
500 partner sys_priority: 65534
501 partner port_id: 4
502 partner port_priority: 65535
503 partner key: 4
504 partner state: activity timeout aggregation synchronized collecting distributing
505---- bond1 ----
506 status: active negotiated
507 sys_id: aa:66:aa:66:00:00
508 sys_priority: 65534
509 aggregation key: 4
510 lacp_time: fast
511
512slave: p2: defaulted detached
513 port_id: 3
514 port_priority: 65535
515 may_enable: false
516
517 actor sys_id: aa:66:aa:66:00:00
518 actor sys_priority: 65534
519 actor port_id: 3
520 actor port_priority: 65535
521 actor key: 4
522 actor state: activity timeout aggregation defaulted
523
524 partner sys_id: 00:00:00:00:00:00
525 partner sys_priority: 0
526 partner port_id: 0
527 partner port_priority: 0
528 partner key: 0
529 partner state:
530
531slave: p3: current attached
532 port_id: 4
533 port_priority: 65535
534 may_enable: true
535
536 actor sys_id: aa:66:aa:66:00:00
537 actor sys_priority: 65534
538 actor port_id: 4
539 actor port_priority: 65535
540 actor key: 4
541 actor state: activity timeout aggregation synchronized collecting distributing
542
543 partner sys_id: aa:55:aa:55:00:00
544 partner sys_priority: 65534
545 partner port_id: 2
546 partner port_priority: 65535
547 partner key: 2
548 partner state: activity timeout aggregation synchronized collecting distributing
549---- bond0 ----
550bond_mode: balance-tcp
adcf00ba 551bond may use recirculation: yes, <del>
f72f0c47
BP
552bond-hash-basis: 0
553updelay: 0 ms
554downdelay: 0 ms
555lacp_status: negotiated
3e5aeeb5 556<active slave mac del>
f72f0c47
BP
557
558slave p0: disabled
559 may_enable: false
560
561slave p1: enabled
562 active slave
563 may_enable: true
564
565---- bond1 ----
566bond_mode: balance-tcp
adcf00ba 567bond may use recirculation: yes, <del>
f72f0c47
BP
568bond-hash-basis: 0
569updelay: 0 ms
570downdelay: 0 ms
571lacp_status: negotiated
3e5aeeb5 572<active slave mac del>
f72f0c47
BP
573
574slave p2: disabled
575 may_enable: false
576
577slave p3: enabled
578 active slave
579 may_enable: true
580
581])
3afefab9
SS
582
583# Reconnect the patch link between p0 and p2 to allow traffic between the ports.
584AT_CHECK([ovs-vsctl \
585-- del-port null0 -- set int p2 options:peer=p0 \
586-- del-port null1 -- set int p0 options:peer=p2])
587
588# Wait for 30 more seconds (LACP_SLOW_TIME_TX) for the lacp to renegotiate
589ovs-appctl time/warp 30100 100
590
591AT_CHECK(
592 [ovs-appctl lacp/show bond0
593ovs-appctl lacp/show bond1
594ovs-appctl bond/show bond0 | STRIP_RECIRC_ID | STRIP_ACTIVE_SLAVE_MAC
595ovs-appctl bond/show bond1 | STRIP_RECIRC_ID | STRIP_ACTIVE_SLAVE_MAC ], [0], [dnl
596---- bond0 ----
597 status: active negotiated
598 sys_id: aa:55:aa:55:00:00
599 sys_priority: 65534
600 aggregation key: 2
601 lacp_time: fast
602
603slave: p0: current attached
604 port_id: 1
605 port_priority: 65535
606 may_enable: true
607
608 actor sys_id: aa:55:aa:55:00:00
609 actor sys_priority: 65534
610 actor port_id: 1
611 actor port_priority: 65535
612 actor key: 2
613 actor state: activity timeout aggregation synchronized collecting distributing
614
615 partner sys_id: aa:66:aa:66:00:00
616 partner sys_priority: 65534
617 partner port_id: 3
618 partner port_priority: 65535
619 partner key: 4
620 partner state: activity timeout aggregation synchronized collecting distributing
621
622slave: p1: current attached
623 port_id: 2
624 port_priority: 65535
625 may_enable: true
626
627 actor sys_id: aa:55:aa:55:00:00
628 actor sys_priority: 65534
629 actor port_id: 2
630 actor port_priority: 65535
631 actor key: 2
632 actor state: activity timeout aggregation synchronized collecting distributing
633
634 partner sys_id: aa:66:aa:66:00:00
635 partner sys_priority: 65534
636 partner port_id: 4
637 partner port_priority: 65535
638 partner key: 4
639 partner state: activity timeout aggregation synchronized collecting distributing
640---- bond1 ----
641 status: active negotiated
642 sys_id: aa:66:aa:66:00:00
643 sys_priority: 65534
644 aggregation key: 4
645 lacp_time: fast
646
647slave: p2: current attached
648 port_id: 3
649 port_priority: 65535
650 may_enable: true
651
652 actor sys_id: aa:66:aa:66:00:00
653 actor sys_priority: 65534
654 actor port_id: 3
655 actor port_priority: 65535
656 actor key: 4
657 actor state: activity timeout aggregation synchronized collecting distributing
658
659 partner sys_id: aa:55:aa:55:00:00
660 partner sys_priority: 65534
661 partner port_id: 1
662 partner port_priority: 65535
663 partner key: 2
664 partner state: activity timeout aggregation synchronized collecting distributing
665
666slave: p3: current attached
667 port_id: 4
668 port_priority: 65535
669 may_enable: true
670
671 actor sys_id: aa:66:aa:66:00:00
672 actor sys_priority: 65534
673 actor port_id: 4
674 actor port_priority: 65535
675 actor key: 4
676 actor state: activity timeout aggregation synchronized collecting distributing
677
678 partner sys_id: aa:55:aa:55:00:00
679 partner sys_priority: 65534
680 partner port_id: 2
681 partner port_priority: 65535
682 partner key: 2
683 partner state: activity timeout aggregation synchronized collecting distributing
684---- bond0 ----
685bond_mode: balance-tcp
686bond may use recirculation: yes, <del>
687bond-hash-basis: 0
688updelay: 0 ms
689downdelay: 0 ms
690lacp_status: negotiated
691<active slave mac del>
692
693slave p0: enabled
694 may_enable: true
695
696slave p1: enabled
697 active slave
698 may_enable: true
699
700---- bond1 ----
701bond_mode: balance-tcp
702bond may use recirculation: yes, <del>
703bond-hash-basis: 0
704updelay: 0 ms
705downdelay: 0 ms
706lacp_status: negotiated
707<active slave mac del>
708
709slave p2: enabled
710 may_enable: true
711
712slave p3: enabled
713 active slave
714 may_enable: true
715
716])
717
f72f0c47
BP
718OVS_VSWITCHD_STOP
719AT_CLEANUP