diff --git a/02-Keyword/tsg_bfapi/PolicyObject.robot b/02-Keyword/tsg_bfapi/PolicyObject.robot index 7a454f1..52e4d1e 100644 --- a/02-Keyword/tsg_bfapi/PolicyObject.robot +++ b/02-Keyword/tsg_bfapi/PolicyObject.robot @@ -143,21 +143,22 @@ DeleteWanIpPood log ${response} Add&Edit_PacketCapture - [Arguments] ${PacketCapture_data} ${location} ${isp} - ${body} PacketCapture ${PacketCapture_data} ${location} ${isp} + [Arguments] ${PacketCapture_data} ${DataCenter} + ${body} PacketCapture ${PacketCapture_data} ${DataCenter} log ${body} # ${body1} Set Variable {"refuseCode":true,"opAction":"add","returnData":0,"list":[{"ipList":[{"flag":"add","ip":"192.168.50.60","status":1597124967143,"isError":false,"testIp":"192.168.50.60","testIpRelativeLocation":"internal","testResult":[{"serverIp":"192.168.32.92","serverRelativeLocation":"external","serverGeoLocation":"UA","reachable":"pass"},{"serverIp":"192.168.32.91","serverRelativeLocation":"internal","serverGeoLocation":"Hongkang","reachable":"pass"}],"linkInfo":{"todo1":"fake-result","todo2":"test-API-only","todo3":"not-get-from-galaxy"},"relative_location":"internal","reachableCollect":"success"}],"profileName":"12313123123"}]} ${response} run keyword if '${PacketCapture_data}[policyId]'=="" BasePostRequest /${version}/troubleshooting/packetcapture/policy ${body} ... ELSE BaseEditRequestOK /${version}/troubleshooting/packetcapture/policy ${body} log ${response} ${response_code} Set Variable ${response['code']} - ${response_id} Set Variable ${response['data']['packetCaptureList'][0]['policyId']} + ${response_policy_id} Set Variable ${response['data']['packetCaptureList'][0]['policyId']} + ${response_task_id} Set Variable ${response['data']['packetCaptureList'][0]['taskId']} # log 11111111111111111111222222222222222 # log ${response_id} Should Be Equal As Strings ${response_code} 200 ${response} Convert to String ${response} log ${response} - [Return] ${response_id} + [Return] ${response_policy_id} ${response_task_id} DeletePacketCapture [Arguments] ${vpnlist} diff --git a/02-Keyword/tsg_common/ManageObjectBody.robot b/02-Keyword/tsg_common/ManageObjectBody.robot index 8214272..8d3e076 100644 --- a/02-Keyword/tsg_common/ManageObjectBody.robot +++ b/02-Keyword/tsg_common/ManageObjectBody.robot @@ -284,22 +284,23 @@ WanNatIpPood [Return] ${json} -# index - # [Arguments] ${list} ${value} - # ${index} evaluate int(0) - # ${1} evaluate int(1) - # FOR ${a} IN @{list} - # #${a} Set Variable ${a} - # run Keyword if "${a}"=="${value}" log ${index} - # ... ELSE ${index} evaluate ${index}+${1} - # log ${a} - # END +index + [Arguments] ${list} ${value} + ${index} evaluate int(0) + ${1} evaluate int(1) + FOR ${a} IN @{list} + #${a} Set Variable ${a} + log ${a} + ${index} run Keyword if '${a}'=='${value}' log ${index} + ... ELSE Evaluate ${index}+${1} + log ${a} + END abcd - [Arguments] ${effectiveRange_list} ${location} + [Arguments] ${effectiveRange_list} ${DataCenter} ${ab} create list - FOR ${a} IN @{location} - ${i} Index ${effectiveRange_list} ${a} + FOR ${a} IN @{DataCenter} + ${i} index ${effectiveRange_list} ${a} Append To List ${ab} ${i} END [Return] ${ab} @@ -322,23 +323,23 @@ loccation_And_isp_json PacketCapture - [Arguments] ${PacketCapturedata} ${location} ${isp} + [Arguments] ${PacketCapturedata} ${DataCenter} # 构建effectiveRange_tsg_sets - ${effectiveRange_list_manu} Create List location location2 Almaty Nursurtan isp transtel tnsplus ktel-mask ktel-bng ktel-mxpe - ${location_length} = Get Length ${location} - ${isp_length} = Get Length ${isp} + ${effectiveRange_list_manu} Create List Almaty + ${DataCenter_length} = Get Length ${DataCenter} + # ${isp_length} = Get Length ${isp} - ${location_ids} run keyword if ${location_length}==0 abcd ${effectiveRange_list_manu} ${location} - ... ELSE abcd ${effectiveRange_list_manu} ${location} - log ${location_ids} - ${loction_json} Create Dictionary tag=location value=${location} ids=${location_ids} + ${DataCenter_ids} run keyword if ${DataCenter_length}==0 abcd ${effectiveRange_list_manu} ${DataCenter} + ... ELSE abcd ${effectiveRange_list_manu} ${DataCenter} + log ${DataCenter_ids} + ${DataCenter_json} Create Dictionary tag=data_center value=${DataCenter} ids=${DataCenter_ids} - ${isp_ids} run keyword if ${isp_length}==0 abcd ${effectiveRange_list_manu} ${isp} - ... ELSE abcd ${effectiveRange_list_manu} ${isp} - log ${isp} - ${isp_json} Create Dictionary tag=isp value=${isp} ids=${isp_ids} + # ${isp_ids} run keyword if ${isp_length}==0 abcd ${effectiveRange_list_manu} ${isp} + # ... ELSE abcd ${effectiveRange_list_manu} ${isp} + # log ${isp} + # ${isp_json} Create Dictionary tag=isp value=${isp} ids=${isp_ids} - ${tag_sets_2} Create List ${loction_json} ${isp_json} + ${tag_sets_2} Create List ${DataCenter_json} ${tag_sets} Create List ${tag_sets_2} ${effectiveRange} Create Dictionary tag_sets=${tag_sets} # 编写iplist json格式 @@ -364,7 +365,7 @@ PacketCapture ... effectiveRange=${effectiveRange} log ${policyListDict} ${policyList} Create List ${policyListDict} - # 判断sjon是用于修改还是新增 + # 判断json是用于修改还是新增 ${opAction} run keyword if '${PacketCapturedata}[policyId]'=="" Set Variable add ... ELSE Set Variable update #编写最外面的格式