补充 object对象组新增/修改

This commit is contained in:
gaochengrui
2020-07-23 16:21:20 +08:00
parent 7c4aafca49
commit 722e82c52c
2 changed files with 48 additions and 8 deletions

View File

@@ -46,7 +46,15 @@ ObjectOperation
Log Object_Request_Body-${json}
[Return] ${json}
listorone
[Arguments] ${object}
${addItemList} Evaluate str('addItemList'in${object}.keys())
log ${addItemList}
${subObjectIds} Evaluate str('subObjectIds'in${object}.keys())
log ${subObjectIds}
${objectparm} set variable ${addItemList} ${subObjectIds}
should contain x times ${objectparm} True 1
# Should Not Be Empty ${object}[addItemList] or Should Not Be Empty ${object}[subObjectIds]
ObjectOrganize
[Documentation]
... 描述入口opAction参数可为'add','update','disable','enable'
@@ -61,8 +69,7 @@ ObjectOrganize
# Should Not Be Empty ${object}[objectType]
# Set To Dictionary ${returnDict} objectType=${object}[objectType]
#新增时addItemList不能为空
Run Keyword If "${opAction}"=="add" Should Not Be Empty ${object}[addItemList]
Run Keyword If "${opAction}"=="add" listorone ${object}
Run Keyword If "${opAction}"=="update" Should Not Be Empty ${object}[objectId]
Run Keyword If "${opAction}"=="enable" Should Not Be Empty ${object}[objectId]
Run Keyword If "${opAction}"=="disable" Should Not Be Empty ${object}[objectId]
@@ -99,10 +106,29 @@ ObjectOrganize
Run Keyword If "${return}"!="FAIL" and "${objectDesc}"!="${EMPTY}" Set To Dictionary ${returnDict} objectDesc=${objectDesc}
... ELSE Set To Dictionary ${returnDict} objectDesc=${Default_ObjectDesc}
${return} ${subObjectIds} Run Keyword And Ignore Error Get From Dictionary ${object} subObjectIds
${subObjectIdsV} Run Keyword If "${return}"!="FAIL" and "${subObjectIds}"!="${EMPTY}" and "${subObjectIds}"!="${None}" Evaluate list(map(int, re.split('[,]', '${subObjectIds}'))) re
... ELSE Set Variable ${emptyList}
Set To Dictionary ${returnDict} subObjectIds=${subObjectIdsV}
Run Keyword If "${return}"!="FAIL" and "${subObjectIds}"!="${EMPTY}" and "${subObjectIds}"!="${None}" Set To Dictionary ${returnDict} subObjectIds=${subObjectIds}
... ELSE Set Variable ${emptyList}
#补充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}
#... ELSE Set To Dictionary ${returnDict} fromFqdns=${emptyList}
log ${fromFqdns}
${return} ${fromProtocol} Run Keyword And Ignore Error Get From Dictionary ${object} fromProtocol
Run Keyword If "${return}"!="FAIL" and "${fromProtocol}"!="${EMPTY}" Set To Dictionary ${returnDict} fromProtocol=${fromProtocol}
#... ELSE Set To Dictionary ${returnDict} fromProtocol=${Default_fromProtocol}
${return} ${learningDepth} Run Keyword And Ignore Error Get From Dictionary ${object} learningDepth
Run Keyword If "${return}"!="FAIL" and "${learningDepth}"!="${EMPTY}" Set To Dictionary ${returnDict} learningDepth=${learningDepth}
#... ELSE Set To Dictionary ${returnDict} learningDepth=${Default_learningDepth}
${return} ${agingTime} Run Keyword And Ignore Error Get From Dictionary ${object} agingTime
Run Keyword If "${return}"!="FAIL" and "${fromProtocol}"!="${EMPTY}" Set To Dictionary ${returnDict} agingTime=${agingTime}
#... ELSE Set To Dictionary ${returnDict} agingTime=${Default_agingTime}
${return} ${voteClientNum} Run Keyword And Ignore Error Get From Dictionary ${object} voteClientNum
Run Keyword If "${return}"!="FAIL" and "${fromProtocol}"!="${EMPTY}" Set To Dictionary ${returnDict} voteClientNum=${voteClientNum}
#... ELSE Set To Dictionary ${returnDict} voteClientNum=${Default_voteClientNum}
${return} ${learnedIpLimit} Run Keyword And Ignore Error Get From Dictionary ${object} learnedIpLimit
Run Keyword If "${return}"!="FAIL" and "${fromProtocol}"!="${EMPTY}" Set To Dictionary ${returnDict} learnedIpLimit=${learnedIpLimit}
#... 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}