ip单元参数预计20.08版本后废弃,object为IP→endpoint时的addItemList/ updateItemList对象属性作适应性修改
This commit is contained in:
40
01-TestCase/tsg_bfapi/policy_object/20.08版本后废弃ip单元参数修改.robot
Normal file
40
01-TestCase/tsg_bfapi/policy_object/20.08版本后废弃ip单元参数修改.robot
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
*** Settings ***
|
||||||
|
Test Teardown DeletePolicyAndObjectAndProfile ${policyIds} ${objectIds} ${profiles}
|
||||||
|
Resource ../../../02-Keyword/tsg_bfapi/PolicyObject.robot
|
||||||
|
Resource ../../../02-Keyword/tsg_bfapi/policy_object/Policy.robot
|
||||||
|
Resource ../../../02-Keyword/tsg_bfapi/policy_object/Object.robot
|
||||||
|
Resource ../../../02-Keyword/tsg_bfapi/policy_object/Log.robot
|
||||||
|
Resource ../../../02-Keyword/tsg_bfapi/Common.robot
|
||||||
|
Library json
|
||||||
|
Library DateTime
|
||||||
|
*** Variables ***
|
||||||
|
@{policyIds}
|
||||||
|
@{profiles}
|
||||||
|
*** Test Cases ***
|
||||||
|
Policy-Post-v1-00013
|
||||||
|
Comment 创建IP
|
||||||
|
#object为IP→endpoint时的addItemList单个对象
|
||||||
|
${addItemList1} Create Dictionary isSession=endpoint ip=192.168.41.68-192.168.41.69 port=0-0 direction=0 protocol=0 isInitialize=0
|
||||||
|
#可以添加多个
|
||||||
|
${addItemLists} Create list ${addItemList1}
|
||||||
|
#objectList对象
|
||||||
|
${objectDict} Create Dictionary objectType=ip isValid=${1} addItemList=${addItemLists}
|
||||||
|
${rescode} ${objectId1} AddObjects ${1} ${objectDict}
|
||||||
|
${objectIds} Set Variable ${objectId1}
|
||||||
|
Log To Console Create IP Object
|
||||||
|
${params} Create Dictionary objectId=${objectId1} itemType=ip
|
||||||
|
${rescode} ${itemIds} ${itemList} GetObjectItems ${params}
|
||||||
|
Log To Console ${itemIds}
|
||||||
|
Comment 更新IP
|
||||||
|
#更新对象属性
|
||||||
|
FOR ${item} IN @{itemList}
|
||||||
|
Set To Dictionary ${item} ip 192.168.41.67-192.168.41.69
|
||||||
|
Remove From Dictionary ${item} isInitialize
|
||||||
|
Set To Dictionary ${item} port 0-1
|
||||||
|
END
|
||||||
|
${objectDict} Create Dictionary objectId=${objectId1} objectType=ip
|
||||||
|
... updateItemList=${itemList}
|
||||||
|
log ${objectDict}
|
||||||
|
log ${itemList}
|
||||||
|
${rescode} UpdateObjects ${1} ${objectDict} update
|
||||||
|
Log To Console Create IP Object
|
||||||
@@ -71,15 +71,12 @@ ManageIpItemList
|
|||||||
# 处理IP对象
|
# 处理IP对象
|
||||||
[Arguments] ${str}
|
[Arguments] ${str}
|
||||||
${returnList} Create List
|
${returnList} Create List
|
||||||
${list} Evaluate re.split('[,]', '${str}') re
|
# ${list} Evaluate re.split('[,]', '${str}') re
|
||||||
FOR ${var} IN @{list}
|
log ${str}
|
||||||
Continue For Loop If '${var}' == '${EMPTY}'
|
FOR ${var} IN @{str}
|
||||||
|
# Continue For Loop If '${var}' == '${EMPTY}'
|
||||||
# 区分入参的类型,分别处理
|
# 区分入参的类型,分别处理
|
||||||
${obj} Run Keyword If '#' in '${var}' and '&' in '${var}' IpItemType1 ${var}
|
Append To List ${returnList} ${var}
|
||||||
... ELSE IF '#' in '${var}' IpItemType2 ${var}
|
|
||||||
... ELSE IF '&' in '${var}' IpItemType3 ${var}
|
|
||||||
... ELSE IpItemType4 ${var}
|
|
||||||
Append To List ${returnList} ${obj}
|
|
||||||
END
|
END
|
||||||
[Return] ${returnList}
|
[Return] ${returnList}
|
||||||
|
|
||||||
@@ -94,7 +91,17 @@ ManageStrItemList
|
|||||||
Append To List ${returnList} ${obj}
|
Append To List ${returnList} ${obj}
|
||||||
END
|
END
|
||||||
[Return] ${returnList}
|
[Return] ${returnList}
|
||||||
|
IpItemType11
|
||||||
|
[Arguments] ${str}
|
||||||
|
${obj} Create Dictionary
|
||||||
|
${values} Evaluate re.split('[|]', '${str}') re
|
||||||
|
${isSession} Convert To Integer ${values}[0]
|
||||||
|
${ip} Convert To Integer ${values}[1]
|
||||||
|
${port} Convert To Integer ${values}[2]
|
||||||
|
${direction} Convert To Integer ${values}[3]
|
||||||
|
${protocol} Convert To Integer ${values}[4]
|
||||||
|
${return} ${isInitialize} Run Keyword And Ignore Error Convert To Integer ${list}[${index+1}]
|
||||||
|
Run Keyword If "${return}"!="FAIL" and "${isInitialize}"!="${EMPTY}" Set To Dictionary ${obj} isInitialize=${isInitialize}
|
||||||
IpItemType1
|
IpItemType1
|
||||||
# IP类型1:4|0|0|endpoint#range|192.168.40.1|192.168.40.50|80/88&range|192.168.40.1|192.168.40.50|80/88|1|itemName|itemDesc,...
|
# IP类型1:4|0|0|endpoint#range|192.168.40.1|192.168.40.50|80/88&range|192.168.40.1|192.168.40.50|80/88|1|itemName|itemDesc,...
|
||||||
[Arguments] ${str}
|
[Arguments] ${str}
|
||||||
|
|||||||
Reference in New Issue
Block a user