From a151dab2401c0e1b82194bd4c731d776bb889d10 Mon Sep 17 00:00:00 2001 From: hebingning Date: Thu, 20 May 2021 15:44:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=B3=E9=94=AE=E5=AD=97GetVerifyState?= =?UTF-8?q?=EF=BC=8C=E7=94=A8=E4=BA=8E=E6=A0=A1=E9=AA=8C=E7=AD=96=E7=95=A5?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=E6=97=B6=E8=BF=94=E5=9B=9E=E7=AD=96=E7=95=A5?= =?UTF-8?q?=E7=9A=84=E7=8A=B6=E6=80=81=EF=BC=8C=E8=A1=A5=E5=85=85=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=E5=88=A0=E9=99=A4=E9=BB=98=E8=AE=A4allow=E7=AD=96?= =?UTF-8?q?=E7=95=A5=E6=97=B6=E7=9A=84categoryids=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 02-Keyword/tsg_bfapi/LoginLogout.robot | 5 +++-- 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}" == "" 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] ... 获取已经存在的策略总量