2020-12-15 19:58:08 +08:00
|
|
|
|
*** Settings ***
|
2020-12-25 15:10:10 +08:00
|
|
|
|
Test Teardown DelPolicysAndGroupObjects ${policyIds} ${objectIds}
|
2020-12-15 19:58:08 +08:00
|
|
|
|
Resource ../../common/ApiHttpRequest.robot
|
|
|
|
|
|
Resource ../../common/Util.robot
|
|
|
|
|
|
Resource ApiPolicyRequest.robot
|
2021-01-07 10:24:42 +08:00
|
|
|
|
Resource PolicyJsonVariable.robot
|
2020-12-15 19:58:08 +08:00
|
|
|
|
Variables ../../../05-Other/variable/policy/apipolicyrequesttest.py
|
2021-01-07 10:24:42 +08:00
|
|
|
|
Variables ../../../05-Other/variable/policy/apipolicyjsonbase.py
|
|
|
|
|
|
Resource ../../../03-Variable/ApplicationID.txt
|
2020-12-25 15:10:10 +08:00
|
|
|
|
#Resource ../../tsg_bfapi/PolicyObject.robot
|
2020-12-15 19:58:08 +08:00
|
|
|
|
|
|
|
|
|
|
*** Variables ***
|
2021-01-07 10:24:42 +08:00
|
|
|
|
${policyIds}
|
|
|
|
|
|
${objectIds}
|
2020-12-15 19:58:08 +08:00
|
|
|
|
*** Test Cases ***
|
|
|
|
|
|
Test-GetRequestResposeCodePrivate
|
|
|
|
|
|
[Tags] test
|
|
|
|
|
|
${data} Set Variable pageSize=20&pageNo=1&policyType=tsg_security
|
|
|
|
|
|
${code} GetRequestResposeCodePrivate ${data}
|
|
|
|
|
|
Should Be Equal As Strings ${code} 200
|
|
|
|
|
|
log ${code}
|
|
|
|
|
|
|
|
|
|
|
|
Test-AddPolicyData
|
|
|
|
|
|
[Tags] test
|
2020-12-25 15:10:10 +08:00
|
|
|
|
#获取当前Case名称
|
|
|
|
|
|
log ${TEST NAME}
|
|
|
|
|
|
#从变量文件中加载的新增对象JSON串
|
2021-01-07 10:24:42 +08:00
|
|
|
|
log ${Test-AddPolicyData_IP_OBJ}
|
|
|
|
|
|
${Test-AddPolicyData_IP_OBJ} Replace String ${Test-AddPolicyData_IP_OBJ} "objectName":"autotest" "objectName":"${TEST NAME}_IP_OBJ"
|
2020-12-25 15:10:10 +08:00
|
|
|
|
#add Object,return statuscode,objectid 多个返回以英文逗号分隔
|
2021-01-07 10:24:42 +08:00
|
|
|
|
${returncode} ${ipid} AddObjectData 1 ${Test-AddPolicyData_IP_OBJ}
|
2020-12-25 15:10:10 +08:00
|
|
|
|
#新增对象添加到删除对象列表,及时添加避免下面异常导致遗留垃圾数据
|
|
|
|
|
|
${objectid} Set Variable ${ipid}
|
|
|
|
|
|
${objectIds} Create List [${objectid}]
|
|
|
|
|
|
#从变量文件中加载的新增对象JSON串
|
2021-01-07 10:24:42 +08:00
|
|
|
|
log ${Test-AddPolicyData_FQDN_OBJ}
|
|
|
|
|
|
${Test-AddPolicyData_FQDN_OBJ} Replace String ${Test-AddPolicyData_FQDN_OBJ} "objectName":"autotest" "objectName":"${TEST NAME}_FQDN_OBJ"
|
2020-12-25 15:10:10 +08:00
|
|
|
|
#add Object,return statcode,objectid
|
2021-01-07 10:24:42 +08:00
|
|
|
|
${returncode} ${fqdnid} AddObjectData 1 ${Test-AddPolicyData_FQDN_OBJ}
|
2020-12-25 15:10:10 +08:00
|
|
|
|
#新增对象添加到删除对象列表,及时添加避免下面异常导致遗留垃圾数据
|
|
|
|
|
|
${objectid} Catenate SEPARATOR=, ${objectid} ${fqdnid}
|
|
|
|
|
|
${objectIds} Create List [${objectid}]
|
|
|
|
|
|
#从变量文件中加载的新增策略的JSON串
|
2021-01-07 10:24:42 +08:00
|
|
|
|
log ${Test-AddPolicyData_SECURITY_POLICY}
|
2020-12-25 15:10:10 +08:00
|
|
|
|
#替换策略中的引用内容,需要在变量文件中提前固定内容
|
|
|
|
|
|
#替换策略中的引用内容,源、目的对象对象引用
|
2021-01-07 10:24:42 +08:00
|
|
|
|
${Test-AddPolicyData_SECURITY_POLICY} Replace String ${Test-AddPolicyData_SECURITY_POLICY} ${TEST NAME}_IP_OBJ ${ipid}
|
2020-12-25 15:10:10 +08:00
|
|
|
|
#替换策略中的引用内容,filter,sni对象对象引用
|
2021-01-07 10:24:42 +08:00
|
|
|
|
${Test-AddPolicyData_SECURITY_POLICY} Replace String ${Test-AddPolicyData_SECURITY_POLICY} ${TEST NAME}_FQDN_OBJ ${fqdnid}
|
2020-12-25 15:10:10 +08:00
|
|
|
|
#替换策略中的策略名称
|
2021-01-07 10:24:42 +08:00
|
|
|
|
${Test-AddPolicyData_SECURITY_POLICY} Replace String ${Test-AddPolicyData_SECURITY_POLICY} "policyName":"autotest" "policyName":"${TEST NAME}_Security_PName"
|
|
|
|
|
|
log ${Test-AddPolicyData_SECURITY_POLICY}
|
2020-12-25 15:10:10 +08:00
|
|
|
|
#add Policy,return statuscode,policyid 多个返回以逗号分隔
|
2021-01-07 10:24:42 +08:00
|
|
|
|
${returncode} ${policyid} AddPolicyData 1 ${Test-AddPolicyData_SECURITY_POLICY}
|
|
|
|
|
|
#新增对象添加到删除策略列表,及时添加避免后面异常导致遗留垃圾数据
|
|
|
|
|
|
${policyId1} Set Variable {"policyType":"tsg_security","policyIds":[${policyid}]}
|
|
|
|
|
|
${policyIds} Create List ${policyId1}
|
|
|
|
|
|
Test-AddPolicyData1
|
|
|
|
|
|
[Tags] test
|
|
|
|
|
|
#获取当前Case名称
|
|
|
|
|
|
log ${TEST NAME}
|
|
|
|
|
|
|
|
|
|
|
|
${destination} Set Variable ${EMPTY}
|
|
|
|
|
|
#从变量文件中加载的新增对象JSON串
|
|
|
|
|
|
log ${Test-AddPolicyData1_IP_OBJ}
|
|
|
|
|
|
${Test-AddPolicyData1_IP_OBJ} Replace String ${Test-AddPolicyData1_IP_OBJ} "objectName":"autotest" "objectName":"${TEST NAME}_IP_OBJ"
|
|
|
|
|
|
#add Object,return statuscode,objectid 多个返回以英文逗号分隔
|
|
|
|
|
|
${returncode} ${ipid} AddObjectData 1 ${Test-AddPolicyData1_IP_OBJ}
|
|
|
|
|
|
#新增对象添加到删除对象列表,及时添加避免下面异常导致遗留垃圾数据
|
|
|
|
|
|
${objectid} Set Variable ${ipid}
|
|
|
|
|
|
${objectIds} Create List [${objectid}]
|
|
|
|
|
|
${destination} Set Variable {"objectId": ${objectid},"protocolField":"TSG_SECURITY_DESTINATION_ADDR"}
|
|
|
|
|
|
#从变量文件中加载的新增对象JSON串
|
|
|
|
|
|
log ${Test-AddPolicyData1_FQDN_OBJ}
|
|
|
|
|
|
${Test-AddPolicyData1_FQDN_OBJ} Replace String ${Test-AddPolicyData1_FQDN_OBJ} "objectName":"autotest" "objectName":"${TEST NAME}_FQDN_OBJ"
|
|
|
|
|
|
#add Object,return statcode,objectid
|
|
|
|
|
|
${returncode} ${fqdnid} AddObjectData 1 ${Test-AddPolicyData1_FQDN_OBJ}
|
|
|
|
|
|
#新增对象添加到删除对象列表,及时添加避免下面异常导致遗留垃圾数据
|
|
|
|
|
|
${objectid} Catenate SEPARATOR=, ${objectid} ${fqdnid}
|
|
|
|
|
|
${objectIds} Create List [${objectid}]
|
|
|
|
|
|
#从变量文件中加载的新增对象JSON串
|
|
|
|
|
|
log ${Test-AddPolicyData1_IPLEARN_OBJ}
|
|
|
|
|
|
${Test-AddPolicyData1_IPLEARN_OBJ} Replace String ${Test-AddPolicyData1_IPLEARN_OBJ} "objectName":"autotest" "objectName":"${TEST NAME}_IPLEARN_OBJ"
|
|
|
|
|
|
#add Object,return statcode,objectid
|
|
|
|
|
|
${returncode} ${iplearnid} AddObjectData 1 ${Test-AddPolicyData1_IPLEARN_OBJ}
|
|
|
|
|
|
#新增对象添加到删除对象列表,及时添加避免下面异常导致遗留垃圾数据
|
|
|
|
|
|
${objectid} Catenate SEPARATOR=, ${objectid} ${iplearnid}
|
|
|
|
|
|
${objectIds} Create List [${objectid}]
|
|
|
|
|
|
${destination} Set Variable ${destination},{"objectId": ${iplearnid},"protocolField":"TSG_SECURITY_DESTINATION_ADDR"}
|
|
|
|
|
|
#从变量文件中加载的新增对象JSON串
|
|
|
|
|
|
log ${Test-AddPolicyData1_IPGEO_OBJ}
|
|
|
|
|
|
${Test-AddPolicyData1_IPGEO_OBJ} Replace String ${Test-AddPolicyData1_IPGEO_OBJ} "objectName":"autotest" "objectName":"${TEST NAME}_IPGEO_OBJ"
|
|
|
|
|
|
#add Object,return statcode,objectid
|
|
|
|
|
|
${returncode} ${ipgeoid} AddObjectData 1 ${Test-AddPolicyData1_IPGEO_OBJ}
|
|
|
|
|
|
#新增对象添加到删除对象列表,及时添加避免下面异常导致遗留垃圾数据
|
|
|
|
|
|
${objectid} Catenate SEPARATOR=, ${objectid} ${ipgeoid}
|
|
|
|
|
|
${objectIds} Create List [${objectid}]
|
|
|
|
|
|
${destination} Set Variable ${destination},{"objectId": ${ipgeoid},"protocolField":"TSG_SECURITY_DESTINATION_LOCATION"}
|
|
|
|
|
|
#从变量文件中加载的新增策略的JSON串
|
|
|
|
|
|
log ${Test-AddPolicyData1_SECURITY_POLICY}
|
|
|
|
|
|
#替换策略中的引用内容,需要在变量文件中提前固定内容
|
|
|
|
|
|
#替换策略中的引用内容,源对象对象引用
|
|
|
|
|
|
${Test-AddPolicyData1_SECURITY_POLICY} Replace String ${Test-AddPolicyData1_SECURITY_POLICY} ${TEST NAME}_IP_OBJ ${ipid}
|
|
|
|
|
|
#替换策略中的引用内容,目的对象引用
|
|
|
|
|
|
${Test-AddPolicyData1_SECURITY_POLICY} Replace String ${Test-AddPolicyData1_SECURITY_POLICY} ${TEST NAME}_DESTINATION ${destination}
|
|
|
|
|
|
#替换策略中的引用内容,filter,sni对象对象引用
|
|
|
|
|
|
${Test-AddPolicyData1_SECURITY_POLICY} Replace String ${Test-AddPolicyData1_SECURITY_POLICY} ${TEST NAME}_FQDN_OBJ ${fqdnid}
|
|
|
|
|
|
#替换策略中的策略名称
|
|
|
|
|
|
${Test-AddPolicyData_SECURITY_POLICY} Replace String ${Test-AddPolicyData1_SECURITY_POLICY} "policyName":"autotest" "policyName":"${TEST NAME}_Security_PName"
|
|
|
|
|
|
log ${Test-AddPolicyData_SECURITY_POLICY}
|
|
|
|
|
|
#add Policy,return statuscode,policyid 多个返回以逗号分隔
|
|
|
|
|
|
${returncode} ${policyid} AddPolicyData 1 ${Test-AddPolicyData1_SECURITY_POLICY}
|
2020-12-25 15:10:10 +08:00
|
|
|
|
#新增对象添加到删除策略列表,及时添加避免后面异常导致遗留垃圾数据
|
|
|
|
|
|
${policyId1} set Variable {"policyType":"tsg_security","policyIds":[${policyid}]}
|
|
|
|
|
|
${policyIds} Create List ${policyId1}
|
2021-01-07 10:24:42 +08:00
|
|
|
|
|
|
|
|
|
|
Test-Policy-Test
|
|
|
|
|
|
[Tags] test
|
|
|
|
|
|
#获取当前Case名称
|
|
|
|
|
|
${sourcejson} Set Variable ${EMPTY}
|
|
|
|
|
|
${destjson} Set Variable ${EMPTY}
|
|
|
|
|
|
${filterjson} Set Variable ${EMPTY}
|
|
|
|
|
|
${iconColor} Set Variable 31739C
|
|
|
|
|
|
log ${TEST NAME}
|
|
|
|
|
|
#IP对象
|
|
|
|
|
|
${parmList} Create List 1.1.1.2 0-65535
|
|
|
|
|
|
${ipObjs} JsonIPItem ${parmList}
|
|
|
|
|
|
${parmList} Create List 1.1.1.1-1.1.1.200 1-65535
|
|
|
|
|
|
${ipObj} JsonIPItem ${parmList}
|
|
|
|
|
|
${ipObjs} Catenate SEPARATOR=, ${ipObjs} ${ipObj}
|
|
|
|
|
|
${parmList} Create List 2.2.2.2/24 443
|
|
|
|
|
|
${ipObj} JsonIPItem ${parmList}
|
|
|
|
|
|
${ipObjs} Catenate SEPARATOR=, ${ipObjs} ${ipObj}
|
|
|
|
|
|
${parmList} Create List a1::b1 0-65535
|
|
|
|
|
|
${ipObj} JsonIPItem ${parmList}
|
|
|
|
|
|
${ipObjs} Catenate SEPARATOR=, ${ipObjs} ${ipObj}
|
|
|
|
|
|
${parmList} Create List a1::b1-a1::b15 1-65535
|
|
|
|
|
|
${ipObj} JsonIPItem ${parmList}
|
|
|
|
|
|
${ipObjs} Catenate SEPARATOR=, ${ipObjs} ${ipObj}
|
|
|
|
|
|
${parmList} Create List a1::b1/128 8080
|
|
|
|
|
|
${ipObj} JsonIPItem ${parmList}
|
|
|
|
|
|
${ipObjs} Catenate SEPARATOR=, ${ipObjs} ${ipObj}
|
|
|
|
|
|
${parmList} Create List 192.168.0.1 0-65535
|
|
|
|
|
|
${ipObj} JsonIPItem ${parmList}
|
|
|
|
|
|
${ipObjs} Catenate SEPARATOR=, ${ipObjs} ${ipObj}
|
|
|
|
|
|
#拼接obj对象
|
|
|
|
|
|
# ${parmList} ${objectType} 0 ${objectSubType} 1 ${objectName} 2 ${addItemList} 3 ${updateItemList} 4 ${deleteItemIds} 5 ${subObjectIds} 6 ${ipLearning} 7
|
|
|
|
|
|
${parmList} Create List ip endpoint ${TEST NAME}_IP ${ipObjs} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${iconColor}
|
|
|
|
|
|
${ipObjjson} JsonOBJ ${parmList}
|
|
|
|
|
|
#拼接新增json
|
|
|
|
|
|
#${parmList}:${opAction}0 ${returnData} 1 ${objectList} 2
|
|
|
|
|
|
${parmList} Create List add 1 ${ipObjjson}
|
|
|
|
|
|
${ipObjjson} JsonOBJS ${parmList}
|
|
|
|
|
|
#add Object,return statuscode,objectid 多个返回以英文逗号分隔
|
|
|
|
|
|
${returncode} ${ipid} AddObjectData 1 ${ipObjjson}
|
|
|
|
|
|
#新增对象添加到删除对象列表,及时添加避免下面异常导致遗留垃圾数据
|
|
|
|
|
|
${objectid} Set Variable ${ipid}
|
|
|
|
|
|
${objectIds} Create List [${objectid}]
|
|
|
|
|
|
${sourcejson} Set Variable {"objectId" : ${ipid},"protocolField" : "TSG_SECURITY_SOURCE_ADDR"}
|
|
|
|
|
|
${destjson} Set Variable {"objectId" : ${ipid},"protocolField" : "TSG_SECURITY_DESTINATION_ADDR"}
|
|
|
|
|
|
|
|
|
|
|
|
#Geo对象
|
|
|
|
|
|
${parmList} Create List Armenia.Abovyan.*
|
|
|
|
|
|
${ipGeos} JsonGEOItem ${parmList}
|
|
|
|
|
|
${parmList} Create List Armenia.Agarak.*
|
|
|
|
|
|
${ipGeo} JsonGEOItem ${parmList}
|
|
|
|
|
|
${ipGeos} Catenate SEPARATOR=, ${ipGeos} ${ipGeo}
|
|
|
|
|
|
#拼接obj对象
|
|
|
|
|
|
# ${parmList} ${objectType} 0 ${objectSubType} 1 ${objectName} 2 ${addItemList} 3 ${updateItemList} 4 ${deleteItemIds} 5 ${subObjectIds} 6 ${ipLearning} 7
|
|
|
|
|
|
${parmList} Create List ip geo_location ${TEST NAME}_GEO ${ipGeos} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${iconColor}
|
|
|
|
|
|
${ipGeojson} JsonOBJ ${parmList}
|
|
|
|
|
|
#拼接新增json
|
|
|
|
|
|
#${parmList}:${opAction}0 ${returnData} 1 ${objectList} 2
|
|
|
|
|
|
${parmList} Create List add 1 ${ipGeojson}
|
|
|
|
|
|
${ipObjjson} JsonOBJS ${parmList}
|
|
|
|
|
|
#add Object,return statuscode,objectid 多个返回以英文逗号分隔
|
|
|
|
|
|
${returncode} ${ipid} AddObjectData 1 ${ipObjjson}
|
|
|
|
|
|
#新增对象添加到删除对象列表,及时添加避免下面异常导致遗留垃圾数据
|
|
|
|
|
|
${objectid} Catenate SEPARATOR=, ${objectid} ${ipid}
|
|
|
|
|
|
${objectIds} Create List [${objectid}]
|
|
|
|
|
|
${sourcejson} Catenate SEPARATOR=, ${sourcejson} {"objectId" : ${ipid},"protocolField" : "TSG_SECURITY_SOURCE_LOCATION"}
|
|
|
|
|
|
${destjson} Catenate SEPARATOR=, ${destjson} {"objectId" : ${ipid},"protocolField" : "TSG_SECURITY_DESTINATION_LOCATION"}
|
|
|
|
|
|
|
|
|
|
|
|
#IPLEARN对象
|
|
|
|
|
|
#${parmList}:${fromFqdns} ${fromProtocol} ${learningDepth} ${agingTime} ${voteClientNum} ${learnedIpLimit}
|
|
|
|
|
|
${parmList} Create List "*abc.com","$www.dce.com" HTTP,SSL 2 48 20 10000
|
|
|
|
|
|
${ipLearns} JsonIPLEARNItem ${parmList}
|
|
|
|
|
|
#拼接obj对象
|
|
|
|
|
|
# ${parmList} ${objectType} 0 ${objectSubType} 1 ${objectName} 2 ${addItemList} 3 ${updateItemList} 4 ${deleteItemIds} 5 ${subObjectIds} 6 ${ipLearning} 7
|
|
|
|
|
|
${parmList} Create List ip ip_learning ${TEST NAME}_IPLEARN ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${ipLearns} ${iconColor}
|
|
|
|
|
|
${ipLearnjson} JsonOBJ ${parmList}
|
|
|
|
|
|
#拼接新增json
|
|
|
|
|
|
#${parmList}:${opAction}0 ${returnData} 1 ${objectList} 2
|
|
|
|
|
|
${parmList} Create List add 1 ${ipLearnjson}
|
|
|
|
|
|
${ipObjjson} JsonOBJS ${parmList}
|
|
|
|
|
|
#add Object,return statuscode,objectid 多个返回以英文逗号分隔
|
|
|
|
|
|
${returncode} ${ipid} AddObjectData 1 ${ipObjjson}
|
|
|
|
|
|
#新增对象添加到删除对象列表,及时添加避免下面异常导致遗留垃圾数据
|
|
|
|
|
|
${objectid} Catenate SEPARATOR=, ${objectid} ${ipid}
|
|
|
|
|
|
${objectIds} Create List [${objectid}]
|
|
|
|
|
|
${sourcejson} Catenate SEPARATOR=, ${sourcejson} {"objectId" : ${ipid},"protocolField" : "TSG_SECURITY_SOURCE_ADDR"}
|
|
|
|
|
|
${destjson} Catenate SEPARATOR=, ${destjson} {"objectId" : ${ipid},"protocolField" : "TSG_SECURITY_DESTINATION_ADDR"}
|
|
|
|
|
|
|
|
|
|
|
|
#subid对象
|
|
|
|
|
|
#${parmList}:${itemId} ${keywordArray} ${isHexbin} ${isInitialize}
|
|
|
|
|
|
#创建拼接对象参数list
|
|
|
|
|
|
${parmList} Create List ${EMPTY} $test1 0 0
|
|
|
|
|
|
#调用关键字生成对象itemjson
|
|
|
|
|
|
${subids} JsonKeywords ${parmList}
|
|
|
|
|
|
#添加另一个 创建拼接对象参数list
|
|
|
|
|
|
${parmList} Create List ${EMPTY} $test62 0 0
|
|
|
|
|
|
${subid} JsonKeywords ${parmList}
|
|
|
|
|
|
${subids} Catenate SEPARATOR=, ${subids} ${subid}
|
|
|
|
|
|
#拼接obj对象
|
|
|
|
|
|
# ${parmList} ${objectType} 0 ${objectSubType} 1 ${objectName} 2 ${addItemList} 3 ${updateItemList} 4 ${deleteItemIds} 5 ${subObjectIds} 6 ${ipLearning} 7
|
|
|
|
|
|
${parmList} Create List subscriberid subscriberid ${TEST NAME}_SUBID ${subids} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${iconColor}
|
|
|
|
|
|
${subidjson} JsonOBJ ${parmList}
|
|
|
|
|
|
#拼接新增json
|
|
|
|
|
|
#${parmList}:${opAction}0 ${returnData} 1 ${objectList} 2
|
|
|
|
|
|
${parmList} Create List add 1 ${subidjson}
|
|
|
|
|
|
${subidjson} JsonOBJS ${parmList}
|
|
|
|
|
|
#add Object,return statuscode,objectid 多个返回以英文逗号分隔
|
|
|
|
|
|
${returncode} ${subidid} AddObjectData 1 ${subidjson}
|
|
|
|
|
|
${objectid} Catenate SEPARATOR=, ${objectid} ${subidid}
|
|
|
|
|
|
${objectIds} Create List [${objectid}]
|
|
|
|
|
|
${sourcejson} Catenate SEPARATOR=, ${sourcejson} {"objectId" : ${subidid},"protocolField" : ""}
|
|
|
|
|
|
#${destjson} Catenate SEPARATOR=, ${destjson} {"objectId" : ${subidid},"protocolField" : ""}
|
|
|
|
|
|
|
|
|
|
|
|
#fqdn对象
|
|
|
|
|
|
#${parmList}:${itemId} ${keywordArray} ${isHexbin} ${isInitialize}
|
|
|
|
|
|
${parmList} Create List ${EMPTY} $www.abc.com 0 0
|
|
|
|
|
|
${fqdns} JsonKeywords ${parmList}
|
|
|
|
|
|
${parmList} Create List ${EMPTY} *.abc.com 0 0
|
|
|
|
|
|
${fqdn} JsonKeywords ${parmList}
|
|
|
|
|
|
${fqdns} Catenate SEPARATOR=, ${fqdns} ${fqdn}
|
|
|
|
|
|
#拼接obj对象
|
|
|
|
|
|
# ${parmList} ${objectType} 0 ${objectSubType} 1 ${objectName} 2 ${addItemList} 3 ${updateItemList} 4 ${deleteItemIds} 5 ${subObjectIds} 6 ${ipLearning} 7
|
|
|
|
|
|
${parmList} Create List fqdn fqdn ${TEST NAME}_FQDN ${fqdns} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${iconColor}
|
|
|
|
|
|
${fqdnjson} JsonOBJ ${parmList}
|
|
|
|
|
|
#拼接新增json
|
|
|
|
|
|
#${parmList}:${opAction}0 ${returnData} 1 ${objectList} 2
|
|
|
|
|
|
${parmList} Create List add 1 ${fqdnjson}
|
|
|
|
|
|
${fqdnjson} JsonOBJS ${parmList}
|
|
|
|
|
|
#add Object,return statuscode,objectid 多个返回以英文逗号分隔
|
|
|
|
|
|
${returncode} ${fqdnidSub} AddObjectData 1 ${fqdnjson}
|
|
|
|
|
|
#新增对象添加到删除对象列表,及时添加避免下面异常导致遗留垃圾数据
|
|
|
|
|
|
#${objectid} Catenate SEPARATOR=, ${objectid} ${fqdnid}
|
|
|
|
|
|
${objectIds} Create List [${objectid}] [${fqdnidSub}]
|
|
|
|
|
|
|
|
|
|
|
|
#fqdn对象组
|
|
|
|
|
|
#拼接obj对象
|
|
|
|
|
|
# ${parmList} ${objectType} 0 ${objectSubType} 1 ${objectName} 2 ${addItemList} 3 ${updateItemList} 4 ${deleteItemIds} 5 ${subObjectIds} 6 ${ipLearning} 7
|
|
|
|
|
|
${parmList} Create List fqdn fqdn ${TEST NAME}_FQDN_GROUP ${EMPTY} ${EMPTY} ${EMPTY} ${fqdnidSub} ${EMPTY} ${iconColor}
|
|
|
|
|
|
${fqdnjson} JsonOBJ ${parmList}
|
|
|
|
|
|
#拼接新增json
|
|
|
|
|
|
#${parmList}:${opAction}0 ${returnData} 1 ${objectList} 2
|
|
|
|
|
|
${parmList} Create List add 1 ${fqdnjson}
|
|
|
|
|
|
${fqdnjson} JsonOBJS ${parmList}
|
|
|
|
|
|
#add Object,return statuscode,objectid 多个返回以英文逗号分隔
|
|
|
|
|
|
${returncode} ${fqdnid} AddObjectData 1 ${fqdnjson}
|
|
|
|
|
|
${objectid} Catenate SEPARATOR=, ${objectid} ${fqdnid}
|
|
|
|
|
|
${objectIds} Create List [${objectid}] [${fqdnidSub}]
|
|
|
|
|
|
${filterjson} Set Variable {"objectId" : ${fqdnid},"protocolField" : "TSG_FIELD_SSL_SNI"}
|
|
|
|
|
|
|
|
|
|
|
|
#从变量文件中加载的新增对象JSON串
|
|
|
|
|
|
# ${Test-LoadBase_POLICY}
|
|
|
|
|
|
${appIdObjects} Set Variable ${SSL_ID}
|
|
|
|
|
|
${userRegion} Set Variable "protocol" : "SSL","keyring" : 1,"decryption" : 1,"decrypt_mirror" : {"enable" : 0,"mirror_profile" : null}
|
|
|
|
|
|
${policyDesc} Set Variable ${TEST NAME}_aututest
|
|
|
|
|
|
#~!@#$%^&*()_+{}|:\"><?`1234567890-=\[\]\;\',./mn
|
|
|
|
|
|
${parmList} Create List ${EMPTY} 1 ${TEST NAME}_Policy tsg_security intercept ${EMPTY} 1 ${userRegion} ${sourcejson} ${destjson} ${filterjson} ${appIdObjects} ${policyDesc} ${EMPTY} ${EMPTY} ${EMPTY}
|
|
|
|
|
|
#${policyId}0 ${isValid}1 ${policyName}2 ${policyType}3 ${action}4 ${userTags}5 ${doLog}6 ${userRegion}7 ${source}8 ${destination}9 ${filterList}10 ${appIdObjects}11 ${policyDesc}12 ${effectiveRange}13 ${appSelectorObjects}14 ${scheduleId}15
|
|
|
|
|
|
${policys} JsonPolicy ${parmList}
|
|
|
|
|
|
#log ${Test-LoadBase_POLICYS}
|
|
|
|
|
|
${parmList} Create List add 1 ${policys}
|
|
|
|
|
|
${policysJson} JsonPolicys ${parmList}
|
|
|
|
|
|
#add Object,return statcode,objectid
|
|
|
|
|
|
${returncode} ${policyid} AddPolicyData 1 ${policysJson}
|
2020-12-25 15:10:10 +08:00
|
|
|
|
|
2021-01-07 10:24:42 +08:00
|
|
|
|
#新增对象添加到删除策略列表,及时添加避免后面异常导致遗留垃圾数据
|
|
|
|
|
|
#${policyId1} Set Variable {"policyType":"tsg_security","policyIds":[${policyid}]}
|
|
|
|
|
|
${policyIds} Create List {"policyType":"tsg_security","policyIds":[${policyid}]}
|
|
|
|
|
|
|
|
|
|
|
|
test
|
|
|
|
|
|
#${tWarningMessage} Run Keyword If abcdef AutoItLibrary.Win Get Text Generate Fee Data warning message ELSE Set Variable ""
|
|
|
|
|
|
|
|
|
|
|
|
#${tIfDuplicateFee} Evaluate "Duplicate Fee Warning" in """${tWarningMessage}"""
|
|
|
|
|
|
|
|
|
|
|
|
#${rCheckResult} Evaluate ${totalNumberNew}==${totalNumberOld} or ${totalNumberNew}>${totalNumberOld}
|
|
|
|
|
|
${listtest} Create List {"keywordArray":["base_keywordArray1"],"district":"base_district","itemId":"base_itemId","isHexbin":"base_isHexbin","isInitialize":base_isInitialize} ${EMPTY} {"keywordArray":["base_keywordArray2"],"district":"base_district","itemId":"base_itemId","isHexbin":"base_isHexbin","isInitialize":base_isInitialize}
|
|
|
|
|
|
${fromlist1} Get Slice From List ${listtest} 0 1
|
|
|
|
|
|
${fromlist2} Get Slice From List ${listtest} 1 2
|
|
|
|
|
|
${fromlist2} Get Slice From List ${listtest} 2
|
|
|
|
|
|
${listlenth}= Get Length ${listtest}
|
|
|
|
|
|
#${tempValue} set Variable tempValue
|
|
|
|
|
|
FOR ${var} IN RANGE ${listlenth}
|
|
|
|
|
|
log ${var}
|
|
|
|
|
|
${tempValue${var}} Get From List ${listtest} ${var}
|
|
|
|
|
|
END
|
|
|
|
|
|
|
|
|
|
|
|
# 新建一个list变量
|
|
|
|
|
|
@{list} create list aa bb
|
|
|
|
|
|
# 为list追加数据 同Append To List
|
|
|
|
|
|
@{list} create list @{list} cc
|
|
|
|
|
|
# 为list追加数据 同Append To List
|
|
|
|
|
|
Append To List @{list} dd
|
|
|
|
|
|
|
|
|
|
|
|
#可以获取list的某一段子list,从两端截取或从中间截取
|
|
|
|
|
|
#list的下标从0开始
|
|
|
|
|
|
@{list} Create List lilei hanmeimei liming liliang liming
|
|
|
|
|
|
# 获取从index=1及之后的数据
|
|
|
|
|
|
${fromlist} Get Slice From List ${list} 1
|
|
|
|
|
|
# 获取从index=1~2的数据,不包括第3个
|
|
|
|
|
|
${fromtolist} Get Slice From List ${list} 1 3
|
|
|
|
|
|
|
|
|
|
|
|
#Remove Duplicates-去重
|
|
|
|
|
|
@{list} Create List lilei hanmeimei liming liliang liming
|
|
|
|
|
|
# list去重并检查不包含重复数据
|
|
|
|
|
|
${listnew} Remove Duplicates ${list}
|
|
|
|
|
|
List Should Not Contain Duplicates ${listnew}
|
|
|
|
|
|
|
|
|
|
|
|
# List Should Contain Sub List-包含子list
|
|
|
|
|
|
@{list} Create List lilei hanmeimei liming liliang liming
|
|
|
|
|
|
@{sublist} Create List lilei hanmeimei
|
|
|
|
|
|
# 是否包含子list
|
|
|
|
|
|
List Should Contain Sub List ${list} ${sublist}
|
|
|
|
|
|
#在log中会打印出来去掉了几个重复数据:
|
|
|
|
|
|
#20201015 18:46:47.647 : INFO : 1 duplicate removed.
|
|
|
|
|
|
|
|
|
|
|
|
#5 List Should Contain Sub List-包含子list
|
|
|
|
|
|
@{list} Create List lilei hanmeimei liming liliang liming
|
|
|
|
|
|
@{sublist} Create List lilei hanmeimei
|
|
|
|
|
|
# 是否包含子list
|
|
|
|
|
|
List Should Contain Sub List ${list} ${sublist}
|
|
|
|
|
|
|
|
|
|
|
|
#6、List Should Not Contain Duplicates-判断不存在重复
|
|
|
|
|
|
#示例,去重后,list就不存在重复数据了,最后一行可执行通过:
|
|
|
|
|
|
@{list} Create List lilei hanmeimei liming liliang liming
|
|
|
|
|
|
${listnew} Remove Duplicates ${list}
|
|
|
|
|
|
List Should Not Contain Duplicates ${listnew}
|
|
|
|
|
|
|
|
|
|
|
|
#7 Lists Should Be Equal-判断list相等
|
|
|
|
|
|
#注意:@{list}是robot提供的语法,python并没有@{},只有${},所以要比较两个@{list},需要把@{list},直接写成英文dollar ${list}进行对比
|
|
|
|
|
|
@{list} Create List lilei hanmeimei liming liliang liming
|
|
|
|
|
|
Remove From List ${list} 0
|
|
|
|
|
|
@{list1} Create List hanmeimei liming liliang liming
|
|
|
|
|
|
Lists Should Be Equal ${list} ${list1}
|
|
|
|
|
|
Remove Values From List ${list} liming
|
|
|
|
|
|
@{list2} Create List hanmeimei liliang
|
|
|
|
|
|
Lists Should Be Equal ${list} ${list2}
|
|
|
|
|
|
#如果list转换成了string,也可以使用should be equal来做相等判断
|
|
|
|
|
|
|
|
|
|
|
|
#8 Remove (Values) From List-删除list中某个值
|
|
|
|
|
|
#Remove From List:按照index删除,一次删除1个
|
|
|
|
|
|
#Remove Values From List:按照value值删除,一次可删除多个
|
|
|
|
|
|
|
|
|
|
|
|
#9 Sort List–升序排序
|
|
|
|
|
|
#对list做升序排序,示例:
|
|
|
|
|
|
@{list} Create List lilei hanmeimei liming liliang liming
|
|
|
|
|
|
Sort List ${list}
|
|
|
|
|
|
${list} Convert To String ${list}
|
|
|
|
|
|
Should Be Equal ${list} ['hanmeimei', 'lilei', 'liliang', 'liming', 'liming']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-12-15 19:58:08 +08:00
|
|
|
|
|
|
|
|
|
|
Test-GetRandomIP
|
|
|
|
|
|
[Tags] test
|
|
|
|
|
|
${ip} GetRandomIP ipv4
|
|
|
|
|
|
log ${ip}
|
|
|
|
|
|
${ip} GetRandomIP ipv6
|
|
|
|
|
|
log ${ip}
|
2021-01-07 10:24:42 +08:00
|
|
|
|
${parmList0} Create List 1.1.1.2 0-65535
|
|
|
|
|
|
${parmList1} Create List 1.1.1.1-1.1.1.200 1-65535
|
|
|
|
|
|
${parmList2} Create List 2.2.2.2/24 443
|
|
|
|
|
|
${parmList3} Create List a1::b1 0-65535
|
|
|
|
|
|
${parmList4} Create List a1::b1-a1::b15 1-65535
|
|
|
|
|
|
${parmList5} Create List a1::b1/128 8080
|
|
|
|
|
|
${parmList6} Create List 192.168.0.1 0-65535
|
|
|
|
|
|
${parmList} Create List "protocol" : "SSL","keyring" : 1,"decryption" : 1,"decrypt_mirror" : {"enable" : 0,"mirror_profile" : null} {"enable" : 0,"mirror_profile" : null} ${parmList0} ${parmList1} ${parmList2} ${parmList3} ${parmList4} ${parmList5} ${parmList6}
|
|
|
|
|
|
:FOR ${element} IN @{parmList}
|
|
|
|
|
|
\ LOG ${element}
|
|
|
|
|
|
${s} Set Variable ,{"enable" : 0,"mirror_profile" : null},{"enable" : 0,"mirror_profile" : null},{"enable" : 0,"mirror_profile" : null}
|
|
|
|
|
|
${s} removeBeforOrAfter ${s} [1:]
|
2020-12-15 19:58:08 +08:00
|
|
|
|
|