merge: 合并代码20241031
This commit is contained in:
@@ -3,6 +3,7 @@ package features
|
|||||||
import (
|
import (
|
||||||
"be.ems/features/cm"
|
"be.ems/features/cm"
|
||||||
"be.ems/features/lm"
|
"be.ems/features/lm"
|
||||||
|
"be.ems/features/nbi"
|
||||||
"be.ems/features/pm"
|
"be.ems/features/pm"
|
||||||
"be.ems/lib/log"
|
"be.ems/lib/log"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
@@ -12,10 +13,10 @@ func InitServiceEngine(r *gin.Engine) {
|
|||||||
log.Info("======init feature group gin.Engine")
|
log.Info("======init feature group gin.Engine")
|
||||||
|
|
||||||
// featuresGroup := r.Group("/")
|
// featuresGroup := r.Group("/")
|
||||||
// 注册 各个features 模块的路由
|
// register features routers
|
||||||
pm.InitSubServiceRoute(r)
|
pm.InitSubServiceRoute(r)
|
||||||
lm.InitSubServiceRoute(r)
|
lm.InitSubServiceRoute(r)
|
||||||
cm.InitSubServiceRoute(r)
|
cm.InitSubServiceRoute(r)
|
||||||
|
nbi.InitSubServiceRoute(r)
|
||||||
// return featuresGroup
|
// return featuresGroup
|
||||||
}
|
}
|
||||||
|
|||||||
257
features/nbi/file/controller.go
Normal file
257
features/nbi/file/controller.go
Normal file
@@ -0,0 +1,257 @@
|
|||||||
|
package nbi_file
|
||||||
|
|
||||||
|
import (
|
||||||
|
"archive/zip"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"net/http"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"be.ems/lib/dborm"
|
||||||
|
"be.ems/lib/file"
|
||||||
|
"be.ems/lib/global"
|
||||||
|
"be.ems/lib/log"
|
||||||
|
"be.ems/lib/services"
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
)
|
||||||
|
|
||||||
|
type SysJobResponse struct {
|
||||||
|
SysJob
|
||||||
|
TableName string `json:"tableName"`
|
||||||
|
TableDisplay string `json:"tableDisplay"`
|
||||||
|
FilePath string `json:"filePath"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type TargetParams struct {
|
||||||
|
Duration int `json:"duration"`
|
||||||
|
TableName string `json:"tableName"`
|
||||||
|
Columns string `json:"columns"` // exported column name of time string
|
||||||
|
TimeCol string `json:"timeCol"` // time stamp of column name
|
||||||
|
TimeUnit string `json:"timeUnit"` // timestamp unit: second/micro/milli
|
||||||
|
Extras string `json:"extras"` // extras condition for where
|
||||||
|
FilePath string `json:"filePath"` // file path
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *FileNBI) GetFileList(c *gin.Context) {
|
||||||
|
var querys FileNBIQuery
|
||||||
|
|
||||||
|
querys.Category = c.Param("category")
|
||||||
|
querys.Type = c.Param("type")
|
||||||
|
if err := c.ShouldBindQuery(&querys); err != nil {
|
||||||
|
c.JSON(http.StatusOK, services.ErrResp(err.Error()))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if querys.Path == "" {
|
||||||
|
tableName := ""
|
||||||
|
ok := false
|
||||||
|
switch querys.Category {
|
||||||
|
case "cdr":
|
||||||
|
tableName, ok = CDRTableMapper[querys.Type]
|
||||||
|
if tableName == "" || !ok {
|
||||||
|
c.JSON(http.StatusOK, services.ErrResp(fmt.Sprintf("invalid CDR file type: %s", querys.Type)))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
case "log":
|
||||||
|
tableName, ok = LogTableMapper[querys.Type]
|
||||||
|
if tableName == "" || !ok {
|
||||||
|
c.JSON(http.StatusOK, services.ErrResp(fmt.Sprintf("invalid log file type: %s", querys.Type)))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
c.JSON(http.StatusOK, services.ErrResp(fmt.Sprintf("invalid log file category: %s", querys.Category)))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
s := SysJob{}
|
||||||
|
where := fmt.Sprintf("invoke_target='%s' and status=1 and JSON_UNQUOTE(JSON_EXTRACT(target_params,'$.tableName'))='%s'", INVOKE_FILE_EXPORT, tableName)
|
||||||
|
_, err := dborm.XEngDB().Table(s.TableName()).
|
||||||
|
Select("JSON_UNQUOTE(JSON_EXTRACT(target_params, '$.filePath')) as file_path").
|
||||||
|
Where(where).
|
||||||
|
Get(&querys.Path)
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(http.StatusOK, services.ErrResp(err.Error()))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
files, err := file.GetFileInfo(querys.Path, querys.Suffix)
|
||||||
|
if err != nil {
|
||||||
|
log.Error("failed to GetFileInfo:", err)
|
||||||
|
c.JSON(http.StatusOK, services.ErrResp(err.Error()))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// split files list
|
||||||
|
lenNum := int64(len(files))
|
||||||
|
start := (querys.PageNum - 1) * querys.PageSize
|
||||||
|
end := start + querys.PageSize
|
||||||
|
var splitList []file.FileInfo
|
||||||
|
if start >= lenNum {
|
||||||
|
splitList = []file.FileInfo{}
|
||||||
|
} else if end >= lenNum {
|
||||||
|
splitList = files[start:]
|
||||||
|
} else {
|
||||||
|
splitList = files[start:end]
|
||||||
|
}
|
||||||
|
total := len(files)
|
||||||
|
c.JSON(http.StatusOK, services.TotalDataResp(splitList, total))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *FileNBI) Total(c *gin.Context) {
|
||||||
|
dir := c.Query("path")
|
||||||
|
|
||||||
|
fileCount, dirCount, err := file.GetFileAndDirCount(dir)
|
||||||
|
if err != nil {
|
||||||
|
log.Error("failed to GetFileAndDirCount:", err)
|
||||||
|
c.JSON(http.StatusOK, services.ErrResp(err.Error()))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
total := fileCount + dirCount
|
||||||
|
c.JSON(http.StatusOK, services.TotalResp(int64(total)))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *FileNBI) GetSingleFileHandler(c *gin.Context) {
|
||||||
|
var querys FileNBIQuery
|
||||||
|
|
||||||
|
querys.Category = c.Param("category")
|
||||||
|
querys.Type = c.Param("type")
|
||||||
|
querys.DateIndex = c.Param("dateIndex")
|
||||||
|
if err := c.ShouldBindQuery(&querys); err != nil {
|
||||||
|
c.JSON(http.StatusOK, services.ErrResp(err.Error()))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
tableName := ""
|
||||||
|
if querys.Path == "" {
|
||||||
|
ok := false
|
||||||
|
switch querys.Category {
|
||||||
|
case "cdr":
|
||||||
|
tableName, ok = CDRTableMapper[querys.Type]
|
||||||
|
if tableName == "" || !ok {
|
||||||
|
c.JSON(http.StatusOK, services.ErrResp(fmt.Sprintf("invalid CDR file type: %s", querys.Type)))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
case "log":
|
||||||
|
tableName, ok = LogTableMapper[querys.Type]
|
||||||
|
if tableName == "" || !ok {
|
||||||
|
c.JSON(http.StatusOK, services.ErrResp(fmt.Sprintf("invalid log file type: %s", querys.Type)))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
c.JSON(http.StatusOK, services.ErrResp(fmt.Sprintf("invalid log file category: %s", querys.Category)))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
s := SysJob{}
|
||||||
|
where := fmt.Sprintf("invoke_target='%s' and status=1 and JSON_UNQUOTE(JSON_EXTRACT(target_params,'$.tableName'))='%s'", INVOKE_FILE_EXPORT, tableName)
|
||||||
|
_, err := dborm.XEngDB().Table(s.TableName()).
|
||||||
|
Select("JSON_UNQUOTE(JSON_EXTRACT(target_params, '$.filePath')) as file_path").
|
||||||
|
Where(where).
|
||||||
|
Get(&querys.Path)
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(http.StatusOK, services.ErrResp(err.Error()))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fileName := tableName + "_export_" + querys.DateIndex + "0000" + ".csv"
|
||||||
|
filePath := filepath.Join(querys.Path, fileName)
|
||||||
|
|
||||||
|
file, err := os.Open(filePath)
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(http.StatusOK, services.ErrResp(err.Error()))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
defer file.Close()
|
||||||
|
|
||||||
|
if _, err := os.Stat(filePath); os.IsNotExist(err) {
|
||||||
|
c.JSON(http.StatusOK, services.ErrResp(err.Error()))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
c.Header("Content-Disposition", "attachment; filename="+fileName)
|
||||||
|
c.Header("Content-Type", "application/octet-stream")
|
||||||
|
c.File(filePath)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *FileNBI) GetMultiFileHandler(c *gin.Context) {
|
||||||
|
var querys FileNBIQuery
|
||||||
|
|
||||||
|
querys.Category = c.Param("category")
|
||||||
|
querys.Type = c.Param("type")
|
||||||
|
if err := c.ShouldBindQuery(&querys); err != nil {
|
||||||
|
c.JSON(http.StatusOK, services.ErrResp(err.Error()))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
tableName := ""
|
||||||
|
if querys.Path == "" {
|
||||||
|
ok := false
|
||||||
|
switch querys.Category {
|
||||||
|
case "cdr":
|
||||||
|
tableName, ok = CDRTableMapper[querys.Type]
|
||||||
|
if tableName == "" || !ok {
|
||||||
|
c.JSON(http.StatusOK, services.ErrResp(fmt.Sprintf("invalid CDR file type: %s", querys.Type)))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
case "log":
|
||||||
|
tableName, ok = LogTableMapper[querys.Type]
|
||||||
|
if tableName == "" || !ok {
|
||||||
|
c.JSON(http.StatusOK, services.ErrResp(fmt.Sprintf("invalid log file type: %s", querys.Type)))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
c.JSON(http.StatusOK, services.ErrResp(fmt.Sprintf("invalid log file category: %s", querys.Category)))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
s := SysJob{}
|
||||||
|
where := fmt.Sprintf("invoke_target='%s' and status=1 and JSON_UNQUOTE(JSON_EXTRACT(target_params,'$.tableName'))='%s'", INVOKE_FILE_EXPORT, tableName)
|
||||||
|
_, err := dborm.XEngDB().Table(s.TableName()).
|
||||||
|
Select("JSON_UNQUOTE(JSON_EXTRACT(target_params, '$.filePath')) as file_path").
|
||||||
|
Where(where).
|
||||||
|
Get(&querys.Path)
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(http.StatusOK, services.ErrResp(err.Error()))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
zipWriter := zip.NewWriter(c.Writer)
|
||||||
|
defer zipWriter.Close()
|
||||||
|
|
||||||
|
for _, fileName := range querys.FileNames {
|
||||||
|
filePath := filepath.Join(querys.Path, fileName)
|
||||||
|
|
||||||
|
file, err := os.Open(filePath)
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(http.StatusOK, services.ErrResp(err.Error()))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
defer file.Close()
|
||||||
|
|
||||||
|
if _, err := os.Stat(filePath); os.IsNotExist(err) {
|
||||||
|
c.JSON(http.StatusOK, services.ErrResp(err.Error()))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
writer, err := zipWriter.Create(filepath.Base(fileName))
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(http.StatusOK, services.ErrResp(err.Error()))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err := io.Copy(writer, file); err != nil {
|
||||||
|
c.JSON(http.StatusOK, services.ErrResp(err.Error()))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
zipFile := tableName + "_export_" + time.Now().Local().Format(global.DateData) + ".zip"
|
||||||
|
c.Header("Content-Disposition", "attachment; filename="+zipFile)
|
||||||
|
c.Header("Content-Type", "application/zip")
|
||||||
|
//c.File(filePath)
|
||||||
|
}
|
||||||
47
features/nbi/file/model.go
Normal file
47
features/nbi/file/model.go
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
package nbi_file
|
||||||
|
|
||||||
|
import (
|
||||||
|
"be.ems/lib/file"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
INVOKE_FILE_EXPORT = "exportTable"
|
||||||
|
)
|
||||||
|
|
||||||
|
var CDRTableMapper map[string]string = map[string]string{
|
||||||
|
"ims": "cdr_event_ims",
|
||||||
|
"smf": "cdr_event_smf",
|
||||||
|
"smsc": "cdr_event_smsc",
|
||||||
|
"sms": "cdr_event_smsc",
|
||||||
|
}
|
||||||
|
|
||||||
|
var LogTableMapper map[string]string = map[string]string{
|
||||||
|
"operate": "sys_log_operate",
|
||||||
|
"security": "sys_log_login",
|
||||||
|
"alarm": "alarm_log",
|
||||||
|
}
|
||||||
|
|
||||||
|
type SysJob struct {
|
||||||
|
JobID int64 `gorm:"column:job_id;primary_key;auto_increment" json:"job_id"` //任务ID
|
||||||
|
InvokeTarget string `gorm:"column:invoke_target" json:"invoke_target"` //调用目标字符串
|
||||||
|
TargetParams string `gorm:"column:target_params;type:json" json:"target_params,omitempty"` //调用目标传入参数
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *SysJob) TableName() string {
|
||||||
|
return "sys_job"
|
||||||
|
}
|
||||||
|
|
||||||
|
type FileNBI struct {
|
||||||
|
file.FileInfo
|
||||||
|
}
|
||||||
|
|
||||||
|
type FileNBIQuery struct {
|
||||||
|
Category string `form:"category" binding:"required"`
|
||||||
|
Type string `form:"type" binding:"required"`
|
||||||
|
DateIndex string `form:"dateIndex"`
|
||||||
|
Path string `json:"path" form:"path"`
|
||||||
|
FileNames []string `json:"fileName" form:"fileName"`
|
||||||
|
Suffix string `form:"suffix"`
|
||||||
|
PageNum int64 `form:"pageNum"`
|
||||||
|
PageSize int64 `form:"pageSize"`
|
||||||
|
}
|
||||||
26
features/nbi/file/route.go
Normal file
26
features/nbi/file/route.go
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
package nbi_file
|
||||||
|
|
||||||
|
import (
|
||||||
|
"be.ems/src/framework/middleware"
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Register Routes for file_export
|
||||||
|
func Register(r *gin.RouterGroup) {
|
||||||
|
fileNBI := r.Group("/file")
|
||||||
|
{
|
||||||
|
var f *FileNBI
|
||||||
|
fileNBI.GET("/:category/:type/list",
|
||||||
|
middleware.PreAuthorize(nil),
|
||||||
|
f.GetFileList,
|
||||||
|
)
|
||||||
|
fileNBI.GET("/:category/:type/:dateIndex",
|
||||||
|
middleware.PreAuthorize(nil),
|
||||||
|
f.GetSingleFileHandler,
|
||||||
|
)
|
||||||
|
fileNBI.GET("/:category/:type",
|
||||||
|
middleware.PreAuthorize(nil),
|
||||||
|
f.GetMultiFileHandler,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,7 +15,6 @@ import (
|
|||||||
"be.ems/lib/log"
|
"be.ems/lib/log"
|
||||||
"be.ems/lib/oauth"
|
"be.ems/lib/oauth"
|
||||||
"be.ems/lib/services"
|
"be.ems/lib/services"
|
||||||
"be.ems/lib/session"
|
|
||||||
"be.ems/restagent/config"
|
"be.ems/restagent/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -35,7 +34,7 @@ type ApiResponse struct {
|
|||||||
ResultMessage interface{}
|
ResultMessage interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
var globalSession = session.NewSessManager("restagent")
|
//var globalSession = session.NewSessManager("restagent")
|
||||||
|
|
||||||
var (
|
var (
|
||||||
MAX_RMUID_NUM int
|
MAX_RMUID_NUM int
|
||||||
|
|||||||
16
features/nbi/service.go
Normal file
16
features/nbi/service.go
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
// log management package
|
||||||
|
|
||||||
|
package nbi
|
||||||
|
|
||||||
|
import (
|
||||||
|
nbi_file "be.ems/features/nbi/file"
|
||||||
|
"be.ems/lib/log"
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
)
|
||||||
|
|
||||||
|
func InitSubServiceRoute(r *gin.Engine) {
|
||||||
|
log.Info("======init North-Bound Interface group gin.Engine")
|
||||||
|
|
||||||
|
nbiGroup := r.Group("/nbi")
|
||||||
|
nbi_file.Register(nbiGroup)
|
||||||
|
}
|
||||||
@@ -54,28 +54,28 @@ func GetNRMByUri(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
// error processing ...
|
// error processing ...
|
||||||
// 401-1 response
|
// 401-1 response
|
||||||
token, ret := globalSession.IsCarriedToken(r)
|
// token, ret := globalSession.IsCarriedToken(r)
|
||||||
if ret == false {
|
// if ret == false {
|
||||||
log.Error("AccessToken is not carried")
|
// log.Error("AccessToken is not carried")
|
||||||
services.ResponseUnauthorized401AccessTokenNotCarried(w)
|
// services.ResponseUnauthorized401AccessTokenNotCarried(w)
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 401-2 response
|
// 401-2 response
|
||||||
if globalSession.IsValidToken(token) == false {
|
// if globalSession.IsValidToken(token) == false {
|
||||||
log.Error("AccessToken fails or does not exist")
|
// log.Error("AccessToken fails or does not exist")
|
||||||
services.ResponseUnauthorized401AccessTokenNotExist(w)
|
// services.ResponseUnauthorized401AccessTokenNotExist(w)
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
// response 403 Forbidden, permissions deny
|
// response 403 Forbidden, permissions deny
|
||||||
// todo...
|
// todo...
|
||||||
plist := globalSession.GetPermissionFromSession(token)
|
// plist := globalSession.GetPermissionFromSession(token)
|
||||||
log.Debug("permission list:", plist)
|
// log.Debug("permission list:", plist)
|
||||||
if len(plist) == 0 || plist[0] == false {
|
// if len(plist) == 0 || plist[0] == false {
|
||||||
log.Error("User permission deny")
|
// log.Error("User permission deny")
|
||||||
services.ResponseForbidden403NotPermission(w)
|
// services.ResponseForbidden403NotPermission(w)
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
|
|
||||||
vars := mux.Vars(r)
|
vars := mux.Vars(r)
|
||||||
qeuryUri := vars["apiCategory"] + "/" + vars["elementTypeValue"] + "/" + vars["objectTypeValue"]
|
qeuryUri := vars["apiCategory"] + "/" + vars["elementTypeValue"] + "/" + vars["objectTypeValue"]
|
||||||
|
|||||||
186
go.mod
186
go.mod
@@ -2,152 +2,130 @@ module be.ems
|
|||||||
|
|
||||||
go 1.21
|
go 1.21
|
||||||
|
|
||||||
toolchain go1.21.0
|
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible
|
github.com/dlclark/regexp2 v1.11.4
|
||||||
github.com/dlclark/regexp2 v1.10.0
|
github.com/dustin/go-humanize v1.0.0
|
||||||
github.com/gin-gonic/gin v1.9.1
|
github.com/gin-gonic/gin v1.10.0
|
||||||
github.com/go-admin-team/go-admin-core/sdk v1.5.1
|
github.com/go-resty/resty/v2 v2.14.0
|
||||||
github.com/go-resty/resty/v2 v2.7.0
|
github.com/go-sql-driver/mysql v1.8.1
|
||||||
github.com/go-sql-driver/mysql v1.7.1
|
github.com/golang-jwt/jwt/v5 v5.2.1
|
||||||
github.com/golang-jwt/jwt/v5 v5.0.0
|
github.com/gopacket/gopacket v1.2.0
|
||||||
github.com/gorilla/mux v1.8.0
|
github.com/gorilla/mux v1.8.1
|
||||||
github.com/gorilla/websocket v1.5.0
|
github.com/gorilla/websocket v1.5.3
|
||||||
github.com/gosnmp/gosnmp v1.35.0
|
github.com/gosnmp/gosnmp v1.38.0
|
||||||
github.com/jasonlvhit/gocron v0.0.1
|
github.com/jasonlvhit/gocron v0.0.1
|
||||||
github.com/lestrrat/go-file-rotatelogs v0.0.0-20180223000712-d3151e2a480f
|
github.com/lestrrat/go-file-rotatelogs v0.0.0-20180223000712-d3151e2a480f
|
||||||
github.com/linxGnu/gosmpp v0.2.0
|
github.com/linxGnu/gosmpp v0.3.0
|
||||||
github.com/matoous/go-nanoid/v2 v2.0.0
|
github.com/matoous/go-nanoid/v2 v2.1.0
|
||||||
github.com/metaleap/go-xsd v0.0.0-20180330193350-61f7638f502f
|
github.com/metaleap/go-xsd v0.0.0-20180330193350-61f7638f502f
|
||||||
github.com/mojocn/base64Captcha v1.3.5
|
github.com/mojocn/base64Captcha v1.3.6
|
||||||
github.com/mssola/user_agent v0.6.0
|
github.com/mssola/useragent v1.0.0
|
||||||
github.com/patrickmn/go-cache v2.1.0+incompatible
|
github.com/patrickmn/go-cache v2.1.0+incompatible
|
||||||
github.com/prometheus-community/pro-bing v0.4.0
|
github.com/pkg/sftp v1.13.6
|
||||||
github.com/redis/go-redis/v9 v9.1.0
|
github.com/prometheus-community/pro-bing v0.4.1
|
||||||
github.com/reiver/go-telnet v0.0.0-20180421082511-9ff0b2ab096e
|
github.com/redis/go-redis/v9 v9.6.1
|
||||||
github.com/robfig/cron/v3 v3.0.1
|
github.com/robfig/cron/v3 v3.0.1
|
||||||
github.com/shirou/gopsutil v3.21.11+incompatible
|
github.com/shirou/gopsutil/v4 v4.24.7
|
||||||
github.com/shirou/gopsutil/v3 v3.23.7
|
github.com/slayercat/GoSNMPServer v0.5.2
|
||||||
github.com/spf13/afero v1.9.5
|
github.com/spf13/pflag v1.0.5
|
||||||
github.com/spf13/viper v1.16.0
|
github.com/spf13/viper v1.19.0
|
||||||
github.com/xuri/excelize/v2 v2.7.1
|
github.com/xuri/excelize/v2 v2.8.1
|
||||||
github.com/xuri/xgen v0.0.0-20230702070049-db840e1a4605
|
github.com/xuri/xgen v0.0.0-20240722131518-d0691b701898
|
||||||
github.com/ziutek/telnet v0.0.0-20180329124119-c3b780dc415b
|
golang.org/x/crypto v0.26.0
|
||||||
golang.org/x/crypto v0.19.0
|
golang.org/x/net v0.28.0
|
||||||
golang.org/x/term v0.17.0
|
golang.org/x/term v0.23.0
|
||||||
|
golang.org/x/text v0.17.0
|
||||||
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
|
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
|
||||||
gopkg.in/yaml.v3 v3.0.1
|
gopkg.in/yaml.v3 v3.0.1
|
||||||
gorm.io/driver/mysql v1.5.1
|
gorm.io/driver/mysql v1.5.7
|
||||||
gorm.io/gorm v1.25.2
|
gorm.io/gorm v1.25.11
|
||||||
xorm.io/xorm v1.3.2
|
xorm.io/xorm v1.3.9
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
filippo.io/edwards25519 v1.1.0 // indirect
|
||||||
github.com/beorn7/perks v1.0.1 // indirect
|
github.com/beorn7/perks v1.0.1 // indirect
|
||||||
github.com/creack/pty v1.1.9 // indirect
|
github.com/bytedance/sonic v1.12.1 // indirect
|
||||||
github.com/go-admin-team/go-admin-core v1.3.12-0.20221121065133-27b7dbe27a8f // indirect
|
github.com/bytedance/sonic/loader v0.2.0 // indirect
|
||||||
github.com/kr/fs v0.1.0 // indirect
|
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||||
github.com/prometheus/client_model v0.5.0 // indirect
|
|
||||||
github.com/prometheus/common v0.48.0 // indirect
|
|
||||||
github.com/prometheus/procfs v0.12.0 // indirect
|
|
||||||
golang.org/x/sync v0.6.0 // indirect
|
|
||||||
)
|
|
||||||
|
|
||||||
require (
|
|
||||||
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible // indirect
|
|
||||||
github.com/bsm/redislock v0.8.2 // indirect
|
|
||||||
github.com/bytedance/go-tagexpr/v2 v2.7.12 // indirect
|
|
||||||
github.com/bytedance/sonic v1.9.1 // indirect
|
|
||||||
github.com/casbin/casbin/v2 v2.54.0 // indirect
|
|
||||||
github.com/cespare/xxhash/v2 v2.2.0 // indirect
|
|
||||||
github.com/chanxuehong/rand v0.0.0-20201110082127-2f19a1bdd973 // indirect
|
|
||||||
github.com/chanxuehong/wechat v0.0.0-20201110083048-0180211b69fd // indirect
|
|
||||||
github.com/chenjiandongx/ginprom v0.0.0-20210617023641-6c809602c38a
|
github.com/chenjiandongx/ginprom v0.0.0-20210617023641-6c809602c38a
|
||||||
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
|
github.com/cloudwego/base64x v0.1.4 // indirect
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.3 // indirect
|
github.com/cloudwego/iasm v0.2.0 // indirect
|
||||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
|
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
|
||||||
github.com/fastly/go-utils v0.0.0-20180712184237-d95a45783239 // indirect
|
github.com/fastly/go-utils v0.0.0-20180712184237-d95a45783239 // indirect
|
||||||
github.com/fatih/color v1.13.0 // indirect
|
github.com/fsnotify/fsnotify v1.7.0 // indirect
|
||||||
github.com/fsnotify/fsnotify v1.6.0 // indirect
|
github.com/gabriel-vasile/mimetype v1.4.5 // indirect
|
||||||
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
|
|
||||||
github.com/gin-contrib/sse v0.1.0 // indirect
|
github.com/gin-contrib/sse v0.1.0 // indirect
|
||||||
github.com/git-chglog/git-chglog v0.0.0-20190611050339-63a4e637021f // indirect
|
|
||||||
github.com/go-admin-team/redisqueue/v2 v2.0.0-20221119141731-97c556b0d5b7 // indirect
|
|
||||||
github.com/go-forks/fsnotify v1.4.7 // indirect
|
github.com/go-forks/fsnotify v1.4.7 // indirect
|
||||||
github.com/go-ole/go-ole v1.2.6 // indirect
|
github.com/go-ole/go-ole v1.3.0 // indirect
|
||||||
github.com/go-playground/locales v0.14.1 // indirect
|
github.com/go-playground/locales v0.14.1 // indirect
|
||||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||||
github.com/go-playground/validator/v10 v10.14.0 // indirect
|
github.com/go-playground/validator/v10 v10.22.0 // indirect
|
||||||
github.com/go-redis/redis/v8 v8.11.5 // indirect
|
github.com/goccy/go-json v0.10.3 // indirect
|
||||||
github.com/go-redis/redis/v9 v9.0.0-rc.1 // indirect
|
|
||||||
github.com/goccy/go-json v0.10.2
|
|
||||||
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
|
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
|
||||||
github.com/golang/protobuf v1.5.3 // indirect
|
|
||||||
github.com/golang/snappy v0.0.4 // indirect
|
github.com/golang/snappy v0.0.4 // indirect
|
||||||
github.com/google/uuid v1.6.0 // indirect
|
github.com/google/uuid v1.6.0 // indirect
|
||||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||||
github.com/henrylee2cn/ameda v1.4.10 // indirect
|
|
||||||
github.com/henrylee2cn/goutil v0.0.0-20210127050712-89660552f6f8 // indirect
|
|
||||||
github.com/imdario/mergo v0.3.9 // indirect
|
|
||||||
github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869 // indirect
|
github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869 // indirect
|
||||||
github.com/jinzhu/inflection v1.0.0 // indirect
|
github.com/jinzhu/inflection v1.0.0 // indirect
|
||||||
github.com/jinzhu/now v1.1.5 // indirect
|
github.com/jinzhu/now v1.1.5 // indirect
|
||||||
|
github.com/jonboulle/clockwork v0.4.0 // indirect
|
||||||
github.com/json-iterator/go v1.1.12 // indirect
|
github.com/json-iterator/go v1.1.12 // indirect
|
||||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
|
github.com/klauspost/compress v1.17.9 // indirect
|
||||||
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
|
github.com/klauspost/cpuid/v2 v2.2.8 // indirect
|
||||||
github.com/leodido/go-urn v1.2.4 // indirect
|
github.com/konsorten/go-windows-terminal-sequences v1.0.1 // indirect
|
||||||
|
github.com/kr/fs v0.1.0 // indirect
|
||||||
|
github.com/leodido/go-urn v1.4.0 // indirect
|
||||||
github.com/lestrrat/go-envload v0.0.0-20180220120943-6ed08b54a570 // indirect
|
github.com/lestrrat/go-envload v0.0.0-20180220120943-6ed08b54a570 // indirect
|
||||||
github.com/lestrrat/go-strftime v0.0.0-20180220042222-ba3bf9c1d042 // indirect
|
github.com/lestrrat/go-strftime v0.0.0-20180220042222-ba3bf9c1d042 // indirect
|
||||||
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
|
github.com/lufia/plan9stats v0.0.0-20240513124658-fba389f38bae // indirect
|
||||||
github.com/magiconair/properties v1.8.7 // indirect
|
github.com/magiconair/properties v1.8.7 // indirect
|
||||||
github.com/mattn/go-colorable v0.1.12 // indirect
|
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.19 // indirect
|
|
||||||
github.com/mattn/goveralls v0.0.2 // indirect
|
|
||||||
github.com/metaleap/go-util v0.0.0-20180330192724-a09253046f73 // indirect
|
github.com/metaleap/go-util v0.0.0-20180330192724-a09253046f73 // indirect
|
||||||
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect
|
|
||||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||||
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
|
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
|
||||||
github.com/nsqio/go-nsq v1.0.8 // indirect
|
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||||
github.com/nyaruka/phonenumbers v1.0.55 // indirect
|
github.com/onsi/ginkgo v1.16.5 // indirect
|
||||||
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
|
github.com/onsi/gomega v1.21.1 // indirect
|
||||||
|
github.com/orcaman/concurrent-map/v2 v2.0.1 // indirect
|
||||||
|
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
|
||||||
github.com/pkg/errors v0.9.1 // indirect
|
github.com/pkg/errors v0.9.1 // indirect
|
||||||
github.com/pkg/sftp v1.13.6
|
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
|
||||||
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
|
github.com/prometheus/client_golang v1.20.0
|
||||||
github.com/prometheus/client_golang v1.19.1
|
github.com/prometheus/client_model v0.6.1 // indirect
|
||||||
github.com/reiver/go-oi v1.0.0 // indirect
|
github.com/prometheus/common v0.55.0 // indirect
|
||||||
|
github.com/prometheus/procfs v0.15.1 // indirect
|
||||||
github.com/richardlehane/mscfb v1.0.4 // indirect
|
github.com/richardlehane/mscfb v1.0.4 // indirect
|
||||||
github.com/richardlehane/msoleps v1.0.3 // indirect
|
github.com/richardlehane/msoleps v1.0.3 // indirect
|
||||||
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
github.com/sagikazarmark/locafero v0.6.0 // indirect
|
||||||
|
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
|
||||||
|
github.com/shirou/gopsutil/v3 v3.23.11 // indirect
|
||||||
github.com/shoenig/go-m1cpu v0.1.6 // indirect
|
github.com/shoenig/go-m1cpu v0.1.6 // indirect
|
||||||
github.com/spf13/cast v1.5.1 // indirect
|
github.com/sirupsen/logrus v1.4.2 // indirect
|
||||||
github.com/spf13/jwalterweatherman v1.1.0 // indirect
|
github.com/sourcegraph/conc v0.3.0 // indirect
|
||||||
github.com/spf13/pflag v1.0.5
|
github.com/spf13/afero v1.11.0 // indirect
|
||||||
github.com/subosito/gotenv v1.4.2 // indirect
|
github.com/spf13/cast v1.7.0 // indirect
|
||||||
|
github.com/subosito/gotenv v1.6.0 // indirect
|
||||||
github.com/syndtr/goleveldb v1.0.0 // indirect
|
github.com/syndtr/goleveldb v1.0.0 // indirect
|
||||||
github.com/tebeka/strftime v0.1.5 // indirect
|
github.com/tebeka/strftime v0.1.5 // indirect
|
||||||
github.com/tklauser/go-sysconf v0.3.11 // indirect
|
github.com/tklauser/go-sysconf v0.3.14 // indirect
|
||||||
github.com/tklauser/numcpus v0.6.0 // indirect
|
github.com/tklauser/numcpus v0.8.0 // indirect
|
||||||
github.com/tsuyoshiwada/go-gitcmd v0.0.0-20180205145712-5f1f5f9475df // indirect
|
|
||||||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
||||||
github.com/ugorji/go/codec v1.2.11 // indirect
|
github.com/ugorji/go/codec v1.2.12 // indirect
|
||||||
github.com/urfave/cli v1.22.1 // indirect
|
github.com/xuri/efp v0.0.0-20240408161823-9ad904a10d6d // indirect
|
||||||
github.com/xuri/efp v0.0.0-20220603152613-6918739fd470 // indirect
|
github.com/xuri/nfp v0.0.0-20240318013403-ab9948c2c4a7 // indirect
|
||||||
github.com/xuri/nfp v0.0.0-20220409054826-5e722a1d9e22 // indirect
|
github.com/yusufpapurcu/wmi v1.2.4 // indirect
|
||||||
github.com/yusufpapurcu/wmi v1.2.3 // indirect
|
go.uber.org/multierr v1.11.0 // indirect
|
||||||
golang.org/x/arch v0.3.0 // indirect
|
golang.org/x/arch v0.9.0 // indirect
|
||||||
golang.org/x/image v0.5.0 // indirect
|
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa // indirect
|
||||||
golang.org/x/net v0.21.0
|
golang.org/x/image v0.19.0 // indirect
|
||||||
golang.org/x/sys v0.17.0 // indirect
|
golang.org/x/sync v0.8.0 // indirect
|
||||||
golang.org/x/text v0.14.0
|
golang.org/x/sys v0.24.0 // indirect
|
||||||
golang.org/x/tools v0.16.1 // indirect
|
golang.org/x/tools/cmd/guru v0.1.1-deprecated // indirect
|
||||||
google.golang.org/protobuf v1.33.0 // indirect
|
google.golang.org/protobuf v1.34.2 // indirect
|
||||||
gopkg.in/AlecAivazis/survey.v1 v1.8.5 // indirect
|
|
||||||
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
|
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
|
||||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||||
gopkg.in/kyokomi/emoji.v1 v1.5.1 // indirect
|
xorm.io/builder v0.3.13 // indirect
|
||||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
|
||||||
xorm.io/builder v0.3.11-0.20220531020008-1bd24a7dc978 // indirect
|
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -9,14 +9,15 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type FileInfo struct {
|
type FileInfo struct {
|
||||||
FileType string `json:"fileType"` // 文件类型
|
FileType string `json:"fileType"` // file type: file/directory
|
||||||
FileMode string `json:"fileMode"` // 文件的权限
|
FileMode string `json:"fileMode"` // file mode
|
||||||
LinkCount int64 `json:"linkCount"` // 硬链接数目
|
LinkCount int64 `json:"linkCount"` // link count
|
||||||
Owner string `json:"owner"` // 所属用户
|
Owner string `json:"owner"` // owner
|
||||||
Group string `json:"group"` // 所属组
|
Group string `json:"group"` // group
|
||||||
Size int64 `json:"size"` // 文件的大小
|
Size int64 `json:"size"` // size: xx byte
|
||||||
ModifiedTime int64 `json:"modifiedTime"` // 最后修改时间,单位为秒
|
ModifiedTime int64 `json:"modifiedTime"` // last modified time:seconds
|
||||||
FileName string `json:"fileName"` // 文件的名称
|
FilePath string `json:"filePath"` // file path
|
||||||
|
FileName string `json:"fileName"` // file name
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetFileInfo(dir, suffix string) ([]FileInfo, error) {
|
func GetFileInfo(dir, suffix string) ([]FileInfo, error) {
|
||||||
@@ -48,6 +49,7 @@ func GetFileInfo(dir, suffix string) ([]FileInfo, error) {
|
|||||||
Group: "-",
|
Group: "-",
|
||||||
Size: info.Size(),
|
Size: info.Size(),
|
||||||
ModifiedTime: info.ModTime().Unix(),
|
ModifiedTime: info.ModTime().Unix(),
|
||||||
|
FilePath: dir,
|
||||||
FileName: info.Name(),
|
FileName: info.Name(),
|
||||||
}
|
}
|
||||||
files = append(files, fileInfo)
|
files = append(files, fileInfo)
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
# duration: rotation time with xx hours, example: 1/12/24 hours
|
# duration: rotation time with xx hours, example: 1/12/24 hours
|
||||||
# count: rotation count of log, default is 30 rotation
|
# count: rotation count of log, default is 30 rotation
|
||||||
logger:
|
logger:
|
||||||
file: d:/local.git/be.ems/restagent/log/restagent.log
|
file: d:/omc.git/be.ems/restagent/log/restagent.log
|
||||||
level: trace
|
level: trace
|
||||||
duration: 24
|
duration: 24
|
||||||
count: 2
|
count: 2
|
||||||
@@ -27,7 +27,7 @@ rest:
|
|||||||
|
|
||||||
webServer:
|
webServer:
|
||||||
enabled: false
|
enabled: false
|
||||||
rootDir: d:/local.git/fe.ems.vue3/dist
|
rootDir: d:/omc.git/fe.ems.vue3/dist
|
||||||
listen:
|
listen:
|
||||||
- addr: :80
|
- addr: :80
|
||||||
schema: http
|
schema: http
|
||||||
@@ -46,7 +46,7 @@ database:
|
|||||||
port: 33066
|
port: 33066
|
||||||
name: omc_db
|
name: omc_db
|
||||||
connParam: charset=utf8mb4&collation=utf8mb4_general_ci&parseTime=True&interpolateParams=True
|
connParam: charset=utf8mb4&collation=utf8mb4_general_ci&parseTime=True&interpolateParams=True
|
||||||
backup: d:/local.git/be.ems/restagent/database
|
backup: d:/omc.git/be.ems/restagent/database
|
||||||
|
|
||||||
# Redis 缓存数据,数据源声明全小写
|
# Redis 缓存数据,数据源声明全小写
|
||||||
redis:
|
redis:
|
||||||
@@ -113,8 +113,8 @@ omc:
|
|||||||
binDir: ./bin
|
binDir: ./bin
|
||||||
backup: ./backup
|
backup: ./backup
|
||||||
upload: ./upload
|
upload: ./upload
|
||||||
frontUpload: d:/local.git/fe.ems/upload
|
frontUpload: d:/omc.git/fe.ems/upload
|
||||||
frontTraceDir: d:/local.git/fe.ems/trace
|
frontTraceDir: d:/omc.git/fe.ems/trace
|
||||||
software: ./software
|
software: ./software
|
||||||
license: ./license
|
license: ./license
|
||||||
gtpUri: gtp:192.168.2.219:2152
|
gtpUri: gtp:192.168.2.219:2152
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
# count: rotation count of log, default is 30 rotation
|
# count: rotation count of log, default is 30 rotation
|
||||||
# pprof: false(default)/true to disable/enable pprof
|
# pprof: false(default)/true to disable/enable pprof
|
||||||
logger:
|
logger:
|
||||||
file: d:/local.git/be.ems/restagent/log/restagent.log
|
file: d:/omc.git/be.ems/restagent/log/restagent.log
|
||||||
level: trace
|
level: trace
|
||||||
duration: 24
|
duration: 24
|
||||||
count: 2
|
count: 2
|
||||||
@@ -20,11 +20,11 @@ pprof:
|
|||||||
rest:
|
rest:
|
||||||
- ipv4: 0.0.0.0
|
- ipv4: 0.0.0.0
|
||||||
ipv6:
|
ipv6:
|
||||||
port: 33030
|
port: 33040
|
||||||
|
|
||||||
webServer:
|
webServer:
|
||||||
enabled: true
|
enabled: false
|
||||||
rootDir: d:/local.git/fe.ems.vue3/dist
|
rootDir: d:/omc.git/fe.ems.vue3/dist
|
||||||
listen:
|
listen:
|
||||||
- addr: :80
|
- addr: :80
|
||||||
schema: http
|
schema: http
|
||||||
@@ -39,25 +39,25 @@ database:
|
|||||||
type: mysql
|
type: mysql
|
||||||
user: root
|
user: root
|
||||||
password: "1000omc@kp!"
|
password: "1000omc@kp!"
|
||||||
host: "127.0.0.1"
|
host: "192.168.9.58"
|
||||||
port: 33066
|
port: 13306
|
||||||
name: "omc_db"
|
name: "omc_db"
|
||||||
connParam: charset=utf8mb4&collation=utf8mb4_general_ci&parseTime=True&interpolateParams=True
|
connParam: charset=utf8mb4&collation=utf8mb4_general_ci&parseTime=True&interpolateParams=True
|
||||||
backup: d:/local.git/be.ems/restagent/database
|
backup: d:/omc.git/be.ems/restagent/database
|
||||||
|
|
||||||
# Redis data cache
|
# Redis data cache
|
||||||
redis:
|
redis:
|
||||||
dataSource:
|
dataSource:
|
||||||
# OMC system db
|
# OMC system db
|
||||||
default:
|
default:
|
||||||
port: 6379 # Redis port
|
port: 16379 # Redis port
|
||||||
host: "127.0.0.1" # Redis host
|
host: "192.168.9.58" # Redis host
|
||||||
password: "helloearth"
|
password: "helloearth"
|
||||||
db: 10 # Redis db_num
|
db: 10 # Redis db_num
|
||||||
# UDM sub/auth db
|
# UDM sub/auth db
|
||||||
udmuser:
|
udmuser:
|
||||||
port: 6379 # Redis port
|
port: 6379 # Redis port
|
||||||
host: "127.0.0.1"
|
host: "192.168.8.58"
|
||||||
password: "helloearth"
|
password: "helloearth"
|
||||||
db: 0 # Redis db_num
|
db: 0 # Redis db_num
|
||||||
# used to specify the default data source for multiple data resourece
|
# used to specify the default data source for multiple data resourece
|
||||||
@@ -66,21 +66,17 @@ redis:
|
|||||||
# sleep: time delay for after write buffer (millisecond)
|
# sleep: time delay for after write buffer (millisecond)
|
||||||
# deadLine: timeout for io read and write (second)
|
# deadLine: timeout for io read and write (second)
|
||||||
mml:
|
mml:
|
||||||
port: 4100
|
|
||||||
port2: 5002
|
|
||||||
sleep: 200
|
sleep: 200
|
||||||
deadLine: 10
|
deadLine: 10
|
||||||
sizeRow: 600
|
sizeRow: 600
|
||||||
sizeCol: 128
|
sizeCol: 128
|
||||||
bufferSize: 65535
|
bufferSize: 65535
|
||||||
user: admin
|
|
||||||
password: admin
|
|
||||||
mmlHome: ./mmlhome
|
mmlHome: ./mmlhome
|
||||||
|
|
||||||
# Tracking configuration
|
# Tracking configuration
|
||||||
trace:
|
trace:
|
||||||
enabled: true
|
enabled: true
|
||||||
host: "172.16.5.100" # Fill in the specific IP address
|
host: "192.168.5.58" # Fill in the specific IP address
|
||||||
port: 33033
|
port: 33033
|
||||||
|
|
||||||
# NE config
|
# NE config
|
||||||
@@ -194,12 +190,12 @@ testConfig:
|
|||||||
file: ./etc/testconfig.yaml
|
file: ./etc/testconfig.yaml
|
||||||
|
|
||||||
# 静态文件配置, 相对项目根路径或填绝对路径
|
# 静态文件配置, 相对项目根路径或填绝对路径
|
||||||
staticFile:
|
# staticFile:
|
||||||
# 默认资源,dir目录需要预先创建
|
# # 默认资源,dir目录需要预先创建
|
||||||
default:
|
# default:
|
||||||
prefix: "/static"
|
# prefix: "/static"
|
||||||
dir: "./static"
|
# dir: "./static"
|
||||||
# 文件上传资源目录映射,与项目目录同级
|
# # 文件上传资源目录映射,与项目目录同级
|
||||||
upload:
|
# upload:
|
||||||
prefix: "/upload"
|
# prefix: "/upload"
|
||||||
dir: "./upload"
|
# dir: "./upload"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# Makefile for rest agent project
|
# Makefile for rest agent project
|
||||||
|
|
||||||
PROJECT = OMC
|
PROJECT = OMC
|
||||||
VERSION = 2.2410.2
|
VERSION = 2.2410.3
|
||||||
PLATFORM = amd64
|
PLATFORM = amd64
|
||||||
ARMPLATFORM = aarch64
|
ARMPLATFORM = aarch64
|
||||||
BUILDDIR = ../../build
|
BUILDDIR = ../../build
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 42 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 16 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 24 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 48 KiB |
@@ -1,7 +1,7 @@
|
|||||||
# 项目信息
|
# 项目信息
|
||||||
framework:
|
framework:
|
||||||
name: "OMC"
|
name: "OMC"
|
||||||
version: "2.2410.2"
|
version: "2.2410.3"
|
||||||
|
|
||||||
# 应用服务配置
|
# 应用服务配置
|
||||||
server:
|
server:
|
||||||
|
|||||||
45
src/modules/crontask/processor/ne_data_udm/ne_data_udm.go
Normal file
45
src/modules/crontask/processor/ne_data_udm/ne_data_udm.go
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
package ne_data_udm
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"be.ems/src/framework/cron"
|
||||||
|
"be.ems/src/framework/logger"
|
||||||
|
neDataService "be.ems/src/modules/network_data/service"
|
||||||
|
neModel "be.ems/src/modules/network_element/model"
|
||||||
|
neService "be.ems/src/modules/network_element/service"
|
||||||
|
)
|
||||||
|
|
||||||
|
var NewProcessor = &NeDataUDM{
|
||||||
|
udmAuthService: neDataService.NewUDMAuthUser,
|
||||||
|
udmSubService: neDataService.NewUDMSubUser,
|
||||||
|
neInfoService: neService.NewNeInfo,
|
||||||
|
count: 0,
|
||||||
|
}
|
||||||
|
|
||||||
|
// NeDataUDM 网元配置文件定期备份
|
||||||
|
type NeDataUDM struct {
|
||||||
|
udmAuthService *neDataService.UDMAuthUser // UDM鉴权信息
|
||||||
|
udmSubService *neDataService.UDMSubUser // UDM签约信息
|
||||||
|
neInfoService *neService.NeInfo // 网元信息服务
|
||||||
|
count int // 执行次数
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *NeDataUDM) Execute(data any) (any, error) {
|
||||||
|
s.count++ // 执行次数加一
|
||||||
|
options := data.(cron.JobData)
|
||||||
|
sysJob := options.SysJob
|
||||||
|
logger.Infof("重复 %v 任务ID %s", options.Repeat, sysJob.JobID)
|
||||||
|
// 返回结果,用于记录执行结果
|
||||||
|
result := map[string]any{
|
||||||
|
"count": s.count,
|
||||||
|
}
|
||||||
|
|
||||||
|
neList := s.neInfoService.SelectList(neModel.NeInfo{NeType: "UDM"}, false, false)
|
||||||
|
for _, neInfo := range neList {
|
||||||
|
result[fmt.Sprintf("AuthNumber_%s", neInfo.NeId)] = s.udmAuthService.ResetData(neInfo.NeId)
|
||||||
|
result[fmt.Sprintf("SubNumber_%s", neInfo.NeId)] = s.udmSubService.ResetData(neInfo.NeId)
|
||||||
|
}
|
||||||
|
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
@@ -10,6 +10,7 @@ import (
|
|||||||
"be.ems/src/modules/crontask/processor/getStateFromNE"
|
"be.ems/src/modules/crontask/processor/getStateFromNE"
|
||||||
processorMonitorSysResource "be.ems/src/modules/crontask/processor/monitor_sys_resource"
|
processorMonitorSysResource "be.ems/src/modules/crontask/processor/monitor_sys_resource"
|
||||||
processorNeConfigBackup "be.ems/src/modules/crontask/processor/ne_config_backup"
|
processorNeConfigBackup "be.ems/src/modules/crontask/processor/ne_config_backup"
|
||||||
|
processorNeDataUDM "be.ems/src/modules/crontask/processor/ne_data_udm"
|
||||||
"be.ems/src/modules/crontask/processor/removeFile"
|
"be.ems/src/modules/crontask/processor/removeFile"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -19,6 +20,8 @@ func InitCronQueue() {
|
|||||||
cron.CreateQueue("monitor_sys_resource", processorMonitorSysResource.NewProcessor)
|
cron.CreateQueue("monitor_sys_resource", processorMonitorSysResource.NewProcessor)
|
||||||
// 网元-网元配置文件定期备份
|
// 网元-网元配置文件定期备份
|
||||||
cron.CreateQueue("ne_config_backup", processorNeConfigBackup.NewProcessor)
|
cron.CreateQueue("ne_config_backup", processorNeConfigBackup.NewProcessor)
|
||||||
|
// 网元数据-UDM数据刷新同步
|
||||||
|
cron.CreateQueue("ne_data_udm", processorNeDataUDM.NewProcessor)
|
||||||
// delete expired NE backup file
|
// delete expired NE backup file
|
||||||
cron.CreateQueue("delExpiredNeBackup", delExpiredNeBackup.NewProcessor)
|
cron.CreateQueue("delExpiredNeBackup", delExpiredNeBackup.NewProcessor)
|
||||||
cron.CreateQueue("deleteExpiredRecord", deleteExpiredRecord.NewProcessor)
|
cron.CreateQueue("deleteExpiredRecord", deleteExpiredRecord.NewProcessor)
|
||||||
|
|||||||
@@ -123,17 +123,30 @@ func (s *SMFController) CDRExport(c *gin.Context) {
|
|||||||
headerCells := map[string]string{
|
headerCells := map[string]string{
|
||||||
"A1": "ID",
|
"A1": "ID",
|
||||||
"B1": "Charging ID",
|
"B1": "Charging ID",
|
||||||
"C1": "Subscriber ID Data",
|
"C1": "NE Name",
|
||||||
"D1": "Subscriber ID Type",
|
"D1": "Resource Unique ID",
|
||||||
"E1": "Data Volume Uplink",
|
"E1": "Subscriber ID Data",
|
||||||
"F1": "Data Volume Downlink",
|
"F1": "Subscriber ID Type",
|
||||||
"G1": "Data Total Volume",
|
"G1": "Data Volume Uplink",
|
||||||
"H1": "Duration",
|
"H1": "Data Volume Downlink",
|
||||||
"I1": "Invocation Time",
|
"I1": "Data Total Volume",
|
||||||
"J1": "PDU Session Charging Information",
|
"J1": "Duration",
|
||||||
|
"K1": "Invocation Time",
|
||||||
|
"L1": "User Identifier",
|
||||||
|
"M1": "SSC Mode",
|
||||||
|
"N1": "DNN ID",
|
||||||
|
"O1": "PDU Type",
|
||||||
|
"P1": "RAT Type",
|
||||||
|
"Q1": "PDU IPv4 Address",
|
||||||
|
"R1": "Network Function IPv4",
|
||||||
|
"S1": "PDU IPv6 Address Swith Prefix",
|
||||||
|
"T1": "Record Network Function ID",
|
||||||
|
"U1": "Record Type",
|
||||||
|
"V1": "Record Opening Time",
|
||||||
}
|
}
|
||||||
// 从第二行开始的数据
|
// 从第二行开始的数据
|
||||||
dataCells := make([]map[string]any, 0)
|
dataCells := make([]map[string]any, 0)
|
||||||
|
|
||||||
for i, row := range rows {
|
for i, row := range rows {
|
||||||
idx := strconv.Itoa(i + 2)
|
idx := strconv.Itoa(i + 2)
|
||||||
// 解析 JSON 字符串为 map
|
// 解析 JSON 字符串为 map
|
||||||
@@ -158,12 +171,22 @@ func (s *SMFController) CDRExport(c *gin.Context) {
|
|||||||
subscriptionIDData = sub["subscriptionIDData"].(string)
|
subscriptionIDData = sub["subscriptionIDData"].(string)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 网络功能 IPv4 地址
|
||||||
|
networkFunctionIPv4Address := ""
|
||||||
|
if v, ok := cdrJSON["nFunctionConsumerInformation"]; ok && v != nil {
|
||||||
|
if conInfo, conInfoOk := v.(map[string]any); conInfoOk && conInfo != nil {
|
||||||
|
networkFunctionIPv4Address = conInfo["networkFunctionIPv4Address"].(string)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 数据量上行链路
|
// 数据量上行链路
|
||||||
dataVolumeUplink := []string{}
|
dataVolumeUplink := []string{}
|
||||||
// 数据量下行链路
|
// 数据量下行链路
|
||||||
dataVolumeDownlink := []string{}
|
dataVolumeDownlink := []string{}
|
||||||
// 数据总量
|
// 数据总量
|
||||||
dataTotalVolume := []string{}
|
dataTotalVolume := []string{}
|
||||||
|
|
||||||
if v, ok := cdrJSON["listOfMultipleUnitUsage"]; ok && v != nil {
|
if v, ok := cdrJSON["listOfMultipleUnitUsage"]; ok && v != nil {
|
||||||
usageList := v.([]any)
|
usageList := v.([]any)
|
||||||
if len(usageList) > 0 {
|
if len(usageList) > 0 {
|
||||||
@@ -198,32 +221,31 @@ func (s *SMFController) CDRExport(c *gin.Context) {
|
|||||||
invocationTimestamp = v.(string)
|
invocationTimestamp = v.(string)
|
||||||
}
|
}
|
||||||
// 记录打开时间
|
// 记录打开时间
|
||||||
pduSessionChargingInformation := ""
|
User_Identifier := ""
|
||||||
|
SSC_Mode := ""
|
||||||
|
RAT_Type := ""
|
||||||
|
DNN_ID := ""
|
||||||
|
PDU_Type := ""
|
||||||
|
PDU_IPv4 := ""
|
||||||
|
PDU_IPv6 := ""
|
||||||
if v, ok := cdrJSON["pDUSessionChargingInformation"]; ok && v != nil {
|
if v, ok := cdrJSON["pDUSessionChargingInformation"]; ok && v != nil {
|
||||||
pduInfo := v.(map[string]any)
|
pduInfo := v.(map[string]any)
|
||||||
|
|
||||||
User_Identifier := ""
|
|
||||||
if v, ok := pduInfo["userIdentifier"]; ok && v != nil {
|
if v, ok := pduInfo["userIdentifier"]; ok && v != nil {
|
||||||
User_Identifier = v.(string)
|
User_Identifier = v.(string)
|
||||||
}
|
}
|
||||||
SSC_Mode := ""
|
|
||||||
if v, ok := pduInfo["sSCMode"]; ok && v != nil {
|
if v, ok := pduInfo["sSCMode"]; ok && v != nil {
|
||||||
SSC_Mode = v.(string)
|
SSC_Mode = v.(string)
|
||||||
}
|
}
|
||||||
RAT_Type := ""
|
|
||||||
if v, ok := pduInfo["rATType"]; ok && v != nil {
|
if v, ok := pduInfo["rATType"]; ok && v != nil {
|
||||||
RAT_Type = v.(string)
|
RAT_Type = v.(string)
|
||||||
}
|
}
|
||||||
DNN_ID := ""
|
|
||||||
if v, ok := pduInfo["dNNID"]; ok && v != nil {
|
if v, ok := pduInfo["dNNID"]; ok && v != nil {
|
||||||
DNN_ID = v.(string)
|
DNN_ID = v.(string)
|
||||||
}
|
}
|
||||||
PDU_Type := ""
|
|
||||||
if v, ok := pduInfo["pDUType"]; ok && v != nil {
|
if v, ok := pduInfo["pDUType"]; ok && v != nil {
|
||||||
PDU_Type = v.(string)
|
PDU_Type = v.(string)
|
||||||
}
|
}
|
||||||
PDU_IPv4 := ""
|
|
||||||
PDU_IPv6 := ""
|
|
||||||
if v, ok := pduInfo["pDUAddress"]; ok && v != nil {
|
if v, ok := pduInfo["pDUAddress"]; ok && v != nil {
|
||||||
pDUAddress := v.(map[string]any)
|
pDUAddress := v.(map[string]any)
|
||||||
if addr, ok := pDUAddress["pDUIPv4Address"]; ok && addr != nil {
|
if addr, ok := pDUAddress["pDUIPv4Address"]; ok && addr != nil {
|
||||||
@@ -234,24 +256,54 @@ func (s *SMFController) CDRExport(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pduSessionChargingInformation = fmt.Sprintf(`User Identifier: %s
|
// pduSessionChargingInformation = fmt.Sprintf(`User Identifier: %s
|
||||||
SSC Mode: %s RAT Type: %s DNN ID: %s
|
// SSC Mode: %s RAT Type: %s DNN ID: %s
|
||||||
PDU Type: %s
|
// PDU Type: %s
|
||||||
PDU IPv4 Address: %s
|
// PDU IPv4 Address: %s
|
||||||
PDU IPv6 Addres Swith Prefix: %s`, User_Identifier, SSC_Mode, RAT_Type, DNN_ID, PDU_Type, PDU_IPv4, PDU_IPv6)
|
// PDU IPv6 Addres Swith Prefix: %s`, User_Identifier, SSC_Mode, RAT_Type, DNN_ID, PDU_Type, PDU_IPv4, PDU_IPv6)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 记录网络参数ID
|
||||||
|
recordNFID := ""
|
||||||
|
if v, ok := cdrJSON["recordingNetworkFunctionID"]; ok && v != nil {
|
||||||
|
recordNFID = v.(string)
|
||||||
|
}
|
||||||
|
|
||||||
|
//记录开始时间
|
||||||
|
recordOpeningTime := ""
|
||||||
|
if v, ok := cdrJSON["recordOpeningTime"]; ok && v != nil {
|
||||||
|
recordOpeningTime = v.(string)
|
||||||
|
}
|
||||||
|
|
||||||
|
//记录类型
|
||||||
|
recordType := ""
|
||||||
|
if v, ok := cdrJSON["recordType"]; ok && v != nil {
|
||||||
|
recordType = v.(string)
|
||||||
}
|
}
|
||||||
|
|
||||||
dataCells = append(dataCells, map[string]any{
|
dataCells = append(dataCells, map[string]any{
|
||||||
"A" + idx: row.ID,
|
"A" + idx: row.ID,
|
||||||
"B" + idx: chargingID,
|
"B" + idx: chargingID,
|
||||||
"C" + idx: subscriptionIDData,
|
"C" + idx: row.NeName,
|
||||||
"D" + idx: subscriptionIDType,
|
"D" + idx: row.RmUID,
|
||||||
"E" + idx: strings.Join(dataVolumeUplink, ","),
|
"E" + idx: subscriptionIDData,
|
||||||
"F" + idx: strings.Join(dataVolumeDownlink, ","),
|
"F" + idx: subscriptionIDType,
|
||||||
"G" + idx: strings.Join(dataTotalVolume, ","),
|
"G" + idx: strings.Join(dataVolumeUplink, ","),
|
||||||
"H" + idx: duration,
|
"H" + idx: strings.Join(dataVolumeDownlink, ","),
|
||||||
"I" + idx: invocationTimestamp,
|
"I" + idx: strings.Join(dataTotalVolume, ","),
|
||||||
"J" + idx: pduSessionChargingInformation,
|
"J" + idx: duration,
|
||||||
|
"K" + idx: invocationTimestamp,
|
||||||
|
"L" + idx: User_Identifier,
|
||||||
|
"M" + idx: SSC_Mode,
|
||||||
|
"N" + idx: DNN_ID,
|
||||||
|
"O" + idx: PDU_Type,
|
||||||
|
"P" + idx: RAT_Type,
|
||||||
|
"Q" + idx: PDU_IPv4,
|
||||||
|
"R" + idx: networkFunctionIPv4Address,
|
||||||
|
"S" + idx: PDU_IPv6,
|
||||||
|
"T" + idx: recordNFID,
|
||||||
|
"U" + idx: recordType,
|
||||||
|
"V" + idx: recordOpeningTime,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -381,7 +381,7 @@ func (s *UDMAuthController) Export(c *gin.Context) {
|
|||||||
|
|
||||||
// 文件名
|
// 文件名
|
||||||
fileName := fmt.Sprintf("udm_auth_user_export_%s_%d.%s", neId, time.Now().UnixMilli(), fileType)
|
fileName := fmt.Sprintf("udm_auth_user_export_%s_%d.%s", neId, time.Now().UnixMilli(), fileType)
|
||||||
filePath := fmt.Sprintf("%s/%s", file.ParseUploadFileDir(uploadsubpath.EXPORT), fileName)
|
filePath := filepath.Join(file.ParseUploadFileDir(uploadsubpath.EXPORT), fileName)
|
||||||
|
|
||||||
if fileType == "csv" {
|
if fileType == "csv" {
|
||||||
// 转换数据
|
// 转换数据
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import (
|
|||||||
|
|
||||||
// 实例化控制层 UDMSubController 结构体
|
// 实例化控制层 UDMSubController 结构体
|
||||||
var NewUDMSub = &UDMSubController{
|
var NewUDMSub = &UDMSubController{
|
||||||
udmSubService: neDataService.NewUDMSub,
|
udmSubService: neDataService.NewUDMSubUser,
|
||||||
neInfoService: neService.NewNeInfo,
|
neInfoService: neService.NewNeInfo,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -386,7 +386,7 @@ func (s *UDMSubController) Export(c *gin.Context) {
|
|||||||
|
|
||||||
// 文件名
|
// 文件名
|
||||||
fileName := fmt.Sprintf("udm_sub_user_export_%s_%d.%s", neId, time.Now().UnixMilli(), fileType)
|
fileName := fmt.Sprintf("udm_sub_user_export_%s_%d.%s", neId, time.Now().UnixMilli(), fileType)
|
||||||
filePath := fmt.Sprintf("%s/%s", file.ParseUploadFileDir(uploadsubpath.EXPORT), fileName)
|
filePath := filepath.Join(file.ParseUploadFileDir(uploadsubpath.EXPORT), fileName)
|
||||||
|
|
||||||
if fileType == "csv" {
|
if fileType == "csv" {
|
||||||
// 转换数据
|
// 转换数据
|
||||||
|
|||||||
@@ -74,6 +74,13 @@ func (r *UDMAuthUser) SelectPage(query map[string]any) map[string]any {
|
|||||||
conditions = append(conditions, "ne_id = ?")
|
conditions = append(conditions, "ne_id = ?")
|
||||||
params = append(params, v)
|
params = append(params, v)
|
||||||
}
|
}
|
||||||
|
if v, ok := query["imsis"]; ok && v != "" {
|
||||||
|
placeholder := repo.KeyPlaceholderByQuery(len(v.([]any)))
|
||||||
|
conditions = append(conditions, fmt.Sprintf("imsi in (%s)", placeholder))
|
||||||
|
for _, v := range v.([]any) {
|
||||||
|
params = append(params, v.(string))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 构建查询条件语句
|
// 构建查询条件语句
|
||||||
whereSql := ""
|
whereSql := ""
|
||||||
|
|||||||
@@ -110,6 +110,13 @@ func (r *UDMSubUser) SelectPage(query map[string]any) map[string]any {
|
|||||||
conditions = append(conditions, "ne_id = ?")
|
conditions = append(conditions, "ne_id = ?")
|
||||||
params = append(params, v)
|
params = append(params, v)
|
||||||
}
|
}
|
||||||
|
if v, ok := query["imsis"]; ok && v != "" {
|
||||||
|
placeholder := repo.KeyPlaceholderByQuery(len(v.([]any)))
|
||||||
|
conditions = append(conditions, fmt.Sprintf("imsi in (%s)", placeholder))
|
||||||
|
for _, v := range v.([]any) {
|
||||||
|
params = append(params, v.(string))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 构建查询条件语句
|
// 构建查询条件语句
|
||||||
whereSql := ""
|
whereSql := ""
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// 实例化服务层 UDMSubUser 结构体
|
// 实例化服务层 UDMSubUser 结构体
|
||||||
var NewUDMSub = &UDMSubUser{
|
var NewUDMSubUser = &UDMSubUser{
|
||||||
udmSubRepository: repository.NewUDMSub,
|
udmSubRepository: repository.NewUDMSub,
|
||||||
udmUserInfoRepository: repository.NewUDMUserInfo,
|
udmUserInfoRepository: repository.NewUDMUserInfo,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,6 +49,8 @@ func NeState(neInfo model.NeInfo) (map[string]any, error) {
|
|||||||
"capability": resData["capability"],
|
"capability": resData["capability"],
|
||||||
"sn": resData["serialNum"],
|
"sn": resData["serialNum"],
|
||||||
"expire": resData["expiryDate"],
|
"expire": resData["expiryDate"],
|
||||||
|
"hostname": resData["hostName"],
|
||||||
|
"os": resData["osInfo"],
|
||||||
"cpu": resData["cpuUsage"],
|
"cpu": resData["cpuUsage"],
|
||||||
"mem": resData["memUsage"],
|
"mem": resData["memUsage"],
|
||||||
"disk": resData["diskSpace"],
|
"disk": resData["diskSpace"],
|
||||||
|
|||||||
@@ -21,15 +21,15 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
// 数据库
|
// 数据库
|
||||||
DbHost = "127.0.0.1"
|
DbHost = "192.168.9.58"
|
||||||
DbPort = 33066
|
DbPort = 13306
|
||||||
DbUser = "root"
|
DbUser = "root"
|
||||||
DbPassswd = "1000omc@kp!"
|
DbPassswd = "1000omc@kp!"
|
||||||
DbName = "omc_db"
|
DbName = "omc_db"
|
||||||
// 配置文件路径
|
// 配置文件路径
|
||||||
configParamDir = "../../../config/param"
|
configParamDir = "../../../config/param"
|
||||||
// configParamFile = "*" // 目录下全部更新
|
// configParamFile = "*" // 目录下全部更新
|
||||||
configParamFile = "omc_param_config.yaml" // 单文件更新
|
configParamFile = "smf_param_config.yaml" // 单文件更新
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestConfig(t *testing.T) {
|
func TestConfig(t *testing.T) {
|
||||||
|
|||||||
@@ -657,11 +657,40 @@ func (r *NeVersion) operateDome(action string, neVersion model.NeVersion) error
|
|||||||
if neInfo.NeId != neVersion.NeId {
|
if neInfo.NeId != neVersion.NeId {
|
||||||
return fmt.Errorf("error found neinfo")
|
return fmt.Errorf("error found neinfo")
|
||||||
}
|
}
|
||||||
|
|
||||||
// ========= 网元OAM配置文件 start ==========
|
// ========= 网元OAM配置文件 start ==========
|
||||||
if err := NewNeInfo.NeConfOAMWirteSync(neInfo, nil, true); err != nil {
|
if err := NewNeInfo.NeConfOAMWirteSync(neInfo, nil, true); err != nil {
|
||||||
return fmt.Errorf("error wirte OAM file info")
|
return fmt.Errorf("error wirte OAM file info")
|
||||||
}
|
}
|
||||||
// ========= 网元OAM配置文件 end ===========
|
// ========= 网元OAM配置文件 end ===========
|
||||||
|
|
||||||
|
// SMSC配置修改IMS和UDM 配置
|
||||||
|
if neInfo.NeType == "SMSC" {
|
||||||
|
para5GData := NewNeInfo.Para5GData
|
||||||
|
mnc_mcc := fmt.Sprintf("mnc%s.mcc%s", para5GData["MNC_DOMAIN"], para5GData["MCC"])
|
||||||
|
smscHost := fmt.Sprintf("%s smsc.ims.%s.3gppnetwork.org", para5GData["SMSC_IP"], mnc_mcc)
|
||||||
|
smscHostCMD := fmt.Sprintf("grep -qxF '%s' /etc/hosts || echo '%s' | sudo tee -a /etc/hosts \n", smscHost, smscHost)
|
||||||
|
smscIPCMD := fmt.Sprintf("grep -qxF '%s smsc' /etc/hosts || echo '%s smsc' | sudo tee -a /etc/hosts \n", para5GData["SMSC_IP"], para5GData["SMSC_IP"])
|
||||||
|
// IMS 配置
|
||||||
|
imsNEs := NewNeInfo.SelectList(model.NeInfo{NeType: "IMS"}, false, false)
|
||||||
|
for _, v := range imsNEs {
|
||||||
|
NewNeInfo.NeRunSSHCmd(v.NeType, v.NeId, smscIPCMD)
|
||||||
|
NewNeInfo.NeRunSSHCmd(v.NeType, v.NeId, smscHostCMD)
|
||||||
|
NewNeInfo.NeRunSSHCmd(v.NeType, v.NeId, "sudo sed -i '/^#!define WITH_SMS/ s/^/#/' /usr/local/etc/ims/vars.cfg")
|
||||||
|
NewNeInfo.NeRunSSHCmd(v.NeType, v.NeId, "ims-stop || true && ims-start")
|
||||||
|
}
|
||||||
|
// UDM 配置
|
||||||
|
smscASName := fmt.Sprintf("sudo sed -i '/- name: sms_as/{n;s|serverName: .*|serverName: sip:%s:5060|}' /usr/local/etc/udm/as.yaml", para5GData["SMSC_IP"])
|
||||||
|
smscASAddress := fmt.Sprintf("sudo sed -i '/- name: sms_as/{n;s|diameterAddress: .*|diameterAddress: smsc.ims.%s.3gppnetwork.org|}' /usr/local/etc/udm/as.yaml", mnc_mcc)
|
||||||
|
udmNEs := NewNeInfo.SelectList(model.NeInfo{NeType: "UDM"}, false, false)
|
||||||
|
for _, v := range udmNEs {
|
||||||
|
NewNeInfo.NeRunSSHCmd(v.NeType, v.NeId, smscIPCMD)
|
||||||
|
NewNeInfo.NeRunSSHCmd(v.NeType, v.NeId, smscHostCMD)
|
||||||
|
NewNeInfo.NeRunSSHCmd(v.NeType, v.NeId, smscASName)
|
||||||
|
NewNeInfo.NeRunSSHCmd(v.NeType, v.NeId, smscASAddress)
|
||||||
|
NewNeInfo.NeRunSSHCmd(v.NeType, v.NeId, "sudo service udm restart")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新Version
|
// 更新Version
|
||||||
|
|||||||
Reference in New Issue
Block a user