diff --git a/01-TestCase/tsg_adc/Wan_Nat/Snat_00001.robot b/01-TestCase/tsg_adc/Wan_Nat/Snat_00001.robot new file mode 100644 index 0000000..23eb64f --- /dev/null +++ b/01-TestCase/tsg_adc/Wan_Nat/Snat_00001.robot @@ -0,0 +1,70 @@ +*** Settings *** +Test Teardown DeletePolicyAndObjectAndIPpoor ${policyIds} ${wan_ippoor} +Force Tags tsg_adc_wp adc_api 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 + +*** 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":"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 ip ${WanNatIpPood} + insert_policyId_to_file1 policyId2 ${policyId2} + +b_wan_nat-snat-00001 + [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 Welcome to nginx HTTP + ${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 self signed certificate + ${rescode} SystemCommands ${commandstr} ${stringlist} + Comment 功能端验证 + ${commandstr} run keyword if '${systemType}'=='Windows' set variable nslookup test.com + ${stringlist} run keyword if '${systemType}'=='Windows' Create List 114.114.114.114 + ${rescode} SystemCommands ${commandstr} ${stringlist} + Comment 功能端验证 + ${FTP} FTP_login ftp://192.168.44.8/test.txt -u"ftpuser:123456" 123456 + should contain ${FTP} ftp_success + Comment 功能端验证 + ${Smtp服务器} Set Variable 192.168.40.156 + ${Smtp服务器端口} Set Variable 25 + ${邮箱账号} Set Variable yyq@163.com + ${邮箱密码} Set Variable 111111 + ${邮件主题} Set Variable 你好明天 + ${发送者} Set Variable yyq@163.com + ${附件} Set Variable ["${mailpath}/朱明明测试文件.txt"] + ${接收者} Set Variable ["zmm@163.com"] + ${抄送者} Set Variable ["zmm@163.com"] + ${密送者} Set Variable ["zmm@163.com"] + ${邮件正文} Set Variable 朱明明content + ${发送邮件返回结果} EmailSendFull ${Smtp服务器} ${Smtp服务器端口} ${邮箱账号} ${邮箱密码} ${邮件主题} ${发送者} ${接收者} ${抄送者} ${密送者} ${邮件正文} ${附件} + Log ${发送邮件返回结果} + should contain ${发送邮件返回结果} mail_success + +c_wan_nat-snat-00001 + [Tags] Never+IP Pools内单个IP + ${policyIds} Create List {"policyType":"wannat","policyIds":[${policyId2}]} + ${wan_ippoor} Create List ${ip} diff --git a/01-TestCase/tsg_adc/Wan_Nat/Snat_00002.robot b/01-TestCase/tsg_adc/Wan_Nat/Snat_00002.robot new file mode 100644 index 0000000..4b362ec --- /dev/null +++ b/01-TestCase/tsg_adc/Wan_Nat/Snat_00002.robot @@ -0,0 +1,82 @@ +*** Settings *** +Test Teardown DeletePolicyAndObjectAndIPpoor ${policyIds} ${wan_ippoor} +Force Tags tsg_adc_wp adc_api 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 + +*** 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 + [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 Welcome to nginx HTTP + ${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 self signed certificate + ${rescode} SystemCommands ${commandstr} ${stringlist} + Comment 功能端验证 + ${commandstr} run keyword if '${systemType}'=='Windows' set variable nslookup test.com + ${stringlist} run keyword if '${systemType}'=='Windows' Create List 202.106.196.115 + ${rescode} SystemCommands ${commandstr} ${stringlist} + Comment 功能端验证 + ${FTP} FTP_login ftp://192.168.44.8/test.txt -u"ftpuser:123456" 123456 + should contain ${FTP} ftp_success + Comment 功能端验证 + ${Smtp服务器} Set Variable 192.168.40.156 + ${Smtp服务器端口} Set Variable 25 + ${邮箱账号} Set Variable yyq@163.com + ${邮箱密码} Set Variable 111111 + ${邮件主题} Set Variable 你好明天 + ${发送者} Set Variable yyq@163.com + ${附件} Set Variable ["${mailpath}/朱明明测试文件.txt"] + ${接收者} Set Variable ["zmm@163.com"] + ${抄送者} Set Variable ["zmm@163.com"] + ${密送者} Set Variable ["zmm@163.com"] + ${邮件正文} Set Variable 朱明明content + ${发送邮件返回结果} EmailSendFull ${Smtp服务器} ${Smtp服务器端口} ${邮箱账号} ${邮箱密码} ${邮件主题} ${发送者} ${接收者} ${抄送者} ${密送者} ${邮件正文} ${附件} + Log ${发送邮件返回结果} + should contain ${发送邮件返回结果} mail_success + +c_wan_nat-snat-00002 + [Tags] Never+IP Pools内单个IP + ${policyIds} Create List {"policyType":"wannat","policyIds":[${snat3}]} + ${wan_ippoor} Create List ${ip1} ${ip2} ${ip3} diff --git a/01-TestCase/tsg_adc/Wan_Nat/__init__.robot b/01-TestCase/tsg_adc/Wan_Nat/__init__.robot new file mode 100644 index 0000000..e69de29 diff --git a/01-TestCase/tsg_adc/multi_step/a_Deny_Tests.robot b/01-TestCase/tsg_adc/multi_step/a_Deny_Tests.robot index 7926761..9b3f0b4 100644 --- a/01-TestCase/tsg_adc/multi_step/a_Deny_Tests.robot +++ b/01-TestCase/tsg_adc/multi_step/a_Deny_Tests.robot @@ -324,7 +324,7 @@ Proxy-Policy-deny-00013 ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=incap_ses*|Set-Cookie,*Max-Age=604800|Set-Cookie,domain=.ke.com|Set-Cookie,irkzadmin_session*|Set-Cookie ${rescode} ${objectId1} AddObject2 ${1} ${objectDict} Comment 创建url - ${objectDict} Create Dictionary objectType=url isValid=${1} aaddItemList=www.nypl.org,thailand.com.co,ke.com,nationalbank.kz + ${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=www.nypl.org,thailand.com.co,ke.com,nationalbank.kz ${rescode} ${objectId2} AddObject2 ${1} ${objectDict} Comment 创建拦截策略 ${policyDict} Create Dictionary policyName=SecurityPolicy-Intercept-deny policyType=tsg_security policyDesc=autotest action=intercept userRegion={"protocol":"SSL","keyring":1,"decryption":1,"decrypt_mirror":{"enable":0,"mirror_profile":null}} filterList=${objectId}|TSG_FIELD_SSL_SNI isValid=${1} appIdObjects=3 diff --git a/01-TestCase/tsg_adc/multi_step/a_Dnat_Tests.robot b/01-TestCase/tsg_adc/multi_step/a_Dnat_Tests.robot index ead1ff5..28d132e 100644 --- a/01-TestCase/tsg_adc/multi_step/a_Dnat_Tests.robot +++ b/01-TestCase/tsg_adc/multi_step/a_Dnat_Tests.robot @@ -11,7 +11,7 @@ Resource ../../../02-Keyword/tsg_bfapi/policy_object/Policy.robot *** Test Cases *** wan_nat-dnat-00001 Comment 创建IP - ${addItemList1} Create Dictionary isSession=endpoint ip=99.99.99.99-99.99.99.99 port=0-0 direction=0 protocol=0 isInitialize=0 + ${addItemList1} Create Dictionary isSession=endpoint ip=219.157.114.43-219.157.114.43 port=0-0 direction=0 protocol=0 isInitialize=0 ${addItemLists} Create list ${addItemList1} ${objectDict} Create Dictionary objectType=ip isValid=${1} addItemList=${addItemLists} ${rescode} ${objectId} AddObjects ${1} ${objectDict} @@ -24,13 +24,39 @@ wan_nat-dnat-00001 wan_nat-dnat-00002 Comment 创建IP - ${addItemList1} Create Dictionary isSession=endpoint ip=99.99.99.99-99.99.99.99 port=0-0 direction=0 protocol=0 isInitialize=0 + ${addItemList1} Create Dictionary isSession=endpoint ip=220.194.214.86-220.194.214.86 port=0-0 direction=0 protocol=0 isInitialize=0 ${addItemLists} Create list ${addItemList1} ${objectDict} Create Dictionary objectType=ip isValid=${1} addItemList=${addItemLists} ${rescode} ${objectId} AddObjects ${1} ${objectDict} Comment 创建dnat策略 - ${policyDict} Create Dictionary policyName=wan_nat_dnat-00002 policyType=wannat policyDesc=autotest action=wannat userRegion={"method":"dnat","dnat_vpn_user_account":"jwc-vpn","dnat_destination_port":80,"dnat_when_vpn_offline":"forward"} isValid=${1} destination=${objectId}|TSG_SECURITY_DESTINATION_ADDR + ${policyDict} Create Dictionary policyName=wan_nat_dnat-00002 policyType=wannat policyDesc=autotest action=wannat userRegion={"method":"dnat","dnat_vpn_user_account":"jwc-vpn","dnat_destination_port":8001,"dnat_when_vpn_offline":"forward"} isValid=${1} destination=${objectId}|TSG_SECURITY_DESTINATION_ADDR log ${policyDict} ${rescode} ${policyId2} AddPolicies 1 ${policyDict} v2 insert_policyId_to_file1 dnat_objectId1 ${objectId} insert_policyId_to_file1 dnat_policyId1 ${policyId2} + +wan_nat-dnat-00003 + Comment 创建IP + ${addItemList1} Create Dictionary isSession=endpoint ip=182.92.25.74-182.92.25.74 port=0-0 direction=0 protocol=0 isInitialize=0 + ${addItemLists} Create list ${addItemList1} + ${objectDict} Create Dictionary objectType=ip isValid=${1} addItemList=${addItemLists} + ${rescode} ${objectId} AddObjects ${1} ${objectDict} + Comment 创建dnat策略 + ${policyDict} Create Dictionary policyName=wan_nat_dnat-00003 policyType=wannat policyDesc=autotest action=wannat userRegion={"method":"dnat","dnat_vpn_user_account":"jwc-vpn","dnat_destination_port":8001,"dnat_when_vpn_offline":"forward"} isValid=${1} destination=${objectId}|TSG_SECURITY_DESTINATION_ADDR + log ${policyDict} + ${rescode} ${policyId2} AddPolicies 1 ${policyDict} v2 + insert_policyId_to_file1 dnat_objectId2 ${objectId} + insert_policyId_to_file1 dnat_policyId2 ${policyId2} + +wan_nat-dnat-00004 + Comment 创建IP + ${addItemList1} Create Dictionary isSession=endpoint ip=112.81.159.16-112.81.159.16 port=0-0 direction=0 protocol=0 isInitialize=0 + ${addItemLists} Create list ${addItemList1} + ${objectDict} Create Dictionary objectType=ip isValid=${1} addItemList=${addItemLists} + ${rescode} ${objectId} AddObjects ${1} ${objectDict} + Comment 创建dnat策略 + ${policyDict} Create Dictionary policyName=wan_nat_dnat-00004 policyType=wannat policyDesc=autotest action=wannat userRegion={"method":"dnat","dnat_vpn_user_account":"jwc-vpn","dnat_destination_port":8111,"dnat_when_vpn_offline":"forward"} isValid=${1} destination=${objectId}|TSG_SECURITY_DESTINATION_ADDR + log ${policyDict} + ${rescode} ${policyId2} AddPolicies 1 ${policyDict} v2 + insert_policyId_to_file1 dnat_objectId3 ${objectId} + insert_policyId_to_file1 dnat_policyId3 ${policyId2} diff --git a/01-TestCase/tsg_adc/multi_step/b_Dnat_Tests.robot b/01-TestCase/tsg_adc/multi_step/b_Dnat_Tests.robot index 3b2db3e..7020e7f 100644 --- a/01-TestCase/tsg_adc/multi_step/b_Dnat_Tests.robot +++ b/01-TestCase/tsg_adc/multi_step/b_Dnat_Tests.robot @@ -1 +1,40 @@ +*** Settings *** +Force Tags tsg_adc_wp proxy_policy adc_verify +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 + *** Test Cases *** +wan_nat-dnat-00001 + Comment 功能端验证HTTP验证 + ${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/wan_nat_dant_00001.bat + ... ELSE set variable curl 219.157.114.43 + ${stringlist} run keyword if '${systemType}'=='Windows' Create List Welcome to nginx HTTP! + ... ELSE Create List Welcome to nginx HTTP! + ${rescode} SystemCommands ${commandstr} ${stringlist} + +wan_nat-dnat-00002 + Comment 功能端验证HTTP验证 + ${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/wan_nat_dant_00002.bat + ... ELSE set variable curl 220.194.214.86 + ${stringlist} run keyword if '${systemType}'=='Windows' Create List Welcome to nginx HTTP! + ... ELSE Create List Welcome to nginx HTTP! + ${rescode} SystemCommands ${commandstr} ${stringlist} + +wan_nat-dnat-00003 + Comment 功能端验证HTTP验证 + ${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/wan_nat_dant_00003.bat + ... ELSE set variable curl 182.92.25.74 + ${stringlist} run keyword if '${systemType}'=='Windows' Create List Welcome to nginx HTTP! + ... ELSE Create List Welcome to nginx HTTP! + ${rescode} SystemCommands ${commandstr} ${stringlist} + +wan_nat-dnat-00004 + Comment 功能端验证HTTP验证 + ${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/wan_nat_dant_00004.bat + ... ELSE set variable curl 112.81.159.16 + ${stringlist} run keyword if '${systemType}'=='Windows' Create List Welcome to nginx HTTP! + ... ELSE Create List Welcome to nginx HTTP! + ${rescode} SystemCommands ${commandstr} ${stringlist} diff --git a/01-TestCase/tsg_adc/multi_step/c_Allow_Http_Tests.robot b/01-TestCase/tsg_adc/multi_step/c_Allow_Http_Tests.robot index 3cae16f..a8abdac 100644 --- a/01-TestCase/tsg_adc/multi_step/c_Allow_Http_Tests.robot +++ b/01-TestCase/tsg_adc/multi_step/c_Allow_Http_Tests.robot @@ -15,16 +15,14 @@ ${objectids} ${EMPTY} *** Test Cases *** SecurityPolicy-Allow-Http-00001 - [Tags] fqdn #删除对象 ${objectids} set Variable ${allow_http_objectId} #删除策略 ${policyIds} Create List {"policyType":"tsg_security","policyIds":[${allow_http_policyId}]} ${s} Convert to String ${allow_http_policyId} - GetLogList security_event_log ${starttime} ${endtime} ${testClentIP} ${s} http_host clintonairport.com + GetLogList security_event_log ${starttime} ${endtime} ${testClentIP} ${s} http_host www.airpano.com SecurityPolicy-Allow-Http-00002 - [Tags] cat #删除对象 ${objectids} set Variable ${allow_http_objectId1} #删除策略 diff --git a/01-TestCase/tsg_adc/multi_step/c_Dnat_Tests.robot b/01-TestCase/tsg_adc/multi_step/c_Dnat_Tests.robot index 261a2d5..e082b64 100644 --- a/01-TestCase/tsg_adc/multi_step/c_Dnat_Tests.robot +++ b/01-TestCase/tsg_adc/multi_step/c_Dnat_Tests.robot @@ -25,3 +25,15 @@ wan_nat-dnat-00002 ${objectids} set Variable ${dnat_objectId1} #删除策略 ${policyIds} Create List {"policyType":"wannat","policyIds":[${dnat_policyId1}]} + +wan_nat-dnat-00003 + #删除对象 + ${objectids} set Variable ${dnat_objectId2} + #删除策略 + ${policyIds} Create List {"policyType":"wannat","policyIds":[${dnat_policyId2}]} + +wan_nat-dnat-00004 + #删除对象 + ${objectids} set Variable ${dnat_objectId3} + #删除策略 + ${policyIds} Create List {"policyType":"wannat","policyIds":[${dnat_policyId3}]} diff --git a/05-Other/curl/command/wan_nat_dant_00001.bat b/05-Other/curl/command/wan_nat_dant_00001.bat new file mode 100644 index 0000000..5d788e0 --- /dev/null +++ b/05-Other/curl/command/wan_nat_dant_00001.bat @@ -0,0 +1 @@ +curl 219.157.114.43 | iconv -f utf-8 -t gbk \ No newline at end of file diff --git a/05-Other/curl/command/wan_nat_dant_00002.bat b/05-Other/curl/command/wan_nat_dant_00002.bat new file mode 100644 index 0000000..3ed249c --- /dev/null +++ b/05-Other/curl/command/wan_nat_dant_00002.bat @@ -0,0 +1 @@ +curl 220.194.214.86 | iconv -f utf-8 -t gbk \ No newline at end of file diff --git a/05-Other/curl/command/wan_nat_dant_00003.bat b/05-Other/curl/command/wan_nat_dant_00003.bat new file mode 100644 index 0000000..357203d --- /dev/null +++ b/05-Other/curl/command/wan_nat_dant_00003.bat @@ -0,0 +1 @@ +curl 182.92.25.74 | iconv -f utf-8 -t gbk \ No newline at end of file diff --git a/05-Other/curl/command/wan_nat_dant_00004.bat b/05-Other/curl/command/wan_nat_dant_00004.bat new file mode 100644 index 0000000..ad8bd0c --- /dev/null +++ b/05-Other/curl/command/wan_nat_dant_00004.bat @@ -0,0 +1 @@ +curl 112.81.159.16 | iconv -f utf-8 -t gbk \ No newline at end of file diff --git a/05-Other/curl/command/wan_nat_sant_00001.bat b/05-Other/curl/command/wan_nat_sant_00001.bat new file mode 100644 index 0000000..0944a1d --- /dev/null +++ b/05-Other/curl/command/wan_nat_sant_00001.bat @@ -0,0 +1 @@ +curl http://192.168.40.156/ | iconv -f utf-8 -t gbk \ No newline at end of file diff --git a/05-Other/curl/command/wan_nat_sant_00002.bat b/05-Other/curl/command/wan_nat_sant_00002.bat new file mode 100644 index 0000000..802ce42 --- /dev/null +++ b/05-Other/curl/command/wan_nat_sant_00002.bat @@ -0,0 +1 @@ +curl https://192.168.40.156/ | iconv -f utf-8 -t gbk \ No newline at end of file