fix: 跟踪信令抓包upf修复
This commit is contained in:
@@ -6,7 +6,7 @@ export function tcpdumpNeTask(
|
|||||||
data: Record<string, string>
|
data: Record<string, string>
|
||||||
) {
|
) {
|
||||||
return request({
|
return request({
|
||||||
url: '/api/rest/traceManagement/v1/tcpdumpNeTask',
|
url: '/tcpdump/ne',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data,
|
data: data,
|
||||||
signal: signal,
|
signal: signal,
|
||||||
@@ -16,7 +16,7 @@ export function tcpdumpNeTask(
|
|||||||
// 网元抓包pcap文件下载
|
// 网元抓包pcap文件下载
|
||||||
export function tcpdumpPcapDownload(data: Record<string, string>) {
|
export function tcpdumpPcapDownload(data: Record<string, string>) {
|
||||||
return request({
|
return request({
|
||||||
url: '/api/rest/traceManagement/v1/tcpdumpPcapDownload',
|
url: '/tcpdump/download',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data,
|
data: data,
|
||||||
responseType: 'blob',
|
responseType: 'blob',
|
||||||
@@ -26,7 +26,7 @@ export function tcpdumpPcapDownload(data: Record<string, string>) {
|
|||||||
// 网元抓包生成pcap
|
// 网元抓包生成pcap
|
||||||
export function tcpdumpNeUPFTask(data: Record<string, string>) {
|
export function tcpdumpNeUPFTask(data: Record<string, string>) {
|
||||||
return request({
|
return request({
|
||||||
url: '/api/rest/traceManagement/v1/tcpdumpNeUPFTask',
|
url: '/tcpdump/neUPF',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data,
|
data: data,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -281,7 +281,7 @@ export default {
|
|||||||
runText: 'Execute',
|
runText: 'Execute',
|
||||||
runTimeText: 'Execute {s} seconds',
|
runTimeText: 'Execute {s} seconds',
|
||||||
stopText: 'Interrupt',
|
stopText: 'Interrupt',
|
||||||
capArgUPFPlease: 'Please enter the packet capture command supported by UPF',
|
capArgUPFPlease: 'Please select the packet capture command supported by UPF',
|
||||||
capStart: 'Start capturing packets',
|
capStart: 'Start capturing packets',
|
||||||
capStop: 'Stop capturing packets',
|
capStop: 'Stop capturing packets',
|
||||||
execTimeout: 'Execution timeout',
|
execTimeout: 'Execution timeout',
|
||||||
|
|||||||
@@ -281,7 +281,7 @@ export default {
|
|||||||
runText: '执行',
|
runText: '执行',
|
||||||
runTimeText: '执行 {s} 秒',
|
runTimeText: '执行 {s} 秒',
|
||||||
stopText: '中断',
|
stopText: '中断',
|
||||||
capArgUPFPlease: '请输入UPF支持的抓包命令',
|
capArgUPFPlease: '请选择UPF支持的抓包命令',
|
||||||
capStart: '开始抓包',
|
capStart: '开始抓包',
|
||||||
capStop: '停止抓包',
|
capStop: '停止抓包',
|
||||||
execTimeout: '执行超时',
|
execTimeout: '执行超时',
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { onMounted, reactive, toRaw } from 'vue';
|
import { onMounted, onUnmounted, reactive, toRaw } from 'vue';
|
||||||
import { PageContainer } from '@ant-design-vue/pro-layout';
|
import { PageContainer } from '@ant-design-vue/pro-layout';
|
||||||
import saveAs from 'file-saver';
|
import saveAs from 'file-saver';
|
||||||
import useNeInfoStore from '@/store/modules/neinfo';
|
import useNeInfoStore from '@/store/modules/neinfo';
|
||||||
@@ -23,6 +23,10 @@ type ModalStateType = {
|
|||||||
neType: string[];
|
neType: string[];
|
||||||
/**表单数据 */
|
/**表单数据 */
|
||||||
from: Record<string, any>;
|
from: Record<string, any>;
|
||||||
|
/**UPF命令组 */
|
||||||
|
upfCmdOptions: Record<string, any>[];
|
||||||
|
/**UPF是否执行过 */
|
||||||
|
upfExec: boolean;
|
||||||
/**确定按钮 loading */
|
/**确定按钮 loading */
|
||||||
confirmLoading: boolean;
|
confirmLoading: boolean;
|
||||||
/**执行日志 */
|
/**执行日志 */
|
||||||
@@ -38,11 +42,29 @@ let modalState: ModalStateType = reactive({
|
|||||||
neType: [],
|
neType: [],
|
||||||
from: {
|
from: {
|
||||||
ip: '',
|
ip: '',
|
||||||
cmd: 'sctp or tcp port 8080 or 8088',
|
timestamp: '', // 时间戳记录文件时间
|
||||||
|
// 普通网元
|
||||||
|
cmd: '-n -s 0 -v -w',
|
||||||
timeout: 60,
|
timeout: 60,
|
||||||
upfStart: 'pcap dispatch trace on max 100000',
|
// upf
|
||||||
upfStop: 'pcap dispatch trace off',
|
upfStart: '',
|
||||||
|
upfStop: '',
|
||||||
},
|
},
|
||||||
|
upfCmdOptions: [
|
||||||
|
{
|
||||||
|
label: '适合其他网元异常,UPF配合抓包的情况',
|
||||||
|
start: 'pcap trace rx tx max 100000 intfc any',
|
||||||
|
stop: 'pcap trace rx tx off',
|
||||||
|
value: 'pcap trace',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '适合UPF异常需要抓包分析的情况',
|
||||||
|
start: 'pcap dispatch trace on max 100000',
|
||||||
|
stop: 'pcap dispatch trace off',
|
||||||
|
value: 'pcap dispatch',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
upfExec: false,
|
||||||
confirmLoading: false,
|
confirmLoading: false,
|
||||||
execLogMsg: '',
|
execLogMsg: '',
|
||||||
fileName: '',
|
fileName: '',
|
||||||
@@ -88,13 +110,14 @@ function fnStart() {
|
|||||||
.validate(['cmd', 'timeout'])
|
.validate(['cmd', 'timeout'])
|
||||||
.then(() => {
|
.then(() => {
|
||||||
modalState.confirmLoading = true;
|
modalState.confirmLoading = true;
|
||||||
|
modalState.from.timestamp = `${Date.now()}`;
|
||||||
const from = toRaw(modalState.from);
|
const from = toRaw(modalState.from);
|
||||||
const hide = message.loading(t('common.loading'), 0);
|
const hide = message.loading(t('common.loading'), 0);
|
||||||
controller = new AbortController();
|
controller = new AbortController();
|
||||||
const signal = controller.signal;
|
const signal = controller.signal;
|
||||||
timeoutId = setInterval(() => {
|
timeoutId = setInterval(() => {
|
||||||
runTime.value++;
|
runTime.value++;
|
||||||
if (runTime.value > from.timeout + 5) {
|
if (runTime.value >= from.timeout + 5) {
|
||||||
clearInterval(timeoutId);
|
clearInterval(timeoutId);
|
||||||
runTime.value = 0;
|
runTime.value = 0;
|
||||||
message.warning({
|
message.warning({
|
||||||
@@ -109,6 +132,7 @@ function fnStart() {
|
|||||||
tcpdumpNeTask(signal, {
|
tcpdumpNeTask(signal, {
|
||||||
neType: modalState.neType[0],
|
neType: modalState.neType[0],
|
||||||
neId: modalState.neType[1],
|
neId: modalState.neType[1],
|
||||||
|
timestamp: from.timestamp,
|
||||||
timeout: from.timeout,
|
timeout: from.timeout,
|
||||||
cmd: from.cmd,
|
cmd: from.cmd,
|
||||||
})
|
})
|
||||||
@@ -118,11 +142,14 @@ function fnStart() {
|
|||||||
content: t('views.traceManage.pcap.execSuccess'),
|
content: t('views.traceManage.pcap.execSuccess'),
|
||||||
duration: 3,
|
duration: 3,
|
||||||
});
|
});
|
||||||
let logmsg = res.data.cmd + '\n\n' + res.data.msg;
|
const msg = res.data.msg;
|
||||||
|
let logmsg = res.data.cmd + '\n\n' + msg;
|
||||||
logmsg = logmsg.replace(' \n', '\n\n');
|
logmsg = logmsg.replace(' \n', '\n\n');
|
||||||
modalState.execLogMsg = logmsg;
|
modalState.execLogMsg = logmsg;
|
||||||
modalState.fileName = res.data.fileName;
|
modalState.fileName = res.data.fileName;
|
||||||
modalState.downBtn = true;
|
// 正常抓包时才显示文件下载
|
||||||
|
modalState.downBtn =
|
||||||
|
msg.indexOf('tcpdump: listening on any,') !== -1;
|
||||||
} else if (
|
} else if (
|
||||||
res.code === RESULT_CODE_ERROR &&
|
res.code === RESULT_CODE_ERROR &&
|
||||||
res.msg.includes('timeout')
|
res.msg.includes('timeout')
|
||||||
@@ -190,17 +217,29 @@ function fnDownPCAP() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**UPF抓包命令选择 */
|
||||||
|
function fnUPFSelectCmd(value: any, option: any) {
|
||||||
|
console.log(value, option);
|
||||||
|
modalState.from.upfStart = option.start;
|
||||||
|
modalState.from.upfStop = option.stop;
|
||||||
|
}
|
||||||
|
|
||||||
/**UPF抓包执行 */
|
/**UPF抓包执行 */
|
||||||
function fnUPF(runType: 'start' | 'stop') {
|
function fnUPF(runType: 'start' | 'stop') {
|
||||||
modalStateFrom
|
modalStateFrom
|
||||||
.validate([runType === 'start' ? 'upfStart' : 'upfStop'])
|
.validate([runType === 'start' ? 'upfStart' : 'upfStop'])
|
||||||
.then(() => {
|
.then(() => {
|
||||||
modalState.confirmLoading = true;
|
modalState.confirmLoading = true;
|
||||||
|
if (runType === 'start') {
|
||||||
|
modalState.downBtn = false;
|
||||||
|
modalState.from.timestamp = `${Date.now()}`;
|
||||||
|
}
|
||||||
const from = toRaw(modalState.from);
|
const from = toRaw(modalState.from);
|
||||||
const hide = message.loading(t('common.loading'), 0);
|
const hide = message.loading(t('common.loading'), 0);
|
||||||
tcpdumpNeUPFTask({
|
tcpdumpNeUPFTask({
|
||||||
neType: modalState.neType[0],
|
neType: modalState.neType[0],
|
||||||
neId: modalState.neType[1],
|
neId: modalState.neType[1],
|
||||||
|
timestamp: from.timestamp,
|
||||||
runType: runType === 'start' ? 'start_str' : 'stop_str',
|
runType: runType === 'start' ? 'start_str' : 'stop_str',
|
||||||
cmd: runType === 'start' ? from.upfStart : from.upfStop,
|
cmd: runType === 'start' ? from.upfStart : from.upfStop,
|
||||||
})
|
})
|
||||||
@@ -211,6 +250,7 @@ function fnUPF(runType: 'start' | 'stop') {
|
|||||||
modalState.execLogMsg = logmsg;
|
modalState.execLogMsg = logmsg;
|
||||||
modalState.fileName = res.data.fileName;
|
modalState.fileName = res.data.fileName;
|
||||||
if (runType === 'start') {
|
if (runType === 'start') {
|
||||||
|
modalState.upfExec = true;
|
||||||
if (res.data.msg.includes('already')) {
|
if (res.data.msg.includes('already')) {
|
||||||
message.warning({
|
message.warning({
|
||||||
content: t('views.traceManage.pcap.execUPFStartA'),
|
content: t('views.traceManage.pcap.execUPFStartA'),
|
||||||
@@ -224,6 +264,7 @@ function fnUPF(runType: 'start' | 'stop') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (runType === 'stop') {
|
if (runType === 'stop') {
|
||||||
|
modalState.upfExec = false;
|
||||||
if (res.data.msg.includes('already')) {
|
if (res.data.msg.includes('already')) {
|
||||||
message.warning({
|
message.warning({
|
||||||
content: t('views.traceManage.pcap.execUPFStopA'),
|
content: t('views.traceManage.pcap.execUPFStopA'),
|
||||||
@@ -273,6 +314,10 @@ onMounted(() => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
fnStop();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -298,6 +343,7 @@ onMounted(() => {
|
|||||||
@change="fnNeChange"
|
@change="fnNeChange"
|
||||||
:allow-clear="false"
|
:allow-clear="false"
|
||||||
:placeholder="t('views.traceManage.pcap.neTypePlease')"
|
:placeholder="t('views.traceManage.pcap.neTypePlease')"
|
||||||
|
:disabled="modalState.confirmLoading || modalState.upfExec"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item :label="t('views.traceManage.pcap.neIp')" name="ip">
|
<a-form-item :label="t('views.traceManage.pcap.neIp')" name="ip">
|
||||||
@@ -306,50 +352,39 @@ onMounted(() => {
|
|||||||
|
|
||||||
<template v-if="modalState.neType[0] === 'UPF'">
|
<template v-if="modalState.neType[0] === 'UPF'">
|
||||||
<a-form-item
|
<a-form-item
|
||||||
:label="t('views.traceManage.pcap.capStart')"
|
:label="t('views.traceManage.pcap.capArg')"
|
||||||
name="upfStart"
|
name="upfStart"
|
||||||
v-bind="modalStateFrom.validateInfos.upfStart"
|
v-bind="modalStateFrom.validateInfos.upfStart"
|
||||||
>
|
>
|
||||||
<a-input-group compact>
|
<a-auto-complete
|
||||||
<a-input
|
v-model:value="modalState.from.upfStart"
|
||||||
v-model:value="modalState.from.upfStart"
|
:options="modalState.upfCmdOptions"
|
||||||
allow-clear
|
:placeholder="t('views.traceManage.pcap.capArgUPFPlease')"
|
||||||
:placeholder="t('views.traceManage.pcap.capArgUPFPlease')"
|
allow-clear
|
||||||
style="width: 75%"
|
@select="fnUPFSelectCmd"
|
||||||
/>
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item :wrapperCol="{ offset: 5 }">
|
||||||
|
<a-space :size="8">
|
||||||
<a-button
|
<a-button
|
||||||
type="primary"
|
type="primary"
|
||||||
style="width: 25%"
|
:disabled="modalState.upfExec"
|
||||||
:disabled="modalState.confirmLoading"
|
|
||||||
:loading="modalState.confirmLoading"
|
:loading="modalState.confirmLoading"
|
||||||
@click.prevent="fnUPF('start')"
|
@click.prevent="fnUPF('start')"
|
||||||
>
|
>
|
||||||
{{ t('views.traceManage.pcap.runText') }}
|
<template #icon><ApiOutlined /></template>
|
||||||
|
{{ t('views.traceManage.pcap.capStart') }}
|
||||||
</a-button>
|
</a-button>
|
||||||
</a-input-group>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item
|
|
||||||
:label="t('views.traceManage.pcap.capStop')"
|
|
||||||
name="upfStop"
|
|
||||||
v-bind="modalStateFrom.validateInfos.upfStop"
|
|
||||||
>
|
|
||||||
<a-input-group compact>
|
|
||||||
<a-input
|
|
||||||
v-model:value="modalState.from.upfStop"
|
|
||||||
allow-clear
|
|
||||||
:placeholder="t('views.traceManage.pcap.capArgUPFPlease')"
|
|
||||||
style="width: 75%"
|
|
||||||
/>
|
|
||||||
<a-button
|
<a-button
|
||||||
type="primary"
|
type="dashed"
|
||||||
style="width: 25%"
|
danger
|
||||||
:disabled="modalState.confirmLoading"
|
:disabled="!modalState.upfExec"
|
||||||
:loading="modalState.confirmLoading"
|
:loading="modalState.confirmLoading"
|
||||||
@click.prevent="fnUPF('stop')"
|
@click.prevent="fnUPF('stop')"
|
||||||
>
|
>
|
||||||
{{ t('views.traceManage.pcap.runText') }}
|
{{ t('views.traceManage.pcap.capStop') }}
|
||||||
</a-button>
|
</a-button>
|
||||||
</a-input-group>
|
</a-space>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
|
|||||||
Reference in New Issue
Block a user