Since vSphere 7.0, it has been much simpler to correlate between an NSX network segment defined in NSX Manager and its representation as a vSphere Distributed Virtual Portgroup (DVG) in vCenter Server as demonstrated in screenshot below using the vSphere UI.
With the additional NSX information such as NSX Transport Zone ID, Transport Zone ID Name, Logical Switch ID, Segment Name and VNI (Virtual Network Identifier), users can streamline debugging and troubleshooting issues with their network team by quickly providing this relevant information.
I recently had a user ask about retrieving the VNI information for a given NSX segment in vCenter Server using PowerCLI, so here is a quick snippet including other NSX information for those interested.
The NSX Transport Zone Name, ID and Logical Switch ID and Segment ID is part of the config property of a DVPG. Unlike the other NSX properties which are found on the main DVPG resource, the VNI property is under the defaultPortConfig property.
If we put all of this together, here is an example PowerCLI snippet that will return all DVPGs that are NSX backed and output the respective NSX properties as mentioned above:
$dvpgs = Get-VDPortgroup $results = @() foreach ($dvpg in $dvpgs) { if($dvpg.ExtensionData.Config.BackingType -eq "nsx") { $tmp = [pscustomobject]@{ Name = $dvpg.Name TransportZoneUuid = $dvpg.ExtensionData.Config.TransportZoneUuid TransportZoneName = $dvpg.ExtensionData.Config.TransportZoneName LogicalSwitchUuid = $dvpg.ExtensionData.Config.LogicalSwitchUuid SegmentId = $dvpg.ExtensionData.Config.SegmentId VNI = $dvpg.ExtensionData.Config.DefaultPortConfig.VNI.Value } $results+=$tmp } } $results
Here is an example output from the script:
Thanks for the comment!