[action] [PR:4638] [techsupport] Skip switch-only collectors on Switch-BMC#388
Merged
Merged
Conversation
#### 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. Signed-off-by: Sonic Build Admin <sonicbld@microsoft.com>
Collaborator
Author
|
Original PR: sonic-net/sonic-utilities#4638 |
Collaborator
Author
|
/azp run |
|
Azure Pipelines could not run because the pipeline triggers exclude this branch/path. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.Signed-off-by: Sonic Build Admin sonicbld@microsoft.com