Network ResourcesDistributed Port Group Related Interfaces

AddIpRange

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": []
}

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

Allowed Values

Starting Version

l3NetworkUuid

String

url

The L3 network UUID.

 

0.6

name

String

body(included in the params structure)

The IP range name.

 

0.6

description

String

body(included in the params structure)

Optional. The detailed description of the IP range.

 

0.6

startIp

String

body(included in the params structure)

The start IP address.

 

0.6

endIp

String

body(included in the params structure)

The end IP address.

 

0.6

netmask

String

body(included in the params structure)

The netmask.

 

0.6

gateway

String

body(included in the params structure)

The gateway.

 

0.6

ipRangeType

String

body(included in the params structure)

Optional. The address type.

  • Normal
  • AddressPool

3.9.0

resourceUuid

String

body(included in the params structure)

Optional. The resource UUID. If specified, the L3 network will use this field value as its UUID.

 

0.6

systemTags

List

body

Optional. The system tags.

 

0.6

userTags

List

body

Optional. The user tags.

 

0.6

  • ZSvirt supports specifying a DHCP server address when adding an IP range. Add the DhcpServer option to SystemTags.
    • Option format: 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"
  }
}
NameTypeDescriptionStarting Version
errorErrorCodeThe error code. If not null, the operation fails, or vice versa. For more information, see error.0.6
inventoryIpRangeInventorySee inventory.0.6

error

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

inventory

NameTypeDescriptionStarting Version
uuidStringThe resource UUID.0.6
l3NetworkUuidStringThe L3 network UUID.0.6
nameStringThe resource name.0.6
descriptionStringThe detailed description of the resource.0.6
startIpString 0.6
endIpString 0.6
netmaskString 0.6
prefixLenStringThe prefix length.3.1.0
gatewayString 0.6
networkCidrString 0.6
ipVersionIntegerThe IP version.3.1.0
addressModeStringThe IPv6 address allocation mode.3.1.0
createDateTimestampThe creation date.0.6
lastOpDateTimestampThe last operation date.0.6
ipRangeTypeIpRangeTypeSee ipRangeType.3.9.0

ipRangeType

NameTypeDescriptionStarting Version
NormalIpRangeType 3.9.0
AddressPoolIpRangeType 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()