From 4abeb11d4fbfce9c1e79acbdf318e5c31aa91751 Mon Sep 17 00:00:00 2001 From: jwc Date: Wed, 5 Aug 2020 18:51:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9PolicyOrganize=E5=85=B3?= =?UTF-8?q?=E9=94=AE=E5=AD=97=EF=BC=8C=E9=80=82=E7=94=A8wannat=E7=AD=96?= =?UTF-8?q?=E7=95=A5=EF=BC=8C=E4=BF=AE=E6=94=B9=E7=AE=A1=E6=8E=A7=E7=AD=96?= =?UTF-8?q?=E7=95=A5allow=E5=8A=A8=E4=BD=9C=E3=80=81redirect=E5=8A=A8?= =?UTF-8?q?=E4=BD=9C=E3=80=81replace=E5=8A=A8=E4=BD=9C=E7=94=A8=E4=BE=8Bcu?= =?UTF-8?q?rl=E8=AF=B7=E6=B1=82=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../multi_step/MultiStepDenyAllTests.robot | 196 ------- .../tsg_adc/multi_step/a_Allow_Tests.robot | 18 +- .../tsg_adc/multi_step/a_Deny_Tests.robot | 26 + .../tsg_adc/multi_step/a_Hijack_Tests.robot | 2 +- .../tsg_adc/multi_step/a_Insert_Tests.robot | 15 +- .../tsg_adc/multi_step/a_Redirect_Tests.robot | 26 +- .../tsg_adc/multi_step/a_Replace_Tests.robot | 24 +- .../tsg_adc/multi_step/b_Allow_Tests.robot | 14 +- .../tsg_adc/multi_step/b_Hijack_Tests.robot | 2 +- .../tsg_adc/multi_step/b_Redirect_Tests.robot | 26 +- .../tsg_adc/multi_step/b_Replace_Tests.robot | 10 +- .../tsg_adc/multi_step/c_Allow_Tests.robot | 4 +- .../tsg_adc/multi_step/c_Insert_Tests.robot | 1 + .../tsg_adc/multi_step/c_Redirect_Tests.robot | 2 + .../tsg_adc/multi_step/c_Replace_Tests.robot | 4 +- .../policy_object/ProcessPolicyBody.robot | 480 +++++++++--------- .../curl/command/ProxyPolicy_allow_00005.bat | 2 +- .../curl/command/ProxyPolicy_allow_00014.bat | 2 +- .../command/ProxyPolicy_redirect_00008.bat | 2 +- .../command/ProxyPolicy_redirect_00009.bat | 2 +- .../command/ProxyPolicy_redirect_00010.bat | 2 +- .../command/ProxyPolicy_redirect_00011.bat | 2 +- .../command/ProxyPolicy_redirect_00014.bat | 2 +- .../command/ProxyPolicy_replace_00008.bat | 2 +- .../command/ProxyPolicy_replace_00009.bat | 2 +- .../command/ProxyPolicy_replace_00010.bat | 2 +- .../command/ProxyPolicy_replace_00011.bat | 2 +- 27 files changed, 355 insertions(+), 517 deletions(-) delete mode 100644 01-TestCase/tsg_adc/multi_step/MultiStepDenyAllTests.robot diff --git a/01-TestCase/tsg_adc/multi_step/MultiStepDenyAllTests.robot b/01-TestCase/tsg_adc/multi_step/MultiStepDenyAllTests.robot deleted file mode 100644 index 6a59c0a..0000000 --- a/01-TestCase/tsg_adc/multi_step/MultiStepDenyAllTests.robot +++ /dev/null @@ -1,196 +0,0 @@ -*** Settings *** -Test Teardown DeleteAfterCase ${policyIds} ${objectids} -Force Tags tsg_adc tsg_security selfserver -Library OperatingSystem -Resource ../../../02-Keyword/tsg_adc/SystemCommand.robot -Resource ../../../02-Keyword/tsg_bfapi/PolicyObject.robot -Resource ../../../02-Keyword/tsg_bfapi/LogVariable.robot -Resource ../../../03-Variable/PolicyObjectDefault.txt -Resource ../../../02-Keyword/tsg_common/StmpHandle.robot -Resource ../../../03-Variable/AllFlowCaseVariable.txt -Resource ../../../02-Keyword/tsg_adc/FileOperation.robot -Resource ../../../03-Variable/BifangApiVariable.txt -Library Custometest -Library json - -*** Variables *** -${policyIds} ${EMPTY} -${objectids} ${EMPTY} -${url} /policy/profile/responsepages -${profiledId} ${EMPTY} -${dict} ${None} -${caseName} SecurityPolicy-Deny-AllProtol-00001 -*** Keywords *** -create-object-policy - [Arguments] @{flag} - Comment 创建目标IP - ${objectDict} Create Dictionary - ... objectType=IP - ... isValid=1 - ... objectSubType=${Default_ObjectSubType} - ... isInitialize=${Default_IsInitialize} - ... isExclusion=${Default_IsExclusion} - ... objectName=${caseName}_IPobject - ... objectDesc=${Default_ObjectDesc} - ... subObjectIds=${Default_SubObjectIds} - ... addItemList=CIDR|192.168.100.5|32|0/0&${Default_AddItem_ServerIpFormat}|${Default_AddItem_ServerIp1}|${Default_AddItem_ServerIp2}|${Default_AddItem_ServerPort}|${Default_AddItem_IsInitialize}|${Default_AddItem_ItemName}|${Default_AddItem_ItemDesc} - ${rescode} ${objectId} AddObject2 ${1} ${objectDict} - ${objectids} Run Keyword If '${testPart}'=='all' set Variable ${objectId} - - Comment 创建安全策略,针对所有协议,相当于BlackIP - ${policyDict} Create Dictionary - ... policyName=${caseName} - ... policyType=tsg_security - ... policyDesc=${Default_PolicyDesc} - ... action=deny - ... effectiveRange=${Default_EffectiveRange} - ... userRegion=${Default_UserRegion} - ... referenceObject=${objectId}|TSG_SECURITY_DESTINATION_ADDR - ... isValid=${Default_IsValid} - ... appObjectIdArray=2,3,4,5,6 - ... userTags=${Default_UserTags} - ... doLog=2 - ... scheduleId=${Default_ScheduleId} - ${rescode} ${policyId} AddPolicy2 ${1} ${policyDict} - ${policyIds} Run Keyword If '${testPart}'=='all' Create List {"policyType":"tsg_security","policyIds":[${policyId}]} - # 区分执行方式 - ${value} Run Keyword If ${flag}==[] insert_policyId_to_file ${caseName} ${policyId} ${objectids} - ... ELSE Create Dictionary policyId=${policyId} objectId=${objectids} - Set Test Variable ${dict} ${value} - -function-test - Run Keyword If '${testPart}'=='all' Sleep ${policyVerificationSleepSeconds}s - ${starttime} Get Time - Comment 功能端验证HTTP验证 - ${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/selfserver/${caseName}_HTTP.bat - ... ELSE set variable curl -kv http://open.node.com/ - - ${stringlist} run keyword if '${systemType}'=='Windows' Create List Connection was reset - ... ELSE Create List Connection reset by peer - - ${starttime_http} Get Time - ${rescode} SystemCommands ${commandstr} ${stringlist} - Run Keyword If '${testPart}'=='all' Sleep ${policyLogVerificationSleepSeconds}s - ${endtime_http} Get Time - #日志验证 - #GetLogList security_event_log ${starttime} ${endtime} ${testClentIP} ${s} http_host open.node.com - - Comment 功能端验证SSL验证 - ${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/selfserver/${caseName}_SSL.bat - ... ELSE set variable curl -kv https://open.node.com/ - - ${stringlist} run keyword if '${systemType}'=='Windows' Create List Connection was reset - #OpenSSL SSL_connect: Connection was reset in connection to - #Send failure: Connection was reset - ... ELSE Create List OpenSSL SSL_connect: Connection reset by peer in connection to - - ${starttime_ssl} Get Time - ${rescode} SystemCommands ${commandstr} ${stringlist} - Run Keyword If '${testPart}'=='all' Sleep ${policyLogVerificationSleepSeconds}s - ${endtime_ssl} Get Time - #日志验证 - #GetLogList security_event_log ${starttime} ${endtime} ${testClentIP} ${s} ssl_sni open.node.com - - Comment 功能端验证DNS验证 - - - Comment 功能端验证MAIL验证 - #${mail} EmailLogin mail.tsgmail.com 25 dongxiaoyan@mail.tsgmail.com dxy123 - ${starttime_mail} Get Time - ${Smtp服务器} Set Variable 192.168.100.5 - ${Smtp服务器端口} Set Variable 25 - ${邮箱账号} Set Variable dongxiaoyan@mail.tsgmail.com - ${邮箱密码} Set Variable dxy123 - ${邮件主题} Set Variable что- иностранныеsuject - ${发送者} Set Variable dongxiaoyan@mail.tsgmail.com - ${附件} Set Variable ["${mailpath}/朱明明测试文件.txt"] - ${接收者} Set Variable ["jwctest@mail.tsgmail.com"] - ${抄送者} Set Variable ["zmmtest@mail.tsgmail.com"] - ${密送者} Set Variable ["lyftest@mail.tsgmail.com"] - ${邮件正文} Set Variable 朱明明contentчто-иностранныеsuject - ${mail} EmailSendFull ${Smtp服务器} ${Smtp服务器端口} ${邮箱账号} ${邮箱密码} ${邮件主题} ${发送者} ${接收者} ${抄送者} ${密送者} ${邮件正文} ${附件} - should contain ${mail} mail_fail - Run Keyword If '${testPart}'=='all' Sleep ${policyLogVerificationSleepSeconds}s - ${endtime_mail} Get Time - #日志验证 - #GetLogList security_event_log ${starttime} ${endtime} ${testClentIP} ${s} mail_protocol_type SMTP - - Comment 功能端验证FTP验证 - ${starttime_ftp} Get Time - ${ftpLogin} FTP_login ftp://192.168.100.5:21 -u"ftp_user:qazXSW@edc" test.txt - should contain ${ftpLogin} ftp_fail - #日志验证 - #GetLogList security_event_log ${starttime} ${endtime} ${testClentIP} ${s} ftp_account '' - Run Keyword If '${testPart}'=='all' Sleep ${policyLogVerificationSleepSeconds}s - ${endtime_ftp} Get Time - - ${endtime} Get Time - # 区分执行方式 - Run Keyword If ${dict}==${None} insert_time_to_file ${caseName} ${starttime} ${endtime} - ... ELSE Run Keyword Set To Dictionary ${dict} ${starttime} ${endtime} -log-test - # 日志验证 - ${obj} Run Keyword If ${dict}==${None} json.Loads ${caseName} - ... ELSE Set Variable ${dict} - ${policyId} Set Variable ${obj}[policyId] - ${s} Convert to String ${policyId} - ${objectids} Run Keyword If '${testPart}'!='all' set Variable ${obj}[objectids] - ${policyIds} Run Keyword If '${testPart}'!='all' Create List {"policyType":"tsg_security","policyIds":[${policyId}]} - Comment 功能端验证HTTP验证 - #日志验证 - GetLogList security_event_log ${starttime_http} ${endtime_http} ${testClentIP} ${s} http_host open.node.com - ${obj}[starttime] ${obj}[endtime] - Comment 功能端验证SSL验证 - #日志验证 - GetLogList security_event_log ${starttime_ssl} ${endtime_ssl} ${testClentIP} ${s} ssl_sni open.node.com - - Comment 功能端验证DNS验证 - - Comment 功能端验证MAIL验证 - #日志验证 - GetLogList security_event_log ${starttime_mail} ${endtime_mail} ${testClentIP} ${s} mail_protocol_type SMTP - - Comment 功能端验证FTP验证 - #日志验证 - GetLogList security_event_log ${starttime_ftp} ${endtime_ftp} ${testClentIP} ${s} ftp_account '' -log-test_bak - # 日志验证 - ${obj} Run Keyword If ${dict}==${None} json.Loads ${caseName} - ... ELSE Set Variable ${dict} - ${policyId} Set Variable ${obj}[policyId] - ${s} Convert to String ${policyId} - ${objectids} Run Keyword If '${testPart}'!='all' set Variable ${obj}[objectids] - ${policyIds} Run Keyword If '${testPart}'!='all' Create List {"policyType":"tsg_security","policyIds":[${policyId}]} - Comment 功能端验证HTTP验证 - #日志验证 - #GetLogList security_event_log ${starttime_http} ${endtime_http} ${testClentIP} ${s} http_host open.node.com - GetLogList security_event_log ${obj}[starttime_http] ${obj}[endtime_http] ${testClentIP} ${s} http_host open.node.com - ${obj}[starttime] ${obj}[endtime] - Comment 功能端验证SSL验证 - #日志验证 - #GetLogList security_event_log ${starttime_ssl} ${endtime_ssl} ${testClentIP} ${s} ssl_sni open.node.com - GetLogList security_event_log ${obj}[starttime_ssl} ${obj}[endtime_ssl} ${testClentIP} ${s} ssl_sni open.node.com - - Comment 功能端验证DNS验证 - - Comment 功能端验证MAIL验证 - #日志验证 - #GetLogList security_event_log ${starttime_mail} ${endtime_mail} ${testClentIP} ${s} mail_protocol_type SMTP - GetLogList security_event_log ${obj}[starttime_mail} ${obj}[endtime_mail} ${testClentIP} ${s} mail_protocol_type SMTP - - Comment 功能端验证FTP验证 - #日志验证 - #GetLogList security_event_log ${starttime_ftp} ${endtime_ftp} ${testClentIP} ${s} ftp_account '' - GetLogList security_event_log ${obj}[starttime_ftp} ${obj}[endtime_ftp} ${testClentIP} ${s} ftp_account '' -*** Test Cases *** -MultiSecurityPolicy-Deny-AllProtol-00001 - [Tags] securitypolciy deny allprotol multistep - #${caseName} set variable SecurityPolicy-Deny-AllProtol-00001 - - Run Keyword If '${testPart}'=='all' Run Keywords create-object-policy True - ... AND function-test - ... AND log-test - ... ELSE IF ${testPart}==1 Run Keyword create-object-policy - ... ELSE IF ${testPart}==2 Run Keyword function-test - ... ELSE IF ${testPart}==3 Run Keyword log-test -#{"opAction":"add","policyList":{"policyId":"","policyName":"dxytest","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"method":"rst"},"referenceObject":[{"objectId":6926,"protocolFields":["TSG_SECURITY_SOURCE_ADDR"]},{"objectId":6943,"protocolFields":["TSG_SECURITY_DESTINATION_ADDR"]}],"isValid":0,"scheduleId":[],"appObjectIdArray":[2,3,4,5,6]}} diff --git a/01-TestCase/tsg_adc/multi_step/a_Allow_Tests.robot b/01-TestCase/tsg_adc/multi_step/a_Allow_Tests.robot index 1db787c..3bd4673 100644 --- a/01-TestCase/tsg_adc/multi_step/a_Allow_Tests.robot +++ b/01-TestCase/tsg_adc/multi_step/a_Allow_Tests.robot @@ -91,13 +91,13 @@ Proxy-Policy-allow-00004 Proxy-Policy-allow-00005 [Tags] 请求头 Comment 创建fqdn - ${objectDict} Create Dictionary objectType=fqdn isValid=${1} addItemList=$www.motel6.com + ${objectDict} Create Dictionary objectType=fqdn isValid=${1} addItemList=$boutiquehotel.me ${rescode} ${objectId} AddObject2 ${1} ${objectDict} Comment 创建url - ${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=motel6.com/#/home + ${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=paris/ ${rescode} ${objectId1} AddObject2 ${1} ${objectDict} Comment 创建请求头 - ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=$Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML like Gecko) Chrome/31.0.1650.63 Safari/537.36|User-Agent + ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=Mozilla/5.0*|User-Agent ${rescode} ${objectId2} AddObject2 ${1} ${objectDict} Comment 创建拦截策略 ${policyDict} Create Dictionary policyName=SecurityPolicy-Intercept-allow 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 @@ -172,7 +172,7 @@ Proxy-Policy-allow-00008 ${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=market/overview/ ${rescode} ${objectId1} AddObject2 ${1} ${objectDict} Comment 创建请求头 - ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=*utf-8|Content-Type + ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=*html|Content-Type ${rescode} ${objectId2} AddObject2 ${1} ${objectDict} Comment Comment 创建拦截策略 ${policyDict} Create Dictionary policyName=SecurityPolicy-Intercept-allow policyType=tsg_security policyDesc=autotest action=intercept userRegion={"protocol":"HTTP"} filterList=${objectId}|TSG_FIELD_HTTP_HOST isValid=${1} appIdObjects=2 @@ -294,7 +294,7 @@ Proxy-Policy-allow-00013 ${objectDict} Create Dictionary objectType=fqdn isValid=${1} addItemList=$russia.payu.com,*925mm.com,*qunar.com,$www.vitalsource.com ${rescode} ${objectId} AddObject2 ${1} ${objectDict} Comment 创建set-cookie - ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=pll_language=ru*|Set-Cookie,*Domain=qunar.com;Path=/|Set-Cookie,frontLang=zh-cn|Set-Cookie,_stargate_session*|Set-Cookie + ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=pll_language=ru*|Set-Cookie,*Domain=qunar.com; Path=/|Set-Cookie,frontLang=zh-cn|Set-Cookie,_stargate_session*|Set-Cookie ${rescode} ${objectId1} AddObject2 ${1} ${objectDict} Comment 创建拦截策略 ${policyDict} Create Dictionary policyName=SecurityPolicy-Intercept-allow 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 @@ -312,10 +312,10 @@ Proxy-Policy-allow-00013 Proxy-Policy-allow-00014 [Tags] 最大组合1 Comment 创建fqdn - ${objectDict} Create Dictionary objectType=fqdn isValid=${1} addItemList=*sutori.com + ${objectDict} Create Dictionary objectType=fqdn isValid=${1} addItemList=$www.orbitz.com ${rescode} ${object_fqdn_Id} AddObject2 ${1} ${objectDict} Comment 创建url - ${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=*teachers + ${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=*Flights ${rescode} ${object_url_Id} AddObject2 ${1} ${objectDict} Comment 创建请求头 ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=Mozilla/5.0*|User-Agent @@ -324,10 +324,10 @@ Proxy-Policy-allow-00014 ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=charset|Content-Type ${rescode} ${object_yd_Id} AddObject2 ${1} ${objectDict} Comment 创建cookie - ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=__stripe_sid|cookie + ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=__stripe_sid|Cookie ${rescode} ${object_ck_Id} AddObject2 ${1} ${objectDict} Comment 创建set-cookie - ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=domain=.sutori.com|set-cookie + ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=Domain=.orbitz.com|Set-Cookie ${rescode} ${object_sk_Id} AddObject2 ${1} ${objectDict} Comment 创建拦截策略 ${policyDict} Create Dictionary policyName=SecurityPolicy-Intercept-allow policyType=tsg_security policyDesc=autotest action=intercept userRegion={"protocol":"SSL","keyring":1,"decryption":1,"decrypt_mirror":{"enable":0,"mirror_profile":null}} filterList=${object_fqdn_Id}|TSG_FIELD_SSL_SNI isValid=${1} appIdObjects=3 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 b89b139..c4ab691 100644 --- a/01-TestCase/tsg_adc/multi_step/a_Deny_Tests.robot +++ b/01-TestCase/tsg_adc/multi_step/a_Deny_Tests.robot @@ -429,3 +429,29 @@ Proxy-Policy-deny-00017 insert_policyId_to_file1 deny_objectId45 ${object_body_Id} insert_policyId_to_file1 intercept_deny_policyId14 ${policyId1} insert_policyId_to_file1 deny_policyId16 ${policyId2} + +Proxy-Policy-deny-00018 + [Tags] Sub Objects + Comment 创建url + ${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=$newsela.com + ${rescode} ${objectId} AddObjects ${1} ${objectDict1} + ${addItemList} Create List ${objectId} + ${objectDict1} Create Dictionary objectType=url isValid=${1} subObjectIds=${addItemList} + ${rescode} ${objectIds} AddObjects ${1} ${objectDict1} + ${params} Create Dictionary objectId=${objectIds} itemType=url + ${rescode} ${itemIds} ${itemList} GetObjectItems ${params} + Comment #创建引用文件 + ${response} CreatePolicyFile2 ${url} ${responsePageFiles} 404china.html resPages + ${profiledId} Get From Dictionary ${response} profileId + Comment 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 + log ${policyDict} + ${rescode} ${policyId1} AddPolicies 1 ${policyDict} v2 + Comment 创建deny策略 + ${policyDict} Create Dictionary policyName=Proxy-Policy-deny-00003 policyType=pxy_manipulation policyDesc=autotest action=deny userRegion={"method":"block","html_profile":${profiledId},"code":404,"protocol":"HTTP"} filterList=${objectId1}|TSG_FIELD_HTTP_URL isValid=${1} appIdObjects=2 + log ${policyDict} + ${rescode} ${policyId2} AddPolicies 1 ${policyDict} v2 + insert_policyId_to_file1 deny_profileId1 ${profiledId} + insert_policyId_to_file1 deny_objectId2 ${objectId} + insert_policyId_to_file1 intercept_deny_policyId2 ${policyId1} + insert_policyId_to_file1 deny_policyId2 ${policyId2} diff --git a/01-TestCase/tsg_adc/multi_step/a_Hijack_Tests.robot b/01-TestCase/tsg_adc/multi_step/a_Hijack_Tests.robot index ea2b372..24ef57e 100644 --- a/01-TestCase/tsg_adc/multi_step/a_Hijack_Tests.robot +++ b/01-TestCase/tsg_adc/multi_step/a_Hijack_Tests.robot @@ -353,7 +353,7 @@ Proxy-Policy-hijack-00013 ${objectDict} Create Dictionary objectType=fqdn isValid=${1} addItemList=$nsscreencast.com,*edreams.net,*boutiquehotel.me,$www.everymantravel.com ${rescode} ${objectId} AddObject2 ${1} ${objectDict} Comment 创建set-cookie - ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=_nsscreencast_session_*|Set-Cookie,*Domain=.everymantravel.com;Path=/|Set-Cookie,Domain=.boutiquehotel.me|Set-Cookie,ADRUM_BTa*|Set-Cookie + ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=_nsscreencast_session_*|Set-Cookie,*Domain=.everymantravel.com;Path=/|Set-Cookie,Domain=.boutiquehotel.me|Set-Cookie,HOME1JSESSIONID*|Set-Cookie ${rescode} ${objectId1} AddObject2 ${1} ${objectDict} Comment 创建url ${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=nsscreencast,edreams,boutiquehotel,everymantravel diff --git a/01-TestCase/tsg_adc/multi_step/a_Insert_Tests.robot b/01-TestCase/tsg_adc/multi_step/a_Insert_Tests.robot index 2d311e2..d733d94 100644 --- a/01-TestCase/tsg_adc/multi_step/a_Insert_Tests.robot +++ b/01-TestCase/tsg_adc/multi_step/a_Insert_Tests.robot @@ -358,17 +358,21 @@ Proxy-Policy-insert-00013 Comment 创建insert文件 ${response} CreatePolicyFile2 ${url} ${path}/insert_files/ Create-Insert Scripts-test-1.js insert ${profiledId} Get From Dictionary ${response} profileId + Comment 创建url + ${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=www.shermanstravel.com,wyndhamhotels.com,travelnow.com,www.smithsonianjourneys.org + ${rescode} ${objectId2} AddObject2 ${1} ${objectDict} Comment 创建拦截策略 ${policyDict} Create Dictionary policyName=SecurityPolicy-Intercept-insert 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 log ${policyDict} ${rescode} ${policyId1} AddPolicies 1 ${policyDict} v2 Comment 创建insert策略 - ${policyDict} Create Dictionary policyName=Proxy-Policy-insert-00013 policyType=pxy_manipulation policyDesc=autotest action=manipulation userRegion={"method":"insert","insert_profile":${profiledId},"protocol":"HTTP"} filterList=${objectId1}|TSG_FIELD_HTTP_RES_HDR isValid=${1} appIdObjects=2 + ${policyDict} Create Dictionary policyName=Proxy-Policy-insert-00013 policyType=pxy_manipulation policyDesc=autotest action=manipulation userRegion={"method":"insert","insert_profile":${profiledId},"protocol":"HTTP"} filterList=${objectId1}|TSG_FIELD_HTTP_RES_HDR,${objectId2}|TSG_FIELD_HTTP_URL isValid=${1} appIdObjects=2 log ${policyDict} ${rescode} ${policyId2} AddPolicies 1 ${policyDict} v2 insert_policyId_to_file1 insert_profileId12 ${profiledId} insert_policyId_to_file1 insert_objectId31 ${objectId} insert_policyId_to_file1 insert_objectId32 ${objectId1} + insert_policyId_to_file1 insert_objectId41 ${objectId2} insert_policyId_to_file1 intercept_insert_policyId12 ${policyId1} insert_policyId_to_file1 insert_policyId12 ${policyId2} @@ -387,14 +391,18 @@ Proxy-Policy-insert-00014 ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=charset|Content-Type ${rescode} ${object_yd_Id} AddObject2 ${1} ${objectDict} Comment 创建cookie - ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=__stripe_sid|cookie + ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=__stripe_sid|Cookie ${rescode} ${object_ck_Id} AddObject2 ${1} ${objectDict} Comment 创建set-cookie - ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=Domain=.intervalworld.com|set-cookie + ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=Domain=.intervalworld.com|Set-Cookie ${rescode} ${object_sk_Id} AddObject2 ${1} ${objectDict} Comment 创建insert文件 ${response} CreatePolicyFile2 ${url} ${path}/insert_files/ Create-Insert Scripts-test-1.js insert ${profiledId} Get From Dictionary ${response} profileId + Comment 创建拦截策略 + ${policyDict} Create Dictionary policyName=SecurityPolicy-Intercept-insert policyType=tsg_security policyDesc=autotest action=intercept userRegion={"protocol":"SSL","keyring":1,"decryption":1,"decrypt_mirror":{"enable":0,"mirror_profile":null}} filterList=${object_fqdn_Id}|TSG_FIELD_SSL_SNI isValid=${1} appIdObjects=3 + log ${policyDict} + ${rescode} ${policyId1} AddPolicies 1 ${policyDict} v2 Comment 创建insert策略 ${policyDict} Create Dictionary policyName=Proxy-Policy-insert-00014 policyType=pxy_manipulation policyDesc=autotest action=manipulation userRegion={"method":"insert","insert_profile":${profiledId},"protocol":"HTTP"} filterList=${object_fqdn_Id}|TSG_FIELD_HTTP_HOST,${object_url_Id}|TSG_FIELD_HTTP_URL,${object_qq_Id}|TSG_FIELD_HTTP_REQ_HDR,${object_yd_Id}|TSG_FIELD_HTTP_RES_HDR,${object_ck_Id}|TSG_FIELD_HTTP_REQ_HDR,${object_sk_Id}|TSG_FIELD_HTTP_RES_HDR isValid=${1} appIdObjects=2 log ${policyDict} @@ -406,4 +414,5 @@ Proxy-Policy-insert-00014 insert_policyId_to_file1 insert_objectId36 ${object_yd_Id} insert_policyId_to_file1 insert_objectId37 ${object_ck_Id} insert_policyId_to_file1 insert_objectId38 ${object_sk_Id} + insert_policyId_to_file1 intercept_insert_policyId13 ${policyId1} insert_policyId_to_file1 insert_policyId13 ${policyId2} diff --git a/01-TestCase/tsg_adc/multi_step/a_Redirect_Tests.robot b/01-TestCase/tsg_adc/multi_step/a_Redirect_Tests.robot index c2816df..1fd7556 100644 --- a/01-TestCase/tsg_adc/multi_step/a_Redirect_Tests.robot +++ b/01-TestCase/tsg_adc/multi_step/a_Redirect_Tests.robot @@ -42,7 +42,7 @@ Proxy-Policy-redirect-00002 log ${policyDict} ${rescode} ${policyId1} AddPolicies 1 ${policyDict} v2 Comment 创建redirect策略 - ${policyDict} Create Dictionary policyName=Proxy-Policy-redirect-00002 policyType=pxy_manipulation policyDesc=autotest action=manipulation userRegion={"method":"redirect","to":"userRegion={"method":"redirect","to":"https://deseretbook.com/t/ebooks/biography-autobiography","code":302,"protocol":"HTTP"} filterList=${objectId}|TSG_FIELD_HTTP_HOST,${objectId1}|TSG_FIELD_HTTP_URL isValid=${1} appIdObjects=2 + ${policyDict} Create Dictionary policyName=Proxy-Policy-redirect-00002 policyType=pxy_manipulation policyDesc=autotest action=manipulation userRegion={"method":"redirect","to":"https://deseretbook.com/t/ebooks/biography-autobiography","code":302,"protocol":"HTTP"} filterList=${objectId}|TSG_FIELD_HTTP_HOST,${objectId1}|TSG_FIELD_HTTP_URL isValid=${1} appIdObjects=2 log ${policyDict} ${rescode} ${policyId2} AddPolicies 1 ${policyDict} v2 insert_policyId_to_file1 redirect_objectId1 ${objectId} @@ -137,7 +137,7 @@ Proxy-Policy-redirect-00006 log ${policyDict} ${rescode} ${policyId1} AddPolicies 1 ${policyDict} v2 Comment 创建redirect策略 - ${policyDict} Create Dictionary policyName=Proxy-Policy-redirect-00006 policyType=pxy_manipulation policyDesc=autotest action=manipulation userRegion={"method":"redirect","to":"https://deseretbook.com/t/ebooks/biography-autobiography","code":302,"protocol":"HTTP"} filterList=${objectId1}|TSG_FIELD_HTTP_URL,${objectId2}|TSG_FIELD_HTTP_REQ_HDR isValid=${1} appIdObjects=2 + ${policyDict} Create Dictionary policyName=Proxy-Policy-redirect-00006 policyType=pxy_manipulation policyDesc=autotest action=manipulation userRegion={"method":"redirect","to":"https://yhd.com","code":302,"protocol":"HTTP"} filterList=${objectId1}|TSG_FIELD_HTTP_URL,${objectId2}|TSG_FIELD_HTTP_REQ_HDR isValid=${1} appIdObjects=2 log ${policyDict} ${rescode} ${policyId2} AddPolicies 1 ${policyDict} v2 insert_policyId_to_file1 redirect_objectId10 ${objectId} @@ -162,7 +162,7 @@ Proxy-Policy-redirect-00007 log ${policyDict} ${rescode} ${policyId1} AddPolicies 1 ${policyDict} v2 Comment 创建redirect策略 - ${policyDict} Create Dictionary policyName=Proxy-Policy-redirect-00007 policyType=pxy_manipulation policyDesc=autotest action=manipulation userRegion={"method":"redirect","to":"https://deseretbook.com/t/ebooks/biography-autobiography","code":302,"protocol":"HTTP"} filterList=${objectId1}|TSG_FIELD_HTTP_URL,${objectId2}|TSG_FIELD_HTTP_REQ_HDR isValid=${1} appIdObjects=2 + ${policyDict} Create Dictionary policyName=Proxy-Policy-redirect-00007 policyType=pxy_manipulation policyDesc=autotest action=manipulation userRegion={"method":"redirect","to":"https://yhd.com","code":302,"protocol":"HTTP"} filterList=${objectId1}|TSG_FIELD_HTTP_URL,${objectId2}|TSG_FIELD_HTTP_REQ_HDR isValid=${1} appIdObjects=2 log ${policyDict} ${rescode} ${policyId2} AddPolicies 1 ${policyDict} v2 insert_policyId_to_file1 redirect_objectId13 ${objectId} @@ -187,7 +187,7 @@ Proxy-Policy-redirect-00008 log ${policyDict} ${rescode} ${policyId1} AddPolicies 1 ${policyDict} v2 Comment 创建redirect策略 - ${policyDict} Create Dictionary policyName=Proxy-Policy-redirect-00008 policyType=pxy_manipulation policyDesc=autotest action=manipulation userRegion={"method":"redirect","to":"https://deseretbook.com/t/ebooks/biography-autobiography","code":302,"protocol":"HTTP"} filterList=${objectId1}|TSG_FIELD_HTTP_URL,${objectId2}|TSG_FIELD_HTTP_RES_HDR isValid=${1} appIdObjects=2 + ${policyDict} Create Dictionary policyName=Proxy-Policy-redirect-00008 policyType=pxy_manipulation policyDesc=autotest action=manipulation userRegion={"method":"redirect","to":"https://yhd.com","code":302,"protocol":"HTTP"} filterList=${objectId1}|TSG_FIELD_HTTP_URL,${objectId2}|TSG_FIELD_HTTP_RES_HDR isValid=${1} appIdObjects=2 log ${policyDict} ${rescode} ${policyId2} AddPolicies 1 ${policyDict} v2 insert_policyId_to_file1 redirect_objectId16 ${objectId} @@ -212,7 +212,7 @@ Proxy-Policy-redirect-00009 log ${policyDict} ${rescode} ${policyId1} AddPolicies 1 ${policyDict} v2 Comment 创建redirect策略 - ${policyDict} Create Dictionary policyName=Proxy-Policy-redirect-00009 policyType=pxy_manipulation policyDesc=autotest action=manipulation userRegion={"method":"redirect","to":"https://deseretbook.com/t/ebooks/biography-autobiography","code":302,"protocol":"HTTP"} filterList=${objectId1}|TSG_FIELD_HTTP_URL,${objectId2}|TSG_FIELD_HTTP_RES_HDR isValid=${1} appIdObjects=2 + ${policyDict} Create Dictionary policyName=Proxy-Policy-redirect-00009 policyType=pxy_manipulation policyDesc=autotest action=manipulation userRegion={"method":"redirect","to":"https://yhd.com","code":302,"protocol":"HTTP"} filterList=${objectId1}|TSG_FIELD_HTTP_URL,${objectId2}|TSG_FIELD_HTTP_RES_HDR isValid=${1} appIdObjects=2 log ${policyDict} ${rescode} ${policyId2} AddPolicies 1 ${policyDict} v2 insert_policyId_to_file1 redirect_objectId19 ${objectId} @@ -274,7 +274,7 @@ Proxy-Policy-redirect-00011 Proxy-Policy-redirect-00012 [Tags] cookie Comment 创建fqdn - ${objectDict} Create Dictionary objectType=fqdn isValid=${1} addItemList=$polb.com + ${objectDict} Create Dictionary objectType=fqdn isValid=${1} addItemList=$www.polb.com ${rescode} ${objectId} AddObject2 ${1} ${objectDict} Comment 创建url ${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=environment/shore-power#shore-power-program-details @@ -304,16 +304,20 @@ Proxy-Policy-redirect-00013 Comment 创建set-cookie ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=mobile=2*|Set-Cookie,*domain=.egencia.com; HttpOnly|Set-Cookie,domain=.expediapartnersolutions.com|Set-Cookie,AKA_A2=A*|Set-Cookie ${rescode} ${objectId1} AddObject2 ${1} ${objectDict} + Comment 创建url + ${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=www.travelmath.com,egencia.com,expediapartnersolutions.com,www.concur.com + ${rescode} ${objectId2} AddObject2 ${1} ${objectDict} Comment 创建拦截策略 ${policyDict} Create Dictionary policyName=SecurityPolicy-Intercept-redirect 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 log ${policyDict} ${rescode} ${policyId1} AddPolicies 1 ${policyDict} v2 Comment 创建redirect策略 - ${policyDict} Create Dictionary policyName=Proxy-Policy-redirect-00013 policyType=pxy_manipulation policyDesc=autotest action=manipulation userRegion={"method":"redirect","to":"https://deseretbook.com/t/ebooks/biography-autobiography","code":302,"protocol":"HTTP"} filterList=${objectId1}|TSG_FIELD_HTTP_RES_HDR isValid=${1} appIdObjects=2 + ${policyDict} Create Dictionary policyName=Proxy-Policy-redirect-00013 policyType=pxy_manipulation policyDesc=autotest action=manipulation userRegion={"method":"redirect","to":"https://deseretbook.com/t/ebooks/biography-autobiography","code":302,"protocol":"HTTP"} filterList=${objectId1}|TSG_FIELD_HTTP_RES_HDR,${objectId2}|TSG_FIELD_HTTP_URL isValid=${1} appIdObjects=2 log ${policyDict} ${rescode} ${policyId2} AddPolicies 1 ${policyDict} v2 insert_policyId_to_file1 redirect_objectId31 ${objectId} insert_policyId_to_file1 redirect_objectId32 ${objectId1} + insert_policyId_to_file1 redirect_objectId46 ${objectId2} insert_policyId_to_file1 intercept_redirect_policyId12 ${policyId1} insert_policyId_to_file1 redirect_policyId12 ${policyId2} @@ -325,16 +329,20 @@ Proxy-Policy-redirect-00014 Comment 创建fqdn ${objectDict} Create Dictionary objectType=fqdn isValid=${1} addItemList=*open.node.com ${rescode} ${objectId1} AddObject2 ${1} ${objectDict} + Comment 创建url + ${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=action + ${rescode} ${objectId2} AddObject2 ${1} ${objectDict} Comment 创建拦截策略 ${policyDict} Create Dictionary policyName=SecurityPolicy-Intercept-redirect policyType=tsg_security policyDesc=autotest action=intercept userRegion={"protocol":"SSL","keyring":1,"decryption":1,"decrypt_mirror":{"enable":0,"mirror_profile":null}} filterList=${objectId1}|TSG_FIELD_SSL_SNI isValid=${1} appIdObjects=3 log ${policyDict} ${rescode} ${policyId1} AddPolicies 1 ${policyDict} v2 Comment 创建redirect策略 - ${policyDict} Create Dictionary policyName=Proxy-Policy-redirect-00014 policyType=pxy_manipulation policyDesc=autotest action=manipulation userRegion={"method":"redirect","to":"https://deseretbook.com/t/ebooks/biography-autobiography","code":302,"protocol":"HTTP"} filterList=${objectId}|TSG_FIELD_HTTP_REQ_CONTENT isValid=${1} appIdObjects=2 + ${policyDict} Create Dictionary policyName=Proxy-Policy-redirect-00014 policyType=pxy_manipulation policyDesc=autotest action=manipulation userRegion={"method":"redirect","to":"https://deseretbook.com/t/ebooks/biography-autobiography","code":302,"protocol":"HTTP"} filterList=${objectId}|TSG_FIELD_HTTP_REQ_CONTENT,${objectId2}|TSG_FIELD_HTTP_URL isValid=${1} appIdObjects=2 log ${policyDict} ${rescode} ${policyId2} AddPolicies 1 ${policyDict} v2 insert_policyId_to_file1 redirect_objectId33 ${objectId} insert_policyId_to_file1 redirect_objectId34 ${objectId1} + insert_policyId_to_file1 redirect_objectId47 ${objectId2} insert_policyId_to_file1 intercept_redirect_policyId13 ${policyId1} insert_policyId_to_file1 redirect_policyId13 ${policyId2} @@ -385,7 +393,7 @@ Proxy-Policy-redirect-00016 log ${policyDict} ${rescode} ${policyId1} AddPolicies 1 ${policyDict} v2 Comment 创建redirect策略 - ${policyDict} Create Dictionary policyName=Proxy-Policy-redirect-00016 policyType=pxy_manipulation policyDesc=autotest action=manipulation userRegion={"method":"redirect","to":"https://deseretbook.com/t/ebooks/biography-autobiography","code":302,"protocol":"HTTP"} filterList=${object_fqdn_Id}|TSG_FIELD_HTTP_HOST,${object_url_Id}|TSG_FIELD_HTTP_URL,${object_qq_Id}|TSG_FIELD_HTTP_REQ_HDR,${object_yd_Id}|TSG_FIELD_HTTP_RES_HDR,${object_body_Id}|TSG_FIELD_HTTP_RES_CONTENT isValid=${1} appIdObjects=2 + ${policyDict} Create Dictionary policyName=Proxy-Policy-redirect-00016 policyType=pxy_manipulation policyDesc=autotest action=manipulation userRegion={"method":"redirect","to":"https://deseretbook.com/t/ebooks/biography-autobiography","code":302,"protocol":"HTTP"} filterList=${object_fqdn_Id}|TSG_FIELD_HTTP_HOST,${object_url_Id}|TSG_FIELD_HTTP_URL,${object_qq_Id}|TSG_FIELD_HTTP_REQ_HDR,${object_yd_Id}|TSG_FIELD_HTTP_RES_HDR isValid=${1} appIdObjects=2 log ${policyDict} ${rescode} ${policyId2} AddPolicies 1 ${policyDict} v2 insert_policyId_to_file1 redirect_objectId40 ${object_fqdn_Id} diff --git a/01-TestCase/tsg_adc/multi_step/a_Replace_Tests.robot b/01-TestCase/tsg_adc/multi_step/a_Replace_Tests.robot index bac5162..af4ef3f 100644 --- a/01-TestCase/tsg_adc/multi_step/a_Replace_Tests.robot +++ b/01-TestCase/tsg_adc/multi_step/a_Replace_Tests.robot @@ -180,7 +180,7 @@ Proxy-Policy-replace-00008 ${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=ghzq/index.html ${rescode} ${objectId1} AddObject2 ${1} ${objectDict} Comment 创建请求头 - ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=*utf-8|Content-Type + ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=*html|Content-Type ${rescode} ${objectId2} AddObject2 ${1} ${objectDict} Comment Comment 创建拦截策略 ${policyDict} Create Dictionary policyName=SecurityPolicy-Intercept-replace policyType=tsg_security policyDesc=autotest action=intercept userRegion={"protocol":"HTTP"} filterList=${objectId}|TSG_FIELD_HTTP_HOST isValid=${1} appIdObjects=2 @@ -205,7 +205,7 @@ Proxy-Policy-replace-00009 ${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=consult/consult.aspx ${rescode} ${objectId1} AddObject2 ${1} ${objectDict} Comment 创建请求头 - ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=$text/html|Content-Type + ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=$text/html; charset=utf-8|Content-Type ${rescode} ${objectId2} AddObject2 ${1} ${objectDict} Comment Comment 创建拦截策略 ${policyDict} Create Dictionary policyName=SecurityPolicy-Intercept-replace policyType=tsg_security policyDesc=autotest action=intercept userRegion={"protocol":"HTTP"} filterList=${objectId}|TSG_FIELD_HTTP_HOST isValid=${1} appIdObjects=2 @@ -222,27 +222,23 @@ Proxy-Policy-replace-00009 insert_policyId_to_file1 replace_policyId8 ${policyId2} Proxy-Policy-replace-00010 - [Tags] 应答头 + [Tags] 替换请求体 Comment 创建fqdn ${objectDict} Create Dictionary objectType=fqdn isValid=${1} addItemList=*open.node.com ${rescode} ${objectId} AddObject2 ${1} ${objectDict} Comment 创建url ${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=action ${rescode} ${objectId1} AddObject2 ${1} ${objectDict} - Comment 创建请求头 - ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=text/html|Content-Type - ${rescode} ${objectId2} AddObject2 ${1} ${objectDict} Comment Comment 创建拦截策略 ${policyDict} Create Dictionary policyName=SecurityPolicy-Intercept-replace policyType=tsg_security policyDesc=autotest action=intercept userRegion={"protocol":"HTTP"} filterList=${objectId}|TSG_FIELD_HTTP_HOST isValid=${1} appIdObjects=2 log ${policyDict} ${rescode} ${policyId1} AddPolicies 1 ${policyDict} v2 Comment 创建replace策略 - ${policyDict} Create Dictionary policyName=Proxy-Policy-replace-00010 policyType=pxy_manipulation policyDesc=autotest action=manipulation userRegion={"method":"replace","rules":[{"search_in":"http_req_body","find":"hello","replace_with":"111111"}],"protocol":"HTTP"} filterList=${objectId1}|TSG_FIELD_HTTP_URL,${objectId2}|TSG_FIELD_HTTP_RES_HDR isValid=${1} appIdObjects=2 + ${policyDict} Create Dictionary policyName=Proxy-Policy-replace-00010 policyType=pxy_manipulation policyDesc=autotest action=manipulation userRegion={"method":"replace","rules":[{"search_in":"http_req_body","find":"hello","replace_with":"111111"}],"protocol":"HTTP"} filterList=${objectId1}|TSG_FIELD_HTTP_URL isValid=${1} appIdObjects=2 log ${policyDict} ${rescode} ${policyId2} AddPolicies 1 ${policyDict} v2 insert_policyId_to_file1 replace_objectId22 ${objectId} insert_policyId_to_file1 replace_objectId23 ${objectId1} - insert_policyId_to_file1 replace_objectId24 ${objectId2} insert_policyId_to_file1 intercept_replace_policyId9 ${policyId1} insert_policyId_to_file1 replace_policyId9 ${policyId2} @@ -304,16 +300,20 @@ Proxy-Policy-replace-00013 Comment 创建set-cookie ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=AWSALB*|Set-Cookie,*Domain=.expedia.co.uk; Secure; SameSite=None|Set-Cookie,AWSALBCORS=|Set-Cookie,CurentCulture=en-US*|Set-Cookie ${rescode} ${objectId1} AddObject2 ${1} ${objectDict} + Comment 创建URL + ${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=www.classicvacations.com,expediacruises.com,expediagroup.com,www.expedia.co.uk + ${rescode} ${objectId2} AddObject2 ${1} ${objectDict} Comment 创建拦截策略 ${policyDict} Create Dictionary policyName=SecurityPolicy-Intercept-replace 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 log ${policyDict} ${rescode} ${policyId1} AddPolicies 1 ${policyDict} v2 Comment 创建replace策略 - ${policyDict} Create Dictionary policyName=Proxy-Policy-replace-00013 policyType=pxy_manipulation policyDesc=autotest action=manipulation userRegion={"method":"replace","rules":[{"search_in":"http_resp_header","find":"html","replace_with":"json"}],"protocol":"HTTP"} filterList=${objectId1}|TSG_FIELD_HTTP_RES_HDR isValid=${1} appIdObjects=2 + ${policyDict} Create Dictionary policyName=Proxy-Policy-replace-00013 policyType=pxy_manipulation policyDesc=autotest action=manipulation userRegion={"method":"replace","rules":[{"search_in":"http_resp_header","find":"html","replace_with":"json"}],"protocol":"HTTP"} filterList=${objectId1}|TSG_FIELD_HTTP_RES_HDR,${objectId2}|TSG_FIELD_HTTP_URL isValid=${1} appIdObjects=2 log ${policyDict} ${rescode} ${policyId2} AddPolicies 1 ${policyDict} v2 insert_policyId_to_file1 replace_objectId31 ${objectId} insert_policyId_to_file1 replace_objectId32 ${objectId1} + insert_policyId_to_file1 replace_objectId41 ${objectId2} insert_policyId_to_file1 intercept_replace_policyId12 ${policyId1} insert_policyId_to_file1 replace_policyId12 ${policyId2} @@ -332,17 +332,17 @@ Proxy-Policy-replace-00014 ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=charset|Content-Type ${rescode} ${object_yd_Id} AddObject2 ${1} ${objectDict} Comment 创建cookie - ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=__stripe_sid|cookie + ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=__stripe_sid|Cookie ${rescode} ${object_ck_Id} AddObject2 ${1} ${objectDict} Comment 创建set-cookie - ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=CURRENCY=USD|set-cookie + ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=CURRENCY=USD|Set-Cookie ${rescode} ${object_sk_Id} AddObject2 ${1} ${objectDict} Comment 创建拦截策略 ${policyDict} Create Dictionary policyName=SecurityPolicy-Intercept-replace policyType=tsg_security policyDesc=autotest action=intercept userRegion={"protocol":"SSL","keyring":1,"decryption":1,"decrypt_mirror":{"enable":0,"mirror_profile":null}} filterList=${object_fqdn_Id}|TSG_FIELD_SSL_SNI isValid=${1} appIdObjects=3 log ${policyDict} ${rescode} ${policyId1} AddPolicies 1 ${policyDict} v2 Comment 创建replace策略 - ${policyDict} Create Dictionary policyName=Proxy-Policy-replace-00014 policyType=pxy_manipulation policyDesc=autotest action=manipulation userRegion={"method":"replace","rules":[{"search_in":"http_resp_header","find":"html","replace_with":"json"}],"protocol":"HTTP"} filterList=${object_fqdn_Id}|TSG_FIELD_HTTP_HOST,${object_url_Id}|TSG_FIELD_HTTP_URL,${object_qq_Id}|TSG_FIELD_HTTP_REQ_HDR,${object_yd_Id}|TSG_FIELD_HTTP_RES_HDR,${object_ck_Id}|TSG_FIELD_HTTP_REQ_HDR,${object_sk_Id}|TSG_FIELD_HTTP_RES_HDR isValid=${1} appIdObjects=2 + ${policyDict} Create Dictionary policyName=Proxy-Policy-replace-00014 policyType=pxy_manipulation policyDesc=autotest action=manipulation userRegion={"method":"replace","rules":[{"search_in":"http_resp_header","find":"html","replace_with":"json"}],"protocol":"HTTP"} filterList=${object_fqdn_Id}|TSG_FIELD_HTTP_HOST,${object_url_Id}|TSG_FIELD_HTTP_URL,${object_qq_Id}|TSG_FIELD_HTTP_REQ_HDR,${object_yd_Id}|TSG_FIELD_HTTP_RES_HDR,${object_sk_Id}|TSG_FIELD_HTTP_RES_HDR,${object_ck_Id}|TSG_FIELD_HTTP_REQ_HDR isValid=${1} appIdObjects=2 log ${policyDict} ${rescode} ${policyId2} AddPolicies 1 ${policyDict} v2 insert_policyId_to_file1 replace_objectId33 ${object_fqdn_Id} diff --git a/01-TestCase/tsg_adc/multi_step/b_Allow_Tests.robot b/01-TestCase/tsg_adc/multi_step/b_Allow_Tests.robot index d1dde87..256d079 100644 --- a/01-TestCase/tsg_adc/multi_step/b_Allow_Tests.robot +++ b/01-TestCase/tsg_adc/multi_step/b_Allow_Tests.robot @@ -100,9 +100,9 @@ Proxy-Policy-allow-00005 [Tags] 请求头 Comment 功能端验证HTTP验证 ${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/ProxyPolicy_allow_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.motel6.com/#/home - ${stringlist} run keyword if '${systemType}'=='Windows' Create List This site might not work properly in this browser Tango Secure Gateway CA - ... ELSE Create List This site might not work properly in this browser Tango Secure Gateway CA + ... 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://boutiquehotel.me/paris/ + ${stringlist} run keyword if '${systemType}'=='Windows' Create List helps you find the best boutique hotels around the Tango Secure Gateway CA + ... ELSE Create List helps you find the best boutique hotels around the Tango Secure Gateway CA ${starttime} Get Time Sleep ${policyVerificationSleepSeconds}s ${rescode} SystemCommands ${commandstr} ${stringlist} @@ -258,10 +258,10 @@ Proxy-Policy-allow-00013 Proxy-Policy-allow-00014 [Tags] 最大组合 Comment 功能端验证HTTP验证 - ${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/ProxyPolicy_allow_00017.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" \ --cookie "__cfduid=d5c21129d57e7124b729fd86dc82abdcd1596020306; __stripe_sid=2940d4d5-6822-4daf-8b38-9cd18d745beb; __stripe_mid=dd118cd8-845c-4b6e-98ce-81e8d5bdd52c" --referer 'https://www.baidu.com/' \ https://www.sutori.com/teachers - ${stringlist} run keyword if '${systemType}'=='Windows' Create List The best instructional and presentation tool Tango Secure Gateway CA - ... ELSE Create List The best instructional and presentation tool Tango Secure Gateway CA + ${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/ProxyPolicy_allow_00014.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" \ --cookie "__cfduid=d5c21129d57e7124b729fd86dc82abdcd1596020306; __stripe_sid=2940d4d5-6822-4daf-8b38-9cd18d745beb; __stripe_mid=dd118cd8-845c-4b6e-98ce-81e8d5bdd52c" --referer 'https://www.baidu.com/' \ https://www.orbitz.com/Flights + ${stringlist} run keyword if '${systemType}'=='Windows' Create List plenty of cheap airfare and flights to choose from Tango Secure Gateway CA + ... ELSE Create List plenty of cheap airfare and flights to choose from Tango Secure Gateway CA ${starttime} Get Time Sleep ${policyVerificationSleepSeconds}s ${rescode} SystemCommands ${commandstr} ${stringlist} diff --git a/01-TestCase/tsg_adc/multi_step/b_Hijack_Tests.robot b/01-TestCase/tsg_adc/multi_step/b_Hijack_Tests.robot index 3729098..238eb33 100644 --- a/01-TestCase/tsg_adc/multi_step/b_Hijack_Tests.robot +++ b/01-TestCase/tsg_adc/multi_step/b_Hijack_Tests.robot @@ -258,7 +258,7 @@ Proxy-Policy-hijack-00013 Proxy-Policy-hijack-00014 [Tags] 最大组合 Comment 功能端验证HTTP验证 - ${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/ProxyPolicy_hijack_00017.bat + ${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/ProxyPolicy_hijack_00014.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" \ --cookie "__cfduid=d5c21129d57e7124b729fd86dc82abdcd1596020306; __stripe_sid=2940d4d5-6822-4daf-8b38-9cd18d745beb; __stripe_mid=dd118cd8-845c-4b6e-98ce-81e8d5bdd52c" --referer 'https://www.baidu.com/' \ https://www.visitphilly.com/covid-19-resources-for-greater-philadelphia/ ${stringlist} run keyword if '${systemType}'=='Windows' Create List test-2.gif Tango Secure Gateway CA ... ELSE Create List test-2.gif Tango Secure Gateway CA diff --git a/01-TestCase/tsg_adc/multi_step/b_Redirect_Tests.robot b/01-TestCase/tsg_adc/multi_step/b_Redirect_Tests.robot index 9e53259..caa18c5 100644 --- a/01-TestCase/tsg_adc/multi_step/b_Redirect_Tests.robot +++ b/01-TestCase/tsg_adc/multi_step/b_Redirect_Tests.robot @@ -115,8 +115,8 @@ Proxy-Policy-redirect-00006 Comment 功能端验证HTTP验证 ${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/ProxyPolicy_redirect_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.marriottvacationclub.com/timeshare-ownership/about/ - ${stringlist} run keyword if '${systemType}'=='Windows' Create List https://deseretbook.com/t/ebooks/biography-autobiography Tango Secure Gateway CA - ... ELSE Create List https://deseretbook.com/t/ebooks/biography-autobiography Tango Secure Gateway CA + ${stringlist} run keyword if '${systemType}'=='Windows' Create List https://yhd.com Tango Secure Gateway CA + ... ELSE Create List https://yhd.com Tango Secure Gateway CA ${starttime} Get Time Sleep ${policyVerificationSleepSeconds}s ${rescode} SystemCommands ${commandstr} ${stringlist} @@ -129,8 +129,8 @@ Proxy-Policy-redirect-00007 Comment 功能端验证HTTP验证 ${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/ProxyPolicy_redirect_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.bulgarihotels.com/zh_CN/ - ${stringlist} run keyword if '${systemType}'=='Windows' Create List https://deseretbook.com/t/ebooks/biography-autobiography Tango Secure Gateway CA - ... ELSE Create List https://deseretbook.com/t/ebooks/biography-autobiography Tango Secure Gateway CA + ${stringlist} run keyword if '${systemType}'=='Windows' Create List https://yhd.com Tango Secure Gateway CA + ... ELSE Create List https://yhd.com Tango Secure Gateway CA ${starttime} Get Time Sleep ${policyVerificationSleepSeconds}s ${rescode} SystemCommands ${commandstr} ${stringlist} @@ -142,9 +142,9 @@ Proxy-Policy-redirect-00008 [Tags] 应答头 Comment 功能端验证HTTP验证 ${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/ProxyPolicy_redirect_00008.bat - ... ELSE set variable curl http://www.essence.com.cn/business/fixed - ${stringlist} run keyword if '${systemType}'=='Windows' Create List https://deseretbook.com/t/ebooks/biography-autobiography - ... ELSE Create List https://deseretbook.com/t/ebooks/biography-autobiography + ... ELSE set variable curl -kv http://www.essence.com.cn/business/fixed + ${stringlist} run keyword if '${systemType}'=='Windows' Create List https://yhd.com + ... ELSE Create List https://yhd.com ${starttime} Get Time Sleep ${policyVerificationSleepSeconds}s ${rescode} SystemCommands ${commandstr} ${stringlist} @@ -156,9 +156,9 @@ Proxy-Policy-redirect-00009 [Tags] 应答头 Comment 功能端验证HTTP验证 ${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/ProxyPolicy_redirect_00009.bat - ... ELSE set variable curl http://www.west95582.com/jdw/index.html - ${stringlist} run keyword if '${systemType}'=='Windows' Create List https://deseretbook.com/t/ebooks/biography-autobiography - ... ELSE Create List https://deseretbook.com/t/ebooks/biography-autobiography + ... ELSE set variable curl -kv http://www.west95582.com/jdw/index.html + ${stringlist} run keyword if '${systemType}'=='Windows' Create List https://yhd.com + ... ELSE Create List https://yhd.com ${starttime} Get Time Sleep ${policyVerificationSleepSeconds}s ${rescode} SystemCommands ${commandstr} ${stringlist} @@ -170,7 +170,7 @@ Proxy-Policy-redirect-00010 [Tags] 应答头 Comment 功能端验证HTTP验证 ${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/ProxyPolicy_redirect_00010.bat - ... ELSE set variable curl http://www.hazq.com/main/aboutus/index.shtml + ... ELSE set variable curl -kv http://www.hazq.com/main/aboutus/index.shtml ${stringlist} run keyword if '${systemType}'=='Windows' Create List https://deseretbook.com/t/ebooks/biography-autobiography ... ELSE Create List https://deseretbook.com/t/ebooks/biography-autobiography ${starttime} Get Time @@ -184,7 +184,7 @@ Proxy-Policy-redirect-00011 [Tags] 应答头 Comment 功能端验证HTTP验证 ${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/ProxyPolicy_redirect_00011.bat - ... ELSE set variable curl http://www.cs.ecitic.com/newsite/business/bank/tzyh_ywjs/ + ... ELSE set variable curl -kv http://www.cs.ecitic.com/newsite/business/bank/tzyh_ywjs/ ${stringlist} run keyword if '${systemType}'=='Windows' Create List https://deseretbook.com/t/ebooks/biography-autobiography ... ELSE Create List https://deseretbook.com/t/ebooks/biography-autobiography ${starttime} Get Time @@ -259,7 +259,7 @@ Proxy-Policy-redirect-00014 [Tags] 请求体 Comment 功能端验证HTTP验证 ${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/ProxyPolicy_redirect_00017.bat - ... ELSE set variable curl -H "Content-Type:application/x-www-form-urlencoded" -X POST -d "reqBody=lksdf&setCookie=kjhsxbn&contentType=content-type&resBody=opijn" http://open.node.com/action + ... ELSE set variable curl -H "Content-Type:application/x-www-form-urlencoded" -X POST -d "reqBody=lksdf&setCookie=kjhsxbn&contentType=content-type&resBody=opijn" -kv \ http://open.node.com/action ${stringlist} run keyword if '${systemType}'=='Windows' Create List https://deseretbook.com/t/ebooks/biography-autobiography Tango Secure Gateway CA ... ELSE Create List https://deseretbook.com/t/ebooks/biography-autobiography Tango Secure Gateway CA ${starttime} Get Time diff --git a/01-TestCase/tsg_adc/multi_step/b_Replace_Tests.robot b/01-TestCase/tsg_adc/multi_step/b_Replace_Tests.robot index 7395457..2a2b798 100644 --- a/01-TestCase/tsg_adc/multi_step/b_Replace_Tests.robot +++ b/01-TestCase/tsg_adc/multi_step/b_Replace_Tests.robot @@ -142,7 +142,7 @@ Proxy-Policy-replace-00008 [Tags] 应答头 Comment 功能端验证HTTP验证 ${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/ProxyPolicy_replace_00008.bat - ... ELSE set variable curl http://www.ghzq.com.cn/ghzq/index.html + ... ELSE set variable curl -kv http://www.ghzq.com.cn/ghzq/index.html ${stringlist} run keyword if '${systemType}'=='Windows' Create List text/json ... ELSE Create List text/json ${starttime} Get Time @@ -156,7 +156,7 @@ Proxy-Policy-replace-00009 [Tags] 应答头 Comment 功能端验证HTTP验证 ${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/ProxyPolicy_replace_00009.bat - ... ELSE set variable curl http://www.zts.com.cn/consult/consult.aspx + ... ELSE set variable curl -kv http://www.zts.com.cn/consult/consult.aspx ${stringlist} run keyword if '${systemType}'=='Windows' Create List text/json ... ELSE Create List text/json ${starttime} Get Time @@ -170,7 +170,7 @@ Proxy-Policy-replace-00010 [Tags] 应答头 Comment 功能端验证HTTP验证 ${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/ProxyPolicy_replace_00010.bat - ... ELSE set variable curl -H "Content-Type:application/x-www-form-urlencoded" -X POST -d "reqBody=hello&setCookie=hjbnm&contentType=content-type&resBody=05691" -kv \ http://open.node.com/action + ... ELSE set variable curl -H "Content-Type:application/x-www-form-urlencoded" -X POST -d "reqBody=hello&setCookie=hjbnm&contentType=text/html&resBody=05691" -kv \ http://open.node.com/action ${stringlist} run keyword if '${systemType}'=='Windows' Create List 111111 ... ELSE Create List 111111 ${starttime} Get Time @@ -184,7 +184,7 @@ Proxy-Policy-replace-00011 [Tags] 应答头 Comment 功能端验证HTTP验证 ${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/ProxyPolicy_replace_00011.bat - ... ELSE set variable curl http://www.shfe.com.cn/products/au/ + ... ELSE set variable curl -kv http://www.shfe.com.cn/products/au/ ${stringlist} run keyword if '${systemType}'=='Windows' Create List text/json ... ELSE Create List text/json ${starttime} Get Time @@ -258,7 +258,7 @@ Proxy-Policy-replace-00013 Proxy-Policy-replace-00014 [Tags] 最大组合2 Comment 功能端验证HTTP验证 - ${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/ProxyPolicy_replace_00017.bat + ${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/ProxyPolicy_replace_00014.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" \ --cookie "__cfduid=d5c21129d57e7124b729fd86dc82abdcd1596020306; __stripe_sid=2940d4d5-6822-4daf-8b38-9cd18d745beb; __stripe_mid=dd118cd8-845c-4b6e-98ce-81e8d5bdd52c" --referer 'https://www.baidu.com/' \ https://www.hotelplanner.com/Group-Rate/ ${stringlist} run keyword if '${systemType}'=='Windows' Create List text/json Tango Secure Gateway CA ... ELSE Create List text/json Tango Secure Gateway CA diff --git a/01-TestCase/tsg_adc/multi_step/c_Allow_Tests.robot b/01-TestCase/tsg_adc/multi_step/c_Allow_Tests.robot index 8abab29..30cb46b 100644 --- a/01-TestCase/tsg_adc/multi_step/c_Allow_Tests.robot +++ b/01-TestCase/tsg_adc/multi_step/c_Allow_Tests.robot @@ -75,7 +75,7 @@ Proxy-Policy-allow-00005 ${policyId2} set Variable {"policyType":"pxy_manipulation","policyIds":[${allow_policyId4}]} ${policyIds} Create List ${policyId1} ${policyId2} ${s} Convert to String ${allow_policyId4} - GetLogList proxy_event_log ${allow_starttime7} ${allow_endtime7} ${testClentIP} ${s} http_host www.motel6.com + GetLogList proxy_event_log ${allow_starttime7} ${allow_endtime7} ${testClentIP} ${s} http_host boutiquehotel.me Proxy-Policy-allow-00006 [Tags] 请求头 @@ -197,4 +197,4 @@ Proxy-Policy-allow-00014 ${policyId2} set Variable {"policyType":"pxy_manipulation","policyIds":[${allow_policyId13}]} ${policyIds} Create List ${policyId1} ${policyId2} ${s} Convert to String ${allow_policyId13} - GetLogList proxy_event_log ${allow_starttime19} ${allow_endtime19} ${testClentIP} ${s} http_host www.sutori.com + GetLogList proxy_event_log ${allow_starttime19} ${allow_endtime19} ${testClentIP} ${s} http_host www.orbitz.com diff --git a/01-TestCase/tsg_adc/multi_step/c_Insert_Tests.robot b/01-TestCase/tsg_adc/multi_step/c_Insert_Tests.robot index 7fcdd70..f162f67 100644 --- a/01-TestCase/tsg_adc/multi_step/c_Insert_Tests.robot +++ b/01-TestCase/tsg_adc/multi_step/c_Insert_Tests.robot @@ -203,6 +203,7 @@ Proxy-Policy-insert-00013 #删除对象 ${objectids} set Variable ${insert_objectId31} ${objectids} Catenate SEPARATOR=, ${objectids} ${insert_objectId32} + ${objectids} Catenate SEPARATOR=, ${objectids} ${insert_objectId41} #删除策略 ${policyId1} set Variable {"policyType":"tsg_security","policyIds":[${intercept_insert_policyId12}]} ${policyId2} set Variable {"policyType":"pxy_manipulation","policyIds":[${insert_policyId12}]} diff --git a/01-TestCase/tsg_adc/multi_step/c_Redirect_Tests.robot b/01-TestCase/tsg_adc/multi_step/c_Redirect_Tests.robot index f851dca..163b532 100644 --- a/01-TestCase/tsg_adc/multi_step/c_Redirect_Tests.robot +++ b/01-TestCase/tsg_adc/multi_step/c_Redirect_Tests.robot @@ -175,6 +175,7 @@ Proxy-Policy-redirect-00013 #删除对象 ${objectids} set Variable ${redirect_objectId31} ${objectids} Catenate SEPARATOR=, ${objectids} ${redirect_objectId32} + ${objectids} Catenate SEPARATOR=, ${objectids} ${redirect_objectId46} #删除策略 ${policyId1} set Variable {"policyType":"tsg_security","policyIds":[${intercept_redirect_policyId12}]} ${policyId2} set Variable {"policyType":"pxy_manipulation","policyIds":[${redirect_policyId12}]} @@ -190,6 +191,7 @@ Proxy-Policy-redirect-00014 #删除对象 ${objectids} set Variable ${redirect_objectId33} ${objectids} Catenate SEPARATOR=, ${objectids} ${redirect_objectId34} + ${objectids} Catenate SEPARATOR=, ${objectids} ${redirect_objectId47} #删除策略 ${policyId1} set Variable {"policyType":"tsg_security","policyIds":[${intercept_redirect_policyId13}]} ${policyId2} set Variable {"policyType":"pxy_manipulation","policyIds":[${redirect_policyId13}]} diff --git a/01-TestCase/tsg_adc/multi_step/c_Replace_Tests.robot b/01-TestCase/tsg_adc/multi_step/c_Replace_Tests.robot index f1ac3cf..8d84a33 100644 --- a/01-TestCase/tsg_adc/multi_step/c_Replace_Tests.robot +++ b/01-TestCase/tsg_adc/multi_step/c_Replace_Tests.robot @@ -136,13 +136,12 @@ Proxy-Policy-replace-00010 #删除对象 ${objectids} set Variable ${replace_objectId22} ${objectids} Catenate SEPARATOR=, ${objectids} ${replace_objectId23} - ${objectids} Catenate SEPARATOR=, ${objectids} ${replace_objectId24} #删除策略 ${policyId1} set Variable {"policyType":"tsg_security","policyIds":[${intercept_replace_policyId9}]} ${policyId2} set Variable {"policyType":"pxy_manipulation","policyIds":[${replace_policyId9}]} ${policyIds} Create List ${policyId1} ${policyId2} ${s} Convert to String ${replace_policyId9} - GetLogList proxy_event_log ${replace_starttime12} ${replace_endtime12} ${testClentIP} ${s} http_host www.csrc.gov.cn + GetLogList proxy_event_log ${replace_starttime12} ${replace_endtime12} ${testClentIP} ${s} http_host open.node.com Proxy-Policy-replace-00011 [Tags] 应答头 @@ -175,6 +174,7 @@ Proxy-Policy-replace-00013 #删除对象 ${objectids} set Variable ${replace_objectId31} ${objectids} Catenate SEPARATOR=, ${objectids} ${replace_objectId32} + ${objectids} Catenate SEPARATOR=, ${objectids} ${replace_objectId41} #删除策略 ${policyId1} set Variable {"policyType":"tsg_security","policyIds":[${intercept_replace_policyId12}]} ${policyId2} set Variable {"policyType":"pxy_manipulation","policyIds":[${replace_policyId12}]} diff --git a/02-Keyword/tsg_bfapi/policy_object/ProcessPolicyBody.robot b/02-Keyword/tsg_bfapi/policy_object/ProcessPolicyBody.robot index d85e319..fec8db4 100644 --- a/02-Keyword/tsg_bfapi/policy_object/ProcessPolicyBody.robot +++ b/02-Keyword/tsg_bfapi/policy_object/ProcessPolicyBody.robot @@ -4,6 +4,7 @@ Library Collections Resource ../../../03-Variable/BifangApiVariable.txt Resource ../../../03-Variable/PolicyObjectDefault.txt Resource ../../tsg_common/ManagePolicyBody.robot + *** Variables *** #arraySplitor:数组元素之间的分隔符 ${arraySplitor} , @@ -13,43 +14,42 @@ ${protocolFiledSplitor} & ${objectIdSplitor} : #idFiledSplitor: objectId和protocolFiled之间的分隔符 ${idFiledSplitor} | + *** Keywords *** -# ... 特殊参数说明: -# ... effectiveRange=Nursurtan|Transtelecom&Astel,Almaty&Nursurtan,|Astel&Transtelecom -# ... 为字符串类型,每条生效区域信息以','分隔 -# ... ①以'|'字符开头表示仅为isp信息,如:effectiveRange=|Astel&Transtelecom -# ... ②非'|'字符开头表示仅为location信息或location和isp信息,如: -# ... effectiveRange=Nursurtan(仅为location信息) -# ... effectiveRange=Nursurtan|Transtelecom&Astel(location和isp信息) -# ... userRegion=protocol:HTTP,keyring:${1} -# ... 为字符串类型,每条动作参数以','分隔 -# ... [key]:[value],... -# ... 在v1版本中referenceObject=${265}|TSG_FIELD_HTTP_HOST,${266}|TSG_FIELD_SSL_SNI&TSG_FIELD_SSL_SAN -# ... 为字符串类型,每条引用的策略对象信息以','分隔 -# ... [objectId]|[protocolFileds],... ,多个protocolFileds用'&'连接 -# ... scheduleId=${3},${1} -# ... 为字符串类型,以','分隔 -# ... 在v1版本接口中appObjectIdArray==${2},${3} -# ... 在v2版本接口中appIdObjects==${2},${3} -# ... 为字符串类型,以','分隔 -# ... -# ... 注:数字类型变量为${0}、${1}、${...} -# ... 在v2版本中 无referenceObject,取而代之的是source,destination,filterList -# ... source= ${265}|TSG_FIELD_HTTP_HOST,${266}|TSG_FIELD_SSL_SNI -# ... destination= ${265}|TSG_FIELD_HTTP_HOST,${266}|TSG_FIELD_SSL_SNI -# ... filterList= ${265}:${257}|TSG_FIELD_HTTP_HOST,${266}:${299}|TSG_FIELD_SSL_SNI -# ... filterList由多个数字用‘:’分隔,加上|对上对应的protocolFiled, -# ... 一个filter中的protocolFiled是确定的,一个protocolFiled对应多个objectId PolicyListDataOperation - [Documentation] - ... 描述:入口,opAction参数可为'add','update','disable','enable' - ... 参数:returnData: 必传,是否返回请求数据。可选${0}(不返回)/${1}(返回)。 - ... policyList: 必传,字典类型。字典内可选参数信息: - ... policyObjectVersion: 必传,v1,v2,涉及策略版本 - ... 其它参数默认值见../../03-Variable/PolicyObjectDefault.txt - ... 多个策略处理 - [Arguments] ${returnData} ${policyList} ${opAction} ${policyObjectVersion} + [Documentation] 描述:入口,opAction参数可为'add','update','disable','enable' + ... 参数:returnData: 必传,是否返回请求数据。可选${0}(不返回)/${1}(返回)。 + ... policyList: 必传,字典类型。字典内可选参数信息: + ... policyObjectVersion: 必传,v1,v2,涉及策略版本 + ... 其它参数默认值见../../03-Variable/PolicyObjectDefault.txt + ... 多个策略处理 + # ... 特殊参数说明: + # ... effectiveRange=Nursurtan|Transtelecom&Astel,Almaty&Nursurtan,|Astel&Transtelecom + # ... 为字符串类型,每条生效区域信息以','分隔 + # ... ①以'|'字符开头表示仅为isp信息,如:effectiveRange=|Astel&Transtelecom + # ... ②非'|'字符开头表示仅为location信息或location和isp信息,如: + # ... effectiveRange=Nursurtan(仅为location信息) + # ... effectiveRange=Nursurtan|Transtelecom&Astel(location和isp信息) + # ... userRegion=protocol:HTTP,keyring:${1} + # ... 为字符串类型,每条动作参数以','分隔 + # ... [key]:[value],... + # ... 在v1版本中referenceObject=${265}|TSG_FIELD_HTTP_HOST,${266}|TSG_FIELD_SSL_SNI&TSG_FIELD_SSL_SAN + # ... 为字符串类型,每条引用的策略对象信息以','分隔 + # ... [objectId]|[protocolFileds],... ,多个protocolFileds用'&'连接 + # ... scheduleId=${3},${1} + # ... 为字符串类型,以','分隔 + # ... 在v1版本接口中appObjectIdArray==${2},${3} + # ... 在v2版本接口中appIdObjects==${2},${3} + # ... 为字符串类型,以','分隔 + # ... + # ... 注:数字类型变量为${0}、${1}、${...} + # ... 在v2版本中 无referenceObject,取而代之的是source,destination,filterList + # ... source= ${265}|TSG_FIELD_HTTP_HOST,${266}|TSG_FIELD_SSL_SNI + # ... destination= ${265}|TSG_FIELD_HTTP_HOST,${266}|TSG_FIELD_SSL_SNI + # ... filterList= ${265}:${257}|TSG_FIELD_HTTP_HOST,${266}:${299}|TSG_FIELD_SSL_SNI + # ... filterList由多个数字用‘:’分隔,加上|对上对应的protocolFiled, + # ... 一个filter中的protocolFiled是确定的,一个protocolFiled对应多个objectId Log To Console Call PolicyListDataOperation ${policyListJson} Set Variable [ FOR ${policy} IN @{policyList} @@ -58,208 +58,197 @@ PolicyListDataOperation END ${policyListJson}= Replace String Using Regexp ${policyListJson} ,$ ] # 转为json结构并返回 - ${dict} Create Dictionary opAction=${opAction} returnData=${returnData} policyList=replace:policyList - ${bodyJson} json.Dumps ${dict} ensure_ascii=False - ${json} Replace String ${bodyJson} "replace:policyList" ${policyListJson} + ${dict} Create Dictionary opAction=${opAction} returnData=${returnData} policyList=replace:policyList + ${bodyJson} json.Dumps ${dict} ensure_ascii=False + ${json} Replace String ${bodyJson} "replace:policyList" ${policyListJson} Log Policy_Request_Body-${json} [Return] ${json} PolicyDataOperation - [Documentation] - ... 描述:入口,opAction参数可为'add','update','disable','enable' - ... 参数:returnData: 必传,是否返回请求数据。可选${0}(不返回)/${1}(返回)。 - ... policy: 必传,字典类型。字典内可选参数信息: - ... policyObjectVersion: 必传,v1,v2,涉及策略版本 - ... 其它参数默认值见../../03-Variable/PolicyObjectDefault.txt - ... 单个策略处理 - [Arguments] ${returnData} ${policy} ${opAction} ${policyObjectVersion} + [Documentation] 描述:入口,opAction参数可为'add','update','disable','enable' + ... 参数:returnData: 必传,是否返回请求数据。可选${0}(不返回)/${1}(返回)。 + ... policy: 必传,字典类型。字典内可选参数信息: + ... policyObjectVersion: 必传,v1,v2,涉及策略版本 + ... 其它参数默认值见../../03-Variable/PolicyObjectDefault.txt + ... 单个策略处理 Log To Console Call PolicyDataOperation ${json} PolicyOrganize ${policy} ${opAction} ${policyObjectVersion} # 转为json结构并返回 - ${dict} Create Dictionary opAction=${opAction} returnData=${returnData} policyList=replace:policyList - ${bodyJson} json.Dumps ${dict} ensure_ascii=False - ${json} Replace String ${bodyJson} "replace:policyList" ${json} - + ${dict} Create Dictionary opAction=${opAction} returnData=${returnData} policyList=replace:policyList + ${bodyJson} json.Dumps ${dict} ensure_ascii=False + ${json} Replace String ${bodyJson} "replace:policyList" ${json} Log Policy_Request_Body-${json} [Return] ${json} PolicyOrganize - [Documentation] - ... 描述:入口,opAction参数可为'add','update','disable','enable' - ... policy: 必传,字典类型。字典内可选参数信息: - ... 其它参数默认值见../../03-Variable/PolicyObjectDefault.txt - ... policyObjectVersion: 必传,v1,v2,涉及策略版本 - ... 单个策略转换为json [Arguments] ${policy} ${opAction} ${policyObjectVersion} + [Documentation] 描述:入口,opAction参数可为'add','update','disable','enable' + ... policy: 必传,字典类型。字典内可选参数信息: + ... 其它参数默认值见../../03-Variable/PolicyObjectDefault.txt + ... policyObjectVersion: 必传,v1,v2,涉及策略版本 + ... 单个策略转换为json Log To Console Call PolicyOrganize ${returnDict} Create Dictionary ${emptyList} Create List #v1版本接口与v2版本接口不同的字段 - Run Keyword If "${policyObjectVersion}"=="v1" Dictionary Should Not Contain Key ${policy} source - Run Keyword If "${policyObjectVersion}"=="v1" Dictionary Should Not Contain Key ${policy} destination - Run Keyword If "${policyObjectVersion}"=="v1" Dictionary Should Not Contain Key ${policy} filterList - Run Keyword If "${policyObjectVersion}"=="v1" Dictionary Should Not Contain Key ${policy} appIdObjects - - Run Keyword If "${policyObjectVersion}"=="v2" Dictionary Should Not Contain Key ${policy} referenceObject - Run Keyword If "${policyObjectVersion}"=="v2" Dictionary Should Not Contain Key ${policy} appObjectIdArray + Run Keyword If "${policyObjectVersion}"=="v1" Dictionary Should Not Contain Key ${policy} source + Run Keyword If "${policyObjectVersion}"=="v1" Dictionary Should Not Contain Key ${policy} destination + Run Keyword If "${policyObjectVersion}"=="v1" Dictionary Should Not Contain Key ${policy} filterList + Run Keyword If "${policyObjectVersion}"=="v1" Dictionary Should Not Contain Key ${policy} appIdObjects + Run Keyword If "${policyObjectVersion}"=="v2" Dictionary Should Not Contain Key ${policy} referenceObject + Run Keyword If "${policyObjectVersion}"=="v2" Dictionary Should Not Contain Key ${policy} appObjectIdArray #更新时 policyId不允许为空 ${return} ${policyId} Run Keyword And Ignore Error Get From Dictionary ${policy} policyId - Run Keyword If "${opAction}"=="update" and "${return}"=="FAIL" Fail policyId is required when opAction is update - Run Keyword If "${opAction}"=="update" and "${policyId}"=="${EMPTY}" Fail policyId is required when opAction is update - Run Keyword If "${opAction}"=="disable" and "${return}"=="FAIL" Fail policyId is required when opAction is disable - Run Keyword If "${opAction}"=="disable" and "${policyId}"=="${EMPTY}" Fail policyId is required when opAction is disable - Run Keyword If "${opAction}"=="enable" and "${return}"=="FAIL" Fail policyId is required when opAction is enable - Run Keyword If "${opAction}"=="enable" and "${policyId}"=="${EMPTY}" Fail policyId is required when opAction is enable - ${policyId} Run Keyword If "${opAction}"=="add" Set Variable ${EMPTY} - ... ELSE Get From Dictionary ${policy} policyId + Run Keyword If "${opAction}"=="update" and "${return}"=="FAIL" Fail policyId is required when opAction is update + Run Keyword If "${opAction}"=="update" and "${policyId}"=="${EMPTY}" Fail policyId is required when opAction is update + Run Keyword If "${opAction}"=="disable" and "${return}"=="FAIL" Fail policyId is required when opAction is disable + Run Keyword If "${opAction}"=="disable" and "${policyId}"=="${EMPTY}" Fail policyId is required when opAction is disable + Run Keyword If "${opAction}"=="enable" and "${return}"=="FAIL" Fail policyId is required when opAction is enable + Run Keyword If "${opAction}"=="enable" and "${policyId}"=="${EMPTY}" Fail policyId is required when opAction is enable + ${policyId} Run Keyword If "${opAction}"=="add" Set Variable ${EMPTY} + ... ELSE Get From Dictionary ${policy} policyId Set To Dictionary ${returnDict} policyId=${policyId} - ${return} ${policyType} Run Keyword And Ignore Error Get From Dictionary ${policy} policyType Run Keyword If "${return}"=="FAIL" or "${policyType}"=="${EMPTY}" Set To Dictionary ${returnDict} policyType=${Default_PolicyType} ... ELSE Set To Dictionary ${returnDict} policyType=${policyType} - - #enable disable直接返回json + #enable disable直接返回json Run Keyword And Return If "${opAction}"=="enable" or "${opAction}"=="disable" ManagePolicyEnableAndDisable ${returnDict} ${opAction} - # 取可选参数,为传入设置默认值 ${return} ${policyName} Run Keyword And Ignore Error Get From Dictionary ${policy} policyName Run Keyword If "${return}"=="FAIL" or "${policyName}"=="${EMPTY}" Set To Dictionary ${returnDict} policyName=${Default_PolicyName} ... ELSE Set To Dictionary ${returnDict} policyName=${policyName} - - #policyDesc 不是必填的选项 + #policyDesc 不是必填的选项 ${return} ${policyDesc} Run Keyword And Ignore Error Get From Dictionary ${policy} policyDesc Run Keyword If "${return}"=="FAIL" or "${policyDesc}"=="${EMPTY}" Set To Dictionary ${returnDict} policyDesc=${Default_PolicyDesc} - ... ELSE Set To Dictionary ${returnDict} policyDesc=${policyDesc} - + ... ELSE Set To Dictionary ${returnDict} policyDesc=${policyDesc} ${return} ${action} Run Keyword And Ignore Error Get From Dictionary ${policy} action Run Keyword If "${return}"=="FAIL" or "${action}"=="${EMPTY}" Set To Dictionary ${returnDict} action=${Default_Action} ... ELSE Set To Dictionary ${returnDict} action=${action} - #userTags 不是必填的选项 + #userTags 不是必填的选项 ${return} ${userTags} Run Keyword And Ignore Error Get From Dictionary ${policy} userTags Run Keyword If "${return}"=="FAIL" or "${userTags}"=="${EMPTY}" Set To Dictionary ${returnDict} userTags=${Default_UserTags} ... ELSE Set To Dictionary ${returnDict} userTags=${userTags} - ${return} ${doLog} Run Keyword And Ignore Error Get From Dictionary ${policy} doLog Run Keyword If "${return}"=="FAIL" or "${doLog}"=="${EMPTY}" Set To Dictionary ${returnDict} doLog=${Default_DoLog} ... ELSE Set To Dictionary ${returnDict} doLog=${doLog} - ${return} ${isValid} Run Keyword And Ignore Error Get From Dictionary ${policy} isValid Run Keyword If "${return}"=="FAIL" or "${isValid}"=="${EMPTY}" Set To Dictionary ${returnDict} isValid=${Default_IsValid} ... ELSE Set To Dictionary ${returnDict} isValid=${isValid} - - ${return} ${scheduleId} Run Keyword And Ignore Error Get From Dictionary ${policy} scheduleId + ${return} ${scheduleId} Run Keyword And Ignore Error Get From Dictionary ${policy} scheduleId ${scheduleIdV} Run Keyword If "${return}"!="FAIL" and "${scheduleId}"!="${EMPTY}" and "${scheduleId}"!="${None}" Evaluate list(map(int, re.split('[,]', '${scheduleId}'))) re - ... ELSE Set Variable ${emptyList} + ... ELSE Set Variable ${emptyList} Set To Dictionary ${returnDict} scheduleId=${scheduleIdV} ${return} ${appObjectIdArray} Run Keyword If "${policyObjectVersion}"=="v1" Run Keyword And Ignore Error Get From Dictionary ${policy} appObjectIdArray ... ELSE Run Keyword And Ignore Error Get From Dictionary ${policy} appIdObjects - ${appObjectIdArrayV} Run Keyword If "${return}"=="FAIL" or "${appObjectIdArray}"=="${EMPTY}" Evaluate list(map(int, re.split('[,]', '${Default_AppObjectIdArray}'))) re - ... ELSE Evaluate list(map(int, re.split('[,]', '${appObjectIdArray}'))) re + ${appObjectIdArrayV} Run Keyword If "${return}"=="FAIL" or "${appObjectIdArray}"=="${EMPTY}" Evaluate list(map(int, re.split('[,]', '${Default_AppObjectIdArray}'))) re + ... ELSE Evaluate list(map(int, re.split('[,]', '${appObjectIdArray}'))) re Run Keyword If "${policyObjectVersion}"=="v1" Set To Dictionary ${returnDict} appObjectIdArray=${appObjectIdArrayV} ... ELSE IF "${policyObjectVersion}"=="v2" Set To Dictionary ${returnDict} appIdObjects=${appObjectIdArrayV} - # 固定值 Set To Dictionary ${returnDict} doBlacklist=${0} # 分别处理EffectiveRange、UserRegion和ReferenceObject参数 ProcessEffectiveRange ${policy} ${returnDict} - #WxManageUserRegion ${policy} - Run Keyword If "${policyObjectVersion}"=="v1" ProcessReferenceObject ${policy} ${returnDict} ELSE IF "${policyObjectVersion}"=="v2" ManageObjectV2 ${policy} ${returnDict} + #WxManageUserRegion ${policy} + Run Keyword If "${policyObjectVersion}"=="v1" ProcessReferenceObject ${policy} ${returnDict} + ... ELSE IF "${policyObjectVersion}"=="v2" ManageObjectV2 ${policy} ${returnDict} #先取出useragion 再放回json ${return} ${userRegion} Run Keyword And Ignore Error Get From Dictionary ${policy} userRegion Set To Dictionary ${returnDict} userRegion=${Default_UserRegion} - ${userRegion} Run Keyword If "${return}"=="FAIL" or '${userRegion}'=="${EMPTY}" Set Variable "" - ... ELSE Set Variable ${userRegion} + ${userRegion} Run Keyword If "${return}"=="FAIL" or '${userRegion}'=="${EMPTY}" Set Variable "" + ... ELSE Set Variable ${userRegion} #针对主动防御特殊处理,主动防御不应用对象 ${active_defence_emptyList} Create List ${return} ${policyType} Run Keyword And Ignore Error Get From Dictionary ${policy} policyType Run Keyword If "${policyObjectVersion}"=="v1" and "${policyType}"=="active_defence" Set To Dictionary ${returnDict} referenceObject=${active_defence_emptyList} - Run Keyword If "${policyObjectVersion}"=="v1" and "${policyType}"=="active_defence" Set To Dictionary ${returnDict} appObjectIdArray=${active_defence_emptyList} + Run Keyword If "${policyObjectVersion}"=="v1" and "${policyType}"=="active_defence" Set To Dictionary ${returnDict} appObjectIdArray=${active_defence_emptyList} #v版本主动防御 - Run Keyword If "${policyObjectVersion}"=="v2" and "${policyType}"=="active_defence" Set To Dictionary ${returnDict} source=${active_defence_emptyList} - Run Keyword If "${policyObjectVersion}"=="v2" and "${policyType}"=="active_defence" Set To Dictionary ${returnDict} destination=${active_defence_emptyList} - Run Keyword If "${policyObjectVersion}"=="v2" and "${policyType}"=="active_defence" Set To Dictionary ${returnDict} filterList=${active_defence_emptyList} - Run Keyword If "${policyObjectVersion}"=="v2" and "${policyType}"=="active_defence" Set To Dictionary ${returnDict} appIdObjects=${active_defence_emptyList} - # 转为json结构并返回 - ${json} json.Dumps ${returnDict} ensure_ascii=False - ${json} Replace String ${json} "method:rst" ${userRegion} - #${json} Replace String ${json} "effectiveRange:Empty" {} + Run Keyword If "${policyObjectVersion}"=="v2" and "${policyType}"=="active_defence" Set To Dictionary ${returnDict} source=${active_defence_emptyList} + Run Keyword If "${policyObjectVersion}"=="v2" and "${policyType}"=="active_defence" Set To Dictionary ${returnDict} destination=${active_defence_emptyList} + Run Keyword If "${policyObjectVersion}"=="v2" and "${policyType}"=="active_defence" Set To Dictionary ${returnDict} filterList=${active_defence_emptyList} + Run Keyword If "${policyObjectVersion}"=="v2" and "${policyType}"=="active_defence" Set To Dictionary ${returnDict} appIdObjects=${active_defence_emptyList} + #针对WAN NAT特殊处理,主动防御不应用对象 + ${wannat_emptyList} Create List + ${return} ${policyType} Run Keyword And Ignore Error Get From Dictionary ${policy} policyType + Run Keyword If "${policyObjectVersion}"=="v2" and "${policyType}"=="wannat" Set To Dictionary ${returnDict} appIdObjects=${wannat_emptyList} + Run Keyword If "${policyObjectVersion}"=="v2" and "${policyType}"=="wannat" Set To Dictionary ${returnDict} filterList=${wannat_emptyList} + # 转为json结构并返回 + ${json} json.Dumps ${returnDict} ensure_ascii=False + ${json} Replace String ${json} "method:rst" ${userRegion} + #${json} Replace String ${json} "effectiveRange:Empty" {} Log Policy-${json} [Return] ${json} + ManagePolicyEnableAndDisable - [Documentation] - ... 启用与禁用时调用 [Arguments] ${returnDict} ${opAction} - Run Keyword If "${opAction}"=="enable" Set To Dictionary ${returnDict} isValid=1 + [Documentation] 启用与禁用时调用 + Run Keyword If "${opAction}"=="enable" Set To Dictionary ${returnDict} isValid=1 Run Keyword If "${opAction}"=="disable" Set To Dictionary ${returnDict} isValid=0 ${json} json.Dumps ${returnDict} ensure_ascii=False Log Policy-${json} - [Return] ${json} + [Return] ${json} + ProcessEffectiveRange - [Documentation] - ... 处理EffectiveRange - ... 加入effectiveRange={}的处理支持 [Arguments] ${policyList} ${returnDict} + [Documentation] 处理EffectiveRange + ... 加入effectiveRange={}的处理支持 Log To Console Call ProcessEffectiveRange ${emptyList} Create List ${emptyListDouble} Create List ${emptyList} - - ${return} ${effectiveRange} Run Keyword And Ignore Error Get From Dictionary ${policyList} effectiveRange + ${return} ${effectiveRange} Run Keyword And Ignore Error Get From Dictionary ${policyList} effectiveRange ${effectiveRange} Run Keyword If "${return}"=="FAIL" or "${effectiveRange}"=="${EMPTY}" Set Variable ${Default_EffectiveRange} - ... ELSE Set Variable ${effectiveRange} + ... ELSE Set Variable ${effectiveRange} ${value} Run Keyword If "${effectiveRange}"=="${EMPTY}" Create Dictionary tag_sets=${emptyListDouble} - ... ELSE IF "${effectiveRange}"=="{}" Create Dictionary ELSE AnalysisEffectiveRange ${effectiveRange} + ... ELSE IF "${effectiveRange}"=="{}" Create Dictionary + ... ELSE AnalysisEffectiveRange ${effectiveRange} Set To Dictionary ${returnDict} effectiveRange=${value} + ProcessReferenceObject - [Documentation] - ... 处理引用对象字符串 - ... v1版本接口使用 [Arguments] ${policy} ${returnDict} + [Documentation] 处理引用对象字符串 + ... v1版本接口使用 Log To Console Call ProcessReferenceObject - ${emptyList} Create List + ${emptyList} Create List #默认客户端条件类型:clientip or clientsubid - ${return} ${defaultClient} Run Keyword And Ignore Error Get From Dictionary ${policy} defalutClient - ${defaultClient} Run Keyword If "${return}"=="FAIL" or "${defaultClient}"=="${EMPTY}" Set Variable ${Default_Client_Type} - ... ELSE Set Variable ${defaultClient} + ${return} ${defaultClient} Run Keyword And Ignore Error Get From Dictionary ${policy} defalutClient + ${defaultClient} Run Keyword If "${return}"=="FAIL" or "${defaultClient}"=="${EMPTY}" Set Variable ${Default_Client_Type} + ... ELSE Set Variable ${defaultClient} Run Keyword If '${addTestClentIPFlag}'=='1' and '${defaultClient}'=='clientip' ManageClientIPObject ${emptyList} - Run Keyword If '${addTestClentIPFlag}'=='1' and '${defaultClient}'=='clientsubid' ManageClientSubIDObject ${emptyList} + Run Keyword If '${addTestClentIPFlag}'=='1' and '${defaultClient}'=='clientsubid' ManageClientSubIDObject ${emptyList} #Run Keyword If '${addTestClentIPFlag}'=='1' ManageClientObject ${emptyList} # Run Keyword If "${clientHostObj}"!="${None}" Append To List ${emptyList} ${clientHostObj} - ${defaultObj} Create Dictionary ${return} ${referenceObject} Run Keyword And Ignore Error Get From Dictionary ${policy} referenceObject - ${referenceObject} Run Keyword If "${return}"=="FAIL" or "${referenceObject}"=="${EMPTY}" Set Variable ${Default_ReferenceObject} - ... ELSE Set Variable ${referenceObject} - ${value} Run Keyword If "${referenceObject}"=="${EMPTY}" Create List ${defaultObj} - ... ELSE AnalysisReferenceObject ${referenceObject} + ${referenceObject} Run Keyword If "${return}"=="FAIL" or "${referenceObject}"=="${EMPTY}" Set Variable ${Default_ReferenceObject} + ... ELSE Set Variable ${referenceObject} + ${value} Run Keyword If "${referenceObject}"=="${EMPTY}" Create List ${defaultObj} + ... ELSE AnalysisReferenceObject ${referenceObject} # 若参数为空,设置默认结构 - # FOR ${var} IN @{value} - # Run Keyword If ${var}!={} Append To List ${referenceObject} ${var} + # FOR ${var} IN @{value} + # Run Keyword If ${var}!={} Append To List ${referenceObject} ${var} # END ObjectLoop ${value} ${emptyList} - Set To Dictionary ${returnDict} referenceObject=${emptyList} ObjectLoop [Arguments] ${value} ${valueList} # 若参数为空,设置默认结构 - FOR ${var} IN @{value} - Run Keyword If ${var}!={} Append To List ${valueList} ${var} + FOR ${var} IN @{value} + Run Keyword If ${var}!={} Append To List ${valueList} ${var} END - [Return] ${valueList} + [Return] ${valueList} + ManageObjectV2 - [Documentation] - ... 处理引用对象字符串 + [Arguments] ${policy} ${returnDict} + [Documentation] 处理引用对象字符串 ... v2版本接口使用 ... source,destination,filterList # 处理引用对象字符串 - [Arguments] ${policy} ${returnDict} - Log To Console Call ManageObjectV2 + Log To Console Call ManageObjectV2 #默认客户端条件类型:clientip or clientsubid - ${return} ${defaultClient} Run Keyword And Ignore Error Get From Dictionary ${policy} defalutClient - ${defaultClient} Run Keyword If "${return}"=="FAIL" or "${defaultClient}"=="${EMPTY}" Set Variable ${Default_Client_Type} - ... ELSE Set Variable ${defaultClient} - + ${return} ${defaultClient} Run Keyword And Ignore Error Get From Dictionary ${policy} defalutClient + ${defaultClient} Run Keyword If "${return}"=="FAIL" or "${defaultClient}"=="${EMPTY}" Set Variable ${Default_Client_Type} + ... ELSE Set Variable ${defaultClient} ${sourceList} Create List ${destinationList} Create List ${filterList} Create List @@ -268,112 +257,109 @@ ManageObjectV2 AnalysisObjectV2 ${policy} source ${sourceList} AnalysisObjectV2 ${policy} destination ${destinationList} AnalysisObjectV2 ${policy} filterList ${filterList} - Set To Dictionary ${returnDict} source=${sourceList} destination=${destinationList} filterList=${filterList} - - Log ${policy} -ManageClientIPObjectV2 - [Arguments] ${emptyList} - # 增加引用测试终端IP策略对象 + Log ${policy} + +ManageClientIPObjectV2 + [Arguments] ${emptyList} + # 增加引用测试终端IP策略对象 ${obj1} Create Dictionary objectId=${testClentID} protocolField=TSG_SECURITY_SOURCE_ADDR Append To List ${emptyList} ${obj1} + ManageClientSubIDObjectV2 - [Arguments] ${emptyList} + [Arguments] ${emptyList} # 增加引用测试终端IP策略对象 - ${protocolField} Set Variable + ${protocolField} Set Variable ${obj1} Create Dictionary objectId=${testClentSubID} protocolField=${protocolField} - Append To List ${emptyList} ${obj1} + Append To List ${emptyList} ${obj1} + AnalysisObjectV2 [Arguments] ${policy} ${objectType} ${objList} - Log To Console Call AnalysisObjectV2 + Log To Console Call AnalysisObjectV2 ${policyObjectDefault} Run Keyword If "${objectType}"=="source" Set Variable ${EMPTY} - ... ELSE IF "${objectType}"=="destination" Set Variable ${EMPTY} + ... ELSE IF "${objectType}"=="destination" Set Variable ${EMPTY} ... ELSE IF "${objectType}"=="filterList" Set Variable ${EMPTY} - ${return} ${objectList} Run Keyword And Ignore Error Get From Dictionary ${policy} ${objectType} - # source,destination,filterList - ${objectList} Run Keyword If "${return}"=="FAIL" or "${objectList}"=="${EMPTY}" Set Variable ${policyObjectDefault} - ... ELSE Set Variable ${objectList} - - ${list} Evaluate re.split('[${arraySplitor}]', '${objectList}') re + ${objectList} Run Keyword If "${return}"=="FAIL" or "${objectList}"=="${EMPTY}" Set Variable ${policyObjectDefault} + ... ELSE Set Variable ${objectList} + ${list} Evaluate re.split('[${arraySplitor}]', '${objectList}') re FOR ${var} IN @{list} ${tempObj} Run Keyword If "${objectType}"=="filterList" and "${var}" != "" ManageFilter ${var} - ... ELSE IF "${var}" != "" ManageObject ${var} ELSE Set Variable ${EMPTY} - Run Keyword If "${tempObj}" != "${EMPTY}" Append To List ${objList} ${tempObj} + ... ELSE IF "${var}" != "" ManageObject ${var} + ... ELSE Set Variable ${EMPTY} + Run Keyword If "${tempObj}" != "${EMPTY}" Append To List ${objList} ${tempObj} END - Log ${objList} + Log ${objList} + ManageObject - [Documentation] - ... source,destination处理 - [Arguments] ${object} - Log To Console Call ManageObject - ${objectList} Create List + [Arguments] ${object} + [Documentation] source,destination处理 + Log To Console Call ManageObject + ${objectList} Create List #截取objectId ${objectId} Evaluate '${object}'[0:'${object}'.find('${idFiledSplitor}')] #截取protocolField ${protocolField} Evaluate '${object}'['${object}'.find('${idFiledSplitor}')+1:] ${tempObj} Create Dictionary ${objectId} Run Keyword If '${objectId}'.isdigit() Evaluate int('${objectId}') - ... ELSE Set Variable ${objectId} + ... ELSE Set Variable ${objectId} Set To Dictionary ${tempObj} objectId=${objectId} Set To Dictionary ${tempObj} protocolField=${protocolField} [Return] ${tempObj} + ManageFilter - [Documentation] - ... filterList处理 - [Arguments] ${filter} - Log Call ManageFilter - ${filterObjectList} Create List + [Arguments] ${filter} + [Documentation] filterList处理 + Log Call ManageFilter + ${filterObjectList} Create List #截取objectId ${objectIds} Evaluate '${filter}'[0:'${filter}'.find('${idFiledSplitor}')] #截取protocolField ${protocolField} Evaluate '${filter}'['${filter}'.find('${idFiledSplitor}')+1:] - #遍历 objectId + #遍历 objectId ${list} Evaluate re.split('[${objectIdSplitor}]', '${objectIds}') re Log list ${list} FOR ${var} IN @{list} - ${tempObj} Create Dictionary - ${var} Run Keyword If '${var}'.isdigit() Evaluate int('${var}') - ... ELSE Set Variable ${var} - Set To Dictionary ${tempObj} objectId=${var} - Set To Dictionary ${tempObj} protocolField=${protocolField} - Append To List ${filterObjectList} ${tempObj} + ${tempObj} Create Dictionary + ${var} Run Keyword If '${var}'.isdigit() Evaluate int('${var}') + ... ELSE Set Variable ${var} + Set To Dictionary ${tempObj} objectId=${var} + Set To Dictionary ${tempObj} protocolField=${protocolField} + Append To List ${filterObjectList} ${tempObj} END ${filterObject} Create Dictionary filter=${filterObjectList} [Return] ${filterObject} Get-PolicyIds - [Documentation] - ... 获取结果中的策略ID [Arguments] ${value} + [Documentation] 获取结果中的策略ID ${policyIds} Create List - FOR ${policy} IN @{value['data']['policyList']} #${policyIdList} Create List ${policy['policyId']} #${policyObj} Create Dictionary policyType=${policy['policyType']} policyIds=${policyIdList} #Append To List ${policyIds} ${policyObj} - Append To List ${policyIds} ${policy['policyId']} + Append To List ${policyIds} ${policy['policyId']} END ${len} Get Length ${policyIds} - ${policyIds} Run Keyword If ${len}==1 Set Variable ${policyIds[0]} + ${policyIds} Run Keyword If ${len}==1 Set Variable ${policyIds[0]} ... ELSE Set Variable ${policyIds} [Return] ${policyIds} + DeletePolicyWithParamDict - [Documentation] - ... 删除策略 - ... params,传入的删除字典 - ... 结构为policyIds=${policyIds} (List) policyType=${policyType} (variable) [Arguments] ${params} + [Documentation] 删除策略 + ... params,传入的删除字典 + ... 结构为policyIds=${policyIds} (List) policyType=${policyType} (variable) ${response} BaseDeleteRequest /${version}${policyUrl} ${params} - ${rescode} Set Variable ${response['code']} - Should Be Equal As Strings ${rescode} 200 + ${rescode} Set Variable ${response['code']} + Should Be Equal As Strings ${rescode} 200 [Return] ${rescode} + VerifyPolicyList - [Documentation] - ... 策略验证 - ... 多个策略验证 [Arguments] ${verifyList} + [Documentation] 策略验证 + ... 多个策略验证 Log To Console Call VerifyPolicyList ${verifyListJson} Set Variable [ FOR ${verifyObj} IN @{verifyList} @@ -383,11 +369,11 @@ VerifyPolicyList ${verifyListJson}= Replace String Using Regexp ${verifyListJson} ,$ ] Log Policy_Request_Body-${verifyListJson} [Return] ${verifyListJson} + VerifyPolicyObj - [Documentation] - ... 策略验证 - ... 单个策略验证 [Arguments] ${verifyObj} + [Documentation] 策略验证 + ... 单个策略验证 Log To Console Call VerifyPolicyObj ${emptyList} Create List ${return} ${policyType} Run Keyword And Ignore Error Set Variable ${verifyObj['policyType']} @@ -395,39 +381,40 @@ VerifyPolicyObj ${verifySession} Get From Dictionary ${verifyObj} verifySession Should Not Be Empty ${verifySession} ${attributes} Get From Dictionary ${verifySession} attributes - Should Not Be Empty ${attributes} + Should Not Be Empty ${attributes} FOR ${attribute} IN @{attributes} - ${attributeType} Get From Dictionary ${attribute} attributeType - ${return} ${tableName} Run Keyword And Ignore Error Set Variable ${attribute['tableName']} - ${return} ${protocol} Run Keyword And Ignore Error Set Variable ${attribute['protocol']} - ${attributeName} Get From Dictionary ${attribute} attributeName - ${attributeValue} Get From Dictionary ${attribute} attributeValue - #将json转换为dict - ${attributeValue} Convert To String ${attributeValue} - ${start} Get Regexp Matches ${attributeValue} ^{\" - ${start1} Get Regexp Matches ${attributeValue} ^{\' - ${len} Get Length ${start} - ${len1} Get Length ${start1} - ${attributeValue} Run Keyword If ${len}>0 Evaluate eval('${attributeValue}') - ... ELSE IF ${len1}>0 Evaluate eval("${attributeValue}") - ... ELSE Set Variable ${attributeValue} - ${type} Run Keyword If ${len}>0 or ${len1}>0 Set Variable dict - ... ELSE Set Variable str - ${attributeValue} Run Keyword If "${attributeType}"=="ip" ManageIpAttributeValue ${attributeValue} ${attributeName} ${type} - ... ELSE IF "${attributeType}"=="signature" ManageSignatureAttributeValue ${attributeValue} ${type} - ... ELSE ManageStringAttributeValue ${attributeValue} ${type} - Set To Dictionary ${attribute} attributeValue=${attributeValue} + ${attributeType} Get From Dictionary ${attribute} attributeType + ${return} ${tableName} Run Keyword And Ignore Error Set Variable ${attribute['tableName']} + ${return} ${protocol} Run Keyword And Ignore Error Set Variable ${attribute['protocol']} + ${attributeName} Get From Dictionary ${attribute} attributeName + ${attributeValue} Get From Dictionary ${attribute} attributeValue + #将json转换为dict + ${attributeValue} Convert To String ${attributeValue} + ${start} Get Regexp Matches ${attributeValue} ^{\" + ${start1} Get Regexp Matches ${attributeValue} ^{\' + ${len} Get Length ${start} + ${len1} Get Length ${start1} + ${attributeValue} Run Keyword If ${len}>0 Evaluate eval('${attributeValue}') + ... ELSE IF ${len1}>0 Evaluate eval("${attributeValue}") + ... ELSE Set Variable ${attributeValue} + ${type} Run Keyword If ${len}>0 or ${len1}>0 Set Variable dict + ... ELSE Set Variable str + ${attributeValue} Run Keyword If "${attributeType}"=="ip" ManageIpAttributeValue ${attributeValue} ${attributeName} ${type} + ... ELSE IF "${attributeType}"=="signature" ManageSignatureAttributeValue ${attributeValue} ${type} + ... ELSE ManageStringAttributeValue ${attributeValue} ${type} + Set To Dictionary ${attribute} attributeValue=${attributeValue} END - Set To Dictionary ${verifyObj} verifySession=${verifySession} - # 转为json结构并返回 - ${json} json.Dumps ${verifyObj} ensure_ascii=False + Set To Dictionary ${verifyObj} verifySession=${verifySession} + # 转为json结构并返回 + ${json} json.Dumps ${verifyObj} ensure_ascii=False Log VerifyPolicy-${json} - [Return] ${json} + [Return] ${json} + ManageIpAttributeValue [Arguments] ${attributeValue} ${attributeName} ${type} Run Keyword And Return If "${type}"=="str" ExtractIpAttributeValue ${attributeValue} ${dict} Create Dictionary - ${return} ${ip} Run Keyword And Ignore Error Set Variable ${attributeValue['ip']} + ${return} ${ip} Run Keyword And Ignore Error Set Variable ${attributeValue['ip']} Run Keyword If "${ip}"=="${EMPTY}" and "${attributeName}"=="source" Should Not Be Empty ${ip} Run Keyword If "${ip}"=="${EMPTY}" and "${attributeName}"=="destination" Should Not Be Empty ${ip} Set To Dictionary ${dict} ip=${ip} @@ -435,19 +422,20 @@ ManageIpAttributeValue Run Keyword If "${port}"=="${EMPTY}" and "${attributeName}"=="source" Should Not Be Empty ${port} Run Keyword If "${port}"=="${EMPTY}" and "${attributeName}"=="destination" Should Not Be Empty ${port} Set To Dictionary ${dict} port=${port} - ${return} ${addrType} Run Keyword And Ignore Error Set Variable ${attributeValue['addrType']} + ${return} ${addrType} Run Keyword And Ignore Error Set Variable ${attributeValue['addrType']} Run Keyword If "${addrType}"=="${EMPTY}" and "${attributeName}"=="source" Should Not Be Empty ${addrType} Run Keyword If "${addrType}"=="${EMPTY}" and "${attributeName}"=="destination" Should Not Be Empty ${addrType} Set To Dictionary ${dict} addrType=${addrType} - ${return} ${protocol} Run Keyword And Ignore Error Set Variable ${attributeValue['protocol']} + ${return} ${protocol} Run Keyword And Ignore Error Set Variable ${attributeValue['protocol']} Run Keyword If "${protocol}"=="${EMPTY}" and "${attributeName}"=="source" Should Not Be Empty ${protocol} Run Keyword If "${protocol}"=="${EMPTY}" and "${attributeName}"=="destination" Should Not Be Empty ${protocol} - Set To Dictionary ${dict} protocol=${protocol} - ${return} ${tableName} Run Keyword And Ignore Error Set Variable ${attributeValue['tableName']} + Set To Dictionary ${dict} protocol=${protocol} + ${return} ${tableName} Run Keyword And Ignore Error Set Variable ${attributeValue['tableName']} Run Keyword If "${tableName}"=="${EMPTY}" and "${attributeName}"=="source" Should Not Be Empty ${tableName} Run Keyword If "${tableName}"=="${EMPTY}" and "${attributeName}"=="destination" Should Not Be Empty ${tableName} Set To Dictionary ${dict} tableName=${tableName} [Return] ${dict} + ExtractIpAttributeValue [Arguments] ${attributeValue} ${list} Split String ${attributeValue} | @@ -456,10 +444,9 @@ ExtractIpAttributeValue ${addrType} Evaluate int(${list}[2]) ${protocol} Set Variable ${list}[3] ${tableName} Set Variable ${list}[4] - ${dict} Create Dictionary ip=${list}[0] port=${list}[1] tableName=${tableName} - ... addrType=${addrType} protocol=${protocol} + ${dict} Create Dictionary ip=${list}[0] port=${list}[1] tableName=${tableName} addrType=${addrType} protocol=${protocol} [Return] ${dict} - + ExtractIpAttributeValue_bak [Arguments] ${attributeValue} ${list} Split String ${attributeValue} | @@ -467,20 +454,21 @@ ExtractIpAttributeValue_bak Should Be Equal As Integers ${len} 4 ${addrType} Evaluate int(${list}[2]) ${protocol} Evaluate int(${list}[3]) - ${dict} Create Dictionary ip=${list}[0] port=${list}[1] - ... addrType=${addrType} protocol=${protocol} + ${dict} Create Dictionary ip=${list}[0] port=${list}[1] addrType=${addrType} protocol=${protocol} [Return] ${dict} + ManageSignatureAttributeValue [Arguments] ${attributeValue} ${type} Run Keyword And Return If "${type}"=="str" ExtractSignatureAttributeValue ${attributeValue} ${dict} Create Dictionary - ${district} Get From Dictionary ${attributeValue} district + ${district} Get From Dictionary ${attributeValue} district Should Not Be Empty ${district} Set To Dictionary ${dict} district=${district} - ${string} Get From Dictionary ${attributeValue} string + ${string} Get From Dictionary ${attributeValue} string Should Not Be Empty ${string} Set To Dictionary ${dict} string=${string} [Return] ${dict} + ExtractSignatureAttributeValue [Arguments] ${attributeValue} ${list} Split String ${attributeValue} | @@ -488,19 +476,20 @@ ExtractSignatureAttributeValue Should Be Equal As Integers ${len} 2 ${dict} Create Dictionary district=${list}[0] string=${list}[1] [Return] ${dict} + ManageStringAttributeValue [Arguments] ${attributeValue} ${type} ${dict} Create Dictionary Run Keyword And Return If "${type}"=="str" Create Dictionary string=${attributeValue} - ${string} Get From Dictionary ${attributeValue} string + ${string} Get From Dictionary ${attributeValue} string Should Not Be Empty ${string} Set To Dictionary ${dict} string=${string} [Return] ${dict} + SortPolicyList - [Documentation] - ... 多策略排序 - ... policyList为数组结构 [Arguments] ${policyList} + [Documentation] 多策略排序 + ... policyList为数组结构 Log Call SortPolicyList ${policyListJson} Set Variable [ FOR ${policyObj} IN @{policyList} @@ -510,22 +499,21 @@ SortPolicyList ${policyListJson}= Replace String Using Regexp ${policyListJson} ,$ ] Log SortPolicyList-${policyListJson} [Return] ${policyListJson} + SortPolicyObject - [Documentation] - ... 策略排序 - ... policyObject为字典结构 - ... policyObject policyId=${policyId} policyType=${policyType} beforePolicyId=${beforePolicyId} afterPolicyId=${afterPolicyId} [Arguments] ${policyObject} + [Documentation] 策略排序 + ... policyObject为字典结构 + ... policyObject policyId=${policyId} policyType=${policyType} beforePolicyId=${beforePolicyId} afterPolicyId=${afterPolicyId} Dictionary Should Contain Key ${policyObject} policyId Dictionary Should Contain Key ${policyObject} policyType ${policyId} Get From Dictionary ${policyObject} policyId Run Keyword If "${policyId}"=="${EMPTY}" Should Not Be Empty ${policyId} - ${policyType} Get From Dictionary ${policyObject} policyType - Should Not Be Empty ${policyType} - ${return} ${beforePolicyId} Run Keyword And Ignore Error Get From Dictionary ${policyObject} beforePolicyId - ${return1} ${afterPolicyId} Run Keyword And Ignore Error Get From Dictionary ${policyObject} afterPolicyId - Run Keyword If "${return}"=="FAIL" and "${return1}"=="FAIL" Fail beforePolicyId和 afterPolicyId必须设置一个! - Run Keyword If "${return}"=="PASS" and "${return1}"=="PASS" and "${beforePolicyId}"=="${EMPTY}" and "${afterPolicyId}"=="${EMPTY}" - ... Fail beforePolicyId和 afterPolicyId不能同时为空! + ${policyType} Get From Dictionary ${policyObject} policyType + Should Not Be Empty ${policyType} + ${return} ${beforePolicyId} Run Keyword And Ignore Error Get From Dictionary ${policyObject} beforePolicyId + ${return1} ${afterPolicyId} Run Keyword And Ignore Error Get From Dictionary ${policyObject} afterPolicyId + Run Keyword If "${return}"=="FAIL" and "${return1}"=="FAIL" Fail beforePolicyId和 afterPolicyId必须设置一个! + Run Keyword If "${return}"=="PASS" and "${return1}"=="PASS" and "${beforePolicyId}"=="${EMPTY}" and "${afterPolicyId}"=="${EMPTY}" Fail beforePolicyId和 afterPolicyId不能同时为空! ${json} json.Dumps ${policyObject} ensure_ascii=False - [Return] ${json} \ No newline at end of file + [Return] ${json} diff --git a/05-Other/curl/command/ProxyPolicy_allow_00005.bat b/05-Other/curl/command/ProxyPolicy_allow_00005.bat index f99780f..86740c6 100644 --- a/05-Other/curl/command/ProxyPolicy_allow_00005.bat +++ b/05-Other/curl/command/ProxyPolicy_allow_00005.bat @@ -1 +1 @@ -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.motel6.com/#/home | iconv -f utf-8 -t gbk \ No newline at end of file +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://boutiquehotel.me/paris/ | iconv -f utf-8 -t gbk \ No newline at end of file diff --git a/05-Other/curl/command/ProxyPolicy_allow_00014.bat b/05-Other/curl/command/ProxyPolicy_allow_00014.bat index 3bac3cf..615ca8c 100644 --- a/05-Other/curl/command/ProxyPolicy_allow_00014.bat +++ b/05-Other/curl/command/ProxyPolicy_allow_00014.bat @@ -1 +1 @@ -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" --cookie "__cfduid=d5c21129d57e7124b729fd86dc82abdcd1596020306; __stripe_sid=2940d4d5-6822-4daf-8b38-9cd18d745beb; __stripe_mid=dd118cd8-845c-4b6e-98ce-81e8d5bdd52c" --referer 'https://www.baidu.com/' \ https://www.sutori.com/teachers | iconv -f utf-8 -t gbk \ No newline at end of file +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" --cookie "__cfduid=d5c21129d57e7124b729fd86dc82abdcd1596020306; __stripe_sid=2940d4d5-6822-4daf-8b38-9cd18d745beb; __stripe_mid=dd118cd8-845c-4b6e-98ce-81e8d5bdd52c" --referer 'https://www.baidu.com/' \ https://www.orbitz.com/Flights | iconv -f utf-8 -t gbk \ No newline at end of file diff --git a/05-Other/curl/command/ProxyPolicy_redirect_00008.bat b/05-Other/curl/command/ProxyPolicy_redirect_00008.bat index cbc54a8..910da8b 100644 --- a/05-Other/curl/command/ProxyPolicy_redirect_00008.bat +++ b/05-Other/curl/command/ProxyPolicy_redirect_00008.bat @@ -1 +1 @@ -curl http://www.essence.com.cn/business/fixed | iconv -f utf-8 -t gbk \ No newline at end of file +curl -kv http://www.essence.com.cn/business/fixed | iconv -f utf-8 -t gbk \ No newline at end of file diff --git a/05-Other/curl/command/ProxyPolicy_redirect_00009.bat b/05-Other/curl/command/ProxyPolicy_redirect_00009.bat index a525e14..9ea9d00 100644 --- a/05-Other/curl/command/ProxyPolicy_redirect_00009.bat +++ b/05-Other/curl/command/ProxyPolicy_redirect_00009.bat @@ -1 +1 @@ -curl http://www.west95582.com/jdw/index.html | iconv -f utf-8 -t gbk \ No newline at end of file +curl -kv http://www.west95582.com/jdw/index.html | iconv -f utf-8 -t gbk \ No newline at end of file diff --git a/05-Other/curl/command/ProxyPolicy_redirect_00010.bat b/05-Other/curl/command/ProxyPolicy_redirect_00010.bat index bd4cabb..82424e1 100644 --- a/05-Other/curl/command/ProxyPolicy_redirect_00010.bat +++ b/05-Other/curl/command/ProxyPolicy_redirect_00010.bat @@ -1 +1 @@ -curl http://www.hazq.com/main/aboutus/index.shtml | iconv -f utf-8 -t gbk \ No newline at end of file +curl -kv http://www.hazq.com/main/aboutus/index.shtml | iconv -f utf-8 -t gbk \ No newline at end of file diff --git a/05-Other/curl/command/ProxyPolicy_redirect_00011.bat b/05-Other/curl/command/ProxyPolicy_redirect_00011.bat index f003276..1c2448c 100644 --- a/05-Other/curl/command/ProxyPolicy_redirect_00011.bat +++ b/05-Other/curl/command/ProxyPolicy_redirect_00011.bat @@ -1 +1 @@ -curl http://www.cs.ecitic.com/newsite/business/bank/tzyh_ywjs/| iconv -f utf-8 -t gbk \ No newline at end of file +curl -kv http://www.cs.ecitic.com/newsite/business/bank/tzyh_ywjs/| iconv -f utf-8 -t gbk \ No newline at end of file diff --git a/05-Other/curl/command/ProxyPolicy_redirect_00014.bat b/05-Other/curl/command/ProxyPolicy_redirect_00014.bat index e825448..13782c4 100644 --- a/05-Other/curl/command/ProxyPolicy_redirect_00014.bat +++ b/05-Other/curl/command/ProxyPolicy_redirect_00014.bat @@ -1 +1 @@ -curl -H "Content-Type:application/x-www-form-urlencoded" -X POST -d "reqBody=lksdf&setCookie=kjhsxbn&contentType=content-type&resBody=opijn" http://open.node.com/action | iconv -f utf-8 -t gbk \ No newline at end of file +curl -H "Content-Type:application/x-www-form-urlencoded" -X POST -d "reqBody=lksdf&setCookie=kjhsxbn&contentType=content-type&resBody=opijn" -kv http://open.node.com/action | iconv -f utf-8 -t gbk \ No newline at end of file diff --git a/05-Other/curl/command/ProxyPolicy_replace_00008.bat b/05-Other/curl/command/ProxyPolicy_replace_00008.bat index 658817d..84e04cb 100644 --- a/05-Other/curl/command/ProxyPolicy_replace_00008.bat +++ b/05-Other/curl/command/ProxyPolicy_replace_00008.bat @@ -1 +1 @@ -curl http://www.ghzq.com.cn/ghzq/index.html | iconv -f utf-8 -t gbk \ No newline at end of file +curl -kv http://www.ghzq.com.cn/ghzq/index.html | iconv -f utf-8 -t gbk \ No newline at end of file diff --git a/05-Other/curl/command/ProxyPolicy_replace_00009.bat b/05-Other/curl/command/ProxyPolicy_replace_00009.bat index e093920..d57491d 100644 --- a/05-Other/curl/command/ProxyPolicy_replace_00009.bat +++ b/05-Other/curl/command/ProxyPolicy_replace_00009.bat @@ -1 +1 @@ -curl http://www.zts.com.cn/consult/consult.aspx| iconv -f utf-8 -t gbk \ No newline at end of file +curl -kv http://www.zts.com.cn/consult/consult.aspx| iconv -f utf-8 -t gbk \ No newline at end of file diff --git a/05-Other/curl/command/ProxyPolicy_replace_00010.bat b/05-Other/curl/command/ProxyPolicy_replace_00010.bat index 147e15b..989ad4e 100644 --- a/05-Other/curl/command/ProxyPolicy_replace_00010.bat +++ b/05-Other/curl/command/ProxyPolicy_replace_00010.bat @@ -1 +1 @@ -curl -H "Content-Type:application/x-www-form-urlencoded" -X POST -d "reqBody=hello&setCookie=hjbnm&contentType=content-type&resBody=05691" -kv http://open.node.com/action | iconv -f utf-8 -t gbk \ No newline at end of file +curl -H "Content-Type:application/x-www-form-urlencoded" -X POST -d "reqBody=hello&setCookie=hjbnm&contentType=text/html&resBody=05691" -kv http://open.node.com/action | iconv -f utf-8 -t gbk \ No newline at end of file diff --git a/05-Other/curl/command/ProxyPolicy_replace_00011.bat b/05-Other/curl/command/ProxyPolicy_replace_00011.bat index 7cf676e..cd76886 100644 --- a/05-Other/curl/command/ProxyPolicy_replace_00011.bat +++ b/05-Other/curl/command/ProxyPolicy_replace_00011.bat @@ -1 +1 @@ -curl http://www.shfe.com.cn/products/au/ | iconv -f utf-8 -t gbk \ No newline at end of file +curl -kv http://www.shfe.com.cn/products/au/ | iconv -f utf-8 -t gbk \ No newline at end of file