Category Archives: Programming

Nexus devices CLI parsing using Python, XML and JSON

This blog is part of my series on Devops for Networking. As I indicated in 1 of my earlier blog, majority of Network devices still have CLI as the only means of configuration and monitoring. CLI is not automation friendly because of obvious reasons. In the last few years, Cisco NXOS devices provides CLI output in XML and JSON format. This allows much easier ways to parse the CLI output which aids in automation. In this blog, I will cover some examples of monitoring Cisco NXOS devices using Python interface to interact with the device and get useful information.

Prerequisites:

Continue reading Nexus devices CLI parsing using Python, XML and JSON

Cisco UCS automation using Python SDK

This blog is part of my series on Devops for Networking. In this blog, I will cover a brief overview of UCS management model, management tools and how to automate configuration and monitoring of Cisco UCS using Python SDK. UCS is Cisco’s Unified computing system that provides a tightly integrated compute, networking and storage solution.

UCS Management

Cisco UCS management information model is a hierarchical tree with each node in the tree representing either physical or logical entity. The node is referred to as MO(Managed object). Physical entities could be chassis, servers, switches and logical entities could be policies, service profiles etc. XML based interface is provided to set and get managed objects. Following picture shows a sample Management tree with Chassis, blades and adapters.

Continue reading Cisco UCS automation using Python SDK

Policy based forwarding application

In this blog, I will cover a policy based forwarding application that I wrote in Python.

Use case:

There are many scenarios where regular routing decisions do not suffice and customers want more fine grained control over paths their traffic takes. This could be because of security reasons, better link utilization, vpn concerns etc. Following scenarios are covered in the application.

  • Traffic type(Either cos based or L4 based)
  • Time of the day
  • Bandwidth based

Continue reading Policy based forwarding application

MuxDemux ODL application

Here, I will cover a simple ODL application that does multiplexing and demultiplexing of packet based on incoming vlan.

Use case for the application:

Test generator ports are always a premium because of the high cost associated with it. In our lab, we connect test generator to a switch and the switch is connected to all DUT. The advantage with this scheme is we can use low speed testgen ports(1G test ports are lot cheaper than 10G, 40G) and there is less need for recabling. There is a need to reprogram the switch based on which DUT we need the testgen port to be connected to and this application is a first step towards automating that process.

Continue reading MuxDemux ODL application

Python REST Library for Opendaylight

In this blog, I will cover Python REST library that I wrote to simplify writing Python ODL applications.

In an earlier blog, I had indicated that the primary programming language choice for ODL applications is either Java or Python.

Following is my experience in Python programming with Opendaylight.

  • Python programming model for ODL is using REST api to talk to Controller, so control is limited to what REST api provides. There are few things that are not possible(or atleast I have not figured out) like sending/receiving packets from the Controller, getting asynchronous event based callback to Python.
  • REST api returns data either in xml or json format. Python has in-built json parser that makes it very easy to manipulate data coming back from the controller.
  • Python has a lot of standard libraries so there is a lot of code reuse.
  • There is plenty of documentation and tutorials in the web for Python, so learning Python is straightforward. For folks familiar with C, Perl or any scripting language, learning Python should be straightforward. Python supports object-oriented programming though I have not used it.

Continue reading Python REST Library for Opendaylight