This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
dongxiaoyan-tsg-autotest/01-TestCase/tsg_adc/Wan_Nat/Snat_00002.robot
2020-08-27 11:41:27 +08:00

93 lines
5.4 KiB
Plaintext

*** Settings ***
Test Teardown DeletePolicyAndObjectAndIPpoor ${policyIds} ${wan_ippoor}
Force Tags wan_nat
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_adc/FileOperation.robot
Resource ../../../02-Keyword/tsg_adc/FileOperation.robot
Resource ../../../02-Keyword/tsg_bfapi/policy_object/Policy.robot
Resource ../../../05-Other/AllFlowCaseVariable.txt
Resource ../../../02-Keyword/tsg_common/StmpHandle.robot
Library Custometest
Library SSHLibrary
*** Variables ***
${policyIds} ${EMPTY}
${wan_ippoor} ${EMPTY}
*** Test Cases ***
a_wan_nat-snat-00002
[Tags] Never+IP Pools内多个IP
Comment 创建ip1
${must_parameter} Create Dictionary profileName=jwctest profileId=
${iplist1} Create Dictionary ip=192.168.50.7 relative_location=internal link_info={"link_id":123,"src_mac":321}
${wan_nat_ip_iplist} Create List ${iplist1}
${ip1} Add&EditWanIpPood ${must_parameter} ${wan_nat_ip_iplist}
Comment 创建ip1
${must_parameter} Create Dictionary profileName=jwctest-1 profileId=
${iplist1} Create Dictionary ip=192.168.50.8 relative_location=internal link_info={"link_id":123,"src_mac":321}
${wan_nat_ip_iplist} Create List ${iplist1}
${ip2} Add&EditWanIpPood ${must_parameter} ${wan_nat_ip_iplist}
Comment 创建ip1
${must_parameter} Create Dictionary profileName=jwctest-2 profileId=
${iplist1} Create Dictionary ip=192.168.50.9 relative_location=internal link_info={"link_id":123,"src_mac":321}
${wan_nat_ip_iplist} Create List ${iplist1}
${ip3} Add&EditWanIpPood ${must_parameter} ${wan_nat_ip_iplist}
Comment 创建snat策略
${policyDict} Create Dictionary policyName=wan_nat_snat-00002 policyType=wannat policyDesc=autotest action=wannat userRegion={"method":"snat","snat_ip_pool_profile_id":[${ip1},${ip2},${ip3}],"snat_vpn_user_account":"user-1","connection_timeout":"5","ip_select_option":{"snat_algorithm":"random","time":"","count":""}} isValid=${1}
log ${policyDict}
${rescode} ${policyId2} AddPolicies 1 ${policyDict} v2
insert_policyId_to_file1 ip1 ${ip1}
insert_policyId_to_file1 ip2 ${ip2}
insert_policyId_to_file1 ip3 ${ip3}
insert_policyId_to_file1 snat3 ${policyId2}
b_wan_nat-snat-00002
[Documentation] b_wan_nat-snat-00002需和b_wan_nat-snat-00002_1同时执行
[Tags] Never+IP Pools内单个IP
Comment 功能端验证
${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/wan_nat_sant_00001.bat
${stringlist} run keyword if '${systemType}'=='Windows' Create List 一号店
${rescode} SystemCommands ${commandstr} ${stringlist}
Comment 功能端验证
${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/wan_nat_sant_00002.bat
${stringlist} run keyword if '${systemType}'=='Windows' Create List 北京租房网
${rescode} SystemCommands ${commandstr} ${stringlist}
Comment 功能端验证
${commandstr} run keyword if '${systemType}'=='Windows' set variable nslookup vip.com
${stringlist} run keyword if '${systemType}'=='Windows' Create List 183.6.216.41
${rescode} SystemCommands ${commandstr} ${stringlist}
Comment 功能端验证
${FTP} FTP_login ftp://192.168.100.5/stamp.txt -u"ftp_user:qazXSW@edc" Shandong Province
should contain ${FTP} ftp_success
Comment 功能端验证
${Smtp服务器} Set Variable Smtp.163.com
${Smtp服务器端口} Set Variable 25
${邮箱账号} Set Variable 13103304145@163.com
${邮箱密码} Set Variable jwc0409.
${邮件主题} Set Variable 123123132
${发送者} Set Variable 13103304145@163.com
${附件} Set Variable ["${mailpath}/姬巍川测试文件.txt"]
${接收者} Set Variable ["nqgjs6@163.com"]
${抄送者} Set Variable ["nqgjs6@163.com"]
${密送者} Set Variable ["nqgjs6@163.com"]
${邮件正文} Set Variable zzzzzzz
${发送邮件返回结果} EmailSendFull ${Smtp服务器} ${Smtp服务器端口} ${邮箱账号} ${邮箱密码} ${邮件主题} ${发送者} ${接收者} ${抄送者} ${密送者} ${邮件正文} ${附件}
Log ${发送邮件返回结果}
should contain ${发送邮件返回结果} mail_success
b_wan_nat-snat-00002_1
Open Connection 192.168.40.156
SSHLibrary.Login root Xxg-PUB<>90
Write tcpdump -n -nn -i ppp0 |grep 192.168.50.7
${output} read delay=1s
Should Contain ${output} 192.168.50.7.52640 > 10.10.120.250.80
Should Contain ${output} 10.10.120.250.80 > 192.168.50.7.52640
c_wan_nat-snat-00002
[Tags] Never+IP Pools内单个IP
${policyIds} Create List {"policyType":"wannat","policyIds":[${snat3}]}
${wan_ippoor} Create List ${ip1} ${ip2} ${ip3}