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/zjj/DLL-DeviceID-Test.robot
2020-09-07 19:46:15 +08:00

71 lines
4.5 KiB
Plaintext
Raw Blame History

*** Settings ***
Test Teardown DeletePolicyAndObject ${policyIds} ${objectids}
Force Tags zjj tsg_effectiveRange_deviceid
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_adc/FileOperation.robot
Resource ../../02-Keyword/tsg_bfapi/policy_object/Policy.robot
Resource ../../03-Variable/ApplicationID.txt
##注意此文件中的测试用例需要修改ManagePolicyBocy.robot的内容EffectiveRangeValueType3函数的#${obj} Create Dictionary tag=location value=${valueList} 替换为${obj} Create Dictionary tag=device_id value=${valueList}
*** Variables ***
${url} /v1/policy/profile/responsepages
*** Test Cases ***
DLL-DeviceID-SecurityPolicy-Deny-Http-00001
[Tags] fqdn
Comment 鍒涘缓fqdn
${objectDict} Create Dictionary objectType=fqdn isValid=${1} addItemList=$webalta.ru
${rescode} ${objectId} AddObject2 ${1} ${objectDict}
${objectids} set Variable ${objectId}
#鍒涘缓 Deny 鎼厤Allow
Comment 鍒涘缓瀹夊叏绛栫暐
${policyDict} Create Dictionary policyName=DLL-DeviceID-SecurityPolicy-Deny-Http-00001 policyType=tsg_security policyDesc=autotest action=deny userRegion={"protocol":"HTTP","method":"drop"} effectiveRange=device_1 filterList=${objectId}|TSG_FIELD_HTTP_HOST isValid=${1} appIdObjects=${HTTP_ID}
log ${policyDict}
${rescode} ${policyId} AddPolicies 1 ${policyDict} v2
${policyIds1} set Variable {"policyType":"tsg_security","policyIds":[${policyId}]}
${policyIds} Create List ${policyIds1}
${starttime} Get Time
#鍔熻兘绔獙璇<E78D99>
Sleep ${policyVerificationSleepSeconds}s
${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/SecurityPolicy_Deny_HTTP_00001.bat
... ELSE set variable curl http://webalta.ru/
${stringlist} run keyword if '${systemType}'=='Windows' Create List Connection was reset
... ELSE Create List Connection reset by peer
${rescode} SystemCommands ${commandstr} ${stringlist}
${endtime} Get Time
Sleep ${policyLogVerificationSleepSeconds}s
#鏃ュ織楠岃瘉
${s} Convert to String ${policyId}
GetLogList security_event_log ${starttime} ${endtime} ${testClentIP} ${s} http_host webalta.ru
DLL-DeviceID-SecurityPolicy-Deny-Http-00002
[Tags] fqdn
Comment 鍒涘缓fqdn
${objectDict} Create Dictionary objectType=fqdn isValid=${1} addItemList=$webalta.ru
${rescode} ${objectId} AddObject2 ${1} ${objectDict}
${objectids} set Variable ${objectId}
#鍒涘缓 Deny 鎼厤Allow
Comment 鍒涘缓瀹夊叏绛栫暐
${policyDict} Create Dictionary policyName=DLL-DeviceID-SecurityPolicy-Deny-Http-000021 policyType=tsg_security policyDesc=autotest action=deny userRegion={"protocol":"HTTP","method":"drop"} effectiveRange=device_100 filterList=${objectId}|TSG_FIELD_HTTP_HOST isValid=${1} appIdObjects=${HTTP_ID}
log ${policyDict}
${rescode} ${policyId} AddPolicies 1 ${policyDict} v2
${policyIds1} set Variable {"policyType":"tsg_security","policyIds":[${policyId}]}
${policyIds} Create List ${policyIds1}
${starttime} Get Time
#鍔熻兘绔獙璇<E78D99>
Sleep ${policyVerificationSleepSeconds}s
${commandstr} run keyword if '${systemType}'=='Windows' set variable ${curlbatpath}/command/SecurityPolicy_Deny_HTTP_00001.bat
... ELSE set variable curl http://webalta.ru/
${stringlist} run keyword if '${systemType}'=='Windows' Create List Connection was reset
... ELSE Create List Connection reset by peer
${emptyList} Create List
${rescode} SystemCommandReturnCompare ${commandstr} ${emptyList} ${stringlist}
${endtime} Get Time
Sleep ${policyLogVerificationSleepSeconds}s
#鏃ュ織楠岃瘉
${s} Convert to String ${policyId}
GetLogList security_event_log ${starttime} ${endtime} ${testClentIP} ${s} http_host webalta.ru