4.3.4 network资源

获取指定虚机的网卡相关信息

接口URI

/vm/{vmname}/network/resource

访问方法

HTTP方法

GET

参数

路径参数(Path Parameter) 说明 数据类型
vmname 虚机的名字 字符串(String)类型。必须,无缺省值。

返回结果

状态码(code)

0000:查询成功
1001:用户token不正确
1002:用户权限不足
3006:虚机不存在

消息头

Status Code: 200 OK
.....

消息体

{
"en0":{
           "ip":"网卡的ip地址",
           "mask":"网卡的子网掩码",
           "gateway":"网卡的网关地址",
           "mac":"网卡的mac地址",
           "slot":"设备槽号",
           "sea_phy":"组成SEA的物理网卡",
           "sea_vir":"组成SEA的虚拟网卡",
           "eth_type":"网卡类型",
           "vlan":"网卡配置的VLAN信息"
} ,
"en1":{
           "ip":"网卡的ip地址",
           .....
} ,
"code": "0000",
"msg": "Success"
}

元素说明

元素 说明 数据类型
en0 网卡名称, AIX中以en开头,linux中以ent开头 字符串(String)类型
ip 网卡的ip地址 字符串(String)类型
mask 网卡的子网掩码 字符串(String)类型
gateway 网卡的网关地址 字符串(String)类型
mac 网卡的mac地址 字符串(String)类型
slot 设备槽号 字符串(String)类型
sea_phy 组成SEA的物理网卡 字符串(String)类型
sea_vir 组成SEA的虚拟网卡 字符串(String)类型
eth_type 网卡类型 字符串(String)类型
vlan 网卡配置的VLAN信息 字符串(String)类型
code 状态码 字符串(String)类型
msg 响应消息 字符串(String)类型
 

应用举例

获取虚机aix1234的网卡资源相关信息

请求

GET http://192.168.137.25:8080/rest/vm/aix1234/network/resource
Accept:application/json
Content-Type:application/json;charset=utf-8
Token:77c3a272ec31c3e3129a0f4a8cfbf140
... ...

响应

Status Code: 200 OK
{
"en0":{
                "ip":"192.168.0.101",
                "mask":"255.255.255.0",
                "gateway":"192.168.0.1",
                "mac":"7e:39:30:09:4a:19",
                "slot":"3",
                "sea_phy":"ent0",
                "sea_vir":"ent5",
                "eth_type":"SEA",
                "vlan":"1"
} ,
"en1":{
                "ip":"192.168.0.141",
                .....
} ,
"code": "0000",
"msg": "Success"
}