The title says it all: how do you get the vCNS/NSX Manager Edge ID from vCloud Director?
vCNS/NSX Manager edge IDs are formatted as <edge-n> for instance edge-202 whereas vCD edge IDs are expressed in URN format for instance urn:vcloud:vapp:490af534-1491-452e-8ed6-a5eb54447dac of which the numeric part is also used to build the Href object reference; a URL like format such as https://vcd.domain.local/api/vApp/vapp-490af534-1491-452e-8ed6-a5eb54447dac
Warning: any network deployed by vCD should not be changed directly from vCNS/NSX Manager (although possible) because vCD wouldn’t know about them and, more importantly, any subsequent change made by vCD will override changes made from vCNS/NSX Manager! Fine if it’s Dev/Test or your lab but I wouldn’t do it in Prod if I were you 🙂
So why would you want to make changes from NSX Manager ? Well there are some corner cases where these is required; for instance if you wish to configure Advanced NSX features on vApp or Org VDC networks on vCD 8.0/8.10 edges; it’s still not available through the vCD GUI so you must do it from the NSX vCenter plug-in. For instance, dynamic routing protocols such as OSPF and BGP are not available (at the time of writing this article) from vCloud Director.
Where’s the problem?
Wait, so where’s the problem you might say? All you need is to search by name under NSX Edges (Networking&Security > NSX Edges) or vCNS Manager (View: Edges) and off you go, make your changes. Well, yes and no, let me explain why with the following example.
The first problem I see with this approach is that, if the Edge is renamed in vCD (because I can) it doesn’t get renamed on vCNS Manager. For instance:
Edge ORG10-VSE04 on vCD
is in reality ORG03-VSE02 in vCNS Manager
So searching by name it’s not really very reliable, you might still be able to figure it out by comparing assigned IP addresses but what if you need to achieve this through automation? We need a safe and reliable way to identify the correct edges between many others, and that’s the vCNS/NSX Manager objectId attribute. This unfortunately does not match the vCD ID
and in vCNS Manager it’s edge-22 as we saw in the previous screenshot.
Long story short (my workaround)
After spending some time digging into the vCD APIs, turns out that the vCNS Manager reference is not exposed through the vCD APIs however it is stored in the vCD Database, table gateway column backing_ref
**** Update 06/12/2016 ****
Starting with vCD APIs version 9.0 (basically vCD 8.0 SP and later) the edge ID backing reference (edge-n) is already exposed for Org VDC Edges, but it isn’t for vApp edges. However things remain the same in my setup since I’m running vCD 5.5 and not 8.10 SP.
See the two following screenshots for comparison:
Version 5.5 Version 9.0
Running the following SQL query will return you the vCNS Manager Id which you can later use with PowerNSX (for instance) if you’re looking to automate the configuration.
<br /> USE VCDDB<br /> SELECT name,backing_ref&amp;amp;nbsp;FROM gateway<br /> WHERE name = 'ORG10-VSE04'<br />
I really hope that the next version of vCD SP coming out (8.20) will have that field exposed 😉