feat:(v2策略)支持update,enable,disable

This commit is contained in:
wangxin
2020-06-16 19:40:59 +08:00
parent e9893ac45d
commit ca22cc7ba7
4 changed files with 140 additions and 5 deletions

View File

@@ -149,4 +149,107 @@ Policy-Post-v2-00006
${profile1} Create Dictionary typeUrl=reflector/payload profileIds=${payload_profile_id}
Append To List ${profiles} ${profile} ${profile1}
${objectIds} Set Variable ${EMPTY}
Log ${rescode} ${policyIds} ${objectIds}
Log ${rescode} ${policyIds} ${objectIds}
Policy-Post-v2-00007
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 Object1
Comment 创建IP1
${objectDict} Create Dictionary objectType=ip isValid=${1}
... isInitialize=0
... addItemList=range|192.168.41.67|192.168.41.67|0/0
${rescode} ${objectId2} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId2}
Log To Console Create IP Object2
Comment 创建url
${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=*baidu.com
${rescode} ${objectId3} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId3},${objectIds}
Log To Console Create url Object3
Comment 创建url1
${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=*google.com.com
${rescode} ${objectId4} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId4},${objectIds}
Log To Console Create url Object4
Comment 创建安全策略
${policy} Create Dictionary policyName=WX_AddPolicy-v2-00007 policyType=tsg_security
... policyDesc=wx-autotest
... action=deny effectiveRange={}
... userRegion={"protocol":"HTTP","method":"drop"}
... source=${objectId1}|TSG_SECURITY_SOURCE_ADDR
... destination=${objectId3}|TSG_FIELD_HTTP_URL
... isValid=${1} appIdObjects=2
${rescode} ${policyIds} AddPolicies 1 ${policy} v2
Log ${rescode}
${updatePolicyId} Set Variable ${policyIds}[0][policyIds][0]
Comment 更新安全策略
${policy} Create Dictionary policyName=WX_UpdatePolicy-v2-00007 policyType=tsg_security
... policyDesc=wx-autotest policyId=${updatePolicyId}
... action=monitor
... userRegion={"protocol":"HTTP","traffic_forward":{"enable":1}}
... source=${objectId2}|TSG_SECURITY_SOURCE_ADDR
... destination=${objectId4}|TSG_FIELD_HTTP_URL
... isValid=${1} appIdObjects=2
${rescode} UpdatePolicies 1 ${policy} v2 update
Policy-Post-v2-00008
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 Object1
Comment 创建url
${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=*baidu.com
${rescode} ${objectId3} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId3},${objectIds}
Log To Console Create url Object3
Comment 创建安全策略
${policy} Create Dictionary policyName=WX_AddPolicy-v2-00008 policyType=tsg_security
... policyDesc=wx-autotest
... action=deny effectiveRange={}
... userRegion={"protocol":"HTTP","method":"drop"}
... source=${objectId1}|TSG_SECURITY_SOURCE_ADDR
... destination=${objectId3}|TSG_FIELD_HTTP_URL
... isValid=${1} appIdObjects=2
${policy1} Copy Dictionary ${policy} true
${rescode} ${policyIds} AddPolicies 1 ${policy} v2
Log ${rescode}
${updatePolicyId} Set Variable ${policyIds}[0][policyIds][0]
Comment 更新安全策略
Set To Dictionary ${policy1} policyId=${updatePolicyId}
${rescode} UpdatePolicies 1 ${policy1} v2 disable
Policy-Post-v2-00009
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 Object1
Comment 创建url
${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=*baidu.com
${rescode} ${objectId3} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId3},${objectIds}
Log To Console Create url Object3
Comment 创建安全策略
${policy} Create Dictionary policyName=WX_AddPolicy-v2-00009 policyType=tsg_security
... policyDesc=wx-autotest
... action=deny effectiveRange={}
... userRegion={"protocol":"HTTP","method":"drop"}
... source=${objectId1}|TSG_SECURITY_SOURCE_ADDR
... destination=${objectId3}|TSG_FIELD_HTTP_URL
... isValid=${0} appIdObjects=2
${policy1} Copy Dictionary ${policy} true
${rescode} ${policyIds} AddPolicies 1 ${policy} v2
Log ${rescode}
${updatePolicyId} Set Variable ${policyIds}[0][policyIds][0]
Comment 更新安全策略
Set To Dictionary ${policy1} policyId=${updatePolicyId}
${rescode} UpdatePolicies 1 ${policy1} v2 enable