安全策略allow动作测试用例,由于环境问题未进行功能验证

This commit is contained in:
jwc
2020-07-02 19:23:58 +08:00
parent d6dcf9d60c
commit cfb8cfe1b9
11 changed files with 218 additions and 8 deletions

View File

@@ -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}

View File

@@ -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}

View File

@@ -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

View File

@@ -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}

View File

@@ -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}

View File

@@ -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

View File

@@ -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

View File

@@ -0,0 +1 @@
curl http://clintonairport.com/airlines-flights/covid/ | iconv -f utf-8 -t gbk

View File

@@ -0,0 +1 @@
curl http://www.airpano.com/360photo_list.php | iconv -f utf-8 -t gbk

View File

@@ -0,0 +1 @@
curl https://ok.ru/ | iconv -f utf-8 -t gbk

View File

@@ -0,0 +1 @@
curl https://www.youtube.com/ | iconv -f utf-8 -t gbk