Rolling Back a Configuration from a Checkpoint File

A rollback checkpoint is an MD-CLI configuration file that can be loaded in the candidate configuration with the rollback command.

A rollback checkpoint is created automatically after every successful commit when automatic save is enabled via the MD-CLI auto-config-save command.

*(ex)[/configure system management-interface]
A:admin@node-2# info detail
    
---snip---
    
        md-cli {
            auto-config-save true
            environment {
                more true
                time-display local
                command-completion {
                    enter true
                    space true
                    tab true
                }

A rollback checkpoint is also created if an operator issues the admin save command, regardless of the MD-CLI auto-config save setting.

The rollback command loads a previously saved MD-CLI configuration file to the candidate configuration. Loading the file does not automatically initiate a commit command, which means that the file can be examined before committing. This rollback command is the equivalent of a load full-replace of the configuration file, but is identified with a checkpoint identifier. If no identifier is specified, the latest saved configuration file identified with index identifier 0 is used as the default.

The rollback command is available only for the model-driven management interface configuration mode.

[ex:/configure]
A:admin@node-2# rollback ?

 rollback

 [checkpoint] (<number> | <keyword>)
 <number>   - <0..200>
 <keyword>  - startup

    ID corresponding to the configuration file to roll back

 

Configuration files loaded with the rollback checkpoint command are identified with a number that corresponds to the configuration file and location specified as bof configuration primary-location in the active CPM’s Boot Option File (BOF). For example, the configuration file executed for a rollback 3 command corresponds to the file named config.cfg.3. The checkpoint identifier 0 corresponds to the last saved configuration file and does not have a suffix. This is also the default when no checkpoint identifier is specified with the rollback command. By default, five configuration files are saved. The configuration-backups command can be used to save a different number of configuration files.

The startup option of the rollback command loads the contents of the current admin save file set with the primary configuration and not the version of the startup file that was booted.

[ex:/configure system management-interface configuration-save]
A:admin@node-2# info detail
 ## apply-groups
 ## apply-groups-exclude
    configuration-backups 5

[ex:/configure system management-interface configuration-save]
A:admin@node-2# configuration-backups

 configuration-backups <number>
 <number>  - <1..200>
 Default   - 5

    Maximum number of backup versions maintained

The admin show configuration bof command executed from the MD-CLI shows the name of the file as config.cfg.

[/]
A:admin@node-2# admin show configuration bof | match primary-location
        primary-location "---snip---/config.cfg"

---snip---
(ro)[/]
A:admin@node-2# //show bof
INFO: CLI #2051: Switching to the classic CLI engine
A:node-2# /show bof
===============================================================================
BOF (Memory)
===============================================================================
    primary-image    ---snip---
    primary-config   ---snip---/config.cfg
    lice---snip---/license

In the MD-CLI, the rollback command references the same filename with an appended suffix of the checkpoint identifier, in this case, identifier 3:

(ex)[/configure]
A:admin@node-2# rollback 3
Executed 386 lines in 0.4 seconds from file ---snip---/config.cfg.3

The rollback command is available in global or exclusive configuration mode and can only be executed from the root of the configuration branch.

When the auto-config-save parameter is set to true, the rollback command (without an index) is the equivalent of executing the discard command for the current candidate configuration changes.

The following figures show the relationship between the candidate and running configurations, the commit command, the setting of the auto-config-save parameter, and the rollback checkpoint files.

In Figure 1, the auto-config-save parameter is set to true. With a successful commit, a rollback checkpoint is created.

Figure 1. Successful Commit with auto-config-save true

In Figure 2, the auto-config-save parameter is set to false. The admin save command creates a rollback checkpoint of the running configuration before the commit. However, a rollback checkpoint is not created after the successful commit.

Figure 2. Successful commit with auto-config-save false

In Figure 3, the commit fails and no rollback checkpoint is created, regardless of the setting of the auto-config-save parameter.

Figure 3. Failed commit