[techsupport] Skip switch-only collectors on Switch-BMC#4638
Conversation
generate_dump ran the full switch data-plane collection unconditionally, producing many errors on a SONiC Switch-BMC, which has no ASIC/SDK, no front-panel ports, no FRR/vtysh, no swss/bgp/syncd containers, no STP, and an ARM/aspeed SoC lacking some sysfs paths and tools. Gate switch-only collectors on a new IS_SWITCH_BMC flag, set from switch_bmc=1 in platform_env.conf (mirroring IS_SUPERVISOR). FRR/BGP/EVPN/BFD, ASIC/SDK health, front-panel interface/transceiver, gearbox, STP, swss/bgp docker logs, hdparm, SAI dump and the port-counter snapshots self-skip; the generic 'show ip interface' L3 summary, LLDP, NAT/conntrack and platform info are kept. Also harden generic fallbacks so absent/empty paths no longer error: record_missing_path replaces the broken 'echo > $TARDIR/$f' fallback in save_proc/save_sys, save_pstore handles absent/empty/populated glob-free, and sed_if_exists guards optional secret-scrub files. Validated on an AST2700 SONiC-BMC: techsupport completes with exit 0 and no spurious errors, BMC artifacts are retained, and the non-BMC path is unchanged. Signed-off-by: William Tsai <willtsai@nvidia.com>
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
@yxieca, could you please review the PR? |
yxieca
left a comment
There was a problem hiding this comment.
LGTM. Reviewed the full diff — clean Switch-BMC enablement for generate_dump. IS_SWITCH_BMC mirrors the existing IS_SUPERVISOR handling (switch_bmc=1 in platform_env.conf), and the switch-only collectors self-skip on BMC (FRR/BGP/EVPN/BFD, ASIC-SDK health, front-panel interface/transceiver, gearbox, STP, swss/bgp docker logs, hdparm, SAI dump, counter snapshots) while ip-interface/LLDP/NAT/redis/platform are retained. Non-BMC behavior is unchanged and the empty-port-config path stays fatal. Generic fallbacks are hardened (record_missing_path, glob-free save_pstore, sed_if_exists for optional scrub files) with no secret-scrub regression. Validated on live AST2700. Nice work.
|
The change is not in 202605 yet. @william8545, please manually create the cherry pick PR for branch 202605. ---Powered by SONiC BuildBot
|
|
Cherry-pick PR to msft-202608: Azure/sonic-utilities.msft#388 |
What: Made scripts/generate_dump (show techsupport) Switch-BMC aware via a new IS_SWITCH_BMC flag, gating switch-only collectors (FRR/BGP/EVPN/BFD, ASIC/SDK, front-panel iface/transceiver, gearbox, STP, swss/bgp docker logs, hdparm, SAI dump, counters) to self-skip. Why: On a control-plane-only Switch-BMC (no ASIC/ports/FRR/syncd) the unconditional data-plane collection produced spurious errors and empty sections in the bundle. How: IS_SWITCH_BMC set from switch_bmc=1 in platform_env.conf (mirrors IS_SUPERVISOR); platform-agnostic collectors retained; hardened generic fallbacks (record_missing_path, glob-free save_pstore, sed_if_exists). Non-BMC behavior unchanged. Testing: All CI green — Azure.sonic-utilities, DCO/EasyCLA/Semgrep pass. Validated on live AST2700 Switch-BMC (default/--silent/--debug-dump all exit 0, gzip-valid). Approved by yxieca, oleksandrivantsiv. Signed-off-by: William Tsai <willtsai@nvidia.com> Signed-off-by: Yogapriya Mohankumar <ymohanku@cisco.com>
What I did
generate_dump(the engine behindshow techsupport) ran the full switch data-plane collection unconditionally. On a SONiC Switch-BMC — a control-plane-only platform with no ASIC/SDK, no front-panel ports, no FRR/vtysh, no swss/bgp/syncd containers, no STP, and an ARM/aspeed SoC that lacks some sysfs paths and tools — this produced a large number of spurious errors and irrelevant/empty sections in the techsupport bundle.This change makes
generate_dumpSwitch-BMC aware soshow techsupportcompletes cleanly on a Switch-BMC, while behavior on regular switches is unchanged.Part of the SONiC Switch-BMC enablement.
How I did it
IS_SWITCH_BMCflag, set fromswitch_bmc=1inplatform_env.conf(mirroring the existingIS_SUPERVISORhandling).hdparm, the SAI dump, and the port-counter snapshots.show ip interfaceL3 summary (incl. management), LLDP, NAT/conntrack, and platform info.record_missing_pathreplaces the brokenecho > $TARDIR/$ffallback insave_proc/save_sys;save_pstorehandles absent/empty/populated without a failing glob;sed_if_existsguards optional secret-scrub files.How to verify it
On an AST2700-based SONiC Switch-BMC (
switch_bmc=1):show techsupport→ completes with exit 0, no spurious data-plane errors, and a valid gzip tarball under/var/dump.On a regular (non-Switch-BMC) switch the behavior is unchanged:
IS_SWITCH_BMC=false, so every collector runs exactly as before, and the empty-port-config path stays fatal.Validated on a live AST2700 SONiC Switch-BMC: multiple full
show techsupportruns (default,--silent,--debug-dump), all exit 0 and gzip-valid; the non-BMC fatal paths confirmed unchanged.Previous command output (if the output of a command-line utility has changed)
On a Switch-BMC,
show techsupportpreviously emitted many collector failures to the console/log (e.g. FRR/vtysh, STP/stpctl, front-panelinterface transceiver, swss/bgp docker-log lookups) and wrote empty/error sections into the bundle.New command output (if the output of a command-line utility has changed)
On a Switch-BMC,
show techsupportnow completes with exit 0 and no spurious errors; the inapplicable switch-only sections are omitted, and the platform/LLDP/NAT/management sections are retained.