[cherry-pick 202412] config: allow golden config to override mac, platform, asic_id#291
Merged
lguohan merged 1 commit intoMar 11, 2026
Conversation
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>
lguohan
approved these changes
Mar 11, 2026
Author
|
@microsoft-github-policy-service agree |
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.
Cherry-pick of sonic-net/sonic-utilities#4348 to 202412 branch.
Description
generate_sysinfo()unconditionally overwritesmacandplatformin golden config with values from running config or hardware detection. This prevents users from overriding these fields viaconfig load_minigraph -oorconfig override-config-table.Fix
Change
generate_sysinfo()to only backfillmacandplatformwhen 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_overrideto verify explicit golden config values are not overwritten by hardware-detected values.Signed-off-by: securely1g securely1g@users.noreply.github.com