Skip to content

[techsupport] Skip switch-only collectors on Switch-BMC#4638

Merged
yxieca merged 1 commit into
sonic-net:masterfrom
william8545:techsupport-bmc-skip-switch-collectors
Jun 29, 2026
Merged

[techsupport] Skip switch-only collectors on Switch-BMC#4638
yxieca merged 1 commit into
sonic-net:masterfrom
william8545:techsupport-bmc-skip-switch-collectors

Conversation

@william8545

Copy link
Copy Markdown
Contributor

What I did

generate_dump (the engine behind show 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_dump Switch-BMC aware so show techsupport completes cleanly on a Switch-BMC, while behavior on regular switches is unchanged.

Part of the SONiC Switch-BMC enablement.

How I did it

  • Add an IS_SWITCH_BMC flag, set from switch_bmc=1 in platform_env.conf (mirroring the existing IS_SUPERVISOR handling).
  • Gate switch-only collectors on it so they self-skip on a Switch-BMC: FRR/BGP/EVPN/BFD, ASIC/SDK health events, front-panel interface/transceiver, gearbox, STP, swss/bgp docker logs, hdparm, the SAI dump, and the port-counter snapshots.
  • Keep platform-agnostic collectors: the generic show ip interface L3 summary (incl. management), LLDP, NAT/conntrack, and platform info.
  • 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 without a failing glob;
    • sed_if_exists guards optional secret-scrub files.

How to verify it

On an AST2700-based SONiC Switch-BMC (switch_bmc=1):

  1. show techsupport → completes with exit 0, no spurious data-plane errors, and a valid gzip tarball under /var/dump.
  2. Confirm the switch-only sections are skipped (no FRR/BGP/STP/transceiver errors) while the platform/LLDP/NAT/management-interface sections are present.

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 techsupport runs (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 techsupport previously emitted many collector failures to the console/log (e.g. FRR/vtysh, STP/stpctl, front-panel interface 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 techsupport now completes with exit 0 and no spurious errors; the inapplicable switch-only sections are omitted, and the platform/LLDP/NAT/management sections are retained.

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>
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@oleksandrivantsiv

Copy link
Copy Markdown
Collaborator

@yxieca, could you please review the PR?

@yxieca yxieca left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@yxieca yxieca merged commit 2f62f6d into sonic-net:master Jun 29, 2026
9 checks passed
@mssonicbld

Copy link
Copy Markdown
Collaborator

The change is not in 202605 yet. @william8545, please manually create the cherry pick PR for branch 202605.
You can ping the release branch owner(github account: vaibhavhd) to approve your cherry pick PR.
If this change is already in 202605, please comment "already in 202605". Thanks!

---Powered by SONiC BuildBot

@mssonicbld

Copy link
Copy Markdown
Collaborator

Cherry-pick PR to msft-202608: Azure/sonic-utilities.msft#388

Yogapriya-cisco pushed a commit to vrajeshe/sonic-utilities that referenced this pull request Jul 10, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants