[202012][minigraph] Consume golden_config_db.json while loading minigraph #2227
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
This PR is to cherry-pick changes in PR #2140 to
202012
branch after resolving conflicts.This PR is for supporting consume
golden_config_db.json
while loading minigraph. User can put thegolden_config_db.json
with minigraph file to override configDB after reload minigraph.The
golden_config_db.json
looks just like a config_db.json and it will be placed on/etc/sonic/golden_config_db.json
.Step1: Load minigraph to configDB
Step2: If golden_config_db.json exists and contains some Table configuration, that Table in configDB will be overriden by the config in golden_config_db.json. Other config that not included in golden_config_db.json will keep the same as minigraph.
For example, assume below ACL_TABLE is loaded from minigraph:
config from minigraph:
The golden_config_db.json also contains ACL_TABLE as below.
config from golden_config_db.json
During load_minigraph, the final config will be the same with golden_config_db.json because ACL_TABLE will be overriden by golden_config_db.json.
configDB ACL_TABLE final state:
How I did it
Add code
config override-config-table
command to let it consumegolden_config_db.json
How to verify it
Add UT tests and run.
Previous command output (if the output of a command-line utility has changed)
New command output (if the output of a command-line utility has changed)