This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
dongxiaoyan fc79ac3782 1、添加时间工具关键字
2、调整部分错误
2020-06-18 13:46:16 +08:00

336 lines
18 KiB
Plaintext

*** 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
Resource ../../../02-Keyword/tsg_bfapi/CommonUtil.robot
*** Variables ***
@{logType} security_event_log proxy_event_log connection_record_log radius_record_log
${apipath} http://${host}:${port}/${version}
*** Test Cases ***
ExportLog-001
${conditions} Set Variable {"field":"common_log_id","type":"long","symbol":"=","value":["59526984506148866"] }
${logname} Set Variable active_defence_event_log
${starttime} ${endtime} GetLast24HoursStartAndEndTime
${logCondition} GetLogCondition ${logname} ${starttime} ${endtime} 30 1
... ${conditions}
log ${logCondition}
${header} Create Dictionary Content-Type=application/json Authorization=${token}
${success} downloadexcel ${header} ${logCondition} ${apipath}/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
${starttime} ${endtime} GetLast24HoursStartAndEndTime
${logCondition} GetLogCondition ${logname} ${starttime} ${endtime} 30 1
... ${conditions}
log ${logCondition}
${header} Create Dictionary Content-Type=application/json Authorization=${token}
${success} downloadexcel ${header} ${logCondition} ${apipath}/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
${starttime} ${endtime} GetLast24HoursStartAndEndTime
${logCondition} GetLogCondition ${logname} ${starttime} ${endtime} 30 1
... ${conditions}
log ${logCondition}
${header} Create Dictionary Content-Type=application/json Authorization=${token}
${success} downloadexcel ${header} ${logCondition} ${apipath}/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
${starttime} ${endtime} GetLast24HoursStartAndEndTime
${logCondition} GetLogCondition ${logname} ${starttime} ${endtime} 30 1
... ${conditions}
log ${logCondition}
${header} Create Dictionary Content-Type=application/json Authorization=${token}
${success} downloadexcel ${header} ${logCondition} ${apipath}/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
${starttime} ${endtime} GetLast24HoursStartAndEndTime
${logCondition} GetLogCondition ${logname} ${starttime} ${endtime} 30 1
... ${conditions}
log ${logCondition}
${header} Create Dictionary Content-Type=application/json Authorization=${token}
${success} downloadexcel ${header} ${logCondition} ${apipath}/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
${starttime} ${endtime} GetLast24HoursStartAndEndTime
${logCondition} GetLogCondition ${logname} ${starttime} ${endtime} 30 1
... ${conditions}
log ${logCondition}
${header} Create Dictionary Content-Type=application/json Authorization=${token}
${success} downloadexcel ${header} ${logCondition} ${apipath}/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
${starttime} ${endtime} GetLast24HoursStartAndEndTime
${logCondition} GetLogCondition ${logname} ${starttime} ${endtime} 30 1
... [${conditions}]
log ${logCondition}
${header} Create Dictionary Content-Type=application/json Authorization=${token}
${success} downloadexcel ${header} ${logCondition} ${apipath}/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
${starttime} ${endtime} GetLast24HoursStartAndEndTime
${logCondition} GetLogCondition ${logname} ${starttime} ${endtime} 30 1
... ${conditions}
log ${logCondition}
${header} Create Dictionary Content-Type=application/json Authorization=${token}
${success} downloadexcel ${header} ${logCondition} ${apipath}/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
${starttime} ${endtime} GetLast24HoursStartAndEndTime
${logCondition} GetLogCondition ${logname} ${starttime} ${endtime} 30 1
... ${conditions}
log ${logCondition}
${header} Create Dictionary Content-Type=application/json Authorization=${token}
${success} downloadexcel ${header} ${logCondition} ${apipath}/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
${starttime} ${endtime} GetLast24HoursStartAndEndTime
${logCondition} GetLogCondition ${logname} ${starttime} ${endtime} 30 1
... ${conditions}
log ${logCondition}
${header} Create Dictionary Content-Type=application/json Authorization=${token}
${success} downloadexcel ${header} ${logCondition} ${apipath}/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
${starttime} ${endtime} GetLast24HoursStartAndEndTime
${logCondition} GetLogCondition ${logname} ${starttime} ${endtime} 30 1
... ${conditions}
log ${logCondition}
${header} Create Dictionary Content-Type=application/json Authorization=${token}
${success} downloadexcel ${header} ${logCondition} ${apipath}/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
${starttime} ${endtime} GetLast24HoursStartAndEndTime
${logCondition} GetLogCondition ${logname} ${starttime} ${endtime} 30 1
... ${conditions}
log ${logCondition}
${header} Create Dictionary Content-Type=application/json Authorization=${token}
${success} downloadexcel ${header} ${logCondition} ${apipath}/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
${starttime} ${endtime} GetLast24HoursStartAndEndTime
${logCondition} GetLogCondition ${logname} ${starttime} ${endtime} 30 1
... ${conditions}
log ${logCondition}
${header} Create Dictionary Content-Type=application/json Authorization=${token}
${success} downloadexcel ${header} ${logCondition} ${apipath}/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
${starttime} ${endtime} GetLast24HoursStartAndEndTime
${logCondition} GetLogCondition ${logname} ${starttime} ${endtime} 30 1
... ${conditions}
log ${logCondition}
${header} Create Dictionary Content-Type=application/json Authorization=${token}
${success} downloadexcel ${header} ${logCondition} ${apipath}/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
${starttime} ${endtime} GetLast24HoursStartAndEndTime
${logCondition} GetLogCondition ${logname} ${starttime} ${endtime} 30 1
... ${conditions}
log ${logCondition}
${header} Create Dictionary Content-Type=application/json Authorization=${token}
${success} downloadexcel ${header} ${logCondition} ${apipath}/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
${starttime} ${endtime} GetLast24HoursStartAndEndTime
${logCondition} GetLogCondition ${logname} ${starttime} ${endtime} 30 1
... ${conditions}
log ${logCondition}
${header} Create Dictionary Content-Type=application/json Authorization=${token}
${success} downloadexcel ${header} ${logCondition} ${apipath}/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
${starttime} ${endtime} GetLast24HoursStartAndEndTime
${logCondition} GetLogCondition ${logname} ${starttime} ${endtime} 30 1
... ${conditions}
log ${logCondition}
${header} Create Dictionary Content-Type=application/json Authorization=${token}
${success} downloadexcel ${header} ${logCondition} ${apipath}/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
${starttime} ${endtime} GetLast24HoursStartAndEndTime
${logCondition} GetLogCondition ${logname} ${starttime} ${endtime} 30 1
... ${conditions}
log ${logCondition}
${header} Create Dictionary Content-Type=application/json Authorization=${token}
${success} downloadexcel ${header} ${logCondition} ${apipath}/log/batch
log ${success}
Should Be Equal ${success} ${200} active_defence_event_log\ test query export failed
ExportLog-019
${starttime} ${endtime} GetLast24HoursStartAndEndTime
${conditions} Set Variable { "field":"common_recv_time", "type":"timestamp", "value":["${starttime}"] }
${logname} Set Variable active_defence_event_log
${logCondition} GetLogCondition ${logname} ${starttime} ${endtime} 30 1
... ${conditions}
log ${logCondition}
${header} Create Dictionary Content-Type=application/json Authorization=${token}
${success} downloadexcel ${header} ${logCondition} ${apipath}/log/batch
log ${success}
Should Be Equal ${success} ${200} active_defence_event_log\ test query export failed
ExportLog-020
${starttime} ${endtime} GetLast24HoursStartAndEndTime
${conditions} Set Variable { "field":"common_recv_time", "type":"timestamp", "symbol":">", "value":["${starttime}"] }
${logname} Set Variable active_defence_event_log
${logCondition} GetLogCondition ${logname} ${starttime} ${endtime} 30 1
... ${conditions}
log ${logCondition}
${header} Create Dictionary Content-Type=application/json Authorization=${token}
${success} downloadexcel ${header} ${logCondition} ${apipath}/log/batch
log ${success}
Should Be Equal ${success} ${200} active_defence_event_log\ test query export failed
ExportLog-021
${starttime} ${endtime} GetLast24HoursStartAndEndTime
${conditions} Set Variable { "field":"common_recv_time", "type":"timestamp", "symbol":"<", "value":["${endtime}"] }
${logname} Set Variable active_defence_event_log
${logCondition} GetLogCondition ${logname} ${starttime} ${endtime} 30 1
... ${conditions}
log ${logCondition}
${header} Create Dictionary Content-Type=application/json Authorization=${token}
${success} downloadexcel ${header} ${logCondition} ${apipath}/log/batch
log ${success}
Should Be Equal ${success} ${200} active_defence_event_log\ test query export failed
ExportLog-022
${starttime} ${endtime} GetLast24HoursStartAndEndTime
${conditions} Set Variable { "field":"common_recv_time", "type":"timestamp", "symbol":"<=", "value":["${endtime}"] }
${logname} Set Variable active_defence_event_log
${logCondition} GetLogCondition ${logname} ${starttime} ${endtime} 30 1
... ${conditions}
log ${logCondition}
${header} Create Dictionary Content-Type=application/json Authorization=${token}
${success} downloadexcel ${header} ${logCondition} ${apipath}/log/batch
log ${success}
Should Be Equal ${success} ${200} active_defence_event_log\ test query export failed
ExportLog-023
${starttime} ${endtime} GetLast24HoursStartAndEndTime
${conditions} Set Variable { "field":"common_recv_time", "type":"timestamp", "symbol":">=", "value":["${starttime}"] }
${logname} Set Variable active_defence_event_log
${logCondition} GetLogCondition ${logname} ${starttime} ${endtime} 30 1
... ${conditions}
log ${logCondition}
${header} Create Dictionary Content-Type=application/json Authorization=${token}
${success} downloadexcel ${header} ${logCondition} ${apipath}/log/batch
log ${success}
Should Be Equal ${success} ${200} active_defence_event_log\ test query export failed
ExportLog-024
${starttime} ${endtime} GetLast24HoursStartAndEndTime
${conditions} Set Variable { "field":"common_recv_time", "type":"timestamp", "symbol":"between", "value":["${starttime}","${endtime}"] }
${logname} Set Variable active_defence_event_log
${logCondition} GetLogCondition ${logname} ${starttime} ${endtime} 30 1
... ${conditions}
log ${logCondition}
${header} Create Dictionary Content-Type=application/json Authorization=${token}
${success} downloadexcel ${header} ${logCondition} ${apipath}/log/batch
log ${success}
Should Be Equal ${success} ${200} active_defence_event_log\ test query export failed
ExportLog-025
${starttime} ${endtime} GetLast24HoursStartAndEndTime
${conditions} Set Variable { "field":"common_recv_time", "type":"timestamp", "value":["${starttime}","${endtime}"] }
${logname} Set Variable active_defence_event_log
${logCondition} GetLogCondition ${logname} ${starttime} ${endtime} 30 1
... ${conditions}
log ${logCondition}
${header} Create Dictionary Content-Type=application/json Authorization=${token}
${success} downloadexcel ${header} ${logCondition} ${apipath}/log/batch
log ${success}
Should Be Equal ${success} ${200} active_defence_event_log\ test query export failed
*** Keywords ***