cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1240
Views
0
Helpful
4
Replies

Options to bulk add a Voice Vlan to all existing Access ports?

pmanicioto
Level 1
Level 1

Hello All, 

I will preface this with I do not know much at all about scripting, but I have tinkered in Prime Infrastructure with releasing bulk changes to devices and can do some simple changes fine, but this one is throwing me for a loop and would appreciate some ideas. 

 

I would like to figure out a way to select my range of switches and scripting a way to say something like : If switchport mode = access, then switchport voice vlan *vlan #*

 

The reason i would like to do this is because the interface numbers change across the environment between models and some are stacked, so it is not %100 continuity in interface names/numbers and I have quite a few hundred switches to change. 

 

If this is at all possible to do a variable type script in Prime like this, or suggestions on something else to use and where to start so I can learn how to configure this, I would appreciate it. 

4 Replies 4

balaji.bandi
Hall of Fame
Hall of Fame

get cattools free trial version, easy to push all changes what you looking all devices.

 

https://www.solarwinds.com/kiwi-cattools

 

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

Thank you for the suggestion, however I am not sure how well this will work considering my devices do not follow a typical management IP scheme and would need to discover the devices first. 

I may be able to copy/paste the IP's from a spreadsheet in, however the next issue is that some are FA01-24, some are Fa0/1-48, some are GI1/0/1-48, some are Gi1/0/1-36 then TE1/0/37-48, some are stacked and now GI1-2-3-4 ranges which complicates this quite a bit

 

This is why I was looking for something I can easily do an If/then statement or select ALL ethernet interfaces in bulk on all devices to make the change. 

Plus any demos usually have a very small limit of devices to test on because they want to get paid. I already have these devices in Prime and in WhatsupGold for mass changes, just limited to premade templates due to not knowing much about scripting

If you have a writeable snmp community this script can do the job.

 

#!/bin/bash

community="public"
voicevlan=101

IP=(192.168.0.1 192.168.0.2)
for myip in "${IP[@]}"
do
    echo "$myip"
    # CISCO-VLAN-MEMBERSHIP-MIB::vmVlan = 1.3.6.1.4.1.9.9.68.1.2.2.1.2
    switchports=`snmpwalk -M /dev/null -v 2c -c $community $myip 1.3.6.1.4.1.9.9.68.1.2.2.1.2 2>/dev/null`       
    printf "$switchports\n"
    printf "write voice vlans\n"
    for ports in $switchports
    do
        [[ $ports =~ iso.3.6.1.4.1.9.9.68.1.2.2.1.2.([0-9]+) ]]
        index=`echo "${BASH_REMATCH[1]}"`
        # CISCO-VLAN-MEMBERSHIP-MIB::vmVoiceVlanId = 1.3.6.1.4.1.9.9.68.1.5.1.1.1
        snmpset -M /dev/null -v 2c -c $community $myip 1.3.6.1.4.1.9.9.68.1.5.1.1.1.$index integer $voicevlan 2>/dev/null
    done 
done

 

 

[root@CrashCart mibwork]# ./switchports
192.168.0.2
iso.3.6.1.4.1.9.9.68.1.2.2.1.2.10102 = INTEGER: 1
iso.3.6.1.4.1.9.9.68.1.2.2.1.2.10105 = INTEGER: 1
iso.3.6.1.4.1.9.9.68.1.2.2.1.2.10122 = INTEGER: 1
iso.3.6.1.4.1.9.9.68.1.2.2.1.2.10123 = INTEGER: 11
iso.3.6.1.4.1.9.9.68.1.2.2.1.2.10125 = INTEGER: 1
iso.3.6.1.4.1.9.9.68.1.2.2.1.2.10141 = INTEGER: 1
iso.3.6.1.4.1.9.9.68.1.2.2.1.2.10142 = INTEGER: 1
iso.3.6.1.4.1.9.9.68.1.2.2.1.2.10143 = INTEGER: 1
iso.3.6.1.4.1.9.9.68.1.2.2.1.2.10144 = INTEGER: 11
iso.3.6.1.4.1.9.9.68.1.2.2.1.2.10145 = INTEGER: 1
iso.3.6.1.4.1.9.9.68.1.2.2.1.2.10149 = INTEGER: 1
iso.3.6.1.4.1.9.9.68.1.2.2.1.2.10150 = INTEGER: 1
iso.3.6.1.4.1.9.9.68.1.2.2.1.2.10151 = INTEGER: 1
iso.3.6.1.4.1.9.9.68.1.2.2.1.2.10152 = INTEGER: 1
iso.3.6.1.4.1.9.9.68.1.2.2.1.2.10201 = INTEGER: 1
iso.3.6.1.4.1.9.9.68.1.2.2.1.2.10202 = INTEGER: 1
write voice vlans
iso.3.6.1.4.1.9.9.68.1.5.1.1.1.10102 = INTEGER: 101
iso.3.6.1.4.1.9.9.68.1.5.1.1.1.10105 = INTEGER: 101
iso.3.6.1.4.1.9.9.68.1.5.1.1.1.10122 = INTEGER: 101
iso.3.6.1.4.1.9.9.68.1.5.1.1.1.10123 = INTEGER: 101
iso.3.6.1.4.1.9.9.68.1.5.1.1.1.10125 = INTEGER: 101
iso.3.6.1.4.1.9.9.68.1.5.1.1.1.10141 = INTEGER: 101
iso.3.6.1.4.1.9.9.68.1.5.1.1.1.10142 = INTEGER: 101
iso.3.6.1.4.1.9.9.68.1.5.1.1.1.10143 = INTEGER: 101
iso.3.6.1.4.1.9.9.68.1.5.1.1.1.10144 = INTEGER: 101
iso.3.6.1.4.1.9.9.68.1.5.1.1.1.10145 = INTEGER: 101
iso.3.6.1.4.1.9.9.68.1.5.1.1.1.10149 = INTEGER: 101
iso.3.6.1.4.1.9.9.68.1.5.1.1.1.10150 = INTEGER: 101
iso.3.6.1.4.1.9.9.68.1.5.1.1.1.10151 = INTEGER: 101
iso.3.6.1.4.1.9.9.68.1.5.1.1.1.10152 = INTEGER: 101
iso.3.6.1.4.1.9.9.68.1.5.1.1.1.10201 = INTEGER: 101
iso.3.6.1.4.1.9.9.68.1.5.1.1.1.10202 = INTEGER: 101

 

 

The first for loop identifies if it is access port and the second for loop writes the voicevlan number as 101.

 

 

Thank you greatly. I will see if I can manipulate this into a template in prime and make it work. 

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: