fix(策略对象新增):关键字单元,扩展类字符串单元修改为dict方式传入
This commit is contained in:
@@ -10,6 +10,7 @@ Library DateTime
|
||||
*** Variables ***
|
||||
@{policyIds}
|
||||
@{profiles}
|
||||
${objectIds} ${EMPTY}
|
||||
*** Test Cases ***
|
||||
Policy-Get-v1-00001
|
||||
${policy} Create Dictionary policyType=tsg_security action=deny
|
||||
@@ -115,12 +116,12 @@ Policy-Post-v2-00005
|
||||
... addItemList=range|192.168.41.68|192.168.41.68|0/0
|
||||
${rescode} ${objectId1} AddObject2 ${1} ${objectDict}
|
||||
${objectIds} Set Variable ${objectId1}
|
||||
Log To Console Create IP Object
|
||||
Log Create IP Object
|
||||
Comment 创建url
|
||||
${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=*baidu.com
|
||||
${rescode} ${objectId2} AddObject2 ${1} ${objectDict}
|
||||
${objectIds} Set Variable ${objectId2},${objectIds}
|
||||
Log To Console Create url Object
|
||||
Log Create url Object
|
||||
Comment 创建安全策略
|
||||
${policy} Create Dictionary policyName=WX_SecurityPolicy-v2-00005 policyType=tsg_security
|
||||
... policyDesc=wx-autotest
|
||||
@@ -162,24 +163,24 @@ Policy-Post-v2-00007
|
||||
... addItemList=range|192.168.41.68|192.168.41.68|0/0
|
||||
${rescode} ${objectId1} AddObject2 ${1} ${objectDict}
|
||||
${objectIds} Set Variable ${objectId1}
|
||||
Log To Console Create IP Object1
|
||||
Log Create IP Object1
|
||||
Comment 创建IP1
|
||||
${objectDict} Create Dictionary objectType=ip isValid=${1}
|
||||
... isInitialize=0
|
||||
... addItemList=range|192.168.41.67|192.168.41.67|0/0
|
||||
${rescode} ${objectId2} AddObject2 ${1} ${objectDict}
|
||||
${objectIds} Set Variable ${objectId2}
|
||||
Log To Console Create IP Object2
|
||||
Log Create IP Object2
|
||||
Comment 创建url
|
||||
${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=*baidu.com
|
||||
${rescode} ${objectId3} AddObject2 ${1} ${objectDict}
|
||||
${objectIds} Set Variable ${objectId3},${objectIds}
|
||||
Log To Console Create url Object3
|
||||
Log Create url Object3
|
||||
Comment 创建url1
|
||||
${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=*google.com.com
|
||||
${rescode} ${objectId4} AddObject2 ${1} ${objectDict}
|
||||
${objectIds} Set Variable ${objectId4},${objectIds}
|
||||
Log To Console Create url Object4
|
||||
Log Create url Object4
|
||||
Comment 创建安全策略
|
||||
${policy} Create Dictionary policyName=WX_AddPolicy-v2-00007 policyType=tsg_security
|
||||
... policyDesc=wx-autotest
|
||||
@@ -207,12 +208,12 @@ Policy-Post-v2-00008
|
||||
... addItemList=range|192.168.41.68|192.168.41.68|0/0
|
||||
${rescode} ${objectId1} AddObject2 ${1} ${objectDict}
|
||||
${objectIds} Set Variable ${objectId1}
|
||||
Log To Console Create IP Object1
|
||||
Log Create IP Object1
|
||||
Comment 创建url
|
||||
${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=*baidu.com
|
||||
${rescode} ${objectId3} AddObject2 ${1} ${objectDict}
|
||||
${objectIds} Set Variable ${objectId3},${objectIds}
|
||||
Log To Console Create url Object3
|
||||
Log Create url Object3
|
||||
|
||||
Comment 创建安全策略
|
||||
${policy} Create Dictionary policyName=WX_AddPolicy-v2-00008 policyType=tsg_security
|
||||
@@ -236,12 +237,12 @@ Policy-Post-v2-00009
|
||||
... addItemList=range|192.168.41.68|192.168.41.68|0/0
|
||||
${rescode} ${objectId1} AddObject2 ${1} ${objectDict}
|
||||
${objectIds} Set Variable ${objectId1}
|
||||
Log To Console Create IP Object1
|
||||
Log Create IP Object1
|
||||
Comment 创建url
|
||||
${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=*baidu.com
|
||||
${rescode} ${objectId3} AddObject2 ${1} ${objectDict}
|
||||
${objectIds} Set Variable ${objectId3},${objectIds}
|
||||
Log To Console Create url Object3
|
||||
Log Create url Object3
|
||||
|
||||
Comment 创建安全策略
|
||||
${policy} Create Dictionary policyName=WX_AddPolicy-v2-00009 policyType=tsg_security
|
||||
@@ -265,12 +266,12 @@ Policy-Post-v2-00010
|
||||
... addItemList=range|192.168.41.68|192.168.41.68|0/0
|
||||
${rescode} ${objectId1} AddObject2 ${1} ${objectDict}
|
||||
${objectIds} Set Variable ${objectId1}
|
||||
Log To Console Create IP Object1
|
||||
Log Create IP Object1
|
||||
Comment 创建url
|
||||
${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=*baidu.com
|
||||
${rescode} ${objectId3} AddObject2 ${1} ${objectDict}
|
||||
${objectIds} Set Variable ${objectId3},${objectIds}
|
||||
Log To Console Create url Object3
|
||||
Log Create url Object3
|
||||
|
||||
Comment 创建安全策略
|
||||
${policy} Create Dictionary policyName=WX_AddPolicy-v2-00010 policyType=tsg_security
|
||||
@@ -293,12 +294,12 @@ Policy-Post-v2-00011
|
||||
... addItemList=range|192.168.41.68|192.168.41.68|0/0
|
||||
${rescode} ${objectId1} AddObject2 ${1} ${objectDict}
|
||||
${objectIds} Set Variable ${objectId1}
|
||||
Log To Console Create IP Object1
|
||||
Log Create IP Object1
|
||||
Comment 创建url
|
||||
${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=*baidu.com
|
||||
${rescode} ${objectId3} AddObject2 ${1} ${objectDict}
|
||||
${objectIds} Set Variable ${objectId3},${objectIds}
|
||||
Log To Console Create url Object3
|
||||
Log Create url Object3
|
||||
|
||||
Comment 创建安全策略
|
||||
${policy} Create Dictionary policyName=WX_AddPolicy-v2-00011 policyType=tsg_security
|
||||
@@ -316,60 +317,96 @@ Policy-Post-v2-00011
|
||||
${rescode} UpdatePolicies 1 ${policy} v2 disable
|
||||
Policy-Post-v1-00012
|
||||
Comment 创建IP
|
||||
${item1} Create Dictionary isSession=endpoint ip=192.168.32.32
|
||||
... port=80 direction=${0} protocol=${6} isInitialize=${0}
|
||||
${addItemList} Create List ${item1}
|
||||
${objectDict} Create Dictionary objectType=ip isValid=${1}
|
||||
... isInitialize=0
|
||||
... addItemList=range|192.168.41.68|192.168.41.68|0/0
|
||||
... addItemList=${addItemList}
|
||||
${rescode} ${objectId1} AddObjects ${1} ${objectDict}
|
||||
${objectIds} Set Variable ${objectId1}
|
||||
Log To Console Create IP Object
|
||||
Log Create IP Object
|
||||
Comment 更新IP
|
||||
${objectDict} Create Dictionary objectId=${objectId1} objectType=ip
|
||||
${rescode} UpdateObjects ${1} ${objectDict} disable
|
||||
Log To Console Create IP Object
|
||||
Log Create IP Object
|
||||
Policy-Post-v1-00013
|
||||
Comment 创建IP
|
||||
${item1} Create Dictionary isSession=endpoint ip=192.168.32.32
|
||||
... port=80 direction=${0} protocol=${6} isInitialize=${0}
|
||||
${addItemList} Create List ${item1}
|
||||
${objectDict} Create Dictionary objectType=ip isValid=${0}
|
||||
... isInitialize=0
|
||||
... addItemList=range|192.168.41.68|192.168.41.68|0/0
|
||||
... addItemList=${addItemList}
|
||||
${rescode} ${objectId1} AddObjects ${1} ${objectDict}
|
||||
${objectIds} Set Variable ${objectId1}
|
||||
Log To Console Create IP Object
|
||||
Log Create IP Object
|
||||
${params} Create Dictionary objectId=${objectId1} itemType=ip
|
||||
${rescode} ${itemIds} ${itemList} GetObjectItems ${params}
|
||||
Log To Console ${itemIds}
|
||||
Log ${itemIds}
|
||||
Comment 更新IP
|
||||
FOR ${item} IN @{itemList}
|
||||
Set To Dictionary ${item} clientIp1 192.168.41.67
|
||||
Set To Dictionary ${item} clientIp2 192.168.41.67
|
||||
Remove From Dictionary ${item} isInitialize
|
||||
Set To Dictionary ${item} serverIp1 192.168.41.68
|
||||
Set To Dictionary ${item} serverIp2 192.168.41.68
|
||||
Set To Dictionary ${item} ip 192.168.41.67
|
||||
END
|
||||
Set To Dictionary ${addItemList[0]} itemId=${itemIds[0]}
|
||||
Remove From Dictionary ${addItemList[0]} isInitialize
|
||||
${objectDict} Create Dictionary objectId=${objectId1} objectType=ip
|
||||
... updateItemList=${itemList}
|
||||
... updateItemList=${addItemList}
|
||||
${rescode} UpdateObjects ${1} ${objectDict} update
|
||||
Log To Console Create IP Object
|
||||
Log Create IP Object
|
||||
Policy-Post-v1-00014
|
||||
Comment 创建urls
|
||||
${objectDict1} Create Dictionary objectType=url isValid=${1} addItemList=*baidu.com,
|
||||
${objectDict2} Create Dictionary objectType=url isValid=${1} addItemList=*google.com
|
||||
${objectDict} Create List ${objectDict1} ${objectDict2}
|
||||
${rescode} ${objectIds} AddObjects ${1} ${objectDict}
|
||||
|
||||
${item1} Create Dictionary keywordArray=*baidu.com isHexbin=${0}
|
||||
${item2} Create Dictionary keywordArray=*google.com isHexbin=${0}
|
||||
${addItemList} Create List ${item1}
|
||||
${addItemList1} Create List ${item2}
|
||||
${objectDict1} Create Dictionary objectType=url isValid=${1} addItemList=${addItemList}
|
||||
${objectDict2} Create Dictionary objectType=url isValid=${1} addItemList=${addItemList1}
|
||||
${objectList} Create List ${objectDict1} ${objectDict2}
|
||||
${rescode} ${objectIds} AddObjects ${1} ${objectList}
|
||||
Policy-Post-v1-00015
|
||||
Comment 创建urls
|
||||
${objectDict1} Create Dictionary objectType=url isValid=${1} addItemList=*baidu.com,*google.com
|
||||
${item1} Create Dictionary keywordArray=*baidu.com isHexbin=${0}
|
||||
${item2} Create Dictionary keywordArray=*google.com isHexbin=${0}
|
||||
${addItemList} Create List ${item1} ${item2}
|
||||
${objectDict1} Create Dictionary objectType=url isValid=${1} addItemList=${addItemList}
|
||||
${rescode} ${objectIds} AddObjects ${1} ${objectDict1}
|
||||
${params} Create Dictionary objectId=${objectIds} itemType=url
|
||||
${rescode} ${itemIds} ${itemList} GetObjectItems ${params}
|
||||
Log To Console ${itemIds}
|
||||
Log ${itemIds}
|
||||
Comment 修改urls
|
||||
${updateList} Create List *baidu.com* *baidu1.com*
|
||||
Set To Dictionary ${itemList}[0] keywordArray ${updateList}
|
||||
${addItem1} Create Dictionary keywordArray=*baidu.com* isHexbin=${0}
|
||||
${updateItem2} Create Dictionary keywordArray=*baidu1.com* isHexbin=${0} itemId=${itemIds[0]}
|
||||
${addItemList} Create List ${addItem1}
|
||||
${updateList} Create List ${updateItem2}
|
||||
|
||||
${objectDict} Create Dictionary objectId=${objectIds} objectType=url
|
||||
... addItemList=putty.com
|
||||
... updateItemList=${itemList}[0]
|
||||
... addItemList=${addItemList}
|
||||
... updateItemList=${updateList}
|
||||
... deleteItemIds=${itemIds}[1]
|
||||
${rescode} UpdateObjects ${1} ${objectDict} update
|
||||
${rescode} UpdateObjects ${1} ${objectDict} update
|
||||
Policy-Post-v1-00015-1
|
||||
Comment 创建http_signature
|
||||
${item1} Create Dictionary keywordArray=*baidu.com isHexbin=${0} district=Cookie isInitialize=0
|
||||
${item2} Create Dictionary keywordArray=*google.com isHexbin=${0} district=Content-Type
|
||||
${addItemList} Create List ${item1} ${item2}
|
||||
${objectDict1} Create Dictionary objectType=http_signature isValid=${1} addItemList=${addItemList}
|
||||
${rescode} ${objectIds} AddObjects ${1} ${objectDict1}
|
||||
${params} Create Dictionary objectId=${objectIds} itemType=http_signature
|
||||
${rescode} ${itemIds} ${itemList} GetObjectItems ${params}
|
||||
Log ${itemIds}
|
||||
Comment 修改urls
|
||||
${addItem1} Create Dictionary keywordArray=*baidu.com* isHexbin=${0} district=Cookie
|
||||
${updateItem2} Create Dictionary keywordArray=*baidu1.com* isHexbin=${0} itemId=${itemIds[0]} isInitialize=0
|
||||
${addItemList} Create List ${addItem1}
|
||||
${updateList} Create List ${updateItem2}
|
||||
|
||||
${objectDict} Create Dictionary objectId=${objectIds} objectType=http_signature
|
||||
... addItemList=${addItemList}
|
||||
... updateItemList=${updateList}
|
||||
... deleteItemIds=${itemIds}[1]
|
||||
${rescode} UpdateObjects ${1} ${objectDict} update
|
||||
Policy-Delete-v1-00016
|
||||
Comment 创建IP
|
||||
${objectDict} Create Dictionary objectType=ip isValid=${1}
|
||||
@@ -377,12 +414,12 @@ Policy-Delete-v1-00016
|
||||
... addItemList=range|192.168.41.68|192.168.41.68|0/0
|
||||
${rescode} ${objectId1} AddObject2 ${1} ${objectDict}
|
||||
${objectIds} Set Variable ${objectId1}
|
||||
Log To Console Create IP Object1
|
||||
Log Create IP Object1
|
||||
Comment 创建url
|
||||
${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=*baidu.com
|
||||
${rescode} ${objectId3} AddObject2 ${1} ${objectDict}
|
||||
${objectIds} Set Variable ${objectId3},${objectIds}
|
||||
Log To Console Create url Object3
|
||||
Log Create url Object3
|
||||
|
||||
Comment 创建安全策略
|
||||
${policy} Create Dictionary policyName=WX_AddPolicy-v2-00011 policyType=tsg_security
|
||||
@@ -405,12 +442,12 @@ Policy-Delete-v1-00017
|
||||
... addItemList=range|192.168.41.68|192.168.41.68|0/0
|
||||
${rescode} ${objectId1} AddObject2 ${1} ${objectDict}
|
||||
${objectIds} Set Variable ${objectId1}
|
||||
Log To Console Create IP Object1
|
||||
Log Create IP Object1
|
||||
Comment 创建url
|
||||
${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=*baidu.com
|
||||
${rescode} ${objectId3} AddObject2 ${1} ${objectDict}
|
||||
${objectIds} Set Variable ${objectId3},${objectIds}
|
||||
Log To Console Create url Object3
|
||||
Log Create url Object3
|
||||
|
||||
Comment 创建安全策略
|
||||
${policy} Create Dictionary policyName=WX_AddPolicy-v2-00011 policyType=tsg_security
|
||||
@@ -565,6 +602,8 @@ Policy-log-v1-00028
|
||||
${resData} QueryLogs ${params} batch
|
||||
Policy-Delete-v1-00029
|
||||
Comment 创建urls
|
||||
${addItem1} Create Dictionary
|
||||
${addItemList} Create List
|
||||
${objectDict1} Create Dictionary objectType=url isValid=${1} addItemList=*baidu.com,
|
||||
${objectDict2} Create Dictionary objectType=url isValid=${1} addItemList=*google.com
|
||||
${objectDict} Create List ${objectDict1} ${objectDict2}
|
||||
|
||||
@@ -13,6 +13,11 @@ AddObjects
|
||||
[Documentation]
|
||||
... 新增策略对象
|
||||
... objectList,策略对象,可为list类型与dict类型
|
||||
... addItemList自动过滤itemId
|
||||
... updateItemList自动过滤isInitialize(update时该字段引发异常)
|
||||
... ipItem格式为dict,自动过滤空的字段
|
||||
... stringItem格式为dict,需要注意keywordArray字段应传入逗号分隔的字符串eg: keyword1,keyword2
|
||||
... http_signature为代表的拓展关键字keywordArray字段也是以逗号分隔的
|
||||
... returnData,是否返回数据,固定为1
|
||||
[Arguments] ${returnData} ${objectList}
|
||||
${returnData}= Run Keyword If '${returnData}' == '${EMPTY}' Set Variable 1
|
||||
@@ -35,6 +40,11 @@ UpdateObjects
|
||||
[Documentation]
|
||||
... 更新策略对象
|
||||
... objectList,策略对象,可为list类型与dict类型
|
||||
... addItemList自动过滤itemId
|
||||
... updateItemList自动过滤isInitialize(update时该字段引发异常)
|
||||
... ipItem格式为dict,自动过滤空的字段
|
||||
... stringItem格式为dict,需要注意keywordArray字段应传入逗号分隔的字符串eg: keyword1,keyword2
|
||||
... http_signature为代表的拓展关键字keywordArray字段也是以逗号分隔的
|
||||
... returnData,是否返回数据,固定为1
|
||||
... opAction,可为update,enable,disable
|
||||
[Arguments] ${returnData} ${objectList} ${opAction}
|
||||
|
||||
@@ -4,6 +4,7 @@ Library Collections
|
||||
Resource ../../../03-Variable/BifangApiVariable.txt
|
||||
Resource ../../../03-Variable/PolicyObjectDefault.txt
|
||||
Resource ../../tsg_common/ManageObjectBody.robot
|
||||
*** Variables ***
|
||||
*** Keywords ***
|
||||
ObjectListOperation
|
||||
[Documentation]
|
||||
@@ -14,7 +15,7 @@ ObjectListOperation
|
||||
... 多个对象处理
|
||||
|
||||
[Arguments] ${returnData} ${objectList} ${opAction}
|
||||
Log To Console Call ObjectListOperation
|
||||
Log Call ObjectListOperation
|
||||
${objectListJson} Set Variable [
|
||||
FOR ${object} IN @{objectList}
|
||||
${json} ObjectOrganize ${object} ${opAction}
|
||||
@@ -37,7 +38,7 @@ ObjectOperation
|
||||
... 单个策略处理
|
||||
|
||||
[Arguments] ${returnData} ${object} ${opAction}
|
||||
Log To Console Call ObjectOperation
|
||||
Log Call ObjectOperation
|
||||
${json} ObjectOrganize ${object} ${opAction}
|
||||
# 转为json结构并返回
|
||||
${dict} Create Dictionary opAction=${opAction} returnData=${returnData} objectList=replace:objectList
|
||||
@@ -62,7 +63,7 @@ ObjectOrganize
|
||||
... 其它参数默认值见../../03-Variable/PolicyObjectDefault.txt
|
||||
... 单个策略转换为json
|
||||
[Arguments] ${object} ${opAction}
|
||||
Log To Console Call ObjectOrganize
|
||||
Log Call ObjectOrganize
|
||||
${emptyList} Create List
|
||||
${returnDict} Create Dictionary
|
||||
# 断言必传参数
|
||||
@@ -108,7 +109,9 @@ ObjectOrganize
|
||||
${return} ${subObjectIds} Run Keyword And Ignore Error Get From Dictionary ${object} subObjectIds
|
||||
Run Keyword If "${return}"!="FAIL" and "${subObjectIds}"!="${EMPTY}" and "${subObjectIds}"!="${None}" Set To Dictionary ${returnDict} subObjectIds=${subObjectIds}
|
||||
... ELSE Set Variable ${emptyList}
|
||||
|
||||
|
||||
${return} ${iconColor} Run Keyword And Ignore Error Set Variable ${object['iconColor']}
|
||||
Run Keyword If "${return}"!="FAIL" Set To Dictionary ${returnDict} iconColor=${iconColor}
|
||||
#补充ip learning对象
|
||||
${return} ${fromFqdns} Run Keyword And Ignore Error Get From Dictionary ${object} fromFqdns
|
||||
Run Keyword If "${return}"!="FAIL" Set To Dictionary ${returnDict} fromFqdns=${fromFqdns}
|
||||
@@ -131,11 +134,11 @@ ObjectOrganize
|
||||
#... ELSE Set To Dictionary ${returnDict} learnedIpLimit=${Default_learnedIpLimit}
|
||||
# 处理AddItemList
|
||||
${return} ${addItemList} Run Keyword And Ignore Error Get From Dictionary ${object} addItemList
|
||||
Run Keyword If "${return}"!="FAIL" and "${addItemList}"!="${EMPTY}" ManageAddItemList ${object} ${returnDict}
|
||||
Run Keyword If "${return}"!="FAIL" and "${addItemList}"!="${EMPTY}" ManageAddItemListNew ${addItemList} ${returnDict} ${objectTypeV} ${objectSubType}
|
||||
|
||||
# 处理UpdateItemList
|
||||
${return} ${updateItemList} Run Keyword And Ignore Error Get From Dictionary ${object} updateItemList
|
||||
Run Keyword If "${opAction}"=="update" and "${return}"!="FAIL" and "${updateItemList}"!="${EMPTY}" ManageUpdateItemList ${updateItemList} ${returnDict}
|
||||
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 ${object} deleteItemIds
|
||||
Run Keyword If "${opAction}"=="update" and "${return}"!="FAIL" and "${deleteItemIds}"!="${EMPTY}" ManageDeleteItemIds ${deleteItemIds} ${returnDict}
|
||||
@@ -152,11 +155,137 @@ ManageEnableAndDisable
|
||||
${json} json.Dumps ${returnDict} ensure_ascii=False
|
||||
Log Object-${json}
|
||||
[Return] ${json}
|
||||
ManageAddItemListNew
|
||||
# 处理addItemList数组
|
||||
[Arguments] ${addItemList} ${returnDict} ${type} ${subType}
|
||||
Log Call ManageAddItemListNew
|
||||
${itemList} Create List
|
||||
FOR ${item} IN @{addItemList}
|
||||
${itemNew} Run Keyword 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'
|
||||
... ManageStrItem ${item} ${type} add
|
||||
... ELSE IF '${type}'=='file_type' ManageFileItem ${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}
|
||||
|
||||
ManageUpdateItemList
|
||||
[Documentation]
|
||||
... 处理updateItemList
|
||||
[Arguments] ${updateItemList} ${returnDict}
|
||||
Set To Dictionary ${returnDict} updateItemList=${updateItemList}
|
||||
[Arguments] ${updateItemList} ${returnDict} ${type} ${subType}
|
||||
${itemList} Create List
|
||||
FOR ${item} IN @{updateItemList}
|
||||
${itemId} Get From Dictionary ${item} itemId
|
||||
|
||||
${itemNew} Run Keyword 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'
|
||||
... ManageStrItem ${item} ${type} update
|
||||
... ELSE IF '${type}'=='file_type' ManageFileItem ${item} ${type} update
|
||||
... ELSE IF '${type}'=='http_signature' ManageExtensionStrItem ${item} ${type} update
|
||||
... ELSE IF '${type}'=='file_size' or '${type}'=='file_integrity_rate' ManageNumberItem ${item} ${type} update
|
||||
... ELSE Fail
|
||||
Set To Dictionary ${itemNew} itemId=${itemId}
|
||||
#由于接口更新时是否内置字段会导致40014001,策略对象单元不可改是否为内置(isInitialize)参数状态,这里去掉是否内置字段
|
||||
Remove From Dictionary ${itemNew} isInitialize
|
||||
Append To List ${itemList} ${itemNew}
|
||||
END
|
||||
Set To Dictionary ${returnDict} updateItemList=${itemList}
|
||||
ManageIpItem
|
||||
[Documentation]
|
||||
... ip item处理
|
||||
[Arguments] ${item} ${subType} ${action}
|
||||
Log Call ManageIpItem
|
||||
${return} ${isSession} Run Keyword And Ignore Error Get From Dictionary ${item} isSession
|
||||
${isSession} Run Keyword If "${return}"!="FAIL" Set Variable ${isSession} ELSE Set Variable ${EMPTY}
|
||||
Run Keyword If "${action}"=="add" Should Not Be Empty ${isSession}
|
||||
${return} ${ip} Run Keyword And Ignore Error Get From Dictionary ${item} ip
|
||||
${ip} Run Keyword If "${return}"!="FAIL" Set Variable ${ip} ELSE Set Variable ${EMPTY}
|
||||
Run Keyword If "${action}"=="add" Should Not Be Empty ${ip}
|
||||
${return} ${port} Run Keyword And Ignore Error Get From Dictionary ${item} port
|
||||
Run Keyword If "${action}"=="add" Should Not Be Empty ${port}
|
||||
Run Keyword If "${action}"=="add" Dictionary Should Contain Key ${item} direction
|
||||
${return} ${direction} Run Keyword And Ignore Error Get From Dictionary ${item} direction
|
||||
${direction} Run Keyword If "${return}"!="FAIL" Set Variable ${direction} ELSE Set Variable ${EMPTY}
|
||||
Run Keyword If "${action}"=="add" Dictionary Should Contain Key ${item} protocol
|
||||
${return} ${protocol} Run Keyword And Ignore Error Get From Dictionary ${item} protocol
|
||||
${protocol} Run Keyword If "${return}"!="FAIL" Set Variable ${protocol} ELSE Set Variable ${EMPTY}
|
||||
${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['itemName']}
|
||||
${itemName} Run Keyword If "${return}"!="FAIL" Set Variable ${itemName}
|
||||
... ELSE Set Variable ${EMPTY}
|
||||
${return} ${itemDesc} Run Keyword And Ignore Error Set Variable ${item['itemDesc']}
|
||||
${itemDesc} Run Keyword If "${return}"!="FAIL" Set Variable ${itemDesc}
|
||||
... ELSE Set Variable ${EMPTY}
|
||||
${itemNew} Create Dictionary
|
||||
Run Keyword If "${isSession}"!="${EMPTY}" Set To Dictionary ${itemNew} isSession=${isSession}
|
||||
Run Keyword If "${ip}"!="${EMPTY}" Set To Dictionary ${itemNew} ip=${ip}
|
||||
Run Keyword If "${port}"!="${EMPTY}" Set To Dictionary ${itemNew} port=${port}
|
||||
Run Keyword If "${direction}"!="${EMPTY}" Set To Dictionary ${itemNew} direction=${direction}
|
||||
Run Keyword If "${protocol}"!="${EMPTY}" Set To Dictionary ${itemNew} protocol=${protocol}
|
||||
Run Keyword If "${isInitialize}"!="${EMPTY}" Set To Dictionary ${itemNew} isInitialize=${isInitialize}
|
||||
Run Keyword If "${itemName}"!="${EMPTY}" Set To Dictionary ${itemNew} itemName=${itemName}
|
||||
Run Keyword If "${itemDesc}"!="${EMPTY}" Set To Dictionary ${itemNew} itemDesc=${itemDesc}
|
||||
[Return] ${itemNew}
|
||||
ManageStrItem
|
||||
[Documentation]
|
||||
... 字符串item处理
|
||||
[Arguments] ${item} ${type} ${action}
|
||||
Log Call ManageStrItem
|
||||
${return} ${keywordArray} Run Keyword And Ignore Error Set Variable ${item['keywordArray']}
|
||||
${keywordArray} Run Keyword If "${return}"!="FAIL" Set Variable ${keywordArray} ELSE Set Variable ${EMPTY}
|
||||
Run Keyword If "${action}"=="add" Should Not Be Empty ${keywordArray}
|
||||
${array} Evaluate re.split('[,]', '${keywordArray}') re
|
||||
|
||||
Run Keyword If "${action}"=="add" Dictionary Should Contain Key ${item} isHexbin
|
||||
${return} ${isHexbin} Run Keyword And Ignore Error Get From Dictionary ${item} isHexbin
|
||||
${isHexbin} Run Keyword If "${return}"!="FAIL" Set Variable ${isHexbin}
|
||||
... ELSE Set Variable ${EMPTY}
|
||||
|
||||
${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['itemName']}
|
||||
${itemName} Run Keyword If "${return}"!="FAIL" Set Variable ${itemName}
|
||||
... ELSE Set Variable ${EMPTY}
|
||||
${return} ${itemDesc} Run Keyword And Ignore Error Set Variable ${item['itemDesc']}
|
||||
${itemDesc} Run Keyword If "${return}"!="FAIL" Set Variable ${itemDesc}
|
||||
... ELSE Set Variable ${EMPTY}
|
||||
|
||||
${itemNew} Create Dictionary
|
||||
Run Keyword If "${keywordArray}"!="${EMPTY}" Set To Dictionary ${itemNew} keywordArray=${array}
|
||||
Run Keyword If "${isHexbin}"!="${EMPTY}" Set To Dictionary ${itemNew} isHexbin=${isHexbin}
|
||||
Run Keyword If "${isInitialize}"!="${EMPTY}" Set To Dictionary ${itemNew} isInitialize=${isInitialize}
|
||||
Run Keyword If "${itemName}"!="${EMPTY}" Set To Dictionary ${itemNew} itemName=${itemName}
|
||||
Run Keyword If "${itemDesc}"!="${EMPTY}" Set To Dictionary ${itemNew} itemDesc=${itemDesc}
|
||||
[Return] ${itemNew}
|
||||
ManageFileItem
|
||||
[Documentation]
|
||||
... 接口未说明,待接口说明字段类型之后再完善
|
||||
[Arguments] ${item} ${type} ${action}
|
||||
Log Call ManageFileItem
|
||||
[Return] ${item}
|
||||
ManageExtensionStrItem
|
||||
[Documentation]
|
||||
... http_signature参数说明
|
||||
[Arguments] ${item} ${type} ${action}
|
||||
Log Call ManageExtensionStrItem
|
||||
${return} ${district} Run Keyword And Ignore Error Get From Dictionary ${item} district
|
||||
${district} Run Keyword If "${return}"!="FAIL" Set Variable ${district} ELSE Set Variable ${EMPTY}
|
||||
Run Keyword If "${action}"=="add" Should Not Be Empty ${district}
|
||||
${itemNew} ManageStrItem ${item} ${type} ${action}
|
||||
Run Keyword If "${district}"!="${EMPTY}" Set To Dictionary ${itemNew} district=${district}
|
||||
[Return] ${itemNew}
|
||||
ManageNumberItem
|
||||
[Documentation]
|
||||
... 接口未说明,待接口说明字段类型之后再完善
|
||||
[Arguments] ${item} ${type} ${action}
|
||||
Log Call ManageNumberItem
|
||||
[Return] ${item}
|
||||
ManageDeleteItemIds
|
||||
[Documentation]
|
||||
... 处理deleteItemIds
|
||||
|
||||
Reference in New Issue
Block a user