Skip to content

Commit 79be640

Browse files
committed
Update Qos sai tests for no lossless queue feature
1. Update qos sai lossy tests because all lossless queues has changed as lossy queues 2. Skip fixture reaseAllports for mellanox device, because after qos test is finished, the teardown will do config reload, it will restore the config of ports, we don't need this fixture before running tests. Also it can save 2 minutes 3. Relevant PRs: sonic-net/sonic-buildimage#21427, sonic-net/sonic-buildimage#21056
1 parent 3019835 commit 79be640

File tree

2 files changed

+34
-6
lines changed

2 files changed

+34
-6
lines changed

tests/qos/files/mellanox/qos_param_generator.py

+5
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,11 @@ def calculate_parameters(self):
236236
self.qos_params_mlnx['wm_pg_shared_lossy'].update(wm_shared_lossy)
237237
wm_shared_lossy["pkts_num_margin"] = 8
238238
self.qos_params_mlnx['wm_q_shared_lossy'].update(wm_shared_lossy)
239+
if 'lossy_dscp' in self.egressLossyProfile:
240+
lossy_queue['dscp'] = self.egressLossyProfile['lossy_dscp']
241+
self.qos_params_mlnx['wm_pg_shared_lossy']['dscp'] = self.egressLossyProfile['lossy_dscp']
242+
self.qos_params_mlnx['wm_q_shared_lossy']['dscp'] = self.egressLossyProfile['lossy_dscp']
243+
self.qos_params_mlnx['wm_q_shared_lossy']['queue'] = self.egressLossyProfile['lossy_queue']
239244

240245
wm_buf_pool_lossless = self.qos_params_mlnx['wm_buf_pool_lossless']
241246
wm_buf_pool_lossless['pkts_num_trig_pfc'] = pkts_num_trig_pfc

tests/qos/qos_sai_base.py

+29-6
Original file line numberDiff line numberDiff line change
@@ -1747,10 +1747,13 @@ def releaseAllPorts(
17471747
Raises:
17481748
RunAnsibleModuleFail if ptf test fails
17491749
"""
1750-
self.runPtfTest(
1751-
ptfhost, testCase="sai_qos_tests.ReleaseAllPorts",
1752-
testParams=dutTestParams["basicParams"]
1753-
)
1750+
if isMellanoxDevice(duthosts[0]):
1751+
logger.info("skip reaseAllports fixture for mellanox device")
1752+
else:
1753+
self.runPtfTest(
1754+
ptfhost, testCase="sai_qos_tests.ReleaseAllPorts",
1755+
testParams=dutTestParams["basicParams"]
1756+
)
17541757

17551758
def __loadSwssConfig(self, duthost):
17561759
"""
@@ -2069,12 +2072,26 @@ def egressLossyProfile(
20692072

20702073
srcport = dutConfig["dutInterfaces"][dutConfig["testPorts"]["src_port_id"]]
20712074

2075+
is_lossy_queue_only = False
2076+
20722077
if srcport in dualtor_ports_for_duts:
20732078
queues = "0-1"
20742079
else:
2075-
queues = "0-2"
2080+
if isMellanoxDevice(duthost):
2081+
profile_content = dut_asic.run_redis_cmd(
2082+
argv=["redis-cli", "-n", 0, "keys", f'BUFFER_PG_TABLE:{srcport}:*-4'])
2083+
if not profile_content:
2084+
is_lossy_queue_only = True
2085+
logger.info(f"{srcport} has only lossy queue")
2086+
if is_lossy_queue_only:
2087+
is_lossy_queue_only = True
2088+
queue_table_postfix_list = ['1-2', '3', '4']
2089+
queue_to_dscp_map = {'1-2': '1', '3': '3', '4': '5'}
2090+
queues = random.choice(queue_table_postfix_list)
2091+
else:
2092+
queues = "0-2"
20762093

2077-
yield self.__getBufferProfile(
2094+
egress_lossy_profile = self.__getBufferProfile(
20782095
request,
20792096
dut_asic,
20802097
duthost.os_version,
@@ -2083,6 +2100,12 @@ def egressLossyProfile(
20832100
srcport,
20842101
queues
20852102
)
2103+
if is_lossy_queue_only:
2104+
egress_lossy_profile['lossy_dscp'] = queue_to_dscp_map[queues]
2105+
egress_lossy_profile['lossy_queue'] = '1' if queues == '1-2' else queues
2106+
logger.info(f"egressLossyProfile: {egress_lossy_profile}")
2107+
2108+
yield egress_lossy_profile
20862109

20872110
@pytest.fixture(scope='class')
20882111
def losslessSchedProfile(

0 commit comments

Comments
 (0)