]> git.proxmox.com Git - mirror_ovs.git/blob - tests/lacp.at
lib/ofpbuf: Compact
[mirror_ovs.git] / tests / lacp.at
1 AT_BANNER([lacp])
2
3 AT_SETUP([lacp - config])
4 OVS_VSWITCHD_START([\
5 add-port br0 p1 --\
6 set Port p1 lacp=active --\
7 set Interface p1 type=dummy ])
8
9 ovs-appctl time/stop
10 ovs-appctl time/warp 100
11 ovs-appctl time/warp 100
12 ovs-appctl time/warp 100
13
14 AT_CHECK([ovs-appctl lacp/show], [0], [dnl
15 ---- p1 ----
16 status: active negotiated
17 sys_id: aa:55:aa:55:00:00
18 sys_priority: 65535
19 aggregation key: 1
20 lacp_time: slow
21
22 slave: p1: expired attached
23 port_id: 1
24 port_priority: 65535
25 may_enable: false
26
27 actor sys_id: aa:55:aa:55:00:00
28 actor sys_priority: 65535
29 actor port_id: 1
30 actor port_priority: 65535
31 actor key: 1
32 actor state: activity synchronized collecting distributing expired
33
34 partner sys_id: 00:00:00:00:00:00
35 partner sys_priority: 0
36 partner port_id: 0
37 partner port_priority: 0
38 partner key: 0
39 partner state: timeout
40 ])
41 AT_CHECK([ovs-appctl bond/show])
42 OVS_VSWITCHD_STOP
43 AT_CLEANUP
44
45 AT_SETUP([lacp - multi port config])
46 OVS_VSWITCHD_START([dnl
47 add-bond br0 bond p1 p2 --\
48 set Port bond lacp=active bond-mode=active-backup \
49 other_config:lacp-time="fast" \
50 other_config:lacp-system-id=11:22:33:44:55:66 \
51 other_config:lacp-system-priority=54321 --\
52 set Interface p1 type=dummy \
53 other_config:lacp-port-id=11 \
54 other_config:lacp-port-priority=111 \
55 other_config:lacp-aggregation-key=3333 --\
56 set Interface p2 type=dummy \
57 other_config:lacp-port-id=22 \
58 other_config:lacp-port-priority=222 \
59 other_config:lacp-aggregation-key=3333 ])
60
61 ovs-appctl time/stop
62 ovs-appctl time/warp 100
63 ovs-appctl time/warp 100
64 ovs-appctl time/warp 100
65
66 AT_CHECK([ovs-appctl lacp/show], [0], [stdout])
67 AT_CHECK([sed -e 's/aggregation key:.*/aggregation key: <omitted>/' < stdout], [0], [dnl
68 ---- bond ----
69 status: active negotiated
70 sys_id: 11:22:33:44:55:66
71 sys_priority: 54321
72 aggregation key: <omitted>
73 lacp_time: fast
74
75 slave: p1: expired attached
76 port_id: 11
77 port_priority: 111
78 may_enable: false
79
80 actor sys_id: 11:22:33:44:55:66
81 actor sys_priority: 54321
82 actor port_id: 11
83 actor port_priority: 111
84 actor key: 3333
85 actor state: activity timeout aggregation synchronized collecting distributing expired
86
87 partner sys_id: 00:00:00:00:00:00
88 partner sys_priority: 0
89 partner port_id: 0
90 partner port_priority: 0
91 partner key: 0
92 partner state: timeout
93
94 slave: p2: expired attached
95 port_id: 22
96 port_priority: 222
97 may_enable: false
98
99 actor sys_id: 11:22:33:44:55:66
100 actor sys_priority: 54321
101 actor port_id: 22
102 actor port_priority: 222
103 actor key: 3333
104 actor state: activity timeout aggregation synchronized collecting distributing expired
105
106 partner sys_id: 00:00:00:00:00:00
107 partner sys_priority: 0
108 partner port_id: 0
109 partner port_priority: 0
110 partner key: 0
111 partner state: timeout
112 ])
113 AT_CHECK([ovs-appctl bond/show], [0], [dnl
114 ---- bond ----
115 bond_mode: active-backup
116 bond-hash-basis: 0
117 updelay: 0 ms
118 downdelay: 0 ms
119 lacp_status: negotiated
120
121 slave p1: disabled
122 may_enable: false
123
124 slave p2: disabled
125 may_enable: false
126
127 ])
128 OVS_VSWITCHD_STOP
129 AT_CLEANUP
130
131 AT_SETUP([lacp - negotiation])
132 # Create bond0 on br0 with interfaces p0 and p1
133 # and bond1 on br1 with interfaces p2 and p3
134 # with p0 patched to p2 and p1 patched to p3.
135 OVS_VSWITCHD_START(
136 [add-bond br0 bond0 p0 p1 bond_mode=balance-tcp lacp=active \
137 other-config:lacp-time=fast \
138 other-config:bond-rebalance-interval=0 -- \
139 set interface p0 type=patch options:peer=p2 ofport_request=1 \
140 other-config:lacp-aggregation-key=2 -- \
141 set interface p1 type=patch options:peer=p3 ofport_request=2 \
142 other-config:lacp-aggregation-key=2 -- \
143 add-br br1 -- \
144 set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
145 set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
146 fail-mode=secure -- \
147 add-bond br1 bond1 p2 p3 bond_mode=balance-tcp lacp=active \
148 other-config:lacp-time=fast \
149 other-config:bond-rebalance-interval=0 -- \
150 set interface p2 type=patch options:peer=p0 ofport_request=3 \
151 other-config:lacp-aggregation-key=4 -- \
152 set interface p3 type=patch options:peer=p1 ofport_request=4 \
153 other-config:lacp-aggregation-key=4 --])
154
155 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
156 ])
157
158 ovs-appctl time/stop
159
160 # Wait for up to 5 (simulated) seconds, until LACP negotiation finishes.
161 i=0
162 while :; do
163 ovs-appctl lacp/show bond0 > bond0
164 AT_CAPTURE_FILE([bond0])
165 ovs-appctl lacp/show bond1 > bond1
166 AT_CAPTURE_FILE([bond1])
167 if grep negotiated bond0 && grep negotiated bond1; then
168 if grep expired bond0 || grep expired bond1; then
169 :
170 else
171 break
172 fi
173 fi
174 i=`expr $i + 1`
175 if test $i = 50; then
176 AT_FAIL_IF([:])
177 fi
178 ovs-appctl time/warp 100
179 done
180
181 # Now check the correctly negotiated configuration.
182 AT_CHECK(
183 [ovs-appctl lacp/show bond0
184 ovs-appctl lacp/show bond1
185 ovs-appctl bond/show bond0
186 ovs-appctl bond/show bond1], [0], [stdout])
187 AT_CHECK([sed '/active slave/d' stdout], [0], [dnl
188 ---- bond0 ----
189 status: active negotiated
190 sys_id: aa:55:aa:55:00:00
191 sys_priority: 65534
192 aggregation key: 2
193 lacp_time: fast
194
195 slave: p0: current attached
196 port_id: 1
197 port_priority: 65535
198 may_enable: true
199
200 actor sys_id: aa:55:aa:55:00:00
201 actor sys_priority: 65534
202 actor port_id: 1
203 actor port_priority: 65535
204 actor key: 2
205 actor state: activity timeout aggregation synchronized collecting distributing
206
207 partner sys_id: aa:66:aa:66:00:00
208 partner sys_priority: 65534
209 partner port_id: 3
210 partner port_priority: 65535
211 partner key: 4
212 partner state: activity timeout aggregation synchronized collecting distributing
213
214 slave: p1: current attached
215 port_id: 2
216 port_priority: 65535
217 may_enable: true
218
219 actor sys_id: aa:55:aa:55:00:00
220 actor sys_priority: 65534
221 actor port_id: 2
222 actor port_priority: 65535
223 actor key: 2
224 actor state: activity timeout aggregation synchronized collecting distributing
225
226 partner sys_id: aa:66:aa:66:00:00
227 partner sys_priority: 65534
228 partner port_id: 4
229 partner port_priority: 65535
230 partner key: 4
231 partner state: activity timeout aggregation synchronized collecting distributing
232 ---- bond1 ----
233 status: active negotiated
234 sys_id: aa:66:aa:66:00:00
235 sys_priority: 65534
236 aggregation key: 4
237 lacp_time: fast
238
239 slave: p2: current attached
240 port_id: 3
241 port_priority: 65535
242 may_enable: true
243
244 actor sys_id: aa:66:aa:66:00:00
245 actor sys_priority: 65534
246 actor port_id: 3
247 actor port_priority: 65535
248 actor key: 4
249 actor state: activity timeout aggregation synchronized collecting distributing
250
251 partner sys_id: aa:55:aa:55:00:00
252 partner sys_priority: 65534
253 partner port_id: 1
254 partner port_priority: 65535
255 partner key: 2
256 partner state: activity timeout aggregation synchronized collecting distributing
257
258 slave: p3: current attached
259 port_id: 4
260 port_priority: 65535
261 may_enable: true
262
263 actor sys_id: aa:66:aa:66:00:00
264 actor sys_priority: 65534
265 actor port_id: 4
266 actor port_priority: 65535
267 actor key: 4
268 actor state: activity timeout aggregation synchronized collecting distributing
269
270 partner sys_id: aa:55:aa:55:00:00
271 partner sys_priority: 65534
272 partner port_id: 2
273 partner port_priority: 65535
274 partner key: 2
275 partner state: activity timeout aggregation synchronized collecting distributing
276 ---- bond0 ----
277 bond_mode: balance-tcp
278 bond-hash-basis: 0
279 updelay: 0 ms
280 downdelay: 0 ms
281 lacp_status: negotiated
282
283 slave p0: enabled
284 may_enable: true
285
286 slave p1: enabled
287 may_enable: true
288
289 ---- bond1 ----
290 bond_mode: balance-tcp
291 bond-hash-basis: 0
292 updelay: 0 ms
293 downdelay: 0 ms
294 lacp_status: negotiated
295
296 slave p2: enabled
297 may_enable: true
298
299 slave p3: enabled
300 may_enable: true
301
302 ])
303 AT_CHECK([grep 'active slave' stdout], [0], [dnl
304 active slave
305 active slave
306 ])
307
308 # Redirect the patch link between p0 and p2 so that no packets get
309 # back and forth across them anymore. Then wait 4 simulated
310 # seconds. The LACP state should become "expired" for p0 and p2.
311 AT_CHECK([ovs-vsctl \
312 -- add-port br0 null0 -- set int null0 type=patch options:peer=p2 -- set int p2 options:peer=null0 \
313 -- add-port br1 null1 -- set int null1 type=patch options:peer=p0 -- set int p0 options:peer=null1])
314
315 for i in `seq 0 40`; do ovs-appctl time/warp 100; done
316 AT_CHECK(
317 [ovs-appctl lacp/show bond0
318 ovs-appctl lacp/show bond1
319 ovs-appctl bond/show bond0
320 ovs-appctl bond/show bond1], [0], [dnl
321 ---- bond0 ----
322 status: active negotiated
323 sys_id: aa:55:aa:55:00:00
324 sys_priority: 65534
325 aggregation key: 2
326 lacp_time: fast
327
328 slave: p0: expired attached
329 port_id: 1
330 port_priority: 65535
331 may_enable: false
332
333 actor sys_id: aa:55:aa:55:00:00
334 actor sys_priority: 65534
335 actor port_id: 1
336 actor port_priority: 65535
337 actor key: 2
338 actor state: activity timeout aggregation synchronized collecting distributing expired
339
340 partner sys_id: aa:66:aa:66:00:00
341 partner sys_priority: 65534
342 partner port_id: 3
343 partner port_priority: 65535
344 partner key: 4
345 partner state: activity timeout aggregation collecting distributing
346
347 slave: p1: current attached
348 port_id: 2
349 port_priority: 65535
350 may_enable: true
351
352 actor sys_id: aa:55:aa:55:00:00
353 actor sys_priority: 65534
354 actor port_id: 2
355 actor port_priority: 65535
356 actor key: 2
357 actor state: activity timeout aggregation synchronized collecting distributing
358
359 partner sys_id: aa:66:aa:66:00:00
360 partner sys_priority: 65534
361 partner port_id: 4
362 partner port_priority: 65535
363 partner key: 4
364 partner state: activity timeout aggregation synchronized collecting distributing
365 ---- bond1 ----
366 status: active negotiated
367 sys_id: aa:66:aa:66:00:00
368 sys_priority: 65534
369 aggregation key: 4
370 lacp_time: fast
371
372 slave: p2: expired attached
373 port_id: 3
374 port_priority: 65535
375 may_enable: false
376
377 actor sys_id: aa:66:aa:66:00:00
378 actor sys_priority: 65534
379 actor port_id: 3
380 actor port_priority: 65535
381 actor key: 4
382 actor state: activity timeout aggregation synchronized collecting distributing expired
383
384 partner sys_id: aa:55:aa:55:00:00
385 partner sys_priority: 65534
386 partner port_id: 1
387 partner port_priority: 65535
388 partner key: 2
389 partner state: activity timeout aggregation collecting distributing
390
391 slave: p3: current attached
392 port_id: 4
393 port_priority: 65535
394 may_enable: true
395
396 actor sys_id: aa:66:aa:66:00:00
397 actor sys_priority: 65534
398 actor port_id: 4
399 actor port_priority: 65535
400 actor key: 4
401 actor state: activity timeout aggregation synchronized collecting distributing
402
403 partner sys_id: aa:55:aa:55:00:00
404 partner sys_priority: 65534
405 partner port_id: 2
406 partner port_priority: 65535
407 partner key: 2
408 partner state: activity timeout aggregation synchronized collecting distributing
409 ---- bond0 ----
410 bond_mode: balance-tcp
411 bond-hash-basis: 0
412 updelay: 0 ms
413 downdelay: 0 ms
414 lacp_status: negotiated
415
416 slave p0: disabled
417 may_enable: false
418
419 slave p1: enabled
420 active slave
421 may_enable: true
422
423 ---- bond1 ----
424 bond_mode: balance-tcp
425 bond-hash-basis: 0
426 updelay: 0 ms
427 downdelay: 0 ms
428 lacp_status: negotiated
429
430 slave p2: disabled
431 may_enable: false
432
433 slave p3: enabled
434 active slave
435 may_enable: true
436
437 ])
438
439 # Wait 4 more simulated seconds. The LACP state should become
440 # "defaulted" for p0 and p2.
441 for i in `seq 0 40`; do ovs-appctl time/warp 100; done
442 AT_CHECK(
443 [ovs-appctl lacp/show bond0
444 ovs-appctl lacp/show bond1
445 ovs-appctl bond/show bond0
446 ovs-appctl bond/show bond1], [0], [dnl
447 ---- bond0 ----
448 status: active negotiated
449 sys_id: aa:55:aa:55:00:00
450 sys_priority: 65534
451 aggregation key: 2
452 lacp_time: fast
453
454 slave: p0: defaulted detached
455 port_id: 1
456 port_priority: 65535
457 may_enable: false
458
459 actor sys_id: aa:55:aa:55:00:00
460 actor sys_priority: 65534
461 actor port_id: 1
462 actor port_priority: 65535
463 actor key: 2
464 actor state: activity timeout aggregation defaulted
465
466 partner sys_id: 00:00:00:00:00:00
467 partner sys_priority: 0
468 partner port_id: 0
469 partner port_priority: 0
470 partner key: 0
471 partner state:
472
473 slave: p1: current attached
474 port_id: 2
475 port_priority: 65535
476 may_enable: true
477
478 actor sys_id: aa:55:aa:55:00:00
479 actor sys_priority: 65534
480 actor port_id: 2
481 actor port_priority: 65535
482 actor key: 2
483 actor state: activity timeout aggregation synchronized collecting distributing
484
485 partner sys_id: aa:66:aa:66:00:00
486 partner sys_priority: 65534
487 partner port_id: 4
488 partner port_priority: 65535
489 partner key: 4
490 partner state: activity timeout aggregation synchronized collecting distributing
491 ---- bond1 ----
492 status: active negotiated
493 sys_id: aa:66:aa:66:00:00
494 sys_priority: 65534
495 aggregation key: 4
496 lacp_time: fast
497
498 slave: p2: defaulted detached
499 port_id: 3
500 port_priority: 65535
501 may_enable: false
502
503 actor sys_id: aa:66:aa:66:00:00
504 actor sys_priority: 65534
505 actor port_id: 3
506 actor port_priority: 65535
507 actor key: 4
508 actor state: activity timeout aggregation defaulted
509
510 partner sys_id: 00:00:00:00:00:00
511 partner sys_priority: 0
512 partner port_id: 0
513 partner port_priority: 0
514 partner key: 0
515 partner state:
516
517 slave: p3: current attached
518 port_id: 4
519 port_priority: 65535
520 may_enable: true
521
522 actor sys_id: aa:66:aa:66:00:00
523 actor sys_priority: 65534
524 actor port_id: 4
525 actor port_priority: 65535
526 actor key: 4
527 actor state: activity timeout aggregation synchronized collecting distributing
528
529 partner sys_id: aa:55:aa:55:00:00
530 partner sys_priority: 65534
531 partner port_id: 2
532 partner port_priority: 65535
533 partner key: 2
534 partner state: activity timeout aggregation synchronized collecting distributing
535 ---- bond0 ----
536 bond_mode: balance-tcp
537 bond-hash-basis: 0
538 updelay: 0 ms
539 downdelay: 0 ms
540 lacp_status: negotiated
541
542 slave p0: disabled
543 may_enable: false
544
545 slave p1: enabled
546 active slave
547 may_enable: true
548
549 ---- bond1 ----
550 bond_mode: balance-tcp
551 bond-hash-basis: 0
552 updelay: 0 ms
553 downdelay: 0 ms
554 lacp_status: negotiated
555
556 slave p2: disabled
557 may_enable: false
558
559 slave p3: enabled
560 active slave
561 may_enable: true
562
563 ])
564 OVS_VSWITCHD_STOP
565 AT_CLEANUP