feat(ttl): Drive traffic and port wait from SWB_UNIT0/SWB_UNIT1
The bench is not always fully populated. config.ttl now declares which
switch units exist:
SWB_UNIT0 = 1 ; this DUT has switch unit 0
SWB_UNIT1 = 1 ; this DUT has switch unit 1
Two values are derived there rather than repeating the same test in
three scripts: swb_any (0 = no unit at all) and swb_opt, the suffix
appended to each blanton_traffic_linespeed call -- "" for both units so
the tool's own TL_UNITS="0 1" applies, " -u 0" or " -u 1" for a single
one.
Script A, B and C build their traffic commands with sprintf2 and the
suffix, wrapped in `if swb_any = 1`. A half-populated DUT no longer
issues bcmcmd against an absent unit, and a DUT with no switch board
skips the traffic stage outright instead of filling the log with
failures.
wait_init.ttl reads the same two flags instead of its own copies, so the
wait and the traffic blocks cannot disagree about what is installed.
Script A -> V1.0.5.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014RetWKFZFG1ZHcitQAyhwM
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
; =============================================================================
|
; =============================================================================
|
||||||
; Script A for Blanton
|
; Script A for Blanton
|
||||||
; Version : V1.0.4
|
; Version : V1.0.5
|
||||||
; Date : 2026-08-21
|
; Date : 2026-08-21
|
||||||
; Author : ETWen
|
; Author : ETWen
|
||||||
; =============================================================================
|
; =============================================================================
|
||||||
@@ -22,6 +22,9 @@
|
|||||||
; 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)
|
||||||
|
; utils/wait_init.ttl Follow config.ttl SWB_UNIT0/SWB_UNIT1
|
||||||
|
; ScriptA/B/C Traffic follows SWB_UNIT: -u 0 / -u 1 / skip
|
||||||
; =============================================================================
|
; =============================================================================
|
||||||
include "config.ttl"
|
include "config.ttl"
|
||||||
|
|
||||||
@@ -124,22 +127,33 @@ 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"
|
||||||
|
; 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
|
||||||
sendln "blanton_traffic_linespeed ps"
|
sprintf2 tl_cmd 'blanton_traffic_linespeed ps%s' swb_opt
|
||||||
|
sendln tl_cmd
|
||||||
wait prompt_sonic_root
|
wait prompt_sonic_root
|
||||||
sendln "blanton_traffic_linespeed init"
|
sprintf2 tl_cmd 'blanton_traffic_linespeed init%s' swb_opt
|
||||||
|
sendln tl_cmd
|
||||||
wait prompt_sonic_root
|
wait prompt_sonic_root
|
||||||
sendln "blanton_traffic_linespeed clear"
|
sprintf2 tl_cmd 'blanton_traffic_linespeed clear%s' swb_opt
|
||||||
|
sendln tl_cmd
|
||||||
wait prompt_sonic_root
|
wait prompt_sonic_root
|
||||||
pause 15
|
pause 15
|
||||||
sendln "blanton_traffic_linespeed show"
|
sprintf2 tl_cmd 'blanton_traffic_linespeed show%s' swb_opt
|
||||||
|
sendln tl_cmd
|
||||||
wait prompt_sonic_root
|
wait prompt_sonic_root
|
||||||
sendln "blanton_traffic_linespeed start"
|
sprintf2 tl_cmd 'blanton_traffic_linespeed start%s' swb_opt
|
||||||
|
sendln tl_cmd
|
||||||
wait prompt_sonic_root
|
wait prompt_sonic_root
|
||||||
pause 15
|
pause 15
|
||||||
sendln "blanton_traffic_linespeed stop"
|
sprintf2 tl_cmd 'blanton_traffic_linespeed stop%s' swb_opt
|
||||||
|
sendln tl_cmd
|
||||||
wait prompt_sonic_root
|
wait prompt_sonic_root
|
||||||
sendln "blanton_traffic_linespeed report"
|
sprintf2 tl_cmd 'blanton_traffic_linespeed report%s' swb_opt
|
||||||
|
sendln tl_cmd
|
||||||
|
endif
|
||||||
|
|
||||||
; ========== Show Power on uptime ==========
|
; ========== Show Power on uptime ==========
|
||||||
wait prompt_sonic_root
|
wait prompt_sonic_root
|
||||||
|
|||||||
@@ -70,17 +70,25 @@ 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_any = 1 then
|
||||||
wait prompt_sonic_root
|
wait prompt_sonic_root
|
||||||
sendln "blanton_traffic_linespeed ps"
|
sprintf2 tl_cmd 'blanton_traffic_linespeed ps%s' swb_opt
|
||||||
|
sendln tl_cmd
|
||||||
wait prompt_sonic_root
|
wait prompt_sonic_root
|
||||||
sendln "blanton_traffic_linespeed init"
|
sprintf2 tl_cmd 'blanton_traffic_linespeed init%s' swb_opt
|
||||||
|
sendln tl_cmd
|
||||||
wait prompt_sonic_root
|
wait prompt_sonic_root
|
||||||
sendln "blanton_traffic_linespeed clear"
|
sprintf2 tl_cmd 'blanton_traffic_linespeed clear%s' swb_opt
|
||||||
|
sendln tl_cmd
|
||||||
wait prompt_sonic_root
|
wait prompt_sonic_root
|
||||||
pause 15
|
pause 15
|
||||||
sendln "blanton_traffic_linespeed show"
|
sprintf2 tl_cmd 'blanton_traffic_linespeed show%s' swb_opt
|
||||||
|
sendln tl_cmd
|
||||||
wait prompt_sonic_root
|
wait prompt_sonic_root
|
||||||
sendln "blanton_traffic_linespeed start"
|
sprintf2 tl_cmd 'blanton_traffic_linespeed start%s' swb_opt
|
||||||
|
sendln tl_cmd
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -43,10 +43,15 @@ 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_any = 1 then
|
||||||
wait prompt_sonic_root
|
wait prompt_sonic_root
|
||||||
sendln "blanton_traffic_linespeed stop"
|
sprintf2 tl_cmd 'blanton_traffic_linespeed stop%s' swb_opt
|
||||||
|
sendln tl_cmd
|
||||||
wait prompt_sonic_root
|
wait prompt_sonic_root
|
||||||
sendln "blanton_traffic_linespeed report"
|
sprintf2 tl_cmd 'blanton_traffic_linespeed report%s' swb_opt
|
||||||
|
sendln tl_cmd
|
||||||
|
endif
|
||||||
|
|
||||||
wait prompt_sonic_root
|
wait prompt_sonic_root
|
||||||
sendln "show reboot-cause"
|
sendln "show reboot-cause"
|
||||||
|
|||||||
@@ -7,6 +7,37 @@ 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
|
||||||
|
|
||||||
|
;================================================================
|
||||||
|
; Switch Unit Population
|
||||||
|
;================================================================
|
||||||
|
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
|
; Prompt Definitions
|
||||||
;================================================================
|
;================================================================
|
||||||
|
|||||||
@@ -7,11 +7,12 @@
|
|||||||
; Wait until every switch unit ENABLED below reports more than WT_MIN ports up:
|
; Wait until every switch unit ENABLED below reports more than WT_MIN ports up:
|
||||||
; bcmcmd -n <u> -c ps | grep -w up | wc -l
|
; bcmcmd -n <u> -c ps | grep -w up | wc -l
|
||||||
;
|
;
|
||||||
; The DUT is not always fully populated, so declare what this bench has:
|
; The DUT is not always fully populated. Which units exist is declared ONCE in
|
||||||
; both units -> WT_UNIT0 = 1 , WT_UNIT1 = 1
|
; config.ttl, so the traffic blocks in Script A/B/C and this wait agree:
|
||||||
; unit 0 only -> WT_UNIT0 = 1 , WT_UNIT1 = 0
|
; both units -> SWB_UNIT0 = 1 , SWB_UNIT1 = 1
|
||||||
; unit 1 only -> WT_UNIT0 = 0 , WT_UNIT1 = 1
|
; unit 0 only -> SWB_UNIT0 = 1 , SWB_UNIT1 = 0
|
||||||
; no unit -> WT_UNIT0 = 0 , WT_UNIT1 = 0 (bypass, returns immediately)
|
; unit 1 only -> SWB_UNIT0 = 0 , SWB_UNIT1 = 1
|
||||||
|
; no unit -> SWB_UNIT0 = 0 , SWB_UNIT1 = 0 (bypass, returns immediately)
|
||||||
;
|
;
|
||||||
; Enter : prompt of the previous command is NOT consumed.
|
; Enter : prompt of the previous command is NOT consumed.
|
||||||
; Exit : a command has been sent, prompt NOT consumed (caller does the wait).
|
; Exit : a command has been sent, prompt NOT consumed (caller does the wait).
|
||||||
@@ -30,10 +31,11 @@
|
|||||||
; V3.0.0 2026-08-21 Add WT_UNIT0 / WT_UNIT1 so a partly populated DUT can
|
; V3.0.0 2026-08-21 Add WT_UNIT0 / WT_UNIT1 so a partly populated DUT can
|
||||||
; be declared: wait on the enabled units only, and bypass
|
; be declared: wait on the enabled units only, and bypass
|
||||||
; entirely when neither is set.
|
; entirely when neither is set.
|
||||||
|
; V3.1.0 2026-08-21 Take the population from SWB_UNIT0 / SWB_UNIT1 in
|
||||||
|
; config.ttl instead of local copies, so this wait and the
|
||||||
|
; traffic blocks cannot drift apart.
|
||||||
; =============================================================================
|
; =============================================================================
|
||||||
; ---- edit these for the bench ----------------------------------------------
|
; ---- which units to wait for: SWB_UNIT0 / SWB_UNIT1, set in config.ttl ------
|
||||||
WT_UNIT0 = 1 ; 1 = this DUT has switch unit 0, wait for it ; 0 = skip
|
|
||||||
WT_UNIT1 = 1 ; 1 = this DUT has switch unit 1, wait for it ; 0 = skip
|
|
||||||
WT_MIN = 216 ; an enabled unit must report MORE than this many ports up
|
WT_MIN = 216 ; an enabled unit must report MORE than this many ports up
|
||||||
WT_INTERVAL = 10 ; seconds between polls
|
WT_INTERVAL = 10 ; seconds between polls
|
||||||
; -----------------------------------------------------------------------------
|
; -----------------------------------------------------------------------------
|
||||||
@@ -42,8 +44,8 @@ timeout = 60 ; per-wait cap; bcmcmd ps is not instant
|
|||||||
wait prompt_sonic_root
|
wait prompt_sonic_root
|
||||||
|
|
||||||
; nothing declared -> bypass
|
; nothing declared -> bypass
|
||||||
if WT_UNIT0 = 0 then
|
if SWB_UNIT0 = 0 then
|
||||||
if WT_UNIT1 = 0 then
|
if SWB_UNIT1 = 0 then
|
||||||
goto NO_UNITS
|
goto NO_UNITS
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
@@ -51,7 +53,7 @@ endif
|
|||||||
:WAIT_PORTS
|
:WAIT_PORTS
|
||||||
wt_ok = 1
|
wt_ok = 1
|
||||||
|
|
||||||
if WT_UNIT0 = 1 then
|
if SWB_UNIT0 = 1 then
|
||||||
wt_up0 = 0
|
wt_up0 = 0
|
||||||
sendln "echo PORTS0=$(bcmcmd -n 0 -c ps | grep -w up | wc -l)"
|
sendln "echo PORTS0=$(bcmcmd -n 0 -c ps | grep -w up | wc -l)"
|
||||||
waitregex "PORTS0=[ ]*([0-9]+)"
|
waitregex "PORTS0=[ ]*([0-9]+)"
|
||||||
@@ -64,7 +66,7 @@ if WT_UNIT0 = 1 then
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if WT_UNIT1 = 1 then
|
if SWB_UNIT1 = 1 then
|
||||||
wt_up1 = 0
|
wt_up1 = 0
|
||||||
sendln "echo PORTS1=$(bcmcmd -n 1 -c ps | grep -w up | wc -l)"
|
sendln "echo PORTS1=$(bcmcmd -n 1 -c ps | grep -w up | wc -l)"
|
||||||
waitregex "PORTS1=[ ]*([0-9]+)"
|
waitregex "PORTS1=[ ]*([0-9]+)"
|
||||||
|
|||||||
Reference in New Issue
Block a user