Categories
Linux Networking Systems Administration

A script to bring Cisco Switch VLAN data into phpIPAM

We have recently set up an IPAM at my workplace, the excellent phpIPAM – https://phpipam.net/

I went through our install and added all our subnets into the IPAM, but to make the data much more useful we wanted to have the VLAN information also:

However, I didn’t want to go through by hand, adding each VLAN entry. This would be both error-prone, and very time-consuming. What I did instead is write a python script to read in cisco config files, run through the config looking for vlan’s, and processing the config blocks.

It then reaches out to the IPAM using the API, and finds the matching subnet. If it finds the subnet, it then tries to match up VLAN <-> IPAM subnet and either corrects or create the VLAN entry if it doesn’t exist.

Here is the script: https://gitlab.com/-/snippets/2524644

The API for phpIPAM is really easy to work with, and has very good documentation on their site.

3 replies on “A script to bring Cisco Switch VLAN data into phpIPAM”

Leave a Reply

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