使用封装的对象和策略关键字添加对象和策略;
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
*** Settings ***
|
*** Settings ***
|
||||||
Test Teardown DeleteAllAfterAdc ${policyIds} ${objectids}
|
Test Teardown DeletePolicyAndObject ${policyIds} ${objectids}
|
||||||
Force Tags tsg_adc tsg_security all_protol
|
Force Tags tsg_adc tsg_security all_protol
|
||||||
Library OperatingSystem
|
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
|
||||||
Library Custometest
|
Library Custometest
|
||||||
Library json
|
Library json
|
||||||
|
|
||||||
@@ -28,9 +28,9 @@ SecurityPolicy-Deny-AllProtol-00001
|
|||||||
${objectDict} Create Dictionary
|
${objectDict} Create Dictionary
|
||||||
... objectType=ip
|
... objectType=ip
|
||||||
... isValid=${1}
|
... isValid=${1}
|
||||||
... addItemList=range|192.168.100.5|192.168.100.5|0/65535
|
... addItemList=CIDR|192.168.100.5|32|0/0
|
||||||
${rescode} ${objectId} AddObject2 ${1} ${objectDict}
|
${rescode} ${objectId} AddObject2 ${1} ${objectDict}
|
||||||
${objectids} set Variable ${object_FQDN_Id}
|
${objectids} set Variable ${objectId}
|
||||||
|
|
||||||
Comment 创建安全策略,针对所有协议,相当于BlackIP
|
Comment 创建安全策略,针对所有协议,相当于BlackIP
|
||||||
${policyDict} Create Dictionary
|
${policyDict} Create Dictionary
|
||||||
@@ -42,18 +42,18 @@ SecurityPolicy-Deny-AllProtol-00001
|
|||||||
... effectiveRange=Nursurtan|Transtelecom&Astel,|Astel&Transtelecom
|
... effectiveRange=Nursurtan|Transtelecom&Astel,|Astel&Transtelecom
|
||||||
... userRegion=method:rst
|
... userRegion=method:rst
|
||||||
... referenceObject=${objectId}|TSG_SECURITY_DESTINATION_ADDR
|
... referenceObject=${objectId}|TSG_SECURITY_DESTINATION_ADDR
|
||||||
... isValid=${0}
|
... isValid=${1}
|
||||||
... appObjectIdArray=2,3,4,5,6
|
... appObjectIdArray=2,3,4,5,6
|
||||||
${rescode} ${policyId} AddPolicy2 ${1} ${policyDict}
|
${rescode} ${policyId} AddPolicy2 ${1} ${policyDict}
|
||||||
${policyId1} set Variable {"policyType":"tsg_security","policyIds":[${policyId}]}
|
${policyId} set Variable {"policyType":"tsg_security","policyIds":[${policyId}]}
|
||||||
|
|
||||||
${s} Convert to String ${policyId}
|
${s} Convert to String ${policyId}
|
||||||
Comment 功能端验证HTTP验证
|
Comment 功能端验证HTTP验证
|
||||||
${commandstr} run keyword if '${systemType}'=='Windows' set variable curl -kv http://open.node.com/ | iconv -f utf-8 -t gbk
|
${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/selfserver/SecurityPolicy-Deny-AllProtol-00001_HTTP.bat
|
||||||
... ELSE set variable curl -kv http://open.node.com/
|
... ELSE set variable curl -kv http://open.node.com/
|
||||||
|
|
||||||
${stringlist} run keyword if '${systemType}'=='Windows' Create List Recv failure: Connection was reset
|
${stringlist} run keyword if '${systemType}'=='Windows' Create List Connection was reset
|
||||||
... ELSE Create List Recv failure: Connection reset by peer
|
... ELSE Create List Connection reset by peer
|
||||||
|
|
||||||
${starttime} Get Time
|
${starttime} Get Time
|
||||||
Sleep ${policyVerificationSleepSeconds}s
|
Sleep ${policyVerificationSleepSeconds}s
|
||||||
@@ -64,11 +64,11 @@ SecurityPolicy-Deny-AllProtol-00001
|
|||||||
GetLogList security_event_log ${starttime} ${endtime} ${testClentIP} ${s} http_host open.node.com
|
GetLogList security_event_log ${starttime} ${endtime} ${testClentIP} ${s} http_host open.node.com
|
||||||
|
|
||||||
Comment 功能端验证SSL验证
|
Comment 功能端验证SSL验证
|
||||||
${commandstr} run keyword if '${systemType}'=='Windows' set variable curl -kv https://open.node.com/ | iconv -f utf-8 -t gbk
|
${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/selfserver/SecurityPolicy-Deny-AllProtol-00001_SSL.bat
|
||||||
... ELSE set variable curl -kv https://open.node.com/
|
... ELSE set variable curl -kv https://open.node.com/
|
||||||
|
|
||||||
${stringlist} run keyword if '${systemType}'=='Windows' Create List Connection was reset
|
${stringlist} run keyword if '${systemType}'=='Windows' Create List Connection was reset
|
||||||
... #OpenSSL SSL_connect: Connection was reset in connection to
|
#OpenSSL SSL_connect: Connection was reset in connection to
|
||||||
#Send failure: Connection was reset
|
#Send failure: Connection was reset
|
||||||
... ELSE Create List OpenSSL SSL_connect: Connection reset by peer in connection to
|
... ELSE Create List OpenSSL SSL_connect: Connection reset by peer in connection to
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ Library OperatingSystem
|
|||||||
Library Selenium2Library
|
Library Selenium2Library
|
||||||
Library Collections
|
Library Collections
|
||||||
Resource ../../../02-Keyword/tsg_bfapi/common.robot
|
Resource ../../../02-Keyword/tsg_bfapi/common.robot
|
||||||
Resource ../../../02-Keyword/tsg_bfapi/policy_file_interface/functionalKeywords.robot
|
Resource ../../../02-Keyword/tsg_bfapi/policy_file_interface/FunctionalKeywords.robot
|
||||||
Resource ../../../03-Variable/bifangapivariable.txt
|
Resource ../../../03-Variable/bifangapivariable.txt
|
||||||
|
|
||||||
*** Variables ***
|
*** Variables ***
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
Resource ../../03-Variable/BifangApiVariable.txt
|
Resource ../../03-Variable/BifangApiVariable.txt
|
||||||
Resource ../tsg_common/ManagePolicyBody.robot
|
Resource ../tsg_common/ManagePolicyBody.robot
|
||||||
Resource ../tsg_common/ManageObjectBody.robot
|
Resource ../tsg_common/ManageObjectBody.robot
|
||||||
|
Resource ../../02-Keyword/tsg_bfapi/policy_file_interface/FunctionalKeywords.robot
|
||||||
Library REST http://${host}:${port}
|
Library REST http://${host}:${port}
|
||||||
Library Collections
|
Library Collections
|
||||||
Library RequestsLibrary
|
Library RequestsLibrary
|
||||||
@@ -11,14 +12,30 @@ Resource Common.robot
|
|||||||
AddLocalIPObject
|
AddLocalIPObject
|
||||||
#创建对象IP
|
#创建对象IP
|
||||||
log to_AddLocalIPObject
|
log to_AddLocalIPObject
|
||||||
${localIP} set variable {"opAction":"add","returnData":1,"objectList":{"objectType":"ip","objectSubType":"endpoint","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"autotestLocalIPObject_${testClentIP}","objectDesc":"LocalIPObject_${testClentIP}自动化测试机IP","subObjectIds":[],"addItemList":[{"addrType":4,"protocol":0,"direction":0,"isSession":"endpoint","clientIp1":"${testClentIP}","clientIp2":"${testClentIP}","clientIpFormat":"range","clientPortFormat":"range","clientPort1":0,"clientPort2":0,"serverIpFormat":"range","serverIp1":"","serverIp2":"","serverPortFormat":"range","serverPort1":0,"serverPort2":0}],"updateItemList":[],"deleteItemIds":[]}}
|
#${localIP} set variable {"opAction":"add","returnData":1,"objectList":{"objectType":"ip","objectSubType":"endpoint","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"autotestLocalIPObject_${testClentIP}","objectDesc":"LocalIPObject_${testClentIP}自动化测试机IP","subObjectIds":[],"addItemList":[{"addrType":4,"protocol":0,"direction":0,"isSession":"endpoint","clientIp1":"${testClentIP}","clientIp2":"${testClentIP}","clientIpFormat":"range","clientPortFormat":"range","clientPort1":0,"clientPort2":0,"serverIpFormat":"range","serverIp1":"","serverIp2":"","serverPortFormat":"range","serverPort1":0,"serverPort2":0}],"updateItemList":[],"deleteItemIds":[]}}
|
||||||
${rescodeip} ${objidip} AddObject ${localIP}
|
#${rescodeip} ${objidip} AddObject ${localIP}
|
||||||
|
#${localSubIP} set variable {"opAction":"add","returnData":1,"objectList":{"objectType":"subscriberid","objectSubType":"","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"test57","objectDesc":"${testSubscriberID}","subObjectIds":[],"addItemList":[{"keywordArray":["${testSubscriberID}"],"itemId":"","isHexbin":0}],"updateItemList":[],"deleteItemIds":[]}}
|
||||||
|
#${rescodesub} ${subiid} AddObject ${localSubIP}
|
||||||
|
# 创建对象-IP
|
||||||
|
Create Dictionary
|
||||||
|
|
||||||
|
${objectDict} Create Dictionary
|
||||||
|
... objectType=ip
|
||||||
|
... objectName=autotest_localIP_${testClentIP}
|
||||||
|
... isValid=${1}
|
||||||
|
... addItemList=range|${testClentIP}|${testClentIP}|0/0
|
||||||
|
${rescode} ${objectId} AddObject2 ${1} ${objectDict}
|
||||||
#log ${rescodeip}
|
#log ${rescodeip}
|
||||||
log LocalIP:${objidip}
|
log LocalIP:${objectId}
|
||||||
SET GLOBAL VARIABLE ${testClentID} ${objidip}
|
SET GLOBAL VARIABLE ${testClentID} ${objectId}
|
||||||
|
|
||||||
log to_AddLocalSubidObject
|
log to_AddLocalSubidObject
|
||||||
${localSubIP} set variable {"opAction":"add","returnData":1,"objectList":{"objectType":"subscriberid","objectSubType":"","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"test57","objectDesc":"${testSubscriberID}","subObjectIds":[],"addItemList":[{"keywordArray":["${testSubscriberID}"],"itemId":"","isHexbin":0}],"updateItemList":[],"deleteItemIds":[]}}
|
${objectDict} Create Dictionary
|
||||||
${rescodesub} ${subiid} AddObject ${localSubIP}
|
... objectType=subscriberid
|
||||||
|
... objectName=autotest_localSubId_${testSubscriberID}
|
||||||
|
... isValid=${1}
|
||||||
|
... addItemList=${testSubscriberID}
|
||||||
|
${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}
|
||||||
@@ -139,3 +156,5 @@ DeletePolicyAndObject
|
|||||||
#删除对象
|
#删除对象
|
||||||
log todeleteobj_DeletePolicyAndObject
|
log todeleteobj_DeletePolicyAndObject
|
||||||
DeleteObject ${objectids}
|
DeleteObject ${objectids}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ ManageReferenceObject
|
|||||||
|
|
||||||
ManageClientObject
|
ManageClientObject
|
||||||
# 增加引用测试终端IP策略对象
|
# 增加引用测试终端IP策略对象
|
||||||
${emptyList} Create List
|
${emptyList} Create List TSG_SECURITY_SOURCE_ADDR
|
||||||
${obj} Create Dictionary objectId=${testClentID} protocolFields=${emptyList}
|
${obj} Create Dictionary objectId=${testClentID} protocolFields=${emptyList}
|
||||||
[Return] ${obj}
|
[Return] ${obj}
|
||||||
|
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
curl -kv https://www.baidu.com | iconv -f utf-8 -t gbk
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
curl -kv https://open.node.com/ | iconv -f utf-8 -t gbk
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
curl -kv http://open.node.com/ | iconv -f utf-8 -t gbk
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
curl -kv https://open.node.com/ | iconv -f utf-8 -t gbk
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
docker images
|
docker images
|
||||||
2、进入docker镜像
|
2、进入docker镜像
|
||||||
docker run -it auto-rf-library:1.0 /bin/bash
|
docker run -it auto-rf-library:1.0 /bin/bash
|
||||||
|
docker run --name autotest.open.node.com --add-host=open.node.com:192.168.100.5 -it auto-rf-library:2.0
|
||||||
3、执行自动化项目
|
3、执行自动化项目
|
||||||
docker run -it -v /home/autoTest_tsg/:/usr/src/python -w /usr/src/python auto-rf-lib:latest[docker最新镜像] -d /newrepot/ robot tsg_autotest0406[project path]
|
docker run -it -v /home/autoTest_tsg/:/usr/src/python -w /usr/src/python auto-rf-lib:latest[docker最新镜像] -d /newrepot/ robot tsg_autotest0406[project path]
|
||||||
执行添加hosts文件:使用自建服务器作为网页访问:
|
执行添加hosts文件:使用自建服务器作为网页访问:
|
||||||
|
|||||||
Reference in New Issue
Block a user