From 722e82c52cb3a1e5c4e01fd5dc64fb22185b189e Mon Sep 17 00:00:00 2001 From: gaochengrui <377185978@qq.com> Date: Thu, 23 Jul 2020 16:21:20 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85=20object=E5=AF=B9=E8=B1=A1?= =?UTF-8?q?=E7=BB=84=E6=96=B0=E5=A2=9E/=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20.08版本后废弃ip单元参数修改.robot | 16 +++++++- .../policy_object/ProcessObjectBody.robot | 40 +++++++++++++++---- 2 files changed, 48 insertions(+), 8 deletions(-) diff --git a/01-TestCase/tsg_bfapi/policy_object/20.08版本后废弃ip单元参数修改.robot b/01-TestCase/tsg_bfapi/policy_object/20.08版本后废弃ip单元参数修改.robot index b8976f1..81b5206 100644 --- a/01-TestCase/tsg_bfapi/policy_object/20.08版本后废弃ip单元参数修改.robot +++ b/01-TestCase/tsg_bfapi/policy_object/20.08版本后废弃ip单元参数修改.robot @@ -11,7 +11,7 @@ Library DateTime @{policyIds} @{profiles} *** Test Cases *** -Policy-Post-v1-00013 +single-object 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 @@ -37,4 +37,18 @@ Policy-Post-v1-00013 log ${objectDict} log ${itemList} ${rescode} UpdateObjects ${1} ${objectDict} update + Log To Console Create IP Object + +group-object + Comment 创建IP + ${subObjectIds} Create list 18470 18439 + ${objectDict} Create Dictionary objectType=ip isValid=${1} subObjectIds=${subObjectIds} + log ${objectDict} + ${rescode} ${objectId1} AddObjects ${1} ${objectDict} + ${objectIds} Set Variable ${objectId1} + Log To Console Create IP Object + ${params} Create Dictionary objectId=${objectId1} itemType=ip + Comment 更新IP + ${objectDict} Create Dictionary objectId=${objectId1} objectType=ip subObjectIds=${subObjectIds} + ${rescode} UpdateObjects ${1} ${objectDict} update Log To Console Create IP Object \ No newline at end of file diff --git a/02-Keyword/tsg_bfapi/policy_object/ProcessObjectBody.robot b/02-Keyword/tsg_bfapi/policy_object/ProcessObjectBody.robot index f34565d..dbe7c26 100644 --- a/02-Keyword/tsg_bfapi/policy_object/ProcessObjectBody.robot +++ b/02-Keyword/tsg_bfapi/policy_object/ProcessObjectBody.robot @@ -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}