I’ve been rolling out quite a few vRealize Network Insight deployments (labs, Proof-of-Concepts) and while the installation of NI is a cake walk (see automated installer here), add the data sources can be time consuming if you have a bunch of switches and/or other data sources which need to be imported.

The Network Insight team has done a very good job on the architecture of the product, where they are using all kinds of cool API calls to push and retrieve information from the NI backend. This is mostly done via JavaScript, which means the users browser is executing those API calls. That means that you can decipher a bit of information when looking at those calls. I dove into the API when wanted to automate the Network Insight installation and found a bunch of very handy API calls.

One of those calls was /api/management/dataSource/setDataSource which was called when I added a data source. This call basically contained all the information needed to add a data source to the system. A quick reproduction showed that I could use the same API call to add a data source via the API!

After a bit of testing, reverse engineering of the API calls and try to break it, I came up with a PowerShell script that uses a CSV as input to add a set of data sources. It’s a raw script which needs a bit of work, but it already has saved me a bunch of manual and repetitive work.

Considering I’ve had several questions about bulk importing data sources into vRealize Network Insight and I’ve successfully been using the script on my latest Network Insight endeavors, I decided to put it online on my GitHub repository:

gitHub-download-button NSX

Instructions can be found in the README of that directory, which should be enough to get you going. Here’s an example of how it will look after putting together the CSV and running the import:

network-insight-bulk-import

If this is something useful for you and you have ideas on how to improve it, please provide me with feedback (PRs are accepted, of course! 😉 ).



Share the wealth!