diff --git a/01-TestCase/tsg_adc/multi_step/a_Allow_Http_Tests.robot b/01-TestCase/tsg_adc/multi_step/a_Allow_Http_Tests.robot new file mode 100644 index 0000000..043e9a2 --- /dev/null +++ b/01-TestCase/tsg_adc/multi_step/a_Allow_Http_Tests.robot @@ -0,0 +1,34 @@ +*** Settings *** +Force Tags tsg_adc_wp adc_api security_policy +Library OperatingSystem +Resource ../../../02-Keyword/tsg_adc/SystemCommand.robot +Resource ../../../02-Keyword/tsg_bfapi/PolicyObject.robot +Resource ../../../02-Keyword/tsg_bfapi/LogVariable.robot +Resource ../../../02-Keyword/tsg_adc/FileOperation.robot +Resource ../../../02-Keyword/tsg_adc/FileOperation.robot +Resource ../../../02-Keyword/tsg_bfapi/policy_object/Policy.robot + +*** Test Cases *** +SecurityPolicy-Allow-Http-00001 + [Tags] fqdn + Comment 创建fqdn + ${objectDict} Create Dictionary objectType=fqdn isValid=${1} addItemList=*clintonairport.com + ${rescode} ${objectId} AddObject2 ${1} ${objectDict} + Comment 创建安全策略 + ${policyDict} Create Dictionary policyName=SecurityPolicy-Allow-Http-00001 policyType=tsg_security policyDesc=autotest action=allow userRegion={"protocol":"HTTP"} filterList=${objectId}|TSG_FIELD_HTTP_HOST isValid=${1} appIdObjects=2 + log ${policyDict} + ${rescode} ${policyId} AddPolicies 1 ${policyDict} v2 + insert_policyId_to_file1 allow_http_objectId ${objectId} + insert_policyId_to_file1 allow_http_policyId ${policyId} + +SecurityPolicy-Allow-Http-00002 + [Tags] cat + Comment 创建fqdn + ${objectDict} Create Dictionary objectType=fqdn_category isValid=${1} addItemList=$www.airpano.com + ${rescode} ${objectId} AddObject2 ${1} ${objectDict} + Comment 创建安全策略 + ${policyDict} Create Dictionary policyName=SecurityPolicy-Allow-Http-00002 policyType=tsg_security policyDesc=autotest action=allow userRegion={"protocol":"HTTP"} filterList=${objectId}|TSG_FIELD_HTTP_HOST isValid=${1} appIdObjects=2 + log ${policyDict} + ${rescode} ${policyId} AddPolicies 1 ${policyDict} v2 + insert_policyId_to_file1 allow_http_objectId1 ${objectId} + insert_policyId_to_file1 allow_http_policyId1 ${policyId} diff --git a/01-TestCase/tsg_adc/multi_step/a_Allow_Ssl_Tests.robot b/01-TestCase/tsg_adc/multi_step/a_Allow_Ssl_Tests.robot new file mode 100644 index 0000000..c5a8c9f --- /dev/null +++ b/01-TestCase/tsg_adc/multi_step/a_Allow_Ssl_Tests.robot @@ -0,0 +1,34 @@ +*** Settings *** +Force Tags tsg_adc_wp adc_api security_policy +Library OperatingSystem +Resource ../../../02-Keyword/tsg_adc/SystemCommand.robot +Resource ../../../02-Keyword/tsg_bfapi/PolicyObject.robot +Resource ../../../02-Keyword/tsg_bfapi/LogVariable.robot +Resource ../../../02-Keyword/tsg_adc/FileOperation.robot +Resource ../../../02-Keyword/tsg_adc/FileOperation.robot +Resource ../../../02-Keyword/tsg_bfapi/policy_object/Policy.robot + +*** Test Cases *** +SecurityPolicy-Allow-Ssl-00001 + [Tags] fqdn + Comment 创建fqdn + ${objectDict} Create Dictionary objectType=fqdn isValid=${1} addItemList=$ok.ru + ${rescode} ${objectId} AddObject2 ${1} ${objectDict} + Comment 创建安全策略 + ${policyDict} Create Dictionary policyName=SecurityPolicy-Allow-Ssl-00001 policyType=tsg_security policyDesc=autotest action=allow userRegion={"protocol":"SSL"} filterList=${objectId}|TSG_FIELD_SSL_SNI isValid=${1} appIdObjects=3 + log ${policyDict} + ${rescode} ${policyId} AddPolicies 1 ${policyDict} v2 + insert_policyId_to_file1 allow_ssl_objectId ${objectId} + insert_policyId_to_file1 allow_ssl_policyId ${policyId} + +SecurityPolicy-Allow-Ssl-00002 + [Tags] cat + Comment 创建cat + ${objectDict} Create Dictionary objectType=fqdn_category isValid=${1} addItemList=*youtube.com + ${rescode} ${objectId} AddObject2 ${1} ${objectDict} + Comment 创建安全策略 + ${policyDict} Create Dictionary policyName=SecurityPolicy-Allow-Ssl-00002 policyType=tsg_security policyDesc=autotest action=allow userRegion={"protocol":"SSL"} filterList=${objectId}|TSG_FIELD_SSL_SNI isValid=${1} appIdObjects=3 + log ${policyDict} + ${rescode} ${policyId} AddPolicies 1 ${policyDict} v2 + insert_policyId_to_file1 allow_ssl_objectId1 ${objectId} + insert_policyId_to_file1 allow_ssl_policyId1 ${policyId} diff --git a/01-TestCase/tsg_adc/multi_step/a_Deny_Ftp_Tests.robot b/01-TestCase/tsg_adc/multi_step/a_Deny_Ftp_Tests.robot index f820304..5403217 100644 --- a/01-TestCase/tsg_adc/multi_step/a_Deny_Ftp_Tests.robot +++ b/01-TestCase/tsg_adc/multi_step/a_Deny_Ftp_Tests.robot @@ -10,15 +10,15 @@ Resource ../../../02-Keyword/tsg_bfapi/policy_object/Policy.robot *** Test Cases *** SecurityPolicy-Deny-Ftp-00001 - [Tags] 子串匹配 + [Tags] 右匹配 Comment 创建Account - ${objectDict} Create Dictionary objectType=account isValid=${1} addItemList=ftp_user + ${objectDict} Create Dictionary objectType=account isValid=${1} addItemList=*user ${rescode} ${object_Account_Id} AddObject2 ${1} ${objectDict} Comment 创建url - ${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=123456.txt + ${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=*123456.txt ${rescode} ${object_url_Id} AddObject2 ${1} ${objectDict} Comment 创建content - ${objectDict} Create Dictionary objectType=keywords isValid=${1} addItemList=пациен + ${objectDict} Create Dictionary objectType=keywords isValid=${1} addItemList=*уровня. ${rescode} ${object_content_Id} AddObject2 ${1} ${objectDict} Comment 创建安全策略 ${policyDict} Create Dictionary policyName=SecurityPolicy-Deny-FTP-00001 policyType=tsg_security policyDesc=autotest action=deny userRegion={"protocol":"FTP","method":"drop"} filterList=${object_Account_Id}|TSG_FIELD_FTP_ACCOUNT,${object_content_Id}|TSG_FIELD_FTP_CONTENT,${object_url_Id}|TSG_FIELD_FTP_URI isValid=${1} appIdObjects=6 @@ -29,15 +29,15 @@ SecurityPolicy-Deny-Ftp-00001 insert_policyId_to_file1 deny_ftp_policyId ${policyId} SecurityPolicy-Deny-Ftp-00002 - [Tags] 右匹配 + [Tags] 字串匹配 Comment 创建Account - ${objectDict} Create Dictionary objectType=account isValid=${1} addItemList=*user + ${objectDict} Create Dictionary objectType=account isValid=${1} addItemList=user ${rescode} ${object_Account_Id} AddObject2 ${1} ${objectDict} Comment 创建url - ${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=*est.txt + ${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=est.txt ${rescode} ${object_url_Id} AddObject2 ${1} ${objectDict} Comment 创建content - ${objectDict} Create Dictionary objectType=keywords isValid=${1} addItemList=*st.txt + ${objectDict} Create Dictionary objectType=keywords isValid=${1} addItemList=st.txt ${rescode} ${object_content_Id} AddObject2 ${1} ${objectDict} Comment 创建安全策略 ${policyDict} Create Dictionary policyName=SecurityPolicy-Deny-FTP-00002 policyType=tsg_security policyDesc=autotest action=deny userRegion={"protocol":"FTP","method":"drop"} filterList=${object_Account_Id}|TSG_FIELD_FTP_ACCOUNT,${object_content_Id}|TSG_FIELD_FTP_CONTENT,${object_url_Id}|TSG_FIELD_FTP_URI isValid=${1} appIdObjects=6 diff --git a/01-TestCase/tsg_adc/multi_step/b_Allow_Http_Tests.robot b/01-TestCase/tsg_adc/multi_step/b_Allow_Http_Tests.robot new file mode 100644 index 0000000..7457446 --- /dev/null +++ b/01-TestCase/tsg_adc/multi_step/b_Allow_Http_Tests.robot @@ -0,0 +1,36 @@ +*** Settings *** +Force Tags tsg_adc_wp security_policy adc_verify +Library OperatingSystem +Resource ../../../02-Keyword/tsg_adc/SystemCommand.robot +Resource ../../../02-Keyword/tsg_bfapi/PolicyObject.robot +Resource ../../../02-Keyword/tsg_bfapi/LogVariable.robot +Resource ../../../02-Keyword/tsg_adc/FileOperation.robot + +*** Test Cases *** +SecurityPolicy-Allow-Http-00001 + [Tags] fqdn + Comment 功能端验证HTTP验证 + ${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/SecurityPolicy_Allow_HTTP_00001.bat + ... ELSE set variable curl \ http://clintonairport.com/airlines-flights/covid/ + ${stringlist} run keyword if '${systemType}'=='Windows' Create List COVID + ... ELSE Create List COVID + ${starttime} Get Time + Sleep ${policyVerificationSleepSeconds}s + ${rescode} SystemCommands ${commandstr} ${stringlist} + Sleep ${policyLogVerificationSleepSeconds}s + ${endtime} Get Time + insert_time_to_file1 allow_http_starttime ${starttime} allow_http_endtime ${endtime} + +SecurityPolicy-Allow-Http-00002 + [Tags] cat + Comment 功能端验证HTTP验证 + ${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/SecurityPolicy_Allow_HTTP_00002.bat + ... ELSE set variable curl http://www.airpano.com/360photo_list.php + ${stringlist} run keyword if '${systemType}'=='Windows' Create List 360° Photo + ... ELSE Create List 360° Photo + ${starttime} Get Time + Sleep ${policyVerificationSleepSeconds}s + ${rescode} SystemCommands ${commandstr} ${stringlist} + Sleep ${policyLogVerificationSleepSeconds}s + ${endtime} Get Time + insert_time_to_file1 allow_http_starttime1 ${starttime} allow_http_endtime1 ${endtime} diff --git a/01-TestCase/tsg_adc/multi_step/b_Allow_Ssl_Tests.robot b/01-TestCase/tsg_adc/multi_step/b_Allow_Ssl_Tests.robot new file mode 100644 index 0000000..16c5f12 --- /dev/null +++ b/01-TestCase/tsg_adc/multi_step/b_Allow_Ssl_Tests.robot @@ -0,0 +1,36 @@ +*** Settings *** +Force Tags tsg_adc_wp security_policy adc_verify +Library OperatingSystem +Resource ../../../02-Keyword/tsg_adc/SystemCommand.robot +Resource ../../../02-Keyword/tsg_bfapi/PolicyObject.robot +Resource ../../../02-Keyword/tsg_bfapi/LogVariable.robot +Resource ../../../02-Keyword/tsg_adc/FileOperation.robot + +*** Test Cases *** +SecurityPolicy-Allow-Ssl-00001 + [Tags] fqdn + Comment 功能端验证HTTP验证 + ${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/SecurityPolicy_Allow_SSL_00001.bat + ... ELSE set variable curl https://ok.ru/ + ${stringlist} run keyword if '${systemType}'=='Windows' Create List Popular on OK.RU + ... ELSE Create List Popular on OK.RU + ${starttime} Get Time + Sleep ${policyVerificationSleepSeconds}s + ${rescode} SystemCommands ${commandstr} ${stringlist} + Sleep ${policyLogVerificationSleepSeconds}s + ${endtime} Get Time + insert_time_to_file1 allow_ssl_starttime ${starttime} allow_ssl_endtime ${endtime} + +SecurityPolicy-Allow-Ssl-00002 + [Tags] cat + Comment 功能端验证HTTP验证 + ${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/SecurityPolicy_Allow_SSL_00002.bat + ... ELSE set variable curl https://www.youtube.com/ + ${stringlist} run keyword if '${systemType}'=='Windows' Create List 推荐视频 + ... ELSE Create List 推荐视频 + ${starttime} Get Time + Sleep ${policyVerificationSleepSeconds}s + ${rescode} SystemCommands ${commandstr} ${stringlist} + Sleep ${policyLogVerificationSleepSeconds}s + ${endtime} Get Time + insert_time_to_file1 allow_ssl_starttime1 ${starttime} allow_ssl_endtime1 ${endtime} diff --git a/01-TestCase/tsg_adc/multi_step/c_Allow_Http_Tests.robot b/01-TestCase/tsg_adc/multi_step/c_Allow_Http_Tests.robot new file mode 100644 index 0000000..31dc806 --- /dev/null +++ b/01-TestCase/tsg_adc/multi_step/c_Allow_Http_Tests.robot @@ -0,0 +1,33 @@ +*** Settings *** +Test Teardown DeletePolicyAndObject ${policyIds} ${objectids} +Force Tags tsg_adc_wp adc_log security_policy +Library OperatingSystem +Resource ../../../02-Keyword/tsg_adc/SystemCommand.robot +Resource ../../../02-Keyword/tsg_bfapi/PolicyObject.robot +Resource ../../../02-Keyword/tsg_bfapi/LogVariable.robot +Resource ../../../05-Other/AllFlowCaseVariable.txt +Resource ../../../02-Keyword/tsg_adc/FileOperation.robot +Resource ../../../05-Other/AllFlowCaseVariable1.txt + +*** Variables *** +${policyIds} ${EMPTY} +${objectids} ${EMPTY} + +*** Test Cases *** +SecurityPolicy-Allow-Http-00001 + [Tags] fqdn + #删除对象 + ${objectids} set Variable ${allow_http_objectId} + #删除策略 + ${policyIds} Create List {"policyType":"tsg_security","policyIds":[${allow_http_policyId}]} + ${s} Convert to String ${allow_http_policyId} + GetLogList security_event_log ${allow_http_starttime} ${allow_http_endtime} ${testClentIP} ${s} http_host clintonairport.com + +SecurityPolicy-Allow-Http-00002 + [Tags] cat + #删除对象 + ${objectids} set Variable ${allow_http_objectId1} + #删除策略 + ${policyIds} Create List {"policyType":"tsg_security","policyIds":[${allow_http_policyId1}]} + ${s} Convert to String ${allow_http_policyId1} + GetLogList security_event_log ${allow_http_starttime1} ${allow_http_endtime1} ${testClentIP} ${s} http_host www.airpano.com diff --git a/01-TestCase/tsg_adc/multi_step/c_Allow_Ssl_Tests.robot b/01-TestCase/tsg_adc/multi_step/c_Allow_Ssl_Tests.robot new file mode 100644 index 0000000..86918b5 --- /dev/null +++ b/01-TestCase/tsg_adc/multi_step/c_Allow_Ssl_Tests.robot @@ -0,0 +1,33 @@ +*** Settings *** +Test Teardown DeletePolicyAndObject ${policyIds} ${objectids} +Force Tags tsg_adc_wp adc_log security_policy +Library OperatingSystem +Resource ../../../02-Keyword/tsg_adc/SystemCommand.robot +Resource ../../../02-Keyword/tsg_bfapi/PolicyObject.robot +Resource ../../../02-Keyword/tsg_bfapi/LogVariable.robot +Resource ../../../05-Other/AllFlowCaseVariable.txt +Resource ../../../02-Keyword/tsg_adc/FileOperation.robot +Resource ../../../05-Other/AllFlowCaseVariable1.txt + +*** Variables *** +${policyIds} ${EMPTY} +${objectids} ${EMPTY} + +*** Test Cases *** +SecurityPolicy-Allow-Ssl-00001 + [Tags] fqdn + #删除对象 + ${objectids} set Variable ${allow_ssl_objectId} + #删除策略 + ${policyIds} Create List {"policyType":"tsg_security","policyIds":[${allow_ssl_policyId}]} + ${s} Convert to String ${allow_ssl_policyId} + GetLogList security_event_log ${allow_ssl_starttime} ${allow_ssl_endtime} ${testClentIP} ${s} ssl_sni ok.ru + +SecurityPolicy-Allow-Ssl-00002 + [Tags] cat + #删除对象 + ${objectids} set Variable ${allow_ssl_objectId1} + #删除策略 + ${policyIds} Create List {"policyType":"tsg_security","policyIds":[${allow_ssl_policyId1}]} + ${s} Convert to String ${allow_ssl_policyId1} + GetLogList security_event_log ${allow_ssl_starttime1} ${allow_ssl_endtime1} ${testClentIP} ${s} ssl_sni youtube.com diff --git a/05-Other/curl/command/SecurityPolicy_Allow_HTTP_00001.bat b/05-Other/curl/command/SecurityPolicy_Allow_HTTP_00001.bat new file mode 100644 index 0000000..8e63b6a --- /dev/null +++ b/05-Other/curl/command/SecurityPolicy_Allow_HTTP_00001.bat @@ -0,0 +1 @@ +curl http://clintonairport.com/airlines-flights/covid/ | iconv -f utf-8 -t gbk \ No newline at end of file diff --git a/05-Other/curl/command/SecurityPolicy_Allow_HTTP_00002.bat b/05-Other/curl/command/SecurityPolicy_Allow_HTTP_00002.bat new file mode 100644 index 0000000..5526983 --- /dev/null +++ b/05-Other/curl/command/SecurityPolicy_Allow_HTTP_00002.bat @@ -0,0 +1 @@ +curl http://www.airpano.com/360photo_list.php | iconv -f utf-8 -t gbk \ No newline at end of file diff --git a/05-Other/curl/command/SecurityPolicy_Allow_SSL_00001.bat b/05-Other/curl/command/SecurityPolicy_Allow_SSL_00001.bat new file mode 100644 index 0000000..cc1b550 --- /dev/null +++ b/05-Other/curl/command/SecurityPolicy_Allow_SSL_00001.bat @@ -0,0 +1 @@ +curl https://ok.ru/ | iconv -f utf-8 -t gbk \ No newline at end of file diff --git a/05-Other/curl/command/SecurityPolicy_Allow_SSL_00002.bat b/05-Other/curl/command/SecurityPolicy_Allow_SSL_00002.bat new file mode 100644 index 0000000..9c53740 --- /dev/null +++ b/05-Other/curl/command/SecurityPolicy_Allow_SSL_00002.bat @@ -0,0 +1 @@ +curl https://www.youtube.com/ | iconv -f utf-8 -t gbk \ No newline at end of file