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