summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhebingning <[email protected]>2022-10-09 18:43:28 +0800
committerhebingning <[email protected]>2022-10-09 18:43:28 +0800
commit7d0bfc67659b141c526446506fdabace8ea3aa43 (patch)
tree3fe2c7801d418b37a40734b3136aafb3b67c7420
parent6baacd5482a65aff68d8f5aa097c9fedba8f23c4 (diff)
TSG-12090 IP Libary自动化用例完善
-rw-r--r--case/policies/security/http.robot130
-rw-r--r--keyword/common/common.robot30
-rw-r--r--keyword/common/login_logout.robot7
-rw-r--r--keyword/common/logschema.robot9
-rw-r--r--keyword/objects/application.robot8
-rw-r--r--keyword/objects/application_new.robot14
-rw-r--r--keyword/objects/ip_objects.robot6
-rw-r--r--keyword/objects/manage_object_body.robot6
-rw-r--r--keyword/objects/object.robot30
-rw-r--r--keyword/objects/process_object_body.robot6
-rw-r--r--keyword/policys/policy.robot57
-rw-r--r--keyword/system/administration/administering_access_tokens.robot12
-rw-r--r--keyword/system/iplibraries.robot152
-rw-r--r--keyword/system/trouble_shooting/packet_capture.robot19
-rw-r--r--other/data/security/http/security-http-allow-fqdn-exactly-data.yaml119
-rw-r--r--other/data/template/template.yaml30
16 files changed, 442 insertions, 193 deletions
diff --git a/case/policies/security/http.robot b/case/policies/security/http.robot
index edf3cc8..0513ff7 100644
--- a/case/policies/security/http.robot
+++ b/case/policies/security/http.robot
@@ -16,257 +16,247 @@ ${createObjectIds} ${EMPTY}
*** Test Cases ***
allow-only-IpAndApplication
- [Tags] OnlySourceAndApp
+ [Tags] OnlySourceAndApp Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-allow-only-IpAndApplication-data.yaml ${TEST NAME}
allow-fqdn-suffix
- [Tags] SingleFilter
+ [Tags] SingleFilter Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-allow-fqdn-suffix-data.yaml ${TEST NAME}
allow-fqdn-exactly
- [Tags] SingleFilter
+ [Tags] SingleFilter Security ipLibrary
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-allow-fqdn-exactly-data.yaml ${TEST NAME}
allow-url-suffix
- [Tags] SingleFilter
+ [Tags] SingleFilter Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-allow-url-suffix-data.yaml ${TEST NAME}
allow-url-prefix
- [Tags] SingleFilter
+ [Tags] SingleFilter Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-allow-url-prefix-data.yaml ${TEST NAME}
allow-url-substring
- [Tags] SingleFilter
+ [Tags] SingleFilter Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-allow-url-substring-data.yaml ${TEST NAME}
allow-url-exactly
- [Tags] SingleFilter
+ [Tags] SingleFilter Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-allow-url-exactly-data.yaml ${TEST NAME}
allow-fqdn-url
- [Tags] MultiFilter
+ [Tags] MultiFilter Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-allow-fqdn-url-data.yaml ${TEST NAME}
allow-reqheader-exactly
- [Tags] SingleFilter
+ [Tags] SingleFilter Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-allow-reqheader-exactly-data.yaml ${TEST NAME}
allow-reqheader-prefix
- [Tags] SingleFilter
+ [Tags] SingleFilter Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-allow-reqheader-prefix-data.yaml ${TEST NAME}
allow-reqheader-suffix
- [Tags] SingleFilter
+ [Tags] SingleFilter Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-allow-reqheader-suffix-data.yaml ${TEST NAME}
allow-reqheader-substring
- [Tags] SingleFilter
+ [Tags] SingleFilter Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-allow-reqheader-substring-data.yaml ${TEST NAME}
allow-resheader-exactly
- [Tags] SingleFilter
+ [Tags] SingleFilter Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-allow-resheader-exactly-data.yaml ${TEST NAME}
allow-resheader-suffix
- [Tags] SingleFilter
+ [Tags] SingleFilter Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-allow-resheader-suffix-data.yaml ${TEST NAME}
allow-resheader-prefix
- [Tags] SingleFilter
+ [Tags] SingleFilter Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-allow-resheader-prefix-data.yaml ${TEST NAME}
allow-resheader-substring
- [Tags] SingleFilter
+ [Tags] SingleFilter Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-allow-resheader-substring-data.yaml ${TEST NAME}
allow-resbody-substring
- [Tags] SingleFilter
+ [Tags] SingleFilter Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-allow-resbody-substring-data.yaml ${TEST NAME}
allow-reqbody-substring
- [Tags] SingleFilter
+ [Tags] SingleFilter Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-allow-reqbody-substring-data.yaml ${TEST NAME}
allow-fqdn-resbody
- [Tags] MultiFilter
+ [Tags] MultiFilter Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-allow-fqdn-resbody-data.yaml ${TEST NAME}
allow-fqdn-reqbody
- [Tags] MultiFilter
+ [Tags] MultiFilter Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-allow-fqdn-reqbody-data.yaml ${TEST NAME}
allow-fqdn-resheader
- [Tags] MultiFilter
+ [Tags] MultiFilter Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-allow-fqdn-resheader-data.yaml ${TEST NAME}
allow-fqdn-reqheader
- [Tags] MultiFilter
+ [Tags] MultiFilter Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-allow-fqdn-reqheader-data.yaml ${TEST NAME}
allow-url-reqheader
- [Tags] MultiFilter
+ [Tags] MultiFilter Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-allow-url-reqheader-data.yaml ${TEST NAME}
allow-url-resheader
- [Tags] MultiFilter
+ [Tags] MultiFilter Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-allow-url-resheader-data.yaml ${TEST NAME}
allow-url-reqbody
- [Tags] MultiFilter
+ [Tags] MultiFilter Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-allow-url-reqbody-data.yaml ${TEST NAME}
allow-url-resbody
- [Tags] MultiFilter
+ [Tags] MultiFilter Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-allow-url-resbody-data.yaml ${TEST NAME}
allow-reqheader-resheader
- [Tags] MultiFilter
+ [Tags] MultiFilter Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-allow-reqheader-resheader-data.yaml ${TEST NAME}
allow-reqbody-resbody
- [Tags] MultiFilter
+ [Tags] MultiFilter Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-allow-reqbody-resbody-data.yaml ${TEST NAME}
allow-fqdn-reqheader-reqbody
- [Tags] MultiFilter
+ [Tags] MultiFilter Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-allow-fqdn-reqheader-reqbody-data.yaml ${TEST NAME}
allow-url-resheader-resbody
- [Tags] MultiFilter
+ [Tags] MultiFilter Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-allow-url-resheader-resbody-data.yaml ${TEST NAME}
allow-fqdn-url-reqheader-resheader
- [Tags] MultiFilter
+ [Tags] MultiFilter Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-allow-fqdn-url-reqheader-resheader-data.yaml ${TEST NAME}
allow-fqdn-url-reqbody-resbody
- [Tags] MultiFilter
+ [Tags] MultiFilter Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-allow-fqdn-url-reqbody-resbody-data.yaml ${TEST NAME}
allow-reqheader-resheader-reqbody-resbody
- [Tags] MultiFilter
+ [Tags] MultiFilter Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-allow-reqheader-resheader-reqbody-resbody-data.yaml ${TEST NAME}
allow-fqdn-url-reqheader-resheader-reqbody-resbody
- [Tags] MultiFilter
+ [Tags] MultiFilter Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-allow-fqdn-url-reqheader-resheader-reqbody-resbody-data.yaml ${TEST NAME}
deny-only-IpAndApplication
- [Tags] OnlySourceAndApp
+ [Tags] OnlySourceAndApp Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-deny-only-IpAndApplication-data.yaml ${TEST NAME}
deny-fqdn-suffix
- [Tags] SingleFiler Reset Block Alert Rate Limit
+ [Tags] SingleFiler Reset Block Alert Rate Limit Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-deny-fqdn-suffix-data.yaml ${TEST NAME}
deny-fqdn-exactly
- [Tags] SingleFiler Reset Block Alert Rate Limit
+ [Tags] SingleFiler Reset Block Alert Rate Limit Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-deny-fqdn-exactly-data.yaml ${TEST NAME}
deny-url-suffix
- [Tags] SingleFilter Reset Block Redirect Alert Rate Limit
+ [Tags] SingleFilter Reset Block Redirect Alert Rate Limit Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-deny-url-suffix-data.yaml ${TEST NAME}
deny-url-prefix
- [Tags] SingleFilter Reset Block Redirect Alert Rate Limit
+ [Tags] SingleFilter Reset Block Redirect Alert Rate Limit Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-deny-url-prefix-data.yaml ${TEST NAME}
deny-url-substring
- [Tags] SingleFilter Reset Block Redirect Alert Rate Limit
+ [Tags] SingleFilter Reset Block Redirect Alert Rate Limit Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-deny-url-substring-data.yaml ${TEST NAME}
deny-url-exactly
- [Tags] SingleFilter Reset Block Redirect Alert Rate Limit
+ [Tags] SingleFilter Reset Block Redirect Alert Rate Limit Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-deny-url-exactly-data.yaml ${TEST NAME}
deny-fqdn-url
- [Tags] SingleFilter Redirect
+ [Tags] SingleFilter Redirect Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-deny-fqdn-url-data.yaml ${TEST NAME}
deny-reqheader-prefix
- [Tags] SingleFilter Reset Block Alert Rate Limit
+ [Tags] SingleFilter Reset Block Alert Rate Limit Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-deny-reqheader-prefix-data.yaml ${TEST NAME}
deny-reqheader-substring
- [Tags] SingleFilter Reset Block Alert Rate Limit
+ [Tags] SingleFilter Reset Block Alert Rate Limit Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-deny-reqheader-substring-data.yaml ${TEST NAME}
deny-resheader-prefix
- [Tags] SingleFilter Reset Block Alert Rate Limit
+ [Tags] SingleFilter Reset Block Alert Rate Limit Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-deny-resheader-prefix-data.yaml ${TEST NAME}
deny-resheader-substring
- [Tags] SingleFilter Reset Block Alert Rate Limit
+ [Tags] SingleFilter Reset Block Alert Rate Limit Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-deny-resheader-substring-data.yaml ${TEST NAME}
deny-url-resbody-substring
- [Tags] SingleFilter Reset Rate Limit
+ [Tags] SingleFilter Reset Rate Limit Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-deny-url-resbody-substring-data.yaml ${TEST NAME}
deny-fqdn-url-reqheader-resheader-reqbody-resbody
- [Tags] MultiFilter Reset Rate Limit
+ [Tags] MultiFilter Reset Rate Limit Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-deny-fqdn-url-reqheader-resheader-reqbody-resbody-data.yaml ${TEST NAME}
monitor-only-IpAndApplication
- [Tags] OnlySourceAndApp
+ [Tags] OnlySourceAndApp Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-monitor-only-IpAndApplication-data.yaml ${TEST NAME}
monitor-fqdn-suffix
- [Tags] SingleFiler
+ [Tags] SingleFiler Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-monitor-fqdn-suffix-data.yaml ${TEST NAME}
monitor-fqdn-exactly
- [Tags] SingleFiler
+ [Tags] SingleFiler Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-monitor-fqdn-exactly-data.yaml ${TEST NAME}
monitor-url-suffix
- [Tags] SingleFilter
+ [Tags] SingleFilter Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-monitor-url-suffix-data.yaml ${TEST NAME}
monitor-url-prefix
- [Tags] SingleFilter
+ [Tags] SingleFilter Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-monitor-url-prefix-data.yaml ${TEST NAME}
monitor-url-substring
- [Tags] SingleFilter
+ [Tags] SingleFilter Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-monitor-url-substring-data.yaml ${TEST NAME}
monitor-url-exactly
- [Tags] SingleFilter
+ [Tags] SingleFilter Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-monitor-url-exactly-data.yaml ${TEST NAME}
-# monitor-reqbody-suffix
- # [Tags] SingleFilter
- # ${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-monitor-reqbody-suffix-data.yaml ${TEST NAME}
-
-# monitor-reqbody-prefix
- # [Tags] SingleFilter
- # ${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-monitor-reqbody-prefix-data.yaml ${TEST NAME}
monitor-reqbody-substring
- [Tags] SingleFilter
+ [Tags] SingleFilter Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-monitor-reqbody-substring-data.yaml ${TEST NAME}
-# monitor-reqbody-exactly
- # [Tags] SingleFilter
- # ${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-monitor-reqbody-exactly-data.yaml ${TEST NAME}
monitor-fqdn-url-reqheader-resheader-reqbody-resbody
- [Tags] MultiFilter
+ [Tags] MultiFilter Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-monitor-fqdn-url-reqheader-resheader-reqbody-resbody-data.yaml ${TEST NAME}
monitor-http-log-verify
- [Tags] MultiFilter
+ [Tags] MultiFilter Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-monitor-http-log-verify-data.yaml ${TEST NAME}
intercept-fqdn-suffix
- [Tags] SingleFiler
+ [Tags] SingleFiler Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-intercept-fqdn-suffix-data.yaml ${TEST NAME}
intercept-fqdn-exactly
- [Tags] SingleFiler
+ [Tags] SingleFiler Security
${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/security-http-intercept-fqdn-exactly-data.yaml ${TEST NAME}
diff --git a/keyword/common/common.robot b/keyword/common/common.robot
index 6a6e49f..34e6df8 100644
--- a/keyword/common/common.robot
+++ b/keyword/common/common.robot
@@ -31,7 +31,7 @@ ManageApistr
BasePostRequest
[Arguments] ${requestUri} ${data}
${headers} Set Variable {"Content-Type":"application/json"}
- Create Session api ${httpVersion}://${airTestUrl}:5000 ${headers} verify=false timeout=10min
+ Create Session api ${httpVersion}://${airTestUrl}:5000 ${headers} verify=false timeout=1200
${response}= Post Request api /${requestUri} data=${data}
log ${data}
log return data =${response}
@@ -376,4 +376,30 @@ CreatePolicyByJson
#${policyIds} json.loads ${json}
${createPolicyIdsTemp} Run Keyword IF "${createPolicyIds}" != "${EMPTY}" AppendListToList ${createPolicyIds} ${policyIds}
... ELSE Set Variable ${policyIds}
- SET GLOBAL VARIABLE ${createPolicyIds} ${createPolicyIdsTemp} \ No newline at end of file
+ SET GLOBAL VARIABLE ${createPolicyIds} ${createPolicyIdsTemp}
+
+ExcuteMysql
+ [Arguments] ${sql}
+ Connect To Database Using Custom Params pymysql ${mysqlHost}
+ ${res} query ${sql}
+ [Return] ${res}
+
+SshExcute
+ [Arguments] ${loginInfo} ${command} ${commandRes}
+ ${unReachable} Set Variable 0
+ ${reachExcuteFail} Set Variable 0
+ ${excuteSuccessful} Set Variable 0
+ ${loginInfo} Replace String ${loginInfo} EXCLAM !
+ ${loginInfo} Replace String ${loginInfo} ' "
+ ${loginInfo} json.loads ${loginInfo}
+ ${manageIp} Get From Dictionary ${loginInfo} manageIp
+ ${operationIp} Get From Dictionary ${loginInfo} operationIp
+ ${manageUser} Get From Dictionary ${loginInfo} manageUser
+ ${managePassword} Get From Dictionary ${loginInfo} managePassword
+ ${returnConnect} ${connect} Run Keyword And Ignore Error Open Connection ${manageIp}
+ ${returnLogin} ${login} Run Keyword And Ignore Error SSHLibrary.Login ${manageUser} ${managePassword}
+ ${return} ${write} Run Keyword And Ignore Error SSHLibrary.Write ${command}
+ ${return} ${res} Run Keyword And Ignore Error Read delay=20s
+
+ ${returnIsExcute} ${excute} Run Keyword And Ignore Error Should Contain ${res} ${commandRes}
+ [Return] ${res} \ No newline at end of file
diff --git a/keyword/common/login_logout.robot b/keyword/common/login_logout.robot
index 7e19820..f5bf9c5 100644
--- a/keyword/common/login_logout.robot
+++ b/keyword/common/login_logout.robot
@@ -18,7 +18,7 @@ InitPotocol
${appDict} Create Dictionary
${appVDict} Create Dictionary
Connect To Database Using Custom Params pymysql ${mysqlHost}
- ${app_id} query SELECT group_id, low_boundary, region_name FROM tsg_obj_app_id WHERE is_valid = 1 AND region_name = 'http' OR region_name = 'ssl' OR region_name = 'dns' OR region_name = 'ftp' OR region_name = 'mail' OR region_name = 'doh' OR region_name = 'rtp' OR region_name = 'sip' OR region_name = 'ssh' OR region_name = 'https' OR region_name = 'imaps' OR region_name = 'pop3s' OR region_name = 'smtps' OR region_name = 'quic' OR region_name = 'Psiphon3' OR region_name = 'tor' OR region_name = 'TachyonVPN' OR region_name = 'Freegate' OR region_name = 'skype' OR region_name = 'facebook' OR region_name = 'baidu' OR region_name = 'instagram' OR region_name = 'telegram' OR region_name = 'whatsapp' OR region_name = 'twitter' OR region_name = 'youtube' OR region_name = 'gmail' OR region_name = 'taobao' OR region_name = 'qq' OR region_name = 'wechat' OR region_name = 'wireguard' OR region_name = 'tachyonvpn' OR region_name = 'dingding' OR region_name = 'v4c' OR region_name = 'UGVPN' OR region_name = 'VPNlat' OR region_name = 'AnonyTun' OR region_name = 'urbanVPN' OR region_name = 'TurboVPN' OR region_name = 'FlashVPN' OR region_name = 'ProtonVPN' OR region_name = 'bilibili' OR region_name = 'gtalk'
+ ${app_id} query SELECT group_id, low_boundary, region_name FROM tsg_obj_app_id WHERE is_valid = 1 AND region_name = 'http' OR region_name = 'ssl' OR region_name = 'dns' OR region_name = 'ftp' OR region_name = 'mail' OR region_name = 'doh' OR region_name = 'rtp' OR region_name = 'sip' OR region_name = 'ssh' OR region_name = 'https' OR region_name = 'imaps' OR region_name = 'pop3s' OR region_name = 'smtps' OR region_name = 'quic' OR region_name = 'Psiphon3' OR region_name = 'tor' OR region_name = 'TachyonVPN' OR region_name = 'Freegate' OR region_name = 'skype' OR region_name = 'facebook' OR region_name = 'baidu' OR region_name = 'instagram' OR region_name = 'telegram' OR region_name = 'whatsapp' OR region_name = 'twitter' OR region_name = 'youtube' OR region_name = 'gmail' OR region_name = 'taobao' OR region_name = 'qq' OR region_name = 'wechat' OR region_name = 'wireguard' OR region_name = 'tachyonvpn' OR region_name = 'dingding' OR region_name = 'v4c' OR region_name = 'UGVPN' OR region_name = 'VPNlat' OR region_name = 'AnonyTun' OR region_name = 'urbanVPN' OR region_name = 'TurboVPN' OR region_name = 'FlashVPN' OR region_name = 'ProtonVPN' OR region_name = 'bilibili' OR region_name = 'gtalk' OR region_name = 'TurboVPN_mm' OR region_name = 'facebook_messenger'
# ... SELECT group_id,low_boundary,region_name FROM tsg_obj_app_id WHERE is_valid=1 and region_name in('http','ftp','${httpVersion}','ssl','dns','doh','quic','mail')
${app_length} Get Length ${app_id}
log ${app_length}
@@ -161,6 +161,11 @@ InitTemplate
${toJson} json.Dumps ${testinMode}
SET GLOBAL VARIABLE ${decryptionExclusionJson} ${toJson}
+ Comment ipLibraries模板
+ ${ipLibraryMode} Get From Dictionary ${LOADED} iplibrariesmode
+ ${toJson} json.Dumps ${ipLibraryMode}
+ SET GLOBAL VARIABLE ${ipLibraryJson} ${toJson}
+
ApiLogin
[Tags]
# 云测系统登录
diff --git a/keyword/common/logschema.robot b/keyword/common/logschema.robot
index 0abf741..04cb946 100644
--- a/keyword/common/logschema.robot
+++ b/keyword/common/logschema.robot
@@ -8,15 +8,6 @@ Library REST ${httpVersion}://${host}:${port}
*** Keywords ***
GetLogCondition
[Arguments] ${logname} ${startTime} ${endTime} ${client_ip} ${policy_id} ${schemaType}=${EMPTY}
- # Set Headers {"Content-Type":"application/x-www-form-urlencoded","Authorization":"${token}"}
- # &{LogSchemaResponse}= GET /${version}/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
-
${headers} Set variable {"Authorization":"${token}","Content-Type":"application/json"}
Create session api ${httpVersion}://${host}:${port} ${headers} verify=false
${response}= Get Request api /${version}/log/schema?logType=${logname}
diff --git a/keyword/objects/application.robot b/keyword/objects/application.robot
index a9075c8..550b2e3 100644
--- a/keyword/objects/application.robot
+++ b/keyword/objects/application.robot
@@ -1,12 +1,10 @@
*** Settings ***
Library Collections
Library RequestsLibrary
-Resource ../../variable/incoming_common_variable.txt
-Resource ../../variable/common_variable.txt
-#Resource functional_keywords.robot
+Resource ${EXECDIR}/variable/incoming_common_variable.txt
+Resource ${EXECDIR}/variable/common_variable.txt
Library Collections
-Resource ../common/common.robot
-#Library ../../../04-CustomLibrary/Library/fileOperations.py
+Resource ${EXECDIR}/keyword/common/common.robot
*** Variables ***
${applicationUrl} /application
diff --git a/keyword/objects/application_new.robot b/keyword/objects/application_new.robot
index c3f5aba..8c13c25 100644
--- a/keyword/objects/application_new.robot
+++ b/keyword/objects/application_new.robot
@@ -1,18 +1,18 @@
*** Settings ***
Library Collections
Library RequestsLibrary
-Resource ../../variable/incoming_common_variable.txt
-Resource ../../variable/common_variable.txt
+Resource ${EXECDIR}/variable/incoming_common_variable.txt
+Resource ${EXECDIR}/variable/common_variable.txt
Library yaml
Library String
-Resource ../common/common.robot
-Resource ../common/api_request.robot
+Resource ${EXECDIR}/common/common.robot
+Resource ${EXECDIR}/common/api_request.robot
Library DatabaseLibrary
Library OperatingSystem
Library Selenium2Library
-Library ../../customlib/dict_data.py
-Library ../../customlib/judge_profilelist.py
-Library ../../customlib/Alternative_content.py
+Library ${EXECDIR}/customlib/dict_data.py
+Library ${EXECDIR}/customlib/judge_profilelist.py
+Library ${EXECDIR}/customlib/Alternative_content.py
*** Variables ***
${applicationUrl} /application
diff --git a/keyword/objects/ip_objects.robot b/keyword/objects/ip_objects.robot
index 31a27af..0124bfb 100644
--- a/keyword/objects/ip_objects.robot
+++ b/keyword/objects/ip_objects.robot
@@ -1,9 +1,9 @@
*** Settings ***
Library yaml
-Resource ../../variable/incoming_common_variable.txt
-Resource ../../../variable/common_variable.txt
+Resource ${EXECDIR}/variable/incoming_common_variable.txt
+Resource ${EXECDIR}/variable/common_variable.txt
Resource object.robot
-Resource ../../common/common.robot
+Resource ${EXECDIR}/common/common.robot
Library Collections
Library json
Library String
diff --git a/keyword/objects/manage_object_body.robot b/keyword/objects/manage_object_body.robot
index 6867691..9679b48 100644
--- a/keyword/objects/manage_object_body.robot
+++ b/keyword/objects/manage_object_body.robot
@@ -1,9 +1,9 @@
*** Settings ***
Library json
Library Collections
-Resource ../../variable/incoming_common_variable.txt
-Resource ../../variable/common_variable.txt
-Resource ../../variable/policy_object_default.txt
+Resource ${EXECDIR}/variable/incoming_common_variable.txt
+Resource ${EXECDIR}/variable/common_variable.txt
+Resource ${EXECDIR}/variable/policy_object_default.txt
Resource object.robot
*** Keywords ***
diff --git a/keyword/objects/object.robot b/keyword/objects/object.robot
index 927c086..b60cca2 100644
--- a/keyword/objects/object.robot
+++ b/keyword/objects/object.robot
@@ -2,22 +2,21 @@
Library Collections
Library String
Library RequestsLibrary
-Resource ../../variable/incoming_common_variable.txt
-Resource ../../variable/common_variable.txt
-Resource ../common/functional_keywords.robot
+Resource ${EXECDIR}/variable/incoming_common_variable.txt
+Resource ${EXECDIR}/variable/common_variable.txt
+Resource ${EXECDIR}/keyword/common/functional_keywords.robot
Resource process_object_body.robot
Library Collections
-Resource ../common/common.robot
-Library ../../customlib/common/util.py
-Library ../../customlib/common/hex_convert.py
+Resource ${EXECDIR}/keyword/common/common.robot
+Library ${EXECDIR}/customlib/common/util.py
+Library ${EXECDIR}/customlib/common/hex_convert.py
Library DatabaseLibrary
-Library ../../customlib/common/common.py
+Library ${EXECDIR}/customlib/common/common.py
*** Variables ***
${objectUrl} /policy/object
${categoryUrl} /category/dict
${applicationDictUrl} /application/update/dict
${fileUploaduRL} /system/feature/update/
-
*** Keywords ***
AddLocalIPObject
#创建对象IP
@@ -25,9 +24,11 @@ AddLocalIPObject
Comment 创建IP
${testClentIP} Run Keyword If "${incomingGreClientInfo}"!="${EMPTY}" GetListClientIp ${incomingGreClientInfo} greInfo
... ELSE IF "${incomingClientInfo}"!="${EMPTY}" GetClientIp ${incomingClientInfo}
- ... ELSE IF "${incomingMobileClientInfo}"!="${EMPTY}" GetClientIp ${incomingMobileClientInfo}
+ ... ELSE IF "${incomingMobileClientInfo}"!="${EMPTY}" GetMobileClientIp ${incomingMobileClientInfo}
... ELSE IF "${incomingVoipClientInfo}"!="${EMPTY}" GetListClientIp ${incomingVoipClientInfo} voipInfo
... ELSE Set Variable ${testClentIP}
+ log ${testClentIP}
+ SET GLOBAL VARIABLE ${autoTestClientIp} ${testClentIP}
#object为IP→endpoint时的addItemList单个对象
${addItemList1} Create Dictionary isSession=endpoint ip=${testClentIP} port=0-65535 direction=0 protocol=0 isInitialize=0
#可以添加多个
@@ -99,6 +100,16 @@ GetClientIp
${testClentIP} Get From Dictionary ${clientInfo} operationIp
[Return] ${testClentIP}
+GetMobileClientIp
+ [Arguments] ${clientInfo}
+ log ${clientInfo}
+
+ ${clientInfo} Replace String ${clientInfo} ' "
+ ${clientInfo} json.loads ${clientInfo}
+ ${testClentIP} Run Keyword If "${isAirTest}"=="1" Get From Dictionary ${clientInfo} manageIp
+ ... ELSE Get From Dictionary ${clientInfo} operationIp
+ [Return] ${testClentIP}
+
GetListClientIp
[Arguments] ${listClientInfo} ${key}
${listClientInfo} Replace String ${listClientInfo} exclam !
@@ -533,6 +544,7 @@ OrangeAttribute
... ELSE IF "${protocolField}" == "TSG_FILED_GTP_APN" Set Variable apn
... ELSE Set Variable ${protocolField}
#... ELSE IF ${protocolField} == "" Set Variable qname
+ log ${appportol}
${potolId} Get From Dictionary ${appportol} ${appName}
#${attribute} Run Keyword If "${objectSubType}" == "endpoint" or "${temp}" == "True" or "${temp1}" == "True" Create Dictionary attributeValue=${attributeValue} attributeName=${attributeName} attributeType=${attributeType}
${attribute} Run Keyword If "${temp}" == "True" or "${temp1}" == "True" Create Dictionary attributeValue=${attributeValue} attributeName=${attributeName} attributeType=${attributeType}
diff --git a/keyword/objects/process_object_body.robot b/keyword/objects/process_object_body.robot
index a4099a1..11b25c1 100644
--- a/keyword/objects/process_object_body.robot
+++ b/keyword/objects/process_object_body.robot
@@ -1,9 +1,9 @@
*** Settings ***
Library json
Library Collections
-Resource ../../variable/incoming_common_variable.txt
-Resource ../../variable/common_variable.txt
-Resource ../../variable/policy_object_default.txt
+Resource ${EXECDIR}/variable/incoming_common_variable.txt
+Resource ${EXECDIR}/variable/common_variable.txt
+Resource ${EXECDIR}/variable/policy_object_default.txt
Resource manage_object_body.robot
*** Variables ***
*** Keywords ***
diff --git a/keyword/policys/policy.robot b/keyword/policys/policy.robot
index 66cb4b0..11cad56 100644
--- a/keyword/policys/policy.robot
+++ b/keyword/policys/policy.robot
@@ -15,6 +15,7 @@ Resource ${EXECDIR}/keyword/common/systemcommand.robot
Resource process_policy_body.robot
Resource ${EXECDIR}/keyword/common/common.robot
Resource ${EXECDIR}/keyword/objects/object.robot
+Resource ${EXECDIR}/keyword/system/iplibraries.robot
Resource ${EXECDIR}/keyword/common/log_variable.robot
Resource ${EXECDIR}/keyword/common/stmp_handle.robot
Resource ${EXECDIR}/keyword/common/common_interface.robot
@@ -326,10 +327,10 @@ PolilcysByTemplate
... ELSE Set Variable ${mobileInfo} ${EMPTY}
log ${mobileInfo}
#0824临时关闭
- Run Keyword If "${isAppReturn}"!="FAIL" and "${isApp}"=="1" and "${isCrontab}"!="1" and "${isAirTest}"!="1" Run Keyword And Continue On Failure CreateTestinTask ${key} ${mobileInfo} ${scriptDeviceInfo}
- ... ELSE IF "${isAppReturn}"!="FAIL" and "${isApp}"=="1" and "${isCrontab}"=="1" and "${isAirTest}"!="1" CreateTestinCrontabTask ${key}
- ... ELSE IF "${isAppReturn}"!="FAIL" and "${isApp}"=="1" and "${isAirTest}"=="1" and "${opAction}"=="add" AirTestFuncVerify ${mobileInfo} ${airTestMessage} ${key}
- ... ELSE IF "${opAction}"=="update" log No app-related operations
+ # Run Keyword If "${isAppReturn}"!="FAIL" and "${isApp}"=="1" and "${isCrontab}"!="1" and "${isAirTest}"!="1" Run Keyword And Continue On Failure CreateTestinTask ${key} ${mobileInfo} ${scriptDeviceInfo}
+ # ... ELSE IF "${isAppReturn}"!="FAIL" and "${isApp}"=="1" and "${isCrontab}"=="1" and "${isAirTest}"!="1" CreateTestinCrontabTask ${key}
+ # ... ELSE IF "${isAppReturn}"!="FAIL" and "${isApp}"=="1" and "${isAirTest}"=="1" and "${opAction}"=="add" AirTestFuncVerify ${mobileInfo} ${airTestMessage} ${key}
+ # ... ELSE IF "${opAction}"=="update" log No app-related operations
Run Keyword If "${returnaddTestClentIPFlag}"=="PASS" SET GLOBAL VARIABLE ${addTestClentIPFlag} ${addTestClentIPFlag1}
... ELSE SET GLOBAL VARIABLE ${addTestClentIPFlag} ${addTestClentIPFlag}
log ${addTestClentIPFlag}
@@ -399,6 +400,7 @@ PolilcysByTemplate
Run Keyword If "${updateStatus}" != "200" Log DisableError FOR POLICYS
${updateVerifyPolicyId} Run Keyword If "${opAction}"=="add" Set Variable ${policyId}
log ${editPolicyId}
+ Run Keyword If "${isApp}"=="1" sleep 90
END
[Return] ${objectIds} ${policyIds}
@@ -767,8 +769,12 @@ ExcuteFtpCommand
${returnFtp} ${ftp} Run Keyword And Ignore Error Write curl -m 10 ftp://${ftpHost}${ftpUrl} -u ${ftpUserName}:${ftpPassword}
${return} ${res} Run Keyword And Ignore Error Read delay=15s
- ${returnIsExcute} ${excute} Run Keyword And Ignore Error Should Contain ${res} ${hopeResult}
+ # ${returnIsExcute} ${excute} Run Keyword And Ignore Error Should Contain ${res} ${hopeResult}
+
+
+ ${returnIsExcute} ${excute} Run Keyword If "${hopeResult}"=="Connection reset by peer" Run Keyword And Ignore Error Should Contain Any ${res} ${hopeResult} timed out
+ ... ELSE Run Keyword And Ignore Error Should Contain ${res} ${hopeResult}
# ${returnIsExcute} Run Keyword If "${returnIsExcute}"=="FAIL" Run Keyword And Continue On Failure Wait Until Keyword Succeeds 5min 30sec RetryCommand ${command} ${commandRes}
# ... ELSE Set Variable ${returnIsExcute}
@@ -1214,11 +1220,16 @@ CreatePolicysAndObjects
... 返回参数:${policyId} [{'objectId': 107582, 'protocolField': 'TSG_SECURITY_SOURCE_ADDR'},{'objectId': 107583, 'protocolField': 'TSG_SECURITY_SOURCE_ADDR'}]
[Arguments] ${policyData} ${testName} ${editPolicyId}=${EMPTY}
-
+ Comment 创建SSL解密排除配置文件
${return} ${exclusionFqdn} Run Keyword And Ignore Error Get From Dictionary ${policyData} exclusionFqdn
${exclusionItemId} Run Keyword If "${return}"=="FAIL" Set Variable ${EMPTY}
... ELSE CreateSslDecryptionExclusion ${exclusionFqdn}
+ Comment 创建ip libraries
+ #10月8日
+ ${return} ${ipLibraryData} Run Keyword And Ignore Error Get From Dictionary ${policyData} ipLibrary
+ ${geoNameId} Run Keyword If "${return}"=="FAIL" Set Variable ${EMPTY}
+ ... ELSE CreateIplibraries ${ipLibraryData}
Log To Console Call CreatePolicysAndObjects
Comment 获取模板
@@ -1845,6 +1856,7 @@ AirTestFuncVerify
... ${airTestInfo}:传入设备的信息,包括ip,用户名,密码
... 以及已知的被命中的策略id
[Arguments] ${airTestInfo} ${airTestMessage} ${key} ${policyId}=${EMPTY} ${policyTemp}=${EMPTY}
+ Run Keyword If "${policyId}"=="${EMPTY}" sleep ${policyVerificationSleepSeconds}
${action} Get From Dictionary ${key} action
log ${airTestInfo}
${airTestInfo} Replace String ${airTestInfo} ' "
@@ -1864,35 +1876,42 @@ AirTestFuncVerify
${return} ${connectVpn} Run Keyword And Ignore Error Get From Dictionary ${key} connectVpn
${connectVpn} Run Keyword If "${return}"=="PASS" Set Variable ${connectVpn}
... ELSE Set Variable 0
+ ${policyName} Get From Dictionary ${key} policyName
${isUTC} Evaluate ${tsgVersion}>=22.03
${starttime} Run Keyword If "${isUTC}"=="True" Get Current Date UTC exclude_millis=True
... ELSE Get Time
#是否需要提前打开或者登陆app
- Run Keyword If "${isLogin}"=="1" or "${connectVpn}"=="1" AppLoginOrConnect ${isLogin} ${connectVpn} ${deviceId} ${app_name} ${operationIp}
+ Run Keyword If "${isLogin}"=="1" or "${connectVpn}"=="1" and "${policyId}"=="${EMPTY}" AppLoginOrConnect ${isLogin} ${connectVpn} ${deviceId} ${app_name} ${operationIp}
... ELSE Log No need to connect or login
- Run Keyword If "${policyId}"=="${EMPTY}" log 当前动作的执行为无策略执行,执行的是:${task_id}_${app_name}_${app_operation}_no_policy
- ... ELSE log 当前动作为有策略执行,执行的是:${task_id}_${app_name}_${app_operation}_with_policy
+ Run Keyword If "${policyId}"=="${EMPTY}" log 当前动作的执行为无策略执行,执行的是:${task_id}_${app_name}_${app_operation}_${policyName}_no_policy
+ ... ELSE log 当前动作为有策略执行,执行的是:${task_id}_${app_name}_${app_operation}_${policyName}_with_policy
#app执行对应的操作
- ${airTestJson} Run Keyword If "${policyId}"=="${EMPTY}" Set Variable {"test_device_id":"${deviceId}","app_name":"${app_name}","app_operation":"${app_operation}","upper_device_ip":"${operationIp}","packet_name":"","upper_device_id":"111111","report_name":"${task_id}_${app_name}_${app_operation}_no_policy"}
- ... ELSE Set Variable {"test_device_id":"${deviceId}","app_name":"${app_name}","app_operation":"${app_operation}","upper_device_ip":"${operationIp}","packet_name":"","upper_device_id":"111111","report_name":"${task_id}_${app_name}_${app_operation}_with_policy"}
+ ${airTestJson} Run Keyword If "${policyId}"=="${EMPTY}" Set Variable {"test_device_id":"${deviceId}","app_name":"${app_name}","app_operation":"${app_operation}","upper_device_ip":"${operationIp}","packet_name":"","upper_device_id":"111111","report_name":"${task_id}_${policyName}_no_policy"}
+ ... ELSE Set Variable {"test_device_id":"${deviceId}","app_name":"${app_name}","app_operation":"${app_operation}","upper_device_ip":"${operationIp}","packet_name":"","upper_device_id":"111111","report_name":"${task_id}_${policyName}_with_policy"}
${response} BasePostRequest task ${airTestJson}
${returnCode} Set Variable ${response['success']}
${verifyReturn} ${verify} Run Keyword And Ignore Error Run Keyword If "${action}"!="deny" Should Be Equal As Integers ${returnCode} 0
... ELSE IF "${action}"=="deny" and "${policyId}"=="${EMPTY}" Should Be Equal As Integers ${returnCode} 0
... ELSE IF "${action}"=="deny" and "${policyId}"!="${EMPTY}" Should Be Equal As Integers ${returnCode} 1
+ Comment 如果非deny动作,校验完效果后,关闭app,否则对查询日志有影响
+ Run Keyword If "${policyId}"!="${EMPTY}" BasePostRequest task {"test_device_id":"${deviceId}","app_name":"${app_name}","app_operation":"close","upper_device_ip":"${operationIp}","packet_name":"","upper_device_id": "111111","report_name":"${task_id}_${app_name}_close"}
${logType} Get From Dictionary ${key} logType
${logQueryParam} Get From Dictionary ${airTestMessage} logQueryParam
- ${endtime} Run Keyword If "${isUTC}"=="True" Get Current Date UTC exclude_millis=True
+ ${endtime} Run Keyword If "${isUTC}"=="True" Get Current Date UTC increment=00:10:00 exclude_millis=True
... ELSE Get Time
+ Comment 日志查询
${logReturn} ${log} Run Keyword And Ignore Error Run Keyword If "${policyId}"=="${EMPTY}" log Log verification is not required
- ... ELSE Run Keyword And Continue On Failure GetLogListMulti ${logType} ${startTime} ${endTime} ${manageIp} ${policyId} ${logQueryParam}
- log ${policyTemp}
- Run Keyword If ("${verifyReturn}"=="FAIL" or "${logReturn}"=="FAIL") and "${policyId}"!="${EMPTY}" Run Keywords Run Keyword And Continue On Failure DisablePolicies ${policyTemp} disable AND sleep ${policyVerificationSleepSeconds} AND log 当前执行为无策略但是捕包执行app动作,执行的是:${task_id}_${app_name}_${app_operation}_no_policy_packet
- ${airTestJson} Run Keyword If ("${verifyReturn}"=="FAIL" or "${logReturn}"=="FAIL") and "${policyId}"!="${EMPTY}" Set Variable {"test_device_id":"${deviceId}","app_name":"${app_name}","app_operation":"${app_operation}","upper_device_ip":"${operationIp}","packet_name":"${packet_name}","upper_device_id": "111111","report_name":"${task_id}_${app_name}${app_operation}_no_policy_packet"}
+ ... ELSE Run Keyword And Ignore Error GetLogListMulti ${logType} ${startTime} ${endTime} ${manageIp} ${policyId} ${logQueryParam}
+ ${logReturn} Run Keyword If "${logReturn}"=="FAIL" and "${policyId}"!="${EMPTY}" Run Keyword And Continue On Failure Wait Until Keyword Succeeds 7min 30sec RetryGetLog ${logType} ${startTime} ${endTime} ${operationIp} ${logPolicyId} ${logQueryParam} ${isUTC}
+ ... ELSE Set Variable ${logReturn}
+ log ${policyId}
+ Run Keyword If ("${verifyReturn}"=="FAIL" or "${logReturn}"=="FAIL") and "${policyId}"!="${EMPTY}" Run Keywords Run Keyword And Continue On Failure DisablePolicies ${policyTemp} disable AND sleep ${policyVerificationSleepSeconds} AND log 当前执行为无策略但是捕包执行app动作,执行的是:${task_id}_${policyName}_no_policy_packet
+ ${airTestJson} Run Keyword If ("${verifyReturn}"=="FAIL" or "${logReturn}"=="FAIL") and "${policyId}"!="${EMPTY}" Set Variable {"test_device_id":"${deviceId}","app_name":"${app_name}","app_operation":"${app_operation}","upper_device_ip":"${operationIp}","packet_name":"${policyName}","upper_device_id": "111111","report_name":"${task_id}_${policyName}_no_policy_packet"}
... ELSE Set Variable ${airTestJson}
${response} Run Keyword If ("${verifyReturn}"=="FAIL" or "${logReturn}"=="FAIL") and "${policyId}"!="${EMPTY}" BasePostRequest task ${airTestJson}
... ELSE Set Variable ${response}
+ Run Keyword If ("${verifyReturn}"=="FAIL" or "${logReturn}"=="FAIL") and "${policyId}"!="${EMPTY}" BasePostRequest task {"test_device_id":"${deviceId}","app_name":"${app_name}","app_operation":"close","upper_device_ip":"${operationIp}","packet_name":"","upper_device_id": "111111","report_name":"${task_id}_${app_name}_close"}
Run Keyword If "${policyId}"!="${EMPTY}" Should Be Equal As Strings "${logReturn}" "PASS"
... ELSE log no need to verify log
Should Be Equal As Strings "${verifyReturn}" "PASS"
@@ -1905,4 +1924,8 @@ AppLoginOrConnect
${airTestJson} Run Keyword If "${isLogin}"=="1" Set Variable {"test_device_id":"${deviceId}","app_name":"${app_name}","app_operation":"login","upper_device_ip":"${operationIp}","packet_name":"","upper_device_id": "111111","report_name":"${task_id}_${app_name}_login"}
... ELSE IF "${connectVpn}"=="1" Set Variable {"test_device_id":"${deviceId}","app_name":"${app_name}","app_operation":"connectVpn","upper_device_ip":"${operationIp}","packet_name":"","upper_device_id": "111111","report_name":"${task_id}_${app_name}_connectVpn"}
${response} BasePostRequest task ${airTestJson}
- [Return] ${response} \ No newline at end of file
+ [Return] ${response}
+
+QuitApp
+ [Arguments] ${deviceId} ${app_name} ${operationIp}
+ Set Variable \ No newline at end of file
diff --git a/keyword/system/administration/administering_access_tokens.robot b/keyword/system/administration/administering_access_tokens.robot
index f72e905..324ecc3 100644
--- a/keyword/system/administration/administering_access_tokens.robot
+++ b/keyword/system/administration/administering_access_tokens.robot
@@ -4,15 +4,15 @@ Library Collections
Library RequestsLibrary
Library DateTime
Library String
-Resource ../../../variable/incoming_common_variable.txt
-Resource ../../../variable/common_variable.txt
-Resource ../../common/common.robot
-Resource ../../common/api_request.robot
+Resource ${EXECDIR}/variable/incoming_common_variable.txt
+Resource ${EXECDIR}/variable/common_variable.txt
+Resource ${EXECDIR}/common/common.robot
+Resource ${EXECDIR}/common/api_request.robot
Library DatabaseLibrary
Library OperatingSystem
Library Selenium2Library
-Library ../../../customlib/dict_data.py
-Library ../../../customlib/judge_profilelist.py
+Library ${EXECDIR}/customlib/dict_data.py
+Library ${EXECDIR}/customlib/judge_profilelist.py
*** Variables ***
${accessTokenUrl} /sys/accesstoken
diff --git a/keyword/system/iplibraries.robot b/keyword/system/iplibraries.robot
index 55cbbb9..5c73d39 100644
--- a/keyword/system/iplibraries.robot
+++ b/keyword/system/iplibraries.robot
@@ -4,55 +4,116 @@ Library Collections
Library RequestsLibrary
Library DateTime
Library String
-Resource ../../variable/incoming_common_variable.txt
-Resource ../../variable/common_variable.txt
-Resource ../common/common.robot
-Resource ../common/api_request.robot
-Library DatabaseLibrary
+Resource ${EXECDIR}/variable/incoming_common_variable.txt
+Resource ${EXECDIR}/variable/common_variable.txt
+Resource ${EXECDIR}/keyword/common/common.robot
Library OperatingSystem
-Library Selenium2Library
-Library ../../customlib/dict_data.py
-Library ../../customlib/judge_profilelist.py
+Library ${EXECDIR}/customlib/dict_data.py
+Library ${EXECDIR}/customlib/judge_profilelist.py
*** Variables ***
${iplibrariesUrl} /geolocation/dict
${ipLibImportUrl} /geolocation/dict/batch
${EMPTY}
*** Keywords ***
-IPLibrariesCreate
- [Arguments] ${filepath} ${opAction}=add ${Id}=1
- [Documentation] 测试schsedules功能时调用, 参数${filepath}为文件路径 ${opAction}新建还是修改,code 接口返回的code码,为空就代表200
- ${YAML}= Get File ${filepath}
- ${iplibrariesIdList} Create List
- log ${Id}
- ${yameData}= yaml.Safe Load ${YAML}
- FOR ${list} ${iplibrariesDataKey} IN ENUMERATE @{yameData}
- ${code} Get From Dictionary ${yameData}[${iplibrariesDataKey}] code
- ${iplibrariesData} Get From Dictionary ${yameData}[${iplibrariesDataKey}] list
- ${iplibrariesId} = CreateIPLibraries ${iplibrariesData} ${code} ${opAction} ${Id}
- Append To List ${iplibrariesIdList} ${iplibrariesId}
- END
- [Return] ${iplibrariesIdList}
+# IPLibrariesCreate
+ # [Arguments] ${filepath} ${opAction}=add ${Id}=1
+ # [Documentation] 测试schsedules功能时调用, 参数${filepath}为文件路径 ${opAction}新建还是修改,code 接口返回的code码,为空就代表200
+ # ${YAML}= Get File ${filepath}
+ # ${iplibrariesIdList} Create List
+ # log ${Id}
+ # ${yameData}= yaml.Safe Load ${YAML}
+ # FOR ${list} ${iplibrariesDataKey} IN ENUMERATE @{yameData}
+ # ${code} Get From Dictionary ${yameData}[${iplibrariesDataKey}] code
+ # ${iplibrariesData} Get From Dictionary ${yameData}[${iplibrariesDataKey}] list
+ # ${iplibrariesId} = CreateIPLibraries ${iplibrariesData} ${code} ${opAction} ${Id}
+ # Append To List ${iplibrariesIdList} ${iplibrariesId}
+ # END
+ # [Return] ${iplibrariesIdList}
+
+# CreateIPLibraries
+ # [Documentation]
+ # ... 必传参数:Schsedules请求数据 code 接口返回的code码,为空就代表200
+ # ... 返回值:${Id}是IPLibraries的id
+ # [Arguments] ${iplibrariesData} ${code} ${opAction}=add ${Id}=1
+ # ${iplibrariesMode}= Get File ${path}/data/template/iplibrariesmode.yaml
+ # ${iplibrariesModeData}= yaml.Safe Load ${iplibrariesMode}
+ # ${iplibrariesModeData1} Get From Dictionary ${iplibrariesModeData} iplibrariesmode
+ # ${iplibrariesModeData2} = Evaluate str(${iplibrariesModeData1})
+ # ${iplibrariesDataStr1} Replace String Using Regexp ${iplibrariesModeData2} opAction': (.*?), 'returnData opAction': '${opAction}', 'returnData
+ # ${iplibrariesDataStr1} Replace String Using Regexp ${iplibrariesDataStr1} list': (.*?)}]}]} list': ${iplibrariesData}}
+ # ${iplibrariesDataStr1} Replace String ${iplibrariesDataStr1} 'opAction': 'add' 'opAction': '${opAction}'
+ # ${geoNameId} Run Keyword If "${opAction}"=="add" evaluate random.randint(1000,1000000) random
+ # ... ELSE Set Variable ${Id}
+ # ${iplibrariesDataStr1} Replace String ${iplibrariesDataStr1} 'geoNameId': 1 'geoNameId': ${geoNameId}
+ # log ${iplibrariesDataStr1}
+ # ${bodyJson} dictconversion ${iplibrariesDataStr1}
+ # ${Id1} IPLibrariesRequest ${bodyJson} ${code} ${opAction} ${geoNameId}
+ # [Return] ${Id1}
+
+CreateIplibraries
+ [Arguments] ${ipLibraryData}
+ Comment 获取模板
+ Comment ${ipLibraryJson}策略模板取自全局变量
+ log ${ipLibraryJson}
+ ${ipLibraryJson} Set Variable ${ipLibraryJson}
+ ${return} ${geoNameId} Run Keyword And Ignore Error Get From Dictionary ${ipLibraryData} geoNameId
+ ${ipLibraryJson} = Run Keyword If "${return}"!="FAIL" and "${geoNameId}" != "None" Replace String ${ipLibraryJson} "geoNameId": "" "geoNameId": "${geoNameId}"
+ ... ELSE Set Variable ${ipLibraryJson}
+
+ ${return} ${continentFull} Run Keyword And Ignore Error Get From Dictionary ${ipLibraryData} continentFull
+ ${ipLibraryJson} = Run Keyword If "${return}"!="FAIL" and "${continentFull}" != "None" Replace String ${ipLibraryJson} "continentFull": null "continentFull": "${continentFull}"
+ ... ELSE Set Variable ${ipLibraryJson}
+
+ ${return} ${superAdministrativeArea} Run Keyword And Ignore Error Get From Dictionary ${ipLibraryData} superAdministrativeArea
+ ${ipLibraryJson} = Run Keyword If "${return}"!="FAIL" and "${superAdministrativeArea}" != "None" Replace String ${ipLibraryJson} "superAdministrativeArea": null "superAdministrativeArea": "${superAdministrativeArea}"
+ ... ELSE Set Variable ${ipLibraryJson}
+
+ ${return} ${administrativeArea} Run Keyword And Ignore Error Get From Dictionary ${ipLibraryData} administrativeArea
+ ${ipLibraryJson} = Run Keyword If "${return}"!="FAIL" and "${administrativeArea}" != "None" Replace String ${ipLibraryJson} "administrativeArea": null "administrativeArea": "${administrativeArea}"
+ ... ELSE Set Variable ${ipLibraryJson}
+
+ ${return} ${subAdministrativeArea} Run Keyword And Ignore Error Get From Dictionary ${ipLibraryData} subAdministrativeArea
+ ${ipLibraryJson} = Run Keyword If "${return}"!="FAIL" and "${subAdministrativeArea}" != "None" Replace String ${ipLibraryJson} "subAdministrativeArea": null "subAdministrativeArea": "${subAdministrativeArea}"
+ ... ELSE Set Variable ${ipLibraryJson}
+
+ ${return} ${locality} Run Keyword And Ignore Error Get From Dictionary ${ipLibraryData} locality
+ ${ipLibraryJson} = Run Keyword If "${return}"!="FAIL" and "${locality}" != "None" Replace String ${ipLibraryJson} "locality": null "locality": "${locality}"
+ ... ELSE Set Variable ${ipLibraryJson}
+
+ ${return} ${dependentLocality} Run Keyword And Ignore Error Get From Dictionary ${ipLibraryData} dependentLocality
+ ${ipLibraryJson} = Run Keyword If "${return}"!="FAIL" and "${dependentLocality}" != "None" Replace String ${ipLibraryJson} "dependentLocality": null "dependentLocality": "${dependentLocality}"
+ ... ELSE Set Variable ${ipLibraryJson}
+
+ ${return} ${doubleDependentLocality} Run Keyword And Ignore Error Get From Dictionary ${ipLibraryData} doubleDependentLocality
+ ${ipLibraryJson} = Run Keyword If "${return}"!="FAIL" and "${doubleDependentLocality}" != "None" Replace String ${ipLibraryJson} "doubleDependentLocality": null "doubleDependentLocality": "${doubleDependentLocality}"
+ ... ELSE Set Variable ${ipLibraryJson}
+
+ ${return} ${opAction} Run Keyword And Ignore Error Get From Dictionary ${ipLibraryData} opAction
+ ${ipLibraryJson} = Run Keyword If "${return}"!="FAIL" and "${opAction}" != "None" Replace String ${ipLibraryJson} "opAction": "add" "opAction": "${opAction}"
+ ... ELSE Set Variable ${ipLibraryJson}
+
+ ${return} ${startIp} Run Keyword And Ignore Error Get From Dictionary ${ipLibraryData} startIp
+ ${startIp} Run Keyword If "${startIp}"=="default" Set Variable ${autoTestClientIp}
+ ... ELSE Set Variable ${startIp}
+ ${ipLibraryJson} = Run Keyword If "${return}"!="FAIL" and "${startIp}" != "None" Replace String ${ipLibraryJson} "startIp": "1.1.1.1" "startIp": "${startIp}"
+ ... ELSE Set Variable ${ipLibraryJson}
+
+ ${return} ${endIp} Run Keyword And Ignore Error Get From Dictionary ${ipLibraryData} endIp
+ ${endIp} Run Keyword If "${endIp}"=="default" Set Variable ${autoTestClientIp}
+ ... ELSE Set Variable ${endIp}
+ ${ipLibraryJson} = Run Keyword If "${return}"!="FAIL" and "${endIp}" != "None" Replace String ${ipLibraryJson} "endIp": "1.1.1.1" "endIp": "${endIp}"
+ ... ELSE Set Variable ${ipLibraryJson}
+ log ${ipLibraryJson}
+ ${response} Run Keyword If "${opAction}"=="add" BasePostRequestForV2 ${iplibrariesUrl} ${ipLibraryJson} ${version}
+ ... ELSE IF "${opAction}"=="update" BaseEditRequestForV2 ${iplibrariesUrl} ${ipLibraryJson} ${version}
+ ... ELSE IF "${opAction}"=="delete" DeleteIPLibrariesIds ${geoNameId}
+ # ${geoNameId} Set Variable ${response}[data][list][0][geoNameId]
+ ${rescode} Set Variable ${response['code']}
+ Should Be Equal As Strings ${rescode} 200
+ SET GLOBAL VARIABLE ${ipLibraryGeoNameId} ${geoNameId}
+ [Return] ${geoNameId}
-CreateIPLibraries
- [Documentation]
- ... 必传参数:Schsedules请求数据 code 接口返回的code码,为空就代表200
- ... 返回值:${Id}是IPLibraries的id
- [Arguments] ${iplibrariesData} ${code} ${opAction}=add ${Id}=1
- ${iplibrariesMode}= Get File ${path}/data/template/iplibrariesmode.yaml
- ${iplibrariesModeData}= yaml.Safe Load ${iplibrariesMode}
- ${iplibrariesModeData1} Get From Dictionary ${iplibrariesModeData} iplibrariesmode
- ${iplibrariesModeData2} = Evaluate str(${iplibrariesModeData1})
- ${iplibrariesDataStr1} Replace String Using Regexp ${iplibrariesModeData2} opAction': (.*?), 'returnData opAction': '${opAction}', 'returnData
- ${iplibrariesDataStr1} Replace String Using Regexp ${iplibrariesDataStr1} list': (.*?)}]}]} list': ${iplibrariesData}}
- ${iplibrariesDataStr1} Replace String ${iplibrariesDataStr1} 'opAction': 'add' 'opAction': '${opAction}'
- ${geoNameId} Run Keyword If "${opAction}"=="add" evaluate random.randint(1000,1000000) random
- ... ELSE Set Variable ${Id}
- ${iplibrariesDataStr1} Replace String ${iplibrariesDataStr1} 'geoNameId': 1 'geoNameId': ${geoNameId}
- log ${iplibrariesDataStr1}
- ${bodyJson} dictconversion ${iplibrariesDataStr1}
- ${Id1} IPLibrariesRequest ${bodyJson} ${code} ${opAction} ${geoNameId}
- [Return] ${Id1}
IPLibrariesRequest
[Arguments] ${bodyJson} ${code} ${opAction} ${recordId}
[Documentation] 请求接口创建,返回id 返回格式:int数值 ${bodyJson}参数是请求策略接口的jison格式 code 接口返回的code码,为空就代表200
@@ -76,15 +137,14 @@ DeleteIPLibrariesIds
${iplibrariesIds} Set Variable [${iplibrariesIds}]
log ${iplibrariesIds}
log iplibrariesIds
- Run Keyword If "${iplibrariesIds}"=="[]" log No Deleteschsedules
+ ${response} Run Keyword If "${iplibrariesIds}"=="[]" log No Deleteschsedules
... ELSE DeleteIPLibrariesIds1 ${iplibrariesIds}
+ [Return] ${response}
DeleteIPLibrariesIds1
[Arguments] ${iplibrariesIds}
- ${response} BaseDeleteRequest /${version}/${iplibrariesUrl} {"geoNameIds":${iplibrariesIds}}
- ${response_code} Get From Dictionary ${response} code
- Should Be Equal As Strings ${response_code} 200
- ${response} Convert to String ${response}
+ ${response} BaseDeleteRequest /${version}/${iplibrariesUrl} {"geoNameIds":${iplibrariesIds},"vsysId":1}
log ${response}
+ [Return] ${response}
QueryRequest
[Arguments] ${requestUri} ${filepath} ${code}=${EMPTY}
diff --git a/keyword/system/trouble_shooting/packet_capture.robot b/keyword/system/trouble_shooting/packet_capture.robot
index 85f993f..d987979 100644
--- a/keyword/system/trouble_shooting/packet_capture.robot
+++ b/keyword/system/trouble_shooting/packet_capture.robot
@@ -4,15 +4,15 @@ Library Collections
Library RequestsLibrary
Library DateTime
Library String
-Resource ../../../variable/incoming_common_variable.txt
-Resource ../../../variable/common_variable.txt
-Resource ../../common/common.robot
-Resource ../../common/api_request.robot
+Resource ${EXECDIR}/variable/incoming_common_variable.txt
+Resource ${EXECDIR}/variable/common_variable.txt
+Resource ${EXECDIR}/keyword/common/common.robot
+Resource ${EXECDIR}/keyword/common/api_request.robot
Library DatabaseLibrary
Library OperatingSystem
Library Selenium2Library
-Library ../../../customlib/dict_data.py
-Library ../../../customlib/judge_profilelist.py
+Library ${EXECDIR}/customlib/dict_data.py
+Library ${EXECDIR}/customlib/judge_profilelist.py
*** Variables ***
${packetPolicyUrl} /troubleshooting/packetcapture/policy
@@ -35,13 +35,16 @@ PacketPoliciesByTemplate
${verifyPolicyId} Run Keyword If "${opAction}"=="add" Set Variable ${policyId}
... ELSE Set Variable ${editPolicyId}
${captureBytes} PackecCaptureVerify ${key} ${verifyPolicyId}
- ${updateStatus} Run Keyword And Continue On Failure DisablePacketCapture ${opAction} ${verifyPolicyId}
+
+ # ${updateStatus} Run Keyword And Continue On Failure DisablePacketCapture disable ${verifyPolicyId}
# ${taskId} GetTaskId ${policyIds}
# sleep ${packetCaptureTime}
# ${captureBytes} PacketCaptureSchedule ${taskId}
END
[Return] ${policyId}
+GetDisablePolicyId
+ [Arguments] ${verifyPolicyId}
DisablePacketCapture
[Documentation] 根据策略id组织策略修改接口的字符串
[Arguments] ${opAction} ${policyId}
@@ -59,7 +62,7 @@ EditPacketCapture
[Arguments] ${policyList} ${code}=null
Log To Console Call EditPolicies
${bodyJson} json.Dumps ${policyList}
- ${response} BaseEditRequestForV2 ${${packetPolicyUrl}} ${bodyJson} ${version}
+ ${response} BaseEditRequestForV2 ${packetPolicyUrl} ${bodyJson} ${version}
${rescode} Set Variable ${response['code']}
Run Keyword If "${code}" == "${Empty}" or "${code}" == "null" Should Be Equal As Strings ${rescode} 200
... ELSE Should Be Equal As Strings ${rescode} ${code}
diff --git a/other/data/security/http/security-http-allow-fqdn-exactly-data.yaml b/other/data/security/http/security-http-allow-fqdn-exactly-data.yaml
index 501d7c7..06d05bd 100644
--- a/other/data/security/http/security-http-allow-fqdn-exactly-data.yaml
+++ b/other/data/security/http/security-http-allow-fqdn-exactly-data.yaml
@@ -28,8 +28,123 @@
-
"queryFiledKey": "http_host"
"queryValue": "scoutbahamas.org"
+ -
+ "queryFiledKey": "common_client_location"
+ "queryValue": "China.Beijing Test.XiChengQu Beijing Test.Desheng Test.Yu Min Lu Test.33号 Test.Xixingang Test"
+ "isValid": 1
+ "scheduleId":
+ "ipLibrary":
+ "opAction": "add"
+ "geoNameId": 961127
+ "continentFull": "Asia"
+ "superAdministrativeArea": "Beijing Test"
+ "administrativeArea": "XiChengQu Beijing Test"
+ "subAdministrativeArea": "Desheng Test"
+ "locality": "Yu Min Lu Test"
+ "dependentLocality": "33号 Test"
+ "doubleDependentLocality": "Xixingang Test"
+ "startIp": "default"
+ "endIp": "default"
+ "condation":
+ -
+ "protocolField": "TSG_FIELD_HTTP_HOST"
+ "objectType": "fqdn"
+ "objectSubType": ""
+ "objectList":
+ - "addItemList":
+ - "keywordArray":
+ - "$scoutbahamas.org"
+ -
+ "opAction": "update"
+ "isEdit": 1
+ "returnData": 1
+ "policyName": "security-http-allow-fqdn-suffix-002"
+ "policyType": "tsg_security"
+ "logType": "security_event"
+ "action": "allow"
+ "isGre": 0
+ "userTags": ""
+ "doBlacklist": 0
+ "doLog": 1
+ "policyDesc": "autotest"
+ "effectiveRange":
+ "userRegion":
+ "protocol": "http"
+ "appIdObjects":
+ - "http"
+ "appSelectorObjects":
+ "isTestMachine": 1
+ "testMachine":
+ -
+ "hopeSuccessNumber": 1
+ "command": "wget -q -O- http://scoutbahamas.org/"
+ "commandRes": "ScoutBahamas"
+ "logQueryParam":
+ -
+ "queryFiledKey": "http_host"
+ "queryValue": "scoutbahamas.org"
+ -
+ "queryFiledKey": "common_client_location"
+ "queryValue": "China.Beijing Update.XiChengQu Beijing Update.Desheng Update.Yu Min Lu Update.33号 Update.Xixingang Update"
+ "isValid": 1
+ "scheduleId":
+ "ipLibrary":
+ "opAction": "update"
+ "geoNameId": 961127
+ "continentFull": "Asia"
+ "superAdministrativeArea": "Beijing Update"
+ "administrativeArea": "XiChengQu Beijing Update"
+ "subAdministrativeArea": "Desheng Update"
+ "locality": "Yu Min Lu Update"
+ "dependentLocality": "33号 Update"
+ "doubleDependentLocality": "Xixingang Update"
+ "startIp": "default"
+ "endIp": "default"
+ "condation":
+ -
+ "protocolField": "TSG_FIELD_HTTP_HOST"
+ "objectType": "fqdn"
+ "objectSubType": ""
+ "objectList":
+ - "addItemList":
+ - "keywordArray":
+ - "$scoutbahamas.org"
+ -
+ "opAction": "add"
+ "returnData": 1
+ "policyName": "security-http-allow-fqdn-suffix-003"
+ "policyType": "tsg_security"
+ "logType": "security_event"
+ "action": "allow"
+ "isGre": 0
+ "userTags": ""
+ "doBlacklist": 0
+ "doLog": 1
+ "policyDesc": "autotest"
+ "effectiveRange":
+ "userRegion":
+ "protocol": "http"
+ "appIdObjects":
+ - "http"
+ "appSelectorObjects":
+ "isTestMachine": 1
+ "testMachine":
+ -
+ "hopeSuccessNumber": 1
+ "command": "wget -q -O- http://scoutbahamas.org/"
+ "commandRes": "ScoutBahamas"
+ "logQueryParam":
+ -
+ "queryFiledKey": "http_host"
+ "queryValue": "scoutbahamas.org"
+ -
+ "queryFiledKey": "common_client_location"
+ "queryValue": "empty"
"isValid": 1
- "scheduleId":
+ "scheduleId":
+ "ipLibrary":
+ "opAction": "delete"
+ "geoNameId": 961127
"condation":
-
"protocolField": "TSG_FIELD_HTTP_HOST"
@@ -38,5 +153,5 @@
"objectList":
- "addItemList":
- "keywordArray":
- - "$scoutbahamas.org"
+ - "$scoutbahamas.org"
\ No newline at end of file
diff --git a/other/data/template/template.yaml b/other/data/template/template.yaml
index 1c6961a..5b32e4a 100644
--- a/other/data/template/template.yaml
+++ b/other/data/template/template.yaml
@@ -5,6 +5,7 @@
"opAction": "add"
"returnData": 1
"vsysId": 1
+ "namespaceId": 1
"objectList":
-
"objectId":
@@ -12,7 +13,7 @@
"objectSubType": "endpoint"
"isValid": 1
"isInitialize": 0
- "isShared": 0
+ "isShared": 1
"isExclusion": 0
"objectName": "auttest单ip指定端口"
"objectDesc": "test"
@@ -215,11 +216,12 @@
"max": "tls13"
"mirror_client": 0
"allow_http2": 0
-############decryption exclusion 模板################
+############decryption exclusion 模板###############
"ssl_decryption_exclusion_template":
"opAction": "add"
"itemType": "fqdn"
"objectId": 1
+ "vsysId": 1
"itemList":
"itemId": ""
"keywordArray":
@@ -230,5 +232,29 @@
"itemName": ""
"itemDesc": "test"
"returnData": 1
+##############ip library 模板 #######################
+"iplibrariesmode":
+ "opAction": "add"
+ "returnData": 1
+ "list":
+ - "geoNameId": ""
+ "continentFull": "Asia"
+ "continent": "Asia"
+ "superAdministrativeArea":
+ "administrativeArea":
+ "subAdministrativeArea":
+ "vsysId": 1
+ "locality":
+ "dependentLocality":
+ "doubleDependentLocality":
+ "continentFull": "Asia"
+ "countryFull": "China"
+ "country": "China"
+ "latitude": 22.4
+ "longitude": 112.9
+ "ipList":
+ - "addrType": 4
+ "startIp": "1.1.1.1"
+ "endIp": "1.1.1.1"