feat: 网元参数配置数据支持版本区分功能,,适应mme版本配置
This commit is contained in:
@@ -164,18 +164,28 @@ func (s NeConfigController) Remove(c *gin.Context) {
|
||||
// @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,SMSC)
|
||||
// @Param neId query string true "NE ID" default(001)
|
||||
// @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 := reqctx.AcceptLanguage(c)
|
||||
neId := c.DefaultQuery("neId", "001")
|
||||
neType := c.Param("neType")
|
||||
if neType == "" {
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neType is empty"))
|
||||
return
|
||||
}
|
||||
data := s.neConfigService.FindByNeType(neType)
|
||||
|
||||
neInfo := s.neInfoService.FindByNeTypeAndNeID(neType, neId)
|
||||
if neInfo.NeId != neId || neInfo.IP == "" {
|
||||
c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo")))
|
||||
return
|
||||
}
|
||||
|
||||
data := s.neConfigService.FindByNeType(neInfo.NeType, neInfo.NeVersion)
|
||||
c.JSON(200, resp.OkData(data))
|
||||
}
|
||||
|
||||
@@ -313,8 +323,14 @@ func (s NeConfigController) DataAdd(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
neInfo := s.neInfoService.FindByNeTypeAndNeID(body.NeType, body.NeId)
|
||||
if neInfo.NeId != body.NeId || neInfo.IP == "" {
|
||||
c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo")))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查是否array
|
||||
info := s.neConfigService.FindByNeTypeAndParamName(body.NeType, body.ParamName)
|
||||
info := s.neConfigService.FindByNeTypeAndParamName(body.NeType, neInfo.NeVersion, body.ParamName)
|
||||
if info.ParamType != "array" {
|
||||
c.JSON(200, resp.ErrMsg("this attribute does not support adding"))
|
||||
return
|
||||
@@ -326,12 +342,6 @@ func (s NeConfigController) DataAdd(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
neInfo := s.neInfoService.FindByNeTypeAndNeID(body.NeType, body.NeId)
|
||||
if neInfo.NeId != body.NeId || neInfo.IP == "" {
|
||||
c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo")))
|
||||
return
|
||||
}
|
||||
|
||||
// 网元直连
|
||||
resData, err := neFetchlink.NeConfigAdd(neInfo, body.ParamName, body.Loc, body.ParamData)
|
||||
if err != nil {
|
||||
@@ -371,19 +381,19 @@ func (s NeConfigController) DataRemove(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
// 检查是否array
|
||||
info := s.neConfigService.FindByNeTypeAndParamName(query.NeType, query.ParamName)
|
||||
if info.ParamType != "array" {
|
||||
c.JSON(200, resp.ErrMsg("this attribute does not support adding"))
|
||||
return
|
||||
}
|
||||
|
||||
neInfo := s.neInfoService.FindByNeTypeAndNeID(query.NeType, query.NeId)
|
||||
if neInfo.NeId != query.NeId || neInfo.IP == "" {
|
||||
c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo")))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查是否array
|
||||
info := s.neConfigService.FindByNeTypeAndParamName(query.NeType, neInfo.NeVersion, query.ParamName)
|
||||
if info.ParamType != "array" {
|
||||
c.JSON(200, resp.ErrMsg("this attribute does not support adding"))
|
||||
return
|
||||
}
|
||||
|
||||
// 网元直连
|
||||
resData, err := neFetchlink.NeConfigDelete(neInfo, query.ParamName, query.Loc)
|
||||
if err != nil {
|
||||
|
||||
@@ -395,6 +395,7 @@ func (s NeInfoController) Add(c *gin.Context) {
|
||||
// 已有网元可获取的信息
|
||||
if body.ServerState != nil {
|
||||
if v, ok := body.ServerState["version"]; ok && v != nil {
|
||||
body.NeVersion = fmt.Sprint(v)
|
||||
neVersion.Version = fmt.Sprint(v)
|
||||
}
|
||||
if v, ok := body.ServerState["sn"]; ok && v != nil {
|
||||
@@ -497,6 +498,7 @@ func (s NeInfoController) Edit(c *gin.Context) {
|
||||
// 已有网元可获取的信息
|
||||
if body.ServerState != nil {
|
||||
if v, ok := body.ServerState["version"]; ok && v != nil {
|
||||
body.NeVersion = fmt.Sprint(v)
|
||||
neVersion.Version = fmt.Sprint(v)
|
||||
neVersion.UpdateBy = loginUserName
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user