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/multi_step/b_Replace_Tests.robot

240 lines
21 KiB
Plaintext
Raw Normal View History

2020-07-29 20:20:03 +08:00
*** 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
Resource ../../../02-Keyword/tsg_bfapi/policy_object/Policy.robot
Resource ../../../03-Variable/ApplicationID.txt
Resource ../../../05-Other/AllFlowCaseVariable.txt
2020-07-29 20:20:03 +08:00
*** Test Cases ***
Proxy-Policy-replace-00001
Comment 功能端验证HTTP验证
${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/ProxyPolicy_replace_00001.bat
... ELSE set variable curl -kv https://destidotcom.wordpress.com/contact/
${stringlist} run keyword if '${systemType}'=='Windows' Create List 明天你好 Tango Secure Gateway CA
... ELSE Create List 明天你好 Tango Secure Gateway CA
${rescode} SystemCommands ${commandstr} ${stringlist}
Comment 改变拦截策略
${policyDict} Create Dictionary policyId=${intercept_replace_policyId} source=${replace_objectId42}|TSG_SECURITY_SOURCE_LOCATION policyName=SecurityPolicy-Intercept-replace-1 policyType=tsg_security policyDesc=autotest action=intercept userRegion={"protocol":"SSL","keyring":1,"decryption":1,"decrypt_mirror":{"enable":0,"mirror_profile":null}} filterList=${replace_objectId43}|TSG_FIELD_SSL_SNI isValid=${1} appIdObjects=${SSL_ID}
log ${policyDict}
${rescode} UpdatePolicies 1 ${policyDict} v2 update
Comment 改变Replace策略
${policyDict} Create Dictionary policyId=${replace_policyId} source=${replace_objectId42}|TSG_SECURITY_SOURCE_LOCATION policyName=Proxy-Policy-replace-00001-1 policyType=pxy_manipulation policyDesc=autotest action=manipulation userRegion={"method":"replace","rules":[{"search_in":"http_resp_body","find":"Artificial","replace_with":"后天你好吗"}],"protocol":"HTTP"} filterList=${replace_objectId43}|TSG_FIELD_HTTP_HOST,${replace_objectId39}|TSG_FIELD_HTTP_URL isValid=${1} appIdObjects=${HTTP_ID}
log ${policyDict}
${rescode} UpdatePolicies 1 ${policyDict} v2 update
sleep 3
Comment 功能端验证HTTP验证
${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/ProxyPolicy_replace_00001.bat
... ELSE set variable r
${stringlist} run keyword if '${systemType}'=='Windows' Create List 后天你好吗 Tango Secure Gateway CA
... ELSE Create List 后天你好吗 Tango Secure Gateway CA
${rescode} SystemCommands ${commandstr} ${stringlist}
2020-07-29 20:20:03 +08:00
Proxy-Policy-replace-00002
Comment 功能端验证HTTP验证
${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/ProxyPolicy_replace_00002.bat
... ELSE set variable curl -kv https://airastana.com/kaz/kk-kz/Josparlau/Kop-baghytty-ushu
${stringlist} run keyword if '${systemType}'=='Windows' Create List Tango Secure Gateway CA
... ELSE Create List Tango Secure Gateway CA
${rescode} SystemCommands ${commandstr} ${stringlist}
Comment 改变Replace策略
${policyDict} Create Dictionary policyId=${replace_policyId1} policyName=Proxy-Policy-replace-00002-1 policyType=pxy_manipulation policyDesc=autotest action=manipulation userRegion={"method":"replace","rules":[{"search_in":"http_req_uri","find":"Kop-baghytty-ushu","replace_with":"Arnaiy-usynystar"}],"protocol":"HTTP"} filterList=109|TSG_FIELD_HTTP_HOST,${replace_objectId44}|TSG_FIELD_HTTP_URL isValid=${1} appIdObjects=${HTTP_ID}
log ${policyDict}
${rescode} UpdatePolicies 1 ${policyDict} v2 update
sleep ${policyModifySleepSeconds}
Comment 功能端验证HTTP验证
${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/ProxyPolicy_replace_00002.bat
... ELSE set variable curl -kv https://airastana.com/kaz/kk-kz/Josparlau/Kop-baghytty-ushu
${stringlist} run keyword if '${systemType}'=='Windows' Create List Tango Secure Gateway CA
... ELSE Create List Tango Secure Gateway CA
2020-07-29 20:20:03 +08:00
${rescode} SystemCommands ${commandstr} ${stringlist}
Proxy-Policy-replace-00003
Comment 功能端验证HTTP验证
${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/ProxyPolicy_replace_00003.bat
... ELSE set variable curl -kv https://umcfa.webs.com/
${stringlist} run keyword if '${systemType}'=='Windows' Create List Australia Tango Secure Gateway CA
... ELSE Create List Australia Tango Secure Gateway CA
2020-07-29 20:20:03 +08:00
${rescode} SystemCommands ${commandstr} ${stringlist}
Comment 功能端验证HTTP验证
${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/ProxyPolicy_replace_00003_1.bat
... ELSE set variable curl -kv https://www.pjpugliese.com/
${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/ProxyPolicy_replace_00003_1.bat
... ELSE set variable curl -kv https://www.pjpugliese.com/
${stringlist} run keyword if '${systemType}'=='Windows' Create List Peter Pugliese Tango Secure Gateway CA
... ELSE Create List Peter Pugliese Tango Secure Gateway CA
2020-07-29 20:20:03 +08:00
${rescode} SystemCommands ${commandstr} ${stringlist}
Comment 功能端验证HTTP验证
${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/ProxyPolicy_replace_00003_2.bat
... ELSE set variable curl -kv https://carblog.co.za/
${stringlist} run keyword if '${systemType}'=='Windows' Create List Carblog Tango Secure Gateway CA
... ELSE Create List Carblog Tango Secure Gateway CA
2020-07-29 20:20:03 +08:00
${rescode} SystemCommands ${commandstr} ${stringlist}
Comment 功能端验证HTTP验证
${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/ProxyPolicy_replace_00003_3.bat
... ELSE set variable curl -kv https://www.ornithomedia.com/
${stringlist} run keyword if '${systemType}'=='Windows' Create List 403 Tango Secure Gateway CA
... ELSE Create List 403 Tango Secure Gateway CA
2020-07-29 20:20:03 +08:00
${rescode} SystemCommands ${commandstr} ${stringlist}
Proxy-Policy-replace-00004
Comment 功能端验证HTTP验证
${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/ProxyPolicy_replace_00004.bat
... ELSE set variable curl -kv --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.70 Safari/537.36" --referer 'https://www.baidu.com/' https://www.ino.com/news/headlines/
2020-07-29 20:20:03 +08:00
${stringlist} run keyword if '${systemType}'=='Windows' Create List text/json Tango Secure Gateway CA
... ELSE Create List text/json Tango Secure Gateway CA
${rescode} SystemCommands ${commandstr} ${stringlist}
Comment 改变Replace策略
${policyDict} Create Dictionary policyId=${replace_policyId3} policyName=Proxy-Policy-replace-00004-1 policyType=pxy_manipulation policyDesc=autotest action=manipulation userRegion={"method":"replace","rules":[{"search_in":"http_resp_header","find":"html","replace_with":"hahaha"}],"protocol":"HTTP"} filterList=${replace_objectId5}|TSG_FIELD_HTTP_URL,${replace_objectId45}|TSG_FIELD_HTTP_REQ_HDR isValid=${1} appIdObjects=${HTTP_ID}
log ${policyDict}
${rescode} UpdatePolicies 1 ${policyDict} v2 update
sleep 5
Comment 功能端验证HTTP验证
${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/ProxyPolicy_replace_00004.bat
... ELSE set variable curl -kv --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.70 Safari/537.36" --referer 'https://www.baidu.com/' https://www.ino.com/news/headlines/
${stringlist} run keyword if '${systemType}'=='Windows' Create List text/hahaha Tango Secure Gateway CA
... ELSE Create List text/hahaha Tango Secure Gateway CA
${rescode} SystemCommands ${commandstr} ${stringlist}
2020-07-29 20:20:03 +08:00
Proxy-Policy-replace-00005
Comment 功能端验证HTTP验证
${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/ProxyPolicy_replace_00005.bat
... ELSE set variable curl -kv --user-agent "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML like Gecko) Chrome/31.0.1650.63 Safari/537.36" --referer 'https://www.baidu.com/' https://www.bestwestern.com/en_US.html
${stringlist} run keyword if '${systemType}'=='Windows' Create List 403 Tango Secure Gateway CA
... ELSE Create List 403 Tango Secure Gateway CA
2020-07-29 20:20:03 +08:00
${rescode} SystemCommands ${commandstr} ${stringlist}
Proxy-Policy-replace-00006
Comment 功能端验证HTTP验证
${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/ProxyPolicy_replace_00006.bat
... ELSE set variable curl -kv --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.70 Safari/537.36" --referer 'https://www.baidu.com/' https://www.quickenloans.com/mortgage-education/home-buyers-guide?qlsource=nav
2020-07-29 20:20:03 +08:00
${stringlist} run keyword if '${systemType}'=='Windows' Create List text/json Tango Secure Gateway CA
... ELSE Create List text/json Tango Secure Gateway CA
${rescode} SystemCommands ${commandstr} ${stringlist}
Proxy-Policy-replace-00007
Comment 功能端验证HTTP验证
${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/ProxyPolicy_replace_00007.bat
... ELSE set variable curl -kv --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.70 Safari/537.36" --referer 'https://www.baidu.com/' https://www.gobank.com/mobile-banking/mobile-app
2020-07-29 20:20:03 +08:00
${stringlist} run keyword if '${systemType}'=='Windows' Create List text/json Tango Secure Gateway CA
... ELSE Create List text/json Tango Secure Gateway CA
${rescode} SystemCommands ${commandstr} ${stringlist}
Proxy-Policy-replace-00008
Comment 功能端验证HTTP验证
${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/ProxyPolicy_replace_00008.bat
... ELSE set variable curl -kv http://www.ghzq.com.cn/ghzq/index.html
2020-07-29 20:20:03 +08:00
${stringlist} run keyword if '${systemType}'=='Windows' Create List text/json
... ELSE Create List text/json
${rescode} SystemCommands ${commandstr} ${stringlist}
Comment 改变Replace策略
${policyDict} Create Dictionary policyId=${replace_policyId7} policyName=Proxy-Policy-replace-00008-1 policyType=pxy_manipulation policyDesc=autotest action=manipulation userRegion={"method":"replace","rules":[{"search_in":"http_resp_header","find":"html","replace_with":"guheihei"}],"protocol":"HTTP"} filterList=${replace_objectId17}|TSG_FIELD_HTTP_URL,${replace_objectId46}|TSG_FIELD_HTTP_RES_HDR isValid=${1} appIdObjects=${HTTP_ID}
log ${policyDict}
${rescode} UpdatePolicies 1 ${policyDict} v2 update
sleep 3
Comment 功能端验证HTTP验证
${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/ProxyPolicy_replace_00008.bat
... ELSE set variable curl -kv http://www.ghzq.com.cn/ghzq/index.html
${stringlist} run keyword if '${systemType}'=='Windows' Create List text/guheihei
... ELSE Create List text/guheihei
${rescode} SystemCommands ${commandstr} ${stringlist}
2020-07-29 20:20:03 +08:00
Proxy-Policy-replace-00009
Comment 功能端验证HTTP验证
${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/ProxyPolicy_replace_00009.bat
... ELSE set variable curl -kv https://www.zcool.com.cn/
2020-07-29 20:20:03 +08:00
${stringlist} run keyword if '${systemType}'=='Windows' Create List text/json
... ELSE Create List text/json
${rescode} SystemCommands ${commandstr} ${stringlist}
Proxy-Policy-replace-00010
Comment 此处拦截策略与之前策略有策略的相互影响,做验证之前先将策略启动
${policyDict} Create Dictionary policyId=${intercept_replace_policyId9} policyName=SecurityPolicy-Intercept-replace-10 policyType=tsg_security policyDesc=autotest action=intercept userRegion={"protocol":"HTTP"} filterList=${replace_objectId22}|TSG_FIELD_HTTP_HOST isValid=${1} appIdObjects=${HTTP_ID}
log ${policyDict}
${rescode} UpdatePolicies 1 ${policyDict} v2 update
Comment 此处replace策略与之后策略有策略的相互影响做验证之前先将策略启动
Comment 启动Replace策略
${policyDict} Create Dictionary policyId=${replace_policyId9} policyName=Proxy-Policy-replace-00010-1 policyType=pxy_manipulation policyDesc=autotest action=manipulation userRegion={"method":"replace","rules":[{"search_in":"http_resp_body","find":"hello","replace_with":"111111"}],"protocol":"HTTP"} filterList=${replace_objectId23}|TSG_FIELD_HTTP_URL isValid=${1} appIdObjects=${HTTP_ID}
log ${policyDict}
${rescode} UpdatePolicies 1 ${policyDict} v2 update
sleep 5
2020-07-29 20:20:03 +08:00
Comment 功能端验证HTTP验证
${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/ProxyPolicy_replace_00010.bat
... ELSE set variable curl -H "Content-Type:application/json;charset=UTF-8" -X POST -d "{"requestbody":"testpolicyreplace_0010","setcook":"12345678","contenttype": "content-type","responsebody": "helloreplace0010"}" -kv http://open.node.com/go
${stringlist} run keyword if '${systemType}'=='Windows' Create List 111111
... ELSE Create List 111111
${rescode} SystemCommands ${commandstr} ${stringlist}
Comment 改变Replace策略
${policyDict} Create Dictionary policyId=${replace_policyId9} policyName=Proxy-Policy-replace-00010-1 policyType=pxy_manipulation policyDesc=autotest action=manipulation userRegion={"method":"replace","rules":[{"search_in":"http_resp_body","find":"helloreplace0010","replace_with":"chifan"}],"protocol":"HTTP"} filterList=${replace_objectId23}|TSG_FIELD_HTTP_URL isValid=${1} appIdObjects=${HTTP_ID}
log ${policyDict}
${rescode} UpdatePolicies 1 ${policyDict} v2 update
sleep 3
Comment 功能端验证HTTP验证
${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/ProxyPolicy_replace_00010.bat
... ELSE set variable curl -H "Content-Type:application/json;charset=UTF-8" -X POST -d "{\"requestbody\":\"testpolicyreplace_0010\",\"setcook\":\"12345678\",\"contenttype\": \"content-type\",\"responsebody\": \"aluohareplace0015\"}" -kv http://open.node.com/go
${stringlist} run keyword if '${systemType}'=='Windows' Create List chifan
... ELSE Create List chifan
2020-07-29 20:20:03 +08:00
${rescode} SystemCommands ${commandstr} ${stringlist}
Comment 使用后将拦截策略失效,防止影响后续的策略
${policyDict} Create Dictionary policyId=${replace_policyId9} policyId=${intercept_replace_policyId9} policyName=SecurityPolicy-Intercept-replace-10 policyType=tsg_security policyDesc=autotest action=intercept userRegion={"protocol":"HTTP"} filterList=${replace_objectId22}|TSG_FIELD_HTTP_HOST isValid=${0} appIdObjects=${HTTP_ID}
log ${policyDict}
${rescode} UpdatePolicies 1 ${policyDict} v2 update
Comment 使用后将策略失效,防止影响后续的策略
${policyDict} Create Dictionary policyId=${replace_policyId9} policyName=Proxy-Policy-replace-00010-1 policyType=pxy_manipulation policyDesc=autotest action=manipulation userRegion={"method":"replace","rules":[{"search_in":"http_resp_body","find":"helloreplace0010","replace_with":"chifan"}],"protocol":"HTTP"} filterList=${replace_objectId23}|TSG_FIELD_HTTP_URL isValid=${0} appIdObjects=${HTTP_ID}
log ${policyDict}
${rescode} UpdatePolicies 1 ${policyDict} v2 update
sleep 5
2020-07-29 20:20:03 +08:00
Proxy-Policy-replace-00011
Comment 功能端验证HTTP验证
${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/ProxyPolicy_replace_00011.bat
... ELSE set variable curl -kv http://www.shfe.com.cn/products/au/
2020-07-29 20:20:03 +08:00
${stringlist} run keyword if '${systemType}'=='Windows' Create List text/json
... ELSE Create List text/json
${rescode} SystemCommands ${commandstr} ${stringlist}
Proxy-Policy-replace-00012
Comment 功能端验证HTTP验证
${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/ProxyPolicy_replace_00012.bat
... ELSE set variable curl -kv --cookie "lQfQ_2132_saltkey=t8WY1oPe; lQfQ_2132_lastvisit=1595381790; lQfQ_2132_sid=vqXOg6; lQfQ_2132_lastact=1595385400%09forum.php%09image" --referer 'https://www.baidu.com/' \ https://www.national-park.com/welcome-to-canyonlands-national-park/
${stringlist} run keyword if '${systemType}'=='Windows' Create List text/json Tango Secure Gateway CA
... ELSE Create List text/json Tango Secure Gateway CA
${rescode} SystemCommands ${commandstr} ${stringlist}
Proxy-Policy-replace-00013
Comment 功能端验证HTTP验证
${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/ProxyPolicy_replace_00013.bat
... ELSE set variable curl -kv https://www.expedia.co.uk/?pwaLob=wizard-hotel-pwa-v2
${stringlist} run keyword if '${systemType}'=='Windows' Create List HTTPOnly Tango Secure Gateway CA
2020-07-29 20:20:03 +08:00
... ELSE Create List text/json Tango Secure Gateway CA
${rescode} SystemCommands ${commandstr} ${stringlist}
Comment 功能端验证HTTP验证
${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/ProxyPolicy_replace_00013_1.bat
... ELSE set variable curl -kv https://welcome.expediagroup.com/en?joinexpedia
${stringlist} run keyword if '${systemType}'=='Windows' Create List Expedia Group Tango Secure Gateway CA
... ELSE Create List Expedia Group Tango Secure Gateway CA
2020-07-29 20:20:03 +08:00
${rescode} SystemCommands ${commandstr} ${stringlist}
Comment 功能端验证HTTP验证
${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/ProxyPolicy_replace_00013_2.bat
... ELSE set variable curl -kv https://www.expediacruises.com/en-US/corporate
${stringlist} run keyword if '${systemType}'=='Windows' Create List Expedia Cruises Tango Secure Gateway CA
... ELSE Create List Expedia Cruises Tango Secure Gateway CA
2020-07-29 20:20:03 +08:00
${rescode} SystemCommands ${commandstr} ${stringlist}
Comment 功能端验证HTTP验证
${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/ProxyPolicy_replace_00013_3.bat
... ELSE set variable curl -kv https://www.classicvacations.com/collections/all-inclusive
${stringlist} run keyword if '${systemType}'=='Windows' Create List classicvacations Tango Secure Gateway CA
... ELSE Create List classicvacations Tango Secure Gateway CA
2020-07-29 20:20:03 +08:00
${rescode} SystemCommands ${commandstr} ${stringlist}
Proxy-Policy-replace-00014
Comment 功能端验证HTTP验证
${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/ProxyPolicy_replace_00014.bat
... ELSE set variable curl -kv -L --user-agent "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML like Gecko) Chrome/31.0.1650.63 Safari/537.36" \ --cookie "__cfduid=d5c21129d57e7124b729fd86dc82abdcd1596020306; __stripe_sid=2940d4d5-6822-4daf-8b38-9cd18d745beb; __stripe_mid=dd118cd8-845c-4b6e-98ce-81e8d5bdd52c" --referer 'https://www.baidu.com/' \ https://www.engadget.com/gaming/
2020-07-29 20:20:03 +08:00
${stringlist} run keyword if '${systemType}'=='Windows' Create List text/json Tango Secure Gateway CA
... ELSE Create List text/json Tango Secure Gateway CA
${rescode} SystemCommands ${commandstr} ${stringlist}