资源管理接口
- 公共接口
- 网络管理接口
- 服务器管理接口
- 存储管理接口
- 查询存储设备列表
- 查询存储设备控制器信息
- 查询存储设备存储池信息
- 查询存储设备硬盘信息
- 查询存储设备LUN信息
- 查询IT设备链路信息
- 查询IT设备端口信息
- 查询FC交换机Zone信息
- 查询主机设备列表
- 批量查询组件接口
- 查询单个组件接口
- 刷新单个设备
- 根据指定参数获取存储设备列表
- 查询存储设备详情
- 存储设备接入接口
- 网管密码修改接口
- 网元密码修改接口
- 设备管理协议信息修改接口
- 查询FusionStorage Object/File集群信息接口
- 查询FusionStorage Object/File、FusionStorage Object硬盘信息接口
- 查询FusionStorage Object/File节点信息
- 查询存储设备网口信息
- 查询FusionStorage Object/File设备实时容量信息
- 查询FusionStorage Object集群信息接口
- 查询FusionStorage Object节点信息
- 查询FusionStorage Object设备实时容量信息
- 主机Agentless方式接入接口
- 查询存储设备LUN性能数据
- 查询存储设备单个文件系统接口
- 查询存储设备单个LUN接口
- 删除单个主机(仅提供给OceanStor DJ)
- 修改主机用户名和密码
- 删除单个存储设备(仅提供给OceanStror DJ)
- 查询告警数量
- 查询事件信息
- 查询存储远程复制pair信息
- 查询存储远程复制一致性组信息
- 关联查询端口组、LUN组、主机组三者映射关系信息
- 关联查询端口、LUN、主机三者映射关系信息
- 虚拟资源(FS/FC/vCenter/ESX)接口
- 虚拟资源(第三方OpenStack)接口
- eLTE管理
- PON管理接口
- 企业通信终端管理接口
- 视频监控管理接口
公共接口
查询所有的设备类别信息列表
接口功能
查询所有的设备类别信息列表。
URI路径
/rest/openapi/necategory
访问方法
GET
参数说明
参数名 |
必选/可选 |
参数位置 |
参数类型 |
参数说明 |
---|---|---|---|---|
openid |
必选 |
请求消息头 |
String |
会话标识,用于Open API的鉴权。 说明:
该参数由第三方调用安全管理的登录接口获取openid。 |
返回结果
字段名 |
类型 |
说明 |
---|---|---|
code |
int |
操作返回码。可以是如下值之一:
|
data |
String[] |
设备类别数组组成的列表。 |
description |
String |
接口调用结果的描述信息。 |
注意事项
无。
使用示例
package com.huawei.nms.openapi.demo.eam; import java.util.ArrayList; import java.util.List; import org.apache.http.HttpResponse; import org.apache.http.message.BasicNameValuePair; import com.huawei.nms.openapi.demo.global.GlobalVar; import com.huawei.nms.openapi.demo.global.NewHttpsAccess; import com.huawei.nms.openapi.demo.sm.Login; public class QueryCategory { /** * @param args */ public static void main(String[] args) { try { Login.login(); queryNeType(); } catch (Exception e) { System.out.println("login failed."); } } private static void queryNeType() { try { String url = "/rest/openapi/necategory"; String method = "GET"; List<BasicNameValuePair> headers = new ArrayList<BasicNameValuePair>(); headers.add(new BasicNameValuePair("openid", GlobalVar.globalOpenid)); //set parameters final List<BasicNameValuePair> parameters = new ArrayList<BasicNameValuePair>(); //send the request final HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, url, method, headers, parameters); //get the result final String ret = NewHttpsAccess.getResult(response); System.out.println(ret); } catch (Exception e ) { System.out.println("query NE type failed"); } } }
执行结果如下:
{ "code": 0, "data": [ "com.huawei.mo.pc", "com.huawei.mo.server", "com.huawei.mo.application", "com.huawei.oms.application" ], "description": "Operation success." }
查询预定条件的设备类型信息列表
接口功能
查询预定条件的设备类型信息列表。
URI路径
/rest/openapi/netype
访问方法
GET
参数说明
参数名 |
必选/可选 |
参数位置 |
参数类型 |
参数说明 |
---|---|---|---|---|
openid |
必选 |
请求消息头 |
String |
会话标识,用于Open API的鉴权。 说明:
该参数由第三方调用安全管理的登录接口获取openid。 |
category |
可选 |
URL参数列表 |
String |
设备分类,不支持字符串模糊匹配。可以通过“查询所有的设备类别信息列表”接口获取。 |
start |
可选 |
URL参数列表 |
int |
指定从哪个起始记录位置开始返回查询结果集。缺省值是0。 说明:
如果值小于0,将使用缺省值。 |
size |
可选 |
URL参数列表 |
int |
指定返回查询结果集总数。缺省值是20。 说明:
如果值小于0,将使用缺省值。 |
orderby |
可选 |
URL参数列表 |
String |
指定查询结果集采用的排序字段。缺省排序字段是netype。 可指定的排序字段包括:netype、vendorid、sysoid、category。 说明:
指定多个排序字段时字段间用英文半角逗号“,”分隔。 |
desc |
可选 |
URL参数列表 |
boolean |
指定查询结果是否按降序排序。缺省值是false。 说明:
此请求参数只有指定了“orderby”请求参数后才有效。 |
返回结果
字段名 |
类型 |
说明 |
---|---|---|
code |
int |
操作返回码。可以是如下值之一:
|
data |
List<InternalRtnNeTypeInfo> |
设备类型信息列表。 |
description |
String |
接口调用结果的描述信息。 |
InternalRtnNeTypeInfo对象包含以下字段:
字段名 |
类型 |
说明 |
---|---|---|
netype |
String |
设备类型。 |
vendorid |
String |
供应商ID。 |
sysoid |
String |
设备sysoid。 |
category |
String |
设备分类。 |
注意事项
无。
使用示例
package com.huawei.nms.openapi.demo.eam; import java.util.ArrayList; import java.util.List; import org.apache.http.HttpResponse; import org.apache.http.message.BasicNameValuePair; import com.huawei.nms.openapi.demo.global.GlobalVar; import com.huawei.nms.openapi.demo.global.NewHttpsAccess; import com.huawei.nms.openapi.demo.sm.Login; public class QueryNetype { /** * @param args */ public static void main(String[] args) { try { Login.login(); queryNeType(); } catch (Exception e) { System.out.println("login failed."); } } private static void queryNeType() { try { String url = "/rest/openapi/netype"; String method = "GET"; List<BasicNameValuePair> headers = new ArrayList<BasicNameValuePair>(); headers.add(new BasicNameValuePair("openid", GlobalVar.globalOpenid)); //set parameters final List<BasicNameValuePair> parameters = new ArrayList<BasicNameValuePair>(); parameters.add(new BasicNameValuePair("size", "200")); parameters.add(new BasicNameValuePair("start", "2")); //send the request final HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, url, method, headers, parameters); //get the result final String ret = NewHttpsAccess.getResult(response); System.out.println(ret); } catch (Exception e ) { System.out.println("query NE type failed"); } } }
执行结果如下:
{ "code": 0, "data": [ { "netype": "ICMP", "vendorid": "ICMP", "sysoid": "", "category": "enterprise.app.vendor.server|enterprise.app.series.microsoft" }, { "netype": "{Microsoft}MicrosoftWindowsDomainController", "vendorid": "Microsoft", "sysoid": "1.3.6.1.4.1.311.1.1.3.1.3", "category": "enterprise.app.vendor.server|enterprise.app.series.microsoft" }, { "netype": "{Microsoft}MicrosoftWindowsServer", "vendorid": "Microsoft", "sysoid": "1.3.6.1.4.1.311.1.1.3.1.2", "category": "enterprise.app.vendor.server|enterprise.app.series.microsoft" }, { "netype": "{Microsoft}MicrosoftWindowsWorkstation", "vendorid": "Microsoft", "sysoid": "1.3.6.1.4.1.311.1.1.3.1.1", "category": "enterprise.app.vendor.server|enterprise.app.series.microsoft" } ], "description": "Operation success." }
查询预定条件的设备信息列表
接口功能
查询预定条件的设备信息列表。
URI路径
/rest/openapi/nedevice
访问方法
GET
参数说明
参数名 |
必选/可选 |
参数位置 |
参数类型 |
参数说明 |
---|---|---|---|---|
openid |
必选 |
请求消息头 |
String |
会话标识,用于Open API的鉴权。 说明:
该参数由第三方调用安全管理的登录接口获取openid。 |
necategory |
可选 |
URL参数列表 |
String |
设备分类,不支持字符串模糊匹配。可以通过“查询所有的设备类别信息列表”接口获取。 |
netype |
可选 |
URL参数列表 |
String |
设备类型,不支持字符串模糊匹配。可以通过“查询预定条件的设备类型信息列表”接口获取。 |
neip |
可选 |
URL参数列表 |
String |
设备IP地址,不支持字符串模糊匹配。 |
nestate |
可选 |
URL参数列表 |
int |
网络设备状态。可以是如下值之一:
|
start |
可选 |
URL参数列表 |
int |
指定从哪个起始记录位置开始返回查询结果集。缺省值是0。 说明:
如果值小于0,将使用缺省值。 |
size |
可选 |
URL参数列表 |
int |
指定返回查询结果集总数。缺省值是20。 说明:
如果值小于0,将使用缺省值。 |
orderby |
可选 |
URL参数列表 |
String |
指定查询结果集采用的排序字段。缺省排序字段是nedn。 可指定的排序字段包括:nedn、nename、necategory、netype、neip、nesysoid、nestate。 说明:
指定多个排序字段时字段间用英文半角逗号“,”分隔。 |
desc |
可选 |
URL参数列表 |
boolean |
指定查询结果是否按降序排序。缺省值是false。 说明:
此请求参数只有指定了“orderby”请求参数后才有效。 |
返回结果
字段名 |
类型 |
说明 |
---|---|---|
code |
int |
操作返回码。可以是如下值之一:
|
data |
List<InternalRtnNodeInfo> |
设备信息列表。默认按升序排序。 |
description |
String |
接口调用结果的描述信息。 |
InternalRtnNodeInfo对象包含以下字段:
字段名 |
类型 |
说明 |
---|---|---|
nedn |
String |
设备DN。 |
nename |
String |
设备名称。 |
necategory |
String |
设备分类。 |
netype |
String |
设备类型。 |
nevendorname |
String |
设备供应商名称。 |
neip |
String |
设备IP地址(通过,分隔)。 |
nesysoid |
String |
设备sysoid。 |
nestate |
int |
设备状态。可以是如下值之一:
|
timezoneid |
String |
设备时区。 |
注意事项
无。
使用示例
package com.huawei.nms.openapi.demo.eam; import java.util.ArrayList; import java.util.List; import org.apache.http.HttpResponse; import org.apache.http.message.BasicNameValuePair; import com.huawei.nms.openapi.demo.global.GlobalVar; import com.huawei.nms.openapi.demo.global.NewHttpsAccess; import com.huawei.nms.openapi.demo.sm.Login; public class QueryNedevice { public static void main(String[] args) throws Exception { Login.login(); get(); } public static void get() throws Exception { //set the URL and method final String openidURL = "/rest/openapi/nedevice"; final String method = "GET"; List<BasicNameValuePair> headers = new ArrayList<BasicNameValuePair>(); headers.add(new BasicNameValuePair("openid", GlobalVar.globalOpenid)); //set parameters final List<BasicNameValuePair> parameters = new ArrayList<BasicNameValuePair>(); parameters.add(new BasicNameValuePair("orderby", "nename,nedn")); parameters.add(new BasicNameValuePair("size", "1")); parameters.add(new BasicNameValuePair("start", "0")); //send the request final HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters); //get the result final String ret = NewHttpsAccess.getResult(response); System.out.println(ret); } }
执行结果如下:
{ "code": 0, "data": [ { "nedn": "DN=TEST_ME_1372305062666", "nename": "node1", "necategory": null, "netype": "NE10TE", "nevendorname": "Huawei", "neip": "10.0.0.1", "nesysoid": "1.3.6.1.4.1.2011.2.35.5", "nestate": 2, "timezoneid": "" }, { "nedn": "DN=TEST_ME_1372305179318", "nename": "node11", "necategory": null, "netype": "NE10TE", "nevendorname": "Huawei", "neip": "10.0.1.1", "nesysoid": "1.3.6.1.4.1.2011.2.35.5", "nestate": 2, "timezoneid": "" }, { "nedn": "DN=TEST_ME_1372305214749", "nename": "node112", "necategory": null, "netype": "NE10TE", "nevendorname": "Huawei", "neip": "10.0.1.1", "nesysoid": "1.3.6.1.4.1.2011.2.35.5", "nestate": 2, "timezoneid": "" }, { "nedn": "OS=1", "nename": "LocalNMS", "necategory": null, "netype": "OMS", "nevendorname": "Huawei", "neip": "", "nesysoid": null, "nestate": 0, "timezoneid": null } ], "description": "Operation success." }
网络管理接口
本节介绍网络资源管理restful接口。
查询网络设备列表
接口功能
查询预定条件的网络设备信息列表。
URI路径
/rest/openapi/network/nedevice
访问方法
GET
参数说明
参数名 |
必选/可选 |
参数位置 |
参数类型 |
参数说明 |
---|---|---|---|---|
openid |
必选 |
请求消息头 |
String |
会话标识,用于Open API的鉴权。 说明:
该参数由第三方调用安全管理登录接口获取openid。 |
nedn |
可选 |
URL |
String |
设备DN |
neid |
可选 |
URL |
String |
设备ID |
aliasname |
可选 |
URL |
String |
网管名称 |
nename |
可选 |
URL |
String |
设备名称 |
necategory |
可选 |
URL |
String |
设备分类 |
netype |
可选 |
URL |
String |
设备类型 |
nevendorname |
可选 |
URL |
String |
设备厂商信息(设备厂商ID) |
neip |
可选 |
URL |
String |
设备IP地址 |
nemac |
可选 |
URL |
String |
设备MAC地址 |
version |
可选 |
URL |
String |
设备版本 |
nepatchversion |
可选 |
URL |
String |
补丁版本 |
nesysoid |
可选 |
URL |
String |
设备sysoid |
nestate |
可选 |
URL |
int |
网络设备状态,可以是如下值之一:
|
lastpolltime |
可选 |
URL |
String |
上次同步时间: eSight服务器本地时间。 格式:YYYY-MM-DD hh:mm:ss YYYY:年 MM:月 DD:日 hh:小时 mm:分钟 ss:秒 |
createtime |
可选 |
URL |
String |
设备创建时间: eSight服务器本地时间。 格式:YYYY-MM-DD hh:mm:ss YYYY:年 MM:月 DD:日 hh:小时 mm:分钟 ss:秒 |
timezoneid |
可选 |
URL |
String |
设备时区 |
neiptype |
可选 |
URL |
int |
ip地址类型,可以是如下值之一:
|
subnet |
可选 |
URL |
String |
所属子网 |
negroupname |
可选 |
URL |
String |
所属分组名称 |
neosversion |
可选 |
URL |
String |
软件版本 |
necontact |
可选 |
URL |
String |
设备联系人 |
neposition |
可选 |
URL |
String |
设备位置 |
memo |
可选 |
URL |
String |
设备备注 |
maintainunit |
可选 |
URL |
String |
维保单位 |
putintoactiontime |
可选 |
URL |
String |
投入使用时间: eSight服务器本地时间。 格式:YYYY-MM-DD YYYY:年 MM:月 DD:日 |
usefullife |
可选 |
URL |
String |
维保到期时间: eSight服务器本地时间。 格式:YYYY-MM-DD YYYY:年 MM:月 DD:日 |
neruntime |
可选 |
URL |
String |
设备启动时间: eSight服务器本地时间。 格式:YYYY-MM-DD hh:mm:ss YYYY:年 MM:月 DD:日 hh:小时 mm:分钟 ss:秒 |
nedescribe |
可选 |
URL |
String |
设备描述 |
assetManager |
可选 |
URL |
String |
资产管理人 |
assetNumber |
可选 |
URL |
String |
资产编号 |
assetDate |
可选 |
URL |
String |
购买日期: eSight服务器本地时间。 格式:YYYY-MM-DD YYYY:年 MM:月 DD:日 |
start |
可选 |
URL |
int |
指定从哪个起始记录位置开始返回查询结果集。缺省值是0。 说明:
|
size |
可选 |
URL |
int |
指定返回查询结果集总数。缺省值是20。 说明:
|
orderby |
可选 |
URL |
String |
指定查询结果集采用的排序字段。缺省排序字段是nedn。 可指定的排序字段包括:nedn、nename、necategory、netype、neip、nesysoid、nestate。 |
desc |
可选 |
URL |
boolean |
指定查询结果是否按降序排序。缺省值是false。 说明:
此请求参数只有指定了“orderby”请求参数后才有效。 |
fields |
可选 |
URL |
String |
指定查询结果所包含的列。需要查询的列名为fields参数的值,多个列名时可用英文逗号隔开。 说明:
此请求参数只有指定了“fields”请求参数后才有效,不指定默认返回所有字段。 |
请求示例
该接口参数较多,openid是必选参数,此处可选参数以nedn为例。 GET https://10.120.22.178:32102/rest/openapi/network/nedevice?nedn=NE=34603225 Headers: key = openid,value = 48bb9862ce7449ce0d2e0894e6001c76ee26060c420e4065
返回结果
字段名 |
类型 |
说明 |
---|---|---|
code |
int |
操作返回码。可以是如下值之一:
|
data |
List<NeDetailInfo> |
设备信息列表 |
description |
String |
接口调用结果的描述信息。 |
NeDetailInfo包含以下字段:
字段名 |
类型 |
说明 |
---|---|---|
nedn |
String |
设备DN |
neid |
String |
设备ID |
aliasname |
String |
网管名称 |
nename |
String |
设备名称 |
necategory |
String |
设备种类(类似路由器、交换机) |
netype |
String |
设备类型 |
nevendorname |
String |
设备厂商信息(设备厂商ID) |
neip |
String |
设备IP地址(通过,分隔) |
nemac |
String |
设备MAC地址 |
version |
String |
设备版本 |
nepatchversion |
String |
补丁版本 |
nesysoid |
String |
设备sysoid |
nestate |
int |
设备状态。可以是如下值之一:
|
lastpolltime |
String |
上次同步时间: eSight服务器本地时间。 格式:YYYY-MM-DD hh:mm:ss YYYY:年 MM:月 DD:日 hh:小时 mm:分钟 ss:秒 |
createtime |
String |
设备创建时间: eSight服务器本地时间。 格式:YYYY-MM-DD hh:mm:ss YYYY:年 MM:月 DD:日 hh:小时 mm:分钟 ss:秒 |
timezoneid |
String |
设备时区 |
neiptype |
int |
ip地址类型,可以是如下值之一:
|
NEIP2NUMBER |
int |
ip地址转换成后的数值 |
subnet |
String |
所属子网 |
negroupname |
String |
所属分组名称 |
neosversion |
String |
软件版本 |
necontact |
String |
设备联系人 |
neposition |
String |
设备位置 |
memo |
String |
设备备注 |
maintainunit |
String |
维保单位 |
putintoactiontime |
String |
投入使用时间: eSight服务器本地时间。 格式:YYYY-MM-DD YYYY:年 MM:月 DD:日 |
usefullife |
String |
维保到期时间: eSight服务器本地时间。 格式:YYYY-MM-DD YYYY:年 MM:月 DD:日 |
neruntime |
String |
设备启动时间: eSight服务器本地时间。 格式:YYYY-MM-DD hh:mm:ss YYYY:年 MM:月 DD:日 hh:小时 mm:分钟 ss:秒 |
nedescribe |
String |
设备描述 |
assetManager |
String |
资产管理人 |
assetNumber |
String |
资产编号 |
assetDate |
String |
购买日期: eSight服务器本地时间。 格式:YYYY-MM-DD YYYY:年 MM:月 DD:日 |
响应示例
{ "code": 0, "data": [ { "nedn": "NE=34603225", "neid": null, "aliasname": "S7706", "nename": "S7706", "necategory": "ne.category.switch", "netype": "S7703", "nevendorname": "Huawei", "neip": "10.136.252.19", "nemac": "78-1D-BA-52-BC-7F", "version": "S7703V200R010C00", "nepatchversion": null, "nesysoid": "1.3.6.1.4.1.2011.2.223.1", "nestate": "1", "lastpolltime": "1543164109307", "createtime": "1543158247357", "timezoneid": "Asia/Shanghai", "neiptype": "0", "NEIP2NUMBER": "176749587", "subnet": "/", "negroupname": "交换机", "neosversion": "VRP5.17 V200R010C00SPC600", "necontact": null, "neposition": "Beijing China", "memo": null, "maintainunit": null, "putintoactiontime": null, "usefullife": null, "neruntime": "1539075948553", "nedescribe": "Quidway S7703\r\nHuawei Versatile Routing Platform Software\r\nVRP (R) Software, Version 5.170 (S7700 V200R010C00SPC600)\r\nCopyright (c) 2000-2016 Huawei Technologies Co., Ltd\r\n", "assetManager": null, "assetNumber": null, "assetDate": null } ], "description": "Operation success." }
注意事项
无。
使用示例
package com.huawei.oms.ros.test; import org.apache.http.HttpResponse; import org.apache.http.message.BasicNameValuePair; import com.huawei.oms.ros.test.GlobalVar; import com.huawei.oms.ros.test.NewHttpsAccess; import com.huawei.oms.ros.test.NewRosSecurity; /** * Query Device Information based on Parameter Settings */ public class QueryNetworkDeviceList { private static final String EAM_NEDEVICE = "/rest/openapi/network/nedevice"; public static void main(String[] args) throws Exception { Login.login(); queryNeDeviceTest(); } public static void queryNeDeviceTest() throws Exception { //set the URL and method String openidURL = EAM_NEDEVICE; String method = "GET"; //set headers BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method); //set parameters BasicNameValuePair[] parameters = { new BasicNameValuePair("necategory", ""), new BasicNameValuePair("netype", ""), new BasicNameValuePair("nedn", "NE=34603011"), new BasicNameValuePair("createtime", ""), new BasicNameValuePair("nestate", ""), new BasicNameValuePair("start", ""), new BasicNameValuePair("size", ""), new BasicNameValuePair("orderby", ""), new BasicNameValuePair("desc", "") }; //send the request HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters); //get the result String body = NewHttpsAccess.getResult(response); System.out.println(body); } }
执行结果如下:
{ "code":0, "data":[ {"nedn":"NE=34603011", "neid":"", "aliasname":"CX600-X8-ASG-9", "nename":"CX600-X8-ASG-9", "necategory":"ne.category.unknown", "netype":"HuaweiDevice", "nevendorname":"Huawei", "neip":"10.137.61.9", "nemac":"00-25-9E-99-84-4B", "version":"", "nepatchversion":"", "nesysoid":"1.3.6.1.4.1.2011.2.87.18", "nestate":"1", "lastpolltime":"1414143600369" "createtime":"1414135951940", "timezoneid":"GMT+08:00", "neiptype":"0", "NEIP2NUMBER":"176766217" "subnet":"/", "negroupname":"Huawei", "neosversion":"VRP5.13 V600R007C00", "necontact":"R&D Beijing, Huawei Technologies co.,Ltd.", "neposition":"beijing China", "memo":"ceshi", "maintainunit":"huawei", "putintoactiontime":"1413388800000", "usefullife":"1476633600000", "neruntime":"1413374071667", "nedescribe":"Huawei Versatile Routing Platform Software\r\nVRP (R) software, Version 5.130 (CX600 V600R007C00)\r\nCopyright (C) 2000-2013 Huawei Technologies Co., Ltd.\r\nCX600-X8 \r\n", "assetManager":"shishi", "assetNumber":"cs123", "assetDate":"1413302400000" } ], "description":"Successful" }
添加或修改网络设备
接口功能
添加或修改网络设备。
- 增加设备:同一个ip和端口仅能添加一个设备。
- 修改设备:只能通过nedn修改设备名称。
URI路径
/rest/openapi/network/nedevice
访问方法
PUT
参数说明
参数名 |
必选/可选 |
参数位置 |
参数类型 |
参数说明 |
---|---|---|---|---|
openid |
必选 |
请求消息头 |
String |
会话标识,用于Open API的鉴权。 说明:
该参数由第三方调用安全管理登录接口获取openid。 |
neip |
必选 |
URL |
String |
设备ip地址。 说明:
同时支持IPv6方式添加。 |
snmpport |
可选 |
URL |
int |
SNMP协议端口。 说明:
默认为161。取值范围0-65535。使用SNMP参数添加设备时,该参数必须填写。 |
readcommunity |
可选 |
URL |
String |
读团体字。 说明:
区分大小写。以SNMPV2c协议方式添加必须填写该参数。 |
protocoltype |
可选 |
URL |
String |
协议类型。 说明:
默认值为“SNMP”,且仅提供SNMP协议。 |
retrytimes |
可选 |
URL |
int |
重试次数。 说明:
默认为5次,取值范围0-5。 大于5使用默认值5。 |
timeout |
可选 |
URL |
int |
超时时间。 说明:
默认为3,取值范围为1-60。输入值单位为秒(s)。大于60使用默认值3。 |
protocolVersion |
可选 |
URL |
String |
协议版本。 说明:
默认值为“V2c”,支持V2c 、V3协议,区分大小写。以SNMPV3协议方式添加必须设置protocolVersion=V3。 |
parentDn |
可选 |
URL |
String |
子网dn。 说明:
格式如"SN=34603287"。不填默认为“/”(即根路径),当且仅当添加时需要填写,修改时不能填写,区分大小写。该参数值如果无法获取,建议不填写该参数,填写参数subnet。该参数与subnet参数二选其一填写。在设备添加成功后,设备将自动归属该子网。 |
subnet |
可选 |
参数列表 |
String |
子网路径。 说明:
格式如"/China/Jiangsu/Nanjing…",不包含\"#%&'+;<=>?特殊字符。 在网管"资源->公共->资源分组->子网"功能中查看已有子网名称,根据名称填写该子网路径,不填写默认路径为“/”(即根路径),当且仅当添加时需要填写,修改时不能填写,区分大小写。该参数与parentDn参数只能二选其一填写。在设备添加成功后,设备将自动归属该子网路径。 |
writecommunity |
可选 |
URL |
String |
写团体字。 说明:
默认为空。 |
nename |
可选 |
URL |
String |
设备在eSight上显示的名称。 说明:
添加设备时若为空则自动从设备上获取。 |
nedn |
可选 |
URL |
String |
设备dn。 说明:
添加设备时分配的唯一标识(可以从数据库的nemgr.tbl_ne_info表中查询) 添加设备时不能填写,当且仅当修改设备时需要填写该参数,区分大小写。 |
securityName |
可选 |
URL |
String |
安全名。 说明:
区分大小写。以SNMPV3协议方式添加必须填写该参数。 |
context |
可选 |
URL |
String |
上下文名称。 说明:
默认为空。 |
authProtocol |
可选 |
URL |
String |
鉴权协议。 说明:
默认值为“HMAC_SHA”,SNMPV3协议采用的授权认证协议,支持HMAC_SHA和HMAC_MD5,区分大小写。 |
authKey |
可选 |
URL |
String |
鉴权密钥。 说明:
默认为空,SNMPV3协议用于鉴权的密码,区分大小写。 |
privProtocol |
可选 |
URL |
String |
私有协议。 说明:
默认值为“AES_128”,SNMPV3协议采用的数据加密协议,支持AES_128和CBC_DES,区分大小写。 |
privKey |
可选 |
URL |
String |
私有密钥。 说明:
默认为空,SNMPV3协议用于报文加密的密码,区分大小写。 |
请求示例
- 添加网络设备
该接口参数较多,openid、neip和snmpport为必选参数。此处可选参数以readcommunity为例。 PUT https://10.120.22.178:32102/rest/openapi/network/nedevice?neip=10.136.252.22&snmpport=161&readcommunity="public123" Headers: key = openid,value = c971939d611d7cbce24652358dc5fbd75b5dd9e4fef7474f
- 修改网络设备
该接口参数较多,openid、neip和snmpport为必选参数。此处可选参数以nedn和nename为例。 PUT https://10.120.22.178:32102/rest/openapi/network/nedevice?neip=10.136.252.22&snmpport=161&nename="test-openapi-name"&nedn=NE=34603309 Headers: key = openid,value = c971939d611d7cbce24652358dc5fbd75b5dd9e4fef7474f
返回结果
字段名 |
类型 |
说明 |
---|---|---|
code |
int |
错误码: 0:成功; 非0:不成功。 |
operateresult |
String |
错误描述。 |
neid |
String |
设备id,预留字段,恒为空。 |
nedn |
String |
设备dn。 |
data |
NULL |
设备信息列表,添加设备回显不需要。 |
neRosReturn |
Map<String, Integer> |
预留字段,无需关注。 |
响应示例
- 添加网络设备
{ "code": 0, "neid": null, "nedn": "NE=34603309", "operateresult": "Operation success.", "data": null, "neRosReturn": { "code": 0 } }
- 修改网络设备
{ "code": 0, "neid": null, "nedn": "NE=34603309", "operateresult": "the device is exist. And modify Operation success.", "data": null, "neRosReturn": { "code": 0 } }
注意事项
无。
使用示例(添加设备)
package com.huawei.oms.ros.test; import org.apache.http.HttpResponse; import org.apache.http.message.BasicNameValuePair; import com.huawei.oms.ros.test.GlobalVar; import com.huawei.oms.ros.test.NewHttpsAccess; import com.huawei.oms.ros.test.NewRosSecurity; /** * Add Device based on Parameter Settings */ public class AddDevice{ private static final String EAM_NEDEVICE = "/rest/openapi/network/nedevice"; public static void main(String[] args) throws Exception { Login.login(); addDeviceTest(); } public static void addDeviceTest() throws Exception { //set the URL and method String openidURL = EAM_NEDEVICE; String method = "PUT"; //set headers BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method); //set parameters BasicNameValuePair[] parameters = { new BasicNameValuePair("neip", "10.137.59.139"), new BasicNameValuePair("readcommunity", "public"), new BasicNameValuePair("writecommunity", "private"), new BasicNameValuePair("snmpport", "10004") , }; //send the request HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters); //get the result String body = NewHttpsAccess.getResult(response); System.out.println(body); } }
执行结果如下:
{ "code":0, "neid":"null", "nedn":"NE=34603609", "operateresult":"Operation success.", "data":null, "neRosReturn":{"code":0} }
使用示例(修改设备名称)
package com.huawei.oms.ros.test; import org.apache.http.HttpResponse; import org.apache.http.message.BasicNameValuePair; import com.huawei.oms.ros.test.GlobalVar; import com.huawei.oms.ros.test.NewHttpsAccess; import com.huawei.oms.ros.test.NewRosSecurity; /** * Add Device based on Parameter Settings */ public class ModifyDevice { private static final String EAM_NEDEVICE = "/rest/openapi/network/nedevice"; public static void main(String[] args) throws Exception { Login.login(); modifyDeviceTest(); } public static void modifyDeviceTest() throws Exception { //set the URL and method String openidURL = EAM_NEDEVICE; String method = "PUT"; //set headers BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method); //set parameters BasicNameValuePair[] parameters = { new BasicNameValuePair("nedn", "NE=34603609"), new BasicNameValuePair("neip", "10.137.59.139"), new BasicNameValuePair("nename", "fgfhhh"), }; //send the request HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters); //get the result String body = NewHttpsAccess.getResult(response); System.out.println(body); } }
执行结果如下:
{ "code":0, "neid":"null", "nedn":"NE=34603609", "operateresult":"the device is exist. And modify Operation success.", "data":null, "neRosReturn":{"code":0} }
删除网络设备
接口功能
删除网络设备。
URI路径
/rest/openapi/network/nedevice
访问方法
DELETE
参数说明
参数名 |
必选/可选 |
参数位置 |
参数类型 |
参数说明 |
---|---|---|---|---|
openid |
必选 |
请求消息头 |
String |
会话标识,用于Open API的鉴权。 说明:
该参数由第三方调用安全管理登录接口获取openid。 |
neid |
可选 |
URL |
String |
设备ID 说明:
第三方系统新增设备时带入的设备ID,和设备DN是映射关系,网管侧用nedn唯一标识一个设备,第三方用neid唯一标识一个设备 |
nedn |
可选 |
URL |
String |
设备DN 说明:
设备DN、设备ID必须有其中一个 |
请求示例
该接口必选参数为openid,此处可选参数以nedn为例。 DELETE https://10.120.22.178:32102/rest/openapi/network/nedevice?nedn=NE=34603309 Headers: key = openid,value = c971939d611d7cbce24652358dc5fbd75b5dd9e4fef7474f
返回结果
字段名 |
类型 |
说明 |
---|---|---|
code |
int |
操作返回码。可以是如下值之一:
|
neid |
String |
设备ID |
nedn |
String |
设备DN |
operateresult |
String |
操作结果 |
响应示例
{ "code": 0, "neid": "null", "nedn": "NE=34603309", "operateresult": "Operation success.", "data": null, "neRosReturn": { "code": 0 } }
注意事项
无。
使用示例
package com.huawei.oms.ros.test; import org.apache.http.HttpResponse; import org.apache.http.message.BasicNameValuePair; public class DeleteDevice { private static final String EAM_LINK = "/rest/openapi/network/nedevice"; public static void main(String[] args) throws Exception { Login.login(); delDevice(); } public static void delDevice() throws Exception { //set the URL and method String openidURL = EAM_LINK; String method = "DELETE"; //set headers BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method); //set parameters BasicNameValuePair[] parameters = { new BasicNameValuePair("nedn", "NE=34604609") }; //send the request HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters); //get the result String body = NewHttpsAccess.getResult(response); System.out.println(body); } }
执行结果如下:
{"code":0, "neid":"null", "nedn":"NE=34604927", "operateresult":"del Operation success."}
查询端口列表
接口功能
查询预订条件的端口信息。
URI路径
/rest/openapi/network/port
访问方法
GET
参数说明
参数名 |
必选/可选 |
参数位置 |
参数类型 |
参数说明 |
---|---|---|---|---|
openid |
必选 |
请求消息头 |
String |
会话标识,用于Open API的鉴权。 说明:
该参数由第三方调用安全管理登录接口获取openid。 |
neip |
可选 |
URL |
String |
设备IP地址,样例:10.137.240.83。 |
nename |
可选 |
URL |
String |
设备名称,样例:CE5855。 |
nedn |
可选 |
URL |
String |
设备DN,样例:NE=34604111。 |
portdn |
可选 |
URL |
String |
端口DN,样例:NE=34603916,FR=-1,S=1,SS=-1,PP=|1025|1|GigabitEthernet1/0/1。 |
framedn |
可选 |
URL |
String |
机框DN,样例:NE=34603916,FR=-1。 |
slotdn |
可选 |
URL |
String |
单板DN,样例:NE=34603916,FR=-1,S=1。 |
subslotdn |
可选 |
URL |
String |
子卡DN,样例:NE=34604111,FR=1,S=1,SS=1。 |
frameno |
可选 |
URL |
int |
机框序号,样例:1。 |
slotno |
可选 |
URL |
int |
单板序号,样例:5。 |
subslotno |
可选 |
URL |
int |
子卡序号,样例:5。 |
portindex |
可选 |
URL |
int |
端口索引,样例:167837696。 |
portno |
可选 |
URL |
int |
端口编号,样例:3。 |
descr |
可选 |
URL |
String |
端口描述,样例:Huawei, Quidway Series, GigabitEthernet0/0/0 Interface。 |
name |
可选 |
URL |
String |
端口名称,样例:GigabitEthernet0/0/0。 |
adminstatus |
可选 |
URL |
int |
接口管理状态,可以是如下值之一:
|
operstatus |
可选 |
URL |
int |
接口运行状态,可以是如下值之一:
|
ifindex |
可选 |
URL |
int |
接口索引,样例:167837697。 |
iftype |
可选 |
URL |
int |
端口类型,可以是如下值之一:
|
ipaddress |
可选 |
URL |
String |
端口IP地址,样例:10.0.3.1。 |
ifspeed |
可选 |
URL |
String |
端口速率(bps),样例:162529280。 |
start |
可选 |
URL |
int |
指定从哪个起始记录位置开始返回查询结果集。缺省值是0。 说明:
|
size |
可选 |
URL |
int |
指定返回查询结果集总数,支持1~5000条,缺省值是20。 说明:
如果值小于1或大于5000时,将使用缺省值。 |
orderby |
可选 |
URL |
String |
指定查询结果集采用的排序字段。缺省排序字段是nedn。 可指定的排序字段包括:nedn、nename、portdn,name(端口名) 说明:
|
desc |
可选 |
URL |
boolean |
指定查询结果是否按降序排序。缺省值是false。 说明:
此请求参数只有指定了“orderby”请求参数后才有效。 |
fields |
可选 |
URL |
String |
指定查询结果所包含的列。需要查询的列名为fields参数的值,多个列名时可用英文逗号隔开。 说明:
此请求参数只有指定了“fields”请求参数后才有效,不指定默认返回所有字段。 |
请求示例
该接口参数较多,openid为必选参数,此处可选参数以neip、framedn、slotdn和portdn为例。 GET https://10.120.22.178:32102/rest/openapi/network/port?neip=10.136.252.210&framedn=NE=34603009,FR=1&slotdn=NE=34603009,FR=1,S=1&portdn=NE=34603009,FR=1,S=1,SS=-1,PP=|1025|5|GE1/0/1 Headers: key = openid,value = c971939d611d7cbce24652358dc5fbd75b5dd9e4fef7474f
返回结果
字段名 |
类型 |
说明 |
---|---|---|
code |
int |
操作返回码。可以是如下值之一:
|
data |
List<PortResData> |
信息列表。 |
pageSize |
int |
从当前起始记录位置开始符合查询条件的记录页数。 |
totalSize |
int |
符合查询条件的记录总数。 |
description |
String |
接口调用结果的描述信息。 |
PortResData对象包含以下字段:
字段名 |
类型 |
说明 |
---|---|---|
neip |
String |
设备IP地址(通过,分隔)。 |
nename |
String |
设备名称。 |
nedn |
String |
设备dn。 |
portdn |
String |
端口dn。 |
framedn |
String |
机框dn。 |
slotdn |
String |
单板dn。 |
subslotdn |
String |
子卡dn。 |
frameno |
int |
机框序号。 |
slotno |
int |
单板序号。 |
subslotno |
int |
子卡序号。 |
portindex |
int |
端口索引。 |
portno |
int |
端口编号。 |
descr |
String |
端口描述。 |
name |
String |
端口名称。 |
adminstatus |
int |
管理状态。 |
operstatus |
int |
操作状态。 |
ifindex |
int |
接口索引。 |
iftype |
int |
端口类型。 |
ipaddress |
String |
端口IP地址。 |
ipnetmask |
String |
端口子网掩码。 |
ifspeed |
String |
端口速率(bps)。 |
响应示例
{ "code": 0, "data": [ { "neip": "10.136.252.210", "nename": "ce5810", "nedn": "NE=34603009", "framedn": "NE=34603009,FR=1", "slotdn": "NE=34603009,FR=1,S=1", "portdn": "NE=34603009,FR=1,S=1,SS=-1,PP=|1025|5|GE1/0/1", "subslotdn": "-1", "frameno": 1, "slotno": 1, "subslotno": -1, "portindex": 16847106, "portno": 5, "descr": "GE1/0/1", "name": "GE1/0/1", "adminstatus": 1, "operstatus": 2, "ifindex": 5, "iftype": 2, "ipaddress": null, "ipnetmask": null, "ifspeed": "1000000000" } ], "description": "Operation success.", "pageSize": 1, "totalSize": 1 }
注意事项
这里是端口port信息,是物理端口非接口。
使用示例
package com.huawei.oms.ros.test; import org.apache.http.HttpResponse; import org.apache.http.message.BasicNameValuePair; /** * Query All Device port */ public class QueryPortRes { private static final String EAM_CATEGORY = "/rest/openapi/network/port"; public static void main(final String[] args) throws Exception { Login.login(); queryNeCategoryTest(); } public static void queryNeCategoryTest() throws Exception { //set the URL and method final String openidURL = EAM_CATEGORY; final String method = "GET"; //set headers final BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method); //set parameters final BasicNameValuePair[] parameters = {new BasicNameValuePair("iftype", "2"), new BasicNameValuePair("nename", "S9312_61.36"), new BasicNameValuePair("name", "GigabitEthernet10/1/1"), new BasicNameValuePair("size", "100")}; //send the request final HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters); //get the result final String body = NewHttpsAccess.getResult(response); System.out.println(body); } }
执行结果如下:
{ "code":0, "data":[ { "neip":"10.137.61.36", "nename":"S9312_61.36", "nedn":"NE=34603642", "portdn":"NE=34603642,FR=1,S=10,SS=-1,PP=|1025|23|GigabitEthernet10/1/11", "framedn":"NE=34603642,FR=1", "slotdn":"NE=34603642,FR=1,S=10", "subslotdn":"-1", "frameno":1, "slotno":10, "subslotno":-1, "portindex":69862094, "portno":23, "descr":"HUAWEI, Quidway Series, GigabitEthernet10/1/11 Interface", "name":"GigabitEthernet10/1/11", "adminstatus":1, "operstatus":2, "ifindex":125, "iftype":2, "ipaddress":null, "ipnetmask":null, "ifspeed":"1000000000" }, { "neip":"10.137.61.36", "nename":"S9312_61.36", "nedn":"NE=34603642", "portdn":"NE=34603642,FR=1,S=10,SS=-1,PP=|1025|22|GigabitEthernet10/1/10", "framedn":"NE=34603642,FR=1", "slotdn":"NE=34603642,FR=1,S=10", "subslotdn":"-1", "frameno":1, "slotno":10, "subslotno":-1, "portindex":69862030, "portno":22, "descr":"HUAWEI, Quidway Series, GigabitEthernet10/1/10 Interface", "name":"GigabitEthernet10/1/10", "adminstatus":1, "operstatus":2, "ifindex":124, "iftype":2, "ipaddress":null, "ipnetmask":null, "ifspeed":"1000000000" }, { "neip":"10.137.61.36", "nename":"S9312_61.36", "nedn":"NE=34603642", "portdn":"NE=34603642,FR=1,S=10,SS=-1,PP=|1025|13|GigabitEthernet10/1/1", "framedn":"NE=34603642,FR=1", "slotdn":"NE=34603642,FR=1,S=10", "subslotdn":"-1", "frameno":1, "slotno":10, "subslotno":-1, "portindex":69861454, "portno":13, "descr":"HUAWEI, Quidway Series, GigabitEthernet10/1/1 Interface", "name":"GigabitEthernet10/1/1", "adminstatus":1, "operstatus":2, "ifindex":115, "iftype":2, "ipaddress":null, "ipnetmask":null, "ifspeed":"1000000000" } ], "description":"Operation success.", "pageSize": 1, "totalSize": 3 }
查询光口列表
接口功能
查询预订条件的光口信息。
URI路径
/rest/openapi/network/otpoint
访问方法
GET
参数说明
参数名 |
必选/可选 |
参数位置 |
参数类型 |
参数说明 |
---|---|---|---|---|
openid |
必选 |
请求消息头 |
String |
会话标识,用于Open API的鉴权。 说明:
该参数由第三方调用安全管理登录接口获取openid。 |
nedn |
可选 |
参数列表 |
String |
设备DN,样例:NE=34604111。 |
start |
可选 |
参数列表 |
int |
指定从哪个起始记录位置开始返回查询结果集。缺省值是0。 说明:
如果值小于0,将使用缺省值。 |
size |
可选 |
参数列表 |
int |
指定返回查询结果集总数,支持1~10000条,缺省值是20。 说明:
如果值小于1或大于10000时,将使用缺省值。 |
fields |
可选 |
参数列表 |
String |
指定查询结果所包含的列。需要查询的列名为fields参数的值,多个列名时可用英文逗号隔开。 说明:
此请求参数只有指定了“fields”请求参数后才有效,不指定默认返回所有字段。 |
返回结果
字段名 |
类型 |
说明 |
---|---|---|
code |
int |
操作返回码。可以是如下值之一:
|
data |
List<OTPointResData> |
信息列表。 |
pageSize |
int |
符合查询条件的记录总页数。 |
totalSize |
int |
符合查询条件的记录总数。 |
description |
String |
接口调用结果的描述信息。 |
OTPointResData对象包含以下字段:
字段名 |
类型 |
说明 |
---|---|---|
name |
String |
光口名称。 |
adminstatus |
String |
管理状态。 |
operstatus |
String |
操作状态。 |
ipaddress |
String |
光口IP地址。 |
ipnetmask |
String |
光口子网掩码 |
portindex |
String |
光口索引。 |
注意事项
这里是光口信息,是物理端口非接口。
使用示例
package com.huawei.oms.ros.test; import org.apache.http.HttpResponse; import org.apache.http.message.BasicNameValuePair; /** * Query All Device port */ public class QueryPortRes { private static final String EAM_CATEGORY = "/rest/openapi/network/otpoint"; public static void main(final String[] args) throws Exception { Login.login(); queryNeCategoryTest(); } public static void queryNeCategoryTest() throws Exception { //set the URL and method final String openidURL = EAM_CATEGORY; final String method = "GET"; //set headers final BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method); //set parameters final BasicNameValuePair[] parameters = {new BasicNameValuePair("nedn", "NE=32540127")}; //send the request final HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters); //get the result final String body = NewHttpsAccess.getResult(response); System.out.println(body); } }
执行结果如下:
{ "code":0, "data":[ { "portindex":69862094, "name":"GigabitEthernet10/1/11", "adminstatus":"1", "operstatus":"2", "ipaddress":null, "ipnetmask":null }, { "portindex":69862030, "name":"GigabitEthernet10/1/10", "adminstatus":"1", "operstatus":"2", "ipaddress":null, "ipnetmask":null }, { "portindex":69861454, "name":"GigabitEthernet10/1/1", "adminstatus":"1", "operstatus":"2", "ipaddress":null, "ipnetmask":null } ], "description":"Operation success.", "pageSize": 1, "totalSize": 3 }
查询单板列表
接口功能
查询预订条件的单板信息列表。
URI路径
/rest/openapi/network/slot
访问方法
GET
参数说明
参数名 |
必选/可选 |
参数位置 |
参数类型 |
参数说明 |
---|---|---|---|---|
openid |
必选 |
请求消息头 |
String |
会话标识,用于Open API的鉴权。 说明:
该参数由第三方调用安全管理登录接口获取openid。 |
nedn |
可选 |
URL |
String |
设备DN,样例:NE=34604111。 |
nename |
可选 |
URL |
String |
设备名称,样例:CE5855。 |
framedn |
可选 |
URL |
String |
机框DN,样例:NE=34603916,FR=-1。 |
framename |
可选 |
URL |
String |
机框名称,样例:AR1220V。 |
frameno |
可选 |
URL |
int |
机框序号,样例:1。 |
slotdn |
可选 |
URL |
String |
单板Dn,样例NE=34603916,FR=-1,S=1。 |
slotindex |
可选 |
URL |
int |
单板索引,样例:151060480。 |
slotno |
可选 |
URL |
int |
单板序号,样例:12。 |
vendortype |
可选 |
URL |
String |
厂商类型,样例:.1.3.6.1.4.1.2011.20021210.12.3797。 |
descr |
可选 |
URL |
String |
单板描述,样例:NE20E 8GE-F Card。 |
slotname |
可选 |
URL |
String |
单板名称,样例:8GE-F。 |
physicalclass |
可选 |
URL |
int |
设备上实体大类型
|
adminstatus |
可选 |
URL |
int |
管理状态
|
operstatus |
可选 |
URL |
int |
操作状态
其他:未知 |
standbystatus |
可选 |
URL |
int |
主备状态
|
hardversion |
可选 |
URL |
String |
硬件版本,样例:VER.A。 |
firmversion |
可选 |
URL |
String |
固件版本,样例:109 Hex: 31 30 39 。 |
softversion |
可选 |
URL |
String |
软件版本,样例:Version 8.100 V100R005C10。 |
serialnum |
可选 |
URL |
String |
序列号,样例:210231A69UH09400。 |
mfgname |
可选 |
URL |
String |
组件名称,样例:Huawei。 |
modelname |
可选 |
URL |
String |
模块名称,样例:huawei。 |
alarmlight |
可选 |
URL |
String |
预留字段,当前无意义。 |
start |
可选 |
URL |
int |
指定从哪个起始记录位置开始返回查询结果集。缺省值是0。 说明:
|
size |
可选 |
URL |
int |
指定返回查询结果集总数。缺省值是20。 说明:
1、如果值小于0,将使用缺省值。 2、数据的size,最大建议10000条。 |
orderby |
可选 |
URL |
string |
指定查询结果集采用的排序字段。缺省排序字段是nedn。 可指定的排序字段包括:nedn、nename、framedn、framename、slotdn 说明:
|
desc |
可选 |
URL |
boolean |
指定查询结果是否按降序排序。缺省值是false。 说明:
此请求参数只有指定了“orderby”请求参数后才有效。 |
fields |
可选 |
URL |
string |
指定查询结果所包含的列。需要查询的列名为fields参数的值,多个列名时可用英文逗号隔开。 说明:
此请求参数只有指定了“fields”请求参数后才有效,不指定默认返回所有字段。 |
请求示例
该接口参数较多,openid为必选参数,此处可选参数以neip、framedn为例。 GET https://10.120.22.178:32102/rest/openapi/network/slot?neip=10.136.252.210&framedn=NE=34603009,FR=1 Headers: key = openid,value = c971939d611d7cbce24652358dc5fbd75b5dd9e4fef7474f
返回结果
字段名 |
类型 |
说明 |
---|---|---|
code |
int |
操作返回码。可以是如下值之一:
|
data |
List<SlotResData> |
信息列表。 |
description |
String |
接口调用结果的描述信息。 |
SlotResData对象包含以下字段:
字段名 |
类型 |
说明 |
---|---|---|
nedn |
String |
设备dn。 |
neName |
String |
设备名称。 |
framedn |
String |
机框dn。 |
framename |
String |
机框名称。 |
frameno |
int |
机框序号。 |
slotdn |
String |
单板dn。 |
slotindex |
int |
单板索引。 |
slotno |
int |
单板序号。 |
vendortype |
String |
厂商类型。 |
descr |
String |
单板描述。 |
slotname |
String |
单板名称。 |
physicalclass |
int |
设备上实体大类型
|
adminstatus |
int |
管理状态
|
operstatus |
int |
操作状态
其他:未知 |
standbystatus |
int |
主备状态
|
hardversion |
String |
硬件版本。 |
firmversion |
String |
固件版本。 |
softversion |
String |
软件版本。 |
serialnum |
String |
序列号。 |
mfgname |
String |
组件名称。 |
modelname |
String |
模块名称。 |
alarmlight |
String |
预留字段,当前无意义。 |
响应示例
{ "code": 0, "data": [ { "nedn": "NE=34603009", "framedn": "NE=34603009,FR=1", "framename": "virtual frame ", "frameno": 1, "slotdn": "NE=34603009,FR=1,S=1", "slotindex": 16842753, "slotno": 1, "vendortype": ".1.3.6.1.4.1.2011.20021210.12.688165", "descr": "Basic Configuration,CloudEngine 5800,CE5810-EI-B00,CE5810-48T4S-EI Switch(2*150W AC Power Module,2*FAN Box,Port side exhaust)", "slotname": "CE5810-48T4S-EI 1", "physicalclass": 9, "adminstatus": 4, "operstatus": 3, "firmversion": "312", "softversion": "Version 8.100 V100R005C10SPC200", "standbystatus": 4, "hardversion": "CEM48T4SP01 VER A", "modelname": "--", "alarmlight": null, "serialnum": "210235908110G8000035", "mfgname": "Huawei", "neName": "ce5810" } ], "description": "Operation success." }
注意事项
无。
使用示例
package com.huawei.oms.ros.test; import org.apache.http.HttpResponse; import org.apache.http.message.BasicNameValuePair; /** * Query Device Types based on Parameter Settings */ public class QuerySlot { private static final String EAM_TYPE = "/rest/openapi/network/slot"; public static void main(String[] args) throws Exception { Login.login(); queryNeTypeTest(); } public static void queryNeTypeTest() throws Exception { //set the URL and method String openidURL = EAM_TYPE; String method = "GET"; //set headers BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method); //set parameters BasicNameValuePair[] parameters = {new BasicNameValuePair("nedn", "NE=34603009"), new BasicNameValuePair("fields", "nedn,nename")}; //send the request HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters); //get the result String body = NewHttpsAccess.getResult(response); System.out.println(body); } }
执行结果如下:
{"code":0,"data":[{"nedn":"NE=34603009","neName":"ac6605d"}],"description":"Operation success."}
查询子卡列表
接口功能
查询预订条件的子卡信息列表。
URI路径
/rest/openapi/network/subslot
访问方法
GET
参数说明
参数名 |
必选/可选 |
参数位置 |
参数类型 |
参数说明 |
---|---|---|---|---|
openid |
必选 |
请求消息头 |
String |
会话标识,用于Open API的鉴权。 说明:
该参数由第三方调用安全管理登录接口获取openid。 |
nedn |
可选 |
URL |
String |
设备Dn,样例:NE=34603918。 |
nename |
可选 |
URL |
String |
设备名称,样例:CE68。 |
framedn |
可选 |
URL |
String |
机框Dn,样例:NE=34603918,FR=-1。 |
slotdn |
可选 |
URL |
String |
单板Dn,样例:NE=34603918,FR=-1,S=0。 |
slotname |
可选 |
URL |
String |
单板名称,样例:board 0。 |
subslotdn |
可选 |
URL |
String |
子卡Dn,样例:NE=34603916,FR=-1,S=5,SS=5。 |
frameno |
可选 |
URL |
int |
机框序号,样例:1。 |
slotno |
可选 |
URL |
int |
单板序号,样例:2。 |
subslotindex |
可选 |
URL |
int |
子卡索引,样例:201457920。 |
subslotno |
可选 |
URL |
int |
子卡序号,样例:5。 |
descr |
可选 |
URL |
String |
子卡描述,样例:NE20E CompactFlash Cfcard。 |
subslotname |
可选 |
URL |
String |
子卡名称,样例:subcard 2/1。 |
vendortype |
可选 |
URL |
String |
厂商类型,样例:.1.3.6.1.4.1.2011.10.3.1.9.4.38。 |
physicalclass |
可选 |
URL |
int |
设备上实体大类型
|
hardversion |
可选 |
URL |
String |
硬件版本,样例:VER.0。 |
firmversion |
可选 |
URL |
String |
固件版本,样例:Hex: 31 30 39 。 |
softversion |
可选 |
URL |
String |
软件版本,样例:0。 |
adminstatus |
可选 |
URL |
int |
管理状态
|
operstatus |
可选 |
URL |
int |
操作状态
其他:未知 |
modelname |
可选 |
URL |
String |
模块名称,样例:huawei。 |
serialnum |
可选 |
URL |
String |
序列号,样例:030KSB10B3000060。 |
mfgname |
可选 |
URL |
String |
组件名称,物理固件的制造厂商,样例:Huawei。 |
start |
可选 |
URL |
int |
指定从哪个起始记录位置开始返回查询结果集。缺省值是0。 说明:
|
size |
可选 |
URL |
int |
指定返回查询结果集总数。缺省值是20。 说明:
1、如果值小于0,将使用缺省值。 2、数据的size,最大建议10000条。 |
orderby |
可选 |
URL |
string |
指定查询结果集采用的排序字段。缺省排序字段是nedn。 可指定的排序字段包括:nedn、nename、framedn、slotdn、slotname 说明:
|
desc |
可选 |
URL |
boolean |
指定查询结果是否按降序排序。缺省值是false。 说明:
此请求参数只有指定了“orderby”请求参数后才有效。 |
请求示例
该接口参数较多,openid为必选参数,此处可选参数以neip、framedn、subslotindex和subslotname为例。 GET https://10.120.22.178:32102/rest/openapi/network/subslot?neip=10.136.252.210&framedn=NE=34603009,FR=1&subslotindex=16847360&subslotname=FAN 1/1 Headers: key = openid,value = c971939d611d7cbce24652358dc5fbd75b5dd9e4fef7474f
返回结果
字段名 |
类型 |
说明 |
---|---|---|
code |
int |
操作返回码。可以是如下值之一:
|
data |
List<SubSlotResData> |
信息列表。 |
description |
String |
接口调用结果的描述信息。 |
SubSlotResData对象包含以下字段:
字段名 |
类型 |
说明 |
---|---|---|
nedn |
String |
设备dn。 |
neName |
String |
设备名称。 |
framedn |
String |
机框dn。 |
slotdn |
String |
单板dn。 |
slotname |
String |
单板名称。 |
subslotdn |
String |
子卡dn。 |
frameno |
int |
机框序号。 |
slotno |
int |
单板序号。 |
subslotindex |
int |
子卡索引。 |
subslotno |
int |
子卡序号。 |
descr |
String |
子卡描述。 |
subslotname |
String |
子卡名称。 |
vendortype |
String |
厂商类型。 |
physicalclass |
int |
设备上实体大类型
|
hardversion |
String |
硬件版本 |
firmversion |
String |
firm版本 |
softversion |
String |
软件版本 |
adminstatus |
int |
管理状态
|
operstatus |
int |
操作状态
其他:未知 |
modelname |
String |
模块名称。 |
serialnum |
String |
序列号。 |
mfgname |
String |
组件名称,物理固件的制造厂商。 |
响应示例
{ "code": 0, "data": [ { "nedn": "NE=34603009", "framedn": "NE=34603009,FR=1", "slotdn": "NE=34603009,FR=1,S=1", "slotname": "CE5810-48T4S-EI 1", "subslotdn": "NE=34603009,FR=1,S=1,SS=1", "frameno": 1, "slotno": 1, "subslotindex": 16847360, "subslotno": 1, "descr": "Assembling Components,Fan box(SB,Front to Back,FAN panel side intake),FAN-40SB-F,Fan box(SB,Front to Back,FAN panel side intake)", "subslotname": "FAN 1/1", "vendortype": ".1.3.6.1.4.1.2011.20021210.13.688128", "physicalclass": 7, "hardversion": null, "firmversion": null, "softversion": null, "adminstatus": 4, "operstatus": 3, "modelname": "--", "serialnum": "21023561536TG5000059", "mfgname": "Huawei", "neName": "ce5810" } ], "description": "Operation success." }
注意事项
无。
使用示例
package com.huawei.oms.ros.test; import org.apache.http.HttpResponse; import org.apache.http.message.BasicNameValuePair; /** * Query Device Types based on Parameter Settings */ public class QuerySubSlot { private static final String EAM_TYPE = "/rest/openapi/network/subslot"; public static void main(String[] args) throws Exception { Login.login(); queryNeTypeTest(); } public static void queryNeTypeTest() throws Exception { //set the URL and method String openidURL = EAM_TYPE; String method = "GET"; //set headers BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method); //set parameters BasicNameValuePair[] parameters = {new BasicNameValuePair("nedn", "NE=34603033")}; //send the request HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters); //get the result String body = NewHttpsAccess.getResult(response); System.out.println(body); } }
执行结果如下:
{"code":0,"data":[{"neName":"CX600-8-RSG-5","nedn":"NE=34603033","framedn":"NE=34603033,FR=1","slotdn":"NE=34603033,FR=1,S=7","slotname":null,"subslotdn":"NE=34603033,FR=1,S=7,SS=0","frameno":1,"slotno":7,"subslotindex":17236224,"subslotno":0,"vendortype":".1.3.6.1.4.1.2011.20021210.13.561155","descr":"--","physicalclass":9,"adminstatus":4,"operstatus":2,"hardversion":"CR52EAGF REV A","firmversion":"PIC0 EPLD ver 004","softversion":"","serialnum":"","modelname":"--","mfgname":"Huawei"}],"description":"Operation success"}
查询链路列表
接口功能
查询预定条件的链路信息列表。
URI路径
/rest/openapi/network/link
访问方法
GET
参数说明
参数名 |
必选/可选 |
参数位置 |
参数类型 |
参数说明 |
---|---|---|---|---|
openid |
必选 |
请求消息头 |
String |
会话标识,用于Open API的鉴权。 说明:
该参数由第三方调用安全管理登录接口获取openid。 |
anedn |
可选 |
URL |
String |
源网元DN |
anename |
可选 |
URL |
String |
源网元名称 |
aneip |
可选 |
URL |
String |
源网元IP |
anestate |
可选 |
URL |
int |
源网元状态(取值:0:未管理;1:在线;2:离线;3:未知) |
aportdn |
可选 |
URL |
String |
源端口DN |
aportname |
可选 |
URL |
String |
源端口名称 |
aportip |
可选 |
URL |
String |
源端口IP |
aportadminstatus |
可选 |
URL |
int |
源端口管理状态(取值:1:up;2:down;3:testing) |
aportoperstatus |
可选 |
URL |
int |
源端口运行状态(取值:1:up;2:down;3:testing;4:unknown;5:dormant;6:notPresent;7:lowerLayerDown) |
znedn |
可选 |
URL |
String |
宿网元DN |
znename |
可选 |
URL |
String |
宿网元名称 |
zneip |
可选 |
URL |
String |
宿网元IP |
znestate |
可选 |
URL |
int |
宿网元状态(取值:0:未管理;1:在线;2:离线;3:未知) |
zportdn |
可选 |
URL |
String |
宿端口DN |
zportname |
可选 |
URL |
String |
宿端口名称 |
zportip |
可选 |
URL |
String |
宿端口IP |
zportadminstatus |
可选 |
URL |
int |
宿端口管理状态(取值:1:up;2:down;3:testing) |
zportoperstatus |
可选 |
URL |
int |
宿端口运行状态(取值:1:up;2:down;3:testing;4:unknown;5:dormant;6:notPresent;7:lowerLayerDown) |
linkdn |
可选 |
URL |
String |
链路DN |
linkname |
可选 |
URL |
String |
链路名称 |
linkstatus |
可选 |
URL |
int |
链路状态(取值:0:正常;1:未知;2:重要故障;3:紧急故障;4:离线;5:不管理;) |
linktype |
可选 |
URL |
int |
链路类型(取值:1:LLDP;2:Side-By-Side;3:MACARP;4:CDP;5:IP;6:由物理链路生成Eth-Trunk链路;99:手工) |
speed |
可选 |
URL |
String |
单位:Mbit/s |
start |
可选 |
URL |
int |
指定从哪个起始记录位置开始返回查询结果集。缺省值是0。 说明:
|
size |
可选 |
URL |
int |
指定返回查询结果集总数,支持1~1000条,缺省值是20。 说明:
如果值小于0或大于1000,将使用缺省值。 |
orderby |
可选 |
URL |
String |
指定查询结果集采用的排序字段。缺省排序字段是linkdn。可指定的排序字段包括:linkdn,linkname,anedn,anename, aportdn,aportname,znedn,znename, zportdn,zportname,linktype,speed。指定多个排序字段时字段间用英文半角逗号“,”分隔。 |
desc |
可选 |
URL |
boolean |
指定查询结果是否按降序排序。缺省值是false。此请求参数只有指定了“orderby”请求参数后才有效。 |
请求示例
该接口参数较多,openid为必选参数,此处可选参数以aneip为例。 GET https://10.120.22.178:32102/rest/openapi/network/link?aneip=10.136.252.19 Headers: key = openid,value = c971939d611d7cbce24652358dc5fbd75b5dd9e4fef7474f
返回结果
字段名 |
类型 |
说明 |
---|---|---|
code |
int |
操作返回码。可以是如下值之一:
|
data |
List<LinkDataModel> |
信息列表。 |
description |
String |
接口调用结果的描述信息。 |
LinkDataModel对象包含以下字段:
字段名 |
类型 |
说明 |
---|---|---|
linkdn |
String |
链路DN |
linkname |
String |
链路名称 |
anedn |
String |
源网元DN |
anename |
String |
源网元名称 |
aneip |
String |
源网元IP |
anestate |
int |
源网元状态 |
aportdn |
String |
源端口DN |
aportname |
String |
源端口名称 |
aportip |
String |
源端口IP |
aportadminstatus |
int |
源端口管理状态 |
aportoperstatus |
int |
源端口运行状态 |
znedn |
String |
宿网元DN |
znename |
String |
宿网元名称 |
zneip |
String |
宿网元IP |
znestate |
int |
宿网元状态 |
zportdn |
String |
宿端口DN |
zportname |
String |
宿端口名称 |
zportip |
String |
宿端口IP |
zportadminstatus |
int |
宿端口管理状态 |
zportoperstatus |
int |
宿端口运行状态 |
linkstatus |
int |
链路状态 |
linktype |
int |
链路类型 |
speed |
String |
带宽 |
响应示例
{ "code": 0, "data": [ { "anedn": "NE=34603225", "anename": "S7706", "aneip": "10.136.252.19", "anestate": 1, "aportdn": "NE=34603225_1170", "aportname": "GigabitEthernet1/0/1", "aportip": "", "aportadminstatus": 1, "aportoperstatus": 2, "znedn": "NE=34603009", "znename": "ce5810", "zneip": "10.136.252.210", "znestate": 1, "zportdn": "NE=34603009_28", "zportname": "GE1/0/24", "zportip": "", "zportadminstatus": 1, "zportoperstatus": 2, "linkdn": "5_-1298870390198018597339391089014153", "linkname": "sdss", "linkstatus": 3, "linktype": 99, "speed": 1000 } ], "description": "Operation success." }
注意事项
无。
使用示例
package com.huawei.oms.ros.test; import org.apache.http.HttpResponse; import org.apache.http.message.BasicNameValuePair; public class QueryLink { private static final String EAM_LINK = "/rest/openapi/network/link"; public static void main(String[] args) throws Exception { Login.login(); queryLinkList(); } public static void queryLinkList() throws Exception { //set the URL and method String openidURL = EAM_LINK; String method = "GET"; //set headers BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method); //set parameters BasicNameValuePair[] parameters = { new BasicNameValuePair("anedn", "NE=34604991") }; HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters); String body = NewHttpsAccess.getResult(response); System.out.println(body); } }
执行结果如下:
"code":0, "data":[ {"linkDn":"2_-129879503991-15331110521068312132", "linkName":"S5352C-EI-154_GigabitEthernet0/0/2_S3352-98_Ethernet0/0/1", "aneDn":"NE=34604991", "aneName":"S5352C-EI-154", "aneIp":"10.137.240.154", "aneState":1, "aportDn":"NE=34604991_9", "aportIp":"", "aportName":"GigabitEthernet0/0/2", "aportOperStatus":1, "aportAdminStatus":1, "zneDn":"NE=34604963", "zneName":"S3352-98", "zneIp":"10.137.240.98", "zneState":1, "zportDn":"NE=34604963_514", "zportName":"Ethernet0/0/1", "zportIp":"", "zportAdminStatus":1, "zportOperStatus":1, "linkStatus":0, "linkType":1, "speed":100,}], "description":"Successful"}
查询机框信息
接口功能
查询预订条件的机框信息列表。
URI路径
/rest/openapi/network/frame
访问方法
GET
参数说明
参数名 |
必选/可选 |
参数位置 |
参数类型 |
参数说明 |
---|---|---|---|---|
openid |
必选 |
请求消息头 |
String |
会话标识,用于Open API的鉴权。 说明:
该参数由第三方调用安全管理登录接口获取openid。 |
nedn |
可选 |
URL |
String |
设备dn,样例:NE=34603916。 |
nename |
可选 |
URL |
String |
网元名称,样例:Ce68。 |
framedn |
可选 |
URL |
String |
机框Dn,样例:NE=34603916,FR=-1。 |
shelfindex |
可选 |
URL |
int |
机架索引设备上有的,所有资源的根索引,样例:-1。 |
frameindex |
可选 |
URL |
int |
机框索引,样例:51445760。 |
frameno |
可选 |
URL |
int |
机框序号,样例:1。 |
vendortype |
可选 |
URL |
String |
厂商类型,样例:.1.3.6.1.4.1.25506.1.148。 |
mfgname |
可选 |
URL |
String |
物理固件的制造厂商,样例:Huawei。 |
serialnum |
可选 |
URL |
String |
序列号,样例:628512。 |
physicalclass |
可选 |
URL |
int |
设备上实体大类型
|
descr |
可选 |
URL |
String |
机框描述,样例:Quidway NE20E Router。 |
framename |
可选 |
URL |
String |
机框名称,样例:Quidway NE20E Router。 |
adminstatus |
可选 |
URL |
int |
管理状态,可以是如下值之一:
|
operstatus |
可选 |
URL |
int |
操作状态,可以是如下值之一:
|
standbystatus |
可选 |
URL |
int |
主备状态
|
softversion |
可选 |
URL |
String |
软件版本 |
start |
可选 |
URL |
int |
指定从哪个起始记录位置开始返回查询结果集。缺省值是0。 说明:
|
size |
可选 |
URL |
int |
指定返回查询结果集总数,支持1~100条,缺省值是20。 说明:
如果值小于1或大于100时,将使用缺省值。 |
orderby |
可选 |
URL |
String |
指定查询结果集采用的排序字段。缺省排序字段是nedn。 可指定的排序字段包括:nedn、nename、framedn、framename(机框名称)。 说明:
使用“start”和“size”参数进行分页查询时,必须指定“orderby”参数为“framedn” |
desc |
可选 |
URL |
boolean |
指定查询结果是否按降序排序。缺省值是false。 说明 此请求参数只有指定了“orderby”请求参数后才有效。 |
请求示例
该接口参数较多,openid为必选参数,此处可选参数以framedn为例。 GET https://10.120.22.178:32102/rest/openapi/network/frame?framedn=NE=34603009,FR=1 Headers: key = openid,value = c971939d611d7cbce24652358dc5fbd75b5dd9e4fef7474f
返回结果
字段名 |
类型 |
说明 |
---|---|---|
code |
int |
操作返回码。可以是如下值之一:
|
data |
List<FrameModelForRest> |
信息列表。 |
description |
String |
接口调用结果的描述信息。 |
FrameModelForRest对象包含以下字段:
字段名 |
类型 |
说明 |
---|---|---|
neDN |
String |
设备dn。 |
neName |
String |
网元名称。 |
frameDN |
String |
机框dn。 |
shelfIndex |
int |
机架索引设备上有的,所有资源的根索引。 |
frameIndex |
int |
机框索引。 |
frameNo |
int |
机框序号。 |
vendorType |
String |
厂商类型。 |
mfgName |
String |
物理固件的制造厂商。 |
serialNum |
String |
序列号。 |
physicalClass |
int |
设备上实体大类型
|
descr |
String |
机框描述。 |
frameName |
String |
机框名称。 |
adminStatus |
int |
管理状态,可以是如下值之一:
|
operStatus |
int |
操作状态,可以是如下值之一:
|
standBystatus |
int |
主备状态
|
softVersion |
String |
软件版本。 |
响应示例
{ "code": 0, "data": [ { "neDN": "NE=34603009", "neName": "ce5810", "frameDN": "NE=34603009,FR=1", "shelfIndex": -1, "frameIndex": 16777216, "frameNo": 1, "vendorType": ".1.3.6.1.4.1.2011.20021210.11.688135", "mfgName": null, "serialNum": null, "physicalClass": 3, "descr": "virtual frame ", "frameName": "virtual frame ", "adminStatus": 4, "operStatus": 3, "standBystatus": 4, "softVersion": null } ], "description": "Operation success." }
注意事项
无。
使用示例
package com.huawei.oms.ros.test; import org.apache.http.HttpResponse; import org.apache.http.message.BasicNameValuePair; public class QueryFrameInfo { private static final String EAM_FRAME = "/rest/openapi/network/frame"; public static void main(String[] args) throws Exception { Login.login(); queryFrameInfo(); } public static void queryFrameInfo() throws Exception { //set the URL and method String openidURL = EAM_FRAME; String method = "GET"; //set headers BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method); //set parameters BasicNameValuePair[] parameters = { new BasicNameValuePair("nedn", "NE=34603015") }; HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters); String body = NewHttpsAccess.getResult(response); System.out.println(body); } }
执行结果如下:
{"code":0, "data": [{"frameDN":"NE=34603015,FR=1", "frameNo":1, "frameName":"Quidway S9303 frame", "operStatus":3, "adminStatus":4, "softVersion":"Version 5.150 V200R006C00", "neDN":"NE=34603015", "neName":"S9300", "shelfIndex":-1, "frameIndex":67108867, "vendorType":".1.3.6.1.4.1.2011.20021210.11.659456", "mfgName":"Huawei", "serialNum":"9300050123456789", "physicalClass":-1, "descr":"Quidway S9303 frame","standBystatus":4}], "description":"Successful"}
查询设备分组信息
接口功能
查询预订条件的分组信息列表。
URI路径
/rest/openapi/network/group
访问方法
GET
参数说明
参数名 |
必选/可选 |
参数位置 |
参数类型 |
参数说明 |
---|---|---|---|---|
openid |
必选 |
请求消息头 |
String |
会话标识,用于Open API的鉴权。 说明:
该参数由第三方调用安全管理登录接口获取openid。 |
id |
可选 |
URL |
String |
设备分组ID |
name |
可选 |
URL |
String |
分组名称 |
description |
可选 |
URL |
String |
分组描述 |
last_changed |
可选 |
URL |
long |
上次变更时间的时间戳,自1970年1月1号0时刻到当前时间点的时间(毫秒数),单位:ms |
tag_name |
可选 |
URL |
String |
分组类别 |
start |
可选 |
URL |
int |
指定从哪个起始记录位置开始返回查询结果集。缺省值是0。 说明 如果值小于0,将使用缺省值。 |
size |
可选 |
URL |
int |
指定返回查询结果集总数。缺省值是20。 说明 如果值小于0,将使用缺省值。 |
orderby |
可选 |
URL |
String |
指定查询结果集采用的排序字段。缺省排序字段是nedn。 可指定的排序字段包括:id、name。 |
desc |
可选 |
URL |
boolean |
指定查询结果是否按降序排序。缺省值是false。 说明 此请求参数只有指定了“orderby”请求参数后才有效。 |
请求示例
该接口参数较多,openid为必选参数,此处可选参数以id为例。 GET https://10.120.22.178:32102/rest/openapi/network/group?id=IVSDefaultGroup Headers: key = openid,value = c971939d611d7cbce24652358dc5fbd75b5dd9e4fef7474f
返回结果
字段名 |
类型 |
说明 |
---|---|---|
code |
int |
操作返回码。可以是如下值之一:
|
data |
List<NeGroupModel> |
信息列表。 |
description |
String |
接口调用结果的描述信息。 |
NeGroupModel包含以下字段:
字段名 |
类型 |
说明 |
---|---|---|
id |
String |
设备分组ID |
name |
String |
分组名称 |
description |
String |
分组描述 |
lastChanged |
long |
上次变更时间: eSight服务器本地时间。 格式:YYYY-MM-DD hh:mm:ss YYYY:年 MM:月 DD:日 hh:小时 mm:分钟 ss:秒 |
tagName |
String |
分组类别 |
响应示例
{ "code": 0, "data": [ { "id": "IVSDefaultGroup", "name": "默认分组", "description": " ", "lastChanged": 1542970922065, "tagName": "IVSDefaultGroup" } ], "description": "Operation success." }
注意事项
无。
使用示例
package com.huawei.oms.ros.test; import org.apache.http.HttpResponse; import org.apache.http.message.BasicNameValuePair; public class QueryNeGroup { private static final String EAM_FRAME = "/rest/openapi/network/group"; public static void main(String[] args) throws Exception { Login.login(); queryNeGroupInfo(); } public static void queryNeGroupInfo() throws Exception { //set the URL and method String openidURL = EAM_FRAME; String method = "GET"; //set headers BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method); //set parameters BasicNameValuePair[] parameters = { new BasicNameValuePair("description","AC") }; HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters); String body = NewHttpsAccess.getResult(response); System.out.println(body); } }
执行结果如下:
{"code":0, "data":[ {"id":"negroup=networkdefault4", "name":"AC", "description":"AC", "lastChanged":1092779379, "tagName":"按设备类别(预置)"}], "description":"Successful"}
下发Telnet命令
- 该接口默认是关闭状态。
- 网管只提供telnet连接和下发命令的能力,接口返回数据和设备侧保持一致。设备命令变更以及命令下发导致的影响,用户自行评估。请谨慎使用。
- 通过配置文件(eSight安装目录\AppBase\etc\neadapter\nebaseinfo\neaccess.cfg)中的配置项 isTelnetOpenAPIEnable 开关控制。具体配置请参考维护指南中“neaccess.cfg”章节。
- 网管必须配置设备的Telnet参数。配置操作如下:
- 在主菜单中选择“资源 > 网络 > 网络设备”。
- 单击设备名称进入设备管理界面。
- 选择“协议参数 > Telnet参数”。
- 根据界面提示配置Telnet参数。
接口功能
下发Telnet命令。
URI路径
/rest/openapi/network/telnet/
访问方法
PUT
参数说明
参数名 |
必选/可选 |
参数位置 |
参数类型 |
参数说明 |
---|---|---|---|---|
openid |
必选 |
请求头参数列表 |
String |
会话标识,用于Open API的鉴权。 说明:
该参数由第三方调用安全管理登录接口获取openid。 |
ip |
可选 |
请求实体参数列表 |
String |
指定设备ip地址。 |
nedn |
可选 |
请求实体参数列表 |
String |
制定设备dn号。 注:ip和nedn参数必须有一个。 |
cmdOrder |
必选 |
请求实体参数列表 |
String |
指定Telnet命令键值。 |
cmd1 |
必选 |
请求实体参数列表 |
String |
指定Telnet命令。 |
cmd2 |
可选 |
请求实体参数列表 |
String |
指定Telnet命令。 |
cmd3 |
可选 |
请求实体参数列表 |
String |
指定Telnet命令。 |
cmd4 |
可选 |
请求实体参数列表 |
String |
指定Telnet命令。 |
cmd5 |
可选 |
请求实体参数列表 |
String |
指定Telnet命令。 |
cmdOrder参数格式如下"cmd1,cmd2,cmd3,cmd4,cmd5",对应下发命令键值,用“,”隔开,有多少个键值就对应多少个命令。
请求示例
该接口必选参数为openid、cmdOrder和cmd1,至少要包含一条Telnet命令参数。此处可选参数以ip为例。 PUT https://10.120.22.178:32102/rest/openapi/network/telnet/ Headers: key = openid,value = c971939d611d7cbce24652358dc5fbd75b5dd9e4fef7474f Body: ip:10.136.252.46 cmdOrder:cmd1 cmd1:system-view
返回结果
字段名 |
类型 |
说明 |
---|---|---|
code |
int |
操作返回码。可以是如下值之一:
|
devIP |
String |
设备ip地址。 |
operateresult |
String |
接口调用结果的描述信息。 |
respInfo |
String |
设备执行telnet命令的回显信息。 |
dNMap |
Map |
ip地址对应的多dn号。 |
响应示例
{ "code": 0, "devIP": "10.136.252.46", "operateresult": "Command execution success.", "respInfo": "\r\nWarning: Telnet is not a secure protocol, and it is recommended to use Stelnet.\n\nLogin authentication\n\n\nPassword:\nWarning: There is a risk on the user-interface which you login through. Please change the configuration of the user-interface as soon as possible. \n\nInfo: The max number of VTY users is 20, and the number\n of current VTY users on line is 2.\n The current login time is 2018-09-04 09:47:01+08:00.\n<ipca-252.46>system-view\nEnter system view, return user view with Ctrl+Z.\n[ipca-252.46]", "dNMap": null }
注意事项
无。
使用示例
package com.huawei.oms.ros.test; import org.apache.http.HttpResponse; import org.apache.http.message.BasicNameValuePair; public class QueryTelnetList { private static final String EAM_NEDEVICE = "/rest/openapi/network/telnet"; public static void main(final String[] args) throws Exception { Login.login(); queryTelnetTest(); } public static void queryTelnetTest() throws Exception { final String openidURL = EAM_NEDEVICE; final String method = "PUT"; final BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method); final BasicNameValuePair[] parameters = { new BasicNameValuePair("ip", "10.137.240.118"), new BasicNameValuePair("nedn", "NE=34603909"), new BasicNameValuePair("cmdOrder", "cmd1,cmd2,cmd3,cmd4,cmd5"), new BasicNameValuePair("cmd1", "system-view"), new BasicNameValuePair("cmd2", "stelnet server enable"), new BasicNameValuePair("cmd3", "sftp server enable"), new BasicNameValuePair("cmd4", "sftp server enable"), new BasicNameValuePair("cmd5", "ssh client first-time enable")}; final HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters); final String body = NewHttpsAccess.getResult(response); System.out.println(body); } }
执行结果如下: { "code":0, "devIP":10.137.240.118, "operateresult":"Command execution success.", "respInfo":"\r\r\nWarning: Telnet is not a secure protocol, and it is recommended to use Stelnet.\r\n\r\nLogin authentication\r\n\r\n\r\nPassword:\r\nWarning: There is a risk on the user-interface which you login through. Please change the configuration of the user-interface as soon as possible. \r\n\r\nInfo: The max number of VTY users is 20, and the number\r\n of current VTY users on line is 3.\r\n The current login time is 2015-08-05 22:59:01+08:00.\r\nWarning: Current license state is Trial. 15 days remain!\r\n<iPCA-S12708>system-view\r\nEnter system view, return user view with Ctrl+Z.\r\n[iPCA-S12708]stelnet server enable\r\nInfo: The Stelnet server is already started.\r\n[iPCA-S12708]sftp server enable\r\nInfo: The SFTP server is already started.\r\n[iPCA-S12708]sftp server enable\r\nInfo: The SFTP server is already started.\r\n[iPCA-S12708]ssh client first-time enable\r\n[iPCA-S12708]" "dNMap":null }
查询下级网管链路信息列表
接口功能
查询下级网管链路信息列表,用于上级网管全量、增量同步下级网管的链路变更信息列表。
URI路径
/rest/openapi/linkmgr/lowforup/linklist
访问方法
GET
参数说明
参数名 |
必选/可选 |
参数位置 |
参数类型 |
参数说明 |
---|---|---|---|---|
openid |
必选 |
请求消息头 |
String |
会话标识,用于Open API的鉴权。 说明:
该参数由第三方调用安全管理登录接口获取openid。 |
upLayer |
必选 |
URL |
String |
上级网管key值 说明:
该参数是下级网管缓存的Map类型链路数据的key值,可以用“上级网管IP+下级网管端口号”的形式作为该参数值,比如“1.1.1.131943”。 |
lowLayer |
必选 |
URL |
String |
下级网管DN。 说明:
在上级网管上添加某一下级网管时,会自动生成一个DN值作为该下级网管节点在上级网管上的唯一标识。 |
getType |
必选 |
URL |
boolean |
是否全量查询下级网管链路列表。 说明:
该参数为true时表示全量查询,全量是指返回某个下级网管的所有链路列表,增量是指仅返回查询周期内“增/删/改”的链路列表。 |
请求示例
GET https://10.171.43.80:32102/rest/openapi/linkmgr/lowforup/linklist?upLayer=10.120.22.17831943&lowLayer=NE=34603209&getType=false Headers: key = openid,value = 810be029f59d8acc93a8e55576d9a99162695de61fd6ed93
返回结果
字段名 |
类型 |
说明 |
---|---|---|
code |
int |
操作返回码。可以是如下值之一:
|
data |
Map<String, List<LinkInfoModel>> |
链路信息,<"insert", linkList>, <"delete", linkList>, <"modify", linkList>,全量查询时只包含insert数据,增量查询时包含insert、delete、modify数据。 |
description |
String |
接口调用结果的描述信息。 |
LinkInfoModel对象包含以下字段:
字段名 |
类型 |
说明 |
---|---|---|
linkDn |
String |
链路DN |
linkName |
String |
链路名称 |
linkNameAlias |
String |
链路别名 |
linkTips |
String |
链路tips信息 |
aneDn |
String |
源网元DN |
aneName |
String |
源网元名称 |
aneIp |
String |
源网元IP |
aportDn |
String |
源端口DN |
aifIndex |
String |
源端口index |
aportName |
String |
源端口名称 |
aportAdminStatus |
int |
源端口管理状态 |
aportOperStatus |
int |
源端口运行状态 |
aneState |
int |
源网元状态 |
aportType |
String |
源接口类型 |
isAphysicalNodeVar |
boolean |
源网元是否为物理节点 |
zneDn |
String |
宿网元DN |
zneName |
String |
宿网元名称 |
zneIp |
String |
宿网元IP |
zportDn |
String |
宿端口DN |
zifIndex |
String |
宿端口index |
zportName |
String |
宿端口名称 |
zportAdminStatus |
int |
宿端口管理状态 |
zportOperStatus |
int |
宿端口运行状态 |
zneState |
int |
宿网元状态 |
zportType |
String |
宿接口类型 |
isZphysicalNodeVar |
boolean |
宿网元是否为物理节点 |
linkStatus |
int |
链路状态 |
linkType |
int |
链路发现算法类型 |
linkCatagory |
int |
链路类型 |
speed |
long |
链路带宽 |
linkUsedStatus |
String |
链路使用状态 |
custom |
int |
链路名称定义类型 |
isDisplayInTopoVar |
boolean |
是否在物理topo显示 |
响应示例
{ "code": 0, "data": { "insert": [{ "linkDn": "2_-129879503991-15331110521068312132", "linkName": "S5352C-EI-154_GigabitEthernet0/0/2_S3352-98_Ethernet0/0/1", "aneDn": "NE=34604991", "aneName": "S5352C-EI-154", "aneIp": "10.137.240.154", "aneState": 1, "aportDn": "NE=34604991_9", "aportIp": "", "aportName": "GigabitEthernet0/0/2", "aportOperStatus": 1, "aportAdminStatus": 1, "zneDn": "NE=34604963", "zneName": "S3352-98", "zneIp": "10.137.240.98", "zneState": 1, "zportDn": "NE=34604963_514", "zportName": "Ethernet0/0/1", "zportIp": "", "zportAdminStatus": 1, "zportOperStatus": 1, "linkStatus": 0, "linkType": 1, "speed": 100 }], "modify": [], "delete": [] }, "description": "Successful" }
注意事项
无。
使用示例
package com.huawei.oms.ros.test; import org.apache.http.HttpResponse; import org.apache.http.message.BasicNameValuePair; public class QueryLowforupLinklist { private static final String EAM_LINK = "/rest/openapi/linkmgr/lowforup/linklist"; public static void main(String[] args) throws Exception { Login.login(); queryLinkList(); } public static void queryLinkList() throws Exception { //set the URL and method String openidURL = EAM_LINK; String method = "GET"; //set headers BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method); //set parameters BasicNameValuePair[] parameters = { new BasicNameValuePair("upLayer", "10.10.10.1031943"), new BasicNameValuePair("lowLayer", "NE=34604991"), new BasicNameValuePair("getType", "false") }; HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters); String body = NewHttpsAccess.getResult(response); System.out.println(body); } }
执行结果如下:
{"code":0, "data":{ "insert":[{"linkDn":"2_-129879503991-15331110521068312132", "linkName":"S5352C-EI-154_GigabitEthernet0/0/2_S3352-98_Ethernet0/0/1", "aneDn":"NE=34604991", "aneName":"S5352C-EI-154", "aneIp":"10.137.240.154", "aneState":1, "aportDn":"NE=34604991_9", "aportIp":"", "aportName":"GigabitEthernet0/0/2", "aportOperStatus":1, "aportAdminStatus":1, "zneDn":"NE=34604963", "zneName":"S3352-98", "zneIp":"10.137.240.98", "zneState":1, "zportDn":"NE=34604963_514", "zportName":"Ethernet0/0/1", "zportIp":"", "zportAdminStatus":1, "zportOperStatus":1, "linkStatus":0, "linkType":1, "speed":100}], "modify":[], "delete":[]}, "description":"Successful"}
删除下级网管缓存的链路信息列表
接口功能
在上级网管删除某个下级网管时,调用下级网管的此接口,用来删除下级网管缓存的链路信息列表,这里缓存的链路信息是要被全量或增量同步到上级网管上。
URI路径
/rest/openapi/linkmgr/lowforup/linklist
访问方法
POST
参数说明
参数名 |
必选/可选 |
参数位置 |
参数类型 |
参数说明 |
---|---|---|---|---|
openid |
必选 |
请求消息头 |
String |
会话标识,用于Open API的鉴权。 说明:
该参数由第三方调用安全管理登录接口获取openid。 |
upLayer |
必选 |
URL |
String |
上级网管key值 说明:
该参数是下级网管缓存的Map类型链路数据的key值,可以用“上级网管IP+下级网管端口号”的形式作为该参数值,比如“1.1.1.131943”。 |
请求示例
POST https://10.171.43.80:32102/rest/openapi/linkmgr/lowforup/linklist?upLayer=10.120.22.17831943 Headers: key = openid,value = 810be029f59d8acc93a8e55576d9a99162695de61fd6ed93
返回结果
字段名 |
类型 |
说明 |
---|---|---|
code |
int |
操作返回码。可以是如下值之一:
|
data |
String |
删除成功返回“OK”。 |
description |
String |
接口调用结果的描述信息。 |
响应示例
{ "code": 0, "data": "OK", "description": "Successful" }
注意事项
无。
使用示例
package com.huawei.oms.ros.test; import org.apache.http.HttpResponse; import org.apache.http.message.BasicNameValuePair; public class DelLowforupLinkCache { private static final String EAM_LINK = "/rest/openapi/linkmgr/lowforup/linklist"; public static void main(String[] args) throws Exception { Login.login(); queryLinkList(); } public static void queryLinkList() throws Exception { //set the URL and method String openidURL = EAM_LINK; String method = "POST"; //set headers BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method); //set parameters BasicNameValuePair[] parameters = { new BasicNameValuePair("upLayer", "10.10.10.1031943") }; HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters); String body = NewHttpsAccess.getResult(response); System.out.println(body); } }
执行结果如下:
{"code":0, "data":"OK" "description":"Successful"}
修改设备的接口备注
该接口默认关闭;
通过配置文件(eSight安装目录\AppBase\etc\neadapter\interface\customization.cfg)中的配置项 isOpenInterfacePage 开关控制。
接口功能
提供该接口供第三方调用,第三方可修改设备的接口备注。
URI路径
/rest/openapi/network/interfaceRemark/modify
访问方法
POST
参数说明
参数名 |
必选/可选 |
参数位置 |
参数类型 |
参数说明 |
---|---|---|---|---|
openid |
必选 |
请求消息头 |
String |
会话标识,用于Open API的鉴权。 说明:
该参数由第三方调用安全管理的登录接口获取openid。 |
interfaceList |
必选 |
请求实体参数列表 |
JSONArray |
查询条件(条数限制为200条),属性包括: neName:待修改的设备名称 ifDesc : 待修改的接口名称。 ifRemark:待修改的备注。 |
参数样例
{
"interfaceList": [{
"neName": "AL1_59.141",
"ifDesc": "100GE1/0/3",
"ifRemark": "Ready for service"
}]
}
返回结果
字段名 |
类型 |
说明 |
---|---|---|
Code |
int |
操作返回码。可以是如下值之一: 0:成功。 非0:失败。 其中1001表示license无效;1002表示license不具有调用openapi的功能;1204表示认证失败。 |
Data |
IfModifyResult |
返回记录信息。 |
Description |
String |
描述信息。 |
IfModifyResult包含如下字段
参数名 |
参数类型 |
参数说明 |
---|---|---|
totalCount |
Int |
要修改的总接口数目。 |
failCount |
Int |
修改失败的接口数目。 |
successResult |
List<IfReturnResult> |
修改成功的接口数据。 |
failResult |
List<IfReturnResult> |
修改失败的接口数据。 |
IfReturnResult包含如下字段
参数名 |
参数类型 |
参数说明 |
---|---|---|
neName |
String |
设备名称。 |
ifDesc |
String |
接口名称。 |
ifRemark |
String |
备注名称。 |
注意事项
此接口在开关关闭时无法调用。
使用示例
package com.huawei.oms.ros.test; import org.apache.http.HttpResponse; import org.apache.http.message.BasicNameValuePair; import com.huawei.nms.openapi.demo.global.GlobalVar; import com.huawei.nms.openapi.demo.global.NewHttpsAccess; import com.huawei.nms.openapi.demo.global.NewRosSecurity; /** * ModifyRemark */ public class ModifyRemarkDemo{ @Test public void ModifyIf() throws Exception { String openidURL = "/rest/openapi/network/interfaceRemark/modify"; String method = "POST"; String openId = Demo.login(); BasicNameValuePair[] headers = { new BasicNameValuePair("openid", openId)}; List<Model> list = test("123"); String param = JSonUtil.generateJson(list); BasicNameValuePair[] parameters = { new BasicNameValuePair("interfaceList", param)}; Long t1 = System.currentTimeMillis(); HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters); String body = NewHttpsAccess.getResult(response); System.out.println(body); } public List<Model> test(String remark) throws Exception{ List<Model> list = new ArrayList<Model>(); int i = 0; Model m = new Model(); m.setNeName(“10.136.252.185”); m.setIfDesc(“Eth-Trunk12”); list.add(m); return list; } } 执行结果如下: { "code": 0, "data": { "totalCount": 1, "failCount": 1, "successResult": null, "failResult": [ { "neName": "10.136.252.185", "ifDesc": " Eth-Trunk12", "ifRemark": "123" } ] }, "description": "Operation success." }
恢复设备的接口备注
该接口默认关闭;
通过配置文件(eSight安装目录\AppBase\etc\neadapter\interface\customization.cfg)中的配置项 isOpenInterfacePage 开关控制。
接口功能
提供该接口供第三方调用,第三方可恢复设备的接口备注。
URI路径
/rest/openapi/network/interfaceRemark/restore
访问方法
POST
参数说明
参数名 |
必选/可选 |
参数位置 |
参数类型 |
参数说明 |
---|---|---|---|---|
openid |
必选 |
请求消息头 |
String |
会话标识,用于Open API的鉴权。 说明:
该参数由第三方调用安全管理的登录接口获取openid。 |
interfaceList |
必选 |
请求实体参数列表 |
JSONArray |
查询条件(条数限制为200条),属性包括: neName:设备名称。 ifDesc : 接口名称。 |
参数样例
{
"interfaceList": [{
"neName": "AL1_59.141",
"ifDesc": "100GE1/0/3"
}]
}
返回结果
字段名 |
类型 |
说明 |
---|---|---|
Code |
int |
操作返回码。可以是如下值之一: 0:成功 非0:失败。其中1001表示license无效;1002表示license不具有调用openapi的功能;1204表示认证失败。 |
Data |
IfModifyResult |
返回记录信息。 |
Description |
String |
描述信息。 |
IfModifyResult包含如下字段
参数名 |
参数类型 |
参数说明 |
---|---|---|
totalCount |
Int |
要恢复的总接口数目。 |
failCount |
Int |
恢复失败的接口数目。 |
successResult |
List<IfReturnResult> |
恢复成功的接口数据。 |
failResult |
List<IfReturnResult> |
恢复失败的接口数据。 |
IfReturnResult包含如下字段
参数名 |
参数类型 |
参数说明 |
---|---|---|
neName |
String |
设备名称。 |
ifDesc |
String |
接口名称。 |
ifRemark |
String |
备注名称。 |
注意事项
此接口在开关关闭时无法调用。
使用示例
package com.huawei.oms.ros.test; import org.apache.http.HttpResponse; import org.apache.http.message.BasicNameValuePair; import com.huawei.nms.openapi.demo.global.GlobalVar; import com.huawei.nms.openapi.demo.global.NewHttpsAccess; import com.huawei.nms.openapi.demo.global.NewRosSecurity; public class ModifyRemarkDemo{ @Test public void restoreIf() throws Exception { String openidURL = "/rest/openapi/network/interfaceRemark/restore"; String method = "POST"; String openId = Demo.login(); BasicNameValuePair[] headers = { new BasicNameValuePair("openid", openId)}; List<Model> list = test(); String param = JSonUtil.generateJson(list); BasicNameValuePair[] parameters = { new BasicNameValuePair("interfaceList", param)}; HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters); String body = NewHttpsAccess.getResult(response); System.out.println(body); } public List<Model> test() throws Exception{ List<Model> list = new ArrayList<Model>(); int i = 0; Model m = new Model(); m.setNeName(“10.136.252.185”); m.setIfDesc(“Eth-Trunk12”); list.add(m); return list; } } 执行结果如下(备注均为恢复之后的备注): { "code": 0, "data": { "totalCount": 1, "failCount": 1, "successResult": [], "failResult": [ { "neName": "10.136.252.185", "ifDesc": " Eth-Trunk12", "ifRemark": "123" } ] }, "description": "Operation success." }
修改设备备注
该接口默认关闭;
通过配置文件(eSight安装目录\AppBase\etc\neadapter\interface\customization.cfg)中的配置项 isOpenInterfacePage 开关控制。
接口功能
提供该接口供第三方调用,第三方可修改设备的备注。
URI路径
/rest/openapi/network/neRemark/modify
访问方法
POST
参数说明
参数名 |
必选/可选 |
参数位置 |
参数类型 |
参数说明 |
---|---|---|---|---|
openid |
必选 |
请求消息头 |
String |
会话标识,用于Open API的鉴权。 说明:
该参数由第三方调用安全管理的登录接口获取openid。 |
neList |
必选 |
请求实体参数列表 |
List<String> |
待修改的设备名称的集合.(条数限制为200条) |
neRemark |
必选 |
请求实体参数列表 |
String |
待修改的设备备注。 |
参数样例
{
"neList": ["AL1_59.141"],
"neRemark": "In Service"
}
返回结果
字段名 |
类型 |
说明 |
---|---|---|
Code |
int |
操作返回码。可以是如下值之一: 0:成功 非0:失败。 其中1001表示license无效;1002表示license不具有调用openapi的功能;1204表示认证失败。 |
Data |
NeModifyResult |
返回记录信息。 |
Description |
String |
描述信息。 |
NeModifyResult包含如下字段
参数名 |
参数类型 |
参数说明 |
---|---|---|
totalCount |
Int |
修改的总数。 |
failCount |
Int |
修改失败的设备数目。 |
neFailResult |
List<String> |
修改失败的数据(失败的设备名称的集合)。 |
注意事项
此接口在开关关闭时无法调用。
使用示例
package com.huawei.oms.ros.test; import org.apache.http.HttpResponse; import org.apache.http.message.BasicNameValuePair; import com.huawei.nms.openapi.demo.global.GlobalVar; import com.huawei.nms.openapi.demo.global.NewHttpsAccess; import com.huawei.nms.openapi.demo.global.NewRosSecurity; public class ModifyRemarkDemo{ @Test public void neModify() throws Exception { String openidURL = "/rest/openapi/network/neRemark/modify"; String method = "POST"; String openId = Demo.login(); long t1 = System.currentTimeMillis(); BasicNameValuePair[] headers = { new BasicNameValuePair("openid", openId)}; List<String> list = test(); String str = JSonUtil.generateJson(list); BasicNameValuePair[] parameters = { new BasicNameValuePair("neList", str), new BasicNameValuePair("neRemark", "123")}; HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters); String body = NewHttpsAccess.getResult(response); System.out.println(body); } public List<Model> test(String remark) throws Exception{ List<Model> list = new ArrayList<Model>(); int i = 0; Model m = new Model(); m.setNeName(“AL_59.1211”); list.add(m); return list; } } 执行结果如下: { "code": 0, "data": { "totalCount": 1, "failCount": 1, "neFailResult": [ "AL_59.1211" ], "neSuccessList": [] }, "description": "Operation success." }
恢复设备备注
该接口默认关闭;
通过配置文件(eSight安装目录\AppBase\etc\neadapter\interface\customization.cfg)中的配置项 isOpenInterfacePage 开关控制。
接口功能
提供该接口供第三方调用,第三方可恢复设备的备注。
URI路径
/rest/openapi/network/neRemark/restore
访问方法
POST
参数说明
参数名 |
必选/可选 |
参数位置 |
参数类型 |
参数说明 |
---|---|---|---|---|
openid |
必选 |
请求消息头 |
String |
会话标识,用于Open API的鉴权。 说明:
该参数由第三方调用安全管理的登录接口获取openid。 |
neList |
必选 |
请求实体参数列表 |
List<String> |
待恢复的设备名称的集合。(条数限制为200条) |
参数样例
{
"neList": ["AL1_59.141"]
}
返回结果
字段名 |
类型 |
说明 |
---|---|---|
Code |
int |
操作返回码。可以是如下值之一: 0:成功 非0:失败。 其中1001表示license无效;1002表示license不具有调用openapi的功能;1204表示认证失败。 |
Data |
NeModifyResult |
返回记录信息。 |
Description |
String |
描述信息。 |
NeModifyResult包含如下字段
参数名 |
参数类型 |
参数说明 |
---|---|---|
totalCount |
Int |
要恢复的设备总数。 |
failCount |
Int |
恢复失败的设备数目。 |
neSuccessList |
List<Map<String, Object>> |
恢复成功的设备数据集合(key:设备名称 value:设备当前备注)。 |
neFailResult |
List<String> |
恢复失败的数据(失败的设备名称的集合)。 |
注意事项
此接口在开关关闭时无法调用。
使用示例
package com.huawei.oms.ros.test; import org.apache.http.HttpResponse; import org.apache.http.message.BasicNameValuePair; import com.huawei.nms.openapi.demo.global.GlobalVar; import com.huawei.nms.openapi.demo.global.NewHttpsAccess; import com.huawei.nms.openapi.demo.global.NewRosSecurity; public class ModifyRemarkDemo{ @Test public void neRestore() throws Exception { String openidURL = "/rest/openapi/network/neRemark/restore"; String method = "POST"; String openId = Demo.login(); BasicNameValuePair[] headers = { new BasicNameValuePair("openid", openId)}; List<String> list = test(); String str = JSonUtil.generateJson(list); BasicNameValuePair[] parameters = { new BasicNameValuePair("ifModifyNeRemark", "true"), new BasicNameValuePair("neList", str),}; HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters); String body = NewHttpsAccess.getResult(response); System.out.println(body); } public List<Model> test() throws Exception{ List<Model> list = new ArrayList<Model>(); int i = 0; Model m = new Model(); m.setNeName(“AL_59.121”); list.add(m); return list; } } 执行结果如下(备注均为恢复之后的备注): { "code": 0, "data": { "totalCount": 1, "failCount": 0, "neFailResult": [], "neSuccessList": [ { "neRemark": "In Service", "neName": "AL_59.121" } ] }, "description": "Operation success." }
修改设备备注及其关联设备的接口备注
该接口默认关闭;
通过配置文件(eSight安装目录\AppBase\etc\neadapter\interface\customization.cfg)中的配置项 isOpenInterfacePage 开关控制。
接口功能
提供该接口供第三方调用,第三方可修改设备备注以及其关联设备的接口备注。
URI路径
/rest/openapi/network/deviceRemark/modify
访问方法
POST
参数说明
参数名 |
必选/可选 |
参数位置 |
参数类型 |
参数说明 |
---|---|---|---|---|
openid |
必选 |
请求消息头 |
String |
会话标识,用于Open API的鉴权。 说明:
该参数由第三方调用安全管理的登录接口获取openid。 |
neList |
必选 |
请求实体参数列表 |
List<String> |
待修改的设备名称的集合。(条数限制为200条) |
neRemark |
可选 |
请求实体参数列表 |
String |
修改的设备备注(ifModifyNeRemark为false,后台不做处理;ifModifyNeRemark为true时必选不填默认为“”) |
ifRemark |
必选 |
请求实体参数列表 |
String |
待修改的接口备注。(接口别名中包含待修改设备名称) |
ifModifyNeRemark |
必选 |
请求实体参数列表 |
String |
判断是否修改设备备注,默认为true。 |
参数样例
{
"neList": ["AL1_59.141"],
"neRemark": "In Service",
"ifRemark": "In Service",
"ifModifyNeRemark": "true"
}
返回结果
字段名 |
类型 |
说明 |
---|---|---|
Code |
int |
操作返回码。可以是如下值之一: 0:成功 非0:失败。 其中1001表示license无效;1002表示license不具有调用openapi的功能;1204表示认证失败。 |
Data |
DeviceModifyResult |
返回记录信息 |
Description |
String |
描述信息 |
DeviceModifyResult包含如下字段
参数名 |
参数类型 |
参数说明 |
---|---|---|
neTotalCount |
Int |
要修改的总设备数。 |
neFailCount |
Int |
修改失败的设备数目。 |
ifSuccessCount |
Int |
修改成功的关联接口数目。 |
neFailResult |
List<String> |
修改失败的设备名称的集合。 |
neSuccessResult |
Map<String, Object> |
修改成功的设备数据。 |
ifSuccessResult |
List<Map<String, Object>> |
修改成功的接口数据。 |
注意事项
此接口在开关关闭时无法调用。
使用示例
package com.huawei.oms.ros.test; import org.apache.http.HttpResponse; import org.apache.http.message.BasicNameValuePair; import com.huawei.nms.openapi.demo.global.GlobalVar; import com.huawei.nms.openapi.demo.global.NewHttpsAccess; import com.huawei.nms.openapi.demo.global.NewRosSecurity; public class ModifyRemarkDemo{ @Test public void ModifyDevice() throws Exception { String openidURL = DEVICEOPENAPI; String method = "POST"; String openId = Demo.login(); BasicNameValuePair[] headers = { new BasicNameValuePair("openid", openId)}; List<String> list = new ArrayList<String>(); ObjectMapper mapper = new ObjectMapper(); list.add("MS1_59.45"); String str = JSonUtil.generateJson(list); BasicNameValuePair[] parameters = { new BasicNameValuePair("ifModifyNeRemark", "true"), new BasicNameValuePair("neList", str), new BasicNameValuePair("ifRemark", " testif123"), new BasicNameValuePair("neRemark", " testif123")}; HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters); String body = NewHttpsAccess.getResult(response); System.out.println(body); } 执行结果如下: { "code": 0, "data": { "neTotalCount": 1, "neFailCount": 0, "ifSuccessCount": 4, "neFailResult": [], "neSuccessResult": {}, "ifSuccessResult": [ { "MS1_59.45": [ { "neName": "ML2_59.31", "ifDesc": "10GE8/0/22", "ifRemark": "testif123" }, { "neName": "ML2_59.31", "ifDesc": "100GE3/0/14", "ifRemark": "testif123" }, { "neName": "AL_59.141", "ifDesc": "10GE1/0/34", "ifRemark": "testif123" }, { "neName": "AL_59.141", "ifDesc": "Eth-Trunk270", "ifRemark": "testif123" } ] } ] }, "description": "Operation success." }
恢复设备备注及其关联设备的接口备注
该接口默认关闭;
通过配置文件(eSight安装目录\AppBase\etc\neadapter\interface\customization.cfg)中的配置项 isOpenInterfacePage 开关控制。
接口功能
提供该接口供第三方调用,第三方可恢复设备备注以及其关联设备的接口备注。
URI路径
/rest/openapi/network/deviceRemark/restore
访问方法
POST
参数说明
参数名 |
必选/可选 |
参数位置 |
参数类型 |
参数说明 |
---|---|---|---|---|
openid |
必选 |
请求消息头 |
String |
会话标识,用于Open API的鉴权。 说明:
该参数由第三方调用安全管理的登录接口获取openid。 |
neList |
必选 |
请求实体参数列表 |
List<String> |
待恢复的设备名称的集合。(条数限制为200条) |
ifModifyNeRemark |
必选 |
请求实体参数列表 |
String |
判断是否恢复设备备注,默认为true。 |
参数样例
{
"neList": ["AL1_59.141"],
"ifModifyNeRemark": "true"
}
返回结果
字段名 |
类型 |
说明 |
---|---|---|
Code |
int |
操作返回码。可以是如下值之一: 0:成功 非0:失败 其中1001表示license无效;1002表示license不具有调用openapi的功能;1204表示认证失败。 |
Data |
DeviceModifyResult |
返回记录信息。 |
Description |
String |
描述信息。 |
DeviceModifyResult包含如下字段
参数名 |
参数类型 |
参数说明 |
---|---|---|
neTotalCount |
Int |
要恢复的总设备数。 |
neFailCount |
Int |
恢复失败的设备数目。 |
ifSuccessCount |
Int |
恢复成功的关联接口数目。 |
neFailResult |
List<String> |
恢复失败的设备名称的集合。 |
neSuccessResult |
Map<String, Object> |
恢复成功的设备数据。 |
ifSuccessResult |
List<Map<String, Object>> |
恢复成功的接口数据。 |
注意事项
此接口在开关关闭时无法调用。
使用示例
package com.huawei.oms.ros.test; import org.apache.http.HttpResponse; import org.apache.http.message.BasicNameValuePair; import com.huawei.nms.openapi.demo.global.GlobalVar; import com.huawei.nms.openapi.demo.global.NewHttpsAccess; import com.huawei.nms.openapi.demo.global.NewRosSecurity; /** * Create a User */ public class ModifyRemarkDemo{ @Test public void restoreDevice() throws Exception { String openidURL = "/rest/openapi/network/deviceRemark/restore"; String method = "POST"; String openId = Demo.login(); BasicNameValuePair[] headers = { new BasicNameValuePair("openid", openId)}; List<String> list = new ArrayList<String>(); ObjectMapper mapper = new ObjectMapper(); list.add("MS1_59.45"); String str = JSonUtil.generateJson(list); BasicNameValuePair[] parameters = { new BasicNameValuePair("ifModifyNeRemark", "true"), new BasicNameValuePair("neList", str)}; HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters); String body = NewHttpsAccess.getResult(response); System.out.println(body); } } 执行结果如下(备注均为恢复之后的备注) { "code": 0, "data": { "neTotalCount": 1, "neFailCount": 0, "ifSuccessCount": 4, "neFailResult": [], "neSuccessResult": { "MS1_59.45": "test123" }, "ifSuccessResult": [ { "MS1_59.45": [ { "neName": "ML2_59.31", "ifDesc": "10GE8/0/22", "ifRemark": "testif123" }, { "neName": "ML2_59.31", "ifDesc": "100GE3/0/14", "ifRemark": "testif123" }, { "neName": "AL_59.141", "ifDesc": "10GE1/0/34", "ifRemark": "testif123" }, { "neName": "AL_59.141", "ifDesc": "Eth-Trunk270", "ifRemark": "testif123" } ] } ] }, "description": "Operation success." }
查询网络设备的Trunk接口配置信息
接口功能
查询网络设备的Trunk接口配置信息。
URI路径
/rest/openapi/network/vlan/trunk
访问方法
GET
参数说明
参数名 |
必选/可选 |
参数位置 |
参数类型 |
参数说明 |
---|---|---|---|---|
openid |
必选 |
请求消息头 |
String |
会话标识,用于Open API的鉴权。 说明:
该参数由第三方调用安全管理登录接口获取openid。 |
nedn |
必选 |
URL |
String |
设备DN。 |
请求示例
该接口openid为必选参数,此处必选参数以nedn为例。 GET https://10.171.35.253:32102/rest/openapi/network/vlan/trunk?nedn=NE=34603369 Headers: key = openid,value = b3716876bca0a3ff1c7341205616a97c6ab09b548569f12e
返回结果
字段名 |
类型 |
说明 |
---|---|---|
code |
int |
操作返回码。可以是如下值之一:
|
data |
List<TrunkIfOpenModel> |
端口Trunk配置信息。 |
description |
String |
接口调用结果的描述信息。 |
TrunkIfOpenModel包含以下字段:
字段名 |
类型 |
说明 |
---|---|---|
ifIndex |
String |
Trunk接口索引 |
ifName |
String |
Trunk接口名称 |
permitVlanInfo |
String |
允许通过的vlan信息 |
ifChildren |
List<InterfaceInfo> |
子接口列表 |
InterfaceInfo包含以下字段:
字段名 |
类型 |
说明 |
---|---|---|
ifIndex |
String |
子接口索引 |
ifName |
String |
子接口名称 |
响应示例
{ "code": 0, "data": [ { "ifIndex": "55", "ifName": "Eth-Trunk0", "permitVlanInfo": "82", "ifChildren": [ { "ifIndex": "6", "ifName": "Ethernet0/0/1" } ] } ] , "description": "Operation success." }
注意事项
无。
使用示例
package com.huawei.oms.ros.test; import org.apache.http.HttpResponse; import org.apache.http.message.BasicNameValuePair; public class QueryTrunkList() { private static final String EAM_NEDEVICE = "rest/openapi/network/vlan/trunk"; public static void main(final String[] args) throws Exception { Login.login(); queryTrunkTest(); } public static void queryTrunkTest() throws Exception { // set the URL and method String openidURL = EAM_NEDEVICE; String method = "GET"; // set headers BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method); // set parameters BasicNameValuePair[] parameters = {new BasicNameValuePair("nedn", " NE=34603317")}; HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters); String body = NewHttpsAccess.getResult(response); System.out.println(body); } }
执行结果如下:
{ "code": 0, "data": [ { "ifIndex": "80", "ifName": "Eth-Trunk10", "permitVlanInfo": "1,20,30,40,50,100", "ifChildren": [ { "ifIndex": "10", "ifName": "GigabitEthernet0/0/5" }, { "ifIndex": "11", "ifName": "GigabitEthernet0/0/6" } ] }, { "ifIndex": "81", "ifName": "Eth-Trunk11", "permitVlanInfo": "1,20,30,40,50,100", "ifChildren": [ { "ifIndex": "12", "ifName": "GigabitEthernet0/0/7" }, { "ifIndex": "13", "ifName": "GigabitEthernet0/0/8" } ] } ], "description": "Operation success." }
服务器管理接口
查询服务器设备列表
接口功能
根据参数servertype获取服务器设备列表。
URI路径
/rest/openapi/server/device
访问方法
GET
参数说明
参数名 |
必选/可选 |
参数位置 |
参数类型 |
参数说明 |
---|---|---|---|---|
openid |
必选 |
请求消息头 |
String |
会话标识,用于Open API的鉴权。 说明:
该参数由第三方调用安全管理的登录eSight获取openid。 |
servertype |
必选 |
参数列表 |
String |
服务器类型,范围如下:
|