Skip to content

Commit b0e7744

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 6d3d0ec commit b0e7744

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
@@ -1797,10 +1797,13 @@ def releaseAllPorts(
17971797
Raises:
17981798
RunAnsibleModuleFail if ptf test fails
17991799
"""
1800-
self.runPtfTest(
1801-
ptfhost, testCase="sai_qos_tests.ReleaseAllPorts",
1802-
testParams=dutTestParams["basicParams"]
1803-
)
1800+
if isMellanoxDevice(duthosts[0]):
1801+
logger.info("skip reaseAllports fixture for mellanox device")
1802+
else:
1803+
self.runPtfTest(
1804+
ptfhost, testCase="sai_qos_tests.ReleaseAllPorts",
1805+
testParams=dutTestParams["basicParams"]
1806+
)
18041807

18051808
def __loadSwssConfig(self, duthost):
18061809
"""
@@ -2123,12 +2126,26 @@ def egressLossyProfile(
21232126

21242127
srcport = dutConfig["dutInterfaces"][dutConfig["testPorts"]["src_port_id"]]
21252128

2129+
is_lossy_queue_only = False
2130+
21262131
if srcport in dualtor_ports_for_duts:
21272132
queues = "0-1"
21282133
else:
2129-
queues = "0-2"
2134+
if isMellanoxDevice(duthost):
2135+
profile_content = dut_asic.run_redis_cmd(
2136+
argv=["redis-cli", "-n", 0, "keys", f'BUFFER_PG_TABLE:{srcport}:*-4'])
2137+
if not profile_content:
2138+
is_lossy_queue_only = True
2139+
logger.info(f"{srcport} has only lossy queue")
2140+
if is_lossy_queue_only:
2141+
is_lossy_queue_only = True
2142+
queue_table_postfix_list = ['1-2', '3', '4']
2143+
queue_to_dscp_map = {'1-2': '1', '3': '3', '4': '5'}
2144+
queues = random.choice(queue_table_postfix_list)
2145+
else:
2146+
queues = "0-2"
21302147

2131-
yield self.__getBufferProfile(
2148+
egress_lossy_profile = self.__getBufferProfile(
21322149
request,
21332150
dut_asic,
21342151
duthost.os_version,
@@ -2137,6 +2154,12 @@ def egressLossyProfile(
21372154
srcport,
21382155
queues
21392156
)
2157+
if is_lossy_queue_only:
2158+
egress_lossy_profile['lossy_dscp'] = queue_to_dscp_map[queues]
2159+
egress_lossy_profile['lossy_queue'] = '1' if queues == '1-2' else queues
2160+
logger.info(f"egressLossyProfile: {egress_lossy_profile}")
2161+
2162+
yield egress_lossy_profile
21402163

21412164
@pytest.fixture(scope='class')
21422165
def losslessSchedProfile(

0 commit comments

Comments
 (0)