fix: OMC网元配置omcNeConfig接口覆盖

This commit is contained in:
TsMask
2024-03-01 19:00:05 +08:00
parent f676e5e9b3
commit c09bd4dbf3
3 changed files with 39 additions and 35 deletions

View File

@@ -23,8 +23,6 @@ import (
)
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
NeCmUri = config.DefaultUriPrefix + "/systemManagement/{apiVersion}/elementType/{elementTypeValue}/objectType/cm"
// NE info
@@ -36,11 +34,9 @@ var (
// nf instance action uri, action: start/stop/restart
UriNeInstance = config.DefaultUriPrefix + "/systemManagement/{apiVersion}/elementType/{elementTypeValue}/objectType/instance/{action}"
CustomUriParamOmcNeConfig = config.UriPrefix + "/systemManagement/v1/elementType/%s/objectType/config/omcNeConfig"
CustomUriOmcNeConfig = config.UriPrefix + "/systemManagement/v1/elementType/omc/objectType/config/omcNeConfig"
CustomNeCmUri = config.UriPrefix + "/systemManagement/{apiVersion}/elementType/{elementTypeValue}/objectType/cm"
CustomUriNeInfo = config.UriPrefix + "/systemManagement/{apiVersion}/elementType/{elementTypeValue}/objectType/neInfo"
CustomUriNeCmFile = config.UriPrefix + "/systemManagement/{apiVersion}/{neType}/neBackup/{fileName}"
CustomNeCmUri = config.UriPrefix + "/systemManagement/{apiVersion}/elementType/{elementTypeValue}/objectType/cm"
CustomUriNeInfo = config.UriPrefix + "/systemManagement/{apiVersion}/elementType/{elementTypeValue}/objectType/neInfo"
CustomUriNeCmFile = config.UriPrefix + "/systemManagement/{apiVersion}/{neType}/neBackup/{fileName}"
// service action uri, action: start/stop/restart
CustomUriNeService = config.UriPrefix + "/systemManagement/{apiVersion}/elementType/{elementTypeValue}/objectType/service/{action}"
// nf instance action uri, action: start/stop/restart
@@ -170,7 +166,7 @@ func PostNeInfo(w http.ResponseWriter, r *http.Request) {
} else {
hostUri := global.CombineHostUri(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)
log.Debug("requestURI2NF:", requestURI2NF)
@@ -280,7 +276,7 @@ func PutNeInfo(w http.ResponseWriter, r *http.Request) {
} else {
hostUri := global.CombineHostUri(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)
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) {
log.Debug("DeleteNeInfo processing... ")