调整Log纯接口测试关键字及用例
This commit is contained in:
@@ -19,18 +19,15 @@ Library String
|
|||||||
LogApiVerifyCase
|
LogApiVerifyCase
|
||||||
[Documentation] 验证日志查询纯接口测试
|
[Documentation] 验证日志查询纯接口测试
|
||||||
${Logurl} Set Variable http://${host}:${port}/v1/log/list
|
${Logurl} Set Variable http://${host}:${port}/v1/log/list
|
||||||
|
${logTypelist} Set Variable security_event_log proxy_event_log connection_record_log radius_record_log voip_record_log live_session_record_log transaction_record_log gtpc_record_log
|
||||||
${logTypelist} create list security_event_log proxy_event_log connection_record_log radius_record_log voip_record_log transaction_record_log live_session_record_log gtpc_record_log
|
${EndTime} get current date
|
||||||
|
${EndTime1} Get Substring ${EndTime} \ -4
|
||||||
${EndTime} get current date
|
${StartTime} add time to date ${EndTime} -01:00:00
|
||||||
|
${StartTime1} Get Substring ${StartTime} \ -4
|
||||||
${EndTime1} Get Substring ${EndTime} \ -4
|
FOR ${logType} in @{logTypelist}
|
||||||
|
${Schemaurl} Set Variable http://${host}:${port}/v1/log/schema?logType=${logType}
|
||||||
${StartTime} add time to date ${EndTime} -01:00:00
|
${a} logapiverify ${Schemaurl} ${Logurl} ${token} ${StartTime1} ${EndTime1} ${logType}
|
||||||
|
END
|
||||||
${StartTime1} Get Substring ${StartTime} \ -4
|
|
||||||
|
|
||||||
logapiverify ${Logurl} ${token} ${StartTime1} ${EndTime1} ${host} ${port} ${logTypelist}
|
|
||||||
|
|
||||||
|
|
||||||
LogFieldVerifyCase
|
LogFieldVerifyCase
|
||||||
@@ -39,7 +36,7 @@ LogFieldVerifyCase
|
|||||||
${logTypelist} create list security_event_log proxy_event_log connection_record_log radius_record_log voip_record_log live_session_record_log transaction_record_log gtpc_record_log
|
${logTypelist} create list security_event_log proxy_event_log connection_record_log radius_record_log voip_record_log live_session_record_log transaction_record_log gtpc_record_log
|
||||||
${EndTime} get current date
|
${EndTime} get current date
|
||||||
${EndTime1} Get Substring ${EndTime} \ -4
|
${EndTime1} Get Substring ${EndTime} \ -4
|
||||||
${StartTime} add time to date ${EndTime} -01:00:00
|
${StartTime} add time to date ${EndTime} -03:00:00
|
||||||
${StartTime1} Get Substring ${StartTime} \ -4
|
${StartTime1} Get Substring ${StartTime} \ -4
|
||||||
${filter} Set Variable
|
${filter} Set Variable
|
||||||
FOR ${logType} in @{logTypelist}
|
FOR ${logType} in @{logTypelist}
|
||||||
@@ -69,7 +66,7 @@ LogRetrieveVerifyCase
|
|||||||
${logTypelist} create list security_event_log proxy_event_log connection_record_log radius_record_log voip_record_log live_session_record_log transaction_record_log gtpc_record_log
|
${logTypelist} create list security_event_log proxy_event_log connection_record_log radius_record_log voip_record_log live_session_record_log transaction_record_log gtpc_record_log
|
||||||
${EndTime} get current date
|
${EndTime} get current date
|
||||||
${EndTime1} Get Substring ${EndTime} \ -4
|
${EndTime1} Get Substring ${EndTime} \ -4
|
||||||
${StartTime} add time to date ${EndTime} -01:00:00
|
${StartTime} add time to date ${EndTime} -03:00:00
|
||||||
${StartTime1} Get Substring ${StartTime} \ -4
|
${StartTime1} Get Substring ${StartTime} \ -4
|
||||||
${filter} Set Variable
|
${filter} Set Variable
|
||||||
FOR ${logType} in @{logTypelist}
|
FOR ${logType} in @{logTypelist}
|
||||||
|
|||||||
@@ -7,12 +7,12 @@ import LogResponseVAL
|
|||||||
import time, datetime
|
import time, datetime
|
||||||
# import allure
|
# import allure
|
||||||
|
|
||||||
list = []
|
|
||||||
|
|
||||||
|
|
||||||
# 请求schema接口得到返回数据,用于其他接口
|
# 请求schema接口得到返回数据,用于其他接口
|
||||||
def schema(schemauerl, token):
|
def schema(schemauerl, token):
|
||||||
url = schemauerl # "http://192.168.44.72:8080/v1/log/schema?logType=security_event_log"
|
url = schemauerl
|
||||||
headers = {"Content-Type": "application/x-www-form-urlencoded", "Authorization": token}
|
headers = {"Content-Type": "application/x-www-form-urlencoded", "Authorization": token}
|
||||||
response = requests.get(url=url, headers=headers)
|
response = requests.get(url=url, headers=headers)
|
||||||
return response.json()
|
return response.json()
|
||||||
@@ -68,10 +68,13 @@ def randrom_url():
|
|||||||
|
|
||||||
|
|
||||||
def Filter1(schemauerl, token):
|
def Filter1(schemauerl, token):
|
||||||
|
list = []
|
||||||
json_str = schema(schemauerl, token)
|
json_str = schema(schemauerl, token)
|
||||||
|
print("schemauerl",json_str)
|
||||||
print(type(json_str))
|
print(type(json_str))
|
||||||
# 获取日志属性定义
|
# 获取日志属性定义
|
||||||
fields = json_str["data"]["fields"]
|
fields = json_str["data"]["fields"]
|
||||||
|
print("1111111111",fields)
|
||||||
# 获取不同属性支持的部不同操作
|
# 获取不同属性支持的部不同操作
|
||||||
operator = json_str["data"]["doc"]["schema_query"]["references"]["operator"]
|
operator = json_str["data"]["doc"]["schema_query"]["references"]["operator"]
|
||||||
for i in fields:
|
for i in fields:
|
||||||
@@ -189,40 +192,34 @@ def Filter1(schemauerl, token):
|
|||||||
list.append(str1)
|
list.append(str1)
|
||||||
|
|
||||||
|
|
||||||
print(list)
|
print("22222222222",list)
|
||||||
return list
|
return list
|
||||||
|
|
||||||
|
|
||||||
# 根据Filter1方法中的的数据,写入log请求接口中,来验证log请求接口
|
# 根据Filter1方法中的的数据,写入log请求接口中,来验证log请求接口
|
||||||
def logapiverify(logurl, token, starttime, endtime, host,port,logtypelist):
|
def logapiverify(schemauerl,logurl, token, starttime, endtime,logtype):
|
||||||
for logtype in logtypelist:
|
filter2 = Filter1(schemauerl, token)
|
||||||
schemauerl="http://"+host+":"+port+"/v1/log/schema?logType="+logtype
|
a = schema(schemauerl, token)
|
||||||
filter2 = Filter1(schemauerl, token)
|
fields = a["data"]["fields"]
|
||||||
a = schema(schemauerl, token)
|
print("333333333333",filter2)
|
||||||
fields = a["data"]["fields"]
|
for i in filter2:
|
||||||
print(fields)
|
print("条件:", i)
|
||||||
str2 = ""
|
url = logurl # "http://192.168.44.72:8080/v1/log/list"
|
||||||
for i in filter2:
|
headers = {"Content-Type": "application/json",
|
||||||
print("条件:",i)
|
"Authorization": token}
|
||||||
str2 = str2 + i + " " + "and" + " "
|
data = {
|
||||||
url = logurl # "http://192.168.44.72:8080/v1/log/list"
|
"start_common_recv_time": starttime,
|
||||||
headers = {"Content-Type": "application/json",
|
"end_common_recv_time": endtime,
|
||||||
"Authorization": token}
|
"logType": logtype,
|
||||||
data = {
|
"fields": fields,
|
||||||
"start_common_recv_time": starttime,
|
"filter": i
|
||||||
"end_common_recv_time": endtime,
|
}
|
||||||
"logType": logtype,
|
print(json.dumps(data))
|
||||||
"fields": fields,
|
response1 = requests.post(url=url, data=json.dumps(data), headers=headers)
|
||||||
"filter": i
|
code = response1.json()["code"]
|
||||||
}
|
assert code == 200
|
||||||
print(data)
|
print(response1.json()["code"])
|
||||||
print(json.dumps(data))
|
return response1.json()
|
||||||
response1 = requests.post(url=url, data=json.dumps(data), headers=headers)
|
|
||||||
code = response1.json()["code"]
|
|
||||||
print("code",code)
|
|
||||||
assert code == 200
|
|
||||||
print(response1.json()["code"])
|
|
||||||
# return response1.json()
|
|
||||||
# print("111111111111111111111111111111111111111111111111111111111111111111111111111111111111111")
|
# print("111111111111111111111111111111111111111111111111111111111111111111111111111111111111111")
|
||||||
# print(str2)
|
# print(str2)
|
||||||
# str3 = str2[0:-4]
|
# str3 = str2[0:-4]
|
||||||
|
|||||||
Reference in New Issue
Block a user