Document navigation

L2 Network Operations

CreateL2TfNetwork

API Request

URLs

POST zstack/v1/l2-networks/tf

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "name": "Tf-L2-Network",
    "description": "Test",
    "zoneUuid": "10f059adb4c83f5ba9a296369d52ffbe",
    "vSwitchType": "LinuxBridge"
  },
  "systemTags": [],
  "userTags": []
}

In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"Tf-L2-Network","description":"Test","zoneUuid":"10f059adb4c83f5ba9a296369d52ffbe","vSwitchType":"LinuxBridge"}}' \
http://localhost:8080/zstack/v1/l2-networks/tf

Request Parameters

Name Type Location Description Optional Value Starting Version
ipPrefix String body (contained in the params structure) Optional. The IP address prefix. 4.8.0
ipPrefixLength Integer body (contained in the params structure) Optional. The IP address prefix length. 4.8.0
name String body (contained in the params structure) The resource name. 4.8.0
description String body (contained in the params structure) Optional. The detailed description of the resource. 4.8.0
zoneUuid String body (contained in the params structure) The zone UUID. 4.8.0
physicalInterface String body (contained in the params structure) The physical interface. 4.8.0
type String body (contained in the params structure) Optional. The L2 network type. 4.8.0
vSwitchType String body (contained in the params structure) Optional. The type of the vSwith.
  • LinuxBridge
  • OvsDpdk
  • MacVlan
4.8.0
resourceUuid String body (contained in the params structure) Optional. The resource UUID. 4.8.0
tagUuids List body (contained in the params structure) Optional. The Uuid tags list. 4.8.0
systemTags List body Optional. The system tags. 4.8.0
userTags List body Optional. The user tags. 4.8.0

API Response

Sample Response

{
  "inventory": {
    "uuid": "672906b1aeca3a68a24c1b07a4f8deb5",
    "name": "test",
    "zoneUuid": "b478828872db33a4807d90e9f16f39e4",
    "physicalInterface": "eth0"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, seeerror. 4.8.0
inventory L2NetworkInventory Seeinventory 4.8.0
success boolean Whether the operation succeeded. 4.8.0

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 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

#inventroy

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 zone UUID. 4.8.0
physicalInterface String The physical interface. 4.8.0
type String The resource 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 UUID. 4.8.0

SDK Sample

Java SDK

CreateL2TfNetworkAction action = new CreateL2TfNetworkAction();
action.name = "Tf-L2-Network";
action.description = "Test";
action.zoneUuid = "10f059adb4c83f5ba9a296369d52ffbe";
action.vSwitchType = "LinuxBridge";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateL2TfNetworkAction.Result res = action.call();

Python SDK

action = CreateL2TfNetworkAction()
action.name = "Tf-L2-Network"
action.description = "Test"
action.zoneUuid = "10f059adb4c83f5ba9a296369d52ffbe"
action.vSwitchType = "LinuxBridge"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

CreateL2HardwareVxlanNetwork

API Request

URLs

POST zstack/v1/l2-networks/hardware-vxlan

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "vni": 10,
    "poolUuid": "772ca51845273486bd60aeb13c545050",
    "name": "Test-Net",
    "description": "Test",
    "zoneUuid": "79c1192d59303c218de085a48666cffa",
    "vSwitchType": "LinuxBridge",
    "isolated": false
  },
  "systemTags": [],
  "userTags": []
}

In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"vni":10,"poolUuid":"772ca51845273486bd60aeb13c545050","name":"Test-Net","description":"Test","zoneUuid":"79c1192d59303c218de085a48666cffa","vSwitchType":"LinuxBridge","isolated":false}}' \
http://localhost:8080/zstack/v1/l2-networks/hardware-vxlan

Request Parameters

Name Type Location Description Optional Value Starting Version
vni Integer body (contained in the params structure) Optional. The VNI number. 3.7
poolUuid String body (contained in the params structure) The resource pool UUID. 3.7
name String body (contained in the params structure) The resource name. 3.7
description String body (contained in the params structure) Optional. The detailed description of the resource. 3.7
zoneUuid String body (contained in the params structure) The zone UUID.. 3.7
physicalInterface String body (contained in the params structure) The physical interface. 3.7
type String body (contained in the params structure) Optional. The resource type. 3.7
resourceUuid String body (contained in the params structure) Optional. The resource UUID. 3.7
tagUuids List body (contained in the params structure) Optional. The tag UUID list. 3.7
systemTags List body Optional. The system tags. 3.7
userTags List body Optional. The user tags. 3.7
vSwitchType String body (contained in the params structure) Optional. The type of the vSwitch.
  • LinuxBridge
  • OvsDpdk
  • MacVlan
0.6
isolated Boolean body (contained in the params structure) Optional. 5.0.0
pvlan String body (contained in the params structure) Optional. 5.0.0
h3cTenantUuid String body (contained in the params structure) Optional. 5.4.0
vlan Integer body (contained in the params structure) Optional. 5.4.0
  • When you create a L2 network in ZStack Cloud, you can record the Huawei iMaster VPC UUID associated with the hardware VXLAN network by adding the huaweiVpcUuid option to SystemTags.

    • Format: huaweiVpcUuid::{%s}
    • Example: huaweiVpcUuid:: bf4eb98c0bb74441a652715f1c9a065d
  • When you create a L2 network in ZStack Cloud, you can record the Huawei iMaster tenant UUID associated with the hardware VXLAN network by adding the huaweiTenantUuid option to SystemTags.

    • Format: huaweiTenantUuid::{%s}
    • Example: huaweiTenantUuid:: e9218d9e4a2e4a029d33ce6a683d44e8

API Response

Sample Response

{
  "inventory": {
    "vni": 10,
    "poolUuid": "7b3b9aaa42d3364d846a598cce125174",
    "name": "Test-Net",
    "description": "Test",
    "zoneUuid": "e88a75173e193288b9a51c35f7c8e1ac",
    "type": "L2VxlanNetwork"
  }
}
Name Type Description Starting Version
success boolean Whether the operation succeeded. 0.6
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.7
inventory L2VxlanNetworkInventory Seeinventroy. 3.7

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 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

#inventory

Name Type Description Starting Version
vni Integer The VNI number. 4.8.0
poolUuid String VXLAN network pool uuid 4.8.0
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 zone UUID 4.8.0
physicalInterface String The physical interface. 4.8.0
type String The resource 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 UUID. 4.8.0

SDK Sample

Java SDK

CreateL2HardwareVxlanNetworkAction action = new CreateL2HardwareVxlanNetworkAction();
action.vni = 10;
action.poolUuid = "772ca51845273486bd60aeb13c545050";
action.name = "Test-Net";
action.description = "Test";
action.zoneUuid = "79c1192d59303c218de085a48666cffa";
action.vSwitchType = "LinuxBridge";
action.isolated = false;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateL2HardwareVxlanNetworkAction.Result res = action.call();

Python SDK

action = CreateL2HardwareVxlanNetworkAction()
action.vni = 10
action.poolUuid = "772ca51845273486bd60aeb13c545050"
action.name = "Test-Net"
action.description = "Test"
action.zoneUuid = "79c1192d59303c218de085a48666cffa"
action.vSwitchType = "LinuxBridge"
action.isolated = false
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

CreateL2HardwareVxlanNetworkPool

API Request

URLs

POST zstack/v1/l2-networks/hardware-vxlan-pool

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "sdnControllerUuid": "0b2231798a5c3971811ca4c9647776b8",
    "name": "Test-NetPool",
    "description": "Test",
    "zoneUuid": "0198cfa1482e31c2bc99512d1aa5b29b",
    "physicalInterface": "bond0",
    "vSwitchType": "LinuxBridge",
    "isolated": false
  },
  "systemTags": [],
  "userTags": []
}

In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"sdnControllerUuid":"0b2231798a5c3971811ca4c9647776b8", \
"name":"Test-NetPool","description":"Test","zoneUuid":"0198cfa1482e31c2bc99512d1aa5b29b","physicalInterface":"bond0","vSwitchType":"LinuxBridge","isolated":false}}' \
http://localhost:8080/zstack/v1/l2-networks/hardware-vxlan-pool

Request Parameters

Name Type Location Description Optional Value Starting Version
sdnControllerUuid String body (contained in the params structure) The SDN controller UUID. 3.7
name String body (contained in the params structure) The resource name. 3.7
description String body (contained in the params structure) Optional. The detailed description of the resource. 3.7
zoneUuid String body (contained in the params structure) The zone UUID. 3.7
physicalInterface String body (contained in the params structure) The physical interface. 3.7
type String body (contained in the params structure) Optional. The resource type. 3.7
resourceUuid String body (contained in the params structure) Optional. The resource UUID. 3.7
tagUuids List body (contained in the params structure) Optional. The user tags list. 3.7
systemTags List body Optional. The system tags. 3.7
userTags List body Optional. The user tags. 3.7
vSwitchType String body (contained in the params structure) Optional. The type of the vSwitch.
  • LinuxBridge
  • OvsDpdk
  • MacVlan
4.1.2
isolated Boolean body (contained in the params structure) Optional. 4.8.0
pvlan String body (contained in the params structure) Optional. 4.8.0
startVlan Integer body (contained in the params structure) Optional. 5.4.0
endVlan Integer body (contained in the params structure) Optional. 5.4.0

API Response

Sample Response

{
  "inventory": {
    "sdnControllerUuid": "359216656f7f3f8681b76e52a0f11429",
    "name": "Test-NetPool",
    "description": "Test",
    "zoneUuid": "7d07d7a4ebfa340da32ac686f77edd4e",
    "type": "HardwareVxlanNetworkPool"
  }
}
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 HardwareL2VxlanNetworkPoolInventory See inventory. 4.8.0

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 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

#inventory

Name Type Description Starting Version
sdnControllerUuid String The sdn controller UUID. 5.3.0
attachedCidrs Map The attached cidrs. 5.3.0
uuid String The resource UUID. 5.3.0
name String The resource name. 5.3.0
description String The detailed description of the resource. 5.3.0
zoneUuid String The zone UUID. 5.3.0
physicalInterface String The physical interface. 5.3.0
type String The resource type. 5.3.0
vSwitchType String The v switch type. 5.3.0
virtualNetworkId Integer The virtual network ID. 5.3.0
isolated Boolean The isolated. 5.3.0
pvlan String The pvlan. 5.3.0
createDate Timestamp The creation date. 5.3.0
lastOpDate Timestamp The last operation date. 5.3.0
attachedClusterUuids List The attached cluster UUIDs. 5.3.0
attachedVtepRefs List See attachedVtepRefs. 5.3.0
remoteVteps List See remoteVteps. 5.3.0
attachedVxlanNetworkRefs List See attachedVxlanNetworkRefs. 5.3.0
attachedVniRanges List See attachedVniRanges. 5.3.0

#attachedVtepRefs

Name Type Description Starting Version
uuid String The resource UUID. 4.8.0
hostUuid String The host UUID 4.8.0
vtepIp String The VTEP IP address. 4.8.0
port Integer The port number. 4.8.0
type String The resource type. 4.8.0
createDate Timestamp The creation date. 4.8.0
lastOpDate Timestamp The last operation date. 4.8.0
poolUuid String The resource pool UUID. 4.8.0

#remoteVteps

Name Type Description Starting Version
uuid String The resource UUID. 4.7.11
clusterUuid String The cluster UUID. 5.3.0
vtepIp String The physical server VTEP IP address. 4.7.11
port Integer The port. 4.7.11
type String The type. 4.7.11
createDate Timestamp The creation date. 4.7.11
lastOpDate Timestamp The last operation date. 4.7.11
poolUuid String The VXLAN recource pool UUID. 4.7.11

#attachedVxlanNetworkRefs

Name Type Description Starting Version
vni Integer The VNI number. 4.8.0
poolUuid String The resource pool UUID. 4.8.0
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 zone UUID. 4.8.0
physicalInterface String The physical interface. 4.8.0
type String The resource 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 UUID. 4.8.0

#attachedVniRanges

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
startVni Integer The start VNI. 4.8.0
endVni Integer The end VNI. 4.8.0
createDate Timestamp The creation date. 4.8.0
lastOpDate Timestamp The last operation date. 4.8.0
l2NetworkUuid String The L2 network UUID 4.8.0

SDK Sample

Java SDK

CreateL2HardwareVxlanNetworkPoolAction action = new CreateL2HardwareVxlanNetworkPoolAction();
action.sdnControllerUuid = "0b2231798a5c3971811ca4c9647776b8";
action.name = "Test-NetPool";
action.description = "Test";
action.zoneUuid = "0198cfa1482e31c2bc99512d1aa5b29b";
action.physicalInterface = "bond0";
action.vSwitchType = "LinuxBridge";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateL2HardwareVxlanNetworkPoolAction.Result res = action.call();

Python SDK

action = CreateL2HardwareVxlanNetworkPoolAction()
action.sdnControllerUuid = "0b2231798a5c3971811ca4c9647776b8"
action.name = "Test-NetPool"
action.description = "Test"
action.zoneUuid = "0198cfa1482e31c2bc99512d1aa5b29b"
action.physicalInterface = "bond0"
action.vSwitchType = "LinuxBridge"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

CreateL2VxlanNetwork

API Request

URLs

POST zstack/v1/l2-networks/vxlan

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "vni": 10,
    "poolUuid": "c27a329718ed3585a27d227174ed1ace",
    "name": "Test-Net",
    "description": "Test",
    "zoneUuid": "8dd66847fcf930178acc687cb4c1438c",
    "vSwitchType": "LinuxBridge"
  },
  "systemTags": [],
  "userTags": []
}

In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"vni":10,"poolUuid":"c27a329718ed3585a27d227174ed1ace","name":"Test-Net","description":"Test","zoneUuid":"8dd66847fcf930178acc687cb4c1438c","vSwitchType":"LinuxBridge"}}' \
http://localhost:8080/zstack/v1/l2-networks/vxlan

Request Parameters

Name Type Location Description Optional Value Starting Version
vni Integer body (contained in the params structure) Optional. The VNI. 0.6
poolUuid String body (contained in the params structure) The VXLAN pool UUID. 0.6
name String body (contained in the params structure) The resource name. 0.6
description String body (contained in the params structure) Optional. The detailed description of the resource. 0.6
zoneUuid String body (contained in the params structure) The zone UUID. 0.6
physicalInterface String body (contained in the params structure) The physical interface. 0.6
type String body (contained in the params structure) Optional. The type. 0.6
resourceUuid String body (contained in the params structure) Optional. The resource UUID. 0.6
systemTags List body Optional. The system tags. 0.6
userTags List body Optional. The user tags. 0.6
vSwitchType String body (contained in the params structure) Optional. The type of the vSwitch.
  • LinuxBridge
  • OvsDpdk
4.8.0
tagUuid List body (contained in the params structure) Optional. The Uuid tags list. 4.8.0

API Response

Sample Response

{
  "inventory": {
    "vni": 10,
    "poolUuid": "848a93cca6b43a67930af04c70f2abd3",
    "name": "Test-Net",
    "description": "Test",
    "zoneUuid": "1b6c6d39024a3e59ba597cd651fe064f",
    "type": "L2VxlanNetwork"
  }
}
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. 0.6
inventory L2VxlanNetworkPoolInventory See inventory. 0.6

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6

#inventory

Name Type Description Starting Version
vni Integer The VNI. 0.6
poolUuid String The VXLAN pool UUID. 0.6
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 zone UUID. 0.6
physicalInterface String The physical interface. 0.6
type String The resource type. 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
attachedClusterUuids List The attached cluster UUIDs. 0.6

SDK Sample

Java SDK

CreateL2VxlanNetworkAction action = new CreateL2VxlanNetworkAction();
action.vni = 10;
action.poolUuid = "c27a329718ed3585a27d227174ed1ace";
action.name = "Test-Net";
action.description = "Test";
action.zoneUuid = "8dd66847fcf930178acc687cb4c1438c";
action.vSwitchType = "LinuxBridge";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateL2VxlanNetworkAction.Result res = action.call();

Python SDK

action = CreateL2VxlanNetworkAction()
action.vni = 10
action.poolUuid = "c27a329718ed3585a27d227174ed1ace"
action.name = "Test-Net"
action.description = "Test"
action.zoneUuid = "8dd66847fcf930178acc687cb4c1438c"
action.vSwitchType = "LinuxBridge"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

QueryL2VxlanNetwork

API Request

URLs

GET zstack/v1/l2-networks/vxlan
GET zstack/v1/l2-networks/vxlan/{uuid}

Headers

Authorization: OAuth the-session-uuid

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth eff53f15d4ad4f17b3dc13bc15d7f0f6" \
-X GET http://localhost:8080/zstack/v1/l2-networks/vxlan
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 801edfc2a7f244198ed2f13743c1b232" \
-X GET http://localhost:8080/zstack/v1/l2-networks/vxlan/8dcdd0a8c57a45a5a884887f5a0681c7

Queryable Fields

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

API Response

Sample Response

{
"inventories": [
    {
"name": "Test-Net",
"description": "Test",
"zoneUuid": "ef52a71330384e3080c88b243bf3fae2",
"type": "L2VxlanNetwork"
"vSwitchType": "LinuxBridge"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 0.6
inventories List See inventories. 0.6

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6

#inventories

Name Type Description Starting Version
vni Integer The VNI. 0.6
poolUuid String The pool UUID. 0.6
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 zone UUID. 0.6
physicalInterface String The physical interface. 0.6
type String The resource type. 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
attachedClusterUuids List The attached cluster UUIDs. 0.6
vSwitchType String The vSwitch type. 4.8.0

SDK Sample

Java SDK

QueryL2VxlanNetworkAction action = new QueryL2VxlanNetworkAction();
action.conditions = asList();
action.sessionId = "4a008984bc2844e59b6fa8acf188d587";
QueryL2VxlanNetworkAction.Result res = action.call();

Python SDK

action = QueryL2VxlanNetworkAction()
action.conditions = []
action.sessionId = "c530e08c8ad24dbeb986647100eff212"
res = action.call()

CreateL2VxlanNetworkPool

API Request

URLs

POST zstack/v1/l2-networks/vxlan-pool

Headers

Authorization: OAuth the-session-uuid

Body

{
"params": {
"name": "Test-NetPool",
"description": "Test",
"zoneUuid": "ec6cc473d1c345528b92da754cd8fa00"
  },
"systemTags": [],
"userTags": []

In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"Test-NetPool","description":"Test","zoneUuid":"2de2048daac33068aecac1f5b40d1343"}}' \
http://localhost:8080/zstack/v1/l2-networks/vxlan-pool

Request Parameters

Name Type Location Description Optional Value Starting Version
name String body (contained in the params structure) The resource name. 0.6
description String body (contained in the params structure) Optional. The detailed description of the resource. 0.6
zoneUuid String body (contained in the params structure) The zone UUID. 0.6
physicalInterface String body (contained in the params structure) The physical interface. 0.6
type String body (contained in the params structure) Optional. The type. 0.6
resourceUuid String body (contained in the params structure) Optional. The resource UUID. 0.6
systemTags List body Optional. The system tags. 0.6
userTags List body Optional. The user tags. 0.6
vSwitchType String body (contained in the params structure) Optional. The type of the vSwitch.
  • LinuxBridge
  • OvsDpdk
4.8.0
tagUuid List body (contained in the params structure) Optional. The Uuid tags list. 4.8.0

API Response

Sample Response

{
"inventory": {
"name": "Test-NetPool",
"description": "Test",
"zoneUuid": "3f35bd50dab14ababe3d85736b63aba7",
"type": "L2VxlanNetwork"
  }
}
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. 0.6
inventory L2VxlanNetworkPoolInventory See inventory. 0.6

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6

#inventory

Name Type Description Starting Version
attachedCidrs Map The attached cidrs. 0.6
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 zone UUID. 0.6
physicalInterface String The physical interface. 0.6
type String The resource type. 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
attachedClusterUuids List The attached cluster UUIDs. 0.6
attachedVtepRefs List See attachedVtepRefs. 0.6
attachedVxlanNetworkRefs List See attachedVxlanNetworkRefs. 0.6
attachedVniRanges List See attachedVniRanges. 0.6

#attachedVtepRefs

Name Type Description Starting Version
uuid String The resource UUID. 0.6
hostUuid String The host UUID. 0.6
vtepIp String The VTEP IP. 0.6
port Integer The port. 0.6
type String The resource type. 0.6
createDate Timestamp The creation date. 0.6
LastOpDate Timestamp The last operation date. 0.6
poolUuid String The pool UUID. 0.6

#attachedVxlanNetworkRefs

Name Type Description Starting Version
vni Integer The VNI. 0.6
poolUuid String The pool UUID. 0.6
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 zone UUID. 0.6
physicalInterface String The physical interface. 0.6
type String The resource type. 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
attachedClusterUuids List The attached cluster UUIDs. 0.6

#attachedVniRanges

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
startVni Integer The start VNI. 0.6
endVni Integer The end VNI. 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
l2NetworkUuid String The L2 network UUID. 0.6

SDK Sample

Java SDK

CreateL2VxlanNetworkPoolAction action = new CreateL2VxlanNetworkPoolAction();
action.name = "Test-NetPool";
action.description = "Test";
action.zoneUuid = "2de2048daac33068aecac1f5b40d1343";
action.vSwitchType = "LinuxBridge";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateL2VxlanNetworkPoolAction.Result res = action.call();

Python SDK

action = CreateL2VxlanNetworkPoolAction()
action.name = "Test-NetPool"
action.description = "Test"
action.zoneUuid = "2de2048daac33068aecac1f5b40d1343"
action.vSwitchType = "LinuxBridge"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

QueryL2VxlanNetworkPool

API Request

URLs

GET zstack/v1/l2-networks/vxlan-pool
GET zstack/v1/l2-networks/vxlan-pool/{uuid}

Headers

Authorization: OAuth the-session-uuid

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b2132aefec76492cb00aff0a2d97a202" \
-X GET http://localhost:8080/zstack/v1/l2-networks/vxlan-pool
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 07c093f70f10467e826adc1743a022e6" \
-X GET http://localhost:8080/zstack/v1/l2-networks/vxlan-pool/0576843440c74069b541faa856f71d39

Queryable Fields

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

API Response

Sample Response

{
"inventories": [
    {
"name": "Test-Net",
"description": "Test",
"zoneUuid": "6199e247f6bf4157a41e51ed7ff2f78c",
"type": "L2VxlanNetworkPool"
"vSwitchType":"LinuxBridge"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 0.6
inventories List See inventories. 0.6

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6

#inventories

Name Type Description Starting Version
attachedCidrs Map The attached cidrs. 0.6
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 zone UUID. 0.6
physicalInterface String The physical interface. 0.6
type String The resource type. 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
attachedClusterUuids List The attached cluster UUIDs. 0.6
attachedVtepRefs List See attachedVtepRefs. 0.6
attachedVxlanNetworkRefs List See attachedVxlanNetworkRefs. 0.6
attachedVniRanges List See attachedVniRanges. 0.6
vSwitchType String The vSwitch type. 4.8.0

#attachedVtepRefs

Name Type Description Starting Version
uuid String The resource UUID. 0.6
hostUuid String The host UUID. 0.6
vtepIp String The VTEP IP. 0.6
port Integer The port. 0.6
type String The resource type. 0.6
poolUuid String The pool UUID. 0.6

#attachedVxlanNetworkRefs

Name Type Description Starting Version
vni Integer The VNI. 0.6
poolUuid String The pool UUID. 0.6
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 zone UUID. 0.6
physicalInterface String The physical interface. 0.6
type String The resource type. 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
attachedClusterUuids List The attached cluster UUIDs. 0.6

#attachedVniRanges

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
startVni Integer The start VNI. 0.6
endVni Integer The end VNI. 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
l2NetworkUuid String The L2 network UUID. 0.6

SDK Sample

Java SDK

QueryL2VxlanNetworkPoolAction action = new QueryL2VxlanNetworkPoolAction();
action.conditions = asList();
action.sessionId = "773c52887a0945c4b5dee525e71f5287";
QueryL2VxlanNetworkPoolAction.Result res = action.call();

Python SDK

action = QueryL2VxlanNetworkPoolAction()
action.conditions = []
action.sessionId = "0fa3249e9dbd48f3951a93a772882f67"
res = action.call()

CreateL2VlanNetwork

API Request

URLs

POST zstack/v1/l2-networks/vlan

Headers

OAuth: the-session-uuid

Body

{
  "params": {
    "vlan": 10,
    "name": "Test-Net",
    "description": "Test",
    "zoneUuid": "43af355e5eae3ab0b74ee76ca9c19005",
    "physicalInterface": "eth0",
    "vSwitchType": "LinuxBridge",
    "isolated": false
  },
  "systemTags": [],
  "userTags": []
}}

In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"vlan":10,"name":"Test-Net","description":"Test","zoneUuid":"43af355e5eae3ab0b74ee76ca9c19005","physicalInterface":"eth0","vSwitchType":"LinuxBridge","isolated":false}}' \
http://localhost:8080/zstack/v1/l2-networks/vlan

Request Parameters

Name Type Location Description Optional Value Starting Version
vlan Integer body (contained in the params structure) The VLAN. 0.6
name String body (contained in the params structure) The resource name. 0,6
description String body (contained in the params structure) Optional. The detailed description of the resource. 0.6
zoneUuid String body (contained in the params structure) The zone UUID. 0.6
physicalInterface String body (contained in the params structure) The physical interface. 0.6
type String body (contained in the params structure) Optional. 0.6
vSwitchType String body (contained in the params structure) Optional. The type of the vSwitch.
  • LinuxBridge
  • OvsDpdk
  • MacVlan
0.6
resourceUuid String body (contained in the params structure) Optional. The resource UUID. 0.6
systemTags List body Optional. The system tags. 0.6
userTags List body Optional. The user tags. 0.6
tagUuids List body (contained in the params structure) Optional. The Uuid tags list. 4.8.0
solated Boolean body (contained in the params structure) The solated. 5.0.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,

{
  "inventory": {
    "vlan": 10,
    "name": "Test-Net",
    "description": "Test",
    "zoneUuid": "75aea7e72b5a3ce7a1f87efb70ac6339",
    "physicalInterface": "eth0",
    "type": "L2VlanNetwork"
  }
}
Name Type Description Starting Version
success boolean Whether the operation succeeded. 0.6
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 0.6
inventory L2VxlanNetworkPoolInventory See inventory. 0.6

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6

#inventory

Name Type Description Starting Version
vlan Integer The VLAN. 0.6
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 zone UUID. 0.6
physicalInterface String The physical interface. 0.6
type String The resource type. 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
attachedClusterUuids List The attached cluster UUIDs. 0.6

SDK Sample

Java SDK

CreateL2VlanNetworkAction action = new CreateL2VlanNetworkAction();
action.vlan = 10;
action.name = "Test-Net";
action.description = "Test";
action.zoneUuid = "43af355e5eae3ab0b74ee76ca9c19005";
action.physicalInterface = "eth0";
action.vSwitchType = "LinuxBridge";
action.isolated = false;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateL2VlanNetworkAction.Result res = action.call();

Python SDK

action = CreateL2VlanNetworkAction()
action.vlan = 10
action.name = "Test-Net"
action.description = "Test"
action.zoneUuid = "43af355e5eae3ab0b74ee76ca9c19005"
action.physicalInterface = "eth0"
action.vSwitchType = "LinuxBridge"
action.isolated = false
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

QueryL2VlanNetwork

API Request

URLs

GET zstack/v1/l2-networks/vlan
GET zstack/v1/l2-networks/vlan/{uuid}

Headers

Authorization: OAuth the-session-uuid

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 1456f654cfcb46889ff24bd83da741f4" \
-X GET http://localhost:8080/zstack/v1/l2-networks/vlan
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 3ad0ef4e609e43829cde6fcaac60d90d" \
-X GET http://localhost:8080/zstack/v1/l2-networks/vlan/d1eefa849cc84978bacd10ef5e1da12f

Queryable Fields

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

API Response

Sample Response

{
"inventories": [
    {
"vlan": 10.0,
"name": "Test-Net",
"description": "Test",
"zoneUuid": "02681829852848e6b25d6a11aa673f0c",
"physicalInterface": "eth0",
"type": "L2VlanNetwork"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 0.6
inventories List See inventories. 0.6

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6

#inventories

Name Type Description Starting Version
vlan Integer The VLAN. 0.6
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 zone UUID. 0.6
physicalInterface String The physical interface. 0.6
type String The resource type. 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
attachedClusterUuids List The attached cluster UUIDs. 0.6

SDK Sample

Java SDK

QueryL2VlanNetworkAction action = new QueryL2VlanNetworkAction();
action.conditions = asList();
action.sessionId = "9ae1447a4dce41f9835c2a89ed7e7eba";
QueryL2VlanNetworkAction.Result res = action.call();

Python SDK

action = QueryL2VlanNetworkAction()
action.conditions = []
action.sessionId = "3e20ec335a82447e9e39c10b371de1b3"
res = action.call()

CreateL2NoVlanNetwork

API Request

URLs

POST zstack/v1/l2-networks/no-vlan

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "name": "Test-Net",
    "description": "Test",
    "zoneUuid": "c23ba5023fcb3b4b8c3e76c443005e3d",
    "physicalInterface": "eth0",
    "vSwitchType": "LinuxBridge",
    "isolated":false
  },
  "systemTags": [],
  "userTags": []
}

In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"Test-Net","description":"Test","zoneUuid":"c23ba5023fcb3b4b8c3e76c443005e3d","physicalInterface":"eth0","vSwitchType":"LinuxBridge","isolated":false}}' \
http://localhost:8080/zstack/v1/l2-networks/no-vlan

Request Parameters

Name Type Location Description Optional Value Starting Version
name String body (contained in the params structure) The common L2 network name. 0.6
description String body (contained in the params structure) Optional. The detailed description of the common L2 network. 0.6
zoneUuid String body (contained in the params structure) The zone UUID. 0.6
physicalInterface String body (contained in the params structure) The physical interface. 0.6
type String body (contained in the params structure) The L2 network type. 0.6
vSwitchType String body (contained in the params structure) Optional. The vSwitch type.
  • LinuxBridge
  • OvsDpdk
  • MacVlan
  • OvnDpdk
5.3.20
resourceUuid String body (contained in the params structure) Optional. The resource UUID. If specified, the L2 network will use the specified value as UUID. 0.6
systemTags List body Optional. The system tags. 0.6
userTags List body Optional. The user tags. 0.6
tagUuids List body (contained in the params structure) Optional. The Uuid tags list. 3.4.0
isolated Boolean body (contained in the params structure) Optional. 5.3.20
pvlan String body (contained in the params structure) Optional. 5.3.20

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,

{
    "error": {
        "code": "SYS.1001",
        "description": "A message or a operation timeout",
        "details": "Create VM on KVM timeout after 300s"
    }
}
Name Type Description Starting Version
success boolean Whether the operation succeeded. 0.6
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error 0.6
inventory L2VxlanNetworkPoolInventory See inventoryinventory. 0.6

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6

#inventory

Name Type Description Starting Version
uuid String The resource UUID. 0.6
name String The resource name. 0.6
description String The detailed description of the resource. 0.6
zoneUuid String The zone UUID. 0.6
physicalInterface String The physical interface. 5.3.20
type String The type of L2 network. 5.3.20
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
attachedClusterUuids List The attached cluster UUID. 5.3.20

SDK Sample

Java SDK

CreateL2NoVlanNetworkAction action = new CreateL2NoVlanNetworkAction();
action.name = "Test-Net";
action.description = "Test";
action.zoneUuid = "c23ba5023fcb3b4b8c3e76c443005e3d";
action.physicalInterface = "eth0";
action.vSwitchType = "LinuxBridge";
action.isolated = false;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateL2NoVlanNetworkAction.Result res = action.call();

Python SDK

action = CreateL2NoVlanNetworkAction()
action.name = "Test-Net"
action.description = "Test"
action.zoneUuid = "c23ba5023fcb3b4b8c3e76c443005e3d"
action.physicalInterface = "eth0"
action.vSwitchType = "LinuxBridge"
action.isolated = false
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

DeleteL2Network

API Request

URLs

DELETE zstack/v1/l2-networks/{uuid}

Headers

Authorization: OAuth the-session-uuid

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth ff3445cd125b4f67b6fc551133852726" \
-X DELETE http://localhost:8080/zstack/v1/l2-networks/254811ac54a04835a8f82871f96ab86f?deleteMode=Permissive

Request Parameters

Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 4.8.0
deleteMode String body Optional. The delete mode. 4.8.0
systemTags List body Optional. The system tags. 4.8.0
userTags List body Optional. The user tags. 4.8.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,

{
    "error": {
        "code": "SYS.1001",
        "description": "A message or a operation timeout",
        "details": "Create VM on KVM timeout after 300s"
    }
}/9

SDK Sample

Java SDK

DeleteL2NetworkAction action = new DeleteL2NetworkAction();
action.uuid = "8952ecc352fc49b9a0b22286772e74e2";
action.deleteMode = "Permissive";
action.sessionId = "1bece9d1092e47e7ba176ac2e3b03793";
DeleteL2NetworkAction.Result res = action.call();

Python SDK

action = DeleteL2NetworkAction()
action.uuid = "f1f6deb480d44b77b53b74784c17a1d9"
action.deleteMode = "Permissive"
action.sessionId = "9b914d6dc4d64c8f8f45452bad140f9f"
res = action.call()

QueryL2Network

API Request

URLs

GET zstack/v1/l2-networks
GET zstack/v1/l2-networks/{uuid}

Headers

OAuth: the-session-uuid

Curl Sample

curl
-H "Content-Type: application/json;charset=UTF-8" \
-H "OAuth: 9bdaea2355c6417b9e6f3acff94fe731"\
-X GET http://localhost:8080/zstack/v1/l2-networks
curl
-H "Content-Type: application/json;charset=UTF-8" \
-H "OAuth: 0469a0dfcb7343abb2eb08d876ad3209" \
-X GET http://localhost:8080/zstack/v1/l2-networks/a523215c60b14236869d249176fb328d

Queryable Fields

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

API Response

Sample Response

{
"inventories": [
    {
"vlan": 10.0,
"name": "Test-Net",
"description": "Test",
"zoneUuid": "a5af85a0db3a4433b58ff429eea1e9a3",
"physicalInterface": "eth0",
"type": "L2VlanNetwork"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 0.6
inventories List See inventories. 0.6

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6

#inventories

Name Type Description Starting Version
uuid String The resource UUID. 0.6
name String The resource name. 0.6
description String Optional. The detailed description of the resource. 0.6
zoneUuid String The zone UUID. 0.6
physicalInterface String The physical interface. 0.6
type String The resource type. 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
attachedClusterUuids List The attached cluster UUIDs. 0.6

SDK Sample

Java SDK

QueryL2NetworkAction action = new QueryL2NetworkAction();
action.conditions = asList();
action.sessionId = "c9c0aa502c3d4bdd8cf480364a17fe67";
QueryL2NetworkAction.Result res = action.call();

Python SDK

action = QueryL2NetworkAction()
action.conditions = []
action.sessionId = "2170549725174f5f9eb390d314f86f8b"
res = action.call()

DetachL2NetworkFromCluster

API Request

URLs

DELETE/v1/l2-networks/{l2NetworkUuid}/clusters/{clusterUuid}

Headers

Authorization: OAuth the-session-uuid

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/l2-networks/baef7db345553050846947bb2d818be0/clusters/2fb51e7e35d339c4bac77819a9c4fea1?

Request Parameters

Name Type Location Description Optional Value Starting Version
l2NetworkUuid String url The L2 network UUID. 0.6
clusterUuid String url The cluster UUID. 0.6
systemTags List body Optional. The system tags. 0.6
userTags List body Optional. The user tags. 0.6

API Response

Sample Response

{
  "inventory": {
    "vlan": 10,
    "name": "Test-Net",
    "description": "Test",
    "zoneUuid": "7a531508c19d396d84abeda34b83d946",
    "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. 0.6
inventory L2NetworkInventory See inventory. 0.6

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6

#inventory

Name Type Description Starting Version
uuid String The resource UUID. 0.6
name String The resource name. 0.6
description String The detailed description of the resource. 0.6
zoneUuid String The zone UUID. 0.6
physicalInterface String The physical interface. 0.6
type String The resource type. 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
attachedClusterUuids List The attached cluster UUIDs. 0.6

SDK Sample

Java SDK

DetachL2NetworkFromClusterAction action = new DetachL2NetworkFromClusterAction();
action.l2NetworkUuid = "baef7db345553050846947bb2d818be0";
action.clusterUuid = "2fb51e7e35d339c4bac77819a9c4fea1";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DetachL2NetworkFromClusterAction.Result res = action.call();

Python SDK

action = DetachL2NetworkFromClusterAction()
action.l2NetworkUuid = "baef7db345553050846947bb2d818be0"
action.clusterUuid = "2fb51e7e35d339c4bac77819a9c4fea1"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

ChangeL2NetworkVlanId

API Request

URLs

PUT zstack/v1/l2-networks/{uuid}/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "changeL2NetworkVlanId": {
    "vlan": 1
  },
  "systemTags": [],
  "userTags": []
}

In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"changeL2NetworkVlanId":{"vlan":1}}' http://localhost:8080/zstack/v1/l2-networks/808756594f2f3ce8bc33ca92499b7653/actions

Request Parameters

Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 5.1.0
vlan Integer body (contained in the changeL2NetworkVlanId structure) Optional. 5.1.0
type String body (contained in the changeL2NetworkVlanId structure) Optional. 5.1.0
systemTags List body Optional. The system tags. 5.1.0
userTags List body Optional. The user tags. 5.1.0

API Response

Sample Response

{
  "inventory": {
    "vlan": 10,
    "name": "Test-Net",
    "description": "Test",
    "zoneUuid": "c3b0e4551d0e39139c79ca8b63fb3964",
    "physicalInterface": "eth0",
    "type": "L2VlanNetwork"
  }
}
Name Type Description Starting Version
success boolean Whether the operation succeeded. 5.1.0
inventory L2NetworkInventory Seeinventory 5.1.0
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, seeerror 5.1.0

#inventory

Name Type Description Starting Version
uuid String The resource UUID. 5.1.0
name String The resource name. 5.1.0
description String The brief description of the resource. 5.1.0
zoneUuid String The zone UUID. 5.1.0
physicalInterface String The physical interface. 5.1.0
type String The type of L2Network. 5.1.0
createDate Timestamp The creation date. 5.1.0
lastOpDate Timestamp The last operation date. 5.1.0
attachedClusterUuids List The attached cluster UUIDs. 5.1.0

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 5.1.0
description String The brief description of the error. 5.1.0
details String The details about the error. 5.1.0
elaboration String The reserved field. Default value: null. 5.1.0
opaque LinkedHashMap The reserved field. Default value: null. 5.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. 5.1.0

SDK Sample

Java SDK

ChangeL2NetworkVlanIdAction action = new ChangeL2NetworkVlanIdAction();
action.uuid = "808756594f2f3ce8bc33ca92499b7653";
action.vlan = 1;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ChangeL2NetworkVlanIdAction.Result res = action.call();

Python SDK

action = ChangeL2NetworkVlanIdAction()
action.uuid = "808756594f2f3ce8bc33ca92499b7653"
action.vlan = 1
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

UpdateL2Network

API Request

URLs

PUT zstack/v1/l2-networks/{uuid}/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
"updateL2Network": {
"name": "Test-Net",
"description": "Test"
  },
"systemTags": [],
"userTags": []
}

In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateL2Network":{"name":"Test-Net","description":"Test"}}' \
http://localhost:8080/zstack/v1/l2-networks/8a44ece25f973842b841591a554f5fee/actions

Request Parameters

Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 0.6
name String body (contained in the updateL2Network structure) Optional. The common L2 network name. 0.6
description String body (contained in the updateL2Network structure) Optional. The detailed description of the common L2 network. 0.6
systemTags List body Optional. The system tags. 0.6
userTags List body Optional. The user tags. 0.6

API Response

Sample Response

{
"inventory": {
"vlan": 10.0,
"name": "Test-Net",
"description": "Test",
"zoneUuid": "95bb5b1156ff49caacaf9acc2eda0058",
"physicalInterface": "eth0",
"type": "L2VlanNetwork"
  }
}
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 L2NetworkInventory See inventory. 0.6

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6

#inventory

Name Type Description Starting Version
uuid String The resource UUID. 0.6
name String The resource name. 0.6
description String The detailed description of the resource. 0.6
zoneUuid String The zone UUID. 0.6
physicalInterface String The physical interface. 0.6
type String The resource type. 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
attachedClusterUuids List The attached cluster UUIDs. 0.6

SDK Sample

Java SDK

UpdateL2NetworkAction action = new UpdateL2NetworkAction();
action.uuid = "f7ea5335fcab4d438069879d62384b0e";
action.name = "Test-Net";
action.description = "Test";
action.sessionId = "05627ec42486449cb6b422ef927829f1";
UpdateL2NetworkAction.Result res = action.call();

Python SDK

action = UpdateL2NetworkAction()
action.uuid = "7dc08ad01b8a4d578aab2ae0ad750f1b"
action.name = "Test-Net"
action.description = "Test"
action.sessionId = "130b064e63204a479857ced03f550cf2"
res = action.call()

GetL2NetworkTypes

API Request

URLs

GET zstack/v1/l2-networks/types

Headers

OAuth: the-session-uuid

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "OAuth: 76514d7cdcf44b57bc26ff7b4ae0be63" \
-X GET http://localhost:8080/zstack/v1/l2-networks/types

Request Parameters

Name Type Location Description Optional Value Starting Version
systemTags List query Optional. The system tags. 0.6
userTags List query Optional. The user tags. 0.6

API Response

Sample Response

{
"l2NetworkTypes": [
"L2VlanNetwork",
"L2NoVlanNetwork"
  ]
}
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

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6

SDK Sample

Java SDK

GetL2NetworkTypesAction action = new GetL2NetworkTypesAction();
action.sessionId = "485005865e744e19a12ad2f9af2ea997";
GetL2NetworkTypesAction.Result res = action.call();

Python SDK

action = GetL2NetworkTypesAction()
action.sessionId = "b34f3c756aa542789f35bc1774845bc1"
res = action.call()

AttachL2NetworkToCluster

API Request

URLs

POST zstack/v1/l2-networks/{l2NetworkUuid}/clusters/{clusterUuid}

Headers

OAuth: the-session-uuid

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST http://localhost:8080/zstack/v1/l2-networks/e852ba6eb4c03f2fafdb73ce838d8980/clusters/112816423a1a3b50a58d54fd1f6a8665

Request Parameters

Name Type Location Description Optional Value Starting Version
l2NetworkUuid String url The L2 network UUID. 0.6
clusterUuid String url The cluster UUID. 0.6
l2ProviderType String body Optional. The type of L2 network provider.
  • LinuxBridge
4.8.0
systemTags List body Optional. The system tags. 0.6
userTags List body Optional. The user tags. 0.6

API Response

Sample Response

{
  "inventory": {
    "vlan": 10,
    "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. 0.6
inventory L2NetworkInventory See inventory. 0.6

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6

#inventory

Name Type Description Starting Version
uuid String The resource UUID. 0.6
name String The resource name. 0.6
description String The detailed description of the resource. 0.6
zoneUuid String The zone UUID. 0.6
physicalInterface String The physical interface. 0.6
type String The resource type. 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
attachedClusterUuids List The attached cluster UUIDs. 0.6

SDK Sample

Java SDK

AttachL2NetworkToClusterAction action = new AttachL2NetworkToClusterAction();
action.l2NetworkUuid = "e852ba6eb4c03f2fafdb73ce838d8980";
action.clusterUuid = "112816423a1a3b50a58d54fd1f6a8665";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AttachL2NetworkToClusterAction.Result res = action.call();

Python SDK

action = AttachL2NetworkToClusterAction()
action.l2NetworkUuid = "e852ba6eb4c03f2fafdb73ce838d8980"
action.clusterUuid = "112816423a1a3b50a58d54fd1f6a8665"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

CreateVniRange

API Request

URLs

POST zstack/v1/l2-networks/vxlan-pool/{l2NetworkUuid}/vni-ranges

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "name": "TestVniRange",
    "description": "Here is a Vni Range",
    "startVni": 10.0,
    "endVni": 5000.0
  },
  "systemTags": [],
  "userTags": []
}

In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"TestVniRange","description":"Here is a Vni Range","startVni":10.0,"endVni":5000.0}}' \
http://localhost:8080/zstack/v1/l2-networks/vxlan-pool/66b7ddcebeea33eaaa39a2b4667267ab/vni-ranges

Request Parameters

Name Type Location Description Optional Value Starting Version
name String body (contained in the params structure) The resource name. 0.6
description String body (contained in the params structure) Optional. The detailed description of the resource. 0.6
startVni Integer body (contained in the params structure) The start VNI. 0.6
endVni Integer body (contained in the params structure) The end VNI. 0.6
l2NetworkUuid String url The VXLAN pool UUID. 0.6
resourceUuid String body (contained in the params structure) Optional. The resource UUID. 0.6
systemTags List body Optional. The system tags. 0.6
userTags List body Optional. The user tags. 0.6

API Response

Sample Response

{
"inventory": {
"name": "TestVniRange",
"description": "Here is a Vni Range",
"startVni": 10.0,
"endVni": 5000.0,
"l2NetworkUuid": "252d938da43a48c98ce93fe7163f14df"
  }
}
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 VniRangeInventory See inventory. 0.6

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6

#inventory

Name Type Description Starting Version
uuid String The resource UUID. 0.6
name String The resource name. 0.6
description String The detailed description of the resource. 0.6
startVni Integer The start VNI. 0.6
endVni Integer The end VNI. 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
l2NetworkUuid String The L2 network UUID. 0.6

SDK Sample

Java SDK

CreateVniRangeAction action = new CreateVniRangeAction();
action.name = "TestVniRange";
action.description = "Here is a Vni Range";
action.startVni = 10.0;
action.endVni = 5000.0;
action.l2NetworkUuid = "9548ed5fc8434782890d5c6ae24d87a7";
action.sessionId = "977eac0795364c5995c20120e9e35ca1";
CreateVniRangeAction.Result res = action.call();

Python SDK

action = CreateVniRangeAction()
action.name = "TestVniRange"
action.description = "Here is a Vni Range"
action.startVni = 10.0
action.endVni = 5000.0
action.l2NetworkUuid = "d55172d6e90e403da46074d53c680838"
action.sessionId = "dfacd10f07444a99bca68426cc19f079"
res = action.call()

DeleteVniRange

API Request

URLs

DELETE/v1/l2-networks/vxlan-pool/vni-ranges/{uuid}?deleteMode={deleteMode}

Headers

Authorization: OAuth the-session-uuid

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 49bf51476d4f49e3b6322688a4c02027" \
-X DELETE http://localhost:8080/zstack/v1/l2-networks/vxlan-pool/vni-ranges/57aae81f5ed248e3bea4509843ab919f?deleteMode=Permissive

Request Parameters

Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 0.6
deleteMode String body Optional. The delete mode. 0.6
systemTags List body Optional. The system tags. 0.6
userTags List body Optional. The user tags. 0.6

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,

{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
    }
}

SDK Sample

Java SDK

DeleteVniRangeAction action = new DeleteVniRangeAction();
action.uuid = "8ad0e38ae63d4f2d86b9cd2283c5df03";
action.deleteMode = "Permissive";
action.sessionId = "85100440f4f94c68ba0884e09c7429dc";
DeleteVniRangeAction.Result res = action.call();

Python SDK

action = DeleteVniRangeAction()
action.uuid = "4aef50ec1f784e66ab79ef021216389d"
action.deleteMode = "Permissive"
action.sessionId = "dfbae4e4897f497a9803a2a5dc23f848"
res = action.call()

QueryVniRange

API Request

URLs

GET zstack/v1/l2-networks/vxlan-pool/vni-range
GET zstack/v1/l2-networks/vxlan-pool/vni-range/{uuid}

Headers

Authorization: OAuth the-session-uuid

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 337c51002a0f4fec9b9ced4cdd9ca08d" \
-X GET http://localhost:8080/zstack/v1/l2-networks/vxlan-pool/vni-range
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 69245fbe344f4adf95454deb1bfe74fb" \
-X GET http://localhost:8080/zstack/v1/l2-networks/vxlan-pool/vni-range/4397921aaa5d45c7ba9bbde764b89389

Queryable Fields

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

API Response

Sample Response

{
"inventories": [
    {
"name": "Test-Range",
"description": "Test",
"startVni": 10.0,
"endVni": 10000.0,
"l2NetworkUuid": "32e0539245504a22a474ea2f34db16d0"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 0.6
inventories List See inventories. 0.6

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6

#inventories

Name Type Description Starting Version
uuid String The resource UUID. 0.6
name String The resource name. 0.6
description String The detailed description of the resource. 0.6
startVni Integer The start VNI. 0.6
endVni Integer The end VNI. 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
l2NetworkUuid String The L2 network UUID. 0.6

SDK Sample

Java SDK

QueryVniRangeAction action = new QueryVniRangeAction();
action.conditions = asList();
action.sessionId = "eb1c573c6d4240ecb746321b12f9e1d3";
QueryVniRangeAction.Result res = action.call();

Python SDK

action = QueryVniRangeAction()
action.conditions = []
action.sessionId = "89f7a520087049dcbd87f91aa20994fa"
res = action.call()

UpdateVniRange

API Request

URLs

PUT zstack/v1/l2-networks/vxlan-pool/vni-ranges/{uuid}

Headers

Authorization: OAuth the-session-uuid

Body

{
  "updateVniRange": {
    "name": "VNI-NEW"
  },
  "systemTags": [],
  "userTags": []
}

In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateVniRange":{"name":"VNI-NEW"}}' http://localhost:8080/zstack/v1/l2-networks/vxlan-pool/vni-ranges/f85dd9a8fcdc33c6a55f4786e0ffae52

Request Parameters

Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 3.3.0
name String body Optional. The name. 3.3.0
systemTags List body Optional. The system tags. 3.3.0
userTags List body Optional. The user tags. 3.3.0

API Response

Sample Response

{
  "inventory": {
    "name": "Test-Range",
    "description": "Test",
    "startVni": 10.0,
    "endVni": 10000.0,
    "l2NetworkUuid": "73f29ba3afd83876830ab1794046e47a"
  }
}
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.3.0

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.3.0
description String The brief description of the error. 3.3.0
details String The details about the error. 3.3.0
elaboration String The reserved field. Default value: null. 3.3.0
opaque LinkedHashMap The reserved field. Default value: null. 3.3.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.3.0

SDK Sample

Java SDK

UpdateVniRangeAction action = new UpdateVniRangeAction();
action.uuid = "f85dd9a8fcdc33c6a55f4786e0ffae52";
action.name = "VNI-NEW";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateVniRangeAction.Result res = action.call();

Python SDK

action = UpdateVniRangeAction()
action.uuid = "f85dd9a8fcdc33c6a55f4786e0ffae52"
action.name = "VNI-NEW"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

QueryPhysicalSwitch

API Request

URLs

GET zstack/v1/topo/physical-switches
GET zstack/v1/topo/physical-switches/{uuid}

Headers

Authorization: OAuth the-session-uuid

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/topo/physical-switches?q=uuid=e0a9b8143944334e90f06a020cb4dd9d
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/topo/physical-switches/4f629d20a9203842863b7dea1dff3637

Queryable Fields

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

API Response

Sample Response

{
  "inventories": [
    {
      "uuid": "9366fcd518b730cea2ee9afa371174d7",
      "name": "test-sdn",
      "description": "sdn for test",
      "ip": "192.168.1.1"
    }
  ]
}
Name Type Description Starting Version
success boolean Whether the operation succeeded. 5.4.0
inventories List See inventories. 5.4.0
error ErrorCode See error. 5.4.0

#inventories

Name Type Description Starting Version
uuid String The resource UUID. 5.4.0
name String The resource name. 5.4.0
description String The detailed description of the resource. 5.4.0
fabricIds String The fabric IDs. 5.4.0
sdnControllerUuid String The sdn controller UUID. 5.4.0
deleted Boolean The deleted. 5.4.0
createDate Timestamp The last operation date. 5.4.0
lastOpDate Timestamp The last operation date. 5.4.0

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 5.4.0
description String The brief description of the error. 5.4.0
details String The details about the error. 5.4.0
elaboration String The reserved field. Default value: null. 5.4.0
opaque LinkedHashMap The reserved field. Default value: null. 5.4.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. 5.4.0

#ports

Name Type Description Starting Version
uuid String The resource UUID. 5.4.0
name String The resource name. 5.4.0
description String The detailed description of the resource. 5.4.0
ethTrunkName String The name of the trunk port to which the physical switch port belongs. 5.4.0
portType String The link type of the physical switch port. 5.4.0
peerInterfaceUuid String The UUID of the server interface connected to the physical switch port. 5.4.0
switchUuid String The UUID of the switch to which the physical switch port belongs. 5.4.0
sdnControllerUuid String The SDN controller UUID. 5.4.0
createDate Timestamp The last operation date. 5.4.0
lastOpDate Timestamp The last operation date. 5.4.0

SDK Sample

Java SDK

QueryPhysicalSwitchAction action = new QueryPhysicalSwitchAction();
action.conditions = asList("uuid=aa5022da31d13887a69893fcb2a6dd2c");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryPhysicalSwitchAction.Result res = action.call();

Python SDK

action = QueryPhysicalSwitchAction()
action.conditions = ["uuid=73f6a940599b3404985c94ec992cd83c"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

GetVSwitchTypes

API Request

URLs

GET zstack//v1/l2-networks/vSwitchTypes

Headers

OAuth: the-session-uuid

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/l2-networks/vSwitchTypes?

Request Parameters

Name Type Location Description Optional Value Starting Version
systemTags List query Optional. The system tags. 4.8.0
userTags List query Optional. The user tags. 4.8.0

API Response

Sample Response

{
  "vSwitchTypes": [
    "LinuxBridge",
    "OVSDPDK"
  ]
}}
Name Type Description Starting Version
success boolean Whether the operation succeeded. 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

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 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

Java SDK

GetVSwitchTypesAction action = new GetVSwitchTypesAction();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetVSwitchTypesAction.Result res = action.call();

Python SDK

action = GetVSwitchTypesAction()
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()