2021-04-26 09:38:04 +08:00
|
|
|
|
*** Settings ***
|
|
|
|
|
|
Library Collections
|
|
|
|
|
|
Library RequestsLibrary
|
|
|
|
|
|
Resource ../../../03-Variable/BifangApiVariable.txt
|
|
|
|
|
|
Resource ../../../02-Keyword/tsg_bfapi/policy_file_interface/FunctionalKeywords.robot
|
|
|
|
|
|
Resource ProcessObjectBody.robot
|
|
|
|
|
|
Library Collections
|
|
|
|
|
|
Resource ../Common.robot
|
|
|
|
|
|
Library ../../../04-CustomLibrary/Library/fileOperations.py
|
|
|
|
|
|
Library DatabaseLibrary
|
|
|
|
|
|
|
|
|
|
|
|
*** Variables ***
|
|
|
|
|
|
${applicationUrl} /application
|
|
|
|
|
|
${signatureUrl} /application/signatures
|
|
|
|
|
|
*** Keywords ***
|
|
|
|
|
|
AddSignature
|
|
|
|
|
|
[Arguments] ${signaturereqbody}
|
|
|
|
|
|
[Documentation] 新增Signature,返回Signature ID
|
|
|
|
|
|
${response} BasePostRequestForV2 ${signatureUrl} ${signaturereqbody} ${version}
|
|
|
|
|
|
${rescode} Set Variable ${response['code']}
|
|
|
|
|
|
${signatureId} Set Variable ${response['data']['signatures'][0]['signatureId']}
|
|
|
|
|
|
Should Be Equal As Strings ${rescode} 200
|
|
|
|
|
|
[Return] ${signatureId}
|
|
|
|
|
|
AddApplication
|
|
|
|
|
|
[Arguments] ${appreqbody}
|
|
|
|
|
|
[Documentation] 新增Application,返回APPIDObject
|
|
|
|
|
|
${response} BasePostRequestForV2 ${applicationUrl} ${appreqbody} ${version}
|
|
|
|
|
|
${rescode} Set Variable ${response['code']}
|
|
|
|
|
|
${appids} Set Variable ${response['data']['appObj']['appId']}
|
|
|
|
|
|
Should Be Equal As Strings ${rescode} 200
|
|
|
|
|
|
[Return] ${appids}
|
|
|
|
|
|
GetAppIdObjects
|
|
|
|
|
|
[Arguments] ${appids}
|
|
|
|
|
|
[Documentation] 通过APPID查询Application,返回APPIDObject
|
|
|
|
|
|
${response} BaseFormRequest ${applicationUrl} appIds=${appids} ${version}
|
|
|
|
|
|
${rescode} Set Variable ${response['code']}
|
|
|
|
|
|
${appidobject} Set Variable ${response['data']['list'][0]['objectId']}
|
|
|
|
|
|
Should Be Equal As Strings ${rescode} 200
|
|
|
|
|
|
[Return] ${appidobject}
|
|
|
|
|
|
|
|
|
|
|
|
DeletePolicyAndObjectAndApplicationAndSignature
|
2021-05-14 15:57:06 +08:00
|
|
|
|
[Arguments] ${policyids} ${objectids} ${appids}=${EMPTY} ${signatureId}=${EMPTY} ${policyids1}=${EMPTY} ${url}=${EMPTY} ${profiledId}=${EMPTY}
|
2021-04-26 09:38:04 +08:00
|
|
|
|
#删除和对象
|
|
|
|
|
|
#2020-09-01修改,引用DeletePolicyAndGroupObject,避免分别维护并兼容之前用例
|
|
|
|
|
|
Run Keyword If "${policyids}"=="${EMPTY}" log no policyids to del
|
|
|
|
|
|
... ELSE DeletePolicyNew ${policyids}
|
2021-05-14 15:57:06 +08:00
|
|
|
|
|
|
|
|
|
|
Run Keyword If "${policyids1}"=="${EMPTY}" log no policyids to del
|
|
|
|
|
|
... ELSE DeletePolicyNew1 ${policyids1}
|
2021-04-26 09:38:04 +08:00
|
|
|
|
|
|
|
|
|
|
Run Keyword If "${appids}"=="${EMPTY}" log no appids to del
|
|
|
|
|
|
... ELSE DeleteApplicationNew ${appids}
|
|
|
|
|
|
|
|
|
|
|
|
Run Keyword If "${signatureId}"=="${EMPTY}" log no appids to del
|
|
|
|
|
|
... ELSE DeleteSignatureNew ${signatureId}
|
|
|
|
|
|
|
2021-04-27 18:25:53 +08:00
|
|
|
|
Run Keyword If "${objectids}"=="${EMPTY}" log no Objects to del
|
|
|
|
|
|
... ELSE DeleteObjectNew ${objectids}
|
2021-04-26 09:38:04 +08:00
|
|
|
|
|
2021-05-14 15:57:06 +08:00
|
|
|
|
#删除文件
|
|
|
|
|
|
|
|
|
|
|
|
Run Keyword If "${profiledId}"=="${EMPTY}" log no file to del
|
|
|
|
|
|
... ELSE DeletePolicyFile2 ${url} ${profiledId}
|
|
|
|
|
|
|
2021-04-26 09:38:04 +08:00
|
|
|
|
DeleteApplicationNew
|
|
|
|
|
|
[Arguments] ${appids}
|
|
|
|
|
|
#删除Application
|
|
|
|
|
|
${response} BaseDeleteRequest /${version}/application {"appIds":[${appids}]}
|
|
|
|
|
|
${response_code} Get From Dictionary ${response} code
|
|
|
|
|
|
Should Be Equal As Strings ${response_code} 200
|
|
|
|
|
|
${response} Convert to String ${response}
|
|
|
|
|
|
log ${response}
|
|
|
|
|
|
|
|
|
|
|
|
DeleteSignatureNew
|
|
|
|
|
|
[Arguments] ${signatureId}
|
|
|
|
|
|
#删除Signature
|
|
|
|
|
|
${response} BaseDeleteRequest /${version}/application/signatures {"signatureIds":[${signatureId}]}
|
|
|
|
|
|
${response_code} Get From Dictionary ${response} code
|
|
|
|
|
|
Should Be Equal As Strings ${response_code} 200
|
|
|
|
|
|
${response} Convert to String ${response}
|
|
|
|
|
|
log ${response}
|
|
|
|
|
|
|
|
|
|
|
|
DeleteObjectNew
|
|
|
|
|
|
[Arguments] ${objectids}
|
|
|
|
|
|
#删除对象
|
|
|
|
|
|
log todeleteobj
|
|
|
|
|
|
${response} BaseDeleteRequest /${version}/policy/object {"objectIds":[${objectids}]}
|
|
|
|
|
|
${response_code} Get From Dictionary ${response} code
|
|
|
|
|
|
Should Be Equal As Strings ${response_code} 200
|
|
|
|
|
|
${response} Convert to String ${response}
|
|
|
|
|
|
log ${response}
|
|
|
|
|
|
|
|
|
|
|
|
DeletePolicyNew
|
|
|
|
|
|
[Arguments] ${policyids}
|
|
|
|
|
|
#删除策略
|
|
|
|
|
|
log toDeletePolicy_DeletePolicyDeletePolicy
|
|
|
|
|
|
${response} BaseDeleteRequest /${version}/policy/compile {"policyType":"tsg_security","policyIds":[${policyids}]}
|
|
|
|
|
|
${response_code} Get From Dictionary ${response} code
|
|
|
|
|
|
Should Be Equal As Strings ${response_code} 200
|
|
|
|
|
|
${response} Convert to String ${response}
|
2021-05-14 15:57:06 +08:00
|
|
|
|
log ${response}
|
|
|
|
|
|
|
|
|
|
|
|
DeletePolicyNew1
|
|
|
|
|
|
[Arguments] ${policyids}
|
|
|
|
|
|
#删除策略
|
|
|
|
|
|
log toDeletePolicy_DeletePolicyDeletePolicy
|
|
|
|
|
|
${response} BaseDeleteRequest /${version}/policy/compile {"policyType":"pxy_manipulation","policyIds":[${policyids}]}
|
|
|
|
|
|
${response_code} Get From Dictionary ${response} code
|
|
|
|
|
|
Should Be Equal As Strings ${response_code} 200
|
|
|
|
|
|
${response} Convert to String ${response}
|
|
|
|
|
|
log ${response}
|
|
|
|
|
|
|
|
|
|
|
|
DeletePolicyFile2
|
|
|
|
|
|
[Arguments] ${url} ${profileId}
|
|
|
|
|
|
#删除文件
|
|
|
|
|
|
log todeleteobj_DeletePolicyAndObject
|
|
|
|
|
|
log todeleteobj
|
|
|
|
|
|
${response} BaseDeleteRequest ${url} {"profileIds":[${profileId}]}
|
|
|
|
|
|
${response_code} Get From Dictionary ${response} code
|
|
|
|
|
|
Should Be Equal As Strings ${response_code} 200
|
|
|
|
|
|
${response} Convert to String ${response}
|
2021-04-26 09:38:04 +08:00
|
|
|
|
log ${response}
|