Refactor API tags in swagger.yaml to use shortened prefixes
- Updated tags from 'network_data' to 'ne_data' for consistency and brevity. - Changed 'network_element' to 'ne' across various endpoints for improved readability. - Adjusted related descriptions in the tags section to reflect the new naming conventions.
This commit is contained in:
39
src/modules/ne/fetch_link/udm.go
Normal file
39
src/modules/ne/fetch_link/udm.go
Normal file
@@ -0,0 +1,39 @@
|
||||
// 网元UDM服务,可能是8080、33030端口服务
|
||||
// 融合的UDM网元视情况调整。
|
||||
|
||||
package fetchlink
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"be.ems/src/framework/logger"
|
||||
"be.ems/src/framework/utils/fetch"
|
||||
)
|
||||
|
||||
// UDMImportAuth UDM导入鉴权数据
|
||||
//
|
||||
// data参数 {path:"服务器文件路径", k4:"可选,k4为空时Ki不加密。"}
|
||||
func UDMImportAuth(udmIP string, data map[string]any) (string, error) {
|
||||
// 网元参数配置新增(array)
|
||||
neUrl := fmt.Sprintf("http://%s:8080/ue-manage/v1/import-auth", udmIP)
|
||||
resBytes, err := fetch.PostJSON(neUrl, data, nil)
|
||||
var resData map[string]string
|
||||
if err != nil {
|
||||
errStr := err.Error()
|
||||
logger.Warnf("UDMImportAuth Post \"%s\"", neUrl)
|
||||
logger.Errorf("UDMImportAuth %s", errStr)
|
||||
return "", fmt.Errorf("NeService UDM API Error")
|
||||
}
|
||||
|
||||
// 序列化结果
|
||||
if err = json.Unmarshal(resBytes, &resData); err != nil {
|
||||
logger.Errorf("UDMImportAuth Unmarshal %s", err.Error())
|
||||
return "", err
|
||||
}
|
||||
if v, ok := resData["code"]; ok && v == "00000" {
|
||||
return strings.TrimSpace(strings.ToLower(resData["message"])), nil
|
||||
}
|
||||
return "", fmt.Errorf("%s", resData["message"])
|
||||
}
|
||||
Reference in New Issue
Block a user