3 # Strips out Reciulation ID information since it may change over time.
4 m4_define([STRIP_RECIRC_ID], [[sed '
8 AT_SETUP([lacp - config])
11 set Port p1 lacp=active --\
12 set Interface p1 type=dummy ])
15 ovs-appctl time/warp 100
16 ovs-appctl time/warp 100
17 ovs-appctl time/warp 100
19 AT_CHECK([ovs-appctl lacp/show], [0], [dnl
21 status: active negotiated
22 sys_id: aa:55:aa:55:00:00
27 slave: p1: expired attached
32 actor sys_id: aa:55:aa:55:00:00
33 actor sys_priority: 65535
35 actor port_priority: 65535
37 actor state: activity synchronized collecting distributing expired
39 partner sys_id: 00:00:00:00:00:00
40 partner sys_priority: 0
42 partner port_priority: 0
44 partner state: timeout
46 AT_CHECK([ovs-appctl bond/show])
50 AT_SETUP([lacp - multi port config])
51 OVS_VSWITCHD_START([dnl
52 add-bond br0 bond p1 p2 --\
53 set Port bond lacp=active bond-mode=active-backup \
54 other_config:lacp-time="fast" \
55 other_config:lacp-system-id=11:22:33:44:55:66 \
56 other_config:lacp-system-priority=54321 --\
57 set Interface p1 type=dummy \
58 other_config:lacp-port-id=11 \
59 other_config:lacp-port-priority=111 \
60 other_config:lacp-aggregation-key=3333 --\
61 set Interface p2 type=dummy \
62 other_config:lacp-port-id=22 \
63 other_config:lacp-port-priority=222 \
64 other_config:lacp-aggregation-key=3333 ])
67 ovs-appctl time/warp 100
68 ovs-appctl time/warp 100
69 ovs-appctl time/warp 100
71 AT_CHECK([ovs-appctl lacp/show], [0], [stdout])
72 AT_CHECK([sed -e 's/aggregation key:.*/aggregation key: <omitted>/' < stdout], [0], [dnl
74 status: active negotiated
75 sys_id: 11:22:33:44:55:66
77 aggregation key: <omitted>
80 slave: p1: expired attached
85 actor sys_id: 11:22:33:44:55:66
86 actor sys_priority: 54321
88 actor port_priority: 111
90 actor state: activity timeout aggregation synchronized collecting distributing expired
92 partner sys_id: 00:00:00:00:00:00
93 partner sys_priority: 0
95 partner port_priority: 0
97 partner state: timeout
99 slave: p2: expired attached
104 actor sys_id: 11:22:33:44:55:66
105 actor sys_priority: 54321
107 actor port_priority: 222
109 actor state: activity timeout aggregation synchronized collecting distributing expired
111 partner sys_id: 00:00:00:00:00:00
112 partner sys_priority: 0
114 partner port_priority: 0
116 partner state: timeout
118 AT_CHECK([ovs-appctl bond/show], [0], [dnl
120 bond_mode: active-backup
121 bond may use recirculation: no, Recirc-ID : -1
125 lacp_status: negotiated
137 AT_SETUP([lacp - negotiation])
138 # Create bond0 on br0 with interfaces p0 and p1
139 # and bond1 on br1 with interfaces p2 and p3
140 # with p0 patched to p2 and p1 patched to p3.
142 [add-bond br0 bond0 p0 p1 bond_mode=balance-tcp lacp=active \
143 other-config:lacp-time=fast \
144 other-config:bond-rebalance-interval=0 -- \
145 set interface p0 type=patch options:peer=p2 ofport_request=1 \
146 other-config:lacp-aggregation-key=2 -- \
147 set interface p1 type=patch options:peer=p3 ofport_request=2 \
148 other-config:lacp-aggregation-key=2 -- \
150 set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
151 set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
152 fail-mode=secure -- \
153 add-bond br1 bond1 p2 p3 bond_mode=balance-tcp lacp=active \
154 other-config:lacp-time=fast \
155 other-config:bond-rebalance-interval=0 -- \
156 set interface p2 type=patch options:peer=p0 ofport_request=3 \
157 other-config:lacp-aggregation-key=4 -- \
158 set interface p3 type=patch options:peer=p1 ofport_request=4 \
159 other-config:lacp-aggregation-key=4 --])
161 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
166 # Wait for up to 5 (simulated) seconds, until LACP negotiation finishes.
169 ovs-appctl lacp/show bond0 > bond0
170 AT_CAPTURE_FILE([bond0])
171 ovs-appctl lacp/show bond1 > bond1
172 AT_CAPTURE_FILE([bond1])
173 if grep negotiated bond0 && grep negotiated bond1; then
174 if grep expired bond0 || grep expired bond1; then
181 if test $i = 50; then
184 ovs-appctl time/warp 100
187 # Now check the correctly negotiated configuration.
189 [ovs-appctl lacp/show bond0
190 ovs-appctl lacp/show bond1
191 ovs-appctl bond/show bond0 | STRIP_RECIRC_ID
192 ovs-appctl bond/show bond1 | STRIP_RECIRC_ID ], [0], [stdout])
193 AT_CHECK([sed '/active slave/d' stdout], [0], [dnl
195 status: active negotiated
196 sys_id: aa:55:aa:55:00:00
201 slave: p0: current attached
206 actor sys_id: aa:55:aa:55:00:00
207 actor sys_priority: 65534
209 actor port_priority: 65535
211 actor state: activity timeout aggregation synchronized collecting distributing
213 partner sys_id: aa:66:aa:66:00:00
214 partner sys_priority: 65534
216 partner port_priority: 65535
218 partner state: activity timeout aggregation synchronized collecting distributing
220 slave: p1: current attached
225 actor sys_id: aa:55:aa:55:00:00
226 actor sys_priority: 65534
228 actor port_priority: 65535
230 actor state: activity timeout aggregation synchronized collecting distributing
232 partner sys_id: aa:66:aa:66:00:00
233 partner sys_priority: 65534
235 partner port_priority: 65535
237 partner state: activity timeout aggregation synchronized collecting distributing
239 status: active negotiated
240 sys_id: aa:66:aa:66:00:00
245 slave: p2: current attached
250 actor sys_id: aa:66:aa:66:00:00
251 actor sys_priority: 65534
253 actor port_priority: 65535
255 actor state: activity timeout aggregation synchronized collecting distributing
257 partner sys_id: aa:55:aa:55:00:00
258 partner sys_priority: 65534
260 partner port_priority: 65535
262 partner state: activity timeout aggregation synchronized collecting distributing
264 slave: p3: current attached
269 actor sys_id: aa:66:aa:66:00:00
270 actor sys_priority: 65534
272 actor port_priority: 65535
274 actor state: activity timeout aggregation synchronized collecting distributing
276 partner sys_id: aa:55:aa:55:00:00
277 partner sys_priority: 65534
279 partner port_priority: 65535
281 partner state: activity timeout aggregation synchronized collecting distributing
283 bond_mode: balance-tcp
284 bond may use recirculation: yes, <del>
288 lacp_status: negotiated
297 bond_mode: balance-tcp
298 bond may use recirculation: yes, <del>
302 lacp_status: negotiated
311 AT_CHECK([grep 'active slave' stdout], [0], [dnl
316 # Redirect the patch link between p0 and p2 so that no packets get
317 # back and forth across them anymore. Then wait 4 simulated
318 # seconds. The LACP state should become "expired" for p0 and p2.
319 AT_CHECK([ovs-vsctl \
320 -- add-port br0 null0 -- set int null0 type=patch options:peer=p2 -- set int p2 options:peer=null0 \
321 -- add-port br1 null1 -- set int null1 type=patch options:peer=p0 -- set int p0 options:peer=null1])
323 for i in `seq 0 40`; do ovs-appctl time/warp 100; done
325 [ovs-appctl lacp/show bond0
326 ovs-appctl lacp/show bond1
327 ovs-appctl bond/show bond0 | STRIP_RECIRC_ID
328 ovs-appctl bond/show bond1 | STRIP_RECIRC_ID ], [0], [dnl
330 status: active negotiated
331 sys_id: aa:55:aa:55:00:00
336 slave: p0: expired attached
341 actor sys_id: aa:55:aa:55:00:00
342 actor sys_priority: 65534
344 actor port_priority: 65535
346 actor state: activity timeout aggregation synchronized collecting distributing expired
348 partner sys_id: aa:66:aa:66:00:00
349 partner sys_priority: 65534
351 partner port_priority: 65535
353 partner state: activity timeout aggregation collecting distributing
355 slave: p1: current attached
360 actor sys_id: aa:55:aa:55:00:00
361 actor sys_priority: 65534
363 actor port_priority: 65535
365 actor state: activity timeout aggregation synchronized collecting distributing
367 partner sys_id: aa:66:aa:66:00:00
368 partner sys_priority: 65534
370 partner port_priority: 65535
372 partner state: activity timeout aggregation synchronized collecting distributing
374 status: active negotiated
375 sys_id: aa:66:aa:66:00:00
380 slave: p2: expired attached
385 actor sys_id: aa:66:aa:66:00:00
386 actor sys_priority: 65534
388 actor port_priority: 65535
390 actor state: activity timeout aggregation synchronized collecting distributing expired
392 partner sys_id: aa:55:aa:55:00:00
393 partner sys_priority: 65534
395 partner port_priority: 65535
397 partner state: activity timeout aggregation collecting distributing
399 slave: p3: current attached
404 actor sys_id: aa:66:aa:66:00:00
405 actor sys_priority: 65534
407 actor port_priority: 65535
409 actor state: activity timeout aggregation synchronized collecting distributing
411 partner sys_id: aa:55:aa:55:00:00
412 partner sys_priority: 65534
414 partner port_priority: 65535
416 partner state: activity timeout aggregation synchronized collecting distributing
418 bond_mode: balance-tcp
419 bond may use recirculation: yes, <del>
423 lacp_status: negotiated
433 bond_mode: balance-tcp
434 bond may use recirculation: yes, <del>
438 lacp_status: negotiated
449 # Wait 4 more simulated seconds. The LACP state should become
450 # "defaulted" for p0 and p2.
451 for i in `seq 0 40`; do ovs-appctl time/warp 100; done
453 [ovs-appctl lacp/show bond0
454 ovs-appctl lacp/show bond1
455 ovs-appctl bond/show bond0 | STRIP_RECIRC_ID
456 ovs-appctl bond/show bond1 | STRIP_RECIRC_ID ], [0], [dnl
458 status: active negotiated
459 sys_id: aa:55:aa:55:00:00
464 slave: p0: defaulted detached
469 actor sys_id: aa:55:aa:55:00:00
470 actor sys_priority: 65534
472 actor port_priority: 65535
474 actor state: activity timeout aggregation defaulted
476 partner sys_id: 00:00:00:00:00:00
477 partner sys_priority: 0
479 partner port_priority: 0
483 slave: p1: current attached
488 actor sys_id: aa:55:aa:55:00:00
489 actor sys_priority: 65534
491 actor port_priority: 65535
493 actor state: activity timeout aggregation synchronized collecting distributing
495 partner sys_id: aa:66:aa:66:00:00
496 partner sys_priority: 65534
498 partner port_priority: 65535
500 partner state: activity timeout aggregation synchronized collecting distributing
502 status: active negotiated
503 sys_id: aa:66:aa:66:00:00
508 slave: p2: defaulted detached
513 actor sys_id: aa:66:aa:66:00:00
514 actor sys_priority: 65534
516 actor port_priority: 65535
518 actor state: activity timeout aggregation defaulted
520 partner sys_id: 00:00:00:00:00:00
521 partner sys_priority: 0
523 partner port_priority: 0
527 slave: p3: current attached
532 actor sys_id: aa:66:aa:66:00:00
533 actor sys_priority: 65534
535 actor port_priority: 65535
537 actor state: activity timeout aggregation synchronized collecting distributing
539 partner sys_id: aa:55:aa:55:00:00
540 partner sys_priority: 65534
542 partner port_priority: 65535
544 partner state: activity timeout aggregation synchronized collecting distributing
546 bond_mode: balance-tcp
547 bond may use recirculation: yes, <del>
551 lacp_status: negotiated
561 bond_mode: balance-tcp
562 bond may use recirculation: yes, <del>
566 lacp_status: negotiated