21.05版关键字修改

This commit is contained in:
hebingning
2021-05-17 09:57:31 +08:00
parent c7edf5e738
commit 17aa195375
28 changed files with 293 additions and 67 deletions

View File

@@ -4,7 +4,7 @@ Resource ../tsg_common/ManagePolicyBody.robot
Resource ../tsg_common/ManageObjectBody.robot
Resource ../../02-Keyword/tsg_bfapi/policy_file_interface/FunctionalKeywords.robot
Resource ../../02-Keyword/tsg_bfapi/policy_object/Object.robot
Resource ../../02-Keyword/tsg_adc/FileOperation.robot
#Resource ../../02-Keyword/tsg_adc/FileOperation.robot
Library REST http://${host}:${port}
Library Collections
Library RequestsLibrary
@@ -348,11 +348,14 @@ DeleteProfiles
Run Keyword If "${profile}"!="" and ${profile}!="${EMPTY}" DeleteProfile ${profile}[typeUrl] ${profile}[profileIds]
END
DeletePolicyAndObject
[Arguments] ${policyids} ${objectids}
[Arguments] ${policyids} ${objectids} ${categoriesId}=null
#删除和对象
#2020-09-01修改引用DeletePolicyAndGroupObject避免分别维护并兼容之前用例
# log ${categoriesId}
${objectId1} Create List [${objectids}]
DeletePolicyAndGroupObject ${policyIds} ${objectId1}
# log ${categoryId1}
${categoryId1} Create List [${categoriesId}]
DeletePolicyAndGroupObject ${policyIds} ${objectId1} ${categoryId1}
#删除策略
#log toDeletePolicy_DeletePolicyAndObject
@@ -369,7 +372,7 @@ DeletePolicyAndObject
# ... ELSE DeleteObject ${objectids}
DeletePolicyAndGroupObject
[Arguments] ${policyids} ${objectids}
[Arguments] ${policyids} ${objectids} ${categoriesId}
#引用此关键字,${objectids}参数必须是双层列表eg['[1]','[2,3]','[4,5,6,7]']
#删除和对象
#删除策略
@@ -380,9 +383,15 @@ DeletePolicyAndGroupObject
#删除对象
log todeleteobj_DeletePolicyAndObject
log ${objectids}
log ${categoriesId}
Run Keyword If "${objectids}"=="${EMPTY}" log no Objects to del
... ELSE IF ${objectids}==['[]'] log no Objects to del
... ELSE DeleteGroupObjects ${objectids}
# ... ELSE IF "${categoryids}"=="${EMPTY}" or ${categoryids}==['[]'] log no Categories to del
# ... ELSE IF ${categoryids}==['[]'] log no Categories to del
... ELSE DeleteGroupObjects ${objectids}
log ${categoriesId}
Run Keyword If "${categoriesId}"=="${EMPTY}" or ${categoriesId}==['[null]'] or ${categoriesId}==['[]'] log no Categories to del
... ELSE DeleteGroupCategories ${categoriesId}
DeletePolicys
[Arguments] ${policyids}
${listlenth}= Get Length ${policyids}
@@ -391,20 +400,53 @@ DeletePolicys
DeletePolicy ${policyids}[${var}]
END
DeleteGroupObjects
[Arguments] ${objectids}
[Arguments] ${objectids}
FOR ${var} IN @{objectids}
log ${var}
DeleteGroupObject ${var}
END
DeleteGroupCategories
[Arguments] ${categoryids}
FOR ${var} IN @{categoryids}
log ${var}
DeleteGroupCategory ${var}
END
DeleteGroupObject
[Arguments] ${objectids}
[Arguments] ${objectids}
#删除对象
log todeleteobj
log todeleteobjAndCategory
${response} BaseDeleteRequest /${version}/policy/object {"objectIds":${objectids}}
${response_code} Get From Dictionary ${response} code
Should Be Equal As Strings ${response_code} 200
${response} Convert to String ${response}
# ${response} BaseDeleteRequest /${version}/policy/object {"objectIds":${objectids}}
# ${response_code} Get From Dictionary ${response} code
# Should Be Equal As Strings ${response_code} 200
# ${response} Convert to String ${response}
log ${response}
DeleteGroupCategory
[Arguments] ${categoryids}
#删除对象
log todeleteobjAndCategory
${response} BaseDeleteRequest /${version}/category/dict {"categoryIds":${categoryids}}
${response_code} Get From Dictionary ${response} code
Should Be Equal As Strings ${response_code} 200
${response} Convert to String ${response}
log ${response}
DeleteCategory
[Arguments] ${categoryids}
#删除对象
log todeleteobjAndCategory
${response} BaseDeleteRequest /${version}/category/dict {"categoryIds":[${categoryids}]}
${response_code} Get From Dictionary ${response} code
Should Be Equal As Strings ${response_code} 200
${response} Convert to String ${response}
log ${response}
DeletePolicyAndObjectAndProfile
[Arguments] ${policyids} ${objectids} ${profiles}
DeletePolicyAndObject ${policyids} ${objectids}
@@ -413,7 +455,7 @@ DeleteAfterCase
[Arguments] ${policyids} ${objectids}
Run Keyword If '${testPart}'=='all' or '${testPart}'=='3' DeletePolicyAndObject ${policyids} ${objectids}
DeletePolicyAndObject1
[Arguments] ${policyids} ${objectids} ${url} ${profiledId}
[Arguments] ${policyids} ${objectids} ${url} ${profiledId} ${categoryIds}=null
#删除策略
log toDeletePolicy_DeletePolicyAndObject
${listlenth}= Get Length ${policyids}
@@ -429,6 +471,12 @@ DeletePolicyAndObject1
log todeleteobj_DeletePolicyAndObject
Run Keyword If "${profiledId}"=="${EMPTY}" log no file to del
... ELSE DeletePolicyFile1 ${url} ${profiledId}
#删除Category
log ${categoryIds}
log todeleteCat_DeletePolicyAndObject
Run Keyword If "${categoryIds}"=="${EMPTY}" log no category to del
... ELSE IF "${categoryIds}"=="null" log no category to del
... ELSE DeleteCategory ${categoryIds}
DeletePolicyAndObjectAndVpn
[Arguments] ${policyids} ${objectids} ${wan_vpn}
@@ -474,4 +522,13 @@ DeletePolicyAndObjectAndIPpoor
log todelete_wan_vpn
Run Keyword If "${wan_ippoor}"=="${EMPTY}" log no vpn to del
... ELSE DeleteWanIpPood ${wan_ippoor}
GetIniCategoryId
[Arguments] ${categoryName}
Connect To Database Using Custom Params pymysql ${mysqlHost}
${iniCategoryId} query SELECT group_id FROM tsg_obj_fqdn_cat WHERE low_boundary IN (SELECT category_id FROM tsg_category_dict WHERE category_name='${categoryName}') AND is_initialize=1
Disconnect From Database
${iniCategoryId} Set Variable ${iniCategoryId}[0][0]
[Return] ${iniCategoryId}