Leveraging an API-driven approach to dynamically generate a live cable-plan for a network allows operators to work with the resulting data programmatically. Having captured the live cable-plan they can utilize it as follows:

  • Compare it to previous versions to identify changes
  • Analyze the topology for troubleshooting and failure analysis
  • Track the evolution of the topology
  • Archive the cable-plan for future comparisons

nxtoolkit

The NX Toolkit is a set of Python libraries that allow for basic configuration of the Cisco Nexus Switch. It is intended to allow users to quickly begin using the NX-API REST interface and decrease the learning curve necessary to begin using the switch.

nxtoolkit is available as an open source project (Apache License, Version2.0) on Github https://github.com/datacenter/nxtoolkit

Cable-Plan Application for nxtoolkit

The cable-plan module allows the programmer to easily import existing cable-plans from XML files, import the currently running cable-plan from a Cisco Nexus Switch, export previously imported cable-plans to a file, and compare cable-plans.

More advanced users can use the Cable-Plan application to easily build a cable-plan XML file, query a cable-plan, and modify a cable-plan.

The Cable-Plan application is available as an application under the nxtoolkit open source project (nxtoolkit/applications/cableplan).

Cable-Plan XML Syntax

The cable-plan XML appears as follows:

  <?xml version="1.0" encoding="UTF-8"?>
  <?created by cable.py?>
  <CISCO_NETWORK_TYPES version="None" xmlns="https://www.cisco.com/cableplan/Schema2" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="nxos-cable-plan-schema.xsd">
     <DATA_CENTER networkLocation="None" idFormat="hostname">
        <CHASSIS_INFO sourceChassis="spine1" type="n9k">
           <LINK_INFO sourcePort="eth2/35" destChassis="leaf1" destPort="eth1/50"/>
           <LINK_INFO sourcePort="eth2/3" destChassis="leaf3" destPort="eth1/50"/>
           <LINK_INFO sourcePort="eth2/2" destChassis="leaf2" destPort="eth1/50"/>
        </CHASSIS_INFO>
        <CHASSIS_INFO sourceChassis="spine2" type="n9k">
           <LINK_INFO sourcePort="eth2/1" destChassis="leaf1" destPort="eth1/49"/>
           <LINK_INFO sourcePort="eth2/3" destChassis="leaf3" destPort="eth1/49"/>
           <LINK_INFO sourcePort="eth2/2" destChassis="leaf2" destPort="eth1/49"/>
        </CHASSIS_INFO>
     </DATA_CENTER>;
  </CISCO_NETWORK_TYPES>  

The CHASSIS_INFO tag normally identifies the spine switches, then the leaf switches are contained in the LINK_INFO. When the XML is read, both leaf and spine switch objects will be created and the get_switch() and get_link()methods can be used to access them.