ZStack Cloud Platform
Single Server, Free Trial for One Year
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) | 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 |
{ "inventory": { "isDistributed": true, "vSwitchIndex": 1, "name": "dvs-1", "description": "Test dvs", "zoneUuid": "4bc93f4e3a1c35b8948583951e56b5eb", "physicalInterface": "bond1", "type": "virtualSwitch" } }| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | 4.1.0 | |
| inventory | L2VirtualSwitchNetworkInventory | See inventory. | 4.1.0 |
| error | ErrorCode | Error code. If not null, the operation fails, or vice versa. The value is null on success. 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 | Physical NIC. | 4.1.0 |
| type | String | 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 | 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 | 4.2.0 | |
| TRUNK | PortGroupVlanMode | 4.2.0 | |
| PVLAN | PortGroupVlanMode | 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 |
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()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 |
{ "error": { "code": "SYS.1001", "description": "A message or a operation timeout", "details": "Create VM on KVM timeout after 300s" } }/9DeleteL2NetworkAction 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()