Route Resource Operations
ReconnectVirtualRouter
API Request
PUT zstack/v1/vm-instances/appliances/virtual-routers/{vmInstanceUuid}/actionsAuthorization: OAuth the-session-uuid{
"reconnectVirtualRouter": {},
"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 bd24a72b74a148e8b18ee2b2367534d6" \
-X PUT -d '{"reconnectVirtualRouter":{}}' \
http://localhost:8080/zstack/v1/vm-instances/appliances/virtual-routers/74f9bb00796c366a83a6201df9e26f43/actions| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| vmInstanceUuid | String | url | The VM instance UUID. | 0.6 | |
| systemTags | List | body | Optional. The system tags. | 0.6 | |
| userTags | List | body | Optional. The user tags. | 0.6 |
API Response
{
"inventory": {
"managementNetworkUuid": "9a154450da784a418db5406a463d2235",
"name": "Test-Router",
"description": "this is a virtual router vm",
"clusterUuid": "9b359b8de95d4d97a19d53bf4193993a",
"imageUuid": "c7bbef849e5d47478ee1db445d55530b",
"instanceOfferingUuid": "5437f63807864c37b4d3042ee28f2680"
}
}| 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 |
|---|---|---|---|
| applianceVmType | String | 0.6 | |
| managementNetworkUuid | String | 0.6 | |
| defaultRouteL3NetworkUuid | String | 0.6 | |
| status | String | 0.6 | |
| agentPort | Integer | 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 |
| clusterUuid | String | The cluster UUID. | 0.6 |
| imageUuid | String | The image UUID. | 0.6 |
| hostUuid | String | The host UUID. | 0.6 |
| lastHostUuid | String | 0.6 | |
| instanceOfferingUuid | String | The instance offering UUID. | 0.6 |
| rootVolumeUuid | String | The root volume UUID. | 0.6 |
| platform | String | 0.6 | |
| defaultL3NetworkUuid | String | 0.6 | |
| type | String | 0.6 | |
| hypervisorType | String | 0.6 | |
| memorySize | Long | 0.6 | |
| cpuNum | Integer | 0.6 | |
| cpuSpeed | Long | 0.6 | |
| allocatorStrategy | String | 0.6 | |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
| state | String | 0.6 | |
| vmNics | List | See vmNics. | 0.6 |
| allVolumes | List | See allVolumes. | 0.6 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 0.6 |
| vmInstanceUuid | String | The VM instance UUID. | 0.6 |
| l3NetworkUuid | String | The L3 network UUID. | 0.6 |
| ip | String | 0.6 | |
| mac | String | 0.6 | |
| netmask | String | 0.6 | |
| gateway | String | 0.6 | |
| metaData | String | 0.6 | |
| deviceId | Integer | 0.6 | |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 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 |
| primaryStorageUuid | String | The primary storage UUID. | 0.6 |
| vmInstanceUuid | String | The VM instance UUID. | 0.6 |
| diskOfferingUuid | String | The disk offering UUID. | 0.6 |
| rootImageUuid | String | 0.6 | |
| installPath | String | 0.6 | |
| type | String | 0.6 | |
| format | String | 0.6 | |
| size | Long | 0.6 | |
| actualSize | Long | 0.6 | |
| deviceId | Integer | 0.6 | |
| state | String | 0.6 | |
| status | String | 0.6 | |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
| isShareable | Boolean | 0.6 |
SDK Sample
ReconnectVirtualRouterAction action = new ReconnectVirtualRouterAction();
action.vmInstanceUuid = "3b20e87b87b442518efff8744c2cfde8";
action.sessionId = "ce03736cdddf4c49bce35d8e55e189c7";
ReconnectVirtualRouterAction.Result res = action.call();ReconnectVirtualRouterAction action = ReconnectVirtualRouterAction()
action.vmInstanceUuid = "ae937aa909594b1bb2e36359cd7dbc5b"
action.sessionId = "4434d7282a7d4940bb0695c0d252bfae"
ReconnectVirtualRouterAction.Result res = action.call()QueryVirtualRouterVm
API Request
GET zstack/v1/vm-instances/appliances/virtual-routers
GET zstack/v1/vm-instances/appliances/virtual-routers/{uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 823cd67ecc7c4e6fa25efbc7f9b5130b" \
-X GET http://localhost:8080/zstack/v1/vm-instances/appliances/virtual-routers?q=name=Test-Routercurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 5b8a868c89ef434086caeb6ade4613bf" \
-X GET http://localhost:8080/zstack/v1/vm-instances/appliances/virtual-routers/a1f8c5edc13743d79ec8c9d912d1c280Queryable Fields
You can check all queryable fields and resource names that can be queried across
tables by using zstack-cli, entering
QueryVirtualRouterVm, and pressing the Tab key.
API Response
{
"inventories": [
{
"uuid": "eb4c132875424e19aa200c5685f7d9ca",
"name": "Test-VM",
"description": "Appliance VM",
"zoneUuid": "453595b58b1f407aa8b551c279738191",
"clusterUuid": "bc24a488a7c740ef828839d6624b15a2",
"imageUuid": "729f3c664fb14ffa8886cbf5d14bec47",
"hostUuid": "bdd8a04c22b6482287a2ac071319f59d",
"lastHostUuid": "bc6337a5a73142c8afbc4108f69595cf",
"instanceOfferingUuid": "5beedb45ba9547a4a154c747c69c38bd",
"rootVolumeUuid": "b07d68c5879b49a680f6fc375d06603f",
"platform": "Linux",
"defaultL3NetworkUuid": "dfd914d7f33a434a880fd0cd29db1ad1",
"type": "UserVm",
"hypervisorType": "KVM",
"memorySize": 8.589934592E9,
"cpuNum": 1.0,
"allocatorStrategy": "LastHostPreferredAllocatorStrategy",
"createDate": "Jun 7, 2017 9:21:17 PM",
"lastOpDate": "Jun 7, 2017 9:21:17 PM",
"state": "Running",
"vmNics": [
{
"uuid": "ba1a965bee39412c962735987da7722a",
"vmInstanceUuid": "eb4c132875424e19aa200c5685f7d9ca",
"usedIpUuid": "7250d89102a44251aa49a5bcf093d484",
"l3NetworkUuid": "dfd914d7f33a434a880fd0cd29db1ad1",
"ip": "192.168.1.10",
"mac": "00:0c:29:bd:99:fc",
"netmask": "255.255.255.0",
"gateway": "192.168.1.1",
"deviceId": 0.0,
"createDate": "Jun 7, 2017 9:21:17 PM",
"lastOpDate": "Jun 7, 2017 9:21:17 PM"
}
],
"allVolumes": [
{
"uuid": "b07d68c5879b49a680f6fc375d06603f",
"name": "Root-Volume-For-VM-eb4c132875424e19aa200c5685f7d9ca",
"primaryStorageUuid": "f82bd3273e1a42a7bc53f1d098d07c63",
"vmInstanceUuid": "eb4c132875424e19aa200c5685f7d9ca",
"diskOfferingUuid": "71a6bbc236974c188ad258875a0cc837",
"rootImageUuid": "729f3c664fb14ffa8886cbf5d14bec47",
"installPath": "/Cloud_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-b07d68c5879b49a680f6fc375d06603f/b07d68c5879b49a680f6fc375d06603f.qcow2",
"type": "Root",
"format": "qcow2",
"size": 1.073741824E11,
"actualSize": 2.147483648E10,
"deviceId": 0.0,
"state": "Enabled",
"status": "Ready",
"createDate": "Jun 7, 2017 9:21:17 PM",
"lastOpDate": "Jun 7, 2017 9:21:17 PM"
}
]
}
]
}| 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 |
|---|---|---|---|
| applianceVmType | String | 0.6 | |
| managementNetworkUuid | String | 0.6 | |
| defaultRouteL3NetworkUuid | String | 0.6 | |
| status | String | 0.6 | |
| agentPort | Integer | 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 |
| clusterUuid | String | The cluster UUID. | 0.6 |
| imageUuid | String | The image UUID. | 0.6 |
| hostUuid | String | The host UUID. | 0.6 |
| lastHostUuid | String | 0.6 | |
| instanceOfferingUuid | String | The instance offering UUID. | 0.6 |
| rootVolumeUuid | String | The root volume UUID. | 0.6 |
| platform | String | 0.6 | |
| defaultL3NetworkUuid | String | 0.6 | |
| type | String | 0.6 | |
| hypervisorType | String | 0.6 | |
| memorySize | Long | 0.6 | |
| cpuNum | Integer | 0.6 | |
| cpuSpeed | Long | 0.6 | |
| allocatorStrategy | String | 0.6 | |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
| state | String | 0.6 | |
| vmNics | List | See vmNics. | 0.6 |
| allVolumes | List | See allVolumes. | 0.6 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 0.6 |
| vmInstanceUuid | String | The VM instance UUID. | 0.6 |
| l3NetworkUuid | String | The L3 network UUID. | 0.6 |
| ip | String | 0.6 | |
| mac | String | 0.6 | |
| netmask | String | 0.6 | |
| gateway | String | 0.6 | |
| metaData | String | 0.6 | |
| deviceId | Integer | 0.6 | |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 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 |
| primaryStorageUuid | String | The primary storage UUID. | 0.6 |
| vmInstanceUuid | String | The VM instance UUID. | 0.6 |
| diskOfferingUuid | String | The disk offering UUID. | 0.6 |
| rootImageUuid | String | 0.6 | |
| installPath | String | 0.6 | |
| type | String | 0.6 | |
| format | String | 0.6 | |
| size | Long | 0.6 | |
| actualSize | Long | 0.6 | |
| deviceId | Integer | 0.6 | |
| state | String | 0.6 | |
| status | String | 0.6 | |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
| isShareable | Boolean | 0.6 |
SDK Sample
QueryVirtualRouterVmAction action = new QueryVirtualRouterVmAction();
action.conditions = asList("name=Test-Router");
action.sessionId = "f25578538ecf4a55b98d51e5b8788adb";
QueryVirtualRouterVmAction.Result res = action.call();QueryVirtualRouterVmAction action = QueryVirtualRouterVmAction()
action.conditions = ["name=Test-Router"]
action.sessionId = "d1cd40ad61f149689bb358c997377d4a"
QueryVirtualRouterVmAction.Result res = action.call()QueryApplianceVm
API Request
GET zstack/v1/vm-instances/appliances
GET zstack/v1/vm-instances/appliances/{uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth fee14fed21eb4535bcd2fd6a11fa9dcd" \
-X GET http://localhost:8080/zstack/v1/vm-instances/appliances?q=uuid=59b2f0ff7d3e49faab66fdb4bdfee249curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth f11e69b5788b458e8149425132902365" \
-X GET http://localhost:8080/zstack/v1/vm-instances/appliances/5eaf0998a54345e5bb25bfdad34b2b31Queryable Fields
You can check all queryable fields and resource names that can be queried across
tables by using zstack-cli, entering
QueryApplianceVm, and pressing the Tab key.
API Response
{
"inventories": [
{
"uuid": "f71a399a79794ab8a41e26a601ac7387",
"name": "Test-VM",
"description": "Appliance VM",
"zoneUuid": "4cf173a14e67440c9349c1e236a56c37",
"clusterUuid": "07412e72791c474fa240b75da1b210c5",
"imageUuid": "7bc33ed9760f424a9b9ff21fc0bbb48e",
"hostUuid": "0cbed62c52bc407e994c966f246363bd",
"lastHostUuid": "08921382c4f44705bae7cba6414c811d",
"instanceOfferingUuid": "e056c84995cb4d68ac78dbcc30af3f4f",
"rootVolumeUuid": "2557a6f997ee457fad526e179a76e8c0",
"platform": "Linux",
"defaultL3NetworkUuid": "748fc87b7fcb456cbea47432e52b377d",
"type": "UserVm",
"hypervisorType": "KVM",
"memorySize": 8.589934592E9,
"cpuNum": 1.0,
"allocatorStrategy": "LastHostPreferredAllocatorStrategy",
"createDate": "Jun 7, 2017 9:20:39 PM",
"lastOpDate": "Jun 7, 2017 9:20:39 PM",
"state": "Running",
"vmNics": [
{
"uuid": "d2dfc67ddf28431bb64cc90fe0e113f6",
"vmInstanceUuid": "f71a399a79794ab8a41e26a601ac7387",
"usedIpUuid": "f654374b78534f5fb9b75873084932a3",
"l3NetworkUuid": "748fc87b7fcb456cbea47432e52b377d",
"ip": "192.168.1.10",
"mac": "00:0c:29:bd:99:fc",
"netmask": "255.255.255.0",
"gateway": "192.168.1.1",
"deviceId": 0.0,
"createDate": "Jun 7, 2017 9:20:39 PM",
"lastOpDate": "Jun 7, 2017 9:20:39 PM"
}
],
"allVolumes": [
{
"uuid": "2557a6f997ee457fad526e179a76e8c0",
"name": "Root-Volume-For-VM-f71a399a79794ab8a41e26a601ac7387",
"primaryStorageUuid": "d00057b39df9494bbaf00d047dd04825",
"vmInstanceUuid": "f71a399a79794ab8a41e26a601ac7387",
"diskOfferingUuid": "20346d1b6643492fbc4da8d6baf4b6d2",
"rootImageUuid": "7bc33ed9760f424a9b9ff21fc0bbb48e",
"installPath": "/Cloud_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-2557a6f997ee457fad526e179a76e8c0/2557a6f997ee457fad526e179a76e8c0.qcow2",
"type": "Root",
"format": "qcow2",
"size": 1.073741824E11,
"actualSize": 2.147483648E10,
"deviceId": 0.0,
"state": "Enabled",
"status": "Ready",
"createDate": "Jun 7, 2017 9:20:39 PM",
"lastOpDate": "Jun 7, 2017 9:20:39 PM"
}
]
}
]
}| 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 |
|---|---|---|---|
| applianceVmType | String | 0.6 | |
| managementNetworkUuid | String | 0.6 | |
| defaultRouteL3NetworkUuid | String | 0.6 | |
| status | String | 0.6 | |
| agentPort | Integer | 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 |
| clusterUuid | String | The cluster UUID. | 0.6 |
| imageUuid | String | The image UUID. | 0.6 |
| hostUuid | String | The host UUID. | 0.6 |
| lastHostUuid | String | 0.6 | |
| instanceOfferingUuid | String | The instance offering UUID. | 0.6 |
| rootVolumeUuid | String | The root volume UUID. | 0.6 |
| platform | String | 0.6 | |
| defaultL3NetworkUuid | String | 0.6 | |
| type | String | 0.6 | |
| hypervisorType | String | 0.6 | |
| memorySize | Long | 0.6 | |
| cpuNum | Integer | 0.6 | |
| cpuSpeed | Long | 0.6 | |
| allocatorStrategy | String | 0.6 | |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
| state | String | 0.6 | |
| vmNics | List | See vmNics. | 0.6 |
| allVolumes | List | See allVolumes. | 0.6 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 0.6 |
| vmInstanceUuid | String | The VM instance UUID. | 0.6 |
| l3NetworkUuid | String | The L3 network UUID. | 0.6 |
| ip | String | 0.6 | |
| mac | String | 0.6 | |
| netmask | String | 0.6 | |
| gateway | String | 0.6 | |
| metaData | String | 0.6 | |
| deviceId | Integer | 0.6 | |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 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 |
| primaryStorageUuid | String | The primary storage UUID. | 0.6 |
| vmInstanceUuid | String | The VM instance UUID. | 0.6 |
| diskOfferingUuid | String | The disk offering UUID. | 0.6 |
| rootImageUuid | String | 0.6 | |
| installPath | String | 0.6 | |
| type | String | 0.6 | |
| format | String | 0.6 | |
| size | Long | 0.6 | |
| actualSize | Long | 0.6 | |
| deviceId | Integer | 0.6 | |
| state | String | 0.6 | |
| status | String | 0.6 | |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
| isShareable | Boolean | 0.6 |
SDK Sample
QueryApplianceVmAction action = new QueryApplianceVmAction();
action.conditions = asList("uuid=691c9a2eb7964cdd8cfad52a4acece7b");
action.sessionId = "9fec03d462184d6b9a87d314c00597ed";
QueryApplianceVmAction.Result res = action.call();QueryApplianceVmAction action = QueryApplianceVmAction()
action.conditions = ["uuid=0c17514849ac49809d6e6047fc4b4978"]
action.sessionId = "485840ed54bc40cc9e47feabd0475ae7"
QueryApplianceVmAction.Result res = action.call()CreateVirtualRouterOffering
API Request
POST zstack/v1/instance-offerings/virtual-routersAuthorization: OAuth the-session-uuid{
"params": {
"zoneUuid": "b2826f6c4a5b433b87916e2240132ffa",
"managementNetworkUuid": "2f8e7e8636db4313b735edddc488a961",
"imageUuid": "bc78c126c6a94ee3aec0c840b50730a7",
"publicNetworkUuid": "95c8cc36b34e4ad89d0eb9b0b6ee02e6",
"isDefault": true,
"name": "VirtualRouter-Offering",
"cpuNum": 2.0,
"memorySize": 1024.0,
"sortKey": 0.0,
"type": "VirtualRouter"
},
"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 bca83008f4154b488a8167f021144e4d" \
-X POST -d '{"params":{"zoneUuid":"a0f488a96504388cae48c6c489c5f368","managementNetworkUuid":"3f5412e1ad0b3021bbdb77503fc7de86","imageUuid":"23743ebd52213235a11e21245100bd57","publicNetworkUuid":"1a24d621f66432eb845b3835697538ed","isDefault":true,"name":"VirtualRouter-Offering","cpuNum":2.0,"memorySize":1024.0,"sortKey":0.0,"type":"VirtualRouter"}}' \
http://localhost:8080/zstack/v1/instance-offerings/virtual-routers| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| zoneUuid | String | body (contained in the params structure) | The zone UUID. | 0.6 | |
| managementNetworkUuid | String | body (contained in the params structure) | The L3 management network UUID. | 0.6 | |
| imageUuid | String | body (contained in the params structure) | The image UUID. | 0.6 | |
| publicNetworkUuid | String | body (contained in the params structure) | Optional. The L3 public network UUID. | 0.6 | |
| isDefault | Boolean | body (contained in the params structure) | Optional. Whether the vRouter offering is the default offering. | 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 | |
| cpuNum | int | body (contained in the params structure) | The CPU count. | 0.6 | |
| memorySize | long | body (contained in the params structure) | The memory size. | 0.6 | |
| allocatorStrategy | String | body (contained in the params structure) | Optional. The allocator strategy. |
|
0.6 |
| sortKey | int | body (contained in the params structure) | Optional. The sort key. | 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 |
API Response
{
"inventory": {
"uuid": "db5bb944a9ef48eda9ff68d3eaedefed",
"name": "instanceOffering1",
"cpuNum": 2.0,
"cpuSpeed": 1.0,
"type": "UserVm",
"allocatorStrategy": "Mevoco",
"createDate": "Jun 7, 2017 9:20:13 PM",
"lastOpDate": "Jun 7, 2017 9:20:13 PM",
"state": "Enabled"
}
}| 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 |
| cpuNum | Integer | The CPU count. | 0.6 |
| cpuSpeed | Integer | The CPU speed. | 0.6 |
| memorySize | Long | The memory size. | 0.6 |
| type | String | The type. | 0.6 |
| allocatorStrategy | String | The allocator strategy. | 0.6 |
| sortKey | Integer | 0.6 | |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
| state | String | The state, including Enabled and Disabled. | 0.6 |
SDK Sample
CreateVirtualRouterOfferingAction action = new CreateVirtualRouterOfferingAction();
action.zoneUuid = "389c6a48c332450ea280933b34e61ac4";
action.managementNetworkUuid = "381c2166c0454d95aed829715ae294b8";
action.imageUuid = "a4da1399797145bc87e36b424e5336af";
action.publicNetworkUuid = "5bf6caac74304a489eda76ae64624f6b";
action.isDefault = true;
action.name = "VirtualRouter-Offering";
action.cpuNum = 2.0;
action.memorySize = 1024.0;
action.sortKey = 0.0;
action.type = "VirtualRouter";
action.sessionId = "b811bf42d0b541ea993787b1fa80e724";
CreateVirtualRouterOfferingAction.Result res = action.call();CreateVirtualRouterOfferingAction action = CreateVirtualRouterOfferingAction()
action.zoneUuid = "d115bed650ad45128aff5216c9f72d23"
action.managementNetworkUuid = "1b4f915b327d488db04c517b767e2731"
action.imageUuid = "737992cde79646ce915681b74e4c4de7"
action.publicNetworkUuid = "6af154a9cd274134ac44d2d889474158"
action.isDefault = true
action.name = "VirtualRouter-Offering"
action.cpuNum = 2.0
action.memorySize = 1024.0
action.sortKey = 0.0
action.type = "VirtualRouter"
action.sessionId = "71db629e6f484b3187c48ecb1d65dcea"
CreateVirtualRouterOfferingAction.Result res = action.call()QueryVirtualRouterOffering
API Request
GET zstack/v1/instance-offerings/virtual-routers
GET zstack/v1/instance-offerings/virtual-routers/{uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 94af029a0bed40d68dbabeff17f22add" \
-X GET http://localhost:8080/zstack/v1/instance-offerings/virtual-routerscurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth db0361e95b29493db9bc03cd35db6129" \
-X GET http://localhost:8080/zstack/v1/instance-offerings/virtual-routers/e422506307254250b817c4f7aa70f277Queryable Fields
You can check all queryable fields and resource names that can be queried across
tables by using zstack-cli, entering
QueryVirtualRouterOffering, and pressing the Tab
key.
API Response
{
"inventories": [
{
"managementNetworkUuid": "6d5e54344898416c9a20a104341c82d5",
"publicNetworkUuid": "c6a23a0ed6ad4337a35d8a946694f8ea",
"zoneUuid": "a12ffae2039847a8b9046478ad03fecd",
"isDefault": true,
"imageUuid": "ca56a16b15bb47c0a26055e28d1e621f",
"name": "VirtualRouter-Offering",
"cpuNum": 2.0,
"cpuSpeed": 1.0,
"memorySize": 1024.0,
"type": "VirtualRouter"
}
]
}| 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 |
|---|---|---|---|
| managementNetworkUuid | String | 0.6 | |
| publicNetworkUuid | String | 0.6 | |
| zoneUuid | String | The zone UUID. | 0.6 |
| isDefault | Boolean | 0.6 | |
| imageUuid | String | The image 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 |
| cpuNum | Integer | 0.6 | |
| cpuSpeed | Integer | 0.6 | |
| memorySize | Long | 0.6 | |
| type | String | 0.6 | |
| allocatorStrategy | String | 0.6 | |
| sortKey | Integer | 0.6 | |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
| state | String | 0.6 |
SDK Sample
QueryVirtualRouterOfferingAction action = new QueryVirtualRouterOfferingAction();
action.conditions = asList();
action.sessionId = "8779bc03a81d463bbebee36eedcc8197";
QueryVirtualRouterOfferingAction.Result res = action.call();QueryVirtualRouterOfferingAction action = QueryVirtualRouterOfferingAction()
action.conditions = []
action.sessionId = "ec9a74a6c42241fb95575a9ba79c6fa6"
QueryVirtualRouterOfferingAction.Result res = action.call()UpdateVirtualRouterOffering
API Request
PUT zstack/v1/instance-offerings/virtual-routers/{uuid}/actionsAuthorization: OAuth the-session-uuid{
"updateVirtualRouterOffering": {
"isDefault": 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 PUT -d '{"updateVirtualRouterOffering":{"isDefault":false}}' \
http://localhost:8080/zstack/v1/instance-offerings/virtual-routers/46a68145223e3c4fb25b5de2b12e43c2/actions| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| isDefault | Boolean | body (contained in the updateVirtualRouterOffering structure) | Optional. Whether the vRouter offering is the default offering. | 0.6 | |
| imageUuid | String | body (contained in the updateVirtualRouterOffering structure) | Optional. The image UUID. | 0.6 | |
| uuid | String | url | The resource UUID. | 0.6 | |
| name | String | body (contained in the updateVirtualRouterOffering structure) | Optional. The resource name. | 0.6 | |
| description | String | body (contained in the updateVirtualRouterOffering structure) | Optional. The detailed description of the resource. | 0.6 | |
| systemTags | List | body | Optional. The system tags. | 0.6 | |
| userTags | List | body | Optional. The user tags. | 0.6 | |
| allocatorStrategy | String | body (contained in the updateVirtualRouterOffering structure) | Optional. The allocator strategy. |
|
2.3 |
API Response
{
"inventory": {
"uuid": "99395ef3a9083f7ba2d64201d6afc6b0",
"name": "instanceOffering1",
"cpuNum": 2.0,
"cpuSpeed": 1.0,
"type": "UserVm",
"allocatorStrategy": "Mevoco",
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM",
"state": "Enabled"
}
}| 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 |
| cpuNum | Integer | The CPU count. | 0.6 |
| cpuSpeed | Integer | The CPU speed. | 0.6 |
| memorySize | Long | The memory size. | 0.6 |
| type | String | The type. | 0.6 |
| allocatorStrategy | String | The allocator strategy. | 0.6 |
| sortKey | Integer | 0.6 | |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
| state | String | The state, including Enabled and Disabled. | 0.6 |
SDK Sample
UpdateVirtualRouterOfferingAction action = new UpdateVirtualRouterOfferingAction();
action.isDefault = false;
action.uuid = "46a68145223e3c4fb25b5de2b12e43c2";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateVirtualRouterOfferingAction.Result res = action.call();UpdateVirtualRouterOfferingAction action = UpdateVirtualRouterOfferingAction()
action.isDefault = false
action.uuid = "46a68145223e3c4fb25b5de2b12e43c2"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateVirtualRouterOfferingAction.Result res = action.call()GetAttachablePublicL3ForVRouter
API Request
GET zstack/v1/vm-instances/appliances/virtual-routers/{vmInstanceUuid}/attachable-public-l3sAuthorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 15085fa6b94f46c1bd4bb4f6b69aa092" \
-X GET http://localhost:8080/zstack/v1/vm-instances/appliances/virtual-routers/ac547d8a596c45ca864cd53235499c18/attachable-public-l3s| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| vmInstanceUuid | String | url | The vRouter UUID. | 2.2 | |
| systemTags | List | query | Optional. The system tags. | 2.2 | |
| userTags | List | query | Optional. The user tags. | 2.2 |
API Response
{
"inventories": [
{
"uuid": "03108cd5c1c9427ea954fe35e8ae6811",
"name": "test-pub-l3",
"description": "test pub l3",
"zoneUuid": "a18dc0e9dc054349af6adeda2efd17f0",
"l2NetworkUuid": "e1791fb069554a69b05caf77d6d900a7",
"system": true,
"createDate": "Sep 29, 2017 2:41:24 PM",
"lastOpDate": "Sep 29, 2017 2:41:24 PM",
"ipRanges": [
{
"l3NetworkUuid": "3c26ee27f6e549b9974535ab1e04ad33",
"name": "test ip range",
"startIp": "100.64.0.10",
"endIp": "100.64.0.100",
"netmask": "255.255.255.0",
"gateway": "100.64.0.1",
"networkCidr": "100.64.0.0/24",
"createDate": "Sep 29, 2017 2:41:24 PM",
"lastOpDate": "Sep 29, 2017 2:41:24 PM"
}
]
}
]
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 2.2 |
| inventories | List | See inventories. | 2.2 |
| 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.2 |
| description | String | The brief description of the error. | 2.2 |
| details | String | The details about the error. | 2.2 |
| elaboration | String | The reserved field. Default value: null. | 2.2 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 2.2 |
| 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.2 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 2.2 |
| name | String | The resource name. | 2.2 |
| description | String | The detailed description of the resource. | 2.2 |
| type | String | 2.2 | |
| zoneUuid | String | The zone UUID. | 2.2 |
| l2NetworkUuid | String | The L2 network UUID. | 2.2 |
| state | String | 2.2 | |
| dnsDomain | String | 2.2 | |
| system | Boolean | 2.2 | |
| category | String | 2.2 | |
| createDate | Timestamp | The creation date. | 2.2 |
| lastOpDate | Timestamp | The last operation date. | 2.2 |
| dns | List | 2.2 | |
| ipRanges | List | See ipRanges. | 2.2 |
| networkServices | List | See networkServices. | 2.2 |
| hostRoute | List | See hostRoute. | 2.3 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 2.2 |
| l3NetworkUuid | String | The L3 network UUID. | 2.2 |
| name | String | The resource name. | 2.2 |
| description | String | The detailed description of the resource. | 2.2 |
| startIp | String | 2.2 | |
| endIp | String | 2.2 | |
| netmask | String | 2.2 | |
| gateway | String | 2.2 | |
| networkCidr | String | 2.2 | |
| createDate | Timestamp | The creation date. | 2.2 |
| lastOpDate | Timestamp | The last operation date. | 2.2 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| l3NetworkUuid | String | The L3 network UUID. | 2.2 |
| networkServiceProviderUuid | String | The network service provider UUID. | 2.2 |
| networkServiceType | String | 2.2 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| id | Long | 2.3 | |
| l3NetworkUuid | String | The L3 network UUID. | 2.3 |
| prefix | String | 2.3 | |
| nexthop | String | 2.3 | |
| createDate | Timestamp | The creation date. | 2.3 |
| lastOpDate | Timestamp | The last operation date. | 2.3 |
SDK Sample
GetAttachablePublicL3ForVRouterAction action = new GetAttachablePublicL3ForVRouterAction();
action.vmInstanceUuid = "851b21ed7425479daf3783b886f6ab35";
action.sessionId = "8f1a0a142f514a49849df351c40d6116";
GetAttachablePublicL3ForVRouterAction.Result res = action.call();GetAttachablePublicL3ForVRouterAction action = GetAttachablePublicL3ForVRouterAction()
action.vmInstanceUuid = "f78e670c912447b68dcae9a6af79617c"
action.sessionId = "99e6b06b41ff4d16bb2c2b11e4e3a7bb"
GetAttachablePublicL3ForVRouterAction.Result res = action.call()vRouter Route Table Operations
CreateVRouterRouteTable
API Request
POST zstack/v1/vrouter-route-tablesAuthorization: OAuth the-session-uuid{
"params": {
"name": "Test-VRouterRouteTable",
"description": "Test-VRouterRouteTable"
},
"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-VRouterRouteTable","description":"Test-VRouterRouteTable"}}' \
http://localhost:8080/zstack/v1/vrouter-route-tables| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| name | String | body (contained in the params structure) | The resource name. | 2.1 | |
| description | String | body (contained in the params structure) | Optional. The detailed description of the resource. | 2.1 | |
| resourceUuid | String | body (contained in the params structure) | Optional. The resource UUID. | 2.1 | |
| systemTags | List | body | Optional. The system tags. | 2.1 | |
| userTags | List | body | Optional. The user tags. | 2.1 |
API Response
{
"inventory": {
"name": "test-route-table",
"description": "Test route table",
"attachedRouterRefs": [],
"routeEntries": []
}
}| 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 |
|---|---|---|---|
| uuid | String | The resource UUID. | 2.1 |
| name | String | The resource name. | 2.1 |
| description | String | The detailed description of the resource. | 2.1 |
| createDate | Timestamp | The creation date. | 2.1 |
| lastOpDate | Timestamp | The last operation date. | 2.1 |
| attachedRouterRefs | List | See attachedRouterRefs. | 2.1 |
| routeEntries | List | See routeEntries. | 2.1 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| virtualRouterVmUuid | String | 2.1 | |
| routeTableUuid | String | 2.1 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 2.1 |
| description | String | The detailed description of the resource. | 2.1 |
| type | String | The type.
|
2.1 |
| routeTableUuid | String | The vRouter route table UUID. | 2.1 |
| destination | String | The destination network address. | 2.1 |
| target | String | The next hop address.
|
2.1 |
| distance | Integer | The route priority. In the minimum match mode, if multiple route rules are available, the rule with the lowest integer has the highest priority to be matched. | 2.1 |
| createDate | Timestamp | The creation date. | 2.1 |
| lastOpDate | Timestamp | The last operation date. | 2.1 |
SDK Sample
CreateVRouterRouteTableAction action = new CreateVRouterRouteTableAction();
action.name = "Test-VRouterRouteTable";
action.description = "Test-VRouterRouteTable";
action.sessionId = "36ae8b4476774bbd819b694d466f5351";
CreateVRouterRouteTableAction.Result res = action.call();CreateVRouterRouteTableAction action = CreateVRouterRouteTableAction()
action.name = "Test-VRouterRouteTable"
action.description = "Test-VRouterRouteTable"
action.sessionId = "c68d30a1ccc9487381ea5ec872cfcced"
CreateVRouterRouteTableAction.Result res = action.call()DeleteVRouterRouteTable
API Request
DELETE zstack/v1/vrouter-route-tables/{uuid}?deleteMode={deleteMode}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth c92c3c7cf7c64dac9e783ab3414e7901" \
-X DELETE http://localhost:8080/zstack/v1/vrouter-route-tables/865cd01ad01f4c46b0a63163eb13e20b?deleteMode=Permissive| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The resource UUID. | 2.1 | |
| deleteMode | String | url | Optional. The delete mode. | 2.1 | |
| systemTags | List | body | Optional. The system tags. | 2.1 | |
| userTags | 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
DeleteVRouterRouteTableAction action = new DeleteVRouterRouteTableAction();
action.uuid = "fb0b9186685544bcb5af032b1426736a";
action.deleteMode = "Permissive";
action.sessionId = "aa1c19e2398949c99132c47e97f11569";
DeleteVRouterRouteTableAction.Result res = action.call();DeleteVRouterRouteTableAction action = DeleteVRouterRouteTableAction()
action.uuid = "dcf18f99774046de99d5791bfba27b35"
action.deleteMode = "Permissive"
action.sessionId = "c2345a70fb6b4ffabc717ca555e60782"
DeleteVRouterRouteTableAction.Result res = action.call()QueryVRouterRouteTable
API Request
GET zstack/v1/vrouter-route-tablesAuthorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 48eaf58e3b6e4c51a56c8d9caa991311" \
-X GET http://localhost:8080/zstack/v1/vrouter-route-tablescurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 20f83215e3bf491782fe7646a42b5c8b" \
-X GET http://localhost:8080/zstack/v1/vrouter-route-tables/3b8991d7295a4cccb08d028911a9164bQueryable Fields
You can check all queryable fields and resource names that can be queried across
tables by using zstack-cli, entering
QueryVRouterRouteTable, and pressing the Tab key.
API Response
{} 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
QueryVRouterRouteTableAction action = new QueryVRouterRouteTableAction();
action.conditions = asList();
action.sessionId = "1e7d262944584f57a8908c9acd1ec62f";
QueryVRouterRouteTableAction.Result res = action.call();QueryVRouterRouteTableAction action = QueryVRouterRouteTableAction()
action.conditions = []
action.sessionId = "6ad6d8b304984d3ba5b64ddd2062efcb"
QueryVRouterRouteTableAction.Result res = action.call()GetVRouterRouteTable
API Request
GET zstack/v1/vrouter-route-tables/vrouter/{virtualRouterVmUuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth ef1c95285ef3435c949854955edc6c66" \
-X GET http://localhost:8080/zstack/v1/vrouter-route-tables/vrouter/27e810f019b74106877814ddb0c6e3bf| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| virtualRouterVmUuid | String | url | The VM instance UUID. | 2.1 | |
| systemTags | List | query | Optional. The system tags. | 2.1 | |
| userTags | List | query | Optional. The user tags. | 2.1 |
API Response
{
"inventories": [
{
"type": "ZStack"
"destination": "0.0.0.0/0"
"target": "100.64.201.1"
"status": "selected"
},
{
"uuid": "7b86eaba601c4ceda5987036c9ea7981"
"type": "UserStatic"
"destination": "100.64.0.0/24"
"target": "100.64.201.10"
"distance": "128"
"status": "selected"
},
{
"uuid": "d15ebfe03aec49e6a0453e74eede350d"
"type": "UserStatic"
"destination": "100.64.0.0/24"
"target": "100.64.201.11"
"distance": "128"
"status": "active"
},
{
"type": "ZStack"
"destination": "10.0.57.94/32"
"target": "eth0"
},
{
"uuid": "50e6070313fa4a05b17907a32be0a63f"
"type": "UserStatic"
"destination": "10.0.57.94/32"
"target": "100.64.201.12"
"distance": "1"
"status": "inactive"
},
{
"type": "DirectConnect"
"destination": "192.168.197.0/24"
"target": "eth1"
"status": "selected"
},
{
"uuid": "6b446d5cf776471c913582ab30bd6340"
"type": "DirectConnect"
"destination": "192.168.197.0/24"
"target": "100.64.201.13"
"distance": "1"
"status": "inactive"
},
{
"uuid": "0aad7115c1f94aa1bf5db1a4d6d3fd17"
"type": "UserBlackHole"
"destination": "192.168.198.0/24"
"distance": "1"
"status": "selected"
},
]
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 2.1 |
| inventories | List | See inventories. | 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 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 2.1 |
| description | String | The detailed description of the resource. | 2.1 |
| type | String | The type. The UserStatic and UserBlackHole types can be added by users. The ZStack type is added by the system. The DirectConnect type means the directly connected route. | 2.1 |
| destination | String | The destination network address. | 2.1 |
| target | String | The next hop address or NIC. | 2.1 |
| distance | Integer | The route priority. In the minimum match mode, if multiple route rules are available, the rule with the lowest integer has the highest priority to be matched. | 2.1 |
| status | String | The route status. Options:
|
2.1 |
SDK Sample
GetVRouterRouteTableAction action = new GetVRouterRouteTableAction();
action.virtualRouterVmUuid = "dfa2698bd9f04cd5be56e5b51826359d";
action.sessionId = "8fbf06a3245a42fc99ef63f618364de7";
GetVRouterRouteTableAction.Result res = action.call();GetVRouterRouteTableAction action = GetVRouterRouteTableAction()
action.virtualRouterVmUuid = "1646d8ca4e144f63896c26488491e016"
action.sessionId = "161364959641477981aa68cd63b19348"
GetVRouterRouteTableAction.Result res = action.call()AddVRouterRouteEntry
API Request
POST zstack/v1/vrouter-route-tables/{routeTableUuid}/route-entriesAuthorization: OAuth the-session-uuid{
"params": {
"description": "Test route",
"type": "UserStatic",
"destination": "192.168.2.0/24",
"target": "172.20.1.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 POST -d '{"params":{"description":"Test route","type":"UserStatic","destination":"192.168.2.0/24","target":"172.20.1.1"}}' \
http://localhost:8080/zstack/v1/vrouter-route-tables/011e554588e93a849e890685d6adb6be/route-entries| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| description | String | body (contained in the params structure) | Optional. The detailed description of the resource. | 2.1 | |
| type | String | body (contained in the params structure) | Optional. The type.
|
|
2.1 |
| routeTableUuid | String | url | The vRouter route table UUID. | 2.1 | |
| destination | String | body (contained in the params structure) | The destination network address, in CIDR format. If you enter a non-standard CIDR, note that the system will automatically transform it to the standard CIDR format. | 2.1 | |
| target | String | body (contained in the params structure) | Optional. The next hop address.
|
2.1 | |
| distance | Integer | body (contained in the params structure) | Optional. The route priority. In the minimum match mode, if multiple route rules are available, the rule with the lowest integer has the highest priority to be matched. | 2.1 | |
| resourceUuid | String | body (contained in the params structure) | Optional. The resource UUID. | 2.1 | |
| systemTags | List | body | Optional. The system tags. | 2.1 | |
| userTags | List | body | Optional. The user tags. | 2.1 |
API Response
{
"inventory": {
"description": "Test route",
"type": "UserStatic",
"routeTableUuid": "5dad5ac78c3642088dc3ed6bc4d8c853",
"destination": "192.168.2.0/24",
"target": "172.20.1.1",
"distance": 128.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 |
|---|---|---|---|
| uuid | String | The resource UUID. | 2.1 |
| description | String | The detailed description of the resource. | 2.1 |
| type | String | The type. You can add two types of routes: static route and black hole route. The system will automatically determine the type by judging whether to enter the next hop. | 2.1 |
| routeTableUuid | String | The vRouter route table UUID. | 2.1 |
| destination | String | The destination network address. | 2.1 |
| target | String | The next hop address.
|
2.1 |
| distance | Integer | The route priority. In the minimum match mode, if multiple route rules are available, the rule with the lowest integer has the highest priority to be matched. | 2.1 |
| createDate | Timestamp | The creation date. | 2.1 |
| lastOpDate | Timestamp | The last operation date. | 2.1 |
SDK Sample
AddVRouterRouteEntryAction action = new AddVRouterRouteEntryAction();
action.description = "Test route";
action.type = "UserStatic";
action.routeTableUuid = "5c33ae47c7c94aaea08ead913ddfe0b4";
action.destination = "192.168.2.0/24";
action.target = "172.20.1.1";
action.sessionId = "f75a12a294fe4128b105e1d8f97257b3";
AddVRouterRouteEntryAction.Result res = action.call();AddVRouterRouteEntryAction action = AddVRouterRouteEntryAction()
action.description = "Test route"
action.type = "UserStatic"
action.routeTableUuid = "4fab7c04998c44b4b6d2bc4da0b35ddb"
action.destination = "192.168.2.0/24"
action.target = "172.20.1.1"
action.sessionId = "1510b167ddf54461b69e41802ddcf5eb"
AddVRouterRouteEntryAction.Result res = action.call()DeleteVRouterRouteEntry
API Request
DELETE zstack/v1/vrouter-route-tables/{routeTableUuid}/route-entries/{uuid}?deleteMode={deleteMode}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 07ed3c114a7f4ca0a10861d448a8b973" \
-X DELETE http://localhost:8080/zstack/v1/vrouter-route-tables/a713099cca4c487e8ee46ed2ad798903/route-entries/44f6816c4c7444b9b93b11c385f2bb19?deleteMode=Permissive| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The resource UUID. | 2.1 | |
| routeTableUuid | String | url | 2.1 | ||
| deleteMode | String | url | Optional. The delete mode. | 2.1 | |
| systemTags | List | body | Optional. The system tags. | 2.1 | |
| userTags | 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
DeleteVRouterRouteEntryAction action = new DeleteVRouterRouteEntryAction();
action.uuid = "6cc2578afb134d03959feb8cd586de06";
action.routeTableUuid = "e9b7f623b59d4cb5832a0eef61fdc273";
action.deleteMode = "Permissive";
action.sessionId = "eeda6890b1a2428087ae1c3d5b8e1311";
DeleteVRouterRouteEntryAction.Result res = action.call();DeleteVRouterRouteEntryAction action = DeleteVRouterRouteEntryAction()
action.uuid = "eb9a0a4ab242430896d50be1a75c1c0d"
action.routeTableUuid = "295cbd7c2b1746ba9907eabecdb6cdf0"
action.deleteMode = "Permissive"
action.sessionId = "dd36b5ccb2444679820945da4ba4ebf3"
DeleteVRouterRouteEntryAction.Result res = action.call()QueryVRouterRouteEntry
API Request
GET zstack/v1/vrouter-route-tables/route-entriesAuthorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 0a9d413ce14245f89cde947aa57ae4c3" \
-X GET http://localhost:8080/zstack/v1/vrouter-route-tables/route-entriescurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth eb2e3203532b405cbe9c2fde23deb53e" \
-X GET http://localhost:8080/zstack/v1/vrouter-route-tables/route-entries/6c19d2d2bad3489f8b095c98fea971a5Queryable Fields
You can check all queryable fields and resource names that can be queried across
tables by using zstack-cli, entering
QueryVRouterRouteEntry, and pressing the Tab key.
API Response
{
"inventories": [
{
"description": "Test route",
"type": "UserStatic",
"routeTableUuid": "4b9b27aa14794f3c98f23818d8a4b281",
"destination": "192.168.2.0/24",
"target": "172.20.1.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. | 2.1 |
| inventories | List | See inventories. | 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 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 2.1 |
| description | String | The detailed description of the resource. | 2.1 |
| type | String | The type.
|
2.1 |
| routeTableUuid | String | The vRouter route table UUID. | 2.1 |
| destination | String | The destination network address. | 2.1 |
| target | String | The next hop address.
|
2.1 |
| distance | Integer | The route priority. In the minimum match mode, if multiple route rules are available, the rule with the lowest integer has the highest priority to be matched. | 2.1 |
| createDate | Timestamp | The creation date. | 2.1 |
| lastOpDate | Timestamp | The last operation date. | 2.1 |
SDK Sample
QueryVRouterRouteEntryAction action = new QueryVRouterRouteEntryAction();
action.conditions = asList();
action.sessionId = "4388bb850faf4cf69e13ecb9bbdcd77e";
QueryVRouterRouteEntryAction.Result res = action.call();QueryVRouterRouteEntryAction action = QueryVRouterRouteEntryAction()
action.conditions = []
action.sessionId = "116b877273e84748994435d8603423b4"
QueryVRouterRouteEntryAction.Result res = action.call()AttachVRouterRouteTableToVRouter
API Request
POST zstack/v1/vrouter-route-tables/{routeTableUuid}/attachAuthorization: OAuth the-session-uuid{
"params": {
"virtualRouterVmUuid": "49e427183ffe4dd8b7c40a635f11f71b"
},
"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":{"virtualRouterVmUuid":"2b8bbccba54438e994d4d14d570a1807"}}' \
http://localhost:8080/zstack/v1/vrouter-route-tables/ee1fc77524993a60a8c0e4b7245470db/attach| Name | Type | Location | Description | Optional Value | Description |
|---|---|---|---|---|---|
| routeTableUuid | String | url | 2.1 | ||
| virtualRouterVmUuid | String | body (contained in the params structure) | The VM instance UUID. | 2.1 | |
| systemTags | List | body | Optional. The system tags. | 2.1 | |
| userTags | List | body | Optional. The user tags. | 2.1 |
API Response
Sample Response
{
"inventory": {
"name": "test-route-table",
"description": "Test route table",
"attachedRouterRefs": [],
"routeEntries": []
}
}
| Name | Type | Description | Description |
|---|---|---|---|
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 2.1 |
| inventory | VRouterRouteTableInventory | See inventory. | 2.1 |
| Name | Type | Description | Description |
|---|---|---|---|
| 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 | Description |
|---|---|---|---|
| uuid | String | The resource UUID. | 2.1 |
| name | String | The resource name. | 2.1 |
| description | String | The detailed description of the resource. | 2.1 |
| createDate | Timestamp | The creation date. | 2.1 |
| lastOpDate | Timestamp | The last operation date. | 2.1 |
| attachedRouterRefs | List | See attachedRouterRefs. | 2.1 |
| routeEntries | List | See routeEntries. | 2.1 |
| Name | Type | Description | Description |
|---|---|---|---|
| virtualRouterVmUuid | String | 2.1 | |
| routeTableUuid | String | 2.1 |
| Name | Type | Description | Description |
|---|---|---|---|
| uuid | String | The resource UUID. | 2.1 |
| description | String | The detailed description of the resource. | 2.1 |
| type | String | The type.
|
2.1 |
| routeTableUuid | String | The vRouter route table UUID. | 2.1 |
| destination | String | The destination network address. | 2.1 |
| target | String | The next hop address.
|
2.1 |
| distance | Integer | The route priority. In the minimum match mode, if multiple route rules are available, the rule with the lowest integer has the highest priority to be matched. | 2.1 |
| createDate | Timestamp | The creation date. | 2.1 |
| lastOpDate | Timestamp | The last operation date. | 2.1 |
SDK Sample
Java SDK
AttachVRouterRouteTableToVRouterAction action = new AttachVRouterRouteTableToVRouterAction();
action.routeTableUuid = "9d77dce987404000a00dd64594863e32";
action.virtualRouterVmUuid = "bfb7963808fa4d64b94cbbc8eb593398";
action.sessionId = "48e036e5881d41fa9070d2b6aa75c7ee";
AttachVRouterRouteTableToVRouterAction.Result res = action.call();
AttachVRouterRouteTableToVRouterAction action = AttachVRouterRouteTableToVRouterAction()
action.routeTableUuid = "0afcb79f56f74b1a96cce814362f861f"
action.virtualRouterVmUuid = "611126cb62094da4b6023824f0f2d0c9"
action.sessionId = "56fd37c6dff343948028d9b826ea4b10"
AttachVRouterRouteTableToVRouterAction.Result res = action.call()DetachVRouterRouteTableFromVRouter
API Request
DELETE zstack/v1/vrouter-route-tables/{routeTableUuid}/detach/{virtualRouterVmUuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/vrouter-route-tables/2ef92879139f36e291314bed861a0cc7/detach/50391e085c803988a3fa27e210834a16| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| routeTableUuid | String | url | The vRouter route table UUID. | 2.1 | |
| virtualRouterVmUuid | String | url | The vRouter table device UUID. | 2.1 | |
| systemTags | List | body | Optional. The system tags. | 2.1 | |
| userTags | List | body | Optional. The user tags. | 2.1 |
API Response
{
"inventory": {
"name": "test-route-table",
"description": "Test route table",
"attachedRouterRefs": [],
"routeEntries": []
}
}| 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 |
|---|---|---|---|
| uuid | String | The resource UUID. | 2.1 |
| name | String | The resource name. | 2.1 |
| description | String | The detailed description of the resource. | 2.1 |
| createDate | Timestamp | The creation date. | 2.1 |
| lastOpDate | Timestamp | The last operation date. | 2.1 |
| attachedRouterRefs | List | See attachedRouterRefs. | 2.1 |
| routeEntries | List | See routeEntries. | 2.1 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| virtualRouterVmUuid | String | 2.1 | |
| routeTableUuid | String | 2.1 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 2.1 |
| description | String | The detailed description of the resource. | 2.1 |
| type | String | The type.
|
2.1 |
| routeTableUuid | String | The vRouter route table UUID. | 2.1 |
| destination | String | The destination network address. | 2.1 |
| target | String | The next hop address.
|
2.1 |
| distance | Integer | The route priority. In the minimum match mode, if multiple route rules are available, the rule with the lowest integer has the highest priority to be matched. | 2.1 |
| createDate | Timestamp | The creation date. | 2.1 |
| lastOpDate | Timestamp | The last operation date. | 2.1 |
SDK Sample
Java SDK
DetachVRouterRouteTableFromVRouterAction action = new DetachVRouterRouteTableFromVRouterAction();
action.routeTableUuid = "c157be1c2fac4806bd0e1ce04087a9b5";
action.virtualRouterVmUuid = "b844d0085c544aecb9a1c49e6c0fa4e9";
action.sessionId = "7299252a24404d92a5ee621ea5a2e6df";
DetachVRouterRouteTableFromVRouterAction.Result res = action.call();
DetachVRouterRouteTableFromVRouterAction action = DetachVRouterRouteTableFromVRouterAction()
action.routeTableUuid = "a7bece0ef6e04218af583d0d20078ec2"
action.virtualRouterVmUuid = "06a9a546ec6f4395b46fe5704f476ca2"
action.sessionId = "6923e611467343a3ad2f4c47163ad4bd"
DetachVRouterRouteTableFromVRouterAction.Result res = action.call()QueryVirtualRouterVRouterRouteTableRef
API Request
GET zstack/v1/vrouter-route-tables/virtual-router-refsAuthorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 735e8b68e40442659dac22fc30d7774b" \
-X GET http://localhost:8080/zstack/v1/vrouter-route-tables/virtual-router-refsQueryable Fields
You can check all queryable fields and resource names that can be queried across
tables by using zstack-cli, entering
QueryVirtualRouterVRouterRouteTableRef, and pressing the
Tab key.
API Response
{
"inventories": [
{
"virtualRouterVmUuid": "ebec6ece12504916a12f13441282bb67",
"routeTableUuid": "fbf34e1fc6924ff3ba4c338435dd8e61"
}
]
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 2.1 |
| inventories | List | See inventories. | 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 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| virtualRouterVmUuid | String | 2.1 | |
| routeTableUuid | String | 2.1 |
SDK Sample
QueryVirtualRouterVRouterRouteTableRefAction action = new QueryVirtualRouterVRouterRouteTableRefAction();
action.conditions = asList();
action.sessionId = "ec7b3e5724604965a1dcf3c7eb58a7c1";
QueryVirtualRouterVRouterRouteTableRefAction.Result res = action.call();QueryVirtualRouterVRouterRouteTableRefAction action = QueryVirtualRouterVRouterRouteTableRefAction()
action.conditions = []
action.sessionId = "b2ca8cc84dae431e95cff3e95ace26c1"
QueryVirtualRouterVRouterRouteTableRefAction.Result res = action.call()