创建子网
功能介绍
创建子网。
请求参数
名称 |
是否必选 |
参数类型 |
说明 |
---|---|---|---|
name |
是 |
String |
|
description |
否 |
String |
|
cidr |
是 |
String |
|
gateway_ip |
是 |
String |
|
ipv6_enable |
否 |
Boolean |
|
dhcp_enable |
否 |
Boolean |
|
primary_dns |
否 |
String |
|
secondary_dns |
否 |
String |
|
dnsList |
否 |
Array of strings |
|
availability_zone |
否 |
String |
|
vpc_id |
是 |
String |
子网所在VPC标识。 |
extra_dhcp_opts |
否 |
Array of extra_dhcp_opt objects |
子网配置的NTP地址,详情请参见extra_dhcp_opt对象。 |
请求示例
- 创建一个子网,所在vpc的id为3ec3b33f-ac1c-4630-ad1c-7dba1ed79d85,命名为subent,设置cidr为192.168.20.0/24,网关IP为192.168.20.1。
POST https://{Endpoint}/v1/{project_id}/subnets { "subnet": { "name": "subnet", "description": "", "cidr": "192.168.20.0/24", "gateway_ip": "192.168.20.1", "ipv6_enable": true, "dhcp_enable": true, "primary_dns": "114.xx.xx.114", "secondary_dns": "114.xx.xx.115", "dnsList": [ "114.xx.xx.114", "114.xx.xx.115" ], "vpc_id": "3ec3b33f-ac1c-4630-ad1c-7dba1ed79d85" } }
响应参数
名称 |
参数类型 |
说明 |
---|---|---|
id |
String |
uuid形式的一个资源标识 |
name |
String |
|
description |
String |
|
cidr |
String |
|
gateway_ip |
String |
|
ipv6_enable |
Boolean |
是否开启IPv6功能 |
cidr_v6 |
String |
IPv6子网的网段,如果子网为IPv4子网,则不返回此参数 |
gateway_ip_v6 |
String |
IPv6子网的网关,如果子网为IPv4子网,则不返回此参数 |
dhcp_enable |
Boolean |
子网是否开启dhcp功能 |
primary_dns |
String |
|
secondary_dns |
String |
|
dnsList |
Array of strings |
|
availability_zone |
String |
|
vpc_id |
String |
子网所在VPC标识 |
status |
String |
|
neutron_network_id |
String |
对应网络(OpenStack Neutron接口)id |
neutron_subnet_id |
String |
对应子网(OpenStack Neutron接口)id |
neutron_subnet_id_v6 |
String |
对应IPv6子网(OpenStack Neutron接口)id,如果子网为IPv4子网,则不返回此参数 |
extra_dhcp_opts |
Array of extra_dhcp_opt objects |
子网配置的NTP地址,详情请参见表7。 |
响应示例
{ "subnet": { "id": "4779ab1c-7c1a-44b1-a02e-93dfc361b32d", "name": "subnet", "description": "", "cidr": "192.168.20.0/24", "dnsList": [ "114.xx.xx.114", "114.xx.xx.115" ], "status": "UNKNOWN", "vpc_id": "3ec3b33f-ac1c-4630-ad1c-7dba1ed79d85", "gateway_ip": "192.168.20.1", "ipv6_enable": true, "cidr_v6": "2001:db8:a583::/64", "gateway_ip_v6": "2001:db8:a583::1", "dhcp_enable": true, "primary_dns": "114.xx.xx.114", "secondary_dns": "114.xx.xx.115", "availability_zone": "aa-bb-cc", "neutron_network_id": "4779ab1c-7c1a-44b1-a02e-93dfc361b32d", "neutron_subnet_id": "213cb9d-3122-2ac1-1a29-91ffc1231a12" "neutron_subnet_id_v6": "e0fa7de1-a6e2-44c9-b052-b9d8cebe93c4", } }
状态码
请参见状态码。
错误码
请参考错误码。