-
Notifications
You must be signed in to change notification settings - Fork 13
/
test-bridge-ul-to-vf-qinq.sh
executable file
·168 lines (141 loc) · 5.24 KB
/
test-bridge-ul-to-vf-qinq.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#!/bin/bash
#
# Test bridge offloads with ping from VF in namespace to remote setup
# over UL with following configurations:
# 6. VF is tagged with VLAN 2 in namespace and pvid/untagged with 802.1ad VLAN 3
# (QinQ) on bridge, UL is pvid/untagged with VLAN 3.
# 7. VF is tagged with VLAN 2 in namespace and pvid/untagged with 802.1ad VLAN 3
# (QinQ) on bridge, UL is pvid/untagged with 802.1ad VLAN 3.
#
# Require external server
#
# Bug SW #2753854: [mlx5, ETH, x86] Traffic lose between 2 VFs with vlans on bridge
#
my_dir="$(dirname "$0")"
. $my_dir/common.sh
. $my_dir/common-br.sh
min_nic_cx6dx
require_remote_server
br=tst1
LOCAL_IP="7.7.1.7"
LOCAL_MAC="e4:0a:05:08:00:02"
LOCAL_IP_VLAN2="7.7.2.7"
LOCAL_MAC_VLAN2="e4:0a:05:08:00:03"
LOCAL_IP_VLAN3="7.7.3.7"
LOCAL_MAC_VLAN3="e4:0a:05:08:00:04"
REMOTE_IP="7.7.1.1"
REMOTE_MAC="0c:42:a1:58:ac:28"
REMOTE_IP_VLAN2="7.7.2.1"
REMOTE_MAC_VLAN2="0c:42:a1:58:ac:29"
REMOTE_IP_UNTAGGED="7.7.3.1"
namespace1=ns1
time=10
npackets=6
function cleanup() {
ip link del name $br type bridge 2>/dev/null
ip netns del $namespace1 &>/dev/null
on_remote "ip link del link $REMOTE_NIC name ${REMOTE_NIC}.2 type vlan id 2 &>/dev/null
ip a del $REMOTE_IP/24 dev $REMOTE_NIC &>/dev/null
ip a del $REMOTE_IP_UNTAGGED/24 dev $REMOTE_NIC &>/dev/null"
}
trap cleanup EXIT
cleanup
title "Config local host"
config_sriov 2
enable_switchdev
require_interfaces REP REP2 NIC
unbind_vfs
bind_vfs
sleep 1
ovs_clear_bridges
remote_disable_sriov
sleep 1
function test_trunk_to_trunk_qinq() {
create_bridge_with_interfaces $br $NIC $REP
config_vf $namespace1 $VF $REP
add_vf_qinq $namespace1 $VF $REP $LOCAL_IP_VLAN2 3 2 $LOCAL_MAC_VLAN2
ip addr flush dev $NIC
ip link set dev $NIC up
bridge vlan add dev $REP vid 3
bridge vlan add dev $NIC vid 3
on_remote "
ip link add link $REMOTE_NIC name ${REMOTE_NIC}.3 type vlan id 3 protocol 802.1ad
ip link add link ${REMOTE_NIC}.3 name ${REMOTE_NIC}.3.2 type vlan id 2
ip link set ${REMOTE_NIC}.3.2 address $REMOTE_MAC_VLAN2
ip address replace dev ${REMOTE_NIC}.3.2 $REMOTE_IP_VLAN2/24
ip link set $REMOTE_NIC up
ip link set ${REMOTE_NIC}.3 up
ip link set ${REMOTE_NIC}.3.2 up"
ip link set $br type bridge vlan_filtering 1 vlan_protocol 802.1ad
sleep 1
flush_bridge $br
verify_ping_ns $namespace1 $VF.3.2 $br $REMOTE_IP_VLAN2 $time $npackets 'vlan and vlan and icmp'
on_remote "
ip link del link $REMOTE_NIC name ${REMOTE_NIC}.3.2 type vlan id 2 &>/dev/null
ip link del link $REMOTE_NIC name ${REMOTE_NIC}.3 type vlan id 3 &>/dev/null"
ip link del name $br type bridge
ip netns del $namespace1
ip addr flush dev $NIC
sleep 1
}
function test_access_to_trunk_qinq() {
create_bridge_with_interfaces $br $NIC $REP
config_vf $namespace1 $VF $REP
add_vf_vlan $namespace1 $VF $REP $LOCAL_IP_VLAN2 2 $LOCAL_MAC_VLAN2
ip addr flush dev $NIC
ip link set dev $NIC up
bridge vlan add dev $REP vid 3 pvid untagged
bridge vlan add dev $NIC vid 3
on_remote "
ip link add link $REMOTE_NIC name ${REMOTE_NIC}.3 type vlan id 3 protocol 802.1ad
ip link add link ${REMOTE_NIC}.3 name ${REMOTE_NIC}.3.2 type vlan id 2
ip link set ${REMOTE_NIC}.3.2 address $REMOTE_MAC_VLAN2
ip address replace dev ${REMOTE_NIC}.3.2 $REMOTE_IP_VLAN2/24
ip link set $REMOTE_NIC up
ip link set ${REMOTE_NIC}.3 up
ip link set ${REMOTE_NIC}.3.2 up"
ip link set $br type bridge vlan_filtering 1 vlan_protocol 802.1ad
sleep 1
flush_bridge $br
verify_ping_ns $namespace1 $VF.2 $br $REMOTE_IP_VLAN2 $time $npackets 'vlan and vlan and icmp'
on_remote "
ip link del link $REMOTE_NIC name ${REMOTE_NIC}.3.2 type vlan id 2 &>/dev/null
ip link del link $REMOTE_NIC name ${REMOTE_NIC}.3 type vlan id 3 &>/dev/null"
ip link del name $br type bridge
ip netns del $namespace1
ip addr flush dev $NIC
sleep 1
}
function test_access_to_access_qinq() {
create_bridge_with_interfaces $br $NIC $REP
config_vf $namespace1 $VF $REP
add_vf_vlan $namespace1 $VF $REP $LOCAL_IP_VLAN2 2 $LOCAL_MAC_VLAN2
ip addr flush dev $NIC
ip link set dev $NIC up
bridge vlan add dev $REP vid 3 pvid untagged
bridge vlan add dev $NIC vid 3 pvid untagged
on_remote "
ip link add link $REMOTE_NIC name ${REMOTE_NIC}.2 type vlan id 2
ip link set ${REMOTE_NIC}.2 address $REMOTE_MAC_VLAN2
ip address replace dev ${REMOTE_NIC}.2 $REMOTE_IP_VLAN2/24
ip link set $REMOTE_NIC up
ip link set ${REMOTE_NIC}.2 up"
ip link set $br type bridge vlan_filtering 1 vlan_protocol 802.1ad
sleep 1
flush_bridge $br
verify_ping_ns $namespace1 $VF.2 $br $REMOTE_IP_VLAN2 $time $npackets 'vlan and vlan and icmp'
on_remote "ip link del link $REMOTE_NIC name ${REMOTE_NIC}.2 type vlan id 2 &>/dev/null"
ip link del name $br type bridge
ip netns del $namespace1
ip addr flush dev $NIC
sleep 1
}
title "test ping (QinQ tagged<->tagged)"
test_trunk_to_trunk_qinq
title "test ping (QinQ untagged<->tagged)"
test_access_to_trunk_qinq
title "test ping (QinQ untagged<->untagged)"
test_access_to_access_qinq
cleanup
trap - EXIT
test_done