This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
dongxiaoyan-tsg-autotest/01-TestCase/tsg_bfapi/policy_object/PolicyObjectTests.robot

125 lines
6.6 KiB
Plaintext
Raw Normal View History

*** Settings ***
Test Teardown DeletePolicyAndObject ${policyIds} ${objectIds}
Resource ../../../02-Keyword/tsg_bfapi/PolicyObject.robot
Resource ../../../02-Keyword/tsg_bfapi/policy_object/Policy.robot
*** Test Cases ***
Policy-Get-v1-00001
${policy} Create Dictionary policyType=tsg_security action=deny
... pageNo=1 pageSize=10
${rescode} ${response} QueryPolicies ${policy} v1
${policyIds} Create List
${objectIds} Set Variable ${EMPTY}
Log ${rescode} ${response}
Policy-Get-v2-00001
${policy} Create Dictionary policyType=tsg_security action=deny
... pageNo=1 pageSize=10
${rescode} ${response} QueryPolicies ${policy} v2
${policyIds} Create List
${objectIds} Set Variable ${EMPTY}
Log ${rescode} ${response}
Policy-Post-v1-00001
${policy} Create Dictionary policyId=1 policyType=tsg_security
... policyName=wx-policyName1 action=allow doBlacklist=0
... doLog=0 isValid=1 effectiveRange={}
... userRegion={"protocol":"HTTP","traffic_forward":{"enable":1}}
${objectIds} Set Variable ${EMPTY}
${rescode} ${policyIds} AddPolicies 1 ${policy} v1
Log ${rescode} ${policyIds} ${objectIds}
Policy-Post-v2-00001
${policy} Create Dictionary policyId=1 policyType=tsg_security
... policyName=wx-policyName1 action=allow doBlacklist=0
... doLog=0 isValid=1 effectiveRange={}
... userRegion={"protocol":"HTTP","traffic_forward":{"enable":1}}
${objectIds} Set Variable ${EMPTY}
${rescode} ${policyIds} AddPolicies 1 ${policy} v2
Log ${rescode} ${policyIds} ${objectIds}
Policy-Post-v1-00002
${policy} Create Dictionary policyId=1 policyType=tsg_security
... policyName=wx-policyName1 action=allow doBlacklist=0
... doLog=0 isValid=1 effectiveRange={}
... userRegion={"protocol":"HTTP","traffic_forward":{"enable":1}}
${policy1} Create Dictionary policyId=2 policyType=tsg_security
... policyName=wx-policyName2 action=allow doBlacklist=0
... doLog=0 isValid=1
... userRegion={"protocol":"HTTP","traffic_forward":{"enable":1}}
${policy2} Create Dictionary policyId=3 policyType=tsg_security
... policyName=wx-policyName3 action=allow doBlacklist=0
... doLog=0 isValid=0
... userRegion={"protocol":"HTTP","traffic_forward":{"enable":1}}
${objectIds} Set Variable ${EMPTY}
@{policyList} Create List ${policy} ${policy1} ${policy2}
${rescode} ${policyIds} AddPolicies 1 ${policyList} v1
Log ${rescode} ${policyIds} ${objectIds}
Policy-Post-v2-00002
${policy} Create Dictionary policyId=1 policyType=tsg_security
... policyName=wx-policyName1 action=allow doBlacklist=0
... doLog=0 isValid=1 effectiveRange={}
... userRegion={"protocol":"HTTP","traffic_forward":{"enable":1}}
${policy1} Create Dictionary policyId=2 policyType=tsg_security
... policyName=wx-policyName2 action=allow doBlacklist=0
... doLog=0 isValid=1
... userRegion={"protocol":"HTTP","traffic_forward":{"enable":1}}
${policy2} Create Dictionary policyId=3 policyType=tsg_security
... policyName=wx-policyName3 action=allow doBlacklist=0
... doLog=0 isValid=0
... userRegion={"protocol":"HTTP","traffic_forward":{"enable":1}}
${objectIds} Set Variable ${EMPTY}
@{policyList} Create List ${policy} ${policy1} ${policy2}
${rescode} ${policyIds} AddPolicies 1 ${policyList} v2
Log ${rescode} ${policyIds} ${objectIds}
Policy-Post-v1-00003
Comment 创建fqdn
${objectDict} Create Dictionary objectType=fqdn isValid=${1} addItemList=*baidu.com
${rescode} ${objectId} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId}
Comment 创建安全策略
${policy} Create Dictionary policyName=WX_SecurityPolicy-v1-00003 policyType=tsg_security
... policyDesc=autotest userTags=
... action=deny effectiveRange={}
... userRegion={"protocol":"SSL","method":"drop"}
... referenceObject=${objectId}|TSG_FIELD_SSL_CN&TSG_FIELD_SSL_SAN
... isValid=${1} appObjectIdArray=3
${rescode} ${policyIds} AddPolicies 1 ${policy} v1
Log ${rescode} ${policyIds} ${objectIds}
Policy-Post-v2-00004
#${testClentID} ${testClentSubID}
Comment 创建fqdn
${objectDict} Create Dictionary objectType=fqdn isValid=${1} addItemList=*baidu.com
${rescode} ${objectId} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId}
Comment 创建安全策略
${policy} Create Dictionary policyName=WX_SecurityPolicy-v2-00004 policyType=tsg_security
... policyDesc=autotest
... action=deny #effectiveRange={}
... userRegion={"protocol":"SSL","method":"drop"}
... filterList=${objectId}:TSG_FIELD_SSL_CN
... isValid=${1} appIdObjects=3
${rescode} ${policyIds} AddPolicies 1 ${policy} v2
Log ${rescode} ${policyIds} ${objectIds}
Policy-Post-v2-00005
Comment 创建IP
${objectDict} Create Dictionary objectType=ip isValid=${1}
... isInitialize=0
... addItemList=range|192.168.41.68|192.168.41.68|0/0
${rescode} ${objectId1} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId1}
Log To Console Create IP Object
Comment 创建url
${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=*baidu.com
${rescode} ${objectId2} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId2},${objectIds}
Log To Console Create url Object
Comment 创建安全策略
${policy} Create Dictionary policyName=WX_SecurityPolicy-v2-00005 policyType=tsg_security
... policyDesc=wx-autotest
... action=deny effectiveRange={}
... userRegion={"protocol":"HTTP","method":"drop"}
... source=${objectId1}|TSG_SECURITY_SOURCE_ADDR
... destination=${objectId2}|TSG_FIELD_HTTP_URL
... isValid=${1} appIdObjects=2
${rescode} ${policyIds} AddPolicies 1 ${policy} v2
Log ${rescode} ${policyIds} ${objectIds}