提交多层删除关键字和安全策略allow、deny动作用例的优化(自测全部通过)

This commit is contained in:
lyf
2020-08-06 17:46:04 +08:00
parent 6649c8d6e3
commit 7ef4a7e0d9
3 changed files with 124 additions and 82 deletions

View File

@@ -1,5 +1,5 @@
*** Settings ***
Test Teardown DeletePolicyAndObject ${policyIds} ${objectIds} ${group}
Test Teardown DeletePolicyAndGroupObject ${policyIds} ${objectIds}
Resource ../../../02-Keyword/tsg_bfapi/PolicyObject.robot
Resource ../../../02-Keyword/tsg_bfapi/policy_object/Policy.robot
Resource ../../../02-Keyword/tsg_bfapi/policy_object/Object.robot
@@ -11,7 +11,6 @@ Library DateTime
@{policyIds}
@{profiles}
${objectIds} ${EMPTY}
${group} ${EMPTY}
*** Test Cases ***
Allow-test-001
#新建allow协议单选http
@@ -23,7 +22,7 @@ Allow-test-001
#objectList对象
${objectDict} Create Dictionary objectType=ip isValid=${1} addItemList=${addItemLists}
${rescode} ${objectId1} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId1}
${objectIds} Create List [${objectId1}]
Comment 创建策略
${policyDict} Create Dictionary policyName=新建allow单选协 action=allow source=${objectId1}|TSG_SECURITY_SOURCE_ADDR userRegion={"protocol":"HTTP"} isValid=${1} appIdObjects=2
${rescode} ${policyIds} AddPolicies 1 ${policyDict} v2
@@ -39,7 +38,7 @@ Allow-test-002
#objectList对象
${objectDict} Create Dictionary objectType=ip isValid=${1} addItemList=${addItemLists}
${rescode} ${objectId1} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId1}
${objectIds} Create List [${objectId1}]
Comment 创建策略
${policyDict} Create Dictionary
... policyName=新建allow单选协议
@@ -63,7 +62,7 @@ Allow-test-003
#objectList对象
${objectDict} Create Dictionary objectType=ip isValid=${1} addItemList=${addItemLists}
${rescode} ${objectId1} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId1}
${objectIds} Create List [${objectId1}]
Comment 创建策略
${policyDict} Create Dictionary
... policyName=新建allow单选协议
@@ -87,7 +86,7 @@ Allow-test-004
#objectList对象
${objectDict} Create Dictionary objectType=ip isValid=${1} addItemList=${addItemLists}
${rescode} ${objectId1} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId1}
${objectIds} Create List [${objectId1}]
Comment 创建策略
${policyDict} Create Dictionary
... policyName=新建allow单选协议
@@ -111,7 +110,7 @@ Allow-test-005
#objectList对象
${objectDict} Create Dictionary objectType=ip isValid=${1} addItemList=${addItemLists}
${rescode} ${objectId1} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId1}
${objectIds} Create List [${objectId1}]
Comment 创建策略
${policyDict} Create Dictionary
... policyName=新建allow单选协议
@@ -135,7 +134,7 @@ Allow-test-006
#objectList对象
${objectDict} Create Dictionary objectType=ip isValid=${1} addItemList=${addItemLists}
${rescode} ${objectId1} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId1}
${objectIds} Create List [${objectId1}]
Comment 创建策略
${policyDict} Create Dictionary
... policyName=新建allow单选协议
@@ -159,7 +158,7 @@ Allow-test-007
#objectList对象
${objectDict} Create Dictionary objectType=ip isValid=${1} addItemList=${addItemLists}
${rescode} ${objectId1} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId1}
${objectIds} Create List [${objectId1}]
Comment 创建策略
${policyDict} Create Dictionary
... policyName=新建allow多选协议
@@ -187,7 +186,7 @@ Allow-test-008
Comment 创建fqdn
${objectDict} Create Dictionary objectType=fqdn isValid=${1} addItemList=*.com
${rescode} ${objectId} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId},${objectIds}
${objectIds} Create List [${objectId},${objectIds}]
Comment 创建策略
${policyDict} Create Dictionary
... policyName=Application选择HTTPfilter选择host中的fqdn右匹配
@@ -216,7 +215,7 @@ Allow-test-009
Comment 创建fqdn
${objectDict} Create Dictionary objectType=fqdn isValid=${1} addItemList=$www.5ytb.com
${rescode} ${objectId} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId},${objectIds}
${objectIds} Create List [${objectId},${objectIds}]
Comment 创建策略
${policyDict} Create Dictionary
... policyName=Application选择HTTPfilter选择host中的fqdn完全匹配
@@ -247,12 +246,13 @@ Allow-test-010
Comment 创建fqdn1
${objectDict} Create Dictionary objectType=fqdn isValid=${1} addItemList=*.com
${rescode} ${objectId0} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId0},${objectId},${objectId1}
${objectIdlist} Create List ${objectId0} ${objectId} ${objectId1}
Comment 创建fqdn-group
${subObjectIds} Create list ${objectId} ${objectId0}
${objectDict} Set Variable {"opAction":"add","returnData":1,"objectList":{"objectType":"fqdn","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"${Default_ObjectName}","objectDesc":"","subObjectIds":${subObjectIds},"addItemList":[],"updateItemList":[],"deleteItemIds":[],"iconColor":"#31739C"}}
${rescode} ${objectId2} AddObject ${objectDict}
${group} Set Variable ${objectId2}
${objectIdlist1} create list ${objectId2}
${objectIds} create list ${objectIdlist1} ${objectIdlist}
Comment 创建策略
${policyDict} Create Dictionary
... policyName=Application选择HTTPfilter选择host中的fqdn-group
@@ -280,7 +280,7 @@ Allow-test-011
Comment 创建fqdn
${objectDict} Create Dictionary objectType=fqdn_category isValid=${1} addItemList=*.com
${rescode} ${objectId} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId},${objectIds}
${objectIds} Create list [${objectId},${objectIds}]
Comment 创建策略
${policyDict} Create Dictionary
... policyName=Application选择HTTPfilter选择host中的category右匹配
@@ -309,7 +309,7 @@ Allow-test-012
Comment 创建fqdn
${objectDict} Create Dictionary objectType=fqdn_category isValid=${1} addItemList=$www.5ytb.com
${rescode} ${objectId} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId},${objectIds}
${objectIds} Create list [${objectId},${objectIds}]
Comment 创建策略
${policyDict} Create Dictionary
... policyName=Application选择HTTPfilter选择host中的category完全匹配
@@ -340,12 +340,13 @@ Allow-test-013
Comment 创建fqdn1
${objectDict} Create Dictionary objectType=fqdn_category isValid=${1} addItemList=*.com
${rescode} ${objectId0} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId0},${objectId},${objectId1}
${objectIdlist} Create list ${objectId0} ${objectId} ${objectId1}
Comment 创建fqdn-group
${subObjectIds} Create list ${objectId} ${objectId0}
${objectDict} Set Variable {"opAction":"add","returnData":1,"objectList":{"objectType":"fqdn_category","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"${Default_ObjectName}","objectDesc":"","subObjectIds":${subObjectIds},"addItemList":[],"updateItemList":[],"deleteItemIds":[],"iconColor":"#31739C"}}
${rescode} ${objectId2} AddObject ${objectDict}
${group} Set Variable ${objectId2}
${objectIdlist1} create list ${objectId2}
${objectIds} create list ${objectIdlist1} ${objectIdlist}
Comment 创建策略
${policyDict} Create Dictionary
... policyName=Application选择HTTPfilter选择host中的category-group
@@ -375,7 +376,7 @@ Allow-test-014
Comment 创建fqdn
${objectDict} Create Dictionary objectType=fqdn isValid=${1} addItemList=*.com
${rescode} ${objectId} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId},${objectIds}
${objectIds} Create list [${objectId},${objectIds}]
Comment 创建策略
${policyDict} Create Dictionary
... policyName=Application选择SSLfilter选择SNI中的fqdn右匹配
@@ -404,7 +405,7 @@ Allow-test-015
Comment 创建fqdn
${objectDict} Create Dictionary objectType=fqdn isValid=${1} addItemList=$www.5ytb.com
${rescode} ${objectId} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId},${objectIds}
${objectIds} Create list [${objectId},${objectIds}]
Comment 创建策略
${policyDict} Create Dictionary
... policyName=Application选择SSLfilter选择SNI中的fqdn完全匹配
@@ -435,12 +436,13 @@ Allow-test-016
Comment 创建fqdn1
${objectDict} Create Dictionary objectType=fqdn isValid=${1} addItemList=*.com
${rescode} ${objectId0} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId0},${objectId},${objectId1}
${objectIdlist} Create list ${objectId0} ${objectId} ${objectId1}
Comment 创建fqdn-group
${subObjectIds} Create list ${objectId} ${objectId0}
${subObjectIds} Create list ${objectId} ${objectId0}
${objectDict} Set Variable {"opAction":"add","returnData":1,"objectList":{"objectType":"fqdn","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"${Default_ObjectName}","objectDesc":"","subObjectIds":${subObjectIds},"addItemList":[],"updateItemList":[],"deleteItemIds":[],"iconColor":"#31739C"}}
${rescode} ${objectId2} AddObject ${objectDict}
${group} Set Variable ${objectId2}
${objectIdlist1} create list ${objectId2}
${objectIds} create list ${objectIdlist1} ${objectIdlist}
Comment 创建策略
${policyDict} Create Dictionary
... policyName=Application选择SSLfilter选择SNI中的fqdn-group
@@ -469,7 +471,7 @@ Allow-test-017
Comment 创建fqdn
${objectDict} Create Dictionary objectType=fqdn_category isValid=${1} addItemList=*.com
${rescode} ${objectId} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId},${objectIds}
${objectIds} Create list [${objectId},${objectIds}]
Comment 创建策略
${policyDict} Create Dictionary
... policyName=Application选择SSLfilter选择SNI中的category右匹配
@@ -498,7 +500,7 @@ Allow-test-018
Comment 创建fqdn
${objectDict} Create Dictionary objectType=fqdn_category isValid=${1} addItemList=$www.5ytb.com
${rescode} ${objectId} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId},${objectIds}
${objectIds} Create list [${objectId},${objectIds}]
Comment 创建策略
${policyDict} Create Dictionary
... policyName=Application选择HTTPfilter选择SNI中的category完全匹配
@@ -529,12 +531,13 @@ Allow-test-019
Comment 创建fqdn1
${objectDict} Create Dictionary objectType=fqdn_category isValid=${1} addItemList=*.com
${rescode} ${objectId0} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId0},${objectId},${objectId1}
${objectIdlist} Create list ${objectId0} ${objectId} ${objectId1}
Comment 创建fqdn-group
${subObjectIds} Create list ${objectId} ${objectId0}
${objectDict} Set Variable {"opAction":"add","returnData":1,"objectList":{"objectType":"fqdn_category","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"${Default_ObjectName}","objectDesc":"","subObjectIds":${subObjectIds},"addItemList":[],"updateItemList":[],"deleteItemIds":[],"iconColor":"#31739C"}}
${rescode} ${objectId2} AddObject ${objectDict}
${group} Set Variable ${objectId2}
${objectIdlist1} create list ${objectId2}
${objectIds} create list ${objectIdlist1} ${objectIdlist}
Comment 创建策略
${policyDict} Create Dictionary
... policyName=Application选择SSLfilter选择SNI中的category-group
@@ -564,7 +567,7 @@ Allow-test-020
Comment 创建fqdn
${objectDict} Create Dictionary objectType=fqdn isValid=${1} addItemList=*.com
${rescode} ${objectId} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId},${objectIds}
${objectIds} Create list [${objectId},${objectIds}]
Comment 创建策略
${policyDict} Create Dictionary
... policyName=Application选择HTTPfilter选择host中的fqdn右匹配
@@ -593,7 +596,7 @@ Allow-test-021
Comment 创建fqdn
${objectDict} Create Dictionary objectType=fqdn isValid=${1} addItemList=$www.5ytb.com
${rescode} ${objectId} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId},${objectIds}
${objectIds} Create list [${objectId},${objectIds}]
Comment 创建策略
${policyDict} Create Dictionary
... policyName=Application选择QUICfilter选择SNI中的fqdn完全匹配
@@ -624,12 +627,13 @@ Allow-test-022
Comment 创建fqdn1
${objectDict} Create Dictionary objectType=fqdn isValid=${1} addItemList=*.com
${rescode} ${objectId0} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId0},${objectId},${objectId1}
${objectIdlist} Create list ${objectId0} ${objectId} ${objectId1}
Comment 创建fqdn-group
${subObjectIds} Create list ${objectId} ${objectId0}
${objectDict} Set Variable {"opAction":"add","returnData":1,"objectList":{"objectType":"fqdn","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"${Default_ObjectName}","objectDesc":"","subObjectIds":${subObjectIds},"addItemList":[],"updateItemList":[],"deleteItemIds":[],"iconColor":"#31739C"}}
${rescode} ${objectId2} AddObject ${objectDict}
${group} Set Variable ${objectId2}
${objectIdlist1} create list ${objectId2}
${objectIds} create list ${objectIdlist1} ${objectIdlist}
Comment 创建策略
${policyDict} Create Dictionary
... policyName=Application选择QUICfilter选择SNI中的fqdn-group
@@ -658,7 +662,7 @@ Allow-test-023
Comment 创建fqdn
${objectDict} Create Dictionary objectType=fqdn_category isValid=${1} addItemList=*.com
${rescode} ${objectId} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId},${objectIds}
${objectIds} Create list [${objectId},${objectIds}]
Comment 创建策略
${policyDict} Create Dictionary
... policyName=Application选择QUICfilter选择SNI中的category右匹配
@@ -687,7 +691,7 @@ Allow-test-024
Comment 创建fqdn
${objectDict} Create Dictionary objectType=fqdn_category isValid=${1} addItemList=$www.5ytb.com
${rescode} ${objectId} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId},${objectIds}
${objectIds} Create list [${objectId},${objectIds}]
Comment 创建策略
${policyDict} Create Dictionary
... policyName=Application选择QUICfilter选择SNI中的category完全匹配
@@ -718,12 +722,13 @@ Allow-test-025
Comment 创建fqdn1
${objectDict} Create Dictionary objectType=fqdn_category isValid=${1} addItemList=*.com
${rescode} ${objectId0} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId0},${objectId},${objectId1}
${objectIdlist} Create list ${objectId0} ${objectId} ${objectId1}
Comment 创建fqdn-group
${subObjectIds} Create list ${objectId} ${objectId0}
${objectDict} Set Variable {"opAction":"add","returnData":1,"objectList":{"objectType":"fqdn_category","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"${Default_ObjectName}","objectDesc":"","subObjectIds":${subObjectIds},"addItemList":[],"updateItemList":[],"deleteItemIds":[],"iconColor":"#31739C"}}
${rescode} ${objectId2} AddObject ${objectDict}
${group} Set Variable ${objectId2}
${objectIdlist1} create list ${objectId2}
${objectIds} create list ${objectIdlist1} ${objectIdlist}
Comment 创建策略
${policyDict} Create Dictionary
... policyName=Application选择QUICfilter选择SNI中的category-group

View File

@@ -1,5 +1,5 @@
*** Settings ***
Test Teardown DeletePolicyAndObject ${policyIds} ${objectIds} ${group}
Test Teardown DeletePolicyAndGroupObject ${policyIds} ${objectIds}
Resource ../../../02-Keyword/tsg_bfapi/PolicyObject.robot
Resource ../../../02-Keyword/tsg_bfapi/policy_object/Policy.robot
Resource ../../../02-Keyword/tsg_bfapi/policy_object/Object.robot
@@ -11,7 +11,6 @@ Library DateTime
@{policyIds}
@{profiles}
${objectIds} ${EMPTY}
${group} ${EMPTY}
*** Test Cases ***
deny-test-001
#新建deny协议单选http
@@ -23,7 +22,7 @@ deny-test-001
#objectList对象
${objectDict} Create Dictionary objectType=ip isValid=${1} addItemList=${addItemLists}
${rescode} ${objectId1} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId1}
${objectIds} Create List [${objectId1}]
Comment 创建策略
${policyDict} Create Dictionary policyName=新建deny单选协 action=deny source=${objectId1}|TSG_SECURITY_SOURCE_ADDR userRegion={"protocol":"HTTP","method":"drop"} isValid=${1} appIdObjects=2
${rescode} ${policyIds} AddPolicies 1 ${policyDict} v2
@@ -39,7 +38,7 @@ deny-test-002
#objectList对象
${objectDict} Create Dictionary objectType=ip isValid=${1} addItemList=${addItemLists}
${rescode} ${objectId1} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId1}
${objectIds} Create List [${objectId1}]
Comment 创建策略
${policyDict} Create Dictionary
... policyName=新建deny单选协议
@@ -63,7 +62,7 @@ deny-test-003
#objectList对象
${objectDict} Create Dictionary objectType=ip isValid=${1} addItemList=${addItemLists}
${rescode} ${objectId1} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId1}
${objectIds} Create List [${objectId1}]
Comment 创建策略
${policyDict} Create Dictionary
... policyName=新建deny单选协议
@@ -87,7 +86,7 @@ deny-test-004
#objectList对象
${objectDict} Create Dictionary objectType=ip isValid=${1} addItemList=${addItemLists}
${rescode} ${objectId1} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId1}
${objectIds} Create List [${objectId1}]
Comment 创建策略
${policyDict} Create Dictionary
... policyName=新建deny单选协议
@@ -111,7 +110,7 @@ deny-test-005
#objectList对象
${objectDict} Create Dictionary objectType=ip isValid=${1} addItemList=${addItemLists}
${rescode} ${objectId1} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId1}
${objectIds} Create List [${objectId1}]
Comment 创建策略
${policyDict} Create Dictionary
... policyName=新建deny单选协议
@@ -135,7 +134,7 @@ deny-test-006
#objectList对象
${objectDict} Create Dictionary objectType=ip isValid=${1} addItemList=${addItemLists}
${rescode} ${objectId1} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId1}
${objectIds} Create List [${objectId1}]
Comment 创建策略
${policyDict} Create Dictionary
... policyName=新建deny单选协议
@@ -159,7 +158,7 @@ deny-test-007
#objectList对象
${objectDict} Create Dictionary objectType=ip isValid=${1} addItemList=${addItemLists}
${rescode} ${objectId1} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId1}
${objectIds} Create List [${objectId1}]
Comment 创建策略
${policyDict} Create Dictionary
... policyName=新建deny多选协议
@@ -187,7 +186,7 @@ deny-test-008
Comment 创建fqdn
${objectDict} Create Dictionary objectType=fqdn isValid=${1} addItemList=*.com
${rescode} ${objectId} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId},${objectIds}
${objectIds} Create List [${objectId},${objectIds}]
Comment 创建策略
${policyDict} Create Dictionary
... policyName=Application选择HTTPfilter选择host中的fqdn右匹配
@@ -216,7 +215,7 @@ deny-test-009
Comment 创建fqdn
${objectDict} Create Dictionary objectType=fqdn isValid=${1} addItemList=$www.5ytb.com
${rescode} ${objectId} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId},${objectIds}
${objectIds} Create List [${objectId},${objectIds}]
Comment 创建策略
${policyDict} Create Dictionary
... policyName=Application选择HTTPfilter选择host中的fqdn完全匹配
@@ -247,12 +246,13 @@ deny-test-010
Comment 创建fqdn1
${objectDict} Create Dictionary objectType=fqdn isValid=${1} addItemList=*.com
${rescode} ${objectId0} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId0},${objectId},${objectId1}
${objectIdlist} create list ${objectId0} ${objectId} ${objectId1}
Comment 创建fqdn-group
${subObjectIds} Create list ${objectId} ${objectId0}
${objectDict} Set Variable {"opAction":"add","returnData":1,"objectList":{"objectType":"fqdn","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"${Default_ObjectName}","objectDesc":"","subObjectIds":${subObjectIds},"addItemList":[],"updateItemList":[],"deleteItemIds":[],"iconColor":"#31739C"}}
${rescode} ${objectId2} AddObject ${objectDict}
${group} Set Variable ${objectId2}
${objectIdlist1} create list ${objectId2}
${objectIds} create list ${objectIdlist1} ${objectIdlist}
Comment 创建策略
${policyDict} Create Dictionary
... policyName=Application选择HTTPfilter选择host中的fqdn-group
@@ -280,7 +280,7 @@ deny-test-011
Comment 创建fqdn
${objectDict} Create Dictionary objectType=fqdn_category isValid=${1} addItemList=*.com
${rescode} ${objectId} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId},${objectIds}
${objectIds} Create List [${objectId},${objectIds}]
Comment 创建策略
${policyDict} Create Dictionary
... policyName=Application选择HTTPfilter选择host中的category右匹配
@@ -309,7 +309,7 @@ deny-test-012
Comment 创建fqdn
${objectDict} Create Dictionary objectType=fqdn_category isValid=${1} addItemList=$www.5ytb.com
${rescode} ${objectId} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId},${objectIds}
${objectIds} Create List [${objectId},${objectIds}]
Comment 创建策略
${policyDict} Create Dictionary
... policyName=Application选择HTTPfilter选择host中的category完全匹配
@@ -340,13 +340,14 @@ deny-test-013
Comment 创建fqdn1
${objectDict} Create Dictionary objectType=fqdn_category isValid=${1} addItemList=*.com
${rescode} ${objectId0} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId0},${objectId},${objectId1}
${objectIdlist} create list ${objectId0} ${objectId} ${objectId1}
Comment 创建fqdn-group
${subObjectIds} Create list ${objectId} ${objectId0}
log 111111111111111111${subObjectIds}
${objectDict} Set Variable {"opAction":"add","returnData":1,"objectList":{"objectType":"fqdn_category","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"${Default_ObjectName}","objectDesc":"","subObjectIds":${subObjectIds},"addItemList":[],"updateItemList":[],"deleteItemIds":[],"iconColor":"#31739C"}}
${rescode} ${objectId2} AddObject ${objectDict}
${group} Set Variable ${objectId2}
${objectIdlist1} create list ${objectId2}
${objectIds} create list ${objectIdlist1} ${objectIdlist}
Comment 创建策略
${policyDict} Create Dictionary
... policyName=Application选择HTTPfilter选择host中的category-group
@@ -366,7 +367,7 @@ deny-test-014
Comment 创建url
${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=abcd.*
${rescode} ${objectId1} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId1}
${objectIds} Create List [${objectId1}]
Comment 创建策略
${policyDict} Create Dictionary
... policyName=Application选择HTTPfilter选择host中的category-group
@@ -385,7 +386,7 @@ deny-test-015
Comment 创建url
${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=*скрипцияк
${rescode} ${objectId1} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId1}
${objectIds} Create List [${objectId1}]
Comment 创建策略
${policyDict} Create Dictionary
... policyName=Application选择HTTPfilter选择host中的category-group
@@ -404,7 +405,7 @@ deny-test-016
Comment 创建url
${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=$完全匹配
${rescode} ${objectId1} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId1}
${objectIds} Create List [${objectId1}]
Comment 创建策略
${policyDict} Create Dictionary
... policyName=Application选择HTTPfilter选择host中的category-group
@@ -423,7 +424,7 @@ deny-test-017
Comment 创建url
${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=123@#¥%……
${rescode} ${objectId1} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId1}
${objectIds} Create List [${objectId1}]
Comment 创建策略
${policyDict} Create Dictionary
... policyName=Application选择HTTPfilter选择host中的category-group
@@ -459,13 +460,14 @@ deny-test-018
Comment 创建url
${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=123@#¥%……
${rescode} ${objectId4} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId1},${objectId2},${objectId3},${objectId4},${objectId0}
${objectIdlist} create list ${objectId1} ${objectId2} ${objectId3} ${objectId4} ${objectId0}
Comment 创建fqdn-group
${subObjectIds} Create list ${objectId1} ${objectId2} ${objectId3} ${objectId4}
log 11111111111111${subObjectIds}
${objectDict} Set Variable {"opAction":"add","returnData":1,"objectList":{"objectType":"url","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"${Default_ObjectName}","objectDesc":"","subObjectIds":${subObjectIds},"addItemList":[],"updateItemList":[],"deleteItemIds":[],"iconColor":"#31739C"}}
${rescode} ${objectId5} AddObject ${objectDict}
${group} Set Variable ${objectId5}
${objectIdlist1} create list ${objectId5}
${objectIds} create list ${objectIdlist1} ${objectIdlist}
Comment 创建策略
${policyDict} Create Dictionary
... policyName=Application选择HTTPfilter选择host中的category-group
@@ -485,7 +487,7 @@ deny-test-019
Comment 创建url
${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=abcd.*|User-Agent
${rescode} ${objectId1} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId1}
${objectIds} Create List [${objectId1}]
Comment 创建策略
${policyDict} Create Dictionary
... policyName=Application选择HTTPfilter选择host中的category-group
@@ -504,7 +506,7 @@ deny-test-020
Comment 创建url
${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=*скрипцияк|User-Agent
${rescode} ${objectId1} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId1}
${objectIds} Create List [${objectId1}]
Comment 创建策略
${policyDict} Create Dictionary
... policyName=Application选择HTTPfilter选择host中的category-group
@@ -523,7 +525,7 @@ deny-test-021
Comment 创建url
${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=$完全匹配|User-Agent
${rescode} ${objectId1} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId1}
${objectIds} Create List [${objectId1}]
Comment 创建策略
${policyDict} Create Dictionary
... policyName=Application选择HTTPfilter选择host中的category-group
@@ -542,7 +544,7 @@ deny-test-022
Comment 创建url
${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=123@#¥%……|User-Agent
${rescode} ${objectId1} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId1}
${objectIds} Create List [${objectId1}]
Comment 创建策略
${policyDict} Create Dictionary
... policyName=Application选择HTTPfilter选择host中的category-group
@@ -558,24 +560,25 @@ deny-test-022
deny-test-023
#新建denyApplication选择HTTPfilter选择request header中的user-agent-group
Comment 创建url
Comment 创建user-agent
${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=abcd.*|User-Agent
${rescode} ${objectId1} AddObject2 ${1} ${objectDict}
Comment 创建url
Comment 创建user-agent
${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=*скрипцияк|User-Agent
${rescode} ${objectId2} AddObject2 ${1} ${objectDict}
Comment 创建url
Comment 创建user-agent
${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=$完全匹配|User-Agent
${rescode} ${objectId3} AddObject2 ${1} ${objectDict}
Comment 创建url
Comment 创建user-agent
${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=123@#¥%……|User-Agent
${rescode} ${objectId4} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId1},${objectId2},${objectId3},${objectId4}
Comment 创建url-group
${subObjectIds} Create list ${objectId1},${objectId2},${objectId3},${objectId4}
${objectIdlist} create list ${objectId1} ${objectId2} ${objectId3} ${objectId4}
Comment 创建user-agent-group
${subObjectIds} Create list ${objectId1} ${objectId2} ${objectId3} ${objectId4}
${objectDict} Set Variable {"opAction":"add","returnData":1,"objectList":{"objectType":"http_signature","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"${Default_ObjectName}","objectDesc":"","subObjectIds":${subObjectIds},"addItemList":[],"updateItemList":[],"deleteItemIds":[],"iconColor":"#31739C"}}
${rescode} ${objectId5} AddObject ${objectDict}
${group} Set Variable ${objectId2}
${objectIdlist1} create list ${objectId5}
${objectIds} create list ${objectIdlist1} ${objectIdlist}
Comment 创建策略
${policyDict} Create Dictionary
... policyName=Application选择HTTPfilter选择host中的category-group
@@ -594,7 +597,7 @@ deny-test-024
Comment 创建url
${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=abcd.*|Cookie
${rescode} ${objectId1} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId1}
${objectIds} Create List [${objectId1}]
Comment 创建策略
${policyDict} Create Dictionary
... policyName=Application选择HTTPfilter选择host中的category-group
@@ -613,7 +616,7 @@ deny-test-025
Comment 创建url
${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=*скрипцияк|Cookie
${rescode} ${objectId1} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId1}
${objectIds} Create List [${objectId1}]
Comment 创建策略
${policyDict} Create Dictionary
... policyName=Application选择HTTPfilter选择host中的category-group
@@ -632,7 +635,7 @@ deny-test-026
Comment 创建url
${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=$完全匹配|Cookie
${rescode} ${objectId1} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId1}
${objectIds} Create List [${objectId1}]
Comment 创建策略
${policyDict} Create Dictionary
... policyName=Application选择HTTPfilter选择host中的category-group
@@ -651,7 +654,7 @@ deny-test-027
Comment 创建url
${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=123@#¥%……|Cookie
${rescode} ${objectId1} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId1}
${objectIds} Create List [${objectId1}]
Comment 创建策略
${policyDict} Create Dictionary
... policyName=Application选择HTTPfilter选择host中的category-group
@@ -667,24 +670,25 @@ deny-test-027
deny-test-028
#新建denyApplication选择HTTPfilter选择request header中的Cookie-group
Comment 创建url
Comment 创建Cookie
${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=abcd.*|Cookie
${rescode} ${objectId1} AddObject2 ${1} ${objectDict}
Comment 创建url
Comment 创建Cookie
${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=*скрипцияк|Cookie
${rescode} ${objectId2} AddObject2 ${1} ${objectDict}
Comment 创建url
Comment 创建Cookie
${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=$完全匹配|Cookie
${rescode} ${objectId3} AddObject2 ${1} ${objectDict}
Comment 创建url
Comment 创建Cookie
${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=123@#¥%……|Cookie
${rescode} ${objectId4} AddObject2 ${1} ${objectDict}
${objectIds} Set Variable ${objectId1},${objectId2},${objectId3},${objectId4}
Comment 创建fqdn-group
${subObjectIds} Create list ${objectId1},${objectId2},${objectId3},${objectId4}
${objectIdlist} create list ${objectId1} ${objectId2} ${objectId3} ${objectId4}
Comment 创建Cookie-group
${subObjectIds} Create list ${objectId1} ${objectId2} ${objectId3} ${objectId4}
${objectDict} Set Variable {"opAction":"add","returnData":1,"objectList":{"objectType":"http_signature","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"${Default_ObjectName}","objectDesc":"","subObjectIds":${subObjectIds},"addItemList":[],"updateItemList":[],"deleteItemIds":[],"iconColor":"#31739C"}}
${rescode} ${objectId5} AddObject ${objectDict}
${group} Set Variable ${objectId2}
${objectIdlist1} create list ${objectId5}
${objectIds} create list ${objectIdlist1} ${objectIdlist}
Comment 创建策略
${policyDict} Create Dictionary
... policyName=Application选择HTTPfilter选择host中的category-group
@@ -697,5 +701,7 @@ deny-test-028
... filterList=${objectId5}|TSG_FIELD_HTTP_REQ_HDR
${rescode} ${policyIds} AddPolicies 1 ${policyDict} v2
${policyIds} Create List {"policyType":"tsg_security","policyIds":[${policyIds}]}

View File

@@ -259,7 +259,38 @@ DeletePolicyAndObject
log todeleteobj_DeletePolicyAndObject
Run Keyword If "${objectids}"=="${EMPTY}" log no obj to del
... ELSE DeleteObject ${objectids}
DeletePolicyAndGroupObject
[Arguments] ${policyids} ${objectids}
#引用此关键字,${objectids}参数必须是双层列表eg['[1]','[2,3]','[4,5,6,7]']
#删除和对象
#删除策略
log toDeletePolicy_DeletePolicyAndObject
${listlenth}= Get Length ${policyids}
FOR ${var} IN RANGE ${listlenth}
log ${var}
DeletePolicy ${policyids}[${var}]
END
#删除对象
log todeleteobj_DeletePolicyAndObject
Run Keyword If "${objectids}"=="${EMPTY}" log no obj to del
... ELSE DeleteGroupObjects ${objectids}
DeleteGroupObjects
[Arguments] ${objectids}
FOR ${var} IN @{objectids}
log ${var}
DeleteGroupObject ${var}
END
DeleteGroupObject
[Arguments] ${objectids}
#删除对象
log todeleteobj
${response} BaseDeleteRequest /${version}/policy/object {"objectIds":${objectids}}
${response_code} Get From Dictionary ${response} code
Should Be Equal As Strings ${response_code} 200
${response} Convert to String ${response}
log ${response}
DeletePolicyAndObjectAndProfile
[Arguments] ${policyids} ${objectids} ${profiles}
DeletePolicyAndObject ${policyids} ${objectids}