VMware Networking Community
ASIS_Intl
Contributor
Contributor

Not Sure What I'm Looking For...how to automate actions on NSX Components?

I have just been tasked with finding a way to make code deployments to new web servers easier. In this case, easier means that there is a way for developers to take down the instance of a web-server in a NSX load-balancer pool, apply code changes, and bring the instance of that web-server back up. We were talking about specially crafted URLs, among other things. Unfortunately, as I'm sure many of you reading this know - it's easy to come up with an idea/solution, but starting on implementation from the ground-up without structure can be a bit tricky.

We own the vRealize Suite (Log Insight and vROM in use, vRA/vOR are not - haven't had a need for them...yet) and Network Insight. I was thinking that these "specially crafted URLs" could make up a RESTful call to NSX to take down an instance of a virtual server or specific pool member. In looking at this, I'm seeing mention of using vRealize Orchestrator to manage advanced NSX task flows. Am I looking in the right direction here?

Alternatively, due to our current lack of automation requirements, is there an easier way to do this? Crafting a single RESTful call to the load-balancer to complete one of the aforementioned tasks seems easy enough...but what's the best way to manage that? If I need upwards of 10 of these "links" for different actions that all trigger RESTful calls?

I have an idea of what to do, but I need either a push in a direction or verification that vRealize Orchestrator will be the tool that makes this fairly simple doable.

Thanks in advance VMware communities!

Reply
0 Kudos
1 Reply
jasnyder
Hot Shot
Hot Shot

I think you can make this work.  Within the vRO NSX plugin there are OOTB workflows for in /Library/NSX/NSX Workflows/  In there you will find two relevant workflows - Add VMs to existing load balancer pools and Remove VMs from load balancer pools.

The vRO plugin is essentially a scripting interface for use in vRO to front-end the NSX API.  You could make these calls directly to the NSX manager if you wanted to do that.  You could also make REST calls to vRO to kick off these workflows or some version of them to do what you want.  There is a lot of value to using vRO because you can test the workflow independent of the calling code, making it a bit easier to iterate on development & test.  Plus you can change the logic external to whatever management code you're using to automate the task.  And finally, the NSX plugin calls (and API for that matter) expect to receive managed object references to vSphere objects (i.e. a VM reference, such as vm-151), and resolving those without vRO in the middle would require separate calls to the vSphere Web Services API.  vRO can act as an abstraction for both with its copious amounts of OOTB vCenter workflows available.  This would be a benefit if you wanted to destroy the VMs through vRO workflows as well as possibly create them.

The vRO REST API is fairly clean, so you should be able to get going quickly.

Check the vRO coding guide here and the REST API reference here.

If you have any questions on vRO workflows don't hesitate to ask.