From aebe4730651bba0fb15125357dc6dbf9adbc52a8 Mon Sep 17 00:00:00 2001 From: dongxiaoyan Date: Thu, 7 May 2020 17:23:25 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E8=B0=83=E6=95=B4=E7=AD=96=E7=95=A5?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=B9=E6=B3=95=EF=BC=8C=E5=92=8C=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=85=A5=E5=8F=82=E4=B8=80=E8=87=B4=202=E3=80=81?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E7=AD=96=E7=95=A5=E6=96=B0=E5=A2=9E=E5=BF=85?= =?UTF-8?q?=E5=A1=AB=E6=97=B6=E9=97=B4=E8=AE=A1=E5=88=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 02-Keyword/tsg_bfapi/PolicyObject.robot | 17 ++++++++++++++--- 02-Keyword/tsg_common/ManagePolicyBody.robot | 10 ++++++---- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/02-Keyword/tsg_bfapi/PolicyObject.robot b/02-Keyword/tsg_bfapi/PolicyObject.robot index 4319673..d8ce907 100644 --- a/02-Keyword/tsg_bfapi/PolicyObject.robot +++ b/02-Keyword/tsg_bfapi/PolicyObject.robot @@ -101,7 +101,12 @@ AddPolicy ${policyId} Set Variable ${response['data']['policyList'][0]['policyId']} ${rescode} Set Variable ${response['code']} [Return] ${rescode} ${policyId} - +QueryPolicy + [Arguments] ${body} + ${response} BaseGetRequest /policy/compile body=${body} + #log ${response} + ${rescode} Set Variable ${response['code']} + [Return] ${rescode} ${response} AddPolicy2 [Arguments] ${returnData} ${policyList} ${body} PolicyParamsOpertion ${returnData} ${policyList} add @@ -112,10 +117,16 @@ AddPolicy2 [Return] ${rescode} ${policyId} EditPolicy - [Arguments] ${policyList} ${opAction} + [Arguments] ${policyList} ${returnData} ${opAction} + + #add:表示新增 + #update:表示修改策略内容,包括策略名称,策略动作,策略动作参数,引用的策略文件,引用的策略对象等有修改时 + #disable:表示停用,只修改isValid属性为0 + #enable:表示启用,只修改isValid属性为1 ${body} PolicyParamsOpertion ${1} ${policyList} ${opAction} ${response} BaseEditRequest /policy/compile ${body} - [Return] ${rescode} + ${rescode} Set Variable ${response['code']} + [Return] ${rescode} ${policyId} ${response} DeletePolicybak [Arguments] ${policyids} diff --git a/02-Keyword/tsg_common/ManagePolicyBody.robot b/02-Keyword/tsg_common/ManagePolicyBody.robot index 7512f04..3b3a372 100644 --- a/02-Keyword/tsg_common/ManagePolicyBody.robot +++ b/02-Keyword/tsg_common/ManagePolicyBody.robot @@ -54,12 +54,14 @@ PolicyParamsOpertion ${return} ${isValid} Run Keyword And Ignore Error Set Variable ${policyList}[isValid] Run Keyword If "${return}"=="FAIL" or "${isValid}"=="${EMPTY}" Set To Dictionary ${policyList} isValid=${Default_IsValid} ${return} ${scheduleId} Run Keyword And Ignore Error Set Variable ${policyList}[scheduleId] - ${scheduleIdV} Run Keyword If "${return}"=="FAIL" or "${scheduleId}"=="${EMPTY}" Evaluate list(map(int, re.split('[,]', '${Default_ScheduleId}'))) re - ... ELSE Evaluate list(map(int, re.split('[,]', '${scheduleId}'))) re + #${scheduleIdV} Run Keyword If "${return}"=="FAIL" or "${scheduleId}"=="${EMPTY}" Evaluate list(map(int, re.split('[,]', '${Default_ScheduleId}'))) re + # ... ELSE Evaluate list(map(int, re.split('[,]', '${scheduleId}'))) re + ${scheduleIdV} Run Keyword If "${return}"!="FAIL" and "${scheduleId}"!="${EMPTY}" and "${scheduleId}"!="${None}" Evaluate list(map(int, re.split('[,]', '${scheduleId}'))) re + ... ELSE Set Variable ${emptyList} + Set To Dictionary ${policyList} scheduleId=${scheduleIdV} ${return} ${appObjectIdArray} Run Keyword And Ignore Error Set Variable ${policyList}[appObjectIdArray] ${appObjectIdArrayV} Run Keyword If "${return}"=="FAIL" or "${appObjectIdArray}"=="${EMPTY}" Evaluate list(map(int, re.split('[,]', '${Default_AppObjectIdArray}'))) re - ... ELSE Evaluate list(map(int, re.split('[,]', '${appObjectIdArray}'))) re - Set To Dictionary ${policyList} scheduleId=${scheduleIdV} + ... ELSE Evaluate list(map(int, re.split('[,]', '${appObjectIdArray}'))) re Set To Dictionary ${policyList} appObjectIdArray=${appObjectIdArrayV} # 固定值 Set To Dictionary ${policyList} policyId= doBlacklist=${0}