Network Resources
Distributed Switch Related Interfaces
CreateL2VirtualSwitch
API Request
POST zstack/v1/l2-networks/virtual-switchAuthorization: OAuth the-session-uuid{
"params": {
"isDistributed": true,
"name": "dvs-1",
"description": "Test",
"zoneUuid": "27f8f98f166a3206b020e83996faabc3",
"physicalInterface": "bond1",
"vSwitchType": "LinuxBridge"
},
"systemTags": [],
"userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"isDistributed":true,"name":"dvs-1","description":"Test","zoneUuid":"27f8f98f166a3206b020e83996faabc3","physicalInterface":"bond1","vSwitchType":"LinuxBridge"}}' \
http://localhost:8080/zstack/v1/l2-networks/virtual-switch| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| isDistributed (Optional) | Boolean | body (contained in params structure) | Whether it is distributed. | 4.1.0 | |
| name | String | body (contained in params structure) | The resource name. | 4.1.0 | |
| description (Optional) | String | body (contained in params structure) | The detailed description of the resource. | 4.1.0 | |
| zoneUuid | String | body (contained in params structure) | The Data Center UUID. | 4.1.0 | |
| physicalInterface | String | body (contained in params structure) | Physical NIC. | 4.1.0 | |
| type (Optional) | String | body (contained in params structure) | Optional. The resource type. | 4.1.0 | |
| vSwitchType (Optional) | String | body (contained in params structure) | Virtual Switch type. |
|
4.1.0 |
| resourceUuid (Optional) | String | body (contained in params structure) | The resource UUID. | 4.1.0 | |
| tagUuids (Optional) | List | body (contained in params structure) | The tag UUID list. | 4.1.0 | |
| systemTags (Optional) | List | body | The system tags. | 4.1.0 | |
| userTags (Optional) | List | body | The user tags. | 4.1.0 |
API Response
{
"inventory": {
"isDistributed": true,
"vSwitchIndex": 1,
"name": "dvs-1",
"description": "Test dvs",
"zoneUuid": "4bc93f4e3a1c35b8948583951e56b5eb",
"physicalInterface": "bond1",
"type": "virtualSwitch"
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| isDistributed | Boolean | Whether it is distributed. | 4.1.0 |
| uuid | String | The resource UUID. | 4.1.0 |
| name | String | The resource name. | 4.1.0 |
| description | String | The detailed description of the resource. | 4.1.0 |
| zoneUuid | String | The Data Center UUID. | 4.1.0 |
| physicalInterface | String | Physical NIC. | 4.1.0 |
| type | String | The resource type. | 4.1.0 |
| vSwitchType | String | Virtual Switch type. | 4.1.0 |
| virtualNetworkId | Integer | Virtual Network ID. | 4.1.0 |
| createDate | Timestamp | The creation date. | 4.1.0 |
| lastOpDate | Timestamp | The last operation date. | 4.1.0 |
| attachedClusterUuids | List | The list of attached Cluster UUIDs. | 4.1.0 |
| portGroups | List | See portGroups. | 4.1.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| vSwitchUuid | String | Virtual Switch UUID. | 4.1.0 |
| vlanId | Integer | VLAN ID. | 4.1.0 |
| vlanRanges | String | VLAN range. | 4.1.0 |
| uuid | String | The resource UUID. | 4.1.0 |
| name | String | The resource name. | 4.1.0 |
| description | String | The detailed description of the resource. | 4.1.0 |
| zoneUuid | String | The Data Center UUID. | 4.1.0 |
| physicalInterface | String | Physical NIC. | 4.1.0 |
| type | String | The resource type. | 4.1.0 |
| vSwitchType | String | Virtual Switch type. | 4.1.0 |
| virtualNetworkId | Integer | Virtual Network ID. | 4.1.0 |
| createDate | Timestamp | The creation date. | 4.1.0 |
| lastOpDate | Timestamp | The last operation date. | 4.1.0 |
| attachedClusterUuids | List | The list of attached Cluster UUIDs. | 4.1.0 |
| vlanMode | PortGroupVlanMode | See vlanMode. | 4.1.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| ACCESS | PortGroupVlanMode | The ACCESS value. | 4.2.0 |
| TRUNK | PortGroupVlanMode | The TRUNK value. | 4.2.0 |
| PVLAN | PortGroupVlanMode | The PVLAN value. | 4.2.0 |
| 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. | 4.1.0 |
| description | String | The brief description of the error. | 4.1.0 |
| details | String | The details about the error. | 4.1.0 |
| elaboration | String | Reserved field. Default value: null. | 4.1.0 |
| opaque | LinkedHashMap | Reserved field. Default value: null. | 4.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. | 4.1.0 |
SDK Sample
CreateL2VirtualSwitchAction action = new CreateL2VirtualSwitchAction();
action.isDistributed = true;
action.name = "dvs-1";
action.description = "Test";
action.zoneUuid = "27f8f98f166a3206b020e83996faabc3";
action.physicalInterface = "bond1";
action.vSwitchType = "LinuxBridge";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateL2VirtualSwitchAction.Result res = action.call();CreateL2VirtualSwitchAction action = CreateL2VirtualSwitchAction()
action.isDistributed = true
action.name = "dvs-1"
action.description = "Test"
action.zoneUuid = "27f8f98f166a3206b020e83996faabc3"
action.physicalInterface = "bond1"
action.vSwitchType = "LinuxBridge"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateL2VirtualSwitchAction.Result res = action.call()DeleteL2Network
API Request
DELETE zstack/v1/l2-networks/{uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth ff3445cd125b4f67b6fc551133852726" \
-X DELETE http://localhost:8080/zstack/v1/l2-networks/254811ac54a04835a8f82871f96ab86f?deleteMode=Permissive| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The resource UUID. | 4.8.0 | |
| deleteMode (Optional) | String | body | Delete mode. | 4.8.0 | |
| systemTags (Optional) | List | body | The system tags. | 4.8.0 | |
| userTags (Optional) | List | body | The user tags. | 4.8.0 |
API Response
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}/9SDK Sample
DeleteL2NetworkAction action = new DeleteL2NetworkAction();
action.uuid = "8952ecc352fc49b9a0b22286772e74e2";
action.deleteMode = "Permissive";
action.sessionId = "1bece9d1092e47e7ba176ac2e3b03793";
DeleteL2NetworkAction.Result res = action.call();DeleteL2NetworkAction action = DeleteL2NetworkAction()
action.uuid = "f1f6deb480d44b77b53b74784c17a1d9"
action.deleteMode = "Permissive"
action.sessionId = "9b914d6dc4d64c8f8f45452bad140f9f"
DeleteL2NetworkAction.Result res = action.call()UpdateL2Network
API Request
PUT zstack/v1/l2-networks/{uuid}/actionsAuthorization: OAuth the-session-uuid{
"updateL2Network": {
"name": "Test-Net",
"description": "Test"
},
"systemTags": [],
"userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateL2Network":{"name":"Test-Net","description":"Test"}}' \
http://localhost:8080/zstack/v1/l2-networks/8a44ece25f973842b841591a554f5fee/actions| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The resource UUID. | 0.6 | |
| name (Optional) | String | body (contained in updateL2Network structure) | The name of the L2 network. | 0.6 | |
| description (Optional) | String | body (contained in updateL2Network structure) | The detailed description of the L2 network. | 0.6 | |
| systemTags (Optional) | List | body | The system tags. | 0.6 | |
| userTags (Optional) | List | body | The user tags. | 0.6 |
API Response
{
"inventory": {
"vlan": 10,
"name": "Test-Net",
"description": "Test",
"zoneUuid": "fa938a0c3dc437748ba603836bb59fda",
"physicalInterface": "eth0",
"type": "L2VlanNetwork"
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | Whether the operation succeeded. | 0.6 |
| error | ErrorCode | Error code. If not null, the operation fails, or vice versa. The value is null on success. See error. | 0.6 |
| inventory | L2NetworkInventory | See inventory. | 0.6 |
| 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 | Reserved field. Default value: null. | 0.6 |
| opaque | LinkedHashMap | 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 |
| 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 |
| zoneUuid | String | The Data Center UUID. | 0.6 |
| physicalInterface | String | Physical NIC. | 0.6 |
| type | String | Distributed Switch type. | 0.6 |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
| attachedClusterUuids | List | The list of attached Cluster UUIDs. | 0.6 |
SDK Sample
UpdateL2NetworkAction action = new UpdateL2NetworkAction();
action.uuid = "f7ea5335fcab4d438069879d62384b0e";
action.name = "Test-Net";
action.description = "Test";
action.sessionId = "05627ec42486449cb6b422ef927829f1";
UpdateL2NetworkAction.Result res = action.call();UpdateL2NetworkAction action = UpdateL2NetworkAction()
action.uuid = "7dc08ad01b8a4d578aab2ae0ad750f1b"
action.name = "Test-Net"
action.description = "Test"
action.sessionId = "130b064e63204a479857ced03f550cf2"
UpdateL2NetworkAction.Result res = action.call()UpdateVirtualSwitchUplinkBondings
API Request
PUT zstack/v1/l2-networks/virtual-switch/{uuid}/uplink-bondingsAuthorization: OAuth the-session-uuid{
"updateVirtualSwitchUplinkBondings": {
"mode": "active-backup 1",
"xmitHashPolicy": "layer2 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 -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateVirtualSwitchUplinkBondings":{"mode":"active-backup 1","xmitHashPolicy":"layer2 0"}}' http://localhost:8080/zstack/v1/l2-networks/virtual-switch/d558d0c667c735cbb2c9a34ef7e7c5c3/uplink-bondings| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The resource UUID. | 4.1.0 | |
| mode | String | body (contained in updateVirtualSwitchUplinkBondings structure) |
The bonding mode. |
|
4.1.0 |
| xmitHashPolicy (Optional) | String | body (contained in updateVirtualSwitchUplinkBondings structure) |
Optional. The hash policy. |
|
4.1.0 |
| systemTags (Optional) | List | body | Optional. The system tags. | 4.1.0 | |
| userTags (Optional) | List | body | Optional. The user tags. | 4.1.0 |
API Response
{
"inventories": [
{
"uuid": "f05eb769fbba34388625771c17666383",
"hostUuid": "7b9b76f4f9663d27a72fb81f4b4ad5b0",
"bondingName": "bond0",
"mode": "active-backup 1",
"xmitHashPolicy": "layer2 0",
"miiStatus": "up",
"mac": "ac:1f:6b:93:6c:8c",
"ipAddresses": [
"172.20.0.116/16"
],
"miimon": 100,
"type": "LinuxBonding",
"allSlavesActive": true,
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM",
"slaves": [
{
"uuid": "96b9aafc2c9c3b9c862771543dc9bdc8",
"hostUuid": "7b9b76f4f9663d27a72fb81f4b4ad5b0",
"bondingUuid": "f05eb769fbba34388625771c17666383",
"interfaceName": "eno1",
"interfaceType": "bondingSlave",
"speed": 1000,
"slaveActive": true,
"carrierActive": true,
"mac": "ac:1f:6b:93:6c:8c",
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM"
},
{
"uuid": "8bf85f6d802438588dc292908bb4e928",
"hostUuid": "7b9b76f4f9663d27a72fb81f4b4ad5b0",
"bondingUuid": "f05eb769fbba34388625771c17666383",
"interfaceName": "eno2",
"interfaceType": "bondingSlave",
"speed": 1000,
"slaveActive": false,
"carrierActive": false,
"mac": "ac:1f:6b:93:6c:8c",
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM"
}
]
}
]
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | Whether the operation succeeded. | 4.1.0 |
| inventories | List | See inventories. | 4.1.0 |
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 4.1.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 4.1.0 |
| hostUuid | String | The host UUID. | 4.1.0 |
| bondingName | String | The Bond name. | 4.1.0 |
| bondingType | String | The Bond application status. Valid values include noBridge and bridgeSlave. | 4.1.0 |
| speed | Long | The Bond speed. | 4.1.0 |
| mode | String | The Bond mode. | 4.1.0 |
| xmitHashPolicy | String | The hash policy. | 4.1.0 |
| miiStatus | String | The MII status. | 4.1.0 |
| mac | String | The MAC address. | 4.1.0 |
| ipAddresses | List | The IP addresses. | 4.1.0 |
| gateway | String | The gateway address. | 4.1.0 |
| callBackIp | String | The callback address. | 4.1.0 |
| miimon | Long | The MII monitor interval. | 4.1.0 |
| type | String | The Bond type. | 4.1.0 |
| allSlavesActive | Boolean | The all slaves active. | 4.1.0 |
| description | String | The detailed description of the resource. | 4.1.0 |
| createDate | Timestamp | The creation date. | 4.1.0 |
| lastOpDate | Timestamp | The last operation date. | 4.1.0 |
| slaves | List | See slaves. | 4.1.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 4.1.0 |
| hostUuid | String | The host UUID. | 4.1.0 |
| bondingUuid | String | The Bond UUID. | 4.1.0 |
| interfaceModel | String | The NIC model. | |
| vendorId | String | The vendor ID. | |
| deviceId | String | The device ID. | |
| subvendorId | String | The subvendor ID. | |
| subdeviceId | String | The subdevice ID. | |
| interfaceName | String | The NIC name. | 4.1.0 |
| interfaceType | String | The NIC application status. Valid values include nomaster, bridgeSlave, and bondSlave. | 4.1.0 |
| speed | Long | The NIC speed. | 4.1.0 |
| slaveActive | Boolean | The Bond link status. | 4.1.0 |
| carrierActive | Boolean | The physical link status. | 4.1.0 |
| ipAddresses | List | The IP addresses. | 4.1.0 |
| gateway | String | The gateway address. | 4.1.0 |
| mac | String | The MAC address. | 4.1.0 |
| callBackIp | String | The callback address. | 4.1.0 |
| pciDeviceAddress | String | The NIC PCI address. | 4.1.0 |
| offloadStatus | String | The offload status. | 4.1.0 |
| description | String | The detailed description of the resource. | 4.1.0 |
| createDate | Timestamp | The creation date. | 4.1.0 |
| lastOpDate | Timestamp | The last operation date. | 4.1.0 |
| 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. | 4.1.0 |
| description | String | The brief description of the error. | 4.1.0 |
| details | String | The details about the error. | 4.1.0 |
| elaboration | String | The reserved field. Default value: null. | 4.1.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 4.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. | 4.1.0 |
SDK Sample
UpdateVirtualSwitchUplinkBondingsAction action = new UpdateVirtualSwitchUplinkBondingsAction();
action.uuid = "d558d0c667c735cbb2c9a34ef7e7c5c3";
action.mode = "active-backup 1";
action.xmitHashPolicy = "layer2 0";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateVirtualSwitchUplinkBondingsAction.Result res = action.call();UpdateVirtualSwitchUplinkBondingsAction action = UpdateVirtualSwitchUplinkBondingsAction()
action.uuid = "d558d0c667c735cbb2c9a34ef7e7c5c3"
action.mode = "active-backup 1"
action.xmitHashPolicy = "layer2 0"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateVirtualSwitchUplinkBondingsAction.Result res = action.call()QueryL2VirtualSwitchNetwork
API Request
GET zstack/v1/l2-networks/virtual-switch
GET zstack/v1/l2-networks/virtual-switch/{uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/l2-networks/virtual-switchcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/l2-networks/virtual-switch/95f17f8b6b6137e3815cedcfa39d812dQueryable Fields
Run the CLI command tool, enter QueryL2VirtualSwitchNetwork, and press Tab to view all queryable fields and resource names that support cross-table queries.
API Response
{
"inventories": [
{
"name": "Test-dvs",
"description": "Test",
"zoneUuid": "55210de8afc03d42bddc8e098c69410c",
"physicalInterface": "eth0",
"type": "virtualSwitch"
}
]
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | Whether the operation succeeded. | 4.1.0 |
| inventories | List | See inventories. | 4.1.0 |
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 4.1.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| isDistributed | Boolean | Whether it is distributed. | 4.1.0 |
| uuid | String | The resource UUID. | 4.1.0 |
| name | String | The resource name. | 4.1.0 |
| description | String | The detailed description of the resource. | 4.1.0 |
| zoneUuid | String | The Data Center UUID. | 4.1.0 |
| physicalInterface | String | The physical NIC. | 4.1.0 |
| type | String | The Distributed Switch type. | 4.1.0 |
| vSwitchType | String | The virtual Switch type. | 4.1.0 |
| virtualNetworkId | Integer | The virtual network ID. | 4.1.0 |
| createDate | Timestamp | The creation date. | 4.1.0 |
| lastOpDate | Timestamp | The last operation date. | 4.1.0 |
| attachedClusterUuids | List | The list of attached Cluster UUIDs. | 4.1.0 |
| portGroups | List | See portGroups. | 4.1.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| vSwitchUuid | String | The virtual Switch UUID. | 4.1.0 |
| vlanId | Integer | The VLAN ID. | 4.1.0 |
| vlanRanges | String | The VLAN range. | 4.1.0 |
| uuid | String | The resource UUID. | 4.1.0 |
| name | String | The resource name. | 4.1.0 |
| description | String | The detailed description of the resource. | 4.1.0 |
| zoneUuid | String | The Data Center UUID. | 4.1.0 |
| physicalInterface | String | The physical NIC. | 4.1.0 |
| type | String | The Distributed Switch type. | 4.1.0 |
| vSwitchType | String | The virtual Switch type. | 4.1.0 |
| virtualNetworkId | Integer | The virtual network ID. | 4.1.0 |
| createDate | Timestamp | The creation date. | 4.1.0 |
| lastOpDate | Timestamp | The last operation date. | 4.1.0 |
| attachedClusterUuids | List | The list of attached Cluster UUIDs. | 4.1.0 |
| vlanMode | L2PortGroupVlanMode | See vlanMode. | 4.1.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| ACCESS | L2PortGroupVlanMode | The ACCESS value. | 4.2.0 |
| TRUNK | L2PortGroupVlanMode | The TRUNK value. | 4.2.0 |
| PVLAN | L2PortGroupVlanMode | The PVLAN value. | 4.2.0 |
| 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. | 4.1.0 |
| description | String | The brief description of the error. | 4.1.0 |
| details | String | The details about the error. | 4.1.0 |
| elaboration | String | The reserved field. Default value: null. | 4.1.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 4.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. | 4.1.0 |
SDK Sample
QueryL2VirtualSwitchNetworkAction action = new QueryL2VirtualSwitchNetworkAction();
action.conditions = asList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryL2VirtualSwitchNetworkAction.Result res = action.call();QueryL2VirtualSwitchNetworkAction action = QueryL2VirtualSwitchNetworkAction()
action.conditions = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryL2VirtualSwitchNetworkAction.Result res = action.call()GetL2NetworkTypes
API Request
GET zstack/v1/l2-networks/typesOAuth: the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "OAuth: 76514d7cdcf44b57bc26ff7b4ae0be63" \
-X GET http://localhost:8080/zstack/v1/l2-networks/types| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| systemTags (Optional) | List | query | Optional. The system tags. | 0.6 | |
| userTags (Optional) | List | query | Optional. The user tags. | 0.6 |
API Response
{
"l2NetworkTypes": [
"L2VlanNetwork",
"L2NoVlanNetwork"
]
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | Whether the operation succeeded. | 0.6 |
| types | List | The types. | 0.6 |
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 0.6 |
| 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
GetL2NetworkTypesAction action = new GetL2NetworkTypesAction();
action.sessionId = "485005865e744e19a12ad2f9af2ea997";
GetL2NetworkTypesAction.Result res = action.call();GetL2NetworkTypesAction action = GetL2NetworkTypesAction()
action.sessionId = "b34f3c756aa542789f35bc1774845bc1"
GetL2NetworkTypesAction.Result res = action.call()AttachL2NetworkToCluster
API Request
POST zstack/v1/l2-networks/{l2NetworkUuid}/clusters/{clusterUuid}OAuth: the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST http://localhost:8080/zstack/v1/l2-networks/e852ba6eb4c03f2fafdb73ce838d8980/clusters/112816423a1a3b50a58d54fd1f6a8665| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| l2NetworkUuid | String | url | The port group Distributed Switch UUID. | 0.6 | |
| clusterUuid | String | url | The cluster UUID. | 0.6 | |
| l2ProviderType (Optional) | String | body | Optional. The Distributed Switch implementation type. |
|
4.8.0 |
| systemTags (Optional) | List | body | Optional. The system tags. | 0.6 | |
| userTags (Optional) | List | body | Optional. The user tags. | 0.6 | |
| hostParams (Optional) | String | body | Optional. The host parameter list. | 4.3.0 |
API Response
{
"inventory": {
"vlan": 10.0,
"name": "Test-Net",
"description": "Test",
"zoneUuid": "95ab67ece21e3ce39896b9b391a21a94",
"physicalInterface": "eth0",
"type": "L2VlanNetwork"
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | Whether the operation succeeded. | 4.8.0 |
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 4.8.0 |
| inventory | L2NetworkInventory | See inventory. | 4.8.0 |
| 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 |
| 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 |
| zoneUuid | String | The Data Center UUID. | 0.6 |
| physicalInterface | String | The physical NIC. | 0.6 |
| type | String | The Distributed Switch type. | 0.6 |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
| attachedClusterUuids | List | The list of attached Cluster UUIDs. | 0.6 |
SDK Sample
AttachL2NetworkToClusterAction action = new AttachL2NetworkToClusterAction();
action.l2NetworkUuid = "e852ba6eb4c03f2fafdb73ce838d8980";
action.clusterUuid = "112816423a1a3b50a58d54fd1f6a8665";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AttachL2NetworkToClusterAction.Result res = action.call();AttachL2NetworkToClusterAction action = AttachL2NetworkToClusterAction()
action.l2NetworkUuid = "e852ba6eb4c03f2fafdb73ce838d8980"
action.clusterUuid = "112816423a1a3b50a58d54fd1f6a8665"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AttachL2NetworkToClusterAction.Result res = action.call()DetachL2NetworkFromCluster
API Request
DELETE/v1/l2-networks/{l2NetworkUuid}/clusters/{clusterUuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/l2-networks/baef7db345553050846947bb2d818be0/clusters/2fb51e7e35d339c4bac77819a9c4fea1?| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| l2NetworkUuid | String | url | The port group Distributed Switch UUID. | 0.6 | |
| clusterUuid | String | url | The cluster UUID. | 0.6 | |
| systemTags (Optional) | List | body | Optional. The system tags. | 0.6 | |
| userTags (Optional) | List | body | Optional. The user tags. | 0.6 |
API Response
{
"inventory": {
"vlan": 10,
"name": "Test-Net",
"description": "Test",
"zoneUuid": "7a531508c19d396d84abeda34b83d946",
"physicalInterface": "eth0",
"type": "L2VlanNetwork"
}
}| 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. | 4.8.0 |
| description | String | The brief description of the error. | 4.8.0 |
| details | String | The details about the error. | 4.8.0 |
| elaboration | String | The reserved field. Default value: null. | 4.8.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 4.8.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. | 4.8.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 4.8.0 |
| name | String | The resource name. | 4.8.0 |
| description | String | The detailed description of the resource. | 4.8.0 |
| zoneUuid | String | The Data Center UUID. | 4.8.0 |
| physicalInterface | String | The physical NIC. | 4.8.0 |
| type | String | The Distributed Switch type. | 4.8.0 |
| createDate | Timestamp | The creation date. | 4.8.0 |
| lastOpDate | Timestamp | The last operation date. | 4.8.0 |
| attachedClusterUuids | List | The attached cluster UUIDs. | 4.8.0 |
SDK Sample
DetachL2NetworkFromClusterAction action = new DetachL2NetworkFromClusterAction();
action.l2NetworkUuid = "baef7db345553050846947bb2d818be0";
action.clusterUuid = "2fb51e7e35d339c4bac77819a9c4fea1";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DetachL2NetworkFromClusterAction.Result res = action.call();DetachL2NetworkFromClusterAction action = DetachL2NetworkFromClusterAction()
action.l2NetworkUuid = "baef7db345553050846947bb2d818be0"
action.clusterUuid = "2fb51e7e35d339c4bac77819a9c4fea1"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DetachL2NetworkFromClusterAction.Result res = action.call()GetCandidateClustersForAttachingL2Network
API Request
GET zstack/v1/l2-networks/{l2NetworkUuid}/cluster-candidatesAuthorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/l2-networks/0b888b1f97993dbc9a22667219bcc690/cluster-candidates?limit=1000&start=0| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| l2NetworkUuid | String | url | The Distributed Switch UUID. | 4.0.0 | |
| clusterTypes (Optional) | List | query | Optional. The cluster type list. | 4.0.0 | |
| limit (Optional) | Integer | query | Optional. The maximum number of records to return. Similar to the MySQL limit. | 4.0.0 | |
| start (Optional) | Integer | query | Optional. The starting record offset. Similar to the MySQL offset. Use with limit for pagination. |
4.0.0 | |
| systemTags (Optional) | List | query | Optional. The system tags. | 4.0.0 | |
| userTags (Optional) | List | query | Optional. The user tags. | 4.0.0 |
API Response
{
"inventories": [
{
"name": "cluster1",
"uuid": "170abd61de68305cb2ccaa008a17c11e",
"description": "test",
"state": "Enabled",
"hypervisorType": "KVM",
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM",
"zoneUuid": "8de4bc023e4c3be6bfa7c514eb3bb024",
"type": "zstack"
}
]
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | Whether the operation succeeded. | 4.0.0 |
| inventories | List | See inventories. | 4.0.0 |
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 4.0.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| name | String | The resource name. | 0.6 |
| uuid | String | The resource UUID. | 0.6 |
| description | String | The detailed description of the resource. | 0.6 |
| state | String | The cluster state. | 0.6 |
| hypervisorType | String | The hypervisor type. | 0.6 |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
| zoneUuid | String | The Data Center UUID. | 0.6 |
| type | String | The reserved field. | 0.6 |
| 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
GetCandidateClustersForAttachingL2NetworkAction action = new GetCandidateClustersForAttachingL2NetworkAction();
action.l2NetworkUuid = "0b888b1f97993dbc9a22667219bcc690";
action.limit = 1000;
action.start = 0;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetCandidateClustersForAttachingL2NetworkAction.Result res = action.call();GetCandidateClustersForAttachingL2NetworkAction action = GetCandidateClustersForAttachingL2NetworkAction()
action.l2NetworkUuid = "0b888b1f97993dbc9a22667219bcc690"
action.limit = 1000
action.start = 0
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetCandidateClustersForAttachingL2NetworkAction.Result res = action.call()GetCandidateL2NetworksForAttachingCluster
API Request
GET zstack/v1/cluster/{clusterUuid}/l2-candidatesAuthorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/cluster/016f3e0efa66377b8acf1d1b73050af0/l2-candidates?limit=1000&start=0| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| clusterUuid | String | url | The cluster UUID. | 4.0.0 | |
| limit (Optional) | Integer | query | Optional. The maximum number of records to return. Similar to the MySQL limit. | 4.0.0 | |
| start (Optional) | Integer | query | Optional. The starting record offset. Similar to the MySQL offset. Use with limit for pagination. |
4.0.0 | |
| systemTags (Optional) | List | query | Optional. The system tags. | 4.0.0 | |
| userTags (Optional) | List | query | Optional. The user tags. | 4.0.0 |
API Response
{
"inventories": [
{
"name": "l2",
"description": "test",
"physicalInterface": "eth0",
"vlan": 0,
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM"
}
]
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | Whether the operation succeeded. | 4.0.0 |
| inventories | List | See inventories. | 4.0.0 |
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 4.0.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 4.0.0 |
| name | String | The resource name. | 4.0.0 |
| poolUuid | String | The network pool UUID. | 4.0.0 |
| zoneUuid | String | The Data Center UUID. | 4.0.0 |
| description | String | The detailed description of the resource. | 4.0.0 |
| physicalInterface | String | The NIC name. | 4.0.0 |
| type | String | The Distributed Switch type. | 4.0.0 |
| vni | String | The VNI number. | 4.0.0 |
| vlan | int | The VLAN number. | 4.0.0 |
| createDate | Timestamp | The creation date. | 4.0.0 |
| lastOpDate | Timestamp | The last operation date. | 4.0.0 |
| 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
GetCandidateL2NetworksForAttachingClusterAction action = new GetCandidateL2NetworksForAttachingClusterAction();
action.clusterUuid = "016f3e0efa66377b8acf1d1b73050af0";
action.limit = 1000;
action.start = 0;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetCandidateL2NetworksForAttachingClusterAction.Result res = action.call();GetCandidateL2NetworksForAttachingClusterAction action = GetCandidateL2NetworksForAttachingClusterAction()
action.clusterUuid = "016f3e0efa66377b8acf1d1b73050af0"
action.limit = 1000
action.start = 0
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetCandidateL2NetworksForAttachingClusterAction.Result res = action.call()AttachL2NetworkToHost
API Request
POST zstack/v1/l2-networks/{l2NetworkUuid}/hosts/{hostUuid}Authorization: OAuth the-session-uuid{
"params": {
"l2ProviderType": "LinuxBridge"
},
"systemTags": [],
"userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"l2ProviderType":"LinuxBridge"}}' http://localhost:8080/zstack/v1/l2-networks/eabc734e7538311a9afd99276867fb88/hosts/b20782106d1537e6bd8ee81f94d2c870| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| l2NetworkUuid | String | url | The port group Distributed Switch UUID. | 4.1.0 | |
| hostUuid | String | url | The host UUID. | 4.1.0 | |
| l2ProviderType (Optional) | String | body(contained in params structure) | Optional. The Switch implementation type. |
|
4.1.0 |
| systemTags (Optional) | List | body | Optional. The system tags. | 4.1.0 | |
| userTags (Optional) | List | body | Optional. The user tags. | 4.1.0 | |
| hostParam (Optional) | String | body(contained in params structure) |
Optional. The host parameter. | 4.3.0 |
API Response
{
"inventory": {
"vlan": 10,
"name": "Test-Net",
"description": "Test",
"zoneUuid": "6b737f0ab0a839b58e9d7a208ce7bb0b",
"physicalInterface": "eth0",
"type": "L2VlanNetwork"
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 4.1.0 |
| name | String | The resource name. | 4.1.0 |
| description | String | The detailed description of the resource. | 4.1.0 |
| zoneUuid | String | The Data Center UUID. | 4.1.0 |
| physicalInterface | String | The physical NIC. | 4.1.0 |
| type | String | The Distributed Switch type. | 4.1.0 |
| createDate | Timestamp | The creation date. | 4.1.0 |
| lastOpDate | Timestamp | The last operation date. | 4.1.0 |
| attachedClusterUuids | List | The list of attached Cluster UUIDs. | 4.1.0 |
| 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. | 4.1.0 |
| description | String | The brief description of the error. | 4.1.0 |
| details | String | The details about the error. | 4.1.0 |
| elaboration | String | The reserved field. Default value: null. | 4.1.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 4.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. | 4.1.0 |
SDK Sample
AttachL2NetworkToHostAction action = new AttachL2NetworkToHostAction();
action.l2NetworkUuid = "eabc734e7538311a9afd99276867fb88";
action.hostUuid = "b20782106d1537e6bd8ee81f94d2c870";
action.l2ProviderType = "LinuxBridge";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AttachL2NetworkToHostAction.Result res = action.call();AttachL2NetworkToHostAction action = AttachL2NetworkToHostAction()
action.l2NetworkUuid = "eabc734e7538311a9afd99276867fb88"
action.hostUuid = "b20782106d1537e6bd8ee81f94d2c870"
action.l2ProviderType = "LinuxBridge"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AttachL2NetworkToHostAction.Result res = action.call()DetachL2NetworkFromHost
API Request
DELETE zstack/v1/l2-networks/{l2NetworkUuid}/hosts/{hostUuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/l2-networks/65509f36186c339d8fa85fe0b632c61f/hosts/99d5e85e897a317780ed520e3dafdf0c| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| l2NetworkUuid | String | url | The port group Distributed Switch UUID. | 4.1.0 | |
| hostUuid | String | url | The host UUID. | 4.1.0 | |
| systemTags (Optional) | List | body | Optional. The system tags. | 4.1.0 | |
| userTags (Optional) | List | body | Optional. The user tags. | 4.1.0 |
API Response
{
"inventory": {
"vlan": 10,
"name": "Test-Net",
"description": "Test",
"zoneUuid": "5b03d97878c536a6bedfb1ac1931ef2c",
"physicalInterface": "eth0",
"type": "L2VlanNetwork"
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 4.1.0 |
| name | String | The resource name. | 4.1.0 |
| description | String | The detailed description of the resource. | 4.1.0 |
| zoneUuid | String | The Data Center UUID. | 4.1.0 |
| physicalInterface | String | The physical NIC. | 4.1.0 |
| type | String | The Distributed Switch type. | 4.1.0 |
| createDate | Timestamp | The creation date. | 4.1.0 |
| lastOpDate | Timestamp | The last operation date. | 4.1.0 |
| attachedClusterUuids | List | The list of attached Cluster UUIDs. | 4.1.0 |
| 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. | 4.1.0 |
| description | String | The brief description of the error. | 4.1.0 |
| details | String | The details about the error. | 4.1.0 |
| elaboration | String | The reserved field. Default value: null. | 4.1.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 4.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. | 4.1.0 |
SDK Sample
DetachL2NetworkFromHostAction action = new DetachL2NetworkFromHostAction();
action.l2NetworkUuid = "65509f36186c339d8fa85fe0b632c61f";
action.hostUuid = "99d5e85e897a317780ed520e3dafdf0c";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DetachL2NetworkFromHostAction.Result res = action.call();DetachL2NetworkFromHostAction action = DetachL2NetworkFromHostAction()
action.l2NetworkUuid = "65509f36186c339d8fa85fe0b632c61f"
action.hostUuid = "99d5e85e897a317780ed520e3dafdf0c"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DetachL2NetworkFromHostAction.Result res = action.call()GetVSwitchTypes
API Request
GET zstack//v1/l2-networks/vSwitchTypesOAuth: the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/l2-networks/vSwitchTypes| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| systemTags (Optional) | List | query | Optional. The system tags. | 4.8.0 | |
| userTags (Optional) | List | query | Optional. The user tags. | 4.8.0 |
API Response
{
"vSwitchTypes": [
"LinuxBridge",
"OvsDpdk"
]
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | boolean | The code. | 4.8.0 |
| types | List | The types. | 4.8.0 |
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 4.8.0 |
| 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. | 4.8.0 |
| description | String | The brief description of the error. | 4.8.0 |
| details | String | The details about the error. | 4.8.0 |
| elaboration | String | The reserved field. Default value: null. | 4.8.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 4.8.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. | 4.8.0 |
SDK Sample
GetVSwitchTypesAction action = new GetVSwitchTypesAction();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetVSwitchTypesAction.Result res = action.call();GetVSwitchTypesAction action = GetVSwitchTypesAction()
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetVSwitchTypesAction.Result res = action.call()QueryUplinkGroup
API Request
GET zstack/v1/l2-networks/virtual-switch/uplink-group
GET zstack/v1/l2-networks/virtual-switch/uplink-group/{uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/l2-networks/virtual-switch/uplink-groupcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edessfb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/l2-networks/virtual-switch/uplink-group/d36391a37b5c399ea46eb86bb2f6ec8aQueryable Fields
Run the CLI command tool, enter QueryUplinkGroup, and press Tab to view all queryable fields and resource names that support cross-table queries.
API Response
{
"inventories": [
{
"interfaceName": "eth0",
"type": "PhysicalInterface",
"interfaceUuid": "24343c2ab2803d82b16b531b5e58b086",
"hostUuid": "1b66d910a4de3418b6214b04ac1a2dd3",
"l2NetworkUuid": "0472b472fef131999b770c1671515cb7"
}
]
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | Whether the operation succeeded. | 4.3.0 |
| inventories | List | See inventories. | 4.3.0 |
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 4.3.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| interfaceName | String | The interface name. | 4.3.0 |
| bondingUuid | String | The bonding UUID. | 4.3.0 |
| interfaceUuid | String | The interface UUID. | 4.3.0 |
| hostUuid | String | The host UUID. | 4.3.0 |
| l2NetworkUuid | String | The Distributed Switch UUID. | 4.3.0 |
| l2ProviderType | String | The Distributed Switch implementation type. | 4.3.0 |
| bridgeName | String | The bridge name. | 4.3.0 |
| createDate | Timestamp | The creation date. | 4.3.0 |
| lastOpDate | Timestamp | The last operation date. | 4.3.0 |
| type | UplinkGroupType | See type. | 4.3.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| PhysicalInterface | UplinkGroupType | Physical NIC. | 4.3.0 |
| Bonding | UplinkGroupType | Bonding. | 4.3.0 |
| 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
QueryUplinkGroupAction action = new QueryUplinkGroupAction();
action.conditions = asList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryUplinkGroupAction.Result res = action.call();QueryUplinkGroupAction action = QueryUplinkGroupAction()
action.conditions = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryUplinkGroupAction.Result res = action.call()UpdateVirtualSwitchUplinkGroup
API Request
PUT zstack/v1/l2-networks/virtual-switch/{uuid}/uplink-groupAuthorization: OAuth the-session-uuid{
"updateVirtualSwitchUplinkGroup": {
"hostUuid": "922a7e4c781638ddb37d2098540530d8",
"slaveNames": [
"eth0"
],
"type": "LinuxBonding"
},
"systemTags": [],
"userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateVirtualSwitchUplinkGroup":{"hostUuid":"922a7e4c781638ddb37d2098540530d8","slaveNames":["eth0"],"type":"LinuxBonding"}}' \
http://localhost:8080/zstack/v1/l2-networks/virtual-switch/6614ce3ef02330cf8fcc734edd07da58/uplink-group| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The resource UUID. | 4.3.0 | |
| hostUuid | String | body(contained in updateVirtualSwitchUplinkGroup structure) |
The host UUID. | 4.3.0 | |
| slaveUuids (Optional) | List | body(contained in updateVirtualSwitchUplinkGroup structure) |
Optional. The slave NIC UUID list. | 4.3.0 | |
| slaveNames (Optional) | List | body(contained in updateVirtualSwitchUplinkGroup structure) |
Optional. The slave NIC name list. | 4.3.0 | |
| type (Optional) | String | body(contained in updateVirtualSwitchUplinkGroup structure) |
Optional. The bonding type. |
|
4.3.0 |
| systemTags (Optional) | List | body | Optional. The system tags. | 4.3.0 | |
| userTags (Optional) | List | body | Optional. The user tags. | 4.3.0 |
API Response
{
"inventory": {
"interfaceName": "eth0",
"type": "PhysicalInterface",
"interfaceUuid": "5d98a3ee3da1373e87b5f559c43da1e7",
"hostUuid": "ec5f7039252633748d29cb55ebcca73c",
"l2NetworkUuid": "d3357c017b793f21b6ec9e36f6f163e5"
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| interfaceName | String | The interface name. | 4.3.0 |
| bondingUuid | String | The bonding UUID. | 4.3.0 |
| interfaceUuid | String | The interface UUID. | 4.3.0 |
| hostUuid | String | The host UUID. | 4.3.0 |
| l2NetworkUuid | String | The Distributed Switch UUID. | 4.3.0 |
| l2ProviderType | String | The Distributed Switch implementation type. | 4.3.0 |
| bridgeName | String | The bridge name. | 4.3.0 |
| createDate | Timestamp | The creation date. | 4.3.0 |
| lastOpDate | Timestamp | The last operation date. | 4.3.0 |
| type | UplinkGroupType | See type. | 4.3.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| PhysicalInterface | UplinkGroupType | Physical NIC. | 4.3.0 |
| Bonding | UplinkGroupType | Bonding. | 4.3.0 |
| 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
UpdateVirtualSwitchUplinkGroupAction action = new UpdateVirtualSwitchUplinkGroupAction();
action.uuid = "6614ce3ef02330cf8fcc734edd07da58";
action.hostUuid = "922a7e4c781638ddb37d2098540530d8";
action.slaveNames = asList("eth0");
action.type = "LinuxBonding";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateVirtualSwitchUplinkGroupAction.Result res = action.call();UpdateVirtualSwitchUplinkGroupAction action = UpdateVirtualSwitchUplinkGroupAction()
action.uuid = "6614ce3ef02330cf8fcc734edd07da58"
action.hostUuid = "922a7e4c781638ddb37d2098540530d8"
action.slaveNames = [eth0]
action.type = "LinuxBonding"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateVirtualSwitchUplinkGroupAction.Result res = action.call()UpdateL2NetworkVirtualNetworkId
API Request
PUT zstack/v1/l2-networks/{uuid}/actionsAuthorization: OAuth the-session-uuid{
"updateL2NetworkVirtualNetworkId": {
"virtualNetworkId": 1
},
"systemTags": [],
"userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateL2NetworkVirtualNetworkId":{"virtualNetworkId":1}}' \
http://localhost:8080/zstack/v1/l2-networks/aaed66240c433b289841fe7dc5cba765/actions| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The resource UUID. | 4.10.0 | |
| virtualNetworkId | Integer | body(contained in updateL2NetworkVirtualNetworkId structure) |
The virtual network ID, vlanId, or vni. | 4.10.0 | |
| systemTags (Optional) | List | body | Optional. The system tags. | 4.10.0 | |
| userTags (Optional) | List | body | Optional. The user tags. | 4.10.0 |
API Response
{
"inventory": {
"vlan": 10,
"name": "Test-Net",
"description": "Test",
"zoneUuid": "883ddcdf78cb3ad7a7112c5d6e0832d0",
"physicalInterface": "eth0",
"type": "L2VlanNetwork"
}
}| 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 |
| zoneUuid | String | The Data Center UUID. | 0.6 |
| physicalInterface | String | The physical NIC. | 0.6 |
| type | String | The Switch type. | 0.6 |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
| attachedClusterUuids | List | The list of attached Cluster UUIDs. | 0.6 |
| attachedHostRefs | List | See attachedHostRefs. | 4.1.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| hostUuid | String | The host UUID. | 4.1.0 |
| l2NetworkUuid | String | The Switch UUID. | 4.1.0 |
| l2ProviderType | String | The Switch implementation type. | 4.1.0 |
| bridgeName | String | The bridge name. | 4.3.0 |
| createDate | Timestamp | The creation date. | 4.1.0 |
| lastOpDate | Timestamp | The last operation date. | 4.1.0 |
| 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
UpdateL2NetworkVirtualNetworkIdAction action = new UpdateL2NetworkVirtualNetworkIdAction();
action.uuid = "aaed66240c433b289841fe7dc5cba765";
action.virtualNetworkId = 1;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateL2NetworkVirtualNetworkIdAction.Result res = action.call();UpdateL2NetworkVirtualNetworkIdAction action = UpdateL2NetworkVirtualNetworkIdAction()
action.uuid = "aaed66240c433b289841fe7dc5cba765"
action.virtualNetworkId = 1
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateL2NetworkVirtualNetworkIdAction.Result res = action.call()Distributed Port Group Related Interfaces
CreatePortGroup
API Request
POST zstack/v1/l3-networks/port-groupAuthorization: OAuth the-session-uuid{
"params": {
"vSwitchUuid": "04d84d13c7e43c53810bd0d470210b4d",
"vlanMode": "ACCESS",
"vlan": 100,
"name": "port-group-1",
"description": "Test",
"type": "L3BasicNetwork",
"category": "Private",
"ipVersion": 4,
"system": false,
"enableIPAM": false
},
"systemTags": [],
"userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"vSwitchUuid":"04d84d13c7e43c53810bd0d470210b4d","vlanMode":"ACCESS","vlan":100,"name":"port-group-1","description":"Test","type":"L3BasicNetwork","category":"Private","ipVersion":4,"system":false,"enableIPAM":false}}' \
http://localhost:8080/zstack/v1/l3-networks/port-group| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| vSwitchUuid | String | body(contained in params structure) | The virtual Switch UUID. | 4.2.0 | |
| vlanMode (Optional) | String | body(contained in params structure) | Optional. The VLAN mode. |
|
4.2.0 |
| vlan | Integer | body(contained in params structure) | The VLAN number. | 4.2.0 | |
| vlanRanges (Optional) | String | body(contained in params structure) | Optional. The VLAN range. | 4.2.0 | |
| name | String | body(contained in params structure) | The resource name. | 4.2.0 | |
| description (Optional) | String | body(contained in params structure) | Optional. The detailed description of the resource. | 4.2.0 | |
| type (Optional) | String | body(contained in params structure) | Optional. The port group type. | 4.2.0 | |
| category (Optional) | String | body(contained in params structure) | Optional. The network type. This parameter must be used with the system tag. When system is true, you can set it to Public, Private, or System. |
|
4.2.0 |
| ipVersion (Optional) | Integer | body(contained in params structure) | Optional. The IP version. |
|
4.2.0 |
| system (Optional) | boolean | body(contained in params structure) | Optional. Whether it is used for system VMs. | 4.2.0 | |
| dnsDomain (Optional) | String | body(contained in params structure) | Optional. The DNS domain. | 4.2.0 | |
| enableIPAM (Optional) | Boolean | body(contained in params structure) | Optional. Whether IP address management is enabled. | 4.2.0 | |
| resourceUuid (Optional) | String | body(contained in params structure) | Optional. The resource UUID. | 4.2.0 | |
| tagUuids (Optional) | List | body(contained in params structure) | Optional. The tag UUID list. | 4.2.0 | |
| systemTags (Optional) | List | body | Optional. The system tags. | 4.2.0 | |
| userTags (Optional) | List | body | Optional. The user tags. | 4.2.0 |
API Response
{
"inventory": {
"vSwitchUuid": "39217a13614a3435bcc5ed199dc6bc04",
"vlanMode": "ACCESS",
"vlanId": 100,
"uuid": "afc3dd5d3e5e36f7af08797bd6582a7d",
"name": "port-group-1",
"description": "Test",
"type": "portGroup",
"zoneUuid": "2ee7572e6ce53147866096c79eb4d4f0",
"l2NetworkUuid": "5f62648626353514892de22f154eeee7",
"state": "Enabled",
"system": false,
"category": "Private",
"enableIPAM": false
}
}| 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 |
| 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 Distributed Port Group type. | 0.6 |
| zoneUuid | String | The Data Center UUID. | 0.6 |
| l2NetworkUuid | String | The port group Distributed Switch UUID. | 0.6 |
| state | String | The Distributed Port Group availability status. | 0.6 |
| dnsDomain | String | The DNS domain. | 0.6 |
| system | Boolean | Whether it is used for system VMs. | 0.6 |
| category | String | The network type. This parameter must be used with the system tag. When system is false, you can set it to Public or Private. | 0.6 |
| ipVersion | Integer | The IP version. | 3.1.0 |
| enableIPAM | Boolean | Whether IP address management is enabled. | 4.10.16 |
| 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 |
| reservedIpRanges | List | See reservedIpRanges. | 4.10.16 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 0.6 |
| l3NetworkUuid | String | The Distributed Port Group UUID. | 0.6 |
| name | String | The resource name. | 0.6 |
| description | String | The detailed description of the resource. | 0.6 |
| startIp | String | The start IP address. | 4.6.21 |
| endIp | String | The end IP address. | 4.6.21 |
| netmask | String | The netmask. | 4.6.21 |
| prefixLen | String | The prefix length. | 3.1.0 |
| gateway | String | The gateway. | 0.6 |
| networkCidr | String | The network CIDR. | 4.6.21 |
| 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. | 4.6.21 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| Normal | IpRangeType | Normal address range. | 4.6.21 |
| AddressPool | IpRangeType | Address pool range. | 4.6.21 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| l3NetworkUuid | String | The Distributed Port Group UUID. | 0.6 |
| networkServiceProviderUuid | String | The network service provider module UUID. | 0.6 |
| networkServiceType | String | The network service type. | 0.6 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| id | Long | The resource ID. | 2.3 |
| l3NetworkUuid | String | The Distributed Port Group UUID. | 2.3 |
| prefix | String | The prefix. | 2.3 |
| nexthop | String | The next hop. | 2.3 |
| createDate | Timestamp | The creation date. | 2.3 |
| lastOpDate | Timestamp | The last operation date. | 2.3 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 4.10.16 |
| l3NetworkUuid | String | The Distributed Port Group UUID. | 4.10.16 |
| name | String | The resource name. | 4.10.16 |
| description | String | The detailed description of the resource. | 4.10.16 |
| startIp | String | The start IP address (included in the reserved IP range). | 4.10.16 |
| endIp | String | The end IP address (included in the reserved IP range). | 4.10.16 |
| ipVersion | Integer | The IP version. | 4.10.16 |
| createDate | Timestamp | The creation date. | 4.10.16 |
| lastOpDate | Timestamp | The last operation date. | 4.10.16 |
SDK Sample
CreatePortGroupAction action = new CreatePortGroupAction();
action.vSwitchUuid = "04d84d13c7e43c53810bd0d470210b4d";
action.vlanMode = "ACCESS";
action.vlan = 100;
action.name = "port-group-1";
action.description = "Test";
action.type = "L3BasicNetwork";
action.category = "Private";
action.ipVersion = 4;
action.system = false;
action.enableIPAM = false;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreatePortGroupAction.Result res = action.call();action = CreatePortGroupAction()
action.vSwitchUuid = "04d84d13c7e43c53810bd0d470210b4d"
action.vlanMode = "ACCESS"
action.vlan = 100
action.name = "port-group-1"
action.description = "Test"
action.type = "L3BasicNetwork"
action.category = "Private"
action.ipVersion = 4
action.system = false
action.enableIPAM = false
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()DeletePortGroup
API Request
DELETE zstack/v1/l3-networks/port-group/{uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/l3-networks/port-group/04e1623d8c9531c7b42d6257c7ef774f| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The resource UUID. | 4.2.0 | |
| deleteMode (Optional) | String | body | Optional. The delete mode (Permissive or Enforcing, default is Permissive). | 4.2.0 | |
| systemTags (Optional) | List | body | Optional. The system tags. | 4.2.0 | |
| userTags (Optional) | List | body | Optional. The user tags. | 4.2.0 |
API Response
{} on success, and returns a JSON structure containing an error field on failure. For example:{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Sample
DeletePortGroupAction action = new DeletePortGroupAction();
action.uuid = "04e1623d8c9531c7b42d6257c7ef774f";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeletePortGroupAction.Result res = action.call();DeletePortGroupAction action = DeletePortGroupAction()
action.uuid = "04e1623d8c9531c7b42d6257c7ef774f"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeletePortGroupAction.Result res = action.call()QueryPortGroup
API Request
GET zstack/v1/l3-networks/port-group
GET zstack/v1/l3-networks/port-group/{uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/l3-networks/port-groupcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/l3-networks/port-group/c94adc28385a31d99a2c07dfa8120532Queryable Fields
Run the CLI command tool, enter QueryPortGroup, and press Tab to view all queryable fields and resource names that support cross-table queries.
API Response
{
"inventories": [
{
"vSwitchUuid": "5343e94b3aa93086b81c1b33c335b9ad",
"vlanMode": "ACCESS",
"vlanId": 100,
"uuid": "01a9693135323cf1acb3049e8ddf50b2",
"name": "port-group-1",
"description": "Test",
"type": "portGroup",
"zoneUuid": "36712d24b27b327aae544095c768366b",
"l2NetworkUuid": "49012f786210301697167b3771a65e8c",
"state": "Enabled",
"system": false,
"category": "Private",
"enableIPAM": false
}
]
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | Whether the operation succeeded. | 4.2.0 |
| 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 |
| 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 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| vSwitchUuid | String | The virtual Switch UUID. | 4.2.0 |
| vlanId | Integer | The VLAN number. | 4.2.0 |
| vlanRanges | String | The VLAN range. | 4.2.0 |
| uuid | String | The resource UUID. | 4.2.0 |
| name | String | The resource name. | 4.2.0 |
| description | String | The detailed description of the resource. | 4.2.0 |
| type | String | The port group type. | 4.2.0 |
| zoneUuid | String | The Data Center UUID. | 4.2.0 |
| l2NetworkUuid | String | The port group Distributed Switch UUID. | 4.2.0 |
| state | String | The status. | 4.2.0 |
| dnsDomain | String | The DNS domain. | 4.2.0 |
| system | Boolean | Whether it is used for system VMs. | 4.2.0 |
| category | String | The network type. This parameter must be used with the system tag. When system is true, you can set it to Public, Private, or System. | 4.2.0 |
| ipVersion | Integer | The IP version. | 4.2.0 |
| enableIPAM | Boolean | Whether IP address management is enabled. | 4.2.0 |
| createDate | Timestamp | The creation date. | 4.2.0 |
| lastOpDate | Timestamp | The last operation date. | 4.2.0 |
| dns | List | The DNS server address. | 4.2.0 |
| vlanMode | PortGroupVlanMode | See vlanMode. | 4.2.0 |
| ipRanges | List | See ipRanges. | 0.6 |
| networkServices | List | See networkServices. | 0.6 |
| hostRoute | List | See hostRoute. | 2.3 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| ACCESS | PortGroupVlanMode | The ACCESS value. | 4.2.0 |
| TRUNK | PortGroupVlanMode | The TRUNK value. | 4.2.0 |
| PVLAN | PortGroupVlanMode | The PVLAN value. | 4.2.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 0.6 |
| l3NetworkUuid | String | The Distributed Port Group UUID. | 0.6 |
| name | String | The resource name. | 0.6 |
| description | String | The detailed description of the resource. | 0.6 |
| startIp | String | The start IP address. | 0.6 |
| endIp | String | The end IP address. | 0.6 |
| netmask | String | The netmask. | 0.6 |
| prefixLen | String | The prefix length. | 3.1.0 |
| gateway | String | The gateway. | 0.6 |
| networkCidr | String | The network CIDR. | 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 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| Normal | IpRangeType | Normal address range. | 3.9 |
| AddressPool | IpRangeType | Address pool range. | 3.9 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| l3NetworkUuid | String | The Distributed Port Group UUID. | 0.6 |
| networkServiceProviderUuid | String | The network service provider module UUID. | 0.6 |
| networkServiceType | String | The network service type. | 0.6 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| id | Long | The resource ID. | 2.3 |
| l3NetworkUuid | String | The Distributed Port Group UUID. | 2.3 |
| prefix | String | The prefix. | 2.3 |
| nexthop | String | The next hop. | 2.3 |
| createDate | Timestamp | The creation date. | 2.3 |
| lastOpDate | Timestamp | The last operation date. | 2.3 |
SDK Sample
QueryPortGroupAction action = new QueryPortGroupAction();
action.conditions = asList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryPortGroupAction.Result res = action.call();QueryPortGroupAction action = QueryPortGroupAction()
action.conditions = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryPortGroupAction.Result res = action.call()UpdatePortGroup
API Request
PUT zstack/v1/l3-networks/port-group/{uuid}/actionsAuthorization: OAuth the-session-uuid{
"updatePortGroup": {
"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 -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updatePortGroup":{"name":"Test-L3Network"}}' \
http://localhost:8080/zstack/v1/l3-networks/port-group/a1a3a4bea5e73628b591081fde9f019a/actions| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The resource UUID. | 4.2.0 | |
| name | String | body(contained in the updatePortGroup structure) | The resource name. | 4.2.0 | |
| description | String | body(contained in the updatePortGroup structure) | Optional. The detailed description of the resource. | 4.2.0 | |
| dnsDomain | String | body(contained in the updatePortGroup structure) | Optional. The DNS domain. | 4.2.0 | |
| category | String | body(contained in the updatePortGroup structure) | Optional. The network type. It must be used with the system tag. When system is true, it can be set to Public or Private. |
|
4.2.0 |
| system | Boolean | body(contained in the updatePortGroup structure) | Optional. Whether it is used for a system Virtual Machine. | 4.2.0 | |
| systemTags | List | body | Optional. The system tags. | 4.2.0 | |
| userTags | List | body | Optional. The user tags. | 4.2.0 |
API Response
{
"inventory": {
"vSwitchUuid": "d0d6d19b51ef3ec18b9607a51ac8fa47",
"vlanMode": "ACCESS",
"vlanId": 100,
"uuid": "20f61c97cf2e32e58bed3812144de79d",
"name": "port-group-1",
"description": "Test",
"type": "portGroup",
"zoneUuid": "231b37f483e93801bad53885c1fe3cdb",
"l2NetworkUuid": "60cbdcfee56831cdb8324aa7d9797032",
"state": "Enabled",
"system": false,
"category": "Private",
"enableIPAM": false
}
}| 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 |
| 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 resource type. | 0.6 |
| zoneUuid | String | The Data Center UUID. | 0.6 |
| l2NetworkUuid | String | The port group Distributed Switch UUID. | 0.6 |
| state | String | The resource state. | 0.6 |
| dnsDomain | String | The DNS domain. | 0.6 |
| system | Boolean | The system. | 0.6 |
| category | String | The category. | 0.6 |
| ipVersion | Integer | The IP protocol number. | 3.1.0 |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
| dns | List | The DNS server address. | 0.6 |
| ipRanges | List | See ipRanges. | 0.6 |
| networkServices | List | See networkServices. | 0.6 |
| hostRoute | List | See hostRoute. | 2.3 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 0.6 |
| l3NetworkUuid | String | The Distributed Port Group UUID. | 0.6 |
| name | String | The resource name. | 0.6 |
| description | String | The detailed description of the resource. | 0.6 |
| startIp | String | The start IP address. | 0.6 |
| endIp | String | The end IP address. | 0.6 |
| netmask | String | The netmask. | 0.6 |
| prefixLen | String | The prefix length. | 3.1.0 |
| gateway | String | The gateway. | 0.6 |
| networkCidr | String | The network CIDR. | 0.6 |
| ipVersion | Integer | The IP protocol number. | 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 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| Normal | IpRangeType | Normal address range. | 3.9 |
| AddressPool | IpRangeType | Address pool range. | 3.9 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| l3NetworkUuid | String | The Distributed Port Group UUID. | 0.6 |
| networkServiceProviderUuid | String | The network service provider UUID. | 0.6 |
| networkServiceType | String | The network service type. | 0.6 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| id | Long | The resource ID. | 2.3 |
| l3NetworkUuid | String | The Distributed Port Group UUID. | 2.3 |
| prefix | String | The prefix. | 2.3 |
| nexthop | String | The next hop. | 2.3 |
| createDate | Timestamp | The creation date. | 2.3 |
| lastOpDate | Timestamp | The last operation date. | 2.3 |
SDK Sample
UpdatePortGroupAction action = new UpdatePortGroupAction();
action.uuid = "a1a3a4bea5e73628b591081fde9f019a";
action.name = "Test-L3Network";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdatePortGroupAction.Result res = action.call();UpdatePortGroupAction action = UpdatePortGroupAction()
action.uuid = "a1a3a4bea5e73628b591081fde9f019a"
action.name = "Test-L3Network"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdatePortGroupAction.Result res = action.call()GetL3NetworkTypes
API Request
GET zstack/v1/l3-networks/typesAuthorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 3a142b201e9342abbb5864a0ea48992e" \
-X GET http://localhost:8080/zstack/v1/l3-networks/types| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| systemTags | List | query | Optional. The system tags. | 0.6 | |
| userTags | List | query | Optional. The user tags. | 0.6 |
API Response
{
"l3NetworkTypes": [
"L3BasicNetwork"
]
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| types | List | The types. | 0.6 |
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 0.6 |
| 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
GetL3NetworkTypesAction action = new GetL3NetworkTypesAction();
action.sessionId = "9105437ebb27461fbae36ecb9336ceba";
GetL3NetworkTypesAction.Result res = action.call();GetL3NetworkTypesAction action = GetL3NetworkTypesAction()
action.sessionId = "a69bae9c3cad4209b042956b23c70af7"
GetL3NetworkTypesAction.Result res = action.call()ChangeL3NetworkState
API Request
PUT zstack/v1/l3-networks/{uuid}/actionsAuthorization: OAuth the-session-uuid{
"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 -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| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The resource UUID. | 0.6 | |
| stateEvent | String | body(contained in the changeL3NetworkState structure) | The state. The allowed values are enable and disable. |
|
0.6 |
| systemTags | List | body | Optional. The system tags. | 0.6 | |
| userTags | List | body | Optional. The user tags. | 0.6 |
API Response
{
"inventory": {
"name": "Test-L3Network",
"l2NetworkUuid": "dfae4bce43694f4d9fc0ba5cdf4e38bd"
}
}| 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 |
| 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 resource type. | 0.6 |
| zoneUuid | String | The Data Center UUID. | 0.6 |
| l2NetworkUuid | String | The port group Distributed Switch UUID. | 0.6 |
| state | String | The resource state. | 0.6 |
| dnsDomain | String | The DNS domain. | 0.6 |
| system | Boolean | The system. | 0.6 |
| category | String | The category. | 0.6 |
| ipVersion | Integer | The IP protocol number. | 3.1.0 |
| enableIPAM | Boolean | Enable IP address management. | 4.10.16 |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
| dns | List | The DNS server address. | 0.6 |
| ipRanges | List | See ipRanges. | 0.6 |
| networkServices | List | See networkServices. | 0.6 |
| hostRoute | List | See hostRoute. | 2.3 |
| reservedIpRanges | List | See reservedIpRanges. | 4.10.16 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 0.6 |
| l3NetworkUuid | String | The Distributed Port Group UUID. | 0.6 |
| name | String | The resource name. | 0.6 |
| description | String | The detailed description of the resource. | 0.6 |
| startIp | String | The start IP. | 0.6 |
| endIp | String | The end IP. | 0.6 |
| netmask | String | The netmask. | 0.6 |
| prefixLen | String | The prefix length. | 3.1.0 |
| gateway | String | The gateway IP address. | 0.6 |
| networkCidr | String | The network cidr. | 0.6 |
| ipVersion | Integer | The IP protocol number. | 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 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| l3NetworkUuid | String | The Distributed Port Group UUID. | 0.6 |
| networkServiceProviderUuid | String | The network service provider UUID. | 0.6 |
| networkServiceType | String | The network service type. | 0.6 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| id | Long | The resource ID. | 2.3 |
| l3NetworkUuid | String | The Distributed Port Group UUID. | 2.3 |
| prefix | String | The prefix. | 2.3 |
| nexthop | String | The next hop. | 2.3 |
| createDate | Timestamp | The creation date. | 2.3 |
| lastOpDate | Timestamp | The last operation date. | 2.3 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 4.10.16 |
| l3NetworkUuid | String | The Distributed Port Group UUID. | 4.10.16 |
| name | String | The resource name. | 4.10.16 |
| description | String | The detailed description of the resource. | 4.10.16 |
| startIp | String | The start IP address (included in the reserved address range). | 4.10.16 |
| endIp | String | The end IP address (included in the reserved address range). | 4.10.16 |
| ipVersion | Integer | The IP protocol number. | 4.10.16 |
| createDate | Timestamp | The creation date. | 4.10.16 |
| lastOpDate | Timestamp | The last operation date. | 4.10.16 |
SDK Sample
ChangeL3NetworkStateAction action = new ChangeL3NetworkStateAction();
action.uuid = "eb0849bf0e57400da650a09f2e852260";
action.stateEvent = "enable";
action.sessionId = "be8ec965ebd94169ba713c42dc079af9";
ChangeL3NetworkStateAction.Result res = action.call();
action = ChangeL3NetworkStateAction()
action.uuid = "a8744f1ba60c33f3a2c912c077f41fe5"
action.stateEvent = "enable"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()GetL3NetworkDhcpIpAddress
API Request
GET zstack/v1/l3-networks/{l3NetworkUuid}/dhcp-ipAuthorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/l3-networks/82cae6542d3b3e7ea50dab8681f3785c/dhcp-ip| Name | Type | Location | Description | Allowed Values | 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
{
"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 | Indicates whether the operation is successful. | 0.6 |
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 0.6 |
| 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
GetL3NetworkDhcpIpAddressAction action = new GetL3NetworkDhcpIpAddressAction();
action.l3NetworkUuid = "1c311c313859434f8586d4288a31952e";
action.sessionId = "dd1a8993de0e41e18d8718ea2e2d8259";
GetL3NetworkDhcpIpAddressAction.Result res = action.call();GetL3NetworkDhcpIpAddressAction action = GetL3NetworkDhcpIpAddressAction()
action.l3NetworkUuid = "4970a85c53a24e35a55f44830058e719"
action.sessionId = "50fd78e250d94c5d944a5fa1a5d6bde0"
GetL3NetworkDhcpIpAddressAction.Result res = action.call()RemoveDnsFromL3Network
API Request
DELETE/v1/l3-networks/{l3NetworkUuid}/dns/{dns}Authorization: OAuth the-session-uuidcurl -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?| Name | Type | Location | Description | Allowed Values | 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
{
"inventory": {
"name": "Test-L3Network",
"l2NetworkUuid": "535aea9c1be24fb9b172fa1955341685",
"dns": []
}
}| 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 |
| 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 resource type. | 0.6 |
| zoneUuid | String | The zone UUID. | 0.6 |
| l2NetworkUuid | String | The L2 network UUID. | 0.6 |
| state | String | The resource state. | 0.6 |
| dnsDomain | String | The DNS domain. | 0.6 |
| system | Boolean | The system. | 0.6 |
| category | String | The category. | 0.6 |
| ipVersion | Integer | The IP version. | 3.1.0 |
| enableIPAM | Boolean | Enables IP address management. | 4.10.16 |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
| dns | List | The DNS server address. | 0.6 |
| ipRanges | List | See ipRanges. | 0.6 |
| networkServices | List | See networkServices. | 0.6 |
| hostRoute | List | See hostRoute. | 2.3 |
| reservedIpRanges | List | See reservedIpRanges | 4.10.16 |
| 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 | The start IP. | 0.6 |
| endIp | String | The end IP. | 0.6 |
| netmask | String | The netmask. | 0.6 |
| prefixLen | String | The prefix length. | 3.1.0 |
| gateway | String | The gateway IP address. | 0.6 |
| networkCidr | String | The network cidr. | 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 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| l3NetworkUuid | String | The L3 network UUID. | 0.6 |
| networkServiceProviderUuid | String | The network service provider UUID. | 0.6 |
| networkServiceType | String | The network service type. | 0.6 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| id | Long | The resource ID. | 2.3 |
| l3NetworkUuid | String | The L3 network UUID. | 2.3 |
| prefix | String | The prefix. | 2.3 |
| nexthop | String | The next hop. | 2.3 |
| createDate | Timestamp | The creation date. | 2.3 |
| lastOpDate | Timestamp | The last operation date. | 2.3 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 4.10.16 |
| l3NetworkUuid | String | The L3 network UUID. | 4.10.16 |
| name | String | The resource name. | 4.10.16 |
| description | String | The detailed description of the resource. | 4.10.16 |
| startIp | String | The start IP address (included in the reserved IP range). | 4.10.16 |
| endIp | String | The end IP address (included in the reserved IP range). | 4.10.16 |
| ipVersion | Integer | The IP version. | 4.10.16 |
| createDate | Timestamp | The creation date. | 4.10.16 |
| lastOpDate | Timestamp | The last operation date. | 4.10.16 |
SDK Sample
RemoveDnsFromL3NetworkAction action = new RemoveDnsFromL3NetworkAction();
action.l3NetworkUuid = "3e9227b9ecbd42bba0f3a4620f5655d2";
action.dns = "8.8.4.4";
action.sessionId = "f3e42d2a37ed4c42a6ce7d192af94e05";
RemoveDnsFromL3NetworkAction.Result res = action.call();action = RemoveDnsFromL3NetworkAction()
action.l3NetworkUuid = "bdb41ab0a7c131a285acbfbd6e88b7d1"
action.dns = "8.8.4.4"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()AddDnsToL3Network
API Request
POST zstack/v1/l3-networks/{l3NetworkUuid}/dnsAuthorization: OAuth the-session-uuid{
"params": {
"dns": "8.8.8.8"
},
"systemTags": [],
"userTags": []
}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| Name | Type | Location | Description | Allowed Values | 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
{
"inventory": {
"name": "Test-L3Network",
"l2NetworkUuid": "08f7b0b577a84c28968ddce5a9377c5d",
"dns": [
"8.8.8.8"
]
}
}| 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 |
| 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 resource type. | 0.6 |
| zoneUuid | String | The zone UUID. | 0.6 |
| l2NetworkUuid | String | The L2 network UUID. | 0.6 |
| state | String | The resource state. | 0.6 |
| dnsDomain | String | The DNS domain. | 0.6 |
| system | Boolean | The system. | 0.6 |
| category | String | The category. | 0.6 |
| ipVersion | Integer | The IP version. | 3.1.0 |
| enableIPAM | Boolean | Enables IP address management. | 4.10.16 |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
| dns | List | The DNS server address. | 0.6 |
| ipRanges | List | See ipRanges. | 0.6 |
| networkServices | List | See networkServices. | 0.6 |
| hostRoute | List | See hostRoute. | 2.3 |
| reservedIpRanges | List | See reservedIpRanges | 4.10.16 |
| 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 | The start IP. | 0.6 |
| endIp | String | The end IP. | 0.6 |
| netmask | String | The netmask. | 0.6 |
| prefixLen | String | The prefix length. | 3.1.0 |
| gateway | String | The gateway IP address. | 0.6 |
| networkCidr | String | The network cidr. | 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 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| l3NetworkUuid | String | The L3 network UUID. | 0.6 |
| networkServiceProviderUuid | String | The network service provider UUID. | 0.6 |
| networkServiceType | String | The network service type. | 0.6 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| id | Long | The resource ID. | 2.3 |
| l3NetworkUuid | String | The L3 network UUID. | 2.3 |
| prefix | String | The prefix. | 2.3 |
| nexthop | String | The next hop. | 2.3 |
| createDate | Timestamp | The creation date. | 2.3 |
| lastOpDate | Timestamp | The last operation date. | 2.3 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 4.10.16 |
| l3NetworkUuid | String | The L3 network UUID. | 4.10.16 |
| name | String | The resource name. | 4.10.16 |
| description | String | The detailed description of the resource. | 4.10.16 |
| startIp | String | The start IP address (included in the reserved IP range). | 4.10.16 |
| endIp | String | The end IP address (included in the reserved IP range). | 4.10.16 |
| ipVersion | Integer | The IP version. | 4.10.16 |
| createDate | Timestamp | The creation date. | 4.10.16 |
| lastOpDate | Timestamp | The last operation date. | 4.10.16 |
SDK Sample
AddDnsToL3NetworkAction action = new AddDnsToL3NetworkAction();
action.l3NetworkUuid = "80bfafb9c4534a2593fcda534ee6414f";
action.dns = "8.8.8.8";
action.sessionId = "0a24af3791134b81bba960844b3aa899";
AddDnsToL3NetworkAction.Result res = action.call();action = AddDnsToL3NetworkAction()
action.l3NetworkUuid = "0b8da8c298ed3960925abbcc4f913da8"
action.dns = "8.8.8.8"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()AddHostRouteToL3Network
API Request
POST zstack/v1/l3-networks/{l3NetworkUuid}/hostrouteAuthorization: OAuth the-session-uuid{
"params": {
"prefix": "169.254.169.254/32",
"nexthop": "192.168.1.254"
},
"systemTags": [],
"userTags": []
}
Note: In the preceding sample, systemTags and userTags are optional. These two fields can be included in the body structure.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| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| l3NetworkUuid | String | url | The Distributed Port Group UUID. | 2.3 | |
| prefix | String | body(contained in the params structure) | The prefix. | 2.3 | |
| nexthop | String | body(contained in the params structure) | The next hop. | 2.3 | |
| systemTags (Optional) | List | body | Optional. The system tags. | 2.3 | |
| userTags (Optional) | List | body | Optional. The user tags. | 2.3 |
API 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 |
|---|---|---|---|
| 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 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID, which uniquely identifies the resource. | 0.6 |
| name | String | The resource name. | 0.6 |
| description | String | The detailed description of the resource. | 0.6 |
| type | String | The resource type. | 0.6 |
| zoneUuid | String | The Data Center UUID. | 0.6 |
| l2NetworkUuid | String | The port group Distributed Switch UUID. | 0.6 |
| state | String | The resource state. | 0.6 |
| dnsDomain | String | The DNS domain. | 0.6 |
| system | Boolean | The system. | 0.6 |
| category | String | The category. | 0.6 |
| ipVersion | Integer | The IP protocol number. | 3.1.0 |
| enableIPAM | Boolean | Enables IP address management. | 4.10.16 |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
| dns | List | The DNS server address. | 0.6 |
| ipRanges | List | See ipRanges | 0.6 |
| networkServices | List | See networkServices | 0.6 |
| hostRoute | List | See hostRoute | 2.3 |
| reservedIpRanges | List | See reservedIpRanges | 4.10.16 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID, which uniquely identifies the resource. | 0.6 |
| l3NetworkUuid | String | The Distributed Port Group UUID. | 0.6 |
| name | String | The resource name. | 0.6 |
| description | String | The detailed description of the resource. | 0.6 |
| startIp | String | The start IP. | 0.6 |
| endIp | String | The end IP. | 0.6 |
| netmask | String | The netmask. | 0.6 |
| prefixLen | String | The prefix length. | 3.1.0 |
| gateway | String | The gateway IP address. | 0.6 |
| networkCidr | String | The network cidr. | 0.6 |
| ipVersion | Integer | The IP protocol number. | 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 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| l3NetworkUuid | String | The Distributed Port Group UUID. | 0.6 |
| networkServiceProviderUuid | String | The network service provider UUID. | 0.6 |
| networkServiceType | String | The network service type. | 0.6 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| id | Long | The resource ID. | 2.3 |
| l3NetworkUuid | String | The Distributed Port Group UUID. | 2.3 |
| prefix | String | The prefix. | 2.3 |
| nexthop | String | The next hop. | 2.3 |
| createDate | Timestamp | The creation date. | 2.3 |
| lastOpDate | Timestamp | The last operation date. | 2.3 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID, which uniquely identifies the resource. | 4.10.16 |
| l3NetworkUuid | String | The Distributed Port Group UUID. | 4.10.16 |
| name | String | The resource name. | 4.10.16 |
| description | String | The detailed description of the resource. | 4.10.16 |
| startIp | String | The start IP address (included in the reserved address range). | 4.10.16 |
| endIp | String | The end IP address (included in the reserved address range). | 4.10.16 |
| ipVersion | Integer | The IP protocol number. | 4.10.16 |
| createDate | Timestamp | The creation date. | 4.10.16 |
| lastOpDate | Timestamp | The last operation date. | 4.10.16 |
SDK Sample
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();action = AddHostRouteToL3NetworkAction()
action.l3NetworkUuid = "45d86c07f10437c6bf3161bae9974bb7"
action.prefix = "169.254.169.254/32"
action.nexthop = "192.168.1.254"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()RemoveHostRouteFromL3Network
API Request
DELETE zstack/v1/l3-networks/{l3NetworkUuid}/hostroute?prefix={prefix}Authorization: OAuth the-session-uuidcurl -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| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| l3NetworkUuid | String | url | The Distributed Port Group UUID. | 2.3 | |
| prefix | String | body | The prefix. | 2.3 | |
| systemTags (Optional) | List | body | Optional. The system tags. | 2.3 | |
| userTags (Optional) | List | body | Optional. The user tags. | 2.3 |
API Response
{
"inventory": {
"name": "Test-L3Network",
"l2NetworkUuid": "15e1e6a016f43a5688ca3d3445076309",
"dns": []
}
}| 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 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID, which uniquely identifies the resource. | 0.6 |
| name | String | The resource name. | 0.6 |
| description | String | The detailed description of the resource. | 0.6 |
| type | String | The resource type. | 0.6 |
| zoneUuid | String | The Data Center UUID. | 0.6 |
| l2NetworkUuid | String | The port group Distributed Switch UUID. | 0.6 |
| state | String | The resource state. | 0.6 |
| dnsDomain | String | The DNS domain. | 0.6 |
| system | Boolean | The system. | 0.6 |
| category | String | The category. | 0.6 |
| ipVersion | Integer | The IP protocol number. | 3.1.0 |
| enableIPAM | Boolean | Enables IP address management. | 4.10.16 |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
| dns | List | The DNS server address. | 0.6 |
| ipRanges | List | See ipRanges | 0.6 |
| networkServices | List | See networkServices | 0.6 |
| hostRoute | List | See hostRoute | 2.3 |
| reservedIpRanges | List | See reservedIpRanges | 4.10.16 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID, which uniquely identifies the resource. | 0.6 |
| l3NetworkUuid | String | The Distributed Port Group UUID. | 0.6 |
| name | String | The resource name. | 0.6 |
| description | String | The detailed description of the resource. | 0.6 |
| startIp | String | The start IP. | 0.6 |
| endIp | String | The end IP. | 0.6 |
| netmask | String | The netmask. | 0.6 |
| gateway | String | The gateway IP address. | 0.6 |
| networkCidr | String | The network cidr. | 0.6 |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| l3NetworkUuid | String | The Distributed Port Group UUID. | 0.6 |
| networkServiceProviderUuid | String | The network service provider UUID. | 0.6 |
| networkServiceType | String | The network service type. | 0.6 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| id | Long | The resource ID. | 2.3 |
| l3NetworkUuid | String | The Distributed Port Group UUID. | 2.3 |
| prefix | String | The prefix. | 2.3 |
| nexthop | String | The next hop. | 2.3 |
| createDate | Timestamp | The creation date. | 2.3 |
| lastOpDate | Timestamp | The last operation date. | 2.3 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID, which uniquely identifies the resource. | 4.10.16 |
| l3NetworkUuid | String | The Distributed Port Group UUID. | 4.10.16 |
| name | String | The resource name. | 4.10.16 |
| description | String | The detailed description of the resource. | 4.10.16 |
| startIp | String | The start IP address (included in the reserved address range). | 4.10.16 |
| endIp | String | The end IP address (included in the reserved address range). | 4.10.16 |
| ipVersion | Integer | The IP protocol number. | 4.10.16 |
| createDate | Timestamp | The creation date. | 4.10.16 |
| lastOpDate | Timestamp | The last operation date. | 4.10.16 |
SDK Sample
RemoveHostRouteFromL3NetworkAction action = new RemoveHostRouteFromL3NetworkAction();
action.l3NetworkUuid = "8648a70a245232c5a1bee9ae408419e5";
action.prefix = "169.254.169.254/32";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RemoveHostRouteFromL3NetworkAction.Result res = action.call();action = RemoveHostRouteFromL3NetworkAction()
action.l3NetworkUuid = "8648a70a245232c5a1bee9ae408419e5"
action.prefix = "169.254.169.254/32"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()GetFreeIp
API Request
GET zstack/v1/l3-networks/ip/freeGET zstack/v1/l3-networks/{l3NetworkUuid}/ip/freeGET zstack/v1/l3-networks/ip-ranges/{ipRangeUuid}/ip/freeAuthorization: OAuth the-session-uuidcurl -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.0curl -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.0curl -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| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| l3NetworkUuid | String | query | The L3 network UUID. Note: Either l3NetworkUuid or ipRangeUuid is required. |
0.6 | |
| ipRangeUuid | String | query | The IP range UUID. Note: Either l3NetworkUuid or ipRangeUuid is required. |
0.6 | |
| start | String | query | Optional. The start IP address. | 0.6 | |
| ipRangeType | String | query | Optional. The address type. |
|
3.9.0 |
| ipVersion | Integer | query | Optional. The IP version. |
|
3.10.0 |
| limit | int | query | Optional. The maximum number of IP addresses to return. | 0.6 | |
| systemTags | List | query | Optional. The system tags. | 0.6 | |
| userTags | List | query | Optional. The user tags. | 0.6 |
API Response
{
"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 |
|---|---|---|---|
| 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 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| ipRangeUuid | String | The IP range UUID. | 0.6 |
| ip | String | The IP address. | 0.6 |
| netmask | String | The netmask. | 0.6 |
| gateway | String | The gateway IP address. | 0.6 |
SDK Sample
GetFreeIpAction action = new GetFreeIpAction();
action.l3NetworkUuid = "c8cd63a1882331a9a5ee83e5d9b265ec";
action.ipRangeUuid = "10fc8508fd723e63bcc57b8bb6d7a133";
action.limit = 100.0;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetFreeIpAction.Result res = action.call();GetFreeIpAction action = GetFreeIpAction()
action.l3NetworkUuid = "c8cd63a1882331a9a5ee83e5d9b265ec"
action.ipRangeUuid = "10fc8508fd723e63bcc57b8bb6d7a133"
action.limit = 100.0
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetFreeIpAction.Result res = action.call()CheckIpAvailability
API Request
GET zstack/v1/l3-networks/{l3NetworkUuid}/ip/{ip}/availabilityAuthorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 642bc388bc3040ce9ed0c477bd6b3874" \
-X GET http://localhost:8080/zstack/v1/l3-networks/44fc110c3d87326299b46975aacb1705/ip/192.168.10.100/availability?arpCheck=false&ipRangeCheck=true| Name | Type | Location | Description | Allowed Values | 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. Specifies whether to use arping to check IP availability. | 4.10.16 | |
| ipRangeCheck | Boolean | query | Optional. Specifies whether to check IP availability within the IP range in the database. | 4.10.16 |
API Response
{
"available": true
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| available | boolean | Indicates whether the IP address is available. | 0.6 |
| success | boolean | Indicates whether the operation is successful. | 0.6 |
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 0.6 |
| 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
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();action = CheckIpAvailabilityAction()
action.l3NetworkUuid = "44fc110c3d87326299b46975aacb1705"
action.ip = "192.168.10.100"
action.arpCheck = false
action.ipRangeCheck = true
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()GetIpAddressCapacity
API Request
GET zstack/v1/ip-capacityAuthorization: OAuth the-session-uuid scurl -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| Name | Type | Location | Description | Starting Version |
|---|---|---|---|---|
| zoneUuids | List | query | Optional. The zone UUID list. | 0.6 |
| l3NetworkUuids | List | query | Optional. The L3 network UUID list. | 0.6 |
| ipRangeUuids | List | query | Optional. The IP range UUID list. | 0.6 |
| all | boolean | query | Optional. Specifies whether to query all IP capacities in the system. | 0.6 |
| systemTags | List | query | Optional. The system tags. | 0.6 |
| userTags | List | query | Optional. The user tags. | 0.6 |
API 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 address capacity. | 0.6 |
| availableCapacity | long | The available IP address capacity. | 0.6 |
| usedIpAddressNumber | long | The number of used IP addresses. | 3.10.0 |
| ipv4TotalCapacity | long | The total 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 total 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 resource (IP range, L3 network, or zone). | 3.9.0 |
| success | boolean | Indicates whether the operation is successful. | 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 |
| 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 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| resourceUuid | String | The resource UUID. | 3.9.0 |
| totalCapacity | long | The total IP address capacity. | 3.9.0 |
| availableCapacity | long | The available IP address 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 number of used IPv4 addresses. | 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 number of used IPv6 addresses. | 3.10.0 |
| 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
GetIpAddressCapacityAction action = new GetIpAddressCapacityAction();
action.ipRangeUuids = asList("6bf57331ebe433389c6c230153ac5d8d");
action.all = false;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetIpAddressCapacityAction.Result res = action.call();GetIpAddressCapacityAction action = GetIpAddressCapacityAction()
action.ipRangeUuids = [6bf57331ebe433389c6c230153ac5d8d]
action.all = false
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetIpAddressCapacityAction.Result res = action.call()AddIpRange
API Request
POST zstack/v1/l3-networks/{l3NetworkUuid}/ip-rangesAuthorization: OAuth the-session-uuid{
"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 -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| 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 |
Note:
- ZStack ZSphere 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
{
"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 |
| 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 |
| 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 | The start IP. | 0.6 |
| endIp | String | The end IP. | 0.6 |
| netmask | String | The netmask. | 0.6 |
| prefixLen | String | The prefix length. | 3.1.0 |
| gateway | String | The gateway IP address. | 0.6 |
| networkCidr | String | The network cidr. | 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 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| Normal | IpRangeType | The Normal value. | 3.9.0 |
| AddressPool | IpRangeType | The AddressPool value. | 3.9.0 |
SDK Sample
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();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
DELETE zstack/v1/l3-networks/ip-ranges/{uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 1872261fb9824d9f9dd73a991cf05a44" \
-X DELETE http://localhost:8080/zstack/v1/l3-networks/ip-ranges/6ab14473fbfa340a807c5987cafa8f7f| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The IP range 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 it succeeds, and returns a JSON object containing an error field when it fails. For example:{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Sample
DeleteIpRangeAction action = new DeleteIpRangeAction();
action.uuid = "6d1f44d0fe1440189eb293f18d7bf682";
action.deleteMode = "Permissive";
action.sessionId = "4a3745cb42f5430f874c6f6c4b298e95";
DeleteIpRangeAction.Result res = action.call();DeleteIpRangeAction action = DeleteIpRangeAction()
action.uuid = "0f1fcf2e779543baa416deb89eeeb2db"
action.deleteMode = "Permissive"
action.sessionId = "d07fb42a181d43dda2b6992536b02804"
DeleteIpRangeAction.Result res = action.call()QueryIpRange
API Request
GET zstack/v1/l3-networks/ip-ranges
GET /v1/l3-networks/ip-ranges/{uuid}Authorization: OAuth the-session-uuidcurl -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=887227aa5d5c49e2a8137b79dad3738acurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 60a5dfda1a9843809415eb28f2550f94" \
-X GET http://localhost:8080/zstack/v1/l3-networks/ip-ranges/17684784fcc04571a47eb24dc2eb9638Query Fields
Run the CLI command tool, enter QueryIpRange, and press the Tab key to view all queryable fields and resource names that can be queried across tables.
API 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 |
| 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 |
| 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 | The start IP. | 0.6 |
| endIp | String | The end IP. | 0.6 |
| netmask | String | The netmask. | 0.6 |
| prefixLen | String | The prefix length. | 3.1.0 |
| gateway | String | The gateway IP address. | 0.6 |
| networkCidr | String | The network cidr. | 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 |
SDK Sample
QueryIpRangeAction action = new QueryIpRangeAction();
action.conditions = asList("uuid=d5764d7ab9174e5486e55ba805d28675");
action.sessionId = "5357e54aa55a4846ac96972776d3100f";
QueryIpRangeAction.Result res = action.call();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
Authorization: OAuth the-session-uuid{
"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 -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| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The resource UUID. | 0.6 | |
| name | String | body(included in the updateIpRange structure) | Optional. The IP range name. | 0.6 | |
| description | String | body(included in the updateIpRange structure) | Optional. The detailed description of the IP range. | 0.6 | |
| systemTags | List | body | Optional. The system tags. | 0.6 | |
| userTags | List | body | Optional. The user tags. | 0.6 |
API Response
{
"inventory": {
"l3NetworkUuid": "f7f0ee7b4978413fa36c811e47dd56a3",
"name": "Test-IPRange",
"networkCidr": "192.168.10.0/24"
}
}| 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 |
| 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 | The start IP. | 0.6 |
| endIp | String | The end IP. | 0.6 |
| netmask | String | The netmask. | 0.6 |
| prefixLen | String | The prefix length. | 3.1.0 |
| gateway | String | The gateway IP address. | 0.6 |
| networkCidr | String | The network cidr. | 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 |
SDK Sample
UpdateIpRangeAction action = new UpdateIpRangeAction();
action.uuid = "97054a54a1fc4b49ba3d7a5d44b9e385";
action.sessionId = "8644fd2755f148359edff9521b27868b";
UpdateIpRangeAction.Result res = action.call();UpdateIpRangeAction action = UpdateIpRangeAction()
action.uuid = "2b4499297735445482dc994113574b41"
action.sessionId = "0a16c9ea3e6e4ad9b1ff71a826b67277"
UpdateIpRangeAction.Result res = action.call()AddIpRangeByNetworkCidr
API Request
POST zstack/v1/l3-networks/{l3NetworkUuid}/ip-ranges/by-cidrAuthorization: OAuth the-session-uuid{
"params": {
"name": "Test-IPRange",
"networkCidr": "192.168.10.0/24",
"ipRangeType": "Normal"
},
"systemTags": [],
"userTags": []
}
Note: In the preceding sample, systemTags and userTags are optional. These two fields can be included in the body structure.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| 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. |
|
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 |
Note:
- ZStack ZSphere
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
- Option format:
API Response
{
"inventory": {
"l3NetworkUuid": "4e0926c4fa27455f88c7d94420bf3422",
"name": "Test-IPRange",
"networkCidr": "192.168.10.0/24"
}
}| 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 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID, which uniquely identifies the resource. | 0.6 |
| l3NetworkUuid | String | The Distributed Port Group UUID. | 0.6 |
| name | String | The resource name. | 0.6 |
| description | String | The detailed description of the resource. | 0.6 |
| startIp | String | The start IP. | 0.6 |
| endIp | String | The end IP. | 0.6 |
| netmask | String | The netmask. | 0.6 |
| prefixLen | String | The prefix length. | 3.1.0 |
| gateway | String | The gateway IP address. | 0.6 |
| networkCidr | String | The network cidr. | 0.6 |
| ipVersion | Integer | The IP protocol number. | 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 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| Normal | IpRangeType | The Normal value. | 3.9.0 |
| AddressPool | IpRangeType | The AddressPool value. | 3.9.0 |
SDK Sample
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();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
GET zstack/v1/l3-networks/{l3NetworkUuid}/mtuAuthorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth dc112a530fd2402cae6b4962f65eae4e" \
-X GET http://localhost:8080/zstack/v1/l3-networks/be54f79eb90f4f929da7fe64e1aea8e4/mtu| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| l3NetworkUuid | String | url | The L3 Network UUID. | 2.1 | |
| systemTags (Optional) | List | query | Optional. The system tags. | 2.1 | |
| userTags (Optional) | List | query | Optional. The user tags. | 2.1 |
API Response
{
"mtu": 9216.0
}| 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 |
| 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
GetL3NetworkMtuAction action = new GetL3NetworkMtuAction();
action.l3NetworkUuid = "fd8d572d777d4383b201ddfce629d50e";
action.sessionId = "0cc5202de3ce4881a305e5fa1d431aaa";
GetL3NetworkMtuAction.Result res = action.call();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
Authorization: OAuth the-session-uuid{
"params": {
"mtu": 9216.0
},
"systemTags": [],
"userTags": []
}
Note: In the preceding sample, systemTags and userTags are optional. These two fields can be included in the body structure.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| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| l3NetworkUuid | String | url | The L3 Network UUID. | 2.1 | |
| mtu | Integer | body(contained in the params structure) | The mtu. | 2.1 | |
| systemTags (Optional) | List | body | Optional. The system tags. | 2.1 | |
| userTags (Optional) | List | body | Optional. The user tags. | 2.1 |
API Response
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Sample
SetL3NetworkMtuAction action = new SetL3NetworkMtuAction();
action.l3NetworkUuid = "b19ce058b0f54c6d83c14078c0079c2c";
action.mtu = 9216.0;
action.sessionId = "b441c616886c4183a51ba044e35c7d66";
SetL3NetworkMtuAction.Result res = action.call();SetL3NetworkMtuAction action = SetL3NetworkMtuAction()
action.l3NetworkUuid = "67dc01887dfc4142aabe4221675c1b98"
action.mtu = 9216.0
action.sessionId = "d5188e0801994e3a9dfb3d3ebc2f7a39"
SetL3NetworkMtuAction.Result res = action.call()AddIpv6Range
API Request
POST zstack/v1/l3-networks/{l3NetworkUuid}/ipv6-rangesAuthorization: OAuth the-session-uuid{
"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, systemTags and userTags are optional. These two fields can be included in the body structure.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| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| l3NetworkUuid | String | url | The L3 Network UUID. | 3.1.0 | |
| name | String | body(contained in the params structure) | The name of the L3 Network. | 3.1.0 | |
| description (Optional) | 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 IPv6 address allocation mode. |
|
3.1.0 |
| resourceUuid (Optional) | String | body(contained in the params structure) | The resource UUID. If specified, the L3 Network will use this field value as its UUID. | 3.1.0 | |
| systemTags (Optional) | List | body | The system tags. | 3.1.0 | |
| userTags (Optional) | List | body | The user tags. | 3.1.0 |
Note:
- ZStack ZSphere
supports specifying a DHCP server address when adding an IPv6 address range. Add the affinityGroup option to SystemTags.
- Option format:
flatNetwork::DhcpServer::{%s}::ipUuid::{%s} - Example:
flatNetwork::DhcpServer::192.168.1.100::ipUuid::null
- Option format:
API 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 |
|---|---|---|---|
| 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 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID, which uniquely identifies the resource. | 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 | The start IP. | 3.1.0 |
| endIp | String | The end IP. | 3.1.0 |
| netmask | String | The netmask. | 3.1.0 |
| prefixLen | String | The prefix length. | 3.1.0 |
| gateway | String | The gateway IP address. | 3.1.0 |
| networkCidr | String | The network cidr. | 3.1.0 |
| ipVersion | Integer | The IP protocol number. | 3.1.0 |
| addressMode | String | The IPv6 address allocation mode. | 3.1.0 |
| createDate | Timestamp | The creation date. | 3.1.0 |
| lastOpDate | Timestamp | The last operation date. | 3.1.0 |
SDK Sample
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();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
POST zstack/v1/l3-networks/{l3NetworkUuid}/ipv6-ranges/by-cidrAuthorization: OAuth the-session-uuid{
"params": {
"name": "Test-IPRange",
"networkCidr": "2002:2001::/64",
"addressMode": "SLAAC"
},
"systemTags": [],
"userTags": []
}
Note: In the preceding sample, systemTags and userTags are optional. These two fields can be included in the body structure.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| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| name | String | body(contained in the params structure) | The name of the L3 Network. | 3.1.0 | |
| description (Optional) | String | body(contained in the params structure) | 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 IPv6 address allocation mode. |
|
3.1.0 |
| resourceUuid (Optional) | String | body(contained in the params structure) | The resource UUID. If specified, the L3 Network will use this field value as its UUID. | 3.1.0 | |
| systemTags (Optional) | List | body | The system tags. | 3.1.0 | |
| userTags (Optional) | List | body | The user tags. | 3.1.0 |
Note:
- ZStack ZSphere
supports specifying a DHCP server address when adding an IPv6 address range by network CIDR. Add the affinityGroup option to SystemTags.
- Option format:
flatNetwork::DhcpServer::{%s}::ipUuid::{%s} - Example:
flatNetwork::DhcpServer::192.168.1.100::ipUuid::null
- Option format:
API Response
{
"inventory": {
"l3NetworkUuid": "6735b2c2bc0c345892b7d66b1616d909",
"name": "Test-IPRange",
"networkCidr": "2002:2001::/64"
}
}| 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 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID, which uniquely identifies the resource. | 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 | The start IP. | 3.1.0 |
| endIp | String | The end IP. | 3.1.0 |
| netmask | String | The netmask. | 3.1.0 |
| prefixLen | String | The prefix length. | 3.1.0 |
| gateway | String | The gateway IP address. | 3.1.0 |
| networkCidr | String | The network cidr. | 3.1.0 |
| ipVersion | Integer | The IP protocol number. | 3.1.0 |
| addressMode | String | The IPv6 address allocation mode. | 3.1.0 |
| createDate | Timestamp | The creation date. | 3.1.0 |
| lastOpDate | Timestamp | The last operation date. | 3.1.0 |
SDK Sample
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();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
GET zstack/v1/l3-networks/ip-address
GET zstack/v1/l3-networks/ip-address{uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/l3-networks/ip-addresscurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/l3-networks/ip-address/87b2ab50f6c13ebb9dd73ca46bb22bc7Query Fields
Run the CLI command tool, enter QueryIpAddress, and press the Tab key to view all queryable fields and resource names that can be queried across tables.
API 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 errot | 3.1.0 |
| inventories | List | For more information, see inventories | 3.1.0 |
| 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 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID, which uniquely identifies the resource. | 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 protocol number. | 3.1.0 |
| ip | String | The IP address. | 3.1.0 |
| netmask | String | The network mask. | 3.1.0 |
| gateway | String | The gateway address. | 3.1.0 |
| usedFor | String | The intended use. | 3.1.0 |
| ipInLong | long | The IP address represented as a long integer. | 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
QueryIpAddressAction action = new QueryIpAddressAction();
action.conditions = asList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryIpAddressAction.Result res = action.call();QueryIpAddressAction action = QueryIpAddressAction()
action.conditions = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryIpAddressAction.Result res = action.call()GetL3NetworkIpStatistic
API Request
GET zstack/v1/l3-networks/{l3NetworkUuid}/ip-statisticAuthorization: OAuth the-session-uuidcurl -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&limit=20&replyWithCount=false| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| l3NetworkUuid | String | url | The L3 Network UUID. | 3.7.0 | |
| resourceType (Optional) | String | query | The resource type for statistics. |
|
3.7.0 |
| ip (Optional) | String | query | The specified IP address. | 3.7.0 | |
| sortBy (Optional) | String | query | The sort method. |
|
3.7.0 |
| sortDirection (Optional) | String | query | The sort direction. |
|
3.7.0 |
| start (Optional) | Integer | query | The start offset of the statistics result. | 3.7.0 | |
| limit (Optional) | Integer | query | The number of statistics results. | 3.7.0 | |
| replyWithCount (Optional) | boolean | query | Whether to return the total count of statistics results. | 3.7.0 | |
| systemTags (Optional) | List | query | The system tags. | 3.7.0 | |
| userTags (Optional) | List | query | The user tags. | 3.7.0 |
API Response
{
"ipStatistics": [
{
"ip": "192.168.0.1",
"resourceTypes": [
"Other"
]
}
],
"total": 1
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| total | Long | The total number of IP statistics results. | 3.7.0 |
| success | boolean | Success. | 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 | For more information, see ipStatistics | 3.7.0 |
| 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 |
| 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 virtual machine UUID. | 3.7.0 |
| vmInstanceName | String | The virtual machine name. | 3.7.0 |
| vmInstanceType | String | The virtual machine type. | 3.7.0 |
| applianceVmOwnerUuid | String | The network service UUID of the appliance virtual machine. | 4.1.0 |
| vmDefaultIp | String | The default IP of the virtual machine. | 3.7.0 |
| resourceTypes | List | The list of resource types bound to the IP address. | 3.7.0 |
| state | String | The resource state. | 3.7.0 |
| useFor | String | The network service bound to the VIP. | 3.7.0 |
| createDate | Timestamp | The creation date. | 3.7.0 |
| ownerName | String | The resource owner name. | 3.7.0 |
| resourceOwnerUuid | String | The resource owner UUID. | 4.1.0 |
| usedIpUuid | String | The IP UUID. | 4.1.0 |
SDK Sample
GetL3NetworkIpStatisticAction action = new GetL3NetworkIpStatisticAction();
action.l3NetworkUuid = "9bdd769f3e603f65bd368512ebe8b998";
action.resourceType = "All";
action.sortBy = "Ip";
action.sortDirection = "asc";
action.start = 0;
action.limit = 20;
action.replyWithCount = false;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetL3NetworkIpStatisticAction.Result res = action.call();
GetL3NetworkIpStatisticAction action = GetL3NetworkIpStatisticAction()
action.l3NetworkUuid = "9bdd769f3e603f65bd368512ebe8b998"
action.resourceType = "All"
action.sortBy = "Ip"
action.sortDirection = "asc"
action.start = 0
action.limit = 20
action.replyWithCount = false
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetL3NetworkIpStatisticAction.Result res = action.call()
QueryAddressPool
API Request
GET zstack/v1/l3-networks/address-poolsGET zstack/v1/l3-networks/address-pools/{uuid}Authorization: OAuth the-session-uuidcurl -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=a73cf6bc10a0390bb5e461d9f5e3fd6dcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/l3-networks/address-pools/f45cb0f9098336a39662b7553f42deb5Query Fields
Run the CLI command tool, enter QueryAddressPool, and press the Tab key to view all queryable fields and resource names that can be queried across tables.
API 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 | For more information, see inventories | 3.9.0 |
| 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 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID, which uniquely identifies the resource. | 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. | 3.9.0 |
| endIp | String | The end IP. | 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 protocol number. | 3.9.0 |
| addressMode | String | The IPv6 address allocation mode. | 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 | For more information, see ipRangeType | 3.9.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| Normal | IpRangeType | Normal address range. | 3.9.0 |
| AddressPool | IpRangeType | Address pool range. | 3.9.0 |
SDK Sample
QueryAddressPoolAction action = new QueryAddressPoolAction();
action.conditions = asList("uuid=4cbab87c862032f1a161bebe7e1f55a1");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryAddressPoolAction.Result res = action.call();QueryAddressPoolAction action = QueryAddressPoolAction()
action.conditions = ["uuid=455d45fad9893eba9565de38588c7416"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryAddressPoolAction.Result res = action.call()ChangeL3NetworkDhcpIpAddress
API Request
PUT zstack/v1/l3-networks/{l3NetworkUuid}/dhcp-ipAuthorization: OAuth the-session-uuid{
"changeL3NetworkDhcpIpAddress": {
"dhcpServerIp": "192.168.1.100",
"dhcpv6ServerIp": "2024:04:28:01::100"
},
"systemTags": [],
"userTags": []
}
Note: In the preceding sample, systemTags and userTags are optional. These two fields can be included in the body structure.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| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| l3NetworkUuid | String | url | The L3 Network UUID. | 4.10.16 | |
| dhcpServerIp (Optional) | String | body(contained in the changeL3NetworkDhcpIpAddress structure) |
The DHCP v4 server address. | 4.10.16 | |
| dhcpv6ServerIp (Optional) | String | body(contained in the changeL3NetworkDhcpIpAddress structure) |
The DHCP v6 server address. | 4.10.16 | |
| systemTags (Optional) | List | body | The system tags. | 4.10.16 | |
| userTags (Optional) | List | body | The user tags. | 4.10.16 |
API Response
{
"dhcpServerIp": "192.168.100.3",
"dhcpv6ServerIp": "2024:04:28:01::100"
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| dhcpServerIp | String | The dhcp server IP. | 4.10.16 |
| dhcpv6ServerIp | String | The dhcpv 6 server IP. | 4.10.16 |
| success | boolean | Whether the operation succeeded. | 4.10.16 |
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error | 4.10.16 |
| 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 |
SDK Sample
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();action = ChangeL3NetworkDhcpIpAddressAction()
action.l3NetworkUuid = "6b693b00316b30819bb30bfe0df10256"
action.dhcpServerIp = "192.168.1.100"
action.dhcpv6ServerIp = "2024:04:28:01::100"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()AddReservedIpRange
API Request
POST zstack/v1/l3-networks/{l3NetworkUuid}/reserved-ip-rangesAuthorization: OAuth the-session-uuid{
"params": {
"startIp": "192.168.100.10",
"endIp": "192.168.100.250"
},
"systemTags": [],
"userTags": []
}
Note: In the preceding sample, systemTags and userTags are optional. These two fields can be included in the body structure.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| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| l3NetworkUuid | String | url | The L3 Network UUID. | 4.10.16 | |
| startIp | String | body(contained in the params structure) |
The start IP (included in the IP range). | 4.10.16 | |
| endIp | String | body(contained in the params structure) |
The end IP (included in the IP range). | 4.10.16 | |
| resourceUuid (Optional) | String | body(contained in the params structure) |
The resource UUID. | 4.10.16 | |
| tagUuids (Optional) | List | body(contained in the params structure) |
The list of tag UUIDs. | 4.10.16 | |
| systemTags (Optional) | List | body | The system tags. | 4.10.16 | |
| userTags (Optional) | List | body | The user tags. | 4.10.16 |
API Response
{
"inventory": {
"l3NetworkUuid": "9bb0926251903385928489eba7388cd4",
"name": "Test-IP-Range",
"startIp": "192.168.100.10",
"endIp": "192.168.100.250",
"ipVersion": 4
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | Whether the operation succeeded. | 4.10.16 |
| inventory | ReservedIpRangeInventory | For more information, see inventory | 4.10.16 |
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error | 4.10.16 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID, which uniquely identifies the resource. | 4.10.16 |
| l3NetworkUuid | String | The L3 Network UUID. | 4.10.16 |
| name | String | The resource name. | 4.10.16 |
| description | String | The detailed description of the resource. | 4.10.16 |
| startIp | String | The start IP (included in the reserved IP range). | 4.10.16 |
| endIp | String | The end IP (included in the reserved IP range). | 4.10.16 |
| ipVersion | Integer | The IP protocol number. | 4.10.16 |
| createDate | Timestamp | The creation date. | 4.10.16 |
| lastOpDate | Timestamp | The last operation date. | 4.10.16 |
| 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 |
SDK Sample
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();action = AddReservedIpRangeAction()
action.l3NetworkUuid = "dc9fb647bbd73a768da652b6cd100495"
action.startIp = "192.168.100.10"
action.endIp = "192.168.100.250"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()DeleteIpAddress
API Request
DELETE zstack/v1/l3-networks/{l3NetworkUuid}/ip-addressAuthorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/l3-networks/b6e5c225bf553bc8bd5a5fcf3fac9fa3/ip-address?usedIpUuids=ff010728f1f63b86be83482e1c436700&deleteMode=Permissive| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| l3NetworkUuid | String | url | The L3 Network UUID. | 4.10.16 | |
| usedIpUuids | List | query | The UUID of the IP address to be deleted. | 4.10.16 | |
| deleteMode (Optional) | String | query | The delete mode (Permissive / Enforcing, Permissive). | 4.10.16 | |
| systemTags (Optional) | List | query | The system tags. | 4.10.16 | |
| userTags (Optional) | List | query | The user tags. | 4.10.16 |
API Response
{}. On failure, the API returns a JSON structure with 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
DeleteIpAddressAction action = new DeleteIpAddressAction();
action.l3NetworkUuid = "b6e5c225bf553bc8bd5a5fcf3fac9fa3";
action.usedIpUuids = asList("ff010728f1f63b86be83482e1c436700");
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteIpAddressAction.Result res = action.call();action = DeleteIpAddressAction()
action.l3NetworkUuid = "b6e5c225bf553bc8bd5a5fcf3fac9fa3"
action.usedIpUuids = [ff010728f1f63b86be83482e1c436700]
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()DeleteReservedIpRange
API Request
DELETE zstack/v1/l3-networks/reserved-ip-ranges/{uuid}Authorization: OAuth the-session-uuidcurl -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?deleteMode=Permissive| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| l3NetworkUuid | String | url | The L3 Network UUID. | 4.10.16 | |
| deleteMode (Optional) | String | query | The delete mode (Permissive / Enforcing, Permissive). | 4.10.16 | |
| systemTags (Optional) | List | query | The system tags. | 4.10.16 | |
| userTags (Optional) | List | query | The user tags. | 4.10.16 |
API Response
{}. On failure, the API returns a JSON structure with 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
DeleteReservedIpRangeAction action = new DeleteReservedIpRangeAction();
action.uuid = "c01027fecc013c338e25d67581eed865";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteReservedIpRangeAction.Result res = action.call();action = DeleteReservedIpRangeAction()
action.uuid = "c01027fecc013c338e25d67581eed865"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()