GetPorts【获取端口信息】

获取租户交换机端口或路由器端口信息:可根据交换机交换机ID或路由器ID来获取交换机端口或路由器端口信息。

Request Parameters

Parameter name Type Description Required
action String API 标识符 Yes
network_id String 交换机 ID(交换机ID和路由器ID任选其一) Yes
router_id String 路由器 ID(交换机ID和路由器ID任选其一) Yes

Response Elements

Name Type Description
message String 执行结果信息
code Integer HTTP Resonpe响应状态码
data Array JSON 格式的交换机端口或路由器端口信息列表,每项参数可见下面 Data Item

Data Item

Name Type Description
status String 状态
parent_id String 端口对应的父 ID
device_owner String 连接设备
security_group_names Array 安全组名称
name String 端口名称
subnet_id String 子网 ID
ip_address String 公网 IP
id String 端口 ID
security_groups Array 安全组 ID

Example

Example Request:

Request Headers:

POST /api/ HTTP/1.1
Origin: https://console.plcloud.com
X-CSRFToken: 6An6xEuOJqW6dVDtlgzZr6FqgkSbJmqp
Content-Type: application/x-www-form-urlencoded

Form Data:

action: GetPorts
network_id: 865f64d8-8ea5-45e2-87d1-5588011fd6e9

Example Response:

{
  "message": "Success",
  "code": 200,
  "data": [
    {
      "status": "ACTIVE",
      "parent_id": "",
      "device_owner": "network:dhcp",
      "security_group_names": [],
      "name": "(a0edca1b)",
      "subnet_id": "e6858c9c-ba6c-40ee-bc04-06db0d127fa0",
      "ip_address": "172.24.0.3",
      "id": "a0edca1b-9969-4ed2-971e-21e570336b74",
      "security_groups": []
    },
    {
      "status": "DOWN",
      "parent_id": "",
      "device_owner": "neutron:LOADBALANCER",
      "security_group_names": [
        "default"
      ],
      "name": "vip-3fd82c8a-1353-49eb-a629-dbf5862737d0",
      "subnet_id": "e6858c9c-ba6c-40ee-bc04-06db0d127fa0",
      "ip_address": "172.24.141.45",
      "id": "cf4a431d-dd29-4f65-b8ae-f59b6769a56e",
      "security_groups": [
        "2c52c687-45e2-4af6-99d6-e462b4211a2e"
      ]
    }
  ]
}