cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
476
Views
0
Helpful
2
Replies

Cisco DNA VLAN naming template

p.nordlien
Level 1
Level 1

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:

VLAN listVLAN list

I would like to create a DNA template that could do something like this:

  1. If VLAN 2 exists - set name 'library'
  2. if VLAN 3 exists - set name 'guest'
  3. if VLAN 4 exists - set name 'wireless_AP'

...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

 

2 Replies 2

TomM
Level 1
Level 1

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"

 

 

Shibble1991
Level 1
Level 1

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

Review Cisco Networking for a $25 gift card