-
Notifications
You must be signed in to change notification settings - Fork 669
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[minigraph] Consume golden_config_db.json while loading minigraph #2140
Conversation
@@ -99,6 +99,9 @@ | |||
QUEUE_RANGE = click.IntRange(min=0, max=255) | |||
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') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
@@ -1619,6 +1623,10 @@ def load_minigraph(db, no_service_restart): | |||
cfggen_namespace_option = " -n {}".format(namespace) | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.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)