04-24-2023 04:55 AM
We have some 600+ switches around the network and a huge amount of VLAN definitions that are not conform. Neither does every VLAN exist everywhere. VTP are not implemented due to various support on the switches. To make things even worse, there are satellite routers where VLAN ID's have been chosen randomly. So, I have ended up with a lot of switches with VLAN lists like this:
I would like to create a DNA template that could do something like this:
...and so on. The template would not be global, I know, but it would help me out alot on the LAN side of the satellite routers.
Any input would be greately appreciated.
Regards
04-27-2023 07:40 PM
I would think if you just wanted to push down vlan names you would have a template with this
vlan 2
name library
vlan 3
name guest
etc. etc.
If you want to remove vlans, you could create a loop through a range of vlans to "no vlan x"
04-29-2023 11:23 AM
I haven't tried it myself, but in theory you should be able to right a template that runs a show command on the switch. Based on that output you would have to right a script that renames the vlan if it exists. Template would look something like:
#set($vlan_id = "<VLAN ID>")
#set($new_vlan_name = "<New VLAN Name>")
show running-config | include vlan $vlan_id
#set($vlan_output = $output.trim())
#set($vlan_exists = "false")
#foreach($line in $vlan_output.split("\n"))
#if($line.contains("vlan $vlan_id"))
#set($vlan_exists = "true")
#end
#end
#if($vlan_exists == "true")
vlan $vlan_id name $new_vlan_name
#end
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide