Network ResourcesDistributed Switch Related Interfaces
AttachL2NetworkToHost
Headers
Authorization: OAuth the-session-uuidBody
{
"params": {
"l2ProviderType": "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":{"l2ProviderType":"LinuxBridge"}}' http://localhost:8080/zstack/v1/l2-networks/eabc734e7538311a9afd99276867fb88/hosts/b20782106d1537e6bd8ee81f94d2c870Parameter List
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 | Optional. The host parameter. |
| 4.3.0 |
API Response
Sample Response
{
"inventory": {
"vlan": 10,
"name": "Test-Net",
"description": "Test",
"zoneUuid": "6b737f0ab0a839b58e9d7a208ce7bb0b",
"physicalInterface": "eth0",
"type": "L2VlanNetwork"
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | 4.1.0 | |
| inventory | L2NetworkInventory | See inventory. | 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 |
inventory
| 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 |
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.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
Java SDK
AttachL2NetworkToHostAction action = new AttachL2NetworkToHostAction();
action.l2NetworkUuid = "eabc734e7538311a9afd99276867fb88";
action.hostUuid = "b20782106d1537e6bd8ee81f94d2c870";
action.l2ProviderType = "LinuxBridge";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AttachL2NetworkToHostAction.Result res = action.call();Python SDK
AttachL2NetworkToHostAction action = AttachL2NetworkToHostAction()
action.l2NetworkUuid = "eabc734e7538311a9afd99276867fb88"
action.hostUuid = "b20782106d1537e6bd8ee81f94d2c870"
action.l2ProviderType = "LinuxBridge"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AttachL2NetworkToHostAction.Result res = action.call()