Merge branch 'develop' of https://git.mesalab.cn/dongxiaoyan/tsg_autotest into develop
This commit is contained in:
362
01-TestCase/tsg_bfapi/active_defence_event_log/Log-count.robot
Normal file
362
01-TestCase/tsg_bfapi/active_defence_event_log/Log-count.robot
Normal file
@@ -0,0 +1,362 @@
|
||||
*** Settings ***
|
||||
Force Tags api api-log api-log-active_defence_event_log api-log-active_defence_event_log-count
|
||||
Resource ../../../02-Keyword/tsg_bfapi/Log_keyword.robot
|
||||
Resource ../../../02-Keyword/tsg_bfapi/Common.robot
|
||||
Library OperatingSystem
|
||||
Library Selenium2Library
|
||||
Library RequestsLibrary
|
||||
Library Collections
|
||||
Library string
|
||||
Library REST http://${host}:${port}/${version}
|
||||
Library json
|
||||
|
||||
*** Test Cases ***
|
||||
CountLog-001
|
||||
${condition} Set Variable { "field":"ad_target_ip", "type":"string", "symbol":"sub", "value":["22"] }
|
||||
${pageSize} Set Variable 30
|
||||
${pageNo} Set Variable 1
|
||||
${starttime} Set Variable 2020-04-26 12:27:03
|
||||
${endtime} Set Variable 2020-04-27 13:27:03
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} Set Variable {"pageNo":${pageNo},"pageSize":${pageSize},"logType":"${logname}","start_common_recv_time":"${startTime}","end_common_recv_time":"${endTime}","conditions":${condition}}
|
||||
${url} Set Variable log/count
|
||||
${response} Post-Request ${url} ${logCondition}
|
||||
${responsejson} Evaluate type($response)
|
||||
Should Be Equal As Strings ${response}[code] 200
|
||||
log ${response}[data][total]
|
||||
|
||||
CountLog-002
|
||||
${condition} Set Variable []
|
||||
${pageSize} Set Variable 30
|
||||
${pageNo} Set Variable 1
|
||||
${starttime} Set Variable 2020-04-26 12:27:03
|
||||
${endtime} Set Variable 2020-04-27 13:27:03
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} Set Variable {"pageNo":${pageNo},"pageSize":${pageSize},"logType":"${logname}","start_common_recv_time":"${startTime}","end_common_recv_time":"${endTime}","conditions":${condition}}
|
||||
${url} Set Variable log/count
|
||||
${response} Post-Request ${url} ${logCondition}
|
||||
${responsejson} Evaluate type($response)
|
||||
Should Be Equal As Strings ${response}[code] 200
|
||||
log ${response}[data][total]
|
||||
|
||||
CountLog-003
|
||||
${condition} Set Variable {"field":"common_log_id","type":"long","symbol":"=","value":["59526984506148866"] }
|
||||
${pageSize} Set Variable 30
|
||||
${pageNo} Set Variable 1
|
||||
${starttime} Set Variable 2020-04-26 12:27:03
|
||||
${endtime} Set Variable 2020-04-27 13:27:03
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} Set Variable {"pageNo":${pageNo},"pageSize":${pageSize},"logType":"${logname}","start_common_recv_time":"${startTime}","end_common_recv_time":"${endTime}","conditions":${condition}}
|
||||
${url} Set Variable log/count
|
||||
${response} Post-Request ${url} ${logCondition}
|
||||
${responsejson} Evaluate type($response)
|
||||
Should Be Equal As Strings ${response}[code] 200
|
||||
log ${response}[data][total]
|
||||
|
||||
CountLog-004
|
||||
${condition} Set Variable { "field":"common_recv_time", "type":"timestamp", "symbol":"=", "value":["2020-04-27 12:48:33"] }
|
||||
${pageSize} Set Variable 30
|
||||
${pageNo} Set Variable 1
|
||||
${starttime} Set Variable 2020-04-26 12:27:03
|
||||
${endtime} Set Variable 2020-04-27 13:27:03
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} Set Variable {"pageNo":${pageNo},"pageSize":${pageSize},"logType":"${logname}","start_common_recv_time":"${startTime}","end_common_recv_time":"${endTime}","conditions":${condition}}
|
||||
${url} Set Variable log/count
|
||||
${response} Post-Request ${url} ${logCondition}
|
||||
${responsejson} Evaluate type($response)
|
||||
Should Be Equal As Strings ${response}[code] 200
|
||||
log ${response}[data][total]
|
||||
|
||||
CountLog-005
|
||||
${condition} Set Variable { "field":"common_policy_id", "type":"int", "symbol":"=", "value":["774"] }
|
||||
${pageSize} Set Variable 30
|
||||
${pageNo} Set Variable 1
|
||||
${starttime} Set Variable 2020-04-26 12:27:03
|
||||
${endtime} Set Variable 2020-04-27 13:27:03
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} Set Variable {"pageNo":${pageNo},"pageSize":${pageSize},"logType":"${logname}","start_common_recv_time":"${startTime}","end_common_recv_time":"${endTime}","conditions":${condition}}
|
||||
${url} Set Variable log/count
|
||||
${response} Post-Request ${url} ${logCondition}
|
||||
${responsejson} Evaluate type($response)
|
||||
Should Be Equal As Strings ${response}[code] 200
|
||||
log ${response}[data][total]
|
||||
|
||||
CountLog-006
|
||||
${condition} Set Variable { "field":"ad_cc_target_url", "type":"string", "symbol":"sub", "value":["www.jianshu.com"] }
|
||||
${pageSize} Set Variable 30
|
||||
${pageNo} Set Variable 1
|
||||
${starttime} Set Variable 2020-04-26 12:27:03
|
||||
${endtime} Set Variable 2020-04-27 13:27:03
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} Set Variable {"pageNo":${pageNo},"pageSize":${pageSize},"logType":"${logname}","start_common_recv_time":"${startTime}","end_common_recv_time":"${endTime}","conditions":${condition}}
|
||||
${url} Set Variable log/count
|
||||
${response} Post-Request ${url} ${logCondition}
|
||||
${responsejson} Evaluate type($response)
|
||||
Should Be Equal As Strings ${response}[code] 200
|
||||
log ${response}[data][total]
|
||||
|
||||
CountLog-007
|
||||
${condition} Set Variable { "field":"ad_target_ip", "type":"string", "symbol":"exactly", "value":["10.3.22.222"] },{"field":"common_log_id","type":"long","symbol":"=","value":["59526984506148866"] },{ "field":"common_recv_time", "type":"timestamp", "symbol":"=", "value":["2020-04-27 13:27:02"] },{ "field":"common_policy_id", "type":"int", "symbol":"=", "value":["95"] }
|
||||
${pageSize} Set Variable 30
|
||||
${pageNo} Set Variable 1
|
||||
${starttime} Set Variable 2020-04-26 12:27:03
|
||||
${endtime} Set Variable 2020-04-27 13:27:03
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} Set Variable {"pageNo":${pageNo},"pageSize":${pageSize},"logType":"${logname}","start_common_recv_time":"${startTime}","end_common_recv_time":"${endTime}","condaiapi-logaa tions":[${condition}]}
|
||||
${url} Set Variable log/count
|
||||
${response} Post-Request ${url} ${logCondition}
|
||||
${responsejson} Evaluate type($response)
|
||||
Should Be Equal As Strings ${response}[code] 200
|
||||
log ${response}[data][total]
|
||||
|
||||
CountLog-008
|
||||
${condition} Set Variable { "field":"ad_target_ip", "type":"string", "symbol":"prefix", "value":["10"] }
|
||||
${pageSize} Set Variable 30
|
||||
${pageNo} Set Variable 1
|
||||
${starttime} Set Variable 2020-04-26 12:27:03
|
||||
${endtime} Set Variable 2020-04-27 13:27:03
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} Set Variable {"pageNo":${pageNo},"pageSize":${pageSize},"logType":"${logname}","start_common_recv_time":"${startTime}","end_common_recv_time":"${endTime}","conditions":${condition}}
|
||||
${url} Set Variable log/count
|
||||
${response} Post-Request ${url} ${logCondition}
|
||||
${responsejson} Evaluate type($response)
|
||||
Should Be Equal As Strings ${response}[code] 200
|
||||
log ${response}[data][total]
|
||||
|
||||
CountLog-009
|
||||
${condition} Set Variable { "field":"ad_target_ip", "type":"string", "symbol":"suffix", "value":["222"] }
|
||||
${pageSize} Set Variable 30
|
||||
${pageNo} Set Variable 1
|
||||
${starttime} Set Variable 2020-04-26 12:27:03
|
||||
${endtime} Set Variable 2020-04-27 13:27:03
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} Set Variable {"pageNo":${pageNo},"pageSize":${pageSize},"logType":"${logname}","start_common_recv_time":"${startTime}","end_common_recv_time":"${endTime}","conditions":${condition}}
|
||||
${url} Set Variable log/count
|
||||
${response} Post-Request ${url} ${logCondition}
|
||||
${responsejson} Evaluate type($response)
|
||||
Should Be Equal As Strings ${response}[code] 200
|
||||
log ${response}[data][total]
|
||||
|
||||
CountLog-010
|
||||
${condition} Set Variable { "field":"ad_target_ip", "type":"string", "symbol":"exactly", "value":["10.3.22.222"] }
|
||||
${pageSize} Set Variable 30
|
||||
${pageNo} Set Variable 1
|
||||
${starttime} Set Variable 2020-04-26 12:27:03
|
||||
${endtime} Set Variable 2020-04-27 13:27:03
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} Set Variable {"pageNo":${pageNo},"pageSize":${pageSize},"logType":"${logname}","start_common_recv_time":"${startTime}","end_common_recv_time":"${endTime}","conditions":${condition}}
|
||||
${url} Set Variable log/count
|
||||
${response} Post-Request ${url} ${logCondition}
|
||||
${responsejson} Evaluate type($response)
|
||||
Should Be Equal As Strings ${response}[code] 200
|
||||
log ${response}[data][total]
|
||||
|
||||
CountLog-011
|
||||
${condition} Set Variable { "field":"ad_target_ip", "type":"string", "value":["10"] }
|
||||
${pageSize} Set Variable 30
|
||||
${pageNo} Set Variable 1
|
||||
${starttime} Set Variable 2020-04-26 12:27:03
|
||||
${endtime} Set Variable 2020-04-27 13:27:03
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} Set Variable {"pageNo":${pageNo},"pageSize":${pageSize},"logType":"${logname}","start_common_recv_time":"${startTime}","end_common_recv_time":"${endTime}","conditions":${condition}}
|
||||
${url} Set Variable log/count
|
||||
${response} Post-Request ${url} ${logCondition}
|
||||
${responsejson} Evaluate type($response)
|
||||
Should Be Equal As Strings ${response}[code] 200
|
||||
log ${response}[data][total]
|
||||
|
||||
CountLog-012
|
||||
${condition} Set Variable { "field":"ad_target_ip", "type":"string", "value":["10"] }
|
||||
${pageSize} Set Variable 30
|
||||
${pageNo} Set Variable 1
|
||||
${starttime} Set Variable 2020-04-26 12:27:03
|
||||
${endtime} Set Variable 2020-04-27 13:27:03
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} Set Variable {"pageNo":${pageNo},"pageSize":${pageSize},"logType":"${logname}","start_common_recv_time":"${startTime}","end_common_recv_time":"${endTime}","conditions":${condition}}
|
||||
${url} Set Variable log/count
|
||||
${response} Post-Request ${url} ${logCondition}
|
||||
${responsejson} Evaluate type($response)
|
||||
Should Be Equal As Strings ${response}[code] 200
|
||||
log ${response}[data][total]
|
||||
|
||||
CountLog-013
|
||||
${condition} Set Variable { "field":"common_policy_id", "type":"int", "symbol":"!=", "value":["774"] }
|
||||
${pageSize} Set Variable 30
|
||||
${pageNo} Set Variable 1
|
||||
${starttime} Set Variable 2020-04-26 12:27:03
|
||||
${endtime} Set Variable 2020-04-27 13:27:03
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} Set Variable {"pageNo":${pageNo},"pageSize":${pageSize},"logType":"${logname}","start_common_recv_time":"${startTime}","end_common_recv_time":"${endTime}","conditions":${condition}}
|
||||
${url} Set Variable log/count
|
||||
${response} Post-Request ${url} ${logCondition}
|
||||
${responsejson} Evaluate type($response)
|
||||
Should Be Equal As Strings ${response}[code] 200
|
||||
log ${response}[data][total]
|
||||
|
||||
CountLog-014
|
||||
${condition} Set Variable { "field":"common_policy_id", "type":"int", "symbol":"!=", "value":["774"] }
|
||||
${pageSize} Set Variable 30
|
||||
${pageNo} Set Variable 1
|
||||
${starttime} Set Variable 2020-04-26 12:27:03
|
||||
${endtime} Set Variable 2020-04-27 13:27:03
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} Set Variable {"pageNo":${pageNo},"pageSize":${pageSize},"logType":"${logname}","start_common_recv_time":"${startTime}","end_common_recv_time":"${endTime}","conditions":${condition}}
|
||||
${url} Set Variable log/count
|
||||
${response} Post-Request ${url} ${logCondition}
|
||||
${responsejson} Evaluate type($response)
|
||||
Should Be Equal As Strings ${response}[code] 200
|
||||
log ${response}[data][total]
|
||||
|
||||
CountLog-015
|
||||
${condition} Set Variable { "field":"common_policy_id", "type":"int", "symbol":"<", "value":["774"] }
|
||||
${pageSize} Set Variable 30
|
||||
${pageNo} Set Variable 1
|
||||
${starttime} Set Variable 2020-04-26 12:27:03
|
||||
${endtime} Set Variable 2020-04-27 13:27:03
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} Set Variable {"pageNo":${pageNo},"pageSize":${pageSize},"logType":"${logname}","start_common_recv_time":"${startTime}","end_common_recv_time":"${endTime}","conditions":${condition}}
|
||||
${url} Set Variable log/count
|
||||
${response} Post-Request ${url} ${logCondition}
|
||||
${responsejson} Evaluate type($response)
|
||||
Should Be Equal As Strings ${response}[code] 200
|
||||
log ${response}[data][total]
|
||||
|
||||
CountLog-016
|
||||
${condition} Set Variable { "field":"common_policy_id", "type":"int", "symbol":"<=", "value":["774"] }
|
||||
${pageSize} Set Variable 30
|
||||
${pageNo} Set Variable 1
|
||||
${starttime} Set Variable 2020-04-26 12:27:03
|
||||
${endtime} Set Variable 2020-04-27 13:27:03
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} Set Variable {"pageNo":${pageNo},"pageSize":${pageSize},"logType":"${logname}","start_common_recv_time":"${startTime}","end_common_recv_time":"${endTime}","conditions":${condition}}
|
||||
${url} Set Variable log/count
|
||||
${response} Post-Request ${url} ${logCondition}
|
||||
${responsejson} Evaluate type($response)
|
||||
Should Be Equal As Strings ${response}[code] 200
|
||||
log ${response}[data][total]
|
||||
|
||||
CountLog-017
|
||||
${condition} Set Variable { "field":"common_policy_id", "type":"int", "symbol":">=", "value":["774"] }
|
||||
${pageSize} Set Variable 30
|
||||
${pageNo} Set Variable 1
|
||||
${starttime} Set Variable 2020-04-26 12:27:03
|
||||
${endtime} Set Variable 2020-04-27 13:27:03
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} Set Variable {"pageNo":${pageNo},"pageSize":${pageSize},"logType":"${logname}","start_common_recv_time":"${startTime}","end_common_recv_time":"${endTime}","conditions":${condition}}
|
||||
${url} Set Variable log/count
|
||||
${response} Post-Request ${url} ${logCondition}
|
||||
${responsejson} Evaluate type($response)
|
||||
Should Be Equal As Strings ${response}[code] 200
|
||||
log ${response}[data][total]
|
||||
|
||||
CountLog-018
|
||||
${condition} Set Variable { "field":"common_policy_id", "type":"int", "symbol":"in", "value":["774","95"] }
|
||||
${pageSize} Set Variable 30
|
||||
${pageNo} Set Variable 1
|
||||
${starttime} Set Variable 2020-04-26 12:27:03
|
||||
${endtime} Set Variable 2020-04-27 13:27:03
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} Set Variable {"pageNo":${pageNo},"pageSize":${pageSize},"logType":"${logname}","start_common_recv_time":"${startTime}","end_common_recv_time":"${endTime}","conditions":${condition}}
|
||||
${url} Set Variable log/count
|
||||
${response} Post-Request ${url} ${logCondition}
|
||||
${responsejson} Evaluate type($response)
|
||||
Should Be Equal As Strings ${response}[code] 200
|
||||
log ${response}[data][total]
|
||||
|
||||
CountLog-019
|
||||
${condition} Set Variable { "field":"common_recv_time", "type":"timestamp", "value":["2020-04-27 12:48:33"] }
|
||||
${pageSize} Set Variable 30
|
||||
${pageNo} Set Variable 1
|
||||
${starttime} Set Variable 2020-04-26 12:27:03
|
||||
${endtime} Set Variable 2020-04-27 13:27:03
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} Set Variable {"pageNo":${pageNo},"pageSize":${pageSize},"logType":"${logname}","start_common_recv_time":"${startTime}","end_common_recv_time":"${endTime}","conditions":${condition}}
|
||||
${url} Set Variable log/count
|
||||
${response} Post-Request ${url} ${logCondition}
|
||||
${responsejson} Evaluate type($response)
|
||||
Should Be Equal As Strings ${response}[code] 200
|
||||
log ${response}[data][total]
|
||||
|
||||
CountLog-020
|
||||
${condition} Set Variable { "field":"common_recv_time", "type":"timestamp", "symbol":">", "value":["2020-04-27 12:48:33"] }
|
||||
${pageSize} Set Variable 30
|
||||
${pageNo} Set Variable 1
|
||||
${starttime} Set Variable 2020-04-26 12:27:03
|
||||
${endtime} Set Variable 2020-04-27 13:27:03
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} Set Variable {"pageNo":${pageNo},"pageSize":${pageSize},"logType":"${logname}","start_common_recv_time":"${startTime}","end_common_recv_time":"${endTime}","conditions":${condition}}
|
||||
${url} Set Variable log/count
|
||||
${response} Post-Request ${url} ${logCondition}
|
||||
${responsejson} Evaluate type($response)
|
||||
Should Be Equal As Strings ${response}[code] 200
|
||||
log ${response}[data][total]
|
||||
|
||||
CountLog-021
|
||||
${condition} Set Variable { "field":"common_recv_time", "type":"timestamp", "symbol":"<", "value":["2020-04-27 12:48:33"] }
|
||||
${pageSize} Set Variable 30
|
||||
${pageNo} Set Variable 1
|
||||
${starttime} Set Variable 2020-04-26 12:27:03
|
||||
${endtime} Set Variable 2020-04-27 13:27:03
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} Set Variable {"pageNo":${pageNo},"pageSize":${pageSize},"logType":"${logname}","start_common_recv_time":"${startTime}","end_common_recv_time":"${endTime}","conditions":${condition}}
|
||||
${url} Set Variable log/count
|
||||
${response} Post-Request ${url} ${logCondition}
|
||||
${responsejson} Evaluate type($response)
|
||||
Should Be Equal As Strings ${response}[code] 200
|
||||
log ${response}[data][total]
|
||||
|
||||
CountLog-022
|
||||
${condition} Set Variable { "field":"common_recv_time", "type":"timestamp", "symbol":"<=", "value":["2020-04-27 12:48:33"] }
|
||||
${pageSize} Set Variable 30
|
||||
${pageNo} Set Variable 1
|
||||
${starttime} Set Variable 2020-04-26 12:27:03
|
||||
${endtime} Set Variable 2020-04-27 13:27:03
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} Set Variable {"pageNo":${pageNo},"pageSize":${pageSize},"logType":"${logname}","start_common_recv_time":"${startTime}","end_common_recv_time":"${endTime}","conditions":${condition}}
|
||||
${url} Set Variable log/count
|
||||
${response} Post-Request ${url} ${logCondition}
|
||||
${responsejson} Evaluate type($response)
|
||||
Should Be Equal As Strings ${response}[code] 200
|
||||
log ${response}[data][total]
|
||||
|
||||
CountLog-023
|
||||
${condition} Set Variable { "field":"common_recv_time", "type":"timestamp", "symbol":">=", "value":["2020-04-27 12:48:33"] }
|
||||
${pageSize} Set Variable 30
|
||||
${pageNo} Set Variable 1
|
||||
${starttime} Set Variable 2020-04-26 12:27:03
|
||||
${endtime} Set Variable 2020-04-27 13:27:03
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} Set Variable {"pageNo":${pageNo},"pageSize":${pageSize},"logType":"${logname}","start_common_recv_time":"${startTime}","end_common_recv_time":"${endTime}","conditions":${condition}}
|
||||
${url} Set Variable log/count
|
||||
${response} Post-Request ${url} ${logCondition}
|
||||
${responsejson} Evaluate type($response)
|
||||
Should Be Equal As Strings ${response}[code] 200
|
||||
log ${response}[data][total]
|
||||
|
||||
CountLog-024
|
||||
${condition} Set Variable { "field":"common_recv_time", "type":"timestamp", "symbol":"between", "value":["2020-04-27 12:48:33","2020-04-27 13:27:03"] }
|
||||
${pageSize} Set Variable 30
|
||||
${pageNo} Set Variable 1
|
||||
${starttime} Set Variable 2020-04-26 12:27:03
|
||||
${endtime} Set Variable 2020-04-27 13:27:03
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} Set Variable {"pageNo":${pageNo},"pageSize":${pageSize},"logType":"${logname}","start_common_recv_time":"${startTime}","end_common_recv_time":"${endTime}","conditions":${condition}}
|
||||
${url} Set Variable log/count
|
||||
${response} Post-Request ${url} ${logCondition}
|
||||
${responsejson} Evaluate type($response)
|
||||
Should Be Equal As Strings ${response}[code] 200
|
||||
log ${response}[data][total]
|
||||
|
||||
CountLog-025
|
||||
${condition} Set Variable { "field":"common_recv_time", "type":"timestamp", "value":["2020-04-27 12:48:33","2020-04-27 13:27:03"] }
|
||||
${pageSize} Set Variable 30
|
||||
${pageNo} Set Variable 1
|
||||
${starttime} Set Variable 2020-04-26 12:27:03
|
||||
${endtime} Set Variable 2020-04-27 13:27:03
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} Set Variable {"pageNo":${pageNo},"pageSize":${pageSize},"logType":"${logname}","start_common_recv_time":"${startTime}","end_common_recv_time":"${endTime}","conditions":${condition}}
|
||||
${url} Set Variable log/count
|
||||
${response} Post-Request ${url} ${logCondition}
|
||||
${responsejson} Evaluate type($response)
|
||||
Should Be Equal As Strings ${response}[code] 200
|
||||
log ${response}[data][total]
|
||||
285
01-TestCase/tsg_bfapi/active_defence_event_log/Log_batch.robot
Normal file
285
01-TestCase/tsg_bfapi/active_defence_event_log/Log_batch.robot
Normal file
@@ -0,0 +1,285 @@
|
||||
*** Settings ***
|
||||
Force Tags api api-log api-log-active_defence_event_log api-log-active_defence_event_log-batch
|
||||
Library downloadexcel.py
|
||||
Resource ../../../02-Keyword/tsg_bfapi/Log_keyword.robot
|
||||
|
||||
*** Variables ***
|
||||
@{logType} security_event_log proxy_event_log connection_record_log radius_record_log
|
||||
|
||||
*** Test Cases ***
|
||||
ExportLog-001
|
||||
${conditions} Set Variable {"field":"common_log_id","type":"long","symbol":"=","value":["59526984506148866"] }
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} GetLogCondition ${logname} 2020-04-26 12:27:03 2020-04-27 13:27:03 30 1
|
||||
... ${conditions}
|
||||
log ${logCondition}
|
||||
${header} Create Dictionary Content-Type=application/json Authorization=${token}
|
||||
${success} downloadexcel ${header} ${logCondition} http://${host}:${port}/${version}/log/batch
|
||||
log ${success}
|
||||
Should Be Equal ${success} ${200} active_defence_event_log\ test query export failed
|
||||
|
||||
ExportLog-002
|
||||
${conditions} Set Variable { "field":"common_recv_time", "type":"timestamp", "symbol":"=", "value":["2020-04-27 12:48:33"] }
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} GetLogCondition ${logname} 2020-04-26 12:27:03 2020-04-27 13:27:03 30 1
|
||||
... ${conditions}
|
||||
log ${logCondition}
|
||||
${header} Create Dictionary Content-Type=application/json Authorization=${token}
|
||||
${success} downloadexcel ${header} ${logCondition} http://${host}:${port}/${version}/log/batch
|
||||
log ${success}
|
||||
Should Be Equal ${success} ${200} active_defence_event_log\ test query export failed
|
||||
|
||||
ExportLog-003
|
||||
${conditions} Set Variable { "field":"common_policy_id", "type":"int", "symbol":"=", "value":["774"] }
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} GetLogCondition ${logname} 2020-04-26 12:27:03 2020-04-27 13:27:03 30 1
|
||||
... ${conditions}
|
||||
log ${logCondition}
|
||||
${header} Create Dictionary Content-Type=application/json Authorization=${token}
|
||||
${success} downloadexcel ${header} ${logCondition} http://${host}:${port}/${version}/log/batch
|
||||
log ${success}
|
||||
Should Be Equal ${success} ${200} active_defence_event_log\ test query export failed
|
||||
|
||||
ExportLog-004
|
||||
${conditions} Set Variable { "field":"common_policy_id", "type":"int", "symbol":"=", "value":["774"] }
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} GetLogCondition ${logname} 2020-04-26 12:27:03 2020-04-27 13:27:03 30 1
|
||||
... ${conditions}
|
||||
log ${logCondition}
|
||||
${header} Create Dictionary Content-Type=application/json Authorization=${token}
|
||||
${success} downloadexcel ${header} ${logCondition} http://${host}:${port}/${version}/log/batch
|
||||
log ${success}
|
||||
Should Be Equal ${success} ${200} active_defence_event_log\ test query export failed
|
||||
|
||||
ExportLog-005
|
||||
${conditions} Set Variable { "field":"ad_cc_target_url", "type":"string", "symbol":"sub", "value":["www.jianshu.com"] }
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} GetLogCondition ${logname} 2020-04-26 12:27:03 2020-04-27 13:27:03 30 1
|
||||
... ${conditions}
|
||||
log ${logCondition}
|
||||
${header} Create Dictionary Content-Type=application/json Authorization=${token}
|
||||
${success} downloadexcel ${header} ${logCondition} http://${host}:${port}/${version}/log/batch
|
||||
log ${success}
|
||||
Should Be Equal ${success} ${200} active_defence_event_log\ test query export failed
|
||||
|
||||
ExportLog-006
|
||||
${conditions} Set Variable { "field":"ad_target_ip", "type":"string", "symbol":"sub", "value":["22"] }
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} GetLogCondition ${logname} 2020-04-26 12:27:03 2020-04-27 13:27:03 30 1
|
||||
... ${conditions}
|
||||
log ${logCondition}
|
||||
${header} Create Dictionary Content-Type=application/json Authorization=${token}
|
||||
${success} downloadexcel ${header} ${logCondition} http://${host}:${port}/${version}/log/batch
|
||||
log ${success}
|
||||
Should Be Equal ${success} ${200} active_defence_event_log\ test query export failed
|
||||
|
||||
ExportLog-007
|
||||
${conditions} Set Variable { "field":"ad_target_ip", "type":"string", "symbol":"exactly", "value":["10.3.22.222"] },{"field":"common_log_id","type":"long","symbol":"=","value":["59526984506148866"] },{ "field":"common_recv_time", "type":"timestamp", "symbol":"=", "value":["2020-04-27 13:27:02"] },{ "field":"common_policy_id", "type":"int", "symbol":"=", "value":["95"] }
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} GetLogCondition ${logname} 2020-04-26 12:27:03 2020-04-27 13:27:03 30 1
|
||||
... [${conditions}]
|
||||
log ${logCondition}
|
||||
${header} Create Dictionary Content-Type=application/json Authorization=${token}
|
||||
${success} downloadexcel ${header} ${logCondition} http://${host}:${port}/${version}/log/batch
|
||||
log ${success}
|
||||
Should Be Equal ${success} ${200} active_defence_event_log\ test query export failed
|
||||
|
||||
ExportLog-008
|
||||
${conditions} Set Variable { "field":"ad_target_ip", "type":"string", "symbol":"prefix", "value":["10"] }
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} GetLogCondition ${logname} 2020-04-26 12:27:03 2020-04-27 13:27:03 30 1
|
||||
... ${conditions}
|
||||
log ${logCondition}
|
||||
${header} Create Dictionary Content-Type=application/json Authorization=${token}
|
||||
${success} downloadexcel ${header} ${logCondition} http://${host}:${port}/${version}/log/batch
|
||||
log ${success}
|
||||
Should Be Equal ${success} ${200} active_defence_event_log\ test query export failed
|
||||
|
||||
ExportLog-009
|
||||
${conditions} Set Variable { "field":"ad_target_ip", "type":"string", "symbol":"suffix", "value":["222"] }
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} GetLogCondition ${logname} 2020-04-26 12:27:03 2020-04-27 13:27:03 30 1
|
||||
... ${conditions}
|
||||
log ${logCondition}
|
||||
${header} Create Dictionary Content-Type=application/json Authorization=${token}
|
||||
${success} downloadexcel ${header} ${logCondition} http://${host}:${port}/${version}/log/batch
|
||||
log ${success}
|
||||
Should Be Equal ${success} ${200} active_defence_event_log\ test query export failed
|
||||
|
||||
ExportLog-010
|
||||
${conditions} Set Variable { "field":"ad_target_ip", "type":"string", "symbol":"exactly", "value":["10.3.22.222"] }
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} GetLogCondition ${logname} 2020-04-26 12:27:03 2020-04-27 13:27:03 30 1
|
||||
... ${conditions}
|
||||
log ${logCondition}
|
||||
${header} Create Dictionary Content-Type=application/json Authorization=${token}
|
||||
${success} downloadexcel ${header} ${logCondition} http://${host}:${port}/${version}/log/batch
|
||||
log ${success}
|
||||
Should Be Equal ${success} ${200} active_defence_event_log\ test query export failed
|
||||
|
||||
ExportLog-011
|
||||
${conditions} Set Variable { "field":"ad_target_ip", "type":"string", "value":["10"] }
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} GetLogCondition ${logname} 2020-04-26 12:27:03 2020-04-27 13:27:03 30 1
|
||||
... ${conditions}
|
||||
log ${logCondition}
|
||||
${header} Create Dictionary Content-Type=application/json Authorization=${token}
|
||||
${success} downloadexcel ${header} ${logCondition} http://${host}:${port}/${version}/log/batch
|
||||
log ${success}
|
||||
Should Be Equal ${success} ${200} active_defence_event_log\ test query export failed
|
||||
|
||||
ExportLog-012
|
||||
${conditions} Set Variable { "field":"common_policy_id", "type":"int", "value":["774"] }
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} GetLogCondition ${logname} 2020-04-26 12:27:03 2020-04-27 13:27:03 30 1
|
||||
... ${conditions}
|
||||
log ${logCondition}
|
||||
${header} Create Dictionary Content-Type=application/json Authorization=${token}
|
||||
${success} downloadexcel ${header} ${logCondition} http://${host}:${port}/${version}/log/batch
|
||||
log ${success}
|
||||
Should Be Equal ${success} ${200} active_defence_event_log\ test query export failed
|
||||
|
||||
ExportLog-013
|
||||
${conditions} Set Variable { "field":"common_policy_id", "type":"int", "symbol":"!=", "value":["774"] }
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} GetLogCondition ${logname} 2020-04-26 12:27:03 2020-04-27 13:27:03 30 1
|
||||
... ${conditions}
|
||||
log ${logCondition}
|
||||
${header} Create Dictionary Content-Type=application/json Authorization=${token}
|
||||
${success} downloadexcel ${header} ${logCondition} http://${host}:${port}/${version}/log/batch
|
||||
log ${success}
|
||||
Should Be Equal ${success} ${200} active_defence_event_log\ test query export failed
|
||||
|
||||
ExportLog-014
|
||||
${conditions} Set Variable { "field":"common_policy_id", "type":"int", "symbol":">", "value":["774"] }
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} GetLogCondition ${logname} 2020-04-26 12:27:03 2020-04-27 13:27:03 30 1
|
||||
... ${conditions}
|
||||
log ${logCondition}
|
||||
${header} Create Dictionary Content-Type=application/json Authorization=${token}
|
||||
${success} downloadexcel ${header} ${logCondition} http://${host}:${port}/${version}/log/batch
|
||||
log ${success}
|
||||
Should Be Equal ${success} ${200} active_defence_event_log\ test query export failed
|
||||
|
||||
ExportLog-015
|
||||
${conditions} Set Variable { "field":"common_policy_id", "type":"int", "symbol":"<", "value":["774"] }
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} GetLogCondition ${logname} 2020-04-26 12:27:03 2020-04-27 13:27:03 30 1
|
||||
... ${conditions}
|
||||
log ${logCondition}
|
||||
${header} Create Dictionary Content-Type=application/json Authorization=${token}
|
||||
${success} downloadexcel ${header} ${logCondition} http://${host}:${port}/${version}/log/batch
|
||||
log ${success}
|
||||
Should Be Equal ${success} ${200} active_defence_event_log\ test query export failed
|
||||
|
||||
ExportLog-016
|
||||
${conditions} Set Variable { "field":"common_policy_id", "type":"int", "symbol":"<=", "value":["774"] }
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} GetLogCondition ${logname} 2020-04-26 12:27:03 2020-04-27 13:27:03 30 1
|
||||
... ${conditions}
|
||||
log ${logCondition}
|
||||
${header} Create Dictionary Content-Type=application/json Authorization=${token}
|
||||
${success} downloadexcel ${header} ${logCondition} http://${host}:${port}/${version}/log/batch
|
||||
log ${success}
|
||||
Should Be Equal ${success} ${200} active_defence_event_log\ test query export failed
|
||||
|
||||
ExportLog-017
|
||||
${conditions} Set Variable { "field":"common_policy_id", "type":"int", "symbol":">=", "value":["774"] }
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} GetLogCondition ${logname} 2020-04-26 12:27:03 2020-04-27 13:27:03 30 1
|
||||
... ${conditions}
|
||||
log ${logCondition}
|
||||
${header} Create Dictionary Content-Type=application/json Authorization=${token}
|
||||
${success} downloadexcel ${header} ${logCondition} http://${host}:${port}/${version}/log/batch
|
||||
log ${success}
|
||||
Should Be Equal ${success} ${200} active_defence_event_log\ test query export failed
|
||||
|
||||
ExportLog-018
|
||||
${conditions} Set Variable { "field":"common_policy_id", "type":"int", "symbol":"in", "value":["774","95"] }
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} GetLogCondition ${logname} 2020-04-26 12:27:03 2020-04-27 13:27:03 30 1
|
||||
... ${conditions}
|
||||
log ${logCondition}
|
||||
${header} Create Dictionary Content-Type=application/json Authorization=${token}
|
||||
${success} downloadexcel ${header} ${logCondition} http://${host}:${port}/${version}/log/batch
|
||||
log ${success}
|
||||
Should Be Equal ${success} ${200} active_defence_event_log\ test query export failed
|
||||
|
||||
ExportLog-019
|
||||
${conditions} Set Variable { "field":"common_recv_time", "type":"timestamp", "value":["2020-04-27 12:48:33"] }
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} GetLogCondition ${logname} 2020-04-26 12:27:03 2020-04-27 13:27:03 30 1
|
||||
... ${conditions}
|
||||
log ${logCondition}
|
||||
${header} Create Dictionary Content-Type=application/json Authorization=${token}
|
||||
${success} downloadexcel ${header} ${logCondition} http://${host}:${port}/${version}/log/batch
|
||||
log ${success}
|
||||
Should Be Equal ${success} ${200} active_defence_event_log\ test query export failed
|
||||
|
||||
ExportLog-020
|
||||
${conditions} Set Variable { "field":"common_recv_time", "type":"timestamp", "symbol":">", "value":["2020-04-27 12:48:33"] }
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} GetLogCondition ${logname} 2020-04-26 12:27:03 2020-04-27 13:27:03 30 1
|
||||
... ${conditions}
|
||||
log ${logCondition}
|
||||
${header} Create Dictionary Content-Type=application/json Authorization=${token}
|
||||
${success} downloadexcel ${header} ${logCondition} http://${host}:${port}/${version}/log/batch
|
||||
log ${success}
|
||||
Should Be Equal ${success} ${200} active_defence_event_log\ test query export failed
|
||||
|
||||
ExportLog-021
|
||||
${conditions} Set Variable { "field":"common_recv_time", "type":"timestamp", "symbol":"<", "value":["2020-04-27 12:48:33"] }
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} GetLogCondition ${logname} 2020-04-26 12:27:03 2020-04-27 13:27:03 30 1
|
||||
... ${conditions}
|
||||
log ${logCondition}
|
||||
${header} Create Dictionary Content-Type=application/json Authorization=${token}
|
||||
${success} downloadexcel ${header} ${logCondition} http://${host}:${port}/${version}/log/batch
|
||||
log ${success}
|
||||
Should Be Equal ${success} ${200} active_defence_event_log\ test query export failed
|
||||
|
||||
ExportLog-022
|
||||
${conditions} Set Variable { "field":"common_recv_time", "type":"timestamp", "symbol":"<=", "value":["2020-04-27 12:48:33"] }
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} GetLogCondition ${logname} 2020-04-26 12:27:03 2020-04-27 13:27:03 30 1
|
||||
... ${conditions}
|
||||
log ${logCondition}
|
||||
${header} Create Dictionary Content-Type=application/json Authorization=${token}
|
||||
${success} downloadexcel ${header} ${logCondition} http://${host}:${port}/${version}/log/batch
|
||||
log ${success}
|
||||
Should Be Equal ${success} ${200} active_defence_event_log\ test query export failed
|
||||
|
||||
ExportLog-023
|
||||
${conditions} Set Variable { "field":"common_recv_time", "type":"timestamp", "symbol":">=", "value":["2020-04-27 12:48:33"] }
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} GetLogCondition ${logname} 2020-04-26 12:27:03 2020-04-27 13:27:03 30 1
|
||||
... ${conditions}
|
||||
log ${logCondition}
|
||||
${header} Create Dictionary Content-Type=application/json Authorization=${token}
|
||||
${success} downloadexcel ${header} ${logCondition} http://${host}:${port}/${version}/log/batch
|
||||
log ${success}
|
||||
Should Be Equal ${success} ${200} active_defence_event_log\ test query export failed
|
||||
|
||||
ExportLog-024
|
||||
${conditions} Set Variable { "field":"common_recv_time", "type":"timestamp", "symbol":"between", "value":["2020-04-27 12:48:33","2020-04-27 13:27:03"] }
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} GetLogCondition ${logname} 2020-04-26 12:27:03 2020-04-27 13:27:03 30 1
|
||||
... ${conditions}
|
||||
log ${logCondition}
|
||||
${header} Create Dictionary Content-Type=application/json Authorization=${token}
|
||||
${success} downloadexcel ${header} ${logCondition} http://${host}:${port}/${version}/log/batch
|
||||
log ${success}
|
||||
Should Be Equal ${success} ${200} active_defence_event_log\ test query export failed
|
||||
|
||||
ExportLog-025
|
||||
${conditions} Set Variable { "field":"common_recv_time", "type":"timestamp", "value":["2020-04-27 12:48:33","2020-04-27 13:27:03"] }
|
||||
${logname} Set Variable active_defence_event_log
|
||||
${logCondition} GetLogCondition ${logname} 2020-04-26 12:27:03 2020-04-27 13:27:03 30 1
|
||||
... ${conditions}
|
||||
log ${logCondition}
|
||||
${header} Create Dictionary Content-Type=application/json Authorization=${token}
|
||||
${success} downloadexcel ${header} ${logCondition} http://${host}:${port}/${version}/log/batch
|
||||
log ${success}
|
||||
Should Be Equal ${success} ${200} active_defence_event_log\ test query export failed
|
||||
|
||||
*** Keywords ***
|
||||
310
01-TestCase/tsg_bfapi/active_defence_event_log/Log_search.robot
Normal file
310
01-TestCase/tsg_bfapi/active_defence_event_log/Log_search.robot
Normal file
@@ -0,0 +1,310 @@
|
||||
*** Settings ***
|
||||
Force Tags api api-log api-log-active_defence_event_log api-log-active_defence_event_log-search
|
||||
Library OperatingSystem
|
||||
Library Selenium2Library
|
||||
Library RequestsLibrary
|
||||
Library Collections
|
||||
Resource ../../../02-Keyword/tsg_bfapi/Log_schema.robot
|
||||
Resource ../../../02-Keyword/tsg_bfapi/Log_search.robot
|
||||
Library string
|
||||
Library REST http://${host}:${port}/${version}
|
||||
Resource ../../../02-Keyword/tsg_bfapi/Log_keyword.robot
|
||||
|
||||
*** Test Cases ***
|
||||
log-schema-001
|
||||
${filds} schema
|
||||
log ${filds}
|
||||
|
||||
log-search-002
|
||||
#${filds} schema
|
||||
${responsedata} Get-Request log/schema?logType=active_defence_event_log
|
||||
${filds} Set Variable ${responsedata['data']['fields']}
|
||||
${response} log_search 2020-04-26 12:27:03 2020-04-27 13:27:03 active_defence_event_log ${filds} []
|
||||
log ${response}
|
||||
Should Be Equal As Strings ${response.code} 200
|
||||
|
||||
log-search-003
|
||||
#${filds} schema
|
||||
${responsedata} Get-Request log/schema?logType=active_defence_event_log
|
||||
${filds} Set Variable ${responsedata['data']['fields']}
|
||||
${conditions} Set Variable {"field":"common_log_id","type":"long","symbol":"=","value":["59526984506148866"] }
|
||||
${response} log_search 2020-04-26 12:27:03 2020-04-27 13:27:03 active_defence_event_log ${filds} [${conditions}]
|
||||
log ${response}
|
||||
Should Be Equal As Strings ${response.code} 200
|
||||
${responsedata} Get From Dictionary ${response} data
|
||||
log ${responsedata}
|
||||
${responselist} Get From Dictionary ${responsedata} list
|
||||
${logid} Set Variable ${responselist}[0][common_log_id]
|
||||
Should Be Equal As Strings ${logid} 59526984506148866
|
||||
|
||||
log-search-004
|
||||
#${filds} schema
|
||||
${responsedata} Get-Request log/schema?logType=active_defence_event_log
|
||||
${filds} Set Variable ${responsedata['data']['fields']}
|
||||
${conditions} Set Variable { "field":"common_recv_time", "type":"timestamp", "symbol":"=", "value":["2020-04-27 12:48:33"] }
|
||||
${response} log_search 2020-04-26 12:27:03 2020-04-27 13:27:03 active_defence_event_log ${filds} [${conditions}]
|
||||
log ${response}
|
||||
Should Be Equal As Strings ${response.code} 200
|
||||
${responsedata} Get From Dictionary ${response} data
|
||||
log ${responsedata}
|
||||
${responselist} Get From Dictionary ${responsedata} list
|
||||
${time} Set Variable ${responselist}[0][common_recv_time]
|
||||
Should Be Equal As Strings ${time} 2020-04-27 12:48:33
|
||||
|
||||
log-search-005
|
||||
#${filds} schema
|
||||
${responsedata} Get-Request log/schema?logType=active_defence_event_log
|
||||
${filds} Set Variable ${responsedata['data']['fields']}
|
||||
${conditions} Set Variable { "field":"common_policy_id", "type":"int", "symbol":"=", "value":["774"] }
|
||||
${response} log_search 2020-04-26 12:27:03 2020-04-27 13:27:03 active_defence_event_log ${filds} ${conditions}
|
||||
log ${response}
|
||||
Should Be Equal As Strings ${response.code} 200
|
||||
${responsedata} Get From Dictionary ${response} data
|
||||
log ${responsedata}
|
||||
${responselist} Get From Dictionary ${responsedata} list
|
||||
${policyid} Set Variable ${responselist}[0][common_policy_id]
|
||||
Should Be Equal As Strings ${policyid} 774
|
||||
|
||||
log-search-006
|
||||
#${filds} schema
|
||||
${responsedata} Get-Request log/schema?logType=active_defence_event_log
|
||||
${filds} Set Variable ${responsedata['data']['fields']}
|
||||
${conditions} Set Variable { "field":"ad_cc_target_url", "type":"string", "symbol":"sub", "value":["www.jianshu.com"] }
|
||||
${response} log_search 2020-04-26 12:27:03 2020-04-27 13:27:03 active_defence_event_log ${filds} ${conditions}
|
||||
log ${response}
|
||||
Should Be Equal As Strings ${response.code} 200
|
||||
${responsedata} Get From Dictionary ${response} data
|
||||
log ${responsedata}
|
||||
${responselist} Get From Dictionary ${responsedata} list
|
||||
log ${responselist}
|
||||
should be empty ${responselist}
|
||||
|
||||
log-search-007
|
||||
#${filds} schema
|
||||
${responsedata} Get-Request log/schema?logType=active_defence_event_log
|
||||
${filds} Set Variable ${responsedata['data']['fields']}
|
||||
${conditions} Set Variable { "field":"ad_target_ip", "type":"string", "symbol":"sub", "value":["22"] }
|
||||
${response} log_search 2020-04-26 12:27:03 2020-04-27 13:27:03 active_defence_event_log ${filds} ${conditions}
|
||||
log ${response}
|
||||
Should Be Equal As Strings ${response.code} 200
|
||||
${responsedata} Get From Dictionary ${response} data
|
||||
log ${responsedata}
|
||||
${responselist} Get From Dictionary ${responsedata} list
|
||||
${ip} Set Variable ${responselist}[0][ad_target_ip]
|
||||
should contain ${ip} 22
|
||||
|
||||
log-search-008
|
||||
#${filds} schema
|
||||
${responsedata} Get-Request log/schema?logType=active_defence_event_log
|
||||
${filds} Set Variable ${responsedata['data']['fields']}
|
||||
${conditions} Set Variable { "field":"ad_target_ip", "type":"string", "symbol":"prefix", "value":["10"] }
|
||||
${response} log_search 2020-04-26 12:27:03 2020-04-27 13:27:03 active_defence_event_log ${filds} ${conditions}
|
||||
log ${response}
|
||||
Should Be Equal As Strings ${response.code} 200
|
||||
${responsedata} Get From Dictionary ${response} data
|
||||
log ${responsedata}
|
||||
${responselist} Get From Dictionary ${responsedata} list
|
||||
${ip} Set Variable ${responselist}[0][ad_target_ip]
|
||||
should contain ${ip} 10
|
||||
|
||||
log-search-009
|
||||
#${filds} schema
|
||||
${responsedata} Get-Request log/schema?logType=active_defence_event_log
|
||||
${filds} Set Variable ${responsedata['data']['fields']}
|
||||
${conditions} Set Variable { "field":"ad_target_ip", "type":"string", "symbol":"suffix", "value":["222"] }
|
||||
${response} log_search 2020-04-26 12:27:03 2020-04-27 13:27:03 active_defence_event_log ${filds} ${conditions}
|
||||
log ${response}
|
||||
Should Be Equal As Strings ${response.code} 200
|
||||
${responsedata} Get From Dictionary ${response} data
|
||||
log ${responsedata}
|
||||
${responselist} Get From Dictionary ${responsedata} list
|
||||
${ip} Set Variable ${responselist}[0][ad_target_ip]
|
||||
should contain ${ip} 222
|
||||
|
||||
log-search-010
|
||||
#${filds} schema
|
||||
${responsedata} Get-Request log/schema?logType=active_defence_event_log
|
||||
${filds} Set Variable ${responsedata['data']['fields']}
|
||||
${conditions} Set Variable { "field":"ad_target_ip", "type":"string", "symbol":"exactly", "value":["10.3.22.222"] }
|
||||
${response} log_search 2020-04-26 12:27:03 2020-04-27 13:27:03 active_defence_event_log ${filds} ${conditions}
|
||||
log ${response}
|
||||
Should Be Equal As Strings ${response.code} 200
|
||||
${responsedata} Get From Dictionary ${response} data
|
||||
log ${responsedata}
|
||||
${responselist} Get From Dictionary ${responsedata} list
|
||||
${ip} Set Variable ${responselist}[0][ad_target_ip]
|
||||
Should Be Equal As Strings ${ip} 10.3.22.222
|
||||
|
||||
log-search-011
|
||||
#${filds} schema
|
||||
${responsedata} Get-Request log/schema?logType=active_defence_event_log
|
||||
${filds} Set Variable ${responsedata['data']['fields']}
|
||||
${conditions} Set Variable { "field":"ad_target_ip", "type":"string", "symbol":"exactly", "value":["10.3.22.222"] },{"field":"common_log_id","type":"long","symbol":"=","value":["59526984506148866"] },{ "field":"common_recv_time", "type":"timestamp", "symbol":"=", "value":["2020-04-27 13:27:02"] },{ "field":"common_policy_id", "type":"int", "symbol":"=", "value":["95"] }
|
||||
${response} log_search 2020-04-26 12:27:03 2020-04-27 13:27:03 active_defence_event_log ${filds} [${conditions}]
|
||||
log ${response}
|
||||
Should Be Equal As Strings ${response.code} 200
|
||||
${responsedata} Get From Dictionary ${response} data
|
||||
log ${responsedata}
|
||||
${responselist} Get From Dictionary ${responsedata} list
|
||||
${ip} Set Variable ${responselist}[0][ad_target_ip]
|
||||
Should Be Equal As Strings ${ip} 10.3.22.222
|
||||
${time} Set Variable ${responselist}[0][common_recv_time]
|
||||
Should Be Equal As Strings ${time} 2020-04-27 13:27:02
|
||||
${logid} Set Variable ${responselist}[0][common_log_id]
|
||||
Should Be Equal As Strings ${logid} 59526984506148866
|
||||
${policyid} Set Variable ${responselist}[0][common_policy_id]
|
||||
Should Be Equal As Strings ${policyid} 95
|
||||
|
||||
log-search-012
|
||||
${conditions} Set Variable {"field":"common_log_id","type":"long","symbol":"=","value":["59526984506148866"] }
|
||||
${simpleCondition} Set Variable "common_server_ips": "40"
|
||||
${logCondition} GetLogCondition active_defence_event_log 2020-04-26 12:27:03 2020-04-27 13:27:03 30 1
|
||||
... ${conditions}
|
||||
${response} BasePostRequest v1/log/list ${logCondition}
|
||||
Should Be Equal As Strings ${response.code} 200
|
||||
${responsedata} Get From Dictionary ${response} data
|
||||
log ${responsedata}
|
||||
${responselist} Get From Dictionary ${responsedata} list
|
||||
${logid} Set Variable ${responselist}[0][common_log_id]
|
||||
Should Be Equal As Strings ${logid} 59526984506148866
|
||||
|
||||
log-search-013
|
||||
#${filds} schema
|
||||
${responsedata} Get-Request log/schema?logType=active_defence_event_log
|
||||
${filds} Set Variable ${responsedata['data']['fields']}
|
||||
${conditions} Set Variable { "field":"common_policy_id", "type":"int", "value":["774"] }
|
||||
${response} log_search 2020-04-26 12:27:03 2020-04-27 13:27:03 active_defence_event_log ${filds} ${conditions}
|
||||
log ${response}
|
||||
Should Be Equal As Strings ${response.code} 200
|
||||
${responsedata} Get From Dictionary ${response} data
|
||||
log ${responsedata}
|
||||
${responselist} Get From Dictionary ${responsedata} list
|
||||
${policyid} Set Variable ${responselist}[0][common_policy_id]
|
||||
Should Be Equal As Strings ${policyid} 774
|
||||
|
||||
log-search-014
|
||||
#${filds} schema
|
||||
${responsedata} Get-Request log/schema?logType=active_defence_event_log
|
||||
${filds} Set Variable ${responsedata['data']['fields']}
|
||||
${conditions} Set Variable { "field":"common_policy_id", "type":"int", "symbol":"!=", "value":["774"] }
|
||||
${response} log_search 2020-04-26 12:27:03 2020-04-27 13:27:03 active_defence_event_log ${filds} ${conditions}
|
||||
log ${response}
|
||||
Should Be Equal As Strings ${response.code} 200
|
||||
|
||||
log-search-015
|
||||
#${filds} schema
|
||||
${responsedata} Get-Request log/schema?logType=active_defence_event_log
|
||||
${filds} Set Variable ${responsedata['data']['fields']}
|
||||
${conditions} Set Variable { "field":"common_policy_id", "type":"int", "symbol":">", "value":["774"] }
|
||||
${response} log_search 2020-04-26 12:27:03 2020-04-27 13:27:03 active_defence_event_log ${filds} ${conditions}
|
||||
log ${response}
|
||||
Should Be Equal As Strings ${response.code} 200
|
||||
|
||||
log-search-016
|
||||
#${filds} schema
|
||||
${responsedata} Get-Request log/schema?logType=active_defence_event_log
|
||||
${filds} Set Variable ${responsedata['data']['fields']}
|
||||
${conditions} Set Variable { "field":"common_policy_id", "type":"int", "symbol":"<", "value":["774"] }
|
||||
${response} log_search 2020-04-26 12:27:03 2020-04-27 13:27:03 active_defence_event_log ${filds} ${conditions}
|
||||
log ${response}
|
||||
Should Be Equal As Strings ${response.code} 200
|
||||
|
||||
log-search-017
|
||||
#${filds} schema
|
||||
${responsedata} Get-Request log/schema?logType=active_defence_event_log
|
||||
${filds} Set Variable ${responsedata['data']['fields']}
|
||||
${conditions} Set Variable { "field":"common_policy_id", "type":"int", "symbol":"<=", "value":["774"] }
|
||||
${response} log_search 2020-04-26 12:27:03 2020-04-27 13:27:03 active_defence_event_log ${filds} ${conditions}
|
||||
log ${response}
|
||||
Should Be Equal As Strings ${response.code} 200
|
||||
|
||||
log-search-018
|
||||
#${filds} schema
|
||||
${responsedata} Get-Request log/schema?logType=active_defence_event_log
|
||||
${filds} Set Variable ${responsedata['data']['fields']}
|
||||
${conditions} Set Variable { "field":"common_policy_id", "type":"int", "symbol":">=", "value":["774"] }
|
||||
${response} log_search 2020-04-26 12:27:03 2020-04-27 13:27:03 active_defence_event_log ${filds} ${conditions}
|
||||
log ${response}
|
||||
Should Be Equal As Strings ${response.code} 200
|
||||
|
||||
log-search-019
|
||||
#${filds} schema
|
||||
${responsedata} Get-Request log/schema?logType=active_defence_event_log
|
||||
${filds} Set Variable ${responsedata['data']['fields']}
|
||||
${conditions} Set Variable { "field":"common_policy_id", "type":"int", "symbol":"in", "value":["774","95"] }
|
||||
${response} log_search 2020-04-26 12:27:03 2020-04-27 13:27:03 active_defence_event_log ${filds} ${conditions}
|
||||
log ${response}
|
||||
Should Be Equal As Strings ${response.code} 200
|
||||
|
||||
log-search-020
|
||||
#${filds} schema
|
||||
${responsedata} Get-Request log/schema?logType=active_defence_event_log
|
||||
${filds} Set Variable ${responsedata['data']['fields']}
|
||||
${conditions} Set Variable { "field":"common_recv_time", "type":"timestamp", "value":["2020-04-27 12:48:33"] }
|
||||
${response} log_search 2020-04-26 12:27:03 2020-04-27 13:27:03 active_defence_event_log ${filds} [${conditions}]
|
||||
log ${response}
|
||||
Should Be Equal As Strings ${response.code} 200
|
||||
${responsedata} Get From Dictionary ${response} data
|
||||
log ${responsedata}
|
||||
${responselist} Get From Dictionary ${responsedata} list
|
||||
${time} Set Variable ${responselist}[0][common_recv_time]
|
||||
Should Be Equal As Strings ${time} 2020-04-27 12:48:33
|
||||
|
||||
log-search-021
|
||||
#${filds} schema
|
||||
${responsedata} Get-Request log/schema?logType=active_defence_event_log
|
||||
${filds} Set Variable ${responsedata['data']['fields']}
|
||||
${conditions} Set Variable { "field":"common_recv_time", "type":"timestamp", "symbol":">", "value":["2020-04-27 12:48:33"] }
|
||||
${response} log_search 2020-04-26 12:27:03 2020-04-27 13:27:03 active_defence_event_log ${filds} [${conditions}]
|
||||
log ${response}
|
||||
Should Be Equal As Strings ${response.code} 200
|
||||
|
||||
log-search-022
|
||||
#${filds} schema
|
||||
${responsedata} Get-Request log/schema?logType=active_defence_event_log
|
||||
${filds} Set Variable ${responsedata['data']['fields']}
|
||||
${conditions} Set Variable { "field":"common_recv_time", "type":"timestamp", "symbol":"<", "value":["2020-04-27 12:48:33"] }
|
||||
${response} log_search 2020-04-26 12:27:03 2020-04-27 13:27:03 active_defence_event_log ${filds} [${conditions}]
|
||||
log ${response}
|
||||
Should Be Equal As Strings ${response.code} 200
|
||||
|
||||
log-search-023
|
||||
#${filds} schema
|
||||
${responsedata} Get-Request log/schema?logType=active_defence_event_log
|
||||
${filds} Set Variable ${responsedata['data']['fields']}
|
||||
${conditions} Set Variable { "field":"common_recv_time", "type":"timestamp", "symbol":"<=", "value":["2020-04-27 12:48:33"] }
|
||||
${response} log_search 2020-04-26 12:27:03 2020-04-27 13:27:03 active_defence_event_log ${filds} [${conditions}]
|
||||
log ${response}
|
||||
Should Be Equal As Strings ${response.code} 200
|
||||
${responsedata} Get From Dictionary ${response} data
|
||||
log ${responsedata}
|
||||
${responselist} Get From Dictionary ${responsedata} list
|
||||
${time} Set Variable ${responselist}[0][common_recv_time]
|
||||
Should Be Equal As Strings ${time} 2020-04-27 12:48:33
|
||||
|
||||
log-search-024
|
||||
#${filds} schema
|
||||
${responsedata} Get-Request log/schema?logType=active_defence_event_log
|
||||
${filds} Set Variable ${responsedata['data']['fields']}
|
||||
${conditions} Set Variable { "field":"common_recv_time", "type":"timestamp", "symbol":">=", "value":["2020-04-27 12:48:33"] }
|
||||
${response} log_search 2020-04-26 12:27:03 2020-04-27 13:27:03 active_defence_event_log ${filds} [${conditions}]
|
||||
log ${response}
|
||||
Should Be Equal As Strings ${response.code} 200
|
||||
|
||||
log-search-025
|
||||
#${filds} schema
|
||||
${responsedata} Get-Request log/schema?logType=active_defence_event_log
|
||||
${filds} Set Variable ${responsedata['data']['fields']}
|
||||
${conditions} Set Variable { "field":"common_recv_time", "type":"timestamp", "symbol":"between", "value":["2020-04-27 12:48:33","2020-04-27 13:27:03"] }
|
||||
${response} log_search 2020-04-26 12:27:03 2020-04-27 13:27:03 active_defence_event_log ${filds} [${conditions}]
|
||||
log ${response}
|
||||
Should Be Equal As Strings ${response.code} 200
|
||||
|
||||
log-search-026
|
||||
#${filds} schema
|
||||
${responsedata} Get-Request log/schema?logType=active_defence_event_log
|
||||
${filds} Set Variable ${responsedata['data']['fields']}
|
||||
${conditions} Set Variable { "field":"common_recv_time", "type":"timestamp", "value":["2020-04-27 12:48:33","2020-04-27 13:27:03"] }
|
||||
${response} log_search 2020-04-26 12:27:03 2020-04-27 13:27:03 active_defence_event_log ${filds} [${conditions}]
|
||||
log ${response}
|
||||
Should Be Equal As Strings ${response.code} 200
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,14 @@
|
||||
import requests
|
||||
|
||||
|
||||
def downloadexcel(headers,data,url):
|
||||
response = requests.post(url, headers=headers, data=data)
|
||||
if response.status_code == 200:
|
||||
with open("active_defence_event_log"+".xlsx", "wb") as code:
|
||||
code.write(response.content)
|
||||
return 200;
|
||||
else:
|
||||
print('导出失败'+response.content)
|
||||
return 500;
|
||||
if __name__ == '__main__':
|
||||
downloadexcel(header,data,url)
|
||||
64
01-TestCase/tsg_bfapi/policy_file_interface/Decryption.robot
Normal file
64
01-TestCase/tsg_bfapi/policy_file_interface/Decryption.robot
Normal file
@@ -0,0 +1,64 @@
|
||||
*** Settings ***
|
||||
Test Teardown TeardownDelete ${url} profileIds ${profileId}
|
||||
Force Tags tsg_bf_api Response_Pages
|
||||
Library String
|
||||
Library OperatingSystem
|
||||
Library Selenium2Library
|
||||
Library Collections
|
||||
Resource ../../../02-Keyword/tsg_bfapi/Common.robot
|
||||
Resource ../../../02-Keyword/tsg_bfapi/policy_file_interface/FunctionalKeywords.robot
|
||||
Resource ../../../03-Variable/BifangApiVariable.txt
|
||||
|
||||
*** Variables ***
|
||||
${url} /policy/profile/decryption
|
||||
${profileId} ${EMPTY}
|
||||
|
||||
*** Test Cases ***
|
||||
Decryption_ADD_001
|
||||
|
||||
Comment 全串{"opAction":"add","returnData":1,"list":[{"profileName":"autotest_decryption_add","decryption":{"dynamic_bypass":{"ev_cert":1,"cert_transparency":1,"mutual_authentication":1,"cert_pinning":1,"protocol_errors":1},"protocol_version":{"min":"ssl3","max":"tls13","mirror_client":1,"allow_http2":1},"certificate_checks":{"approach":{"cn":1,"issuer":1,"self-signed":1,"expiration":1},"fail_action":"fail-close"}},"isValid":1,"isInitialize":0,"profileDesc":""}]}
|
||||
Comment "dynamic_bypass":{"ev_cert":1,"cert_transparency":1,"mutual_authentication":1,"cert_pinning":1,"protocol_errors":1}
|
||||
Comment "protocol_version":{"min":"ssl3","max":"tls13","mirror_client":1,"allow_http2":1}
|
||||
Comment dynamic_bypass
|
||||
Comment 拦截排除参数对象
|
||||
Comment ev_cert Integer 是 ON/OFF,缺省OFF,1表示ON,0表示OFF
|
||||
Comment cert_transparency Integer 是 ON/OFF,缺省OFF,1表示ON,0表示OFF
|
||||
Comment mutual_authentication Integer 是 ON/OFF,缺省ON,1表示ON,0表示OFF
|
||||
Comment cert_pinning Integer 是 Blocl/Bypass,缺省Block,1表示Block,0表示Bypass
|
||||
Comment protocol_errors Integer 是 ON/OFF,缺省ON,1表示ON,0表示OFF
|
||||
Comment protocol_version Object 是 协议版本对象
|
||||
Comment min Integer 否 如果mirror_client=1,则此参数可为空
|
||||
Comment max Integer 否 如果mirror_client=1,则此参数可为空
|
||||
Comment mirror_client Integer 是 ON/OFF,缺省ON,1表示ON,0表示OFF
|
||||
Comment allow_http2 Integer 是 1表示ON,0表示OFF
|
||||
Comment certificate_checks Object 是 证书检查参数对象
|
||||
Comment approachObject 是 certificateChecksObj对象参数
|
||||
Comment cn Integer 是 approach对象参数,ON/OFF,缺省ON, 1表示ON,0表示OFF
|
||||
Comment issuer Integer 是 approach对象参数,ON/OFF,缺省ON, 1表示ON,0表示OFF
|
||||
Comment self-signed Integer 是 approach对象参数, ON/OFF,缺省ON, 1表示ON,0表示OFF
|
||||
Comment expiration Integer 是 approach对象参数,ON/OFF,缺省ON, 1表示ON,0表示OFF
|
||||
Comment fail_action String 是 certificateChecksObj对象参数,值为: fail-close pass-through
|
||||
Comment isValid Integer 是 是否有效
|
||||
Comment isInitialize Integer 否 0:非内置,缺省 1:内置
|
||||
|
||||
${dynamic_bypass} set variable "dynamic_bypass":{"ev_cert":1,"cert_transparency":1,"mutual_authentication":1,"cert_pinning":1,"protocol_errors":1}
|
||||
${protocol_version} set variable "protocol_version":{"min":"","max":"","mirror_client":1,"allow_http2":1}
|
||||
${certificate_checks} set variable "certificate_checks":{"approach":{"cn":1,"issuer":1,"self-signed":1,"expiration":1},"fail_action":"fail-close"}
|
||||
${requestbody} set variable {"opAction":"add","returnData":1,"list":[{"profileName":"autotest_decryption_add","decryption":{${dynamic_bypass},${protocol_version},${certificate_checks}},"isValid":1,"isInitialize":0,"profileDesc":""}]}
|
||||
${data} Create List ${requestbody}
|
||||
${response} CreatePolicyFileNoFile ${url} ${data}
|
||||
|
||||
# 查询
|
||||
${profileId} Get From Dictionary ${response} profileId
|
||||
${profileName} Get From Dictionary ${response} profileName
|
||||
QueryPolicyFile ${url} profileId=${profileId}&profileName=${profileName}
|
||||
|
||||
|
||||
# 修改
|
||||
${dynamic_bypass}="dynamic_bypass":{"ev_cert":0,"cert_transparency":0,"mutual_authentication":0,"cert_pinning":0,"protocol_errors":0}
|
||||
${protocol_version}="protocol_version":{"min":"ssl3","max":"tls13","mirror_client":0,"allow_http2":0}
|
||||
${certificate_checks}="certificate_checks":{"approach":{"cn":0,"issuer":0,"self-signed":0,"expiration":0},"fail_action":"pass-through"}
|
||||
${requestbody}={"opAction":"add","returnData":1,"list":[{"profileName":"autotest_decryption_edit","decryption":{${dynamic_bypass},${protocol_version},${certificate_checks}},"isValid":0,"isInitialize":0,"profileDesc":""}]}
|
||||
@{data} set variable ${requestbody}
|
||||
UpdatePolicyFile2 ${url} ${reqData_edit} @{data}
|
||||
|
||||
@@ -17,7 +17,7 @@ ${profileId} ${EMPTY}
|
||||
Hijack Files Policy CRUD case
|
||||
|
||||
# 新增
|
||||
${response} CreatePolicyFile2 ${url} Hijack Files-files/ Create-Hijack Files-test-3.html hijack
|
||||
${response} CreatePolicyFile2 ${url} hijack_files/ Create-Hijack Files-test-3.html hijack
|
||||
|
||||
# 查询
|
||||
${profileId} Get From Dictionary ${response} profileId
|
||||
|
||||
@@ -17,7 +17,7 @@ ${profileId} ${EMPTY}
|
||||
Insert Scripts Policy CRUD case
|
||||
|
||||
# 新增
|
||||
${response} CreatePolicyFile2 ${url} Insert Scripts-files/ Create-Insert Scripts-test-1.js insert
|
||||
${response} CreatePolicyFile2 ${url} insert_files/ Create-Insert Scripts-test-1.js insert
|
||||
|
||||
# 查询
|
||||
${profileId} Get From Dictionary ${response} profileId
|
||||
|
||||
@@ -17,7 +17,7 @@ ${keyringId} ${EMPTY}
|
||||
Keyring Policy File case
|
||||
|
||||
# 新增
|
||||
${response} CreatePolicyMutipartFile ${url} Keyrings/root/ mesalab-ca-cert.pem mesalab-ca-key.pem
|
||||
${response} CreatePolicyMutipartFile ${url} keyrings/root/ mesalab-ca-cert.pem mesalab-ca-key.pem
|
||||
|
||||
# 查询
|
||||
${keyringId} Get From Dictionary ${response} keyringId
|
||||
|
||||
@@ -17,7 +17,7 @@ ${profileId} ${EMPTY}
|
||||
Response Pages Policy CRUD case
|
||||
|
||||
# 新增
|
||||
${response} CreatePolicyFile2 ${url} Response pages-files/ Create-Response Pages-test-1.html resPages
|
||||
${response} CreatePolicyFile2 ${url} response_pages_files/ Create-Response Pages-test-1.html resPages
|
||||
|
||||
# 查询
|
||||
${profileId} Get From Dictionary ${response} profileId
|
||||
|
||||
@@ -17,7 +17,7 @@ ${certId} ${EMPTY}
|
||||
Trusted Cert Policy CRUD case
|
||||
|
||||
# 新增
|
||||
${response} CreatePolicyFile ${url} Keyrings/root/ tango-ca-trust-ca-cer.pem
|
||||
${response} CreatePolicyFile ${url} keyrings/root/ tango-ca-trust-ca-cer.pem
|
||||
|
||||
# 查询
|
||||
${certId} Get From Dictionary ${response} certId
|
||||
|
||||
Reference in New Issue
Block a user