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}" == "" 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] ... 获取已经存在的策略总量