Query for IP Addresses
When you use
Automation Assembler
to create a deployment, VMware Aria Automation
allocates IP addresses to manage resources. To
identify the IP addresses that have been allocated, you query the network IP range. You can
only reserve IP addresses that have not been allocated.- Verify that all general prerequisites and prerequisites for theAutomation AssemblerInfrastructure as a Service (IaaS) service have been satisfied. See Prerequisites for API Use Case Examples.
You create network IP ranges with
a range of IP addresses. The following procedure shows how to determine the IP addresses
in a range that are available.
- To get the ID of the network range that you want to use, list the internal network IP ranges in your deployment.curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" "$url/iaas/api/network-ip-ranges?apiVersion=$api_version" | jq "."Examine the response to find the ID of the network IP range that you want to use.
- Assign a variable for the network IP range ID.ip_range_id='<your_network_ip_range_id>'
- To query IP ranges associated with a particular network and get information such as IP availability, you can use one of the following commands:
- If you have the network IP range ID, use:curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" "$url/iaas/api/network-ip-ranges/$ip_range_id?apiVersion=$api_version" | jq "."
- If you have the network ID, use:curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" "$url/iaas/api/networks/<your_network_id>/network-ip-ranges?apiVersion=$api_version" | jq "."
- If you have the networking fabric ID, use:curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" "$url/iaas/api/fabric-networks/<your_fabric_network_id>/network-ip-ranges?apiVersion=$api_version" | jq "."
- If you have the networking fabric for vSphere ID, use:curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" "$url/iaas/api/fabric-networks-vsphere/<your_fabric_network_vsphere_id>/network-ip-ranges?apiVersion=$api_version" | jq "."
Examine the response to see the number of allocated and available IP addresses. If the number of available IP addresses is too low, check another network IP range until you find one with enough IP addresses to fit your needs. - Use the network IP range ID to query the status of IP addresses within the range.curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" "$url/iaas/api/network-ip-ranges/$ip_range_id/ip-addresses?apiVersion=$api_version" | jq "."Examine the result. All IP addresses appear with"ipAddressStatus": "ALLOCATED"or"ipAddressStatus": "RELEASED"and are not available.
Query for IP addresses within an
IP range
The example query requests and responses
show how to find allocated IP addresses.
Assign variables.
$ url='https://appliance.domain.com' $ api_version='2021-07-15'
List the internal network IP ranges in
your deployment.
$ curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" "$url/iaas/api/network-ip-ranges?apiVersion=$api_version" | jq "."
A snippet of the response shows the
network IP ranges with their IDs.
... "startIPAddress": "fe45::2", "orgId": "8040fbde-5ff0-41f3-a8a1-9e25a3311be2", "endIPAddress": "fe45::fffe", "createdAt": "2023-02-28", "ipVersion": "IPv6", "name": "rangeIPv6", "id": "703a02df-3b6d-4ad7-b146-582b398055f2", ...
Assign the variable for the network IP
range ID.
$ ip_range_id='703a02df-3b6d-4ad7-b146-582b398055f2'
Query the IP range associated with the
network IP range ID.
$ curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" "$url/iaas/api/network-ip-ranges/$ip_range_id?apiVersion=$api_version" | jq "."
A snippet of the response shows the
number of available and allocated IPv6 addresses. It also shows the IP version and
the start and end of the IP address sequence.
{ "numberOfAllocatedIPs": 2, "numberOfAvailableIPs": 65531, "numberOfReleasedIPs": 0, "totalNumberOfIPs": 65533, "numberOfUserAllocatedIPs": 0, "numberOfSystemAllocatedIPs": 2, "startIPAddress": "fe45::2", "endIPAddress": "fe45::fffe", "ipVersion": "IPv6", "name": "rangeIPv6", "id": "703a02df-3b6d-4ad7-b146-582b398055f2", "createdAt": "2023-02-28", "updatedAt": "2023-02-28", "organizationId": "8040fbde-5ff0-41f3-a8a1-9e25a3311be2", "orgId": "8040fbde-5ff0-41f3-a8a1-9e25a3311be2", "_links": { "self": { "href": "/iaas/api/network-ip-ranges/703a02df-3b6d-4ad7-b146-582b398055f2" } } }
The following example shows how to query
of IP ranges associated with fabric network ID
33c2bbb5-5b26-4a5a-87c6-9e96db72451d
.curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" "$url/iaas/api/fabric-networks/33c2bbb5-5b26-4a5a-87c6-9e96db72451d/network-ip-ranges?apiVersion=$api_version" | jq "."
The response shows two IP ranges with
details about associated IPv4 addresses.
"content": [ { "numberOfAllocatedIPs": 0, "numberOfAvailableIPs": 10, "numberOfReleasedIPs": 0, "totalNumberOfIPs": 10, "numberOfUserAllocatedIPs": 0, "numberOfSystemAllocatedIPs": 0, "startIPAddress": "10.10.10.1", "endIPAddress": "10.10.10.10", "ipVersion": "IPv4", "name": "range-1", "id": "578ec19a-2b52-497e-8777-029b57d685ab", "createdAt": "2023-03-15", "updatedAt": "2023-03-29", "orgId": "89db05f7-1b93-4bd8-b395-1772d50813a4", "_links": { "fabric-networks": { "hrefs": [ "/iaas/api/fabric-networks/33c2bbb5-5b26-4a5a-87c6-9e96db72451d", "/iaas/api/fabric-networks/51f1ed6c-3db3-4877-857d-2bcc84f81897" ] }, "self": { "href": "/iaas/api/network-ip-ranges/578ec19a-2b52-497e-8777-029b57d685ab" } } }, { "numberOfAllocatedIPs": 0, "numberOfAvailableIPs": 10, "numberOfReleasedIPs": 0, "totalNumberOfIPs": 10, "numberOfUserAllocatedIPs": 0, "numberOfSystemAllocatedIPs": 0, "startIPAddress": "10.10.10.11", "endIPAddress": "10.10.10.20", "ipVersion": "IPv4", "name": "range-2", "id": "95a0053c-b57f-4500-a59b-970042f4ce8c", "createdAt": "2023-03-29", "updatedAt": "2023-03-29", "orgId": "89db05f7-1b93-4bd8-b395-1772d50813a4", "_links": { "fabric-networks": { "hrefs": [ "/iaas/api/fabric-networks/33c2bbb5-5b26-4a5a-87c6-9e96db72451d" ] }, "self": { "href": "/iaas/api/network-ip-ranges/95a0053c-b57f-4500-a59b-970042f4ce8c" }, "fabric-network": { "href": "/iaas/api/fabric-networks/33c2bbb5-5b26-4a5a-87c6-9e96db72451d" } } } ], "totalElements": 2, "numberOfElements": 2 }
If the IP range has a sufficient number
of available IP addresses, get more information about the IP addresses in that
range.
$ curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" "$url/iaas/api/network-ip-ranges/$ip_range_id/ip_addresses?apiVersion=$api_version" | jq "."
The response provides details about the
umavailable IP addresses including their IP version and how they were allocated.
- "ipAllocationType": "SYSTEM"indicates that an IP address was automatically allocated for use in a deployment.
- "ipAllocationType": "USER"indicates that an IP address was manually allocated for use by a user.
{ "content": [ { "ipAddress": "fe4500:10:118:136:fcd8:d68d:9701:4440", "ipAddressDecimalValue": 168561938, "ipVersion": "IPv6", "ipAddressStatus": "ALLOCATED", "ipAllocationType": "SYSTEM", "id": "e83d9a43-ea2d-428c-ae75-da396c1bb205", "createdAt": "2023-02-21", "updatedAt": "2023-02-21", "orgId": "8040fbde-5ff0-41f3-a8a1-9e25a3311be2", "_links": { "network-ip-range": { "href": "/iaas/api/network-ip-ranges/4e6b700c-5d07-4247-b0c7-ae13d1d7188a" }, "self": { "href": "/iaas/api/network-ip-ranges/4e6b700c-5d07-4247-b0c7-ae13d1d7188a/ip-addresses/e83d9a43-ea2d-428c-ae75-da396c1bb205" }, "connected-resource": { "href": "/iaas/api/machines/83ede26c-656a-4a08-8716-bea29c21d3f4/network-interfaces/051d92e6-5729-495d-ad66-9e443e5747c8" } } }, { "ipAddress": "fe45:10:118:136:fcd8:d68d:9701:4450", "ipAddressDecimalValue": 168561941, "ipVersion": "IPv6", "ipAddressStatus": "ALLOCATED", "ipAllocationType": "SYSTEM", "id": "439f9c9b-2b2f-484d-8867-2d7b541ddeec", "createdAt": "2023-02-22", "updatedAt": "2023-02-22", "orgId": "8040fbde-5ff0-41f3-a8a1-9e25a3311be2", "_links": { "network-ip-range": { "href": "/iaas/api/network-ip-ranges/4e6b700c-5d07-4247-b0c7-ae13d1d7188a" }, "self": { "href": "/iaas/api/network-ip-ranges/4e6b700c-5d07-4247-b0c7-ae13d1d7188a/ip-addresses/439f9c9b-2b2f-484d-8867-2d7b541ddeec" }, "connected-resource": { "href": "/iaas/api/machines/81633fba-e86b-4bfa-a06f-3c4f7a754568/network-interfaces/1c26b194-2862-4d7e-be9c-9881d6cdb871" } } } ], "totalElements": 2, "numberOfElements": 2 }
You can allocate any of the IP addresses
in the network range except
fe4500:10:118:136:fcd8:d68d:9701:4440
and fe45:10:118:136:fcd8:d68d:9701:4450
. IP addresses with the status
"ipAddressStatus": "ALLOCATED"
or "ipAddressStatus":
"RELEASED"
are not available for allocation. You can allocate any of the
remaining the IP addresses in the range. See Allocate IP Addresses.