Retrieve identifying information for an NSX Cluster IP Pool

As a follow up to the thoroughly engrossing post on accessing the NSX API from Powershell, here is another example ripped from the pages of Twitter.

While the API lists “Add an IP Pool” and “Query IP Pool Details” and there is a section on querying IP Pools for an SSL VPN appliance, listing all IP Pools for an NSX Controller is left out.

You do get

GET https://nsxmgr-ip/api/2.0/services/ipam/pools/

to query IP Pools, and we have seen before that /scope/globalroot-0 will retrieve all objects for a particular API branch, a little combining reveals

GET https://nsxmgr-ip/api/2.0/services/ipam/pools/scope/globalroot-0

Will retrieve all of the IP pools configured. Using the Powershell API routine posted before:

C:\$pool = NSXAPI https://nsxmgr-ip/api/2.0/services/ipam/pools/scope/globalroot-0
C:\$pool.ipamAddressPools.ipamAddressPool
objectId : ipaddresspool-2
objectTypeName : IpAddressPool
vsmUuid : 422598C3-F970-86D2-1D4B-139E932D95DD
revision : 1
type : type
name : VTEP-1-Management
scope : scope
clientHandle :
extendedAttributes :
totalAddressCount : 10
usedAddressCount : 3
usedPercentage : 30
prefixLength : 24
gateway : 192.168.150.2
dnsSuffix :
dnsServer1 :
dnsServer2 :
ipPoolType : ipv4
ipRanges : ipRanges
subnetId : subnet-2
.....

This entry was posted in Computing, Network, PowerShell, Scripting, Virtualization, VMware. Bookmark the permalink.

Leave a Reply