feat:(策略)1.策略排序;2.策略统计;3.策略生效字段查询

注意策略排序调用接口显示异常,策略生效字段查询返回总是空数据
4.Default_v2开头的参数配置替换为EMPTY
This commit is contained in:
wangxin
2020-06-30 18:26:22 +08:00
parent 9c133d0a70
commit 568029c8ef
4 changed files with 101 additions and 10 deletions

View File

@@ -277,9 +277,9 @@ ManageClientSubIDObjectV2
AnalysisObjectV2
[Arguments] ${policy} ${objectType} ${objList}
Log To Console Call AnalysisObjectV2
${policyObjectDefault} Run Keyword If "${objectType}"=="source" Set Variable ${Default_v2_SourceObject}
... ELSE IF "${objectType}"=="destination" Set Variable ${Default_v2_DestinationObject}
... ELSE IF "${objectType}"=="filterList" Set Variable ${Default_v2_FilterObject}
${policyObjectDefault} Run Keyword If "${objectType}"=="source" Set Variable ${EMPTY}
... ELSE IF "${objectType}"=="destination" Set Variable ${EMPTY}
... ELSE IF "${objectType}"=="filterList" Set Variable ${EMPTY}
${return} ${objectList} Run Keyword And Ignore Error Get From Dictionary ${policy} ${objectType}
@@ -287,7 +287,7 @@ AnalysisObjectV2
${objectList} Run Keyword If "${return}"=="FAIL" or "${objectList}"=="${EMPTY}" Set Variable ${policyObjectDefault}
... ELSE Set Variable ${objectList}
${list} Evaluate re.split('[,]', '${objectList}') re
${list} Evaluate re.split('[,]', '${objectList}') re
FOR ${var} IN @{list}
${tempObj} Run Keyword If "${objectType}"=="filterList" and "${var}" != "" ManageFilter ${var}
... ELSE IF "${var}" != "" ManageObject ${var} ELSE Set Variable ${EMPTY}
@@ -314,7 +314,7 @@ ManageFilter
[Documentation]
... filterList处理
[Arguments] ${filter}
Log To Console Call ManageFilter
Log Call ManageFilter
${filterObjectList} Create List
#截取objectId
${objectIds} Evaluate '${filter}'[0:'${filter}'.find(':')]
@@ -322,6 +322,7 @@ ManageFilter
${protocolField} Evaluate '${filter}'['${filter}'.find(':')+1:]
#遍历 objectId
${list} Evaluate re.split('[|]', '${objectIds}') re
Log list ${list}
FOR ${var} IN @{list}
${tempObj} Create Dictionary
${var} Run Keyword If '${var}'.isdigit() Evaluate int('${var}')
@@ -471,4 +472,37 @@ ManageStringAttributeValue
${string} Get From Dictionary ${attributeValue} string
Should Not Be Empty ${string}
Set To Dictionary ${dict} string=${string}
[Return] ${dict}
[Return] ${dict}
SortPolicyList
[Documentation]
... 多策略排序
... policyList为数组结构
[Arguments] ${policyList}
Log Call SortPolicyList
${policyListJson} Set Variable [
FOR ${policyObj} IN @{policyList}
${json} SortPolicyObject ${policyObj}
${policyListJson} Set Variable ${policyListJson}${json},
END
${policyListJson}= Replace String Using Regexp ${policyListJson} ,$ ]
Log SortPolicyList-${policyListJson}
[Return] ${policyListJson}
SortPolicyObject
[Documentation]
... 策略排序
... policyObject为字典结构
... policyObject policyId=${policyId} policyType=${policyType} beforePolicyId=${beforePolicyId} afterPolicyId=${afterPolicyId}
[Arguments] ${policyObject}
Dictionary Should Contain Key ${policyObject} policyId
Dictionary Should Contain Key ${policyObject} policyType
${policyId} Get From Dictionary ${policyObject} policyId
Run Keyword If "${policyId}"=="${EMPTY}" Should Not Be Empty ${policyId}
${policyType} Get From Dictionary ${policyObject} policyType
Should Not Be Empty ${policyType}
${return} ${beforePolicyId} Run Keyword And Ignore Error Get From Dictionary ${policyObject} beforePolicyId
${return1} ${afterPolicyId} Run Keyword And Ignore Error Get From Dictionary ${policyObject} afterPolicyId
Run Keyword If "${return}"=="FAIL" and "${return1}"=="FAIL" Fail beforePolicyId和 afterPolicyId必须设置一个
Run Keyword If "${return}"=="PASS" and "${return1}"=="PASS" and "${beforePolicyId}"=="${EMPTY}" and "${afterPolicyId}"=="${EMPTY}"
... Fail beforePolicyId和 afterPolicyId不能同时为空
${json} json.Dumps ${policyObject} ensure_ascii=False
[Return] ${json}