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

Prime API - how to get vlan list

Chris P
Level 1
Level 1

Hi 

Does anyone know how to pull the list of vlan (layer2) configured on a device from the API?

 

Basically what you get from GUI when you get to
Inventory / Device Management / Network Devices / Device Groups / All Devices / <device name> 
System > VLANs

 

thank you 

 
2 Replies 2

henrikjohan
Level 1
Level 1

Hello.

 

Unfortunately I do now know where or how from Cisco Prime API to get that information.

Not all information from the GUI is accessible or easily accessible in the API.

 

What I would do, if I couldn't find it, was to get the device list from Prime via its API, and then just SNMP-WALK each switch manually.

 

OID 1.3.6.1.4.1.9.9.46.1.3.1.1.4.1 should give you all the VLANs with its respective names.

 

example:

 

iso.3.6.1.4.1.9.9.46.1.3.1.1.4.1.1 = STRING: "default"
iso.3.6.1.4.1.9.9.46.1.3.1.1.4.1.1002 = STRING: "fddi-default"
iso.3.6.1.4.1.9.9.46.1.3.1.1.4.1.1003 = STRING: "token-ring-default"
iso.3.6.1.4.1.9.9.46.1.3.1.1.4.1.1004 = STRING: "fddinet-default"
iso.3.6.1.4.1.9.9.46.1.3.1.1.4.1.1005 = STRING: "trnet-default"

 

Then just do a split based on the OID, and you'll get the VLAN ID

e.g.

oid, vlanId = "1.3.6.1.4.1.9.9.46.1.3.1.1.4.1.102".split('1.3.6.1.4.1.9.9.46.1.3.1.1.4.1.")

 

If you want more example code, I can provide you with python and its necessary libraries.

Hi 

 

many thanks and you're right snmp is the proper approach.

 

thanks again for helping.

 

Christian