summaryrefslogtreecommitdiff
path: root/case/security
diff options
context:
space:
mode:
Diffstat (limited to 'case/security')
-rw-r--r--case/security/dns/deny_dns_test.robot36
-rw-r--r--case/security/http/demo.robot97
2 files changed, 133 insertions, 0 deletions
diff --git a/case/security/dns/deny_dns_test.robot b/case/security/dns/deny_dns_test.robot
new file mode 100644
index 0000000..2cd7c2a
--- /dev/null
+++ b/case/security/dns/deny_dns_test.robot
@@ -0,0 +1,36 @@
+*** Settings ***
+Force Tags api objects ip
+Library OperatingSystem
+Library Selenium2Library
+Resource ../../../keyword/objects/object.robot
+Resource ../../../keyword/policys/policy.robot
+Resource ../../../keyword/policys/process_policy_body.robot
+Resource ../../../keyword/common/file_operation.robot
+
+*** Variables ***
+${policyIds} ${EMPTY}
+${objectids} ${EMPTY}
+
+*** Test Cases ***
+
+security_policy_allow_ssl
+ [Tags] fqdn完整匹配 update policy:ip geo
+ Comment 创建fqdn
+ ${addItemList1} Create Dictionary keywordArray=$homebank.kz isHexbin=${0}
+ ${addItemLists} Create list ${addItemList1}
+ ${objectDict} Create Dictionary objectType=fqdn objectSubType=fqdn isValid=${1} addItemList=${addItemLists}
+ ${rescode} ${objectId} AddObjects ${1} ${objectDict}
+ Comment 创建ip geo
+ ${addItemList1} Create Dictionary keywordArray=XXG地区.*
+ ${addItemLists} Create list ${addItemList1}
+ ${objectDict} Create Dictionary objectType=ip objectSubType=geo_location isValid=${1} addItemList=${addItemLists}
+ ${rescode} ${objectId1} AddObjects ${1} ${objectDict}
+ Comment 创建安全策略
+ ${policyDict} Create Dictionary policyName=SecurityPolicy-Allow-Ssl-00001 policyType=tsg_security policyDesc=autotest action=allow userRegion={"protocol":"SSL"} filterList=${objectId}|TSG_FIELD_SSL_SNI isValid=${1} appIdObjects=${SSL_ID}
+ log ${policyDict}
+ ${rescode} ${policyId} AddPolicies 1 ${policyDict} v2
+ ${policyId} GetPids ${policyId}
+ ${policyId} Set Variable ${policyId}[0]
+ InsertObjectIdToFile allow_ssl_objectId ${objectId}
+ InsertObjectIdToFile allow_ssl_objectId2 ${objectId1}
+ InsertObjectIdToFile allow_ssl_policyId ${policyId} \ No newline at end of file
diff --git a/case/security/http/demo.robot b/case/security/http/demo.robot
new file mode 100644
index 0000000..7c63066
--- /dev/null
+++ b/case/security/http/demo.robot
@@ -0,0 +1,97 @@
+*** Settings ***
+Test Teardown DeletePolicyAndObjectAndOther
+Force Tags admission basic
+Library OperatingSystem
+Resource ../../../keyword/common/command.robot
+Resource ../../../keyword/objects/object.robot
+Resource ../../../keyword/policys/policy.robot
+Resource ../../../keyword/common/clear_data.robot
+Resource ../../../keyword/common/verify.robot
+*** Variables ***
+${createPolicyIds} ${EMPTY}
+${createObjectIds} ${EMPTY}
+
+*** Test Cases ***
+policy_http_allow
+ log ${TEST NAME}
+ ${objectIds} ${policyIds} PolilcysByTemplate ${path}/data/security/http/demo_data.yaml ${TEST NAME}
+
+
+test_json
+ ${a} set variable {"datafomat": "complate", "opAction": "add", "returnData": 1, "objectList": [{"objectId": null, "objectType": "ip", "objectSubType": "endpoint", "isValid": 1, "isInitialize": 0, "isExclusion": 0, "objectName": "auttest\u5355ip\u6307\u5b9a\u7aef\u53e3", "objectDesc": "test", "subObjectIds": [null], "addItemList": [{"ip": "255.255.255.254", "port": "65535"}, {"ip": "255.255.255.254", "port": "65535"}], "updateItemList": [null], "deleteItemIds": [null], "iconColor": "#31739C"}]}
+
+ ${bodyJson} json.Loads ${a}
+ log ${bodyJson}
+
+ Replace String ${bodyJson} [null] []
+ log ${bodyJson}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+policy_dns_allow_ip_potol
+ [Tags] admission basic api adc
+ Comment 全流程:创建对象-》创建策略-》策略验证-》策略效果验证-》日志验证
+ log ${TEST NAME}
+ Comment 创建Allow策略
+ ${policyIds} CreatePolilcys ${path}/data/security/dns ${TEST NAME}.yaml ${TEST NAME}
+ ${objType} = Evaluate type(${policyIds})
+ #功能端验证
+ #Sleep ${policyVerificationSleepSeconds}s
+ Comment 策略验证
+
+ Comment 效果验证
+ ${windowsCommand} set variable nslookup -d www.facebook.com
+ ${LinuxCommand} set variable nslookup www.facebook.com
+ ${commandstr} run keyword if '${systemType}'=='Windows' set variable nslookup -d www.facebook.com
+ ... ELSE set variable nslookup www.facebook.com
+ ${stringlist} run keyword if '${systemType}'=='Windows' Create List www.facebook.com canonical name = star-mini.c10r.facebook.com。
+ ... ELSE Create List www.facebook.com canonical name = star-mini.c10r.facebook.com
+ ${rescode} SystemCommandContains ${commandstr} ${stringlist}
+ ${trueCounter} Run Keyword If '${rescode}'=='True' SystemCommandsRetry ${commandstr} ${stringlist}
+ ... ELSE set variable 1
+
+ ${rescode} Evaluate ${trueCounter}>${0}
+ ${lastRescode} Should Be Equal "${rescode}" "True"
+ #日志验证
+
+
+
+
+
+
+
+
+
+
+
+
+
+ \ No newline at end of file