配置管理接口
本节介绍配置管理接口。
查询配置文件变更信息
接口功能
查询配置文件变更信息。
URI路径
/rest/openapi/configfile/configchange
访问方法
GET
请求示例
GET https://10.120.70.220:32102/rest/openapi/configfile/configchange?changeTime=123456789&pageSize=20&pageNo=1 Headers: key = openid,value = d21ee8aae2f9c05b2098e82a33b3430b37e1c6980d26004f
参数说明
参数名 |
必选/可选 |
参数位置 |
参数类型 |
参数说明 |
---|---|---|---|---|
openid |
必选 |
请求头参数列表 |
String |
会话标识,用于Open API的鉴权。 说明:
该参数由第三方调用安全管理登录接口获取openid。 |
changeTime |
必选 |
请求实体参数列表 |
long |
起始时间(UTC时间,精确到毫秒),表示查询从该时间到现在的配置文件变更信息。 |
pageNo |
必选 |
请求实体参数列表 |
int |
指定从第几页开始返回查询结果集,从1开始。 |
pageSize |
必选 |
请求实体参数列表 |
int |
每页大小,最小值为1,最大值为100。 |
返回结果
字段名 |
类型 |
说明 |
---|---|---|
code |
int |
操作返回码。可以是如下值之一:
|
description |
String |
接口调用结果的描述信息。 |
data |
ConfigChangePage |
配置文件变更信息。 |
data包含以下字段:
字段名 |
类型 |
说明 |
---|---|---|
configChangeInfo |
List |
配置文件变更信息 |
curPage |
int |
当前页数 |
totalPage |
int |
总页数 |
configChangeInfo包含以下字段:
字段名 |
类型 |
说明 |
---|---|---|
neDn |
String |
网元的唯一标识。 |
changeTime |
long |
变更时间(UTC时间,精确到毫秒)。 |
oldFile |
String |
老文件名。 |
newFile |
String |
新文件名。 |
fileType |
String |
备份文件类型,"r":运行配置;“s”:启动配置; |
added |
String |
新增的命令。 |
modified |
String |
修改的命令。 |
baseModified |
String |
修改前的命令。 |
deleted |
String |
删除的命令。 |
addNum |
int |
新增的行数。 |
modifyNum |
int |
修改的行数。 |
deleteNum |
int |
删除的行数。 |
响应示例
{ "code": 0, "data": { "configChangeInfo": [ { "neDn": "NE=34622313", "changeTime": 1479450011876, "oldFile": "20161118141713R.cfg", "newFile": "20161118141953R.cfg", "fileType": "r", "added": "ap-group name employee", "modified": null, "baseModified": null, "deleted": null, "addNum": 1, "modifyNum": 0, "deleteNum": 0 } ], "curPage": 1, "totalPage": 1 }, "description": "" }
注意事项
无。
使用示例
package com.huawei.oms.ros.test; import org.apache.http.HttpResponse; import org.apache.http.message.BasicNameValuePair; public class QueryConfigChange { private static final String CONFIGCHANGEPATH = "/rest/openapi/configfile/configchange"; public static void main(String[] args) throws Exception { Login.login(); queryConfigChange(); } public static void queryConfigChange() throws Exception { //set the URL and method String openidURL = CONFIGCHANGEPATH; String method = "GET"; //set headers BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method); //set parameters BasicNameValuePair[] parameters = { new BasicNameValuePair("changeTime", "123456789"), new BasicNameValuePair("pageSize", "20"), new BasicNameValuePair("pageNo", "1"), }; 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": { "configChangeInfo": [ { "neDn": "NE=34622313", "changeTime": 1479450011876, "oldFile": "20161118141713R.cfg", "newFile": "20161118141953R.cfg", "fileType": "r", "added": "ap-group name employee\n", "modified": null, "baseModified": null, "deleted": null, "addNum": 1, "modifyNum": 0, "deleteNum": 0 }], "curPage": 1, "totalPage": 1 }, "description": "" }
查询SSID和VAP模板信息
接口功能
查询SSID模板和VAP模板信息。
URI路径
/rest/openapi/sct/ssid
访问方法
GET
请求示例
GET https://10.120.70.220:32102/rest/openapi/sct/ssid?nedn=NE=34603109&profileType=ssid&profileName=whtest002 Headers: key = openid,value = d21ee8aae2f9c05b2098e82a33b3430b37e1c6980d26004f
参数说明
参数名 |
必选/可选 |
参数位置 |
参数类型 |
参数说明 |
---|---|---|---|---|
openid |
必选 |
请求头参数列表 |
String |
会话标识,用于Open API的鉴权。 说明:
该参数由第三方调用安全管理登录接口获取openid。 |
nedn |
必选 |
请求实体参数列表 |
String |
设备nedn,表示待查询设备在网管上的唯一标识。 |
profileType |
必选 |
请求实体参数列表 |
String |
查询模板类型:
|
profileName |
可选 |
请求实体参数列表 |
String |
请求查询模板名。 说明:
如果模板名参数为空,则查询改设备下所有ssid模板或vap模板信息。 |
返回结果
字段名 |
类型 |
说明 |
---|---|---|
code |
int |
操作返回码。可以是如下值之一:
|
description |
String |
接口调用结果的描述信息。 |
data |
ProfileInfo |
模板信息。 |
ProfileInfo包含以下字段:
字段名 |
类型 |
说明 |
---|---|---|
nedn |
String |
设备标识信息 |
profileType |
String |
查询模板类型 |
vapProfileList |
List<VapProfileInfo> |
vap模板信息 说明:
如果模板类型为ssid,vapProfileList则返回null 。 |
ssidProfileList |
List<SsidProfileInfo> |
ssid模板信息 说明:
如果模板类型为vap,ssidProfileList则返回null 。 |
VapProfileInfo包含以下字段:
字段名 |
类型 |
说明 |
---|---|---|
vapProfileName |
String |
vap模板名 |
referedSsidProfileName |
String |
vap模板引用的ssid模板名 |
referedSsidName |
String |
vap模板引用的ssid模板下的ssid名 |
SsidProfileInfo包含以下字段:
字段名 |
类型 |
说明 |
---|---|---|
ssidProfileName |
String |
ssid模板名 |
ssidName |
String |
ssid模板下的ssid名称 |
响应示例
{ "code":0, "data":"{ "nedn":"NE=34603809", "profileType":"ssid", "vapProfileList":null, "ssidProfileList":[ { "ssidProfileName":"whtest002", "ssidName":"HUAWEI-WLAN" } ] }", "description":"query ssid profile success " }
注意事项
1. 查询接口只适用于AC设备V2R8C10及以后版本。
使用示例1:查询SSID模板
package com.huawei.oms.ros.test; import org.apache.http.HttpResponse; import org.apache.http.message.BasicNameValuePair; public class QuerySsidProfile { private static final String SSIDPROFILEPATH= "/rest/openapi/sct/ssid"; public static void main(String[] args) throws Exception { Login.login(); querySsidProfile(); } public static void querySsidProfile() throws Exception{ String openidURL = "/rest/openapi/sct/ssid"; String method = "GET"; JSONObject model = new JSONObject(); model.put("nedn", "NE=34603809"); model.put("profileType", "ssid"); model.put("profileName", "whtest002"); BasicNameValuePair[] parameters = convertJsonObj(model); // set headers BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method); 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=34603809", "profileType":"ssid", "vapProfileList":null, "ssidProfileList":[ { "ssidProfileName":"whtest002", "ssidName":"HUAWEI-WLAN" } ] }", "description":"query ssid profile success " }
使用示例2:查询VAP模板
package com.huawei.oms.ros.test; import org.apache.http.HttpResponse; import org.apache.http.message.BasicNameValuePair; public class QuerySsidProfile { private static final String SSIDPROFILEPATH= "/rest/openapi/sct/ssid"; public static void main(String[] args) throws Exception { Login.login(); querySsidProfile(); } public static void querySsidProfile() throws Exception{ String openidURL = "/rest/openapi/sct/ssid"; String method = "GET"; JSONObject model = new JSONObject(); model.put("nedn", "NE=34603809"); model.put("profileType", "vap"); model.put("profileName", "whtest002"); BasicNameValuePair[] parameters = convertJsonObj(model); // set headers BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method); 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=34603809", "profileType":"vap", "vapProfileList":[ { "vapProfileName":"whtest002", "referedSsidProfileName":"whtest002", "referedSsidName":"HUAWEI-WLAN" }] "ssidProfileList":null }", "description":"query ssid profile success " }
创建SSID和VAP模板
接口功能
创建SSID和VAP模板。
URI路径
/rest/openapi/sct/ssid
访问方法
POST
请求示例
POST https://10.120.70.220:32102/rest/openapi/sct/ssid?nedn=NE=34603109&ssidProfileName=default&vapProfileName=default$apMacList=22-22-22-22-22-22,22-22-22-22-22-23&apGroupList=eSight,eSight001&wlanId=2&radioId=1 Headers: key = openid,value = d21ee8aae2f9c05b2098e82a33b3430b37e1c6980d26004f
参数说明
参数名 |
必选/可选 |
参数位置 |
参数类型 |
参数说明 |
---|---|---|---|---|
openid |
必选 |
请求头参数列表 |
String |
会话标识,用于Open API的鉴权。 说明:
该参数由第三方调用安全管理登录接口获取openid。 |
nedn |
必选 |
请求实体参数列表 |
String |
设备nedn,表示待查询设备在网管上的唯一标识。 |
ssidProfileName |
必选 |
请求实体参数列表 |
String |
创建的ssid模板名。 |
vapProfileName |
必选 |
请求实体参数列表 |
String |
创建的vap模板名。 |
apMacList |
可选 |
请求实体参数列表 |
String |
设备AP的Mac地址。支持多个Mac,各Mac之间以逗号分隔。 |
apGroupList |
可选 |
请求实体参数列表 |
String |
设备AP组名,支持多个AP组名,各AP组名之间以逗号分隔。 |
wlanId |
可选 |
请求实体参数列表 |
String |
设备AP组下vap模板唯一标识号 说明:
如果apMacList或者apGroupList参数不为空,则wlanId为必选项。 |
radioId |
可选 |
请求实体参数列表 |
int |
radio ID,取值为【0,1,2】。 说明:
如果apMacList或者apGroupList参数不为空,则radioId为必选项。 |
返回结果
字段名 |
类型 |
说明 |
---|---|---|
code |
int |
操作返回码。可以是如下值之一:
|
data |
String |
此处为null。 |
description |
String |
接口调用结果的描述信息。 |
响应示例
{ "code":0, "data":null, "description":"deploy success" }
注意事项
无。
使用示例
package com.huawei.oms.ros.test; import org.apache.http.HttpResponse; import org.apache.http.message.BasicNameValuePair; public class DeploySsidProfile { private static final String SSIDPROFILEPATH= "/rest/openapi/sct/ssid"; public static void main(String[] args) throws Exception { Login.login(); deploySsidProfile(); } public static void deploySsidProfile() throws Exception { String openidURL = "/rest/openapi/sct/ssid"; String method = "POST"; JSONObject model = new JSONObject(); model.put("nedn", "NE=34603809"); model.put("ssidProfileName", "whtest002"); model.put("vapProfileName", "whtest002"); BasicNameValuePair[] parameters = convertJsonObj(model); // set headers BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method); 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":null, "description":"deploy success" }