2020-07-02 19:23:58 +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 13:24:29 +06:00
|
|
|
|
2020-07-02 19:23:58 +08:00
|
|
|
|
2021-02-01 19:16:09 +08:00
|
|
|
|
2020-07-02 19:23:58 +08:00
|
|
|
*** Test Cases ***
|
|
|
|
|
SecurityPolicy-Allow-Ssl-00001
|
2021-02-09 15:30:49 +08:00
|
|
|
[Tags] fqdn完整匹配 update policy:ip geo
|
2020-07-02 19:23:58 +08:00
|
|
|
Comment 创建fqdn
|
2021-05-17 13:24:29 +06:00
|
|
|
${addItemList1} Create Dictionary keywordArray=$homebank.kz isHexbin=${0}
|
|
|
|
|
${addItemLists} Create list ${addItemList1}
|
|
|
|
|
${objectDict} Create Dictionary objectType=fqdn objectSubType=fqdn isValid=${1} addItemList=${addItemLists}
|
|
|
|
|
${rescode} ${objectId} AddObjects ${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} ${objectId1} AddObjects ${1} ${objectDict}
|
2020-07-02 19:23:58 +08:00
|
|
|
Comment 创建安全策略
|
2020-09-07 19:23:55 +08:00
|
|
|
${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=${SSL_ID}
|
2020-07-02 19:23:58 +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-02 19:23:58 +08:00
|
|
|
insert_policyId_to_file1 allow_ssl_objectId ${objectId}
|
2021-02-09 15:30:49 +08:00
|
|
|
insert_policyId_to_file1 allow_ssl_objectId2 ${objectId1}
|
2020-07-02 19:23:58 +08:00
|
|
|
insert_policyId_to_file1 allow_ssl_policyId ${policyId}
|
|
|
|
|
|
|
|
|
|
SecurityPolicy-Allow-Ssl-00002
|
2021-02-09 15:30:49 +08:00
|
|
|
[Tags] cat右匹配 update policy:fqdn
|
2021-02-08 18:33:51 +08:00
|
|
|
Comment 创建fqdn
|
2021-05-17 13:24:29 +06:00
|
|
|
${addItemList1} Create Dictionary keywordArray=*prontomail.com isHexbin=${0}
|
|
|
|
|
${addItemLists} Create list ${addItemList1}
|
|
|
|
|
${objectDict} Create Dictionary objectType=fqdn objectSubType=fqdn isValid=${1} addItemList=${addItemLists}
|
|
|
|
|
${rescode} ${objectId} AddObjects ${1} ${objectDict}
|
2021-02-09 15:30:49 +08:00
|
|
|
Comment 创建fqdn2
|
2021-05-17 13:24:29 +06:00
|
|
|
${addItemList1} Create Dictionary keywordArray=$xinyue.qq.com isHexbin=${0}
|
|
|
|
|
${addItemLists} Create list ${addItemList1}
|
|
|
|
|
${objectDict} Create Dictionary objectType=fqdn objectSubType=fqdn isValid=${1} addItemList=${addItemLists}
|
|
|
|
|
${rescode} ${objectId1} AddObjects ${1} ${objectDict}
|
|
|
|
|
Comment 创建categories
|
|
|
|
|
${addItemList1} Create Dictionary fqdn=*protonmail.com
|
|
|
|
|
${addItemLists} Create list ${addItemList1}
|
|
|
|
|
${objectDict} Create Dictionary categoryType=fqdn categoryName=youxiang objectSubType=category isValid=${1} fqdnList=${addItemLists}
|
|
|
|
|
${rescode} ${categoryObjId} ${categoryId} AddCategories ${1} ${objectDict} add 200
|
2020-07-02 19:23:58 +08:00
|
|
|
Comment 创建安全策略
|
2021-05-17 13:24:29 +06:00
|
|
|
${policyDict} Create Dictionary policyName=SecurityPolicy-Allow-Ssl-00002 policyType=tsg_security policyDesc=autotest action=allow userRegion={"protocol":"SSL"} filterList=${objectId}|TSG_FIELD_SSL_SNI,${categoryObjId}|TSG_FIELD_SSL_SNI isValid=${1} appIdObjects=${SSL_ID}
|
2020-07-02 19:23:58 +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-08 18:33:51 +08:00
|
|
|
insert_policyId_to_file1 allow_ssl_objectId1 ${objectId}
|
2021-02-09 15:30:49 +08:00
|
|
|
insert_policyId_to_file1 allow_ssl_objectId3 ${objectId1}
|
2020-07-02 19:23:58 +08:00
|
|
|
insert_policyId_to_file1 allow_ssl_policyId1 ${policyId}
|
2021-05-17 13:24:29 +06:00
|
|
|
insert_policyId_to_file1 allow_ssl_categoryId ${categoryId}
|
2021-03-01 09:08:49 +08:00
|
|
|
|
|
|
|
|
SecurityPolicy-Allow-Ssl-00003
|
|
|
|
|
[Tags] the minimum match
|
|
|
|
|
Comment 创建安全策略
|
|
|
|
|
${policyDict} Create Dictionary policyName=SecurityPolicy-Allow-Ssl-00003 policyType=tsg_security policyDesc=autotest action=allow userRegion={"protocol":"SSL"} isValid=${0} appIdObjects=${SSL_ID}
|
|
|
|
|
log ${policyDict}
|
|
|
|
|
${rescode} ${policyId} AddPolicies 1 ${policyDict} v2
|
|
|
|
|
${policyId} Get-Pids ${policyId}
|
|
|
|
|
${policyId} Set Variable ${policyId}[0]
|
|
|
|
|
insert_policyId_to_file1 allow_ssl_policyId2 ${policyId}
|
|
|
|
|
|
2021-03-05 11:37:54 +08:00
|
|
|
|