7.1. Discarding Changes in Specific Contexts
The discard command can be used only from the top level of the configuration branch. From any working context (including the configure context), the discard /configure command can be used.
*(ex)[configure router "Base" ospf 0 timers spf-wait]
A:admin@node-2# discard
MINOR: MGMT_CORE #2203: Invalid element - 'discard' not allowed in 'spf-wait'
*(ex)[configure router "Base" ospf 0 timers spf-wait]
A:admin@node-2# discard /configure
(ex)[configure router "Base" ospf 0 timers spf-wait]
A:admin@node-2#
However, the discard /configure command removes all configuration statements from the candidate configuration datastore. To discard changes from a specific context, the output from the compare command can be used to copy and paste configuration statements from within a working context.
By default, the compare command uses the baseline datastore as the base reference. Therefore, any new configuration in the candidate datastore is displayed with a preceding plus (+) sign. When the compare command uses the candidate datastore as the base reference, the compare output displays any new configuration in the candidate datastore with a preceding minus (-) sign, indicating that these configuration elements are not present in the baseline datastore. The configuration elements preceded with a minus (-) sign can be used to discard configurations from the specific context from which the compare command was issued.
In the following configuration example, the lsa-generate timers are modified.
(ex)[configure router "Base" ospf 0 timers lsa-generate]
A:admin@node-2# info detail
max-lsa-wait 5000
lsa-initial-wait 5000
lsa-second-wait 5000
(ex)[configure router "Base" ospf 0 timers lsa-generate]
A:admin@node-2# lsa-initial-wait 1000
*(ex)[configure router "Base" ospf 0 timers lsa-generate]
A:admin@node-2# lsa-second-wait 2000
*(ex)[configure router "Base" ospf 0 timers lsa-generate]
A:admin@node-2# max-lsa-wait 3000
*(ex)[configure router "Base" ospf 0 timers lsa-generate]
A:admin@node-2# info
max-lsa-wait 3000
lsa-initial-wait 1000
lsa-second-wait 2000
By default, the compare command shows the new configuration using the baseline datastore as the reference:
*(ex)[configure router "Base" ospf 0 timers lsa-generate]
A:admin@node-2# compare
+ max-lsa-wait 3000
+ lsa-initial-wait 1000
+ lsa-second-wait 2000
The following shows the compare command output when the command is executed with the candidate datastore as the reference.
*(ex)[configure router "Base" ospf 0 timers lsa-generate]
A:admin@node-2# compare from candidate to baseline
- max-lsa-wait 3000
- lsa-initial-wait 1000
- lsa-second-wait 2000
To discard the max-lsa-wait and lsa-initial-wait timer changes, the first two lines from the compare command output can be copied and pasted while in the specified context. The info detail command shows that the timer changes have reverted to their default values.
*(ex)[configure router "Base" ospf 0 timers lsa-generate]
A:admin@node-2# - max-lsa-wait 3000
*(ex)[configure router "Base" ospf 0 timers lsa-generate]
A:admin@node-2# - lsa-initial-wait 1000
*(ex)[configure router "Base" ospf 0 timers lsa-generate]
A:admin@node-2#
*(ex)[configure router "Base" ospf 0 timers lsa-generate]
A:admin@node-2# info detail
max-lsa-wait 5000
lsa-initial-wait 5000
lsa-second-wait 2000
*(ex)[configure router "Base" ospf 0 timers lsa-generate]
A:admin@node-2