netbox-community / Device-Type-Library-Import

This library is intended to assist with importing device and module types into NetBox from the NetBox Community DeviceType-Library
https://github.com/netbox-community/devicetype-library
MIT License
256 stars 77 forks source link

Increase import speed #29

Closed dalrrard closed 2 years ago

dalrrard commented 3 years ago

I refactored all of the import functions to use bulk POSTs and list GETs instead of individual ones. In my testing, it took around 3.5 hours to import all device types before the change and about 20 minutes to import all device types after these modifications. I couldn't find any style guidelines, so let me know if anything cosmetic or substantive needs to change. Thanks!

ndom91 commented 3 years ago

Damn has the device library gotten that big?! 😂

dalrrard commented 3 years ago

Either that or I have terrible internet! I imagine you could have it cache each type of import for every device in some lists and do giant bulk POSTs for each import type at the very end of the run instead of the smaller ones I'm doing for each device individually to save some more time, but I haven't tested it out.