From a4294903c28dcf91f67a59f387f097b18e8e986f Mon Sep 17 00:00:00 2001 From: Sonic Build Admin Date: Mon, 23 Feb 2026 06:01:42 +0000 Subject: [PATCH] Fix SONiC PFC storm generation script on Arista devices ### Description of PR Summary: Fix SONiC PFC storm generation script on Arista devices. The PFC generation script needs to enable PFC on the fanout. However, in our fanout configuration. PORT_QOS_MAP is not configured by default. So the following code will return an error, and won't do anything. ``` admin@str5-7060x6-moby-512-fan-2:~$ sudo config interface pfc priority Ethernet88 4 on Cannot find interface Ethernet88 admin@str5-7060x6-moby-512-fan-2:~$ ``` ### Type of change - [ ] Bug fix - [ ] Testbed and Framework(new/improvement) - [ ] New Test case - [ ] Skipped for non-supported platforms - [ ] Test case improvement ### Back port request - [ ] 202205 - [ ] 202305 - [ ] 202311 - [ ] 202405 - [ ] 202411 - [ ] 202505 ### Approach #### What is the motivation for this PR? Fix the script error for Arista SONiC fanout. #### How did you do it? This script will only be called on fanout, the new change includes: 1. create the PORT_QOS_MAP entry before calling `config interface pfc priority {intf} {prio} on` 2. Remove the PORT_QOS_MAP when stopping pfc storm, 3. For SONiC fanout, use self._shellCmd() instead of incorrect self._cliCmd() when disabling PFC. #### How did you verify/test it? On local testbed. #### Any platform specific information? Arista SONiC fanout only. #### Supported testbed topology if it's a new test case? ### Documentation --- tests/common/helpers/pfc_gen_brcm_xgs.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/common/helpers/pfc_gen_brcm_xgs.py b/tests/common/helpers/pfc_gen_brcm_xgs.py index 8232d11742..cb098f8c5a 100755 --- a/tests/common/helpers/pfc_gen_brcm_xgs.py +++ b/tests/common/helpers/pfc_gen_brcm_xgs.py @@ -148,11 +148,12 @@ def _endPfcStorm(self, intf): self._bcmltshellCmd(f"pt MMU_INTFO_TO_XPORT_BKPr set BCMLT_PT_PORT={mmuPort} PAUSE_PFC_BKP=0") else: self._bcmshellCmd(f"setreg CHFC2PFC_STATE.{port} PRI_BKP=0") - self._cliCmd(f"en\nconf\n\nint {intf}\nno priority-flow-control on") if self.os == 'sonic': for prio in range(8): - self._cliCmd(f"config interface pfc priority {intf} {prio} off") + self._shellCmd(f"config interface pfc priority {intf} {prio} off") + self._shellCmd(f"redis-cli -n 4 DEL \"PORT_QOS_MAP|{intf}\"") else: + self._cliCmd(f"en\nconf\n\nint {intf}\nno priority-flow-control on") for prio in range(8): self._cliCmd(f"en\nconf\n\nint {intf}\nno priority-flow-control priority {prio} no-drop") @@ -164,6 +165,7 @@ def startPfcStorm(self, intf): mmuPort = self.intfToMmuPort[intf] port = self.intfToPort[intf] if self.os == 'sonic': + self._shellCmd(f"redis-cli -n 4 HSET \"PORT_QOS_MAP|{intf}\" \"pfc_enable\" \"\"") for prio in range(8): if (1 << prio) & self.priority: self._shellCmd(f"config interface pfc priority {intf} {prio} on")