This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
dongxiaoyan-tsg-autotest/01-TestCase/tsg_adc/multi_step/b_Deny_Dns_Tests.robot

111 lines
8.3 KiB
Plaintext
Raw Normal View History

2020-06-23 21:04:14 +08:00
*** Settings ***
Force Tags tsg_adc_wp security_policy adc_verify
Library OperatingSystem
Resource ../../../02-Keyword/tsg_adc/SystemCommand.robot
Resource ../../../02-Keyword/tsg_bfapi/PolicyObject.robot
Resource ../../../02-Keyword/tsg_bfapi/LogVariable.robot
Resource ../../../02-Keyword/tsg_adc/FileOperation.robot
Resource ../../../02-Keyword/tsg_bfapi/policy_object/Policy.robot
2021-05-17 13:24:29 +06:00
# Resource ../../../03-Variable/ApplicationID.txt
Resource ../../../05-Other/AllFlowCaseVariable.txt
2020-06-23 21:04:14 +08:00
*** Test Cases ***
SecurityPolicy-Deny-Dns-00001
Comment 功能端验证HTTP验证
${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 超时
2021-04-22 15:26:27 +08:00
... ELSE Create List timed out
2020-06-23 21:04:14 +08:00
${rescode} SystemCommands ${commandstr} ${stringlist}
Comment 功能端验证HTTP验证
2020-07-06 10:29:21 +08:00
${commandstr} run keyword if '${systemType}'=='Windows' set variable nslookup -d rutube.ru
... ELSE set variable nslookup -d rutube.ru
2020-06-23 21:04:14 +08:00
${stringlist} run keyword if '${systemType}'=='Windows' Create List 超时
2021-04-22 15:26:27 +08:00
... ELSE Create List timed out
2020-06-23 21:04:14 +08:00
${rescode} SystemCommands ${commandstr} ${stringlist}
Comment 改变阻断策略
${policyDict} Create Dictionary policyId=${deny_dns_policyId} policyName=SecurityPolicy-Deny-Dns-00001_1 policyType=tsg_security policyDesc=autotest action=deny userRegion={"protocol":"DNS","method":"drop"} source=${deny_dns_objectId4}|TSG_SECURITY_SOURCE_LOCATION filterList=${deny_dns_objectId}|TSG_FIELD_DNS_QNAME isValid=${1} appIdObjects=${DNS_ID}
log ${policyDict}
${rescode} UpdatePolicies 1 ${policyDict} v2 update
Comment 功能端验证HTTP验证
${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 超时
2021-04-22 15:26:27 +08:00
... ELSE Create List timed out
${rescode} SystemCommands ${commandstr} ${stringlist}
Comment 功能端验证HTTP验证
${commandstr} run keyword if '${systemType}'=='Windows' set variable nslookup -d rutube.ru
... ELSE set variable nslookup -d rutube.ru
${stringlist} run keyword if '${systemType}'=='Windows' Create List 超时
2021-04-22 15:26:27 +08:00
... ELSE Create List timed out
${rescode} SystemCommands ${commandstr} ${stringlist}
2020-06-23 21:04:14 +08:00
SecurityPolicy-Deny-Dns-00002
Comment 功能端验证HTTP验证
${commandstr} run keyword if '${systemType}'=='Windows' set variable nslookup -d www.arctictrucks.ru 8.8.8.8
... ELSE set variable nslookup -debug -query=A \ www.arctictrucks.ru
2021-04-12 14:51:02 +08:00
${stringlist} run keyword if '${systemType}'=='Windows' Create List www.arctictrucks.ru
... ELSE Create List www.arctictrucks.ru
2020-06-23 21:04:14 +08:00
${rescode} SystemCommands ${commandstr} ${stringlist}
Comment 功能端验证HTTP验证
${commandstr} run keyword if '${systemType}'=='Windows' set variable nslookup -d wifika.ru 8.8.8.8
... ELSE set variable nslookup -debug -query=A \ wifika.ru
2021-04-12 14:51:02 +08:00
${stringlist} run keyword if '${systemType}'=='Windows' Create List wifika.ru
... ELSE Create List wifika.ru
2020-06-23 21:04:14 +08:00
${rescode} SystemCommands ${commandstr} ${stringlist}
SecurityPolicy-Deny-Dns-00003
Comment 功能端验证HTTP验证
${commandstr} run keyword if '${systemType}'=='Windows' set variable nslookup -d aec188.com 8.8.8.8
2021-04-22 15:26:27 +08:00
... ELSE set variable nslookup -debug -query=AAAA \ aec188.com
2021-04-12 14:51:02 +08:00
${stringlist} run keyword if '${systemType}'=='Windows' Create List aec188.com
... ELSE Create List aec188.com
2020-06-23 21:04:14 +08:00
${rescode} SystemCommands ${commandstr} ${stringlist}
Comment 功能端验证HTTP验证
${commandstr} run keyword if '${systemType}'=='Windows' set variable nslookup -d huitu.com 8.8.8.8
2021-04-22 15:26:27 +08:00
... ELSE set variable nslookup -debug -query=AAAA \ huitu.com
2021-04-12 14:51:02 +08:00
${stringlist} run keyword if '${systemType}'=='Windows' Create List huitu.com
2020-06-23 21:04:14 +08:00
... ELSE Create List fc00::2:11 www.taobao.com ttl = 400
${rescode} SystemCommands ${commandstr} ${stringlist}
2021-05-17 13:24:29 +06:00
# Comment 用后失效与insert12互相影响
# ${policyDict} Create Dictionary policyId=${deny_dns_policyId2} policyName=SecurityPolicy-Deny-Dns-00003_1 policyType=tsg_security policyDesc=autotest action=deny userRegion={"protocol":"DNS","method":"redirect","resolution":[{"qtype":"AAAA","answer":[{"atype":"AAAA","value":"fc00::2:11","ttl":{"min":400,"max":400}},{"atype":"CNAME","value":"www.taobao.com","ttl":{"min":600,"max":600}}]}]} filterList=129|TSG_FIELD_DNS_QNAME isValid=${0} appIdObjects=${DNS_ID}
# log ${policyDict}
# ${rescode} UpdatePolicies 1 ${policyDict} v2 update
2020-06-23 21:04:14 +08:00
SecurityPolicy-Deny-Dns-00004
Comment 功能端验证HTTP验证
2021-05-17 13:24:29 +06:00
${commandstr} run keyword if '${systemType}'=='Windows' set variable nslookup -d www.twitch.tv 8.8.8.8
2021-04-22 15:26:27 +08:00
... ELSE set variable nslookup -debug -query=A \ www.twitch.tv
2021-05-17 13:24:29 +06:00
${stringlist} run keyword if '${systemType}'=='Windows' Create List www.ok.ru
2020-06-23 21:04:14 +08:00
... ELSE Create List 192.168.40.110 www.ok.ru ttl = 400
${rescode} SystemCommands ${commandstr} ${stringlist}
Comment 改变阻断策略
2021-04-22 15:26:27 +08:00
${policyDict} Create Dictionary policyId=${deny_dns_policyId3} policyName=SecurityPolicy-Deny-Dns-00004_1 policyType=tsg_security policyDesc=autotest action=deny userRegion={"protocol":"DNS","method":"redirect","resolution":[{"answer":[{"atype":"AAAA","value":"fc00::2:22","ttl":{"min":400,"max":400}},{"atype":"CNAME","value":"www.facebook.com","ttl":{"min":400,"max":400}}],"qtype":"AAAA"},{"qtype":"A","answer":[{"atype":"CNAME","value":"www.ok.ru","ttl":{"min":400,"max":400}},{"atype":"A","value":"192.168.40.110","ttl":{"min":400,"max":400}}]}]} filterList=${deny_dns_objectId5}|TSG_FIELD_DNS_QNAME isValid=${1} appIdObjects=${DNS_ID}
log ${policyDict}
${rescode} UpdatePolicies 1 ${policyDict} v2 update
2021-05-17 13:24:29 +06:00
sleep ${policyModifySleepSeconds}
Comment 功能端验证HTTP验证
2021-05-17 13:24:29 +06:00
${commandstr} run keyword if '${systemType}'=='Windows' set variable nslookup -d www.twitch.tv 8.8.8.8
2021-04-22 15:26:27 +08:00
... ELSE set variable nslookup -debug -query=AAAA \ www.twitch.tv
2021-05-17 13:24:29 +06:00
${stringlist} run keyword if '${systemType}'=='Windows' Create List www.ok.ru
2020-06-23 21:04:14 +08:00
... ELSE Create List ttl = 400 www.facebook.com fc00::2:22
${rescode} SystemCommands ${commandstr} ${stringlist}
SecurityPolicy-Deny-Dns-00005
Comment 打开安全策略
${policyDict} Create Dictionary policyId=${deny_dns_policyId4} policyName=SecurityPolicy-Deny-Dns-00005-1 policyType=tsg_security policyDesc=autotest action=deny userRegion={"protocol":"DNS","method":"drop"} isValid=${1} appIdObjects=${DNS_ID}
log ${policyDict}
${rescode} UpdatePolicies 1 ${policyDict} v2 update
sleep ${policyModifySleepSeconds}
Comment 功能端验证HTTP验证
${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 超时
2021-04-22 15:26:27 +08:00
... ELSE Create List timed out
${rescode} SystemCommands ${commandstr} ${stringlist}
Comment 关闭安全策略
${policyDict} Create Dictionary policyId=${deny_dns_policyId4} policyName=SecurityPolicy-Deny-Dns-00005-2 policyType=tsg_security policyDesc=autotest action=deny userRegion={"protocol":"DNS","method":"drop"} isValid=${0} appIdObjects=${DNS_ID}
log ${policyDict}
${rescode} UpdatePolicies 1 ${policyDict} v2 update
sleep ${policyModifySleepSeconds}