From f6797368b7f14aea4cf824da8816af3b687ccb6b Mon Sep 17 00:00:00 2001 From: Sonic Build Admin Date: Thu, 28 May 2026 03:06:37 +0000 Subject: [PATCH] Fix the Broadcom supported cmds list in techsupport Due to the changes in [PR#4542](https://github.com/sonic-net/sonic-utilities/pull/4542), the show_techsupport test needs to check Broadcom commands based on the chip module. The fix separates non-TH5 and TH5 commands into different lists (broadcom_cmd_bcmcmd_xgs_soc and broadcom_cmd_bcmcmd_xgs_th5) and combines with the common commands list (broadcom_cmd_bcmcmd_xgs) before checking. ### Description of PR Summary: Fixes # (issue) ### Type of change - [x] Bug fix - [ ] Testbed and Framework(new/improvement) - [ ] New Test case - [ ] Skipped for non-supported platforms - [ ] Test case improvement ### Back port request - [ ] 202311 - [ ] 202405 - [ ] 202411 - [ ] 202505 - [x] 202511 - [ ] 202512 - [ ] 202605 ### Approach #### What is the motivation for this PR? To address show_techsupport test failure after [PR#4542](https://github.com/sonic-net/sonic-utilities/pull/4542) is merged. #### How did you do it? #### How did you verify/test it? Run show_techsupport test on the DUTs with Broadcom non-TH5 and TH5 chipsets, and verify no failed cases. #### Any platform specific information? #### Supported testbed topology if it's a new test case? ### Documentation Signed-off-by: Sonic Build Admin --- tests/show_techsupport/tech_support_cmds.py | 41 +++++++++++++++------ tests/show_techsupport/test_techsupport.py | 24 ++++++++++++ 2 files changed, 53 insertions(+), 12 deletions(-) diff --git a/tests/show_techsupport/tech_support_cmds.py b/tests/show_techsupport/tech_support_cmds.py index a611a52606..d011581beb 100644 --- a/tests/show_techsupport/tech_support_cmds.py +++ b/tests/show_techsupport/tech_support_cmds.py @@ -252,33 +252,50 @@ ] broadcom_cmd_bcmcmd_xgs = [ - 'bcmcmd{} -t5 version', - 'bcmcmd{} -t5 soc', - 'bcmcmd{} -t5 ps', - 'bcmcmd{} "l3 nat_ingress show"', - 'bcmcmd{} "l3 nat_egress show"', + 'bcmcmd{} -t 5 version', + 'bcmcmd{} -t 5 ps', 'bcmcmd{} "ipmc table show"', 'bcmcmd{} "multicast show"', - 'bcmcmd{} "conf show"', 'bcmcmd{} "fp show"', 'bcmcmd{} "pvlan show"', 'bcmcmd{} "l2 show"', 'bcmcmd{} "l3 intf show"', - 'bcmcmd{} "l3 defip show"', - 'bcmcmd{} "l3 l3table show"', 'bcmcmd{} "l3 egress show"', - 'bcmcmd{} "l3 ecmp egress show"', - 'bcmcmd{} "l3 multipath show"', - 'bcmcmd{} "l3 ip6host show"', - 'bcmcmd{} "l3 ip6route show"', 'bcmcmd{} "mc show"', 'bcmcmd{} "cstat *"', 'bcmcmd{} "mirror show"', 'bcmcmd{} "mirror dest show"', 'bcmcmd{} "port *"', +] + +broadcom_cmd_bcmcmd_xgs_soc = [ + 'bcmcmd{} -t 5 soc', + 'bcmcmd{} "conf show"', + 'bcmcmd{} "l3 defip show"', + 'bcmcmd{} "l3 l3table show"', + 'bcmcmd{} "l3 ecmp egress show"', + 'bcmcmd{} "l3 multipath show"', + 'bcmcmd{} "l3 ip6host show"', + 'bcmcmd{} "l3 ip6route show"', 'bcmcmd{} "d chg my_station_tcam"', ] +broadcom_cmd_bcmcmd_xgs_th5 = [ + 'bcmcmd{} "show config lt raw"', + 'bcmcmd{} "l3 route show v6=0"', + 'bcmcmd{} "l3 host show v6=0"', + 'bcmcmd{} "l3 ecmp show"', + 'bcmcmd{} "l3 host show v6=1"', + 'bcmcmd{} "l3 route show v6=1"', + 'bcmcmd{} "l2 station show"', + 'bcmcmd{} "bcmltshell -c \'pt dump -d my_station_tcam\'"', +] + +broadcom_cmd_bcmcmd_xgs_nat = [ + 'bcmcmd{} "l3 nat_ingress show"', + 'bcmcmd{} "l3 nat_egress show"', +] + broadcom_cmd_bcmcmd_dnx = [ 'bcmcmd{} "l2 show"', 'bcmcmd{} "field group list"', diff --git a/tests/show_techsupport/test_techsupport.py b/tests/show_techsupport/test_techsupport.py index bcdffe1bf5..2fb10c8bea 100644 --- a/tests/show_techsupport/test_techsupport.py +++ b/tests/show_techsupport/test_techsupport.py @@ -517,6 +517,30 @@ def commands_to_check(duthosts, enum_rand_one_per_hwsku_frontend_hostname): asic_cmds = cmds.broadcom_cmd_bcmcmd_dnx else: asic_cmds = cmds.broadcom_cmd_bcmcmd_xgs + + # Check if soc commands should be supported + soc_supported = None + try: + soc_supported = duthost.shell(r'bcmcmd bsh -c SOC') + except Exception: + pass + else: + if (soc_supported and soc_supported['rc'] == 0 + and 'Unknown command: SOC' not in ' '.join(soc_supported["stdout_lines"])): + asic_cmds += cmds.broadcom_cmd_bcmcmd_xgs_soc + else: + asic_cmds += cmds.broadcom_cmd_bcmcmd_xgs_th5 + + # Check if nat commands should be supported + nat_supported = None + try: + nat_supported = duthost.shell(r'bcmcmd "show feature" | grep -i nat') + except Exception: + pass + else: + if (nat_supported and nat_supported['rc'] == 0): + asic_cmds += cmds.broadcom_cmd_bcmcmd_xgs_nat + cmds_to_check.update( { "broadcom_cmd_bcmcmd":