网络
列举网络
功能介绍
列出租户有权访问的网络。
除具有管理权限的用户提交列举子网的请求外,默认策略是只返回提交请求的用户所拥有的网络。
URI
GET /v2.0/networks
请求消息
无
响应消息
参数 | 参数类型 | 描述 |
---|---|---|
id | string | 网络ID。 |
tenant_id | string | 项目ID。 |
project_id | string | 项目ID。 |
name | string | 资源的人类可读名称。 |
admin_state_up | boolean | 该网络是否启动。 |
port_security_enabled | boolean | 该网络是否开启网络安全防护功能。如果使用安全组功能,此配置项一定为打开。 |
mtu | int | 该网络数据包最大传输单元大小。 |
shared | boolean | 该网络是否允许全资源池项目都可见。 |
router:external | boolean | 该网络是否为外部网络。 |
availability_zone_hints | array | 该网络的可用区候补选项。 |
availability_zones | array | 该网络的可用区。 |
subnets | array | 该网络的状态。 |
provider:network_type | string | 该网络的类型。例如flat、vlan、geneve。 |
provider:physical_network | string | 该网络的segment来自哪个物理网络。 |
provider:segmentation_id | string | 该网络的segmentation ID。 |
ipv4_address_scope | string | 该网络关联的ipv4地址scope。 |
status | string | 该网络的状态。 |
description | string | 该网络的自定义描述。 |
tags | array | 该网络的自定义标签。 |
updated_at | string | 该网络最新更新时间。 |
created_at | string | 该网络创建时间。 |
qos_policy_id | string | 该网络绑定的qos策略ID。 |
revision_number | int | 该网络的操作码。 |
ipv6_address_scope | string | 该网络关联的ipv6地址scope。 |
igmp_snooping | dict | 该网络的二层组播配置。enabled:是否开启二层组播 |
请求示例
GET http://{endpoint}/v2.0/networks
正常响应示例
{
"network": {
"id": "553f02e3-b0d0-4f9a-a818-42e0c82448ba",
"name": "test",
"tenant_id": "5608307e73d845918339684a78503e78",
"project_id": "5608307e73d845918339684a78503e78",
"admin_state_up": true,
"port_security_enabled": true,
"mtu": 1500,
"shared": false,
"router:external": false,
"availability_zone_hints": ["default-az"],
"availability_zones": ["default-az"],
"subnets": [
"0ce8208f-8c50-4a10-92e6-894edc025e2a",
"a6b9609c-aac5-4cf0-9IDc0c-45b247de6228"
],
"igmp_snooping":{
"enabled": true
},
"provider:network_type": "vlan",
"provider:physical_network": "physnet2",
"provider:segmentation_id": 1015,
"ipv4_address_scope": null,
"status": "ACTIVE",
"description": "",
"tags": [ ],
"updated_at": "2021-02-19T03:54:41Z",
"created_at": "2021-02-19T03:04:35Z",
"qos_policy_id": null,
"revision_number": 7,
"ipv6_address_scope": null
}
}
正常响应代码
200
错误码
401
创建网络
功能介绍
创建一个网络。
URI
POST /v2.0/networks
请求消息
参数 | 参数类型 | 是否必选 | Description |
---|---|---|---|
name | string | 是 | 该网络的名称。默认是一个空字符串。 |
project_id | string | 否 | 该网络所属的项目ID。 |
availability_zone_hints | array | 否 | 该网络所属的可用区候选。 |
availability_zones | array | 否 | 该网络所属的可用区。 |
shared | boolean | 否 | 该网络是否全局共享。 |
router:external | boolean | 否 | 该网络是否为外部网络。默认是内部网络。 |
provider:network_type | string | 否 | 该网络的类型。例如flat、vlan、geneve。 |
provider:physical_network | string | 否 | 该网络的segment来自哪个物理网络。 |
provider:segmentation_id | int | 否 | 该网络的segmentation ID。 |
subnets | array | 否 | 该网络中的子网。 |
tags | array | 否 | 该网络的标签。 |
igmp_snooping | dict | 否 | 该网络的二层组播配置。enabled:是否开启二层组播 |
响应消息
参数 | 参数类型 | 描述 |
---|---|---|
id | string | 网络ID。 |
tenant_id | string | 项目ID。 |
project_id | string | 项目ID。 |
name | string | 资源的人类可读名称。 |
admin_state_up | boolean | 该网络是否启动。 |
port_security_enabled | boolean | 该网络是否开启网络安全防护功能。如果使用安全组功能,此配置项一定为打开。 |
mtu | int | 该网络数据包最大传输单元大小。 |
shared | boolean | 该网络是否允许全资源池项目都可见。 |
router:external | boolean | 该网络是否为外部网络。 |
availability_zone_hints | array | 该网络的可用区候补选项。 |
availability_zones | array | 该网络的可用区。 |
subnets | array | 该网络的状态。 |
provider:network_type | string | 该网络的类型。例如flat、vlan、geneve。 |
provider:physical_network | string | 该网络的segment来自哪个物理网络。 |
provider:segmentation_id | string | 该网络的segmentation ID。 |
ipv4_address_scope | string | 该网络关联的ipv4地址scope。 |
status | string | 该网络的状态。 |
description | string | 该网络的自定义描述。 |
tags | array | 该网络的自定义标签。 |
updated_at | string | 该网络最新更新时间。 |
created_at | string | 该网络创建时间。 |
qos_policy_id | string | 该网络绑定的qos策略ID。 |
revision_number | int | 该网络的操作码。 |
ipv6_address_scope | string | 该网络关联的ipv6地址scope。 |
igmp_snooping | dict | 该网络的二层组播配置。enabled:是否开启二层组播 |
请求示例
POST http://{endpoint}/v2.0/networks
{
"network": {
"name": "test"
}
}
正常响应示例
{
"network": {
"id": "553f02e3-b0d0-4f9a-a818-42e0c82448ba",
"name": "test",
"tenant_id": "5608307e73d845918339684a78503e78",
"project_id": "5608307e73d845918339684a78503e78",
"admin_state_up": true,
"port_security_enabled": true,
"mtu": 1500,
"shared": false,
"igmp_snooping": {
"enabled": false
},
"router:external": false,
"availability_zone_hints": ["default-az"],
"availability_zones": ["default-az"],
"subnets": [],
"provider:network_type": "vlan",
"provider:physical_network": "physnet2",
"provider:segmentation_id": 1015,
"ipv4_address_scope": null,
"status": "ACTIVE",
"description": "",
"tags": [],
"updated_at": "2021-02-19T03:54:41Z",
"created_at": "2021-02-19T03:04:35Z",
"qos_policy_id": null,
"revision_number": 7,
"ipv6_address_scope": null
}
}
正常响应代码
201
错误码
400,401
显示网络详情
功能介绍
显示某个网络的详细信息。
URI
GET /v2.0/networks/{network_id}
参数 | 参数类型 | 是否必选 | Description |
---|---|---|---|
network_id | string | 是 | 获取详情的network的ID。 |
请求消息
无
响应消息
参数 | 参数类型 | 描述 |
---|---|---|
id | string | 网络ID。 |
tenant_id | string | 项目ID。 |
project_id | string | 项目ID。 |
name | string | 资源的人类可读名称。 |
admin_state_up | boolean | 该网络是否启动。 |
port_security_enabled | boolean | 该网络是否开启网络安全防护功能。如果使用安全组功能,此配置项一定为打开。 |
mtu | int | 该网络数据包最大传输单元大小。 |
shared | boolean | 该网络是否允许全资源池项目都可见。 |
router:external | boolean | 该网络是否为外部网络。 |
availability_zone_hints | array | 该网络的可用区候补选项。 |
availability_zones | array | 该网络的可用区。 |
subnets | array | 该网络的状态。 |
provider:network_type | string | 该网络的类型。例如flat、vlan、geneve。 |
provider:physical_network | string | 该网络的segment来自哪个物理网络。 |
provider:segmentation_id | string | 该网络的segmentation ID。 |
ipv4_address_scope | string | 该网络关联的ipv4地址scope。 |
status | string | 该网络的状态。 |
description | string | 该网络的自定义描述。 |
tags | array | 该网络的自定义标签。 |
updated_at | string | 该网络最新更新时间。 |
created_at | string | 该网络创建时间。 |
qos_policy_id | string | 该网络绑定的qos策略ID。 |
revision_number | int | 该网络的操作码。 |
ipv6_address_scope | string | 该网络关联的ipv6地址scope。 |
igmp_snooping | dict | 该网络的二层组播配置。enabled:是否开启二层组播 |
请求示例
GET http://{endpoint}/v2.0/networks/553f02e3-b0d0-4f9a-a818-42e0c82448ba
正常响应示例
{
"network": {
"id": "553f02e3-b0d0-4f9a-a818-42e0c82448ba",
"name": "test",
"tenant_id": "5608307e73d845918339684a78503e78",
"project_id": "5608307e73d845918339684a78503e78",
"admin_state_up": true,
"port_security_enabled": true,
"mtu": 1500,
"shared": false,
"igmp_snooping": {
"enabled": true
},
"router:external": false,
"availability_zone_hints": ["default-az"],
"availability_zones": ["default-az"],
"subnets": [],
"provider:network_type": "vlan",
"provider:physical_network": "physnet2",
"provider:segmentation_id": 1015,
"ipv4_address_scope": null,
"status": "ACTIVE",
"description": "",
"tags": [],
"updated_at": "2021-02-19T03:54:41Z",
"created_at": "2021-02-19T03:04:35Z",
"qos_policy_id": null,
"revision_number": 7,
"ipv6_address_scope": null
}
}
正常响应代码
200
错误码
400,401
更新网络
功能介绍
更新一个网络。
URI
PUT /v2.0/networks/{network_id}
参数 | 参数类型 | 是否必选 | Description |
---|---|---|---|
network_id | string | 是 | 需要更新的network的ID。 |
请求消息
参数 | 参数类型 | 是否必选 | Description |
---|---|---|---|
name | string | 否 | 网络更新后的的name。 |
igmp_snooping | dict | 否 | 该网络的二层组播配置。enabled:是否开启二层组播 |
响应消息
参数 | 参数类型 | 描述 |
---|---|---|
id | string | 网络ID。 |
tenant_id | string | 项目ID。 |
project_id | string | 项目ID。 |
name | string | 资源的人类可读名称。 |
admin_state_up | boolean | 该网络是否启动。 |
port_security_enabled | boolean | 该网络是否开启网络安全防护功能。如果使用安全组功能,此配置项一定为打开。 |
mtu | int | 该网络数据包最大传输单元大小。 |
shared | boolean | 该网络是否允许全资源池项目都可见。 |
router:external | boolean | 该网络是否为外部网络。 |
availability_zone_hints | array | 该网络的可用区候补选项。 |
availability_zones | array | 该网络的可用区。 |
subnets | array | 该网络的状态。 |
provider:network_type | string | 该网络的类型。例如flat、vlan、geneve。 |
provider:physical_network | string | 该网络的segment来自哪个物理网络。 |
provider:segmentation_id | string | 该网络的segmentation ID。 |
ipv4_address_scope | string | 该网络关联的ipv4地址scope。 |
status | string | 该网络的状态。 |
description | string | 该网络的自定义描述。 |
tags | array | 该网络的自定义标签。 |
updated_at | string | 该网络最新更新时间。 |
created_at | string | 该网络创建时间。 |
qos_policy_id | string | 该网络绑定的qos策略ID。 |
revision_number | int | 该网络的操作码。 |
ipv6_address_scope | string | 该网络关联的ipv6地址scope。 |
igmp_snooping | dict | 该网络的二层组播配置。enabled:是否开启二层组播 |
请求示例
PUT http://{endpoint}/v2.0/networks/553f02e3-b0d0-4f9a-a818-42e0c82448ba
{
"network": {
"name": "test-new",
"igmp_snooping": {
"enabled": true
}
}
}
正常响应示例
{
"network": {
"id": "553f02e3-b0d0-4f9a-a818-42e0c82448ba",
"name": "test-new",
"tenant_id": "5608307e73d845918339684a78503e78",
"project_id": "5608307e73d845918339684a78503e78",
"admin_state_up": true,
"port_security_enabled": true,
"mtu": 1500,
"shared": false,
"igmp_snooping": {
"enabled": true
},
"router:external": false,
"availability_zone_hints": ["default-az"],
"availability_zones": ["default-az"],
"subnets": [],
"provider:network_type": "vlan",
"provider:physical_network": "physnet2",
"provider:segmentation_id": 1015,
"ipv4_address_scope": null,
"status": "ACTIVE",
"description": "",
"tags": [],
"updated_at": "2021-02-19T03:54:41Z",
"created_at": "2021-02-19T03:04:35Z",
"qos_policy_id": null,
"revision_number": 7,
"ipv6_address_scope": null
}
}
正常响应代码
200
错误码
400,401,403,404,412
删除网络
功能介绍
删除一个网络。
URI
DELETE /v2.0/networks/{network_id}
参数 | 参数类型 | 是否必选 | Description |
---|---|---|---|
network_id | string | 是 | 需要删除网络的ID。 |
请求消息
无
响应消息
无
请求示例
DELETE http://{endpoint}/v2.0/networks/553f02e3-b0d0-4f9a-a818-42e0c82448ba
正常响应示例
无
正常响应代码
204
错误码
401,404,409,412
获取网络可用IP详情
功能介绍
获取一个网络以及网络中所有子网的可用IP详情。
URI
GET /v2.0/network-ip-availabilities/{network_id}
参数 | 参数类型 | 是否必选 | Description |
---|---|---|---|
network_id | string | 是 | 获取可用IP情况的network的ID。 |
请求消息
无
响应消息
参数 | 参数类型 | 描述 |
---|---|---|
network_id | string | 网络ID。 |
tenant_id | string | 项目ID。 |
project_id | string | 项目ID。 |
network_name | string | 资源的人类可读名称。 |
subnet_ip_availability | array | 该网络中所有子网的可用IP详情。 |
used_ips | int | 该网络已经使用的IP数量。 |
total_ips | int | 该网络可用的IP数量。 |
请求示例
GET http://{endpoint}/v2.0/network-ip-availabilities/e9319d35-2fc0-4203-b6f3-bf0295cdc74b
正常响应示例
{
"network_ip_availability": {
"network_id": "e9319d35-2fc0-4203-b6f3-bf0295cdc74b",
"network_name": "public_net",
"tenant_id": "209b8b929715438695771f58a8a307ef",
"project_id": "209b8b929715438695771f58a8a307ef",
"subnet_ip_availability": [{
"subnet_id": "b66b5c1f-e5cf-4566-943e-4dd0da06f786",
"ip_version": 4,
"cidr": "172.16.10.0/24",
"subnet_name": "public_net__subnet",
"used_ips": 4,
"total_ips": 243,
"used_ip_addresses": ["172.16.10.100", "172.16.10.28", "172.16.10.41", "172.16.10.62"]
}, {
"subnet_id": "cf2a5f99-fb81-430c-ad2d-6e5858027adf",
"ip_version": 6,
"cidr": "2233::/64",
"subnet_name": "public_net_default_ipv6_subnet",
"used_ips": 2,
"total_ips": 18446744073709551614,
"used_ip_addresses": ["2233::25f", "2233::31f"]
}],
"used_ips": 6,
"total_ips": 18446744073709551857
}
}
正常响应代码
200
错误码
400,401