14 February, 2014

Spanning-tree output formatting to XML

Formatting spanning-tree output into (almost) structured XML.
Can be used to query entire list of VLANs or just the desired ones.
The content of temp4.odm:

###
show spanning-tree
show spanning-tree vlan *
<?xml version="1.0" encoding="UTF-8"?>
<ODMSpec>
<SpecVersion>built-in</SpecVersion>
<Command><Name>show spanning-tree</Name></Command>
<DataModel>
<Container name="ShowSpanningtree">
<Container name="VLAN" alias = "VLANNER" dynamic = "true">
<Property name="VLAN" alias = "VLAN" distance = "0" length = "1" type = "String"/>
<Container name="Priority" alias = "Root_ID" dynamic = "false">
<Property name="Priority" alias = "Root_Priority" distance = "1" length = "1" type = "String"/>
<Property name="Address" alias = "Root_Address" distance = "1" length = "1" end-delimiter = "," type = "String"/>
<Property name="This" alias = "am_root" distance = "4" length = "1" type = "String"/>
</Container>
<Container name="Priority" alias = "Bridge_ID" dynamic = "false">
<Property name="Priority" alias = "Bridge_Priority" distance = "1" length = "1" type = "String"/>
<Property name="Address" alias = "Bridge_Address" distance = "1" length = "1" end-delimiter = "," type = "String"/>
</Container>
<Table name="Interfaces">
<Header name="Interface" type="String" start="0" end="18"/>
<Header name="Role" type="String" start="20" end="23"/>
<Header name="Sts" type="String" start="25" end="27"/>
<Header name="Cost" type="String" start="29" end="37"/>
<Header name="Prio.Nbr" type="String" start="39" end="46"/>
<Header name="Type" type="String" start="48" end="69"/>
</Table>
</Container>
</Container>
</DataModel>
</ODMSpec>

2 comments:

  1. Both CCNA and MCSE are certified courses of networking. CCNA is by Cisco where as latter is a certified course from Microsoft. Today, computers are not only used in corporate and offices but also in small shops, stores and house holds. CCNA course in Pune

    ReplyDelete