Skip to content

Commit

Permalink
Fix error in qos_param_generator (#14715)
Browse files Browse the repository at this point in the history
Description of PR
Error seen when running on T2 testbed.

21:32:22 base._run                                L0118 DEBUG  | /data/tests/common/devices/sonic.py::get_running_config_facts#1774: [sfd-lt2-lc0] AnsibleModule::config_facts done, is_failed=False, rc=None
21:32:22 __init__._fixture_generator_decorator    L0088 ERROR  | 
KeyError('DSCP_TO_TC_MAP')
Traceback (most recent call last):
  File "/data/tests/common/plugins/log_section_start/__init__.py", line 84, in _fixture_generator_decorator
    res = next(it)
  File "/data/tests/qos/qos_sai_base.py", line 1671, in dutQosConfig
    qpm = qos_param_generator.QosParamCisco(
  File "/data/tests/qos/files/cisco/qos_param_generator.py", line 87, in __init__
    self.dscp_queue0 = self.get_one_dscp_from_queue(0)
  File "/data/tests/qos/files/cisco/qos_param_generator.py", line 96, in get_one_dscp_from_queue
    dscp_to_tc_map = self.config_facts['DSCP_TO_TC_MAP']['AZURE']
KeyError: 'DSCP_TO_TC_MAP'
self.config_facts['DSCP_TO_TC_MAP'] doesn't exist, since it reads the running-config for host, not for asic.


Approach
What is the motivation for this PR?
Fix script error when running on T2 testbed.

How did you do it?
Read configuration for asic, also move those statements under if support_autogen.

How did you verify/test it?
Verified there is no error when running on T2 testbed.

---------------------------------------------- generated xml file: /tmp/qos/test_qos_sai.py::TestQosSai::testParameter_2024-09-25-20-41-38.xml -----------------------------------------------
----------------------------------------------------------------------------------- live log sessionfinish -----------------------------------------------------------------------------------
21:08:01 __init__.pytest_terminal_summary         L0067 INFO   | Can not get Allure report URL. Please check logs
================================================================================== short test summary info ===================================================================================
PASSED qos/test_qos_sai.py::TestQosSai::testParameter[single_asic]
PASSED qos/test_qos_sai.py::TestQosSai::testParameter[single_dut_multi_asic]
PASSED qos/test_qos_sai.py::TestQosSai::testParameter[multi_dut_longlink_to_shortlink]
PASSED qos/test_qos_sai.py::TestQosSai::testParameter[multi_dut_shortlink_to_shortlink]
PASSED qos/test_qos_sai.py::TestQosSai::testParameter[multi_dut_shortlink_to_longlink]
========================================================================= 5 passed, 1 warning in 1581.20s (0:26:21) ==========================================================================
INFO:root:Can not get Allure report URL. Please check logs
sonic@sonic-ucs-m6-4:/data/tests$ 
Verified there is no error on T0 testbed.

------------------------------------------------- generated xml file: /tmp/qos/test_qos_sai.py::TestQosSai::testParameter_2024-09-25-23-05-30.xml -------------------------------------------------
------------------------------------------------------------------------------------- live log sessionfinish --------------------------------------------------------------------------------------
23:08:20 __init__.pytest_terminal_summary         L0067 INFO   | Can not get Allure report URL. Please check logs
===================================================================================== short test summary info =====================================================================================
PASSED qos/test_qos_sai.py::TestQosSai::testParameter[single_asic]
SKIPPED [1] qos/test_qos_sai.py:315: single_dut_multi_asic is not supported on T0 topologies
SKIPPED [3] qos/test_qos_sai.py:315: multi-dut is not supported on T0 topologies
====================================================================== 1 passed, 4 skipped, 2 warnings in 168.11s (0:02:48) =======================================================================
INFO:root:Can not get Allure report URL. Please check logs
sonic@sonic-ucs-m5-9:/data/tests$ 
Any platform specific information?
The error is only seen on T2.

Signed-off-by: Zhixin Zhu <[email protected]>
  • Loading branch information
zhixzhu authored and mssonicbld committed Oct 1, 2024
1 parent 16da56c commit 3fb703c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions tests/qos/files/cisco/qos_param_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ def __init__(self, qos_params, duthost, dutAsic, topo, bufferConfig, portSpeedCa
self.log("Pre-pad drop thr bytes: {}".format(pre_pad_drop))
self.log("Drop thr bytes: {}".format(self.drop_thr))
self.log("Reduced pause thr bytes: {}".format(self.reduced_pause_thr))
self.config_facts = duthost.get_running_config_facts()
# DSCP value for lossy
self.dscp_queue0 = self.get_one_dscp_from_queue(0)
self.dscp_queue1 = self.get_one_dscp_from_queue(1)
# DSCP, queue, weight list
self.dscp_list, self.q_list, self.weight_list = self.get_dscp_q_weight_list()
self.config_facts = duthost.asic_instance().config_facts(source="running")["ansible_facts"]
# DSCP value for lossy
self.dscp_queue0 = self.get_one_dscp_from_queue(0)
self.dscp_queue1 = self.get_one_dscp_from_queue(1)
# DSCP, queue, weight list
self.dscp_list, self.q_list, self.weight_list = self.get_dscp_q_weight_list()

def get_one_dscp_from_queue(self, queue):
'''
Expand Down
2 changes: 1 addition & 1 deletion tests/qos/qos_sai_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2404,7 +2404,7 @@ def tc_to_dscp_count(self, get_src_dst_asic_and_duts):
tc_to_dscp_count_map = {}
for tc in range(8):
tc_to_dscp_count_map[tc] = 0
config_facts = duthost.get_running_config_facts()
config_facts = duthost.asic_instance().config_facts(source="running")["ansible_facts"]
dscp_to_tc_map = config_facts['DSCP_TO_TC_MAP']['AZURE']
for dscp, tc in dscp_to_tc_map.items():
tc_to_dscp_count_map[int(tc)] += 1
Expand Down

0 comments on commit 3fb703c

Please sign in to comment.