From 8714bbb773a0f8c97088fa98f7f9942115bdf61e Mon Sep 17 00:00:00 2001 From: ETWen Date: Fri, 21 Aug 2026 12:19:18 +0800 Subject: [PATCH] fix(ttl): Compare SWB_UNIT1 in the second operand of the traffic branches Rework the traffic blocks in A, B and C as explicit if/elseif branches holding literal commands, and drop the derived swb_any/swb_opt from config.ttl -- the branches read straight off the page and there is no indirection to follow. All nine conditions compared SWB_UNIT0 against itself, though: if SWB_UNIT0 = 1 && SWB_UNIT0 = 1 -> SWB_UNIT0 = 1 elseif SWB_UNIT0 = 1 && SWB_UNIT0 = 0 -> never elseif SWB_UNIT0 = 0 && SWB_UNIT0 = 1 -> never so the single-unit paths were unreachable. A DUT with only unit 0 would have run the both-unit commands and hit bcmcmd on an absent unit 1, while a DUT with only unit 1 fell through to the empty else and skipped traffic entirely. Second operand is now SWB_UNIT1. Verified per branch that the -u argument matches the condition guarding it: both units carry no -u (tool default TL_UNITS="0 1"), unit-0-only carries -u 0, unit-1-only carries -u 1, and the else stays empty. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_014RetWKFZFG1ZHcitQAyhwM --- src/Script_ABC_Blanton/1_Blanton_Script_A.ttl | 63 +++++++++++++------ src/Script_ABC_Blanton/2_Blanton_Script_B.ttl | 44 +++++++++---- src/Script_ABC_Blanton/3_Blanton_Script_C.ttl | 21 +++++-- src/Script_ABC_Blanton/config.ttl | 25 -------- 4 files changed, 92 insertions(+), 61 deletions(-) diff --git a/src/Script_ABC_Blanton/1_Blanton_Script_A.ttl b/src/Script_ABC_Blanton/1_Blanton_Script_A.ttl index 5f226cd..2f48e8c 100644 --- a/src/Script_ABC_Blanton/1_Blanton_Script_A.ttl +++ b/src/Script_ABC_Blanton/1_Blanton_Script_A.ttl @@ -22,7 +22,7 @@ ; ScriptA Remove empty Check History block ; ScriptA/B Disable lldp + config save before traffic (silent MAC) ; ScriptB Add sfputil lpmode off Ethernet513/514 -; V1.0.5 2026-08-21 config.ttl Add SWB_UNIT0/SWB_UNIT1 (+derived swb_any/swb_opt) +; V1.0.5 2026-08-21 config.ttl Add SWB_UNIT0/SWB_UNIT1 ; utils/wait_init.ttl Follow config.ttl SWB_UNIT0/SWB_UNIT1 ; ScriptA/B/C Traffic follows SWB_UNIT: -u 0 / -u 1 / skip ; ============================================================================= @@ -127,32 +127,59 @@ sendln "config feature state lldp disabled" wait prompt_sonic_root sendln "config save -y" -; swb_any / swb_opt come from config.ttl: "" both units, " -u 0" or " -u 1" -; when only one is populated, and the whole block is skipped when neither is. -if swb_any = 1 then +if SWB_UNIT0 = 1 && SWB_UNIT1 = 1 then wait prompt_sonic_root - sprintf2 tl_cmd 'blanton_traffic_linespeed ps%s' swb_opt - sendln tl_cmd + sendln "blanton_traffic_linespeed ps" wait prompt_sonic_root - sprintf2 tl_cmd 'blanton_traffic_linespeed init%s' swb_opt - sendln tl_cmd + sendln "blanton_traffic_linespeed init" wait prompt_sonic_root - sprintf2 tl_cmd 'blanton_traffic_linespeed clear%s' swb_opt - sendln tl_cmd + sendln "blanton_traffic_linespeed clear" wait prompt_sonic_root pause 15 - sprintf2 tl_cmd 'blanton_traffic_linespeed show%s' swb_opt - sendln tl_cmd + sendln "blanton_traffic_linespeed show" wait prompt_sonic_root - sprintf2 tl_cmd 'blanton_traffic_linespeed start%s' swb_opt - sendln tl_cmd + sendln "blanton_traffic_linespeed start" wait prompt_sonic_root pause 15 - sprintf2 tl_cmd 'blanton_traffic_linespeed stop%s' swb_opt - sendln tl_cmd + sendln "blanton_traffic_linespeed stop" wait prompt_sonic_root - sprintf2 tl_cmd 'blanton_traffic_linespeed report%s' swb_opt - sendln tl_cmd + sendln "blanton_traffic_linespeed report" +elseif SWB_UNIT0 = 1 && SWB_UNIT1 = 0 then + wait prompt_sonic_root + sendln "blanton_traffic_linespeed ps -u 0" + wait prompt_sonic_root + sendln "blanton_traffic_linespeed init -u 0" + wait prompt_sonic_root + sendln "blanton_traffic_linespeed clear -u 0" + wait prompt_sonic_root + pause 15 + sendln "blanton_traffic_linespeed show -u 0" + wait prompt_sonic_root + sendln "blanton_traffic_linespeed start -u 0" + wait prompt_sonic_root + pause 15 + sendln "blanton_traffic_linespeed stop -u 0" + wait prompt_sonic_root + sendln "blanton_traffic_linespeed report -u 0" +elseif SWB_UNIT0 = 0 && SWB_UNIT1 = 1 then + wait prompt_sonic_root + sendln "blanton_traffic_linespeed ps -u 1" + wait prompt_sonic_root + sendln "blanton_traffic_linespeed init -u 1" + wait prompt_sonic_root + sendln "blanton_traffic_linespeed clear -u 1" + wait prompt_sonic_root + pause 15 + sendln "blanton_traffic_linespeed show -u 1" + wait prompt_sonic_root + sendln "blanton_traffic_linespeed start -u 1" + wait prompt_sonic_root + pause 15 + sendln "blanton_traffic_linespeed stop -u 1" + wait prompt_sonic_root + sendln "blanton_traffic_linespeed report -u 1" +else + endif ; ========== Show Power on uptime ========== diff --git a/src/Script_ABC_Blanton/2_Blanton_Script_B.ttl b/src/Script_ABC_Blanton/2_Blanton_Script_B.ttl index 10a4922..61ff9a3 100644 --- a/src/Script_ABC_Blanton/2_Blanton_Script_B.ttl +++ b/src/Script_ABC_Blanton/2_Blanton_Script_B.ttl @@ -70,24 +70,44 @@ sendln "config feature state lldp disabled" wait prompt_sonic_root sendln "config save -y" -; swb_any / swb_opt come from config.ttl -if swb_any = 1 then +if SWB_UNIT0 = 1 && SWB_UNIT1 = 1 then wait prompt_sonic_root - sprintf2 tl_cmd 'blanton_traffic_linespeed ps%s' swb_opt - sendln tl_cmd + sendln "blanton_traffic_linespeed ps" wait prompt_sonic_root - sprintf2 tl_cmd 'blanton_traffic_linespeed init%s' swb_opt - sendln tl_cmd + sendln "blanton_traffic_linespeed init" wait prompt_sonic_root - sprintf2 tl_cmd 'blanton_traffic_linespeed clear%s' swb_opt - sendln tl_cmd + sendln "blanton_traffic_linespeed clear" wait prompt_sonic_root pause 15 - sprintf2 tl_cmd 'blanton_traffic_linespeed show%s' swb_opt - sendln tl_cmd + sendln "blanton_traffic_linespeed show" wait prompt_sonic_root - sprintf2 tl_cmd 'blanton_traffic_linespeed start%s' swb_opt - sendln tl_cmd + sendln "blanton_traffic_linespeed start" +elseif SWB_UNIT0 = 1 && SWB_UNIT1 = 0 then + wait prompt_sonic_root + sendln "blanton_traffic_linespeed ps -u 0" + wait prompt_sonic_root + sendln "blanton_traffic_linespeed init -u 0" + wait prompt_sonic_root + sendln "blanton_traffic_linespeed clear -u 0" + wait prompt_sonic_root + pause 15 + sendln "blanton_traffic_linespeed show -u 0" + wait prompt_sonic_root + sendln "blanton_traffic_linespeed start -u 0" +elseif SWB_UNIT0 = 0 && SWB_UNIT1 = 1 then + wait prompt_sonic_root + sendln "blanton_traffic_linespeed ps -u 1" + wait prompt_sonic_root + sendln "blanton_traffic_linespeed init -u 1" + wait prompt_sonic_root + sendln "blanton_traffic_linespeed clear -u 1" + wait prompt_sonic_root + pause 15 + sendln "blanton_traffic_linespeed show -u 1" + wait prompt_sonic_root + sendln "blanton_traffic_linespeed start -u 1" +else + endif diff --git a/src/Script_ABC_Blanton/3_Blanton_Script_C.ttl b/src/Script_ABC_Blanton/3_Blanton_Script_C.ttl index 7e4c248..0b264cf 100644 --- a/src/Script_ABC_Blanton/3_Blanton_Script_C.ttl +++ b/src/Script_ABC_Blanton/3_Blanton_Script_C.ttl @@ -43,14 +43,23 @@ wait prompt_sonic_root sendln "cat ~/hammer/tools/log.stress_ssd" ; ========== CHECK Traffic counters ========== -; swb_any / swb_opt come from config.ttl -if swb_any = 1 then +if SWB_UNIT0 = 1 && SWB_UNIT1 = 1 then wait prompt_sonic_root - sprintf2 tl_cmd 'blanton_traffic_linespeed stop%s' swb_opt - sendln tl_cmd + sendln "blanton_traffic_linespeed stop" wait prompt_sonic_root - sprintf2 tl_cmd 'blanton_traffic_linespeed report%s' swb_opt - sendln tl_cmd + sendln "blanton_traffic_linespeed report" +elseif SWB_UNIT0 = 1 && SWB_UNIT1 = 0 then + wait prompt_sonic_root + sendln "blanton_traffic_linespeed stop -u 0" + wait prompt_sonic_root + sendln "blanton_traffic_linespeed report -u 0" +elseif SWB_UNIT0 = 0 && SWB_UNIT1 = 1 then + wait prompt_sonic_root + sendln "blanton_traffic_linespeed stop -u 1" + wait prompt_sonic_root + sendln "blanton_traffic_linespeed report -u 1" +else + endif wait prompt_sonic_root diff --git a/src/Script_ABC_Blanton/config.ttl b/src/Script_ABC_Blanton/config.ttl index 6dad08b..5d88f68 100644 --- a/src/Script_ABC_Blanton/config.ttl +++ b/src/Script_ABC_Blanton/config.ttl @@ -5,7 +5,6 @@ project_name = "Blanton" strTestcase="ENV" ;ENV,EMC,Margin...etc EN_Margin = 0 ; 1: Enable Margin Test, 0: Disable Margin Test - EN_log = 1 ; 1: Enable log, 0: Disable log ;================================================================ @@ -14,30 +13,6 @@ EN_log = 1 ; 1: Enable log, 0: Disable log SWB_UNIT0 = 1 ; 1 = this DUT has switch unit 0, wait for it ; 0 = skip SWB_UNIT1 = 1 ; 1 = this DUT has switch unit 1, wait for it ; 0 = skip -; --- derived from the two flags above; do not edit -------------- -; swb_any : 0 = no switch unit at all -> skip every traffic block -; swb_opt : suffix appended to each blanton_traffic_linespeed call -; "" both units -> tool default TL_UNITS="0 1" -; " -u 0" unit 0 only -; " -u 1" unit 1 only -swb_any = 0 -swb_opt = "" -if SWB_UNIT0 = 1 then - swb_any = 1 -endif -if SWB_UNIT1 = 1 then - swb_any = 1 -endif -if SWB_UNIT0 = 1 then - if SWB_UNIT1 = 0 then - swb_opt = " -u 0" - endif -endif -if SWB_UNIT0 = 0 then - if SWB_UNIT1 = 1 then - swb_opt = " -u 1" - endif -endif ;================================================================ ; Prompt Definitions ;================================================================