Skip to main content

Posts

Python scripting lesson for Juniper switches

Collecting comprehensive switch interface information When working with Juniper EX / QFX switches it is often required to collect comprehensive interface status data. Not any single show command will provide all the details and merging the output of several commands is quite time consuming.  On top of this, it can be tricky to find free ports on switches, because unconfigured ports are simply not shown in many commands and the only way to find out available ports is examining the chassis hardware components. In the following article I would like to show you an easy way of collecting such information quickly by using Pretty Good Termina l.    PGT is completely free for private use so you don’t need to worry about any costs involved. What the script does As part of the standard installation, PGT contains a sample Visual Script designed for Juniper EX /QFX switches to collect switch interface information. The script will issue the following CLI commands and m
Recent posts

Using Python to script Cisco routers

A year ago or so I posted an article on LinkedIn,  How to configure 50000+ CPE routers .  Now I want to go a step further in scripting and share you my way of using Python for scripting Cisco routers. I show you the software and its usage for large scale scripting deployment because I do believe it is an extremely powerful network scripting tool, and all who face similar challenges might find it a good friend. It is not a commercial, I do use the software every day and I develop  Pretty Good Terminal  as needed to achieve my goals quicker and simpler in a more & more elegant way. In this article I do not wan to dive deep into scripting details but rather just flash some cool features of PGT worth highlighting. Should you be interested in details, you will find quite detailed descriptions about these features on the website of the software. A Visual Script using Python The software I developed for router mass-configuration has evolved a lot since its first publication an

Python Crumbs for Cisco routers - Part I

In this series I want to show you how to use Python to solve some common tasks related to Cisco router scripting. Update, 2018.06 : I compiled a short training video that will teach you the basic Python scripting in PGT. If you prefer watching a video over reading the article, this is exactly for you :  PrettyGoodTerminal - Using Python Scripts This tutorial will focus only on - so to say - applied Python language and won't go into details with Python syntax or language elements itself for one very good reason : at the beginning you probably want to have results quickly without reading hundreds of pages about the language. I always affirmed that learning something new is much easier when you get  a grasp on it on a practical way. The most common task I came across is getting some basic information of  a router or switch, like system uptime, version, interface status, etc. Of course, you don't need Python for simple queries, but when you need to do some text process

Python Crumbs for Cisco routers - Part II

In my  previous post I discussed the basics of using Python scripts with Pretty Good Terminal. What I want to share now is a specific script I created to investigate an issue.  One of our customer's network exhibited connection issues over DLS lines. There were around 20,000 Cisco 800 series routers connected to the network, and around 200 of these experienced intermittent reachability issues once in a while.  To check whether the issue was related to the DSL line or not, I had the idea to use specific IOS commands to collect DSL contoller data from the routers. There were two types of routers involved : Cisco 857 and 867VAE. On a 857 router one can use the "sh dsl interface atm 0" command, while on a 867VAE the "sh controllers vdsl 0" command needs to be issued. So the first thing a script should do is to detect the router type and based on it issue the correct command. This is something I covered in my previous post, so I will simple reuse the code pos