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) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014RetWKFZFG1ZHcitQAyhwM
This commit is contained in:
2026-08-21 12:19:18 +08:00
co-authored by Claude Opus 5
parent d8bf1f7a41
commit 8714bbb773
4 changed files with 92 additions and 61 deletions
+45 -18
View File
@@ -22,7 +22,7 @@
; ScriptA Remove empty Check History block ; ScriptA Remove empty Check History block
; ScriptA/B Disable lldp + config save before traffic (silent MAC) ; ScriptA/B Disable lldp + config save before traffic (silent MAC)
; ScriptB Add sfputil lpmode off Ethernet513/514 ; 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 ; utils/wait_init.ttl Follow config.ttl SWB_UNIT0/SWB_UNIT1
; ScriptA/B/C Traffic follows SWB_UNIT: -u 0 / -u 1 / skip ; 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 wait prompt_sonic_root
sendln "config save -y" sendln "config save -y"
; swb_any / swb_opt come from config.ttl: "" both units, " -u 0" or " -u 1" if SWB_UNIT0 = 1 && SWB_UNIT1 = 1 then
; when only one is populated, and the whole block is skipped when neither is.
if swb_any = 1 then
wait prompt_sonic_root wait prompt_sonic_root
sprintf2 tl_cmd 'blanton_traffic_linespeed ps%s' swb_opt sendln "blanton_traffic_linespeed ps"
sendln tl_cmd
wait prompt_sonic_root wait prompt_sonic_root
sprintf2 tl_cmd 'blanton_traffic_linespeed init%s' swb_opt sendln "blanton_traffic_linespeed init"
sendln tl_cmd
wait prompt_sonic_root wait prompt_sonic_root
sprintf2 tl_cmd 'blanton_traffic_linespeed clear%s' swb_opt sendln "blanton_traffic_linespeed clear"
sendln tl_cmd
wait prompt_sonic_root wait prompt_sonic_root
pause 15 pause 15
sprintf2 tl_cmd 'blanton_traffic_linespeed show%s' swb_opt sendln "blanton_traffic_linespeed show"
sendln tl_cmd
wait prompt_sonic_root wait prompt_sonic_root
sprintf2 tl_cmd 'blanton_traffic_linespeed start%s' swb_opt sendln "blanton_traffic_linespeed start"
sendln tl_cmd
wait prompt_sonic_root wait prompt_sonic_root
pause 15 pause 15
sprintf2 tl_cmd 'blanton_traffic_linespeed stop%s' swb_opt sendln "blanton_traffic_linespeed stop"
sendln tl_cmd
wait prompt_sonic_root wait prompt_sonic_root
sprintf2 tl_cmd 'blanton_traffic_linespeed report%s' swb_opt sendln "blanton_traffic_linespeed report"
sendln tl_cmd 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 endif
; ========== Show Power on uptime ========== ; ========== Show Power on uptime ==========
+32 -12
View File
@@ -70,24 +70,44 @@ sendln "config feature state lldp disabled"
wait prompt_sonic_root wait prompt_sonic_root
sendln "config save -y" sendln "config save -y"
; swb_any / swb_opt come from config.ttl if SWB_UNIT0 = 1 && SWB_UNIT1 = 1 then
if swb_any = 1 then
wait prompt_sonic_root wait prompt_sonic_root
sprintf2 tl_cmd 'blanton_traffic_linespeed ps%s' swb_opt sendln "blanton_traffic_linespeed ps"
sendln tl_cmd
wait prompt_sonic_root wait prompt_sonic_root
sprintf2 tl_cmd 'blanton_traffic_linespeed init%s' swb_opt sendln "blanton_traffic_linespeed init"
sendln tl_cmd
wait prompt_sonic_root wait prompt_sonic_root
sprintf2 tl_cmd 'blanton_traffic_linespeed clear%s' swb_opt sendln "blanton_traffic_linespeed clear"
sendln tl_cmd
wait prompt_sonic_root wait prompt_sonic_root
pause 15 pause 15
sprintf2 tl_cmd 'blanton_traffic_linespeed show%s' swb_opt sendln "blanton_traffic_linespeed show"
sendln tl_cmd
wait prompt_sonic_root wait prompt_sonic_root
sprintf2 tl_cmd 'blanton_traffic_linespeed start%s' swb_opt sendln "blanton_traffic_linespeed start"
sendln tl_cmd 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 endif
+15 -6
View File
@@ -43,14 +43,23 @@ wait prompt_sonic_root
sendln "cat ~/hammer/tools/log.stress_ssd" sendln "cat ~/hammer/tools/log.stress_ssd"
; ========== CHECK Traffic counters ========== ; ========== CHECK Traffic counters ==========
; swb_any / swb_opt come from config.ttl if SWB_UNIT0 = 1 && SWB_UNIT1 = 1 then
if swb_any = 1 then
wait prompt_sonic_root wait prompt_sonic_root
sprintf2 tl_cmd 'blanton_traffic_linespeed stop%s' swb_opt sendln "blanton_traffic_linespeed stop"
sendln tl_cmd
wait prompt_sonic_root wait prompt_sonic_root
sprintf2 tl_cmd 'blanton_traffic_linespeed report%s' swb_opt sendln "blanton_traffic_linespeed report"
sendln tl_cmd 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 endif
wait prompt_sonic_root wait prompt_sonic_root
-25
View File
@@ -5,7 +5,6 @@ project_name = "Blanton"
strTestcase="ENV" ;ENV,EMC,Margin...etc strTestcase="ENV" ;ENV,EMC,Margin...etc
EN_Margin = 0 ; 1: Enable Margin Test, 0: Disable Margin Test EN_Margin = 0 ; 1: Enable Margin Test, 0: Disable Margin Test
EN_log = 1 ; 1: Enable log, 0: Disable log 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_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 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 ; Prompt Definitions
;================================================================ ;================================================================