Skip to content

[cherry-pick 202412] config: allow golden config to override mac, platform, asic_id#291

Merged
lguohan merged 1 commit into
Azure:202412from
securely1g:cherry-pick-golden-config-mac-202412
Mar 11, 2026
Merged

[cherry-pick 202412] config: allow golden config to override mac, platform, asic_id#291
lguohan merged 1 commit into
Azure:202412from
securely1g:cherry-pick-golden-config-mac-202412

Conversation

@securely1g

Copy link
Copy Markdown

Cherry-pick of sonic-net/sonic-utilities#4348 to 202412 branch.

Description

generate_sysinfo() unconditionally overwrites mac and platform in golden config with values from running config or hardware detection. This prevents users from overriding these fields via config load_minigraph -o or config override-config-table.

Fix

Change generate_sysinfo() to only backfill mac and platform when they are not explicitly present in the golden config. Existing behavior is preserved for golden configs that don't specify these fields.

Test

Added test_device_metadata_explicit_sysinfo_override to verify explicit golden config values are not overwritten by hardware-detected values.

Signed-off-by: securely1g securely1g@users.noreply.github.com

Currently generate_sysinfo() unconditionally overwrites mac, platform,
and asic_id in the golden config with values from the running config or
hardware detection. This prevents users from intentionally overriding
these fields via 'config load_minigraph -o' or 'config override-config-table'.

Change generate_sysinfo() to only backfill these fields when they are
not explicitly present in the golden config input. If the golden config
provides mac/platform/asic_id, those values are preserved.

Add unit test to verify explicit sysinfo values in golden config are
not overwritten by hardware-detected values.

Signed-off-by: securely1g <securely1g@users.noreply.github.com>
@BYGX-wcr

Copy link
Copy Markdown

@r12f

@BYGX-wcr BYGX-wcr left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

good

@securely1g

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@lguohan lguohan merged commit bce9106 into Azure:202412 Mar 11, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants