08-22-2019 01:42 AM
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
09-20-2019 03:34 AM
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.
10-19-2019 12:24 AM
Hi
many thanks and you're right snmp is the proper approach.
thanks again for helping.
Christian
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: