While building out a new enterprise network for a client using Juniper hardware (SRX240s and EX3300s), I ran into a decision I’ve encountered a number of times: how to generate repetitive configuration. For example:

set interface ge-2/0/0 unit 0 family ethernet-switching port-mode access vlan members corporate-data
set interface ge-2/0/1 unit 0 family ethernet-switching port-mode access vlan members corporate-data
, etc.

Obviously interface-range exists to solve this issue, at least for switchport config, but other members of my team take issue with the transparency of configuration in that form, and I agree somewhat – to verify an interface’s configuration, you’re either following a chain of config items or using the less-than-ideal show vlans. Additionally, interface-range only helps with interface configuration, not for security zones or policies.

In the past, I’ve used a quick bash script that I modify as necessary for outputting the required set commands. This is fine for me, but I wanted to make something a bit easier and more portable for my (Windows-using) team, so I converted it to a quick Python script.

Python is still not the most accessible interpreter for Windows users, so I figured I’d go all the way and create a javascript web version. It’s barebones and the interactivity is a bit weird – I intended to go for the full terminal experience, but my JS and CSS skills are weak at best. Anyway, hope this is useful to someone other than me and my coworkers.

Leave a Reply

Your email address will not be published. Required fields are marked *