[minigraph] Consume golden_config_db.json while loading minigraph#2140
[minigraph] Consume golden_config_db.json while loading minigraph#2140wen587 merged 3 commits intosonic-net:masterfrom
Conversation
| GRE_TYPE_RANGE = click.IntRange(min=0, max=65535) | ||
|
|
||
| # Load sonic-cfggen from source since /usr/local/bin/sonic-cfggen does not have .py extension. | ||
| sonic_cfggen = load_module_from_source('sonic_cfggen', '/usr/local/bin/sonic-cfggen') |
qiluo-msft
left a comment
There was a problem hiding this comment.
LGTM. Let's wait a while for more eyes.
|
Can you please provide more details in the description? For e.g, what is overridden from the golden_config? Is any config taken from the minigraph in this case? |
Updated in description. |
| clicommon.run_command(db_migrator + ' -o set_version' + cfggen_namespace_option) | ||
|
|
||
| # Load golden_config_db.json | ||
| if os.path.isfile(DEFAULT_GOLDEN_CONFIG_DB_FILE): |
There was a problem hiding this comment.
@wen587, @qiluo-msft, to support multi-asic devices, to start with could we also call this API override_config_by() per namespace as well? This will help with the pilot of this feature MACSEC_PROFILE table which is needed in the redis_db per namespace as well -- macsec/swss dockers run per asic/namespace.
Later when we design the table contents in the golden_config_db.json file, we could name the table based on the asic/namespace name eg: ASIC0_PORT_TABLE, ASIC1_PORT_TABLE etc - so that the respective tables will be pushed to the right redis DB in namespaces.
What I did
This PR is for supporting consume
golden_config_db.jsonwhile loading minigraph. User can put thegolden_config_db.jsonwith minigraph file to override configDB after reload minigraph.The
golden_config_db.jsonlooks 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-tablecommand to let it consumegolden_config_db.jsonHow 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)