跳到主要内容

list_device_x 获取设备列表

POST /api/v1/network/list_device_x

描述

获取设备(网络接口名称)列表,可以利用status参数来过滤设备状态,获取到指定状态的接口列表。

可以利用status参数来过滤设备状态,如connected, disconnected, unmanaged, unavailable

访问权限

具备以下权限:

network:get_connection_x

JSON参数

请求参数如下:

{
"status": "option string" // 可选参数,表示设备状态,如connected, disconnected, unmanaged, unavailable
}

无参数, 传递空对象即可

请求示例:

{}

响应结果

请求返回的HTTP状态码为200

返回结果为JSON格式的数据,您可以通过解析JSON数据来获取API调用的结果信息。结构如下:

{
"success": true|false,
"data"?:[
{
"device": "string", // 网口设备名称:如eth_ntp0、eth_ntp1、bond0等
"type": "string", // 设备类型:如ethernet、bond、vlan等
"state": "string" // 设备状态:如connected, disconnected, unmanaged, unavailable
},
...
],
"errorCode"?: "option string",
"errorMessage"?: "option string",
"showType"?: 0|1|2|4|9,
"traceId"?: "option string"
}
提示
  • deviceId: 设备ID
  • device: 网口设备名称,如eth0, eth1等

正确结果示例:

{
"success": true,
"data": [
{
"device": "eth_ntp5",
"type": "ethernet",
"state": "connected"
},
{
"device": "eth_ntp0",
"type": "ethernet",
"state": "connected"
},
{
"device": "eth_ntp0.100",
"type": "vlan",
"state": "connected"
},
{
"device": "bond1",
"type": "bond",
"state": "connected"
},
{
"device": "eth_ntp2",
"type": "ethernet",
"state": "disconnected"
},
{
"device": "eth_ntp3",
"type": "ethernet",
"state": "disconnected"
},
{
"device": "eth_ntp1",
"type": "ethernet",
"state": "unavailable"
},
{
"device": "eth_ntp10",
"type": "ethernet",
"state": "unavailable"
},
{
"device": "eth_ntp11",
"type": "ethernet",
"state": "unavailable"
},
{
"device": "eth_ntp4",
"type": "ethernet",
"state": "unavailable"
},
{
"device": "eth_ntp6",
"type": "ethernet",
"state": "unavailable"
},
{
"device": "eth_ntp7",
"type": "ethernet",
"state": "unavailable"
},
{
"device": "eth_ntp8",
"type": "ethernet",
"state": "unavailable"
},
{
"device": "eth_ntp9",
"type": "ethernet",
"state": "unavailable"
},
{
"device": "ethi210",
"type": "ethernet",
"state": "unavailable"
},
{
"device": "vlan300",
"type": "vlan",
"state": "unmanaged"
}
]
}