fix: OMC网元配置omcNeConfig接口覆盖
This commit is contained in:
@@ -23,8 +23,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
UriParamOmcNeConfig = config.DefaultUriPrefix + "/systemManagement/v1/elementType/%s/objectType/config/omcNeConfig"
|
|
||||||
UriOmcNeConfig = config.DefaultUriPrefix + "/systemManagement/v1/elementType/omc/objectType/config/omcNeConfig"
|
|
||||||
// NE CM export/import
|
// NE CM export/import
|
||||||
NeCmUri = config.DefaultUriPrefix + "/systemManagement/{apiVersion}/elementType/{elementTypeValue}/objectType/cm"
|
NeCmUri = config.DefaultUriPrefix + "/systemManagement/{apiVersion}/elementType/{elementTypeValue}/objectType/cm"
|
||||||
// NE info
|
// NE info
|
||||||
@@ -36,11 +34,9 @@ var (
|
|||||||
// nf instance action uri, action: start/stop/restart
|
// nf instance action uri, action: start/stop/restart
|
||||||
UriNeInstance = config.DefaultUriPrefix + "/systemManagement/{apiVersion}/elementType/{elementTypeValue}/objectType/instance/{action}"
|
UriNeInstance = config.DefaultUriPrefix + "/systemManagement/{apiVersion}/elementType/{elementTypeValue}/objectType/instance/{action}"
|
||||||
|
|
||||||
CustomUriParamOmcNeConfig = config.UriPrefix + "/systemManagement/v1/elementType/%s/objectType/config/omcNeConfig"
|
CustomNeCmUri = config.UriPrefix + "/systemManagement/{apiVersion}/elementType/{elementTypeValue}/objectType/cm"
|
||||||
CustomUriOmcNeConfig = config.UriPrefix + "/systemManagement/v1/elementType/omc/objectType/config/omcNeConfig"
|
CustomUriNeInfo = config.UriPrefix + "/systemManagement/{apiVersion}/elementType/{elementTypeValue}/objectType/neInfo"
|
||||||
CustomNeCmUri = config.UriPrefix + "/systemManagement/{apiVersion}/elementType/{elementTypeValue}/objectType/cm"
|
CustomUriNeCmFile = config.UriPrefix + "/systemManagement/{apiVersion}/{neType}/neBackup/{fileName}"
|
||||||
CustomUriNeInfo = config.UriPrefix + "/systemManagement/{apiVersion}/elementType/{elementTypeValue}/objectType/neInfo"
|
|
||||||
CustomUriNeCmFile = config.UriPrefix + "/systemManagement/{apiVersion}/{neType}/neBackup/{fileName}"
|
|
||||||
// service action uri, action: start/stop/restart
|
// service action uri, action: start/stop/restart
|
||||||
CustomUriNeService = config.UriPrefix + "/systemManagement/{apiVersion}/elementType/{elementTypeValue}/objectType/service/{action}"
|
CustomUriNeService = config.UriPrefix + "/systemManagement/{apiVersion}/elementType/{elementTypeValue}/objectType/service/{action}"
|
||||||
// nf instance action uri, action: start/stop/restart
|
// nf instance action uri, action: start/stop/restart
|
||||||
@@ -170,7 +166,7 @@ func PostNeInfo(w http.ResponseWriter, r *http.Request) {
|
|||||||
} else {
|
} else {
|
||||||
hostUri := global.CombineHostUri(neInfo.Ip, neInfo.Port)
|
hostUri := global.CombineHostUri(neInfo.Ip, neInfo.Port)
|
||||||
//hostUri := fmt.Sprintf("http://%s:%v", neInfo.Ip, neInfo.Port)
|
//hostUri := fmt.Sprintf("http://%s:%v", neInfo.Ip, neInfo.Port)
|
||||||
apiUri := fmt.Sprintf(UriParamOmcNeConfig, strings.ToLower(neInfo.NeType))
|
apiUri := fmt.Sprintf("%s/systemManagement/v1/elementType/%s/objectType/config/omcNeConfig", config.DefaultUriPrefix, strings.ToLower(neInfo.NeType))
|
||||||
requestURI2NF := fmt.Sprintf("%s%s", hostUri, apiUri)
|
requestURI2NF := fmt.Sprintf("%s%s", hostUri, apiUri)
|
||||||
log.Debug("requestURI2NF:", requestURI2NF)
|
log.Debug("requestURI2NF:", requestURI2NF)
|
||||||
|
|
||||||
@@ -280,7 +276,7 @@ func PutNeInfo(w http.ResponseWriter, r *http.Request) {
|
|||||||
} else {
|
} else {
|
||||||
hostUri := global.CombineHostUri(neInfo.Ip, neInfo.Port)
|
hostUri := global.CombineHostUri(neInfo.Ip, neInfo.Port)
|
||||||
//hostUri := fmt.Sprintf("http://%s:%v", neInfo.Ip, neInfo.Port)
|
//hostUri := fmt.Sprintf("http://%s:%v", neInfo.Ip, neInfo.Port)
|
||||||
apiUri := fmt.Sprintf(UriParamOmcNeConfig, neTypeLower)
|
apiUri := fmt.Sprintf("%s/systemManagement/v1/elementType/%s/objectType/config/omcNeConfig", config.DefaultUriPrefix, neTypeLower)
|
||||||
requestURI2NF := fmt.Sprintf("%s%s", hostUri, apiUri)
|
requestURI2NF := fmt.Sprintf("%s%s", hostUri, apiUri)
|
||||||
log.Debug("requestURI2NF:", requestURI2NF)
|
log.Debug("requestURI2NF:", requestURI2NF)
|
||||||
|
|
||||||
@@ -338,28 +334,6 @@ func PutNeInfo(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func PutOMCNeConfig(w http.ResponseWriter, r *http.Request) {
|
|
||||||
vars := mux.Vars(r)
|
|
||||||
neType := vars["elementTypeValue"]
|
|
||||||
if neType == "" {
|
|
||||||
log.Error("elementTypeValue is empty")
|
|
||||||
services.ResponseNotFound404UriNotExist(w, r)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
body, err := io.ReadAll(io.LimitReader(r.Body, global.RequestBodyMaxLen))
|
|
||||||
if err != nil {
|
|
||||||
log.Error("Failed to io.ReadAll:", err)
|
|
||||||
services.ResponseNotFound404UriNotExist(w, r)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
neInfo := new(dborm.NeInfo)
|
|
||||||
_ = json.Unmarshal(body, neInfo)
|
|
||||||
neInfo.NeType = strings.ToUpper(neType)
|
|
||||||
|
|
||||||
services.ResponseStatusOK204NoContent(w)
|
|
||||||
}
|
|
||||||
|
|
||||||
func DeleteNeInfo(w http.ResponseWriter, r *http.Request) {
|
func DeleteNeInfo(w http.ResponseWriter, r *http.Request) {
|
||||||
log.Debug("DeleteNeInfo processing... ")
|
log.Debug("DeleteNeInfo processing... ")
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package cm
|
package cm
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"strings"
|
||||||
|
|
||||||
"ems.agt/lib/dborm"
|
"ems.agt/lib/dborm"
|
||||||
"ems.agt/lib/global"
|
"ems.agt/lib/global"
|
||||||
"ems.agt/lib/log"
|
"ems.agt/lib/log"
|
||||||
@@ -163,8 +165,14 @@ func PutParamConfigToNF(w http.ResponseWriter, r *http.Request) {
|
|||||||
services.ResponseNotFound404UriNotExist(w, r)
|
services.ResponseNotFound404UriNotExist(w, r)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
neId := services.GetUriParamString(r, "ne_id", ",", false, false)
|
|
||||||
|
|
||||||
|
// OMC配置接口 /api/rest/systemManagement/v1/elementType/omc/objectType/config/omcNeConfig
|
||||||
|
if v, ok := vars["paraName"]; ok && v == "omcNeConfig" && strings.ToLower(neType) == "omc" {
|
||||||
|
PutOMCNeConfig(w, r)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
neId := services.GetUriParamString(r, "ne_id", ",", false, false)
|
||||||
// no, _ := strconv.ParseInt(neId, 10, 64)
|
// no, _ := strconv.ParseInt(neId, 10, 64)
|
||||||
neInfo, err := dborm.XormGetNeInfo(neType, neId)
|
neInfo, err := dborm.XormGetNeInfo(neType, neId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -199,6 +207,31 @@ func PutParamConfigToNF(w http.ResponseWriter, r *http.Request) {
|
|||||||
services.ResponseWithJson(w, http.StatusNoContent, response)
|
services.ResponseWithJson(w, http.StatusNoContent, response)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PutOMCNeConfig 网元OMC配置
|
||||||
|
//
|
||||||
|
// 目前没配置,返回204
|
||||||
|
func PutOMCNeConfig(w http.ResponseWriter, r *http.Request) {
|
||||||
|
// vars := mux.Vars(r)
|
||||||
|
// neType := vars["elementTypeValue"]
|
||||||
|
// if neType == "" {
|
||||||
|
// log.Error("elementTypeValue is empty")
|
||||||
|
// services.ResponseNotFound404UriNotExist(w, r)
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
// body, err := io.ReadAll(io.LimitReader(r.Body, global.RequestBodyMaxLen))
|
||||||
|
// if err != nil {
|
||||||
|
// log.Error("Failed to io.ReadAll:", err)
|
||||||
|
// services.ResponseNotFound404UriNotExist(w, r)
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
|
||||||
|
// neInfo := new(dborm.NeInfo)
|
||||||
|
// _ = json.Unmarshal(body, neInfo)
|
||||||
|
// neInfo.NeType = strings.ToUpper(neType)
|
||||||
|
|
||||||
|
services.ResponseStatusOK204NoContent(w)
|
||||||
|
}
|
||||||
|
|
||||||
func DeleteParamConfigToNF(w http.ResponseWriter, r *http.Request) {
|
func DeleteParamConfigToNF(w http.ResponseWriter, r *http.Request) {
|
||||||
log.Debug("DeleteParamConfigToNF processing... ")
|
log.Debug("DeleteParamConfigToNF processing... ")
|
||||||
|
|
||||||
|
|||||||
@@ -166,9 +166,6 @@ func init() {
|
|||||||
Register("PUT", cm.CustomUriNeInfo, cm.PutNeInfo, nil)
|
Register("PUT", cm.CustomUriNeInfo, cm.PutNeInfo, nil)
|
||||||
Register("DELETE", cm.CustomUriNeInfo, cm.DeleteNeInfo, nil)
|
Register("DELETE", cm.CustomUriNeInfo, cm.DeleteNeInfo, nil)
|
||||||
|
|
||||||
Register("PUT", cm.UriOmcNeConfig, cm.PutOMCNeConfig, nil)
|
|
||||||
Register("PUT", cm.CustomUriOmcNeConfig, cm.PutOMCNeConfig, nil)
|
|
||||||
|
|
||||||
//ne service action handle
|
//ne service action handle
|
||||||
Register("POST", cm.UriNeService, cm.PostNeServiceAction, nil)
|
Register("POST", cm.UriNeService, cm.PostNeServiceAction, nil)
|
||||||
//ne service action handle
|
//ne service action handle
|
||||||
|
|||||||
Reference in New Issue
Block a user