2020-07-27 16:36:19 +08:00
|
|
|
|
*** 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
|
2020-09-07 19:46:15 +08:00
|
|
|
|
Resource ../../03-Variable/ApplicationID.txt
|
2020-07-27 16:36:19 +08:00
|
|
|
|
##注意此文件中的测试用例需要修改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 鍒涘缓瀹夊叏绛栫暐
|
2020-09-07 19:46:15 +08:00
|
|
|
|
${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}
|
2020-07-27 16:36:19 +08:00
|
|
|
|
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
|
2020-07-27 17:42:07 +08:00
|
|
|
|
${rescode} SystemCommands ${commandstr} ${stringlist}
|
2020-07-27 16:36:19 +08:00
|
|
|
|
${endtime} Get Time
|
2020-07-27 17:42:07 +08:00
|
|
|
|
Sleep ${policyLogVerificationSleepSeconds}s
|
2020-07-27 16:36:19 +08:00
|
|
|
|
#鏃ュ織楠岃瘉
|
|
|
|
|
|
${s} Convert to String ${policyId}
|
2020-07-27 17:42:07 +08:00
|
|
|
|
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 鍒涘缓瀹夊叏绛栫暐
|
2020-09-07 19:46:15 +08:00
|
|
|
|
${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}
|
2020-07-27 17:42:07 +08:00
|
|
|
|
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
|
2020-07-27 16:36:19 +08:00
|
|
|
|
|