feat: 网元OAM配置文件读写接口和部分接口参数变更
This commit is contained in:
@@ -204,31 +204,86 @@ func (s *NeInfoController) ConfigFileWrite(c *gin.Context) {
|
||||
c.JSON(200, result.Ok(nil))
|
||||
}
|
||||
|
||||
// 网元端公共配置文件读取
|
||||
// 网元端OAM配置文件读取
|
||||
//
|
||||
// GET /para5GFile
|
||||
func (s *NeInfoController) Para5GFileRead(c *gin.Context) {
|
||||
fileType := c.Query("fileType")
|
||||
data := s.neInfoService.NeConfPara5GRead(fileType)
|
||||
// GET /oamFile
|
||||
func (s *NeInfoController) OAMFileRead(c *gin.Context) {
|
||||
language := ctx.AcceptLanguage(c)
|
||||
var querys struct {
|
||||
NeType string `form:"neType" binding:"required"`
|
||||
NeID string `form:"neId" binding:"required"`
|
||||
}
|
||||
if err := c.ShouldBindQuery(&querys); err != nil {
|
||||
c.JSON(400, result.CodeMsg(400, i18n.TKey(language, "app.common.err400")))
|
||||
return
|
||||
}
|
||||
|
||||
data, err := s.neInfoService.NeConfOAMRead(querys.NeType, querys.NeID)
|
||||
if err != nil {
|
||||
c.JSON(200, result.ErrMsg(err.Error()))
|
||||
return
|
||||
}
|
||||
c.JSON(200, result.OkData(data))
|
||||
}
|
||||
|
||||
// 网元端公共配置文件写入
|
||||
// 网元端OAM配置文件写入
|
||||
//
|
||||
// PUT /para5GFile
|
||||
func (s *NeInfoController) Para5GFileWrite(c *gin.Context) {
|
||||
// PUT /oamFile
|
||||
func (s *NeInfoController) OAMFileWrite(c *gin.Context) {
|
||||
language := ctx.AcceptLanguage(c)
|
||||
var body struct {
|
||||
FileType string `json:"fileType" binding:"oneof='' txt json yaml yml"` // 解析内容数据到对应文件类型
|
||||
Content any `json:"content" binding:"required"` // 内容
|
||||
SyncNE []string `json:"syncNe"` // 同步到网元
|
||||
NeType string `json:"neType" binding:"required"`
|
||||
NeID string `json:"neId" binding:"required"`
|
||||
Content map[string]any `json:"content" binding:"required"` // 内容
|
||||
Sync bool `json:"sync"` // 同步到网元
|
||||
}
|
||||
if err := c.ShouldBindBodyWith(&body, binding.JSON); err != nil {
|
||||
c.JSON(400, result.CodeMsg(400, i18n.TKey(language, "app.common.err400")))
|
||||
return
|
||||
}
|
||||
|
||||
err := s.neInfoService.NeConfPara5GWirte(body.FileType, body.Content, body.SyncNE)
|
||||
// 查询网元获取IP
|
||||
neInfo := s.neInfoService.SelectNeInfoByNeTypeAndNeID(body.NeType, body.NeID)
|
||||
if neInfo.NeId != body.NeID || neInfo.IP == "" {
|
||||
c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.noNEInfo")))
|
||||
return
|
||||
}
|
||||
|
||||
err := s.neInfoService.NeConfOAMWirte(body.NeType, body.NeID, body.Content, body.Sync)
|
||||
if err != nil {
|
||||
c.JSON(200, result.ErrMsg(err.Error()))
|
||||
return
|
||||
}
|
||||
c.JSON(200, result.Ok(nil))
|
||||
}
|
||||
|
||||
// 网元端Para5G配置文件读取
|
||||
//
|
||||
// GET /para5GFile
|
||||
func (s *NeInfoController) Para5GFileRead(c *gin.Context) {
|
||||
data, err := s.neInfoService.NeConfPara5GRead()
|
||||
if err != nil {
|
||||
c.JSON(200, result.ErrMsg(err.Error()))
|
||||
return
|
||||
}
|
||||
c.JSON(200, result.OkData(data))
|
||||
}
|
||||
|
||||
// 网元端Para5G配置文件写入
|
||||
//
|
||||
// PUT /para5GFile
|
||||
func (s *NeInfoController) Para5GFileWrite(c *gin.Context) {
|
||||
language := ctx.AcceptLanguage(c)
|
||||
var body struct {
|
||||
Content map[string]any `json:"content" binding:"required"` // 内容
|
||||
SyncNE []string `json:"syncNe"` // 同步到网元
|
||||
}
|
||||
if err := c.ShouldBindBodyWith(&body, binding.JSON); err != nil {
|
||||
c.JSON(400, result.CodeMsg(400, i18n.TKey(language, "app.common.err400")))
|
||||
return
|
||||
}
|
||||
|
||||
err := s.neInfoService.NeConfPara5GWirte(body.Content, body.SyncNE)
|
||||
if err != nil {
|
||||
c.JSON(200, result.ErrMsg(err.Error()))
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user