3 # Strips out Reciulation ID information since it may change over time.
4 m4_define([STRIP_RECIRC_ID], [[sed '
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>/
13 AT_SETUP([lacp - config])
16 set Port p1 lacp=active --\
17 set Interface p1 type=dummy ])
20 ovs-appctl time/warp 300 100
22 AT_CHECK([ovs-appctl lacp/show], [0], [dnl
24 status: active negotiated
25 sys_id: aa:55:aa:55:00:00
30 slave: p1: expired attached
35 actor sys_id: aa:55:aa:55:00:00
36 actor sys_priority: 65535
38 actor port_priority: 65535
40 actor state: activity synchronized collecting distributing expired
42 partner sys_id: 00:00:00:00:00:00
43 partner sys_priority: 0
45 partner port_priority: 0
47 partner state: timeout
49 AT_CHECK([ovs-appctl bond/show])
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 ])
70 ovs-appctl time/warp 300 100
72 AT_CHECK([ovs-appctl lacp/show], [0], [stdout])
73 AT_CHECK([sed -e 's/aggregation key:.*/aggregation key: <omitted>/' < stdout], [0], [dnl
75 status: active negotiated
76 sys_id: 11:22:33:44:55:66
78 aggregation key: <omitted>
81 slave: p1: expired attached
86 actor sys_id: 11:22:33:44:55:66
87 actor sys_priority: 54321
89 actor port_priority: 111
91 actor state: activity timeout aggregation synchronized collecting distributing expired
93 partner sys_id: 00:00:00:00:00:00
94 partner sys_priority: 0
96 partner port_priority: 0
98 partner state: timeout
100 slave: p2: expired attached
105 actor sys_id: 11:22:33:44:55:66
106 actor sys_priority: 54321
108 actor port_priority: 222
110 actor state: activity timeout aggregation synchronized collecting distributing expired
112 partner sys_id: 00:00:00:00:00:00
113 partner sys_priority: 0
115 partner port_priority: 0
117 partner state: timeout
119 AT_CHECK([ovs-appctl bond/show], [0], [dnl
121 bond_mode: active-backup
122 bond may use recirculation: no, Recirc-ID : -1
126 lacp_status: negotiated
127 active slave mac: 00:00:00:00:00:00(none)
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.
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 -- \
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 --])
163 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
168 # Wait for up to 5 (simulated) seconds, until LACP negotiation finishes.
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
183 if test $i = 50; then
186 ovs-appctl time/warp 100
189 # Now check the correctly negotiated configuration.
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
197 status: active negotiated
198 sys_id: aa:55:aa:55:00:00
203 slave: p0: current attached
208 actor sys_id: aa:55:aa:55:00:00
209 actor sys_priority: 65534
211 actor port_priority: 65535
213 actor state: activity timeout aggregation synchronized collecting distributing
215 partner sys_id: aa:66:aa:66:00:00
216 partner sys_priority: 65534
218 partner port_priority: 65535
220 partner state: activity timeout aggregation synchronized collecting distributing
222 slave: p1: current attached
227 actor sys_id: aa:55:aa:55:00:00
228 actor sys_priority: 65534
230 actor port_priority: 65535
232 actor state: activity timeout aggregation synchronized collecting distributing
234 partner sys_id: aa:66:aa:66:00:00
235 partner sys_priority: 65534
237 partner port_priority: 65535
239 partner state: activity timeout aggregation synchronized collecting distributing
241 status: active negotiated
242 sys_id: aa:66:aa:66:00:00
247 slave: p2: current attached
252 actor sys_id: aa:66:aa:66:00:00
253 actor sys_priority: 65534
255 actor port_priority: 65535
257 actor state: activity timeout aggregation synchronized collecting distributing
259 partner sys_id: aa:55:aa:55:00:00
260 partner sys_priority: 65534
262 partner port_priority: 65535
264 partner state: activity timeout aggregation synchronized collecting distributing
266 slave: p3: current attached
271 actor sys_id: aa:66:aa:66:00:00
272 actor sys_priority: 65534
274 actor port_priority: 65535
276 actor state: activity timeout aggregation synchronized collecting distributing
278 partner sys_id: aa:55:aa:55:00:00
279 partner sys_priority: 65534
281 partner port_priority: 65535
283 partner state: activity timeout aggregation synchronized collecting distributing
285 bond_mode: balance-tcp
286 bond may use recirculation: yes, <del>
290 lacp_status: negotiated
299 bond_mode: balance-tcp
300 bond may use recirculation: yes, <del>
304 lacp_status: negotiated
313 AT_CHECK([grep 'active slave$' stdout], [0], [dnl
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])
325 ovs-appctl time/warp 4100 100
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
332 status: active negotiated
333 sys_id: aa:55:aa:55:00:00
338 slave: p0: expired attached
343 actor sys_id: aa:55:aa:55:00:00
344 actor sys_priority: 65534
346 actor port_priority: 65535
348 actor state: activity timeout aggregation synchronized collecting distributing expired
350 partner sys_id: aa:66:aa:66:00:00
351 partner sys_priority: 65534
353 partner port_priority: 65535
355 partner state: activity timeout aggregation collecting distributing
357 slave: p1: current attached
362 actor sys_id: aa:55:aa:55:00:00
363 actor sys_priority: 65534
365 actor port_priority: 65535
367 actor state: activity timeout aggregation synchronized collecting distributing
369 partner sys_id: aa:66:aa:66:00:00
370 partner sys_priority: 65534
372 partner port_priority: 65535
374 partner state: activity timeout aggregation synchronized collecting distributing
376 status: active negotiated
377 sys_id: aa:66:aa:66:00:00
382 slave: p2: expired attached
387 actor sys_id: aa:66:aa:66:00:00
388 actor sys_priority: 65534
390 actor port_priority: 65535
392 actor state: activity timeout aggregation synchronized collecting distributing expired
394 partner sys_id: aa:55:aa:55:00:00
395 partner sys_priority: 65534
397 partner port_priority: 65535
399 partner state: activity timeout aggregation collecting distributing
401 slave: p3: current attached
406 actor sys_id: aa:66:aa:66:00:00
407 actor sys_priority: 65534
409 actor port_priority: 65535
411 actor state: activity timeout aggregation synchronized collecting distributing
413 partner sys_id: aa:55:aa:55:00:00
414 partner sys_priority: 65534
416 partner port_priority: 65535
418 partner state: activity timeout aggregation synchronized collecting distributing
420 bond_mode: balance-tcp
421 bond may use recirculation: yes, <del>
425 lacp_status: negotiated
426 <active slave mac del>
436 bond_mode: balance-tcp
437 bond may use recirculation: yes, <del>
441 lacp_status: negotiated
442 <active slave mac del>
453 # Wait 4 more simulated seconds. The LACP state should become
454 # "defaulted" for p0 and p2.
455 ovs-appctl time/warp 4100 100
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
462 status: active negotiated
463 sys_id: aa:55:aa:55:00:00
468 slave: p0: defaulted detached
473 actor sys_id: aa:55:aa:55:00:00
474 actor sys_priority: 65534
476 actor port_priority: 65535
478 actor state: activity timeout aggregation defaulted
480 partner sys_id: 00:00:00:00:00:00
481 partner sys_priority: 0
483 partner port_priority: 0
487 slave: p1: current attached
492 actor sys_id: aa:55:aa:55:00:00
493 actor sys_priority: 65534
495 actor port_priority: 65535
497 actor state: activity timeout aggregation synchronized collecting distributing
499 partner sys_id: aa:66:aa:66:00:00
500 partner sys_priority: 65534
502 partner port_priority: 65535
504 partner state: activity timeout aggregation synchronized collecting distributing
506 status: active negotiated
507 sys_id: aa:66:aa:66:00:00
512 slave: p2: defaulted detached
517 actor sys_id: aa:66:aa:66:00:00
518 actor sys_priority: 65534
520 actor port_priority: 65535
522 actor state: activity timeout aggregation defaulted
524 partner sys_id: 00:00:00:00:00:00
525 partner sys_priority: 0
527 partner port_priority: 0
531 slave: p3: current attached
536 actor sys_id: aa:66:aa:66:00:00
537 actor sys_priority: 65534
539 actor port_priority: 65535
541 actor state: activity timeout aggregation synchronized collecting distributing
543 partner sys_id: aa:55:aa:55:00:00
544 partner sys_priority: 65534
546 partner port_priority: 65535
548 partner state: activity timeout aggregation synchronized collecting distributing
550 bond_mode: balance-tcp
551 bond may use recirculation: yes, <del>
555 lacp_status: negotiated
556 <active slave mac del>
566 bond_mode: balance-tcp
567 bond may use recirculation: yes, <del>
571 lacp_status: negotiated
572 <active slave mac del>