Network ResourcesDistributed Port Group Related Interfaces

GetFreeIp

GET/zstack/v1/l3-networks/ip/free
GET zstack/v1/l3-networks/{l3NetworkUuid}/ip/free
GET zstack/v1/l3-networks/ip-ranges/{ipRangeUuid}/ip/free

Headers

Authorization: OAuth the-session-uuid

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/l3-networks/ip/free?l3NetworkUuid=c8cd63a1882331a9a5ee83e5d9b265ec&ipRangeUuid=10fc8508fd723e63bcc57b8bb6d7a133&limit=100.0
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/l3-networks/c8cd63a1882331a9a5ee83e5d9b265ec/ip/free?l3NetworkUuid=c8cd63a1882331a9a5ee83e5d9b265ec&ipRangeUuid=10fc8508fd723e63bcc57b8bb6d7a133&limit=100.0
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/l3-networks/ip-ranges/10fc8508fd723e63bcc57b8bb6d7a133/ip/free?l3NetworkUuid=c8cd63a1882331a9a5ee83e5d9b265ec&ipRangeUuid=10fc8508fd723e63bcc57b8bb6d7a133&limit=100.0

Request Parameters

Name

Type

Location

Description

Allowed Values

Starting Version

l3NetworkUuid

String

query

The L3 network UUID.Note: Either l3NetworkUuid or ipRangeUuid is required.

 

0.6

ipRangeUuid

String

query

The IP range UUID.Note: Either l3NetworkUuid or ipRangeUuid is required.

 

0.6

start

String

query

Optional. The start IP address.

 

0.6

ipRangeType

String

query

Optional. The address type.

  • Normal
  • AddressPool

3.9.0

ipVersion

Integer

query

Optional. The IP version.

  • 4
  • 6

3.10.0

limit

int

query

Optional. The maximum number of IP addresses to return.

 

0.6

systemTags

List

query

Optional. The system tags.

 

0.6

userTags

List

query

Optional. The user tags.

 

0.6

API Response

Sample Response

{
  "inventories": [
    {
      "ipRangeUuid": "662d600a4b644f98a0c49df2e5430d69",
      "ip": "10.20.10.5",
      "netmask": "255.255.255.0",
      "gateway": "10.20.10.1"
    },
    {
      "ipRangeUuid": "662d600a4b644f98a0c49df2e5430d69",
      "ip": "10.20.10.6",
      "netmask": "255.255.255.0",
      "gateway": "10.20.10.1"
    },
    {
      "ipRangeUuid": "662d600a4b644f98a0c49df2e5430d69",
      "ip": "10.20.10.10",
      "netmask": "255.255.255.0",
      "gateway": "10.20.10.1"
    }
  ]
}
NameTypeDescriptionStarting Version
errorErrorCodeThe error code. If not null, the operation fails, or vice versa. For more information, see error.0.6
inventoryL3NetworkInventorySee inventory.0.6

error

NameTypeDescriptionStarting Version
codeStringThe error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001.0.6
descriptionStringThe brief description of the error.0.6
detailsStringThe details about the error.0.6
elaborationStringThe reserved field. Default value: null.0.6
opaqueLinkedHashMapThe reserved field. Default value: null.0.6
causeErrorCodeThe root error, which is the associated root cause of the current error. If no root error exists, this parameter is null.0.6

inventory

NameTypeDescriptionStarting Version
ipRangeUuidStringThe IP range UUID.0.6
ipString 0.6
netmaskString 0.6
gatewayString 0.6

SDK Sample

Java SDK

GetFreeIpAction action = new GetFreeIpAction();
action.l3NetworkUuid = "c8cd63a1882331a9a5ee83e5d9b265ec";
action.ipRangeUuid = "10fc8508fd723e63bcc57b8bb6d7a133";
action.limit = 100.0;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetFreeIpAction.Result res = action.call();

Python SDK

GetFreeIpAction action = GetFreeIpAction()
action.l3NetworkUuid = "c8cd63a1882331a9a5ee83e5d9b265ec"
action.ipRangeUuid = "10fc8508fd723e63bcc57b8bb6d7a133"
action.limit = 100.0
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetFreeIpAction.Result res = action.call()