Skip navigation
All People > franklaszlo > Laszlo Frank's Blog > 2016 > January > 18

Laszlo Frank's Blog

January 18, 2016 Previous day Next day

In this post I want to show you how easy to create complex scripts for router mass configuration.


Recently I have published an article in which I described a tool I developed to configure more than

50.000 CPE routers.


Since then the software - Pretty Good Terminal - became a popular tool among my colleagues, who as

network engineers are responsible for large, multinational companies' global network design and frequently

need to poll or configure hundreds or thousands of Cisco routers and switches. They reported that using PGT

saves a lot of their precious time.


When dealing with so many devices, some kind of scripting capability arise inevitably due to the versatility

of device types and configurations in complex networks. PGT has supported scripting since it was first released,

but creating complex scripts required some level of programming skills and the use of Visual Studio which

deterred most network engineers. I was puzzling over this situation finding a way to make scripting an easy

task without reinventing the wheel and introducing a new proprietary, application specific scripting language

which I would find pointless.


And then the idea of a Visual Script Editor was born. This is what I really want to show you now.


Most of the time scripts - and humans, too :-) - repeat the following basic steps:

- check a device configuration element by issuing show commands

- analyze the response

- based on the result construct a configuration command


Of course, one step is rarely enough to decide what to do and more configuration checks are required until

enough information is collected to build the final configuration change.


The best way to design a script is to represent the required steps visually and organizing them to a flowchart.

This is exactly what you can do with PGT's Visual Script Editor. Let me show a screenshot here:


For instance if you want to check if a router is in a specific BGP AS, you only need to enter the how command

you would normally use for this purpose and indicate what must the answer contain for the Yes branch of the

decision element in the flow chart.


If the answer is yes, let's add an ACL:



As you can see it is very easy, straightforward and no programming or scripting is involved at all !


For a simple script, this is all what you need.


For more complex scripts, however, you can write custom code to dynamically construct the CLI commands from

variables for example. You can do this, because PGT Visual Script execution engine is actually a c# compiler and

every script element can have custom code and variables which is compiled and executed at runtime.

This means that PGT does not define its own proprietary scripting language but use the industry standard c# instead.


It is still very easy, let's consider the last element which adds a static route. Adding a static route requires

the knowledge of the next-hop address. In reality you would to this by checking the route table and memorize the

appropriate next hop and store its value. Not going into much more details as this article is not intended to be

a complete tutorial, assume you acquired the next_hop_ip. Based on this, you can consturct configuration commands

like below:




I hope you found this short introduction interesting and useful. If this is the case, you can read the details on PGT's website

by downloading PGT and reading the user's manual where Visual Script usage is fully documented.