全流程用例添加策略对象时增加默认值
This commit is contained in:
@@ -5,6 +5,7 @@ Library OperatingSystem
|
|||||||
Resource ../../../02-Keyword/tsg_adc/SystemCommand.robot
|
Resource ../../../02-Keyword/tsg_adc/SystemCommand.robot
|
||||||
Resource ../../../02-Keyword/tsg_bfapi/PolicyObject.robot
|
Resource ../../../02-Keyword/tsg_bfapi/PolicyObject.robot
|
||||||
Resource ../../../02-Keyword/tsg_bfapi/LogVariable.robot
|
Resource ../../../02-Keyword/tsg_bfapi/LogVariable.robot
|
||||||
|
Resource ../../../03-Variable/PolicyObjectDefault.txt
|
||||||
Library Custometest
|
Library Custometest
|
||||||
Library json
|
Library json
|
||||||
|
|
||||||
@@ -26,14 +27,32 @@ SecurityPolicy-Deny-AllProtol-00001
|
|||||||
# ...
|
# ...
|
||||||
Comment 创建目标IP
|
Comment 创建目标IP
|
||||||
${objectDict} Create Dictionary
|
${objectDict} Create Dictionary
|
||||||
... addItemList=CIDR|192.168.100.5|32|0/0
|
... objectType=${Default_ObjectType}
|
||||||
|
... isValid=${Default_IsValid}
|
||||||
|
... objectSubType=${Default_ObjectSubType}
|
||||||
|
... isInitialize=${Default_IsInitialize}
|
||||||
|
... isExclusion=${Default_IsExclusion}
|
||||||
|
... objectName=${Default_ObjectName}
|
||||||
|
... objectDesc=${Default_ObjectDesc}
|
||||||
|
... subObjectIds=${Default_SubObjectIds}
|
||||||
|
... addItemList=CIDR|192.168.100.5|32|0/0&${Default_AddItem_ServerIpFormat}|${Default_AddItem_ServerIp1}|${Default_AddItem_ServerIp2}|${Default_AddItem_ServerPort}|${Default_AddItem_IsInitialize}|${Default_AddItem_ItemName}|${Default_AddItem_ItemDesc}
|
||||||
${rescode} ${objectId} AddObject2 ${1} ${objectDict}
|
${rescode} ${objectId} AddObject2 ${1} ${objectDict}
|
||||||
${objectids} set Variable ${objectId}
|
${objectids} set Variable ${objectId}
|
||||||
|
|
||||||
Comment 创建安全策略,针对所有协议,相当于BlackIP
|
Comment 创建安全策略,针对所有协议,相当于BlackIP
|
||||||
${policyDict} Create Dictionary
|
${policyDict} Create Dictionary
|
||||||
... policyName=SecurityPolicy-Deny-AllProtol-00001
|
... policyName=${Default_PolicyName}
|
||||||
|
... policyType=${Default_PolicyType}
|
||||||
|
... policyDesc=${Default_PolicyDesc}
|
||||||
|
... action=${Default_Action}
|
||||||
|
... effectiveRange=${Default_EffectiveRange}
|
||||||
|
... userRegion=${Default_UserRegion}
|
||||||
... referenceObject=${objectId}|TSG_SECURITY_DESTINATION_ADDR
|
... referenceObject=${objectId}|TSG_SECURITY_DESTINATION_ADDR
|
||||||
|
... isValid=${Default_IsValid}
|
||||||
|
... appObjectIdArray=${Default_AppObjectIdArray}
|
||||||
|
... userTags=${Default_UserTags}
|
||||||
|
... doLog=${Default_DoLog}
|
||||||
|
... scheduleId=${Default_ScheduleId}
|
||||||
${rescode} ${policyId} AddPolicy2 ${1} ${policyDict}
|
${rescode} ${policyId} AddPolicy2 ${1} ${policyDict}
|
||||||
${policyId} set Variable {"policyType":"tsg_security","policyIds":[${policyId}]}
|
${policyId} set Variable {"policyType":"tsg_security","policyIds":[${policyId}]}
|
||||||
|
|
||||||
|
|||||||
@@ -21,9 +21,14 @@ AddLocalIPObject
|
|||||||
|
|
||||||
${objectDict} Create Dictionary
|
${objectDict} Create Dictionary
|
||||||
... objectType=ip
|
... objectType=ip
|
||||||
|
... objectSubType=${Default_ObjectSubType}
|
||||||
|
... isInitialize=${Default_IsInitialize}
|
||||||
|
... isExclusion=${Default_IsExclusion}
|
||||||
... objectName=autotest_localIP_${testClentIP}
|
... objectName=autotest_localIP_${testClentIP}
|
||||||
|
... objectDesc=${Default_ObjectDesc}
|
||||||
|
... subObjectIds=${Default_SubObjectIds}
|
||||||
... isValid=${1}
|
... isValid=${1}
|
||||||
... addItemList=range|${testClentIP}|${testClentIP}|0/0
|
... addItemList=range|${testClentIP}|${testClentIP}|0/0&${Default_AddItem_ServerIpFormat}|${Default_AddItem_ServerIp1}|${Default_AddItem_ServerIp2}|${Default_AddItem_ServerPort}|${Default_AddItem_IsInitialize}|${Default_AddItem_ItemName}|${Default_AddItem_ItemDesc}
|
||||||
${rescode} ${objectId} AddObject2 ${1} ${objectDict}
|
${rescode} ${objectId} AddObject2 ${1} ${objectDict}
|
||||||
#log ${rescodeip}
|
#log ${rescodeip}
|
||||||
log LocalIP:${objectId}
|
log LocalIP:${objectId}
|
||||||
@@ -32,10 +37,15 @@ AddLocalIPObject
|
|||||||
log to_AddLocalSubidObject
|
log to_AddLocalSubidObject
|
||||||
${objectDict} Create Dictionary
|
${objectDict} Create Dictionary
|
||||||
... objectType=subscriberid
|
... objectType=subscriberid
|
||||||
|
... objectSubType=${Default_ObjectSubType}
|
||||||
|
... isInitialize=${Default_IsInitialize}
|
||||||
|
... isExclusion=${Default_IsExclusion}
|
||||||
... objectName=autotest_localSubId_${testSubscriberID}
|
... objectName=autotest_localSubId_${testSubscriberID}
|
||||||
|
... objectDesc=${Default_ObjectDesc}
|
||||||
|
... subObjectIds=${Default_SubObjectIds}
|
||||||
... isValid=${1}
|
... isValid=${1}
|
||||||
... addItemList=${testSubscriberID}
|
... addItemList=${testSubscriberID}|${Default_AddItem_IsHexbin}|${Default_AddItem_IsInitialize}|${Default_AddItem_ItemName}|${Default_AddItem_ItemDesc}
|
||||||
${rescode} ${subiid} AddObject2 ${1} ${objectDict}
|
${rescode} ${subiid} AddObject2 ${1} ${objectDict}
|
||||||
#log ${subiid}
|
#log ${subiid}
|
||||||
log LocalSubIP:${subiid}
|
log LocalSubIP:${subiid}
|
||||||
SET GLOBAL VARIABLE ${testClentSubID} ${subiid}
|
SET GLOBAL VARIABLE ${testClentSubID} ${subiid}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ case01
|
|||||||
|
|
||||||
# 创建对象-http_signature
|
# 创建对象-http_signature
|
||||||
# addItemList全参数:(参数不可跳跃,[keywordArray]|[district]为必填,其它可省略)
|
# addItemList全参数:(参数不可跳跃,[keywordArray]|[district]为必填,其它可省略)
|
||||||
# [keywordArray]|[district]|[isHexbin]|[isSession]|[isInitialize]|[itemName]|[itemDesc],...
|
# [keywordArray]|[district]|[isHexbin]|[isInitialize]|[itemName]|[itemDesc],...
|
||||||
${objectDict} Create Dictionary
|
${objectDict} Create Dictionary
|
||||||
... objectType=http_signature
|
... objectType=http_signature
|
||||||
... isValid=${1}
|
... isValid=${1}
|
||||||
@@ -32,7 +32,7 @@ case01
|
|||||||
|
|
||||||
# 创建对象-url/fqdn/keywords/subscriberid/fqdn_category/account
|
# 创建对象-url/fqdn/keywords/subscriberid/fqdn_category/account
|
||||||
# addItemList全参数:(参数不可跳跃,[keywordArray]为必填,其它可省略)
|
# addItemList全参数:(参数不可跳跃,[keywordArray]为必填,其它可省略)
|
||||||
# [keywordArray]|[isHexbin]|[isSession]|[isInitialize]|[itemName]|[itemDesc],...
|
# [keywordArray]|[isHexbin]|[isInitialize]|[itemName]|[itemDesc],...
|
||||||
${objectDict} Create Dictionary
|
${objectDict} Create Dictionary
|
||||||
... objectType=url
|
... objectType=url
|
||||||
... isValid=${1}
|
... isValid=${1}
|
||||||
|
|||||||
@@ -43,8 +43,11 @@ ObjectParamsOpertion
|
|||||||
Run Keyword If "${return}"!="FAIL" and "${objectDesc}"!="${EMPTY}" Set To Dictionary ${returnDict} objectDesc=${objectDesc}
|
Run Keyword If "${return}"!="FAIL" and "${objectDesc}"!="${EMPTY}" Set To Dictionary ${returnDict} objectDesc=${objectDesc}
|
||||||
... ELSE Set To Dictionary ${returnDict} objectDesc=${Default_ObjectDesc}
|
... ELSE Set To Dictionary ${returnDict} objectDesc=${Default_ObjectDesc}
|
||||||
${return} ${subObjectIds} Run Keyword And Ignore Error Set Variable ${objectList}[subObjectIds]
|
${return} ${subObjectIds} Run Keyword And Ignore Error Set Variable ${objectList}[subObjectIds]
|
||||||
Run Keyword If "${return}"!="FAIL" and "${subObjectIds}"!="${EMPTY}" Set To Dictionary ${returnDict} subObjectIds=${subObjectIds}
|
${subObjectIdsV} Run Keyword If "${return}"!="FAIL" and "${subObjectIds}"!="${EMPTY}" and "${subObjectIds}"!="${None}" Evaluate list(map(int, re.split('[,]', '${subObjectIds}'))) re
|
||||||
... ELSE Set To Dictionary ${returnDict} subObjectIds=${emptyList}
|
... ELSE Set Variable ${emptyList}
|
||||||
|
|
||||||
|
Set To Dictionary ${returnDict} subObjectIds=${subObjectIdsV}
|
||||||
|
|
||||||
# 处理AddItemList
|
# 处理AddItemList
|
||||||
ManageAddItemList ${objectList} ${returnDict}
|
ManageAddItemList ${objectList} ${returnDict}
|
||||||
|
|
||||||
|
|||||||
@@ -184,8 +184,8 @@ ManageReferenceObject
|
|||||||
# 处理引用对象字符串
|
# 处理引用对象字符串
|
||||||
[Arguments] ${policyList}
|
[Arguments] ${policyList}
|
||||||
${emptyList} Create List
|
${emptyList} Create List
|
||||||
${clientHostObj} Run Keyword If '${addTestClentIPFlag}'=='1' ManageClientObject
|
Run Keyword If '${addTestClentIPFlag}'=='1' ManageClientObject ${emptyList}
|
||||||
Run Keyword If "${clientHostObj}"!="${None}" Append To List ${emptyList} ${clientHostObj}
|
# Run Keyword If "${clientHostObj}"!="${None}" Append To List ${emptyList} ${clientHostObj}
|
||||||
|
|
||||||
${defaultObj} Create Dictionary
|
${defaultObj} Create Dictionary
|
||||||
${return} ${referenceObject} Run Keyword And Ignore Error Set Variable ${policyList}[referenceObject]
|
${return} ${referenceObject} Run Keyword And Ignore Error Set Variable ${policyList}[referenceObject]
|
||||||
@@ -200,10 +200,14 @@ ManageReferenceObject
|
|||||||
Set To Dictionary ${policyList} referenceObject=${emptyList}
|
Set To Dictionary ${policyList} referenceObject=${emptyList}
|
||||||
|
|
||||||
ManageClientObject
|
ManageClientObject
|
||||||
|
[Arguments] ${emptyList}
|
||||||
# 增加引用测试终端IP策略对象
|
# 增加引用测试终端IP策略对象
|
||||||
${emptyList} Create List TSG_SECURITY_SOURCE_ADDR
|
${list1} Create List TSG_SECURITY_SOURCE_ADDR
|
||||||
${obj} Create Dictionary objectId=${testClentID} protocolFields=${emptyList}
|
${obj1} Create Dictionary objectId=${testClentID} protocolFields=${list1}
|
||||||
[Return] ${obj}
|
Append To List ${emptyList} ${obj1}
|
||||||
|
# ${list2} Create List null
|
||||||
|
# ${obj2} Create Dictionary objectId=${testClentSubID} protocolFields=${list2}
|
||||||
|
# Append To List ${emptyList} ${obj2}
|
||||||
|
|
||||||
|
|
||||||
AnalysisReferenceObject
|
AnalysisReferenceObject
|
||||||
|
|||||||
@@ -22,10 +22,17 @@ ${Default_IsInitialize} ${0}
|
|||||||
${Default_IsExclusion} ${0}
|
${Default_IsExclusion} ${0}
|
||||||
${Default_ObjectName} autotestobj
|
${Default_ObjectName} autotestobj
|
||||||
${Default_ObjectDesc} autotestobj
|
${Default_ObjectDesc} autotestobj
|
||||||
${Default_AddItem_AddrType} ${4}
|
${Default_SubObjectIds} ${None}
|
||||||
${Default_AddItem_Protocol} ${0}
|
${Default_AddItem_AddrType} ${4}
|
||||||
${Default_AddItem_Direction} ${0}
|
${Default_AddItem_Protocol} ${0}
|
||||||
${Default_AddItem_IsSession} endpoint
|
${Default_AddItem_Direction} ${0}
|
||||||
|
${Default_AddItem_IsSession} endpoint
|
||||||
|
${Default_AddItem_ServerIpFormat} range
|
||||||
|
${Default_AddItem_ServerIp1} ${EMPTY}
|
||||||
|
${Default_AddItem_ServerIp2} ${EMPTY}
|
||||||
|
${Default_AddItem_ServerPort} ${0}/${0}
|
||||||
|
${Default_AddItem_IsHexbin} ${0}
|
||||||
|
${Default_AddItem_IsInitialize} ${0}
|
||||||
|
${Default_AddItem_ItemName} ${EMPTY}
|
||||||
|
${Default_AddItem_ItemDesc} ${EMPTY}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user