]> git.proxmox.com Git - mirror_ovs.git/blob - tests/lacp.at
AUTHORS: Add Shu Shen.
[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 active slave mac: 00:00:00:00:00:00(none)
128
129 slave p1: disabled
130 may_enable: false
131
132 slave p2: disabled
133 may_enable: false
134
135 ])
136 OVS_VSWITCHD_STOP
137 AT_CLEANUP
138
139 AT_SETUP([lacp - negotiation])
140 # Create bond0 on br0 with interfaces p0 and p1
141 # and bond1 on br1 with interfaces p2 and p3
142 # with p0 patched to p2 and p1 patched to p3.
143 OVS_VSWITCHD_START(
144 [add-bond br0 bond0 p0 p1 bond_mode=balance-tcp lacp=active \
145 other-config:lacp-time=fast \
146 other-config:bond-rebalance-interval=0 -- \
147 set interface p0 type=patch options:peer=p2 ofport_request=1 \
148 other-config:lacp-aggregation-key=2 -- \
149 set interface p1 type=patch options:peer=p3 ofport_request=2 \
150 other-config:lacp-aggregation-key=2 -- \
151 add-br br1 -- \
152 set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
153 set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
154 fail-mode=secure -- \
155 add-bond br1 bond1 p2 p3 bond_mode=balance-tcp lacp=active \
156 other-config:lacp-time=fast \
157 other-config:bond-rebalance-interval=0 -- \
158 set interface p2 type=patch options:peer=p0 ofport_request=3 \
159 other-config:lacp-aggregation-key=4 -- \
160 set interface p3 type=patch options:peer=p1 ofport_request=4 \
161 other-config:lacp-aggregation-key=4 --])
162
163 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
164 ])
165
166 ovs-appctl time/stop
167
168 # Wait for up to 5 (simulated) seconds, until LACP negotiation finishes.
169 i=0
170 while :; do
171 ovs-appctl lacp/show bond0 > bond0
172 AT_CAPTURE_FILE([bond0])
173 ovs-appctl lacp/show bond1 > bond1
174 AT_CAPTURE_FILE([bond1])
175 if grep negotiated bond0 && grep negotiated bond1; then
176 if grep expired bond0 || grep expired bond1; then
177 :
178 else
179 break
180 fi
181 fi
182 i=`expr $i + 1`
183 if test $i = 50; then
184 AT_FAIL_IF([:])
185 fi
186 ovs-appctl time/warp 100
187 done
188
189 # Now check the correctly negotiated configuration.
190 AT_CHECK(
191 [ovs-appctl lacp/show bond0
192 ovs-appctl lacp/show bond1
193 ovs-appctl bond/show bond0 | STRIP_RECIRC_ID | STRIP_ACTIVE_SLAVE_MAC
194 ovs-appctl bond/show bond1 | STRIP_RECIRC_ID | STRIP_ACTIVE_SLAVE_MAC ], [0], [stdout])
195 AT_CHECK([sed '/active slave/d' stdout], [0], [dnl
196 ---- bond0 ----
197 status: active negotiated
198 sys_id: aa:55:aa:55:00:00
199 sys_priority: 65534
200 aggregation key: 2
201 lacp_time: fast
202
203 slave: p0: current attached
204 port_id: 1
205 port_priority: 65535
206 may_enable: true
207
208 actor sys_id: aa:55:aa:55:00:00
209 actor sys_priority: 65534
210 actor port_id: 1
211 actor port_priority: 65535
212 actor key: 2
213 actor state: activity timeout aggregation synchronized collecting distributing
214
215 partner sys_id: aa:66:aa:66:00:00
216 partner sys_priority: 65534
217 partner port_id: 3
218 partner port_priority: 65535
219 partner key: 4
220 partner state: activity timeout aggregation synchronized collecting distributing
221
222 slave: p1: current attached
223 port_id: 2
224 port_priority: 65535
225 may_enable: true
226
227 actor sys_id: aa:55:aa:55:00:00
228 actor sys_priority: 65534
229 actor port_id: 2
230 actor port_priority: 65535
231 actor key: 2
232 actor state: activity timeout aggregation synchronized collecting distributing
233
234 partner sys_id: aa:66:aa:66:00:00
235 partner sys_priority: 65534
236 partner port_id: 4
237 partner port_priority: 65535
238 partner key: 4
239 partner state: activity timeout aggregation synchronized collecting distributing
240 ---- bond1 ----
241 status: active negotiated
242 sys_id: aa:66:aa:66:00:00
243 sys_priority: 65534
244 aggregation key: 4
245 lacp_time: fast
246
247 slave: p2: current attached
248 port_id: 3
249 port_priority: 65535
250 may_enable: true
251
252 actor sys_id: aa:66:aa:66:00:00
253 actor sys_priority: 65534
254 actor port_id: 3
255 actor port_priority: 65535
256 actor key: 4
257 actor state: activity timeout aggregation synchronized collecting distributing
258
259 partner sys_id: aa:55:aa:55:00:00
260 partner sys_priority: 65534
261 partner port_id: 1
262 partner port_priority: 65535
263 partner key: 2
264 partner state: activity timeout aggregation synchronized collecting distributing
265
266 slave: p3: current attached
267 port_id: 4
268 port_priority: 65535
269 may_enable: true
270
271 actor sys_id: aa:66:aa:66:00:00
272 actor sys_priority: 65534
273 actor port_id: 4
274 actor port_priority: 65535
275 actor key: 4
276 actor state: activity timeout aggregation synchronized collecting distributing
277
278 partner sys_id: aa:55:aa:55:00:00
279 partner sys_priority: 65534
280 partner port_id: 2
281 partner port_priority: 65535
282 partner key: 2
283 partner state: activity timeout aggregation synchronized collecting distributing
284 ---- bond0 ----
285 bond_mode: balance-tcp
286 bond may use recirculation: yes, <del>
287 bond-hash-basis: 0
288 updelay: 0 ms
289 downdelay: 0 ms
290 lacp_status: negotiated
291
292 slave p0: enabled
293 may_enable: true
294
295 slave p1: enabled
296 may_enable: true
297
298 ---- bond1 ----
299 bond_mode: balance-tcp
300 bond may use recirculation: yes, <del>
301 bond-hash-basis: 0
302 updelay: 0 ms
303 downdelay: 0 ms
304 lacp_status: negotiated
305
306 slave p2: enabled
307 may_enable: true
308
309 slave p3: enabled
310 may_enable: true
311
312 ])
313 AT_CHECK([grep 'active slave$' stdout], [0], [dnl
314 active slave
315 active slave
316 ])
317
318 # Redirect the patch link between p0 and p2 so that no packets get
319 # back and forth across them anymore. Then wait 4 simulated
320 # seconds. The LACP state should become "expired" for p0 and p2.
321 AT_CHECK([ovs-vsctl \
322 -- add-port br0 null0 -- set int null0 type=patch options:peer=p2 -- set int p2 options:peer=null0 \
323 -- add-port br1 null1 -- set int null1 type=patch options:peer=p0 -- set int p0 options:peer=null1])
324
325 ovs-appctl time/warp 4100 100
326 AT_CHECK(
327 [ovs-appctl lacp/show bond0
328 ovs-appctl lacp/show bond1
329 ovs-appctl bond/show bond0 | STRIP_RECIRC_ID | STRIP_ACTIVE_SLAVE_MAC
330 ovs-appctl bond/show bond1 | STRIP_RECIRC_ID | STRIP_ACTIVE_SLAVE_MAC ], [0], [dnl
331 ---- bond0 ----
332 status: active negotiated
333 sys_id: aa:55:aa:55:00:00
334 sys_priority: 65534
335 aggregation key: 2
336 lacp_time: fast
337
338 slave: p0: expired attached
339 port_id: 1
340 port_priority: 65535
341 may_enable: false
342
343 actor sys_id: aa:55:aa:55:00:00
344 actor sys_priority: 65534
345 actor port_id: 1
346 actor port_priority: 65535
347 actor key: 2
348 actor state: activity timeout aggregation synchronized collecting distributing expired
349
350 partner sys_id: aa:66:aa:66:00:00
351 partner sys_priority: 65534
352 partner port_id: 3
353 partner port_priority: 65535
354 partner key: 4
355 partner state: activity timeout aggregation collecting distributing
356
357 slave: p1: current attached
358 port_id: 2
359 port_priority: 65535
360 may_enable: true
361
362 actor sys_id: aa:55:aa:55:00:00
363 actor sys_priority: 65534
364 actor port_id: 2
365 actor port_priority: 65535
366 actor key: 2
367 actor state: activity timeout aggregation synchronized collecting distributing
368
369 partner sys_id: aa:66:aa:66:00:00
370 partner sys_priority: 65534
371 partner port_id: 4
372 partner port_priority: 65535
373 partner key: 4
374 partner state: activity timeout aggregation synchronized collecting distributing
375 ---- bond1 ----
376 status: active negotiated
377 sys_id: aa:66:aa:66:00:00
378 sys_priority: 65534
379 aggregation key: 4
380 lacp_time: fast
381
382 slave: p2: expired attached
383 port_id: 3
384 port_priority: 65535
385 may_enable: false
386
387 actor sys_id: aa:66:aa:66:00:00
388 actor sys_priority: 65534
389 actor port_id: 3
390 actor port_priority: 65535
391 actor key: 4
392 actor state: activity timeout aggregation synchronized collecting distributing expired
393
394 partner sys_id: aa:55:aa:55:00:00
395 partner sys_priority: 65534
396 partner port_id: 1
397 partner port_priority: 65535
398 partner key: 2
399 partner state: activity timeout aggregation collecting distributing
400
401 slave: p3: current attached
402 port_id: 4
403 port_priority: 65535
404 may_enable: true
405
406 actor sys_id: aa:66:aa:66:00:00
407 actor sys_priority: 65534
408 actor port_id: 4
409 actor port_priority: 65535
410 actor key: 4
411 actor state: activity timeout aggregation synchronized collecting distributing
412
413 partner sys_id: aa:55:aa:55:00:00
414 partner sys_priority: 65534
415 partner port_id: 2
416 partner port_priority: 65535
417 partner key: 2
418 partner state: activity timeout aggregation synchronized collecting distributing
419 ---- bond0 ----
420 bond_mode: balance-tcp
421 bond may use recirculation: yes, <del>
422 bond-hash-basis: 0
423 updelay: 0 ms
424 downdelay: 0 ms
425 lacp_status: negotiated
426 <active slave mac del>
427
428 slave p0: disabled
429 may_enable: false
430
431 slave p1: enabled
432 active slave
433 may_enable: true
434
435 ---- bond1 ----
436 bond_mode: balance-tcp
437 bond may use recirculation: yes, <del>
438 bond-hash-basis: 0
439 updelay: 0 ms
440 downdelay: 0 ms
441 lacp_status: negotiated
442 <active slave mac del>
443
444 slave p2: disabled
445 may_enable: false
446
447 slave p3: enabled
448 active slave
449 may_enable: true
450
451 ])
452
453 # Wait 4 more simulated seconds. The LACP state should become
454 # "defaulted" for p0 and p2.
455 ovs-appctl time/warp 4100 100
456 AT_CHECK(
457 [ovs-appctl lacp/show bond0
458 ovs-appctl lacp/show bond1
459 ovs-appctl bond/show bond0 | STRIP_RECIRC_ID | STRIP_ACTIVE_SLAVE_MAC
460 ovs-appctl bond/show bond1 | STRIP_RECIRC_ID | STRIP_ACTIVE_SLAVE_MAC ], [0], [dnl
461 ---- bond0 ----
462 status: active negotiated
463 sys_id: aa:55:aa:55:00:00
464 sys_priority: 65534
465 aggregation key: 2
466 lacp_time: fast
467
468 slave: p0: defaulted detached
469 port_id: 1
470 port_priority: 65535
471 may_enable: false
472
473 actor sys_id: aa:55:aa:55:00:00
474 actor sys_priority: 65534
475 actor port_id: 1
476 actor port_priority: 65535
477 actor key: 2
478 actor state: activity timeout aggregation defaulted
479
480 partner sys_id: 00:00:00:00:00:00
481 partner sys_priority: 0
482 partner port_id: 0
483 partner port_priority: 0
484 partner key: 0
485 partner state:
486
487 slave: p1: current attached
488 port_id: 2
489 port_priority: 65535
490 may_enable: true
491
492 actor sys_id: aa:55:aa:55:00:00
493 actor sys_priority: 65534
494 actor port_id: 2
495 actor port_priority: 65535
496 actor key: 2
497 actor state: activity timeout aggregation synchronized collecting distributing
498
499 partner sys_id: aa:66:aa:66:00:00
500 partner sys_priority: 65534
501 partner port_id: 4
502 partner port_priority: 65535
503 partner key: 4
504 partner state: activity timeout aggregation synchronized collecting distributing
505 ---- bond1 ----
506 status: active negotiated
507 sys_id: aa:66:aa:66:00:00
508 sys_priority: 65534
509 aggregation key: 4
510 lacp_time: fast
511
512 slave: p2: defaulted detached
513 port_id: 3
514 port_priority: 65535
515 may_enable: false
516
517 actor sys_id: aa:66:aa:66:00:00
518 actor sys_priority: 65534
519 actor port_id: 3
520 actor port_priority: 65535
521 actor key: 4
522 actor state: activity timeout aggregation defaulted
523
524 partner sys_id: 00:00:00:00:00:00
525 partner sys_priority: 0
526 partner port_id: 0
527 partner port_priority: 0
528 partner key: 0
529 partner state:
530
531 slave: p3: current attached
532 port_id: 4
533 port_priority: 65535
534 may_enable: true
535
536 actor sys_id: aa:66:aa:66:00:00
537 actor sys_priority: 65534
538 actor port_id: 4
539 actor port_priority: 65535
540 actor key: 4
541 actor state: activity timeout aggregation synchronized collecting distributing
542
543 partner sys_id: aa:55:aa:55:00:00
544 partner sys_priority: 65534
545 partner port_id: 2
546 partner port_priority: 65535
547 partner key: 2
548 partner state: activity timeout aggregation synchronized collecting distributing
549 ---- bond0 ----
550 bond_mode: balance-tcp
551 bond may use recirculation: yes, <del>
552 bond-hash-basis: 0
553 updelay: 0 ms
554 downdelay: 0 ms
555 lacp_status: negotiated
556 <active slave mac del>
557
558 slave p0: disabled
559 may_enable: false
560
561 slave p1: enabled
562 active slave
563 may_enable: true
564
565 ---- bond1 ----
566 bond_mode: balance-tcp
567 bond may use recirculation: yes, <del>
568 bond-hash-basis: 0
569 updelay: 0 ms
570 downdelay: 0 ms
571 lacp_status: negotiated
572 <active slave mac del>
573
574 slave p2: disabled
575 may_enable: false
576
577 slave p3: enabled
578 active slave
579 may_enable: true
580
581 ])
582 OVS_VSWITCHD_STOP
583 AT_CLEANUP