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-tsg-autotest/02-Keyword/tsg_bfapi/LogVariable.robot

93 lines
4.8 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

*** Settings ***
Resource ../../03-Variable/BifangApiVariable.txt
Resource LogSchema.robot
Library REST http://${host}:${port}
Library RequestsLibrary
Library OperatingSystem
Library Collections
Library string
Library ../../04-CustomLibrary/Custometest/log_contrast.py
*** Keywords ***
GetLogList_new
[Arguments] ${logType} ${startTime} ${client_ip} ${policy_id} ${parmkey} ${parmvalue}
FOR ${i} IN RANGE ${logfornumber}
Sleep ${policyLogVerificationSleepSeconds}s
${endtime} Get Time
${logs} GetLogList_new1 ${logType} ${startTime} ${endTime} ${client_ip} ${policy_id} ${parmkey} ${parmvalue}
${returnvalue} log_contrast ${logs} ${client_ip} ${policy_id} ${parmkey} ${parmvalue}
${trueorfalse} Run Keyword If "${returnvalue}"=="true" set variable true
... ELSE set variable false
Run Keyword If "${returnvalue}"=="true" Exit for loop
END
[Return] ${trueorfalse}
GetLogList_new1
[Arguments] ${logType} ${startTime} ${endTime} ${client_ip} ${policy_id} ${parmkey} ${parmvalue}
${logCondition} GetLogCondition ${logType} ${startTime} ${endTime} ${client_ip} ${policy_id}
log ${logCondition}
${LogListResponse} PostRemoteData /${version}/log/list ${logCondition}
Should Be Equal As Strings ${LogListResponse.status_code} 200
${returnData} To Json ${LogListResponse.content}
${responseCode} Get From Dictionary ${returnData} code
Log ${responseCode}
Should Be Equal ${responseCode} ${200} security_event_log \ \ test query list failed
log this time request security_event_log \ table logRecord \ : ${LogListResponse.content}
${a} Set Variable this time request security_event_log \ table logRecord \ : ${LogListResponse.content}
log ${a}
${log} Set Variable ${LogListResponse.json()}[data][list]
FOR ${logs} IN ${log}
log ${logs}
END
[Return] ${logs}
GetLogList
[Arguments] ${logType} ${startTime} ${endTime} ${client_ip} ${policy_id} ${parmkey} ${parmvalue}
${logCondition} GetLogCondition ${logType} ${startTime} ${endTime} ${client_ip} ${policy_id}
log ${logCondition}
${LogListResponse} PostRemoteData /${version}/log/list ${logCondition}
Should Be Equal As Strings ${LogListResponse.status_code} 200
${returnData} To Json ${LogListResponse.content}
${responseCode} Get From Dictionary ${returnData} code
Log ${responseCode}
Should Be Equal ${responseCode} ${200} security_event_log \ \ test query list failed
log this time request security_event_log \ table logRecord \ : ${LogListResponse.content}
${a} Set Variable this time request security_event_log \ table logRecord \ : ${LogListResponse.content}
log ${a}
${log} Set Variable ${LogListResponse.json()}[data][list]
FOR ${logs} IN ${log}
log ${logs}
END
log %%%%%%%%%%%%%%%%%%%%%%%%${logs}
Should Contain ${logs}"" ${client_ip}
Should Contain ${logs}"" ${policy_id}
Should Contain ${logs}"" ${parmkey}
Should Contain ${logs}"${parmkey}" ${parmvalue}
GetLogListSize
[Documentation]
... 描述ProxyPinning
...
[Arguments] ${logType} ${startTime} ${endTime} ${client_ip} ${policy_id} ${parmkey} ${parmvalue}
${logCondition} GetALLLogCondition ${logType} ${startTime} ${endTime} ${client_ip} ${policy_id} 10000 1
log ${logCondition}
${LogListResponse} PostRemoteData /${version}/log/list ${logCondition}
Should Be Equal As Strings ${LogListResponse.status_code} 200
${returnData} To Json ${LogListResponse.content}
${data} Get From Dictionary ${returnData} data
${len} Get Length ${data}[list]
[Return] ${len}
GetLogCount
[Arguments] ${logType} ${startTime} ${endTime} ${client_ip} ${policy_id} ${parmkey} ${parmvalue}
${logCondition} GetALLLogCondition ${logType} ${startTime} ${endTime} ${client_ip} ${policy_id} 10000 1
${LogListResponse} PostRemoteData /${version}/log/count ${logCondition}
Should Be Equal As Strings ${LogListResponse.status_code} 200
${returnData} To Json ${LogListResponse.content}
${len} Set Variable ${LogListResponse.json()}[data][total]
#${len} Get From Dictionary ${returnData} total
[Return] ${len}