管理服务接口升级关键字以及用例提交
This commit is contained in:
@@ -28,6 +28,37 @@ ObjectListOperation
|
||||
${json} Replace String ${bodyJson} "replace:objectList" ${objectListJson}
|
||||
Log Object_Request_Body-${json}
|
||||
[Return] ${json}
|
||||
|
||||
CategoryListOperation
|
||||
[Documentation]
|
||||
... 描述:入口,opAction参数可为'add','update','disable','enable'
|
||||
... 参数:returnData: 必传,是否返回请求数据。可选${0}(不返回)/${1}(返回)。
|
||||
... objectList: 必传,字典类型。字典内可选参数信息:
|
||||
... 其它参数默认值见../../03-Variable/PolicyObjectDefault.txt
|
||||
... 多个对象处理
|
||||
|
||||
[Arguments] ${returnData} ${objectList} ${opAction}
|
||||
Log Call ObjectListOperation
|
||||
${objectListJson} Set Variable [
|
||||
FOR ${object} IN @{objectList}
|
||||
${json} CategoryOrganize ${object} ${opAction}
|
||||
${objectListJson} Set Variable ${objectListJson}${json},
|
||||
END
|
||||
${objectListJson}= Replace String Using Regexp ${objectListJson} ,$ ]
|
||||
|
||||
# 转为json结构并返回
|
||||
${dict} Create Dictionary opAction=${opAction} returnData=${returnData} categoryList=replace:objectList
|
||||
${bodyJson} json.Dumps ${dict} ensure_ascii=False
|
||||
${json} Replace String ${bodyJson} "replace:objectList" ${json}
|
||||
|
||||
Log Category_Request_Body-${json}
|
||||
|
||||
# 转为json结构并返回
|
||||
# ${dict} Create Dictionary opAction=${opAction} returnData=${returnData} objectList=replace:objectList
|
||||
# ${bodyJson} json.Dumps ${dict} ensure_ascii=False
|
||||
# ${json} Replace String ${bodyJson} "replace:objectList" ${objectListJson}
|
||||
# Log Object_Request_Body-${json}
|
||||
[Return] ${json}
|
||||
|
||||
ObjectOperation
|
||||
[Documentation]
|
||||
@@ -47,6 +78,65 @@ ObjectOperation
|
||||
|
||||
Log Object_Request_Body-${json}
|
||||
[Return] ${json}
|
||||
|
||||
InstallOperation
|
||||
[Documentation]
|
||||
... 描述:入口,opAction参数可为'add','update','disable','enable'
|
||||
... 参数:returnData: 必传,是否返回请求数据。可选${0}(不返回)/${1}(返回)。
|
||||
... object: 必传,字典类型。字典内可选参数信息:
|
||||
... 其它参数默认值见../../03-Variable/PolicyObjectDefault.txt
|
||||
... 单个策略处理
|
||||
|
||||
[Arguments] ${object}
|
||||
Log Call ObjectOperation
|
||||
${json} ObjectOrganize ${object}
|
||||
# 转为json结构并返回
|
||||
${dict} Create Dictionary opAction=${opAction} returnData=${returnData} objectList=replace:objectList
|
||||
${bodyJson} json.Dumps ${dict} ensure_ascii=False
|
||||
${json} Replace String ${bodyJson} "replace:objectList" ${json}
|
||||
|
||||
Log Object_Request_Body-${json}
|
||||
[Return] ${json}
|
||||
|
||||
FeatureOperation
|
||||
[Documentation]
|
||||
... 描述:入口,opAction参数可为'add','update','disable','enable'
|
||||
... 参数:returnData: 必传,是否返回请求数据。可选${0}(不返回)/${1}(返回)。
|
||||
... object: 必传,字典类型。字典内可选参数信息:
|
||||
... 其它参数默认值见../../03-Variable/PolicyObjectDefault.txt
|
||||
... 单个策略处理
|
||||
|
||||
[Arguments] ${returnData} ${object} ${opAction}
|
||||
Log Call ObjectOperation
|
||||
${json} ObjectOrganize ${object} ${opAction}
|
||||
# 转为json结构并返回
|
||||
${dict} Create Dictionary opAction=${opAction} returnData=${returnData} objectList=replace:objectList
|
||||
${bodyJson} json.Dumps ${dict} ensure_ascii=False
|
||||
${json} Replace String ${bodyJson} "replace:objectList" ${json}
|
||||
|
||||
Log Object_Request_Body-${json}
|
||||
[Return] ${json}
|
||||
|
||||
CategoryOperation
|
||||
[Documentation]
|
||||
... 描述:入口,opAction参数可为'add','update','disable','enable'
|
||||
... 参数:returnData: 必传,是否返回请求数据。可选${0}(不返回)/${1}(返回)。
|
||||
... object: 必传,字典类型。字典内可选参数信息:
|
||||
... 其它参数默认值见../../03-Variable/PolicyObjectDefault.txt
|
||||
... 单个策略处理
|
||||
|
||||
[Arguments] ${returnData} ${category} ${opAction}
|
||||
Log Call ObjectOperation
|
||||
${json} CategoryOrganize ${category} ${opAction}
|
||||
|
||||
# 转为json结构并返回
|
||||
${dict} Create Dictionary opAction=${opAction} returnData=${returnData} categoryList=replace:objectList
|
||||
${bodyJson} json.Dumps ${dict} ensure_ascii=False
|
||||
${json} Replace String ${bodyJson} "replace:objectList" ${json}
|
||||
|
||||
Log Category_Request_Body-${json}
|
||||
[Return] ${json}
|
||||
|
||||
listorone
|
||||
[Arguments] ${object}
|
||||
${addItemList} Evaluate str('addItemList'in${object}.keys())
|
||||
@@ -147,6 +237,81 @@ ObjectOrganize
|
||||
${json} json.Dumps ${returnDict} ensure_ascii=False
|
||||
Log Object-${json}
|
||||
[Return] ${json}
|
||||
Categorylistorone
|
||||
[Arguments] ${category}
|
||||
${addItemList} Evaluate str('fqdnList'in${category}.keys())
|
||||
log ${addItemList}
|
||||
${objectparm} set variable ${addItemList}
|
||||
should contain x times ${objectparm} True 1
|
||||
# Should Not Be Empty ${object}[addItemList] or Should Not Be Empty ${object}[subObjectIds]
|
||||
|
||||
CategoryOrganize
|
||||
[Documentation]
|
||||
... 描述:入口,opAction参数可为'add','update','disable','enable'
|
||||
... object: 必传,字典类型。字典内可选参数信息:
|
||||
... 其它参数默认值见../../03-Variable/PolicyObjectDefault.txt
|
||||
... 单个策略转换为json
|
||||
[Arguments] ${category} ${opAction}
|
||||
Log Call CategoryOrganize
|
||||
${emptyList} Create List
|
||||
${returnDict} Create Dictionary
|
||||
# 断言必传参数
|
||||
# Should Not Be Empty ${object}[objectType]
|
||||
# Set To Dictionary ${returnDict} objectType=${object}[objectType]
|
||||
#新增时addItemList不能为空
|
||||
Run Keyword If "${opAction}"=="add" Categorylistorone ${category}
|
||||
Run Keyword If "${opAction}"=="update" Should Not Be Empty ${category}[categoryId]
|
||||
${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}
|
||||
${return} ${categoryId} Run Keyword And Ignore Error Get From Dictionary ${category} categoryId
|
||||
Run Keyword If "${return}"=="FAIL" or "${categoryId}"=="${EMPTY}" Set To Dictionary ${returnDict} categoryId=${EMPTY}
|
||||
... ELSE Set To Dictionary ${returnDict} categoryId=${categoryId}
|
||||
|
||||
${return} ${categoryType} Run Keyword And Ignore Error Get From Dictionary ${category} categoryType
|
||||
${categoryTypeV} Run Keyword If "${return}"!="FAIL" and "${categoryType}"!="${EMPTY}" Evaluate '${categoryType}'.lower()
|
||||
... ELSE Evaluate '${Default_CategoryType}'.lower()
|
||||
Set To Dictionary ${returnDict} categoryType=${categoryTypeV}
|
||||
# 取可选参数,为传入设置默认值
|
||||
Set To Dictionary ${returnDict} categoryType=${categoryTypeV}
|
||||
# ${return} ${isDelete} Run Keyword And Ignore Error Get From Dictionary ${category} isDelete
|
||||
# Run Keyword If "${return}"=="FAIL" or "${isDelete}"=="${EMPTY}" Set To Dictionary ${returnDict} isDelete=${Default_IsDelete}
|
||||
# ... ELSE Set To Dictionary ${returnDict} isDelete=${isDelete}
|
||||
${return} ${categoryDimension} Run Keyword And Ignore Error Get From Dictionary ${category} categoryDimension
|
||||
Run Keyword If "${return}"=="FAIL" or "${categoryDimension}"=="${EMPTY}" Set To Dictionary ${returnDict} categoryDimension=${Default_Dimension}
|
||||
... ELSE Set To Dictionary ${returnDict} categoryDimension=${categoryDimension}
|
||||
${return} ${categoryOrigin} Run Keyword And Ignore Error Get From Dictionary ${category} categoryOrigin
|
||||
Run Keyword If "${return}"=="FAIL" or "${categoryOrigin}"=="${EMPTY}" Set To Dictionary ${returnDict} categoryOrigin=${Default_Origin}
|
||||
... ELSE Set To Dictionary ${returnDict} categoryOrigin=${categoryOrigin}
|
||||
${return} ${isInitialize} Run Keyword And Ignore Error Get From Dictionary ${category} isInitialize
|
||||
Run Keyword If "${return}"=="FAIL" or "${isInitialize}"=="${EMPTY}" Set To Dictionary ${returnDict} isInitialize=${Default_IsInitialize}
|
||||
... ELSE Set To Dictionary ${returnDict} isInitialize=${isInitialize}
|
||||
${return} ${categoryName} Run Keyword And Ignore Error Get From Dictionary ${category} categoryName
|
||||
Run Keyword If "${return}"=="FAIL" or "${categoryName}"=="${EMPTY}" Set To Dictionary ${returnDict} categoryName=${Default_ObjectName}
|
||||
... ELSE Set To Dictionary ${returnDict} categoryName=${categoryName}
|
||||
${return} ${categoryDesc} Run Keyword And Ignore Error Get From Dictionary ${category} categoryDesc
|
||||
Run Keyword If "${return}"!="FAIL" and "${categoryDesc}"!="${EMPTY}" Set To Dictionary ${returnDict} categoryDesc=${categoryDesc}
|
||||
... ELSE Set To Dictionary ${returnDict} categoryDesc=${Default_ObjectDesc}
|
||||
${return} ${objectSubType} Run Keyword And Ignore Error Get From Dictionary ${category} objectSubType
|
||||
Run Keyword If "${return}"!="FAIL" and "${objectSubType}"!="${EMPTY}" Set To Dictionary ${returnDict} objectSubType=${objectSubType}
|
||||
... 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}
|
||||
|
||||
# 处理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结构并返回
|
||||
${json} json.Dumps ${returnDict} ensure_ascii=False
|
||||
Log Object-${json}
|
||||
[Return] ${json}
|
||||
|
||||
ManageEnableAndDisable
|
||||
[Documentation]
|
||||
... 启用与禁用时调用
|
||||
@@ -164,15 +329,19 @@ ManageAddItemListNew
|
||||
FOR ${item} IN @{addItemList}
|
||||
${itemNew} Run Keyword If '${type}'=='ip' and '${subType}'=="geo_location" ManageGeoItem ${item} ${subType} add
|
||||
... ELSE IF '${type}'=='ip' ManageIpItem ${item} ${subType} add
|
||||
... 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' or '${type}'=='mobile_identity' or '${type}'=='apn'
|
||||
... ManageStrItem ${item} ${type} add
|
||||
... ELSE IF '${type}'=='file_type' ManageFileItem ${item} ${type} add
|
||||
... ELSE IF '${type}'=='fqdn' and '${subType}'=='category' ManageCategory ${item} ${type} add
|
||||
... ELSE IF '${type}'=='http_signature' ManageExtensionStrItem ${item} ${type} add
|
||||
... ELSE IF '${type}'=='file_size' or '${type}'=='file_integrity_rate' ManageNumberItem ${item} ${type} add
|
||||
... ELSE Fail
|
||||
Append To List ${itemList} ${itemNew}
|
||||
END
|
||||
Set To Dictionary ${returnDict} addItemList=${itemList}
|
||||
Run Keyword If '${subType}'=='category' Set To Dictionary ${returnDict} fqdnList=${itemList}
|
||||
... ELSE Set To Dictionary ${returnDict} addItemList=${itemList}
|
||||
|
||||
|
||||
ManageUpdateItemList
|
||||
[Documentation]
|
||||
@@ -281,6 +450,28 @@ ManageStrItem
|
||||
Run Keyword If "${itemName}"!="${EMPTY}" Set To Dictionary ${itemNew} itemName=${itemName}
|
||||
Run Keyword If "${itemDesc}"!="${EMPTY}" Set To Dictionary ${itemNew} itemDesc=${itemDesc}
|
||||
[Return] ${itemNew}
|
||||
|
||||
ManageCategory
|
||||
[Documentation]
|
||||
... 字符串item处理
|
||||
[Arguments] ${item} ${type} ${action}
|
||||
Log Call ManageStrItem
|
||||
${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
|
||||
[Documentation]
|
||||
... 接口未说明,待接口说明字段类型之后再完善
|
||||
@@ -333,4 +524,22 @@ Get-ObjectIds
|
||||
${json} json.Dumps ${objectIds} ensure_ascii=False
|
||||
${json} Remove String ${json} [
|
||||
${json} Remove String ${json} ]
|
||||
[Return] ${json}
|
||||
|
||||
Get-CategoryIds
|
||||
[Documentation]
|
||||
... 获取结果中的对象ID
|
||||
[Arguments] ${value}
|
||||
Log Call Get-ObjectIds
|
||||
${CategoryIds} 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 ${CategoryIds} ${category['categoryId']}
|
||||
END
|
||||
${json} json.Dumps ${CategoryIds} ensure_ascii=False
|
||||
${json} Remove String ${json} [
|
||||
${json} Remove String ${json} ]
|
||||
[Return] ${json}
|
||||
Reference in New Issue
Block a user