diff --git a/02-Keyword/tsg_bfapi/LogStatistics.robot b/02-Keyword/tsg_bfapi/LogStatistics.robot index ac5aee4..9bc0106 100644 --- a/02-Keyword/tsg_bfapi/LogStatistics.robot +++ b/02-Keyword/tsg_bfapi/LogStatistics.robot @@ -232,3 +232,35 @@ SplicingTrafficSql ${where}= Get Substring ${strippedwhere} \ -1 ${sql2} catenate select DATE_FORMAT(FROM_UNIXTIME(FLOOR(UNIX_TIMESTAMP(__time)/${timeGranularity})*${timeGranularity}),'%Y-%m-%d %H:%i:%s') as statisticsTime, ${where} from traffic_metrics_log where __time >= '${startTime}' and __time < '${endTime}' group by DATE_FORMAT(FROM_UNIXTIME(FLOOR(UNIX_TIMESTAMP(__time)/${timeGranularity})*${timeGranularity}),'%Y-%m-%d %H:%i:%s') limit ${limit} [Return] ${sql2} +Recommend + [Arguments] ${url} ${statisticTime} + ${header} Create Dictionary Content-Type=application/x-www-form-urlencoded Authorization=${token} + Create Session api http://${host}:${port}/${version} headers=${header} + ${remoteResponse} Get Request api ${url}?statisticTime=${statisticTime} headers=${header} + ${response} to json ${remoteResponse.content} + Should Be Equal As Strings ${remoteResponse.status_code} 200 + +Trend + [Arguments] ${url} ${startTime} ${endTime} ${logType} ${policyId} + ${header} Create Dictionary Content-Type=application/x-www-form-urlencoded Authorization=${token} + Create Session api http://${host}:${port}/${version} headers=${header} + ${remoteResponse} Get Request api ${url}?policyId=${policyId}&logType=${logType}&startTime=${startTime}&endTime=${endTime} headers=${header} + ${response} to json ${remoteResponse.content} + Should Be Equal As Strings ${remoteResponse.status_code} 200 + Should Be Equal As Strings ${remoteResponse.json()}[msg] Success + +Timeandcount + [Arguments] ${url} ${logType} ${policyIds} + ${header} Create Dictionary Content-Type=application/x-www-form-urlencoded Authorization=${token} + Create Session api http://${host}:${port}/${version} headers=${header} + ${remoteResponse} Get Request api ${url}?policyIds=${policyIds}&logType=${logType} headers=${header} + ${response} to json ${remoteResponse.content} + Should Be Equal As Strings ${remoteResponse.status_code} 200 + Should Be Equal As Strings ${remoteResponse.json()}[msg] Success + ${data} set variable ${response}[data][list] + FOR ${kk} ${vv} IN ENUMERATE @{data} + log ${vv}[policyId] + ${true} Evaluate "${vv}[policyId]" in "${policyIds}" + Should Be Equal As Strings ${true} True + END +