In this recipe, we take a look at automating NSX with Orchestrator.
You need NSX installed and connected to your vCenter. There are some good YouTube videos that show the essential setup. For more information, refer to https://www.youtube.com/watch?v=CATcY254pP8 .
You will need the latest version of the NSX plugin (as of writing, version 1.0.4) and to install it in your Orchestrator. You can find it here by logging into www.vmware.com and then selecting NSX and then under Drivers & Tools.
To understand NSX, there is a wonderful Hands-on Labs from VMware that you may like to work through: http://www.vmware.com/products/nsx/nsx-hol.html .
This recipe is broken up into two sections: configuring and an example.
https://[FQDN
NSX appliance]
.
We will now create a new logical switch in NSX with default settings (unicast and IP discovery). You need an existing Transport Zone for this to work.
The NSX plugin is a useful tool for automating; however, the workflows that come with the plugin are mostly designed for vRealize Automation. It's important to understand that they return mostly an NSX object, meaning that they need to be modified before they can be used in vSphere or vRA XaaS:
If you want to use the workflows for some kind of automation, you need to use some extra programming. As we saw earlier, you need to provide all the MoRefs of each object. Here is an example of how to do this:
To get all the scopes (Transport Zones) use the following code:
scopes=NSXVdnScopeManager.getVdnScopes(connection);
To show-case this, I have provided an example workflow 11.01 Create logical switch
and its two actions: getAllScopes
and getScopeIDFromName
.
NSX is directly integrated into vRA and is configured and used through the vCenter Endpoint.
To integrate NSX, you need to configure the vCenter Endpoint to allow for NSX integration as well as create a vRO Infrastructure Endpoint, follow these instructions:
https://[FQDN NSX]
.For vRA to be able to use the NSX, we need to have at least one transport zone as well as one Distributed Logical Router (DLR).
Please note that you could attach the DLR directly onto the external network if this network would have a VLAN ID other than 0. In my example, I used an extra Edge.
The following is an example of the setup that allows me to create NSX networks that can connect to iNet (see the following figure):
220Net
). Use an IP from your external network (192.168.220.90
).Transport
), use the IP that will be the gateway for the Logical Network (192.168.10.1
)As the Gateway, you select the Uplink and enter the IP of your external Network Gateway (192.168.220.2
).
Transport
)Transport
), and use an IP from the Logical Network (192.168.10.10
)Transport
) with the DNS setting of your External Network (220Net – Mylab.local
). Set the IP of your Edge (192.168.10.1
) as the Gateway.220Net
) using its Gateway.