Merge remote-tracking branch 'origin/main' into multi-tenant

This commit is contained in:
TsMask
2025-02-07 10:30:14 +08:00
13 changed files with 913 additions and 60 deletions

View File

@@ -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"` // 所属用户

View File

@@ -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 {

View File

@@ -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

View File

@@ -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",

View File

@@ -36,11 +36,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
@@ -102,7 +102,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

View File

@@ -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

View File

@@ -216,8 +216,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
@@ -406,7 +406,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

View File

@@ -58,11 +58,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")
@@ -122,13 +123,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)
}
}
@@ -136,11 +146,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,
})
}

View File

@@ -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

View File

@@ -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) {