diff options
| author | hebingning <[email protected]> | 2021-05-20 15:44:51 +0800 |
|---|---|---|
| committer | hebingning <[email protected]> | 2021-05-20 15:44:51 +0800 |
| commit | a151dab2401c0e1b82194bd4c731d776bb889d10 (patch) | |
| tree | 92100613c7742f799ba14235391434437a7434d0 | |
| parent | e8144eda6b1ae0db28a430c0c471a5f241833137 (diff) | |
关键字GetVerifyState,用于校验策略验证时返回策略的状态,补充提交删除默认allow策略时的categoryids参数
| -rw-r--r-- | 02-Keyword/tsg_bfapi/LoginLogout.robot | 5 | ||||
| -rw-r--r-- | 02-Keyword/tsg_bfapi/policy_object/Policy.robot | 16 |
2 files changed, 19 insertions, 2 deletions
diff --git a/02-Keyword/tsg_bfapi/LoginLogout.robot b/02-Keyword/tsg_bfapi/LoginLogout.robot index 7f9f5ba..58cc5e8 100644 --- a/02-Keyword/tsg_bfapi/LoginLogout.robot +++ b/02-Keyword/tsg_bfapi/LoginLogout.robot @@ -173,6 +173,7 @@ SecurityPolicy-Allow-TSGUIAPI-DEL log toDelTSGUIAPI #${policyId1} set Variable {"policyType":"tsg_security","policyIds":[${testBifangPolicy}]} #${policyIds} Create List ${testBifangPolicy} - ${objectIds} Create List ${testBifangIP} - DeletePolicyAndGroupObject ${testBifangPolicy} ${objectIds} + ${objectIds} Create List ${testBifangIP} + ${categories} Create List + DeletePolicyAndGroupObject ${testBifangPolicy} ${objectIds} ${categories} log delTSGUIAPISucess
\ No newline at end of file diff --git a/02-Keyword/tsg_bfapi/policy_object/Policy.robot b/02-Keyword/tsg_bfapi/policy_object/Policy.robot index c1a2c8e..f24eb2e 100644 --- a/02-Keyword/tsg_bfapi/policy_object/Policy.robot +++ b/02-Keyword/tsg_bfapi/policy_object/Policy.robot @@ -56,6 +56,7 @@ AddPolicies ... ELSE IF "${dictType}" == "<class 'dict'>" PolicyDataOperation ${returnData} ${policyList} add ${version}
... ELSE Set Variable ${EMPTY}
#${body} Set Variable {"opAction":"add","policyList":{"policyName":"wx-test","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"SSL","method":"drop"},"source":[{"objectId":3101,"protocolField":"TSG_SECURITY_SOURCE_ADDR"}],"destination":[],"filterList":[{"filter":[{"objectId":3404,"protocolField":"TSG_FIELD_SSL_CN"}]}],"appIdObjects":[3],"isValid":0,"scheduleId":[]}}
+ log ${body}
${response} BasePostRequestForV2 ${policyUrl} ${body} ${version}
${policyIds} Run Keyword If "${returnData}" == "1" Get-PolicyIds ${response}
... ELSE Create List
@@ -185,6 +186,21 @@ VerifyPolicies ${rescode} Set Variable ${response['code']}
Should Be Equal As Strings ${rescode} 200
[Return] ${rescode} ${response['data']}
+
+GetVerifyState
+ [Documentation]
+ ... 传入VerifyPolicies返回的resData值
+ ... 以及已知的被命中的策略id
+ [Arguments] ${resData} ${policyId}
+ ${len} Get Length ${resData['hitPolicyList']}
+ ${policyState} Create Dictionary
+ FOR ${n} IN RANGE ${len}
+ Set To Dictionary ${policyState} '${resData['hitPolicyList'][${n}]['policyId']}'=${resData['hitPolicyList'][${n}]['isExecutePolicy']}
+ END
+ log ${policyState}
+ ${State} Get From Dictionary ${policyState} '${policyId}'
+ Should Be Equal As Strings ${State} True
+
GetPolicyTotal
[Documentation]
... 获取已经存在的策略总量
|
