Skip to content

Commit 3019835

Browse files
committed
update qos case due to no lossless buffer
1. When there is no lossless buffer, return a dump buffer lossless pg profile 2. Skip tests related to lossless buffer case dynamically
1 parent cacb03a commit 3019835

File tree

2 files changed

+38
-3
lines changed

2 files changed

+38
-3
lines changed

tests/qos/qos_sai_base.py

+18-2
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,24 @@ def __getBufferProfile(self, request, dut_asic, os_version, table, port, priorit
342342
else:
343343
bufferProfileName = out.translate({ord(i): None for i in '[]'})
344344
else:
345-
bufferProfileName = bufkeystr + dut_asic.run_redis_cmd(
346-
argv=["redis-cli", "-n", db, "HGET", keystr, "profile"])[0]
345+
profile_content = dut_asic.run_redis_cmd(argv=["redis-cli", "-n", db, "HGET", keystr, "profile"])
346+
if profile_content:
347+
bufferProfileName = bufkeystr + profile_content[0]
348+
else:
349+
logger.info("No lossless buffer. To compatible the existing case, return dump bufferProfilfe")
350+
dump_buffer_profile = {
351+
"profileName": f"{bufkeystr}pg_lossless_0_0m_profile",
352+
"pool": "ingress_lossless_pool",
353+
"xon": "0",
354+
"xoff": "0",
355+
"size": "0",
356+
"dynamic_th": "0",
357+
"pg_q_alpha": "0",
358+
"port_alpha": "0",
359+
"pool_size": "0",
360+
"static_th": "0"
361+
}
362+
return dump_buffer_profile
347363

348364
result = dut_asic.run_redis_cmd(
349365
argv=["redis-cli", "-n", db, "HGETALL", bufferProfileName]

tests/qos/test_qos_sai.py

+20-1
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,11 @@ def get_portspeed_cablelen(asic_instance):
136136
return ""
137137

138138

139+
def skip_test_on_no_lossless_pg(portSpeedCableLength):
140+
if portSpeedCableLength == "0_0m":
141+
pytest.skip("skip the test due to no buffer lossless pg")
142+
143+
139144
class TestQosSai(QosSaiBase):
140145
"""TestQosSai derives from QosSaiBase and contains collection of QoS SAI test cases.
141146
@@ -371,6 +376,7 @@ def testQosSaiPfcXoffLimit(
371376
"Additional DSCPs are not supported on non-dual ToR ports")
372377

373378
portSpeedCableLength = dutQosConfig["portSpeedCableLength"]
379+
skip_test_on_no_lossless_pg(portSpeedCableLength)
374380
if dutTestParams['hwsku'] in self.BREAKOUT_SKUS and 'backend' not in dutTestParams['topo']:
375381
qosConfig = dutQosConfig["param"][portSpeedCableLength]["breakout"]
376382
else:
@@ -460,6 +466,7 @@ def testPfcStormWithSharedHeadroomOccupancy(
460466
pytest.skip("Shared Headroom has to be enabled for this test")
461467

462468
portSpeedCableLength = dutQosConfig["portSpeedCableLength"]
469+
skip_test_on_no_lossless_pg(portSpeedCableLength)
463470
if xonProfile in list(dutQosConfig["param"][portSpeedCableLength].keys()):
464471
qosConfig = dutQosConfig["param"][portSpeedCableLength]
465472
else:
@@ -633,6 +640,7 @@ def testQosSaiPfcXonLimit(
633640
"Additional DSCPs are not supported on non-dual ToR ports")
634641

635642
portSpeedCableLength = dutQosConfig["portSpeedCableLength"]
643+
skip_test_on_no_lossless_pg(portSpeedCableLength)
636644
if xonProfile in list(dutQosConfig["param"][portSpeedCableLength].keys()):
637645
qosConfig = dutQosConfig["param"][portSpeedCableLength]
638646
else:
@@ -802,6 +810,7 @@ def testQosSaiHeadroomPoolSize(
802810
"""
803811

804812
portSpeedCableLength = dutQosConfig["portSpeedCableLength"]
813+
skip_test_on_no_lossless_pg(portSpeedCableLength)
805814
qosConfig = dutQosConfig["param"][portSpeedCableLength]
806815
testPortIps = dutConfig["testPortIps"]
807816

@@ -1560,6 +1569,7 @@ def testQosSaiDwrr(
15601569
RunAnsibleModuleFail if ptf test fails
15611570
"""
15621571
portSpeedCableLength = dutQosConfig["portSpeedCableLength"]
1572+
skip_test_on_no_lossless_pg(portSpeedCableLength)
15631573
qosConfig = dutQosConfig["param"]
15641574
if "wrr" in qosConfig[portSpeedCableLength]:
15651575
qosConfigWrr = qosConfig[portSpeedCableLength]["wrr"]
@@ -1639,6 +1649,9 @@ def testQosSaiPgSharedWatermark(
16391649
"""
16401650

16411651
portSpeedCableLength = dutQosConfig["portSpeedCableLength"]
1652+
if pgProfile == "wm_pg_shared_lossless":
1653+
skip_test_on_no_lossless_pg(portSpeedCableLength)
1654+
16421655
if pgProfile in list(dutQosConfig["param"][portSpeedCableLength].keys()):
16431656
qosConfig = dutQosConfig["param"][portSpeedCableLength]
16441657
else:
@@ -1734,6 +1747,7 @@ def testQosSaiPgHeadroomWatermark(
17341747
RunAnsibleModuleFail if ptf test fails
17351748
"""
17361749
portSpeedCableLength = dutQosConfig["portSpeedCableLength"]
1750+
skip_test_on_no_lossless_pg(portSpeedCableLength)
17371751
if dutTestParams['hwsku'] in self.BREAKOUT_SKUS and 'backend' not in dutTestParams['topo']:
17381752
qosConfig = dutQosConfig["param"][portSpeedCableLength]["breakout"]
17391753
else:
@@ -1846,6 +1860,8 @@ def testQosSaiQSharedWatermark(
18461860
RunAnsibleModuleFail if ptf test fails
18471861
"""
18481862
portSpeedCableLength = dutQosConfig["portSpeedCableLength"]
1863+
if queueProfile == "wm_q_shared_lossless":
1864+
skip_test_on_no_lossless_pg(portSpeedCableLength)
18491865

18501866
if queueProfile == "wm_q_shared_lossless":
18511867
if dutTestParams["basicParams"]["sonic_asic_type"] == 'cisco-8000':
@@ -1907,7 +1923,8 @@ def testQosSaiQSharedWatermark(
19071923
)
19081924

19091925
def testQosSaiDscpToPgMapping(
1910-
self, get_src_dst_asic_and_duts, duthost, request, ptfhost, dutTestParams, dutConfig, dut_qos_maps # noqa F811
1926+
self, get_src_dst_asic_and_duts, duthost, request, ptfhost,
1927+
dutTestParams, dutConfig, dut_qos_maps, dutQosConfig # noqa F811
19111928
):
19121929
"""
19131930
Test QoS SAI DSCP to PG mapping ptf test
@@ -1926,6 +1943,8 @@ def testQosSaiDscpToPgMapping(
19261943
RunAnsibleModuleFail if ptf test fails
19271944
"""
19281945
disableTest = request.config.getoption("--disable_test")
1946+
portSpeedCableLength = dutQosConfig["portSpeedCableLength"]
1947+
skip_test_on_no_lossless_pg(portSpeedCableLength)
19291948
if dutTestParams["basicParams"]["sonic_asic_type"] == 'cisco-8000' or \
19301949
('platform_asic' in dutTestParams["basicParams"] and
19311950
dutTestParams["basicParams"]["platform_asic"] in ["broadcom-dnx", "mellanox"]):

0 commit comments

Comments
 (0)