Cisco Enhanced Device Interface Programmer's Guide 2.2.1
CLI Mode

Table Of Contents

CLI Mode

Sending Edit Configuration Commands in cli Format

Sending Edit Configuration Commands in cli-block Mode

Sending EXEC Commands in cli-block Mode

Getting a Configuration Using Filters in cli Format


CLI Mode


This chapter describes the Command Line Interface (CLI) mode provided by Cisco E-DI XML PI.

Cisco E-DI allows the user to send CLI commands as text enclosed in XML tags. The response to the CLI commands will be the output from the network element in text format enclosed in the appropriate XML tags.

Cisco E-DI supports two ways of sending CLI commands:

As content of the element config-format-text-cmd. This is cli format.

As content of the element config-format-text-block. This is cli-block format.

This chapter includes the following details:

Sending Edit Configuration Commands in cli Format

Sending Edit Configuration Commands in cli-block Mode

Sending EXEC Commands in cli-block Mode

Getting a Configuration Using Filters in cli Format

Sending Edit Configuration Commands in cli Format

The following example details how to send edit configuration commands in cli format

Request:

<rpc message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" 
xmlns:cpi="http://www.cisco.com/cpi_10/schema">
<edit-config>
<target>
    <candidate/>
</target>
<default-operation>merge</default-operation>
<test-option>test-then-set</test-option>
<error-option>ignore-error</error-option>
<config>
    <cpi:cli-config-data>
        <cpi:cmd>no username testcliedit</cpi:cmd>
    </cpi:cli-config-data>
</config>
</edit-config>
</rpc>

Response:

<rpc-reply message-id="101" xmlns:cpi="http://www.cisco.com/cpi_10/schema" 
xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<ok/>
</rpc-reply> 

Sending Edit Configuration Commands in cli-block Mode

The following example details sending edit configuration commands in cli-block format.

Request:

<rpc message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" 
xmlns:cpi="http://www.cisco.com/cpi_10/schema">
<edit-config>
<target>
    <candidate/>
</target>
<default-operation>merge</default-operation>
<test-option>test-then-set</test-option>
<error-option>ignore-error</error-option>
<config>
    <cpi:cli-config-data-block>username testcliedit1         username 
testcliedit2</cpi:cli-config-data-block>
</config>
</edit-config>
</rpc>

Response:

<rpc-reply message-id="101" xmlns:cpi="http://www.cisco.com/cpi_10/schema" 
xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">   
<ok/>
</rpc-reply> 

Sending EXEC Commands in cli-block Mode

The following example details sending EXEC commands in cli-block mode.


Note The validate-syntax attribute is not supported.


Request:

<rpc message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" 
xmlns:cpi="http://www.cisco.com/cpi_10/schema">
<get>
<filter>
    <cpi:config-format-text-block>
        <text-filter-spec>| include interface</text-filter-spec>
    </cpi:config-format-text-block>
    <cpi:oper-data-format-text-block>
        <show>interfaces</show>
        <show>arp</show>
    </cpi:oper-data-format-text-block>
</filter>
</get>
</rpc>

Response:

<rpc-reply message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" 
xmlns:cpi="http://www.cisco.com/cpi_10/schema">
<data>
<cpi:cli-config-data-block xmlns:cpi="http://www.cisco.com/cpi_10/schema">
    interface Loopback0
    interface Loopback5
    interface Virtual-TokenRing1
    interface Virtual-TokenRing1.1
</cpi:cli-config-data-block>
<cli-oper-data-block>
    <item>
        <show>interfaces</show>
        <response>
            Dialer1 is up (spoofing), line protocol is up (spoofing)
            MTU 1500 bytes, BW 1000 Kbit, DLY 100000 usec,
            reliability 255/255, txload 1/255, rxload 1/255
            Output queue: 0/0 (size/max)
            Virtual-TokenRing1.1 is up, line protocol is up
           Hardware is Virtual-TokenRing, address is 4000.0000.000c (bia 
            4000.0000.000c)
            MTU 8136 bytes, BW 16000 Kbit, DLY 5000 usec,
            reliability 255/255, txload 1/255, rxload 1/255
            Encapsulation SNAP
            ARP type: SNAP, ARP Timeout 04:00:00
            Last clearing of "show interface" counters never
        </response>
    </item>
    <item>
        <show>arp</show>
        <response>
            Protocol  Address          Age (min)  Hardware Addr   Type   Interface
            Internet  10.76.92.34           119   0009.e831.d8ff  ARPA 
FastEthernet0
            Internet  10.76.92.35            38   0009.e831.d8ff  ARPA   
FastEthernet0
            Internet  172.25.86.5             1   00c0.9f61.7b61  ARPA   
FastEthernet0
            Internet  172.25.86.15          118   0009.434d.0500  ARPA   
FastEthernet0
        </response>
    </item>
</cli-oper-data-block>
</data>
</rpc-reply>

Getting a Configuration Using Filters in cli Format

The following example details getting a configuration using filters in cli format

Request:

<rpc message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" 
xmlns:cpi="http://www.cisco.com/cpi_10/schema">
<get>
<filter>
    <cpi:config-format-text-cmd>
        <text-filter-spec>| include interface</text-filter-spec>
    </cpi:config-format-text-cmd>
    <cpi:oper-data-format-text-block>
        <show>interfaces</show>
        <show>arp</show>
    </cpi:oper-data-format-text-block>
</filter>
</get>
</rpc>

Response:

<rpc-reply message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" 
xmlns:cpi="http://www.cisco.com/cpi_10/schema">
<data>
<cpi:cli-config-data xmlns:cpi="http://www.cisco.com/cpi_10/schema">
    <cpi:cmd>interface Loopback0</cpi:cmd>
    <cpi:cmd>interface Loopback5</cpi:cmd>
    <cpi:cmd>interface Virtual-TokenRing1</cpi:cmd>
    <cpi:cmd>interface Virtual-TokenRing1.1</cpi:cmd>
</cpi:cli-config-data>
<cli-oper-data-block>
    <item>
        <show>interfaces</show>
        <response>
            Dialer1 is up (spoofing), line protocol is up (spoofing)
            Hardware is Unknown
            MTU 1500 bytes, BW 56 Kbit, DLY 20000 usec,
            reliability 255/255, txload 1/255, rxload 1/255
            Encapsulation HDLC, loopback not set
            Last clearing of "show interface" counters never
        </response>
    </item>
    <item>
        <show>arp</show>
        <response>
            Protocol  Address          Age (min)  Hardware Addr   Type   Interface
            Internet  10.76.92.34           134   0009.e831.d8ff  ARPA   
FastEthernet0
            Internet  172.25.86.1             0   0009.e831.d8ff  ARPA   
FastEthernet0
            Internet  172.25.86.5             1   00c0.9f61.7b61  ARPA   
FastEthernet0
            Internet  172.25.86.15          133   0009.434d.0500  ARPA   
FastEthernet0
        </response>
    </item>
</cli-oper-data-block>
</data>
</rpc-reply>