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

@@ -130,7 +130,7 @@ CategoryOperation
${json} CategoryOrganize ${category} ${opAction}
# 转为json结构并返回
${dict} Create Dictionary opAction=${opAction} returnData=${returnData} categoryList=replace:objectList
${dict} Create Dictionary opAction=${opAction} returnData=${returnData} list=replace:objectList
${bodyJson} json.Dumps ${dict} ensure_ascii=False
${json} Replace String ${bodyJson} "replace:objectList" ${json}
@@ -261,6 +261,7 @@ CategoryOrganize
#新增时addItemList不能为空
Run Keyword If "${opAction}"=="add" Categorylistorone ${category}
Run Keyword If "${opAction}"=="update" Should Not Be Empty ${category}[categoryId]
Run Keyword If "${opAction}"=="update" Should Not Be Empty ${category}[objectId]
${return} ${objectId} Run Keyword And Ignore Error Get From Dictionary ${category} objectId
Run Keyword If "${return}"=="FAIL" or "${objectId}"=="${EMPTY}" Set To Dictionary ${returnDict} objectId=${EMPTY}
... ELSE Set To Dictionary ${returnDict} objectId=${objectId}
@@ -297,14 +298,10 @@ CategoryOrganize
... ELSE Set To Dictionary ${returnDict} objectSubType=${Default_ObjectSubType}
# 处理AddItemList
${return} ${addItemList} Run Keyword And Ignore Error Get From Dictionary ${category} fqdnList
Run Keyword If "${return}"!="FAIL" and "${addItemList}"!="${EMPTY}" ManageAddItemListNew ${addItemList} ${returnDict} ${categoryTypeV} ${objectSubType}
Run Keyword If "${opAction}"=="add" Should Not Be Empty ${addItemList}
# Run Keyword If "${return}"!="FAIL" and "${addItemList}"!="${EMPTY}" ManageAddItemListNew ${addItemList} ${returnDict} ${categoryTypeV} ${objectSubType}
ManageAddItemListNew ${addItemList} ${returnDict} ${categoryTypeV} ${objectSubType}
# 处理UpdateItemList
${return} ${updateItemList} Run Keyword And Ignore Error Get From Dictionary ${category} updateItemList
Run Keyword If "${opAction}"=="update" and "${return}"!="FAIL" and "${updateItemList}"!="${EMPTY}" ManageUpdateItemList ${updateItemList} ${returnDict} ${objectTypeV} ${objectSubType}
# 处理deleteItemIds
${return} ${deleteItemIds} Run Keyword And Ignore Error Get From Dictionary ${category} deleteItemIds
Run Keyword If "${opAction}"=="update" and "${return}"!="FAIL" and "${deleteItemIds}"!="${EMPTY}" ManageDeleteItemIds ${deleteItemIds} ${returnDict}
# 删除无用判断key值objectSubType
Remove From Dictionary ${returnDict} objectSubType
# 转为json结构并返回
@@ -354,7 +351,7 @@ ManageUpdateItemList
${itemNew} Run Keyword If '${type}'=='ip' and '${subType}'=="geo_location" ManageGeoItem ${item} ${subType} update
... ELSE IF '${type}'=='ip' ManageIpItem ${item} ${subType} update
... ELSE IF '${type}'=='url' or '${type}'=='fqdn' or '${type}'=='keywords' or '${type}'=='subscriberid' or '${type}'=='fqdn_category' or '${type}'=='account' or '${type}'=='app_id'
... ELSE IF '${type}'=='url' or ('${type}'=='fqdn' and '${subType}'!='category') or '${type}'=='keywords' or '${type}'=='subscriberid' or '${type}'=='fqdn_category' or '${type}'=='account' or '${type}'=='app_id'
... ManageStrItem ${item} ${type} update
... ELSE IF '${type}'=='file_type' ManageFileItem ${item} ${type} update
... ELSE IF '${type}'=='http_signature' ManageExtensionStrItem ${item} ${type} update
@@ -365,7 +362,9 @@ ManageUpdateItemList
Remove From Dictionary ${itemNew} isInitialize
Append To List ${itemList} ${itemNew}
END
Set To Dictionary ${returnDict} updateItemList=${itemList}
# Set To Dictionary ${returnDict} updateItemList=${itemList}
Run Keyword If '${subType}'=='category' Set To Dictionary ${returnDict} fqdnList=${itemList}
... ELSE Set To Dictionary ${returnDict} updateItemList=${itemList}
ManageIpItem
[Documentation]
... ip item处理
@@ -459,17 +458,8 @@ ManageCategory
${return} ${fqdn} Run Keyword And Ignore Error Set Variable ${item['fqdn']}
${fqdn} Run Keyword If "${return}"!="FAIL" Set Variable ${fqdn} ELSE Set Variable ${EMPTY}
Run Keyword If "${action}"=="add" Should Not Be Empty ${fqdn}
${fqdn} Evaluate re.split('[,]', '${fqdn}') re
# ${return} ${isInitialize} Run Keyword And Ignore Error Set Variable ${item['isInitialize']}
# ${isInitialize} Run Keyword If "${return}"!="FAIL" Set Variable ${isInitialize}
# ... ELSE Set Variable ${EMPTY}
# ${return} ${itemName} Run Keyword And Ignore Error Set Variable ${item['isDelete']}
# ${itemName} Run Keyword If "${return}"!="FAIL" Set Variable ${isDelete}
${itemNew} Create Dictionary
Run Keyword If "${fqdn}"!="${EMPTY}" Set To Dictionary ${itemNew} fqdn=${fqdn}
# Run Keyword If "${isInitialize}"!="${EMPTY}" Set To Dictionary ${itemNew} isInitialize=${isInitialize}
# Run Keyword If "${isDelete}"!="${EMPTY}" Set To Dictionary ${itemNew} isDelete=${isDelete}
[Return] ${itemNew}
ManageFileItem
@@ -526,11 +516,29 @@ Get-ObjectIds
${json} Remove String ${json} ]
[Return] ${json}
Get-CategoryObjIds
[Documentation]
... 获取Category结果中的对象ID
[Arguments] ${value}
Log Call Get-CategoryObjectIds
${CategoryObjIds} Create List
${CategoryTemp} Set Variable ${EMPTY}
${return} ${data} Run Keyword And Ignore Error Get From Dictionary ${value} data
Return From Keyword If "${return}"=="FAIL" ${CategoryTemp}
FOR ${category} IN @{value['data']['list']}
Append To List ${CategoryObjIds} ${category['objectId']}
END
${json} json.Dumps ${CategoryObjIds} ensure_ascii=False
${json} Remove String ${json} [
${json} Remove String ${json} ]
[Return] ${json}
Get-CategoryIds
[Documentation]
... 获取结果中的对象ID
... 获取Category结果中的对象ID
[Arguments] ${value}
Log Call Get-ObjectIds
Log Call Get-CategoryObjectIds
${CategoryIds} Create List
${CategoryTemp} Set Variable ${EMPTY}
${return} ${data} Run Keyword And Ignore Error Get From Dictionary ${value} data
@@ -542,4 +550,4 @@ Get-CategoryIds
${json} json.Dumps ${CategoryIds} ensure_ascii=False
${json} Remove String ${json} [
${json} Remove String ${json} ]
[Return] ${json}
[Return] ${json}