Document navigation

L3 Network Operations

CreateL3Network

API Request

URLs
POST zstack/v1/l3-networks
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "name": "Test-L3Network",
    "type": "L3BasicNetwork",
    "l2NetworkUuid": "bb059728e72f3ff1b3ae2fc9caba3dce",
    "category": "Private",
    "system": false,
    "enableIPAM": true
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"Test-L3Network","type":"L3BasicNetwork","l2NetworkUuid":"bb059728e72f3ff1b3ae2fc9caba3dce","category":"Private","system":false,"enableIPAM":true}}' \
http://localhost:8080/zstack/v1/l3-networks
Request Parameters
Name Type Location Description Optional Value Starting Version
name String body (contained in the params structure) The L3 network name. 0.6
description String body (contained in the params structure) Optional. The detailed description of the L3 network. 0.6
type String body (contained in the params structure) Optional. The L3 network type.
  • L3BasicNetwork
  • L3VpcNetwork
0.6
l2NetworkUuid String body (contained in the params structure) The L2 network UUID. 0.6
ipVersion String body (contained in the params structure) Optional. The IP version.
  • 4
  • 6
4.6.21
system boolean body (contained in the params structure) Optional. Whether the L3 network can be applied to appliance VM instances. 0.6
dnsDomain String body (contained in the params structure) Optional. The DNS domain. 0.6
resourceUuid String body (contained in the params structure) Optional. The resource UUID. If specified, the L3 network will use the specified value as UUID. 0.6
systemTags List body Optional. The system tags. 0.6
userTags List body Optional. The user tags. 0.6
category String body (contained in the params structure) Optional. The network type, which must be used with the system tags. If system is set to false, this parameter can be set to Public or Private.
  • Public
  • Private
  • System
2.2
tagUuids List body (contained in the params structure) The tag UUID list. 4.6.21
enableIPAM Boolean body(contained in the paramsstructure) Whether to enable the IP address management. 4.6.21
Note:
  • When you create an L3 network in ZStack Cloud, you can specify the port mirroring network by adding the mirrorNetwork option to SystemTags.
    • Format of the mirrorNetwork option: mirrorNetwork::{L3NetworkVOUuid}
    • Example: mirrorNetwork::1c707a63817b4f29b1235fa1f76c0ccc
  • When you create an L3 network in ZStack Cloud, you can record the Huawei SDN virtual router associated with the VPC gateway by adding the logicalRouterUuid option to SystemTags.
    • Format of the logicalRouterUuid option: logicalRouterUuid::{L3NetworkVOUuid}
    • Example: logicalRouterUuid::ecb4a71e0e32476da948a583ea0a220d

API Response

Sample Response
{
  "inventory": {
    "name": "Test-L3Network",
    "l2NetworkUuid": "1bfca1892b674df28d26d9a3c0f609f9",
    "category": "Private"
  }
}
Name Type Description Starting Version
success boolean 4.6.21
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 0.6
inventory L3NetworkInventory See inventory. 0.6
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 0.6
name String The resource name. 0.6
description String The detailed description of the resource. 0.6
type String The L3 network type. 0.6
zoneUuid String The zone UUID. 0.6
l2NetworkUuid String The L2 network UUID. 0.6
state String The state of the L3 network. 0.6
dnsDomain String The DNS domain. 0.6
system Boolean Whether the L3 network can be applied to appliance VM instances. 0.6
category String The network type, which must be used with the system tags. If system is set to true, this parameter can be set to Public or Private. 0.6
ipVersion Integer The IP version. 3.1.0
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
dns List The DNS server. 0.6
ipRanges List See ipRanges. 0.6
networkServices List See networkServices. 0.6
hostRoute List See hostRoute. 2.3
#ipRanges
Name Type Description Starting Version
uuid String The resource UUID. 0.6
l3NetworkUuid String The L3 network UUID. 0.6
name String The resource name. 0.6
description String The detailed description of the resource. 0.6
startIp String 0.6
endIp String 0.6
netmask String 0.6
prefixLen String The prefix length. 3.1.0
gateway String 0.6
networkCidr String 0.6
ipVersion Integer The IP version. 3.1.0
addressMode String The allocation mode of the IPv6 address. 3.1.0
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
ipRangeType IpRangeType See ipRangeType. 4.6.21
#ipRangeType
Name Type Description Starting Version
Normal IpRangeType Normal IP range. 4.6.21
AddressPool IpRangeType IP range pool. 4.6.21
#networkServices
Name Type Description Starting Version
l3NetworkUuid String The L3 network UUID. 0.6
networkServiceProviderUuid String The network service provider UUID. 0.6
networkServiceType String 0.6
#hostRoute
Name Type Description Starting Version
id Long 2.3
l3NetworkUuid String The L3 network UUID. 2.3
prefix String 2.3
nexthop String 2.3
createDate Timestamp The creation date. 2.3
lastOpDate Timestamp The last operation date. 2.3

SDK Sample

Java SDK
CreateL3NetworkAction action = new CreateL3NetworkAction();
action.name = "Test-L3Network";
action.type = "L3BasicNetwork";
action.l2NetworkUuid = "bb059728e72f3ff1b3ae2fc9caba3dce";
action.category = "Private";
action.system = false;
action.enableIPAM = true;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateL3NetworkAction.Result res = action.call();
Python SDK
CreateL3NetworkAction action = CreateL3NetworkAction()
action.name = "Test-L3Network"
action.type = "L3BasicNetwork"
action.l2NetworkUuid = "bb059728e72f3ff1b3ae2fc9caba3dce"
action.category = "Private"
action.system = false
action.enableIPAM = true
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateL3NetworkAction.Result res = action.call()

DeleteL3Network

API Request

URLs
DELETE zstack/v1/l3-networks/{uuid}?deleteMode={deleteMode}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 9e78fa4cfc8a49baadb763cd62ac6a3f" \
-X DELETE http://localhost:8080/zstack/v1/l3-networks/76490f9cd26d4c8a9501cc5a5312aa99?deleteMode=Permissive
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 0.6
deleteMode String body Optional. The delete mode. 0.6
systemTags List body Optional. The system tags. 0.6
userTags List body Optional. The user tags. 0.6

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
    "error": {
        "code": "SYS.1001",
        "description": "A message or a operation timeout",
        "details": "Create VM on KVM timeout after 300s"
    }
}

SDK Sample

Java SDK
DeleteL3NetworkAction action = new DeleteL3NetworkAction();
action.uuid = "c19ee03770c6486b85abc58ea10f017a";
action.deleteMode = "Permissive";
action.sessionId = "b8b93037f8064e219bdcbe9dd9a9f366";
DeleteL3NetworkAction.Result res = action.call();
Python SDK
DeleteL3NetworkAction action = DeleteL3NetworkAction()
action.uuid = "8c4a39676be64072b20e7b7dc4b0ccc7"
action.deleteMode = "Permissive"
action.sessionId = "e0e4140009fc4b95af7197bffc64f7c0"
DeleteL3NetworkAction.Result res = action.call()

QueryL3Network

API Request

URLs
GET zstack/v1/l3-networks
GET zstack/v1/l3-networks/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 98858a4b613f46a4815c34c1c930b34e" \
-X GET http://localhost:8080/zstack/v1/l3-networks
Note:
For example, query the private L3 network.
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 98858a4b613f46a4815c34c1c930b34e" \
-X GET http://localhost:8080/zstack/v1/l3-networks?q=category=Private
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth c1148725103644bc8e2879d72fa47389" \
-X GET http://localhost:8080/zstack/v1/l3-networks/9d119c003bb54d4781443bbc7febcd7f

Queryable Fields

You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryL3Network, and pressing the Tab key.

API Response

Sample Response
{
  "inventories": [
    {
      "name": "Test-L3Network",
      "l2NetworkUuid": "8bcf5b824378406494d81ffdae56bde3"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 0.6
inventories List See inventories. 0.6
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6
#inventories
Name Type Description Starting Version
uuid String The resource UUID. 0.6
name String The resource name. 0.6
description String The detailed description of the resource. 0.6
type String The L3 network type. 0.6
zoneUuid String The zone UUID. 0.6
l2NetworkUuid String The L2 network UUID. 0.6
state String The state of the L3 network. 0.6
dnsDomain String The DNS domain. 0.6
system Boolean Whether the L3 network can be applied to appliance VM instances. 0.6
category String The network type, which must be used with the system tags. If system is set to true, this parameter can be set to Public or Private. 0.6
ipVersion Integer The IP version. 3.1.0
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
dns List The DNS server. 0.6
ipRanges List See ipRanges. 0.6
networkServices List See networkServices. 0.6
hostRoute List See hostRoute. 2.3
#ipRanges
Name Type Description Starting Version
uuid String The resource UUID. 0.6
l3NetworkUuid String The L3 network UUID. 0.6
name String The resource name. 0.6
description String The detailed description of the resource. 0.6
startIp String 0.6
endIp String 0.6
netmask String 0.6
prefixLen String The prefix length. 3.1.0
gateway String 0.6
networkCidr String 0.6
ipVersion Integer The IP version. 3.1.0
addressMode String The allocation mode of the IPv6 address. 3.1.0
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
#networkServices
Name Type Description Starting Version
l3NetworkUuid String The L3 network UUID. 0.6
networkServiceProviderUuid String The network service provider UUID. 0.6
networkServiceType String 0.6
#hostRoute
Name Type Description Starting Version
id Long 2.3
l3NetworkUuid String The L3 network UUID. 2.3
prefix String 2.3
nexthop String 2.3
createDate Timestamp The creation date. 2.3
lastOpDate Timestamp The last operation date. 2.3

SDK Sample

Java SDK
QueryL3NetworkAction action = new QueryL3NetworkAction();
action.conditions = asList();
action.sessionId = "58f4bcc9b20f46bfaba379ca0c739535";
QueryL3NetworkAction.Result res = action.call();
Python SDK
QueryL3NetworkAction action = QueryL3NetworkAction()
action.conditions = []
action.sessionId = "2f99e245b0f04712941da401ecab7173"
QueryL3NetworkAction.Result res = action.call()

UpdateL3Network

API Request

URLs
PUT zstack/v1/l3-networks/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "updateL3Network": {
    "name": "Test-L3Network"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateL3Network":{"name":"Test-L3Network"}}' \
http://localhost:8080/zstack/v1/l3-networks/a1a3a4bea5e73628b591081fde9f019a/actions
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 0.6
name String body (contained in the updateL3Network structure) Optional. The L3 network name. 0.6
description String body (contained in the updateL3Network structure) Optional. The detailed description of the L3 network. 0.6
system Boolean body (contained in the updateL3Network structure) Optional. Whether the L3 network can be applied to appliance VM instances. 0.6
dnsDomain String body (contained in the updateL3Network structure) Optional. The DNS domain. 2.6.0
systemTags List body Optional. The system tags. 0.6
userTags List body Optional. The user tags. 0.6
category String body (contained in the updateL3Network structure) Optional. The network type, which must be used with the system tags. If system is set to true, this parameter can be set to Public or Private.
  • Public
  • Private
  • System
2.2

API Response

Sample Response
{
  "inventory": {
    "uuid": "dd370da0d6fa49288fc119b35db36b7c",
    "name": "Test-L3Network"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 0.6
inventory L3NetworkInventory See inventory. 0.6
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 0.6
name String The resource name. 0.6
description String The detailed description of the resource. 0.6
type String 0.6
zoneUuid String The zone UUID. 0.6
l2NetworkUuid String The L2 network UUID 0.6
state String 0.6
dnsDomain String 0.6
system Boolean 0.6
category String 0.6
ipVersion Integer The IP version. 3.1.0
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
dns List 0.6
ipRanges List See ipRanges. 0.6
networkServices List See networkServices. 0.6
hostRoute List See hostRoute. 2.3
#ipRanges
Name Type Description Starting Version
uuid String The resource UUID. 0.6
l3NetworkUuid String The L3 network UUID. 0.6
name String The resource name. 0.6
description String The detailed description of the resource. 0.6
startIp String 0.6
endIp String 0.6
netmask String 0.6
prefixLen String The prefix length. 3.1.0
gateway String 0.6
networkCidr String 0.6
ipVersion Integer The IP version. 3.1.0
addressMode String The allocation mode of the IPv6 address. 3.1.0
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
#networkServices
Name Type Description Starting Version
l3NetworkUuid String The L3 network UUID. 0.6
networkServiceProviderUuid String The network service provider UUID. 0.6
networkServiceType String 0.6
#hostRoute
Name Type Description Starting Version
id Long 2.3
l3NetworkUuid String The L3 network UUID. 2.3
prefix String 2.3
nexthop String 2.3
createDate Timestamp The creation date. 2.3
lastOpDate Timestamp The last operation date. 2.3

SDK Sample

Java SDK
UpdateL3NetworkAction action = new UpdateL3NetworkAction();
action.uuid = "88d2a1d687974c0ea0e102c276739e39";
action.name = "Test-L3Network";
action.sessionId = "dae0914beced4293bd336fe443ed0d2b";
UpdateL3NetworkAction.Result res = action.call();
Python SDK
UpdateL3NetworkAction action = UpdateL3NetworkAction()
action.uuid = "3210b12187464e35bfdc50d8d4e2d1d0"
action.name = "Test-L3Network"
action.sessionId = "9e0b1d4240ef4421804612b01c98d7b8"
UpdateL3NetworkAction.Result res = action.call()

GetL3NetworkTypes

API Request

URLs
GET zstack/v1/l3-networks/types
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 3a142b201e9342abbb5864a0ea48992e" \
-X GET http://localhost:8080/zstack/v1/l3-networks/types
Request Parameters
Name Type Location Description Optional Value Starting Version
systemTags List query Optional. The system tags. 0.6
userTags List query Optional. The user tags. 0.6

API Response

Sample Response
{
"l3NetworkTypes": [
"L3BasicNetwork"
  ]
}
Name Type Description Starting Version
types List 0.6
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 0.6
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6

SDK Sample

Java SDK
GetL3NetworkTypesAction action = new GetL3NetworkTypesAction();
action.sessionId = "9105437ebb27461fbae36ecb9336ceba";
GetL3NetworkTypesAction.Result res = action.call();
Python SDK
GetL3NetworkTypesAction action = GetL3NetworkTypesAction()
action.sessionId = "a69bae9c3cad4209b042956b23c70af7"
GetL3NetworkTypesAction.Result res = action.call()

ChangeL3NetworkState

API Request

URLs
PUT zstack/v1/l3-networks/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
"changeL3NetworkState": {
"stateEvent": "enable"
  },
"systemTags": [],
"userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"changeL3NetworkState":{"stateEvent":"enable"}}' \
http://localhost:8080/zstack/v1/l3-networks/a8744f1ba60c33f3a2c912c077f41fe5/actions
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 0.6
stateEvent String body (contained in the changeL3NetworkState structure) The state. Options: enable and disable.
  • enable
  • disable
0.6
systemTags List body Optional. The system tags. 0.6
userTags List body Optional. The user tags. 0.6

API Response

Sample Response
{
"inventory": {
"name": "Test-L3Network",
"l2NetworkUuid": "dfae4bce43694f4d9fc0ba5cdf4e38bd"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 0.6
inventory L3NetworkInventory See inventory. 0.6
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 0.6
name String The resource name. 0.6
description String The detailed description of the resource. 0.6
type String 0.6
zoneUuid String The zone UUID. 0.6
l2NetworkUuid String The L2 network UUID. 0.6
state String 0.6
dnsDomain String 0.6
system Boolean 0.6
category String 0.6
ipVersion Integer The IP version. 3.1.0
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
dns List 0.6
ipRanges List See ipRanges. 0.6
networkServices List See networkServices. 0.6
hostRoute List See hostRoute. 2.3
#ipRange
Name Type Description Starting Version
uuid String The resource UUID. 0.6
l3NetworkUuid String The L3 network UUID. 0.6
name String The resource name. 0.6
description String The detailed description of the resource. 0.6
startIp String 0.6
endIp String 0.6
netmask String 0.6
prefixLen String The prefix length. 3.1.0
gateway String 0.6
networkCidr String 0.6
ipVersion Integer The IP version. 3.1.0
addressMode String The allocation mode of the IPv6 address. 3.1.0
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
#networkServices
Name Type Description Starting Version
l3NetworkUuid String The L3 network UUID. 0.6
networkServiceProviderUuid String The network service provider UUID. 0.6
networkServiceType String 0.6
#hostRoute
Name Type Description Starting Version
id Long 2.3
l3NetworkUuid String The L3 network UUID. 2.3
prefix String 2.3
nexthop String 2.3
createDate Timestamp The creation date. 2.3
lastOpDate Timestamp The last operation date. 2.3

SDK Sample

Java SDK
ChangeL3NetworkStateAction action = new ChangeL3NetworkStateAction();
action.uuid = "eb0849bf0e57400da650a09f2e852260";
action.stateEvent = "enable";
action.sessionId = "be8ec965ebd94169ba713c42dc079af9";
ChangeL3NetworkStateAction.Result res = action.call();
Python SDK
ChangeL3NetworkStateAction action = ChangeL3NetworkStateAction()
action.uuid = "d8a1565df89748a2a21ef87b9c9f5be7"
action.stateEvent = "enable"
action.sessionId = "7b8417b9ee3b4df8a21acc8e7c41a7f9"
ChangeL3NetworkStateAction.Result res = action.call()

GetL3NetworkDhcpIpAddress

API Request

URLs
GET zstack/v1/l3-networks/{l3NetworkUuid}/dhcp-ip
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/82cae6542d3b3e7ea50dab8681f3785c/dhcp-ip
Request Parameters
Name Type Location Description Optional Value Starting Version
l3NetworkUuid String url The L3 network UUID. 0.6
systemTags List query Optional. The system tags. 0.6
userTags List query Optional. The user tags. 0.6

API Response

Sample Response
{
"ip": "192.168.100.3"
}
Name Type Description Starting Version
ip String The IP address. 0.6
ip6 String The IPv6 address. 3.10.0
success boolean Whether the API succeeds. 0.6
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 0.6
error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6

SDK Sample

Java SDK
GetL3NetworkDhcpIpAddressAction action = new GetL3NetworkDhcpIpAddressAction();
action.l3NetworkUuid = "1c311c313859434f8586d4288a31952e";
action.sessionId = "dd1a8993de0e41e18d8718ea2e2d8259";
GetL3NetworkDhcpIpAddressAction.Result res = action.call();
Python SDK
GetL3NetworkDhcpIpAddressAction action = GetL3NetworkDhcpIpAddressAction()
action.l3NetworkUuid = "4970a85c53a24e35a55f44830058e719"
action.sessionId = "50fd78e250d94c5d944a5fa1a5d6bde0"
GetL3NetworkDhcpIpAddressAction.Result res = action.call()

AddDnsToL3Network

API Request

URLs
POST zstack/v1/l3-networks/{l3NetworkUuid}/dns
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "dns": "8.8.8.8"
  },
  "systemTags": [],
  "userTags": []
}
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"dns":"8.8.8.8"}}' \
http://localhost:8080/zstack/v1/l3-networks/0b8da8c298ed3960925abbcc4f913da8/dns
Request Parameters
Name Type Location Description Optional Value Starting Version
l3NetworkUuid String url The L3 network UUID. 0.6
dns String url The DNS address. 0.6
systemTags List body Optional. The system tags. 0.6
userTags List body Optional. The user tags. 0.6

API Response

Sample Response
{
  "inventory": {
    "name": "Test-L3Network",
    "l2NetworkUuid": "08f7b0b577a84c28968ddce5a9377c5d",
    "dns": [
      "8.8.8.8"
    ]
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 0.6
inventory L3NetworkInventory See inventory. 0.6
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 0.6
name String The resource name. 0.6
description String The detailed description of the resource. 0.6
type String 0.6
zoneUuid String The zone UUID. 0.6
l2NetworkUuid String The L2 network UUID. 0.6
state String 0.6
dnsDomain String 0.6
system Boolean 0.6
category String 0.6
ipVersion Integer The IP version. 3.1.0
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
dns List 0.6
ipRanges List See ipRanges. 0.6
networkServices List See networkServices. 0.6
hostRoute List See hostRoute. 2.3
#ipRanges
Name Type Description Starting Version
uuid String The resource UUID. 0.6
l3NetworkUuid String The L3 network UUID. 0.6
name String The resource name. 0.6
description String The detailed description of the resource. 0.6
startIp String 0.6
endIp String 0.6
netmask String 0.6
prefixLen String The prefix length. 3.1.0
gateway String 0.6
networkCidr String 0.6
ipVersion Integer The IP version. 3.1.0
addressMode String The allocation mode of the IPv6 address. 3.1.0
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
#networkServices
Name Type Description Starting Version
l3NetworkUuid String The L3 network UUID. 0.6
networkServiceProviderUuid String The network service provider UUID. 0.6
networkServiceType String 0.6
#hostRoute
Name Type Description Starting Version
id Long 2.3
l3NetworkUuid String The L3 network UUID. 2.3
prefix String 2.3
nexthop String 2.3
createDate Timestamp The creation date. 2.3
lastOpDate Timestamp The last operation date. 2.3

SDK Sample

Java SDK
AddDnsToL3NetworkAction action = new AddDnsToL3NetworkAction();
action.l3NetworkUuid = "80bfafb9c4534a2593fcda534ee6414f";
action.dns = "8.8.8.8";
action.sessionId = "0a24af3791134b81bba960844b3aa899";
AddDnsToL3NetworkAction.Result res = action.call();
Python SDK
AddDnsToL3NetworkAction action = AddDnsToL3NetworkAction()
action.l3NetworkUuid = "17ecd7a47dc34f1ba01df5180480e264"
action.dns = "8.8.8.8"
action.sessionId = "30e00bf1296244cd98c93dec6182ab72"
AddDnsToL3NetworkAction.Result res = action.call()

RemoveDnsFromL3Network

API Request

URLs
DELETE/v1/l3-networks/{l3NetworkUuid}/dns/{dns}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 209fa412351946a6bef267d423f4e53c" \
-X DELETE http://localhost:8080/zstack/v1/l3-networks/d96f7d4c0506435a9a1aa7394976c0b2/dns/8.8.4.4?
Request Parameters
Name Type Location Description Optional Value Starting Version
l3NetworkUuid String url The L3 network UUID. 0.6
dns String url The DNS address. 0.6
systemTags List body Optional. The system tags. 0.6
userTags List body Optional. The user tags. 0.6

API Response

Sample Response
{
"inventory": {
"name": "Test-L3Network",
"l2NetworkUuid": "535aea9c1be24fb9b172fa1955341685",
"dns": []
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 0.6
inventory L3NetworkInventory See inventory. 0.6
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 0.6
name String The resource name. 0.6
description String The detailed description of the resource. 0.6
type String 0.6
zoneUuid String The zone UUID. 0.6
l2NetworkUuid String The L2 network UUID. 0.6
state String 0.6
dnsDomain String 0.6
system Boolean 0.6
category String 0.6
ipVersion Integer The IP version. 3.1.0
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
dns List 0.6
ipRanges List See ipRanges. 0.6
networkServices List See networkServices. 0.6
hostRoute List See hostRoute. 2.3
#ipRanges
Name Type Description Starting Version
uuid String The resource UUID. 0.6
l3NetworkUuid String The L3 network UUID. 0.6
name String The resource name. 0.6
description String The detailed description of the resource. 0.6
startIp String 0.6
endIp String 0.6
netmask String 0.6
prefixLen String The prefix length. 3.1.0
gateway String 0.6
networkCidr String 0.6
ipVersion Integer The IP version. 3.1.0
addressMode String The allocation mode of the IPv6 address. 3.1.0
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
#networkServices
Name Type Description Starting Version
l3NetworkUuid String The L3 network UUID. 0.6
networkServiceProviderUuid String The network service provider UUID. 0.6
networkServiceType String 0.6
#hostRoute
Name Type Description Starting Version
id Long 2.3
l3NetworkUuid String The L3 network UUID. 2.3
prefix String 2.3
nexthop String 2.3
createDate Timestamp The creation date. 2.3
lastOpDate Timestamp The last operation date. 2.3

SDK Sample

Java SDK
RemoveDnsFromL3NetworkAction action = new RemoveDnsFromL3NetworkAction();
action.l3NetworkUuid = "3e9227b9ecbd42bba0f3a4620f5655d2";
action.dns = "8.8.4.4";
action.sessionId = "f3e42d2a37ed4c42a6ce7d192af94e05";
RemoveDnsFromL3NetworkAction.Result res = action.call();
Python SDK
RemoveDnsFromL3NetworkAction action = RemoveDnsFromL3NetworkAction()
action.l3NetworkUuid = "4046beb7d6164cb3843fb5fac2f86ac3"
action.dns = "8.8.4.4"
action.sessionId = "e9fd57376378422e9b58ada9be59185c"
RemoveDnsFromL3NetworkAction.Result res = action.call()

AddHostRouteToL3Network

API Request

URLs
POST zstack/v1/l3-networks/{l3NetworkUuid}/hostroute
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "prefix": "169.254.169.254/32",
    "nexthop": "192.168.1.254"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"prefix":"169.254.169.254/32","nexthop":"192.168.1.254"}}' \
http://localhost:8080/zstack/v1/l3-networks/45d86c07f10437c6bf3161bae9974bb7/hostroute
Request Parameters
Name Type Location Description Optional Value Starting Version
l3NetworkUuid String url The L3 network UUID. 2.3
prefix String body (contained in the params structure) 2.3
nexthop String body (contained in the params structure) 2.3
systemTags List body Optional. The system tags. 2.3
userTags List body Optional. The user tags. 2.3

API Response

Sample Response
{
  "inventory": {
    "name": "Test-L3Network",
    "l2NetworkUuid": "7dfdf976ef1334fba5c3b475104011b2",
    "dns": [
      "8.8.8.8"
    ],
    "hostRoute": [
      {
        "prefix": "169.254.169.254/32",
        "nexthop": "192.168.1.254"
      }
    ]
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 2.3
inventory L3NetworkInventory See inventory. 2.3
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 0.6
name String The resource name. 0.6
description String The detailed description of the resource. 0.6
type String 0.6
zoneUuid String The zone UUID. 0.6
l2NetworkUuid String The L2 network UUID. 0.6
state String 0.6
dnsDomain String 0.6
system Boolean 0.6
category String 0.6
ipVersion Integer The IP version. 3.1.0
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
dns List 0.6
ipRanges List See ipRanges. 0.6
networkServices List See networkServices. 0.6
hostRoute List See hostRoute. 2.3
#ipRanges
Name Type Description Starting Version
uuid String The resource UUID. 0.6
l3NetworkUuid String The L3 network UUID. 0.6
name String The resource name. 0.6
description String The detailed description of the resource. 0.6
startIp String 0.6
endIp String 0.6
netmask String 0.6
prefixLen String The prefix length. 3.1.0
gateway String 0.6
networkCidr String 0.6
ipVersion Integer The IP version. 3.1.0
addressMode String The allocation mode of the IPv6 address. 3.1.0
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
#networkServices
Name Type Description Starting Version
l3NetworkUuid String The L3 network UUID. 0.6
networkServiceProviderUuid String The network service provider UUID. 0.6
networkServiceType String 0.6
#hostRoute
Name Type Description Starting Version
id Long 2.3
l3NetworkUuid String The L3 network UUID. 2.3
prefix String 2.3
nexthop String 2.3
createDate Timestamp The creation date. 2.3
lastOpDate Timestamp The last operation date. 2.3

SDK Sample

Java SDK
AddHostRouteToL3NetworkAction action = new AddHostRouteToL3NetworkAction();
action.l3NetworkUuid = "45d86c07f10437c6bf3161bae9974bb7";
action.prefix = "169.254.169.254/32";
action.nexthop = "192.168.1.254";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddHostRouteToL3NetworkAction.Result res = action.call();
Python SDK
AddHostRouteToL3NetworkAction action = AddHostRouteToL3NetworkAction()
action.l3NetworkUuid = "45d86c07f10437c6bf3161bae9974bb7"
action.prefix = "169.254.169.254/32"
action.nexthop = "192.168.1.254"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddHostRouteToL3NetworkAction.Result res = action.call()

RemoveHostRouteFromL3Network

API Request

URLs
DELETE zstack/v1/l3-networks/{l3NetworkUuid}/hostroute?prefix={prefix}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/l3-networks/8648a70a245232c5a1bee9ae408419e5/hostroute?prefix=169.254.169.254/32
Request Parameters
Name Type Location Description Optional Value Starting Version
l3NetworkUuid String url The L3 network UUID. 2.3
prefix String body 2.3
systemTags List body Optional. The system tags. 2.3
userTags List body Optional. The user tags. 2.3

API Response

Sample Response
{
  "inventory": {
    "name": "Test-L3Network",
    "l2NetworkUuid": "15e1e6a016f43a5688ca3d3445076309",
    "dns": []
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 2.3
inventory L3NetworkInventory See inventory. 2.3
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 0.6
name String The resource name. 0.6
description String The detailed description of the resource. 0.6
type String 0.6
zoneUuid String The zone UUID. 0.6
l2NetworkUuid String The L2 network UUID. 0.6
state String 0.6
dnsDomain String 0.6
system Boolean 0.6
category String 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
dns List 0.6
ipRanges List See ipRanges. 0.6
networkServices List See networkServices. 0.6
hostRoute List See hostRoute. 2.3
#ipRanges
Name Type Description Starting Version
uuid String The resource UUID. 0.6
l3NetworkUuid String The L3 network UUID. 0.6
name String The resource name. 0.6
description String The detailed description of the resource. 0.6
startIp String 0.6
endIp String 0.6
netmask String 0.6
gateway String 0.6
networkCidr String 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
#networkServices
Name Type Description Starting Version
l3NetworkUuid String The L3 network UUID. 0.6
networkServiceProviderUuid String The network service provider UUID. 0.6
networkServiceType String 0.6
#hostRoute
Name Type Description Starting Version
id Long 2.3
l3NetworkUuid String The L3 network UUID. 2.3
prefix String 2.3
nexthop String 2.3
createDate Timestamp The creation date. 2.3
lastOpDate Timestamp The last operation date. 2.3

SDK Sample

Java SDK
RemoveHostRouteFromL3NetworkAction action = new RemoveHostRouteFromL3NetworkAction();
action.l3NetworkUuid = "8648a70a245232c5a1bee9ae408419e5";
action.prefix = "169.254.169.254/32";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RemoveHostRouteFromL3NetworkAction.Result res = action.call();
Python SDK
RemoveHostRouteFromL3NetworkAction action = RemoveHostRouteFromL3NetworkAction()
action.l3NetworkUuid = "8648a70a245232c5a1bee9ae408419e5"
action.prefix = "169.254.169.254/32"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
RemoveHostRouteFromL3NetworkAction.Result res = action.call()

GetFreeIp

API Request

URLs
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 Optional Value Starting Version
l3NetworkUuid String query Optional. The L3 network UUID.
Note: Make sure that at least one of l3NetworkUuid and ipRangeUuid is not null.
0.6
ipRangeUuid String query Optional. The IP range UUID.
Note: Make sure that at least one of l3NetworkUuid and ipRangeUuid is not null.
0.6
start String query The start value. 0.6
ipRangeType String query Optional. The IP range type.
  • Normal
  • AddressPool
3.9.0
ipVersion Integer query Optional. The IP version.
  • 4
  • 6
3.10.0
limit int query Optional. The count limit. 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"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 0.6
inventory L3NetworkInventory See inventory. 0.6
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6
#inventory
Name Type Description Starting Version
ipRangeUuid String The IP range UUID. 0.6
ip String 0.6
netmask String 0.6
gateway String 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()

CheckIpAvailability

API Request

URLs
GET zstack/v1/l3-networks/{l3NetworkUuid}/ip/{ip}/availability
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/44fc110c3d87326299b46975aacb1705/ip/192.168.10.100/availability?arpCheck=false&ipRangeCheck=true
Request Parameters
Name Type Location Description Optional Value Starting Version
l3NetworkUuid String url The L3 network UUID. 0.6
ip String url The IP address. 0.6
systemTags List query Optional. The system tags. 0.6
userTags List query Optional. The user tags. 0.6
arpCheck Boolean query Optional. Use arping to check. 5.1.0
ipRangeCheck Boolean query Optional. Check available IP address range in database. 5.1.0

API Response

Sample Response
{
"available": true
}
Name Type Description Starting Version
available boolean Whether the API is available. 0.6
reason String Reason 3.4
success boolean Whether the API succeeds. 0.6
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 0.6
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6

SDK Sample

Java SDK
CheckIpAvailabilityAction action = new CheckIpAvailabilityAction();
action.l3NetworkUuid = "44fc110c3d87326299b46975aacb1705";
action.ip = "192.168.10.100";
action.arpCheck = false;
action.ipRangeCheck = true;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CheckIpAvailabilityAction.Result res = action.call();
Python SDK
CheckIpAvailabilityAction action = CheckIpAvailabilityAction()
action.l3NetworkUuid = "44fc110c3d87326299b46975aacb1705"
action.ip = "192.168.10.100"
action.arpCheck = false
action.ipRangeCheck = true
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CheckIpAvailabilityAction.Result res = action.call()

GetIpAddressCapacity

API Request

URLs
GET zstack/v1/ip-capacity
Headers
Authorization: OAuth the-session-uuid s
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/ip-capacity?ipRangeUuids=6bf57331ebe433389c6c230153ac5d8d&all=false
Request Parameters
Name Type Location Description Starting Version
zoneUuids List query Optional. The zone UUIDs. 0.6
l3NetworkUuids List query Optional. The L3 network UUIDs. 0.6
ipRangeUuids List query Optional. The IP range UUIDs. 0.6
all boolean query Optional. Global settings. 0.6
systemTags List query Optional. The system tags. 0.6
userTags List query Optional. The user tags. 0.6

API Response

Sample Response
{
  "totalCapacity": 20.0,
  "availableCapacity": 15.0,
  "usedIpAddressNumber": 5.0,
  "ipv4TotalCapacity": 0.0,
  "ipv4AvailableCapacity": 0.0,
  "ipv4UsedIpAddressNumber": 0.0,
  "ipv6TotalCapacity": 0.0,
  "ipv6AvailableCapacity": 0.0,
  "ipv6UsedIpAddressNumber": 0.0,
  "capacityData": [
    {
      "resourceUuid": "68b9a1c74c4c33c7b818e4c14bdea0a7",
      "totalCapacity": 20.0,
      "availableCapacity": 15.0,
      "usedIpAddressNumber": 5.0,
      "ipv4TotalCapacity": 0.0,
      "ipv4AvailableCapacity": 0.0,
      "ipv4UsedIpAddressNumber": 0.0,
      "ipv6TotalCapacity": 0.0,
      "ipv6AvailableCapacity": 0.0,
      "ipv6UsedIpAddressNumber": 0.0
    }
  ],
  "resourceType": "L3NetworkVO"
}
Name Type Description Starting Version
totalCapacity long The total IP capacity. 0.6
availableCapacity long The available IP capacity. 0.6
usedIpAddressNumber Long The number of used IP addresses. 3.10.0
ipv4TotalCapacity long The IPv4 address capacity. 3.10.0
ipv4AvailableCapacity long The available IPv4 address capacity. 3.10.0
ipv4UsedIpAddressNumber long The number of used IPv4 addresses. 3.10.0
ipv6TotalCapacity long The IPv6 address capacity. 3.10.0
ipv6AvailableCapacity long The available IPv6 address capacity. 3.10.0
ipv6UsedIpAddressNumber long The number of used IPv6 addresses. 3.10.0
resourceType String The type of the queried resources, such as the IP range, L3 network, and zone. 3.9.0
success boolean Whether the API succeeds. 0.6
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 0.6
capacityData List See capacityData. 3.9.0
error ErrorCode See error. 0.6
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6
#capacityData
Name Type Description Starting Version
resourceUuid String The resource UUID. 3.9.0
totalCapacity long The total IP capacity. 3.9.0
availableCapacity long The available IP capacity. 3.9.0
usedIpAddressNumber long The number of used IP addresses. 3.9.0
ipv4TotalCapacity long The total IPv4 address capacity. 3.10.0
ipv4AvailableCapacity long The available IPv4 address capacity. 3.10.0
ipv4UsedIpAddressNumber long The used IPv4 address capacity. 3.10.0
ipv6TotalCapacity long The total IPv6 address capacity. 3.10.0
ipv6AvailableCapacity long The available IPv6 address capacity. 3.10.0
ipv6UsedIpAddressNumber long The used IPv6 address capacity. 3.10.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6

SDK Sample

Java SDK
GetIpAddressCapacityAction action = new GetIpAddressCapacityAction();
action.ipRangeUuids = asList("454d69e78a7849b487ce2266c64cc6e0");
action.all = false;
action.sessionId = "58287d81bc0d441cac85579ed46cb4dd";
GetIpAddressCapacityAction.Result res = action.call();
Python SDK
GetIpAddressCapacityAction action = GetIpAddressCapacityAction()
action.ipRangeUuids = [2ef2089aa3ba4929bfde743c9d1cb674]
action.all = false
action.sessionId = "349872e1c8ad445bbc0b024ac6ac0fbb"
GetIpAddressCapacityAction.Result res = action.call()

AddIpRange

API Request

URLs
POST zstack/v1/l3-networks/{l3NetworkUuid}/ip-ranges
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "name": "Test-IP-Range",
    "startIp": "192.168.100.10",
    "endIp": "192.168.100.250",
    "netmask": "255.255.255.0",
    "gateway": "192.168.100.1",
    "ipRangeType": "Normal"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"Test-IP-Range","startIp":"192.168.100.10","endIp":"192.168.100.250","netmask":"255.255.255.0","gateway":"192.168.100.1","ipRangeType":"Normal"}}' http://localhost:8080/zstack/v1/l3-networks/acc0573590db3297814610cab774b60b/ip-ranges
Request Parameters
Name Type Location Description Optional Value Starting Version
l3NetworkUuid String url The L3 network UUID. 0.6
name String body (contained in the params structure) The L3 network name. 0.6
description String body (contained in the params structure) Optional. The detailed description of the L3 network. 0.6
startIp String body (contained in the params structure) The start IP address. 0.6
endIp String body (contained in the params structure) The end IP address. 0.6
netmask String body (contained in the params structure) The netmask. 0.6
gateway String body (contained in the params structure) The gateway. 0.6
ipRangeType String body (contained in the params structure) Optional. The IP range type.
  • Normal
  • AddressPool
3.9.0
resourceUuid String body (contained in the params structure) Optional. The resource UUID. If specified, the L3 network will use the specified value as UUID. 0.6
systemTags List body Optional. The system tags. 0.6
userTags List body Optional. The user tags. 0.6
Note:
  • When you add an IP range in ZStack Cloud, you can specify the DHCP server address by adding the DhcpServer option to SystemTags.
    • Format of the DhcpServer option: flatNetwork::DhcpServer::{%s}::ipUuid::{%s}
    • Example: flatNetwork::DhcpServer::192.168.1.100::ipUuid::null

API Response

Sample Response
{
  "inventory": {
    "l3NetworkUuid": "4cbec970df744e258726f71de79e6497",
    "name": "Test-IP-Range",
    "startIp": "192.168.100.10",
    "endIp": "192.168.100.250",
    "netmask": "255.255.255.0",
    "gateway": "192.168.100.1"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 0.6
inventory IpRangeInventory See inventory. 0.6
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 0.6
l3NetworkUuid String The L3 network UUID. 0.6
name String The resource name. 0.6
description String The detailed description of the resource. 0.6
startIp String 0.6
endIp String 0.6
netmask String 0.6
prefixLen String The prefix length. 3.1.0
gateway String 0.6
networkCidr String 0.6
ipVersion Integer The IP version. 3.1.0
addressMode String The allocation mode of the IPv6 address. 3.1.0
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
ipRangeType IpRangeType See ipRangeType. 3.9.0
#ipRangeType
Name Type Description Starting Version
Normal IpRangeType 3.9.0
AddressPool IpRangeType 3.9.0

SDK Sample

Java SDK
AddIpRangeAction action = new AddIpRangeAction();
action.l3NetworkUuid = "acc0573590db3297814610cab774b60b";
action.name = "Test-IP-Range";
action.startIp = "192.168.100.10";
action.endIp = "192.168.100.250";
action.netmask = "255.255.255.0";
action.gateway = "192.168.100.1";
action.ipRangeType = "Normal";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddIpRangeAction.Result res = action.call();
Python SDK
AddIpRangeAction action = AddIpRangeAction()
action.l3NetworkUuid = "acc0573590db3297814610cab774b60b"
action.name = "Test-IP-Range"
action.startIp = "192.168.100.10"
action.endIp = "192.168.100.250"
action.netmask = "255.255.255.0"
action.gateway = "192.168.100.1"
action.ipRangeType = "Normal"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddIpRangeAction.Result res = action.call()

DeleteIpRange

API Request

URLs
DELETE/v1/l3-networks/ip-ranges/{uuid}?deleteMode={deleteMode}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 1872261fb9824d9f9dd73a991cf05a44" \
-X DELETE http://localhost:8080/zstack/v1/l3-networks/ip-ranges/a2a9f85d22914afe95a195b63143830d?deleteMode=Permissive
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The UUID of the IP range. 0.6
deleteMode String body Optional. The delete mode. 0.6
systemTags List body Optional. The system tags. 0.6
userTags List body Optional. The user tags. 0.6

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
    }
}

SDK Sample

Java SDK
DeleteIpRangeAction action = new DeleteIpRangeAction();
action.uuid = "6d1f44d0fe1440189eb293f18d7bf682";
action.deleteMode = "Permissive";
action.sessionId = "4a3745cb42f5430f874c6f6c4b298e95";
DeleteIpRangeAction.Result res = action.call();
Python SDK
DeleteIpRangeAction action = DeleteIpRangeAction()
action.uuid = "0f1fcf2e779543baa416deb89eeeb2db"
action.deleteMode = "Permissive"
action.sessionId = "d07fb42a181d43dda2b6992536b02804"
DeleteIpRangeAction.Result res = action.call()

QueryIpRange

API Request

URLs
GET zstack/v1/l3-networks/ip-ranges
GET /v1/l3-networks/ip-ranges/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 8f7b1e0396c54646a4b37affdfdda079" \
-X GET http://localhost:8080/zstack/v1/l3-networks/ip-ranges?q=uuid=887227aa5d5c49e2a8137b79dad3738a
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 60a5dfda1a9843809415eb28f2550f94" \
-X GET http://localhost:8080/zstack/v1/l3-networks/ip-ranges/17684784fcc04571a47eb24dc2eb9638

Queryable Fields

You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryIpRange, and pressing the Tab key.

API Response

Sample Response
{
"inventories": [
    {
"l3NetworkUuid": "9a72daf0034443aa81864e593f0f5b32",
"name": "Test-IPRange",
"networkCidr": "192.168.10.0/24"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 0.6
inventories List See inventories. 0.6
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6
#inventories
Name Type Description Starting Version
uuid String The resource UUID. 0.6
l3NetworkUuid String The L3 network UUID. 0.6
name String The resource name. 0.6
description String The detailed description of the resource. 0.6
startIp String 0.6
endIp String 0.6
netmask String 0.6
prefixLen String The prefix length. 3.1.0
gateway String 0.6
networkCidr String 0.6
ipVersion Integer The IP version. 3.1.0
addressMode String The allocation mode of the IPv6 address. 3.1.0
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6

SDK Sample

Java SDK
QueryIpRangeAction action = new QueryIpRangeAction();
action.conditions = asList("uuid=d5764d7ab9174e5486e55ba805d28675");
action.sessionId = "5357e54aa55a4846ac96972776d3100f";
QueryIpRangeAction.Result res = action.call();
Python SDK
QueryIpRangeAction action = QueryIpRangeAction()
action.conditions = ["uuid=2cda79a574344eeb9f38393253ddf858"]
action.sessionId = "c87d6755153549f6a4e7373b601ac99f"
QueryIpRangeAction.Result res = action.call()

UpdateIpRange

API Request

URLs

PUT zstack/v1/l3-networks/ip-ranges/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
"updateIpRange": {},
"systemTags": [],
"userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateIpRange":{}}' \
http://localhost:8080/zstack/v1/l3-networks/ip-ranges/0ebb3eb1c1e134bea93c2f9ed2e2beef/actions
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 0.6
name String body (contained in the updateIpRange structure) Optional. The L3 network name. 0.6
description String body (contained in the updateIpRange structure) Optional. The detailed description of the L3 network. 0.6
systemTags List body Optional. The system tags. 0.6
userTags List body Optional. The user tags. 0.6

API Response

Sample Response
{
"inventory": {
"l3NetworkUuid": "f7f0ee7b4978413fa36c811e47dd56a3",
"name": "Test-IPRange",
"networkCidr": "192.168.10.0/24"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 0.6
inventory IpRangeInventory See inventory. 0.6
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 0.6
l3NetworkUuid String The L3 network UUID. 0.6
name String The resource name. 0.6
description String The detailed description of the resource. 0.6
startIp String 0.6
endIp String 0.6
netmask String 0.6
prefixLen String The prefix length. 3.1.0
gateway String 0.6
networkCidr String 0.6
ipVersion Integer The IP version. 3.1.0
addressMode String The allocation mode of the IPv6 address. 3.1.0
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6

SDK Sample

Java SDK
UpdateIpRangeAction action = new UpdateIpRangeAction();
action.uuid = "97054a54a1fc4b49ba3d7a5d44b9e385";
action.sessionId = "8644fd2755f148359edff9521b27868b";
UpdateIpRangeAction.Result res = action.call();
Python SDK
UpdateIpRangeAction action = UpdateIpRangeAction()
action.uuid = "2b4499297735445482dc994113574b41"
action.sessionId = "0a16c9ea3e6e4ad9b1ff71a826b67277"
UpdateIpRangeAction.Result res = action.call()

AddIpRangeByNetworkCidr

API Request

URLs
POST zstack/v1/l3-networks/{l3NetworkUuid}/ip-ranges/by-cidr
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "name": "Test-IPRange",
    "networkCidr": "192.168.10.0/24",
    "ipRangeType": "Normal"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"Test-IPRange","networkCidr":"192.168.10.0/24","ipRangeType":"Normal"}}' http://localhost:8080/zstack/v1/l3-networks/c186887bc5e43da7ba42bd5d66eba0cd/ip-ranges/by-cidr
Request Parameters
Name Type Location Description Optional Value Starting Version
name String body (contained in the params structure) The L3 network name. 0.6
description String body (contained in the params structure) Optional. The detailed description of the L3 network. 0.6
l3NetworkUuid String url The L3 network UUID. 0.6
networkCidr String body (contained in the params structure) The network CIDR. 0.6
gateway String body (contained in the params structure) Optional. The gateway. 3.7.0
ipRangeType String body (contained in the params structure) Optional. The IP range type.
  • Normal
  • AddressPool
3.9.0
resourceUuid String body (contained in the params structure) Optional. The resource UUID. If specified, the L3 network will use the specified value as UUID. 0.6
systemTags List body Optional. The system tags. 0.6
userTags List body Optional. The user tags. 0.6
Note:
  • When you add an IP range by specifying a network CIDR in ZStack Cloud, you can specify the DHCP server address by adding the affinityGroup option to SystemTags.
    • Format of the affinityGroup option: flatNetwork::DhcpServer::{%s}::ipUuid::{%s}
    • Example: flatNetwork::DhcpServer::192.168.1.100::ipUuid::null

API Response

Sample Response
{
"inventory": {
"l3NetworkUuid": "4e0926c4fa27455f88c7d94420bf3422",
"name": "Test-IPRange",
"networkCidr": "192.168.10.0/24"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 0.6
inventory IpRangeInventory See inventory. 0.6
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 0.6
l3NetworkUuid String The L3 network UUID. 0.6
name String The resource name. 0.6
description String The detailed description of the resource. 0.6
startIp String 0.6
endIp String 0.6
netmask String 0.6
prefixLen String The prefix length. 3.1.0
gateway String 0.6
networkCidr String 0.6
ipVersion Integer The IP version. 3.1.0
addressMode String The allocation mode of the IPv6 address. 3.1.0
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
ipRangeType IpRangeType See ipRangeType. 3.9.0
#ipRangeType
Name Type Description Starting Version
Normal IpRangeType 3.9.0
AddressPool IpRangeType 3.9.0

SDK Sample

Java SDK
AddIpRangeByNetworkCidrAction action = new AddIpRangeByNetworkCidrAction();
action.name = "Test-IPRange";
action.l3NetworkUuid = "c186887bc5e43da7ba42bd5d66eba0cd";
action.networkCidr = "192.168.10.0/24";
action.ipRangeType = "Normal";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddIpRangeByNetworkCidrAction.Result res = action.call();
Python SDK
AddIpRangeByNetworkCidrAction action = AddIpRangeByNetworkCidrAction()
action.name = "Test-IPRange"
action.l3NetworkUuid = "c186887bc5e43da7ba42bd5d66eba0cd"
action.networkCidr = "192.168.10.0/24"
action.ipRangeType = "Normal"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddIpRangeByNetworkCidrAction.Result res = action.call()

GetL3NetworkMtu

API Request

URLs
GET zstack/v1/l3-networks/{l3NetworkUuid}/mtu
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth dc112a530fd2402cae6b4962f65eae4e" \
-X GET http://localhost:8080/zstack/v1/l3-networks/be54f79eb90f4f929da7fe64e1aea8e4/mtu
Request Parameters
Name Type Location Description Optional Value Starting Version
l3NetworkUuid String url The L3 network UUID. 2.1
systemTags List query Optional. The system tags. 2.1
userTags List query Optional. The user tags. 2.1

API Response

Sample Response
{
  "mtu": 9216.0
}
Name Type Description Starting Version
mtu Integer 2.1
success boolean 2.1
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 2.1
error ErrorCode See error. 2.1
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 2.1
description String The brief description of the error. 2.1
details String The details about the error. 2.1
elaboration String The reserved field. Default value: null. 2.1
opaque LinkedHashMap The reserved field. Default value: null. 2.1
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.1
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 2.1
description String The brief description of the error. 2.1
details String The details about the error. 2.1
elaboration String The reserved field. Default value: null. 2.1
opaque LinkedHashMap The reserved field. Default value: null. 2.1
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.1

SDK Sample

Java SDK
GetL3NetworkMtuAction action = new GetL3NetworkMtuAction();
action.l3NetworkUuid = "fd8d572d777d4383b201ddfce629d50e";
action.sessionId = "0cc5202de3ce4881a305e5fa1d431aaa";
GetL3NetworkMtuAction.Result res = action.call();
Python SDK
GetL3NetworkMtuAction action = GetL3NetworkMtuAction()
action.l3NetworkUuid = "7615cfd154a048dcab07a1114ee6205d"
action.sessionId = "d0f3cf05a49345438a92108d2fd86cfe"
GetL3NetworkMtuAction.Result res = action.call()

SetL3NetworkMtu

API Request

URLs

POST zstack/v1/l3-networks/{l3NetworkUuid}/mtu
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "mtu": 9216.0
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"mtu":9216.0}}' \
http://localhost:8080/zstack/v1/l3-networks/817672c1bb903264a9a41c34332c3145/mtu
Request
Name Type Location Description Optional Value Starting Version
l3NetworkUuid String url The L3 network UUID. 2.1
mtu Integer body (contained in the params structure) 2.1
systemTags List body Optional. The system tags. 2.1
userTags List body Optional. The user tags. 2.1

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK Sample

Java SDK
SetL3NetworkMtuAction action = new SetL3NetworkMtuAction();
action.l3NetworkUuid = "b19ce058b0f54c6d83c14078c0079c2c";
action.mtu = 9216.0;
action.sessionId = "b441c616886c4183a51ba044e35c7d66";
SetL3NetworkMtuAction.Result res = action.call();
Python SDK
SetL3NetworkMtuAction action = SetL3NetworkMtuAction()
action.l3NetworkUuid = "67dc01887dfc4142aabe4221675c1b98"
action.mtu = 9216.0
action.sessionId = "d5188e0801994e3a9dfb3d3ebc2f7a39"
SetL3NetworkMtuAction.Result res = action.call()

GetL3NetworkRouterInterfaceIp

API Request

URLs
GET zstack/v1/l3-networks/{l3NetworkUuid}/router-interface-ip
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/71aa55703e063d9db0f13fa0b285a82b/router-interface-ip
Request Parameters
Name Type Location Description Optional Value Starting Version
l3NetworkUuid String url The L3 network UUID. 2.2
systemTags List query Optional. The system tags. 2.2
userTags List query Optional. The user tags. 2.2

API Response

Sample Response
{
  "routerInterfaceIp": "192.168.0.2"
}
Name Type Description Starting Version
routerInterfaceIp String The IP address of the router on the L3 network. This parameter is valid only when a vRouter is created on a common L3 network, or a VPC vRouter is attached to a VPC network. 2.2
success boolean 2.2
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 2.2
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6

SDK Sample

Java SDK
GetL3NetworkRouterInterfaceIpAction action = new GetL3NetworkRouterInterfaceIpAction();
action.l3NetworkUuid = "23453c09a0f534d5bb10a3267c09aac8";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetL3NetworkRouterInterfaceIpAction.Result res = action.call();
Python SDK
GetL3NetworkRouterInterfaceIpAction action = GetL3NetworkRouterInterfaceIpAction()
action.l3NetworkUuid = "5cece4a676083f6fa3491a068e3e34e6"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetL3NetworkRouterInterfaceIpAction.Result res = action.call()

SetL3NetworkRouterInterfaceIp

API Request

URLs
POST zstack/v1/l3-networks/{l3NetworkUuid}/router-interface-ip
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "routerInterfaceIp": "192.168.10.2"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"routerInterfaceIp":"192.168.10.2"}}' \
http://localhost:8080/zstack/v1/l3-networks/40124528890f368c8752825634144fd5/router-interface-ip
Request Parameters
Name Type Location Description Optional Value Starting Version
l3NetworkUuid String url The L3 network UUID. 2.1
routerInterfaceIp String body (contained in the params structure) 2.1
systemTags List body Optional. The system tags. 2.1
userTags List body Optional. The user tags. 2.1

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK Sample

Java SDK
SetL3NetworkRouterInterfaceIpAction action = new SetL3NetworkRouterInterfaceIpAction();
action.l3NetworkUuid = "00ab12382f544de0ac71b48afe7ecd9c";
action.routerInterfaceIp = "192.168.10.2";
action.sessionId = "279a26540d254f42b7a2320652e6c64b";
SetL3NetworkRouterInterfaceIpAction.Result res = action.call();
Python SDK
SetL3NetworkRouterInterfaceIpAction action = SetL3NetworkRouterInterfaceIpAction()
action.l3NetworkUuid = "3558f265c4204eae93104e3ffa974661"
action.routerInterfaceIp = "192.168.10.2"
action.sessionId = "97c0fdecc551496d86b8861f045df21a"
SetL3NetworkRouterInterfaceIpAction.Result res = action.call()

AddIpv6Range

API Request

URLs
POST zstack/v1/l3-networks/{l3NetworkUuid}/ipv6-ranges
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "name": "Test-IP-Range",
    "startIp": "2002:2001::02",
    "endIp": "2002:2001::FE",
    "gateway": "2002:2001::01",
    "prefixLen": 64,
    "addressMode": "Stateful-DHCP"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"Test-IP-Range","startIp":"2002:2001::02","endIp":"2002:2001::FE","gateway":"2002:2001::01","prefixLen":64.0,"addressMode":"Stateful-DHCP"}}' http://localhost:8080/zstack/v1/l3-networks/b6f82aa00c3f37adba4b349eb427db80/ipv6-ranges
Request Parameters
Name Type Location Description Optional Value Starting Version
l3NetworkUuid String url The L3 network UUID. 3.1.0
name String body (contained in the params structure) The L3 network name. 3.1.0
description String body (contained in the params structure) The detailed description of the L3 network. 3.1.0
startIp String body (contained in the params structure) The start IP address. 3.1.0
endIp String body (contained in the params structure) The end IP address. 3.1.0
gateway String body (contained in the params structure) The gateway. 3.1.0
prefixLen Integer body (contained in the params structure) The prefix length. 3.1.0
addressMode String body (contained in the params structure) The allocation mode of the IPv6 address.
  • SLAAC
  • Stateful-DHCP
  • Stateless-DHCP
3.1.0
resourceUuid String body (contained in the params structure) Optional. The resource UUID. If specified, the L3 network will use the specified value as UUID. 3.1.0
systemTags List body Optional. The system tags. 3.1.0
userTags List body Optional. The user tags. 3.1.0
Note:
  • When you add an IPv6 range in ZStack Cloud, you can specify the DHCP server address by adding the affinityGroup option to SystemTags.
    • Format of the affinityGroup option: flatNetwork::DhcpServer::{%s}::ipUuid::{%s}
    • Example: flatNetwork::DhcpServer::192.168.1.100::ipUuid::null

API Response

Sample Response
{
  "inventory": {
    "l3NetworkUuid": "10d6128c8f473a63889597becc396bba",
    "name": "Test-IP-Range",
    "startIp": "2002:2001::02",
    "endIp": "2002:2001::FE",
    "netmask": "FFFF:FFFF:FFFF:FFFF:0:0:0:0",
	"prefixLen": "64"
    "gateway": "2002:2001::01"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.1.0
inventory IpRangeInventory See inventory. 3.1.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.1.0
description String The brief description of the error. 3.1.0
details String The details about the error. 3.1.0
elaboration String The reserved field. Default value: null. 3.1.0
opaque LinkedHashMap The reserved field. Default value: null. 3.1.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.1.0
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 3.1.0
l3NetworkUuid String The L3 network UUID. 3.1.0
name String The resource name. 3.1.0
description String The detail description of the resource. 3.1.0
startIp String 3.1.0
endIp String 3.1.0
netmask String 3.1.0
prefixLen String The prefix length. 3.1.0
gateway String 3.1.0
networkCidr String 3.1.0
ipVersion Integer The IP version. 3.1.0
addressMode String The allocation mode of the IPv6 address. 3.1.0
createDate Timestamp The creation date. 3.1.0
lastOpDate Timestamp The last operation date. 3.1.0

SDK Sample

Java SDK
AddIpv6RangeAction action = new AddIpv6RangeAction();
action.l3NetworkUuid = "b6f82aa00c3f37adba4b349eb427db80";
action.name = "Test-IP-Range";
action.startIp = "2002:2001::02";
action.endIp = "2002:2001::FE";
action.gateway = "2002:2001::01";
action.prefixLen = 64;
action.addressMode = "Stateful-DHCP";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddIpv6RangeAction.Result res = action.call();
Python SDK
AddIpv6RangeAction action = AddIpv6RangeAction()
action.l3NetworkUuid = "b6f82aa00c3f37adba4b349eb427db80"
action.name = "Test-IP-Range"
action.startIp = "2002:2001::02"
action.endIp = "2002:2001::FE"
action.gateway = "2002:2001::01"
action.prefixLen = 64
action.addressMode = "Stateful-DHCP"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddIpv6RangeAction.Result res = action.call()

AddIpv6RangeByNetworkCidr

API Request

URLs
POST zstack/v1/l3-networks/{l3NetworkUuid}/ipv6-ranges/by-cidr
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "name": "Test-IPRange",
    "networkCidr": "2002:2001::/64",
    "addressMode": "SLAAC"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"Test-IPRange","networkCidr":"2002:2001::/64","addressMode":"SLAAC"}}' http://localhost:8080/zstack/v1/l3-networks/92850b5a66633e2aa8c3a8ae6ebb541d/ipv6-ranges/by-cidr
Request Parameters
Name Type Location Description Optional Value Starting Version
name String body (contained in the params structure) The L3 network name. 3.1.0
description String body (contained in the params structure) Optional. The detailed description of the L3 network. 3.1.0
l3NetworkUuid String url The L3 network UUID. 3.1.0
networkCidr String body (contained in the params structure) The network CIDR. 3.1.0
addressMode String body (contained in the params structure) The allocation mode of the IPv6 address.
  • SLAAC
  • Stateful-DHCP
  • Stateless-DHCP
3.1.0
resourceUuid String body (contained in the params structure) Optional. The resource UUID. If specified, the L3 network will use the specified value as UUID. 3.1.0
systemTags List body Optional. The system tags. 3.1.0
userTags List body Optional. The user tags. 3.1.0
Note:
  • When you add an IPv6 range by specifying a network CIDR in ZStack Cloud, you can specify the DHCP server address by adding the affinityGroup option to SystemTags.
    • Format of the affinityGroup option: flatNetwork::DhcpServer::{%s}::ipUuid::{%s}
    • Example: flatNetwork::DhcpServer::192.168.1.100::ipUuid::null

API Response

Sample Response
{
  "inventory": {
    "l3NetworkUuid": "6735b2c2bc0c345892b7d66b1616d909",
    "name": "Test-IPRange",
    "networkCidr": "2002:2001::/64"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.1.0
inventory IpRangeInventory See inventory. 3.1.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.1.0
description String The brief description of the error. 3.1.0
details String The details about the error. 3.1.0
elaboration String The reserved field. Default value: null. 3.1.0
opaque LinkedHashMap The reserved field. Default value: null. 3.1.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.1.0
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 3.1.0
l3NetworkUuid String The L3 network UUID. 3.1.0
name String The resource name. 3.1.0
description String The detailed description of the resource. 3.1.0
startIp String 3.1.0
endIp String 3.1.0
netmask String 3.1.0
prefixLen String The prefix length. 3.1.0
gateway String 3.1.0
networkCidr String 3.1.0
ipVersion Integer The IP version. 3.1.0
addressMode String The allocation mode of the IPv6 address. 3.1.0
createDate Timestamp The creation date. 3.1.0
lastOpDate Timestamp The last operation date. 3.1.0

SDK Sample

Java SDK
AddIpv6RangeByNetworkCidrAction action = new AddIpv6RangeByNetworkCidrAction();
action.name = "Test-IPRange";
action.l3NetworkUuid = "92850b5a66633e2aa8c3a8ae6ebb541d";
action.networkCidr = "2002:2001::/64";
action.addressMode = "SLAAC";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddIpv6RangeByNetworkCidrAction.Result res = action.call();
Python SDK
AddIpv6RangeByNetworkCidrAction action = AddIpv6RangeByNetworkCidrAction()
action.name = "Test-IPRange"
action.l3NetworkUuid = "92850b5a66633e2aa8c3a8ae6ebb541d"
action.networkCidr = "2002:2001::/64"
action.addressMode = "SLAAC"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddIpv6RangeByNetworkCidrAction.Result res = action.call()

QueryIpAddress

API Request

URLs
GET zstack/v1/l3-networks/ip-address
GET zstack/v1/l3-networks/ip-address{uuid}
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-address
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/l3-networks/ip-address/87b2ab50f6c13ebb9dd73ca46bb22bc7

Queryable Fields

You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryIpAddress, and pressing the Tab key.

API Response

Sample Response
{
  "inventories": [
    {
      "uuid": "3ccfbfd6bd483a5eaeabed00b284f4fc",
      "ipRangeUuid": "1b3a29978ea73f0db4ce8d8c2d0bd479",
      "l3NetworkUuid": "c11b366475f836078e5aa86469de2eef",
      "ipVersion": 4.0,
      "ip": "192.168.1.100",
      "netmask": "255.255.255.0",
      "gateway": "192.168.1.1",
      "ipInLong": 0.0,
      "vmNicUuid": "28e22f67b2893b208547333dfef7cfa8"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.1.0
inventories List See inventories. 3.1.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.1.0
description String The brief description of the error. 3.1.0
details String The details about the error. 3.1.0
elaboration String The reserved field. Default value: null. 3.1.0
opaque LinkedHashMap The reserved field. Default value: null. 3.1.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.1.0
#inventories
Name Type Description Starting Version
uuid String The resource UUID. 3.1.0
ipRangeUuid String The IP range UUID. 3.1.0
l3NetworkUuid String The L3 network UUID. 3.1.0
ipVersion Integer The IP version. 3.1.0
ip String The IP address. 3.1.0
netmask String The netmask. 3.1.0
gateway String The gateway. 3.1.0
usedFor String 3.1.0
ipInLong long 3.1.0
vmNicUuid String The VM NIC UUID. 3.1.0
createDate Timestamp The creation date. 3.1.0
lastOpDate Timestamp The last operation date. 3.1.0

SDK Sample

Java SDK
QueryIpAddressAction action = new QueryIpAddressAction();
action.conditions = asList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryIpAddressAction.Result res = action.call();
Python SDK
QueryIpAddressAction action = QueryIpAddressAction()
action.conditions = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryIpAddressAction.Result res = action.call()

GetL3NetworkIpStatistic

API Request

URLs
GET zstack/v1/l3-networks/{l3NetworkUuid}/ip-statistic
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/9bdd769f3e603f65bd368512ebe8b998/ip-statistic?resourceType=All&sortBy=Ip&sortDirection=asc&start=0.0&limit=20.0&replyWithCount=false
Request Parameters
Name Type Location Description Optional Value Starting Version
l3NetworkUuid String url The L3 network UUID. 3.7.0
resourceType String query Optional. The resource type.
  • All
  • Vip
  • VM
3.7.0
ip String query Optional. The specified IP address. 3.7.0
sortBy String query Optional. The sort method.
  • Ip
  • CreateDate
3.7.0
sortDirection String query Optional. The sort direction.
  • asc
  • desc
3.7.0
start Integer query Optional. The location where the statistics starts. 3.7.0
limit Integer query Optional. The count of the statistics. 3.7.0
replyWithCount boolean query Optional. Whether to return both the statistics result and count. 3.7.0
systemTags List query Optional. The system tags. 3.7.0
userTags List query Optional. The user tags. 3.7.0

API Response

Sample Response
{
  "ipStatistics": [
    {
      "ip": "192.168.0.1",
      "resourceTypes": [
        "Other"
      ]
    }
  ],
  "total": 1.0
}
Name Type Description Starting Version
total Long The total statistics of the IP addresses. 3.7.0
success boolean Whether the API succeeds. 3.7.0
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.7.0
ipStatistics List See ipStatistics. 3.7.0
error ErrorCode See error. 3.7.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.7.0
description String The brief description of the error. 3.7.0
details String The details about the error. 3.7.0
elaboration String The reserved field. Default value: null. 3.7.0
opaque LinkedHashMap The reserved field. Default value: null. 3.7.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.7.0
#ipStatistics
Name Type Description Starting Version
ip String The IP address. 3.7.0
vipUuid String The VIP UUID. 3.7.0
vipName String The VIP name. 3.7.0
vmInstanceUuid String The VM instance UUID. 3.7.0
vmInstanceName String The VM instance name. 3.7.0
vmInstanceType String The VM instance type. 3.7.0
vmDefaultIp String The default IP address of the VM instance. 3.7.0
resourceTypes List The types of resources to which the IP address binds. 3.7.0
state String The resource state. 3.7.0
useFor String The network service to which the IP address binds. 3.7.0
createDate Timestamp The creation date. 3.7.0
ownerName String The name of the resource owner. 3.7.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.7.0
description String The brief description of the error. 3.7.0
details String The details about the error. 3.7.0
elaboration String The reserved field. Default value: null. 3.7.0
opaque LinkedHashMap The reserved field. Default value: null. 3.7.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.7.0

SDK Sample

Java SDK
GetL3NetworkIpStatisticAction action = new GetL3NetworkIpStatisticAction();
action.l3NetworkUuid = "9bdd769f3e603f65bd368512ebe8b998";
action.resourceType = "All";
action.sortBy = "Ip";
action.sortDirection = "asc";
action.start = 0.0;
action.limit = 20.0;
action.replyWithCount = false;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetL3NetworkIpStatisticAction.Result res = action.call();
Python SDK
GetL3NetworkIpStatisticAction action = GetL3NetworkIpStatisticAction()
action.l3NetworkUuid = "9bdd769f3e603f65bd368512ebe8b998"
action.resourceType = "All"
action.sortBy = "Ip"
action.sortDirection = "asc"
action.start = 0.0
action.limit = 20.0
action.replyWithCount = false
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetL3NetworkIpStatisticAction.Result res = action.call()

QueryAddressPool

API Request

URLs
GET zstack/v1/l3-networks/address-pools
GET zstack/v1/l3-networks/address-pools/{uuid}
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/address-pools?q=uuid=a73cf6bc10a0390bb5e461d9f5e3fd6d
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/l3-networks/address-pools/f45cb0f9098336a39662b7553f42deb5

Queryable Fields

You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryAddressPool, and pressing the Tab key.

API Response

Sample Response
{
  "inventories": [
    {
      "l3NetworkUuid": "81ce7828f3f63c0ea8a69dd9139bdaa0",
      "name": "Test-IPRange",
      "networkCidr": "192.168.10.0/24",
      "ipRangeType": "AddressPool"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.9.0
inventories List See inventories. 3.9.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.9.0
description String The brief description of the error. 3.9.0
details String The details about the error. 3.9.0
elaboration String The reserved field. Default value: null. 3.9.0
opaque LinkedHashMap The reserved field. Default value: null. 3.9.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.9.0
#inventories
Name Type Description Starting Version
uuid String The resource UUID. 3.9.0
l3NetworkUuid String The L3 network UUID. 3.9.0
name String The resource name. 3.9.0
description String The detailed description of the resource. 3.9.0
startIp String The start IP address. 3.9.0
endIp String The end IP address. 3.9.0
netmask String The netmask. 3.9.0
gateway String The gateway. 3.9.0
networkCidr String The network CIDR. 3.9.0
ipVersion Integer The IP version. 3.9.0
addressMode String The allocation mode of the IPv6 address. 3.9.0
prefixLen Integer The prefix length. 3.9.0
createDate Timestamp The creation date. 3.9.0
lastOpDate Timestamp The last operation date. 3.9.0
ipRangeType IpRangeType See ipRangeType. 3.9.0
#ipRangeType
Name Type Description Starting Version
Normal IpRangeType The normal IP range. 3.9.0
AddressPool IpRangeType The IP address pool. 3.9.0

SDK Sample

Java SDK
QueryAddressPoolAction action = new QueryAddressPoolAction();
action.conditions = asList("uuid=4cbab87c862032f1a161bebe7e1f55a1");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryAddressPoolAction.Result res = action.call();
Python SDK
QueryAddressPoolAction action = QueryAddressPoolAction()
action.conditions = ["uuid=455d45fad9893eba9565de38588c7416"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryAddressPoolAction.Result res = action.call()

AddReservedIpRange

API Request

URLs
POST zstack/v1/l3-networks/{l3NetworkUuid}/reserved-ip-ranges
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "startIp": "192.168.100.10",
    "endIp": "192.168.100.250"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"startIp":"192.168.100.10","endIp":"192.168.100.250"}}' \
http://localhost:8080/zstack/v1/l3-networks/dc9fb647bbd73a768da652b6cd100495/reserved-ip-ranges
Request Parameters
Name Type Location Description Optional Value Starting Version
l3NetworkUuid String url The L3 network UUID. 5.1.0
startIp String body (contained in the params structure) The start IP address. 5.1.0
endIp String body (contained in the params structure) The end IP address. 5.1.0
resourceUuid String body (contained in the params structure) Optional. The resource UUID. 5.1.0
tagUuids List body (contained in the params structure) Optional. The tag UUID. 5.1.0
systemTags List body Optional. The system tags. 5.1.0
userTags List body Optional. The user tags. 5.1.0

API Response

Sample Response
{
  "inventory": {
    "l3NetworkUuid": "9bb0926251903385928489eba7388cd4",
    "name": "Test-IP-Range",
    "startIp": "192.168.100.10",
    "endIp": "192.168.100.250"
  }
}
Name Type Description Starting Version
success boolean 5.1.0
inventory ReservedIpRangeInventory See inventory 5.1.0
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 5.1.0
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 5.1.0
l3NetworkUuid String The L3 network UUID. 5.1.0
name String The resource name. 5.1.0
description String The detail description of the resource. 5.1.0
startIp String The start IP address. 5.1.0
endIp String The end IP address. 5.1.0
ipVersion Integer The IP version. 5.1.0
createDate Timestamp The creation date. 5.1.0
lastOpDate Timestamp The last operation date. 5.1.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6

SDK Sample

Java SDK
AddReservedIpRangeAction action = new AddReservedIpRangeAction();
action.l3NetworkUuid = "dc9fb647bbd73a768da652b6cd100495";
action.startIp = "192.168.100.10";
action.endIp = "192.168.100.250";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddReservedIpRangeAction.Result res = action.call();
Python SDK
AddReservedIpRangeAction action = AddReservedIpRangeAction()
action.l3NetworkUuid = "dc9fb647bbd73a768da652b6cd100495"
action.startIp = "192.168.100.10"
action.endIp = "192.168.100.250"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddReservedIpRangeAction.Result res = action.call()

DeleteReservedIpRange

API Request

URLs
DELETE zstack/v1/l3-networks/reserved-ip-ranges/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/l3-networks/reserved-ip-ranges/c01027fecc013c338e25d67581eed865
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 5.1.0
deleteMode String body Optional. The delete mode. (Permissive / Enforcing,Permissive) 5.1.0
systemTags List body Optional. The system tags. 5.1.0
userTags List body Optional. The user tags. 5.1.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK Sample

Java SDK
DeleteReservedIpRangeAction action = new DeleteReservedIpRangeAction();
action.uuid = "c01027fecc013c338e25d67581eed865";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteReservedIpRangeAction.Result res = action.call();
Python SDK
DeleteReservedIpRangeAction action = DeleteReservedIpRangeAction()
action.uuid = "c01027fecc013c338e25d67581eed865"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteReservedIpRangeAction.Result res = action.call()

ChangeL3NetworkDhcpIpAddress

API Request

URLs
PUT zstack/v1/l3-networks/{l3NetworkUuid}/dhcp-ip
Headers
Authorization: OAuth the-session-uuid
Body
{
  "changeL3NetworkDhcpIpAddress": {
    "dhcpServerIp": "192.168.1.100",
    "dhcpv6ServerIp": "2024:04:28:01::100"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"changeL3NetworkDhcpIpAddress":{"dhcpServerIp":"192.168.1.100","dhcpv6ServerIp":"2024:04:28:01::100"}}' \
http://localhost:8080/zstack/v1/l3-networks/6b693b00316b30819bb30bfe0df10256/dhcp-ip
Request Parameters
Name Type Location Description Optional Value Starting Version
l3NetworkUuid String url The L3 network UUID. 5.1.0
dhcpServerIp String body (contained in the changeL3NetworkDhcpIpAddress structure) Optional. The IPv4 address of the DHCP server. 5.1.0
dhcpv6ServerIp String body (contained in the changeL3NetworkDhcpIpAddress structure) Optional. The IPv6 address of the DHCP server. 5.1.0
systemTags List body Optional. The system tags. 5.1.0
userTags List body Optional. The user tags. 5.1.0

API Response

Sample Response
{
  "dhcpServerIp": "192.168.100.3",
  "dhcpv6ServerIp": "2024:04:28:01::100"
}
Name Type Description Starting Version
dhcpServerIp String 5.1.0
dhcpv6ServerIp String 5.1.0
success boolean 5.1.0
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error 5.1.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6

SDK Sample

Java SDK
ChangeL3NetworkDhcpIpAddressAction action = new ChangeL3NetworkDhcpIpAddressAction();
action.l3NetworkUuid = "6b693b00316b30819bb30bfe0df10256";
action.dhcpServerIp = "192.168.1.100";
action.dhcpv6ServerIp = "2024:04:28:01::100";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ChangeL3NetworkDhcpIpAddressAction.Result res = action.call();
Python SDK
ChangeL3NetworkDhcpIpAddressAction action = ChangeL3NetworkDhcpIpAddressAction()
action.l3NetworkUuid = "6b693b00316b30819bb30bfe0df10256"
action.dhcpServerIp = "192.168.1.100"
action.dhcpv6ServerIp = "2024:04:28:01::100"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
ChangeL3NetworkDhcpIpAddressAction.Result res = action.call()

DeleteIpAddress

API Request

URLs
DELETE zstack/v1/l3-networks/{l3NetworkUuid}/ip-address
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/l3-networks/b6e5c225bf553bc8bd5a5fcf3fac9fa3/ip-address
Request Parameters
Name Type Location Description Optional Value Starting Version
l3NetworkUuid String url The L3 network UUID. 5.1.0
usedIpUuids List body The UUID of the deleted IP address. 5.1.0
deleteMode String body Optional. The delete mode. (Permissive / Enforcing,Permissive) 5.1.0
systemTags List body Optional. The system tags. 5.1.0
userTags List body Optional. The user tags. 5.1.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK Sample

Java SDK
DeleteIpAddressAction action = new DeleteIpAddressAction();
action.l3NetworkUuid = "b6e5c225bf553bc8bd5a5fcf3fac9fa3";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteIpAddressAction.Result res = action.call();
Python SDK
DeleteIpAddressAction action = DeleteIpAddressAction()
action.l3NetworkUuid = "b6e5c225bf553bc8bd5a5fcf3fac9fa3"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteIpAddressAction.Result res = action.call()
API Reference | 5.4.12 | ZStack Cloud · ZCF | ZStack Resource Center