From 61cea303a0b80fc89bab4fdcc3cecc2641b407a5 Mon Sep 17 00:00:00 2001 From: yaopingzhu Date: Tue, 19 May 2026 17:37:22 +0000 Subject: [PATCH] Fix the Broadcom supported cmds list in techsupport Due to the changes in 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 and combines with the common ones before checking. Signed-off-by: yaopingzhu --- 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 3db88c759d1..79f54785885 100644 --- a/tests/show_techsupport/tech_support_cmds.py +++ b/tests/show_techsupport/tech_support_cmds.py @@ -250,33 +250,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 b3cdb7fbbd2..1153df6fc16 100644 --- a/tests/show_techsupport/test_techsupport.py +++ b/tests/show_techsupport/test_techsupport.py @@ -534,6 +534,30 @@ def commands_to_check(duthosts, enum_rand_one_per_hwsku_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":