- Preface
- Cisco XML API Overview
- Cisco XML Router Configuration and Management
- Cisco XML Operational Requests and Fault Management
- Cisco XML and Native Data Operations
- Cisco XML and Native Data Access Techniques
- Cisco XML and Encapsulated CLI Operations
- Cisco XML and Large Data Retrieval
- Cisco XML Security
- Cisco XML Schema Versioning
- Alarms
- Error Reporting in Cisco XML Responses
- Summary of Cisco XML API Configuration Tags
- Cisco XML Transport and Event Notifications
- Cisco XML Schemas
- Network Configuration Protocol
- Cisco IOS XR Perl Scripting Toolkit
- Sample BGP Configuration
- Glossary
- Index
- Target Configuration Overview
- Configuration Operations
- Additional Configuration Options Using XML
- Locking the Running Configuration
- Browsing the Target or Running Configuration
- Browsing the Changed Configuration
- Loading the Target Configuration
- Setting the Target Configuration Explicitly
- Saving the Target Configuration
- Committing the Target Configuration
- Unlocking the Running Configuration
- Additional Router Configuration and Management Options Using XML
- Getting Commit Changes
- Loading Commit Changes
- Clearing a Target Session
- Rolling Back Configuration Changes to a Specified Commit Identifier
- Rolling Back the Trial Configuration Changes Before the Trial Time Expires
- Rolling Back Configuration Changes to a Specified Number of Commits
- Getting Rollback Changes
- Loading Rollback Changes
- Getting Configuration History
- Getting Configuration Commit List
- Getting Configuration Session Information
- Clear Configuration Session
- Replacing the Current Running Configuration
- Clear Configuration Inconsistency Alarm
Cisco XML Router Configuration and Management
This chapter reviews the basic XML requests and responses used to configure and manage the router.
The use of XML to configure the router is essentially an abstraction of a configuration editor in which client applications can, load, browse, and modify configuration data without affecting the current running (that is, active) configuration on the router. This configuration is called the "target configuration" and is not the running configuration on the router. The router's running configuration can never be modified directly. All changes to the running configuration must go through the target configuration.
Note Each client application session has its own target configuration, which is not visible to other client sessions.
This chapter contains the following sections:
•Target Configuration Overview
•Additional Router Configuration and Management Options Using XML
Target Configuration Overview
The target configuration is effectively the current running configuration overlaid with the client-entered configuration. In other words, the target configuration is the client-intended configuration if the client were to commit changes. In terms of implementation, the target configuration is an operating system buffer that contains just the changes (set and delete) that are performed within the configuration session.
A "client session" is synonymous with dedicated TCP, Telnet, Secure Shell (SSH) connection, or SSL dedicated connection and authentication, authorization, and accounting (AAA) login. The target configuration is created implicitly at the beginning of a client application session and must be promoted (that is, committed) to the running configuration explicitly by the client application in order to replace or become the running configuration. If the client session breaks, the current target configuration is aborted and any outstanding locks are released.
Note Only the syntax of the target configuration is checked and verified to be compatible with the installed software image on the router. The semantics of the target configuration is checked only when the target configuration is promoted to the running configuration.
Configuration Operations
Note Only the tasks in the "Committing the Target Configuration" section are required to change the configuration on the router (that is, modifying and committing the target configuration).
Use the following configuration options from the client application to configure or modify the router with XML:
•Locking the Running Configuration
•Browsing the Target or Running Configuration
•Browsing the Changed Configuration
•Loading the Target Configuration
•Setting the Target Configuration Explicitly
•Saving the Target Configuration
•Committing the Target Configuration
–Loading a Failed Configuration
•Unlocking the Running Configuration
Additional Configuration Options Using XML
Several optional configuration tasks are available to the client application to configure or modify the router with XML:
•Rolling Back Configuration Changes to a Specified Commit Identifier
•Rolling Back Configuration Changes to a Specified Number of Commits
•Getting Configuration History
•Getting Configuration Session Information
•Replacing the Current Running Configuration
Locking the Running Configuration
The client application uses the <Lock> operation to obtain an exclusive lock on the running configuration in order to prevent modification by other users or applications.
If the lock operation is successful, the response contains only the <Lock/> tag. If the lock operation fails, the response also contains ErrorCode and ErrorMsg attributes that indicates the cause of the lock failure.
The following example shows a request to lock the running configuration. This request corresponds to the command-line interface (CLI) command configure exclusive.
Sample XML Request from the Client Application
<?xml version="1.0" encoding="UTF-8"?>
<Request MajorVersion="1" MinorVersion="0">
<Lock/>
</Request>
Sample XML Response from the Router
<?xml version="1.0" encoding="UTF-8"?>
<Response MajorVersion="1" MinorVersion="0">
<Lock/>
<ResultSummary ErrorCount="0"/>
</Response>
The following issues are used to lock the running configuration:
•The scope of the lock is the entire configuration "namespace."
•Only one client application can hold the lock on the running configuration at a time. If a client application attempts to lock the configuration while another application holds the lock, an error is returned.
•If a client application has locked the running configuration, all other client applications can read only the running configuration, but cannot modify it (that is, they cannot commit changes to it).
•No mechanism is provided to allow a client application to break the lock of another user.
•If a client session is terminated, any outstanding locks are automatically released.
•The XML API does not support timeouts for locks.
•The <GetConfigurationSessions> operation is used to identify the user session holding the lock.
Browsing the Target or Running Configuration
The client application browses the target or current running configuration using the <Get> operation along with the <Configuration> request type tag. The client application optionally uses CLI commands encoded within XML tags to browse the configuration.
The <Configuration> tag supports the optional Source attribute, which is used to specify the source of the configuration information returned from a <Get> operation.
Getting Configuration Data
Table 2-1 describes the Source options.
If the get operation fails, the response contains one or more ErrorCode and ErrorMsg attributes indicating the cause of the failure.
The following example shows a <Get> request to browse the current Border Gateway Protocol (BGP) configuration:
Sample XML Client Request to Browse the Current BGP Configuration
<?xml version="1.0" encoding="UTF-8"?>
<Request MajorVersion="1" MinorVersion="0">
<Get>
<Configuration Source="CurrentConfig">
<BGP MajorVersion="18" MinorVersion="0"/>
</Configuration>
</Get>
</Request>
Sample XML Response from the Router
<?xml version="1.0" encoding="UTF-8"?>
<Response MajorVersion="1" MinorVersion="0">
<Get>
<Configuration Source="CurrentConfig">
<BGP MajorVersion="18" MinorVersion="0">
..
.
.
response data goes here
.
.
.
</BGP>
</Configuration>
</Get>
<ResultSummary ErrorCount="0"/>
</Response>
Browsing the Changed Configuration
When a client application issues a <Get> request with a Source type of ChangedConfig, the response contains the OperationType attribute to indicate whether the returned changes to the target configuration were a result of <Set> or <Delete> operations.
Use <Get> to browse uncommitted target configuration changes.
The following example shows <Set> and <Delete> operations that modify the BGP configuration followed by a <Get> request to browse the uncommitted BGP configuration changes. These requests correspond to the following CLI commands:
RP/0/RP0/CPU0:router# configure
RP/0/RP0/CPU0:router(config)# router bgp 3
RP/0/RP0/CPU0:router(config-bgp)# default-metric 10
RP/0/RP0/CPU0:router(config-bgp)# no neighbor 10.0.101.8
RP/0/RP0/CPU0:router(config-bgp)# exit
RP/0/RP0/CPU0:router# show configuration
Sample XML to Modify the BGP Configuration
<?xml version="1.0" encoding="UTF-8"?>
<Request MajorVersion="1" MinorVersion="0">
<Set>
<Configuration>
<BGP>
<AS>
<Naming>
<AS>0</AS>
</Naming>
<FourByteAS>
<Naming>
<AS>3</AS>
</Naming>
<DefaultVRF>
<Global>
<DefaultMetric>10</DefaultMetric>
</Global>
</DefaultVRF>
</FourByteAS>
</AS>
</BGP>
</Configuration>
</Set>
<Delete>
<Configuration>
<BGP>
<AS>
<Naming>
<AS>0</AS>
</Naming>
<FourByteAS>
<Naming>
<AS>3</AS>
</Naming>
<DefaultVRF>
<BGPEntity>
<NeighborTable>
<Neighbor>
<Naming>
<NeighborAddress>
<IPV4Address>10.0.101.8</IPV4Address>
</NeighborAddress>
</Naming>
</Neighbor>
</NeighborTable>
</BGPEntity>
</DefaultVRF>
</FourByteAS>
</AS>
</BGP>
</Configuration>
</Delete>
</Request>
Sample XML Response from the Router
<?xml version="1.0" encoding="UTF-8"?>
<Response MajorVersion="1" MinorVersion="0">
<Set>
<Configuration/>
</Set>
<Delete>
<Configuration/>
</Delete>
<ResultSummary ErrorCount="0"/>
</Response>
Sample XML Client Request to Browse Uncommitted Target Configuration Changes
<?xml version="1.0" encoding="UTF-8"?>
<Request MajorVersion="1" MinorVersion="0">
<Get>
<Configuration Source="ChangedConfig">
<BGP/>
</Configuration>
</Get>
</Request>
Sample Secondary XML Response from the Router
<?xml version="1.0" encoding="UTF-8"?>
<Response MajorVersion="1" MinorVersion="0">
<Get>
<Configuration Source="ChangedConfig" OperationType="Set">
<BGP MajorVersion="30" MinorVersion="0">
<AS>
<Naming>
<AS>0</AS>
</Naming>
<FourByteAS>
<Naming>
<AS>3</AS>
</Naming>
<BGPRunning>true</BGPRunning>
<DefaultVRF>
<Global>
<DefaultMetric>
10
</DefaultMetric>
</Global>
</DefaultVRF>
</FourByteAS>
</AS>
</BGP>
</Configuration>
<Configuration Source="ChangedConfig" OperationType="Delete">
<BGP MajorVersion="30" MinorVersion="0">
<AS>
<Naming>
<AS>0</AS>
</Naming>
<FourByteAS>
<Naming>
<AS>3</AS>
</Naming>
<DefaultVRF>
<BGPEntity>
<NeighborTable>
<Neighbor>
<Naming>
<NeighborAddress>
<IPV4Address>
10.0.101.8
</IPV4Address>
</NeighborAddress>
</Naming>
</Neighbor>
</NeighborTable>
</BGPEntity>
</DefaultVRF>
</FourByteAS>
</AS>
</BGP>
</Configuration>
</Get>
<ResultSummary ErrorCount="0"/>
</Response>
Loading the Target Configuration
The client application uses the <Load> operation along with the <File> tag to populate the target configuration with the contents of a binary configuration file previously saved on the router using the <Save> operation.
Note At the current time, a configuration file saved using CLI is not loadable with XML <Load>. The configuration should have been saved using the XML <Save> operation. Using the <Load> operation is strictly optional. It can be used alone or with the <Set> and <Delete> operations, as described in the section "Setting the Target Configuration Explicitly" section.
Use the <File> tag to name the file from which the configuration is to be loaded. When you use the <File> tag to name the file from which the configuration is to be loaded, specify the complete path of the file to be loaded.
If the load operation is successful, the response contains both the <Load> and <File> tags. If the load operation fails, the response can also contain the ErrorCode and ErrorMsg attributes that indicates the cause of the load failure.
The following example shows a request to load the target configuration from the contents of the file my_bgp.cfg:
Sample XML Client Request to Load the Target Configuration from a Named File
<?xml version="1.0" encoding="UTF-8"?>
<Request MajorVersion="1" MinorVersion="0">
<Load>
<File>disk0:/my_bgp.cfg</File>
</Load>
</Request>
Sample XML Response from the Router
<?xml version="1.0" encoding="UTF-8"?>
<Response MajorVersion="1" MinorVersion="0">
<Load>
<File>disk0:/my_bgp.cfg</File>
</Load>
<ResultSummary ErrorCount="0"/>
</Response>
See also the "Setting the Target Configuration Explicitly" section.
Setting the Target Configuration Explicitly
The client application modifies the target configuration as needed using the <Delete> and <Set> operations.
Note There are not separate "Create" and "Modify" operations, because a <Set> operation for an item can result in the creation of the item if it does not already exist in the configuration, and a modification of the item if it does already exist.
The client application can optionally use CLI commands encoded within XML tags to modify the target configuration.
If the operation to modify the target configuration is successful, the response contains only the <Delete/> or <Set/> tag. If the operation fails, the response includes the element or object hierarchy passed in the request along with one or more ErrorCode and ErrorMsg attributes indicating the cause of the failure.
A syntax check is performed whenever the client application writes to the target configuration. A successful write to the target configuration, however, does not guarantee that the configuration change can succeed when a subsequent commit of the target configuration is attempted. For example, errors resulting from failed verifications may be returned from the commit.
The following example shows how to use a <Set> request to set the default metric and routing timers and disable neighbor change logging for a particular BGP autonomous system. This request corresponds to the following CLI commands:
RP/0/RP0/CPU0:router# configure
RP/0/RP0/CPU0:router(config)# router bgp 3
RP/0/RP0/CPU0:router(config-bgp)# default-metric 10
RP/0/RP0/CPU0:router(config-bgp)# timers bgp 60 180
RP/0/RP0/CPU0:router(config-bgp)# exit
Sample XML Client Request to Set Timers and Disable Neighbor Change Logging for a BGP Configuration
<?xml version="1.0" encoding="UTF-8"?>
<Request MajorVersion="1" MinorVersion="0">
<Set>
<Configuration>
<BGP>
<AS>
<Naming>
<AS>3</AS>
</Naming>
<FourByteAS>
<Naming>
<AS>3</AS>
</Naming>
<DefaultVRF>
<Global>
<DefaultMetric>10</DefaultMetric>
<GlobalTimers>
<Keepalive>60</Keepalive>
<HoldTime>180</HoldTime>
</GlobalTimers>
</Global>
</DefaultVRF>
</FourByteAS>
</AS>
</BGP>
</Configuration>
</Set>
</Request>
Sample XML Response from the Router
<?xml version="1.0" encoding="UTF-8"?>
<Response MajorVersion="1" MinorVersion="0">
<Set>
<Configuration/>
</Set>
<ResultSummary ErrorCount="0"/>
</Response>
To replace a portion of the configuration, the client application should use a <Delete> operation to remove the unwanted configuration followed by a <Set> operation to add the new configuration. An explicit "replace" option is not supported.
For more information on replacing the configuration, see the "Replacing the Current Running Configuration" section.
Saving the Target Configuration
The client application uses the <Save> operation along with the <File> tag to save the contents of the target configuration to a binary file on the router.
Use the <File> tag to name the file to which the configuration is to be saved. You must specify the complete path of the file to be saved when you use the <File> tag. If the file already exists on the router, then an error is returned unless the optional Boolean attribute Overwrite is included on the <File> tag with a value of "true".
Note No mechanism is provided by the XML interface for "browsing" through the file directory structure.
If the save operation is successful, the response contains both the <Save> and <File> tags. If the save operation fails, the response can also contain the ErrorCode and ErrorMsg attributes that indicate the cause of the save failure.
The following example shows a request to save the contents of the target configuration to the file named my_bgp.cfg on the router:
Sample XML Client Request to Save the Target Configuration to a File
<?xml version="1.0" encoding="UTF-8"?>
<Request MajorVersion="1" MinorVersion="0">
<Save>
<File Overwrite="true">disk0:/my_bgp.cfg</File>
</Save>
</Request>
Sample XML Response from the Router
<?xml version="1.0" encoding="UTF-8"?>
<Response MajorVersion="1" MinorVersion="0">
<Save>
<File Overwrite="true">disk0:/my_bgp.cfg</File>
</Save>
<ResultSummary ErrorCount="0"/>
</Response>
Committing the Target Configuration
In order for the configuration in the target area to become part of the running configuration, the target configuration must be explicitly committed by the client application using the <Commit> operation.
Commit Operation
Table 2-2 describes the six optional attributes that are specified with the <Commit> operation.
If the commit operation is successful, the response contains only the <Commit/> tag along with a unique CommitID and any other attributes specified in the request. If the commit operation fails, the failed configuration is returned in the response.
The following example shows a request to commit the target configuration using the Atomic option. The request corresponds to the commit label BGPUpdate1 comment BGP config update CLI command.
Sample XML Client Request to Commit the Target Configuration Using the Atomic Option
<?xml version="1.0" encoding="UTF-8"?>
<Request MajorVersion="1" MinorVersion="0">
<Commit Mode="Atomic" Label="BGPUpdate1" Comment="BGP config update"/>
</Request>
Sample XML Response from the Router
<?xml version="1.0" encoding="UTF-8"?>
<Response MajorVersion="1" MinorVersion="0">
<Commit Mode="Atomic" Label="BGPUpdate1"
Comment="BGP config update"
CommitID="1000000075"/>
<ResultSummary ErrorCount="0"/>
</Response>
The following example shows a request to commit for a 50-second period. The request corresponds to the commit confirmed 50 CLI command.
Sample XML Client Request to Commit for a 50-second Period
<?xml version="1.0" encoding="UTF-8"?>
<Request MajorVersion="1" MinorVersion="0">
<Commit Confirmed="50"/>
</Request>
Sample XML Response from the Router
<?xml version="1.0" encoding="UTF-8"?>
<Response MajorVersion="1" MinorVersion="0">
<Commit Confirmed="50"
CommitID="1000000075"/>
<ResultSummary ErrorCount="0"/>
</Response>
The following points should be noted with regard to committing the target configuration:
•After each successful commit operation, a commit record is created in the router commit database. The router maintains up to 100 entries in the commit database corresponding to the last 100 commits. Each commit is assigned a unique identifier, for example, "1000000075," which is saved with the commit information in the database. The commit identifier is used in subsequent operations such as <Get> commit changes or <Rollback> to a previous commit identifier (along with the <CommitID> tag).
•Configuration changes in the target configuration are merged with the running configuration when committed. If a client application is to perform a replace of the configuration, the client must first remove the unwanted configuration using a <Delete> operation and then add the new configuration using a <Set> operation. An explicit replace option is not supported. For more information on replacing the configuration, see the "Replacing the Current Running Configuration" section.
•Applying the configuration for a trial period ("try-and-apply") is not supported for this release.
•If the client application never commits, the target configuration is automatically destroyed when the client session is terminated. No other timeouts are supported.
•To confirm the commit with the Confirmed attribute, the user has to send an explicit <Commit/> without the Confirmed attribute or send a <Commit/> without the "Confirmed" attribute along with any other configurations.
Commit Errors
If any configuration entered into the target configuration fails to makes its way to the running configuration as the result of a <Commit> operation (for example, the configuration contains a semantic error and is therefore rejected by a back-end application's verifier function), all of the failed configuration is returned in the <Commit> response along with the appropriate ErrorCode and ErrrorMsg attributes indicating the cause of each failure.
The OperationType attribute is used to indicate whether the failure was a result of a requested <Set> or <Delete> operation. In the case of a <Set> operation failure, the value to be set is included in the commit response.
The following example shows <Set> and <Delete> operations to modify the BGP configuration followed by a <Commit> request resulting in failures for both requested operations. This request corresponds to the following CLI commands:
RP/0/RP0/CPU0:router# configure
RP/0/RP0/CPU0:router(config)# router bgp 4
RP/0/RP0/CPU0:router(config-bgp)# default-metric 10
RP/0/RP0/CPU0:router(config-bgp)# exit
RP/0/RP0/CPU0:router(config)# commit best-effort
Sample XML Client Request to Modify the Target Configuration
<?xml version="1.0" encoding="UTF-8"?>
<Request MajorVersion="1" MinorVersion="0">
<Set>
<Configuration>
<BGP>
<AS>
<Naming>
<AS>0</AS>
</Naming>
<FourByteAS>
<Naming>
<AS>4</AS>
</Naming>
<DefaultVRF>
<Global>
<DefaultMetric>10</DefaultMetric>
</Global>
</DefaultVRF>
</FourByteAS>
</AS>
</BGP>
</Configuration>
</Set>
</Request>
Sample XML Response from the Router
<?xml version="1.0" encoding="UTF-8"?>
<Response MajorVersion="1" MinorVersion="0">
<Set>
<Configuration/>
</Set>
<ResultSummary ErrorCount="0"/>
</Response>
Sample Request to Commit the Target Configuration
<?xml version="1.0" encoding="UTF-8"?>
<Request MajorVersion="1" MinorVersion="0">
<Commit Mode="BestEffort"/>
</Request>
Sample XML Response from the Router Showing Failures for Both Requested Operations
<?xml version="1.0" encoding="UTF-8"?>
<Response MajorVersion="1" MinorVersion="0">
<Commit Mode="BestEffort" ErrorCode="0x40819c00"
ErrorMsg="'sysdb' detected the ' warning' condition 'One or more sub-operations failed during a best effort complex operation'">
<Configuration OperationType="Set">
<BGP MajorVersion="30" MinorVersion="0">
<AS>
<Naming>
<AS>4</AS>
</Naming>
<FourByteAS>
<Naming>
<AS>4</AS>
</Naming>
<DefaultVRF>
<Global>
<DefaultMetric ErrorCode="0x409f8c00" ErrorMsg="AS number is wrong - BGP is already running with AS number 3">
10
</DefaultMetric>
</Global>
</DefaultVRF>
</FourByteAS>
</AS>
</BGP>
</Configuration>
</Commit>
<ResultSummary ErrorCount="1"/>
</Response>
For more information, see the "Loading a Failed Configuration" section.
Loading a Failed Configuration
The client application uses the <Load> operation along with the <FailedConfig> tag to populate the target configuration with the failed configuration from the most recent <Commit> operation. Loading the failed configuration in this way is equivalent to specifying a "true" value for the KeepFailedConfig attribute in the <Commit> operation.
If the load is successful, the response contains both the <Load> and <FailedConfig> tags. If the load fails, the response can also contain the ErrorCode and ErrorMsg attributes that indicate the cause of the load failure.
The following example shows a request to load and display the failed configuration from the last <Commit> operation. This request corresponds to the show configuration failed CLI command.
Sample XML Client Request to Load the Failed Configuration from the Last <Commit> Operation
<?xml version="1.0" encoding="UTF-8"?>
<Request MajorVersion="1" MinorVersion="0">
<Load>
<FailedConfig/>
</Load>
<Get>
<Configuration Source="ChangedConfig"/>
</Get>
</Request>
Sample XML Response from the Router
<?xml version="1.0" encoding="UTF-8"?>
<Response MajorVersion="1" MinorVersion="0">
<Load>
<FailedConfig/>
</Load>
<Get>
<Configuration Source="ChangedConfig" OperationType="Set">
<BGP MajorVersion="30" MinorVersion="0">
<AS>
<Naming>
<AS>0</AS>
</Naming>
<FourByteAS>
<Naming>
<AS>4</AS>
</Naming>
<BGPRunning>
true
</BGPRunning>
<DefaultVRF>
<Global>
<DefaultMetric>
10
</DefaultMetric>
</Global>
</DefaultVRF>
</FourByteAS>
</AS>
</BGP>
</Configuration>
</Get>
<ResultSummary ErrorCount="0"/>
</Response>
Unlocking the Running Configuration
The client application must use the <Unlock> operation to release the exclusive lock on the running configuration for the current session prior to terminating the session.
If the unlock operation is successful, the response contains only the <Unlock/> tag. If the unlock operation fails, the response can also contain the ErrorCode and ErrorMsg attributes that indicate the cause of the unlock failure.
The following example shows a request to unlock the running configuration. This request corresponds to the exit CLI command when it is used after the configuration mode is entered through the configure exclusive CLI command.
Sample XML Client Request to Unlock the Running Configuration
<?xml version="1.0" encoding="UTF-8"?>
<Request MajorVersion="1" MinorVersion="0">
<Unlock/>
</Request>
Sample XML Response from the Router
<?xml version="1.0" encoding="UTF-8"?>
<Response MajorVersion="1" MinorVersion="0">
<Unlock/>
<ResultSummary ErrorCount="0"/>
</Response>
Additional Router Configuration and Management Options Using XML
The following sections describe the optional configuration and router management tasks available to the client application:
•Rolling Back Configuration Changes to a Specified Commit Identifier
•Rolling Back the Trial Configuration Changes Before the Trial Time Expires
•Rolling Back Configuration Changes to a Specified Number of Commits
•Getting Configuration History
•Getting Configuration Commit List
•Getting Configuration Session Information
•Replacing the Current Running Configuration
•Clear Configuration Inconsistency Alarm
Getting Commit Changes
When a client application successfully commits the target configuration to the running configuration, the configuration manager writes a single configuration change event to the system message logging (syslog). As a result, an event notification is written to the Alarm Channel and subsequently forwarded to any registered configuration agents.
Table 2-3 describes the event notification.
|
|
---|---|
userid |
Name of the user who performed the commit operation. |
timestamp |
Date and time of the commit. |
commit |
Unique ID associated with the commit. |
The following example shows a configuration change notification:
RP/0/1/CPU0:Jul 25 18:23:21.810 : config[65725]: %MGBL-CONFIG-6-DB_COMMIT :
Configuration committed by user 'lab'. Use 'show configuration commit changes
1000000001' to view the changes
Upon receiving the configuration change notification, a client application can then use the <Get> operation to load and browse the changed configuration.
The client application can read a set of commit changes using the <Get> operation along with the <Configuration> request type tag when it includes the Source attribute option CommitChanges. One of the additional attributes, either ForCommitID or SinceCommitID, must also be used to specify the commit identifier or commit label for which the commit changes should be retrieved.
The following example shows the use of the ForCommitID attribute to show the commit changes for a specific commit. This request corresponds to the show configuration commit changes 1000000075 CLI command.
Sample XML Request to Show Specified Commit Changes Using the ForCommitID Attribute
<?xml version="1.0" encoding="UTF-8"?>
<Request MajorVersion="1" MinorVersion="0">
<Get>
<Configuration Source="CommitChanges" ForCommitID="1000000075"/>
</Get>
</Request>
Sample XML Response from the Router
<?xml version="1.0" encoding="UTF-8"?>
<Response MajorVersion="1" MinorVersion="0">
<Get>
<Configuration Source="CommitChanges" ForCommitID="1000000075"
OperationType="....>
.
.
changed config returned here
.
.
.
</Configuration>
</Get>
<ResultSummary ErrorCount="0"/>
</Response>
The following example shows the use of the SinceCommitID attribute to show the commit changes made since a specific commit. This request corresponds to the show configuration commit changes since 1000000072 CLI command.
Sample XML Request to Show Specified Commit Changes Using the SinceCommitID Attribute
<?xml version="1.0" encoding="UTF-8"?>
<Request MajorVersion="1" MinorVersion="0">
<Get>
<Configuration Source="CommitChanges" SinceCommitID="1000000072"/>
</Get>
</Request>
Sample XML Response from the Router
<?xml version="1.0" encoding="UTF-8"?>
<Response MajorVersion="1" MinorVersion="0">
<Get>
<Configuration Source="CommitChanges" SinceCommitID="1000000072">
OperationType="....>
.
.
changed config returned here
.
.
.
</Configuration>
</Get>
<ResultSummary ErrorCount="0"/>
</Response>
Loading Commit Changes
The client application can load a set of commit changes into the target configuration buffer using the Load operation and CommitChanges tag along with one of the additional tags ForCommitID, SinceCommitID, or Previous. After the completion of the Load operation, the client application can then modify and commit the commit changes like any other config.
If the load succeeds, the response contains both the Load and CommitChanges tags. If the load fails, the response also contains the ErrorCode and ErrorMsg attributes indicating the cause of the load failure.
The following example shows the use of the Load operation and CommitChanges tag along with the ForCommitID tag to load the commit changes for a specific commit into the target configuration buffer. This request corresponds to the load commit changes 1000000072 CLI command.
Sample XML Request to Load Commit Changes with the ForCommitID tag
<?xml version="1.0" encoding="UTF-8"?>
<Request MajorVersion="1" MinorVersion="0">
<Load>
<CommitChanges>
<ForCommitID>1000000072</ForCommitID>
</CommitChanges>
</Load>
</Request>
Sample XML Response from the Router
<?xml version="1.0" encoding="UTF-8"?>
<Response MajorVersion="1" MinorVersion="0">
<Load>
<CommitChanges>
<ForCommitID>1000000072</ForCommitID>
</CommitChanges>
</Load>
<ResultSummary ErrorCount="0"/>
</Response>
The following example shows the use of the Load operation and CommitChanges tag along with the SinceCommitID tag to load the commit changes since (and including) a specific commit into the target configuration buffer. This request corresponds to the load commit changes since 1000000072 CLI command.
Sample XML Request to Load Commit Changes with the SinceCommitID tag
<?xml version="1.0" encoding="UTF-8"?>
<Request MajorVersion="1" MinorVersion="0">
<Load>
<CommitChanges>
<SinceCommitID>1000000072</SinceCommitID>
</CommitChanges>
</Load>
</Request>
Sample XML Response from the Router
<?xml version="1.0" encoding="UTF-8"?>
<Response MajorVersion="1" MinorVersion="0">
<Load>
<CommitChanges>
<SinceCommitID>1000000072</SinceCommitID>
</CommitChanges>
</Load>
<ResultSummary ErrorCount="0"/>
</Response>
The following example shows the use of the Load operation and CommitChanges tag along with the Previous tag to load the commit changes for the most recent four commits into the target configuration buffer. This request corresponds to the load commit changes last 4 CLI command.
Sample XML Request to Load Commit Changes with the Previous tag
<?xml version="1.0" encoding="UTF-8"?>
<Request MajorVersion="1" MinorVersion="0">
<Load>
<CommitChanges>
<Previous>4</Previous>
</CommitChanges>
</Load>
</Request>
Sample XML Response from the Router
<?xml version="1.0" encoding="UTF-8"?>
<Response MajorVersion="1" MinorVersion="0">
<Load>
<CommitChanges/>
<Previous>4</Previous>
</CommitChanges>
</Load>
<ResultSummary ErrorCount="0"/>
</Response>
Clearing a Target Session
Prior to committing the target configuration to the active running configuration, the client application can use the <Clear> operation to clear the target configuration session. This operation has the effect of clearing the contents of the target configuration, thus removing any changes made to the target configuration since the last commit. The clear operation does not end the target configuration session, but results in the discarding of any uncommitted changes from the target configuration.
If the clear operation is successful, the response contains just the <Clear/> tag. If the clear operation fails, the response can also contain the ErrorCode and ErrorMsg attributes that indicate the cause of the clear failure.
The following example shows a request to clear the current target configuration session. This request corresponds to the clear CLI command.
Sample XML Request to Clear the Current Target Configuration Session
<?xml version="1.0" encoding="UTF-8"?>
<Request MajorVersion="1" MinorVersion="0">
<Clear/>
</Request>
Sample XML Response from a Router
<?xml version="1.0" encoding="UTF-8"?>
<Response MajorVersion="1" MinorVersion="0">
<Clear/>
<ResultSummary ErrorCount="0"/>
</Response>
Rolling Back Configuration Changes to a Specified Commit Identifier
The client application uses the <Rollback> operation with the <CommitID> tag to roll back the configuration changes made since (and including) the commit by specifying a commit identifier or commit label.
If the roll back operation is successful, the response contains both the <Rollback> and <CommitID> tags. If the roll back operation fails, the response can also contain the ErrorCode and ErrorMsg attributes that indicate the cause of the roll back failure.
Table 2-4 describes the optional attributes that are specified with the <Rollback> operation by the client application when rolling back to a commit identifier.
The following example shows a request to roll back the configuration changes to a specified commit identifier. This request corresponds to the rollback configuration to 1000000072 CLI command.
Sample XML Request to Roll Back the Configuration Changes to a Specified Commit Identifier
<?xml version="1.0" encoding="UTF-8"?>
<Request MajorVersion="1" MinorVersion="0">
<Rollback Label="BGPRollback1" Comment="My BGP rollback">
<CommitID>1000000072</CommitID>
</Rollback>
</Request>
Sample XML Response from the Router
<?xml version="1.0" encoding="UTF-8"?>
<Response MajorVersion="1" MinorVersion="0">
<Rollback Label="BGPRollback1" Comment="My BGP rollback">
<CommitID>1000000072</CommitID>
</Rollback>
<ResultSummary ErrorCount="0"/>
</Response>
Note The commit identifier can also be obtained by using the <GetConfigurationHistory> operation described in the section "Getting Configuration History" section.
Rolling Back the Trial Configuration Changes Before the Trial Time Expires
When the user sends a commit request with the Confirmed attribute, a trial configuration session is created. If the user then sends a confirmed commit, the trial configuration changes are committed. If the user wants to roll back the trial configuration changes before the time expires, the user can use the <Rollback> operation.
Note No optional attributes can be used when <Trial Configuration> is specified.
The following example shows a request to roll back the trial configuration changes:
Sample XML Request to Roll Back the Trial Configuration Before the Trial Time Expires
<?xml version="1.0" encoding="UTF-8"?>
<Request MajorVersion="1" MinorVersion="0">
<Rollback>
<TrialConfiguration/>
</Rollback>
</Request>
Sample XML Response from the Router
<?xml version="1.0" encoding="UTF-8"?>
<Response MajorVersion="1" MinorVersion="0">
<Rollback>
<TrialConfiguration/>
</Rollback>
<ResultSummary ErrorCount="0"/>
</Response>
Rolling Back Configuration Changes to a Specified Number of Commits
The client application uses the <Rollback> operation with the <Previous> tag to roll back the configuration changes made during the most recent [x] commits, where [x] is a number ranging from 0 to the number of saved commits in the commit database. If the <Previous> value is specified as "0", nothing is rolled back. The target configuration must be unlocked at the time the <Rollback> operation is requested.
If the roll back operation is successful, the response contains both the <Rollback> and <Previous> tags. If the roll back operation fails, the response can also contain the ErrorCode and ErrorMsg attributes that indicate the cause of the rollback failure.
Table 2-5 describes the optional attributes that are specified with the <Rollback> operation by the client application when rolling back a specified number of commits.
The example shows a request to roll back the configuration changes made during the previous three commits. This request corresponds to the rollback configuration last 3 CLI command.
Sample XML Request to Roll Back Configuration Changes to a Specified Number of Commits
<?xml version="1.0" encoding="UTF-8"?>
<Request MajorVersion="1" MinorVersion="0">
<Rollback>
<Previous>3</Previous>
</Rollback>
</Request>
Sample XML Response from the Router
<?xml version="1.0" encoding="UTF-8"?>
<Response MajorVersion="1" MinorVersion="0">
<Rollback>
<Previous>3</Previous>
</Rollback>
<ResultSummary ErrorCount="0"/>
</Response>
Getting Rollback Changes
The client application can read a set of rollback changes using the <Get> operation along with the <Configuration> request type tag when it includes both the Source attribute option RollbackChanges and one of the additional attributes ToCommitID or PreviousCommits.
The set of roll back changes are the changes that are applied when the <Rollback> operation is performed using the same parameters. It is recommended that the client application read or verify the set of roll back changes before performing the roll back.
The following example shows the use of the ToCommitID attribute to get the rollback changes for rolling back to a specific commit. This request corresponds to the show configuration rollback-changes to 1000000072 CLI command.
Sample XML Client Request to Get Rollback Changes Using the ToCommitID Attribute
<?xml version="1.0" encoding="UTF-8"?>
<Request MajorVersion="1" MinorVersion="0">
<Get>
<Configuration Source="RollbackChanges" ToCommitID="1000000072"/>
</Get>
</Request>
Sample XML Response from the Router
<?xml version="1.0" encoding="UTF-8"?>
<Response MajorVersion="1" MinorVersion="0">
<Get>
<Configuration Source="RollbackChanges" ToCommitID="1000000072">
OperationType="....>
.
.
rollback changes returned here
.
.
.
</Configuration>
</Get>
<ResultSummary ErrorCount="0"/>
</Response>
The following example shows the use of the PreviousCommits attribute to get the roll back changes for rolling back a specified number of commits. This request corresponds to the show configuration rollback-changes last 4 CLI command.
Sample XML Client Request to Get Roll Back Changes Using the PreviousCommits Attribute
<?xml version="1.0" encoding="UTF-8"?>
<Request MajorVersion="1" MinorVersion="0">
<Get>
<Configuration Source="RollbackChanges" PreviousCommits="4"/>
</Get>
</Request>
Sample XML Response from the Router
<?xml version="1.0" encoding="UTF-8"?>
<Response MajorVersion="1" MinorVersion="0">
<Get>
<Configuration Source="RollbackChanges" PreviousCommits="4">
OperationType="....>
.
.
rollback changes returned here
.
.
.
</Configuration>
</Get>
< ResultSummary ErrorCount="0"/>
</Response>
Loading Rollback Changes
The client application can load a set of rollback changes into the target configuration buffer using the Load operation and RollbackChanges tag along with one of the additional tags ForCommitID, ToCommidID, or Previous. After the completion of the Load operation, the client application can then modify and commit the rollback changes like any other configuration.
If the load succeeds, the response contains both the Load and RollbackChanges tags. If the load fails, the response also contains the ErrorCode and ErrorMsg attributes indicating the cause of the load failure.
The following example shows the use of the Load operation and RollbackChanges tag along with the ForCommitID tag to load the rollback changes for a specific commit into the target configuration buffer. This request corresponds to the load rollback changes 1000000072 CLI command.
Sample XML Client to Load Rollback Changes with the ForCommitID tag
<?xml version="1.0" encoding="UTF-8"?>
<Request MajorVersion="1" MinorVersion="0">
<Load>
<RollbackChanges>
<ForCommitID>1000000072</ForCommitID>
</RollbackChanges>
</Load>
</Request>
Sample XML Response from the Router
<?xml version="1.0" encoding="UTF-8"?>
<Response MajorVersion="1" MinorVersion="0">
<Load>
<RollbackChanges/
<ForCommitID>1000000072</ForCommitID>
</RollbackChanges>
</Load>
<ResultSummary ErrorCount="0"/>
</Response>
The following example shows the use of the Load operation and RollbackChanges tag along with the ToCommitID tag to load the rollback changes up to (and including) a specific commit into the target configuration buffer. This request corresponds to the load rollback changes to 1000000072 CLI command.
Sample XML Client to Load Rollback Changes with the ToCommitID tag
<?xml version="1.0" encoding="UTF-8"?>
<Request MajorVersion="1" MinorVersion="0">
<Load>
<RollbackChanges>
<ToCommitID>1000000072</ToCommitID>
</RollbackChanges>
</Load>
</Request>
Sample XML Response from the Router
<?xml version="1.0" encoding="UTF-8"?>
<Response MajorVersion="1" MinorVersion="0">
<Load>
<RollbackChanges>
<ToCommitID>1000000072</ToCommitID>
</RollbackChanges>
</Load>
<ResultSummary ErrorCount="0"/>
</Response>
The following example shows the use of the Load operation and RollbackChanges tag along with the Previous tag to load the rollback changes for the most recent four commits into the target configuration buffer. This request corresponds to the load rollback changes last 4 CLI command.
Sample XML Client to Load Rollback Changes with the Previous tag
<?xml version="1.0" encoding="UTF-8"?>
<Request MajorVersion="1" MinorVersion="0">
<Load>
<RollbackChanges>
<Previous>4</Previous>
</RollbackChanges>
</Load>
</Request>
Sample XML Response from the Router
<?xml version="1.0" encoding="UTF-8"?>
<Response MajorVersion="1" MinorVersion="0">
<Load>
<RollbackChanges>
<Previous>4</Previous>
</RollbackChanges>
</Load>
<ResultSummary ErrorCount="0"/>
</Response>
Getting Configuration History
The client application uses the <GetConfigurationHistory> operation to get information regarding the following configuration events:
•Commit
•Online insertion and removal (OIR) events, also known as remove and replace
•Router shutdown synchronization
•cfs check rebuild of persistent configuration from running configuration
•Startup apply of admin and SDR configuration, noting alternate configuration fallback specification
•Configuration inconsistency including failed configuration or other similar reasons
Table 2-6 describes the optional attributes available with the <GetConfigurationHistory> operation.
The <GetConfigurationHistory> operation corresponds to the show configuration history CLI command.
The following example shows a request to list the information associated with the previous three commits. This request corresponds to the show configuration commit history first 6 detail CLI command.
Sample XML Request to List Configuration History Information for the Previous Three Commits
<?xml version="1.0" encoding="UTF-8"?>
<Request MajorVersion="1" MinorVersion="0">
<GetConfigurationHistory EventType="All" Detail="true" Maximum="6"/>
</Request>
Sample XML Response from the Router
<?xml version="1.0" encoding="UTF-8"?>
<Response MajorVersion="1" MinorVersion="0">
<GetConfigurationHistory EventType="All" Detail="true" Maximum="6">
<EventEntry>
<Naming>
<EventName>
CFS-Check
</EventName>
</Naming>
<Timestamp>
1300262221
</Timestamp>
<Detail>
<UserID>
lab
</UserID>
<Line>
vty2
</Line>
</Detail>
</Event Entry>
<Event Entry>
<Naming>
<EventName>
Commit
</EventName>
</Naming>
<Timestamp>
1300262224
</Timestamp>
<Detail>
<CommitID>
1000000627
</CommitID>
<UserID>
lab
</UserID>
<Line>
vty2
</Line>
<ClientName>
CLI
</ClientName>
</Detail>
</Event Entry>
<Event Entry>
<Naming>
<EventName>
Commit
</EventName>
</Naming>
<Timestamp>
1300262231
</Timestamp>
<Detail>
<CommitID>
1000000628
</CommitID>
<UserID>
lab
</UserID>
<Line>
vty0
</Line>
<Client>CLI
</Client>
</Detail>
</EventEntry>
<EventEntry>
<Naming>
<EventName>
Commit
</EventName>
</Naming>
<Timestamp>
1300262239
</Timestamp>
<Detail>
<CommitID>
1000000629
</CommitID>
<UserID>
lab
</UserID>
<Line>
vty0
</Line>
<ClientName>
CLI
</ClientName>
</Detail>
</EventEntry>
<EventEntry>
<Naming>
<EventName>
Commit
</EventName>
</Naming>
<Timestamp>
1300262246
</Timestamp>
<Detail>
<CommitID>
1000000630
</CommitID>
<UserID>
lab
</UserID>
<Line>
vty0
</Line>
<ClientName>
CLI
</ClientName>
</Detail>
</EventEntry>
<EventEntry>
<Naming>
<EventName>
Commit
</EventName>
<Naming>
<Timestamp>
1300262255
</Timestamp>
<Detail>
<CommitID>
1000000631
</CommitID>
<UserID>
lab
</UserID>
<Line>
vty0
</Line>
<ClientName>
CLI
</ClientName>
</Detail>
</EventEntry>
</GetConfigurationHistory>
<ResultSummary ErrorCount="0"/>
</Response>
Getting Configuration Commit List
The client application can use the <GetConfigurationCommitList> operation to get information regarding the most recent commits to the running configuration.
Table 2-7 describes the information that is returned for each configuration commit session.
The <GetConfigurationCommitList> operation corresponds to the show configuration commit list CLI command.
The following example shows a request to list the information associated with the previous two commits. This request corresponds to the show configuration commit list 2 CLI command.
Sample XML Request to List Configuration History Information for the Previous Three Commits
<?xml version="1.0" encoding="UTF-8"?>
<Request MajorVersion="1" MinorVersion="0">
<GetConfigurationCommitList Maximum="2"/>
</Request>
Sample XML Response from the Router
<?xml version="1.0" encoding="UTF-8"?>
<Response MajorVersion="1" MinorVersion="0">
<GetConfigurationHistory Maximum="2">
<CommitEntry>
<Naming>
<CommitID>
1000000462
</CommitID>
</Naming>
<UserID>
lab
</UserID>
<Line>
/dev/vty0:node0_0_CPU0
</Line>
<ClientName>Rollback
</Client>
<Timestamp>
1303319582
</Timestamp>
</CommitEntry>
<CommitENtry>
<Naming>
<CommitID>
1000000461
</CommitID>
</Naming>
<User>
lab
</User>
<Line>
/dev/vty0:node0_0_CPU0
</Line>
<ClientName>
XML TTY Agent
</Client>
<Timestamp>
1303318704
</Timestamp>
</CommitEntry>
</GetConfigurationCommitList>
<ResultSummary ErrorCount="0"/>
</Response><
Getting Configuration Session Information
The client application uses the <GetConfigurationSessions> operation to get the list of all users configuring the router. In the case where the configuration is locked, the list identifies the user holding the lock.
Table 2-8 describes the information that is returned for each configuration session.
The Detail attribute can be specified with <GetConfigurationSessions>:
Accepts either true or false. False is the default value. Specifies whether the detailed information is required or not.
Table 2-9 describes the additional information that is returned when the Detail attribute is used.
The following example shows a request to get the list of users currently configuring the router. This request corresponds to the show configuration sessions detail CLI command.
Sample XML Request to Get List of Users Configuring the Router
<?xml version="1.0" encoding="UTF-8"?>
<Request MajorVersion="1" MinorVersion="0">
<GetConfigurationSessions Detail="true"/>
</Request>
Sample XML Response from the Router
<?xml version="1.0" encoding="UTF-8"?>
<Response MajorVersion="1" MinorVersion="0">
<GetConfigurationSessions Detail="true">
<Session>
<Naming>
<SessionID>
00000000-0005f109-00000000
</SessionID>
</Naming>
<UserID>
lab
</UserID>
<Line>
con0_0_CPU0
</Line>
<Since>
1303317929
</Since>
<LockHeld>
false
</LockHeld>
<TrialSession>
false
</TrialSession>
<Detail>
<ClientName>
CLI
</ClientName>
<ProcessID>
389385
</ProcessID>
<Process>
config
</Process>
<Node>
<Rack>
0
</Rack>
<Slot>
0
</Slot>
<Instance>
CPU0
</Instance>
</Node>
<ElapsedTime>
2183
</ElapsedTime>
</Detail>
</Session>
</GetConfigurationSessions>
<ResultSummary ErrorCount="0"/>
</Response>
Clear Configuration Session
The client application can use the <ClearConfigurationSession> operation to clear a particular configuration session. The SessionID attribute specifies the session to be cleared.
The following example shows a request to clear a configuration session. This request corresponds to the clear configuration sessions 00000000-000a00c9-00000000 CLI command.
Sample XML Request to Get List of Users Configuring the Router
<?xml version="1.0" encoding="UTF-8"?>
<Request MajorVersion="1" MinorVersion="0">
<ClearConfigurationSession SessionID="00000000-000a00c9-00000000"/>
</Request>
Sample XML Response from the Router
<?xml version="1.0" encoding="UTF-8"?>
<Response MajorVersion="1" MinorVersion="0">
<ClearConfigurationSession SessionID="00000000-000a00c9-00000000"/>
<ResultSummary ErrorCount="0"/>
</Response>
Replacing the Current Running Configuration
A client application replaces the current running configuration on the router with a users configuration file by performing the following operations in sequence:
1. Lock the configuration.
2. Load the desired off-the-box configuration into the target configuration using one or more <Set> operations (assuming that the entire desired configuration is available in XML format, perhaps from a previous <Get> of the entire configuration). As an alternative, use an appropriate copy command enclosed within <CLI> tags.
3. Commit the target configuration specifying the Replace attribute with a value of true.
The following example illustrates these steps:
Sample XML Request to Lock the Current Running Configuration
<?xml version="1.0" encoding="UTF-8"?>
<Request MajorVersion="1" MinorVersion="0">
<Lock/>
</Request>
Sample XML Response from the Router
<?xml version="1.0" encoding="UTF-8"?>
<Response MajorVersion="1" MinorVersion="0">
<Lock/>
<ResultSummary ErrorCount="0"/>
</Response>
Sample XML Request to Set the Current Running Configuration
<?xml version="1.0" encoding="UTF-8"?>
<Request MajorVersion="1" MinorVersion="0">
<Set>
<Configuration>
.
.
.
configuration data goes here
.
.
.
</Configuration>
</Set>
</Request>
Sample XML Response from the Router
<?xml version="1.0" encoding="UTF-8"?>
<Response MajorVersion="1" MinorVersion="0">
<Set>
<Configuration/>
</Set>
<ResultSummary ErrorCount="0"/>
</Response>
Sample XML Request to Commit the Target Configuration
<?xml version="1.0" encoding="UTF-8"?>
<Request MajorVersion="1" MinorVersion="0">
<Commit Replace="true"/>
</Request>
Sample XML Response from the Router
<?xml version="1.0" encoding="UTF-8"?>
<Response MajorVersion="1" MinorVersion="0">
<Commit CommitID="1000000075"/>
<ResultSummary ErrorCount="0"/>
</Response>
Clear Configuration Inconsistency Alarm
The client application uses the <ClearConfigurationInconsistency> operation to clear a bi-state configuration inconsistency alarm.
If the clear operation is successful, the response contains only the <ClearConfigurationInconsistency/> tag. If the clear operation fails, the response also contains the ErrorCode and ErrorMsg attributes, indicating the cause of the clear failure.
The following example shows a request to clear the configuration inconsistency alarm in user mode. This request corresponds to the clear configuration inconsistency CLI command.
Sample XML Request to Clear the Configuration Inconsistency Alarm
<?xml version="1.0" encoding="UTF-8"?>
<Request MajorVersion="1" MinorVersion="0">
<ClearConfigurationInconsistency/>
</Request>
Sample XML Response from the Router
<?xml version="1.0" encoding="UTF-8"?>
<Response MajorVersion="1" MinorVersion="0">
<ClearConfigurationInconsistency/>
<ResultSummary ErrorCount="0"/>
</Response>