主动防御接口case

This commit is contained in:
lyf
2020-04-29 19:39:52 +08:00
parent 7e38504505
commit 78e3622184
14 changed files with 1094 additions and 25 deletions

View 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]

View 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 ***

View 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

View File

@@ -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)