2 # SPDX-License-Identifier: GPL-2.0
4 lib_dir
=$
(dirname $0)/..
/..
/..
/net
/forwarding
7 create_8021ad_vlan_upper_on_top_front_panel_port
8 create_8021ad_vlan_upper_on_top_bridge_port
9 create_8021ad_vlan_upper_on_top_lag
10 create_8021ad_vlan_upper_on_top_bridge
11 create_8021ad_vlan_upper_on_top_8021ad_bridge
12 create_vlan_upper_on_top_8021ad_bridge
13 create_vlan_upper_on_top_front_panel_enslaved_to_8021ad_bridge
14 create_vlan_upper_on_top_lag_enslaved_to_8021ad_bridge
15 enslave_front_panel_with_vlan_upper_to_8021ad_bridge
16 enslave_lag_with_vlan_upper_to_8021ad_bridge
17 add_ip_address_to_8021ad_bridge
18 switch_bridge_protocol_from_8021q_to_8021ad
21 source $lib_dir/lib.sh
28 ip link
set dev
$swp1 up
29 ip link
set dev
$swp2 up
38 ip link
set dev
$swp2 down
39 ip link
set dev
$swp1 down
42 create_vlan_upper_on_top_of_bridge
()
46 local bridge_proto
=$1; shift
47 local netdev_proto
=$1; shift
49 ip link add dev br0
type bridge vlan_filtering
1 \
50 vlan_protocol
$bridge_proto vlan_default_pvid
0 mcast_snooping
0
52 ip link
set dev br0 up
53 ip link
set dev
$swp1 master br0
55 ip link add name br0.100 link br0
type vlan \
56 protocol
$netdev_proto id
100 2>/dev
/null
57 check_fail $?
"$netdev_proto vlan upper creation on top of an $bridge_proto bridge not rejected"
59 ip link add name br0.100 link br0
type vlan \
60 protocol
$netdev_proto id
100 2>&1 >/dev
/null \
61 |
grep -q mlxsw_spectrum
62 check_err $?
"$netdev_proto vlan upper creation on top of an $bridge_proto bridge rejected without extack"
64 log_test
"create $netdev_proto vlan upper on top $bridge_proto bridge"
69 create_8021ad_vlan_upper_on_top_front_panel_port
()
73 ip link add name
$swp1.100 link
$swp1 type vlan \
74 protocol
802.1ad id
100 2>/dev
/null
75 check_fail $?
"802.1ad vlan upper creation on top of a front panel not rejected"
77 ip link add name
$swp1.100 link
$swp1 type vlan \
78 protocol
802.1ad id
100 2>&1 >/dev
/null \
79 |
grep -q mlxsw_spectrum
80 check_err $?
"802.1ad vlan upper creation on top of a front panel rejected without extack"
82 log_test
"create 802.1ad vlan upper on top of a front panel"
85 create_8021ad_vlan_upper_on_top_bridge_port
()
89 ip link add dev br0
type bridge vlan_filtering
1 \
90 vlan_default_pvid
0 mcast_snooping
0
92 ip link
set dev
$swp1 master br0
93 ip link
set dev br0 up
95 ip link add name
$swp1.100 link
$swp1 type vlan \
96 protocol
802.1ad id
100 2>/dev
/null
97 check_fail $?
"802.1ad vlan upper creation on top of a bridge port not rejected"
99 ip link add name
$swp1.100 link
$swp1 type vlan \
100 protocol
802.1ad id
100 2>&1 >/dev
/null \
101 |
grep -q mlxsw_spectrum
102 check_err $?
"802.1ad vlan upper creation on top of a bridge port rejected without extack"
104 log_test
"create 802.1ad vlan upper on top of a bridge port"
109 create_8021ad_vlan_upper_on_top_lag
()
113 ip link add name bond1
type bond mode
802.3ad
114 ip link
set dev
$swp1 down
115 ip link
set dev
$swp1 master bond1
117 ip link add name bond1.100 link bond1
type vlan \
118 protocol
802.1ad id
100 2>/dev
/null
119 check_fail $?
"802.1ad vlan upper creation on top of a lag not rejected"
121 ip link add name bond1.100 link bond1
type vlan \
122 protocol
802.1ad id
100 2>&1 >/dev
/null \
123 |
grep -q mlxsw_spectrum
124 check_err $?
"802.1ad vlan upper creation on top of a lag rejected without extack"
126 log_test
"create 802.1ad vlan upper on top of a lag"
128 ip link del dev bond1
131 create_8021ad_vlan_upper_on_top_bridge
()
135 create_vlan_upper_on_top_of_bridge
"802.1q" "802.1ad"
138 create_8021ad_vlan_upper_on_top_8021ad_bridge
()
142 create_vlan_upper_on_top_of_bridge
"802.1ad" "802.1ad"
145 create_vlan_upper_on_top_8021ad_bridge
()
149 create_vlan_upper_on_top_of_bridge
"802.1ad" "802.1q"
152 create_vlan_upper_on_top_front_panel_enslaved_to_8021ad_bridge
()
156 ip link add dev br0
type bridge vlan_filtering
1 \
157 vlan_protocol
802.1ad vlan_default_pvid
0 mcast_snooping
0
158 ip link
set dev br0 up
160 ip link
set dev
$swp1 master br0
162 ip link add name
$swp1.100 link
$swp1 type vlan id
100 2>/dev
/null
163 check_fail $?
"vlan upper creation on top of front panel enslaved to 802.1ad bridge not rejected"
165 ip link add name
$swp1.100 link
$swp1 type vlan id
100 2>&1 >/dev
/null \
166 |
grep -q mlxsw_spectrum
167 check_err $?
"vlan upper creation on top of front panel enslaved to 802.1ad bridge rejected without extack"
169 log_test
"create vlan upper on top of front panel enslaved to 802.1ad bridge"
174 create_vlan_upper_on_top_lag_enslaved_to_8021ad_bridge
()
178 ip link add dev br0
type bridge vlan_filtering
1 \
179 vlan_protocol
802.1ad vlan_default_pvid
0 mcast_snooping
0
180 ip link
set dev br0 up
182 ip link add name bond1
type bond mode
802.3ad
183 ip link
set dev
$swp1 down
184 ip link
set dev
$swp1 master bond1
185 ip link
set dev bond1 master br0
187 ip link add name bond1.100 link bond1
type vlan id
100 2>/dev
/null
188 check_fail $?
"vlan upper creation on top of lag enslaved to 802.1ad bridge not rejected"
190 ip link add name bond1.100 link bond1
type vlan id
100 2>&1 >/dev
/null \
191 |
grep -q mlxsw_spectrum
192 check_err $?
"vlan upper creation on top of lag enslaved to 802.1ad bridge rejected without extack"
194 log_test
"create vlan upper on top of lag enslaved to 802.1ad bridge"
196 ip link del dev bond1
200 enslave_front_panel_with_vlan_upper_to_8021ad_bridge
()
204 ip link add dev br0
type bridge vlan_filtering
1 \
205 vlan_protocol
802.1ad vlan_default_pvid
0 mcast_snooping
0
206 ip link
set dev br0 up
208 ip link add name
$swp1.100 link
$swp1 type vlan id
100
210 ip link
set dev
$swp1 master br0
2>/dev
/null
211 check_fail $?
"front panel with vlan upper enslavemnt to 802.1ad bridge not rejected"
213 ip link
set dev
$swp1 master br0
2>&1 >/dev
/null |
grep -q mlxsw_spectrum
214 check_err $?
"front panel with vlan upper enslavemnt to 802.1ad bridge rejected without extack"
216 log_test
"enslave front panel with vlan upper to 802.1ad bridge"
218 ip link del dev
$swp1.100
222 enslave_lag_with_vlan_upper_to_8021ad_bridge
()
226 ip link add dev br0
type bridge vlan_filtering
1 \
227 vlan_protocol
802.1ad vlan_default_pvid
0 mcast_snooping
0
228 ip link
set dev br0 up
230 ip link add name bond1
type bond mode
802.3ad
231 ip link
set dev
$swp1 down
232 ip link
set dev
$swp1 master bond1
233 ip link add name bond1.100 link bond1
type vlan id
100
235 ip link
set dev bond1 master br0
2>/dev
/null
236 check_fail $?
"lag with vlan upper enslavemnt to 802.1ad bridge not rejected"
238 ip link
set dev bond1 master br0
2>&1 >/dev
/null \
239 |
grep -q mlxsw_spectrum
240 check_err $?
"lag with vlan upper enslavemnt to 802.1ad bridge rejected without extack"
242 log_test
"enslave lag with vlan upper to 802.1ad bridge"
244 ip link del dev bond1
249 add_ip_address_to_8021ad_bridge
()
253 ip link add dev br0
type bridge vlan_filtering
1 \
254 vlan_protocol
802.1ad vlan_default_pvid
0 mcast_snooping
0
256 ip link
set dev br0 up
257 ip link
set dev
$swp1 master br0
259 ip addr add dev br0
192.0.2.17/28 2>/dev
/null
260 check_fail $?
"IP address addition to 802.1ad bridge not rejected"
262 ip addr add dev br0
192.0.2.17/28 2>&1 >/dev
/null |
grep -q mlxsw_spectrum
263 check_err $?
"IP address addition to 802.1ad bridge rejected without extack"
265 log_test
"IP address addition to 802.1ad bridge"
270 switch_bridge_protocol_from_8021q_to_8021ad
()
274 ip link add dev br0
type bridge vlan_filtering
1 \
275 vlan_protocol
802.1ad vlan_default_pvid
0 mcast_snooping
0
277 ip link
set dev br0 up
278 ip link
set dev
$swp1 master br0
280 ip link
set dev br0
type bridge vlan_protocol
802.1q
2>/dev
/null
281 check_fail $?
"switching bridge protocol from 802.1q to 802.1ad not rejected"
283 log_test
"switch bridge protocol"