cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
204
Views
1
Helpful
3
Replies

Slow Device Inventory Extraction Due to Missing Location Data

salviprasad13
Level 1
Level 1


I am using Cisco DNA Center APIs to extract an inventory of network devices. The /dna/intent/api/v1/network-device API provides most of the required details, but the location field is missing in the response.

To work around this, I am making an additional API call to /dna/intent/api/v1/device-detail for each device using its UUID to fetch the exact location data. However, this approach significantly increases execution time, making the inventory extraction process take approximately 45 minutes.

Is there a more efficient way to retrieve the device location without making an API call for each individual UUID?


DNAC Version 2.3.5.5-70026-HF60

3 Replies 3

shane.carnahan
Level 1
Level 1

I have been looking into this and thinking about it. I don't have a great or even a good answer so far. In the /dna/intent/api/v1/network-device API call there is a response for "locationName" but I've run this against 2.3.7.7 and for every device it is "null".

My only thought, so far, would be to pull a device list and then in one go loop through it a pull a list based upon all the IDs at one time. Then go back and cross reference it. Not sure if that will speed things up for you or not. I've used the same API you are using to get the UUID for a device but not the other way around. So far I can't find an API call that would get and return the locationName in one shot. I'll keep searching as time permits and see if I come up with something.

I dont know if this a bug, which remains unfixed, but going back i recall this locationName being null on the network-device call for a while now. I think this was teh case i once found https://bst.cisco.com/quickview/bug/CSCwb70990

The '/dna/intent/api/v1/site' followed by parsing the list of sites and pull the membership per site'/dna/intent/api/v1/membership/{}'.format(site['id']) - should returns the site general memberships and the devices associated with the site.

In past threads raised it was mentioned to use "Get Device Detail", it should provide the location and hopefully does not return null.

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

A thought here might be to use the /dna/intent/api/v1/network-device/{startIndex}/{recordsToReturn} (https://developer.cisco.com/docs/dna-center/2-3-5/get-network-device-by-pagination-range/). It says it includes the location, location name, hostname, etc in the return. Looks like you could grab up to 500 records at a time. Then cross reference based upon hostname or some other common value. Just a thought while looking through some of the different API calls that are available.