Reload

This section explains the reload configuration support in SONiC switches.

Reload Configuration

This command is used to clear the current configuration and import a new configuration from the input file or from /etc/sonic/config_db.json. This command stops all services before clearing the configuration and then restarting those services.

Follow the step below to reload the configuration.

Step

Command

Description

1

config reload [OPTIONS] [FILENAME]

Configure reload options.

  • FILENAME: The names of one or more configuration files to load, separated by commas with no spaces in between.

  • OPTIONS:

    • -y, --yes: Force the loading without prompting the user for confirmation. If the argument is not specified, it prompts the user to confirm whether the user wants to load this configuration file.

    • -n, --no-service-restart: Clear and load the configuration without restarting dependent services running on the device. One use case for this option is during boot time when the config-setup service loads an existing old configuration and there are no services running on the device.

    • -f, --force: Ignore system sanity checks. By default, a list of sanity checks is performed and if one of the checks fails, the command will not execute. Sanity checks include ensuring the system status is not starting, all the essential services are up, and swss is in the ready state.

The example below shows the command used to configure reload options.

admin@sonic: ~$ sudo config reload

running

admin@sonic: ~$ sudo config reload -y

running

admin@sonic: ~$

Configure Load

This command reads the specified JSON file and writes it to the config database for addition and replacement as running settings. This command loads the configuration from the input file (if the user specifies the optional filename, the command will use that input file; otherwise, it will use the default /etc/sonic/config_db.json file as the input file) into CONFIG_DB.

The configuration present in the input file is applied on top of the already running configuration. This command does not flush the config DB before loading the new configuration; if the configuration present in the input file is same as the current running configuration, nothing happens. If the config present in the input file is not present in running configuration, it will be added. If the config present in the input file differs (when the key matches) from that of the running configuration, it will be modified per the new values for those keys.

Follow the step below to load the configuration.

Step

Command

Description

1

config load [OPTIONS] [FILENAME]

Configure load options.

  • FILENAME: The names of one or more configuration files to load, separated by commas with no spaces in between.

  • OPTIONS: -y indicates "yes" to reload the current configuration file.

The example below shows the command used to load the configuration.

admin@sonic: ~$ sudo config load -y

Running command: /usr/local/bin/sonic-cfggen -j /etc/sonic/config_db.json –write-to-db

admin@sonic: ~$ sudo config load

Load config from the default config file(s) ? [y/N]: y

Running command: /usr/local/bin/sonic-cfggen -j /etc/sonic/config_db.json –write-to-db

admin@sonic: ~$