forked from sonic-net/sonic-mgmt
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_pfc_port_congestion.py
More file actions
589 lines (506 loc) · 28.9 KB
/
Copy pathtest_pfc_port_congestion.py
File metadata and controls
589 lines (506 loc) · 28.9 KB
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
import pytest
import random
from tests.common.helpers.assertions import pytest_require, pytest_assert # noqa: F401
from tests.common.fixtures.conn_graph_facts import conn_graph_facts, fanout_graph_facts_multidut, \
fanout_graph_facts # noqa: F401
from tests.common.snappi_tests.snappi_fixtures import snappi_api_serv_ip, snappi_api_serv_port, \
snappi_api, snappi_multi_base_config, cleanup_config, get_snappi_ports_for_rdma, \
get_snappi_ports, get_snappi_ports_multi_dut, clear_fabric_counters, check_fabric_counters, \
get_snappi_ports_single_dut # noqa: F401
from tests.common.snappi_tests.qos_fixtures import prio_dscp_map, lossless_prio_list, \
lossy_prio_list, all_prio_list, disable_pfcwd # noqa: F401
from tests.snappi_tests.variables import MULTIDUT_PORT_INFO, MULTIDUT_TESTBED
from tests.snappi_tests.pfc.files.pfc_congestion_helper import run_pfc_test
from tests.common.snappi_tests.snappi_test_params import SnappiTestParams
from tests.snappi_tests.cisco.helper import disable_voq_watchdog # noqa: F401
import logging
logger = logging.getLogger(__name__)
pytestmark = [pytest.mark.topology('multidut-tgen')]
port_map = [[1, 100, 2, 100], [1, 400, 2, 400]]
# Testplan: docs/testplan/PFC_Snappi_Additional_Testcases.md
# This test-script covers following testcases:
# testcase#04: DETECT CONGESTION WITH REAL-LIFE TRAFFIC PATTERN - 90% LOSSLESS and 10% LOSSY
# testcase#05: DETECT CONGESTION WITH EQUAL DISTRIBUTION OF LOSSLESS AND LOSSY TRAFFIC
@pytest.mark.parametrize('port_map', port_map)
@pytest.mark.parametrize("multidut_port_info", MULTIDUT_PORT_INFO[MULTIDUT_TESTBED])
def test_multiple_prio_diff_dist(snappi_api, # noqa: F811
conn_graph_facts, # noqa: F811
fanout_graph_facts_multidut, # noqa: F811
duthosts,
prio_dscp_map, # noqa: F811
lossless_prio_list, # noqa: F811
lossy_prio_list, # noqa: F811
tbinfo,
get_snappi_ports, # noqa: F811
port_map,
multidut_port_info, # noqa: F811
disable_pfcwd): # noqa: F811
"""
Purpose of the test case is to test oversubscription with two ingresses and single ingress.
Traffic pattern has 90% lossless priority and 10% lossy priority traffic.
No losses for both lossless and lossy priority traffic.
Args:
snappi_api (pytest fixture): SNAPPI session
conn_graph_facts (pytest fixture): connection graph
fanout_graph_facts_multidut_multidut (pytest fixture): fanout graph
duthosts (pytest fixture): list of DUTs
prio_dscp_map (pytest fixture): priority vs. DSCP map (key = priority).
lossless_prio_list(list): list of lossless priorities
lossy_prio_list(list): list of lossy priorities.
tbinfo(key): element to identify testbed info name.
get_snappi_ports(pytest fixture): returns list of ports based on linecards selected.
port_map(list): list for port-speed combination.
multidut_port_info : Line card classification along with ports selected as Rx and Tx port.
Returns:
N/A
"""
# port_map is defined as port-speed combination.
# first two parameters are count of egress links and its speed.
# last two parameters are count of ingress links and its speed.
# pkt_size of 1024B will be used unless imix flag is set.
# With imix flag set, the traffic_generation.py uses IMIX profile.
pkt_size = 1024
for testbed_subtype, rdma_ports in multidut_port_info.items():
rx_port_count = port_map[0]
tx_port_count = port_map[2]
tmp_snappi_port_list = get_snappi_ports
snappi_port_list = []
for item in tmp_snappi_port_list:
if (int(item['speed']) == (port_map[1] * 1000)):
snappi_port_list.append(item)
pytest_require(MULTIDUT_TESTBED == tbinfo['conf-name'],
"The testbed name from testbed file doesn't match with MULTIDUT_TESTBED in variables.py ")
pytest_require(len(snappi_port_list) >= tx_port_count + rx_port_count,
"Need Minimum of 2 ports defined in ansible/files/*links.csv file")
pytest_require(len(rdma_ports['tx_ports']) >= tx_port_count,
'MULTIDUT_PORT_INFO doesn\'t have the required Tx ports defined for \
testbed {}, subtype {} in variables.py'.
format(MULTIDUT_TESTBED, testbed_subtype))
pytest_require(len(rdma_ports['rx_ports']) >= rx_port_count,
'MULTIDUT_PORT_INFO doesn\'t have the required Rx ports defined for \
testbed {}, subtype {} in variables.py'.
format(MULTIDUT_TESTBED, testbed_subtype))
logger.info('Running test for testbed subtype: {}'.format(testbed_subtype))
snappi_ports = get_snappi_ports_for_rdma(snappi_port_list, rdma_ports,
tx_port_count, rx_port_count, MULTIDUT_TESTBED)
testbed_config, port_config_list, snappi_ports = snappi_multi_base_config(duthosts,
snappi_ports,
snappi_api)
enable_pfcwd = True
if duthosts[0].facts["platform_asic"] == 'cisco-8000' and duthosts[0].get_facts().get("modular_chassis"):
enable_pfcwd = False
# Percentage drop expected for lossless and lossy traffic.
# speed_tol is speed tolerance between egress link speed and actual speed.
# loss_expected to check losses on DUT and TGEN.
test_check = {'lossless': 0, 'lossy': 0, 'speed_tol': 3, 'loss_expected': False, 'pfc': True}
test_def = {'TEST_FLOW_AGGR_RATE_PERCENT': 88,
'BG_FLOW_AGGR_RATE_PERCENT': 12,
'data_flow_pkt_size': pkt_size,
'DATA_FLOW_DURATION_SEC': 300,
'data_flow_delay_sec': 0,
'SNAPPI_POLL_DELAY_SEC': 60,
'test_type': '/tmp/Two_Ingress_Single_Egress_diff_dist_'+str(port_map[1])+'Gbps',
'line_card_choice': testbed_subtype,
'port_map': port_map,
'enable_pfcwd': enable_pfcwd,
'enable_credit_wd': True,
'stats_interval': 60,
'background_traffic': True,
'imix': False,
'test_check': test_check,
'verify_flows': False}
test_prio_list = lossless_prio_list
pause_prio_list = test_prio_list
bg_prio_list = random.sample(lossy_prio_list, 3)
logger.info('Selected lossless :{} and lossy priorities:{} for the test'.format(test_prio_list, bg_prio_list))
snappi_extra_params = SnappiTestParams()
snappi_extra_params.multi_dut_params.duthost1 = snappi_ports[0]['duthost']
snappi_extra_params.multi_dut_params.duthost2 = snappi_ports[-1]['duthost']
snappi_extra_params.multi_dut_params.multi_dut_ports = snappi_ports
if (snappi_ports[0]['peer_device'] == snappi_ports[-1]['peer_device']):
dut_list = [snappi_ports[0]['duthost']]
else:
dut_list = [snappi_ports[0]['duthost'], snappi_ports[-1]['duthost']]
for dut in duthosts:
clear_fabric_counters(dut)
try:
run_pfc_test(api=snappi_api,
testbed_config=testbed_config,
port_config_list=port_config_list,
conn_data=conn_graph_facts,
fanout_data=fanout_graph_facts_multidut,
global_pause=False,
pause_prio_list=pause_prio_list,
test_prio_list=test_prio_list,
bg_prio_list=bg_prio_list,
prio_dscp_map=prio_dscp_map,
test_traffic_pause=False,
test_def=test_def,
snappi_extra_params=snappi_extra_params)
for dut in duthosts:
check_fabric_counters(dut)
finally:
cleanup_config(dut_list, snappi_ports)
@pytest.mark.parametrize('port_map', port_map)
@pytest.mark.parametrize("multidut_port_info", MULTIDUT_PORT_INFO[MULTIDUT_TESTBED])
def test_multiple_prio_uni_dist(snappi_api, # noqa: F811
conn_graph_facts, # noqa: F811
fanout_graph_facts_multidut, # noqa: F811
duthosts,
prio_dscp_map, # noqa: F811
lossless_prio_list, # noqa: F811
lossy_prio_list, # noqa: F811
tbinfo,
get_snappi_ports, # noqa: F811
port_map,
multidut_port_info, # noqa: F811
disable_pfcwd): # noqa: F811
"""
Purpose of the test case is to test oversubscription with two ingresses and single ingress.
Traffic pattern has 24% lossless priority and 36% lossy priority traffic.
Each priority carries equal 12% of traffic.
No losses for lossless priority traffic. Some loss expected for lossy priority traffic.
Args:
snappi_api (pytest fixture): SNAPPI session
conn_graph_facts (pytest fixture): connection graph
fanout_graph_facts_multidut (pytest fixture): fanout graph
duthosts (pytest fixture): list of DUTs
prio_dscp_map (pytest fixture): priority vs. DSCP map (key = priority).
lossless_prio_list(list): list of lossless priorities
lossy_prio_list(list): list of lossy priorities.
tbinfo(key): element to identify testbed info name.
get_snappi_ports(pytest fixture): returns list of ports based on linecards selected.
port_map(list): list for port-speed combination.
multidut_port_info : Line card classification along with ports selected as Rx and Tx port.
Returns:
N/A
"""
# port_map is defined as port-speed combination.
# first two parameters are count of egress links and its speed.
# last two parameters are count of ingress links and its speed.
# pkt_size of 1024B will be used unless imix flag is set.
# With imix flag set, the traffic_generation.py uses IMIX profile.
pkt_size = 1024
for testbed_subtype, rdma_ports in multidut_port_info.items():
rx_port_count = port_map[0]
tx_port_count = port_map[2]
tmp_snappi_port_list = get_snappi_ports
snappi_port_list = []
for item in tmp_snappi_port_list:
if (int(item['speed']) == (port_map[1] * 1000)):
snappi_port_list.append(item)
pytest_require(MULTIDUT_TESTBED == tbinfo['conf-name'],
"The testbed name from testbed file doesn't match with MULTIDUT_TESTBED in variables.py ")
pytest_require(len(snappi_port_list) >= tx_port_count + rx_port_count,
"Need Minimum of 2 ports defined in ansible/files/*links.csv file")
pytest_require(len(rdma_ports['tx_ports']) >= tx_port_count,
'MULTIDUT_PORT_INFO doesn\'t have the required Tx ports defined for \
testbed {}, subtype {} in variables.py'.
format(MULTIDUT_TESTBED, testbed_subtype))
pytest_require(len(rdma_ports['rx_ports']) >= rx_port_count,
'MULTIDUT_PORT_INFO doesn\'t have the required Rx ports defined for \
testbed {}, subtype {} in variables.py'.
format(MULTIDUT_TESTBED, testbed_subtype))
logger.info('Running test for testbed subtype: {}'.format(testbed_subtype))
snappi_ports = get_snappi_ports_for_rdma(snappi_port_list, rdma_ports,
tx_port_count, rx_port_count, MULTIDUT_TESTBED)
testbed_config, port_config_list, snappi_ports = snappi_multi_base_config(duthosts,
snappi_ports,
snappi_api)
enable_pfcwd = True
if duthosts[0].facts["platform_asic"] == 'cisco-8000' and duthosts[0].get_facts().get("modular_chassis"):
enable_pfcwd = False
# Percentage drop expected for lossless and lossy traffic.
# speed_tol is speed tolerance between egress link speed and actual speed.
# loss_expected to check losses on DUT and TGEN.
test_check = {'lossless': 0, 'lossy': 51, 'speed_tol': 3, 'loss_expected': True, 'pfc': True}
test_def = {'TEST_FLOW_AGGR_RATE_PERCENT': 40,
'BG_FLOW_AGGR_RATE_PERCENT': 60,
'data_flow_pkt_size': pkt_size,
'DATA_FLOW_DURATION_SEC': 300,
'data_flow_delay_sec': 0,
'SNAPPI_POLL_DELAY_SEC': 60,
'test_type': '/tmp/Two_Ingress_Single_Egress_uni_dist_full'+str(port_map[1])+'Gbps',
'line_card_choice': testbed_subtype,
'port_map': port_map,
'enable_pfcwd': enable_pfcwd,
'enable_credit_wd': True,
'stats_interval': 60,
'background_traffic': True,
'imix': False,
'test_check': test_check,
'verify_flows': False}
test_prio_list = lossless_prio_list
pause_prio_list = test_prio_list
bg_prio_list = random.sample(lossy_prio_list, 3)
logger.info('Selected lossless :{} and lossy priorities:{} for the test'.format(test_prio_list, bg_prio_list))
snappi_extra_params = SnappiTestParams()
snappi_extra_params.multi_dut_params.duthost1 = snappi_ports[0]['duthost']
snappi_extra_params.multi_dut_params.duthost2 = snappi_ports[-1]['duthost']
snappi_extra_params.multi_dut_params.multi_dut_ports = snappi_ports
if (snappi_ports[0]['peer_device'] == snappi_ports[-1]['peer_device']):
dut_list = [snappi_ports[0]['duthost']]
else:
dut_list = [snappi_ports[0]['duthost'], snappi_ports[-1]['duthost']]
for dut in duthosts:
clear_fabric_counters(dut)
try:
run_pfc_test(api=snappi_api,
testbed_config=testbed_config,
port_config_list=port_config_list,
conn_data=conn_graph_facts,
fanout_data=fanout_graph_facts_multidut,
global_pause=False,
pause_prio_list=pause_prio_list,
test_prio_list=test_prio_list,
bg_prio_list=bg_prio_list,
prio_dscp_map=prio_dscp_map,
test_traffic_pause=False,
test_def=test_def,
snappi_extra_params=snappi_extra_params)
for dut in duthosts:
check_fabric_counters(dut)
finally:
cleanup_config(dut_list, snappi_ports)
@pytest.mark.parametrize('port_map', port_map)
@pytest.mark.parametrize("multidut_port_info", MULTIDUT_PORT_INFO[MULTIDUT_TESTBED])
def test_multiple_prio_equal_dist(snappi_api, # noqa: F811
conn_graph_facts, # noqa: F811
fanout_graph_facts_multidut, # noqa: F811
duthosts,
prio_dscp_map, # noqa: F811
lossless_prio_list, # noqa: F811
lossy_prio_list, # noqa: F811
tbinfo,
get_snappi_ports, # noqa: F811
port_map,
multidut_port_info, # noqa: F811
disable_pfcwd): # noqa: F811
"""
Purpose of the test case is to test oversubscription with two ingresses and single ingress.
Traffic pattern has 24% lossless priority and 36% lossy priority traffic.
Each priority carries equal 12% of traffic.
No losses for lossless priority traffic. Some loss expected for lossy priority traffic.
Args:
snappi_api (pytest fixture): SNAPPI session
conn_graph_facts (pytest fixture): connection graph
fanout_graph_facts_multidut (pytest fixture): fanout graph
duthosts (pytest fixture): list of DUTs
prio_dscp_map (pytest fixture): priority vs. DSCP map (key = priority).
lossless_prio_list(list): list of lossless priorities
lossy_prio_list(list): list of lossy priorities.
tbinfo(key): element to identify testbed info name.
get_snappi_ports(pytest fixture): returns list of ports based on linecards selected.
port_map(list): list for port-speed combination.
multidut_port_info : Line card classification along with ports selected as Rx and Tx port.
Returns:
N/A
"""
# port_map is defined as port-speed combination.
# first two parameters are count of egress links and its speed.
# last two parameters are count of ingress links and its speed.
# pkt_size of 1024B will be used unless imix flag is set.
# With imix flag set, the traffic_generation.py uses IMIX profile.
pkt_size = 1024
for testbed_subtype, rdma_ports in multidut_port_info.items():
rx_port_count = port_map[0]
tx_port_count = port_map[2]
tmp_snappi_port_list = get_snappi_ports
snappi_port_list = []
for item in tmp_snappi_port_list:
if (int(item['speed']) == (port_map[1] * 1000)):
snappi_port_list.append(item)
pytest_require(MULTIDUT_TESTBED == tbinfo['conf-name'],
"The testbed name from testbed file doesn't match with MULTIDUT_TESTBED in variables.py ")
pytest_require(len(snappi_port_list) >= tx_port_count + rx_port_count,
"Need Minimum of 2 ports defined in ansible/files/*links.csv file")
pytest_require(len(rdma_ports['tx_ports']) >= tx_port_count,
'MULTIDUT_PORT_INFO doesn\'t have the required Tx ports defined for \
testbed {}, subtype {} in variables.py'.
format(MULTIDUT_TESTBED, testbed_subtype))
pytest_require(len(rdma_ports['rx_ports']) >= rx_port_count,
'MULTIDUT_PORT_INFO doesn\'t have the required Rx ports defined for \
testbed {}, subtype {} in variables.py'.
format(MULTIDUT_TESTBED, testbed_subtype))
logger.info('Running test for testbed subtype: {}'.format(testbed_subtype))
snappi_ports = get_snappi_ports_for_rdma(snappi_port_list, rdma_ports,
tx_port_count, rx_port_count, MULTIDUT_TESTBED)
testbed_config, port_config_list, snappi_ports = snappi_multi_base_config(duthosts,
snappi_ports,
snappi_api)
enable_pfcwd = True
if duthosts[0].facts["platform_asic"] == 'cisco-8000' and duthosts[0].get_facts().get("modular_chassis"):
enable_pfcwd = False
# Percentage drop expected for lossless and lossy traffic.
# speed_tol is speed tolerance between egress link speed and actual speed.
# loss_expected to check losses on DUT and TGEN.
test_check = {'lossless': 0, 'lossy': 20, 'speed_tol': 3, 'loss_expected': True, 'pfc': True}
test_def = {'TEST_FLOW_AGGR_RATE_PERCENT': 30,
'BG_FLOW_AGGR_RATE_PERCENT': 30,
'data_flow_pkt_size': pkt_size,
'DATA_FLOW_DURATION_SEC': 300,
'data_flow_delay_sec': 0,
'SNAPPI_POLL_DELAY_SEC': 60,
'test_type': '/tmp/Two_Ingress_Single_Egress_equal_dist'+str(port_map[1])+'Gbps',
'line_card_choice': testbed_subtype,
'port_map': port_map,
'enable_pfcwd': enable_pfcwd,
'enable_credit_wd': True,
'stats_interval': 60,
'background_traffic': True,
'imix': False,
'test_check': test_check,
'verify_flows': False}
test_prio_list = lossless_prio_list
pause_prio_list = test_prio_list
bg_prio_list = random.sample(lossy_prio_list, 2)
logger.info('Selected lossless :{} and lossy priorities:{} for the test'.format(test_prio_list, bg_prio_list))
snappi_extra_params = SnappiTestParams()
snappi_extra_params.multi_dut_params.duthost1 = snappi_ports[0]['duthost']
snappi_extra_params.multi_dut_params.duthost2 = snappi_ports[-1]['duthost']
snappi_extra_params.multi_dut_params.multi_dut_ports = snappi_ports
if (snappi_ports[0]['peer_device'] == snappi_ports[-1]['peer_device']):
dut_list = [snappi_ports[0]['duthost']]
else:
dut_list = [snappi_ports[0]['duthost'], snappi_ports[-1]['duthost']]
for dut in duthosts:
clear_fabric_counters(dut)
try:
run_pfc_test(api=snappi_api,
testbed_config=testbed_config,
port_config_list=port_config_list,
conn_data=conn_graph_facts,
fanout_data=fanout_graph_facts_multidut,
global_pause=False,
pause_prio_list=pause_prio_list,
test_prio_list=test_prio_list,
bg_prio_list=bg_prio_list,
prio_dscp_map=prio_dscp_map,
test_traffic_pause=False,
test_def=test_def,
snappi_extra_params=snappi_extra_params)
for dut in duthosts:
check_fabric_counters(dut)
finally:
cleanup_config(dut_list, snappi_ports)
@pytest.mark.parametrize('port_map', port_map)
@pytest.mark.parametrize("multidut_port_info", MULTIDUT_PORT_INFO[MULTIDUT_TESTBED])
def test_multiple_prio_non_cngtn(snappi_api, # noqa: F811
conn_graph_facts, # noqa: F811
fanout_graph_facts_multidut, # noqa: F811
duthosts,
prio_dscp_map, # noqa: F811
lossless_prio_list, # noqa: F811
lossy_prio_list, # noqa: F811
tbinfo,
get_snappi_ports, # noqa: F811
port_map,
multidut_port_info, # noqa: F811
disable_pfcwd): # noqa: F811
"""
Purpose of the test case is to test oversubscription with two ingresses and single ingress.
Traffic pattern has 18% lossless priority and 27% lossy priority traffic.
Total ingress link is sending only 45% link capacity and hence egress will not be congested.
No losses for both lossless and lossy priority traffic.
Args:
snappi_api (pytest fixture): SNAPPI session
conn_graph_facts (pytest fixture): connection graph
fanout_graph_facts_multidut (pytest fixture): fanout graph
duthosts (pytest fixture): list of DUTs
prio_dscp_map (pytest fixture): priority vs. DSCP map (key = priority).
lossless_prio_list(list): list of lossless priorities
lossy_prio_list(list): list of lossy priorities.
tbinfo(key): element to identify testbed info name.
get_snappi_ports(pytest fixture): returns list of ports based on linecards selected.
port_map(list): list for port-speed combination.
multidut_port_info : Line card classification along with ports selected as Rx and Tx port.
Returns:
N/A
"""
# port_map is defined as port-speed combination.
# first two parameters are count of egress links and its speed.
# last two parameters are count of ingress links and its speed.
# pkt_size of 1024B will be used unless imix flag is set.
# With imix flag set, the traffic_generation.py uses IMIX profile.
pkt_size = 1024
for testbed_subtype, rdma_ports in multidut_port_info.items():
rx_port_count = port_map[0]
tx_port_count = port_map[2]
tmp_snappi_port_list = get_snappi_ports
snappi_port_list = []
for item in tmp_snappi_port_list:
if (int(item['speed']) == (port_map[1] * 1000)):
snappi_port_list.append(item)
pytest_require(MULTIDUT_TESTBED == tbinfo['conf-name'],
"The testbed name from testbed file doesn't match with MULTIDUT_TESTBED in variables.py ")
pytest_require(len(snappi_port_list) >= tx_port_count + rx_port_count,
"Need Minimum of 2 ports defined in ansible/files/*links.csv file")
pytest_require(len(rdma_ports['tx_ports']) >= tx_port_count,
'MULTIDUT_PORT_INFO doesn\'t have the required Tx ports defined for \
testbed {}, subtype {} in variables.py'.
format(MULTIDUT_TESTBED, testbed_subtype))
pytest_require(len(rdma_ports['rx_ports']) >= rx_port_count,
'MULTIDUT_PORT_INFO doesn\'t have the required Rx ports defined for \
testbed {}, subtype {} in variables.py'.
format(MULTIDUT_TESTBED, testbed_subtype))
logger.info('Running test for testbed subtype: {}'.format(testbed_subtype))
snappi_ports = get_snappi_ports_for_rdma(snappi_port_list, rdma_ports,
tx_port_count, rx_port_count, MULTIDUT_TESTBED)
testbed_config, port_config_list, snappi_ports = snappi_multi_base_config(duthosts,
snappi_ports,
snappi_api)
enable_pfcwd = True
if duthosts[0].facts["platform_asic"] == 'cisco-8000' and duthosts[0].get_facts().get("modular_chassis"):
enable_pfcwd = False
# Percentage drop expected for lossless and lossy traffic.
# speed_tol is speed tolerance between egress link speed and actual speed.
# loss_expected to check losses on DUT and TGEN.
test_check = {'lossless': 0, 'lossy': 0, 'speed_tol': 14, 'loss_expected': False, 'pfc': False}
test_def = {'TEST_FLOW_AGGR_RATE_PERCENT': 18,
'BG_FLOW_AGGR_RATE_PERCENT': 27,
'data_flow_pkt_size': pkt_size,
'DATA_FLOW_DURATION_SEC': 300,
'data_flow_delay_sec': 0,
'SNAPPI_POLL_DELAY_SEC': 60,
'test_type': '/tmp/Two_Ingress_Single_Egress_non_cngstn_'+str(port_map[1])+'Gbps',
'line_card_choice': testbed_subtype,
'port_map': port_map,
'enable_pfcwd': enable_pfcwd,
'enable_credit_wd': True,
'stats_interval': 60,
'background_traffic': True,
'imix': False,
'test_check': test_check,
'verify_flows': False}
test_prio_list = lossless_prio_list
pause_prio_list = test_prio_list
bg_prio_list = random.sample(lossy_prio_list, 3)
logger.info('Selected lossless :{} and lossy priorities:{} for the test'.format(test_prio_list, bg_prio_list))
snappi_extra_params = SnappiTestParams()
snappi_extra_params.multi_dut_params.duthost1 = snappi_ports[0]['duthost']
snappi_extra_params.multi_dut_params.duthost2 = snappi_ports[-1]['duthost']
snappi_extra_params.multi_dut_params.multi_dut_ports = snappi_ports
if (snappi_ports[0]['peer_device'] == snappi_ports[-1]['peer_device']):
dut_list = [snappi_ports[0]['duthost']]
else:
dut_list = [snappi_ports[0]['duthost'], snappi_ports[-1]['duthost']]
for dut in duthosts:
clear_fabric_counters(dut)
try:
run_pfc_test(api=snappi_api,
testbed_config=testbed_config,
port_config_list=port_config_list,
conn_data=conn_graph_facts,
fanout_data=fanout_graph_facts_multidut,
global_pause=False,
pause_prio_list=pause_prio_list,
test_prio_list=test_prio_list,
bg_prio_list=bg_prio_list,
prio_dscp_map=prio_dscp_map,
test_traffic_pause=False,
test_def=test_def,
snappi_extra_params=snappi_extra_params)
for dut in duthosts:
check_fabric_counters(dut)
finally:
cleanup_config(dut_list, snappi_ports)