Skip to content

Commit 4fd9a8d

Browse files
authored
support 2 vlans test in test_acl dynamically (sonic-net#16551)
What is the motivation for this PR? In pytest_generate_tests hook, depends on how many vlan interfaces in topo file, it parametrizes vlan_name dynamically before testing. It doesn't need to use hardcode to check the topo name then set vlan_name. It's not flexible. How did you do it? In this PR, Add t0-118 topo which has 2 vlan config by default. In test_acl, will choose vlan ip range and rule id separately. If default_vlan_config == two_vlan_a, the IP range should choose DOWNSTREAM_DST_IP_VLAN and DOWNSTREAM_DST_IP_VLAN2000 separately for each vlan. And also chooses different rule id in case test_dest_ip_match_forwarded and test_dest_ip_match_dropped for 2 vlan config. How did you verify/test it? verified on two vlan testbed on 202405 image, 384 all passed -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html -------------------------------------------------------------------------------------------------- live log sessionfinish --------------------------------------------------------------------------------------------------- 12:46:19 __init__.pytest_terminal_summary L0067 INFO | Can not get Allure report URL. Please check logs =============================================================================== 384 passed, 1216 skipped, 1545 warnings in 4036.92s (1:07:16) =============================================================================== DEBUG:tests.conftest:[log_custom_msg] item: <Function test_icmp_match_forwarded[ipv6-ingress-uplink->downlink-default-Vlan2000]> Also verified on one vlan testbed on 202405 image, 192 all passed ================================================================================ 192 passed, 608 skipped, 777 warnings in 2099.37s (0:34:59) ================================================================================ DEBUG:tests.conftest:[log_custom_msg] item: <Function test_icmp_match_forwarded[ipv6-ingress-uplink->downlink-default-Vlan1000]> DEBUG:tests.conftest:append custom_msg: {'dut_check_result': {'core_dump_check_pass': True, 'config_db_check_pass': False}} INFO:root:Can not get Allure report URL. Please check logs zhaohuisun@sonic-mgmt-zhaohuisun:/data/sonic-mgmt-int/tests$
1 parent f2090ae commit 4fd9a8d

File tree

8 files changed

+361
-17
lines changed

8 files changed

+361
-17
lines changed

ansible/module_utils/port_utils.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -235,12 +235,16 @@ def get_port_alias_to_name_map(hwsku, asic_name=None):
235235
s100G_ports += [x for x in range(23, 27)]
236236

237237
port_alias_to_name_map = _port_alias_to_name_map_50G(all_ports, s100G_ports)
238-
elif hwsku in ["Arista-7260CX3-D108C8", "Arista-7260CX3-D108C8-AILAB", "Arista-7260CX3-D108C8-CSI"]:
238+
elif hwsku in ["Arista-7260CX3-D108C8", "Arista-7260CX3-D108C8-AILAB",
239+
"Arista-7260CX3-D108C8-CSI", "Arista-7260CX3-D108C10"]:
239240
# All possible breakout 50G port numbers:
240241
all_ports = [x for x in range(1, 65)]
241242

242243
# 100G ports
243244
s100G_ports = [x for x in range(13, 21)]
245+
if hwsku == "Arista-7260CX3-D108C10":
246+
# The first 2 ports are 100G
247+
s100G_ports.extend([x for x in range(1, 3)])
244248

245249
if hwsku == "Arista-7260CX3-D108C8-AILAB":
246250
s100G_ports = [x for x in range(45, 53)]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
t0-leaf-lag-2.j2

ansible/vars/topo_t0-118.yml

+294
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,294 @@
1+
topology:
2+
host_interfaces:
3+
- 0
4+
- 1
5+
- 2
6+
- 3
7+
- 4
8+
- 5
9+
- 6
10+
- 7
11+
- 8
12+
- 9
13+
- 10
14+
- 11
15+
- 12
16+
- 13
17+
- 14
18+
- 15
19+
- 16
20+
- 17
21+
- 18
22+
- 19
23+
- 20
24+
- 21
25+
- 30
26+
- 31
27+
- 32
28+
- 33
29+
- 34
30+
- 35
31+
- 36
32+
- 37
33+
- 38
34+
- 39
35+
- 40
36+
- 41
37+
- 42
38+
- 43
39+
- 44
40+
- 45
41+
- 46
42+
- 47
43+
- 48
44+
- 49
45+
- 50
46+
- 51
47+
- 52
48+
- 53
49+
- 54
50+
- 55
51+
- 56
52+
- 57
53+
- 58
54+
- 59
55+
- 60
56+
- 61
57+
- 62
58+
- 63
59+
- 64
60+
- 65
61+
- 66
62+
- 67
63+
- 68
64+
- 69
65+
- 70
66+
- 71
67+
- 72
68+
- 73
69+
- 74
70+
- 75
71+
- 76
72+
- 77
73+
- 78
74+
- 79
75+
- 80
76+
- 81
77+
- 82
78+
- 83
79+
- 84
80+
- 85
81+
- 86
82+
- 87
83+
- 88
84+
- 89
85+
- 90
86+
- 91
87+
- 92
88+
- 93
89+
- 94
90+
- 95
91+
- 96
92+
- 97
93+
- 98
94+
- 99
95+
- 100
96+
- 101
97+
- 102
98+
- 103
99+
- 104
100+
- 105
101+
- 106
102+
- 107
103+
- 108
104+
- 109
105+
- 110
106+
- 111
107+
- 112
108+
- 113
109+
- 114
110+
- 115
111+
- 116
112+
- 117
113+
VMs:
114+
ARISTA01T1:
115+
vlans:
116+
- 22
117+
- 23
118+
vm_offset: 0
119+
ARISTA02T1:
120+
vlans:
121+
- 24
122+
- 25
123+
vm_offset: 1
124+
ARISTA03T1:
125+
vlans:
126+
- 26
127+
- 27
128+
vm_offset: 2
129+
ARISTA04T1:
130+
vlans:
131+
- 28
132+
- 29
133+
vm_offset: 3
134+
DUT:
135+
vlan_configs:
136+
default_vlan_config: two_vlan_a
137+
one_vlan_a:
138+
Vlan1000:
139+
id: 1000
140+
intfs: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 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]
141+
prefix: 192.168.0.1/21
142+
prefix_v6: fc02:1000::1/64
143+
tag: 1000
144+
two_vlan_a:
145+
Vlan1000:
146+
id: 1000
147+
intfs: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 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]
148+
prefix: 192.168.0.1/25
149+
prefix_v6: fc02:1000::1/64
150+
tag: 1000
151+
Vlan2000:
152+
id: 2000
153+
intfs: [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]
154+
prefix: 192.168.0.129/25
155+
prefix_v6: fc02:1000:0:1::1/64
156+
tag: 2000
157+
four_vlan_a:
158+
Vlan1000:
159+
id: 1000
160+
intfs: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 30, 31, 33, 34, 35]
161+
prefix: 192.168.0.1/23
162+
prefix_v6: fc02:400::1/64
163+
tag: 1000
164+
Vlan2000:
165+
id: 2000
166+
intfs: [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]
167+
prefix: 192.168.2.1/23
168+
prefix_v6: fc02:401::1/64
169+
tag: 2000
170+
Vlan3000:
171+
id: 3000
172+
intfs: [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]
173+
prefix: 192.168.4.1/23
174+
prefix_v6: fc02:402::1/64
175+
tag: 3000
176+
Vlan4000:
177+
id: 4000
178+
intfs: [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]
179+
prefix: 192.168.6.1/23
180+
prefix_v6: fc02:403::1/64
181+
tag: 4000
182+
183+
configuration_properties:
184+
common:
185+
dut_asn: 4200065100
186+
dut_type: ToRRouter
187+
swrole: leaf
188+
podset_number: 200
189+
tor_number: 16
190+
tor_subnet_number: 2
191+
max_tor_subnet_number: 16
192+
tor_subnet_size: 128
193+
spine_asn: 65534
194+
leaf_asn_start: 4200064600
195+
tor_asn_start: 4200065500
196+
nhipv4: 10.10.246.254
197+
nhipv6: FC0A::FF
198+
199+
configuration:
200+
ARISTA01T1:
201+
properties:
202+
- common
203+
bgp:
204+
asn: 4200064600
205+
peers:
206+
4200065100:
207+
- 10.0.0.32
208+
- FC00::21
209+
interfaces:
210+
Loopback0:
211+
ipv4: 100.1.0.33/32
212+
ipv6: 2064:100::33/128
213+
Ethernet1:
214+
lacp: 1
215+
Ethernet2:
216+
lacp: 1
217+
Port-Channel1:
218+
ipv4: 10.0.0.33/31
219+
ipv6: fc00::22/126
220+
bp_interface:
221+
ipv4: 10.10.246.33/24
222+
ipv6: fc0a::23/64
223+
224+
ARISTA02T1:
225+
properties:
226+
- common
227+
bgp:
228+
asn: 4200064600
229+
peers:
230+
4200065100:
231+
- 10.0.0.34
232+
- FC00::25
233+
interfaces:
234+
Loopback0:
235+
ipv4: 100.1.0.35/32
236+
ipv6: 2064:100::26/128
237+
Ethernet1:
238+
lacp: 1
239+
Ethernet2:
240+
lacp: 1
241+
Port-Channel1:
242+
ipv4: 10.0.0.35/31
243+
ipv6: fc00::26/126
244+
bp_interface:
245+
ipv4: 10.10.246.35/24
246+
ipv6: fc0a::26/64
247+
248+
ARISTA03T1:
249+
properties:
250+
- common
251+
bgp:
252+
asn: 4200064600
253+
peers:
254+
4200065100:
255+
- 10.0.0.36
256+
- FC00::29
257+
interfaces:
258+
Loopback0:
259+
ipv4: 100.1.0.37/32
260+
ipv6: 2064:100::2A/128
261+
Ethernet1:
262+
lacp: 1
263+
Ethernet2:
264+
lacp: 1
265+
Port-Channel1:
266+
ipv4: 10.0.0.37/31
267+
ipv6: fc00::2A/126
268+
bp_interface:
269+
ipv4: 10.10.246.37/24
270+
ipv6: fc0a::2A/64
271+
272+
ARISTA04T1:
273+
properties:
274+
- common
275+
bgp:
276+
asn: 4200064600
277+
peers:
278+
4200065100:
279+
- 10.0.0.38
280+
- FC00::2D
281+
interfaces:
282+
Loopback0:
283+
ipv4: 100.1.0.39/32
284+
ipv6: 2064:100::2E/128
285+
Ethernet1:
286+
lacp: 1
287+
Ethernet2:
288+
lacp: 1
289+
Port-Channel1:
290+
ipv4: 10.0.0.39/31
291+
ipv6: fc00::2E/126
292+
bp_interface:
293+
ipv4: 10.10.246.39/24
294+
ipv6: fc0a::2E/64

ansible/veos

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ all:
3535
- t0-64-32
3636
- t0-80
3737
- t0-116
38+
- t0-118
3839
- t0-backend
3940
- t0-standalone-32
4041
- t0-standalone-64

ansible/veos_vtb

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ all:
2929
- t0-64
3030
- t0-64-32
3131
- t0-116
32+
- t0-118
3233
- t0-backend
3334
- dualtor
3435
- dualtor-56

docs/testbed/README.testbed.Overview.md

+1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ The T0 type topology has different variations. The differences are just the numb
7777
* t0-56-po2vlan
7878
* t0-80
7979
* t0-116
80+
* t0-118
8081
* t0-120
8182
* t0-backend
8283
* t0-standalone-32

0 commit comments

Comments
 (0)