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