Some random python scripts that I’ve created during my learning trail. These scripts focuses primarily on use-cases for Network Engineers. All examples are available on the python script examples GitHub repository.


Parse Cisco IOS configurations using ciscoconfparse

Parse Cisco IOS configurations using ciscoconfparse

In my last post, I took a look on how to parse information from a Cisco IOS configuration using regular expressions. This post focuses on the same use case as the last one, but this time I use the ciscoconfparse library. The use of the library doesn't mean that you can ignore regular expressions at all. You need at least a basic understanding of it. Before continuing, I highly recommend to read my last post about Parse Cisco IOS configurations using RegEx. I will reuse some of the RegEx and skip the detailed explanation in this post.
Parse Cisco IOS configurations using RegEx

Parse Cisco IOS configurations using RegEx

In one of my earlier posts, I parse IP parameters from an existing Cisco IOS configuration using ciscoconfparse. In this post, I'll like to provide some basic patterns how to parse (almost any) information from a running configuration, but first without using any library. I just take a look at the python standard library and regular expressions (RegEx).
Validate JSON data using cerberus

Validate JSON data using cerberus

During some coding work for my day job, I require a way to validate the format (or schema) for some JSON data. If you need a quick refresh, what JSON is and how to work with it in python, take a look at one of my earlier posts about python dictionaries and JSON. As an additional requirement, the validation step should include default data for certain keys that are not found in the original data.
Automate SSH connections with netmiko

Automate SSH connections with netmiko

Today, I like to show you an example how to automate SSH connections with netmiko. To demonstrate it, I decide to create a simple CDP information crawler. The result should be a basic network diagram based on HTML and Javascript. As you might know, this involve more components than just netmiko. It is used to collect the information from the device using SSH. To parse the output from the device, we will use TextFSM. For the visualization, we will use some HTML, Javascript and CSS.