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}