t_lagg.sh revision 1.2.2.2 1 1.2.2.2 cjep # $NetBSD: t_lagg.sh,v 1.2.2.2 2021/05/31 22:15:23 cjep Exp $
2 1.2.2.2 cjep #
3 1.2.2.2 cjep # Copyright (c) 2021 Internet Initiative Japan Inc.
4 1.2.2.2 cjep # All rights reserved.
5 1.2.2.2 cjep #
6 1.2.2.2 cjep # Redistribution and use in source and binary forms, with or without
7 1.2.2.2 cjep # modification, are permitted provided that the following conditions
8 1.2.2.2 cjep # are met:
9 1.2.2.2 cjep # 1. Redistributions of source code must retain the above copyright
10 1.2.2.2 cjep # notice, this list of conditions and the following disclaimer.
11 1.2.2.2 cjep # 2. Redistributions in binary form must reproduce the above copyright
12 1.2.2.2 cjep # notice, this list of conditions and the following disclaimer in the
13 1.2.2.2 cjep # documentation and/or other materials provided with the distribution.
14 1.2.2.2 cjep #
15 1.2.2.2 cjep # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
16 1.2.2.2 cjep # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
17 1.2.2.2 cjep # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18 1.2.2.2 cjep # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
19 1.2.2.2 cjep # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 1.2.2.2 cjep # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 1.2.2.2 cjep # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 1.2.2.2 cjep # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 1.2.2.2 cjep # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 1.2.2.2 cjep # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 1.2.2.2 cjep # POSSIBILITY OF SUCH DAMAGE.
26 1.2.2.2 cjep #
27 1.2.2.2 cjep
28 1.2.2.2 cjep SOCK_HOST0=unix://commsock0
29 1.2.2.2 cjep SOCK_HOST1=unix://commsock1
30 1.2.2.2 cjep SOCK_HOST2=unix://commsock2
31 1.2.2.2 cjep BUS0=bus0
32 1.2.2.2 cjep BUS1=bus1
33 1.2.2.2 cjep BUS2=bus2
34 1.2.2.2 cjep IP4ADDR0=192.168.0.1
35 1.2.2.2 cjep IP4ADDR1=192.168.0.2
36 1.2.2.2 cjep IP4ADDR2=192.168.1.1
37 1.2.2.2 cjep IP4ADDR3=192.168.1.2
38 1.2.2.2 cjep IP6ADDR0=fc00::1
39 1.2.2.2 cjep IP6ADDR1=fc00::2
40 1.2.2.2 cjep IP6ADDR2=fc00:1::1
41 1.2.2.2 cjep IP6ADDR3=fc00:1::2
42 1.2.2.2 cjep WAITTIME=20
43 1.2.2.2 cjep
44 1.2.2.2 cjep DEBUG=${DEBUG:-false}
45 1.2.2.2 cjep
46 1.2.2.2 cjep wait_state()
47 1.2.2.2 cjep {
48 1.2.2.2 cjep local state=$1
49 1.2.2.2 cjep local if_lagg=$2
50 1.2.2.2 cjep local if_port=$3
51 1.2.2.2 cjep
52 1.2.2.2 cjep local n=$WAITTIME
53 1.2.2.2 cjep local cmd_grep="grep -q ${state}"
54 1.2.2.2 cjep
55 1.2.2.2 cjep if [ x"$if_port" != x"" ]; then
56 1.2.2.2 cjep cmd_grep="grep $if_port | $cmd_grep"
57 1.2.2.2 cjep fi
58 1.2.2.2 cjep
59 1.2.2.2 cjep for i in $(seq $n); do
60 1.2.2.2 cjep rump.ifconfig $if_lagg | eval $cmd_grep
61 1.2.2.2 cjep if [ $? = 0 ] ; then
62 1.2.2.2 cjep $DEBUG && echo "wait for $i seconds."
63 1.2.2.2 cjep return 0
64 1.2.2.2 cjep fi
65 1.2.2.2 cjep
66 1.2.2.2 cjep sleep 1
67 1.2.2.2 cjep done
68 1.2.2.2 cjep
69 1.2.2.2 cjep $DEBUG && rump.ifconfig -v $if_lagg
70 1.2.2.2 cjep atf_fail "Couldn't be ${state} for $n seconds."
71 1.2.2.2 cjep }
72 1.2.2.2 cjep wait_for_distributing()
73 1.2.2.2 cjep {
74 1.2.2.2 cjep
75 1.2.2.2 cjep wait_state "DISTRIBUTING" $*
76 1.2.2.2 cjep }
77 1.2.2.2 cjep
78 1.2.2.2 cjep expected_inactive()
79 1.2.2.2 cjep {
80 1.2.2.2 cjep local if_lagg=$1
81 1.2.2.2 cjep local if_port=$2
82 1.2.2.2 cjep
83 1.2.2.2 cjep sleep 3 # wait a little
84 1.2.2.2 cjep atf_check -s exit:0 -o not-match:"${if_port}.*ACTIVE" \
85 1.2.2.2 cjep rump.ifconfig ${if_lagg}
86 1.2.2.2 cjep }
87 1.2.2.2 cjep
88 1.2.2.2 cjep atf_test_case lagg_ifconfig cleanup
89 1.2.2.2 cjep lagg_ifconfig_head()
90 1.2.2.2 cjep {
91 1.2.2.2 cjep
92 1.2.2.2 cjep atf_set "descr" "tests for create, destroy, and ioctl of lagg(4)"
93 1.2.2.2 cjep atf_set "require.progs" "rump_server"
94 1.2.2.2 cjep }
95 1.2.2.2 cjep
96 1.2.2.2 cjep lagg_ifconfig_body()
97 1.2.2.2 cjep {
98 1.2.2.2 cjep local atf_ifconfig="atf_check -s exit:0 rump.ifconfig"
99 1.2.2.2 cjep
100 1.2.2.2 cjep rump_server_start $SOCK_HOST0 lagg
101 1.2.2.2 cjep
102 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST0
103 1.2.2.2 cjep $atf_ifconfig lagg0 create
104 1.2.2.2 cjep $atf_ifconfig lagg0 destroy
105 1.2.2.2 cjep
106 1.2.2.2 cjep $atf_ifconfig lagg0 create
107 1.2.2.2 cjep $atf_ifconfig shmif0 create
108 1.2.2.2 cjep
109 1.2.2.2 cjep $atf_ifconfig lagg0 laggproto none
110 1.2.2.2 cjep atf_check -s exit:0 -o match:'laggproto none' \
111 1.2.2.2 cjep rump.ifconfig lagg0
112 1.2.2.2 cjep
113 1.2.2.2 cjep # cannot add a port while protocol is none
114 1.2.2.2 cjep atf_check -s not-exit:0 -e ignore \
115 1.2.2.2 cjep rump.ifconfig lagg0 laggport shmif0
116 1.2.2.2 cjep
117 1.2.2.2 cjep $atf_ifconfig lagg0 laggproto lacp
118 1.2.2.2 cjep atf_check -s exit:0 -o match:'laggproto lacp' \
119 1.2.2.2 cjep rump.ifconfig lagg0
120 1.2.2.2 cjep
121 1.2.2.2 cjep # add a port and an added port
122 1.2.2.2 cjep $atf_ifconfig lagg0 laggport shmif0
123 1.2.2.2 cjep atf_check -s not-exit:0 -e ignore \
124 1.2.2.2 cjep rump.ifconfig lagg0 laggport shmif0
125 1.2.2.2 cjep
126 1.2.2.2 cjep # remove an added port and a removed port
127 1.2.2.2 cjep $atf_ifconfig lagg0 -laggport shmif0
128 1.2.2.2 cjep atf_check -s not-exit:0 -e ignore \
129 1.2.2.2 cjep rump.ifconfig lagg0 -laggport shmif0
130 1.2.2.2 cjep
131 1.2.2.2 cjep # re-add a removed port
132 1.2.2.2 cjep $atf_ifconfig lagg0 laggport shmif0
133 1.2.2.2 cjep
134 1.2.2.2 cjep # detach protocol even if the I/F has ports
135 1.2.2.2 cjep $atf_ifconfig lagg0 laggproto none
136 1.2.2.2 cjep
137 1.2.2.2 cjep # destroy the interface while grouping ports
138 1.2.2.2 cjep $atf_ifconfig lagg0 destroy
139 1.2.2.2 cjep
140 1.2.2.2 cjep $atf_ifconfig lagg0 create
141 1.2.2.2 cjep $atf_ifconfig shmif1 create
142 1.2.2.2 cjep
143 1.2.2.2 cjep $atf_ifconfig lagg0 laggproto lacp
144 1.2.2.2 cjep $atf_ifconfig lagg0 laggport shmif0
145 1.2.2.2 cjep $atf_ifconfig lagg0 laggport shmif1
146 1.2.2.2 cjep
147 1.2.2.2 cjep $atf_ifconfig lagg0 -laggport shmif0
148 1.2.2.2 cjep $atf_ifconfig lagg0 laggport shmif0
149 1.2.2.2 cjep $atf_ifconfig lagg0 -laggport shmif1
150 1.2.2.2 cjep $atf_ifconfig lagg0 laggport shmif1
151 1.2.2.2 cjep
152 1.2.2.2 cjep # destroy a LAGed port
153 1.2.2.2 cjep atf_check -s exit:0 -o match:shmif0 rump.ifconfig lagg0
154 1.2.2.2 cjep atf_check -s exit:0 -o match:shmif1 rump.ifconfig lagg0
155 1.2.2.2 cjep $atf_ifconfig shmif0 destroy
156 1.2.2.2 cjep $atf_ifconfig shmif1 destroy
157 1.2.2.2 cjep
158 1.2.2.2 cjep $atf_ifconfig lagg0 laggproto none
159 1.2.2.2 cjep atf_check -s exit:0 -o ignore rump.ifconfig lagg0
160 1.2.2.2 cjep }
161 1.2.2.2 cjep
162 1.2.2.2 cjep lagg_ifconfig_cleanup()
163 1.2.2.2 cjep {
164 1.2.2.2 cjep $DEBG && dump
165 1.2.2.2 cjep cleanup
166 1.2.2.2 cjep }
167 1.2.2.2 cjep
168 1.2.2.2 cjep atf_test_case lagg_macaddr cleanup
169 1.2.2.2 cjep lagg_macaddr_head()
170 1.2.2.2 cjep {
171 1.2.2.2 cjep atf_set "descr" "tests for a MAC address to assign to lagg(4)"
172 1.2.2.2 cjep atf_set "require.progs" "rump_server"
173 1.2.2.2 cjep }
174 1.2.2.2 cjep
175 1.2.2.2 cjep lagg_macaddr_body()
176 1.2.2.2 cjep {
177 1.2.2.2 cjep local atf_ifconfig="atf_check -s exit:0 rump.ifconfig"
178 1.2.2.2 cjep
179 1.2.2.2 cjep rump_server_start $SOCK_HOST0 lagg
180 1.2.2.2 cjep
181 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST0
182 1.2.2.2 cjep $atf_ifconfig lagg0 create
183 1.2.2.2 cjep rump_server_add_iface $SOCK_HOST0 shmif0 $BUS0
184 1.2.2.2 cjep rump_server_add_iface $SOCK_HOST0 shmif1 $BUS1
185 1.2.2.2 cjep
186 1.2.2.2 cjep maddr=$(get_macaddr $SOCK_HOST0 lagg0)
187 1.2.2.2 cjep maddr0=$(get_macaddr $SOCK_HOST0 shmif0)
188 1.2.2.2 cjep maddr1=$(get_macaddr $SOCK_HOST0 shmif1)
189 1.2.2.2 cjep
190 1.2.2.2 cjep $atf_ifconfig lagg0 laggproto lacp
191 1.2.2.2 cjep
192 1.2.2.2 cjep $atf_ifconfig lagg0 laggport shmif0
193 1.2.2.2 cjep atf_check -s exit:0 -o match:$maddr0 rump.ifconfig lagg0
194 1.2.2.2 cjep
195 1.2.2.2 cjep $atf_ifconfig lagg0 laggport shmif1
196 1.2.2.2 cjep atf_check -s exit:0 -o match:$maddr0 rump.ifconfig lagg0
197 1.2.2.2 cjep atf_check -s exit:0 -o match:$maddr0 rump.ifconfig shmif1
198 1.2.2.2 cjep
199 1.2.2.2 cjep $atf_ifconfig lagg0 -laggport shmif0
200 1.2.2.2 cjep atf_check -s exit:0 -o match:$maddr1 rump.ifconfig lagg0
201 1.2.2.2 cjep atf_check -s exit:0 -o match:$maddr0 rump.ifconfig shmif0
202 1.2.2.2 cjep
203 1.2.2.2 cjep $atf_ifconfig lagg0 laggport shmif0
204 1.2.2.2 cjep atf_check -s exit:0 -o match:$maddr1 rump.ifconfig lagg0
205 1.2.2.2 cjep atf_check -s exit:0 -o match:$maddr1 rump.ifconfig shmif0
206 1.2.2.2 cjep
207 1.2.2.2 cjep $atf_ifconfig lagg0 -laggport shmif0
208 1.2.2.2 cjep atf_check -s exit:0 -o match:$maddr0 rump.ifconfig shmif0
209 1.2.2.2 cjep
210 1.2.2.2 cjep $atf_ifconfig lagg0 -laggport shmif1
211 1.2.2.2 cjep atf_check -s exit:0 -o match:$maddr rump.ifconfig lagg0
212 1.2.2.2 cjep }
213 1.2.2.2 cjep
214 1.2.2.2 cjep lagg_macaddr_cleanup()
215 1.2.2.2 cjep {
216 1.2.2.2 cjep $DEBUG && dump
217 1.2.2.2 cjep cleanup
218 1.2.2.2 cjep }
219 1.2.2.2 cjep
220 1.2.2.2 cjep atf_test_case lagg_ipv6lla cleanup
221 1.2.2.2 cjep lagg_ipv6lla_head()
222 1.2.2.2 cjep {
223 1.2.2.2 cjep atf_set "descr" "tests for a IPV6 LLA to assign to lagg(4)"
224 1.2.2.2 cjep atf_set "require.progs" "rump_server"
225 1.2.2.2 cjep }
226 1.2.2.2 cjep
227 1.2.2.2 cjep lagg_ipv6lla_body()
228 1.2.2.2 cjep {
229 1.2.2.2 cjep local atf_ifconfig="atf_check -s exit:0 rump.ifconfig"
230 1.2.2.2 cjep
231 1.2.2.2 cjep rump_server_start $SOCK_HOST0 netinet6 lagg
232 1.2.2.2 cjep
233 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST0
234 1.2.2.2 cjep $atf_ifconfig lagg0 create
235 1.2.2.2 cjep rump_server_add_iface $SOCK_HOST0 shmif0 $BUS0
236 1.2.2.2 cjep rump_server_add_iface $SOCK_HOST0 shmif1 $BUS1
237 1.2.2.2 cjep
238 1.2.2.2 cjep $atf_ifconfig lagg0 laggproto lacp
239 1.2.2.2 cjep
240 1.2.2.2 cjep $atf_ifconfig shmif0 up
241 1.2.2.2 cjep atf_check -s exit:0 -o match:'inet6 fe80:' rump.ifconfig shmif0
242 1.2.2.2 cjep
243 1.2.2.2 cjep $atf_ifconfig lagg0 laggproto lacp laggport shmif0
244 1.2.2.2 cjep atf_check -s exit:0 -o not-match:'inet6 fe80:' rump.ifconfig shmif0
245 1.2.2.2 cjep
246 1.2.2.2 cjep $atf_ifconfig lagg0 laggport shmif1
247 1.2.2.2 cjep $atf_ifconfig shmif1 up
248 1.2.2.2 cjep atf_check -s exit:0 -o not-match:'inet6 fe80:' rump.ifconfig shmif1
249 1.2.2.2 cjep
250 1.2.2.2 cjep $atf_ifconfig lagg0 -laggport shmif0
251 1.2.2.2 cjep atf_check -s exit:0 -o match:'inet6 fe80:' rump.ifconfig shmif0
252 1.2.2.2 cjep
253 1.2.2.2 cjep $atf_ifconfig shmif1 down
254 1.2.2.2 cjep $atf_ifconfig lagg0 -laggport shmif1
255 1.2.2.2 cjep atf_check -s exit:0 -o not-match:'inet fe80:' rump.ifconfig shmif1
256 1.2.2.2 cjep }
257 1.2.2.2 cjep
258 1.2.2.2 cjep lagg_ipv6lla_cleanup()
259 1.2.2.2 cjep {
260 1.2.2.2 cjep $DEBUG && dump
261 1.2.2.2 cjep cleanup
262 1.2.2.2 cjep }
263 1.2.2.2 cjep
264 1.2.2.2 cjep atf_test_case lagg_lacp_basic cleanup
265 1.2.2.2 cjep lagg_lacp_basic_head()
266 1.2.2.2 cjep {
267 1.2.2.2 cjep
268 1.2.2.2 cjep atf_set "descr" "tests for LACP basic functions"
269 1.2.2.2 cjep atf_set "require.progs" "rump_server"
270 1.2.2.2 cjep }
271 1.2.2.2 cjep
272 1.2.2.2 cjep lagg_lacp_basic_body()
273 1.2.2.2 cjep {
274 1.2.2.2 cjep local atf_ifconfig="atf_check -s exit:0 rump.ifconfig"
275 1.2.2.2 cjep
276 1.2.2.2 cjep rump_server_start $SOCK_HOST0 lagg
277 1.2.2.2 cjep rump_server_start $SOCK_HOST1 lagg
278 1.2.2.2 cjep rump_server_start $SOCK_HOST2 lagg
279 1.2.2.2 cjep
280 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST0
281 1.2.2.2 cjep
282 1.2.2.2 cjep # added running interface
283 1.2.2.2 cjep $atf_ifconfig shmif0 create
284 1.2.2.2 cjep $atf_ifconfig shmif0 linkstr $BUS0
285 1.2.2.2 cjep
286 1.2.2.2 cjep $atf_ifconfig shmif1 create
287 1.2.2.2 cjep $atf_ifconfig shmif1 linkstr $BUS1
288 1.2.2.2 cjep
289 1.2.2.2 cjep $atf_ifconfig lagg0 create
290 1.2.2.2 cjep $atf_ifconfig lagg0 laggproto lacp
291 1.2.2.2 cjep
292 1.2.2.2 cjep $atf_ifconfig shmif0 up
293 1.2.2.2 cjep $atf_ifconfig shmif1 up
294 1.2.2.2 cjep $atf_ifconfig lagg0 up
295 1.2.2.2 cjep
296 1.2.2.2 cjep $atf_ifconfig lagg0 laggport shmif0
297 1.2.2.2 cjep $atf_ifconfig lagg0 laggport shmif1
298 1.2.2.2 cjep $atf_ifconfig -w 10
299 1.2.2.2 cjep
300 1.2.2.2 cjep $atf_ifconfig lagg0 -laggport shmif0
301 1.2.2.2 cjep $atf_ifconfig lagg0 -laggport shmif1
302 1.2.2.2 cjep $atf_ifconfig lagg0 down
303 1.2.2.2 cjep
304 1.2.2.2 cjep # add the same interfaces again
305 1.2.2.2 cjep $atf_ifconfig lagg0 up
306 1.2.2.2 cjep $atf_ifconfig lagg0 laggport shmif0
307 1.2.2.2 cjep $atf_ifconfig lagg0 laggport shmif1
308 1.2.2.2 cjep
309 1.2.2.2 cjep # detach and re-attach protocol
310 1.2.2.2 cjep $atf_ifconfig lagg0 laggproto none
311 1.2.2.2 cjep $atf_ifconfig lagg0 laggproto lacp \
312 1.2.2.2 cjep laggport shmif0 laggport shmif1
313 1.2.2.2 cjep
314 1.2.2.2 cjep $atf_ifconfig lagg0 -laggport shmif0 -laggport shmif1
315 1.2.2.2 cjep $atf_ifconfig lagg0 destroy
316 1.2.2.2 cjep $atf_ifconfig shmif0 destroy
317 1.2.2.2 cjep $atf_ifconfig shmif1 destroy
318 1.2.2.2 cjep
319 1.2.2.2 cjep # tests for a loopback condition
320 1.2.2.2 cjep $atf_ifconfig shmif0 create
321 1.2.2.2 cjep $atf_ifconfig shmif0 linkstr $BUS0
322 1.2.2.2 cjep $atf_ifconfig shmif1 create
323 1.2.2.2 cjep $atf_ifconfig shmif1 linkstr $BUS0
324 1.2.2.2 cjep $atf_ifconfig lagg0 create
325 1.2.2.2 cjep $atf_ifconfig lagg0 laggproto lacp \
326 1.2.2.2 cjep laggport shmif0 laggport shmif1
327 1.2.2.2 cjep $atf_ifconfig shmif0 up
328 1.2.2.2 cjep $atf_ifconfig shmif1 up
329 1.2.2.2 cjep $atf_ifconfig lagg0 up
330 1.2.2.2 cjep
331 1.2.2.2 cjep expected_inactive lagg0
332 1.2.2.2 cjep
333 1.2.2.2 cjep $atf_ifconfig shmif0 down
334 1.2.2.2 cjep $atf_ifconfig shmif0 destroy
335 1.2.2.2 cjep $atf_ifconfig shmif1 down
336 1.2.2.2 cjep $atf_ifconfig shmif1 destroy
337 1.2.2.2 cjep $atf_ifconfig lagg0 down
338 1.2.2.2 cjep $atf_ifconfig lagg0 destroy
339 1.2.2.2 cjep
340 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST0
341 1.2.2.2 cjep $atf_ifconfig shmif0 create
342 1.2.2.2 cjep $atf_ifconfig shmif0 linkstr $BUS0
343 1.2.2.2 cjep $atf_ifconfig shmif0 up
344 1.2.2.2 cjep
345 1.2.2.2 cjep $atf_ifconfig shmif1 create
346 1.2.2.2 cjep $atf_ifconfig shmif1 linkstr $BUS1
347 1.2.2.2 cjep $atf_ifconfig shmif1 up
348 1.2.2.2 cjep
349 1.2.2.2 cjep $atf_ifconfig shmif2 create
350 1.2.2.2 cjep $atf_ifconfig shmif2 linkstr $BUS2
351 1.2.2.2 cjep $atf_ifconfig shmif2 up
352 1.2.2.2 cjep
353 1.2.2.2 cjep $atf_ifconfig lagg0 create
354 1.2.2.2 cjep $atf_ifconfig lagg0 laggproto lacp laggport shmif0 \
355 1.2.2.2 cjep laggport shmif1 laggport shmif2
356 1.2.2.2 cjep $atf_ifconfig lagg0 up
357 1.2.2.2 cjep
358 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST1
359 1.2.2.2 cjep $atf_ifconfig shmif0 create
360 1.2.2.2 cjep $atf_ifconfig shmif0 linkstr $BUS0
361 1.2.2.2 cjep $atf_ifconfig shmif0 up
362 1.2.2.2 cjep
363 1.2.2.2 cjep $atf_ifconfig shmif1 create
364 1.2.2.2 cjep $atf_ifconfig shmif1 linkstr $BUS1
365 1.2.2.2 cjep $atf_ifconfig shmif1 up
366 1.2.2.2 cjep
367 1.2.2.2 cjep $atf_ifconfig lagg0 create
368 1.2.2.2 cjep $atf_ifconfig lagg0 laggproto lacp
369 1.2.2.2 cjep $atf_ifconfig lagg1 create
370 1.2.2.2 cjep $atf_ifconfig lagg1 laggproto lacp
371 1.2.2.2 cjep
372 1.2.2.2 cjep $atf_ifconfig lagg0 laggport shmif0
373 1.2.2.2 cjep $atf_ifconfig lagg0 up
374 1.2.2.2 cjep wait_for_distributing lagg0 shmif0
375 1.2.2.2 cjep
376 1.2.2.2 cjep $atf_ifconfig lagg1 laggport shmif1
377 1.2.2.2 cjep $atf_ifconfig lagg1 up
378 1.2.2.2 cjep
379 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST2
380 1.2.2.2 cjep $atf_ifconfig shmif0 create
381 1.2.2.2 cjep $atf_ifconfig shmif0 linkstr $BUS2
382 1.2.2.2 cjep $atf_ifconfig shmif0 up
383 1.2.2.2 cjep
384 1.2.2.2 cjep $atf_ifconfig lagg0 create
385 1.2.2.2 cjep $atf_ifconfig lagg0 laggproto lacp laggport shmif0
386 1.2.2.2 cjep $atf_ifconfig lagg0 up
387 1.2.2.2 cjep
388 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST0
389 1.2.2.2 cjep wait_for_distributing lagg0 shmif0
390 1.2.2.2 cjep expected_inactive lagg0 shmif1
391 1.2.2.2 cjep expected_inactive lagg0 shmif2
392 1.2.2.2 cjep }
393 1.2.2.2 cjep
394 1.2.2.2 cjep lagg_lacp_basic_cleanup()
395 1.2.2.2 cjep {
396 1.2.2.2 cjep
397 1.2.2.2 cjep $DEBUG && dump
398 1.2.2.2 cjep cleanup
399 1.2.2.2 cjep }
400 1.2.2.2 cjep
401 1.2.2.2 cjep lagg_lacp_ping()
402 1.2.2.2 cjep {
403 1.2.2.2 cjep local atf_ifconfig="atf_check -s exit:0 rump.ifconfig"
404 1.2.2.2 cjep
405 1.2.2.2 cjep local af=$1
406 1.2.2.2 cjep local atf_ping="atf_check -s exit:0 -o ignore rump.ping -c 1"
407 1.2.2.2 cjep local ping=rump.ping
408 1.2.2.2 cjep local rumplib=""
409 1.2.2.2 cjep local pfx=24
410 1.2.2.2 cjep local addr_host0=$IP4ADDR0
411 1.2.2.2 cjep local addr_host1=$IP4ADDR1
412 1.2.2.2 cjep
413 1.2.2.2 cjep case $af in
414 1.2.2.2 cjep "inet")
415 1.2.2.2 cjep # do nothing
416 1.2.2.2 cjep ;;
417 1.2.2.2 cjep "inet6")
418 1.2.2.2 cjep atf_ping="atf_check -s exit:0 -o ignore rump.ping6 -c 1"
419 1.2.2.2 cjep rumplib="netinet6"
420 1.2.2.2 cjep pfx=64
421 1.2.2.2 cjep addr_host0=$IP6ADDR0
422 1.2.2.2 cjep addr_host1=$IP6ADDR1
423 1.2.2.2 cjep ;;
424 1.2.2.2 cjep esac
425 1.2.2.2 cjep
426 1.2.2.2 cjep rump_server_start $SOCK_HOST0 lagg $rumplib
427 1.2.2.2 cjep rump_server_start $SOCK_HOST1 lagg $rumplib
428 1.2.2.2 cjep
429 1.2.2.2 cjep rump_server_add_iface $SOCK_HOST0 shmif0 $BUS0
430 1.2.2.2 cjep rump_server_add_iface $SOCK_HOST0 shmif1 $BUS1
431 1.2.2.2 cjep rump_server_add_iface $SOCK_HOST0 shmif2 $BUS2
432 1.2.2.2 cjep
433 1.2.2.2 cjep rump_server_add_iface $SOCK_HOST1 shmif0 $BUS0
434 1.2.2.2 cjep rump_server_add_iface $SOCK_HOST1 shmif1 $BUS1
435 1.2.2.2 cjep rump_server_add_iface $SOCK_HOST1 shmif2 $BUS2
436 1.2.2.2 cjep
437 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST0
438 1.2.2.2 cjep $atf_ifconfig lagg0 create
439 1.2.2.2 cjep $atf_ifconfig lagg0 laggproto lacp laggport shmif0
440 1.2.2.2 cjep $atf_ifconfig lagg0 $af $addr_host0/$pfx
441 1.2.2.2 cjep $atf_ifconfig shmif0 up
442 1.2.2.2 cjep $atf_ifconfig lagg0 up
443 1.2.2.2 cjep
444 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST1
445 1.2.2.2 cjep $atf_ifconfig lagg0 create
446 1.2.2.2 cjep $atf_ifconfig lagg0 laggproto lacp laggport shmif0
447 1.2.2.2 cjep $atf_ifconfig lagg0 $af $addr_host1/$pfx
448 1.2.2.2 cjep $atf_ifconfig shmif0 up
449 1.2.2.2 cjep $atf_ifconfig lagg0 up
450 1.2.2.2 cjep
451 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST0
452 1.2.2.2 cjep wait_for_distributing lagg0
453 1.2.2.2 cjep $atf_ifconfig -w 10
454 1.2.2.2 cjep
455 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST1
456 1.2.2.2 cjep wait_for_distributing lagg0
457 1.2.2.2 cjep $atf_ifconfig -w 10
458 1.2.2.2 cjep
459 1.2.2.2 cjep $atf_ping $addr_host0
460 1.2.2.2 cjep
461 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST0
462 1.2.2.2 cjep $atf_ifconfig shmif1 up
463 1.2.2.2 cjep $atf_ifconfig lagg0 laggport shmif1 laggport shmif2
464 1.2.2.2 cjep $atf_ifconfig shmif2 up
465 1.2.2.2 cjep
466 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST1
467 1.2.2.2 cjep $atf_ifconfig shmif1 up
468 1.2.2.2 cjep $atf_ifconfig lagg0 laggport shmif1 laggport shmif2
469 1.2.2.2 cjep $atf_ifconfig shmif2 up
470 1.2.2.2 cjep
471 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST0
472 1.2.2.2 cjep wait_for_distributing lagg0 shmif1
473 1.2.2.2 cjep wait_for_distributing lagg0 shmif2
474 1.2.2.2 cjep
475 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST1
476 1.2.2.2 cjep wait_for_distributing lagg0 shmif1
477 1.2.2.2 cjep wait_for_distributing lagg0 shmif2
478 1.2.2.2 cjep
479 1.2.2.2 cjep $atf_ping $addr_host0
480 1.2.2.2 cjep }
481 1.2.2.2 cjep
482 1.2.2.2 cjep atf_test_case lagg_lacp_ipv4 cleanup
483 1.2.2.2 cjep lagg_lacp_ipv4_head()
484 1.2.2.2 cjep {
485 1.2.2.2 cjep
486 1.2.2.2 cjep atf_set "descr" "tests for IPv4 with LACP"
487 1.2.2.2 cjep atf_set "require.progs" "rump_server"
488 1.2.2.2 cjep }
489 1.2.2.2 cjep
490 1.2.2.2 cjep lagg_lacp_ipv4_body()
491 1.2.2.2 cjep {
492 1.2.2.2 cjep
493 1.2.2.2 cjep lagg_lacp_ping "inet"
494 1.2.2.2 cjep }
495 1.2.2.2 cjep
496 1.2.2.2 cjep lagg_lacp_ipv4_cleanup()
497 1.2.2.2 cjep {
498 1.2.2.2 cjep
499 1.2.2.2 cjep $DEBUG && dump
500 1.2.2.2 cjep cleanup
501 1.2.2.2 cjep }
502 1.2.2.2 cjep
503 1.2.2.2 cjep atf_test_case lagg_lacp_ipv6 cleanup
504 1.2.2.2 cjep lagg_lacp_ipv6_head()
505 1.2.2.2 cjep {
506 1.2.2.2 cjep
507 1.2.2.2 cjep atf_set "descr" "tests for IPv6 with LACP"
508 1.2.2.2 cjep atf_set "require.progs" "rump_server"
509 1.2.2.2 cjep }
510 1.2.2.2 cjep
511 1.2.2.2 cjep lagg_lacp_ipv6_body()
512 1.2.2.2 cjep {
513 1.2.2.2 cjep
514 1.2.2.2 cjep lagg_lacp_ping "inet6"
515 1.2.2.2 cjep }
516 1.2.2.2 cjep
517 1.2.2.2 cjep lagg_lacp_ipv6_cleanup()
518 1.2.2.2 cjep {
519 1.2.2.2 cjep
520 1.2.2.2 cjep $DEBUG && dump
521 1.2.2.2 cjep cleanup
522 1.2.2.2 cjep }
523 1.2.2.2 cjep
524 1.2.2.2 cjep lagg_lacp_vlan()
525 1.2.2.2 cjep {
526 1.2.2.2 cjep local atf_ifconfig="atf_check -s exit:0 rump.ifconfig"
527 1.2.2.2 cjep
528 1.2.2.2 cjep local af=$1
529 1.2.2.2 cjep local atf_ping="atf_check -s exit:0 -o ignore rump.ping -c 1"
530 1.2.2.2 cjep local rumplib="vlan"
531 1.2.2.2 cjep local pfx=24
532 1.2.2.2 cjep local vlan0_addr_host0=$IP4ADDR0
533 1.2.2.2 cjep local host0addr0=$IP4ADDR0
534 1.2.2.2 cjep local host1addr0=$IP4ADDR1
535 1.2.2.2 cjep local host0addr1=$IP4ADDR2
536 1.2.2.2 cjep local host1addr1=$IP4ADDR3
537 1.2.2.2 cjep
538 1.2.2.2 cjep case $af in
539 1.2.2.2 cjep "inet")
540 1.2.2.2 cjep # do nothing
541 1.2.2.2 cjep ;;
542 1.2.2.2 cjep "inet6")
543 1.2.2.2 cjep atf_ping="atf_check -s exit:0 -o ignore rump.ping6 -c 1"
544 1.2.2.2 cjep rumplib="netinet6"
545 1.2.2.2 cjep pfx=64
546 1.2.2.2 cjep host0addr0=$IP6ADDR0
547 1.2.2.2 cjep host1addr0=$IP6ADDR1
548 1.2.2.2 cjep host0addr1=$IP6ADDR2
549 1.2.2.2 cjep host1addr1=$IP6ADDR3
550 1.2.2.2 cjep ;;
551 1.2.2.2 cjep esac
552 1.2.2.2 cjep
553 1.2.2.2 cjep rump_server_start $SOCK_HOST0 lagg $rumplib
554 1.2.2.2 cjep rump_server_start $SOCK_HOST1 lagg $rumplib
555 1.2.2.2 cjep
556 1.2.2.2 cjep rump_server_add_iface $SOCK_HOST0 shmif0 $BUS0
557 1.2.2.2 cjep rump_server_add_iface $SOCK_HOST0 shmif1 $BUS1
558 1.2.2.2 cjep rump_server_add_iface $SOCK_HOST0 shmif2 $BUS2
559 1.2.2.2 cjep
560 1.2.2.2 cjep rump_server_add_iface $SOCK_HOST1 shmif0 $BUS0
561 1.2.2.2 cjep rump_server_add_iface $SOCK_HOST1 shmif1 $BUS1
562 1.2.2.2 cjep rump_server_add_iface $SOCK_HOST1 shmif2 $BUS2
563 1.2.2.2 cjep
564 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST0
565 1.2.2.2 cjep $atf_ifconfig lagg0 create
566 1.2.2.2 cjep $atf_ifconfig lagg0 laggproto lacp laggport shmif0
567 1.2.2.2 cjep $atf_ifconfig shmif0 up
568 1.2.2.2 cjep $atf_ifconfig lagg0 up
569 1.2.2.2 cjep
570 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST1
571 1.2.2.2 cjep $atf_ifconfig lagg0 create
572 1.2.2.2 cjep $atf_ifconfig lagg0 laggproto lacp laggport shmif0
573 1.2.2.2 cjep $atf_ifconfig shmif0 up
574 1.2.2.2 cjep $atf_ifconfig lagg0 up
575 1.2.2.2 cjep
576 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST0
577 1.2.2.2 cjep wait_for_distributing lagg0
578 1.2.2.2 cjep
579 1.2.2.2 cjep $atf_ifconfig vlan0 create
580 1.2.2.2 cjep $atf_ifconfig vlan0 vlan 10 vlanif lagg0
581 1.2.2.2 cjep $atf_ifconfig vlan0 $af $host0addr0/$pfx
582 1.2.2.2 cjep $atf_ifconfig vlan0 up
583 1.2.2.2 cjep
584 1.2.2.2 cjep $atf_ifconfig vlan1 create
585 1.2.2.2 cjep $atf_ifconfig vlan1 vlan 11 vlanif lagg0
586 1.2.2.2 cjep $atf_ifconfig vlan1 $af $host0addr1/$pfx
587 1.2.2.2 cjep $atf_ifconfig vlan1 up
588 1.2.2.2 cjep
589 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST1
590 1.2.2.2 cjep $atf_ifconfig vlan0 create
591 1.2.2.2 cjep $atf_ifconfig vlan0 vlan 10 vlanif lagg0
592 1.2.2.2 cjep $atf_ifconfig vlan0 $af $host1addr0/$pfx
593 1.2.2.2 cjep $atf_ifconfig vlan0 up
594 1.2.2.2 cjep
595 1.2.2.2 cjep $atf_ifconfig vlan1 create
596 1.2.2.2 cjep $atf_ifconfig vlan1 vlan 11 vlanif lagg0
597 1.2.2.2 cjep $atf_ifconfig vlan1 $af $host1addr1/$pfx
598 1.2.2.2 cjep $atf_ifconfig vlan1 up
599 1.2.2.2 cjep
600 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST0
601 1.2.2.2 cjep $atf_ifconfig -w 10
602 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST1
603 1.2.2.2 cjep $atf_ifconfig -w 10
604 1.2.2.2 cjep
605 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST0
606 1.2.2.2 cjep $atf_ping $host1addr0
607 1.2.2.2 cjep $atf_ping $host1addr1
608 1.2.2.2 cjep
609 1.2.2.2 cjep $atf_ifconfig lagg0 laggport shmif1
610 1.2.2.2 cjep $atf_ifconfig shmif1 up
611 1.2.2.2 cjep
612 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST1
613 1.2.2.2 cjep $atf_ifconfig lagg0 laggport shmif1
614 1.2.2.2 cjep $atf_ifconfig shmif1 up
615 1.2.2.2 cjep
616 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST0
617 1.2.2.2 cjep wait_for_distributing lagg0 shmif1
618 1.2.2.2 cjep
619 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST1
620 1.2.2.2 cjep wait_for_distributing lagg0 shmif1
621 1.2.2.2 cjep
622 1.2.2.2 cjep $atf_ping $host0addr0
623 1.2.2.2 cjep $atf_ping $host0addr1
624 1.2.2.2 cjep }
625 1.2.2.2 cjep
626 1.2.2.2 cjep atf_test_case lagg_lacp_vlan_ipv4 cleanup
627 1.2.2.2 cjep lagg_lacp_vlan_ipv4_head()
628 1.2.2.2 cjep {
629 1.2.2.2 cjep
630 1.2.2.2 cjep atf_set "descr" "tests for IPv4 VLAN frames over LACP LAG"
631 1.2.2.2 cjep atf_set "require.progs" "rump_server"
632 1.2.2.2 cjep }
633 1.2.2.2 cjep
634 1.2.2.2 cjep lagg_lacp_vlan_ipv4_body()
635 1.2.2.2 cjep {
636 1.2.2.2 cjep
637 1.2.2.2 cjep lagg_lacp_vlan "inet"
638 1.2.2.2 cjep }
639 1.2.2.2 cjep
640 1.2.2.2 cjep lagg_lacp_vlan_ipv4_cleanup()
641 1.2.2.2 cjep {
642 1.2.2.2 cjep $DEBUG && dump
643 1.2.2.2 cjep cleanup
644 1.2.2.2 cjep }
645 1.2.2.2 cjep
646 1.2.2.2 cjep atf_test_case lagg_lacp_vlan_ipv6 cleanup
647 1.2.2.2 cjep lagg_lacp_vlan_ipv6_head()
648 1.2.2.2 cjep {
649 1.2.2.2 cjep
650 1.2.2.2 cjep atf_set "descr" "tests for IPv6 VLAN frames over LACP LAG"
651 1.2.2.2 cjep atf_set "require.progs" "rump_server"
652 1.2.2.2 cjep }
653 1.2.2.2 cjep
654 1.2.2.2 cjep lagg_lacp_vlan_ipv6_body()
655 1.2.2.2 cjep {
656 1.2.2.2 cjep
657 1.2.2.2 cjep lagg_lacp_vlan "inet"
658 1.2.2.2 cjep }
659 1.2.2.2 cjep
660 1.2.2.2 cjep lagg_lacp_vlan_ipv6_cleanup()
661 1.2.2.2 cjep {
662 1.2.2.2 cjep $DEBUG && dump
663 1.2.2.2 cjep cleanup
664 1.2.2.2 cjep }
665 1.2.2.2 cjep
666 1.2.2.2 cjep atf_test_case lagg_lacp_portpri cleanup
667 1.2.2.2 cjep lagg_lacp_portpri_head()
668 1.2.2.2 cjep {
669 1.2.2.2 cjep
670 1.2.2.2 cjep atf_set "descr" "tests for LACP port priority"
671 1.2.2.2 cjep atf_set "require.progs" "rump_server"
672 1.2.2.2 cjep }
673 1.2.2.2 cjep
674 1.2.2.2 cjep lagg_lacp_portpri_body()
675 1.2.2.2 cjep {
676 1.2.2.2 cjep local atf_ifconfig="atf_check -s exit:0 rump.ifconfig"
677 1.2.2.2 cjep
678 1.2.2.2 cjep rump_server_start $SOCK_HOST0 lagg
679 1.2.2.2 cjep rump_server_start $SOCK_HOST1 lagg
680 1.2.2.2 cjep
681 1.2.2.2 cjep rump_server_add_iface $SOCK_HOST0 shmif0 $BUS0
682 1.2.2.2 cjep rump_server_add_iface $SOCK_HOST0 shmif1 $BUS1
683 1.2.2.2 cjep rump_server_add_iface $SOCK_HOST0 shmif2 $BUS2
684 1.2.2.2 cjep
685 1.2.2.2 cjep rump_server_add_iface $SOCK_HOST1 shmif0 $BUS0
686 1.2.2.2 cjep rump_server_add_iface $SOCK_HOST1 shmif1 $BUS1
687 1.2.2.2 cjep rump_server_add_iface $SOCK_HOST1 shmif2 $BUS2
688 1.2.2.2 cjep
689 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST0
690 1.2.2.2 cjep $atf_ifconfig lagg0 create
691 1.2.2.2 cjep $atf_ifconfig lagg0 laggproto lacp
692 1.2.2.2 cjep $atf_ifconfig lagg0 lagglacp maxports 2
693 1.2.2.2 cjep
694 1.2.2.2 cjep $atf_ifconfig shmif0 up
695 1.2.2.2 cjep $atf_ifconfig shmif1 up
696 1.2.2.2 cjep $atf_ifconfig shmif2 up
697 1.2.2.2 cjep
698 1.2.2.2 cjep $atf_ifconfig lagg0 laggport shmif0 pri 1000
699 1.2.2.2 cjep $atf_ifconfig lagg0 laggport shmif1 pri 2000
700 1.2.2.2 cjep $atf_ifconfig lagg0 laggport shmif2 pri 3000
701 1.2.2.2 cjep $atf_ifconfig lagg0 up
702 1.2.2.2 cjep
703 1.2.2.2 cjep atf_check -s exit:0 -o match:'shmif0 pri=1000' rump.ifconfig lagg0
704 1.2.2.2 cjep atf_check -s exit:0 -o match:'shmif1 pri=2000' rump.ifconfig lagg0
705 1.2.2.2 cjep atf_check -s exit:0 -o match:'shmif2 pri=3000' rump.ifconfig lagg0
706 1.2.2.2 cjep
707 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST1
708 1.2.2.2 cjep $atf_ifconfig lagg0 create
709 1.2.2.2 cjep $atf_ifconfig lagg0 laggproto lacp
710 1.2.2.2 cjep
711 1.2.2.2 cjep $atf_ifconfig shmif0 up
712 1.2.2.2 cjep $atf_ifconfig shmif1 up
713 1.2.2.2 cjep $atf_ifconfig shmif2 up
714 1.2.2.2 cjep
715 1.2.2.2 cjep $atf_ifconfig lagg0 laggport shmif0 pri 300
716 1.2.2.2 cjep $atf_ifconfig lagg0 laggport shmif1 pri 200
717 1.2.2.2 cjep $atf_ifconfig lagg0 laggport shmif2 pri 100
718 1.2.2.2 cjep $atf_ifconfig lagg0 up
719 1.2.2.2 cjep
720 1.2.2.2 cjep atf_check -s exit:0 -o match:'shmif0 pri=300' rump.ifconfig lagg0
721 1.2.2.2 cjep atf_check -s exit:0 -o match:'shmif1 pri=200' rump.ifconfig lagg0
722 1.2.2.2 cjep atf_check -s exit:0 -o match:'shmif2 pri=100' rump.ifconfig lagg0
723 1.2.2.2 cjep
724 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST0
725 1.2.2.2 cjep wait_for_distributing lagg0 shmif0
726 1.2.2.2 cjep wait_for_distributing lagg0 shmif1
727 1.2.2.2 cjep wait_state "STANDBY" lagg0 shmif2
728 1.2.2.2 cjep
729 1.2.2.2 cjep $atf_ifconfig shmif0 down
730 1.2.2.2 cjep wait_for_distributing lagg0 shmif2
731 1.2.2.2 cjep
732 1.2.2.2 cjep $atf_ifconfig shmif0 up
733 1.2.2.2 cjep wait_for_distributing lagg0 shmif0
734 1.2.2.2 cjep
735 1.2.2.2 cjep $atf_ifconfig lagg0 laggportpri shmif0 5000
736 1.2.2.2 cjep $atf_ifconfig lagg0 laggportpri shmif1 5000
737 1.2.2.2 cjep $atf_ifconfig lagg0 laggportpri shmif2 5000
738 1.2.2.2 cjep
739 1.2.2.2 cjep atf_check -s exit:0 -o match:'shmif0 pri=5000' rump.ifconfig lagg0
740 1.2.2.2 cjep atf_check -s exit:0 -o match:'shmif1 pri=5000' rump.ifconfig lagg0
741 1.2.2.2 cjep atf_check -s exit:0 -o match:'shmif2 pri=5000' rump.ifconfig lagg0
742 1.2.2.2 cjep
743 1.2.2.2 cjep wait_state "STANDBY" lagg0 shmif0
744 1.2.2.2 cjep wait_for_distributing lagg0 shmif1
745 1.2.2.2 cjep wait_for_distributing lagg0 shmif2
746 1.2.2.2 cjep }
747 1.2.2.2 cjep
748 1.2.2.2 cjep lagg_lacp_portpri_cleanup()
749 1.2.2.2 cjep {
750 1.2.2.2 cjep
751 1.2.2.2 cjep $DEBUG && dump
752 1.2.2.2 cjep cleanup
753 1.2.2.2 cjep }
754 1.2.2.2 cjep
755 1.2.2.2 cjep lagg_failover()
756 1.2.2.2 cjep {
757 1.2.2.2 cjep local atf_ifconfig="atf_check -s exit:0 rump.ifconfig"
758 1.2.2.2 cjep
759 1.2.2.2 cjep local af=$1
760 1.2.2.2 cjep local ping="rump.ping -c 1"
761 1.2.2.2 cjep local rumplib=""
762 1.2.2.2 cjep local pfx=24
763 1.2.2.2 cjep local addr_host0=$IP4ADDR0
764 1.2.2.2 cjep local addr_host1=$IP4ADDR1
765 1.2.2.2 cjep
766 1.2.2.2 cjep case $af in
767 1.2.2.2 cjep "inet")
768 1.2.2.2 cjep # do nothing
769 1.2.2.2 cjep ;;
770 1.2.2.2 cjep "inet6")
771 1.2.2.2 cjep ping="rump.ping6 -c 1"
772 1.2.2.2 cjep rumplib="netinet6"
773 1.2.2.2 cjep pfx=64
774 1.2.2.2 cjep addr_host0=$IP6ADDR0
775 1.2.2.2 cjep addr_host1=$IP6ADDR1
776 1.2.2.2 cjep ;;
777 1.2.2.2 cjep esac
778 1.2.2.2 cjep
779 1.2.2.2 cjep local atf_ping="atf_check -s exit:0 -o ignore ${ping}"
780 1.2.2.2 cjep
781 1.2.2.2 cjep rump_server_start $SOCK_HOST0 lagg $rumplib
782 1.2.2.2 cjep rump_server_start $SOCK_HOST1 lagg $rumplib
783 1.2.2.2 cjep
784 1.2.2.2 cjep rump_server_add_iface $SOCK_HOST0 shmif0 $BUS0
785 1.2.2.2 cjep rump_server_add_iface $SOCK_HOST0 shmif1 $BUS1
786 1.2.2.2 cjep rump_server_add_iface $SOCK_HOST0 shmif2 $BUS2
787 1.2.2.2 cjep
788 1.2.2.2 cjep rump_server_add_iface $SOCK_HOST1 shmif0 $BUS0
789 1.2.2.2 cjep rump_server_add_iface $SOCK_HOST1 shmif1 $BUS1
790 1.2.2.2 cjep rump_server_add_iface $SOCK_HOST1 shmif2 $BUS2
791 1.2.2.2 cjep
792 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST0
793 1.2.2.2 cjep $atf_ifconfig lagg0 create
794 1.2.2.2 cjep $atf_ifconfig lagg0 laggproto failover
795 1.2.2.2 cjep
796 1.2.2.2 cjep $atf_ifconfig lagg0 laggport shmif0 pri 1000
797 1.2.2.2 cjep $atf_ifconfig lagg0 laggport shmif1 pri 2000
798 1.2.2.2 cjep $atf_ifconfig lagg0 laggport shmif2 pri 3000
799 1.2.2.2 cjep $atf_ifconfig lagg0 $af $addr_host0/$pfx
800 1.2.2.2 cjep
801 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST1
802 1.2.2.2 cjep $atf_ifconfig lagg0 create
803 1.2.2.2 cjep $atf_ifconfig lagg0 laggproto failover
804 1.2.2.2 cjep
805 1.2.2.2 cjep $atf_ifconfig lagg0 laggport shmif0 pri 1000
806 1.2.2.2 cjep $atf_ifconfig lagg0 laggport shmif1 pri 3000
807 1.2.2.2 cjep $atf_ifconfig lagg0 laggport shmif2 pri 2000
808 1.2.2.2 cjep $atf_ifconfig lagg0 $af $addr_host1/$pfx
809 1.2.2.2 cjep
810 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST0
811 1.2.2.2 cjep $atf_ifconfig shmif0 up
812 1.2.2.2 cjep $atf_ifconfig shmif1 up
813 1.2.2.2 cjep $atf_ifconfig shmif2 up
814 1.2.2.2 cjep $atf_ifconfig lagg0 up
815 1.2.2.2 cjep
816 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST1
817 1.2.2.2 cjep $atf_ifconfig shmif0 up
818 1.2.2.2 cjep $atf_ifconfig shmif1 up
819 1.2.2.2 cjep $atf_ifconfig shmif2 up
820 1.2.2.2 cjep $atf_ifconfig lagg0 up
821 1.2.2.2 cjep
822 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST0
823 1.2.2.2 cjep $atf_ifconfig -w 10
824 1.2.2.2 cjep wait_for_distributing lagg0 shmif0
825 1.2.2.2 cjep wait_state "COLLECTING" lagg0 shmif0
826 1.2.2.2 cjep wait_state "COLLECTING" lagg0 shmif1
827 1.2.2.2 cjep wait_state "COLLECTING" lagg0 shmif2
828 1.2.2.2 cjep
829 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST1
830 1.2.2.2 cjep $atf_ifconfig -w 10
831 1.2.2.2 cjep wait_for_distributing lagg0 shmif0
832 1.2.2.2 cjep wait_state "COLLECTING" lagg0 shmif0
833 1.2.2.2 cjep wait_state "COLLECTING" lagg0 shmif1
834 1.2.2.2 cjep wait_state "COLLECTING" lagg0 shmif2
835 1.2.2.2 cjep
836 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST0
837 1.2.2.2 cjep $atf_ping $addr_host1
838 1.2.2.2 cjep
839 1.2.2.2 cjep $atf_ifconfig shmif0 down
840 1.2.2.2 cjep wait_for_distributing lagg0 shmif1
841 1.2.2.2 cjep wait_state "COLLECTING" lagg0 shmif1
842 1.2.2.2 cjep wait_state "COLLECTING" lagg0 shmif2
843 1.2.2.2 cjep
844 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST1
845 1.2.2.2 cjep $atf_ifconfig shmif0 down
846 1.2.2.2 cjep wait_for_distributing lagg0 shmif2
847 1.2.2.2 cjep wait_state "COLLECTING" lagg0 shmif2
848 1.2.2.2 cjep wait_state "COLLECTING" lagg0 shmif1
849 1.2.2.2 cjep
850 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST0
851 1.2.2.2 cjep $atf_ping $addr_host1
852 1.2.2.2 cjep
853 1.2.2.2 cjep $atf_ifconfig lagg0 laggfailover -rx-all
854 1.2.2.2 cjep atf_check -s exit:0 -o not-match:'shmif2.+COLLECTING' rump.ifconfig lagg0
855 1.2.2.2 cjep
856 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST1
857 1.2.2.2 cjep $atf_ifconfig lagg0 laggfailover -rx-all
858 1.2.2.2 cjep atf_check -s exit:0 -o not-match:'shmif1.+COLLECTING' rump.ifconfig lagg0
859 1.2.2.2 cjep
860 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST0
861 1.2.2.2 cjep atf_check -s not-exit:0 -o ignore -e ignore $ping -c 1 $addr_host1
862 1.2.2.2 cjep }
863 1.2.2.2 cjep
864 1.2.2.2 cjep atf_test_case lagg_failover_ipv4 cleanup
865 1.2.2.2 cjep lagg_failover_ipv4_head()
866 1.2.2.2 cjep {
867 1.2.2.2 cjep
868 1.2.2.2 cjep atf_set "descr" "tests for failover using IPv4"
869 1.2.2.2 cjep atf_set "require.progs" "rump_server"
870 1.2.2.2 cjep }
871 1.2.2.2 cjep
872 1.2.2.2 cjep lagg_failover_ipv4_body()
873 1.2.2.2 cjep {
874 1.2.2.2 cjep
875 1.2.2.2 cjep lagg_failover "inet"
876 1.2.2.2 cjep }
877 1.2.2.2 cjep
878 1.2.2.2 cjep lagg_failover_ipv4_cleanup()
879 1.2.2.2 cjep {
880 1.2.2.2 cjep
881 1.2.2.2 cjep $DEBUG && dump
882 1.2.2.2 cjep cleanup
883 1.2.2.2 cjep }
884 1.2.2.2 cjep
885 1.2.2.2 cjep atf_test_case lagg_failover_ipv6 cleanup
886 1.2.2.2 cjep lagg_failover_ipv6_head()
887 1.2.2.2 cjep {
888 1.2.2.2 cjep
889 1.2.2.2 cjep atf_set "descr" "tests for failover using IPv6"
890 1.2.2.2 cjep atf_set "require.progs" "rump_server"
891 1.2.2.2 cjep }
892 1.2.2.2 cjep
893 1.2.2.2 cjep lagg_failover_ipv6_body()
894 1.2.2.2 cjep {
895 1.2.2.2 cjep
896 1.2.2.2 cjep lagg_failover "inet6"
897 1.2.2.2 cjep }
898 1.2.2.2 cjep
899 1.2.2.2 cjep lagg_failover_ipv6_cleanup()
900 1.2.2.2 cjep {
901 1.2.2.2 cjep
902 1.2.2.2 cjep $DEBUG && dump
903 1.2.2.2 cjep cleanup
904 1.2.2.2 cjep }
905 1.2.2.2 cjep
906 1.2.2.2 cjep lagg_loadbalance()
907 1.2.2.2 cjep {
908 1.2.2.2 cjep local atf_ifconfig="atf_check -s exit:0 rump.ifconfig"
909 1.2.2.2 cjep
910 1.2.2.2 cjep local af=$1
911 1.2.2.2 cjep local ping="rump.ping -c 1"
912 1.2.2.2 cjep local rumplib=""
913 1.2.2.2 cjep local pfx=24
914 1.2.2.2 cjep local addr_host0=$IP4ADDR0
915 1.2.2.2 cjep local addr_host1=$IP4ADDR1
916 1.2.2.2 cjep
917 1.2.2.2 cjep case $af in
918 1.2.2.2 cjep "inet")
919 1.2.2.2 cjep # do nothing
920 1.2.2.2 cjep ;;
921 1.2.2.2 cjep "inet6")
922 1.2.2.2 cjep ping="rump.ping6 -c 1"
923 1.2.2.2 cjep rumplib="netinet6"
924 1.2.2.2 cjep pfx=64
925 1.2.2.2 cjep addr_host0=$IP6ADDR0
926 1.2.2.2 cjep addr_host1=$IP6ADDR1
927 1.2.2.2 cjep ;;
928 1.2.2.2 cjep esac
929 1.2.2.2 cjep
930 1.2.2.2 cjep local atf_ping="atf_check -s exit:0 -o ignore ${ping}"
931 1.2.2.2 cjep
932 1.2.2.2 cjep rump_server_start $SOCK_HOST0 lagg $rumplib
933 1.2.2.2 cjep rump_server_start $SOCK_HOST1 lagg $rumplib
934 1.2.2.2 cjep
935 1.2.2.2 cjep rump_server_add_iface $SOCK_HOST0 shmif0 $BUS0
936 1.2.2.2 cjep rump_server_add_iface $SOCK_HOST0 shmif1 $BUS1
937 1.2.2.2 cjep rump_server_add_iface $SOCK_HOST0 shmif2 $BUS2
938 1.2.2.2 cjep
939 1.2.2.2 cjep rump_server_add_iface $SOCK_HOST1 shmif0 $BUS0
940 1.2.2.2 cjep rump_server_add_iface $SOCK_HOST1 shmif1 $BUS1
941 1.2.2.2 cjep rump_server_add_iface $SOCK_HOST1 shmif2 $BUS2
942 1.2.2.2 cjep
943 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST0
944 1.2.2.2 cjep $atf_ifconfig lagg0 create
945 1.2.2.2 cjep $atf_ifconfig lagg0 laggproto loadbalance
946 1.2.2.2 cjep
947 1.2.2.2 cjep $atf_ifconfig lagg0 laggport shmif0 pri 1000
948 1.2.2.2 cjep $atf_ifconfig lagg0 laggport shmif1 pri 2000
949 1.2.2.2 cjep $atf_ifconfig lagg0 laggport shmif2 pri 3000
950 1.2.2.2 cjep $atf_ifconfig lagg0 $af $addr_host0/$pfx
951 1.2.2.2 cjep
952 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST1
953 1.2.2.2 cjep $atf_ifconfig lagg0 create
954 1.2.2.2 cjep $atf_ifconfig lagg0 laggproto loadbalance
955 1.2.2.2 cjep
956 1.2.2.2 cjep $atf_ifconfig lagg0 laggport shmif0 pri 1000
957 1.2.2.2 cjep $atf_ifconfig lagg0 laggport shmif1 pri 3000
958 1.2.2.2 cjep $atf_ifconfig lagg0 laggport shmif2 pri 2000
959 1.2.2.2 cjep $atf_ifconfig lagg0 $af $addr_host1/$pfx
960 1.2.2.2 cjep
961 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST0
962 1.2.2.2 cjep $atf_ifconfig shmif0 up
963 1.2.2.2 cjep $atf_ifconfig shmif1 up
964 1.2.2.2 cjep $atf_ifconfig shmif2 up
965 1.2.2.2 cjep $atf_ifconfig lagg0 up
966 1.2.2.2 cjep
967 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST1
968 1.2.2.2 cjep $atf_ifconfig shmif0 up
969 1.2.2.2 cjep $atf_ifconfig shmif1 up
970 1.2.2.2 cjep $atf_ifconfig shmif2 up
971 1.2.2.2 cjep $atf_ifconfig lagg0 up
972 1.2.2.2 cjep
973 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST0
974 1.2.2.2 cjep $atf_ifconfig -w 10
975 1.2.2.2 cjep wait_for_distributing lagg0 shmif0
976 1.2.2.2 cjep wait_state "COLLECTING" lagg0 shmif0
977 1.2.2.2 cjep wait_state "COLLECTING" lagg0 shmif1
978 1.2.2.2 cjep wait_state "COLLECTING" lagg0 shmif2
979 1.2.2.2 cjep
980 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST1
981 1.2.2.2 cjep $atf_ifconfig -w 10
982 1.2.2.2 cjep wait_state "COLLECTING,DISTRIBUTING" lagg0 shmif0
983 1.2.2.2 cjep wait_state "COLLECTING,DISTRIBUTING" lagg0 shmif1
984 1.2.2.2 cjep wait_state "COLLECTING,DISTRIBUTING" lagg0 shmif2
985 1.2.2.2 cjep
986 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST0
987 1.2.2.2 cjep $atf_ping $addr_host1
988 1.2.2.2 cjep
989 1.2.2.2 cjep $atf_ifconfig shmif0 down
990 1.2.2.2 cjep wait_state "COLLECTING,DISTRIBUTING" lagg0 shmif1
991 1.2.2.2 cjep wait_state "COLLECTING,DISTRIBUTING" lagg0 shmif2
992 1.2.2.2 cjep
993 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST1
994 1.2.2.2 cjep $atf_ifconfig shmif0 down
995 1.2.2.2 cjep wait_state "COLLECTING,DISTRIBUTING" lagg0 shmif1
996 1.2.2.2 cjep wait_state "COLLECTING,DISTRIBUTING" lagg0 shmif2
997 1.2.2.2 cjep
998 1.2.2.2 cjep export RUMP_SERVER=$SOCK_HOST0
999 1.2.2.2 cjep $atf_ping $addr_host1
1000 1.2.2.2 cjep }
1001 1.2.2.2 cjep
1002 1.2.2.2 cjep atf_test_case lagg_loadbalance_ipv4 cleanup
1003 1.2.2.2 cjep lagg_loadbalance_ipv4_head()
1004 1.2.2.2 cjep {
1005 1.2.2.2 cjep
1006 1.2.2.2 cjep atf_set "descr" "tests for loadbalance using IPv4"
1007 1.2.2.2 cjep atf_set "require.progs" "rump_server"
1008 1.2.2.2 cjep }
1009 1.2.2.2 cjep
1010 1.2.2.2 cjep lagg_loadbalance_ipv4_body()
1011 1.2.2.2 cjep {
1012 1.2.2.2 cjep
1013 1.2.2.2 cjep lagg_loadbalance "inet"
1014 1.2.2.2 cjep }
1015 1.2.2.2 cjep
1016 1.2.2.2 cjep lagg_loadbalance_ipv4_cleanup()
1017 1.2.2.2 cjep {
1018 1.2.2.2 cjep
1019 1.2.2.2 cjep $DEBUG && dump
1020 1.2.2.2 cjep cleanup
1021 1.2.2.2 cjep }
1022 1.2.2.2 cjep
1023 1.2.2.2 cjep atf_test_case lagg_loadbalance_ipv6 cleanup
1024 1.2.2.2 cjep lagg_loadbalance_ipv6_head()
1025 1.2.2.2 cjep {
1026 1.2.2.2 cjep
1027 1.2.2.2 cjep atf_set "descr" "tests for loadbalance using IPv6"
1028 1.2.2.2 cjep atf_set "require.progs" "rump_server"
1029 1.2.2.2 cjep }
1030 1.2.2.2 cjep
1031 1.2.2.2 cjep lagg_loadbalance_ipv6_body()
1032 1.2.2.2 cjep {
1033 1.2.2.2 cjep
1034 1.2.2.2 cjep lagg_loadbalance "inet6"
1035 1.2.2.2 cjep }
1036 1.2.2.2 cjep
1037 1.2.2.2 cjep lagg_loadbalance_ipv6_cleanup()
1038 1.2.2.2 cjep {
1039 1.2.2.2 cjep
1040 1.2.2.2 cjep $DEBUG && dump
1041 1.2.2.2 cjep cleanup
1042 1.2.2.2 cjep }
1043 1.2.2.2 cjep
1044 1.2.2.2 cjep atf_init_test_cases()
1045 1.2.2.2 cjep {
1046 1.2.2.2 cjep
1047 1.2.2.2 cjep atf_add_test_case lagg_ifconfig
1048 1.2.2.2 cjep atf_add_test_case lagg_macaddr
1049 1.2.2.2 cjep atf_add_test_case lagg_ipv6lla
1050 1.2.2.2 cjep atf_add_test_case lagg_lacp_basic
1051 1.2.2.2 cjep atf_add_test_case lagg_lacp_ipv4
1052 1.2.2.2 cjep atf_add_test_case lagg_lacp_ipv6
1053 1.2.2.2 cjep atf_add_test_case lagg_lacp_vlan_ipv4
1054 1.2.2.2 cjep atf_add_test_case lagg_lacp_vlan_ipv6
1055 1.2.2.2 cjep atf_add_test_case lagg_lacp_portpri
1056 1.2.2.2 cjep atf_add_test_case lagg_failover_ipv4
1057 1.2.2.2 cjep atf_add_test_case lagg_failover_ipv6
1058 1.2.2.2 cjep atf_add_test_case lagg_loadbalance_ipv4
1059 1.2.2.2 cjep atf_add_test_case lagg_loadbalance_ipv6
1060 1.2.2.2 cjep }
1061