Reviewed-by: Sarda, Priya <prsarda@noreply.gitea.eco.tsi-dev.otc-service.com> Co-authored-by: Qin Ying, Fan <fanqinying@huawei.com> Co-committed-by: Qin Ying, Fan <fanqinying@huawei.com>
27 KiB
Creating a Subnet Pool
Function
This API is used to create a subnet pool.
URI
POST /v2.0/subnetpools
Request Message
Parameter |
Type |
Mandatory |
Description |
---|---|---|---|
subnetpool |
subnetpool object |
Yes |
Specifies the subnet pool list. For details, see Table 2. |
Attribute |
Mandatory |
Type |
Description |
---|---|---|---|
name |
Yes |
String |
Specifies the subnet pool name. |
default_quota |
No |
Integer |
Specifies the upper limit of the prefix space that can be allocated from the subnet pool to the subnet. For IPv4 subnet pools, default_quota is measured in units of /32. For IPv6 subnet pools, default_quota is measured in units of /64. |
prefixes |
Yes |
Array of strings |
Specifies a list of subnet prefixes that are assigned to the subnet pool. The adjacent prefixes are merged and treated as a single prefix. Each subnet prefix must be unique. |
min_prefixlen |
No |
Integer |
Specifies the minimum number for the prefix of a subnet that can be allocated from the subnet pool. The minimum number for the prefix of an IPv4 subnet is 8, and that of an IPv6 subnet is 64. Instructions: min_prefixlen =< default_prefixlen =< max_prefixlen |
default_prefixlen |
No |
Integer |
Specifies the default prefix to be allocated to a subnet if the cidr or prefixlen is not specified when you create the subnet. The default value is 8 for an IPv4 subnet and 64 for an IPv6 subnet. Instructions: min_prefixlen =< default_prefixlen =< max_prefixlen |
max_prefixlen |
No |
Integer |
Specifies the maximum number for the prefix of a subnet that can be allocated from the subnet pool. The maximum number for the prefix of an IPv4 subnet is 32, and that of an IPv6 subnet is 128. Instructions: min_prefixlen =< default_prefixlen =< max_prefixlen |
description |
No |
String |
Provides supplementary information about the subnet pool. |
is_default |
No |
Boolean |
Specifies whether this is the default subnet pool. |
Response Message
Parameter |
Type |
Description |
---|---|---|
subnetpool |
subnetpool object |
Specifies the subnet pool list. For details, see Table 4. |
Attribute |
Type |
Description |
---|---|---|
id |
String |
Specifies the subnet pool ID. This parameter is not mandatory when you query subnet pools. |
name |
String |
Specifies the subnet pool name. |
ip_version |
Integer |
Specifies the IP address version. The value can be 4 (IPv4) or 6 (IPv6). |
default_quota |
Integer |
Specifies the upper limit of the prefix space that can be allocated from the subnet pool to the subnet. For IPv4 subnet pools, default_quota is measured in units of /32. For IPv6 subnet pools, default_quota is measured in units of /64. |
project_id |
String |
Specifies the project ID. |
created_at |
String |
Specifies the time (UTC) when the subnet pool is created. Format: yyyy-MM-ddTHH:mm:ss |
updated_at |
String |
Specifies the time (UTC) when the subnet pool rule is updated. Format: yyyy-MM-ddTHH:mm:ss |
prefixes |
Array of strings |
Specifies a list of subnet prefixes that are assigned to the subnet pool. The adjacent prefixes are merged and treated as a single prefix. Each subnet prefix must be unique. |
min_prefixlen |
Integer |
Specifies the minimum number for the prefix of a subnet that can be allocated from the subnet pool. The minimum number for the prefix of an IPv4 subnet is 8, and that of an IPv6 subnet is 64. |
address_scope_id |
String |
Specifies the ID of the address range allocated to the subnet pool. Only the administrator can specify this attribute. |
shared |
Boolean |
Specifies whether the network can be shared to all projects. |
tenant_id |
String |
Specifies the project ID. |
default_prefixlen |
Integer |
Specifies the default prefix to be allocated to a subnet if the cidr or prefixlen is not specified when you create the subnet. The default value is 8 for an IPv4 subnet and 64 for an IPv6 subnet. |
max_prefixlen |
Integer |
Specifies the maximum number for the prefix of a subnet that can be allocated from the subnet pool. The maximum number for the prefix of an IPv4 subnet is 32, and that of an IPv6 subnet is 128. |
description |
String |
Provides supplementary information about the subnet pool. |
is_default |
Boolean |
Specifies whether this is the default subnet pool. |
tags |
Array of strings |
Specifies the tags. |
Example:
POST https://{Endpoint}/v2.0/subnetpools { "subnetpool": { "name": "my-subnet-pool", "prefixes": [ "192.168.0.0/16", "10.10.0.0/21" ], "default_prefixlen": 25, "min_prefixlen": 24, "max_prefixlen": 30, "shared": false } }
Example response
{ "subnetpool": { "address_scope_id": null, "default_prefixlen": 25, "default_quota": null, "description": "", "id": "f49a1319-423a-4ee6-ba54-1d95a4f6cc68", "ip_version": 4, "is_default": false, "max_prefixlen": 30, "min_prefixlen": 24, "name": "my-subnet-pool", "prefixes": [ "10.10.0.0/21", "192.168.0.0/16" ], "project_id": "9fadcee8aa7c40cdb2114fff7d569c08", "shared": false, "tenant_id": "9fadcee8aa7c40cdb2114fff7d569c08", "created_at": "2018-09-20T02:15:34", "updated_at": "2018-09-20T02:15:34", "tags": [] } }
Status Code
See Status Codes.
Error Code
See Error Codes.