feat: 信令分析

This commit is contained in:
TsMask
2023-09-23 19:14:39 +08:00
parent 15bd6f5856
commit 0bc2be52ef
3 changed files with 923 additions and 405 deletions

74
src/api/trace/analysis.ts Normal file
View File

@@ -0,0 +1,74 @@
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
import { request } from '@/plugins/http-fetch';
import { parseObjLineToHump } from '@/utils/parse-utils';
/**
* 查询信令列表
* @param query 查询参数
* @returns object
*/
export async function listTraceData(query: Record<string, any>) {
let totalSQL = 'select count(*) as total from trace_data where 1=1 ';
let rowsSQL = 'select * from trace_data where 1=1 ';
// 查询
let querySQL = '';
if (query.imsi) {
querySQL += ` and imsi = '${query.imsi}' `;
}
// 分页
const pageNum = query.pageNum - 1;
const limtSql = ` limit ${pageNum},${query.pageSize} `;
// 发起请求
const result = await request({
url: `/databaseManagement/v1/omc_db/trace_data`,
method: 'get',
params: {
totalSQL: totalSQL + querySQL,
rowsSQL: rowsSQL + querySQL + limtSql,
},
});
// 解析数据
if (result.code === RESULT_CODE_SUCCESS) {
const data: DataList = {
total: 0,
rows: [],
code: result.code,
msg: result.msg,
};
result.data.data.forEach((item: any) => {
const itemData = item['trace_data'];
if (Array.isArray(itemData)) {
if (itemData.length === 1 && itemData[0]['total']) {
data.total = itemData[0]['total'];
} else {
data.rows = itemData.map(v => parseObjLineToHump(v));
}
}
});
return data;
}
return result;
}
// 网元抓包pcap文件下载
export function tcpdumpPcapDownload(data: Record<string, string>) {
return request({
url: '/traceManagement/v1/tcpdumpPcapDownload',
method: 'post',
data: data,
responseType: 'blob',
});
}
// 网元抓包生成pcap
export function tcpdumpNeUPFTask(data: Record<string, string>) {
return request({
url: '/traceManagement/v1/tcpdumpNeUPFTask',
method: 'post',
data: data,
});
}