Networking API v2.0

General API Overview

API guide

本节向读者介绍 OpenStack Networking (v2) API,提供使用指南,并描述了贯穿所有 Networking API 可供用户使用的常见功能。

通用信息

Networking API v2.0 是一个 RESTful HTTP 服务,它使用了 HTTP 协议的所有方面,包括方法、URI、媒体类型、响应代码等。提供商可以使用协议的现有功能,包括缓存、持久连接和内容压缩。例如,部署了缓存层的提供商可以在请求从缓存提供时,响应一个 203 码,而不是 200 码。此外,提供商可以通过使用 ETags 来支持条件 GET 请求,或者响应 GET 请求时发送重定向。创建客户端时应考虑这些差异。

身份验证和授权

Networking API v2.0 使用 OpenStack Identity 服务 作为默认的认证服务。当 Keystone 启用时,向 OpenStack Networking 服务提交请求的用户必须在 X-Auth-Token 请求头中提供认证令牌。您可以通过向 Keystone 端点进行身份验证来获取令牌。

当 Keystone 启用时,创建请求中不需要 project_id 属性,因为项目 ID 是从认证令牌中派生的。

注意:目前 Networking API 为了向后兼容,接受已弃用的 tenant_id 属性作为项目 ID。

默认的授权设置只允许管理员用户代表其他项目创建资源。

OpenStack Networking 使用从 Keystone 收到的信息来授权用户请求。OpenStack Networking 处理以下类型的授权策略:

  • 基于操作的策略 指定特定操作的访问标准,可能对特定属性进行精细控制。

  • 基于资源的策略 访问特定资源。权限可能被授予,也可能不被授予,这取决于为资源配置的权限。目前仅适用于网络资源。

OpenStack Networking 中实际执行的授权策略可能因部署而异。

请求和响应格式

Networking API v2.0 仅支持 JSON 数据序列化请求和响应格式。

Request format

Networking API v2.0 只接受 JSON 数据序列化格式的请求。Content-Type 头被忽略。

Tenant and project attributes in requests

从 Networking 服务 Newton 版本开始,Networking API 除了 tenant_id 属性外,还接受请求中的 project_id 属性。tenant_id 属性是为了向后兼容而接受的。如果在同一个请求中提供了 project_idtenant_id 属性,它们的值必须相同。

要确定 Networking API v2.0 端点是否支持请求中的 project_id 属性,请检查 project-id API 扩展是否已启用(参见 Extensions)。

Response format

Networking API v2.0 始终以 JSON 数据序列化格式响应。Accept 头被忽略。

Query extension A .json extension can be added to the request URI. For example, the .json extension in the following requests are equivalent

  • GET publicURL/networks

  • GET publicURL/networks.json

Tenant and project attributes in responses

从 Networking 服务 Newton 版本开始,Networking API 在响应中返回 project_id 属性,同时为了向后兼容仍然返回 tenant_id 属性。它们的值将始终相同。

要确定 Networking API v2.0 端点是否在响应中返回 project_id 属性,请检查 project-id API 扩展是否已启用(参见 Extensions)。

Filtering and column selection

Networking API v2.0 支持基于资源所有顶级属性的过滤。过滤器适用于所有列表请求。

例如,以下请求返回所有名为 foobar 的网络

GET /v2.0/networks?name=foobar

当您使用不同字段指定多个过滤器时,Networking API v2.0 只返回满足所有过滤条件的对象的集合。操作在不同过滤器字段之间应用 AND 条件。

OpenStack Networking 通过重复使用具有不同 OR 标准的字段来提供 OR 机制。例如,查找所有名为 foobarbizbaz 的网络

GET /v2.0/networks?name=foobar&name=bizbaz

OR 和 AND 可以组合使用。例如,如果您想查找所有 admin_state_up=True 且 shared=True 且名为 foobarbizbaz 的网络

GET /v2.0/networks?name=foobar&name=bizbaz&admin_state_up=True&shared=True

GET 请求支持资源列表。例如,如果您想获取 ID 为 port_id_Aport_id_B 的两个特定端口的信息

GET /v2.0/ports?id=port_id_A&id=port_id_B

它将 ID 过滤器视为列表并返回具有这两个 ID 的端口。

从 Rocky 版本开始,Networking API 可能支持过滤具有空值的属性。例如,以下请求列出所有 device_id 属性为空(即未绑定的端口)的端口。

GET /v2.0/ports?device_id=

要确定是否支持此功能,用户可以检查 empty-string-filtering 扩展 API 是否可用。

从 Rocky 版本开始,如果 filter-validation API 扩展可用,Networking API 将对过滤属性执行验证。如果 API 请求包含未知或不支持的参数,服务器将返回 400 响应,而不是静默忽略无效输入。

Fields

默认情况下,OpenStack Networking 会为任何显示或列表调用返回所有属性。Networking API v2.0 有一种机制可以限制返回的属性集。例如,返回 id

您可以使用 fields 查询参数来控制从 Networking API v2.0 返回的属性。

例如,以下请求为每个网络仅返回 idname

GET /v2.0/networks.json?fields=id&fields=name

分页

为了减少服务的负载,列表操作一次最多只返回一定数量的项目。要遍历集合,可以在 URI 中设置 limitmarkerpage_reverse 参数。例如

?limit=100&marker=1234&page_reverse=False

The marker parameter is the ID of the last item in the previous list. The limit parameter sets the page size. The page_reverse parameter sets the page direction. These parameters are optional. If the client requests a limit beyond the maximum limit configured by the deployment, the server returns the maximum limit number of items.

为了方便起见,列表响应包含 atom next 链接和 previous 链接。使用 page_reverse=False 请求的列表中的最后一页将不包含 next 链接,而使用 page_reverse=True 请求的列表中的最后一页将不包含 previous 链接。以下示例说明了具有三个项目的两页。第一页是通过以下方式检索的:

GET http://127.0.0.1:9696/v2.0/networks.json?limit=2

Pagination is an optional feature of OpenStack Networking API, and it might be disabled. If pagination is disabled, the pagination parameters will be ignored and return all the items.

如果特定插件不支持分页操作,并且分页已启用,Networking API v2.0 将模拟分页行为,以便用户无论后台运行的特定插件如何,都能期望相同的行为。

要确定分页是否受支持,用户可以检查“pagination”扩展 API 是否可用。

Example Network collection, first page: JSON request

GET /v2.0/networks.json?limit=2 HTTP/1.1
Host: 127.0.0.1:9696
Content-Type: application/json
Accept: application/json

Example Network collection, first page: JSON response

{
    "networks": [
        {
            "admin_state_up": true,
            "id": "396f12f8-521e-4b91-8e21-2e003500433a",
            "name": "net3",
            "provider:network_type": "vlan",
            "provider:physical_network": "physnet1",
            "provider:segmentation_id": 1002,
            "router:external": false,
            "shared": false,
            "status": "ACTIVE",
            "subnets": [],
            "tenant_id": "20bd52ff3e1b40039c312395b04683cf"
            "project_id": "20bd52ff3e1b40039c312395b04683cf"
        },
        {
            "admin_state_up": true,
            "id": "71c1e68c-171a-4aa2-aca5-50ea153a3718",
            "name": "net2",
            "provider:network_type": "vlan",
            "provider:physical_network": "physnet1",
            "provider:segmentation_id": 1001,
            "router:external": false,
            "shared": false,
            "status": "ACTIVE",
            "subnets": [],
            "tenant_id": "20bd52ff3e1b40039c312395b04683cf"
            "project_id": "20bd52ff3e1b40039c312395b04683cf"
        }
    ],
    "networks_links": [
        {
            "href": "http://127.0.0.1:9696/v2.0/networks.json?limit=2&marker=71c1e68c-171a-4aa2-aca5-50ea153a3718",
            "rel": "next"
        },
        {
            "href": "http://127.0.0.1:9696/v2.0/networks.json?limit=2&marker=396f12f8-521e-4b91-8e21-2e003500433a&page_reverse=True",
            "rel": "previous"
        }
    ]
}

The last page won’t show the next links

Example Network collection, last page: JSON request

GET /v2.0/networks.json?limit=2&marker=71c1e68c-171a-4aa2-aca5-50ea153a3718 HTTP/1.1
Host: 127.0.0.1:9696
Content-Type: application/json
Accept: application/json

Example Network collection, last page: JSON response

{
    "networks": [
        {
            "admin_state_up": true,
            "id": "b3680498-03da-4691-896f-ef9ee1d856a7",
            "name": "net1",
            "provider:network_type": "vlan",
            "provider:physical_network": "physnet1",
            "provider:segmentation_id": 1000,
            "router:external": false,
            "shared": false,
            "status": "ACTIVE",
            "subnets": [],
            "tenant_id": "c05140b3dc7c4555afff9fab6b58edc2"
            "project_id": "c05140b3dc7c4555afff9fab6b58edc2"
        }
    ],
    "networks_links": [
        {
            "href": "http://127.0.0.1:9696/v2.0/networks.json?limit=2&marker=b3680498-03da-4691-896f-ef9ee1d856a7&page_reverse=True",
            "rel": "previous"
        }
    ]
}

Sorting

您可以使用 sort_keysort_dir 参数对列表操作的结果进行排序。目前排序不适用于资源的扩展属性。sort_keysort_dir 可以重复使用,提供的 sort_keysort_dir 的数量必须相同。sort_dir 参数指示排序方向。可接受的值为 asc(升序)和 desc(降序)。

Sorting is an optional feature of OpenStack Networking API, and it might be disabled. If sorting is disabled, the sorting parameters are ignored.

如果特定插件不支持排序操作并且排序已启用,Networking API v2.0 将模拟排序行为,以便用户无论后台运行的特定插件如何,都能期望相同的行为。

要确定排序是否受支持,用户可以检查“sorting”扩展 API 是否可用。

从 Rocky 版本开始,如果 sort-key-validation API 扩展可用,Networking API 将对排序属性执行验证。如果 API 请求包含未知或不支持的排序键,服务器将返回 400 响应,而不是静默忽略无效输入。

Synchronous versus asynchronous plug-in behavior

Networking API v2.0 提供了一个由网络、端口和子网组成的逻辑网络连接模型。由 OpenStack Networking 插件负责与底层基础设施通信,以确保数据包转发与逻辑模型一致。插件可能会异步执行这些操作。

当 API 客户端通过发出 HTTP POSTPUTDELETE 请求修改逻辑模型时,API 调用可能会在插件修改底层虚拟和物理交换设备之前返回。然而,API 客户端保证所有后续的 API 调用都将正确反映更改后的逻辑模型。

例如,如果客户端发出 HTTP PUT 请求来设置端口的连接,当 HTTP 调用返回时,不能保证名为附件的接口发送的数据包会立即转发。然而,可以保证后续的 HTTP GET 请求来查看该端口上的连接会返回新的附件值。

您可以使用 status 属性与网络和端口资源进行交互,以确定 OpenStack Networking 插件是否已成功完成资源的配置。

Bulk-create

Networking API v2.0 允许您在同一个 API 请求中创建多个相同类型的对象。批量创建操作使用与单个创建操作完全相同的 API 语法,只是您在请求体中指定的是对象列表而不是单个对象。

批量操作始终是原子性的,这意味着请求体中的所有对象要么被创建,要么都不被创建。如果特定插件不支持原子操作,Networking API v2.0 将模拟原子行为,以便用户无论后台运行的特定插件如何,都能期望相同的行为。

OpenStack Networking 可能在没有支持批量操作的情况下部署,当客户端尝试批量创建操作时,将返回 400 错误请求。

扩展

Networking API v2.0 是可扩展的。

Networking API v2.0 扩展的目的是:

  • 在不要求版本更改的情况下引入 API 中的新功能。

  • 引入特定于供应商的小众功能。

  • 为可能包含在 API 未来版本中的实验性功能充当试验场。

为了以编程方式确定哪些扩展可用,请在 v2.0/extensions URI 上发出 GET 请求。

要通过唯一的别名单独查询扩展,请在 /v2.0/extensions/*alias_name* URI 上发出 GET 请求。使用此方法可以轻松确定扩展是否可用。如果扩展不可用,将返回 404 Not Found 响应。

您可以扩展现有的核心 API 资源,添加新的操作或额外的属性。此外,您还可以添加新的资源作为扩展。扩展通常具有标签,以防止与定义具有相同名称的属性或资源的其他扩展以及核心资源和属性发生冲突。因为扩展可能并非所有插件都支持,所以扩展的可用性因部署和所使用的特定插件而异。

故障

Networking API v2.0 在处理请求时发生故障时会返回错误响应。OpenStack Networking 只使用标准的 HTTP 错误代码。4nn 错误表示从客户端发送的特定请求存在问题。

错误

描述

400

Bad request Malformed request URI or body requested admin state invalid Invalid values entered Bulk operations disallowed Validation failed Method not allowed for request body (such as trying to update attributes that can be specified at create-time only)

404

Not Found Non existent URI Resource not found

409

Conflict Port configured on network IP allocated on subnet Conflicting IP allocation pools for subnet

412

Precondition failed The revision number is mismatched

500

Internal server error Internal OpenStack Networking error

503

Service unavailable Failure in Mac address generation

向 Networking API v2.0 提交请求的用户也可能收到以下错误:

  • 401 Unauthorized - 如果提供了无效的凭证。

  • 403 Forbidden - 如果用户无法访问特定资源或执行请求的操作。

Revisions

The Resource revision numbers extension (standard-attr-revisions) adds the revision_number attribute to all API resources that support standard attributes. This includes networks, ports, subnets, subnet pools, floating IPs, routers, logs, security groups/rules, network segments, QoS policies and trunks. As you’d expect, the revision_number indicates the number of updates a particular resource has undergone and is read-only.

In addition, the If-Match constraints based on revision_number extension (revision-if-match) allows API consumers to leverage the If-Match HTTP header to conditionally update/delete a resource when the HTTP If-Match header matches the revision_number of the said resource.

If the HTTP If-Match header doesn’t match the revision_number of the resource, users will receive the following errors

  • 412 Precondition failed - Update/Delete the target resource has been denied due to the mismatch of revision number.

API 版本

Lists information for all Networking API versions.

GET
/

列出 API 版本

Lists information about all Networking API versions.

正常响应代码:200

请求

响应参数

名称

入参

类型

描述

versions

body

数组

List of versions.

status

body

字符串

Status of the API, which can be CURRENT, STABLE or DEPRECATED.

id

body

字符串

Version of the API.

links

body

数组

List of version links. Each link is a dict with ‘href’ and ‘rel’.

href

body

字符串

Link to the API.

rel

body

字符串

Relationship of link with the version.

响应示例

{
    "versions": [
        {
            "status": "CURRENT",
            "id": "v2.0",
            "links": [
                {
                    "href": "http://23.253.228.211:9696/v2.0",
                    "rel": "self"
                }
            ]
        }
    ]
}
GET
/v2.0/

Show API v2 details

Shows details for Networking API v2.0.

正常响应代码:200

Error response codes: 401

请求

响应参数

名称

入参

类型

描述

resources

body

数组

List of resource objects.

name

body

字符串

资源的名称。

collection

body

字符串

Collection name of the resource.

links

body

数组

List of links related to the resource. Each link is a dict with ‘href’ and ‘rel’.

href

body

字符串

Link to the resource.

rel

body

字符串

Relationship between link and the resource.

响应示例

{
    "resources": [
        {
            "links": [
                {
                    "href": "http://23.253.228.211:9696/v2.0/subnets",
                    "rel": "self"
                }
            ],
            "name": "subnet",
            "collection": "subnets"
        },
        {
            "links": [
                {
                    "href": "http://23.253.228.211:9696/v2.0/networks",
                    "rel": "self"
                }
            ],
            "name": "network",
            "collection": "networks"
        },
        {
            "links": [
                {
                    "href": "http://23.253.228.211:9696/v2.0/ports",
                    "rel": "self"
                }
            ],
            "name": "port",
            "collection": "ports"
        }
    ]
}

Extensions

Extensions introduce features and vendor-specific functionality to the API.

GET
/v2.0/extensions

List extensions

Lists available extensions.

Lists available Networking API v2.0 extensions.

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

Error response codes: 401

请求

响应参数

名称

入参

类型

描述

extensions

body

数组

A list of extension objects.

name

body

字符串

Human-readable name of the resource.

links

body

数组

List of links related to the extension.

alias

body

字符串

The alias for the extension. For example “quotas” or “security-group”.

updated

body

字符串

The date and timestamp when the extension was last updated.

description

body

字符串

The human-readable description for the resource.

响应示例

{
    "extensions": [
        {
            "updated": "2013-01-20T00:00:00-00:00",
            "name": "Neutron Service Type Management",
            "links": [],
            "alias": "service-type",
            "description": "API for retrieving service providers for Neutron advanced services"
        },
        {
            "updated": "2012-10-05T10:00:00-00:00",
            "name": "security-group",
            "links": [],
            "alias": "security-group",
            "description": "The security groups extension."
        },
        {
            "updated": "2013-02-07T10:00:00-00:00",
            "name": "L3 Agent Scheduler",
            "links": [],
            "alias": "l3_agent_scheduler",
            "description": "Schedule routers among l3 agents"
        },
        {
            "updated": "2013-03-28T10:00:00-00:00",
            "name": "Neutron L3 Configurable external gateway mode",
            "links": [],
            "alias": "ext-gw-mode",
            "description": "Extension of the router abstraction for specifying whether SNAT should occur on the external gateway"
        },
        {
            "updated": "2014-02-03T10:00:00-00:00",
            "name": "Port Binding",
            "links": [],
            "alias": "binding",
            "description": "Expose port bindings of a virtual port to external application"
        },
        {
            "updated": "2012-09-07T10:00:00-00:00",
            "name": "Provider Network",
            "links": [],
            "alias": "provider",
            "description": "Expose mapping of virtual networks to physical networks"
        },
        {
            "updated": "2013-02-03T10:00:00-00:00",
            "name": "agent",
            "links": [],
            "alias": "agent",
            "description": "The agent management extension."
        },
        {
            "updated": "2012-07-29T10:00:00-00:00",
            "name": "Quota management support",
            "links": [],
            "alias": "quotas",
            "description": "Expose functions for quotas management per tenant"
        },
        {
            "updated": "2013-02-07T10:00:00-00:00",
            "name": "DHCP Agent Scheduler",
            "links": [],
            "alias": "dhcp_agent_scheduler",
            "description": "Schedule networks among dhcp agents"
        },
        {
            "updated": "2013-06-27T10:00:00-00:00",
            "name": "Multi Provider Network",
            "links": [],
            "alias": "multi-provider",
            "description": "Expose mapping of virtual networks to multiple physical networks"
        },
        {
            "updated": "2013-01-14T10:00:00-00:00",
            "name": "Neutron external network",
            "links": [],
            "alias": "external-net",
            "description": "Adds external network attribute to network resource."
        },
        {
            "updated": "2012-07-20T10:00:00-00:00",
            "name": "Neutron L3 Router",
            "links": [],
            "alias": "router",
            "description": "Router abstraction for basic L3 forwarding between L2 Neutron networks and access to external networks via a NAT gateway."
        },
        {
            "updated": "2013-07-23T10:00:00-00:00",
            "name": "Allowed Address Pairs",
            "links": [],
            "alias": "allowed-address-pairs",
            "description": "Provides allowed address pairs"
        },
        {
            "updated": "2013-03-17T12:00:00-00:00",
            "name": "Neutron Extra DHCP opts",
            "links": [],
            "alias": "extra_dhcp_opt",
            "description": "Extra options configuration for DHCP. For example PXE boot options to DHCP clients can be specified (e.g. tftp-server, server-ip-address, bootfile-name)"
        },
        {
            "updated": "2013-02-01T10:00:00-00:00",
            "name": "Neutron Extra Route",
            "links": [],
            "alias": "extraroute",
            "description": "Extra routes configuration for L3 router"
        },
        {
            "updated": "2016-01-24T10:00:00-00:00",
            "name": "Neutron Port Data Plane Status",
            "links": [],
            "alias": "data-plane-status",
            "description": "Status of the underlying data plane."
        }
    ]
}
GET
/v2.0/extensions/{alias}

Show extension details

Shows details for an extension, by alias. The response shows the extension name and its alias. To show details for an extension, you specify the alias.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

Error response codes: 401, 404

请求

名称

入参

类型

描述

alias

路径

字符串

The alias of an extension.

Response Parameters

名称

入参

类型

描述

extension

body

对象

An extension object.

name

body

字符串

Human-readable name of the resource.

links

body

数组

List of links related to the extension.

alias

body

字符串

The alias for the extension. For example “quotas” or “security-group”.

updated

body

字符串

The date and timestamp when the extension was last updated.

description

body

字符串

The human-readable description for the resource.

Response Example

{
    "extension": {
        "updated": "2013-02-03T10:00:00-00:00",
        "name": "agent",
        "links": [],
        "alias": "agent",
        "description": "The agent management extension."
    }
}

Layer 2 Networking

网络

Lists, shows details for, creates, updates, and deletes networks.

Address Scopes Extension

The address-scope extension adds the ipv4_address_scope and ipv6_address_scope attributes to networks. ipv4_address_scope is the ID of the IPv4 address scope that the network is associated with. ipv6_address_scope is the ID of the IPv6 address scope that the network is associated with.

Auto Allocated Topology

The auto-allocated-topology extension adds the is_default boolean attribute to networks. This value indicates the network should be used when auto allocating topologies.

DNS integration

The dns-integration extension adds the dns_domain attribute to networks. The dns_domain of a network in conjunction with the dns_name attribute of its ports will be published in an external DNS service when Neutron is configured to integrate with such a service.

External network

The external-net extension adds the router:external attribute to networks. This boolean attribute indicates the network has an external routing facility that’s not managed by the networking service.

FloatingIP autodelete internal

The floatingip-autodelete-internal shim extension signals that the update of a network’s router:external attribute from true to false autodeletes the unused Floating IPs of that network.

HA extension

The network-ha extension allows to pass a boolean parameter during the network creation. If true is passed, a ha_router_networks database register will be created along with the network register. This field is not visible and, initially, not meant to be supported in the CLI.

L2 adjacency extension

The l2_adjacency extension provides display of L2 Adjacency for networks by adding the read-only l2_adjacency attribute. This is a boolean value where true means that you can expect L2 connectivity throughout the Network and false means that there is no guarantee of L2 connectivity. This value is read-only and is derived from the current state of segments within the network.

MTU extensions

The net-mtu extension allows plug-ins to expose the MTU that is guaranteed to pass through the data path of the segments in the network. This extension introduces a read-only mtu attribute.

A newer net-mtu-writable extension enhances net-mtu in that now the mtu attribute is available for write (both when creating as well as updating networks).

警告

Due to limitations in libvirt and QEMU, updating the mtu value for an existing network with instances plugged into it requires either a hard reboot of those instances, or a detach and re-attach of their ports from that network.

Multiple provider extension

The multi-provider extension allows administrative users to define multiple physical bindings for a logical network.

To define multiple physical bindings for a network, include a segments list in the request body of network creation request. Each element in the segments list has the same structure as the provider network attributes. These attributes are provider:network_type, provider:physical_network, and provider:segmentation_id. The same validation rules are applied to each element in the segments list.

Note that you cannot use the provider extension and the multiple provider extension for a single logical network.

Network availability zone extension

The network_availability_zone extension provides support of availability zone for networks, exposing availability_zone_hints and availability_zones attributes.

Network cascade delete extension

The network-cascade-delete shim extension adds to networks the optional boolean attribute, cascade, that when defined as true, removes all child objects of a network upon its deletion.

Port security

The port-security extension adds the port_security_enabled boolean attribute to networks. At the network level, port_security_enabled defines the default value for new ports attached to the network; they will inherit the value of their network’s port_security_enabled unless explicitly set on the port itself. While the default value for port_security_enabled is true, this can be changed by updating the respective network. Note that changing a value of port_security_enabled on a network, does not cascade the value to ports attached to the network.

Provider extended attributes

The provider extension allows administrative users to define a physical binding of a logical network. This extension provides three additional attributes: provider:network_type, provider:physical_network and provider:segmentation_id. The validation rules for these attributes vary across provider:network_type. For example, vlan and flat network types require provider:physical_network attribute, but vxlan network type does not.

Most Networking plug-ins (e.g. ML2 Plugin) and drivers do not support updating any provider related attributes. Check your plug-in whether it supports updating.

QinQ

The qinq extension adds the qinq boolean attribute which allows to control the VLAN QinQ (vlan in vlan) of the network. It uses 0x8a88 ethertype for the double tagged packets. If the service does not support VLAN QinQ and a user requests a VLAN QinQ network, the plug-in refuses to create one and returns an appropriate error to the user. This extension enables VLAN-In-VLAN feature where inner and outer frames are using different ethertypes. Inner (C-Tag) tag is using ethertype 0x8100 and outher (S-Tag) tag is using ethertype 8x8a88. This is described in the 802.1ad IEEE document.

QoS extension

The QoS extension (qos) makes it possible to define QoS policies and associate these to the networks by introducing the qos_policy_id attribute. The policies should be created before they are associated to the networks.

Resource timestamps

The standard-attr-timestamp extension adds the created_at and updated_at attributes to all resources that have standard attributes.

Tag extension

The standard-attr-tag adds Tag support for resources with standard attributes by adding the tags attribute allowing consumers to associate tags with resources.

VLAN transparency extension

The vlan-transparent extension enables plug-ins that support VLAN transparency to deliver VLAN transparent trunk networks. This extension introduces a vlan_transparent attribute to control the VLAN transparency of the network. If the service does not support VLAN transparency and a user requests a VLAN transparent network, the plug-in refuses to create one and returns an appropriate error to the user. This extension enables feature called sometimes as QinQ which means “Q-tag-in-Q-tag” where both, inner and outer frame is using 802.1q tag (ethertype 0x8100).

GET
/v2.0/networks/{network_id}

Show network details

Shows details for a network.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

Error response codes: 401, 404

请求

名称

入参

类型

描述

network_id

路径

字符串

The ID of the network.

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

network

body

对象

A network object.

admin_state_up

body

布尔值

The administrative state of the network, which is up (true) or down (false).

availability_zone_hints

body

数组

The availability zone candidate for the network.

availability_zones

body

数组

The availability zone for the network.

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

dns_domain

body

字符串

A valid DNS domain.

id

body

字符串

The ID of the network.

ipv4_address_scope

body

字符串

The ID of the IPv4 address scope that the network is associated with.

ipv6_address_scope

body

字符串

The ID of the IPv6 address scope that the network is associated with.

l2_adjacency

body

布尔值

Indicates whether L2 connectivity is available throughout the network.

mtu

body

整数

The maximum transmission unit (MTU) value to address fragmentation. Minimum value is 68 for IPv4, and 1280 for IPv6.

name

body

字符串

Human-readable name of the network.

port_security_enabled

body

布尔值

The port security status of the network. Valid values are enabled (true) and disabled (false). This value is used as the default value of port_security_enabled field of a newly created port.

project_id

body

字符串

项目的 ID。

provider:network_type

body

字符串

The type of physical network that this network is mapped to. For example, flat, vlan, vxlan, or gre. Valid values depend on a networking back-end.

provider:physical_network

body

字符串

The physical network where this network/segment is implemented.

provider:segmentation_id

body

整数

The ID of the isolated segment on the physical network. The network_type attribute defines the segmentation model. For example, if the network_type value is vlan, this ID is a vlan identifier. If the network_type value is gre, this ID is a gre key. Note that only the segmentation-id of VLAN type networks can be changed!

qos_policy_id

body

字符串

The ID of the QoS policy associated with the network.

revision_number

body

整数

The revision number of the resource.

router:external

body

布尔值

Defines whether the network may be used for creation of floating IPs. Only networks with this flag may be an external gateway for routers. The network must have an external routing facility that is not managed by the networking service. If the network is updated from external to internal the unused floating IPs of this network are automatically deleted when extension floatingip-autodelete-internal is present.

body

数组

A list of provider segment objects.

shared

body

布尔值

Indicates whether this network is shared across all tenants. By default, only administrative users can change this value.

status

body

字符串

The network status. Values are ACTIVE, DOWN, BUILD or ERROR.

子网

body

数组

The associated subnets.

tenant_id

body

字符串

项目的 ID。

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

vlan_transparent

body

布尔值

Indicates the VLAN transparency mode of the network, which is VLAN transparent (true) or not VLAN transparent (false).

description

body

字符串

A human-readable description for the resource.

is_default

body

布尔值

The network is default pool or not.

tags

body

数组

The list of tags on the resource.

响应示例

{
    "network": {
        "admin_state_up": true,
        "availability_zone_hints": [],
        "availability_zones": [
            "nova"
        ],
        "created_at": "2016-03-08T20:19:41",
        "dns_domain": "my-domain.org.",
        "id": "d32019d3-bc6e-4319-9c1d-6722fc136a22",
        "ipv4_address_scope": null,
        "ipv6_address_scope": null,
        "l2_adjacency": false,
        "mtu": 1500,
        "name": "private-network",
        "port_security_enabled": true,
        "project_id": "4fd44f30292945e481c7b8a0c8908869",
        "qos_policy_id": "6a8454ade84346f59e8d40665f878b2e",
        "revision_number": 1,
        "router:external": false,
        "shared": true,
        "status": "ACTIVE",
        "subnets": [
            "54d6f61d-db07-451c-9ab3-b9609b6b6f0b"
        ],
        "tags": ["tag1,tag2"],
        "tenant_id": "4fd44f30292945e481c7b8a0c8908869",
        "updated_at": "2016-03-08T20:19:41",
        "vlan_transparent": false,
        "qinq": false,
        "description": "",
        "is_default": true
    }
}

Response Example (admin user; single segment mapping)

{
    "network": {
        "admin_state_up": true,
        "availability_zone_hints": [],
        "availability_zones": [
            "nova"
        ],
        "created_at": "2016-03-08T20:19:41",
        "dns_domain": "my-domain.org.",
        "id": "d32019d3-bc6e-4319-9c1d-6722fc136a22",
        "ipv4_address_scope": null,
        "ipv6_address_scope": null,
        "l2_adjacency": false,
        "mtu": 1500,
        "name": "private-network",
        "port_security_enabled": true,
        "project_id": "4fd44f30292945e481c7b8a0c8908869",
        "provider:network_type": "local",
        "provider:physical_network": null,
        "provider:segmentation_id": null,
        "qos_policy_id": "6a8454ade84346f59e8d40665f878b2e",
        "revision_number": 1,
        "router:external": false,
        "shared": true,
        "status": "ACTIVE",
        "subnets": [
            "54d6f61d-db07-451c-9ab3-b9609b6b6f0b"
        ],
        "tags": ["tag1,tag2"],
        "tenant_id": "4fd44f30292945e481c7b8a0c8908869",
        "updated_at": "2016-03-08T20:19:41",
        "vlan_transparent": false,
        "qinq": false,
        "description": "",
        "is_default": true
    }
}

Response Example (admin user; multiple segment mappings)

{
    "network": {
        "admin_state_up": true,
        "availability_zone_hints": [],
        "availability_zones": [
            "nova"
        ],
        "created_at": "2016-03-08T20:19:41",
        "dns_domain": "my-domain.org.",
        "id": "4e8e5957-649f-477b-9e5b-f1f75b21c03c",
        "ipv4_address_scope": null,
        "ipv6_address_scope": null,
        "l2_adjacency": false,
        "mtu": 1500,
        "name": "net1",
        "port_security_enabled": true,
        "project_id": "9bacb3c5d39d41a79512987f338cf177",
        "qos_policy_id": "6a8454ade84346f59e8d40665f878b2e",
        "revision_number": 1,
        "router:external": false,
        "segments": [
            {
                "provider:network_type": "vlan",
                "provider:physical_network": "public",
                "provider:segmentation_id": 2
            },
            {
                "provider:network_type": "flat",
                "provider:physical_network": "default",
                "provider:segmentation_id": 0
            }
        ],
        "shared": false,
        "status": "ACTIVE",
        "subnets": [
            "54d6f61d-db07-451c-9ab3-b9609b6b6f0b"
        ],
        "tags": ["tag1,tag2"],
        "tenant_id": "4fd44f30292945e481c7b8a0c8908869",
        "updated_at": "2016-03-08T20:19:41",
        "vlan_transparent": false,
        "qinq": false,
        "description": "",
        "is_default": false
    }
}
PUT
/v2.0/networks/{network_id}

Update network

Updates a network.

正常响应代码:200

Error response codes: 400, 401, 403, 404, 412

请求

名称

入参

类型

描述

network_id

路径

字符串

The ID of the network.

network

body

对象

A network object.

admin_state_up (Optional)

body

布尔值

The administrative state of the network, which is up (true) or down (false).

dns_domain (Optional)

body

字符串

A valid DNS domain.

mtu (Optional)

body

整数

The maximum transmission unit (MTU) value to address fragmentation. Minimum value is 68 for IPv4, and 1280 for IPv6.

name (可选)

body

字符串

Human-readable name of the network.

port_security_enabled (Optional)

body

布尔值

The port security status of the network. Valid values are enabled (true) and disabled (false). This value is used as the default value of port_security_enabled field of a newly created port.

provider:network_type

body

字符串

The type of physical network that this network is mapped to. For example, flat, vlan, vxlan, or gre. Valid values depend on a networking back-end.

provider:physical_network

body

字符串

The physical network where this network/segment is implemented.

provider:segmentation_id

body

整数

The ID of the isolated segment on the physical network. The network_type attribute defines the segmentation model. For example, if the network_type value is vlan, this ID is a vlan identifier. If the network_type value is gre, this ID is a gre key. Note that only the segmentation-id of VLAN type networks can be changed!

qos_policy_id (Optional)

body

字符串

The ID of the QoS policy associated with the network.

router:external (Optional)

body

布尔值

Indicates whether the network has an external routing facility that’s not managed by the networking service.

body

数组

A list of provider segment objects.

shared (Optional)

body

布尔值

Indicates whether this resource is shared across all projects. By default, only administrative users can change this value.

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

is_default (Optional)

body

布尔值

The network is default or not.

请求示例

{
    "network": {
        "dns_domain": "my-domain.org.",
        "name": "sample_network_5_updated",
        "qos_policy_id": "6a8454ade84346f59e8d40665f878b2e",
        "mtu": 1300
    }
}

Request Example (admin user; single segment mapping)

{
    "network": {
        "provider:network_type": "vlan",
        "provider:physical_network": "public",
        "provider:segmentation_id": 2
    }
}

Request Example (admin user; multiple segment mappings)

{
    "network": {
        "segments": [
            {
                "provider:segmentation_id": 2,
                "provider:physical_network": "public",
                "provider:network_type": "vlan"
            },
            {
                "provider:physical_network": "default",
                "provider:network_type": "flat"
            }
        ]
    }
}

响应参数

名称

入参

类型

描述

network

body

对象

A network object.

admin_state_up

body

布尔值

The administrative state of the network, which is up (true) or down (false).

availability_zone_hints

body

数组

The availability zone candidate for the network.

availability_zones

body

数组

The availability zone for the network.

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

dns_domain

body

字符串

A valid DNS domain.

id

body

字符串

The ID of the network.

ipv4_address_scope

body

字符串

The ID of the IPv4 address scope that the network is associated with.

ipv6_address_scope

body

字符串

The ID of the IPv6 address scope that the network is associated with.

l2_adjacency

body

布尔值

Indicates whether L2 connectivity is available throughout the network.

mtu

body

整数

The maximum transmission unit (MTU) value to address fragmentation. Minimum value is 68 for IPv4, and 1280 for IPv6.

name

body

字符串

Human-readable name of the network.

port_security_enabled

body

布尔值

The port security status of the network. Valid values are enabled (true) and disabled (false). This value is used as the default value of port_security_enabled field of a newly created port.

project_id

body

字符串

项目的 ID。

provider:network_type

body

字符串

The type of physical network that this network is mapped to. For example, flat, vlan, vxlan, or gre. Valid values depend on a networking back-end.

provider:physical_network

body

字符串

The physical network where this network/segment is implemented.

provider:segmentation_id

body

整数

The ID of the isolated segment on the physical network. The network_type attribute defines the segmentation model. For example, if the network_type value is vlan, this ID is a vlan identifier. If the network_type value is gre, this ID is a gre key. Note that only the segmentation-id of VLAN type networks can be changed!

qos_policy_id

body

字符串

The ID of the QoS policy associated with the network.

revision_number

body

整数

The revision number of the resource.

router:external

body

布尔值

Defines whether the network may be used for creation of floating IPs. Only networks with this flag may be an external gateway for routers. The network must have an external routing facility that is not managed by the networking service. If the network is updated from external to internal the unused floating IPs of this network are automatically deleted when extension floatingip-autodelete-internal is present.

body

数组

A list of provider segment objects.

shared

body

布尔值

Indicates whether this network is shared across all tenants. By default, only administrative users can change this value.

status

body

字符串

The network status. Values are ACTIVE, DOWN, BUILD or ERROR.

子网

body

数组

The associated subnets.

tenant_id

body

字符串

项目的 ID。

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

description

body

字符串

A human-readable description for the resource.

is_default

body

布尔值

The network is default pool or not.

tags

body

数组

The list of tags on the resource.

响应示例

This is an example when a regular user without administrative roles sends a PUT request. Response examples for administrative users are similar to responses of Show network details and Create network. See them for details.

{
    "network": {
        "admin_state_up": true,
        "availability_zone_hints": [],
        "availability_zones": [
            "nova"
        ],
        "created_at": "2016-03-08T20:19:41",
        "dns_domain": "my-domain.org.",
        "id": "1f370095-98f6-4079-be64-6d3d4a6adcc6",
        "ipv4_address_scope": null,
        "ipv6_address_scope": null,
        "l2_adjacency": false,
        "mtu": 1300,
        "name": "sample_network_5_updated",
        "port_security_enabled": true,
        "project_id": "4fd44f30292945e481c7b8a0c8908869",
        "qos_policy_id": "6a8454ade84346f59e8d40665f878b2e",
        "revision_number": 2,
        "router:external": false,
        "shared": false,
        "status": "ACTIVE",
        "subnets": [
            "54d6f61d-db07-451c-9ab3-b9609b6b6f0b"
        ],
        "tags": ["tag1,tag2"],
        "tenant_id": "4fd44f30292945e481c7b8a0c8908869",
        "updated_at": "2016-03-08T20:19:41",
        "vlan_transparent": false,
        "qinq": false,
        "description": "",
        "is_default": false
    }
}
DELETE
/v2.0/networks/{network_id}

Delete network

Deletes a network and its associated resources.

正常响应代码:204

Error response codes: 401, 404, 409, 412

请求

名称

入参

类型

描述

network_id

路径

字符串

The ID of the network.

响应

There is no body content for the response of a successful DELETE request.

GET
/v2.0/networks

List networks

Lists networks to which the project has access.

Default policy settings return only networks that the project who submits the request owns, unless an administrative user submits the request. In addition, networks shared with the project who submits the request are also returned.

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

You can also use the tags, tags-any, not-tags, not-tags-any query parameter to filter the response with tags. For information, see REST API Impact.

正常响应代码:200

Error response codes: 401

请求

名称

入参

类型

描述

admin_state_up (Optional)

查询

布尔值

Filter the list result by the administrative state of the resource, which is up (true) or down (false).

id (可选)

查询

字符串

Filter the list result by the ID of the resource.

mtu (Optional)

查询

整数

Filter the network list result by the maximum transmission unit (MTU) value to address fragmentation. Minimum value is 68 for IPv4, and 1280 for IPv6.

name (可选)

查询

字符串

Filter the list result by the human-readable name of the resource.

project_id (可选)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

provider:network_type (Optional)

查询

字符串

Filter the list result by the type of physical network that this network/segment is mapped to. For example, flat, vlan, vxlan, or gre. Valid values depend on a networking back-end.

provider:physical_network (Optional)

查询

字符串

Filter the list result by the physical network where this network/segment is implemented.

provider:segmentation_id (Optional)

查询

整数

Filter the list result by the ID of the isolated segment on the physical network.

revision_number (Optional)

查询

整数

Filter the list result by the revision number of the resource.

router:external (Optional)

查询

布尔值

Filter the network list result based on whether the network has an external routing facility that’s not managed by the networking service.

shared (Optional)

查询

布尔值

Filter the network list result based on if the network is shared across all tenants.

status (可选)

查询

字符串

Filter the network list result by network status. Values are ACTIVE, DOWN, BUILD or ERROR.

tenant_id (可选)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

vlan_transparent (Optional)

查询

布尔值

Filter the network list by the VLAN transparency mode of the network, which is VLAN transparent (true) or not VLAN transparent (false).

description (可选)

查询

字符串

Filter the list result by the human-readable description of the resource.

is_default (Optional)

查询

布尔值

Filter the network list result based on if the network is default pool or not.

tags (可选)

查询

字符串

A list of tags to filter the list result by. Resources that match all tags in this list will be returned. Tags in query must be separated by comma.

tags-any (Optional)

查询

字符串

A list of tags to filter the list result by. Resources that match any tag in this list will be returned. Tags in query must be separated by comma.

not-tags (Optional)

查询

字符串

A list of tags to filter the list result by. Resources that match all tags in this list will be excluded. Tags in query must be separated by comma.

not-tags-any (Optional)

查询

字符串

A list of tags to filter the list result by. Resources that match any tag in this list will be excluded. Tags in query must be separated by comma.

sort_dir (可选)

查询

字符串

Sort direction. A valid value is asc (ascending) or desc (descending). You can specify multiple pairs of sort key and sort direction query parameters.

sort_key (可选)

查询

字符串

Sorts by a network attribute. You can specify multiple pairs of sort key and sort direction query parameters. The sort keys are limited to

  • admin_state_up

  • availability_zone_hints

  • id

  • mtu

  • name

  • status

  • tenant_id

  • project_id

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

Response Parameters

名称

入参

类型

描述

networks

body

数组

A list of network objects.

admin_state_up

body

布尔值

The administrative state of the network, which is up (true) or down (false).

availability_zone_hints

body

数组

The availability zone candidate for the network.

availability_zones

body

数组

The availability zone for the network.

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

dns_domain

body

字符串

A valid DNS domain.

id

body

字符串

The ID of the network.

ipv4_address_scope

body

字符串

The ID of the IPv4 address scope that the network is associated with.

ipv6_address_scope

body

字符串

The ID of the IPv6 address scope that the network is associated with.

l2_adjacency

body

布尔值

Indicates whether L2 connectivity is available throughout the network.

mtu

body

整数

The maximum transmission unit (MTU) value to address fragmentation. Minimum value is 68 for IPv4, and 1280 for IPv6.

name

body

字符串

Human-readable name of the network.

port_security_enabled

body

布尔值

The port security status of the network. Valid values are enabled (true) and disabled (false). This value is used as the default value of port_security_enabled field of a newly created port.

project_id

body

字符串

项目的 ID。

provider:network_type

body

字符串

The type of physical network that this network is mapped to. For example, flat, vlan, vxlan, or gre. Valid values depend on a networking back-end.

provider:physical_network

body

字符串

The physical network where this network/segment is implemented.

provider:segmentation_id

body

整数

The ID of the isolated segment on the physical network. The network_type attribute defines the segmentation model. For example, if the network_type value is vlan, this ID is a vlan identifier. If the network_type value is gre, this ID is a gre key. Note that only the segmentation-id of VLAN type networks can be changed!

qos_policy_id

body

字符串

The ID of the QoS policy associated with the network.

revision_number

body

整数

The revision number of the resource.

router:external

body

布尔值

Defines whether the network may be used for creation of floating IPs. Only networks with this flag may be an external gateway for routers. The network must have an external routing facility that is not managed by the networking service. If the network is updated from external to internal the unused floating IPs of this network are automatically deleted when extension floatingip-autodelete-internal is present.

body

数组

A list of provider segment objects.

shared

body

布尔值

Indicates whether this network is shared across all tenants. By default, only administrative users can change this value.

status

body

字符串

The network status. Values are ACTIVE, DOWN, BUILD or ERROR.

子网

body

数组

The associated subnets.

tenant_id

body

字符串

项目的 ID。

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

vlan_transparent

body

布尔值

Indicates the VLAN transparency mode of the network, which is VLAN transparent (true) or not VLAN transparent (false).

description

body

字符串

A human-readable description for the resource.

is_default

body

布尔值

The network is default pool or not.

tags

body

数组

The list of tags on the resource.

响应示例

{
    "networks": [
        {
            "admin_state_up": true,
            "availability_zone_hints": [],
            "availability_zones": [
                "nova"
            ],
            "created_at": "2016-03-08T20:19:41",
            "dns_domain": "my-domain.org.",
            "id": "d32019d3-bc6e-4319-9c1d-6722fc136a22",
            "ipv4_address_scope": null,
            "ipv6_address_scope": null,
            "l2_adjacency": false,
            "mtu": 1500,
            "name": "net1",
            "port_security_enabled": true,
            "project_id": "4fd44f30292945e481c7b8a0c8908869",
            "qos_policy_id": "6a8454ade84346f59e8d40665f878b2e",
            "revision_number": 1,
            "router:external": false,
            "shared": false,
            "status": "ACTIVE",
            "subnets": [
                "54d6f61d-db07-451c-9ab3-b9609b6b6f0b"
            ],
            "tenant_id": "4fd44f30292945e481c7b8a0c8908869",
            "updated_at": "2016-03-08T20:19:41",
            "vlan_transparent": true,
            "qinq": true,
            "description": "",
            "is_default": false
        },
        {
            "admin_state_up": true,
            "availability_zone_hints": [],
            "availability_zones": [
                "nova"
            ],
            "created_at": "2016-03-08T20:19:41",
            "dns_domain": "my-domain.org.",
            "id": "db193ab3-96e3-4cb3-8fc5-05f4296d0324",
            "ipv4_address_scope": null,
            "ipv6_address_scope": null,
            "l2_adjacency": false,
            "mtu": 1500,
            "name": "net2",
            "port_security_enabled": true,
            "project_id": "26a7980765d0414dbc1fc1f88cdb7e6e",
            "qos_policy_id": "bfdb6c39f71e4d44b1dfbda245c50819",
            "revision_number": 3,
            "router:external": false,
            "shared": false,
            "status": "ACTIVE",
            "subnets": [
                "08eae331-0402-425a-923c-34f7cfe39c1b"
            ],
            "tenant_id": "26a7980765d0414dbc1fc1f88cdb7e6e",
            "updated_at": "2016-03-08T20:19:41",
            "vlan_transparent": false,
            "qinq": false,
            "description": "",
            "is_default": false
        }
    ]
}

Response Example (admin user)

When Administrative users request to list networks, physical segment information bound to the networks are also returned in a response. In this example, a network net1 is mapped to a single network segment and a network net2 is mapped to multiple network segments.

{
    "networks": [
        {
            "admin_state_up": true,
            "availability_zone_hints": [],
            "availability_zones": [
                "nova"
            ],
            "created_at": "2016-03-08T20:19:41",
            "dns_domain": "my-domain.org.",
            "id": "d32019d3-bc6e-4319-9c1d-6722fc136a22",
            "ipv4_address_scope": null,
            "ipv6_address_scope": null,
            "l2_adjacency": false,
            "mtu": 1500,
            "name": "net1",
            "port_security_enabled": true,
            "project_id": "4fd44f30292945e481c7b8a0c8908869",
            "qos_policy_id": "6a8454ade84346f59e8d40665f878b2e",
            "provider:network_type": "vlan",
            "provider:physical_network": "public",
            "provider:segmentation_id": 3,
            "revision_number": 1,
            "router:external": false,
            "shared": false,
            "status": "ACTIVE",
            "subnets": [
                "54d6f61d-db07-451c-9ab3-b9609b6b6f0b"
            ],
            "tags": ["tag1,tag2"],
            "tenant_id": "4fd44f30292945e481c7b8a0c8908869",
            "updated_at": "2016-03-08T20:19:41",
            "vlan_transparent": true,
            "qinq": false,
            "description": "",
            "is_default": false
        },
        {
            "admin_state_up": true,
            "availability_zone_hints": [],
            "availability_zones": [
                "nova"
            ],
            "created_at": "2016-03-08T20:19:41",
            "dns_domain": "my-domain.org.",
            "id": "db193ab3-96e3-4cb3-8fc5-05f4296d0324",
            "ipv4_address_scope": null,
            "ipv6_address_scope": null,
            "l2_adjacency": false,
            "mtu": 1450,
            "name": "net2",
            "port_security_enabled": true,
            "project_id": "26a7980765d0414dbc1fc1f88cdb7e6e",
            "provider:network_type": "local",
            "provider:physical_network": null,
            "provider:segmentation_id": null,
            "qos_policy_id": "bfdb6c39f71e4d44b1dfbda245c50819",
            "revision_number": 2,
            "router:external": false,
            "segments": [
                {
                    "provider:network_type": "vlan",
                    "provider:physical_network": "public",
                    "provider:segmentation_id": 2
                },
                {
                    "provider:network_type": "vxlan",
                    "provider:physical_network": "default",
                    "provider:segmentation_id": 1000
                }
            ],
            "shared": false,
            "status": "ACTIVE",
            "subnets": [
                "08eae331-0402-425a-923c-34f7cfe39c1b"
            ],
            "tags": ["tag1,tag2"],
            "tenant_id": "26a7980765d0414dbc1fc1f88cdb7e6e",
            "updated_at": "2016-03-08T20:19:41",
            "vlan_transparent": false,
            "qinq": false,
            "description": "",
            "is_default": false
        }
    ]
}
POST
/v2.0/networks

Create network

Creates a network.

A request body is optional. An administrative user can specify another project ID, which is the project that owns the network, in the request body.

正常响应代码:201

错误响应代码:400, 401

请求

名称

入参

类型

描述

network

body

对象

A network object.

admin_state_up (Optional)

body

布尔值

The administrative state of the network, which is up (true) or down (false).

dns_domain (Optional)

body

字符串

A valid DNS domain.

mtu (Optional)

body

整数

The maximum transmission unit (MTU) value to address fragmentation. Minimum value is 68 for IPv4, and 1280 for IPv6.

name (可选)

body

字符串

Human-readable name of the network.

port_security_enabled (Optional)

body

布尔值

The port security status of the network. Valid values are enabled (true) and disabled (false). This value is used as the default value of port_security_enabled field of a newly created port.

project_id (可选)

body

字符串

The ID of the project that owns the resource. Only administrative and users with advsvc role can specify a project ID other than their own. You cannot change this value through authorization policies.

provider:network_type (Optional)

body

字符串

The type of physical network that this network should be mapped to. For example, flat, vlan, vxlan, or gre. Valid values depend on a networking back-end.

provider:physical_network (Optional)

body

字符串

The physical network where this network should be implemented. The Networking API v2.0 does not provide a way to list available physical networks. For example, the Open vSwitch plug-in configuration file defines a symbolic name that maps to specific bridges on each compute host.

provider:segmentation_id (Optional)

body

整数

The ID of the isolated segment on the physical network. The network_type attribute defines the segmentation model. For example, if the network_type value is vlan, this ID is a vlan identifier. If the network_type value is gre, this ID is a gre key.

qos_policy_id (Optional)

body

字符串

The ID of the QoS policy associated with the network.

router:external (Optional)

body

布尔值

Indicates whether the network has an external routing facility that’s not managed by the networking service.

segments (Optional)

body

数组

A list of provider segment objects.

shared (Optional)

body

布尔值

Indicates whether this resource is shared across all projects. By default, only administrative users can change this value.

tenant_id (可选)

body

字符串

The ID of the project that owns the resource. Only administrative and users with advsvc role can specify a project ID other than their own. You cannot change this value through authorization policies.

vlan_transparent (Optional)

body

布尔值

Indicates the VLAN transparency mode of the network, which is VLAN transparent (true) or not VLAN transparent (false).

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

is_default (Optional)

body

布尔值

The network is default or not.

availability_zone_hints (Optional)

body

数组

The availability zone candidate for the network.

请求示例

{
    "network": {
        "name": "sample_network",
        "admin_state_up": true,
        "dns_domain": "my-domain.org.",
        "qos_policy_id": "6a8454ade84346f59e8d40665f878b2e",
        "mtu": 1400
    }
}

Request Example (admin user; single segment mapping)

{
    "network": {
        "admin_state_up": true,
        "name": "net1",
        "provider:network_type": "vlan",
        "provider:physical_network": "public",
        "provider:segmentation_id": 2,
        "qos_policy_id": "6a8454ade84346f59e8d40665f878b2e"
    }
}

Request Example (admin user; multiple segment mappings)

{
    "network": {
        "segments": [
            {
                "provider:segmentation_id": 2,
                "provider:physical_network": "public",
                "provider:network_type": "vlan"
            },
            {
                "provider:physical_network": "default",
                "provider:network_type": "flat"
            }
        ],
        "name": "net1",
        "admin_state_up": true,
        "qos_policy_id": "6a8454ade84346f59e8d40665f878b2e"
    }
}

Response Parameters

名称

入参

类型

描述

network

body

对象

A network object.

admin_state_up

body

布尔值

The administrative state of the network, which is up (true) or down (false).

availability_zone_hints

body

数组

The availability zone candidate for the network.

availability_zones

body

数组

The availability zone for the network.

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

dns_domain

body

字符串

A valid DNS domain.

id

body

字符串

The ID of the network.

ipv4_address_scope

body

字符串

The ID of the IPv4 address scope that the network is associated with.

ipv6_address_scope

body

字符串

The ID of the IPv6 address scope that the network is associated with.

l2_adjacency

body

布尔值

Indicates whether L2 connectivity is available throughout the network.

mtu

body

整数

The maximum transmission unit (MTU) value to address fragmentation. Minimum value is 68 for IPv4, and 1280 for IPv6.

name

body

字符串

Human-readable name of the network.

port_security_enabled

body

布尔值

The port security status of the network. Valid values are enabled (true) and disabled (false). This value is used as the default value of port_security_enabled field of a newly created port.

project_id

body

字符串

项目的 ID。

provider:network_type

body

字符串

The type of physical network that this network is mapped to. For example, flat, vlan, vxlan, or gre. Valid values depend on a networking back-end.

provider:physical_network

body

字符串

The physical network where this network/segment is implemented.

provider:segmentation_id

body

整数

The ID of the isolated segment on the physical network. The network_type attribute defines the segmentation model. For example, if the network_type value is vlan, this ID is a vlan identifier. If the network_type value is gre, this ID is a gre key. Note that only the segmentation-id of VLAN type networks can be changed!

qos_policy_id

body

字符串

The ID of the QoS policy associated with the network.

revision_number

body

整数

The revision number of the resource.

router:external

body

布尔值

Defines whether the network may be used for creation of floating IPs. Only networks with this flag may be an external gateway for routers. The network must have an external routing facility that is not managed by the networking service. If the network is updated from external to internal the unused floating IPs of this network are automatically deleted when extension floatingip-autodelete-internal is present.

body

数组

A list of provider segment objects.

shared

body

布尔值

Indicates whether this network is shared across all tenants. By default, only administrative users can change this value.

status

body

字符串

The network status. Values are ACTIVE, DOWN, BUILD or ERROR.

子网

body

数组

The associated subnets.

tenant_id

body

字符串

项目的 ID。

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

vlan_transparent

body

布尔值

Indicates the VLAN transparency mode of the network, which is VLAN transparent (true) or not VLAN transparent (false).

description

body

字符串

A human-readable description for the resource.

is_default

body

布尔值

The network is default pool or not.

tags

body

数组

The list of tags on the resource.

响应示例

{
    "network": {
        "admin_state_up": true,
        "availability_zone_hints": [],
        "availability_zones": [
            "nova"
        ],
        "created_at": "2016-03-08T20:19:41",
        "dns_domain": "my-domain.org.",
        "id": "4e8e5957-649f-477b-9e5b-f1f75b21c03c",
        "ipv4_address_scope": null,
        "ipv6_address_scope": null,
        "l2_adjacency": true,
        "mtu": 1400,
        "name": "net1",
        "port_security_enabled": true,
        "project_id": "9bacb3c5d39d41a79512987f338cf177",
        "qos_policy_id": "6a8454ade84346f59e8d40665f878b2e",
        "revision_number": 1,
        "router:external": false,
        "shared": false,
        "status": "ACTIVE",
        "subnets": [],
        "tags": ["tag1,tag2"],
        "tenant_id": "9bacb3c5d39d41a79512987f338cf177",
        "updated_at": "2016-03-08T20:19:41",
        "vlan_transparent": false,
        "qinq": false,
        "description": "",
        "is_default": false
    }
}

Response Example (admin user; single segment mapping)

{
    "network": {
        "status": "ACTIVE",
        "subnets": [],
        "availability_zone_hints": [],
        "availability_zones": [
            "nova"
        ],
        "created_at": "2016-03-08T20:19:41",
        "dns_domain": "",
        "ipv4_address_scope": null,
        "ipv6_address_scope": null,
        "name": "net1",
        "provider:physical_network": "public",
        "admin_state_up": true,
        "project_id": "9bacb3c5d39d41a79512987f338cf177",
        "tags": ["tag1,tag2"],
        "tenant_id": "9bacb3c5d39d41a79512987f338cf177",
        "updated_at": "2016-03-08T20:19:41",
        "qos_policy_id": "6a8454ade84346f59e8d40665f878b2e",
        "revision_number": 1,
        "router:external": false,
        "provider:network_type": "vlan",
        "l2_adjacency": true,
        "mtu": 1500,
        "shared": false,
        "id": "4e8e5957-649f-477b-9e5b-f1f75b21c03c",
        "provider:segmentation_id": 2,
        "description": "",
        "port_security_enabled": true,
        "is_default": false
    }
}

Response Example (admin user; multiple segment mappings)

{
    "network": {
        "status": "ACTIVE",
        "subnets": [],
        "availability_zone_hints": [],
        "availability_zones": [
            "nova"
        ],
        "created_at": "2016-03-08T20:19:41",
        "name": "net1",
        "admin_state_up": true,
        "dns_domain": "",
        "ipv4_address_scope": null,
        "ipv6_address_scope": null,
        "l2_adjacency": true,
        "mtu": 1500,
        "port_security_enabled": true,
        "project_id": "9bacb3c5d39d41a79512987f338cf177",
        "tags": ["tag1,tag2"],
        "tenant_id": "9bacb3c5d39d41a79512987f338cf177",
        "updated_at": "2016-03-08T20:19:41",
        "qos_policy_id": "6a8454ade84346f59e8d40665f878b2e",
        "revision_number": 1,
        "segments": [
            {
                "provider:segmentation_id": 2,
                "provider:physical_network": "public",
                "provider:network_type": "vlan"
            },
            {
                "provider:segmentation_id": null,
                "provider:physical_network": "default",
                "provider:network_type": "flat"
            }
        ],
        "shared": false,
        "id": "4e8e5957-649f-477b-9e5b-f1f75b21c03c",
        "description": "",
        "is_default": false
    }
}
POST
/v2.0/networks

Bulk create networks

Creates multiple networks in a single request.

In the request body, specify a list of networks.

The bulk create operation is always atomic. Either all or no networks in the request body are created.

正常响应代码:201

错误响应代码:400, 401

请求

名称

入参

类型

描述

networks

body

数组

A list of network objects.

admin_state_up (Optional)

body

布尔值

The administrative state of the network, which is up (true) or down (false).

dns_domain (Optional)

body

字符串

A valid DNS domain.

mtu (Optional)

body

整数

The maximum transmission unit (MTU) value to address fragmentation. Minimum value is 68 for IPv4, and 1280 for IPv6.

name (可选)

body

字符串

Human-readable name of the network.

port_security_enabled (Optional)

body

布尔值

The port security status of the network. Valid values are enabled (true) and disabled (false). This value is used as the default value of port_security_enabled field of a newly created port.

project_id (可选)

body

字符串

The ID of the project that owns the resource. Only administrative and users with advsvc role can specify a project ID other than their own. You cannot change this value through authorization policies.

provider:network_type (Optional)

body

字符串

The type of physical network that this network should be mapped to. For example, flat, vlan, vxlan, or gre. Valid values depend on a networking back-end.

provider:physical_network (Optional)

body

字符串

The physical network where this network should be implemented. The Networking API v2.0 does not provide a way to list available physical networks. For example, the Open vSwitch plug-in configuration file defines a symbolic name that maps to specific bridges on each compute host.

provider:segmentation_id (Optional)

body

整数

The ID of the isolated segment on the physical network. The network_type attribute defines the segmentation model. For example, if the network_type value is vlan, this ID is a vlan identifier. If the network_type value is gre, this ID is a gre key.

qos_policy_id (Optional)

body

字符串

The ID of the QoS policy associated with the network.

router:external (Optional)

body

布尔值

Indicates whether the network has an external routing facility that’s not managed by the networking service.

segments (Optional)

body

数组

A list of provider segment objects.

shared (Optional)

body

布尔值

Indicates whether this resource is shared across all projects. By default, only administrative users can change this value.

tenant_id (可选)

body

字符串

The ID of the project that owns the resource. Only administrative and users with advsvc role can specify a project ID other than their own. You cannot change this value through authorization policies.

vlan_transparent (Optional)

body

布尔值

Indicates the VLAN transparency mode of the network, which is VLAN transparent (true) or not VLAN transparent (false).

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

availability_zone_hints (Optional)

body

数组

The availability zone candidate for the network.

Request Example

{
    "networks": [
        {
            "admin_state_up": true,
            "name": "sample_network3",
            "qos_policy_id": "6a8454ade84346f59e8d40665f878b2e"
        },
        {
            "admin_state_up": true,
            "name": "sample_network4",
            "qos_policy_id": "6a8454ade84346f59e8d40665f878b2e"
        }
    ]
}

响应参数

名称

入参

类型

描述

networks

body

数组

A list of network objects.

admin_state_up

body

布尔值

The administrative state of the network, which is up (true) or down (false).

availability_zone_hints

body

数组

The availability zone candidate for the network.

availability_zones

body

数组

The availability zone for the network.

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

dns_domain

body

字符串

A valid DNS domain.

id

body

字符串

The ID of the network.

ipv4_address_scope

body

字符串

The ID of the IPv4 address scope that the network is associated with.

ipv6_address_scope

body

字符串

The ID of the IPv6 address scope that the network is associated with.

l2_adjacency

body

布尔值

Indicates whether L2 connectivity is available throughout the network.

mtu

body

整数

The maximum transmission unit (MTU) value to address fragmentation. Minimum value is 68 for IPv4, and 1280 for IPv6.

name

body

字符串

Human-readable name of the network.

port_security_enabled

body

布尔值

The port security status of the network. Valid values are enabled (true) and disabled (false). This value is used as the default value of port_security_enabled field of a newly created port.

project_id

body

字符串

项目的 ID。

provider:network_type

body

字符串

The type of physical network that this network is mapped to. For example, flat, vlan, vxlan, or gre. Valid values depend on a networking back-end.

provider:physical_network

body

字符串

The physical network where this network/segment is implemented.

provider:segmentation_id

body

整数

The ID of the isolated segment on the physical network. The network_type attribute defines the segmentation model. For example, if the network_type value is vlan, this ID is a vlan identifier. If the network_type value is gre, this ID is a gre key. Note that only the segmentation-id of VLAN type networks can be changed!

qos_policy_id

body

字符串

The ID of the QoS policy associated with the network.

revision_number

body

整数

The revision number of the resource.

router:external

body

布尔值

Defines whether the network may be used for creation of floating IPs. Only networks with this flag may be an external gateway for routers. The network must have an external routing facility that is not managed by the networking service. If the network is updated from external to internal the unused floating IPs of this network are automatically deleted when extension floatingip-autodelete-internal is present.

body

数组

A list of provider segment objects.

shared

body

布尔值

Indicates whether this network is shared across all tenants. By default, only administrative users can change this value.

status

body

字符串

The network status. Values are ACTIVE, DOWN, BUILD or ERROR.

子网

body

数组

The associated subnets.

tenant_id

body

字符串

项目的 ID。

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

vlan_transparent

body

布尔值

Indicates the VLAN transparency mode of the network, which is VLAN transparent (true) or not VLAN transparent (false).

description

body

字符串

A human-readable description for the resource.

is_default

body

布尔值

The network is default pool or not.

tags

body

数组

The list of tags on the resource.

响应示例

{
    "networks": [
        {
            "admin_state_up": true,
            "availability_zone_hints": [],
            "availability_zones": [
                "nova"
            ],
            "created_at": "2016-03-08T20:19:41",
            "dns_domain": "",
            "id": "bc1a76cb-8767-4c3a-bb95-018b822f2130",
            "ipv4_address_scope": null,
            "ipv6_address_scope": null,
            "l2_adjacency": true,
            "mtu": 1500,
            "name": "sample_network3",
            "project_id": "4fd44f30292945e481c7b8a0c8908869",
            "qos_policy_id": "6a8454ade84346f59e8d40665f878b2e",
            "revision_number": 1,
            "router:external": false,
            "shared": false,
            "status": "ACTIVE",
            "subnets": [],
            "tags": ["tag1,tag2"],
            "tenant_id": "4fd44f30292945e481c7b8a0c8908869",
            "updated_at": "2016-03-08T20:19:41",
            "vlan_transparent": false,
            "qinq": false,
            "description": "",
            "port_security_enabled": true,
            "is_default": false
        },
        {
            "admin_state_up": true,
            "availability_zone_hints": [],
            "availability_zones": [
                "nova"
            ],
            "created_at": "2016-03-08T20:19:41",
            "dns_domain": "",
            "id": "af374017-c9ae-4a1d-b799-ab73111476e2",
            "ipv4_address_scope": null,
            "ipv6_address_scope": null,
            "l2_adjacency": true,
            "mtu": 1500,
            "name": "sample_network4",
            "project_id": "4fd44f30292945e481c7b8a0c8908869",
            "qos_policy_id": "6a8454ade84346f59e8d40665f878b2e",
            "revision_number": 1,
            "router:external": false,
            "shared": false,
            "status": "ACTIVE",
            "subnets": [],
            "tags": ["tag1,tag2"],
            "tenant_id": "4fd44f30292945e481c7b8a0c8908869",
            "updated_at": "2016-03-08T20:19:41",
            "vlan_transparent": false,
            "qinq": false,
            "description": "",
            "port_security_enabled": true,
            "is_default": false
        }
    ]
}

Network Segment Ranges

The network segment range extension exposes the segment range management to be administered via the Neutron API. It introduces the network-segment-range resource for tenant network segment allocation. In addition, it introduces the ability for the administrator to control the segment ranges globally or on a per-tenant basis.

Lists, shows details for, creates, updates, and deletes network segment ranges. The network segment ranges API is admin-only.

Resource timestamps

The standard-attr-timestamp extension adds the created_at and updated_at attributes to all resources that have standard attributes.

Tag extension

The standard-attr-tag adds tag support for resources with standard attributes by adding the tags attribute allowing consumers to associate tags with resources.

GET
/v2.0/network_segment_ranges/{network_segment_range_id}

Show network segment range details

Shows details for a network segment range.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

Error response codes: 401, 404

请求

名称

入参

类型

描述

network_segment_range_id

路径

字符串

The ID of the network segment range.

响应参数

名称

入参

类型

描述

id

body

字符串

The UUID of the network segment range.

name

body

字符串

Human-readable name of the resource.

description

body

字符串

A human-readable description for the resource.

default

body

布尔值

Defines whether the network segment range is the default that is loaded from the host ML2 config file.

shared

body

布尔值

Indicates whether this network segment range is shared across all projects.

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

network_type

body

字符串

The type of physical network that maps to this network segment range resource. For example, vlan, vxlan, or gre. Valid values depend on a networking back-end.

physical_network

body

字符串

The physical network where this network segment range is implemented.

minimum

body

整数

The minimum segmentation ID of the network segment range.

maximum

body

整数

The maximum segmentation ID of the network segment range.

available

body

列表

List of available segmentation IDs in the network segment range.

used

body

dict

Mapping of which segmentation ID in the network segment range is used by which project.

revision_number

body

整数

The revision number of the resource.

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

tags

body

数组

The list of tags on the resource.

Response Example

{
    "network_segment_range": {
        "id": "59b38ee8-6642-418a-88b7-756861606ecb",
        "name": "range_vlan_physnet1",
        "description": "network segment range for testing",
        "default": false,
        "shared": false,
        "tenant_id": "7011dc7fccac4efda89dc3b7f0d0975a",
        "project_id": "7011dc7fccac4efda89dc3b7f0d0975a",
        "network_type": "vlan",
        "physical_network": "physnet1",
        "minimum": 10,
        "maximum": 20,
        "available": [10,11,12,13,14,15,16,19,20],
        "used": {
            "17": "5fc1cd2f16ab4c8fbba2e780891b9de3",
            "18": "87504c1c9d86439882ff90fdbfb096ad"}
        },
        "created_at": "2019-03-04T04:49:28Z",
        "updated_at": "2019-03-04T04:49:28Z",
        "revision_number": 1,
        "tags": ["tag1,tag2"]
}
PUT
/v2.0/network_segment_ranges/{network_segment_range_id}

Update network segment range

Updates a network segment range.

正常响应代码:200

Error response codes: 400, 401, 403, 404, 412

请求

名称

入参

类型

描述

network_segment_range_id

路径

字符串

The ID of the network segment range.

name (可选)

body

字符串

资源的易读名称。默认情况下为空字符串。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

minimum (Optional)

body

整数

The minimum segmentation ID of the network segment range.

maximum (Optional)

body

整数

The maximum segmentation ID of the network segment range.

tags (可选)

查询

字符串

A list of tags to filter the list result by. Resources that match all tags in this list will be returned. Tags in query must be separated by comma.

tags-any (Optional)

查询

字符串

A list of tags to filter the list result by. Resources that match any tag in this list will be returned. Tags in query must be separated by comma.

not-tags (Optional)

查询

字符串

A list of tags to filter the list result by. Resources that match all tags in this list will be excluded. Tags in query must be separated by comma.

not-tags-any (Optional)

查询

字符串

A list of tags to filter the list result by. Resources that match any tag in this list will be excluded. Tags in query must be separated by comma.

请求示例

{
    "network_segment_range": {
        "name": "new_range",
        "minimum": 10,
        "maximum": 20,
        "description": "network segment range updated for testing"
    }
}

响应参数

名称

入参

类型

描述

id

body

字符串

The UUID of the network segment range.

name

body

字符串

Human-readable name of the resource.

description

body

字符串

A human-readable description for the resource.

default

body

布尔值

Defines whether the network segment range is the default that is loaded from the host ML2 config file.

shared

body

布尔值

Indicates whether this network segment range is shared across all projects.

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

network_type

body

字符串

The type of physical network that maps to this network segment range resource. For example, vlan, vxlan, or gre. Valid values depend on a networking back-end.

physical_network

body

字符串

The physical network where this network segment range is implemented.

minimum

body

整数

The minimum segmentation ID of the network segment range.

maximum

body

整数

The maximum segmentation ID of the network segment range.

available

body

列表

List of available segmentation IDs in the network segment range.

used

body

dict

Mapping of which segmentation ID in the network segment range is used by which project.

revision_number

body

整数

The revision number of the resource.

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

tags

body

数组

The list of tags on the resource.

响应示例

{
    "network_segment_range": {
        "id": "50089a13-4a9f-4421-85ba-5222e84610c3",
        "name": "new_range",
        "description": "network segment range updated for testing",
        "default": false,
        "shared": false,
        "tenant_id": "7011dc7fccac4efda89dc3b7f0d0975a",
        "project_id": "7011dc7fccac4efda89dc3b7f0d0975a",
        "network_type": "vxlan",
        "physical_network": null,
        "minimum": 10,
        "maximum": 20,
        "available": [10,11,12,13,14,15,16,19,20],
        "used": {
            "17": "5fc1cd2f16ab4c8fbba2e780891b9de3",
            "18": "87504c1c9d86439882ff90fdbfb096ad"},
        "created_at": "2019-03-04T04:56:49Z",
        "updated_at": "2019-03-04T04:58:06Z",
        "revision_number": 2,
        "tags": ["tag1,tag2"]
    }
}
DELETE
/v2.0/network_segment_ranges/{network_segment_range_id}

Delete network segment range

Deletes a network segment range.

正常响应代码:204

Error response codes: 401, 404, 409, 412

请求

名称

入参

类型

描述

network_segment_range_id

路径

字符串

The ID of the network segment range.

Response

There is no body content for the response of a successful DELETE request.

GET
/v2.0/network_segment_ranges

List network segment ranges

Lists network segment ranges to which the admin has access.

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

Error response codes: 401

请求

名称

入参

类型

描述

id (可选)

查询

字符串

Filter the network segment range list result based on the range ID.

name (可选)

查询

字符串

Filter the network segment range list result based on the name of the range.

tenant_id (可选)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

project_id (可选)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

network_type (Optional)

查询

字符串

Filter the list result by the type of physical network that this network segment range is mapped to. For example, vlan, vxlan, or gre. Valid values depend on a networking back-end.

physical_network (Optional)

查询

字符串

Filter the list result by the physical network where this network segment range is implemented.

sort_dir (可选)

查询

字符串

Sort direction. A valid value is asc (ascending) or desc (descending). You can specify multiple pairs of sort key and sort direction query parameters.

sort_key (可选)

查询

字符串

Sorts by a network segment range attribute. You can specify multiple pairs of sort key and sort direction query parameters. The sort keys are limited to

  • id

  • name

  • project_id

  • tenant_id

tags (可选)

查询

字符串

A list of tags to filter the list result by. Resources that match all tags in this list will be returned. Tags in query must be separated by comma.

tags-any (Optional)

查询

字符串

A list of tags to filter the list result by. Resources that match any tag in this list will be returned. Tags in query must be separated by comma.

not-tags (Optional)

查询

字符串

A list of tags to filter the list result by. Resources that match all tags in this list will be excluded. Tags in query must be separated by comma.

not-tags-any (Optional)

查询

字符串

A list of tags to filter the list result by. Resources that match any tag in this list will be excluded. Tags in query must be separated by comma.

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

Response Parameters

名称

入参

类型

描述

id

body

字符串

The UUID of the network segment range.

name

body

字符串

Human-readable name of the resource.

description

body

字符串

A human-readable description for the resource.

default

body

布尔值

Defines whether the network segment range is the default that is loaded from the host ML2 config file.

shared

body

布尔值

Indicates whether this network segment range is shared across all projects.

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

network_type

body

字符串

The type of physical network that maps to this network segment range resource. For example, vlan, vxlan, or gre. Valid values depend on a networking back-end.

physical_network

body

字符串

The physical network where this network segment range is implemented.

minimum

body

整数

The minimum segmentation ID of the network segment range.

maximum

body

整数

The maximum segmentation ID of the network segment range.

available

body

列表

List of available segmentation IDs in the network segment range.

used

body

dict

Mapping of which segmentation ID in the network segment range is used by which project.

revision_number

body

整数

The revision number of the resource.

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

tags

body

数组

The list of tags on the resource.

响应示例

{
    "network_segment_ranges": [
        {
            "id": "59b38ee8-6642-418a-88b7-756861606ecb",
            "name": "range_vlan_physnet1",
            "description": "network segment range 1 for testing",
            "default": false,
            "shared": false,
            "tenant_id": "7011dc7fccac4efda89dc3b7f0d0975a",
            "project_id": "7011dc7fccac4efda89dc3b7f0d0975a",
            "network_type": "vlan",
            "physical_network": "physnet1",
            "minimum": 10,
            "maximum": 20,
            "available": [10,11,12,13,14,15,16,19,20],
            "used": {
                "17": "5fc1cd2f16ab4c8fbba2e780891b9de3",
                "18": "87504c1c9d86439882ff90fdbfb096ad"},
            "created_at": "2019-03-04T04:49:28Z",
            "updated_at": "2019-03-04T04:49:28Z",
            "revision_number": 1,
            "tags": ["tag1,tag2"]
        },
        {
            "id": "91ea6e31-3a6d-4541-8432-b49b4cacf893",
            "name": "range_vxlan",
            "description": "network segment range 2 for testing",
            "default": false,
            "shared": true,
            "tenant_id": null,
            "project_id": null,
            "network_type": "vxlan",
            "physical_network": null,
            "minimum": 40,
            "maximum": 50,
            "available": [40,41,43,44,46,47,48,49,50],
            "used": {
                "42": "07ac1127ee9647d48ce2626867104a13",
                "45": "d4fa62aa47d340d98d076801aa7e6ec4"},
            "created_at": "2019-03-04T04:56:49Z",
            "updated_at": "2019-03-04T04:58:06Z",
            "revision_number": 2,
            "tags": ["tag1,tag2"]
        }
    ]
}
POST
/v2.0/network_segment_ranges

Create network segment range

Creates a network segment range.

正常响应代码:201

错误响应代码:400, 401

请求

名称

入参

类型

描述

name (可选)

body

字符串

Human-readable name of the network segment range.

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

shared

body

布尔值

Indicates whether this network segment range is shared across all projects.

project_id (可选)

body

字符串

拥有资源的项目的 ID。

network_type

body

字符串

The type of physical network that maps to this network segment range resource. For example, vlan, vxlan, or gre. Valid values depend on a networking back-end.

physical_network (Optional)

body

字符串

The physical network where this network segment range is implemented.

minimum

body

整数

The minimum segmentation ID of the network segment range.

maximum

body

整数

The minimum segmentation ID of the network segment range.

Request Example

{
    "network_segment_range": {
        "name": "range_vlan_physnet1",
        "description": "network segment range for testing",
        "shared": false,
        "project_id": "7011dc7fccac4efda89dc3b7f0d0975a",
        "network_type": "vlan",
        "physical_network": "physnet1",
        "minimum": 10,
        "maximum": 20
    }
}

Response Parameters

名称

入参

类型

描述

id

body

字符串

The UUID of the network segment range.

name

body

字符串

Human-readable name of the resource.

description

body

字符串

A human-readable description for the resource.

default

body

布尔值

Defines whether the network segment range is the default that is loaded from the host ML2 config file.

shared

body

布尔值

Indicates whether this network segment range is shared across all projects.

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

network_type

body

字符串

The type of physical network that maps to this network segment range resource. For example, vlan, vxlan, or gre. Valid values depend on a networking back-end.

physical_network

body

字符串

The physical network where this network segment range is implemented.

minimum

body

整数

The minimum segmentation ID of the network segment range.

maximum

body

整数

The maximum segmentation ID of the network segment range.

available

body

列表

List of available segmentation IDs in the network segment range.

used

body

dict

Mapping of which segmentation ID in the network segment range is used by which project.

revision_number

body

整数

The revision number of the resource.

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

tags

body

数组

The list of tags on the resource.

响应示例

{
    "network_segment_range": {
        "id": "59b38ee8-6642-418a-88b7-756861606ecb",
        "name": "range_vlan_physnet1",
        "description": "network segment range for testing",
        "default": false,
        "shared": false,
        "tenant_id": "7011dc7fccac4efda89dc3b7f0d0975a",
        "project_id": "7011dc7fccac4efda89dc3b7f0d0975a",
        "network_type": "vlan",
        "physical_network": "physnet1",
        "minimum": 10,
        "maximum": 20,
        "available": [10,11,12,13,14,15,16,17,18,19,20],
        "used": {},
        "created_at": "2019-03-04T04:49:28Z",
        "updated_at": "2019-03-04T04:49:28Z",
        "revision_number": 1,
        "tags": ["tag1,tag2"]
    }
}

端口

Lists, shows details for, creates, updates, and deletes ports.

Allowed address pairs

The allowed-address-pairs extension adds an allowed_address_pairs attribute to ports. The value of allowed_address_pairs is an array of allowed address pair objects, each having an ip_address and a mac_address. The set of allowed address pairs defines IP and MAC address that the port can use when sending packets if port_security_enabled is true (see the port-security extension). Note that while the ip_address is required in each allowed address pair, the mac_address is optional and will be taken from the port if not specified.

警告

如果一个带有remote_group_id规则的安全组被某个端口使用,那么添加一个IP地址为0.0.0.0/0ANY)的地址对将会绕过所有对使用相同安全组的所有端口设置的源IP地址限制规则。

允许的地址对(原子化)扩展

允许的地址对(原子化)扩展(allowedaddresspairs-atomic)通过添加两个成员操作(add_allowed_address_pairs/ remove_allowed_address_pairs)来扩展port资源,以便在服务器端原子化地编辑允许的地址对集合。

数据平面状态扩展

数据平面端口扩展(data-plane-status)在port资源中添加了一个新属性data_plane_status,用于表示底层数据平面的状态。该属性将由Networking服务之外的实体管理,而status属性由Networking服务管理。两个状态属性彼此独立。

支持的数据平面状态值

  • null:未报告状态;默认值

  • ACTIVE:底层数据平面正在运行

  • DOWN:无法从/向端口传输流量

DNS集成

dns-integration扩展为端口资源添加了dns_namedns_assignment属性。dns_name可以在创建和更新操作中设置,而dns_assignment是只读的,显示端口内部DNS分配的hostnameip_addressfqdn

要启用端口资源上的dns_domain,必须将dns-domain-ports扩展与dns-integration扩展结合使用。启用并设置后,端口级别的dns_domain将优先于端口网络中指定的dns_domain,从而允许每个端口拥有独立的DNS域。

设备配置文件

端口设备配置文件扩展(port-device-profile)定义了一个命名的用户需求集,用于一个或多个加速器。此参数是Cyborg项目的引用,由Nova在请求端口时读取。如果此参数已填充,Nova会向Cyborg发出请求。https://docs.openstack.org/api-ref/accelerator/#device-profiles

额外DHCP选项(extra_dhcp_opt)扩展

额外DHCP选项(extra_dhcp_opt)扩展在ports上启用了额外的DHCP配置选项。例如,可以指定DHCP客户端的PXE启动选项(例如,tftp-server、server-ip-address、bootfile-name)。extra_dhcp_opt属性的值是一个DHCP选项对象的数组,每个对象包含一个opt_name和一个opt_value(字符串值),以及一个可选的ip_version(可接受的值是整数46)。

IP分配扩展

IP分配扩展(ip_allocation)添加了一个新的只读属性ip_allocation,指示端口何时使用延迟、即时或无IP分配。

IP子字符串过滤

ip-substring-filtering扩展增加了通过IP地址的一部分来过滤端口的支持。

MAC学习扩展

mac_learning_enabled扩展通过mac_learning_enabled属性增强了Neutron端口,提供了在关联端口上启用MAC学习的能力。

NUMA亲和策略

NUMA亲和策略扩展(port-numa-affinity-policy)根据网络后端NUMA拓扑定义了Nova调度策略。此参数可以是requiredpreferredlegacysocketNone

端口绑定扩展属性

端口绑定扩展(binding)允许管理员用户指定和检索端口的物理绑定信息。该扩展定义了几个带有binding:前缀的属性,包括binding:host_idbinding:vnic_typebinding:vif_typebinding:vif_detailsbinding:profile

警告

当API策略的新默认值被启用时(在Neutron的配置中将enforce_new_defaults设置为True),binding:profile只能由具有SERVICE角色的用户设置或更新。如果需要由admin用户设置(例如用于调试目的),则需要在policy.yaml文件中覆盖create_port:binding:profile和/或update_port:binding:profile的默认API策略。

端口提示

端口提示扩展(port-hints)引入了hints端口属性。提示是后端特定的信息,主要用于允许后端进行特定的性能调优。此扩展本身不定义任何特定的提示,因此hints属性也没有有效的取值。它仅作为其他引入具体提示的扩展的基础,并向API用户发出hints端口属性存在的信号。默认策略下,hints属性的使用仅限于管理员用户。

端口提示:Open vSwitch Tx转向

port-hint-ovs-tx-steering扩展允许在hints端口属性中使用新的值(即提示)。它允许控制Open vSwitch的用户空间Tx数据包转向选项。有关Open vSwitch的详细信息,请参阅:https://docs.openvswitch.org/en/2025.2/topics/userspace-tx-steering/

端口资源请求

端口资源请求扩展(port-resource-request)允许管理员用户(包括Nova)通过在port资源中引入resource_request来检索端口所需的Placement资源和特性。可以从Placement服务获取和管理资源。

端口资源请求组

端口资源请求组扩展(port-resource-request-groups)为port资源引入了resource_request字段的新格式。新结构使用户能够从同一RP子树请求多个资源和特性组。

资源请求新格式示例

{
    "request_groups": [
        {
            "id": "1e4f3958-c0c9-4dec-82fa-ed2dc1c5cb34",
            "required": ["CUSTOM_VNIC_TYPE_NORMAL"],
            "resources": {
                "NET_PACKET_RATE_KILOPACKET_PER_SEC": 1000
            }
        },
        {
            "id": "b20bb47f-5d6d-45a6-8fe7-2c1b44f0db73",
            "required": ["CUSTOM_PHYSNET_PUBLIC", "CUSTOM_VNIC_TYPE_NORMAL"],
            "resources": {
                "NET_BW_EGR_KILOBIT_PER_SEC": 2000
            }
        }
    ],
    "same_subtree": [
        "1e4f3958-c0c9-4dec-82fa-ed2dc1c5cb34",
        "b20bb47f-5d6d-45a6-8fe7-2c1b44f0db73"
    ]
}

端口安全

port-security扩展向端口添加了port_security_enabled布尔属性。如果创建端口时未指定port-security值,则端口将继承其连接到的网络的port_security_enabled值。

受信任的VIF

port-trusted-vif扩展向端口资源添加了trusted属性。此属性存储有关SR-IOV端口是否应被信任的信息。它将在端口绑定配置文件信息中填充为trusted字段。

批量创建时标记端口

tag-ports-during-bulk-creation扩展增加了在创建端口时,直接在POST请求中设置端口标签的能力。这既可以在创建单个端口时完成,也可以在批量创建端口时完成。

QoS扩展

qos扩展(QoS)通过引入qos_policy_id属性,使得能够定义QoS策略并将其关联到端口。策略应在与端口关联之前创建。

QoS网络策略

qos-port-network-policy扩展向端口响应添加了只读参数qos_network_policy_id。此参数包含端口所连接网络的QoS策略ID。

MAC地址重新生成扩展

端口MAC地址重新生成扩展(port-mac-address-regenerate)使得可以重新生成端口的MAC地址。在端口更新时,将'null'None)作为mac_address传递,将生成新的MAC地址并设置在端口上。

资源时间戳

The standard-attr-timestamp extension adds the created_at and updated_at attributes to all resources that have standard attributes.

标签扩展

The standard-attr-tag adds Tag support for resources with standard attributes by adding the tags attribute allowing consumers to associate tags with resources.

硬件卸载扩展

port-hardware-offload扩展向端口资源添加了hardware_offload_type属性。此属性存储端口将使用的硬件卸载类型,并将在端口绑定配置文件信息中以“'capabilities': [<hardware_offload_type>]”的形式填充。

GET
/v2.0/ports/{port_id}

显示端口详细信息

显示端口的详细信息。

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

Error response codes: 401, 404

请求

名称

入参

类型

描述

port_id

路径

字符串

端口的ID。

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

port

body

对象

一个port对象。

admin_state_up

body

布尔值

资源的管理状态,为开启(true)或关闭(false)。

allowed_address_pairs

body

数组

一个零个或多个允许的地址对对象的集合,每个地址对对象包含一个ip_address和一个mac_addressip_address是必需的,而mac_address如果未指定,将从端口获取。ip_address的值可以是IP地址或CIDR(如果底层扩展插件支持)。连接到端口的服务器可以发送源地址与指定的允许地址对之一匹配的数据包。

binding:host_id

body

字符串

端口所在主机的ID。

binding:profile

body

对象

一个字典,允许特定主机上运行的应用程序传递和接收特定于网络后端的vif端口信息。网络API不定义此字段的特定格式。如果更新请求为null,则此响应字段将为{}。

binding:vif_details

body

对象

一个包含端口附加信息的字典。目前定义的字段有:port_filterovs_hybrid_plugport_filter是一个布尔值,指示网络服务是否提供端口过滤功能,如安全组和/或防MAC/IP欺骗。ovs_hybrid_plug是一个布尔值,用于告知Nova等API消费者是否应使用OVS的混合插件策略。

binding:vif_type

body

字符串

用于端口的机制类型。Nova等API消费者可以使用此信息来确定连接设备的适当方式(例如,虚拟服务器的接口)。目前定义的可用值包括ovsbridgemacvtaphw_vebhostdev_physicalvhostuserdistributedother。还有特殊值:unboundbinding_failedunbound表示端口未绑定到网络后端。binding_failed表示端口绑定到网络后端失败的错误。

binding:vnic_type

body

字符串

此端口应连接的vNIC类型。这用于确定要用于绑定端口的机制驱动程序。有效值为normalmacvtapdirectbaremetaldirect-physicalvirtio-forwardersmart-nicremote-managed。实际可用的vNIC类型取决于部署。

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

data_plane_status

body

字符串

端口底层数据平面的状态。

description

body

字符串

A human-readable description for the resource.

device_id

body

字符串

使用此端口的设备的ID。例如,服务器实例或逻辑路由器。

device_owner

body

字符串

使用此端口的实体类型。例如,compute:nova(服务器实例)、network:dhcp(DHCP代理)或network:router_interface(路由器接口)。

dns_assignment

body

对象

Networking内部DNS分配给端口的数据,包括hostnameip_addressfqdn

dns_domain

body

字符串

A valid DNS domain.

dns_name

body

字符串

有效的DNS名称。

extra_dhcp_opts

body

数组

零个或多个额外DHCP选项对的集合。一个选项对由选项值和选项名称组成。

fixed_ips

body

数组

端口的IP地址。如果端口有多个IP地址,则此字段有多个条目。每个条目包括IP地址(ip_address)以及分配IP地址的子网ID(subnet_id)。

hints

body

对象

仅限管理员。以下值用于控制Open vSwitch的用户空间Tx数据包转向功能

  • {"openvswitch": {"other_config": {"tx-steering": "hash|thread"}}}

id

body

字符串

资源的ID。

ip_allocation

body

字符串

指示端口何时使用deferredimmediate或无IP分配(none)。

mac_address

body

字符串

端口的MAC地址。如果端口使用direct-physicalvnic_type,则此字段的值将被替换为活动绑定:配置文件中提供的MAC地址(如果有)。

name

body

字符串

Human-readable name of the resource.

network_id

body

字符串

连接网络的 ID。

numa_affinity_policy (Optional)

body

字符串

虚拟机调度期间请求的端口NUMA亲和策略。值:Nonerequiredpreferredlegacy

port_security_enabled

body

布尔值

端口安全状态。有效值为启用(true)或禁用(false)。如果端口启用了端口安全,则安全组规则和防欺骗规则将应用于端口上的流量。如果禁用,则不应用这些规则。

project_id

body

字符串

项目的 ID。

qos_network_policy_id

body

字符串

此端口所连接网络的QoS策略ID。

qos_policy_id

body

字符串

与端口关联的QoS策略ID。

revision_number

body

整数

The revision number of the resource.

resource_request (Optional)

body

对象

将端口请求的Placement资源(例如:minimum-bandwidth)和特性(例如:vnic-typephysnet)暴露给Nova和Placement。resource_request对象包含request_groupssame_subtree键。request_groups是一个字典列表,其中每个字典表示一个需要从单个资源提供者满足的资源和特性组。列表中的每个字典必须包含idrequiredresources键。id字段是一个字符串,表示通过UUID5方法结合port_id和对组有贡献的QoS规则的UUID生成的每个组的唯一UUID。required键包含端口所需的特性(从vnic_typephysnet生成),而resources键包含请求的资源类名与QoS策略请求数量的映射。same_subtree键包含每个资源组的id值的列表。

security_groups

body

数组

应用于端口的安全组的ID。

status

body

字符串

端口状态。值为ACTIVEDOWNBUILDERROR

tags

body

数组

The list of tags on the resource.

tenant_id

body

字符串

项目的 ID。

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

propagate_uplink_status

body

布尔值

端口的上行链路状态传播。有效值为启用(true)和禁用(false)。

mac_learning_enabled (Optional)

body

布尔值

一个布尔值,指示是否在关联端口上启用了MAC学习。

port_trusted_vif

body

布尔值

端口的可信VIF状态。有效值为truefalse。此字段的值将包含在端口的binding:profile字典中。

响应示例

{
    "port": {
        "admin_state_up": true,
        "allowed_address_pairs": [],
        "created_at": "2016-03-08T20:19:41",
        "data_plane_status": "ACTIVE",
        "description": "",
        "device_id": "5e3898d7-11be-483e-9732-b2f5eccd2b2e",
        "device_owner": "network:router_interface",
        "dns_assignment": [
            {
                "hostname": "myport",
                "ip_address": "10.0.0.1",
                "fqdn": "myport.my-domain.org"
            }
        ],
        "dns_domain": "my-domain.org.",
        "dns_name": "myport",
        "extra_dhcp_opts": [
            {
                "opt_value": "pxelinux.0",
                "ip_version": 4,
                "opt_name": "bootfile-name"
            }
        ],
        "fixed_ips": [
            {
                "ip_address": "10.0.0.1",
                "subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2"
            }
        ],
        "id": "46d4bfb9-b26e-41f3-bd2e-e6dcc1ccedb2",
        "ip_allocation": "immediate",
        "mac_address": "fa:16:3e:23:fd:d7",
        "name": "",
        "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7",
        "port_security_enabled": false,
        "project_id": "7e02058126cc4950b75f9970368ba177",
        "revision_number": 1,
        "security_groups": [],
        "status": "ACTIVE",
        "tags": ["tag1,tag2"],
        "tenant_id": "7e02058126cc4950b75f9970368ba177",
        "updated_at": "2016-03-08T20:19:41",
        "qos_network_policy_id": "174dd0c1-a4eb-49d4-a807-ae80246d82f4",
        "qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae",
        "propagate_uplink_status": false,
        "hardware_offload_type": ""
    }
}

响应示例(管理员用户)

{
    "port": {
        "admin_state_up": true,
        "allowed_address_pairs": [],
        "binding:host_id": "devstack",
        "binding:profile": {},
        "binding:vif_details": {
            "ovs_hybrid_plug": true,
            "port_filter": true
        },
        "binding:vif_type": "ovs",
        "binding:vnic_type": "normal",
        "created_at": "2016-03-08T20:19:41",
        "data_plane_status": "ACTIVE",
        "description": "",
        "device_id": "5e3898d7-11be-483e-9732-b2f5eccd2b2e",
        "device_owner": "network:router_interface",
        "dns_assignment": [
            {
                "hostname": "myport",
                "ip_address": "10.0.0.1",
                "fqdn": "myport.my-domain.org"
            }
        ],
        "dns_domain": "my-domain.org.",
        "dns_name": "myport",
        "extra_dhcp_opts": [
            {
                "opt_value": "pxelinux.0",
                "ip_version": 4,
                "opt_name": "bootfile-name"
            }
        ],
        "fixed_ips": [
            {
                "ip_address": "10.0.0.1",
                "subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2"
            }
        ],
        "id": "46d4bfb9-b26e-41f3-bd2e-e6dcc1ccedb2",
        "ip_allocation": "immediate",
        "mac_address": "fa:16:3e:23:fd:d7",
        "mac_learning_enabled": false,
        "name": "",
        "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7",
        "port_security_enabled": false,
        "project_id": "7e02058126cc4950b75f9970368ba177",
        "revision_number": 1,
        "security_groups": [],
        "status": "ACTIVE",
        "tags": ["tag1,tag2"],
        "tenant_id": "7e02058126cc4950b75f9970368ba177",
        "updated_at": "2016-03-08T20:19:41",
        "qos_network_policy_id": "174dd0c1-a4eb-49d4-a807-ae80246d82f4",
        "qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae",
        "resource_request": {
            "request_groups": [
                {
                    "id": "1e4f3958-c0c9-4dec-82fa-ed2dc1c5cb34",
                    "required": ["CUSTOM_VNIC_TYPE_NORMAL"],
                    "resources": {
                        "NET_PACKET_RATE_KILOPACKET_PER_SEC": 1000
                    }
                },
                {
                    "id": "b20bb47f-5d6d-45a6-8fe7-2c1b44f0db73",
                    "required": [
                        "CUSTOM_PHYSNET_PUBLIC", "CUSTOM_VNIC_TYPE_NORMAL"],
                    "resources": {
                        "NET_BW_EGR_KILOBIT_PER_SEC": 1000
                    }
                }
            ],
            "same_subtree": [
                "1e4f3958-c0c9-4dec-82fa-ed2dc1c5cb34",
                "b20bb47f-5d6d-45a6-8fe7-2c1b44f0db73"
            ]
        },
        "propagate_uplink_status": false,
        "hardware_offload_type": "",
        "trusted": true
    }
}
PUT
/v2.0/ports/{port_id}

更新端口

更新端口。

您可以更新端口的信息,例如其符号名称和关联的IP。当您更新端口的IP时,所有先前关联的IP都会被移除,返回到相应的子网分配池,并被请求体中的IP替换。因此,当您在请求体中指定fixed_ip属性时,此操作会替换该属性。如果更新的IP地址无效或已被使用,操作将失败,并且现有的IP地址不会从端口中移除。

当您更新端口的安全组并操作成功时,所有关联的安全组将被移除,并被请求体中的安全组替换。因此,当您在请求体中指定security_groups属性时,此操作会替换该属性。如果安全组无效,操作将失败,并且现有的安全组不会从端口中移除。

当您将端口的binding:profile更新为null时,在响应中它将被视为{}。

binding:vnic_type属性只能在未绑定的端口上更新。如果端口已绑定,该属性的更新操作将返回Conflict (409)响应代码。

只有管理员和具有特定角色的用户才能更新数据平面状态(默认角色:data_plane_integrator)。

正常响应代码:200

错误响应代码:400、401、403、404、409、412

请求

名称

入参

类型

描述

port_id

路径

字符串

端口的ID。

port

body

对象

一个port对象。

admin_state_up (Optional)

body

布尔值

资源的管理状态,为开启(true)或关闭(false)。默认为true

allowed_address_pairs (Optional)

body

数组

一个零个或多个允许的地址对对象的集合,每个地址对对象包含一个ip_address和一个mac_addressip_address是必需的,而mac_address如果未指定,将从端口获取。ip_address的值可以是IP地址或CIDR(如果底层扩展插件支持)。连接到端口的服务器可以发送源地址与指定的允许地址对之一匹配的数据包。

binding:host_id (Optional)

body

字符串

端口所在主机的ID。默认为空字符串。

binding:profile (Optional)

body

对象

一个字典,允许特定主机上运行的应用程序传递和接收特定于网络后端的vif端口信息。此字段仅用于机器到机器通信,供Nova、Ironic或Zun等计算服务将信息传递给Neutron后端。它不应被多个服务并发使用,也不应被云终端用户使用。现有的反例(Open vSwitch硬件卸载的capabilities: [switchdev]和受信任虚拟函数的trusted=true)将被清理。网络API不定义此字段的特定格式。默认为空字典。如果您将其更新为null,则在响应中将其视为{}。自端口MAC地址覆盖扩展以来,binding:profile字段的device_mac_address可用于提供直接物理端口绑定的物理设备的MAC地址。如果提供,则端口资源的mac_address字段将更新为活动绑定中的MAC。

binding:vnic_type (Optional)

body

字符串

此端口应连接的vNIC类型。这用于确定要用于绑定端口的机制驱动程序。有效值为normalmacvtapdirectbaremetaldirect-physicalvirtio-forwardersmart-nicremote-managed。实际可用的vNIC类型取决于部署。默认为normal

data_plane_status (Optional)

body

字符串

端口底层数据平面的状态。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

device_id (Optional)

body

字符串

使用此端口的设备的ID。例如,服务器实例或逻辑路由器。

device_owner (Optional)

body

字符串

使用此端口的实体类型。例如,compute:nova(服务器实例)、network:dhcp(DHCP代理)或network:router_interface(路由器接口)。

dns_domain (Optional)

body

字符串

A valid DNS domain.

dns_name (Optional)

body

字符串

有效的DNS名称。

extra_dhcp_opts (Optional)

body

数组

零个或多个额外DHCP选项对的集合。一个选项对由选项值和选项名称组成。

fixed_ips (Optional)

body

数组

端口的IP地址。如果您想为端口分配多个IP地址,请在此字段中指定多个条目。每个条目包括IP地址(ip_address)以及分配IP地址的子网ID(subnet_id)。

  • 如果您同时指定了子网ID和IP地址,OpenStack Networking将尝试将该IP地址分配给该子网中的端口。

  • 如果您仅指定了子网ID,OpenStack Networking将从该子网中分配一个可用的IP给端口。

  • 如果您仅指定了IP地址,OpenStack Networking将尝试分配该IP地址,前提是该地址对于指定网络中的任何子网都是有效IP。

hints (可选)

body

对象

仅限管理员。一个字典,顶层键为机制驱动程序的别名(如setup.cfg中所定义)。以下值可用于控制Open vSwitch的用户空间Tx数据包转向功能

  • {"openvswitch": {"other_config": {"tx-steering": "hash"}}}

  • {"openvswitch": {"other_config": {"tx-steering": "thread"}}}

如果省略,则默认由Open vSwitch定义。该字段长度不能超过4095个字符。

mac_address (Optional)

body

字符串

端口的MAC地址。默认情况下,只有管理员用户和具有advsvc角色的用户可以更改此值。

name (可选)

body

字符串

资源的易读名称。默认情况下为空字符串。

numa_affinity_policy (Optional)

body

字符串

虚拟机调度期间请求的端口NUMA亲和策略。值:Nonerequiredpreferredlegacy

port_security_enabled (Optional)

body

布尔值

端口安全状态。有效值为启用(true)或禁用(false)。如果端口启用了端口安全,则安全组规则和防欺骗规则将应用于端口上的流量。如果禁用,则不应用这些规则。

propagate_uplink_status

body

布尔值

端口的上行链路状态传播。有效值为启用(true)和禁用(false)。

qos_policy_id (Optional)

body

字符串

与端口关联的QoS策略。

security_groups (可选)

body

数组

应用于端口的安全组的ID。

mac_learning_enabled (Optional)

body

布尔值

一个布尔值,指示是否在关联端口上启用了MAC学习。

port_trusted_vif (Optional)

body

布尔值

端口的可信VIF状态。有效值为truefalse。此字段的值将包含在端口的binding:profile字典中。

请求示例

{
    "port": {
        "admin_state_up": true,
        "device_id": "d90a13da-be41-461f-9f99-1dbcf438fdf2",
        "device_owner": "compute:nova",
        "name": "test-for-port-update",
        "qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae",
        "propagate_uplink_status": true
    }
}

请求示例(管理员用户)

{
    "port": {
        "binding:host_id": "test_for_port_update_host",
        "binding:profile": null,
        "device_id": "d90a13da-be41-461f-9f99-1dbcf438fdf2",
        "data_plane_status": "DOWN",
        "device_owner": "compute:nova",
        "qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae"
    }
}

响应参数

名称

入参

类型

描述

port

body

对象

一个port对象。

admin_state_up

body

布尔值

资源的管理状态,为开启(true)或关闭(false)。

allowed_address_pairs

body

数组

一个零个或多个允许的地址对对象的集合,每个地址对对象包含一个ip_address和一个mac_addressip_address是必需的,而mac_address如果未指定,将从端口获取。ip_address的值可以是IP地址或CIDR(如果底层扩展插件支持)。连接到端口的服务器可以发送源地址与指定的允许地址对之一匹配的数据包。

binding:host_id

body

字符串

端口所在主机的ID。

binding:profile

body

对象

一个字典,允许特定主机上运行的应用程序传递和接收特定于网络后端的vif端口信息。网络API不定义此字段的特定格式。如果更新请求为null,则此响应字段将为{}。

binding:vif_details

body

对象

一个包含端口附加信息的字典。目前定义的字段有:port_filterovs_hybrid_plugport_filter是一个布尔值,指示网络服务是否提供端口过滤功能,如安全组和/或防MAC/IP欺骗。ovs_hybrid_plug是一个布尔值,用于告知Nova等API消费者是否应使用OVS的混合插件策略。

binding:vif_type

body

字符串

用于端口的机制类型。Nova等API消费者可以使用此信息来确定连接设备的适当方式(例如,虚拟服务器的接口)。目前定义的可用值包括ovsbridgemacvtaphw_vebhostdev_physicalvhostuserdistributedother。还有特殊值:unboundbinding_failedunbound表示端口未绑定到网络后端。binding_failed表示端口绑定到网络后端失败的错误。

binding:vnic_type

body

字符串

此端口应连接的vNIC类型。这用于确定要用于绑定端口的机制驱动程序。有效值为normalmacvtapdirectbaremetaldirect-physicalvirtio-forwardersmart-nicremote-managed。实际可用的vNIC类型取决于部署。

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

data_plane_status

body

字符串

端口底层数据平面的状态。

description

body

字符串

A human-readable description for the resource.

device_id

body

字符串

使用此端口的设备的ID。例如,服务器实例或逻辑路由器。

device_owner

body

字符串

使用此端口的实体类型。例如,compute:nova(服务器实例)、network:dhcp(DHCP代理)或network:router_interface(路由器接口)。

dns_assignment

body

对象

Networking内部DNS分配给端口的数据,包括hostnameip_addressfqdn

dns_domain

body

字符串

A valid DNS domain.

dns_name

body

字符串

有效的DNS名称。

extra_dhcp_opts

body

数组

零个或多个额外DHCP选项对的集合。一个选项对由选项值和选项名称组成。

fixed_ips

body

数组

端口的IP地址。如果端口有多个IP地址,则此字段有多个条目。每个条目包括IP地址(ip_address)以及分配IP地址的子网ID(subnet_id)。

hints

body

对象

仅限管理员。以下值用于控制Open vSwitch的用户空间Tx数据包转向功能

  • {"openvswitch": {"other_config": {"tx-steering": "hash|thread"}}}

id

body

字符串

资源的ID。

ip_allocation

body

字符串

指示端口何时使用deferredimmediate或无IP分配(none)。

mac_address

body

字符串

端口的MAC地址。如果端口使用direct-physicalvnic_type,则此字段的值将被替换为活动绑定:配置文件中提供的MAC地址(如果有)。

name

body

字符串

Human-readable name of the resource.

network_id

body

字符串

连接网络的 ID。

numa_affinity_policy (Optional)

body

字符串

虚拟机调度期间请求的端口NUMA亲和策略。值:Nonerequiredpreferredlegacy

port_security_enabled

body

布尔值

端口安全状态。有效值为启用(true)或禁用(false)。如果端口启用了端口安全,则安全组规则和防欺骗规则将应用于端口上的流量。如果禁用,则不应用这些规则。

project_id

body

字符串

项目的 ID。

qos_network_policy_id

body

字符串

此端口所连接网络的QoS策略ID。

qos_policy_id

body

字符串

与端口关联的QoS策略ID。

revision_number

body

整数

The revision number of the resource.

resource_request (Optional)

body

对象

将端口请求的Placement资源(例如:minimum-bandwidth)和特性(例如:vnic-typephysnet)暴露给Nova和Placement。resource_request对象包含request_groupssame_subtree键。request_groups是一个字典列表,其中每个字典表示一个需要从单个资源提供者满足的资源和特性组。列表中的每个字典必须包含idrequiredresources键。id字段是一个字符串,表示通过UUID5方法结合port_id和对组有贡献的QoS规则的UUID生成的每个组的唯一UUID。required键包含端口所需的特性(从vnic_typephysnet生成),而resources键包含请求的资源类名与QoS策略请求数量的映射。same_subtree键包含每个资源组的id值的列表。

security_groups

body

数组

应用于端口的安全组的ID。

status

body

字符串

端口状态。值为ACTIVEDOWNBUILDERROR

tags

body

数组

The list of tags on the resource.

tenant_id

body

字符串

项目的 ID。

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

propagate_uplink_status

body

布尔值

端口的上行链路状态传播。有效值为启用(true)和禁用(false)。

mac_learning_enabled (Optional)

body

布尔值

一个布尔值,指示是否在关联端口上启用了MAC学习。

port_trusted_vif

body

布尔值

端口的可信VIF状态。有效值为truefalse。此字段的值将包含在端口的binding:profile字典中。

响应示例

{
    "port": {
        "admin_state_up": true,
        "allowed_address_pairs": [],
        "binding:host_id": "test_for_port_update_host",
        "binding:profile": {},
        "binding:vif_details": {},
        "binding:vif_type": "binding_failed",
        "binding:vnic_type": "normal",
        "created_at": "2016-03-08T20:19:41",
        "data_plane_status": "ACTIVE",
        "description": "",
        "device_id": "d90a13da-be41-461f-9f99-1dbcf438fdf2",
        "device_owner": "compute:nova",
        "dns_assignment": [
            {
                "hostname": "myport",
                "ip_address": "20.20.0.4",
                "fqdn": "myport.my-domain.org"
            }
        ],
        "dns_domain": "my-domain.org.",
        "dns_name": "myport",
        "extra_dhcp_opts": [
            {
                "opt_value": "pxelinux.0",
                "ip_version": 4,
                "opt_name": "bootfile-name"
            }
        ],
        "fixed_ips": [
            {
                "ip_address": "20.20.0.4",
                "subnet_id": "898dec4a-74df-4193-985f-c76721bcc746"
            }
        ],
        "id": "43c831e0-19ce-4a76-9a49-57b57e69428b",
        "ip_allocation": "immediate",
        "mac_address": "fa:16:3e:11:11:5e",
        "name": "test-for-port-update",
        "network_id": "883fc383-5ea1-4c8b-8916-e1ddb0a9f365",
        "project_id": "522eda8d23124b25bf03fe44f1986b74",
        "revision_number": 1,
        "security_groups": [
            "ce0179d6-8a94-4f7c-91c2-f3038e2acbd0"
        ],
        "status": "DOWN",
        "tags": ["tag1,tag2"],
        "tenant_id": "522eda8d23124b25bf03fe44f1986b74",
        "updated_at": "2016-03-08T20:19:41",
        "qos_network_policy_id": "174dd0c1-a4eb-49d4-a807-ae80246d82f4",
        "qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae",
        "port_security_enabled": false,
        "hardware_offload_type": "",
        "trusted": true,
        "propagate_uplink_status": true
    }
}

响应示例(管理员用户)

{
    "port": {
        "admin_state_up": true,
        "allowed_address_pairs": [],
        "binding:host_id": "test_for_port_update_host",
        "binding:profile": {},
        "binding:vif_details": {},
        "binding:vif_type": "binding_failed",
        "binding:vnic_type": "normal",
        "created_at": "2016-03-08T20:19:41",
        "data_plane_status": "DOWN",
        "description": "",
        "device_id": "d90a13da-be41-461f-9f99-1dbcf438fdf2",
        "device_owner": "compute:nova",
        "dns_assignment": [
            {
                "hostname": "myport",
                "ip_address": "20.20.0.4",
                "fqdn": "myport.my-domain.org"
            }
        ],
        "dns_domain": "my-domain.org.",
        "dns_name": "myport",
        "extra_dhcp_opts": [
            {
                "opt_value": "pxelinux.0",
                "ip_version": 4,
                "opt_name": "bootfile-name"
            }
        ],
        "fixed_ips": [
            {
                "ip_address": "20.20.0.4",
                "subnet_id": "898dec4a-74df-4193-985f-c76721bcc746"
            }
        ],
        "id": "43c831e0-19ce-4a76-9a49-57b57e69428b",
        "ip_allocation": "immediate",
        "mac_address": "fa:16:3e:11:11:5e",
        "name": "test-for-port-update",
        "network_id": "883fc383-5ea1-4c8b-8916-e1ddb0a9f365",
        "project_id": "522eda8d23124b25bf03fe44f1986b74",
        "revision_number": 2,
        "security_groups": [
            "ce0179d6-8a94-4f7c-91c2-f3038e2acbd0"
        ],
        "status": "DOWN",
        "tags": ["tag1,tag2"],
        "tenant_id": "522eda8d23124b25bf03fe44f1986b74",
        "updated_at": "2016-03-08T20:19:41",
        "qos_network_policy_id": "174dd0c1-a4eb-49d4-a807-ae80246d82f4",
        "qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae",
        "port_security_enabled": false,
        "resource_request": {
            "request_groups": [
                {
                    "id": "1e4f3958-c0c9-4dec-82fa-ed2dc1c5cb34",
                    "required": ["CUSTOM_VNIC_TYPE_NORMAL"],
                    "resources": {
                        "NET_PACKET_RATE_KILOPACKET_PER_SEC": 1000
                    }
                },
                {
                    "id": "b20bb47f-5d6d-45a6-8fe7-2c1b44f0db73",
                    "required": [
                        "CUSTOM_PHYSNET_PUBLIC", "CUSTOM_VNIC_TYPE_NORMAL"],
                    "resources": {
                        "NET_BW_EGR_KILOBIT_PER_SEC": 1000
                    }
                }
            ],
            "same_subtree": [
                "1e4f3958-c0c9-4dec-82fa-ed2dc1c5cb34",
                "b20bb47f-5d6d-45a6-8fe7-2c1b44f0db73"
            ]
        },
        "propagate_uplink_status": false,
        "hardware_offload_type": "",
        "trusted": true
    }
}
DELETE
/v2.0/ports/{port_id}

删除端口

删除一个端口。

与端口关联的任何IP地址都将返回到相应的子网分配池。

正常响应代码:204

错误响应代码:401、403、404、412

请求

名称

入参

类型

描述

port_id

路径

字符串

端口的ID。

响应

There is no body content for the response of a successful DELETE request.

GET
/v2.0/ports

列出端口

列出用户有权访问的端口。

默认策略设置仅返回属于请求用户所属项目的端口,除非请求是由具有管理员权限的用户提交的。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

如果启用了ip-substring-filtering扩展,Neutron API将支持在fixed_ips属性上进行IP地址子字符串过滤。如果您在fixed_ips属性的条目中指定了一个IP地址子字符串(ip_address_substr),Neutron API将列出所有IP地址与该子字符串匹配的端口。

正常响应代码:200

Error response codes: 401

请求

名称

入参

类型

描述

admin_state_up (Optional)

查询

布尔值

Filter the list result by the administrative state of the resource, which is up (true) or down (false).

binding:host_id (Optional)

查询

字符串

按端口所在主机的ID过滤端口列表结果。

description (可选)

查询

字符串

Filter the list result by the human-readable description of the resource.

device_id (Optional)

查询

字符串

按使用该端口的设备的ID过滤端口列表结果。例如,服务器实例或逻辑路由器。

device_owner (Optional)

查询

字符串

按使用端口的实体类型过滤端口列表结果。例如,compute:nova(服务器实例)、network:dhcp(DHCP代理)或network:router_interface(路由器接口)。

fixed_ips (Optional)

查询

数组

按端口的IP地址过滤端口列表结果。此字段包含一个或多个条目。每个条目包括IP地址(ip_address)、IP地址子字符串(ip_address_substr)和/或分配IP地址的子网ID(subnet_id)。

id (可选)

查询

字符串

Filter the list result by the ID of the resource.

ip_allocation (Optional)

查询

字符串

根据端口是否使用deferredimmediate或无IP分配(none)来过滤端口列表结果。

mac_address (Optional)

查询

字符串

按端口的MAC地址过滤端口列表结果。

name (可选)

查询

字符串

Filter the list result by the human-readable name of the resource.

network_id (Optional)

查询

字符串

按连接网络的ID过滤列表结果。

project_id (可选)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

revision_number (Optional)

查询

整数

Filter the list result by the revision number of the resource.

sort_dir (可选)

查询

字符串

Sort direction. A valid value is asc (ascending) or desc (descending). You can specify multiple pairs of sort key and sort direction query parameters.

sort_key (可选)

查询

字符串

按端口属性排序。您可以指定多个排序键和排序方向查询参数对。排序键限于

  • admin_state_up

  • device_id

  • device_owner

  • id

  • ip_allocation

  • mac_address

  • name

  • network_id

  • project_id

  • status

  • tenant_id

status (可选)

查询

字符串

按端口状态过滤端口列表结果。值为ACTIVEDOWNBUILDERROR

tenant_id (可选)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

tags (可选)

查询

字符串

A list of tags to filter the list result by. Resources that match all tags in this list will be returned. Tags in query must be separated by comma.

tags-any (Optional)

查询

字符串

A list of tags to filter the list result by. Resources that match any tag in this list will be returned. Tags in query must be separated by comma.

not-tags (Optional)

查询

字符串

A list of tags to filter the list result by. Resources that match all tags in this list will be excluded. Tags in query must be separated by comma.

not-tags-any (Optional)

查询

字符串

A list of tags to filter the list result by. Resources that match any tag in this list will be excluded. Tags in query must be separated by comma.

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

mac_learning_enabled (Optional)

查询

布尔值

按资源的mac_learning_enabled状态过滤列表结果,该状态为启用(true)或禁用(false)。

响应参数

名称

入参

类型

描述

ports

body

数组

一个port对象的列表。

admin_state_up

body

布尔值

资源的管理状态,为开启(true)或关闭(false)。

allowed_address_pairs

body

数组

一个零个或多个允许的地址对对象的集合,每个地址对对象包含一个ip_address和一个mac_addressip_address是必需的,而mac_address如果未指定,将从端口获取。ip_address的值可以是IP地址或CIDR(如果底层扩展插件支持)。连接到端口的服务器可以发送源地址与指定的允许地址对之一匹配的数据包。

binding:host_id

body

字符串

端口所在主机的ID。

binding:profile

body

对象

一个字典,允许特定主机上运行的应用程序传递和接收特定于网络后端的vif端口信息。网络API不定义此字段的特定格式。如果更新请求为null,则此响应字段将为{}。

binding:vif_details

body

对象

一个包含端口附加信息的字典。目前定义的字段有:port_filterovs_hybrid_plugport_filter是一个布尔值,指示网络服务是否提供端口过滤功能,如安全组和/或防MAC/IP欺骗。ovs_hybrid_plug是一个布尔值,用于告知Nova等API消费者是否应使用OVS的混合插件策略。

binding:vif_type

body

字符串

用于端口的机制类型。Nova等API消费者可以使用此信息来确定连接设备的适当方式(例如,虚拟服务器的接口)。目前定义的可用值包括ovsbridgemacvtaphw_vebhostdev_physicalvhostuserdistributedother。还有特殊值:unboundbinding_failedunbound表示端口未绑定到网络后端。binding_failed表示端口绑定到网络后端失败的错误。

binding:vnic_type

body

字符串

此端口应连接的vNIC类型。这用于确定要用于绑定端口的机制驱动程序。有效值为normalmacvtapdirectbaremetaldirect-physicalvirtio-forwardersmart-nicremote-managed。实际可用的vNIC类型取决于部署。

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

data_plane_status

body

字符串

端口底层数据平面的状态。

description

body

字符串

A human-readable description for the resource.

device_id

body

字符串

使用此端口的设备的ID。例如,服务器实例或逻辑路由器。

device_owner

body

字符串

使用此端口的实体类型。例如,compute:nova(服务器实例)、network:dhcp(DHCP代理)或network:router_interface(路由器接口)。

dns_assignment

body

对象

Networking内部DNS分配给端口的数据,包括hostnameip_addressfqdn

dns_domain

body

字符串

A valid DNS domain.

dns_name

body

字符串

有效的DNS名称。

extra_dhcp_opts

body

数组

零个或多个额外DHCP选项对的集合。一个选项对由选项值和选项名称组成。

fixed_ips

body

数组

端口的IP地址。如果端口有多个IP地址,则此字段有多个条目。每个条目包括IP地址(ip_address)以及分配IP地址的子网ID(subnet_id)。

hints

body

对象

仅限管理员。以下值用于控制Open vSwitch的用户空间Tx数据包转向功能

  • {"openvswitch": {"other_config": {"tx-steering": "hash|thread"}}}

id

body

字符串

资源的ID。

ip_allocation

body

字符串

指示端口何时使用deferredimmediate或无IP分配(none)。

mac_address

body

字符串

端口的MAC地址。如果端口使用direct-physicalvnic_type,则此字段的值将被替换为活动绑定:配置文件中提供的MAC地址(如果有)。

name

body

字符串

Human-readable name of the resource.

network_id

body

字符串

连接网络的 ID。

numa_affinity_policy (Optional)

body

字符串

虚拟机调度期间请求的端口NUMA亲和策略。值:Nonerequiredpreferredlegacy

port_security_enabled

body

布尔值

端口安全状态。有效值为启用(true)或禁用(false)。如果端口启用了端口安全,则安全组规则和防欺骗规则将应用于端口上的流量。如果禁用,则不应用这些规则。

project_id

body

字符串

项目的 ID。

qos_network_policy_id

body

字符串

此端口所连接网络的QoS策略ID。

qos_policy_id

body

字符串

与端口关联的QoS策略ID。

revision_number

body

整数

The revision number of the resource.

resource_request (Optional)

body

对象

将端口请求的Placement资源(例如:minimum-bandwidth)和特性(例如:vnic-typephysnet)暴露给Nova和Placement。resource_request对象包含request_groupssame_subtree键。request_groups是一个字典列表,其中每个字典表示一个需要从单个资源提供者满足的资源和特性组。列表中的每个字典必须包含idrequiredresources键。id字段是一个字符串,表示通过UUID5方法结合port_id和对组有贡献的QoS规则的UUID生成的每个组的唯一UUID。required键包含端口所需的特性(从vnic_typephysnet生成),而resources键包含请求的资源类名与QoS策略请求数量的映射。same_subtree键包含每个资源组的id值的列表。

security_groups

body

数组

应用于端口的安全组的ID。

status

body

字符串

端口状态。值为ACTIVEDOWNBUILDERROR

tags

body

数组

The list of tags on the resource.

tenant_id

body

字符串

项目的 ID。

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

propagate_uplink_status

body

布尔值

端口的上行链路状态传播。有效值为启用(true)和禁用(false)。

mac_learning_enabled (Optional)

body

布尔值

一个布尔值,指示是否在关联端口上启用了MAC学习。

port_trusted_vif

body

布尔值

端口的可信VIF状态。有效值为truefalse。此字段的值将包含在端口的binding:profile字典中。

响应示例

{
    "ports": [
        {
            "admin_state_up": true,
            "allowed_address_pairs": [],
            "created_at": "2016-03-08T20:19:41",
            "data_plane_status": null,
            "description": "",
            "device_id": "9ae135f4-b6e0-4dad-9e91-3c223e385824",
            "device_owner": "network:router_gateway",
            "dns_assignment": [
                {
                    "hostname": "myport",
                    "ip_address": "172.24.4.2",
                    "fqdn": "myport.my-domain.org"
                }
            ],
            "dns_domain": "my-domain.org.",
            "dns_name": "myport",
            "extra_dhcp_opts": [
            {
                "opt_value": "pxelinux.0",
                "ip_version": 4,
                "opt_name": "bootfile-name"
            }
            ],
            "fixed_ips": [
                {
                    "ip_address": "172.24.4.2",
                    "subnet_id": "008ba151-0b8c-4a67-98b5-0d2b87666062"
                }
            ],
            "id": "d80b1a3b-4fc1-49f3-952e-1e2ab7081d8b",
            "ip_allocation": "immediate",
            "mac_address": "fa:16:3e:58:42:ed",
            "name": "",
            "network_id": "70c1db1f-b701-45bd-96e0-a313ee3430b3",
            "project_id": "",
            "revision_number": 1,
            "security_groups": [],
            "status": "ACTIVE",
            "tags": ["tag1,tag2"],
            "tenant_id": "",
            "updated_at": "2016-03-08T20:19:41",
            "qos_network_policy_id": "174dd0c1-a4eb-49d4-a807-ae80246d82f4",
            "qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae",
            "port_security_enabled": false,
            "propagate_uplink_status": false
        },
        {
            "admin_state_up": true,
            "allowed_address_pairs": [],
            "created_at": "2016-03-08T20:19:41",
            "data_plane_status": null,
            "description": "",
            "device_id": "9ae135f4-b6e0-4dad-9e91-3c223e385824",
            "device_owner": "network:router_interface",
            "dns_assignment": [
                {
                    "hostname": "myport2",
                    "ip_address": "10.0.0.1",
                    "fqdn": "myport2.my-domain.org"
                }
            ],
            "dns_domain": "my-domain.org.",
            "dns_name": "myport2",
            "extra_dhcp_opts": [
                {
                    "opt_value": "pxelinux.0",
                    "ip_version": 4,
                    "opt_name": "bootfile-name"
                }
            ],
            "fixed_ips": [
                {
                    "ip_address": "10.0.0.1",
                    "subnet_id": "288bf4a1-51ba-43b6-9d0a-520e9005db17"
                }
            ],
            "id": "f71a6703-d6de-4be1-a91a-a570ede1d159",
            "ip_allocation": "immediate",
            "mac_address": "fa:16:3e:bb:3c:e4",
            "name": "",
            "network_id": "f27aa545-cbdd-4907-b0c6-c9e8b039dcc2",
            "project_id": "d397de8a63f341818f198abb0966f6f3",
            "revision_number": 1,
            "security_groups": [],
            "status": "ACTIVE",
            "tags": ["tag1,tag2"],
            "tenant_id": "d397de8a63f341818f198abb0966f6f3",
            "updated_at": "2016-03-08T20:19:41",
            "qos_network_policy_id": null,
            "qos_policy_id": null,
            "port_security_enabled": false,
            "propagate_uplink_status": false
        }
    ]
}

响应示例(管理员用户)

{
    "ports": [
        {
            "admin_state_up": true,
            "allowed_address_pairs": [],
            "binding:host_id": "devstack",
            "binding:profile": {},
            "binding:vif_details": {
                "ovs_hybrid_plug": true,
                "port_filter": true
            },
            "binding:vif_type": "ovs",
            "binding:vnic_type": "normal",
            "created_at": "2016-03-08T20:19:41",
            "data_plane_status": null,
            "description": "",
            "device_id": "9ae135f4-b6e0-4dad-9e91-3c223e385824",
            "device_owner": "network:router_gateway",
            "dns_assignment": [
                {
                    "hostname": "myport",
                    "ip_address": "172.24.4.2",
                    "fqdn": "myport.my-domain.org"
                }
            ],
            "dns_domain": "my-domain.org.",
            "dns_name": "myport",
            "extra_dhcp_opts": [],
            "fixed_ips": [
                {
                    "ip_address": "172.24.4.2",
                    "subnet_id": "008ba151-0b8c-4a67-98b5-0d2b87666062"
                }
            ],
            "id": "d80b1a3b-4fc1-49f3-952e-1e2ab7081d8b",
            "ip_allocation": "immediate",
            "mac_address": "fa:16:3e:58:42:ed",
            "name": "",
            "network_id": "70c1db1f-b701-45bd-96e0-a313ee3430b3",
            "port_security_enabled": true,
            "project_id": "",
            "revision_number": 1,
            "security_groups": [],
            "status": "ACTIVE",
            "updated_at": "2016-03-08T20:19:41",
            "qos_network_policy_id": null,
            "qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae",
            "resource_request": {
                "request_groups": [
                    {
                        "id": "1e4f3958-c0c9-4dec-82fa-ed2dc1c5cb34",
                        "required": ["CUSTOM_VNIC_TYPE_NORMAL"],
                        "resources": {
                            "NET_PACKET_RATE_KILOPACKET_PER_SEC": 1000
                        }
                    },
                    {
                        "id": "b20bb47f-5d6d-45a6-8fe7-2c1b44f0db73",
                        "required": [
                            "CUSTOM_PHYSNET_PUBLIC", "CUSTOM_VNIC_TYPE_NORMAL"],
                        "resources": {
                            "NET_BW_EGR_KILOBIT_PER_SEC": 1000
                        }
                    }
                ],
                "same_subtree": [
                    "1e4f3958-c0c9-4dec-82fa-ed2dc1c5cb34",
                    "b20bb47f-5d6d-45a6-8fe7-2c1b44f0db73"
                ]
            },
            "tags": ["tag1,tag2"],
            "tenant_id": "",
            "propagate_uplink_status": false,
            "hardware_offload_type": "",
            "trusted": true
        },
        {
            "admin_state_up": true,
            "allowed_address_pairs": [],
            "binding:host_id": "devstack",
            "binding:profile": {},
            "binding:vif_details": {
                "ovs_hybrid_plug": true,
                "port_filter": true
            },
            "binding:vif_type": "ovs",
            "binding:vnic_type": "normal",
            "created_at": "2016-03-08T20:19:41",
            "data_plane_status": null,
            "description": "",
            "device_id": "9ae135f4-b6e0-4dad-9e91-3c223e385824",
            "device_owner": "network:router_interface",
            "dns_assignment": [
                {
                    "hostname": "myport2",
                    "ip_address": "10.0.0.1",
                    "fqdn": "myport2.my-domain.org"
                }
            ],
            "dns_domain": "my-domain.org.",
            "dns_name": "myport2",
            "extra_dhcp_opts": [],
            "fixed_ips": [
                {
                    "ip_address": "10.0.0.1",
                    "subnet_id": "288bf4a1-51ba-43b6-9d0a-520e9005db17"
                }
            ],
            "id": "f71a6703-d6de-4be1-a91a-a570ede1d159",
            "ip_allocation": "immediate",
            "mac_address": "fa:16:3e:bb:3c:e4",
            "name": "",
            "network_id": "f27aa545-cbdd-4907-b0c6-c9e8b039dcc2",
            "port_security_enabled": true,
            "project_id": "d397de8a63f341818f198abb0966f6f3",
            "revision_number": 2,
            "security_groups": [],
            "status": "ACTIVE",
            "updated_at": "2016-03-08T20:19:41",
            "qos_network_policy_id": "174dd0c1-a4eb-49d4-a807-ae80246d82f4",
            "qos_policy_id": null,
            "tags": ["tag1,tag2"],
            "tenant_id": "d397de8a63f341818f198abb0966f6f3",
            "propagate_uplink_status": false,
            "hardware_offload_type": "",
            "trusted": false
        }
    ]
}
POST
/v2.0/ports

创建端口

在网络上创建一个端口。

要定义创建端口的网络,请在请求体中指定network_id属性。

正常响应代码:201

错误响应代码:400、401、403、404

请求

名称

入参

类型

描述

port

body

对象

一个port对象。

admin_state_up (Optional)

body

布尔值

资源的管理状态,为开启(true)或关闭(false)。默认为true

allowed_address_pairs (Optional)

body

数组

一个零个或多个允许的地址对对象的集合,每个地址对对象包含一个ip_address和一个mac_addressip_address是必需的,而mac_address如果未指定,将从端口获取。ip_address的值可以是IP地址或CIDR(如果底层扩展插件支持)。连接到端口的服务器可以发送源地址与指定的允许地址对之一匹配的数据包。

binding:host_id (Optional)

body

字符串

端口所在主机的ID。默认为空字符串。

binding:profile (Optional)

body

对象

一个字典,允许特定主机上运行的应用程序传递和接收特定于网络后端的vif端口信息。此字段仅用于机器到机器通信,供Nova、Ironic或Zun等计算服务将信息传递给Neutron后端。它不应被多个服务并发使用,也不应被云终端用户使用。现有的反例(Open vSwitch硬件卸载的capabilities: [switchdev]和受信任虚拟函数的trusted=true)将被清理。网络API不定义此字段的特定格式。默认为空字典。如果您将其更新为null,则在响应中将其视为{}。自端口MAC地址覆盖扩展以来,binding:profile字段的device_mac_address可用于提供直接物理端口绑定的物理设备的MAC地址。如果提供,则端口资源的mac_address字段将更新为活动绑定中的MAC。

binding:vnic_type (Optional)

body

字符串

此端口应连接的vNIC类型。这用于确定要用于绑定端口的机制驱动程序。有效值为normalmacvtapdirectbaremetaldirect-physicalvirtio-forwardersmart-nicremote-managed。实际可用的vNIC类型取决于部署。默认为normal

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

device_id (Optional)

body

字符串

使用此端口的设备的ID。例如,服务器实例或逻辑路由器。

device_owner (Optional)

body

字符串

使用此端口的实体类型。例如,compute:nova(服务器实例)、network:dhcp(DHCP代理)或network:router_interface(路由器接口)。

dns_domain (Optional)

body

字符串

A valid DNS domain.

dns_name (Optional)

body

字符串

有效的DNS名称。

extra_dhcp_opts (Optional)

body

数组

零个或多个额外DHCP选项对的集合。一个选项对由选项值和选项名称组成。

fixed_ips (Optional)

body

数组

端口的IP地址。如果您想为端口分配多个IP地址,请在此字段中指定多个条目。每个条目包括IP地址(ip_address)以及分配IP地址的子网ID(subnet_id)。

  • 如果您同时指定了子网ID和IP地址,OpenStack Networking将尝试将该IP地址分配给该子网中的端口。

  • 如果您仅指定了子网ID,OpenStack Networking将从该子网中分配一个可用的IP给端口。

  • 如果您仅指定了IP地址,OpenStack Networking将尝试分配该IP地址,前提是该地址对于指定网络中的任何子网都是有效IP。

hints (可选)

body

对象

仅限管理员。一个字典,顶层键为机制驱动程序的别名(如setup.cfg中所定义)。以下值可用于控制Open vSwitch的用户空间Tx数据包转向功能

  • {"openvswitch": {"other_config": {"tx-steering": "hash"}}}

  • {"openvswitch": {"other_config": {"tx-steering": "thread"}}}

如果省略,则默认由Open vSwitch定义。该字段长度不能超过4095个字符。

mac_address (Optional)

body

字符串

端口的MAC地址。如果未指定,将自动生成MAC地址。

name (可选)

body

字符串

资源的易读名称。默认情况下为空字符串。

network_id

body

字符串

连接网络的 ID。

numa_affinity_policy (Optional)

body

字符串

虚拟机调度期间请求的端口NUMA亲和策略。值:Nonerequiredpreferredlegacy

port_security_enabled (Optional)

body

布尔值

端口安全状态。有效值为启用(true)或禁用(false)。如果端口启用了端口安全,则安全组规则和防欺骗规则将应用于端口上的流量。如果禁用,则不应用这些规则。

project_id (可选)

body

字符串

The ID of the project that owns the resource. Only administrative and users with advsvc role can specify a project ID other than their own. You cannot change this value through authorization policies.

qos_policy_id (Optional)

body

字符串

与端口关联的QoS策略。

security_groups (可选)

body

数组

应用于端口的安全组的ID。

tenant_id (可选)

body

字符串

The ID of the project that owns the resource. Only administrative and users with advsvc role can specify a project ID other than their own. You cannot change this value through authorization policies.

propagate_uplink_status (Optional)

body

布尔值

端口的上行链路状态传播。有效值为启用(true)和禁用(false)。

mac_learning_enabled (Optional)

body

布尔值

一个布尔值,指示是否在关联端口上启用了MAC学习。

port_trusted_vif (Optional)

body

布尔值

端口的可信VIF状态。有效值为truefalse。此字段的值将包含在端口的binding:profile字典中。

请求示例

{
    "port": {
        "admin_state_up": true,
        "dns_domain": "my-domain.org.",
        "dns_name": "myport",
        "name": "private-port",
        "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7",
        "qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae",
        "port_security_enabled": true,
        "allowed_address_pairs": [
            {
                "ip_address": "12.12.11.12",
                "mac_address": "fa:14:2a:b3:cb:f0"
            }
        ],
        "propagate_uplink_status": false,
        "hardware_offload_type": "",
        "trusted": true
    }
}

请求示例(管理员用户)

{
    "port": {
        "binding:host_id": "4df8d9ff-6f6f-438f-90a1-ef660d4586ad",
        "binding:profile": {
            "local_link_information": [
                {
                    "port_id": "Ethernet3/1",
                    "switch_id": "0a:1b:2c:3d:4e:5f",
                    "switch_info": "switch1"
                }
            ]
        },
        "binding:vnic_type": "baremetal",
        "device_id": "d90a13da-be41-461f-9f99-1dbcf438fdf2",
        "device_owner": "baremetal:none",
        "dns_domain": "my-domain.org.",
        "dns_name": "myport",
        "hints": {"openvswitch": {"other_config": {"tx-steering": "hash"}}},
        "qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae",
        "propagate_uplink_status": false,
        "trusted": true
    }
}

响应参数

名称

入参

类型

描述

port

body

对象

一个port对象。

admin_state_up

body

布尔值

资源的管理状态,为开启(true)或关闭(false)。

allowed_address_pairs

body

数组

一个零个或多个允许的地址对对象的集合,每个地址对对象包含一个ip_address和一个mac_addressip_address是必需的,而mac_address如果未指定,将从端口获取。ip_address的值可以是IP地址或CIDR(如果底层扩展插件支持)。连接到端口的服务器可以发送源地址与指定的允许地址对之一匹配的数据包。

binding:host_id

body

字符串

端口所在主机的ID。

binding:profile

body

对象

一个字典,允许特定主机上运行的应用程序传递和接收特定于网络后端的vif端口信息。网络API不定义此字段的特定格式。如果更新请求为null,则此响应字段将为{}。

binding:vif_details

body

对象

一个包含端口附加信息的字典。目前定义的字段有:port_filterovs_hybrid_plugport_filter是一个布尔值,指示网络服务是否提供端口过滤功能,如安全组和/或防MAC/IP欺骗。ovs_hybrid_plug是一个布尔值,用于告知Nova等API消费者是否应使用OVS的混合插件策略。

binding:vif_type

body

字符串

用于端口的机制类型。Nova等API消费者可以使用此信息来确定连接设备的适当方式(例如,虚拟服务器的接口)。目前定义的可用值包括ovsbridgemacvtaphw_vebhostdev_physicalvhostuserdistributedother。还有特殊值:unboundbinding_failedunbound表示端口未绑定到网络后端。binding_failed表示端口绑定到网络后端失败的错误。

binding:vnic_type

body

字符串

此端口应连接的vNIC类型。这用于确定要用于绑定端口的机制驱动程序。有效值为normalmacvtapdirectbaremetaldirect-physicalvirtio-forwardersmart-nicremote-managed。实际可用的vNIC类型取决于部署。

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

data_plane_status

body

字符串

端口底层数据平面的状态。

description

body

字符串

A human-readable description for the resource.

device_id

body

字符串

使用此端口的设备的ID。例如,服务器实例或逻辑路由器。

device_owner

body

字符串

使用此端口的实体类型。例如,compute:nova(服务器实例)、network:dhcp(DHCP代理)或network:router_interface(路由器接口)。

dns_assignment

body

对象

Networking内部DNS分配给端口的数据,包括hostnameip_addressfqdn

dns_domain

body

字符串

A valid DNS domain.

dns_name

body

字符串

有效的DNS名称。

extra_dhcp_opts

body

数组

零个或多个额外DHCP选项对的集合。一个选项对由选项值和选项名称组成。

fixed_ips

body

数组

端口的IP地址。如果端口有多个IP地址,则此字段有多个条目。每个条目包括IP地址(ip_address)以及分配IP地址的子网ID(subnet_id)。

hints

body

对象

仅限管理员。以下值用于控制Open vSwitch的用户空间Tx数据包转向功能

  • {"openvswitch": {"other_config": {"tx-steering": "hash|thread"}}}

id

body

字符串

资源的ID。

ip_allocation

body

字符串

指示端口何时使用deferredimmediate或无IP分配(none)。

mac_address

body

字符串

端口的MAC地址。如果端口使用direct-physicalvnic_type,则此字段的值将被替换为活动绑定:配置文件中提供的MAC地址(如果有)。

name

body

字符串

Human-readable name of the resource.

network_id

body

字符串

连接网络的 ID。

numa_affinity_policy (Optional)

body

字符串

虚拟机调度期间请求的端口NUMA亲和策略。值:Nonerequiredpreferredlegacy

port_security_enabled

body

布尔值

端口安全状态。有效值为启用(true)或禁用(false)。如果端口启用了端口安全,则安全组规则和防欺骗规则将应用于端口上的流量。如果禁用,则不应用这些规则。

project_id

body

字符串

项目的 ID。

qos_network_policy_id

body

字符串

此端口所连接网络的QoS策略ID。

qos_policy_id

body

字符串

与端口关联的QoS策略ID。

revision_number

body

整数

The revision number of the resource.

resource_request (Optional)

body

对象

将端口请求的Placement资源(例如:minimum-bandwidth)和特性(例如:vnic-typephysnet)暴露给Nova和Placement。resource_request对象包含request_groupssame_subtree键。request_groups是一个字典列表,其中每个字典表示一个需要从单个资源提供者满足的资源和特性组。列表中的每个字典必须包含idrequiredresources键。id字段是一个字符串,表示通过UUID5方法结合port_id和对组有贡献的QoS规则的UUID生成的每个组的唯一UUID。required键包含端口所需的特性(从vnic_typephysnet生成),而resources键包含请求的资源类名与QoS策略请求数量的映射。same_subtree键包含每个资源组的id值的列表。

security_groups

body

数组

应用于端口的安全组的ID。

status

body

字符串

端口状态。值为ACTIVEDOWNBUILDERROR

tags

body

数组

The list of tags on the resource.

tenant_id

body

字符串

项目的 ID。

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

propagate_uplink_status

body

布尔值

端口的上行链路状态传播。有效值为启用(true)和禁用(false)。

mac_learning_enabled (Optional)

body

布尔值

一个布尔值,指示是否在关联端口上启用了MAC学习。

port_trusted_vif

body

布尔值

端口的可信VIF状态。有效值为truefalse。此字段的值将包含在端口的binding:profile字典中。

响应示例

{
    "port": {
        "admin_state_up": true,
        "allowed_address_pairs": [
            {
                "ip_address": "12.12.11.12",
                "mac_address": "fa:14:2a:b3:cb:f0"
            }
        ],
        "created_at": "2016-03-08T20:19:41",
        "data_plane_status": null,
        "description": "",
        "device_id": "",
        "device_owner": "",
        "dns_assignment": [
            {
                "hostname": "myport",
                "ip_address": "10.0.0.2",
                "fqdn": "myport.my-domain.org"
            }
        ],
        "dns_domain": "my-domain.org.",
        "dns_name": "myport",
        "extra_dhcp_opts": [
            {
                "opt_value": "pxelinux.0",
                "ip_version": 4,
                "opt_name": "bootfile-name"
            }
        ],
        "fixed_ips": [
            {
                "ip_address": "10.0.0.2",
                "subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2"
            }
        ],
        "id": "65c0ee9f-d634-4522-8954-51021b570b0d",
        "ip_allocation": "immediate",
        "mac_address": "fa:16:3e:c9:cb:f0",
        "name": "private-port",
        "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7",
        "port_security_enabled": true,
        "project_id": "d6700c0c9ffa4f1cb322cd4a1f3906fa",
        "revision_number": 1,
        "security_groups": [
            "f0ac4394-7e4a-4409-9701-ba8be283dbc3"
        ],
        "status": "DOWN",
        "tags": ["tag1,tag2"],
        "tenant_id": "d6700c0c9ffa4f1cb322cd4a1f3906fa",
        "updated_at": "2016-03-08T20:19:41",
        "qos_network_policy_id": "174dd0c1-a4eb-49d4-a807-ae80246d82f4",
        "qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae",
        "propagate_uplink_status": false,
        "hardware_offload_type": "",
        "trusted": true
    }
}

响应示例(管理员用户)

{
    "port": {
        "admin_state_up": true,
        "allowed_address_pairs": [
            {
                "ip_address": "12.12.11.12",
                "mac_address": "fa:14:2a:b3:cb:f0"
            }
        ],
        "binding:host_id": "4df8d9ff-6f6f-438f-90a1-ef660d4586ad",
        "binding:profile": {
            "local_link_information": [
                {
                    "port_id": "Ethernet3/1",
                    "switch_id": "0a:1b:2c:3d:4e:5f",
                    "switch_info": "switch1"
                }
            ]
        },
        "binding:vif_details": {},
        "binding:vif_type": "unbound",
        "binding:vnic_type": "other",
        "created_at": "2016-03-08T20:19:41",
        "data_plane_status": null,
        "description": "",
        "device_id": "d90a13da-be41-461f-9f99-1dbcf438fdf2",
        "device_owner": "baremetal:none",
        "dns_assignment": [
            {
                "hostname": "myport",
                "ip_address": "10.0.0.2",
                "fqdn": "myport.my-domain.org"
            }
        ],
        "dns_domain": "my-domain.org.",
        "dns_name": "myport",
        "extra_dhcp_opts": [
            {
                "opt_value": "pxelinux.0",
                "ip_version": 4,
                "opt_name": "bootfile-name"
            }
        ],
        "fixed_ips": [
            {
                "ip_address": "10.0.0.2",
                "subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2"
            }
        ],
        "hints": {"openvswitch": {"other_config": {"tx-steering": "hash"}}},
        "id": "65c0ee9f-d634-4522-8954-51021b570b0d",
        "ip_allocation": "immediate",
        "mac_address": "fa:16:3e:c9:cb:f0",
        "name": "private-port",
        "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7",
        "project_id": "d6700c0c9ffa4f1cb322cd4a1f3906fa",
        "revision_number": 1,
        "security_groups": [
            "f0ac4394-7e4a-4409-9701-ba8be283dbc3"
        ],
        "status": "DOWN",
        "tags": ["tag1,tag2"],
        "tenant_id": "d6700c0c9ffa4f1cb322cd4a1f3906fa",
        "updated_at": "2016-03-08T20:19:41",
        "qos_network_policy_id": "174dd0c1-a4eb-49d4-a807-ae80246d82f4",
        "qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae",
        "port_security_enabled": true,
        "resource_request": {
            "request_groups": [
                {
                    "id": "1e4f3958-c0c9-4dec-82fa-ed2dc1c5cb34",
                    "required": ["CUSTOM_VNIC_TYPE_NORMAL"],
                    "resources": {
                        "NET_PACKET_RATE_KILOPACKET_PER_SEC": 1000
                    }
                },
                {
                    "id": "b20bb47f-5d6d-45a6-8fe7-2c1b44f0db73",
                    "required": [
                        "CUSTOM_PHYSNET_PUBLIC", "CUSTOM_VNIC_TYPE_NORMAL"],
                    "resources": {
                        "NET_BW_EGR_KILOBIT_PER_SEC": 1000
                    }
                }
            ],
            "same_subtree": [
                "1e4f3958-c0c9-4dec-82fa-ed2dc1c5cb34",
                "b20bb47f-5d6d-45a6-8fe7-2c1b44f0db73"
            ]
        },
        "propagate_uplink_status": false,
        "hardware_offload_type": "switchdev",
        "trusted": true
    }
}
POST
/v2.0/ports

批量创建端口

在一个请求中创建多个端口。在请求体中指定一个端口列表。

保证批量操作的原子完成。

正常响应代码:201

错误响应代码:400、401、403、404、409

请求

名称

入参

类型

描述

ports

body

数组

一个port对象的列表。

admin_state_up (Optional)

body

布尔值

资源的管理状态,为开启(true)或关闭(false)。默认为true

allowed_address_pairs (Optional)

body

数组

一个零个或多个允许的地址对对象的集合,每个地址对对象包含一个ip_address和一个mac_addressip_address是必需的,而mac_address如果未指定,将从端口获取。ip_address的值可以是IP地址或CIDR(如果底层扩展插件支持)。连接到端口的服务器可以发送源地址与指定的允许地址对之一匹配的数据包。

binding:host_id (Optional)

body

字符串

端口所在主机的ID。默认为空字符串。

binding:profile (Optional)

body

对象

一个字典,允许特定主机上运行的应用程序传递和接收特定于网络后端的vif端口信息。此字段仅用于机器到机器通信,供Nova、Ironic或Zun等计算服务将信息传递给Neutron后端。它不应被多个服务并发使用,也不应被云终端用户使用。现有的反例(Open vSwitch硬件卸载的capabilities: [switchdev]和受信任虚拟函数的trusted=true)将被清理。网络API不定义此字段的特定格式。默认为空字典。如果您将其更新为null,则在响应中将其视为{}。自端口MAC地址覆盖扩展以来,binding:profile字段的device_mac_address可用于提供直接物理端口绑定的物理设备的MAC地址。如果提供,则端口资源的mac_address字段将更新为活动绑定中的MAC。

binding:vnic_type (Optional)

body

字符串

此端口应连接的vNIC类型。这用于确定要用于绑定端口的机制驱动程序。有效值为normalmacvtapdirectbaremetaldirect-physicalvirtio-forwardersmart-nicremote-managed。实际可用的vNIC类型取决于部署。默认为normal

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

device_id (Optional)

body

字符串

使用此端口的设备的ID。例如,服务器实例或逻辑路由器。

device_owner (Optional)

body

字符串

使用此端口的实体类型。例如,compute:nova(服务器实例)、network:dhcp(DHCP代理)或network:router_interface(路由器接口)。

dns_domain (Optional)

body

字符串

A valid DNS domain.

dns_name (Optional)

body

字符串

有效的DNS名称。

extra_dhcp_opts (Optional)

body

数组

零个或多个额外DHCP选项对的集合。一个选项对由选项值和选项名称组成。

fixed_ips (Optional)

body

数组

端口的IP地址。如果您想为端口分配多个IP地址,请在此字段中指定多个条目。每个条目包括IP地址(ip_address)以及分配IP地址的子网ID(subnet_id)。

  • 如果您同时指定了子网ID和IP地址,OpenStack Networking将尝试将该IP地址分配给该子网中的端口。

  • 如果您仅指定了子网ID,OpenStack Networking将从该子网中分配一个可用的IP给端口。

  • 如果您仅指定了IP地址,OpenStack Networking将尝试分配该IP地址,前提是该地址对于指定网络中的任何子网都是有效IP。

mac_address (Optional)

body

字符串

端口的MAC地址。如果未指定,将自动生成MAC地址。

name (可选)

body

字符串

资源的易读名称。默认情况下为空字符串。

network_id

body

字符串

连接网络的 ID。

numa_affinity_policy (Optional)

body

字符串

虚拟机调度期间请求的端口NUMA亲和策略。值:Nonerequiredpreferredlegacy

port_security_enabled (Optional)

body

布尔值

端口安全状态。有效值为启用(true)或禁用(false)。如果端口启用了端口安全,则安全组规则和防欺骗规则将应用于端口上的流量。如果禁用,则不应用这些规则。

project_id (可选)

body

字符串

The ID of the project that owns the resource. Only administrative and users with advsvc role can specify a project ID other than their own. You cannot change this value through authorization policies.

qos_policy_id (Optional)

body

字符串

与端口关联的QoS策略。

security_groups (可选)

body

数组

应用于端口的安全组的ID。

tenant_id (可选)

body

字符串

The ID of the project that owns the resource. Only administrative and users with advsvc role can specify a project ID other than their own. You cannot change this value through authorization policies.

propagate_uplink_status (Optional)

body

布尔值

端口的上行链路状态传播。有效值为启用(true)和禁用(false)。

mac_learning_enabled (Optional)

body

布尔值

一个布尔值,指示是否在关联端口上启用了MAC学习。

请求示例

{
    "ports": [
        {
            "admin_state_up": false,
            "name": "sample_port_1",
            "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7",
            "qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae"
        },
        {
            "admin_state_up": false,
            "name": "sample_port_2",
            "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7",
            "hardware_offload_type": "switchdev"
        }
    ]
}

响应参数

名称

入参

类型

描述

ports

body

数组

一个port对象的列表。

admin_state_up

body

布尔值

资源的管理状态,为开启(true)或关闭(false)。

allowed_address_pairs

body

数组

一个零个或多个允许的地址对对象的集合,每个地址对对象包含一个ip_address和一个mac_addressip_address是必需的,而mac_address如果未指定,将从端口获取。ip_address的值可以是IP地址或CIDR(如果底层扩展插件支持)。连接到端口的服务器可以发送源地址与指定的允许地址对之一匹配的数据包。

binding:host_id

body

字符串

端口所在主机的ID。

binding:profile

body

对象

一个字典,允许特定主机上运行的应用程序传递和接收特定于网络后端的vif端口信息。网络API不定义此字段的特定格式。如果更新请求为null,则此响应字段将为{}。

binding:vif_details

body

对象

一个包含端口附加信息的字典。目前定义的字段有:port_filterovs_hybrid_plugport_filter是一个布尔值,指示网络服务是否提供端口过滤功能,如安全组和/或防MAC/IP欺骗。ovs_hybrid_plug是一个布尔值,用于告知Nova等API消费者是否应使用OVS的混合插件策略。

binding:vif_type

body

字符串

用于端口的机制类型。Nova等API消费者可以使用此信息来确定连接设备的适当方式(例如,虚拟服务器的接口)。目前定义的可用值包括ovsbridgemacvtaphw_vebhostdev_physicalvhostuserdistributedother。还有特殊值:unboundbinding_failedunbound表示端口未绑定到网络后端。binding_failed表示端口绑定到网络后端失败的错误。

binding:vnic_type

body

字符串

此端口应连接的vNIC类型。这用于确定要用于绑定端口的机制驱动程序。有效值为normalmacvtapdirectbaremetaldirect-physicalvirtio-forwardersmart-nicremote-managed。实际可用的vNIC类型取决于部署。

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

data_plane_status

body

字符串

端口底层数据平面的状态。

description

body

字符串

A human-readable description for the resource.

device_id

body

字符串

使用此端口的设备的ID。例如,服务器实例或逻辑路由器。

device_owner

body

字符串

使用此端口的实体类型。例如,compute:nova(服务器实例)、network:dhcp(DHCP代理)或network:router_interface(路由器接口)。

dns_assignment

body

对象

Networking内部DNS分配给端口的数据,包括hostnameip_addressfqdn

dns_domain

body

字符串

A valid DNS domain.

dns_name

body

字符串

有效的DNS名称。

extra_dhcp_opts

body

数组

零个或多个额外DHCP选项对的集合。一个选项对由选项值和选项名称组成。

fixed_ips

body

数组

端口的IP地址。如果端口有多个IP地址,则此字段有多个条目。每个条目包括IP地址(ip_address)以及分配IP地址的子网ID(subnet_id)。

id

body

字符串

资源的ID。

ip_allocation

body

字符串

指示端口何时使用deferredimmediate或无IP分配(none)。

mac_address

body

字符串

端口的MAC地址。如果端口使用direct-physicalvnic_type,则此字段的值将被替换为活动绑定:配置文件中提供的MAC地址(如果有)。

name

body

字符串

Human-readable name of the resource.

network_id

body

字符串

连接网络的 ID。

numa_affinity_policy (Optional)

body

字符串

虚拟机调度期间请求的端口NUMA亲和策略。值:Nonerequiredpreferredlegacy

port_security_enabled

body

布尔值

端口安全状态。有效值为启用(true)或禁用(false)。如果端口启用了端口安全,则安全组规则和防欺骗规则将应用于端口上的流量。如果禁用,则不应用这些规则。

project_id

body

字符串

项目的 ID。

qos_network_policy_id

body

字符串

此端口所连接网络的QoS策略ID。

qos_policy_id

body

字符串

与端口关联的QoS策略ID。

revision_number

body

整数

The revision number of the resource.

security_groups

body

数组

应用于端口的安全组的ID。

status

body

字符串

端口状态。值为ACTIVEDOWNBUILDERROR

tags

body

数组

The list of tags on the resource.

tenant_id

body

字符串

项目的 ID。

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

propagate_uplink_status

body

布尔值

端口的上行链路状态传播。有效值为启用(true)和禁用(false)。

mac_learning_enabled (Optional)

body

布尔值

一个布尔值,指示是否在关联端口上启用了MAC学习。

响应示例

{
    "ports": [
        {
            "admin_state_up": false,
            "allowed_address_pairs": [],
            "created_at": "2016-03-08T20:19:41",
            "data_plane_status": null,
            "description": "",
            "device_id": "",
            "device_owner": "",
            "dns_domain": "",
            "dns_name": "",
            "extra_dhcp_opts": [
                {
                    "opt_value": "pxelinux.0",
                    "ip_version": 4,
                    "opt_name": "bootfile-name"
                }
            ],
            "fixed_ips": [
                {
                    "ip_address": "10.0.0.5",
                    "subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2"
                }
            ],
            "id": "94225baa-9d3f-4b93-bf12-b41e7ce49cdb",
            "ip_allocation": "immediate",
            "mac_address": "fa:16:3e:48:b8:9f",
            "name": "sample_port_1",
            "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7",
            "project_id": "d6700c0c9ffa4f1cb322cd4a1f3906fa",
            "revision_number": 1,
            "security_groups": [
                "f0ac4394-7e4a-4409-9701-ba8be283dbc3"
            ],
            "status": "DOWN",
            "tags": ["tag1,tag2"],
            "tenant_id": "d6700c0c9ffa4f1cb322cd4a1f3906fa",
            "updated_at": "2016-03-08T20:19:41",
            "qos_network_policy_id": null,
            "qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae",
            "port_security_enabled": false,
            "propagate_uplink_status": false,
            "hardware_offload_type": "",
            "trusted": null
        },
        {
            "admin_state_up": false,
            "allowed_address_pairs": [],
            "created_at": "2016-03-08T20:19:41",
            "data_plane_status": null,
            "description": "",
            "device_id": "",
            "device_owner": "",
            "dns_assignment": [],
            "dns_domain": "",
            "dns_name": "",
            "extra_dhcp_opts": [
                {
                    "opt_value": "pxelinux.0",
                    "ip_version": 4,
                    "opt_name": "bootfile-name"
                }
            ],
            "fixed_ips": [
                {
                    "ip_address": "10.0.0.6",
                    "subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2"
                }
            ],
            "id": "235b09e0-63c4-47f1-b221-66ba54c21760",
            "ip_allocation": "immediate",
            "mac_address": "fa:16:3e:f4:73:df",
            "name": "sample_port_2",
            "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7",
            "project_id": "d6700c0c9ffa4f1cb322cd4a1f3906fa",
            "revision_number": 1,
            "security_groups": [
                "f0ac4394-7e4a-4409-9701-ba8be283dbc3"
            ],
            "status": "DOWN",
            "tags": ["tag1,tag2"],
            "tenant_id": "d6700c0c9ffa4f1cb322cd4a1f3906fa",
            "updated_at": "2016-03-08T20:19:41",
            "qos_network_policy_id": "174dd0c1-a4eb-49d4-a807-ae80246d82f4",
            "qos_policy_id": null,
            "port_security_enabled": false,
            "propagate_uplink_status": false,
            "hardware_offload_type": "switchdev",
            "trusted": null
        }
    ]
}
PUT
/v2.0/ports/{port_id}/add_allowed_address_pairs

将允许的地址对添加到端口

原子地将一组允许的地址对添加到端口已有的允许地址对中。

正常响应代码:200

错误响应代码:400、401、404、412

请求

名称

入参

类型

描述

port_id

路径

字符串

端口的ID。

port

body

对象

一个port对象。

allowed_address_pairs (Optional)

body

数组

一个零个或多个允许的地址对对象的集合,每个地址对对象包含一个ip_address和一个mac_addressip_address是必需的,而mac_address如果未指定,将从端口获取。ip_address的值可以是IP地址或CIDR(如果底层扩展插件支持)。连接到端口的服务器可以发送源地址与指定的允许地址对之一匹配的数据包。

请求示例

{
   "port" : {
        "allowed_address_pairs": [
            {
                "ip_address": "192.168.13.7",
                "mac_address": "fa:16:3e:09:1f:b2"
            }
        ]
   }
}

响应参数

名称

入参

类型

描述

port

body

对象

一个port对象。

admin_state_up

body

布尔值

资源的管理状态,为开启(true)或关闭(false)。

allowed_address_pairs

body

数组

一个零个或多个允许的地址对对象的集合,每个地址对对象包含一个ip_address和一个mac_addressip_address是必需的,而mac_address如果未指定,将从端口获取。ip_address的值可以是IP地址或CIDR(如果底层扩展插件支持)。连接到端口的服务器可以发送源地址与指定的允许地址对之一匹配的数据包。

binding:host_id

body

字符串

端口所在主机的ID。

binding:profile

body

对象

一个字典,允许特定主机上运行的应用程序传递和接收特定于网络后端的vif端口信息。网络API不定义此字段的特定格式。如果更新请求为null,则此响应字段将为{}。

binding:vif_details

body

对象

一个包含端口附加信息的字典。目前定义的字段有:port_filterovs_hybrid_plugport_filter是一个布尔值,指示网络服务是否提供端口过滤功能,如安全组和/或防MAC/IP欺骗。ovs_hybrid_plug是一个布尔值,用于告知Nova等API消费者是否应使用OVS的混合插件策略。

binding:vif_type

body

字符串

用于端口的机制类型。Nova等API消费者可以使用此信息来确定连接设备的适当方式(例如,虚拟服务器的接口)。目前定义的可用值包括ovsbridgemacvtaphw_vebhostdev_physicalvhostuserdistributedother。还有特殊值:unboundbinding_failedunbound表示端口未绑定到网络后端。binding_failed表示端口绑定到网络后端失败的错误。

binding:vnic_type

body

字符串

此端口应连接的vNIC类型。这用于确定要用于绑定端口的机制驱动程序。有效值为normalmacvtapdirectbaremetaldirect-physicalvirtio-forwardersmart-nicremote-managed。实际可用的vNIC类型取决于部署。

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

data_plane_status

body

字符串

端口底层数据平面的状态。

description

body

字符串

A human-readable description for the resource.

device_id

body

字符串

使用此端口的设备的ID。例如,服务器实例或逻辑路由器。

device_owner

body

字符串

使用此端口的实体类型。例如,compute:nova(服务器实例)、network:dhcp(DHCP代理)或network:router_interface(路由器接口)。

dns_assignment

body

对象

Networking内部DNS分配给端口的数据,包括hostnameip_addressfqdn

dns_domain

body

字符串

A valid DNS domain.

dns_name

body

字符串

有效的DNS名称。

extra_dhcp_opts

body

数组

零个或多个额外DHCP选项对的集合。一个选项对由选项值和选项名称组成。

fixed_ips

body

数组

端口的IP地址。如果端口有多个IP地址,则此字段有多个条目。每个条目包括IP地址(ip_address)以及分配IP地址的子网ID(subnet_id)。

hints

body

对象

仅限管理员。以下值用于控制Open vSwitch的用户空间Tx数据包转向功能

  • {"openvswitch": {"other_config": {"tx-steering": "hash|thread"}}}

id

body

字符串

资源的ID。

ip_allocation

body

字符串

指示端口何时使用deferredimmediate或无IP分配(none)。

mac_address

body

字符串

端口的MAC地址。如果端口使用direct-physicalvnic_type,则此字段的值将被替换为活动绑定:配置文件中提供的MAC地址(如果有)。

name

body

字符串

Human-readable name of the resource.

network_id

body

字符串

连接网络的 ID。

numa_affinity_policy (Optional)

body

字符串

虚拟机调度期间请求的端口NUMA亲和策略。值:Nonerequiredpreferredlegacy

port_security_enabled

body

布尔值

端口安全状态。有效值为启用(true)或禁用(false)。如果端口启用了端口安全,则安全组规则和防欺骗规则将应用于端口上的流量。如果禁用,则不应用这些规则。

project_id

body

字符串

项目的 ID。

qos_network_policy_id

body

字符串

此端口所连接网络的QoS策略ID。

qos_policy_id

body

字符串

与端口关联的QoS策略ID。

revision_number

body

整数

The revision number of the resource.

resource_request (Optional)

body

对象

将端口请求的Placement资源(例如:minimum-bandwidth)和特性(例如:vnic-typephysnet)暴露给Nova和Placement。resource_request对象包含request_groupssame_subtree键。request_groups是一个字典列表,其中每个字典表示一个需要从单个资源提供者满足的资源和特性组。列表中的每个字典必须包含idrequiredresources键。id字段是一个字符串,表示通过UUID5方法结合port_id和对组有贡献的QoS规则的UUID生成的每个组的唯一UUID。required键包含端口所需的特性(从vnic_typephysnet生成),而resources键包含请求的资源类名与QoS策略请求数量的映射。same_subtree键包含每个资源组的id值的列表。

security_groups

body

数组

应用于端口的安全组的ID。

status

body

字符串

端口状态。值为ACTIVEDOWNBUILDERROR

tags

body

数组

The list of tags on the resource.

tenant_id

body

字符串

项目的 ID。

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

propagate_uplink_status

body

布尔值

端口的上行链路状态传播。有效值为启用(true)和禁用(false)。

mac_learning_enabled (Optional)

body

布尔值

一个布尔值,指示是否在关联端口上启用了MAC学习。

响应示例

{
    "port": {
        "admin_state_up": true,
        "allowed_address_pairs": [
            {
                "ip_address": "192.168.13.7",
                "mac_address": "fa:16:3e:09:1f:b2"
            }
        ],
        "binding:host_id": "",
        "binding:profile": {},
        "binding:vif_details": {},
        "binding:vif_type": "unbound",
        "binding:vnic_type": "normal",
        "created_at": "2023-04-20T02:32:41",
        "data_plane_status": null,
        "description": "",
        "device_id": "",
        "device_owner": "",
        "dns_assignment": [],
        "dns_domain": "",
        "dns_name": "",
        "extra_dhcp_opts": [],
        "fixed_ips": [
            {
                "ip_address": "192.168.13.6",
                "subnet_id": "a4c3b506-2110-4929-a70a-bda534bc0b07"
            }
        ],
        "id": "dc67ee67-7acd-464d-98fd-4abef6d8759d",
        "ip_allocation": "immediate",
        "mac_address": "fa:16:3e:09:1f:b2",
        "mac_learning_enabled": false,
        "name": "test-port",
        "network_id": "99b8e526-e943-4463-aa28-a22395bed154",
        "port_security_enabled": true,
        "project_id": "294b394e8f454cc8b26bbe342bc210d3",
        "revision_number": 1,
        "security_groups": [
            "751d740a-b52b-46d9-bca8-a21e75c8a727"
        ],
        "status": "DOWN",
        "tags": [],
        "tenant_id": "294b394e8f454cc8b26bbe342bc210d3",
        "updated_at": "2023-04-20T02:32:41",
        "qos_network_policy_id": null,
        "qos_policy_id": null,
        "resource_request": null,
        "propagate_uplink_status": false,
        "trusted": true
    }
}
PUT
/v2.0/ports/{port_id}/remove_allowed_address_pairs

从端口移除允许的地址对

原子地从端口已有的允许地址对中移除一组允许的地址对。

正常响应代码:200

错误响应代码:400、401、404、412

请求

名称

入参

类型

描述

port_id

路径

字符串

端口的ID。

port

body

对象

一个port对象。

allowed_address_pairs (Optional)

body

数组

一个零个或多个允许的地址对对象的集合,每个地址对对象包含一个ip_address和一个mac_addressip_address是必需的,而mac_address如果未指定,将从端口获取。ip_address的值可以是IP地址或CIDR(如果底层扩展插件支持)。连接到端口的服务器可以发送源地址与指定的允许地址对之一匹配的数据包。

请求示例

{
   "port" : {
        "allowed_address_pairs": [
            {
                "ip_address": "192.168.13.7",
                "mac_address": "fa:16:3e:09:1f:b2"
            }
        ]
   }
}

响应参数

名称

入参

类型

描述

port

body

对象

一个port对象。

admin_state_up

body

布尔值

资源的管理状态,为开启(true)或关闭(false)。

allowed_address_pairs

body

数组

一个零个或多个允许的地址对对象的集合,每个地址对对象包含一个ip_address和一个mac_addressip_address是必需的,而mac_address如果未指定,将从端口获取。ip_address的值可以是IP地址或CIDR(如果底层扩展插件支持)。连接到端口的服务器可以发送源地址与指定的允许地址对之一匹配的数据包。

binding:host_id

body

字符串

端口所在主机的ID。

binding:profile

body

对象

一个字典,允许特定主机上运行的应用程序传递和接收特定于网络后端的vif端口信息。网络API不定义此字段的特定格式。如果更新请求为null,则此响应字段将为{}。

binding:vif_details

body

对象

一个包含端口附加信息的字典。目前定义的字段有:port_filterovs_hybrid_plugport_filter是一个布尔值,指示网络服务是否提供端口过滤功能,如安全组和/或防MAC/IP欺骗。ovs_hybrid_plug是一个布尔值,用于告知Nova等API消费者是否应使用OVS的混合插件策略。

binding:vif_type

body

字符串

用于端口的机制类型。Nova等API消费者可以使用此信息来确定连接设备的适当方式(例如,虚拟服务器的接口)。目前定义的可用值包括ovsbridgemacvtaphw_vebhostdev_physicalvhostuserdistributedother。还有特殊值:unboundbinding_failedunbound表示端口未绑定到网络后端。binding_failed表示端口绑定到网络后端失败的错误。

binding:vnic_type

body

字符串

此端口应连接的vNIC类型。这用于确定要用于绑定端口的机制驱动程序。有效值为normalmacvtapdirectbaremetaldirect-physicalvirtio-forwardersmart-nicremote-managed。实际可用的vNIC类型取决于部署。

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

data_plane_status

body

字符串

端口底层数据平面的状态。

description

body

字符串

A human-readable description for the resource.

device_id

body

字符串

使用此端口的设备的ID。例如,服务器实例或逻辑路由器。

device_owner

body

字符串

使用此端口的实体类型。例如,compute:nova(服务器实例)、network:dhcp(DHCP代理)或network:router_interface(路由器接口)。

dns_assignment

body

对象

Networking内部DNS分配给端口的数据,包括hostnameip_addressfqdn

dns_domain

body

字符串

A valid DNS domain.

dns_name

body

字符串

有效的DNS名称。

extra_dhcp_opts

body

数组

零个或多个额外DHCP选项对的集合。一个选项对由选项值和选项名称组成。

fixed_ips

body

数组

端口的IP地址。如果端口有多个IP地址,则此字段有多个条目。每个条目包括IP地址(ip_address)以及分配IP地址的子网ID(subnet_id)。

hints

body

对象

仅限管理员。以下值用于控制Open vSwitch的用户空间Tx数据包转向功能

  • {"openvswitch": {"other_config": {"tx-steering": "hash|thread"}}}

id

body

字符串

资源的ID。

ip_allocation

body

字符串

指示端口何时使用deferredimmediate或无IP分配(none)。

mac_address

body

字符串

端口的MAC地址。如果端口使用direct-physicalvnic_type,则此字段的值将被替换为活动绑定:配置文件中提供的MAC地址(如果有)。

name

body

字符串

Human-readable name of the resource.

network_id

body

字符串

连接网络的 ID。

numa_affinity_policy (Optional)

body

字符串

虚拟机调度期间请求的端口NUMA亲和策略。值:Nonerequiredpreferredlegacy

port_security_enabled

body

布尔值

端口安全状态。有效值为启用(true)或禁用(false)。如果端口启用了端口安全,则安全组规则和防欺骗规则将应用于端口上的流量。如果禁用,则不应用这些规则。

project_id

body

字符串

项目的 ID。

qos_network_policy_id

body

字符串

此端口所连接网络的QoS策略ID。

qos_policy_id

body

字符串

与端口关联的QoS策略ID。

revision_number

body

整数

The revision number of the resource.

resource_request (Optional)

body

对象

将端口请求的Placement资源(例如:minimum-bandwidth)和特性(例如:vnic-typephysnet)暴露给Nova和Placement。resource_request对象包含request_groupssame_subtree键。request_groups是一个字典列表,其中每个字典表示一个需要从单个资源提供者满足的资源和特性组。列表中的每个字典必须包含idrequiredresources键。id字段是一个字符串,表示通过UUID5方法结合port_id和对组有贡献的QoS规则的UUID生成的每个组的唯一UUID。required键包含端口所需的特性(从vnic_typephysnet生成),而resources键包含请求的资源类名与QoS策略请求数量的映射。same_subtree键包含每个资源组的id值的列表。

security_groups

body

数组

应用于端口的安全组的ID。

status

body

字符串

端口状态。值为ACTIVEDOWNBUILDERROR

tags

body

数组

The list of tags on the resource.

tenant_id

body

字符串

项目的 ID。

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

propagate_uplink_status

body

布尔值

端口的上行链路状态传播。有效值为启用(true)和禁用(false)。

mac_learning_enabled (Optional)

body

布尔值

一个布尔值,指示是否在关联端口上启用了MAC学习。

响应示例

{
    "port": {
        "admin_state_up": true,
        "allowed_address_pairs": [],
        "binding:host_id": "",
        "binding:profile": {},
        "binding:vif_details": {},
        "binding:vif_type": "unbound",
        "binding:vnic_type": "normal",
        "created_at": "2023-04-20T02:32:41",
        "data_plane_status": null,
        "description": "",
        "device_id": "",
        "device_owner": "",
        "dns_assignment": [],
        "dns_domain": "",
        "dns_name": "",
        "extra_dhcp_opts": [],
        "fixed_ips": [
            {
                "ip_address": "192.168.13.6",
                "subnet_id": "a4c3b506-2110-4929-a70a-bda534bc0b07"
            }
        ],
        "id": "dc67ee67-7acd-464d-98fd-4abef6d8759d",
        "ip_allocation": "immediate",
        "mac_address": "fa:16:3e:09:1f:b2",
        "mac_learning_enabled": false,
        "name": "test-port",
        "network_id": "99b8e526-e943-4463-aa28-a22395bed154",
        "port_security_enabled": true,
        "project_id": "294b394e8f454cc8b26bbe342bc210d3",
        "revision_number": 1,
        "security_groups": [
            "751d740a-b52b-46d9-bca8-a21e75c8a727"
        ],
        "status": "DOWN",
        "tags": [],
        "tenant_id": "294b394e8f454cc8b26bbe342bc210d3",
        "updated_at": "2023-04-20T02:32:41",
        "qos_network_policy_id": null,
        "qos_policy_id": null,
        "resource_request": null,
        "propagate_uplink_status": false,
        "hardware_offload_type": "",
        "trusted": true
    }
}

端口绑定

将虚拟端口的端口绑定暴露给外部应用程序。

端口绑定扩展

“端口绑定扩展”扩展向“端口绑定”添加了额外的字段,如statusproject id,并允许绑定的activation

GET
/v2.0/ports/{port_id}/bindings

显示端口的端口绑定

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

Error response codes: 401, 404

请求

名称

入参

类型

描述

port_id

路径

字符串

端口的ID。

响应参数

名称

入参

类型

描述

bindings

body

对象

一个binding对象。

host

body

字符串

代理运行所在系统的名称。

profile

body

对象

一个字典,允许特定主机上运行的应用程序传递和接收特定于网络后端的vif端口信息。网络API不定义此字段的特定格式。如果更新请求为null,则此响应字段将为{}。

vif_details

body

对象

一个包含端口附加信息的字典。目前定义的字段有:port_filterovs_hybrid_plugport_filter是一个布尔值,指示网络服务是否提供端口过滤功能,如安全组和/或防MAC/IP欺骗。ovs_hybrid_plug是一个布尔值,用于告知Nova等API消费者是否应使用OVS的混合插件策略。

vif_type

body

字符串

用于端口的机制类型。Nova等API消费者可以使用此信息来确定连接设备的适当方式(例如,虚拟服务器的接口)。目前定义的可用值包括ovsbridgemacvtaphw_vebhostdev_physicalvhostuserdistributedother。还有特殊值:unboundbinding_failedunbound表示端口未绑定到网络后端。binding_failed表示端口绑定到网络后端失败的错误。

vnic_type

body

字符串

此端口应连接的vNIC类型。这用于确定要用于绑定端口的机制驱动程序。有效值为normalmacvtapdirectbaremetaldirect-physicalvirtio-forwardersmart-nicremote-managed。实际可用的vNIC类型取决于部署。

响应示例(管理员用户)

{
    "bindings" : [
        {
            "host" : "jammy",
            "profile" : {},
            "status" : "ACTIVE",
            "vif_details" : {
                "bridge_name" : "br-int",
                "connectivity" : "l2",
                "datapath_type" : "system",
                "ovs_hybrid_plug" : false,
                "port_filter" : true
            },
            "vif_type" : "ovs",
            "vnic_type" : "normal"
        }
   ]
}
POST
/v2.0/ports/{port_id}/bindings/

创建端口绑定

正常响应代码:201

错误响应代码:400、401、403、404

请求

名称

入参

类型

描述

port_id

路径

字符串

端口的ID。

bindings

body

对象

一个binding对象。

host

body

字符串

代理运行所在系统的名称。

profile

body

对象

一个字典,允许特定主机上运行的应用程序传递和接收特定于网络后端的vif端口信息。网络API不定义此字段的特定格式。如果更新请求为null,则此响应字段将为{}。

vif_details

body

对象

一个包含端口附加信息的字典。目前定义的字段有:port_filterovs_hybrid_plugport_filter是一个布尔值,指示网络服务是否提供端口过滤功能,如安全组和/或防MAC/IP欺骗。ovs_hybrid_plug是一个布尔值,用于告知Nova等API消费者是否应使用OVS的混合插件策略。

vif_type

body

字符串

用于端口的机制类型。Nova等API消费者可以使用此信息来确定连接设备的适当方式(例如,虚拟服务器的接口)。目前定义的可用值包括ovsbridgemacvtaphw_vebhostdev_physicalvhostuserdistributedother。还有特殊值:unboundbinding_failedunbound表示端口未绑定到网络后端。binding_failed表示端口绑定到网络后端失败的错误。

vnic_type

body

字符串

此端口应连接的vNIC类型。这用于确定要用于绑定端口的机制驱动程序。有效值为normalmacvtapdirectbaremetaldirect-physicalvirtio-forwardersmart-nicremote-managed。实际可用的vNIC类型取决于部署。

请求示例(管理员用户)

{
    "binding": {
        "host": "compute"
    }
}

响应参数

名称

入参

类型

描述

port_id

路径

字符串

端口的ID。

bindings

body

对象

一个binding对象。

host

body

字符串

代理运行所在系统的名称。

profile

body

对象

一个字典,允许特定主机上运行的应用程序传递和接收特定于网络后端的vif端口信息。网络API不定义此字段的特定格式。如果更新请求为null,则此响应字段将为{}。

vif_details

body

对象

一个包含端口附加信息的字典。目前定义的字段有:port_filterovs_hybrid_plugport_filter是一个布尔值,指示网络服务是否提供端口过滤功能,如安全组和/或防MAC/IP欺骗。ovs_hybrid_plug是一个布尔值,用于告知Nova等API消费者是否应使用OVS的混合插件策略。

vif_type

body

字符串

用于端口的机制类型。Nova等API消费者可以使用此信息来确定连接设备的适当方式(例如,虚拟服务器的接口)。目前定义的可用值包括ovsbridgemacvtaphw_vebhostdev_physicalvhostuserdistributedother。还有特殊值:unboundbinding_failedunbound表示端口未绑定到网络后端。binding_failed表示端口绑定到网络后端失败的错误。

vnic_type

body

字符串

此端口应连接的vNIC类型。这用于确定要用于绑定端口的机制驱动程序。有效值为normalmacvtapdirectbaremetaldirect-physicalvirtio-forwardersmart-nicremote-managed。实际可用的vNIC类型取决于部署。

响应示例(管理员用户)

{
    "binding": {
        "host": "compute",
        "vif_type": "ovs",
        "vnic_type": "normal",
        "status": "INACTIVE",
        "profile": {},
        "vif_details": {
            "connectivity": "l2",
            "port_filter": true,
            "ovs_hybrid_plug": false,
            "datapath_type": "system",
            "bridge_name": "br-int"
        }
    }
}
PUT
/v2.0/ports/{port_id}/bindings/{host}/activate

激活端口绑定

正常响应代码:200

错误响应代码:400、401、404、412

请求

名称

入参

类型

描述

port_id

路径

字符串

端口的ID。

host

body

字符串

代理运行所在系统的名称。

响应参数

名称

入参

类型

描述

port_id

路径

字符串

端口的ID。

bindings

body

对象

一个binding对象。

host

body

字符串

代理运行所在系统的名称。

profile

body

对象

一个字典,允许特定主机上运行的应用程序传递和接收特定于网络后端的vif端口信息。网络API不定义此字段的特定格式。如果更新请求为null,则此响应字段将为{}。

vif_details

body

对象

一个包含端口附加信息的字典。目前定义的字段有:port_filterovs_hybrid_plugport_filter是一个布尔值,指示网络服务是否提供端口过滤功能,如安全组和/或防MAC/IP欺骗。ovs_hybrid_plug是一个布尔值,用于告知Nova等API消费者是否应使用OVS的混合插件策略。

vif_type

body

字符串

用于端口的机制类型。Nova等API消费者可以使用此信息来确定连接设备的适当方式(例如,虚拟服务器的接口)。目前定义的可用值包括ovsbridgemacvtaphw_vebhostdev_physicalvhostuserdistributedother。还有特殊值:unboundbinding_failedunbound表示端口未绑定到网络后端。binding_failed表示端口绑定到网络后端失败的错误。

vnic_type

body

字符串

此端口应连接的vNIC类型。这用于确定要用于绑定端口的机制驱动程序。有效值为normalmacvtapdirectbaremetaldirect-physicalvirtio-forwardersmart-nicremote-managed。实际可用的vNIC类型取决于部署。

响应示例(管理员用户)

{
    "binding": {
        "host": "compute",
        "vif_type": "ovs",
        "vnic_type": "normal",
        "status": "ACTIVE",
        "profile": {},
        "vif_details": {
            "connectivity": "l2",
            "port_filter": true,
            "ovs_hybrid_plug": false,
            "datapath_type": "system",
            "bridge_name": "br-int"
        }
    }
}
DELETE
/v2.0/ports/{port_id}/bindings/{host}

删除端口绑定

正常响应代码:204

错误响应代码:401、403、404、412

请求

名称

入参

类型

描述

port_id

路径

字符串

端口的ID。

host

body

字符串

代理运行所在系统的名称。

响应

There is no body content for the response of a successful DELETE request.

分段

列出、显示详细信息、创建、更新和删除分段。分段API是仅限管理员的。

资源时间戳

The standard-attr-timestamp extension adds the created_at and updated_at attributes to all resources that have standard attributes.

GET
/v2.0/segments/{segment_id}

显示分段详细信息

显示分段的详细信息。

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

Error response codes: 401, 404

请求

名称

入参

类型

描述

segment_id

路径

字符串

分段的UUID。

响应参数

名称

入参

类型

描述

id

body

字符串

分段的UUID。

network_id

body

字符串

连接网络的 ID。

physical_network

body

字符串

The physical network where this network/segment is implemented.

network_type

body

字符串

映射到此网络资源的物理网络类型。例如,flatvlanvxlangre

revision_number

body

整数

The revision number of the resource.

segmentation_id

body

整数

The ID of the isolated segment on the physical network. The network_type attribute defines the segmentation model. For example, if the network_type value is vlan, this ID is a vlan identifier. If the network_type value is gre, this ID is a gre key. Note that only the segmentation-id of VLAN type networks can be changed!

name

body

字符串

Human-readable name of the resource.

description

body

字符串

A human-readable description for the resource.

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

响应示例

{
  "segment": {
    "name": null,
    "network_id": "5c0cb560-4089-41dd-be29-469907a23b49",
    "segmentation_id": 2000,
    "network_type": "vlan",
    "physical_network": "segment-1",
    "revision_number": 1,
    "id": "57fe85e4-ca2f-4192-b3cd-d5c249d7a21f",
    "created_at": "2018-03-19T19:16:56Z",
    "updated_at": "2018-03-19T19:16:56Z",
    "description": null
  }
}
PUT
/v2.0/segments/{segment_id}

更新分段

更新一个分段。

正常响应代码:200

Error response codes: 400, 401, 403, 404, 412

请求

名称

入参

类型

描述

segment_id

路径

字符串

分段的UUID。

name (可选)

body

字符串

分段的易读名称。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

请求示例

{
    "segment": {
        "name": "1",
        "description": "Segment One"
    }
}

响应参数

名称

入参

类型

描述

id

body

字符串

分段的UUID。

network_id

body

字符串

连接网络的 ID。

physical_network

body

字符串

The physical network where this network/segment is implemented.

network_type

body

字符串

映射到此网络资源的物理网络类型。例如,flatvlanvxlangre

revision_number

body

整数

The revision number of the resource.

segmentation_id

body

整数

The ID of the isolated segment on the physical network. The network_type attribute defines the segmentation model. For example, if the network_type value is vlan, this ID is a vlan identifier. If the network_type value is gre, this ID is a gre key. Note that only the segmentation-id of VLAN type networks can be changed!

name

body

字符串

Human-readable name of the resource.

description

body

字符串

A human-readable description for the resource.

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

响应示例

{
  "segment": {
    "name": "1",
    "network_id": "5c0cb560-4089-41dd-be29-469907a23b49",
    "segmentation_id": 2000,
    "network_type": "vlan",
    "physical_network": "segment-1",
    "revision_number": 4,
    "id": "57fe85e4-ca2f-4192-b3cd-d5c249d7a21f",
    "created_at": "2018-03-19T19:16:56Z",
    "updated_at": "2018-03-19T19:16:56Z",
    "description": "Segment One"
  }
}
DELETE
/v2.0/segments/{segment_id}

删除分段

删除分段及其关联资源。

正常响应代码:204

Error response codes: 401, 404, 409, 412

请求

名称

入参

类型

描述

segment_id

路径

字符串

分段的UUID。

响应

There is no body content for the response of a successful DELETE request.

GET
/v2.0/segments

列出分段

列出项目有权访问的分段。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

Error response codes: 401

请求

名称

入参

类型

描述

id (可选)

查询

字符串

Filter the list result by the ID of the resource.

network_id (Optional)

查询

字符串

按连接网络的ID过滤列表结果。

physical_network (Optional)

查询

字符串

Filter the list result by the physical network where this network/segment is implemented.

network_type (Optional)

查询

字符串

Filter the list result by the type of physical network that this network/segment is mapped to. For example, flat, vlan, vxlan, or gre. Valid values depend on a networking back-end.

revision_number (Optional)

查询

整数

Filter the list result by the revision number of the resource.

segmentation_id (Optional)

查询

整数

Filter the list result by the ID of the isolated segment on the physical network.

name (可选)

查询

字符串

Filter the list result by the human-readable name of the resource.

description (可选)

查询

字符串

Filter the list result by the human-readable description of the resource.

sort_dir (可选)

查询

字符串

Sort direction. A valid value is asc (ascending) or desc (descending). You can specify multiple pairs of sort key and sort direction query parameters.

sort_key (可选)

查询

字符串

按分段属性排序。您可以指定多个排序键和排序方向查询参数对。排序键限于

  • id

  • name

  • network_id

  • network_type

  • physical_network

  • segmentation_id

  • tenant_id

  • project_id

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

id

body

字符串

分段的UUID。

network_id

body

字符串

连接网络的 ID。

physical_network

body

字符串

The physical network where this network/segment is implemented.

network_type

body

字符串

映射到此网络资源的物理网络类型。例如,flatvlanvxlangre

revision_number

body

整数

The revision number of the resource.

segmentation_id

body

整数

The ID of the isolated segment on the physical network. The network_type attribute defines the segmentation model. For example, if the network_type value is vlan, this ID is a vlan identifier. If the network_type value is gre, this ID is a gre key. Note that only the segmentation-id of VLAN type networks can be changed!

name

body

字符串

Human-readable name of the resource.

description

body

字符串

A human-readable description for the resource.

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

响应示例

{
  "segments": [
    {
      "name": null,
      "network_id": "5c0cb560-4089-41dd-be29-469907a23b49",
      "segmentation_id": 2000,
      "network_type": "vlan",
      "physical_network": "segment-1",
      "revision_number": 1,
      "id": "57fe85e4-ca2f-4192-b3cd-d5c249d7a21f",
      "created_at": "2018-03-19T19:16:56Z",
      "updated_at": "2018-03-19T19:16:56Z",
      "description": null
    },
    {
      "name": null,
      "network_id": "5c0cb560-4089-41dd-be29-469907a23b49",
      "segmentation_id": 2000,
      "network_type": "vlan",
      "physical_network": "segment-2",
      "revision_number": 3,
      "id": "f1364c3a-4fc1-4206-b2dc-3254bc25cbfc",
      "created_at": "2018-03-19T19:16:56Z",
      "updated_at": "2018-03-19T19:16:56Z",
      "description": null
    }
  ]
}
POST
/v2.0/segments

创建分段

创建分段。

正常响应代码:201

错误响应代码:400, 401

请求

名称

入参

类型

描述

network_id

body

字符串

连接网络的 ID。

physical_network

body

字符串

The physical network where this network/segment is implemented.

network_type

body

字符串

映射到此网络资源的物理网络类型。例如,flatvlanvxlangre

segmentation_id

body

整数

The ID of the isolated segment on the physical network. The network_type attribute defines the segmentation model. For example, if the network_type value is vlan, this ID is a vlan identifier. If the network_type value is gre, this ID is a gre key. Note that only the segmentation-id of VLAN type networks can be changed!

name (可选)

body

字符串

分段的易读名称。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

请求示例

{
    "segment": {
        "network_id": "5c0cb560-4089-41dd-be29-469907a23b49",
        "segmentation_id": 2000,
        "network_type": "vlan",
        "physical_network": "segment-1"
    }
}

响应参数

名称

入参

类型

描述

id

body

字符串

分段的UUID。

network_id

body

字符串

连接网络的 ID。

physical_network

body

字符串

The physical network where this network/segment is implemented.

network_type

body

字符串

映射到此网络资源的物理网络类型。例如,flatvlanvxlangre

revision_number

body

整数

The revision number of the resource.

segmentation_id

body

整数

The ID of the isolated segment on the physical network. The network_type attribute defines the segmentation model. For example, if the network_type value is vlan, this ID is a vlan identifier. If the network_type value is gre, this ID is a gre key. Note that only the segmentation-id of VLAN type networks can be changed!

name

body

字符串

Human-readable name of the resource.

description

body

字符串

A human-readable description for the resource.

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

响应示例

{
  "segment": {
    "name": null,
    "network_id": "5c0cb560-4089-41dd-be29-469907a23b49",
    "segmentation_id": 2000,
    "network_type": "vlan",
    "physical_network": "segment-1",
    "revision_number": 1,
    "id": "57fe85e4-ca2f-4192-b3cd-d5c249d7a21f",
    "created_at": "2018-03-19T19:16:56Z",
    "updated_at": "2018-03-19T19:16:56Z",
    "description": null
  }
}

Trunk 网络

Trunk扩展可用于通过单个Neutron逻辑端口多路复用来自多个Neutron逻辑网络或去往多个Neutron逻辑网络的流量。Trunk在Neutron中被建模为Neutron逻辑端口的集合。一个称为父端口的端口必须与Trunk关联,并且是用于连接实例与Neutron的端口。一系列子端口(或sub_ports),每个子端口通常属于不同的Neutron网络,也与Trunk关联,并且每个子端口可以有一个分段类型和ID,用于多路复用/解复用进出父端口的流量。

更详细地说,该扩展引入了以下资源

  • trunk。一个顶级逻辑实体,用于建模通过Trunk流动的Neutron逻辑网络集合。

  • sub_port。与具有分段ID和分段类型属性的Neutron逻辑端口的关联。

资源时间戳

The standard-attr-timestamp extension adds the created_at and updated_at attributes to all resources that have standard attributes.

标签扩展

The standard-attr-tag adds Tag support for resources with standard attributes by adding the tags attribute allowing consumers to associate tags with resources.

GET
/v2.0/trunks

列出Trunk

列出用户可访问的Trunk。

默认策略设置仅返回用户项目拥有的Trunk,除非管理员用户提交请求。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

Error response codes: 401, 404

请求参数

名称

入参

类型

描述

admin_state_up (Optional)

查询

布尔值

按Trunk的管理状态过滤Trunk列表结果,为开启(true)或关闭(false)。

description (可选)

查询

字符串

Filter the list result by the human-readable description of the resource.

id (可选)

查询

字符串

Filter the list result by the ID of the resource.

name (可选)

查询

字符串

Filter the list result by the human-readable name of the resource.

port_id (Optional)

查询

字符串

按父端口ID过滤Trunk列表结果。

revision_number (Optional)

查询

整数

Filter the list result by the revision number of the resource.

status (可选)

查询

字符串

按Trunk的状态过滤Trunk列表结果。可能的值为ACTIVEDOWNBUILDDEGRADEDERROR

tenant_id (可选)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

project_id (可选)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

sort_dir (可选)

查询

字符串

Sort direction. A valid value is asc (ascending) or desc (descending). You can specify multiple pairs of sort key and sort direction query parameters.

sort_key (可选)

查询

字符串

按Trunk属性排序。您可以指定多个排序键和排序方向查询参数对。排序键限于

  • admin_state_up

  • id

  • name

  • port_id

  • project_id

  • status

  • tenant_id

tags (可选)

查询

字符串

A list of tags to filter the list result by. Resources that match all tags in this list will be returned. Tags in query must be separated by comma.

tags-any (Optional)

查询

字符串

A list of tags to filter the list result by. Resources that match any tag in this list will be returned. Tags in query must be separated by comma.

not-tags (Optional)

查询

字符串

A list of tags to filter the list result by. Resources that match all tags in this list will be excluded. Tags in query must be separated by comma.

not-tags-any (Optional)

查询

字符串

A list of tags to filter the list result by. Resources that match any tag in this list will be excluded. Tags in query must be separated by comma.

响应参数

名称

入参

类型

描述

admin_state_up (Optional)

body

布尔值

Trunk的管理状态,为开启(true)或关闭(false)。

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

description

body

字符串

资源的描述。

id

body

字符串

资源的ID。

name (可选)

body

字符串

资源的名称。

port_id

body

字符串

父端口的ID。

revision_number

body

整数

The revision number of the resource.

status

body

字符串

Trunk的状态。可能的值为ACTIVEDOWNBUILDDEGRADEDERROR

tenant_id (可选)

body

字符串

The ID of the project that owns the resource. Only administrative and users with advsvc role can specify a project ID other than their own. You cannot change this value through authorization policies.

project_id (可选)

body

字符串

The ID of the project that owns the resource. Only administrative and users with advsvc role can specify a project ID other than their own. You cannot change this value through authorization policies.

sub_ports

body

数组

与Trunk关联的端口列表。

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

tags

body

数组

The list of tags on the resource.

响应示例

{
    "trunks": [
        {
            "status": "DOWN",
            "sub_ports": [],
            "name": "test",
            "admin_state_up": true,
            "project_id": "313be01bd0744cea86643c711c57012b",
            "tenant_id": "313be01bd0744cea86643c711c57012b",
            "created_at": "2016-10-05T20:11:16Z",
            "updated_at": "2016-10-05T20:11:16Z",
            "revision_number": 1,
            "port_id": "8027c4da-772f-4e43-bfbf-023b4a4e63de",
            "id": "ee98bdb4-a817-43af-943f-4318bff98f51",
            "description": ""
        }
    ]
}
POST
/v2.0/trunks

创建Trunk

错误代码

  • 400 如果请求格式错误,例如请求中缺少或无效的参数,操作将返回此错误代码。

  • 401 操作未授权。

  • 404 如果扩展不可用或指定的任何端口的端口UUID未找到。

  • 409 操作因以下原因之一返回此错误代码:

    • 要用作子端口的端口正被另一个Trunk使用。

    • Trunk中的分段类型和分段ID已在使用中。

    • 要用作父端口的端口正被另一个Trunk使用或无法进行Trunk。

    • 系统配置阻止了操作的成功。

正常响应代码:201

错误响应代码:400、401、404、409

请求

名称

入参

类型

描述

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

port_id

body

字符串

父端口的ID。

name (可选)

body

字符串

资源的名称。

description

body

字符串

资源的描述。

admin_state_up (Optional)

body

布尔值

Trunk的管理状态,为开启(true)或关闭(false)。

sub_ports

body

数组

与Trunk关联的端口列表。

请求示例

{
    "trunk": {
        "port_id": "8027c4da-772f-4e43-bfbf-023b4a4e63de",
        "name": "test",
        "admin_state_up": true
    }
}

响应参数

名称

入参

类型

描述

admin_state_up (Optional)

body

布尔值

Trunk的管理状态,为开启(true)或关闭(false)。

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

description

body

字符串

资源的描述。

id

body

字符串

资源的ID。

name (可选)

body

字符串

资源的名称。

port_id

body

字符串

父端口的ID。

revision_number

body

整数

The revision number of the resource.

status

body

字符串

Trunk的状态。可能的值为ACTIVEDOWNBUILDDEGRADEDERROR

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

sub_ports

body

数组

与Trunk关联的端口列表。

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

tags

body

数组

The list of tags on the resource.

响应示例

{
    "trunk": {
        "status": "DOWN",
        "sub_ports": [],
        "name": "test",
        "admin_state_up": true,
        "project_id": "145a14e4a64b49bf98baad8945dbd4f1",
        "tenant_id": "145a14e4a64b49bf98baad8945dbd4f1",
        "created_at": "2016-10-05T22:31:37Z",
        "updated_at": "2016-10-05T22:31:37Z",
        "revision_number": 1,
        "port_id": "8027c4da-772f-4e43-bfbf-023b4a4e63de",
        "id": "114a26b1-d124-4835-bb4f-021d3d886023",
        "description": ""
    }
}
PUT
/v2.0/trunks/{trunk_id}/add_subports

将子端口添加到Trunk

正常响应代码:200

错误响应代码:400、401、404、409

请求

名称

入参

类型

描述

trunk_id

路径

字符串

Trunk的ID。

segmentation_id (Optional)

body

整数

子端口的分段ID。

segmentation_type (Optional)

body

字符串

子端口的分段类型。可能的值包括vlaninherit。当指定inherit时,端口将从其连接的网络获取分段类型。

port_id

body

字符串

子端口的ID。

请求示例

{
    "sub_ports": [
        {
            "segmentation_id": 44,
            "port_id": "4b4c691b-086d-43d2-8a65-5487e9434155",
            "segmentation_type": "vlan"
        }
    ]
}

响应参数

名称

入参

类型

描述

admin_state_up (Optional)

body

布尔值

Trunk的管理状态,为开启(true)或关闭(false)。

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

description

body

字符串

资源的描述。

id

body

字符串

资源的ID。

name (可选)

body

字符串

资源的名称。

port_id

body

字符串

父端口的ID。

revision_number

body

整数

The revision number of the resource.

status

body

字符串

Trunk的状态。可能的值为ACTIVEDOWNBUILDDEGRADEDERROR

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

sub_ports

body

数组

与Trunk关联的端口列表。

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

tags

body

数组

The list of tags on the resource.

响应示例

{
    "status": "DOWN",
    "sub_ports": [
        {
            "segmentation_type": "vlan",
            "port_id": "4b4c691b-086d-43d2-8a65-5487e9434155",
            "segmentation_id": 44
        }
    ],
    "name": "test",
    "admin_state_up": true,
    "project_id": "145a14e4a64b49bf98baad8945dbd4f1",
    "tenant_id": "145a14e4a64b49bf98baad8945dbd4f1",
    "created_at": "2016-10-05T22:31:37Z",
    "updated_at": "2016-10-05T22:52:04Z",
    "revision_number": 2,
    "port_id": "8027c4da-772f-4e43-bfbf-023b4a4e63de",
    "id": "114a26b1-d124-4835-bb4f-021d3d886023",
    "description": ""
}
PUT
/v2.0/trunks/{trunk_id}/remove_subports

从Trunk中删除子端口

正常响应代码:200

错误响应代码:400、401、404、409

请求

名称

入参

类型

描述

trunk_id

路径

字符串

Trunk的ID。

port_id

body

字符串

端口的ID。

请求示例

{
    "sub_ports": [
       {
           "port_id": "4b4c691b-086d-43d2-8a65-5487e9434155"
       }
    ]
}

响应参数

名称

入参

类型

描述

admin_state_up (Optional)

body

布尔值

Trunk的管理状态,为开启(true)或关闭(false)。

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

description

body

字符串

资源的描述。

id

body

字符串

资源的ID。

name (可选)

body

字符串

资源的名称。

port_id

body

字符串

父端口的ID。

revision_number

body

整数

The revision number of the resource.

status

body

字符串

Trunk的状态。可能的值为ACTIVEDOWNBUILDDEGRADEDERROR

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

sub_ports

body

数组

与Trunk关联的端口列表。

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

tags

body

数组

The list of tags on the resource.

响应示例

{
    "status": "DOWN",
    "sub_ports": [],
    "name": "test",
    "admin_state_up": true,
    "project_id": "145a14e4a64b49bf98baad8945dbd4f1",
    "tenant_id": "145a14e4a64b49bf98baad8945dbd4f1",
    "created_at": "2016-10-05T22:31:37Z",
    "updated_at": "2016-10-05T22:57:44Z",
    "revision_number": 3,
    "port_id": "8027c4da-772f-4e43-bfbf-023b4a4e63de",
    "id": "114a26b1-d124-4835-bb4f-021d3d886023",
    "description": ""
}
GET
/v2.0/trunks/{trunk_id}/get_subports

列出Trunk的子端口

正常响应代码:200

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

Error response codes: 401, 404

请求

名称

入参

类型

描述

trunk_id

路径

字符串

Trunk的ID。

响应参数

名称

入参

类型

描述

port_id

body

字符串

子端口的ID。

segmentation_type

body

字符串

子端口的分段类型。可能的值包括vlaninherit。当指定inherit时,端口将从其连接的网络获取分段类型。

segmentation_id (Optional)

body

整数

子端口的分段ID。

tags

body

数组

The list of tags on the resource.

响应示例

{
    "sub_ports": [
        {
            "segmentation_type": "vlan",
            "port_id": "4b4c691b-086d-43d2-8a65-5487e9434155",
            "segmentation_id": 44
        }
    ]
}
PUT
/v2.0/trunks/{trunk_id}

更新Trunk

更新请求仅用于更改诸如名称、描述或admin_state_up等字段。将admin_state_up设置为False会锁定Trunk,因为它会阻止诸如添加/删除子端口等操作。

正常响应代码:200

错误响应代码:400、401、404、409、412

请求

名称

入参

类型

描述

name_resource (Optional)

body

字符串

资源的名称。

admin_state_up_trunk

body

布尔值

资源的管理状态,为开启(true)或关闭(false)。

description_resource

body

字符串

资源的描述。

trunk_id

路径

字符串

Trunk的ID。

请求示例

{
    "trunk": {
        "name": "foo",
        "admin_state_up": true
    }
}

响应参数

名称

入参

类型

描述

admin_state_up (Optional)

body

布尔值

Trunk的管理状态,为开启(true)或关闭(false)。

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

description

body

字符串

资源的描述。

id

body

字符串

资源的ID。

name (可选)

body

字符串

资源的名称。

port_id

body

字符串

父端口的ID。

revision_number

body

整数

The revision number of the resource.

status

body

字符串

Trunk的状态。可能的值为ACTIVEDOWNBUILDDEGRADEDERROR

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

sub_ports

body

数组

与Trunk关联的端口列表。

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

tags

body

数组

The list of tags on the resource.

响应示例

{
    "trunk": {
        "status": "DOWN",
        "sub_ports": [
            {
                "segmentation_type": "vlan",
                "port_id": "4b4c691b-086d-43d2-8a65-5487e9434155",
                "segmentation_id": 44
            }
        ],
        "name": "foo",
        "admin_state_up": true,
        "project_id": "145a14e4a64b49bf98baad8945dbd4f1",
        "tenant_id": "145a14e4a64b49bf98baad8945dbd4f1",
        "created_at": "2016-10-05T22:31:37Z",
        "updated_at": "2016-10-05T23:28:17Z",
        "revision_number": 9,
        "port_id": "8027c4da-772f-4e43-bfbf-023b4a4e63de",
        "id": "114a26b1-d124-4835-bb4f-021d3d886023",
        "description": ""
    }
}
GET
/v2.0/trunks/{trunk_id}

显示Trunk

显示Trunk的详细信息。

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

Error response codes: 401, 404

请求

名称

入参

类型

描述

trunk_id

路径

字符串

Trunk的ID。

响应参数

名称

入参

类型

描述

admin_state_up (Optional)

body

布尔值

Trunk的管理状态,为开启(true)或关闭(false)。

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

description

body

字符串

资源的描述。

id

body

字符串

资源的ID。

name (可选)

body

字符串

资源的名称。

port_id

body

字符串

父端口的ID。

revision_number

body

整数

The revision number of the resource.

status

body

字符串

Trunk的状态。可能的值为ACTIVEDOWNBUILDDEGRADEDERROR

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

sub_ports

body

数组

与Trunk关联的端口列表。

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

tags

body

数组

The list of tags on the resource.

响应示例

{
    "trunk": {
        "status": "DOWN",
        "sub_ports": [
            {
                 "segmentation_type": "vlan",
                 "port_id": "4b4c691b-086d-43d2-8a65-5487e9434155",
                 "segmentation_id": 44
            }
        ],
        "name": "foo",
        "admin_state_up": true,
        "project_id": "145a14e4a64b49bf98baad8945dbd4f1",
        "tenant_id": "145a14e4a64b49bf98baad8945dbd4f1",
        "created_at": "2016-10-05T22:31:37Z",
        "updated_at": "2016-10-05T23:28:17Z",
        "revision_number": 9,
        "port_id": "8027c4da-772f-4e43-bfbf-023b4a4e63de",
        "id": "114a26b1-d124-4835-bb4f-021d3d886023",
        "description": ""
    }
}
DELETE
/v2.0/trunks/{trunk_id}

删除Trunk

在状态允许的情况下删除Trunk。

正常响应代码:204

Error response codes: 401, 404, 409, 412

请求

名称

入参

类型

描述

trunk_id

路径

字符串

Trunk的ID。

Trunk详细信息扩展属性(端口)

当显示参与Trunk作为父端口的端口资源时,可以使用trunk_details扩展属性。该扩展对于可能希望在获取父端口时访问Trunk详细信息的REST客户端很有用,并且可以避免额外的查找。

GET
/v2.0/ports/{port_id}

显示Trunk详细信息

显示端口的详细信息。trunk_details属性中可用的详细信息包含Trunk ID和显示属于Trunk的子端口信息的数组:端口UUID、分段类型、分段ID和MAC地址。

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

请求

名称

入参

类型

描述

port_id

路径

字符串

端口的ID。

响应参数

名称

入参

类型

描述

trunk_details (Optional)

body

dict

Trunk的详细信息。

响应示例

{
    "port": {
        "status": "DOWN",
        "created_at": "2016-10-05T20:05:14Z",
        "description": "",
        "admin_state_up": true,
        "network_id": "1cf9e069-365f-4a78-8784-616bc12c4c5a",
        "project_id": "313be01bd0744cea86643c711c57012b",
        "tenant_id": "313be01bd0744cea86643c711c57012b",
        "extra_dhcp_opts": [],
        "updated_at": "2016-10-05T20:05:14Z",
        "name": "test",
        "device_owner": "",
        "trunk_details": {
            "trunk_id": "8905d084-010c-46e8-a863-f21cb4441ab1",
            "sub_ports": [
               {
                   "segmentation_id": 33,
                   "port_id": "70df9f3e-b409-4761-8304-ce029b2079f5",
                   "segmentation_type": "vlan",
                   "mac_address": "fa:16:3e:86:9b:dc"
               },
               {
                   "segmentation_id": 44,
                   "port_id": "4b4c691b-086d-43d2-8a65-5487e9434155",
                   "segmentation_type": "vlan",
                   "mac_address": "fa:16:3e:fe:29:97"
               }
           ]
       },
       "revision_number": 5,
       "mac_address": "fa:16:3e:5c:e9:a3",
       "fixed_ips": [
           {
               "subnet_id": "76a059c0-b189-479f-882c-5e8bd464ea49",
               "ip_address": "40.0.0.3"
           }
       ],
       "id": "8027c4da-772f-4e43-bfbf-023b4a4e63de",
       "security_groups": ["da88a249-12ac-4221-9565-c406b6feeb48"],
       "device_id": ""
    }
}

Layer 3 网络

地址范围

列出、创建、显示详细信息、更新和删除地址范围。

GET
/v2.0/address-scopes/{address_scope_id}

显示地址范围

显示地址范围的信息。

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

Error response codes: 401, 404

请求

名称

入参

类型

描述

address_scope_id

路径

字符串

地址范围的ID。

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

address_scope

body

对象

一个address scope对象。

id

body

字符串

地址范围的ID。

name

body

字符串

Human-readable name of the resource.

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

ip_version

body

整数

IP协议版本。有效值为46。默认为4

shared

body

布尔值

指示此资源是否在所有项目之间共享。

响应示例

{
    "address_scope": {
        "name": "address-scope-ip4",
        "tenant_id": "a7a7fa10fd7a4c80acb7e4b224480495",
        "ip_version": 4,
        "shared": true,
        "project_id": "a7a7fa10fd7a4c80acb7e4b224480495",
        "id": "4143da3e-d2a7-4077-ba80-215ecfd016d7"
    }
}
PUT
/v2.0/address-scopes/{address_scope_id}

更新地址范围

更新一个地址范围。

正常响应代码:200

Error response codes: 400, 401, 403, 404, 412

请求

名称

入参

类型

描述

address_scope_id

路径

字符串

地址范围的ID。

address_scope

body

对象

一个address scope对象。

name (可选)

body

字符串

资源的易读名称。默认情况下为空字符串。

shared (Optional)

body

布尔值

Indicates whether this resource is shared across all projects. By default, only administrative users can change this value.

请求示例

{
    "address_scope": {
        "name": "address-scope-ip4",
        "shared": true
    }
}

响应参数

名称

入参

类型

描述

address_scope

body

对象

一个address scope对象。

id

body

字符串

地址范围的ID。

name

body

字符串

Human-readable name of the resource.

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

ip_version

body

整数

IP协议版本。有效值为46。默认为4

shared

body

布尔值

指示此资源是否在所有项目之间共享。

响应示例

{
    "address_scope": {
        "name": "address-scope-2",
        "tenant_id": "a7a7fa10fd7a4c80acb7e4b224480495",
        "ip_version": 4,
        "shared": true,
        "project_id": "a7a7fa10fd7a4c80acb7e4b224480495",
        "id": "4143da3e-d2a7-4077-ba80-215ecfd016d7"
    }
}
DELETE
/v2.0/address-scopes/{address_scope_id}

删除地址范围

删除一个地址范围。

正常响应代码:204

错误响应代码:401、404、412

请求

名称

入参

类型

描述

address_scope_id

路径

字符串

地址范围的ID。

响应

There is no body content for the response of a successful DELETE request.

GET
/v2.0/address-scopes

列出地址范围

列出项目有权访问的地址范围。

默认策略设置仅返回请求用户所属项目拥有的地址范围,除非用户具有管理员角色。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

Error response codes: 401

请求

名称

入参

类型

描述

id (可选)

查询

字符串

Filter the list result by the ID of the resource.

name (可选)

查询

字符串

Filter the list result by the human-readable name of the resource.

tenant_id (可选)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

project_id (可选)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

ip_version (Optional)

查询

整数

按IP协议版本过滤列表结果。有效值为46

shared (Optional)

查询

布尔值

仅限管理员。根据资源是否在所有项目之间共享来过滤列表结果。

sort_key (可选)

查询

字符串

按地址范围属性排序。您可以指定多个排序键和排序方向查询参数对。排序键限于

  • id

  • ip_version

  • name

  • project_id

  • shared

  • tenant_id

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

address_scopes

body

数组

一个address scope对象的列表。

id

body

字符串

地址范围的ID。

name

body

字符串

Human-readable name of the resource.

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

ip_version

body

整数

IP协议版本。有效值为46。默认为4

shared

body

布尔值

指示此资源是否在所有项目之间共享。

响应示例

{
    "address_scopes": [
        {
            "name": "address-scope-ip6",
            "tenant_id": "a7a7fa10fd7a4c80acb7e4b224480495",
            "ip_version": 6,
            "shared": true,
            "project_id": "a7a7fa10fd7a4c80acb7e4b224480495",
            "id": "3b189848-58bb-4499-abc2-8df170a6a8ae"
        },
        {
            "name": "address-scope-2",
            "tenant_id": "a7a7fa10fd7a4c80acb7e4b224480495",
            "ip_version": 4,
            "shared": true,
            "project_id": "a7a7fa10fd7a4c80acb7e4b224480495",
            "id": "4143da3e-d2a7-4077-ba80-215ecfd016d7"
        }
    ]
}
POST
/v2.0/address-scopes

创建地址范围

创建一个地址范围。

正常响应代码:201

错误响应代码:400、401、403、404

请求

名称

入参

类型

描述

address_scope

body

对象

一个address scope对象。

name (可选)

body

字符串

资源的易读名称。默认情况下为空字符串。

tenant_id (可选)

body

字符串

The ID of the project that owns the resource. Only administrative and users with advsvc role can specify a project ID other than their own. You cannot change this value through authorization policies.

project_id (可选)

body

字符串

The ID of the project that owns the resource. Only administrative and users with advsvc role can specify a project ID other than their own. You cannot change this value through authorization policies.

ip_version

body

整数

IP协议版本。有效值为46

shared (Optional)

body

布尔值

Indicates whether this resource is shared across all projects. By default, only administrative users can change this value.

请求示例

{
    "address_scope": {
        "name": "address-scope-2",
        "tenant_id": "a7a7fa10fd7a4c80acb7e4b224480495",
        "ip_version": 4,
        "shared": true,
        "project_id": "a7a7fa10fd7a4c80acb7e4b224480495"
    }
}

响应参数

名称

入参

类型

描述

address_scope

body

对象

一个address scope对象。

id

body

字符串

地址范围的ID。

name

body

字符串

Human-readable name of the resource.

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

ip_version

body

整数

IP协议版本。有效值为46。默认为4

shared

body

布尔值

指示此资源是否在所有项目之间共享。

响应示例

{
    "address_scope": {
        "name": "address-scope-2",
        "tenant_id": "a7a7fa10fd7a4c80acb7e4b224480495",
        "ip_version": 4,
        "shared": true,
        "project_id": "a7a7fa10fd7a4c80acb7e4b224480495",
        "id": "4143da3e-d2a7-4077-ba80-215ecfd016d7"
    }
}

路由器 Conntrack Helper (CT) 目标规则

列出、创建、显示详细信息、更新和删除路由器 conntrack helper (CT) 目标规则。

GET
/v2.0/routers/{router_id}/conntrack_helpers/{conntrack_helper_id}

显示 conntrack helper

显示路由器 conntrack helper 的信息。

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

错误响应代码:400、404

请求

名称

入参

类型

描述

router_id

路径

字符串

路由器的ID。

conntrack_helper_id

路径

字符串

conntrack helper的ID。

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

conntrack_helper

body

对象

一个路由器conntrack helper对象。

helper

body

字符串

netfilter conntrack helper模块。

id

body

字符串

conntrack helper的ID。

协议

body

字符串

netfilter conntrack目标规则的网络协议。

port

body

整数

netfilter conntrack目标规则的网络端口。

响应示例

{
    "conntrack_helper": {
        "protocol": "tcp",
        "id": "2fc1eebb-e0fa-4c40-868a-7ace444717e1",
        "helper": "ftp",
        "port": 21
    }
}
PUT
/v2.0/routers/{router_id}/conntrack_helpers/{conntrack_helper_id}

更新一个 conntrack helper

更新一个路由器 conntrack helper。

正常响应代码:200

错误响应代码:400、404

请求

名称

入参

类型

描述

router_id

路径

字符串

路由器的ID。

conntrack_helper_id

路径

字符串

conntrack helper的ID。

helper (Optional)

body

字符串

netfilter conntrack helper模块。

protocol (Optional)

body

字符串

netfilter conntrack目标规则的网络协议。

port (Optional)

body

整数

netfilter conntrack目标规则的网络端口。

请求示例

{
    "conntrack_helper": {
        "helper": "tftp",
        "protocol": "udp",
        "port": 69
    }
}

响应参数

名称

入参

类型

描述

conntrack_helper

body

对象

一个路由器conntrack helper对象。

id

body

字符串

conntrack helper的ID。

helper

body

字符串

netfilter conntrack helper模块。

协议

body

字符串

netfilter conntrack目标规则的网络协议。

port

body

整数

netfilter conntrack目标规则的网络端口。

响应示例

{
    "conntrack_helper": {
        "protocol": "udp",
        "id": "2fc1eebb-e0fa-4c40-868a-7ace444717e1",
        "helper": "tftp",
        "port": 69
    }
}
DELETE
/v2.0/routers/{router_id}/conntrack_helpers/{conntrack_helper_id}

删除一个 conntrack helper

删除一个路由器 conntrack helper。

正常响应代码:204

错误响应代码:404

请求

名称

入参

类型

描述

router_id

路径

字符串

路由器的ID。

conntrack_helper_id

路径

字符串

conntrack helper的ID。

响应

There is no body content for the response of a successful DELETE request.

GET
/v2.0/routers/{router_id}/conntrack_helpers

列出路由器 conntrack helpers

列出与路由器关联的路由器 conntrack helpers。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

错误响应代码:400、404

请求

名称

入参

类型

描述

router_id

路径

字符串

路由器的ID。

id (可选)

查询

字符串

Filter the list result by the ID of the resource.

helper (Optional)

查询

字符串

按使用的helper过滤列表结果。

protocol (Optional)

查询

字符串

按使用的协议过滤列表结果。

port (Optional)

查询

整数

按使用的端口过滤列表结果。

sort_key (可选)

查询

字符串

按 conntrack helper ID 属性排序。您可以指定多个排序键和排序方向查询参数对。排序键限于

  • id

  • helper

  • port

  • 协议

sort_dir (可选)

查询

字符串

Sort direction. A valid value is asc (ascending) or desc (descending). You can specify multiple pairs of sort key and sort direction query parameters.

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

conntrack_helpers

body

数组

一个router conntrack helpers对象的列表。

id

body

字符串

conntrack helper的ID。

helper

body

字符串

netfilter conntrack helper模块。

协议

body

字符串

netfilter conntrack目标规则的网络协议。

port

body

整数

netfilter conntrack目标规则的网络端口。

响应示例

{
    "conntrack_helpers": [
        {
            "protocol": "udp",
            "id": "2fc1eebb-e0fa-4c40-868a-7ace444717e1",
            "helper": "tftp",
            "port": 6969
        },
        {
            "protocol": "tcp",
            "id": "ee7c890f-44fa-443d-9326-8574c1c3e5e1",
            "helper": "ftp",
            "port": 21
        }
    ]
}
POST
/v2.0/routers/{router_id}/conntrack_helpers

创建 conntrack helper

创建一个路由器 conntrack helper。

正常响应代码:201

错误响应代码:400、404

请求

名称

入参

类型

描述

conntrack_helper

body

对象

一个路由器conntrack helper对象。

router_id

路径

字符串

路由器的ID。

helper

body

字符串

netfilter conntrack helper模块。

协议

body

字符串

netfilter conntrack目标规则的网络协议。

port

body

整数

netfilter conntrack目标规则的网络端口。

请求示例

{
    "conntrack_helper": {
        "protocol": "udp",
        "port": 2121,
        "helper": "ftp"
    }
}

响应参数

名称

入参

类型

描述

conntrack_helper

body

对象

一个路由器conntrack helper对象。

id

body

字符串

conntrack helper的ID。

helper

body

字符串

netfilter conntrack helper模块。

协议

body

字符串

netfilter conntrack目标规则的网络协议。

port

body

整数

netfilter conntrack目标规则的网络端口。

响应示例

{
    "conntrack_helper": {
        "protocol": "tcp",
        "id": "32925de7-580e-4ca9-bfd7-c2c2cefbd2ad",
        "helper": "ftp",
        "port": 21
    }
}

浮动IP (floatingips)

DNS集成

dns-integration扩展为浮动IP添加了dns_namedns_domain属性,允许在创建时指定它们。当Neutron配置为与此类服务集成时,这些属性中的数据将发布到外部DNS服务。

浮动IP分布式

floating-ip-distributed扩展向浮动IP添加了distributed属性。此属性的值标识浮动IP是分布式还是集中式的。

浮动IP端口详细信息

fip-port-details扩展向浮动IP添加了port_details属性。此属性的值包含关联端口的信息。

浮动IP端口转发

expose-port-forwarding-in-fip扩展向浮动IP添加了port_forwardings属性。此属性的值包含关联端口转发资源的信息。

浮动IP端口转发详细信息

floating-ip-port-forwarding-detail扩展向port_forwardings添加了idinternal_port_id属性。

QoS扩展

qos扩展(QoS)通过引入qos_policy_id属性,使得能够定义QoS策略并将其关联到浮动IP。策略应在与浮动IP关联之前创建。

QoS网络策略

qos-fip扩展向浮动IP响应添加了只读参数qos_network_policy_id。此参数包含此浮动IP所分配网络的QoS策略ID。

资源时间戳

The standard-attr-timestamp extension adds the created_at and updated_at attributes to all resources that have standard attributes.

标签扩展

The standard-attr-tag adds Tag support for resources with standard attributes by adding the tags attribute allowing consumers to associate tags with resources.

GET
/v2.0/floatingips

列出浮动IP

列出用户可见的浮动IP。

默认策略设置仅返回用户项目拥有的浮动IP,除非用户具有管理员角色。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

此示例请求以JSON格式列出浮动IP

GET /v2.0/floatingips
Accept: application/json

正常响应代码:200

Error response codes: 401

请求

名称

入参

类型

描述

id (可选)

查询

字符串

Filter the list result by the ID of the resource.

router_id (Optional)

查询

字符串

按浮动IP的路由器ID过滤浮动IP列表结果。

status (可选)

查询

字符串

按浮动IP的状态过滤浮动IP列表结果。值为ACTIVEDOWNERROR

tenant_id (可选)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

project_id (可选)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

revision_number (Optional)

查询

整数

Filter the list result by the revision number of the resource.

description (可选)

查询

字符串

Filter the list result by the human-readable description of the resource.

distributed (Optional)

body

布尔值

true表示分布式浮动IP。在启用floating-ip-distributed扩展时可用。

floating_network_id (Optional)

查询

字符串

按与浮动IP关联的网络ID过滤浮动IP列表结果。

fixed_ip_address (Optional)

查询

字符串

按与浮动IP地址关联的固定IP地址过滤浮动IP列表结果。

floating_ip_address (Optional)

查询

字符串

按浮动IP地址过滤浮动IP列表结果。

port_id (Optional)

查询

字符串

按与浮动IP关联的端口ID过滤浮动IP列表结果。

sort_dir (可选)

查询

字符串

Sort direction. A valid value is asc (ascending) or desc (descending). You can specify multiple pairs of sort key and sort direction query parameters.

sort_key (可选)

查询

字符串

按浮动IP属性排序。您可以指定多个排序键和排序方向查询参数对。排序键限于

  • fixed_ip_address

  • floating_ip_address

  • floating_network_id

  • id

  • router_id

  • status

  • tenant_id

  • project_id

tags (可选)

查询

字符串

A list of tags to filter the list result by. Resources that match all tags in this list will be returned. Tags in query must be separated by comma.

tags-any (Optional)

查询

字符串

A list of tags to filter the list result by. Resources that match any tag in this list will be returned. Tags in query must be separated by comma.

not-tags (Optional)

查询

字符串

A list of tags to filter the list result by. Resources that match all tags in this list will be excluded. Tags in query must be separated by comma.

not-tags-any (Optional)

查询

字符串

A list of tags to filter the list result by. Resources that match any tag in this list will be excluded. Tags in query must be separated by comma.

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

浮动 IP

body

数组

一个floatingip对象的列表。

id

body

字符串

浮动IP地址的ID。

router_id

body

字符串

浮动IP的路由器ID。

status

body

字符串

浮动IP的状态。值为ACTIVEDOWNERROR

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

revision_number

body

整数

The revision number of the resource.

description

body

字符串

A human-readable description for the resource.

distributed

body

布尔值

true表示分布式浮动IP。在启用floating-ip-distributed扩展时可用。

dns_domain

body

字符串

A valid DNS domain.

dns_name

body

字符串

有效的DNS名称。

port_details

body

字符串

此浮动IP关联的端口信息。特别是,如果浮动IP与端口关联,则此字段包含关联端口的一些属性,包括namenetwork_idmac_addressadmin_state_upstatusdevice_iddevice_owner。如果浮动IP未与端口关联,则此字段为null

qos_network_policy_id

body

字符串

此浮动IP所分配网络的QoS策略ID。

qos_policy_id

body

字符串

与浮动IP关联的QoS策略ID。

floating_network_id

body

字符串

与浮动IP关联的网络ID。

fixed_ip_address

body

字符串

与浮动IP地址关联的固定IP地址。

floating_ip_address

body

字符串

浮动 IP 地址。

port_id

body

字符串

与浮动IP关联的端口ID。

tags

body

数组

The list of tags on the resource.

port_forwardings

body

数组

浮动 IP 的关联端口转发资源。如果浮动 IP 有多个端口转发资源,则此字段有多个条目。每个条目包含网络 IP 协议(protocol)、内部 Neutron 端口的固定 IP 地址(internal_ip_address)、内部 Neutron 端口使用的 TCP 或 UDP 端口或端口范围(internal_port)或(internal_port_range)以及浮动 IP 使用的 TCP 或 UDP 端口或端口范围(external_port)或(external_port_range)。

响应示例

{
    "floatingips": [
        {
            "router_id": "d23abc8d-2991-4a55-ba98-2aaea84cc72f",
            "description": "for test",
            "dns_domain": "my-domain.org.",
            "dns_name": "myfip",
            "created_at": "2016-12-21T10:55:50Z",
            "updated_at": "2016-12-21T10:55:53Z",
            "revision_number": 1,
            "project_id": "4969c491a3c74ee4af974e6d800c62de",
            "tenant_id": "4969c491a3c74ee4af974e6d800c62de",
            "floating_network_id": "376da547-b977-4cfe-9cba-275c80debf57",
            "fixed_ip_address": "10.0.0.3",
            "floating_ip_address": "172.24.4.228",
            "port_id": "ce705c24-c1ef-408a-bda3-7bbd946164ab",
            "id": "2f245a7b-796b-4f26-9cf9-9e82d248fda7",
            "status": "ACTIVE",
            "port_details": {
                "status": "ACTIVE",
                "name": "",
                "admin_state_up": true,
                "network_id": "02dd8479-ef26-4398-a102-d19d0a7b3a1f",
                "device_owner": "compute:nova",
                "mac_address": "fa:16:3e:b1:3b:30",
                "device_id": "8e3941b4-a6e9-499f-a1ac-2a4662025cba"
            },
            "tags": ["tag1,tag2"],
            "port_forwardings": [],
            "qos_network_policy_id": "174dd0c1-a4eb-49d4-a807-ae80246d82f4",
            "qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae"

        },
        {
            "router_id": null,
            "description": "for test",
            "dns_domain": "my-domain.org.",
            "dns_name": "myfip2",
            "created_at": "2016-12-21T11:55:50Z",
            "updated_at": "2016-12-21T11:55:53Z",
            "revision_number": 2,
            "project_id": "4969c491a3c74ee4af974e6d800c62de",
            "tenant_id": "4969c491a3c74ee4af974e6d800c62de",
            "floating_network_id": "376da547-b977-4cfe-9cba-275c80debf57",
            "fixed_ip_address": null,
            "floating_ip_address": "172.24.4.227",
            "port_id": null,
            "id": "61cea855-49cb-4846-997d-801b70c71bdd",
            "status": "DOWN",
            "port_details": null,
            "tags": ["tag1,tag2"],
            "port_forwardings": [],
            "qos_network_policy_id": "174dd0c1-a4eb-49d4-a807-ae80246d82f4",
            "qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae"
        },
        {
            "router_id": "0303bf18-2c52-479c-bd68-e0ad712a1639",
            "description": "for test with port forwarding",
            "dns_domain": "my-domain.org.",
            "dns_name": "myfip3",
            "created_at": "2018-06-15T02:12:48Z",
            "updated_at": "2018-06-15T02:12:57Z",
            "revision_number": 1,
            "project_id": "4969c491a3c74ee4af974e6d800c62de",
            "tenant_id": "4969c491a3c74ee4af974e6d800c62de",
            "floating_network_id": "376da547-b977-4cfe-9cba-275c80debf57",
            "fixed_ip_address": null,
            "floating_ip_address": "172.24.4.42",
            "port_id": null,
            "id": "898b198e-49f7-47d6-a7e1-53f626a548e6",
            "status": "ACTIVE",
            "tags": [],
            "port_forwardings": [
                {
                    "protocol": "tcp",
                    "internal_ip_address": "10.0.0.19",
                    "internal_port": 25,
                    "internal_port_id": "2057ec54-8be2-11eb-8dcd-0242ac130003",
                    "external_port": 2225,
                    "id": "0f23a90a-8be2-11eb-8dcd-0242ac130003"
                },
                {
                    "protocol": "tcp",
                    "internal_ip_address": "10.0.0.18",
                    "internal_port": 16666,
                    "internal_port_id": "1238be08-a2a8-4b8d-addf-fb5e2250e480",
                    "external_port": 8786,
                    "id": "e0a0274e-4d19-4eab-9e12-9e77a8caf3ea"
                }
            ],
            "qos_network_policy_id": "174dd0c1-a4eb-49d4-a807-ae80246d82f4",
            "qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae"
        }
    ]
}
POST
/v2.0/floatingips

创建浮动 IP

创建浮动 IP,如果指定了端口信息,则将浮动 IP 与内部端口关联。

要将浮动 IP 与内部端口关联,请在请求正文中指定端口 ID 属性。如果未在请求中指定端口 ID,则可以发出 PUT 请求而不是 POST 请求。

默认策略设置仅允许管理员用户设置浮动 IP 地址,而某些非管理员用户可能需要浮动 IP 地址。如果未在请求中指定浮动 IP 地址,则操作会自动分配一个。

默认情况下,此操作会将浮动 IP 地址与配置在 OpenStack 网络端口上的单个固定 IP 地址关联。如果端口有多个 IP 地址,则必须在请求正文中指定 fixed_ip_address 属性,才能将固定 IP 地址与浮动 IP 地址关联。

您只能在外部网络上创建浮动 IP。创建浮动 IP 时,必须指定要在其上创建浮动 IP 的网络的 ID。或者,您可以根据该子网的成本和质量,在外部网络上的子网中创建浮动 IP。

您必须将 IP 地址配置为与浮动 IP 地址关联的内部 OpenStack 网络端口。

操作会因以下原因之一而返回 Bad Request (400) 响应代码:

  • 网络不是外部网络,例如 router:external=False

  • 内部 OpenStack 网络端口未与浮动 IP 地址关联。

  • 请求的浮动 IP 地址不在外部网络的子网范围内。

  • 固定 IP 地址无效。

如果端口 ID 无效,此操作将返回 404 响应代码。

操作会因以下原因之一而返回 Conflict (409) 响应代码:

  • 请求的浮动 IP 地址已在使用中。

  • 内部 OpenStack 网络端口和固定 IP 地址已与其他浮动 IP 关联。

  • 外部 DNS 服务记录集配额超出限制。

正常响应代码:201

错误响应代码:400、401、404、409

请求

名称

入参

类型

描述

floatingip

body

对象

一个 floatingip 对象。当您将浮动 IP 地址与虚拟机关联时,该实例每次启动时都具有相同的公共 IP 地址,主要是为了保持一致的 IP 地址以维护 DNS 分配。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

floating_network_id

body

字符串

与浮动IP关联的网络ID。

fixed_ip_address (Optional)

body

字符串

与浮动 IP 关联的固定 IP 地址。如果内部端口有多个关联的 IP 地址,则服务会选择第一个 IP 地址,除非您在 fixed_ip_address 参数中显式定义了固定 IP 地址。

floating_ip_address (Optional)

body

字符串

浮动 IP 地址。

port_id (Optional)

body

字符串

与浮动 IP 关联的端口的 ID。要在创建时将浮动 IP 与固定 IP 关联,必须指定内部端口的标识符。

subnet_id (可选)

body

字符串

要在其上创建浮动 IP 的子网的 ID。

distributed (Optional)

body

布尔值

true表示分布式浮动IP。在启用floating-ip-distributed扩展时可用。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

dns_domain (Optional)

body

字符串

A valid DNS domain.

dns_name (Optional)

body

字符串

有效的DNS名称。

qos_policy_id (Optional)

body

字符串

与浮动IP关联的QoS策略ID。

请求示例

{
    "floatingip": {
        "floating_network_id": "376da547-b977-4cfe-9cba-275c80debf57",
        "port_id": "ce705c24-c1ef-408a-bda3-7bbd946164ab",
        "subnet_id": "278d9507-36e7-403c-bb80-1d7093318fe6",
        "fixed_ip_address": "10.0.0.3",
        "floating_ip_address": "172.24.4.228",
        "description": "floating ip for testing",
        "dns_domain": "my-domain.org.",
        "dns_name": "myfip",
        "qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae"
    }
}

响应参数

名称

入参

类型

描述

floatingip

body

对象

一个 floatingip 对象。当您将浮动 IP 地址与虚拟机关联时,该实例每次启动时都具有相同的公共 IP 地址,主要是为了保持一致的 IP 地址以维护 DNS 分配。

router_id

body

字符串

浮动IP的路由器ID。

status

body

字符串

浮动IP的状态。值为ACTIVEDOWNERROR

description

body

字符串

A human-readable description for the resource.

distributed

body

布尔值

true表示分布式浮动IP。在启用floating-ip-distributed扩展时可用。

dns_domain

body

字符串

A valid DNS domain.

dns_name

body

字符串

有效的DNS名称。

port_details

body

字符串

此浮动IP关联的端口信息。特别是,如果浮动IP与端口关联,则此字段包含关联端口的一些属性,包括namenetwork_idmac_addressadmin_state_upstatusdevice_iddevice_owner。如果浮动IP未与端口关联,则此字段为null

tenant_id

body

字符串

项目的 ID。

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

revision_number

body

整数

The revision number of the resource.

project_id

body

字符串

项目的 ID。

floating_network_id

body

字符串

与浮动IP关联的网络ID。

fixed_ip_address

body

字符串

与浮动IP地址关联的固定IP地址。

floating_ip_address

body

字符串

浮动 IP 地址。

port_id

body

字符串

与浮动IP关联的端口ID。

id

body

字符串

浮动IP地址的ID。

tags

body

数组

The list of tags on the resource.

port_forwardings

body

数组

浮动 IP 的关联端口转发资源。如果浮动 IP 有多个端口转发资源,则此字段有多个条目。每个条目包含网络 IP 协议(protocol)、内部 Neutron 端口的固定 IP 地址(internal_ip_address)、内部 Neutron 端口使用的 TCP 或 UDP 端口或端口范围(internal_port)或(internal_port_range)以及浮动 IP 使用的 TCP 或 UDP 端口或端口范围(external_port)或(external_port_range)。

qos_network_policy_id

body

字符串

此浮动IP所分配网络的QoS策略ID。

qos_policy_id

body

字符串

与浮动IP关联的QoS策略ID。

响应示例

{
    "floatingip": {
        "fixed_ip_address": "10.0.0.3",
        "floating_ip_address": "172.24.4.228",
        "floating_network_id": "376da547-b977-4cfe-9cba-275c80debf57",
        "id": "2f245a7b-796b-4f26-9cf9-9e82d248fda7",
        "port_id": "ce705c24-c1ef-408a-bda3-7bbd946164ab",
        "router_id": "d23abc8d-2991-4a55-ba98-2aaea84cc72f",
        "status": "ACTIVE",
        "project_id": "4969c491a3c74ee4af974e6d800c62de",
        "tenant_id": "4969c491a3c74ee4af974e6d800c62de",
        "description": "floating ip for testing",
        "dns_domain": "my-domain.org.",
        "dns_name": "myfip",
        "created_at": "2016-12-21T01:36:04Z",
        "updated_at": "2016-12-21T01:36:04Z",
        "revision_number": 1,
        "port_details": {
            "status": "ACTIVE",
            "name": "",
            "admin_state_up": true,
            "network_id": "02dd8479-ef26-4398-a102-d19d0a7b3a1f",
            "device_owner": "compute:nova",
            "mac_address": "fa:16:3e:b1:3b:30",
            "device_id": "8e3941b4-a6e9-499f-a1ac-2a4662025cba"
        },
        "tags": ["tag1,tag2"],
        "port_forwardings": [],
        "qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae"
    }
}
GET
/v2.0/floatingips/{floatingip_id}

显示浮动 IP 详细信息

显示浮动 IP 的详细信息。

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

此示例请求以 JSON 格式显示浮动 IP 的详细信息。此示例还按 fixed_ip_addressfloating_ip_address 字段过滤结果。

GET /v2.0/floatingips/{floatingip_id}?fields=fixed_ip_address
&
fields=floating_ip_address
Accept: application/json

正常响应代码:200

错误响应代码:401、403、404

请求

名称

入参

类型

描述

floatingip_id

路径

字符串

浮动IP地址的ID。

响应参数

名称

入参

类型

描述

floatingip

body

对象

一个 floatingip 对象。当您将浮动 IP 地址与虚拟机关联时,该实例每次启动时都具有相同的公共 IP 地址,主要是为了保持一致的 IP 地址以维护 DNS 分配。

router_id

body

字符串

浮动IP的路由器ID。

status

body

字符串

浮动IP的状态。值为ACTIVEDOWNERROR

description

body

字符串

A human-readable description for the resource.

distributed

body

布尔值

true表示分布式浮动IP。在启用floating-ip-distributed扩展时可用。

dns_domain

body

字符串

A valid DNS domain.

dns_name

body

字符串

有效的DNS名称。

port_details

body

字符串

此浮动IP关联的端口信息。特别是,如果浮动IP与端口关联,则此字段包含关联端口的一些属性,包括namenetwork_idmac_addressadmin_state_upstatusdevice_iddevice_owner。如果浮动IP未与端口关联,则此字段为null

tenant_id

body

字符串

项目的 ID。

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

revision_number

body

整数

The revision number of the resource.

project_id

body

字符串

项目的 ID。

floating_network_id

body

字符串

与浮动IP关联的网络ID。

fixed_ip_address

body

字符串

与浮动IP地址关联的固定IP地址。

floating_ip_address

body

字符串

浮动 IP 地址。

port_id

body

字符串

与浮动IP关联的端口ID。

id

body

字符串

浮动IP地址的ID。

tags

body

数组

The list of tags on the resource.

port_forwardings

body

数组

浮动 IP 的关联端口转发资源。如果浮动 IP 有多个端口转发资源,则此字段有多个条目。每个条目包含网络 IP 协议(protocol)、内部 Neutron 端口的固定 IP 地址(internal_ip_address)、内部 Neutron 端口使用的 TCP 或 UDP 端口或端口范围(internal_port)或(internal_port_range)以及浮动 IP 使用的 TCP 或 UDP 端口或端口范围(external_port)或(external_port_range)。

qos_network_policy_id

body

字符串

此浮动IP所分配网络的QoS策略ID。

qos_policy_id

body

字符串

与浮动IP关联的QoS策略ID。

响应示例

{
    "floatingip": {
        "floating_network_id": "376da547-b977-4cfe-9cba-275c80debf57",
        "router_id": "d23abc8d-2991-4a55-ba98-2aaea84cc72f",
        "fixed_ip_address": "10.0.0.3",
        "floating_ip_address": "172.24.4.228",
        "project_id": "4969c491a3c74ee4af974e6d800c62de",
        "tenant_id": "4969c491a3c74ee4af974e6d800c62de",
        "status": "ACTIVE",
        "port_id": "ce705c24-c1ef-408a-bda3-7bbd946164ab",
        "id": "2f245a7b-796b-4f26-9cf9-9e82d248fda7",
        "description": "floating ip for testing",
        "dns_domain": "my-domain.org.",
        "dns_name": "myfip",
        "created_at": "2016-12-21T01:36:04Z",
        "updated_at": "2016-12-21T01:36:04Z",
        "revision_number": 1,
        "port_details": {
            "status": "ACTIVE",
            "name": "",
            "admin_state_up": true,
            "network_id": "02dd8479-ef26-4398-a102-d19d0a7b3a1f",
            "device_owner": "compute:nova",
            "mac_address": "fa:16:3e:b1:3b:30",
            "device_id": "8e3941b4-a6e9-499f-a1ac-2a4662025cba"
        },
        "tags": ["tag1,tag2"],
        "port_forwardings": [],
        "qos_network_policy_id": "174dd0c1-a4eb-49d4-a807-ae80246d82f4",
        "qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae"

    }
}
PUT
/v2.0/floatingips/{floatingip_id}

更新浮动 IP

更新浮动 IP 及其与内部端口的关联。

关联过程与创建浮动 IP 操作的过程相同。

要将浮动 IP 与端口解除关联,请将 port_id 属性设置为 null 或将其从请求正文中省略。

此示例更新浮动 IP

PUT /v2.0/floatingips/{floatingip_id} Accept: application/json

根据您提交的请求正文,此请求会将端口与浮动 IP 关联或将浮动 IP 与端口解除关联。

正常响应代码:200

错误响应代码:400、401、404、409、412

请求

名称

入参

类型

描述

floatingip

body

对象

一个 floatingip 对象。当您将浮动 IP 地址与虚拟机关联时,该实例每次启动时都具有相同的公共 IP 地址,主要是为了保持一致的 IP 地址以维护 DNS 分配。

floatingip_id

路径

字符串

浮动IP地址的ID。

port_id

body

字符串

与浮动 IP 关联的端口的 ID。要将浮动 IP 与固定 IP 关联,必须指定内部端口的 ID。要解除浮动 IP 的关联,应指定 null

fixed_ip_address (Optional)

body

字符串

与浮动 IP 关联的固定 IP 地址。如果内部端口有多个关联的 IP 地址,则服务会选择第一个 IP 地址,除非您在 fixed_ip_address 参数中显式定义了固定 IP 地址。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

distributed (Optional)

body

布尔值

true表示分布式浮动IP。在启用floating-ip-distributed扩展时可用。

请求示例

{
    "floatingip": {
        "port_id": "fc861431-0e6c-4842-a0ed-e2363f9bc3a8"
    }
}

请求示例(解除关联)

{
    "floatingip": {
        "port_id": null
    }
}

响应参数

名称

入参

类型

描述

floatingip

body

对象

一个 floatingip 对象。当您将浮动 IP 地址与虚拟机关联时,该实例每次启动时都具有相同的公共 IP 地址,主要是为了保持一致的 IP 地址以维护 DNS 分配。

router_id

body

字符串

浮动IP的路由器ID。

status

body

字符串

浮动IP的状态。值为ACTIVEDOWNERROR

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

floating_network_id

body

字符串

与浮动IP关联的网络ID。

fixed_ip_address

body

字符串

与浮动IP地址关联的固定IP地址。

floating_ip_address

body

字符串

浮动 IP 地址。

port_id

body

字符串

与浮动IP关联的端口ID。

id

body

字符串

浮动IP地址的ID。

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

revision_number

body

整数

The revision number of the resource.

description

body

字符串

A human-readable description for the resource.

distributed

body

布尔值

true表示分布式浮动IP。在启用floating-ip-distributed扩展时可用。

dns_domain

body

字符串

A valid DNS domain.

dns_name

body

字符串

有效的DNS名称。

port_details

body

字符串

此浮动IP关联的端口信息。特别是,如果浮动IP与端口关联,则此字段包含关联端口的一些属性,包括namenetwork_idmac_addressadmin_state_upstatusdevice_iddevice_owner。如果浮动IP未与端口关联,则此字段为null

tags

body

数组

The list of tags on the resource.

port_forwardings

body

数组

浮动 IP 的关联端口转发资源。如果浮动 IP 有多个端口转发资源,则此字段有多个条目。每个条目包含网络 IP 协议(protocol)、内部 Neutron 端口的固定 IP 地址(internal_ip_address)、内部 Neutron 端口使用的 TCP 或 UDP 端口或端口范围(internal_port)或(internal_port_range)以及浮动 IP 使用的 TCP 或 UDP 端口或端口范围(external_port)或(external_port_range)。

qos_network_policy_id

body

字符串

此浮动IP所分配网络的QoS策略ID。

qos_policy_id

body

字符串

与浮动IP关联的QoS策略ID。

响应示例

{
    "floatingip": {
        "created_at": "2016-12-21T10:55:50Z",
        "description": "floating ip for testing",
        "dns_domain": "my-domain.org.",
        "dns_name": "myfip",
        "fixed_ip_address": "10.0.0.4",
        "floating_ip_address": "172.24.4.228",
        "floating_network_id": "376da547-b977-4cfe-9cba-275c80debf57",
        "id": "2f245a7b-796b-4f26-9cf9-9e82d248fda7",
        "port_id": "fc861431-0e6c-4842-a0ed-e2363f9bc3a8",
        "project_id": "4969c491a3c74ee4af974e6d800c62de",
        "revision_number": 3,
        "router_id": "d23abc8d-2991-4a55-ba98-2aaea84cc72f",
        "status": "ACTIVE",
        "tags": ["tag1,tag2"],
        "tenant_id": "4969c491a3c74ee4af974e6d800c62de",
        "updated_at": "2016-12-22T03:13:49Z",
        "port_details": {
            "status": "ACTIVE",
            "name": "",
            "admin_state_up": true,
            "network_id": "02dd8479-ef26-4398-a102-d19d0a7b3a1f",
            "device_owner": "compute:nova",
            "mac_address": "fa:16:3e:b1:3b:30",
            "device_id": "8e3941b4-a6e9-499f-a1ac-2a4662025cba"
        },
        "port_forwardings": [],
        "qos_network_policy_id": "174dd0c1-a4eb-49d4-a807-ae80246d82f4",
        "qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae"
    }
}

响应示例(解除关联)

{
    "floatingip": {
        "floating_network_id": "376da547-b977-4cfe-9cba-275c80debf57",
        "router_id": "d23abc8d-2991-4a55-ba98-2aaea84cc72f",
        "fixed_ip_address": null,
        "floating_ip_address": "172.24.4.228",
        "project_id": "4969c491a3c74ee4af974e6d800c62de",
        "tenant_id": "4969c491a3c74ee4af974e6d800c62de",
        "status": "ACTIVE",
        "port_id": null,
        "id": "2f245a7b-796b-4f26-9cf9-9e82d248fda7",
        "description": "for test",
        "created_at": "2016-12-21T10:55:50Z",
        "updated_at": "2016-12-22T03:13:49Z",
        "revision_number": 3,
        "port_details": null,
        "tags": ["tag1,tag2"],
        "port_forwardings": []
    }
}
DELETE
/v2.0/floatingips/{floatingip_id}

删除浮动 IP

删除浮动 IP,如果存在,则删除其关联的端口。

此示例删除浮动 IP

DELETE /v2.0/floatingips/{floatingip_id} Accept: application/json

正常响应代码:204

错误响应代码:401、404、412

请求

名称

入参

类型

描述

floatingip_id

路径

字符串

浮动IP地址的ID。

响应

There is no body content for the response of a successful DELETE request.

浮动 IP 池 (floatingip_pools)

列出浮动 IP 池。

GET
/v2.0/floatingip_pools

列出浮动 IP 池

列出用户可见的浮动 IP 池。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

Error response codes: 401

请求

响应参数

名称

入参

类型

描述

floatingip_pools

body

数组

一个 floatingip_pools 对象的列表。

subnet_id

body

字符串

子网的 ID。

network_id

body

字符串

子网所属网络的 ID。

subnet_name

body

字符串

Human-readable name of the resource.

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

cidr

body

字符串

子网的 CIDR。

响应示例

{
    "floatingip_pools": [
        {
            "subnet_id": "cdec285c-b157-48aa-900c-e77f6bd958e5",
            "tenant_id": "26a7980765d0414dbc1fc1f88cdb7e6e",
            "network_id": "db193ab3-96e3-4cb3-8fc5-05f4296d0324",
            "subnet_name": "public-subnet",
            "cidr": "192.0.0.0/8",
            "project_id": "26a7980765d0414dbc1fc1f88cdb7e6e"
        }
    ]
}

浮动 IP 端口转发

列出、创建、显示浮动 IP 端口转发的详细信息、更新和删除。

带端口范围的端口转发

floating-ip-port-forwarding-port-ranges 扩展在浮动 IP 端口转发中添加了新的属性 internal_port_rangeexternal_port_range。这些新属性的值应为表示端口范围的字符串,用冒号分隔。您不能在同一请求中使用 internal_port_rangeexternal_port_range 属性与 internal_portexternal_port 属性。

端口转发规则描述

floating-ip-port-forwarding-description 扩展在浮动 IP 端口转发中添加了 description 属性。description 属性的值包含描述规则的文本,这有助于用户轻松管理/查找他们的规则。

GET
/v2.0/floatingips/{floatingip_id}/port_forwardings/{port_forwarding_id}

显示端口转发

显示浮动 IP 端口转发的信息。

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

错误响应代码:400、404

请求

名称

入参

类型

描述

floatingip_id

路径

字符串

浮动IP地址的ID。

port_forwarding_id

路径

字符串

浮动 IP 端口转发的 ID。

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

port_forwarding

body

对象

一个 floating IP port forwarding 对象。

id

body

字符串

浮动 IP 端口转发的 ID。

internal_port_id

body

字符串

与浮动 IP 端口转发关联的 Neutron 端口的 ID。

internal_ip_address

body

字符串

与浮动 IP 端口转发关联的 Neutron 端口的固定 IPv4 地址。

internal_port (可选)

body

整数

与浮动 IP 端口转发关联的 Neutron 端口固定 IP 地址的 TCP/UDP/其他协议端口号。

internal_port_range (可选)

body

字符串

与浮动 IP 端口转发关联的 Neutron 端口固定 IP 地址的 TCP/UDP/其他协议端口范围。

external_port (可选)

body

整数

端口转发的浮动 IP 地址的 TCP/UDP/其他协议端口号。

external_port_range (可选)

body

字符串

端口转发的浮动 IP 地址的 TCP/UDP/其他协议端口范围。

协议

body

字符串

浮动 IP 端口转发使用的 IP 协议。

description (可选)

body

字符串

描述规则的文本,这有助于用户轻松管理/查找他们的规则。

响应示例

{
  "port_forwarding": {
    "protocol": "tcp",
    "internal_ip_address": "10.0.0.11",
    "internal_port": 25,
    "internal_port_id": "1238be08-a2a8-4b8d-addf-fb5e2250e480",
    "external_port": 2230,
    "description": "Some description",
    "id": "725ade3c-9760-4880-8080-8fc2dbab9acc"
  }
}
PUT
/v2.0/floatingips/{floatingip_id}/port_forwardings/{port_forwarding_id}

更新端口转发

更新浮动 IP 端口转发。

正常响应代码:200

错误响应代码:400、404

请求

名称

入参

类型

描述

floatingip_id

路径

字符串

浮动IP地址的ID。

port_forwarding_id

路径

字符串

浮动 IP 端口转发的 ID。

port_forwarding

body

对象

一个 floating IP port forwarding 对象。

internal_port_id (可选)

body

字符串

与浮动 IP 端口转发关联的 Neutron 端口的 ID。

internal_ip_address

body

字符串

与浮动 IP 端口转发关联的 Neutron 端口的固定 IPv4 地址。

internal_port (可选)

body

整数

与浮动 IP 端口转发关联的 Neutron 端口固定 IP 地址的 TCP/UDP/其他协议端口号。

internal_port_range (可选)

body

字符串

与浮动 IP 端口转发关联的 Neutron 端口固定 IP 地址的 TCP/UDP/其他协议端口范围。

external_port (可选)

body

整数

端口转发的浮动 IP 地址的 TCP/UDP/其他协议端口号。

external_port_range (可选)

body

字符串

端口转发的浮动 IP 地址的 TCP/UDP/其他协议端口范围。

protocol (Optional)

body

字符串

浮动 IP 端口转发使用的 IP 协议。

请求示例

{
  "port_forwarding": {
    "protocol": "udp",
    "internal_port": 37,
    "internal_port_id": "99889dc2-19a7-4edb-b9d0-d2ace8d1e144",
    "external_port": 1960,
    "description": "Some description"
  }
}

响应参数

名称

入参

类型

描述

port_forwarding

body

对象

一个 floating IP port forwarding 对象。

id

body

字符串

浮动 IP 端口转发的 ID。

internal_port_id

body

字符串

与浮动 IP 端口转发关联的 Neutron 端口的 ID。

internal_ip_address

body

字符串

与浮动 IP 端口转发关联的 Neutron 端口的固定 IPv4 地址。

internal_port (可选)

body

整数

与浮动 IP 端口转发关联的 Neutron 端口固定 IP 地址的 TCP/UDP/其他协议端口号。

internal_port_range (可选)

body

字符串

与浮动 IP 端口转发关联的 Neutron 端口固定 IP 地址的 TCP/UDP/其他协议端口范围。

external_port (可选)

body

整数

端口转发的浮动 IP 地址的 TCP/UDP/其他协议端口号。

external_port_range (可选)

body

字符串

端口转发的浮动 IP 地址的 TCP/UDP/其他协议端口范围。

协议

body

字符串

浮动 IP 端口转发使用的 IP 协议。

description (可选)

body

字符串

描述规则的文本,这有助于用户轻松管理/查找他们的规则。

响应示例

{
  "port_forwarding": {
    "protocol": "udp",
    "internal_ip_address": "10.0.0.14",
    "internal_port": 37,
    "internal_port_id": "99889dc2-19a7-4edb-b9d0-d2ace8d1e144",
    "external_port": 1960,
    "description": "Some description",
    "id": "725ade3c-9760-4880-8080-8fc2dbab9acc"
  }
}
DELETE
/v2.0/floatingips/{floatingip_id}/port_forwardings/{port_forwarding_id}

删除浮动 IP 端口转发

删除浮动 IP 端口转发。

正常响应代码:204

错误响应代码:404

请求

名称

入参

类型

描述

floatingip_id

路径

字符串

浮动IP地址的ID。

port_forwarding_id

路径

字符串

浮动 IP 端口转发的 ID。

响应

There is no body content for the response of a successful DELETE request.

GET
/v2.0/floatingips/{floatingip_id}/port_forwardings

列出浮动 IP 端口转发

列出项目可以访问的浮动 IP 端口转发。

默认策略设置仅返回与提交请求的用户项目拥有的浮动 IP 关联的端口转发,除非用户具有管理员角色。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

错误响应代码:400、404

请求

名称

入参

类型

描述

floatingip_id

路径

字符串

浮动IP地址的ID。

id (可选)

查询

字符串

Filter the list result by the ID of the resource.

internal_port_id (可选)

查询

字符串

按内部 Neutron 端口的 ID 过滤列表结果。

external_port (可选)

查询

整数

按浮动 IP 的 TCP/UDP/其他协议端口号过滤列表结果。

external_port_range (可选)

查询

字符串

按浮动 IP 的 TCP/UDP/其他协议端口范围过滤列表结果。

protocol (Optional)

查询

字符串

按使用的协议过滤列表结果。

sort_key (可选)

查询

字符串

按浮动 IP 端口转发属性排序。您可以指定多个排序键和排序方向查询参数对。排序键仅限于

  • id

  • internal_port_id

  • external_port

  • external_port_range

  • 协议

sort_dir (可选)

查询

字符串

Sort direction. A valid value is asc (ascending) or desc (descending). You can specify multiple pairs of sort key and sort direction query parameters.

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

port_forwardings

body

数组

一个 floating IP port forwardings 对象的列表。

id

body

字符串

浮动 IP 端口转发的 ID。

internal_port_id

body

字符串

与浮动 IP 端口转发关联的 Neutron 端口的 ID。

internal_ip_address

body

字符串

与浮动 IP 端口转发关联的 Neutron 端口的固定 IPv4 地址。

internal_port (可选)

body

整数

与浮动 IP 端口转发关联的 Neutron 端口固定 IP 地址的 TCP/UDP/其他协议端口号。

internal_port_range (可选)

body

字符串

与浮动 IP 端口转发关联的 Neutron 端口固定 IP 地址的 TCP/UDP/其他协议端口范围。

external_port (可选)

body

整数

端口转发的浮动 IP 地址的 TCP/UDP/其他协议端口号。

external_port_range (可选)

body

字符串

端口转发的浮动 IP 地址的 TCP/UDP/其他协议端口范围。

协议

body

字符串

浮动 IP 端口转发使用的 IP 协议。

description (可选)

body

字符串

描述规则的文本,这有助于用户轻松管理/查找他们的规则。

响应示例

{
  "port_forwardings": [
    {
      "protocol": "tcp",
      "internal_ip_address": "10.0.0.24",
      "internal_port": 25,
      "internal_port_id": "070ef0b2-0175-4299-be5c-01fea8cca522",
      "external_port": 2229,
      "description": "Some description",
      "id": "1798dc82-c0ed-4b79-b12d-4c3c18f90eb2"
    },
    {
      "protocol": "tcp",
      "internal_ip_address": "10.0.0.11",
      "internal_port": 25,
      "internal_port_id": "1238be08-a2a8-4b8d-addf-fb5e2250e480",
      "external_port": 2230,
      "description": "",
      "id": "e0a0274e-4d19-4eab-9e12-9e77a8caf3ea"
    },
    {
      "protocol": "tcp",
      "internal_ip_address": "10.0.0.12",
      "internal_port_range": "80:90",
      "internal_port_id": "2057ec54-8be2-11eb-8dcd-0242ac130003",
      "external_port_range": "8080:8090",
      "description": "using port ranges",
      "id": "0f23a90a-8be2-11eb-8dcd-0242ac130003"
    }
  ]
}
POST
/v2.0/floatingips/{floatingip_id}/port_forwardings

创建端口转发

创建浮动 IP 端口转发。

正常响应代码:201

错误响应代码:400、404

请求

名称

入参

类型

描述

floatingip_id

路径

字符串

浮动IP地址的ID。

port_forwarding

body

对象

一个 floating IP port forwarding 对象。

internal_port_id

body

字符串

与浮动 IP 端口转发关联的 Neutron 端口的 ID。

internal_ip_address

body

字符串

与浮动 IP 端口转发关联的 Neutron 端口的固定 IPv4 地址。

internal_port (可选)

body

整数

与浮动 IP 端口转发关联的 Neutron 端口固定 IP 地址的 TCP/UDP/其他协议端口号。

internal_port_range (可选)

body

字符串

与浮动 IP 端口转发关联的 Neutron 端口固定 IP 地址的 TCP/UDP/其他协议端口范围。

external_port (可选)

body

整数

端口转发的浮动 IP 地址的 TCP/UDP/其他协议端口号。

external_port_range (可选)

body

字符串

端口转发的浮动 IP 地址的 TCP/UDP/其他协议端口范围。

协议

body

字符串

浮动 IP 端口转发使用的 IP 协议。

description (可选)

body

字符串

描述规则的文本,这有助于用户轻松管理/查找他们的规则。

请求示例

{
  "port_forwarding": {
    "protocol": "tcp",
    "internal_ip_address": "10.0.0.11",
    "internal_port": 25,
    "internal_port_id": "1238be08-a2a8-4b8d-addf-fb5e2250e480",
    "external_port": 2230,
    "description": "Some description"
  }
}

响应参数

名称

入参

类型

描述

port_forwarding

body

对象

一个 floating IP port forwarding 对象。

id

body

字符串

浮动 IP 端口转发的 ID。

internal_port_id

body

字符串

与浮动 IP 端口转发关联的 Neutron 端口的 ID。

internal_ip_address

body

字符串

与浮动 IP 端口转发关联的 Neutron 端口的固定 IPv4 地址。

internal_port (可选)

body

整数

与浮动 IP 端口转发关联的 Neutron 端口固定 IP 地址的 TCP/UDP/其他协议端口号。

internal_port_range (可选)

body

字符串

与浮动 IP 端口转发关联的 Neutron 端口固定 IP 地址的 TCP/UDP/其他协议端口范围。

external_port (可选)

body

整数

端口转发的浮动 IP 地址的 TCP/UDP/其他协议端口号。

external_port_range (可选)

body

字符串

端口转发的浮动 IP 地址的 TCP/UDP/其他协议端口范围。

协议

body

字符串

浮动 IP 端口转发使用的 IP 协议。

description (可选)

body

字符串

描述规则的文本,这有助于用户轻松管理/查找他们的规则。

响应示例

{
  "port_forwarding": {
    "protocol": "tcp",
    "internal_ip_address": "10.0.0.11",
    "internal_port": 25,
    "internal_port_id": "1238be08-a2a8-4b8d-addf-fb5e2250e480",
    "external_port": 2230,
    "description": "Some description",
    "id": "725ade3c-9760-4880-8080-8fc2dbab9acc"
  }
}

路由器 (routers)

router 是一个逻辑实体,用于在内部子网之间转发数据包,并通过适当的外部网关将其 NAT 到外部网络。

如果启用了 router 扩展,则提供此资源。

分布式虚拟路由器扩展

dvr 扩展启用将路由器配置为分布式虚拟路由器的功能,并添加了 distributed 参数。

附加路由扩展

附加路由扩展(extraroute)通过添加包含路由对象数组的 routes 属性来扩展 router 资源。每个路由对象都有一个 destinationnexthop 属性来表示路由。当 extraroute-atomic 扩展也可用时,您可以在服务器端原子地添加或删除一组附加路由。有关详细信息,请参阅下文。

警告

默认情况下,路由器有每个连接子网的一个路由。如果您添加的附加路由与其中一个默认子网路由匹配,则现有子网路由将被覆盖。如果删除 Neutron 路由,则相应的路由也将被删除。受影响的子网将 subsequently 失去与此路由器的连接。

附加路由(原子)扩展

附加路由原子扩展(extraroute-atomic)通过添加两个成员操作(add_extraroutes / remove_extraroutes)来原子地编辑服务器端附加路由集,从而扩展 router 资源。

警告

默认情况下,路由器有每个连接子网的一个路由。如果您添加的附加路由与其中一个默认子网路由匹配,则现有子网路由将被覆盖。如果删除 Neutron 路由,则相应的路由也将被删除。受影响的子网将 subsequently 失去与此路由器的连接。

路由器扩展的高可用性功能(l3-ha

L3 HA 扩展 l3-ha 添加了 ha 属性,当设置为 true 时,为路由器启用 HA 功能。

L3 外部网关模式扩展(ext-gw-mode

路由器抽象的 ext-gw-mode 扩展用于指定是否在外部网关上执行 SNAT。ext-gw-mode 扩展允许启用可配置的外部网关模式,向 routers 添加 external_gateway_info 属性,并允许定义 network_idenable_snatexternal_fixed_ips

L3 外部网关多宿主扩展(external-gateway-multihoming

external-gateway-multihoming 扩展允许路由器拥有多个外部网关端口,并指定如何处理从网关端口关联的子网推断出的默认路由的 ECMP 和 BFD。

L3 风格扩展(l3-flavors

路由器风格扩展(l3-flavors)向路由器添加了 flavor_id 属性,允许根据给定路由器的风格将其请求分派给不同的驱动程序。

资源时间戳

The standard-attr-timestamp extension adds the created_at and updated_at attributes to all resources that have standard attributes.

路由器管理员状态在更新扩展前关闭

router-admin-state-down-before-update 扩展要求在修改路由器 distributed 参数之前,将分布式虚拟路由器 (DVR) 的管理员状态设置为 DOWN(admin_state_up=False)。如果路由器 distributed 属性在未先将路由器 admin_state_up=False 设置为 DOWN 的情况下被修改,API 将返回 400 错误响应代码。此扩展需要 dvr 扩展。

路由器可用区域扩展

router_availability_zone 扩展向 routers 添加了 availability_zonesavailability_zone_hints 属性,允许基于可用区域和提示进行调度。此扩展需要 routeravailability_zone 扩展。

路由器服务类型扩展(router-service-type

router-service-type 扩展通过引入 service_type_id 参数来启用将服务类型与路由器关联,该参数可用于将路由器与现有 service-provider 关联,请参阅 服务提供商

标签扩展

The standard-attr-tag adds Tag support for resources with standard attributes by adding the tags attribute allowing consumers to associate tags with resources.

L3 连接跟踪助手扩展(expose-l3-conntrack-helper

路由器连接跟踪助手扩展(expose-l3-conntrack-helper)向路由器添加了 conntrack_helpers 字段,允许为 routers 配置可变的 netfilter CT 目标规则。

路由器启用 NDP 代理扩展 (router-extend-ndp-proxy)

router-extend-ndp-proxy 扩展向路由器添加了 enable_ndp_proxy 参数。如果此参数设置为 false,则路由器不支持 ndp_proxy

路由器网关 IP QoS (qos-gateway-ip)

qos-gateway-ip 扩展向路由器的 external_gateway_info 字段添加了 qos_policy_id

路由器启用默认路由 ECMP 扩展(enable-default-route-ecmp

enable-default-route-ecmp 扩展向路由器资源添加了一个名为 enable_default_route_ecmp 的参数,该参数可用于启用或禁用基于路由器网关端口(请参阅 external-gateway-multihoming 扩展)可访问的子网的默认路由的自动配置 ECMP。

路由器启用默认路由 BFD 扩展(enable-default-route-bfd

enable-default-route-bfd 扩展向路由器资源添加了一个名为 enable_default_route_bfd 的参数,该参数可用于启用或禁用路由器基于路由器网关端口(请参阅 enable-default-route-ecmp 扩展)可访问的子网的默认网关的自动配置 BFD。

路由器公开“enable_snat”标志扩展(router-enable-snat

router-enable-snat 扩展通过 API 公开路由器属性标志“enable_snat”。此标志可以在路由器创建期间设置,但只能使用外部网关 API 命令进行修改。

GET
/v2.0/routers

列出路由器

列出提交请求的项目可以访问的逻辑路由器。

默认策略设置仅返回提交请求的项目拥有的路由器,除非提交请求的用户是管理员。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

Error response codes: 401

请求

名称

入参

类型

描述

id (可选)

查询

字符串

Filter the list result by the ID of the resource.

tenant_id (可选)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

project_id (可选)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

name (可选)

查询

字符串

Filter the list result by the human-readable name of the resource.

description (可选)

查询

字符串

Filter the list result by the human-readable description of the resource.

admin_state_up (Optional)

查询

布尔值

Filter the list result by the administrative state of the resource, which is up (true) or down (false).

revision_number (Optional)

查询

整数

Filter the list result by the revision number of the resource.

sort_dir (可选)

查询

字符串

Sort direction. A valid value is asc (ascending) or desc (descending). You can specify multiple pairs of sort key and sort direction query parameters.

sort_key (可选)

查询

字符串

按路由器属性排序。您可以指定多个排序键和排序方向查询参数对。排序键仅限于

  • admin_state_up

  • flavor_id

  • id

  • name

  • status

  • tenant_id

  • project_id

tags (可选)

查询

字符串

A list of tags to filter the list result by. Resources that match all tags in this list will be returned. Tags in query must be separated by comma.

tags-any (Optional)

查询

字符串

A list of tags to filter the list result by. Resources that match any tag in this list will be returned. Tags in query must be separated by comma.

not-tags (Optional)

查询

字符串

A list of tags to filter the list result by. Resources that match all tags in this list will be excluded. Tags in query must be separated by comma.

not-tags-any (Optional)

查询

字符串

A list of tags to filter the list result by. Resources that match any tag in this list will be excluded. Tags in query must be separated by comma.

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

routers

body

数组

一个 router 对象的列表。

id

body

字符串

路由器的ID。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

name

body

字符串

Human-readable name of the resource.

description

body

字符串

A human-readable description for the resource.

admin_state_up

body

布尔值

资源的管理状态,为开启(true)或关闭(false)。

status

body

字符串

路由器状态。

enable_snat

body

布尔值

启用源 NAT (SNAT) 属性。true 表示当流量从附加到路由器的子网发送到/从外部网络接收时,为该流量启用了网络地址转换 (NAT)。false 表示不对来自/到外部网络的流量应用 NAT。启用 ext-gw-mode 扩展时可用。请注意,根据后端及其配置,嵌套路由器的 SNAT 行为可能有所不同。

external_gateway_info

body

对象

路由器的外部网关信息。如果路由器有外部网关,这将是一个包含 network_idenable_snatexternal_fixed_ipsqos_policy_idenable_default_route_ecmpenable_default_route_bfd 的字典。否则,这将是 null

external_gateways

body

数组

路由器的外部网关列表。

revision_number

body

整数

The revision number of the resource.

routes

body

数组

L3 路由器的附加路由配置。包含 destinationnexthop 参数的字典列表。启用 extraroute 扩展时可用。

destination

body

字符串

目标 CIDR。

nexthop

body

字符串

相应目标的下一跳 IP 地址。下一跳 IP 地址必须是路由器接口连接到的某个子网的一部分。

distributed

body

布尔值

true 表示分布式路由器。启用 dvr 扩展时可用。

ha

body

布尔值

true 表示高可用路由器。启用 l3-ha 扩展时可用。

availability_zone_hints

body

数组

路由器的可用区域候选。启用 router_availability_zone 扩展时可用。

availability_zones

body

数组

路由器的可用区域。启用 router_availability_zone 扩展时可用。

service_type_id

body

字符串

与路由器关联的服务类型的 ID。

flavor_id

body

字符串

与路由器关联的风格的 ID。

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

tags

body

数组

The list of tags on the resource.

conntrack_helpers

body

数组

路由器关联的连接跟踪助手资源。如果路由器有多个连接跟踪助手资源,则此字段有多个条目。每个条目包含 netfilter 连接跟踪助手(helper)、网络协议(protocol)、网络端口(port)。

enable_ndp_proxy

body

布尔值

启用 NDP 代理属性。true 表示为路由器启用了 NDP 代理,通过创建 ndp_proxy 可以将附加到路由器的内部子网的 IPv6 地址发布到外部。false 表示禁用 NDP 代理,通过 ndp_proxy 无法将附加到路由器的内部子网的 IPv6 地址发布到外部。启用 router-extend-ndp-proxy 扩展时可用。

enable_default_route_bfd (可选)

body

布尔值

true 表示 Neutron 将为从路由器网关端口子网推断出的默认路由启用 BFD 会话。启用 external-gateway-multihoming 扩展时可用。

enable_default_route_ecmp (可选)

body

布尔值

true 表示如果通过不同的网关端口有多个可用的默认路由,Neutron 将添加 ECMP 默认路由。启用 external-gateway-multihoming 扩展时可用。

响应示例

{
    "routers": [
        {
            "admin_state_up": true,
            "availability_zone_hints": [],
            "availability_zones": [
                "nova"
            ],
            "created_at": "2018-03-19T19:17:04Z",
            "description": "",
            "distributed": false,
            "external_gateway_info": {
                "enable_snat": true,
                "external_fixed_ips": [
                    {
                        "ip_address": "172.24.4.3",
                        "subnet_id": "b930d7f6-ceb7-40a0-8b81-a425dd994ccf"
                    },
                    {
                        "ip_address": "2001:db8::c",
                        "subnet_id": "0c56df5d-ace5-46c8-8f4c-45fa4e334d18"
                    }
                ],
                "network_id": "ae34051f-aa6c-4c75-abf5-50dc9ac99ef3"
            },
            "flavor_id": "f7b14d9a-b0dc-4fbe-bb14-a0f4970a69e0",
            "ha": false,
            "id": "915a14a6-867b-4af7-83d1-70efceb146f9",
            "name": "router2",
            "revision_number": 1,
            "routes": [
                {
                    "destination": "179.24.1.0/24",
                    "nexthop": "172.24.3.99"
                }
            ],
            "status": "ACTIVE",
            "updated_at": "2018-03-19T19:17:22Z",
            "project_id": "0bd18306d801447bb457a46252d82d13",
            "tenant_id": "0bd18306d801447bb457a46252d82d13",
            "service_type_id": null,
            "tags": ["tag1,tag2"],
            "conntrack_helpers": [
                {
                    "protocol": "udp",
                    "helper": "tftp",
                    "port": 69
                },
                {
                    "protocol": "tcp",
                    "helper": "ftp",
                    "port": 21
                }
            ]
        },
        {
            "admin_state_up": true,
            "availability_zone_hints": [],
            "availability_zones": [
                "nova"
            ],
            "created_at": "2018-03-19T19:17:04Z",
            "description": "",
            "distributed": false,
            "external_gateway_info": {
                "enable_snat": true,
                "external_fixed_ips": [
                    {
                        "ip_address": "172.24.4.6",
                        "subnet_id": "b930d7f6-ceb7-40a0-8b81-a425dd994ccf"
                    },
                    {
                        "ip_address": "2001:db8::9",
                        "subnet_id": "0c56df5d-ace5-46c8-8f4c-45fa4e334d18"
                    }
                ],
                "network_id": "ae34051f-aa6c-4c75-abf5-50dc9ac99ef3"
            },
            "flavor_id": "f7b14d9a-b0dc-4fbe-bb14-a0f4970a69e0",
            "ha": false,
            "id": "f8a44de0-fc8e-45df-93c7-f79bf3b01c95",
            "name": "router1",
            "revision_number": 1,
            "routes": [],
            "status": "ACTIVE",
            "updated_at": "2018-03-19T19:17:22Z",
            "project_id": "0bd18306d801447bb457a46252d82d13",
            "tenant_id": "0bd18306d801447bb457a46252d82d13",
            "service_type_id": null,
            "tags": ["tag1,tag2"],
            "conntrack_helpers": [
                {
                    "protocol": "udp",
                    "helper": "tftp",
                    "port": 69
                },
                {
                    "protocol": "tcp",
                    "helper": "ftp",
                    "port": 21
                }
            ]
        }
    ]
}
POST
/v2.0/routers

创建路由器

创建逻辑路由器。

此操作创建一个逻辑路由器。该逻辑路由器没有任何内部接口,也没有与任何子网关联。您可以选择在创建时为路由器指定外部网关。路由器的外部网关必须连接到外部网络。外部网络的 router:external 扩展字段设置为 true。要指定外部网关,必须在请求正文的 external_gateway_info 属性的 network_id 参数中传递外部网络的 ID。

正常响应代码:201

错误响应代码:400, 401

请求

名称

入参

类型

描述

router

body

对象

一个 router 对象。

tenant_id (可选)

body

字符串

The ID of the project that owns the resource. Only administrative and users with advsvc role can specify a project ID other than their own. You cannot change this value through authorization policies.

project_id (可选)

body

字符串

The ID of the project that owns the resource. Only administrative and users with advsvc role can specify a project ID other than their own. You cannot change this value through authorization policies.

name (可选)

body

字符串

资源的易读名称。默认情况下为空字符串。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

admin_state_up (Optional)

body

布尔值

资源的管理状态,为开启(true)或关闭(false)。默认为true

external_gateway_info (可选)

body

对象

路由器的外部网关信息。如果路由器有外部网关,这将是一个包含 network_idenable_snatexternal_fixed_ipsqos_policy_id 的字典。否则,这将是 null

distributed (Optional)

body

布尔值

true 表示分布式路由器。启用 dvr 扩展时可用。

ha (可选)

body

布尔值

true 表示高可用路由器。启用 l3-ha 扩展时可用。

availability_zone_hints (Optional)

body

数组

路由器的可用区域候选。启用 router_availability_zone 扩展时可用。

service_type_id (可选)

body

字符串

与路由器关联的服务类型的 ID。

flavor_id (可选)

body

字符串

与路由器关联的风格的 ID。

enable_ndp_proxy (可选)

body

布尔值

启用 NDP 代理属性。默认值为 false。要持久化此属性值,请在 neutron.conf 文件中设置 enable_ndp_proxy_by_default 选项。启用 router-extend-ndp-proxy 扩展时可用。

enable_default_route_bfd (可选)

body

布尔值

true 表示 Neutron 将为从路由器网关端口子网推断出的默认路由启用 BFD 会话。启用 external-gateway-multihoming 扩展时可用。

enable_default_route_ecmp (可选)

body

布尔值

true 表示如果通过不同的网关端口有多个可用的默认路由,Neutron 将添加 ECMP 默认路由。启用 external-gateway-multihoming 扩展时可用。

请求示例

{
    "router": {
        "name": "router1",
        "external_gateway_info": {
            "network_id": "ae34051f-aa6c-4c75-abf5-50dc9ac99ef3",
            "enable_snat": true,
            "external_fixed_ips": [
                {
                    "ip_address": "172.24.4.6",
                    "subnet_id": "b930d7f6-ceb7-40a0-8b81-a425dd994ccf"
                }
            ]
        },
        "admin_state_up": true
    }
}

响应参数

名称

入参

类型

描述

router

body

对象

一个 router 对象。

id

body

字符串

路由器的ID。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

name

body

字符串

Human-readable name of the resource.

description

body

字符串

A human-readable description for the resource.

admin_state_up

body

布尔值

资源的管理状态,为开启(true)或关闭(false)。

status

body

字符串

路由器状态。

enable_snat

body

布尔值

启用源 NAT (SNAT) 属性。true 表示当流量从附加到路由器的子网发送到/从外部网络接收时,为该流量启用了网络地址转换 (NAT)。false 表示不对来自/到外部网络的流量应用 NAT。启用 ext-gw-mode 扩展时可用。请注意,根据后端及其配置,嵌套路由器的 SNAT 行为可能有所不同。

external_gateway_info

body

对象

路由器的外部网关信息。如果路由器有外部网关,这将是一个包含 network_idenable_snatexternal_fixed_ipsqos_policy_idenable_default_route_ecmpenable_default_route_bfd 的字典。否则,这将是 null

external_gateways

body

数组

路由器的外部网关列表。

revision_number

body

整数

The revision number of the resource.

routes

body

数组

L3 路由器的附加路由配置。包含 destinationnexthop 参数的字典列表。启用 extraroute 扩展时可用。

destination

body

字符串

目标 CIDR。

nexthop

body

字符串

相应目标的下一跳 IP 地址。下一跳 IP 地址必须是路由器接口连接到的某个子网的一部分。

distributed

body

布尔值

true 表示分布式路由器。启用 dvr 扩展时可用。

ha

body

布尔值

true 表示高可用路由器。启用 l3-ha 扩展时可用。

availability_zone_hints

body

数组

路由器的可用区域候选。启用 router_availability_zone 扩展时可用。

availability_zones

body

数组

路由器的可用区域。启用 router_availability_zone 扩展时可用。

service_type_id

body

字符串

与路由器关联的服务类型的 ID。

flavor_id

body

字符串

与路由器关联的风格的 ID。

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

tags

body

数组

The list of tags on the resource.

conntrack_helpers

body

数组

路由器关联的连接跟踪助手资源。如果路由器有多个连接跟踪助手资源,则此字段有多个条目。每个条目包含 netfilter 连接跟踪助手(helper)、网络协议(protocol)、网络端口(port)。

enable_ndp_proxy

body

布尔值

启用 NDP 代理属性。true 表示为路由器启用了 NDP 代理,通过创建 ndp_proxy 可以将附加到路由器的内部子网的 IPv6 地址发布到外部。false 表示禁用 NDP 代理,通过 ndp_proxy 无法将附加到路由器的内部子网的 IPv6 地址发布到外部。启用 router-extend-ndp-proxy 扩展时可用。

enable_default_route_bfd (可选)

body

布尔值

true 表示 Neutron 将为从路由器网关端口子网推断出的默认路由启用 BFD 会话。启用 external-gateway-multihoming 扩展时可用。

enable_default_route_ecmp (可选)

body

布尔值

true 表示如果通过不同的网关端口有多个可用的默认路由,Neutron 将添加 ECMP 默认路由。启用 external-gateway-multihoming 扩展时可用。

响应示例

{
    "router": {
        "admin_state_up": true,
        "availability_zone_hints": [],
        "availability_zones": [
            "nova"
        ],
        "created_at": "2018-03-19T19:17:04Z",
        "description": "",
        "distributed": false,
        "external_gateway_info": {
            "enable_snat": true,
            "external_fixed_ips": [
                {
                    "ip_address": "172.24.4.6",
                    "subnet_id": "b930d7f6-ceb7-40a0-8b81-a425dd994ccf"
                }
            ],
            "network_id": "ae34051f-aa6c-4c75-abf5-50dc9ac99ef3"
        },
        "flavor_id": "f7b14d9a-b0dc-4fbe-bb14-a0f4970a69e0",
        "ha": false,
        "id": "f8a44de0-fc8e-45df-93c7-f79bf3b01c95",
        "name": "router1",
        "routes": [],
        "revision_number": 1,
        "status": "ACTIVE",
        "updated_at": "2018-03-19T19:17:22Z",
        "project_id": "0bd18306d801447bb457a46252d82d13",
        "tenant_id": "0bd18306d801447bb457a46252d82d13",
        "service_type_id": null,
        "tags": ["tag1,tag2"],
        "conntrack_helpers": []
    }
}
GET
/v2.0/routers/{router_id}

显示路由器详细信息

显示路由器的详细信息。

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

错误响应代码:401、403、404

请求

名称

入参

类型

描述

router_id

路径

字符串

路由器的ID。

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

router

body

对象

一个 router 对象。

id

body

字符串

路由器的ID。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

name

body

字符串

Human-readable name of the resource.

description

body

字符串

A human-readable description for the resource.

admin_state_up

body

布尔值

资源的管理状态,为开启(true)或关闭(false)。

status

body

字符串

路由器状态。

enable_snat

body

布尔值

启用源 NAT (SNAT) 属性。true 表示当流量从附加到路由器的子网发送到/从外部网络接收时,为该流量启用了网络地址转换 (NAT)。false 表示不对来自/到外部网络的流量应用 NAT。启用 ext-gw-mode 扩展时可用。请注意,根据后端及其配置,嵌套路由器的 SNAT 行为可能有所不同。

external_gateway_info

body

对象

路由器的外部网关信息。如果路由器有外部网关,这将是一个包含 network_idenable_snatexternal_fixed_ipsqos_policy_idenable_default_route_ecmpenable_default_route_bfd 的字典。否则,这将是 null

external_gateways

body

数组

路由器的外部网关列表。

revision_number

body

整数

The revision number of the resource.

routes

body

数组

L3 路由器的附加路由配置。包含 destinationnexthop 参数的字典列表。启用 extraroute 扩展时可用。

destination

body

字符串

目标 CIDR。

nexthop

body

字符串

相应目标的下一跳 IP 地址。下一跳 IP 地址必须是路由器接口连接到的某个子网的一部分。

distributed

body

布尔值

true 表示分布式路由器。启用 dvr 扩展时可用。

ha

body

布尔值

true 表示高可用路由器。启用 l3-ha 扩展时可用。

availability_zone_hints

body

数组

路由器的可用区域候选。启用 router_availability_zone 扩展时可用。

availability_zones

body

数组

路由器的可用区域。启用 router_availability_zone 扩展时可用。

service_type_id

body

字符串

与路由器关联的服务类型的 ID。

flavor_id

body

字符串

与路由器关联的风格的 ID。

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

tags

body

数组

The list of tags on the resource.

conntrack_helpers

body

数组

路由器关联的连接跟踪助手资源。如果路由器有多个连接跟踪助手资源,则此字段有多个条目。每个条目包含 netfilter 连接跟踪助手(helper)、网络协议(protocol)、网络端口(port)。

enable_ndp_proxy

body

布尔值

启用 NDP 代理属性。true 表示为路由器启用了 NDP 代理,通过创建 ndp_proxy 可以将附加到路由器的内部子网的 IPv6 地址发布到外部。false 表示禁用 NDP 代理,通过 ndp_proxy 无法将附加到路由器的内部子网的 IPv6 地址发布到外部。启用 router-extend-ndp-proxy 扩展时可用。

enable_default_route_bfd (可选)

body

布尔值

true 表示 Neutron 将为从路由器网关端口子网推断出的默认路由启用 BFD 会话。启用 external-gateway-multihoming 扩展时可用。

enable_default_route_ecmp (可选)

body

布尔值

true 表示如果通过不同的网关端口有多个可用的默认路由,Neutron 将添加 ECMP 默认路由。启用 external-gateway-multihoming 扩展时可用。

响应示例

{
    "router": {
        "admin_state_up": true,
        "availability_zone_hints": [],
        "availability_zones": [
            "nova"
        ],
        "created_at": "2018-03-19T19:17:04Z",
        "description": "",
        "distributed": false,
        "external_gateway_info": {
            "enable_snat": true,
            "external_fixed_ips": [
                {
                    "ip_address": "172.24.4.6",
                    "subnet_id": "b930d7f6-ceb7-40a0-8b81-a425dd994ccf"
                },
                {
                    "ip_address": "2001:db8::9",
                    "subnet_id": "0c56df5d-ace5-46c8-8f4c-45fa4e334d18"
                }
            ],
            "network_id": "ae34051f-aa6c-4c75-abf5-50dc9ac99ef3"
        },
        "flavor_id": "f7b14d9a-b0dc-4fbe-bb14-a0f4970a69e0",
        "ha": false,
        "id": "f8a44de0-fc8e-45df-93c7-f79bf3b01c95",
        "name": "router1",
        "revision_number": 1,
        "routes": [
            {
                "destination": "179.24.1.0/24",
                "nexthop": "172.24.3.99"
            }
        ],
        "status": "ACTIVE",
        "updated_at": "2018-03-19T19:17:22Z",
        "project_id": "0bd18306d801447bb457a46252d82d13",
        "tenant_id": "0bd18306d801447bb457a46252d82d13",
        "service_type_id": null,
        "tags": ["tag1,tag2"],
        "conntrack_helpers": []
    }
}
PUT
/v2.0/routers/{router_id}

更新路由器

更新逻辑路由器。

此操作不允许更新路由器接口。要更新路由器接口,请使用添加路由器接口和删除路由器接口操作。

正常响应代码:200

错误响应代码:400、401、404、412

请求

名称

入参

类型

描述

router

body

对象

一个 router 对象。

external_gateway_info (可选)

body

对象

路由器的外部网关信息。如果路由器有外部网关,这将是一个包含 network_idenable_snatexternal_fixed_ipsqos_policy_id 的字典。否则,这将是 null

ha (可选)

body

布尔值

true 表示高可用路由器。启用 l3-ha 扩展时可用。

name

body

字符串

Human-readable name of the resource.

admin_state_up

body

布尔值

资源的管理状态,为开启(true)或关闭(false)。

router_id

路径

字符串

路由器的ID。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

routes (可选)

body

数组

L3 路由器的附加路由配置。包含 destinationnexthop 参数的字典列表。启用 extraroute 扩展时可用。默认值为空列表([])。

distributed (Optional)

body

布尔值

true 表示分布式路由器。启用 dvr 扩展时可用。

enable_ndp_proxy (可选)

body

布尔值

启用 NDP 代理属性。默认值为 false。要持久化此属性值,请在 neutron.conf 文件中设置 enable_ndp_proxy_by_default 选项。启用 router-extend-ndp-proxy 扩展时可用。

enable_default_route_bfd (可选)

body

布尔值

true 表示 Neutron 将为从路由器网关端口子网推断出的默认路由启用 BFD 会话。启用 external-gateway-multihoming 扩展时可用。

enable_default_route_ecmp (可选)

body

布尔值

true 表示如果通过不同的网关端口有多个可用的默认路由,Neutron 将添加 ECMP 默认路由。启用 external-gateway-multihoming 扩展时可用。

请求示例

{
    "router": {
        "distributed": false,
        "external_gateway_info": {
            "network_id": "ae34051f-aa6c-4c75-abf5-50dc9ac99ef3",
            "enable_snat": true,
            "external_fixed_ips": [
                {
                    "ip_address": "172.24.4.6",
                    "subnet_id": "b930d7f6-ceb7-40a0-8b81-a425dd994ccf"
                }
            ],
            "routes": [
                {
                    "destination": "179.24.1.0/24",
                    "nexthop": "172.24.3.99"
                }
            ]
        }
    }
}

响应参数

名称

入参

类型

描述

router

body

对象

一个 router 对象。

id

body

字符串

路由器的ID。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

name

body

字符串

Human-readable name of the resource.

description

body

字符串

A human-readable description for the resource.

admin_state_up

body

布尔值

资源的管理状态,为开启(true)或关闭(false)。

status

body

字符串

路由器状态。

enable_snat

body

布尔值

启用源 NAT (SNAT) 属性。true 表示当流量从附加到路由器的子网发送到/从外部网络接收时,为该流量启用了网络地址转换 (NAT)。false 表示不对来自/到外部网络的流量应用 NAT。启用 ext-gw-mode 扩展时可用。请注意,根据后端及其配置,嵌套路由器的 SNAT 行为可能有所不同。

external_gateway_info

body

对象

路由器的外部网关信息。如果路由器有外部网关,这将是一个包含 network_idenable_snatexternal_fixed_ipsqos_policy_idenable_default_route_ecmpenable_default_route_bfd 的字典。否则,这将是 null

external_gateways

body

数组

路由器的外部网关列表。

revision_number

body

整数

The revision number of the resource.

routes

body

数组

L3 路由器的附加路由配置。包含 destinationnexthop 参数的字典列表。启用 extraroute 扩展时可用。

destination

body

字符串

目标 CIDR。

nexthop

body

字符串

相应目标的下一跳 IP 地址。下一跳 IP 地址必须是路由器接口连接到的某个子网的一部分。

distributed

body

布尔值

true 表示分布式路由器。启用 dvr 扩展时可用。

ha

body

布尔值

true 表示高可用路由器。启用 l3-ha 扩展时可用。

availability_zone_hints

body

数组

路由器的可用区域候选。启用 router_availability_zone 扩展时可用。

availability_zones

body

数组

路由器的可用区域。启用 router_availability_zone 扩展时可用。

service_type_id

body

字符串

与路由器关联的服务类型的 ID。

flavor_id

body

字符串

与路由器关联的风格的 ID。

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

tags

body

数组

The list of tags on the resource.

conntrack_helpers

body

数组

路由器关联的连接跟踪助手资源。如果路由器有多个连接跟踪助手资源,则此字段有多个条目。每个条目包含 netfilter 连接跟踪助手(helper)、网络协议(protocol)、网络端口(port)。

enable_ndp_proxy

body

布尔值

启用 NDP 代理属性。true 表示为路由器启用了 NDP 代理,通过创建 ndp_proxy 可以将附加到路由器的内部子网的 IPv6 地址发布到外部。false 表示禁用 NDP 代理,通过 ndp_proxy 无法将附加到路由器的内部子网的 IPv6 地址发布到外部。启用 router-extend-ndp-proxy 扩展时可用。

enable_default_route_bfd (可选)

body

布尔值

true 表示 Neutron 将为从路由器网关端口子网推断出的默认路由启用 BFD 会话。启用 external-gateway-multihoming 扩展时可用。

enable_default_route_ecmp (可选)

body

布尔值

true 表示如果通过不同的网关端口有多个可用的默认路由,Neutron 将添加 ECMP 默认路由。启用 external-gateway-multihoming 扩展时可用。

响应示例

{
    "router": {
        "admin_state_up": true,
        "availability_zone_hints": [],
        "availability_zones": [
            "nova"
        ],
        "created_at": "2018-03-19T19:17:04Z",
        "description": "",
        "distributed": false,
        "external_gateway_info": {
            "enable_snat": true,
            "external_fixed_ips": [
                {
                    "ip_address": "172.24.4.6",
                    "subnet_id": "b930d7f6-ceb7-40a0-8b81-a425dd994ccf"
                }
            ],
            "network_id": "ae34051f-aa6c-4c75-abf5-50dc9ac99ef3"
        },
        "flavor_id": "f7b14d9a-b0dc-4fbe-bb14-a0f4970a69e0",
        "ha": false,
        "id": "f8a44de0-fc8e-45df-93c7-f79bf3b01c95",
        "name": "router1",
        "revision_number": 3,
        "routes": [
            {
                "destination": "179.24.1.0/24",
                "nexthop": "172.24.3.99"
            }
        ],
        "status": "ACTIVE",
        "updated_at": "2018-03-19T19:17:22Z",
        "project_id": "0bd18306d801447bb457a46252d82d13",
        "tenant_id": "0bd18306d801447bb457a46252d82d13",
        "service_type_id": null,
        "tags": ["tag1,tag2"],
        "conntrack_helpers": []
    }
}
DELETE
/v2.0/routers/{router_id}

删除路由器

删除逻辑路由器,如果存在,则删除其外部网关接口。

如果路由器具有已附加的接口,此操作将失败。请使用删除路由器接口操作在删除路由器之前删除所有路由器接口。

正常响应代码:204

Error response codes: 401, 404, 409, 412

请求

名称

入参

类型

描述

router_id

路径

字符串

路由器的ID。

响应

There is no body content for the response of a successful DELETE request.

PUT
/v2.0/routers/{router_id}/add_router_interface

向路由器添加接口

向逻辑路由器添加内部接口。这意味着指定的子网作为内部路由器接口附加到路由器。

在请求正文中指定子网或端口的 ID

  • 子网 ID。子网的网关 IP 地址将用作创建的路由器接口的 IP 地址。

  • 端口 ID。与端口关联的 IP 地址将用作创建的路由器接口的 IP 地址。

当您指定 IPv6 子网时,此操作会将子网添加到路由器上具有相同网络 ID 的现有内部端口。如果不存在具有相同网络 ID 的端口,此操作将为该子网在路由器上创建一个端口。

每个路由器端口一个 IPv4 子网的限制仍然存在,但一个端口可以包含属于同一网络 ID 的任意数量的 IPv6 子网。

当您使用 port-create 命令添加端口然后调用 router-interface-add 并提供此端口 ID 时,如果满足以下条件,此操作将将端口添加到路由器:

  • 端口的 IPv4 子网不超过一个。

  • 端口上的 IPv6 子网(如果有)的 network ID 与任何其他端口上的 IPv6 子网的 network ID 相同。

如果您同时指定了子网 ID 和端口 ID,此操作将返回 Bad Request (400) 响应代码。

如果端口已在使用中,此操作将返回 Conflict (409) 响应代码。

此操作返回一个端口 ID,该 ID 是:

  • 当在请求正文中指定端口时,与传递的 ID 相同。

  • 此操作创建用于将子网连接到路由器的端口的 ID。

运行此操作后,该操作将设置:

  • 此端口的 device_id 属性为路由器 ID

  • device_owner 属性为 network:router_interface

正常响应代码:200

错误响应代码:400、401、404、409

请求

名称

入参

类型

描述

router_id

路径

字符串

路由器的ID。

subnet_id (可选)

body

字符串

子网 ID。必须指定 subnet_idport_id 中的一个。

port_id (Optional)

body

字符串

端口 ID。必须指定 subnet_idport_id 中的一个。

请求示例

{
    "subnet_id": "a2f1f29d-571b-4533-907f-5803ab96ead1"
}

或者

{
    "port_id": "2dc46bcc-d1f2-4077-b99e-91ee28afaff0"
}

响应参数

名称

入参

类型

描述

id

body

字符串

路由器的ID。

subnet_id

body

字符串

路由器接口所属子网的 ID。

subnet_ids

body

数组

路由器接口所属子网 ID 的列表。列表只包含一个成员。

tenant_id

body

字符串

拥有路由器接口的项目 ID。

project_id

body

字符串

拥有路由器接口的项目 ID。

port_id

body

字符串

代表路由器接口的端口 ID。

network_id

body

字符串

路由器接口所连接的网络 ID。

tags

body

数组

The list of tags on the resource.

响应示例

{
    "id": "915a14a6-867b-4af7-83d1-70efceb146f9",
    "network_id": "91c013e2-d65a-474e-9177-c3e1799ca726",
    "port_id": "2dc46bcc-d1f2-4077-b99e-91ee28afaff0",
    "subnet_id": "a2f1f29d-571b-4533-907f-5803ab96ead1",
    "subnet_ids": [
        "a2f1f29d-571b-4533-907f-5803ab96ead1"
    ],
    "project_id": "0bd18306d801447bb457a46252d82d13",
    "tenant_id": "0bd18306d801447bb457a46252d82d13",
    "tags": ["tag1,tag2"]
}
PUT
/v2.0/routers/{router_id}/remove_router_interface

从路由器删除接口

删除逻辑路由器的内部接口。

此操作删除内部路由器接口,从而将子网与路由器分离。如果该子网 ID 是端口上的最后一个子网,则此操作将删除端口本身。您必须在请求正文中指定子网 ID 或端口 ID;操作将使用此值来识别要删除的路由器接口。

您也可以同时指定子网 ID 和端口 ID。如果您同时指定了两个 ID,则子网 ID 必须与端口上的第一个 IP 地址的子网 ID 匹配。否则,此操作将返回带有受影响的路由器和接口信息的 Conflict (409) 响应代码。

如果您尝试删除由一个或多个 routes 使用的子网的路由器接口,此操作将返回 Conflict (409) 响应。在这种情况下,您需要先从路由器中删除这些路由。

如果路由器或子网和端口不存在或对您不可见,此操作将返回 Not Found (404) 响应代码。作为此操作的结果,操作将删除连接路由器与子网的端口,从子网的网络中移除。

正常响应代码:200

错误响应代码:400、401、404、409

请求

名称

入参

类型

描述

router_id

路径

字符串

路由器的ID。

subnet_id (可选)

body

字符串

子网 ID。必须指定 subnet_idport_id 中的一个。

port_id (Optional)

body

字符串

端口 ID。必须指定 subnet_idport_id 中的一个。

请求示例

{
    "subnet_id": "a2f1f29d-571b-4533-907f-5803ab96ead1"
}

或者

{
    "port_id": "2dc46bcc-d1f2-4077-b99e-91ee28afaff0"
}

响应参数

名称

入参

类型

描述

id

body

字符串

路由器的ID。

subnet_id

body

字符串

路由器接口所属子网的 ID。

subnet_ids

body

数组

路由器接口所属子网 ID 的列表。列表只包含一个成员。

tenant_id

body

字符串

拥有路由器接口的项目 ID。

project_id

body

字符串

拥有路由器接口的项目 ID。

port_id

body

字符串

代表路由器接口的端口 ID。

network_id

body

字符串

路由器接口所连接的网络 ID。

tags

body

数组

The list of tags on the resource.

响应示例

{
    "id": "915a14a6-867b-4af7-83d1-70efceb146f9",
    "network_id": "91c013e2-d65a-474e-9177-c3e1799ca726",
    "port_id": "a5b7d209-dc02-4c46-a51f-805eadd3de64",
    "subnet_id": "4e5fe97c-82bc-432e-87d8-06d7e157dffa",
    "subnet_ids": [
        "4e5fe97c-82bc-432e-87d8-06d7e157dffa"
    ],
    "project_id": "0bd18306d801447bb457a46252d82d13",
    "tags": ["tag1,tag2"],
    "tenant_id": "0bd18306d801447bb457a46252d82d13"
}
PUT
/v2.0/routers/{router_id}/add_extraroutes

向路由器添加附加路由

原子地将一组附加路由添加到路由器已有的附加路由中。

此操作是更新路由器 routes 参数的一种变体。在所有方面,它的工作方式相同,只是请求正文中发送的附加路由不会替换现有的附加路由集。相反,发送的附加路由会被添加到现有的附加路由集中。

在可能对附加路由集进行并发更新的所有情况下,都推荐使用 add_extraroutes/remove_extraroutes 成员操作,而不是更新 routes 参数。

添加操作的边界情况如下

  • 当(destinationA, nexthopA)要被添加但已存在时,该请求被接受并成功。

  • 具有相同目标但具有不同下一跳的两个或多个路由都会被接受。

  • 可以添加目标与现有路由目标重叠的路由(例如 192.168.1.0/24192.168.1.0/22),现有路由保持不变。

请求正体的格式与向路由器发送 PUT 请求的格式相同,仅更改 routes 参数。

响应代码和响应正体与更新 routes 参数相同。也就是说,将返回整个路由器对象,包括代表添加结果的 routes 参数。

正常响应代码:200

错误响应代码:400、401、404、412

请求参数

名称

入参

类型

描述

router_id

路径

字符串

路由器的ID。

routes

body

数组

L3 路由器的附加路由配置。包含 destinationnexthop 参数的字典列表。启用 extraroute 扩展时可用。

请求示例

{
   "router" : {
      "routes" : [
         { "destination" : "10.0.3.0/24", "nexthop" : "10.0.0.13" },
         { "destination" : "10.0.4.0/24", "nexthop" : "10.0.0.14" }
      ]
   }
}

响应参数

名称

入参

类型

描述

id

body

字符串

路由器的ID。

name

路径

字符串

路由器的名称。

routes

body

数组

L3 路由器的附加路由配置。包含 destinationnexthop 参数的字典列表。启用 extraroute 扩展时可用。

响应示例

{
   "router" : {
      "id" : "64e339bb-1a6c-47bd-9ee7-a0cf81a35172",
      "name" : "router1",
      "routes" : [
         { "destination" : "10.0.1.0/24", "nexthop" : "10.0.0.11" },
         { "destination" : "10.0.2.0/24", "nexthop" : "10.0.0.12" },
         { "destination" : "10.0.3.0/24", "nexthop" : "10.0.0.13" },
         { "destination" : "10.0.4.0/24", "nexthop" : "10.0.0.14" }
      ]
   }
}
PUT
/v2.0/routers/{router_id}/remove_extraroutes

从路由器删除附加路由

原子地从路由器已有的附加路由中删除一组附加路由。

此操作是更新路由器 routes 参数的一种变体。在所有方面,它的工作方式相同,只是请求正文中发送的附加路由不会替换现有的附加路由集。相反,发送的附加路由将从现有的附加路由集中删除。

在可能对附加路由集进行并发更新的所有情况下,都推荐使用 add_extraroutes/remove_extraroutes 成员操作,而不是更新 routes 参数。

移除操作的边界情况如下

  • 只有当发送的路由与已存在的路由在 destinationnexthop 方面完全匹配时,才会删除附加路由。

  • 当(destinationA, nexthopA)要被删除但已丢失时,该请求被接受并成功。

请求正体的格式与向路由器发送 PUT 请求的格式相同,仅更改 routes 参数。但是,发送的路由并非用于覆盖整个 routes 参数,而是用于从现有集中删除。

响应代码和响应正体与更新 routes 参数相同。也就是说,将返回整个路由器对象,包括代表删除结果的 routes 参数。

正常响应代码:200

错误响应代码:400、401、404、412

请求

名称

入参

类型

描述

router_id

路径

字符串

路由器的ID。

routes

body

数组

L3 路由器的附加路由配置。包含 destinationnexthop 参数的字典列表。启用 extraroute 扩展时可用。

请求示例

{
   "router" : {
      "routes" : [
         { "destination" : "10.0.3.0/24", "nexthop" : "10.0.0.13" },
         { "destination" : "10.0.4.0/24", "nexthop" : "10.0.0.14" }
      ]
   }
}

响应参数

名称

入参

类型

描述

id

body

字符串

路由器的ID。

name

路径

字符串

路由器的名称。

routes

body

数组

L3 路由器的附加路由配置。包含 destinationnexthop 参数的字典列表。启用 extraroute 扩展时可用。

响应示例

{
   "router" : {
      "id" : "64e339bb-1a6c-47bd-9ee7-a0cf81a35172",
      "name" : "router1",
      "routes" : [
         { "destination" : "10.0.1.0/24", "nexthop" : "10.0.0.11" },
         { "destination" : "10.0.2.0/24", "nexthop" : "10.0.0.12" }
      ]
   }
}
PUT
/v2.0/routers/{router_id}/add_external_gateways

向路由器添加外部网关

将外部网关添加到路由器,以补充已有的网关。

可以向同一个路由器添加连接到同一网络的多个网关。

添加/更新/删除外部网关操作扩展了 router.external_gateway_info 的用法以管理多个外部网关。完整的外部网关集显示在只读的 router.external_gateways 参数中。router.external_gateways 包含一个 external_gateway_info 结构的列表,例如

[
  {"network_id": ...,
   "external_fixed_ips": [{"ip_address": ..., "subnet_id": ...}, ...],
   "enable_snat": ...},
  ...
]

external_gateways 列表的第一个项目(索引 0)是特殊的,如果路由器还没有任何网关端口

  • 它将为兼容的 router.external_gateway_info 字段提供数据;

  • 第一个项目设置路由器的默认路由。如果为从网关端口子网推断出的默认路由启用了 ECMP,则所有这些默认路由都用于负载共享;

  • 如果路由器已有一个或多个网关,并且执行了添加操作,则第一个项目只是另一个附加网关。

列表中其余项目(索引 1、2、…)的顺序无关紧要,将被忽略。

可以通过两种方式管理第一个外部网关:通过 router.external_gateway_info 或通过 add/update/remove_external_gateways。其他外部网关只能通过 add/update/remove_external_gateways 进行管理。

请求正体的格式与只读的 router.external_gateways 参数的格式相同,但包装如下:

{"router": {"external_gateways": EXTERNAL-GATEWAY-LIST}}

响应代码和响应正体与更新路由器相同。也就是说,将返回整个路由器对象,包括代表操作结果的 external_gateway_infoexternal_gateways 参数。

router.external_gateway_info 的更改将反映在 router.external_gateways 中,反之亦然。更新 external_gateway_info 也会更新 external_gateways 的第一个元素,并保持 external_gateways 的其余部分不变。将 external_gateway_info 设置为空值将删除单个网关,并由一个附加网关替换。

正常响应代码:200

错误响应代码:400、401、404、412

请求参数

名称

入参

类型

描述

router_id

路径

字符串

路由器的ID。

external_gateways

body

数组

路由器的外部网关列表。

请求示例

{
   "router" : {
      "external_gateways" : [
         {
            "enable_snat" : false,
            "external_fixed_ips" : [
               {
                  "ip_address" : "192.0.2.2",
                  "subnet_id" : "b189c314-ebb9-11eb-939c-9bde3f3867cb"
               }
            ],
            "network_id" : "8edec774-ebb9-11eb-9b09-371108ef5905"
         }
      ]
   }
}

响应参数

名称

入参

类型

描述

id

body

字符串

路由器的ID。

name

路径

字符串

路由器的名称。

external_gateways

body

数组

路由器的外部网关列表。

响应示例

{
   "router" : {
      "admin_state_up" : true,
      "availability_zone_hints" : [],
      "availability_zones" : [
         "nova"
      ],
      "created_at" : "2021-06-29T13:33:40Z",
      "description" : "",
      "distributed" : false,
      "enable_default_route_ecmp" : false,
      "enable_default_route_bfd" : false,
      "external_gateway_info" : {
         "enable_snat" : false,
         "external_fixed_ips" : [
            {
               "ip_address" : "172.24.4.144",
               "subnet_id" : "1ed1c499-a45d-48d0-a567-e83a2364a40e"
            }
         ],
         "network_id" : "52700ca1-1647-46ad-8f86-b9e64eaed820"
      },
      "external_gateways" : [
         {
            "enable_snat" : false,
            "external_fixed_ips" : [
               {
                  "ip_address" : "172.24.4.144",
                  "subnet_id" : "1ed1c499-a45d-48d0-a567-e83a2364a40e"
               }
            ],
            "network_id" : "52700ca1-1647-46ad-8f86-b9e64eaed820"
         },
         {
            "enable_snat" : false,
            "external_fixed_ips" : [
               {
                  "ip_address" : "192.0.2.2",
                  "subnet_id" : "b189c314-ebb9-11eb-939c-9bde3f3867cb"
               }
            ],
            "network_id" : "8edec774-ebb9-11eb-9b09-371108ef5905"
         }
      ],
      "flavor_id" : null,
      "ha" : false,
      "id" : "47c32c39-1c09-47de-8d50-ec57a96db5e7",
      "interfaces_info" : [
         {
            "ip_address" : "fd26:d08e:af31::1",
            "port_id" : "20683e3d-b041-4977-9686-b97db622c76a",
            "subnet_id" : "2921b809-b60a-4799-ac99-59dacbeb7c3a"
         },
         {
            "ip_address" : "10.0.0.1",
            "port_id" : "89ab7084-7883-48e6-8281-d498a0cf4c92",
            "subnet_id" : "3a5bec20-2df1-4d11-b0d5-5481969b91ac"
         },
         {
            "ip_address" : "10.0.5.1",
            "port_id" : "b04c6f4e-5bc7-43a2-85e9-c28452368532",
            "subnet_id" : "f96970c4-026a-46f3-9852-f512a56688fe"
         }
      ],
      "name" : "router1",
      "project_id" : "b66a1cea961f49738fff1210733ec440",
      "revision_number" : 7,
      "routes" : [],
      "status" : "ACTIVE",
      "tags" : [],
      "updated_at" : "2021-06-29T13:37:07Z"
   }
}
PUT
/v2.0/routers/{router_id}/update_external_gateways

更新路由器的外部网关

更新路由器的某些外部网关。

有关添加/更新/删除外部网关操作的通用信息,请参阅上面的 add_external_gateways

要更新的外部网关由 PUT 请求中找到的 network_ids 标识。可以更新 external_fixed_ipsenable_snat 字段。network_id 字段无法更新 - 任何更改都会导致网关端口被删除并重新创建。

请求正体的格式与只读的 router.external_gateways 参数的格式相同,但包装如下:

{"router": {"external_gateways": EXTERNAL-GATEWAY-LIST}}

enable_snat 字段对附加网关(除了列表中的第一个外部网关)没有影响。

network_id 字段用于通过 external_fixed_ips 字段来标识特定的网关端口。仅指定 network_id 字段是模糊的:Neutron 将尝试查找匹配的网关端口,但如果存在多个匹配项,它将返回错误响应代码。

enable_snat 字段可以从请求中省略。指定 external_fixed_ips 将导致根据这些固定 IP 匹配端口。如果网关端口具有指定固定 IP 的子集,则 IP 集将更新为与请求中的 IP 匹配。或者,如果网关端口具有请求固定 IP 的超集,则 IP 将从网关端口中删除。

响应代码和响应正体与更新路由器相同。也就是说,将返回整个路由器对象,包括代表操作结果的 external_gateway_infoexternal_gateways 参数。

请注意,更新 external_gateway_info 也会更新 external_gateways 的第一个元素,并保持 external_gateways 的其余部分不变。

正常响应代码:200

错误响应代码:400、401、404、412

请求参数

名称

入参

类型

描述

router_id

路径

字符串

路由器的ID。

external_gateways

body

数组

路由器的外部网关列表。

请求示例

{
   "router" : {
      "external_gateways" : [
         {
            "enable_snat" : true,
            "network_id" : "8edec774-ebb9-11eb-9b09-371108ef5905"
         }
      ]
   }
}

响应参数

名称

入参

类型

描述

id

body

字符串

路由器的ID。

name

路径

字符串

路由器的名称。

external_gateways

body

数组

路由器的外部网关列表。

响应示例

{
   "router" : {
      "admin_state_up" : true,
      "availability_zone_hints" : [],
      "availability_zones" : [
         "nova"
      ],
      "created_at" : "2021-06-29T13:33:40Z",
      "description" : "",
      "distributed" : false,
      "enable_default_route_ecmp" : false,
      "enable_default_route_bfd" : false,
      "external_gateway_info" : {
         "enable_snat" : false,
         "enable_default_route_ecmp": false,
         "enable_default_route_bfd": false,
         "external_fixed_ips" : [
            {
               "ip_address" : "172.24.4.144",
               "subnet_id" : "1ed1c499-a45d-48d0-a567-e83a2364a40e"
            }
         ],
         "network_id" : "52700ca1-1647-46ad-8f86-b9e64eaed820"
      },
      "external_gateways" : [
         {
            "enable_snat" : false,
            "external_fixed_ips" : [
               {
                  "ip_address" : "172.24.4.144",
                  "subnet_id" : "1ed1c499-a45d-48d0-a567-e83a2364a40e"
               }
            ],
            "network_id" : "52700ca1-1647-46ad-8f86-b9e64eaed820"
         },
         {
            "enable_snat" : true,
            "external_fixed_ips" : [
               {
                  "ip_address" : "192.0.2.2",
                  "subnet_id" : "b189c314-ebb9-11eb-939c-9bde3f3867cb"
               }
            ],
            "network_id" : "8edec774-ebb9-11eb-9b09-371108ef5905"
         }
      ],
      "flavor_id" : null,
      "ha" : false,
      "id" : "47c32c39-1c09-47de-8d50-ec57a96db5e7",
      "interfaces_info" : [
         {
            "ip_address" : "fd26:d08e:af31::1",
            "port_id" : "20683e3d-b041-4977-9686-b97db622c76a",
            "subnet_id" : "2921b809-b60a-4799-ac99-59dacbeb7c3a"
         },
         {
            "ip_address" : "10.0.0.1",
            "port_id" : "89ab7084-7883-48e6-8281-d498a0cf4c92",
            "subnet_id" : "3a5bec20-2df1-4d11-b0d5-5481969b91ac"
         },
         {
            "ip_address" : "10.0.5.1",
            "port_id" : "b04c6f4e-5bc7-43a2-85e9-c28452368532",
            "subnet_id" : "f96970c4-026a-46f3-9852-f512a56688fe"
         }
      ],
      "name" : "router1",
      "project_id" : "b66a1cea961f49738fff1210733ec440",
      "revision_number" : 7,
      "routes" : [],
      "status" : "ACTIVE",
      "tags" : [],
      "updated_at" : "2021-06-29T13:37:07Z"
   }
}
PUT
/v2.0/routers/{router_id}/remove_external_gateways

从路由器删除外部网关

从路由器删除某些外部网关。

有关添加/更新/删除外部网关操作的通用信息,请参阅上面的 add_external_gateways

请求正体的格式与只读的 router.external_gateways 参数的格式相同,但包装如下:

{"router": {"external_gateways": EXTERNAL-GATEWAY-LIST}}

然而,请求正体可以是部分的。只有 external_gateway_info 结构中的 network_idexternal_fixed_ips 字段用于匹配特定的网关端口。可以包含 enable_snat 键,但其值将被忽略。

请注意,将 external_gateway_info 设置为空值也会将 external_gateways 重置为空列表。

正常响应代码:200

错误响应代码:400、401、404、412

请求参数

名称

入参

类型

描述

router_id

路径

字符串

路由器的ID。

external_gateways

body

数组

路由器的外部网关列表。

请求示例

{
   "router" : {
      "external_gateways" : [
         {
            "network_id" : "8edec774-ebb9-11eb-9b09-371108ef5905"
         }
      ]
   }
}

响应参数

名称

入参

类型

描述

id

body

字符串

路由器的ID。

name

路径

字符串

路由器的名称。

external_gateways

body

数组

路由器的外部网关列表。

响应示例

{
   "router" : {
      "admin_state_up" : true,
      "availability_zone_hints" : [],
      "availability_zones" : [
         "nova"
      ],
      "created_at" : "2021-06-29T13:33:40Z",
      "description" : "",
      "distributed" : false,
      "enable_default_route_ecmp" : false,
      "enable_default_route_bfd" : false,
      "external_gateway_info" : {
         "enable_snat" : false,
         "external_fixed_ips" : [
            {
               "ip_address" : "172.24.4.144",
               "subnet_id" : "1ed1c499-a45d-48d0-a567-e83a2364a40e"
            }
         ],
         "network_id" : "52700ca1-1647-46ad-8f86-b9e64eaed820"
      },
      "external_gateways" : [
         {
            "enable_snat" : false,
            "external_fixed_ips" : [
               {
                  "ip_address" : "172.24.4.144",
                  "subnet_id" : "1ed1c499-a45d-48d0-a567-e83a2364a40e"
               }
            ],
            "network_id" : "52700ca1-1647-46ad-8f86-b9e64eaed820"
         }
      ],
      "flavor_id" : null,
      "ha" : false,
      "id" : "47c32c39-1c09-47de-8d50-ec57a96db5e7",
      "interfaces_info" : [
         {
            "ip_address" : "fd26:d08e:af31::1",
            "port_id" : "20683e3d-b041-4977-9686-b97db622c76a",
            "subnet_id" : "2921b809-b60a-4799-ac99-59dacbeb7c3a"
         },
         {
            "ip_address" : "10.0.0.1",
            "port_id" : "89ab7084-7883-48e6-8281-d498a0cf4c92",
            "subnet_id" : "3a5bec20-2df1-4d11-b0d5-5481969b91ac"
         },
         {
            "ip_address" : "10.0.5.1",
            "port_id" : "b04c6f4e-5bc7-43a2-85e9-c28452368532",
            "subnet_id" : "f96970c4-026a-46f3-9852-f512a56688fe"
         }
      ],
      "name" : "router1",
      "project_id" : "b66a1cea961f49738fff1210733ec440",
      "revision_number" : 7,
      "routes" : [],
      "status" : "ACTIVE",
      "tags" : [],
      "updated_at" : "2021-06-29T13:37:07Z"
   }
}

路由器 NDP 代理 (ndp_proxies)

ndp_proxy 是一个逻辑实体,用于向外部网络宣告唯一的 IPv6 地址。它依赖于启用了外部网关的 router 实体。

GET
/v2.0/ndp_proxies

列出 NDP 代理

列出提交请求的项目可以访问的逻辑 ndp_proxies。

默认策略设置仅返回提交请求的项目拥有的 ndp_proxies,除非提交请求的用户是管理员。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

Error response codes: 401

请求

名称

入参

类型

描述

id (可选)

查询

字符串

Filter the list result by the ID of the resource.

tenant_id (可选)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

project_id (可选)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

name (可选)

查询

字符串

Filter the list result by the human-readable name of the resource.

description (可选)

查询

字符串

Filter the list result by the human-readable description of the resource.

router_id (Optional)

查询

字符串

NDP 代理的路由器 ID。

port_id (Optional)

查询

字符串

NDP 代理的端口 ID。

ip_address (可选)

查询

字符串

ndp proxy 宣告到外部网络的 IPv6 地址。

revision_number (Optional)

查询

整数

Filter the list result by the revision number of the resource.

sort_dir (可选)

查询

字符串

Sort direction. A valid value is asc (ascending) or desc (descending). You can specify multiple pairs of sort key and sort direction query parameters.

sort_key (可选)

查询

字符串

按 ndp 代理属性排序。您可以指定多个排序键和排序方向查询参数对。排序键仅限于

  • id

  • name

  • tenant_id

  • project_id

  • router_id

  • port_id

  • ip_address

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

ndp_proxies

body

数组

一个 ndp proxy 对象的列表。

name

body

字符串

Human-readable name of the resource.

id

body

字符串

NDP 代理的 ID

description

body

字符串

A human-readable description for the resource.

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

revision_number

body

整数

The revision number of the resource.

router_id

body

字符串

NDP 代理的路由器 ID。

port_id

body

字符串

NDP 代理的端口 ID。

ip_address

body

字符串

ndp proxy 宣告到外部网络的 IPv6 地址。

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

响应示例

{
  "ndp_proxies": [
    {
      "name": "proxy1",
      "id": "b930d7f6-ceb7-40a0-8b81-a425dd994ccf",
      "router_id": "915a14a6-867b-4af7-83d1-70efceb146f9",
      "port_id": "f7b14d9a-b0dc-4fbe-bb14-a0f4970a69e0",
      "ip_address": "2001::1:56",
      "revision_number": 1,
      "project_id": "0bd18306d801447bb457a46252d82d13",
      "tenant_id": "0bd18306d801447bb457a46252d82d13",
      "created_at": "2021-07-16T19:17:04Z",
      "updated_at": "2021-07-16T20:36:22Z",
      "description": ""
    },
    {
      "name": "proxy2",
      "id": "f8a44de0-fc8e-45df-93c7-f79bf3b01c95",
      "router_id": "915a14a6-867b-4af7-83d1-70efceb146f9",
      "port_id": "fc36c5b0-497b-42a3-8ef3-545f90756a41",
      "ip_address": "2001::1:67",
      "revision_number": 1,
      "project_id": "0bd18306d801447bb457a46252d82d13",
      "tenant_id": "0bd18306d801447bb457a46252d82d13",
      "created_at": "2021-07-16T19:27:04Z",
      "updated_at": "2021-07-16T20:38:22Z",
      "description": ""
    }
  ]
}
GET
/v2.0/ndp_proxies/{ndp_proxy_id}

显示 NDP 代理详细信息

显示 NDP 代理的信息

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

Error response codes: 401, 404

请求

名称

入参

类型

描述

ndp_proxy_id

路径

字符串

NDP 代理的 ID。

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

ndp_proxy

body

对象

一个 ndp proxy 对象。

name

body

字符串

Human-readable name of the resource.

id

body

字符串

NDP 代理的 ID

description

body

字符串

A human-readable description for the resource.

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

revision_number

body

整数

The revision number of the resource.

router_id

body

字符串

NDP 代理的路由器 ID。

port_id

body

字符串

NDP 代理的端口 ID。

ip_address

body

字符串

ndp proxy 宣告到外部网络的 IPv6 地址。

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

响应示例

{
  "ndp_proxy": {
    "name": "proxy1",
    "id": "b930d7f6-ceb7-40a0-8b81-a425dd994ccf",
    "router_id": "915a14a6-867b-4af7-83d1-70efceb146f9",
    "port_id": "f7b14d9a-b0dc-4fbe-bb14-a0f4970a69e0",
    "ip_address": "2001::1:56",
    "revision_number": 1,
    "project_id": "0bd18306d801447bb457a46252d82d13",
    "tenant_id": "0bd18306d801447bb457a46252d82d13",
    "created_at": "2021-07-16T19:17:04Z",
    "updated_at": "2021-07-16T20:36:22Z",
    "description": ""
  }
}
PUT
/v2.0/ndp_proxies/{ndp_proxy_id}

更新ndp代理

更新 NDP 代理

正常响应代码:200

错误响应代码:400、401、404

请求

名称

入参

类型

描述

ndp_proxy_id

路径

字符串

NDP 代理的 ID。

ndp_proxy

body

对象

一个 ndp proxy 对象。

name

body

字符串

Human-readable name of the resource.

description (可选)

body

字符串

A human-readable description for the resource.

请求示例

{
  "ndp_proxy": {
    "name": "new-name",
    "description": "balabalabala"
  }
}

响应参数

名称

入参

类型

描述

ndp_proxy

body

对象

一个 ndp proxy 对象。

name

body

字符串

Human-readable name of the resource.

id

body

字符串

NDP 代理的 ID

description

body

字符串

A human-readable description for the resource.

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

revision_number

body

整数

The revision number of the resource.

router_id

body

字符串

NDP 代理的路由器 ID。

port_id

body

字符串

NDP 代理的端口 ID。

ip_address

body

字符串

ndp proxy 宣告到外部网络的 IPv6 地址。

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

响应示例

{
  "ndp_proxy": {
    "name": "new-name",
    "id": "b930d7f6-ceb7-40a0-8b81-a425dd994ccf",
    "router_id": "915a14a6-867b-4af7-83d1-70efceb146f9",
    "port_id": "f7b14d9a-b0dc-4fbe-bb14-a0f4970a69e0",
    "ip_address": "2001::1:56",
    "revision_number": 3,
    "project_id": "0bd18306d801447bb457a46252d82d13",
    "tenant_id": "0bd18306d801447bb457a46252d82d13",
    "created_at": "2021-07-16T19:17:04Z",
    "updated_at": "2021-07-16T20:36:22Z",
    "description": "balabalabala"
  }
}
POST
/v2.0/ndp_proxies

创建 NDP 代理

创建 NDP 代理

正常响应代码:201

错误响应代码:400, 401

请求

名称

入参

类型

描述

ndp_proxy

body

对象

一个 ndp proxy 对象。

name (可选)

body

字符串

资源的易读名称。默认情况下为空字符串。

router_id

body

字符串

NDP 代理的路由器 ID。

port_id

body

字符串

NDP 代理的端口 ID。

ip_address (可选)

body

字符串

ndp proxy 宣告到外部网络的 IPv6 地址。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

请求示例

{
  "ndp_proxy": {
    "name": "ndp_proxy1",
    "router_id": "1238be08-a2a8-4b8d-addf-fb5e2250e480",
    "port_id": "6738be23-a398-445d-aaaf-785e4550e4cb",
    "ip_address": "2001::1:6",
    "description": "Some description"
  }
}

响应参数

名称

入参

类型

描述

ndp_proxy

body

对象

一个 ndp proxy 对象。

name

body

字符串

Human-readable name of the resource.

id

body

字符串

NDP 代理的 ID

description

body

字符串

A human-readable description for the resource.

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

revision_number

body

整数

The revision number of the resource.

router_id

body

字符串

NDP 代理的路由器 ID。

port_id

body

字符串

NDP 代理的端口 ID。

ip_address

body

字符串

ndp proxy 宣告到外部网络的 IPv6 地址。

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

响应示例

{
  "ndp_proxy": {
    "name": "ndp_proxy1",
    "id": "b930d7f6-ceb7-40a0-8b81-a425dd994ccf",
    "router_id": "1238be08-a2a8-4b8d-addf-fb5e2250e480",
    "port_id": "6738be23-a398-445d-aaaf-785e4550e4cb",
    "ip_address": "2001::1:6",
    "revision_number": 0,
    "project_id": "0bd18306d801447bb457a46252d82d13",
    "tenant_id": "0bd18306d801447bb457a46252d82d13",
    "created_at": "2021-07-16T19:17:04Z",
    "updated_at": "2021-07-16T20:36:22Z",
    "description": "Some description"
  }
}
DELETE
/v2.0/ndp_proxies/{ndp_proxy_id}

删除ndp代理

删除 NDP 代理。

正常响应代码:204

错误响应代码:404

请求

名称

入参

类型

描述

ndp_proxy_id

路径

字符串

NDP 代理的 ID。

响应

There is no body content for the response of a successful DELETE request.

子网池扩展 (subnetpools)

列出、创建、显示子网池的详细信息、更新和删除。

地址范围扩展

address-scope 扩展向子网池添加了 address_scope_id 属性。address_scope_id 是子网池所属的地址范围的 ID。

资源时间戳

The standard-attr-timestamp extension adds the created_at and updated_at attributes to all resources that have standard attributes.

标签扩展

The standard-attr-tag adds Tag support for resources with standard attributes by adding the tags attribute allowing consumers to associate tags with resources.

GET
/v2.0/subnetpools/{subnetpool_id}

显示子网池

显示子网池的信息。

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

Error response codes: 401, 404

请求

名称

入参

类型

描述

subnetpool_id

路径

字符串

子网池的 UUID。

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

subnetpool

body

对象

一个 subnetpool 对象。

id

body

字符串

子网池的 ID。

name

body

字符串

Human-readable name of the resource.

default_quota (可选)

body

整数

对项目子网可以从子网池分配的前缀空间设置每个项目的配额。默认情况下,对子网池的分配不强制执行配额。对于 IPv4 子网池,default_quota 以 /32 为单位度量。对于 IPv6 子网池,default_quota 以 /64 为单位度量。使用子网池的所有项目都应用相同的网络前缀配额。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

prefixes

body

数组

要分配给子网池的子网前缀列表。API 会合并相邻的前缀并将它们视为单个前缀。每个子网前缀在与地址范围关联的所有子网池的所有子网前缀中必须是唯一的。

min_prefixlen (可选)

body

整数

可以从子网池分配的最小前缀。对于 IPv4 子网池,默认为 8。对于 IPv6 子网池,默认为 64

address_scope_id (可选)

body

对象

要分配给子网池的地址范围。

ip_version (Optional)

body

整数

IP协议版本。有效值为46。默认为4

shared (Optional)

body

布尔值

Indicates whether this resource is shared across all projects. By default, only administrative users can change this value.

default_prefixlen (可选)

body

整数

在创建子网时省略 cidrprefixlen 属性时要分配的前缀大小。默认为 min_prefixlen

max_prefixlen (可选)

body

整数

可以从子网池分配的最大前缀大小。对于 IPv4 子网池,默认为 32。对于 IPv6 子网池,默认为 128

description

body

字符串

A human-readable description for the resource.

is_default

body

布尔值

该子网池是默认池还是非默认池。

revision_number

body

整数

The revision number of the resource.

tags

body

数组

The list of tags on the resource.

响应示例

{
    "subnetpool": {
        "min_prefixlen": "64",
        "address_scope_id": null,
        "default_prefixlen": "64",
        "id": "03f761e6-eee0-43fc-a921-8acf64c14988",
        "max_prefixlen": "64",
        "name": "my-subnet-pool",
        "default_quota": null,
        "is_default": false,
        "project_id": "9fadcee8aa7c40cdb2114fff7d569c08",
        "tenant_id": "9fadcee8aa7c40cdb2114fff7d569c08",
        "created_at": "2016-03-08T20:19:41",
        "prefixes": [
            "2001:db8:0:2::/64",
            "2001:db8::/63"
        ],
        "updated_at": "2016-03-08T20:19:41",
        "ip_version": 6,
        "shared": false,
        "description": "",
        "revision_number": 2,
        "tags": ["tag1,tag2"]
    }
}
PUT
/v2.0/subnetpools/{subnetpool_id}

更新子网池

更新子网池。

正常响应代码:200

Error response codes: 400, 401, 403, 404, 412

请求

名称

入参

类型

描述

subnetpool_id

路径

字符串

子网池的 UUID。

subnetpool

body

对象

一个 subnetpool 对象。

name

body

字符串

Human-readable name of the resource.

default_quota (可选)

body

整数

对项目子网可以从子网池分配的前缀空间设置每个项目的配额。默认情况下,对子网池的分配不强制执行配额。对于 IPv4 子网池,default_quota 以 /32 为单位度量。对于 IPv6 子网池,default_quota 以 /64 为单位度量。使用子网池的所有项目都应用相同的网络前缀配额。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

prefixes

body

数组

要分配给子网池的子网前缀列表。API 会合并相邻的前缀并将它们视为单个前缀。每个子网前缀在与地址范围关联的所有子网池的所有子网前缀中必须是唯一的。

min_prefixlen (可选)

body

整数

可以从子网池分配的最小前缀。对于 IPv4 子网池,默认为 8。对于 IPv6 子网池,默认为 64

address_scope_id (可选)

body

对象

要分配给子网池的地址范围。

default_prefixlen (可选)

body

整数

在创建子网时省略 cidrprefixlen 属性时要分配的前缀大小。默认为 min_prefixlen

max_prefixlen (可选)

body

整数

可以从子网池分配的最大前缀大小。对于 IPv4 子网池,默认为 32。对于 IPv6 子网池,默认为 128

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

is_default (Optional)

body

布尔值

该子网池是默认池还是非默认池。

请求示例

{
    "subnetpool": {
        "name": "my-new-subnetpool-name",
        "prefixes": [
            "2001:db8::/64",
            "2001:db8:0:1::/64",
            "2001:db8:0:2::/64"
        ],
        "min_prefixlen": 64,
        "default_prefixlen": 64,
        "max_prefixlen": 64
    }
}

响应参数

名称

入参

类型

描述

subnetpool

body

对象

一个 subnetpool 对象。

id

body

字符串

子网池的 ID。

name

body

字符串

Human-readable name of the resource.

default_quota (可选)

body

整数

对项目子网可以从子网池分配的前缀空间设置每个项目的配额。默认情况下,对子网池的分配不强制执行配额。对于 IPv4 子网池,default_quota 以 /32 为单位度量。对于 IPv6 子网池,default_quota 以 /64 为单位度量。使用子网池的所有项目都应用相同的网络前缀配额。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

prefixes

body

数组

要分配给子网池的子网前缀列表。API 会合并相邻的前缀并将它们视为单个前缀。每个子网前缀在与地址范围关联的所有子网池的所有子网前缀中必须是唯一的。

min_prefixlen (可选)

body

整数

可以从子网池分配的最小前缀。对于 IPv4 子网池,默认为 8。对于 IPv6 子网池,默认为 64

address_scope_id (可选)

body

对象

要分配给子网池的地址范围。

ip_version (Optional)

body

整数

IP协议版本。有效值为46。默认为4

shared (Optional)

body

布尔值

Indicates whether this resource is shared across all projects. By default, only administrative users can change this value.

default_prefixlen (可选)

body

整数

在创建子网时省略 cidrprefixlen 属性时要分配的前缀大小。默认为 min_prefixlen

max_prefixlen (可选)

body

整数

可以从子网池分配的最大前缀大小。对于 IPv4 子网池,默认为 32。对于 IPv6 子网池,默认为 128

description

body

字符串

A human-readable description for the resource.

is_default

body

布尔值

该子网池是默认池还是非默认池。

revision_number

body

整数

The revision number of the resource.

tags

body

数组

The list of tags on the resource.

响应示例

{
    "subnetpool": {
        "name": "my-new-subnetpool-name",
        "default_quota": null,
        "is_default": false,
        "project_id": "9fadcee8aa7c40cdb2114fff7d569c08",
        "tenant_id": "9fadcee8aa7c40cdb2114fff7d569c08",
        "prefixes": [
            "2001:db8::/63",
            "2001:db8:0:2::/64"
        ],
        "min_prefixlen": 64,
        "address_scope_id": null,
        "ip_version": 6,
        "shared": false,
        "default_prefixlen": 64,
        "id": "03f761e6-eee0-43fc-a921-8acf64c14988",
        "max_prefixlen": 64,
        "description": "",
        "created_at": "2016-03-08T20:19:41",
        "updated_at": "2016-03-08T20:19:41",
        "revision_number": 2,
        "tags": ["tag1,tag2"]
    }
}
DELETE
/v2.0/subnetpools/{subnetpool_id}

删除子网池

删除子网池。

如果子网池中仍有已分配的子网在使用,则操作失败。

正常响应代码:204

错误响应代码:401、404、412

请求

名称

入参

类型

描述

subnetpool_id

路径

字符串

子网池的 UUID。

响应

There is no body content for the response of a successful DELETE request.

GET
/v2.0/subnetpools

列出子网池

列出项目有权访问的子网池。

默认策略设置仅返回用户请求的项目拥有的子网池,除非用户具有管理员角色。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

Error response codes: 401

请求

名称

入参

类型

描述

id (可选)

查询

字符串

Filter the list result by the ID of the resource.

name (可选)

查询

字符串

Filter the list result by the human-readable name of the resource.

default_quota (可选)

查询

整数

按项目子网可从子网池分配的前缀空间配额过滤子网池列表结果。

tenant_id (可选)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

project_id (可选)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

min_prefixlen (可选)

查询

整数

按可从子网池分配的最小前缀过滤子网池列表结果。

address_scope_id (可选)

查询

字符串

按分配给子网池的地址范围过滤子网池列表结果。

ip_version (Optional)

查询

整数

按IP协议版本过滤列表结果。有效值为46

shared (Optional)

查询

布尔值

仅限管理员。根据资源是否在所有项目之间共享来过滤列表结果。

default_prefixlen (可选)

查询

整数

在创建子网时,如果省略 cidrprefixlen 属性,则按要分配的前缀大小过滤子网池列表结果。默认为 min_prefixlen

max_prefixlen (可选)

查询

整数

按可从子网池分配的最大前缀大小过滤子网池列表结果。

description (可选)

查询

字符串

Filter the list result by the human-readable description of the resource.

is_default (Optional)

查询

布尔值

按是否为默认池过滤子网池列表结果。

revision_number (Optional)

查询

整数

Filter the list result by the revision number of the resource.

sort_dir (可选)

查询

字符串

Sort direction. A valid value is asc (ascending) or desc (descending). You can specify multiple pairs of sort key and sort direction query parameters.

sort_key (可选)

查询

字符串

按子网池属性排序。您可以指定多个排序键和排序方向查询参数对。排序键限于

  • address_scope_id

  • default_prefixlen

  • default_quota

  • id

  • ip_version

  • is_default

  • max_prefixlen

  • min_prefixlen

  • name

  • shared

  • tenant_id

  • project_id

tags (可选)

查询

字符串

A list of tags to filter the list result by. Resources that match all tags in this list will be returned. Tags in query must be separated by comma.

tags-any (Optional)

查询

字符串

A list of tags to filter the list result by. Resources that match any tag in this list will be returned. Tags in query must be separated by comma.

not-tags (Optional)

查询

字符串

A list of tags to filter the list result by. Resources that match all tags in this list will be excluded. Tags in query must be separated by comma.

not-tags-any (Optional)

查询

字符串

A list of tags to filter the list result by. Resources that match any tag in this list will be excluded. Tags in query must be separated by comma.

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

subnetpools

body

数组

一个 subnetpool 对象列表。

id

body

字符串

子网池的 ID。

name

body

字符串

Human-readable name of the resource.

default_quota (可选)

body

整数

对项目子网可以从子网池分配的前缀空间设置每个项目的配额。默认情况下,对子网池的分配不强制执行配额。对于 IPv4 子网池,default_quota 以 /32 为单位度量。对于 IPv6 子网池,default_quota 以 /64 为单位度量。使用子网池的所有项目都应用相同的网络前缀配额。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

prefixes

body

数组

要分配给子网池的子网前缀列表。API 会合并相邻的前缀并将它们视为单个前缀。每个子网前缀在与地址范围关联的所有子网池的所有子网前缀中必须是唯一的。

min_prefixlen (可选)

body

整数

可以从子网池分配的最小前缀。对于 IPv4 子网池,默认为 8。对于 IPv6 子网池,默认为 64

address_scope_id (可选)

body

对象

要分配给子网池的地址范围。

ip_version (Optional)

body

整数

IP协议版本。有效值为46。默认为4

shared (Optional)

body

布尔值

Indicates whether this resource is shared across all projects. By default, only administrative users can change this value.

default_prefixlen (可选)

body

整数

在创建子网时省略 cidrprefixlen 属性时要分配的前缀大小。默认为 min_prefixlen

max_prefixlen (可选)

body

整数

可以从子网池分配的最大前缀大小。对于 IPv4 子网池,默认为 32。对于 IPv6 子网池,默认为 128

description

body

字符串

A human-readable description for the resource.

is_default

body

布尔值

该子网池是默认池还是非默认池。

revision_number

body

整数

The revision number of the resource.

tags

body

数组

The list of tags on the resource.

响应示例

{
    "subnetpools": [
        {
            "min_prefixlen": "64",
            "address_scope_id": null,
            "default_prefixlen": "64",
            "id": "03f761e6-eee0-43fc-a921-8acf64c14988",
            "max_prefixlen": "64",
            "name": "my-subnet-pool-ipv6",
            "default_quota": null,
            "is_default": false,
            "project_id": "9fadcee8aa7c40cdb2114fff7d569c08",
            "tenant_id": "9fadcee8aa7c40cdb2114fff7d569c08",
            "prefixes": [
                "2001:db8:0:2::/64",
                "2001:db8::/63"
            ],
            "ip_version": 6,
            "shared": false,
            "description": "",
            "created_at": "2016-03-08T20:19:41",
            "updated_at": "2016-03-08T20:19:41",
            "revision_number": 2,
            "tags": ["tag1,tag2"]
        },
        {
            "min_prefixlen": "24",
            "address_scope_id": null,
            "default_prefixlen": "25",
            "id": "f49a1319-423a-4ee6-ba54-1d95a4f6cc68",
            "max_prefixlen": "30",
            "name": "my-subnet-pool-ipv4",
            "default_quota": null,
            "is_default": false,
            "project_id": "9fadcee8aa7c40cdb2114fff7d569c08",
            "tenant_id": "9fadcee8aa7c40cdb2114fff7d569c08",
            "prefixes": [
                "10.10.0.0/21",
                "192.168.0.0/16"
            ],
            "ip_version": 4,
            "shared": false,
            "description": "",
            "created_at": "2016-03-08T20:19:41",
            "updated_at": "2016-03-08T20:19:41",
            "revision_number": 2,
            "tags": ["tag1,tag2"]
        }
    ]
}
POST
/v2.0/subnetpools

创建子网池

创建子网池。

正常响应代码:201

错误响应代码:400、401、403、404

请求

名称

入参

类型

描述

subnetpool

body

对象

一个 subnetpool 对象。

name

body

字符串

Human-readable name of the resource.

default_quota (可选)

body

整数

对项目子网可以从子网池分配的前缀空间设置每个项目的配额。默认情况下,对子网池的分配不强制执行配额。对于 IPv4 子网池,default_quota 以 /32 为单位度量。对于 IPv6 子网池,default_quota 以 /64 为单位度量。使用子网池的所有项目都应用相同的网络前缀配额。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

prefixes

body

数组

要分配给子网池的子网前缀列表。API 会合并相邻的前缀并将它们视为单个前缀。每个子网前缀在与地址范围关联的所有子网池的所有子网前缀中必须是唯一的。

min_prefixlen (可选)

body

整数

可以从子网池分配的最小前缀。对于 IPv4 子网池,默认为 8。对于 IPv6 子网池,默认为 64

address_scope_id (可选)

body

对象

要分配给子网池的地址范围。

shared (Optional)

body

布尔值

Indicates whether this resource is shared across all projects. By default, only administrative users can change this value.

default_prefixlen (可选)

body

整数

在创建子网时省略 cidrprefixlen 属性时要分配的前缀大小。默认为 min_prefixlen

max_prefixlen (可选)

body

整数

可以从子网池分配的最大前缀大小。对于 IPv4 子网池,默认为 32。对于 IPv6 子网池,默认为 128

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

is_default

body

布尔值

该子网池是默认池还是非默认池。

请求示例

{
    "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"
    }
}

响应参数

名称

入参

类型

描述

subnetpool

body

对象

一个 subnetpool 对象。

id

body

字符串

子网池的 ID。

name

body

字符串

Human-readable name of the resource.

default_quota (可选)

body

整数

对项目子网可以从子网池分配的前缀空间设置每个项目的配额。默认情况下,对子网池的分配不强制执行配额。对于 IPv4 子网池,default_quota 以 /32 为单位度量。对于 IPv6 子网池,default_quota 以 /64 为单位度量。使用子网池的所有项目都应用相同的网络前缀配额。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

prefixes

body

数组

要分配给子网池的子网前缀列表。API 会合并相邻的前缀并将它们视为单个前缀。每个子网前缀在与地址范围关联的所有子网池的所有子网前缀中必须是唯一的。

min_prefixlen (可选)

body

整数

可以从子网池分配的最小前缀。对于 IPv4 子网池,默认为 8。对于 IPv6 子网池,默认为 64

address_scope_id (可选)

body

对象

要分配给子网池的地址范围。

ip_version (Optional)

body

整数

IP协议版本。有效值为46。默认为4

shared (Optional)

body

布尔值

Indicates whether this resource is shared across all projects. By default, only administrative users can change this value.

default_prefixlen (可选)

body

整数

在创建子网时省略 cidrprefixlen 属性时要分配的前缀大小。默认为 min_prefixlen

max_prefixlen (可选)

body

整数

可以从子网池分配的最大前缀大小。对于 IPv4 子网池,默认为 32。对于 IPv6 子网池,默认为 128

description

body

字符串

A human-readable description for the resource.

is_default

body

布尔值

该子网池是默认池还是非默认池。

revision_number

body

整数

The revision number of the resource.

tags

body

数组

The list of tags on the resource.

响应示例

{
    "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",
        "revision_number": 1,
        "shared": false,
        "created_at": "2016-03-08T20:19:41",
        "updated_at": "2016-03-08T20:19:41",
        "tags": ["tag1,tag2"],
        "tenant_id": "9fadcee8aa7c40cdb2114fff7d569c08"
    }
}

子网池前缀操作 (subnetpool-prefix-ops)

将前缀添加到子网池前缀列表或从中删除。

PUT
/v2.0/subnetpools/{subnetpool_id}/add_prefixes

添加前缀

将前缀添加到子网池。

正常响应代码:200

错误响应代码:400、401、403、404、409、412

请求

名称

入参

类型

描述

subnetpool_id

路径

字符串

子网池的 UUID。

prefixes

body

数组

要分配给子网池的子网前缀列表。API 会合并相邻的前缀并将它们视为单个前缀。每个子网前缀在与地址范围关联的所有子网池的所有子网前缀中必须是唯一的。

请求示例

{
  "prefixes": ["192.168.0.0/24", "192.168.1.0/24", "172.16.0.0/21"]
}

响应参数

名称

入参

类型

描述

prefixes

body

数组

当前分配给子网池的子网前缀列表。相邻前缀将被合并并视为单个前缀。

响应示例

{
  "prefixes": ["192.168.0.0/23", "172.16.0.0/21"]
}
PUT
/v2.0/subnetpools/{subnetpool_id}/remove_prefixes

删除前缀

从子网池中删除前缀。

正常响应代码:200

错误响应代码:400、401、403、404、409、412

请求

名称

入参

类型

描述

subnetpool_id

路径

字符串

子网池的 UUID。

prefixes

body

数组

要从子网池中删除的子网前缀列表。当删除子集前缀时,API 会分割较大的前缀,并合并任何由此产生的相邻前缀,将它们视为单个前缀。

请求示例

{
  "prefixes": ["192.168.0.0/24"]
}

响应参数

名称

入参

类型

描述

prefixes

body

数组

当前分配给子网池的子网前缀列表。相邻前缀将被合并并视为单个前缀。

响应示例

{
  "prefixes": ["192.168.1.0/24", "172.16.0.0/21"]
}

子网

列出、显示详细信息、创建、更新和删除子网资源。

默认子网池扩展

默认子网池扩展 (default-subnetpools) 允许管理员用户指定默认子网池(每个 IP 版本一个)。然后,用户可以在创建子网时指定 use_default_subnetpool 属性,而无需指定引用默认子网池的 subnetpool_id 属性。

资源时间戳

The standard-attr-timestamp extension adds the created_at and updated_at attributes to all resources that have standard attributes.

子网分配扩展

子网分配扩展 (subnet_allocation) 支持从子网池分配子网。

子网 DNS 发布固定 IP 扩展

subnet-dns-publish-fixed-ip 扩展向子网添加了 dns_publish_fixed_ip 属性。它允许为每个子网选择是否在外部 DNS 服务中发布固定 IP 的 DNS 记录。

网段扩展

网段 (segment) 扩展使得可能将子网与网络上的特定 L2 网段关联,而不是跨越网络中的所有网段。网络和子网之间的关联仍然存在,但子网中会添加一个可选的 segment_id 字段,以便它可以与网络上的特定网段关联。当网络中有多个子网时,segment_id 用于确定子网是否为 L2 隣接。网络中的子网要么全部与网段关联,要么一个也不关联。

子网网段 ID 可写扩展

子网网段 ID 可写 (subnet-segmentid-writable) 扩展增强了 网段 (segment) 扩展,使得 segment_id 属性在更新子网时也可以写入。

网段对等子网主机路由扩展

网段对等子网主机路由扩展 (segments-peer-subnet-host-routes) 扩展增强了 网段 (segment) 扩展,使得不同网段上对等子网的路由会自动添加到不同 子网 (subnets) 的 host_routes 属性中。这确保了 L3 路由网络内的流量即使在默认路由位于不同主机接口时也能保持在网络内。

子网服务类型扩展

子网服务类型扩展 (subnet-service-types) 允许管理员用户通过向 subnets 添加 service_types 属性来设置子网所需的端口类型。(例如,network:floatingip_agent_gateway 服务类型允许 DVR 浮动 IP 代理网关端口使用子网以最大限度地减少公共 IP 地址消耗)。

标签扩展

The standard-attr-tag adds Tag support for resources with standard attributes by adding the tags attribute allowing consumers to associate tags with resources.

GET
/v2.0/subnets

列出子网

列出项目有权访问的子网。

默认策略设置仅返回用户请求的项目拥有的子网,除非用户具有管理员角色。您可以使用 fields 查询参数控制返回哪些属性。您可以使用查询字符串参数过滤结果。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

Error response codes: 401

请求

名称

入参

类型

描述

id (可选)

查询

字符串

Filter the list result by the ID of the resource.

tenant_id (可选)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

project_id (可选)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

name (可选)

查询

字符串

Filter the list result by the human-readable name of the resource.

enable_dhcp (可选)

查询

布尔值

根据子网是否启用或禁用 DHCP 来过滤子网列表结果。

network_id (Optional)

查询

字符串

按子网所属的网络 ID 过滤子网列表结果。

ip_version (Optional)

查询

整数

按 IP 协议版本过滤子网列表结果。值为 46

gateway_ip (可选)

查询

字符串

按此子网的网关 IP 过滤子网列表结果。

cidr (可选)

查询

字符串

按子网的 CIDR 过滤子网列表结果。

description (可选)

查询

字符串

Filter the list result by the human-readable description of the resource.

ipv6_address_mode (可选)

查询

字符串

按 IPv6 地址模式过滤子网列表结果,该模式指定分配 IP 地址的机制。值为 slaacdhcpv6-statefuldhcpv6-statelessnull

ipv6_ra_mode (可选)

查询

字符串

按 IPv6 路由器通告过滤子网列表结果,该通告指定网络服务是否应为子网传输 ICMPv6 数据包。值为 slaacdhcpv6-statefuldhcpv6-statelessnull

revision_number (Optional)

查询

整数

Filter the list result by the revision number of the resource.

segment_id (可选)

查询

字符串

按子网关联的网络网段 ID 过滤子网列表结果。当 segment 扩展启用时可用。

shared (Optional)

查询

布尔值

仅限管理员。根据资源是否在所有项目之间共享来过滤列表结果。

sort_dir (可选)

查询

字符串

Sort direction. A valid value is asc (ascending) or desc (descending). You can specify multiple pairs of sort key and sort direction query parameters.

sort_key (可选)

查询

字符串

按子网属性排序。您可以指定多个排序键和排序方向查询参数对。排序键限于

  • cidr

  • enable_dhcp

  • gateway_ip

  • id

  • ip_version

  • ipv6_address_mode

  • ipv6_ra_mode

  • name

  • network_id

  • segment_id

  • subnetpool_id

  • tenant_id

  • project_id

subnetpool_id (可选)

查询

字符串

按与子网关联的子网池 ID 过滤子网列表结果。

tags (可选)

查询

字符串

A list of tags to filter the list result by. Resources that match all tags in this list will be returned. Tags in query must be separated by comma.

tags-any (Optional)

查询

字符串

A list of tags to filter the list result by. Resources that match any tag in this list will be returned. Tags in query must be separated by comma.

not-tags (Optional)

查询

字符串

A list of tags to filter the list result by. Resources that match all tags in this list will be excluded. Tags in query must be separated by comma.

not-tags-any (Optional)

查询

字符串

A list of tags to filter the list result by. Resources that match any tag in this list will be excluded. Tags in query must be separated by comma.

dns_publish_fixed_ip (可选)

查询

布尔值

根据子网是否启用或禁用 dns_publish_fixed_ip 来过滤子网列表结果。

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

子网

body

数组

一个 subnet 对象列表。

id

body

字符串

子网的 ID。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

name

body

字符串

Human-readable name of the resource.

enable_dhcp

body

布尔值

指示子网是否启用了 DHCP。

network_id

body

字符串

子网所属网络的 ID。

dns_nameservers

body

数组

与子网关联的 DNS 名称服务器列表。

allocation_pools

body

数组

此子网的 startend IP 地址的分配池。

host_routes

body

数组

子网的附加路由。包含 destinationnexthop 参数的字典列表。

ip_version

body

整数

IP 协议版本。值为 46

gateway_ip

body

字符串

此子网的网关 IP。如果值为 null,则表示没有与该子网关联的网关。

cidr

body

字符串

子网的 CIDR。

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

description

body

字符串

A human-readable description for the resource.

ipv6_address_mode

body

字符串

IPv6 地址模式指定了分配 IP 地址的机制。值为 slaacdhcpv6-statefuldhcpv6-statelessnull

ipv6_ra_mode

body

字符串

IPv6 路由器通告指定了网络服务是否应为子网传输 ICMPv6 数据包。值为 slaacdhcpv6-statefuldhcpv6-statelessnull

revision_number

body

整数

The revision number of the resource.

segment_id

body

字符串

子网关联的网络网段的 ID。当 segment 扩展启用时可用。

service_types

body

数组

与子网关联的服务类型。

subnetpool_id

body

字符串

与子网关联的子网池的 ID。

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

tags

body

数组

The list of tags on the resource.

dns_publish_fixed_ip

body

布尔值

是否为该子网的 IP 发布 DNS 记录。

router:external (Optional)

查询

布尔值

子网与外部网络的成员关系。

响应示例

{
    "subnets": [
        {
            "name": "private-subnet",
            "enable_dhcp": true,
            "network_id": "db193ab3-96e3-4cb3-8fc5-05f4296d0324",
            "segment_id": null,
            "project_id": "26a7980765d0414dbc1fc1f88cdb7e6e",
            "tenant_id": "26a7980765d0414dbc1fc1f88cdb7e6e",
            "dns_nameservers": [],
            "dns_publish_fixed_ip": false,
            "allocation_pools": [
                {
                    "start": "10.0.0.2",
                    "end": "10.0.0.254"
                }
            ],
            "host_routes": [],
            "ip_version": 4,
            "gateway_ip": "10.0.0.1",
            "cidr": "10.0.0.0/24",
            "id": "08eae331-0402-425a-923c-34f7cfe39c1b",
            "created_at": "2016-10-10T14:35:34Z",
            "description": "",
            "ipv6_address_mode": null,
            "ipv6_ra_mode": null,
            "revision_number": 2,
            "service_types": [],
            "subnetpool_id": null,
            "tags": ["tag1,tag2"],
            "updated_at": "2016-10-10T14:35:34Z",
            "router:external": false
        },
        {
            "name": "my_subnet",
            "enable_dhcp": true,
            "network_id": "d32019d3-bc6e-4319-9c1d-6722fc136a22",
            "segment_id": null,
            "project_id": "4fd44f30292945e481c7b8a0c8908869",
            "tenant_id": "4fd44f30292945e481c7b8a0c8908869",
            "dns_nameservers": [],
            "dns_publish_fixed_ip": false,
            "allocation_pools": [
                {
                    "start": "192.0.0.2",
                    "end": "192.255.255.254"
                }
            ],
            "host_routes": [],
            "ip_version": 4,
            "gateway_ip": "192.0.0.1",
            "cidr": "192.0.0.0/8",
            "id": "54d6f61d-db07-451c-9ab3-b9609b6b6f0b",
            "created_at": "2016-10-10T14:35:47Z",
            "description": "",
            "ipv6_address_mode": null,
            "ipv6_ra_mode": null,
            "revision_number": 2,
            "service_types": [],
            "subnetpool_id": null,
            "tags": ["tag1,tag2"],
            "updated_at": "2016-10-10T14:35:47Z",
            "router:external": true
        }
    ]
}
POST
/v2.0/subnets

创建子网

在网络上创建子网。

OpenStack Networking 不会尝试从 CIDR 推导出正确的 IP 版本。如果您未指定 gateway_ip 属性,OpenStack Networking 将从子网的网关 CIDR 中分配一个地址。

要指定一个没有网关的子网,请在请求正文中将 gateway_ip 属性设置为 null。如果您未指定 allocation_pools 属性,OpenStack Networking 将自动分配池以覆盖 CIDR 中的所有 IP 地址,排除为子网网关保留的地址。否则,您可以显式指定分配池,如下例所示。

当您同时指定 allocation_poolsgateway_ip 属性时,您必须确保网关 IP 不与分配池重叠;否则,调用将返回 Conflict (409) 响应代码。

一个子网可以有一个或多个名称服务器和主机路由。此子网中的主机使用名称服务器。来自此子网的 IP 地址(不包括本地子网路由)使用主机路由。

指定 ipv6_ra_modeipv6_address_mode 属性以创建支持 IPv6 配置的子网,例如无状态地址自动配置 (SLAAC)、DHCPv6 有状态和 DHCPv6 无状态配置。

创建子网时,可以通过指定指定网络上有效网段的 segment_id 来选择性地将其与网络网段关联。具有以这种方式关联的子网的网络称为路由网络。在任何给定网络上,所有子网必须与网段关联,或者没有子网与网段关联。Neutron 会强制执行此不变性。目前,路由网络仅支持提供者网络。

注意

创建子网并不总是会导致对网络上已绑定端口的端口进行自动更新。

有关详细信息,请参阅:https://docs.openstack.org/neutron/2025.2/admin/config-ipv6.html#address-modes-for-ports

正常响应代码:201

错误响应代码:400、401、403、404、409

请求

名称

入参

类型

描述

subnet

body

对象

一个 subnet 对象。

tenant_id (可选)

body

字符串

The ID of the project that owns the resource. Only administrative and users with advsvc role can specify a project ID other than their own. You cannot change this value through authorization policies.

project_id (可选)

body

字符串

The ID of the project that owns the resource. Only administrative and users with advsvc role can specify a project ID other than their own. You cannot change this value through authorization policies.

name (可选)

body

字符串

资源的易读名称。默认情况下为空字符串。

enable_dhcp (可选)

body

布尔值

指示子网是否启用了 DHCP。默认为 true

network_id

body

字符串

子网所属网络的 ID。

dns_nameservers (可选)

body

数组

与子网关联的 DNS 名称服务器列表。默认为空列表。

allocation_pools (可选)

body

数组

此子网的 startend IP 地址的分配池。如果未指定 allocation_pools,OpenStack Networking 将默认自动分配池以覆盖 CIDR 中的所有 IP 地址,排除为子网网关保留的地址。

host_routes (可选)

body

数组

子网的附加路由。包含 destinationnexthop 参数的字典列表。默认值为空列表。

ip_version

body

整数

IP 协议版本。值为 46

gateway_ip (可选)

body

字符串

此子网的网关 IP。如果值为 null,则表示没有与该子网关联的网关。如果未指定 gateway_ip,OpenStack Networking 将默认从子网的 CIDR 中分配一个地址作为网关。

cidr

body

字符串

子网的 CIDR。

prefixlen (可选)

body

整数

用于从子网池分配子网的前缀长度。如果未指定,将使用子网池的 default_prefixlen 值。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

ipv6_address_mode (可选)

body

字符串

IPv6 地址模式指定了分配 IP 地址的机制。值为 slaacdhcpv6-statefuldhcpv6-stateless

ipv6_ra_mode (可选)

body

字符串

IPv6 路由器通告指定了网络服务是否应为子网传输 ICMPv6 数据包。值为 slaacdhcpv6-statefuldhcpv6-stateless

segment_id (可选)

body

字符串

子网关联的网络网段的 ID。当 segment 扩展启用时可用。

subnetpool_id (可选)

body

字符串

与子网关联的子网池的 ID。

use_default_subnetpool (可选)

body

布尔值

是否从默认子网池分配此子网。

service_types (可选)

body

数组

与子网关联的服务类型。

dns_publish_fixed_ip (可选)

body

布尔值

是否为该子网的 IP 发布 DNS 记录。默认为 false

请求示例

{
    "subnet": {
        "network_id": "d32019d3-bc6e-4319-9c1d-6722fc136a22",
        "ip_version": 4,
        "cidr": "192.168.199.0/24"
    }
}

响应参数

名称

入参

类型

描述

subnet

body

对象

一个 subnet 对象。

id

body

字符串

子网的 ID。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

name

body

字符串

Human-readable name of the resource.

enable_dhcp

body

布尔值

指示子网是否启用了 DHCP。

network_id

body

字符串

子网所属网络的 ID。

dns_nameservers

body

数组

与子网关联的 DNS 名称服务器列表。

allocation_pools

body

数组

此子网的 startend IP 地址的分配池。

host_routes

body

数组

子网的附加路由。包含 destinationnexthop 参数的字典列表。

ip_version

body

整数

IP 协议版本。值为 46

gateway_ip

body

字符串

此子网的网关 IP。如果值为 null,则表示没有与该子网关联的网关。

cidr

body

字符串

子网的 CIDR。

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

description

body

字符串

A human-readable description for the resource.

ipv6_address_mode

body

字符串

IPv6 地址模式指定了分配 IP 地址的机制。值为 slaacdhcpv6-statefuldhcpv6-statelessnull

ipv6_ra_mode

body

字符串

IPv6 路由器通告指定了网络服务是否应为子网传输 ICMPv6 数据包。值为 slaacdhcpv6-statefuldhcpv6-statelessnull

revision_number

body

整数

The revision number of the resource.

service_types

body

数组

与子网关联的服务类型。

subnetpool_id

body

字符串

与子网关联的子网池的 ID。

segment_id

body

字符串

子网关联的网络网段的 ID。当 segment 扩展启用时可用。

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

tags

body

数组

The list of tags on the resource.

dns_publish_fixed_ip

body

布尔值

是否为该子网的 IP 发布 DNS 记录。

router:external (Optional)

查询

布尔值

子网与外部网络的成员关系。

响应示例

{
    "subnet": {
        "name": "",
        "enable_dhcp": true,
        "network_id": "d32019d3-bc6e-4319-9c1d-6722fc136a22",
        "segment_id": null,
        "project_id": "4fd44f30292945e481c7b8a0c8908869",
        "tenant_id": "4fd44f30292945e481c7b8a0c8908869",
        "dns_nameservers": [],
        "dns_publish_fixed_ip": false,
        "allocation_pools": [
            {
                "start": "192.168.199.2",
                "end": "192.168.199.254"
            }
        ],
        "host_routes": [],
        "ip_version": 4,
        "gateway_ip": "192.168.199.1",
        "cidr": "192.168.199.0/24",
        "id": "3b80198d-4f7b-4f77-9ef5-774d54e17126",
        "created_at": "2016-10-10T14:35:47Z",
        "description": "",
        "ipv6_address_mode": null,
        "ipv6_ra_mode": null,
        "revision_number": 1,
        "service_types": [],
        "subnetpool_id": null,
        "tags": ["tag1,tag2"],
        "updated_at": "2016-10-10T14:35:47Z",
        "router:external": false
    }
}
POST
/v2.0/subnets

批量创建子网

在单个请求中创建多个子网。在请求正文中指定子网列表。

批量创建操作始终是原子的。请求正文中的所有子网都会被创建,或者一个子网都不会被创建。

正常响应代码:201

错误响应代码:400、401、403、404、409

请求

名称

入参

类型

描述

子网

body

数组

一个 subnet 对象列表。

tenant_id (可选)

body

字符串

The ID of the project that owns the resource. Only administrative and users with advsvc role can specify a project ID other than their own. You cannot change this value through authorization policies.

project_id (可选)

body

字符串

The ID of the project that owns the resource. Only administrative and users with advsvc role can specify a project ID other than their own. You cannot change this value through authorization policies.

name (可选)

body

字符串

资源的易读名称。默认情况下为空字符串。

enable_dhcp (可选)

body

布尔值

指示子网是否启用了 DHCP。默认为 true

network_id

body

字符串

子网所属网络的 ID。

dns_nameservers (可选)

body

数组

与子网关联的 DNS 名称服务器列表。默认为空列表。

allocation_pools (可选)

body

数组

此子网的 startend IP 地址的分配池。如果未指定 allocation_pools,OpenStack Networking 将默认自动分配池以覆盖 CIDR 中的所有 IP 地址,排除为子网网关保留的地址。

host_routes (可选)

body

数组

子网的附加路由。包含 destinationnexthop 参数的字典列表。默认值为空列表。

ip_version

body

整数

IP 协议版本。值为 46

gateway_ip (可选)

body

字符串

此子网的网关 IP。如果值为 null,则表示没有与该子网关联的网关。如果未指定 gateway_ip,OpenStack Networking 将默认从子网的 CIDR 中分配一个地址作为网关。

cidr

body

字符串

子网的 CIDR。

prefixlen (可选)

body

整数

用于从子网池分配子网的前缀长度。如果未指定,将使用子网池的 default_prefixlen 值。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

ipv6_address_mode (可选)

body

字符串

IPv6 地址模式指定了分配 IP 地址的机制。值为 slaacdhcpv6-statefuldhcpv6-stateless

ipv6_ra_mode (可选)

body

字符串

IPv6 路由器通告指定了网络服务是否应为子网传输 ICMPv6 数据包。值为 slaacdhcpv6-statefuldhcpv6-stateless

segment_id (可选)

body

字符串

子网关联的网络网段的 ID。当 segment 扩展启用时可用。

subnetpool_id (可选)

body

字符串

与子网关联的子网池的 ID。

use_default_subnetpool (可选)

body

布尔值

是否从默认子网池分配此子网。

service_types (可选)

body

数组

与子网关联的服务类型。

dns_publish_fixed_ip (可选)

body

布尔值

是否为该子网的 IP 发布 DNS 记录。默认为 false

请求示例

{
    "subnets": [
        {
            "cidr": "192.168.199.0/24",
            "ip_version": 4,
            "network_id": "e6031bc2-901a-4c66-82da-f4c32ed89406"
        },
        {
            "cidr": "10.56.4.0/22",
            "ip_version": 4,
            "network_id": "64239a54-dcc4-4b39-920b-b37c2144effa"
        }
    ]
}

响应参数

名称

入参

类型

描述

子网

body

数组

一个 subnet 对象列表。

id

body

字符串

子网的 ID。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

name

body

字符串

Human-readable name of the resource.

enable_dhcp

body

布尔值

指示子网是否启用了 DHCP。

network_id

body

字符串

子网所属网络的 ID。

dns_nameservers

body

数组

与子网关联的 DNS 名称服务器列表。

allocation_pools

body

数组

此子网的 startend IP 地址的分配池。

host_routes

body

数组

子网的附加路由。包含 destinationnexthop 参数的字典列表。

ip_version

body

整数

IP 协议版本。值为 46

gateway_ip

body

字符串

此子网的网关 IP。如果值为 null,则表示没有与该子网关联的网关。

cidr

body

字符串

子网的 CIDR。

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

description

body

字符串

A human-readable description for the resource.

ipv6_address_mode

body

字符串

IPv6 地址模式指定了分配 IP 地址的机制。值为 slaacdhcpv6-statefuldhcpv6-statelessnull

ipv6_ra_mode

body

字符串

IPv6 路由器通告指定了网络服务是否应为子网传输 ICMPv6 数据包。值为 slaacdhcpv6-statefuldhcpv6-statelessnull

revision_number

body

整数

The revision number of the resource.

segment_id

body

字符串

子网关联的网络网段的 ID。当 segment 扩展启用时可用。

service_types

body

数组

与子网关联的服务类型。

subnetpool_id

body

字符串

与子网关联的子网池的 ID。

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

tags

body

数组

The list of tags on the resource.

dns_publish_fixed_ip

body

布尔值

是否为该子网的 IP 发布 DNS 记录。

router:external (Optional)

查询

布尔值

子网与外部网络的成员关系。

响应示例

{
    "subnets": [
        {
            "allocation_pools": [
                {
                    "end": "192.168.199.254",
                    "start": "192.168.199.2"
                }
            ],
            "cidr": "192.168.199.0/24",
            "dns_nameservers": [],
            "dns_publish_fixed_ip": false,
            "enable_dhcp": true,
            "gateway_ip": "192.168.199.1",
            "host_routes": [],
            "id": "0468a7a7-290d-4127-aedd-6c9449775a24",
            "ip_version": 4,
            "name": "",
            "network_id": "e6031bc2-901a-4c66-82da-f4c32ed89406",
            "segment_id": null,
            "project_id": "d19231fc08ec4bc4829b668040d34512",
            "tenant_id": "d19231fc08ec4bc4829b668040d34512",
            "created_at": "2016-10-10T14:35:47Z",
            "description": "",
            "ipv6_address_mode": null,
            "ipv6_ra_mode": null,
            "revision_number": 1,
            "service_types": [],
            "subnetpool_id": null,
            "tags": ["tag1,tag2"],
            "updated_at": "2016-10-10T14:35:47Z"
        },
        {
            "allocation_pools": [
                {
                    "end": "10.56.7.254",
                    "start": "10.56.4.2"
                }
            ],
            "cidr": "10.56.4.0/22",
            "dns_nameservers": [],
            "dns_publish_fixed_ip": false,
            "enable_dhcp": true,
            "gateway_ip": "10.56.4.1",
            "host_routes": [],
            "id": "b0e7435c-1512-45fb-aa9e-9a7c5932fb30",
            "ip_version": 4,
            "name": "",
            "network_id": "64239a54-dcc4-4b39-920b-b37c2144effa",
            "segment_id": null,
            "project_id": "d19231fc08ec4bc4829b668040d34512",
            "tenant_id": "d19231fc08ec4bc4829b668040d34512",
            "created_at": "2016-10-10T14:35:34Z",
            "description": "",
            "ipv6_address_mode": null,
            "ipv6_ra_mode": null,
            "revision_number": 1,
            "service_types": [],
            "subnetpool_id": null,
            "tags": ["tag1,tag2"],
            "updated_at": "2016-10-10T14:35:34Z"
        }
    ]
}
GET
/v2.0/subnets/{subnet_id}

显示子网详细信息

显示子网的详细信息。

使用 fields 查询参数过滤结果。

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

Error response codes: 401, 404

请求

名称

入参

类型

描述

subnet_id

路径

字符串

子网的 ID。

响应参数

名称

入参

类型

描述

subnet

body

对象

一个 subnet 对象。

id

body

字符串

子网的 ID。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

name

body

字符串

Human-readable name of the resource.

enable_dhcp

body

布尔值

指示子网是否启用了 DHCP。

network_id

body

字符串

子网所属网络的 ID。

dns_nameservers

body

数组

与子网关联的 DNS 名称服务器列表。

allocation_pools

body

数组

此子网的 startend IP 地址的分配池。

host_routes

body

数组

子网的附加路由。包含 destinationnexthop 参数的字典列表。

ip_version

body

整数

IP 协议版本。值为 46

gateway_ip

body

字符串

此子网的网关 IP。如果值为 null,则表示没有与该子网关联的网关。

cidr

body

字符串

子网的 CIDR。

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

description

body

字符串

A human-readable description for the resource.

ipv6_address_mode

body

字符串

IPv6 地址模式指定了分配 IP 地址的机制。值为 slaacdhcpv6-statefuldhcpv6-statelessnull

ipv6_ra_mode

body

字符串

IPv6 路由器通告指定了网络服务是否应为子网传输 ICMPv6 数据包。值为 slaacdhcpv6-statefuldhcpv6-statelessnull

revision_number

body

整数

The revision number of the resource.

segment_id

body

字符串

子网关联的网络网段的 ID。当 segment 扩展启用时可用。

service_types

body

数组

与子网关联的服务类型。

subnetpool_id

body

字符串

与子网关联的子网池的 ID。

tags

body

数组

The list of tags on the resource.

dns_publish_fixed_ip

body

布尔值

是否为该子网的 IP 发布 DNS 记录。

router:external (Optional)

查询

布尔值

子网与外部网络的成员关系。

响应示例

{
    "subnet": {
        "name": "my_subnet",
        "enable_dhcp": true,
        "network_id": "d32019d3-bc6e-4319-9c1d-6722fc136a22",
        "segment_id": null,
        "project_id": "4fd44f30292945e481c7b8a0c8908869",
        "tenant_id": "4fd44f30292945e481c7b8a0c8908869",
        "created_at": "2016-03-08T20:19:41",
        "dns_nameservers": [],
        "dns_publish_fixed_ip": false,
        "allocation_pools": [
            {
                "start": "192.0.0.2",
                "end": "192.255.255.254"
            }
        ],
        "host_routes": [],
        "ip_version": 4,
        "gateway_ip": "192.0.0.1",
        "cidr": "192.0.0.0/8",
        "updated_at": "2016-03-08T20:19:41",
        "id": "54d6f61d-db07-451c-9ab3-b9609b6b6f0b",
        "description": "",
        "ipv6_address_mode": null,
        "ipv6_ra_mode": null,
        "revision_number": 2,
        "service_types": [],
        "subnetpool_id": null,
        "tags": ["tag1,tag2"],
        "router:external": false
    }
}
PUT
/v2.0/subnets/{subnet_id}

更新子网

更新子网。

某些属性,例如 IP 版本 (ip_version)、CIDR (cidr) 和网段 (segment_id) 无法更新。尝试更新这些属性将导致 400 Bad Request 错误。

正常响应代码:200

Error response codes: 400, 401, 403, 404, 412

请求

名称

入参

类型

描述

subnet_id

路径

字符串

子网的 ID。

name (可选)

body

字符串

Human-readable name of the resource.

enable_dhcp (可选)

body

布尔值

指示子网是否启用了 DHCP。默认为 true

dns_nameservers (可选)

body

数组

与子网关联的 DNS 名称服务器列表。默认为空列表。

allocation_pools (可选)

body

数组

此子网的 startend IP 地址的分配池。如果未指定 allocation_pools,OpenStack Networking 将默认自动分配池以覆盖 CIDR 中的所有 IP 地址,排除为子网网关保留的地址。

host_routes (可选)

body

数组

子网的附加路由。包含 destinationnexthop 参数的字典列表。默认值为空列表。

gateway_ip (可选)

body

字符串

此子网的网关 IP。如果值为 null,则表示没有与该子网关联的网关。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

service_types (可选)

body

数组

与子网关联的服务类型。

segment_id (可选)

body

字符串

子网关联的网络网段的 ID。当 segment 扩展启用时可用。

dns_publish_fixed_ip (可选)

body

布尔值

是否为该子网的 IP 发布 DNS 记录。默认为 false

请求示例

{
    "subnet": {
        "name": "my_subnet"
    }
}

响应参数

名称

入参

类型

描述

subnet

body

对象

一个 subnet 对象。

id

body

字符串

子网的 ID。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

name

body

字符串

Human-readable name of the resource.

enable_dhcp

body

布尔值

指示子网是否启用了 DHCP。

network_id

body

字符串

子网所属网络的 ID。

dns_nameservers

body

数组

与子网关联的 DNS 名称服务器列表。

allocation_pools

body

数组

此子网的 startend IP 地址的分配池。

host_routes

body

数组

子网的附加路由。包含 destinationnexthop 参数的字典列表。

ip_version

body

整数

IP 协议版本。值为 46

gateway_ip

body

字符串

此子网的网关 IP。如果值为 null,则表示没有与该子网关联的网关。

cidr

body

字符串

子网的 CIDR。

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

description

body

字符串

A human-readable description for the resource.

ipv6_address_mode

body

字符串

IPv6 地址模式指定了分配 IP 地址的机制。值为 slaacdhcpv6-statefuldhcpv6-statelessnull

ipv6_ra_mode

body

字符串

IPv6 路由器通告指定了网络服务是否应为子网传输 ICMPv6 数据包。值为 slaacdhcpv6-statefuldhcpv6-statelessnull

revision_number

body

整数

The revision number of the resource.

segment_id

body

字符串

子网关联的网络网段的 ID。当 segment 扩展启用时可用。

service_types

body

数组

与子网关联的服务类型。

subnetpool_id

body

字符串

与子网关联的子网池的 ID。

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

tags

body

数组

The list of tags on the resource.

dns_publish_fixed_ip

body

布尔值

是否为该子网的 IP 发布 DNS 记录。

router:external (Optional)

查询

布尔值

子网与外部网络的成员关系。

响应示例

{
    "subnet": {
        "name": "my_subnet",
        "enable_dhcp": true,
        "network_id": "db193ab3-96e3-4cb3-8fc5-05f4296d0324",
        "revision_number": 1,
        "segment_id": null,
        "project_id": "26a7980765d0414dbc1fc1f88cdb7e6e",
        "tenant_id": "26a7980765d0414dbc1fc1f88cdb7e6e",
        "created_at": "2016-03-08T20:19:41",
        "dns_nameservers": [],
        "dns_publish_fixed_ip": false,
        "service_types": [],
        "allocation_pools": [
            {
                "start": "10.0.0.2",
                "end": "10.0.0.254"
            }
        ],
        "host_routes": [],
        "ip_version": 4,
        "gateway_ip": "10.0.0.1",
        "cidr": "10.0.0.0/24",
        "updated_at": "2016-03-08T20:19:41",
        "id": "08eae331-0402-425a-923c-34f7cfe39c1b",
        "description": "",
        "tags": ["tag1,tag2"],
        "router:external": false
    }
}
DELETE
/v2.0/subnets/{subnet_id}

删除子网

删除子网。

如果子网 IP 地址仍被分配,则操作失败。

正常响应代码:204

错误响应代码:401、404、412

请求

名称

入参

类型

描述

subnet_id

路径

字符串

子网的 ID。

响应

There is no body content for the response of a successful DELETE request.

子网载入操作 (subnet-onboard-ops)

将网络子网入网到子网池

PUT
/v2.0/subnetpools/{subnetpool_id}/onboard_network_subnets

载入子网

将网络子网载入子网池。

正常响应代码:200

错误响应代码:400

请求

名称

入参

类型

描述

network_id

body

字符串

连接网络的 ID。

subnetpool_id

路径

字符串

子网池的 UUID。

请求示例

{"network_id": "30640c16-a281-4ec5-8ec0-da05a0a5578d"}

响应参数

名称

入参

类型

描述

subnetpool_id

路径

字符串

子网池的 UUID。

cidr

body

字符串

子网的 CIDR。

响应示例

{
  "subnetpool_id": "5b3d3ffd-109a-4bda-a03c-57b17989b215",
  "cidr": "10.0.2.0/24"
}

本地 IP (local_ips)

允许用户创建虚拟 IP,该 IP 以后可以分配给多个端口/ VM(类似于 anycast IP),并且保证仅在同一物理服务器/节点边界内可达。

资源时间戳

The standard-attr-timestamp extension adds the created_at and updated_at attributes to all resources that have standard attributes.

GET
/v2.0/local_ips

列出本地 IP

列出用户可见的本地 IP。

默认策略设置仅返回用户项目拥有的本地 IP,除非用户具有管理员角色。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

Error response codes: 401

请求

名称

入参

类型

描述

id (可选)

查询

字符串

按本地 IP ID 过滤本地 IP 列表结果

name (可选)

查询

字符串

Filter the list result by the human-readable name of the resource.

description (可选)

查询

字符串

Filter the list result by the human-readable description of the resource.

project_id (可选)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

local_port_id (可选)

查询

字符串

按底层 Neutron 端口 ID 过滤本地 IP 列表结果

network_id (Optional)

查询

字符串

按连接网络的ID过滤列表结果。

local_ip_address (可选)

查询

字符串

按 IP 地址过滤本地 IP 列表结果

ip_mode (可选)

查询

字符串

按 IP 模式过滤本地 IP 列表结果。可能的值为 translate (DNAT) 和 passthrough (无 DNAT)

revision_number (Optional)

查询

整数

Filter the list result by the revision number of the resource.

sort_dir (可选)

查询

字符串

Sort direction. A valid value is asc (ascending) or desc (descending). You can specify multiple pairs of sort key and sort direction query parameters.

sort_key (可选)

查询

字符串

按本地 IP 属性排序。您可以指定多个排序键和排序方向查询参数对。排序键限于

  • id

  • name

  • description

  • project_id

  • local_port_id

  • network_id

  • local_ip_address

  • ip_mode

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

local_ips

body

数组

一个 local_ip 对象列表。每个 local_ip 对象代表一个可以与多个端口关联的本地 IP

id

body

字符串

本地 IP 的 ID。

name

body

字符串

Human-readable name of the resource.

description

body

字符串

A human-readable description for the resource.

project_id

body

字符串

项目的 ID。

local_port_id

body

字符串

本地 IP 的底层端口 ID。

network_id

body

字符串

连接网络的 ID。

local_ip_address

body

字符串

本地 IP 的实际 IP 地址。

ip_mode

body

字符串

本地 IP 的 IP 模式。可能的值为 translate (DNAT) 和 passthrough (无 DNAT)

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

revision_number

body

整数

The revision number of the resource.

响应示例

{
    "local_ips": [
        {
            "id": "d23abc8d-2991-4a55-ba98-2aaea84cc72f",
            "name": "test_local_ip1",
            "description": "for test",
            "project_id": "4969c491a3c74ee4af974e6d800c62de",
            "local_port_id": "2f245a7b-796b-4f26-9cf9-9e82d248fda7",
            "network_id": "ce705c24-c1ef-408a-bda3-7bbd946164ab",
            "local_ip_address": "100.100.100.100",
            "ip_mode": "translate",
            "created_at": "2021-12-21T10:55:50Z",
            "updated_at": "2021-12-21T10:55:53Z",
            "revision_number": 1
        },
        {
            "id": "61cea855-49cb-4846-997d-801b70c71bdd",
            "name": "test_local_ip2",
            "description": "for test",
            "project_id": "4969c491a3c74ee4af974e6d800c62de",
            "local_port_id": "898b198e-49f7-47d6-a7e1-53f626a548e6",
            "network_id": "376da547-b977-4cfe-9cba-275c80debf57",
            "local_ip_address": "172.24.4.228",
            "ip_mode": "passthrough",
            "created_at": "2021-12-21T20:45:00Z",
            "updated_at": "2021-12-21T20:45:00Z",
            "revision_number": 1
        }
    ]
}
POST
/v2.0/local_ips

创建本地 IP

创建本地 IP,如果您不指定现有端口 ID,则会分配一个具有指定网络 IP 地址的内部端口。

操作会因以下原因之一而返回 Bad Request (400) 响应代码:

  • 请求的本地 IP 地址不在指定网络的子网范围内。

  • 本地 IP 地址无效。

  • 指定的 local_port_id 没有固定 IP 地址

  • 指定的 local_port_id 有多个固定 IP 地址,且未指定 local_ip

  • 指定的 ip_mode 不受支持

如果 local_port_id 或 network_id 无效,则此操作返回 404 响应代码。

操作会因以下原因之一而返回 Conflict (409) 响应代码:

  • 请求中同时指定了 local_port_id 和 network_id

  • 同时指定了 local_port_id 和 local_ip,但端口没有此类 local_ip

  • 同时指定了 network_id 和 local_ip_address,但网络没有可以满足所请求 IP 的子网

正常响应代码:201

错误响应代码:400、401、404、409

请求

名称

入参

类型

描述

local_ip

body

对象

一个 local_ip 对象代表一个可以与多个端口关联的本地 IP

name (可选)

body

字符串

资源的易读名称。默认情况下为空字符串。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

project_id (可选)

body

字符串

The ID of the project that owns the resource. Only administrative and users with advsvc role can specify a project ID other than their own. You cannot change this value through authorization policies.

local_port_ip

body

字符串

请求的本地 IP 底层端口的 ID

network_id

body

字符串

请求的本地 IP 所属网络的 ID

local_ip_address (可选)

body

字符串

请求的本地 IP 的实际 IP 地址。

ip_mode (可选)

body

字符串

请求的本地 IP 的 IP 模式。可能的值为 translate (DNAT) 和 passthrough (无 DNAT)

请求示例

{
    "local_ip": {
        "name": "test_local_ip",
        "description": "local ip for testing",
        "network_id": "ce705c24-c1ef-408a-bda3-7bbd946164ab",
        "local_ip_address": "172.24.4.228",
        "ip_mode": "translate"
    }
}

响应参数

名称

入参

类型

描述

local_ip

body

对象

一个 local_ip 对象代表一个可以与多个端口关联的本地 IP

id

body

字符串

本地 IP 的 ID。

name

body

字符串

Human-readable name of the resource.

description

body

字符串

A human-readable description for the resource.

project_id

body

字符串

项目的 ID。

local_port_id

body

字符串

本地 IP 的底层端口 ID。

network_id

body

字符串

请求的本地 IP 所属网络的 ID。

local_ip_address

body

字符串

本地 IP 的实际 IP 地址。

ip_mode

body

字符串

本地 IP 的 IP 模式。可能的值为 translate (DNAT) 和 passthrough (无 DNAT)

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

revision_number

body

整数

The revision number of the resource.

响应示例

{
    "local_ip": {
        "id": "d23abc8d-2991-4a55-ba98-2aaea84cc72f",
        "name": "test_local_ip",
        "description": "local ip for testing",
        "project_id": "4969c491a3c74ee4af974e6d800c62de",
        "local_port_id": "2f245a7b-796b-4f26-9cf9-9e82d248fda7",
        "network_id": "ce705c24-c1ef-408a-bda3-7bbd946164ab",
        "local_ip_address": "172.24.4.228",
        "ip_mode": "translate",
        "created_at": "2021-12-21T10:55:50Z",
        "updated_at": "2021-12-21T10:55:53Z",
        "revision_number": 1
    }
}
GET
/v2.0/local_ips/{local_ip_id}

显示本地 IP 详细信息

显示本地 IP 的详细信息。

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

错误响应代码:401、403、404

请求

名称

入参

类型

描述

local_ip_id

路径

字符串

本地 IP 的 ID

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

local_ip

body

对象

一个 local_ip 对象代表一个可以与多个端口关联的本地 IP

id

body

字符串

本地 IP 的 ID。

name

body

字符串

Human-readable name of the resource.

description

body

字符串

A human-readable description for the resource.

project_id

body

字符串

项目的 ID。

local_port_id

body

字符串

本地 IP 的底层端口 ID。

network_id

body

字符串

请求的本地 IP 所属网络的 ID。

local_ip_address

body

字符串

本地 IP 的实际 IP 地址。

ip_mode

body

字符串

本地 IP 的 IP 模式。可能的值为 translate (DNAT) 和 passthrough (无 DNAT)

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

revision_number

body

整数

The revision number of the resource.

响应示例

{
    "local_ip": {
        "id": "d23abc8d-2991-4a55-ba98-2aaea84cc72f",
        "name": "test_local_ip",
        "description": "local ip for testing",
        "project_id": "4969c491a3c74ee4af974e6d800c62de",
        "local_port_id": "2f245a7b-796b-4f26-9cf9-9e82d248fda7",
        "network_id": "ce705c24-c1ef-408a-bda3-7bbd946164ab",
        "local_ip_address": "172.24.4.228",
        "ip_mode": "translate",
        "created_at": "2021-12-21T10:55:50Z",
        "updated_at": "2021-12-21T10:55:53Z",
        "revision_number": 1
    }
}
PUT
/v2.0/local_ips/{local_ip_id}

更新本地 IP

更新本地 IP。

正常响应代码:200

错误响应代码:400、401、404、409

请求

名称

入参

类型

描述

local_ip

body

对象

一个 local_ip 对象代表一个可以与多个端口关联的本地 IP

local_ip_id

路径

字符串

本地 IP 的 ID

name (可选)

body

字符串

资源的易读名称。默认情况下为空字符串。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

请求示例

{
    "local_ip": {
        "name": "new_name",
        "description": "new description"
    }
}

响应参数

名称

入参

类型

描述

local_ip

body

对象

一个 local_ip 对象代表一个可以与多个端口关联的本地 IP

id

body

字符串

本地 IP 的 ID。

name

body

字符串

Human-readable name of the resource.

description

body

字符串

A human-readable description for the resource.

project_id

body

字符串

项目的 ID。

local_port_id

body

字符串

本地 IP 的底层端口 ID。

network_id

body

字符串

请求的本地 IP 所属网络的 ID。

local_ip_address

body

字符串

本地 IP 的实际 IP 地址。

ip_mode

body

字符串

本地 IP 的 IP 模式。可能的值为 translate (DNAT) 和 passthrough (无 DNAT)

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

revision_number

body

整数

The revision number of the resource.

响应示例

{
    "local_ip": {
        "id": "d23abc8d-2991-4a55-ba98-2aaea84cc72f",
        "name": "new_name",
        "description": "now in passthrough mode",
        "project_id": "4969c491a3c74ee4af974e6d800c62de",
        "local_port_id": "2f245a7b-796b-4f26-9cf9-9e82d248fda7",
        "network_id": "ce705c24-c1ef-408a-bda3-7bbd946164ab",
        "local_ip_address": "172.24.4.228",
        "ip_mode": "passthrough",
        "created_at": "2021-12-21T10:55:50Z",
        "updated_at": "2021-12-21T10:55:53Z",
        "revision_number": 1
    }
}
DELETE
/v2.0/local_ips/{local_ip_id}

删除本地 IP

删除本地 IP 及其底层端口(如果适用)。如果底层端口是为此本地 IP 特别创建的,并且具有相应的 device_owner 和 device_id,则会删除它。

由于以下原因,该操作返回 Precondition Failed  (412) 响应代码

  • 请求的本地 IP 仍与某些端口关联。

正常响应代码:204

错误响应代码:401、404、412

请求

名称

入参

类型

描述

local_ip_id

路径

字符串

本地 IP 的 ID

响应

There is no body content for the response of a successful DELETE request.

本地 IP 关联 (port_associations)

此资源允许用户将本地 IP 分配给用户端口。这是本地 IP 资源的子资源。

GET
/v2.0/local_ips/{local_ip_id}/port_associations

列出本地 IP 关联

列出给定本地 IP 的关联。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

Error response codes: 401

请求

名称

入参

类型

描述

local_ip_id

路径

字符串

本地 IP 的 ID

fixed_port_id (可选)

查询

字符串

按关联端口的 ID 过滤本地 IP 关联列表结果

fixed_ip (可选)

查询

字符串

按关联端口的 IP 过滤本地 IP 关联列表结果

host (可选)

查询

字符串

按关联端口的主机过滤本地 IP 关联列表结果

sort_dir (可选)

查询

字符串

Sort direction. A valid value is asc (ascending) or desc (descending). You can specify multiple pairs of sort key and sort direction query parameters.

sort_key (可选)

查询

字符串

按本地 IP 关联属性排序。您可以指定多个排序键和排序方向查询参数对。排序键限于

  • local_ip_id

  • fixed_port_id

  • fixed_ip

  • host

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

local_ip_associations

body

数组

一个 local_ip_association 对象列表。每个 local_ip_association 对象代表一个与端口关联的本地 IP 关联

local_ip_id

body

字符串

本地 IP 的 ID。

local_ip_address

body

字符串

本地 IP 的实际 IP 地址。

fixed_port_id

body

字符串

与本地 IP 关联的端口的 ID。

fixed_ip (可选)

body

字符串

与本地 IP 关联的端口的 IP。

host (可选)

body

字符串

与本地 IP 关联的端口的主机。

响应示例

{
  "port_associations": [
    {
      "local_ip_id": "8c5d88dc-60ac-4b02-a65a-36b65888ddcd",
      "local_ip_address": "172.24.4.228",
      "fixed_port_id": "96227c78-6a0c-4d9d-b441-c4b8f6fb6c4a",
      "fixed_ip": "10.0.0.5",
      "host": "host1"
    },
    {
      "local_ip_id": "8c5d88dc-60ac-4b02-a65a-36b65888ddcd",
      "local_ip_address": "172.24.4.228",
      "fixed_port_id": "1b09fd12-c769-4be7-9c26-dececa474acf",
      "fixed_ip": "10.0.0.6",
      "host": "host2"
    }
  ]
}
POST
/v2.0/local_ips/{local_ip_id}/port_associations

创建本地 IP 关联

创建本地 IP 与给定端口的关联。如果端口有多个固定 IP,用户必须指定要用于关联的 IP。

操作会因以下原因之一而返回 Conflict (409) 响应代码:

  • 指定的 fixed_port_id 有多个固定 IP 地址,且未指定 fixed_ip

  • 请求中同时指定了 fixed_port_id 和 fixed_ip,但端口没有此类固定 IP

正常响应代码:201

错误响应代码:400、401、404、409

请求

名称

入参

类型

描述

local_ip_id

路径

字符串

本地 IP 的 ID

fixed_port_id

body

字符串

与本地 IP 关联的端口的请求 ID。

fixed_ip (可选)

body

字符串

与本地 IP 关联的端口的请求 IP。

请求示例

{
  "port_association": {
    "fixed_port_id": "96227c78-6a0c-4d9d-b441-c4b8f6fb6c4a",
    "fixed_ip": "10.0.0.5"
  }
}

响应参数

名称

入参

类型

描述

local_ip_association

body

对象

一个 local_ip_association 对象代表一个与端口关联的本地 IP 关联

local_ip_id

body

字符串

关联的本地 IP 的 ID。

fixed_port_id

body

字符串

与本地 IP 关联的端口的 ID。

fixed_ip (可选)

body

字符串

与本地 IP 关联的端口的 IP。

host (可选)

body

字符串

与本地 IP 关联的端口的主机。

响应示例

{
  "port_association": {
      "local_ip_id": "8c5d88dc-60ac-4b02-a65a-36b65888ddcd",
      "local_ip_address": "172.24.4.228",
      "fixed_port_id": "96227c78-6a0c-4d9d-b441-c4b8f6fb6c4a",
      "fixed_ip": "10.0.0.5",
      "host": "host1"
  }
}
DELETE
/v2.0/local_ips/{local_ip_id}/port_associations/{fixed_port_id}

删除本地 IP 关联

删除本地 IP 关联。

正常响应代码:204

错误响应代码:400、401、403、404

请求

名称

入参

类型

描述

local_ip_id

路径

字符串

本地 IP 的 ID

fixed_port_id

路径

字符串

与本地 IP 关联的端口的 ID。

响应

There is no body content for the response of a successful DELETE request.

安全

地址组

列出、创建、显示详细信息、更新和删除地址组。

GET
/v2.0/address-groups/{address_group_id}

显示地址组

显示地址组的信息。

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

Error response codes: 401, 404

请求

名称

入参

类型

描述

address_group_id

路径

字符串

地址组的 ID。

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

address_group

body

对象

一个 address group 对象。

id

body

字符串

地址组的 ID。

name

body

字符串

Human-readable name of the resource.

description

body

字符串

A human-readable description for the resource.

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

addresses

body

数组

IP 地址列表。

响应示例

{
  "addresses": [
    "10.0.1.34/32",
    "192.168.100.0/24"
  ],
  "description": "",
  "id": "9ace2ef6-bd57-426a-9223-cf1751d26db9",
  "name": "doc-address-group",
  "project_id": "c9a6f447205640e89523df967c26f4d5"
}
PUT
/v2.0/address-groups/{address_group_id}

更新地址组

更新地址组。

正常响应代码:200

Error response codes: 400, 401, 403, 404, 412

请求

名称

入参

类型

描述

address_group_id

路径

字符串

地址组的 ID。

address_group

body

对象

一个 address group 对象。

name (可选)

body

字符串

资源的易读名称。默认情况下为空字符串。

description

body

字符串

A human-readable description for the resource.

请求示例

{
    "address_group": {
        "description": "AG description"
    }
}

响应参数

名称

入参

类型

描述

address_group

body

对象

一个 address group 对象。

id

body

字符串

地址组的 ID。

name

body

字符串

Human-readable name of the resource.

description

body

字符串

A human-readable description for the resource.

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

addresses

body

数组

IP 地址列表。

响应示例

{
    "address_group": {
        "id": "9ace2ef6-bd57-426a-9223-cf1751d26db9",
        "name": "doc-address-group",
        "project_id": "c9a6f447205640e89523df967c26f4d5",
        "addresses": [
            "10.0.1.34/32",
            "10.0.2.100/32",
            "192.168.100.0/24"
        ],
        "description": "AG description",
        "tenant_id": "c9a6f447205640e89523df967c26f4d5"
    }
}
DELETE
/v2.0/address-groups/{address_group_id}

删除地址组

删除地址组。

正常响应代码:204

错误响应代码:401、404、412

请求

名称

入参

类型

描述

address_group_id

路径

字符串

地址组的 ID。

响应

There is no body content for the response of a successful DELETE request.

GET
/v2.0/address-groups

列出地址组

列出项目有权访问的地址组。

默认策略设置仅返回用户请求的项目拥有的地址组,除非用户具有管理员角色。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

Error response codes: 401

请求

名称

入参

类型

描述

id (可选)

查询

字符串

Filter the list result by the ID of the resource.

name (可选)

查询

字符串

Filter the list result by the human-readable name of the resource.

tenant_id (可选)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

project_id (可选)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

sort_key (可选)

查询

字符串

按地址组属性排序。您可以指定多个排序键和排序方向查询参数对。排序键限于

  • id

  • name

  • project_id

  • shared

  • tenant_id

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

address_groups

body

数组

一个 address group 对象列表。

id

body

字符串

地址组的 ID。

name

body

字符串

Human-readable name of the resource.

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

addresses

body

数组

IP 地址列表。

响应示例

{
    "address_groups": [
        {
            "id": "9ace2ef6-bd57-426a-9223-cf1751d26db9",
            "name": "doc-address-group",
            "project_id": "c9a6f447205640e89523df967c26f4d5",
            "addresses": [
                "10.0.1.34/32",
                "10.0.2.100/32",
                "192.168.100.0/24"
            ],
            "description": "",
            "tenant_id": "c9a6f447205640e89523df967c26f4d5"
        }
    ]
}
POST
/v2.0/address-groups

创建地址组

创建地址组。

正常响应代码:201

错误响应代码:400、401、403、404

请求

名称

入参

类型

描述

address_group_id

路径

字符串

地址组的 ID。

address_group

body

对象

一个 address group 对象。

name (可选)

body

字符串

资源的易读名称。默认情况下为空字符串。

description

body

字符串

A human-readable description for the resource.

addresses

body

数组

IP 地址列表。

请求示例

{
    "address_group": {
        "addresses": [],
        "name": "address-group-2",
        "description": "docs example group"
    }
}

响应参数

名称

入参

类型

描述

address_group

body

对象

一个 address group 对象。

id

body

字符串

地址组的 ID。

name

body

字符串

Human-readable name of the resource.

description

body

字符串

A human-readable description for the resource.

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

addresses

body

数组

IP 地址列表。

响应示例

{
    "address_group": {
        "id": "9f60873a-9bb0-45c9-ac25-b1d5d668d955",
        "name": "address-group-2",
        "project_id": "c9a6f447205640e89523df967c26f4d5",
        "addresses": [],
        "description": "docs example group",
        "tenant_id": "c9a6f447205640e89523df967c26f4d5"
    }
}
PUT
/v2.0/address-group/{address_group_id}/add_addresses

将 IP 地址添加到地址组

将一组 IP 地址原子地添加到地址组已有的地址中。

正常响应代码:200

错误响应代码:400、401、404、412

请求

名称

入参

类型

描述

address_group_id

路径

字符串

地址组的 ID。

addresses

body

数组

IP 地址列表。

请求示例

{
    "address_group": {
        "addresses": ["10.0.2.100/32"]
    }
}

响应参数

名称

入参

类型

描述

address_group

body

对象

一个 address group 对象。

id

body

字符串

地址组的 ID。

name

body

字符串

Human-readable name of the resource.

description

body

字符串

A human-readable description for the resource.

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

addresses

body

数组

IP 地址列表。

响应示例

{
    "address_group": {
        "id": "9ace2ef6-bd57-426a-9223-cf1751d26db9",
        "name": "doc-address-group",
        "project_id": "c9a6f447205640e89523df967c26f4d5",
        "addresses": [
            "10.0.1.34/32",
            "10.0.2.100/32",
            "192.168.100.0/24"
        ],
        "description": "AG description",
        "tenant_id": "c9a6f447205640e89523df967c26f4d5"
    }
}
PUT
/v2.0/address-group/{address_group_id}/remove_addresses

从地址组中删除 IP 地址

原子地从地址组已有的地址中删除一组 IP 地址。

正常响应代码:200

错误响应代码:400、401、404、412

请求

名称

入参

类型

描述

address_group_id

路径

字符串

地址组的 ID。

addresses

body

数组

IP 地址列表。

请求示例

{
    "address_group": {
        "addresses": ["10.0.2.100/32"]
    }
}

响应参数

名称

入参

类型

描述

address_group

body

对象

一个 address group 对象。

id

body

字符串

地址组的 ID。

name

body

字符串

Human-readable name of the resource.

description

body

字符串

A human-readable description for the resource.

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

addresses

body

数组

IP 地址列表。

响应示例

{
    "address_group": {
        "id": "9ace2ef6-bd57-426a-9223-cf1751d26db9",
        "name": "doc-address-group",
        "project_id": "c9a6f447205640e89523df967c26f4d5",
        "addresses": [
            "10.0.1.34/32",
            "192.168.100.0/24"
        ],
        "description": "AG description",
        "tenant_id": "c9a6f447205640e89523df967c26f4d5"
    }
}

FWaaS v2.0 (当前) (fwaas, firewall_groups, firewall_policies, firewall_rules)

使用防火墙即服务 (FWaaS) v2.0 扩展来部署防火墙组以保护您的网络。

FWaaS 扩展使您能够

  • 对进入和离开项目网络的流量应用防火墙规则。

  • 应用 TCP、UDP、ICMP 或协议无关的规则。

  • 创建和共享包含有序防火墙规则集合的防火墙策略。

  • 审计防火墙规则和策略。

此扩展引入了以下资源

  • firewall_group。项目可以创建和管理的逻辑防火墙资源。防火墙组可以有一个用于入站流量的防火墙策略和/或一个用于出站流量的防火墙策略。

  • firewall_policy。有序的防火墙规则集合。您可以与其他项目共享防火墙策略。您可以将防火墙策略包含在审计工作流中,以便授权的相关实体可以审计防火墙策略。此实体可以与创建防火墙策略的用户或使用该防火墙策略的项目不同。

  • firewall_rule。一组属性,例如源和目标端口、源和目标 IP 地址、协议和 IP 版本。这些属性定义了匹配条件以及对匹配数据流量要执行的操作,例如允许、拒绝或拒绝。

GET
/v2.0/fwaas/firewall_groups

列出防火墙组

列出所有防火墙组。

列表可能为空。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

错误响应代码:401, 403

请求

名称

入参

类型

描述

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

firewall_groups

body

数组

一个 firewall_group 对象列表。

admin_state_up

body

布尔值

防火墙组的管理状态,分为启用(true)或禁用(false)。默认为 true

description

body

对象

防火墙组的易读描述。

egress_firewall_policy_id

body

字符串

防火墙组的出站防火墙策略 ID。

id

body

字符串

防火墙组的 ID。

ingress_firewall_policy_id

body

字符串

防火墙组的入站防火墙策略 ID。

name

body

字符串

防火墙组的易读名称。

ports

body

数组

与防火墙组关联的端口 ID 列表。

project_id

body

字符串

拥有资源的项目的 ID。

shared

body

布尔值

指示此防火墙组是否跨所有项目共享。

status

body

字符串

防火墙组的状态。有效值为 ACTIVEINACTIVEERRORPENDING_UPDATEPENDING_DELETE

tenant_id

body

字符串

拥有资源的项目的 ID。

响应示例

{
    "firewall_groups": [
        {
            "admin_state_up": true,
            "description": "",
            "egress_firewall_policy_id": "c69933c1-b472-44f9-8226-30dc4ffd454c",
            "id": "3b0ef8f4-82c7-44d4-a4fb-6177f9a21977",
            "ingress_firewall_policy_id": "c69933c1-b472-44f9-8226-30dc4ffd454c",
            "name": "",
            "ports": [
                "650bfd2f-7766-4a0d-839f-218f33e16998"
            ],
            "shared": true,
            "project_id": "45977fa2dbd7482098dd68d0d8970117",
            "status": "ACTIVE",
            "tenant_id": "45977fa2dbd7482098dd68d0d8970117"
        }
    ]
}
GET
/v2.0/fwaas/firewall_groups/{firewall_group_id}

显示防火墙组详细信息

显示防火墙组的详细信息。

如果用户不是管理员用户且防火墙组对象不属于该项目,此调用将返回 FirewallGroupNotFound (404) 响应代码。

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

错误响应代码:401、403、404

请求

名称

入参

类型

描述

firewall_group_id

路径

字符串

防火墙组的 ID。

响应参数

名称

入参

类型

描述

firewall_group

body

对象

一个 firewall_group 对象。

admin_state_up

body

布尔值

防火墙组的管理状态,分为启用(true)或禁用(false)。默认为 true

description

body

对象

防火墙组的易读描述。

egress_firewall_policy_id

body

字符串

防火墙组的出站防火墙策略 ID。

id

body

字符串

防火墙组的 ID。

ingress_firewall_policy_id

body

字符串

防火墙组的入站防火墙策略 ID。

name

body

字符串

防火墙组的易读名称。

ports

body

数组

与防火墙组关联的端口 ID 列表。

project_id

body

字符串

拥有资源的项目的 ID。

shared

body

布尔值

指示此防火墙组是否跨所有项目共享。

status

body

字符串

防火墙组的状态。有效值为 ACTIVEINACTIVEERRORPENDING_UPDATEPENDING_DELETE

tenant_id

body

字符串

拥有资源的项目的 ID。

响应示例

{
    "firewall_group": {
        "admin_state_up": true,
        "description": "",
        "egress_firewall_policy_id": null,
        "id": "07411bda-0147-418b-af05-c8665630d937",
        "ingress_firewall_policy_id": null,
        "name": "",
        "project_id": "96108b04417b416e9b9bc788c11c42c9",
        "shared": false,
        "status": "INACTIVE",
        "tenant_id": "96108b04417b416e9b9bc788c11c42c9"
    }
}
POST
/v2.0/fwaas/firewall_groups

创建防火墙组

创建防火墙组。

防火墙组可以与入站防火墙策略和/或出站防火墙策略关联。

如果 admin_state_upfalse,防火墙组将阻止所有流量。

正常响应代码:201

错误响应代码:400, 401

请求

名称

入参

类型

描述

firewall_group

body

对象

一个 firewall_group 对象。

admin_state_up (Optional)

body

布尔值

防火墙组的管理状态,分为启用(true)或禁用(false)。默认为 true

description (可选)

body

对象

防火墙组的易读描述。

egress_firewall_policy_id (可选)

body

字符串

防火墙组的出站防火墙策略 ID。

ingress_firewall_policy_id (可选)

body

字符串

防火墙组的入站防火墙策略 ID。

name (可选)

body

字符串

防火墙组的易读名称。

ports (可选)

body

数组

与防火墙组关联的端口 ID 列表。

project_id (可选)

body

字符串

拥有资源的项目的 ID。

shared (Optional)

body

布尔值

指示此防火墙组是否跨所有项目共享。

tenant_id (可选)

body

字符串

拥有资源的项目的 ID。

请求示例

{
    "firewall_group": {
        "admin_state_up": false,
        "egress_firewall_policy_id": "14c9d3c1-b472-44f9-8226-30dc4ffd454c",
        "ingress_firewall_policy_id": "c69933c1-b472-44f9-8226-30dc4ffd454c"
    }
}

响应参数

名称

入参

类型

描述

firewall_group

body

对象

一个 firewall_group 对象。

admin_state_up

body

布尔值

防火墙组的管理状态,分为启用(true)或禁用(false)。默认为 true

description

body

对象

防火墙组的易读描述。

egress_firewall_policy_id

body

字符串

防火墙组的出站防火墙策略 ID。

id

body

字符串

防火墙组的 ID。

ingress_firewall_policy_id

body

字符串

防火墙组的入站防火墙策略 ID。

name

body

字符串

防火墙组的易读名称。

ports

body

数组

与防火墙组关联的端口 ID 列表。

project_id

body

字符串

拥有资源的项目的 ID。

shared

body

布尔值

指示此防火墙组是否跨所有项目共享。

status

body

字符串

防火墙组的状态。有效值为 ACTIVEINACTIVEERRORPENDING_UPDATEPENDING_DELETE

tenant_id

body

字符串

拥有资源的项目的 ID。

响应示例

{
    "firewall_group": {
        "admin_state_up": true,
        "description": "",
        "egress_firewall_policy_id": "1244ed87-b472-44f9-8226-30dc4ffd454c",
        "ingress_firewall_policy_id": "c69933c1-b472-44f9-8226-30dc4ffd454c",
        "id": "3b0ef8f4-82c7-44d4-a4fb-6177f9a21977",
        "name": "",
        "ports": [
            "650bfd2f-7766-4a0d-839f-218f33e16998"
        ],
        "project_id": "45977fa2dbd7482098dd68d0d8970117",
        "shared": true,
        "status": "PENDING_CREATE",
        "tenant_id": "45977fa2dbd7482098dd68d0d8970117"
    }
}
PUT
/v2.0/fwaas/firewall_groups/{firewall_group_id}

更新防火墙组

更新防火墙组。

如果防火墙组的状态为 PENDING_*,则无法更新。

正常响应代码:200

错误响应代码:400、401、404

请求

名称

入参

类型

描述

firewall_group_id

路径

字符串

防火墙组的 ID。

firewall_group

body

对象

一个 firewall_group 对象。

admin_state_up (Optional)

body

布尔值

防火墙组的管理状态,分为启用(true)或禁用(false)。默认为 true

description (可选)

body

对象

防火墙组的易读描述。

egress_firewall_policy_id (可选)

body

字符串

防火墙组的出站防火墙策略 ID。

ingress_firewall_policy_id (可选)

body

字符串

防火墙组的入站防火墙策略 ID。

name (可选)

body

字符串

防火墙组的易读名称。

ports (可选)

body

数组

与防火墙组关联的端口 ID 列表。

shared (Optional)

body

布尔值

指示此防火墙组是否跨所有项目共享。

请求示例

{
    "firewall_group": {
        "admin_state_up": "false"
    }
}

响应参数

名称

入参

类型

描述

firewall_group

body

对象

一个 firewall_group 对象。

admin_state_up

body

布尔值

防火墙组的管理状态,分为启用(true)或禁用(false)。默认为 true

description

body

对象

防火墙组的易读描述。

egress_firewall_policy_id

body

字符串

防火墙组的出站防火墙策略 ID。

id

body

字符串

防火墙组的 ID。

ingress_firewall_policy_id

body

字符串

防火墙组的入站防火墙策略 ID。

name

body

字符串

防火墙组的易读名称。

ports

body

数组

与防火墙组关联的端口 ID 列表。

project_id

body

字符串

拥有资源的项目的 ID。

shared

body

布尔值

指示此防火墙组是否跨所有项目共享。

status

body

字符串

防火墙组的状态。有效值为 ACTIVEINACTIVEERRORPENDING_UPDATEPENDING_DELETE

tenant_id

body

字符串

拥有资源的项目的 ID。

响应示例

{
    "firewall_group": {
        "admin_state_up": false,
        "description": "",
        "egress_firewall_policy_id": "c69933c1-b472-44f9-8226-30dc4ffd454c",
        "ingress_firewall_policy_id": "c69933c1-b472-44f9-8226-30dc4ffd454c",
        "id": "3b0ef8f4-82c7-44d4-a4fb-6177f9a21977",
        "name": "",
        "ports": [
            "650bfd2f-7766-4a0d-839f-218f33e16998"
        ],
        "shared": true,
        "project_id": "45977fa2dbd7482098dd68d0d8970117",
        "status": "PENDING_UPDATE",
        "tenant_id": "45977fa2dbd7482098dd68d0d8970117"
    }
}
DELETE
/v2.0/fwaas/firewall_groups/{firewall_group_id}

删除防火墙组

删除防火墙组。

正常响应代码:204

错误响应代码:401, 404, 409

请求

名称

入参

类型

描述

firewall_group_id

路径

字符串

防火墙组的 ID。

响应

There is no body content for the response of a successful DELETE request.

GET
/v2.0/fwaas/firewall_policies

列出防火墙策略

列出所有防火墙策略。

列表可能为空。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

错误响应代码:401, 403

请求

名称

入参

类型

描述

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

firewall_policies

body

数组

一个 firewall_policy 对象列表。

audited

body

布尔值

每次更改防火墙策略或其关联规则时,API 都会将此属性设置为 false。要审计策略,请显式将此属性设置为 true

description

body

字符串

防火墙策略的易读名称。

id

body

字符串

防火墙策略的 ID。

firewall_rules

body

数组

与防火墙策略关联的防火墙规则 ID 列表。

name

body

字符串

防火墙策略的易读名称。

project_id

body

字符串

拥有资源的项目的 ID。

shared

body

布尔值

设置为 true 使此防火墙策略对其他项目可见。默认为 false

tenant_id

body

字符串

拥有资源的项目的 ID。

响应示例

{
    "firewall_policies": [
        {
            "audited": false,
            "description": "",
            "firewall_rules": [
                "8722e0e0-9cc9-4490-9660-8c9a5732fbb0"
            ],
            "id": "c69933c1-b472-44f9-8226-30dc4ffd454c",
            "name": "test-policy",
            "project_id": "45977fa2dbd7482098dd68d0d8970117",
            "shared": false,
            "tenant_id": "45977fa2dbd7482098dd68d0d8970117"
        }
    ]
}
GET
/v2.0/fwaas/firewall_policies/{firewall_policy_id}

显示防火墙策略详细信息

显示防火墙策略的详细信息。

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

错误响应代码:401、403、404

请求

名称

入参

类型

描述

firewall_policy_id

路径

字符串

防火墙策略的 ID。

响应参数

名称

入参

类型

描述

audited

body

布尔值

每次更改防火墙策略或其关联规则时,API 都会将此属性设置为 false。要审计策略,请显式将此属性设置为 true

description

body

字符串

防火墙策略的易读名称。

firewall_rules

body

数组

与防火墙策略关联的防火墙规则 ID 列表。

id

body

字符串

防火墙策略的 ID。

name

body

字符串

防火墙策略的易读名称。

project_id

body

字符串

拥有资源的项目的 ID。

shared

body

布尔值

设置为 true 使此防火墙策略对其他项目可见。默认为 false

tenant_id

body

字符串

拥有资源的项目的 ID。

响应示例

{
    "firewall_policy": {
        "audited": false,
        "description": "",
        "firewall_rules": [
            "8722e0e0-9cc9-4490-9660-8c9a5732fbb0"
        ],
        "id": "c69933c1-b472-44f9-8226-30dc4ffd454c",
        "name": "test-policy",
        "project_id": "45977fa2dbd7482098dd68d0d8970117",
        "shared": false,
        "tenant_id": "45977fa2dbd7482098dd68d0d8970117"
    }
}
POST
/v2.0/fwaas/firewall_policies

创建防火墙策略

创建防火墙策略。

正常响应代码:201

错误响应代码:400, 401

请求

名称

入参

类型

描述

firewall_policy

body

对象

一个 firewall_policy 对象。

audited (可选)

body

布尔值

每次更改防火墙策略或其关联规则时,API 都会将此属性设置为 false。要审计策略,请显式将此属性设置为 true

description (可选)

body

字符串

防火墙策略的易读名称。

firewall_rules (可选)

body

数组

与防火墙策略关联的防火墙规则 ID 列表。

name (可选)

body

字符串

防火墙策略的易读名称。

project_id (可选)

body

字符串

拥有资源的项目的 ID。

shared (Optional)

body

布尔值

设置为 true 使此防火墙策略对其他项目可见。默认为 false

tenant_id (可选)

body

字符串

拥有资源的项目的 ID。

请求示例

{
    "firewall_policy": {
        "name": "test-policy",
        "firewall_rules": [
            "8722e0e0-9cc9-4490-9660-8c9a5732fbb0"
        ]
    }
}

响应参数

名称

入参

类型

描述

firewall_policy

body

对象

一个 firewall_policy 对象。

audited

body

布尔值

每次更改防火墙策略或其关联规则时,API 都会将此属性设置为 false。要审计策略,请显式将此属性设置为 true

description

body

字符串

防火墙策略的易读名称。

firewall_rules

body

数组

与防火墙策略关联的防火墙规则 ID 列表。

id

body

字符串

防火墙策略的 ID。

name

body

字符串

防火墙策略的易读名称。

project_id

body

字符串

拥有资源的项目的 ID。

shared

body

布尔值

设置为 true 使此防火墙策略对其他项目可见。默认为 false

tenant_id

body

字符串

拥有资源的项目的 ID。

响应示例

{
    "firewall_policy": {
        "audited": false,
        "description": "",
        "firewall_rules": [
            "8722e0e0-9cc9-4490-9660-8c9a5732fbb0"
        ],
        "id": "c69933c1-b472-44f9-8226-30dc4ffd454c",
        "name": "test-policy",
        "project_id": "45977fa2dbd7482098dd68d0d8970117",
        "shared": false,
        "tenant_id": "45977fa2dbd7482098dd68d0d8970117"
    }
}
PUT
/v2.0/fwaas/firewall_policies/{firewall_policy_id}

更新防火墙策略

更新防火墙策略。

正常响应代码:200

错误响应代码:400、401、404

请求

名称

入参

类型

描述

firewall_policy_id

路径

字符串

防火墙策略的 ID。

firewall_policy

body

对象

一个 firewall_policy 对象。

audited (可选)

body

布尔值

每次更改防火墙策略或其关联规则时,API 都会将此属性设置为 false。要审计策略,请显式将此属性设置为 true

description (可选)

body

字符串

防火墙策略的易读名称。

firewall_rules (可选)

body

数组

与防火墙策略关联的防火墙规则 ID 列表。

name (可选)

body

字符串

防火墙策略的易读名称。

project_id (可选)

body

字符串

拥有资源的项目的 ID。

shared (Optional)

body

布尔值

设置为 true 使此防火墙策略对其他项目可见。默认为 false

tenant_id (可选)

body

字符串

拥有资源的项目的 ID。

请求示例

{
    "firewall_policy": {
        "firewall_rules": [
            "a08ef905-0ff6-4784-8374-175fffe7dade",
            "8722e0e0-9cc9-4490-9660-8c9a5732fbb0"
        ]
    }
}

响应参数

名称

入参

类型

描述

firewall_policy

body

对象

一个 firewall_policy 对象。

audited

body

布尔值

每次更改防火墙策略或其关联规则时,API 都会将此属性设置为 false。要审计策略,请显式将此属性设置为 true

description

body

字符串

防火墙策略的易读名称。

firewall_rules

body

数组

与防火墙策略关联的防火墙规则 ID 列表。

id

body

字符串

防火墙策略的 ID。

name

body

字符串

防火墙策略的易读名称。

shared

body

布尔值

设置为 true 使此防火墙策略对其他项目可见。默认为 false

project_id

body

字符串

拥有资源的项目的 ID。

tenant_id

body

字符串

拥有资源的项目的 ID。

响应示例

{
    "firewall_policy": {
        "audited": false,
        "description": "",
        "firewall_rules": [
            "a08ef905-0ff6-4784-8374-175fffe7dade",
            "8722e0e0-9cc9-4490-9660-8c9a5732fbb0"
        ],
        "id": "c69933c1-b472-44f9-8226-30dc4ffd454c",
        "name": "test-policy",
        "project_id": "45977fa2dbd7482098dd68d0d8970117",
        "shared": false,
        "tenant_id": "45977fa2dbd7482098dd68d0d8970117"
    }
}
DELETE
/v2.0/fwaas/firewall_policies/{firewall_policy_id}

删除防火墙策略

删除防火墙策略。

正常响应代码:204

错误响应代码:401, 404, 409

请求

名称

入参

类型

描述

firewall_policy_id

路径

字符串

防火墙策略的 ID。

响应

There is no body content for the response of a successful DELETE request.

GET
/v2.0/fwaas/firewall_rules

列出防火墙规则

列出所有防火墙规则。

列表可能为空。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

错误响应代码:401, 403

请求

名称

入参

类型

描述

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

firewall_rules

body

对象

一个 firewall_rule 对象列表。

动作

body

字符串

API 对匹配防火墙规则的流量执行的操作。有效值为 allowdeny。默认为 deny

description

body

字符串

防火墙规则的易读描述。

destination_firewall_group_id

body

字符串

远程目标防火墙组的 ID。

destination_ip_address

body

字符串

防火墙规则的目标 IPv4 或 IPv6 地址或 CIDR。无默认值。

destination_port

body

字符串

防火墙规则的目标端口或端口范围。有效值为端口号(整数)或端口范围(格式为 : 分隔的范围)。对于端口范围,请包含范围的两端。例如,80:90

enabled

body

布尔值

设置为 false 以在此防火墙策略中禁用此规则。有助于选择性地关闭规则,而无需将规则与防火墙策略取消关联。有效值为 truefalse。默认为 true

firewall_policy_id

body

字符串

防火墙策略的 ID。

id

body

字符串

防火墙规则的 ID。

ip_version

body

整数

防火墙规则的 IP 协议版本。有效值为 46。默认为 4

name

body

字符串

防火墙规则的易读名称。

project_id

body

字符串

拥有资源的项目的 ID。

协议

body

字符串

防火墙规则的 IP 协议。可能的值为 icmptcpudpnull

shared

body

布尔值

指示此防火墙规则是否跨所有项目共享。

source_firewall_group_id

body

字符串

远程源防火墙组的 ID。

source_ip_address

body

字符串

防火墙规则的源 IPv4 或 IPv6 地址或 CIDR。无默认值。

source_port

body

字符串

防火墙规则的源端口或端口范围。有效值为端口号(整数)或端口范围(格式为 : 分隔的范围)。对于端口范围,请包含范围的两端。例如,80:90

tenant_id

body

字符串

拥有资源的项目的 ID。

响应示例

{
    "firewall_rules": [
        {
            "action": "allow",
            "description": "",
            "destination_firewall_group_id": null,
            "destination_ip_address": null,
            "destination_port": "80",
            "enabled": true,
            "firewall_policy_id": "c69933c1-b472-44f9-8226-30dc4ffd454c",
            "id": "8722e0e0-9cc9-4490-9660-8c9a5732fbb0",
            "ip_version": 4,
            "name": "ALLOW_HTTP",
            "position": 1,
            "project_id": "45977fa2dbd7482098dd68d0d8970117",
            "protocol": "tcp",
            "shared": false,
            "source_firewall_group_id": null,
            "source_ip_address": null,
            "source_port": null,
            "tenant_id": "45977fa2dbd7482098dd68d0d8970117"
        }
    ]
}
GET
/v2.0/fwaas/firewall_rules/{firewall_rule_id}

显示防火墙规则详细信息

显示防火墙规则的详细信息。

如果用户不是管理员用户且防火墙规则对象不属于该项目,此调用将返回 Forbidden (403) 响应代码。

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

错误响应代码:401、403、404

请求

名称

入参

类型

描述

firewall_rule_id

路径

字符串

防火墙规则的 ID。

响应参数

名称

入参

类型

描述

firewall_rule

body

对象

一个 firewall_rule 对象。

动作

body

字符串

API 对匹配防火墙规则的流量执行的操作。有效值为 allowdeny。默认为 deny

description

body

字符串

防火墙规则的易读描述。

destination_firewall_group_id

body

字符串

远程目标防火墙组的 ID。

destination_ip_address

body

字符串

防火墙规则的目标 IPv4 或 IPv6 地址或 CIDR。无默认值。

destination_port

body

字符串

防火墙规则的目标端口或端口范围。有效值为端口号(整数)或端口范围(格式为 : 分隔的范围)。对于端口范围,请包含范围的两端。例如,80:90

enabled

body

布尔值

设置为 false 以在此防火墙策略中禁用此规则。有助于选择性地关闭规则,而无需将规则与防火墙策略取消关联。有效值为 truefalse。默认为 true

firewall_policy_id

body

字符串

防火墙策略的 ID。

id

body

字符串

防火墙规则的 ID。

ip_version

body

整数

防火墙规则的 IP 协议版本。有效值为 46。默认为 4

name

body

字符串

防火墙规则的易读名称。

project_id

body

字符串

拥有资源的项目的 ID。

协议

body

字符串

防火墙规则的 IP 协议。可能的值为 icmptcpudpnull

shared

body

布尔值

指示此防火墙规则是否跨所有项目共享。

source_firewall_group_id

body

字符串

远程源防火墙组的 ID。

source_ip_address

body

字符串

防火墙规则的源 IPv4 或 IPv6 地址或 CIDR。无默认值。

source_port

body

字符串

防火墙规则的源端口或端口范围。有效值为端口号(整数)或端口范围(格式为 : 分隔的范围)。对于端口范围,请包含范围的两端。例如,80:90

tenant_id

body

字符串

拥有资源的项目的 ID。

响应示例

{
    "firewall_rule": {
        "action": "allow",
        "description": "",
        "destination_firewall_group_id": null,
        "destination_ip_address": null,
        "destination_port": "80",
        "enabled": true,
        "firewall_policy_id": null,
        "id": "8722e0e0-9cc9-4490-9660-8c9a5732fbb0",
        "ip_version": 4,
        "name": "ALLOW_HTTP",
        "position": null,
        "project_id": "45977fa2dbd7482098dd68d0d8970117",
        "protocol": "tcp",
        "shared": false,
        "source_firewall_group_id": null,
        "source_ip_address": null,
        "source_port": null,
        "tenant_id": "45977fa2dbd7482098dd68d0d8970117"
    }
}
POST
/v2.0/fwaas/firewall_rules

创建防火墙规则

创建防火墙规则。

正常响应代码:201

错误响应代码:400, 401

请求

名称

入参

类型

描述

firewall_rule

body

对象

一个 firewall_rule 对象。

action(可选)

body

字符串

API 对匹配防火墙规则的流量执行的操作。有效值为 allowdeny。默认为 deny

description (可选)

body

字符串

防火墙规则的易读描述。

destination_firewall_group_id (可选)

body

字符串

远程目标防火墙组的 ID。

destination_ip_address (可选)

body

字符串

防火墙规则的目标 IPv4 或 IPv6 地址或 CIDR。无默认值。

destination_port (可选)

body

字符串

防火墙规则的目标端口或端口范围。有效值为端口号(整数)或端口范围(格式为 : 分隔的范围)。对于端口范围,请包含范围的两端。例如,80:90

enabled(可选)

body

布尔值

设置为 false 以在此防火墙策略中禁用此规则。有助于选择性地关闭规则,而无需将规则与防火墙策略取消关联。有效值为 truefalse。默认为 true

ip_version (Optional)

body

整数

防火墙规则的 IP 协议版本。有效值为 46。默认为 4

name (可选)

body

字符串

防火墙规则的易读名称。

project_id (可选)

body

字符串

拥有资源的项目的 ID。

protocol (Optional)

body

字符串

防火墙规则的 IP 协议。可能的值为 icmptcpudpnull

shared (Optional)

body

布尔值

指示此防火墙规则是否跨所有项目共享。

source_firewall_group_id (可选)

body

字符串

远程源防火墙组的 ID。

source_ip_address (可选)

body

字符串

防火墙规则的源 IPv4 或 IPv6 地址或 CIDR。无默认值。

source_port (可选)

body

字符串

防火墙规则的源端口或端口范围。有效值为端口号(整数)或端口范围(格式为 : 分隔的范围)。对于端口范围,请包含范围的两端。例如,80:90

tenant_id (可选)

body

字符串

拥有资源的项目的 ID。

请求示例

{
    "firewall_rule": {
        "action": "allow",
        "destination_port": "80",
        "enabled": true,
        "name": "ALLOW_HTTP",
        "protocol": "tcp"
    }
}

响应参数

名称

入参

类型

描述

firewall_rule

body

对象

一个 firewall_rule 对象。

动作

body

字符串

API 对匹配防火墙规则的流量执行的操作。有效值为 allowdeny。默认为 deny

description

body

字符串

防火墙规则的易读描述。

destination_firewall_group_id

body

字符串

远程目标防火墙组的 ID。

destination_ip_address

body

字符串

防火墙规则的目标 IPv4 或 IPv6 地址或 CIDR。无默认值。

destination_port

body

字符串

防火墙规则的目标端口或端口范围。有效值为端口号(整数)或端口范围(格式为 : 分隔的范围)。对于端口范围,请包含范围的两端。例如,80:90

enabled

body

布尔值

设置为 false 以在此防火墙策略中禁用此规则。有助于选择性地关闭规则,而无需将规则与防火墙策略取消关联。有效值为 truefalse。默认为 true

firewall_policy_id

body

字符串

防火墙策略的 ID。

id

body

字符串

防火墙规则的 ID。

ip_version

body

整数

防火墙规则的 IP 协议版本。有效值为 46。默认为 4

name

body

字符串

防火墙规则的易读名称。

project_id

body

字符串

拥有资源的项目的 ID。

协议

body

字符串

防火墙规则的 IP 协议。可能的值为 icmptcpudpnull

shared

body

布尔值

指示此防火墙规则是否跨所有项目共享。

source_firewall_group_id

body

字符串

远程源防火墙组的 ID。

source_ip_address

body

字符串

防火墙规则的源 IPv4 或 IPv6 地址或 CIDR。无默认值。

source_port

body

字符串

防火墙规则的源端口或端口范围。有效值为端口号(整数)或端口范围(格式为 : 分隔的范围)。对于端口范围,请包含范围的两端。例如,80:90

tenant_id

body

字符串

拥有资源的项目的 ID。

响应示例

{
    "firewall_rule": {
        "action": "deny",
        "description": "",
        "destination_firewall_group_id": null,
        "destination_ip_address": null,
        "destination_port": null,
        "enabled": true,
        "id": "1fd59b2f-cc87-435f-a244-1df2c0cc3f70",
        "ip_version": 4,
        "name": "rule3",
        "project_id": "95573613ec554b4b8df9f2679c64557b",
        "protocol": null,
        "shared": false,
        "source_firewall_group_id": null,
        "source_ip_address": null,
        "source_port": null,
        "tenant_id": "95573613ec554b4b8df9f2679c64557b"
    }
}
PUT
/v2.0/fwaas/firewall_rules/{firewall_rule_id}

更新防火墙规则

更新防火墙规则。

正常响应代码:200

错误响应代码:400、401、404

请求

名称

入参

类型

描述

firewall_rule_id

路径

字符串

防火墙规则的 ID。

firewall_rule

body

对象

一个 firewall_rule 对象。

action(可选)

body

字符串

API 对匹配防火墙规则的流量执行的操作。有效值为 allowdeny。默认为 deny

description (可选)

body

字符串

防火墙规则的易读描述。

destination_firewall_group_id (可选)

body

字符串

远程目标防火墙组的 ID。

destination_ip_address (可选)

body

字符串

防火墙规则的目标 IPv4 或 IPv6 地址或 CIDR。无默认值。

destination_port (可选)

body

字符串

防火墙规则的目标端口或端口范围。有效值为端口号(整数)或端口范围(格式为 : 分隔的范围)。对于端口范围,请包含范围的两端。例如,80:90

enabled(可选)

body

布尔值

设置为 false 以在此防火墙策略中禁用此规则。有助于选择性地关闭规则,而无需将规则与防火墙策略取消关联。有效值为 truefalse。默认为 true

firewall_policy_id

body

字符串

防火墙策略的 ID。

ip_version (Optional)

body

整数

防火墙规则的 IP 协议版本。有效值为 46。默认为 4

name (可选)

body

字符串

防火墙规则的易读名称。

project_id (可选)

body

字符串

拥有资源的项目的 ID。

protocol (Optional)

body

字符串

防火墙规则的 IP 协议。可能的值为 icmptcpudpnull

shared (Optional)

body

布尔值

指示此防火墙规则是否跨所有项目共享。

source_firewall_group_id (可选)

body

字符串

远程源防火墙组的 ID。

source_ip_address (可选)

body

字符串

防火墙规则的源 IPv4 或 IPv6 地址或 CIDR。无默认值。

source_port (可选)

body

字符串

防火墙规则的源端口或端口范围。有效值为端口号(整数)或端口范围(格式为 : 分隔的范围)。对于端口范围,请包含范围的两端。例如,80:90

tenant_id (可选)

body

字符串

拥有资源的项目的 ID。

请求示例

{
    "firewall_rule": {
        "shared": true
    }
}

响应参数

名称

入参

类型

描述

firewall_rule

body

对象

一个 firewall_rule 对象。

动作

body

字符串

API 对匹配防火墙规则的流量执行的操作。有效值为 allowdeny。默认为 deny

description

body

字符串

防火墙规则的易读描述。

destination_firewall_group_id

body

字符串

远程目标防火墙组的 ID。

destination_ip_address

body

字符串

防火墙规则的目标 IPv4 或 IPv6 地址或 CIDR。无默认值。

destination_port

body

字符串

防火墙规则的目标端口或端口范围。有效值为端口号(整数)或端口范围(格式为 : 分隔的范围)。对于端口范围,请包含范围的两端。例如,80:90

enabled

body

布尔值

设置为 false 以在此防火墙策略中禁用此规则。有助于选择性地关闭规则,而无需将规则与防火墙策略取消关联。有效值为 truefalse。默认为 true

firewall_policy_id

body

字符串

防火墙策略的 ID。

id

body

字符串

防火墙规则的 ID。

ip_version

body

整数

防火墙规则的 IP 协议版本。有效值为 46。默认为 4

name

body

字符串

防火墙规则的易读名称。

project_id

body

字符串

拥有资源的项目的 ID。

协议

body

字符串

防火墙规则的 IP 协议。可能的值为 icmptcpudpnull

shared

body

布尔值

指示此防火墙规则是否跨所有项目共享。

source_firewall_group_id

body

字符串

远程源防火墙组的 ID。

source_ip_address

body

字符串

防火墙规则的源 IPv4 或 IPv6 地址或 CIDR。无默认值。

source_port

body

字符串

防火墙规则的源端口或端口范围。有效值为端口号(整数)或端口范围(格式为 : 分隔的范围)。对于端口范围,请包含范围的两端。例如,80:90

tenant_id

body

字符串

拥有资源的项目的 ID。

响应示例

{
    "firewall_rule": {
        "action": "allow",
        "description": "",
        "destination_firewall_group_id": null,
        "destination_ip_address": null,
        "destination_port": "80",
        "enabled": true,
        "firewall_policy_id": "c69933c1-b472-44f9-8226-30dc4ffd454c",
        "id": "8722e0e0-9cc9-4490-9660-8c9a5732fbb0",
        "ip_version": 4,
        "name": "ALLOW_HTTP",
        "position": 1,
        "project_id": "45977fa2dbd7482098dd68d0d8970117",
        "protocol": "tcp",
        "shared": true,
        "source_firewall_group_id": null,
        "source_ip_address": null,
        "source_port": null,
        "tenant_id": "45977fa2dbd7482098dd68d0d8970117"
    }
}
DELETE
/v2.0/fwaas/firewall_rules/{firewall_rule_id}

删除防火墙规则

删除防火墙规则。 samples/firewall-v2/firewall-policy-create-response.json

正常响应代码:204

错误响应代码:401, 404, 409

请求

名称

入参

类型

描述

firewall_rule_id

路径

字符串

防火墙规则的 ID。

PUT
/v2.0/fwaas/firewall_policies/{firewall_policy_id}/insert_rule

将规则插入防火墙策略

将防火墙规则插入策略。

防火墙规则 ID 相对于 insert_beforeinsert_after 指定的防火墙规则 ID 进行插入。如果设置了 insert_before,则 insert_after 将被忽略。如果未设置 insert_beforeinsert_after,则新的 firewall_rule_id 将作为策略的第一个规则插入。

正常响应代码:200

错误响应代码:400、401、404、409

请求

名称

入参

类型

描述

firewall_policy_id

路径

字符串

防火墙策略的 ID。

firewall_rule_id

body

字符串

防火墙规则的 ID。

insert_after

body

字符串

要插入新规则之后的新规则的防火墙规则 ID。新规则将紧跟在指定的防火墙规则之后插入。如果同时提供了 beforeafter 值,则将忽略 after 值。要将规则插入尚无规则的策略,beforeafter 值都必须是“”。

insert_before

body

字符串

要将新规则插入之前的防火墙规则 ID。新规则将紧跟在指定的防火墙规则之前插入。如果同时提供了 beforeafter 值,则将忽略 after 值。要将规则插入尚无规则的策略,beforeafter 值都必须是“”。

请求示例

{
    "firewall_rule_id": "7bc34b8c-8d3b-4ada-a9c8-1f4c11c65692",
    "insert_after": "a08ef905-0ff6-4784-8374-175fffe7dade",
    "insert_before": ""
}

响应参数

名称

入参

类型

描述

audited

body

布尔值

每次更改防火墙策略或其关联规则时,API 都会将此属性设置为 false。要审计策略,请显式将此属性设置为 true

description

body

字符串

防火墙策略的易读名称。

firewall_rules

body

数组

与防火墙策略关联的防火墙规则 ID 列表。

id

body

字符串

防火墙策略的 ID。

name

body

字符串

防火墙策略的易读名称。

project_id

body

字符串

拥有资源的项目的 ID。

shared

body

布尔值

设置为 true 使此防火墙策略对其他项目可见。默认为 false

tenant_id

body

字符串

拥有资源的项目的 ID。

响应示例

{
  "audited": false,
  "description": "",
  "firewall_rules": [
    "acbdfead-eca2-4456-838c-8b531e47b9c7"
  ],
  "id": "c9e15d6e-b6ba-4ef4-8715-985d1f100467",
  "name": "policy2",
  "shared": false,
  "project_id": "95573613ec554b4b8df9f2679c64557b",
  "tenant_id": "95573613ec554b4b8df9f2679c64557b"
}
PUT
/v2.0/fwaas/firewall_policies/{firewall_policy_id}/remove_rule

从防火墙策略中删除规则

从策略中删除防火墙规则。

正常响应代码:200

错误响应代码:400、401、404

请求

名称

入参

类型

描述

firewall_policy_id

路径

字符串

防火墙策略的 ID。

firewall_rule_id

body

字符串

防火墙规则的 ID。

请求示例

{
    "firewall_rule_id": "7bc34b8c-8d3b-4ada-a9c8-1f4c11c65692"
}

响应参数

名称

入参

类型

描述

audited

body

布尔值

每次更改防火墙策略或其关联规则时,API 都会将此属性设置为 false。要审计策略,请显式将此属性设置为 true

description

body

字符串

防火墙策略的易读名称。

firewall_rules

body

数组

与防火墙策略关联的防火墙规则 ID 列表。

id

body

字符串

防火墙策略的 ID。

name

body

字符串

防火墙策略的易读名称。

project_id

body

字符串

拥有资源的项目的 ID。

shared

body

布尔值

设置为 true 使此防火墙策略对其他项目可见。默认为 false

tenant_id

body

字符串

拥有资源的项目的 ID。

响应示例

{
  "audited": false,
  "description": "",
  "firewall_rules": [],
  "id": "c9e15d6e-b6ba-4ef4-8715-985d1f100467",
  "name": "policy2",
  "project_id": "95573613ec554b4b8df9f2679c64557b",
  "shared": false,
  "tenant_id": "95573613ec554b4b8df9f2679c64557b"
}

RBAC 策略

列出、显示详细信息、创建、更新和删除 RBAC 策略。

rbac-security-groups 扩展的存在将其 API 扩展到支持 security_group 的对象类型。

rbac-address-scope 扩展的存在将其 API 扩展到支持 address-scope 的对象类型。

rbac-subnetpool 扩展的存在将其 API 扩展到支持 subnetpool 的对象类型。

rbac-address-group 扩展的存在将其 API 扩展到支持 address-group 的对象类型。

rbac-bgpvpn 扩展的存在将其 API 扩展到支持 bgpvpn 的对象类型。

GET
/v2.0/rbac-policies/{rbac_policy_id}

显示 RBAC 策略详细信息

显示给定 RBAC 策略的详细信息。

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

Error response codes: 401, 404

请求

名称

入参

类型

描述

rbac_policy_id

路径

字符串

RBAC 策略的 ID。

响应参数

名称

入参

类型

描述

target_tenant

body

字符串

将强制执行 RBAC 策略的租户 ID。

tenant_id

body

字符串

拥有资源的项目的 ID。

object_type

body

字符串

RBAC 策略影响的对象类型。类型包括 qos-policynetworksecurity-groupaddress-scopesubnetpooladdress-group

object_id

body

字符串

object_type 资源的 ID。networkobject_type 返回网络 ID,qos-policyobject_type 返回 QoS 策略 ID,security-groupobject_type 返回安全组 ID,address-scopeobject_type 返回地址范围 ID,subnetpoolobject_type 返回子网池 ID,address-groupobject_type 返回地址组 ID。

动作

body

字符串

RBAC 策略的操作,为 access_as_externalaccess_as_shared

project_id

body

字符串

项目的 ID。

id

body

字符串

RBAC 策略的 ID。

响应示例

{
   "rbac_policy": {
      "target_tenant": "*",
      "tenant_id": "3de27ce0a2a54cc6ae06dc62dd0ec832",
      "object_type": "network",
      "object_id": "1f32f072-4d17-4811-b619-3623d018bd40",
      "action": "access_as_external",
      "project_id": "3de27ce0a2a54cc6ae06dc62dd0ec832",
      "id": "6d4c666e-1aad-465e-b670-4d112b760137"
   }
}
PUT
/v2.0/rbac-policies/{rbac_policy_id}

更新 RBAC 策略

更新给定租户的 RBAC 策略。

正常响应代码:200

错误响应代码:400、401、403、404

请求

名称

入参

类型

描述

rbac_policy_id

路径

字符串

RBAC 策略的 ID。

target_tenant

body

字符串

将强制执行 RBAC 策略的租户 ID。请注意,Neutron 不执行任何类型的验证,以确保提供的值实际上是现有项目的 ID。例如,如果此处提供了项目的名称,Neutron API 将接受它,但创建的 RBAC 规则将无法按预期工作。

请求示例

{
   "rbac_policy": {
      "target_tenant": "*"
   }
}

响应参数

名称

入参

类型

描述

target_tenant

body

字符串

将强制执行 RBAC 策略的租户 ID。

tenant_id

body

字符串

拥有资源的项目的 ID。

object_type

body

字符串

RBAC 策略影响的对象类型。类型包括 qos-policynetworksecurity-groupaddress-scopesubnetpooladdress-group

object_id

body

字符串

object_type 资源的 ID。networkobject_type 返回网络 ID,qos-policyobject_type 返回 QoS 策略 ID,security-groupobject_type 返回安全组 ID,address-scopeobject_type 返回地址范围 ID,subnetpoolobject_type 返回子网池 ID,address-groupobject_type 返回地址组 ID。

动作

body

字符串

RBAC 策略的操作,为 access_as_externalaccess_as_shared

project_id

body

字符串

项目的 ID。

id

body

字符串

RBAC 策略的 ID。

响应示例

{
   "rbac_policy": {
      "target_tenant": "*",
      "tenant_id": "3de27ce0a2a54cc6ae06dc62dd0ec832",
      "object_type": "network",
      "object_id": "1f32f072-4d17-4811-b619-3623d018bd40",
      "action": "access_as_external",
      "project_id": "3de27ce0a2a54cc6ae06dc62dd0ec832",
      "id": "6d4c666e-1aad-465e-b670-4d112b760137"
   }
}
DELETE
/v2.0/rbac-policies/{rbac_policy_id}

删除 RBAC 策略

删除 RBAC 策略。

正常响应代码:204

错误响应代码:401, 404, 409

请求

名称

入参

类型

描述

rbac_policy_id

路径

字符串

RBAC 策略的 ID。

响应

There is no body content for the response of a successful DELETE request.

GET
/v2.0/rbac-policies

列出 RBAC 策略

列出属于给定租户的 RBAC 策略。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

Error response codes: 401

请求

名称

入参

类型

描述

target_tenant (可选)

查询

字符串

按将强制执行 RBAC 策略的租户 ID 过滤 RBAC 策略列表结果。

tenant_id (可选)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

object_type (可选)

查询

字符串

按 RBAC 策略影响的对象类型过滤 RBAC 策略列表结果。类型包括 qos-policynetworksecurity-groupaddress-scopesubnetpooladdress-groupbgpvpn

object_id (可选)

查询

字符串

object_type 资源的 ID 过滤 RBAC 策略列表结果。networkobject_type 返回网络 ID,qos-policyobject_type 返回 QoS 策略 ID,security-groupobject_type 返回安全组 ID,address-scopeobject_type 返回地址范围 ID,subnetpoolobject_type 返回子网池 ID,address-groupobject_type 返回地址组 ID,bgpvpnobject_type 返回 bgpvpn ID。

action(可选)

查询

字符串

按 RBAC 策略的操作过滤 RBAC 策略列表结果,为 access_as_externalaccess_as_shared

project_id (可选)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

id (可选)

查询

字符串

Filter the list result by the ID of the resource.

sort_dir (可选)

查询

字符串

Sort direction. A valid value is asc (ascending) or desc (descending). You can specify multiple pairs of sort key and sort direction query parameters.

sort_key (可选)

查询

字符串

按 RBAC 策略属性排序。您可以指定多个排序键和排序方向查询参数对。排序键限于

  • 动作

  • id

  • object_id

  • target_tenant

  • tenant_id

  • project_id

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

target_tenant

body

字符串

将强制执行 RBAC 策略的租户 ID。

tenant_id

body

字符串

拥有资源的项目的 ID。

object_type

body

字符串

RBAC 策略影响的对象类型。类型包括 qos-policynetworksecurity-groupaddress-scopesubnetpooladdress-group

object_id

body

字符串

object_type 资源的 ID。networkobject_type 返回网络 ID,qos-policyobject_type 返回 QoS 策略 ID,security-groupobject_type 返回安全组 ID,address-scopeobject_type 返回地址范围 ID,subnetpoolobject_type 返回子网池 ID,address-groupobject_type 返回地址组 ID。

动作

body

字符串

RBAC 策略的操作,为 access_as_externalaccess_as_shared

project_id

body

字符串

项目的 ID。

id

body

字符串

RBAC 策略的 ID。

响应示例

{
   "rbac_policies": [
      {
         "target_tenant": "*",
         "tenant_id": "3de27ce0a2a54cc6ae06dc62dd0ec832",
         "object_type": "network",
         "object_id": "1f32f072-4d17-4811-b619-3623d018bd40",
         "action": "access_as_external",
         "project_id": "3de27ce0a2a54cc6ae06dc62dd0ec832",
         "id":"6d4c666e-1aad-465e-b670-4d112b760137"
      }
   ]
}
POST
/v2.0/rbac-policies

创建 RBAC 策略

为给定租户创建 RBAC 策略。

正常响应代码:201

错误响应代码:400, 401

请求

名称

入参

类型

描述

target_tenant

body

字符串

将强制执行 RBAC 策略的租户 ID。请注意,Neutron 不执行任何类型的验证,以确保提供的值实际上是现有项目的 ID。例如,如果此处提供了项目的名称,Neutron API 将接受它,但创建的 RBAC 规则将无法按预期工作。

object_type

body

字符串

RBAC 策略影响的对象类型。类型包括 qos-policynetworksecurity-groupaddress-scopesubnetpooladdress-group

object_id

body

字符串

object_type 资源的 ID。networkobject_type 返回网络 ID,qos-policyobject_type 返回 QoS 策略 ID,security-groupobject_type 返回安全组 ID,address-scopeobject_type 返回地址范围 ID,subnetpoolobject_type 返回子网池 ID,address-groupobject_type 返回地址组 ID。

动作

body

字符串

RBAC 策略的操作,为 access_as_externalaccess_as_shared

请求示例

{
   "rbac_policy": {
      "action": "access_as_shared",
      "object_type": "network",
      "target_tenant": "0670b690f27e47a58b6a479d26004715",
      "object_id": "1f32f072-4d17-4811-b619-3623d018bd40"
   }
}

响应参数

名称

入参

类型

描述

target_tenant

body

字符串

将强制执行 RBAC 策略的租户 ID。

tenant_id

body

字符串

拥有资源的项目的 ID。

object_type

body

字符串

RBAC 策略影响的对象类型。类型包括 qos-policynetworksecurity-groupaddress-scopesubnetpooladdress-group

object_id

body

字符串

object_type 资源的 ID。networkobject_type 返回网络 ID,qos-policyobject_type 返回 QoS 策略 ID,security-groupobject_type 返回安全组 ID,address-scopeobject_type 返回地址范围 ID,subnetpoolobject_type 返回子网池 ID,address-groupobject_type 返回地址组 ID。

动作

body

字符串

RBAC 策略的操作,为 access_as_externalaccess_as_shared

project_id

body

字符串

项目的 ID。

id

body

字符串

RBAC 策略的 ID。

响应示例

{
   "rbac_policy": {
      "target_tenant": "0670b690f27e47a58b6a479d26004715",
      "tenant_id": "3de27ce0a2a54cc6ae06dc62dd0ec832",
      "object_type": "network",
      "object_id": "1f32f072-4d17-4811-b619-3623d018bd40",
      "action": "access_as_shared",
      "project_id": "3de27ce0a2a54cc6ae06dc62dd0ec832",
      "id": "2cf7523a-93b5-4e69-9360-6c6bf986bb7c"
   }
}

安全组规则 (security-group-rules)

列出、创建、显示详细信息和删除安全组规则。

资源时间戳

The standard-attr-timestamp extension adds the created_at and updated_at attributes to all resources that have standard attributes.

远程地址组 ID

security-groups-remote-address-group 扩展在安全组规则中添加了一个新字段 remote_address_group_id

属于项目默认安全组

此只读标志确定安全组规则是否属于项目默认安全组。这是服务器设置的合成字段。

GET
/v2.0/security-group-rules

列出安全组规则

列出项目可以访问的所有 OpenStack Networking 安全组规则的摘要。

列表提供每个安全组规则的 ID。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

Error response codes: 401

请求

名称

入参

类型

描述

remote_group_id (可选)

查询

字符串

按远程组 ID 过滤安全组规则列表结果,该 ID 与此安全组规则关联。

direction (可选)

查询

字符串

按安全组规则应用的顺序过滤安全组规则列表结果,为 ingressegress

protocol (Optional)

查询

字符串

按 IP 协议过滤安全组规则列表结果。

ethertype (可选)

查询

字符串

按网络流量的以太网类型过滤安全组规则列表结果。值必须是 IPv4IPv6

port_range_max (可选)

查询

整数

按安全组规则匹配的端口范围中的最大端口号过滤安全组规则列表结果。

security_group_id (可选)

查询

字符串

按与此安全组规则关联的安全组 ID 过滤安全组规则列表结果。

tenant_id (可选)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

project_id (可选)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

port_range_min (可选)

查询

整数

按安全组规则匹配的端口范围中的最小端口号过滤安全组规则列表结果。

remote_ip_prefix (可选)

查询

字符串

按此安全组规则匹配的远程 IP 前缀过滤列表结果。

revision_number (Optional)

查询

整数

Filter the list result by the revision number of the resource.

id (可选)

查询

字符串

Filter the list result by the ID of the resource.

description (可选)

查询

字符串

Filter the list result by the human-readable description of the resource.

sort_dir (可选)

查询

字符串

Sort direction. A valid value is asc (ascending) or desc (descending). You can specify multiple pairs of sort key and sort direction query parameters.

sort_key (可选)

查询

字符串

按安全组规则属性排序。您可以指定多个排序键和排序方向查询参数对。排序键限于

  • direction

  • ethertype

  • id

  • port_range_max

  • port_range_min

  • 协议

  • remote_group_id

  • remote_ip_prefix

  • security_group_id

  • tenant_id

  • project_id

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

security_group_rules

body

数组

一个 security_group_rule 对象列表。有关详细信息,请参阅 安全组规则

remote_group_id

body

字符串

与此安全组规则关联的远程组 UUID。您可以在请求正文中指定 remote_group_idremote_ip_prefix 属性。

remote_address_group_id

body

字符串

与此安全组规则关联的远程地址组 UUID。

direction

body

字符串

入站或出站,这是应用安全组规则的方向。

协议

body

字符串

IP 协议可以用字符串、整数或 null 来表示。有效的字符串或整数值包括 any0ah51dccp33egp8esp50gre47icmp1icmpv658igmp2ipip4ipv6-encap41ipv6-frag44ipv6-icmp58ipv6-nonxt59ipv6-opts60ipv6-route43ospf89pgm113rsvp46sctp132tcp6udp17udplite136vrrp112。此外,介于 [0-255] 之间的任何整数值也有效。字符串 any (或整数 0) 表示 所有 IP 协议。有关支持的字符串的最新列表,请参阅 neutron_lib.constants 中的常量。

ethertype

body

字符串

必须是 IPv4 或 IPv6,并且 CIDR 表示的地址必须与入口或出口规则匹配。

port_range_max

body

整数

安全组规则匹配的范围内的最大端口号。如果协议是 TCP、UDP、DCCP、SCTP 或 UDP-Lite,此值必须大于或等于 port_range_min 属性值。如果协议是 ICMP,此值必须是 ICMP 代码。

security_group_id

body

字符串

与此安全组规则关联的安全组 ID。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

port_range_min

body

整数

安全组规则匹配的范围内的最小端口号。如果协议是 TCP、UDP、DCCP、SCTP 或 UDP-Lite,此值必须小于或等于 port_range_max 属性值。如果协议是 ICMP,此值必须是 ICMP 类型。

remote_ip_prefix

body

字符串

此安全组规则匹配的远程 IP 前缀。

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

revision_number

body

整数

The revision number of the resource.

id

body

字符串

安全组规则的 ID。

description

body

字符串

A human-readable description for the resource.

belongs_to_default_sg

body

布尔值

指示安全组规则是否属于项目的默认安全组。

响应示例

{
    "security_group_rules": [
        {
            "direction": "egress",
            "ethertype": "IPv6",
            "id": "3c0e45ff-adaf-4124-b083-bf390e5482ff",
            "port_range_max": null,
            "port_range_min": null,
            "protocol": null,
            "remote_group_id": null,
            "remote_address_group_id": null,
            "remote_ip_prefix": null,
            "security_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5",
            "project_id": "e4f50856753b4dc6afee5fa6b9b6c550",
            "revision_number": 1,
            "created_at": "2018-03-19T19:16:56Z",
            "updated_at": "2018-03-19T19:16:56Z",
            "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550",
            "description": "",
            "belongs_to_default_sg": false
        },
        {
            "direction": "egress",
            "ethertype": "IPv4",
            "id": "93aa42e5-80db-4581-9391-3a608bd0e448",
            "port_range_max": null,
            "port_range_min": null,
            "protocol": null,
            "remote_group_id": null,
            "remote_address_group_id": null,
            "remote_ip_prefix": null,
            "security_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5",
            "project_id": "e4f50856753b4dc6afee5fa6b9b6c550",
            "revision_number": 1,
            "created_at": "2018-03-19T19:16:56Z",
            "updated_at": "2018-03-19T19:16:56Z",
            "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550",
            "description": "",
            "belongs_to_default_sg": false
        },
        {
            "direction": "ingress",
            "ethertype": "IPv6",
            "id": "c0b09f00-1d49-4e64-a0a7-8a186d928138",
            "port_range_max": null,
            "port_range_min": null,
            "protocol": null,
            "remote_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5",
            "remote_address_group_id": null,
            "remote_ip_prefix": null,
            "security_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5",
            "project_id": "e4f50856753b4dc6afee5fa6b9b6c550",
            "revision_number": 2,
            "created_at": "2018-03-19T19:16:56Z",
            "updated_at": "2018-03-19T19:16:56Z",
            "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550",
            "description": "",
            "belongs_to_default_sg": false
        },
        {
            "direction": "ingress",
            "ethertype": "IPv4",
            "id": "f7d45c89-008e-4bab-88ad-d6811724c51c",
            "port_range_max": null,
            "port_range_min": null,
            "protocol": null,
            "remote_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5",
            "remote_address_group_id": null,
            "remote_ip_prefix": null,
            "security_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5",
            "project_id": "e4f50856753b4dc6afee5fa6b9b6c550",
            "revision_number": 1,
            "created_at": "2018-03-19T19:16:56Z",
            "updated_at": "2018-03-19T19:16:56Z",
            "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550",
            "description": "",
            "belongs_to_default_sg": false
        }
    ]
}
POST
/v2.0/security-group-rules

创建安全组规则

创建 OpenStack Networking 安全组规则。

正常响应代码:201

错误响应代码:400、401、404、409

请求

名称

入参

类型

描述

security_group_rule

body

对象

一个 security_group_rule 对象。

remote_group_id (可选)

body

字符串

与此安全组规则关联的远程组 UUID。您可以在请求正文中指定 remote_group_idremote_ip_prefix 属性。

remote_address_group_id (可选)

查询

字符串

从模板创建的安全组规则关联的远程地址组的 UUID。

direction

body

字符串

入站或出站,这是应用安全组规则的方向。

protocol (Optional)

body

字符串

IP 协议可以用字符串、整数或 null 来表示。有效的字符串或整数值包括 any0ah51dccp33egp8esp50gre47icmp1icmpv658igmp2ipip4ipv6-encap41ipv6-frag44ipv6-icmp58ipv6-nonxt59ipv6-opts60ipv6-route43ospf89pgm113rsvp46sctp132tcp6udp17udplite136vrrp112。此外,介于 [0-255] 之间的任何整数值也有效。字符串 any (或整数 0) 表示 所有 IP 协议。有关支持的字符串的最新列表,请参阅 neutron_lib.constants 中的常量。

ethertype (可选)

body

字符串

必须是 IPv4 或 IPv6,并且 CIDR 表示的地址必须与入口或出口规则匹配。

port_range_max (可选)

body

整数

安全组规则匹配的范围内的最大端口号。如果协议是 TCP、UDP、DCCP、SCTP 或 UDP-Lite,此值必须大于或等于 port_range_min 属性值。如果协议是 ICMP,此值必须是 ICMP 代码。

security_group_id

body

字符串

与此安全组规则关联的安全组 ID。

port_range_min (可选)

body

整数

安全组规则匹配的范围内的最小端口号。如果协议是 TCP、UDP、DCCP、SCTP 或 UDP-Lite,此值必须小于或等于 port_range_max 属性值。如果协议是 ICMP,此值必须是 ICMP 类型。

remote_ip_prefix (可选)

body

字符串

此安全组规则匹配的远程 IP 前缀。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

请求示例

{
    "security_group_rule": {
        "direction": "ingress",
        "port_range_min": "80",
        "ethertype": "IPv4",
        "port_range_max": "80",
        "protocol": "tcp",
        "remote_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5",
        "remote_address_group_id": "a9baa1eb-0614-4d68-870e-fec6d8f8c221",
        "security_group_id": "a7734e61-b545-452d-a3cd-0189cbd9747a"
    }
}

响应参数

名称

入参

类型

描述

security_group_rule

body

对象

一个 security_group_rule 对象。

remote_group_id

body

字符串

与此安全组规则关联的远程组 UUID。您可以在请求正文中指定 remote_group_idremote_ip_prefix 属性。

remote_address_group_id

body

字符串

与此安全组规则关联的远程地址组 UUID。

direction

body

字符串

入站或出站,这是应用安全组规则的方向。

协议

body

字符串

IP 协议可以用字符串、整数或 null 来表示。有效的字符串或整数值包括 any0ah51dccp33egp8esp50gre47icmp1icmpv658igmp2ipip4ipv6-encap41ipv6-frag44ipv6-icmp58ipv6-nonxt59ipv6-opts60ipv6-route43ospf89pgm113rsvp46sctp132tcp6udp17udplite136vrrp112。此外,介于 [0-255] 之间的任何整数值也有效。字符串 any (或整数 0) 表示 所有 IP 协议。有关支持的字符串的最新列表,请参阅 neutron_lib.constants 中的常量。

ethertype

body

字符串

必须是 IPv4 或 IPv6,并且 CIDR 表示的地址必须与入口或出口规则匹配。

port_range_max

body

整数

安全组规则匹配的范围内的最大端口号。如果协议是 TCP、UDP、DCCP、SCTP 或 UDP-Lite,此值必须大于或等于 port_range_min 属性值。如果协议是 ICMP,此值必须是 ICMP 代码。

security_group_id

body

字符串

与此安全组规则关联的安全组 ID。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

port_range_min

body

整数

安全组规则匹配的范围内的最小端口号。如果协议是 TCP、UDP、DCCP、SCTP 或 UDP-Lite,此值必须小于或等于 port_range_max 属性值。如果协议是 ICMP,此值必须是 ICMP 类型。

remote_ip_prefix

body

字符串

此安全组规则匹配的远程 IP 前缀。

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

revision_number

body

整数

The revision number of the resource.

id

body

字符串

安全组规则的 ID。

description

body

字符串

A human-readable description for the resource.

belongs_to_default_sg

body

布尔值

指示安全组规则是否属于项目的默认安全组。

响应示例

{
    "security_group_rule": {
        "direction": "ingress",
        "ethertype": "IPv4",
        "id": "2bc0accf-312e-429a-956e-e4407625eb62",
        "port_range_max": 80,
        "port_range_min": 80,
        "protocol": "tcp",
        "remote_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5",
        "remote_address_group_id": "a9baa1eb-0614-4d68-870e-fec6d8f8c221",
        "remote_ip_prefix": null,
        "security_group_id": "a7734e61-b545-452d-a3cd-0189cbd9747a",
        "project_id": "e4f50856753b4dc6afee5fa6b9b6c550",
        "revision_number": 1,
        "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550",
        "created_at": "2018-03-19T19:16:56Z",
        "updated_at": "2018-03-19T19:16:56Z",
        "description": "",
        "belongs_to_default_sg": false
    }
}
POST
/v2.0/security-group-rules

批量创建安全组规则

在单个请求中创建多个 OpenStack Networking 安全组规则。在请求正文中指定一个安全组规则列表。

保证批量操作的原子完成。

正常响应代码:201

错误响应代码:400、401、404、409

请求

名称

入参

类型

描述

security_group_rules

body

数组

一个 security_group_rule 对象列表。有关详细信息,请参阅 安全组规则

remote_group_id (可选)

body

字符串

与此安全组规则关联的远程组 UUID。您可以在请求正文中指定 remote_group_idremote_ip_prefix 属性。

remote_address_group_id (可选)

查询

字符串

从模板创建的安全组规则关联的远程地址组的 UUID。

direction

body

字符串

入站或出站,这是应用安全组规则的方向。

protocol (Optional)

body

字符串

IP 协议可以用字符串、整数或 null 来表示。有效的字符串或整数值包括 any0ah51dccp33egp8esp50gre47icmp1icmpv658igmp2ipip4ipv6-encap41ipv6-frag44ipv6-icmp58ipv6-nonxt59ipv6-opts60ipv6-route43ospf89pgm113rsvp46sctp132tcp6udp17udplite136vrrp112。此外,介于 [0-255] 之间的任何整数值也有效。字符串 any (或整数 0) 表示 所有 IP 协议。有关支持的字符串的最新列表,请参阅 neutron_lib.constants 中的常量。

ethertype (可选)

body

字符串

必须是 IPv4 或 IPv6,并且 CIDR 表示的地址必须与入口或出口规则匹配。

port_range_max (可选)

body

整数

安全组规则匹配的范围内的最大端口号。如果协议是 TCP、UDP、DCCP、SCTP 或 UDP-Lite,此值必须大于或等于 port_range_min 属性值。如果协议是 ICMP,此值必须是 ICMP 代码。

security_group_id

body

字符串

与此安全组规则关联的安全组 ID。

port_range_min (可选)

body

整数

安全组规则匹配的范围内的最小端口号。如果协议是 TCP、UDP、DCCP、SCTP 或 UDP-Lite,此值必须小于或等于 port_range_max 属性值。如果协议是 ICMP,此值必须是 ICMP 类型。

remote_ip_prefix (可选)

body

字符串

此安全组规则匹配的远程 IP 前缀。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

请求示例

{
    "security_group_rules": [
        {
            "direction": "ingress",
            "port_range_min": "80",
            "ethertype": "IPv4",
            "port_range_max": "80",
            "protocol": "tcp",
            "remote_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5",
            "remote_address_group_id": "a9baa1eb-0614-4d68-870e-fec6d8f8c221",
            "security_group_id": "a7734e61-b545-452d-a3cd-0189cbd9747a"
        },
        {
            "direction": "ingress",
            "port_range_min": "443",
            "ethertype": "IPv4",
            "port_range_max": "443",
            "protocol": "tcp",
            "remote_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5",
            "remote_address_group_id": "a9baa1eb-0614-4d68-870e-fec6d8f8c221",
            "security_group_id": "a7734e61-b545-452d-a3cd-0189cbd9747a"
        }
    ]
}

响应参数

名称

入参

类型

描述

security_group_rules

body

数组

一个 security_group_rule 对象列表。有关详细信息,请参阅 安全组规则

remote_group_id

body

字符串

与此安全组规则关联的远程组 UUID。您可以在请求正文中指定 remote_group_idremote_ip_prefix 属性。

remote_address_group_id

body

字符串

与此安全组规则关联的远程地址组 UUID。

direction

body

字符串

入站或出站,这是应用安全组规则的方向。

协议

body

字符串

IP 协议可以用字符串、整数或 null 来表示。有效的字符串或整数值包括 any0ah51dccp33egp8esp50gre47icmp1icmpv658igmp2ipip4ipv6-encap41ipv6-frag44ipv6-icmp58ipv6-nonxt59ipv6-opts60ipv6-route43ospf89pgm113rsvp46sctp132tcp6udp17udplite136vrrp112。此外,介于 [0-255] 之间的任何整数值也有效。字符串 any (或整数 0) 表示 所有 IP 协议。有关支持的字符串的最新列表,请参阅 neutron_lib.constants 中的常量。

ethertype

body

字符串

必须是 IPv4 或 IPv6,并且 CIDR 表示的地址必须与入口或出口规则匹配。

port_range_max

body

整数

安全组规则匹配的范围内的最大端口号。如果协议是 TCP、UDP、DCCP、SCTP 或 UDP-Lite,此值必须大于或等于 port_range_min 属性值。如果协议是 ICMP,此值必须是 ICMP 代码。

security_group_id

body

字符串

与此安全组规则关联的安全组 ID。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

port_range_min

body

整数

安全组规则匹配的范围内的最小端口号。如果协议是 TCP、UDP、DCCP、SCTP 或 UDP-Lite,此值必须小于或等于 port_range_max 属性值。如果协议是 ICMP,此值必须是 ICMP 类型。

remote_ip_prefix

body

字符串

此安全组规则匹配的远程 IP 前缀。

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

revision_number

body

整数

The revision number of the resource.

id

body

字符串

安全组规则的 ID。

description

body

字符串

A human-readable description for the resource.

belongs_to_default_sg

body

布尔值

指示安全组规则是否属于项目的默认安全组。

响应示例

{
    "security_group_rules": [
        {
            "direction": "ingress",
            "ethertype": "IPv4",
            "id": "2bc0accf-312e-429a-956e-e4407625eb62",
            "port_range_max": 80,
            "port_range_min": 80,
            "protocol": "tcp",
            "remote_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5",
            "remote_ip_prefix": null,
            "security_group_id": "a7734e61-b545-452d-a3cd-0189cbd9747a",
            "project_id": "e4f50856753b4dc6afee5fa6b9b6c550",
            "revision_number": 1,
            "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550",
            "created_at": "2018-03-19T19:16:56Z",
            "updated_at": "2018-03-19T19:16:56Z",
            "description": "",
            "belongs_to_default_sg": false
        },
        {
            "direction": "ingress",
            "ethertype": "IPv4",
            "id": "4d4a5704-749a-4525-958e-93844d1dd9a4",
            "port_range_max": 443,
            "port_range_min": 443,
            "protocol": "tcp",
            "remote_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5",
            "remote_ip_prefix": null,
            "security_group_id": "a7734e61-b545-452d-a3cd-0189cbd9747a",
            "project_id": "e4f50856753b4dc6afee5fa6b9b6c550",
            "revision_number": 1,
            "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550",
            "created_at": "2018-03-19T19:16:56Z",
            "updated_at": "2018-03-19T19:16:56Z",
            "description": "",
            "belongs_to_default_sg": false
        }
    ]
}
GET
/v2.0/security-group-rules/{security_group_rule_id}

显示安全组规则

显示安全组规则的详细信息。

响应正文包含有关安全组规则的以下信息

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

Error response codes: 401, 404

请求

名称

入参

类型

描述

security_group_rule_id

路径

字符串

安全组规则的 ID。

verbose (可选)

查询

布尔值

显示详细信息。

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

security_group_rule

body

对象

一个 security_group_rule 对象。

remote_group_id

body

字符串

与此安全组规则关联的远程组 UUID。您可以在请求正文中指定 remote_group_idremote_ip_prefix 属性。

remote_address_group_id

body

字符串

与此安全组规则关联的远程地址组 UUID。

direction

body

字符串

入站或出站,这是应用安全组规则的方向。

协议

body

字符串

IP 协议可以用字符串、整数或 null 来表示。有效的字符串或整数值包括 any0ah51dccp33egp8esp50gre47icmp1icmpv658igmp2ipip4ipv6-encap41ipv6-frag44ipv6-icmp58ipv6-nonxt59ipv6-opts60ipv6-route43ospf89pgm113rsvp46sctp132tcp6udp17udplite136vrrp112。此外,介于 [0-255] 之间的任何整数值也有效。字符串 any (或整数 0) 表示 所有 IP 协议。有关支持的字符串的最新列表,请参阅 neutron_lib.constants 中的常量。

ethertype

body

字符串

必须是 IPv4 或 IPv6,并且 CIDR 表示的地址必须与入口或出口规则匹配。

port_range_max

body

整数

安全组规则匹配的范围内的最大端口号。如果协议是 TCP、UDP、DCCP、SCTP 或 UDP-Lite,此值必须大于或等于 port_range_min 属性值。如果协议是 ICMP,此值必须是 ICMP 代码。

security_group_id

body

字符串

与此安全组规则关联的安全组 ID。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

port_range_min

body

整数

安全组规则匹配的范围内的最小端口号。如果协议是 TCP、UDP、DCCP、SCTP 或 UDP-Lite,此值必须小于或等于 port_range_max 属性值。如果协议是 ICMP,此值必须是 ICMP 类型。

remote_ip_prefix

body

字符串

此安全组规则匹配的远程 IP 前缀。

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

revision_number

body

整数

The revision number of the resource.

id

body

字符串

安全组规则的 ID。

description

body

字符串

A human-readable description for the resource.

belongs_to_default_sg

body

布尔值

指示安全组规则是否属于项目的默认安全组。

响应示例

{
    "security_group_rule": {
        "direction": "egress",
        "ethertype": "IPv6",
        "id": "3c0e45ff-adaf-4124-b083-bf390e5482ff",
        "port_range_max": null,
        "port_range_min": null,
        "protocol": null,
        "remote_group_id": null,
        "remote_address_group_id": null,
        "remote_ip_prefix": null,
        "revision_number": 1,
        "created_at": "2018-03-19T19:16:56Z",
        "updated_at": "2018-03-19T19:16:56Z",
        "security_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5",
        "project_id": "e4f50856753b4dc6afee5fa6b9b6c550",
        "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550",
        "belongs_to_default_sg": false
    }
}
DELETE
/v2.0/security-group-rules/{security_group_rule_id}

删除安全组规则

从 OpenStack Networking 安全组中删除一条规则。

正常响应代码:204

错误响应代码:401、404、412

请求

名称

入参

类型

描述

security_group_rule_id

路径

字符串

安全组规则的 ID。

响应

成功的 DELETE 请求不会返回正文内容。

安全组 (security-groups)

列出、创建、显示信息、更新和删除安全组。

资源时间戳

The standard-attr-timestamp extension adds the created_at and updated_at attributes to all resources that have standard attributes.

标签扩展

The standard-attr-tag adds Tag support for resources with standard attributes by adding the tags attribute allowing consumers to associate tags with resources.

有状态安全组扩展 (stateful-security-group)

有状态安全组扩展 (stateful-security-group) 向安全组添加了 stateful 字段,允许用户为 ports 配置有状态或无状态安全组。

无状态安全组会绕过底层防火墙中的连接跟踪,可能提供性能和简洁性方面的优势。另一方面,使用无状态安全组会增加规则定义的复杂性:用户现在必须为双向连接的两个方向明确定义规则,因此例如需要定义两条规则来允许 TCP 流:一条用于发送到端口的数据包,另一条用于接收到端口的数据包。

现有的安全组都将被视为有状态。当安全组没有关联的端口时,允许更新 stateful 属性。

无论为无状态安全组定义的规则如何,以下协议都应该可以正常工作:ARP、DHCP、IPv6 SLAAC / DHCPv6 无状态地址配置、IPv6 路由器和邻居发现。

注意:元数据服务默认未启用。如果您的工作负载需要元数据进行配置,请确保创建安全组规则以允许来自元数据服务 IP 地址/端口对的 HTTP 响应。

共享过滤扩展

security-groups-shared-filtering 扩展向安全组添加了 shared 字段,并允许用户根据 shared 字段过滤安全组。

GET
/v2.0/security-groups

列出安全组

列出项目有权访问的 OpenStack Networking 安全组。

响应是一个 security_group 对象数组,其中包含一个 security_group_rules 对象列表。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

Error response codes: 401

请求

名称

入参

类型

描述

id (可选)

查询

字符串

Filter the list result by the ID of the resource.

tenant_id (可选)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

project_id (可选)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

revision_number (Optional)

查询

整数

Filter the list result by the revision number of the resource.

name (可选)

查询

字符串

Filter the list result by the human-readable name of the resource.

description (可选)

查询

字符串

Filter the list result by the human-readable description of the resource.

sort_dir (可选)

查询

字符串

Sort direction. A valid value is asc (ascending) or desc (descending). You can specify multiple pairs of sort key and sort direction query parameters.

sort_key (可选)

查询

字符串

按安全组属性排序。您可以指定多个排序键和排序方向查询参数。排序键限于

  • id

  • name

  • tenant_id

  • project_id

shared (Optional)

查询

布尔值

根据安全组是否共享给请求者项目来过滤安全组列表结果。

tags (可选)

查询

字符串

A list of tags to filter the list result by. Resources that match all tags in this list will be returned. Tags in query must be separated by comma.

tags-any (Optional)

查询

字符串

A list of tags to filter the list result by. Resources that match any tag in this list will be returned. Tags in query must be separated by comma.

not-tags (Optional)

查询

字符串

A list of tags to filter the list result by. Resources that match all tags in this list will be excluded. Tags in query must be separated by comma.

not-tags-any (Optional)

查询

字符串

A list of tags to filter the list result by. Resources that match any tag in this list will be excluded. Tags in query must be separated by comma.

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

security_groups

body

数组

security_group 对象列表。

id

body

字符串

安全组的 ID。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

revision_number

body

整数

The revision number of the resource.

name

body

字符串

Human-readable name of the resource.

description

body

字符串

A human-readable description for the resource.

security_group_rules

body

数组

一个 security_group_rule 对象列表。有关详细信息,请参阅 安全组规则

tags

body

数组

The list of tags on the resource.

stateful (可选)

body

布尔值

指示安全组是有状态还是无状态。

shared

body

布尔值

指示此安全组是否共享给请求者项目。

响应示例

{
    "security_groups": [
        {
            "description": "default",
            "id": "85cc3048-abc3-43cc-89b3-377341426ac5",
            "name": "default",
            "security_group_rules": [
                {
                    "direction": "egress",
                    "ethertype": "IPv6",
                    "id": "3c0e45ff-adaf-4124-b083-bf390e5482ff",
                    "port_range_max": null,
                    "port_range_min": null,
                    "protocol": null,
                    "remote_group_id": null,
                    "remote_ip_prefix": null,
                    "security_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5",
                    "project_id": "e4f50856753b4dc6afee5fa6b9b6c550",
                    "revision_number": 1,
                    "tags": ["tag1,tag2"],
                    "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550",
                    "created_at": "2018-03-19T19:16:56Z",
                    "updated_at": "2018-03-19T19:16:56Z",
                    "description": "",
                    "belongs_to_default_sg": false
                },
                {
                    "direction": "egress",
                    "ethertype": "IPv4",
                    "id": "93aa42e5-80db-4581-9391-3a608bd0e448",
                    "port_range_max": null,
                    "port_range_min": null,
                    "protocol": null,
                    "remote_group_id": null,
                    "remote_ip_prefix": null,
                    "security_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5",
                    "project_id": "e4f50856753b4dc6afee5fa6b9b6c550",
                    "revision_number": 2,
                    "tags": ["tag1,tag2"],
                    "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550",
                    "created_at": "2018-03-19T19:16:56Z",
                    "updated_at": "2018-03-19T19:16:56Z",
                    "description": "",
                    "belongs_to_default_sg": false
                },
                {
                    "direction": "ingress",
                    "ethertype": "IPv6",
                    "id": "c0b09f00-1d49-4e64-a0a7-8a186d928138",
                    "port_range_max": null,
                    "port_range_min": null,
                    "protocol": null,
                    "remote_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5",
                    "remote_ip_prefix": null,
                    "security_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5",
                    "project_id": "e4f50856753b4dc6afee5fa6b9b6c550",
                    "revision_number": 1,
                    "tags": ["tag1,tag2"],
                    "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550",
                    "created_at": "2018-03-19T19:16:56Z",
                    "updated_at": "2018-03-19T19:16:56Z",
                    "description": "",
                    "belongs_to_default_sg": false
                },
                {
                    "direction": "ingress",
                    "ethertype": "IPv4",
                    "id": "f7d45c89-008e-4bab-88ad-d6811724c51c",
                    "port_range_max": null,
                    "port_range_min": null,
                    "protocol": null,
                    "remote_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5",
                    "remote_ip_prefix": null,
                    "security_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5",
                    "project_id": "e4f50856753b4dc6afee5fa6b9b6c550",
                    "revision_number": 1,
                    "tags": ["tag1,tag2"],
                    "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550",
                    "created_at": "2018-03-19T19:16:56Z",
                    "updated_at": "2018-03-19T19:16:56Z",
                    "description": "",
                    "belongs_to_default_sg": false
                }
            ],
            "project_id": "e4f50856753b4dc6afee5fa6b9b6c550",
            "revision_number": 8,
            "created_at": "2018-03-19T19:16:56Z",
            "updated_at": "2018-03-19T19:16:56Z",
            "tags": ["tag1,tag2"],
            "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550",
            "stateful": true,
            "shared": false
        }
    ]
}
POST
/v2.0/security-groups

创建安全组

创建 OpenStack Networking 安全组。

此操作会为主机和 IPv6 以太类型创建具有默认安全组规则的安全组。

正常响应代码:201

错误响应代码:400、401、409

请求

名称

入参

类型

描述

security_group

body

对象

一个 security_group 对象。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

name

body

字符串

Human-readable name of the resource.

stateful (可选)

body

布尔值

指示安全组是有状态还是无状态。

请求示例

{
    "security_group": {
        "name": "new-webservers",
        "description": "security group for webservers",
        "stateful": true
    }
}

响应参数

名称

入参

类型

描述

security_group

body

对象

一个 security_group 对象。

id

body

字符串

安全组的 ID。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

revision_number

body

整数

The revision number of the resource.

name

body

字符串

Human-readable name of the resource.

description

body

字符串

A human-readable description for the resource.

security_group_rules

body

数组

一个 security_group_rule 对象列表。有关详细信息,请参阅 安全组规则

tags

body

数组

The list of tags on the resource.

stateful (可选)

body

布尔值

指示安全组是有状态还是无状态。

shared

body

布尔值

指示此安全组是否共享给请求者项目。

响应示例

{
    "security_group": {
        "description": "security group for webservers",
        "id": "2076db17-a522-4506-91de-c6dd8e837028",
        "name": "new-webservers",
        "security_group_rules": [
            {
                "direction": "egress",
                "ethertype": "IPv4",
                "id": "38ce2d8e-e8f1-48bd-83c2-d33cb9f50c3d",
                "port_range_max": null,
                "port_range_min": null,
                "protocol": null,
                "remote_group_id": null,
                "remote_ip_prefix": null,
                "security_group_id": "2076db17-a522-4506-91de-c6dd8e837028",
                "project_id": "e4f50856753b4dc6afee5fa6b9b6c550",
                "created_at": "2018-03-19T19:16:56Z",
                "updated_at": "2018-03-19T19:16:56Z",
                "revision_number": 1,
                "revisio[n_number": 1,
                "tags": ["tag1,tag2"],
                "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550",
                "description": "",
                "belongs_to_default_sg": false
            },
            {
                "direction": "egress",
                "ethertype": "IPv6",
                "id": "565b9502-12de-4ffd-91e9-68885cff6ae1",
                "port_range_max": null,
                "port_range_min": null,
                "protocol": null,
                "remote_group_id": null,
                "remote_ip_prefix": null,
                "security_group_id": "2076db17-a522-4506-91de-c6dd8e837028",
                "project_id": "e4f50856753b4dc6afee5fa6b9b6c550",
                "created_at": "2018-03-19T19:16:56Z",
                "updated_at": "2018-03-19T19:16:56Z",
                "revision_number": 1,
                "tags": ["tag1,tag2"],
                "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550",
                "description": "",
                "belongs_to_default_sg": false
            }
        ],
        "project_id": "e4f50856753b4dc6afee5fa6b9b6c550",
        "created_at": "2018-03-19T19:16:56Z",
        "updated_at": "2018-03-19T19:16:56Z",
        "revision_number": 1,
        "tags": ["tag1,tag2"],
        "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550",
        "stateful": true,
        "shared": false
    }
}
GET
/v2.0/security-groups/{security_group_id}

显示安全组

显示安全组的详细信息。

响应中包含相关的安全组规则。

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

Error response codes: 401, 404

请求

名称

入参

类型

描述

security_group_id

路径

字符串

安全组的 ID。

verbose (可选)

查询

布尔值

显示详细信息。

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

请求示例

GET /v2.0/security-groups/85cc3048-abc3-43cc-89b3-377341426ac5
Accept: application/json

响应参数

名称

入参

类型

描述

security_group

body

对象

一个 security_group 对象。

id

body

字符串

安全组的 ID。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

revision_number

body

整数

The revision number of the resource.

name

body

字符串

Human-readable name of the resource.

description

body

字符串

A human-readable description for the resource.

security_group_rules

body

数组

一个 security_group_rule 对象列表。有关详细信息,请参阅 安全组规则

tags

body

数组

The list of tags on the resource.

stateful (可选)

body

布尔值

指示安全组是有状态还是无状态。

shared

body

布尔值

指示此安全组是否共享给请求者项目。

响应示例

{
    "security_group": {
        "description": "default",
        "id": "85cc3048-abc3-43cc-89b3-377341426ac5",
        "name": "default",
        "security_group_rules": [
            {
                "direction": "egress",
                "ethertype": "IPv6",
                "id": "3c0e45ff-adaf-4124-b083-bf390e5482ff",
                "port_range_max": null,
                "port_range_min": null,
                "protocol": null,
                "remote_group_id": null,
                "remote_ip_prefix": null,
                "security_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5",
                "project_id": "e4f50856753b4dc6afee5fa6b9b6c550",
                "revision_number": 1,
                "tags": ["tag1,tag2"],
                "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550",
                "created_at": "2018-03-19T19:16:56Z",
                "updated_at": "2018-03-19T19:16:56Z",
                "description": "",
                "belongs_to_default_sg": false
            },
            {
                "direction": "egress",
                "ethertype": "IPv4",
                "id": "93aa42e5-80db-4581-9391-3a608bd0e448",
                "port_range_max": null,
                "port_range_min": null,
                "protocol": null,
                "remote_group_id": null,
                "remote_ip_prefix": null,
                "security_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5",
                "project_id": "e4f50856753b4dc6afee5fa6b9b6c550",
                "revision_number": 2,
                "tags": ["tag1,tag2"],
                "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550",
                "created_at": "2018-03-19T19:16:56Z",
                "updated_at": "2018-03-19T19:16:56Z",
                "description": "",
                "belongs_to_default_sg": false
            },
            {
                "direction": "ingress",
                "ethertype": "IPv6",
                "id": "c0b09f00-1d49-4e64-a0a7-8a186d928138",
                "port_range_max": null,
                "port_range_min": null,
                "protocol": null,
                "remote_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5",
                "remote_ip_prefix": null,
                "security_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5",
                "project_id": "e4f50856753b4dc6afee5fa6b9b6c550",
                "revision_number": 1,
                "tags": ["tag1,tag2"],
                "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550",
                "created_at": "2018-03-19T19:16:56Z",
                "updated_at": "2018-03-19T19:16:56Z",
                "description": "",
                "belongs_to_default_sg": false
            },
            {
                "direction": "ingress",
                "ethertype": "IPv4",
                "id": "f7d45c89-008e-4bab-88ad-d6811724c51c",
                "port_range_max": null,
                "port_range_min": null,
                "protocol": null,
                "remote_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5",
                "remote_ip_prefix": null,
                "security_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5",
                "project_id": "e4f50856753b4dc6afee5fa6b9b6c550",
                "revision_number": 1,
                "tags": ["tag1,tag2"],
                "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550",
                "created_at": "2018-03-19T19:16:56Z",
                "updated_at": "2018-03-19T19:16:56Z",
                "description": "",
                "belongs_to_default_sg": false
            }
        ],
        "project_id": "e4f50856753b4dc6afee5fa6b9b6c550",
        "created_at": "2018-03-19T19:16:56Z",
        "updated_at": "2018-03-19T19:16:56Z",
        "revision_number": 4,
        "tags": ["tag1,tag2"],
        "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550",
        "stateful": true,
        "shared": false
    }
}
PUT
/v2.0/security-groups/{security_group_id}

更新安全组

更新安全组。

正常响应代码:200

Error response codes: 400, 401, 403, 404, 412

请求

名称

入参

类型

描述

security_group_id

路径

字符串

安全组的 ID。

security_group

body

对象

一个 security_group 对象。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

name

body

字符串

Human-readable name of the resource.

请求示例

{
    "security_group": {
        "name": "mysecgroup",
        "description": "my security group",
        "stateful": true
    }
}

响应参数

名称

入参

类型

描述

security_group

body

对象

一个 security_group 对象。

id

body

字符串

安全组的 ID。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

revision_number

body

整数

The revision number of the resource.

name

body

字符串

Human-readable name of the resource.

description

body

字符串

A human-readable description for the resource.

security_group_rules

body

数组

一个 security_group_rule 对象列表。有关详细信息,请参阅 安全组规则

tags

body

数组

The list of tags on the resource.

stateful (可选)

body

布尔值

指示安全组是有状态还是无状态。

shared

body

布尔值

指示此安全组是否共享给请求者项目。

响应示例

{
    "security_group": {
        "security_group_rules": [],
        "project_id": "a52cdb9cc7854a39a23d3af73a40899e",
        "revision_number": 4,
        "tenant_id": "a52cdb9cc7854a39a23d3af73a40899e",
        "created_at": "2018-03-19T19:16:56Z",
        "updated_at": "2018-03-19T19:16:56Z",
        "id": "01fbade5-b664-42f6-83ae-4e214f4263fa",
        "name": "mysecgroup",
        "description": "my security group",
        "tags": ["tag1,tag2"],
        "stateful": true,
        "shared": false,
        "belongs_to_default_sg": false
    }
}
DELETE
/v2.0/security-groups/{security_group_id}

删除安全组

删除 OpenStack Networking 安全组。

此操作删除 OpenStack Networking 安全组及其关联的安全组规则,前提是端口未与安全组关联。如果端口与安全组关联,则返回 409 (冲突)。

此操作不需要请求正文。此操作不返回响应正文。

正常响应代码:204

Error response codes: 401, 404, 409, 412

请求

名称

入参

类型

描述

security_group_id

路径

字符串

安全组的 ID。

请求示例

DELETE /v2.0/security-groups/e470bdfc-4869-459b-a561-cb3377efae59
Content-Type: application/json
Accept: application/json

响应

There is no body content for the response of a successful DELETE request.

安全组默认规则 (security-group-default-rules)

列出、创建、显示信息以及删除安全组默认规则。

GET
/v2.0/default-security-group-rules

列出安全组默认规则

列出用于每个新创建的安全组的所有 OpenStack Networking 安全组规则的摘要。

列表提供每个安全组默认规则的 ID。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

Error response codes: 401

请求

名称

入参

类型

描述

remote_group_id (可选)

查询

字符串

通过与此安全组规则关联的远程组 ID 来过滤安全组规则列表结果。此字段可以包含安全组的 UUID 或特殊词 PARENT,这意味着在从该模板创建的实际规则中,所有者安全组的 UUID 将被放入 remote_group_id

direction (可选)

查询

字符串

按安全组规则应用的顺序过滤安全组规则列表结果,为 ingressegress

protocol (Optional)

查询

字符串

按 IP 协议过滤安全组规则列表结果。

ethertype (可选)

查询

字符串

按网络流量的以太网类型过滤安全组规则列表结果。值必须是 IPv4IPv6

port_range_max (可选)

查询

整数

按安全组规则匹配的端口范围中的最大端口号过滤安全组规则列表结果。

port_range_min (可选)

查询

整数

按安全组规则匹配的端口范围中的最小端口号过滤安全组规则列表结果。

remote_ip_prefix (可选)

查询

字符串

按此安全组规则匹配的远程 IP 前缀过滤列表结果。

remote_address_group_id (可选)

查询

字符串

通过与此安全组规则关联的远程地址组 ID 来过滤安全组规则列表结果。

used_in_default_sg (可选)

body

布尔值

按应在为每个新项目自动创建的默认安全组中使用的安全组规则模板进行过滤。

used_in_non_default_sg (可选)

body

布尔值

按应在项目用户创建的自定义安全组中使用的安全组规则模板进行过滤。

id (可选)

查询

字符串

Filter the list result by the ID of the resource.

description (可选)

查询

字符串

Filter the list result by the human-readable description of the resource.

sort_dir (可选)

查询

字符串

Sort direction. A valid value is asc (ascending) or desc (descending). You can specify multiple pairs of sort key and sort direction query parameters.

sort_key (可选)

查询

字符串

按安全组规则属性排序。您可以指定多个排序键和排序方向查询参数对。排序键限于

  • direction

  • ethertype

  • id

  • port_range_max

  • port_range_min

  • 协议

  • remote_group_id

  • remote_ip_prefix

  • security_group_id

  • tenant_id

  • project_id

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

security_group_rules

body

数组

一个 security_group_rule 对象列表。有关详细信息,请参阅 安全组规则

remote_group_id (可选)

查询

字符串

通过与此安全组规则关联的远程组 ID 来过滤安全组规则列表结果。此字段可以包含安全组的 UUID 或特殊词 PARENT,这意味着在从该模板创建的实际规则中,所有者安全组的 UUID 将被放入 remote_group_id

direction

body

字符串

入站或出站,这是应用安全组规则的方向。

协议

body

字符串

IP 协议可以用字符串、整数或 null 来表示。有效的字符串或整数值包括 any0ah51dccp33egp8esp50gre47icmp1icmpv658igmp2ipip4ipv6-encap41ipv6-frag44ipv6-icmp58ipv6-nonxt59ipv6-opts60ipv6-route43ospf89pgm113rsvp46sctp132tcp6udp17udplite136vrrp112。此外,介于 [0-255] 之间的任何整数值也有效。字符串 any (或整数 0) 表示 所有 IP 协议。有关支持的字符串的最新列表,请参阅 neutron_lib.constants 中的常量。

ethertype

body

字符串

必须是 IPv4 或 IPv6,并且 CIDR 表示的地址必须与入口或出口规则匹配。

port_range_max

body

整数

安全组规则匹配的范围内的最大端口号。如果协议是 TCP、UDP、DCCP、SCTP 或 UDP-Lite,此值必须大于或等于 port_range_min 属性值。如果协议是 ICMP,此值必须是 ICMP 代码。

port_range_min

body

整数

安全组规则匹配的范围内的最小端口号。如果协议是 TCP、UDP、DCCP、SCTP 或 UDP-Lite,此值必须小于或等于 port_range_max 属性值。如果协议是 ICMP,此值必须是 ICMP 类型。

remote_ip_prefix

body

字符串

此安全组规则匹配的远程 IP 前缀。

remote_address_group_id

body

字符串

与此安全组规则关联的远程地址组 UUID。

used_in_default_sg (可选)

body

布尔值

此安全组规则模板是否应在为每个新项目自动创建的默认安全组中使用。默认值为 False

used_in_non_default_sg (可选)

body

布尔值

此安全组规则模板是否应在项目用户创建的自定义安全组中使用。默认值为 True

id

body

字符串

安全组默认规则的 ID。

description

body

字符串

A human-readable description for the resource.

响应示例

{
    "default_security_group_rules": [
        {
            "direction": "egress",
            "ethertype": "IPv6",
            "id": "3c0e45ff-adaf-4124-b083-bf390e5482ff",
            "port_range_max": null,
            "port_range_min": null,
            "protocol": null,
            "remote_group_id": null,
            "remote_ip_prefix": null,
            "remote_address_group_id": null,
            "used_in_default_sg": true,
            "used_in_default_non_sg": true,
            "description": ""
        },
        {
            "direction": "egress",
            "ethertype": "IPv4",
            "id": "93aa42e5-80db-4581-9391-3a608bd0e448",
            "port_range_max": null,
            "port_range_min": null,
            "protocol": null,
            "remote_group_id": null,
            "remote_ip_prefix": null,
            "remote_address_group_id": null,
            "used_in_default_sg": true,
            "used_in_default_non_sg": true,
            "description": ""
        },
        {
            "direction": "ingress",
            "ethertype": "IPv6",
            "id": "333e64bf-cab0-47ed-8303-fca711b74433",
            "port_range_max": null,
            "port_range_min": null,
            "protocol": null,
            "remote_group_id": "PARENT",
            "remote_ip_prefix": null,
            "remote_address_group_id": null,
            "used_in_default_sg": true,
            "used_in_default_non_sg": true,
            "description": ""
        },
        {
            "direction": "ingress",
            "ethertype": "IPv4",
            "id": "91eff177-4e20-4407-a7ac-843c625316e3",
            "port_range_max": null,
            "port_range_min": null,
            "protocol": null,
            "remote_group_id": "PARENT",
            "remote_ip_prefix": null,
            "remote_address_group_id": null,
            "used_in_default_sg": true,
            "used_in_default_non_sg": true,
            "description": ""
        },
        {
            "direction": "ingress",
            "ethertype": "IPv6",
            "id": "d41fc3d7-46bc-405e-a4f6-029cbb63c5c4",
            "port_range_max": 22,
            "port_range_min": 22,
            "protocol": null,
            "remote_group_id": null,
            "remote_ip_prefix": null,
            "remote_address_group_id": null,
            "used_in_default_sg": false,
            "used_in_default_non_sg": true,
            "description": "Allow SSH connections over IPv6"
        },
        {
            "direction": "ingress",
            "ethertype": "IPv4",
            "id": "03315f60-52dd-40e0-a769-04360cb3e6c1",
            "port_range_max": 22,
            "port_range_min": 22,
            "protocol": null,
            "remote_group_id": null,
            "remote_ip_prefix": null,
            "remote_address_group_id": null,
            "used_in_default_sg": false,
            "used_in_default_non_sg": true,
            "description": "Allow SSH connections over IPv4"
        }
    ]
}
POST
/v2.0/default-security-group-rules

创建安全组默认规则

创建 Openstack Networking 安全组规则模板。

正常响应代码:201

错误响应代码:400、401、404、409

请求

名称

入参

类型

描述

default_security_group_rule

body

对象

一个 default_security_group_rule 对象。

remote_group_id (可选)

body

字符串

与此安全组规则关联的远程组 UUID。您可以在请求正文中指定 remote_group_idremote_ip_prefix 属性。

direction

body

字符串

入站或出站,这是应用安全组规则的方向。

protocol (Optional)

body

字符串

IP 协议可以用字符串、整数或 null 来表示。有效的字符串或整数值包括 any0ah51dccp33egp8esp50gre47icmp1icmpv658igmp2ipip4ipv6-encap41ipv6-frag44ipv6-icmp58ipv6-nonxt59ipv6-opts60ipv6-route43ospf89pgm113rsvp46sctp132tcp6udp17udplite136vrrp112。此外,介于 [0-255] 之间的任何整数值也有效。字符串 any (或整数 0) 表示 所有 IP 协议。有关支持的字符串的最新列表,请参阅 neutron_lib.constants 中的常量。

ethertype (可选)

body

字符串

必须是 IPv4 或 IPv6,并且 CIDR 表示的地址必须与入口或出口规则匹配。

port_range_max (可选)

body

整数

安全组规则匹配的范围内的最大端口号。如果协议是 TCP、UDP、DCCP、SCTP 或 UDP-Lite,此值必须大于或等于 port_range_min 属性值。如果协议是 ICMP,此值必须是 ICMP 代码。

port_range_min (可选)

body

整数

安全组规则匹配的范围内的最小端口号。如果协议是 TCP、UDP、DCCP、SCTP 或 UDP-Lite,此值必须小于或等于 port_range_max 属性值。如果协议是 ICMP,此值必须是 ICMP 类型。

remote_ip_prefix (可选)

body

字符串

此安全组规则匹配的远程 IP 前缀。

remote_address_group_id (可选)

查询

字符串

从模板创建的安全组规则关联的远程地址组的 UUID。

used_in_default_sg (可选)

body

布尔值

此安全组规则模板是否应在为每个新项目自动创建的默认安全组中使用。默认值为 False

used_in_non_default_sg (可选)

body

布尔值

此安全组规则模板是否应在项目用户创建的自定义安全组中使用。默认值为 True

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

请求示例

{
    "default_security_group_rule": {
        "direction": "ingress",
        "port_range_min": "80",
        "ethertype": "IPv4",
        "port_range_max": "80",
        "protocol": "tcp"
    }
}

响应参数

名称

入参

类型

描述

remote_group_id

body

字符串

与此安全组规则关联的远程组 UUID。您可以在请求正文中指定 remote_group_idremote_ip_prefix 属性。

direction

body

字符串

入站或出站,这是应用安全组规则的方向。

协议

body

字符串

IP 协议可以用字符串、整数或 null 来表示。有效的字符串或整数值包括 any0ah51dccp33egp8esp50gre47icmp1icmpv658igmp2ipip4ipv6-encap41ipv6-frag44ipv6-icmp58ipv6-nonxt59ipv6-opts60ipv6-route43ospf89pgm113rsvp46sctp132tcp6udp17udplite136vrrp112。此外,介于 [0-255] 之间的任何整数值也有效。字符串 any (或整数 0) 表示 所有 IP 协议。有关支持的字符串的最新列表,请参阅 neutron_lib.constants 中的常量。

ethertype

body

字符串

必须是 IPv4 或 IPv6,并且 CIDR 表示的地址必须与入口或出口规则匹配。

port_range_max

body

整数

安全组规则匹配的范围内的最大端口号。如果协议是 TCP、UDP、DCCP、SCTP 或 UDP-Lite,此值必须大于或等于 port_range_min 属性值。如果协议是 ICMP,此值必须是 ICMP 代码。

port_range_min

body

整数

安全组规则匹配的范围内的最小端口号。如果协议是 TCP、UDP、DCCP、SCTP 或 UDP-Lite,此值必须小于或等于 port_range_max 属性值。如果协议是 ICMP,此值必须是 ICMP 类型。

remote_ip_prefix

body

字符串

此安全组规则匹配的远程 IP 前缀。

remote_address_group_id

body

字符串

与此安全组规则关联的远程地址组 UUID。

used_in_default_sg (可选)

body

布尔值

此安全组规则模板是否应在为每个新项目自动创建的默认安全组中使用。默认值为 False

used_in_non_default_sg (可选)

body

布尔值

此安全组规则模板是否应在项目用户创建的自定义安全组中使用。默认值为 True

id

body

字符串

安全组默认规则的 ID。

description

body

字符串

A human-readable description for the resource.

响应示例

{
    "default_security_group_rule": {
        "direction": "ingress",
        "ethertype": "IPv4",
        "id": "2bc0accf-312e-429a-956e-e4407625eb62",
        "port_range_max": 80,
        "port_range_min": 80,
        "protocol": "tcp",
        "remote_group_id": null,
        "remote_ip_prefix": null,
        "remote_address_group_id": null,
        "used_in_default_sg": false,
        "used_in_non_default_sg": true,
        "description": ""
    }
}

警告

安全组规则模板 API 不会验证 remote address group idremote group ID 等资源的 UUID。此处可以提供任何字符串,但请注意,它将用于为项目创建实际的安全组规则,如果使用了不存在的 security groupremote address group 的 UUID,则在创建安全组时会导致错误。

GET
/v2.0/default-security-group-rules/{default_security_group_rule_id}

显示安全组默认规则

显示安全组默认规则的详细信息。

响应正文包含有关安全组规则的以下信息

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

Error response codes: 401, 404

请求

名称

入参

类型

描述

default_security_group_rule_id

路径

字符串

安全组默认规则的 ID。

verbose (可选)

查询

布尔值

显示详细信息。

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

default_security_group_rule

body

对象

一个 default_security_group_rule 对象。

remote_group_id

body

字符串

与此安全组规则关联的远程组 UUID。您可以在请求正文中指定 remote_group_idremote_ip_prefix 属性。

direction

body

字符串

入站或出站,这是应用安全组规则的方向。

协议

body

字符串

IP 协议可以用字符串、整数或 null 来表示。有效的字符串或整数值包括 any0ah51dccp33egp8esp50gre47icmp1icmpv658igmp2ipip4ipv6-encap41ipv6-frag44ipv6-icmp58ipv6-nonxt59ipv6-opts60ipv6-route43ospf89pgm113rsvp46sctp132tcp6udp17udplite136vrrp112。此外,介于 [0-255] 之间的任何整数值也有效。字符串 any (或整数 0) 表示 所有 IP 协议。有关支持的字符串的最新列表,请参阅 neutron_lib.constants 中的常量。

ethertype

body

字符串

必须是 IPv4 或 IPv6,并且 CIDR 表示的地址必须与入口或出口规则匹配。

port_range_max

body

整数

安全组规则匹配的范围内的最大端口号。如果协议是 TCP、UDP、DCCP、SCTP 或 UDP-Lite,此值必须大于或等于 port_range_min 属性值。如果协议是 ICMP,此值必须是 ICMP 代码。

port_range_min

body

整数

安全组规则匹配的范围内的最小端口号。如果协议是 TCP、UDP、DCCP、SCTP 或 UDP-Lite,此值必须小于或等于 port_range_max 属性值。如果协议是 ICMP,此值必须是 ICMP 类型。

remote_ip_prefix

body

字符串

此安全组规则匹配的远程 IP 前缀。

remote_address_group_id

body

字符串

与此安全组规则关联的远程地址组 UUID。

used_in_default_sg (可选)

body

布尔值

此安全组规则模板是否应在为每个新项目自动创建的默认安全组中使用。默认值为 False

used_in_non_default_sg (可选)

body

布尔值

此安全组规则模板是否应在项目用户创建的自定义安全组中使用。默认值为 True

id

body

字符串

安全组默认规则的 ID。

description

body

字符串

A human-readable description for the resource.

响应示例

{
    "default_security_group_rule": {
        "direction": "ingress",
        "ethertype": "IPv4",
        "id": "2bc0accf-312e-429a-956e-e4407625eb62",
        "port_range_max": 80,
        "port_range_min": 80,
        "protocol": "tcp",
        "remote_group_id": null,
        "remote_ip_prefix": null,
        "remote_address_group_id": null,
        "used_in_default_sg": false,
        "used_in_non_default_sg": true,
        "description": ""
    }
}
DELETE
/v2.0/default-security-group-rules/{default_security_group_rule_id}

删除安全组默认规则

删除 OpenStack Networking 安全组规则模板。

正常响应代码:204

错误响应代码:401、404、412

请求

名称

入参

类型

描述

default_security_group_rule_id

路径

字符串

安全组默认规则的 ID。

响应

成功的 DELETE 请求不会返回正文内容。

VPNaaS 2.0 (vpn, vpnservices, ikepolicies, ipsecpolicies, endpoint-groups, ipsec-site-connections)

虚拟专用网络即服务 (VPNaaS) 扩展使 OpenStack 项目能够通过公共电信基础设施扩展专用网络。

VPNaaS 扩展的初始实现提供了

  • 连接两个专用网络的站点到站点 VPN。

  • 每个项目的多个 VPN 连接。

  • 支持 IKEv1 策略,具有 3des、aes-128、aes-256 或 aes-192 加密。

  • 支持 IPsec 策略,具有 3des、aes-128、aes-192 或 aes-256 加密、sha1 认证、ESP、AH 或 AH-ESP 转换协议,以及隧道或传输模式封装。

  • 具有 hold、clear、restart、disabled 或 restart-by-peer 操作的 Dead Peer Detection (DPD)。

此扩展引入了以下资源

  • service。将 VPN 与特定子网和路由器关联的父对象。

  • ikepolicy。互联网密钥交换 (IKE) 策略,用于标识 VPN 连接的第一阶段和第二阶段协商期间要使用的认证和加密算法。

  • ipsecpolicy。IP 安全策略,用于指定已建立 VPN 连接要使用的认证和加密算法以及封装模式。

  • ipsec-site-connection。站点到站点 IPsec 连接的详细信息,包括对端 CIDR、MTU、认证模式、对端地址、DPD 设置和状态。

VPN 端点组

endpoint-groups 扩展支持定义一个或多个特定类型的端点,并可用于为 IPsec 连接指定本地和对端端点。

VPN Flavor

vpn-flavors 扩展向 vpnservices 资源添加了 flavor_id 属性。在创建 vpnservice 时,如果传入了 flavor_id,则它将用于查找将处理新创建的 vpnservice 的驱动程序提供商。

GET
/v2.0/vpn/ikepolicies

列出 IKE 策略

列出 IKE 策略。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

错误响应代码:401, 403

请求

名称

入参

类型

描述

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

ikepolicies

body

数组

ikepolicy 对象列表。

name (可选)

body

字符串

资源的易读名称。默认情况下为空字符串。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

auth_algorithm (可选)

body

字符串

认证哈希算法。有效值为 sha1sha256sha384sha512aes-xcbcaes-cmac。默认值为 sha1

encryption_algorithm (可选)

body

字符串

加密算法。有效值为 3desaes-128aes-192aes-256aes-128-ctraes-192-ctraes-256-ctr。AES CCM 和 GCM 模式的附加值定义为(例如 aes-256-ccm-16aes-256-gcm-16),适用于密钥长度为 128、192、256 位和 ICV 长度为 8、12、16 字节的所有组合。默认值为 aes-128

pfs (可选)

body

字符串

Perfect Forward Secrecy (PFS)。有效值为 Group2Group5Group14Group31。默认值为 Group5

value (可选)

body

整数

生命周期值,为正整数。生命周期包括单位和整数值。您可以省略生命周期的单位或值部分。默认单位为秒,默认值为 3600。

phase1_negotiation_mode (可选)

body

字符串

IKE 模式。有效值为 main,这是默认值。

units (可选)

body

字符串

安全关联生命周期的单位。生命周期包括单位和整数值。您可以省略生命周期的单位或值部分。默认单位为秒,默认值为 3600。

lifetime (可选)

body

对象

安全关联的生命周期。生命周期包括单位和整数值。您可以省略生命周期的单位或值部分。默认单位为秒,默认值为 3600。

id

body

字符串

IKE 策略的 ID。

ike_version (可选)

body

字符串

IKE 版本。有效值为 v1v2。默认值为 v1

响应示例

{
    "ikepolicies": [
        {
            "name": "ikepolicy1",
            "project_id": "ccb81365fe36411a9011e90491fe1330",
            "tenant_id": "ccb81365fe36411a9011e90491fe1330",
            "auth_algorithm": "sha1",
            "encryption_algorithm": "aes-256",
            "pfs": "group5",
            "phase1_negotiation_mode": "main",
            "lifetime": {
                "units": "seconds",
                "value": 3600
            },
            "ike_version": "v1",
            "id": "5522aff7-1b3c-48dd-9c3c-b50f016b73db",
            "description": ""
        }
    ]
}
POST
/v2.0/vpn/ikepolicies

创建 IKE 策略

创建 IKE 策略。

IKE 策略用于 VPN 连接的第一阶段和第二阶段协商。您可以为连接指定认证和加密算法。

正常响应代码:201

错误响应代码:400, 401

请求

名称

入参

类型

描述

ikepolicy

body

对象

一个 ikepolicy 对象。

name (可选)

body

字符串

资源的易读名称。默认情况下为空字符串。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

auth_algorithm (可选)

body

字符串

认证哈希算法。有效值为 sha1sha256sha384sha512aes-xcbcaes-cmac。默认值为 sha1

encryption_algorithm (可选)

body

字符串

加密算法。有效值为 3desaes-128aes-192aes-256aes-128-ctraes-192-ctraes-256-ctr。AES CCM 和 GCM 模式的附加值定义为(例如 aes-256-ccm-16aes-256-gcm-16),适用于密钥长度为 128、192、256 位和 ICV 长度为 8、12、16 字节的所有组合。默认值为 aes-128

pfs (可选)

body

字符串

Perfect Forward Secrecy (PFS)。有效值为 Group2Group5Group14Group31。默认值为 Group5

value (可选)

body

整数

生命周期值,为正整数。生命周期包括单位和整数值。您可以省略生命周期的单位或值部分。默认单位为秒,默认值为 3600。

phase1_negotiation_mode (可选)

body

字符串

IKE 模式。有效值为 main,这是默认值。

units (可选)

body

字符串

安全关联生命周期的单位。生命周期包括单位和整数值。您可以省略生命周期的单位或值部分。默认单位为秒,默认值为 3600。

lifetime (可选)

body

对象

安全关联的生命周期。生命周期包括单位和整数值。您可以省略生命周期的单位或值部分。默认单位为秒,默认值为 3600。

ike_version (可选)

body

字符串

IKE 版本。有效值为 v1v2。默认值为 v1

请求示例

{
    "ikepolicy": {
        "phase1_negotiation_mode": "main",
        "auth_algorithm": "sha1",
        "encryption_algorithm": "aes-128",
        "pfs": "group5",
        "lifetime": {
            "units": "seconds",
            "value": 7200
        },
        "ike_version": "v1",
        "name": "ikepolicy1"
    }
}

响应参数

名称

入参

类型

描述

ikepolicies

body

数组

ikepolicy 对象列表。

ikepolicy

body

对象

一个 ikepolicy 对象。

name (可选)

body

字符串

资源的易读名称。默认情况下为空字符串。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

auth_algorithm (可选)

body

字符串

认证哈希算法。有效值为 sha1sha256sha384sha512aes-xcbcaes-cmac。默认值为 sha1

encryption_algorithm (可选)

body

字符串

加密算法。有效值为 3desaes-128aes-192aes-256aes-128-ctraes-192-ctraes-256-ctr。AES CCM 和 GCM 模式的附加值定义为(例如 aes-256-ccm-16aes-256-gcm-16),适用于密钥长度为 128、192、256 位和 ICV 长度为 8、12、16 字节的所有组合。默认值为 aes-128

pfs (可选)

body

字符串

Perfect Forward Secrecy (PFS)。有效值为 Group2Group5Group14Group31。默认值为 Group5

value (可选)

body

整数

生命周期值,为正整数。生命周期包括单位和整数值。您可以省略生命周期的单位或值部分。默认单位为秒,默认值为 3600。

phase1_negotiation_mode (可选)

body

字符串

IKE 模式。有效值为 main,这是默认值。

units (可选)

body

字符串

安全关联生命周期的单位。生命周期包括单位和整数值。您可以省略生命周期的单位或值部分。默认单位为秒,默认值为 3600。

lifetime (可选)

body

对象

安全关联的生命周期。生命周期包括单位和整数值。您可以省略生命周期的单位或值部分。默认单位为秒,默认值为 3600。

id

body

字符串

IKE 策略的 ID。

ike_version (可选)

body

字符串

IKE 版本。有效值为 v1v2。默认值为 v1

响应示例

{
    "ikepolicy": {
        "name": "ikepolicy1",
        "project_id": "ccb81365fe36411a9011e90491fe1330",
        "tenant_id": "ccb81365fe36411a9011e90491fe1330",
        "auth_algorithm": "sha1",
        "encryption_algorithm": "aes-128",
        "pfs": "group5",
        "phase1_negotiation_mode": "main",
        "lifetime": {
            "units": "seconds",
            "value": 7200
        },
        "ike_version": "v1",
        "id": "5522aff7-1b3c-48dd-9c3c-b50f016b73db",
        "description": ""
    }
}
GET
/v2.0/vpn/ikepolicies/{ikepolicy_id}

显示 IKE 策略详情

显示 IKE 策略的详细信息。

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

错误响应代码:401、403、404

请求

名称

入参

类型

描述

ikepolicy_id

路径

字符串

IKE 策略的 ID。

响应参数

名称

入参

类型

描述

ikepolicies

body

数组

ikepolicy 对象列表。

ikepolicy

body

对象

一个 ikepolicy 对象。

name (可选)

body

字符串

资源的易读名称。默认情况下为空字符串。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

auth_algorithm (可选)

body

字符串

认证哈希算法。有效值为 sha1sha256sha384sha512aes-xcbcaes-cmac。默认值为 sha1

encryption_algorithm (可选)

body

字符串

加密算法。有效值为 3desaes-128aes-192aes-256aes-128-ctraes-192-ctraes-256-ctr。AES CCM 和 GCM 模式的附加值定义为(例如 aes-256-ccm-16aes-256-gcm-16),适用于密钥长度为 128、192、256 位和 ICV 长度为 8、12、16 字节的所有组合。默认值为 aes-128

pfs (可选)

body

字符串

Perfect Forward Secrecy (PFS)。有效值为 Group2Group5Group14Group31。默认值为 Group5

value (可选)

body

整数

生命周期值,为正整数。生命周期包括单位和整数值。您可以省略生命周期的单位或值部分。默认单位为秒,默认值为 3600。

phase1_negotiation_mode (可选)

body

字符串

IKE 模式。有效值为 main,这是默认值。

units (可选)

body

字符串

安全关联生命周期的单位。生命周期包括单位和整数值。您可以省略生命周期的单位或值部分。默认单位为秒,默认值为 3600。

lifetime (可选)

body

对象

安全关联的生命周期。生命周期包括单位和整数值。您可以省略生命周期的单位或值部分。默认单位为秒,默认值为 3600。

id

body

字符串

IKE 策略的 ID。

ike_version (可选)

body

字符串

IKE 版本。有效值为 v1v2。默认值为 v1

响应示例

{
    "ikepolicy": {
        "name": "ikepolicy1",
        "project_id": "ccb81365fe36411a9011e90491fe1330",
        "tenant_id": "ccb81365fe36411a9011e90491fe1330",
        "auth_algorithm": "sha1",
        "encryption_algorithm": "aes-256",
        "pfs": "group5",
        "phase1_negotiation_mode": "main",
        "lifetime": {
            "units": "seconds",
            "value": 3600
        },
        "ike_version": "v1",
        "id": "5522aff7-1b3c-48dd-9c3c-b50f016b73db",
        "description": ""
    }
}
PUT
/v2.0/vpn/ikepolicies/{ikepolicy_id}

更新 IKE 策略

在 IKE 策略中更新策略设置。

正常响应代码:200

错误响应代码:400、401、404

请求

名称

入参

类型

描述

ikepolicy_id

路径

字符串

IKE 策略的 ID。

ikepolicy

body

对象

一个 ikepolicy 对象。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

auth_algorithm (可选)

body

字符串

认证哈希算法。有效值为 sha1sha256sha384sha512aes-xcbcaes-cmac。默认值为 sha1

name (可选)

body

字符串

资源的易读名称。默认情况下为空字符串。

encryption_algorithm (可选)

body

字符串

加密算法。有效值为 3desaes-128aes-192aes-256aes-128-ctraes-192-ctraes-256-ctr。AES CCM 和 GCM 模式的附加值定义为(例如 aes-256-ccm-16aes-256-gcm-16),适用于密钥长度为 128、192、256 位和 ICV 长度为 8、12、16 字节的所有组合。默认值为 aes-128

pfs (可选)

body

字符串

Perfect Forward Secrecy (PFS)。有效值为 Group2Group5Group14Group31。默认值为 Group5

value (可选)

body

整数

生命周期值,为正整数。生命周期包括单位和整数值。您可以省略生命周期的单位或值部分。默认单位为秒,默认值为 3600。

phase1_negotiation_mode (可选)

body

字符串

IKE 模式。有效值为 main,这是默认值。

units (可选)

body

字符串

安全关联生命周期的单位。生命周期包括单位和整数值。您可以省略生命周期的单位或值部分。默认单位为秒,默认值为 3600。

lifetime (可选)

body

对象

安全关联的生命周期。生命周期包括单位和整数值。您可以省略生命周期的单位或值部分。默认单位为秒,默认值为 3600。

ike_version (可选)

body

字符串

IKE 版本。有效值为 v1v2。默认值为 v1

请求示例

{
    "ikepolicy": {
        "encryption_algorithm": "aes-256"
    }
}

响应参数

名称

入参

类型

描述

ikepolicies

body

数组

ikepolicy 对象列表。

ikepolicy

body

对象

一个 ikepolicy 对象。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

auth_algorithm (可选)

body

字符串

认证哈希算法。有效值为 sha1sha256sha384sha512aes-xcbcaes-cmac。默认值为 sha1

name (可选)

body

字符串

资源的易读名称。默认情况下为空字符串。

encryption_algorithm (可选)

body

字符串

加密算法。有效值为 3desaes-128aes-192aes-256aes-128-ctraes-192-ctraes-256-ctr。AES CCM 和 GCM 模式的附加值定义为(例如 aes-256-ccm-16aes-256-gcm-16),适用于密钥长度为 128、192、256 位和 ICV 长度为 8、12、16 字节的所有组合。默认值为 aes-128

pfs (可选)

body

字符串

Perfect Forward Secrecy (PFS)。有效值为 Group2Group5Group14Group31。默认值为 Group5

value (可选)

body

整数

生命周期值,为正整数。生命周期包括单位和整数值。您可以省略生命周期的单位或值部分。默认单位为秒,默认值为 3600。

phase1_negotiation_mode (可选)

body

字符串

IKE 模式。有效值为 main,这是默认值。

units (可选)

body

字符串

安全关联生命周期的单位。生命周期包括单位和整数值。您可以省略生命周期的单位或值部分。默认单位为秒,默认值为 3600。

lifetime (可选)

body

对象

安全关联的生命周期。生命周期包括单位和整数值。您可以省略生命周期的单位或值部分。默认单位为秒,默认值为 3600。

id

body

字符串

IKE 策略的 ID。

ike_version (可选)

body

字符串

IKE 版本。有效值为 v1v2。默认值为 v1

响应示例

{
    "ikepolicy": {
        "name": "ikepolicy1",
        "project_id": "ccb81365fe36411a9011e90491fe1330",
        "tenant_id": "ccb81365fe36411a9011e90491fe1330",
        "auth_algorithm": "sha1",
        "encryption_algorithm": "aes-256",
        "pfs": "group5",
        "phase1_negotiation_mode": "main",
        "lifetime": {
            "units": "seconds",
            "value": 3600
        },
        "ike_version": "v1",
        "id": "5522aff7-1b3c-48dd-9c3c-b50f016b73db",
        "description": ""
    }
}
DELETE
/v2.0/vpn/ikepolicies/{ikepolicy_id}

移除 IKE 策略

移除 IKE 策略。

正常响应代码:204

错误响应代码:401, 404, 409

请求

名称

入参

类型

描述

ikepolicy_id

路径

字符串

IKE 策略的 ID。

响应

There is no body content for the response of a successful DELETE request.

GET
/v2.0/vpn/ipsecpolicies

列出 IPsec 策略

列出所有 IPsec 策略。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

错误响应代码:401, 403

请求

名称

入参

类型

描述

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

ipsecpolicies

body

数组

ipsecpolicy 对象列表。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

auth_algorithm (可选)

body

字符串

认证哈希算法。有效值为 sha1sha256sha384sha512aes-xcbcaes-cmac。默认值为 sha1

encapsulation_mode (可选)

body

字符串

封装模式。有效值为 tunneltransport。默认值为 tunnel

encryption_algorithm (可选)

body

字符串

加密算法。有效值为 3desaes-128aes-192aes-256aes-128-ctraes-192-ctraes-256-ctr。AES CCM 和 GCM 模式的附加值定义为(例如 aes-256-ccm-16aes-256-gcm-16),适用于密钥长度为 128、192、256 位和 ICV 长度为 8、12、16 字节的所有组合。默认值为 aes-128

pfs (可选)

body

字符串

Perfect Forward Secrecy (PFS)。有效值为 Group2Group5Group14Group31。默认值为 Group5

value (可选)

body

整数

生命周期值,为正整数。生命周期包括单位和整数值。您可以省略生命周期的单位或值部分。默认单位为秒,默认值为 3600。

transform_protocol (可选)

body

字符串

转换协议。有效值为 ESPAHAH-ESP。默认值为 ESP

units (可选)

body

字符串

安全关联生命周期的单位。生命周期包括单位和整数值。您可以省略生命周期的单位或值部分。默认单位为秒,默认值为 3600。

lifetime (可选)

body

对象

安全关联的生命周期。生命周期包括单位和整数值。您可以省略生命周期的单位或值部分。默认单位为秒,默认值为 3600。

id

body

字符串

IPsec 策略的 ID。

name (可选)

body

字符串

资源的易读名称。默认情况下为空字符串。

响应示例

{
    "ipsecpolicies": [
        {
            "name": "ipsecpolicy1",
            "transform_protocol": "esp",
            "auth_algorithm": "sha1",
            "encapsulation_mode": "tunnel",
            "encryption_algorithm": "aes-128",
            "pfs": "group14",
            "project_id": "ccb81365fe36411a9011e90491fe1330",
            "tenant_id": "ccb81365fe36411a9011e90491fe1330",
            "lifetime": {
                "units": "seconds",
                "value": 3600
            },
            "id": "5291b189-fd84-46e5-84bd-78f40c05d69c",
            "description": ""
        }
    ]
}
POST
/v2.0/vpn/ipsecpolicies

创建 IPsec 策略

创建 IP 安全 (IPsec) 策略。

IPsec 策略指定已建立 VPN 连接要使用的认证和加密算法以及封装模式。

正常响应代码:201

错误响应代码:400, 401

请求

名称

入参

类型

描述

ipsecpolicy

body

对象

一个 ipsecpolicy 对象。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

auth_algorithm (可选)

body

字符串

认证哈希算法。有效值为 sha1sha256sha384sha512aes-xcbcaes-cmac。默认值为 sha1

encapsulation_mode (可选)

body

字符串

封装模式。有效值为 tunneltransport。默认值为 tunnel

encryption_algorithm (可选)

body

字符串

加密算法。有效值为 3desaes-128aes-192aes-256aes-128-ctraes-192-ctraes-256-ctr。AES CCM 和 GCM 模式的附加值定义为(例如 aes-256-ccm-16aes-256-gcm-16),适用于密钥长度为 128、192、256 位和 ICV 长度为 8、12、16 字节的所有组合。默认值为 aes-128

pfs (可选)

body

字符串

Perfect Forward Secrecy (PFS)。有效值为 Group2Group5Group14Group31。默认值为 Group5

value (可选)

body

整数

生命周期值,为正整数。生命周期包括单位和整数值。您可以省略生命周期的单位或值部分。默认单位为秒,默认值为 3600。

transform_protocol (可选)

body

字符串

转换协议。有效值为 ESPAHAH-ESP。默认值为 ESP

units (可选)

body

字符串

安全关联生命周期的单位。生命周期包括单位和整数值。您可以省略生命周期的单位或值部分。默认单位为秒,默认值为 3600。

lifetime (可选)

body

对象

安全关联的生命周期。生命周期包括单位和整数值。您可以省略生命周期的单位或值部分。默认单位为秒,默认值为 3600。

name (可选)

body

字符串

资源的易读名称。默认情况下为空字符串。

请求示例

{
    "ipsecpolicy": {
        "name": "ipsecpolicy1",
        "transform_protocol": "esp",
        "auth_algorithm": "sha1",
        "encapsulation_mode": "tunnel",
        "encryption_algorithm": "aes-128",
        "pfs": "group5",
        "lifetime": {
            "units": "seconds",
            "value": 7200
        }
    }
}

响应参数

名称

入参

类型

描述

ipsecpolicies

body

数组

ipsecpolicy 对象列表。

ipsecpolicy

body

对象

一个 ipsecpolicy 对象。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

auth_algorithm (可选)

body

字符串

认证哈希算法。有效值为 sha1sha256sha384sha512aes-xcbcaes-cmac。默认值为 sha1

encapsulation_mode (可选)

body

字符串

封装模式。有效值为 tunneltransport。默认值为 tunnel

encryption_algorithm (可选)

body

字符串

加密算法。有效值为 3desaes-128aes-192aes-256aes-128-ctraes-192-ctraes-256-ctr。AES CCM 和 GCM 模式的附加值定义为(例如 aes-256-ccm-16aes-256-gcm-16),适用于密钥长度为 128、192、256 位和 ICV 长度为 8、12、16 字节的所有组合。默认值为 aes-128

pfs (可选)

body

字符串

Perfect Forward Secrecy (PFS)。有效值为 Group2Group5Group14Group31。默认值为 Group5

value (可选)

body

整数

生命周期值,为正整数。生命周期包括单位和整数值。您可以省略生命周期的单位或值部分。默认单位为秒,默认值为 3600。

transform_protocol (可选)

body

字符串

转换协议。有效值为 ESPAHAH-ESP。默认值为 ESP

units (可选)

body

字符串

安全关联生命周期的单位。生命周期包括单位和整数值。您可以省略生命周期的单位或值部分。默认单位为秒,默认值为 3600。

lifetime (可选)

body

对象

安全关联的生命周期。生命周期包括单位和整数值。您可以省略生命周期的单位或值部分。默认单位为秒,默认值为 3600。

id

body

字符串

IPsec 策略的 ID。

name (可选)

body

字符串

资源的易读名称。默认情况下为空字符串。

响应示例

{
    "ipsecpolicy": {
        "name": "ipsecpolicy1",
        "transform_protocol": "esp",
        "auth_algorithm": "sha1",
        "encapsulation_mode": "tunnel",
        "encryption_algorithm": "aes-128",
        "pfs": "group5",
        "project_id": "ccb81365fe36411a9011e90491fe1330",
        "tenant_id": "ccb81365fe36411a9011e90491fe1330",
        "lifetime": {
            "units": "seconds",
            "value": 7200
        },
        "id": "5291b189-fd84-46e5-84bd-78f40c05d69c",
        "description": ""
    }
}
GET
/v2.0/vpn/ipsecpolicies/{ipsecpolicy_id}

显示 IPsec 策略

显示 IPsec 策略的详细信息。

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

错误响应代码:401、403、404

请求

名称

入参

类型

描述

ipsecpolicy_id

路径

字符串

IPsec 策略的 ID。

响应参数

名称

入参

类型

描述

ipsecpolicies

body

数组

ipsecpolicy 对象列表。

ipsecpolicy

body

对象

一个 ipsecpolicy 对象。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

auth_algorithm (可选)

body

字符串

认证哈希算法。有效值为 sha1sha256sha384sha512aes-xcbcaes-cmac。默认值为 sha1

encapsulation_mode (可选)

body

字符串

封装模式。有效值为 tunneltransport。默认值为 tunnel

encryption_algorithm (可选)

body

字符串

加密算法。有效值为 3desaes-128aes-192aes-256aes-128-ctraes-192-ctraes-256-ctr。AES CCM 和 GCM 模式的附加值定义为(例如 aes-256-ccm-16aes-256-gcm-16),适用于密钥长度为 128、192、256 位和 ICV 长度为 8、12、16 字节的所有组合。默认值为 aes-128

pfs (可选)

body

字符串

Perfect Forward Secrecy (PFS)。有效值为 Group2Group5Group14Group31。默认值为 Group5

value (可选)

body

整数

生命周期值,为正整数。生命周期包括单位和整数值。您可以省略生命周期的单位或值部分。默认单位为秒,默认值为 3600。

transform_protocol (可选)

body

字符串

转换协议。有效值为 ESPAHAH-ESP。默认值为 ESP

units (可选)

body

字符串

安全关联生命周期的单位。生命周期包括单位和整数值。您可以省略生命周期的单位或值部分。默认单位为秒,默认值为 3600。

lifetime (可选)

body

对象

安全关联的生命周期。生命周期包括单位和整数值。您可以省略生命周期的单位或值部分。默认单位为秒,默认值为 3600。

id

body

字符串

IPsec 策略的 ID。

name (可选)

body

字符串

资源的易读名称。默认情况下为空字符串。

响应示例

{
    "ipsecpolicy": {
        "name": "ipsecpolicy1",
        "transform_protocol": "esp",
        "auth_algorithm": "sha1",
        "encapsulation_mode": "tunnel",
        "encryption_algorithm": "aes-128",
        "pfs": "group14",
        "project_id": "ccb81365fe36411a9011e90491fe1330",
        "tenant_id": "ccb81365fe36411a9011e90491fe1330",
        "lifetime": {
            "units": "seconds",
            "value": 3600
        },
        "id": "5291b189-fd84-46e5-84bd-78f40c05d69c",
        "description": ""
    }
}
PUT
/v2.0/vpn/ipsecpolicies/{ipsecpolicy_id}

更新 IPsec 策略

在 IPsec 策略中更新策略设置。

正常响应代码:200

错误响应代码:400、401、404

请求

名称

入参

类型

描述

ipsecpolicy_id

路径

字符串

IPsec 策略的 ID。

ipsecpolicy

body

对象

一个 ipsecpolicy 对象。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

transform_protocol (可选)

body

字符串

转换协议。有效值为 ESPAHAH-ESP。默认值为 ESP

auth_algorithm (可选)

body

字符串

认证哈希算法。有效值为 sha1sha256sha384sha512aes-xcbcaes-cmac。默认值为 sha1

encapsulation_mode (可选)

body

字符串

封装模式。有效值为 tunneltransport。默认值为 tunnel

encryption_algorithm (可选)

body

字符串

加密算法。有效值为 3desaes-128aes-192aes-256aes-128-ctraes-192-ctraes-256-ctr。AES CCM 和 GCM 模式的附加值定义为(例如 aes-256-ccm-16aes-256-gcm-16),适用于密钥长度为 128、192、256 位和 ICV 长度为 8、12、16 字节的所有组合。默认值为 aes-128

pfs (可选)

body

字符串

Perfect Forward Secrecy (PFS)。有效值为 Group2Group5Group14Group31。默认值为 Group5

value (可选)

body

整数

生命周期值,为正整数。生命周期包括单位和整数值。您可以省略生命周期的单位或值部分。默认单位为秒,默认值为 3600。

units (可选)

body

字符串

安全关联生命周期的单位。生命周期包括单位和整数值。您可以省略生命周期的单位或值部分。默认单位为秒,默认值为 3600。

lifetime (可选)

body

对象

安全关联的生命周期。生命周期包括单位和整数值。您可以省略生命周期的单位或值部分。默认单位为秒,默认值为 3600。

name (可选)

body

字符串

资源的易读名称。默认情况下为空字符串。

请求示例

{
    "ipsecpolicy": {
        "pfs": "group14"
    }
}

响应参数

名称

入参

类型

描述

ipsecpolicies

body

数组

ipsecpolicy 对象列表。

ipsecpolicy

body

对象

一个 ipsecpolicy 对象。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

auth_algorithm (可选)

body

字符串

认证哈希算法。有效值为 sha1sha256sha384sha512aes-xcbcaes-cmac。默认值为 sha1

encapsulation_mode (可选)

body

字符串

封装模式。有效值为 tunneltransport。默认值为 tunnel

encryption_algorithm (可选)

body

字符串

加密算法。有效值为 3desaes-128aes-192aes-256aes-128-ctraes-192-ctraes-256-ctr。AES CCM 和 GCM 模式的附加值定义为(例如 aes-256-ccm-16aes-256-gcm-16),适用于密钥长度为 128、192、256 位和 ICV 长度为 8、12、16 字节的所有组合。默认值为 aes-128

pfs (可选)

body

字符串

Perfect Forward Secrecy (PFS)。有效值为 Group2Group5Group14Group31。默认值为 Group5

value (可选)

body

整数

生命周期值,为正整数。生命周期包括单位和整数值。您可以省略生命周期的单位或值部分。默认单位为秒,默认值为 3600。

transform_protocol (可选)

body

字符串

转换协议。有效值为 ESPAHAH-ESP。默认值为 ESP

units (可选)

body

字符串

安全关联生命周期的单位。生命周期包括单位和整数值。您可以省略生命周期的单位或值部分。默认单位为秒,默认值为 3600。

lifetime (可选)

body

对象

安全关联的生命周期。生命周期包括单位和整数值。您可以省略生命周期的单位或值部分。默认单位为秒,默认值为 3600。

id

body

字符串

IPsec 策略的 ID。

name (可选)

body

字符串

资源的易读名称。默认情况下为空字符串。

响应示例

{
    "ipsecpolicy": {
        "name": "ipsecpolicy1",
        "transform_protocol": "esp",
        "auth_algorithm": "sha1",
        "encapsulation_mode": "tunnel",
        "encryption_algorithm": "aes-128",
        "pfs": "group14",
        "project_id": "ccb81365fe36411a9011e90491fe1330",
        "tenant_id": "ccb81365fe36411a9011e90491fe1330",
        "lifetime": {
            "units": "seconds",
            "value": 3600
        },
        "id": "5291b189-fd84-46e5-84bd-78f40c05d69c",
        "description": ""
    }
}
DELETE
/v2.0/vpn/ipsecpolicies/{ipsecpolicy_id}

移除 IPsec 策略

移除 IPsec 策略。

正常响应代码:204

错误响应代码:401, 404, 409

请求

名称

入参

类型

描述

ipsecpolicy_id

路径

字符串

IPsec 策略的 ID。

响应

There is no body content for the response of a successful DELETE request.

GET
/v2.0/vpn/ipsec-site-connections

列出 IPsec 连接

列出所有 IPsec 连接。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

错误响应代码:401, 403

请求

名称

入参

类型

描述

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

auth_mode (可选)

body

字符串

认证模式。有效值为 psk,这是默认值。

ikepolicy_id

body

字符串

IKE 策略的 ID。

vpnservice_id

body

字符串

VPN 服务的 ID。

local_ep_group_id (可选)

body

字符串

包含连接本地端专用子网的端点组的 ID。您必须指定此参数以及 peer_ep_group_id 参数,除非在向 VPN 服务提供 peer_cidrssubnet_id 的向后兼容模式下。

peer_address

body

字符串

对端网关公用 IPv4 或 IPv6 地址或 FQDN。

id (可选)

body

字符串

IPsec 站点到站点连接的 ID。

route_mode (可选)

body

字符串

路由模式。有效值为 static,这是默认值。

ipsecpolicy_id

body

字符串

IPsec 策略的 ID。

peer_id

body

字符串

用于认证的对端路由器标识。有效值为 IPv4 地址、IPv6 地址、电子邮件地址、密钥 ID 或 FQDN。通常,此值与 peer_address 值匹配。

status

body

字符串

指示 IPsec 连接当前是否正常运行。值为 ACTIVEDOWNBUILDERRORPENDING_CREATEPENDING_UPDATEPENDING_DELETE

psk

body

字符串

预共享密钥。有效值为任何字符串。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

initiator (可选)

body

字符串

指示 VPN 是否只能响应连接,还是可以响应和发起连接。有效值为 response-onlybi-directional。默认值为 bi-directional

peer_cidrs (已弃用)

body

数组

(已弃用) 形式为 < net_address > / < prefix > 的有效对端专用 CIDR 的唯一列表。

name (可选)

body

字符串

资源的易读名称。默认情况下为空字符串。

admin_state_up

body

布尔值

资源的管理状态,为开启(true)或关闭(false)。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

interval (可选)

body

整数

Dead Peer Detection (DPD) 间隔(以秒为单位)。有效值为正整数。默认值为 30。

mtu

body

整数

The maximum transmission unit (MTU) value to address fragmentation. Minimum value is 68 for IPv4, and 1280 for IPv6.

peer_ep_group_id (可选)

body

字符串

包含连接对端专有 CIDR(形式为 < net_address > / < prefix >)的端点组的 ID。您必须指定此参数以及 local_ep_group_id 参数,除非在向 VPN 服务提供 peer_cidrssubnet_id 的向后兼容模式下。

dpd (可选)

body

对象

一个包含 Dead Peer Detection (DPD) 协议控件的字典。

timeout

body

整数

Dead Peer Detection (DPD) 超时(以秒为单位)。有效值为大于 DPD interval 值 的正整数。默认值为 120。

动作

body

字符串

Dead Peer Detection (DPD) 操作。有效值为 clearholdrestartdisabledrestart-by-peer。默认值为 hold

local_id (可选)

body

字符串

在不同网络实例之间的东-西流量中,用于虚拟路由器以进行流量的 ID,而不是外部 IP 地址。local ID 通常是域名、电子邮件地址等。如果未配置,则外部 IP 地址将用作 ID。

响应示例

{
    "ipsec_site_connections": [
        {
            "status": "PENDING CREATE",
            "psk": "secret",
            "initiator": "bi-directional",
            "name": "vpnconnection1",
            "admin_state_up": true,
            "project_id": "10039663455a446d8ba2cbb058b0f578",
            "tenant_id": "10039663455a446d8ba2cbb058b0f578",
            "auth_mode": "psk",
            "peer_cidrs": [],
            "mtu": 1500,
            "peer_ep_group_id": "9ad5a7e0-6dac-41b4-b20d-a7b8645fddf1",
            "ikepolicy_id": "9b00d6b0-6c93-4ca5-9747-b8ade7bb514f",
            "vpnservice_id": "5c561d9d-eaea-45f6-ae3e-08d1a7080828",
            "dpd": {
                "action": "hold",
                "interval": 30,
                "timeout": 120
            },
            "route_mode": "static",
            "ipsecpolicy_id": "e6e23d0c-9519-4d52-8ea4-5b1f96d857b1",
            "local_ep_group_id": "3e1815dd-e212-43d0-8f13-b494fa553e68",
            "peer_address": "172.24.4.226",
            "peer_id": "172.24.4.226",
            "id": "851f280f-5639-4ea3-81aa-e298525ab74b",
            "description": ""
        }
    ]
}
POST
/v2.0/vpn/ipsec-site-connections

创建 IPsec 连接

为服务创建站点到站点 IPsec 连接。

正常响应代码:201

错误响应代码:400, 401

请求

名称

入参

类型

描述

ipsec_site_connection

body

对象

一个 ipsec_site_connection 对象。

auth_mode (可选)

body

字符串

认证模式。有效值为 psk,这是默认值。

ikepolicy_id (可选)

body

字符串

IKE 策略的 ID。

vpnservice_id (可选)

body

字符串

VPN 服务的 ID。

local_ep_group_id (可选)

body

字符串

包含连接本地端专用子网的端点组的 ID。您必须指定此参数以及 peer_ep_group_id 参数,除非在向 VPN 服务提供 peer_cidrssubnet_id 的向后兼容模式下。

peer_address

body

字符串

对端网关公用 IPv4 或 IPv6 地址或 FQDN。

route_mode (可选)

body

字符串

路由模式。有效值为 static,这是默认值。

ipsecpolicy_id (可选)

body

字符串

IPsec 策略的 ID。

peer_id

body

字符串

用于认证的对端路由器标识。有效值为 IPv4 地址、IPv6 地址、电子邮件地址、密钥 ID 或 FQDN。通常,此值与 peer_address 值匹配。

psk

body

字符串

预共享密钥。有效值为任何字符串。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

initiator (可选)

body

字符串

指示 VPN 是否只能响应连接,还是可以响应和发起连接。有效值为 response-onlybi-directional。默认值为 bi-directional

peer_cidrs (已弃用)

body

数组

(已弃用) 形式为 < net_address > / < prefix > 的有效对端专用 CIDR 的唯一列表。

name (可选)

body

字符串

资源的易读名称。默认情况下为空字符串。

admin_state_up

body

布尔值

资源的管理状态,为开启(true)或关闭(false)。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

interval (可选)

body

整数

Dead Peer Detection (DPD) 间隔(以秒为单位)。有效值为正整数。默认值为 30。

mtu

body

整数

The maximum transmission unit (MTU) value to address fragmentation. Minimum value is 68 for IPv4, and 1280 for IPv6.

peer_ep_group_id (可选)

body

字符串

包含连接对端专有 CIDR(形式为 < net_address > / < prefix >)的端点组的 ID。您必须指定此参数以及 local_ep_group_id 参数,除非在向 VPN 服务提供 peer_cidrssubnet_id 的向后兼容模式下。

dpd (可选)

body

对象

一个包含 Dead Peer Detection (DPD) 协议控件的字典。

timeout

body

整数

Dead Peer Detection (DPD) 超时(以秒为单位)。有效值为大于 DPD interval 值 的正整数。默认值为 120。

动作

body

字符串

Dead Peer Detection (DPD) 操作。有效值为 clearholdrestartdisabledrestart-by-peer。默认值为 hold

local_id (可选)

body

字符串

在不同网络实例之间的东-西流量中,用于虚拟路由器以进行流量的 ID,而不是外部 IP 地址。local ID 通常是域名、电子邮件地址等。如果未配置,则外部 IP 地址将用作 ID。

请求示例

{
    "ipsec_site_connection": {
        "psk": "secret",
        "initiator": "bi-directional",
        "ipsecpolicy_id": "e6e23d0c-9519-4d52-8ea4-5b1f96d857b1",
        "admin_state_up": true,
        "mtu": "1500",
        "peer_ep_group_id": "9ad5a7e0-6dac-41b4-b20d-a7b8645fddf1",
        "ikepolicy_id": "9b00d6b0-6c93-4ca5-9747-b8ade7bb514f",
        "vpnservice_id": "5c561d9d-eaea-45f6-ae3e-08d1a7080828",
        "local_ep_group_id": "3e1815dd-e212-43d0-8f13-b494fa553e68",
        "peer_address": "172.24.4.233",
        "peer_id": "172.24.4.233",
        "name": "vpnconnection1"
    }
}

响应参数

名称

入参

类型

描述

ipsec_site_connection

body

对象

一个 ipsec_site_connection 对象。

auth_mode (可选)

body

字符串

认证模式。有效值为 psk,这是默认值。

ikepolicy_id

body

字符串

IKE 策略的 ID。

vpnservice_id

body

字符串

VPN 服务的 ID。

local_ep_group_id (可选)

body

字符串

包含连接本地端专用子网的端点组的 ID。您必须指定此参数以及 peer_ep_group_id 参数,除非在向 VPN 服务提供 peer_cidrssubnet_id 的向后兼容模式下。

peer_address

body

字符串

对端网关公用 IPv4 或 IPv6 地址或 FQDN。

id (可选)

body

字符串

IPsec 站点到站点连接的 ID。

route_mode (可选)

body

字符串

路由模式。有效值为 static,这是默认值。

ipsecpolicy_id

body

字符串

IPsec 策略的 ID。

peer_id

body

字符串

用于认证的对端路由器标识。有效值为 IPv4 地址、IPv6 地址、电子邮件地址、密钥 ID 或 FQDN。通常,此值与 peer_address 值匹配。

status

body

字符串

指示 IPsec 连接当前是否正常运行。值为 ACTIVEDOWNBUILDERRORPENDING_CREATEPENDING_UPDATEPENDING_DELETE

psk

body

字符串

预共享密钥。有效值为任何字符串。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

initiator (可选)

body

字符串

指示 VPN 是否只能响应连接,还是可以响应和发起连接。有效值为 response-onlybi-directional。默认值为 bi-directional

peer_cidrs (已弃用)

body

数组

(已弃用) 形式为 < net_address > / < prefix > 的有效对端专用 CIDR 的唯一列表。

name (可选)

body

字符串

资源的易读名称。默认情况下为空字符串。

admin_state_up

body

布尔值

资源的管理状态,为开启(true)或关闭(false)。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

interval (可选)

body

整数

Dead Peer Detection (DPD) 间隔(以秒为单位)。有效值为正整数。默认值为 30。

mtu

body

整数

The maximum transmission unit (MTU) value to address fragmentation. Minimum value is 68 for IPv4, and 1280 for IPv6.

peer_ep_group_id (可选)

body

字符串

包含连接对端专有 CIDR(形式为 < net_address > / < prefix >)的端点组的 ID。您必须指定此参数以及 local_ep_group_id 参数,除非在向 VPN 服务提供 peer_cidrssubnet_id 的向后兼容模式下。

dpd (可选)

body

对象

一个包含 Dead Peer Detection (DPD) 协议控件的字典。

timeout

body

整数

Dead Peer Detection (DPD) 超时(以秒为单位)。有效值为大于 DPD interval 值 的正整数。默认值为 120。

动作

body

字符串

Dead Peer Detection (DPD) 操作。有效值为 clearholdrestartdisabledrestart-by-peer。默认值为 hold

local_id (可选)

body

字符串

在不同网络实例之间的东-西流量中,用于虚拟路由器以进行流量的 ID,而不是外部 IP 地址。local ID 通常是域名、电子邮件地址等。如果未配置,则外部 IP 地址将用作 ID。

响应示例

{
    "ipsec_site_connection": {
        "status": "PENDING_CREATE",
        "psk": "secret",
        "initiator": "bi-directional",
        "name": "vpnconnection1",
        "admin_state_up": true,
        "project_id": "10039663455a446d8ba2cbb058b0f578",
        "tenant_id": "10039663455a446d8ba2cbb058b0f578",
        "auth_mode": "psk",
        "peer_cidrs": [],
        "mtu": 1500,
        "peer_ep_group_id": "9ad5a7e0-6dac-41b4-b20d-a7b8645fddf1",
        "ikepolicy_id": "9b00d6b0-6c93-4ca5-9747-b8ade7bb514f",
        "vpnservice_id": "5c561d9d-eaea-45f6-ae3e-08d1a7080828",
        "dpd": {
            "action": "hold",
            "interval": 30,
            "timeout": 120
        },
        "route_mode": "static",
        "ipsecpolicy_id": "e6e23d0c-9519-4d52-8ea4-5b1f96d857b1",
        "local_ep_group_id": "3e1815dd-e212-43d0-8f13-b494fa553e68",
        "peer_address": "172.24.4.233",
        "peer_id": "172.24.4.233",
        "id": "851f280f-5639-4ea3-81aa-e298525ab74b",
        "description": ""
    }
}
GET
/v2.0/vpn/ipsec-site-connections/{connection_id}

显示 IPsec 连接

显示 IPsec 连接的详细信息。

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

错误响应代码:401、403、404

请求

名称

入参

类型

描述

connection_id

路径

字符串

IPsec 站点到站点连接的 ID。

响应参数

名称

入参

类型

描述

auth_mode (可选)

body

字符串

认证模式。有效值为 psk,这是默认值。

ikepolicy_id

body

字符串

IKE 策略的 ID。

vpnservice_id

body

字符串

VPN 服务的 ID。

local_ep_group_id (可选)

body

字符串

包含连接本地端专用子网的端点组的 ID。您必须指定此参数以及 peer_ep_group_id 参数,除非在向 VPN 服务提供 peer_cidrssubnet_id 的向后兼容模式下。

peer_address

body

字符串

对端网关公用 IPv4 或 IPv6 地址或 FQDN。

id (可选)

body

字符串

IPsec 站点到站点连接的 ID。

ipsec_site_connection

body

对象

一个 ipsec_site_connection 对象。

route_mode (可选)

body

字符串

路由模式。有效值为 static,这是默认值。

ipsecpolicy_id

body

字符串

IPsec 策略的 ID。

peer_id

body

字符串

用于认证的对端路由器标识。有效值为 IPv4 地址、IPv6 地址、电子邮件地址、密钥 ID 或 FQDN。通常,此值与 peer_address 值匹配。

status

body

字符串

指示 IPsec 连接当前是否正常运行。值为 ACTIVEDOWNBUILDERRORPENDING_CREATEPENDING_UPDATEPENDING_DELETE

psk

body

字符串

预共享密钥。有效值为任何字符串。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

initiator (可选)

body

字符串

指示 VPN 是否只能响应连接,还是可以响应和发起连接。有效值为 response-onlybi-directional。默认值为 bi-directional

peer_cidrs (已弃用)

body

数组

(已弃用) 形式为 < net_address > / < prefix > 的有效对端专用 CIDR 的唯一列表。

name (可选)

body

字符串

资源的易读名称。默认情况下为空字符串。

admin_state_up

body

布尔值

资源的管理状态,为开启(true)或关闭(false)。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

interval (可选)

body

整数

Dead Peer Detection (DPD) 间隔(以秒为单位)。有效值为正整数。默认值为 30。

mtu

body

整数

The maximum transmission unit (MTU) value to address fragmentation. Minimum value is 68 for IPv4, and 1280 for IPv6.

peer_ep_group_id (可选)

body

字符串

包含连接对端专有 CIDR(形式为 < net_address > / < prefix >)的端点组的 ID。您必须指定此参数以及 local_ep_group_id 参数,除非在向 VPN 服务提供 peer_cidrssubnet_id 的向后兼容模式下。

dpd (可选)

body

对象

一个包含 Dead Peer Detection (DPD) 协议控件的字典。

timeout

body

整数

Dead Peer Detection (DPD) 超时(以秒为单位)。有效值为大于 DPD interval 值 的正整数。默认值为 120。

动作

body

字符串

Dead Peer Detection (DPD) 操作。有效值为 clearholdrestartdisabledrestart-by-peer。默认值为 hold

local_id (可选)

body

字符串

在不同网络实例之间的东-西流量中,用于虚拟路由器以进行流量的 ID,而不是外部 IP 地址。local ID 通常是域名、电子邮件地址等。如果未配置,则外部 IP 地址将用作 ID。

响应示例

{
    "ipsec_site_connection": {
        "status": "DOWN",
        "psk": "secret",
        "initiator": "bi-directional",
        "name": "vpnconnection1",
        "admin_state_up": true,
        "project_id": "10039663455a446d8ba2cbb058b0f578",
        "tenant_id": "10039663455a446d8ba2cbb058b0f578",
        "auth_mode": "psk",
        "peer_cidrs": [],
        "mtu": 1500,
        "peer_ep_group_id": "9ad5a7e0-6dac-41b4-b20d-a7b8645fddf1",
        "ikepolicy_id": "9b00d6b0-6c93-4ca5-9747-b8ade7bb514f",
        "vpnservice_id": "5c561d9d-eaea-45f6-ae3e-08d1a7080828",
        "dpd": {
            "action": "hold",
            "interval": 30,
            "timeout": 120
        },
        "route_mode": "static",
        "ipsecpolicy_id": "e6e23d0c-9519-4d52-8ea4-5b1f96d857b1",
        "local_ep_group_id": "3e1815dd-e212-43d0-8f13-b494fa553e68",
        "peer_address": "172.24.4.226",
        "peer_id": "172.24.4.226",
        "id": "851f280f-5639-4ea3-81aa-e298525ab74b",
        "description": ""
    }
}
PUT
/v2.0/vpn/ipsec-site-connections/{connection_id}

更新 IPsec 连接

更新 IPsec 连接的连接设置。

正常响应代码:200

错误响应代码:400、401、404

请求

名称

入参

类型

描述

connection_id

路径

字符串

IPsec 站点到站点连接的 ID。

ipsec_site_connection

body

对象

一个 ipsec_site_connection 对象。

psk

body

字符串

预共享密钥。有效值为任何字符串。

initiator (可选)

body

字符串

指示 VPN 是否只能响应连接,还是可以响应和发起连接。有效值为 response-onlybi-directional。默认值为 bi-directional

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

admin_state_up

body

布尔值

资源的管理状态,为开启(true)或关闭(false)。

interval (可选)

body

整数

Dead Peer Detection (DPD) 间隔(以秒为单位)。有效值为正整数。默认值为 30。

peer_cidrs (已弃用)

body

数组

(已弃用) 形式为 < net_address > / < prefix > 的有效对端专用 CIDR 的唯一列表。

mtu

body

整数

The maximum transmission unit (MTU) value to address fragmentation. Minimum value is 68 for IPv4, and 1280 for IPv6.

peer_ep_group_id (可选)

body

字符串

包含连接对端专有 CIDR(形式为 < net_address > / < prefix >)的端点组的 ID。您必须指定此参数以及 local_ep_group_id 参数,除非在向 VPN 服务提供 peer_cidrssubnet_id 的向后兼容模式下。

local_ep_group_id (可选)

body

字符串

包含连接本地端专用子网的端点组的 ID。您必须指定此参数以及 peer_ep_group_id 参数,除非在向 VPN 服务提供 peer_cidrssubnet_id 的向后兼容模式下。

dpd (可选)

body

对象

一个包含 Dead Peer Detection (DPD) 协议控件的字典。

timeout

body

整数

Dead Peer Detection (DPD) 超时(以秒为单位)。有效值为大于 DPD interval 值 的正整数。默认值为 120。

动作

body

字符串

Dead Peer Detection (DPD) 操作。有效值为 clearholdrestartdisabledrestart-by-peer。默认值为 hold

peer_address

body

字符串

对端网关公用 IPv4 或 IPv6 地址或 FQDN。

peer_id

body

字符串

用于认证的对端路由器标识。有效值为 IPv4 地址、IPv6 地址、电子邮件地址、密钥 ID 或 FQDN。通常,此值与 peer_address 值匹配。

name (可选)

body

字符串

资源的易读名称。默认情况下为空字符串。

local_id (可选)

body

字符串

在不同网络实例之间的东-西流量中,用于虚拟路由器以进行流量的 ID,而不是外部 IP 地址。local ID 通常是域名、电子邮件地址等。如果未配置,则外部 IP 地址将用作 ID。

请求示例

{
    "ipsec_site_connection": {
        "mtu": "2000"
    }
}

响应参数

名称

入参

类型

描述

auth_mode (可选)

body

字符串

认证模式。有效值为 psk,这是默认值。

ikepolicy_id

body

字符串

IKE 策略的 ID。

vpnservice_id

body

字符串

VPN 服务的 ID。

local_ep_group_id (可选)

body

字符串

包含连接本地端专用子网的端点组的 ID。您必须指定此参数以及 peer_ep_group_id 参数,除非在向 VPN 服务提供 peer_cidrssubnet_id 的向后兼容模式下。

peer_address

body

字符串

对端网关公用 IPv4 或 IPv6 地址或 FQDN。

id (可选)

body

字符串

IPsec 站点到站点连接的 ID。

ipsec_site_connection

body

对象

一个 ipsec_site_connection 对象。

route_mode (可选)

body

字符串

路由模式。有效值为 static,这是默认值。

ipsecpolicy_id

body

字符串

IPsec 策略的 ID。

peer_id

body

字符串

用于认证的对端路由器标识。有效值为 IPv4 地址、IPv6 地址、电子邮件地址、密钥 ID 或 FQDN。通常,此值与 peer_address 值匹配。

status

body

字符串

指示 IPsec 连接当前是否正常运行。值为 ACTIVEDOWNBUILDERRORPENDING_CREATEPENDING_UPDATEPENDING_DELETE

psk

body

字符串

预共享密钥。有效值为任何字符串。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

initiator (可选)

body

字符串

指示 VPN 是否只能响应连接,还是可以响应和发起连接。有效值为 response-onlybi-directional。默认值为 bi-directional

peer_cidrs (已弃用)

body

数组

(已弃用) 形式为 < net_address > / < prefix > 的有效对端专用 CIDR 的唯一列表。

name (可选)

body

字符串

资源的易读名称。默认情况下为空字符串。

admin_state_up

body

布尔值

资源的管理状态,为开启(true)或关闭(false)。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

interval (可选)

body

整数

Dead Peer Detection (DPD) 间隔(以秒为单位)。有效值为正整数。默认值为 30。

mtu

body

整数

The maximum transmission unit (MTU) value to address fragmentation. Minimum value is 68 for IPv4, and 1280 for IPv6.

peer_ep_group_id (可选)

body

字符串

包含连接对端专有 CIDR(形式为 < net_address > / < prefix >)的端点组的 ID。您必须指定此参数以及 local_ep_group_id 参数,除非在向 VPN 服务提供 peer_cidrssubnet_id 的向后兼容模式下。

dpd (可选)

body

对象

一个包含 Dead Peer Detection (DPD) 协议控件的字典。

timeout

body

整数

Dead Peer Detection (DPD) 超时(以秒为单位)。有效值为大于 DPD interval 值 的正整数。默认值为 120。

动作

body

字符串

Dead Peer Detection (DPD) 操作。有效值为 clearholdrestartdisabledrestart-by-peer。默认值为 hold

local_id (可选)

body

字符串

在不同网络实例之间的东-西流量中,用于虚拟路由器以进行流量的 ID,而不是外部 IP 地址。local ID 通常是域名、电子邮件地址等。如果未配置,则外部 IP 地址将用作 ID。

响应示例

{
    "ipsec_site_connection": {
        "status": "DOWN",
        "psk": "secret",
        "initiator": "bi-directional",
        "name": "vpnconnection1",
        "admin_state_up": true,
        "project_id": "10039663455a446d8ba2cbb058b0f578",
        "tenant_id": "10039663455a446d8ba2cbb058b0f578",
        "auth_mode": "psk",
        "peer_cidrs": [],
        "mtu": 2000,
        "peer_ep_group_id": "9ad5a7e0-6dac-41b4-b20d-a7b8645fddf1",
        "ikepolicy_id": "9b00d6b0-6c93-4ca5-9747-b8ade7bb514f",
        "vpnservice_id": "5c561d9d-eaea-45f6-ae3e-08d1a7080828",
        "dpd": {
            "action": "hold",
            "interval": 30,
            "timeout": 120
        },
        "route_mode": "static",
        "ipsecpolicy_id": "e6e23d0c-9519-4d52-8ea4-5b1f96d857b1",
        "local_ep_group_id": "3e1815dd-e212-43d0-8f13-b494fa553e68",
        "peer_address": "172.24.4.233",
        "peer_id": "172.24.4.233",
        "id": "851f280f-5639-4ea3-81aa-e298525ab74b",
        "description": "New description"
    }
}
DELETE
/v2.0/vpn/ipsec-site-connections/{connection_id}

移除 IPsec 连接

移除 IPsec 连接。

正常响应代码:204

错误响应代码:401, 404, 409

请求

名称

入参

类型

描述

connection_id

路径

字符串

IPsec 站点到站点连接的 ID。

响应

There is no body content for the response of a successful DELETE request.

GET
/v2.0/vpn/endpoint-groups

列出 VPN 端点组

列出 VPN 端点组。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

错误响应代码:401, 403

请求

名称

入参

类型

描述

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

endpoints

body

数组

一组相同类型的端点列表。值取决于类型。

name (可选)

body

字符串

资源的易读名称。默认情况下为空字符串。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

type

body

字符串

组中端点的类型。有效值为 subnetcidrnetworkroutervlan。目前仅支持 subnetcidr

id

body

字符串

VPN 端点组的 ID。

响应示例

{
    "endpoint_groups": [
        {
            "description": "",
            "project_id": "4ad57e7ce0b24fca8f12b9834d91079d",
            "tenant_id": "4ad57e7ce0b24fca8f12b9834d91079d",
            "endpoints": [
                "a3da778c-adfb-46db-88b3-d2ce53290a89"
            ],
            "type": "subnet",
            "id": "6bf34c7c-864c-4948-a6d4-db791669f9d4",
            "name": "locals"
        },
        {
            "description": "",
            "project_id": "4ad57e7ce0b24fca8f12b9834d91079d",
            "tenant_id": "4ad57e7ce0b24fca8f12b9834d91079d",
            "endpoints": [
                "10.2.0.0/24",
                "10.3.0.0/24"
            ],
            "type": "cidr",
            "id": "6ecd9cf3-ca64-46c7-863f-f2eb1b9e838a",
            "name": "peers"
        }
    ]
}
POST
/v2.0/vpn/endpoint-groups

创建 VPN 端点组

创建 VPN 端点组。

端点组包含一个或多个特定类型的端点,您可以使用它们来创建 VPN 连接。

正常响应代码:201

错误响应代码:400, 401

请求

名称

入参

类型

描述

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

endpoints

body

数组

一组相同类型的端点列表。值取决于类型。

type

body

字符串

组中端点的类型。有效值为 subnetcidrnetworkroutervlan。目前仅支持 subnetcidr

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

name (可选)

body

字符串

资源的易读名称。默认情况下为空字符串。

请求示例

{
    "endpoint_group": {
        "endpoints": [
            "10.2.0.0/24",
            "10.3.0.0/24"
        ],
        "type": "cidr",
        "name": "peers"
    }
}

响应参数

名称

入参

类型

描述

endpoints

body

数组

一组相同类型的端点列表。值取决于类型。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

type

body

字符串

组中端点的类型。有效值为 subnetcidrnetworkroutervlan。目前仅支持 subnetcidr

id

body

字符串

VPN 端点组的 ID。

name (可选)

body

字符串

资源的易读名称。默认情况下为空字符串。

响应示例

{
    "endpoint_group": {
        "description": "",
        "project_id": "4ad57e7ce0b24fca8f12b9834d91079d",
        "tenant_id": "4ad57e7ce0b24fca8f12b9834d91079d",
        "endpoints": [
            "10.2.0.0/24",
            "10.3.0.0/24"
        ],
        "type": "cidr",
        "id": "6ecd9cf3-ca64-46c7-863f-f2eb1b9e838a",
        "name": "peers"
    }
}
GET
/v2.0/vpn/endpoint-groups/{endpoint_group_id}

显示 VPN 端点组

显示 VPN 端点组的详细信息。

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

错误响应代码:401、403、404

请求

名称

入参

类型

描述

endpoint_group_id

路径

字符串

VPN 端点组的 ID。

响应参数

名称

入参

类型

描述

endpoints

body

数组

一组相同类型的端点列表。值取决于类型。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

type

body

字符串

组中端点的类型。有效值为 subnetcidrnetworkroutervlan。目前仅支持 subnetcidr

id

body

字符串

VPN 端点组的 ID。

name (可选)

body

字符串

资源的易读名称。默认情况下为空字符串。

响应示例

{
    "endpoint_group": {
        "description": "",
        "project_id": "4ad57e7ce0b24fca8f12b9834d91079d",
        "tenant_id": "4ad57e7ce0b24fca8f12b9834d91079d",
        "endpoints": [
            "10.2.0.0/24",
            "10.3.0.0/24"
        ],
        "type": "cidr",
        "id": "6ecd9cf3-ca64-46c7-863f-f2eb1b9e838a",
        "name": "peers"
    }
}
PUT
/v2.0/vpn/endpoint-groups/{endpoint_group_id}

更新 VPN 端点组

更新 VPN 端点组的设置。

正常响应代码:200

错误响应代码:400、401、404

请求

名称

入参

类型

描述

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

name (可选)

body

字符串

资源的易读名称。默认情况下为空字符串。

endpoint_group_id

路径

字符串

VPN 端点组的 ID。

请求示例

{
    "endpoint_group": {
        "description": "New description"
    }
}

响应参数

名称

入参

类型

描述

endpoints

body

数组

一组相同类型的端点列表。值取决于类型。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

type

body

字符串

组中端点的类型。有效值为 subnetcidrnetworkroutervlan。目前仅支持 subnetcidr

id

body

字符串

VPN 端点组的 ID。

name (可选)

body

字符串

资源的易读名称。默认情况下为空字符串。

响应示例

{
    "endpoint_group": {
        "description": "New description",
        "project_id": "4ad57e7ce0b24fca8f12b9834d91079d",
        "tenant_id": "4ad57e7ce0b24fca8f12b9834d91079d",
        "endpoints": [
            "10.2.0.0/24",
            "10.3.0.0/24"
        ],
        "type": "cidr",
        "id": "6ecd9cf3-ca64-46c7-863f-f2eb1b9e838a",
        "name": "peers"
    }
}
DELETE
/v2.0/vpn/endpoint-groups/{endpoint_group_id}

移除 VPN 端点组

移除 VPN 端点组。

正常响应代码:204

错误响应代码:401, 404, 409

请求

名称

入参

类型

描述

endpoint_group_id

路径

字符串

VPN 端点组的 ID。

响应

There is no body content for the response of a successful DELETE request.

GET
/v2.0/vpn/vpnservices

列出 VPN 服务

列出所有 VPN 服务。

列表可能为空。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

错误响应代码:401, 403

请求

名称

入参

类型

描述

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

vpnservices

body

数组

VPN 服务对象列表。

router_id

路径

字符串

路由器的ID。

status

body

字符串

指示 IPsec VPN 服务当前是否正常运行。值为 ACTIVEDOWNBUILDERRORPENDING_CREATEPENDING_UPDATEPENDING_DELETE

name (可选)

body

字符串

资源的易读名称。默认情况下为空字符串。

external_v6_ip

body

字符串

用于 VPN 服务的只读外部 (公共) IPv6 地址。如果存在 IPv6 接口,VPN 插件会设置此地址。

admin_state_up

body

布尔值

资源的管理状态,为开启(true)或关闭(false)。

subnet_id (可选)

body

字符串

如果仅指定了子网 UUID,OpenStack Networking 会从该子网中为端口分配一个可用 IP。如果同时指定了子网 UUID 和 IP 地址,OpenStack Networking 会尝试将该地址分配给端口。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

external_v4_ip

body

字符串

用于 VPN 服务的只读外部 (公共) IPv4 地址。如果存在 IPv4 接口,VPN 插件会设置此地址。

id

body

字符串

VPN 服务的 ID。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

flavor_id

body

字符串

flavor 的 ID。

响应示例

{
    "vpnservices": [
        {
            "router_id": "66e3b16c-8ce5-40fb-bb49-ab6d8dc3f2aa",
            "status": "PENDING_CREATE",
            "name": "myservice",
            "external_v6_ip": "2001:db8::1",
            "admin_state_up": true,
            "subnet_id": null,
            "project_id": "10039663455a446d8ba2cbb058b0f578",
            "tenant_id": "10039663455a446d8ba2cbb058b0f578",
            "external_v4_ip": "172.32.1.11",
            "id": "5c561d9d-eaea-45f6-ae3e-08d1a7080828",
            "description": "",
            "flavor_id": null
        }
    ]
}
POST
/v2.0/vpn/vpnservices

创建 VPN 服务

创建 VPN 服务。

该服务与路由器相关联。创建服务后,它可以包含多个 VPN 连接。

可以选择传入一个可选的 flavor_id 属性,以便在配置时启用动态选择合适的提供商。仅在启用 vpn-flavors 扩展时可用。基本选择算法选择当前与 flavor 关联的第一个服务配置文件中的提供商。此选项只能在 POST 操作中设置。

正常响应代码:201

错误响应代码:400, 401

请求

名称

入参

类型

描述

vpnservice

body

对象

一个 vpnservice 对象。

router_id

路径

字符串

路由器的ID。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

admin_state_up

body

布尔值

资源的管理状态,为开启(true)或关闭(false)。

subnet_id (可选)

body

字符串

如果仅指定了子网 UUID,OpenStack Networking 会从该子网中为端口分配一个可用 IP。如果同时指定了子网 UUID 和 IP 地址,OpenStack Networking 会尝试将该地址分配给端口。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

name (可选)

body

字符串

资源的易读名称。默认情况下为空字符串。

flavor_id (可选)

body

字符串

flavor 的 ID。

请求示例

{
    "vpnservice": {
        "subnet_id": null,
        "router_id": "66e3b16c-8ce5-40fb-bb49-ab6d8dc3f2aa",
        "name": "myservice",
        "admin_state_up": true,
        "flavor_id": null
    }
}

响应参数

名称

入参

类型

描述

vpnservice

body

对象

一个 vpnservice 对象。

router_id

路径

字符串

路由器的ID。

status

body

字符串

指示 IPsec VPN 服务当前是否正常运行。值为 ACTIVEDOWNBUILDERRORPENDING_CREATEPENDING_UPDATEPENDING_DELETE

name (可选)

body

字符串

资源的易读名称。默认情况下为空字符串。

external_v6_ip

body

字符串

用于 VPN 服务的只读外部 (公共) IPv6 地址。如果存在 IPv6 接口,VPN 插件会设置此地址。

admin_state_up

body

布尔值

资源的管理状态,为开启(true)或关闭(false)。

subnet_id (可选)

body

字符串

如果仅指定了子网 UUID,OpenStack Networking 会从该子网中为端口分配一个可用 IP。如果同时指定了子网 UUID 和 IP 地址,OpenStack Networking 会尝试将该地址分配给端口。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

external_v4_ip

body

字符串

用于 VPN 服务的只读外部 (公共) IPv4 地址。如果存在 IPv4 接口,VPN 插件会设置此地址。

id

body

字符串

VPN 服务的 ID。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

flavor_id

body

字符串

flavor 的 ID。

响应示例

{
    "vpnservice": {
        "router_id": "66e3b16c-8ce5-40fb-bb49-ab6d8dc3f2aa",
        "status": "PENDING_CREATE",
        "name": "myservice",
        "external_v6_ip": "2001:db8::1",
        "admin_state_up": true,
        "subnet_id": null,
        "project_id": "10039663455a446d8ba2cbb058b0f578",
        "tenant_id": "10039663455a446d8ba2cbb058b0f578",
        "external_v4_ip": "172.32.1.11",
        "id": "5c561d9d-eaea-45f6-ae3e-08d1a7080828",
        "description": "",
        "flavor_id": null
    }
}
GET
/v2.0/vpn/vpnservices/{service_id}

显示 VPN 服务详情

显示 VPN 服务的详细信息。

如果用户不是管理员用户,并且 VPN 服务对象不属于用户的租户帐户,则操作将返回 Forbidden (403) 响应代码。

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

错误响应代码:401、403、404

请求

名称

入参

类型

描述

service_id

路径

字符串

VPN 服务的 ID。

响应参数

名称

入参

类型

描述

vpnservice

body

对象

一个 vpnservice 对象。

router_id

路径

字符串

路由器的ID。

status

body

字符串

指示 IPsec VPN 服务当前是否正常运行。值为 ACTIVEDOWNBUILDERRORPENDING_CREATEPENDING_UPDATEPENDING_DELETE

name (可选)

body

字符串

资源的易读名称。默认情况下为空字符串。

external_v6_ip

body

字符串

用于 VPN 服务的只读外部 (公共) IPv6 地址。如果存在 IPv6 接口,VPN 插件会设置此地址。

admin_state_up

body

布尔值

资源的管理状态,为开启(true)或关闭(false)。

subnet_id (可选)

body

字符串

如果仅指定了子网 UUID,OpenStack Networking 会从该子网中为端口分配一个可用 IP。如果同时指定了子网 UUID 和 IP 地址,OpenStack Networking 会尝试将该地址分配给端口。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

external_v4_ip

body

字符串

用于 VPN 服务的只读外部 (公共) IPv4 地址。如果存在 IPv4 接口,VPN 插件会设置此地址。

id

body

字符串

VPN 服务的 ID。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

flavor_id

body

字符串

flavor 的 ID。

响应示例

{
    "vpnservice": {
        "router_id": "66e3b16c-8ce5-40fb-bb49-ab6d8dc3f2aa",
        "status": "PENDING_CREATE",
        "name": "myservice",
        "external_v6_ip": "2001:db8::1",
        "admin_state_up": true,
        "subnet_id": null,
        "project_id": "10039663455a446d8ba2cbb058b0f578",
        "tenant_id": "10039663455a446d8ba2cbb058b0f578",
        "external_v4_ip": "172.32.1.11",
        "id": "5c561d9d-eaea-45f6-ae3e-08d1a7080828",
        "description": "",
        "flavor_id": null
    }
}
PUT
/v2.0/vpn/vpnservices/{service_id}

更新 VPN 服务

更新 VPN 服务。

更新 VPN 服务的属性。您无法更新状态为 PENDING_* 的服务。

正常响应代码:200

错误响应代码:400、401、404

请求

名称

入参

类型

描述

vpnservice

body

对象

一个 vpnservice 对象。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

name (可选)

body

字符串

资源的易读名称。默认情况下为空字符串。

admin_state_up

body

布尔值

资源的管理状态,为开启(true)或关闭(false)。

service_id

路径

字符串

VPN 服务的 ID。

请求示例

{
    "vpnservice": {
        "description": "Updated description"
    }
}

响应参数

名称

入参

类型

描述

vpnservice

body

对象

一个 vpnservice 对象。

router_id

路径

字符串

路由器的ID。

status

body

字符串

指示 IPsec VPN 服务当前是否正常运行。值为 ACTIVEDOWNBUILDERRORPENDING_CREATEPENDING_UPDATEPENDING_DELETE

name (可选)

body

字符串

资源的易读名称。默认情况下为空字符串。

external_v6_ip

body

字符串

用于 VPN 服务的只读外部 (公共) IPv6 地址。如果存在 IPv6 接口,VPN 插件会设置此地址。

admin_state_up

body

布尔值

资源的管理状态,为开启(true)或关闭(false)。

subnet_id (可选)

body

字符串

如果仅指定了子网 UUID,OpenStack Networking 会从该子网中为端口分配一个可用 IP。如果同时指定了子网 UUID 和 IP 地址,OpenStack Networking 会尝试将该地址分配给端口。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

external_v4_ip

body

字符串

用于 VPN 服务的只读外部 (公共) IPv4 地址。如果存在 IPv4 接口,VPN 插件会设置此地址。

id

body

字符串

VPN 服务的 ID。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

flavor_id

body

字符串

flavor 的 ID。

响应示例

{
    "vpnservice": {
        "router_id": "881b7b30-4efb-407e-a162-5630a7af3595",
        "status": "ACTIVE",
        "name": "myvpn",
        "admin_state_up": true,
        "subnet_id": null,
        "project_id": "26de9cd6cae94c8cb9f79d660d628e1f",
        "tenant_id": "26de9cd6cae94c8cb9f79d660d628e1f",
        "id": "41bfef97-af4e-4f6b-a5d3-4678859d2485",
        "description": "Updated description",
        "flavor_id": null
    }
}
DELETE
/v2.0/vpn/vpnservices/{service_id}

移除 VPN 服务

移除 VPN 服务。

如果服务有连接,则请求将被拒绝。

正常响应代码:204

错误响应代码:401, 404, 409

请求

名称

入参

类型

描述

service_id

路径

字符串

VPN 服务的 ID。

响应

There is no body content for the response of a successful DELETE request.

资源管理

Networking Flavors Framework v2.0 (CURRENT) (flavor, service_profile)

允许用户在创建资源时选择运营商策划的 Flavor 的扩展。

用户可以通过对 /v2.0/extensions/flavors 执行 GET 请求来检查 Flavor 是否可用。如果不可用,则会返回 404 错误响应 (itemNotFound)。有关更多详细信息,请参阅 显示扩展详情

GET
/v2.0/flavors

列出 flavors

列出项目可见的所有 Flavor。

列表可能为空。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

Error response codes: 401

请求

名称

入参

类型

描述

id (可选)

查询

字符串

Filter the list result by the ID of the resource.

service_type (可选)

查询

字符串

按 Flavor 的类型过滤 Flavor 列表结果。

name (可选)

查询

字符串

Filter the list result by the human-readable name of the resource.

description (可选)

查询

字符串

Filter the list result by the human-readable description of the resource.

enabled(可选)

查询

布尔值

根据 Flavor 是否启用来过滤 Flavor 列表结果。

sort_dir (可选)

查询

字符串

Sort direction. A valid value is asc (ascending) or desc (descending). You can specify multiple pairs of sort key and sort direction query parameters.

sort_key (可选)

查询

字符串

按 Flavor 属性排序。您可以指定多个排序键和排序方向查询参数。排序键限于

  • description

  • enabled

  • id

  • name

  • service_type

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

flavors

body

数组

flavor 对象列表。

id

body

字符串

flavor 的 ID。

service_type

body

字符串

Flavor 的服务类型。例如:FIREWALL。

name

body

字符串

风味的名称。

description

body

字符串

Flavor 的人类可读描述。

enabled

body

布尔值

指示 Flavor 是否启用。默认值为 true。

service_profiles

body

数组

与此 Flavor 关联的服务配置文件 UUID。

响应示例

{
    "flavors": [
        {
            "description": "",
            "enabled": true,
            "service_profiles": [],
            "service_type": "FIREWALL",
            "id": "f7b14d9a-b0dc-4fbe-bb14-a0f4970a69e0",
            "name": "dummy"
        }
    ]
}
POST
/v2.0/flavors

创建 Flavor

创建flavor。

此操作建立一个新的 Flavor。

Flavor 所适用的 service_type 是一个必需参数。相应的服务插件必须已作为配置的一部分被激活。请参阅 服务提供商 以了解如何查看当前加载的服务类型。此外,服务插件需要支持 Flavor 的使用。

创建目前仅限于管理员。其他用户将收到 Forbidden 403 响应代码,并附带一个 NeutronError 消息响应正文,说明根据策略不允许创建。

在操作员将一个或多个服务配置文件与 Flavor 关联之前,尝试在资源创建过程中使用该 Flavor 目前将返回 Not Found 404 响应,并附带一个指示找不到服务配置文件的响应正文。

如果 API 由于数据不足或数据无效而无法满足请求,服务将返回 HTTP Bad Request (400) 响应代码,并在响应正文中提供有关失败的信息。验证错误要求您纠正错误并重新提交请求。

正常响应代码:201

错误响应代码:400、401、403、404

请求

名称

入参

类型

描述

flavor

body

对象

一个 flavor 对象。

service_type

body

字符串

Flavor 的服务类型。例如:FIREWALL。

enabled(可选)

body

布尔值

指示 Flavor 是否启用。默认值为 true。

description (可选)

body

字符串

Flavor 的人类可读描述。

name (可选)

body

字符串

风味的名称。

请求示例

{
    "flavor": {
        "service_type": "FIREWALL",
        "enabled": true,
        "name": "dummy",
        "description": "Dummy flavor"
    }
}

响应参数

名称

入参

类型

描述

flavor

body

对象

一个 flavor 对象。

id

body

字符串

flavor 的 ID。

service_type

body

字符串

Flavor 的服务类型。例如:FIREWALL。

name

body

字符串

风味的名称。

description

body

字符串

Flavor 的人类可读描述。

enabled

body

布尔值

指示 Flavor 是否启用。默认值为 true。

service_profiles

body

数组

与此 Flavor 关联的服务配置文件 UUID。

响应示例

{
    "flavor": {
        "id": "7fc0581b-4509-49e1-90eb-c953c877fa4c",
        "name": "dummy",
        "service_type": "FIREWALL",
        "description": "Dummy flavor",
        "enabled": true,
        "service_profiles": []
    }
}
GET
/v2.0/flavors/{flavor_id}

显示 Flavor 详情

显示flavor的详情。

此操作通过 ID 返回一个 Flavor 对象。如果您不是管理员用户,并且 Flavor 对象对您的项目帐户不可见,服务将返回 HTTP Forbidden (403) 响应代码。

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

错误响应代码:401、403、404

请求

名称

入参

类型

描述

flavor_id

路径

字符串

Flavor 的 UUID。

响应参数

名称

入参

类型

描述

flavor

body

对象

一个 flavor 对象。

id

body

字符串

flavor 的 ID。

service_type

body

字符串

Flavor 的服务类型。例如:FIREWALL。

name

body

字符串

风味的名称。

description

body

字符串

Flavor 的人类可读描述。

enabled

body

布尔值

指示 Flavor 是否启用。默认值为 true。

service_profiles

body

数组

与此 Flavor 关联的服务配置文件 UUID。

响应示例

{
    "flavor": {
        "description": "",
        "enabled": true,
        "service_profiles": [],
        "service_type": "FIREWALL",
        "id": "f7b14d9a-b0dc-4fbe-bb14-a0f4970a69e0",
        "name": "dummy"
    }
}
PUT
/v2.0/flavors/{flavor_id}

更新 Flavor

更新 Flavor。

无法更新 service_type,因为可能有相关的服务配置文件和消费者依赖于该值。

正常响应代码:200

错误响应代码:400、401、403、404

请求

名称

入参

类型

描述

flavor_id

路径

字符串

Flavor 的 UUID。

flavor

body

对象

一个 flavor 对象。

name (可选)

body

字符串

风味的名称。

description (可选)

body

字符串

Flavor 的人类可读描述。

enabled(可选)

body

布尔值

指示 Flavor 是否启用。默认值为 true。

请求示例

{
    "flavor": {
        "enabled": false,
        "name": "newname",
        "description": "New description"
    }
}

响应参数

名称

入参

类型

描述

flavor

body

对象

一个 flavor 对象。

id

body

字符串

flavor 的 ID。

service_type

body

字符串

Flavor 的服务类型。例如:FIREWALL。

name

body

字符串

风味的名称。

description

body

字符串

Flavor 的人类可读描述。

enabled

body

布尔值

指示 Flavor 是否启用。默认值为 true。

service_profiles

body

数组

与此 Flavor 关联的服务配置文件 UUID。

响应示例

{
    "flavor": {
        "description": "New description",
        "enabled": false,
        "service_profiles": [],
        "service_type": "FIREWALL",
        "id": "7fc0581b-4509-49e1-90eb-c953c877fa4c",
        "name": "newname"
    }
}
DELETE
/v2.0/flavors/{flavor_id}

删除 Flavor

删除 Flavor。

正常响应代码:204

错误响应代码:401、403、404

请求

名称

入参

类型

描述

flavor_id

路径

字符串

Flavor 的 UUID。

响应

成功删除后不返回正文内容。

POST
/v2.0/flavors/{flavor_id}/service_profiles

将 Flavor 与服务配置文件关联

将 Flavor 与服务配置文件关联。

一个 Flavor 可以与多个配置文件关联。

如果关联已存在,将返回 409 Conflict

正常响应代码:201

错误响应代码:400、401、403、404、409

请求

名称

入参

类型

描述

flavor_id

路径

字符串

Flavor 的 UUID。

service_profile

body

对象

一个 service_profile 对象。

id

body

字符串

服务配置文件的 UUID。

请求示例

{
    "service_profile": {
        "id": "4e5b9191-ffbe-4f7a-b112-2db98232fd32"
    }
}

响应参数

名称

入参

类型

描述

service_profile

body

对象

一个 service_profile 对象。

id

body

字符串

资源的ID。

响应示例

{
    "service_profile": {
        "id": "4e5b9191-ffbe-4f7a-b112-2db98232fd32"
    }
}
DELETE
/v2.0/flavors/{flavor_id}/service_profiles/{profile_id}

取消 Flavor 的关联。

将 Flavor 与服务配置文件解除关联。

正常响应代码:204

错误响应代码:401、403、404

请求

名称

入参

类型

描述

profile_id

路径

字符串

服务配置文件的 UUID。

flavor_id

路径

字符串

Flavor 的 UUID。

响应

成功的解除关联请求不返回正文内容。

GET
/v2.0/service_profiles

列出服务配置文件

列出租户帐户可见的所有服务配置文件。

列表可能为空。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

Error response codes: 401

请求

名称

入参

类型

描述

id (可选)

查询

字符串

Filter the list result by the ID of the resource.

enabled(可选)

查询

布尔值

根据服务配置文件是否启用来过滤服务配置文件列表结果。

driver (可选)

查询

字符串

按配置文件使用的驱动程序过滤服务配置文件列表结果。

description (可选)

查询

字符串

Filter the list result by the human-readable description of the resource.

sort_dir (可选)

查询

字符串

Sort direction. A valid value is asc (ascending) or desc (descending). You can specify multiple pairs of sort key and sort direction query parameters.

sort_key (可选)

查询

字符串

按服务配置文件属性排序。您可以指定多个排序键和排序方向查询参数。排序键限于

  • description

  • driver

  • enabled

  • id

  • metainfo

响应参数

名称

入参

类型

描述

service_profiles

body

数组

与此 Flavor 关联的服务配置文件 UUID。

id

body

字符串

服务配置文件的 UUID。

enabled

body

布尔值

指示此服务配置文件是否启用。默认值为 true

driver

body

字符串

此配置文件使用的提供商驱动程序。

description

body

字符串

服务配置文件的可读描述。

metainfo

body

字符串

服务配置文件的 JSON 格式元信息。

响应示例

{
    "service_profiles": [
        {
            "id": "4e5b9191-ffbe-4f7a-b112-2db98232fd32",
            "enabled": true,
            "driver": "neutron.services.vpn.device_drivers.ipsec.OpenSwanDriver",
            "description": "",
            "metainfo": "{}"
        },
        {
            "id": "684322c5-703a-48a2-8138-34b99942a7ef",
            "enabled": true,
            "driver": "neutron.services.vpn.device_drivers.ipsec.OpenSwanDriver",
            "description": "",
            "metainfo": "{}"
        }
    ]
}
POST
/v2.0/service_profiles

创建服务配置文件

创建服务配置文件。

此操作建立一个新的服务配置文件,该文件可以与一个或多个 Flavor 关联。

需要元数据或驱动程序。

如果指定了驱动程序但不存在,调用将返回 Not found 404 错误,响应正文解释驱动程序未找到。

创建目前仅限于管理员。其他用户将收到 Forbidden 403 响应代码,并附带一个 NeutronError 消息响应正文,说明根据策略不允许创建。

如果 API 由于数据不足或数据无效而无法满足请求,服务将返回 HTTP Bad Request (400) 响应代码,并在响应正文中提供有关失败的信息。验证错误要求您纠正错误并重新提交请求。

正常响应代码:201

错误响应代码:400、401、403、404

请求

名称

入参

类型

描述

service_profile

body

对象

一个 service_profile 对象。

description (可选)

body

字符串

服务配置文件的可读描述。

metainfo (可选)

body

字符串

服务配置文件的 JSON 格式元信息。

enabled(可选)

body

布尔值

指示此服务配置文件是否启用。默认值为 true

driver (可选)

body

字符串

此配置文件使用的提供商驱动程序。

请求示例

{
    "service_profile": {
        "enabled": "true",
        "driver": "neutron.services.vpn.device_drivers.ipsec.OpenSwanDriver",
        "description": "Dummy profile",
        "metainfo": "{'foo': 'bar'}"
    }
}

响应参数

名称

入参

类型

描述

service_profile

body

对象

一个 service_profile 对象。

id

body

字符串

服务配置文件的 UUID。

enabled

body

布尔值

指示此服务配置文件是否启用。默认值为 true

driver

body

字符串

此配置文件使用的提供商驱动程序。

description

body

字符串

服务配置文件的可读描述。

metainfo

body

字符串

服务配置文件的 JSON 格式元信息。

响应示例

{
    "service_profile": {
        "enabled": true,
        "metainfo": "{'foo': 'bar'}",
        "driver": "neutron.services.vpn.device_drivers.ipsec.OpenSwanDriver",
        "id": "7c793e5f-9b64-44e0-8b1f-902e59c85a01",
        "description": "Dummy profile"
    }
}
GET
/v2.0/service_profiles/{profile_id}

显示服务配置文件详情

显示服务配置文件的详细信息。

此操作通过 ID 返回一个服务配置文件对象。如果您不是管理员用户,并且该对象对您的租户帐户不可见,服务将返回 HTTP Forbidden (403) 响应代码。

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

错误响应代码:401、403、404

请求

名称

入参

类型

描述

profile_id

路径

字符串

服务配置文件的 UUID。

响应参数

名称

入参

类型

描述

service_profile

body

对象

一个 service_profile 对象。

id

body

字符串

服务配置文件的 UUID。

enabled

body

布尔值

指示此服务配置文件是否启用。默认值为 true

driver

body

字符串

此配置文件使用的提供商驱动程序。

description

body

字符串

服务配置文件的可读描述。

metainfo

body

字符串

服务配置文件的 JSON 格式元信息。

响应示例

{
    "service_profile": {
        "enabled": true,
        "metainfo": "{'foo': 'bar'}",
        "driver": "neutron.services.vpn.device_drivers.ipsec.OpenSwanDriver",
        "id": "7c793e5f-9b64-44e0-8b1f-902e59c85a01",
        "description": "Dummy profile"
    }
}
PUT
/v2.0/service_profiles/{profile_id}

更新服务配置文件

更新服务配置文件。

正常响应代码:200

错误响应代码:400、401、403、404

请求

名称

入参

类型

描述

profile_id

路径

字符串

服务配置文件的 UUID。

service_profile

body

对象

一个 service_profile 对象。

enabled(可选)

body

布尔值

指示此服务配置文件是否启用。默认值为 true

driver (可选)

body

字符串

此配置文件使用的提供商驱动程序。

description (可选)

body

字符串

服务配置文件的可读描述。

metainfo (可选)

body

字符串

服务配置文件的 JSON 格式元信息。

请求示例

{
    "service_profile": {
        "enabled": false,
        "driver": "neutron.services.vpn.device_drivers.ipsec.OpenSwanDriver",
        "description": "New description",
        "metainfo": "{'new': 'info'}"
    }
}

响应参数

名称

入参

类型

描述

service_profile

body

对象

一个 service_profile 对象。

id

body

字符串

服务配置文件的 UUID。

enabled

body

布尔值

指示此服务配置文件是否启用。默认值为 true

driver

body

字符串

此配置文件使用的提供商驱动程序。

description

body

字符串

服务配置文件的可读描述。

metainfo

body

字符串

服务配置文件的 JSON 格式元信息。

响应示例

{
    "service_profile": {
        "enabled": false,
        "metainfo": "{'new': 'info'}",
        "driver": "neutron.services.vpn.device_drivers.ipsec.OpenSwanDriver",
        "id": "7c793e5f-9b64-44e0-8b1f-902e59c85a01",
        "description": "New description"
    }
}
DELETE
/v2.0/service_profiles/{profile_id}

删除服务配置文件

删除服务配置文件。

尝试删除当前与 Flavor 关联的服务配置文件将返回 Conflict 409,响应正文包含正在使用中的消息。

需要元数据或驱动程序。

正常响应代码:204

错误响应代码:401、403、404、409

请求

名称

入参

类型

描述

profile_id

路径

字符串

服务配置文件的 UUID。

响应

成功删除后不返回正文内容。

计量标签和规则 (metering-labels, metering-label-rules)

创建、修改和删除 OpenStack L3 计量标签和规则。

GET
/v2.0/metering/metering-labels

列出计量标签

列出属于项目的全部 L3 计量标签。

列表显示每个计量标签的 ID。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

Error response codes: 401

请求

名称

入参

类型

描述

description (可选)

查询

字符串

Filter the list result by the human-readable description of the resource.

tenant_id (可选)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

project_id (可选)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

shared (Optional)

查询

布尔值

仅限管理员。根据资源是否在所有项目之间共享来过滤列表结果。

id (可选)

查询

字符串

Filter the list result by the ID of the resource.

name (可选)

查询

字符串

Filter the list result by the human-readable name of the resource.

sort_dir (可选)

查询

字符串

Sort direction. A valid value is asc (ascending) or desc (descending). You can specify multiple pairs of sort key and sort direction query parameters.

sort_key (可选)

查询

字符串

按计量标签属性排序。您可以指定多个排序键和排序方向查询参数。排序键限于

  • id

  • shared

  • name

  • description

  • tenant_id

  • project_id

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

metering_labels

body

数组

metering_label 对象列表。

description

body

字符串

A human-readable description for the resource.

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

shared

body

布尔值

指示此计量标签是否在所有项目中共享。

id

body

字符串

计量标签的 ID。

name

body

字符串

Human-readable name of the resource.

响应示例

{
    "metering_labels": [
        {
            "project_id": "45345b0ee1ea477fac0f541b2cb79cd4",
            "tenant_id": "45345b0ee1ea477fac0f541b2cb79cd4",
            "description": "label1 description",
            "name": "label1",
            "id": "a6700594-5b7a-4105-8bfe-723b346ce866",
            "shared": false
        },
        {
            "project_id": "45345b0ee1ea477fac0f541b2cb79cd4",
            "tenant_id": "45345b0ee1ea477fac0f541b2cb79cd4",
            "description": "label2 description",
            "name": "label2",
            "id": "e131d186-b02d-4c0b-83d5-0c0725c4f812",
            "shared": false
        }
    ]
}
POST
/v2.0/metering/metering-labels

创建计量标签

创建 L3 计量标签。

正常响应代码:201

错误响应代码:400、401、403

请求

名称

入参

类型

描述

metering_label

body

对象

一个 metering_label 对象。

shared (Optional)

body

布尔值

指示此计量标签是否在所有项目中共享。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

name (可选)

body

字符串

资源的易读名称。默认情况下为空字符串。

tenant_id (可选)

body

字符串

The ID of the project that owns the resource. Only administrative and users with advsvc role can specify a project ID other than their own. You cannot change this value through authorization policies.

project_id (可选)

body

字符串

The ID of the project that owns the resource. Only administrative and users with advsvc role can specify a project ID other than their own. You cannot change this value through authorization policies.

请求示例

{
    "metering_label": {
        "name": "label1",
        "description": "description of label1"
    }
}

响应参数

名称

入参

类型

描述

metering_label

body

对象

一个 metering_label 对象。

description

body

字符串

A human-readable description for the resource.

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

shared

body

布尔值

指示此计量标签是否在所有项目中共享。

id

body

字符串

计量标签的 ID。

name

body

字符串

Human-readable name of the resource.

响应示例

{
    "metering_label": {
        "project_id": "45345b0ee1ea477fac0f541b2cb79cd4",
        "tenant_id": "45345b0ee1ea477fac0f541b2cb79cd4",
        "description": "description of label1",
        "name": "label1",
        "id": "bc91b832-8465-40a7-a5d8-ba87de442266",
        "shared": false
    }
}
GET
/v2.0/metering/metering-labels/{metering_label_id}

显示计量标签详情

显示计量标签的详细信息。

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

Error response codes: 401, 404

请求

名称

入参

类型

描述

metering_label_id

路径

字符串

计量标签的 ID。

请求示例

GET /v2.0/metering/metering-labels/a6700594-5b7a-4105-8bfe-723b346ce866 HTTP/1.1
Host: controlnode:9696
User-Agent: python-neutronclient
Content-Type: application/json
Accept: application/json
X-Auth-Token: c52a1b304fec4ca0ac85dc1741eec6e2

响应参数

名称

入参

类型

描述

metering_label

body

对象

一个 metering_label 对象。

description

body

字符串

A human-readable description for the resource.

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

shared

body

布尔值

指示此计量标签是否在所有项目中共享。

id

body

字符串

计量标签的 ID。

name

body

字符串

Human-readable name of the resource.

响应示例

{
    "metering_label": {
        "project_id": "45345b0ee1ea477fac0f541b2cb79cd4",
        "tenant_id": "45345b0ee1ea477fac0f541b2cb79cd4",
        "description": "label1 description",
        "name": "label1",
        "id": "a6700594-5b7a-4105-8bfe-723b346ce866",
        "shared": false
    }
}
DELETE
/v2.0/metering/metering-labels/{metering_label_id}

删除计量标签

删除 L3 计量标签。

正常响应代码:204

Error response codes: 401, 404

请求

名称

入参

类型

描述

metering_label_id

路径

字符串

计量标签的 ID。

请求示例

DELETE /v2.0/metering/metering-labels/a6700594-5b7a-4105-8bfe-723b346ce866 HTTP/1.1
Host: controlnode:9696
User-Agent: python-neutronclient
Content-Type: application/json
Accept: application/json
X-Auth-Token: c52a1b304fec4ca0ac85dc1741eec6e2

响应

There is no body content for the response of a successful DELETE request.

GET
/v2.0/metering/metering-label-rules

列出计量标签规则

列出属于项目的全部 L3 计量标签规则的摘要。

列表显示每个计量标签规则的 ID。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

Error response codes: 401

请求

名称

入参

类型

描述

direction (可选)

查询

字符串

按计量规则应用的流量方向过滤计量规则列表结果,即 ingressegress

remote_ip_prefix (可选)

查询

字符串

(已弃用) 按计量规则关联的源 IP 前缀过滤计量规则列表结果。通过源 IP 前缀,应该读取 OpenStack 中使用的内部/专用 IP。

source_ip_prefix (可选)

查询

字符串

计量规则关联的源 IP 前缀;在此上下文中,源 IP 前缀表示网络数据包的源 IP。因此,对于入口规则,源 IP 是访问 OpenStack 内部内容的系统的 IP。另一方面,对于出口规则,源 IP 是与某些 OpenStack VM 关联的内部 IP。此外,除了 IP 之外,还可以使用 CIDR 作为源 IP 前缀。

destination_ip_prefix (可选)

查询

字符串

计量规则关联的目标 IP 前缀;在此上下文中,目标 IP 前缀表示网络数据包的目标 IP。因此,对于入口规则,目标 IP 是与某些 OpenStack VM 关联的内部 IP。另一方面,对于出口规则,目标 IP 前缀是虚拟机内部应用程序尝试访问的某个外部系统的 IP。此外,除了 IP 之外,还可以使用 CIDR 作为目标 IP 前缀。

excluded (可选)

查询

布尔值

根据计量规则是否排除具有 remote_ip_prefix 值的特定 IP 地址的流量来过滤计量规则列表结果。

metering_label_id (可选)

查询

字符串

按与此计量规则关联的计量标签 ID 来过滤计量规则列表结果。

id (可选)

查询

字符串

Filter the list result by the ID of the resource.

sort_dir (可选)

查询

字符串

Sort direction. A valid value is asc (ascending) or desc (descending). You can specify multiple pairs of sort key and sort direction query parameters.

sort_key (可选)

查询

字符串

按计量标签属性排序。您可以指定多个排序键和排序方向查询参数。排序键限于

  • id

  • metering_label_id

  • excluded

  • remote_ip_prefix

  • direction

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

metering_label_rules

body

数组

metering_label_rule 对象列表。

direction

body

字符串

入口或出口,这是计量规则应用的流量方向。

remote_ip_prefix

body

字符串

(已弃用) 此计量规则匹配的源 IP 前缀。通过源 IP 前缀,应该读取 OpenStack 中使用的内部/专用 IP。

source_ip_prefix (可选)

查询

字符串

计量规则关联的源 IP 前缀;在此上下文中,源 IP 前缀表示网络数据包的源 IP。因此,对于入口规则,源 IP 是访问 OpenStack 内部内容的系统的 IP。另一方面,对于出口规则,源 IP 是与某些 OpenStack VM 关联的内部 IP。此外,除了 IP 之外,还可以使用 CIDR 作为源 IP 前缀。

destination_ip_prefix (可选)

查询

字符串

计量规则关联的目标 IP 前缀;在此上下文中,目标 IP 前缀表示网络数据包的目标 IP。因此,对于入口规则,目标 IP 是与某些 OpenStack VM 关联的内部 IP。另一方面,对于出口规则,目标 IP 前缀是虚拟机内部应用程序尝试访问的某个外部系统的 IP。此外,除了 IP 之外,还可以使用 CIDR 作为目标 IP 前缀。

excluded

body

布尔值

指示是否计算具有 remote_ip_prefixsource_ip_prefixdestination_ip_prefix 值的特定 IP 地址的流量。

metering_label_id

body

字符串

与此计量规则关联的计量标签 ID。

id

body

字符串

计量标签规则的 ID。

响应示例

{
    "metering_label_rules": [
        {
            "remote_ip_prefix": "20.0.0.0/24",
            "direction": "ingress",
            "metering_label_id": "e131d186-b02d-4c0b-83d5-0c0725c4f812",
            "id": "9536641a-7d14-4dc5-afaf-93a973ce0eb8",
            "excluded": false
        },
        {
            "remote_ip_prefix": "10.0.0.0/24",
            "direction": "ingress",
            "metering_label_id": "e131d186-b02d-4c0b-83d5-0c0725c4f812",
            "id": "ffc6fd15-40de-4e7d-b617-34d3f7a93aec",
            "excluded": false
        }
    ]
}
POST
/v2.0/metering/metering-label-rules

创建计量标签规则

创建 L3 计量标签规则。

正常响应代码:201

错误响应代码:400、401、403、404、409

请求

名称

入参

类型

描述

metering_label_rule

body

对象

一个 metering_label_rule 对象。

remote_ip_prefix

body

字符串

(已弃用) 此计量规则匹配的源 IP 前缀。通过源 IP 前缀,应该读取 OpenStack 中使用的内部/专用 IP。

source_ip_prefix (可选)

查询

字符串

计量规则关联的源 IP 前缀;在此上下文中,源 IP 前缀表示网络数据包的源 IP。因此,对于入口规则,源 IP 是访问 OpenStack 内部内容的系统的 IP。另一方面,对于出口规则,源 IP 是与某些 OpenStack VM 关联的内部 IP。此外,除了 IP 之外,还可以使用 CIDR 作为源 IP 前缀。

destination_ip_prefix (可选)

查询

字符串

计量规则关联的目标 IP 前缀;在此上下文中,目标 IP 前缀表示网络数据包的目标 IP。因此,对于入口规则,目标 IP 是与某些 OpenStack VM 关联的内部 IP。另一方面,对于出口规则,目标 IP 前缀是虚拟机内部应用程序尝试访问的某个外部系统的 IP。此外,除了 IP 之外,还可以使用 CIDR 作为目标 IP 前缀。

direction

body

字符串

入口或出口,这是计量规则应用的流量方向。

metering_label_id

body

字符串

与此计量规则关联的计量标签 ID。

excluded (可选)

body

布尔值

指示是否计算具有 remote_ip_prefixsource_ip_prefixdestination_ip_prefix 值的特定 IP 地址的流量。默认值为 false

请求示例

{
    "metering_label_rule": {
        "remote_ip_prefix": "10.0.1.0/24",
        "direction": "ingress",
        "metering_label_id": "e131d186-b02d-4c0b-83d5-0c0725c4f812"
    }
}

响应参数

名称

入参

类型

描述

metering_label_rule

body

对象

一个 metering_label_rule 对象。

direction

body

字符串

入口或出口,这是计量规则应用的流量方向。

remote_ip_prefix

body

字符串

(已弃用) 此计量规则匹配的源 IP 前缀。通过源 IP 前缀,应该读取 OpenStack 中使用的内部/专用 IP。

source_ip_prefix (可选)

查询

字符串

计量规则关联的源 IP 前缀;在此上下文中,源 IP 前缀表示网络数据包的源 IP。因此,对于入口规则,源 IP 是访问 OpenStack 内部内容的系统的 IP。另一方面,对于出口规则,源 IP 是与某些 OpenStack VM 关联的内部 IP。此外,除了 IP 之外,还可以使用 CIDR 作为源 IP 前缀。

destination_ip_prefix (可选)

查询

字符串

计量规则关联的目标 IP 前缀;在此上下文中,目标 IP 前缀表示网络数据包的目标 IP。因此,对于入口规则,目标 IP 是与某些 OpenStack VM 关联的内部 IP。另一方面,对于出口规则,目标 IP 前缀是虚拟机内部应用程序尝试访问的某个外部系统的 IP。此外,除了 IP 之外,还可以使用 CIDR 作为目标 IP 前缀。

excluded

body

布尔值

指示是否计算具有 remote_ip_prefixsource_ip_prefixdestination_ip_prefix 值的特定 IP 地址的流量。

metering_label_id

body

字符串

与此计量规则关联的计量标签 ID。

id

body

字符串

计量标签规则的 ID。

响应示例

{
    "metering_label_rule": {
        "remote_ip_prefix": "10.0.1.0/24",
        "direction": "ingress",
        "metering_label_id": "e131d186-b02d-4c0b-83d5-0c0725c4f812",
        "id": "00e13b58-b4f2-4579-9c9c-7ac94615f9ae",
        "excluded": false
    }
}
GET
/v2.0/metering/metering-label-rules/{metering_label_rule_id}

显示计量标签规则详情

显示计量标签规则的详细信息。

响应正文显示每个计量标签规则的此信息

  • direction。入口或出口。

  • excludedtruefalse

  • 计量标签规则的 ID。

  • 远程 IP 前缀 (已弃用)。

  • 源 IP 前缀

  • 目标 IP 前缀

  • 与规则关联的计量标签的计量标签 ID。

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

Error response codes: 401, 404

请求

名称

入参

类型

描述

metering_label_rule_id

路径

字符串

计量标签规则的 ID。

请求示例

GET /v2.0/metering/metering-label-rules/9536641a-7d14-4dc5-afaf-93a973ce0eb8 HTTP/1.1
Host: controlnode:9696
User-Agent: python-neutronclient
Content-Type: application/json
Accept: application/json
X-Auth-Token: c52a1b304fec4ca0ac85dc1741eec6e2

响应参数

名称

入参

类型

描述

metering_label_rule

body

对象

一个 metering_label_rule 对象。

direction

body

字符串

入口或出口,这是计量规则应用的流量方向。

remote_ip_prefix

body

字符串

(已弃用) 此计量规则匹配的源 IP 前缀。通过源 IP 前缀,应该读取 OpenStack 中使用的内部/专用 IP。

source_ip_prefix (可选)

查询

字符串

计量规则关联的源 IP 前缀;在此上下文中,源 IP 前缀表示网络数据包的源 IP。因此,对于入口规则,源 IP 是访问 OpenStack 内部内容的系统的 IP。另一方面,对于出口规则,源 IP 是与某些 OpenStack VM 关联的内部 IP。此外,除了 IP 之外,还可以使用 CIDR 作为源 IP 前缀。

destination_ip_prefix (可选)

查询

字符串

计量规则关联的目标 IP 前缀;在此上下文中,目标 IP 前缀表示网络数据包的目标 IP。因此,对于入口规则,目标 IP 是与某些 OpenStack VM 关联的内部 IP。另一方面,对于出口规则,目标 IP 前缀是虚拟机内部应用程序尝试访问的某个外部系统的 IP。此外,除了 IP 之外,还可以使用 CIDR 作为目标 IP 前缀。

excluded

body

布尔值

指示是否计算具有 remote_ip_prefixsource_ip_prefixdestination_ip_prefix 值的特定 IP 地址的流量。

metering_label_id

body

字符串

与此计量规则关联的计量标签 ID。

id

body

字符串

计量标签规则的 ID。

响应示例

{
    "metering_label_rule": {
        "remote_ip_prefix": "20.0.0.0/24",
        "direction": "ingress",
        "metering_label_id": "e131d186-b02d-4c0b-83d5-0c0725c4f812",
        "id": "9536641a-7d14-4dc5-afaf-93a973ce0eb8",
        "excluded": false
    }
}
DELETE
/v2.0/metering/metering-label-rules/{metering_label_rule_id}

删除计量标签规则

删除 L3 计量标签规则。

正常响应代码:204

Error response codes: 401, 404

请求

名称

入参

类型

描述

metering_label_rule_id

路径

字符串

计量标签规则的 ID。

请求示例

DELETE /v2.0/metering/metering-labels/37b31179-71ee-4f0a-b130-0eeb28e7ede7 HTTP/1.1
Host: controlnode:9696
User-Agent: python-neutronclient
Content-Type: application/json
Accept: application/json
X-Auth-Token: c52a1b304fec4ca0ac85dc1741eec6e2

响应

There is no body content for the response of a successful DELETE request.

网络 IP 可用性和使用统计

network-ip-availability 扩展允许用户列出和显示所有网络或指定网络的网络 IP 使用统计信息。根据默认策略配置,只有管理员用户才能使用此 API。

网络 IP 可用性详情

network-ip-availability-detail 扩展向网络 IP 可用性添加了 ip_availability_details 属性。此属性的值包含有关网络 IP 使用统计信息的详细信息。

GET
/v2.0/network-ip-availabilities/{network_id}

显示网络 IP 可用性

显示网络的网络 IP 可用性详情。

根据默认策略配置,只有管理员用户才能检索 IP 可用性。否则,将返回 Not Found (404)

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

Error response codes: 401, 404

请求

名称

入参

类型

描述

network_id

路径

字符串

The ID of the network.

响应参数

名称

入参

类型

描述

network_ip_availability

body

对象

一个 network_ip_availability 对象。

network_id

body

字符串

报告 IP 可用性详情的网络的 ID。

network_name

body

字符串

Human-readable name of the network.

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

total_ips

body

整数

网络中的总 IP 地址数。

used_ips

body

整数

网络中所有子网的已用 IP 地址数。

ip_availability_details

body

dict

网络的 IP 可用性详细信息。此字段包括以下属性:total_ips_in_subnet 是子网 CIDR 中的可用 IP 数量,total_ips_in_allocation_pool 是每个分配池中的可用 IP 总和(如果没有分配池则为 0),used_ips_in_subnet 是子网中已用的 IP 数量(不考虑分配池),used_ips_in_allocation_pool 是每个分配池中已用的 IP 总和(如果没有分配池则为 0)。

subnet_ip_availability

body

数组

字典列表,显示子网 IP 可用性。它包含与网络关联的每个子网的信息。

subnet_id

body

字符串

报告 IP 可用性详情的子网的 ID。

subnet_name

body

字符串

子网的名称。

ip_version

body

整数

IP 协议版本。值为 46

cidr

body

字符串

子网的 CIDR。

响应示例

{
    "network_ip_availability": {
        "used_ips": 4,
        "subnet_ip_availability": [
            {
                "used_ips": 2,
                "subnet_id": "44e70d00-80a2-4fb1-ab59-6190595ceb61",
                "subnet_name": "private-subnet",
                "ip_version": 4,
                "cidr": "10.0.0.0/24",
                "total_ips": 253,
                "ip_availability_details": {
                    "total_ips_in_subnet": 254,
                    "total_ips_in_allocation_pool": 253,
                    "used_ips_in_subnet": 2,
                    "used_ips_in_allocation_pool": 1
                }
            },
            {
                "used_ips": 2,
                "subnet_id": "a90623df-00e1-4902-a675-40674385d74c",
                "subnet_name": "ipv6-private-subnet",
                "ip_version": 6,
                "cidr": "fdbf:ac66:9be8::/64",
                "total_ips": 18446744073709551000,
                "ip_availability_details": {
                    "total_ips_in_subnet": 18446744073709551616,
                    "total_ips_in_allocation_pool": 18446744073709551000,
                    "used_ips_in_subnet": 2,
                    "used_ips_in_allocation_pool": 1
                }
            }
        ],
        "network_id": "6801d9c8-20e6-4b27-945d-62499f00002e",
        "project_id": "d56d3b8dd6894a508cf41b96b522328c",
        "tenant_id": "d56d3b8dd6894a508cf41b96b522328c",
        "total_ips": 18446744073709551253,
        "network_name": "private",
        "ip_availability_details": {
            "total_ips_in_subnet": 18446744073709551870,
            "total_ips_in_allocation_pool": 18446744073709551253,
            "used_ips_in_subnet": 4,
            "used_ips_in_allocation_pool": 2
        }
    }
}
GET
/v2.0/network-ip-availabilities

列出网络 IP 可用性

列出所有网络的网络 IP 可用性。

根据默认策略配置,只有管理员用户才能检索 IP 可用性。否则,将返回空列表。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

Error response codes: 401

请求

名称

入参

类型

描述

network_id (Optional)

查询

字符串

按报告 IP 可用性详情的网络 ID 过滤列表结果。

network_name (可选)

查询

字符串

按网络的易读名称过滤列表结果。

tenant_id (可选)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

project_id (可选)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

ip_version (Optional)

查询

整数

按IP协议版本过滤列表结果。有效值为46

响应参数

名称

入参

类型

描述

network_ip_availabilities

body

数组

network_ip_availabilities 对象。

network_id

body

字符串

报告 IP 可用性详情的网络的 ID。

network_name

body

字符串

Human-readable name of the network.

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

total_ips

body

整数

网络中的总 IP 地址数。

used_ips

body

整数

网络中所有子网的已用 IP 地址数。

ip_availability_details

body

dict

网络的 IP 可用性详细信息。此字段包括以下属性:total_ips_in_subnet 是子网 CIDR 中的可用 IP 数量,total_ips_in_allocation_pool 是每个分配池中的可用 IP 总和(如果没有分配池则为 0),used_ips_in_subnet 是子网中已用的 IP 数量(不考虑分配池),used_ips_in_allocation_pool 是每个分配池中已用的 IP 总和(如果没有分配池则为 0)。

subnet_ip_availability

body

数组

字典列表,显示子网 IP 可用性。它包含与网络关联的每个子网的信息。

subnet_id

body

字符串

报告 IP 可用性详情的子网的 ID。

subnet_name

body

字符串

子网的名称。

ip_version

body

整数

IP 协议版本。值为 46

cidr

body

字符串

子网的 CIDR。

响应示例

{
    "network_ip_availabilities": [
        {
            "network_id": "4cf895c9-c3d1-489e-b02e-59b5c8976809",
            "network_name": "public",
            "subnet_ip_availability": [
                {
                    "cidr": "2001:db8::/64",
                    "ip_version": 6,
                    "subnet_id": "ca3f46c4-c6ff-4272-9be4-0466f84c6077",
                    "subnet_name": "ipv6-public-subnet",
                    "total_ips": 18446744073709551000,
                    "used_ips": 1,
                    "ip_availability_details": {
                        "total_ips_in_subnet": 18446744073709551616,
                        "total_ips_in_allocation_pool": 18446744073709551000,
                        "used_ips_in_subnet": 1,
                        "used_ips_in_allocation_pool": 1
                    }
                },
                {
                    "cidr": "172.24.4.0/24",
                    "ip_version": 4,
                    "subnet_id": "cc02efc1-9d47-46bd-bab6-760919c836b5",
                    "subnet_name": "public-subnet",
                    "total_ips": 253,
                    "used_ips": 1,
                    "ip_availability_details": {
                        "total_ips_in_subnet": 254,
                        "total_ips_in_allocation_pool": 253,
                        "used_ips_in_subnet": 1,
                        "used_ips_in_allocation_pool": 1
                    }
                }
            ],
            "project_id": "1a02cc95f1734fcc9d3c753818f03002",
            "tenant_id": "1a02cc95f1734fcc9d3c753818f03002",
            "total_ips": 18446744073709551253,
            "used_ips": 2,
            "ip_availability_details": {
                "total_ips_in_subnet": 18446744073709551870,
                "total_ips_in_allocation_pool": 18446744073709551253,
                "used_ips_in_subnet": 2,
                "used_ips_in_allocation_pool": 2
            }
        },
        {
            "network_id": "6801d9c8-20e6-4b27-945d-62499f00002e",
            "network_name": "private",
            "subnet_ip_availability": [
                {
                    "cidr": "10.0.0.0/24",
                    "ip_version": 4,
                    "subnet_id": "44e70d00-80a2-4fb1-ab59-6190595ceb61",
                    "subnet_name": "private-subnet",
                    "total_ips": 253,
                    "used_ips": 2,
                    "ip_availability_details": {
                        "total_ips_in_subnet": 254,
                        "total_ips_in_allocation_pool": 253,
                        "used_ips_in_subnet": 2,
                        "used_ips_in_allocation_pool": 1
                    }
                },
                {
                    "ip_version": 6,
                    "cidr": "fdbf:ac66:9be8::/64",
                    "subnet_id": "a90623df-00e1-4902-a675-40674385d74c",
                    "subnet_name": "ipv6-private-subnet",
                    "total_ips": 18446744073709551000,
                    "used_ips": 2,
                    "ip_availability_details": {
                        "total_ips_in_subnet": 18446744073709551616,
                        "total_ips_in_allocation_pool": 18446744073709551000,
                        "used_ips_in_subnet": 2,
                        "used_ips_in_allocation_pool": 1
                    }
                }
            ],
            "project_id": "d56d3b8dd6894a508cf41b96b522328c",
            "tenant_id": "d56d3b8dd6894a508cf41b96b522328c",
            "total_ips": 18446744073709551253,
            "used_ips": 4,
            "ip_availability_details": {
                "total_ips_in_subnet": 18446744073709551870,
                "total_ips_in_allocation_pool": 18446744073709551253,
                "used_ips_in_subnet": 4,
                "used_ips_in_allocation_pool": 2
            }
        }
    ]
}

配额扩展 (quotas)

列出默认配额、项目非默认配额值、显示、更新和重置项目配额。

值为 -1 的配额表示该配额没有限制。

GET
/v2.0/quotas

列出项目非默认配额值

列出项目非默认配额值。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

错误响应代码:401, 403

请求

响应参数

名称

入参

类型

描述

quotas

body

数组

配额对象列表。

floatingip

body

整数

每个项目允许的浮动 IP 地址数量。值为 -1 表示没有限制。

network

body

整数

每个项目允许的网络数量。值为 -1 表示没有限制。

port

body

整数

每个项目允许的端口数量。值为 -1 表示没有限制。

project_id

body

字符串

项目的 ID。

rbac_policy

body

整数

每个项目的基于角色的访问控制 (RBAC) 策略数量。值为 -1 表示没有限制。

router

body

整数

每个项目允许的路由器数量。值为 -1 表示没有限制。

security_group

body

整数

每个项目允许的安全组数量。值为 -1 表示没有限制。

security_group_rule

body

整数

每个项目允许的安全组规则数量。值为 -1 表示没有限制。

subnet

body

整数

每个项目允许的子网数量。值为 -1 表示没有限制。

subnetpool

body

整数

每个项目允许的子网池数量。值为 -1 表示没有限制。

tenant_id

body

字符串

项目的 ID。

响应示例

{
    "quotas": [
        {
            "floatingip": 50,
            "network": 15,
            "port": 50,
            "project_id": "bab7d5c60cd041a0a36f7c4b6e1dd978",
            "rbac_policy": -1,
            "router": 10,
            "security_group": 10,
            "security_group_rule": 100,
            "subnet": 10,
            "subnetpool": -1,
            "tenant_id": "bab7d5c60cd041a0a36f7c4b6e1dd978"
        }
    ]
}
GET
/v2.0/quotas/{project_id}

列出项目配额

列出项目配额。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

错误响应代码:401, 403

请求

名称

入参

类型

描述

project_id

路径

字符串

项目的 ID。

响应参数

名称

入参

类型

描述

quota

body

对象

一个 quota 对象。

floatingip

body

整数

每个项目允许的浮动 IP 地址数量。值为 -1 表示没有限制。

network

body

整数

每个项目允许的网络数量。值为 -1 表示没有限制。

port

body

整数

每个项目允许的端口数量。值为 -1 表示没有限制。

rbac_policy

body

整数

每个项目的基于角色的访问控制 (RBAC) 策略数量。值为 -1 表示没有限制。

router

body

整数

每个项目允许的路由器数量。值为 -1 表示没有限制。

security_group

body

整数

每个项目允许的安全组数量。值为 -1 表示没有限制。

security_group_rule

body

整数

每个项目允许的安全组规则数量。值为 -1 表示没有限制。

subnet

body

整数

每个项目允许的子网数量。值为 -1 表示没有限制。

subnetpool

body

整数

每个项目允许的子网池数量。值为 -1 表示没有限制。

响应示例

{
    "quota": {
        "floatingip": 50,
        "network": 10,
        "port": 50,
        "rbac_policy": -1,
        "router": 10,
        "security_group": 10,
        "security_group_rule": 100,
        "subnet": 10,
        "subnetpool": -1
    }
}
PUT
/v2.0/quotas/{project_id}

更新项目配额

更新项目配额。在需要非默认配额时使用。

正常响应代码:200

错误响应代码:401, 403

请求

名称

入参

类型

描述

project_id

路径

字符串

项目的 ID。

quota

body

对象

一个 quota 对象。

floatingip (可选)

body

整数

每个项目允许的浮动 IP 地址数量。值为 -1 表示没有限制。

network (可选)

body

整数

每个项目允许的网络数量。值为 -1 表示没有限制。

port (Optional)

body

整数

每个项目允许的端口数量。值为 -1 表示没有限制。

rbac_policy (可选)

body

整数

每个项目的基于角色的访问控制 (RBAC) 策略数量。值为 -1 表示没有限制。

router (可选)

body

整数

每个项目允许的路由器数量。值为 -1 表示没有限制。

security_group (可选)

body

整数

每个项目允许的安全组数量。值为 -1 表示没有限制。

security_group_rule (可选)

body

整数

每个项目允许的安全组规则数量。值为 -1 表示没有限制。

subnet (可选)

body

整数

每个项目允许的子网数量。值为 -1 表示没有限制。

subnetpool (可选)

body

整数

每个项目允许的子网池数量。值为 -1 表示没有限制。

check_limit (可选)

body

对象

(已弃用) 在 quota 更新命令中使用的标志。如果启用,配额引擎将在应用新的配额限制之前检查资源使用情况。

force (可选)

body

对象

quota 更新命令中使用的标志。如果启用,配额引擎将在应用新的配额限制之前不检查资源使用情况。

请求示例

{
    "quota": {
        "floatingip": 50,
        "network": 10,
        "port": 50,
        "rbac_policy": -1,
        "router": 10,
        "security_group": 10,
        "security_group_rule": 100,
        "subnet": 10,
        "subnetpool": -1,
        "check_limit": "True",
        "force": "False"
    }
}

响应参数

名称

入参

类型

描述

quota

body

对象

一个 quota 对象。

floatingip

body

整数

每个项目允许的浮动 IP 地址数量。值为 -1 表示没有限制。

network

body

整数

每个项目允许的网络数量。值为 -1 表示没有限制。

port

body

整数

每个项目允许的端口数量。值为 -1 表示没有限制。

rbac_policy

body

整数

每个项目的基于角色的访问控制 (RBAC) 策略数量。值为 -1 表示没有限制。

router

body

整数

每个项目允许的路由器数量。值为 -1 表示没有限制。

security_group

body

整数

每个项目允许的安全组数量。值为 -1 表示没有限制。

security_group_rule

body

整数

每个项目允许的安全组规则数量。值为 -1 表示没有限制。

subnet

body

整数

每个项目允许的子网数量。值为 -1 表示没有限制。

subnetpool

body

整数

每个项目允许的子网池数量。值为 -1 表示没有限制。

响应示例

{
    "quota": {
        "subnet": 10,
        "network": 15,
        "floatingip": 50,
        "subnetpool": -1,
        "security_group_rule": 100,
        "security_group": 10,
        "router": 10,
        "rbac_policy": -1,
        "port": 50
    }
}
DELETE
/v2.0/quotas/{project_id}

重置项目配额

将项目配额重置为默认值。

正常响应代码:204

错误响应代码:401、403、404

请求

名称

入参

类型

描述

project_id

路径

字符串

项目的 ID。

响应

There is no body content for the response of a successful DELETE request.

GET
/v2.0/quotas/{project_id}/default

列出项目默认配额

列出项目默认配额。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

错误响应代码:401, 403

请求

名称

入参

类型

描述

project_id

路径

字符串

项目的 ID。

响应参数

名称

入参

类型

描述

quota

body

对象

一个 quota 对象。

floatingip

body

整数

每个项目允许的浮动 IP 地址数量。值为 -1 表示没有限制。

network

body

整数

每个项目允许的网络数量。值为 -1 表示没有限制。

port

body

整数

每个项目允许的端口数量。值为 -1 表示没有限制。

rbac_policy

body

整数

每个项目的基于角色的访问控制 (RBAC) 策略数量。值为 -1 表示没有限制。

router

body

整数

每个项目允许的路由器数量。值为 -1 表示没有限制。

security_group

body

整数

每个项目允许的安全组数量。值为 -1 表示没有限制。

security_group_rule

body

整数

每个项目允许的安全组规则数量。值为 -1 表示没有限制。

subnet

body

整数

每个项目允许的子网数量。值为 -1 表示没有限制。

subnetpool

body

整数

每个项目允许的子网池数量。值为 -1 表示没有限制。

响应示例

{
    "quota": {
        "floatingip": 50,
        "network": 10,
        "port": 50,
        "rbac_policy": -1,
        "router": 10,
        "security_group": 10,
        "security_group_rule": 100,
        "subnet": 10,
        "subnetpool": -1
    }
}

配额详细信息扩展 (quota_details)

扩展 quotas API,以显示每个项目的配额集,该配额集包括每个资源的已用量、限制和保留计数。

值为 -1 的配额表示该配额没有限制。

GET
/v2.0/quotas/{project_id}/details.json

显示租户的配额详细信息

显示项目的配额详细信息。

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

错误响应代码:401, 403

请求

名称

入参

类型

描述

project_id

路径

字符串

项目的 ID。

响应参数

名称

入参

类型

描述

quota

body

对象

一个 quota 详细信息对象。对象中的每个键对应一个具有配额的资源类型(networkport 等)。每个资源类型的值本身就是一个对象(配额集),其中包含配额的 usedlimitreserved 整数值。

响应示例

{
    "quota": {
        "rbac_policy": {
            "used": 4,
            "limit": 10,
            "reserved": 0
        },
        "subnetpool": {
            "used": 2,
            "limit": -1,
            "reserved": 0
        },
        "security_group_rule": {
            "used": 10,
            "limit": 100,
            "reserved": 1
        },
        "security_group": {
            "used": 3,
            "limit": 10,
            "reserved": 0
        },
        "subnet": {
            "used": 3,
            "limit": 100,
            "reserved": 0
        },
        "port": {
            "used": 21,
            "limit": 500,
            "reserved": 3
        },
        "network" :{
            "used": 9,
            "limit": 100,
            "reserved": 2
        }
    }
}

服务提供商

列出服务提供商。

GET
/v2.0/service-providers

列出服务提供商

列出服务提供商及其关联的服务类型。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

Error response codes: 401

请求

名称

入参

类型

描述

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

service_providers

body

数组

service_provider 对象列表。

service_type

body

字符串

服务类型,包括 COREDUMMYFIREWALLFLAVORSL3_ROUTER_NATMETERINGQOSVPN

name

body

字符串

Human-readable name of the resource.

default

body

布尔值

定义提供商是否是服务类型的默认提供商。如果此值为 true,则提供商是默认提供商。如果此值为 false,则提供商不是默认提供商。

响应示例

{
    "service_providers": [
        {
            "service_type": "FIREWALL",
            "default": true,
            "name": "haproxy"
        }
    ]
}

标签扩展 (tags)

显示标签的详细信息、更新和删除标签。

标签允许的最大字符数为 255。如果长度超过 255,API 将返回 HTTP Bad Request (400) 响应代码,并带有“invalid input for operation”错误消息。

标准属性标签扩展

standard-attr-tag 将标签支持扩展到一些支持标准属性的资源。这包括网络、端口、子网、子网池、浮动 IP、路由器、安全组、安全组规则、QoS 策略和 trunk。

POST
/v2.0/{resource_type}/{resource_id}/tags

创建标签

为资源创建多个标签。

正常响应代码:200

错误响应代码:400、401、403

请求

名称

入参

类型

描述

resource_type

路径

字符串

设置标签的资源类型。

resource_id

路径

字符串

设置标签的资源 ID。

tags

body

数组

The list of tags on the resource.

请求示例

{
    "tags": [
        "red",
        "blue"
    ]
}
PUT
/v2.0/{resource_type}/{resource_id}/tags

替换所有标签

替换资源上的所有标签。

正常响应代码:200

错误响应代码:400、401、404

请求

名称

入参

类型

描述

resource_type

路径

字符串

设置标签的资源类型。

resource_id

路径

字符串

设置标签的资源 ID。

tags

body

数组

The list of tags on the resource.

请求示例

{
    "tags": [
        "red",
        "blue"
    ]
}

响应参数

名称

入参

类型

描述

tags

body

数组

The list of tags on the resource.

响应示例

{
    "tags": [
        "red",
        "blue"
    ]
}
DELETE
/v2.0/{resource_type}/{resource_id}/tags

删除所有标签

删除资源上的所有标签。

正常响应代码:204

Error response codes: 401, 404

请求

名称

入参

类型

描述

resource_type

路径

字符串

设置标签的资源类型。

resource_id

路径

字符串

设置标签的资源 ID。

响应

There is no body content for the response of a successful DELETE request.

GET
/v2.0/{resource_type}/{resource_id}/tags/{tag}

确认标签

确认给定的标签是否已设置在资源上。

正常响应代码:204

Error response codes: 401, 404

请求

名称

入参

类型

描述

resource_type

路径

字符串

设置标签的资源类型。

resource_id

路径

字符串

设置标签的资源 ID。

tag

路径

字符串

标签的名称。

响应

成功的 GET 请求没有响应体内容。

PUT
/v2.0/{resource_type}/{resource_id}/tags/{tag}

添加标签

为资源添加标签。

正常响应代码:201

Error response codes: 401, 404

请求

名称

入参

类型

描述

resource_type

路径

字符串

设置标签的资源类型。

resource_id

路径

字符串

设置标签的资源 ID。

tag

路径

字符串

标签的名称。

响应

成功的 PUT 请求没有响应体内容。

GET
/v2.0/{resource_type}/{resource_id}/tags

获取标签列表

获取资源的标签。

正常响应代码:200

Error response codes: 401, 404

请求

名称

入参

类型

描述

resource_type

路径

字符串

设置标签的资源类型。

resource_id

路径

字符串

设置标签的资源 ID。

响应

名称

入参

类型

描述

tags

body

数组

The list of tags on the resource.

响应示例

{
    "tags": [
        "red",
        "blue"
    ]
}
DELETE
/v2.0/{resource_type}/{resource_id}/tags/{tag}

删除标签

删除资源的标签。

正常响应代码:204

Error response codes: 401, 404

请求

名称

入参

类型

描述

resource_type

路径

字符串

设置标签的资源类型。

resource_id

路径

字符串

设置标签的资源 ID。

tag

路径

字符串

标签的名称。

响应

There is no body content for the response of a successful DELETE request.

服务质量

QoS 规则类型

列出并显示当前部署中可用的 QoS 规则类型信息。

规则类型详细信息

名为 qos-rule-type-details 的扩展为 QoS 规则类型添加了 drivers 属性。 drivers 属性的值是一个驱动程序对象列表。每个驱动程序对象代表一个已加载的后端 QoS 驱动程序,包括驱动程序的 name 以及其 supported_parameters 和可接受值列表。

GET
/v2.0/qos/rule-types

列出 QoS 规则类型

列出可用的 qos 规则类型。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

Error response codes: 401

请求

名称

入参

类型

描述

all_supported (可选)

body

布尔值

设置为 true 可返回任何加载的驱动程序支持的所有 QoS 规则类型。

all_rules (可选)

body

布尔值

设置为 true 可返回 Neutron 服务器中实现的所有 QoS 规则类型。

响应参数

名称

入参

类型

描述

rule_types

body

数组

QoS rule_type 对象列表。

type

body

字符串

QoS 规则的类型。

响应示例

{
    "rule_types": [
        {
            "type": "bandwidth_limit"
        },
        {
            "type": "dscp_marking"
        },
        {
            "type": "minimum_bandwidth"
        }
    ]
}
GET
/v2.0/qos/rule-types/{rule_type}

显示 QoS 规则类型详细信息

显示可用 QoS 规则类型的详细信息。

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

Error response codes: 401, 404

请求

名称

入参

类型

描述

rule_type

路径

字符串

QoS 规则类型的名称。它应该是 List QoS rule types API 返回的类型之一,例如 bandwidth_limitdscp_marking

响应参数

名称

入参

类型

描述

type

body

字符串

QoS 规则的类型。

驱动程序

body

列表

加载的 QoS 驱动程序列表,包含支持的规则类型参数及其每个参数的可能值。每个驱动程序都由一个具有 namesupported_parameters 键的字典表示。 name 字段包含后端驱动程序的名称。 supported_parameters 字段包含一个字典列表,其中包含 parameter_nameparameter_typeparameter_values 字段。 parameter_type 的有效值为 choicesrange。如果 parameter_typechoices,则 parameter_values 包含一个可接受值列表,否则它包含一个带有 startend 键的字典,这些键定义了可接受值的范围。

响应示例(类型“bandwidth_limit”)

{
    "drivers": [
        {
            "name": "openvswitch",
            "supported_parameters": [
                {
                    "parameter_name": "max_kbps",
                    "parameter_type": "range",
                    "parameter_values": {
                        "end": 2147483647,
                        "start": 0
                    }
                },
                {
                    "parameter_name": "direction",
                    "parameter_type": "choices",
                    "parameter_values": [
                        "ingress",
                        "egress"
                    ]
                },
                {
                    "parameter_name": "max_burst_kbps",
                    "parameter_type": "range",
                    "parameter_values": {
                        "end": 2147483647,
                        "start": 0
                    }
                }
            ]
        },
        {
            "name": "linuxbridge",
            "supported_parameters": [
                {
                    "parameter_name": "max_kbps",
                    "parameter_type": "range",
                    "parameter_values": {
                        "end": 2147483647,
                        "start": 0
                    }
                },
                {
                    "parameter_name": "direction",
                    "parameter_type": "choices",
                    "parameter_values": [
                        "ingress",
                        "egress"
                    ]
                },
                {
                    "parameter_name": "max_burst_kbps",
                    "parameter_type": "range",
                    "parameter_values": {
                        "end": 2147483647,
                        "start": 0
                    }
                }
            ]
        }
    ],
    "type": "bandwidth_limit"
}

响应示例(类型“dscp_marking”)

{
    "drivers": [
        {
            "name": "openvswitch",
            "supported_parameters": [
                {
                    "parameter_name": "dscp_mark",
                    "parameter_type": "choices",
                    "parameter_values": [
                        0, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 44, 46, 48, 56
                    ]
                }
            ]
        },
        {
            "name": "linuxbridge",
            "supported_parameters": [
                {
                    "parameter_name": "dscp_mark",
                    "parameter_type": "choices",
                    "parameter_values": [
                        0, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 44, 46, 48, 56
                    ]
                }
            ]
        }
    ],
    "type": "dscp_marking"
}

QoS 策略 (qos)

列出、创建、删除、显示 QoS 策略信息并更新 QoS 策略。

资源时间戳扩展

The standard-attr-timestamp extension adds the created_at and updated_at attributes to all resources that have standard attributes.

QoS 默认扩展

QoS 默认扩展(qos-default)通过向 policy 资源添加 is_default 属性,允许为每个项目设置默认 QoS 策略。

标签扩展

The standard-attr-tag adds Tag support for resources with standard attributes by adding the tags attribute allowing consumers to associate tags with resources.

GET
/v2.0/qos/policies

列出 QoS 策略

列出与您的项目关联的所有 QoS 策略。一个策略可以包含多个规则类型。

列表可能为空。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

Error response codes: 401

请求

名称

入参

类型

描述

description (可选)

查询

字符串

Filter the list result by the human-readable description of the resource.

tenant_id (可选)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

project_id (可选)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

revision_number (Optional)

查询

整数

Filter the list result by the revision number of the resource.

shared (Optional)

查询

布尔值

根据此策略是否在所有项目中共享来过滤 QoS 策略列表结果。

id (可选)

查询

字符串

Filter the list result by the ID of the resource.

is_default (Optional)

查询

布尔值

根据此策略是否为默认策略来过滤 QoS 策略列表结果。

name (可选)

查询

字符串

Filter the list result by the human-readable name of the resource.

tags (可选)

查询

字符串

A list of tags to filter the list result by. Resources that match all tags in this list will be returned. Tags in query must be separated by comma.

tags-any (Optional)

查询

字符串

A list of tags to filter the list result by. Resources that match any tag in this list will be returned. Tags in query must be separated by comma.

not-tags (Optional)

查询

字符串

A list of tags to filter the list result by. Resources that match all tags in this list will be excluded. Tags in query must be separated by comma.

not-tags-any (Optional)

查询

字符串

A list of tags to filter the list result by. Resources that match any tag in this list will be excluded. Tags in query must be separated by comma.

sort_dir (可选)

查询

字符串

Sort direction. A valid value is asc (ascending) or desc (descending). You can specify multiple pairs of sort key and sort direction query parameters.

sort_key (可选)

查询

字符串

按 QoS 策略属性排序。您可以指定多个排序键和排序方向查询参数对。排序键限于

  • id

  • name

  • project_id

  • tenant_id

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

策略

body

数组

QoS policy 对象列表。

description

body

字符串

A human-readable description for the resource.

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

revision_number

body

整数

The revision number of the resource.

shared

body

布尔值

指示此策略是否在所有项目中共享。

id

body

字符串

QoS 策略的 ID。

is_default

body

布尔值

如果为 true,则 QoS policy 是默认策略。

rules

body

数组

零个或多个策略规则集。

name

body

字符串

Human-readable name of the resource.

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

tags

body

数组

The list of tags on the resource.

响应示例

{
    "policies": [
        {
            "project_id": "8d4c70a21fed4aeba121a1a429ba0d04",
            "tenant_id": "8d4c70a21fed4aeba121a1a429ba0d04",
            "id": "46ebaec0-0570-43ac-82f6-60d2b03168c4",
            "is_default": false,
            "name": "10Mbit",
            "description": "This policy limits the ports to 10Mbit max.",
            "revision_number": 3,
            "created_at": "2018-04-03T21:26:39Z",
            "updated_at": "2018-04-03T21:26:39Z",
            "shared": false,
            "rules": [
                {
                    "max_kbps": 10000,
                    "type": "bandwidth_limit",
                    "id": "b1866696-032a-4228-857f-846075f63487",
                    "max_burst_kbps": 0,
                    "qos_policy_id": "46ebaec0-0570-43ac-82f6-60d2b03168c4"
                },
                {
                    "dscp_mark": 20,
                    "type": "dscp_marking",
                    "id": "d9c021d5-5433-4d7c-8bfa-69cca486aac8",
                    "qos_policy_id": "46ebaec0-0570-43ac-82f6-60d2b03168c4"
                }
            ],
            "tags": ["tag1,tag2"]
        }
    ]
}
POST
/v2.0/qos/policies

创建 QoS 策略

创建 QoS 策略。

通过使用您在请求对象中定义的配置来创建 QoS 策略。将返回一个响应对象。该对象包含一个唯一的 ID。

根据默认策略配置,如果调用者不是管理员用户,此调用将返回 HTTP Forbidden (403) 响应代码。

具有管理员角色的用户可以通过指定与他们自己的项目 ID 不同的项目 ID 来代表其他项目创建策略。

正常响应代码:201

错误响应代码:401、403、404、409

请求

名称

入参

类型

描述

policy

body

对象

QoS policy 对象。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

tenant_id (可选)

body

字符串

The ID of the project that owns the resource. Only administrative and users with advsvc role can specify a project ID other than their own. You cannot change this value through authorization policies.

project_id (可选)

body

字符串

The ID of the project that owns the resource. Only administrative and users with advsvc role can specify a project ID other than their own. You cannot change this value through authorization policies.

shared (Optional)

body

布尔值

设置为 true 以与其他项目共享此策略。默认为 false

is_default (Optional)

body

布尔值

如果为 true,则 QoS policy 是默认策略。

name (可选)

body

字符串

Human-readable name of the resource.

请求示例

{
    "policy": {
        "name": "10Mbit",
        "description": "This policy limits the ports to 10Mbit max.",
        "shared": false
    }
}

响应参数

名称

入参

类型

描述

policy

body

对象

QoS policy 对象。

description

body

字符串

A human-readable description for the resource.

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

revision_number

body

整数

The revision number of the resource.

shared

body

布尔值

指示此策略是否在所有项目中共享。

rules

body

数组

零个或多个策略规则集。

id

body

字符串

QoS 策略的 ID。

is_default

body

布尔值

如果为 true,则 QoS policy 是默认策略。

name

body

字符串

Human-readable name of the resource.

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

响应示例

{
    "policy": {
        "name": "10Mbit",
        "description": "This policy limits the ports to 10Mbit max.",
        "rules": [],
        "id": "46ebaec0-0570-43ac-82f6-60d2b03168c4",
        "is_default": false,
        "project_id": "8d4c70a21fed4aeba121a1a429ba0d04",
        "revision_number": 1,
        "tenant_id": "8d4c70a21fed4aeba121a1a429ba0d04",
        "created_at": "2018-04-03T21:26:39Z",
        "updated_at": "2018-04-03T21:26:39Z",
        "shared": false,
        "tags": ["tag1,tag2"]
    }
}
GET
/v2.0/qos/policies/{policy_id}

显示 QoS 策略详细信息

显示 QoS 策略的详细信息。一个策略可以包含多个规则类型。

正常响应代码:200

Error response codes: 401, 404

请求

名称

入参

类型

描述

policy_id

路径

字符串

QoS 策略的 ID。

响应参数

名称

入参

类型

描述

policy

body

对象

QoS policy 对象。

description

body

字符串

A human-readable description for the resource.

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

revision_number

body

整数

The revision number of the resource.

shared

body

布尔值

指示此策略是否在所有项目中共享。

rules

body

数组

零个或多个策略规则集。

id

body

字符串

QoS 策略的 ID。

is_default

body

布尔值

如果为 true,则 QoS policy 是默认策略。

name

body

字符串

Human-readable name of the resource.

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

响应示例

{
    "policy": {
        "project_id": "8d4c70a21fed4aeba121a1a429ba0d04",
        "tenant_id": "8d4c70a21fed4aeba121a1a429ba0d04",
        "id": "46ebaec0-0570-43ac-82f6-60d2b03168c4",
        "is_default": false,
        "name": "10Mbit",
        "description": "This policy limits the ports to 10Mbit max.",
        "revision_number": 3,
        "created_at": "2018-04-03T21:26:39Z",
        "updated_at": "2018-04-03T21:26:39Z",
        "shared": false,
        "rules": [
            {
                "id": "5f126d84-551a-4dcf-bb01-0e9c0df0c793",
                "qos_policy_id": "46ebaec0-0570-43ac-82f6-60d2b03168c4",
                "max_kbps": 10000,
                "max_burst_kbps": 0,
                "type": "bandwidth_limit"
             },
            {
                "id": "5f126d84-551a-4dcf-bb01-0e9c0df0c794",
                "qos_policy_id": "46ebaec0-0570-43ac-82f6-60d2b03168c4",
                "dscp_mark": 26,
                "type": "dscp_marking"
            }
        ],
        "tags": ["tag1,tag2"]
    }
}
PUT
/v2.0/qos/policies/{policy_id}

更新 QoS 策略

更新 QoS 策略。

正常响应代码:200

错误响应代码:400、401、404、412

请求

名称

入参

类型

描述

policy_id

路径

字符串

QoS 策略的 ID。

policy

body

对象

QoS policy 对象。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

is_default (Optional)

body

布尔值

如果为 true,则 QoS policy 是默认策略。

shared (Optional)

body

布尔值

设置为 true 以与其他项目共享此策略。默认为 false

name (可选)

body

字符串

Human-readable name of the resource.

请求示例

{
    "policy": {
        "name": "10Mbit",
        "description": "This policy limits the ports to 10Mbit max.",
        "shared": false
    }
}

响应参数

名称

入参

类型

描述

policy

body

对象

QoS policy 对象。

description

body

字符串

A human-readable description for the resource.

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

revision_number

body

整数

The revision number of the resource.

shared

body

布尔值

指示此策略是否在所有项目中共享。

id

body

字符串

QoS 策略的 ID。

is_default

body

布尔值

如果为 true,则 QoS policy 是默认策略。

rules

body

数组

零个或多个策略规则集。

name

body

字符串

Human-readable name of the resource.

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

响应示例

{
    "policy": {
        "name": "10Mbit",
        "description": "This policy limits the ports to 10Mbit max.",
        "id": "46ebaec0-0570-43ac-82f6-60d2b03168c4",
        "is_default": false,
        "project_id": "8d4c70a21fed4aeba121a1a429ba0d04",
        "revision_number": 3,
        "created_at": "2018-04-03T21:26:39Z",
        "updated_at": "2018-04-03T21:26:39Z",
        "tenant_id": "8d4c70a21fed4aeba121a1a429ba0d04",
        "shared": false,
        "tags": ["tag1,tag2"]
    }
}
DELETE
/v2.0/qos/policies/{policy_id}

删除 QoS 策略

删除 QoS 策略。

正常响应代码:204

错误响应代码:400、401、404、412

请求

名称

入参

类型

描述

policy_id

路径

字符串

QoS 策略的 ID。

响应

There is no body content for the response of a successful DELETE request.

QoS 带宽限制规则

列出、创建、删除、显示 QoS 带宽限制规则信息并更新 QoS 带宽限制规则。

带宽限制方向

名为 qos-bw-limit-direction 的扩展为 QoS 规则类型添加了 direction 属性。 direction 属性允许配置具有特定方向的 QoS 带宽限制规则:ingressegress。默认为 egress

GET
/v2.0/qos/policies/{policy_id}/bandwidth_limit_rules

列出 QoS 策略的带宽限制规则

列出 QoS 策略的所有带宽限制规则。

列表可能为空。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

Error response codes: 401, 404

请求

名称

入参

类型

描述

policy_id

路径

字符串

QoS 策略的 ID。

max_kbps (可选)

查询

整数

按最大 KBPS(千比特每秒)值过滤列表结果。

id (可选)

查询

字符串

Filter the list result by the ID of the resource.

max_burst_kbps (可选)

查询

整数

按最大突发大小(以千比特为单位)过滤列表结果。

direction (可选)

查询

字符串

按 QoS 规则适用的流量方向过滤列表结果。有效值为 egressingress

sort_dir (可选)

查询

字符串

Sort direction. A valid value is asc (ascending) or desc (descending). You can specify multiple pairs of sort key and sort direction query parameters.

sort_key (可选)

查询

字符串

按带宽限制规则属性排序。您可以指定多个排序键和排序方向查询参数对。排序键限于

  • direction

  • id

  • max_burst_kbps

  • max_kbps

响应参数

名称

入参

类型

描述

bandwidth_limit_rules

body

数组

与 QoS 策略关联的带宽限制规则列表。

max_kbps

body

整数

最大 KBPS(千比特每秒)值。如果指定此值,则必须大于 0,否则 max_kbps 将为空值。

id

body

字符串

QoS 带宽限制规则的 ID。

max_burst_kbps

body

整数

最大突发大小(以千比特为单位)。

direction

body

字符串

port 的角度来看,QoS 规则适用的流量方向。有效值为 egressingress。默认值为 egress

tags

body

数组

The list of tags on the resource.

响应示例

{
    "bandwidth_limit_rules": [
        {
            "id": "5f126d84-551a-4dcf-bb01-0e9c0df0c793",
            "max_kbps": 10000,
            "max_burst_kbps": 0,
            "direction": "egress"
        }
    ]
}
POST
/v2.0/qos/policies/{policy_id}/bandwidth_limit_rules

创建带宽限制规则

为 QoS 策略创建带宽限制规则。

正常响应代码:201

错误响应代码:400、401、404、409

请求

名称

入参

类型

描述

policy_id

路径

字符串

QoS 策略的 ID。

bandwidth_limit_rule

body

对象

一个 bandwidth_limit_rule 对象。

max_kbps (可选)

body

整数

最大 KBPS(千比特每秒)值。如果指定此值,则必须大于 0,否则 max_kbps 将为空值。

max_burst_kbps (可选)

body

整数

最大突发大小(以千比特为单位)。默认为 0

direction (可选)

body

字符串

port 的角度来看,QoS 规则适用的流量方向。有效值为 egressingress。默认值为 egress

请求示例

{
    "bandwidth_limit_rule": {
        "max_kbps": "10000"
    }
}

响应参数

名称

入参

类型

描述

bandwidth_limit_rule

body

对象

一个 bandwidth_limit_rule 对象。

max_kbps

body

整数

最大 KBPS(千比特每秒)值。如果指定此值,则必须大于 0,否则 max_kbps 将为空值。

id

body

字符串

QoS 带宽限制规则的 ID。

max_burst_kbps

body

整数

最大突发大小(以千比特为单位)。

direction

body

字符串

port 的角度来看,QoS 规则适用的流量方向。有效值为 egressingress。默认值为 egress

tags

body

数组

The list of tags on the resource.

响应示例

{
    "bandwidth_limit_rule": {
        "id": "5f126d84-551a-4dcf-bb01-0e9c0df0c793",
        "max_kbps": 10000,
        "max_burst_kbps": 0,
        "direction": "egress"
    }
}
GET
/v2.0/qos/policies/{policy_id}/bandwidth_limit_rules/{rule_id}

显示带宽限制规则详细信息

显示 QoS 策略的带宽限制规则的详细信息。

正常响应代码:200

Error response codes: 401, 404

请求

名称

入参

类型

描述

policy_id

路径

字符串

QoS 策略的 ID。

rule_id

路径

字符串

QoS 规则的 ID。

响应参数

名称

入参

类型

描述

bandwidth_limit_rule

body

对象

一个 bandwidth_limit_rule 对象。

max_kbps

body

整数

最大 KBPS(千比特每秒)值。如果指定此值,则必须大于 0,否则 max_kbps 将为空值。

id

body

字符串

QoS 带宽限制规则的 ID。

max_burst_kbps

body

整数

最大突发大小(以千比特为单位)。

direction

body

字符串

port 的角度来看,QoS 规则适用的流量方向。有效值为 egressingress。默认值为 egress

tags

body

数组

The list of tags on the resource.

响应示例

{
    "bandwidth_limit_rule": {
        "id": "5f126d84-551a-4dcf-bb01-0e9c0df0c793",
        "max_kbps": 10000,
        "max_burst_kbps": 0,
        "direction": "egress"
    }
}
PUT
/v2.0/qos/policies/{policy_id}/bandwidth_limit_rules/{rule_id}

更新带宽限制规则

更新 QoS 策略的带宽限制规则。

正常响应代码:200

错误响应代码:400、401、404

请求

名称

入参

类型

描述

policy_id

路径

字符串

QoS 策略的 ID。

rule_id

路径

字符串

QoS 规则的 ID。

bandwidth_limit_rule

body

对象

一个 bandwidth_limit_rule 对象。

max_kbps (可选)

body

整数

最大 KBPS(千比特每秒)值。如果指定此值,则必须大于 0,否则 max_kbps 将为空值。

max_burst_kbps (可选)

body

整数

最大突发大小(以千比特为单位)。默认为 0

direction (可选)

body

字符串

port 的角度来看,QoS 规则适用的流量方向。有效值为 egressingress

请求示例

{
    "bandwidth_limit_rule": {
        "max_kbps": "10000"
    }
}

响应参数

名称

入参

类型

描述

bandwidth_limit_rule

body

对象

一个 bandwidth_limit_rule 对象。

max_kbps

body

整数

最大 KBPS(千比特每秒)值。如果指定此值,则必须大于 0,否则 max_kbps 将为空值。

id

body

字符串

QoS 带宽限制规则的 ID。

max_burst_kbps

body

整数

最大突发大小(以千比特为单位)。

direction

body

字符串

port 的角度来看,QoS 规则适用的流量方向。有效值为 egressingress

tags

body

数组

The list of tags on the resource.

响应示例

{
    "bandwidth_limit_rule": {
        "id": "5f126d84-551a-4dcf-bb01-0e9c0df0c793",
        "max_kbps": 10000,
        "max_burst_kbps": 0,
        "direction": "egress"
    }
}
DELETE
/v2.0/qos/policies/{policy_id}/bandwidth_limit_rules/{rule_id}

删除带宽限制规则

删除 QoS 策略的带宽限制规则。

正常响应代码:204

错误响应代码:400、401、404

请求

名称

入参

类型

描述

policy_id

路径

字符串

QoS 策略的 ID。

rule_id

路径

字符串

QoS 规则的 ID。

响应

There is no body content for the response of a successful DELETE request.

QoS DSCP 标记规则

列出、创建、删除、显示 QoS DSCP 标记规则信息并更新 QoS DSCP 标记规则。

GET
/v2.0/qos/policies/{policy_id}/dscp_marking_rules

列出 QoS 策略的 DSCP 标记规则

列出 QoS 策略的所有 DSCP 标记规则。

列表可能为空。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

Error response codes: 401, 404

请求

名称

入参

类型

描述

policy_id

路径

字符串

QoS 策略的 ID。

dscp_mark (可选)

查询

整数

按 DSCP 标记值过滤列表结果。

id (可选)

查询

字符串

Filter the list result by the ID of the resource.

sort_dir (可选)

查询

字符串

Sort direction. A valid value is asc (ascending) or desc (descending). You can specify multiple pairs of sort key and sort direction query parameters.

sort_key (可选)

查询

字符串

按 DSCP 标记规则属性排序。您可以指定多个排序键和排序方向查询参数对。排序键限于

  • dscp_mark

  • id

响应参数

名称

入参

类型

描述

dscp_marking_rules

body

数组

dscp_marking_rule 对象列表。

dscp_mark

body

整数

DSCP 标记值。

id

body

字符串

QoS DSCP 标记规则的 ID。

tags

body

数组

The list of tags on the resource.

响应示例

{
    "dscp_marking_rules": [
        {
            "id": "5f126d84-551a-4dcf-bb01-0e9c0df0c794",
            "dscp_mark": 26
        }
    ]
}
POST
/v2.0/qos/policies/{policy_id}/dscp_marking_rules

创建 DSCP 标记规则

为 QoS 策略创建 DSCP 标记规则。

正常响应代码:201

错误响应代码:400、401、404、409

请求

名称

入参

类型

描述

policy_id

路径

字符串

QoS 策略的 ID。

dscp_marking_rule

body

对象

一个 dscp_marking_rule 对象。

dscp_mark (可选)

body

整数

DSCP 标记值。

请求示例

{
    "dscp_marking_rule": {
        "dscp_mark": "26"
    }
}

响应参数

名称

入参

类型

描述

dscp_marking_rule

body

对象

一个 dscp_marking_rule 对象。

dscp_mark

body

整数

DSCP 标记值。

id

body

字符串

QoS DSCP 标记规则的 ID。

tags

body

数组

The list of tags on the resource.

响应示例

{
    "dscp_marking_rule": {
        "id": "5f126d84-551a-4dcf-bb01-0e9c0df0c794",
        "dscp_mark": 26
    }
}
GET
/v2.0/qos/policies/{policy_id}/dscp_marking_rules/{dscp_rule_id}

显示 DSCP 标记规则详细信息

显示 QoS 策略的 DSCP 标记规则的详细信息。

正常响应代码:200

Error response codes: 401, 404

请求

名称

入参

类型

描述

policy_id

路径

字符串

QoS 策略的 ID。

dscp_rule_id

路径

字符串

DSCP 规则的 ID。

响应参数

名称

入参

类型

描述

dscp_marking_rule

body

对象

一个 dscp_marking_rule 对象。

dscp_mark (可选)

body

整数

DSCP 标记值。

id

body

字符串

QoS DSCP 标记规则的 ID。

tags

body

数组

The list of tags on the resource.

响应示例

{
    "dscp_marking_rule": {
        "id": "5f126d84-551a-4dcf-bb01-0e9c0df0c794",
        "dscp_mark": 26
    }
}
PUT
/v2.0/qos/policies/{policy_id}/dscp_marking_rules/{dscp_rule_id}

更新 DSCP 标记规则

更新 QoS 策略的 DSCP 标记规则。

正常响应代码:200

错误响应代码:400、401、404

请求

名称

入参

类型

描述

policy_id

路径

字符串

QoS 策略的 ID。

dscp_rule_id

路径

字符串

DSCP 规则的 ID。

dscp_marking_rule

body

对象

一个 dscp_marking_rule 对象。

dscp_mark (可选)

body

整数

DSCP 标记值。

请求示例

{
    "dscp_marking_rule": {
        "dscp_mark": "16"
    }
}

响应参数

名称

入参

类型

描述

dscp_marking_rule

body

对象

一个 dscp_marking_rule 对象。

dscp_mark

body

整数

DSCP 标记值。

id

body

字符串

QoS DSCP 标记规则的 ID。

tags

body

数组

The list of tags on the resource.

响应示例

{
    "dscp_marking_rule": {
        "id": "5f126d84-551a-4dcf-bb01-0e9c0df0c794",
        "dscp_mark": 16
    }
}
DELETE
/v2.0/qos/policies/{policy_id}/dscp_marking_rules/{dscp_rule_id}

删除 DSCP 标记规则

删除 QoS 策略的 DSCP 标记规则。

正常响应代码:204

错误响应代码:400、401、404

请求

名称

入参

类型

描述

policy_id

路径

字符串

QoS 策略的 ID。

dscp_rule_id

路径

字符串

DSCP 规则的 ID。

响应

There is no body content for the response of a successful DELETE request.

QoS 最低带宽规则

列出、创建、删除、显示 QoS 最低带宽规则信息并更新 QoS 最低带宽规则。

GET
/v2.0/qos/policies/{policy_id}/minimum_bandwidth_rules

列出 QoS 策略的最低带宽规则

列出 QoS 策略的所有最低带宽规则。

列表可能为空。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

Error response codes: 401, 404

请求

名称

入参

类型

描述

policy_id

路径

字符串

QoS 策略的 ID。

min_kbps (可选)

查询

整数

按端口应可用的最低 KBPS(千比特每秒)值过滤列表结果。

id (可选)

查询

字符串

Filter the list result by the ID of the resource.

direction (可选)

查询

字符串

按 QoS 规则适用的流量方向过滤列表结果。有效值为 egressingress

sort_dir (可选)

查询

字符串

Sort direction. A valid value is asc (ascending) or desc (descending). You can specify multiple pairs of sort key and sort direction query parameters.

sort_key (可选)

查询

字符串

按最低带宽规则属性排序。您可以指定多个排序键和排序方向查询参数对。排序键限于

  • direction

  • id

  • min_kbps

响应参数

名称

入参

类型

描述

minimum_bandwidth_rules

body

数组

与 QoS 策略关联的 minimum_bandwidth_rule 对象列表。

min_kbps

body

整数

端口应可用的最低 KBPS(千比特每秒)值。

id

body

字符串

QoS 最低带宽规则的 ID。

direction

body

字符串

port 的角度来看,QoS 规则适用的流量方向。有效值为 egressingress。默认值为 egress

tags

body

数组

The list of tags on the resource.

响应示例

{
    "minimum_bandwidth_rules": [
        {
            "id": "1eddf7af-0b4c-42c5-8ae1-390b32f1de08",
            "min_kbps": 10000,
            "direction": "egress"
        }
    ]
}
POST
/v2.0/qos/policies/{policy_id}/minimum_bandwidth_rules

创建最低带宽规则

为 QoS 策略创建最低带宽规则。

正常响应代码:201

错误响应代码:400、401、404、409

请求

名称

入参

类型

描述

policy_id

路径

字符串

QoS 策略的 ID。

minimum_bandwidth_rule

body

对象

一个 minimum_bandwidth_rule 对象。

min_kbps

body

整数

端口应可用的最低 KBPS(千比特每秒)值。

direction (可选)

body

字符串

port 的角度来看,QoS 规则适用的流量方向。有效值为 egressingress。默认值为 egress

请求示例

{
    "minimum_bandwidth_rule": {
        "min_kbps": "10000"
    }
}

响应参数

名称

入参

类型

描述

minimum_bandwidth_rule

body

对象

一个 minimum_bandwidth_rule 对象。

min_kbps

body

整数

端口应可用的最低 KBPS(千比特每秒)值。

id

body

字符串

QoS 最低带宽规则的 ID。

direction

body

字符串

port 的角度来看,QoS 规则适用的流量方向。有效值为 egressingress。默认值为 egress

tags

body

数组

The list of tags on the resource.

响应示例

{
    "minimum_bandwidth_rule": {
        "id": "1eddf7af-0b4c-42c5-8ae1-390b32f1de08",
        "min_kbps": 10000,
        "direction": "egress"
    }
}
GET
/v2.0/qos/policies/{policy_id}/minimum_bandwidth_rules/{rule_id}

显示最低带宽规则详细信息

显示 QoS 策略的最低带宽规则的详细信息。

正常响应代码:200

Error response codes: 401, 404

请求

名称

入参

类型

描述

policy_id

路径

字符串

QoS 策略的 ID。

rule_id

路径

字符串

QoS 规则的 ID。

响应参数

名称

入参

类型

描述

minimum_bandwidth_rule

body

对象

一个 minimum_bandwidth_rule 对象。

min_kbps

body

整数

端口应可用的最低 KBPS(千比特每秒)值。

id

body

字符串

QoS 最低带宽规则的 ID。

direction

body

字符串

port 的角度来看,QoS 规则适用的流量方向。有效值为 egressingress。默认值为 egress

tags

body

数组

The list of tags on the resource.

响应示例

{
    "minimum_bandwidth_rule": {
        "id": "1eddf7af-0b4c-42c5-8ae1-390b32f1de08",
        "min_kbps": 10000,
        "direction": "egress"
    }
}
PUT
/v2.0/qos/policies/{policy_id}/minimum_bandwidth_rules/{rule_id}

更新最低带宽规则

更新 QoS 策略的最低带宽规则。

注意:如果有关联的端口通过 QoS 策略引用该规则,则规则无法更新,并且更新将被拒绝,并返回错误代码 501。

正常响应代码:200

错误响应代码:400、401、404、501

请求

名称

入参

类型

描述

policy_id

路径

字符串

QoS 策略的 ID。

rule_id

路径

字符串

QoS 规则的 ID。

minimum_bandwidth_rule

body

对象

一个 minimum_bandwidth_rule 对象。

min_kbps

body

整数

端口应可用的最低 KBPS(千比特每秒)值。

direction (可选)

body

字符串

port 的角度来看,QoS 规则适用的流量方向。有效值为 egressingress

请求示例

{
    "minimum_bandwidth_rule": {
        "min_kbps": "20000"
    }
}

响应参数

名称

入参

类型

描述

minimum_bandwidth_rule

body

对象

一个 minimum_bandwidth_rule 对象。

min_kbps

body

整数

端口应可用的最低 KBPS(千比特每秒)值。

id

body

字符串

QoS 最低带宽规则的 ID。

direction

body

字符串

port 的角度来看,QoS 规则适用的流量方向。有效值为 egressingress

tags

body

数组

The list of tags on the resource.

响应示例

{
    "minimum_bandwidth_rule": {
        "id": "1eddf7af-0b4c-42c5-8ae1-390b32f1de08",
        "min_kbps": 20000,
        "direction": "egress"
    }
}
DELETE
/v2.0/qos/policies/{policy_id}/minimum_bandwidth_rules/{rule_id}

删除最低带宽规则

删除 QoS 策略的最低带宽规则。

正常响应代码:204

错误响应代码:400、401、404

请求

名称

入参

类型

描述

policy_id

路径

字符串

QoS 策略的 ID。

rule_id

路径

字符串

QoS 规则的 ID。

响应

There is no body content for the response of a successful DELETE request.

QoS 最低数据包速率规则

列出、创建、删除、显示 QoS 最低数据包速率规则信息并更新 QoS 最低数据包速率规则。

GET
/v2.0/qos/policies/{policy_id}/minimum_packet_rate_rules

列出 QoS 策略的最低数据包速率规则

列出 QoS 策略的所有最低数据包速率规则。

列表可能为空。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

Error response codes: 401, 404

请求

名称

入参

类型

描述

policy_id

路径

字符串

QoS 策略的 ID。

min_kpps (可选)

查询

整数

按 min kpps(千数据包每秒)值过滤列表结果。

id (可选)

查询

字符串

Filter the list result by the ID of the resource.

direction (可选)

查询

字符串

按 QoS 最低数据包规则适用的流量方向过滤列表结果。有效值为 anyegressingress

sort_dir (可选)

查询

字符串

Sort direction. A valid value is asc (ascending) or desc (descending). You can specify multiple pairs of sort key and sort direction query parameters.

sort_key (可选)

查询

字符串

按最低数据包速率规则属性排序。您可以指定多个排序键和排序方向查询参数对。排序键限于

  • direction

  • id

  • min_kpps

响应参数

名称

入参

类型

描述

minimum_packet_rate_rules

body

数组

与 QoS 策略关联的 minimum_packet_rate_rule 对象列表。

min_kpps

body

整数

每秒千(1000)数据包(kpps)的最小值。

id

body

字符串

QoS 最低数据包速率规则的 ID。

direction

body

字符串

port 的角度来看,QoS 最低数据包速率规则适用的流量方向。有效值为 anyegressingress

tags

body

数组

The list of tags on the resource.

响应示例

{
    "minimum_packet_rate_rules": [
        {
            "id": "5f126d84-551a-4dcf-bb01-0e9c0df0c793",
            "min_kpps": 1000,
            "direction": "egress"
        }
    ]
  }
POST
/v2.0/qos/policies/{policy_id}/minimum_packet_rate_rules

创建最低数据包速率规则

为 QoS 策略创建最低数据包速率规则。

正常响应代码:201

错误响应代码:400、401、404、409

请求

名称

入参

类型

描述

policy_id

路径

字符串

QoS 策略的 ID。

minimum_packet_rate_rule

body

对象

一个 minimum_packet_rate_rule 对象。

min_kpps

body

整数

每秒千(1000)数据包(kpps)的最小值。

direction

body

字符串

port 的角度来看,QoS 最低数据包速率规则适用的流量方向。有效值为 anyegressingress

请求示例

{
    "minimum_packet_rate_rule": {
        "min_kpps": 1000,
        "direction": "any"
    }
}

响应参数

名称

入参

类型

描述

minimum_packet_rate_rule

body

对象

一个 minimum_packet_rate_rule 对象。

min_kpps

body

整数

每秒千(1000)数据包(kpps)的最小值。

id

body

字符串

QoS 最低数据包速率规则的 ID。

direction

body

字符串

port 的角度来看,QoS 最低数据包速率规则适用的流量方向。有效值为 anyegressingress

tags

body

数组

The list of tags on the resource.

响应示例

{
    "minimum_packet_rate_rule": {
        "id": "5f126d84-551a-4dcf-bb01-0e9c0df0c793",
        "min_kpps": 1000,
        "direction": "any"
    }
}
GET
/v2.0/qos/policies/{policy_id}/minimum_packet_rate_rules/{rule_id}

显示最低数据包速率规则详细信息

显示 QoS 策略的最低数据包速率规则的详细信息。

正常响应代码:200

Error response codes: 401, 404

请求

名称

入参

类型

描述

policy_id

路径

字符串

QoS 策略的 ID。

rule_id

路径

字符串

QoS 规则的 ID。

响应参数

名称

入参

类型

描述

minimum_packet_rate_rule

body

对象

一个 minimum_packet_rate_rule 对象。

min_kpps

body

整数

每秒千(1000)数据包(kpps)的最小值。

id

body

字符串

QoS 最低数据包速率规则的 ID。

direction

body

字符串

port 的角度来看,QoS 最低数据包速率规则适用的流量方向。有效值为 anyegressingress

tags

body

数组

The list of tags on the resource.

响应示例

{
    "minimum_packet_rate_rule": {
        "id": "5f126d84-551a-4dcf-bb01-0e9c0df0c793",
        "min_kpps": 1000,
        "direction": "egress"
    }
}
PUT
/v2.0/qos/policies/{policy_id}/minimum_packet_rate_rules/{rule_id}

更新最低数据包速率规则

更新 QoS 策略的最低数据包速率规则。

注意:如果有关联的端口通过 QoS 策略引用该规则,则规则无法更新,并且更新将被拒绝,并返回错误代码 501。

正常响应代码:200

错误响应代码:400、401、404、409、501

请求

名称

入参

类型

描述

policy_id

路径

字符串

QoS 策略的 ID。

rule_id

路径

字符串

QoS 规则的 ID。

minimum_packet_rate_rule

body

对象

一个 minimum_packet_rate_rule 对象。

min_kpps (可选)

body

整数

每秒千(1000)数据包(kpps)的最小值。

direction (可选)

body

字符串

port 的角度来看,QoS 最低数据包速率规则适用的流量方向。有效值为 anyegressingress

请求示例

{
    "minimum_packet_rate_rule": {
        "min_kpps": 2000,
        "direction": "any"
    }
}

响应参数

名称

入参

类型

描述

minimum_packet_rate_rule

body

对象

一个 minimum_packet_rate_rule 对象。

min_kpps

body

整数

每秒千(1000)数据包(kpps)的最小值。

id

body

字符串

QoS 最低数据包速率规则的 ID。

direction

body

字符串

port 的角度来看,QoS 最低数据包速率规则适用的流量方向。有效值为 anyegressingress

tags

body

数组

The list of tags on the resource.

响应示例

{
    "minimum_packet_rate_rule": {
        "id": "5f126d84-551a-4dcf-bb01-0e9c0df0c794",
        "min_kpps": 2000,
        "direction": "any"
    }
}
DELETE
/v2.0/qos/policies/{policy_id}/minimum_packet_rate_rules/{rule_id}

删除最低数据包速率规则

删除 QoS 策略的最低数据包速率规则。

正常响应代码:204

错误响应代码:400、401、404

请求

名称

入参

类型

描述

policy_id

路径

字符串

QoS 策略的 ID。

rule_id

路径

字符串

QoS 规则的 ID。

响应

There is no body content for the response of a successful DELETE request.

QoS 数据包速率限制规则

列出、创建、删除、显示 QoS 数据包速率限制规则信息并更新 QoS 数据包速率限制规则。

GET
/v2.0/qos/policies/{policy_id}/packet_rate_limit_rules

列出 QoS 策略的数据包速率限制规则

列出 QoS 策略的所有数据包速率限制规则。

列表可能为空。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

Error response codes: 401, 404

请求

名称

入参

类型

描述

policy_id

路径

字符串

QoS 策略的 ID。

max_kpps (可选)

查询

整数

按 max kpps(千数据包每秒)值过滤列表结果。

max_burst_kpps (可选)

查询

整数

按 max burst kpps(千数据包每秒)值过滤列表结果。

id (可选)

查询

字符串

Filter the list result by the ID of the resource.

direction (可选)

查询

字符串

按 QoS 规则适用的流量方向过滤列表结果。有效值为 egressingress

sort_dir (可选)

查询

字符串

Sort direction. A valid value is asc (ascending) or desc (descending). You can specify multiple pairs of sort key and sort direction query parameters.

sort_key (可选)

查询

字符串

按数据包速率限制规则属性排序。您可以指定多个排序键和排序方向查询参数对。排序键限于

  • direction

  • id

  • max_kpps

  • max_burst_kpps

响应参数

名称

入参

类型

描述

packet_rate_limit_rules

body

数组

与 QoS 策略关联的 packet_rate_limit_rule 对象列表。

max_kpps

body

整数

max kpps(千数据包每秒)值。

max_burst_kpps

body

整数

max burst kpps(千数据包每秒)值。

id

body

字符串

QoS 数据包速率限制规则的 ID。

direction

body

字符串

port 的角度来看,QoS 规则适用的流量方向。有效值为 egressingress。默认值为 egress

tags

body

数组

The list of tags on the resource.

响应示例

{
    "packet_rate_limit_rules": [
        {
            "id": "1eddf7af-0b4c-42c5-8ae1-390b32f1de08",
            "max_kpps": 10000,
            "max_burst_kpps": 10000,
            "direction": "egress"
        }
    ]
}
POST
/v2.0/qos/policies/{policy_id}/packet_rate_limit_rules

创建数据包速率限制规则

为 QoS 策略创建数据包速率限制规则。

正常响应代码:201

错误响应代码:400、401、404、409

请求

名称

入参

类型

描述

policy_id

路径

字符串

QoS 策略的 ID。

packet_rate_limit_rule

body

对象

一个 packet_rate_limit_rule 对象。

max_kpps

body

整数

max kpps(千数据包每秒)值。

max_burst_kpps

body

整数

max burst kpps(千数据包每秒)值。

direction (可选)

body

字符串

port 的角度来看,QoS 规则适用的流量方向。有效值为 egressingress。默认值为 egress

请求示例

{
    "packet_rate_limit_rule": {
        "max_kpps": "10000",
        "max_burst_kpps": "10000"
    }
}

响应参数

名称

入参

类型

描述

packet_rate_limit_rule

body

对象

一个 packet_rate_limit_rule 对象。

max_kpps

body

整数

max kpps(千数据包每秒)值。

max_burst_kpps

body

整数

max burst kpps(千数据包每秒)值。

id

body

字符串

QoS 数据包速率限制规则的 ID。

direction

body

字符串

port 的角度来看,QoS 规则适用的流量方向。有效值为 egressingress。默认值为 egress

tags

body

数组

The list of tags on the resource.

响应示例

{
    "packet_rate_limit_rule": {
        "id": "1eddf7af-0b4c-42c5-8ae1-390b32f1de08",
        "max_kpps": 10000,
        "max_burst_kpps": 10000,
        "direction": "egress"
    }
}
GET
/v2.0/qos/policies/{policy_id}/packet_rate_limit_rules/{rule_id}

显示数据包速率限制规则详细信息

显示 QoS 策略的数据包速率限制规则的详细信息。

正常响应代码:200

Error response codes: 401, 404

请求

名称

入参

类型

描述

policy_id

路径

字符串

QoS 策略的 ID。

rule_id

路径

字符串

QoS 规则的 ID。

响应参数

名称

入参

类型

描述

packet_rate_limit_rule

body

对象

一个 packet_rate_limit_rule 对象。

max_kpps

body

整数

max kpps(千数据包每秒)值。

max_burst_kpps

body

整数

max burst kpps(千数据包每秒)值。

id

body

字符串

QoS 数据包速率限制规则的 ID。

direction

body

字符串

port 的角度来看,QoS 规则适用的流量方向。有效值为 egressingress。默认值为 egress

tags

body

数组

The list of tags on the resource.

响应示例

{
    "packet_rate_limit_rule": {
        "id": "1eddf7af-0b4c-42c5-8ae1-390b32f1de08",
        "max_kpps": 10000,
        "max_burst_kpps": 10000,
        "direction": "egress"
    }
}
PUT
/v2.0/qos/policies/{policy_id}/packet_rate_limit_rules/{rule_id}

更新数据包速率限制规则

更新 QoS 策略的数据包速率限制规则。

正常响应代码:200

错误响应代码:400、401、404

请求

名称

入参

类型

描述

policy_id

路径

字符串

QoS 策略的 ID。

rule_id

路径

字符串

QoS 规则的 ID。

packet_rate_limit_rule

body

对象

一个 packet_rate_limit_rule 对象。

max_kpps

body

整数

max kpps(千数据包每秒)值。

max_burst_kpps

body

整数

max burst kpps(千数据包每秒)值。

direction (可选)

body

字符串

port 的角度来看,QoS 规则适用的流量方向。有效值为 egressingress

请求示例

{
    "packet_rate_limit_rule": {
        "max_kpps": "20000",
        "max_burst_kpps": "20000"
    }
}

响应参数

名称

入参

类型

描述

packet_rate_limit_rule

body

对象

一个 packet_rate_limit_rule 对象。

max_kpps

body

整数

max kpps(千数据包每秒)值。

max_burst_kpps

body

整数

max burst kpps(千数据包每秒)值。

id

body

字符串

QoS 数据包速率限制规则的 ID。

direction

body

字符串

port 的角度来看,QoS 规则适用的流量方向。有效值为 egressingress

tags

body

数组

The list of tags on the resource.

响应示例

{
    "packet_rate_limit_rule": {
        "id": "1eddf7af-0b4c-42c5-8ae1-390b32f1de08",
        "max_kpps": 20000,
        "max_burst_kpps": 20000,
        "direction": "egress"
    }
}
DELETE
/v2.0/qos/policies/{policy_id}/packet_rate_limit_rules/{rule_id}

删除数据包速率限制规则

删除 QoS 策略的数据包速率限制规则。

正常响应代码:204

错误响应代码:400、401、404

请求

名称

入参

类型

描述

policy_id

路径

字符串

QoS 策略的 ID。

rule_id

路径

字符串

QoS 规则的 ID。

响应

There is no body content for the response of a successful DELETE request.

服务质量规则别名 API

此 API 扩展的目的是使调用者能够执行删除、显示和更新 QoS 规则的请求,而无需指定相应的策略 ID。否则,这些请求的行为与本文档其他部分描述的对应请求完全相同。此 API 扩展中可用的请求是

GET
/v2.0/qos/alias_bandwidth_limit_rules/{rule_id}

显示带宽限制规则详细信息别名

有关请求、响应和返回代码的更多信息,请参阅 显示带宽限制规则详细信息

PUT
/v2.0/qos/alias_bandwidth_limit_rules/{rule_id}

更新带宽限制规则别名

有关请求、响应和返回代码的更多信息,请参阅 更新带宽限制规则

DELETE
/v2.0/qos/alias_bandwidth_limit_rules/{rule_id}

删除带宽限制规则别名

有关请求、响应和返回代码的更多信息,请参阅 删除带宽限制规则

GET
/v2.0/qos/alias_dscp_marking_rules/{dscp_rule_id}

显示 DSCP 标记规则详细信息别名

有关请求、响应和返回代码的更多信息,请参阅 显示 DSCP 标记规则详细信息

PUT
/v2.0/qos/alias_dscp_marking_rules/{dscp_rule_id}

更新 DSCP 标记规则别名

有关请求、响应和返回代码的更多信息,请参阅 更新 DSCP 标记规则

DELETE
/v2.0/qos/alias_dscp_marking_rules/{dscp_rule_id}

删除 DSCP 标记规则别名

有关请求、响应和返回代码的更多信息,请参阅 删除 DSCP 标记规则

GET
/v2.0/qos/alias_minimum_bandwidth_rules/{rule_id}

显示最低带宽规则详细信息别名

有关请求、响应和返回代码的更多信息,请参阅 显示最低带宽规则详细信息

PUT
/v2.0/qos/alias_minimum_bandwidth_rules/{rule_id}

更新最低带宽规则别名

有关请求、响应和返回代码的更多信息,请参阅 更新最低带宽规则

DELETE
/v2.0/qos/alias_minimum_bandwidth_rules/{rule_id}

删除最低带宽规则别名

有关请求、响应和返回代码的更多信息,请参阅 删除最低带宽规则

服务质量最低数据包速率规则别名 API

此 API 扩展使调用者无需指定相应的策略 ID 即可执行删除、显示和更新 QoS 最低数据包速率规则的请求。

GET
/v2.0/qos/alias_minimum_packet_rate_rules/{rule_id}

显示最低数据包速率规则详细信息别名

有关请求、响应和返回代码的更多信息,请参阅 显示最低数据包速率规则详细信息

PUT
/v2.0/qos/alias_minimum_packet_rate_rules/{rule_id}

更新最低数据包速率规则别名

有关请求、响应和返回代码的更多信息,请参阅 更新最低数据包速率规则

DELETE
/v2.0/qos/alias_minimum_packet_rate_rules/{rule_id}

删除最低数据包速率规则别名

有关请求、响应和返回代码的更多信息,请参阅 删除最低数据包速率规则

负载均衡即服务 2.0 (已弃用)

Neutron-lbaas 自 Queens 版本起已弃用。负载均衡即服务 (LBaaS v2) 现在由 Octavia 项目 提供。 Octavia API v2 向后兼容 neutron-lbaas 对 LBaaS 2.0 API 的实现。

请参阅 FAQ https://wiki.openstack.org/wiki/Neutron/LBaaS/Deprecation

日志资源 (networking-midonet)

日志资源

注意

目前此 logging-resource 扩展仅适用于 networking-midonet。

列出、显示日志资源信息、创建、更新和删除日志资源。

GET
/v2.0/logging/logging_resources

列出日志资源

列出日志资源。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

错误响应代码:401, 403

请求

名称

入参

类型

描述

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应

名称

入参

类型

描述

logging_resources

body

数组

logging_resource 对象列表。

id

body

字符串

日志资源的 ID。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

firewall_logs

body

数组

firewall_log 对象列表。

name

body

字符串

Human-readable name of the resource.

description

body

字符串

A human-readable description for the resource.

enabled

body

布尔值

指示此日志资源是启用还是禁用。

响应示例

{
    "logging_resources": [
        {
            "description": "my log",
            "enabled": true,
            "firewall_logs": [],
            "id": "13b64f3c-20af-4741-b230-658ab7d5b257",
            "name": "log",
            "project_id": "8d018258316e4f22890561e8780c85bb",
            "tenant_id": "8d018258316e4f22890561e8780c85bb"
        },
        {
            "description": "my log2",
            "enabled": true,
            "firewall_logs": [],
            "id": "335c7b7d-c4a9-423a-9c24-9f4982f31e24",
            "name": "log2",
            "project_id": "8d018258316e4f22890561e8780c85bb",
            "tenant_id": "8d018258316e4f22890561e8780c85bb"
        }
    ]
}
POST
/v2.0/logging/logging_resources

创建日志资源

创建日志资源。

正常响应代码:201

错误响应代码:400、401、403

请求

名称

入参

类型

描述

logging_resource

body

对象

一个 logging_resource 对象。

tenant_id (可选)

body

字符串

The ID of the project that owns the resource. Only administrative and users with advsvc role can specify a project ID other than their own. You cannot change this value through authorization policies.

project_id (可选)

body

字符串

The ID of the project that owns the resource. Only administrative and users with advsvc role can specify a project ID other than their own. You cannot change this value through authorization policies.

name (可选)

body

字符串

资源的易读名称。默认情况下为空字符串。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

enabled(可选)

body

布尔值

指示此日志资源是启用还是禁用。默认为 false。

请求示例

{
    "logging_resource": {
        "description": "my log",
        "enabled": true,
        "name": "log"
    }
}

响应

名称

入参

类型

描述

logging_resource

body

对象

一个 logging_resource 对象。

id

body

字符串

日志资源的 ID。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

firewall_logs

body

数组

firewall_log 对象列表。

name

body

字符串

Human-readable name of the resource.

description

body

字符串

A human-readable description for the resource.

enabled

body

布尔值

指示此日志资源是启用还是禁用。

响应示例

{
    "logging_resource": {
        "description": "my log",
        "enabled": true,
        "firewall_logs": [],
        "id": "13b64f3c-20af-4741-b230-658ab7d5b257",
        "name": "log",
        "project_id": "8d018258316e4f22890561e8780c85bb",
        "tenant_id": "8d018258316e4f22890561e8780c85bb"
    }
}
GET
/v2.0/logging/logging_resources/{logging_resource_id}

显示日志资源详细信息

显示日志资源的详细信息。

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

错误响应代码:400、401、403、404

请求

名称

入参

类型

描述

logging_resource_id

路径

字符串

日志资源的 ID。

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应

名称

入参

类型

描述

logging_resource

body

对象

一个 logging_resource 对象。

id

body

字符串

日志资源的 ID。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

firewall_logs

body

数组

firewall_log 对象列表。

name

body

字符串

Human-readable name of the resource.

description

body

字符串

A human-readable description for the resource.

enabled

body

布尔值

指示此日志资源是启用还是禁用。

响应示例

{
    "logging_resource": {
        "description": "my log",
        "enabled": true,
        "firewall_logs": [
            {
                "description": "",
                "firewall_id": "682cfe44-5fcf-4c16-982e-1176493f6825",
                "fw_event": "ALL",
                "id": "1ee6fea7-c294-418e-9b97-06db48e3f3d5",
                "logging_resource_id": "13b64f3c-20af-4741-b230-658ab7d5b257",
                "project_id": "8d018258316e4f22890561e8780c85bb",
                "tenant_id": "8d018258316e4f22890561e8780c85bb"
            }
        ],
        "id": "13b64f3c-20af-4741-b230-658ab7d5b257",
        "name": "log",
        "project_id": "8d018258316e4f22890561e8780c85bb",
        "tenant_id": "8d018258316e4f22890561e8780c85bb"
    }
}
PUT
/v2.0/logging/logging_resources/{logging_resource_id}

更新日志资源

更新日志资源。

正常响应代码:200

错误响应代码:400、401、403、404

请求

名称

入参

类型

描述

logging_resource_id

路径

字符串

日志资源的 ID。

logging_resource

body

对象

一个 logging_resource 对象。

name (可选)

body

字符串

Human-readable name of the resource.

description (可选)

body

字符串

A human-readable description for the resource.

enabled(可选)

body

布尔值

指示此日志资源是启用还是禁用。

请求示例

{
    "logging_resource": {
        "description": "my log2",
        "enabled": false
    }
}

响应

名称

入参

类型

描述

logging_resource

body

对象

一个 logging_resource 对象。

id

body

字符串

日志资源的 ID。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

firewall_logs

body

数组

firewall_log 对象列表。

name

body

字符串

Human-readable name of the resource.

description

body

字符串

A human-readable description for the resource.

enabled

body

布尔值

指示此日志资源是启用还是禁用。

响应示例

{
    "logging_resource": {
        "description": "my log2",
        "enabled": false,
        "firewall_logs": [
            {
                "description": "",
                "firewall_id": "682cfe44-5fcf-4c16-982e-1176493f6825",
                "fw_event": "ALL",
                "id": "1ee6fea7-c294-418e-9b97-06db48e3f3d5",
                "logging_resource_id": "335c7b7d-c4a9-423a-9c24-9f4982f31e24",
                "project_id": "8d018258316e4f22890561e8780c85bb",
                "tenant_id": "8d018258316e4f22890561e8780c85bb"
            }
        ],
        "id": "335c7b7d-c4a9-423a-9c24-9f4982f31e24",
        "name": "log2",
        "project_id": "8d018258316e4f22890561e8780c85bb",
        "tenant_id": "8d018258316e4f22890561e8780c85bb"
    }
}
DELETE
/v2.0/logging/logging_resources/{logging_resource_id}

删除日志资源

删除日志资源。

正常响应代码:204

错误响应代码:400、401、403、404

请求

名称

入参

类型

描述

logging_resource_id

路径

字符串

日志资源的 ID。

响应

There is no body content for the response of a successful DELETE request.

防火墙日志

注意

目前此 logging-resource 扩展仅适用于 networking-midonet。

列出、显示防火墙日志信息、创建、更新和删除防火墙日志。

GET
/v2.0/logging/logging_resources/{logging_resource_id}/firewall_logs

列出防火墙日志

列出防火墙日志。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

错误响应代码:401, 403

请求

名称

入参

类型

描述

logging_resource_id

路径

字符串

日志资源的 ID。

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应

名称

入参

类型

描述

firewall_logs

body

数组

firewall_log 对象列表。

logging_resource_id

body

字符串

日志资源的 ID。

id

body

字符串

防火墙日志资源的 ID。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

description

body

字符串

A human-readable description for the resource.

fw_event

body

字符串

要记录的防火墙事件类型。ACCEPTDROPALL

firewall_id

body

字符串

FWaaS v1 防火墙的 ID。

响应示例

{
    "firewall_logs": [
        {
            "description": "my firewall log 2",
            "firewall_id": "a6564146-f8b3-49c3-add1-fb213455d5a8",
            "fw_event": "ACCEPT",
            "id": "3969b708-d600-4343-93b9-01645f8e9a8a",
            "logging_resource_id": "13b64f3c-20af-4741-b230-658ab7d5b257",
            "project_id": "8d018258316e4f22890561e8780c85bb",
            "tenant_id": "8d018258316e4f22890561e8780c85bb"
        },
        {
            "description": "my firewall log",
            "firewall_id": "a6564146-f8b3-49c3-add1-fb213455d5a8",
            "fw_event": "DROP",
            "id": "deb19331-e5d5-4a80-a37f-5e5ad407b353",
            "logging_resource_id": "13b64f3c-20af-4741-b230-658ab7d5b257",
            "project_id": "8d018258316e4f22890561e8780c85bb",
            "tenant_id": "8d018258316e4f22890561e8780c85bb"
        }
    ]
}
POST
/v2.0/logging/logging_resources/{logging_resource_id}/firewall_logs

创建防火墙日志

创建防火墙日志。

正常响应代码:201

错误响应代码:400、401、403

请求

名称

入参

类型

描述

logging_resource_id

路径

字符串

日志资源的 ID。

firewall_log

body

对象

一个 firewall_log 对象。

tenant_id (可选)

body

字符串

The ID of the project that owns the resource. Only administrative and users with advsvc role can specify a project ID other than their own. You cannot change this value through authorization policies.

project_id (可选)

body

字符串

The ID of the project that owns the resource. Only administrative and users with advsvc role can specify a project ID other than their own. You cannot change this value through authorization policies.

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

fw_event (可选)

body

字符串

要记录的防火墙事件类型。ACCEPTDROPALL。默认为 ALL

firewall_id

body

字符串

FWaaS v1 防火墙的 ID。

请求示例

{
    "firewall_log": {
        "description": "my firewall log",
        "firewall_id": "a6564146-f8b3-49c3-add1-fb213455d5a8",
        "fw_event": "DROP"
    }
}

响应

名称

入参

类型

描述

firewall_log

body

对象

一个 firewall_log 对象。

logging_resource_id

body

字符串

日志资源的 ID。

id

body

字符串

防火墙日志资源的 ID。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

description

body

字符串

A human-readable description for the resource.

fw_event

body

字符串

要记录的防火墙事件类型。ACCEPTDROPALL

firewall_id

body

字符串

FWaaS v1 防火墙的 ID。

响应示例

{
    "firewall_log": {
        "description": "my firewall log",
        "firewall_id": "a6564146-f8b3-49c3-add1-fb213455d5a8",
        "fw_event": "DROP",
        "id": "deb19331-e5d5-4a80-a37f-5e5ad407b353",
        "logging_resource_id": "13b64f3c-20af-4741-b230-658ab7d5b257",
        "project_id": "8d018258316e4f22890561e8780c85bb",
        "tenant_id": "8d018258316e4f22890561e8780c85bb"
    }
}
GET
/v2.0/logging/logging_resources/{logging_resource_id}/firewall_logs/{firewall_log_id}

显示防火墙日志详细信息

显示防火墙日志的详细信息。

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

错误响应代码:400、401、403、404

请求

名称

入参

类型

描述

logging_resource_id

路径

字符串

日志资源的 ID。

firewall_log_id

路径

字符串

防火墙日志资源的 ID。

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应

名称

入参

类型

描述

firewall_log

body

对象

一个 firewall_log 对象。

logging_resource_id

body

字符串

日志资源的 ID。

id

body

字符串

防火墙日志资源的 ID。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

description

body

字符串

A human-readable description for the resource.

fw_event

body

字符串

要记录的防火墙事件类型。ACCEPTDROPALL

firewall_id

body

字符串

FWaaS v1 防火墙的 ID。

响应示例

{
    "firewall_log": {
        "description": "my firewall log 3",
        "firewall_id": "a6564146-f8b3-49c3-add1-fb213455d5a8",
        "fw_event": "ALL",
        "id": "3969b708-d600-4343-93b9-01645f8e9a8a",
        "logging_resource_id": "13b64f3c-20af-4741-b230-658ab7d5b257",
        "project_id": "8d018258316e4f22890561e8780c85bb",
        "tenant_id": "8d018258316e4f22890561e8780c85bb"
    }
}
PUT
/v2.0/logging/logging_resources/{logging_resource_id}/firewall_logs/{firewall_log_id}

更新防火墙日志

更新防火墙日志。

正常响应代码:200

错误响应代码:400、401、403、404

请求

名称

入参

类型

描述

logging_resource_id

路径

字符串

日志资源的 ID。

firewall_log_id

路径

字符串

防火墙日志资源的 ID。

firewall_log

body

对象

一个 firewall_log 对象。

description (可选)

body

字符串

A human-readable description for the resource.

fw_event (可选)

body

字符串

要记录的防火墙事件类型。ACCEPTDROPALL

请求示例

{
    "firewall_log": {
        "description": "my firewall log 3",
        "fw_event": "ALL"
    }
}

响应

名称

入参

类型

描述

firewall_log

body

对象

一个 firewall_log 对象。

logging_resource_id

body

字符串

日志资源的 ID。

id

body

字符串

防火墙日志资源的 ID。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

description

body

字符串

A human-readable description for the resource.

fw_event

body

字符串

要记录的防火墙事件类型。ACCEPTDROPALL

firewall_id

body

字符串

FWaaS v1 防火墙的 ID。

响应示例

{
    "firewall_log": {
        "description": "my firewall log 3",
        "firewall_id": "a6564146-f8b3-49c3-add1-fb213455d5a8",
        "fw_event": "ALL",
        "id": "3969b708-d600-4343-93b9-01645f8e9a8a",
        "logging_resource_id": "13b64f3c-20af-4741-b230-658ab7d5b257",
        "project_id": "8d018258316e4f22890561e8780c85bb",
        "tenant_id": "8d018258316e4f22890561e8780c85bb"
    }
}
DELETE
/v2.0/logging/logging_resources/{logging_resource_id}/firewall_logs/{firewall_log_id}

删除防火墙日志

删除防火墙日志。

正常响应代码:204

错误响应代码:400、401、403、404

请求

名称

入参

类型

描述

logging_resource_id

路径

字符串

日志资源的 ID。

firewall_log_id

路径

字符串

防火墙日志资源的 ID。

响应

There is no body content for the response of a successful DELETE request.

路由器接口浮动 IP (networking-midonet)

路由器接口浮动 IP

注意

目前此 router-interface-fip 扩展仅适用于 networking-midonet。

router-interface-fip 扩展表示能够将浮动 IP 关联到路由器的内部接口。(没有此扩展,浮动 IP 只能关联到路由器的网关接口。)

此扩展不引入任何资源或属性。

FIP64 (networking-midonet)

FIP64

注意

目前此 fip64 扩展仅适用于 networking-midonet。

fip64 扩展提供 NAT64 功能,它允许将 IPv6 浮动 IP 关联到 IPv4 固定 IP。(没有此扩展,浮动 IP 仅限于 IPv4。)

此扩展不引入任何资源或属性。

BGP/MPLS VPN 互连

BGP - MPLS VPN 概述

bgpvpn 扩展实现了 BGP VPN 互连 API,该 API 能够通过边界网关协议 (BGP) 对等连接将 OpenStack 网络和/或路由器与多协议标签交换 (MPLS) 虚拟专用网络 (VPN) 相关联。BGP-MPLS VPN 通常由电信服务提供商提供给客户,用于广域网连接,或者与互联网连接一起提供。此 API 支持使用 *路由目标* 来指示所需网络,从而实现与这些 WAN VPN 的互连。

关于路由目标

route_targetsimport_targetsexport_targets 属性

  • 用于导入的 RT 集合是 route_targetsimport_targets 的并集。

  • 用于导出的 RT 集合是 route_targetsexport_targets 的并集。

通常会定义 route_targetsimport_targetsexport_targets 中的至少一个选项,但 API 不会强制执行此操作,并且所有列表都可以为空。

例如,在 BGP VPN 使用单个路由目标进行导入和导出的典型用例中,仅 route_targets 参数就足够了,并且将包含一个路由目标。

关于路由区分符 (RD)

route_distinguishers 参数是可选的,它指示将用于为 Neutron 网络宣告路由的 RD。约定是,当指定 RD 列表时,后端将为特定宣告的路由使用这些 RD 中的一个。拥有列表而不是单个 RD 的原因是支持 VPN 前缀的多宿主(通常是为了弹性、负载均衡或 anycast)。后端可能支持也可能不支持此行为,并在后一种情况下报告 API 错误。当未指定时,后端将使用自动分配的 RD(例如,源自提供商边缘 (PE) IP 的 <ip>:<number> RD)。

路由区分符和路由目标的有效字符串

路由目标或路由区分符的有效字符串如下

  • <2 字节 AS#>:<32 位数字>

  • <4 字节 AS#>:<16 位数字>

  • <4 字节 IPv4>:<16 位数字>

关于 VXLAN VNI

VXLAN 是可用于 BGP E-VPN 的选项之一。当在硬件平台上使用 VXLAN 时,并非始终可能使用本地分配的 ID,这导致需要配置全局分配的 VXLAN VNI。

可选的 vni 属性是仅管理员使用的参数,它允许管理员强制对该 BGPVPN 使用选定的全局分配的 VXLAN VNI。

当未指定 VNI 且使用 VXLAN 封装时,默认为让后端选择宣告路由中的 VNI,并使用接收路由中的 VNI 进行流量传输。后端将符合 E-VPN 覆盖规范。

vni 属性的有效范围是 [1, 224-1]。

控制广告到 BGPVPN 的路由

借助 bgpvpn 扩展,当定义了网络或路由器与 BGPVPN 之间的关联时,与 neutron 端口固定 IP 对应的路由将通告到 BGPVPN。对于路由器关联,路由器的额外路由(router 资源的 ‘routes’ 属性)也可能通告到 BGPVPN。

为了提供更大的灵活性,bgpvpn-routes-control 扩展提供了一种方法来

  • 将其他路由通告到 BGPVPN,例如通过 neutron 端口可达的某个前缀,或从另一个 BGPVPN 泄漏的路由;这是通过 BGPVPN 端口关联的 routes 属性实现的

  • 不将 neutron 端口的固定 IP 通告到 BGPVPN,这在可以通过端口访问其他 IP 前缀时可能特别有用;这是通过 BGPVPN 端口关联的 advertise_fixed_ips 属性实现的

  • 显式控制是否将路由器的额外路由通告到 BGPVPN;这是通过 BGPVPN 路由器关联的 advertise_extra_routes 属性实现的。

    注意

    此功能正在为 Rocky 版本开发中

  • 可选地控制通告路由的 LOCAL_PREF BGP 属性的值,针对 BGPVPN 的所有路由(通过 BGPVPN 资源的 local_pref 属性)和/或每条路由(通过路由端口关联中的 local_pref

BGP - MPLS VPN 注意事项

关联约束

一个给定的 BGP VPN 可以关联到多个网络和/或多个路由器。

为避免在语义上产生任何歧义,特别是在处理与路由器相关的上下文时(例如 NAT 或 FWaaS),如果网络中的某个子网绑定到某个路由器,则此 API 不允许将该网络关联到 L3 BGP VPN,同时也将该路由器关联到相同或不同的 L3 BGP VPN。

此外,对于 L3 类型的 BGP VPN,可能存在 IP 前缀重叠的情况,这些情况在收到 BGP 路由之前无法被服务插件检测到,在这种情况下,这些规范的行为是未定义的(即,哪条重叠的路由被使用),并将取决于后端。这适用于路由器关联和网络关联,在流量由路由器转发且目标 IP 同时属于与路由器或发起流量的网络相关联的 BGP VPN 的前缀,以及绑定到路由器的子网的前缀的情况下;在这种情况下,流量将被传递到子网还是 BGP VPN,由此 API 定义。

OpenStack Neutron 内部的连通性影响

创建两个具有 RT 的 BGP VPN,导致这两个 VPN 交换路由,然后将这两个 BGP VPN 关联到两个网络,这将导致这两个网络之间建立互连,这仅仅是应用 BGP VPN Route Target 语义的结果(即,不将 OpenStack 网络的特定前缀作为特殊情况)。

这同样适用于路由器关联。

BGP VPN

引入了一个新的 BGPVPN 资源。它包含一组用于基于 BGP 的 VPN 的参数。

BGPVPN 由管理员创建并提供给租户,租户随后可以将其关联到网络、路由器或端口(后者在 bgpvpn-routes-control 扩展可用时)。

BGP VPN API 列出、显示详细信息、创建、更新和删除 BGP VPN。

GET
/v2.0/bgpvpn/bgpvpns

列出 BGP VPN

列出项目有权访问的 BGP VPN。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

错误响应代码:400、401、403

请求

名称

入参

类型

描述

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

project_id (可选)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

networks (Optional)

查询

数组

过滤结果,查找与提供的 network_ids 中的至少一个网络有关联的 BGPVPN。

routers (Optional)

查询

数组

过滤结果,查找与提供的 router_ids 中的至少一个路由器有关联的 BGPVPN。

ports (可选)

查询

数组

过滤结果,查找与提供的 port_ids 中的至少一个端口有关联的 BGPVPN。

响应参数

名称

入参

类型

描述

bgpvpns

body

数组

一个 bgpvpn 对象列表。每个 bgpvpn 对象代表一个 MPLS 网络,Neutron 路由器和/或网络可以与其关联

id

body

字符串

BGP VPN 的 ID。

name

body

字符串

BGP VPN 的用户有意义的名称。

type

body

字符串

选择 VPN 的类型及其底层技术。允许的值为 l2l3。默认为 l3。l2 表示层 2(即桥接)附件,l3 表示层 3(即路由)附件。

route_distinguishers

body

数组

路由区分符字符串列表。如果指定此参数,将使用这些 RD 中的一个来通告 VPN 路由。

route_targets

body

数组

将同时导入和用于导出的路由目标。

import_targets

body

数组

将导入的附加路由目标。

export_targets

body

数组

将用于导出的附加路由目标。

networks

body

数组

此只读网络 ID 列表反映了通过网络关联 API 资源定义的关联。

routers

body

数组

此只读路由器 ID 列表反映了通过路由器关联 API 资源定义的关联。

ports

body

数组

此只读端口 ID 列表反映了通过端口关联 API 资源定义的关联(仅在 bgpvpn-routes-control API 扩展启用时存在)。

local_pref

body

整数

将通告到 BGPVPN 的路由的默认 BGP LOCAL_PREF(除非每条路由覆盖)。

VNI

body

整数

BGP VPN 的全局分配的 VXLAN vni

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

响应示例

{
  "bgpvpns": [
    {
      "export_targets": [
        "64512:1666"
      ],
      "name": "",
      "routers": [],
      "route_distinguishers": [
        "64512:1777",
        "64512:1888",
        "64512:1999"
      ],
      "tenant_id": "b7549121395844bea941bb92feb3fad9",
      "project_id": "b7549121395844bea941bb92feb3fad9",
      "import_targets": [
        "64512:1555"
      ],
      "route_targets": [
        "64512:1444"
      ],
      "type": "l3",
      "id": "0f9d472a-908f-40f5-8574-b4e8a63ccbf0",
      "networks": [],
      "local_pref": null,
      "vni": 1000
    }
  ]
}
POST
/v2.0/bgpvpn/bgpvpns

创建 BGP VPN

创建 BGP VPN。

正常响应代码:201

错误响应代码:400, 401

请求

名称

入参

类型

描述

bgpvpn

body

对象

一个 bgpvpn 对象代表一个 MPLS 网络,Neutron 路由器和/或网络可以与其关联

name (可选)

body

字符串

BGP VPN 的用户有意义的名称。

route_distinguishers (Optional)

body

数组

路由区分符字符串列表。如果指定此参数,将使用这些 RD 中的一个来通告 VPN 路由。

route_targets (Optional)

body

数组

将同时导入和用于导出的路由目标。

import_targets (Optional)

body

数组

将导入的附加路由目标。

export_targets (Optional)

body

数组

将用于导出的附加路由目标。

local_pref (Optional)

body

整数

将通告到 BGPVPN 的路由的默认 BGP LOCAL_PREF(除非每条路由覆盖)。默认为 null

vni (Optional)

body

整数

BGP VPN 的全局分配的 VXLAN vni

tenant_id (可选)

body

字符串

The ID of the project that owns the resource. Only administrative and users with advsvc role can specify a project ID other than their own. You cannot change this value through authorization policies.

project_id (可选)

body

字符串

The ID of the project that owns the resource. Only administrative and users with advsvc role can specify a project ID other than their own. You cannot change this value through authorization policies.

type (可选)

body

字符串

选择 VPN 的类型及其底层技术。允许的值为 l2l3。默认为 l3。l2 表示层 2(即桥接)附件,l3 表示层 3(即路由)附件。

请求示例

{
  "bgpvpn": {
    "tenant_id": "b7549121395844bea941bb92feb3fad9",
    "route_targets": "64512:1444",
    "import_targets": "64512:1555",
    "export_targets": "64512:1666",
    "route_distinguishers": ["64512:1777", "64512:1888", "64512:1999"],
    "type": "l3",
    "vni": 1000
  }
}

响应参数

名称

入参

类型

描述

bgpvpn

body

对象

一个 bgpvpn 对象代表一个 MPLS 网络,Neutron 路由器和/或网络可以与其关联

id

body

字符串

BGP VPN 的 ID。

name

body

字符串

BGP VPN 的用户有意义的名称。

type

body

字符串

选择 VPN 的类型及其底层技术。允许的值为 l2l3。默认为 l3。l2 表示层 2(即桥接)附件,l3 表示层 3(即路由)附件。

route_targets

body

数组

将同时导入和用于导出的路由目标。

import_targets

body

数组

将导入的附加路由目标。

export_targets

body

数组

将用于导出的附加路由目标。

networks

body

数组

此只读网络 ID 列表反映了通过网络关联 API 资源定义的关联。

routers

body

数组

此只读路由器 ID 列表反映了通过路由器关联 API 资源定义的关联。

ports

body

数组

此只读端口 ID 列表反映了通过端口关联 API 资源定义的关联(仅在 bgpvpn-routes-control API 扩展启用时存在)。

local_pref

body

整数

将通告到 BGPVPN 的路由的默认 BGP LOCAL_PREF(除非每条路由覆盖)。

VNI

body

整数

BGP VPN 的全局分配的 VXLAN vni

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

响应示例

{
  "bgpvpn": {
    "export_targets": [
      "64512:1666"
    ],
    "name": "",
    "routers": [],
    "route_distinguishers": [
      "64512:1777",
      "64512:1888",
      "64512:1999"
    ],
    "tenant_id": "b7549121395844bea941bb92feb3fad9",
    "project_id": "b7549121395844bea941bb92feb3fad9",
    "import_targets": [
      "64512:1555"
    ],
    "route_targets": [
      "64512:1444"
    ],
    "type": "l3",
    "id": "0f9d472a-908f-40f5-8574-b4e8a63ccbf0",
    "networks": [],
    "local_pref": null,
    "vni": 1000
  }
}
GET
/v2.0/bgpvpn/bgpvpns/{bgpvpn_id}

显示 BGP VPN 详细信息

显示 BGP VPN 的详细信息。

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

错误响应代码:401、403、404

请求

名称

入参

类型

描述

bgpvpn_id

路径

字符串

BGP VPN 的 ID。

响应参数

名称

入参

类型

描述

bgpvpn

body

对象

一个 bgpvpn 对象代表一个 MPLS 网络,Neutron 路由器和/或网络可以与其关联

id

body

字符串

BGP VPN 的 ID。

name

body

字符串

BGP VPN 的用户有意义的名称。

type

body

字符串

选择 VPN 的类型及其底层技术。允许的值为 l2l3。默认为 l3。l2 表示层 2(即桥接)附件,l3 表示层 3(即路由)附件。

route_distinguishers

body

数组

路由区分符字符串列表。如果指定此参数,将使用这些 RD 中的一个来通告 VPN 路由。

route_targets

body

数组

将同时导入和用于导出的路由目标。

import_targets

body

数组

将导入的附加路由目标。

export_targets

body

数组

将用于导出的附加路由目标。

networks

body

数组

此只读网络 ID 列表反映了通过网络关联 API 资源定义的关联。

routers

body

数组

此只读路由器 ID 列表反映了通过路由器关联 API 资源定义的关联。

ports

body

数组

此只读端口 ID 列表反映了通过端口关联 API 资源定义的关联(仅在 bgpvpn-routes-control API 扩展启用时存在)。

local_pref

body

整数

将通告到 BGPVPN 的路由的默认 BGP LOCAL_PREF(除非每条路由覆盖)。

VNI

body

整数

BGP VPN 的全局分配的 VXLAN vni

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

响应示例

{
    "bgpvpn": {
       "id": "460ac411-3dfb-45bb-8116-ed1a7233d143",
       "name": "foo",
       "route_targets": ["64512:1444"],
       "export_targets": [],
       "import_targets": [],
       "type": "l3",
       "tenant_id": "f94ea398564d49dfb0d542f086c68ce7",
       "project_id": "f94ea398564d49dfb0d542f086c68ce7",
       "routers": [],
       "route_distinguishers": [],
       "networks": [
         "a4f2b8df-cb42-4893-a333-d0b5c36ade17"
       ],
       "local_pref": null,
       "vni": 1000
    }
}
PUT
/v2.0/bgpvpn/bgpvpns/{bgpvpn_id}

更新 BGP VPN

更新 BGP VPN。

正常响应代码:201

错误响应代码:400、401、403、404

请求

非管理员用户只能更新 name 参数。所有其他更新都需要管理员权限。

名称

入参

类型

描述

bgpvpn_id

路径

字符串

BGP VPN 的 ID。

bgpvpn

body

对象

一个 bgpvpn 对象代表一个 MPLS 网络,Neutron 路由器和/或网络可以与其关联

name (可选)

body

字符串

BGP VPN 的用户有意义的名称。

route_distinguishers (Optional)

body

数组

路由区分符字符串列表。如果指定此参数,将使用这些 RD 中的一个来通告 VPN 路由。

route_targets (Optional)

body

数组

将同时导入和用于导出的路由目标。

import_targets (Optional)

body

数组

将导入的附加路由目标。

export_targets (Optional)

body

数组

将用于导出的附加路由目标。

local_pref (Optional)

body

整数

将通告到 BGPVPN 的路由的默认 BGP LOCAL_PREF(除非每条路由覆盖)。默认为 null

请求示例

{
    "bgpvpn": {
       "name": "foo",
       "route_targets": ["64512:1444"],
       "export_targets": [],
       "import_targets": []
    }
}

响应参数

名称

入参

类型

描述

bgpvpn

body

对象

一个 bgpvpn 对象代表一个 MPLS 网络,Neutron 路由器和/或网络可以与其关联

id

body

字符串

BGP VPN 的 ID。

name

body

字符串

BGP VPN 的用户有意义的名称。

type

body

字符串

选择 VPN 的类型及其底层技术。允许的值为 l2l3。默认为 l3。l2 表示层 2(即桥接)附件,l3 表示层 3(即路由)附件。

route_distinguishers

body

数组

路由区分符字符串列表。如果指定此参数,将使用这些 RD 中的一个来通告 VPN 路由。

route_targets

body

数组

将同时导入和用于导出的路由目标。

import_targets

body

数组

将导入的附加路由目标。

export_targets

body

数组

将用于导出的附加路由目标。

networks

body

数组

此只读网络 ID 列表反映了通过网络关联 API 资源定义的关联。

routers

body

数组

此只读路由器 ID 列表反映了通过路由器关联 API 资源定义的关联。

ports

body

数组

此只读端口 ID 列表反映了通过端口关联 API 资源定义的关联(仅在 bgpvpn-routes-control API 扩展启用时存在)。

local_pref

body

整数

将通告到 BGPVPN 的路由的默认 BGP LOCAL_PREF(除非每条路由覆盖)。

VNI

body

整数

BGP VPN 的全局分配的 VXLAN vni

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

响应示例

{
  "bgpvpn": {
    "export_targets": [],
    "name": "",
    "routers": [],
    "route_distinguishers": [
      "12345:1234"
    ],
    "tenant_id": "b7549121395844bea941bb92feb3fad9",
    "import_targets": [],
    "route_targets": ["64512:1444"],
    "type": "l3",
    "id": "4d627abf-06dd-45ab-920b-8e61422bb984",
    "networks": [],
    "local_pref": null,
    "vni": 1000
  }
}
DELETE
/v2.0/bgpvpn/bgpvpns/{bgpvpn_id}

删除 BGP VPN

删除 BGP VPN 及其网络和/或路由器关联。

正常响应代码:204

错误响应代码:401、403、404

请求

名称

入参

类型

描述

bgpvpn_id

路径

字符串

BGP VPN 的 ID。

响应

There is no body content for the response of a successful DELETE request.

网络关联

可以将 BGPVPN 关联到 L2 和 L3 类型的 BGPVPN。对于 L3 类型,语义是网络的所有子网将与 BGP VPN(以及它们之间)互连。

一个网络可以关联到多个 BGPVPN。

将 BGPVPN 关联或解除关联到网络是通过将 BGPVPN 资源的子资源作为网络关联 API 资源来操作的。

GET
/v2.0/bgpvpn/bgpvpns/{bgpvpn_id}/network_associations

列出网络关联

列出给定 BGP VPN 的网络关联。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

错误响应代码:400、401、403、404

请求

名称

入参

类型

描述

bgpvpn_id

路径

字符串

BGP VPN 的 ID。

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

network_associations

body

对象

一个 network_association 对象列表,代表 MPLS 网络与 Neutron 网络的绑定。

id

body

字符串

网络与 BGP VPN 之间关联的 ID。

network_id

body

字符串

要与 BGP VPN 关联的 Neutron 网络的 ID。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

响应示例

{
  "network_associations": [
    {
      "network_id": "8c5d88dc-60ac-4b02-a65a-36b65888ddcd",
      "tenant_id": "b7549121395844bea941bb92feb3fad9",
      "project_id": "b7549121395844bea941bb92feb3fad9",
      "id": "96227c78-6a0c-4d9d-b441-c4b8f6fb6c4a"
    },
    {
      "network_id": "a4f2b8df-cb42-4893-a333-d0b5c36ade17",
      "tenant_id": "b7549121395844bea941bb92feb3fad9",
      "project_id": "b7549121395844bea941bb92feb3fad9",
      "id": "1b09fd12-c769-4be7-9c26-dececa474acf"
    }
  ]
}
POST
/v2.0/bgpvpn/bgpvpns/{bgpvpn_id}/network_associations

创建网络关联

为给定的 BGP VPN 创建网络关联。

正常响应代码:201

错误响应代码:400、401、404

请求

名称

入参

类型

描述

bgpvpn_id

路径

字符串

BGP VPN 的 ID。

network_association

body

对象

一个 network_association 对象,代表 BGP VPN 与 Neutron 网络的绑定。

network_id

body

字符串

要与 BGP VPN 关联的 Neutron 网络的 ID。

请求示例

{
  "network_association": {
    "network_id": "8c5d88dc-60ac-4b02-a65a-36b65888ddcd"
  }
}

响应参数

名称

入参

类型

描述

network_association

body

对象

一个 network_association 对象,代表 BGP VPN 与 Neutron 网络的绑定。

id

body

字符串

网络与 BGP VPN 之间关联的 ID。

network_id

body

字符串

要与 BGP VPN 关联的 Neutron 网络的 ID。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

响应示例

{
  "network_association": {
    "network_id": "8c5d88dc-60ac-4b02-a65a-36b65888ddcd",
    "tenant_id": "b7549121395844bea941bb92feb3fad9",
    "project_id": "b7549121395844bea941bb92feb3fad9",
    "id": "73238ca1-e05d-4c7a-b4d4-70407b4b8730"
  }
}
GET
/v2.0/bgpvpn/bgpvpns/{bgpvpn_id}/network_associations/{network_association_id}

显示网络关联详细信息

显示网络关联的详细信息。

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

错误响应代码:401、403、404

请求

名称

入参

类型

描述

bgpvpn_id

路径

字符串

BGP VPN 的 ID。

network_association_id

路径

字符串

网络与 BGP VPN 之间关联的 ID。

响应参数

名称

入参

类型

描述

network_association

body

对象

一个 network_association 对象,代表 BGP VPN 与 Neutron 网络的绑定。

id

body

字符串

网络与 BGP VPN 之间关联的 ID。

network_id

body

字符串

要与 BGP VPN 关联的 Neutron 网络的 ID。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

响应示例

{
    "network_association":
       {
          "id": "1b09fd12-c769-4be7-9c26-dececa474acf",
          "network_id": "a4f2b8df-cb42-4893-a333-d0b5c36ade17",
          "tenant_id": "b7549121395844bea941bb92feb3fad9",
          "project_id": "b7549121395844bea941bb92feb3fad9"
       }
}
DELETE
/v2.0/bgpvpn/bgpvpns/{bgpvpn_id}/network_associations/{network_association_id}

删除网络关联

删除网络关联。

正常响应代码:204

错误响应代码:400、401、403、404

请求

名称

入参

类型

描述

bgpvpn_id

路径

字符串

BGP VPN 的 ID。

network_association_id

路径

字符串

网络与 BGP VPN 之间关联的 ID。

响应

There is no body content for the response of a successful DELETE request.

路由器关联

可以将 BGPVPN 关联到路由器,但这仅适用于 L3 类型的 BGPVPN。语义是路由器绑定的所有子网都将与 BGPVPN 互连。

一个路由器可以关联到多个 BGPVPN。

将 BGPVPN 关联或解除关联到路由器是通过将 BGPVPN 资源的子资源作为路由器关联 API 资源来操作的。

将路由器额外路由通告到 BGPVPN

bgpvpn-routes-control API 扩展允许控制路由器额外路由在 BGPVPN 中的重新通告(“额外路由”是路由器 routes 属性中定义的路由,当 extraroute 扩展可用时)。

在这种情况下,可以在 router_association 上设置 advertise_extra_routes 属性

  • true:路由器 routes 属性中定义的额外路由将通告到 BGPVPN(默认值)

  • false:路由器 routes 属性中定义的额外路由将通告到 BGPVPN

GET
/v2.0/bgpvpn/bgpvpns/{bgpvpn_id}/router_associations

列出路由器关联

列出给定 BGP VPN 的路由器关联。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

错误响应代码:400、401、403、404

请求

名称

入参

类型

描述

bgpvpn_id

路径

字符串

BGP VPN 的 ID。

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

router_associations

body

对象

一个 router_association 对象列表,代表 MPLS 网络与 Neutron 路由器的绑定。

id

body

字符串

路由器与 BGP VPN 之间关联的 ID。

router_id

body

字符串

要与 BGP VPN 关联的 Neutron 路由器的 ID。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

响应示例

{
  "router_associations": [
    {
      "router_id": "61222227-49eb-4dcc-b2d6-66bbfb2fdd7a",
      "tenant_id": "b7549121395844bea941bb92feb3fad9",
      "project_id": "b7549121395844bea941bb92feb3fad9",
      "id": "95277be7-a231-4e96-9625-8f9fe41de9d6",
      "advertise_extra_routes": true
    }
  ]
}
POST
/v2.0/bgpvpn/bgpvpns/{bgpvpn_id}/router_associations

创建路由器关联

为给定的 BGP VPN 创建路由器关联。

正常响应代码:201

错误响应代码:400、401、404

请求

名称

入参

类型

描述

bgpvpn_id

路径

字符串

BGP VPN 的 ID。

router_association

body

对象

一个 router_association 对象,代表 BGP VPN 与 Neutron 路由器的绑定。

router_id

body

字符串

要与 BGP VPN 关联的 Neutron 路由器的 ID。

请求示例

{
  "router_association": {
    "router_id": "b58a6241-6e49-4b11-87c6-8e0606dde796"
  }
}

响应参数

名称

入参

类型

描述

router_association

body

对象

一个 router_association 对象,代表 BGP VPN 与 Neutron 路由器的绑定。

id

body

字符串

路由器与 BGP VPN 之间关联的 ID。

router_id

body

字符串

要与 BGP VPN 关联的 Neutron 路由器的 ID。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

响应示例

{
  "router_association": {
    "router_id": "46a1a80b-7c42-4c45-88fd-b531e636969f",
    "tenant_id": "b7549121395844bea941bb92feb3fad9",
    "project_id": "b7549121395844bea941bb92feb3fad9",
    "id": "c63149a0-a0b3-4ca7-aba4-9aaa1b39d7f3",
    "advertise_extra_routes": true
  }
}
GET
/v2.0/bgpvpn/bgpvpns/{bgpvpn_id}/router_associations/{router_association_id}

显示路由器关联详细信息

显示路由器关联的详细信息。

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

错误响应代码:401、403、404

请求

名称

入参

类型

描述

bgpvpn_id

路径

字符串

BGP VPN 的 ID。

router_association_id

路径

字符串

路由器与 BGP VPN 之间关联的 ID。

响应参数

名称

入参

类型

描述

router_association

body

对象

一个 router_association 对象,代表 BGP VPN 与 Neutron 路由器的绑定。

id

body

字符串

路由器与 BGP VPN 之间关联的 ID。

router_id

body

字符串

要与 BGP VPN 关联的 Neutron 路由器的 ID。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

响应示例

{
    "router_association": {
        "id": "c63149a0-a0b3-4ca7-aba4-9aaa1b39d7f3",
        "router_id": "46a1a80b-7c42-4c45-88fd-b531e636969f",
        "tenant_id": "b7549121395844bea941bb92feb3fad9",
        "project_id": "b7549121395844bea941bb92feb3fad9",
        "advertise_extra_routes": true
    }
}
PUT
/v2.0/bgpvpn/bgpvpns/{bgpvpn_id}/router_associations/{router_association_id}

更新路由器关联(‘bgpvpn-routes-control’ 扩展)

注意

仅当 bgpvpn-routes-control API 扩展启用时,此操作才可用。

更新路由器关联。

正常响应代码:201

错误响应代码:400、401、403、404

请求

名称

入参

类型

描述

bgpvpn_id

路径

字符串

BGP VPN 的 ID。

router_association_id

路径

字符串

路由器与 BGP VPN 之间关联的 ID。

router_association

body

对象

一个 router_association 对象,代表 BGP VPN 与 Neutron 路由器的绑定。

advertise_extra_routes (Optional)

body

布尔值

控制是否将路由器 routes 属性中指定的路由通告到 BGPVPN 的布尔标志(默认值:true)。

请求示例

{
    "router_association": {
        "router_id": "46a1a80b-7c42-4c45-88fd-b531e636969f",
        "advertise_extra_routes": false
    }
}

响应参数

名称

入参

类型

描述

router_association

body

对象

一个 router_association 对象,代表 BGP VPN 与 Neutron 路由器的绑定。

id

body

字符串

路由器与 BGP VPN 之间关联的 ID。

router_id

body

字符串

要与 BGP VPN 关联的 Neutron 路由器的 ID。

project_id

body

字符串

项目的 ID。

advertise_extra_routes

body

布尔值

控制是否将路由器 routes 属性中指定的路由通告到 BGPVPN 的布尔标志。

响应示例

{
    "router_association": {
        "id": "c63149a0-a0b3-4ca7-aba4-9aaa1b39d7f3",
        "project_id": "b7549121395844bea941bb92feb3fad9",
        "router_id": "46a1a80b-7c42-4c45-88fd-b531e636969f",
        "advertise_extra_routes": false
    }
}
DELETE
/v2.0/bgpvpn/bgpvpns/{bgpvpn_id}/router_associations/{router_association_id}

删除路由器关联

删除路由器关联。

正常响应代码:204

错误响应代码:401、403、404

请求

名称

入参

类型

描述

bgpvpn_id

路径

字符串

BGP VPN 的 ID。

router_association_id

路径

字符串

路由器与 BGP VPN 之间关联的 ID。

响应

There is no body content for the response of a successful DELETE request.

端口关联

如果 bgpvpn-routes-control 扩展可用,则可以使用端口关联。

将 BGPVPN 关联或解除关联到端口是通过将 BGPVPN 资源的子资源作为端口关联 API 资源来操作的。

此 API 调用的语义是一种策略路由:来自给定端口的流量将根据该端口特定的数据平面查找进行处理。这意味着,特别是属于同一 Neutron 网络的端口,如果它们具有不同的 BGPVPN 关联,可能会看到不同的 L2 或 L3 连通性。

当为给定端口定义了端口关联,同时又为该端口的网络定义了网络关联时,这两种关联被同时视为有效,并且将会在端口与两种关联中的 BGPVPN 之间建立连通性。即使有多个关联,并且对于连接到该端口网络的路由器的路由器关联,情况也是如此。

端口路由

除了在 BGPVPN 连通性定义中提供端口级别的粒度外,端口关联还提供了一种控制除 neutron 端口的固定 IP 之外的路由通告的方式。

所谓的静态路由定义如下:指示前缀 20.1.0.0/16 可通过端口 A 访问,并应相应地在 BGPVPN X 中通告,需要在端口 A 和 BGPVPN X 之间定义一个端口关联,并将 routes 属性设置为 [ {'type': 'prefix', 'prefix': '20.1.0.0/16'} ]

类似地,支持将某个 BGPVPN 的路由泄漏到同一租户的另一个 BGPVPN 中:指示 BGPVPN Y 的所有通告路由(即,带有至少一个 RT 属于 BGPVPN Y 的 route_targetsimport_targets 的路由)可通过端口 A 访问,并应泄漏到 BGPVPN X 中,需要在端口 A 和 BGPVPN X 之间定义一个端口关联,并将 routes 属性设置为 [ {'type': 'bgpvpn', 'bgpvpn_id': <uuid of BGPVPN Y>} ]

控制 BGP LOCAL_PREF 属性

可以通过在 routes 属性的路由中添加 'local_pref': VALUE 来控制特定路由的 BGP LOCAL_PREF 值,使其不同于 BGPVPN local_pref 属性中定义的值(请参阅端口关联更新请求中的示例)。

GET
/v2.0/bgpvpn/bgpvpns/{bgpvpn_id}/port_associations

列出端口关联

列出给定 BGP VPN 的端口关联。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

错误响应代码:401、403、404

请求

名称

入参

类型

描述

bgpvpn_id

路径

字符串

BGP VPN 的 ID。

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

port_associations

body

数组

一个 port_association 对象列表,代表 MPLS 网络与 Neutron 端口的绑定。

id

body

字符串

端口与 BGP VPN 之间关联的 ID。

port_id

body

字符串

要与 BGP VPN 关联的 Neutron 端口的 ID。

project_id

body

字符串

项目的 ID。

routes

body

数组

路由列表,每条路由都是一个字典,至少包含一个 type 键,可以是 prefixbgpvpn

对于 prefix 类型,IP 前缀(v4 或 v6)在 prefix 键中指定。

对于 bgpvpn 类型,bgpvpn_id 键指定将从中读取路由并将其作为下一跳(任何带有 RT 属于此 BGPVPN 的 route_targetsimport_targets 的路由将被重新通告到关联的 BGPVPN 的 RT(export_targets + route_targets)中,其下一跳/标签指向此端口)的 BGPVPN。

对于这两种类型,local_pref 键可用于控制将通告的路由的 BGP LOCAL_PREF 值。

advertise_fixed_ips

body

布尔值

控制是否将端口的固定 IP 通告到 BGPVPN 的布尔标志。

响应示例

{
    "port_associations": [
        {
            "id": "95277be7-a231-4e96-9625-8f9fe41de9d6",
            "port_id": "61222227-49eb-4dcc-b2d6-66bbfb2fdd7a",
            "project_id": "b7549121395844bea941bb92feb3fad9",
            "routes": [
                {
                    "type": "prefix",
                    "prefix": "20.1.0.0/16"
                }
            ],
            "advertise_fixed_ips": true
        }
    ]
}
POST
/v2.0/bgpvpn/bgpvpns/{bgpvpn_id}/port_associations

创建端口关联

为给定的 BGP VPN 创建端口关联。

正常响应代码:201

错误响应代码:400、401、404

请求

名称

入参

类型

描述

bgpvpn_id

路径

字符串

BGP VPN 的 ID。

port_association

body

对象

一个 port_association 对象,代表 BGP VPN 与 Neutron 端口的绑定。

port_id

body

字符串

要与 BGP VPN 关联的 Neutron 端口的 ID。

routes (可选)

body

数组

路由列表,每条路由都是一个字典,至少包含一个 type 键,可以是 prefixbgpvpn

对于 prefix 类型,IP 前缀(v4 或 v6)在 prefix 键中指定。

对于 bgpvpn 类型,bgpvpn_id 键指定将从中读取路由并将其作为下一跳(任何带有 RT 属于此 BGPVPN 的 route_targetsimport_targets 的路由将被重新通告到关联的 BGPVPN 的 RT(export_targets + route_targets)中,其下一跳/标签指向此端口)的 BGPVPN。

对于这两种类型,local_pref 键可用于控制将通告的路由的 BGP LOCAL_PREF 值。

advertise_fixed_ips (Optional)

body

布尔值

控制是否将端口的固定 IP 通告到 BGPVPN 的布尔标志(默认值:true)。

请求示例

{
    "port_association": {
        "port_id": "b58a6241-6e49-4b11-87c6-8e0606dde796",
        "routes": [
            {
                "type": "prefix",
                "prefix": "20.1.0.0/16"
            }
        ]
    }
}

响应参数

名称

入参

类型

描述

port_association

body

对象

一个 port_association 对象,代表 BGP VPN 与 Neutron 端口的绑定。

id

body

字符串

端口与 BGP VPN 之间关联的 ID。

port_id

body

字符串

要与 BGP VPN 关联的 Neutron 端口的 ID。

project_id

body

字符串

项目的 ID。

routes

body

数组

路由列表,每条路由都是一个字典,至少包含一个 type 键,可以是 prefixbgpvpn

对于 prefix 类型,IP 前缀(v4 或 v6)在 prefix 键中指定。

对于 bgpvpn 类型,bgpvpn_id 键指定将从中读取路由并将其作为下一跳(任何带有 RT 属于此 BGPVPN 的 route_targetsimport_targets 的路由将被重新通告到关联的 BGPVPN 的 RT(export_targets + route_targets)中,其下一跳/标签指向此端口)的 BGPVPN。

对于这两种类型,local_pref 键可用于控制将通告的路由的 BGP LOCAL_PREF 值。

advertise_fixed_ips

body

布尔值

控制是否将端口的固定 IP 通告到 BGPVPN 的布尔标志。

响应示例

{
    "port_association": {
        "id": "c63149a0-a0b3-4ca7-aba4-9aaa1b39d7f3",
        "port_id": "46a1a80b-7c42-4c45-88fd-b531e636969f",
        "project_id": "b7549121395844bea941bb92feb3fad9",
        "routes": [
            {
                "type": "prefix",
                "prefix": "20.1.0.0/16"
            }
        ],
        "advertise_fixed_ips": true
    }
}
GET
/v2.0/bgpvpn/bgpvpns/{bgpvpn_id}/port_associations/{port_association_id}

显示端口关联详细信息

显示端口关联的详细信息。

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

错误响应代码:401、403、404

请求

名称

入参

类型

描述

bgpvpn_id

路径

字符串

BGP VPN 的 ID。

port_association_id

路径

字符串

端口与 BGP VPN 之间关联的 ID。

响应参数

名称

入参

类型

描述

port_association

body

对象

一个 port_association 对象,代表 BGP VPN 与 Neutron 端口的绑定。

id

body

字符串

端口与 BGP VPN 之间关联的 ID。

port_id

body

字符串

要与 BGP VPN 关联的 Neutron 端口的 ID。

project_id

body

字符串

项目的 ID。

routes

body

数组

路由列表,每条路由都是一个字典,至少包含一个 type 键,可以是 prefixbgpvpn

对于 prefix 类型,IP 前缀(v4 或 v6)在 prefix 键中指定。

对于 bgpvpn 类型,bgpvpn_id 键指定将从中读取路由并将其作为下一跳(任何带有 RT 属于此 BGPVPN 的 route_targetsimport_targets 的路由将被重新通告到关联的 BGPVPN 的 RT(export_targets + route_targets)中,其下一跳/标签指向此端口)的 BGPVPN。

对于这两种类型,local_pref 键可用于控制将通告的路由的 BGP LOCAL_PREF 值。

advertise_fixed_ips

body

布尔值

控制是否将端口的固定 IP 通告到 BGPVPN 的布尔标志。

响应示例

{
    "port_association": {
        "id": "c63149a0-a0b3-4ca7-aba4-9aaa1b39d7f3",
        "port_id": "46a1a80b-7c42-4c45-88fd-b531e636969f",
        "project_id": "b7549121395844bea941bb92feb3fad9",
        "routes": [
            {
                "type": "prefix",
                "prefix": "20.1.0.0/16"
            }
        ],
        "advertise_fixed_ips": true
    }
}
PUT
/v2.0/bgpvpn/bgpvpns/{bgpvpn_id}/port_associations/{port_association_id}

更新端口关联

更新端口关联。

正常响应代码:201

错误响应代码:400、401、403、404

请求

名称

入参

类型

描述

bgpvpn_id

路径

字符串

BGP VPN 的 ID。

port_association_id

路径

字符串

端口与 BGP VPN 之间关联的 ID。

port_association

body

对象

一个 port_association 对象,代表 BGP VPN 与 Neutron 端口的绑定。

routes (可选)

body

数组

路由列表,每条路由都是一个字典,至少包含一个 type 键,可以是 prefixbgpvpn

对于 prefix 类型,IP 前缀(v4 或 v6)在 prefix 键中指定。

对于 bgpvpn 类型,bgpvpn_id 键指定将从中读取路由并将其作为下一跳(任何带有 RT 属于此 BGPVPN 的 route_targetsimport_targets 的路由将被重新通告到关联的 BGPVPN 的 RT(export_targets + route_targets)中,其下一跳/标签指向此端口)的 BGPVPN。

对于这两种类型,local_pref 键可用于控制将通告的路由的 BGP LOCAL_PREF 值。

advertise_fixed_ips (Optional)

body

布尔值

控制是否将端口的固定 IP 通告到 BGPVPN 的布尔标志(默认值:true)。

请求示例

{
    "port_association": {
        "port_id": "46a1a80b-7c42-4c45-88fd-b531e636969f",
        "routes": [
            {
                "type": "bgpvpn",
                "bgpvpn_id": "180630e3-9eae-4ba7-9939-d5f47966e1f0",
                "local_pref": 111
            }
        ],
        "advertise_fixed_ips": false
    }
}

响应参数

名称

入参

类型

描述

port_association

body

对象

一个 port_association 对象,代表 BGP VPN 与 Neutron 端口的绑定。

id

body

字符串

端口与 BGP VPN 之间关联的 ID。

port_id

body

字符串

要与 BGP VPN 关联的 Neutron 端口的 ID。

project_id

body

字符串

项目的 ID。

routes

body

数组

路由列表,每条路由都是一个字典,至少包含一个 type 键,可以是 prefixbgpvpn

对于 prefix 类型,IP 前缀(v4 或 v6)在 prefix 键中指定。

对于 bgpvpn 类型,bgpvpn_id 键指定将从中读取路由并将其作为下一跳(任何带有 RT 属于此 BGPVPN 的 route_targetsimport_targets 的路由将被重新通告到关联的 BGPVPN 的 RT(export_targets + route_targets)中,其下一跳/标签指向此端口)的 BGPVPN。

对于这两种类型,local_pref 键可用于控制将通告的路由的 BGP LOCAL_PREF 值。

advertise_fixed_ips

body

布尔值

控制是否将端口的固定 IP 通告到 BGPVPN 的布尔标志。

响应示例

{
    "port_association": {
        "id": "c63149a0-a0b3-4ca7-aba4-9aaa1b39d7f3",
        "port_id": "46a1a80b-7c42-4c45-88fd-b531e636969f",
        "project_id": "b7549121395844bea941bb92feb3fad9",
        "routes": [
            {
                "type": "bgpvpn",
                "bgpvpn_id": "180630e3-9eae-4ba7-9939-d5f47966e1f0",
                "local_pref": 111
            }
        ],
        "advertise_fixed_ips": false
    }
}
DELETE
/v2.0/bgpvpn/bgpvpns/{bgpvpn_id}/port_associations/{port_association_id}

删除端口关联

删除端口关联。

正常响应代码:204

错误响应代码:401、403、404

请求

名称

入参

类型

描述

bgpvpn_id

路径

字符串

BGP VPN 的 ID。

port_association_id

路径

字符串

端口与 BGP VPN 之间关联的 ID。

响应

There is no body content for the response of a successful DELETE request.

BGP 动态路由

BGP 扬声器

BGP Speaker 作为路由服务器,使用 BGP 路由协议。它将路由通告给添加到 BGP Speaker 的 BGP 对等体。目前,BGP Speaker 只通告其关联的网络路由。

BGP Speaker 需要与“网关”网络关联才能确定符合条件的路由。在 Neutron 中,“网关”网络将 Neutron 路由器连接到上游路由器。外部网络最适合用作网关网络。

此关联构建了同一地址范围内的提供商网络和自服务网络上具有网关的所有虚拟路由器的列表。

GET
/v2.0/bgp-speakers

列出 BGP Speakers

发出一个 GET 请求到 /v2.0/bgp-speakers 来检索可用 BGP Speakers 的列表。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

错误响应代码:400、401、403

请求

名称

入参

类型

描述

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

bgp_speakers

body

数组

一个 bgp_speaker 对象列表。每个 bgp_speaker 对象充当路由服务器,使用 BGP 路由协议。

id

body

字符串

BGP Speaker 的 ID。

name

body

字符串

BGP Speaker 的用户有意义的名称。

ip_version

body

字符串

BGP Speaker 的 IP 版本(4 或 6)。

advertise_floating_ip_host_routes

body

字符串

是否启用或禁用 BGP Speaker 通告浮动 IP 主机路由。默认为 True。

advertise_tenant_networks

body

字符串

是否启用或禁用 BGP Speaker 通告租户网络路由。默认为 True。

local_as

body

字符串

BGP Speaker 的本地自治系统编号。

networks

body

字符串

BGP Speaker 关联的网络 ID。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

响应示例

{
  "bgp_speakers":[
     {
        "peers":[
        ],
        "name":"bgp-speaker-1",
        "tenant_id":"34a6e17a48cf414ebc890367bf42266b",
        "local_as":1001,
        "advertise_tenant_networks":true,
        "networks":[
        ],
        "ip_version":4,
        "advertise_floating_ip_host_routes":true,
        "id":"5e08db80-db77-4b5c-a56d-dbca0b284f2c"
     },
     {
        "peers":[
        ],
        "name":"bgp-speaker",
        "tenant_id":"34a6e17a48cf414ebc890367bf42266b",
        "local_as":1000,
        "advertise_tenant_networks":true,
        "networks":[
        ],
        "ip_version":4,
        "advertise_floating_ip_host_routes":true,
        "id":"b759b2a1-27f4-4a6b-bb61-f2c9a22c9902"
     }
  ]
}
GET
/v2.0/bgp-speakers/{bgp-speaker-id}

显示 BGP Speaker 详细信息

发出一个 GET 请求到 /v2.0/bgp-speakers/<bgp-speaker-id> 来检索有关特定 BGP Speaker 的详细信息。

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

Error response codes: 401, 404

请求

名称

入参

类型

描述

bgp-speaker-id

路径

字符串

BGP Speaker 的 ID。

响应参数

名称

入参

类型

描述

id

body

字符串

BGP Speaker 的 ID。

name

body

字符串

BGP Speaker 的用户有意义的名称。

ip_version

body

字符串

BGP Speaker 的 IP 版本(4 或 6)。

advertise_floating_ip_host_routes

body

字符串

是否启用或禁用 BGP Speaker 通告浮动 IP 主机路由。默认为 True。

advertise_tenant_networks

body

字符串

是否启用或禁用 BGP Speaker 通告租户网络路由。默认为 True。

local_as

body

字符串

BGP Speaker 的本地自治系统编号。

networks

body

字符串

BGP Speaker 关联的网络 ID。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

响应示例

{
   "bgp_speaker": {
      "peers": [
      ],
      "name": "bgp-speaker-1",
      "tenant_id": "34a6e17a48cf414ebc890367bf42266b",
      "local_as": 1001,
      "advertise_tenant_networks": true,
      "networks": [
      ],
      "ip_version": 4,
      "advertise_floating_ip_host_routes": true,
      "id": "5e08db80-db77-4b5c-a56d-dbca0b284f2c"
   }
}
POST
/v2.0/bgp-speakers

创建 BGP Speaker

发出一个 POST 请求到 /v2.0/bgp-speakers,并带以下 JSON 编码数据来创建 BGP Speaker。

正常响应代码:201

错误响应代码:401、403、404、409

请求

名称

入参

类型

描述

name

body

字符串

BGP Speaker 的用户有意义的名称。

ip_version

body

字符串

BGP Speaker 的 IP 版本(4 或 6)。

advertise_floating_ip_host_routes

body

字符串

是否启用或禁用 BGP Speaker 通告浮动 IP 主机路由。默认为 True。

advertise_tenant_networks

body

字符串

是否启用或禁用 BGP Speaker 通告租户网络路由。默认为 True。

local_as

body

字符串

BGP Speaker 的本地自治系统编号。

networks

body

字符串

BGP Speaker 关联的网络 ID。

请求示例

{
   "bgp_speaker":{
      "ip_version":4,
      "local_as":"1000",
      "name":"bgp-speaker"
   }
}

响应参数

名称

入参

类型

描述

id

body

字符串

BGP Speaker 的 ID。

name

body

字符串

BGP Speaker 的用户有意义的名称。

ip_version

body

字符串

BGP Speaker 的 IP 版本(4 或 6)。

advertise_floating_ip_host_routes

body

字符串

是否启用或禁用 BGP Speaker 通告浮动 IP 主机路由。默认为 True。

advertise_tenant_networks

body

字符串

是否启用或禁用 BGP Speaker 通告租户网络路由。默认为 True。

local_as

body

字符串

BGP Speaker 的本地自治系统编号。

networks

body

字符串

BGP Speaker 关联的网络 ID。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

响应示例

{
   "bgp_speaker":{
      "peers":[
      ],
      "name":"bgp-speaker",
      "tenant_id":"34a6e17a48cf414ebc890367bf42266b",
      "local_as":1000,
      "advertise_tenant_networks":true,
      "networks":[
      ],
      "ip_version":4,
      "advertise_floating_ip_host_routes":true,
      "id":"5e08db80-db77-4b5c-a56d-dbca0b284f2c"
   }
}
PUT
/v2.0/bgp-speakers/{bgp-speaker-id}

更新 BGP Speaker

发出 PUT 请求到 /v2.0/bgp-speakers/<bgp-speaker-id> 来更新特定的 BGP Speaker。可以更新以下属性。

正常响应代码:200

错误响应代码:400, 401, 404, 41

请求

名称

入参

类型

描述

bgp-speakeriid

路径

字符串

BGP Speaker 的 ID。

name

body

字符串

BGP Speaker 的用户有意义的名称。

advertise_floating_ip_host_routes

body

字符串

是否启用或禁用 BGP Speaker 通告浮动 IP 主机路由。默认为 True。

advertise_tenant_networks

body

字符串

是否启用或禁用 BGP Speaker 通告租户网络路由。默认为 True。

请求示例

{
   "bgp_speaker":{
      "advertise_floating_ip_host_routes": "true",
      "advertise_tenant_networks": "false",
      "name":"bgp-speaker_2"
   }
}
DELETE
/v2.0/bgp-speakers/{bgp-speaker-id}

删除 BGP Speaker

删除特定的 BGP Speaker。

正常响应代码:204

错误响应代码:400、401、404、412

请求

名称

入参

类型

描述

bgp-speakeri-id

路径

字符串

BGP Speaker 的 ID。

响应

There is no body content for the response of a successful DELETE request.

PUT
/v2.0/bgp-speakers/{bgp-speaker-id}/add_bgp_peer

将 BGP Peer 添加到 BGP Speaker

将 BGP Peer 绑定到指定的 BGP Speaker。

正常响应代码:200

请求

名称

入参

类型

描述

bgp-speaker-id

路径

字符串

BGP Speaker 的 ID。

bgp_peer_id

body

字符串

Peer 的 ID。

请求示例

{
   "bgp_peer_id":"a7193581-a31c-4ea5-8218-b3052758461f"
}

响应参数

名称

入参

类型

描述

bgp_peer_id

body

字符串

Peer 的 ID。

响应示例

{
   "bgp_peer_id":"a7193581-a31c-4ea5-8218-b3052758461f"
}
PUT
/v2.0/bgp-speakers/{bgp-speaker-id}/remove_bgp_peer

从 BGP Speaker 中移除 BGP Peer

将 BGP Peer 从 BGP Speaker 解绑。

正常响应代码:200

请求

名称

入参

类型

描述

bgp-speaker-id

路径

字符串

BGP Speaker 的 ID。

bgp_peer_id

body

字符串

Peer 的 ID。

请求示例

{
   "bgp_peer_id":"a7193581-a31c-4ea5-8218-b3052758461f"
}

响应

There is no body content for the response of a successful DELETE request.

PUT
/v2.0/bgp-speakers/{bgp-speaker-id}/add_gateway_network

将网络添加到 BGP Speaker

将网络添加到指定的 BGP Speaker。

正常响应代码:200

请求

名称

入参

类型

描述

bgp-speaker-id

路径

字符串

BGP Speaker 的 ID。

network_id

body

字符串

连接网络的 ID。

请求示例

{
   "network_id":"f2269b61-6755-4174-8f64-5e318617b204"
}

响应参数

名称

入参

类型

描述

bgp_peer_id

body

字符串

Peer 的 ID。

network_id

body

字符串

连接网络的 ID。

响应示例

{
   "network_id":"f2269b61-6755-4174-8f64-5e318617b204"
}
PUT
/v2.0/bgp-speakers/{bgp-speaker-id}/remove_gateway_network

从 BGP Speaker 中删除网络

从指定的 BGP Speaker 中移除网络。

正常响应代码:200

请求

名称

入参

类型

描述

bgp-speaker-id

路径

字符串

BGP Speaker 的 ID。

network_id

body

字符串

连接网络的 ID。

请求示例

{
   "network_id":"f2269b61-6755-4174-8f64-5e318617b204"
}

响应

There is no body content for the response of a successful DELETE request.

GET
/v2.0/bgp-speakers/{bgp-speaker-id}/get_advertised_routes

列出 BGP Speaker 通告的路由

列出指定的 BGP Speaker 通告的所有路由。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

响应参数

名称

入参

类型

描述

advertised_routes

body

数组

BGP Speaker 通告的路由列表(CIDR-下一跳对)。

cidr

body

字符串

BGP Speaker 通告的路由的 CIDR。

nexthop

body

字符串

BGP Speaker 通告的路由的下一跳。

响应示例

{
   "advertised_routes":[
      {
         "cidr":"192.168.10.0/24",
         "nexthop":"10.0.0.1"
      }
   ]
}
GET
/v2.0/bgp-speakers/{bgp-speaker-id}/bgp-dragents

列出托管特定 BGP Speaker 的动态路由代理

列出托管指定 BGP Speaker 的所有 BGP 动态代理。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

响应参数

名称

入参

类型

描述

admin_state_up

body

布尔值

资源的管理状态,为开启(true)或关闭(false)。

agents

body

数组

一个 agent 对象列表。

agent_type

body

字符串

代理的类型,例如 Open vSwitch agentDHCP agent

alive

body

布尔值

指示代理是否存活并正在运行。

availability_zone

body

字符串

代理的可用区。

binary

body

字符串

用于启动代理的可执行命令,例如 neutron-openvswitch-agentneutron-dhcp-agent

configurations

body

对象

包含特定配置键/值对的对象;其语义由二进制名称和类型确定。

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

description

body

字符串

A human-readable description for the resource.

heartbeat_timestamp

body

字符串

收到最后心跳的时间。

host

body

字符串

代理运行所在系统的名称。

id

body

字符串

资源的ID。

resources_synced (Optional)

body

布尔值

值为 null 表示未尝试将资源视图同步到 Placement。值为 true / false 表示最后一次同步尝试成功。因此,只有当此属性为 true 时,Placement 中的相关资源才能被视为最新。此属性是只读的,仅用于内部更新,但可读以供调试。并非所有代理类型都通过 Placement 跟踪资源,因此 null 的值并不一定意味着系统存在错误。

started_at

body

字符串

代理启动的时间。

topic

body

字符串

代理正在监听的 AMQP 主题的名称,例如 dhcp_agent。当代理不使用 AMQP 主题时,使用特殊值 N/A

响应示例

{
  "agents":[
     {
        "binary":"neutron-bgp-dragent",
        "description":null,
        "admin_state_up":true,
        "heartbeat_timestamp":"2016-05-17 03:05:12",
        "availability_zone":null,
        "alive":true,
        "topic":"bgp_dragent",
        "host":"yangyubj-virtual-machine",
        "agent_type":"BGP dynamic routing agent",
        "resource_versions":{
        },
        "created_at":"2016-05-09 07:38:00",
        "started_at":"2016-05-11 09:06:13",
        "id":"af216618-29d3-4ee7-acab-725bdc90e614",
        "configurations":{
           "advertise_routes":0,
           "bgp_peers":0,
           "bgp_speakers":1
        }
     }
  ]
}

BGP 对等体

Neutron 中的 BGP Peer 代表真实的 BGP 基础设施,如路由器、路由反射器和路由服务器。

当定义了 BGP Peer 并将其与 BGP Speaker 关联时,Neutron 将尝试与提到的远程 Peer 打开 BGP 邻居关系。正是通过此会话,Neutron 才宣告其路由。

GET
/v2.0/bgp-peers

列出 BGP Peers

发出一个 GET 请求到 /v2.0/bgp-peers 来检索可用 BGP Peers 的列表。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

错误响应代码:400、401、403

请求

名称

入参

类型

描述

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

bgp_peers

body

数组

一个 bgp_peer 对象列表。每个 bgp_peer 对象代表真实的 BGP 基础设施,如路由器、路由反射器和路由服务器。

remote_as

body

字符串

BGP Peer 的远程自治系统编号。

name

body

字符串

BGP Peer 的用户有意义的名称。

peer_ip

body

字符串

Peer 的 IP 地址。

id

body

字符串

BGP Peer 的 ID。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

响应示例

{
   "bgp_peers":[
      {
         "auth_type":"none",
         "remote_as":1001,
         "name":"bgp-peer",
         "tenant_id":"34a6e17a48cf414ebc890367bf42266b",
         "peer_ip":"10.0.0.3",
         "id":"a7193581-a31c-4ea5-8218-b3052758461f"
      }
   ]
}
GET
/v2.0/bgp-peers/{bgp-peer-id}

显示 BGP Peer 详细信息

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

Error response codes: 401, 404

请求

名称

入参

类型

描述

bgp-speaker-id

路径

字符串

BGP Speaker 的 ID。

响应参数

名称

入参

类型

描述

bgp_peers

body

数组

一个 bgp_peer 对象列表。每个 bgp_peer 对象代表真实的 BGP 基础设施,如路由器、路由反射器和路由服务器。

remote_as

body

字符串

BGP Peer 的远程自治系统编号。

name

body

字符串

BGP Peer 的用户有意义的名称。

peer_ip

body

字符串

Peer 的 IP 地址。

id

body

字符串

BGP Peer 的 ID。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

响应示例

{
   "bgp_peer":{
      "auth_type":"none",
      "remote_as":1001,
      "name":"bgp-peer",
      "tenant_id":"34a6e17a48cf414ebc890367bf42266b",
      "peer_ip":"10.0.0.3",
      "id":"a7193581-a31c-4ea5-8218-b3052758461f"
   }
}
POST
/v2.0/bgp-peers

创建 BGP Peer

创建 BGP 对等体。

正常响应代码:201

错误响应代码:401、403、404、409

请求

名称

入参

类型

描述

auth_type

body

对象

BGP Peer 的认证类型,可以是 nonemd5。默认为 none

remote_as

body

字符串

BGP Peer 的远程自治系统编号。

name

body

字符串

BGP Peer 的用户有意义的名称。

peer_ip

body

字符串

Peer 的 IP 地址。

请求示例

{
   "bgp_peer":{
      "auth_type":"none",
      "remote_as":"1001",
      "name":"bgp-peer",
      "peer_ip":"10.0.0.3"
   }
}

响应参数

名称

入参

类型

描述

bgp_peer

body

对象

一个 BGP Peer 对象。

auth_type

body

对象

BGP Peer 的认证类型,可以是 nonemd5。默认为 none

password

body

字符串

指定认证类型的认证密码。

remote_as

body

字符串

BGP Peer 的远程自治系统编号。

name

body

字符串

BGP Peer 的用户有意义的名称。

peer_ip

body

字符串

Peer 的 IP 地址。

id

body

字符串

BGP Peer 的 ID。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

响应示例

{
   "bgp_peer":{
      "auth_type":"none",
      "remote_as":"1001",
      "name":"bgp-peer",
      "tenant_id":"34a6e17a48cf414ebc890367bf42266b",
      "peer_ip":"10.0.0.3",
      "id":"a7193581-a31c-4ea5-8218-b3052758461f"
   }
}
PUT
/v2.0/bgp-peers/{bgp-peer-id}

更新 BGP Peer

更新特定的 BGP Peer。

正常响应代码:200

错误响应代码:400, 401, 404, 41

请求

名称

入参

类型

描述

name

body

字符串

BGP Peer 的用户有意义的名称。

password

body

字符串

指定认证类型的认证密码。

DELETE
/v2.0/bgp-peers/{bgp-peer-id}

删除 BGP Peer

删除特定的 BGP Peer。

正常响应代码:204

错误响应代码:400、401、404、412

BGP Speaker 和动态路由代理交互

POST
/v2.0/agents/{bgp-agent-id}/bgp-drinstances

将 BGP Speaker 添加到动态路由代理

发出一个 POST 请求到 /v2.0/agents/{bgp-agent-id}/bgp-drinstances 来将 BGP Speaker 添加到指定的动态路由代理。

注意

动态路由插件可以配置为使用静态或动态(机会)调度 BGP Speaker 与动态路由代理。当使用静态调度程序时,必须使用此 API 将 BGP Speaker 与一个或多个动态路由代理关联。但是,当使用机会调度程序时,此关联会自动发生。因此,只有在希望将 BGP Speaker 与其他动态路由代理关联时(例如,在进行节点维护之前),才需要调用此 API。有关更多信息,请参阅 代理调度程序 文档。

正常响应代码:201

请求

名称

入参

类型

描述

bgp_speaker_id

body

字符串

BGP Speaker 的 ID。

请求示例

{
    "bgp_speaker_id": "5639072c-49eb-480a-9f11-953386589bc8"
}

响应

成功将 BGP Speaker 添加到动态路由代理的响应没有正文内容。

GET
/v2.0/agents/{bgp-dragent-id}/bgp-drinstances

列出由动态路由代理托管的 BGP Speaker

发出一个 GET 请求到 /v2.0/agents/{bgp-dragent-id}/bgp-drinstances 来列出托管在指定动态路由代理上的所有 BGP Speaker。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

请求

名称

入参

类型

描述

bgp-dragent-id

路径

字符串

动态路由代理的 ID。

响应参数

名称

入参

类型

描述

bgp_speakers

body

数组

一个 bgp_speaker 对象列表。每个 bgp_speaker 对象充当路由服务器,使用 BGP 路由协议。

id

body

字符串

BGP Speaker 的 ID。

peers

body

数组

一个 bgp_peer 对象列表。每个 bgp_peer 对象代表真实的 BGP 基础设施,如路由器、路由反射器和路由服务器。

name

body

字符串

BGP Speaker 的用户有意义的名称。

ip_version

body

字符串

BGP Speaker 的 IP 版本(4 或 6)。

advertise_floating_ip_host_routes

body

字符串

是否启用或禁用 BGP Speaker 通告浮动 IP 主机路由。默认为 True。

advertise_tenant_networks

body

字符串

是否启用或禁用 BGP Speaker 通告租户网络路由。默认为 True。

local_as

body

字符串

BGP Speaker 的本地自治系统编号。

networks

body

字符串

BGP Speaker 关联的网络 ID。

project_id

body

字符串

项目的 ID。

响应示例

{
     "bgp_speakers":[
        {
           "peers":[
           ],
           "name":"bgp-speaker",
           "tenant_id":"34a6e17a48cf414ebc890367bf42266b",
           "local_as":1000,
           "advertise_tenant_networks":true,
           "networks":[
           ],
           "ip_version":4,
           "advertise_floating_ip_host_routes":true,
           "id":"b759b2a1-27f4-4a6b-bb61-f2c9a22c9902"
        }
     ]
}
DELETE
/v2.0/agents/{bgp-agent-id}/bgp-drinstances/{bgp-speaker-id}

从动态路由代理中删除 BGP Speaker

发出一个 DELETE 请求到 /v2.0/agents/{bgp-agent-id}/bgp-drinstances/{bgp-speaker-id} 来删除托管在指定动态路由代理上的 BGP Speaker。

注意

动态路由插件可以配置为使用静态或动态(机会)调度 BGP Speaker 与动态路由代理。当使用静态调度程序时,必须使用此 API 将 BGP Speaker 与动态路由代理解除关联。但是,当使用机会调度程序时,此解除关联会自动发生。因此,只有在希望将 BGP Speaker 与其他动态路由代理解除关联时(例如,在进行节点维护之后),才需要调用此 API。有关更多信息,请参阅 代理调度程序 文档。

正常响应代码:204

请求

名称

入参

类型

描述

bgp-speaker-id

路径

字符串

BGP Speaker 的 ID。

bgp-dragent-id

路径

字符串

动态路由代理的 ID。

响应

There is no body content for the response of a successful DELETE request.

日志

日志资源

“logging”扩展列出、创建、显示信息并更新日志资源。

资源时间戳

The standard-attr-timestamp extension adds the created_at and updated_at attributes to all resources that have standard attributes.

GET
/v2.0/log/logs

列出日志

列出与您的项目相关的所有日志资源。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

列表可能为空。

正常响应代码:200

Error response codes: 401

请求

名称

入参

类型

描述

id (可选)

查询

字符串

Filter the list result by the ID of the resource.

name (可选)

查询

字符串

Filter the list result by the human-readable name of the resource.

description (可选)

查询

字符串

Filter the list result by the human-readable description of the resource.

tenant_id (可选)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

project_id (可选)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

event (可选)

查询

字符串

按安全事件类型过滤日志列表结果,该类型为 ACCEPTDROPALL

revision_number (Optional)

查询

整数

Filter the list result by the revision number of the resource.

resource_type (可选)

查询

字符串

按资源类型(例如 security_group)过滤日志列表结果。

resource_id (Optional)

查询

字符串

按资源 ID(例如安全组 ID)过滤日志列表结果。

target_id (Optional)

查询

字符串

按日志目标的资源 ID 过滤日志列表结果。

enabled(可选)

查询

布尔值

根据此日志对象是否启用(true)或禁用(false)过滤日志列表结果。

sort_dir (可选)

查询

字符串

Sort direction. A valid value is asc (ascending) or desc (descending). You can specify multiple pairs of sort key and sort direction query parameters.

sort_key (可选)

查询

字符串

按日志属性排序。您可以指定多个排序键和排序方向查询参数。排序键仅限于

  • enabled

  • 事件

  • id

  • name

  • project_id

  • resource_id

  • resource_type

  • target_id

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

日志

body

数组

一个 log 对象列表。

id

body

字符串

日志对象的 ID。

name

body

字符串

Human-readable name of the resource.

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

description

body

字符串

A human-readable description for the resource.

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

事件

body

字符串

要记录的安全事件类型。ACCEPTDROPALL

revision_number

body

整数

The revision number of the resource.

resource_type

body

字符串

日志资源的资源类型,例如 ‘security_group’。

resource_id

body

字符串

日志资源的 ID(例如安全组 ID)。

target_id

body

字符串

资源目标日志的 ID,例如端口 ID。

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

enabled

body

布尔值

指示此日志对象是启用还是禁用。

响应示例

{
    "logs": [
        {
            "name": "security group log",
            "description": "Log for project demo.",
            "id": "46ebaec0-0570-43ac-82f6-60d2b03168c4",
            "project_id": "92a5a4f4245a4abbafacb7ca73b027b0",
            "tenant_id": "92a5a4f4245a4abbafacb7ca73b027b0",
            "created_at": "2018-04-03T21:03:04Z",
            "updated_at": "2018-04-03T21:03:04Z",
            "enabled": true,
            "revision_number": 1,
            "resource_type": "security_group",
            "resource_id": null,
            "target_id": null,
            "event": "ALL"
        }
    ]
}
POST
/v2.0/log/logs

创建日志

创建日志资源。

使用您在请求对象中定义的配置创建日志资源。将返回一个响应对象。该对象包含一个唯一的 ID。

如果调用者不是管理员用户,此调用将返回 HTTP Forbidden (403) 响应代码。

具有管理员角色的用户可以通过指定与他们自己的项目 ID 不同的项目 ID 来代表其他项目创建策略。

正常响应代码:201

错误响应代码:400、401、403、409

请求

名称

入参

类型

描述

log

body

对象

一个 log 对象。

name (可选)

body

字符串

资源的易读名称。默认情况下为空字符串。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

tenant_id (可选)

body

字符串

The ID of the project that owns the resource. Only administrative and users with advsvc role can specify a project ID other than their own. You cannot change this value through authorization policies.

project_id (可选)

body

字符串

The ID of the project that owns the resource. Only administrative and users with advsvc role can specify a project ID other than their own. You cannot change this value through authorization policies.

event (可选)

body

字符串

要记录的安全事件类型。ACCEPTDROPALL。默认为 ALL

resource_type

body

字符串

日志资源的资源类型,例如 ‘security_group’。

resource_id (Optional)

body

字符串

日志资源的 ID(例如安全组 ID)。

target_id (Optional)

body

字符串

资源目标日志的 ID,例如端口 ID。

enabled(可选)

body

布尔值

指示此日志对象是启用还是禁用。默认为 true。

请求示例

{
    "log": {
        "name": "security group log",
        "description": "Log for project demo.",
        "resource_type": "security_group"
    }
}

响应参数

名称

入参

类型

描述

log

body

对象

一个 log 对象。

id

body

字符串

日志对象的 ID。

name

body

字符串

Human-readable name of the resource.

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

description

body

字符串

A human-readable description for the resource.

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

事件

body

字符串

要记录的安全事件类型。ACCEPTDROPALL

revision_number

body

整数

The revision number of the resource.

resource_type

body

字符串

日志资源的资源类型,例如 ‘security_group’。

resource_id

body

字符串

日志资源的 ID(例如安全组 ID)。

target_id

body

字符串

资源目标日志的 ID,例如端口 ID。

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

enabled

body

布尔值

指示此日志对象是启用还是禁用。

请求示例

{
    "log": {
        "name": "security group log",
        "description": "Log for project demo.",
        "id": "46ebaec0-0570-43ac-82f6-60d2b03168c4",
        "project_id": "92a5a4f4245a4abbafacb7ca73b027b0",
        "tenant_id": "92a5a4f4245a4abbafacb7ca73b027b0",
        "created_at": "2018-04-03T21:03:04Z",
        "updated_at": "2018-04-03T21:03:04Z",
        "enabled": true,
        "resource_type": "security_group",
        "resource_id": null,
        "revision_number": 1,
        "target_id": null,
        "event": "ALL"
    }
}
GET
/v2.0/log/logs/{log_id}

显示日志

显示日志资源的详细信息。

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

Error response codes: 401, 404

请求

名称

入参

类型

描述

log_id

路径

字符串

日志资源的 ID。

响应参数

名称

入参

类型

描述

log

body

对象

一个 log 对象。

id

body

字符串

日志对象的 ID。

name

body

字符串

Human-readable name of the resource.

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

description

body

字符串

A human-readable description for the resource.

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

事件

body

字符串

要记录的安全事件类型。ACCEPTDROPALL

revision_number

body

整数

The revision number of the resource.

resource_type

body

字符串

日志资源的资源类型,例如 ‘security_group’。

resource_id

body

字符串

日志资源的 ID(例如安全组 ID)。

target_id

body

字符串

资源目标日志的 ID,例如端口 ID。

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

enabled

body

布尔值

指示此日志对象是启用还是禁用。

响应示例

{
    "log": {
        "name": "security group log",
        "description": "Log for project demo.",
        "id": "46ebaec0-0570-43ac-82f6-60d2b03168c4",
        "project_id": "8d4c70a21fed4aeba121a1a429ba0d04",
        "tenant_id": "8d4c70a21fed4aeba121a1a429ba0d04",
        "created_at": "2018-04-03T21:03:04Z",
        "updated_at": "2018-04-03T21:03:04Z",
        "enabled": true,
        "revision_number": 1,
        "resource_type": "security_group",
        "resource_id": null,
        "target_id": null,
        "event": "ACCEPT"
    }
}
PUT
/v2.0/log/logs/{log_id}

更新日志

更新日志资源。

正常响应代码:200

错误响应代码:400、401、404、412

请求

名称

入参

类型

描述

log_id

路径

字符串

日志资源的 ID。

log

body

对象

一个 log 对象。

name (可选)

body

字符串

资源的易读名称。默认情况下为空字符串。

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

enabled(可选)

body

布尔值

指示此日志对象是启用还是禁用。

请求示例

{
    "log": {
        "enabled": false
    }
}

响应参数

名称

入参

类型

描述

log

body

对象

一个 log 对象。

id

body

字符串

日志对象的 ID。

name

body

字符串

Human-readable name of the resource.

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

description

body

字符串

A human-readable description for the resource.

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

事件

body

字符串

要记录的安全事件类型。ACCEPTDROPALL

revision_number

body

整数

The revision number of the resource.

resource_type

body

字符串

日志资源的资源类型,例如 ‘security_group’。

resource_id

body

字符串

日志资源的 ID(例如安全组 ID)。

target_id

body

字符串

资源目标日志的 ID,例如端口 ID。

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

enabled

body

布尔值

指示此日志对象是启用还是禁用。

响应示例

{
    "log": {
        "name": "security group log",
        "description": "Log for project demo.",
        "id": "46ebaec0-0570-43ac-82f6-60d2b03168c4",
        "project_id": "8d4c70a21fed4aeba121a1a429ba0d04",
        "tenant_id": "8d4c70a21fed4aeba121a1a429ba0d04",
        "created_at": "2018-04-03T21:03:04Z",
        "updated_at": "2018-04-03T21:03:04Z",
        "enabled": false,
        "revision_number": 3,
        "resource_type": "security_group",
        "resource_id": null,
        "target_id": null,
        "event": "DROP"
    }
}
DELETE
/v2.0/log/logs/{log_id}

删除日志

删除日志资源。

正常响应代码:204

错误响应代码:400、401、404、412

请求

名称

入参

类型

描述

log_id

路径

字符串

日志资源的 ID。

响应

There is no body content for the response of a successful DELETE request.

可记录资源

GET
/v2.0/log/loggable-resources

列出可记录资源

列出支持的所有资源日志类型。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

Error response codes: 401

请求

响应参数

名称

入参

类型

描述

loggable_resources

body

对象

一个 loggable_resource 对象列表。

type

body

字符串

日志资源的资源类型,例如 ‘security_group’。

响应示例

{
    "loggable_resources": [
        {
            "type": "security_group"
        }
    ]
}

网络代理

代理

列出、显示详细信息、更新和删除代理。

资源同步代理扩展

“agent-resources-synced”扩展向代理添加了 resources_synced 属性。

可用区扩展

“availability_zone”扩展向代理添加了 availability_zone 属性。availability_zone 是代理运行的可用区名称。

GET
/v2.0/agents

列出所有代理

列出所有代理。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

Error response codes: 401

请求

名称

入参

类型

描述

admin_state_up (Optional)

查询

布尔值

Filter the list result by the administrative state of the resource, which is up (true) or down (false).

agent_type (Optional)

查询

字符串

按代理类型过滤列表结果,例如 Open vSwitch agentDHCP agent

alive (Optional)

查询

布尔值

根据代理是否存活并运行来过滤列表结果。

availability_zone (可选)

查询

字符串

按代理的可用区过滤列表结果。

binary (可选)

查询

字符串

按用于启动代理的可执行命令过滤列表结果,例如 neutron-openvswitch-agentneutron-dhcp-agent

description (可选)

查询

字符串

Filter the list result by the human-readable description of the resource.

host (可选)

查询

字符串

按代理运行的系统的主机名过滤列表结果。

id (可选)

查询

字符串

Filter the list result by the ID of the resource.

topic (Optional)

查询

字符串

按代理正在监听的 AMQP 主题的名称过滤列表结果,例如 dhcp_agent

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

sort_dir (可选)

查询

字符串

Sort direction. A valid value is asc (ascending) or desc (descending). You can specify multiple pairs of sort key and sort direction query parameters.

sort_key (可选)

查询

字符串

按代理属性排序。您可以指定多个排序键和排序方向查询参数。排序键仅限于

  • admin_state_up

  • agent_type

  • alive

  • binary

  • created_at

  • description

  • heartbeat_timestamp

  • host

  • id

  • started_at

  • topic

响应参数

名称

入参

类型

描述

admin_state_up

body

布尔值

资源的管理状态,为开启(true)或关闭(false)。

agents

body

数组

一个 agent 对象列表。

agent_type

body

字符串

代理的类型,例如 Open vSwitch agentDHCP agent

alive

body

布尔值

指示代理是否存活并正在运行。

availability_zone

body

字符串

代理的可用区。

binary

body

字符串

用于启动代理的可执行命令,例如 neutron-openvswitch-agentneutron-dhcp-agent

configurations

body

对象

包含特定配置键/值对的对象;其语义由二进制名称和类型确定。

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

description

body

字符串

A human-readable description for the resource.

heartbeat_timestamp

body

字符串

收到最后心跳的时间。

host

body

字符串

代理运行所在系统的名称。

id

body

字符串

资源的ID。

resources_synced (Optional)

body

布尔值

值为 null 表示未尝试将资源视图同步到 Placement。值为 true / false 表示最后一次同步尝试成功。因此,只有当此属性为 true 时,Placement 中的相关资源才能被视为最新。此属性是只读的,仅用于内部更新,但可读以供调试。并非所有代理类型都通过 Placement 跟踪资源,因此 null 的值并不一定意味着系统存在错误。

started_at

body

字符串

代理启动的时间。

topic

body

字符串

代理正在监听的 AMQP 主题的名称,例如 dhcp_agent。当代理不使用 AMQP 主题时,使用特殊值 N/A

响应示例

{
    "agents": [
        {
            "binary": "neutron-openvswitch-agent",
            "description": null,
            "availability_zone": null,
            "heartbeat_timestamp": "2017-09-12 19:40:08",
            "admin_state_up": true,
            "alive": true,
            "id":" 04c62b91-b799-48b7-9cd5-2982db6df9c6",
            "topic": "N/A",
            "host": "agenthost1",
            "agent_type": "Open vSwitch agent",
            "started_at": "2017-09-12 19:35:38",
            "created_at": "2017-09-12 19:35:38",
            "resources_synced": true,
            "configurations": {
                "ovs_hybrid_plug": true,
                "in_distributed_mode": false,
                "datapath_type": "system",
                "vhostuser_socket_dir": "/var/run/openvswitch",
                "tunneling_ip": "172.16.78.191",
                "arp_responder_enabled": false,
                "devices": 0,
                "ovs_capabilities": {
                    "datapath_types": [
                        "netdev",
                        "system"
                    ],
                    "iface_types": [
                        "geneve",
                        "gre",
                        "internal",
                        "ipsec_gre",
                        "lisp",
                        "patch",
                        "stt",
                        "system",
                        "tap",
                        "vxlan"
                    ]
                },
                "log_agent_heartbeats": false,
                "l2_population": false,
                "tunnel_types": [
                    "vxlan"
                ],
                "extensions": [

                ],
                "enable_distributed_routing": false,
                "bridge_mappings": {
                    "public": "br-ex"
                }
            }
        },
        {
            "binary": "neutron-dhcp-agent",
            "description": null,
            "availability_zone": "nova",
            "heartbeat_timestamp": "2017-09-12 19:39:56",
            "admin_state_up": true,
            "alive": true,
            "id": "840d5d68-5759-4e9e-812f-f3bd19214c7f",
            "topic": "dhcp_agent",
            "host": "agenthost1",
            "agent_type" :"DHCP agent",
            "started_at": "2017-09-12 19:35:36",
            "created_at": "2017-09-12 19:35:36",
            "resources_synced": null,
            "configurations": {
                "subnets": 2,
                "dhcp_lease_duration": 86400,
                "dhcp_driver": "neutron.agent.linux.dhcp.Dnsmasq",
                "networks": 1,
                "log_agent_heartbeats": false,
                "ports": 3
            }
        },
        {
            "binary": "neutron-l3-agent",
            "description": null,
            "availability_zone": "nova",
            "heartbeat_timestamp": "2017-09-12 19:40:08",
            "admin_state_up": true,
            "alive": true,
            "id": "a09b81fc-5a42-46d3-a306-1a5d122a7787",
            "topic": "l3_agent",
            "host": "agenthost1",
            "agent_type": "L3 agent",
            "started_at": "2017-09-12 19:35:38",
            "created_at": "2017-09-12 19:35:38",
            "resources_synced": null,
            "configurations": {
                "agent_mode": "legacy",
                "gateway_external_network_id": "",
                "handle_internal_only_routers": true,
                "routers": 1,
                "interfaces": 2,
                "floating_ips": 0,
                "interface_driver": "openvswitch",
                "log_agent_heartbeats": false,
                "ex_gw_ports": 1
            }
        },
        {
            "binary": "neutron-metadata-agent",
            "description": null,
            "availability_zone": null,
            "heartbeat_timestamp": "2017-09-12 19:40:09",
            "admin_state_up": true,
            "alive": true,
            "id": "c876c9f7-1058-4b9b-90ed-20fb3f905ec4",
            "topic": "N/A",
            "host": "agenthost1",
            "agent_type": "Metadata agent",
            "started_at": "2017-09-12 19:35:39",
            "created_at": "2017-09-12 19:35:39",
            "resources_synced": null,
            "configurations": {
                "log_agent_heartbeats": false,
                "nova_metadata_host": "172.16.78.191",
                "nova_metadata_port": 8775,
                "metadata_proxy_socket": "/opt/stack/data/neutron/metadata_proxy"
            }
        }
    ]
}
GET
/v2.0/agents/{agent_id}

显示代理详细信息

显示代理的详细信息。

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

Error response codes: 401, 404

请求

名称

入参

类型

描述

agent_id

路径

字符串

代理的 ID。

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

admin_state_up

body

布尔值

资源的管理状态,为开启(true)或关闭(false)。

agent

body

字符串

一个 agent 对象。

agent_type

body

字符串

代理的类型,例如 Open vSwitch agentDHCP agent

alive

body

布尔值

指示代理是否存活并正在运行。

availability_zone

body

字符串

代理的可用区。

binary

body

字符串

用于启动代理的可执行命令,例如 neutron-openvswitch-agentneutron-dhcp-agent

configurations

body

对象

包含特定配置键/值对的对象;其语义由二进制名称和类型确定。

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

description

body

字符串

A human-readable description for the resource.

heartbeat_timestamp

body

字符串

收到最后心跳的时间。

host

body

字符串

代理运行所在系统的名称。

id

body

字符串

资源的ID。

resources_synced (Optional)

body

布尔值

值为 null 表示未尝试将资源视图同步到 Placement。值为 true / false 表示最后一次同步尝试成功。因此,只有当此属性为 true 时,Placement 中的相关资源才能被视为最新。此属性是只读的,仅用于内部更新,但可读以供调试。并非所有代理类型都通过 Placement 跟踪资源,因此 null 的值并不一定意味着系统存在错误。

started_at

body

字符串

代理启动的时间。

topic

body

字符串

代理正在监听的 AMQP 主题的名称,例如 dhcp_agent。当代理不使用 AMQP 主题时,使用特殊值 N/A

响应示例

{
    "agent": {
        "binary": "neutron-openvswitch-agent",
        "description": null,
        "availability_zone": null,
        "heartbeat_timestamp": "2017-09-12 19:40:38",
        "admin_state_up": true,
        "alive": true,
        "id": "04c62b91-b799-48b7-9cd5-2982db6df9c6",
        "topic": "N/A",
        "host": "agenthost1",
        "agent_type": "Open vSwitch agent",
        "started_at": "2017-09-12 19:35:38",
        "created_at": "2017-09-12 19:35:38",
        "resources_synced": true,
        "configurations": {
            "ovs_hybrid_plug": true,
            "in_distributed_mode": false,
            "datapath_type": "system",
            "vhostuser_socket_dir": "/var/run/openvswitch",
            "tunneling_ip": "172.16.78.191",
            "arp_responder_enabled": false,
            "devices": 0,
            "ovs_capabilities": {
                "datapath_types": [
                    "netdev",
                    "system"
                ],
                "iface_types": [
                    "geneve",
                    "gre",
                    "internal",
                    "ipsec_gre",
                    "lisp",
                    "patch",
                    "stt",
                    "system",
                    "tap",
                    "vxlan"
                ]
            },
            "log_agent_heartbeats": false,
            "l2_population": false,
            "tunnel_types": [
                "vxlan"
            ],
            "extensions": [],
            "enable_distributed_routing": false,
            "bridge_mappings": {
                "public": "br-ex"
            }
        }
    }
}
PUT
/v2.0/agents/{agent_id}

更新代理

更新代理。

正常响应代码:200

错误响应代码:400、401、403、404

请求

名称

入参

类型

描述

agent_id

路径

字符串

代理的 ID。

admin_state_up (Optional)

body

布尔值

资源的管理状态,为开启(true)或关闭(false)。默认为true

description (可选)

body

字符串

A human-readable description for the resource. Default is an empty string.

请求示例

{
    "agent": {
        "description": "My OVS agent for OpenStack"
    }
}

响应参数

名称

入参

类型

描述

admin_state_up

body

布尔值

资源的管理状态,为开启(true)或关闭(false)。

agent

body

字符串

一个 agent 对象。

agent_type

body

字符串

代理的类型,例如 Open vSwitch agentDHCP agent

alive

body

布尔值

指示代理是否存活并正在运行。

availability_zone

body

字符串

代理的可用区。

binary

body

字符串

用于启动代理的可执行命令,例如 neutron-openvswitch-agentneutron-dhcp-agent

configurations

body

对象

包含特定配置键/值对的对象;其语义由二进制名称和类型确定。

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

description

body

字符串

A human-readable description for the resource.

heartbeat_timestamp

body

字符串

收到最后心跳的时间。

host

body

字符串

代理运行所在系统的名称。

id

body

字符串

资源的ID。

resources_synced (Optional)

body

布尔值

值为 null 表示未尝试将资源视图同步到 Placement。值为 true / false 表示最后一次同步尝试成功。因此,只有当此属性为 true 时,Placement 中的相关资源才能被视为最新。此属性是只读的,仅用于内部更新,但可读以供调试。并非所有代理类型都通过 Placement 跟踪资源,因此 null 的值并不一定意味着系统存在错误。

started_at

body

字符串

代理启动的时间。

topic

body

字符串

代理正在监听的 AMQP 主题的名称,例如 dhcp_agent。当代理不使用 AMQP 主题时,使用特殊值 N/A

响应示例

{
    "agent": {
        "binary": "neutron-openvswitch-agent",
        "description": "My OVS agent for OpenStack",
        "availability_zone": null,
        "heartbeat_timestamp": "2017-09-12 19:40:38",
        "admin_state_up": true,
        "alive": true,
        "id": "04c62b91-b799-48b7-9cd5-2982db6df9c6",
        "topic": "N/A",
        "host": "agenthost1",
        "agent_type": "Open vSwitch agent",
        "started_at": "2017-09-12 19:35:38",
        "created_at": "2017-09-12 19:35:38",
        "resources_synced": true,
        "configurations": {
            "ovs_hybrid_plug": true,
            "in_distributed_mode": false,
            "datapath_type": "system",
            "vhostuser_socket_dir": "/var/run/openvswitch",
            "tunneling_ip": "172.16.78.191",
            "arp_responder_enabled": false,
            "devices": 0,
            "ovs_capabilities": {
                "datapath_types": [
                    "netdev",
                    "system"
                ],
                "iface_types": [
                    "geneve",
                    "gre",
                    "internal",
                    "ipsec_gre",
                    "lisp",
                    "patch",
                    "stt",
                    "system",
                    "tap",
                    "vxlan"
                ]
            },
            "log_agent_heartbeats": false,
            "l2_population": false,
            "tunnel_types": [
                "vxlan"
            ],
            "extensions": [],
            "enable_distributed_routing": false,
            "bridge_mappings": {
                "public": "br-ex"
            }
        }
    }
}
DELETE
/v2.0/agents/{agent_id}

删除代理

可以移除不再使用的代理。在通过 API 删除代理之前,应停止/禁用该代理。

正常响应代码:204

错误响应代码:401, 404, 409

请求

名称

入参

类型

描述

agent_id

路径

字符串

代理的 ID。

响应

There is no body content for the response of a successful DELETE request.

可用区

列出可用区。

GET
/v2.0/availability_zones

列出所有可用区

列出所有可用区。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

Error response codes: 401

请求

名称

入参

类型

描述

state (可选)

查询

字符串

按可用区的状态过滤列表结果,该状态为 availableunavailable

resource (Optional)

查询

字符串

按可用区的资源类型过滤列表结果。支持的资源类型为 networkrouter

name (可选)

查询

字符串

Filter the list result by the human-readable name of the resource.

响应参数

名称

入参

类型

描述

availability_zones

body

数组

一个 availability zone 对象列表。

state

body

字符串

可用区的状态,为 availableunavailable

resource

body

字符串

可用区的资源类型。支持的资源类型为 networkrouter

name

body

字符串

Human-readable name of the resource.

响应示例

{
    "availability_zones": [
        {
            "state": "available",
            "resource": "router",
            "name": "nova"
        },
        {
            "state": "available",
            "resource": "network",
            "name": "nova"
        }
    ]
}

L3 代理调度程序

L3 代理调度程序扩展(l3_agent_scheduler)允许管理员将 Neutron 路由器分配给 Neutron L3 代理,并检索 Neutron 路由器与 L3 代理之间的映射。

GET
/v2.0/agents/{agent_id}/l3-routers

列出 L3 代理托管的路由器

列出 L3 代理所托管的路由器。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

Error response codes: 401, 404

请求

名称

入参

类型

描述

agent_id

路径

字符串

代理的 ID。

响应参数

名称

入参

类型

描述

routers

body

数组

一个 router 对象的列表。

id

body

字符串

路由器的ID。

tenant_id

body

字符串

项目的 ID。

project_id

body

字符串

项目的 ID。

name

body

字符串

Human-readable name of the resource.

description

body

字符串

A human-readable description for the resource.

admin_state_up

body

布尔值

资源的管理状态,为开启(true)或关闭(false)。

status

body

字符串

路由器状态。

external_gateway_info

body

对象

路由器的外部网关信息。如果路由器有外部网关,这将是一个包含 network_idenable_snatexternal_fixed_ipsqos_policy_idenable_default_route_ecmpenable_default_route_bfd 的字典。否则,这将是 null

revision_number

body

整数

The revision number of the resource.

routes

body

数组

L3 路由器的附加路由配置。包含 destinationnexthop 参数的字典列表。启用 extraroute 扩展时可用。

destination

body

字符串

目标 CIDR。

nexthop

body

字符串

相应目标的下一跳 IP 地址。下一跳 IP 地址必须是路由器接口连接到的某个子网的一部分。

distributed

body

布尔值

true 表示分布式路由器。启用 dvr 扩展时可用。

ha

body

布尔值

true 表示高可用路由器。启用 l3-ha 扩展时可用。

availability_zone_hints

body

数组

路由器的可用区域候选。启用 router_availability_zone 扩展时可用。

availability_zones

body

数组

路由器的可用区域。启用 router_availability_zone 扩展时可用。

service_type_id

body

字符串

与路由器关联的服务类型的 ID。

flavor_id

body

字符串

与路由器关联的风格的 ID。

响应示例

{
    "routers": [
        {
            "admin_state_up": true,
            "availability_zone_hints": [],
            "availability_zones": [
                "nova"
            ],
            "description": "",
            "distributed": false,
            "external_gateway_info": {
                "enable_snat": true,
                "external_fixed_ips": [
                    {
                        "ip_address": "172.24.4.3",
                        "subnet_id": "b930d7f6-ceb7-40a0-8b81-a425dd994ccf"
                    },
                    {
                        "ip_address": "2001:db8::c",
                        "subnet_id": "0c56df5d-ace5-46c8-8f4c-45fa4e334d18"
                    }
                ],
                "network_id": "ae34051f-aa6c-4c75-abf5-50dc9ac99ef3"
            },
            "flavor_id": "f7b14d9a-b0dc-4fbe-bb14-a0f4970a69e0",
            "ha": false,
            "id": "915a14a6-867b-4af7-83d1-70efceb146f9",
            "name": "router2",
            "revision_number": 1,
            "routes": [
                {
                    "destination": "179.24.1.0/24",
                    "nexthop": "172.24.3.99"
                }
            ],
            "status": "ACTIVE",
            "project_id": "0bd18306d801447bb457a46252d82d13",
            "tenant_id": "0bd18306d801447bb457a46252d82d13",
            "service_type_id": null
        },
        {
            "admin_state_up": true,
            "availability_zone_hints": [],
            "availability_zones": [
                "nova"
            ],
            "description": "",
            "distributed": false,
            "external_gateway_info": {
                "enable_snat": true,
                "external_fixed_ips": [
                    {
                        "ip_address": "172.24.4.6",
                        "subnet_id": "b930d7f6-ceb7-40a0-8b81-a425dd994ccf"
                    },
                    {
                        "ip_address": "2001:db8::9",
                        "subnet_id": "0c56df5d-ace5-46c8-8f4c-45fa4e334d18"
                    }
                ],
                "network_id": "ae34051f-aa6c-4c75-abf5-50dc9ac99ef3"
            },
            "flavor_id": "f7b14d9a-b0dc-4fbe-bb14-a0f4970a69e0",
            "ha": false,
            "id": "f8a44de0-fc8e-45df-93c7-f79bf3b01c95",
            "name": "router1",
            "revision_number": 1,
            "routes": [],
            "status": "ACTIVE",
            "project_id": "0bd18306d801447bb457a46252d82d13",
            "tenant_id": "0bd18306d801447bb457a46252d82d13",
            "service_type_id": null
        }
    ]
}
POST
/v2.0/agents/{agent_id}/l3-routers

调度路由器到 L3 代理

将路由器添加到 L3 代理。

正常响应代码:201

错误响应代码:400、401、404

请求

名称

入参

类型

描述

agent_id

路径

字符串

代理的 ID。

router_id

body

字符串

路由器的ID。

请求示例

{
  "router_id": "43e66290-79a4-415d-9eb9-7ff7919839e1"
}

响应参数

null

响应示例

成功 POST 请求的响应没有正文内容。

DELETE
/v2.0/agents/{agent_id}/l3-routers/{router_id}

从 L3 代理中移除 L3 路由器

从 L3 代理中移除路由器。

正常响应代码:204

Error response codes: 401, 404

请求

名称

入参

类型

描述

agent_id

路径

字符串

代理的 ID。

router_id

路径

字符串

路由器的ID。

响应示例

There is no body content for the response of a successful DELETE request.

GET
/v2.0/routers/{router_id}/l3-agents

列出托管路由器的 L3 代理

列出托管特定路由器的 L3 代理。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

Error response codes: 401, 404

请求

名称

入参

类型

描述

router_id

路径

字符串

路由器的ID。

响应参数

名称

入参

类型

描述

admin_state_up

body

布尔值

资源的管理状态,为开启(true)或关闭(false)。

agents

body

数组

一个 agent 对象列表。

agent_type

body

字符串

代理的类型,例如 Open vSwitch agentDHCP agent

alive

body

布尔值

指示代理是否存活并正在运行。

binary

body

字符串

用于启动代理的可执行命令,例如 neutron-openvswitch-agentneutron-dhcp-agent

configurations

body

对象

包含特定配置键/值对的对象;其语义由二进制名称和类型确定。

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

description

body

字符串

A human-readable description for the resource.

heartbeat_timestamp

body

字符串

收到最后心跳的时间。

host

body

字符串

代理运行所在系统的名称。

id

body

字符串

资源的ID。

started_at

body

字符串

代理启动的时间。

topic

body

字符串

代理正在监听的 AMQP 主题的名称,例如 dhcp_agent。当代理不使用 AMQP 主题时,使用特殊值 N/A

响应示例

{
    "agents": [
        {
            "binary": "neutron-l3-agent",
            "description": null,
            "availability_zone": "nova",
            "heartbeat_timestamp": "2018-04-08 07:32:42",
            "admin_state_up": true,
            "alive": true,
            "topic": "l3_agent",
            "host": "mkm-instance01",
            "ha_state": null,
            "agent_type": "L3 agent",
            "resource_versions": {},
            "created_at": "2018-03-11 08:10:58",
            "started_at": "2018-03-11 08:10:58",
            "id": "b64f5c61-2210-41a6-869f-b51d7914511e",
            "configurations": {
                "agent_mode": "legacy",
                "gateway_external_network_id": "",
                "handle_internal_only_routers": true,
                "routers": 3,
                "interfaces": 1,
                "floating_ips": 0,
                "interface_driver": "openvswitch",
                "log_agent_heartbeats": false,
                "ex_gw_ports": 1
            }
        }
    ]
}

DHCP 代理调度程序

DHCP 代理调度程序扩展(dhcp_agent_scheduler)使管理员能够将 Neutron 网络的 DHCP 服务器分配给指定的 Neutron DHCP 代理,并检索 Neutron 网络与 DHCP 代理之间的映射。

GET
/v2.0/agents/{agent_id}/dhcp-networks

列出 DHCP 代理托管的网络

列出 DHCP 代理所托管的网络。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

错误响应代码:401, 403

请求

名称

入参

类型

描述

agent_id

路径

字符串

代理的 ID。

响应参数

名称

入参

类型

描述

network

body

对象

A network object.

admin_state_up

body

布尔值

The administrative state of the network, which is up (true) or down (false).

availability_zone_hints

body

数组

The availability zone candidate for the network.

availability_zones

body

数组

The availability zone for the network.

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

dns_domain

body

字符串

A valid DNS domain.

id

body

字符串

The ID of the network.

ipv4_address_scope

body

字符串

The ID of the IPv4 address scope that the network is associated with.

ipv6_address_scope

body

字符串

The ID of the IPv6 address scope that the network is associated with.

l2_adjacency

body

布尔值

Indicates whether L2 connectivity is available throughout the network.

mtu

body

整数

The maximum transmission unit (MTU) value to address fragmentation. Minimum value is 68 for IPv4, and 1280 for IPv6.

name

body

字符串

Human-readable name of the network.

port_security_enabled

body

布尔值

The port security status of the network. Valid values are enabled (true) and disabled (false). This value is used as the default value of port_security_enabled field of a newly created port.

project_id

body

字符串

项目的 ID。

provider:network_type

body

字符串

The type of physical network that this network is mapped to. For example, flat, vlan, vxlan, or gre. Valid values depend on a networking back-end.

provider:physical_network

body

字符串

The physical network where this network/segment is implemented.

provider:segmentation_id

body

整数

The ID of the isolated segment on the physical network. The network_type attribute defines the segmentation model. For example, if the network_type value is vlan, this ID is a vlan identifier. If the network_type value is gre, this ID is a gre key. Note that only the segmentation-id of VLAN type networks can be changed!

qos_policy_id

body

字符串

QoS 策略的 ID。

revision_number

body

整数

The revision number of the resource.

router:external

body

布尔值

Defines whether the network may be used for creation of floating IPs. Only networks with this flag may be an external gateway for routers. The network must have an external routing facility that is not managed by the networking service. If the network is updated from external to internal the unused floating IPs of this network are automatically deleted when extension floatingip-autodelete-internal is present.

body

数组

A list of provider segment objects.

shared

body

布尔值

Indicates whether this network is shared across all tenants. By default, only administrative users can change this value.

status

body

字符串

The network status. Values are ACTIVE, DOWN, BUILD or ERROR.

子网

body

数组

The associated subnets.

tenant_id

body

字符串

项目的 ID。

updated_at

body

字符串

Time at which the resource has been updated (in UTC ISO8601 format).

vlan_transparent

body

布尔值

Indicates the VLAN transparency mode of the network, which is VLAN transparent (true) or not VLAN transparent (false).

description

body

字符串

A human-readable description for the resource.

is_default

body

布尔值

The network is default pool or not.

响应示例

{
    "networks": [
        {
            "admin_state_up": true,
            "availability_zone_hints": [],
            "availability_zones": [
                "nova"
            ],
            "created_at": "2016-03-08T20:19:41",
            "dns_domain": "my-domain.org.",
            "id": "d32019d3-bc6e-4319-9c1d-6722fc136a22",
            "ipv4_address_scope": null,
            "ipv6_address_scope": null,
            "l2_adjacency": false,
            "mtu": 1500,
            "name": "net1",
            "port_security_enabled": true,
            "project_id": "4fd44f30292945e481c7b8a0c8908869",
            "qos_policy_id": "6a8454ade84346f59e8d40665f878b2e",
            "revision_number": 1,
            "router:external": false,
            "shared": false,
            "status": "ACTIVE",
            "subnets": [
                "54d6f61d-db07-451c-9ab3-b9609b6b6f0b"
            ],
            "tenant_id": "4fd44f30292945e481c7b8a0c8908869",
            "updated_at": "2016-03-08T20:19:41",
            "vlan_transparent": true,
            "qinq": false,
            "description": "",
            "is_default": false
        },
        {
            "admin_state_up": true,
            "availability_zone_hints": [],
            "availability_zones": [
                "nova"
            ],
            "created_at": "2016-03-08T20:19:41",
            "dns_domain": "my-domain.org.",
            "id": "db193ab3-96e3-4cb3-8fc5-05f4296d0324",
            "ipv4_address_scope": null,
            "ipv6_address_scope": null,
            "l2_adjacency": false,
            "mtu": 1500,
            "name": "net2",
            "port_security_enabled": true,
            "project_id": "26a7980765d0414dbc1fc1f88cdb7e6e",
            "qos_policy_id": "bfdb6c39f71e4d44b1dfbda245c50819",
            "revision_number": 3,
            "router:external": false,
            "shared": false,
            "status": "ACTIVE",
            "subnets": [
                "08eae331-0402-425a-923c-34f7cfe39c1b"
            ],
            "tenant_id": "26a7980765d0414dbc1fc1f88cdb7e6e",
            "updated_at": "2016-03-08T20:19:41",
            "vlan_transparent": false,
            "qinq": false,
            "description": "",
            "is_default": false
        }
    ]
}
POST
/v2.0/agents/{agent_id}/dhcp-networks

调度网络到 DHCP 代理

将网络添加到 DHCP 代理。

正常响应代码:201

错误响应代码:400, 403, 409, 404

请求

名称

入参

类型

描述

agent_id

路径

字符串

代理的 ID。

network_id

body

字符串

The ID of the network.

请求示例

{"network_id": "1ae075ca-708b-4e66-b4a7-b7698632f05f"}

响应参数

null

响应示例

成功 POST 请求的响应没有正文内容。

DELETE
/v2.0/agents/{agent_id}/dhcp-networks/{network_id}

从 DHCP 代理中移除网络

从 DHCP 代理中移除网络。

正常响应代码:204

错误响应代码:401、403、404、409

请求

名称

入参

类型

描述

agent_id

路径

字符串

代理的 ID。

network_id

body

字符串

连接网络的 ID。

响应示例

There is no body content for the response of a successful DELETE request.

GET
/v2.0/networks/{network_id}/dhcp-agents

列出托管网络的 DHCP 代理

列出托管网络的 DHCP 代理。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

错误响应代码:401, 403

请求

名称

入参

类型

描述

network_id

body

字符串

连接网络的 ID。

响应参数

名称

入参

类型

描述

admin_state_up

body

布尔值

资源的管理状态,为开启(true)或关闭(false)。

agents

body

数组

一个 agent 对象列表。

agent_type

body

字符串

代理的类型,例如 Open vSwitch agentDHCP agent

alive

body

布尔值

指示代理是否存活并正在运行。

binary

body

字符串

用于启动代理的可执行命令,例如 neutron-openvswitch-agentneutron-dhcp-agent

configurations

body

对象

包含特定配置键/值对的对象;其语义由二进制名称和类型确定。

created_at

body

字符串

Time at which the resource has been created (in UTC ISO8601 format).

description

body

字符串

A human-readable description for the resource.

heartbeat_timestamp

body

字符串

收到最后心跳的时间。

host

body

字符串

代理运行所在系统的名称。

id

body

字符串

资源的ID。

started_at

body

字符串

代理启动的时间。

topic

body

字符串

代理正在监听的 AMQP 主题的名称,例如 dhcp_agent。当代理不使用 AMQP 主题时,使用特殊值 N/A

响应示例

{
    "agents": [
        {
            "binary": "neutron-dhcp-agent",
            "description": null,
            "availability_zone": "nova",
            "heartbeat_timestamp": "2018-04-08 07:32:42",
            "admin_state_up": true,
            "alive": true,
            "topic": "dhcp_agent",
            "host": "mkm-instance01",
            "ha_state": null,
            "agent_type": "DHCP agent",
            "resource_versions": {},
            "created_at": "2018-03-11 08:10:58",
            "started_at": "2018-03-11 08:10:58",
            "id": "b64f5c61-2210-41a6-869f-b51d7914511e",
            "configurations": {
              "subnets": 1,
              "dhcp_lease_duration": 86400,
              "dhcp_driver": "neutron.agent.linux.dhcp.Dnsmasq",
              "ports": 2,
              "log_agent_heartbeats": false,
              "networks": 1
            }
        }
    ]
}

自动分配拓扑

自动分配拓扑

显示指定项目的自动分配拓扑的详细信息并删除它。此 API 仅在 auto-allocated-topology 扩展启用时可用。

GET
/v2.0/auto-allocated-topology/{project_id}

显示自动分配拓扑详细信息

显示自动分配拓扑的详细信息。

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

Error response codes: 401, 404

请求

名称

入参

类型

描述

project_id

路径

字符串

项目的 ID。

fields (可选)

查询

字符串

The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

响应参数

名称

入参

类型

描述

id

body

字符串

自动分配拓扑的网络 ID。

tenant_id

body

字符串

拥有自动分配拓扑的项目 ID。

响应示例

{
    "id": "31483d41-5c2b-481c-beef-ab501bd2e0da",
    "tenant_id": "7623217f-dd15-44ec-994a-581a6e41c113"
}
DELETE
/v2.0/auto-allocated-topology/{project_id}

删除自动分配拓扑

删除自动分配拓扑。

正常响应代码:204

错误响应代码:401、403、404

请求

名称

入参

类型

描述

project_id

路径

字符串

项目的 ID。

响应

There is no body content for the response of a successful DELETE request.

Tap 作为服务

Tap 即服务

TaaS 插件提供了一种机制,可以将特定流量(例如,用特定 VLAN 标记的流量)从源 VM 镜像到任何流量分析器 VM。当数据包被转发时,源和目标 IP/端口信息的原始值将不会被更改,系统管理员将能够运行,例如,在目标 VM 上执行 tcpdump 来跟踪这些数据包。

TaaS 插件主要由 tap servicetap flow 组成。

VLAN 过滤器

Neutron Tap 即服务的 VLAN filtering 允许在镜像 SRIOV 端口的情况下,按 VLAN ID 过滤来自 tap-flows 的流量。

Tap 服务

TapService 代表镜像流量被传递到的端口。

GET
/v2.0/taas/tap_services

列出 Tap 服务

列出属于给定项目的 Tap 服务。

列表可能为空。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

Error response codes: 401

请求参数

名称

入参

类型

描述

project (Optional)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

project-domain (Optional)

查询

字符串

项目所属的域(名称或 ID)。如果项目名称之间存在冲突,可以使用此选项。

响应参数

名称

入参

类型

描述

id

body

字符串

Tap 服务的 ID。

tenant_id

body

字符串

项目的 ID。

port

body

字符串

Tap 服务连接到的端口。

status

body

字符串

Tap 服务状态的人性化描述。

响应示例

{
    "tap_services": [
        {
            "id": "257bcb47-5134-4ee9-b5cc-762d99ddae0b",
            "tenant_id": "dad19b09dba44e589c022000d580e9d5",
            "name": "tap_service-1",
            "port_id": "a9855775-48ae-4609-8742-aa9d85db2e01",
            "status": "ACTIVE"
        }
    ]
}
POST
/v2.0/taas/tap_services

创建 Tap 服务

通过传递以下 JSON 编码数据创建 Tap 服务。namemonitoring port 是必需参数,description 是可选参数。

正常响应代码:201

错误响应代码:401、403、404、409

请求参数

名称

入参

类型

描述

project (Optional)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

project-domain (Optional)

查询

字符串

项目所属的域(名称或 ID)。如果项目名称之间存在冲突,可以使用此选项。

tenant_id (可选)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

name

查询

字符串

Tap 服务的名称。

port (Optional)

查询

字符串

Tap 服务连接到的端口。

description (可选)

查询

字符串

Filter the list result by the human-readable description of the resource.

请求示例

{
    "tap_service": {
        "name": "ts1",
        "port_id": "a9855775-48ae-4609-8742-aa9d85db2e01"
    }
}

响应参数

名称

入参

类型

描述

id

body

字符串

Tap 服务的 ID。

tenant_id

body

字符串

项目的 ID。

name

body

字符串

Tap Flow 的名称。

port

body

字符串

Tap 服务连接到的端口。

status

body

字符串

Tap 服务状态的人性化描述。

description

body

字符串

此 Tap 服务的描述。

project_id

body

字符串

项目的 ID。

响应示例

{
    "tap_service": {
        "id": "2fec9339-f565-46d0-947b-1d98c2a406aa",
        "tenant_id": "dad19b09dba44e589c022000d580e9d5",
        "name": "tap_service-1",
        "description": "tap service",
        "port_id": "a9855775-48ae-4609-8742-aa9d85db2e01",
        "status": "DOWN",
        "project_id": "dad19b09dba44e589c022000d580e9d5"
    }
}
PUT
/v2.0/taas/tap_services/{tap_service_id/name}

更新 Tap 服务

通过传递 Tap 服务 nameid 作为 JSON 编码数据来更新 Tap 服务。只能更新名称或描述,或两者都更新。

正常响应代码:200

错误响应代码:400、401、404、412

请求参数

名称

入参

类型

描述

name

查询

字符串

Tap 服务的名称。

description (可选)

查询

字符串

Filter the list result by the human-readable description of the resource.

请求示例

{
    "tap_service": {
        "description": "test tap service"
    }
}

响应参数

名称

入参

类型

描述

id

body

字符串

Tap 服务的 ID。

name

body

字符串

Tap Flow 的名称。

port

body

字符串

Tap 服务连接到的端口。

status

body

字符串

Tap 服务状态的人性化描述。

description

body

字符串

此 Tap 服务的描述。

project_id

body

字符串

项目的 ID。

响应示例

{
    "tap_service": {
        "id": "2fec9339-f565-46d0-947b-1d98c2a406aa",
        "tenant_id": "dad19b09dba44e589c022000d580e9d5",
        "name": "ts1",
        "description": "test tas",
        "port_id": "a9855775-48ae-4609-8742-aa9d85db2e01",
        "status": "ACTIVE",
        "project_id": "dad19b09dba44e589c022000d580e9d5"
    }
}
DELETE
/v2.0/taas/tap_services/{tap_service_id/name}

删除 Tap 服务

通过传递 Tap 服务 nameid 作为 JSON 编码数据来删除 Tap 服务。

正常响应代码:204

错误响应代码:400、401、404、412

请求参数

名称

入参

类型

描述

name

查询

字符串

Tap 服务的名称。

id (可选)

查询

字符串

Tap 服务的 ID。

响应参数

There is no body content for the response of a successful DELETE request.

GET
/v2.0/taas/tap_services/{tap_service_id/name}

显示 Tap 服务

通过传递 Tap 服务 nameid 作为 JSON 编码数据来显示 Tap 服务的详细信息。

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

Error response codes: 401, 404

请求参数

名称

入参

类型

描述

project (Optional)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

project-domain (Optional)

查询

字符串

项目所属的域(名称或 ID)。如果项目名称之间存在冲突,可以使用此选项。

name

查询

字符串

Tap 服务的名称。

响应参数

名称

入参

类型

描述

id

body

字符串

Tap 服务的 ID。

name

body

字符串

Tap Flow 的名称。

port

body

字符串

Tap 服务连接到的端口。

status

body

字符串

Tap 服务状态的人性化描述。

description

body

字符串

此 Tap 服务的描述。

project_id

body

字符串

项目的 ID。

tenant_id

body

字符串

项目的 ID。

响应示例

{
    "tap_service": {
        "id": "1b059120-078b-4f25-bb16-e14d69706a9a",
        "tenant_id": "dad19b09dba44e589c022000d580e9d5",
        "name": "ts1",
        "description": "",
        "port_id": "a9855775-48ae-4609-8742-aa9d85db2e01",
        "status": "ACTIVE",
        "project_id": "dad19b09dba44e589c022000d580e9d5"
    }
}

Tap Flow

TapFlow 代表需要镜像流量的端口。它可以是连接到另一云网络上的 VM 的端口。

GET
/v2.0/taas/tap_flows

列出 Tap Flow

列出属于给定租户的 Tap Flow。

列表可能为空。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

Error response codes: 401

请求参数

名称

入参

类型

描述

project (Optional)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

project-domain (Optional)

查询

字符串

项目所属的域(名称或 ID)。如果项目名称之间存在冲突,可以使用此选项。

响应参数

名称

入参

类型

描述

id

body

字符串

Tap Flow 的 ID。

port

body

字符串

Tap Flow 连接到的源端口。

status

body

字符串

Tap 服务状态的人性化描述。

响应示例

{
    "tap_flows": [
        {
            "ID": "4082b3f6-387f-4d1e-b67e-f47f0dcd2926",
            "Tenant": "dad19b09dba44e589c022000d580e9d5",
            "Name": "tf1",
            "Status": "ACTIVE",
            "source_port": "ee2911c3-08e7-44cb-81aa-fbee2cf43168",
            "tap_service_id": "1b059120-078b-4f25-bb16-e14d69706a9a",
            "Direction": "BOTH"
        }
    ]
}
POST
/v2.0/taas/tap_flows

创建 Tap Flow

通过传递以下 JSON 编码数据创建 Tap Flow。namesource portdirectionIN/OUT/BOTH)和 tap_service 是必需参数,description 是可选参数。

正常响应代码:201

错误响应代码:401、403、404、409

请求参数

名称

入参

类型

描述

project (Optional)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

project-domain (Optional)

查询

字符串

项目所属的域(名称或 ID)。如果项目名称之间存在冲突,可以使用此选项。

tenant_id (可选)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

name

查询

字符串

Tap Flow 的名称。

port (Optional)

查询

字符串

Tap Flow 连接到的源端口。

tap_service (Optional)

查询

字符串

Tap Flow 所属的 Tap 服务。

vlan_filter (Optional)

查询

字符串

要镜像的 VLAN ID,形式为范围字符串。

direction (可选)

查询

字符串

Tap 流动方向。可能选项为:IN、OUT、BOTH

description (可选)

查询

字符串

Filter the list result by the human-readable description of the resource.

请求示例

{
    "tap_flow": {
        "name": "tf1",
        "source_port": "ee2911c3-08e7-44cb-81aa-fbee2cf43168",
        "tap_service_id": "1b059120-078b-4f25-bb16-e14d69706a9a",
        "direction": "BOTH"
    }
}

响应参数

名称

入参

类型

描述

id

body

字符串

Tap Flow 的 ID。

name

body

字符串

Tap 流的名称。

port

body

字符串

Tap Flow 连接到的源端口。

status

body

字符串

Tap 流状态的可读描述。

tap_service

body

字符串

Tap Flow 所属的 Tap 服务。

direction

body

字符串

此 Tap 流的描述。

project_id

body

字符串

项目的 ID。

tenant_id

body

字符串

项目的 ID。

响应示例

{
    "tap_flow": {
        "id": "137086d8-a77b-4bbc-825f-9c2f7b9bfa7b",
        "tenant_id": "dad19b09dba44e589c022000d580e9d5",
        "tap_service_id": "1b059120-078b-4f25-bb16-e14d69706a9a",
        "name": "tf1",
        "description": "",
        "source_port": "ee2911c3-08e7-44cb-81aa-fbee2cf43168",
        "direction": "BOTH",
        "status": "DOWN",
        "vlan_filter": null,
        "project_id": "dad19b09dba44e589c022000d580e9d5"
    }
}
PUT
/v2.0/taas/tap_flows/{taf_service_id/name}

更新 Tap 流

通过 JSON 编码数据传递 Tap 流的 nameid 来更新 Tap 流。只能更新名称或描述,或两者都更新。

正常响应代码:200

错误响应代码:400、401、404、412

请求参数

名称

入参

类型

描述

name

查询

字符串

Tap Flow 的名称。

description (可选)

查询

字符串

Filter the list result by the human-readable description of the resource.

请求示例

{
    "tap_flow": {
        "description": "test tap flow"
    }
}

响应参数

名称

入参

类型

描述

id

body

字符串

Tap Flow 的 ID。

name

body

字符串

Tap 流的名称。

port

body

字符串

Tap Flow 连接到的源端口。

status

body

字符串

Tap 服务状态的人性化描述。

tap_service

body

字符串

Tap Flow 所属的 Tap 服务。

direction

body

字符串

此 Tap 流的描述。

project_id

body

字符串

项目的 ID。

tenant_id

body

字符串

项目的 ID。

响应示例

{
    "tap_flow": {
        "id": "137086d8-a77b-4bbc-825f-9c2f7b9bfa7b",
        "tenant_id": "dad19b09dba44e589c022000d580e9d5",
        "tap_service_id": "1b059120-078b-4f25-bb16-e14d69706a9a",
        "name": "tf1",
        "description": "test tap flow",
        "source_port": "ee2911c3-08e7-44cb-81aa-fbee2cf43168",
        "direction": "BOTH",
        "status": "DOWN",
        "vlan_filter": null,
        "project_id": "dad19b09dba44e589c022000d580e9d5"
    }
}
DELETE
/v2.0/taas/tap_flows/{tap_service_id/name}

删除 Tap 流

通过 JSON 编码数据传递 Tap 流的 nameid 来删除 Tap 流。

正常响应代码:204

错误响应代码:400、401、404、412

请求参数

名称

入参

类型

描述

id (可选)

查询

字符串

Tap 流的 ID。

name

查询

字符串

Tap Flow 的名称。

响应参数

成功执行 DELETE 请求后,将显示 Tap flow {tap_flow_id} deleted. 消息。

GET
/v2.0/taas/tap_flows/{tap_flows_id/name}

显示 Tap 流

通过 JSON 编码数据传递 Tap 流的 nameid 来显示 Tap 流的详细信息。

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

Error response codes: 401, 404

请求参数

名称

入参

类型

描述

project (Optional)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

project-domain (Optional)

查询

字符串

项目所属的域(名称或 ID)。如果项目名称之间存在冲突,可以使用此选项。

tenant_id (可选)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

id (可选)

查询

字符串

Tap 流的 ID。

name

查询

字符串

Tap Flow 的名称。

响应参数

名称

入参

类型

描述

id

body

字符串

Tap Flow 的 ID。

name

body

字符串

Tap 流的名称。

port

body

字符串

Tap Flow 连接到的源端口。

status

body

字符串

Tap 流状态的可读描述。

tap_service

body

字符串

Tap Flow 所属的 Tap 服务。

direction

body

字符串

此 Tap 流的描述。

project_id

body

字符串

项目的 ID。

tenant_id

body

字符串

项目的 ID。

响应示例

{
    "tap_flow": {
        "id": "137086d8-a77b-4bbc-825f-9c2f7b9bfa7b",
        "tenant_id": "dad19b09dba44e589c022000d580e9d5",
        "tap_service_id": "1b059120-078b-4f25-bb16-e14d69706a9a",
        "name": "tf1",
        "description": "test tap flow",
        "source_port": "ee2911c3-08e7-44cb-81aa-fbee2cf43168",
        "direction": "BOTH",
        "status": "DOWN",
        "vlan_filter": null,
        "project_id": "dad19b09dba44e589c022000d580e9d5"
    }
}

Tap 镜像

Tap 镜像提供了一种将来自 Neutron 端口的流量镜像到 GRE 或 ERSPAN v1 隧道中的外部 IP 的方法。

GET
/v2.0/taas/tap_mirrors

列出 Tap 镜像

列出属于给定项目的 Tap 镜像。

列表可能为空。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

Error response codes: 401

请求参数

名称

入参

类型

描述

project (Optional)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

project-domain (Optional)

查询

字符串

项目所属的域(名称或 ID)。如果项目名称之间存在冲突,可以使用此选项。

响应参数

名称

入参

类型

描述

id

body

字符串

Tap 镜像的 ID。

name

body

字符串

Tap 镜像的名称。

description

body

字符串

A human-readable description for the resource.

tenant_id

body

字符串

项目的 ID。

port_id

body

字符串

Tap 镜像的端口 ID,这将是镜像流量的源,并且这些流量将被隧道传输到 GRE 或 ERSPAN v1 隧道中。隧道本身并非从此端口开始!

mirror_type

body

字符串

镜像的类型,可以是 greerspanv1

remote_ip

body

字符串

Tap 镜像的远程 IP,这将是 GRE 或 ERSPAN v1 隧道的远程端。

directions

body

对象

一个包含 directiontunnel_id 的字典。Direction 可以是 INOUT

响应示例

{
    "tap_mirrors": [
        {
            "description": "My fancy tap mirror with direction IN and id 99",
            "directions": {
                "IN": 99
            },
            "id": "207e4809-5358-4592-891b-3312bed32c47",
            "mirror_type": "gre",
            "name": "my_tap_mirror",
            "port_id": "81bc638f-e991-4306-ae5e-df8492890b39",
            "project_id": "57425788f1a148059926c124a6ffabe6",
            "remote_ip": "100.109.0.142",
            "tenant_id": "57425788f1a148059926c124a6ffabe6"
        }
    ]
}
POST
/v2.0/taas/tap_mirrors

创建 Tap 镜像

创建 Tap 镜像。

错误响应代码:401、403、404、409

请求参数

名称

入参

类型

描述

project (Optional)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

project-domain (Optional)

查询

字符串

项目所属的域(名称或 ID)。如果项目名称之间存在冲突,可以使用此选项。

tenant_id

body

字符串

项目的 ID。

name

body

字符串

Tap 镜像的名称。

port_id

body

字符串

Tap 镜像的端口 ID,这将是镜像流量的源,并且这些流量将被隧道传输到 GRE 或 ERSPAN v1 隧道中。隧道本身并非从此端口开始!

mirror_type

body

字符串

镜像的类型,可以是 greerspanv1

remote_ip

body

字符串

Tap 镜像的远程 IP,这将是 GRE 或 ERSPAN v1 隧道的远程端。

directions

body

对象

一个包含 directiontunnel_id 的字典。Direction 可以是 INOUT

description

body

字符串

A human-readable description for the resource.

请求示例

{
    "tap_mirror": {
        "name": "mirror2",
        "description": "Two direction mirror",
        "port_id":"c63e4f48-da76-466c-a6f1-f4e4a4902c6a",
        "directions": {"IN": 99, "OUT": 100},
        "remote_ip":"100.109.0.142",
        "mirror_type":"erspanv1"
    }
}

响应参数

名称

入参

类型

描述

id

body

字符串

Tap 镜像的 ID。

name

body

字符串

Tap 镜像的名称。

description

body

字符串

A human-readable description for the resource.

tenant_id

body

字符串

项目的 ID。

port_id

body

字符串

Tap 镜像的端口 ID,这将是镜像流量的源,并且这些流量将被隧道传输到 GRE 或 ERSPAN v1 隧道中。隧道本身并非从此端口开始!

mirror_type

body

字符串

镜像的类型,可以是 greerspanv1

remote_ip

body

字符串

Tap 镜像的远程 IP,这将是 GRE 或 ERSPAN v1 隧道的远程端。

directions

body

对象

一个包含 directiontunnel_id 的字典。Direction 可以是 INOUT

响应示例

{
    "tap_mirror": {
        "id": "6ffe758f-d426-4718-9e33-71c542634d2b",
        "project_id": "57425788f1a148059926c124a6ffabe6",
        "name": "mirror2",
        "description": "Two direction mirror",
        "port_id": "c63e4f48-da76-466c-a6f1-f4e4a4902c6a",
        "directions": {"IN": 99, "OUT": 100},
        "remote_ip": "100.109.0.142",
        "mirror_type": "erspanv1",
        "tenant_id": "57425788f1a148059926c124a6ffabe6"
    }
}
PUT
/v2.0/taas/tap_mirrors/{tap_mirror_id}

更新 Tap 镜像

更新 Tap 镜像。

正常响应代码:200

错误响应代码:400、401、404、412

请求参数

名称

入参

类型

描述

tap_mirror_id

查询

字符串

Tap 镜像的 ID。

description

body

字符串

A human-readable description for the resource.

name

body

字符串

Tap 镜像的名称。

请求示例

{
    "tap_mirror": {
        "name": "my_tap_mirror",
        "description":"My fancy tap mirror with direction IN and id 99"
    }
}

响应参数

名称

入参

类型

描述

id

body

字符串

Tap 镜像的 ID。

name

body

字符串

Tap 镜像的名称。

description

body

字符串

A human-readable description for the resource.

tenant_id

body

字符串

项目的 ID。

port_id

body

字符串

Tap 镜像的端口 ID,这将是镜像流量的源,并且这些流量将被隧道传输到 GRE 或 ERSPAN v1 隧道中。隧道本身并非从此端口开始!

mirror_type

body

字符串

镜像的类型,可以是 greerspanv1

remote_ip

body

字符串

Tap 镜像的远程 IP,这将是 GRE 或 ERSPAN v1 隧道的远程端。

directions

body

对象

一个包含 directiontunnel_id 的字典。Direction 可以是 INOUT

响应示例

{
    "tap_mirror": {
        "id": "207e4809-5358-4592-891b-3312bed32c47",
        "project_id": "57425788f1a148059926c124a6ffabe6",
        "name": "my_tap_mirror",
        "description": "My fancy tap mirror with direction IN and id 99",
        "port_id": "81bc638f-e991-4306-ae5e-df8492890b39",
        "directions": {"IN": 99},
        "remote_ip": "100.109.0.142",
        "mirror_type": "gre",
        "tenant_id": "57425788f1a148059926c124a6ffabe6"
    }
}
DELETE
/v2.0/taas/tap_mirrors/{tap_mirror_id}

删除 Tap 镜像

删除 Tap 镜像。

正常响应代码:204

错误响应代码:400、401、404、412

请求参数

名称

入参

类型

描述

tap_mirror_id

查询

字符串

Tap 镜像的 ID。

响应参数

There is no body content for the response of a successful DELETE request.

GET
/v2.0/taas/tap_mirrors/{tap_mirror_id}

显示 Tap 镜像

显示 Tap 镜像的详细信息。

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

Error response codes: 401, 404

请求参数

名称

入参

类型

描述

project (Optional)

查询

字符串

Filter the list result by the ID of the project that owns the resource.

project-domain (Optional)

查询

字符串

项目所属的域(名称或 ID)。如果项目名称之间存在冲突,可以使用此选项。

tap_mirror_id

查询

字符串

Tap 镜像的 ID。

响应参数

名称

入参

类型

描述

id

body

字符串

Tap 镜像的 ID。

name

body

字符串

Tap 镜像的名称。

description

body

字符串

A human-readable description for the resource.

tenant_id

body

字符串

项目的 ID。

port_id

body

字符串

Tap 镜像的端口 ID,这将是镜像流量的源,并且这些流量将被隧道传输到 GRE 或 ERSPAN v1 隧道中。隧道本身并非从此端口开始!

mirror_type

body

字符串

镜像的类型,可以是 greerspanv1

remote_ip

body

字符串

Tap 镜像的远程 IP,这将是 GRE 或 ERSPAN v1 隧道的远程端。

directions

body

对象

一个包含 directiontunnel_id 的字典。Direction 可以是 INOUT

响应示例

{
   "tap_mirror" : {
      "description" : "My fancy tap mirror with direction IN and id 99",
      "directions" : {
         "IN" : 99
      },
      "id" : "0f077b67-e85b-4138-bc64-5d705b0a06ef",
      "mirror_type" : "gre",
      "name" : "my_tap_mirror",
      "port_id" : "81bc638f-e991-4306-ae5e-df8492890b39",
      "project_id" : "57425788f1a148059926c124a6ffabe6",
      "remote_ip" : "100.109.0.142",
      "tenant_id" : "57425788f1a148059926c124a6ffabe6"
   }
}

网络 SFC API

端口链 (port-chains)

列出、显示信息、创建、更新和删除端口链。

GET
/v1.0/sfc/port_chains

列出端口链

列出端口链。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

错误响应代码:未授权(401)、禁止(403)

响应

名称

入参

类型

描述

id

body

字符串

端口链的 UUID。

name

body

字符串

端口链的名称。

description

body

字符串

A human-readable description for the resource.

port_pair_groups

body

数组

端口对组 UUID 列表。

flow_classifiers (可选)

body

数组

流分类器 UUID 列表。

chain_parameters (可选)

body

对象

一个链参数字典,形式为 correlation: [‘mpls’, ‘nsh’],(默认为 mpls),weight: 整数 (默认为 1)。

响应示例

示例:列出端口链:JSON 响应

{
    "port_chains": [
        {
            "name": "PC1",
            "id": "1278dcd4-459f-62ed-754b-87fc5e4a6751",
            "tenant_id": "d382007aa9904763a801f68ecf065cf5",
            "description": "Port chain with Firewall and IPS SFs",
            "flow_classifiers": [
                 "4a334cd4-fe9c-4fae-af4b-321c5e2eb051",
                 "105a4b0a-73d6-11e5-b392-2c27d72acb4c"
            ],
            "port_pair_groups": [
                 "4512d643-24fc-4fae-af4b-321c5e2eb3d1",
                 "4a634d49-76dc-4fae-af4b-321c5e23d651"
            ]
        }
    ]
}
POST
/v1.0/sfc/port_chains

创建端口链

创建端口链。

正常响应代码:200

错误响应代码:badRequest(400),unauthorized(401),forbidden(403)

请求

名称

入参

类型

描述

name

body

字符串

端口链的名称。

description

body

字符串

A human-readable description for the resource.

port_pair_groups

body

数组

端口对组 UUID 列表。

flow_classifiers (可选)

body

数组

流分类器 UUID 列表。

chain_parameters (可选)

body

对象

一个链参数字典,形式为 correlation: [‘mpls’, ‘nsh’],(默认为 mpls),weight: 整数 (默认为 1)。

请求示例

示例:创建端口链:JSON 请求

{
    "port_chain": {
        "name": "PC1",
        "tenant_id": "d382007aa9904763a801f68ecf065cf5",
        "description": "Port chain with Firewall and IPS SFs",
        "flow_classifiers": [
             "4a334cd4-fe9c-4fae-af4b-321c5e2eb051",
             "105a4b0a-73d6-11e5-b392-2c27d72acb4c"
        ],
        "port_pair_groups": [
             "4512d643-24fc-4fae-af4b-321c5e2eb3d1",
             "4a634d49-76dc-4fae-af4b-321c5e23d651"
        ]
    }
}

响应

名称

入参

类型

描述

id

body

字符串

端口链的 UUID。

name

body

字符串

端口链的名称。

description

body

字符串

A human-readable description for the resource.

port_pair_groups

body

数组

端口对组 UUID 列表。

flow_classifiers (可选)

body

数组

流分类器 UUID 列表。

chain_parameters (可选)

body

对象

一个链参数字典,形式为 correlation: [‘mpls’, ‘nsh’],(默认为 mpls),weight: 整数 (默认为 1)。

响应示例

示例:创建端口链:JSON 响应

{
    "port_chain": {
        "name": "PC1",
        "tenant_id": "d382007aa9904763a801f68ecf065cf5",
        "description": "Port chain with Firewall and IPS SFs",
        "flow_classifiers": [
             "4a334cd4-fe9c-4fae-af4b-321c5e2eb051",
             "105a4b0a-73d6-11e5-b392-2c27d72acb4c"
        ],
        "port_pair_groups": [
             "4512d643-24fc-4fae-af4b-321c5e2eb3d1",
             "4a634d49-76dc-4fae-af4b-321c5e23d651"
        ],
        "id": "1278dcd4-459f-62ed-754b-87fc5e4a6751"
    }
}
GET
/v1.0/sfc/port_chains/{port_chain_id}

显示端口链详细信息

显示端口链的详细信息。

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

错误响应代码:badRequest(400), unauthorized(401), forbidden(403), itemNotFound(404)

请求

名称

入参

类型

描述

port_chain_id

路径

字符串

端口链的 UUID。

响应

名称

入参

类型

描述

id

body

字符串

端口链的 UUID。

name

body

字符串

端口链的名称。

description

body

字符串

A human-readable description for the resource.

port_pair_groups

body

数组

端口对组 UUID 列表。

flow_classifiers (可选)

body

数组

流分类器 UUID 列表。

chain_parameters (可选)

body

对象

一个链参数字典,形式为 correlation: [‘mpls’, ‘nsh’],(默认为 mpls),weight: 整数 (默认为 1)。

响应示例

示例:显示端口链:JSON 响应

{
    "port_chain": {
        "id": "1278dcd4-459f-62ed-754b-87fc5e4a6751",
        "name": "PC1",
        "tenant_id": "d382007aa9904763a801f68ecf065cf5",
        "description": "Port chain with Firewall and IPS SFs",
        "flow_classifiers": [
             "4a334cd4-fe9c-4fae-af4b-321c5e2eb051",
             "105a4b0a-73d6-11e5-b392-2c27d72acb4c"
        ],
        "port_pair_groups": [
             "4512d643-24fc-4fae-af4b-321c5e2eb3d1",
             "4a634d49-76dc-4fae-af4b-321c5e23d651"
        ]
    }
}
PUT
/v1.0/sfc/port_chains/{port_chain_id}

更新端口链

更新端口链。当前的端口对组列表将被更新请求中的端口对组列表替换。当前的流分类器列表将被更新请求中的流分类器列表替换。

正常响应代码:200

错误响应代码:badRequest(400), unauthorized(401), forbidden(403), itemNotFound(404)

请求

名称

入参

类型

描述

port_chain_id

路径

字符串

端口链的 UUID。

name

body

字符串

端口链的名称。

description

body

字符串

A human-readable description for the resource.

port_pair_groups

body

数组

端口对组 UUID 列表。

flow_classifiers (可选)

body

数组

流分类器 UUID 列表。

请求示例

示例:更新端口链:JSON 请求

{
    "port_chain": {
        "id": "1278dcd4-459f-62ed-754b-87fc5e4a6751",
        "name": "PC1",
        "tenant_id": "d382007aa9904763a801f68ecf065cf5",
        "description": "Port chain with Firewall and IPS SFs",
        "flow_classifiers": [
             "4a334cd4-fe9c-4fae-af4b-321c5e2eb051",
             "105a4b0a-73d6-11e5-b392-2c27d72acb4c"
        ],
        "port_pair_groups": [
             "4512d643-24fc-4fae-af4b-321c5e2eb3d1",
             "4a634d49-76dc-4fae-af4b-321c5e23d651"
        ]
    }
}

响应

名称

入参

类型

描述

id

body

字符串

端口链的 UUID。

name

body

字符串

端口链的名称。

description

body

字符串

A human-readable description for the resource.

port_pair_groups

body

数组

端口对组 UUID 列表。

flow_classifiers (可选)

body

数组

流分类器 UUID 列表。

响应示例

示例:更新端口链:JSON 响应

{
    "port_chain": {
        "name": "PC1",
        "tenant_id": "d382007aa9904763a801f68ecf065cf5",
        "description": "Port chain with Firewall and IPS SFs",
        "flow_classifiers": [
             "4a334cd4-fe9c-4fae-af4b-321c5e2eb051",
             "105a4b0a-73d6-11e5-b392-2c27d72acb4c"
        ],
        "port_pair_groups": [
             "4512d643-24fc-4fae-af4b-321c5e2eb3d1",
             "4a634d49-76dc-4fae-af4b-321c5e23d651"
        ],
        "id": "1278dcd4-459f-62ed-754b-87fc5e4a6751"
    }
}
DELETE
/v1.0/sfc/port-chains/{port_chain_id}

删除端口链

删除端口链。

正常响应代码:202

错误响应代码:badRequest(400), unauthorized(401), forbidden(403), itemNotFound(404)

请求

名称

入参

类型

描述

port_chain_id

路径

字符串

端口链的 UUID。

响应

成功的 Delete 请求没有响应正文。

端口对组 (port-pair-groups)

列出、显示信息、创建、更新和删除端口对组。

GET
/v1.0/sfc/port_pair_groups

列出端口对组

列出端口对组。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

错误响应代码:未授权(401)、禁止(403)

响应

名称

入参

类型

描述

id

body

字符串

端口对组的 UUID。

name

body

字符串

端口对组的名称。

description

body

字符串

A human-readable description for the resource.

port_pairs

body

数组

端口对 UUID 列表。

port_pair_group_parameters (可选)

body

dict

端口对组参数字典,形式为 lb_fields: 列表 (eth|ip|tcp|udp)_(src|dst)) 的正则表达式,ppg_n_tuple_mapping: ingress_n_tupleegress_n_tuple。ingress 或 egress 元组是一个包含以下键的字典:source_ip_prefix, destination_ip_prefix, source_port_range_min, source_port_range_max, destination_port_range_min, destination_port_range_max。

tap_enabled (可选)

body

布尔值

如果启用了被动 Tap 服务功能支持,则为 True,默认为 False。

响应示例

示例:列出端口对组:JSON 响应

{
    "port_pair_groups": [
        {
             "name": "Firewall_PortPairGroup",
             "tenant_id": "d382007aa9904763a801f68ecf065cf5",
             "description": "Group of Firewall SF instances",
             "port_pairs": [
                 "78dcd363-fc23-aeb6-f44b-56dc5e2fb3ae"
             ],
             "id": "4512d643-24fc-4fae-af4b-321c5e2eb3d1"
        }
    ]
}
POST
/v1.0/sfc/port_pair_groups

创建端口对组

创建端口对组。

正常响应代码:200

错误响应代码:badRequest(400),unauthorized(401),forbidden(403)

请求

名称

入参

类型

描述

name

body

字符串

端口对组的名称。

description

body

字符串

A human-readable description for the resource.

port_pairs

body

数组

端口对 UUID 列表。

port_pair_group_parameters (可选)

body

dict

端口对组参数字典,形式为 lb_fields: 列表 (eth|ip|tcp|udp)_(src|dst)) 的正则表达式,ppg_n_tuple_mapping: ingress_n_tupleegress_n_tuple。ingress 或 egress 元组是一个包含以下键的字典:source_ip_prefix, destination_ip_prefix, source_port_range_min, source_port_range_max, destination_port_range_min, destination_port_range_max。

tap_enabled (可选)

body

布尔值

如果启用了被动 Tap 服务功能支持,则为 True,默认为 False。

示例:创建端口对组:JSON 请求

{
    "port_pair_group": {
         "name": "Firewall_PortPairGroup",
         "tenant_id": "d382007aa9904763a801f68ecf065cf5",
         "description": "Group of Firewall SF instances",
         "port_pairs": [
             "78dcd363-fc23-aeb6-f44b-56dc5e2fb3ae"
         ]
    }
}

响应

名称

入参

类型

描述

id

body

字符串

端口对组的 UUID。

name

body

字符串

端口对组的名称。

description

body

字符串

A human-readable description for the resource.

port_pairs

body

数组

端口对 UUID 列表。

port_pair_group_parameters (可选)

body

dict

端口对组参数字典,形式为 lb_fields: 列表 (eth|ip|tcp|udp)_(src|dst)) 的正则表达式,ppg_n_tuple_mapping: ingress_n_tupleegress_n_tuple。ingress 或 egress 元组是一个包含以下键的字典:source_ip_prefix, destination_ip_prefix, source_port_range_min, source_port_range_max, destination_port_range_min, destination_port_range_max。

tap_enabled (可选)

body

布尔值

如果启用了被动 Tap 服务功能支持,则为 True,默认为 False。

响应示例

示例:创建端口对组:JSON 响应

{
    "port_pair_group": {
         "name": "Firewall_PortPairGroup",
         "tenant_id": "d382007aa9904763a801f68ecf065cf5",
         "description": "Group of Firewall SF instances",
         "port_pairs": [
             "78dcd363-fc23-aeb6-f44b-56dc5e2fb3ae"
         ],
         "id": "4512d643-24fc-4fae-af4b-321c5e2eb3d1"
    }
}
GET
/v1.0/sfc/port_pair_groups/{port_pair_group_id}

显示端口对组详细信息

显示端口对组的详细信息。

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

错误响应代码:badRequest(400), unauthorized(401), forbidden(403), itemNotFound(404)

请求

名称

入参

类型

描述

port_pair_group_id

路径

字符串

端口对组的 UUID。

响应

名称

入参

类型

描述

id

body

字符串

端口对组的 UUID。

name

body

字符串

端口对组的名称。

description

body

字符串

A human-readable description for the resource.

port_pairs

body

数组

端口对 UUID 列表。

port_pair_group_parameters (可选)

body

dict

端口对组参数字典,形式为 lb_fields: 列表 (eth|ip|tcp|udp)_(src|dst)) 的正则表达式,ppg_n_tuple_mapping: ingress_n_tupleegress_n_tuple。ingress 或 egress 元组是一个包含以下键的字典:source_ip_prefix, destination_ip_prefix, source_port_range_min, source_port_range_max, destination_port_range_min, destination_port_range_max。

tap_enabled (可选)

body

布尔值

如果启用了被动 Tap 服务功能支持,则为 True,默认为 False。

响应示例

示例:显示端口对组:JSON 响应

{
    "port_pair_group": {
         "name": "Firewall_PortPairGroup",
         "tenant_id": "d382007aa9904763a801f68ecf065cf5",
         "description": "Group of Firewall SF instances",
         "port_pairs": [
             "78dcd363-fc23-aeb6-f44b-56dc5e2fb3ae"
         ],
         "id": "4512d643-24fc-4fae-af4b-321c5e2eb3d1"
    }
}
PUT
/v1.0/sfc/port_pair_groups/{port_pair_group_id}

更新端口对组

更新端口对组。当前的端口对列表将被更新请求中的端口对列表替换。

正常响应代码:200

错误响应代码:badRequest(400), unauthorized(401), forbidden(403), itemNotFound(404)

请求

名称

入参

类型

描述

port_pair_group_id

路径

字符串

端口对组的 UUID。

name

body

字符串

端口对组的名称。

description

body

字符串

A human-readable description for the resource.

port_pairs

body

数组

端口对 UUID 列表。

port_pair_group_parameters (可选)

body

dict

端口对组参数字典,形式为 lb_fields: 列表 (eth|ip|tcp|udp)_(src|dst)) 的正则表达式,ppg_n_tuple_mapping: ingress_n_tupleegress_n_tuple。ingress 或 egress 元组是一个包含以下键的字典:source_ip_prefix, destination_ip_prefix, source_port_range_min, source_port_range_max, destination_port_range_min, destination_port_range_max。

tap_enabled (可选)

body

布尔值

如果启用了被动 Tap 服务功能支持,则为 True,默认为 False。

请求示例

示例:更新端口对组:JSON 请求

{
    "port_pair_group": {
         "name": "Firewall_PortPairGroup",
         "tenant_id": "d382007aa9904763a801f68ecf065cf5",
         "description": "Group of Firewall SF instances",
         "port_pairs": [
             "78dcd363-fc23-aeb6-f44b-56dc5e2fb3ae"
         ]
    }
}

响应

名称

入参

类型

描述

id

body

字符串

端口对组的 UUID。

name

body

字符串

端口对组的名称。

description

body

字符串

A human-readable description for the resource.

port_pairs

body

数组

端口对 UUID 列表。

port_pair_group_parameters (可选)

body

dict

端口对组参数字典,形式为 lb_fields: 列表 (eth|ip|tcp|udp)_(src|dst)) 的正则表达式,ppg_n_tuple_mapping: ingress_n_tupleegress_n_tuple。ingress 或 egress 元组是一个包含以下键的字典:source_ip_prefix, destination_ip_prefix, source_port_range_min, source_port_range_max, destination_port_range_min, destination_port_range_max。

tap_enabled (可选)

body

布尔值

如果启用了被动 Tap 服务功能支持,则为 True,默认为 False。

响应示例

示例:更新端口对组:JSON 响应

{
    "port_pair_group": {
         "name": "Firewall_PortPairGroup",
         "tenant_id": "d382007aa9904763a801f68ecf065cf5",
         "description": "Group of Firewall SF instances",
         "port_pairs": [
             "78dcd363-fc23-aeb6-f44b-56dc5e2fb3ae"
         ],
         "id": "4512d643-24fc-4fae-af4b-321c5e2eb3d1"
    }
}
DELETE
/v1.0/sfc/port-pair-groups/{port_pair_group_id}

删除端口对组

删除端口对组。

正常响应代码:202

错误响应代码:badRequest(400), unauthorized(401), forbidden(403), itemNotFound(404)

请求

名称

入参

类型

描述

port_pair_group_id

路径

字符串

端口对组的 UUID。

响应

成功的 Delete 请求没有响应正文。

端口对 (port-pairs)

列出、显示信息、创建、更新和删除端口对。

GET
/v1.0/sfc/port_pairs

列出端口对

列出端口对。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

错误响应代码:未授权(401)、禁止(403)

响应

名称

入参

类型

描述

id

body

字符串

端口对的 UUID。

name

body

字符串

端口对的名称。

description

body

字符串

A human-readable description for the resource.

port_pair_groups

body

数组

端口对组 UUID 列表。

flow_classifiers (可选)

body

数组

流分类器 UUID 列表。

响应示例

示例:列出端口对:JSON 响应

{
    "port_pairs": [
        {
             "name": "SF1",
             "tenant_id": "d382007aa9904763a801f68ecf065cf5",
             "description": "Firewall SF instance",
             "ingress": "dace4513-24fc-4fae-af4b-321c5e2eb3d1",
             "egress": "aef3478a-4a56-2a6e-cd3a-9dee4e2ec345",
             "id": "78dcd363-fc23-aeb6-f44b-56dc5e2fb3ae"
         }
    ]
}
POST
/v1.0/sfc/port_pairs

创建端口对

创建端口对。

正常响应代码:200

错误响应代码:badRequest(400),unauthorized(401),forbidden(403)

请求

名称

入参

类型

描述

name

body

字符串

端口对的名称。

description

body

字符串

A human-readable description for the resource.

ingress

body

字符串

入口 Neutron 端口的 UUID。

egress

body

字符串

出口 Neutron 端口的 UUID。

service_function_parameters (可选)

body

对象

服务函数参数字典,形式为 correlation: mplsnsh,以及 weight: 整数。

请求示例

示例:创建端口对:JSON 请求

{
    "port_pair": {
         "name": "SF1",
         "tenant_id": "d382007aa9904763a801f68ecf065cf5",
         "description": "Firewall SF instance",
         "ingress": "dace4513-24fc-4fae-af4b-321c5e2eb3d1",
         "egress": "aef3478a-4a56-2a6e-cd3a-9dee4e2ec345"
    }
}

响应

名称

入参

类型

描述

id

body

字符串

端口对的 UUID。

name

body

字符串

端口对的名称。

description

body

字符串

A human-readable description for the resource.

ingress

body

字符串

入口 Neutron 端口的 UUID。

egress

body

字符串

出口 Neutron 端口的 UUID。

service_function_parameters (可选)

body

对象

服务函数参数字典,形式为 correlation: mplsnsh,以及 weight: 整数。

响应示例

示例:创建端口对:JSON 响应

{
    "port_pair": {
         "name": "SF1",
         "tenant_id": "d382007aa9904763a801f68ecf065cf5",
         "description": "Firewall SF instance",
         "ingress": "dace4513-24fc-4fae-af4b-321c5e2eb3d1",
         "egress": "aef3478a-4a56-2a6e-cd3a-9dee4e2ec345",
         "id": "78dcd363-fc23-aeb6-f44b-56dc5e2fb3ae"
     }
}
GET
/v1.0/sfc/port_pairs/{port_pair_id}

显示端口对详细信息

显示端口对的详细信息。

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

错误响应代码:badRequest(400), unauthorized(401), forbidden(403), itemNotFound(404)

请求

名称

入参

类型

描述

port_pair_id

路径

字符串

端口对的 UUID。

响应

名称

入参

类型

描述

id

body

字符串

端口对的 UUID。

name

body

字符串

端口对的名称。

description

body

字符串

A human-readable description for the resource.

ingress

body

字符串

入口 Neutron 端口的 UUID。

egress

body

字符串

出口 Neutron 端口的 UUID。

service_function_parameters (可选)

body

对象

服务函数参数字典,形式为 correlation: mplsnsh,以及 weight: 整数。

响应示例

示例:显示端口对:JSON 响应

{
    "port_pair": {
         "name": "SF1",
         "tenant_id": "d382007aa9904763a801f68ecf065cf5",
         "description": "Firewall SF instance",
         "ingress": "dace4513-24fc-4fae-af4b-321c5e2eb3d1",
         "egress": "aef3478a-4a56-2a6e-cd3a-9dee4e2ec345",
         "id": "78dcd363-fc23-aeb6-f44b-56dc5e2fb3ae"
     }
}
PUT
/v1.0/sfc/port_pairs/{port_pair_id}

更新端口对

更新端口对。

正常响应代码:200

错误响应代码:badRequest(400), unauthorized(401), forbidden(403), itemNotFound(404)

请求

名称

入参

类型

描述

port_pair_id

路径

字符串

端口对的 UUID。

name

body

字符串

端口对的名称。

description

body

字符串

A human-readable description for the resource.

请求示例

示例:更新端口对:JSON 请求

{
    "port_pair": {
         "name": "SF1",
         "tenant_id": "d382007aa9904763a801f68ecf065cf5",
         "description": "Firewall SF instance"
    }
}

响应

名称

入参

类型

描述

id

body

字符串

端口对的 UUID。

name

body

字符串

端口对的名称。

description

body

字符串

A human-readable description for the resource.

ingress

body

字符串

入口 Neutron 端口的 UUID。

egress

body

字符串

出口 Neutron 端口的 UUID。

service_function_parameters (可选)

body

对象

服务函数参数字典,形式为 correlation: mplsnsh,以及 weight: 整数。

响应示例

示例:更新端口对:JSON 响应

{
    "port_pair": {
         "name": "SF1",
         "tenant_id": "d382007aa9904763a801f68ecf065cf5",
         "description": "Firewall SF instance",
         "ingress": "dace4513-24fc-4fae-af4b-321c5e2eb3d1",
         "egress": "aef3478a-4a56-2a6e-cd3a-9dee4e2ec345",
         "id": "78dcd363-fc23-aeb6-f44b-56dc5e2fb3ae"
     }
}
DELETE
/v1.0/sfc/port-pairs/{port_pair_id}

删除端口对

删除端口对。

正常响应代码:202

错误响应代码:badRequest(400), unauthorized(401), forbidden(403), itemNotFound(404)

请求

名称

入参

类型

描述

port_pair_id

路径

字符串

端口对的 UUID。

响应

成功的 Delete 请求没有响应正文。

流分类器 (flow-classifiers)

列出、显示信息、创建、更新和删除流分类器。

GET
/v1.0/sfc/flow_classifiers

列出流分类器

列出流分类器。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

错误响应代码:未授权(401)、禁止(403)

响应

名称

入参

类型

描述

flow_classifier_id

路径

字符串

流分类器的 ID。

name

body

字符串

流分类器的名称。

description

body

字符串

A human-readable description for the resource.

响应示例

示例:列出流分类器:JSON 响应

{
     "flow_classifiers": [
        {
             "id": "4a334cd4-fe9c-4fae-af4b-321c5e2eb051",
             "name": "FC1",
             "tenant_id": "1814726e2d22407b8ca76db5e567dcf1",
             "description": "Flow rule for classifying TCP traffic",
             "protocol": "TCP",
             "source_port_range_min": 100,
             "source_port_range_max": 4000,
             "destination_port_range_min": 80,
             "destination_port_range_max": 80,
             "source_ip_prefix": null,
             "destination_ip_prefix": "22.12.34.65"
         }
    ]
}
POST
/v1.0/sfc/flow_classifiers

创建流分类器

创建流分类器。

正常响应代码:200

错误响应代码:badRequest(400),unauthorized(401),forbidden(403)

请求

名称

入参

类型

描述

name

body

字符串

流分类器的名称。

description

body

字符串

A human-readable description for the resource.

ethertype

body

字符串

必须是 IPv4 或 IPv6,并且 CIDR 表示的地址必须与入口或出口规则匹配。

协议

body

字符串

IP 协议可以用字符串、整数或 null 来表示。有效的字符串或整数值包括 any0ah51dccp33egp8esp50gre47icmp1icmpv658igmp2ipip4ipv6-encap41ipv6-frag44ipv6-icmp58ipv6-nonxt59ipv6-opts60ipv6-route43ospf89pgm113rsvp46sctp132tcp6udp17udplite136vrrp112。此外,介于 [0-255] 之间的任何整数值也有效。字符串 any (或整数 0) 表示 所有 IP 协议。有关支持的字符串的最新列表,请参阅 neutron_lib.constants 中的常量。

source_port_range_min (可选)

body

整数

最小源协议端口。

source_port_range_max (可选)

body

整数

最大源协议端口。

destination_port_range_min (可选)

body

整数

最小目标协议端口。

destination_port_range_max (可选)

body

整数

最大目标协议端口。

source_ip_prefix (可选)

body

字符串

源 IP 前缀。

destination_ip_prefix (可选)

body

字符串

目标 IP 前缀。

source_logical_port (可选)

body

字符串

源逻辑端口的 UUID。

destination_logical_port (可选)

body

字符串

目标逻辑端口的 UUID。

l7_parameters (可选)

body

对象

L7 参数字典,形式为 logical_source_network: uuid, logical_destination_network: uuid。

请求示例

示例:创建流分类器:JSON 请求

{
     "flow_classifier": {
         "name": "FC1",
         "tenant_id": "1814726e2d22407b8ca76db5e567dcf1",
         "description": "Flow rule for classifying TCP traffic",
         "protocol": "TCP",
         "source_port_range_min": 22,
         "source_port_range_max": 4000,
         "destination_port_range_min": 80,
         "destination_port_range_max": 80,
         "source_ip_prefix": null,
         "destination_ip_prefix": "22.12.34.45"
     }
}

响应

名称

入参

类型

描述

flow_classifier_id

路径

字符串

流分类器的 ID。

name

body

字符串

流分类器的名称。

description

body

字符串

A human-readable description for the resource.

ethertype

body

字符串

必须是 IPv4 或 IPv6,并且 CIDR 表示的地址必须与入口或出口规则匹配。

协议

body

字符串

IP 协议可以用字符串、整数或 null 来表示。有效的字符串或整数值包括 any0ah51dccp33egp8esp50gre47icmp1icmpv658igmp2ipip4ipv6-encap41ipv6-frag44ipv6-icmp58ipv6-nonxt59ipv6-opts60ipv6-route43ospf89pgm113rsvp46sctp132tcp6udp17udplite136vrrp112。此外,介于 [0-255] 之间的任何整数值也有效。字符串 any (或整数 0) 表示 所有 IP 协议。有关支持的字符串的最新列表,请参阅 neutron_lib.constants 中的常量。

source_port_range_min (可选)

body

整数

最小源协议端口。

source_port_range_max (可选)

body

整数

最大源协议端口。

destination_port_range_min (可选)

body

整数

最小目标协议端口。

destination_port_range_max (可选)

body

整数

最大目标协议端口。

source_ip_prefix (可选)

body

字符串

源 IP 前缀。

destination_ip_prefix (可选)

body

字符串

目标 IP 前缀。

source_logical_port (可选)

body

字符串

源逻辑端口的 UUID。

destination_logical_port (可选)

body

字符串

目标逻辑端口的 UUID。

l7_parameters (可选)

body

对象

L7 参数字典,形式为 logical_source_network: uuid, logical_destination_network: uuid。

响应示例

示例:创建流分类器:JSON 响应

{
     "flow_classifier": {
         "name": "FC1",
         "tenant_id": "1814726e2d22407b8ca76db5e567dcf1",
         "description": "Flow rule for classifying TCP traffic",
         "protocol": "TCP",
         "source_port_range_min": 22,
         "source_port_range_max": 4000,
         "destination_port_range_min": 80,
         "destination_port_range_max": 80,
         "source_ip_prefix": null,
         "destination_ip_prefix": "22.12.34.45",
         "id": "4a334cd4-fe9c-4fae-af4b-321c5e2eb051"
     }
}
GET
/v1.0/sfc/flow_classifiers/{flow_classifier_id}

显示流分类器详细信息

显示流分类器的详细信息。

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

错误响应代码:badRequest(400), unauthorized(401), forbidden(403), itemNotFound(404)

请求

名称

入参

类型

描述

flow_classifier_id

路径

字符串

流分类器的 ID。

响应

名称

入参

类型

描述

id

body

字符串

流分类器的 UUID。

name

body

字符串

流分类器的名称。

description

body

字符串

A human-readable description for the resource.

ethertype

body

字符串

必须是 IPv4 或 IPv6,并且 CIDR 表示的地址必须与入口或出口规则匹配。

协议

body

字符串

IP 协议可以用字符串、整数或 null 来表示。有效的字符串或整数值包括 any0ah51dccp33egp8esp50gre47icmp1icmpv658igmp2ipip4ipv6-encap41ipv6-frag44ipv6-icmp58ipv6-nonxt59ipv6-opts60ipv6-route43ospf89pgm113rsvp46sctp132tcp6udp17udplite136vrrp112。此外,介于 [0-255] 之间的任何整数值也有效。字符串 any (或整数 0) 表示 所有 IP 协议。有关支持的字符串的最新列表,请参阅 neutron_lib.constants 中的常量。

source_port_range_min (可选)

body

整数

最小源协议端口。

source_port_range_max (可选)

body

整数

最大源协议端口。

destination_port_range_min (可选)

body

整数

最小目标协议端口。

destination_port_range_max (可选)

body

整数

最大目标协议端口。

source_ip_prefix (可选)

body

字符串

源 IP 前缀。

destination_ip_prefix (可选)

body

字符串

目标 IP 前缀。

source_logical_port (可选)

body

字符串

源逻辑端口的 UUID。

destination_logical_port (可选)

body

字符串

目标逻辑端口的 UUID。

l7_parameters (可选)

body

对象

L7 参数字典,形式为 logical_source_network: uuid, logical_destination_network: uuid。

响应示例

示例:显示流分类器:JSON 响应

{
     "flow_classifier": {
         "id": "4a334cd4-fe9c-4fae-af4b-321c5e2eb051",
         "name": "FC1",
         "tenant_id": "1814726e2d22407b8ca76db5e567dcf1",
         "description": "Flow rule for classifying TCP traffic",
         "protocol": "TCP",
         "source_port_range_min": 100,
         "source_port_range_max": 4000,
         "destination_port_range_min": 80,
         "destination_port_range_max": 80,
         "source_ip_prefix": null,
         "destination_ip_prefix": "22.12.34.65"
     }
}
PUT
/v1.0/sfc/flow_classifiers/{flow_classifier_id}

更新流分类器

更新流分类器。

正常响应代码:200

错误响应代码:badRequest(400), unauthorized(401), forbidden(403), itemNotFound(404)

请求

名称

入参

类型

描述

flow_classifier_id

路径

字符串

流分类器的 ID。

name

body

字符串

流分类器的名称。

description

body

字符串

A human-readable description for the resource.

请求示例

示例:更新流分类器:JSON 请求

{
     "flow_classifier": {
         "id": "4a334cd4-fe9c-4fae-af4b-321c5e2eb051",
         "name": "FC1",
         "tenant_id": "1814726e2d22407b8ca76db5e567dcf1",
         "description": "Flow rule for classifying TCP traffic"
     }
}

响应

名称

入参

类型

描述

id

body

字符串

流分类器的 UUID。

name

body

字符串

流分类器的名称。

description

body

字符串

A human-readable description for the resource.

ethertype

body

字符串

必须是 IPv4 或 IPv6,并且 CIDR 表示的地址必须与入口或出口规则匹配。

协议

body

字符串

IP 协议可以用字符串、整数或 null 来表示。有效的字符串或整数值包括 any0ah51dccp33egp8esp50gre47icmp1icmpv658igmp2ipip4ipv6-encap41ipv6-frag44ipv6-icmp58ipv6-nonxt59ipv6-opts60ipv6-route43ospf89pgm113rsvp46sctp132tcp6udp17udplite136vrrp112。此外,介于 [0-255] 之间的任何整数值也有效。字符串 any (或整数 0) 表示 所有 IP 协议。有关支持的字符串的最新列表,请参阅 neutron_lib.constants 中的常量。

source_port_range_min (可选)

body

整数

最小源协议端口。

source_port_range_max (可选)

body

整数

最大源协议端口。

destination_port_range_min (可选)

body

整数

最小目标协议端口。

destination_port_range_max (可选)

body

整数

最大目标协议端口。

source_ip_prefix (可选)

body

字符串

源 IP 前缀。

destination_ip_prefix (可选)

body

字符串

目标 IP 前缀。

source_logical_port (可选)

body

字符串

源逻辑端口的 UUID。

destination_logical_port (可选)

body

字符串

目标逻辑端口的 UUID。

l7_parameters (可选)

body

对象

L7 参数字典,形式为 logical_source_network: uuid, logical_destination_network: uuid。

响应示例

示例:更新流分类器:JSON 响应

{
     "flow_classifier": {
         "id": "4a334cd4-fe9c-4fae-af4b-321c5e2eb051",
         "name": "FC1",
         "tenant_id": "1814726e2d22407b8ca76db5e567dcf1",
         "description": "Flow rule for classifying TCP traffic",
         "protocol": "TCP",
         "source_port_range_min": 100,
         "source_port_range_max": 4000,
         "destination_port_range_min": 80,
         "destination_port_range_max": 80,
         "source_ip_prefix": null,
         "destination_ip_prefix": "22.12.34.65"
     }
}
DELETE
/v1.0/sfc/flow-classifiers/{flow_classifier_id}

删除流分类器

删除流分类器。

正常响应代码:202

错误响应代码:badRequest(400), unauthorized(401), forbidden(403), itemNotFound(404)

请求

名称

入参

类型

描述

flow_classifier_id

路径

字符串

流分类器的 ID。

响应

成功的 Delete 请求没有响应正文。

服务图 (service_graph)

列出、显示信息、创建、更新和删除服务图。

GET
/v1.0/sfc/service_graphs

列出服务图

列出服务图。

Standard query parameters are supported on the URI. For more information, see Filtering and Column Selection.

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

Pagination query parameters are supported if Neutron configuration supports it by overriding allow_pagination=false. For more information, see Pagination.

Sorting query parameters are supported if Neutron configuration supports it with allow_sorting=true. For more information, see Sorting.

正常响应代码:200

错误响应代码:未授权(401)、禁止(403)

响应

名称

入参

类型

描述

id (可选)

body

布尔值

服务图的 UUID。

name (可选)

body

布尔值

服务图的名称。

description

body

字符串

A human-readable description for the resource.

port_chains

body

dict

一个字典,其中键是源端口链,值是目标端口链列表。

响应示例

示例:列出服务图:JSON 响应

{
   "service_graphs":[
      {
         "id":"15e82a5c-c907-4c8c-9501-3e9268178bf8",
         "name":"graph",
         "description":"one graph that uses 6 port chains",
         "tenant_id":"0b18a09b22ef49a5be0bf51d68ed1962",
         "project_id":"0b18a09b22ef49a5be0bf51d68ed1962",
         "port_chains":{
            "19b1965e-f528-4a81-bb05-64b18815fcfc":[
               "3a478b3b-6012-47c6-9c34-6adaffc51b32"
            ],
            "07d0bf74-4293-4e4a-b66f-561ba30bcf76":[
               "3a478b3b-6012-47c6-9c34-6adaffc51b32"
            ],
            "74e01d2b-3dbc-4de8-9969-d4b95d710103":[
               "41e04664-59fb-4f1c-a063-6cfa39ed9ae7",
               "71b514f6-498b-4ae8-ba4e-dff434ad6c1a"
            ],
            "41e04664-59fb-4f1c-a063-6cfa39ed9ae7":[
               "07d0bf74-4293-4e4a-b66f-561ba30bcf76",
               "19b1965e-f528-4a81-bb05-64b18815fcfc"
            ]
         }
      },
      {
         "id":"b91000f0-ece2-4254-9679-76e1ba6843cb",
         "name":"simpler-graph",
         "description":"",
         "tenant_id":"0b18a09b22ef49a5be0bf51d68ed1962",
         "project_id":"0b18a09b22ef49a5be0bf51d68ed1962",
         "port_chains":{
            "ff90b009-396d-4ce7-b387-82a702125e46":[
               "1da89f39-db34-401d-b54b-468e1c648cd1"
            ]
         }
      }
   ]
}
POST
/v1.0/sfc/service_graphs

创建服务图

创建服务图。

正常响应代码:200

错误响应代码:badRequest(400),unauthorized(401),forbidden(403)

请求

名称

入参

类型

描述

name (可选)

body

布尔值

服务图的名称。

description

body

字符串

A human-readable description for the resource.

port_chains

body

dict

一个字典,其中键是源端口链,值是目标端口链列表。

示例:创建服务图:JSON 请求

{
   "service_graph":{
      "name":"graph",
      "description":"one graph that uses 6 port chains",
      "port_chains":{
         "19b1965e-f528-4a81-bb05-64b18815fcfc":[
            "3a478b3b-6012-47c6-9c34-6adaffc51b32"
         ],
         "07d0bf74-4293-4e4a-b66f-561ba30bcf76":[
            "3a478b3b-6012-47c6-9c34-6adaffc51b32"
         ],
         "41e04664-59fb-4f1c-a063-6cfa39ed9ae7":[
            "07d0bf74-4293-4e4a-b66f-561ba30bcf76",
            "19b1965e-f528-4a81-bb05-64b18815fcfc"
         ],
         "74e01d2b-3dbc-4de8-9969-d4b95d710103":[
            "41e04664-59fb-4f1c-a063-6cfa39ed9ae7",
            "71b514f6-498b-4ae8-ba4e-dff434ad6c1a"
         ]
      }
   }
}

响应

名称

入参

类型

描述

id (可选)

body

布尔值

服务图的 UUID。

name (可选)

body

布尔值

服务图的名称。

description

body

字符串

A human-readable description for the resource.

port_chains

body

dict

一个字典,其中键是源端口链,值是目标端口链列表。

响应示例

示例:创建服务图:JSON 响应

{
   "service_graph":{
      "id":"15e82a5c-c907-4c8c-9501-3e9268178bf8",
      "name":"graph",
      "description":"one graph that uses 6 port chains",
      "tenant_id":"0b18a09b22ef49a5be0bf51d68ed1962",
      "project_id":"0b18a09b22ef49a5be0bf51d68ed1962",
      "port_chains":{
         "19b1965e-f528-4a81-bb05-64b18815fcfc":[
            "3a478b3b-6012-47c6-9c34-6adaffc51b32"
         ],
         "07d0bf74-4293-4e4a-b66f-561ba30bcf76":[
            "3a478b3b-6012-47c6-9c34-6adaffc51b32"
         ],
         "74e01d2b-3dbc-4de8-9969-d4b95d710103":[
            "41e04664-59fb-4f1c-a063-6cfa39ed9ae7",
            "71b514f6-498b-4ae8-ba4e-dff434ad6c1a"
         ],
         "41e04664-59fb-4f1c-a063-6cfa39ed9ae7":[
            "07d0bf74-4293-4e4a-b66f-561ba30bcf76",
            "19b1965e-f528-4a81-bb05-64b18815fcfc"
         ]
      }
   }
}
GET
/v1.0/sfc/service_graphs/{sfc_service_graph_id-path}

显示服务图详细信息

显示服务图的详细信息。

Use the fields query parameter to control which fields are returned in the response body. For more information, see Fields.

正常响应代码:200

错误响应代码:badRequest(400), unauthorized(401), forbidden(403), itemNotFound(404)

请求

名称

入参

类型

描述

service_graph_id

路径

字符串

服务图的 UUID。

响应

名称

入参

类型

描述

id (可选)

body

布尔值

服务图的 UUID。

name (可选)

body

布尔值

服务图的名称。

description

body

字符串

A human-readable description for the resource.

port_chains

body

dict

一个字典,其中键是源端口链,值是目标端口链列表。

响应示例

示例:显示服务图:JSON 响应

{
   "service_graph":{
      "id":"15e82a5c-c907-4c8c-9501-3e9268178bf8",
      "name":"graph",
      "description":"one graph that uses 6 port chains",
      "tenant_id":"0b18a09b22ef49a5be0bf51d68ed1962",
      "project_id":"0b18a09b22ef49a5be0bf51d68ed1962",
      "port_chains":{
         "19b1965e-f528-4a81-bb05-64b18815fcfc":[
            "3a478b3b-6012-47c6-9c34-6adaffc51b32"
         ],
         "07d0bf74-4293-4e4a-b66f-561ba30bcf76":[
            "3a478b3b-6012-47c6-9c34-6adaffc51b32"
         ],
         "74e01d2b-3dbc-4de8-9969-d4b95d710103":[
            "41e04664-59fb-4f1c-a063-6cfa39ed9ae7",
            "71b514f6-498b-4ae8-ba4e-dff434ad6c1a"
         ],
         "41e04664-59fb-4f1c-a063-6cfa39ed9ae7":[
            "07d0bf74-4293-4e4a-b66f-561ba30bcf76",
            "19b1965e-f528-4a81-bb05-64b18815fcfc"
         ]
      }
   }
}
PUT
/v1.0/sfc/service_graphs/{sfc_service_graph_id-path}

更新服务图

更新服务图。

正常响应代码:200

错误响应代码:badRequest(400), unauthorized(401), forbidden(403), itemNotFound(404)

请求

名称

入参

类型

描述

service_graph_id

路径

字符串

服务图的 UUID。

name (可选)

body

布尔值

服务图的名称。

description

body

字符串

A human-readable description for the resource.

port_chains

body

dict

一个字典,其中键是源端口链,值是目标端口链列表。

请求示例

示例:更新服务图:JSON 请求

{
   "service_graph":{
      "name":"new-name",
      "description":"and new description, the port_chains dictionary can't be updated"
   }
}

响应

名称

入参

类型

描述

id (可选)

body

布尔值

服务图的 UUID。

name (可选)

body

布尔值

服务图的名称。

description

body

字符串

A human-readable description for the resource.

port_chains

body

dict

一个字典,其中键是源端口链,值是目标端口链列表。

响应示例

示例:更新服务图:JSON 响应

{
   "service_graph":{
      "id":"15e82a5c-c907-4c8c-9501-3e9268178bf8",
      "name":"new-name",
      "description":"and new description, the port_chains dictionary can't be updated",
      "tenant_id":"0b18a09b22ef49a5be0bf51d68ed1962",
      "project_id":"0b18a09b22ef49a5be0bf51d68ed1962",
      "port_chains":{
         "19b1965e-f528-4a81-bb05-64b18815fcfc":[
            "3a478b3b-6012-47c6-9c34-6adaffc51b32"
         ],
         "07d0bf74-4293-4e4a-b66f-561ba30bcf76":[
            "3a478b3b-6012-47c6-9c34-6adaffc51b32"
         ],
         "74e01d2b-3dbc-4de8-9969-d4b95d710103":[
            "41e04664-59fb-4f1c-a063-6cfa39ed9ae7",
            "71b514f6-498b-4ae8-ba4e-dff434ad6c1a"
         ],
         "41e04664-59fb-4f1c-a063-6cfa39ed9ae7":[
            "07d0bf74-4293-4e4a-b66f-561ba30bcf76",
            "19b1965e-f528-4a81-bb05-64b18815fcfc"
         ]
      }
   }
}
DELETE
/v1.0/sfc/service_graphs/{sfc_service_graph_id-path}

删除服务图

删除服务图。

正常响应代码:202

错误响应代码:badRequest(400), unauthorized(401), forbidden(403), itemNotFound(404)

请求

名称

入参

类型

描述

service_graph_id

路径

字符串

服务图的 UUID。

响应

成功的 Delete 请求没有响应正文。