cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
541
Views
0
Helpful
5
Replies

DNAC - Cat Center - Python Help- List all VLANs across all switches

jdomin01sa
Level 1
Level 1

Hello Everyone,

I have searched high and low, on Cisco.com, Google.com and developer.cisco.com for any python or DNA Center API that will list the VLANS associated with all switches across the enterprise.  We are trying to see what VLANS are used where and on what switches those VLANS exist upon.  I can definitely use Postman to query each switch independently, but that only scales on a switch-per-switch basis.  I would like to see if anyone out there has had to query their enterprise for all VLANS (VlanId, Vlan Name and Switch IP address) and where they live?

So far the DNA API only gives me the names and the ID of all the VLANS, but not where those VLANS are seen across the enterprise or what switch the VLAN is assigned to. 

Please advise if you have any examples or assistance in how i can quickly obtain the list of VLANS and where those VLANS are associated to within the enterprise.

Thank you,

JCD

 

5 Replies 5

Dan Rowe
Cisco Employee
Cisco Employee

Hi JCD,

Does the 'VLAN' report template for Network Devices provide you with the information you need?

Screenshot 2024-02-20 at 2.19.14 AM.png

Screenshot 2024-02-20 at 2.19.47 AM.png

Hello Dan,

   Unfortunately, it does not.  It only doesnt fully provide all the VLANS that are in use across the trunks.  We discovered through some review and analysis that the report doesnt capture the VLANS that are not directly assigned as Native or Access VLANS.  That is why I thought of going down the python path or the API path of DNAC.  The DNAC API's don't provide the depth required either, that would provide the list of VLANS assigned to the switch and where the VLAN(s) are in use.  We are trying to find the VLANS that are sporadically in use so that we can identify their usage assignment and maybe re-align the assignment with a different VLAN ID, thus eliminating the VLANS that are less globally used across the enterprise.  This would aid us in getting a smaller VLAN footrprint prior to implementing Secure Group Tagging/trustsec, not to mention clean things up a bit.

Thank you,

Juan

Juan,

You can use the Command Runner Tool to accomplish this task:

Here is an example of getting the VLANs configured, but in can add multiple commands to accomplish your customized needs.

Example:

Example_01.pngExample_02b.pngExample_03.png

jdomin01sa
Level 1
Level 1

Tomas,

Thank you for the suggestion, let me give that a shot and let you all know if that solution suffices that outcomes we are looking for.  

Thank you,

Juan D

jdomin01sa
Level 1
Level 1

Tom,

I attempted the suggestion, but unfortunately the command runner doesnt allow "Select All" and has a maximum limit of 20 switches.  This is not going to capture all the devices at once and would require several iterations of the execution and also would require us to concatenate of all the collections from those iterations.  I am looking for a more automated scripting method if possible, but i do appreciate the suggestion and could work for other smaller tasks in the future.

Thank you,

Juan D