CreateVpcVRouter

API Request

URLs
POST zstack/v1/vpc/virtual-routers
Headers
Authorization: OAuth the-session-uuid
Body
{   "params": {     "name": "TestVPC",     "virtualRouterOfferingUuid": "d9a495f730564ce58328dbfdb1d05721",     "description": "this is a vpc for test"   },   "systemTags": [],   "userTags": [] }
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \ -H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \ -X POST -d '{"params":{"name":"TestVPC","virtualRouterOfferingUuid":"81e8c1f14a6e352884e6941c4a2de95a","description":"this is a vpc for test"}}' \ http://localhost:8080/zstack/v1/vpc/virtual-routers
Request Parameters
Name Type Location Description Optional Value Starting Version
name String body (contained in the params structure) The resource name. 2.3
virtualRouterOfferingUuid String body (contained in the params structure) The vRouter offering UUID. 2.3
description String body (contained in the params structure) Optional. The detailed description of the resource. 2.3
resourceUuid String body (contained in the params structure) Optional. The resource UUID. 2.3
systemTags List body Optional. The system tags. 2.3
userTags List body Optional. The user tags. 2.3
Note:
  • When you create a VPC vRouter in ZStack, the cloud records whether the VPC vRouter is added to an HA group. Note that you can add the haUuid option to SystemTags.
    • Format of the haUuid option: haUuid::HA_GROUP_UUID
    • Example: haUuid::e2af8f869eff49d2a3d6f86cadc27090
  • When you create a VPC vRouter in ZStack, you can specify a public IP by adding the staticVip option to SystemTags.
    • Format of the staticVip option: staticVip::L3UUID::IP. Here, L3UUID is the L3 public network UUID in the vRouter offering, and IP is the public IP address that you specified.
    • Example: staticVip::4ed5cce4f55a43aca8e61ebbc0c3985d::172.20.1.1

API Response

Sample Response
{   "inventory": {     "applianceVmType": "vpcvrouter",     "managementNetworkUuid": "a01fad3eb1d14bd787b8830e1d287ee3",     "status": "Connected",     "agentPort": 7272.0,     "uuid": "4de286dcb34343a0b5dedaea96307c06",     "name": "TestVPC",     "description": "this is a vpc for test",     "zoneUuid": "88634bc51a1345b98058c1827999bd75",     "clusterUuid": "5ebca05bc3cf4d5b970ddb32b10455c0",     "imageUuid": "490043dfeb814b119f0f6c264ed6bb1e",     "hostUuid": "a19572ae4fcc4b7d8a090d06c99067fa",     "lastHostUuid": "d374797d2d01495cb4dedd9e452909d0",     "instanceOfferingUuid": "8fcc3c2b5e1b41e586ed07ffece475e4",     "rootVolumeUuid": "ed5b232109f64f0dbe3342ffa8924d14",     "platform": "Linux",     "defaultL3NetworkUuid": "2aedc4cd00f8495f8fc08c991dd7be4c",     "type": "ApplianceVm",     "hypervisorType": "KVM",     "memorySize": 8.589934592E9,     "cpuNum": 4.0,     "allocatorStrategy": "LastHostPreferredAllocatorStrategy",     "createDate": "Nov 9, 2017 4:20:39 PM",     "lastOpDate": "Nov 9, 2017 4:20:39 PM",     "state": "Running",     "vmNics": [       {         "uuid": "6c8b46eec225440bb7179b6c797937ed",         "vmInstanceUuid": "4de286dcb34343a0b5dedaea96307c06",         "usedIpUuid": "033b876b861f4b9abaf594a893c1c94f",         "l3NetworkUuid": "49e2d31895c94bf0808372360ebcae31",         "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": "Nov 9, 2017 4:20:39 PM",         "lastOpDate": "Nov 9, 2017 4:20:39 PM"       }     ],     "allVolumes": [       {         "uuid": "ed5b232109f64f0dbe3342ffa8924d14",         "name": "Root-Volume-For-VM-4de286dcb34343a0b5dedaea96307c06",         "primaryStorageUuid": "c3f1cbaf9b014c1d8989ff940ed5593a",         "vmInstanceUuid": "4de286dcb34343a0b5dedaea96307c06",         "diskOfferingUuid": "93bfd802ebea486ab4ce071967235b76",         "rootImageUuid": "490043dfeb814b119f0f6c264ed6bb1e",         "installPath": "/zstack_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-ed5b232109f64f0dbe3342ffa8924d14/ed5b232109f64f0dbe3342ffa8924d14.qcow2",         "type": "Root",         "format": "qcow2",         "size": 1.073741824E11,         "actualSize": 2.147483648E10,         "deviceId": 0.0,         "state": "Enabled",         "status": "Ready",         "createDate": "Nov 9, 2017 4:20:39 PM",         "lastOpDate": "Nov 9, 2017 4: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. 2.3
inventory VmInstanceInventory See inventory. 2.3
#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. 2.3
description String The brief description of the error. 2.3
details String The details about the error. 2.3
elaboration String The reserved field. Default value: null. 2.3
opaque LinkedHashMap The reserved field. Default value: null. 2.3
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.3
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 2.3
name String The resource name. 2.3
description String The detailed description of the resource. 2.3
zoneUuid String The zone UUID. 2.3
clusterUuid String The cluster UUID. 2.3
imageUuid String The image UUID. 2.3
hostUuid String The host UUID. 2.3
lastHostUuid String The UUID of the host where the vRouter VM instance was running last time. 2.3
instanceOfferingUuid String The instance offering UUID. 2.3
rootVolumeUuid String The root volume UUID. 2.3
platform String The operating platform of the vRouter device. 2.3
defaultL3NetworkUuid String The default L3 network UUID. 2.3
type String The vRouter device type. 2.3
hypervisorType String The hypervisor type of the vRouter device. 2.3
memorySize Long The memory size. 2.3
cpuNum Integer The CPU count. 2.3
cpuSpeed Long The CPU speed. 2.3
allocatorStrategy String The allocator strategy. 2.3
createDate Timestamp The creation date. 2.3
lastOpDate Timestamp The last operation date. 2.3
state String Thea state of the vRouter device. 2.3
vmNics List See vmNics. 2.3
allVolumes List See allVolumes. 2.3
#vmNics
Name Type Description Starting Version
uuid String The resource UUID. 2.3
vmInstanceUuid String The VM instance UUID. 2.3
l3NetworkUuid String The L3 network UUID. 2.3
ip String The IP address. 2.3
mac String The MAC address. 2.3
netmask String The netmask. 2.3
gateway String The gateway. 2.3
metaData String The reserved field for internal use. 2.3
deviceId Integer The device ID.
  • Indicates the sequence (an integer) of the NIC on the Ethernet device of the guest operating system.
  • For example, 0 means eth0, while 1 means eth1.
2.3
createDate Timestamp The creation date. 2.3
lastOpDate Timestamp The last operation date. 2.3
#allVolumes
Name Type Description Starting Version
uuid String The resource UUID. 2.3
name String The resource name. 2.3
description String The detailed description of the resource. 2.3
primaryStorageUuid String The primary storage UUID. 2.3
vmInstanceUuid String The VM instance UUID. 2.3
diskOfferingUuid String The disk offering UUID. 2.3
rootImageUuid String The root image UUID. 2.3
installPath String The installation path. 2.3
type String The volume type. 2.3
format String The volume format. 2.3
size Long The virtual size of the volume. 2.3
actualSize Long The actual size of the volume. 2.3
deviceId Integer The device ID. 2.3
state String The state of the volume. 2.3
status String The status of the volume. 2.3
createDate Timestamp The creation date. 2.3
lastOpDate Timestamp The last operation date. 2.3
isShareable Boolean Whether the volume is shareable. 2.3

SDK Sample

Java SDK
CreateVpcVRouterAction action = new CreateVpcVRouterAction(); action.name = "TestVPC"; action.virtualRouterOfferingUuid = "c9cfb57035294ff4abeb400922f50d09"; action.description = "this is a vpc for test"; action.sessionId = "41652c67906143948e1fecc1054b65bd"; CreateVpcVRouterAction.Result res = action.call();
Python SDK
CreateVpcVRouterAction action = CreateVpcVRouterAction() action.name = "TestVPC" action.virtualRouterOfferingUuid = "a7eaafd48945481fa2d9a35032b8770b" action.description = "this is a vpc for test" action.sessionId = "9d1cc409dd8b47d3aa4ead7bccf875f2" CreateVpcVRouterAction.Result res = action.call()

QueryVpcRouter

API Request

URLs
GET zstack/v1/vpc/virtual-routers GET zstack/v1/vpc/virtual-routers/{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/vpc/virtual-routers?q=name=vpcRouter
curl -H "Content-Type: application/json;charset=UTF-8" \ -H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \ -X GET http://localhost:8080/zstack/v1/vpc/virtual-routers/205d11a687d03b46852d4d24fc85ae75

Queryable Fields

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

API Response

Sample Response
{   "inventories": [     {       "dns": [         {           "vpcRouterUuid": "4183325c367d384a84458f89c35d62a8",           "dns": "8.8.8.8"         }       ],       "uuid": "4183325c367d384a84458f89c35d62a8",       "name": "Test-VM",       "description": "web server VM",       "zoneUuid": "77689ed989253db0bb5863b103e06ecd",       "clusterUuid": "7f124c177f1535cebca9b0a555998e8e",       "imageUuid": "9e0eaf2e7ea93bc0bfc9f22d3f7328cd",       "hostUuid": "72547613a0bf320caca7a149d99e3ed4",       "lastHostUuid": "9e54bc8261f6396db6c66eb8a76e246d",       "instanceOfferingUuid": "e115b1542d2e35c8b9fbb5afd9fd067c",       "rootVolumeUuid": "48afbfcc2d36391586f7b6b44df93712",       "platform": "Linux",       "defaultL3NetworkUuid": "70dc6311679638c0a1e323d583332463",       "type": "UserVm",       "hypervisorType": "KVM",       "memorySize": 8.589934592E9,       "cpuNum": 1.0,       "allocatorStrategy": "LastHostPreferredAllocatorStrategy",       "createDate": "Nov 14, 2017 10:20:57 PM",       "lastOpDate": "Nov 14, 2017 10:20:57 PM",       "state": "Running",       "vmNics": [         {           "uuid": "df1eae8361983c86a46d3d922ad0a6f4",           "vmInstanceUuid": "4183325c367d384a84458f89c35d62a8",           "usedIpUuid": "2bdc1a927ebb34f89a880d8aefc7c763",           "l3NetworkUuid": "70dc6311679638c0a1e323d583332463",           "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": "Nov 14, 2017 10:20:57 PM",           "lastOpDate": "Nov 14, 2017 10:20:57 PM"         }       ],       "allVolumes": [         {           "uuid": "48afbfcc2d36391586f7b6b44df93712",           "name": "Root-Volume-For-VM-4183325c367d384a84458f89c35d62a8",           "primaryStorageUuid": "a33d58803a2a307bb1762b9209e64ba2",           "vmInstanceUuid": "4183325c367d384a84458f89c35d62a8",           "diskOfferingUuid": "c762d59a3e6f36d89bff2ce3ea4b864c",           "rootImageUuid": "9e0eaf2e7ea93bc0bfc9f22d3f7328cd",           "installPath": "/zstack_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-48afbfcc2d36391586f7b6b44df93712/48afbfcc2d36391586f7b6b44df93712.qcow2",           "type": "Root",           "format": "qcow2",           "size": 1.073741824E11,           "actualSize": 2.147483648E10,           "deviceId": 0.0,           "state": "Enabled",           "status": "Ready",           "createDate": "Nov 14, 2017 10:20:57 PM",           "lastOpDate": "Nov 14, 2017 10:20:57 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
#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
publicNetworkUuid String 0.6
virtualRouterVips List 0.6
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
dns List See dns. 2.4
vmNics List See vmNics. 0.6
allVolumes List See allVolumes. 0.6
#dns
Name Type Description Starting Version
vpcRouterUuid String 2.4
dns String 2.4
createDate Timestamp The creation date. 2.4
lastOpDate Timestamp The last operation date. 2.4
#vmNics
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
#allVolumes
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

Java SDK
QueryVpcRouterAction action = new QueryVpcRouterAction(); action.conditions = asList("name=vpcRouter"); action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"; QueryVpcRouterAction.Result res = action.call();
Python SDK
QueryVpcRouterAction action = QueryVpcRouterAction() action.conditions = ["name=vpcRouter"] action.sessionId = "b86c9016b4f24953a9edefb53ca0678c" QueryVpcRouterAction.Result res = action.call()

GetAttachableVpcL3Network

API Request

URLs
POST zstack/v1/vpc/virtual-routers/{uuid}/attachable-vpc-l3s
Headers
Authorization: OAuth the-session-uuid
Body
{   "params": {},   "systemTags": [],   "userTags": [] }
Note: 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":{}}' http://localhost:8080/zstack/v1/vpc/virtual-routers/417478f0b61732408176f16615ab6d32/attachable-vpc-l3s
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 2.3
systemTags List body Optional. The system tags. 2.3
userTags List body Optional. The user tags. 2.3

API Response

Sample Response
{   "inventories": [     {       "uuid": "81c29ac529163ffa9d4f246d68518dd1",       "name": "test-l3",       "description": "test l3",       "type": "L3VpcNetwork",       "zoneUuid": "aea3c47aa8273399ac8827fbc78aae67",       "l2NetworkUuid": "cbba13d2e8273d529cfcb89c66d54fb2",       "system": false,       "category": "Private",       "createDate": "Nov 14, 2017 10:20:57 PM",       "lastOpDate": "Nov 14, 2017 10:20:57 PM",       "ipRanges": [         {           "l3NetworkUuid": "cc5980d5c4173dd5b57dc1b28cdb0683",           "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": "Nov 14, 2017 10:20:57 PM",           "lastOpDate": "Nov 14, 2017 10:20:57 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.3
inventories List See inventories. 2.3
#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. 2.3
description String The brief description of the error. 2.3
details String The details about the error. 2.3
elaboration String The reserved field. Default value: null. 2.3
opaque LinkedHashMap The reserved field. Default value: null. 2.3
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.3
#inventories
Name Type Description Starting Version
uuid String The resource UUID. 2.3
name String The resource name. 2.3
description String The detailed description of the resource. 2.3
type String The L3 network type. 2.3
zoneUuid String The zone UUID. 2.3
l2NetworkUuid String The L2 network UUID. 2.3
state String The state of the L3 network. 2.3
dnsDomain String The DNS domain. 2.3
system Boolean Whether the L3 network can be applied to appliance VM instances. 2.3
category String The network type, which must be used with the system tags. If system is set to true, this parameter can be set to Public or Private. 2.3
createDate Timestamp The creation date. 2.3
lastOpDate Timestamp The last operation date. 2.3
dns List The DNS server. 2.3
ipRanges List See ipRanges. 2.3
networkServices List See networkServices. 2.3
hostRoute List See hostRoute.
#ipRanges
Name Type Description Starting Version
uuid String The resource UUID. 2.3
l3NetworkUuid String The L3 network UUID. 2.3
name String The resource name. 2.3
description String The detailed description of the resource. 2.3
startIp String The start IP address. 2.3
endIp String The end IP address. 2.3
netmask String The netmask. 2.3
gateway String The gateway. 2.3
networkCidr String The network CIDR. 2.3
createDate Timestamp The creation date. 2.3
lastOpDate Timestamp The last operation date. 2.3
#networkServices
Name Type Description Starting Version
l3NetworkUuid String The L3 network UUID. 2.3
networkServiceProviderUuid String The network service provider UUID. 2.3
networkServiceType String The network service type. 2.3
#hostRoute
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

Java SDK
GetAttachableVpcL3NetworkAction action = new GetAttachableVpcL3NetworkAction(); action.uuid = "417478f0b61732408176f16615ab6d32"; action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"; GetAttachableVpcL3NetworkAction.Result res = action.call();
Python SDK
GetAttachableVpcL3NetworkAction action = GetAttachableVpcL3NetworkAction() action.uuid = "417478f0b61732408176f16615ab6d32" action.sessionId = "b86c9016b4f24953a9edefb53ca0678c" GetAttachableVpcL3NetworkAction.Result res = action.call()













Back to Top

Download

Already filled the basic info?Click here.

Enter at least 2 characters.
Invalid mobile number.
Enter at least 4 characters.
Invalid email address.
Wrong code. Try again. Send Code Resend Code (60s)

An email with a verification code will be sent to you. Make sure the address you provided is valid and correct.

Download

Not filled the basic info yet? Click here.

Invalid email address or mobile number.

Email Us

contact@zstack.io
ZStack Training and Certification
Enter at least 2 characters.
Invalid mobile number.
Enter at least 4 characters.
Invalid email address.
Wrong code. Try again. Send Code Resend Code (60s)

Email Us

contact@zstack.io
Request Trial
Enter at least 2 characters.
Invalid mobile number.
Enter at least 4 characters.
Invalid email address.
Wrong code. Try again. Send Code Resend Code (60s)

Email Us

contact@zstack.io

The download link is sent to your email address.

If you don't see it, check your spam folder, subscription folder, or AD folder. After receiving the email, click the URL to download the documentation.

The download link is sent to your email address.

If you don't see it, check your spam folder, subscription folder, or AD folder.
Or click on the URL below. (For Internet Explorer, right-click the URL and save it.)

Thank you for using ZStack products and services.

Submit successfully.

We'll connect soon.

Thank you for using ZStack products and services.