修改接口的地址前缀全部使用配置文件版本
This commit is contained in:
@@ -36,7 +36,7 @@ PolicyVertify
|
||||
${resultObj} Create Dictionary verifyList=${verifyList}
|
||||
|
||||
${json} json.Dumps ${resultObj} ensure_ascii=False
|
||||
${response} BasePostRequest /v1/policy/verify body=${json}
|
||||
${response} BasePostRequest /policy/verify body=${json}
|
||||
Log REQ = ${json}
|
||||
Log RES = ${response}
|
||||
Should Be True ${response['code']} == 200
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
*** Settings ***
|
||||
Resource ../../03-Variable/BifangApiVariable.txt
|
||||
Library REST http://${host}:${port}
|
||||
Library REST http://${host}:${port}/${version}
|
||||
Library Collections
|
||||
Library RequestsLibrary
|
||||
|
||||
@@ -19,7 +19,7 @@ BasePostRequest
|
||||
BaseDeleteRequest
|
||||
[Arguments] ${requestUri} ${data}
|
||||
${headers} set variable {"Authorization":"${token}","Content-Type":"application/json"}
|
||||
create session api http://${host}:${port} ${headers}
|
||||
create session api http://${host}:${port}/${version} ${headers}
|
||||
${response}= Delete Request api ${requestUri} data=${data}
|
||||
log return data =${response}
|
||||
Should Be Equal As Strings ${response.status_code} 200
|
||||
@@ -29,7 +29,7 @@ BaseDeleteRequest
|
||||
BaseEditRequest
|
||||
[Arguments] ${requestUri} ${data}
|
||||
${headers} set variable {"Authorization":"${token}","Content-Type":"application/json"}
|
||||
create session api http://${host}:${port} ${headers}
|
||||
create session api http://${host}:${port}/${version} ${headers}
|
||||
${response}= Put Request api ${requestUri} data=${data}
|
||||
log return data =${response}
|
||||
Should Be Equal As Strings ${response.status_code} 200
|
||||
|
||||
@@ -4,13 +4,13 @@ Library RequestsLibrary
|
||||
Library OperatingSystem
|
||||
Library Collections
|
||||
Library string
|
||||
Library REST http://${host}:${port}
|
||||
Library REST http://${host}:${port}/${version}
|
||||
|
||||
*** Keywords ***
|
||||
GetLogCondition
|
||||
[Arguments] ${logname} ${startTime} ${endTime} ${client_ip} ${policy_id}
|
||||
Set Headers {"Content-Type":"application/x-www-form-urlencoded","Authorization":"${token}"}
|
||||
&{LogSchemaResponse}= GET /v1/log/schema?logType=${logname}
|
||||
&{LogSchemaResponse}= GET /log/schema?logType=${logname}
|
||||
log ${logname}
|
||||
#Output Schema response body
|
||||
Object response body
|
||||
@@ -35,7 +35,7 @@ PostRemoteData
|
||||
GetALLLogCondition
|
||||
[Arguments] ${logname} ${startTime} ${endTime} ${client_ip} ${policy_id} ${pageSize} ${pageNo}
|
||||
Set Headers {"Content-Type":"application/x-www-form-urlencoded","Authorization":"${token}"}
|
||||
&{LogSchemaResponse}= GET /v1/log/schema?logType=${logname}
|
||||
&{LogSchemaResponse}= GET /log/schema?logType=${logname}
|
||||
log ${logname}
|
||||
#Output Schema response body
|
||||
Object response body
|
||||
@@ -53,7 +53,7 @@ GetALLLogCondition
|
||||
GetLogCountConditon
|
||||
[Arguments] ${logname} ${startTime} ${endTime} ${client_ip} ${policy_id} ${pageSize} ${pageNo}
|
||||
Set Headers {"Content-Type":"application/x-www-form-urlencoded","Authorization":"${token}"}
|
||||
&{LogSchemaResponse}= GET /v1/log/schema?logType=${logname}
|
||||
&{LogSchemaResponse}= GET /log/schema?logType=${logname}
|
||||
log ${logname}
|
||||
#Output Schema response body
|
||||
Object response body
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
*** Settings ***
|
||||
Resource ../../03-Variable/BifangApiVariable.txt
|
||||
Library REST http://${host}:${port}
|
||||
Library REST http://${host}:${port}/${version}
|
||||
Library Collections
|
||||
Library SSHLibrary
|
||||
Resource PolicyObject.robot
|
||||
@@ -13,7 +13,7 @@ Login
|
||||
[Tags] tsg_adc tsg_bf_api
|
||||
#[Arguments] ${username} ${password} ${authmode} ${authCode} ${ldapId}
|
||||
# 毕方接口用户名密码
|
||||
GET /v1/user/encryptpwd?password=${password}
|
||||
GET /user/encryptpwd?password=${password}
|
||||
Object response body
|
||||
#OUTPUT response body
|
||||
#${rescode} Integer $.code
|
||||
@@ -33,7 +33,7 @@ Login
|
||||
#getToken##################################################################################
|
||||
#log ${username}
|
||||
#log ${pwdstr}
|
||||
POST /v1/user/login?username=${username}&password=${encodePassword}&authMode=${authmode}
|
||||
POST /user/login?username=${username}&password=${encodePassword}&authMode=${authmode}
|
||||
Object response body
|
||||
#OUTPUT response body
|
||||
Integer $.code 200
|
||||
@@ -51,7 +51,7 @@ Login
|
||||
|
||||
Logout
|
||||
[Tags] tsg_adc tsg_bf_api
|
||||
POST /v1/user/logout headers=${headers}
|
||||
POST /user/logout headers=${headers}
|
||||
Object response body
|
||||
Integer $.code 200
|
||||
${rescode} Integer $.code
|
||||
|
||||
@@ -3,7 +3,7 @@ Resource ../../03-Variable/BifangApiVariable.txt
|
||||
Resource ../tsg_common/ManagePolicyBody.robot
|
||||
Resource ../tsg_common/ManageObjectBody.robot
|
||||
Resource ../../02-Keyword/tsg_bfapi/policy_file_interface/FunctionalKeywords.robot
|
||||
Library REST http://${host}:${port}
|
||||
Library REST http://${host}:${port}/${version}
|
||||
Library Collections
|
||||
Library RequestsLibrary
|
||||
Resource Common.robot
|
||||
@@ -52,17 +52,17 @@ AddLocalIPObject
|
||||
|
||||
DelLocalIPObject
|
||||
log to_DelLocalIPObject
|
||||
${response} BaseDeleteRequest /v1/policy/object {"objectIds":[${testClentID}]}
|
||||
${response} BaseDeleteRequest /policy/object {"objectIds":[${testClentID}]}
|
||||
#${response_code} Get From Dictionary ${response} code
|
||||
#Should Be Equal As Strings ${response} {'code': 200, 'msg': 'Success', 'success': True}
|
||||
SET GLOBAL VARIABLE ${testClentID} ${EMPTY}
|
||||
${response} BaseDeleteRequest /v1/policy/object {"objectIds":[${testClentSubID}]}
|
||||
${response} BaseDeleteRequest /policy/object {"objectIds":[${testClentSubID}]}
|
||||
SET GLOBAL VARIABLE ${testClentSubID} ${EMPTY}
|
||||
|
||||
AddObject
|
||||
[Arguments] ${body}
|
||||
#addIPobject#################################################################################
|
||||
${response} BasePostRequest /v1/policy/object body=${body}
|
||||
${response} BasePostRequest /policy/object body=${body}
|
||||
#log ${response}
|
||||
${objectId} Set Variable ${response['data']['objectList'][0]['objectId']}
|
||||
${rescodeReturn} Set Variable ${response['code']}
|
||||
@@ -72,7 +72,7 @@ AddObject2
|
||||
[Arguments] ${returnData} ${policyList}
|
||||
${body} ObjectParamsOpertion ${returnData} ${policyList}
|
||||
|
||||
${response} BasePostRequest /v1/policy/object body=${body}
|
||||
${response} BasePostRequest /policy/object body=${body}
|
||||
${objectId} Set Variable ${response['data']['objectList'][0]['objectId']}
|
||||
${rescodeReturn} Set Variable ${response['code']}
|
||||
[Return] ${rescodeReturn} ${objectId}
|
||||
@@ -84,7 +84,7 @@ EditObject
|
||||
DeleteObjectbak
|
||||
[Arguments] ${objectids}
|
||||
${body} String {"objectIds":[${objectids}]}
|
||||
DELETE /v1/policy/object body=${body} headers=${headers}
|
||||
DELETE /policy/object body=${body} headers=${headers}
|
||||
Object response body
|
||||
log DeleteObject
|
||||
log dxytestOUtputstart
|
||||
@@ -96,7 +96,7 @@ DeleteObjectbak
|
||||
|
||||
AddPolicy
|
||||
[Arguments] ${body}
|
||||
${response} BasePostRequest /v1/policy/compile body=${body}
|
||||
${response} BasePostRequest /policy/compile body=${body}
|
||||
#log ${response}
|
||||
${policyId} Set Variable ${response['data']['policyList'][0]['policyId']}
|
||||
${rescode} Set Variable ${response['code']}
|
||||
@@ -104,22 +104,23 @@ AddPolicy
|
||||
|
||||
AddPolicy2
|
||||
[Arguments] ${returnData} ${policyList}
|
||||
${body} PolicyParamsOpertion ${returnData} ${policyList}
|
||||
${body} PolicyParamsOpertion ${returnData} ${policyList} add
|
||||
|
||||
${response} BasePostRequest /v1/policy/compile body=${body}
|
||||
${response} BasePostRequest /policy/compile body=${body}
|
||||
${policyId} Set Variable ${response['data']['policyList'][0]['policyId']}
|
||||
${rescode} Set Variable ${response['code']}
|
||||
[Return] ${rescode} ${policyId}
|
||||
|
||||
EditPolicy
|
||||
[Arguments] ${body}
|
||||
${response} BaseEditRequest /v1/policy/compile ${body}
|
||||
[Arguments] ${policyList} ${opAction}
|
||||
${body} PolicyParamsOpertion ${1} ${policyList} ${opAction}
|
||||
${response} BaseEditRequest /policy/compile ${body}
|
||||
[Return] ${rescode}
|
||||
|
||||
DeletePolicybak
|
||||
[Arguments] ${policyids}
|
||||
${body} String {"policyType":"tsg_security","policyIds":[${policyids}]}
|
||||
DELETE /v1/policy/compile body=${body} headers=${headers}
|
||||
DELETE /policy/compile body=${body} headers=${headers}
|
||||
Object response body
|
||||
log DeletePolicy
|
||||
Output response body
|
||||
@@ -131,7 +132,7 @@ DeletePolicy
|
||||
[Arguments] ${body}
|
||||
#删除策略
|
||||
log toDeletePolicy_DeletePolicyDeletePolicy
|
||||
${response} BaseDeleteRequest /v1/policy/compile ${body}
|
||||
${response} BaseDeleteRequest /policy/compile ${body}
|
||||
#{"policyType":"tsg_security","policyIds":[${policyids}]}
|
||||
${response_code} Get From Dictionary ${response} code
|
||||
Should Be Equal As Strings ${response_code} 200
|
||||
@@ -143,7 +144,7 @@ DeleteObject
|
||||
[Arguments] ${objectids}
|
||||
#删除对象
|
||||
log todeleteobj
|
||||
${response} BaseDeleteRequest /v1/policy/object {"objectIds":[${objectids}]}
|
||||
${response} BaseDeleteRequest /policy/object {"objectIds":[${objectids}]}
|
||||
${response_code} Get From Dictionary ${response} code
|
||||
#log aaaaaaaaaa:${response_code}
|
||||
Should Be Equal As Strings ${response_code} 200
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
*** Settings ***
|
||||
Resource ../../03-Variable/BifangApiVariable.txt
|
||||
Library REST http://${host}:${port}
|
||||
Library REST http://${host}:${port}/${version}
|
||||
Library Collections
|
||||
Library RequestsLibrary
|
||||
Resource Common.robot
|
||||
@@ -9,7 +9,7 @@ Resource Common.robot
|
||||
ApiAddTags
|
||||
[Arguments] ${body}
|
||||
#ApiAddTags#################################################################################
|
||||
${response} BasePostRequest /v1/customize/tags body=${body}
|
||||
${response} BasePostRequest /customize/tags body=${body}
|
||||
#log ${response}
|
||||
${tagId} Set Variable ${response['data']['tagList'][0]['id']}
|
||||
${rescodeReturn} Set Variable ${response['code']}
|
||||
@@ -23,7 +23,7 @@ ApiDeleteTags
|
||||
[Arguments] ${body}
|
||||
#删除策略
|
||||
log toApiDeleteTags
|
||||
${response} BaseDeleteRequest /v1/customize/tags ${body}
|
||||
${response} BaseDeleteRequest /customize/tags ${body}
|
||||
${response_code} Get From Dictionary ${response} code
|
||||
Should Be Equal As Strings ${response_code} 200
|
||||
${response} Convert to String ${response}
|
||||
|
||||
@@ -18,7 +18,7 @@ ${Tsg_Passwd} tsg_passwd
|
||||
# tsg_help指令返回值对比文件路径
|
||||
${Tsg_Help_file_Path} cli_files/tsg_help.txt
|
||||
# tsg_show指令查询时附加sql条件
|
||||
${Tsg_Show_Added_Sql} "order by time desc limit 20 "
|
||||
${Tsg_Show_Added_Sql} "order by time desc limit 1"
|
||||
${Tsg_Show_Added_Sql_Query} --query
|
||||
# tsg_show指令返回数据flowType和sled参数值
|
||||
${Tsg_Show_FlowType_Values} inline|intercomm|mirror
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
*** Settings ***
|
||||
Resource ../../03-Variable/BifangApiVariable.txt
|
||||
Library REST http://${host}:${port}
|
||||
Library REST http://${host}:${port}/${version}
|
||||
Library Collections
|
||||
Library ExtensionLibrary
|
||||
Resource ../tsg_bfapi/LoginLogout.robot
|
||||
|
||||
@@ -33,7 +33,7 @@ PolicyParamsOpertion
|
||||
... policyList: 必传,字典类型。字典内可选参数信息:
|
||||
... 其它参数默认值见../../03-Variable/PolicyObjectDefault.txt
|
||||
|
||||
[Arguments] ${returnData} ${policyList}
|
||||
[Arguments] ${returnData} ${policyList} ${opAction}
|
||||
${emptyList} Create List
|
||||
# 断言必传参数
|
||||
# Should Not Be Empty ${policyList}[policyType]
|
||||
@@ -79,7 +79,7 @@ PolicyParamsOpertion
|
||||
Run Keyword If "${policyType}"=="active_defence" Set To Dictionary ${policyList} referenceObject=${active_defence_emptyList}
|
||||
Run Keyword If "${policyType}"=="active_defence" Set To Dictionary ${policyList} appObjectIdArray=${active_defence_emptyList}
|
||||
# 转为json结构并返回
|
||||
${dict} Create Dictionary opAction=add returnData=${returnData} policyList=${policyList}
|
||||
${dict} Create Dictionary opAction=${opAction} returnData=${returnData} policyList=${policyList}
|
||||
${json} json.Dumps ${dict} ensure_ascii=False
|
||||
${json} Replace String ${json} "method:rst" ${userRegion}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user