From 554c8564ae23e5fe61ea6ff11b39b28e7ec71cca Mon Sep 17 00:00:00 2001 From: wangxin Date: Wed, 24 Jun 2020 18:07:07 +0800 Subject: [PATCH] =?UTF-8?q?feat:(=E6=97=A5=E5=BF=97=E6=9C=8D=E5=8A=A1)?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E6=97=A5=E5=BF=97=E6=80=BB=E6=95=B0=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../policy_object/PolicyObjectTests.robot | 28 +++++++++++-------- 02-Keyword/tsg_bfapi/policy_object/Log.robot | 24 ++++++++-------- 2 files changed, 29 insertions(+), 23 deletions(-) diff --git a/01-TestCase/tsg_bfapi/policy_object/PolicyObjectTests.robot b/01-TestCase/tsg_bfapi/policy_object/PolicyObjectTests.robot index 55d7f34..60b9b39 100644 --- a/01-TestCase/tsg_bfapi/policy_object/PolicyObjectTests.robot +++ b/01-TestCase/tsg_bfapi/policy_object/PolicyObjectTests.robot @@ -521,21 +521,25 @@ Policy-log-v1-00026 ${objectIds} Set Variable ${EMPTY} Comment 查询schema ${schema_query} ${schema_type} ${default_columns} ${fields} GetLogSchema security_event_log - Comment 处理schema,构造查询条件 - ${queryFieldList} Create List - FOR ${field} IN @{fields} - log ${field} - ${return} ${doc} Run Keyword And Ignore Error Get From Dictionary ${field} doc - Continue For Loop If "${return}"=="FAIL" - ${return} ${allow_query} Run Keyword And Ignore Error Get From Dictionary ${doc} allow_query - Continue For Loop If "${allow_query}"=="false" or "${return}"=="FAIL" - ${fieldDict} Create Dictionary name=${field['name']} type=${field['type']} - Append To List ${queryFieldList} ${fieldDict} - END + Comment 处理schema,构造查询条件 ${params} Create Dictionary pageSize=${10} logType=security_event_log ... start_common_recv_time=2020-06-01 00:00:00 ... end_common_recv_time=2020-06-24 00:00:00 ... fields=common_log_id|long,http_url|string,common_client_ip|string,common_client_port|int,common_server_ip|string,common_server_port|int ... conditions=common_server_port|int|in|${80}^${8080} ... orderBy=common_server_ip|true - ${resData} QueryLogList ${params} \ No newline at end of file + ... common_log_ids=162273027957354498 + ${resData} QueryLogs ${params} list +Policy-log-v1-00027 + ${objectIds} Set Variable ${EMPTY} + Comment 查询schema + ${schema_query} ${schema_type} ${default_columns} ${fields} GetLogSchema security_event_log + Comment 处理schema,构造查询条件 + ${params} Create Dictionary pageSize=${10} logType=security_event_log + ... start_common_recv_time=2020-06-01 00:00:00 + ... end_common_recv_time=2020-06-24 00:00:00 + ... fields=common_log_id|long,http_url|string,common_client_ip|string,common_client_port|int,common_server_ip|string,common_server_port|int + ... conditions=common_server_port|int|in|${80}^${8080} + ... orderBy=common_server_ip|true + ... common_log_ids=162273027957354498 + ${resData} QueryLogs ${params} count \ No newline at end of file diff --git a/02-Keyword/tsg_bfapi/policy_object/Log.robot b/02-Keyword/tsg_bfapi/policy_object/Log.robot index b4a79e9..0c206a4 100644 --- a/02-Keyword/tsg_bfapi/policy_object/Log.robot +++ b/02-Keyword/tsg_bfapi/policy_object/Log.robot @@ -22,7 +22,7 @@ GetLogSchema ${schema_type} Get From Dictionary ${resData['doc']} schema_type ${default_columns} Get From Dictionary ${resData['doc']} default_columns [Return] ${schema_query} ${schema_type} ${default_columns} ${resData['fields']} -QueryLogList +QueryLogs [Documentation] ... 日志列表查询 ... params字典列表 @@ -31,7 +31,7 @@ QueryLogList ... fields=name1|type,name2|type ... conditions=field1|type|symbol|value1^value2,field2|type|symbol|value3^value4 ... value1^value2是使用^分隔的字符串解析后为[value1,value2]格式的数组 - [Arguments] ${params} + [Arguments] ${params} ${path} Should Not Be Empty ${params} ${return} ${pageSize} Run Keyword And Ignore Error Get From Dictionary ${params} pageSize Run Keyword If "${return}"=="PASS" and "${pageSize}"=="${EMPTY}" Remove From Dictionary ${params} pageSize @@ -42,14 +42,16 @@ QueryLogList #处理排序 ${return} ${orderBy} Run Keyword And Ignore Error Get From Dictionary ${params} orderBy ${orderBy} Run Keyword If "${return}"=="FAIL" or "${orderBy}"=="${EMPTY}" Create List - ... ELSE ManageOrderBy ${orderBy} - Set To Dictionary ${params} orderBy=${orderBy} - - ${fields} Get From Dictionary ${params} fields - Should Not Be Empty ${fields} - ${fields} ManageFields ${fields} - Set To Dictionary ${params} fields=${fields} - + ... ELSE IF "${path}"=="list" ManageOrderBy ${orderBy} ELSE IF "${path}"=="count" + ... Set Variable ${orderBy} + Run Keyword If "${path}"=="list" Set To Dictionary ${params} orderBy=${orderBy} + Run Keyword If "${path}"=="count" Remove From Dictionary ${params} orderBy + ${return} ${fields} Run Keyword And Ignore Error Get From Dictionary ${params} fields + Run Keyword If "${path}"=="list" Should Not Be Empty ${fields} + ${fields} Run Keyword If "${path}"=="list" ManageFields ${fields} + ... ELSE Create List + Run Keyword If "${path}"=="list" Set To Dictionary ${params} fields=${fields} + Run Keyword If "${path}"=="count" Remove From Dictionary ${params} fields ${start_common_recv_time} Get From Dictionary ${params} start_common_recv_time Should Not Be Empty ${start_common_recv_time} ${end_common_recv_time} Get From Dictionary ${params} end_common_recv_time @@ -62,7 +64,7 @@ QueryLogList ... ELSE Create List Set To Dictionary ${params} conditions=${conditions} ${bodyJson} json.Dumps ${params} ensure_ascii=False - ${response} BasePostRequestForV2 ${logUrl}/list ${bodyJson} ${version} + ${response} BasePostRequestForV2 ${logUrl}/${path} ${bodyJson} ${version} ${rescode} Set Variable ${response['code']} Should Be Equal As Integers ${rescode} 200 ${resData} Set Variable ${response['data']}