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

This commit is contained in:
TsMask
2025-01-24 20:49:26 +08:00
66 changed files with 16618 additions and 196 deletions

View File

@@ -35,11 +35,11 @@ type NeActionController struct {
//
// POST /pushFile
//
// @Tags network_element
// @Tags network_element/action
// @Accept json
// @Produce json
// @Success 200 {object} map[string]any{} "data"
// @Security ApiKeyAuth
// @Success 200 {object} object "Response Results"
// @Security TokenAuth
// @Summary Sending files from local to network elements
// @Description Sending files from local to network elements
// @Router /ne/action/pushFile [post]
@@ -100,6 +100,15 @@ func (s *NeActionController) PushFile(c *gin.Context) {
// 从网元到本地获取文件
//
// GET /pullFile
//
// @Tags network_element/action
// @Accept json
// @Produce json
// @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
// @Router /ne/action/pullFile [get]
func (s *NeActionController) PullFile(c *gin.Context) {
language := ctx.AcceptLanguage(c)
var querys struct {
@@ -159,6 +168,15 @@ func (s *NeActionController) PullFile(c *gin.Context) {
// 从网元到本地获取目录压缩为ZIP
//
// GET /pullDirZip
//
// @Tags network_element/action
// @Accept json
// @Produce json
// @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
// @Router /ne/action/pullDirZip [get]
func (s *NeActionController) PullDirZip(c *gin.Context) {
language := ctx.AcceptLanguage(c)
var querys struct {
@@ -226,6 +244,15 @@ func (s *NeActionController) PullDirZip(c *gin.Context) {
// 查看网元端文件内容
//
// GET /viewFile
//
// @Tags network_element/action
// @Accept json
// @Produce json
// @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
// @Router /ne/action/viewFile [get]
func (s *NeActionController) ViewFile(c *gin.Context) {
language := ctx.AcceptLanguage(c)
var querys struct {
@@ -269,6 +296,15 @@ func (s *NeActionController) ViewFile(c *gin.Context) {
// 网元端文件列表
//
// GET /files
//
// @Tags network_element/action
// @Accept json
// @Produce json
// @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
// @Router /ne/action/files [get]
func (s *NeActionController) Files(c *gin.Context) {
language := ctx.AcceptLanguage(c)
var querys struct {
@@ -333,6 +369,15 @@ func (s *NeActionController) Files(c *gin.Context) {
// 网元服务操作
//
// PUT /service
//
// @Tags network_element/action
// @Accept json
// @Produce json
// @Success 200 {object} object "Response Results"
// @Security TokenAuth
// @Summary Network element service operation
// @Description Network element service operation
// @Router /ne/action/service [put]
func (s *NeActionController) Service(c *gin.Context) {
language := ctx.AcceptLanguage(c)
var body struct {

View File

@@ -157,6 +157,16 @@ func (s *NeConfigController) Remove(c *gin.Context) {
// 网元参数配置可用属性值列表指定网元类型全部无分页
//
// GET /list/:neType
//
// @Tags network_element/config
// @Accept json
// @Produce json
// @Param neType path string true "NE Type" Enums(IMS,AMF,AUSF,UDM,SMF,PCF,NSSF,NRF,UPF,MME,CBC,OMC,SGWC)
// @Success 200 {object} object "Response Results"
// @Security TokenAuth
// @Summary Network Element Parameter Configuration Available Attribute Values List Specify Network Element Type All Unpaged
// @Description Network Element Parameter Configuration Available Attribute Values List Specify Network Element Type All Unpaged
// @Router /ne/config/list/{neType} [get]
func (s *NeConfigController) ListByNeType(c *gin.Context) {
language := ctx.AcceptLanguage(c)
neType := c.Param("neType")
@@ -171,6 +181,18 @@ func (s *NeConfigController) ListByNeType(c *gin.Context) {
// 网元参数配置数据信息
//
// GET /data
//
// @Tags network_element/config
// @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 neId query string true "NE ID" default(001)
// @Param paramName query string true "Available attributes, based on querying the list of attributes"
// @Success 200 {object} object "Response Results"
// @Security TokenAuth
// @Summary Network Element Parameter Configuration Data Information
// @Description Network Element Parameter Configuration Data Information
// @Router /ne/config/data [get]
func (s *NeConfigController) DataInfo(c *gin.Context) {
language := ctx.AcceptLanguage(c)
var query struct {
@@ -213,6 +235,16 @@ func (s *NeConfigController) DataInfo(c *gin.Context) {
// 网元参数配置数据修改
//
// PUT /data
//
// @Tags network_element/config
// @Accept json
// @Produce json
// @Param data body object true "Request Param"
// @Success 200 {object} object "Response Results"
// @Security TokenAuth
// @Summary Network element parameter configuration data modification
// @Description Network element parameter configuration data modification
// @Router /ne/config/data [put]
func (s *NeConfigController) DataEdit(c *gin.Context) {
language := ctx.AcceptLanguage(c)
var body struct {
@@ -255,6 +287,16 @@ func (s *NeConfigController) DataEdit(c *gin.Context) {
// 网元参数配置数据新增array
//
// POST /data
//
// @Tags network_element/config
// @Accept json
// @Produce json
// @Param data body object true "Request Param"
// @Success 200 {object} object "Response Results"
// @Security TokenAuth
// @Summary Network element parameter configuration data added (array)
// @Description Network element parameter configuration data added (array)
// @Router /ne/config/data [post]
func (s *NeConfigController) DataAdd(c *gin.Context) {
language := ctx.AcceptLanguage(c)
var body struct {
@@ -300,6 +342,19 @@ func (s *NeConfigController) DataAdd(c *gin.Context) {
// 网元参数配置数据删除array
//
// DELETE /data
//
// @Tags network_element/config
// @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 neId query string true "NE ID" default(001)
// @Param paramName query string true "Available attributes, based on querying the list of attributes"
// @Param loc query string true "Array index"
// @Success 200 {object} object "Response Results"
// @Security TokenAuth
// @Summary Network element parameter configuration data deletion (array)
// @Description Network element parameter configuration data deletion (array)
// @Router /ne/config/data [delete]
func (s *NeConfigController) DataRemove(c *gin.Context) {
language := ctx.AcceptLanguage(c)
var query struct {

View File

@@ -171,6 +171,16 @@ func (s *NeHostController) Remove(c *gin.Context) {
// 网元主机测试连接
//
// POST /test
//
// @Tags network_element/host
// @Accept json
// @Produce json
// @Param data body object true "Request Param"
// @Success 200 {object} object "Response Results"
// @Security TokenAuth
// @Summary Network element host test connection
// @Description Network element host test connection
// @Router /ne/host/test [post]
func (s *NeHostController) Test(c *gin.Context) {
language := ctx.AcceptLanguage(c)
var body model.NeHost
@@ -239,6 +249,16 @@ func (s *NeHostController) Test(c *gin.Context) {
// 网元主机发送命令
//
// POST /cmd
//
// @Tags network_element/host
// @Accept json
// @Produce json
// @Param data body object true "Request Param"
// @Success 200 {object} object "Response Results"
// @Security TokenAuth
// @Summary The network element host sends the command
// @Description The network element host sends the command
// @Router /ne/host/cmd [post]
func (s *NeHostController) Cmd(c *gin.Context) {
language := ctx.AcceptLanguage(c)
var body struct {
@@ -311,6 +331,16 @@ func (s *NeHostController) Cmd(c *gin.Context) {
// 网元主机SSH方式检查服务器环境
//
// POST /checkBySSH
//
// @Tags network_element/host
// @Accept json
// @Produce json
// @Param data body object true "Request Param"
// @Success 200 {object} object "Response Results"
// @Security TokenAuth
// @Summary Checking the server environment by SSH method of Net Element Hosting
// @Description Checking the server environment by SSH method of Net Element Hosting
// @Router /ne/host/checkBySSH [post]
func (s *NeHostController) CheckBySSH(c *gin.Context) {
language := ctx.AcceptLanguage(c)
var body model.NeHost
@@ -402,6 +432,16 @@ func (s *NeHostController) CheckBySSH(c *gin.Context) {
// 网元主机SSH方式授权免密发送
//
// POST /authorizedBySSH
//
// @Tags network_element/host
// @Accept json
// @Produce json
// @Param data body object true "Request Param"
// @Success 200 {object} object "Response Results"
// @Security TokenAuth
// @Summary Network element host SSH method of authorization for password-free sending
// @Description Network element host SSH method of authorization for password-free sending
// @Router /ne/host/authorizedBySSH [post]
func (s *NeHostController) AuthorizedBySSH(c *gin.Context) {
language := ctx.AcceptLanguage(c)
var body model.NeHost

View File

@@ -12,8 +12,8 @@ import (
neFetchlink "be.ems/src/modules/network_element/fetch_link"
"be.ems/src/modules/network_element/model"
neService "be.ems/src/modules/network_element/service"
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin/binding"
)
// 实例化控制层 NeInfoController 结构体
@@ -39,6 +39,17 @@ var mutex sync.Mutex
// 网元信息状态
//
// GET /state
//
// @Tags network_element/info
// @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 neId query string true "NE ID" default(001)
// @Success 200 {object} object "Response Results"
// @Security TokenAuth
// @Summary Network element information state
// @Description Network element information state
// @Router /ne/info/state [get]
func (s *NeInfoController) State(c *gin.Context) {
language := ctx.AcceptLanguage(c)
var querys struct {
@@ -91,6 +102,17 @@ func (s *NeInfoController) State(c *gin.Context) {
// 网元neType和neID查询
//
// GET /byTypeAndID
//
// @Tags network_element/info
// @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 neId query string true "NE ID" default(001)
// @Success 200 {object} object "Response Results"
// @Security TokenAuth
// @Summary Network element neType and neID queries
// @Description Network element neType and neID queries
// @Router /ne/info/byTypeAndID [get]
func (s *NeInfoController) NeTypeAndID(c *gin.Context) {
language := ctx.AcceptLanguage(c)
var querys struct {
@@ -113,6 +135,19 @@ func (s *NeInfoController) NeTypeAndID(c *gin.Context) {
// 网元信息列表全部无分页
//
// GET /listAll
//
// @Tags network_element/info
// @Accept json
// @Produce json
// @Param neType query string true "NE Type"
// @Param neId query string true "NE ID" default(001)
// @Param bandStatus query boolean true "With status information"
// @Param bandHost query boolean true "With host information"
// @Success 200 {object} object "Response Results"
// @Security TokenAuth
// @Summary The list of network element information is all unpaginated
// @Description The list of network element information is all unpaginated
// @Router /ne/info/listAll [get]
func (s *NeInfoController) ListAll(c *gin.Context) {
language := ctx.AcceptLanguage(c)
var querys struct {
@@ -163,7 +198,7 @@ func (s *NeInfoController) Para5GFileWrite(c *gin.Context) {
Content map[string]any `json:"content" binding:"required"` // 内容
SyncNE []string `json:"syncNe"` // 同步到网元
}
if err := c.ShouldBindBodyWith(&body, binding.JSON); err != nil {
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
c.JSON(400, result.CodeMsg(400, i18n.TKey(language, "app.common.err400")))
return
}
@@ -209,7 +244,7 @@ func (s *NeInfoController) OAMFileWrite(c *gin.Context) {
Content map[string]any `json:"content" binding:"required"` // 内容
Sync bool `json:"sync"` // 同步到网元
}
if err := c.ShouldBindBodyWith(&body, binding.JSON); err != nil {
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
c.JSON(400, result.CodeMsg(400, i18n.TKey(language, "app.common.err400")))
return
}
@@ -232,6 +267,20 @@ func (s *NeInfoController) OAMFileWrite(c *gin.Context) {
// 网元信息列表
//
// GET /list
//
// @Tags network_element/info
// @Accept json
// @Produce json
// @Param bandStatus query boolean false "The result carries the state of the network element"
// @Param neId query string false "NE ID"
// @Param neType query string false "Ne Type"
// @Param pageNum query number true "pageNum" default(1)
// @Param pageSize query number true "pageSize" default(10)
// @Success 200 {object} object "Response Results"
// @Security TokenAuth
// @Summary Network element information list
// @Description Network element information list
// @Router /ne/info/list [get]
func (s *NeInfoController) List(c *gin.Context) {
query := ctx.QueryMapString(c)
bandStatus := false
@@ -245,6 +294,16 @@ func (s *NeInfoController) List(c *gin.Context) {
// 网元信息
//
// GET /:infoId
//
// @Tags network_element/info
// @Accept json
// @Produce json
// @Param value path string true "Row ID"
// @Success 200 {object} object "Response Results"
// @Security TokenAuth
// @Summary Network element information
// @Description Network element information
// @Router /ne/info/{value} [get]
func (s *NeInfoController) Info(c *gin.Context) {
language := ctx.AcceptLanguage(c)
infoId := c.Param("infoId")
@@ -266,10 +325,20 @@ func (s *NeInfoController) Info(c *gin.Context) {
// 网元信息新增
//
// POST /
//
// @Tags network_element/info
// @Accept json
// @Produce json
// @Param data body object true "Request Param"
// @Success 200 {object} object "Response Results"
// @Security TokenAuth
// @Summary Network element information addition
// @Description Network element information addition
// @Router /ne/info [post]
func (s *NeInfoController) Add(c *gin.Context) {
language := ctx.AcceptLanguage(c)
var body model.NeInfo
err := c.ShouldBindBodyWith(&body, binding.JSON)
err := c.ShouldBindBodyWithJSON(&body)
if err != nil || body.ID != "" {
c.JSON(400, result.CodeMsg(400, i18n.TKey(language, "app.common.err400")))
return
@@ -344,10 +413,20 @@ func (s *NeInfoController) Add(c *gin.Context) {
// 网元信息修改
//
// PUT /
//
// @Tags network_element/info
// @Accept json
// @Produce json
// @Param data body object true "Request Param"
// @Success 200 {object} object "Response Results"
// @Security TokenAuth
// @Summary Network element information modification
// @Description Network element information modification
// @Router /ne/info [put]
func (s *NeInfoController) Edit(c *gin.Context) {
language := ctx.AcceptLanguage(c)
var body model.NeInfo
err := c.ShouldBindBodyWith(&body, binding.JSON)
err := c.ShouldBindBodyWithJSON(&body)
if err != nil || body.ID == "" {
c.JSON(400, result.CodeMsg(400, i18n.TKey(language, "app.common.err400")))
return
@@ -442,6 +521,16 @@ func (s *NeInfoController) Edit(c *gin.Context) {
// 网元信息删除
//
// DELETE /:infoIds
//
// @Tags network_element/info
// @Accept json
// @Produce json
// @Param value path string true "Row ID, multiple separated by a , sign"
// @Success 200 {object} object "Response Results"
// @Security TokenAuth
// @Summary Network element information deletion
// @Description Network element information deletion
// @Router /ne/info/{value} [delete]
func (s *NeInfoController) Remove(c *gin.Context) {
language := ctx.AcceptLanguage(c)
infoIds := c.Param("infoIds")

View File

@@ -3,14 +3,14 @@ package controller
import (
"fmt"
"github.com/gin-gonic/gin"
"be.ems/src/framework/i18n"
"be.ems/src/framework/utils/ctx"
"be.ems/src/framework/vo/result"
neFetchlink "be.ems/src/modules/network_element/fetch_link"
"be.ems/src/modules/network_element/model"
neService "be.ems/src/modules/network_element/service"
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin/binding"
)
// 实例化控制层 NeLicenseController 结构体
@@ -30,6 +30,17 @@ type NeLicenseController struct {
// 网元授权激活列表
//
// GET /list
//
// @Tags network_element/license
// @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 neId query string true "NE ID" default(001)
// @Success 200 {object} object "Response Results"
// @Security TokenAuth
// @Summary Net Element License Activation List
// @Description Net Element License Activation List
// @Router /ne/license/list [get]
func (s *NeLicenseController) List(c *gin.Context) {
querys := ctx.QueryMap(c)
data := s.neLicenseService.SelectPage(querys)
@@ -69,6 +80,17 @@ func (s *NeLicenseController) Info(c *gin.Context) {
// 网元neType和neID查询
//
// GET /byTypeAndID
//
// @Tags network_element/license
// @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 neId query string true "NE ID" default(001)
// @Success 200 {object} object "Response Results"
// @Security TokenAuth
// @Summary Network element neType and neID queries
// @Description Network element neType and neID queries
// @Router /ne/license/byTypeAndID [get]
func (s *NeLicenseController) NeTypeAndID(c *gin.Context) {
language := ctx.AcceptLanguage(c)
var querys struct {
@@ -93,6 +115,17 @@ func (s *NeLicenseController) NeTypeAndID(c *gin.Context) {
// 网元授权激活授权申请码
//
// GET /code
//
// @Tags network_element/license
// @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 neId query string true "NE ID" default(001)
// @Success 200 {object} object "Response Results"
// @Security TokenAuth
// @Summary Network Element License Activation License Application Code
// @Description Network Element License Activation License Application Code
// @Router /ne/license/code [get]
func (s *NeLicenseController) Code(c *gin.Context) {
language := ctx.AcceptLanguage(c)
var querys struct {
@@ -131,10 +164,20 @@ func (s *NeLicenseController) Code(c *gin.Context) {
// 网元授权激活授权文件替换
//
// POST /change
//
// @Tags network_element/license
// @Accept json
// @Produce json
// @Param data body object true "Request Param"
// @Success 200 {object} object "Response Results"
// @Security TokenAuth
// @Summary Network element authorization activation status
// @Description Network element authorization activation status
// @Router /ne/license/change [post]
func (s *NeLicenseController) Change(c *gin.Context) {
language := ctx.AcceptLanguage(c)
var body model.NeLicense
err := c.ShouldBindBodyWith(&body, binding.JSON)
err := c.ShouldBindBodyWithJSON(&body)
if err != nil || body.LicensePath == "" {
c.JSON(400, result.CodeMsg(400, i18n.TKey(language, "app.common.err400")))
return
@@ -172,6 +215,17 @@ func (s *NeLicenseController) Change(c *gin.Context) {
// 网元授权激活状态
//
// GET /state
//
// @Tags network_element/license
// @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 neId query string true "NE ID" default(001)
// @Success 200 {object} object "Response Results"
// @Security TokenAuth
// @Summary Network element authorization activation status
// @Description Network element authorization activation status
// @Router /ne/license/state [get]
func (s *NeLicenseController) State(c *gin.Context) {
language := ctx.AcceptLanguage(c)
var querys struct {

View File

@@ -28,6 +28,17 @@ type NeSoftwareController struct {
// 网元软件包列表
//
// GET /list
//
// @Tags network_element/software
// @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 neId query string true "NE ID" default(001)
// @Success 200 {object} object "Response Results"
// @Security TokenAuth
// @Summary List of Network Element Software Packages
// @Description List of Network Element Software Packages
// @Router /ne/software/list [get]
func (s *NeSoftwareController) List(c *gin.Context) {
querys := ctx.QueryMap(c)
data := s.neSoftwareService.SelectPage(querys)
@@ -164,6 +175,16 @@ func (s *NeSoftwareController) Remove(c *gin.Context) {
// 网元软件包设为网元新版本
//
// POST /newNeVersion
//
// @Tags network_element/software
// @Accept json
// @Produce json
// @Param data body object true "Request Param"
// @Success 200 {object} object "Response Results"
// @Security TokenAuth
// @Summary Net Element package set to Net Element new version
// @Description Net Element package set to Net Element new version
// @Router /ne/software/newNeVersion [post]
func (s *NeSoftwareController) NewNeVersion(c *gin.Context) {
language := ctx.AcceptLanguage(c)
var body model.NeSoftware

View File

@@ -55,6 +55,16 @@ func (s *NeVersionController) Info(c *gin.Context) {
// 网元版本操作
//
// POST /operate
//
// @Tags network_element/version
// @Accept json
// @Produce json
// @Param data body object true "Request Param"
// @Success 200 {object} object "Response Results"
// @Security TokenAuth
// @Summary Network element version operation
// @Description Network element version operation
// @Router /ne/version/operate [post]
func (s *NeVersionController) Operate(c *gin.Context) {
language := ctx.AcceptLanguage(c)
var body struct {

View File

@@ -63,16 +63,31 @@ func AMFGnbStateList(neInfo model.NeInfo) ([]map[string]any, error) {
resBytes, err := fetch.Get(neUrl, nil, 60_000)
if err != nil {
errStr := err.Error()
logger.Warnf("AMFNbInfoList Get \"%s\"", neUrl)
logger.Errorf("AMFNbInfoList %s", errStr)
logger.Warnf("AMFGnbStateList Get \"%s\"", neUrl)
logger.Errorf("AMFGnbStateList %s", errStr)
return nil, fmt.Errorf("NeService AMF API Error")
}
// 序列化结果 {"data":[{"name": "Gnb","address": "192.168.8.1","state": "INACTIVE"}]}
// 序列化结果
// {
// "data": [
// {
// "index": 1,
// "name": "Gnb",
// "address": "192.168.8.1",
// "position": "Area-B",
// "offTime": "2024-12-30T16:31:57+08:00",
// "onTime": "2024-12-30T15:41:59+08:00",
// "state": "OFF",
// "nbName": "SA",
// "ueNum": 1
// },
// ]
// }
var resData map[string]any
err = json.Unmarshal(resBytes, &resData)
if err != nil {
logger.Errorf("AMFNbInfoList Unmarshal %s", err.Error())
logger.Errorf("AMFGnbStateList Unmarshal %s", err.Error())
return nil, err
}

View File

@@ -10,7 +10,7 @@ import (
"be.ems/src/modules/network_element/model"
)
// MMENbInfoList AMF基站信息
// MMENbInfoList MME基站信息
//
// 查询参数 {"id":"7"}
//
@@ -32,7 +32,7 @@ func MMENbInfoList(neInfo model.NeInfo, data map[string]string) ([]map[string]an
errStr := err.Error()
logger.Warnf("MMENbInfoList Get \"%s\"", neUrl)
logger.Errorf("MMENbInfoList %s", errStr)
return nil, fmt.Errorf("NeService AMF API Error")
return nil, fmt.Errorf("NeService MME API Error")
}
// 序列化结果 {"data":[{"id":"7","name":"NR-SA-GNB","address":"192.168.5.100:60110","ueNum":0}]}
@@ -54,3 +54,52 @@ func MMENbInfoList(neInfo model.NeInfo, data map[string]string) ([]map[string]an
}
return []map[string]any{}, nil
}
// MMEEnbStateList MME基站状态信息对比配置项enbList
//
// 返回结果 []
func MMEEnbStateList(neInfo model.NeInfo) ([]map[string]any, error) {
neUrl := fmt.Sprintf("http://%s:%d/api/rest/ueManagement/v1/elementType/mme/objectType/nbState", neInfo.IP, neInfo.Port)
resBytes, err := fetch.Get(neUrl, nil, 60_000)
if err != nil {
errStr := err.Error()
logger.Warnf("MMEEnbStateList Get \"%s\"", neUrl)
logger.Errorf("MMEEnbStateList %s", errStr)
return nil, fmt.Errorf("NeService MME API Error")
}
// 序列化结果
// {
// "data": [
// {
// "index": 1,
// "name": "Enb",
// "address": "192.168.8.1",
// "position": "Area-B",
// "offTime": "2024-12-30T16:31:57+08:00",
// "onTime": "2024-12-30T15:41:59+08:00",
// "state": "OFF",
// "nbName": "SA",
// "ueNum": 1
// },
// ]
// }
var resData map[string]any
err = json.Unmarshal(resBytes, &resData)
if err != nil {
logger.Errorf("MMEEnbStateList Unmarshal %s", err.Error())
return nil, err
}
// 固定返回字段,方便前端解析
if v, ok := resData["data"]; ok && v != nil {
if arr := v.([]any); len(arr) > 0 {
result := make([]map[string]any, len(arr))
for i, item := range arr {
result[i] = item.(map[string]any)
}
return result, nil
}
}
return []map[string]any{}, nil
}

View File

@@ -61,7 +61,8 @@ func SMFSubInfoList(neInfo model.NeInfo, data map[string]string) (map[string]any
}
// 固定页数量50条
if v, ok := data["pageNum"]; ok && v != "" {
query = append(query, fmt.Sprintf("pageNum=%s", v))
pageNum := parse.Number(v)
query = append(query, fmt.Sprintf("pageNum=%d", pageNum))
}
if len(query) > 0 {