Skip to content

sam6626/Sam-SONICChangeConfig

Repository files navigation

DELL Enterprise SONiC ConfigReplace Overview

The Configuration Replacement and Rollback feature provides the capability to replace the current running configuration, i.e., CONFIG_DB, with a known good configuration file saved in the serialization of DB format, i.e. config_db.json. Currently SONiC utility "config reload" or Klish command "copy source-url running-configuration overwrite" is provided to replace configuration, but both methods require some core services restarted. This feature is designed to limit the impact to features/services that are being replaced, with minimum service disruption.

Config replace operation can be executed in either via exec CLI mode (config terminal) or the new session mode (config session).

ConfigReplace in Session mode

- Configure session mode has the below CLI options for performing the configuration replace on Dell Enterprise SONiC switch,

- Replace: New CLI introduced as part of config-replace feature, this command used to perform config replace from configure session mode.

- Commit timeout: Timer option added to commit command for user to apply the changes to CONFIG_DB on trial basis, if a timer gets expired, rollback to the previous configuration.

- Commit confirm: Confirm option added to commit command for user to confirm new configuration changes. (Move trial to permanent stage)

- Commit: Committing the new configuration changes.

Steps:

  1. start session mode
  2. switch1 (config-s)# replace config:filename
  3. switch1 (config-s)# commit

- Abort: When "clear config session" is executed from CLI – the commit timeout will be cancelled and rollback to previous running-configuration if “commit timeout” is configured. Or it just aborts the configurations from the session.

For examples and command details please check the corresponding section in Dell Enterprise SONiC - ConfigReplace Testing document here

ConfigReplace in Exec mode

Perform this operation to replace the current running configuration with a saved Dell Enterprise SONiC configuration file.

Note: User must create (generate) a configuration file in supported file format before performing this operation. Please check the Generating Configuration file section below for details.

Steps:

  1. copy source-url running-configuration replace

For examples and command details please check the corresponding section in Dell Enterprise SONiC - ConfigReplace Testing document here

ConfigReplace using REST Request

In case you are using to integrate Configreplace in your Restful programmatic logic or code. Here is a quick sample of a curl post to trigger the Configreplace.

Example

curl -X POST https://mgmt-ipaddress/restconf/operations/openconfig-file-mgmt-private:copy -H "accept: application/yang-data+json" -H "Authorization: Basic YWRtaW46RGVsbGFkbWlu" -H "Content-Type: application/yang-data+json" -d "{"openconfig-file-mgmt-private:input":{"source":"config://config_db.json","destination":"running-configuration","copy-config-option":"REPLACE"}}" -k

ConfigReplace using GNOI

In case you are using to integrate Configreplace in your gPRC programmatic logic or code. Here is a quick sample command using the built-in gNOI client to trigger the Configreplace.

Example

gnoi_client -module OpenconfigFileMgmtPrivate -rpc Copy -jsonin '{"openconfig-file-mgmt-private:input":{"source":"config://config_db.json","destination":"running-configuration","copy-config-option":"REPLACE"}}' -insecure -username <user_name> -password

For examples and command details please check the corresponding section in Dell Enterprise SONiC - ConfigReplace Testing document here

Note: gNMI not supported for config-replace.

Generating configuration file

configuration file is generated by the copy running-configuration destination-url command or if generated externally, the configuration file must fulfil with the format of files generated by Dell Enterprise SONiC devices. Configuration files can be stored and available for use with the “copy source-url running-configuration replace” command, can be located on the following file systems:

  • config: Copy from configuration directory (config://filename)
  • ftp: Copy from remote FTP server (ftp://userid:passwd@hostip/filepath)
  • home: Copy from home directory (home://filename)
  • http: Copy from remote HTTP server (http://hostip/filepath)
  • scp: Copy from remote SCP server (scp://userid:passwd@hostip/filepath)
  • usb: Copy from usb media directory (usb://filename)

The copy source-url running-configuration replace command provides the capability to replace the current running configuration with any saved Dell Enterprise SONiC configuration file. Using this functionality, we can revert to a previous configuration state if previous configuration state is saved in config file.

About

SONiC Change Config

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages