Beruflich Dokumente
Kultur Dokumente
14361_05_2008_X1 © 2008 Cisco Systems, Inc. All rights reserved. Cisco Public 1
XML-PI 1.0
Programmatic Access to
Cisco IOS Using XML
BRKDEV-1181
BRKDEV-1181
14361_05_2008_X1 © 2008 Cisco Systems, Inc. All rights reserved. Cisco Public 2
What is XML-PI?
Retrieving configurations in XML
Changing configurations using XML
Getting “show” command output in XML
Development tools and libraries
Q&A
BRKDEV-1181
14361_05_2008_X1 © 2008 Cisco Systems, Inc. All rights reserved. Cisco Public 3
BRKDEV-1181
14361_05_2008_X1 © 2008 Cisco Systems, Inc. All rights reserved. Cisco Public 4
BRKDEV-1181
14361_05_2008_X1 © 2008 Cisco Systems, Inc. All rights reserved. Cisco Public 5
BRKDEV-1181
14361_05_2008_X1 © 2008 Cisco Systems, Inc. All rights reserved. Cisco Public 6
BRKDEV-1181
14361_05_2008_X1 © 2008 Cisco Systems, Inc. All rights reserved. Cisco Public 7
XML-PI
IOS
BRKDEV-1181
14361_05_2008_X1 © 2008 Cisco Systems, Inc. All rights reserved. Cisco Public 8
BRKDEV-1181
14361_05_2008_X1 © 2008 Cisco Systems, Inc. All rights reserved. Cisco Public 9
Retrieve Config—GET-CONFIG
BRKDEV-1181
14361_05_2008_X1 © 2008 Cisco Systems, Inc. All rights reserved. Cisco Public 10
Response
…
<Device-Configuration>
<interface>
<GigabitEthernetInterface>
<InterfaceName>GigabitEthernet0/1</InterfaceName>
<Interface-Configuration>
<ip>
<address>
<IPAddress>10.0.1.1</IPAddress>
<IPSubnetMask>255.0.0.0</IPSubnetMask>
</address>
</ip>
<duplex><auto/></duplex>
<speed><auto/></speed>
<media-type><rj45/></media-type>
<negotiation><auto operation='delete'/></negotiation>
</Interface-Configuration>
</GigabitEthernetInterface>
</interface>
</Device-Configuration>
…
BRKDEV-1181
14361_05_2008_X1 © 2008 Cisco Systems, Inc. All rights reserved. Cisco Public 11
BRKDEV-1181
14361_05_2008_X1 © 2008 Cisco Systems, Inc. All rights reserved. Cisco Public 12
BRKDEV-1181
14361_05_2008_X1 © 2008 Cisco Systems, Inc. All rights reserved. Cisco Public 13
Change a Config—EDIT-CONFIG
Request
<?xml version="1.0" encoding="UTF-8"?>
<rpc message-id="3"
xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<edit-config>
<target><running/></target>
<config>
<xml-config-data>
<Device-Configuration>
<ip>
<host>
<NameHost>
shangrila
</NameHost>
<HostIPAddress>
10.2.3.4
</HostIPAddress>
</host>
</ip>
<ip>
<host>
<NameHost>
vallhala
</NameHost>
<HostIPAddress>
10.2.3.5
</HostIPAddress>
</host>
</ip>
</Device-Configuration>
</xml-config-data>
</config>
</edit-config>
</rpc>]]>]]>
BRKDEV-1181
14361_05_2008_X1 © 2008 Cisco Systems, Inc. All rights reserved. Cisco Public 14
BRKDEV-1181
14361_05_2008_X1 © 2008 Cisco Systems, Inc. All rights reserved. Cisco Public 15
Response
<?xml version="1.0" encoding="UTF-8"?>
<rpc-reply message-id="3" xmlns="urn:ietf:params:netconf:base:1.0">
<ok/>
</rpc-reply>
BRKDEV-1181
14361_05_2008_X1 © 2008 Cisco Systems, Inc. All rights reserved. Cisco Public 16
BRKDEV-1181
14361_05_2008_X1 © 2008 Cisco Systems, Inc. All rights reserved. Cisco Public 17
BRKDEV-1181
14361_05_2008_X1 © 2008 Cisco Systems, Inc. All rights reserved. Cisco Public 19
BRKDEV-1181
14361_05_2008_X1 © 2008 Cisco Systems, Inc. All rights reserved. Cisco Public 20
BRKDEV-1181
14361_05_2008_X1 © 2008 Cisco Systems, Inc. All rights reserved. Cisco Public 21
BRKDEV-1181
14361_05_2008_X1 © 2008 Cisco Systems, Inc. All rights reserved. Cisco Public 22
</DeviceSpec>
<DeviceType>Cat295024G</DeviceType>
<Versions><Version>12.1(22)EA2</Version></Versions> Targets for the
<DeviceSpec>
<DeviceType>Cat355024</DeviceType>
CLI Command
<Versions><Version>12.1(22)EA6</Version></Versions>
</DeviceSpec>
</SupportedDeviceTypes>
<DataModel>
<Container name="ShowVtpStatus" >
<Property name="VTP Version" />
<Property name="Configuration Revision" />
<Property name="Maximum VLANs supported locally" type="Integer" />
<Property name="Number of existing VLANs" type="Integer" />
<Property name="VTP Operating Mode" />
<Property name="VTP Domain Name" />
<Property name="VTP Pruning Mode" />
<Property name="VTP V2 Mode" />
Output Format
<Property name="VTP Traps Generation" />
<Property name="MD5 digest" length="-1"/>
<Container name="Configuration" >
<Property name="last modified by" />
<Property name="last modified by" alias="At" distance="3" length="-1"/>
</Container>
</Container>
</DataModel>
</ODMSpec>
Type
Length
Distance
BRKDEV-1181
14361_05_2008_X1 © 2008 Cisco Systems, Inc. All rights reserved. Cisco Public 23
Development Tools
BRKDEV-1181
14361_05_2008_X1 © 2008 Cisco Systems, Inc. All rights reserved. Cisco Public 24
BRKDEV-1181
14361_05_2008_X1 © 2008 Cisco Systems, Inc. All rights reserved. Cisco Public 25
BRKDEV-1181
14361_05_2008_X1 © 2008 Cisco Systems, Inc. All rights reserved. Cisco Public 26
BRKDEV-1181
14361_05_2008_X1 © 2008 Cisco Systems, Inc. All rights reserved. Cisco Public 27
Recommended Reading
BRKDEV-1181
14361_05_2008_X1 © 2008 Cisco Systems, Inc. All rights reserved. Cisco Public 28
BRKDEV-1181
14361_05_2008_X1 © 2008 Cisco Systems, Inc. All rights reserved. Cisco Public 29
BRKDEV-1181
14361_05_2008_X1 © 2008 Cisco Systems, Inc. All rights reserved. Cisco Public 30