Loading
close

策略路由

time 更新时间:2024-12-26 16:34:22

策略路由

列举路由器

功能介绍

‎列举策略路由

URI

GET /v2.0/policyroutes

请求消息

参数 参数类型 是否必选 描述
project_id string 指定项目ID进行查询。
router_id string 指定路由器ID进行查询。

响应消息

参数 参数类型 描述
policyroutes array 策略路由列表。
action string 策略动作。取值包括:allow 允许,deny 拒绝,reroute 重新路由。其中 reroute 需要配合 nexthops 字段实现功能。
created_at string 创建时间。
description string 描述。
destination string 目标地址。
dst_port string 目标端口。有效的值可以是单个端口号,例如22;也可以是范围,例如80:90。
enabled boolean 策略路由是否开启,取值: true 开启,false 禁用。
ethertype string 以太网协议,IPv4 或 IPv6。
from_interface string 源接口的 UUID,必需属于绑定的路由器的接口。
id string 策略路由 ID。
nexthops string reroute 重路由的下一跳 IP 地址。多个下一跳地址表示 ecmp 路由,用逗号隔开。
priority integer 策略路由的优先级。
project_id string 租户 ID。
protocol String IP 协议。取值包括: icmp、tcp、udp 或 null。
revision_number integer 策略路由的版本号。
router_id string 绑定的路由器 UUID。
source string 源地址。
src_port string 源端口。有效的值可以是单个端口号,例如22;也可以是范围,例如80:90。
tags array 标签列表。
tenant_id string 租户 ID。
to_interface string 目标接口的 UUID,必需属于绑定的路由器的接口。
updated_at string 上一次更新时间。

请求示例

GET https://{endpoint}/v2.0/policyroutes?router_id=d536a8ba-6b98-4059-85a2-1c2c60014f60

正常响应示例

{
    "policyroutes": [
        {
            "action": "reroute",
            "created_at": "2024-12-24T06:07:55Z",
            "description": "",
            "destination": null,
            "dst_port": null,
            "enabled": true,
            "ethertype": "IPv4",
            "from_interface": "b2b3f0d0-cf6b-41a2-bd5e-5cfcf3b87f87",
            "id": "fb0c6e80-34aa-484b-b9c8-4a6908bd25ae",
            "nexthops": "172.16.10.23,172.16.10.24",
            "priority": 123,
            "project_id": "ed6255c8005846889398598becb9878f",
            "protocol": null,
            "revision_number": 0,
            "router_id": "d536a8ba-6b98-4059-85a2-1c2c60014f60",
            "source": "192.168.117.0/24",
            "src_port": null,
            "tags": [],
            "tenant_id": "ed6255c8005846889398598becb9878f",
            "to_interface": null,
            "updated_at": "2024-12-24T06:07:55Z"
        }
    ]

}	

正常响应代码

200

错误码

400,401,403,404,409,413

创建策略路由

功能介绍

‎创建一个策略路由

URI

POST /v2.0/policyroutes

请求消息

参数 参数类型 是否必选 描述
policyroute object 策略路由对象。
action string 策略动作。取值包括:allow 允许,deny 拒绝,reroute 重新路由,默认是 reroute。其中 reroute 需要配合 nexthops 字段实现功能。
description string 描述。
destination string 目标地址。
dst_port string 目标端口。有效的值可以是单个端口号,例如22;也可以是范围,例如80:90。
enabled boolean 策略路由是否开启,取值: true 开启,false 禁用。默认是 true。
ethertype string 以太网协议,IPv4 或 IPv6。默认是IPv4。
from_interface string 源接口的 UUID,必需属于绑定的路由器的接口。
nexthops string reroute 重路由的下一跳 IP 地址。多个下一跳地址表示 ecmp 路由,用逗号隔开。
priority integer 策略路由的优先级。
project_id string 租户 ID。
protocol string IP 协议。取值包括: icmp、tcp、udp 或 null。
router_id string 绑定的路由器 UUID。
source string 源地址。
src_port string 源端口。有效的值可以是单个端口号,例如22;也可以是范围,例如80:90。
tenant_id string 租户 ID。
to_interface string 目标接口的 UUID,必需属于绑定的路由器的接口。

响应消息

参数 参数类型 描述
action string 策略动作。取值包括:allow 允许,deny 拒绝,reroute 重新路由。其中 reroute 需要配合 nexthops 字段实现功能。
created_at string 创建时间。
description string 描述。
destination string 目标地址。
dst_port string 目标端口。有效的值可以是单个端口号,例如22;也可以是范围,例如80:90。
enabled boolean 策略路由是否开启,取值: true 开启,false 禁用。
ethertype string 以太网协议,IPv4 或 IPv6。
from_interface string 源接口的 UUID,必需属于绑定的路由器的接口。
id string 策略路由 ID。
nexthops string reroute 重路由的下一跳 IP 地址。多个下一跳地址表示 ecmp 路由,用逗号隔开。
priority integer 策略路由的优先级。
project_id string 租户 ID。
protocol String IP 协议。取值包括: icmp、tcp、udp 或 null。
revision_number integer 策略路由的版本号。
router_id string 绑定的路由器 UUID。
source string 源地址。
src_port string 源端口。有效的值可以是单个端口号,例如22;也可以是范围,例如80:90。
tags array 标签列表。
tenant_id string 租户 ID。
to_interface string 目标接口的 UUID,必需属于绑定的路由器的接口。
updated_at string 上一次更新时间。

请求示例

POST http://{endpoint}/v2.0/policyroutes
{
    "policyroute": {
        "action": "reroute",
        "destination": "172.16.10.251/32",
        "dst_port": "22",
        "enabled": true,
        "ethertype": "IPv4",
        "from_interface": "b2b3f0d0-cf6b-41a2-bd5e-5cfcf3b87f87",
        "nexthops": "172.16.10.23,172.16.10.24",
        "priority": 123,
        "project_id": "ed6255c8005846889398598becb9878f",
        "protocol": tcp,
        "router_id": "d536a8ba-6b98-4059-85a2-1c2c60014f60",
        "source": "192.168.117.0/24",
        "src_port": "55:80",
        "to_interface": "e2369f70-077c-4a1e-a45e-bb88a7ee13fe",
    }
}

正常响应示例

{
    "policyroute": {
        "action": "reroute",
        "created_at": "2024-12-24T06:07:55Z",
        "description": "",
        "destination": "172.16.10.251/32",
        "dst_port": "22",
        "enabled": true,
        "ethertype": "IPv4",
        "from_interface": "b2b3f0d0-cf6b-41a2-bd5e-5cfcf3b87f87",
        "id": "fb0c6e80-34aa-484b-b9c8-4a6908bd25ae",
        "nexthops": "172.16.10.23,172.16.10.24",
        "priority": 123,
        "project_id": "ed6255c8005846889398598becb9878f",
        "protocol": tcp,
        "revision_number": 0,
        "router_id": "d536a8ba-6b98-4059-85a2-1c2c60014f60",
        "source": "192.168.117.0/24",
        "src_port": "55:80",
        "tags": [],
        "tenant_id": "ed6255c8005846889398598becb9878f",
        "to_interface": "e2369f70-077c-4a1e-a45e-bb88a7ee13fe",
        "updated_at": "2024-12-24T06:07:55Z"
    }
}

正常响应代码

201

错误码

400,401,403,404,409,413

获取策略路由

功能介绍

‎获取一个策略路由的详情

URI

GET /v2.0/policyroutes/{policyroute_id}

参数 是否必选 描述
policyroute_id 策略路由的 ID。

请求消息

响应消息

参数 参数类型 描述
action string 策略动作。取值包括:allow 允许,deny 拒绝,reroute 重新路由。其中 reroute 需要配合 nexthops 字段实现功能。
created_at string 创建时间。
description string 描述。
destination string 目标地址。
dst_port string 目标端口。有效的值可以是单个端口号,例如22;也可以是范围,例如80:90。
enabled boolean 策略路由是否开启,取值: true 开启,false 禁用。
ethertype string 以太网协议,IPv4 或 IPv6。
from_interface string 源接口的 UUID,必需属于绑定的路由器的接口。
id string 策略路由 ID。
nexthops string reroute 重路由的下一跳 IP 地址。多个下一跳地址表示 ecmp 路由,用逗号隔开。
priority integer 策略路由的优先级。
project_id string 租户 ID。
protocol String IP 协议。取值包括: icmp、tcp、udp 或 null。
revision_number integer 策略路由的版本号。
router_id string 绑定的路由器 UUID。
source string 源地址。
src_port string 源端口。有效的值可以是单个端口号,例如22;也可以是范围,例如80:90。
tags array 标签列表。
tenant_id string 租户 ID。
to_interface string 目标接口的 UUID,必需属于绑定的路由器的接口。
updated_at string 上一次更新时间。

请求示例

GET http://{endpoint}/v2.0/policyroutes/fb0c6e80-34aa-484b-b9c8-4a6908bd25ae

正常响应示例

{
    "policyroute": {
        "action": "reroute",
        "created_at": "2024-12-24T06:07:55Z",
        "description": "",
        "destination": "172.16.10.251/32",
        "dst_port": "22",
        "enabled": true,
        "ethertype": "IPv4",
        "from_interface": "b2b3f0d0-cf6b-41a2-bd5e-5cfcf3b87f87",
        "id": "fb0c6e80-34aa-484b-b9c8-4a6908bd25ae",
        "nexthops": "172.16.10.23,172.16.10.24",
        "priority": 123,
        "project_id": "ed6255c8005846889398598becb9878f",
        "protocol": tcp,
        "revision_number": 0,
        "router_id": "d536a8ba-6b98-4059-85a2-1c2c60014f60",
        "source": "192.168.117.0/24",
        "src_port": "55:80",
        "tags": [],
        "tenant_id": "ed6255c8005846889398598becb9878f",
        "to_interface": "e2369f70-077c-4a1e-a45e-bb88a7ee13fe",
        "updated_at": "2024-12-24T06:07:55Z"
    }
}

正常响应代码

200

错误码

400,401,403,404,409,413

更新策略路由

功能介绍

‎更新一个指定策略路由

URI

PUT /v2.0/policyroutes/{policyroute_id}

参数 是否必选 描述
policyroute_id 策略路由的 ID。

请求消息

参数 参数类型 是否必选 描述
policyroute object 策略路由对象。
description string 描述。
destination string 目标地址。
dst_port string 目标端口。有效的值可以是单个端口号,例如22;也可以是范围,例如80:90。
enabled boolean 策略路由是否开启,取值: true 开启,false 禁用。
from_interface string 源接口的 UUID,必需属于绑定的路由器的接口。
nexthops string reroute 重路由的下一跳 IP 地址。多个下一跳地址表示 ecmp 路由,用逗号隔开。
priority integer 策略路由的优先级。
protocol string IP 协议。取值包括: icmp、tcp、udp 或 null。
router_id string 绑定的路由器 UUID。
source string 源地址。
src_port string 源端口。有效的值可以是单个端口号,例如22;也可以是范围,例如80:90。
to_interface string 目标接口的 UUID,必需属于绑定的路由器的接口。

响应消息

参数 参数类型 描述
action string 策略动作。取值包括:allow 允许,deny 拒绝,reroute 重新路由。其中 reroute 需要配合 nexthops 字段实现功能。
created_at string 创建时间。
description string 描述。
destination string 目标地址。
dst_port string 目标端口。有效的值可以是单个端口号,例如22;也可以是范围,例如80:90。
enabled boolean 策略路由是否开启,取值: true 开启,false 禁用。
ethertype string 以太网协议,IPv4 或 IPv6。
from_interface string 源接口的 UUID,必需属于绑定的路由器的接口。
id string 策略路由 ID。
nexthops string reroute 重新路由的下一跳 IP 地址。多个下一跳地址表示 ECMP 路由,用逗号隔开。
priority integer 策略路由的优先级。
project_id string 租户 ID。
protocol String IP 协议。取值包括: icmp、tcp、udp 或 null。
revision_number integer 策略路由的版本号。
router_id string 绑定的路由器 UUID。
source string 源地址。
src_port string 源端口。有效的值可以是单个端口号,例如22;也可以是范围,例如80:90。
tags array 标签列表。
tenant_id string 租户 ID。
to_interface string 目标接口的 UUID,必需属于绑定的路由器的接口。
updated_at string 上一次更新时间。

请求示例

PUT http://{endpoint}/v2.0/policyroutes/fb0c6e80-34aa-484b-b9c8-4a6908bd25ae
{
    "policyroute": {
        "destination": "172.16.10.251/32",
        "dst_port": "80",
        "from_interface": "b2b3f0d0-cf6b-41a2-bd5e-5cfcf3b87f87",
        "nexthops": "172.16.10.25,172.16.10.26",
        "project_id": "ed6255c8005846889398598becb9878f",
        "protocol": tcp,
        "router_id": "d536a8ba-6b98-4059-85a2-1c2c60014f60",
        "source": "192.168.117.0/24",
        "src_port": "55:800",
        "to_interface": "e2369f70-077c-4a1e-a45e-bb88a7ee13fe",
    }
}

正常响应示例

{
    "policyroute": {
        "action": "reroute",
        "created_at": "2024-12-24T06:07:55Z",
        "description": "",
        "destination": "172.16.10.251/32",
        "dst_port": "80",
        "enabled": true,
        "ethertype": "IPv4",
        "from_interface": "b2b3f0d0-cf6b-41a2-bd5e-5cfcf3b87f87",
        "id": "fb0c6e80-34aa-484b-b9c8-4a6908bd25ae",
        "nexthops": "172.16.10.25,172.16.10.26",
        "priority": 123,
        "project_id": "ed6255c8005846889398598becb9878f",
        "protocol": tcp,
        "revision_number": 0,
        "router_id": "d536a8ba-6b98-4059-85a2-1c2c60014f60",
        "source": "192.168.117.0/24",
        "src_port": "55:800",
        "tags": [],
        "tenant_id": "ed6255c8005846889398598becb9878f",
        "to_interface": "e2369f70-077c-4a1e-a45e-bb88a7ee13fe",
        "updated_at": "2024-12-24T08:07:55Z"
    }
}

正常响应代码

200

错误码

400,401,403,404,409,413

删除策略路由

功能介绍

‎删除一个指定策略路由

URI

DELETE /v2.0/policyroutes/{policyroute_id}

参数 是否必选 描述
policyroute_id 策略路由的 ID。

请求消息

请求示例

DELETE http://{endpoint}/v2.0/policyroutes/fb0c6e80-34aa-484b-b9c8-4a6908bd25ae

正常响应代码

204

错误码

400,401,403,404,409,413

此篇文章对你是否有帮助?
没帮助
locked-file

您暂无权限访问该产品