diff --git a/01-TestCase/tsg_bfapi/report/ReportStressTesting.robot b/01-TestCase/tsg_bfapi/report/ReportStressTesting.robot new file mode 100644 index 0000000..293ddc6 --- /dev/null +++ b/01-TestCase/tsg_bfapi/report/ReportStressTesting.robot @@ -0,0 +1,229 @@ +*** Settings *** +Force Tags tsg_bf_api report +Library OperatingSystem +Library GetTimeLibrary +Resource ../../../03-Variable/BifangApiVariable.txt +Resource ../../../02-Keyword/tsg_bfapi/Common.robot +Resource ../../../02-Keyword/tsg_bfapi/offline_stat_report/ApiRequest1.robot +*** Variables *** +${dataset_url} /${version}/report/dataset +${datasetId} ${EMPTY} +${reportId} ${EMPTY} +${report_url} /${version}/report/offlinejob +${chartId} ${EMPTY} +${chart_url} /${version}/report/chart +${result_url} /${version}/report/offlinejob/result +${resultId} ${EMPTY} +*** Test Cases *** +Report_Top30 Users By Bandwidth and Sessions_15-001 + #引用默认Chart ID为1 + FOR ${i} IN RANGE 15 + ${name} Set Variable Report_Top30UsersByBandwidthandSessions_15-001-${i} + BasePostRequestOK ${report_url} {"reportJobList":{"rangeType":"last","rangeInterval":1,"rangeUnit":"day","jobName":"${name}","scheduleId":6,"chartList":[{"chartId":1,"timeGranulartiy":1,"timeUnit":"","disabled":true}],"isNotice":0,"noticeMethod":"","receivers":[""],"receiver":"","startTime":"","endTime":"","filterConnector":"and","filterCondition":[]}} + #查询Report的id + ${response1} BaseGetRequestOK ${report_url} pageSize=20&pageNo=1&jobIds=&jobName=${name}&opStartTime=&opEndTime=&opUser=&scheduleId= + ${reportId} Set Variable ${response1}[data][list][0][jobId] + #把得到的ID写入文件里 + lyf_list_write ${path}/report_files/reportid.txt ${reportId} + + + END + +Report_Top30 Website Domains By BandWidth and Sessions_15-002 + #引用默认Chart ID为2 + FOR ${i} IN RANGE 15 + ${name} Set Variable Report_Top30WebsiteDomainsByBandWidthandSessions_15-002-${i} + BasePostRequestOK ${report_url} {"reportJobList":{"rangeType":"last","rangeInterval":1,"rangeUnit":"day","jobName":"${name}","scheduleId":6,"chartList":[{"chartId":2,"timeGranulartiy":1,"timeUnit":"","disabled":true}],"isNotice":0,"noticeMethod":"","receivers":[""],"receiver":"","startTime":"","endTime":"","filterConnector":"and","filterCondition":[]}} + #查询Report的id + ${response1} BaseGetRequestOK ${report_url} pageSize=20&pageNo=1&jobIds=&jobName=${name}&opStartTime=&opEndTime=&opUser=&scheduleId= + ${reportId} Set Variable ${response1}[data][list][0][jobId] + #把得到的ID写入文件里 + lyf_list_write ${path}/report_files/reportid.txt ${reportId} + + END + +Report_Top30 Server IP By BandWidth and Sessions_15-003 + #引用默认Chart ID为3 + FOR ${i} IN RANGE 15 + ${name} Set Variable Report_Top30ServerIPByBandWidthandSessions_15-003-${i} + BasePostRequestOK ${report_url} {"reportJobList":{"rangeType":"last","rangeInterval":1,"rangeUnit":"day","jobName":"${name}","scheduleId":6,"chartList":[{"chartId":3,"timeGranulartiy":1,"timeUnit":"","disabled":true}],"isNotice":0,"noticeMethod":"","receivers":[""],"receiver":"","startTime":"","endTime":"","filterConnector":"and","filterCondition":[]}} + #查询Report的id + ${response1} BaseGetRequestOK ${report_url} pageSize=20&pageNo=1&jobIds=&jobName=${name}&opStartTime=&opEndTime=&opUser=&scheduleId= + ${reportId} Set Variable ${response1}[data][list][0][jobId] + #把得到的ID写入文件里 + lyf_list_write ${path}/report_files/reportid.txt ${reportId} + + + END + +Report_Top30 Client IP By BandWidth and Sessions-004 + #引用默认Chart ID为4 + FOR ${i} IN RANGE 15 + ${name} Set Variable Report_Top30ClientIPByBandWidthandSessions-004-${i} + BasePostRequestOK ${report_url} {"reportJobList":{"rangeType":"last","rangeInterval":1,"rangeUnit":"day","jobName":"${name}","scheduleId":6,"chartList":[{"chartId":4,"timeGranulartiy":1,"timeUnit":"","disabled":true}],"isNotice":0,"noticeMethod":"","receivers":[""],"receiver":"","startTime":"","endTime":"","filterConnector":"and","filterCondition":[]}} + #查询Report的id + ${response1} BaseGetRequestOK ${report_url} pageSize=20&pageNo=1&jobIds=&jobName=${name}&opStartTime=&opEndTime=&opUser=&scheduleId= + ${reportId} Set Variable ${response1}[data][list][0][jobId] + #把得到的ID写入文件里 + lyf_list_write ${path}/report_files/reportid.txt ${reportId} + + END + +Report_Top30 Server Ports By Sessions-005 + #引用默认Chart ID为5 + FOR ${i} IN RANGE 15 + ${name} Set Variable Report_Top30ServerPortsBySessions-004-${i} + BasePostRequestOK ${report_url} {"reportJobList":{"rangeType":"last","rangeInterval":1,"rangeUnit":"day","jobName":"${name}","scheduleId":6,"chartList":[{"chartId":5,"timeGranulartiy":1,"timeUnit":"","disabled":true}],"isNotice":0,"noticeMethod":"","receivers":[""],"receiver":"","startTime":"","endTime":"","filterConnector":"and","filterCondition":[]}} + #查询Report的id + ${response1} BaseGetRequestOK ${report_url} pageSize=20&pageNo=1&jobIds=&jobName=${name}&opStartTime=&opEndTime=&opUser=&scheduleId= + ${reportId} Set Variable ${response1}[data][list][0][jobId] + #把得到的ID写入文件里 + lyf_list_write ${path}/report_files/reportid.txt ${reportId} + + END + +Report_SecurityEventActionHit-006 + FOR ${i} IN RANGE 15 + ${name} Set Variable Report_SecurityEventActionHit-006-${i} + #新建DataSet + #${name} Set Variable Report_Result-001 + BasePostRequestOK ${dataset_url} {"list":{"name":"${name}","logType":"security_event_log","filterConnector":"and","havingConnector":"and","groupColumnList":[{"name":"common_action"}],"queryColumnList":[{"name":"common_action","expression":"","label":"Action"},{"name":"common_c2s_pkt_num,common_s2c_pkt_num","expression":"sum","label":"Packets Sent+Packets Received","expressionList":[{"label":"sum","value":"sum"},{"label":"min","value":"min"},{"label":"max","value":"max"},{"label":"avg","value":"avg"},{"label":"count","value":"count"}]},{"name":"common_c2s_byte_num,common_s2c_byte_num","expression":"sum","label":"Bytes Sent+Bytes Received","expressionList":[{"label":"sum","value":"sum"},{"label":"min","value":"min"},{"label":"max","value":"max"},{"label":"avg","value":"avg"},{"label":"count","value":"count"}]},{"name":"common_log_id","expression":"count","label":"sessions","expressionList":[]}],"filterConditionList":[],"havingConditionList":[]}} + #获取dataset的ID + ${response} BaseGetRequestOK ${dataset_url} pageSize=20&pageNo=1&id=&name=${name}&logType=&opStartTime=&opEndTime=&opUser= + ${datasetId} Set Variable ${response}[data][list][0][id] + #把得到的ID写入文件里 + lyf_list_write ${path}/report_files/datasetid.txt ${datasetId} + #根据DataSet的id,新建Chart,Lien图形表 + BasePostRequestOK ${chart_url} {"list":{"id":null,"name":"${name}","description":"","datasetId":${datasetId},"chartType":"table","dataTop":10,"orderBy":"","orderDesc":"","drilldownTop":null,"includeOther":false,"tableType":"Regular","columns":[{"title":"Action","width":20,"dataBindings":[{"dataType":"","dataBinding":"Action","format":"Default","legend":"","name":"common_action"}]},{"title":"Packets Sent+Packets Received","width":20,"dataBindings":[{"dataType":"","dataBinding":"Packets Sent+Packets Received","format":"Default","legend":"","name":"common_c2s_pkt_num,common_s2c_pkt_num"}]},{"title":"Bytes Sent+Bytes Received","width":20,"dataBindings":[{"dataType":"","dataBinding":"Bytes Sent+Bytes Received","format":"Default","legend":"","name":"common_c2s_byte_num,common_s2c_byte_num"}]},{"title":"sessions","width":20,"dataBindings":[{"dataType":"","dataBinding":"sessions","format":"Default","legend":"","name":"common_log_id"}]}]}} + #根据name查询出该Chart的id + ${response1} BaseGetRequestOK ${chart_url} pageSize=20&pageNo=1&id=&name=${name}&opUser= + ${chartId} Set Variable ${response1}[data][list][0][id] + #把得到的ID写入文件里 + lyf_list_write ${path}/report_files/chartid.txt ${chartId} + #新建Report,时间计划为Today,图表引用Line。 + BasePostRequestOK ${report_url} {"reportJobList":{"rangeType":"last","rangeInterval":1,"rangeUnit":"day","jobName":"${name}","scheduleId":6,"chartList":[{"chartId":${chartId},"timeGranulartiy":1,"timeUnit":"","disabled":true}],"isNotice":0,"noticeMethod":"","receivers":[""],"receiver":"","startTime":"","endTime":"","filterConnector":"and","filterCondition":[]}} + #查询Report的id + ${response1} BaseGetRequestOK ${report_url} pageSize=20&pageNo=1&jobIds=&jobName=${name}&opStartTime=&opEndTime=&opUser=&scheduleId= + ${reportId} Set Variable ${response1}[data][list][0][jobId] + #把得到的ID写入文件里 + lyf_list_write ${path}/report_files/reportid.txt ${reportId} + + + END + +Report_ClientIPTopN-007 + FOR ${i} IN RANGE 15 + ${name} Set Variable Report_ClientIPTopN-007-${i} + #新建DataSet + #${name} Set Variable Report_Result-001 + BasePostRequestOK ${dataset_url} {"list":{"name":"${name}","logType":"connection_record_log","filterConnector":"and","havingConnector":"and","groupColumnList":[{"name":"common_client_ip"}],"queryColumnList":[{"name":"common_client_ip","expression":"","label":"Client IP"},{"name":"common_log_id","expression":"count","label":"sessions","expressionList":[{"label":"sum","value":"sum"},{"label":"min","value":"min"},{"label":"max","value":"max"},{"label":"avg","value":"avg"},{"label":"count","value":"count"}]},{"name":"common_c2s_byte_num","expression":"sum","label":"Bytes Sent","expressionList":[{"label":"sum","value":"sum"},{"label":"min","value":"min"},{"label":"max","value":"max"},{"label":"avg","value":"avg"},{"label":"count","value":"count"}]},{"name":"common_s2c_byte_num","expression":"sum","label":"Bytes Received","expressionList":[{"label":"sum","value":"sum"},{"label":"min","value":"min"},{"label":"max","value":"max"},{"label":"avg","value":"avg"},{"label":"count","value":"count"}]},{"name":"common_c2s_byte_num,common_s2c_byte_num","expression":"sum","label":"Bytes Sent+Bytes Received","expressionList":[{"label":"sum","value":"sum"},{"label":"min","value":"min"},{"label":"max","value":"max"},{"label":"avg","value":"avg"},{"label":"count","value":"count"}]},{"name":"common_c2s_pkt_num","expression":"sum","label":"Packets Sent","expressionList":[{"label":"sum","value":"sum"},{"label":"min","value":"min"},{"label":"max","value":"max"},{"label":"avg","value":"avg"},{"label":"count","value":"count"}]},{"name":"common_s2c_pkt_num","expression":"sum","label":"Packets Received","expressionList":[{"label":"sum","value":"sum"},{"label":"min","value":"min"},{"label":"max","value":"max"},{"label":"avg","value":"avg"},{"label":"count","value":"count"}]},{"name":"common_c2s_pkt_num,common_s2c_pkt_num","expression":"sum","label":"Packets Sent+Packets Received","expressionList":[{"label":"sum","value":"sum"},{"label":"min","value":"min"},{"label":"max","value":"max"},{"label":"avg","value":"avg"},{"label":"count","value":"count"}]}],"filterConditionList":[],"havingConditionList":[]}} + #获取dataset的ID + ${response} BaseGetRequestOK ${dataset_url} pageSize=20&pageNo=1&id=&name=${name}&logType=&opStartTime=&opEndTime=&opUser= + ${datasetId} Set Variable ${response}[data][list][0][id] + #把得到的ID写入文件里 + lyf_list_write ${path}/report_files/datasetid.txt ${datasetId} + #根据DataSet的id,新建Chart,Lien图形表 + BasePostRequestOK ${chart_url} {"list":{"id":null,"name":"${name}","description":"","datasetId":${datasetId},"chartType":"table","dataTop":10,"orderBy":"sessions","orderDesc":0,"drilldownTop":null,"includeOther":false,"tableType":"Regular","columns":[{"title":"Client IP","width":10,"dataBindings":[{"dataType":"","dataBinding":"Client IP","format":"Default","legend":"","name":"common_client_ip"}]},{"title":"sessions","width":10,"dataBindings":[{"dataType":"","dataBinding":"sessions","format":"Default","legend":"","name":"common_log_id"}]},{"title":"Bytes Sent","width":10,"dataBindings":[{"dataType":"","dataBinding":"Bytes Sent","format":"Default","legend":"","name":"common_c2s_byte_num"}]},{"title":"Bytes Received","width":10,"dataBindings":[{"dataType":"","dataBinding":"Bytes Received","format":"Default","legend":"","name":"common_s2c_byte_num"}]},{"title":"Bytes Sent+Bytes Received","width":10,"dataBindings":[{"dataType":"","dataBinding":"Bytes Sent+Bytes Received","format":"Default","legend":"","name":"common_c2s_byte_num,common_s2c_byte_num"}]},{"title":"Packets Sent","width":10,"dataBindings":[{"dataType":"","dataBinding":"Packets Sent","format":"Default","legend":"","name":"common_c2s_pkt_num"}]},{"title":"Packets Received","width":10,"dataBindings":[{"dataType":"","dataBinding":"Packets Received","format":"Default","legend":"","name":"common_s2c_pkt_num"}]},{"title":"Packets Sent+Packets Received","width":10,"dataBindings":[{"dataType":"","dataBinding":"Packets Sent+Packets Received","format":"Default","legend":"","name":"common_c2s_pkt_num,common_s2c_pkt_num"}]}]}} + #根据name查询出该Chart的id + ${response1} BaseGetRequestOK ${chart_url} pageSize=20&pageNo=1&id=&name=${name}&opUser= + ${chartId} Set Variable ${response1}[data][list][0][id] + #把得到的ID写入文件里 + lyf_list_write ${path}/report_files/chartid.txt ${chartId} + #新建Report,时间计划为Today,图表引用Line。 + BasePostRequestOK ${report_url} {"reportJobList":{"rangeType":"last","rangeInterval":1,"rangeUnit":"day","jobName":"${name}","scheduleId":6,"chartList":[{"chartId":${chartId},"timeGranulartiy":1,"timeUnit":"","disabled":true}],"isNotice":0,"noticeMethod":"","receivers":[""],"receiver":"","startTime":"","endTime":"","filterConnector":"and","filterCondition":[]}} + #查询Report的id + ${response1} BaseGetRequestOK ${report_url} pageSize=20&pageNo=1&jobIds=&jobName=${name}&opStartTime=&opEndTime=&opUser=&scheduleId= + ${reportId} Set Variable ${response1}[data][list][0][jobId] + #把得到的ID写入文件里 + lyf_list_write ${path}/report_files/reportid.txt ${reportId} + + + END + +Report_ServiceIPTopN-008 + FOR ${i} IN RANGE 15 + ${name} Set Variable Report_ServiceIPTopN-008-${i} + #新建DataSet + #${name} Set Variable Report_Result-001 + BasePostRequestOK ${dataset_url} {"list":{"name":"${name}","logType":"connection_record_log","filterConnector":"and","havingConnector":"and","groupColumnList":[{"name":"common_server_ip"}],"queryColumnList":[{"name":"common_server_ip","expression":"","label":"Server IP"},{"name":"common_log_id","expression":"count","label":"sessions","expressionList":[{"label":"sum","value":"sum"},{"label":"min","value":"min"},{"label":"max","value":"max"},{"label":"avg","value":"avg"},{"label":"count","value":"count"}]},{"name":"common_c2s_byte_num","expression":"sum","label":"Bytes Sent","expressionList":[{"label":"sum","value":"sum"},{"label":"min","value":"min"},{"label":"max","value":"max"},{"label":"avg","value":"avg"},{"label":"count","value":"count"}]},{"name":"common_s2c_byte_num","expression":"sum","label":"Bytes Received","expressionList":[{"label":"sum","value":"sum"},{"label":"min","value":"min"},{"label":"max","value":"max"},{"label":"avg","value":"avg"},{"label":"count","value":"count"}]},{"name":"common_c2s_byte_num,common_s2c_byte_num","expression":"sum","label":"Bytes Sent+Bytes Received","expressionList":[{"label":"sum","value":"sum"},{"label":"min","value":"min"},{"label":"max","value":"max"},{"label":"avg","value":"avg"},{"label":"count","value":"count"}]},{"name":"common_c2s_pkt_num","expression":"sum","label":"Packets Sent","expressionList":[{"label":"sum","value":"sum"},{"label":"min","value":"min"},{"label":"max","value":"max"},{"label":"avg","value":"avg"},{"label":"count","value":"count"}]},{"name":"common_s2c_pkt_num","expression":"sum","label":"Packets Received","expressionList":[{"label":"sum","value":"sum"},{"label":"min","value":"min"},{"label":"max","value":"max"},{"label":"avg","value":"avg"},{"label":"count","value":"count"}]},{"name":"common_c2s_pkt_num,common_s2c_pkt_num","expression":"sum","label":"Packets Sent+Packets Received","expressionList":[{"label":"sum","value":"sum"},{"label":"min","value":"min"},{"label":"max","value":"max"},{"label":"avg","value":"avg"},{"label":"count","value":"count"}]}],"filterConditionList":[],"havingConditionList":[]}} + #获取dataset的ID + ${response} BaseGetRequestOK ${dataset_url} pageSize=20&pageNo=1&id=&name=${name}&logType=&opStartTime=&opEndTime=&opUser= + ${datasetId} Set Variable ${response}[data][list][0][id] + #把得到的ID写入文件里 + lyf_list_write ${path}/report_files/datasetid.txt ${datasetId} + #根据DataSet的id,新建Chart,Lien图形表 + BasePostRequestOK ${chart_url} {"list":{"id":null,"name":"${name}","description":"","datasetId":${datasetId},"chartType":"table","dataTop":10,"orderBy":"sessions","orderDesc":0,"drilldownTop":null,"includeOther":false,"tableType":"Regular","columns":[{"title":"Server IP","width":10,"dataBindings":[{"dataType":"","dataBinding":"Server IP","format":"Default","legend":"","name":"common_server_ip"}]},{"title":"sessions","width":10,"dataBindings":[{"dataType":"","dataBinding":"sessions","format":"Default","legend":"","name":"common_log_id"}]},{"title":"Bytes Sent","width":10,"dataBindings":[{"dataType":"","dataBinding":"Bytes Sent","format":"Default","legend":"","name":"common_c2s_byte_num"}]},{"title":"Bytes Received","width":10,"dataBindings":[{"dataType":"","dataBinding":"Bytes Received","format":"Default","legend":"","name":"common_s2c_byte_num"}]},{"title":"Bytes Sent+Bytes Received","width":10,"dataBindings":[{"dataType":"","dataBinding":"Bytes Sent+Bytes Received","format":"Default","legend":"","name":"common_c2s_byte_num,common_s2c_byte_num"}]},{"title":"Packets Sent","width":10,"dataBindings":[{"dataType":"","dataBinding":"Packets Sent","format":"Default","legend":"","name":"common_c2s_pkt_num"}]},{"title":"Packets Received","width":10,"dataBindings":[{"dataType":"","dataBinding":"Packets Received","format":"Default","legend":"","name":"common_s2c_pkt_num"}]},{"title":"Packets Sent+Packets Received","width":10,"dataBindings":[{"dataType":"","dataBinding":"Packets Sent+Packets Received","format":"Default","legend":"","name":"common_c2s_pkt_num,common_s2c_pkt_num"}]}]}} + #根据name查询出该Chart的id + ${response1} BaseGetRequestOK ${chart_url} pageSize=20&pageNo=1&id=&name=${name}&opUser= + ${chartId} Set Variable ${response1}[data][list][0][id] + #把得到的ID写入文件里 + lyf_list_write ${path}/report_files/chartid.txt ${chartId} + #新建Report,时间计划为Today,图表引用Line。 + BasePostRequestOK ${report_url} {"reportJobList":{"rangeType":"last","rangeInterval":1,"rangeUnit":"day","jobName":"${name}","scheduleId":6,"chartList":[{"chartId":${chartId},"timeGranulartiy":1,"timeUnit":"","disabled":true}],"isNotice":0,"noticeMethod":"","receivers":[""],"receiver":"","startTime":"","endTime":"","filterConnector":"and","filterCondition":[]}} + #查询Report的id + ${response1} BaseGetRequestOK ${report_url} pageSize=20&pageNo=1&jobIds=&jobName=${name}&opStartTime=&opEndTime=&opUser=&scheduleId= + ${reportId} Set Variable ${response1}[data][list][0][jobId] + #把得到的ID写入文件里 + lyf_list_write ${path}/report_files/reportid.txt ${reportId} + + + END + +Report_SubscriberIDTopN-009 + FOR ${i} IN RANGE 15 + ${name} Set Variable Report_SubscriberIDTopN-009-${i} + #新建DataSet + #${name} Set Variable Report_Result-001 + BasePostRequestOK ${dataset_url} {"list":{"name":"${name}","logType":"connection_record_log","filterConnector":"and","havingConnector":"and","groupColumnList":[{"name":"common_subscriber_id"}],"queryColumnList":[{"name":"common_subscriber_id","expression":"","label":"Subscriber ID"},{"name":"common_log_id","expression":"count","label":"sessions","expressionList":[{"label":"sum","value":"sum"},{"label":"min","value":"min"},{"label":"max","value":"max"},{"label":"avg","value":"avg"},{"label":"count","value":"count"}]},{"name":"common_c2s_byte_num","expression":"sum","label":"Bytes Sent","expressionList":[{"label":"sum","value":"sum"},{"label":"min","value":"min"},{"label":"max","value":"max"},{"label":"avg","value":"avg"},{"label":"count","value":"count"}]},{"name":"common_s2c_byte_num","expression":"sum","label":"Bytes Received","expressionList":[{"label":"sum","value":"sum"},{"label":"min","value":"min"},{"label":"max","value":"max"},{"label":"avg","value":"avg"},{"label":"count","value":"count"}]},{"name":"common_c2s_byte_num,common_s2c_byte_num","expression":"sum","label":"Bytes Sent+Bytes Received","expressionList":[{"label":"sum","value":"sum"},{"label":"min","value":"min"},{"label":"max","value":"max"},{"label":"avg","value":"avg"},{"label":"count","value":"count"}]},{"name":"common_c2s_pkt_num","expression":"sum","label":"Packets Sent","expressionList":[{"label":"sum","value":"sum"},{"label":"min","value":"min"},{"label":"max","value":"max"},{"label":"avg","value":"avg"},{"label":"count","value":"count"}]},{"name":"common_s2c_pkt_num","expression":"sum","label":"Packets Received","expressionList":[{"label":"sum","value":"sum"},{"label":"min","value":"min"},{"label":"max","value":"max"},{"label":"avg","value":"avg"},{"label":"count","value":"count"}]},{"name":"common_c2s_pkt_num,common_s2c_pkt_num","expression":"sum","label":"Packets Sent+Packets Received","expressionList":[{"label":"sum","value":"sum"},{"label":"min","value":"min"},{"label":"max","value":"max"},{"label":"avg","value":"avg"},{"label":"count","value":"count"}]}],"filterConditionList":[],"havingConditionList":[]}} + #获取dataset的ID + ${response} BaseGetRequestOK ${dataset_url} pageSize=20&pageNo=1&id=&name=${name}&logType=&opStartTime=&opEndTime=&opUser= + ${datasetId} Set Variable ${response}[data][list][0][id] + #把得到的ID写入文件里 + lyf_list_write ${path}/report_files/datasetid.txt ${datasetId} + #根据DataSet的id,新建Chart,Lien图形表 + BasePostRequestOK ${chart_url} {"list":{"id":null,"name":"${name}","description":"","datasetId":${datasetId},"chartType":"table","dataTop":10,"orderBy":"sessions","orderDesc":0,"drilldownTop":null,"includeOther":false,"tableType":"Regular","columns":[{"title":"Subscriber ID","width":10,"dataBindings":[{"dataType":"","dataBinding":"Subscriber ID","format":"Default","legend":"","name":"common_subscriber_id"}]},{"title":"sessions","width":10,"dataBindings":[{"dataType":"","dataBinding":"sessions","format":"Default","legend":"","name":"common_log_id"}]},{"title":"Bytes Sent","width":10,"dataBindings":[{"dataType":"","dataBinding":"Bytes Sent","format":"Default","legend":"","name":"common_c2s_byte_num"}]},{"title":"Bytes Received","width":10,"dataBindings":[{"dataType":"","dataBinding":"Bytes Received","format":"Default","legend":"","name":"common_s2c_byte_num"}]},{"title":"Bytes Sent+Bytes Received","width":10,"dataBindings":[{"dataType":"","dataBinding":"Bytes Sent+Bytes Received","format":"Default","legend":"","name":"common_c2s_byte_num,common_s2c_byte_num"}]},{"title":"Packets Sent","width":10,"dataBindings":[{"dataType":"","dataBinding":"Packets Sent","format":"Default","legend":"","name":"common_c2s_pkt_num"}]},{"title":"Packets Received","width":10,"dataBindings":[{"dataType":"","dataBinding":"Packets Received","format":"Default","legend":"","name":"common_s2c_pkt_num"}]},{"title":"Packets Sent+Packets Received","width":10,"dataBindings":[{"dataType":"","dataBinding":"Packets Sent+Packets Received","format":"Default","legend":"","name":"common_c2s_pkt_num,common_s2c_pkt_num"}]}]}} + #根据name查询出该Chart的id + ${response1} BaseGetRequestOK ${chart_url} pageSize=20&pageNo=1&id=&name=${name}&opUser= + ${chartId} Set Variable ${response1}[data][list][0][id] + #把得到的ID写入文件里 + lyf_list_write ${path}/report_files/chartid.txt ${chartId} + #新建Report,时间计划为Today,图表引用Line。 + BasePostRequestOK ${report_url} {"reportJobList":{"rangeType":"last","rangeInterval":1,"rangeUnit":"day","jobName":"${name}","scheduleId":6,"chartList":[{"chartId":${chartId},"timeGranulartiy":1,"timeUnit":"","disabled":true}],"isNotice":0,"noticeMethod":"","receivers":[""],"receiver":"","startTime":"","endTime":"","filterConnector":"and","filterCondition":[]}} + #查询Report的id + ${response1} BaseGetRequestOK ${report_url} pageSize=20&pageNo=1&jobIds=&jobName=${name}&opStartTime=&opEndTime=&opUser=&scheduleId= + ${reportId} Set Variable ${response1}[data][list][0][jobId] + #把得到的ID写入文件里 + lyf_list_write ${path}/report_files/reportid.txt ${reportId} + + + END + +Report_DomainsTopN-010 + FOR ${i} IN RANGE 15 + ${name} Set Variable Report_Report_DomainsTopN-010-${i} + #新建DataSet + #${name} Set Variable Report_Result-001 + BasePostRequestOK ${dataset_url} {"list":{"name":"${name}","logType":"connection_record_log","filterConnector":"and","havingConnector":"and","groupColumnList":[{"name":"http_domain"}],"queryColumnList":[{"name":"http_domain","expression":"","label":"Http.Domain"},{"name":"common_log_id","expression":"count","label":"sessions","expressionList":[{"label":"sum","value":"sum"},{"label":"min","value":"min"},{"label":"max","value":"max"},{"label":"avg","value":"avg"},{"label":"count","value":"count"}]},{"name":"common_c2s_byte_num","expression":"sum","label":"Bytes Sent","expressionList":[{"label":"sum","value":"sum"},{"label":"min","value":"min"},{"label":"max","value":"max"},{"label":"avg","value":"avg"},{"label":"count","value":"count"}]},{"name":"common_s2c_byte_num","expression":"sum","label":"Bytes Received","expressionList":[{"label":"sum","value":"sum"},{"label":"min","value":"min"},{"label":"max","value":"max"},{"label":"avg","value":"avg"},{"label":"count","value":"count"}]},{"name":"common_c2s_byte_num,common_s2c_byte_num","expression":"sum","label":"Bytes Sent+Bytes Received","expressionList":[{"label":"sum","value":"sum"},{"label":"min","value":"min"},{"label":"max","value":"max"},{"label":"avg","value":"avg"},{"label":"count","value":"count"}]},{"name":"common_c2s_pkt_num","expression":"sum","label":"Packets Sent","expressionList":[{"label":"sum","value":"sum"},{"label":"min","value":"min"},{"label":"max","value":"max"},{"label":"avg","value":"avg"},{"label":"count","value":"count"}]},{"name":"common_s2c_pkt_num","expression":"sum","label":"Packets Received","expressionList":[{"label":"sum","value":"sum"},{"label":"min","value":"min"},{"label":"max","value":"max"},{"label":"avg","value":"avg"},{"label":"count","value":"count"}]},{"name":"common_c2s_pkt_num,common_s2c_pkt_num","expression":"sum","label":"Packets Sent+Packets Received","expressionList":[{"label":"sum","value":"sum"},{"label":"min","value":"min"},{"label":"max","value":"max"},{"label":"avg","value":"avg"},{"label":"count","value":"count"}]}],"filterConditionList":[],"havingConditionList":[]}} + #获取dataset的ID + ${response} BaseGetRequestOK ${dataset_url} pageSize=20&pageNo=1&id=&name=${name}&logType=&opStartTime=&opEndTime=&opUser= + ${datasetId} Set Variable ${response}[data][list][0][id] + #把得到的ID写入文件里 + lyf_list_write ${path}/report_files/datasetid.txt ${datasetId} + #根据DataSet的id,新建Chart,Lien图形表 + BasePostRequestOK ${chart_url} {"list":{"id":null,"name":"${name}","description":"","datasetId":${datasetId},"chartType":"table","dataTop":10,"orderBy":"sessions","orderDesc":0,"drilldownTop":null,"includeOther":false,"tableType":"Regular","columns":[{"title":"Http.Domain","width":10,"dataBindings":[{"dataType":"","dataBinding":"Http.Domain","format":"Default","legend":"","name":"http_domain"}]},{"title":"sessions","width":10,"dataBindings":[{"dataType":"","dataBinding":"sessions","format":"Default","legend":"","name":"common_log_id"}]},{"title":"Bytes Sent","width":10,"dataBindings":[{"dataType":"","dataBinding":"Bytes Sent","format":"Default","legend":"","name":"common_c2s_byte_num"}]},{"title":"Bytes Received","width":10,"dataBindings":[{"dataType":"","dataBinding":"Bytes Received","format":"Default","legend":"","name":"common_s2c_byte_num"}]},{"title":"Bytes Sent+Bytes Received","width":10,"dataBindings":[{"dataType":"","dataBinding":"Bytes Sent+Bytes Received","format":"Default","legend":"","name":"common_c2s_byte_num,common_s2c_byte_num"}]},{"title":"Packets Sent","width":10,"dataBindings":[{"dataType":"","dataBinding":"Packets Sent","format":"Default","legend":"","name":"common_c2s_pkt_num"}]},{"title":"Packets Received","width":10,"dataBindings":[{"dataType":"","dataBinding":"Packets Received","format":"Default","legend":"","name":"common_s2c_pkt_num"}]},{"title":"Packets Sent+Packets Received","width":10,"dataBindings":[{"dataType":"","dataBinding":"Packets Sent+Packets Received","format":"Default","legend":"","name":"common_c2s_pkt_num,common_s2c_pkt_num"}]}]}} + #根据name查询出该Chart的id + ${response1} BaseGetRequestOK ${chart_url} pageSize=20&pageNo=1&id=&name=${name}&opUser= + ${chartId} Set Variable ${response1}[data][list][0][id] + #把得到的ID写入文件里 + lyf_list_write ${path}/report_files/chartid.txt ${chartId} + #新建Report,时间计划为Today,图表引用Line。 + BasePostRequestOK ${report_url} {"reportJobList":{"rangeType":"last","rangeInterval":1,"rangeUnit":"day","jobName":"${name}","scheduleId":6,"chartList":[{"chartId":${chartId},"timeGranulartiy":1,"timeUnit":"","disabled":true}],"isNotice":0,"noticeMethod":"","receivers":[""],"receiver":"","startTime":"","endTime":"","filterConnector":"and","filterCondition":[]}} + #查询Report的id + ${response1} BaseGetRequestOK ${report_url} pageSize=20&pageNo=1&jobIds=&jobName=${name}&opStartTime=&opEndTime=&opUser=&scheduleId= + ${reportId} Set Variable ${response1}[data][list][0][jobId] + #把得到的ID写入文件里 + lyf_list_write ${path}/report_files/reportid.txt ${reportId} + + + END + diff --git a/01-TestCase/tsg_bfapi/report/ReportStressTestingDelete.robot b/01-TestCase/tsg_bfapi/report/ReportStressTestingDelete.robot new file mode 100644 index 0000000..3d6c083 --- /dev/null +++ b/01-TestCase/tsg_bfapi/report/ReportStressTestingDelete.robot @@ -0,0 +1,31 @@ +*** Settings *** +Force Tags tsg_bf_api report +Library OperatingSystem +Library GetTimeLibrary +Resource ../../../03-Variable/BifangApiVariable.txt +Resource ../../../02-Keyword/tsg_bfapi/Common.robot +Resource ../../../02-Keyword/tsg_bfapi/offline_stat_report/ApiRequest1.robot +*** Variables *** +${dataset_url} /${version}/report/dataset +${datasetId} ${EMPTY} +${reportId} ${EMPTY} +${report_url} /${version}/report/offlinejob +${chartId} ${EMPTY} +${chart_url} /${version}/report/chart +*** Test Cases *** +Report_Delete-001 + ${reportId} lyf_list_read ${path}/report_files/reportid.txt + ${chartId} lyf_list_read ${path}/report_files/chartid.txt + ${datasetId} lyf_list_read ${path}/report_files/datasetid.txt + ${data1} Create Dictionary ids=${datasetId} + ${data2} Create Dictionary ids=${chartId} + ${data3} Create Dictionary jobIds=${reportId} + Run Keyword If "${reportId}"=="[]" log no report to delete + ... ELSE BaseDeleteRequestOK ${report_url} ${data3} + Run Keyword If "${chartId}"=="[]" log no chart to delete + ... ELSE BaseDeleteRequestOK ${chart_url} ${data2} + Run Keyword If "${datasetId}"=="[]" log no dataset to delete + ... ELSE BaseDeleteRequestOK ${dataset_url} ${data1} + + +