fix: cm data follow spec of CM doc

This commit is contained in:
simon
2025-07-26 14:35:55 +08:00
parent 3e7c60ecd0
commit 1a5b2cd15a
8 changed files with 77 additions and 58 deletions

View File

@@ -18,7 +18,7 @@ func SyncNbiCM() error {
// 从ne_info表获取UDM类型的网元
var udmNEs []common.NeInfo
err := dborm.DefaultDB().Table("ne_info").Where("ne_type = ?", "UDM").
err := dborm.DefaultDB().Table("ne_info").Where("ne_type = ? and status <> 0", "UDM").
Find(&udmNEs).Error
if err != nil {
log.Errorf("Failed to query UDM network elements: %v", err)
@@ -45,7 +45,7 @@ func SyncNbiCM() error {
UserLabel: ne.NeName,
VendorName: ne.VendorName,
ManagedBy: ne.Dn,
ManagementIpAddress: ne.Ip,
ManagementIpAddress: "{" + ne.Ip + "}",
SwVersion: version,
PatchInfo: "-",
AdministrativeState: adminState,
@@ -95,7 +95,7 @@ func SyncNbiCM() error {
OperationalState: operState,
VnfInstanceId: "vnf-" + ne.NeType + "-" + ne.NeId,
Fqdn: fmt.Sprintf("%s%s.mnc000.mcc460.3gppnetwork.org", strings.ToLower(ne.NeType), ne.NeId),
SbiServiceList: "Nudm_UEAuthentication,Nudm_SubscriberDataManagement,Nudm_UEContextManagement",
SbiServiceList: "{Nudm_UEAuthentication,Nudm_SubscriberDataManagement,Nudm_UEContextManagement}",
}
udmJSON, err := json.Marshal(udmFunction)
if err != nil {
@@ -135,7 +135,7 @@ func SyncNbiCM() error {
// ========== UdrFunction ==========
var capability int
err = dborm.DefaultDB().Table("ne_license").Where("ne_type = ? and ne_id = ?", ne.NeType, ne.NeId).
err = dborm.DefaultDB().Table("ne_license").Where("ne_type = ? and ne_id = ? and status = 1", ne.NeType, ne.NeId).
Pluck("capability", &capability).Error
if err != nil {
log.Errorf("Failed to query capability for ne_id %s: %v", ne.NeId, err)
@@ -148,7 +148,7 @@ func SyncNbiCM() error {
OperationalState: operState,
VnfInstanceId: "vnf-UDR-" + ne.NeId,
Fqdn: fmt.Sprintf("%s%s.mnc000.mcc460.3gppnetwork.org", strings.ToLower(ne.NeType), ne.NeId),
SbiServiceList: "Nudr_DataRepository",
SbiServiceList: "{Nudr_DataRepository}",
MaxNumSupi: capability,
MaxNumMsisdn: capability,
}
@@ -196,7 +196,7 @@ func SyncNbiCM() error {
OperationalState: operState,
VnfInstanceId: "vnf-AUSF-" + ne.NeId,
Fqdn: fmt.Sprintf("ausf%s.mnc000.mcc460.3gppnetwork.org", ne.NeId),
SbiServiceList: "Nausf_UEAuthentication,Nausf_SoRProtection",
SbiServiceList: "{Nausf_UEAuthentication,Nausf_SoRProtection}",
}
ausfJSON, err := json.Marshal(ausfFunction)
if err != nil {