Skip to content

Commit 6d3d0ec

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 66cef24 commit 6d3d0ec

File tree

2 files changed

+37
-3
lines changed

2 files changed

+37
-3
lines changed

tests/qos/qos_sai_base.py

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

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

tests/qos/test_qos_sai.py

+19-1
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,11 @@ def check_skip_xon_hysteresis_test(xonHysteresisKey, dutQosConfig,
175175
" Pls see qos.yaml for the port idx's that are needed.")
176176

177177

178+
def skip_test_on_no_lossless_pg(portSpeedCableLength):
179+
if portSpeedCableLength == "0_0m":
180+
pytest.skip("skip the test due to no buffer lossless pg")
181+
182+
178183
class TestQosSai(QosSaiBase):
179184
"""TestQosSai derives from QosSaiBase and contains collection of QoS SAI test cases.
180185
@@ -411,6 +416,7 @@ def testQosSaiPfcXoffLimit(
411416
"Additional DSCPs are not supported on non-dual ToR ports")
412417

413418
portSpeedCableLength = dutQosConfig["portSpeedCableLength"]
419+
skip_test_on_no_lossless_pg(portSpeedCableLength)
414420
if dutTestParams['hwsku'] in self.BREAKOUT_SKUS and 'backend' not in dutTestParams['topo']:
415421
qosConfig = dutQosConfig["param"][portSpeedCableLength]["breakout"]
416422
else:
@@ -508,6 +514,7 @@ def testPfcStormWithSharedHeadroomOccupancy(
508514
pytest.skip("Shared Headroom has to be enabled for this test")
509515

510516
portSpeedCableLength = dutQosConfig["portSpeedCableLength"]
517+
skip_test_on_no_lossless_pg(portSpeedCableLength)
511518
if xonProfile in list(dutQosConfig["param"][portSpeedCableLength].keys()):
512519
qosConfig = dutQosConfig["param"][portSpeedCableLength]
513520
else:
@@ -681,6 +688,7 @@ def testQosSaiPfcXonLimit(
681688
"Additional DSCPs are not supported on non-dual ToR ports")
682689

683690
portSpeedCableLength = dutQosConfig["portSpeedCableLength"]
691+
skip_test_on_no_lossless_pg(portSpeedCableLength)
684692
if xonProfile in list(dutQosConfig["param"][portSpeedCableLength].keys()):
685693
qosConfig = dutQosConfig["param"][portSpeedCableLength]
686694
else:
@@ -858,6 +866,7 @@ def testQosSaiHeadroomPoolSize(
858866
"""
859867

860868
portSpeedCableLength = dutQosConfig["portSpeedCableLength"]
869+
skip_test_on_no_lossless_pg(portSpeedCableLength)
861870
qosConfig = dutQosConfig["param"][portSpeedCableLength]
862871
testPortIps = dutConfig["testPortIps"]
863872

@@ -1616,6 +1625,7 @@ def testQosSaiDwrr(
16161625
RunAnsibleModuleFail if ptf test fails
16171626
"""
16181627
portSpeedCableLength = dutQosConfig["portSpeedCableLength"]
1628+
skip_test_on_no_lossless_pg(portSpeedCableLength)
16191629
qosConfig = dutQosConfig["param"]
16201630
if "wrr" in qosConfig[portSpeedCableLength]:
16211631
qosConfigWrr = qosConfig[portSpeedCableLength]["wrr"]
@@ -1695,6 +1705,9 @@ def testQosSaiPgSharedWatermark(
16951705
"""
16961706

16971707
portSpeedCableLength = dutQosConfig["portSpeedCableLength"]
1708+
if pgProfile == "wm_pg_shared_lossless":
1709+
skip_test_on_no_lossless_pg(portSpeedCableLength)
1710+
16981711
if pgProfile in list(dutQosConfig["param"][portSpeedCableLength].keys()):
16991712
qosConfig = dutQosConfig["param"][portSpeedCableLength]
17001713
else:
@@ -1798,6 +1811,7 @@ def testQosSaiPgHeadroomWatermark(
17981811
RunAnsibleModuleFail if ptf test fails
17991812
"""
18001813
portSpeedCableLength = dutQosConfig["portSpeedCableLength"]
1814+
skip_test_on_no_lossless_pg(portSpeedCableLength)
18011815
if dutTestParams['hwsku'] in self.BREAKOUT_SKUS and 'backend' not in dutTestParams['topo']:
18021816
qosConfig = dutQosConfig["param"][portSpeedCableLength]["breakout"]
18031817
else:
@@ -1910,6 +1924,8 @@ def testQosSaiQSharedWatermark(
19101924
RunAnsibleModuleFail if ptf test fails
19111925
"""
19121926
portSpeedCableLength = dutQosConfig["portSpeedCableLength"]
1927+
if queueProfile == "wm_q_shared_lossless":
1928+
skip_test_on_no_lossless_pg(portSpeedCableLength)
19131929

19141930
if queueProfile == "wm_q_shared_lossless":
19151931
if dutTestParams["basicParams"]["sonic_asic_type"] == 'cisco-8000':
@@ -1972,7 +1988,7 @@ def testQosSaiQSharedWatermark(
19721988

19731989
def testQosSaiDscpToPgMapping(
19741990
self, get_src_dst_asic_and_duts, duthost, request, ptfhost, dutTestParams, dutConfig, dut_qos_maps, # noqa F811
1975-
change_lag_lacp_timer):
1991+
change_lag_lacp_timer, dutQosConfig):
19761992
"""
19771993
Test QoS SAI DSCP to PG mapping ptf test
19781994
@@ -1990,6 +2006,8 @@ def testQosSaiDscpToPgMapping(
19902006
RunAnsibleModuleFail if ptf test fails
19912007
"""
19922008
disableTest = request.config.getoption("--disable_test")
2009+
portSpeedCableLength = dutQosConfig["portSpeedCableLength"]
2010+
skip_test_on_no_lossless_pg(portSpeedCableLength)
19932011
if dutTestParams["basicParams"]["sonic_asic_type"] == 'cisco-8000' or \
19942012
('platform_asic' in dutTestParams["basicParams"] and
19952013
dutTestParams["basicParams"]["platform_asic"] in ["broadcom-dnx", "mellanox"]):

0 commit comments

Comments
 (0)