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