diff --git a/01-TestCase/tsg_bfapi/setting/WanIPpoor.robot b/01-TestCase/tsg_bfapi/setting/WanIPpoor.robot new file mode 100644 index 0000000..931299a --- /dev/null +++ b/01-TestCase/tsg_bfapi/setting/WanIPpoor.robot @@ -0,0 +1,41 @@ +*** Settings *** +Test Teardown DeletePolicyAndObject ${policyIds} ${objectids} +Force Tags tsg_adc proxy_policy +Library OperatingSystem +Resource ../../../02-Keyword/tsg_adc/SystemCommand.robot +Resource ../../../02-Keyword/tsg_bfapi/PolicyObject.robot +Resource ../../../02-Keyword/tsg_bfapi/LogVariable.robot +Resource ../../../02-Keyword/tsg_bfapi/ApiRequest.robot +Resource ../../../03-Variable/AllFlowCaseVariable.txt + +*** Variables *** +${policyIds} ${EMPTY} +${objectids} ${EMPTY} + +*** Test Cases *** +create_wan_ip_pood_add + # 新增不填写 profileId + ${must_parameter} Create Dictionary profileName=zmmtest profileId= + ${iplist1} Create Dictionary ip=1.1.1.1 relative_location=internal link_info={"link_id":123,"src_mac":321} + ${iplist2} Create Dictionary ip=8.8.8.8 relative_location=external link_info={"xxxx":567,"yyyy":890} + ${wan_nat_ip_iplist} Create List ${iplist1} ${iplist2} + ${WanNatIpPood} Add&EditWanIpPood ${must_parameter} ${wan_nat_ip_iplist} + + +create_wan_ip_pood_updata + # 修改填写 profileId + ${must_parameter} Create Dictionary profileName=zmmtest profileId=41 + ${iplist1} Create Dictionary ip=1.1.1.1 relative_location=internal link_info={"link_id":123,"src_mac":321} + ${wan_nat_ip_iplist} Create List ${iplist1} + ${WanNatIpPood} Add&EditWanIpPood ${must_parameter} ${wan_nat_ip_iplist} + + +delete_wan_ip_pood + # 删除一个vpn + ${deletelist} Create List 41 + ${a} DeleteWanIpPood ${deletelist} +delete_wan_ip_pood_2 + # 删除一个vpn + ${deletelist} Create List 43 45 + ${a} DeleteWanIpPood ${deletelist} + diff --git a/02-Keyword/tsg_bfapi/PolicyObject.robot b/02-Keyword/tsg_bfapi/PolicyObject.robot index 8f922c8..9134454 100644 --- a/02-Keyword/tsg_bfapi/PolicyObject.robot +++ b/02-Keyword/tsg_bfapi/PolicyObject.robot @@ -107,6 +107,32 @@ DeleteWanVpn ${response} Convert to String ${response} log ${response} +Add&EditWanIpPood + [Arguments] ${must_parameter} ${wan_nat_ip_iplist} + ${body} WanNatIpPood ${must_parameter} ${wan_nat_ip_iplist} + log ${body} + ${response} run keyword if '${must_parameter}[profileId]'=="" BasePostRequest /${version}/policy/profile/wannat/ippool ${body} + ... ELSE BaseEditRequestOK /${version}/policy/profile/wannat/ippool ${body} + log ${response} + ${response_code} Set Variable ${response['code']} + Should Be Equal As Strings ${response_code} 200 + ${response} Convert to String ${response} + log ${response} + [Return] ${response} + +DeleteWanIpPood + [Arguments] ${vpnlist} + #删除Vpn + ${body} Create Dictionary profileIds=${vpnlist} + log 删除vpn + ${response} BaseDeleteRequest /${version}/policy/profile/wannat/ippool ${body} + ${response_code} Get From Dictionary ${response} code + Should Be Equal As Strings ${response_code} 200 + ${response} Convert to String ${response} + log ${response} + + + EditObject [Arguments] ${objectList} ${opAction} diff --git a/02-Keyword/tsg_common/ManageObjectBody.robot b/02-Keyword/tsg_common/ManageObjectBody.robot index 41c4020..7e734b2 100644 --- a/02-Keyword/tsg_common/ManageObjectBody.robot +++ b/02-Keyword/tsg_common/ManageObjectBody.robot @@ -248,4 +248,17 @@ WanVpn ${data2} set to dictionary ${dict} list=${wanvpnlist} [Return] ${data2} - +WanNatIpPood + [Arguments] ${must_parameter} ${wan_nat_ip_iplist} + # 编写iplist json格式 + ${wan_nat_ip_iplist} Create Dictionary profileId=${must_parameter}[profileId] profileName=${must_parameter}[profileName] ipList=${wan_nat_ip_iplist} isValid=1 + #编写二层list内地格式 + ${wan_nat_ip_list} Create List ${wan_nat_ip_iplist} + # 判断sjon是用于修改还是新增 + ${opAction} run keyword if '${must_parameter}[profileId]'=="" Set Variable add + ... ELSE Set Variable update + #编写最外面的格式 + ${wan_nat_ip_pood_data} Create Dictionary opAction=${opAction} returnData=1 list=${wan_nat_ip_list} + # 返回请求json + log ${wan_nat_ip_pood_data} + [Return] ${wan_nat_ip_pood_data}