NSX Automation Part 2 – Create CSV from Existing Logical Switches

In order to manipulate existing Logical Switches, we will need to gather all the information for those Logical Switches.  This post shows how to get that data from the NSX manager and put it in a CSV file.  We will massage that file in later posts for other uses.

 

Items required:

  • curl
  • python
  • python setuptools
  • xmlutils.py

 

The Command:

ndaher@ubuntu:~$ curl -k -u admin:Password! -H 'content-type: application/xml' -X GET -o logswitches.xml https://nsxman.local/api/2.0/vdn/virtualwires ; xml2csv --input "logswitches.xml" --output "logswitches.out" --tag "virtualWire" ; sed s/\"//g logswitches.out > logswitches.csv

 

 

Permanent link to this article: https://daherlabs.mywire.org/wordpress/?p=476

Leave a Reply

Your email address will not be published.