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 300 100
17 AT_CHECK([ovs-appctl lacp/show], [0], [dnl
19 status: active negotiated
20 sys_id: aa:55:aa:55:00:00
25 slave: p1: expired attached
30 actor sys_id: aa:55:aa:55:00:00
31 actor sys_priority: 65535
33 actor port_priority: 65535
35 actor state: activity synchronized collecting distributing expired
37 partner sys_id: 00:00:00:00:00:00
38 partner sys_priority: 0
40 partner port_priority: 0
42 partner state: timeout
44 AT_CHECK([ovs-appctl bond/show])
48 AT_SETUP([lacp - multi port config])
49 OVS_VSWITCHD_START([dnl
50 add-bond br0 bond p1 p2 --\
51 set Port bond lacp=active bond-mode=active-backup \
52 other_config:lacp-time="fast" \
53 other_config:lacp-system-id=11:22:33:44:55:66 \
54 other_config:lacp-system-priority=54321 --\
55 set Interface p1 type=dummy \
56 other_config:lacp-port-id=11 \
57 other_config:lacp-port-priority=111 \
58 other_config:lacp-aggregation-key=3333 --\
59 set Interface p2 type=dummy \
60 other_config:lacp-port-id=22 \
61 other_config:lacp-port-priority=222 \
62 other_config:lacp-aggregation-key=3333 ])
65 ovs-appctl time/warp 300 100
67 AT_CHECK([ovs-appctl lacp/show], [0], [stdout])
68 AT_CHECK([sed -e 's/aggregation key:.*/aggregation key: <omitted>/' < stdout], [0], [dnl
70 status: active negotiated
71 sys_id: 11:22:33:44:55:66
73 aggregation key: <omitted>
76 slave: p1: expired attached
81 actor sys_id: 11:22:33:44:55:66
82 actor sys_priority: 54321
84 actor port_priority: 111
86 actor state: activity timeout aggregation synchronized collecting distributing expired
88 partner sys_id: 00:00:00:00:00:00
89 partner sys_priority: 0
91 partner port_priority: 0
93 partner state: timeout
95 slave: p2: expired attached
100 actor sys_id: 11:22:33:44:55:66
101 actor sys_priority: 54321
103 actor port_priority: 222
105 actor state: activity timeout aggregation synchronized collecting distributing expired
107 partner sys_id: 00:00:00:00:00:00
108 partner sys_priority: 0
110 partner port_priority: 0
112 partner state: timeout
114 AT_CHECK([ovs-appctl bond/show], [0], [dnl
116 bond_mode: active-backup
117 bond may use recirculation: no, Recirc-ID : -1
121 lacp_status: negotiated
133 AT_SETUP([lacp - negotiation])
134 # Create bond0 on br0 with interfaces p0 and p1
135 # and bond1 on br1 with interfaces p2 and p3
136 # with p0 patched to p2 and p1 patched to p3.
138 [add-bond br0 bond0 p0 p1 bond_mode=balance-tcp lacp=active \
139 other-config:lacp-time=fast \
140 other-config:bond-rebalance-interval=0 -- \
141 set interface p0 type=patch options:peer=p2 ofport_request=1 \
142 other-config:lacp-aggregation-key=2 -- \
143 set interface p1 type=patch options:peer=p3 ofport_request=2 \
144 other-config:lacp-aggregation-key=2 -- \
146 set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
147 set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
148 fail-mode=secure -- \
149 add-bond br1 bond1 p2 p3 bond_mode=balance-tcp lacp=active \
150 other-config:lacp-time=fast \
151 other-config:bond-rebalance-interval=0 -- \
152 set interface p2 type=patch options:peer=p0 ofport_request=3 \
153 other-config:lacp-aggregation-key=4 -- \
154 set interface p3 type=patch options:peer=p1 ofport_request=4 \
155 other-config:lacp-aggregation-key=4 --])
157 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
162 # Wait for up to 5 (simulated) seconds, until LACP negotiation finishes.
165 ovs-appctl lacp/show bond0 > bond0
166 AT_CAPTURE_FILE([bond0])
167 ovs-appctl lacp/show bond1 > bond1
168 AT_CAPTURE_FILE([bond1])
169 if grep negotiated bond0 && grep negotiated bond1; then
170 if grep expired bond0 || grep expired bond1; then
177 if test $i = 50; then
180 ovs-appctl time/warp 100
183 # Now check the correctly negotiated configuration.
185 [ovs-appctl lacp/show bond0
186 ovs-appctl lacp/show bond1
187 ovs-appctl bond/show bond0 | STRIP_RECIRC_ID
188 ovs-appctl bond/show bond1 | STRIP_RECIRC_ID ], [0], [stdout])
189 AT_CHECK([sed '/active slave/d' stdout], [0], [dnl
191 status: active negotiated
192 sys_id: aa:55:aa:55:00:00
197 slave: p0: current attached
202 actor sys_id: aa:55:aa:55:00:00
203 actor sys_priority: 65534
205 actor port_priority: 65535
207 actor state: activity timeout aggregation synchronized collecting distributing
209 partner sys_id: aa:66:aa:66:00:00
210 partner sys_priority: 65534
212 partner port_priority: 65535
214 partner state: activity timeout aggregation synchronized collecting distributing
216 slave: p1: current attached
221 actor sys_id: aa:55:aa:55:00:00
222 actor sys_priority: 65534
224 actor port_priority: 65535
226 actor state: activity timeout aggregation synchronized collecting distributing
228 partner sys_id: aa:66:aa:66:00:00
229 partner sys_priority: 65534
231 partner port_priority: 65535
233 partner state: activity timeout aggregation synchronized collecting distributing
235 status: active negotiated
236 sys_id: aa:66:aa:66:00:00
241 slave: p2: current attached
246 actor sys_id: aa:66:aa:66:00:00
247 actor sys_priority: 65534
249 actor port_priority: 65535
251 actor state: activity timeout aggregation synchronized collecting distributing
253 partner sys_id: aa:55:aa:55:00:00
254 partner sys_priority: 65534
256 partner port_priority: 65535
258 partner state: activity timeout aggregation synchronized collecting distributing
260 slave: p3: current attached
265 actor sys_id: aa:66:aa:66:00:00
266 actor sys_priority: 65534
268 actor port_priority: 65535
270 actor state: activity timeout aggregation synchronized collecting distributing
272 partner sys_id: aa:55:aa:55:00:00
273 partner sys_priority: 65534
275 partner port_priority: 65535
277 partner state: activity timeout aggregation synchronized collecting distributing
279 bond_mode: balance-tcp
280 bond may use recirculation: yes, <del>
284 lacp_status: negotiated
293 bond_mode: balance-tcp
294 bond may use recirculation: yes, <del>
298 lacp_status: negotiated
307 AT_CHECK([grep 'active slave' stdout], [0], [dnl
312 # Redirect the patch link between p0 and p2 so that no packets get
313 # back and forth across them anymore. Then wait 4 simulated
314 # seconds. The LACP state should become "expired" for p0 and p2.
315 AT_CHECK([ovs-vsctl \
316 -- add-port br0 null0 -- set int null0 type=patch options:peer=p2 -- set int p2 options:peer=null0 \
317 -- add-port br1 null1 -- set int null1 type=patch options:peer=p0 -- set int p0 options:peer=null1])
319 ovs-appctl time/warp 4100 100
321 [ovs-appctl lacp/show bond0
322 ovs-appctl lacp/show bond1
323 ovs-appctl bond/show bond0 | STRIP_RECIRC_ID
324 ovs-appctl bond/show bond1 | STRIP_RECIRC_ID ], [0], [dnl
326 status: active negotiated
327 sys_id: aa:55:aa:55:00:00
332 slave: p0: expired attached
337 actor sys_id: aa:55:aa:55:00:00
338 actor sys_priority: 65534
340 actor port_priority: 65535
342 actor state: activity timeout aggregation synchronized collecting distributing expired
344 partner sys_id: aa:66:aa:66:00:00
345 partner sys_priority: 65534
347 partner port_priority: 65535
349 partner state: activity timeout aggregation collecting distributing
351 slave: p1: current attached
356 actor sys_id: aa:55:aa:55:00:00
357 actor sys_priority: 65534
359 actor port_priority: 65535
361 actor state: activity timeout aggregation synchronized collecting distributing
363 partner sys_id: aa:66:aa:66:00:00
364 partner sys_priority: 65534
366 partner port_priority: 65535
368 partner state: activity timeout aggregation synchronized collecting distributing
370 status: active negotiated
371 sys_id: aa:66:aa:66:00:00
376 slave: p2: expired attached
381 actor sys_id: aa:66:aa:66:00:00
382 actor sys_priority: 65534
384 actor port_priority: 65535
386 actor state: activity timeout aggregation synchronized collecting distributing expired
388 partner sys_id: aa:55:aa:55:00:00
389 partner sys_priority: 65534
391 partner port_priority: 65535
393 partner state: activity timeout aggregation collecting distributing
395 slave: p3: current attached
400 actor sys_id: aa:66:aa:66:00:00
401 actor sys_priority: 65534
403 actor port_priority: 65535
405 actor state: activity timeout aggregation synchronized collecting distributing
407 partner sys_id: aa:55:aa:55:00:00
408 partner sys_priority: 65534
410 partner port_priority: 65535
412 partner state: activity timeout aggregation synchronized collecting distributing
414 bond_mode: balance-tcp
415 bond may use recirculation: yes, <del>
419 lacp_status: negotiated
429 bond_mode: balance-tcp
430 bond may use recirculation: yes, <del>
434 lacp_status: negotiated
445 # Wait 4 more simulated seconds. The LACP state should become
446 # "defaulted" for p0 and p2.
447 ovs-appctl time/warp 4100 100
449 [ovs-appctl lacp/show bond0
450 ovs-appctl lacp/show bond1
451 ovs-appctl bond/show bond0 | STRIP_RECIRC_ID
452 ovs-appctl bond/show bond1 | STRIP_RECIRC_ID ], [0], [dnl
454 status: active negotiated
455 sys_id: aa:55:aa:55:00:00
460 slave: p0: defaulted detached
465 actor sys_id: aa:55:aa:55:00:00
466 actor sys_priority: 65534
468 actor port_priority: 65535
470 actor state: activity timeout aggregation defaulted
472 partner sys_id: 00:00:00:00:00:00
473 partner sys_priority: 0
475 partner port_priority: 0
479 slave: p1: current attached
484 actor sys_id: aa:55:aa:55:00:00
485 actor sys_priority: 65534
487 actor port_priority: 65535
489 actor state: activity timeout aggregation synchronized collecting distributing
491 partner sys_id: aa:66:aa:66:00:00
492 partner sys_priority: 65534
494 partner port_priority: 65535
496 partner state: activity timeout aggregation synchronized collecting distributing
498 status: active negotiated
499 sys_id: aa:66:aa:66:00:00
504 slave: p2: defaulted detached
509 actor sys_id: aa:66:aa:66:00:00
510 actor sys_priority: 65534
512 actor port_priority: 65535
514 actor state: activity timeout aggregation defaulted
516 partner sys_id: 00:00:00:00:00:00
517 partner sys_priority: 0
519 partner port_priority: 0
523 slave: p3: current attached
528 actor sys_id: aa:66:aa:66:00:00
529 actor sys_priority: 65534
531 actor port_priority: 65535
533 actor state: activity timeout aggregation synchronized collecting distributing
535 partner sys_id: aa:55:aa:55:00:00
536 partner sys_priority: 65534
538 partner port_priority: 65535
540 partner state: activity timeout aggregation synchronized collecting distributing
542 bond_mode: balance-tcp
543 bond may use recirculation: yes, <del>
547 lacp_status: negotiated
557 bond_mode: balance-tcp
558 bond may use recirculation: yes, <del>
562 lacp_status: negotiated