From bbef0afeb01317f351a7fad7e908a465df58629b Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Thu, 6 Feb 2025 14:29:03 +0800 Subject: [PATCH 1/5] =?UTF-8?q?docs:=20=E6=9B=B4=E6=96=B0swagger=E6=B3=A8?= =?UTF-8?q?=E9=87=8A=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/monitor/controller/monitor.go | 8 ++- .../network_data/controller/all_kpi.go | 10 +-- .../network_data/controller/udm_auth.go | 4 +- .../network_data/controller/udm_sub.go | 6 +- swagger2docs/docs.go | 69 +++++++++++++++++-- swagger2docs/swagger.json | 69 +++++++++++++++++-- swagger2docs/swagger.yaml | 61 +++++++++++++--- 7 files changed, 195 insertions(+), 32 deletions(-) diff --git a/src/modules/monitor/controller/monitor.go b/src/modules/monitor/controller/monitor.go index b1e90d34..bc18a66a 100644 --- a/src/modules/monitor/controller/monitor.go +++ b/src/modules/monitor/controller/monitor.go @@ -28,7 +28,13 @@ type MonitorController struct { // @Tags monitor // @Accept json // @Produce json -// @Success 200 {object} object "Response Results" +// @Param type query string true "Data Type" Enums(all,load,cpu,memory,io,network) default(all) +// @Param startTime query number true "StartTime, timestamp milliseconds" default(1738771200000) +// @Param endTime query number true "EndTime, timestamp milliseconds" default(1738810051253) +// @Param neType query string false "NE Type, Currently none Default #" default(#) +// @Param neId query string false "NE ID, Currently none Default #" default(#) +// @Param name query string false "Name, Data Type valid for networ and io" +// @Success 200 {object} object "Response Results" // @Security TokenAuth // @Summary Resource monitoring information loading // @Description Resource monitoring information loading diff --git a/src/modules/network_data/controller/all_kpi.go b/src/modules/network_data/controller/all_kpi.go index 6877b3a3..b1a12ccf 100644 --- a/src/modules/network_data/controller/all_kpi.go +++ b/src/modules/network_data/controller/all_kpi.go @@ -31,11 +31,11 @@ type PerfKPIController struct { // @Tags network_data/kpi // @Accept json // @Produce json -// @Param neType query string true "NE Type" Enums(IMS,AMF,AUSF,UDM,SMF,PCF,NSSF,NRF,UPF,MME,CBC,OMC,SGWC) +// @Param neType query string true "NE Type" Enums(IMS,AMF,AUSF,UDM,SMF,PCF,NSSF,NRF,UPF,MME,CBC,OMC,SGWC) default(AMF) // @Param neId query string true "NE ID" default(001) -// @Param startTime query number true "Start time (timestamped milliseconds)" default(1737453599059) -// @Param endTime query number true "End time (timestamped milliseconds)" default(1737453599059) -// @Param interval query number true "interval" Enums(5,10,15,30,60,300,600,900,1800,3600) +// @Param startTime query number true "Start time (timestamped milliseconds)" default(1729162507596) +// @Param endTime query number true "End time (timestamped milliseconds)" default(1729164187611) +// @Param interval query number true "interval" Enums(5,10,15,30,60,300,600,900,1800,3600) default(60) // @Success 200 {object} object "Response Results" // @Security TokenAuth // @Summary Access to statistical data @@ -73,7 +73,7 @@ func (s *PerfKPIController) GoldKPI(c *gin.Context) { // @Tags network_data/kpi // @Accept json // @Produce json -// @Param neType query string true "NE Type" Enums(IMS,AMF,AUSF,UDM,SMF,PCF,NSSF,NRF,UPF,MME,CBC,OMC,SGWC) +// @Param neType query string true "NE Type" Enums(IMS,AMF,AUSF,UDM,SMF,PCF,NSSF,NRF,UPF,MME,CBC,OMC,SGWC) default(AMF) // @Success 200 {object} object "Response Results" // @Security TokenAuth // @Summary Get Statistical Headings diff --git a/src/modules/network_data/controller/udm_auth.go b/src/modules/network_data/controller/udm_auth.go index d2c784ea..cd8c2505 100644 --- a/src/modules/network_data/controller/udm_auth.go +++ b/src/modules/network_data/controller/udm_auth.go @@ -205,7 +205,7 @@ func (s *UDMAuthController) Add(c *gin.Context) { // @Accept json // @Produce json // @Param neId path string true "NE ID" default(001) -// @Param value path number true "Number includes starting imsi" +// @Param value path number true "Number of releases, value includes start imsi" // @Param data body object true "Request Param" // @Success 200 {object} object "Response Results" // @Security TokenAuth @@ -390,7 +390,7 @@ func (s *UDMAuthController) Remove(c *gin.Context) { // @Produce json // @Param neId path string true "NE ID" default(001) // @Param imsi path string true "IMSI" -// @Param num path number true "Number includes starting imsi" +// @Param num path number true "Number of releases, value includes start imsi" // @Success 200 {object} object "Response Results" // @Security TokenAuth // @Summary UDM Authentication User Batch Deletion diff --git a/src/modules/network_data/controller/udm_sub.go b/src/modules/network_data/controller/udm_sub.go index 459c14e2..d8b5d6e2 100644 --- a/src/modules/network_data/controller/udm_sub.go +++ b/src/modules/network_data/controller/udm_sub.go @@ -205,8 +205,8 @@ func (s *UDMSubController) Add(c *gin.Context) { // @Tags network_data/udm/sub // @Accept json // @Produce json -// @Param neId path string true "NE ID" default(001) -// @Param value path number true "Number includes starting imsi" default(1) +// @Param neId path string true "NE ID" default(001) +// @Param value path number true "Number of releases, value includes start imsi" default(1) // @Param data body object true "Request Param" // @Success 200 {object} object "Response Results" // @Security TokenAuth @@ -395,7 +395,7 @@ func (s *UDMSubController) Remove(c *gin.Context) { // @Produce json // @Param neId path string true "NE ID" default(001) // @Param imsi path string true "IMSI" -// @Param num path number true "Number includes starting imsi" +// @Param num path number true "Number of releases, value includes start imsi" // @Success 200 {object} object "Response Results" // @Security TokenAuth // @Summary UDM Subscriber User Batch Deletion diff --git a/swagger2docs/docs.go b/swagger2docs/docs.go index 9e94c773..e62d967f 100644 --- a/swagger2docs/docs.go +++ b/swagger2docs/docs.go @@ -560,6 +560,60 @@ const docTemplate = `{ "monitor" ], "summary": "Resource monitoring information loading", + "parameters": [ + { + "enum": [ + "all", + "load", + "cpu", + "memory", + "io", + "network" + ], + "type": "string", + "default": "all", + "description": "Data Type", + "name": "type", + "in": "query", + "required": true + }, + { + "type": "number", + "default": 1738771200000, + "description": "StartTime, timestamp milliseconds", + "name": "startTime", + "in": "query", + "required": true + }, + { + "type": "number", + "default": 1738810051253, + "description": "EndTime, timestamp milliseconds", + "name": "endTime", + "in": "query", + "required": true + }, + { + "type": "string", + "default": "#", + "description": "NE Type, Currently none Default #", + "name": "neType", + "in": "query" + }, + { + "type": "string", + "default": "#", + "description": "NE ID, Currently none Default #", + "name": "neId", + "in": "query" + }, + { + "type": "string", + "description": "Name, Data Type valid for networ and io", + "name": "name", + "in": "query" + } + ], "responses": { "200": { "description": "Response Results", @@ -2527,6 +2581,7 @@ const docTemplate = `{ "SGWC" ], "type": "string", + "default": "AMF", "description": "NE Type", "name": "neType", "in": "query", @@ -2542,7 +2597,7 @@ const docTemplate = `{ }, { "type": "number", - "default": 1737453599059, + "default": 1729162507596, "description": "Start time (timestamped milliseconds)", "name": "startTime", "in": "query", @@ -2550,7 +2605,7 @@ const docTemplate = `{ }, { "type": "number", - "default": 1737453599059, + "default": 1729164187611, "description": "End time (timestamped milliseconds)", "name": "endTime", "in": "query", @@ -2570,6 +2625,7 @@ const docTemplate = `{ 3600 ], "type": "number", + "default": 60, "description": "interval", "name": "interval", "in": "query", @@ -2622,6 +2678,7 @@ const docTemplate = `{ "SGWC" ], "type": "string", + "default": "AMF", "description": "NE Type", "name": "neType", "in": "query", @@ -3722,7 +3779,7 @@ const docTemplate = `{ }, { "type": "number", - "description": "Number includes starting imsi", + "description": "Number of releases, value includes start imsi", "name": "num", "in": "path", "required": true @@ -3810,7 +3867,7 @@ const docTemplate = `{ }, { "type": "number", - "description": "Number includes starting imsi", + "description": "Number of releases, value includes start imsi", "name": "value", "in": "path", "required": true @@ -4188,7 +4245,7 @@ const docTemplate = `{ }, { "type": "number", - "description": "Number includes starting imsi", + "description": "Number of releases, value includes start imsi", "name": "num", "in": "path", "required": true @@ -4277,7 +4334,7 @@ const docTemplate = `{ { "type": "number", "default": 1, - "description": "Number includes starting imsi", + "description": "Number of releases, value includes start imsi", "name": "value", "in": "path", "required": true diff --git a/swagger2docs/swagger.json b/swagger2docs/swagger.json index 463c588c..a495f912 100644 --- a/swagger2docs/swagger.json +++ b/swagger2docs/swagger.json @@ -558,6 +558,60 @@ "monitor" ], "summary": "Resource monitoring information loading", + "parameters": [ + { + "enum": [ + "all", + "load", + "cpu", + "memory", + "io", + "network" + ], + "type": "string", + "default": "all", + "description": "Data Type", + "name": "type", + "in": "query", + "required": true + }, + { + "type": "number", + "default": 1738771200000, + "description": "StartTime, timestamp milliseconds", + "name": "startTime", + "in": "query", + "required": true + }, + { + "type": "number", + "default": 1738810051253, + "description": "EndTime, timestamp milliseconds", + "name": "endTime", + "in": "query", + "required": true + }, + { + "type": "string", + "default": "#", + "description": "NE Type, Currently none Default #", + "name": "neType", + "in": "query" + }, + { + "type": "string", + "default": "#", + "description": "NE ID, Currently none Default #", + "name": "neId", + "in": "query" + }, + { + "type": "string", + "description": "Name, Data Type valid for networ and io", + "name": "name", + "in": "query" + } + ], "responses": { "200": { "description": "Response Results", @@ -2525,6 +2579,7 @@ "SGWC" ], "type": "string", + "default": "AMF", "description": "NE Type", "name": "neType", "in": "query", @@ -2540,7 +2595,7 @@ }, { "type": "number", - "default": 1737453599059, + "default": 1729162507596, "description": "Start time (timestamped milliseconds)", "name": "startTime", "in": "query", @@ -2548,7 +2603,7 @@ }, { "type": "number", - "default": 1737453599059, + "default": 1729164187611, "description": "End time (timestamped milliseconds)", "name": "endTime", "in": "query", @@ -2568,6 +2623,7 @@ 3600 ], "type": "number", + "default": 60, "description": "interval", "name": "interval", "in": "query", @@ -2620,6 +2676,7 @@ "SGWC" ], "type": "string", + "default": "AMF", "description": "NE Type", "name": "neType", "in": "query", @@ -3720,7 +3777,7 @@ }, { "type": "number", - "description": "Number includes starting imsi", + "description": "Number of releases, value includes start imsi", "name": "num", "in": "path", "required": true @@ -3808,7 +3865,7 @@ }, { "type": "number", - "description": "Number includes starting imsi", + "description": "Number of releases, value includes start imsi", "name": "value", "in": "path", "required": true @@ -4186,7 +4243,7 @@ }, { "type": "number", - "description": "Number includes starting imsi", + "description": "Number of releases, value includes start imsi", "name": "num", "in": "path", "required": true @@ -4275,7 +4332,7 @@ { "type": "number", "default": 1, - "description": "Number includes starting imsi", + "description": "Number of releases, value includes start imsi", "name": "value", "in": "path", "required": true diff --git a/swagger2docs/swagger.yaml b/swagger2docs/swagger.yaml index 6a364dfb..70ce0ad4 100644 --- a/swagger2docs/swagger.yaml +++ b/swagger2docs/swagger.yaml @@ -341,6 +341,46 @@ paths: consumes: - application/json description: Resource monitoring information loading + parameters: + - default: all + description: Data Type + enum: + - all + - load + - cpu + - memory + - io + - network + in: query + name: type + required: true + type: string + - default: 1738771200000 + description: StartTime, timestamp milliseconds + in: query + name: startTime + required: true + type: number + - default: 1738810051253 + description: EndTime, timestamp milliseconds + in: query + name: endTime + required: true + type: number + - default: '#' + description: 'NE Type, Currently none Default #' + in: query + name: neType + type: string + - default: '#' + description: 'NE ID, Currently none Default #' + in: query + name: neId + type: string + - description: Name, Data Type valid for networ and io + in: query + name: name + type: string produces: - application/json responses: @@ -1626,7 +1666,8 @@ paths: - application/json description: Access to statistical data parameters: - - description: NE Type + - default: AMF + description: NE Type enum: - IMS - AMF @@ -1651,19 +1692,20 @@ paths: name: neId required: true type: string - - default: 1737453599059 + - default: 1729162507596 description: Start time (timestamped milliseconds) in: query name: startTime required: true type: number - - default: 1737453599059 + - default: 1729164187611 description: End time (timestamped milliseconds) in: query name: endTime required: true type: number - - description: interval + - default: 60 + description: interval enum: - 5 - 10 @@ -1697,7 +1739,8 @@ paths: - application/json description: Get Statistical Headings parameters: - - description: NE Type + - default: AMF + description: NE Type enum: - IMS - AMF @@ -2306,7 +2349,7 @@ paths: name: imsi required: true type: string - - description: Number includes starting imsi + - description: Number of releases, value includes start imsi in: path name: num required: true @@ -2391,7 +2434,7 @@ paths: name: neId required: true type: string - - description: Number includes starting imsi + - description: Number of releases, value includes start imsi in: path name: value required: true @@ -2602,7 +2645,7 @@ paths: name: imsi required: true type: string - - description: Number includes starting imsi + - description: Number of releases, value includes start imsi in: path name: num required: true @@ -2688,7 +2731,7 @@ paths: required: true type: string - default: 1 - description: Number includes starting imsi + description: Number of releases, value includes start imsi in: path name: value required: true From 279f8146747b1b9bf9c758e8f0aecb680c577cb9 Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Thu, 6 Feb 2025 14:29:55 +0800 Subject: [PATCH 2/5] =?UTF-8?q?fix:=20=E6=9C=AC=E5=9C=B0=E5=85=8D=E5=AF=86?= =?UTF-8?q?=E8=AE=A4=E8=AF=81=E7=AB=AF=E5=8F=A3=E5=8E=BB=E9=99=A4=E9=99=90?= =?UTF-8?q?=E5=88=B622?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/framework/utils/ssh/ssh.go | 1 - 1 file changed, 1 deletion(-) diff --git a/src/framework/utils/ssh/ssh.go b/src/framework/utils/ssh/ssh.go index 6a4a526a..f412b718 100644 --- a/src/framework/utils/ssh/ssh.go +++ b/src/framework/utils/ssh/ssh.go @@ -165,7 +165,6 @@ func (c *ConnSSH) NewClientSFTP() (*SSHClientSFTP, error) { // Port: body.Port, // } func (c *ConnSSH) NewClientByLocalPrivate() (*ConnSSH, error) { - c.Port = 22 c.AuthMode = "1" privateKey, err := c.CurrentUserRsaKey(false) if err != nil { From 0b94281520d94d59f962248ea3fc57d42d683fac Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Thu, 6 Feb 2025 14:32:42 +0800 Subject: [PATCH 3/5] =?UTF-8?q?fix:=20=E7=9B=91=E6=8E=A7=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?/load=E5=92=8C/system-info=E5=92=8C/cache=E5=8E=BB=E9=99=A4?= =?UTF-8?q?=E6=9D=83=E9=99=90=E6=A0=87=E8=AF=86=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/monitor/monitor.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/modules/monitor/monitor.go b/src/modules/monitor/monitor.go index b71bbfa4..751716a9 100644 --- a/src/modules/monitor/monitor.go +++ b/src/modules/monitor/monitor.go @@ -23,14 +23,15 @@ func Setup(router *gin.Engine) { monitorGroup := router.Group("/monitor") { monitorGroup.GET("/load", - // middleware.PreAuthorize(nil), + middleware.PreAuthorize(nil), controller.NewMonitor.Load, ) } // 服务器服务信息 router.GET("/monitor/system-info", - middleware.PreAuthorize(map[string][]string{"hasPerms": {"monitor:system:info"}}), + // middleware.PreAuthorize(map[string][]string{"hasPerms": {"monitor:system:info"}}), + middleware.PreAuthorize(nil), controller.NewSystemInfo.Info, ) @@ -38,7 +39,8 @@ func Setup(router *gin.Engine) { sysCacheGroup := router.Group("/monitor/cache") { sysCacheGroup.GET("", - middleware.PreAuthorize(map[string][]string{"hasPerms": {"monitor:cache:info"}}), + // middleware.PreAuthorize(map[string][]string{"hasPerms": {"monitor:cache:info"}}), + middleware.PreAuthorize(nil), controller.NewSysCache.Info, ) sysCacheGroup.GET("/getNames", From 89e03ca3d9a778bfc6249c69fc4442d503ccc21d Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Thu, 6 Feb 2025 20:33:55 +0800 Subject: [PATCH 4/5] =?UTF-8?q?docs:=20=E6=9B=B4=E6=96=B0swagger=E6=B3=A8?= =?UTF-8?q?=E9=87=8A=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/framework/utils/ssh/files.go | 2 +- .../network_element/controller/action.go | 33 ++- src/modules/network_element/ne_config_test.go | 6 +- swagger2docs/docs.go | 237 ++++++++++++++++++ swagger2docs/swagger.json | 237 ++++++++++++++++++ swagger2docs/swagger.yaml | 183 ++++++++++++++ 6 files changed, 688 insertions(+), 10 deletions(-) diff --git a/src/framework/utils/ssh/files.go b/src/framework/utils/ssh/files.go index d38a62d5..e681ee99 100644 --- a/src/framework/utils/ssh/files.go +++ b/src/framework/utils/ssh/files.go @@ -11,7 +11,7 @@ import ( // FileListRow 文件列表行数据 type FileListRow struct { - FileType string `json:"fileType"` // 文件类型 + FileType string `json:"fileType"` // 文件类型 dir, file, symlink FileMode string `json:"fileMode"` // 文件的权限 LinkCount int64 `json:"linkCount"` // 硬链接数目 Owner string `json:"owner"` // 所属用户 diff --git a/src/modules/network_element/controller/action.go b/src/modules/network_element/controller/action.go index 295c799b..d1c7dc02 100644 --- a/src/modules/network_element/controller/action.go +++ b/src/modules/network_element/controller/action.go @@ -38,7 +38,8 @@ type NeActionController struct { // @Tags network_element/action // @Accept json // @Produce json -// @Success 200 {object} object "Response Results" +// @Param data body object true "Request Param" +// @Success 200 {object} object "Response Results" // @Security TokenAuth // @Summary Sending files from local to network elements // @Description Sending files from local to network elements @@ -104,7 +105,12 @@ func (s *NeActionController) PushFile(c *gin.Context) { // @Tags network_element/action // @Accept json // @Produce json -// @Success 200 {object} object "Response Results" +// @Param neType query string true "NE Type" Enums(IMS,AMF,AUSF,UDM,SMF,PCF,NSSF,NRF,UPF,MME,CBC,OMC,SGWC) default(UPF) +// @Param neId query string true "NE ID" default(001) +// @Param path query string true "dir path" default(/var/log) +// @Param fileName query string true "file name" +// @Param delTemp query boolean false "Delete Temp File" default(false) +// @Success 200 {object} object "Response Results" // @Security TokenAuth // @Summary Getting files from the network element to the local // @Description Getting files from the network element to the local @@ -172,7 +178,11 @@ func (s *NeActionController) PullFile(c *gin.Context) { // @Tags network_element/action // @Accept json // @Produce json -// @Success 200 {object} object "Response Results" +// @Param neType query string true "NE Type" Enums(IMS,AMF,AUSF,UDM,SMF,PCF,NSSF,NRF,UPF,MME,CBC,OMC,SGWC) default(UPF) +// @Param neId query string true "NE ID" default(001) +// @Param path query string true "dir path" default(/var/log) +// @Param delTemp query boolean false "Delete Temp File" default(false) +// @Success 200 {object} object "Response Results" // @Security TokenAuth // @Summary Get directories compressed to ZIP from the network element to the local area // @Description Get directories compressed to ZIP from the network element to the local area @@ -248,7 +258,11 @@ func (s *NeActionController) PullDirZip(c *gin.Context) { // @Tags network_element/action // @Accept json // @Produce json -// @Success 200 {object} object "Response Results" +// @Param neType query string true "NE Type" Enums(IMS,AMF,AUSF,UDM,SMF,PCF,NSSF,NRF,UPF,MME,CBC,OMC,SGWC) default(UPF) +// @Param neId query string true "NE ID" default(001) +// @Param path query string true "file path" default(/var/log) +// @Param fileName query string true "file name" +// @Success 200 {object} object "Response Results" // @Security TokenAuth // @Summary Viewing the contents of a file on the network element side // @Description Viewing the contents of a file on the network element side @@ -300,7 +314,13 @@ func (s *NeActionController) ViewFile(c *gin.Context) { // @Tags network_element/action // @Accept json // @Produce json -// @Success 200 {object} object "Response Results" +// @Param neType query string true "NE Type" Enums(IMS,AMF,AUSF,UDM,SMF,PCF,NSSF,NRF,UPF,MME,CBC,OMC,SGWC) default(UPF) +// @Param neId query string true "NE ID" default(001) +// @Param path query string true "file path" default(/var/log) +// @Param pageNum query number true "pageNum" default(1) +// @Param pageSize query number true "pageSize" default(10) +// @Param search query string false "search prefix" default(upf) +// @Success 200 {object} object "Response Results" // @Security TokenAuth // @Summary List of files on the network element side // @Description List of files on the network element side @@ -373,7 +393,8 @@ func (s *NeActionController) Files(c *gin.Context) { // @Tags network_element/action // @Accept json // @Produce json -// @Success 200 {object} object "Response Results" +// @Param data body object true "Request Param" +// @Success 200 {object} object "Response Results" // @Security TokenAuth // @Summary Network element service operation // @Description Network element service operation diff --git a/src/modules/network_element/ne_config_test.go b/src/modules/network_element/ne_config_test.go index 1324d58c..1a601365 100644 --- a/src/modules/network_element/ne_config_test.go +++ b/src/modules/network_element/ne_config_test.go @@ -21,15 +21,15 @@ import ( const ( // 数据库 - DbHost = "127.0.0.1" - DbPort = 33066 + DbHost = "192.168.9.58" + DbPort = 13306 DbUser = "root" DbPassswd = "1000omc@kp!" DbName = "omc_db" // 配置文件路径 configParamDir = "../../../config/param" // configParamFile = "*" // 目录下全部更新 - configParamFile = "omc_param_config.yaml" // 单文件更新 + configParamFile = "mme_param_config.yaml" // 单文件更新 ) func TestConfig(t *testing.T) { diff --git a/swagger2docs/docs.go b/swagger2docs/docs.go index e62d967f..91a80138 100644 --- a/swagger2docs/docs.go +++ b/swagger2docs/docs.go @@ -698,6 +698,70 @@ const docTemplate = `{ "network_element/action" ], "summary": "List of files on the network element side", + "parameters": [ + { + "enum": [ + "IMS", + "AMF", + "AUSF", + "UDM", + "SMF", + "PCF", + "NSSF", + "NRF", + "UPF", + "MME", + "CBC", + "OMC", + "SGWC" + ], + "type": "string", + "default": "UPF", + "description": "NE Type", + "name": "neType", + "in": "query", + "required": true + }, + { + "type": "string", + "default": "001", + "description": "NE ID", + "name": "neId", + "in": "query", + "required": true + }, + { + "type": "string", + "default": "/var/log", + "description": "file path", + "name": "path", + "in": "query", + "required": true + }, + { + "type": "number", + "default": 1, + "description": "pageNum", + "name": "pageNum", + "in": "query", + "required": true + }, + { + "type": "number", + "default": 10, + "description": "pageSize", + "name": "pageSize", + "in": "query", + "required": true + }, + { + "type": "string", + "default": "upf", + "description": "search prefix", + "name": "search", + "in": "query" + } + ], "responses": { "200": { "description": "Response Results", @@ -726,6 +790,54 @@ const docTemplate = `{ "network_element/action" ], "summary": "Get directories compressed to ZIP from the network element to the local area", + "parameters": [ + { + "enum": [ + "IMS", + "AMF", + "AUSF", + "UDM", + "SMF", + "PCF", + "NSSF", + "NRF", + "UPF", + "MME", + "CBC", + "OMC", + "SGWC" + ], + "type": "string", + "default": "UPF", + "description": "NE Type", + "name": "neType", + "in": "query", + "required": true + }, + { + "type": "string", + "default": "001", + "description": "NE ID", + "name": "neId", + "in": "query", + "required": true + }, + { + "type": "string", + "default": "/var/log", + "description": "dir path", + "name": "path", + "in": "query", + "required": true + }, + { + "type": "boolean", + "default": false, + "description": "Delete Temp File", + "name": "delTemp", + "in": "query" + } + ], "responses": { "200": { "description": "Response Results", @@ -754,6 +866,61 @@ const docTemplate = `{ "network_element/action" ], "summary": "Getting files from the network element to the local", + "parameters": [ + { + "enum": [ + "IMS", + "AMF", + "AUSF", + "UDM", + "SMF", + "PCF", + "NSSF", + "NRF", + "UPF", + "MME", + "CBC", + "OMC", + "SGWC" + ], + "type": "string", + "default": "UPF", + "description": "NE Type", + "name": "neType", + "in": "query", + "required": true + }, + { + "type": "string", + "default": "001", + "description": "NE ID", + "name": "neId", + "in": "query", + "required": true + }, + { + "type": "string", + "default": "/var/log", + "description": "dir path", + "name": "path", + "in": "query", + "required": true + }, + { + "type": "string", + "description": "file name", + "name": "fileName", + "in": "query", + "required": true + }, + { + "type": "boolean", + "default": false, + "description": "Delete Temp File", + "name": "delTemp", + "in": "query" + } + ], "responses": { "200": { "description": "Response Results", @@ -782,6 +949,17 @@ const docTemplate = `{ "network_element/action" ], "summary": "Sending files from local to network elements", + "parameters": [ + { + "description": "Request Param", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object" + } + } + ], "responses": { "200": { "description": "Response Results", @@ -810,6 +988,17 @@ const docTemplate = `{ "network_element/action" ], "summary": "Network element service operation", + "parameters": [ + { + "description": "Request Param", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object" + } + } + ], "responses": { "200": { "description": "Response Results", @@ -838,6 +1027,54 @@ const docTemplate = `{ "network_element/action" ], "summary": "Viewing the contents of a file on the network element side", + "parameters": [ + { + "enum": [ + "IMS", + "AMF", + "AUSF", + "UDM", + "SMF", + "PCF", + "NSSF", + "NRF", + "UPF", + "MME", + "CBC", + "OMC", + "SGWC" + ], + "type": "string", + "default": "UPF", + "description": "NE Type", + "name": "neType", + "in": "query", + "required": true + }, + { + "type": "string", + "default": "001", + "description": "NE ID", + "name": "neId", + "in": "query", + "required": true + }, + { + "type": "string", + "default": "/var/log", + "description": "file path", + "name": "path", + "in": "query", + "required": true + }, + { + "type": "string", + "description": "file name", + "name": "fileName", + "in": "query", + "required": true + } + ], "responses": { "200": { "description": "Response Results", diff --git a/swagger2docs/swagger.json b/swagger2docs/swagger.json index a495f912..9316faae 100644 --- a/swagger2docs/swagger.json +++ b/swagger2docs/swagger.json @@ -696,6 +696,70 @@ "network_element/action" ], "summary": "List of files on the network element side", + "parameters": [ + { + "enum": [ + "IMS", + "AMF", + "AUSF", + "UDM", + "SMF", + "PCF", + "NSSF", + "NRF", + "UPF", + "MME", + "CBC", + "OMC", + "SGWC" + ], + "type": "string", + "default": "UPF", + "description": "NE Type", + "name": "neType", + "in": "query", + "required": true + }, + { + "type": "string", + "default": "001", + "description": "NE ID", + "name": "neId", + "in": "query", + "required": true + }, + { + "type": "string", + "default": "/var/log", + "description": "file path", + "name": "path", + "in": "query", + "required": true + }, + { + "type": "number", + "default": 1, + "description": "pageNum", + "name": "pageNum", + "in": "query", + "required": true + }, + { + "type": "number", + "default": 10, + "description": "pageSize", + "name": "pageSize", + "in": "query", + "required": true + }, + { + "type": "string", + "default": "upf", + "description": "search prefix", + "name": "search", + "in": "query" + } + ], "responses": { "200": { "description": "Response Results", @@ -724,6 +788,54 @@ "network_element/action" ], "summary": "Get directories compressed to ZIP from the network element to the local area", + "parameters": [ + { + "enum": [ + "IMS", + "AMF", + "AUSF", + "UDM", + "SMF", + "PCF", + "NSSF", + "NRF", + "UPF", + "MME", + "CBC", + "OMC", + "SGWC" + ], + "type": "string", + "default": "UPF", + "description": "NE Type", + "name": "neType", + "in": "query", + "required": true + }, + { + "type": "string", + "default": "001", + "description": "NE ID", + "name": "neId", + "in": "query", + "required": true + }, + { + "type": "string", + "default": "/var/log", + "description": "dir path", + "name": "path", + "in": "query", + "required": true + }, + { + "type": "boolean", + "default": false, + "description": "Delete Temp File", + "name": "delTemp", + "in": "query" + } + ], "responses": { "200": { "description": "Response Results", @@ -752,6 +864,61 @@ "network_element/action" ], "summary": "Getting files from the network element to the local", + "parameters": [ + { + "enum": [ + "IMS", + "AMF", + "AUSF", + "UDM", + "SMF", + "PCF", + "NSSF", + "NRF", + "UPF", + "MME", + "CBC", + "OMC", + "SGWC" + ], + "type": "string", + "default": "UPF", + "description": "NE Type", + "name": "neType", + "in": "query", + "required": true + }, + { + "type": "string", + "default": "001", + "description": "NE ID", + "name": "neId", + "in": "query", + "required": true + }, + { + "type": "string", + "default": "/var/log", + "description": "dir path", + "name": "path", + "in": "query", + "required": true + }, + { + "type": "string", + "description": "file name", + "name": "fileName", + "in": "query", + "required": true + }, + { + "type": "boolean", + "default": false, + "description": "Delete Temp File", + "name": "delTemp", + "in": "query" + } + ], "responses": { "200": { "description": "Response Results", @@ -780,6 +947,17 @@ "network_element/action" ], "summary": "Sending files from local to network elements", + "parameters": [ + { + "description": "Request Param", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object" + } + } + ], "responses": { "200": { "description": "Response Results", @@ -808,6 +986,17 @@ "network_element/action" ], "summary": "Network element service operation", + "parameters": [ + { + "description": "Request Param", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object" + } + } + ], "responses": { "200": { "description": "Response Results", @@ -836,6 +1025,54 @@ "network_element/action" ], "summary": "Viewing the contents of a file on the network element side", + "parameters": [ + { + "enum": [ + "IMS", + "AMF", + "AUSF", + "UDM", + "SMF", + "PCF", + "NSSF", + "NRF", + "UPF", + "MME", + "CBC", + "OMC", + "SGWC" + ], + "type": "string", + "default": "UPF", + "description": "NE Type", + "name": "neType", + "in": "query", + "required": true + }, + { + "type": "string", + "default": "001", + "description": "NE ID", + "name": "neId", + "in": "query", + "required": true + }, + { + "type": "string", + "default": "/var/log", + "description": "file path", + "name": "path", + "in": "query", + "required": true + }, + { + "type": "string", + "description": "file name", + "name": "fileName", + "in": "query", + "required": true + } + ], "responses": { "200": { "description": "Response Results", diff --git a/swagger2docs/swagger.yaml b/swagger2docs/swagger.yaml index 70ce0ad4..0ffe19f5 100644 --- a/swagger2docs/swagger.yaml +++ b/swagger2docs/swagger.yaml @@ -432,6 +432,56 @@ paths: consumes: - application/json description: List of files on the network element side + parameters: + - default: UPF + description: NE Type + enum: + - IMS + - AMF + - AUSF + - UDM + - SMF + - PCF + - NSSF + - NRF + - UPF + - MME + - CBC + - OMC + - SGWC + in: query + name: neType + required: true + type: string + - default: "001" + description: NE ID + in: query + name: neId + required: true + type: string + - default: /var/log + description: file path + in: query + name: path + required: true + type: string + - default: 1 + description: pageNum + in: query + name: pageNum + required: true + type: number + - default: 10 + description: pageSize + in: query + name: pageSize + required: true + type: number + - default: upf + description: search prefix + in: query + name: search + type: string produces: - application/json responses: @@ -450,6 +500,44 @@ paths: - application/json description: Get directories compressed to ZIP from the network element to the local area + parameters: + - default: UPF + description: NE Type + enum: + - IMS + - AMF + - AUSF + - UDM + - SMF + - PCF + - NSSF + - NRF + - UPF + - MME + - CBC + - OMC + - SGWC + in: query + name: neType + required: true + type: string + - default: "001" + description: NE ID + in: query + name: neId + required: true + type: string + - default: /var/log + description: dir path + in: query + name: path + required: true + type: string + - default: false + description: Delete Temp File + in: query + name: delTemp + type: boolean produces: - application/json responses: @@ -468,6 +556,49 @@ paths: consumes: - application/json description: Getting files from the network element to the local + parameters: + - default: UPF + description: NE Type + enum: + - IMS + - AMF + - AUSF + - UDM + - SMF + - PCF + - NSSF + - NRF + - UPF + - MME + - CBC + - OMC + - SGWC + in: query + name: neType + required: true + type: string + - default: "001" + description: NE ID + in: query + name: neId + required: true + type: string + - default: /var/log + description: dir path + in: query + name: path + required: true + type: string + - description: file name + in: query + name: fileName + required: true + type: string + - default: false + description: Delete Temp File + in: query + name: delTemp + type: boolean produces: - application/json responses: @@ -485,6 +616,13 @@ paths: consumes: - application/json description: Sending files from local to network elements + parameters: + - description: Request Param + in: body + name: data + required: true + schema: + type: object produces: - application/json responses: @@ -502,6 +640,13 @@ paths: consumes: - application/json description: Network element service operation + parameters: + - description: Request Param + in: body + name: data + required: true + schema: + type: object produces: - application/json responses: @@ -519,6 +664,44 @@ paths: consumes: - application/json description: Viewing the contents of a file on the network element side + parameters: + - default: UPF + description: NE Type + enum: + - IMS + - AMF + - AUSF + - UDM + - SMF + - PCF + - NSSF + - NRF + - UPF + - MME + - CBC + - OMC + - SGWC + in: query + name: neType + required: true + type: string + - default: "001" + description: NE ID + in: query + name: neId + required: true + type: string + - default: /var/log + description: file path + in: query + name: path + required: true + type: string + - description: file name + in: query + name: fileName + required: true + type: string produces: - application/json responses: From ae04428307a92790e5ab6cdf0e9282a90845428f Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Fri, 7 Feb 2025 10:12:28 +0800 Subject: [PATCH 5/5] =?UTF-8?q?fix:=20IMS-CDR=E5=AF=BC=E5=87=BA=E8=A1=A8?= =?UTF-8?q?=E5=A4=B4=E5=AD=97=E6=AE=B5=E4=BF=A1=E6=81=AF=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../network_data/service/cdr_event_ims.go | 39 ++++++++++++------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/src/modules/network_data/service/cdr_event_ims.go b/src/modules/network_data/service/cdr_event_ims.go index 1291c814..aa9128f3 100644 --- a/src/modules/network_data/service/cdr_event_ims.go +++ b/src/modules/network_data/service/cdr_event_ims.go @@ -53,11 +53,12 @@ func (r CDREventIMS) ExportXlsx(rows []model.CDREventIMS, fileName, language str "A1": "ID", "B1": "Record Behavior", "C1": "Type", - "D1": "Caller", - "E1": "Called", - "F1": "Duration", - "G1": "Result", - "H1": "Time", + "D1": "Called", + "E1": "Result", + "F1": "Caller", + "G1": "Duration", + "H1": "Call Start Time", + "I1": "Hangup Time", } // 读取字典数据 CDR SIP响应代码类别类型 dictCDRSipCode := sysService.NewSysDictData.SelectDictDataByType("cdr_sip_code") @@ -117,13 +118,22 @@ func (r CDREventIMS) ExportXlsx(rows []model.CDREventIMS, fileName, language str } } } - // 取时间 - timeStr := "" + // 呼叫时间 + seizureTimeStr := "" + if v, ok := cdrJSON["seizureTime"]; ok && v != nil { + if seizureTime := parse.Number(v); seizureTime > 0 { + seizureTimeStr = date.ParseDateToStr(seizureTime, date.YYYY_MM_DDTHH_MM_SSZ) + } else { + seizureTimeStr = v.(string) + } + } + // 挂断时间 + releaseTimeStr := "" if v, ok := cdrJSON["releaseTime"]; ok && v != nil { if releaseTime := parse.Number(v); releaseTime > 0 { - timeStr = date.ParseDateToStr(releaseTime, date.YYYY_MM_DDTHH_MM_SSZ) + releaseTimeStr = date.ParseDateToStr(releaseTime, date.YYYY_MM_DDTHH_MM_SSZ) } else { - timeStr = v.(string) + releaseTimeStr = v.(string) } } @@ -131,11 +141,12 @@ func (r CDREventIMS) ExportXlsx(rows []model.CDREventIMS, fileName, language str "A" + idx: row.ID, "B" + idx: recordType, "C" + idx: callTypeLable, - "D" + idx: caller, - "E" + idx: called, - "F" + idx: duration, - "G" + idx: callResult, - "H" + idx: timeStr, + "D" + idx: called, + "E" + idx: callResult, + "F" + idx: caller, + "G" + idx: duration, + "H" + idx: seizureTimeStr, + "I" + idx: releaseTimeStr, }) }