2 # SPDX-License-Identifier: GPL-2.0
4 # +--------------------------------------------+
7 # | + LAG1.100 + LAG1.200 |
8 # | | 192.0.2.1/28 | 192.0.2.17/28 |
9 # | | 2001:db8:1::1/64 | 2001:db8:3:1/64 |
10 # | \___________ _______/ |
18 # +----------|-----------|---------------------+
20 # +----------|-----------|---------------------+
27 # | _______^______________ |
29 # | +------|------------+ +-------|----------+ |
30 # | | + LAG2.100 | | + LAG2.200 | |
32 # | | BR1 (802.1d) | | BR2 (802.1d) | |
33 # | | 192.0.2.2/28 | | 192.0.2.18/28 | |
34 # | | 2001:db8:1::2/64 | | 2001:db8:3:2/64 | |
36 # | +-------------------+ +------------------+ |
38 # | + LAG3.100 + LAG3.200 |
39 # | | 192.0.2.129/28 | 192.0.2.145/28 |
40 # | | 2001:db8:2::1/64 | 2001:db8:4::1/64 |
42 # | \_________ ___________/ |
49 # +-------|---------|--------------------------+
51 # +-------|---------|--------------------------+
58 # | __________^__________ |
61 # | + LAG4.100 + LAG4.200 |
62 # | 192.0.2.130/28 192.0.2.146/28 |
63 # | 2001:db8:2::2/64 2001:db8:4::2/64 |
66 # +--------------------------------------------+
72 $(: exercise remastering of LAG2 slaves )
89 $(: exercise remastering of LAG2 itself )
95 $(: exercise remastering of LAG3 slaves )
117 team_create lag1 lacp
118 ip link
set dev lag1 addrgenmode none
119 ip link
set dev lag1 address $
(mac_get
$h1)
120 ip link
set dev
$h1 master lag1
121 ip link
set dev
$h4 master lag1
123 ip link
set dev
$h1 up
124 ip link
set dev
$h4 up
126 vlan_create lag1
100 vlag1
192.0.2.1/28 2001:db8
:1::1/64
127 vlan_create lag1
200 vlag1
192.0.2.17/28 2001:db8
:3::1/64
129 ip
-4 route add
192.0.2.128/28 vrf vlag1 nexthop via
192.0.2.2
130 ip
-6 route add
2001:db8
:2::/64 vrf vlag1 nexthop via
2001:db8
:1::2
132 ip
-4 route add
192.0.2.144/28 vrf vlag1 nexthop via
192.0.2.18
133 ip
-6 route add
2001:db8
:4::/64 vrf vlag1 nexthop via
2001:db8
:3::2
138 ip
-6 route del
2001:db8
:4::/64 vrf vlag1
139 ip
-4 route del
192.0.2.144/28 vrf vlag1
141 ip
-6 route del
2001:db8
:2::/64 vrf vlag1
142 ip
-4 route del
192.0.2.128/28 vrf vlag1
144 vlan_destroy lag1
200
145 vlan_destroy lag1
100
147 ip link
set dev
$h4 down
148 ip link
set dev
$h1 down
150 ip link
set dev
$h4 nomaster
151 ip link
set dev
$h1 nomaster
157 team_create lag4 lacp
158 ip link
set dev lag4 addrgenmode none
159 ip link
set dev lag4 address $
(mac_get
$h2)
160 ip link
set dev
$h2 master lag4
161 ip link
set dev
$h3 master lag4
163 ip link
set dev
$h2 up
164 ip link
set dev
$h3 up
166 vlan_create lag4
100 vlag4
192.0.2.130/28 2001:db8
:2::2/64
167 vlan_create lag4
200 vlag4
192.0.2.146/28 2001:db8
:4::2/64
169 ip
-4 route add
192.0.2.0/28 vrf vlag4 nexthop via
192.0.2.129
170 ip
-6 route add
2001:db8
:1::/64 vrf vlag4 nexthop via
2001:db8
:2::1
172 ip
-4 route add
192.0.2.16/28 vrf vlag4 nexthop via
192.0.2.145
173 ip
-6 route add
2001:db8
:3::/64 vrf vlag4 nexthop via
2001:db8
:4::1
178 ip
-6 route del
2001:db8
:3::/64 vrf vlag4
179 ip
-4 route del
192.0.2.16/28 vrf vlag4
181 ip
-6 route del
2001:db8
:1::/64 vrf vlag4
182 ip
-4 route del
192.0.2.0/28 vrf vlag4
184 vlan_destroy lag4
200
185 vlan_destroy lag4
100
187 ip link
set dev
$h3 down
188 ip link
set dev
$h2 down
190 ip link
set dev
$h3 nomaster
191 ip link
set dev
$h2 nomaster
197 team_create lag2 lacp
198 ip link
set dev lag2 addrgenmode none
199 ip link
set dev lag2 address $
(mac_get
$swp1)
200 ip link
set dev
$swp1 master lag2
201 ip link
set dev
$swp4 master lag2
206 ip link add name br1
type bridge vlan_filtering
0
207 ip link
set dev br1 address $
(mac_get lag2.100
)
208 ip link
set dev lag2.100 master br1
210 ip link add name br2
type bridge vlan_filtering
0
211 ip link
set dev br2 address $
(mac_get lag2.200
)
212 ip link
set dev lag2.200 master br2
214 ip link
set dev
$swp1 up
215 ip link
set dev
$swp4 up
216 ip link
set dev br1 up
217 ip link
set dev br2 up
219 __addr_add_del br1 add
192.0.2.2/28 2001:db8
:1::2/64
220 __addr_add_del br2 add
192.0.2.18/28 2001:db8
:3::2/64
222 team_create lag3 lacp
223 ip link
set dev lag3 addrgenmode none
224 ip link
set dev lag3 address $
(mac_get
$swp2)
225 ip link
set dev
$swp2 master lag3
226 ip link
set dev
$swp3 master lag3
227 ip link
set dev
$swp2 up
228 ip link
set dev
$swp3 up
233 __addr_add_del lag3.100 add
192.0.2.129/28 2001:db8
:2::1/64
234 __addr_add_del lag3.200 add
192.0.2.145/28 2001:db8
:4::1/64
239 __addr_add_del lag3.200 del
192.0.2.145/28 2001:db8
:4::1/64
240 __addr_add_del lag3.100 del
192.0.2.129/28 2001:db8
:2::1/64
242 vlan_destroy lag3
200
243 vlan_destroy lag3
100
245 ip link
set dev
$swp3 down
246 ip link
set dev
$swp2 down
247 ip link
set dev
$swp3 nomaster
248 ip link
set dev
$swp2 nomaster
251 __addr_add_del br2 del
192.0.2.18/28 2001:db8
:3::2/64
252 __addr_add_del br1 del
192.0.2.2/28 2001:db8
:1::2/64
254 ip link
set dev br2 down
255 ip link
set dev br1 down
256 ip link
set dev
$swp4 down
257 ip link
set dev
$swp1 down
259 ip link
set dev lag2.200 nomaster
262 ip link
set dev lag2.100 nomaster
265 vlan_destroy lag2
200
266 vlan_destroy lag2
100
268 ip link
set dev
$swp4 nomaster
269 ip link
set dev
$swp1 nomaster
273 config_remaster_lag2
()
275 log_info
"Remaster bridge slaves"
277 ip link
set dev lag2.200 nomaster
278 ip link
set dev lag2.100 nomaster
280 ip link
set dev lag2.100 master br1
281 ip link
set dev lag2.200 master br2
286 local netdev
=$1; shift
288 log_info
"Deslave $netdev"
289 ip link
set dev
$netdev down
290 ip link
set dev
$netdev nomaster
291 ip link
set dev
$netdev up
294 config_deslave_swp1
()
299 config_deslave_swp2
()
304 config_deslave_swp3
()
309 config_deslave_swp4
()
316 local netdev
=$1; shift
317 local master
=$1; shift
319 log_info
"Enslave $netdev to $master"
320 ip link
set dev
$netdev down
321 ip link
set dev
$netdev master
$master
322 ip link
set dev
$netdev up
325 config_enslave_swp1
()
327 config_enslave
$swp1 lag2
330 config_enslave_swp2
()
332 config_enslave
$swp2 lag3
335 config_enslave_swp3
()
337 config_enslave
$swp3 lag3
340 config_enslave_swp4
()
342 config_enslave
$swp4 lag2
391 ping_test lag1.100
192.0.2.130 ": via 100"
392 ping_test lag1.200
192.0.2.146 ": via 200"
397 ping6_test lag1.100
2001:db8
:2::2 ": via 100"
398 ping6_test lag1.200
2001:db8
:4::2 ": via 200"