Cisco IOS XR XML API Guide, Release 3.2
Chapter 6 - Cisco XML and Encapsulated CLI Operations
Downloads: This chapterpdf (PDF - 151.0KB) The complete bookPDF (PDF - 2.09MB) | Feedback

Cisco XML and Encapsulated CLI Operations

Table Of Contents

Cisco XML and Encapsulated CLI Operations

XML CLI Command Tags

CLI Command Limitations


Cisco XML and Encapsulated CLI Operations


The extensible markup language (XML) interface for the router provides support for XML encapsulated command-line interface (CLI) commands and responses.

This chapter provides information on XML CLI command tags.

XML CLI Command Tags

A client application can request a CLI command by encoding the text for the command within a pair of <CLI> start and </CLI> end tags, and <Configuration> tags. The router responds with the uninterpreted CLI text result.


Note XML encapsulated CLI commands use the same target configuration as the corresponding XML operations <Get>, <Set>, and <Delete>.


When used for CLI operations, the <Configuration> tag supports the optional Operation attribute, which can take one of the values listed in Table 6-1.

Table 6-1 Operational Attribute Values 

Operational Attribute Value
Operational Attribute Value Description

Apply

Specifies that the commands should be executed or applied (default).

Help

Gets help on the last command in the list of commands sent in the request. There should not be any empty lines after the last command (because the last command is considered to be the one on the last line)

CommandCompletion

Completes the last keyword of the last command. Apart from not allowing empty lines at the end of the list of commands sent in the request, when this option is used there should not be any white spaces after the partial keyword to be completed.


The following example uses the <CLI> operation tag:

Sample XML Client Request for CLI Command Using CLI Tags

<?xml version="1.0" encoding="UTF-8"?>
<Request MajorVersion="1" MinorVersion="0">
  <CLI>
   <Configuration>
     router bgp 3
      default-metric 10
      timers bgp 80 160
     exit
    show config
   </Configuration>
  </CLI>
</Request>

Sample XML Response from the Router

<?xml version="1.0" encoding="UTF-8"?>
<Response MajorVersion="1" MinorVersion="0">
  <CLI>
    <Configuration>
     Building configuration...
     router bgp 3
      default-metric 10
      timers bgp 80 160
     end
    </Configuration>
  </CLI>
</Response>

CLI Command Limitations

The initial CLI command support through XML is limited to CLI configuration and subsequent responses wrapped in <CLI> tags.

The following commands and conditions are not supported:

<Operational> namespace commands.

<Action> namespace commands.

Iterators for responses to <CLI> commands issued through XML. For example, iterators are not supported for the output of the show run and show configuration commands.

Sending a request in <CLI> format and getting back an XML encoded response.

Sending an XML encoded request and getting back a response in <CLI> format.

"Long running" commands, for example, "ping" and "top."

Iterators in responses to CLI commands such as the show run and show configuration commands.

Only one XML <CLI> request can be issued at a time across all client sessions on the router.