-
Notifications
You must be signed in to change notification settings - Fork 661
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
CLI command to load config in Yang format #1781
Conversation
Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan <arlakshm@microsoft.com>
Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan <arlakshm@microsoft.com>
config/main.py
Outdated
type=click.Choice(['yang', 'config_db']), | ||
show_default=True, | ||
help='specify the file format') | ||
@click.option('-r', |
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.
The command can be used for loading initial and incremental configuration from config_yang
file.
When loading initial configuration, the intention is to replicate the behavior of config load_minigraph
. The -r
is introduced for this purpose.
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.
loading initial configuration -> then config reload
fit your purpose better.
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.
On a new SONiC device, there no configuration, the initial config can be loaded yang_config
to populate the initial configuration on the device. config load_minigraph
does the similar thing.
config reload
load the save configuration on the device and may not work in this case.
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.
Offline discussed.
- for loading initial config, we use
config reload --file_format config_yang
. It already has an option to restart service. - for incremental config, we use
config replace
. ref: https://github.com/Azure/SONiC/blob/master/doc/config-generic-update-rollback/SONiC_Generic_Config_Update_and_Rollback_Design.md - the semantice of
load
for incremental updating purpose is not well defined. It is lack the flexibility, such as removing existing config, so we will not continue implement for file_format config_yang.
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.
Fixed this in the latest commit.
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.
As comments
Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan <arlakshm@microsoft.com>
Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan <arlakshm@microsoft.com>
The existing code is fine, the check
|
/Azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
the swss test Retrying again.. |
/Azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan <arlakshm@microsoft.com>
Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan arlakshm@microsoft.com
What I did
To support loading configuration data in yang schema, the
config load
command is enchanced with the below options-t
--file-format
to specify the file-format. The config file can beyang
orconfig_db
format-r
to restart the services. Currently this option is supported for yang file format only.How I did it
Add the above mentioned cli options.
Add Unit tests
How to verify it
Verify the command on VS.
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)