2020-07-30 19:10:03 +08:00
|
|
|
*** 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_bfapi/policy_object/Policy.robot
|
2021-05-17 09:50:56 +08:00
|
|
|
Resource ../../../03-Variable/ApplicationID.txt
|
2020-07-30 19:10:03 +08:00
|
|
|
|
|
|
|
|
*** Test Cases ***
|
|
|
|
|
SecurityPolicy-Allow-Http-00001
|
2021-05-17 09:50:56 +08:00
|
|
|
[Tags] fqdn right match,whole world match,ip geo,url
|
2020-07-30 19:10:03 +08:00
|
|
|
Comment 创建fqdn
|
2021-05-17 09:50:56 +08:00
|
|
|
${objectDict} Create Dictionary objectType=fqdn isValid=${1} addItemList=*clintonairport.com
|
|
|
|
|
${rescode} ${objectId} AddObject2 ${1} ${objectDict}
|
2021-02-09 15:30:49 +08:00
|
|
|
Comment 创建url
|
2021-05-17 09:50:56 +08:00
|
|
|
${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=$clintonairport.com/airlines-flights/covid/
|
|
|
|
|
${rescode} ${objectId1} AddObject2 ${1} ${objectDict}
|
2021-02-09 15:30:49 +08:00
|
|
|
Comment 创建ip geo
|
|
|
|
|
${addItemList1} Create Dictionary keywordArray=XXG地区.*
|
|
|
|
|
${addItemLists} Create list ${addItemList1}
|
|
|
|
|
${objectDict} Create Dictionary objectType=ip objectSubType=geo_location isValid=${1} addItemList=${addItemLists}
|
|
|
|
|
${rescode} ${objectId2} AddObjects ${1} ${objectDict}
|
|
|
|
|
Comment 创建fqdn2
|
2021-05-17 09:50:56 +08:00
|
|
|
${objectDict} Create Dictionary objectType=fqdn isValid=${1} addItemList=$www.66rpg.com
|
|
|
|
|
${rescode} ${objectId3} AddObject2 ${1} ${objectDict}
|
2021-02-09 15:30:49 +08:00
|
|
|
Comment 创建url2
|
2021-05-17 09:50:56 +08:00
|
|
|
${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=66rpg
|
|
|
|
|
${rescode} ${objectId4} AddObject2 ${1} ${objectDict}
|
2020-07-30 19:10:03 +08:00
|
|
|
Comment 创建安全策略
|
2021-05-17 09:50:56 +08:00
|
|
|
${policyDict} Create Dictionary policyName=SecurityPolicy-Allow-Http-00001 policyType=tsg_security policyDesc=autotest action=allow userRegion={"protocol":"HTTP"} filterList=${objectId}|TSG_FIELD_HTTP_HOST,${objectId1}|TSG_FIELD_HTTP_URL isValid=${1} appIdObjects=${HTTP_ID}
|
2020-07-30 19:10:03 +08:00
|
|
|
log ${policyDict}
|
|
|
|
|
${rescode} ${policyId} AddPolicies 1 ${policyDict} v2
|
2021-02-01 19:16:09 +08:00
|
|
|
${policyId} Get-Pids ${policyId}
|
|
|
|
|
${policyId} Set Variable ${policyId}[0]
|
2020-07-30 19:10:03 +08:00
|
|
|
insert_policyId_to_file1 allow_http_objectId ${objectId}
|
2021-02-09 15:30:49 +08:00
|
|
|
insert_policyId_to_file1 allow_http_objectId2 ${objectId1}
|
|
|
|
|
insert_policyId_to_file1 allow_http_objectId3 ${objectId2}
|
|
|
|
|
insert_policyId_to_file1 allow_http_objectId4 ${objectId3}
|
|
|
|
|
insert_policyId_to_file1 allow_http_objectId5 ${objectId4}
|
2020-07-30 19:10:03 +08:00
|
|
|
insert_policyId_to_file1 allow_http_policyId ${policyId}
|
|
|
|
|
|
|
|
|
|
SecurityPolicy-Allow-Http-00002
|
2021-02-09 15:30:49 +08:00
|
|
|
[Tags] cat,fqdn 完全匹配,url左匹配 update policy:url右匹配
|
2020-07-30 19:10:03 +08:00
|
|
|
Comment 创建fqdn
|
2021-05-17 09:50:56 +08:00
|
|
|
${objectDict} Create Dictionary objectType=fqdn isValid=${1} addItemList=$scoutbahamas.org
|
|
|
|
|
${rescode} ${objectId} AddObject2 ${1} ${objectDict}
|
2021-02-09 15:30:49 +08:00
|
|
|
Comment 创建url
|
2021-05-17 09:50:56 +08:00
|
|
|
${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=scoutbah*
|
|
|
|
|
${rescode} ${objectId1} AddObject2 ${1} ${objectDict}
|
2021-02-09 15:30:49 +08:00
|
|
|
Comment 创建fqdn2
|
2021-05-17 09:50:56 +08:00
|
|
|
${objectDict} Create Dictionary objectType=fqdn isValid=${1} addItemList=*ang5.com
|
|
|
|
|
${rescode} ${objectId2} AddObject2 ${1} ${objectDict}
|
2021-02-09 15:30:49 +08:00
|
|
|
Comment 创建url2
|
2021-05-17 09:50:56 +08:00
|
|
|
${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=*w.xiang5.com/
|
|
|
|
|
${rescode} ${objectId3} AddObject2 ${1} ${objectDict}
|
2020-07-30 19:10:03 +08:00
|
|
|
Comment 创建安全策略
|
2021-05-17 09:50:56 +08:00
|
|
|
${policyDict} Create Dictionary policyName=SecurityPolicy-Allow-Http-00002 policyType=tsg_security policyDesc=autotest action=allow userRegion={"protocol":"HTTP"} filterList=109|TSG_FIELD_HTTP_HOST,${objectId}|TSG_FIELD_HTTP_HOST,${objectId1}|TSG_FIELD_HTTP_URL isValid=${1} appIdObjects=${HTTP_ID}
|
2020-07-30 19:10:03 +08:00
|
|
|
log ${policyDict}
|
|
|
|
|
${rescode} ${policyId} AddPolicies 1 ${policyDict} v2
|
2021-02-01 19:16:09 +08:00
|
|
|
${policyId} Get-Pids ${policyId}
|
|
|
|
|
${policyId} Set Variable ${policyId}[0]
|
2021-02-09 15:30:49 +08:00
|
|
|
insert_policyId_to_file1 allow_http_objectId1 ${objectId}
|
|
|
|
|
insert_policyId_to_file1 allow_http_objectId6 ${objectId1}
|
|
|
|
|
insert_policyId_to_file1 allow_http_objectId7 ${objectId2}
|
|
|
|
|
insert_policyId_to_file1 allow_http_objectId8 ${objectId3}
|
2020-08-18 09:32:49 +08:00
|
|
|
insert_policyId_to_file1 allow_http_policyId1 ${policyId}
|
2021-03-01 09:08:49 +08:00
|
|
|
|
|
|
|
|
SecurityPolicy-Allow-Http-00003
|
|
|
|
|
[Tags] the minimum match
|
|
|
|
|
Comment 与allow00002组合验证筛选条件优先级
|
|
|
|
|
Comment 创建安全策略
|
|
|
|
|
${policyDict} Create Dictionary policyName=SecurityPolicy-Allow-Http-00003 policyType=tsg_security policyDesc=autotest action=allow userRegion={"protocol":"HTTP"} isValid=${0} appIdObjects=${HTTP_ID}
|
|
|
|
|
log ${policyDict}
|
|
|
|
|
${rescode} ${policyId} AddPolicies 1 ${policyDict} v2
|
|
|
|
|
${policyId} Get-Pids ${policyId}
|
|
|
|
|
${policyId} Set Variable ${policyId}[0]
|
2021-05-17 09:50:56 +08:00
|
|
|
insert_policyId_to_file1 allow_http_policyId2 ${policyId}
|
2021-03-01 09:08:49 +08:00
|
|
|
|
2020-08-18 09:32:49 +08:00
|
|
|
|