-
请求示例 修改一个事务,事务的id是1,事务所属的工程ID是1,包括修改事务的请求信息。 /v1/{project_id}/templates/1
{
"contents" : [ {
"content" : [ {
"content" : {
"body_type" : 0,
"bodys" : [ ],
"check_end_length" : null,
"check_end_str" : null,
"check_end_type" : null,
"connect_timeout" : 5000,
"connect_type" : 1,
"headers" : [ {
"key" : "Content-Type",
"value" : "application/json"
} ],
"http_version" : "HTTP/1.1",
"method" : "GET",
"name" : "Msg-31445",
"protocol_type" : 2,
"return_timeout" : 5000,
"return_timeout_param" : null,
"url" : "https://www.domain-example.com"
},
"content_type" : 2
} ],
"content_id" : 2346,
"index" : 0
} ],
"description" : "",
"enable_pre" : false,
"for_loop_params" : [ ],
"id" : 1,
"name" : "transaction_test",
"project_id" : 1,
"temp_type" : 0
}
-
请求参数 表2 请求Body参数 参数 是否必选 参数类型 描述 id 是 Integer 事务ID project_id 是 Integer 工程ID name 是 String 事务名称 temp_type 否 Integer 事务类型 description 否 String 描述信息 for_loop_params 否 Array of objects 旧版本逻辑控制器字段,当前已未使用 enable_pre 否 Boolean 是否启用预置事务,当前版本已未使用 contents 否 Array of TempContentInfo objects 事务脚本信息 表3 TempContentInfo 参数 是否必选 参数类型 描述 content_id 否 Integer 报文id或者事务ID或者插件ID content 否 Array of Content objects 内容 index 否 Integer 索引 data 否 Object 数据指令内容 data_type 否 Integer 数据指令类型(0:默认请求卡片;1:数据指令;201:循环指令;202:条件指令;301:集合点;203:vu百分比控制器;204:吞吐量控制器;302:插件请求) 表4 Content 参数 是否必选 参数类型 描述 content_type 否 Integer 用例卡片类型(1:思考时间;2:报文;3:检查点;4:变量提取) content 否 ContentInfo object 内容 表5 ContentInfo 参数 是否必选 参数类型 描述 body_type 否 Integer body类型(0:字符串;1:form-data格式;3:x-www-form-urlencoded格式) bodys 否 Array of objects 请求体 check_end_length 否 Object TCP/UDP协议返回数据长度 check_end_str 否 Object TCP/UDP协议返回结束符 check_end_type 否 Object TCP/UDP协议返回结束类型,1:返回数据长度;2:结束符 connect_timeout 否 Integer 超时时间 connect_type 否 Integer 连接设置,当前版本已未使用 headers 否 Array of ContentHeader objects 请求头 http_version 否 String HTTP版本 method 否 String HTTP方法 name 否 String 用例名称 protocol_type 否 Integer 协议类型(1:HTTP;2:HTTPS;3:TCP;4:UDP;7:HLS/RTMP;9:WebSocket;10:HTTP-FLV;11:MQTT) return_timeout 否 Integer 响应超时 return_timeout_param 否 String 响应超时参数 url 否 String 请求地址 rtmp_url 否 String rtmp地址 flv_url 否 String flv地址 bitrate_type 否 Integer 分辨率策略 duration 否 Integer 持续时间 retry_delay 否 Integer HLS重试延迟时间 retry_time 否 Integer HLS重试次数 表6 ContentHeader 参数 是否必选 参数类型 描述 key 否 String 键 value 否 String 值
-
响应示例 返回状态码为200:操作成功 HTTP/1.1 200 OK
Date: Tue,17 May 2022 10:00:00 GMT
Server: example-server
Content-Type: application/json;charset=UTF-8
Content-Length: 250
Connection: keep-alive
{
"huawei-ac-restconf-transactions:output" : {
"native" : {
"dry-run-ne-native-confs-item" : [
{
"ne-id" : "d2f853ed-325e-39dc-aa6b-6cf7782c5300",
"ne-name" : "huawei"
}
]
},
"diff" : {
"dry-run-ne-diff-confs-item" : [
{
"ne-id" : "d2f853ed-325e-39dc-aa6b-6cf7782c5300",
"ne-name" : "huawei",
"ne-cfg-diffs" : [
{
"feature" : "vlan",
"diff-info" : "vlans"
}
]
}
]
},
"mapconf" : {
"service_map_confs" : [
{
"source" : "ne",
"dry-run-map-confs-item" : [
{
"ne-id" : "d2f853ed-325e-39dc-aa6b-6cf7782c5300",
"ne-name" : "huawei"
}
]
}
]
}
}
} 返回状态码为400:请求错误 HTTP/1.1 400 Bad Request
Date: Tue,17 May 2022 10:00:00 GMT
Server: example-server
Content-Type: application/json;charset=UTF-8
Content-Length: 250
Connection: keep-alive
-
请求参数 表1 body参数列表 参数名称 必选 类型 参数值域 默认值 参数说明 参数示例 dry-run-query 是 REFERENCE 详细请参见表2。 试运行查询 - 表2 dry-run-query-input对象的参数列表 参数名称 类型 参数值域 默认值 参数说明 参数示例 huawei-ac-restconf-transactions:input REFERENCE 详细请参见表3。 - - 表3 dry-run-query-input-body对象的参数列表 参数名称 必选 类型 参数值域 默认值 参数说明 参数示例 by-user 否 boolean - false by-user模式 false trans-id 是 string 1~255个字符。 - 事务id "d2f853ed-325e-39dc-aa6b-6cf7782c5300"
-
请求示例 HTTP的示例 POST /restconf/operations/huawei-ac-restconf-transactions:dry-run-query HTTP/1.1
Host: 192.168.1.125:26335
Content-Type: application/json
Accept: application/json
Accept-Language: en-US
X-AUTH-TOKEN: x-yyyyyy
{
"huawei-ac-restconf-transactions:input" : {
"by-user" : false,
"trans-id" : "d2f853ed-325e-39dc-aa6b-6cf7782c5300"
}
}
-
请求示例 HTTP示例1 POST /restconf/v1/data/huawei-ac-applications:applications HTTP/1.1
Host: {ip:port}
Content-Type: application/json
Accept: application/json
Accept-Language: en-US
X-AC
CES S-TOKEN: CA48D152F6B19D84:637C38259E6974E17788348128A430FEE150E874752CE754B6BF855281219925 HTTP示例2 POST /restconf/v1/data/huawei-ac-nes:inventory-cfg/nes/ne/8d394835-cb84-38f3-a4d5-36a7f2074b47
Host: {ip:port}
Content-Type: application/json
Accept: application/json
Accept-Language: en-US
X-ACCESS-TOKEN: CA48D152F6B19D84:637C38259E6974E17788348128A430FEE150E874752CE754B6BF855281219925 body示例 {
"bngBngPairs:bngBngPairs": [
{
"bngBngPairsName": "bngPair",
"bngServiceName": "hbng_ins",
"pairName": "LS01"
}
]
}
-
响应参数 返回状态码为200:编辑成功。 返回状态为400或500:编辑失败。 表2 错误码描述 Status Code Error Code Error Message Parameter 错误说明 500 0x00c80022 {0}下发转发器失败,“{1}”。 {0}:节点名称,“{1}”:详细原因。 下发转发器失败,请检查预配置;如果预配置正确,请根据对应设备的详细错误信息进行分析。 500 0x01600004 业务{0}分解的网元数据{1}存在冲突,请重新编辑。 {0}:业务名称,{1},网元数据Path。 两个业务修改了同一个网元数据,并且数据不一致。 500 0x01600001 事务\"{0}\"已经过期,未下发的配置已经失效。 {0}:用户事务ID。 事务默认5天过期,或者该事务已经被提交。
-
请求参数 表1 参数列表 参数名称 必选 类型 参数值域 默认值 参数说明 neId 否 string 1~255个字符 - 设备id。 xxx 否 string 1~255个字符 - 业务名称。北向API接口根据三方包中的YANG模型动态生成,生成的规则是URI通过“/”拼接三方包中YANG模型各层级节点。body示例中以bng业务为例,实际使用时以所使用的三方包的YANG模型为准,具体使用xxx订制URI的北向API清单请参考附录(可定制编程接口)
-
URI /restconf/v1/data/huawei-ac-applications:applications/{xxx} /restconf/v1/data/huawei-ac-nes-device:nes/ne/[neId]/{xxx} /restconf/v1/data/huawei-ac-nes:inventory-cfg/nes/ne/[neId]/{xxx} /restconf/v1/operations/{xxx} /restconf/v1/operations/huawei-ac-nes:inventory-cfg/nes/ne/{xxx}/{xxx}
-
请求示例 cURL示例 curl -k -s -L -i -X POST -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'Accept-Language: en-US' -H 'X-ACCESS-TOKEN: CA48D152F6B19D84:637C38259E6974E17788348128A430FEE150E874752CE754B6BF855281219925' 'https://{ip:port}/restconf/operations/huawei-ac-restconf-transactions:commit'
-d '{"huawei-ac-applications:input":{"trans-id":"83bac01c-df39-473a-aa27-789549ff98bf"}},"force":false,"no-network":false' HTTP示例 POST /restconf/operations/huawei-ac-restconf-transactions:commit HTTP/1.1
Host: {ip:port}
Content-Type: application/json
Accept: application/json
Accept-Language: en-US
X-ACCESS-TOKEN: CA48D152F6B19D84:637C38259E6974E17788348128A430FEE150E874752CE754B6BF855281219925
-
响应示例 HTTP/1.1 200 OK
Date: Tue,30 Oct 2018 10:00:00 GMT
Server: example-server
Content-Type: application/json;charset=UTF-8
Content-Length: 250
Connection: keep-alive
{
"huawei-ac-restconf-transactions:output": {
"result": true
}
}
-
响应参数 表4 CommitOutput对象的参数列表 参数名称 类型 参数值域 默认值 参数说明 huawei-ac-restconf-transactions:output REFERENCE 详细信息请参见表 huawei-ac-restconf-transactions:output对象的参数列表。 - 表5 huawei-ac-restconf-transactions:output对象的参数列表 参数名称 类型 参数值域 默认值 参数说明 reason string 0~255个字符 - 失败原因。 result boolean - - 是否成功。 extra-info REFERENCE - - 额外异步任务 表6 extra-info对象的参数列表 参数名称 类型 参数值域 默认值 参数说明 async-task-id string 0~255个字符 额外异步任务ID 返回状态码为200:提交成功。 返回状态为400或500:提交失败。 表7 错误码描述 Status Code Error Code Error Message Parameter 错误说明 500 0x00c80022 {0}下发转发器失败,“{1}”。 {0}:节点名称,“{1}”:详细原因。 下发转发器失败,请检查预配置;如果预配置正确,请根据对应设备的详细错误信息进行分析。 400 0x00c80055 {0}重复。 {0} :系统配置。 业务分解出的网元数据与系现存的配置存在重复。 500 0x01600004 业务{0}分解的网元数据{1}存在冲突,请重新编辑。 {0}:业务名称,{1},网元数据Path。 两个业务修改了同一个网元数据,并且数据不一致。 500 0x01600001 事务\"{0}\"已经过期,未下发的配置已经失效。 {0}:用户事务ID。 事务默认5天过期,或者该事务已经被提交。 500 0x00c8004c 设备{0} netconf通信失败。 {0}:转发器ID。 设备netconf协议断链。
-
请求参数 表1 body参数列表 参数名称 必选 类型 参数值域 默认值 参数说明 commitInput 是 REFERENCE 详细信息请参见表 commitInput对象的参数列表。 提交修改参数。 表2 commitInput对象的参数列表 参数名称 必选 类型 参数值域 默认值 参数说明 huawei-ac-restconf-transactions:input 否 REFERENCE 详细信息请参见表 huawei-ac-restconf-transactions:commit 对象的参数列表。 - 表3 huawei-ac-restconf-transactions:commit 对象的参数列表 参数名称 必选 类型 参数值域 默认值 参数说明 trans-id 是 string 1~255个字符 - 事务ID。 force 否 boolean - false 是否强制提交。当为true,强制下发配置到设备。 no-network 否 boolean - false 是否将配置发送到设备。当为false,将配置下发到设备。 async-execution 否 boolean - false 是否异步执行。如果为true,将通过任务管理下发 only-service 否 boolean - false 是否不分解和部署到设备。 service-parallel 否 boolean - false 是否并行执行。 by-user 否 boolean - false 是否是用户操作模式。 time-out 否 int - - 设置超时时间
-
请求参数 表1 body参数列表 参数名称 必选 类型 参数值域 默认值 参数说明 resetInput 是 REFERENCE 详细信息请参见表 resetInput对象的参数列表。 撤销事务参数。 表2 resetInput对象的参数列表 参数名称 必选 类型 参数值域 默认值 参数说明 huawei-ac-restconf-transactions:input 否 REFERENCE 详细信息请参见表 huawei-ac-restconf-transactions:input对象的参数列表。 - 表3 huawei-ac-restconf-transactions:input对象的参数列表 参数名称 必选 类型 参数值域 默认值 参数说明 trans-id 是 string 1~255个字符 - 事务ID。
-
请求示例 cURL示例 curl -k -s -L -i -X POST -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'Accept-Language: en-US' -H 'X-ACCESS-TOKEN: CA48D152F6B19D84:637C38259E6974E17788348128A430FEE150E874752CE754B6BF855281219925' 'https://{ip:port}/restconf/operations/huawei-ac-restconf-transactions:reset'
-d '{"huawei-ac-applications:input":{"trans-id":"3d80e8be-7b7e-469b-acd6-034dabbaed6e"}}' HTTP示例 POST /restconf/operations/huawei-ac-restconf-transactions:reset HTTP/1.1
Host: {ip:port}
Content-Type: application/json
Accept: application/json
Accept-Language: en-US
X-ACCESS-TOKEN: CA48D152F6B19D84:637C38259E6974E17788348128A430FEE150E874752CE754B6BF855281219925