Network ResourcesDistributed Port Group Related Interfaces

Add IP Address Range by Network CIDR

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

In the preceding sample, 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

Allowed Values

Starting Version

name

String

body(contained in the params structure)

The name of the Distributed Port Group.

 

0.6

description (Optional)

String

body(contained in the params structure)

The detailed description of the Distributed Port Group.

 

0.6

l3NetworkUuid

String

url

The Distributed Port Group UUID.

 

0.6

networkCidr

String

body(contained in the params structure)

The network CIDR.

 

0.6

gateway (Optional)

String

body(contained in the params structure)

The gateway.

 

3.7.0

ipRangeType (Optional)

String

body(contained in the params structure)

The address type.

  • Normal
  • AddressPool

3.9.0

resourceUuid (Optional)

String

body(contained in the params structure)

The resource UUID. If specified, the Distributed Port Group will use this field value as its UUID.

 

0.6

systemTags (Optional)

List

body

The system tags.

 

0.6

userTags (Optional)

List

body

The user tags.

 

0.6

  • ZSvirt supports specifying a DHCP server address when adding an IP address range by network CIDR. 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": "4e0926c4fa27455f88c7d94420bf3422",
    "name": "Test-IPRange",
    "networkCidr": "192.168.10.0/24"
  }
}
NameTypeDescriptionStarting Version
errorErrorCodeThe error code. If not null, the operation fails, or vice versa. For more information, see error0.6
inventoryIpRangeInventorySee inventory0.6

error

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

inventory

NameTypeDescriptionStarting Version
uuidStringThe resource UUID, which uniquely identifies the resource.0.6
l3NetworkUuidStringThe Distributed Port Group 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 protocol number.3.1.0
addressModeStringThe IPv6 address allocation mode.3.1.0
createDateTimestampThe creation date.0.6
lastOpDateTimestampThe last operation date.0.6
ipRangeTypeIpRangeTypeSee ipRangeType3.9.0

ipRangeType

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