AddIpRange
Headers
Authorization: OAuth the-session-uuidBody
{
"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-rangesRequest 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. |
| 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
- Option format:
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 IPv6 address allocation mode. | 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()