]> git.proxmox.com Git - mirror_ovs.git/blob - tests/lacp.at
bond: Add 'primary' interface concept for active-backup mode.
[mirror_ovs.git] / tests / lacp.at
1 AT_BANNER([lacp])
2
3 # Strips out Reciulation ID information since it may change over time.
4 m4_define([STRIP_RECIRC_ID], [[sed '
5 s/Recirc-ID.*$/<del>/
6 ' ]])
7
8 # Strips out active slave mac address since it may change over time.
9 m4_define([STRIP_ACTIVE_SLAVE_MAC], [[sed '
10 s/active slave mac.*$/<active slave mac del>/
11 ' ]])
12
13 AT_SETUP([lacp - config])
14 OVS_VSWITCHD_START([\
15 add-port br0 p1 --\
16 set Port p1 lacp=active --\
17 set Interface p1 type=dummy ])
18
19 ovs-appctl time/stop
20 ovs-appctl time/warp 300 100
21
22 AT_CHECK([ovs-appctl lacp/show], [0], [dnl
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
30 slave: p1: expired attached
31 port_id: 1
32 port_priority: 65535
33 may_enable: false
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 ])
49 AT_CHECK([ovs-appctl bond/show])
50 OVS_VSWITCHD_STOP
51 AT_CLEANUP
52
53 AT_SETUP([lacp - multi port config])
54 OVS_VSWITCHD_START([dnl
55 add-bond br0 bond p1 p2 --\
56 set Port bond lacp=active bond-mode=active-backup \
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
69 ovs-appctl time/stop
70 ovs-appctl time/warp 300 100
71
72 AT_CHECK([ovs-appctl lacp/show], [0], [stdout])
73 AT_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
81 slave: p1: expired attached
82 port_id: 11
83 port_priority: 111
84 may_enable: false
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
100 slave: p2: expired attached
101 port_id: 22
102 port_priority: 222
103 may_enable: false
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 ])
119 AT_CHECK([ovs-appctl bond/show], [0], [dnl
120 ---- bond ----
121 bond_mode: active-backup
122 bond may use recirculation: no, Recirc-ID : -1
123 bond-hash-basis: 0
124 lb_output action: disabled, bond-id: -1
125 updelay: 0 ms
126 downdelay: 0 ms
127 lacp_status: negotiated
128 lacp_fallback_ab: false
129 active-backup primary: <none>
130 active slave mac: 00:00:00:00:00:00(none)
131
132 slave p1: disabled
133 may_enable: false
134
135 slave p2: disabled
136 may_enable: false
137
138 ])
139 OVS_VSWITCHD_STOP
140 AT_CLEANUP
141
142 AT_SETUP([lacp - negotiation])
143 # Create bond0 on br0 with interfaces p0 and p1
144 # and bond1 on br1 with interfaces p2 and p3
145 # with p0 patched to p2 and p1 patched to p3.
146 OVS_VSWITCHD_START(
147 [add-bond br0 bond0 p0 p1 bond_mode=balance-tcp lacp=active \
148 other-config:lacp-time=fast \
149 other-config:bond-rebalance-interval=0 -- \
150 set interface p0 type=patch options:peer=p2 ofport_request=1 \
151 other-config:lacp-aggregation-key=2 -- \
152 set interface p1 type=patch options:peer=p3 ofport_request=2 \
153 other-config:lacp-aggregation-key=2 -- \
154 add-br br1 -- \
155 set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
156 set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
157 fail-mode=secure -- \
158 add-bond br1 bond1 p2 p3 bond_mode=balance-tcp lacp=active \
159 other-config:lacp-time=fast \
160 other-config:bond-rebalance-interval=0 -- \
161 set interface p2 type=patch options:peer=p0 ofport_request=3 \
162 other-config:lacp-aggregation-key=4 -- \
163 set interface p3 type=patch options:peer=p1 ofport_request=4 \
164 other-config:lacp-aggregation-key=4 --])
165
166 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
167 ])
168
169 ovs-appctl time/stop
170
171 # Wait for up to 5 (simulated) seconds, until LACP negotiation finishes.
172 i=0
173 while :; do
174 ovs-appctl lacp/show bond0 > bond0
175 AT_CAPTURE_FILE([bond0])
176 ovs-appctl lacp/show bond1 > bond1
177 AT_CAPTURE_FILE([bond1])
178 if grep negotiated bond0 && grep negotiated bond1; then
179 if grep expired bond0 || grep expired bond1; then
180 :
181 else
182 break
183 fi
184 fi
185 i=`expr $i + 1`
186 if test $i = 50; then
187 AT_FAIL_IF([:])
188 fi
189 ovs-appctl time/warp 100
190 done
191
192 # Now check the correctly negotiated configuration.
193 AT_CHECK(
194 [ovs-appctl lacp/show bond0
195 ovs-appctl lacp/show bond1
196 ovs-appctl bond/show bond0 | STRIP_RECIRC_ID | STRIP_ACTIVE_SLAVE_MAC
197 ovs-appctl bond/show bond1 | STRIP_RECIRC_ID | STRIP_ACTIVE_SLAVE_MAC ], [0], [stdout])
198 AT_CHECK([sed '/active slave/d' stdout], [0], [dnl
199 ---- bond0 ----
200 status: active negotiated
201 sys_id: aa:55:aa:55:00:00
202 sys_priority: 65534
203 aggregation key: 2
204 lacp_time: fast
205
206 slave: p0: current attached
207 port_id: 1
208 port_priority: 65535
209 may_enable: true
210
211 actor sys_id: aa:55:aa:55:00:00
212 actor sys_priority: 65534
213 actor port_id: 1
214 actor port_priority: 65535
215 actor key: 2
216 actor state: activity timeout aggregation synchronized collecting distributing
217
218 partner sys_id: aa:66:aa:66:00:00
219 partner sys_priority: 65534
220 partner port_id: 3
221 partner port_priority: 65535
222 partner key: 4
223 partner state: activity timeout aggregation synchronized collecting distributing
224
225 slave: p1: current attached
226 port_id: 2
227 port_priority: 65535
228 may_enable: true
229
230 actor sys_id: aa:55:aa:55:00:00
231 actor sys_priority: 65534
232 actor port_id: 2
233 actor port_priority: 65535
234 actor key: 2
235 actor state: activity timeout aggregation synchronized collecting distributing
236
237 partner sys_id: aa:66:aa:66:00:00
238 partner sys_priority: 65534
239 partner port_id: 4
240 partner port_priority: 65535
241 partner key: 4
242 partner state: activity timeout aggregation synchronized collecting distributing
243 ---- bond1 ----
244 status: active negotiated
245 sys_id: aa:66:aa:66:00:00
246 sys_priority: 65534
247 aggregation key: 4
248 lacp_time: fast
249
250 slave: p2: current attached
251 port_id: 3
252 port_priority: 65535
253 may_enable: true
254
255 actor sys_id: aa:66:aa:66:00:00
256 actor sys_priority: 65534
257 actor port_id: 3
258 actor port_priority: 65535
259 actor key: 4
260 actor state: activity timeout aggregation synchronized collecting distributing
261
262 partner sys_id: aa:55:aa:55:00:00
263 partner sys_priority: 65534
264 partner port_id: 1
265 partner port_priority: 65535
266 partner key: 2
267 partner state: activity timeout aggregation synchronized collecting distributing
268
269 slave: p3: current attached
270 port_id: 4
271 port_priority: 65535
272 may_enable: true
273
274 actor sys_id: aa:66:aa:66:00:00
275 actor sys_priority: 65534
276 actor port_id: 4
277 actor port_priority: 65535
278 actor key: 4
279 actor state: activity timeout aggregation synchronized collecting distributing
280
281 partner sys_id: aa:55:aa:55:00:00
282 partner sys_priority: 65534
283 partner port_id: 2
284 partner port_priority: 65535
285 partner key: 2
286 partner state: activity timeout aggregation synchronized collecting distributing
287 ---- bond0 ----
288 bond_mode: balance-tcp
289 bond may use recirculation: yes, <del>
290 bond-hash-basis: 0
291 lb_output action: disabled, bond-id: -1
292 updelay: 0 ms
293 downdelay: 0 ms
294 lacp_status: negotiated
295 lacp_fallback_ab: false
296 active-backup primary: <none>
297
298 slave p0: enabled
299 may_enable: true
300
301 slave p1: enabled
302 may_enable: true
303
304 ---- bond1 ----
305 bond_mode: balance-tcp
306 bond may use recirculation: yes, <del>
307 bond-hash-basis: 0
308 lb_output action: disabled, bond-id: -1
309 updelay: 0 ms
310 downdelay: 0 ms
311 lacp_status: negotiated
312 lacp_fallback_ab: false
313 active-backup primary: <none>
314
315 slave p2: enabled
316 may_enable: true
317
318 slave p3: enabled
319 may_enable: true
320
321 ])
322 AT_CHECK([grep 'active slave$' stdout], [0], [dnl
323 active slave
324 active slave
325 ])
326
327 # Redirect the patch link between p0 and p2 so that no packets get
328 # back and forth across them anymore. Then wait 4 simulated
329 # seconds. The LACP state should become "expired" for p0 and p2.
330 AT_CHECK([ovs-vsctl \
331 -- add-port br0 null0 -- set int null0 type=patch options:peer=p2 -- set int p2 options:peer=null0 \
332 -- add-port br1 null1 -- set int null1 type=patch options:peer=p0 -- set int p0 options:peer=null1])
333
334 ovs-appctl time/warp 4100 100
335 AT_CHECK(
336 [ovs-appctl lacp/show bond0
337 ovs-appctl lacp/show bond1
338 ovs-appctl bond/show bond0 | STRIP_RECIRC_ID | STRIP_ACTIVE_SLAVE_MAC
339 ovs-appctl bond/show bond1 | STRIP_RECIRC_ID | STRIP_ACTIVE_SLAVE_MAC ], [0], [dnl
340 ---- bond0 ----
341 status: active negotiated
342 sys_id: aa:55:aa:55:00:00
343 sys_priority: 65534
344 aggregation key: 2
345 lacp_time: fast
346
347 slave: p0: expired attached
348 port_id: 1
349 port_priority: 65535
350 may_enable: false
351
352 actor sys_id: aa:55:aa:55:00:00
353 actor sys_priority: 65534
354 actor port_id: 1
355 actor port_priority: 65535
356 actor key: 2
357 actor state: activity timeout aggregation synchronized collecting distributing expired
358
359 partner sys_id: aa:66:aa:66:00:00
360 partner sys_priority: 65534
361 partner port_id: 3
362 partner port_priority: 65535
363 partner key: 4
364 partner state: activity timeout aggregation collecting distributing
365
366 slave: p1: current attached
367 port_id: 2
368 port_priority: 65535
369 may_enable: true
370
371 actor sys_id: aa:55:aa:55:00:00
372 actor sys_priority: 65534
373 actor port_id: 2
374 actor port_priority: 65535
375 actor key: 2
376 actor state: activity timeout aggregation synchronized collecting distributing
377
378 partner sys_id: aa:66:aa:66:00:00
379 partner sys_priority: 65534
380 partner port_id: 4
381 partner port_priority: 65535
382 partner key: 4
383 partner state: activity timeout aggregation synchronized collecting distributing
384 ---- bond1 ----
385 status: active negotiated
386 sys_id: aa:66:aa:66:00:00
387 sys_priority: 65534
388 aggregation key: 4
389 lacp_time: fast
390
391 slave: p2: expired attached
392 port_id: 3
393 port_priority: 65535
394 may_enable: false
395
396 actor sys_id: aa:66:aa:66:00:00
397 actor sys_priority: 65534
398 actor port_id: 3
399 actor port_priority: 65535
400 actor key: 4
401 actor state: activity timeout aggregation synchronized collecting distributing expired
402
403 partner sys_id: aa:55:aa:55:00:00
404 partner sys_priority: 65534
405 partner port_id: 1
406 partner port_priority: 65535
407 partner key: 2
408 partner state: activity timeout aggregation collecting distributing
409
410 slave: p3: current attached
411 port_id: 4
412 port_priority: 65535
413 may_enable: true
414
415 actor sys_id: aa:66:aa:66:00:00
416 actor sys_priority: 65534
417 actor port_id: 4
418 actor port_priority: 65535
419 actor key: 4
420 actor state: activity timeout aggregation synchronized collecting distributing
421
422 partner sys_id: aa:55:aa:55:00:00
423 partner sys_priority: 65534
424 partner port_id: 2
425 partner port_priority: 65535
426 partner key: 2
427 partner state: activity timeout aggregation synchronized collecting distributing
428 ---- bond0 ----
429 bond_mode: balance-tcp
430 bond may use recirculation: yes, <del>
431 bond-hash-basis: 0
432 lb_output action: disabled, bond-id: -1
433 updelay: 0 ms
434 downdelay: 0 ms
435 lacp_status: negotiated
436 lacp_fallback_ab: false
437 active-backup primary: <none>
438 <active slave mac del>
439
440 slave p0: disabled
441 may_enable: false
442
443 slave p1: enabled
444 active slave
445 may_enable: true
446
447 ---- bond1 ----
448 bond_mode: balance-tcp
449 bond may use recirculation: yes, <del>
450 bond-hash-basis: 0
451 lb_output action: disabled, bond-id: -1
452 updelay: 0 ms
453 downdelay: 0 ms
454 lacp_status: negotiated
455 lacp_fallback_ab: false
456 active-backup primary: <none>
457 <active slave mac del>
458
459 slave p2: disabled
460 may_enable: false
461
462 slave p3: enabled
463 active slave
464 may_enable: true
465
466 ])
467
468 # Wait 4 more simulated seconds. The LACP state should become
469 # "defaulted" for p0 and p2.
470 ovs-appctl time/warp 4100 100
471 AT_CHECK(
472 [ovs-appctl lacp/show bond0
473 ovs-appctl lacp/show bond1
474 ovs-appctl bond/show bond0 | STRIP_RECIRC_ID | STRIP_ACTIVE_SLAVE_MAC
475 ovs-appctl bond/show bond1 | STRIP_RECIRC_ID | STRIP_ACTIVE_SLAVE_MAC ], [0], [dnl
476 ---- bond0 ----
477 status: active negotiated
478 sys_id: aa:55:aa:55:00:00
479 sys_priority: 65534
480 aggregation key: 2
481 lacp_time: fast
482
483 slave: p0: defaulted detached
484 port_id: 1
485 port_priority: 65535
486 may_enable: false
487
488 actor sys_id: aa:55:aa:55:00:00
489 actor sys_priority: 65534
490 actor port_id: 1
491 actor port_priority: 65535
492 actor key: 2
493 actor state: activity timeout aggregation defaulted
494
495 partner sys_id: 00:00:00:00:00:00
496 partner sys_priority: 0
497 partner port_id: 0
498 partner port_priority: 0
499 partner key: 0
500 partner state:
501
502 slave: p1: current attached
503 port_id: 2
504 port_priority: 65535
505 may_enable: true
506
507 actor sys_id: aa:55:aa:55:00:00
508 actor sys_priority: 65534
509 actor port_id: 2
510 actor port_priority: 65535
511 actor key: 2
512 actor state: activity timeout aggregation synchronized collecting distributing
513
514 partner sys_id: aa:66:aa:66:00:00
515 partner sys_priority: 65534
516 partner port_id: 4
517 partner port_priority: 65535
518 partner key: 4
519 partner state: activity timeout aggregation synchronized collecting distributing
520 ---- bond1 ----
521 status: active negotiated
522 sys_id: aa:66:aa:66:00:00
523 sys_priority: 65534
524 aggregation key: 4
525 lacp_time: fast
526
527 slave: p2: defaulted detached
528 port_id: 3
529 port_priority: 65535
530 may_enable: false
531
532 actor sys_id: aa:66:aa:66:00:00
533 actor sys_priority: 65534
534 actor port_id: 3
535 actor port_priority: 65535
536 actor key: 4
537 actor state: activity timeout aggregation defaulted
538
539 partner sys_id: 00:00:00:00:00:00
540 partner sys_priority: 0
541 partner port_id: 0
542 partner port_priority: 0
543 partner key: 0
544 partner state:
545
546 slave: p3: current attached
547 port_id: 4
548 port_priority: 65535
549 may_enable: true
550
551 actor sys_id: aa:66:aa:66:00:00
552 actor sys_priority: 65534
553 actor port_id: 4
554 actor port_priority: 65535
555 actor key: 4
556 actor state: activity timeout aggregation synchronized collecting distributing
557
558 partner sys_id: aa:55:aa:55:00:00
559 partner sys_priority: 65534
560 partner port_id: 2
561 partner port_priority: 65535
562 partner key: 2
563 partner state: activity timeout aggregation synchronized collecting distributing
564 ---- bond0 ----
565 bond_mode: balance-tcp
566 bond may use recirculation: yes, <del>
567 bond-hash-basis: 0
568 lb_output action: disabled, bond-id: -1
569 updelay: 0 ms
570 downdelay: 0 ms
571 lacp_status: negotiated
572 lacp_fallback_ab: false
573 active-backup primary: <none>
574 <active slave mac del>
575
576 slave p0: disabled
577 may_enable: false
578
579 slave p1: enabled
580 active slave
581 may_enable: true
582
583 ---- bond1 ----
584 bond_mode: balance-tcp
585 bond may use recirculation: yes, <del>
586 bond-hash-basis: 0
587 lb_output action: disabled, bond-id: -1
588 updelay: 0 ms
589 downdelay: 0 ms
590 lacp_status: negotiated
591 lacp_fallback_ab: false
592 active-backup primary: <none>
593 <active slave mac del>
594
595 slave p2: disabled
596 may_enable: false
597
598 slave p3: enabled
599 active slave
600 may_enable: true
601
602 ])
603
604 # Reconnect the patch link between p0 and p2 to allow traffic between the ports.
605 AT_CHECK([ovs-vsctl \
606 -- del-port null0 -- set int p2 options:peer=p0 \
607 -- del-port null1 -- set int p0 options:peer=p2])
608
609 # Wait for 30 more seconds (LACP_SLOW_TIME_TX) for the lacp to renegotiate
610 ovs-appctl time/warp 30100 100
611
612 AT_CHECK(
613 [ovs-appctl lacp/show bond0
614 ovs-appctl lacp/show bond1
615 ovs-appctl bond/show bond0 | STRIP_RECIRC_ID | STRIP_ACTIVE_SLAVE_MAC
616 ovs-appctl bond/show bond1 | STRIP_RECIRC_ID | STRIP_ACTIVE_SLAVE_MAC ], [0], [dnl
617 ---- bond0 ----
618 status: active negotiated
619 sys_id: aa:55:aa:55:00:00
620 sys_priority: 65534
621 aggregation key: 2
622 lacp_time: fast
623
624 slave: p0: current attached
625 port_id: 1
626 port_priority: 65535
627 may_enable: true
628
629 actor sys_id: aa:55:aa:55:00:00
630 actor sys_priority: 65534
631 actor port_id: 1
632 actor port_priority: 65535
633 actor key: 2
634 actor state: activity timeout aggregation synchronized collecting distributing
635
636 partner sys_id: aa:66:aa:66:00:00
637 partner sys_priority: 65534
638 partner port_id: 3
639 partner port_priority: 65535
640 partner key: 4
641 partner state: activity timeout aggregation synchronized collecting distributing
642
643 slave: p1: current attached
644 port_id: 2
645 port_priority: 65535
646 may_enable: true
647
648 actor sys_id: aa:55:aa:55:00:00
649 actor sys_priority: 65534
650 actor port_id: 2
651 actor port_priority: 65535
652 actor key: 2
653 actor state: activity timeout aggregation synchronized collecting distributing
654
655 partner sys_id: aa:66:aa:66:00:00
656 partner sys_priority: 65534
657 partner port_id: 4
658 partner port_priority: 65535
659 partner key: 4
660 partner state: activity timeout aggregation synchronized collecting distributing
661 ---- bond1 ----
662 status: active negotiated
663 sys_id: aa:66:aa:66:00:00
664 sys_priority: 65534
665 aggregation key: 4
666 lacp_time: fast
667
668 slave: p2: current attached
669 port_id: 3
670 port_priority: 65535
671 may_enable: true
672
673 actor sys_id: aa:66:aa:66:00:00
674 actor sys_priority: 65534
675 actor port_id: 3
676 actor port_priority: 65535
677 actor key: 4
678 actor state: activity timeout aggregation synchronized collecting distributing
679
680 partner sys_id: aa:55:aa:55:00:00
681 partner sys_priority: 65534
682 partner port_id: 1
683 partner port_priority: 65535
684 partner key: 2
685 partner state: activity timeout aggregation synchronized collecting distributing
686
687 slave: p3: current attached
688 port_id: 4
689 port_priority: 65535
690 may_enable: true
691
692 actor sys_id: aa:66:aa:66:00:00
693 actor sys_priority: 65534
694 actor port_id: 4
695 actor port_priority: 65535
696 actor key: 4
697 actor state: activity timeout aggregation synchronized collecting distributing
698
699 partner sys_id: aa:55:aa:55:00:00
700 partner sys_priority: 65534
701 partner port_id: 2
702 partner port_priority: 65535
703 partner key: 2
704 partner state: activity timeout aggregation synchronized collecting distributing
705 ---- bond0 ----
706 bond_mode: balance-tcp
707 bond may use recirculation: yes, <del>
708 bond-hash-basis: 0
709 lb_output action: disabled, bond-id: -1
710 updelay: 0 ms
711 downdelay: 0 ms
712 lacp_status: negotiated
713 lacp_fallback_ab: false
714 active-backup primary: <none>
715 <active slave mac del>
716
717 slave p0: enabled
718 may_enable: true
719
720 slave p1: enabled
721 active slave
722 may_enable: true
723
724 ---- bond1 ----
725 bond_mode: balance-tcp
726 bond may use recirculation: yes, <del>
727 bond-hash-basis: 0
728 lb_output action: disabled, bond-id: -1
729 updelay: 0 ms
730 downdelay: 0 ms
731 lacp_status: negotiated
732 lacp_fallback_ab: false
733 active-backup primary: <none>
734 <active slave mac del>
735
736 slave p2: enabled
737 may_enable: true
738
739 slave p3: enabled
740 active slave
741 may_enable: true
742
743 ])
744
745 OVS_VSWITCHD_STOP
746 AT_CLEANUP
747
748 # test lacp liveness propagation - OF1.3.
749 AT_SETUP([lacp - liveness propagation - OF1.3])
750 OVS_VSWITCHD_START
751 AT_CHECK([ovs-ofctl -O OpenFlow13 -P standard monitor br0 --detach --no-chdir --pidfile])
752 check_liveness () {
753 printf '\n\n--- check_liveness %d ---\n\n\n' $1
754 shift
755
756 echo >>expout "OFPT_PORT_STATUS (OF1.3): MOD: 1(p0): addr:
757 config: 0
758 state: $1
759 speed: 0 Mbps now, 0 Mbps max"
760
761 AT_CHECK(
762 [[sed '
763 s/ (xid=0x[0-9a-fA-F]*)//
764 s/ *duration.*//
765 s/addr:[0-9a-fA-F:]*/addr:/' < monitor.log|grep -A3 "MOD: 1(p0)"|grep -ve --]],
766 [0], [expout])
767 }
768 : > expout
769 ovs-appctl -t ovs-ofctl ofctl/barrier
770 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
771 # Set miss_send_len to 128, enabling port_status messages to our service connection.
772 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
773
774 # Create bond0 on br0 with interfaces p0 and p1
775 # and bond1 on br1 with interfaces p2 and p3
776 # with p0 patched to p2 and p1 patched to p3.
777 AT_CHECK([ovs-vsctl add-bond br0 bond0 p0 p1 bond_mode=balance-tcp lacp=active \
778 other-config:lacp-time=fast \
779 other-config:bond-rebalance-interval=0 -- \
780 set interface p0 type=patch options:peer=p2 ofport_request=1 \
781 other-config:lacp-aggregation-key=2 -- \
782 set interface p1 type=patch options:peer=p3 ofport_request=2 \
783 other-config:lacp-aggregation-key=2 -- \
784 add-br br1 -- \
785 set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
786 set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
787 fail-mode=secure -- \
788 add-bond br1 bond1 p2 p3 bond_mode=balance-tcp lacp=active \
789 other-config:lacp-time=fast \
790 other-config:bond-rebalance-interval=0 -- \
791 set interface p2 type=patch options:peer=p0 ofport_request=3 \
792 other-config:lacp-aggregation-key=4 -- \
793 set interface p3 type=patch options:peer=p1 ofport_request=4 \
794 other-config:lacp-aggregation-key=4 --])
795
796 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
797 ])
798 ovs-appctl time/stop
799
800 # Wait for up to 5 (simulated) seconds, until LACP negotiation finishes.
801 i=0
802 while :; do
803 ovs-appctl lacp/show bond0 > bond0
804 AT_CAPTURE_FILE([bond0])
805 ovs-appctl lacp/show bond1 > bond1
806 AT_CAPTURE_FILE([bond1])
807 if grep negotiated bond0 && grep negotiated bond1; then
808 if grep expired bond0 || grep expired bond1; then
809 :
810 else
811 break
812 fi
813 fi
814 i=`expr $i + 1`
815 if test $i = 50; then
816 AT_FAIL_IF([:])
817 fi
818 ovs-appctl time/warp 100
819 done
820 check_liveness 1 LIVE
821
822 # Makes LACP state "expired" for p0 and p2.
823 AT_CHECK([ovs-vsctl \
824 -- add-port br0 null0 -- set int null0 type=patch options:peer=p2 -- set int p2 options:peer=null0 \
825 -- add-port br1 null1 -- set int null1 type=patch options:peer=p0 -- set int p0 options:peer=null1])
826
827 # Wait 4 more simulated seconds. The LACP state should become "defaulted" for p0 and p2.
828 ovs-appctl time/warp 4100 100
829 check_liveness 3 0
830
831 # Reconnect the patch link between p0 and p2 to allow traffic between the ports.
832 AT_CHECK([ovs-vsctl \
833 -- del-port null0 -- set int p2 options:peer=p0 \
834 -- del-port null1 -- set int p0 options:peer=p2])
835
836 # Wait for 30 more seconds (LACP_SLOW_TIME_TX) for the lacp to renegotiate
837 ovs-appctl time/warp 30100 100
838 check_liveness 3 LIVE
839
840 OVS_VSWITCHD_STOP
841 AT_CLEANUP
842
843 # test lacp liveness propagation - OF1.4.
844 AT_SETUP([lacp - liveness propagation - OF1.4])
845 OVS_VSWITCHD_START
846 AT_CHECK([ovs-ofctl -O OpenFlow14 -P standard monitor br0 --detach --no-chdir --pidfile])
847 check_liveness () {
848 printf '\n\n--- check_liveness %d ---\n\n\n' $1
849 shift
850
851 echo >>expout "OFPT_PORT_STATUS (OF1.4): MOD: 1(p0): addr:
852 config: 0
853 state: $1
854 speed: 0 Mbps now, 0 Mbps max"
855
856 AT_CHECK(
857 [[sed '
858 s/ (xid=0x[0-9a-fA-F]*)//
859 s/ *duration.*//
860 s/addr:[0-9a-fA-F:]*/addr:/' < monitor.log|grep -A3 "MOD: 1(p0)"|grep -ve --]],
861 [0], [expout])
862 }
863 : > expout
864 ovs-appctl -t ovs-ofctl ofctl/barrier
865 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
866 # Set miss_send_len to 128, enabling port_status messages to our service connection.
867 ovs-appctl -t ovs-ofctl ofctl/send 0509000c0123456700000080
868
869 # Create bond0 on br0 with interfaces p0 and p1
870 # and bond1 on br1 with interfaces p2 and p3
871 # with p0 patched to p2 and p1 patched to p3.
872 AT_CHECK([ovs-vsctl add-bond br0 bond0 p0 p1 bond_mode=balance-tcp lacp=active \
873 other-config:lacp-time=fast \
874 other-config:bond-rebalance-interval=0 -- \
875 set interface p0 type=patch options:peer=p2 ofport_request=1 \
876 other-config:lacp-aggregation-key=2 -- \
877 set interface p1 type=patch options:peer=p3 ofport_request=2 \
878 other-config:lacp-aggregation-key=2 -- \
879 add-br br1 -- \
880 set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
881 set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
882 fail-mode=secure -- \
883 add-bond br1 bond1 p2 p3 bond_mode=balance-tcp lacp=active \
884 other-config:lacp-time=fast \
885 other-config:bond-rebalance-interval=0 -- \
886 set interface p2 type=patch options:peer=p0 ofport_request=3 \
887 other-config:lacp-aggregation-key=4 -- \
888 set interface p3 type=patch options:peer=p1 ofport_request=4 \
889 other-config:lacp-aggregation-key=4 --])
890
891 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
892 ])
893 ovs-appctl time/stop
894
895 # Wait for up to 5 (simulated) seconds, until LACP negotiation finishes.
896 i=0
897 while :; do
898 ovs-appctl lacp/show bond0 > bond0
899 AT_CAPTURE_FILE([bond0])
900 ovs-appctl lacp/show bond1 > bond1
901 AT_CAPTURE_FILE([bond1])
902 if grep negotiated bond0 && grep negotiated bond1; then
903 if grep expired bond0 || grep expired bond1; then
904 :
905 else
906 break
907 fi
908 fi
909 i=`expr $i + 1`
910 if test $i = 50; then
911 AT_FAIL_IF([:])
912 fi
913 ovs-appctl time/warp 100
914 done
915 check_liveness 1 LIVE
916
917 # Makes LACP state "expired" for p0 and p2.
918 AT_CHECK([ovs-vsctl \
919 -- add-port br0 null0 -- set int null0 type=patch options:peer=p2 -- set int p2 options:peer=null0 \
920 -- add-port br1 null1 -- set int null1 type=patch options:peer=p0 -- set int p0 options:peer=null1])
921
922 # Wait 4 more simulated seconds. The LACP state should become "defaulted" for p0 and p2.
923 ovs-appctl time/warp 4100 100
924 check_liveness 3 0
925
926 # Reconnect the patch link between p0 and p2 to allow traffic between the ports.
927 AT_CHECK([ovs-vsctl \
928 -- del-port null0 -- set int p2 options:peer=p0 \
929 -- del-port null1 -- set int p0 options:peer=p2])
930
931 # Wait for 30 more seconds (LACP_SLOW_TIME_TX) for the lacp to renegotiate
932 ovs-appctl time/warp 30100 100
933 check_liveness 3 LIVE
934
935 OVS_VSWITCHD_STOP
936 AT_CLEANUP
937
938 # test lacp liveness propagation - OF1.5.
939 AT_SETUP([lacp - liveness propagation - OF1.5])
940 OVS_VSWITCHD_START
941 AT_CHECK([ovs-ofctl -O OpenFlow15 -P standard monitor br0 --detach --no-chdir --pidfile])
942 check_liveness () {
943 printf '\n\n--- check_liveness %d ---\n\n\n' $1
944 shift
945
946 echo >>expout "OFPT_PORT_STATUS (OF1.5): MOD: 1(p0): addr:
947 config: 0
948 state: $1
949 speed: 0 Mbps now, 0 Mbps max"
950
951 AT_CHECK(
952 [[sed '
953 s/ (xid=0x[0-9a-fA-F]*)//
954 s/ *duration.*//
955 s/addr:[0-9a-fA-F:]*/addr:/' < monitor.log|grep -A3 "MOD: 1(p0)"|grep -ve --]],
956 [0], [expout])
957 }
958 : > expout
959 ovs-appctl -t ovs-ofctl ofctl/barrier
960 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
961 # Set miss_send_len to 128, enabling port_status messages to our service connection.
962 ovs-appctl -t ovs-ofctl ofctl/send 0609000c0123456700000080
963
964 # Create bond0 on br0 with interfaces p0 and p1
965 # and bond1 on br1 with interfaces p2 and p3
966 # with p0 patched to p2 and p1 patched to p3.
967 AT_CHECK([ovs-vsctl add-bond br0 bond0 p0 p1 bond_mode=balance-tcp lacp=active \
968 other-config:lacp-time=fast \
969 other-config:bond-rebalance-interval=0 -- \
970 set interface p0 type=patch options:peer=p2 ofport_request=1 \
971 other-config:lacp-aggregation-key=2 -- \
972 set interface p1 type=patch options:peer=p3 ofport_request=2 \
973 other-config:lacp-aggregation-key=2 -- \
974 add-br br1 -- \
975 set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
976 set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
977 fail-mode=secure -- \
978 add-bond br1 bond1 p2 p3 bond_mode=balance-tcp lacp=active \
979 other-config:lacp-time=fast \
980 other-config:bond-rebalance-interval=0 -- \
981 set interface p2 type=patch options:peer=p0 ofport_request=3 \
982 other-config:lacp-aggregation-key=4 -- \
983 set interface p3 type=patch options:peer=p1 ofport_request=4 \
984 other-config:lacp-aggregation-key=4 --])
985
986 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
987 ])
988 ovs-appctl time/stop
989
990 # Wait for up to 5 (simulated) seconds, until LACP negotiation finishes.
991 i=0
992 while :; do
993 ovs-appctl lacp/show bond0 > bond0
994 AT_CAPTURE_FILE([bond0])
995 ovs-appctl lacp/show bond1 > bond1
996 AT_CAPTURE_FILE([bond1])
997 if grep negotiated bond0 && grep negotiated bond1; then
998 if grep expired bond0 || grep expired bond1; then
999 :
1000 else
1001 break
1002 fi
1003 fi
1004 i=`expr $i + 1`
1005 if test $i = 50; then
1006 AT_FAIL_IF([:])
1007 fi
1008 ovs-appctl time/warp 100
1009 done
1010 check_liveness 1 LIVE
1011
1012 # Makes LACP state "expired" for p0 and p2.
1013 AT_CHECK([ovs-vsctl \
1014 -- add-port br0 null0 -- set int null0 type=patch options:peer=p2 -- set int p2 options:peer=null0 \
1015 -- add-port br1 null1 -- set int null1 type=patch options:peer=p0 -- set int p0 options:peer=null1])
1016
1017 # Wait 4 more simulated seconds. The LACP state should become "defaulted" for p0 and p2.
1018 ovs-appctl time/warp 4100 100
1019 check_liveness 3 0
1020
1021 # Reconnect the patch link between p0 and p2 to allow traffic between the ports.
1022 AT_CHECK([ovs-vsctl \
1023 -- del-port null0 -- set int p2 options:peer=p0 \
1024 -- del-port null1 -- set int p0 options:peer=p2])
1025
1026 # Wait for 30 more seconds (LACP_SLOW_TIME_TX) for the lacp to renegotiate
1027 ovs-appctl time/warp 30100 100
1028 check_liveness 3 LIVE
1029
1030 OVS_VSWITCHD_STOP
1031 AT_CLEANUP