An attendee of our Building Network Automation Solutions online course decided to automate his NSX-T environment and sent me this question:
I will be working on NSX-T quite a lot these days and I was wondering how could I automate my workflow (lab + production) to produce a certain consistency in my work.
I’ve seen that VMware relies a lot on PowerShell and I’ve haven’t invested a lot in that yet … and I would like to get more skills and become more proficient using Python right now.
Always select the most convenient tool for the job, and regardless of personal preferences PowerShell seems to be the one to use in this case. I know people who totally automated their NSX-V deployments using it (see also the PowerNSX part of our free PowerShell for Networking Engineers webinar).
I never looked into the details of NSX-T API, but NSX-V (and everything else vSphere-related) seems to use SOAP (XML-based) REST API, and NSX-T is probably no different. While it’s possible to interface with that API in any programming language, dealing with XML and its namespaces quickly becomes a major pain, so it’s much easier if someone already wrote the wrappers that provide high-level functionality like Anthony Burke and Nick Bradford did for NSX-V.
Last year VMware release PowerShell cmdlets for NSX-T, so that would be the natural way to go.
What do you think I should do? Start trying to reinvent my wheel that could help me to get more skills in Python and scratch my head? Or not reinvent the wheel but still scratch my head and stick with PowerShell?
multiple frameworks / tools already exist, such as:
- NSX-T for Java: https://code.vmware.com/web/sdk/2.3/nsx-t-java
- NSX-T for Python: https://code.vmware.com/web/sdk/2.3/nsx-t-python
- NSX-T Terraform Provider: https://www.terraform.io/docs/providers/nsxt/index.html
- PowerCLI: http://cloudmaniac.net/powercli-nsx-t-module/
Also, the NSX-T API is described in an OpenAPI format, and as such you can download easily as a Postman Collection (here: http://cloudmaniac.net/nsx-t-api-embedded-documentation-and-postman-collection/).
I hope this can help.
In my experience you can use any of those but the more flexible (not necessarily the most easy) approach is to do dev against the API (and the OpenAPI that NSX-T provides is AMAZING) instead of being tied to the SDKs, but as you also comment is good to "not reinvent the wheel", meaning that you should be aware of the tools and their scope and just develop the things that are missing or complex chaining of them to fulfill your use case.