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_00001.robot
2020-08-27 11:41:27 +08:00

82 lines
4.6 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

*** Settings ***
Documentation snat运行需要先运行a然后将连接vpn后运行b和c
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-00001
[Tags] Never+IP Pools内单个IP
${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}
${WanNatIpPood} Add&EditWanIpPood ${must_parameter} ${wan_nat_ip_iplist}
log ${WanNatIpPood}
Comment 创建snat策略
${policyDict} Create Dictionary policyName=wan_nat_snat-00001 policyType=wannat policyDesc=autotest action=wannat userRegion={"method":"snat","snat_ip_pool_profile_id":[${WanNatIpPood}],"snat_vpn_user_account":"${vpn}","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 ip ${WanNatIpPood}
insert_policyId_to_file1 policyId2 ${policyId2}
b_wan_nat-snat-00001
[Documentation] b_wan_nat-snat-00001需和b_wan_nat-snat-00001_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-00001_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-00001
[Tags] Never+IP Pools内单个IP
${policyIds} Create List {"policyType":"wannat","policyIds":[${policyId2}]}
${wan_ippoor} Create List ${ip}