Cisco Nexus 7000 Series NX-OS System Management Configuration Guide, Release 6.x
Converting CLI Commands to Network Configuration Format
Downloads: This chapterpdf (PDF - 227.0KB) The complete bookPDF (PDF - 8.94MB) | Feedback

Table Of Contents

Converting CLI Commands to Network Configuration Format

Information About XMLIN

Licensing Requirements for XMLIN

Guidelines and Limitations

Installing and Using the XMLIN Tool

Converting Show Command Output to XML

Configuration Examples for XMLIN

Additional References

Related Documents

Standards

Feature History for XMLIN


Converting CLI Commands to Network Configuration Format


This chapter explains how to install and use the XMLIN tool to convert CLI commands to the Network Configuration (NETCONF) protocol.

This chapter includes the following sections:

Information About XMLIN

Licensing Requirements for XMLIN

Guidelines and Limitations

Installing and Using the XMLIN Tool

Converting Show Command Output to XML

Configuration Examples for XMLIN

Additional References

Feature History for XMLIN

Information About XMLIN

The XMLIN tool converts CLI commands to the Network Configuration (NETCONF) protocol format. NETCONF is a network management protocol that provides mechanisms to install, manipulate, and delete the configuration of network devices. It uses XML-based encoding for configuration data and protocol messages. The NX-OS implementation of the NETCONF protocol supports the following protocol operations: <get>, <edit-config>, <close-session>, <kill-session>, and <exec-command>.

The XMLIN tool converts show, EXEC, and configuration commands to corresponding NETCONF <get>, <exec-command>, and <edit-config> requests. You can enter multiple configuration commands into a single NETCONF <edit-config> instance.

The XMLIN tool also converts the output of show commands to XML format.

Licensing Requirements for XMLIN

The following table shows the licensing requirements for this feature:

Product
License Requirement

Cisco NX-OS

XMLIN requires no license. Any feature not included in a license package is bundled with the Cisco NX-OS system images and is provided at no extra charge to you. For a complete explanation of the Cisco NX-OS licensing scheme, see the Cisco NX-OS Licensing Guide.


Guidelines and Limitations

XMLIN has the following guidelines and limitations:

In NETCONF, <edit-config> requests cannot consist of any show commands.

In each <get-config> instance, only one show command is allowed.

Installing and Using the XMLIN Tool

You can install the XMLIN tool and then use it to convert configuration commands to NETCONF format.

BEFORE YOU BEGIN

Although the XMLIN tool is usually capable of generating NETCONF instances of commands even if the corresponding feature sets or the required hardware capabilities are not available on the device, you might have to install some feature sets before entering the xmlin command.

SUMMARY STEPS

1. xmlin

2. configure terminal

3. Configuration commands

4. (Optional) end

5. (Optional) show commands

6. (Optional) exit

DETAILED STEPS

 
Command
Purpose

Step 1 

xmlin

Example:

switch# xmlin
switch(xmlin)#

Installs the XMLIN tool on the device and then generates equivalent NETCONF formats of all CLI commands entered in this mode.

Step 1 

configure terminal

Example:

switch(xmlin)# configure terminal

Enter configuration commands, one per line. End with CNTL/Z.

switch(config)(xmlin)#

Enters global configuration mode.

Step 2 

Configuration commands

Example:

switch(config)(xmlin)# interface ethernet 2/1

% Success

switch(config-if-verify)(xmlin)# cdp enable

% Success

Converts configuration commands to NETCONF format.

Step 3 

end

Example:

switch(config-if-verify)(xmlin)# end

(Optional) Generates the corresponding <edit-config> request.

Note You must enter the end command to finish the current XML configuration before you generate an XML instance for a show command.

Step 4 

show commands

Example:

switch(config-if-verify)(xmlin)# show interface ethernet 2/1

(Optional) Converts show commands to NETCONF format.

Step 5 

exit

Example:

switch(config-if-verify)(xmlin)# exit
switch#

(Optional) Returns to EXEC mode.

Converting Show Command Output to XML

You can convert the output of show commands to XML.

BEFORE YOU BEGIN

Make sure that all features for the commands you want to convert are installed and enabled on the device. Otherwise, the commands will fail.


Note You can use the terminal verify-only command to verify that a feature is enabled without entering it on the device.


Make sure that all required hardware for the commands you want to convert are present on the device. Otherwise, the commands will fail.

Make sure that the XMLIN tool is installed.

SUMMARY STEPS

1. show-command | xmlin

DETAILED STEPS

 
Command
Purpose

Step 1 

show-command | xmlin

Example:

switch# show interface brief | xmlin

Enters global configuration mode.

Note You cannot use this command with configuration commands.

Configuration Examples for XMLIN

The following example shows how the XMLIN tool is installed on the device and used to convert a set of configuration commands to an <edit-config> instance.

switch# xmlin
******************************************
Loading the xmlin tool. Please be patient.
******************************************
Cisco Nexus Operating System (NX-OS) Software
TAC support: http://www.cisco.com/tac
Copyright ©) 2002-2013, Cisco Systems, Inc. All rights reserved.
The copyrights to certain works contained in this software are
owned by other third parties and used and distributed under
license. Certain components of this software are licensed under
the GNU General Public License (GPL) version 2.0 or the GNU
Lesser General Public License (LGPL) Version 2.1. A copy of each
such license is available at
http://www.opensource.org/licenses/gpl-2.0.php and
http://www.opensource.org/licenses/lgpl-2.1.php
 
 
switch(xmlin)# configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
switch(config)(xmlin)# interface ethernet 2/1
% Success
switch(config-if-verify)(xmlin)# cdp enable
% Success
switch(config-if-verify)(xmlin)# end
<?xml version="1.0"?>
<nf:rpc xmlns:nf="urn:ietf:params:xml:ns:netconf:base:1.0"
xmlns="http://www.cisco.com/nxos:6.2.2.:configure_"
xmlns:m="http://www.cisco.com/nxos:6.2.2.:_exec"
xmlns:m1="http://www.cisco.com/nxos:6.2.2.:configure__if-eth-base" message-id="1">
	<nf:edit-config>
		<nf:target>
			<nf:running/>
		</nf:target>
		<nf:config>
			<m:configure>
				<m:terminal>
					<interface>
						<__XML__PARAM__interface>
							<__XML__value>Ethernet2/1</__XML__value>
							<m1:cdp>
								<m1:enable/>
							</m1:cdp>
						</__XML__PARAM__interface>
					</interface>
				</m:terminal>
			</m:configure>
		</nf:config>
	</nf:edit-config>
</nf:rpc>
]]>]]> 
 

The following example shows how you must enter the end command to finish the current XML configuration before you generate an XML instance for a show command.

switch(xmlin)# configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
switch(config)(xmlin)# interface ethernet 2/1
switch(config-if-verify)(xmlin)# show interface ethernet 2/1
********************************************************
Please type "end" to finish and output the current XML document before building a new one.
********************************************************
% Command not successful 

switch(config-if-verify)(xmlin)# end
<?xml version="1.0"?>
<nf:rpc xmlns:nf="urn:ietf:params:xml:ns:netconf:base:1.0"
xmlns="http://www.cisco.com/nxos:6.2.2.:configure_"
xmlns:m="http://www.cisco.com/nxos:6.2.2.:_exec" message-id="1">
	<nf:edit-config>
		<nf:target>
			<nf:running/>
		</nf:target>
		<nf:config>
			<m:configure>
				<m:terminal>
					<interface>
						<__XML__PARAM__interface>
							<__XML__value>Ethernet2/1</__XML__value>
						</__XML__PARAM__interface>
					</interface>
				</m:terminal>
			</m:configure>
		</nf:config>
	</nf:edit-config>
</nf:rpc>
]]>]]>
 
 
switch(xmlin)# show interface ethernet 2/1
<?xml version="1.0"?>
<nf:rpc xmlns:nf="urn:ietf:params:xml:ns:netconf:base:1.0"
xmlns="http://www.cisco.com/nxos:6.2.2.:if_manager" message-id="1">
	<nf:get>
		<nf:filter type="subtree">
			<show>
				<interface>
					<__XML__PARAM__ifeth>
						<__XML__value>Ethernet2/1</__XML__value>
					</__XML__PARAM__ifeth>
				</interface>
			</show>
		</nf:filter>
	</nf:get>
</nf:rpc>
]]>]]>
switch(xmlin)# exit
switch# 
 

The following example shows how you can convert the output of the show interface brief command to XML.

switch# show interface brief | xmlin
<?xml version="1.0"?>
<nf:rpc xmlns:nf="urn:ietf:params:xml:ns:netconf:base:1.0"
xmlns="http://www.cisco.com/nxos:6.2.2.:if_manager" 

message-id="1">
	<nf:get>
		<nf:filter type="subtree">
			<show>
				<interface>
					<brief/>
				</interface>
			</show>
		</nf:filter>
	</nf:get>
</nf:rpc>
]]>]]>

Additional References

For additional information related to implementing LLDP, see the following sections:

Related Documents

Standards

Related Documents

Related Topic
Document Title

XMLIN commands: complete command syntax, command modes, command history, defaults, usage guidelines, and examples

Cisco Nexus 7000 Series NX-OS System Management Command Reference


Standards

Standards
Title

No new or modified standards are supported by this feature, and support for existing standards has not been modified by this feature.


Feature History for XMLIN

Table 21-1 lists the release history for this feature.

Table 21-1 Feature History for XMLIN

Feature Name
Releases
Feature Information

XMLIN

6.2(2)

This feature was introduced.