first init project code
This commit is contained in:
11
.project
Normal file
11
.project
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>tsg_autotest</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
||||||
119
01-TestCase/tsg_adc/api_security/AllowHttpTests.robot
Normal file
119
01-TestCase/tsg_adc/api_security/AllowHttpTests.robot
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
*** Settings ***
|
||||||
|
Test Teardown DeletePolicyAndObject ${policyIds} ${objectids}
|
||||||
|
Force Tags tsg_adc tsg_security
|
||||||
|
Library OperatingSystem
|
||||||
|
Resource ../../../02-Keyword/tsg_adc/SystemCommand.robot
|
||||||
|
Resource ../../../02-Keyword/tsg_bfapi/PolicyObject.robot
|
||||||
|
Resource ../../../02-Keyword/tsg_bfapi/LogVariable.robot
|
||||||
|
Resource ../../../03-Variable/BifangApiVariable.txt
|
||||||
|
|
||||||
|
|
||||||
|
*** Test Cases ***
|
||||||
|
SecurityPolicy-Allow-Http-00001
|
||||||
|
[Tags] Allow IP FQDN DENY HTTP
|
||||||
|
#创建对象IP
|
||||||
|
#${rescode} ${object_IP_Id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"ip","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmmtest_IP","objectDesc":"","subObjectIds":[],"addItemList":[{"addrType":4,"protocol":0,"direction":0,"clientIp1":"192.168.50.31","clientIp2":"192.168.50.31","clientIpFormat":"range","clientPortFormat":"","clientPort1":"","clientPort2":"","serverIpFormat":"","serverIp1":"","serverIp2":"","serverPortFormat":"","serverPort1":"","serverPort2":""}],"updateItemList":[],"deleteItemIds":[]}}
|
||||||
|
#log ${object_IP_Id}
|
||||||
|
#创建对象FQDN
|
||||||
|
${rescodeip} ${object_FQDN_Id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"fqdn","objectSubType":"","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"SecurityPolicy-Allow-Http-00001_FQDN_icbc","objectDesc":"","subObjectIds":[],"addItemList":[{"keywordArray":["$www.icbc.com.cn"],"itemId":"","isHexbin":0}],"updateItemList":[],"deleteItemIds":[]}}
|
||||||
|
log ${object_FQDN_Id}
|
||||||
|
${objectids} set Variable ${object_FQDN_Id}
|
||||||
|
#创建 Deny 搭配Allow
|
||||||
|
${addPolicyStr} set variable {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Allow-Http-00001_Deny","policyType":"tsg_security","action":"deny","userTags":"${userTagIds}","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"HTTP","method":"drop"},"referenceObject":[{"objectId":${object_FQDN_Id},"protocolFields":["TSG_FIELD_HTTP_HOST"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[2]}}
|
||||||
|
${addPolicyStr} run keyword if '${addTestClentIPFlag}'=='1' set variable {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Allow-Http-00001_Deny","policyType":"tsg_security","action":"deny","userTags":"${userTagIds}","doBlacklist":0,"doLog":1,"policyDesc":"autotest","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"HTTP","method":"drop"},"referenceObject":[{"objectId":${testClentID},"protocolFields":["TSG_SECURITY_SOURCE_ADDR"]},{"objectId":${object_FQDN_Id},"protocolFields":["TSG_FIELD_HTTP_HOST"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[2]}}
|
||||||
|
log ${addPolicyStr}
|
||||||
|
${rescode} ${policyId1} AddPolicy ${addPolicyStr}
|
||||||
|
log ${policyId1}
|
||||||
|
${policyIds} set Variable {"policyType":"tsg_security","policyIds":[${policyId1}]}
|
||||||
|
#创建allow策略
|
||||||
|
${addPolicyStr} set variable {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Allow-Http-00001","policyType":"tsg_security","action":"allow","userTags":"${userTagIds}","doBlacklist":0,"doLog":1,"policyDesc":"autotest","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"HTTP"},"referenceObject":[],"isValid":1,"scheduleId":[],"appObjectIdArray":[2]}}
|
||||||
|
${addPolicyStr} run keyword if '${addTestClentIPFlag}'=='1' set variable {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Allow-Http-00001","policyType":"tsg_security","action":"allow","userTags":"${userTagIds}","doBlacklist":0,"doLog":1,"policyDesc":"autotest","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"HTTP"},"referenceObject":[{"objectId":${testClentID},"protocolFields":["TSG_SECURITY_SOURCE_ADDR"]},{"objectId":${object_FQDN_Id},"protocolFields":["TSG_FIELD_HTTP_HOST"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[2]}}
|
||||||
|
${rescode} ${policyId2} AddPolicy ${addPolicyStr}
|
||||||
|
log ${policyId2}
|
||||||
|
${policyIds2} set Variable {"policyType":"tsg_security","policyIds":[${policyId2}]}
|
||||||
|
${policyIds1} set Variable {"policyType":"tsg_security","policyIds":[${policyId1}]}
|
||||||
|
${policyIds} Create List ${policyIds1} ${policyIds2}
|
||||||
|
#${rescode} ${policyId} AddPolicy {"opAction":"add","returnData":1,"policyList":{"policyName":"SecurityPolicy-Allow-Http-00001","policyType":"tsg_security","action":"allow","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"HTTP","keyring":1},"referenceObject":[{"objectId":${object_IP_Id},"protocolFields":[]},{"objectId":${object_FQDN_Id},"protocolFields":["TSG_FIELD_HTTP_HOST"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
${starttime} Get Time
|
||||||
|
#功能端验证
|
||||||
|
Sleep ${policyVerificationSleepSeconds}s
|
||||||
|
${commandreturn} OperatingSystem.Run curl -I \ -m \ 10 \ -o \ /dev/null \ -s \ -w \ \ \%{http_code} \ \ http://www.icbc.com.cn
|
||||||
|
should contain ${commandreturn} 200
|
||||||
|
Sleep ${policyLogVerificationSleepSeconds}s
|
||||||
|
${endtime} Get Time
|
||||||
|
#日志验证
|
||||||
|
${s} Convert to String ${policyId2}
|
||||||
|
GetLogList security_event_log ${starttime} ${endtime} ${testClentIP} ${s} http_host icbc
|
||||||
|
|
||||||
|
SecurityPolicy-Allow-Http-00002
|
||||||
|
[Tags] Allow SubID Category DENY HTTP
|
||||||
|
#创建对象Subid
|
||||||
|
${rescode} ${object_Subid_Id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"subscriberid","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"SecurityPolicy-Allow-Http-00002_subid","objectDesc":"","subObjectIds":[],"addItemList":[{"keywordArray":["$zmmtest"],"itemId":"","isHexbin":0}],"updateItemList":[],"deleteItemIds":[]}}
|
||||||
|
log ${object_Subid_Id}
|
||||||
|
${objectids} set Variable ${object_Subid_Id}
|
||||||
|
#创建对象Categry
|
||||||
|
${rescodeip} ${object_Category_Id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"fqdn_category","objectSubType":"","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"SecurityPolicy-Allow-Http-00002-Categry","objectDesc":"autotest","subObjectIds":[],"addItemList":[{"keywordArray":["*www.ccb.com"],"itemId":"","isValid":"","isHexbin":0}],"updateItemList":[],"deleteItemIds":[],"objectId":""}}
|
||||||
|
|
||||||
|
log ${object_Category_Id}
|
||||||
|
${objectids} set Variable ${object_Subid_Id},${object_Category_Id}
|
||||||
|
#创建 Deny 搭配Allow
|
||||||
|
#${addPolicyStr} set variable {"opAction":"add","returnData":1,"policyList":{"policyName":"SecurityPolicy-Allow-Http-00002_deny","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"HTTP","method":"drop","keyring":1},"referenceObject":[{"objectId":${object_Subid_Id} ,"protocolFields":[]},{"objectId":${object_Category_Id} ,"protocolFields":["TSG_FIELD_HTTP_HOST"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
${addPolicyStr} set variable {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Allow-Http-00002_deny","policyType":"tsg_security","action":"deny","userTags":"${userTagIds}","doBlacklist":0,"doLog":1,"policyDesc":"autotest","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"HTTP","method":"drop"},"referenceObject":[{"objectId":${object_Subid_Id},"protocolFields":[null]},{"objectId":${object_Category_Id},"protocolFields":["TSG_FIELD_HTTP_HOST"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[2]}}
|
||||||
|
log ${addPolicyStr}
|
||||||
|
${rescode} ${policyId1} AddPolicy ${addPolicyStr}
|
||||||
|
log ${policyId1}
|
||||||
|
${policyIds} set Variable {"policyType":"tsg_security","policyIds":[${policyId1}]}
|
||||||
|
#创建策略
|
||||||
|
#${addPolicyStr} set variable {"opAction":"add","returnData":1,"policyList":{"policyName":"SecurityPolicy-Allow-Http-00002","policyType":"tsg_security","action":"allow","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"HTTP","keyring":1},"referenceObject":[{"objectId":${object_Subid_Id},"protocolFields":[]},{"objectId":${object_Category_Id},"protocolFields":["TSG_FIELD_HTTP_HOST"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
${addPolicyStr} set variable {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Allow-Http-00002","policyType":"tsg_security","action":"allow","userTags":"${userTagIds}","doBlacklist":0,"doLog":1,"policyDesc":"autotest","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"HTTP"},"referenceObject":[{"objectId":${object_Subid_Id},"protocolFields":[null]},{"objectId":${object_Category_Id},"protocolFields":["TSG_FIELD_HTTP_HOST"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[2]}}
|
||||||
|
${rescode} ${policyId2} AddPolicy ${addPolicyStr}
|
||||||
|
log ${policyId2}
|
||||||
|
${policyIds1} set Variable {"policyType":"tsg_security","policyIds":[${policyId1}]}
|
||||||
|
${policyIds2} set Variable {"policyType":"tsg_security","policyIds":[${policyId2}]}
|
||||||
|
${policyIds} Create List ${policyIds1} ${policyIds2}
|
||||||
|
#功能端验证
|
||||||
|
Sleep ${policyVerificationSleepSeconds}s
|
||||||
|
${starttime} Get Time
|
||||||
|
${commandreturn} OperatingSystem.Run curl -I \ -m \ 10 \ -o \ /dev/null \ -s \ -w \ \ \%{http_code} \ \ http://www.ccb.com
|
||||||
|
should contain ${commandreturn} 200
|
||||||
|
Sleep ${policyLogVerificationSleepSeconds}s
|
||||||
|
${endtime} Get Time
|
||||||
|
#日志验证
|
||||||
|
${s} Convert to String ${policyId2}
|
||||||
|
GetLogList security_event_log ${starttime} ${endtime} ${testClentIP} ${s} http_host ccb
|
||||||
|
|
||||||
|
SecurityPolicy-Allow-Http-00003
|
||||||
|
[Tags] Allow IP FQDN DENY HTTP
|
||||||
|
#创建对象IP
|
||||||
|
#${rescode} ${object_IP_Id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"ip","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmmtest_IP","objectDesc":"","subObjectIds":[],"addItemList":[{"addrType":4,"protocol":0,"direction":0,"clientIp1":"192.168.50.31","clientIp2":"192.168.50.31","clientIpFormat":"range","clientPortFormat":"","clientPort1":"","clientPort2":"","serverIpFormat":"","serverIp1":"","serverIp2":"","serverPortFormat":"","serverPort1":"","serverPort2":""}],"updateItemList":[],"deleteItemIds":[]}}
|
||||||
|
#log ${object_IP_Id}
|
||||||
|
#创建对象FQDN
|
||||||
|
${rescodeip} ${object_FQDN_Id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"fqdn","objectSubType":"","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"SecurityPolicy-Allow-Http-00001_FQDN_xiaozhu","objectDesc":"","subObjectIds":[],"addItemList":[{"keywordArray":["*.xiaozhu.com"],"itemId":"","isHexbin":0}],"updateItemList":[],"deleteItemIds":[]}}
|
||||||
|
log ${object_FQDN_Id}
|
||||||
|
${objectids} set Variable ${object_FQDN_Id}
|
||||||
|
#创建 Deny 搭配Allow
|
||||||
|
${addPolicyStr} set variable {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Allow-Http-00003_Deny","policyType":"tsg_security","action":"deny","userTags":"${userTagIds}","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"HTTP","method":"drop"},"referenceObject":[{"objectId":${object_FQDN_Id},"protocolFields":["TSG_FIELD_HTTP_HOST"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[2]}}
|
||||||
|
${addPolicyStr} run keyword if '${addTestClentIPFlag}'=='1' set variable {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Allow-Http-00001_Deny","policyType":"tsg_security","action":"deny","userTags":"${userTagIds}","doBlacklist":0,"doLog":1,"policyDesc":"autotest","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"HTTP","method":"drop"},"referenceObject":[{"objectId":${testClentID},"protocolFields":["TSG_SECURITY_SOURCE_ADDR"]},{"objectId":${object_FQDN_Id},"protocolFields":["TSG_FIELD_HTTP_HOST"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[2]}}
|
||||||
|
log ${addPolicyStr}
|
||||||
|
${rescode} ${policyId1} AddPolicy ${addPolicyStr}
|
||||||
|
log ${policyId1}
|
||||||
|
${policyIds} set Variable {"policyType":"tsg_security","policyIds":[${policyId1}]}
|
||||||
|
#创建allow策略
|
||||||
|
${addPolicyStr} set variable {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Allow-Http-00003","policyType":"tsg_security","action":"allow","userTags":"${userTagIds}","doBlacklist":0,"doLog":1,"policyDesc":"autotest","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"HTTP"},"referenceObject":[],"isValid":1,"scheduleId":[],"appObjectIdArray":[2]}}
|
||||||
|
${addPolicyStr} run keyword if '${addTestClentIPFlag}'=='1' set variable {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Allow-Http-00001","policyType":"tsg_security","action":"allow","userTags":"${userTagIds}","doBlacklist":0,"doLog":1,"policyDesc":"autotest","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"HTTP"},"referenceObject":[{"objectId":${testClentID},"protocolFields":["TSG_SECURITY_SOURCE_ADDR"]},{"objectId":${object_FQDN_Id},"protocolFields":["TSG_FIELD_HTTP_HOST"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[2]}}
|
||||||
|
${rescode} ${policyId2} AddPolicy ${addPolicyStr}
|
||||||
|
log ${policyId2}
|
||||||
|
${policyIds2} set Variable {"policyType":"tsg_security","policyIds":[${policyId2}]}
|
||||||
|
${policyIds1} set Variable {"policyType":"tsg_security","policyIds":[${policyId1}]}
|
||||||
|
${policyIds} Create List ${policyIds1} ${policyIds2}
|
||||||
|
#${rescode} ${policyId} AddPolicy {"opAction":"add","returnData":1,"policyList":{"policyName":"SecurityPolicy-Allow-Http-00001","policyType":"tsg_security","action":"allow","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"HTTP","keyring":1},"referenceObject":[{"objectId":${object_IP_Id},"protocolFields":[]},{"objectId":${object_FQDN_Id},"protocolFields":["TSG_FIELD_HTTP_HOST"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
${starttime} Get Time
|
||||||
|
#功能端验证
|
||||||
|
Sleep ${policyVerificationSleepSeconds}s
|
||||||
|
${commandreturn} OperatingSystem.Run curl -I \ -m \ 10 \ -o \ /dev/null \ -s \ -w \ \ \%{http_code} \ \ http://www.xiaozhu.com/
|
||||||
|
should contain ${commandreturn} 200
|
||||||
|
Sleep ${policyLogVerificationSleepSeconds}s
|
||||||
|
${endtime} Get Time
|
||||||
|
#日志验证
|
||||||
|
${s} Convert to String ${policyId2}
|
||||||
|
GetLogList security_event_log ${starttime} ${endtime} ${testClentIP} ${s} http_host .xiaozhu.com
|
||||||
87
01-TestCase/tsg_adc/api_security/AllowSSLTests.robot
Normal file
87
01-TestCase/tsg_adc/api_security/AllowSSLTests.robot
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
*** Settings ***
|
||||||
|
Test Teardown DeletePolicyAndObject ${policyIds} ${objectids}
|
||||||
|
Force Tags tsg_adc tsg_security
|
||||||
|
Library OperatingSystem
|
||||||
|
Resource ../../../02-Keyword/tsg_adc/SystemCommand.robot
|
||||||
|
Resource ../../../02-Keyword/tsg_bfapi/PolicyObject.robot
|
||||||
|
Resource ../../../02-Keyword/tsg_bfapi/LogVariable.robot
|
||||||
|
|
||||||
|
*** Variables ***
|
||||||
|
${policyIds} ${EMPTY}
|
||||||
|
${objectids} ${EMPTY}
|
||||||
|
|
||||||
|
*** Test Cases ***
|
||||||
|
SecurityPolicy-Allow-SSL-00001
|
||||||
|
[Tags] Allow IP FQDN DENY HTTP
|
||||||
|
#创建对象IP
|
||||||
|
#${rescode} ${object_IP_Id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"ip","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmmtest_IP","objectDesc":"","subObjectIds":[],"addItemList":[{"addrType":4,"protocol":0,"direction":0,"clientIp1":"192.168.50.31","clientIp2":"192.168.50.31","clientIpFormat":"range","clientPortFormat":"","clientPort1":"","clientPort2":"","serverIpFormat":"","serverIp1":"","serverIp2":"","serverPortFormat":"","serverPort1":"","serverPort2":""}],"updateItemList":[],"deleteItemIds":[]}}
|
||||||
|
#log ${object_IP_Id}
|
||||||
|
#创建对象FQDN
|
||||||
|
${rescodeip} ${object_FQDN_Id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"fqdn","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmmtest_FQDN_icbc","objectDesc":"","subObjectIds":[],"addItemList":[{"keywordArray":["*ww.sogou.com"],"itemId":"","isHexbin":0}],"updateItemList":[],"deleteItemIds":[]}}
|
||||||
|
log ${object_FQDN_Id}
|
||||||
|
${objectids} set Variable ${object_FQDN_Id}
|
||||||
|
#创建 Deny 搭配Allow
|
||||||
|
${addPolicyStr} set variable {"opAction":"add","returnData":1,"policyList":{"policyName":"SecurityPolicy-Allow-SSL-00001_deny","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"SSL","method":"drop","keyring":1},"referenceObject":[{"objectId":${object_FQDN_Id},"protocolFields":["TSG_FIELD_SSL_SNI"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
${addPolicyStr} run keyword if '${addTestClentIPFlag}'=='1' set variable {"opAction":"add","returnData":1,"policyList":{"policyName":"SecurityPolicy-Allow-SSL-00001_deny","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"SSL","method":"drop","keyring":1},"referenceObject":[{"objectId":${testClentID},"protocolFields":[]},{"objectId":${object_FQDN_Id},"protocolFields":["TSG_FIELD_SSL_SNI"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
log ${addPolicyStr}
|
||||||
|
${rescode} ${policyId1} AddPolicy ${addPolicyStr}
|
||||||
|
log ${policyId1}
|
||||||
|
${policyIds} set Variable {"policyType":"tsg_security","policyIds":[${policyId1}]}
|
||||||
|
#创建策略
|
||||||
|
${addPolicyStr} set variable {"opAction":"add","returnData":1,"policyList":{"policyName":"SecurityPolicy-Allow-SSL-00001","policyType":"tsg_security","action":"allow","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"SSL","keyring":1},"referenceObject":[{"objectId":${object_FQDN_Id},"protocolFields":["TSG_FIELD_SSL_SNI"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
${addPolicyStr} run keyword if '${addTestClentIPFlag}'=='1' set variable {"opAction":"add","returnData":1,"policyList":{"policyName":"SecurityPolicy-Allow-SSL-00001","policyType":"tsg_security","action":"allow","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"SSL","keyring":1},"referenceObject":[{"objectId":${testClentID},"protocolFields":[]},{"objectId":${object_FQDN_Id},"protocolFields":["TSG_FIELD_SSL_SNI"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}} \
|
||||||
|
${rescode} ${policyId2} AddPolicy ${addPolicyStr}
|
||||||
|
log ${policyId2}
|
||||||
|
${policyIds1} set Variable {"policyType":"tsg_security","policyIds":[${policyId1}]}
|
||||||
|
${policyIds2} set Variable {"policyType":"tsg_security","policyIds":[${policyId2}]}
|
||||||
|
${policyIds} Create List ${policyIds1} ${policyIds2}
|
||||||
|
#${rescode} ${policyId} AddPolicy {"opAction":"add","returnData":1,"policyList":{"policyName":"SecurityPolicy-Allow-Http-00001","policyType":"tsg_security","action":"allow","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"HTTP","keyring":1},"referenceObject":[{"objectId":${object_IP_Id},"protocolFields":[]},{"objectId":${object_FQDN_Id},"protocolFields":["TSG_FIELD_HTTP_HOST"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
#功能端验证
|
||||||
|
Sleep ${policyVerificationSleepSeconds}s
|
||||||
|
${starttime} Get Time
|
||||||
|
${commandreturn} OperatingSystem.Run curl -I \ -m \ 10 \ -o \ /dev/null \ -s \ -w \ \ \%{http_code} \ \ https://www.sogou.com
|
||||||
|
should contain ${commandreturn} 200
|
||||||
|
Sleep ${policyLogVerificationSleepSeconds}s
|
||||||
|
${endtime} Get Time
|
||||||
|
#日志验证
|
||||||
|
${s} Convert to String ${policyId2}
|
||||||
|
GetLogList security_event_log ${starttime} ${endtime} ${testClentIP} ${s} ssl_sni icbc
|
||||||
|
|
||||||
|
SecurityPolicy-Allow-SSL-00002
|
||||||
|
[Tags] Allow SubID Category DENY HTTP
|
||||||
|
#创建对象Subid
|
||||||
|
${rescode} ${object_Subid_Id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"subscriberid","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmmtest_subid","objectDesc":"","subObjectIds":[],"addItemList":[{"keywordArray":["$zmmtest"],"itemId":"","isHexbin":0}],"updateItemList":[],"deleteItemIds":[]}}
|
||||||
|
log ${object_Subid_Id}
|
||||||
|
${objectids} set Variable ${object_Subid_Id}
|
||||||
|
#创建对象Categry
|
||||||
|
${rescodeip} ${object_Category_Id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"fqdn_category","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmmtest_category","objectDesc":"","subObjectIds":[],"addItemList":[{"keywordArray":["*arch.jd.com"],"itemId":"","isHexbin":0}],"updateItemList":[],"deleteItemIds":[]}}
|
||||||
|
log ${object_Category_Id}
|
||||||
|
${objectids} set Variable ${object_Subid_Id},${object_Category_Id}
|
||||||
|
#创建 Deny 搭配Allow
|
||||||
|
${addPolicyStr} set variable {"opAction":"add","returnData":1,"policyList":{"policyName":"SecurityPolicy-Allow-SSL-00001_deny","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"SSL","method":"drop","keyring":1},"referenceObject":[{"objectId":${object_Subid_Id} ,"protocolFields":[]},{"objectId":${object_Category_Id} ,"protocolFields":["TSG_FIELD_SSL_SNI"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
${addPolicyStr} run keyword if '${addTestClentIPFlag}'=='1' set variable {"opAction":"add","returnData":1,"policyList":{"policyName":"SecurityPolicy-Allow-SSL-00001_deny","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"SSL","method":"drop","keyring":1},"referenceObject":[{"objectId":${object_Subid_Id} ,"protocolFields":[]},{"objectId":${object_Category_Id} ,"protocolFields":["TSG_FIELD_SSL_SNI"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
log ${addPolicyStr}
|
||||||
|
${rescode} ${policyId1} AddPolicy ${addPolicyStr}
|
||||||
|
log ${policyId1}
|
||||||
|
${policyIds} set Variable {"policyType":"tsg_security","policyIds":[${policyId1}]}
|
||||||
|
#创建策略
|
||||||
|
${addPolicyStr} set variable {"opAction":"add","returnData":1,"policyList":{"policyName":"SecurityPolicy-Allow-SSL-00002","policyType":"tsg_security","action":"allow","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"SSL","keyring":1},"referenceObject":[{"objectId":${object_Subid_Id},"protocolFields":[]},{"objectId":${object_Category_Id},"protocolFields":["TSG_FIELD_SSL_SNI"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
${addPolicyStr} run keyword if '${addTestClentIPFlag}'=='1' set variable {"opAction":"add","returnData":1,"policyList":{"policyName":"SecurityPolicy-Allow-SSL-00002","policyType":"tsg_security","action":"allow","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"SSL","keyring":1},"referenceObject":[{"objectId":${object_Subid_Id},"protocolFields":[]},{"objectId":${object_Category_Id},"protocolFields":["TSG_FIELD_SSL_SNI"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
${rescode} ${policyId2} AddPolicy ${addPolicyStr}
|
||||||
|
log ${policyId2}
|
||||||
|
${policyIds1} set Variable {"policyType":"tsg_security","policyIds":[${policyId1}]}
|
||||||
|
${policyIds2} set Variable {"policyType":"tsg_security","policyIds":[${policyId2}]}
|
||||||
|
${policyIds} Create List ${policyIds1} ${policyIds2}
|
||||||
|
#${rescode} ${policyId} AddPolicy {"opAction":"add","returnData":1,"policyList":{"policyName":"SecurityPolicy-Allow-Http-00002","policyType":"tsg_security","action":"allow","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"HTTP","keyring":1},"referenceObject":[{"objectId":${object_Subid_Id},"protocolFields":[]},{"objectId":${object_Category_Id},"protocolFields":["TSG_FIELD_HTTP_HOST"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
#log ${rescode}
|
||||||
|
#log ${policyId}
|
||||||
|
#功能端验证
|
||||||
|
Sleep ${policyVerificationSleepSeconds}s
|
||||||
|
${starttime} Get Time
|
||||||
|
${commandreturn} OperatingSystem.Run curl -I \ -m \ 10 \ -o \ /dev/null \ -s \ -w \ \ \%{http_code} \ \ http://www.ccb.com
|
||||||
|
should contain ${commandreturn} 200
|
||||||
|
Sleep ${policyLogVerificationSleepSeconds}s
|
||||||
|
${endtime} Get Time
|
||||||
|
#日志验证
|
||||||
|
${s} Convert to String ${policyId2}
|
||||||
|
GetLogList security_event_log ${starttime} ${endtime} ${testClentIP} ${s} ssl_sni icbc
|
||||||
74
01-TestCase/tsg_adc/api_security/DenyDNSTests.robot
Normal file
74
01-TestCase/tsg_adc/api_security/DenyDNSTests.robot
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
*** Settings ***
|
||||||
|
Test Teardown DeletePolicyAndObject ${policyIds} ${objectids}
|
||||||
|
Force Tags tsg_adc tsg_security
|
||||||
|
Library OperatingSystem #Test Setup Login #Test Teardown Logout
|
||||||
|
Resource ../../../02-Keyword/tsg_adc/SystemCommand.robot
|
||||||
|
Resource ../../../02-Keyword/tsg_bfapi/PolicyObject.robot
|
||||||
|
Resource ../../../02-Keyword/tsg_bfapi/LogVariable.robot
|
||||||
|
Library Custometest
|
||||||
|
Resource ../../../02-Keyword/tsg_common/StmpHandle.robot
|
||||||
|
|
||||||
|
*** Test Cases ***
|
||||||
|
SecurityPolicy-Deny-DNS-00001
|
||||||
|
[Tags] Deny Fqdn_IP
|
||||||
|
#创建对象 IP
|
||||||
|
#${rescode} ${object_IP_Id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"ip","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmmtest_IP","objectDesc":"","subObjectIds":[],"addItemList":[{"addrType":4,"protocol":0,"direction":0,"clientIp1":"192.168.50.31","clientIp2":"192.168.50.31","clientIpFormat":"range","clientPortFormat":"","clientPort1":"","clientPort2":"","serverIpFormat":"","serverIp1":"","serverIp2":"","serverPortFormat":"","serverPort1":"","serverPort2":""}],"updateItemList":[],"deleteItemIds":[]}}
|
||||||
|
#log ${object_IP_Id}
|
||||||
|
#创建对象 FQDN
|
||||||
|
${rescodeip} ${object_FQDN_Id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"fqdn","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmm_Deny_fqdn_ziroom","objectDesc":"","subObjectIds":[],"addItemList":[{"keywordArray":["$www.ziroom.com"],"itemId":"","isHexbin":0}],"updateItemList":[],"deleteItemIds":[]}}
|
||||||
|
log ${object_FQDN_Id}
|
||||||
|
${objectids} set Variable ${object_FQDN_Id}
|
||||||
|
#创建策略
|
||||||
|
${addPolicyStr} set variable {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Deny-DNS-00001","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"DNS","method":"drop","keyring":1},"referenceObject":[{"objectId":${object_FQDN_Id},"protocolFields":["TSG_FIELD_DNS_QNAME"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
${addPolicyStr} run keyword if '${addTestClentIPFlag}'=='1' set variable {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Deny-DNS-00001","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"DNS","method":"drop","keyring":1},"referenceObject":[{"objectId":${testClentID},"protocolFields":[]},{"objectId":${object_FQDN_Id},"protocolFields":["TSG_FIELD_DNS_QNAME"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
${rescode} ${policyId2} AddPolicy ${addPolicyStr}
|
||||||
|
${policyId1} set Variable {"policyType":"tsg_security","policyIds":[${policyId2}]}
|
||||||
|
${policyIds} Create List ${policyId1}
|
||||||
|
#${rescode} ${policyId} AddPolicy {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Deny-DNS-00001","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"DNS","method":"drop","keyring":1},"referenceObject":[{"objectId":${object_IP_Id},"protocolFields":[]},{"objectId":${object_FQDN_Id},"protocolFields":["TSG_FIELD_DNS_QNAME"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
#log ${rescode}
|
||||||
|
#log ${policyId}
|
||||||
|
#功能端验证
|
||||||
|
Sleep ${policyVerificationSleepSeconds}s
|
||||||
|
${starttime} Get Time
|
||||||
|
${commandstr} set variable nslookup -d www.ziroom.com
|
||||||
|
${stringlista} set variable 超时
|
||||||
|
${stringlist} Create List ${stringlista}
|
||||||
|
${rescode} SystemCommands ${commandstr} ${stringlist}
|
||||||
|
Sleep ${policyLogVerificationSleepSeconds}s
|
||||||
|
${endtime} Get Time
|
||||||
|
#日志验证
|
||||||
|
${s} Convert to String ${policyId2}
|
||||||
|
GetLogList security_event_log ${starttime} ${endtime} ${testClentIP} ${s} ssl_sni xiaozhu
|
||||||
|
|
||||||
|
SecurityPolicy-Deny-DNS-00002
|
||||||
|
[Tags] Deny Sub_Category
|
||||||
|
#创建对象 Sub
|
||||||
|
${rescode} ${object_Sub_Id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"subscriberid","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmmtest_subid","objectDesc":"","subObjectIds":[],"addItemList":[{"keywordArray":["$zmmtest"],"itemId":"","isHexbin":0}],"updateItemList":[],"deleteItemIds":[]}}
|
||||||
|
log ${object_Sub_Id}
|
||||||
|
${objectids} set Variable ${object_Sub_Id}
|
||||||
|
#创建对象 Cat
|
||||||
|
${rescodeip} ${object_Cat_Id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"fqdn_category","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmm_Cat_smsp","objectDesc":"","subObjectIds":[],"addItemList":[{"keywordArray":["$smspunch.net"],"itemId":"","isHexbin":0}],"updateItemList":[],"deleteItemIds":[]}}
|
||||||
|
log ${object_Cat_Id}
|
||||||
|
${objectids} set Variable ${object_Sub_Id},${object_Cat_Id}
|
||||||
|
#创建策略
|
||||||
|
${addPolicyStr} set variable {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Deny-DNS-00002","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"DNS","method":"redirect","resolution":[{"qtype":"AAAA","answer":[{"atype":"AAAA","value":"e061:82db:c37e:e8c5:c8ab:eab8:5a76:04a9","ttl":{"min":300,"max":300}},{"atype":"CNAME","value":"www.ly.com","ttl":{"min":300,"max":300}}]}],"keyring":1},"referenceObject":[{"objectId":${object_Sub_Id},"protocolFields":[]},{"objectId":${object_Cat_Id},"protocolFields":["TSG_FIELD_DNS_QNAME"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
${addPolicyStr} run keyword if '${addTestClentIPFlag}'=='1' set variable {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Deny-DNS-00002","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"DNS","method":"redirect","resolution":[{"qtype":"AAAA","answer":[{"atype":"AAAA","value":"e061:82db:c37e:e8c5:c8ab:eab8:5a76:04a9","ttl":{"min":300,"max":300}},{"atype":"CNAME","value":"www.ly.com","ttl":{"min":300,"max":300}}]}],"keyring":1},"referenceObject":[{"objectId":${object_Sub_Id},"protocolFields":[]},{"objectId":${object_Cat_Id},"protocolFields":["TSG_FIELD_DNS_QNAME"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
${rescode} ${policyId2} AddPolicy ${addPolicyStr}
|
||||||
|
${policyId1} set Variable {"policyType":"tsg_security","policyIds":[${policyId2}]}
|
||||||
|
${policyIds} Create List ${policyId1}
|
||||||
|
#${rescode} ${policyId} AddPolicy {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Deny-DNS-00002","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"DNS","method":"redirect","resolution":[{"qtype":"AAAA","answer":[{"atype":"AAAA","value":"e061:82db:c37e:e8c5:c8ab:eab8:5a76:04a9","ttl":{"min":300,"max":300}},{"atype":"CNAME","value":"www.ly.com","ttl":{"min":300,"max":300}}]}],"keyring":1},"referenceObject":[{"objectId":${object_Sub_Id},"protocolFields":[]},{"objectId":${object_Cat_Id},"protocolFields":["TSG_FIELD_DNS_QNAME"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
#log ${rescode}
|
||||||
|
#log ${policyId}
|
||||||
|
#功能端验证
|
||||||
|
Sleep ${policyVerificationSleepSeconds}s
|
||||||
|
${starttime} Get Time
|
||||||
|
${commandstr} set variable nslookup -d www.smspunch.net
|
||||||
|
@{stringlist} set variable www.ly.com
|
||||||
|
${rescode} SystemCommands ${commandstr} @{stringlist}
|
||||||
|
Sleep ${policyLogVerificationSleepSeconds}s
|
||||||
|
${endtime} Get Time
|
||||||
|
#日志验证
|
||||||
|
${s} Convert to String ${policyId2}
|
||||||
|
GetLogList security_event_log ${starttime} ${endtime} ${testClentIP} ${s} ssl_sni xiaozhu
|
||||||
|
|
||||||
|
|
||||||
101
01-TestCase/tsg_adc/api_security/DenyFtpTests.robot
Normal file
101
01-TestCase/tsg_adc/api_security/DenyFtpTests.robot
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
*** Settings ***
|
||||||
|
Test Teardown DeletePolicyAndObject ${policyIds} ${objectids}
|
||||||
|
Force Tags tsg_adc tsg_security
|
||||||
|
Library OperatingSystem
|
||||||
|
Resource ../../../02-Keyword/tsg_adc/SystemCommand.robot
|
||||||
|
Resource ../../../02-Keyword/tsg_bfapi/PolicyObject.robot
|
||||||
|
Resource ../../../02-Keyword/tsg_bfapi/LogVariable.robot
|
||||||
|
Library Custometest
|
||||||
|
|
||||||
|
*** Test Cases ***
|
||||||
|
SecurityPolicy-Deny-FTP-00001
|
||||||
|
[Tags] Deny Sub_Account
|
||||||
|
#创建对象 Sub
|
||||||
|
${rescode} ${object_Sub_Id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"subscriberid","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmmtest_subid","objectDesc":"","subObjectIds":[],"addItemList":[{"keywordArray":["$zmmtest"],"itemId":"","isHexbin":0}],"updateItemList":[],"deleteItemIds":[]}}
|
||||||
|
log ${object_Sub_Id}
|
||||||
|
${objectids} set Variable ${object_Sub_Id}
|
||||||
|
#创建对象 Account
|
||||||
|
${rescodeip} ${object_Account_Id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"account","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmm_Account","objectDesc":"","subObjectIds":[],"addItemList":[{"keywordArray":["anony*"],"itemId":"","isHexbin":0}],"updateItemList":[],"deleteItemIds":[],"objectId":""}}
|
||||||
|
log ${object_Account_Id}
|
||||||
|
${objectids} set Variable ${object_Sub_Id},${object_Account_Id}
|
||||||
|
#创建策略
|
||||||
|
${addPolicyStr} set variable {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Deny-FTP-00001","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"FTP","method":"drop","keyring":1},"referenceObject":[{"objectId":${object_Sub_Id} ,"protocolFields":[]},{"objectId":${object_Account_Id} ,"protocolFields":["TSG_FIELD_FTP_ACCOUNT"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
${addPolicyStr} run keyword if '${addTestClentIPFlag}'=='1' set variable {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Deny-FTP-00001","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"FTP","method":"drop","keyring":1},"referenceObject":[{"objectId":${object_Sub_Id} ,"protocolFields":[]},{"objectId":${object_Account_Id} ,"protocolFields":["TSG_FIELD_FTP_ACCOUNT"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
${rescode} ${policyId2} AddPolicy ${addPolicyStr}
|
||||||
|
${policyId1} set Variable {"policyType":"tsg_security","policyIds":[${policyId2}]}
|
||||||
|
${policyIds} Create List ${policyId1}
|
||||||
|
#${rescode} ${policyId} AddPolicy {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Deny-DNS-00002","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"DNS","method":"redirect","resolution":[{"qtype":"AAAA","answer":[{"atype":"AAAA","value":"e061:82db:c37e:e8c5:c8ab:eab8:5a76:04a9","ttl":{"min":300,"max":300}},{"atype":"CNAME","value":"www.ly.com","ttl":{"min":300,"max":300}}]}],"keyring":1},"referenceObject":[{"objectId":${object_Sub_Id},"protocolFields":[]},{"objectId":${object_Cat_Id},"protocolFields":["TSG_FIELD_DNS_QNAME"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
#log ${rescode}
|
||||||
|
#log ${policyId}
|
||||||
|
#功能端验证
|
||||||
|
Sleep ${policyVerificationSleepSeconds}s
|
||||||
|
${starttime} Get Time
|
||||||
|
${FTP} FTP 登录
|
||||||
|
should contain ${FTP} Deny Success
|
||||||
|
Sleep ${policyLogVerificationSleepSeconds}s
|
||||||
|
${endtime} Get Time
|
||||||
|
#日志验证
|
||||||
|
${s} Convert to String ${policyId2}
|
||||||
|
GetLogList security_event_log ${starttime} ${endtime} ${testClentIP} ${s} ftp_account anonymous
|
||||||
|
|
||||||
|
SecurityPolicy-Deny-FTP-00002
|
||||||
|
[Tags] Deny URI_Content
|
||||||
|
#创建对象IP
|
||||||
|
#${rescode} ${object_IP_Id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"ip","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmmtest_IP","objectDesc":"","subObjectIds":[],"addItemList":[{"addrType":4,"protocol":0,"direction":0,"clientIp1":"192.168.50.31","clientIp2":"192.168.50.31","clientIpFormat":"range","clientPortFormat":"","clientPort1":"","clientPort2":"","serverIpFormat":"","serverIp1":"","serverIp2":"","serverPortFormat":"","serverPort1":"","serverPort2":""}],"updateItemList":[],"deleteItemIds":[]}}
|
||||||
|
#log ${object_IP_Id}
|
||||||
|
#创建对象 URI
|
||||||
|
${rescodeip} ${object_URI_Id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"url","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"ZMM_FTP_URI","objectDesc":"","subObjectIds":[],"addItemList":[{"keywordArray":["*771.txt"],"itemId":"","isHexbin":0}],"updateItemList":[],"deleteItemIds":[],"objectId":""}}
|
||||||
|
log ${object_URI_Id}
|
||||||
|
${objectids} set Variable ${object_URI_Id}
|
||||||
|
#创建对象 Content
|
||||||
|
${rescode_deny} ${object_Content_id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"keywords","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"ZMM_FTP_Content","objectDesc":"","subObjectIds":[],"addItemList":[{"keywordArray":["accountsservice"],"isHexbin":0,"itemId":"","isValid":""}],"updateItemList":[],"deleteItemIds":[],"objectId":""}}
|
||||||
|
log ${object_Content_id}
|
||||||
|
${objectids} set Variable ${object_URI_Id},${object_Content_id}
|
||||||
|
#创建策略
|
||||||
|
${addPolicyStr} set variable {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Deny-FTP-00002","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"FTP","method":"drop"},"referenceObject":[{"objectId":${object_URI_Id} ,"protocolFields":["TSG_FIELD_FTP_URI"]},{"objectId":${object_Content_id} ,"protocolFields":["TSG_FIELD_FTP_CONTENT"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
${addPolicyStr} run keyword if '${addTestClentIPFlag}'=='1' set variable {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Deny-FTP-00002","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"FTP","method":"drop"},"referenceObject":[{"objectId":${testClentID},"protocolFields":[]},{"objectId":${object_URI_Id} ,"protocolFields":["TSG_FIELD_FTP_URI"]},{"objectId":${object_Content_id} ,"protocolFields":["TSG_FIELD_FTP_CONTENT"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
${rescode} ${policyId2} AddPolicy ${addPolicyStr}
|
||||||
|
${policyId1} set Variable {"policyType":"tsg_security","policyIds":[${policyId2}]}
|
||||||
|
${policyIds} Create List ${policyId1}
|
||||||
|
#${rescode} ${policyId} AddPolicy {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Deny-Http-00001","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"HTTP","method":"drop","keyring":1},"referenceObject":[{"objectId":${object_IP_Id},"protocolFields":[]},{"objectId":${object_Category_Id},"protocolFields":["TSG_FIELD_HTTP_HOST"]},{"objectId":${object_URL_id},"protocolFields":["TSG_FIELD_HTTP_URL"]},{"objectId":${object_UA_id},"protocolFields":["TSG_FIELD_HTTP_REQ_HDR"]},{"objectId":${object_CT_id},"protocolFields":["TSG_FIELD_HTTP_RES_HDR"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
#${policyIds} set Variable {"policyType":"tsg_security","policyIds":[${policyId}]}
|
||||||
|
#log ${rescode}
|
||||||
|
#log ${policyId}
|
||||||
|
#功能端验证
|
||||||
|
Sleep ${policyVerificationSleepSeconds}s
|
||||||
|
${starttime} Get Time
|
||||||
|
${FTP} FTP 下载
|
||||||
|
should contain ${FTP} Deny Success
|
||||||
|
Sleep ${policyLogVerificationSleepSeconds}s
|
||||||
|
${endtime} Get Time
|
||||||
|
#日志验证
|
||||||
|
${s} Convert to String ${policyId2}
|
||||||
|
GetLogList security_event_log ${starttime} ${endtime} ${testClentIP} ${s} ftp_url ftp://202.38.97.230/pub/iso/linux/knoppix/KNOPPIX_V7.7.1DVD-2016-10-22-EN/dpkg-l-dvd-771.txt
|
||||||
|
|
||||||
|
SecurityPolicy-Deny-FTP-00003
|
||||||
|
[Tags] Deny Sub_Account
|
||||||
|
#创建对象 Account
|
||||||
|
${rescodeip} ${object_Account_Id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"account","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmm_Account","objectDesc":"","subObjectIds":[],"addItemList":[{"keywordArray":["anony*"],"itemId":"","isHexbin":0}],"updateItemList":[],"deleteItemIds":[],"objectId":""}}
|
||||||
|
log ${object_Account_Id}
|
||||||
|
${objectids} set Variable ${object_Account_Id}
|
||||||
|
#创建策略
|
||||||
|
${addPolicyStr} set variable {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Deny-FTP-00001","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"FTP","method":"drop","keyring":1},"referenceObject":[{"objectId":${object_Account_Id} ,"protocolFields":["TSG_FIELD_FTP_ACCOUNT"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
${addPolicyStr} run keyword if '${addTestClentIPFlag}'=='1' set variable {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Deny-FTP-00001","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"FTP","method":"drop","keyring":1},"referenceObject":[{"objectId":${object_Account_Id} ,"protocolFields":["TSG_FIELD_FTP_ACCOUNT"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
${rescode} ${policyId2} AddPolicy ${addPolicyStr}
|
||||||
|
${policyId1} set Variable {"policyType":"tsg_security","policyIds":[${policyId2}]}
|
||||||
|
${policyIds} Create List ${policyId1}
|
||||||
|
#${rescode} ${policyId} AddPolicy {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Deny-DNS-00002","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"DNS","method":"redirect","resolution":[{"qtype":"AAAA","answer":[{"atype":"AAAA","value":"e061:82db:c37e:e8c5:c8ab:eab8:5a76:04a9","ttl":{"min":300,"max":300}},{"atype":"CNAME","value":"www.ly.com","ttl":{"min":300,"max":300}}]}],"keyring":1},"referenceObject":[{"objectId":${object_Sub_Id},"protocolFields":[]},{"objectId":${object_Cat_Id},"protocolFields":["TSG_FIELD_DNS_QNAME"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
#log ${rescode}
|
||||||
|
#log ${policyId}
|
||||||
|
#功能端验证
|
||||||
|
Sleep ${policyVerificationSleepSeconds}s
|
||||||
|
${starttime} Get Time
|
||||||
|
${FTP} FTP 登录
|
||||||
|
should contain ${FTP} Deny Success
|
||||||
|
Sleep ${policyLogVerificationSleepSeconds}s
|
||||||
|
${endtime} Get Time
|
||||||
|
#日志验证
|
||||||
|
${s} Convert to String ${policyId2}
|
||||||
|
GetLogList security_event_log ${starttime} ${endtime} ${testClentIP} ${s} ftp_account anonymous
|
||||||
|
|
||||||
|
|
||||||
94
01-TestCase/tsg_adc/api_security/DenyHttpTests.robot
Normal file
94
01-TestCase/tsg_adc/api_security/DenyHttpTests.robot
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
*** Settings ***
|
||||||
|
Test Teardown DeletePolicyAndObject ${policyIds} ${objectids}
|
||||||
|
Force Tags tsg_adc tsg_security
|
||||||
|
Library OperatingSystem
|
||||||
|
Resource ../../../02-Keyword/tsg_adc/SystemCommand.robot
|
||||||
|
Resource ../../../02-Keyword/tsg_bfapi/PolicyObject.robot
|
||||||
|
Resource ../../../02-Keyword/tsg_bfapi/LogVariable.robot
|
||||||
|
Library Custometest
|
||||||
|
|
||||||
|
*** Test Cases ***
|
||||||
|
SecurityPolicy-Deny-HTTP-00001
|
||||||
|
[Tags] Deny Category_Url_UA_CT
|
||||||
|
#创建对象IP
|
||||||
|
#${rescode} ${object_IP_Id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"ip","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmmtest_IP","objectDesc":"","subObjectIds":[],"addItemList":[{"addrType":4,"protocol":0,"direction":0,"clientIp1":"192.168.50.31","clientIp2":"192.168.50.31","clientIpFormat":"range","clientPortFormat":"","clientPort1":"","clientPort2":"","serverIpFormat":"","serverIp1":"","serverIp2":"","serverPortFormat":"","serverPort1":"","serverPort2":""}],"updateItemList":[],"deleteItemIds":[]}}
|
||||||
|
#log ${object_IP_Id}
|
||||||
|
#创建对象Category
|
||||||
|
${rescodeip} ${object_Category_Id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"fqdn_category","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmm_cat_ziroom","objectDesc":"","subObjectIds":[],"addItemList":[{"keywordArray":["*oom.com"],"itemId":"","isHexbin":0}],"updateItemList":[],"deleteItemIds":[]}}
|
||||||
|
log ${object_Category_Id}
|
||||||
|
${objectids} set Variable ${object_Category_Id}
|
||||||
|
#创建对象URL
|
||||||
|
${rescode_deny} ${object_URL_id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"url","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmmtest_url-ziroom","objectDesc":"","subObjectIds":[],"addItemList":[{"keywordArray":["www.ziroom.com/li*"],"itemId":"","isHexbin":0}],"updateItemList":[],"deleteItemIds":[]}}
|
||||||
|
log ${object_URL_id}
|
||||||
|
${objectids} set Variable ${object_Category_Id},${object_URL_id}
|
||||||
|
#创建对象UA
|
||||||
|
${rescode_deny} ${object_UA_id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"http_signature","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmm_ua_ziroom","objectDesc":"","subObjectIds":[],"addItemList":[{"keywordArray":["Mozilla/5.0*"],"isHexbin":0,"district":"User-Agent"}],"updateItemList":[],"deleteItemIds":[]}}
|
||||||
|
log ${object_UA_id}
|
||||||
|
${objectids} set Variable ${object_Category_Id},${object_URL_id},${object_UA_id}
|
||||||
|
#创建对象CT
|
||||||
|
${rescode_deny} ${object_CT_id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"http_signature","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmm_ct_ziroom","objectDesc":"","subObjectIds":[],"addItemList":[{"keywordArray":["text/html; charse*"],"isHexbin":0,"district":"Content-Type"}],"updateItemList":[],"deleteItemIds":[]}}
|
||||||
|
log ${object_CT_id}
|
||||||
|
${objectids} set Variable ${object_Category_Id},${object_URL_id},${object_UA_id},${object_CT_id}
|
||||||
|
#创建策略
|
||||||
|
${addPolicyStr} set variable {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Deny-Http-00001","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"HTTP","method":"drop","keyring":1},"referenceObject":[{"objectId":${object_Category_Id},"protocolFields":["TSG_FIELD_HTTP_HOST"]},{"objectId":${object_URL_id},"protocolFields":["TSG_FIELD_HTTP_URL"]},{"objectId":${object_UA_id},"protocolFields":["TSG_FIELD_HTTP_REQ_HDR"]},{"objectId":${object_CT_id},"protocolFields":["TSG_FIELD_HTTP_RES_HDR"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
${addPolicyStr} run keyword if '${addTestClentIPFlag}'=='1' set variable {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Deny-Http-00001","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"HTTP","method":"drop","keyring":1},"referenceObject":[{"objectId":${testClentID},"protocolFields":[]},{"objectId":${object_Category_Id},"protocolFields":["TSG_FIELD_HTTP_HOST"]},{"objectId":${object_URL_id},"protocolFields":["TSG_FIELD_HTTP_URL"]},{"objectId":${object_UA_id},"protocolFields":["TSG_FIELD_HTTP_REQ_HDR"]},{"objectId":${object_CT_id},"protocolFields":["TSG_FIELD_HTTP_RES_HDR"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
${rescode} ${policyId2} AddPolicy ${addPolicyStr}
|
||||||
|
${policyId1} set Variable {"policyType":"tsg_security","policyIds":[${policyId2}]}
|
||||||
|
${policyIds} Create List ${policyId1}
|
||||||
|
#${rescode} ${policyId} AddPolicy {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Deny-Http-00001","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"HTTP","method":"drop","keyring":1},"referenceObject":[{"objectId":${object_IP_Id},"protocolFields":[]},{"objectId":${object_Category_Id},"protocolFields":["TSG_FIELD_HTTP_HOST"]},{"objectId":${object_URL_id},"protocolFields":["TSG_FIELD_HTTP_URL"]},{"objectId":${object_UA_id},"protocolFields":["TSG_FIELD_HTTP_REQ_HDR"]},{"objectId":${object_CT_id},"protocolFields":["TSG_FIELD_HTTP_RES_HDR"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
#${policyIds} set Variable {"policyType":"tsg_security","policyIds":[${policyId}]}
|
||||||
|
#log ${rescode}
|
||||||
|
#log ${policyId}
|
||||||
|
#功能端验证
|
||||||
|
Sleep ${policyVerificationSleepSeconds}s
|
||||||
|
${starttime} Get Time
|
||||||
|
${commandreturn} OperatingSystem.Run curl --user-agent "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36" --referer 'http://www.baidu.com/' \ http://www.ziroom.com/life/index \ \ | iconv -f utf-8 -t gbk
|
||||||
|
should not contain ${commandreturn} 营业执照
|
||||||
|
Sleep ${policyLogVerificationSleepSeconds}s
|
||||||
|
${endtime} Get Time
|
||||||
|
#日志验证
|
||||||
|
${s} Convert to String ${policyId2}
|
||||||
|
GetLogList security_event_log ${starttime} ${endtime} ${testClentIP} ${s} http_host ziroom
|
||||||
|
|
||||||
|
SecurityPolicy-Deny-HTTP-00002
|
||||||
|
[Tags] Deny Fqdn_Url_CK_SC
|
||||||
|
#创建对象SubID
|
||||||
|
${rescode} ${object_Subid_Id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"subscriberid","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmmtest_subid","objectDesc":"","subObjectIds":[],"addItemList":[{"keywordArray":["$zmmtest"],"itemId":"","isHexbin":0}],"updateItemList":[],"deleteItemIds":[]}}
|
||||||
|
log ${object_Subid_Id}
|
||||||
|
${objectids} set Variable ${object_Subid_Id}
|
||||||
|
#创建对象FQDN
|
||||||
|
${rescodeip} ${object_FQDN_Id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"fqdn","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmm_xiaozhu_fqdn","objectDesc":"","subObjectIds":[],"addItemList":[{"keywordArray":["*zhu.com"],"itemId":"","isHexbin":0}],"updateItemList":[],"deleteItemIds":[]}}
|
||||||
|
log ${object_FQDN_Id}
|
||||||
|
${objectids} set Variable ${object_Subid_Id},${object_FQDN_Id}
|
||||||
|
#创建对象URL
|
||||||
|
${rescode_deny} ${object_URL_id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"url","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmm_xiaozhu_url","objectDesc":"","subObjectIds":[],"addItemList":[{"keywordArray":["*ozhu.com/"],"itemId":"","isHexbin":0}],"updateItemList":[],"deleteItemIds":[]}}
|
||||||
|
log ${object_URL_id}
|
||||||
|
${objectids} set Variable ${object_Subid_Id},${object_FQDN_Id},${object_URL_id}
|
||||||
|
#创建对象CK
|
||||||
|
${rescode_deny} ${object_CK_id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"http_signature","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmm_xiaozhu_cookie","objectDesc":"","subObjectIds":[],"addItemList":[{"keywordArray":["*_math=czsuv8n9d4p; Hm_lvt_92e8bc890f374994dd570aa15afc99e1=1575187416; Hm_lpvt_92e8bc890f374994dd570aa15afc99e1=1575187416; _uab_collina=157518741578524001717192"],"isHexbin":0,"district":"Cookie"}],"updateItemList":[],"deleteItemIds":[]}}
|
||||||
|
log ${object_CK_id}
|
||||||
|
${objectids} set Variable ${object_Subid_Id},${object_FQDN_Id},${object_URL_id},${object_CK_id}
|
||||||
|
#创建对象SC
|
||||||
|
${rescode_deny} ${object_SC_id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"http_signature","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmm_sc","objectDesc":"","subObjectIds":[],"addItemList":[{"keywordArray":["*domain=.xiaozhu.com"],"isHexbin":0,"district":"Set-Cookie"}],"updateItemList":[],"deleteItemIds":[]}}
|
||||||
|
log ${object_SC_id}
|
||||||
|
${objectids} set Variable ${object_Subid_Id},${object_FQDN_Id},${object_URL_id},${object_CK_id},${object_SC_id}
|
||||||
|
#创建策略
|
||||||
|
${addPolicyStr} set variable {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Deny-Http-00002","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"HTTP","method":"rst","keyring":1},"referenceObject":[{"objectId":${object_Subid_Id},"protocolFields":[]},{"objectId":${object_FQDN_Id},"protocolFields":["TSG_FIELD_HTTP_HOST"]},{"objectId":${object_URL_id},"protocolFields":["TSG_FIELD_HTTP_URL"]},{"objectId":${object_CK_id},"protocolFields":["TSG_FIELD_HTTP_REQ_HDR"]},{"objectId":${object_SC_id},"protocolFields":["TSG_FIELD_HTTP_RES_HDR"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
${addPolicyStr} run keyword if '${addTestClentIPFlag}'=='1' set variable {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Deny-Http-00002","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"HTTP","method":"rst","keyring":1},"referenceObject":[{"objectId":${object_Subid_Id},"protocolFields":[]},{"objectId":${object_FQDN_Id},"protocolFields":["TSG_FIELD_HTTP_HOST"]},{"objectId":${object_URL_id},"protocolFields":["TSG_FIELD_HTTP_URL"]},{"objectId":${object_CK_id},"protocolFields":["TSG_FIELD_HTTP_REQ_HDR"]},{"objectId":${object_SC_id},"protocolFields":["TSG_FIELD_HTTP_RES_HDR"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
${rescode} ${policyId2} AddPolicy ${addPolicyStr}
|
||||||
|
${policyId1} set Variable {"policyType":"tsg_security","policyIds":[${policyId2}]}
|
||||||
|
${policyIds} Create List ${policyId1}
|
||||||
|
#${rescode} ${policyId} AddPolicy {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Deny-Http-00002","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"HTTP","method":"rst","keyring":1},"referenceObject":[{"objectId":${object_Subid_Id},"protocolFields":[]},{"objectId":${object_FQDN_Id},"protocolFields":["TSG_FIELD_HTTP_HOST"]},{"objectId":${object_URL_id},"protocolFields":["TSG_FIELD_HTTP_URL"]},{"objectId":${object_CK_id},"protocolFields":["TSG_FIELD_HTTP_REQ_HDR"]},{"objectId":${object_SC_id},"protocolFields":["TSG_FIELD_HTTP_RES_HDR"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
#log ${rescode}
|
||||||
|
#log ${policyId}
|
||||||
|
#功能端验证
|
||||||
|
Sleep ${policyVerificationSleepSeconds}s
|
||||||
|
${starttime} Get Time
|
||||||
|
${commandreturn} OperatingSystem.Run curl --cookie "*_math=czsuv8n9d4p; Hm_lvt_92e8bc890f374994dd570aa15afc99e1=1575187416; Hm_lpvt_92e8bc890f374994dd570aa15afc99e1=1575187416; _uab_collina=157518741578524001717192" --referer 'http://www.baidu.com/' \ http://www.xiaozhu.com \ \ | iconv -f utf-8 -t gbk
|
||||||
|
should contain ${commandreturn} 403
|
||||||
|
Sleep ${policyLogVerificationSleepSeconds}s
|
||||||
|
${endtime} Get Time
|
||||||
|
#日志验证
|
||||||
|
${s} Convert to String ${policyId2}
|
||||||
|
GetLogList security_event_log ${starttime} ${endtime} ${testClentIP} ${s} http_host xiaozhu
|
||||||
|
|
||||||
328
01-TestCase/tsg_adc/api_security/DenyMailTests.robot
Normal file
328
01-TestCase/tsg_adc/api_security/DenyMailTests.robot
Normal file
@@ -0,0 +1,328 @@
|
|||||||
|
*** Settings ***
|
||||||
|
Test Teardown DeletePolicyAndObject ${policyIds} ${objectids}
|
||||||
|
Force Tags tsg_adc tsg_security
|
||||||
|
Library OperatingSystem #Test Setup Login #Test Teardown Logout
|
||||||
|
Resource ../../02-Keyword/tsg-adc/systemcommand.txt
|
||||||
|
Resource ../../02-Keyword/tsg-bf-api/policyobject.txt
|
||||||
|
Resource ../../02-Keyword/tsg-bf-api/logvariable.txt
|
||||||
|
Resource ../../02-Keyword/tsg-bf-api/logschema.txt #Resource log-3.robot
|
||||||
|
Library custometest
|
||||||
|
Resource ../../02-Keyword/tsg-ui/StmpHandle2.robot
|
||||||
|
|
||||||
|
*** Test Cases ***
|
||||||
|
SecurityPolicy-Deny-Mail-00001
|
||||||
|
[Tags] Deny URI_Content
|
||||||
|
#创建对象 Sub
|
||||||
|
#${rescode} ${object_Sub_Id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"subscriberid","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmmtest_subid","objectDesc":"","subObjectIds":[],"addItemList":[{"keywordArray":["$zmmtest"],"itemId":"","isHexbin":0}],"updateItemList":[],"deleteItemIds":[]}}
|
||||||
|
#log ${object_Sub_Id}
|
||||||
|
#${objectids} set Variable ${object_Sub_Id}
|
||||||
|
#创建对象 Account
|
||||||
|
${rescodeip} ${object_Account_Id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"account","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmm_account","objectDesc":"","subObjectIds":[],"addItemList":[{"keywordArray":["z1343921421z@163.com"],"itemId":"","isValid":"","isHexbin":0}],"updateItemList":[],"deleteItemIds":[],"objectId":""}}
|
||||||
|
log ${object_Account_Id}
|
||||||
|
${objectids} set Variable ${object_Account_Id}
|
||||||
|
#创建策略
|
||||||
|
${addPolicyStr} set variable {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Deny-Mail-00001","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"MAIL","method":"rst","code":""},"referenceObject":[{"objectId":${object_Account_Id},"protocolFields":["TSG_FIELD_MAIL_ACCOUNT"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
${addPolicyStr} run keyword if '${addTestClentIPFlag}'=='1' set variable {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Deny-Mail-00001","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"MAIL","method":"rst","code":""},"referenceObject":[{"objectId":${testClentID},"protocolFields":[]},{"objectId":${object_Account_Id},"protocolFields":["TSG_FIELD_MAIL_ACCOUNT"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
${rescode} ${policyId2} AddPolicy ${addPolicyStr}
|
||||||
|
${policyId1} set Variable {"policyType":"tsg_security","policyIds":[${policyId2}]}
|
||||||
|
${policyIds} Create List ${policyId1}
|
||||||
|
#${rescode} ${policyId} AddPolicy {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Deny-Http-00001","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"HTTP","method":"drop","keyring":1},"referenceObject":[{"objectId":${object_IP_Id},"protocolFields":[]},{"objectId":${object_Category_Id},"protocolFields":["TSG_FIELD_HTTP_HOST"]},{"objectId":${object_URL_id},"protocolFields":["TSG_FIELD_HTTP_URL"]},{"objectId":${object_UA_id},"protocolFields":["TSG_FIELD_HTTP_REQ_HDR"]},{"objectId":${object_CT_id},"protocolFields":["TSG_FIELD_HTTP_RES_HDR"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
#${policyIds} set Variable {"policyType":"tsg_security","policyIds":[${policyId}]}
|
||||||
|
#log ${rescode}
|
||||||
|
#log ${policyId}
|
||||||
|
#功能端验证
|
||||||
|
Sleep ${policyVerificationSleepSeconds}s
|
||||||
|
${starttime} Get Time
|
||||||
|
${mail} EmailLogin smtp.163.com 25 z1343921421z@163.com QKCEUFAJJRZLJKQE
|
||||||
|
should contain ${mail} fail
|
||||||
|
Sleep ${policyLogVerificationSleepSeconds}s
|
||||||
|
${endtime} Get Time
|
||||||
|
#日志验证
|
||||||
|
${s} Convert to String ${policyId2}
|
||||||
|
GetLogList security_event_log ${starttime} ${endtime} ${testClentIP} ${s} mail_account z1343921421z@163.com
|
||||||
|
|
||||||
|
SecurityPolicy-Deny-Mail-00002
|
||||||
|
[Tags] Deny URI_Content
|
||||||
|
#创建对象IP
|
||||||
|
#${rescode} ${object_IP_Id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"ip","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmmtest_IP","objectDesc":"","subObjectIds":[],"addItemList":[{"addrType":4,"protocol":0,"direction":0,"clientIp1":"192.168.50.31","clientIp2":"192.168.50.31","clientIpFormat":"range","clientPortFormat":"","clientPort1":"","clientPort2":"","serverIpFormat":"","serverIp1":"","serverIp2":"","serverPortFormat":"","serverPort1":"","serverPort2":""}],"updateItemList":[],"deleteItemIds":[]}}
|
||||||
|
#log ${object_IP_Id}
|
||||||
|
#创建对象 Subject
|
||||||
|
${rescodeip} ${object_Subject_Id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"keywords","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmm_subject","objectDesc":"","subObjectIds":[],"addItemList":[{"keywordArray":["朱明明subject"],"isHexbin":0,"itemId":"","isValid":""}],"updateItemList":[],"deleteItemIds":[],"objectId":""}}
|
||||||
|
log ${object_Subject_Id}
|
||||||
|
${objectids} set Variable ${object_Subject_Id}
|
||||||
|
#创建对象 Content
|
||||||
|
${rescode_deny} ${object_Content_id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"keywords","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmm_content","objectDesc":"","subObjectIds":[],"addItemList":[{"keywordArray":["朱明明content"],"isHexbin":0,"itemId":"","isValid":""}],"updateItemList":[],"deleteItemIds":[],"objectId":""}}
|
||||||
|
log ${object_Content_id}
|
||||||
|
${objectids} set Variable ${object_Subject_Id},${object_Content_id}
|
||||||
|
#创建对象 Att_name
|
||||||
|
${rescode_deny} ${object_Att_name_id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"keywords","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmm_ATT_Name","objectDesc":"","subObjectIds":[],"addItemList":[{"keywordArray":["朱明明测试文件"],"isHexbin":0,"itemId":"","isValid":""}],"updateItemList":[],"deleteItemIds":[],"objectId":""}}
|
||||||
|
log ${object_Att_name_id}
|
||||||
|
${objectids} set Variable ${object_Subject_Id},${object_Content_id},${object_Att_name_id}
|
||||||
|
#创建对象 att_content
|
||||||
|
${rescode_deny} ${object_att_content_id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"keywords","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmm_content","objectDesc":"","subObjectIds":[],"addItemList":[{"keywordArray":["朱明明测试文件内容"],"isHexbin":0,"itemId":"","isValid":""}],"updateItemList":[],"deleteItemIds":[],"objectId":""}}
|
||||||
|
log ${object_att_content_id}
|
||||||
|
${objectids} set Variable ${object_Subject_Id},${object_Content_id},${object_Att_name_id},${object_att_content_id}
|
||||||
|
#创建对象 From
|
||||||
|
${rescode_deny} ${object_From_id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"account","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmm_from","objectDesc":"","subObjectIds":[],"addItemList":[{"keywordArray":["z1343921421z@163.com"],"itemId":"","isHexbin":0}],"updateItemList":[],"deleteItemIds":[],"objectId":""}}
|
||||||
|
log ${object_From_id}
|
||||||
|
${objectids} set Variable ${object_Subject_Id},${object_Content_id},${object_Att_name_id},${object_att_content_id},${object_From_id}
|
||||||
|
#创建对象 to
|
||||||
|
${rescode_deny} ${object_to_id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"account","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmm_to","objectDesc":"","subObjectIds":[],"addItemList":[{"keywordArray":["z1789327568z@163.com"],"itemId":"","isValid":"","isHexbin":0}],"updateItemList":[],"deleteItemIds":[],"objectId":""}}
|
||||||
|
log ${object_to_id}
|
||||||
|
${objectids} set Variable ${object_Subject_Id},${object_Content_id},${object_Att_name_id},${object_att_content_id},${object_From_id},${object_to_id}
|
||||||
|
#创建策略
|
||||||
|
${addPolicyStr} set variable {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Deny-Mail-00002","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"MAIL","method":"drop","code":550},"referenceObject":[{"objectId":${object_Att_name_id},"protocolFields":["TSG_FIELD_MAIL_ATT_NAME"]},{"objectId":${object_att_content_id},"protocolFields":["TSG_FIELD_MAIL_ATT_CONTENT"]},{"objectId":${object_From_id},"protocolFields":["TSG_FIELD_MAIL_FROM"]},{"objectId":${object_to_id},"protocolFields":["TSG_FIELD_MAIL_TO"]},{"objectId":${object_Content_id},"protocolFields":["TSG_FIELD_MAIL_CONTENT"]},{"objectId":${object_Subject_Id},"protocolFields":["TSG_FIELD_MAIL_SUBJECT"]},{"objectId":4059,"protocolFields":[]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
${addPolicyStr} run keyword if '${addTestClentIPFlag}'=='1' set variable {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Deny-Mail-00002","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"MAIL","method":"drop","code":550},"referenceObject":[{"objectId":${testClentID},"protocolFields":[]},{"objectId":${object_Att_name_id},"protocolFields":["TSG_FIELD_MAIL_ATT_NAME"]},{"objectId":${object_att_content_id},"protocolFields":["TSG_FIELD_MAIL_ATT_CONTENT"]},{"objectId":${object_From_id},"protocolFields":["TSG_FIELD_MAIL_FROM"]},{"objectId":${object_to_id},"protocolFields":["TSG_FIELD_MAIL_TO"]},{"objectId":${object_Content_id},"protocolFields":["TSG_FIELD_MAIL_CONTENT"]},{"objectId":${object_Subject_Id},"protocolFields":["TSG_FIELD_MAIL_SUBJECT"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
${rescode} ${policyId2} AddPolicy ${addPolicyStr}
|
||||||
|
${policyId1} set Variable {"policyType":"tsg_security","policyIds":[${policyId2}]}
|
||||||
|
${policyIds} Create List ${policyId1}
|
||||||
|
#功能端验证
|
||||||
|
Sleep ${policyVerificationSleepSeconds}s
|
||||||
|
${starttime} Get Time
|
||||||
|
${Smtp服务器} Set Variable smtp.163.com
|
||||||
|
${Smtp服务器端口} Set Variable 25
|
||||||
|
${邮箱账号} Set Variable z1343921421z@163.com
|
||||||
|
${邮箱密码} Set Variable VIAVUYPIEJRDQDBN
|
||||||
|
${邮件主题} Set Variable 朱明明subject
|
||||||
|
${发送者} Set Variable z1343921421z@163.com
|
||||||
|
${附件} Set Variable ["${mailpath}/朱明明测试文件.txt"]
|
||||||
|
${接收者} Set Variable ["z1789327568z@163.com"]
|
||||||
|
${抄送者} Set Variable ["z1789327568z@163.com"]
|
||||||
|
${密送者} Set Variable ["z1789327568z@163.com"]
|
||||||
|
${邮件正文} Set Variable 朱明明content
|
||||||
|
${发送邮件返回结果} EmailSendFull ${Smtp服务器} ${Smtp服务器端口} ${邮箱账号} ${邮箱密码} ${邮件主题} ${发送者} ${接收者} ${抄送者} ${密送者} ${邮件正文} ${附件}
|
||||||
|
Log ${发送邮件返回结果}
|
||||||
|
should contain ${发送邮件返回结果} fail
|
||||||
|
Sleep ${policyLogVerificationSleepSeconds}s
|
||||||
|
${endtime} Get Time
|
||||||
|
#日志验证
|
||||||
|
${s} Convert to String ${policyId2}
|
||||||
|
GetLogList security_event_log ${starttime} ${endtime} ${testClentIP} ${s} mail_account z1343921421z@163.com
|
||||||
|
|
||||||
|
SecurityPolicy-Deny-Mail-00003
|
||||||
|
[Tags] Deny Subject
|
||||||
|
#创建对象IP
|
||||||
|
#${rescode} ${object_IP_Id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"ip","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmmtest_IP","objectDesc":"","subObjectIds":[],"addItemList":[{"addrType":4,"protocol":0,"direction":0,"clientIp1":"192.168.50.31","clientIp2":"192.168.50.31","clientIpFormat":"range","clientPortFormat":"","clientPort1":"","clientPort2":"","serverIpFormat":"","serverIp1":"","serverIp2":"","serverPortFormat":"","serverPort1":"","serverPort2":""}],"updateItemList":[],"deleteItemIds":[]}}
|
||||||
|
#log ${object_IP_Id}
|
||||||
|
#创建对象 Subject
|
||||||
|
${rescodeip} ${object_Subject_Id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"keywords","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmm_subject","objectDesc":"","subObjectIds":[],"addItemList":[{"keywordArray":["朱明明subject"],"isHexbin":0,"itemId":"","isValid":""}],"updateItemList":[],"deleteItemIds":[],"objectId":""}}
|
||||||
|
log ${object_Subject_Id}
|
||||||
|
${objectids} set Variable ${object_Subject_Id}
|
||||||
|
#创建策略
|
||||||
|
#${addPolicyStr} set variable {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Deny-Mail-00001","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"MAIL","method":"drop","code":550},"referenceObject":[{"objectId":${object_Att_name_id},"protocolFields":["TSG_FIELD_MAIL_ATT_NAME"]},{"objectId":${object_att_content_id},"protocolFields":["TSG_FIELD_MAIL_ATT_CONTENT"]},{"objectId":${object_From_id},"protocolFields":["TSG_FIELD_MAIL_FROM"]},{"objectId":${object_to_id},"protocolFields":["TSG_FIELD_MAIL_TO"]},{"objectId":${object_Content_id},"protocolFields":["TSG_FIELD_MAIL_CONTENT"]},{"objectId":${object_Subject_Id},"protocolFields":["TSG_FIELD_MAIL_SUBJECT"]},{"objectId":4059,"protocolFields":[]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
${addPolicyStr} run keyword if '${addTestClentIPFlag}'=='1' set variable {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Deny-Mail-00003","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"MAIL","method":"drop","code":550},"referenceObject":[{"objectId":${testClentID},"protocolFields":[]},{"objectId":${object_Subject_Id},"protocolFields":["TSG_FIELD_MAIL_SUBJECT"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
${rescode} ${policyId2} AddPolicy ${addPolicyStr}
|
||||||
|
${policyId1} set Variable {"policyType":"tsg_security","policyIds":[${policyId2}]}
|
||||||
|
${policyIds} Create List ${policyId1}
|
||||||
|
#功能端验证
|
||||||
|
Sleep ${policyVerificationSleepSeconds}s
|
||||||
|
${starttime} Get Time
|
||||||
|
${Smtp服务器} Set Variable smtp.163.com
|
||||||
|
${Smtp服务器端口} Set Variable 25
|
||||||
|
${邮箱账号} Set Variable z1343921421z@163.com
|
||||||
|
${邮箱密码} Set Variable VIAVUYPIEJRDQDBN
|
||||||
|
${邮件主题} Set Variable 朱明明subject
|
||||||
|
${发送者} Set Variable z1343921421z@163.com
|
||||||
|
${附件} Set Variable ["${mailpath}/朱明明测试文件.txt"]
|
||||||
|
${接收者} Set Variable ["z1789327568z@163.com"]
|
||||||
|
${抄送者} Set Variable ["z1789327568z@163.com"]
|
||||||
|
${密送者} Set Variable ["z1789327568z@163.com"]
|
||||||
|
${邮件正文} Set Variable 朱明明content
|
||||||
|
${发送邮件返回结果} EmailSendFull ${Smtp服务器} ${Smtp服务器端口} ${邮箱账号} ${邮箱密码} ${邮件主题} ${发送者} ${接收者} ${抄送者} ${密送者} ${邮件正文} ${附件}
|
||||||
|
Log ${发送邮件返回结果}
|
||||||
|
should contain ${发送邮件返回结果} fail
|
||||||
|
Sleep ${policyLogVerificationSleepSeconds}s
|
||||||
|
${endtime} Get Time
|
||||||
|
#日志验证
|
||||||
|
${s} Convert to String ${policyId2}
|
||||||
|
GetLogList security_event_log ${starttime} ${endtime} ${testClentIP} ${s} mail_account z1343921421z@163.com
|
||||||
|
|
||||||
|
SecurityPolicy-Deny-Mail-00004
|
||||||
|
[Tags] Deny Content
|
||||||
|
#创建对象IP
|
||||||
|
#${rescode} ${object_IP_Id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"ip","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmmtest_IP","objectDesc":"","subObjectIds":[],"addItemList":[{"addrType":4,"protocol":0,"direction":0,"clientIp1":"192.168.50.31","clientIp2":"192.168.50.31","clientIpFormat":"range","clientPortFormat":"","clientPort1":"","clientPort2":"","serverIpFormat":"","serverIp1":"","serverIp2":"","serverPortFormat":"","serverPort1":"","serverPort2":""}],"updateItemList":[],"deleteItemIds":[]}}
|
||||||
|
#log ${object_IP_Id}
|
||||||
|
#创建对象 Content
|
||||||
|
${rescode_deny} ${object_Content_id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"keywords","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmm_content","objectDesc":"","subObjectIds":[],"addItemList":[{"keywordArray":["朱明明content"],"isHexbin":0,"itemId":"","isValid":""}],"updateItemList":[],"deleteItemIds":[],"objectId":""}}
|
||||||
|
log ${object_Content_id}
|
||||||
|
${objectids} set Variable ${object_Content_id}
|
||||||
|
#创建策略
|
||||||
|
#${addPolicyStr} set variable {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Deny-Mail-00001","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"MAIL","method":"drop","code":550},"referenceObject":[{"objectId":${object_Att_name_id},"protocolFields":["TSG_FIELD_MAIL_ATT_NAME"]},{"objectId":${object_att_content_id},"protocolFields":["TSG_FIELD_MAIL_ATT_CONTENT"]},{"objectId":${object_From_id},"protocolFields":["TSG_FIELD_MAIL_FROM"]},{"objectId":${object_to_id},"protocolFields":["TSG_FIELD_MAIL_TO"]},{"objectId":${object_Content_id},"protocolFields":["TSG_FIELD_MAIL_CONTENT"]},{"objectId":${object_Subject_Id},"protocolFields":["TSG_FIELD_MAIL_SUBJECT"]},{"objectId":4059,"protocolFields":[]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
${addPolicyStr} run keyword if '${addTestClentIPFlag}'=='1' set variable {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Deny-Mail-00004","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"MAIL","method":"drop","code":550},"referenceObject":[{"objectId":${testClentID},"protocolFields":[]},{"objectId":${object_Content_id},"protocolFields":["TSG_FIELD_MAIL_CONTENT"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
${rescode} ${policyId2} AddPolicy ${addPolicyStr}
|
||||||
|
${policyId1} set Variable {"policyType":"tsg_security","policyIds":[${policyId2}]}
|
||||||
|
${policyIds} Create List ${policyId1}
|
||||||
|
#功能端验证
|
||||||
|
Sleep ${policyVerificationSleepSeconds}s
|
||||||
|
${starttime} Get Time
|
||||||
|
${Smtp服务器} Set Variable smtp.163.com
|
||||||
|
${Smtp服务器端口} Set Variable 25
|
||||||
|
${邮箱账号} Set Variable z1343921421z@163.com
|
||||||
|
${邮箱密码} Set Variable VIAVUYPIEJRDQDBN
|
||||||
|
${邮件主题} Set Variable 朱明明subject
|
||||||
|
${发送者} Set Variable z1343921421z@163.com
|
||||||
|
${附件} Set Variable ["${mailpath}/朱明明测试文件.txt"]
|
||||||
|
${接收者} Set Variable ["z1789327568z@163.com"]
|
||||||
|
${抄送者} Set Variable ["z1789327568z@163.com"]
|
||||||
|
${密送者} Set Variable ["z1789327568z@163.com"]
|
||||||
|
${邮件正文} Set Variable 朱明明content
|
||||||
|
${发送邮件返回结果} EmailSendFull ${Smtp服务器} ${Smtp服务器端口} ${邮箱账号} ${邮箱密码} ${邮件主题} ${发送者} ${接收者} ${抄送者} ${密送者} ${邮件正文} ${附件}
|
||||||
|
Log ${发送邮件返回结果}
|
||||||
|
should contain ${发送邮件返回结果} fail
|
||||||
|
Sleep ${policyLogVerificationSleepSeconds}s
|
||||||
|
${endtime} Get Time
|
||||||
|
#日志验证
|
||||||
|
${s} Convert to String ${policyId2}
|
||||||
|
GetLogList security_event_log ${starttime} ${endtime} ${testClentIP} ${s} mail_account z1343921421z@163.com
|
||||||
|
|
||||||
|
SecurityPolicy-Deny-Mail-00005
|
||||||
|
[Tags] Deny tt_name
|
||||||
|
#创建对象IP
|
||||||
|
#${rescode} ${object_IP_Id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"ip","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmmtest_IP","objectDesc":"","subObjectIds":[],"addItemList":[{"addrType":4,"protocol":0,"direction":0,"clientIp1":"192.168.50.31","clientIp2":"192.168.50.31","clientIpFormat":"range","clientPortFormat":"","clientPort1":"","clientPort2":"","serverIpFormat":"","serverIp1":"","serverIp2":"","serverPortFormat":"","serverPort1":"","serverPort2":""}],"updateItemList":[],"deleteItemIds":[]}}
|
||||||
|
#log ${object_IP_Id}
|
||||||
|
#创建对象 Att_name
|
||||||
|
${rescode_deny} ${object_Att_name_id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"keywords","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmm_ATT_Name","objectDesc":"","subObjectIds":[],"addItemList":[{"keywordArray":["朱明明测试文件"],"isHexbin":0,"itemId":"","isValid":""}],"updateItemList":[],"deleteItemIds":[],"objectId":""}}
|
||||||
|
log ${object_Att_name_id}
|
||||||
|
${objectids} set Variable ${object_Att_name_id}
|
||||||
|
#创建策略
|
||||||
|
#${addPolicyStr} set variable {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Deny-Mail-00001","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"MAIL","method":"drop","code":550},"referenceObject":[{"objectId":${object_Att_name_id},"protocolFields":["TSG_FIELD_MAIL_ATT_NAME"]},{"objectId":${object_att_content_id},"protocolFields":["TSG_FIELD_MAIL_ATT_CONTENT"]},{"objectId":${object_From_id},"protocolFields":["TSG_FIELD_MAIL_FROM"]},{"objectId":${object_to_id},"protocolFields":["TSG_FIELD_MAIL_TO"]},{"objectId":${object_Content_id},"protocolFields":["TSG_FIELD_MAIL_CONTENT"]},{"objectId":${object_Subject_Id},"protocolFields":["TSG_FIELD_MAIL_SUBJECT"]},{"objectId":4059,"protocolFields":[]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
${addPolicyStr} run keyword if '${addTestClentIPFlag}'=='1' set variable {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Deny-Mail-00005","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"MAIL","method":"drop","code":550},"referenceObject":[{"objectId":${testClentID},"protocolFields":[]},{"objectId":${object_Att_name_id},"protocolFields":["TSG_FIELD_MAIL_ATT_NAME"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
${rescode} ${policyId2} AddPolicy ${addPolicyStr}
|
||||||
|
${policyId1} set Variable {"policyType":"tsg_security","policyIds":[${policyId2}]}
|
||||||
|
${policyIds} Create List ${policyId1}
|
||||||
|
#功能端验证
|
||||||
|
Sleep ${policyVerificationSleepSeconds}s
|
||||||
|
${starttime} Get Time
|
||||||
|
${Smtp服务器} Set Variable smtp.163.com
|
||||||
|
${Smtp服务器端口} Set Variable 25
|
||||||
|
${邮箱账号} Set Variable z1343921421z@163.com
|
||||||
|
${邮箱密码} Set Variable VIAVUYPIEJRDQDBN
|
||||||
|
${邮件主题} Set Variable 朱明明subject
|
||||||
|
${发送者} Set Variable z1343921421z@163.com
|
||||||
|
${附件} Set Variable ["${mailpath}/朱明明测试文件.txt"]
|
||||||
|
${接收者} Set Variable ["z1789327568z@163.com"]
|
||||||
|
${抄送者} Set Variable ["z1789327568z@163.com"]
|
||||||
|
${密送者} Set Variable ["z1789327568z@163.com"]
|
||||||
|
${邮件正文} Set Variable 朱明明content
|
||||||
|
${发送邮件返回结果} EmailSendFull ${Smtp服务器} ${Smtp服务器端口} ${邮箱账号} ${邮箱密码} ${邮件主题} ${发送者} ${接收者} ${抄送者} ${密送者} ${邮件正文} ${附件}
|
||||||
|
Log ${发送邮件返回结果}
|
||||||
|
should contain ${发送邮件返回结果} fail
|
||||||
|
Sleep ${policyLogVerificationSleepSeconds}s
|
||||||
|
${endtime} Get Time
|
||||||
|
#日志验证
|
||||||
|
${s} Convert to String ${policyId2}
|
||||||
|
GetLogList security_event_log ${starttime} ${endtime} ${testClentIP} ${s} mail_account z1343921421z@163.com
|
||||||
|
|
||||||
|
SecurityPolicy-Deny-Mail-00006
|
||||||
|
[Tags] Deny Att_content
|
||||||
|
#创建对象IP
|
||||||
|
#${rescode} ${object_IP_Id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"ip","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmmtest_IP","objectDesc":"","subObjectIds":[],"addItemList":[{"addrType":4,"protocol":0,"direction":0,"clientIp1":"192.168.50.31","clientIp2":"192.168.50.31","clientIpFormat":"range","clientPortFormat":"","clientPort1":"","clientPort2":"","serverIpFormat":"","serverIp1":"","serverIp2":"","serverPortFormat":"","serverPort1":"","serverPort2":""}],"updateItemList":[],"deleteItemIds":[]}}
|
||||||
|
#log ${object_IP_Id}
|
||||||
|
#创建对象 att_content
|
||||||
|
${rescode_deny} ${object_att_content_id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"keywords","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmm_content","objectDesc":"","subObjectIds":[],"addItemList":[{"keywordArray":["朱明明测试文件内容"],"isHexbin":0,"itemId":"","isValid":""}],"updateItemList":[],"deleteItemIds":[],"objectId":""}}
|
||||||
|
log ${object_att_content_id}
|
||||||
|
${objectids} set Variable ${object_att_content_id}
|
||||||
|
#创建策略
|
||||||
|
#${addPolicyStr} set variable {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Deny-Mail-00001","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"MAIL","method":"drop","code":550},"referenceObject":[{"objectId":${object_Att_name_id},"protocolFields":["TSG_FIELD_MAIL_ATT_NAME"]},{"objectId":${object_att_content_id},"protocolFields":["TSG_FIELD_MAIL_ATT_CONTENT"]},{"objectId":${object_From_id},"protocolFields":["TSG_FIELD_MAIL_FROM"]},{"objectId":${object_to_id},"protocolFields":["TSG_FIELD_MAIL_TO"]},{"objectId":${object_Content_id},"protocolFields":["TSG_FIELD_MAIL_CONTENT"]},{"objectId":${object_Subject_Id},"protocolFields":["TSG_FIELD_MAIL_SUBJECT"]},{"objectId":4059,"protocolFields":[]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
${addPolicyStr} run keyword if '${addTestClentIPFlag}'=='1' set variable {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Deny-Mail-00006","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"MAIL","method":"drop","code":550},"referenceObject":[{"objectId":${testClentID},"protocolFields":[]},{"objectId":${object_att_content_id},"protocolFields":["TSG_FIELD_MAIL_ATT_CONTENT"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
${rescode} ${policyId2} AddPolicy ${addPolicyStr}
|
||||||
|
${policyId1} set Variable {"policyType":"tsg_security","policyIds":[${policyId2}]}
|
||||||
|
${policyIds} Create List ${policyId1}
|
||||||
|
#功能端验证
|
||||||
|
Sleep ${policyVerificationSleepSeconds}s
|
||||||
|
${starttime} Get Time
|
||||||
|
${Smtp服务器} Set Variable smtp.163.com
|
||||||
|
${Smtp服务器端口} Set Variable 25
|
||||||
|
${邮箱账号} Set Variable z1343921421z@163.com
|
||||||
|
${邮箱密码} Set Variable VIAVUYPIEJRDQDBN
|
||||||
|
${邮件主题} Set Variable 朱明明subject
|
||||||
|
${发送者} Set Variable z1343921421z@163.com
|
||||||
|
${附件} Set Variable ["${mailpath}/朱明明测试文件.txt"]
|
||||||
|
${接收者} Set Variable ["z1789327568z@163.com"]
|
||||||
|
${抄送者} Set Variable ["z1789327568z@163.com"]
|
||||||
|
${密送者} Set Variable ["z1789327568z@163.com"]
|
||||||
|
${邮件正文} Set Variable 朱明明content
|
||||||
|
${发送邮件返回结果} EmailSendFull ${Smtp服务器} ${Smtp服务器端口} ${邮箱账号} ${邮箱密码} ${邮件主题} ${发送者} ${接收者} ${抄送者} ${密送者} ${邮件正文} ${附件}
|
||||||
|
Log ${发送邮件返回结果}
|
||||||
|
should contain ${发送邮件返回结果} fail
|
||||||
|
Sleep ${policyLogVerificationSleepSeconds}s
|
||||||
|
${endtime} Get Time
|
||||||
|
#日志验证
|
||||||
|
${s} Convert to String ${policyId2}
|
||||||
|
GetLogList security_event_log ${starttime} ${endtime} ${testClentIP} ${s} mail_account z1343921421z@163.com
|
||||||
|
|
||||||
|
SecurityPolicy-Deny-Mail-00007
|
||||||
|
[Tags] Deny From
|
||||||
|
#创建对象IP
|
||||||
|
#${rescode} ${object_IP_Id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"ip","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmmtest_IP","objectDesc":"","subObjectIds":[],"addItemList":[{"addrType":4,"protocol":0,"direction":0,"clientIp1":"192.168.50.31","clientIp2":"192.168.50.31","clientIpFormat":"range","clientPortFormat":"","clientPort1":"","clientPort2":"","serverIpFormat":"","serverIp1":"","serverIp2":"","serverPortFormat":"","serverPort1":"","serverPort2":""}],"updateItemList":[],"deleteItemIds":[]}}
|
||||||
|
#log ${object_IP_Id}
|
||||||
|
#创建对象 From
|
||||||
|
${rescode_deny} ${object_From_id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"account","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmm_from","objectDesc":"","subObjectIds":[],"addItemList":[{"keywordArray":["z1343921421z@163.com"],"itemId":"","isHexbin":0}],"updateItemList":[],"deleteItemIds":[],"objectId":""}}
|
||||||
|
log ${object_From_id}
|
||||||
|
${objectids} set Variable ${object_From_id}
|
||||||
|
#创建策略
|
||||||
|
#${addPolicyStr} set variable {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Deny-Mail-00001","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"MAIL","method":"drop","code":550},"referenceObject":[{"objectId":${object_Att_name_id},"protocolFields":["TSG_FIELD_MAIL_ATT_NAME"]},{"objectId":${object_att_content_id},"protocolFields":["TSG_FIELD_MAIL_ATT_CONTENT"]},{"objectId":${object_From_id},"protocolFields":["TSG_FIELD_MAIL_FROM"]},{"objectId":${object_to_id},"protocolFields":["TSG_FIELD_MAIL_TO"]},{"objectId":${object_Content_id},"protocolFields":["TSG_FIELD_MAIL_CONTENT"]},{"objectId":${object_Subject_Id},"protocolFields":["TSG_FIELD_MAIL_SUBJECT"]},{"objectId":4059,"protocolFields":[]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
${addPolicyStr} run keyword if '${addTestClentIPFlag}'=='1' set variable {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Deny-Mail-00007","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"MAIL","method":"drop","code":550},"referenceObject":[{"objectId":${testClentID},"protocolFields":[]},{"objectId":${object_From_id},"protocolFields":["TSG_FIELD_MAIL_FROM"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
${rescode} ${policyId2} AddPolicy ${addPolicyStr}
|
||||||
|
${policyId1} set Variable {"policyType":"tsg_security","policyIds":[${policyId2}]}
|
||||||
|
${policyIds} Create List ${policyId1}
|
||||||
|
#功能端验证
|
||||||
|
Sleep ${policyVerificationSleepSeconds}s
|
||||||
|
${starttime} Get Time
|
||||||
|
${Smtp服务器} Set Variable smtp.163.com
|
||||||
|
${Smtp服务器端口} Set Variable 25
|
||||||
|
${邮箱账号} Set Variable z1343921421z@163.com
|
||||||
|
${邮箱密码} Set Variable VIAVUYPIEJRDQDBN
|
||||||
|
${邮件主题} Set Variable 朱明明subject
|
||||||
|
${发送者} Set Variable z1343921421z@163.com
|
||||||
|
${附件} Set Variable ["${mailpath}/朱明明测试文件.txt"]
|
||||||
|
${接收者} Set Variable ["z1789327568z@163.com"]
|
||||||
|
${抄送者} Set Variable ["z1789327568z@163.com"]
|
||||||
|
${密送者} Set Variable ["z1789327568z@163.com"]
|
||||||
|
${邮件正文} Set Variable 朱明明content
|
||||||
|
${发送邮件返回结果} EmailSendFull ${Smtp服务器} ${Smtp服务器端口} ${邮箱账号} ${邮箱密码} ${邮件主题} ${发送者} ${接收者} ${抄送者} ${密送者} ${邮件正文} ${附件}
|
||||||
|
Log ${发送邮件返回结果}
|
||||||
|
should contain ${发送邮件返回结果} fail
|
||||||
|
Sleep ${policyLogVerificationSleepSeconds}s
|
||||||
|
${endtime} Get Time
|
||||||
|
#日志验证
|
||||||
|
${s} Convert to String ${policyId2}
|
||||||
|
GetLogList security_event_log ${starttime} ${endtime} ${testClentIP} ${s} mail_account z1343921421z@163.com
|
||||||
|
|
||||||
|
SecurityPolicy-Deny-Mail-00008
|
||||||
|
[Tags] Deny to
|
||||||
|
#创建对象IP
|
||||||
|
#${rescode} ${object_IP_Id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"ip","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmmtest_IP","objectDesc":"","subObjectIds":[],"addItemList":[{"addrType":4,"protocol":0,"direction":0,"clientIp1":"192.168.50.31","clientIp2":"192.168.50.31","clientIpFormat":"range","clientPortFormat":"","clientPort1":"","clientPort2":"","serverIpFormat":"","serverIp1":"","serverIp2":"","serverPortFormat":"","serverPort1":"","serverPort2":""}],"updateItemList":[],"deleteItemIds":[]}}
|
||||||
|
#log ${object_IP_Id}
|
||||||
|
#创建对象 to
|
||||||
|
${rescode_deny} ${object_to_id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"account","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmm_to","objectDesc":"","subObjectIds":[],"addItemList":[{"keywordArray":["z1789327568z@163.com"],"itemId":"","isValid":"","isHexbin":0}],"updateItemList":[],"deleteItemIds":[],"objectId":""}}
|
||||||
|
log ${object_to_id}
|
||||||
|
${objectids} set Variable ${object_to_id}
|
||||||
|
#创建策略
|
||||||
|
#${addPolicyStr} set variable {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Deny-Mail-00001","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"MAIL","method":"drop","code":550},"referenceObject":[{"objectId":${object_Att_name_id},"protocolFields":["TSG_FIELD_MAIL_ATT_NAME"]},{"objectId":${object_att_content_id},"protocolFields":["TSG_FIELD_MAIL_ATT_CONTENT"]},{"objectId":${object_From_id},"protocolFields":["TSG_FIELD_MAIL_FROM"]},{"objectId":${object_to_id},"protocolFields":["TSG_FIELD_MAIL_TO"]},{"objectId":${object_Content_id},"protocolFields":["TSG_FIELD_MAIL_CONTENT"]},{"objectId":${object_Subject_Id},"protocolFields":["TSG_FIELD_MAIL_SUBJECT"]},{"objectId":4059,"protocolFields":[]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
${addPolicyStr} run keyword if '${addTestClentIPFlag}'=='1' set variable {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Deny-Mail-00008","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"MAIL","method":"drop","code":550},"referenceObject":[{"objectId":${testClentID},"protocolFields":[]},{"objectId":${object_to_id},"protocolFields":["TSG_FIELD_MAIL_TO"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
${rescode} ${policyId2} AddPolicy ${addPolicyStr}
|
||||||
|
${policyId1} set Variable {"policyType":"tsg_security","policyIds":[${policyId2}]}
|
||||||
|
${policyIds} Create List ${policyId1}
|
||||||
|
#功能端验证
|
||||||
|
Sleep ${policyVerificationSleepSeconds}s
|
||||||
|
${starttime} Get Time
|
||||||
|
${Smtp服务器} Set Variable smtp.163.com
|
||||||
|
${Smtp服务器端口} Set Variable 25
|
||||||
|
${邮箱账号} Set Variable z1343921421z@163.com
|
||||||
|
${邮箱密码} Set Variable VIAVUYPIEJRDQDBN
|
||||||
|
${邮件主题} Set Variable 朱明明subject
|
||||||
|
${发送者} Set Variable z1343921421z@163.com
|
||||||
|
${附件} Set Variable ["${mailpath}/朱明明测试文件.txt"]
|
||||||
|
${接收者} Set Variable ["z1789327568z@163.com"]
|
||||||
|
${抄送者} Set Variable ["z1789327568z@163.com"]
|
||||||
|
${密送者} Set Variable ["z1789327568z@163.com"]
|
||||||
|
${邮件正文} Set Variable 朱明明content
|
||||||
|
${发送邮件返回结果} EmailSendFull ${Smtp服务器} ${Smtp服务器端口} ${邮箱账号} ${邮箱密码} ${邮件主题} ${发送者} ${接收者} ${抄送者} ${密送者} ${邮件正文} ${附件}
|
||||||
|
Log ${发送邮件返回结果}
|
||||||
|
should contain ${发送邮件返回结果} fail
|
||||||
|
Sleep ${policyLogVerificationSleepSeconds}s
|
||||||
|
${endtime} Get Time
|
||||||
|
#日志验证
|
||||||
|
${s} Convert to String ${policyId2}
|
||||||
|
GetLogList security_event_log ${starttime} ${endtime} ${testClentIP} ${s} mail_account z1343921421z@163.com
|
||||||
89
01-TestCase/tsg_adc/api_security/DenySSLTests.robot
Normal file
89
01-TestCase/tsg_adc/api_security/DenySSLTests.robot
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
*** Settings ***
|
||||||
|
Test Teardown DeletePolicyAndObject ${policyIds} ${objectids}
|
||||||
|
Force Tags tsg_adc tsg_security
|
||||||
|
Library OperatingSystem #Test Setup Login #Test Teardown Logout
|
||||||
|
Resource ../../02-Keyword/tsg-adc/systemcommand.txt
|
||||||
|
Resource ../../02-Keyword/tsg-bf-api/policyobject.txt
|
||||||
|
Resource ../../02-Keyword/tsg-bf-api/logvariable.txt
|
||||||
|
Resource ../../02-Keyword/tsg-bf-api/logschema.txt #Resource log-3.robot
|
||||||
|
Library custometest
|
||||||
|
Resource ../../02-Keyword/tsg-ui/StmpHandle2.robot
|
||||||
|
|
||||||
|
*** Test Cases ***
|
||||||
|
SecurityPolicy-Deny-SSL-00001
|
||||||
|
[Tags] Deny SSL SNI_SAN_CN_Category
|
||||||
|
#创建对象 IP
|
||||||
|
#${rescode} ${object_IP_Id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"ip","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmmtest_IP","objectDesc":"","subObjectIds":[],"addItemList":[{"addrType":4,"protocol":0,"direction":0,"clientIp1":"192.168.50.31","clientIp2":"192.168.50.31","clientIpFormat":"range","clientPortFormat":"","clientPort1":"","clientPort2":"","serverIpFormat":"","serverIp1":"","serverIp2":"","serverPortFormat":"","serverPort1":"","serverPort2":""}],"updateItemList":[],"deleteItemIds":[]}}
|
||||||
|
#log ${object_IP_Id}
|
||||||
|
#${objectids} set Variable ${object_Subid_Id}
|
||||||
|
#创建对象 SNI_CAT
|
||||||
|
${rescodeip} ${object_SNI_CAT_Id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"fqdn_category","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmm_SSL_jd_cat","objectDesc":"","subObjectIds":[],"addItemList":[{"keywordArray":["*d.com"],"itemId":"","isValid":"","isHexbin":0}],"updateItemList":[],"deleteItemIds":[]}}
|
||||||
|
log ${object_SNI_CAT_Id}
|
||||||
|
${objectids} set Variable ${object_SNI_CAT_Id}
|
||||||
|
#创建对象 SAN_CAT
|
||||||
|
${rescode_deny} ${object_SAN_CAT_id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"fqdn_category","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmm_SSL_jd_cat","objectDesc":"","subObjectIds":[],"addItemList":[{"keywordArray":["*d.com"],"itemId":"","isValid":"","isHexbin":0}],"updateItemList":[],"deleteItemIds":[]}}
|
||||||
|
log ${object_SAN_CAT_id}
|
||||||
|
${objectids} set Variable ${object_SNI_CAT_Id},${object_SAN_CAT_id}
|
||||||
|
#创建对象 CN_CAT
|
||||||
|
${rescode_deny} ${object_CN_CAT_id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"fqdn_category","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmm_SSL_jd_cat","objectDesc":"","subObjectIds":[],"addItemList":[{"keywordArray":["*d.com"],"itemId":"","isValid":"","isHexbin":0}],"updateItemList":[],"deleteItemIds":[]}}
|
||||||
|
log ${object_CN_CAT_id}
|
||||||
|
${objectids} set Variable ${object_SNI_CAT_Id},${object_SAN_CAT_id},${object_CN_CAT_id}
|
||||||
|
#创建策略
|
||||||
|
${addPolicyStr} set variable {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Deny-SSL-00001","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"SSL","method":"drop","keyring":1},"referenceObject":[{"objectId":${object_SNI_CAT_Id},"protocolFields":["TSG_FIELD_SSL_SNI"]},{"objectId":${object_CN_CAT_id},"protocolFields":["TSG_FIELD_SSL_CN"]},{"objectId":${object_SAN_CAT_id},"protocolFields":["TSG_FIELD_SSL_SAN"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
${addPolicyStr} run keyword if '${addTestClentIPFlag}'=='1' set variable {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Deny-SSL-00001","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"SSL","method":"drop","keyring":1},"referenceObject":[{"objectId":${testClentID},"protocolFields":[]},{"objectId":${object_SNI_CAT_Id},"protocolFields":["TSG_FIELD_SSL_SNI"]},{"objectId":${object_CN_CAT_id},"protocolFields":["TSG_FIELD_SSL_CN"]},{"objectId":${object_SAN_CAT_id},"protocolFields":["TSG_FIELD_SSL_SAN"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
${rescode} ${policyId2} AddPolicy ${addPolicyStr}
|
||||||
|
${policyId1} set Variable {"policyType":"tsg_security","policyIds":[${policyId2}]}
|
||||||
|
${policyIds} Create List ${policyId1}
|
||||||
|
#${rescode} ${policyId} AddPolicy {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Deny-SSL-00001","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"SSL","method":"drop","keyring":1},"referenceObject":[{"objectId":${object_IP_Id},"protocolFields":[]},{"objectId":${object_SNI_CAT_Id},"protocolFields":["TSG_FIELD_SSL_SNI"]},{"objectId":${object_CN_CAT_id},"protocolFields":["TSG_FIELD_SSL_CN"]},{"objectId":${object_SAN_CAT_id},"protocolFields":["TSG_FIELD_SSL_SAN"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
#log ${rescode}
|
||||||
|
#log ${policyId}
|
||||||
|
#功能端验证
|
||||||
|
Sleep ${policyVerificationSleepSeconds}s
|
||||||
|
${starttime} Get Time
|
||||||
|
${commandreturn} OperatingSystem.Run curl -I \ -m \ 10 \ -o \ /dev/null \ -s \ -w \ \ \%{http_code} \ \ https://www.jd.com
|
||||||
|
should contain ${commandreturn} 000
|
||||||
|
Sleep ${policyLogVerificationSleepSeconds}s
|
||||||
|
${endtime} Get Time
|
||||||
|
#日志验证
|
||||||
|
${s} Convert to String ${policyId2}
|
||||||
|
GetLogList security_event_log ${starttime} ${endtime} ${testClentIP} ${s} ssl_sni xiaozhu
|
||||||
|
|
||||||
|
SecurityPolicy-Deny-SSL-00002
|
||||||
|
[Tags] Deny Fqdn_SNI_CN_SAN
|
||||||
|
#创建对象 Sub
|
||||||
|
${rescode} ${object_Sub_Id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"subscriberid","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmmtest_subid","objectDesc":"","subObjectIds":[],"addItemList":[{"keywordArray":["$zmmtest"],"itemId":"","isHexbin":0}],"updateItemList":[],"deleteItemIds":[]}}
|
||||||
|
log ${object_Sub_Id}
|
||||||
|
${objectids} set Variable ${object_Sub_Id}
|
||||||
|
#创建对象 SNI_FQDN
|
||||||
|
${rescodeip} ${object_SNI_FQDN_Id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"fqdn","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmm_SSL_sogou","objectDesc":"","subObjectIds":[],"addItemList":[{"keywordArray":["*ogou.com"],"itemId":"","isHexbin":0}],"updateItemList":[],"deleteItemIds":[]}}
|
||||||
|
log ${object_SNI_FQDN_Id}
|
||||||
|
${objectids} set Variable ${object_Sub_Id},${object_SNI_FQDN_Id}
|
||||||
|
#创建对象 SAN_FQDN
|
||||||
|
${rescode_deny} ${object_SAN_FQDN_id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"fqdn","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmm_SSL_sogou","objectDesc":"","subObjectIds":[],"addItemList":[{"keywordArray":["*ogou.com"],"itemId":"","isHexbin":0}],"updateItemList":[],"deleteItemIds":[]}}
|
||||||
|
log ${object_SAN_FQDN_id}
|
||||||
|
${objectids} set Variable ${object_Sub_Id},${object_SNI_FQDN_Id},${object_SAN_FQDN_id}
|
||||||
|
#创建对象 CN_FQDN
|
||||||
|
${rescode_deny} ${object_CN_FQDN_id} AddObject {"opAction":"add","returnData":1,"objectList":{"objectType":"fqdn","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"zmm_SSL_sogou","objectDesc":"","subObjectIds":[],"addItemList":[{"keywordArray":["*ogou.com"],"itemId":"","isHexbin":0}],"updateItemList":[],"deleteItemIds":[]}}
|
||||||
|
log ${object_CN_FQDN_id}
|
||||||
|
${objectids} set Variable ${object_Sub_Id},${object_SNI_FQDN_Id},${object_SAN_FQDN_id},${object_CN_FQDN_id}
|
||||||
|
#创建策略
|
||||||
|
${addPolicyStr} set variable {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Deny-SSL-00002","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"SSL","method":"drop","keyring":1},"referenceObject":[{"objectId":${object_Sub_Id},"protocolFields":[]},{"objectId":${object_SNI_FQDN_Id},"protocolFields":["TSG_FIELD_SSL_SNI"]},{"objectId":${object_CN_FQDN_id},"protocolFields":["TSG_FIELD_SSL_CN"]},{"objectId":${object_SAN_FQDN_id},"protocolFields":["TSG_FIELD_SSL_SAN"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
${addPolicyStr} run keyword if '${addTestClentIPFlag}'=='1' set variable {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Deny-SSL-00002","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"SSL","method":"drop","keyring":1},"referenceObject":[{"objectId":${object_Sub_Id},"protocolFields":[]},{"objectId":${object_SNI_FQDN_Id},"protocolFields":["TSG_FIELD_SSL_SNI"]},{"objectId":${object_CN_FQDN_id},"protocolFields":["TSG_FIELD_SSL_CN"]},{"objectId":${object_SAN_FQDN_id},"protocolFields":["TSG_FIELD_SSL_SAN"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
${rescode} ${policyId2} AddPolicy ${addPolicyStr}
|
||||||
|
${policyId1} set Variable {"policyType":"tsg_security","policyIds":[${policyId2}]}
|
||||||
|
${policyIds} Create List ${policyId1}
|
||||||
|
#${rescode} ${policyId} AddPolicy {"opAction":"add","returnData":1,"policyList":{"policyId":"","policyName":"SecurityPolicy-Deny-SSL-00002","policyType":"tsg_security","action":"deny","userTags":"","doBlacklist":0,"doLog":1,"policyDesc":"","effectiveRange":{"tag_sets":[[]]},"userRegion":{"protocol":"SSL","method":"drop","keyring":1},"referenceObject":[{"objectId":${object_Sub_Id},"protocolFields":[]},{"objectId":${object_SNI_FQDN_Id},"protocolFields":["TSG_FIELD_SSL_SNI"]},{"objectId":${object_CN_FQDN_id},"protocolFields":["TSG_FIELD_SSL_CN"]},{"objectId":${object_SAN_FQDN_id},"protocolFields":["TSG_FIELD_SSL_SAN"]}],"isValid":1,"scheduleId":[],"appObjectIdArray":[]}}
|
||||||
|
#log ${rescode}
|
||||||
|
#log ${policyId}
|
||||||
|
#功能端验证
|
||||||
|
Sleep ${policyVerificationSleepSeconds}s
|
||||||
|
${starttime} Get Time
|
||||||
|
${commandreturn} OperatingSystem.Run curl -I \ -m \ 10 \ -o \ /dev/null \ -s \ -w \ \ \%{http_code} \ \ https://www.sogou.com
|
||||||
|
should contain ${commandreturn} 200
|
||||||
|
Sleep ${policyLogVerificationSleepSeconds}s
|
||||||
|
${endtime} Get Time
|
||||||
|
#日志验证
|
||||||
|
${s} Convert to String ${policyId2}
|
||||||
|
GetLogList security_event_log ${starttime} ${endtime} ${testClentIP} ${s} ssl_sni xiaozhu
|
||||||
|
|
||||||
|
|
||||||
25
02-Keyword/tsg_adc/FileOperation.robot
Normal file
25
02-Keyword/tsg_adc/FileOperation.robot
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
*** Settings ***
|
||||||
|
Library String
|
||||||
|
Library json
|
||||||
|
Library OperatingSystem
|
||||||
|
Library RequestsLibrary
|
||||||
|
Library Selenium2Library
|
||||||
|
Library Collections
|
||||||
|
Library FileLibrary
|
||||||
|
Resource ../../02-Keyword/tsg_bfapi/Common.robot
|
||||||
|
Resource ../../03-Variable/BifangApiVariable.txt
|
||||||
|
|
||||||
|
|
||||||
|
*** Keywords ***
|
||||||
|
insert_policyId_to_file
|
||||||
|
[Arguments] ${key} ${policyId} ${objectids}
|
||||||
|
${dict} Create Dictionary policyId=${policyId} objectId=${objectids}
|
||||||
|
${json} json.Dumps ${dict}
|
||||||
|
Alter Dict ${path}/03-Variable/AllFlowCaseVariable.txt ${key} ${json}
|
||||||
|
|
||||||
|
insert_time_to_file
|
||||||
|
[Arguments] ${key} ${starttime} ${endtime}
|
||||||
|
${value} json.Loads ${${key}}
|
||||||
|
${dict} Create Dictionary policyId=${value}[policyId] objectId=${value}[objectId] starttime=${starttime} endtime=${endtime}
|
||||||
|
${json} json.Dumps ${dict}
|
||||||
|
Alter Dict ${path}/03-Variable/AllFlowCaseVariable.txt ${key} ${json}
|
||||||
35
02-Keyword/tsg_adc/SystemCommand.robot
Normal file
35
02-Keyword/tsg_adc/SystemCommand.robot
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
*** Settings ***
|
||||||
|
Library OperatingSystem
|
||||||
|
Library Selenium2Library
|
||||||
|
Library RequestsLibrary
|
||||||
|
Library Collections
|
||||||
|
|
||||||
|
*** Keywords ***
|
||||||
|
SystemCommands
|
||||||
|
[Arguments] ${commandstr} ${stringlist}
|
||||||
|
log toSystemCommand_SystemCommandTest
|
||||||
|
${commandreturn} OperatingSystem.Run ${commandstr}
|
||||||
|
${listlenth}= Get Length ${stringlist}
|
||||||
|
FOR ${var} IN RANGE ${listlenth}
|
||||||
|
#log ${var}
|
||||||
|
Should Contain ${commandreturn} ${stringlist}[${var}]
|
||||||
|
END
|
||||||
|
${rescode} Set Variable 200
|
||||||
|
log ${rescode}
|
||||||
|
[Return] ${rescode}
|
||||||
|
|
||||||
|
SystemCommand
|
||||||
|
[Arguments] ${commandstr} @{stringlist}
|
||||||
|
log dxytest${commandstr}
|
||||||
|
${commandreturn} OperatingSystem.Run ${commandstr}
|
||||||
|
#nslookup -d www.jd.com
|
||||||
|
log ${commandreturn}
|
||||||
|
FOR ${var} IN @{stringlist}
|
||||||
|
log dxytest
|
||||||
|
log ${var}
|
||||||
|
Should Contain ${commandreturn} ${var}
|
||||||
|
END
|
||||||
|
#Should Contain ${commandreturn} ${qatype}
|
||||||
|
${rescode} Set Variable 200
|
||||||
|
log ${rescode}
|
||||||
|
[Return] ${rescode}
|
||||||
50
02-Keyword/tsg_bfapi/ApiRequest.robot
Normal file
50
02-Keyword/tsg_bfapi/ApiRequest.robot
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
*** Settings ***
|
||||||
|
Library Collections
|
||||||
|
Library RequestsLibrary
|
||||||
|
Resource ../../03-Variable/BifangApiVariable.txt
|
||||||
|
|
||||||
|
*** Keywords ***
|
||||||
|
Post-Request
|
||||||
|
[Arguments] ${url} ${data}
|
||||||
|
${header} Create Dictionary Content-Type=application/json Authorization=${token}
|
||||||
|
Create Session api http://${host}:${port}/${version} headers=${header}
|
||||||
|
${remoteResponse} Post Request api ${url} data=${data} headers=${header}
|
||||||
|
${response} to json ${remoteResponse.content}
|
||||||
|
Should Be Equal As Strings ${remoteResponse.status_code} 200
|
||||||
|
[Return] ${response}
|
||||||
|
|
||||||
|
Get-Request
|
||||||
|
[Arguments] ${url}
|
||||||
|
${header} Create Dictionary Content-Type=application/json Authorization=${token}
|
||||||
|
Create Session api http://${host}:${port}/${version} headers=${header}
|
||||||
|
${remoteResponse} Get Request api ${url} headers=${header}
|
||||||
|
${response} to json ${remoteResponse.content}
|
||||||
|
Should Be Equal As Strings ${remoteResponse.status_code} 200
|
||||||
|
[Return] ${response}
|
||||||
|
|
||||||
|
Delete-Request
|
||||||
|
[Arguments] ${url} ${data}
|
||||||
|
${header} Create Dictionary Content-Type=application/json Authorization=${token}
|
||||||
|
Create Session api http://${host}:${port}/${version} headers=${header}
|
||||||
|
${remoteResponse} Delete Request api ${url} data=${data} headers=${header}
|
||||||
|
${response} to json ${remoteResponse.content}
|
||||||
|
Should Be Equal As Strings ${remoteResponse.status_code} 200
|
||||||
|
[Return] ${response}
|
||||||
|
|
||||||
|
UpFilePostRequest
|
||||||
|
[Arguments] ${url} ${data} ${files} ${fileDesc}
|
||||||
|
${header} Set To Dictionary ${fileDesc} Authorization=${token}
|
||||||
|
Create Session api http://${host}:${port}/${version} headers=${header}
|
||||||
|
${remoteResponse} Post Request api ${url} data=${data} files=${files} headers=${header}
|
||||||
|
${response} to json ${remoteResponse.content}
|
||||||
|
Should Be Equal As Strings ${remoteResponse.status_code} 200
|
||||||
|
[Return] ${response}
|
||||||
|
|
||||||
|
UpFilePutRequest
|
||||||
|
[Arguments] ${url} ${data} ${files} ${fileDesc}
|
||||||
|
${header} Set To Dictionary ${fileDesc} Authorization=${token}
|
||||||
|
Create Session api http://${host}:${port}/${version} headers=${header}
|
||||||
|
${remoteResponse} Put Request api ${url} params=${data} files=${files} headers=${header}
|
||||||
|
${response} to json ${remoteResponse.content}
|
||||||
|
Should Be Equal As Strings ${remoteResponse.status_code} 200
|
||||||
|
[Return] ${response}
|
||||||
36
02-Keyword/tsg_bfapi/Common.robot
Normal file
36
02-Keyword/tsg_bfapi/Common.robot
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
*** Settings ***
|
||||||
|
Resource ../../03-Variable/BifangApiVariable.txt
|
||||||
|
Library REST http://${host}:${port}
|
||||||
|
Library Collections
|
||||||
|
Library RequestsLibrary
|
||||||
|
|
||||||
|
*** Keywords ***
|
||||||
|
BasePostRequest
|
||||||
|
[Arguments] ${apistr} ${body}
|
||||||
|
Set Headers {"Authorization":"${token}","Content-Type":"application/json"}
|
||||||
|
&{httpResponse} Post ${apistr} ${body}
|
||||||
|
Output response body
|
||||||
|
Object response body
|
||||||
|
#Integer $.code 200
|
||||||
|
#Array $.data.policyList
|
||||||
|
${response} Set Variable ${httpResponse.body}
|
||||||
|
[Return] ${response}
|
||||||
|
BaseDeleteRequest
|
||||||
|
[Arguments] ${requestUri} ${data}
|
||||||
|
${headers} set variable {"Authorization":"${token}","Content-Type":"application/json"}
|
||||||
|
create session api http://${host}:${port} ${headers}
|
||||||
|
${response}= Delete Request api ${requestUri} data=${data}
|
||||||
|
log return data =${response}
|
||||||
|
Should Be Equal As Strings ${response.status_code} 200
|
||||||
|
${response} to json ${response.content}
|
||||||
|
[Return] ${response}
|
||||||
|
|
||||||
|
BaseEditRequest
|
||||||
|
[Arguments] ${requestUri} ${data}
|
||||||
|
${headers} set variable {"Authorization":"${token}","Content-Type":"application/json"}
|
||||||
|
create session api http://${host}:${port} ${headers}
|
||||||
|
${response}= Put Request api ${requestUri} data=${data}
|
||||||
|
log return data =${response}
|
||||||
|
Should Be Equal As Strings ${response.status_code} 200
|
||||||
|
${response} to json ${response.content}
|
||||||
|
[Return] ${response}
|
||||||
33
02-Keyword/tsg_bfapi/LogSchema.robot
Normal file
33
02-Keyword/tsg_bfapi/LogSchema.robot
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
*** Settings ***
|
||||||
|
Resource ../../03-Variable/BifangApiVariable.txt
|
||||||
|
Library RequestsLibrary
|
||||||
|
Library OperatingSystem
|
||||||
|
Library Collections
|
||||||
|
Library string
|
||||||
|
Library REST http://${host}:${port}
|
||||||
|
|
||||||
|
*** Keywords ***
|
||||||
|
GetLogCondition
|
||||||
|
[Arguments] ${logname} ${startTime} ${endTime} ${client_ip} ${policy_id}
|
||||||
|
Set Headers {"Content-Type":"application/x-www-form-urlencoded","Authorization":"${token}"}
|
||||||
|
&{LogSchemaResponse}= GET /v1/log/schema?logType=${logname}
|
||||||
|
log ${logname}
|
||||||
|
Output Schema response body
|
||||||
|
Object response body
|
||||||
|
#Integer $.code 200
|
||||||
|
log ${LogSchemaResponse.body['data']}
|
||||||
|
${field} Evaluate json.dumps(eval(str(${LogSchemaResponse.body['data']['fields']}))) json
|
||||||
|
log ${field}
|
||||||
|
${pageSize} Set Variable 30
|
||||||
|
${pageNo} Set Variable 1
|
||||||
|
${condition} Set Variable [{"value":["${startTime}","${endTime}"],"symbol":"between","field":"common_recv_time","type":"timestamp"}]
|
||||||
|
${logCondition} Set Variable {"pageNo":${pageNo},"pageSize":${pageSize},"logType":"${logname}","fields":${field},"start_common_recv_time":"${startTime}","end_common_recv_time":"${endTime}","conditions":${condition} ,"common_client_ips":"${client_ip}","common_policy_ids":"${policy_id}"}
|
||||||
|
log this time query condition:${logCondition}
|
||||||
|
[Return] ${logCondition}
|
||||||
|
|
||||||
|
PostRemoteData
|
||||||
|
[Arguments] ${url} ${data}
|
||||||
|
${header} Create Dictionary Content-Type=application/json Authorization=${token}
|
||||||
|
Create Session api http://${host}:${port}/${version} headers=${header}
|
||||||
|
${remoteResponse} Post Request api ${url} data=${data} headers=${header}
|
||||||
|
[Return] ${remoteResponse}
|
||||||
32
02-Keyword/tsg_bfapi/LogVariable.robot
Normal file
32
02-Keyword/tsg_bfapi/LogVariable.robot
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
*** Settings ***
|
||||||
|
Resource ../../03-Variable/BifangApiVariable.txt
|
||||||
|
Resource LogSchema.robot
|
||||||
|
Library REST http://${host}:${port}/${version}
|
||||||
|
Library RequestsLibrary
|
||||||
|
Library OperatingSystem
|
||||||
|
Library Collections
|
||||||
|
Library string
|
||||||
|
|
||||||
|
*** Keywords ***
|
||||||
|
GetLogList
|
||||||
|
[Arguments] ${logType} ${startTime} ${endTime} ${client_ip} ${policy_id} ${parmkey} ${parmvalue}
|
||||||
|
${logCondition} GetLogCondition ${logType} ${startTime} ${endTime} ${client_ip} ${policy_id}
|
||||||
|
log ${logCondition}
|
||||||
|
${LogListResponse} PostRemoteData /log/list ${logCondition}
|
||||||
|
Should Be Equal As Strings ${LogListResponse.status_code} 200
|
||||||
|
${returnData} To Json ${LogListResponse.content}
|
||||||
|
${responseCode} Get From Dictionary ${returnData} code
|
||||||
|
Log ${responseCode}
|
||||||
|
Should Be Equal ${responseCode} ${200} security_event_log \ \ test query list failed
|
||||||
|
log this time request security_event_log \ table logRecord \ : ${LogListResponse.content}
|
||||||
|
${a} Set Variable this time request security_event_log \ table logRecord \ : ${LogListResponse.content}
|
||||||
|
log ${a}
|
||||||
|
${log} Set Variable ${LogListResponse.json()}[data][list]
|
||||||
|
FOR ${logs} IN ${log}
|
||||||
|
log ${logs}
|
||||||
|
END
|
||||||
|
log %%%%%%%%%%%%%%%%%%%%%%%%${logs}
|
||||||
|
Should Contain ${logs}"" ${client_ip}
|
||||||
|
Should Contain ${logs}"" ${policy_id}
|
||||||
|
Should Contain ${logs}"" ${parmkey}
|
||||||
|
Should Contain ${logs}"${parmkey}" ${parmvalue}
|
||||||
84
02-Keyword/tsg_bfapi/LoginLogout.robot
Normal file
84
02-Keyword/tsg_bfapi/LoginLogout.robot
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
*** Settings ***
|
||||||
|
Resource ../../03-Variable/BifangApiVariable.txt
|
||||||
|
Library REST http://${host}:${port}
|
||||||
|
Library Collections
|
||||||
|
Library SSHLibrary
|
||||||
|
Resource PolicyObject.robot
|
||||||
|
Resource ../tsg_ui/Logout/Logout.robot
|
||||||
|
Resource ../tsg_ui/Login/Login.robot
|
||||||
|
Resource Tag.robot
|
||||||
|
|
||||||
|
*** Keywords ***
|
||||||
|
Login
|
||||||
|
#[Arguments] ${username} ${password} ${authmode} ${authCode} ${ldapId}
|
||||||
|
# 毕方接口用户名密码
|
||||||
|
GET /v1/user/encryptpwd?password=${password}
|
||||||
|
Object response body
|
||||||
|
#OUTPUT response body
|
||||||
|
#${rescode} Integer $.code
|
||||||
|
Integer $.code 200
|
||||||
|
#log ${rescode}
|
||||||
|
${pwd} String $.data.encryptpwd
|
||||||
|
#log ${pwd}
|
||||||
|
${pwdstr} Get From List ${pwd} 0
|
||||||
|
#log aaaaaaa
|
||||||
|
log ${pwdstr}
|
||||||
|
#log bbb
|
||||||
|
SET GLOBAL VARIABLE ${encodePassword} ${pwdstr}
|
||||||
|
#log aaaaaaa
|
||||||
|
log ${encodePassword}
|
||||||
|
#log aaaaaaa
|
||||||
|
#log ${host}:${port}
|
||||||
|
#getToken##################################################################################
|
||||||
|
#log ${username}
|
||||||
|
#log ${pwdstr}
|
||||||
|
POST /v1/user/login?username=${username}&password=${encodePassword}&authMode=${authmode}
|
||||||
|
Object response body
|
||||||
|
#OUTPUT response body
|
||||||
|
Integer $.code 200
|
||||||
|
#${rescodelist} Integer $.code
|
||||||
|
#${rescode} Get From List ${rescodelist} 0
|
||||||
|
${rescode} Integer $.code
|
||||||
|
log ${rescode}
|
||||||
|
${tokenGlobal} String $.data.token
|
||||||
|
${tokenStr} Get From List ${tokenGlobal} 0
|
||||||
|
log ${tokenStr}
|
||||||
|
SET GLOBAL VARIABLE ${token} ${tokenStr}
|
||||||
|
log ${token}
|
||||||
|
SET GLOBAL VARIABLE ${headers} {"Contest-Type":"application/json","Authorization":"${token}"}
|
||||||
|
#Return ${rescode}
|
||||||
|
|
||||||
|
Logout
|
||||||
|
POST /v1/user/logout headers=${headers}
|
||||||
|
Object response body
|
||||||
|
Integer $.code 200
|
||||||
|
${rescode} Integer $.code
|
||||||
|
#[Return] ${rescode}
|
||||||
|
|
||||||
|
ApiLoginAndAddLocalIP
|
||||||
|
[Arguments] ${tempparm}
|
||||||
|
log ApiLoginAndAddLocalIP${tempparm}
|
||||||
|
loginlogout.Login
|
||||||
|
#log **********
|
||||||
|
Run Keyword If ${addTestClentIPFlag}==1 AddLocalIPObject
|
||||||
|
log ApiLoginAndAddLocalIP
|
||||||
|
#ApiAddAutoTagsCase
|
||||||
|
#[Return] ${rescode}
|
||||||
|
|
||||||
|
ApiLogoutAndDelLocalIP
|
||||||
|
[Arguments] ${tempparm}
|
||||||
|
log ApiLogoutAndDelLocalIP${tempparm}
|
||||||
|
log to_LogoutAndDelLocalIP_LogoutAndDelLocalIP
|
||||||
|
Run Keyword If ${addTestClentIPFlag}==1 DelLocalIPObject
|
||||||
|
#ApiDeleteAutoTagsCase
|
||||||
|
loginlogout.Logout
|
||||||
|
#[Return] ${rescode}
|
||||||
|
|
||||||
|
CliLogin
|
||||||
|
Open Connection ${cliHost}
|
||||||
|
SSHLibrary.Login ${cliUsername} ${cliPassword}
|
||||||
|
|
||||||
|
CliLogout
|
||||||
|
Close Connection
|
||||||
|
Log Close connection
|
||||||
|
#exit
|
||||||
111
02-Keyword/tsg_bfapi/PolicyObject.robot
Normal file
111
02-Keyword/tsg_bfapi/PolicyObject.robot
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
*** Settings ***
|
||||||
|
Resource ../../03-Variable/BifangApiVariable.txt
|
||||||
|
Library REST http://${host}:${port}
|
||||||
|
Library Collections
|
||||||
|
Library RequestsLibrary
|
||||||
|
Resource Common.robot
|
||||||
|
|
||||||
|
*** Keywords ***
|
||||||
|
AddLocalIPObject
|
||||||
|
#创建对象IP
|
||||||
|
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":[]}}
|
||||||
|
${rescodeip} ${objidip} AddObject ${localIP}
|
||||||
|
log ${rescodeip}
|
||||||
|
log LocalIP:${objidip}
|
||||||
|
SET GLOBAL VARIABLE ${testClentID} ${objidip}
|
||||||
|
|
||||||
|
DelLocalIPObject
|
||||||
|
log to_DelLocalIPObject
|
||||||
|
${response} BaseDeleteRequest /v1/policy/object {"objectIds":[${testClentID}]}
|
||||||
|
#${response_code} Get From Dictionary ${response} code
|
||||||
|
Should Be Equal As Strings ${response} {'code': 200, 'msg': 'Success', 'success': True}
|
||||||
|
SET GLOBAL VARIABLE ${testClentID} ${EMPTY}
|
||||||
|
|
||||||
|
AddObject
|
||||||
|
[Arguments] ${body}
|
||||||
|
#addIPobject#################################################################################
|
||||||
|
${response} BasePostRequest /v1/policy/object body=${body}
|
||||||
|
#log ${response}
|
||||||
|
${objectId} Set Variable ${response['data']['objectList'][0]['objectId']}
|
||||||
|
${rescodeReturn} Set Variable ${response['code']}
|
||||||
|
[Return] ${rescodeReturn} ${objectId}
|
||||||
|
|
||||||
|
EditObject
|
||||||
|
[Arguments] @{body}
|
||||||
|
[Return] ${rescode} ${objectId}
|
||||||
|
|
||||||
|
DeleteObjectbak
|
||||||
|
[Arguments] ${objectids}
|
||||||
|
${body} String {"objectIds":[${objectids}]}
|
||||||
|
DELETE /v1/policy/object body=${body} headers=${headers}
|
||||||
|
Object response body
|
||||||
|
log DeleteObject
|
||||||
|
log dxytestOUtputstart
|
||||||
|
Output response body
|
||||||
|
log dxytestOUtputstart
|
||||||
|
${rescode} Integer $.code
|
||||||
|
${rescodeReturn} Get From List ${rescode} 0
|
||||||
|
[Return] ${rescodeReturn}
|
||||||
|
|
||||||
|
AddPolicy
|
||||||
|
[Arguments] ${body}
|
||||||
|
${response} BasePostRequest /v1/policy/compile body=${body}
|
||||||
|
#log ${response}
|
||||||
|
${policyId} Set Variable ${response['data']['policyList'][0]['policyId']}
|
||||||
|
${rescode} Set Variable ${response['code']}
|
||||||
|
[Return] ${rescode} ${policyId}
|
||||||
|
|
||||||
|
EditPolicy
|
||||||
|
[Arguments] @{body}
|
||||||
|
[Return] ${rescode} ${objectId}
|
||||||
|
|
||||||
|
DeletePolicybak
|
||||||
|
[Arguments] ${policyids}
|
||||||
|
${body} String {"policyType":"tsg_security","policyIds":[${policyids}]}
|
||||||
|
DELETE /v1/policy/compile body=${body} headers=${headers}
|
||||||
|
Object response body
|
||||||
|
log DeletePolicy
|
||||||
|
Output response body
|
||||||
|
${rescode} Integer $.code
|
||||||
|
${rescodeReturn} Get From List ${rescode} 0
|
||||||
|
[Return] ${rescodeReturn}
|
||||||
|
|
||||||
|
DeletePolicy
|
||||||
|
[Arguments] ${body}
|
||||||
|
#删除策略
|
||||||
|
log toDeletePolicy_DeletePolicyDeletePolicy
|
||||||
|
${response} BaseDeleteRequest /v1/policy/compile ${body}
|
||||||
|
#{"policyType":"tsg_security","policyIds":[${policyids}]}
|
||||||
|
${response_code} Get From Dictionary ${response} code
|
||||||
|
Should Be Equal As Strings ${response_code} 200
|
||||||
|
${response} Convert to String ${response}
|
||||||
|
Should Be Equal As Strings ${response} {'code': 200, 'msg': 'Success', 'success': True}
|
||||||
|
|
||||||
|
DeleteObject
|
||||||
|
[Arguments] ${objectids}
|
||||||
|
#删除对象
|
||||||
|
log todeleteobj
|
||||||
|
${response} BaseDeleteRequest /v1/policy/object {"objectIds":[${objectids}]}
|
||||||
|
${response_code} Get From Dictionary ${response} code
|
||||||
|
#log aaaaaaaaaa:${response_code}
|
||||||
|
Should Be Equal As Strings ${response_code} 200
|
||||||
|
#Integer ${response_code} 200
|
||||||
|
${response} Convert to String ${response}
|
||||||
|
Should Be Equal As Strings ${response} {'code': 200, 'msg': 'Success', 'success': True}
|
||||||
|
|
||||||
|
DeletePolicyAndObject
|
||||||
|
[Arguments] ${policyids} ${objectids}
|
||||||
|
#删除和对象
|
||||||
|
#删除策略
|
||||||
|
log toDeletePolicy_DeletePolicyAndObject
|
||||||
|
${listlenth}= Get Length ${policyids}
|
||||||
|
FOR ${var} IN RANGE ${listlenth}
|
||||||
|
#log dxytest111111
|
||||||
|
log ${var}
|
||||||
|
DeletePolicy ${policyids}[${var}]
|
||||||
|
#Should Contain ${commandreturn} ${ca}
|
||||||
|
END
|
||||||
|
#删除对象
|
||||||
|
log todeleteobj_DeletePolicyAndObject
|
||||||
|
DeleteObject ${objectids}
|
||||||
41
02-Keyword/tsg_bfapi/Tag.robot
Normal file
41
02-Keyword/tsg_bfapi/Tag.robot
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
*** Settings ***
|
||||||
|
Resource ../../03-Variable/BifangApiVariable.txt
|
||||||
|
Library REST http://${host}:${port}
|
||||||
|
Library Collections
|
||||||
|
Library RequestsLibrary
|
||||||
|
Resource Common.robot
|
||||||
|
|
||||||
|
*** Keywords ***
|
||||||
|
ApiAddTags
|
||||||
|
[Arguments] ${body}
|
||||||
|
#ApiAddTags#################################################################################
|
||||||
|
${response} BasePostRequest /v1/customize/tags body=${body}
|
||||||
|
#log ${response}
|
||||||
|
${tagId} Set Variable ${response['data']['tagList'][0]['id']}
|
||||||
|
${rescodeReturn} Set Variable ${response['code']}
|
||||||
|
[Return] ${rescodeReturn} ${objectId}
|
||||||
|
|
||||||
|
ApiEditTags
|
||||||
|
[Arguments] @{body}
|
||||||
|
[Return] ${rescode} ${objectId}
|
||||||
|
|
||||||
|
ApiDeleteTags
|
||||||
|
[Arguments] ${body}
|
||||||
|
#删除策略
|
||||||
|
log toApiDeleteTags
|
||||||
|
${response} BaseDeleteRequest /v1/customize/tags ${body}
|
||||||
|
${response_code} Get From Dictionary ${response} code
|
||||||
|
Should Be Equal As Strings ${response_code} 200
|
||||||
|
${response} Convert to String ${response}
|
||||||
|
Should Be Equal As Strings ${response} {'code': 200, 'msg': 'Success', 'success': True}
|
||||||
|
|
||||||
|
ApiAddAutoTagsCase
|
||||||
|
#ApiAddTags#################################################################################
|
||||||
|
${rescode} ${tag_id} ApiAddTags {"tagList":{"id":0,"isValid":1,"opTime":1585652133641,"opUser":0,"optionType":2,"pid":0,"tagId":"","tagColor":"rgb(21, 101, 192)","tags":[{"tagId":"","tagName":"ApiAutoTest","key":1585652121540}],"tagList":[],"tagCategory":"AutoTest"},"returnData":0}
|
||||||
|
log ${tag_id}
|
||||||
|
SET GLOBAL VARIABLE ${userTagIds} ${tag_id}
|
||||||
|
|
||||||
|
ApiDeleteAutoTagsCase
|
||||||
|
#ApiAddTags#################################################################################
|
||||||
|
ApiDeleteTags {"ids":[${userTagIds}]}
|
||||||
|
|
||||||
@@ -0,0 +1,192 @@
|
|||||||
|
*** Settings ***
|
||||||
|
Library String
|
||||||
|
Library OperatingSystem
|
||||||
|
Library RequestsLibrary
|
||||||
|
Library Selenium2Library
|
||||||
|
Library Collections
|
||||||
|
Resource ../../../02-Keyword/tsg-bf-api/common.txt
|
||||||
|
Resource ../../../02-Keyword/tsg-bf-api/apirequest.txt
|
||||||
|
Resource ../../../03-Variable/bifangapivariable.txt
|
||||||
|
|
||||||
|
|
||||||
|
*** Keywords ***
|
||||||
|
QueryPolicyFile
|
||||||
|
[Arguments] ${url} ${suffix}
|
||||||
|
${content_quary} Get-Request ${url}?isValid=1&${suffix}
|
||||||
|
${msg_quary} Set Variable ${content_quary['msg']}
|
||||||
|
${length} Get Length ${content_quary['data']['list']}
|
||||||
|
Should Be True ${length}>0
|
||||||
|
Log quary operation:${msg_quary}
|
||||||
|
Log data:${content_quary['data']['list']}
|
||||||
|
|
||||||
|
QueryPolicyFile2
|
||||||
|
[Arguments] ${url} ${suffix}
|
||||||
|
${content_quary} Get-Request ${url}?${suffix}
|
||||||
|
${msg_quary} Set Variable ${content_quary['msg']}
|
||||||
|
${length} Get Length ${content_quary['data']['list']}
|
||||||
|
Should Be True ${length}>0
|
||||||
|
Log quary operation:${msg_quary}
|
||||||
|
Log data:${content_quary['data']['list']}
|
||||||
|
${certId} Set Variable ${content_quary['data']['list'][0]['certId']}
|
||||||
|
[Return] ${certId}
|
||||||
|
|
||||||
|
CreatePolicyFile
|
||||||
|
[Documentation]
|
||||||
|
... 必传参数:url、filePath(文件路径)、fileName(文件名称)
|
||||||
|
... 可选参数:header(不传时使用默认值)
|
||||||
|
[Arguments] ${url} ${filePath} ${fileName} @{header}
|
||||||
|
${suffix} Generate Random String
|
||||||
|
${certName} Catenate SEPARATOR=_ test ${suffix}
|
||||||
|
${header} Run Keyword If ${header}==[] Set Variable {"isValid":1,"opAction":"add","certName":"${certName}","certId":null,"returnData":1}
|
||||||
|
... ELSE Get From List ${header} 0
|
||||||
|
|
||||||
|
${binFile} Evaluate open(r"${path}/${filePath}${fileName}",'rb')
|
||||||
|
${fileDict} Create Dictionary file=${binFile}
|
||||||
|
${requestData} Create Dictionary name="file" filename="${fileName}" Content-Type=application/octet-stream
|
||||||
|
${fileDesc} Create Dictionary File-Desc=${header}
|
||||||
|
${content} UpFilePostRequest ${url} ${requestData} ${fileDict} ${fileDesc}
|
||||||
|
${msg} Set Variable ${content['msg']}
|
||||||
|
${list} Set Variable ${content['data']['list']}
|
||||||
|
${cerId} Set Variable ${list[0]['certId']}
|
||||||
|
${certName} Set Variable ${list[0]['certName']}
|
||||||
|
${response} Create Dictionary msg=${msg} certId=${cerId} certName=${certName}
|
||||||
|
Log add operation:${msg}
|
||||||
|
Log cerId:${cerId}
|
||||||
|
[Return] ${response}
|
||||||
|
|
||||||
|
CreatePolicyFile2
|
||||||
|
[Documentation]
|
||||||
|
... 必传参数:url、filePath(文件路径)、fileName(文件名称)、flag(模块标识)
|
||||||
|
... 可选参数:header(不传时使用默认值)
|
||||||
|
[Arguments] ${url} ${filePath} ${fileName} ${flag} @{header}
|
||||||
|
${suffix} Generate Random String
|
||||||
|
${randomName} Catenate SEPARATOR=_ test ${suffix}
|
||||||
|
${value} Run Keyword If '${flag}'=='resPages' Set Variable {"isValid":1,"format":"html","opAction":"add","profileName":"${randomName}","profileId":null,"returnData":1}
|
||||||
|
... ELSE IF '${flag}'=='hijack' Set Variable {"isValid":1,"contentType":"text/html","opAction":"add","profileName":"${randomName}","contentName":"${fileName}","profileId":null,"returnData":1}
|
||||||
|
... ELSE IF '${flag}'=='insert' Set Variable {"isValid":1,"format":"js","insertOn":"after_page_load","opAction":"add","profileName":"${randomName}","profileId":null,"returnData":1}
|
||||||
|
|
||||||
|
${header} Run Keyword If ${header}==[] Set Variable ${value}
|
||||||
|
... ELSE Get From List ${header} 0
|
||||||
|
|
||||||
|
${binFile} Evaluate open(r"${path}/${filePath}${fileName}",'rb')
|
||||||
|
${fileDict} Create Dictionary file=${binFile}
|
||||||
|
${requestData} Create Dictionary name="file" filename="${fileName}" Content-Type=application/octet-stream
|
||||||
|
${suffix} Generate Random String
|
||||||
|
${profileName} Catenate SEPARATOR=_ test ${suffix}
|
||||||
|
${fileDesc} Create Dictionary File-Desc=${header}
|
||||||
|
${content} UpFilePostRequest ${url} ${requestData} ${fileDict} ${fileDesc}
|
||||||
|
${msg} Set Variable ${content['msg']}
|
||||||
|
${list} Set Variable ${content['data']['list']}
|
||||||
|
${profileId} Set Variable ${list[0]['profileId']}
|
||||||
|
${profileName} Set Variable ${list[0]['profileName']}
|
||||||
|
${response} Create Dictionary msg=${msg} profileId=${profileId} profileName=${profileName}
|
||||||
|
Log add operation:${msg}
|
||||||
|
Log profileId:${profileId}
|
||||||
|
[Return] ${response}
|
||||||
|
|
||||||
|
CreatePolicyFile3
|
||||||
|
[Documentation]
|
||||||
|
... 必传参数:url
|
||||||
|
... 可选参数:data(不传时使用默认值)
|
||||||
|
[Arguments] ${url} @{data}
|
||||||
|
${suffix} Generate Random String
|
||||||
|
${profileName} Catenate SEPARATOR=_ test ${suffix}
|
||||||
|
${data} Run Keyword If ${data}==[] Set Variable {"opAction":"add","returnData":1,"trafficMirrorList":[{"profileName":"${profileName}","addrType":"mac","isValid":1,"addrArray":["00:A1:B2:06:C3:29"]}]}
|
||||||
|
... ELSE Get From List ${data} 0
|
||||||
|
|
||||||
|
${content} Post-Request ${url} ${data}
|
||||||
|
${msg} Set Variable ${content['msg']}
|
||||||
|
${list} Set Variable ${content['data']['list']}
|
||||||
|
${profileId} Set Variable ${list[0]['profileId']}
|
||||||
|
${profileName} Set Variable ${list[0]['profileName']}
|
||||||
|
${response} Create Dictionary msg=${msg} profileId=${profileId} profileName=${profileName}
|
||||||
|
Log add operation:${msg}
|
||||||
|
Log profileId:${profileId}
|
||||||
|
[Return] ${response}
|
||||||
|
|
||||||
|
CreatePolicyMutipartFile
|
||||||
|
[Documentation]
|
||||||
|
... 必传参数:url、filePath(文件路径)、pubFileName(证书文件名)、priFileName(私钥文件名)
|
||||||
|
... 可选参数:header(不传时使用默认值)
|
||||||
|
[Arguments] ${url} ${filePath} ${pubFileName} ${priFileName} @{header}
|
||||||
|
${suffix} Generate Random String
|
||||||
|
${certName} Catenate SEPARATOR=_ test ${suffix}
|
||||||
|
${header} Run Keyword If ${header}==[] Set Variable {"isValid":1,"opAction":"add","returnData":1,"keyringName":"${certName}","keyringType":"root","reissueExpiryHour":0,"crl":"null","publicKeyAlgo":"rsa1024","keyringId":null,"includeRoot":0}
|
||||||
|
... ELSE Get From List ${header} 0
|
||||||
|
|
||||||
|
${pubFile} Evaluate open(r"${path}/${filePath}${pubFileName}",'rb')
|
||||||
|
${priFile} Evaluate open(r"${path}/${filePath}${priFileName}",'rb')
|
||||||
|
${fileDict} Create Dictionary publicFile ${pubFile}
|
||||||
|
Set To Dictionary ${fileDict} privateFile ${priFile}
|
||||||
|
${requestData} Create Dictionary name="publicFile" filename="${pubFileName}" Content-Type=application/octet-stream
|
||||||
|
Set To Dictionary ${requestData} name privateFile
|
||||||
|
Set To Dictionary ${requestData} filename ${priFileName}
|
||||||
|
Set To Dictionary ${requestData} Content-Type application/octet-stream
|
||||||
|
${fileDesc} Create Dictionary File-Desc=${header}
|
||||||
|
|
||||||
|
${content} UpFilePostRequest ${url} ${requestData} ${fileDict} ${fileDesc}
|
||||||
|
${msg} Set Variable ${content['msg']}
|
||||||
|
${list} Set Variable ${content['data']['list']}
|
||||||
|
${keyringId} Set Variable ${list[0]['keyringId']}
|
||||||
|
${keyringName} Set Variable ${list[0]['keyringName']}
|
||||||
|
${response} Create Dictionary msg=${msg} keyringId=${keyringId} keyringName=${keyringName}
|
||||||
|
Log add operation:${msg}
|
||||||
|
Log keyringId:${keyringId}
|
||||||
|
[Return] ${response}
|
||||||
|
|
||||||
|
UpdatePolicyMutipartFile
|
||||||
|
[Arguments] ${url} ${filePath} ${pubFileName} ${priFileName} ${reqHeader}
|
||||||
|
${pubFile} Evaluate open(r"${path}/${filePath}${pubFileName}",'rb')
|
||||||
|
${priFile} Evaluate open(r"${path}/${filePath}${priFileName}",'rb')
|
||||||
|
${fileDict} Create Dictionary publicFile ${pubFile}
|
||||||
|
Set To Dictionary ${fileDict} privateFile ${priFile}
|
||||||
|
|
||||||
|
${requestData} Create Dictionary name="publicFile" filename="${pubFileName}" Content-Type=application/octet-stream
|
||||||
|
Set To Dictionary ${requestData} name privateFile
|
||||||
|
Set To Dictionary ${requestData} filename ${priFileName}
|
||||||
|
Set To Dictionary ${requestData} Content-Type application/octet-stream
|
||||||
|
|
||||||
|
${fileDesc} Create Dictionary File-Desc ${reqHeader}
|
||||||
|
${content} UpFilePutRequest ${url} ${requestData} ${fileDict} ${fileDesc}
|
||||||
|
${msg} Set Variable ${content['msg']}
|
||||||
|
Log update operation:${msg}
|
||||||
|
Log update condition:${reqHeader}
|
||||||
|
|
||||||
|
UpdatePolicyFile
|
||||||
|
[Arguments] ${url} ${filePath} ${fileName} ${reqHeader}
|
||||||
|
${binFile} Evaluate open(r"${path}/${filePath}${fileName}",'rb')
|
||||||
|
${fileDict} Create Dictionary file=${binFile}
|
||||||
|
${requestData} Create Dictionary name="file" filename="${fileName}" Content-Type=application/octet-stream
|
||||||
|
${fileDesc} Create Dictionary File-Desc=${reqHeader}
|
||||||
|
${content} UpFilePutRequest ${url} ${requestData} ${fileDict} ${fileDesc}
|
||||||
|
${msg} Set Variable ${content['msg']}
|
||||||
|
Log update operation:${msg}
|
||||||
|
Log update condition:${reqHeader}
|
||||||
|
|
||||||
|
UpdatePolicyFile2
|
||||||
|
[Arguments] ${url} ${data}
|
||||||
|
${header} Create Dictionary Content-Type=application/json Authorization=${token}
|
||||||
|
Create Session api http://${host}:${port}/${version} headers=${header}
|
||||||
|
${remoteResponse} Put Request api ${url} data=${data} headers=${header}
|
||||||
|
${response} to json ${remoteResponse.content}
|
||||||
|
Should Be Equal As Strings ${remoteResponse.status_code} 200
|
||||||
|
${msg} Set Variable ${response['msg']}
|
||||||
|
Log update operation:${msg}
|
||||||
|
Log update condition:${data}
|
||||||
|
|
||||||
|
DeletePolicyFile
|
||||||
|
[Arguments] ${url} ${data}
|
||||||
|
${content} Delete-Request ${url} ${data}
|
||||||
|
${msg} Set Variable ${content['msg']}
|
||||||
|
Log delete operation:${msg}
|
||||||
|
Log delete condition:${data}
|
||||||
|
|
||||||
|
TeardownDelete
|
||||||
|
[Arguments] ${url} ${key} ${value}
|
||||||
|
${ids} Create List ${value}
|
||||||
|
${data} Create Dictionary ${key}=${ids}
|
||||||
|
${content} Delete-Request ${url} ${data}
|
||||||
|
${msg} Set Variable ${content['msg']}
|
||||||
|
Log teardown operation:${msg}
|
||||||
|
Log teardown condition:${data}
|
||||||
|
|
||||||
281
02-Keyword/tsg_cli/Interface.robot
Normal file
281
02-Keyword/tsg_cli/Interface.robot
Normal file
@@ -0,0 +1,281 @@
|
|||||||
|
*** Settings ***
|
||||||
|
Library json
|
||||||
|
Library String
|
||||||
|
Library DateTime
|
||||||
|
Library SSHLibrary
|
||||||
|
Library Collections
|
||||||
|
Library RequestsLibrary
|
||||||
|
Library Selenium2Library
|
||||||
|
Resource ../../03-Variable/bifangapivariable.txt
|
||||||
|
|
||||||
|
*** Variables ***
|
||||||
|
${Tsg_Policy} tsg_policy
|
||||||
|
${Tsg_Policy_Object} tsg_policy_object
|
||||||
|
${Tsg_Record} tsg_record
|
||||||
|
${Tsg_Show} tsg_show
|
||||||
|
${Tsg_Passwd} tsg_passwd
|
||||||
|
${Tsg_Help_file_Path} cli_files/tsg_help.txt
|
||||||
|
|
||||||
|
*** Keywords ***
|
||||||
|
Get_Policy_Object1
|
||||||
|
[Arguments] ${type}
|
||||||
|
${dict} Tsg_Policy_Query ${type} ${None} ${None} ${None} ${True}
|
||||||
|
Should Be True ${dict}[data][total] > 1
|
||||||
|
[Return] ${dict}[data][list][1]
|
||||||
|
|
||||||
|
Get_Policy_Object2
|
||||||
|
[Arguments] ${type}
|
||||||
|
${dict} Tsg_Policy_Query ${type} ${None} ${None} ${None} ${True}
|
||||||
|
[Return] ${dict}[data][list][0]
|
||||||
|
|
||||||
|
Get_Policy_Object3
|
||||||
|
[Arguments] ${type}
|
||||||
|
${obj} Get_Policy_Object1 ${type}
|
||||||
|
${commandType1} Run Keyword If ${obj}[isValid]==0 Set Variable enable
|
||||||
|
... ELSE Set Variable disable
|
||||||
|
${commandType2} Run Keyword If ${obj}[isValid]==1 Set Variable enable
|
||||||
|
... ELSE Set Variable disable
|
||||||
|
Set To Dictionary ${obj} commandType1=${commandType1} commandType2=${commandType2}
|
||||||
|
[Return] ${obj}
|
||||||
|
|
||||||
|
Get_Policy_Object4
|
||||||
|
[Arguments] ${type}
|
||||||
|
${dict} Tsg_Policy_Object_Query ${type} ${None} ${True}
|
||||||
|
[Return] ${dict}[data][list][0]
|
||||||
|
|
||||||
|
Get_File_Name
|
||||||
|
[Arguments] ${ObjectType} ${FileType}
|
||||||
|
${date} Get Current Date
|
||||||
|
${date_stamp} Convert Date ${date} epoch
|
||||||
|
${time} Evaluate int(round(${date_stamp} * 1000))
|
||||||
|
${filename} Set Variable ${ObjectType}_export_${time}.${FileType}
|
||||||
|
[Return] ${filename}
|
||||||
|
|
||||||
|
Get_Import_Info
|
||||||
|
[Arguments] ${type}
|
||||||
|
${date} Get Current Date
|
||||||
|
${date_stamp} Convert Date ${date} epoch
|
||||||
|
${time} Evaluate int(round(${date_stamp} * 1000))
|
||||||
|
${name} Set Variable ${type}_import_${time}
|
||||||
|
[Return] ${name}
|
||||||
|
|
||||||
|
Tsg_Policy_Query
|
||||||
|
# ${type}:必传 @{param}:非必传,最大参数数量为四位。依次顺序为'policyId'、'policyName'、'policyDesc'和'allFlag',中间存在为空参数可用'${None}'占位
|
||||||
|
[Arguments] ${type} @{params}
|
||||||
|
${str} Evaluate '${Tsg_Policy} --query --policyType %s ' % ('${type}')
|
||||||
|
${str} Run Keyword If '${params}[0]' != '${None}' Evaluate '${str}--policyId %s ' % ('${params}[0]')
|
||||||
|
... ELSE Set Variable ${str}
|
||||||
|
${str} Run Keyword If '${params}[1]' != '${None}' Evaluate '${str}--policyName "%s" ' % ('${params}[1]')
|
||||||
|
... ELSE Set Variable ${str}
|
||||||
|
${str} Run Keyword If '${params}[2]' != '${None}' Evaluate '${str}--policyDesc "%s" ' % ('${params}[2]')
|
||||||
|
... ELSE Set Variable ${str}
|
||||||
|
${str} Run Keyword If ${params}[3] == ${True} Evaluate '${str}--all '
|
||||||
|
... ELSE Set Variable ${str}
|
||||||
|
Log ${str}
|
||||||
|
${r} Run1 ${str}
|
||||||
|
[Return] ${r}
|
||||||
|
|
||||||
|
Tsg_Policy_EnDisable
|
||||||
|
# ${id}:必传 ${type}:必传 ${commandType}:必传'enable'|'disable'
|
||||||
|
[Arguments] ${id} ${type} ${commandType}
|
||||||
|
${str} Evaluate '${Tsg_Policy} --%s --policyId %s --policyType %s' % ('${commandType}', '${id}', '${type}')
|
||||||
|
Run2 ${str}
|
||||||
|
|
||||||
|
Tsg_Policy_Object_Query
|
||||||
|
# @{param}:非必传,最大参数数量为三位。依次顺序为'objectName'、'objectType'和'allFlag',中间存在为空参数可用'${None}'占位
|
||||||
|
[Arguments] @{params}
|
||||||
|
${str} Set Variable ${Tsg_Policy_Object} --query
|
||||||
|
${str} Run Keyword If '${params}[0]' != '${None}' Evaluate '${str} --objectType "%s" ' % ('${params}[0]')
|
||||||
|
... ELSE Set Variable ${str}
|
||||||
|
${str} Run Keyword If '${params}[1]' != '${None}' Evaluate '${str} --objectName "%s" ' % ('${params}[1]')
|
||||||
|
... ELSE Set Variable ${str}
|
||||||
|
${str} Run Keyword If ${params}[2] == ${True} Evaluate '${str} --all '
|
||||||
|
... ELSE Set Variable ${str}
|
||||||
|
${r} Run1 ${str}
|
||||||
|
[Return] ${r}
|
||||||
|
|
||||||
|
Tsg_Policy_Object_Import
|
||||||
|
# ${type}:必传 ${file}:必传 @{params}:非必传,含义'objectName'
|
||||||
|
[Arguments] ${type} ${file} @{params}
|
||||||
|
${newFile} Replace String ${file} export import
|
||||||
|
${command} Set Variable head -n 2 files/${file} > files/${newFile}
|
||||||
|
Run4 ${command}
|
||||||
|
${str} Evaluate '${Tsg_Policy_Object} --import --objectType %s --file files/%s ' % ('${type}','${newFile}')
|
||||||
|
${str} Run Keyword If '${params}[0]' != '${None}' Evaluate '${str}--objectName %s ' % ('${params}[0]')
|
||||||
|
... ELSE Set Variable ${str}
|
||||||
|
Run3 ${str}
|
||||||
|
|
||||||
|
Tsg_Policy_Object_Export
|
||||||
|
# ${type}:必传 ${file}:必传 @{params}:非必传,含义'exportFormat'(txt|csv)
|
||||||
|
[Arguments] ${type} ${file} @{params}
|
||||||
|
${str} Evaluate '${Tsg_Policy_Object} --export --objectType %s --file files/%s ' % ('${type}','${file}')
|
||||||
|
${str} Run Keyword If '${params}[0]' != '${None}' Evaluate '${str}--exportFormat %s ' % ('${params}[0]')
|
||||||
|
... ELSE Set Variable ${str}
|
||||||
|
Run3 ${str}
|
||||||
|
|
||||||
|
Tsg_Record_UserList
|
||||||
|
${str} Set Variable ${Tsg_Record} --userlist
|
||||||
|
Run6 ${str} ${cliUsername}
|
||||||
|
|
||||||
|
Tsg_Record_Query
|
||||||
|
${str} Evaluate '${Tsg_Record} --username %s ' % ('${cliUsername}')
|
||||||
|
${param} Set Variable ${Tsg_Record} --userlist
|
||||||
|
Run6 ${str} ${param}
|
||||||
|
|
||||||
|
Clear_Test_Data
|
||||||
|
${str} Set Variable rm -rf /home/${cliUsername}/files/*
|
||||||
|
Run4 ${str}
|
||||||
|
|
||||||
|
Tsg_Help_Keyword
|
||||||
|
${r} Run5 tsg_help
|
||||||
|
${data} Evaluate open(r"${path}/${Tsg_Help_file_Path}",'rb').read()
|
||||||
|
Should Be Equal As Strings ${r} ${data}
|
||||||
|
|
||||||
|
Tsg_Diagnose_Keyword
|
||||||
|
Write Until Expected Output tsg_diagnose\n Success ${timeout} ${timeout}
|
||||||
|
|
||||||
|
Tsg_Show_Chassis-ip
|
||||||
|
${str} Set Variable ${Tsg_Show} --chassis-ip
|
||||||
|
${r} Run5 ${str}
|
||||||
|
Should Contain ${r} Name
|
||||||
|
Should Contain ${r} IP
|
||||||
|
|
||||||
|
Tsg_Show_Chassis-port
|
||||||
|
${str} Set Variable ${Tsg_Show} --chassis-port
|
||||||
|
${r} Run5 ${str}
|
||||||
|
Should Contain ${r} PortId
|
||||||
|
Should Contain ${r} Type
|
||||||
|
Should Contain ${r} Function
|
||||||
|
Should Contain ${r} Description
|
||||||
|
|
||||||
|
Tsg_Show_Interface
|
||||||
|
${str} Set Variable ${Tsg_Show} --interface
|
||||||
|
${r} Run5 ${str}
|
||||||
|
Should Contain ${r} time
|
||||||
|
Should Contain ${r} PhyRXBits
|
||||||
|
Should Contain ${r} PhyRXFrame
|
||||||
|
Should Contain ${r} PhyTXBits
|
||||||
|
Should Contain ${r} PhyTXFrame
|
||||||
|
Should Contain ${r} flow_type
|
||||||
|
Should Contain ${r} sled
|
||||||
|
|
||||||
|
Tsg_Show_APP
|
||||||
|
${str} Set Variable ${Tsg_Show} --app
|
||||||
|
${r} Run5 ${str}
|
||||||
|
Should Contain ${r} time
|
||||||
|
Should Contain ${r} RxBits
|
||||||
|
Should Contain ${r} RxPkts
|
||||||
|
Should Contain ${r} TxBits
|
||||||
|
Should Contain ${r} TxPkts
|
||||||
|
Should Contain ${r} device
|
||||||
|
Should Contain ${r} flow_type
|
||||||
|
Should Contain ${r} sled
|
||||||
|
|
||||||
|
Tsg_Show_Protocol
|
||||||
|
${str} Set Variable ${Tsg_Show} --protocol
|
||||||
|
${r} Run5 ${str}
|
||||||
|
Should Contain ${r} time
|
||||||
|
Should Contain ${r} Eth_Bit
|
||||||
|
Should Contain ${r} Ipv4_Bit
|
||||||
|
Should Contain ${r} Ipv6_Bit
|
||||||
|
Should Contain ${r} Tcp_Bit
|
||||||
|
Should Contain ${r} Udp_Bit
|
||||||
|
Should Contain ${r} device
|
||||||
|
Should Contain ${r} flow_type
|
||||||
|
Should Contain ${r} sled
|
||||||
|
|
||||||
|
Tsg_Show_Stream
|
||||||
|
${str} Set Variable ${Tsg_Show} --stream
|
||||||
|
${r} Run5 ${str}
|
||||||
|
Should Contain ${r} time
|
||||||
|
Should Contain ${r} Tcp_Link_New
|
||||||
|
Should Contain ${r} Tcp_Concurrent
|
||||||
|
Should Contain ${r} Tcp_Link_Double
|
||||||
|
Should Contain ${r} device
|
||||||
|
Should Contain ${r} flow_type
|
||||||
|
Should Contain ${r} sled
|
||||||
|
|
||||||
|
Tsg_Show_Intercept
|
||||||
|
${str} Set Variable ${Tsg_Show} --intercept
|
||||||
|
${r} Run5 ${str}
|
||||||
|
Should Contain ${r} time
|
||||||
|
Should Contain ${r} intcp_rdy_bits
|
||||||
|
Should Contain ${r} intcp_rdy_stm
|
||||||
|
Should Contain ${r} intcped_bits
|
||||||
|
Should Contain ${r} intcped_stm
|
||||||
|
Should Contain ${r} sled
|
||||||
|
|
||||||
|
Tsg_Passwd_Keyword
|
||||||
|
${str1} Evaluate '${Tsg_Passwd} --password %s' % ('${cliPassword}x')
|
||||||
|
Run7 ${str1}
|
||||||
|
${str2} Evaluate '${Tsg_Passwd} --password %s --username %s' % ('${cliPassword}y','${cliUsername}')
|
||||||
|
Run7 ${str2}
|
||||||
|
${str3} Evaluate '${Tsg_Passwd} --password %s' % ('${cliPassword}')
|
||||||
|
Run7 ${str3}
|
||||||
|
|
||||||
|
Run1
|
||||||
|
[Arguments] ${command}
|
||||||
|
Write ${command}
|
||||||
|
${r} Read delay=10s
|
||||||
|
${dict} Run Keyword If '${cliUsername}'!='tsgadmin' Run1_A ${r}
|
||||||
|
... ELSE Run1_B ${r}
|
||||||
|
[Return] ${dict}
|
||||||
|
|
||||||
|
Run1_A
|
||||||
|
[Arguments] ${r}
|
||||||
|
Should Contain ${r} Permission denied
|
||||||
|
${dict} To Json {"data":{"list":[{"policyDesc":"","policyId":0,"policyName":"","policyType":"","objectType":"","objectName":"","isValid":0},{"policyDesc":"","policyId":0,"policyName":"","policyType":"","isValid":0}],"total":2},"msg":"Success"}
|
||||||
|
[Return] ${dict}
|
||||||
|
|
||||||
|
Run1_B
|
||||||
|
[Arguments] ${r}
|
||||||
|
Should Contain ${r} Success
|
||||||
|
${str} Replace String ${r} ${\n} -
|
||||||
|
${str} Replace String ${str} ' \\'
|
||||||
|
${index} Evaluate '${str}'.rindex('}') + 1
|
||||||
|
${len} Convert To Integer ${index}
|
||||||
|
${json} Evaluate '${str}'[0:${len}]
|
||||||
|
${dict} json.Loads ${json}
|
||||||
|
Should Be True ${dict}[data][total] > 0
|
||||||
|
[Return] ${dict}
|
||||||
|
|
||||||
|
Run2
|
||||||
|
[Arguments] ${command}
|
||||||
|
Write ${command}
|
||||||
|
${r} Read delay=10s
|
||||||
|
Run Keyword If '${cliUsername}'!='tsgadmin' Should Contain ${r} Permission denied
|
||||||
|
... ELSE Should Contain ${r} Success
|
||||||
|
|
||||||
|
Run3
|
||||||
|
[Arguments] ${command}
|
||||||
|
${flag} Run Keyword If '${cliUsername}'!='tsgadmin' Set Variable Permission denied
|
||||||
|
... ELSE Set Variable Success
|
||||||
|
Write Until Expected Output ${command}\n ${flag} ${timeout} ${timeout}
|
||||||
|
|
||||||
|
Run4
|
||||||
|
[Arguments] ${command}
|
||||||
|
Write ${command}
|
||||||
|
${r} Read delay=10s
|
||||||
|
Run Keyword If '${cliUsername}'!='tsgadmin' Should Contain Any ${r} Permission denied -bash:
|
||||||
|
... ELSE Should Not Contain ${r} head:
|
||||||
|
|
||||||
|
Run5
|
||||||
|
[Arguments] ${command}
|
||||||
|
Write ${command}
|
||||||
|
${r} Read delay=10s
|
||||||
|
Should Not Be Empty ${r}
|
||||||
|
[Return] ${r}
|
||||||
|
|
||||||
|
Run6
|
||||||
|
[Arguments] ${command} ${param}
|
||||||
|
Write ${command}
|
||||||
|
${r} Read delay=10s
|
||||||
|
Should Not Be Empty ${r}
|
||||||
|
Run Keyword If '${cliUsername}'!='tsgadmin' Should Contain ${r} Permission denied
|
||||||
|
... ELSE Should Contain ${r} ${param}
|
||||||
|
|
||||||
|
Run7
|
||||||
|
[Arguments] ${command}
|
||||||
|
Write ${command}
|
||||||
|
${r} Read delay=10s
|
||||||
|
Should Contain ${r} Success
|
||||||
18
02-Keyword/tsg_common/LoginAndLogoutTypeSwitch.robot
Normal file
18
02-Keyword/tsg_common/LoginAndLogoutTypeSwitch.robot
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
*** Settings ***
|
||||||
|
Resource ../../03-Variable/BifangApiVariable.txt
|
||||||
|
Library REST http://${host}:${port}
|
||||||
|
Library Collections
|
||||||
|
Resource ../tsg_bfapi/LoginLogout.robot
|
||||||
|
Resource ../tsg_ui/Logout/Logout.robot
|
||||||
|
Resource ../tsg_ui/Login/Login.robot
|
||||||
|
|
||||||
|
*** Keywords ***
|
||||||
|
LoginAndAddLocalIP
|
||||||
|
Run Keyword If '${loginType}' == 'api' ApiLoginAndAddLocalIP aa
|
||||||
|
... ELSE IF '${loginType}' == 'cli' CliLogin
|
||||||
|
... ELSE UiLoginAndAaddLocalIP bb
|
||||||
|
|
||||||
|
LogoutAndDelLocalIP
|
||||||
|
Run Keyword If '${loginType}' == 'api' ApiLogoutAndDelLocalIP aa
|
||||||
|
... ELSE IF '${loginType}' == 'cli' CliLogout
|
||||||
|
... ELSE UiLogoutAndDelLocalIP bb
|
||||||
43
02-Keyword/tsg_common/StmpHandle.robot
Normal file
43
02-Keyword/tsg_common/StmpHandle.robot
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
*** Settings ***
|
||||||
|
Library Smtp3Library
|
||||||
|
|
||||||
|
*** Keywords ***
|
||||||
|
EmailLogin
|
||||||
|
[Arguments] ${SURL} ${SPORT} ${SUSER} ${SPWD}
|
||||||
|
[Documentation] [${SURL}:邮箱发送服务器,比如:腾讯企业邮箱:smtp.exmail.qq.com;qq邮箱:smtp.qq.com;163邮箱:smtp.163.com等]
|
||||||
|
... [${SPORT}:邮箱发送服务器的端口,无论是哪种邮箱的,一般是25,该值可灵活填充]
|
||||||
|
... [${SUSER}:邮箱登入用户名,无需转码]
|
||||||
|
... [${SPWD}:登入密码。对于腾讯企业邮箱,密码无变化;qq邮箱需要第三方授权码登入;163邮箱需要第三方授权码登入]
|
||||||
|
... [关键字返回值:这是163邮箱的返回结果:不同邮箱可能不太一样(235, b'Authentication successful')]
|
||||||
|
[Tags] function email send
|
||||||
|
Prepare Connection ${SURL} ${SPORT} ${SUSER} ${SPWD}
|
||||||
|
Connect
|
||||||
|
Ehlo
|
||||||
|
${result} logins
|
||||||
|
run keyword if "${result}"=="fail" log ${result}
|
||||||
|
... ELSE Quit Close Connection
|
||||||
|
#Quit
|
||||||
|
#Close Connection
|
||||||
|
[Return] ${result} # 返回登入结果
|
||||||
|
|
||||||
|
EmailSendFull
|
||||||
|
[Arguments] ${SURL} ${SPORT} ${SUSER} ${PWD} ${SUBJ} ${FROM} ${to} ${cc} ${bcc} ${Sbody} ${attach}
|
||||||
|
[Documentation] [注意:所有参数都是必填参数]
|
||||||
|
... [${SURL}:邮箱发送服务器,比如:smtp.qq.com]
|
||||||
|
... [${SPORT}:邮箱服务器,写法如:25]
|
||||||
|
... [${SUSER}:登入名,如:zhangsan@qq.com]
|
||||||
|
... [${PWD}:登入密码,不同类型的邮箱登入密码需求不一样,具体看EmailLogin关键字对于密码的要求]
|
||||||
|
... [${SUBJ}:主题,如:111111]
|
||||||
|
... [${FROM} :发送者,例如:zhangsan@qq.com]
|
||||||
|
... [ ${to} :接收者,可以写多个,写法例如:["lisi@qq.com","wangwu@163.com"] ,若写单个接收者["lisi@qq.com"] ]
|
||||||
|
... [${cc}:抄送者。可以写多个,写法同${to}]
|
||||||
|
... [${bcc}:密送者。可以写多个,写法同${to}]
|
||||||
|
... [${Sbody}:邮件正文,写法如:1234teacher]
|
||||||
|
... [${attach}:附件文本,可以写多个,注意本地是否有这些文件。写法如:["1.txt","E://abc.txt"]]
|
||||||
|
... [关键字返回值:发送成功会返回{},空的内容]
|
||||||
|
[Tags] function email send
|
||||||
|
Prepare Connection ${SURL} ${SPORT} ${SUSER} ${PWD}
|
||||||
|
${send_result} Send Message With All Parameters ${SURL} ${SUSER} ${PWD} ${SUBJ} ${FROM} ${to} ${cc} ${bcc} ${Sbody} ${attach}
|
||||||
|
Comment Send Message
|
||||||
|
Close Connection
|
||||||
|
[Return] ${send_result} # 返回发送邮件结果
|
||||||
BIN
02-Keyword/tsg_common/测试结果入库关键字参数描述及示例.docx
Normal file
BIN
02-Keyword/tsg_common/测试结果入库关键字参数描述及示例.docx
Normal file
Binary file not shown.
94
02-Keyword/tsg_ui/FTPHandle.robot
Normal file
94
02-Keyword/tsg_ui/FTPHandle.robot
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
*** Settings ***
|
||||||
|
Library FtpLibrary
|
||||||
|
|
||||||
|
*** Keywords ***
|
||||||
|
checkFTPRecvReport
|
||||||
|
[Arguments] ${fURL} ${fport} ${fuser} ${fpwd} ${fpath} ${filename}
|
||||||
|
[Documentation] [fURL写法例如:192.168.1.1]
|
||||||
|
... [fport写法例如:21]
|
||||||
|
... [fuser写法例如:wxs]
|
||||||
|
... [fpwd要写ftp服务器的密码,写法例如:111111]
|
||||||
|
... [fpath要写ftp服务器的绝对路径,写法例如:/a/b/20200110/]
|
||||||
|
... [filename,是指系统下发report时对report起的名字,在这里判断方法是ftp文件名称是否包含report名称,所以在TSG系统上下发report时应尽量不要用重名,以免判断失误,写法例如:长安街]
|
||||||
|
... [注意:该关键字无返回值,他是等同于一个用例,若字符串不包含则表示用例执行失败,会有相关信息打印]
|
||||||
|
[Tags] function FTP reportResult
|
||||||
|
Ftp Connect ${fURL} ${fuser} ${fpwd} ${fport}
|
||||||
|
sleep 1
|
||||||
|
cwd ${fpath}
|
||||||
|
sleep 1
|
||||||
|
@{dirname} Dir Names
|
||||||
|
sleep 1
|
||||||
|
${Strdirname} Evaluate ''.join(@{dirname})
|
||||||
|
Should Contain ${Strdirname} ${filename}
|
||||||
|
ftp close
|
||||||
|
|
||||||
|
FTPDownloadFile
|
||||||
|
[Arguments] ${fURL} ${fport} ${fuser} ${fpwd} ${SrcPath} ${SrcName} ${dstPathName}
|
||||||
|
[Documentation] [fUrl是FTP服务器地址,例如:192.168.1.1]
|
||||||
|
... [fport是ftp服务器的端口号,例如:21]
|
||||||
|
... [fuser是用户名,例如:wxs]
|
||||||
|
... [fpwd是密码,例如:wqqq]
|
||||||
|
... [SrcPath是ftp服务器上的要下载的文件的路径,文件包名称必须写,例如:/a/b/]
|
||||||
|
... [SrcName是ftp服务器上的要下载的文件名称,文件名称不要太复杂(不要包含符号),否则无法识别,例如:teacher王.txt]
|
||||||
|
... [dstPathName是下载到本地时的本地路径名(+名称),名称可不写,建议不写,下载到本地的名称就会与FTP上文件一样,写法:1. D:/rfftppy/tmp/ 2.D:/rfftppy/tmp/b.txt \]
|
||||||
|
[Tags] function FTP downloadFile
|
||||||
|
Ftp Connect ${fURL} ${fuser} ${fpwd} ${fport}
|
||||||
|
cwd ${SrcPath}
|
||||||
|
sleep 1
|
||||||
|
download file ${SrcName} ${dstPathName}
|
||||||
|
ftp close
|
||||||
|
|
||||||
|
FTPUploadFileToTest
|
||||||
|
[Arguments] ${fURL} ${fport} ${fuser} ${fpwd} ${SrcPathName}
|
||||||
|
[Documentation] [fURL写法例如:192.168.1.1]
|
||||||
|
... [fport写法例如:21]
|
||||||
|
... [fuser写法例如:wxs]
|
||||||
|
... [fpwd要写ftp服务器的密码,写法例如:111111]
|
||||||
|
... [SrcPathName,本地待上传的文件的路径名,例如:E:/qqq.txt]
|
||||||
|
... [注意:该关键字默认上传到ftp服务器的/test目录下,若test目录不存在会自己创建]
|
||||||
|
[Tags] function FTP uploadFileToTest
|
||||||
|
${intest} Set Variable test
|
||||||
|
Run Keyword If '${fport}'!='21' Run Keyword Log 请注意:FTP服务器端口号不是21(默认端口号),请继续登入
|
||||||
|
... AND Log 登入中...
|
||||||
|
Ftp Connect ${fURL} ${fuser} ${fpwd} ${fport}
|
||||||
|
@{dirnames} Dir Names
|
||||||
|
${result} checkListContainStirng ${intest} @{dirnames}
|
||||||
|
log ${SrcPathName}
|
||||||
|
Run Keyword If '${result}'=='${intest}' log /test目录存在
|
||||||
|
... ELSE Run Keyword log /test目录不存在,已创建并上传文件
|
||||||
|
... AND Mkd ${intest}
|
||||||
|
Cwd ${intest}
|
||||||
|
Comment @{aa} Dir Names
|
||||||
|
Upload File ${SrcPathName}
|
||||||
|
|
||||||
|
checkListContainStirng
|
||||||
|
[Arguments] ${str} @{strlist}
|
||||||
|
FOR ${value} IN @{strlist}
|
||||||
|
Log ${value}
|
||||||
|
Return From Keyword If '${value}'=='${str}' ${value}
|
||||||
|
END
|
||||||
|
Return From Keyword ${value}
|
||||||
|
|
||||||
|
FTPUploadFile
|
||||||
|
[Arguments] ${fURL} ${fport} ${fuser} ${fpwd} ${SrcPathName}
|
||||||
|
[Documentation] [fURL写法例如:192.168.1.1]
|
||||||
|
... [fport写法例如:21]
|
||||||
|
... [fuser写法例如:wxs]
|
||||||
|
... [fpwd要写ftp服务器的密码,写法例如:111111]
|
||||||
|
... [SrcPathName,本地待上传的文件的路径名,例如:E:/qqq.txt]
|
||||||
|
... [注意:该关键字默认上传到ftp服务器的root目录下]
|
||||||
|
[Tags] function FTP uploadFile
|
||||||
|
Run Keyword If '${fport}'!='21' Run Keyword Log 请注意:FTP服务器端口号不是21(默认端口号),请继续登入
|
||||||
|
... AND Log 登入中...
|
||||||
|
Ftp Connect ${fURL} ${fuser} ${fpwd} ${fport}
|
||||||
|
Upload File ${SrcPathName}
|
||||||
|
|
||||||
|
FTPLogin
|
||||||
|
[Arguments] ${fURL} ${fport} ${fuser} ${fpwd}
|
||||||
|
[Documentation] [fURL写法例如:192.168.1.1]
|
||||||
|
... [fport写法例如:21]
|
||||||
|
... [fuser写法例如:wxs]
|
||||||
|
... [fpwd要写ftp服务器的密码,写法例如:111111]
|
||||||
|
[Tags] function FTP login
|
||||||
|
Ftp Connect ${fURL} ${fuser} ${fpwd} ${fport}
|
||||||
|
Get Welcome
|
||||||
259
02-Keyword/tsg_ui/Log/Log.robot
Normal file
259
02-Keyword/tsg_ui/Log/Log.robot
Normal file
@@ -0,0 +1,259 @@
|
|||||||
|
*** Settings ***
|
||||||
|
Documentation 写用例的话,直接调用关键字,输入关键字参数的值。
|
||||||
|
... 例如:想查询时间为2020-02-24 00:00:00 到2020-02-25 00:00:00 \ 的policy id为2409的log
|
||||||
|
... 1、创建一个case,
|
||||||
|
... 2、输入关键字Security Event Logs
|
||||||
|
... 3、输入必填参数的值(根据关键字里的要求填入相对应的值)
|
||||||
|
... 必填参数:${time1} | ${time2} | ${type1} | ${value} | ${element1}
|
||||||
|
... ${time1}:为开始时间 \ ${time2}:为结束时间
|
||||||
|
... ${type1}:为要查询的类型
|
||||||
|
... ${value}:要查询的内容
|
||||||
|
... ${element1}:想要获取信息的定位元素
|
||||||
|
...
|
||||||
|
... 4、直接运行该case
|
||||||
|
Library Selenium2Library
|
||||||
|
Library ExcelLibrary
|
||||||
|
|
||||||
|
*** Keywords ***
|
||||||
|
click
|
||||||
|
[Arguments] ${element}
|
||||||
|
Click Element ${element}
|
||||||
|
|
||||||
|
input
|
||||||
|
[Arguments] ${element} ${text}
|
||||||
|
Input Text ${element} ${text}
|
||||||
|
|
||||||
|
ui-login
|
||||||
|
Open Browser http://192.168.40.120 Chrome
|
||||||
|
input xpath=//*[@id="app"]/div/div[2]/div/div[2]/div/input lyf
|
||||||
|
input xpath=//*[@id="app"]/div/div[2]/div/div[3]/div/input 111111
|
||||||
|
click xpath=//*[@id="app"]/div/div[2]/div/div[4]/button
|
||||||
|
|
||||||
|
ui-logout
|
||||||
|
Close Browser
|
||||||
|
|
||||||
|
Security Event Logs
|
||||||
|
[Arguments] ${time1} ${time2} ${type1} ${value} ${element1}
|
||||||
|
#打开浏览器
|
||||||
|
#TSG-登录 lyf 111111
|
||||||
|
Sleep 1
|
||||||
|
click id=children2 #点击一级目录log
|
||||||
|
Sleep 1
|
||||||
|
click id=sidebarLog_SecurityEventLogs #点击二级目录Security Event Logs
|
||||||
|
sleep 1
|
||||||
|
${result} ${text1} Run Keyword And Ignore Error text #获取弹出框文本,进行异常处理
|
||||||
|
run keyword if '${result}'=='Pass' run keywords click xpath=/html/body/div/div/div[3]/button
|
||||||
|
sleep 1
|
||||||
|
Clear Element Text xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div/input[1] #清空输入框
|
||||||
|
sleep 1
|
||||||
|
input xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div/input[1] ${time1} #在输入框里输入时间 \ 格式为2020-02-24 18:21:01
|
||||||
|
sleep 1
|
||||||
|
Clear Element Text xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div/input[2] #清空输入框
|
||||||
|
sleep 1
|
||||||
|
input xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div/input[2] ${time2} #在输入框里输入时间 \ 格式为2020-02-24 18:21:01
|
||||||
|
sleep 1
|
||||||
|
click xpath=/html/body/div/div[2]/button[2]
|
||||||
|
sleep 1
|
||||||
|
click id=one-input
|
||||||
|
sleep 1
|
||||||
|
click ${type1} #选择要查询的类型
|
||||||
|
sleep 1
|
||||||
|
input id=sreach_input ${value} #在输入框输入查询数据
|
||||||
|
sleep 1
|
||||||
|
click xpath=//*[@id="app"]/div/div[3]/div/div/div[1]/div/div[2] #点击搜索按钮
|
||||||
|
sleep 2
|
||||||
|
${result1} ${text2} Run Keyword And Ignore Error text #获取弹出框文本,进行异常处理
|
||||||
|
run keyword if '${result}'=='Pass' run keywords click xpath=/html/body/div/div/div[3]/button
|
||||||
|
sleep 1
|
||||||
|
${text3} Get text xpath=//*[@id="app"]/div/div[3]/div/div/div[7]/div/ul/li[1]/span
|
||||||
|
# Evaluate ${text3}.replace('','Total: ')
|
||||||
|
${t} Convert To Integer ${text3}
|
||||||
|
${a1} Evaluate ${t}%20 #求余
|
||||||
|
${t1}= Evaluate math.ceil(${t}/20) math #求整(如果有余数会得出整数加1)
|
||||||
|
${t2} Evaluate ${t1}+1
|
||||||
|
: FOR ${j} IN RANGE 1 ${t2}
|
||||||
|
\ ForSElog ${element1} ${j} ${t1} ${a1}
|
||||||
|
\ click xpath=//*[@id="zhumingmingPageRight"]/i
|
||||||
|
#关闭浏览器
|
||||||
|
|
||||||
|
text
|
||||||
|
sleep 2
|
||||||
|
${text1} Get Text xpath=/html/body/div/div/div[3]/button/span
|
||||||
|
|
||||||
|
ForSElog
|
||||||
|
[Arguments] ${element} ${j} ${t1} ${a1}
|
||||||
|
: FOR ${i} IN RANGE 1 21
|
||||||
|
\ log ${i}
|
||||||
|
\ click xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr[${i}]/td[3]
|
||||||
|
\ sleep 2
|
||||||
|
\ ${text4} Get text ${element}
|
||||||
|
\ log ${text4}
|
||||||
|
\ click id=securityEvent_logIdClose
|
||||||
|
\ run keyword if '${j}'=='${t1}' log yes
|
||||||
|
\ IF1 ${i} ${a1}
|
||||||
|
|
||||||
|
IF1
|
||||||
|
[Arguments] ${i} ${a2}
|
||||||
|
run keyword if '${i}'=='${a2}' Exit For Loop
|
||||||
|
|
||||||
|
Proxy Event Logs
|
||||||
|
[Arguments] ${time1} ${time2} ${type1} ${value} ${element1}
|
||||||
|
#打开浏览器
|
||||||
|
#TSG-登录 lyf 111111
|
||||||
|
Sleep 1
|
||||||
|
click id=children2 #点击一级目录log
|
||||||
|
Sleep 1
|
||||||
|
click id=sidebarLog_ProxyEventLogs #点击二级目录ProxyEventLogs
|
||||||
|
sleep 1
|
||||||
|
${result} ${text1} Run Keyword And Ignore Error text1 #获取弹出框文本,进行异常处理
|
||||||
|
run keyword if '${result}'=='Pass' run keywords click xpath=/html/body/div/div/div[3]/button
|
||||||
|
#click xpath=/html/body/div/div/div[3]/button
|
||||||
|
Clear Element Text id=d #清空输入框
|
||||||
|
sleep 1
|
||||||
|
input id=d ${time1} #在输入框里输入时间 \ 格式为2020-02-24 18:21:01
|
||||||
|
sleep 1
|
||||||
|
Clear Element Text id=a #清空输入框
|
||||||
|
sleep 1
|
||||||
|
input id=a ${time2} #在输入框里输入时间 \ 格式为2020-02-24 18:21:01
|
||||||
|
sleep 1
|
||||||
|
click xpath=/html/body/div/div[2]/button[2] #点击时间组件的ok按钮
|
||||||
|
sleep 1
|
||||||
|
click id=one-input #点击查询输入框
|
||||||
|
sleep 1
|
||||||
|
click ${type1} #选择要查询的类型
|
||||||
|
sleep 1
|
||||||
|
input id=sreach_input ${value} #在输入框输入查询数据
|
||||||
|
sleep 1
|
||||||
|
click xpath=//*[@id="app"]/div/div[3]/div/div/div[1]/div/div[2] #点击搜索按钮
|
||||||
|
sleep 2
|
||||||
|
${result1} ${text2} Run Keyword And Ignore Error text1 #获取弹出框文本,进行异常处理
|
||||||
|
run keyword if '${result}'=='Pass' run keywords click xpath=/html/body/div/div/div[3]/button
|
||||||
|
sleep 1
|
||||||
|
${text3} Get text xpath=//*[@id="app"]/div/div[3]/div/div/div[7]/div/ul/li[1]/span #获取列表数量
|
||||||
|
# Evaluate ${text3}.replace('','Total: ')
|
||||||
|
${t} Convert To Integer ${text3} #text转换为int
|
||||||
|
${a1} Evaluate ${t}%20 #求余
|
||||||
|
${t1}= Evaluate math.ceil(${t}/20) math #求整(如果有余数会得出整数加1)
|
||||||
|
${t2} Evaluate ${t1}+1
|
||||||
|
: FOR ${j} IN RANGE 1 ${t2}
|
||||||
|
ForPElog ${element1} ${j} ${t1} ${a1}
|
||||||
|
click xpath=//*[@id="zhumingmingPageRight"]/i #点击翻页
|
||||||
|
#关闭浏览器
|
||||||
|
|
||||||
|
text1
|
||||||
|
sleep 2
|
||||||
|
${text1} Get Text xpath=/html/body/div[3]/div/div[3]/button/span
|
||||||
|
|
||||||
|
SE logs-Export
|
||||||
|
[Arguments] ${time1} ${time2} ${type1} ${value} ${file}
|
||||||
|
#打开浏览器
|
||||||
|
#TSG-登录 lyf 111111
|
||||||
|
Sleep 1
|
||||||
|
click id=children2 #点击一级目录log
|
||||||
|
Sleep 1
|
||||||
|
click id=sidebarLog_SecurityEventLogs #点击二级目录Security Event Logs
|
||||||
|
sleep 1
|
||||||
|
${result} ${text1} Run Keyword And Ignore Error text #获取弹出框文本,进行异常处理
|
||||||
|
run keyword if '${result}'=='Pass' run keywords click xpath=/html/body/div/div/div[3]/button
|
||||||
|
#click xpath=/html/body/div[2]/div/div[3]/button
|
||||||
|
Clear Element Text xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div/input[1] #清空输入框
|
||||||
|
sleep 1
|
||||||
|
input xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div/input[1] ${time1} #在输入框里输入时间 \ 格式为2020-02-24 18:21:01
|
||||||
|
sleep 1
|
||||||
|
Clear Element Text xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div/input[2] #清空输入框
|
||||||
|
sleep 1
|
||||||
|
input xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div/input[2] ${time2} #在输入框里输入时间 \ 格式为2020-02-24 18:21:01
|
||||||
|
sleep 1
|
||||||
|
click xpath=/html/body/div/div[2]/button[2]
|
||||||
|
sleep 1
|
||||||
|
click id=one-input
|
||||||
|
sleep 1
|
||||||
|
click ${type1} #选择要查询的类型
|
||||||
|
sleep 1
|
||||||
|
input id=sreach_input ${value} #在输入框输入查询数据
|
||||||
|
sleep 1
|
||||||
|
click xpath=//*[@id="app"]/div/div[3]/div/div/div[1]/div/div[2] #点击搜索按钮
|
||||||
|
sleep 2
|
||||||
|
${result1} ${text2} Run Keyword And Ignore Error text #获取弹出框文本,进行异常处理
|
||||||
|
run keyword if '${result}'=='Pass' ui-logout else log 有数据
|
||||||
|
sleep 1
|
||||||
|
${text3} Get text xpath=//*[@id="app"]/div/div[3]/div/div/div[7]/div/ul/li[1]/span
|
||||||
|
${t} Convert To Integer ${text3}
|
||||||
|
click xpath=//*[@id="log_securityEventExport"]/i
|
||||||
|
sleep 20
|
||||||
|
Open Excel ${file} #打开Excel表
|
||||||
|
sleep 2
|
||||||
|
${row} Get Row Count Sheet1 #获取Excel表的行数
|
||||||
|
Should Be Equal As Numbers ${row} ${t} #断言 \ 获取到的log列表数量和获取到的Excel表的行数对比
|
||||||
|
|
||||||
|
PE Logs-Export
|
||||||
|
|
||||||
|
Session Records
|
||||||
|
[Arguments] ${time1} ${time2} ${type1} ${value} ${element1}
|
||||||
|
#打开浏览器
|
||||||
|
#TSG-登录 lyf 111111
|
||||||
|
Sleep 1
|
||||||
|
click id=children2 #点击一级目录log
|
||||||
|
Sleep 1
|
||||||
|
click id=sidebarLog_SesssionRecords #点击二级目录Session Records
|
||||||
|
sleep 1
|
||||||
|
${result} ${text1} Run Keyword And Ignore Error text #获取弹出框文本,进行异常处理
|
||||||
|
run keyword if '${result}'=='Pass' run keywords click xpath=/html/body/div/div/div[3]/button
|
||||||
|
# xpath=/html/body/div[2]/div/div[3]/button
|
||||||
|
Clear Element Text xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div/input[1] #清空输入框
|
||||||
|
sleep 1
|
||||||
|
input xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div/input[1] ${time1} #在输入框里输入时间 \ 格式为2020-02-24 18:21:01
|
||||||
|
sleep 1
|
||||||
|
Clear Element Text xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div/input[2] #清空输入框
|
||||||
|
sleep 1
|
||||||
|
input xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div/input[2] ${time2} #在输入框里输入时间 \ 格式为2020-02-24 18:21:01
|
||||||
|
sleep 1
|
||||||
|
click xpath=/html/body/div/div[2]/button[2]
|
||||||
|
sleep 1
|
||||||
|
${result} ${text1} Run Keyword And Ignore Error text #获取弹出框文本,进行异常处理
|
||||||
|
run keyword if '${result}'=='Pass' run keywords click xpath=/html/body/div/div/div[3]/button
|
||||||
|
click id=one-input
|
||||||
|
sleep 1
|
||||||
|
click ${type1} #选择要查询的类型
|
||||||
|
sleep 1
|
||||||
|
input id=sreach_input ${value} #在输入框输入查询数据
|
||||||
|
sleep 1
|
||||||
|
click xpath=//*[@id="app"]/div/div[3]/div/div/div[1]/div/div[2] #点击搜索按钮
|
||||||
|
sleep 2
|
||||||
|
${result1} ${text2} Run Keyword And Ignore Error text #获取弹出框文本,进行异常处理
|
||||||
|
run keyword if '${result}'=='Pass' run keywords click xpath=/html/body/div/div/div[3]/button
|
||||||
|
sleep 1
|
||||||
|
${text3} Get text xpath=//*[@id="app"]/div/div[3]/div/div/div[6]/div/ul/li[1]/span
|
||||||
|
# Evaluate ${text3}.replace('','Total: ')
|
||||||
|
${t} Convert To Integer ${text3}
|
||||||
|
${a1} Evaluate ${t}%20 #求余
|
||||||
|
${t1}= Evaluate math.ceil(${t}/20) math #求整(如果有余数会得出整数加1)
|
||||||
|
${t2} Evaluate ${t1}+1
|
||||||
|
: FOR ${j} IN RANGE 1 ${t2}
|
||||||
|
ForSR ${element1} ${j} ${t1} ${a1}
|
||||||
|
click xpath=//*[@id="zhumingmingPageRight"]/i
|
||||||
|
#关闭浏览器
|
||||||
|
|
||||||
|
ForPElog
|
||||||
|
[Arguments] ${element} ${j} ${t1} ${a1}
|
||||||
|
: FOR ${i} IN RANGE 1 21
|
||||||
|
\ log ${i}
|
||||||
|
\ click xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr[${i}]/td[3]
|
||||||
|
\ sleep 2
|
||||||
|
\ ${text4} Get text ${element}
|
||||||
|
\ log ${text4}
|
||||||
|
\ click id=proxyEvent_logIdClose
|
||||||
|
\ run keyword if '${j}'=='${t1}' log yes
|
||||||
|
\ IF1 ${i} ${a1}
|
||||||
|
|
||||||
|
ForSR
|
||||||
|
[Arguments] ${element} ${j} ${t1} ${a1}
|
||||||
|
: FOR ${i} IN RANGE 1 21
|
||||||
|
\ log ${i}
|
||||||
|
\ click xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr[${i}]/td[3]
|
||||||
|
\ sleep 2
|
||||||
|
\ ${text4} Get text ${element}
|
||||||
|
\ log ${text4}
|
||||||
|
\ click id=sessionRecords_logIdClose
|
||||||
|
\ run keyword if '${j}'=='${t1}' log yes
|
||||||
|
\ IF1 ${i} ${a1}
|
||||||
26
02-Keyword/tsg_ui/Login/Login.robot
Normal file
26
02-Keyword/tsg_ui/Login/Login.robot
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
*** Settings ***
|
||||||
|
Library Selenium2Library
|
||||||
|
Resource ../../../03-Variable/BifangApiVariable.txt
|
||||||
|
Library Selenium2Library
|
||||||
|
Resource ../Objects/Objects.robot
|
||||||
|
Resource ../Objects/ObjectPages.robot
|
||||||
|
|
||||||
|
*** Keywords ***
|
||||||
|
Login
|
||||||
|
Open Browser http://${host}/#/login ${browserType}
|
||||||
|
Maximize Browser Window
|
||||||
|
input text xpath=//*[@id="app"]/div/div[2]/div/div[2]/div/input ${username}
|
||||||
|
input text xpath=//*[@id="app"]/div/div[2]/div/div[3]/div/input ${password}
|
||||||
|
Click button id=login
|
||||||
|
|
||||||
|
AddLocalIp
|
||||||
|
${obj1} create dictionary type=Ip name=LocahIPName ipads=${ipType} ipclient=masks ipclienttext1=${testClentIP} ipclienttext2=${ipMask}
|
||||||
|
CreatePage ${obj1}[type] ${obj1}[name] ipads=${obj1}[ipads] ipclient=${obj1}[ipclient] ipclienttext1=${obj1}[ipclienttext1] ipclienttext2=${obj1}[ipclienttext2]
|
||||||
|
set global variable ${LocahIPName} ${obj1}[name]
|
||||||
|
|
||||||
|
UiLoginAndAaddLocalIP
|
||||||
|
[Arguments] ${tempParm}
|
||||||
|
log UiLoginAndAaddLocalIP${tempParm}
|
||||||
|
Login.Login
|
||||||
|
Run Keyword If ${addTestClentIPFlag}==1 AddLocalIp
|
||||||
|
log UiLoginAndAaddLocalIP:${LocahIPName}
|
||||||
17
02-Keyword/tsg_ui/Logout/Logout.robot
Normal file
17
02-Keyword/tsg_ui/Logout/Logout.robot
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
*** Settings ***
|
||||||
|
Library Selenium2Library
|
||||||
|
Resource ../Objects/ObjectPages.robot
|
||||||
|
|
||||||
|
*** Keywords ***
|
||||||
|
Logout
|
||||||
|
Mouse Hover xpath=//*[@id="app"]/div/div[1]/div[2]/div/span/div/span
|
||||||
|
sleep 0.5
|
||||||
|
click element xpath=//div[@class='SignOut']
|
||||||
|
sleep 2
|
||||||
|
Close All Browsers
|
||||||
|
|
||||||
|
UiLogoutAndDelLocalIP
|
||||||
|
[Arguments] ${tempParm}
|
||||||
|
log UiLogoutAndDelLocalIP${tempParm}
|
||||||
|
Objects.DeletePage ${LocahIPName}
|
||||||
|
Logout.Logout
|
||||||
23
02-Keyword/tsg_ui/Menu.robot
Normal file
23
02-Keyword/tsg_ui/Menu.robot
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
*** Settings ***
|
||||||
|
Library Selenium2Library
|
||||||
|
|
||||||
|
*** Keywords ***
|
||||||
|
Menu
|
||||||
|
[Arguments] ${menuOne} ${menuTwo}
|
||||||
|
Wait Until Element Is Enabled id=routerEvent0
|
||||||
|
# 一级菜单
|
||||||
|
${dict} create dictionary dashboard=routerEvent0 policy&objects=children1 log=children2 report=children3 device=children4 settings=children5 administartion=children6
|
||||||
|
# 二级菜单
|
||||||
|
${policy&objects} create dictionary Security Policy=sidebarObjects_ProxyInterception Proxy Policy=sidebarObjects_ProxyManipulation Objects=sidebarObjects_Objects Schedules=sidebarObjects_Schedule Tags=sidebarObjects_Tags
|
||||||
|
${log} create dictionary Security Event Logs=sidebarLog_SecurityEventLogs Proxy Event Logs=sidebarLog_ProxyEventLogs Session Records=sidebarLog_SesssionRecords Radius Logs=sidebarLog_RadiusLogs
|
||||||
|
# 遍历一级菜单
|
||||||
|
FOR ${list} ${num} IN ENUMERATE @{dict}
|
||||||
|
run keyword if "${num}"=="${menuOne}" run keywords sleep 5
|
||||||
|
... AND click element id=${dict}[${num}]
|
||||||
|
END
|
||||||
|
# 遍历二级菜单
|
||||||
|
FOR ${list} ${num} IN ENUMERATE @{${menuOne}}
|
||||||
|
run keyword if "${num}"=="dashboard" Exit For Loop
|
||||||
|
... ELSE IF "${num}"=="${menuTwo}" run keywords sleep 3
|
||||||
|
... AND click element id=${${menuOne}}[${num}]
|
||||||
|
END
|
||||||
71
02-Keyword/tsg_ui/Objects/ObjectPages.robot
Normal file
71
02-Keyword/tsg_ui/Objects/ObjectPages.robot
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
*** Settings ***
|
||||||
|
Library Selenium2Library
|
||||||
|
Resource Objects.robot
|
||||||
|
Resource ../Menu.robot
|
||||||
|
Library Collections
|
||||||
|
|
||||||
|
*** Keywords ***
|
||||||
|
CreatePage
|
||||||
|
[Arguments] ${objtype} ${name} ${ipads}=null ${ipclient}=null ${ipclienttext1}=null ${ipclienttext2}=null ${keywordtext}=null ${hex}=close ${reqrestype}=null ${reqresheader}=null
|
||||||
|
Menu policy&objects Objects
|
||||||
|
sleep 3
|
||||||
|
Objects.CreateButton ${objtype}
|
||||||
|
Objects.Create-name ${name}
|
||||||
|
Objects.Create-item
|
||||||
|
run keyword if "${objtype}"=="Ip" run keywords Objects.Create-ip-AddressType ${ipads}
|
||||||
|
... AND Objects.Create-ip-ClientIP ${ipclient}
|
||||||
|
... AND Objects.Create-ip-ClientIP-text ${ipclient} ${ipclienttext1} ${ipclienttext2}
|
||||||
|
run keyword if "${objtype}"=="Fqdn" or "${objtype}"=="Sub" or "${objtype}"=="Url" or "${objtype}"=="Category" or "${objtype}"=="Account" run keywords Objects.Create-keyword-text ${objtype} ${keywordtext}
|
||||||
|
... AND sleep 1
|
||||||
|
run keyword if '${objtype}'=='Key' run keywords Objects.Create-Key-text ${keywordtext}
|
||||||
|
... AND Objects.Create-Key-hexmode ${hex}
|
||||||
|
run keyword if '${objtype}'=='ReqRes' run keywords Objects.Create-ReqRes-type ${reqrestype}
|
||||||
|
... AND Objects.Create-ReqRes-header ${reqrestype} ${reqresheader}
|
||||||
|
... AND Objects.Create-ReqRes-text ${keywordtext}
|
||||||
|
... AND Objects.Create-ReqRes-hexmode ${hex}
|
||||||
|
Objects.Create-item-ok ${objtype}
|
||||||
|
Objects.Create-ok
|
||||||
|
|
||||||
|
UpdateIPPage
|
||||||
|
SelectOne
|
||||||
|
UpButton
|
||||||
|
UpName yyq_test_up
|
||||||
|
Create-item
|
||||||
|
Create-ip-ClientIP range
|
||||||
|
Create-ip-ClientIP-text 192.168.255.255 192.168.255.255
|
||||||
|
Create-item-ok Ip #Ip
|
||||||
|
UpOk
|
||||||
|
|
||||||
|
DeletePage
|
||||||
|
[Arguments] ${name}
|
||||||
|
sleep 1
|
||||||
|
click element id=clear_input_btm
|
||||||
|
sleep 1
|
||||||
|
input text id=one-input ${name}
|
||||||
|
press keys id=one-input ENTER
|
||||||
|
Objects.SelectOne
|
||||||
|
Objects.DeleteButton
|
||||||
|
Objects.Delete-delete
|
||||||
|
|
||||||
|
UploadPage
|
||||||
|
UploadButton
|
||||||
|
Upload-name yyq-uploadFile
|
||||||
|
Upload-objectType
|
||||||
|
Upload-uploadedFile F:\\yyq\\python\\ip_20200221080650.txt
|
||||||
|
Upload-ok
|
||||||
|
|
||||||
|
ExportPage
|
||||||
|
ExportPage
|
||||||
|
Export-objectType ip
|
||||||
|
Export-format txt
|
||||||
|
Export-ok
|
||||||
|
|
||||||
|
DeleteObjects
|
||||||
|
[Arguments] ${obj}
|
||||||
|
sleep 2
|
||||||
|
Menu policy&objects Objects
|
||||||
|
FOR ${num} ${key} IN ENUMERATE @{obj}
|
||||||
|
sleep 2
|
||||||
|
run keyword if "${key}"!="Ip" DeletePage ${obj}[${key}]
|
||||||
|
sleep 1
|
||||||
|
END
|
||||||
256
02-Keyword/tsg_ui/Objects/Objects.robot
Normal file
256
02-Keyword/tsg_ui/Objects/Objects.robot
Normal file
@@ -0,0 +1,256 @@
|
|||||||
|
*** Settings ***
|
||||||
|
Library Selenium2Library
|
||||||
|
|
||||||
|
*** Keywords ***
|
||||||
|
CreateButton
|
||||||
|
[Arguments] ${objType}
|
||||||
|
Wait Until Element Is Enabled id=objectCreate
|
||||||
|
sleep 3
|
||||||
|
Click element id=objectCreate
|
||||||
|
run keyword if "${objType}"=="Ip" run keywords sleep 2
|
||||||
|
... AND Click element id=object1
|
||||||
|
... ELSE IF "${objType}"=="Fqdn" run keywords sleep 2
|
||||||
|
... AND Click element id=object2
|
||||||
|
... ELSE IF "${objType}"=="Sub" run keywords sleep 2
|
||||||
|
... AND Click element id=object3
|
||||||
|
... ELSE IF "${objType}"=="ReqRes" run keywords sleep 2
|
||||||
|
... AND Click element id=object4
|
||||||
|
... ELSE IF "${objType}"=="Key" run keywords sleep 2
|
||||||
|
... AND Click element id=object5
|
||||||
|
... ELSE IF "${objType}"=="Url" run keywords sleep 2
|
||||||
|
... AND Click element id=object6
|
||||||
|
... ELSE IF "${objType}"=="Category" run keywords sleep 2
|
||||||
|
... AND Click element id=object7
|
||||||
|
... ELSE IF "${objType}"=="Account" run keywords sleep 2
|
||||||
|
... AND Click element id=object8
|
||||||
|
... ELSE IF log 对象类型有误
|
||||||
|
|
||||||
|
Create-name
|
||||||
|
[Arguments] ${objName}
|
||||||
|
sleep 2
|
||||||
|
input text id=objectAdd_name ${objName}
|
||||||
|
|
||||||
|
Create-item
|
||||||
|
click element id=objectAddItemAdd
|
||||||
|
|
||||||
|
Create-item-Add
|
||||||
|
[Arguments] ${Type}
|
||||||
|
click element id=objectAddItem${Type}Add
|
||||||
|
|
||||||
|
Create-item-ok
|
||||||
|
[Arguments] ${Type}
|
||||||
|
sleep 2
|
||||||
|
run keyword if "${Type}"=="Category" click element id=objectAddItemFqdnOk
|
||||||
|
... ELSE IF "${Type}"=="Account" click element id=objectItemAccountOk
|
||||||
|
... ELSE click element id=objectAddItem${Type}Ok
|
||||||
|
|
||||||
|
Create-item-Cancel
|
||||||
|
[Arguments] ${Type}
|
||||||
|
click button id=objectAddItem${Type}Cancel
|
||||||
|
|
||||||
|
Create-ip-AddressType
|
||||||
|
[Arguments] ${AdsType}
|
||||||
|
sleep 2
|
||||||
|
click element id=objectItemIpType0
|
||||||
|
sleep 2
|
||||||
|
run keyword if "${AdsType}"=="ipv4" run keywords click element xpath=/html/body/div[2]/div[1]/div[1]/ul/li[1]
|
||||||
|
... AND sleep 1
|
||||||
|
... ELSE IF "${AdsType}"=="ipv6" run keywords click element xpath=/html/body/div[2]/div[1]/div[1]/ul/li[2]
|
||||||
|
... ELSE run keywords log 'Address Type错误'
|
||||||
|
|
||||||
|
Create-ip-Protocol
|
||||||
|
[Arguments] ${Protocol}
|
||||||
|
run keyword if ${Protocol}=="any" click element id=objectItemIpProtocol10
|
||||||
|
... ELSE IF ${Protocol}=="tcp" click element id=objectItemIpProtocol20
|
||||||
|
... ELSE IF ${Protocol}=="udp" click element id=objectItemIpProtocol30
|
||||||
|
|
||||||
|
Create-ip-Directed
|
||||||
|
[Arguments] ${Directed}
|
||||||
|
run keyword if ${Directed}=="no" click element id=objectItemIpDirection10
|
||||||
|
... ELSE IF ${Directed}=="yes" click element id=objectItemIpDirection20
|
||||||
|
|
||||||
|
Create-ip-ClientIP
|
||||||
|
[Arguments] ${clientIPType}
|
||||||
|
sleep 2
|
||||||
|
click element id=object_ip_sourecip0
|
||||||
|
sleep 2
|
||||||
|
run keyword if "${clientIPType}"=="range" run keywords sleep 1
|
||||||
|
... AND click element id=range0
|
||||||
|
... ELSE IF "${clientIPType}"=="cidr" run keywords sleep 1
|
||||||
|
... AND click element id=CIDR0
|
||||||
|
... ELSE IF "${clientIPType}"=="masks" run keywords sleep 1
|
||||||
|
... AND click element xpath=/html/body/div[3]/div[1]/div[1]/ul/li[3]
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
Create-ip-ClientIP-text
|
||||||
|
[Arguments] ${clientIPType} ${clientIPStart} ${clientIPEnd}
|
||||||
|
sleep 2
|
||||||
|
run keyword if "${clientIPType}"=="range" run keywords input text id=object_ip_clientip10 ${clientIPStart}
|
||||||
|
... AND input text id=object_ip_clientip20 ${clientIPEnd}
|
||||||
|
run keyword if "${clientIPType}"=="cidr" run keywords input text id=object_ip_clientip30 ${clientIPStart}
|
||||||
|
... AND input text id=object_ip_clientip40 ${clientIPEnd}
|
||||||
|
run keyword if "${clientIPType}"=="masks" run keywords input text id=object_ip_clientip50 ${clientIPStart}
|
||||||
|
... AND input text id=object_ip_clientip60 ${clientIPEnd}
|
||||||
|
|
||||||
|
Create-ip-ClientPort
|
||||||
|
|
||||||
|
Create-ip-ClientPort-text
|
||||||
|
|
||||||
|
Create-ip-ServerIP
|
||||||
|
|
||||||
|
Create-ip-ServerPort
|
||||||
|
|
||||||
|
Create-subobjects
|
||||||
|
click element id=objectAddSubAdd
|
||||||
|
|
||||||
|
Create-Description
|
||||||
|
[Arguments] ${objDesc}
|
||||||
|
input text id=objectAdd_description ${objDesc}
|
||||||
|
|
||||||
|
Create-ok
|
||||||
|
sleep 1
|
||||||
|
click button id=objectAdd_ok
|
||||||
|
|
||||||
|
Create-cancel
|
||||||
|
click button id=objectAdd_cancel
|
||||||
|
|
||||||
|
SelectOne
|
||||||
|
sleep 3
|
||||||
|
click element xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr[1]
|
||||||
|
|
||||||
|
UpButton
|
||||||
|
click button id=objectEdit
|
||||||
|
|
||||||
|
DeleteButton
|
||||||
|
click button id=objectDel
|
||||||
|
|
||||||
|
Delete-delete
|
||||||
|
sleep 2
|
||||||
|
click button id=object-objectDel-confirm
|
||||||
|
|
||||||
|
Delete-cancel
|
||||||
|
click button xpath=/html/body/div[2]/div/div[3]/button[1]
|
||||||
|
|
||||||
|
UpName
|
||||||
|
[Arguments] ${name}
|
||||||
|
clear element text id=objectAdd_name
|
||||||
|
input text id=objectAdd_name ${name}
|
||||||
|
|
||||||
|
UpOk
|
||||||
|
click button id=objectAdd_ok
|
||||||
|
|
||||||
|
UploadButton
|
||||||
|
sleep 3
|
||||||
|
click button id=objectImprt
|
||||||
|
|
||||||
|
ExportButton
|
||||||
|
sleep 3
|
||||||
|
click button id=objectExport
|
||||||
|
|
||||||
|
Upload-name
|
||||||
|
[Arguments] ${name}
|
||||||
|
sleep 2
|
||||||
|
input text xpath=//*[@id="app"]/div/div[3]/div/div/div[14]/div/div[1]/div[1]/div/input ${name}
|
||||||
|
|
||||||
|
Upload-objectType
|
||||||
|
click button id=object_select_Import
|
||||||
|
sleep 2
|
||||||
|
click element xpath=/html/body/div[2]/div[1]/div[1]/ul/li[1]
|
||||||
|
|
||||||
|
Upload-uploadedFile
|
||||||
|
[Arguments] ${ads}
|
||||||
|
sleep 3
|
||||||
|
Choose File xpath=//*[@id="app"]/div/div[3]/div/div/div[14]/div/div[2]/div/div[1]/input ${ads}
|
||||||
|
|
||||||
|
Upload-ok
|
||||||
|
click button id=objectUploadedOk
|
||||||
|
|
||||||
|
Export-objectType
|
||||||
|
[Arguments] ${objType}
|
||||||
|
click element id=object_select_Import1
|
||||||
|
run keyword if "${objType}"=="ip" run keywords sleep 2
|
||||||
|
... AND click element xpath=/html/body/div[2]/div[1]/div[1]/ul/li[1]
|
||||||
|
... ELSE IF "${objType}"=="fqdn" run keywords sleep 2
|
||||||
|
... AND Click element xpath=/html/body/div[2]/div[1]/div[1]/ul/li[2]
|
||||||
|
... ELSE IF "${objType}"=="subscriberid" run keywords sleep 2
|
||||||
|
... AND Click element xpath=/html/body/div[2]/div[1]/div[1]/ul/li[3]
|
||||||
|
... ELSE IF "${objType}"=="httpsignature" run keywords sleep 2
|
||||||
|
... AND Click element xpath=/html/body/div[2]/div[1]/div[1]/ul/li[4]
|
||||||
|
... ELSE IF "${objType}"=="keywords" run keywords sleep 2
|
||||||
|
... AND Click element xpath=/html/body/div[2]/div[1]/div[1]/ul/li[5]
|
||||||
|
... ELSE IF "${objType}"=="url" run keywords sleep 2
|
||||||
|
... AND Click element xpath=/html/body/div[2]/div[1]/div[1]/ul/li[6]
|
||||||
|
... ELSE IF "${objType}"=="category" run keywords sleep 2
|
||||||
|
... AND Click element xpath=/html/body/div[2]/div[1]/div[1]/ul/li[7]
|
||||||
|
... ELSE IF "${objType}"=="account" run keywords sleep 2
|
||||||
|
... AND Click element xpath=/html/body/div[2]/div[1]/div[1]/ul/li[8]
|
||||||
|
|
||||||
|
Export-format
|
||||||
|
[Arguments] ${filetype}
|
||||||
|
sleep 2
|
||||||
|
click element id=object_select_export
|
||||||
|
run keyword if "${filetype}"=="txt" run keywords sleep 2
|
||||||
|
... AND click element xpath=/html/body/div[3]/div[1]/div[1]/ul/li[1]
|
||||||
|
... ELSE IF "${filetype}"=="csv" run keywords sleep 2
|
||||||
|
... AND click element xpath=/html/body/div[3]/div[1]/div[1]/ul/li[2]
|
||||||
|
|
||||||
|
Export-ok
|
||||||
|
click button id=objectImportOk
|
||||||
|
|
||||||
|
Export-cancel
|
||||||
|
click button id=objectImportCancel
|
||||||
|
|
||||||
|
Create-keyword-text
|
||||||
|
[Arguments] ${type} ${keywordtext}
|
||||||
|
sleep 1
|
||||||
|
run keyword if "${type}"=="Fqdn" run keywords sleep 1
|
||||||
|
... AND input text id=object_fqdn0 ${keywordtext}
|
||||||
|
... ELSE IF "${type}"=="Sub" run keywords sleep 1
|
||||||
|
... AND input text id=object_sub0 ${keywordtext}
|
||||||
|
... ELSE IF "${type}"=="Url" run keywords sleep 1
|
||||||
|
... AND input text id=object_url0 ${keywordtext}
|
||||||
|
... ELSE IF "${type}"=="Category" run keywords sleep 1
|
||||||
|
... AND input text id=object_fqdn0 ${keywordtext}
|
||||||
|
... ELSE IF "${type}"=="Account" run keywords sleep 1
|
||||||
|
... AND input text id=object_account0 ${keywordtext}
|
||||||
|
... ELSE log 2
|
||||||
|
|
||||||
|
Create-ReqRes-type
|
||||||
|
[Arguments] ${type}
|
||||||
|
sleep 1
|
||||||
|
run keyword if '${type}'=='req' click element xpath=//*[@id="objectAddItemReqRes"]/label[1]
|
||||||
|
... ELSE IF '${type}'=='res' click element xpath=//*[@id="objectAddItemReqRes"]/label[2]
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
Create-ReqRes-header
|
||||||
|
[Arguments] ${type} ${header}
|
||||||
|
sleep 1
|
||||||
|
run keyword if '${type}'=='req' and '${header}'=='ua' click element xpath=//*[@id="objectAddItemReqResType1"]/label[1]
|
||||||
|
... ELSE IF '${type}'=='req' and '${header}'=='ck' click element xpath=//*[@id="objectAddItemReqResType1"]/label[2]
|
||||||
|
... ELSE IF '${type}'=='res'and '${header}'=='sck' click element xpath=//*[@id="objectAddItemReqResType"]/label[1]
|
||||||
|
... ELSE IF '${type}'=='res'and '${header}'=='ct' click element xpath=//*[@id="objectAddItemReqResType"]/label[2]
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
Create-ReqRes-text
|
||||||
|
[Arguments] ${keywordtext}
|
||||||
|
sleep 1
|
||||||
|
input text id=object_sig0 ${keywordtext}
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
Create-ReqRes-hexmode
|
||||||
|
[Arguments] ${hex}
|
||||||
|
sleep 1
|
||||||
|
run keyword if "${hex}"=="open" click element id=objectAddItemReqResIsHexbin0_swith
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
Create-Key-text
|
||||||
|
[Arguments] ${keywordtext}
|
||||||
|
sleep 1
|
||||||
|
input text id=object_key0 ${keywordtext}
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
Create-Key-hexmode
|
||||||
|
[Arguments] ${hex}
|
||||||
|
sleep 1
|
||||||
|
run keyword if "${hex}"=="open" click element id=objectAddItemKeyIsHexbin0_swith
|
||||||
|
sleep 1
|
||||||
260
02-Keyword/tsg_ui/Schedules/Schedules.robot
Normal file
260
02-Keyword/tsg_ui/Schedules/Schedules.robot
Normal file
@@ -0,0 +1,260 @@
|
|||||||
|
*** Settings ***
|
||||||
|
Library Selenium2Library
|
||||||
|
|
||||||
|
*** Keywords ***
|
||||||
|
Schedules-create
|
||||||
|
[Arguments] ${name} ${type1} ${number} ${weeks} ${dateorweeks} ${dates}
|
||||||
|
... ${aweeks} ${Start Date} ${End Date} ${Start Time} ${End Time}
|
||||||
|
click element id=scheduleAdd #点击create按钮
|
||||||
|
sleep 1
|
||||||
|
input text id=schedule_name ${name}
|
||||||
|
sleep 1
|
||||||
|
${type} set variable ${type1}
|
||||||
|
run keyword if '${type}'=='Daily' run keywords sleep 1
|
||||||
|
... AND Schedules-Daily ${number}
|
||||||
|
... ELSE IF '${type}'=='Weekly' run keywords sleep 1
|
||||||
|
... AND Schedules-Weekly ${number} ${weeks}
|
||||||
|
... ELSE IF '${type}'=='Monthly' run keywords sleep 1
|
||||||
|
... AND Schedules-Monthly ${dateorweeks} ${number} ${dates} ${aweeks}
|
||||||
|
... ${weeks}
|
||||||
|
... ELSE IF '${type}'=='One-time' run keywords sleep 1
|
||||||
|
... AND click element id=scheduleAddTypeSingle
|
||||||
|
sleep 1
|
||||||
|
input text id=schedulead_startdate ${Start Date} #开始日期
|
||||||
|
sleep 1
|
||||||
|
click element xpath=//*[@id="policy_Manipulation_create5"]/div[2]
|
||||||
|
sleep 1
|
||||||
|
input text xpath=//*[@id="policy_Manipulation_create5"]/div[2]/form/div[5]/div/div/input ${End Date} #结束日期
|
||||||
|
sleep 1
|
||||||
|
click element xpath=//*[@id="policy_Manipulation_create5"]/div[2]
|
||||||
|
sleep 1
|
||||||
|
input text id=schedulead_startTime ${Start Time} #开始时间
|
||||||
|
sleep 1
|
||||||
|
click element xpath=//*[@id="policy_Manipulation_create5"]/div[2]
|
||||||
|
sleep 1
|
||||||
|
input text xpath=//*[@id="policy_Manipulation_create5"]/div[2]/form/div[7]/div/div/input ${End Time} #结束时间
|
||||||
|
sleep 1
|
||||||
|
click element xpath=//*[@id="policy_Manipulation_create5"]/div[2]
|
||||||
|
sleep 2
|
||||||
|
click element xpath=//*[@id="policy_Manipulation_create5"]/div[2]/form/div[8]/div/div/button[1] #点击OK
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
Schedules-Daily
|
||||||
|
[Arguments] ${number}
|
||||||
|
click element id=scheduleAddTypeDaily #点击 Daily
|
||||||
|
sleep 1
|
||||||
|
input text xpath=//*[@id="schedule_interval"]/div/input ${number}
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
Schedules-Weekly
|
||||||
|
[Arguments] ${number} ${weeks}
|
||||||
|
click element id=scheduleAddTypeWeekly #点击Weekly
|
||||||
|
sleep 1
|
||||||
|
input text xpath=//*[@id="schedule_interval"]/div/input ${number}
|
||||||
|
sleep 1
|
||||||
|
${week} set variable ${weeks}
|
||||||
|
run keyword if '${week}'=='SUN' run keywords sleep 1
|
||||||
|
... AND click element id=schedulead_cities0
|
||||||
|
... ELSE IF '${week}'=='MON' run keywords sleep 1
|
||||||
|
... AND click element id=schedulead_cities1
|
||||||
|
... ELSE IF '${week}'=='TUE' run keywords sleep 1
|
||||||
|
... AND click element id=schedulead_cities2
|
||||||
|
... ELSE IF '${week}'=='WED' run keywords sleep 1
|
||||||
|
... AND click element id=schedulead_cities3
|
||||||
|
... ELSE IF '${week}'=='THU' run keywords sleep 1
|
||||||
|
... AND click element id=schedulead_cities4
|
||||||
|
... ELSE IF '${week}'=='FRI' run keywords sleep 1
|
||||||
|
... AND click element id=schedulead_cities5
|
||||||
|
... ELSE IF '${week}'=='SAT' run keywords sleep 1
|
||||||
|
... AND click element id=schedulead_cities6
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
Schedules-Monthly
|
||||||
|
[Arguments] ${dateorweeks} ${number}=null ${dates}=null ${aweeks}=null ${weeks}=null
|
||||||
|
click element id=scheduleAddTypeMonthly #点击monthly
|
||||||
|
sleep 1
|
||||||
|
${dateorweek} set variable ${dateorweeks}
|
||||||
|
run keyword if '${dateorweek}'=='Date' run keywords sleep 1
|
||||||
|
... AND click element xpath=//*[@id="policy_Manipulation_create5"]/div[2]/form/div[3]/div/div[1]/label[1]
|
||||||
|
... AND Schedules-Monthly-Date ${number} ${dates}
|
||||||
|
... ELSE IF '${dateorweek}'=='Week' run keywords sleep 1
|
||||||
|
... AND click element xpath=//*[@id="policy_Manipulation_create5"]/div[2]/form/div[3]/div/div[1]/label[2]
|
||||||
|
... AND Schedules-Monthly-Week ${number} ${aweeks} ${weeks}
|
||||||
|
|
||||||
|
Schedules-Monthly-Date
|
||||||
|
[Arguments] ${number} ${dates}
|
||||||
|
input text xpath=//*[@id="schedule_interval"]/div/input ${number}
|
||||||
|
sleep 1
|
||||||
|
${date} set variable ${dates}
|
||||||
|
run keyword if '${date}'=='All' run keywords sleep 1
|
||||||
|
... AND click element id=schedule_alldaycontrol
|
||||||
|
... ELSE IF '${date}'=='1' run keywords sleep 1
|
||||||
|
... AND click element id=schedule_onDay0
|
||||||
|
... ELSE IF '${date}'=='2' run keywords sleep 1
|
||||||
|
... AND click element id=schedule_onDay1
|
||||||
|
... ELSE IF '${date}'=='3' run keywords sleep 1
|
||||||
|
... AND click element id=schedule_onDay2
|
||||||
|
... ELSE IF '${date}'=='4' run keywords sleep 1
|
||||||
|
... AND click element id=schedule_onDay3
|
||||||
|
... ELSE IF '${date}'=='5' run keywords sleep 1
|
||||||
|
... AND click element id=schedule_onDay4
|
||||||
|
... ELSE IF '${date}'=='6' run keywords sleep 1
|
||||||
|
... AND click element id=schedule_onDay5
|
||||||
|
... ELSE IF '${date}'=='7' run keywords sleep 1
|
||||||
|
... AND click element id=schedule_onDay6
|
||||||
|
... ELSE IF '${date}'=='8' run keywords sleep 1
|
||||||
|
... AND click element id=schedule_onDay7
|
||||||
|
... ELSE IF '${date}'=='9' run keywords sleep 1
|
||||||
|
... AND click element id=schedule_onDay8
|
||||||
|
... ELSE IF '${date}'=='10' run keywords sleep 1
|
||||||
|
... AND click element id=schedule_onDay9
|
||||||
|
... ELSE IF '${date}'=='11' run keywords sleep 1
|
||||||
|
... AND click element id=schedule_onDay10
|
||||||
|
... ELSE IF '${date}'=='12' run keywords sleep 1
|
||||||
|
... AND click element id=schedule_onDay11
|
||||||
|
... ELSE IF '${date}'=='13' run keywords sleep 1
|
||||||
|
... AND click element id=schedule_onDay12
|
||||||
|
... ELSE IF '${date}'=='14' run keywords sleep 1
|
||||||
|
... AND click element id=schedule_onDay13
|
||||||
|
... ELSE IF '${date}'=='15' run keywords sleep 1
|
||||||
|
... AND click element id=schedule_onDay14
|
||||||
|
... ELSE IF '${date}'=='16' run keywords sleep 1
|
||||||
|
... AND click element id=schedule_onDay15
|
||||||
|
... ELSE IF '${date}'=='17' run keywords sleep 1
|
||||||
|
... AND click element id=schedule_onDay16
|
||||||
|
... ELSE IF '${date}'=='18' run keywords sleep 1
|
||||||
|
... AND click element id=schedule_onDay17
|
||||||
|
... ELSE IF '${date}'=='19' run keywords sleep 1
|
||||||
|
... AND click element id=schedule_onDay18
|
||||||
|
... ELSE IF '${date}'=='20' run keywords sleep 1
|
||||||
|
... AND click element id=schedule_onDay19
|
||||||
|
... ELSE IF '${date}'=='21' run keywords sleep 1
|
||||||
|
... AND click element id=schedule_onDay20
|
||||||
|
... ELSE IF '${date}'=='22' run keywords sleep 1
|
||||||
|
... AND click element id=schedule_onDay21
|
||||||
|
... ELSE IF '${date}'=='23' run keywords sleep 1
|
||||||
|
... AND click element id=schedule_onDay22
|
||||||
|
... ELSE IF '${date}'=='24' run keywords sleep 1
|
||||||
|
... AND click element id=schedule_onDay23
|
||||||
|
... ELSE IF '${date}'=='25' run keywords sleep 1
|
||||||
|
... AND click element id=schedule_onDay24
|
||||||
|
... ELSE IF '${date}'=='26' run keywords sleep 1
|
||||||
|
... AND click element id=schedule_onDay25
|
||||||
|
... ELSE IF '${date}'=='27' run keywords sleep 1
|
||||||
|
... AND click element id=schedule_onDay26
|
||||||
|
... ELSE IF '${date}'=='28' run keywords sleep 1
|
||||||
|
... AND click element id=schedule_onDay27
|
||||||
|
... ELSE IF '${date}'=='29' run keywords sleep 1
|
||||||
|
... AND click element id=schedule_onDay28
|
||||||
|
... ELSE IF '${date}'=='30' run keywords sleep 1
|
||||||
|
... AND click element id=schedule_onDay29
|
||||||
|
... ELSE IF '${date}'=='31' run keywords sleep 1
|
||||||
|
... AND click element id=schedule_onDay301sleep1
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
Schedules-Monthly-Week
|
||||||
|
[Arguments] ${number} ${aweeks} ${weeks}
|
||||||
|
sleep 2
|
||||||
|
input text xpath=/html/body/div/div/div[3]/div/div/div/div[2]/form/div[3]/div/div[2]/div/div/div/div/input ${number}
|
||||||
|
sleep 1
|
||||||
|
click element id=schedulead_select_week
|
||||||
|
sleep 2
|
||||||
|
${aweek} set variable ${aweeks}
|
||||||
|
run keyword if '${aweek}'=='1' run keywords sleep 1
|
||||||
|
... AND click element xpath=/html/body/div/div[1]/div[1]/ul/li[1]
|
||||||
|
... ELSE IF '${aweek}'=='2' run keywords sleep 1
|
||||||
|
... AND click element xpath=/html/body/div/div[1]/div[1]/ul/li[2]
|
||||||
|
... ELSE IF '${aweek}'=='3' run1 keywords sleep 1
|
||||||
|
... AND click element xpath=/html/body/div/div[1]/div[1]/ul/li[3]
|
||||||
|
... ELSE IF '${aweek}'=='4' run keywords sleep 1
|
||||||
|
... AND click eleme1nt xpath=/html/body/div/div[1]/div[1]/ul/li[4]
|
||||||
|
... ELSE IF '${aweek}'=='L' run keywords sleep 1
|
||||||
|
... AND click element xpath=/html/body/div/div[1]/div[1]/ul/li[5]
|
||||||
|
sleep 1
|
||||||
|
click element xpath=//*[@id="policy_Manipulation_create5"]/div[2]/form/div[3]/div/div[3]/nav/div/div[2]/span/span/i
|
||||||
|
sleep 1
|
||||||
|
${week} set variable ${weeks}
|
||||||
|
run keyword if '${week}'=='SUN' run keywords sleep 1
|
||||||
|
... AND click element id=schedulead_cities0
|
||||||
|
... ELSE IF '${week}'=='MON' run keywords sleep 1
|
||||||
|
... AND click element id=schedulead_cities1
|
||||||
|
... ELSE IF '${week}'=='TUE' run keywords sleep 1
|
||||||
|
... AND click element id=schedulead_cities2
|
||||||
|
... ELSE IF '${week}'=='WED' run keywords sleep 1
|
||||||
|
... AND click element id=schedulead_cities3
|
||||||
|
... ELSE IF '${week}'=='THU' run keywords sleep 1
|
||||||
|
... AND click element id=schedulead_cities4
|
||||||
|
... ELSE IF '${week}'=='FRI' run keywords sleep 1
|
||||||
|
... AND click element id=schedulead_cities5
|
||||||
|
... ELSE IF '${week}'=='SAT' run keywords sleep 1
|
||||||
|
... AND click element id=schedulead_cities6
|
||||||
|
... ELSE IF '${week}'=='All' run keywords sleep 1
|
||||||
|
... AND click element id=schedulead_weekchooseAll
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
Schedules-delete
|
||||||
|
sleep 1
|
||||||
|
click element id=scheduleDel #点击删除按钮
|
||||||
|
sleep 1
|
||||||
|
click element xpath=/html/body/div[2]/div/div[3]/button[2]
|
||||||
|
|
||||||
|
Schedules-search-id
|
||||||
|
[Arguments] ${id}
|
||||||
|
sleep 1
|
||||||
|
click element id=one-input
|
||||||
|
sleep 1
|
||||||
|
click element id=input_list_li1
|
||||||
|
sleep 1
|
||||||
|
input text id=sreach_input ${id}
|
||||||
|
sleep 1
|
||||||
|
click element id=select_new_search_btn
|
||||||
|
sleep 1
|
||||||
|
click element xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table
|
||||||
|
|
||||||
|
Schedules-search-name
|
||||||
|
[Arguments] ${name}
|
||||||
|
sleep 1
|
||||||
|
click element id=one-input
|
||||||
|
sleep 1
|
||||||
|
click element id=input_list_li2
|
||||||
|
sleep 1
|
||||||
|
input text id=sreach_input ${name}
|
||||||
|
sleep 1
|
||||||
|
click element id=select_new_search_btn
|
||||||
|
sleep 1
|
||||||
|
click element xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table
|
||||||
|
|
||||||
|
Schedules-edit
|
||||||
|
[Arguments] ${name} ${type1} ${number} ${weeks} ${dateorweeks} ${dates}
|
||||||
|
... ${aweeks} ${Start Date} ${End Date} ${Start Time} ${End Time}
|
||||||
|
click element id=scheduleEdit #点击create按钮
|
||||||
|
sleep 1
|
||||||
|
input text id=schedule_name ${name}
|
||||||
|
sleep 1
|
||||||
|
${type} set variable ${type1}
|
||||||
|
run keyword if '${type}'=='Daily' run keywords sleep 1
|
||||||
|
... AND Schedules-Daily ${number}
|
||||||
|
... ELSE IF '${type}'=='Weekly' run keywords sleep 1
|
||||||
|
... AND Schedules-Weekly ${number} ${weeks}
|
||||||
|
... ELSE IF '${type}'=='Monthly' run keywords sleep 1
|
||||||
|
... AND Schedules-Monthly ${dateorweeks} ${number} ${dates} ${aweeks}
|
||||||
|
... ${weeks}
|
||||||
|
sleep 1
|
||||||
|
input text id=schedulead_startdate ${Start Date} #开始日期
|
||||||
|
sleep 1
|
||||||
|
click element xpath=//*[@id="policy_Manipulation_create5"]/div[2]
|
||||||
|
sleep 1
|
||||||
|
input text xpath=//*[@id="policy_Manipulation_create5"]/div[2]/form/div[5]/div/div/input ${End Date} #结束日期
|
||||||
|
sleep 1
|
||||||
|
click element xpath=//*[@id="policy_Manipulation_create5"]/div[2]
|
||||||
|
sleep 1
|
||||||
|
input text id=schedulead_startTime ${Start Time} #开始时间
|
||||||
|
sleep 1
|
||||||
|
click element xpath=//*[@id="policy_Manipulation_create5"]/div[2]
|
||||||
|
sleep 1
|
||||||
|
input text xpath=//*[@id="policy_Manipulation_create5"]/div[2]/form/div[7]/div/div/input ${End Time} #结束时间
|
||||||
|
sleep 1
|
||||||
|
click element xpath=//*[@id="policy_Manipulation_create5"]/div[2]
|
||||||
|
sleep 1
|
||||||
|
click element xpath=//*[@id="policy_Manipulation_create5"]/div[2]/form/div[8]/div/div/button[1] #点击OK
|
||||||
|
Sleep 2
|
||||||
122
02-Keyword/tsg_ui/SecurityPolicy/InterceptSSLModule.robot
Normal file
122
02-Keyword/tsg_ui/SecurityPolicy/InterceptSSLModule.robot
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
*** Settings ***
|
||||||
|
Library Selenium2Library
|
||||||
|
|
||||||
|
*** Keywords ***
|
||||||
|
Keyring-create
|
||||||
|
[Arguments] ${keyring-name} ${file} ${file1} ${1or2} ${type} ${type1}
|
||||||
|
[Documentation] 引用次关键字,填入必填参数
|
||||||
|
... 必填参数:
|
||||||
|
... ${keyring-name}:新建页面name输入框里的内容
|
||||||
|
... ${file}:上传文件所在本地的路径
|
||||||
|
... ${file1}:上传文件所在本地的路径
|
||||||
|
... ${1or2}:填入1 或者其他数值
|
||||||
|
... ${type}:上传证书类型的元素
|
||||||
|
... ${type1}:上传证书加密解密算法的元素
|
||||||
|
click element id=interceptionadd_eventkeying #点击下拉框
|
||||||
|
sleep 1
|
||||||
|
click element id=interceptionadd_keyadd #点击+号添加证书
|
||||||
|
sleep 2
|
||||||
|
input text id=keyringsadd_name ${keyring-name} #输入证书name
|
||||||
|
sleep 1
|
||||||
|
Choose File xpath=//*[@id="proxy"]/div[10]/div/div/div[2]/form/div[2]/div/div/div/input ${file} #上传证书文件
|
||||||
|
sleep 2
|
||||||
|
Choose File xpath=//*[@id="proxy"]/div[10]/div/div/div[2]/form/div[4]/div/div/div/input ${file1} #上传证书文件
|
||||||
|
${select} Set Variable ${1or2}
|
||||||
|
Run Keyword If '${select}'=='1' click id=keyringsadd_customized
|
||||||
|
Run Keyword If '${select}'=='1' input id=reissueExpiryDate 10
|
||||||
|
click element id=certificateType_input #点击下拉框
|
||||||
|
sleep 1
|
||||||
|
click element ${type} #选择证书类型
|
||||||
|
sleep 1
|
||||||
|
click element id=keyringsadd_publicKeyAlgo #点击下拉框
|
||||||
|
sleep 1
|
||||||
|
click element ${type1} #选择加密解密类型
|
||||||
|
sleep 1
|
||||||
|
click element id=parentobj_submit #点击ok
|
||||||
|
|
||||||
|
Keyring-search
|
||||||
|
[Arguments] ${name}
|
||||||
|
[Documentation] 条用此关键字前需要给必填参数:${name}
|
||||||
|
... ${name}:创建的keyring的name
|
||||||
|
click element id=tab-0 #点击Keyring
|
||||||
|
sleep 1
|
||||||
|
click element id=interceptionadd_eventkeying #点击下拉框
|
||||||
|
sleep 1
|
||||||
|
input text id=card_keyringName ${name} #搜索框输入
|
||||||
|
Sleep 1
|
||||||
|
Press key id=card_keyringName \\13 #回车键
|
||||||
|
sleep 1
|
||||||
|
click element id=card_keylist0 #点击列表
|
||||||
|
|
||||||
|
Certificate Checks
|
||||||
|
[Arguments] ${Type}
|
||||||
|
[Documentation] 在调用此关键字前,需要添加必填参数${Type}
|
||||||
|
... ${Type}为Fail-close或者是Pass-through \ \ \ 代表Certificate Checks 里的两个按钮
|
||||||
|
click element id=tab-1 #点击Certificate Checks
|
||||||
|
sleep 1
|
||||||
|
run keyword if "${Type}"=="Fail-close" click element id=card_fileoption0
|
||||||
|
... ELSE IF "${Type}"=="Pass-through" click element id=card_fileoption1 #选择Fail-close或者pass-through
|
||||||
|
|
||||||
|
Dynamic Bypass
|
||||||
|
[Arguments] ${Type}
|
||||||
|
[Documentation] 调用此关键字前 需要给一个必填参数${Type}
|
||||||
|
... ${Type}参数为EV或者CT或者MA或者OPE或者CP \ 对应Dynamic Bypass 五个按钮
|
||||||
|
click element id=tab-3 #点击Dynamic Bypass
|
||||||
|
sleep 1
|
||||||
|
click element id=mutual_authentication_swith
|
||||||
|
sleep 1
|
||||||
|
click element id=undefined_swith
|
||||||
|
sleep 1
|
||||||
|
click element id=cert_pinning1_swith
|
||||||
|
sleep 1
|
||||||
|
run keyword if "${Type}"=="EV" click element id=ev_cert_swith
|
||||||
|
... ELSE IF "${Type}"=="CT" click element id=cert_transparency_swith
|
||||||
|
... ELSE IF "${Type}"=="MA" click element id=mutual_authentication_swith
|
||||||
|
... ELSE IF "${Type}"=="OPE" click element id=undefined_swith
|
||||||
|
... ELSE IF "${Type}"=="CP" click element id=cert_pinning1_swith
|
||||||
|
|
||||||
|
Certificate Checks-close
|
||||||
|
[Documentation] 次关键字为关闭Certificate Checks的四个按钮
|
||||||
|
click element id=tab-1 #点击Certificate Checks
|
||||||
|
sleep 1
|
||||||
|
click element id=cn_swith
|
||||||
|
sleep 1
|
||||||
|
click element id=issuer_swith
|
||||||
|
sleep 1
|
||||||
|
click element id=self_signed_swith
|
||||||
|
sleep 1
|
||||||
|
click element id=expiration_swith
|
||||||
|
|
||||||
|
Protocol Version
|
||||||
|
[Arguments] ${Type} ${Type1} ${Type2}
|
||||||
|
[Documentation] 调用次关键字前需要添加必填参数:
|
||||||
|
... ${Type}:填入MCV或者AH2
|
||||||
|
... ${Type1}:对应最小版本号(填入:3.0或者1.0或者1.1或者1.2或者1.3)
|
||||||
|
... ${Type2}:对应最大版本号(填入:3.0或者1.0或者1.1或者1.2或者1.3)
|
||||||
|
click element id=tab-4
|
||||||
|
sleep 1
|
||||||
|
run keyword if "${Type}"=="MCV" run keywords click element id=interceptionadd_sslver_swith
|
||||||
|
... AND Mirror Client Versions-close ${Type1} ${Type2}
|
||||||
|
... ELSE IF "${Type}"=="AH2" click element id=interceptionaddallhttp_swith
|
||||||
|
|
||||||
|
Mirror Client Versions-close
|
||||||
|
[Arguments] ${Type} ${Type1}
|
||||||
|
[Documentation] 调用次关键字前需要添加必填参数:
|
||||||
|
... ${Type}:对应最小版本号(填入:3.0或者1.0或者1.1或者1.2或者1.3)
|
||||||
|
... ${Type1}:对应最大版本号(填入:3.0或者1.0或者1.1或者1.2或者1.3)
|
||||||
|
sleep 1
|
||||||
|
click element id=interceptionadd_sslmin
|
||||||
|
sleep 1
|
||||||
|
run keyword if "${Type}"=="3.0" click element id=pro_min0
|
||||||
|
... ELSE IF "${Type}"=="1.0" click element id=pro_min1
|
||||||
|
... ELSE IF "${Type}"=="1.1" click element id=pro_min2
|
||||||
|
... ELSE IF "${Type}"=="1.2" click element id=pro_min3
|
||||||
|
... ELSE IF "${Type}"=="1.3" click element id=pro_min4
|
||||||
|
sleep 1
|
||||||
|
click element id=interceptionadd_sslmax
|
||||||
|
sleep 1
|
||||||
|
run keyword if "${Type1}"=="3.0" click element id=pro_max0
|
||||||
|
... ELSE IF "${Type1}"=="1.0" click element id=pro_max1
|
||||||
|
... ELSE IF "${Type1}"=="1.1" click element id=pro_max2
|
||||||
|
... ELSE IF "${Typeq}"=="1.2" click element id=pro_max3
|
||||||
|
... ELSE IF "${Typeq}"=="1.3" click element id=pro_max4
|
||||||
259
02-Keyword/tsg_ui/SecurityPolicy/SecurityPolicy.robot
Normal file
259
02-Keyword/tsg_ui/SecurityPolicy/SecurityPolicy.robot
Normal file
@@ -0,0 +1,259 @@
|
|||||||
|
*** Settings ***
|
||||||
|
Library Selenium2Library
|
||||||
|
|
||||||
|
*** Keywords ***
|
||||||
|
CreateButton
|
||||||
|
Wait Until Element Is Enabled id=proxyInterception_create
|
||||||
|
sleep 3
|
||||||
|
click element id=proxyInterception_create
|
||||||
|
|
||||||
|
Create-name
|
||||||
|
[Arguments] ${name}
|
||||||
|
sleep 2
|
||||||
|
input text id=interceptionadd_name ${name}
|
||||||
|
|
||||||
|
Create-action
|
||||||
|
[Arguments] ${action}
|
||||||
|
run keyword if "${action}"=="allow" run keywords sleep 1
|
||||||
|
... AND click element id=security_action_Allow
|
||||||
|
... ELSE IF "${action}"=="deny" run keywords sleep 1
|
||||||
|
... AND click element id=security_action_Deny
|
||||||
|
... ELSE IF "${action}"=="monitor" run keywords sleep 1
|
||||||
|
... AND click element id=security_action_Monitor
|
||||||
|
... ELSE IF "${action}"=="intercept" run keywords sleep 1
|
||||||
|
... AND click element id=security_action_Intercept
|
||||||
|
|
||||||
|
Create-Conditions
|
||||||
|
sleep 2
|
||||||
|
click element id=interceptionadd_object
|
||||||
|
|
||||||
|
Create-Conditions-ip
|
||||||
|
[Arguments] ${objname}
|
||||||
|
sleep 2
|
||||||
|
click element id=interceptionadd_procolall1
|
||||||
|
sleep 2
|
||||||
|
SecurityPolicy.SelectOne ${objname}
|
||||||
|
|
||||||
|
Create-Conditions-sub
|
||||||
|
[Arguments] ${objname}
|
||||||
|
sleep 2
|
||||||
|
click element id=interceptionadd_procolall2
|
||||||
|
sleep 2
|
||||||
|
SecurityPolicy.SelectOne ${objname}
|
||||||
|
|
||||||
|
Create-Conditions-protocol
|
||||||
|
[Arguments] ${protocol}
|
||||||
|
sleep 2
|
||||||
|
click element id=interceptionadd_procolall3
|
||||||
|
sleep 2
|
||||||
|
run keyword if '${protocol}'=='http' run keywords sleep 1
|
||||||
|
... AND click element id=interceptionadd_prochange0
|
||||||
|
... ELSE IF '${protocol}'=='ssl' run keywords sleep 1
|
||||||
|
... AND click element id=interceptionadd_prochange1
|
||||||
|
... ELSE IF '${protocol}'=='dns' run keywords sleep 1
|
||||||
|
... AND click element id=interceptionadd_prochange2
|
||||||
|
... ELSE IF '${protocol}'=='mail' run keywords sleep 1
|
||||||
|
... AND click element id=interceptionadd_prochange3
|
||||||
|
... ELSE IF '${protocol}'=='ftp' run keywords sleep 1
|
||||||
|
... AND click element id=interceptionadd_prochange4
|
||||||
|
... ELSE log 协议内容错误
|
||||||
|
|
||||||
|
Create-Conditions-Search
|
||||||
|
[Arguments] ${Search}
|
||||||
|
input text xpath=//*[@id="proxy"]/div[5]/div[2]/div[2]/div/div[1]/input ${Search}
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
Create-Conditions-Close
|
||||||
|
click button id=interceptionadd_allcancelobject
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
Create-Tag
|
||||||
|
|
||||||
|
Create-EffectiveDevices
|
||||||
|
|
||||||
|
Create-Schedule
|
||||||
|
|
||||||
|
Create-Log Session
|
||||||
|
|
||||||
|
Create-Description
|
||||||
|
|
||||||
|
Create-Enabled
|
||||||
|
[Arguments] ${state}
|
||||||
|
sleep 2
|
||||||
|
run keyword if "${state}"=="open" run keywords click element id=enablencheck_swith
|
||||||
|
... AND sleep 2
|
||||||
|
... AND click button id=interceptionadd-enable-confirm
|
||||||
|
|
||||||
|
Create-ok
|
||||||
|
execute javascript document.documentElement.scrollTop=1000
|
||||||
|
sleep 2
|
||||||
|
click button id=interceptionadd_sub
|
||||||
|
sleep 1
|
||||||
|
execute javascript document.documentElement.scrollTop=0
|
||||||
|
|
||||||
|
Create-cancel
|
||||||
|
click button id=interceptionadd_back
|
||||||
|
|
||||||
|
Create-Conditions-obj
|
||||||
|
[Arguments] ${action} ${protocol} ${objtype} ${objname} ${objtype1}=null
|
||||||
|
run keyword if '${action}'=='allow' and '${protocol}'=='http' run keywords sleep 1
|
||||||
|
... AND click element id=interceptionadd_prochange0
|
||||||
|
... AND Create-Conditions-allow&intercept-http ${objtype} ${objname}
|
||||||
|
... ELSE IF '${action}'=='intercept' and '${protocol}'=='http' run keywords sleep 1
|
||||||
|
... AND click element id=interceptionadd_prochange0
|
||||||
|
... AND Create-Conditions-allow&intercept-http ${objtype} ${objname}
|
||||||
|
... ELSE IF '${action}'=='allow' and '${protocol}'=='ssl' run keywords sleep 1
|
||||||
|
... AND click element id=interceptionadd_prochange1
|
||||||
|
... AND Create-Conditions-allow&intercept-ssl ${objtype} ${objname}
|
||||||
|
... ELSE IF '${action}'=='intercept' and '${protocol}'=='ssl' run keywords sleep 1
|
||||||
|
... AND click element id=interceptionadd_prochange1
|
||||||
|
... AND Create-Conditions-allow&intercept-ssl ${objtype} ${objname}
|
||||||
|
... ELSE IF '${action}'=='deny' and '${protocol}'=='http' run keywords sleep 1
|
||||||
|
... AND click element id=interceptionadd_prochange0
|
||||||
|
... AND Create-Conditions-deny&monitor-http ${objtype} ${objname}
|
||||||
|
... ELSE IF '${action}'=='monitor' and '${protocol}'=='http' run keywords sleep 1
|
||||||
|
... AND click element id=interceptionadd_prochange0
|
||||||
|
... AND Create-Conditions-deny&monitor-http ${objtype} ${objname}
|
||||||
|
... ELSE IF '${action}'=='deny' and '${protocol}'=='ssl' run keywords sleep 1
|
||||||
|
... AND click element id=interceptionadd_prochange1
|
||||||
|
... AND Create-Conditions-deny&monitor-ssl ${objtype1} ${objtype} ${objname}
|
||||||
|
... ELSE IF '${action}'=='monitor' and '${protocol}'=='ssl' run keywords sleep 1
|
||||||
|
... AND click element id=interceptionadd_prochange1
|
||||||
|
... AND Create-Conditions-deny&monitor-ssl ${objtype1} ${objtype} ${objname}
|
||||||
|
... ELSE IF '${action}'=='deny' and '${protocol}'=='dns' run keywords sleep 1
|
||||||
|
... AND click element id=interceptionadd_prochange2
|
||||||
|
... AND Create-Conditions-deny&monitor-dns ${objtype} ${objname}
|
||||||
|
... ELSE IF '${action}'=='monitor' and '${protocol}'=='dns' run keywords sleep 1
|
||||||
|
... AND click element id=interceptionadd_prochange2
|
||||||
|
... AND Create-Conditions-deny&monitor-dns ${objtype} ${objname}
|
||||||
|
... ELSE IF '${action}'=='deny' and '${protocol}'=='mail' run keywords sleep 1
|
||||||
|
... AND click element id=interceptionadd_prochange3
|
||||||
|
... AND Create-Conditions-deny&monitor-mail ${objtype} ${objname}
|
||||||
|
... ELSE IF '${action}'=='monitor' and '${protocol}'=='mail' run keywords sleep 1
|
||||||
|
... AND click element id=interceptionadd_prochange3
|
||||||
|
... AND Create-Conditions-deny&monitor-mail ${objtype} ${objname}
|
||||||
|
... ELSE IF '${action}'=='deny' and '${protocol}'=='ftp' run keywords sleep 1
|
||||||
|
... AND click element id=interceptionadd_prochange4
|
||||||
|
... AND Create-Conditions-deny&monitor-ftp ${objtype} ${objname}
|
||||||
|
... ELSE IF '${action}'=='monitor' and '${protocol}'=='ftp' run keywords sleep 1
|
||||||
|
... AND click element id=interceptionadd_prochange4
|
||||||
|
... AND Create-Conditions-deny&monitor-ftp ${objtype} ${objname}
|
||||||
|
... ELSE log 对象错误
|
||||||
|
|
||||||
|
Create-Conditions-allow&intercept-http
|
||||||
|
[Arguments] ${objtype} ${objname}
|
||||||
|
sleep 2
|
||||||
|
run keyword if '${objtype}'=='Fqdn' run keywords click element xpath=//*[@id="interceptionadd_pro0"]/div[2]
|
||||||
|
... AND sleep 2
|
||||||
|
... ELSE IF '${objtype}'=='Category' run keywords click element xpath=//*[@id="interceptionadd_pro0"]/div[3]
|
||||||
|
... AND sleep 2
|
||||||
|
... ELSE log 对象错误
|
||||||
|
SecurityPolicy.SelectOne ${objname}
|
||||||
|
|
||||||
|
Create-Conditions-allow&intercept-ssl
|
||||||
|
[Arguments] ${objtype} ${objname}
|
||||||
|
sleep 2
|
||||||
|
run keyword if '${objtype}'=='Fqdn' run keywords click element xpath=//*[@id="interceptionadd_pro0"]/div[2]
|
||||||
|
... AND sleep 2
|
||||||
|
... ELSE IF '${objtype}'=='Category' run keywords click element xpath=//*[@id="interceptionadd_pro0"]/div[3]
|
||||||
|
... AND sleep 2
|
||||||
|
... ELSE log 对象错误
|
||||||
|
SecurityPolicy.SelectOne ${objname}
|
||||||
|
|
||||||
|
Create-Conditions-deny&monitor-http
|
||||||
|
[Arguments] ${objtype} ${objname}
|
||||||
|
sleep 2
|
||||||
|
run keyword if '${objtype}'=='Fqdn' run keywords click element xpath=//*[@id="interceptionadd_pro0"]/div[2]
|
||||||
|
... AND sleep 2
|
||||||
|
... ELSE IF '${objtype}'=='Category' run keywords click element xpath=//*[@id="interceptionadd_pro0"]/div[3]
|
||||||
|
... AND sleep 2
|
||||||
|
... ELSE IF '${objtype}'=='Url' run keywords click element id=interceptionadd_pro1
|
||||||
|
... AND sleep 2
|
||||||
|
... ELSE IF '${objtype}'=='Reqhdr' run keywords click element id=interceptionadd_pro2
|
||||||
|
... AND sleep 2
|
||||||
|
... ELSE IF '${objtype}'=='Reshdr' run keywords click element id=interceptionadd_pro3
|
||||||
|
... AND sleep 2
|
||||||
|
... ELSE IF '${objtype}'=='Reqbody' run keywords click element id=interceptionadd_pro4
|
||||||
|
... AND sleep 2
|
||||||
|
... ELSE IF '${objtype}'=='Resbody' run keywords click element id=interceptionadd_pro5
|
||||||
|
... AND sleep 2
|
||||||
|
... ELSE log 对象错误
|
||||||
|
SecurityPolicy.SelectOne ${objname}
|
||||||
|
|
||||||
|
Create-Conditions-deny&monitor-ssl
|
||||||
|
[Arguments] ${objtype1} ${objtype} ${objname}
|
||||||
|
sleep 2
|
||||||
|
run keyword if '${objtype1}'=='sni' and '${objtype}'=='Fqdn' run keywords click element xpath=//*[@id="interceptionadd_pro0"]/div[2]
|
||||||
|
... AND sleep 2
|
||||||
|
... ELSE IF '${objtype1}'=='sni' and '${objtype}'=='Category' run keywords click element xpath=//*[@id="interceptionadd_pro0"]/div[3]
|
||||||
|
... AND sleep 2
|
||||||
|
... ELSE IF ${objtype1}'=='cn' and ${objtype}'=='Fqdn' run keywords click element id=interceptionadd_pro1
|
||||||
|
... AND sleep 2
|
||||||
|
... AND click element xpath=//*[@id="interceptionadd_pro1"]/div[2]
|
||||||
|
... AND sleep 2
|
||||||
|
... ELSE IF ${objtype1}'=='cn' and${objtype}'=='Category' run keywords click element id=interceptionadd_pro1
|
||||||
|
... AND sleep 2
|
||||||
|
... AND click element xpath=//*[@id="interceptionadd_pro1"]/div[3]
|
||||||
|
... AND sleep 2
|
||||||
|
... ELSE IF ${objtype1}'=='san' and ${objtype}'=='Fqdn' run keywords click element id=interceptionadd_pro2
|
||||||
|
... AND sleep 2
|
||||||
|
... AND click element xpath=//*[@id="interceptionadd_pro2"]/div[2]
|
||||||
|
... AND sleep 2
|
||||||
|
... ELSE IF ${objtype1}'=='san' and ${objtype}'=='Category' run keywords click element id=interceptionadd_pro2
|
||||||
|
... AND sleep 2
|
||||||
|
... AND click element xpath=//*[@id="interceptionadd_pro2"]/div[3]
|
||||||
|
... AND sleep 2
|
||||||
|
... ELSE log 对象错误
|
||||||
|
SecurityPolicy.SelectOne ${objname}
|
||||||
|
|
||||||
|
Create-Conditions-deny&monitor-dns
|
||||||
|
[Arguments] ${objtype} ${objname}
|
||||||
|
sleep 2
|
||||||
|
run keyword if '${objtype}'=='Fqdn' run keywords click element xpath=//*[@id="interceptionadd_pro0"]/div[2]
|
||||||
|
... AND sleep 2
|
||||||
|
... ELSE IF '${objtype}'=='Category' run keywords click element xpath=//*[@id="interceptionadd_pro0"]/div[3]
|
||||||
|
... AND sleep 2
|
||||||
|
... ELSE log 对象错误
|
||||||
|
SecurityPolicy.SelectOne ${objname}
|
||||||
|
|
||||||
|
Create-Conditions-deny&monitor-mail
|
||||||
|
[Arguments] ${objtype} ${objname}
|
||||||
|
sleep 2
|
||||||
|
run keyword if '${objtype}'=='Subject' run keywords click element id=interceptionadd_pro0
|
||||||
|
... AND sleep 2
|
||||||
|
... ELSE IF '${objtype}'=='Content' run keywords click element id=interceptionadd_pro1
|
||||||
|
... AND sleep 2
|
||||||
|
... ELSE IF '${objtype}'=='ATT Name' run keywords click element id=interceptionadd_pro2
|
||||||
|
... AND sleep 2
|
||||||
|
... ELSE IF '${objtype}'=='ATT CONT' run keywords click element id=interceptionadd_pro3
|
||||||
|
... AND sleep 2
|
||||||
|
... ELSE IF '${objtype}'=='From' run keywords click element id=interceptionadd_pro4
|
||||||
|
... AND sleep 2
|
||||||
|
... ELSE IF '${objtype}'=='To' run keywords click element id=interceptionadd_pro5
|
||||||
|
... AND sleep 2
|
||||||
|
... ELSE IF '${objtype}'=='Account' run keywords click element id=interceptionadd_pro6
|
||||||
|
... AND sleep 2
|
||||||
|
... ELSE log 对象错误
|
||||||
|
SecurityPolicy.SelectOne ${objname}
|
||||||
|
|
||||||
|
Create-Conditions-deny&monitor-ftp
|
||||||
|
[Arguments] ${objtype} ${objname}
|
||||||
|
sleep 2
|
||||||
|
run keyword if '${objtype}'=='url' run keywords click element id=interceptionadd_pro0
|
||||||
|
... AND sleep 2
|
||||||
|
... ELSE IF '${objtype}'=='content' run keywords click element id=interceptionadd_pro1
|
||||||
|
... AND sleep 2
|
||||||
|
... ELSE IF '${objtype}'=='account' run keywords click element id=interceptionadd_pro2
|
||||||
|
... AND sleep 2
|
||||||
|
... ELSE log 对象错误
|
||||||
|
SecurityPolicy.SelectOne ${objname}
|
||||||
|
|
||||||
|
SelectOne
|
||||||
|
[Arguments] ${objname}
|
||||||
|
sleep 2
|
||||||
|
log ${objname}
|
||||||
|
input text xpath=//*[@id="condistions_protocol"]/div[2]/div[2]/div/div[1]/input ${objname}
|
||||||
|
sleep 1
|
||||||
|
press keys xpath=//*[@id="condistions_protocol"]/div[2]/div[2]/div/div[1]/input ENTER
|
||||||
|
sleep 2
|
||||||
|
click element xpath=//*[@id="interceptionadd_checkouobject"]/ul/li[1]
|
||||||
541
02-Keyword/tsg_ui/Setting/Settings.robot
Normal file
541
02-Keyword/tsg_ui/Setting/Settings.robot
Normal file
@@ -0,0 +1,541 @@
|
|||||||
|
*** Settings ***
|
||||||
|
Library Selenium2Library
|
||||||
|
Library E:/Program Files (x86)/Python37-32/Lib/site-packages/robot/libraries/String.py
|
||||||
|
|
||||||
|
*** Keywords ***
|
||||||
|
click
|
||||||
|
[Arguments] ${element}
|
||||||
|
Click Element ${element}
|
||||||
|
|
||||||
|
input
|
||||||
|
[Arguments] ${element} ${text}
|
||||||
|
Input Text ${element} ${text}
|
||||||
|
|
||||||
|
ui-logout
|
||||||
|
Close Browser
|
||||||
|
|
||||||
|
ui-login
|
||||||
|
Open Browser http://192.168.40.120 Chrome
|
||||||
|
input xpath=//*[@id="app"]/div/div[2]/div/div[2]/div/input lyf
|
||||||
|
input xpath=//*[@id="app"]/div/div[2]/div/div[3]/div/input 111111
|
||||||
|
click xpath=//*[@id="app"]/div/div[2]/div/div[4]/button
|
||||||
|
|
||||||
|
Create-Hijack Files
|
||||||
|
[Arguments] ${name} ${file} ${type}
|
||||||
|
Sleep 1
|
||||||
|
click id=children5 #点击一级目录Settings
|
||||||
|
Sleep 1
|
||||||
|
click id=sidebarProxy_Profiles #点击二级目录Proxy Profiles
|
||||||
|
Sleep 2
|
||||||
|
click id=profilesTabs_Profile_HijackFiles #点击Hijack Files按钮
|
||||||
|
Sleep 1
|
||||||
|
click id=hijackAdd #点击Create
|
||||||
|
Sleep 2
|
||||||
|
input id=hijack_profileName ${name} #输入name
|
||||||
|
Sleep 2
|
||||||
|
Choose File xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div[1]/div[2]/form/div[2]/div/div/div[1]/input ${file} #上传文件
|
||||||
|
Sleep 2
|
||||||
|
click id=hijackAddContentType #点击+ 打开侧滑窗口
|
||||||
|
Sleep 1
|
||||||
|
click ${type} #选择文件类型
|
||||||
|
sleep 2
|
||||||
|
click id=hijackAddOk #点击OK
|
||||||
|
Sleep 2
|
||||||
|
input id=one-input ${name} #搜索输入框输入name
|
||||||
|
Sleep 1
|
||||||
|
click id=select_new_search_btn #点击搜索按钮
|
||||||
|
Sleep 1
|
||||||
|
${text1} Get Text xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr/td[2]/div/span #获取点击后页面文本信息
|
||||||
|
Should Be Equal As Strings ${text1} ${name} #断言
|
||||||
|
|
||||||
|
Create-Insert Scripts
|
||||||
|
[Arguments] ${name} ${file} ${type}
|
||||||
|
Sleep 1
|
||||||
|
click id=children5 #点击一级目录Settings
|
||||||
|
Sleep 1
|
||||||
|
click id=sidebarProxy_Profiles #点击二级目录Proxy Profiles
|
||||||
|
Sleep 2
|
||||||
|
click id=profilesTabs_Profile_Insert #点击Insert Scripts按钮
|
||||||
|
Sleep 1
|
||||||
|
click id=insertAdd #点击Create
|
||||||
|
Sleep 2
|
||||||
|
input id=insert_profileName ${name} #输入name
|
||||||
|
Sleep 2
|
||||||
|
Choose File xpath=//*[@id="insertAddUpload"]/div[1]/input ${file} #上传文件
|
||||||
|
Sleep 2
|
||||||
|
click id=insert_select_format #点击下拉框按钮
|
||||||
|
Sleep 1
|
||||||
|
click ${type} #选择css
|
||||||
|
sleep 1
|
||||||
|
click xpath=//*[@id="policy_Manipulation_create8"]/div[2]/form/div[5]/div/div/button[1] #点击OK
|
||||||
|
Sleep 1
|
||||||
|
input xpath=//*[@id="one-input"] ${name} #搜索输入框输入name
|
||||||
|
Sleep 1
|
||||||
|
click xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div[1]/div[2]/div[2]/i #点击搜索按钮
|
||||||
|
Sleep 1
|
||||||
|
${text1} Get Text xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div[2]/div/div[3]/table/tbody/tr[1]/td[2]/div/div/span #获取点击后页面文本信息
|
||||||
|
Should Be Equal As Strings ${text1} ${name} #断言
|
||||||
|
ui-logout
|
||||||
|
|
||||||
|
Create-Traffic Mirror Profiles
|
||||||
|
[Arguments] ${name} ${type} ${shuru}
|
||||||
|
Sleep 1
|
||||||
|
click id=children5 #点击一级目录Settings
|
||||||
|
Sleep 1
|
||||||
|
click id=sidebarProxy_Profiles #点击二级目录Proxy Profiles
|
||||||
|
Sleep 2
|
||||||
|
click id=profilesTabs_Profile_TrafficMirrorProfiles #点击Traffic Mirror Profiles按钮
|
||||||
|
Sleep 1
|
||||||
|
click id=trafficMirrorAdd #点击Create
|
||||||
|
Sleep 2
|
||||||
|
input id=trafficmirror_profileName ${name} #输入name
|
||||||
|
Sleep 2
|
||||||
|
click xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div/div[2]/form/div[2]/div/div/div[1]/span/span/i #点击下拉框
|
||||||
|
Sleep 2
|
||||||
|
click ${type} #选择vlan或者mac
|
||||||
|
Sleep 1
|
||||||
|
input id=trafficmirror_addrArray0 ${shuru}
|
||||||
|
sleep 2
|
||||||
|
click xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div/div[2]/form/div[5]/div/div/button[1] #点击OK
|
||||||
|
Sleep 2
|
||||||
|
input id=one-input ${name} #搜索输入框输入name
|
||||||
|
Sleep 1
|
||||||
|
click id=select_new_search_btn #点击搜索按钮
|
||||||
|
Sleep 1
|
||||||
|
${text1} Get Text xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div[2]/div/div[3]/table/tbody/tr/td[2]/div/div/span #获取点击后页面文本信息
|
||||||
|
Should Be Equal As Strings ${text1} ${name} #断言
|
||||||
|
ui-logout
|
||||||
|
|
||||||
|
Edit-Insert Scripts
|
||||||
|
[Arguments] ${id-name} ${name} ${name1} ${file} ${type}
|
||||||
|
[Documentation] 引用关键字,填入必填参数
|
||||||
|
... 必填参数:
|
||||||
|
... ${id-name}:为选择要查询的类型是ID或者Name的元素
|
||||||
|
... ${name}:为查询输入框输入内容
|
||||||
|
... ${name1}:为修改页面的name输入框里输入的内容
|
||||||
|
... ${file}:为修改页面要上传文件的路径
|
||||||
|
... ${type}:选择文件类型的元素
|
||||||
|
Sleep 1
|
||||||
|
click xpath=//*[@id="app"]/div/div[2]/ul/li[6]/div #点击一级目录Settings
|
||||||
|
Sleep 1
|
||||||
|
click id=sidebarProxy_Profiles #点击二级目录Proxy Profiles
|
||||||
|
Sleep 2
|
||||||
|
click id=profilesTabs_Profile_Insert #点击Insert files按钮
|
||||||
|
sleep 1
|
||||||
|
click id=one-input #搜索点击输入框
|
||||||
|
sleep 1
|
||||||
|
click ${id-name} #选择ID或者name
|
||||||
|
sleep 1
|
||||||
|
input id=sreach_input ${name} #输入搜索内容
|
||||||
|
sleep 1
|
||||||
|
click xpath=//*[@id="select_new_search_btn"] #点击搜索按钮
|
||||||
|
sleep 1
|
||||||
|
click xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div[2]/div/div[3]/table/tbody/tr[1] #点击搜素到的列表
|
||||||
|
sleep 1
|
||||||
|
click id=insertEdit #点击Edit
|
||||||
|
sleep 1
|
||||||
|
Clear Element Text id=insert_profileName #清空输入框
|
||||||
|
sleep 1
|
||||||
|
input id=insert_profileName ${name1} #输入框输入
|
||||||
|
sleep 1
|
||||||
|
Choose File xpath=//*[@id="insertAddUpload"]/div[1]/input ${file} #上传文件
|
||||||
|
sleep 1
|
||||||
|
click id=insert_select_format #点击下拉框
|
||||||
|
sleep 1
|
||||||
|
click ${type} #选择文件类型
|
||||||
|
sleep 1
|
||||||
|
click xpath=//*[@id="policy_Manipulation_create8"]/div[2]/form/div[8]/div/div/button[1] #点击ok提交
|
||||||
|
|
||||||
|
Create-Response Pages
|
||||||
|
[Arguments] ${name} ${file}
|
||||||
|
[Documentation] 引用次关键字,填入必填参数
|
||||||
|
... 必填参数:
|
||||||
|
... ${name}:新建页面name输入框里的内容
|
||||||
|
... ${file}:上传文件所在本地的路径
|
||||||
|
#打开浏览器
|
||||||
|
#ui-login lyf 111111
|
||||||
|
Sleep 1
|
||||||
|
click id=children5 #点击一级目录Settings
|
||||||
|
Sleep 1
|
||||||
|
click id=sidebarProxy_Profiles #点击二级目录Proxy Profiles
|
||||||
|
Sleep 2
|
||||||
|
click id=respinseAdd #Response Pages点击Create
|
||||||
|
Sleep 2
|
||||||
|
input id=responsepages_profileName ${name} #输入name
|
||||||
|
Sleep 2
|
||||||
|
Choose File xpath=//*[@id="policy_Manipulation_create6"]/div[2]/form/div[2]/div/div/div/input ${file} #上传文件
|
||||||
|
Sleep 2
|
||||||
|
click xpath=//*[@id="policy_Manipulation_create6"]/div[2]/form/div[4]/div/div/button[1] #点击OK缇交
|
||||||
|
Sleep 1
|
||||||
|
input xpath=//*[@id="one-input"] ${name} #搜索框输入
|
||||||
|
Sleep 1
|
||||||
|
click xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div[1]/div[1]/div[2]/i #点击搜索按钮
|
||||||
|
Sleep 1
|
||||||
|
${text1} Get Text xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr/td[2]/div/div/span #获取点击后页面文本信息
|
||||||
|
Should Be Equal As Strings ${text1} ${name} #断言
|
||||||
|
#ui-logout
|
||||||
|
|
||||||
|
Edit-Response Pages
|
||||||
|
[Arguments] ${id-name} ${name} ${name1} ${file}
|
||||||
|
[Documentation] 引用关键字,填入必填参数
|
||||||
|
... 必填参数:
|
||||||
|
... ${id-name}:为选择要查询的类型是ID或者Name的元素
|
||||||
|
... ${name}:为查询输入框输入内容
|
||||||
|
... ${name1}:为修改页面的name输入框里输入的内容
|
||||||
|
... ${file}:为修改页面要上传文件的路径
|
||||||
|
Sleep 1
|
||||||
|
click xpath=//*[@id="app"]/div/div[2]/ul/li[6]/div #点击一级目录Settings
|
||||||
|
Sleep 1
|
||||||
|
click id=sidebarProxy_Profiles #点击二级目录Proxy Profiles
|
||||||
|
Sleep 2
|
||||||
|
click id=one-input #搜索点击输入框
|
||||||
|
sleep 1
|
||||||
|
click ${id-name} #选择ID或者name
|
||||||
|
sleep 1
|
||||||
|
input id=sreach_input ${name}
|
||||||
|
sleep 1
|
||||||
|
click xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr[1] #点击搜素到的列表
|
||||||
|
sleep 1
|
||||||
|
click id=resinseEdit #点击Edit
|
||||||
|
sleep 1
|
||||||
|
Clear Element Text id=responsepages_profileName #清空name输入框
|
||||||
|
sleep 1
|
||||||
|
input id=responsepages_profileName ${name1}
|
||||||
|
sleep 1
|
||||||
|
Choose File xpath=//*[@id="policy_Manipulation_create6"]/div[2]/form/div[5]/div/div/div/input ${file}
|
||||||
|
sleep 1
|
||||||
|
click xpath=//*[@id="policy_Manipulation_create6"]/div[2]/form/div[7]/div/div/button[1]
|
||||||
|
|
||||||
|
Edit-Hijack Files
|
||||||
|
[Arguments] ${id-name} ${name} ${name1} ${file} ${type}
|
||||||
|
[Documentation] 引用关键字,填入必填参数
|
||||||
|
... 必填参数:
|
||||||
|
... ${id-name}:为选择要查询的类型是ID或者Name的元素
|
||||||
|
... ${name}:为查询输入框输入内容
|
||||||
|
... ${name1}:为修改页面的name输入框里输入的内容
|
||||||
|
... ${file}:为修改页面要上传文件的路径
|
||||||
|
... ${type}:为文件类型的元素
|
||||||
|
Sleep 1
|
||||||
|
click xpath=//*[@id="app"]/div/div[2]/ul/li[6]/div #点击一级目录Settings
|
||||||
|
Sleep 1
|
||||||
|
click id=sidebarProxy_Profiles #点击二级目录Proxy Profiles
|
||||||
|
Sleep 2
|
||||||
|
click id=profilesTabs_Profile_HijackFiles #点击Hijack files按钮
|
||||||
|
sleep 1
|
||||||
|
click id=one-input #搜索点击输入框
|
||||||
|
sleep 1
|
||||||
|
click ${id-name} #选择ID或者name
|
||||||
|
sleep 1
|
||||||
|
input id=sreach_input ${name} #输入搜索内容
|
||||||
|
sleep 1
|
||||||
|
click xpath=//*[@id="select_new_search_btn"] #点击搜索按钮
|
||||||
|
sleep 1
|
||||||
|
click xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr[1] #点击搜素到的列表
|
||||||
|
sleep 1
|
||||||
|
click id=hijackEdit #点击Edit
|
||||||
|
sleep 1
|
||||||
|
Clear Element Text id=hijack_profileName #清空输入框
|
||||||
|
sleep 1
|
||||||
|
input id=hijack_profileName ${name1} #输入框输入
|
||||||
|
sleep 1
|
||||||
|
Choose File xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div[1]/div[2]/form/div[5]/div/div/div[1]/input ${file} #上传文件
|
||||||
|
sleep 1
|
||||||
|
click id=hijackAddContentType #点击+号打开侧滑框
|
||||||
|
sleep 3
|
||||||
|
click ${type} #选择类型
|
||||||
|
sleep 1
|
||||||
|
click xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div[2]/div/div[2]/button #关闭侧滑框
|
||||||
|
sleep 1
|
||||||
|
click id=hijackAddOk #点击ok提交
|
||||||
|
|
||||||
|
Edit-Traffic Mirror Profiles
|
||||||
|
[Arguments] ${id-name} ${name} ${name1} ${type} ${shuju}
|
||||||
|
[Documentation] 引用关键字,填入必填参数
|
||||||
|
... 必填参数:
|
||||||
|
... ${id-name}:为选择要查询的类型是ID或者Name的元素
|
||||||
|
... ${name}:为查询输入框输入内容
|
||||||
|
... ${name1}:为修改页面的name输入框里输入的内容
|
||||||
|
... ${type}:为选择点击vlan或mac的元素
|
||||||
|
... ${shuju}:为输入框输入内容
|
||||||
|
Sleep 1
|
||||||
|
click xpath=//*[@id="app"]/div/div[2]/ul/li[6]/div #点击一级目录Settings
|
||||||
|
Sleep 1
|
||||||
|
click id=sidebarProxy_Profiles #点击二级目录Proxy Profiles
|
||||||
|
Sleep 2
|
||||||
|
click id=profilesTabs_Profile_TrafficMirrorProfiles #点击Traffic Mirror Profiles按钮
|
||||||
|
sleep 1
|
||||||
|
click id=one-input #搜索点击输入框
|
||||||
|
sleep 1
|
||||||
|
click ${id-name} #选择ID或者name
|
||||||
|
sleep 1
|
||||||
|
input id=sreach_input ${name} #输入搜索内容
|
||||||
|
sleep 1
|
||||||
|
click xpath=//*[@id="select_new_search_btn"] #点击搜索按钮
|
||||||
|
sleep 1
|
||||||
|
click xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div[2]/div/div[3]/table/tbody/tr[1] #点击搜素到的列表
|
||||||
|
sleep 1
|
||||||
|
click id=trafficMirrorEdit #点击Edit
|
||||||
|
sleep 1
|
||||||
|
Clear Element Text id=trafficmirror_profileName #清空输入框
|
||||||
|
sleep 1
|
||||||
|
input id=trafficmirror_profileName ${name1} #输入框输入
|
||||||
|
sleep 1
|
||||||
|
click xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div/div[2]/form/div[5]/div/div/div[1]/input #点击下拉框
|
||||||
|
sleep 1
|
||||||
|
click ${type} #选择vlan或者mac
|
||||||
|
sleep 1
|
||||||
|
Clear Element Text id=trafficmirror_addrArray0 #清空输入框
|
||||||
|
sleep 1
|
||||||
|
input id=trafficmirror_addrArray0 ${shuju} #输入内容
|
||||||
|
sleep 1
|
||||||
|
click xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div/div[2]/form/div[8]/div/div/button[1] #点击ok
|
||||||
|
|
||||||
|
import-Trusted Certificate Authorities
|
||||||
|
[Arguments] ${name} ${file}
|
||||||
|
[Documentation] 引用次关键字,填入必填参数
|
||||||
|
... 必填参数:
|
||||||
|
... ${name}:新建页面name输入框里的内容
|
||||||
|
... ${file}:上传文件所在本地的路径
|
||||||
|
#打开浏览器
|
||||||
|
#ui-login lyf 111111
|
||||||
|
Sleep 1
|
||||||
|
click id=children5 #点击一级目录Settings
|
||||||
|
Sleep 1
|
||||||
|
click id=sidebarProxy_CertificateManagement #点击二级目录Trusted Certificate Authorities
|
||||||
|
Sleep 2
|
||||||
|
click id=Authorities_create #点击Import
|
||||||
|
Sleep 2
|
||||||
|
input id=authoritiesAdd_name ${name} #输入name
|
||||||
|
Sleep 2
|
||||||
|
Choose File xpath=//*[@id="upload_dome"]/div/input ${file} #上传文件
|
||||||
|
Sleep 2
|
||||||
|
click id=authoritiesAdd_sub #点击OK缇交
|
||||||
|
Sleep 1
|
||||||
|
input xpath=//*[@id="one-input"] ${name} #搜索框输入
|
||||||
|
Sleep 1
|
||||||
|
click id=select_new_search_btn #点击搜索按钮
|
||||||
|
Sleep 1
|
||||||
|
${text1} Get Text xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr/td[2]/div/div/div/p/span #获取点击后页面文本信息
|
||||||
|
Should Be Equal As Strings ${text1} ${name} #断言
|
||||||
|
#ui-logout
|
||||||
|
|
||||||
|
Create-Decryption Keyrings
|
||||||
|
[Arguments] ${name} ${file} ${file1} ${1or2} ${type} ${type1}
|
||||||
|
[Documentation] 引用次关键字,填入必填参数
|
||||||
|
... 必填参数:
|
||||||
|
... ${name}:新建页面name输入框里的内容
|
||||||
|
... ${file}:上传文件所在本地的路径
|
||||||
|
... ${file1}:上传文件所在本地的路径
|
||||||
|
... ${1or2}:填入1 或者其他
|
||||||
|
... ${type}:上传证书类型的元素
|
||||||
|
... ${type1}:上传证书加密解密算法的元素
|
||||||
|
#打开浏览器
|
||||||
|
#ui-login lyf 111111
|
||||||
|
Sleep 1
|
||||||
|
click id=children5 #点击一级目录Settings
|
||||||
|
Sleep 1
|
||||||
|
click id=sidebarProxy_CertificateManagement #点击二级目录Trusted Certificate Authorities
|
||||||
|
Sleep 2
|
||||||
|
click xpath=//*[@id="proxyTabs"]/div/ul/li[2] #点击Decryption Keyrings
|
||||||
|
sleep 1
|
||||||
|
click id=Keyrings_create #点击Create
|
||||||
|
Sleep 2
|
||||||
|
input id=keyringsadd_name ${name} #输入name
|
||||||
|
Sleep 2
|
||||||
|
Choose File xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div/div[2]/form/div[2]/div/div/div/input ${file} #上传文件
|
||||||
|
Sleep 2
|
||||||
|
Choose File xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div/div[2]/form/div[4]/div/div/div/input ${file1} #上传文件
|
||||||
|
${select} Set Variable ${1or2}
|
||||||
|
Run Keyword If '${select}'=='1' click id=keyringsadd_customized
|
||||||
|
Run Keyword If '${select}'=='1' input id=reissueExpiryDate 10
|
||||||
|
sleep 1
|
||||||
|
click xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div/div[2]/form/div[7]/div/div/div[1] #点击下拉框
|
||||||
|
sleep 1
|
||||||
|
click ${type} #选择证书类型
|
||||||
|
sleep 1
|
||||||
|
click xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div/div[2]/form/div[8]/div/div/div[1] #点击下拉框
|
||||||
|
sleep 1
|
||||||
|
click ${type1} #选择加密解密类型
|
||||||
|
sleep 1
|
||||||
|
click id=keyringsadd_sub #点击OK缇交
|
||||||
|
Sleep 1
|
||||||
|
input xpath=//*[@id="one-input"] ${name} #搜索框输入
|
||||||
|
Sleep 1
|
||||||
|
click id=select_new_search_btn #点击搜索按钮
|
||||||
|
Sleep 1
|
||||||
|
${text1} Get Text xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr/td[2]/div/div/div/p/span #获取点击后页面文本信息
|
||||||
|
Should Be Equal As Strings ${text1} ${name} #断言
|
||||||
|
#ui-logout
|
||||||
|
|
||||||
|
Create-SSL Decryption Exclusion
|
||||||
|
[Arguments] ${name} ${value} ${name1}
|
||||||
|
[Documentation] 引用次关键字,填入必填参数
|
||||||
|
... 必填参数:
|
||||||
|
... ${name}:新建页面name输入框里的内容
|
||||||
|
... ${value}:输入内容
|
||||||
|
... ${naem1}:搜索框填入内容
|
||||||
|
Sleep 1
|
||||||
|
click id=children5 #点击一级目录Settings
|
||||||
|
Sleep 1
|
||||||
|
click id=sidebarProxy_CertificateManagement #点击二级目录Trusted Certificate Authorities
|
||||||
|
Sleep 2
|
||||||
|
click xpath=//*[@id="proxyTabs"]/div/ul/li[3] #点击SSL Decryption Exclusion按钮
|
||||||
|
sleep 1
|
||||||
|
click id=ssl_create #点击Create
|
||||||
|
Sleep 2
|
||||||
|
input id=sslAdd_name ${name} #输入name
|
||||||
|
Sleep 2
|
||||||
|
input id=sslAdd_itemDesc ${value} #输入内容
|
||||||
|
Sleep 2
|
||||||
|
click id=ssl_ok #点击OK缇交
|
||||||
|
Sleep 1
|
||||||
|
input xpath=//*[@id="one-input"] ${name1} #搜索框输入
|
||||||
|
Sleep 1
|
||||||
|
click id=select_new_search_btn #点击搜索按钮
|
||||||
|
Sleep 1
|
||||||
|
${text1} Get Text xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr/td[2]/div/div/div/p/span #获取点击后页面文本信息
|
||||||
|
Should Be Equal As Strings ${text1} ${name} #断言
|
||||||
|
|
||||||
|
Search-Cached Intermediate Certificates
|
||||||
|
[Arguments] ${type} ${id-sni} ${enabled}
|
||||||
|
[Documentation] 引用关键字,填入必填参数
|
||||||
|
... ${type}:为搜索类型的元素(id或sni)
|
||||||
|
... ${enabled}:为enabled开启或关闭按钮的元素
|
||||||
|
Sleep 1
|
||||||
|
click id=children5 #点击一级目录Settings
|
||||||
|
Sleep 1
|
||||||
|
click id=sidebarProxy_CertificateManagement #点击二级目录Trusted Certificate Authorities
|
||||||
|
Sleep 2
|
||||||
|
click xpath=//*[@id="proxyTabs"]/div/ul/li[4] #点击Cached Intermediate Certificates按钮
|
||||||
|
Sleep 1
|
||||||
|
click id=one-input #点击搜索框
|
||||||
|
Sleep 1
|
||||||
|
click ${type}
|
||||||
|
Sleep 1
|
||||||
|
input id=sreach_input ${id-sni}
|
||||||
|
click id=select_new_search_btn #点击搜索按钮
|
||||||
|
Sleep 1
|
||||||
|
click xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr/td[8]/div/div/div/p/a/i #点击下载
|
||||||
|
Sleep 10
|
||||||
|
click ${enabled} #点击enabled按钮
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
Edit-Trusted Certificate Authorities
|
||||||
|
[Arguments] ${id-name} ${value} ${name} ${file}
|
||||||
|
[Documentation] 引用关键字,填入必填参数
|
||||||
|
... 必填参数:
|
||||||
|
... ${id-name}:为选择要查询的类型是ID或者Name的元素
|
||||||
|
... ${value}:为查询输入框输入内容
|
||||||
|
... ${name}:为修改页面的name输入框里输入的内容
|
||||||
|
... ${file}:为修改页面要上传文件的路径
|
||||||
|
Sleep 1
|
||||||
|
click id=children5 #点击一级目录Settings
|
||||||
|
Sleep 1
|
||||||
|
click id=sidebarProxy_CertificateManagement #点击二级目录Trusted Certificate Authorities
|
||||||
|
Sleep 2
|
||||||
|
click id=one-input #点击搜索框
|
||||||
|
sleep 1
|
||||||
|
click ${id-name} #选择搜索类型
|
||||||
|
sleep 1
|
||||||
|
input id=sreach_input ${value} #输入内容
|
||||||
|
sleep 1
|
||||||
|
click id=select_new_search_btn #点击搜索按钮
|
||||||
|
sleep 1
|
||||||
|
click xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr #点击搜索列表
|
||||||
|
sleep 1
|
||||||
|
click id=Authorities_edit #点击Edit按钮
|
||||||
|
sleep 1
|
||||||
|
Clear Element Text id=authoritiesAdd_name #清空name输入框
|
||||||
|
sleep 1
|
||||||
|
input id=authoritiesAdd_name ${name} #输入name
|
||||||
|
sleep 1
|
||||||
|
Choose File xpath=//*[@id="upload_dome"]/div/input ${file} #上传文件
|
||||||
|
sleep 1
|
||||||
|
click id=authoritiesAdd_sub #点击ok
|
||||||
|
|
||||||
|
Edit-Decryption Keyrings
|
||||||
|
[Arguments] ${id-name} ${value} ${name} ${file} ${file1} ${1or2}
|
||||||
|
... ${type} ${type1}
|
||||||
|
[Documentation] 引用次关键字,填入必填参数
|
||||||
|
... 必填参数:
|
||||||
|
... ${id-name}:为选择要查询的类型是ID或者Name的元素
|
||||||
|
... ${value}:为查询输入框输入内容
|
||||||
|
... ${name}:新建页面name输入框里的内容
|
||||||
|
... ${file}:上传文件所在本地的路径
|
||||||
|
... ${file1}:上传文件所在本地的路径
|
||||||
|
... ${1or2}:填入1 或者其他
|
||||||
|
... ${type}:上传证书类型的元素
|
||||||
|
... ${type1}:上传证书加密解密算法的元素
|
||||||
|
Sleep 1
|
||||||
|
click id=children5 #点击一级目录Settings
|
||||||
|
Sleep 1
|
||||||
|
click id=sidebarProxy_CertificateManagement #点击二级目录Trusted Certificate Authorities
|
||||||
|
Sleep 2
|
||||||
|
click xpath=//*[@id="proxyTabs"]/div/ul/li[2] #点击Decryption Keyrings
|
||||||
|
sleep 1
|
||||||
|
click id=one-input #点击搜索框
|
||||||
|
sleep 1
|
||||||
|
click ${id-name} #选择搜索类型
|
||||||
|
sleep 1
|
||||||
|
input id=sreach_input ${value} #输入内容
|
||||||
|
sleep 1
|
||||||
|
click id=select_new_search_btn #点击搜索按钮
|
||||||
|
sleep 1
|
||||||
|
click xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr #点击搜索列表
|
||||||
|
sleep 1
|
||||||
|
click id=Keyrings_edit #点击Edit按钮
|
||||||
|
sleep 1
|
||||||
|
Clear Element Text id=keyringsadd_name #清空name输入框
|
||||||
|
sleep 1
|
||||||
|
input id=keyringsadd_name ${name} #输入name
|
||||||
|
sleep 1
|
||||||
|
Choose File xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div/div[2]/form/div[5]/div/div/div/input ${file} #上传文件
|
||||||
|
Sleep 2
|
||||||
|
Choose File xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div/div[2]/form/div[7]/div/div/div/input ${file1} #上传文件
|
||||||
|
${select} Set Variable ${1or2}
|
||||||
|
Run Keyword If '${select}'=='1' click id=keyringsadd_customized
|
||||||
|
Run Keyword If '${select}'=='1' input id=reissueExpiryDate 10
|
||||||
|
sleep 1
|
||||||
|
click xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div/div[2]/form/div[10]/div/div/div[1] #点击下拉框
|
||||||
|
sleep 1
|
||||||
|
click ${type} #选择证书类型
|
||||||
|
sleep 1
|
||||||
|
click xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div/div[2]/form/div[11]/div/div/div[1] #点击下拉框
|
||||||
|
sleep 1
|
||||||
|
click ${type1} #选择加密解密类型
|
||||||
|
sleep 1
|
||||||
|
click id=keyringsadd_sub #点击OK缇交
|
||||||
|
|
||||||
|
Edit-SSL Decryption Exclusion
|
||||||
|
[Arguments] ${id-name} ${value} ${name} ${value1}
|
||||||
|
[Documentation] 引用关键字,填入必填参数
|
||||||
|
... ${id-name}:id或者name的元素
|
||||||
|
... ${value}:输入搜索的内容
|
||||||
|
... ${name}:输入name
|
||||||
|
... ${calue1}:输入内容
|
||||||
|
Sleep 1
|
||||||
|
click id=children5 #点击一级目录Settings
|
||||||
|
Sleep 1
|
||||||
|
click id=sidebarProxy_CertificateManagement #点击二级目录Trusted Certificate Authorities
|
||||||
|
Sleep 2
|
||||||
|
click xpath=//*[@id="proxyTabs"]/div/ul/li[3] #点击SSL Decryption Exclusion按钮
|
||||||
|
sleep 1
|
||||||
|
click id=one-input #点击搜索框
|
||||||
|
sleep 1
|
||||||
|
click ${id-name} #选择搜索类型
|
||||||
|
sleep 1
|
||||||
|
input id=sreach_input ${value} #输入内容
|
||||||
|
sleep 1
|
||||||
|
click id=select_new_search_btn #点击搜索按钮
|
||||||
|
sleep 1
|
||||||
|
click xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr #点击搜索列表
|
||||||
|
Sleep 1
|
||||||
|
click id=ssl_edit #点击Edit
|
||||||
|
Sleep 1
|
||||||
|
Clear Element Text id=sslAdd_name #清空name输入框
|
||||||
|
sleep 1
|
||||||
|
input id=sslAdd_name ${name} #输入name
|
||||||
|
sleep 1
|
||||||
|
input id=sslAdd_itemDesc ${value1} #输入内容
|
||||||
|
Sleep 2
|
||||||
|
click id=ssl_ok #点击OK缇交
|
||||||
120
02-Keyword/tsg_ui/Tag/Tags.robot
Normal file
120
02-Keyword/tsg_ui/Tag/Tags.robot
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
*** Settings ***
|
||||||
|
Library Selenium2Library
|
||||||
|
|
||||||
|
*** Keywords ***
|
||||||
|
ui-tags-create
|
||||||
|
[Arguments] ${tag-name} ${color-element} ${tag-value}
|
||||||
|
[Documentation] 引用关键字,填入必填参数:
|
||||||
|
... ${tag-name}:输入tag 的name
|
||||||
|
... ${color-element}:选择tag字体的颜色
|
||||||
|
... ${tag-value}:输入tag内容
|
||||||
|
click element id=tagAdd #点击create按钮,新建tag
|
||||||
|
sleep 2
|
||||||
|
input text id=tagsAdd_name ${tag-name} #输入tag name
|
||||||
|
sleep 1
|
||||||
|
click element id=tagsAdd_color #点击color
|
||||||
|
sleep 2
|
||||||
|
click element ${color-element} #选择tag字体颜色
|
||||||
|
sleep 2
|
||||||
|
input text id=tag_tagName0 ${tag-value} #输入tag内容
|
||||||
|
sleep 1
|
||||||
|
click element id=tagAddOk1
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
ui-tags-create-1
|
||||||
|
[Arguments] ${tag-name} ${color-element} ${tag-value} ${tag-value1}
|
||||||
|
[Documentation] 引用关键字,填入必填参数:
|
||||||
|
... ${tag-name}:输入tag 的name
|
||||||
|
... ${color-element}:选择tag字体的颜色
|
||||||
|
... ${tag-value}:输入tag内容
|
||||||
|
... ${tag-value1}:输入tag内容
|
||||||
|
click element id=tagAdd #点击create按钮,新建tag
|
||||||
|
sleep 2
|
||||||
|
input text id=tagsAdd_name ${tag-name} #输入tag name
|
||||||
|
sleep 1
|
||||||
|
click element id=tagsAdd_color #点击color
|
||||||
|
sleep 2
|
||||||
|
click element ${color-element} #选择tag字体颜色
|
||||||
|
sleep 1
|
||||||
|
input text id=tag_tagName0 ${tag-value} #输入tag内容
|
||||||
|
sleep 1
|
||||||
|
click element id=tagAddInput
|
||||||
|
input text id=tag_tagName1 ${tag-value1} #输入tag内容
|
||||||
|
sleep 1
|
||||||
|
click element id=tagAddOk1
|
||||||
|
|
||||||
|
ui-tags-edit
|
||||||
|
[Arguments] ${tag-name} ${color-element} ${tag-value}
|
||||||
|
[Documentation] 引用关键字,填入必填参数:
|
||||||
|
... ${tag-name}:输入tag 的name
|
||||||
|
... ${color-element}:选择tag字体的颜色
|
||||||
|
... ${tag-value}:输入tag内容
|
||||||
|
sleep 1
|
||||||
|
click element id=tagEdit #点击edit按钮
|
||||||
|
sleep 2
|
||||||
|
input text id=tagsAdd_name ${tag-name} #输入tag name
|
||||||
|
sleep 2
|
||||||
|
click element id=tagsAdd_color #点击color
|
||||||
|
sleep 1
|
||||||
|
click element ${color-element} #选择tag字体颜色
|
||||||
|
sleep 1
|
||||||
|
input text id=tag_tagName0 ${tag-value} #输入tag内容
|
||||||
|
sleep 1
|
||||||
|
click element id=tagAddOk1
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
ui-tags-search-id
|
||||||
|
[Arguments] ${id}
|
||||||
|
sleep 1
|
||||||
|
click element id=one-input
|
||||||
|
sleep 1
|
||||||
|
click element id=input_list_li1
|
||||||
|
sleep 1
|
||||||
|
input text id=sreach_input ${id}
|
||||||
|
sleep 1
|
||||||
|
click element id=select_new_search_btn
|
||||||
|
sleep 1
|
||||||
|
click element xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table
|
||||||
|
|
||||||
|
ui-tags-search-name
|
||||||
|
[Arguments] ${name}
|
||||||
|
sleep 1
|
||||||
|
click element id=one-input
|
||||||
|
sleep 1
|
||||||
|
click element id=input_list_li2
|
||||||
|
sleep 1
|
||||||
|
input text id=sreach_input ${name}
|
||||||
|
sleep 1
|
||||||
|
click element id=select_new_search_btn
|
||||||
|
sleep 1
|
||||||
|
click element xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table
|
||||||
|
|
||||||
|
ui-tags-delete
|
||||||
|
sleep 1
|
||||||
|
click element id=tagDel #点击删除按钮
|
||||||
|
sleep 1
|
||||||
|
click element id=tags-tagsDel-confirm
|
||||||
|
|
||||||
|
ui-tags-edit-1
|
||||||
|
[Arguments] ${tag-name} ${color-element} ${tag-value} ${tag-value1}
|
||||||
|
[Documentation] 引用关键字,填入必填参数:
|
||||||
|
... ${tag-name}:输入tag 的name
|
||||||
|
... ${color-element}:选择tag字体的颜色
|
||||||
|
... ${tag-value}:输入tag内容
|
||||||
|
... ${tag-value1}:输入tag内容
|
||||||
|
sleep 1
|
||||||
|
click element id=tagEdit #点击edit按钮
|
||||||
|
sleep 2
|
||||||
|
input text id=tagsAdd_name ${tag-name} #输入tag name
|
||||||
|
sleep 1
|
||||||
|
click element id=tagsAdd_color #点击color
|
||||||
|
sleep 1
|
||||||
|
click element ${color-element} #选择tag字体颜色
|
||||||
|
sleep 2
|
||||||
|
input text id=tag_tagName0 ${tag-value} #输入tag内容
|
||||||
|
sleep 1
|
||||||
|
sleep 1
|
||||||
|
click element id=tagAddInput
|
||||||
|
input text id=tag_tagName1 ${tag-value1} #输入tag内容
|
||||||
|
click element id=tagAddOk1
|
||||||
|
sleep 1
|
||||||
1
03-Variable/AllFlowCaseVariable.txt
Normal file
1
03-Variable/AllFlowCaseVariable.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
*** Variables ***
|
||||||
45
03-Variable/BifangApiVariable.txt
Normal file
45
03-Variable/BifangApiVariable.txt
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
*** Variables ***
|
||||||
|
#ui登陆还是api登陆
|
||||||
|
${loginType} api
|
||||||
|
#API配置信息
|
||||||
|
${host} 192.168.40.120
|
||||||
|
${port} 8080
|
||||||
|
${authmode} 1
|
||||||
|
${authCode} ${EMPTY}
|
||||||
|
${ldapId} 27
|
||||||
|
${version} v1
|
||||||
|
${username} uitest
|
||||||
|
${password} 111111
|
||||||
|
${encodePassword} ${EMPTY}
|
||||||
|
${token} ${EMPTY}
|
||||||
|
#[Documentation] 测试终端IP统一配置
|
||||||
|
${testClentIP} 192.168.50.43
|
||||||
|
#自动化标签
|
||||||
|
${userTagIds} ${EMPTY}
|
||||||
|
#Documentation] 是否添加测试终端IP到策略统一配置,0为不添加测试终端IP,1为添加测试终端IP,默认1
|
||||||
|
${addTestClentIPFlag} 1
|
||||||
|
#执行需要暂停时间
|
||||||
|
#策略下发后到验证需等待时间
|
||||||
|
${policyVerificationSleepSeconds} 20
|
||||||
|
#策略验证后到验证策略日志需等待时间
|
||||||
|
${policyLogVerificationSleepSeconds} 50
|
||||||
|
${path} E:/auto_git/tsg_autotest
|
||||||
|
${curlbatpath} ${path}/05-Other/curl
|
||||||
|
${mailpath} ${path}/05-Other/mail
|
||||||
|
#全流程分阶段测试参数
|
||||||
|
#[Documentation] 当前测试部分,all为一个终端全网全流程测试,
|
||||||
|
#1为添加策略和对象测试;
|
||||||
|
#2为功能端业务验证部分测试;
|
||||||
|
#3为llog日志验证测试
|
||||||
|
${testPart} all
|
||||||
|
#UI配置的本地IP名称
|
||||||
|
${LocahIPName} ${EMPTY}
|
||||||
|
${ipType} ipv4
|
||||||
|
${ipMask} 255.255.255.255
|
||||||
|
${browserType} chrome
|
||||||
|
# Cli自动化测试变量[start]
|
||||||
|
${cliHost} 192.168.40.165
|
||||||
|
${cliUsername} tsgadmin
|
||||||
|
${cliPassword} Cli2019
|
||||||
|
${timeout} 600s
|
||||||
|
# Cli自动化测试变量[end]
|
||||||
40
04-CustomLibrary/Custometest/MD5.py
Normal file
40
04-CustomLibrary/Custometest/MD5.py
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
# 由于MD5模块在python3中被移除
|
||||||
|
# 在python3中使用hashlib模块进行md5操作
|
||||||
|
|
||||||
|
import hashlib
|
||||||
|
|
||||||
|
class MD5:
|
||||||
|
def MD5(data,langer,md5_types):
|
||||||
|
# 创建md5对象
|
||||||
|
# m = hashlib.md5()
|
||||||
|
# Tips
|
||||||
|
# 此处必须encode
|
||||||
|
# 若写法为m.update(str) 报错为: Unicode-objects must be encoded before hashing
|
||||||
|
# 因为python3里默认的str是unicode
|
||||||
|
# 或者 b = bytes(str, encoding='utf-8'),作用相同,都是encode为bytes
|
||||||
|
# b = str.encode(encoding='utf-8')
|
||||||
|
# m.update(b)
|
||||||
|
# str_md5 = m.hexdigest()
|
||||||
|
if langer == "英文":
|
||||||
|
# str_md5 = hashlib.md5(b'this is a md5 test.').hexdigest()
|
||||||
|
str_md5 = hashlib.md5("b'"+data+"'").hexdigest()
|
||||||
|
print('MD5加密前为 :' + data)
|
||||||
|
print('MD5加密后为 :' + str_md5)
|
||||||
|
return str_md5
|
||||||
|
elif langer == "中文":
|
||||||
|
str_md5 = hashlib.md5('你好'.encode(encoding=md5_types)).hexdigest()
|
||||||
|
return str_md5
|
||||||
|
# utf8 和gbk 加密结构不一样
|
||||||
|
# hashlib.md5('你好'.encode(encoding='GBK')).hexdigest()
|
||||||
|
# hashlib.md5('你好'.encode(encoding='GB2312')).hexdigest()
|
||||||
|
# hashlib.md5('你好'.encode(encoding='GB18030')).hexdigest()
|
||||||
|
if __name__ == '__main__':
|
||||||
|
data = '小猪'
|
||||||
|
langer = '中文'
|
||||||
|
md5_types = 'GBK'
|
||||||
|
a =MD5(data,langer,md5_types)
|
||||||
|
print(a)
|
||||||
|
b=r'C:\Users\小猪\AppData\Local\Programs\Python\Python37\Lib\site-packages\custometest\MD5.py'
|
||||||
|
with open(b, encoding='utf-8') as f:
|
||||||
|
text = f.read()
|
||||||
|
print(text)
|
||||||
16
04-CustomLibrary/Custometest/__init__.py
Normal file
16
04-CustomLibrary/Custometest/__init__.py
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
|
||||||
|
#-*- coding:utf-8 -*-
|
||||||
|
'''
|
||||||
|
created by hch 2019-06-26
|
||||||
|
'''
|
||||||
|
|
||||||
|
from custometest.printlog import printlog
|
||||||
|
from custometest.MD5 import MD5
|
||||||
|
from custometest.cmd_cer import Order
|
||||||
|
# from custometest.printlog import printlog
|
||||||
|
|
||||||
|
|
||||||
|
__version__ = '1.0'
|
||||||
|
|
||||||
|
class custometest(printlog,Order,MD5):
|
||||||
|
ROBOT_LIBRARY_SCOPE = 'GLOBAL'
|
||||||
0
04-CustomLibrary/Custometest/certificate.yaml
Normal file
0
04-CustomLibrary/Custometest/certificate.yaml
Normal file
164
04-CustomLibrary/Custometest/cmd_cer.py
Normal file
164
04-CustomLibrary/Custometest/cmd_cer.py
Normal file
@@ -0,0 +1,164 @@
|
|||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
from time import sleep
|
||||||
|
|
||||||
|
|
||||||
|
class Order:
|
||||||
|
def CMD(self,data):
|
||||||
|
result = os.popen(data)
|
||||||
|
# res = result.read().encoding('GBK')
|
||||||
|
res = result.read()
|
||||||
|
result.close()
|
||||||
|
# res = res.decode("unicode-escape")
|
||||||
|
return res
|
||||||
|
def Linux(self):
|
||||||
|
pass
|
||||||
|
# 根据证书颁发者名字判断证书是否替换
|
||||||
|
def Cert_Verification(self,data):
|
||||||
|
c = []
|
||||||
|
print(1)
|
||||||
|
#with open(r'C:\Users\iiesoft\AppData\Local\Programs\Python\Python36\Lib\site-packages\custometest\certificate.yaml', 'r') as foo:
|
||||||
|
with open(r'certificate.yaml', 'r') as foo:
|
||||||
|
print(2)
|
||||||
|
for line in foo.readlines():
|
||||||
|
if data in line:
|
||||||
|
print(line)
|
||||||
|
c.append('证书已替换')
|
||||||
|
else:
|
||||||
|
pass
|
||||||
|
if '证书已替换' in c:
|
||||||
|
# print('证书已替换')
|
||||||
|
foo.close()
|
||||||
|
return '证书已替换'
|
||||||
|
else:
|
||||||
|
# print('证书未替换')
|
||||||
|
foo.close()
|
||||||
|
return '证书未替换'
|
||||||
|
|
||||||
|
def Content_Type(self,data):
|
||||||
|
d = []
|
||||||
|
with open('certificate.yaml', 'r') as foo:
|
||||||
|
for line in foo.readlines():
|
||||||
|
if data in line:
|
||||||
|
# print(line)
|
||||||
|
d.append('Content_Type已替换')
|
||||||
|
else:
|
||||||
|
pass
|
||||||
|
if 'Content_Type已替换' in d:
|
||||||
|
# print('证书已替换')
|
||||||
|
foo.close()
|
||||||
|
return 'Content_Type已替换'
|
||||||
|
else:
|
||||||
|
# print('证书未替换')
|
||||||
|
foo.close()
|
||||||
|
return 'Content_Type未替换'
|
||||||
|
# curl路由内容设置
|
||||||
|
def curl_name(self,data):
|
||||||
|
#curl_name = 'curl -kv -m 10 -1 --trace C:/Users/iiesoft/AppData/Local/Programs/Python/Python36/Lib/site-packages/custometest/certificate.yaml '+data+'| iconv -f utf-8 -t gbk'
|
||||||
|
curl_name = 'curl -kv -m 10 -1 --trace certificate.yaml '+data+'| iconv -f utf-8 -t gbk'
|
||||||
|
return curl_name
|
||||||
|
# 控制器
|
||||||
|
def manu(self,url,Certificate):
|
||||||
|
# print(data['url'])
|
||||||
|
n = 0
|
||||||
|
while n != len(url):
|
||||||
|
b = self.curl_name(url[n])
|
||||||
|
d = self.CMD(b)
|
||||||
|
# print(d)
|
||||||
|
sleep(1)
|
||||||
|
if Certificate != "":
|
||||||
|
c =self.Cert_Verification(Certificate)
|
||||||
|
# f = self.Content_Type(data["Content_Type"])
|
||||||
|
sleep(1)
|
||||||
|
assert_cer = url[n]+c
|
||||||
|
# assert_Content_Type = data['Content_Type']+f
|
||||||
|
n+=1
|
||||||
|
return d,assert_cer
|
||||||
|
|
||||||
|
def FTP(self, ftp_type):
|
||||||
|
windows_path = os.getcwd()
|
||||||
|
linux_path = os.getcwd().replace('\\', '/')
|
||||||
|
# 判断FTP执行类型:(下载/登录)
|
||||||
|
if ftp_type == "下载":
|
||||||
|
# 调用cmd执行FTP下载文件
|
||||||
|
data = 'curl -m 20 ftp://202.38.97.230/pub/iso/linux/knoppix/KNOPPIX_V7.7.1DVD-2016-10-22-EN/dpkg-l-dvd-771.txt -u"anonymous:chrome@example.com" -o zmmtext123.txt'
|
||||||
|
d = self.CMD(data)
|
||||||
|
sleep(5)
|
||||||
|
fsize = os.path.getsize(linux_path + "/zmmtext123.txt") # 435814
|
||||||
|
if fsize == 435814:
|
||||||
|
return "Success"
|
||||||
|
else:
|
||||||
|
return "Fail"
|
||||||
|
elif ftp_type == "登录":
|
||||||
|
data = 'curl -m 10 ftp://202.38.97.230/pub/iso/linux/knoppix/KNOPPIX_V7.7.1DVD-2016-10-22-EN/dpkg-l-dvd-771.txt -u"anonymous:chrome@example.com" | iconv -f utf-8 -t gbk'
|
||||||
|
d = self.CMD(data)
|
||||||
|
# print(d)
|
||||||
|
if "Graphical (Xorg) program starter for ADRIANE" in d:
|
||||||
|
return "Success"
|
||||||
|
else:
|
||||||
|
return "Fail"
|
||||||
|
# FTP 下载
|
||||||
|
def FTP_down(self, ftp_url,file_size,fiel_name):
|
||||||
|
windows_path = os.getcwd()
|
||||||
|
linux_path = os.getcwd().replace('\\', '/')
|
||||||
|
# 判断FTP执行类型:(下载/登录)
|
||||||
|
# 调用cmd执行FTP下载文件
|
||||||
|
data = 'curl -m 20 '+ftp_url+ '-o '+ fiel_name + " ' "
|
||||||
|
print(data)
|
||||||
|
d = self.CMD(data)
|
||||||
|
sleep(5)
|
||||||
|
fsize = os.path.getsize(linux_path + "/"+fiel_name) # 435814
|
||||||
|
print(fsize)
|
||||||
|
if fsize == file_size:
|
||||||
|
return "Success"
|
||||||
|
else:
|
||||||
|
return "Fail"
|
||||||
|
|
||||||
|
# FTP 登录
|
||||||
|
def FTP_login(self, ftp_url,file_content):
|
||||||
|
data = 'curl -m 10 '+ftp_url+' | iconv -f utf-8 -t gbk'
|
||||||
|
d = self.CMD(data)
|
||||||
|
# print(d)
|
||||||
|
if file_content in d:
|
||||||
|
return "Success"
|
||||||
|
else:
|
||||||
|
return "Fail"
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
datas = {"url":['https://www.baidu.com'],
|
||||||
|
"Certificate":"Tango Secure Gateway CA",
|
||||||
|
# "Content_Type":"text/html",
|
||||||
|
'log':'Security Event Logs',
|
||||||
|
"sni":['baidu'],
|
||||||
|
"intercept_code":"200",
|
||||||
|
"log_code":"200",
|
||||||
|
"certifucate":"1",
|
||||||
|
"log_content":"true"
|
||||||
|
}
|
||||||
|
# data= {"url":['https://www.baidu.com'],
|
||||||
|
# "Certificate":"Tango Secure Gateway CA"
|
||||||
|
# }
|
||||||
|
# url = ['https://www.baidu.com']
|
||||||
|
# url = ['https://www.baidu.com']
|
||||||
|
# url = ['https://www.baidu.com']
|
||||||
|
# # Certificate1 = "Tango Secure Gateway CA"
|
||||||
|
# Certificate = "baidu"
|
||||||
|
# a='Tango Secure Gateway CA'
|
||||||
|
# s = Order()
|
||||||
|
# b = s.manu(url,Certificate)
|
||||||
|
# print(b[1])
|
||||||
|
# FTP下载 传入ftp的路径和文件大小
|
||||||
|
ftp_url = 'ftp://202.38.97.230/pub/iso/linux/knoppix/KNOPPIX_V7.7.1DVD-2016-10-22-EN/dpkg-l-dvd-771.txt -u"anonymous:chrome@example.com" '
|
||||||
|
ftp_size = 435814
|
||||||
|
ftp_issue = s.FTP_down(ftp_url,ftp_size)
|
||||||
|
# FTP登录 传入ftp的路径和文件内容
|
||||||
|
ftp_url ='ftp://202.38.97.230/pub/iso/linux/knoppix/KNOPPIX_V7.7.1DVD-2016-10-22-EN/dpkg-l-dvd-771.txt -u"anonymous:chrome@example.com" '
|
||||||
|
file_content = "Graphical (Xorg) program starter for ADRIANE"
|
||||||
|
ftp_issue = s.FTP_login(ftp_url,file_content)
|
||||||
|
# for i in b:
|
||||||
|
# print(i)
|
||||||
|
# dd = s.CMD('curl -I https://www.baidu.com')
|
||||||
|
# print(dd)
|
||||||
|
# if "private, no-cache, no-store, proxy-revalidate, no-transform"in dd:
|
||||||
|
# print("ok")
|
||||||
|
# a ='curl -kv -1 --trace certificate.yaml https://www.baidu.com | iconv -f utf-8 -t gbk'
|
||||||
11
04-CustomLibrary/Custometest/printlog.py
Normal file
11
04-CustomLibrary/Custometest/printlog.py
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
#-*- coding:utf-8 -*-
|
||||||
|
'''
|
||||||
|
created by hch 2019-06-26
|
||||||
|
'''
|
||||||
|
|
||||||
|
|
||||||
|
class printlog():
|
||||||
|
|
||||||
|
def printA():
|
||||||
|
print("hello word")
|
||||||
7
04-CustomLibrary/FileLibrary/__init__.py
Normal file
7
04-CustomLibrary/FileLibrary/__init__.py
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#coding=utf-8
|
||||||
|
from filetool import filetool
|
||||||
|
|
||||||
|
version = '1.0'
|
||||||
|
|
||||||
|
class FileLibrary(filetool):
|
||||||
|
ROBOT_LIBRARY_SCOPE = 'GLOBAL'
|
||||||
27
04-CustomLibrary/FileLibrary/filetool.py
Normal file
27
04-CustomLibrary/FileLibrary/filetool.py
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
#coding=utf-8
|
||||||
|
import sys
|
||||||
|
reload(sys)
|
||||||
|
sys.setdefaultencoding("utf-8")
|
||||||
|
|
||||||
|
""" 变量文件操作 """
|
||||||
|
|
||||||
|
class filetool():
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def alter_dict(self, path, k, v):
|
||||||
|
data = ''
|
||||||
|
flag = True
|
||||||
|
key = '${%s}' % (k)
|
||||||
|
add = key + '\t%s' % (v) + '\n'
|
||||||
|
with open(path, 'r+') as f:
|
||||||
|
for line in f.readlines():
|
||||||
|
if(line.find(key + '\t') == 0):
|
||||||
|
line = add
|
||||||
|
flag = False
|
||||||
|
data += line
|
||||||
|
if(flag):
|
||||||
|
data += add
|
||||||
|
print data
|
||||||
|
with open(path, 'w+') as f:
|
||||||
|
f.writelines(data)
|
||||||
200
04-CustomLibrary/Pop3Library/__init__.py
Normal file
200
04-CustomLibrary/Pop3Library/__init__.py
Normal file
@@ -0,0 +1,200 @@
|
|||||||
|
import poplib
|
||||||
|
import base64
|
||||||
|
import time
|
||||||
|
from email.parser import Parser
|
||||||
|
# 用来解析邮件主题
|
||||||
|
from email.header import decode_header
|
||||||
|
# 用来解析邮件来源
|
||||||
|
from email.utils import parseaddr
|
||||||
|
|
||||||
|
from robot.api.deco import keyword
|
||||||
|
from robot.api import logger
|
||||||
|
|
||||||
|
|
||||||
|
class AcceptEmail(object):
|
||||||
|
|
||||||
|
def __init__(self, user_email, password, pop3_server='serverDemon'):
|
||||||
|
self.user_email = user_email
|
||||||
|
self.password = password
|
||||||
|
self.pop3_server = pop3_server
|
||||||
|
|
||||||
|
self.connect_email_server()
|
||||||
|
|
||||||
|
def connect_email_server(self):
|
||||||
|
self.server = poplib.POP3(self.pop3_server)
|
||||||
|
# 打印POP3服务器的欢迎文字,验证是否正确连接到了邮件服务器
|
||||||
|
# print('连接成功 -- ', self.server.getwelcome().decode('utf8'))
|
||||||
|
# +OK QQMail POP3 Server v1.0 Service Ready(QQMail v2.0)
|
||||||
|
|
||||||
|
# 开始进行身份验证
|
||||||
|
self.server.user(self.user_email)
|
||||||
|
self.server.pass_(self.password)
|
||||||
|
|
||||||
|
def __del__(self):
|
||||||
|
# 关闭与服务器的连接,释放资源
|
||||||
|
self.server.close()
|
||||||
|
|
||||||
|
def get_email_count(self):
|
||||||
|
# 返回邮件总数目和占用服务器的空间大小(字节数), 通过stat()方法即可
|
||||||
|
email_num, email_size = self.server.stat()
|
||||||
|
# print("消息的数量: {0}, 消息的总大小: {1}".format(email_num, email_size))
|
||||||
|
return email_num
|
||||||
|
|
||||||
|
def receive_email_info(self, now_count=None):
|
||||||
|
# 返回邮件总数目和占用服务器的空间大小(字节数), 通过stat()方法即可
|
||||||
|
email_num, email_size = self.server.stat()
|
||||||
|
# print("消息的数量: {0}, 消息的总大小: {1}".format(email_num, email_size))
|
||||||
|
self.email_count = email_num
|
||||||
|
self.email_sumsize = email_size
|
||||||
|
|
||||||
|
# 使用list()返回所有邮件的编号,默认为字节类型的串
|
||||||
|
rsp, msg_list, rsp_siz = self.server.list()
|
||||||
|
# print(msg_list, '邮件数量',len(msg_list))
|
||||||
|
# print("服务器的响应: {0},\n消息列表: {1},\n返回消息的大小: {2}".format(rsp, msg_list, rsp_siz))
|
||||||
|
# print('邮件总数: {}'.format(len(msg_list)))
|
||||||
|
self.response_status = rsp
|
||||||
|
self.response_size = rsp_siz
|
||||||
|
|
||||||
|
# 下面获取最新的一封邮件,某个邮件下标(1开始算)
|
||||||
|
# total_mail_numbers = len(msg_list)
|
||||||
|
|
||||||
|
# 动态取消息
|
||||||
|
total_mail_numbers = now_count
|
||||||
|
|
||||||
|
rsp, msglines, msgsiz = self.server.retr(total_mail_numbers)
|
||||||
|
# rsp, msglines, msgsiz = self.server.retr(1)
|
||||||
|
# print("服务器的响应: {0},\n原始邮件内容: {1},\n该封邮件所占字节大小: {2}".format(rsp, msglines, msgsiz))
|
||||||
|
|
||||||
|
# 从邮件原内容中解析
|
||||||
|
msg_content = b'\r\n'.join(msglines).decode('utf-8')#gbk
|
||||||
|
msg = Parser().parsestr(text=msg_content)
|
||||||
|
self.msg = msg
|
||||||
|
# print('解码后的邮件信息:\n{}'.format(msg))
|
||||||
|
|
||||||
|
def recv(self, now_count=None):
|
||||||
|
self.receive_email_info(now_count)
|
||||||
|
self.parser()
|
||||||
|
|
||||||
|
def get_email_title(self):
|
||||||
|
subject = self.msg['Subject']
|
||||||
|
value, charset = decode_header(subject)[0]
|
||||||
|
if charset:
|
||||||
|
value = value.decode(charset)
|
||||||
|
# print('邮件主题: {0}'.format(value))
|
||||||
|
self.email_title = value
|
||||||
|
|
||||||
|
def get_sender_info(self):
|
||||||
|
hdr, addr = parseaddr(self.msg['From'])
|
||||||
|
# name 发送人邮箱名称, addr 发送人邮箱地址
|
||||||
|
name, charset = decode_header(hdr)[0]
|
||||||
|
if charset:
|
||||||
|
name = name.decode(charset)
|
||||||
|
self.sender_qq_name = name
|
||||||
|
self.sender_qq_email = addr
|
||||||
|
# print('发送人邮箱名称: {0},发送人邮箱地址: {1}'.format(name, addr))
|
||||||
|
|
||||||
|
def get_email_content(self):
|
||||||
|
content = self.msg.get_payload()
|
||||||
|
# 文本信息
|
||||||
|
content_charset = content[0].get_content_charset() # 获取编码格式
|
||||||
|
text = content[0].as_string().split('base64')[-1]
|
||||||
|
text_content = base64.b64decode(text).decode(content_charset) # base64解码
|
||||||
|
self.email_content = text_content
|
||||||
|
# print('邮件内容: {0}'.format(text_content))
|
||||||
|
|
||||||
|
# 添加了HTML代码的信息
|
||||||
|
content_charset = content[1].get_content_charset()
|
||||||
|
text = content[1].as_string().split('base64')[-1]
|
||||||
|
# html_content = base64.b64decode(text).decode(content_charset)
|
||||||
|
|
||||||
|
# print('文本信息: {0}\n添加了HTML代码的信息: {1}'.format(text_content, html_content))
|
||||||
|
|
||||||
|
def parser(self):
|
||||||
|
self.get_email_title()
|
||||||
|
self.get_sender_info()
|
||||||
|
#self.get_email_content()
|
||||||
|
|
||||||
|
|
||||||
|
def get_new_mail(user_name, pwd, pop3_server, second=5):
|
||||||
|
t = AcceptEmail(user_name, pwd, pop3_server)
|
||||||
|
now_count = t.get_email_count()
|
||||||
|
#print('开启的时候的邮件数量为:%s' % now_count)
|
||||||
|
logger.info("开启的时候的邮件数量为:"+str(now_count))
|
||||||
|
# 每次需要重新连接邮箱服务器,才能获取到最新的消息
|
||||||
|
# 默认每隔5秒看一次是否有新内容
|
||||||
|
num = 0
|
||||||
|
while True:
|
||||||
|
obj = AcceptEmail(user_name, pwd, pop3_server)
|
||||||
|
count = obj.get_email_count()
|
||||||
|
if count > now_count:
|
||||||
|
new_mail_count = count - now_count
|
||||||
|
#print('有新的邮件数量:%s' % new_mail_count)
|
||||||
|
logger.info("有新的邮件数量:"+str(new_mail_count))
|
||||||
|
now_count += 1
|
||||||
|
obj.recv(now_count)
|
||||||
|
|
||||||
|
yield {"title": obj.email_title, "sender": obj.sender_qq_name, "sender_email": obj.sender_qq_email}
|
||||||
|
#yield {"title": obj.email_title, "sender": obj.sender_qq_name, "sender_email": obj.sender_qq_email,
|
||||||
|
# "email_content": obj.email_content}
|
||||||
|
if new_mail_count > 0:
|
||||||
|
return
|
||||||
|
# print('-' * 30)
|
||||||
|
# print("邮件主题:%s\n发件人:%s\n发件人邮箱:%s\n邮件内容:%s" % (
|
||||||
|
# obj.email_title, obj.sender_qq_name, obj.sender_qq_email, obj.email_content))
|
||||||
|
# print('-' * 30)
|
||||||
|
|
||||||
|
#else:
|
||||||
|
#print('没有任何新消息.')
|
||||||
|
#logger.info("没有任何新消息.")
|
||||||
|
time.sleep(second)
|
||||||
|
num += 1
|
||||||
|
if num == 36:#等待时间粒度,一个粒度是5s,如果num=10意思就是等待接收邮件50s,若没有邮件就返回;36是等待3min
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
@keyword('Recv Email')
|
||||||
|
def recv_email(user_name, pwd, pop3_server, send_user, subj):
|
||||||
|
'''
|
||||||
|
参数说明:
|
||||||
|
[user_name]:用户名
|
||||||
|
[pwd]:密码,第三方登入密码
|
||||||
|
[pop server]:pop服务器
|
||||||
|
[sender]:发送者邮箱,注意全称
|
||||||
|
[subj_sub]:主题的部分内容,这里是测主题是否包含该参数
|
||||||
|
[return]:返回值,成功返回success,失败返回n其他
|
||||||
|
其他问题请阅读该库的readme.txt
|
||||||
|
'''
|
||||||
|
dic = {}
|
||||||
|
logger.info("正在监听邮件服务器端是否有新消息---")
|
||||||
|
#print('正在监听邮件服务器端是否有新消息---')
|
||||||
|
try:
|
||||||
|
iterator = get_new_mail(user_name, pwd, pop3_server)
|
||||||
|
except TypeError:
|
||||||
|
#print('监听的内容有误,有图片数据等,无法解析而报错,不是纯文本内容')
|
||||||
|
logger.info("监听的内容有误,有图片数据等,无法解析而报错,不是纯文本内容")
|
||||||
|
return "fail"
|
||||||
|
else:
|
||||||
|
for dic in iterator:
|
||||||
|
#print("邮件主题:%s\n发件人:%s\n发件人邮箱:%s\n邮件内容:%s" % (
|
||||||
|
# dic["title"], dic["sender"], dic["sender_email"], dic["email_content"]))
|
||||||
|
#logger.info("邮件主题: " + str(dic["title"]) + " 发件人: " + str(dic["sender"])+"发件人邮箱:"+str(dic["sender_email"]))
|
||||||
|
if dic["sender"] == send_user:
|
||||||
|
#logger.info("发送者一样")
|
||||||
|
if subj in dic["title"]:
|
||||||
|
#logger.info("主题也包含")
|
||||||
|
return "success"
|
||||||
|
else:
|
||||||
|
#logger.info("主题不包含")
|
||||||
|
return "fail"
|
||||||
|
else:
|
||||||
|
return "fail"
|
||||||
|
|
||||||
|
|
||||||
|
#if __name__ == '__main__':
|
||||||
|
# user = 'xxxx@qq.com'
|
||||||
|
# pwd = 'xxxx'
|
||||||
|
# pop3_server = 'pop.qq.com'
|
||||||
|
# send_user = 'zlking_2019@163.com'
|
||||||
|
# subj = 'or2020'
|
||||||
|
# result = recv_email(user, pwd, pop3_server, send_user, subj)
|
||||||
|
# print(result)
|
||||||
BIN
04-CustomLibrary/Pop3Library/__pycache__/__init__.cpython-36.pyc
Normal file
BIN
04-CustomLibrary/Pop3Library/__pycache__/__init__.cpython-36.pyc
Normal file
Binary file not shown.
26
04-CustomLibrary/Pop3Library/readme.txt
Normal file
26
04-CustomLibrary/Pop3Library/readme.txt
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
导入方法:
|
||||||
|
1.将该目录放到....\Python\Lib\site-packages 下
|
||||||
|
2.在测试夹具里面要根据绝对路径导入此包
|
||||||
|
|
||||||
|
|
||||||
|
注意:
|
||||||
|
1.使用该包的关键字时不要用qq邮箱,qq邮箱测试发现时长会失灵现象,最好用163邮箱等
|
||||||
|
2.注意关闭邮箱的加密传送方式SSL协议
|
||||||
|
3.注意邮箱是否支持POP3的协议以及不同邮箱pop服务器的写法
|
||||||
|
|
||||||
|
|
||||||
|
关键字:
|
||||||
|
[return] Recv Email [user_name] [pwd] [pop server] [sender] [subj_sub]
|
||||||
|
参数说明:
|
||||||
|
[user_name]:用户名
|
||||||
|
[pwd]:密码,第三方登入密码
|
||||||
|
[pop server]:pop服务器
|
||||||
|
[sender]:发送者邮箱,注意全称
|
||||||
|
[subj_sub]:主题的部分内容,这里是测主题是否包含该参数
|
||||||
|
[return]:返回值,成功返回success,失败返回n其他
|
||||||
|
该关键字默认等待3min,3min内每5s检测邮箱是否收到邮件,
|
||||||
|
若收到邮件与[sender]参数进行完全匹配,与[subj_sub]部分主题内容参数进行是否包含匹配,匹配成功则返回success;
|
||||||
|
若收到邮件匹配失败或者超时则返回其他,
|
||||||
|
|
||||||
|
|
||||||
|
若修改等待时间,可查找源码中的num变量将36改为其他值即可,注意时间粒度是5s,若num=3,则您修改的等待时间是15s
|
||||||
417
04-CustomLibrary/Smtp4Library/__init__.py
Normal file
417
04-CustomLibrary/Smtp4Library/__init__.py
Normal file
@@ -0,0 +1,417 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# This file is part of robotframework-Smtp3Library.
|
||||||
|
# https://github.io/lucamaro/robotframework-Smtp3Library
|
||||||
|
|
||||||
|
# Licensed under the Apache License 2.0 license:
|
||||||
|
# http://www.opensource.org/licenses/Apache-2.0
|
||||||
|
# Copyright (c) 2016, Luca Maragnani <luca.maragnani@gmail.com>
|
||||||
|
|
||||||
|
"""
|
||||||
|
Library implementation
|
||||||
|
"""
|
||||||
|
import ast
|
||||||
|
import smtplib
|
||||||
|
import email
|
||||||
|
import random
|
||||||
|
import string
|
||||||
|
import mimetypes
|
||||||
|
import quopri
|
||||||
|
from email.message import Message
|
||||||
|
from email.mime.audio import MIMEAudio
|
||||||
|
from email.mime.base import MIMEBase
|
||||||
|
from email.mime.image import MIMEImage
|
||||||
|
from email.mime.multipart import MIMEMultipart
|
||||||
|
from email.mime.text import MIMEText
|
||||||
|
from email import encoders
|
||||||
|
import os.path
|
||||||
|
import socket
|
||||||
|
from robot.api.deco import keyword
|
||||||
|
from robot.api import logger
|
||||||
|
|
||||||
|
from Smtp3Library.version import __version__ # NOQA
|
||||||
|
|
||||||
|
COMMASPACE = ', '
|
||||||
|
|
||||||
|
class Smtp3Library(object):
|
||||||
|
"""
|
||||||
|
SMTP Client class
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
"""
|
||||||
|
Constructor
|
||||||
|
"""
|
||||||
|
self.message = self._MailMessage()
|
||||||
|
self.host = None
|
||||||
|
self.port = None
|
||||||
|
self.user = None
|
||||||
|
self.password = None
|
||||||
|
self.smtp = None
|
||||||
|
|
||||||
|
def _prepare_connection(self, host, port, user=None, password=None):
|
||||||
|
"""
|
||||||
|
Private method to collect connection informations
|
||||||
|
"""
|
||||||
|
self.host = host
|
||||||
|
self.port = int(port)
|
||||||
|
self.user = user
|
||||||
|
self.password = password
|
||||||
|
self.client_hostname = socket.gethostname()
|
||||||
|
|
||||||
|
|
||||||
|
def prepare_ssl_connection(self, host, port=465, user=None, password=None):
|
||||||
|
"""
|
||||||
|
Collect connection informations for SSL channel
|
||||||
|
"""
|
||||||
|
self._prepare_connection(host, port, user, password)
|
||||||
|
self.smtp = smtplib.SMTP_SSL()
|
||||||
|
|
||||||
|
def prepare_connection(self, host, port=25, user=None, password=None):
|
||||||
|
"""
|
||||||
|
Collect connection informations for unencrypted channel
|
||||||
|
"""
|
||||||
|
self._prepare_connection(host, port, user, password)
|
||||||
|
self.smtp = smtplib.SMTP()
|
||||||
|
|
||||||
|
def add_to_recipient(self, recipient):
|
||||||
|
"""
|
||||||
|
Add a recipient to "To:" list
|
||||||
|
"""
|
||||||
|
self.message.mail_to.append(recipient)
|
||||||
|
|
||||||
|
def add_cc_recipient(self, recipient):
|
||||||
|
"""
|
||||||
|
Add a recipient to "Cc:" list
|
||||||
|
"""
|
||||||
|
self.message.mail_cc.append(recipient)
|
||||||
|
|
||||||
|
def add_bcc_recipient(self, recipient):
|
||||||
|
"""
|
||||||
|
Add a recipient to "Bcc:" list
|
||||||
|
"""
|
||||||
|
self.message.mail_bcc.append(recipient)
|
||||||
|
|
||||||
|
def set_subject(self, subj):
|
||||||
|
"""
|
||||||
|
Set email subject
|
||||||
|
"""
|
||||||
|
self.message.subject = subj
|
||||||
|
|
||||||
|
def set_from(self, from_recipient):
|
||||||
|
"""
|
||||||
|
Set from address of message and envelope
|
||||||
|
"""
|
||||||
|
self.message.mail_from = from_recipient
|
||||||
|
|
||||||
|
def set_body(self, body):
|
||||||
|
"""
|
||||||
|
Set email body
|
||||||
|
"""
|
||||||
|
self.message.body = body
|
||||||
|
|
||||||
|
def set_random_body(self, size):
|
||||||
|
"""
|
||||||
|
Set a random body of <size> length
|
||||||
|
"""
|
||||||
|
body = ''
|
||||||
|
for i in range(0, size):
|
||||||
|
body += ''.join(random.choice(string.uppercase + string.digits))
|
||||||
|
if i % 80 == 0:
|
||||||
|
body += "\n"
|
||||||
|
self.message.body = body
|
||||||
|
|
||||||
|
def add_attachment(self, attach):
|
||||||
|
"""
|
||||||
|
Add attachment to a list of filenames
|
||||||
|
"""
|
||||||
|
self.message.attachments.append(attach)
|
||||||
|
|
||||||
|
def add_header(self, name, value):
|
||||||
|
"""
|
||||||
|
Add a custom header to headers list
|
||||||
|
"""
|
||||||
|
self.message.headers[name] = value
|
||||||
|
|
||||||
|
def connect(self):
|
||||||
|
'''
|
||||||
|
Open connection to server
|
||||||
|
Returns tuple (smtp status code, message)
|
||||||
|
'''
|
||||||
|
return self.smtp.connect(self.host, self.port)
|
||||||
|
|
||||||
|
def present_client_as(self, client_hostname):
|
||||||
|
'''
|
||||||
|
Set helo/ehlo client identity
|
||||||
|
'''
|
||||||
|
self.client_hostname = client_hostname
|
||||||
|
|
||||||
|
def helo(self):
|
||||||
|
'''
|
||||||
|
Send HELO command
|
||||||
|
Returns tuple (smtp status code, message)
|
||||||
|
'''
|
||||||
|
result = self.smtp.helo(self.client_hostname)
|
||||||
|
logger.info(result)
|
||||||
|
return result
|
||||||
|
|
||||||
|
def ehlo(self):
|
||||||
|
'''
|
||||||
|
Send EHLO command
|
||||||
|
Returns tuple (smtp status code, message)
|
||||||
|
'''
|
||||||
|
result = self.smtp.ehlo(self.client_hostname)
|
||||||
|
logger.info(result)
|
||||||
|
return result
|
||||||
|
|
||||||
|
def get_esmtp_features(self):
|
||||||
|
'''
|
||||||
|
Returns hashmap with ESMTP feature received with EHLO
|
||||||
|
'''
|
||||||
|
logger.info(self.smtp.esmtp_features)
|
||||||
|
return self.smtp.esmtp_features
|
||||||
|
|
||||||
|
def logins(self):
|
||||||
|
try:
|
||||||
|
'''
|
||||||
|
Login user
|
||||||
|
Returns tuple (smtp status code, message)
|
||||||
|
'''
|
||||||
|
logger.info("Login with user " + self.user + " and password " + self.password)
|
||||||
|
'''try:
|
||||||
|
subuser=bytes.decode(self.user)
|
||||||
|
subpassword=bytes.decode(self.password)
|
||||||
|
result = self.smtp.login(subuser.encode('ascii'), subpassword.encode('ascii'))
|
||||||
|
logger.info(result)
|
||||||
|
return result
|
||||||
|
except:
|
||||||
|
logger.info("本身就是str类型不需要bytes to str!")
|
||||||
|
subuser=str(self.user).encode('ascii')
|
||||||
|
subpassword=str(self.password).encode('ascii')
|
||||||
|
result = self.smtp.login(subuser, subpassword)
|
||||||
|
logger.info(result)
|
||||||
|
return result'''
|
||||||
|
result = self.smtp.login(self.user, self.password)
|
||||||
|
logger.info(result)
|
||||||
|
return "success"
|
||||||
|
except:
|
||||||
|
return "fail"
|
||||||
|
|
||||||
|
|
||||||
|
def starttls(self, keyfile=None, certfile=None):
|
||||||
|
'''
|
||||||
|
sends STARTTLS
|
||||||
|
optional: keyfile certfile
|
||||||
|
Returns tuple (smtp status code, message)
|
||||||
|
'''
|
||||||
|
logger.info("STARTTLS")
|
||||||
|
if keyfile is None and certfile is None:
|
||||||
|
result = self.smtp.starttls()
|
||||||
|
else:
|
||||||
|
result = self.smtp.starttls(keyfile, certfile)
|
||||||
|
logger.info(result)
|
||||||
|
return result
|
||||||
|
|
||||||
|
def data(self):
|
||||||
|
'''
|
||||||
|
Data command send email body with "MAIL FROM:", "RCPT TO:" and "DATA" commands
|
||||||
|
Returns tuple (smtp status code, message)
|
||||||
|
'''
|
||||||
|
result = self.smtp.mail(self.message.mail_from)
|
||||||
|
result += self.smtp.rcpt(self.message.get_message_recipients())
|
||||||
|
|
||||||
|
result += self.smtp.data(self.message.get_message_as_string())
|
||||||
|
logger.info(result)
|
||||||
|
return result
|
||||||
|
|
||||||
|
def sendmail(self):
|
||||||
|
'''
|
||||||
|
Send email with "MAIL FROM:", "RCPT TO:" and "DATA" commands
|
||||||
|
Returns tuple (smtp status code, message)
|
||||||
|
'''
|
||||||
|
result = self.smtp.sendmail(self.message.mail_from, self.message.get_message_recipients(), self.message.get_message_as_string())
|
||||||
|
logger.info(result)
|
||||||
|
return result
|
||||||
|
|
||||||
|
def quit(self):
|
||||||
|
'''
|
||||||
|
Send QUIT command
|
||||||
|
Returns tuple (smtp status code, message)
|
||||||
|
'''
|
||||||
|
result = self.smtp.quit()
|
||||||
|
logger.info(result)
|
||||||
|
return result
|
||||||
|
|
||||||
|
def close_connection(self):
|
||||||
|
'''
|
||||||
|
Close connection to server
|
||||||
|
'''
|
||||||
|
return self.smtp.close()
|
||||||
|
|
||||||
|
def send_message(self):
|
||||||
|
"""
|
||||||
|
Send the message, from connection establishment to quit and close connection.
|
||||||
|
All the connection and email parameters must be already set before invocation.
|
||||||
|
Returns sendmail response (code, message)
|
||||||
|
"""
|
||||||
|
|
||||||
|
# Send the message
|
||||||
|
try:
|
||||||
|
self.connect()
|
||||||
|
|
||||||
|
if self.user is not None:
|
||||||
|
self.ehlo()
|
||||||
|
self.logins()
|
||||||
|
|
||||||
|
send_result = self.sendmail()
|
||||||
|
|
||||||
|
self.quit()
|
||||||
|
self.close_connection()
|
||||||
|
# return send_result
|
||||||
|
return "success"
|
||||||
|
except:
|
||||||
|
return "fail"
|
||||||
|
|
||||||
|
@keyword('Send Message With All Parameters')
|
||||||
|
def send_message_full(self, host, user, password, subj,
|
||||||
|
from_recipient, to_recipient, cc_recipient=None, bcc_recipient=None,
|
||||||
|
body=None, attach=None):
|
||||||
|
"""
|
||||||
|
Send a message specifing all parameters on the same linecc
|
||||||
|
cc, bcc and attach parameters may be strings or array of strings
|
||||||
|
host, user, password, subj, fromadd, toadd - are mandatory parameters
|
||||||
|
to use the optional paramaters pleas specify the name fo the parameter in the call
|
||||||
|
user and password even if mandatory could be set to None so no authentication will be made
|
||||||
|
Example:
|
||||||
|
sendMail("smtp.mail.com", None, None, "The subject", "me@mail.com", "friend@mai.com", body="Hello World body")
|
||||||
|
|
||||||
|
sendMail("smtp.mail.com", "scott", "tiger", "The subject", "me@mail.com", "friend@mai.com", body="Hello World body", attach=attaches
|
||||||
|
where could be:
|
||||||
|
attaches = ["c:\\desktop\\file1.zip", "c:\\desktop\\file2.zip"] or
|
||||||
|
attaches = "c:\\desktop\\file1.zip"
|
||||||
|
Returns sendmail response (code, message)
|
||||||
|
"""
|
||||||
|
|
||||||
|
self.host = host
|
||||||
|
self.user = user
|
||||||
|
self.password = password
|
||||||
|
|
||||||
|
self.set_subject(subj)
|
||||||
|
self.set_from(from_recipient)
|
||||||
|
self.message.mail_to = to_recipient
|
||||||
|
if cc_recipient != None:
|
||||||
|
self.message.mail_cc = cc_recipient
|
||||||
|
if bcc_recipient != None:
|
||||||
|
self.message.mail_bcc = bcc_recipient
|
||||||
|
#Fill the message
|
||||||
|
if body != None:
|
||||||
|
self.set_body(body)
|
||||||
|
# Part two is attachment
|
||||||
|
if attach != None:
|
||||||
|
attachlist = ast.literal_eval(attach)
|
||||||
|
self.message.attachments = attachlist
|
||||||
|
#logger.info("self.message.attachments:"+str(type(self.message.attachments)))
|
||||||
|
#logger.info("attachtype:"+str(type(attachlist)))
|
||||||
|
#logger.info("attachlist:"+str(attachlist))
|
||||||
|
|
||||||
|
return self.send_message()
|
||||||
|
|
||||||
|
|
||||||
|
class _MailMessage:
|
||||||
|
"""
|
||||||
|
Simplified email message
|
||||||
|
This class represent email headers and payload content, not envelope data
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
"""
|
||||||
|
init object variables
|
||||||
|
"""
|
||||||
|
self.mail_from = None
|
||||||
|
self.mail_to = []
|
||||||
|
self.mail_cc = []
|
||||||
|
self.mail_bcc = []
|
||||||
|
self.subject = ''
|
||||||
|
self.body = ''
|
||||||
|
self.attachments = []
|
||||||
|
self.headers = {}
|
||||||
|
|
||||||
|
def get_message_recipients(self):
|
||||||
|
'''
|
||||||
|
Get all message recipients (to, cc, bcc)
|
||||||
|
'''
|
||||||
|
recipients = []
|
||||||
|
tolist = ast.literal_eval(self.mail_to)
|
||||||
|
cclist = ast.literal_eval(self.mail_cc)
|
||||||
|
bcclist = ast.literal_eval(self.mail_bcc)
|
||||||
|
recipients.extend(tolist)
|
||||||
|
recipients.extend(cclist)
|
||||||
|
recipients.extend(bcclist)
|
||||||
|
#logger.info("recipientslist:"+str(recipients))
|
||||||
|
return recipients
|
||||||
|
|
||||||
|
def get_message_as_string(self):
|
||||||
|
'''
|
||||||
|
Get message as string to be sent with smtplib.sendmail api
|
||||||
|
'''
|
||||||
|
if len(self.attachments) > 0:
|
||||||
|
#logger.info("attachments:"+str(self.attachments))
|
||||||
|
#logger.info("attachmentstype:"+str(type(self.attachments)))
|
||||||
|
#logger.info("attachmentsnum:"+str(len(self.attachments)))
|
||||||
|
|
||||||
|
envelope = MIMEMultipart()
|
||||||
|
envelope.attach(MIMEText(self.body))
|
||||||
|
else:
|
||||||
|
envelope = MIMEText(self.body)
|
||||||
|
|
||||||
|
recipients = self.get_message_recipients()
|
||||||
|
|
||||||
|
|
||||||
|
tolist = ast.literal_eval(self.mail_to)
|
||||||
|
cclist = ast.literal_eval(self.mail_cc)
|
||||||
|
envelope['From'] = self.mail_from
|
||||||
|
envelope['To'] = COMMASPACE.join(tolist)
|
||||||
|
envelope['Cc'] = COMMASPACE.join(cclist)
|
||||||
|
envelope['Subject'] = self.subject
|
||||||
|
#logger.info("envelope111:"+str(self.attachments))
|
||||||
|
for attachment in list(self.attachments):
|
||||||
|
ctype, encoding = mimetypes.guess_type(attachment)
|
||||||
|
#logger.info("attachment:"+attachment+" ctype:"+str(ctype)+" encoding:"+str(encoding))
|
||||||
|
if ctype is None or encoding is not None:
|
||||||
|
# No guess could be made, or the file is encoded (compressed), so
|
||||||
|
# use a generic bag-of-bits type.
|
||||||
|
ctype = 'application/octet-stream'
|
||||||
|
maintype, subtype = ctype.split('/', 1)
|
||||||
|
#logger.info("maintype:"+str(maintype)+" subtype:"+str(subtype))
|
||||||
|
|
||||||
|
msg = None
|
||||||
|
if maintype == 'text':
|
||||||
|
attach_file = open(attachment,'rb')
|
||||||
|
# TODO: we should handle calculating the charset
|
||||||
|
msg = MIMEText(attach_file.read(), _subtype=subtype, _charset='utf-8')
|
||||||
|
attach_file.close()
|
||||||
|
elif maintype == 'image':
|
||||||
|
attach_file = open(attachment, 'rb')
|
||||||
|
msg = MIMEImage(attach_file.read(), _subtype=subtype)
|
||||||
|
attach_file.close()
|
||||||
|
elif maintype == 'audio':
|
||||||
|
attach_file = open(attachment, 'rb')
|
||||||
|
msg = MIMEAudio(attach_file.read(), _subtype=subtype)
|
||||||
|
attach_file.close()
|
||||||
|
else:
|
||||||
|
attach_file = open(attachment, 'rb')
|
||||||
|
msg = MIMEBase(maintype, subtype)
|
||||||
|
msg.set_payload(attach_file.read())
|
||||||
|
attach_file.close()
|
||||||
|
# Encode the payload using Base64
|
||||||
|
encoders.encode_base64(msg)
|
||||||
|
|
||||||
|
# Set the filename parameter
|
||||||
|
msg.add_header('Content-Disposition', 'attachment',
|
||||||
|
filename=os.path.basename(attachment))
|
||||||
|
envelope.attach(msg)
|
||||||
|
|
||||||
|
|
||||||
|
#logger.info("envelope.as_string:"+envelope.as_string())
|
||||||
|
return envelope.as_string()
|
||||||
Binary file not shown.
Binary file not shown.
BIN
04-CustomLibrary/Smtp4Library/__pycache__/version.cpython-37.pyc
Normal file
BIN
04-CustomLibrary/Smtp4Library/__pycache__/version.cpython-37.pyc
Normal file
Binary file not shown.
11
04-CustomLibrary/Smtp4Library/version.py
Normal file
11
04-CustomLibrary/Smtp4Library/version.py
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# This file is part of robotframework-Smtp3Library.
|
||||||
|
# https://github.io/lucamaro/robotframework-SmtpLibrary
|
||||||
|
|
||||||
|
# Licensed under the Apache License 2.0 license:
|
||||||
|
# http://www.opensource.org/licenses/Apache-2.0
|
||||||
|
# Copyright (c) 2016, Luca Maragnani <luca.maragnani@gmail.com>
|
||||||
|
|
||||||
|
__version__ = '0.1.3' # NOQA
|
||||||
68
05-Other/cli_files/tsg_help.txt
Normal file
68
05-Other/cli_files/tsg_help.txt
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
+---+--------------------+---------------+------------------------------------------------------------+
|
||||||
|
|No.|Command Name |Privilege Mode |Description |
|
||||||
|
+---+--------------------+---------------+------------------------------------------------------------+
|
||||||
|
|1 |alias |N |create aliases |
|
||||||
|
+---+--------------------+---------------+------------------------------------------------------------+
|
||||||
|
|2 |awk |N |pattern scanning and processing language |
|
||||||
|
+---+--------------------+---------------+------------------------------------------------------------+
|
||||||
|
|3 |cat |N |concatenate files and print on the standard output |
|
||||||
|
+---+--------------------+---------------+------------------------------------------------------------+
|
||||||
|
|4 |cp |Y |copy files and directories |
|
||||||
|
+---+--------------------+---------------+------------------------------------------------------------+
|
||||||
|
|5 |exit |N |close and quit current SSH connection. |
|
||||||
|
+---+--------------------+---------------+------------------------------------------------------------+
|
||||||
|
|6 |find |N |search for files in a directory hierarchy |
|
||||||
|
+---+--------------------+---------------+------------------------------------------------------------+
|
||||||
|
|7 |grep |N |print lines matching a pattern |
|
||||||
|
+---+--------------------+---------------+------------------------------------------------------------+
|
||||||
|
|8 |head |N |output the first part of files |
|
||||||
|
+---+--------------------+---------------+------------------------------------------------------------+
|
||||||
|
|9 |history |N |display the command history list with line numbers |
|
||||||
|
+---+--------------------+---------------+------------------------------------------------------------+
|
||||||
|
|10 |ifconfig |Y |configure a network interface |
|
||||||
|
+---+--------------------+---------------+------------------------------------------------------------+
|
||||||
|
|11 |ls |N |list directory contents |
|
||||||
|
+---+--------------------+---------------+------------------------------------------------------------+
|
||||||
|
|12 |mkdir |Y |make directories |
|
||||||
|
+---+--------------------+---------------+------------------------------------------------------------+
|
||||||
|
|13 |mv |Y |move (rename) files |
|
||||||
|
+---+--------------------+---------------+------------------------------------------------------------+
|
||||||
|
|14 |ping |N |send ICMP ECHO_REQUEST to network hosts |
|
||||||
|
+---+--------------------+---------------+------------------------------------------------------------+
|
||||||
|
|15 |rm |Y |remove files or directories |
|
||||||
|
+---+--------------------+---------------+------------------------------------------------------------+
|
||||||
|
|16 |sort |N |sort lines of text files |
|
||||||
|
+---+--------------------+---------------+------------------------------------------------------------+
|
||||||
|
|17 |tail |N |output the last part of files |
|
||||||
|
+---+--------------------+---------------+------------------------------------------------------------+
|
||||||
|
|18 |whoami |N |print effective userid |
|
||||||
|
+---+--------------------+---------------+------------------------------------------------------------+
|
||||||
|
|19 |cd |N |change the current directory |
|
||||||
|
+---+--------------------+---------------+------------------------------------------------------------+
|
||||||
|
|20 |clear |N |clear |
|
||||||
|
+---+--------------------+---------------+------------------------------------------------------------+
|
||||||
|
|21 |pwd |N |print name of current/working directory |
|
||||||
|
+---+--------------------+---------------+------------------------------------------------------------+
|
||||||
|
|22 |rz |Y |XMODEM, YMODEM, ZMODEM (Batch) file receive |
|
||||||
|
+---+--------------------+---------------+------------------------------------------------------------+
|
||||||
|
|23 |sz |Y |XMODEM, YMODEM, ZMODEM file send |
|
||||||
|
+---+--------------------+---------------+------------------------------------------------------------+
|
||||||
|
|24 |scp |Y |secure copy (remote file copy program) |
|
||||||
|
+---+--------------------+---------------+------------------------------------------------------------+
|
||||||
|
|25 |vi |Y |a programmers text editor |
|
||||||
|
+---+--------------------+---------------+------------------------------------------------------------+
|
||||||
|
|26 |vim |Y |a programmers text editor |
|
||||||
|
+---+--------------------+---------------+------------------------------------------------------------+
|
||||||
|
|27 |tsg_diagnose |N |Fast Fault Diagnosis |
|
||||||
|
+---+--------------------+---------------+------------------------------------------------------------+
|
||||||
|
|28 |tsg_policy |Y |query and configure policy information |
|
||||||
|
+---+--------------------+---------------+------------------------------------------------------------+
|
||||||
|
|29 |tsg_policy_object |Y |query policy object information |
|
||||||
|
+---+--------------------+---------------+------------------------------------------------------------+
|
||||||
|
|30 |tsg_record |Y |Record executed commands |
|
||||||
|
+---+--------------------+---------------+------------------------------------------------------------+
|
||||||
|
|31 |tsg_show |N |show tsg device information |
|
||||||
|
+---+--------------------+---------------+------------------------------------------------------------+
|
||||||
|
|32 |tsg_passwd |N |Change Password |
|
||||||
|
+---+--------------------+---------------+------------------------------------------------------------+
|
||||||
|
tsgcli >
|
||||||
1
05-Other/curl/AllFlowHTTPSIntercept-001_dos.bat
Normal file
1
05-Other/curl/AllFlowHTTPSIntercept-001_dos.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl -kv https://www.baidu.com | iconv -f utf-8 -t gbk
|
||||||
1
05-Other/curl/ProxyPolicy-Hijack-Http-exe-00002.bat
Normal file
1
05-Other/curl/ProxyPolicy-Hijack-Http-exe-00002.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl -kv --cookie "oKD0_802a_saltkey=GssJU4vd; oKD0_802a_lastvisit=1583299284; oKD0_802a_pvi=656927416; _ga=GA1.2.2008992591.1583302924; __qca=P0-416369031-1583302925459; oKD0_802a_chinacountry=1; oKD0_802a_si=s75975888; zh_choose=n; __gads=ID=9674dfcbea12038e:T=1585059647:S=ALNI_MYPPZN5Z_UthuylbEOqR-zno5YoHg; oKD0_802a_application_clientip=111.201.144.161; oKD0_802a_sid=va7jUV; oKD0_802a_lastact=1585234917%09portal.php%09index" --referer 'http://www.baidu.com/' http://www.sinovision.net/portal.php? | iconv -f utf-8 -t gbk
|
||||||
1
05-Other/curl/ProxyPolicy-Hijack-Http-png-00001.bat
Normal file
1
05-Other/curl/ProxyPolicy-Hijack-Http-png-00001.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl -kv --user-agent "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36" --referer 'http://www.baidu.com/' \ http://www.sinovision.net/portal.php?mod=center \ \ | iconv -f utf-8 -t gbk
|
||||||
1
05-Other/curl/ProxyPolicy-Hijack-SSL-apk-00001.bat
Normal file
1
05-Other/curl/ProxyPolicy-Hijack-SSL-apk-00001.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl -kv --user-agent "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36" --referer 'https://www.baidu.com/' https://wap.sogou.com/| iconv -f utf-8 -t gbk
|
||||||
1
05-Other/curl/ProxyPolicy-Hijack-SSL-html-00002.bat
Normal file
1
05-Other/curl/ProxyPolicy-Hijack-SSL-html-00002.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl -kv --cookie "SUV=001417487B769DD85B65253149725433; SMYUV=1533629990235795; SUID=B30E65757C20940A000000005B6AF061; pgv_pvi=8797682688; ssuid=8017562563; tv_play_records=tvshow_2279123:20190405; LSTMV=312%2C176; LCLKINT=1391; CXID=5145CC50244AEAAF133BCAF7997E0DF2; ad=DZllllllll2WyAMQlllllVi0lF7llllltxhNmZllll9lllllxCxlw@@@@@@@@@@@; IPLOC=CN1100; usid=rc9pej2Z7YMatQbc; SNUID=F4C59C3B5550F496B37EEB265569EF03; ABTEST=8|1585237652|v1; sct=45; wuid=AAGUT3HcLQAAAAqPMm4EAwAAkwA=" --referer 'http://www.baidu.com/' https://wap.sogou.com/ | iconv -f utf-8 -t gbk
|
||||||
1
05-Other/curl/ProxyPolicy-deny-ssl-00011.bat
Normal file
1
05-Other/curl/ProxyPolicy-deny-ssl-00011.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl -kv https://www.facebook.com/ | iconv -f utf-8 -t gbk
|
||||||
1
05-Other/curl/ProxyPolicy-deny-ssl-00012.bat
Normal file
1
05-Other/curl/ProxyPolicy-deny-ssl-00012.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl -kv https://rutube.ru/ | iconv -f utf-8 -t gbk
|
||||||
1
05-Other/curl/ProxyPolicy_Redirect_http00002.bat
Normal file
1
05-Other/curl/ProxyPolicy_Redirect_http00002.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl -kv --user-agent "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36" --referer 'http://www.baidu.com/' \ http://www.ccb.com/cn/home/indexv3.html \ \ | iconv -f utf-8 -t gbk
|
||||||
1
05-Other/curl/ProxyPolicy_Redirect_http00003.bat
Normal file
1
05-Other/curl/ProxyPolicy_Redirect_http00003.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl --cookie "*_math=czsuv8n9d4p; Hm_lvt_92e8bc890f374994dd570aa15afc99e1=1575187416; Hm_lpvt_92e8bc890f374994dd570aa15afc99e1=1575187416; _uab_collina=157518741578524001717192" --referer 'http://www.baidu.com/' \ http://www.xiaozhu.com //| iconv -f utf-8 -t gbk
|
||||||
1
05-Other/curl/ProxyPolicy_Redirect_http00006.bat
Normal file
1
05-Other/curl/ProxyPolicy_Redirect_http00006.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl -kv http://www.xiaozhu.com/#ongo/ | iconv -f utf-8 -t gbk
|
||||||
1
05-Other/curl/ProxyPolicy_Redirect_ssl00001.bat
Normal file
1
05-Other/curl/ProxyPolicy_Redirect_ssl00001.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl -kv https://bj.lianjia.com/ershoufang/ | iconv -f utf-8 -t gbk
|
||||||
1
05-Other/curl/ProxyPolicy_Redirect_ssl00004.bat
Normal file
1
05-Other/curl/ProxyPolicy_Redirect_ssl00004.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl -kv -H "Content-Type:application/x-www-form-urlencoded" -X POST -d "reqBody=123456&setCookie=set-cookie&contentType=content-type&resBody=Response Body" https://open.node.com/action | iconv -f utf-8 -t gbk
|
||||||
1
05-Other/curl/ProxyPolicy_Redirect_ssl00005.bat
Normal file
1
05-Other/curl/ProxyPolicy_Redirect_ssl00005.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl -kv https://www.toutiao.com/ch/news_hot/ | iconv -f utf-8 -t gbk
|
||||||
1
05-Other/curl/ProxyPolicy_Redirect_ssl00007.bat
Normal file
1
05-Other/curl/ProxyPolicy_Redirect_ssl00007.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl -kv --user-agent "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36" --referer 'https://www.baidu.com/' \ https://www.gamersky.com/news/ \ \ | iconv -f utf-8 -t gbk
|
||||||
1
05-Other/curl/ProxyPolicy_Redirect_ssl00008.bat
Normal file
1
05-Other/curl/ProxyPolicy_Redirect_ssl00008.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl -kv https://nationalbank.kz/ | iconv -f utf-8 -t gbk
|
||||||
1
05-Other/curl/ProxyPolicy_Redirect_ssl00009.bat
Normal file
1
05-Other/curl/ProxyPolicy_Redirect_ssl00009.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl -kv -H "Content-Type:application/x-www-form-urlencoded" -X POST -d "reqBody=123456&setCookie=set-cookie&contentType=content-type&resBody=Response Body" https://open.node.com/action | iconv -f utf-8 -t gbk
|
||||||
1
05-Other/curl/ProxyPolicy_Redirect_ssl00010.bat
Normal file
1
05-Other/curl/ProxyPolicy_Redirect_ssl00010.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl -kv --user-agent "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36" --referer 'https://www.baidu.com/' \ https://www.twitch.tv/directory \ \ | iconv -f utf-8 -t gbk
|
||||||
1
05-Other/curl/ProxyPolicy_Redirect_ssl00011.bat
Normal file
1
05-Other/curl/ProxyPolicy_Redirect_ssl00011.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl -kv https://www.zakon.kz/top_news/ | iconv -f utf-8 -t gbk
|
||||||
1
05-Other/curl/ProxyPolicy_Redirect_ssl00012.bat
Normal file
1
05-Other/curl/ProxyPolicy_Redirect_ssl00012.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl -kv -H "Content-Type:application/x-www-form-urlencoded" -X POST -d "reqBody=<3D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܧۧ<DCA7><DBA7>֧ܧ<D6A7>&setCookie=set-cookie&contentType=content-type&resBody=Response Body" https://open.node.com/action | iconv -f utf-8 -t gbk
|
||||||
1
05-Other/curl/ProxyPolicy_Replace_http00001.bat
Normal file
1
05-Other/curl/ProxyPolicy_Replace_http00001.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl -kv http://sz.xiaozhu.com/fangzi/6257935516.html | iconv -f utf-8 -t gbk
|
||||||
1
05-Other/curl/ProxyPolicy_Replace_http00002.bat
Normal file
1
05-Other/curl/ProxyPolicy_Replace_http00002.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl -kv http://www.tianya.cn/ | iconv -f utf-8 -t gbk
|
||||||
1
05-Other/curl/ProxyPolicy_Replace_http00003.bat
Normal file
1
05-Other/curl/ProxyPolicy_Replace_http00003.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl -kv http://military.miercn.com/ | iconv -f utf-8 -t gbk
|
||||||
1
05-Other/curl/ProxyPolicy_Replace_http00004.bat
Normal file
1
05-Other/curl/ProxyPolicy_Replace_http00004.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl -kv http://www.ziroom.com/life/index | iconv -f utf-8 -t gbk
|
||||||
1
05-Other/curl/ProxyPolicy_allow_ssl00008.bat
Normal file
1
05-Other/curl/ProxyPolicy_allow_ssl00008.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl --user-agent "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36" --referer 'http://www.baidu.com/' \ http://www.sinovision.net/ \ \ | iconv -f utf-8 -t gbk
|
||||||
1
05-Other/curl/ProxyPolicy_allow_ssl00010.bat
Normal file
1
05-Other/curl/ProxyPolicy_allow_ssl00010.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl -kv https://youtube.com/ | iconv -f utf-8 -t gbk
|
||||||
1
05-Other/curl/ProxyPolicy_allow_ssl00011.bat
Normal file
1
05-Other/curl/ProxyPolicy_allow_ssl00011.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl -kv https://zakon.kz/ | iconv -f utf-8 -t gbk
|
||||||
1
05-Other/curl/ProxyPolicy_deny_ssl00004.bat
Normal file
1
05-Other/curl/ProxyPolicy_deny_ssl00004.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl -kv https://bj.zu.ke.com/zufang | iconv -f utf-8 -t gbk
|
||||||
1
05-Other/curl/ProxyPolicy_hijack_http00002.bat
Normal file
1
05-Other/curl/ProxyPolicy_hijack_http00002.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl -kv --user-agent "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36" --referer 'http://www.baidu.com/' \ http://www.sinovision.net/portal.php?mod=center \ \ | iconv -f utf-8 -t gbk
|
||||||
1
05-Other/curl/ProxyPolicy_hijack_http00003.bat
Normal file
1
05-Other/curl/ProxyPolicy_hijack_http00003.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl --cookie "*_math=czsuv8n9d4p; Hm_lvt_92e8bc890f374994dd570aa15afc99e1=1575187416; Hm_lpvt_92e8bc890f374994dd570aa15afc99e1=1575187416; _uab_collina=157518741578524001717192" --referer 'http://www.baidu.com/' \ http://www.xiaozhu.com \ \ | iconv -f utf-8 -t gbk
|
||||||
1
05-Other/curl/ProxyPolicy_hijack_http00005.bat
Normal file
1
05-Other/curl/ProxyPolicy_hijack_http00005.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl -kv http://www.ccb.com/cn/home/indexv3.html | iconv -f utf-8 -t gbk
|
||||||
1
05-Other/curl/ProxyPolicy_hijack_ssl00001.bat
Normal file
1
05-Other/curl/ProxyPolicy_hijack_ssl00001.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl -kv https://www.jianshu.com/mobile/club | iconv -f utf-8 -t gbk
|
||||||
1
05-Other/curl/ProxyPolicy_hijack_ssl00004.bat
Normal file
1
05-Other/curl/ProxyPolicy_hijack_ssl00004.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl -kv https://open.douyin.com/platform | iconv -f utf-8 -t gbk
|
||||||
1
05-Other/curl/ProxyPolicy_hijack_ssl00006.bat
Normal file
1
05-Other/curl/ProxyPolicy_hijack_ssl00006.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl -kv --user-agent "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36" --referer 'https://www.baidu.com/' \ https://www.zealer.com/account/register \ \ | iconv -f utf-8 -t gbk
|
||||||
1
05-Other/curl/ProxyPolicy_hijack_ssl00007.bat
Normal file
1
05-Other/curl/ProxyPolicy_hijack_ssl00007.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl -kv https://passport.yhd.com/passport/login_input.do | iconv -f utf-8 -t gbk
|
||||||
1
05-Other/curl/ProxyPolicy_hijack_ssl00008.bat
Normal file
1
05-Other/curl/ProxyPolicy_hijack_ssl00008.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl -kv https://twitter.com/login | iconv -f utf-8 -t gbk
|
||||||
1
05-Other/curl/ProxyPolicy_hijack_ssl00009.bat
Normal file
1
05-Other/curl/ProxyPolicy_hijack_ssl00009.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl -kv --user-agent "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36" --referer 'https://www.baidu.com/' \ https://tengrinews.kz/zakon/ \ \ | iconv -f utf-8 -t gbk
|
||||||
1
05-Other/curl/SecurityPolicy-SSL-Intecept-Demo001.bat
Normal file
1
05-Other/curl/SecurityPolicy-SSL-Intecept-Demo001.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl -kv https://www.baidu.com | iconv -f utf-8 -t gbk
|
||||||
2
05-Other/curl/SecurityPolicy_Intercept_SSL001.bat
Normal file
2
05-Other/curl/SecurityPolicy_Intercept_SSL001.bat
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
curl -kv https://www.youtube.com | iconv -f utf-8 -t gbk
|
||||||
|
|
||||||
1
05-Other/curl/SecurityPolicy_Intercept_SSL002.bat
Normal file
1
05-Other/curl/SecurityPolicy_Intercept_SSL002.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl -kv https://www.facebook.com | iconv -f utf-8 -t gbk
|
||||||
1
05-Other/curl/SecurityPolicy_Intercept_SSL003.bat
Normal file
1
05-Other/curl/SecurityPolicy_Intercept_SSL003.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl -kv https://client.badssl.com/ | iconv -f utf-8 -t gbk
|
||||||
1
05-Other/curl/SecurityPolicy_Intercept_SSL004.bat
Normal file
1
05-Other/curl/SecurityPolicy_Intercept_SSL004.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl -kv https://self-signed.badssl.com/ | iconv -f utf-8 -t gbk
|
||||||
1
05-Other/curl/SecurityPolicy_Intercept_SSL005_007.bat
Normal file
1
05-Other/curl/SecurityPolicy_Intercept_SSL005_007.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl -kv https://www.myssl.cn/ | iconv -f utf-8 -t gbk
|
||||||
1
05-Other/curl/SecurityPolicy_Intercept_SSL006_010.bat
Normal file
1
05-Other/curl/SecurityPolicy_Intercept_SSL006_010.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl -kv https://www.vip.com/ | iconv -f utf-8 -t gbk
|
||||||
1
05-Other/curl/SecurityPolicy_Intercept_SSL008.bat
Normal file
1
05-Other/curl/SecurityPolicy_Intercept_SSL008.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl -kv https://360.cn/ | iconv -f utf-8 -t gbk
|
||||||
1
05-Other/curl/SecurityPolicy_Intercept_SSL009.bat
Normal file
1
05-Other/curl/SecurityPolicy_Intercept_SSL009.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl -kv https://www.mi.com/ | iconv -f utf-8 -t gbk
|
||||||
1
05-Other/curl/SecurityPolicy_Intercept_SSL011.bat
Normal file
1
05-Other/curl/SecurityPolicy_Intercept_SSL011.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl -kv https://www.taobao.com/ | iconv -f utf-8 -t gbk
|
||||||
1
05-Other/curl/SecurityPolicy_Intercept_SSL012.bat
Normal file
1
05-Other/curl/SecurityPolicy_Intercept_SSL012.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl -kv https://halfrost.com/ | iconv -f utf-8 -t gbk
|
||||||
1
05-Other/curl/SecurityPolicy_Intercept_SSL013.bat
Normal file
1
05-Other/curl/SecurityPolicy_Intercept_SSL013.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl -kv https://www.olx.kz/uslugi/ | iconv -f utf-8 -t gbk
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user