Compare commits
1
Commits
nbi
..
dee8a166ff
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dee8a166ff |
No files matched your search
@@ -17,7 +17,6 @@ restagent/upload/
|
||||
restagent/software/
|
||||
restagent/database/
|
||||
restagent/license/
|
||||
restagent/restagent
|
||||
|
||||
sshsvc/sshsvc
|
||||
sshsvc/mmllog/
|
||||
@@ -34,8 +33,6 @@ vendor
|
||||
*.vsix
|
||||
*.log
|
||||
*.log-*
|
||||
*.log.*
|
||||
*.bak
|
||||
*.bak*
|
||||
*.exe
|
||||
__debug_bin*
|
||||
@@ -1,5 +1,12 @@
|
||||
# 版本发布日志
|
||||
|
||||
## 2.2503.6-20250509
|
||||
|
||||
- 更新 fix: 网元主机title唯一导致冲突5002修改失败
|
||||
- 新增 网元信令跟踪功能
|
||||
- 新增 ws模块消息码变更及修复断链情况
|
||||
- 优化 数据库引用变更
|
||||
|
||||
## 2.2503.5-20250412
|
||||
|
||||
- 更新 角色系统参数配置权限分配
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
# alarm relation rules
|
||||
derived:
|
||||
- parentCode: 10001
|
||||
childCode: 10002
|
||||
- parentCode: 20001
|
||||
childCode: 20002
|
||||
related:
|
||||
- codes: [30005, 30006, 30007]
|
||||
neType: "AMF"
|
||||
timeWindow: 60 # 秒
|
||||
@@ -1,4 +0,0 @@
|
||||
schemaPath: /usr/local/omc/etc/schema
|
||||
randomMin: 1
|
||||
randomMax: 100
|
||||
mergeMode: merge # none: Merge Mode None/merge: Merge Mode Merge/schema: Merge Mode Schema
|
||||
@@ -186,14 +186,4 @@ params:
|
||||
|
||||
testConfig:
|
||||
enabled: false
|
||||
file: /usr/local/omc/etc/testconfig.yaml
|
||||
|
||||
nbiConfig:
|
||||
enabled: true
|
||||
pmConfig:
|
||||
enabled: true
|
||||
file: /usr/local/omc/etc/nbi_pm.yaml
|
||||
# alarm_relation_rules.yaml
|
||||
relationRules:
|
||||
enabled: true
|
||||
file: /usr/local/omc/etc/alarm_relation_rules.yaml
|
||||
file: /usr/local/omc/etc/testconfig.yaml
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,269 +0,0 @@
|
||||
[
|
||||
{
|
||||
"ObjectType": "PcfFunction",
|
||||
"KPIs": [
|
||||
{
|
||||
"KPIID": "PCF.AmAssocNbrMean",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 6
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.AmAssocNbrMax",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 10
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.SmAssocNbrMean",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 7
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.SmAssocNbrMax",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 11
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicyAmAssocCreateReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 8
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicyAmAssocCreateSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 10
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicyAmAssocUpdateReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 7
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicyAmAssocUpdateSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicyAmAssocNotifReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 2
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicyAmAssocNotifSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 12
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicyAmAssocDeleteReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 11
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicyAmAssocDeleteSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 2
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicySmAssocCreateReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 11
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicySmAssocCreateSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicySmAssocCreateFail",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 11
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicySmAssocCreateFail._Cause",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 10
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicySmAssocUpdateReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 8
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicySmAssocUpdateSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicySmAssocUpdateFail",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 9
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicySmAssocUpdateFail._Cause",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 3
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicySmAssocNotifReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 8
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicySmAssocNotifSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 10
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicySmAssocNotifFail",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicySmAssocNotifFail._Cause",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 6
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicySmAssocDeleteReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 2
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicySmAssocDeleteSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 2
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ObjectType": "UdrFunction",
|
||||
"KPIs": [
|
||||
{
|
||||
"KPIID": "UDR.PcfSubNbr",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 6
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ObjectType": "ManagedElement",
|
||||
"KPIs": [
|
||||
{
|
||||
"KPIID": "ME.MeanMeLoad",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 13
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,373 +0,0 @@
|
||||
[
|
||||
{
|
||||
"ObjectType": "UdmFunction",
|
||||
"KPIs": [
|
||||
{
|
||||
"KPIID": "UDM.AmfUecmRegReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 15
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.AmfUecmRegSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.AmfUecmRegUpdateReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 9
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.AmfUecmRegUpdateSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 9
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.AmfUecmDeregReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.AmfUecmDeregSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 15
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SmfUecmRegReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SmfUecmRegSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 3
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SmfUecmDeregReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 5
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SmfUecmDeregSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 2
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SdmGetReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 16
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SdmGetSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 14
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SdmNotif",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 6
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SdmSubscrReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SdmSubscrSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 11
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SdmUnSubscrReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 10
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SdmUnSubscrSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 14
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.UecmDeregNotif",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 8
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SdmGetUserNotFound",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 7
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SdmGetDataNotFound",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 5
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.AmfUecmRegUserNotFound",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 14
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.AmfUecmRegUnknownSub",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 2
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.AmfUecmRegNoPsSub",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 3
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.AmfUecmRegRoamNotAllowed",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 10
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.AmfUecmRegRatNotAllowed",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 3
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.AmfUecmRegContextNotFound",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 3
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.AmfUecmRegReAuth",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SmfUecmRegUserNotFound",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 15
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SmfUecmRegUnknownSub",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 13
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SmfUecmRegRoamNotAllowed",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 6
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SmfUecmRegDnnNotAllowed",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 6
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ObjectType": "UdrFunction",
|
||||
"KPIs": [
|
||||
{
|
||||
"KPIID": "UDR.5gSupi",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 10
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDR.5gSub",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 14
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDR.5gActSub",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 16
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ObjectType": "AusfFunction",
|
||||
"KPIs": [
|
||||
{
|
||||
"KPIID": "Ausf.UeAuthReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "Ausf.UeAuthAnsSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "Ausf.UeAuthAnsUserNotFound",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "Ausf.UeAuthAnsContextNotFound",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ObjectType": "ManagedElement",
|
||||
"KPIs": [
|
||||
{
|
||||
"KPIID": "ME.MeanMeLoad",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 11
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -1,269 +0,0 @@
|
||||
[
|
||||
{
|
||||
"ObjectType": "PcfFunction",
|
||||
"KPIs": [
|
||||
{
|
||||
"KPIID": "PCF.AmAssocNbrMean",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 6
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.AmAssocNbrMax",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 10
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.SmAssocNbrMean",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 7
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.SmAssocNbrMax",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 11
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicyAmAssocCreateReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 8
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicyAmAssocCreateSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 10
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicyAmAssocUpdateReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 7
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicyAmAssocUpdateSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicyAmAssocNotifReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 2
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicyAmAssocNotifSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 12
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicyAmAssocDeleteReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 11
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicyAmAssocDeleteSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 2
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicySmAssocCreateReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 11
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicySmAssocCreateSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicySmAssocCreateFail",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 11
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicySmAssocCreateFail._Cause",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 10
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicySmAssocUpdateReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 8
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicySmAssocUpdateSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicySmAssocUpdateFail",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 9
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicySmAssocUpdateFail._Cause",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 3
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicySmAssocNotifReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 8
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicySmAssocNotifSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 10
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicySmAssocNotifFail",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicySmAssocNotifFail._Cause",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 6
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicySmAssocDeleteReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 2
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicySmAssocDeleteSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 2
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ObjectType": "UdrFunction",
|
||||
"KPIs": [
|
||||
{
|
||||
"KPIID": "UDR.PcfSubNbr",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 6
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ObjectType": "ManagedElement",
|
||||
"KPIs": [
|
||||
{
|
||||
"KPIID": "ME.MeanMeLoad",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 13
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,373 +0,0 @@
|
||||
[
|
||||
{
|
||||
"ObjectType": "UdmFunction",
|
||||
"KPIs": [
|
||||
{
|
||||
"KPIID": "UDM.AmfUecmRegReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 15
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.AmfUecmRegSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.AmfUecmRegUpdateReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 9
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.AmfUecmRegUpdateSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 9
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.AmfUecmDeregReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.AmfUecmDeregSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 15
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SmfUecmRegReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SmfUecmRegSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 3
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SmfUecmDeregReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 5
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SmfUecmDeregSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 2
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SdmGetReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 16
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SdmGetSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 14
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SdmNotif",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 6
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SdmSubscrReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SdmSubscrSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 11
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SdmUnSubscrReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 10
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SdmUnSubscrSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 14
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.UecmDeregNotif",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 8
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SdmGetUserNotFound",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 7
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SdmGetDataNotFound",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 5
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.AmfUecmRegUserNotFound",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 14
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.AmfUecmRegUnknownSub",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 2
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.AmfUecmRegNoPsSub",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 3
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.AmfUecmRegRoamNotAllowed",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 10
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.AmfUecmRegRatNotAllowed",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 3
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.AmfUecmRegContextNotFound",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 3
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.AmfUecmRegReAuth",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SmfUecmRegUserNotFound",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 15
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SmfUecmRegUnknownSub",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 13
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SmfUecmRegRoamNotAllowed",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 6
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SmfUecmRegDnnNotAllowed",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 6
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ObjectType": "UdrFunction",
|
||||
"KPIs": [
|
||||
{
|
||||
"KPIID": "UDR.5gSupi",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 10
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDR.5gSub",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 14
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDR.5gActSub",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 16
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ObjectType": "AusfFunction",
|
||||
"KPIs": [
|
||||
{
|
||||
"KPIID": "Ausf.UeAuthReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "Ausf.UeAuthAnsSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "Ausf.UeAuthAnsUserNotFound",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "Ausf.UeAuthAnsContextNotFound",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ObjectType": "ManagedElement",
|
||||
"KPIs": [
|
||||
{
|
||||
"KPIID": "ME.MeanMeLoad",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 11
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,34 +1,48 @@
|
||||
/*
|
||||
Navicat Premium Data Transfer
|
||||
|
||||
Source Server : root@192.168.2.165
|
||||
Source Server Type : MariaDB
|
||||
Source Server Version : 100335 (10.3.35-MariaDB)
|
||||
Source Host : 192.168.2.165:33066
|
||||
Source Schema : omc_db
|
||||
|
||||
Target Server Type : MariaDB
|
||||
Target Server Version : 100335 (10.3.35-MariaDB)
|
||||
File Encoding : 65001
|
||||
|
||||
Date: 16/05/2025 10:48:43
|
||||
*/
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for alarm_relation
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `alarm_relation`;
|
||||
CREATE TABLE `alarm_relation` (
|
||||
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`root_alarm_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||||
`alarm_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||||
`relation_type` enum('derived','related') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '衍生关系:derived/related: 父子/兄弟',
|
||||
`add_info` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||||
`created_at` datetime NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
-- MariaDB dump 10.19 Distrib 10.6.16-MariaDB, for debian-linux-gnu (x86_64)
|
||||
--
|
||||
-- Host: 192.168.2.219 Database: omc_db
|
||||
-- ------------------------------------------------------
|
||||
-- Server version 10.3.38-MariaDB
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8mb4 */;
|
||||
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
||||
/*!40103 SET TIME_ZONE='+00:00' */;
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||
|
||||
--
|
||||
-- Table structure for table `alarm_relation`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `alarm_relation`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `alarm_relation` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`created_at` datetime(3) DEFAULT NULL,
|
||||
`updated_at` datetime(3) DEFAULT NULL,
|
||||
`deleted_at` datetime(3) DEFAULT NULL,
|
||||
`root_alarm_id` varchar(64) DEFAULT NULL,
|
||||
`alarm_id` varchar(64) DEFAULT NULL,
|
||||
`relation_type` varchar(64) DEFAULT NULL,
|
||||
`add_info` varchar(64) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
KEY `idx_alarm_relation_deleted_at` (`deleted_at`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2024-03-06 17:26:55
|
||||
+54
-39
@@ -1,39 +1,54 @@
|
||||
/*
|
||||
Navicat Premium Data Transfer
|
||||
|
||||
Source Server : root@192.168.2.165
|
||||
Source Server Type : MariaDB
|
||||
Source Server Version : 100335 (10.3.35-MariaDB)
|
||||
Source Host : 192.168.2.165:33066
|
||||
Source Schema : omc_db
|
||||
|
||||
Target Server Type : MariaDB
|
||||
Target Server Version : 100335 (10.3.35-MariaDB)
|
||||
File Encoding : 65001
|
||||
|
||||
Date: 26/05/2025 17:26:21
|
||||
*/
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for nbi_cm
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `nbi_cm`;
|
||||
CREATE TABLE `nbi_cm` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`ne_type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||||
`ne_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||||
`cm_version` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||||
`rm_uid` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||||
`event_type` enum('ObjectOriginalEvent','ObjectCreationEvent','ObjectDeletionEvent','ObjectAttributeValueChangeEvent') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'ObjectCreationEvent',
|
||||
`object_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||||
`value_json` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL,
|
||||
`timestamp` datetime NULL DEFAULT current_timestamp() ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
INDEX `idx-ne-id-rmuid`(`ne_type`, `ne_id`, `rm_uid`) USING BTREE,
|
||||
INDEX `idx-timestamp`(`timestamp`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 93 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
-- MariaDB dump 10.19 Distrib 10.6.16-MariaDB, for debian-linux-gnu (x86_64)
|
||||
--
|
||||
-- Host: 192.168.2.219 Database: omc_db
|
||||
-- ------------------------------------------------------
|
||||
-- Server version 10.3.38-MariaDB
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8mb4 */;
|
||||
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
||||
/*!40103 SET TIME_ZONE='+00:00' */;
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||
|
||||
--
|
||||
-- Table structure for table `nbi_cm`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `nbi_cm`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `nbi_cm` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`timestamp` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
|
||||
`time_zone` varchar(10) DEFAULT NULL,
|
||||
`vendor_name` varchar(65) DEFAULT NULL,
|
||||
`ne_type` varchar(16) DEFAULT NULL,
|
||||
`cm_version` varchar(32) DEFAULT NULL,
|
||||
`rm_uid` varchar(32) DEFAULT NULL,
|
||||
`ne_id` varchar(32) DEFAULT NULL,
|
||||
`user_label` varchar(64) DEFAULT NULL,
|
||||
`object_type` varchar(32) DEFAULT NULL,
|
||||
`pv_flag` enum('PNF','VNF') DEFAULT 'PNF',
|
||||
`vm_id` varchar(128) DEFAULT '0',
|
||||
`vnf_instance_id` varchar(64) DEFAULT NULL,
|
||||
`value_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
|
||||
`status` enum('Original','Created','Updated','Deleted') NOT NULL DEFAULT 'Original',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=311439 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2024-03-06 17:26:56
|
||||
@@ -1,59 +1,44 @@
|
||||
/*
|
||||
Navicat Premium Data Transfer
|
||||
|
||||
Source Server : omc@192.168.2.164
|
||||
Source Server Type : MariaDB
|
||||
Source Server Version : 100528 (10.5.28-MariaDB)
|
||||
Source Host : 192.168.2.164:33066
|
||||
Source Schema : omc_db
|
||||
|
||||
Target Server Type : MariaDB
|
||||
Target Server Version : 100528 (10.5.28-MariaDB)
|
||||
File Encoding : 65001
|
||||
|
||||
Date: 29/04/2025 14:45:48
|
||||
*/
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for ne_license
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `ne_license`;
|
||||
CREATE TABLE `ne_license` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '网元类型',
|
||||
`ne_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '网元ID',
|
||||
`activation_request_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '激活申请代码',
|
||||
`license_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '激活授权文件',
|
||||
`serial_num` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '-' COMMENT '序列号',
|
||||
`expiry_date` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '-' COMMENT '许可证到期日期',
|
||||
`capability` int(11) NULL DEFAULT 0,
|
||||
`status` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '状态 0无效 1有效',
|
||||
`remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '备注',
|
||||
`create_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者',
|
||||
`create_time` bigint(20) NULL DEFAULT 0 COMMENT '创建时间',
|
||||
`update_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者',
|
||||
`update_time` bigint(20) NULL DEFAULT 0 COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
UNIQUE INDEX `uk_type_id`(`ne_type`, `ne_id`) USING BTREE COMMENT '唯一网元类型和网元ID'
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 19 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '网元授权激活信息' ROW_FORMAT = Dynamic;
|
||||
|
||||
-- 初始数据对应网元
|
||||
INSERT INTO `ne_license` VALUES (1, 'OMC', '001', '', '', '', '', 0, '0', '', 'supervisor', 1713928436971, '', 0);
|
||||
INSERT INTO `ne_license` VALUES (2, 'IMS', '001', '', '', '', '', 0, '0', '', 'supervisor', 1713928436971, '', 0);
|
||||
INSERT INTO `ne_license` VALUES (3, 'AMF', '001', '', '', '', '', 0, '0', '', 'supervisor', 1713928436971, '', 0);
|
||||
INSERT INTO `ne_license` VALUES (4, 'AUSF', '001', '', '', '', '', 0, '0', '', 'supervisor', 1713928436971, '', 0);
|
||||
INSERT INTO `ne_license` VALUES (5, 'UDM', '001', '', '', '', '', 0, '0', '', 'supervisor', 1713928436971, '', 0);
|
||||
INSERT INTO `ne_license` VALUES (6, 'SMF', '001', '', '', '', '', 0, '0', '', 'supervisor', 1713928436971, '', 0);
|
||||
INSERT INTO `ne_license` VALUES (7, 'PCF', '001', '', '', '', '', 0, '0', '', 'supervisor', 1713928436971, '', 0);
|
||||
INSERT INTO `ne_license` VALUES (8, 'NSSF', '001', '', '', '', '', 0, '0', '', 'supervisor', 1713928436971, '', 0);
|
||||
INSERT INTO `ne_license` VALUES (9, 'NRF', '001', '', '', '', '', 0, '0', '', 'supervisor', 1713928436971, '', 0);
|
||||
INSERT INTO `ne_license` VALUES (10, 'UPF', '001', '', '', '', '', 0, '0', '', 'supervisor', 1713928436971, '', 0);
|
||||
INSERT INTO `ne_license` VALUES (11, 'LMF', '001', '', '', '', '', 0, '0', '', 'supervisor', 1713928436971, '', 0);
|
||||
INSERT INTO `ne_license` VALUES (12, 'NEF', '001', '', '', '', '', 0, '0', '', 'supervisor', 1713928436971, '', 0);
|
||||
INSERT INTO `ne_license` VALUES (13, 'MME', '001', '', '', '', '', 0, '0', '', 'supervisor', 1713928436971, '', 0);
|
||||
INSERT INTO `ne_license` VALUES (14, 'N3IWF', '001', '', '', '', '', 0, '0', '', 'supervisor', 1713928436971, '', 0);
|
||||
|
||||
SET FOREIGN_KEY_CHECKS=1;
|
||||
SET NAMES utf8mb4;
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
--
|
||||
-- Table structure for table `ne_license`
|
||||
--
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `ne_license`;
|
||||
CREATE TABLE `ne_license` (
|
||||
`id` int NOT NULL AUTO_INCREMENT,
|
||||
`ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '网元类型',
|
||||
`ne_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '网元ID',
|
||||
`activation_request_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '激活申请代码',
|
||||
`license_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '激活授权文件',
|
||||
`serial_num` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '-' COMMENT '序列号',
|
||||
`expiry_date` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '-' COMMENT '许可证到期日期',
|
||||
`status` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '状态 0无效 1有效',
|
||||
`remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '备注',
|
||||
`create_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '创建者',
|
||||
`create_time` bigint DEFAULT '0' COMMENT '创建时间',
|
||||
`update_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '更新者',
|
||||
`update_time` bigint DEFAULT '0' COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
UNIQUE KEY `uk_type_id` (`ne_type`,`ne_id`) USING BTREE COMMENT '唯一网元类型和网元ID'
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='网元授权激活信息';
|
||||
|
||||
-- 初始数据对应网元
|
||||
INSERT INTO `ne_license` VALUES (1, 'OMC', '001', '', '', '', '', '0', '', 'supervisor', 1713928436971, '', 0);
|
||||
INSERT INTO `ne_license` VALUES (2, 'IMS', '001', '', '', '', '', '0', '', 'supervisor', 1713928436971, '', 0);
|
||||
INSERT INTO `ne_license` VALUES (3, 'AMF', '001', '', '', '', '', '0', '', 'supervisor', 1713928436971, '', 0);
|
||||
INSERT INTO `ne_license` VALUES (4, 'AUSF', '001', '', '', '', '', '0', '', 'supervisor', 1713928436971, '', 0);
|
||||
INSERT INTO `ne_license` VALUES (5, 'UDM', '001', '', '', '', '', '0', '', 'supervisor', 1713928436971, '', 0);
|
||||
INSERT INTO `ne_license` VALUES (6, 'SMF', '001', '', '', '', '', '0', '', 'supervisor', 1713928436971, '', 0);
|
||||
INSERT INTO `ne_license` VALUES (7, 'PCF', '001', '', '', '', '', '0', '', 'supervisor', 1713928436971, '', 0);
|
||||
INSERT INTO `ne_license` VALUES (8, 'NSSF', '001', '', '', '', '', '0', '', 'supervisor', 1713928436971, '', 0);
|
||||
INSERT INTO `ne_license` VALUES (9, 'NRF', '001', '', '', '', '', '0', '', 'supervisor', 1713928436971, '', 0);
|
||||
INSERT INTO `ne_license` VALUES (10, 'UPF', '001', '', '', '', '', '0', '', 'supervisor', 1713928436971, '', 0);
|
||||
INSERT INTO `ne_license` VALUES (11, 'LMF', '001', '', '', '', '', '0', '', 'supervisor', 1713928436971, '', 0);
|
||||
INSERT INTO `ne_license` VALUES (12, 'NEF', '001', '', '', '', '', '0', '', 'supervisor', 1713928436971, '', 0);
|
||||
INSERT INTO `ne_license` VALUES (13, 'MME', '001', '', '', '', '', '0', '', 'supervisor', 1713928436971, '', 0);
|
||||
INSERT INTO `ne_license` VALUES (14, 'N3IWF', '001', '', '', '', '', '0', '', 'supervisor', 1713928436971, '', 0);
|
||||
|
||||
SET FOREIGN_KEY_CHECKS=1;
|
||||
@@ -733,9 +733,5 @@ INSERT INTO `sys_dict_data` VALUES (2222, 2222, 'dictData.trace_interfaces.17',
|
||||
INSERT INTO `sys_dict_data` VALUES (2223, 2223, 'dictData.trace_interfaces.20', 'N20', 'i18n_zh', '', '', '1', 'supervisor', 1721902269805, '', 0, '');
|
||||
INSERT INTO `sys_dict_data` VALUES (2224, 2224, 'dictData.trace_interfaces.22', 'N22', 'i18n_zh', '', '', '1', 'supervisor', 1721902269805, '', 0, '');
|
||||
INSERT INTO `sys_dict_data` VALUES (2225, 2225, 'dictData.trace_interfaces.40', 'N40', 'i18n_zh', '', '', '1', 'supervisor', 1721902269805, '', 0, '');
|
||||
REPLACE INTO `sys_dict_data` VALUES (2226, 2226, 'job.nbi.syncNRM', '定期同步网元资源数据', 'i18n_zh', '', '', '1', 'supervisor', 1721902269805, '', 0, '');
|
||||
REPLACE INTO `sys_dict_data` VALUES (2227, 2227, 'job.nbi.syncNRM.remark', '定期同步网元资源数据任务', 'i18n_zh', '', '', '1', 'supervisor', 1721902269805, '', 0, '');
|
||||
REPLACE INTO `sys_dict_data` VALUES (2228, 2228, 'job.deleteExpiredNbiCm', '定期删除北向资源数据', 'i18n_zh', '', '', '1', 'supervisor', 1721902269805, '', 0, '');
|
||||
REPLACE INTO `sys_dict_data` VALUES (2229, 2229, 'job.deleteExpiredNbiCm.remark', '定期删除北向资源数据任务', 'i18n_zh', '', '', '1', 'supervisor', 1721902269805, '', 0, '');
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
@@ -733,9 +733,5 @@ INSERT INTO `sys_dict_data` VALUES (4222, 4222, 'dictData.trace_interfaces.17',
|
||||
INSERT INTO `sys_dict_data` VALUES (4223, 4223, 'dictData.trace_interfaces.20', 'N20', 'i18n_en', '', '', '1', 'supervisor', 1721902269805, '', 0, '');
|
||||
INSERT INTO `sys_dict_data` VALUES (4224, 4224, 'dictData.trace_interfaces.22', 'N22', 'i18n_en', '', '', '1', 'supervisor', 1721902269805, '', 0, '');
|
||||
INSERT INTO `sys_dict_data` VALUES (4225, 4225, 'dictData.trace_interfaces.40', 'N40', 'i18n_en', '', '', '1', 'supervisor', 1721902269805, '', 0, '');
|
||||
REPLACE INTO `sys_dict_data` VALUES (4226, 4226, 'job.nbi.syncNRM', 'Scheduled Synchronization of NEs Resource Data', 'i18n_en', '', '', '1', 'supervisor', 1721902269805, '', 0, '');
|
||||
REPLACE INTO `sys_dict_data` VALUES (4227, 4227, 'job.nbi.syncNRM.remark', 'Scheduled Task for Synchronization of NEs Resource Data', 'i18n_en', '', '', '1', 'supervisor', 1721902269805, '', 0, '');
|
||||
REPLACE INTO `sys_dict_data` VALUES (4228, 4228, 'job.deleteExpiredNbiCm', 'Scheduled Deletion of Northbound Resource Data', 'i18n_en', '', '', '1', 'supervisor', 1721902269805, '', 0, '');
|
||||
REPLACE INTO `sys_dict_data` VALUES (4229, 4229, 'job.deleteExpiredNbiCm.remark', 'Scheduled Task for Deleting Northbound Resource Data', 'i18n_en', '', '', '1', 'supervisor', 1721902269805, '', 0, '');
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
@@ -44,7 +44,5 @@ INSERT INTO `sys_job` VALUES (13, 'job.exportSMFCDR', 'SYSTEM', 'exportTable', '
|
||||
INSERT INTO `sys_job` VALUES (14, 'job.exportSMSCCDR', 'SYSTEM', 'exportTable', '{\"duration\":1,\"tableName\":\"cdr_event_smsc\",\"columns\":\"id,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.recordType\')) as record_type,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.serviceType\')) as service_type,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.callerParty\')) as caller_party,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.calledParty\')) as called_party,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.result\')) as result,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.updateTime\')) as update_time\",\"timeCol\":\"timestamp\",\"timeUnit\":\"second\",\"extras\":\"\",\"filePath\":\"/usr/local/omc/backup/smsc_cdr\"}', '0 0 0/1 * * ?', '3', '0', '1', '1', 'supervisor', 1698478134842, 'admin', 1724309047797, '');
|
||||
INSERT INTO `sys_job` VALUES (15, 'job.removeExportedFiles', 'SYSTEM', 'removeFile', '[{\"filePath\":\"/usr/local/omc/backup/operate_log\",\"maxDays\":30},{\"filePath\":\"/usr/local/omc/backup/ims_cdr\",\"maxDays\":30},{\"filePath\":\"/usr/local/omc/backup/smf_cdr\",\"maxDays\":30},{\"filePath\":\"/usr/local/omc/backup/smsc_cdr\",\"maxDays\":30}]', '0 10 0 * * ?', '3', '0', '1', '1', 'supervisor', 1698478134842, 'admin', 1728634085631, '');
|
||||
INSERT INTO `sys_job` VALUES (16, 'job.exportSGWCCDR', 'SYSTEM', 'exportTable', '{\"duration\":1,\"tableName\":\"cdr_event_sgwc\",\"columns\":\"id,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.recordType\')) as recordType,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.accessPointNameNI\')) as accessPointNameNI,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.servedIMSI\')) as IMSI,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.servedMSISDN\')) as MSISDN,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.servedPDPPDNAddress\')) as PdpAddress,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.duration\')) as duration,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.recordOpeningTime\')) as recordOpeningTime,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.chargingID\')) as chargingID,JSON_UNQUOTE(JSON_EXTRACT(cdr_json, \'$.listOfTrafficVolumes[0].dataVolumeGPRSDownlink\')) AS dataVolumeGPRSDownlink,JSON_UNQUOTE(JSON_EXTRACT(cdr_json, \'$.listOfTrafficVolumes[0].dataVolumeGPRsUplink\')) as dataVolumeGPRsUplink,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.userLocationInformation.tai.tac\')) as tac,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.userLocationInformation.ecgi.eutraCellId\')) as cellID\",\"timeCol\":\"timestamp\",\"timeUnit\":\"second\",\"extras\":\"\",\"filePath\":\"/usr/local/omc/backup/sgwc_cdr\"}', '0 0 0/1 * * ?', '3', '0', '1', '1', 'supervisor', 1698478134842, 'admin', 1724309047797, '');
|
||||
INSERT INTO `sys_job` VALUES (17, 'job.nbi.syncNRM', 'SYSTEM', 'syncNbiNRM', '', '0 0/5 * * * ?', '3', '0', '1', '1', 'system', 1698478134839, 'system', 1698478134839, 'job.nbi.syncNRM.remark');
|
||||
INSERT INTO `sys_job` VALUES (18, 'job.deleteExpiredNbiCm', 'SYSTEM', 'deleteExpiredRecord', '{\"duration\":30,\"tableName\":\"nbi_cm\",\"colName\":\"timestamp\",\"extras\":\"\"}', '0 40 0 * * ?', '3', '0', '1', '1', 'supervisor', 1698478134841, NULL, 0, 'job.deleteExpiredNbiCm.remark');
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
Navicat Premium Data Transfer
|
||||
|
||||
Source Server : root@192.168.2.165
|
||||
Source Server Type : MariaDB
|
||||
Source Server Version : 100335 (10.3.35-MariaDB)
|
||||
Source Host : 192.168.2.165:33066
|
||||
Source Schema : omc_db
|
||||
|
||||
Target Server Type : MariaDB
|
||||
Target Server Version : 100335 (10.3.35-MariaDB)
|
||||
File Encoding : 65001
|
||||
|
||||
Date: 26/05/2025 17:22:45
|
||||
*/
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for nbi_cm
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `nbi_cm`;
|
||||
CREATE TABLE `nbi_cm` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`ne_type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||||
`ne_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||||
`cm_version` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||||
`rm_uid` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||||
`event_type` enum('ObjectOriginalEvent','ObjectCreationEvent','ObjectDeletionEvent','ObjectAttributeValueChangeEvent') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'ObjectCreationEvent',
|
||||
`object_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||||
`value_json` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL,
|
||||
`timestamp` datetime NULL DEFAULT current_timestamp() ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
INDEX `idx-ne-id-rmuid`(`ne_type`, `ne_id`, `rm_uid`) USING BTREE,
|
||||
INDEX `idx-timestamp`(`timestamp`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 93 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
@@ -1,20 +0,0 @@
|
||||
SET NAMES utf8mb4;
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `alarm_relation` (
|
||||
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`root_alarm_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||||
`alarm_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||||
`relation_type` enum('derived','related') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '衍生关系:derived/related: 父子/兄弟',
|
||||
`add_info` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||||
`created_at` datetime NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||||
|
||||
ALTER TABLE `alarm_relation`
|
||||
DROP COLUMN IF EXISTS `updated_at`,
|
||||
DROP COLUMN IF EXISTS `deleted_at`,
|
||||
MODIFY COLUMN IF EXISTS `relation_type` enum('derived','related') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '衍生关系:derived/related: 父子/兄弟' AFTER `alarm_id`,
|
||||
MODIFY COLUMN IF EXISTS `created_at` datetime NULL DEFAULT NULL AFTER `add_info`;
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
@@ -1,46 +0,0 @@
|
||||
SET FOREIGN_KEY_CHECKS=0;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `nbi_cm` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`ne_type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||||
`ne_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||||
`cm_version` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||||
`rm_uid` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||||
`event_type` enum('ObjectOriginalEvent','ObjectCreationEvent','ObjectDeletionEvent','ObjectAttributeValueChangeEvent') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'ObjectCreationEvent',
|
||||
`object_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||||
`value_json` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL,
|
||||
`timestamp` datetime NULL DEFAULT current_timestamp() ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
INDEX `idx-ne-id-rmuid`(`ne_type`, `ne_id`, `rm_uid`) USING BTREE,
|
||||
INDEX `idx-timestamp`(`timestamp`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 93 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||||
|
||||
ALTER TABLE `nbi_cm` ADD COLUMN IF NOT EXISTS `event_type` enum('ObjectOriginalEvent','ObjectCreationEvent','ObjectDeletionEvent','ObjectAttributeValueChangeEvent') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'ObjectCreationEvent' AFTER `rm_uid`;
|
||||
|
||||
ALTER TABLE `nbi_cm` MODIFY COLUMN `ne_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL AFTER `ne_type`;
|
||||
|
||||
ALTER TABLE `nbi_cm` MODIFY COLUMN `value_json` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL AFTER `object_type`;
|
||||
|
||||
ALTER TABLE `nbi_cm` MODIFY COLUMN `timestamp` datetime NULL DEFAULT current_timestamp() ON UPDATE CURRENT_TIMESTAMP AFTER `value_json`;
|
||||
|
||||
ALTER TABLE `nbi_cm` DROP COLUMN IF EXISTS `time_zone`;
|
||||
|
||||
ALTER TABLE `nbi_cm` DROP COLUMN IF EXISTS `vendor_name`;
|
||||
|
||||
ALTER TABLE `nbi_cm` DROP COLUMN IF EXISTS `user_label`;
|
||||
|
||||
ALTER TABLE `nbi_cm` DROP COLUMN IF EXISTS `pv_flag`;
|
||||
|
||||
ALTER TABLE `nbi_cm` DROP COLUMN IF EXISTS `vm_id`;
|
||||
|
||||
ALTER TABLE `nbi_cm` DROP COLUMN IF EXISTS `vnf_instance_id`;
|
||||
|
||||
ALTER TABLE `nbi_cm` DROP COLUMN IF EXISTS `status`;
|
||||
|
||||
ALTER TABLE `nbi_cm`
|
||||
ADD INDEX IF NOT EXISTS `idx-ne-id-rmuid`(`ne_type`, `ne_id`, `rm_uid`) USING BTREE;
|
||||
|
||||
ALTER TABLE `nbi_cm`
|
||||
ADD INDEX `idx-timestamp`(`timestamp`) USING BTREE;
|
||||
|
||||
SET FOREIGN_KEY_CHECKS=1;
|
||||
@@ -47,6 +47,6 @@ ALTER TABLE `ne_license` DROP COLUMN IF EXISTS `created_at`;
|
||||
ALTER TABLE `ne_license` DROP COLUMN IF EXISTS `updated_at`;
|
||||
ALTER TABLE `ne_license` DROP COLUMN IF EXISTS `deleted_at`;
|
||||
ALTER TABLE `ne_license` ADD UNIQUE INDEX IF NOT EXISTS `uk_type_id`(`ne_type` ASC, `ne_id` ASC) USING BTREE COMMENT '唯一网元类型和网元ID';
|
||||
ALTER TABLE `ne_license` ADD COLUMN IF NOT EXISTS `capability` int NULL DEFAULT 0 AFTER `expiry_date`;
|
||||
|
||||
|
||||
SET FOREIGN_KEY_CHECKS=1;
|
||||
@@ -740,9 +740,5 @@ REPLACE INTO `sys_dict_data` VALUES (2222, 2222, 'dictData.trace_interfaces.17',
|
||||
REPLACE INTO `sys_dict_data` VALUES (2223, 2223, 'dictData.trace_interfaces.20', 'N20', 'i18n_zh', '', '', '1', 'supervisor', 1721902269805, '', 0, '');
|
||||
REPLACE INTO `sys_dict_data` VALUES (2224, 2224, 'dictData.trace_interfaces.22', 'N22', 'i18n_zh', '', '', '1', 'supervisor', 1721902269805, '', 0, '');
|
||||
REPLACE INTO `sys_dict_data` VALUES (2225, 2225, 'dictData.trace_interfaces.40', 'N40', 'i18n_zh', '', '', '1', 'supervisor', 1721902269805, '', 0, '');
|
||||
REPLACE INTO `sys_dict_data` VALUES (2226, 2226, 'job.nbi.syncNRM', '定期同步网元资源数据', 'i18n_zh', '', '', '1', 'supervisor', 1721902269805, '', 0, '');
|
||||
REPLACE INTO `sys_dict_data` VALUES (2227, 2227, 'job.nbi.syncNRM.remark', '定期同步网元资源数据任务', 'i18n_zh', '', '', '1', 'supervisor', 1721902269805, '', 0, '');
|
||||
REPLACE INTO `sys_dict_data` VALUES (2228, 2228, 'job.deleteExpiredNbiCm', '定期删除北向资源数据', 'i18n_zh', '', '', '1', 'supervisor', 1721902269805, '', 0, '');
|
||||
REPLACE INTO `sys_dict_data` VALUES (2229, 2229, 'job.deleteExpiredNbiCm.remark', '定期删除北向资源数据任务', 'i18n_zh', '', '', '1', 'supervisor', 1721902269805, '', 0, '');
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
@@ -739,9 +739,5 @@ REPLACE INTO `sys_dict_data` VALUES (4222, 4222, 'dictData.trace_interfaces.17',
|
||||
REPLACE INTO `sys_dict_data` VALUES (4223, 4223, 'dictData.trace_interfaces.20', 'N20', 'i18n_en', '', '', '1', 'supervisor', 1721902269805, '', 0, '');
|
||||
REPLACE INTO `sys_dict_data` VALUES (4224, 4224, 'dictData.trace_interfaces.22', 'N22', 'i18n_en', '', '', '1', 'supervisor', 1721902269805, '', 0, '');
|
||||
REPLACE INTO `sys_dict_data` VALUES (4225, 4225, 'dictData.trace_interfaces.40', 'N40', 'i18n_en', '', '', '1', 'supervisor', 1721902269805, '', 0, '');
|
||||
REPLACE INTO `sys_dict_data` VALUES (4226, 4226, 'job.nbi.syncNRM', 'Scheduled Synchronization of NEs Resource Data', 'i18n_en', '', '', '1', 'supervisor', 1721902269805, '', 0, '');
|
||||
REPLACE INTO `sys_dict_data` VALUES (4227, 4227, 'job.nbi.syncNRM.remark', 'Scheduled Task for Synchronization of NEs Resource Data', 'i18n_en', '', '', '1', 'supervisor', 1721902269805, '', 0, '');
|
||||
REPLACE INTO `sys_dict_data` VALUES (4228, 4228, 'job.deleteExpiredNbiCm', 'Scheduled Deletion of Northbound Resource Data', 'i18n_en', '', '', '1', 'supervisor', 1721902269805, '', 0, '');
|
||||
REPLACE INTO `sys_dict_data` VALUES (4229, 4229, 'job.deleteExpiredNbiCm.remark', 'Scheduled Task for Deleting Northbound Resource Data', 'i18n_en', '', '', '1', 'supervisor', 1721902269805, '', 0, '');
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
@@ -48,7 +48,5 @@ REPLACE INTO `sys_job` VALUES (13, 'job.exportSMFCDR', 'SYSTEM', 'exportTable',
|
||||
REPLACE INTO `sys_job` VALUES (14, 'job.exportSMSCCDR', 'SYSTEM', 'exportTable', '{\"duration\":1,\"tableName\":\"cdr_event_smsc\",\"columns\":\"id,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.recordType\')) as record_type,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.serviceType\')) as service_type,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.callerParty\')) as caller_party,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.calledParty\')) as called_party,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.result\')) as result,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.updateTime\')) as update_time\",\"timeCol\":\"timestamp\",\"timeUnit\":\"second\",\"extras\":\"\",\"filePath\":\"/usr/local/omc/backup/smsc_cdr\"}', '0 0 0/1 * * ?', '3', '0', '1', '1', 'supervisor', 1698478134842, 'admin', 1724309047797, '');
|
||||
REPLACE INTO `sys_job` VALUES (15, 'job.removeExportedFiles', 'SYSTEM', 'removeFile', '[{\"filePath\":\"/usr/local/omc/backup/operate_log\",\"maxDays\":30},{\"filePath\":\"/usr/local/omc/backup/ims_cdr\",\"maxDays\":30},{\"filePath\":\"/usr/local/omc/backup/smf_cdr\",\"maxDays\":30},{\"filePath\":\"/usr/local/omc/backup/smsc_cdr\",\"maxDays\":30}]', '0 10 0 * * ?', '3', '0', '1', '1', 'supervisor', 1698478134842, 'admin', 1728634085631, '');
|
||||
REPLACE INTO `sys_job` VALUES (16, 'job.exportSGWCCDR', 'SYSTEM', 'exportTable', '{\"duration\":1,\"tableName\":\"cdr_event_sgwc\",\"columns\":\"id,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.recordType\')) as recordType,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.accessPointNameNI\')) as accessPointNameNI,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.servedIMSI\')) as IMSI,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.servedMSISDN\')) as MSISDN,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.servedPDPPDNAddress\')) as PdpAddress,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.duration\')) as duration,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.recordOpeningTime\')) as recordOpeningTime,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.chargingID\')) as chargingID,JSON_UNQUOTE(JSON_EXTRACT(cdr_json, \'$.listOfTrafficVolumes[0].dataVolumeGPRSDownlink\')) AS dataVolumeGPRSDownlink,JSON_UNQUOTE(JSON_EXTRACT(cdr_json, \'$.listOfTrafficVolumes[0].dataVolumeGPRsUplink\')) as dataVolumeGPRsUplink,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.userLocationInformation.tai.tac\')) as tac,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.userLocationInformation.ecgi.eutraCellId\')) as cellID\",\"timeCol\":\"timestamp\",\"timeUnit\":\"second\",\"extras\":\"\",\"filePath\":\"/usr/local/omc/backup/sgwc_cdr\"}', '0 0 0/1 * * ?', '3', '0', '1', '1', 'supervisor', 1698478134842, 'admin', 1724309047797, '');
|
||||
REPLACE INTO `sys_job` VALUES (17, 'job.nbi.syncNRM', 'SYSTEM', 'syncNbiNRM', '', '0 0/5 * * * ?', '3', '0', '1', '1', 'system', 1698478134839, 'system', 1698478134839, 'job.nbi.syncNRM.remark');
|
||||
REPLACE INTO `sys_job` VALUES (18, 'job.deleteExpiredNbiCm', 'SYSTEM', 'deleteExpiredRecord', '{\"duration\":30,\"tableName\":\"nbi_cm\",\"colName\":\"timestamp\",\"extras\":\"\"}', '0 40 0 * * ?', '3', '0', '1', '1', 'supervisor', 1698478134841, NULL, 0, 'job.deleteExpiredNbiCm.remark');
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"be.ems/features/nbi/redisqueue"
|
||||
"be.ems/lib/config"
|
||||
"be.ems/lib/dborm"
|
||||
"be.ems/lib/global"
|
||||
@@ -450,12 +449,6 @@ func PostAlarmFromNF(w http.ResponseWriter, r *http.Request) {
|
||||
services.ResponseInternalServerError500DatabaseOperationFailed(w)
|
||||
continue
|
||||
}
|
||||
|
||||
// 推送到 redis 队列, for NBI ARALM notification
|
||||
err = redisqueue.AddAlarmQueue(alarmData.AlarmId)
|
||||
if err != nil {
|
||||
log.Warn("Failed to AddAlarmQueue:", err)
|
||||
}
|
||||
}
|
||||
alarmLog := new(AlarmLog)
|
||||
alarmLog.NeType = alarmData.NeType
|
||||
@@ -483,24 +476,6 @@ func PostAlarmFromNF(w http.ResponseWriter, r *http.Request) {
|
||||
log.Error("Failed to AlarmSMSForward:", err)
|
||||
}
|
||||
}
|
||||
if config.GetYamlConfig().Alarm.RelatedRules.Enabled {
|
||||
relatedId, found := JudgeRelated(&alarmData, session, config.RelationRules.Related)
|
||||
if found {
|
||||
id, err := InsertAlarmRelation(session, alarmData.AlarmId, relatedId, "related")
|
||||
if err != nil {
|
||||
log.Error("Failed to insert alarm relation:", err)
|
||||
}
|
||||
redisqueue.AddAlarmRelationQueue([]string{strconv.FormatInt(id, 10)})
|
||||
}
|
||||
derivedId, found := JudgeDerived(&alarmData, session)
|
||||
if found {
|
||||
id, err := InsertAlarmRelation(session, alarmData.AlarmId, derivedId, "derived")
|
||||
if err != nil {
|
||||
log.Error("Failed to insert alarm relation:", err)
|
||||
}
|
||||
redisqueue.AddAlarmRelationQueue([]string{strconv.FormatInt(id, 10)})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
services.ResponseStatusOK200Null(w)
|
||||
@@ -785,11 +760,6 @@ func GetAlarmFromNF(w http.ResponseWriter, r *http.Request) {
|
||||
log.Error("Failed to insert alarm:", err)
|
||||
continue
|
||||
}
|
||||
// 推送到 redis 队列, for NBI ARALM notification
|
||||
err = redisqueue.AddAlarmQueue(alarmData.AlarmId)
|
||||
if err != nil {
|
||||
log.Warn("Failed to AddAlarmQueue:", err)
|
||||
}
|
||||
}
|
||||
if err == nil && affected > 0 {
|
||||
alarmLog := new(AlarmLog)
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
package fm
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"be.ems/lib/config"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func JudgeDerived(alarm *Alarm, session *xorm.Session) (parentId string, found bool) {
|
||||
for _, rule := range config.RelationRules.Derived {
|
||||
if alarm.AlarmCode == rule.ChildCode {
|
||||
// 查询是否有 parent_code 的告警
|
||||
var parent Alarm
|
||||
has, _ := session.Table("alarm").
|
||||
Where("alarm_code=? AND ne_id=? AND alarm_status=1", rule.ParentCode, alarm.NeId).
|
||||
Get(&parent)
|
||||
if has {
|
||||
return parent.AlarmId, true
|
||||
}
|
||||
}
|
||||
}
|
||||
return "", false
|
||||
}
|
||||
|
||||
func JudgeRelated(alarm *Alarm, session *xorm.Session, rules []config.RelatedRule) (relatedId string, found bool) {
|
||||
for _, rule := range rules {
|
||||
// 1. 检查 ne_type 是否匹配
|
||||
if rule.NeType != "" && alarm.NeType != rule.NeType {
|
||||
continue
|
||||
}
|
||||
// 2. 检查 code 是否在 codes 列表
|
||||
codeMatch := false
|
||||
for _, c := range rule.Codes {
|
||||
if alarm.AlarmCode == c {
|
||||
codeMatch = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !codeMatch {
|
||||
continue
|
||||
}
|
||||
// 3. 查询同一ne_id、codes列表内、时间窗口内的其他告警
|
||||
var brother Alarm
|
||||
parsedTime, err := time.Parse(time.RFC3339, alarm.EventTime)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
timeStart := parsedTime.Add(-time.Duration(rule.TimeWindow) * time.Second)
|
||||
has, _ := session.Table("alarm").
|
||||
Where("ne_id=? AND alarm_code IN (?) AND event_time BETWEEN ? AND ? AND alarm_id!=?",
|
||||
alarm.NeId, rule.Codes, timeStart, alarm.EventTime, alarm.AlarmId).
|
||||
Get(&brother)
|
||||
if has {
|
||||
return brother.AlarmId, true
|
||||
}
|
||||
}
|
||||
return "", false
|
||||
}
|
||||
|
||||
type AlarmRelation struct {
|
||||
Id int64 `xorm:"pk autoincr 'id'"`
|
||||
AlarmId string `xorm:"alarm_id"`
|
||||
RelatedAlarmId string `xorm:"related_alarm_id"`
|
||||
RelationType string `xorm:"relation_type"`
|
||||
CreateAt time.Time `xorm:"create_at"`
|
||||
}
|
||||
|
||||
func InsertAlarmRelation(session *xorm.Session, alarmId, relatedId, relationType string) (int64, error) {
|
||||
relation := &AlarmRelation{
|
||||
AlarmId: alarmId,
|
||||
RelatedAlarmId: relatedId,
|
||||
RelationType: relationType,
|
||||
CreateAt: time.Now(),
|
||||
}
|
||||
_, err := session.Insert(relation)
|
||||
return relation.Id, err // 返回插入的ID
|
||||
}
|
||||
@@ -1,181 +0,0 @@
|
||||
package redisqueue
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
|
||||
"be.ems/lib/log"
|
||||
|
||||
redisdb "be.ems/src/framework/database/redis"
|
||||
"github.com/redis/go-redis/v9"
|
||||
)
|
||||
|
||||
const (
|
||||
// MaxMessages is the maximum number of messages to retain in each stream
|
||||
// This is set to 2000 as per the original code
|
||||
// It ensures that only the latest 2000 messages are kept in the stream
|
||||
// This helps in managing memory and performance by not allowing the stream to grow indefinitely
|
||||
// If you need to change this, make sure to update it in all relevant places
|
||||
// across the codebase to maintain consistency
|
||||
// and avoid unexpected behavior.
|
||||
// Note: This value should be consistent with the XTRIM command used in the code
|
||||
// to trim the stream.
|
||||
// If you change this value, also update the XTRIM command accordingly.
|
||||
maxMessages = 2000 // Maximum number of messages to retain in each stream
|
||||
)
|
||||
|
||||
// 写入 alarm_relation 消息
|
||||
func AddAlarmRelationQueue(ids []string) error {
|
||||
payload := map[string][]string{"ids": ids}
|
||||
payloadBytes, err := json.Marshal(payload)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
values := map[string]interface{}{
|
||||
"payload": string(payloadBytes),
|
||||
}
|
||||
|
||||
_, err = client.XAdd(ctx, &redis.XAddArgs{
|
||||
Stream: "alarm_relation",
|
||||
Values: values,
|
||||
}).Result()
|
||||
|
||||
// 只保留最新2000条消息
|
||||
client.XTrimMaxLen(context.Background(), "alarm_relation", maxMessages).Result()
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// 写入 alarm 消息
|
||||
func AddAlarmQueue(id string) error {
|
||||
payload := map[string]string{"id": id}
|
||||
payloadBytes, err := json.Marshal(payload)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
values := map[string]interface{}{
|
||||
"payload": string(payloadBytes),
|
||||
}
|
||||
|
||||
_, err = client.XAdd(ctx, &redis.XAddArgs{
|
||||
Stream: "alarm",
|
||||
Values: values,
|
||||
}).Result()
|
||||
|
||||
// 只保留最新2000条消息
|
||||
client.XTrimMaxLen(context.Background(), "alarm", maxMessages).Result()
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// 写入 nbi_cm 消息
|
||||
func AddNbiCMQueue(ids []string) error {
|
||||
payload := map[string][]string{"ids": ids}
|
||||
payloadBytes, err := json.Marshal(payload)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
values := map[string]interface{}{
|
||||
"payload": string(payloadBytes),
|
||||
}
|
||||
_, err = client.XAdd(ctx, &redis.XAddArgs{
|
||||
Stream: "nbi_cm",
|
||||
Values: values,
|
||||
}).Result()
|
||||
|
||||
// 只保留最新2000条消息
|
||||
client.XTrimMaxLen(context.Background(), "nbi_cm", maxMessages).Result()
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// 写入 kpi_report_xxx 消息
|
||||
func AddNbiKpiQueue(neType, id string) error {
|
||||
payload := map[string]string{"neType": neType, "id": id}
|
||||
payloadBytes, err := json.Marshal(payload)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
values := map[string]interface{}{
|
||||
"payload": string(payloadBytes),
|
||||
}
|
||||
_, err = client.XAdd(ctx, &redis.XAddArgs{
|
||||
Stream: "nbi_kpi",
|
||||
Values: values,
|
||||
}).Result()
|
||||
|
||||
// 只保留最新2000条消息
|
||||
client.XTrimMaxLen(context.Background(), "nbi_kpi", maxMessages).Result()
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// 写入 nbi_pm 消息
|
||||
func AddNbiPMQueueOrg(neType, id string) error {
|
||||
payload := map[string]string{"neType": neType, "id": id}
|
||||
payloadBytes, err := json.Marshal(payload)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
values := map[string]interface{}{
|
||||
"payload": string(payloadBytes),
|
||||
}
|
||||
_, err = client.XAdd(ctx, &redis.XAddArgs{
|
||||
Stream: "nbi_pm",
|
||||
Values: values,
|
||||
}).Result()
|
||||
|
||||
// 只保留最新2000条消息
|
||||
client.XTrimMaxLen(context.Background(), "nbi_pm", maxMessages).Result()
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// 写入 nbi_pm 消息
|
||||
func AddNbiPMQueue(id string) error {
|
||||
payload := map[string]string{"id": id}
|
||||
payloadBytes, err := json.Marshal(payload)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
values := map[string]interface{}{
|
||||
"payload": string(payloadBytes),
|
||||
}
|
||||
_, err = client.XAdd(ctx, &redis.XAddArgs{
|
||||
Stream: "nbi_pm",
|
||||
Values: values,
|
||||
}).Result()
|
||||
|
||||
// 只保留最新2000条消息
|
||||
client.XTrimMaxLen(context.Background(), "nbi_pm", maxMessages).Result()
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// 读取并打印指定 stream 的最新消息
|
||||
func ReadLatest(stream string) error {
|
||||
res, err := client.XRevRangeN(ctx, stream, "+", "-", 1).Result()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, msg := range res {
|
||||
log.Tracef("Stream: %s, ID: %s, Values: %v\n", stream, msg.ID, msg.Values)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var ctx = context.Background()
|
||||
var client *redis.Client
|
||||
|
||||
func InitRedisQueue() {
|
||||
// var cancel context.CancelFunc
|
||||
// ctx, cancel = context.WithTimeout(context.Background(), 5*time.Second)
|
||||
// defer cancel()
|
||||
client = redisdb.RDB("")
|
||||
}
|
||||
|
||||
func CloseRedisQueue() {
|
||||
if err := client.Close(); err != nil {
|
||||
log.Errorf("redis db close: %s", err)
|
||||
}
|
||||
}
|
||||
+29
-495
@@ -5,15 +5,11 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"math"
|
||||
"math/rand"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"be.ems/features/nbi/redisqueue"
|
||||
"be.ems/features/pm/kpi_c_report"
|
||||
"be.ems/features/pm/kpi_c_title"
|
||||
"be.ems/lib/config"
|
||||
@@ -342,12 +338,6 @@ func PostKPIReportFromNF(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
// 推送到redis队列
|
||||
err = redisqueue.AddNbiKpiQueue(kpiData.NEType, strconv.Itoa(kpiData.ID))
|
||||
if err != nil {
|
||||
log.Warn("Failed to AddNbiKpiQueue:", err)
|
||||
}
|
||||
|
||||
services.ResponseStatusOK204NoContent(w)
|
||||
}
|
||||
|
||||
@@ -936,449 +926,37 @@ func PatchMeasureTaskToNF(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
type Measurement struct {
|
||||
// Date is the measurement date in YYYY-MM-DD format (internal use only, omitted from JSON).
|
||||
Date string `json:"-" xorm:"date"`
|
||||
Index int `json:"Index"` // Index of 15-minute intervals (time granularity) in a day, range: 0~95
|
||||
// Timestamp represents the measurement time in Unix milliseconds, populated from measurement time.
|
||||
NeName string `json:"NeName"` // 网元用户标签(UserLabel),用于显示和唯一标识网元名称
|
||||
// RmUID is the unique identifier for the network element (unique per NE, used for database joins).
|
||||
RmUID string `json:"RmUID" xorm:"rm_uid"`
|
||||
// Dn is the Network Element Distinguished Name (DN), uniquely identifies the network element.
|
||||
// Format example: "RJN-CMZJ-TZ,SubNetwork=5GC88,ManagedElement=SMF53456,SmfFunction=53456"
|
||||
// Dn为网元唯一标识(DN),格式示例:"RJN-CMZJ-TZ,SubNetwork=5GC88,ManagedElement=SMF53456,SmfFunction=53456"
|
||||
Dn string `json:"Dn" xorm:"dn"`
|
||||
// TimeZone specifies the time zone for the measurement, e.g., "Asia/Shanghai" or "+08:00".
|
||||
Id int `json:"-" xorm:"pk 'id' autoincr"`
|
||||
Date string `json:"-" xorm:"date"`
|
||||
Index int `json:"Index"` // 1天中测量时间粒度(如15分钟)的切片索引: 0~95
|
||||
Timestamp string `json:"TimeStamp" xorm:"-"`
|
||||
NeName string `json:"NeName"` // UserLabel
|
||||
RmUID string `json:"RmUID" xorm:"rm_uid"`
|
||||
NeType string `json:"NeType"` // 网元类型
|
||||
PmVersion string `json:"PmVersion"` // 性能数据版本号
|
||||
Dn string `json:"Dn"` // (???)网元标识, 如:RJN-CMZJ-TZ,SubNetwork=5GC88,ManagedElement=SMF53456,SmfFunction=53456
|
||||
Period string `json:"Period"` // 测量时间粒度选项:5/15/30/60
|
||||
TimeZone string `json:"TimeZone"`
|
||||
NeType string `json:"NeType"` // 网元类型
|
||||
StartTime string `json:"StartTime"`
|
||||
// List of KPIs grouped by ObjectType.
|
||||
|
||||
Datas []Data `json:"Datas"`
|
||||
}
|
||||
|
||||
type KPIValue struct {
|
||||
Name string `json:"Name"` // "Total" is used for aggregate values; other names (e.g., "cmnet", "ims") are used for specific measurement items such as DNN names.
|
||||
Name string `json:"Name"` // 单个的写"Total", 或者指标项有多个测量项,如Dnn的名称写对应的Dnn"cmnet"/"ims"
|
||||
Value int64 `json:"Value"`
|
||||
}
|
||||
|
||||
type KPI struct {
|
||||
KPIID string `json:"KPIID"`
|
||||
KPIID string `json:"KPIID"` // 指标项, 如: SMF.AttCreatePduSession._Dnn
|
||||
KPIValues []KPIValue `json:"KPIValues"`
|
||||
}
|
||||
|
||||
type Data struct {
|
||||
ObjectType string `json:"ObjectType"` // 网络资源类别名称, Pm指标项列表中为空间粒度 如:SmfFunction
|
||||
KPIs []KPI `json:"KPIs"` // 指标项, 如: SMF.AttCreatePduSession._Dnn
|
||||
}
|
||||
|
||||
// 添加配置结构体
|
||||
// type PMConfig struct {
|
||||
// SchemaPath string `json:"schemaPath"` // schema文件路径
|
||||
// RandomMin int `json:"randomMin"` // 随机数最小值
|
||||
// RandomMax int `json:"randomMax"` // 随机数最大值
|
||||
// MergeMode string `json:"mergeMode"` // 合并模式: "merge"(合并), "none"(不合并), "schema"(仅schema随机值)
|
||||
// }
|
||||
|
||||
// 定义合并模式常量
|
||||
const (
|
||||
MergeModeNone = "none" // 不合并,仅使用网元发送的数据
|
||||
MergeModeMerge = "merge" // 合并模式,优先使用网元数据,缺失部分用随机值补充
|
||||
MergeModeSchema = "schema" // 仅使用schema数据,全部用随机值
|
||||
)
|
||||
|
||||
// 全局配置
|
||||
// SchemaPath should be configured per environment; by default, it uses "/home/simon/omc.git/be.ems/config/schema".
|
||||
// You can override this by setting the environment variable EMS_PM_SCHEMA_PATH.
|
||||
// var pmConfig = PMConfig{
|
||||
// SchemaPath: func() string {
|
||||
// if envPath := os.Getenv("EMS_PM_SCHEMA_PATH"); envPath != "" {
|
||||
// return envPath
|
||||
// }
|
||||
// return "/home/simon/omc.git/be.ems/config/schema"
|
||||
// }(),
|
||||
// RandomMin: 1,
|
||||
// RandomMax: 16,
|
||||
// MergeMode: MergeModeSchema,
|
||||
// }
|
||||
|
||||
// var pmConfig = PMConfig{
|
||||
// SchemaPath: config.GetNbiPmConfig().SchemaPath,
|
||||
// RandomMin: config.GetNbiPmConfig().RandomMin,
|
||||
// RandomMax: config.GetNbiPmConfig().RandomMax,
|
||||
// MergeMode: config.GetNbiPmConfig().MergeMode,
|
||||
// }
|
||||
|
||||
// schema数据结构
|
||||
type SchemaKPIValue struct {
|
||||
Name string `json:"Name"`
|
||||
Value int `json:"Value"`
|
||||
}
|
||||
|
||||
type SchemaKPI struct {
|
||||
KPIID string `json:"KPIID"`
|
||||
KPIValues []SchemaKPIValue `json:"KPIValues"`
|
||||
}
|
||||
|
||||
type SchemaObject struct {
|
||||
ObjectType string `json:"ObjectType"`
|
||||
KPIs []SchemaKPI `json:"KPIs"`
|
||||
}
|
||||
|
||||
type SchemaData []SchemaObject
|
||||
|
||||
// 读取schema文件
|
||||
func loadSchemaData(neType string) (*SchemaData, error) {
|
||||
schemaFile := filepath.Join(config.GetNbiPmConfig().SchemaPath, strings.ToLower(neType)+"-nbi-pm-schema.json")
|
||||
|
||||
if _, err := os.Stat(schemaFile); os.IsNotExist(err) {
|
||||
log.Warnf("Schema file not found: %s", schemaFile)
|
||||
return nil, nil // 文件不存在时返回 nil,不是错误
|
||||
}
|
||||
|
||||
data, err := os.ReadFile(schemaFile)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to read schema file: %v", err)
|
||||
}
|
||||
|
||||
var schema SchemaData
|
||||
if err := json.Unmarshal(data, &schema); err != nil {
|
||||
return nil, fmt.Errorf("failed to parse schema file: %v", err)
|
||||
}
|
||||
|
||||
return &schema, nil
|
||||
}
|
||||
|
||||
// 生成随机值
|
||||
func generateRandomKPIValue() int64 {
|
||||
return int64(rand.Intn(config.GetNbiPmConfig().RandomMax-config.GetNbiPmConfig().RandomMin+1) +
|
||||
config.GetNbiPmConfig().RandomMin)
|
||||
}
|
||||
|
||||
// 合并网元数据和schema数据
|
||||
func mergeWithSchema(measurement *dborm.NorthboundPm, schema *SchemaData) {
|
||||
if schema == nil {
|
||||
return
|
||||
}
|
||||
|
||||
switch config.GetNbiPmConfig().MergeMode {
|
||||
case MergeModeNone:
|
||||
// 不合并,直接返回
|
||||
log.Debug("Merge mode is 'none', skipping schema merge")
|
||||
return
|
||||
|
||||
case MergeModeSchema:
|
||||
// 仅使用schema数据,清空原有数据,全部用随机值
|
||||
log.Debug("Merge mode is 'schema', replacing all data with schema random values")
|
||||
measurement.Datas = nil
|
||||
generateSchemaOnlyData(measurement, schema)
|
||||
return
|
||||
|
||||
case MergeModeMerge:
|
||||
// 合并模式,优先使用网元数据,缺失部分用随机值补充
|
||||
log.Debug("Merge mode is 'merge', merging NE data with schema")
|
||||
mergeNeDataWithSchema(measurement, schema)
|
||||
return
|
||||
|
||||
default:
|
||||
log.Warnf("Unknown merge mode: %s, using default merge mode", config.GetNbiPmConfig().MergeMode)
|
||||
mergeNeDataWithSchema(measurement, schema)
|
||||
}
|
||||
}
|
||||
|
||||
// 仅使用schema数据生成随机值
|
||||
func generateSchemaOnlyData(measurement *dborm.NorthboundPm, schema *SchemaData) {
|
||||
for _, schemaObj := range *schema {
|
||||
newData := struct {
|
||||
ObjectType string `json:"ObjectType" xorm:"object_type"`
|
||||
PmDatas []struct {
|
||||
PmName string `json:"KPIID" xorm:"pm_name"`
|
||||
SubDatas []struct {
|
||||
SN string `json:"Name" xorm:"sn"`
|
||||
SV int64 `json:"Value" xorm:"sv"`
|
||||
} `json:"KPIValues" xorm:"sub_datas"`
|
||||
} `json:"KPIs" xorm:"pm_datas"`
|
||||
}{
|
||||
ObjectType: schemaObj.ObjectType,
|
||||
PmDatas: []struct {
|
||||
PmName string `json:"KPIID" xorm:"pm_name"`
|
||||
SubDatas []struct {
|
||||
SN string `json:"Name" xorm:"sn"`
|
||||
SV int64 `json:"Value" xorm:"sv"`
|
||||
} `json:"KPIValues" xorm:"sub_datas"`
|
||||
}{},
|
||||
}
|
||||
|
||||
// 遍历schema中的KPI
|
||||
for _, schemaKPI := range schemaObj.KPIs {
|
||||
newKPI := struct {
|
||||
PmName string `json:"KPIID" xorm:"pm_name"`
|
||||
SubDatas []struct {
|
||||
SN string `json:"Name" xorm:"sn"`
|
||||
SV int64 `json:"Value" xorm:"sv"`
|
||||
} `json:"KPIValues" xorm:"sub_datas"`
|
||||
}{
|
||||
PmName: schemaKPI.KPIID,
|
||||
SubDatas: []struct {
|
||||
SN string `json:"Name" xorm:"sn"`
|
||||
SV int64 `json:"Value" xorm:"sv"`
|
||||
}{},
|
||||
}
|
||||
|
||||
// 为每个KPI值生成随机数
|
||||
for _, schemaValue := range schemaKPI.KPIValues {
|
||||
randomValue := generateRandomKPIValue()
|
||||
newSubData := struct {
|
||||
SN string `json:"Name" xorm:"sn"`
|
||||
SV int64 `json:"Value" xorm:"sv"`
|
||||
}{
|
||||
SN: schemaValue.Name,
|
||||
SV: randomValue,
|
||||
}
|
||||
newKPI.SubDatas = append(newKPI.SubDatas, newSubData)
|
||||
log.Debugf("Generated schema random value for %s.%s: %d",
|
||||
schemaKPI.KPIID, schemaValue.Name, randomValue)
|
||||
}
|
||||
|
||||
if len(newKPI.SubDatas) > 0 {
|
||||
newData.PmDatas = append(newData.PmDatas, newKPI)
|
||||
}
|
||||
}
|
||||
|
||||
if len(newData.PmDatas) > 0 {
|
||||
measurement.Datas = append(measurement.Datas, newData)
|
||||
log.Debugf("Created ObjectType with schema data: %s (%d KPIs)",
|
||||
schemaObj.ObjectType, len(newData.PmDatas))
|
||||
}
|
||||
}
|
||||
|
||||
log.Debugf("Schema-only mode: generated %d object types", len(measurement.Datas))
|
||||
}
|
||||
|
||||
// 合并网元数据和schema数据(原有逻辑)
|
||||
func mergeNeDataWithSchema(measurement *dborm.NorthboundPm, schema *SchemaData) {
|
||||
// 创建网元已有数据的映射,用于快速查找
|
||||
neDataMap := make(map[string]map[string]map[string]int64) // ObjectType -> KPIID -> Name -> Value
|
||||
|
||||
for _, data := range measurement.Datas {
|
||||
if neDataMap[data.ObjectType] == nil {
|
||||
neDataMap[data.ObjectType] = make(map[string]map[string]int64)
|
||||
}
|
||||
|
||||
for _, pmData := range data.PmDatas {
|
||||
if neDataMap[data.ObjectType][pmData.PmName] == nil {
|
||||
neDataMap[data.ObjectType][pmData.PmName] = make(map[string]int64)
|
||||
}
|
||||
|
||||
for _, subData := range pmData.SubDatas {
|
||||
neDataMap[data.ObjectType][pmData.PmName][subData.SN] = subData.SV
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
log.Debugf("Original measurement data contains %d object types", len(measurement.Datas))
|
||||
|
||||
// 遍历schema,补充缺失的数据
|
||||
for _, schemaObj := range *schema {
|
||||
// 查找或创建对应的ObjectType
|
||||
var targetData *struct {
|
||||
ObjectType string `json:"ObjectType" xorm:"object_type"`
|
||||
PmDatas []struct {
|
||||
PmName string `json:"KPIID" xorm:"pm_name"`
|
||||
SubDatas []struct {
|
||||
SN string `json:"Name" xorm:"sn"`
|
||||
SV int64 `json:"Value" xorm:"sv"`
|
||||
} `json:"KPIValues" xorm:"sub_datas"`
|
||||
} `json:"KPIs" xorm:"pm_datas"`
|
||||
}
|
||||
|
||||
for i := range measurement.Datas {
|
||||
if measurement.Datas[i].ObjectType == schemaObj.ObjectType {
|
||||
targetData = &measurement.Datas[i]
|
||||
break
|
||||
}
|
||||
}
|
||||
// 如果没找到对应的ObjectType,创建新的
|
||||
if targetData == nil {
|
||||
newData := struct {
|
||||
ObjectType string `json:"ObjectType" xorm:"object_type"`
|
||||
PmDatas []struct {
|
||||
PmName string `json:"KPIID" xorm:"pm_name"`
|
||||
SubDatas []struct {
|
||||
SN string `json:"Name" xorm:"sn"`
|
||||
SV int64 `json:"Value" xorm:"sv"`
|
||||
} `json:"KPIValues" xorm:"sub_datas"`
|
||||
} `json:"KPIs" xorm:"pm_datas"`
|
||||
}{
|
||||
ObjectType: schemaObj.ObjectType,
|
||||
PmDatas: []struct {
|
||||
PmName string `json:"KPIID" xorm:"pm_name"`
|
||||
SubDatas []struct {
|
||||
SN string `json:"Name" xorm:"sn"`
|
||||
SV int64 `json:"Value" xorm:"sv"`
|
||||
} `json:"KPIValues" xorm:"sub_datas"`
|
||||
}{},
|
||||
}
|
||||
measurement.Datas = append(measurement.Datas, newData)
|
||||
targetData = &measurement.Datas[len(measurement.Datas)-1]
|
||||
log.Debugf("Created new ObjectType: %s", schemaObj.ObjectType)
|
||||
}
|
||||
|
||||
// 遍历schema中的KPI
|
||||
for _, schemaKPI := range schemaObj.KPIs {
|
||||
// 查找是否已存在该KPI
|
||||
var targetKPI *struct {
|
||||
PmName string `json:"KPIID" xorm:"pm_name"`
|
||||
SubDatas []struct {
|
||||
SN string `json:"Name" xorm:"sn"`
|
||||
SV int64 `json:"Value" xorm:"sv"`
|
||||
} `json:"KPIValues" xorm:"sub_datas"`
|
||||
}
|
||||
|
||||
for i := range targetData.PmDatas {
|
||||
if targetData.PmDatas[i].PmName == schemaKPI.KPIID {
|
||||
targetKPI = &targetData.PmDatas[i]
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// 如果没找到对应的KPI,创建新的
|
||||
if targetKPI == nil {
|
||||
newKPI := struct {
|
||||
PmName string `json:"KPIID" xorm:"pm_name"`
|
||||
SubDatas []struct {
|
||||
SN string `json:"Name" xorm:"sn"`
|
||||
SV int64 `json:"Value" xorm:"sv"`
|
||||
} `json:"KPIValues" xorm:"sub_datas"`
|
||||
}{
|
||||
PmName: schemaKPI.KPIID,
|
||||
SubDatas: []struct {
|
||||
SN string `json:"Name" xorm:"sn"`
|
||||
SV int64 `json:"Value" xorm:"sv"`
|
||||
}{},
|
||||
}
|
||||
targetData.PmDatas = append(targetData.PmDatas, newKPI)
|
||||
targetKPI = &targetData.PmDatas[len(targetData.PmDatas)-1]
|
||||
log.Debugf("Created new KPI: %s", schemaKPI.KPIID)
|
||||
}
|
||||
|
||||
// 遍历schema中的KPI值
|
||||
for _, schemaValue := range schemaKPI.KPIValues {
|
||||
// 检查是否已存在该值
|
||||
exists := false
|
||||
for i := range targetKPI.SubDatas {
|
||||
if targetKPI.SubDatas[i].SN == schemaValue.Name {
|
||||
exists = true
|
||||
// 如果网元没有提供该值,使用随机值
|
||||
if neDataMap[schemaObj.ObjectType] == nil ||
|
||||
neDataMap[schemaObj.ObjectType][schemaKPI.KPIID] == nil ||
|
||||
neDataMap[schemaObj.ObjectType][schemaKPI.KPIID][schemaValue.Name] == 0 {
|
||||
targetKPI.SubDatas[i].SV = generateRandomKPIValue()
|
||||
log.Debugf("Updated KPI %s.%s with random value: %d",
|
||||
schemaKPI.KPIID, schemaValue.Name, targetKPI.SubDatas[i].SV)
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// 如果不存在,添加新的值
|
||||
if !exists {
|
||||
var value int64
|
||||
// 优先使用网元发送的值
|
||||
if neDataMap[schemaObj.ObjectType] != nil &&
|
||||
neDataMap[schemaObj.ObjectType][schemaKPI.KPIID] != nil &&
|
||||
neDataMap[schemaObj.ObjectType][schemaKPI.KPIID][schemaValue.Name] != 0 {
|
||||
value = neDataMap[schemaObj.ObjectType][schemaKPI.KPIID][schemaValue.Name]
|
||||
log.Debugf("Using NE provided value for %s.%s: %d",
|
||||
schemaKPI.KPIID, schemaValue.Name, value)
|
||||
} else {
|
||||
value = generateRandomKPIValue()
|
||||
log.Debugf("Generated random value for %s.%s: %d",
|
||||
schemaKPI.KPIID, schemaValue.Name, value)
|
||||
}
|
||||
|
||||
newSubData := struct {
|
||||
SN string `json:"Name" xorm:"sn"`
|
||||
SV int64 `json:"Value" xorm:"sv"`
|
||||
}{
|
||||
SN: schemaValue.Name,
|
||||
SV: value,
|
||||
}
|
||||
targetKPI.SubDatas = append(targetKPI.SubDatas, newSubData)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add this function before mergeNeDataWithSchema
|
||||
func mergeDuplicateObjectTypes(measurement *dborm.NorthboundPm) {
|
||||
if len(measurement.Datas) <= 1 {
|
||||
return
|
||||
}
|
||||
|
||||
// Create a map to group data by ObjectType
|
||||
objectTypeMap := make(map[string]*struct {
|
||||
ObjectType string `json:"ObjectType" xorm:"object_type"`
|
||||
PmDatas []struct {
|
||||
PmName string `json:"KPIID" xorm:"pm_name"`
|
||||
SubDatas []struct {
|
||||
SN string `json:"Name" xorm:"sn"`
|
||||
SV int64 `json:"Value" xorm:"sv"`
|
||||
} `json:"KPIValues" xorm:"sub_datas"`
|
||||
} `json:"KPIs" xorm:"pm_datas"`
|
||||
})
|
||||
|
||||
// Group data by ObjectType
|
||||
for _, data := range measurement.Datas {
|
||||
if existingData, exists := objectTypeMap[data.ObjectType]; exists {
|
||||
// Merge PmDatas - check for duplicate KPIs
|
||||
kpiMap := make(map[string]*struct {
|
||||
PmName string `json:"KPIID" xorm:"pm_name"`
|
||||
SubDatas []struct {
|
||||
SN string `json:"Name" xorm:"sn"`
|
||||
SV int64 `json:"Value" xorm:"sv"`
|
||||
} `json:"KPIValues" xorm:"sub_datas"`
|
||||
})
|
||||
|
||||
// Index existing KPIs
|
||||
for i := range existingData.PmDatas {
|
||||
kpiMap[existingData.PmDatas[i].PmName] = &existingData.PmDatas[i]
|
||||
}
|
||||
|
||||
// Merge new KPIs
|
||||
for _, newPmData := range data.PmDatas {
|
||||
if existingKpi, exists := kpiMap[newPmData.PmName]; exists {
|
||||
// Merge SubDatas for existing KPI
|
||||
subDataMap := make(map[string]bool)
|
||||
for _, subData := range existingKpi.SubDatas {
|
||||
subDataMap[subData.SN] = true
|
||||
}
|
||||
|
||||
// Add new SubDatas that don't exist
|
||||
for _, newSubData := range newPmData.SubDatas {
|
||||
if !subDataMap[newSubData.SN] {
|
||||
existingKpi.SubDatas = append(existingKpi.SubDatas, newSubData)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Add new KPI
|
||||
existingData.PmDatas = append(existingData.PmDatas, newPmData)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Create new entry for this ObjectType
|
||||
objectTypeMap[data.ObjectType] = &data
|
||||
}
|
||||
}
|
||||
|
||||
// Replace measurement.Datas with merged data
|
||||
measurement.Datas = nil
|
||||
for _, mergedData := range objectTypeMap {
|
||||
measurement.Datas = append(measurement.Datas, *mergedData)
|
||||
}
|
||||
|
||||
log.Debugf("Merged duplicate ObjectTypes: original count %d, merged count %d",
|
||||
len(measurement.Datas), len(objectTypeMap))
|
||||
}
|
||||
|
||||
// process measurement post message from NFs
|
||||
func PostMeasurementFromNF(w http.ResponseWriter, r *http.Request) {
|
||||
log.Debug("PostMeasurementFromNF processing... ")
|
||||
@@ -1397,49 +975,19 @@ func PostMeasurementFromNF(w http.ResponseWriter, r *http.Request) {
|
||||
services.ResponseNotFound404UriNotExist(w, r)
|
||||
return
|
||||
}
|
||||
//log.Debug("Request body:", string(body))
|
||||
log.Debug("Request body:", string(body))
|
||||
// measurement := new(dborm.NorthboundPm)
|
||||
measurement := new(dborm.NorthboundPm)
|
||||
_ = json.Unmarshal(body, &measurement)
|
||||
log.Debug("measurement:", measurement)
|
||||
|
||||
// Merge duplicate ObjectTypes before processing
|
||||
mergeDuplicateObjectTypes(measurement)
|
||||
|
||||
neInfo, err := dborm.XormGetNeInfoByRmUID(measurement.NeType, measurement.RmUID)
|
||||
if err != nil {
|
||||
log.Error("dborm.XormGetNeInfo is failed:", err)
|
||||
services.ResponseInternalServerError500DatabaseOperationFailed(w)
|
||||
return
|
||||
}
|
||||
if neInfo == nil {
|
||||
log.Error("Not found target NE neType:", measurement.NeType, "RmUID:", measurement.RmUID)
|
||||
services.ResponseNotFound404UriNotExist(w, r)
|
||||
return
|
||||
}
|
||||
measurement.NeName = neInfo.NeName
|
||||
measurement.Dn = neInfo.Dn
|
||||
|
||||
// 加载schema数据并进行合并
|
||||
if config.GetNbiPmConfig().MergeMode != MergeModeNone {
|
||||
log.Debugf("Loading schema for neType: %s (mode: %s)", measurement.NeType, config.GetNbiPmConfig().MergeMode)
|
||||
schema, err := loadSchemaData(measurement.NeType)
|
||||
if err != nil {
|
||||
log.Warnf("Failed to load schema for %s: %v", measurement.NeType, err)
|
||||
} else if schema != nil {
|
||||
log.Debugf("Successfully loaded schema for %s, processing with mode: %s", measurement.NeType, config.GetNbiPmConfig().MergeMode)
|
||||
mergeWithSchema(measurement, schema)
|
||||
log.Debug("Data processing completed")
|
||||
} else {
|
||||
log.Debugf("No schema file found for %s, using original data", measurement.NeType)
|
||||
}
|
||||
}
|
||||
|
||||
session := xEngine.NewSession()
|
||||
session := dborm.DbClient.XEngine.NewSession()
|
||||
defer session.Close()
|
||||
|
||||
// layout := global.DateTime
|
||||
layout := time.RFC3339
|
||||
measurement.Date = GetDateFromTimeString(layout, measurement.StartTime)
|
||||
measurement.StartTime = GetDateTimeFromTimeString(layout, measurement.StartTime)
|
||||
|
||||
affected, err := session.Table("nbi_pm").Insert(measurement)
|
||||
if err != nil && affected <= 0 {
|
||||
log.Error("Failed to insert nbi_pm:", err)
|
||||
@@ -1447,12 +995,6 @@ func PostMeasurementFromNF(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
// 推送到redis队列
|
||||
err = redisqueue.AddNbiPMQueue(strconv.Itoa(measurement.Id))
|
||||
if err != nil {
|
||||
log.Warn("Failed to AddNbiPMQueue:", err)
|
||||
}
|
||||
|
||||
services.ResponseStatusOK204NoContent(w)
|
||||
}
|
||||
|
||||
@@ -1460,6 +1002,12 @@ func PostMeasurementFromNF(w http.ResponseWriter, r *http.Request) {
|
||||
func GetMeasurementFromNF(w http.ResponseWriter, r *http.Request) {
|
||||
log.Debug("GetMeasurementFromNF processing... ")
|
||||
|
||||
// _, err := services.CheckFrontValidRequest(w, r)
|
||||
// if err != nil {
|
||||
// log.Error("Request error:", err)
|
||||
// return
|
||||
// }
|
||||
|
||||
vars := mux.Vars(r)
|
||||
apiVer := vars["apiVersion"]
|
||||
if apiVer != global.ApiVersionV1 {
|
||||
@@ -1483,7 +1031,9 @@ func GetMeasurementFromNF(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
log.Debugf("neType: %s neId:%s", neType, neIds)
|
||||
|
||||
//var neInfo *dborm.NeInfo
|
||||
neInfo := new(dborm.NeInfo)
|
||||
|
||||
neInfo, err := dborm.XormGetNeInfo(neType, neIds[0])
|
||||
if err != nil {
|
||||
log.Error("dborm.XormGetNeInfo is failed:", err)
|
||||
@@ -1510,26 +1060,10 @@ func GetMeasurementFromNF(w http.ResponseWriter, r *http.Request) {
|
||||
switch response.StatusCode() {
|
||||
case http.StatusOK, http.StatusCreated, http.StatusNoContent, http.StatusAccepted:
|
||||
log.Debug("response:", response)
|
||||
// measurement := new(dborm.NorthboundPm)
|
||||
measurement := new(dborm.NorthboundPm)
|
||||
_ = json.Unmarshal(response.Body(), &measurement)
|
||||
|
||||
// Merge duplicate ObjectTypes before processing
|
||||
mergeDuplicateObjectTypes(measurement)
|
||||
|
||||
// Load schema and merge if needed
|
||||
if config.GetNbiPmConfig().MergeMode != MergeModeNone {
|
||||
log.Debugf("Loading schema for neType: %s (mode: %s)", measurement.NeType, config.GetNbiPmConfig().MergeMode)
|
||||
schema, err := loadSchemaData(measurement.NeType)
|
||||
if err != nil {
|
||||
log.Warnf("Failed to load schema for %s: %v", measurement.NeType, err)
|
||||
} else if schema != nil {
|
||||
log.Debugf("Successfully loaded schema for %s, processing with mode: %s", measurement.NeType, config.GetNbiPmConfig().MergeMode)
|
||||
mergeWithSchema(measurement, schema)
|
||||
log.Debug("Data processing completed")
|
||||
} else {
|
||||
log.Debugf("No schema file found for %s, using original data", measurement.NeType)
|
||||
}
|
||||
}
|
||||
log.Debug("measurement:", measurement)
|
||||
|
||||
session := dborm.DbClient.XEngine.NewSession()
|
||||
defer session.Close()
|
||||
|
||||
@@ -37,15 +37,12 @@ require (
|
||||
golang.org/x/term v0.28.0
|
||||
golang.org/x/text v0.21.0
|
||||
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
|
||||
gopkg.in/yaml.v2 v2.4.0
|
||||
gopkg.in/yaml.v3 v3.0.1
|
||||
gorm.io/driver/mysql v1.5.7
|
||||
gorm.io/gorm v1.25.11
|
||||
xorm.io/xorm v1.3.9
|
||||
)
|
||||
|
||||
require github.com/google/go-cmp v0.6.0 // indirect
|
||||
|
||||
require (
|
||||
filippo.io/edwards25519 v1.1.0 // indirect
|
||||
github.com/KyleBanks/depth v1.2.1 // indirect
|
||||
@@ -70,7 +67,7 @@ require (
|
||||
github.com/go-openapi/swag v0.23.0 // indirect
|
||||
github.com/go-playground/locales v0.14.1 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||
github.com/go-playground/validator/v10 v10.22.0
|
||||
github.com/go-playground/validator/v10 v10.22.0 // indirect
|
||||
github.com/goccy/go-json v0.10.3 // indirect
|
||||
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
|
||||
github.com/golang/snappy v0.0.4 // indirect
|
||||
|
||||
@@ -1,24 +1,10 @@
|
||||
cloud.google.com/go v0.112.1/go.mod h1:+Vbu+Y1UU+I1rjmzeMOb/8RfkKJK2Gyxi1X6jJCZLo4=
|
||||
cloud.google.com/go/compute v1.24.0/go.mod h1:kw1/T+h/+tK2LJK0wiPPx1intgdAM3j/g3hFDlscY40=
|
||||
cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA=
|
||||
cloud.google.com/go/firestore v1.15.0/go.mod h1:GWOxFXcv8GZUtYpWHw/w6IuYNux/BtmeVTMmjrm4yhk=
|
||||
cloud.google.com/go/iam v1.1.5/go.mod h1:rB6P/Ic3mykPbFio+vo7403drjlgvoWfYpJhMXEbzv8=
|
||||
cloud.google.com/go/longrunning v0.5.5/go.mod h1:WV2LAxD8/rg5Z1cNW6FJ/ZpX4E4VnDnoTk0yawPBB7s=
|
||||
cloud.google.com/go/storage v1.35.1/go.mod h1:M6M/3V/D3KpzMTJyPOR/HU6n2Si5QdaXYEsng2xgOs8=
|
||||
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
|
||||
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
|
||||
gitea.com/xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a h1:lSA0F4e9A2NcQSqGqTOXqu2aRi/XEQxDCBwM8yJtE6s=
|
||||
gitea.com/xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a/go.mod h1:EXuID2Zs0pAQhH8yz+DNjUbjppKQzKFAn28TMYPB6IU=
|
||||
gitee.com/travelliu/dm v1.8.11192/go.mod h1:DHTzyhCrM843x9VdKVbZ+GKXGRbKM2sJ4LxihRxShkE=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc=
|
||||
github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE=
|
||||
github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
|
||||
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
|
||||
github.com/alecthomas/kingpin/v2 v2.4.0/go.mod h1:0gyi0zQnjuFk8xrkNKamJoyUo382HRL7ATRpFZCw6tE=
|
||||
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE=
|
||||
github.com/allegro/bigcache/v3 v3.1.0/go.mod h1:aPyh7jEvrog9zAwx5N7+JUQX5dZTSGpxF1LAR4dr35I=
|
||||
github.com/armon/go-metrics v0.4.1/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4=
|
||||
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
||||
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
||||
github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs=
|
||||
@@ -34,13 +20,10 @@ github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UF
|
||||
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
github.com/chenjiandongx/ginprom v0.0.0-20210617023641-6c809602c38a h1:yTfhjWYoPomJkHVArtNHpo36FuOa6Kc2ZjTLvyyQ5Lg=
|
||||
github.com/chenjiandongx/ginprom v0.0.0-20210617023641-6c809602c38a/go.mod h1:lINNCb1ZH3c0uL/9ApaQ8muR4QILsi0STj8Ojt8ZmwU=
|
||||
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk=
|
||||
github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y=
|
||||
github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=
|
||||
github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg=
|
||||
github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY=
|
||||
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
|
||||
github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
@@ -56,8 +39,6 @@ github.com/ebitengine/purego v0.8.1 h1:sdRKd6plj7KYW33EH5As6YKfe8m9zbN9JMrOjNVF/
|
||||
github.com/ebitengine/purego v0.8.1/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ=
|
||||
github.com/fastly/go-utils v0.0.0-20180712184237-d95a45783239 h1:Ghm4eQYC0nEPnSJdVkTrXpu9KtoVCSo1hg7mtI7G9KU=
|
||||
github.com/fastly/go-utils v0.0.0-20180712184237-d95a45783239/go.mod h1:Gdwt2ce0yfBxPvZrHkprdPPTTS3N5rwmLE8T22KBXlw=
|
||||
github.com/fatih/color v1.14.1/go.mod h1:2oHN61fhTpgcxD3TSWCgKDiH1+x4OiDVVGH8WlgGZGg=
|
||||
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
|
||||
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
|
||||
github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
@@ -74,10 +55,6 @@ github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU=
|
||||
github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y=
|
||||
github.com/go-forks/fsnotify v1.4.7 h1:lyiU2Wqd4fNGCQDn9dZ4UxSiSFgeU1rM6yIfahk8haY=
|
||||
github.com/go-forks/fsnotify v1.4.7/go.mod h1:AU8mot+GznW5+B4jRJHxKg/2EeO+jMORGRkKSxs0biw=
|
||||
github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0=
|
||||
github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
|
||||
github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
|
||||
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
|
||||
github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE=
|
||||
github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78=
|
||||
@@ -105,14 +82,10 @@ github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqw
|
||||
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
|
||||
github.com/goccy/go-json v0.10.3 h1:KZ5WoDbxAIgm2HNbYckL0se1fHD6rz5j4ywS6ebzDqA=
|
||||
github.com/goccy/go-json v0.10.3/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
|
||||
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
|
||||
github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk=
|
||||
github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
|
||||
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
|
||||
github.com/golang-sql/sqlexp v0.1.0/go.mod h1:J4ad9Vo8ZCWQ2GMrC4UCQy1JpCbwU9m3EOqtpKwwwHI=
|
||||
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g=
|
||||
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=
|
||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
|
||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
|
||||
@@ -121,7 +94,6 @@ github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrU
|
||||
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
|
||||
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
|
||||
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
||||
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
|
||||
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
@@ -134,12 +106,8 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/gopacket v1.1.19/go.mod h1:iJ8V8n6KS+z2U1A8pUwu8bW5SyEMkXJB8Yo/Vo+TKTo=
|
||||
github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.3.2/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0=
|
||||
github.com/googleapis/gax-go/v2 v2.12.3/go.mod h1:AKloxT6GtNbaLm8QTNSidHUVsHYcBHwWRvkNFJUQcS4=
|
||||
github.com/googleapis/google-cloud-go-testing v0.0.0-20210719221736-1c9a4c676720/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g=
|
||||
github.com/gopacket/gopacket v1.2.0 h1:eXbzFad7f73P1n2EJHQlsKuvIMJjVXK5tXoSca78I3A=
|
||||
github.com/gopacket/gopacket v1.2.0/go.mod h1:BrAKEy5EOGQ76LSqh7DMAr7z0NNPdczWm2GxCG7+I8M=
|
||||
github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
|
||||
@@ -149,26 +117,9 @@ github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/ad
|
||||
github.com/gosnmp/gosnmp v1.36.2-0.20231009064202-d306ed5aa998/go.mod h1:O938QjIS4vpSag1UTcnnBq9MfNmimuOGtvQsT1NbErc=
|
||||
github.com/gosnmp/gosnmp v1.38.0 h1:I5ZOMR8kb0DXAFg/88ACurnuwGwYkXWq3eLpJPHMEYc=
|
||||
github.com/gosnmp/gosnmp v1.38.0/go.mod h1:FE+PEZvKrFz9afP9ii1W3cprXuVZ17ypCcyyfYuu5LY=
|
||||
github.com/hashicorp/consul/api v1.28.2/go.mod h1:KyzqzgMEya+IZPcD65YFoOVAgPpbfERu4I/tzG6/ueE=
|
||||
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
|
||||
github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M=
|
||||
github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
|
||||
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
|
||||
github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8=
|
||||
github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
|
||||
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
|
||||
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
||||
github.com/hashicorp/serf v0.10.1/go.mod h1:yL2t6BqATOLGc5HF7qbFkTfXoPIY0WZdWHfEvMqbG+4=
|
||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||
github.com/jackc/chunkreader/v2 v2.0.1/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk=
|
||||
github.com/jackc/pgconn v1.14.0/go.mod h1:9mBNlny0UvkgJdCDvdVHYSjI+8tD2rnKK69Wz8ti++E=
|
||||
github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8=
|
||||
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
|
||||
github.com/jackc/pgproto3/v2 v2.3.2/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA=
|
||||
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
|
||||
github.com/jackc/pgtype v1.14.0/go.mod h1:LUMuVrfsFfdKGLw+AFFVv6KtHOFMwRgDDzBt76IqCA4=
|
||||
github.com/jackc/pgx/v4 v4.18.0/go.mod h1:FydWkUyadDmdNH/mHnGob881GawxeEm7TcMCzkb+qQE=
|
||||
github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869 h1:IPJ3dvxmJ4uczJe5YQdrYB16oTJlGSC/OyZDqUk9xX4=
|
||||
github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869/go.mod h1:cJ6Cj7dQo+O6GJNiMx+Pa94qKj+TG8ONdKHgMNIyyag=
|
||||
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
|
||||
@@ -179,10 +130,8 @@ github.com/jonboulle/clockwork v0.4.0 h1:p4Cf1aMWXnXAUh8lVfewRBx1zaTSYKrKMF2g3ST
|
||||
github.com/jonboulle/clockwork v0.4.0/go.mod h1:xgRqUGwRcjKCO1vbZUEtSLrqKoPSsUpK7fnezOII0kc=
|
||||
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
|
||||
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
|
||||
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
|
||||
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
||||
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
|
||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
|
||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
|
||||
github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA=
|
||||
@@ -209,7 +158,6 @@ github.com/lestrrat/go-file-rotatelogs v0.0.0-20180223000712-d3151e2a480f h1:sgU
|
||||
github.com/lestrrat/go-file-rotatelogs v0.0.0-20180223000712-d3151e2a480f/go.mod h1:UGmTpUd3rjbtfIpwAPrcfmGf/Z1HS95TATB+m57TPB8=
|
||||
github.com/lestrrat/go-strftime v0.0.0-20180220042222-ba3bf9c1d042 h1:Bvq8AziQ5jFF4BHGAEDSqwPW1NJS3XshxbRCxtjFAZc=
|
||||
github.com/lestrrat/go-strftime v0.0.0-20180220042222-ba3bf9c1d042/go.mod h1:TPpsiPUEh0zFL1Snz4crhMlBe60PYxRHr5oFF3rRYg0=
|
||||
github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
|
||||
github.com/linxGnu/gosmpp v0.3.0 h1:LL+eY+zc9Ei/YY0po9A6L6SHf8nPyGvqsLddttr/y/4=
|
||||
github.com/linxGnu/gosmpp v0.3.0/go.mod h1:Ba6SULQql3IbF2A5Mtj3DqMKoFbx1pEz/8xyiOh8ZOs=
|
||||
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I=
|
||||
@@ -221,7 +169,6 @@ github.com/mailru/easyjson v0.9.0 h1:PrnmzHw7262yW8sTBwxi1PdJA3Iw/EKBa8psRf7d9a4
|
||||
github.com/mailru/easyjson v0.9.0/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU=
|
||||
github.com/matoous/go-nanoid/v2 v2.1.0 h1:P64+dmq21hhWdtvZfEAofnvJULaRR1Yib0+PnU669bE=
|
||||
github.com/matoous/go-nanoid/v2 v2.1.0/go.mod h1:KlbGNQ+FhrUNIHUxZdL63t7tl4LaPkZNpUULS8H4uVM=
|
||||
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
|
||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y=
|
||||
@@ -230,8 +177,6 @@ github.com/metaleap/go-util v0.0.0-20180330192724-a09253046f73 h1:4vKVhAdype/dej
|
||||
github.com/metaleap/go-util v0.0.0-20180330192724-a09253046f73/go.mod h1:l71/5fppWP5A6nqhcxz6wQAYok6pr/vM2+KHIy50/LY=
|
||||
github.com/metaleap/go-xsd v0.0.0-20180330193350-61f7638f502f h1:eeJGcYszuvOpmuJxeq57LaOO8mJurfjpOHJJMfQSD0s=
|
||||
github.com/metaleap/go-xsd v0.0.0-20180330193350-61f7638f502f/go.mod h1:WK3zEKtwVd/v+NM3lh1ZE6MdDfHsdOFFOD5Ezi4Hutg=
|
||||
github.com/microsoft/go-mssqldb v1.6.0/go.mod h1:00mDtPbeQCRGC1HwOOR5K/gr30P1NcEG0vx6Kbv2aJU=
|
||||
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
||||
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
|
||||
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
@@ -247,10 +192,6 @@ github.com/mssola/useragent v1.0.0 h1:WRlDpXyxHDNfvZaPEut5Biveq86Ze4o4EMffyMxmH5
|
||||
github.com/mssola/useragent v1.0.0/go.mod h1:hz9Cqz4RXusgg1EdI4Al0INR62kP7aPSRNHnpU+b85Y=
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
|
||||
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||
github.com/nats-io/nats.go v1.34.0/go.mod h1:Ubdu4Nh9exXdSz0RVWRFBbRfrbSxOYd26oF0wkWclB8=
|
||||
github.com/nats-io/nkeys v0.4.7/go.mod h1:kqXRgRDPlGy7nGaEDMuYzmiJCIAAWDK0IMBtDmGD0nc=
|
||||
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
|
||||
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
|
||||
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
|
||||
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
|
||||
@@ -259,7 +200,6 @@ github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W
|
||||
github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
|
||||
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
|
||||
github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU=
|
||||
github.com/onsi/ginkgo/v2 v2.1.6/go.mod h1:MEH45j8TBi6u9BMogfbp0stKC5cdGjumZj5Y7AG4VIk=
|
||||
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
|
||||
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
|
||||
@@ -306,7 +246,6 @@ github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzG
|
||||
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
|
||||
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
|
||||
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/sagikazarmark/crypt v0.19.0/go.mod h1:c6vimRziqqERhtSe0MhIvzE1w54FrCHtrXb5NH/ja78=
|
||||
github.com/sagikazarmark/locafero v0.6.0 h1:ON7AQg37yzcRPU69mt7gwhFEBwxI6P9T4Qu3N51bwOk=
|
||||
github.com/sagikazarmark/locafero v0.6.0/go.mod h1:77OmuIc6VTraTXKXIs/uvUxKGUXjE1GbemJYHqdNjX0=
|
||||
github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE=
|
||||
@@ -319,7 +258,6 @@ github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFt
|
||||
github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ=
|
||||
github.com/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU=
|
||||
github.com/shoenig/test v0.6.4/go.mod h1:byHiCGXqrVaflBLAMq/srcZIHynQPQgeyvkvXnjqq0k=
|
||||
github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
|
||||
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
||||
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
|
||||
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
||||
@@ -374,12 +312,10 @@ github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2
|
||||
github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE=
|
||||
github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
|
||||
github.com/urfave/cli/v2 v2.1.1/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ=
|
||||
github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI=
|
||||
github.com/vishvananda/netlink v1.1.0 h1:1iyaYNBLmP6L0220aDnYQpo1QEV4t4hJ+xEEhhJH8j0=
|
||||
github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE=
|
||||
github.com/vishvananda/netns v0.0.0-20211101163701-50045581ed74 h1:gga7acRE695APm9hlsSMoOoE65U4/TcqNj90mc69Rlg=
|
||||
github.com/vishvananda/netns v0.0.0-20211101163701-50045581ed74/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0=
|
||||
github.com/xhit/go-str2duration/v2 v2.1.0/go.mod h1:ohY8p+0f07DiV6Em5LKB0s2YpLtXVyJfNt1+BlmyAsU=
|
||||
github.com/xuri/efp v0.0.0-20240408161823-9ad904a10d6d h1:llb0neMWDQe87IzJLS4Ci7psK/lVsjIS2otl+1WyRyY=
|
||||
github.com/xuri/efp v0.0.0-20240408161823-9ad904a10d6d/go.mod h1:ybY/Jr0T0GTCnYjKqmdwxyxn2BQf2RcQIIvex5QldPI=
|
||||
github.com/xuri/excelize/v2 v2.9.0 h1:1tgOaEq92IOEumR1/JfYS/eR0KHOCsRv/rYXXh6YJQE=
|
||||
@@ -394,21 +330,8 @@ github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5t
|
||||
github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
|
||||
github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0=
|
||||
github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
|
||||
github.com/ziutek/mymysql v1.5.4/go.mod h1:LMSpPZ6DbqWFxNCHW77HeMg9I646SAhApZ/wKdgO/C0=
|
||||
go.etcd.io/etcd/api/v3 v3.5.12/go.mod h1:Ot+o0SWSyT6uHhA56al1oCED0JImsRiU9Dc26+C2a+4=
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.12/go.mod h1:seTzl2d9APP8R5Y2hFL3NVlD6qC/dOT+3kvrqPyTas4=
|
||||
go.etcd.io/etcd/client/v2 v2.305.12/go.mod h1:aQ/yhsxMu+Oht1FOupSr60oBvcS9cKXHrzBpDsPTf9E=
|
||||
go.etcd.io/etcd/client/v3 v3.5.12/go.mod h1:tSbBCakoWmmddL+BKVAJHa9km+O/E+bumDe9mSbPiqw=
|
||||
go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo=
|
||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0/go.mod h1:Mjt1i1INqiaoZOMGR1RIUJN+i3ChKoFRqzrRQhlkbs0=
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0/go.mod h1:p8pYQP+m5XfbZm9fxtSKAbM6oIllS7s2AfxrChvc7iw=
|
||||
go.opentelemetry.io/otel v1.24.0/go.mod h1:W7b9Ozg4nkF5tWI5zsXkaKKDjdVjpD4oAt9Qi/MArHo=
|
||||
go.opentelemetry.io/otel/metric v1.24.0/go.mod h1:VYhLe1rFfxuTXLgj4CBiyz+9WYBA8pNGJgDcSFRKBco=
|
||||
go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU=
|
||||
go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
|
||||
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
|
||||
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
|
||||
go.uber.org/zap v1.21.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw=
|
||||
golang.org/x/arch v0.9.0 h1:ub9TgUInamJ8mrZIGlBG6/4TqWeMszd4N8lNorbrr6k=
|
||||
golang.org/x/arch v0.9.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
@@ -456,7 +379,6 @@ golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
|
||||
golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE=
|
||||
golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
|
||||
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
|
||||
golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
@@ -501,7 +423,6 @@ golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU=
|
||||
golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE=
|
||||
golang.org/x/telemetry v0.0.0-20240521205824-bda55230c457/go.mod h1:pRgIJT+bRLFKnoM1ldnzKoxTIn14Yxz928LQRYYgIN0=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
@@ -544,13 +465,6 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8=
|
||||
google.golang.org/api v0.171.0/go.mod h1:Hnq5AHm4OTMt2BUVjael2CWZFD6vksJdWCWiUAmjC9o=
|
||||
google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds=
|
||||
google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9/go.mod h1:mqHbVIp48Muh7Ywss/AD6I5kNVKZMmAa/QEW58Gxp2s=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20240311132316-a219d84964c2/go.mod h1:O1cOfN1Cy6QEYr7VxtjOyP5AdAuR0aJ/MYZaaof623Y=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240314234333-6e1732d8331c/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY=
|
||||
google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE=
|
||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||
@@ -575,8 +489,6 @@ gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
@@ -607,8 +519,6 @@ modernc.org/strutil v1.1.3/go.mod h1:MEHNA7PdEnEwLvspRMtWTNnp2nnyvMfkimT1NKNAGbw
|
||||
modernc.org/token v1.0.1 h1:A3qvTqOwexpfZZeyI0FeGPDlSWX5pjZu9hF4lU+EKWg=
|
||||
modernc.org/token v1.0.1/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=
|
||||
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
|
||||
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
|
||||
sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=
|
||||
xorm.io/builder v0.3.13 h1:a3jmiVVL19psGeXx8GIurTp7p0IIgqeDmwhcR6BAOAo=
|
||||
xorm.io/builder v0.3.13/go.mod h1:aUW0S9eb9VCaPohFCH3j7czOx1PMW3i1HrSzbLYGBSE=
|
||||
xorm.io/xorm v1.3.9 h1:TUovzS0ko+IQ1XnNLfs5dqK1cJl1H5uHpWbWqAQ04nU=
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
type DerivedRule struct {
|
||||
ParentCode int `yaml:"parentCode"`
|
||||
ChildCode int `yaml:"childCode"`
|
||||
}
|
||||
type RelatedRule struct {
|
||||
Codes []int `yaml:"codes"`
|
||||
NeType string `yaml:"neType"`
|
||||
TimeWindow int `yaml:"timeWindow"`
|
||||
}
|
||||
type AlarmRelationRules struct {
|
||||
Derived []DerivedRule `yaml:"derived"`
|
||||
Related []RelatedRule `yaml:"related"`
|
||||
}
|
||||
|
||||
var RelationRules AlarmRelationRules
|
||||
|
||||
func LoadAlarmRelationRules(path string) error {
|
||||
data, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return yaml.Unmarshal(data, &RelationRules)
|
||||
}
|
||||
|
||||
func LoadNbiRelationRulesConfig(path string) error {
|
||||
data, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return yaml.Unmarshal(data, &RelationRules)
|
||||
}
|
||||
+1
-33
@@ -126,8 +126,6 @@ type YamlConfig struct {
|
||||
Enabled bool `yaml:"enabled"`
|
||||
File string `yaml:"file"`
|
||||
} `yaml:"testConfig"`
|
||||
|
||||
NbiConfig NbiConfig `yaml:"nbiConfig"`
|
||||
}
|
||||
|
||||
type RestParam struct {
|
||||
@@ -182,23 +180,7 @@ type AlarmConfig struct {
|
||||
SignName string `yaml:"signName"`
|
||||
TemplateCode string `yaml:"templateCode"`
|
||||
} `yaml:"smsForward"`
|
||||
SMProxy string `yaml:"smProxy"`
|
||||
RelatedRules struct {
|
||||
Enabled bool `yaml:"enabled"`
|
||||
File string `yaml:"file"`
|
||||
} `yaml:"relatedRules"`
|
||||
}
|
||||
|
||||
type NbiConfig struct {
|
||||
Enabled bool `yaml:"enabled"`
|
||||
PmConfig struct {
|
||||
Enabled bool `yaml:"enabled"`
|
||||
File string `yaml:"file"`
|
||||
} `yaml:"pmConfig"`
|
||||
RelationRules struct {
|
||||
Enabled bool `yaml:"enabled"`
|
||||
File string `yaml:"file"`
|
||||
} `yaml:"relationRules"`
|
||||
SMProxy string `yaml:"smProxy"`
|
||||
}
|
||||
|
||||
type MMLParam struct {
|
||||
@@ -289,20 +271,6 @@ func ReadConfig(configFile string) {
|
||||
yamlConfig = YamlConfigInfo.ConfigLines
|
||||
|
||||
ReadOriginalConfig(configFile)
|
||||
|
||||
// load alarm relation rules
|
||||
if yamlConfig.Alarm.RelatedRules.Enabled {
|
||||
LoadAlarmRelationRules(yamlConfig.Alarm.RelatedRules.File)
|
||||
}
|
||||
|
||||
if yamlConfig.NbiConfig.Enabled {
|
||||
if yamlConfig.NbiConfig.PmConfig.Enabled {
|
||||
LoadNbiPmConfig(yamlConfig.NbiConfig.PmConfig.File)
|
||||
}
|
||||
if yamlConfig.NbiConfig.RelationRules.Enabled {
|
||||
LoadNbiRelationRulesConfig(yamlConfig.NbiConfig.RelationRules.File)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func ReadOriginalConfig(configFile string) {
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
type NbiPmConfig struct {
|
||||
SchemaPath string `yaml:"schemaPath"`
|
||||
RandomMin int `yaml:"randomMin"`
|
||||
RandomMax int `yaml:"randomMax"`
|
||||
MergeMode string `yaml:"mergeMode"` // MergeModeNone/MergeModeMerge/MergeModeSchema
|
||||
}
|
||||
|
||||
var nbiPmConfig NbiPmConfig
|
||||
|
||||
func GetNbiPmConfig() NbiPmConfig {
|
||||
return nbiPmConfig
|
||||
}
|
||||
|
||||
func LoadNbiPmConfig(path string) error {
|
||||
data, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return yaml.Unmarshal(data, &nbiPmConfig)
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
ProjectL = omc
|
||||
ProjectU = OMC
|
||||
PROJECT = $(ProjectL)
|
||||
VERSION = 2.2508.2
|
||||
VERSION = 2.2503.6
|
||||
RelDate = `date +%Y%m%d`
|
||||
Release = $(RelDate)
|
||||
RelVer = $(VERSION)-$(RelDate)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
ProcList="restagent sshsvc"
|
||||
ProjectL=omc
|
||||
VERSION=2.2508.2
|
||||
VERSION=2.2503.6
|
||||
RelDate=`date +%Y%m%d`
|
||||
Release=${RelDate}
|
||||
RelVer=${VERSION}-${RelDate}
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
# alarm relation rules
|
||||
derived:
|
||||
- parentCode: 1001
|
||||
childCode: 1002
|
||||
- parentCode: 2001
|
||||
childCode: 2002
|
||||
related:
|
||||
- codes: [3001, 3002, 3003]
|
||||
neType: "AMF"
|
||||
timeWindow: 60 # 秒
|
||||
@@ -1,4 +0,0 @@
|
||||
schemaPath: ./etc/schema
|
||||
randomMin: 1
|
||||
randomMax: 100
|
||||
mergeMode: merge # none: Merge Mode None/merge: Merge Mode Merge/schema: Merge Mode Schema
|
||||
+11
-21
@@ -20,10 +20,10 @@ pprof:
|
||||
rest:
|
||||
- ipv4: 0.0.0.0
|
||||
ipv6:
|
||||
port: 43030
|
||||
port: 33040
|
||||
- ipv4: 0.0.0.0
|
||||
ipv6:
|
||||
port: 43443
|
||||
port: 33443
|
||||
schema: https
|
||||
clientAuthType: 0
|
||||
caFile: ./etc/certs/omc-ca.crt
|
||||
@@ -31,12 +31,12 @@ rest:
|
||||
keyFile: ./etc/certs/omc-server.key
|
||||
|
||||
webServer:
|
||||
enabled: true
|
||||
rootDir: /home/simon/omc.git/fe.ems.vue3/dist # front-end build dist directory
|
||||
enabled: false
|
||||
rootDir: d:/omc.git/fe.ems.vue3/dist # front-end build dist directory
|
||||
listen:
|
||||
- addr: :8080
|
||||
- addr: :80
|
||||
schema: http
|
||||
- addr: :8443
|
||||
- addr: :443
|
||||
schema: https
|
||||
clientAuthType: 0
|
||||
caFile: ./etc/certs/omc-ca.crt
|
||||
@@ -47,8 +47,8 @@ database:
|
||||
type: mysql
|
||||
user: root
|
||||
password: "1000omc@kp!"
|
||||
host: "192.168.2.165"
|
||||
port: 33066
|
||||
host: "192.168.9.58"
|
||||
port: 13306
|
||||
name: omc_db
|
||||
connParam: charset=utf8mb4&collation=utf8mb4_general_ci&parseTime=True&interpolateParams=True
|
||||
backup: ./database
|
||||
@@ -58,8 +58,8 @@ redis:
|
||||
dataSource:
|
||||
# OMC system db
|
||||
default:
|
||||
port: 6379 # Redis port
|
||||
host: "127.0.0.1" # Redis host
|
||||
port: 16379 # Redis port
|
||||
host: "192.168.9.58" # Redis host
|
||||
password: "helloearth"
|
||||
db: 10 # Redis db_num
|
||||
# used to specify the default data source for multiple data resourece
|
||||
@@ -139,7 +139,7 @@ alarm:
|
||||
enable: true
|
||||
emailList:
|
||||
smtp: mail.smtp.com
|
||||
port: 110
|
||||
port: 25
|
||||
user: smtpext@smtp.com
|
||||
password: "1000smtp@omc!"
|
||||
tlsSkipVerify: true
|
||||
@@ -203,13 +203,3 @@ staticFile:
|
||||
upload:
|
||||
prefix: "/upload"
|
||||
dir: "./upload"
|
||||
|
||||
nbiConfig:
|
||||
enabled: true
|
||||
pmConfig:
|
||||
enabled: true
|
||||
file: ./etc/nbi_pm.yaml
|
||||
# alarm_relation_rules.yaml
|
||||
relationRules:
|
||||
enabled: true
|
||||
file: ./etc/alarm_relation_rules.yaml
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,269 +0,0 @@
|
||||
[
|
||||
{
|
||||
"ObjectType": "PcfFunction",
|
||||
"KPIs": [
|
||||
{
|
||||
"KPIID": "PCF.AmAssocNbrMean",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 6
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.AmAssocNbrMax",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 10
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.SmAssocNbrMean",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 7
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.SmAssocNbrMax",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 11
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicyAmAssocCreateReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 8
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicyAmAssocCreateSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 10
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicyAmAssocUpdateReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 7
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicyAmAssocUpdateSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicyAmAssocNotifReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 2
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicyAmAssocNotifSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 12
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicyAmAssocDeleteReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 11
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicyAmAssocDeleteSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 2
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicySmAssocCreateReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 11
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicySmAssocCreateSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicySmAssocCreateFail",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 11
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicySmAssocCreateFail._Cause",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 10
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicySmAssocUpdateReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 8
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicySmAssocUpdateSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicySmAssocUpdateFail",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 9
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicySmAssocUpdateFail._Cause",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 3
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicySmAssocNotifReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 8
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicySmAssocNotifSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 10
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicySmAssocNotifFail",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicySmAssocNotifFail._Cause",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 6
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicySmAssocDeleteReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 2
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "PCF.PolicySmAssocDeleteSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 2
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ObjectType": "UdrFunction",
|
||||
"KPIs": [
|
||||
{
|
||||
"KPIID": "UDR.PcfSubNbr",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 6
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ObjectType": "ManagedElement",
|
||||
"KPIs": [
|
||||
{
|
||||
"KPIID": "ME.MeanMeLoad",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 13
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,373 +0,0 @@
|
||||
[
|
||||
{
|
||||
"ObjectType": "UdmFunction",
|
||||
"KPIs": [
|
||||
{
|
||||
"KPIID": "UDM.AmfUecmRegReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 15
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.AmfUecmRegSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.AmfUecmRegUpdateReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 9
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.AmfUecmRegUpdateSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 9
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.AmfUecmDeregReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.AmfUecmDeregSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 15
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SmfUecmRegReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SmfUecmRegSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 3
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SmfUecmDeregReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 5
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SmfUecmDeregSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 2
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SdmGetReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 16
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SdmGetSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 14
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SdmNotif",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 6
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SdmSubscrReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SdmSubscrSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 11
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SdmUnSubscrReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 10
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SdmUnSubscrSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 14
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.UecmDeregNotif",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 8
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SdmGetUserNotFound",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 7
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SdmGetDataNotFound",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 5
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.AmfUecmRegUserNotFound",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 14
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.AmfUecmRegUnknownSub",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 2
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.AmfUecmRegNoPsSub",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 3
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.AmfUecmRegRoamNotAllowed",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 10
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.AmfUecmRegRatNotAllowed",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 3
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.AmfUecmRegContextNotFound",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 3
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.AmfUecmRegReAuth",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SmfUecmRegUserNotFound",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 15
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SmfUecmRegUnknownSub",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 13
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SmfUecmRegRoamNotAllowed",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 6
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDM.SmfUecmRegDnnNotAllowed",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 6
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ObjectType": "UdrFunction",
|
||||
"KPIs": [
|
||||
{
|
||||
"KPIID": "UDR.5gSupi",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 10
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDR.5gSub",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 14
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "UDR.5gActSub",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 16
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ObjectType": "AusfFunction",
|
||||
"KPIs": [
|
||||
{
|
||||
"KPIID": "Ausf.UeAuthReq",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "Ausf.UeAuthAnsSucc",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "Ausf.UeAuthAnsUserNotFound",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"KPIID": "Ausf.UeAuthAnsContextNotFound",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ObjectType": "ManagedElement",
|
||||
"KPIs": [
|
||||
{
|
||||
"KPIID": "ME.MeanMeLoad",
|
||||
"KPIValues": [
|
||||
{
|
||||
"Name": "Total",
|
||||
"Value": 11
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
File diff suppressed because it is too large.
Load diff
+1
-1
@@ -1,7 +1,7 @@
|
||||
# Makefile for rest agent project
|
||||
|
||||
PROJECT = OMC
|
||||
VERSION = 2.2508.2
|
||||
VERSION = 2.2503.6
|
||||
PLATFORM = amd64
|
||||
ARMPLATFORM = aarch64
|
||||
BUILDDIR = ../../build
|
||||
|
||||
@@ -20,7 +20,6 @@ import (
|
||||
"be.ems/features/fm"
|
||||
"be.ems/features/lm"
|
||||
"be.ems/features/mml"
|
||||
"be.ems/features/nbi/redisqueue"
|
||||
"be.ems/features/pm"
|
||||
featuresCfg "be.ems/lib/config"
|
||||
"be.ems/lib/dborm"
|
||||
@@ -210,9 +209,6 @@ func loadFeatures(app *gin.Engine) {
|
||||
|
||||
mml.InitMML()
|
||||
|
||||
// 初始化Redis Queue连接池
|
||||
redisqueue.InitRedisQueue()
|
||||
|
||||
// 将 mux.Router 注册到 gin.Engine
|
||||
|
||||
// 默认路由组
|
||||
|
||||
@@ -12,7 +12,6 @@ import (
|
||||
processorNeConfigBackup "be.ems/src/modules/crontask/processor/ne_config_backup"
|
||||
processorNeDataUDM "be.ems/src/modules/crontask/processor/ne_data_udm"
|
||||
"be.ems/src/modules/crontask/processor/removeFile"
|
||||
"be.ems/src/modules/crontask/processor/syncNbiNRM"
|
||||
)
|
||||
|
||||
// InitCronQueue 初始定时任务队列
|
||||
@@ -31,5 +30,4 @@ func InitCronQueue() {
|
||||
cron.CreateQueue("genNeStateAlarm", genNeStateAlarm.NewProcessor)
|
||||
cron.CreateQueue("exportTable", exportTable.NewProcessor)
|
||||
cron.CreateQueue("removeFile", removeFile.NewProcessor)
|
||||
cron.CreateQueue("syncNbiNRM", syncNbiNRM.NewProcessor)
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
package amf
|
||||
|
||||
import "be.ems/src/modules/crontask/processor/syncNbiNRM/common"
|
||||
|
||||
const (
|
||||
AMF string = "AMF" // 网元类型
|
||||
)
|
||||
|
||||
type ManagedElement struct {
|
||||
Id string `json:"id"`
|
||||
UserLabel string `json:"userLabel"`
|
||||
VendorName string `json:"vendorName"`
|
||||
ManagedBy string `json:"managedBy"`
|
||||
ManagementIpAddress string `json:"managementIpAddress"`
|
||||
SwVersion string `json:"swVersion"`
|
||||
PatchInfo string `json:"patchInfo"`
|
||||
AdministrativeState common.AdministrativeState `json:"administrativeState"`
|
||||
OperationalState common.OperationalState `json:"operationalState"`
|
||||
}
|
||||
|
||||
type AmfFunction struct {
|
||||
Id string `json:"id"`
|
||||
UserLabel string `json:"userLabel"`
|
||||
AdministrativeState common.AdministrativeState `json:"administrativeState"`
|
||||
OperationalState common.OperationalState `json:"operationalState"`
|
||||
VnfInstanceId string `json:"vnfInstanceId"`
|
||||
Fqdn string `json:"fqdn"`
|
||||
SbiServiceList string `json:"sbiServiceList"`
|
||||
AmfGuamiList string `json:"amfGuamiList"`
|
||||
SnssaiList string `json:"snssaiList"`
|
||||
MaxUser int `json:"maxUser"`
|
||||
RelativeCapacity int `json:"relativeCapacity"`
|
||||
MaxGnbNum int `json:"maxGnbNum"`
|
||||
}
|
||||
|
||||
type EpRpDynN8Amf struct {
|
||||
Id string `json:"id"`
|
||||
UserLabel string `json:"userLabel"`
|
||||
LocIpAddrList string `json:"locIpAddrList"`
|
||||
FarIpSubnetworkList string `json:"farIpSubnetworkList"`
|
||||
}
|
||||
|
||||
type EpRpDynN11Amf struct {
|
||||
Id string `json:"id"`
|
||||
UserLabel string `json:"userLabel"`
|
||||
LocIpAddrList string `json:"locIpAddrList"`
|
||||
FarIpSubnetworkList string `json:"farIpSubnetworkList"`
|
||||
}
|
||||
|
||||
type EpRpDynN12Amf struct {
|
||||
Id string `json:"id"`
|
||||
UserLabel string `json:"userLabel"`
|
||||
LocIpAddrList string `json:"locIpAddrList"`
|
||||
FarIpSubnetworkList string `json:"farIpSubnetworkList"`
|
||||
}
|
||||
|
||||
type IPResource struct {
|
||||
Id string `json:"id"`
|
||||
UserLabel string `json:"userLabel"`
|
||||
InterfaceType string `json:"interfaceType"`
|
||||
LocIpV4AddrList string `json:"locIpV4AddrList"`
|
||||
LocIpV6AddrList string `json:"locIpV6AddrList"`
|
||||
}
|
||||
@@ -1,326 +0,0 @@
|
||||
package amf
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"be.ems/features/nbi/redisqueue"
|
||||
"be.ems/lib/dborm"
|
||||
"be.ems/lib/log"
|
||||
|
||||
"be.ems/src/modules/crontask/processor/syncNbiNRM/common"
|
||||
)
|
||||
|
||||
// SyncAmfNbiCM 从ne_info获取AMF网元并同步数据到nbi_cm表
|
||||
func SyncNbiCM() error {
|
||||
log.Info("Starting AMF NBI CM synchronization")
|
||||
|
||||
// 从ne_info表获取AMF类型的网元
|
||||
var amfNEs []common.NeInfo
|
||||
err := dborm.DefaultDB().Table("ne_info").Where("ne_type = ? and status <> 0", "AMF").
|
||||
Find(&amfNEs).Error
|
||||
if err != nil {
|
||||
log.Errorf("Failed to query AMF network elements: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
log.Infof("Found %d AMF network elements", len(amfNEs))
|
||||
|
||||
// 遍历每个AMF网元,生成对应的NBI CM记录
|
||||
for _, ne := range amfNEs {
|
||||
adminState, operState := common.ParseStateFromStatus(ne.Status)
|
||||
|
||||
var version string = "-"
|
||||
err := dborm.DefaultDB().Table("ne_version").
|
||||
Where("ne_type = ? and ne_id = ?", ne.NeType, ne.NeId).
|
||||
Pluck("version", &version).Error
|
||||
if err != nil {
|
||||
log.Errorf("Failed to query %s version: %v", ne.NeName, err)
|
||||
return err
|
||||
}
|
||||
|
||||
// ========== ManagedElement ==========
|
||||
managedElement := ManagedElement{
|
||||
Id: fmt.Sprintf("%s-%s-ManagedElement", ne.NeType, ne.NeId),
|
||||
UserLabel: ne.NeName,
|
||||
VendorName: ne.VendorName,
|
||||
ManagedBy: ne.Dn,
|
||||
ManagementIpAddress: "{" + ne.Ip + "}",
|
||||
SwVersion: version,
|
||||
PatchInfo: "-",
|
||||
AdministrativeState: adminState,
|
||||
OperationalState: operState,
|
||||
}
|
||||
meJSON, err := json.Marshal(managedElement)
|
||||
if err != nil {
|
||||
log.Errorf("Failed to marshal ManagedElement for ne_id %s: %v", ne.NeId, err)
|
||||
continue
|
||||
}
|
||||
var lastJson string
|
||||
err = dborm.DefaultDB().Table("nbi_cm").
|
||||
Where("ne_type = ? AND ne_id = ? AND object_type = ? AND event_type = ?", ne.NeType, ne.NeId, "ManagedElement", common.ObjectOriginalEvent).
|
||||
Order("timestamp ASC").Pluck("value_json", &lastJson).Error
|
||||
newValueJson := string(meJSON)
|
||||
if err != nil || lastJson == "" {
|
||||
common.InsertNbiCm(ne, version, "ManagedElement", newValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, version, "ManagedElement", newValueJson, common.ObjectCreationEvent)
|
||||
redisqueue.AddNbiCMQueue([]string{strconv.Itoa(nbiCm.Id)})
|
||||
} else {
|
||||
var ids []string
|
||||
added, modified, deleted, _ := common.CompareJSON(lastJson, newValueJson)
|
||||
if len(added) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "ManagedElement", common.ToJson(added), common.ObjectCreationEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(modified) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "ManagedElement", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(deleted) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "ManagedElement", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
|
||||
if len(ids) > 0 {
|
||||
redisqueue.AddNbiCMQueue(ids)
|
||||
common.InsertNbiCm(ne, version, "ManagedElement", newValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
|
||||
// ========== AmfFunction ==========
|
||||
var capability int
|
||||
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)
|
||||
capability = 0
|
||||
}
|
||||
amfFunction := AmfFunction{
|
||||
Id: fmt.Sprintf("%s-%s-AmfFunction", ne.NeType, ne.NeId),
|
||||
UserLabel: ne.NeName + "-AmfFunction",
|
||||
AdministrativeState: adminState,
|
||||
OperationalState: operState,
|
||||
VnfInstanceId: "vnf-" + ne.NeType + "-" + ne.NeId,
|
||||
Fqdn: fmt.Sprintf("%s%s.mnc000.mcc460.3gppnetwork.org", strings.ToLower(ne.NeType), ne.NeId),
|
||||
SbiServiceList: "{Namf_Communication,Namf_EventExposure,Namf_MT,Namf_Location}",
|
||||
AmfGuamiList: "{{\"mcc\":\"460\",\"mnc\":\"000\",\"amfId\":\"" + ne.NeId + "\"}}",
|
||||
SnssaiList: "{{\"sst\":1,\"sd\":\"000001\"}}",
|
||||
MaxUser: capability,
|
||||
RelativeCapacity: 30,
|
||||
MaxGnbNum: 100,
|
||||
}
|
||||
amfJSON, err := json.Marshal(amfFunction)
|
||||
if err != nil {
|
||||
log.Errorf("Failed to marshal AmfFunction for ne_id %s: %v", ne.NeId, err)
|
||||
continue
|
||||
}
|
||||
var lastAmfJson string
|
||||
err = dborm.DefaultDB().Table("nbi_cm").
|
||||
Where("ne_type = ? AND ne_id = ? AND object_type = ? AND event_type = ?", ne.NeType, ne.NeId, "AmfFunction", common.ObjectOriginalEvent).
|
||||
Order("timestamp ASC").Pluck("value_json", &lastAmfJson).Error
|
||||
newAmfValueJson := string(amfJSON)
|
||||
if err != nil || lastAmfJson == "" {
|
||||
common.InsertNbiCm(ne, version, "AmfFunction", newAmfValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, version, "AmfFunction", newAmfValueJson, common.ObjectCreationEvent)
|
||||
redisqueue.AddNbiCMQueue([]string{strconv.Itoa(nbiCm.Id)})
|
||||
} else {
|
||||
var ids []string
|
||||
added, modified, deleted, _ := common.CompareJSON(lastAmfJson, newAmfValueJson)
|
||||
if len(added) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "AmfFunction", common.ToJson(added), common.ObjectCreationEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(modified) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "AmfFunction", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(deleted) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "AmfFunction", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
|
||||
if len(ids) > 0 {
|
||||
redisqueue.AddNbiCMQueue(ids)
|
||||
common.InsertNbiCm(ne, version, "AmfFunction", newAmfValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
|
||||
// ========== EpRpDynN8Amf ==========
|
||||
epRpDynN8Amf := EpRpDynN8Amf{
|
||||
Id: fmt.Sprintf("%s-%s-EpRpDynN8Amf", ne.NeType, ne.NeId),
|
||||
UserLabel: ne.NeName + "-EpRpDynN8Amf",
|
||||
LocIpAddrList: `{` + ne.Ip + `}`,
|
||||
FarIpSubnetworkList: `{{Subnetwork:10.10.1.0,Mask:255.255.255.255}}`,
|
||||
}
|
||||
n8JSON, err := json.Marshal(epRpDynN8Amf)
|
||||
if err != nil {
|
||||
log.Errorf("Failed to marshal EpRpDynN8Amf for ne_id %s: %v", ne.NeId, err)
|
||||
} else {
|
||||
var lastN8Json string
|
||||
err = dborm.DefaultDB().Table("nbi_cm").
|
||||
Where("ne_type = ? AND ne_id = ? AND object_type = ? AND event_type = ?", ne.NeType, ne.NeId, "EpRpDynN8Amf", common.ObjectOriginalEvent).
|
||||
Order("timestamp ASC").Pluck("value_json", &lastN8Json).Error
|
||||
newN8ValueJson := string(n8JSON)
|
||||
if err != nil || lastN8Json == "" {
|
||||
common.InsertNbiCm(ne, version, "EpRpDynN8Amf", newN8ValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, version, "EpRpDynN8Amf", newN8ValueJson, common.ObjectCreationEvent)
|
||||
redisqueue.AddNbiCMQueue([]string{strconv.Itoa(nbiCm.Id)})
|
||||
} else {
|
||||
var ids []string
|
||||
added, modified, deleted, _ := common.CompareJSON(lastN8Json, newN8ValueJson)
|
||||
if len(added) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "EpRpDynN8Amf", common.ToJson(added), common.ObjectCreationEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(modified) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "EpRpDynN8Amf", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(deleted) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "EpRpDynN8Amf", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
|
||||
if len(ids) > 0 {
|
||||
redisqueue.AddNbiCMQueue(ids)
|
||||
common.InsertNbiCm(ne, version, "EpRpDynN8Amf", newN8ValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ========== EpRpDynN11Amf ==========
|
||||
epRpDynN11Amf := EpRpDynN11Amf{
|
||||
Id: fmt.Sprintf("%s-%s-EpRpDynN11Amf", ne.NeType, ne.NeId),
|
||||
UserLabel: ne.NeName + "-EpRpDynN11Amf",
|
||||
LocIpAddrList: `{` + ne.Ip + `}`,
|
||||
FarIpSubnetworkList: `{{Subnetwork:10.11.1.0,Mask:255.255.255.255}}`,
|
||||
}
|
||||
n11JSON, err := json.Marshal(epRpDynN11Amf)
|
||||
if err != nil {
|
||||
log.Errorf("Failed to marshal EpRpDynN11Amf for ne_id %s: %v", ne.NeId, err)
|
||||
} else {
|
||||
var lastN11Json string
|
||||
err = dborm.DefaultDB().Table("nbi_cm").
|
||||
Where("ne_type = ? AND ne_id = ? AND object_type = ? AND event_type = ?", ne.NeType, ne.NeId, "EpRpDynN11Amf", common.ObjectOriginalEvent).
|
||||
Order("timestamp ASC").Pluck("value_json", &lastN11Json).Error
|
||||
newN11ValueJson := string(n11JSON)
|
||||
if err != nil || lastN11Json == "" {
|
||||
common.InsertNbiCm(ne, version, "EpRpDynN11Amf", newN11ValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, version, "EpRpDynN11Amf", newN11ValueJson, common.ObjectCreationEvent)
|
||||
redisqueue.AddNbiCMQueue([]string{strconv.Itoa(nbiCm.Id)})
|
||||
} else {
|
||||
var ids []string
|
||||
added, modified, deleted, _ := common.CompareJSON(lastN11Json, newN11ValueJson)
|
||||
if len(added) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "EpRpDynN11Amf", common.ToJson(added), common.ObjectCreationEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(modified) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "EpRpDynN11Amf", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(deleted) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "EpRpDynN11Amf", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
|
||||
if len(ids) > 0 {
|
||||
redisqueue.AddNbiCMQueue(ids)
|
||||
common.InsertNbiCm(ne, version, "EpRpDynN11Amf", newN11ValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ========== EpRpDynN12Amf ==========
|
||||
epRpDynN12Amf := EpRpDynN12Amf{
|
||||
Id: fmt.Sprintf("%s-%s-EpRpDynN12Amf", ne.NeType, ne.NeId),
|
||||
UserLabel: ne.NeName + "-EpRpDynN12Amf",
|
||||
LocIpAddrList: `{` + ne.Ip + `}`,
|
||||
FarIpSubnetworkList: `{{Subnetwork:10.12.1.0,Mask:255.255.255.255}}`,
|
||||
}
|
||||
n12JSON, err := json.Marshal(epRpDynN12Amf)
|
||||
if err != nil {
|
||||
log.Errorf("Failed to marshal EpRpDynN12Amf for ne_id %s: %v", ne.NeId, err)
|
||||
} else {
|
||||
var lastN12Json string
|
||||
err = dborm.DefaultDB().Table("nbi_cm").
|
||||
Where("ne_type = ? AND ne_id = ? AND object_type = ? AND event_type = ?", ne.NeType, ne.NeId, "EpRpDynN12Amf", common.ObjectOriginalEvent).
|
||||
Order("timestamp ASC").Pluck("value_json", &lastN12Json).Error
|
||||
newN12ValueJson := string(n12JSON)
|
||||
if err != nil || lastN12Json == "" {
|
||||
common.InsertNbiCm(ne, version, "EpRpDynN12Amf", newN12ValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, version, "EpRpDynN12Amf", newN12ValueJson, common.ObjectCreationEvent)
|
||||
redisqueue.AddNbiCMQueue([]string{strconv.Itoa(nbiCm.Id)})
|
||||
} else {
|
||||
var ids []string
|
||||
added, modified, deleted, _ := common.CompareJSON(lastN12Json, newN12ValueJson)
|
||||
if len(added) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "EpRpDynN12Amf", common.ToJson(added), common.ObjectCreationEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(modified) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "EpRpDynN12Amf", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(deleted) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "EpRpDynN12Amf", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
|
||||
if len(ids) > 0 {
|
||||
redisqueue.AddNbiCMQueue(ids)
|
||||
common.InsertNbiCm(ne, version, "EpRpDynN12Amf", newN12ValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ========== IPResource ==========
|
||||
ipResource := IPResource{
|
||||
Id: fmt.Sprintf("%s-%s-IPResource", ne.NeType, ne.NeId),
|
||||
UserLabel: ne.NeName + "-IPResource",
|
||||
InterfaceType: "{Mgt,N8,N11,N12}",
|
||||
LocIpV4AddrList: fmt.Sprintf("{%s,%s,%s,%s}", ne.Ip, "10.10.1.100", "10.11.1.100", "10.12.1.100"),
|
||||
LocIpV6AddrList: "{Default,Default,Default,Default}",
|
||||
}
|
||||
ipJSON, err := json.Marshal(ipResource)
|
||||
if err != nil {
|
||||
log.Errorf("Failed to marshal IPResource for ne_id %s: %v", ne.NeId, err)
|
||||
} else {
|
||||
var lastIpJson string
|
||||
err = dborm.DefaultDB().Table("nbi_cm").
|
||||
Where("ne_type = ? AND ne_id = ? AND object_type = ? AND event_type = ?", ne.NeType, ne.NeId, "IPResource", common.ObjectOriginalEvent).
|
||||
Order("timestamp ASC").Pluck("value_json", &lastIpJson).Error
|
||||
newIpValueJson := string(ipJSON)
|
||||
if err != nil || lastIpJson == "" {
|
||||
common.InsertNbiCm(ne, version, "IPResource", newIpValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, version, "IPResource", newIpValueJson, common.ObjectCreationEvent)
|
||||
redisqueue.AddNbiCMQueue([]string{strconv.Itoa(nbiCm.Id)})
|
||||
} else {
|
||||
var ids []string
|
||||
added, modified, deleted, _ := common.CompareJSON(lastIpJson, newIpValueJson)
|
||||
if len(added) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "IPResource", common.ToJson(added), common.ObjectCreationEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(modified) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "IPResource", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(deleted) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "IPResource", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
|
||||
if len(ids) > 0 {
|
||||
redisqueue.AddNbiCMQueue(ids)
|
||||
common.InsertNbiCm(ne, version, "IPResource", newIpValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
log.Info("AMF NBI CM synchronization completed")
|
||||
return nil
|
||||
}
|
||||
@@ -1,145 +0,0 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
type AdministrativeState string
|
||||
|
||||
const (
|
||||
Locked AdministrativeState = "Locked"
|
||||
Unlocked AdministrativeState = "Unlocked"
|
||||
ShuttingDown AdministrativeState = "ShuttingDown"
|
||||
)
|
||||
|
||||
type OperationalState string
|
||||
|
||||
const (
|
||||
Enabled OperationalState = "Enabled"
|
||||
Disabled OperationalState = "Disabled"
|
||||
)
|
||||
|
||||
const (
|
||||
// NBI CM表名
|
||||
NbiCmTableName = "nbi_cm"
|
||||
CmVersion = "v1" // CM版本
|
||||
)
|
||||
|
||||
type EventType int
|
||||
|
||||
const (
|
||||
ObjectNullEvent EventType = iota // ObjectNullEvent 空事件
|
||||
ObjectOriginalEvent // ObjectOriginalEvent 原始事件
|
||||
ObjectCreationEvent // ObjectCreationEvent 创建事件
|
||||
ObjectDeletionEvent // ObjectDeletionEvent 删除事件
|
||||
ObjectAttributeValueChangeEvent // ObjectAttributeValueChangeEvent 修改事件
|
||||
ObjectUnkownEvent // 未知事件
|
||||
)
|
||||
|
||||
func (et EventType) EventTypeEnumString() string {
|
||||
switch et {
|
||||
case ObjectOriginalEvent:
|
||||
return "ObjectOriginalEvent"
|
||||
case ObjectCreationEvent:
|
||||
return "ObjectCreationEvent"
|
||||
case ObjectDeletionEvent:
|
||||
return "ObjectDeletionEvent"
|
||||
case ObjectAttributeValueChangeEvent:
|
||||
return "ObjectAttributeValueChangeEvent"
|
||||
case ObjectNullEvent:
|
||||
return "ObjectNullEvent"
|
||||
default:
|
||||
return "ObjectUnkownEvent"
|
||||
}
|
||||
}
|
||||
|
||||
func (et EventType) EventTypeIntString() string {
|
||||
return fmt.Sprintf("%d", et)
|
||||
}
|
||||
|
||||
// EventTypeInt 将字符串转换为 EventType 枚举类型
|
||||
func EventTypeInt(s string) EventType {
|
||||
if i, err := strconv.Atoi(s); err == nil {
|
||||
return EventType(i)
|
||||
}
|
||||
|
||||
switch s {
|
||||
case "ObjectOriginalEvent":
|
||||
return ObjectOriginalEvent
|
||||
case "ObjectCreationEvent":
|
||||
return ObjectCreationEvent
|
||||
case "ObjectDeletionEvent":
|
||||
return ObjectDeletionEvent
|
||||
case "ObjectAttributeValueChangeEvent":
|
||||
return ObjectAttributeValueChangeEvent
|
||||
case "":
|
||||
// 如果字符串为空,则返回未知事件
|
||||
return ObjectNullEvent
|
||||
default:
|
||||
return ObjectUnkownEvent
|
||||
}
|
||||
}
|
||||
|
||||
type NeStatus int
|
||||
|
||||
const (
|
||||
NeStatusOffline NeStatus = iota
|
||||
NeStatusActive
|
||||
NeStatusToSync
|
||||
NeStatusStandby
|
||||
NeStatusUnknown
|
||||
)
|
||||
|
||||
// ParseStateFromStatus 将状态字符串转换为 AdministrativeState 和 OperationalState
|
||||
func ParseStateFromStatus(status NeStatus) (AdministrativeState, OperationalState) {
|
||||
var adminState AdministrativeState
|
||||
var operState OperationalState
|
||||
|
||||
switch status {
|
||||
case NeStatusOffline:
|
||||
adminState = Locked
|
||||
operState = Disabled
|
||||
case NeStatusActive:
|
||||
adminState = Unlocked
|
||||
operState = Enabled
|
||||
case NeStatusToSync:
|
||||
adminState = Unlocked
|
||||
operState = Enabled
|
||||
case NeStatusStandby:
|
||||
adminState = Locked
|
||||
operState = Enabled
|
||||
default:
|
||||
adminState = ShuttingDown
|
||||
operState = Disabled
|
||||
}
|
||||
|
||||
return adminState, operState
|
||||
}
|
||||
|
||||
type NeInfo struct {
|
||||
NeId string `db:"ne_id"`
|
||||
NeType string `db:"ne_type"`
|
||||
RmUid string `db:"rm_uid"`
|
||||
VendorName string `db:"vendor_name"`
|
||||
NeName string `db:"ne_name"`
|
||||
Ip string `db:"ip"`
|
||||
Port string `db:"port"`
|
||||
PVFlag string `db:"pv_flag"`
|
||||
Province string `db:"province"`
|
||||
Dn string `db:"dn"`
|
||||
Status NeStatus `db:"status"`
|
||||
}
|
||||
|
||||
// NbiCm 表结构
|
||||
type NbiCm struct {
|
||||
Id int `json:"id" db:"id PRIMARY KEY"`
|
||||
NeType string `json:"neType" db:"ne_type"`
|
||||
NeId string `json:"neId" db:"ne_id"`
|
||||
CmVersion string `json:"cmVersion" db:"cm_version"`
|
||||
RmUid string `json:"rmUid" db:"rm_uid"`
|
||||
EventType EventType `json:"eventType" db:"event_type"`
|
||||
ObjectType string `json:"objectType" db:"object_type"`
|
||||
ValueJson string `json:"valueJson" db:"value_json"`
|
||||
Timestamp string `json:"timestamp" db:"timestamp"`
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"time"
|
||||
|
||||
"be.ems/lib/dborm"
|
||||
)
|
||||
|
||||
// CompareJSON 比较两个 JSON,返回新增、修改和删除的内容
|
||||
func CompareJSON(json1, json2 string) (map[string]interface{}, map[string]interface{}, map[string]interface{}, error) {
|
||||
var map1, map2 map[string]interface{}
|
||||
|
||||
// 解析 JSON
|
||||
if err := json.Unmarshal([]byte(json1), &map1); err != nil {
|
||||
return nil, nil, nil, fmt.Errorf("failed to parse json1: %v", err)
|
||||
}
|
||||
if err := json.Unmarshal([]byte(json2), &map2); err != nil {
|
||||
return nil, nil, nil, fmt.Errorf("failed to parse json2: %v", err)
|
||||
}
|
||||
|
||||
// 存储新增、修改和删除的内容
|
||||
added := make(map[string]interface{})
|
||||
modified := make(map[string]interface{})
|
||||
deleted := make(map[string]interface{})
|
||||
|
||||
// 递归比较
|
||||
compareMaps(map1, map2, added, modified, deleted, "")
|
||||
|
||||
return added, modified, deleted, nil
|
||||
}
|
||||
|
||||
// compareMaps 递归比较两个 map
|
||||
func compareMaps(map1, map2, added, modified, deleted map[string]interface{}, prefix string) {
|
||||
// 遍历 map1,检查删除或修改
|
||||
for key, val1 := range map1 {
|
||||
fullKey := key
|
||||
if prefix != "" {
|
||||
fullKey = prefix + "." + key
|
||||
}
|
||||
|
||||
val2, exists := map2[key]
|
||||
if !exists {
|
||||
// 如果 key 不存在于 map2,记录为删除
|
||||
deleted[fullKey] = val1
|
||||
} else if !reflect.DeepEqual(val1, val2) {
|
||||
// 如果 key 存在但值不同,记录为修改
|
||||
if reflect.TypeOf(val1) == reflect.TypeOf(val2) && reflect.TypeOf(val1).Kind() == reflect.Map {
|
||||
// 如果值是嵌套对象,递归比较
|
||||
compareMaps(val1.(map[string]interface{}), val2.(map[string]interface{}), added, modified, deleted, fullKey)
|
||||
} else {
|
||||
modified[fullKey] = map[string]interface{}{
|
||||
"old": val1,
|
||||
"new": val2,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 遍历 map2,检查新增
|
||||
for key, val2 := range map2 {
|
||||
fullKey := key
|
||||
if prefix != "" {
|
||||
fullKey = prefix + "." + key
|
||||
}
|
||||
|
||||
if _, exists := map1[key]; !exists {
|
||||
// 如果 key 不存在于 map1,记录为新增
|
||||
added[fullKey] = val2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func InsertNbiCm(ne NeInfo, version, objType, valueJson string, eventType EventType) NbiCm {
|
||||
nbiCM := NbiCm{
|
||||
NeType: ne.NeType,
|
||||
NeId: ne.NeId,
|
||||
CmVersion: version,
|
||||
RmUid: ne.RmUid,
|
||||
EventType: eventType,
|
||||
ObjectType: objType,
|
||||
ValueJson: valueJson,
|
||||
Timestamp: time.Now().Format("2006-01-02 15:04:05"),
|
||||
}
|
||||
dborm.DefaultDB().Table("nbi_cm").Create(&nbiCM)
|
||||
|
||||
return nbiCM
|
||||
}
|
||||
|
||||
func ToJson(m map[string]interface{}) string {
|
||||
b, _ := json.Marshal(m)
|
||||
return string(b)
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
package pcf
|
||||
|
||||
import "be.ems/src/modules/crontask/processor/syncNbiNRM/common"
|
||||
|
||||
const (
|
||||
PCF string = "PCF" // 网元类型
|
||||
)
|
||||
|
||||
type ManagedElement struct {
|
||||
Id string `json:"id"`
|
||||
UserLabel string `json:"userLabel"`
|
||||
VendorName string `json:"vendorName"`
|
||||
ManagedBy string `json:"managedBy"`
|
||||
ManagementIpAddress string `json:"managementIpAddress"`
|
||||
SwVersion string `json:"swVersion"`
|
||||
PatchInfo string `json:"patchInfo"`
|
||||
AdministrativeState common.AdministrativeState `json:"administrativeState"`
|
||||
OperationalState common.OperationalState `json:"operationalState"`
|
||||
}
|
||||
|
||||
type PcfFunction struct {
|
||||
Id string `json:"id"`
|
||||
UserLabel string `json:"userLabel"`
|
||||
AdministrativeState common.AdministrativeState `json:"administrativeState"`
|
||||
OperationalState common.OperationalState `json:"operationalState"`
|
||||
VnfInstanceId string `json:"vnfInstanceId"`
|
||||
Fqdn string `json:"fqdn"`
|
||||
SbiServiceList string `json:"sbiServiceList"`
|
||||
}
|
||||
|
||||
type UdrFunction struct {
|
||||
Id string `json:"id"`
|
||||
UserLabel string `json:"userLabel"`
|
||||
AdministrativeState common.AdministrativeState `json:"administrativeState"`
|
||||
OperationalState common.OperationalState `json:"operationalState"`
|
||||
MaxSubNbr int `json:"maxSubNbr"`
|
||||
}
|
||||
|
||||
type IPResource struct {
|
||||
Id string `json:"id"`
|
||||
UserLabel string `json:"userLabel"`
|
||||
InterfaceType string `json:"interfaceType"`
|
||||
LocIpV4AddrList string `json:"locIpV4AddrList"`
|
||||
LocIpV6AddrList string `json:"locIpV6AddrList"`
|
||||
}
|
||||
@@ -1,234 +0,0 @@
|
||||
package pcf
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"be.ems/features/nbi/redisqueue"
|
||||
"be.ems/lib/dborm"
|
||||
"be.ems/lib/log"
|
||||
"be.ems/src/modules/crontask/processor/syncNbiNRM/common"
|
||||
)
|
||||
|
||||
// SyncPcfNbiCM 从ne_info获取PCF网元并同步数据到nbi_cm表
|
||||
func SyncNbiCM() error {
|
||||
log.Info("Starting PCF NBI CM synchronization")
|
||||
|
||||
// 从ne_info表获取PCF类型的网元
|
||||
var pcfNEs []common.NeInfo
|
||||
err := dborm.DefaultDB().Table("ne_info").Where("ne_type = ? and status <> 0", "PCF").
|
||||
Find(&pcfNEs).Error
|
||||
if err != nil {
|
||||
log.Errorf("Failed to query PCF network elements: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
log.Infof("Found %d PCF network elements", len(pcfNEs))
|
||||
|
||||
for _, ne := range pcfNEs {
|
||||
adminState, operState := common.ParseStateFromStatus(ne.Status)
|
||||
|
||||
var version string = "-"
|
||||
err := dborm.DefaultDB().Table("ne_version").
|
||||
Where("ne_type = ? and ne_id = ?", ne.NeType, ne.NeId).
|
||||
Pluck("version", &version).Error
|
||||
if err != nil {
|
||||
log.Errorf("Failed to query %s version: %v", ne.NeName, err)
|
||||
return err
|
||||
}
|
||||
|
||||
// ========== ManagedElement ==========
|
||||
managedElement := ManagedElement{
|
||||
Id: fmt.Sprintf("%s-%s-ManagedElement", ne.NeType, ne.NeId),
|
||||
UserLabel: ne.NeName,
|
||||
VendorName: ne.VendorName,
|
||||
ManagedBy: ne.Dn,
|
||||
ManagementIpAddress: "{" + ne.Ip + "}",
|
||||
SwVersion: version,
|
||||
PatchInfo: "-",
|
||||
AdministrativeState: adminState,
|
||||
OperationalState: operState,
|
||||
}
|
||||
meJSON, err := json.Marshal(managedElement)
|
||||
if err != nil {
|
||||
log.Errorf("Failed to marshal ManagedElement for PCF ne_id %s: %v", ne.NeId, err)
|
||||
continue
|
||||
}
|
||||
var lastJson string
|
||||
err = dborm.DefaultDB().Table("nbi_cm").
|
||||
Where("ne_type = ? AND ne_id = ? AND object_type = ? AND event_type = ?", ne.NeType, ne.NeId, "ManagedElement", common.ObjectOriginalEvent).
|
||||
Order("timestamp ASC").Pluck("value_json", &lastJson).Error
|
||||
newValueJson := string(meJSON)
|
||||
if err != nil || lastJson == "" {
|
||||
common.InsertNbiCm(ne, version, "ManagedElement", newValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, version, "ManagedElement", newValueJson, common.ObjectCreationEvent)
|
||||
redisqueue.AddNbiCMQueue([]string{strconv.Itoa(nbiCm.Id)})
|
||||
} else {
|
||||
var ids []string
|
||||
added, modified, deleted, _ := common.CompareJSON(lastJson, newValueJson)
|
||||
if len(added) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "ManagedElement", common.ToJson(added), common.ObjectCreationEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(modified) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "ManagedElement", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(deleted) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "ManagedElement", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
|
||||
if len(ids) > 0 {
|
||||
redisqueue.AddNbiCMQueue(ids)
|
||||
common.InsertNbiCm(ne, version, "ManagedElement", newValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
|
||||
// ========== PcfFunction ==========
|
||||
pcfFunction := PcfFunction{
|
||||
Id: fmt.Sprintf("%s-%s-PcfFunction", ne.NeType, ne.NeId),
|
||||
UserLabel: ne.NeName + "-PcfFunction",
|
||||
AdministrativeState: adminState,
|
||||
OperationalState: operState,
|
||||
VnfInstanceId: "vnf-" + ne.NeType + "-" + ne.NeId,
|
||||
Fqdn: fmt.Sprintf("%s%s.mnc000.mcc460.3gppnetwork.org", strings.ToLower(ne.NeType), ne.NeId),
|
||||
SbiServiceList: "{Npcf_AMPolicyControl,Npcf_PolicyAuthorization,Npcf_SMPolicyControl,Npcf_BDTPolicyControl}",
|
||||
}
|
||||
pcfJSON, err := json.Marshal(pcfFunction)
|
||||
if err != nil {
|
||||
log.Errorf("Failed to marshal PcfFunction for ne_id %s: %v", ne.NeId, err)
|
||||
continue
|
||||
}
|
||||
var lastPcfJson string
|
||||
err = dborm.DefaultDB().Table("nbi_cm").
|
||||
Where("ne_type = ? AND ne_id = ? AND object_type = ? AND event_type = ?", ne.NeType, ne.NeId, "PcfFunction", common.ObjectOriginalEvent).
|
||||
Order("timestamp ASC").Pluck("value_json", &lastPcfJson).Error
|
||||
newPcfValueJson := string(pcfJSON)
|
||||
if err != nil || lastPcfJson == "" {
|
||||
common.InsertNbiCm(ne, version, "PcfFunction", newPcfValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, version, "PcfFunction", newPcfValueJson, common.ObjectCreationEvent)
|
||||
redisqueue.AddNbiCMQueue([]string{strconv.Itoa(nbiCm.Id)})
|
||||
} else {
|
||||
var ids []string
|
||||
added, modified, deleted, _ := common.CompareJSON(lastPcfJson, newPcfValueJson)
|
||||
if len(added) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "PcfFunction", common.ToJson(added), common.ObjectCreationEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(modified) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "PcfFunction", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(deleted) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "PcfFunction", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
|
||||
if len(ids) > 0 {
|
||||
redisqueue.AddNbiCMQueue(ids)
|
||||
common.InsertNbiCm(ne, version, "PcfFunction", newPcfValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
|
||||
// ========== UdrFunction ==========
|
||||
var capability int
|
||||
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)
|
||||
capability = 0
|
||||
}
|
||||
udrFunction := UdrFunction{
|
||||
Id: fmt.Sprintf("%s-%s-UdrFunction", ne.NeType, ne.NeId),
|
||||
UserLabel: ne.NeName + "-UdrFunction",
|
||||
AdministrativeState: adminState,
|
||||
OperationalState: operState,
|
||||
MaxSubNbr: capability,
|
||||
}
|
||||
udrJSON, err := json.Marshal(udrFunction)
|
||||
if err != nil {
|
||||
log.Errorf("Failed to marshal UdrFunction for ne_id %s: %v", ne.NeId, err)
|
||||
} else {
|
||||
var lastUdrJson string
|
||||
err = dborm.DefaultDB().Table("nbi_cm").
|
||||
Where("ne_type = ? AND ne_id = ? AND object_type = ? AND event_type = ?", ne.NeType, ne.NeId, "UdrFunction", common.ObjectOriginalEvent).
|
||||
Order("timestamp ASC").Pluck("value_json", &lastUdrJson).Error
|
||||
newUdrValueJson := string(udrJSON)
|
||||
if err != nil || lastUdrJson == "" {
|
||||
common.InsertNbiCm(ne, version, "UdrFunction", newUdrValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, version, "UdrFunction", newUdrValueJson, common.ObjectCreationEvent)
|
||||
redisqueue.AddNbiCMQueue([]string{strconv.Itoa(nbiCm.Id)})
|
||||
} else {
|
||||
var ids []string
|
||||
added, modified, deleted, _ := common.CompareJSON(lastUdrJson, newUdrValueJson)
|
||||
if len(added) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "UdrFunction", common.ToJson(added), common.ObjectCreationEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(modified) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "UdrFunction", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(deleted) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "UdrFunction", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
|
||||
if len(ids) > 0 {
|
||||
redisqueue.AddNbiCMQueue(ids)
|
||||
common.InsertNbiCm(ne, version, "UdrFunction", newUdrValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ========== IPResource ==========
|
||||
ipResource := IPResource{
|
||||
Id: fmt.Sprintf("%s-%s-IPResource", ne.NeType, ne.NeId),
|
||||
UserLabel: ne.NeName + "-IPResource",
|
||||
InterfaceType: "{Mgt,N5,N7,N15}",
|
||||
LocIpV4AddrList: fmt.Sprintf("{%s,Default,Default,Default}", ne.Ip),
|
||||
LocIpV6AddrList: "{Default,Default,Default,Default}",
|
||||
}
|
||||
ipJSON, err := json.Marshal(ipResource)
|
||||
if err != nil {
|
||||
log.Errorf("Failed to marshal IPResource for PCF ne_id %s: %v", ne.NeId, err)
|
||||
} else {
|
||||
var lastIpJson string
|
||||
err = dborm.DefaultDB().Table("nbi_cm").
|
||||
Where("ne_type = ? AND ne_id = ? AND object_type = ? AND event_type = ?", ne.NeType, ne.NeId, "IPResource", common.ObjectOriginalEvent).
|
||||
Order("timestamp ASC").Pluck("value_json", &lastIpJson).Error
|
||||
newIpValueJson := string(ipJSON)
|
||||
if err != nil || lastIpJson == "" {
|
||||
common.InsertNbiCm(ne, version, "IPResource", newIpValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, version, "IPResource", newIpValueJson, common.ObjectCreationEvent)
|
||||
redisqueue.AddNbiCMQueue([]string{strconv.Itoa(nbiCm.Id)})
|
||||
} else {
|
||||
var ids []string
|
||||
added, modified, deleted, _ := common.CompareJSON(lastIpJson, newIpValueJson)
|
||||
if len(added) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "IPResource", common.ToJson(added), common.ObjectCreationEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(modified) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "IPResource", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(deleted) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "IPResource", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
|
||||
if len(ids) > 0 {
|
||||
redisqueue.AddNbiCMQueue(ids)
|
||||
common.InsertNbiCm(ne, version, "IPResource", newIpValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
log.Info("PCF NBI CM synchronization completed")
|
||||
return nil
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
package smf
|
||||
|
||||
import "be.ems/src/modules/crontask/processor/syncNbiNRM/common"
|
||||
|
||||
const (
|
||||
SMF string = "SMF" // 网元类型
|
||||
)
|
||||
|
||||
type ManagedElement struct {
|
||||
Id string `json:"id"`
|
||||
UserLabel string `json:"userLabel"`
|
||||
VendorName string `json:"vendorName"`
|
||||
ManagedBy string `json:"managedBy"`
|
||||
ManagementIpAddress string `json:"managementIpAddress"`
|
||||
SwVersion string `json:"swVersion"`
|
||||
PatchInfo string `json:"patchInfo"`
|
||||
AdministrativeState common.AdministrativeState `json:"administrativeState"`
|
||||
OperationalState common.OperationalState `json:"operationalState"`
|
||||
}
|
||||
|
||||
type SmfFunction struct {
|
||||
Id string `json:"id"`
|
||||
UserLabel string `json:"userLabel"`
|
||||
AdministrativeState common.AdministrativeState `json:"administrativeState"`
|
||||
OperationalState common.OperationalState `json:"operationalState"`
|
||||
VnfInstanceId string `json:"vnfInstanceId"`
|
||||
Fqdn string `json:"fqdn"`
|
||||
SbiServiceList string `json:"sbiServiceList"`
|
||||
MaxPduSessions int32 `json:"maxPduSessions"`
|
||||
MaxQfi int32 `json:"maxQfi"`
|
||||
UpfList string `json:"upfList"`
|
||||
}
|
||||
|
||||
type AddrPool struct {
|
||||
Id string `json:"id"`
|
||||
UserLabel string `json:"userLabel"`
|
||||
AddrType string `json:"addrType"`
|
||||
IpVersion string `json:"ipVersion"`
|
||||
AddrSegList string `json:"addrSegList"`
|
||||
}
|
||||
|
||||
type EpRpDynN7Smf struct {
|
||||
Id string `json:"id"`
|
||||
UserLabel string `json:"userLabel"`
|
||||
LocIpAddrList string `json:"locIpAddrList"`
|
||||
FarIpSubnetworkList string `json:"farIpSubnetworkList"`
|
||||
}
|
||||
type EpRpDynN10Smf struct {
|
||||
Id string `json:"id"`
|
||||
UserLabel string `json:"userLabel"`
|
||||
LocIpAddrList string `json:"locIpAddrList"`
|
||||
FarIpSubnetworkList string `json:"farIpSubnetworkList"`
|
||||
}
|
||||
|
||||
type IPResource struct {
|
||||
Id string `json:"id"`
|
||||
UserLabel string `json:"userLabel"`
|
||||
InterfaceType string `json:"interfaceType"`
|
||||
LocIpV4AddrList string `json:"locIpV4AddrList"`
|
||||
LocIpV6AddrList string `json:"locIpV6AddrList"`
|
||||
}
|
||||
@@ -1,329 +0,0 @@
|
||||
package smf
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"be.ems/features/nbi/redisqueue"
|
||||
"be.ems/lib/dborm"
|
||||
"be.ems/lib/log"
|
||||
"be.ems/src/modules/crontask/processor/syncNbiNRM/common"
|
||||
)
|
||||
|
||||
// SyncSmfNbiCM 从ne_info获取SMF网元并同步数据到nbi_cm表
|
||||
func SyncNbiCM() error {
|
||||
log.Info("Starting SMF NBI CM synchronization")
|
||||
|
||||
// 从ne_info表获取SMF类型的网元
|
||||
var smfNEs []common.NeInfo
|
||||
err := dborm.DefaultDB().Table("ne_info").Where("ne_type = ? and status <> 0", "SMF").
|
||||
Find(&smfNEs).Error
|
||||
if err != nil {
|
||||
log.Errorf("Failed to query SMF network elements: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
log.Infof("Found %d SMF network elements", len(smfNEs))
|
||||
|
||||
for _, ne := range smfNEs {
|
||||
adminState, operState := common.ParseStateFromStatus(ne.Status)
|
||||
|
||||
var version string = "-"
|
||||
err := dborm.DefaultDB().Table("ne_version").
|
||||
Where("ne_type = ? and ne_id = ?", ne.NeType, ne.NeId).
|
||||
Pluck("version", &version).Error
|
||||
if err != nil {
|
||||
log.Errorf("Failed to query %s version: %v", ne.NeName, err)
|
||||
return err
|
||||
}
|
||||
|
||||
// ========== ManagedElement ==========
|
||||
managedElement := ManagedElement{
|
||||
Id: fmt.Sprintf("%s-%s-ManagedElement", ne.NeType, ne.NeId),
|
||||
UserLabel: ne.NeName,
|
||||
VendorName: ne.VendorName,
|
||||
ManagedBy: ne.Dn,
|
||||
ManagementIpAddress: "{" + ne.Ip + "}",
|
||||
SwVersion: version,
|
||||
PatchInfo: "-",
|
||||
AdministrativeState: adminState,
|
||||
OperationalState: operState,
|
||||
}
|
||||
meJSON, err := json.Marshal(managedElement)
|
||||
if err != nil {
|
||||
log.Errorf("Failed to marshal ManagedElement for SMF ne_id %s: %v", ne.NeId, err)
|
||||
continue
|
||||
}
|
||||
var lastJson string
|
||||
err = dborm.DefaultDB().Table("nbi_cm").
|
||||
Where("ne_type = ? AND ne_id = ? AND object_type = ? AND event_type = ?", ne.NeType, ne.NeId, "ManagedElement", common.ObjectOriginalEvent).
|
||||
Order("timestamp ASC").Pluck("value_json", &lastJson).Error
|
||||
newValueJson := string(meJSON)
|
||||
if err != nil || lastJson == "" {
|
||||
common.InsertNbiCm(ne, version, "ManagedElement", newValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, version, "ManagedElement", newValueJson, common.ObjectCreationEvent)
|
||||
redisqueue.AddNbiCMQueue([]string{strconv.Itoa(nbiCm.Id)})
|
||||
} else {
|
||||
var ids []string
|
||||
added, modified, deleted, _ := common.CompareJSON(lastJson, newValueJson)
|
||||
if len(added) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "ManagedElement", common.ToJson(added), common.ObjectCreationEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(modified) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "ManagedElement", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(deleted) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "ManagedElement", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
|
||||
if len(ids) > 0 {
|
||||
redisqueue.AddNbiCMQueue(ids)
|
||||
common.InsertNbiCm(ne, version, "ManagedElement", newValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
|
||||
// ========== SmfFunction ==========
|
||||
var capability int32
|
||||
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)
|
||||
capability = 0
|
||||
}
|
||||
upfNames := []string{}
|
||||
err = dborm.DefaultDB().Table("ne_info").Where("ne_type = ? and status <> 0", "UPF").
|
||||
Select("ne_name").Find(&upfNames).Error
|
||||
if err != nil {
|
||||
log.Errorf("Failed to query UPF list for ne_id %s: %v", ne.NeId, err)
|
||||
}
|
||||
smfFunction := SmfFunction{
|
||||
Id: fmt.Sprintf("%s-%s-SmfFunction", ne.NeType, ne.NeId),
|
||||
UserLabel: ne.NeName + "-SmfFunction",
|
||||
AdministrativeState: adminState,
|
||||
OperationalState: operState,
|
||||
VnfInstanceId: "vnf-" + ne.NeType + "-" + ne.NeId,
|
||||
Fqdn: fmt.Sprintf("%s%s.mnc000.mcc460.3gppnetwork.org", strings.ToLower(ne.NeType), ne.NeId),
|
||||
SbiServiceList: "{Nsmf_PDUSession,Nsmf_EventExposure}",
|
||||
MaxPduSessions: capability,
|
||||
MaxQfi: 64,
|
||||
UpfList: "{" + strings.Join(upfNames, ",") + "}",
|
||||
}
|
||||
smfJSON, err := json.Marshal(smfFunction)
|
||||
if err != nil {
|
||||
log.Errorf("Failed to marshal SmfFunction for ne_id %s: %v", ne.NeId, err)
|
||||
continue
|
||||
}
|
||||
var lastSmfJson string
|
||||
err = dborm.DefaultDB().Table("nbi_cm").
|
||||
Where("ne_type = ? AND ne_id = ? AND object_type = ? AND event_type = ?", ne.NeType, ne.NeId, "SmfFunction", common.ObjectOriginalEvent).
|
||||
Order("timestamp ASC").Pluck("value_json", &lastSmfJson).Error
|
||||
newSmfValueJson := string(smfJSON)
|
||||
if err != nil || lastSmfJson == "" {
|
||||
common.InsertNbiCm(ne, version, "SmfFunction", newSmfValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, version, "SmfFunction", newSmfValueJson, common.ObjectCreationEvent)
|
||||
redisqueue.AddNbiCMQueue([]string{strconv.Itoa(nbiCm.Id)})
|
||||
} else {
|
||||
var ids []string
|
||||
added, modified, deleted, _ := common.CompareJSON(lastSmfJson, newSmfValueJson)
|
||||
if len(added) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "SmfFunction", common.ToJson(added), common.ObjectCreationEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(modified) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "SmfFunction", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(deleted) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "SmfFunction", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
|
||||
if len(ids) > 0 {
|
||||
redisqueue.AddNbiCMQueue(ids)
|
||||
common.InsertNbiCm(ne, version, "SmfFunction", newSmfValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
|
||||
// ========== AddrPool ==========
|
||||
addrPool := AddrPool{
|
||||
Id: fmt.Sprintf("%s-%s-AddrPool", ne.NeType, ne.NeId),
|
||||
UserLabel: ne.NeName + "-AddrPool",
|
||||
AddrType: "Static",
|
||||
IpVersion: "IPv4",
|
||||
AddrSegList: `{{StartIp:10.60.1.100,SegLen:100},{StartIp:10.61.1.100,SegLen:100}}`,
|
||||
}
|
||||
addrPoolJSON, err := json.Marshal(addrPool)
|
||||
if err != nil {
|
||||
log.Errorf("Failed to marshal AddrPool for ne_id %s: %v", ne.NeId, err)
|
||||
} else {
|
||||
var lastAddrPoolJson string
|
||||
err = dborm.DefaultDB().Table("nbi_cm").
|
||||
Where("ne_type = ? AND ne_id = ? AND object_type = ? AND event_type = ?", ne.NeType, ne.NeId, "AddrPool", common.ObjectOriginalEvent).
|
||||
Order("timestamp ASC").Pluck("value_json", &lastAddrPoolJson).Error
|
||||
newAddrPoolValueJson := string(addrPoolJSON)
|
||||
if err != nil || lastAddrPoolJson == "" {
|
||||
common.InsertNbiCm(ne, version, "AddrPool", newAddrPoolValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, version, "AddrPool", newAddrPoolValueJson, common.ObjectCreationEvent)
|
||||
redisqueue.AddNbiCMQueue([]string{strconv.Itoa(nbiCm.Id)})
|
||||
} else {
|
||||
var ids []string
|
||||
added, modified, deleted, _ := common.CompareJSON(lastAddrPoolJson, newAddrPoolValueJson)
|
||||
if len(added) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "AddrPool", common.ToJson(added), common.ObjectCreationEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(modified) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "AddrPool", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(deleted) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "AddrPool", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
|
||||
if len(ids) > 0 {
|
||||
redisqueue.AddNbiCMQueue(ids)
|
||||
common.InsertNbiCm(ne, version, "AddrPool", newAddrPoolValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ========== EpRpDynN7Smf ==========
|
||||
epRpDynN7Smf := EpRpDynN7Smf{
|
||||
Id: fmt.Sprintf("%s-%s-EpRpDynN7Smf", ne.NeType, ne.NeId),
|
||||
UserLabel: ne.NeName + "-N7",
|
||||
LocIpAddrList: `{` + ne.Ip + `}`,
|
||||
FarIpSubnetworkList: `{{Subnetwork:10.17.1.0,Mask:255.255.255.255}}`,
|
||||
}
|
||||
n7JSON, err := json.Marshal(epRpDynN7Smf)
|
||||
if err != nil {
|
||||
log.Errorf("Failed to marshal EpRpDynN7Smf for ne_id %s: %v", ne.NeId, err)
|
||||
} else {
|
||||
var lastN7Json string
|
||||
err = dborm.DefaultDB().Table("nbi_cm").
|
||||
Where("ne_type = ? AND ne_id = ? AND object_type = ? AND event_type = ?", ne.NeType, ne.NeId, "EpRpDynN7Smf", common.ObjectOriginalEvent).
|
||||
Order("timestamp ASC").Pluck("value_json", &lastN7Json).Error
|
||||
newN7ValueJson := string(n7JSON)
|
||||
if err != nil || lastN7Json == "" {
|
||||
common.InsertNbiCm(ne, version, "EpRpDynN7Smf", newN7ValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, version, "EpRpDynN7Smf", newN7ValueJson, common.ObjectCreationEvent)
|
||||
redisqueue.AddNbiCMQueue([]string{strconv.Itoa(nbiCm.Id)})
|
||||
} else {
|
||||
var ids []string
|
||||
added, modified, deleted, _ := common.CompareJSON(lastN7Json, newN7ValueJson)
|
||||
if len(added) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "EpRpDynN7Smf", common.ToJson(added), common.ObjectCreationEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(modified) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "EpRpDynN7Smf", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(deleted) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "EpRpDynN7Smf", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
|
||||
if len(ids) > 0 {
|
||||
redisqueue.AddNbiCMQueue(ids)
|
||||
common.InsertNbiCm(ne, version, "EpRpDynN7Smf", newN7ValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ========== EpRpDynN10Smf ==========
|
||||
epRpDynN10Smf := EpRpDynN10Smf{
|
||||
Id: fmt.Sprintf("%s-%s-EpRpDynN10Smf", ne.NeType, ne.NeId),
|
||||
UserLabel: ne.NeName + "-N10",
|
||||
LocIpAddrList: `{` + ne.Ip + `}`,
|
||||
FarIpSubnetworkList: `{{Subnetwork:10.20.1.0,Mask:255.255.255.255}}`,
|
||||
}
|
||||
n10JSON, err := json.Marshal(epRpDynN10Smf)
|
||||
if err != nil {
|
||||
log.Errorf("Failed to marshal EpRpDynN10Smf for ne_id %s: %v", ne.NeId, err)
|
||||
} else {
|
||||
var lastN10Json string
|
||||
err = dborm.DefaultDB().Table("nbi_cm").
|
||||
Where("ne_type = ? AND ne_id = ? AND object_type = ? AND event_type = ?", ne.NeType, ne.NeId, "EpRpDynN10Smf", common.ObjectOriginalEvent).
|
||||
Order("timestamp ASC").Pluck("value_json", &lastN10Json).Error
|
||||
newN10ValueJson := string(n10JSON)
|
||||
if err != nil || lastN10Json == "" {
|
||||
common.InsertNbiCm(ne, version, "EpRpDynN10Smf", newN10ValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, version, "EpRpDynN10Smf", newN10ValueJson, common.ObjectCreationEvent)
|
||||
redisqueue.AddNbiCMQueue([]string{strconv.Itoa(nbiCm.Id)})
|
||||
} else {
|
||||
var ids []string
|
||||
added, modified, deleted, _ := common.CompareJSON(lastN10Json, newN10ValueJson)
|
||||
if len(added) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "EpRpDynN10Smf", common.ToJson(added), common.ObjectCreationEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(modified) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "EpRpDynN10Smf", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(deleted) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "EpRpDynN10Smf", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
|
||||
if len(ids) > 0 {
|
||||
redisqueue.AddNbiCMQueue(ids)
|
||||
common.InsertNbiCm(ne, version, "EpRpDynN10Smf", newN10ValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ========== IPResource ==========
|
||||
ipResource := IPResource{
|
||||
Id: fmt.Sprintf("%s-%s-IPResource", ne.NeType, ne.NeId),
|
||||
UserLabel: ne.NeName + "-IPResource",
|
||||
InterfaceType: "{Mgt,N4,N7,N10,N11}",
|
||||
LocIpV4AddrList: fmt.Sprintf("{%s,%s,%s,%s,%s}", ne.Ip, ne.Ip, ne.Ip, ne.Ip, ne.Ip),
|
||||
LocIpV6AddrList: "{Default,Default,Default,Default,Default}",
|
||||
}
|
||||
ipJSON, err := json.Marshal(ipResource)
|
||||
if err != nil {
|
||||
log.Errorf("Failed to marshal IPResource for SMF ne_id %s: %v", ne.NeId, err)
|
||||
} else {
|
||||
var lastIpJson string
|
||||
err = dborm.DefaultDB().Table("nbi_cm").
|
||||
Where("ne_type = ? AND ne_id = ? AND object_type = ? AND event_type = ?", ne.NeType, ne.NeId, "IPResource", common.ObjectOriginalEvent).
|
||||
Order("timestamp ASC").Pluck("value_json", &lastIpJson).Error
|
||||
newIpValueJson := string(ipJSON)
|
||||
if err != nil || lastIpJson == "" {
|
||||
common.InsertNbiCm(ne, version, "IPResource", newIpValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, version, "IPResource", newIpValueJson, common.ObjectCreationEvent)
|
||||
redisqueue.AddNbiCMQueue([]string{strconv.Itoa(nbiCm.Id)})
|
||||
} else {
|
||||
var ids []string
|
||||
added, modified, deleted, _ := common.CompareJSON(lastIpJson, newIpValueJson)
|
||||
if len(added) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "IPResource", common.ToJson(added), common.ObjectCreationEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(modified) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "IPResource", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(deleted) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "IPResource", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
|
||||
if len(ids) > 0 {
|
||||
redisqueue.AddNbiCMQueue(ids)
|
||||
common.InsertNbiCm(ne, version, "IPResource", newIpValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
log.Info("SMF NBI CM synchronization completed")
|
||||
return nil
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
package syncNbiNRM
|
||||
|
||||
import (
|
||||
"be.ems/lib/log"
|
||||
"be.ems/src/modules/crontask/processor/syncNbiNRM/amf"
|
||||
"be.ems/src/modules/crontask/processor/syncNbiNRM/pcf"
|
||||
"be.ems/src/modules/crontask/processor/syncNbiNRM/smf"
|
||||
"be.ems/src/modules/crontask/processor/syncNbiNRM/udm"
|
||||
"be.ems/src/modules/crontask/processor/syncNbiNRM/upf"
|
||||
)
|
||||
|
||||
var NewProcessor = &BarProcessor{
|
||||
progress: 0,
|
||||
count: 0,
|
||||
}
|
||||
|
||||
// bar 队列任务处理
|
||||
type BarProcessor struct {
|
||||
// 任务进度
|
||||
progress int
|
||||
// 执行次数
|
||||
count int
|
||||
}
|
||||
|
||||
type BarParams struct {
|
||||
Duration int `json:"duration"`
|
||||
TableName string `json:"tableName"`
|
||||
Columns string `json:"columns"` // exported column name of time string
|
||||
TimeCol string `json:"timeCol"` // time stamp of column name
|
||||
TimeUnit string `json:"timeUnit"` // timestamp unit: second/micro/milli
|
||||
Extras string `json:"extras"` // extras condition for where
|
||||
FilePath string `json:"filePath"` // file path
|
||||
}
|
||||
|
||||
func (s *BarProcessor) Execute(data any) (any, error) {
|
||||
s.count++
|
||||
|
||||
// options := data.(cron.JobData)
|
||||
// sysJob := options.SysJob
|
||||
// var params BarParams
|
||||
|
||||
err := amf.SyncNbiCM()
|
||||
if err != nil {
|
||||
log.Errorf("SyncAmfNbiCM error: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
err = pcf.SyncNbiCM()
|
||||
if err != nil {
|
||||
log.Errorf("SyncPcfNbiCM error: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
err = udm.SyncNbiCM()
|
||||
if err != nil {
|
||||
log.Errorf("SyncUdmNbiCM error: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
err = smf.SyncNbiCM()
|
||||
if err != nil {
|
||||
log.Errorf("SyncSmfNbiCM error: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
err = upf.SyncNbiCM()
|
||||
if err != nil {
|
||||
log.Errorf("SyncUpfNbiCM error: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// 返回结果,用于记录执行结果
|
||||
return map[string]any{
|
||||
"msg": "sucess",
|
||||
}, nil
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
package udm
|
||||
|
||||
import "be.ems/src/modules/crontask/processor/syncNbiNRM/common"
|
||||
|
||||
type ManagedElement struct {
|
||||
Id string `json:"id"`
|
||||
UserLabel string `json:"userLabel"`
|
||||
VendorName string `json:"vendorName"`
|
||||
ManagedBy string `json:"managedBy"`
|
||||
ManagementIpAddress string `json:"managementIpAddress"`
|
||||
SwVersion string `json:"swVersion"`
|
||||
PatchInfo string `json:"patchInfo"`
|
||||
AdministrativeState common.AdministrativeState `json:"administrativeState"`
|
||||
OperationalState common.OperationalState `json:"operationalState"`
|
||||
}
|
||||
|
||||
type UdmFunction struct {
|
||||
Id string `json:"id"`
|
||||
UserLabel string `json:"userLabel"`
|
||||
AdministrativeState common.AdministrativeState `json:"administrativeState"`
|
||||
OperationalState common.OperationalState `json:"operationalState"`
|
||||
VnfInstanceId string `json:"vnfInstanceId"`
|
||||
Fqdn string `json:"fqdn"`
|
||||
SbiServiceList string `json:"sbiServiceList"`
|
||||
}
|
||||
|
||||
type UdrFunction struct {
|
||||
Id string `json:"id"`
|
||||
UserLabel string `json:"userLabel"`
|
||||
AdministrativeState common.AdministrativeState `json:"administrativeState"`
|
||||
OperationalState common.OperationalState `json:"operationalState"`
|
||||
VnfInstanceId string `json:"vnfInstanceId"`
|
||||
Fqdn string `json:"fqdn"`
|
||||
SbiServiceList string `json:"sbiServiceList"`
|
||||
MaxNumSupi int `json:"maxNumSupi"`
|
||||
MaxNumMsisdn int `json:"maxNumMsisdn"`
|
||||
}
|
||||
|
||||
type AusfFunction struct {
|
||||
Id string `json:"id"`
|
||||
UserLabel string `json:"userLabel"`
|
||||
AdministrativeState common.AdministrativeState `json:"administrativeState"`
|
||||
OperationalState common.OperationalState `json:"operationalState"`
|
||||
VnfInstanceId string `json:"vnfInstanceId"`
|
||||
Fqdn string `json:"fqdn"`
|
||||
SbiServiceList string `json:"sbiServiceList"`
|
||||
}
|
||||
|
||||
type IPResource struct {
|
||||
Id string `json:"id"`
|
||||
UserLabel string `json:"userLabel"`
|
||||
InterfaceType string `json:"interfaceType"`
|
||||
LocIpV4AddrList string `json:"locIpV4AddrList"`
|
||||
LocIpV6AddrList string `json:"locIpV6AddrList"`
|
||||
}
|
||||
@@ -1,284 +0,0 @@
|
||||
package udm
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"be.ems/features/nbi/redisqueue"
|
||||
"be.ems/lib/dborm"
|
||||
"be.ems/lib/log"
|
||||
"be.ems/src/modules/crontask/processor/syncNbiNRM/common"
|
||||
)
|
||||
|
||||
// SyncUdmNbiCM 从ne_info获取UDM网元并同步数据到nbi_cm表
|
||||
func SyncNbiCM() error {
|
||||
log.Info("Starting UDM NBI CM synchronization")
|
||||
|
||||
// 从ne_info表获取UDM类型的网元
|
||||
var udmNEs []common.NeInfo
|
||||
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)
|
||||
return err
|
||||
}
|
||||
|
||||
log.Infof("Found %d UDM network elements", len(udmNEs))
|
||||
|
||||
for _, ne := range udmNEs {
|
||||
adminState, operState := common.ParseStateFromStatus(ne.Status)
|
||||
|
||||
var version string = "-"
|
||||
err := dborm.DefaultDB().Table("ne_version").
|
||||
Where("ne_type = ? and ne_id = ?", ne.NeType, ne.NeId).
|
||||
Pluck("version", &version).Error
|
||||
if err != nil {
|
||||
log.Errorf("Failed to query %s version: %v", ne.NeName, err)
|
||||
return err
|
||||
}
|
||||
|
||||
// ========== ManagedElement ==========
|
||||
managedElement := ManagedElement{
|
||||
Id: fmt.Sprintf("%s-%s-ManagedElement", ne.NeType, ne.NeId),
|
||||
UserLabel: ne.NeName,
|
||||
VendorName: ne.VendorName,
|
||||
ManagedBy: ne.Dn,
|
||||
ManagementIpAddress: "{" + ne.Ip + "}",
|
||||
SwVersion: version,
|
||||
PatchInfo: "-",
|
||||
AdministrativeState: adminState,
|
||||
OperationalState: operState,
|
||||
}
|
||||
meJSON, err := json.Marshal(managedElement)
|
||||
if err != nil {
|
||||
log.Errorf("Failed to marshal ManagedElement for UDM ne_id %s: %v", ne.NeId, err)
|
||||
continue
|
||||
}
|
||||
var lastJson string
|
||||
err = dborm.DefaultDB().Table("nbi_cm").
|
||||
Where("ne_type = ? AND ne_id = ? AND object_type = ? AND event_type = ?", ne.NeType, ne.NeId, "ManagedElement", common.ObjectOriginalEvent).
|
||||
Order("timestamp ASC").Pluck("value_json", &lastJson).Error
|
||||
newValueJson := string(meJSON)
|
||||
if err != nil || lastJson == "" {
|
||||
common.InsertNbiCm(ne, version, "ManagedElement", newValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, version, "ManagedElement", newValueJson, common.ObjectCreationEvent)
|
||||
redisqueue.AddNbiCMQueue([]string{strconv.Itoa(nbiCm.Id)})
|
||||
} else {
|
||||
var ids []string
|
||||
added, modified, deleted, _ := common.CompareJSON(lastJson, newValueJson)
|
||||
if len(added) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "ManagedElement", common.ToJson(added), common.ObjectCreationEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(modified) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "ManagedElement", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(deleted) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "ManagedElement", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
|
||||
if len(ids) > 0 {
|
||||
redisqueue.AddNbiCMQueue(ids)
|
||||
common.InsertNbiCm(ne, version, "ManagedElement", newValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
|
||||
// ========== UdmFunction ==========
|
||||
udmFunction := UdmFunction{
|
||||
Id: fmt.Sprintf("%s-%s-UdmFunction", ne.NeType, ne.NeId),
|
||||
UserLabel: ne.NeName + "-UdmFunction",
|
||||
AdministrativeState: adminState,
|
||||
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}",
|
||||
}
|
||||
udmJSON, err := json.Marshal(udmFunction)
|
||||
if err != nil {
|
||||
log.Errorf("Failed to marshal UdmFunction for ne_id %s: %v", ne.NeId, err)
|
||||
continue
|
||||
}
|
||||
var lastUdmJson string
|
||||
err = dborm.DefaultDB().Table("nbi_cm").
|
||||
Where("ne_type = ? AND ne_id = ? AND object_type = ? AND event_type = ?", ne.NeType, ne.NeId, "UdmFunction", common.ObjectOriginalEvent).
|
||||
Order("timestamp ASC").Pluck("value_json", &lastUdmJson).Error
|
||||
newUdmValueJson := string(udmJSON)
|
||||
if err != nil || lastUdmJson == "" {
|
||||
common.InsertNbiCm(ne, version, "UdmFunction", newUdmValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, version, "UdmFunction", newUdmValueJson, common.ObjectCreationEvent)
|
||||
redisqueue.AddNbiCMQueue([]string{strconv.Itoa(nbiCm.Id)})
|
||||
} else {
|
||||
var ids []string
|
||||
added, modified, deleted, _ := common.CompareJSON(lastUdmJson, newUdmValueJson)
|
||||
if len(added) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "UdmFunction", common.ToJson(added), common.ObjectCreationEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(modified) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "UdmFunction", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(deleted) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "UdmFunction", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
|
||||
if len(ids) > 0 {
|
||||
redisqueue.AddNbiCMQueue(ids)
|
||||
common.InsertNbiCm(ne, version, "UdmFunction", newUdmValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
|
||||
// ========== UdrFunction ==========
|
||||
var capability int
|
||||
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)
|
||||
capability = 0
|
||||
}
|
||||
udrFunction := UdrFunction{
|
||||
Id: fmt.Sprintf("%s-%s-UdrFunction", ne.NeType, ne.NeId),
|
||||
UserLabel: ne.NeName + "-UdrFunction",
|
||||
AdministrativeState: adminState,
|
||||
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}",
|
||||
MaxNumSupi: capability,
|
||||
MaxNumMsisdn: capability,
|
||||
}
|
||||
udrJSON, err := json.Marshal(udrFunction)
|
||||
if err != nil {
|
||||
log.Errorf("Failed to marshal UdrFunction for ne_id %s: %v", ne.NeId, err)
|
||||
} else {
|
||||
var lastUdrJson string
|
||||
err = dborm.DefaultDB().Table("nbi_cm").
|
||||
Where("ne_type = ? AND ne_id = ? AND object_type = ? AND event_type = ?", ne.NeType, ne.NeId, "UdrFunction", common.ObjectOriginalEvent).
|
||||
Order("timestamp ASC").Pluck("value_json", &lastUdrJson).Error
|
||||
newUdrValueJson := string(udrJSON)
|
||||
if err != nil || lastUdrJson == "" {
|
||||
common.InsertNbiCm(ne, version, "UdrFunction", newUdrValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, version, "UdrFunction", newUdrValueJson, common.ObjectCreationEvent)
|
||||
redisqueue.AddNbiCMQueue([]string{strconv.Itoa(nbiCm.Id)})
|
||||
} else {
|
||||
var ids []string
|
||||
added, modified, deleted, _ := common.CompareJSON(lastUdrJson, newUdrValueJson)
|
||||
if len(added) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "UdrFunction", common.ToJson(added), common.ObjectCreationEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(modified) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "UdrFunction", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(deleted) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "UdrFunction", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
|
||||
if len(ids) > 0 {
|
||||
redisqueue.AddNbiCMQueue(ids)
|
||||
common.InsertNbiCm(ne, version, "UdrFunction", newUdrValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ========== AusfFunction ==========
|
||||
ausfFunction := AusfFunction{
|
||||
Id: fmt.Sprintf("%s-%s-AusfFunction", ne.NeType, ne.NeId),
|
||||
UserLabel: ne.NeName + "-AusfFunction",
|
||||
AdministrativeState: adminState,
|
||||
OperationalState: operState,
|
||||
VnfInstanceId: "vnf-AUSF-" + ne.NeId,
|
||||
Fqdn: fmt.Sprintf("ausf%s.mnc000.mcc460.3gppnetwork.org", ne.NeId),
|
||||
SbiServiceList: "{Nausf_UEAuthentication,Nausf_SoRProtection}",
|
||||
}
|
||||
ausfJSON, err := json.Marshal(ausfFunction)
|
||||
if err != nil {
|
||||
log.Errorf("Failed to marshal AusfFunction for ne_id %s: %v", ne.NeId, err)
|
||||
} else {
|
||||
var lastAusfJson string
|
||||
err = dborm.DefaultDB().Table("nbi_cm").
|
||||
Where("ne_type = ? AND ne_id = ? AND object_type = ? AND event_type = ?", ne.NeType, ne.NeId, "AusfFunction", common.ObjectOriginalEvent).
|
||||
Order("timestamp ASC").Pluck("value_json", &lastAusfJson).Error
|
||||
newAusfValueJson := string(ausfJSON)
|
||||
if err != nil || lastAusfJson == "" {
|
||||
common.InsertNbiCm(ne, version, "AusfFunction", newAusfValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, version, "AusfFunction", newAusfValueJson, common.ObjectCreationEvent)
|
||||
redisqueue.AddNbiCMQueue([]string{strconv.Itoa(nbiCm.Id)})
|
||||
} else {
|
||||
var ids []string
|
||||
added, modified, deleted, _ := common.CompareJSON(lastAusfJson, newAusfValueJson)
|
||||
if len(added) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "AusfFunction", common.ToJson(added), common.ObjectCreationEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(modified) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "AusfFunction", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(deleted) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "AusfFunction", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
|
||||
if len(ids) > 0 {
|
||||
redisqueue.AddNbiCMQueue(ids)
|
||||
common.InsertNbiCm(ne, version, "AusfFunction", newAusfValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ========== IPResource ==========
|
||||
ipResource := IPResource{
|
||||
Id: fmt.Sprintf("%s-%s-IPResource", ne.NeType, ne.NeId),
|
||||
UserLabel: ne.NeName + "-IPResource",
|
||||
InterfaceType: "{Mgt,N8,N10,N12,N21}",
|
||||
LocIpV4AddrList: fmt.Sprintf("{%s,%s,%s,%s,%s}", ne.Ip, ne.Ip, ne.Ip, ne.Ip, ne.Ip),
|
||||
LocIpV6AddrList: "{Default,Default,Default,Default,Default}",
|
||||
}
|
||||
ipJSON, err := json.Marshal(ipResource)
|
||||
if err != nil {
|
||||
log.Errorf("Failed to marshal IPResource for UDM ne_id %s: %v", ne.NeId, err)
|
||||
} else {
|
||||
var lastIpJson string
|
||||
err = dborm.DefaultDB().Table("nbi_cm").
|
||||
Where("ne_type = ? AND ne_id = ? AND object_type = ? AND event_type = ?", ne.NeType, ne.NeId, "IPResource", common.ObjectOriginalEvent).
|
||||
Order("timestamp ASC").Pluck("value_json", &lastIpJson).Error
|
||||
newIpValueJson := string(ipJSON)
|
||||
if err != nil || lastIpJson == "" {
|
||||
common.InsertNbiCm(ne, version, "IPResource", newIpValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, version, "IPResource", newIpValueJson, common.ObjectCreationEvent)
|
||||
redisqueue.AddNbiCMQueue([]string{strconv.Itoa(nbiCm.Id)})
|
||||
} else {
|
||||
var ids []string
|
||||
added, modified, deleted, _ := common.CompareJSON(lastIpJson, newIpValueJson)
|
||||
if len(added) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "IPResource", common.ToJson(added), common.ObjectCreationEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(modified) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "IPResource", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(deleted) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "IPResource", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
|
||||
if len(ids) > 0 {
|
||||
redisqueue.AddNbiCMQueue(ids)
|
||||
common.InsertNbiCm(ne, version, "IPResource", newIpValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
log.Info("UDM NBI CM synchronization completed")
|
||||
return nil
|
||||
}
|
||||
@@ -1,163 +0,0 @@
|
||||
package upf
|
||||
|
||||
import "be.ems/src/modules/crontask/processor/syncNbiNRM/common"
|
||||
|
||||
type ManagedElement struct {
|
||||
Id string `json:"id"`
|
||||
UserLabel string `json:"userLabel"`
|
||||
VendorName string `json:"vendorName"`
|
||||
ManagedBy string `json:"managedBy"`
|
||||
ManagementIpAddress string `json:"managementIpAddress"`
|
||||
SwVersion string `json:"swVersion"`
|
||||
PatchInfo string `json:"patchInfo"`
|
||||
AdministrativeState common.AdministrativeState `json:"administrativeState"`
|
||||
OperationalState common.OperationalState `json:"operationalState"`
|
||||
LocationName string `json:"locationName"`
|
||||
HardwarePlatform string `json:"hardwarePlatform"`
|
||||
}
|
||||
|
||||
type InventoryUnitRack struct {
|
||||
Id string `json:"id"`
|
||||
UserLabel string `json:"userLabel"`
|
||||
VendorUnitFamilyType string `json:"vendorUnitFamilyType"`
|
||||
VendorUnitTypeNumber string `json:"vendorUnitTypeNumber"`
|
||||
VendorName string `json:"vendorName"`
|
||||
SerialNumber string `json:"serialNumber"`
|
||||
VersionNumber string `json:"versionNumber"`
|
||||
DateOfManufacture string `json:"dateOfManufacture"`
|
||||
DateOfLastService string `json:"dateOfLastService"`
|
||||
ManufacturerData string `json:"manufacturerData"`
|
||||
RackPosition string `json:"rackPosition"`
|
||||
}
|
||||
|
||||
type InventoryUnitShelf struct {
|
||||
Id string `json:"id"`
|
||||
UserLabel string `json:"userLabel"`
|
||||
VendorUnitFamilyType string `json:"vendorUnitFamilyType"`
|
||||
VendorUnitTypeNumber string `json:"vendorUnitTypeNumber"`
|
||||
VendorName string `json:"vendorName"`
|
||||
SerialNumber string `json:"serialNumber"`
|
||||
VersionNumber string `json:"versionNumber"`
|
||||
DateOfManufacture string `json:"dateOfManufacture"`
|
||||
DateOfLastService string `json:"dateOfLastService"`
|
||||
ManufacturerData string `json:"manufacturerData"`
|
||||
SlotsInformation string `json:"slotsInformation"`
|
||||
ShelfPosition string `json:"shelfPosition"`
|
||||
}
|
||||
|
||||
type InventoryUnitPack struct {
|
||||
Id string `json:"id"`
|
||||
UserLabel string `json:"userLabel"`
|
||||
VendorUnitFamilyType string `json:"vendorUnitFamilyType"`
|
||||
VendorUnitTypeNumber string `json:"vendorUnitTypeNumber"`
|
||||
VendorName string `json:"vendorName"`
|
||||
SerialNumber string `json:"serialNumber"`
|
||||
VersionNumber string `json:"versionNumber"`
|
||||
DateOfManufacture string `json:"dateOfManufacture"`
|
||||
DateOfLastService string `json:"dateOfLastService"`
|
||||
ManufacturerData string `json:"manufacturerData"`
|
||||
PortsInformation string `json:"portsInformation"`
|
||||
PackPosition string `json:"packPosition"`
|
||||
SlotsOccupied string `json:"slotsOccupied"`
|
||||
}
|
||||
|
||||
type InventoryUnitHost struct {
|
||||
Id string `json:"id"`
|
||||
UserLabel string `json:"userLabel"`
|
||||
VendorUnitFamilyType string `json:"vendorUnitFamilyType"`
|
||||
VendorUnitTypeNumber string `json:"vendorUnitTypeNumber"`
|
||||
VendorName string `json:"vendorName"`
|
||||
SerialNumber string `json:"serialNumber"`
|
||||
VersionNumber string `json:"versionNumber"`
|
||||
DateOfManufacture string `json:"dateOfManufacture"`
|
||||
DateOfLastService string `json:"dateOfLastService"`
|
||||
ManufacturerData string `json:"manufacturerData"`
|
||||
HostPosition string `json:"hostPosition"`
|
||||
NumberOfCpu int32 `json:"numberOfCpu"`
|
||||
MemSize float32 `json:"memSize"`
|
||||
HardDiskSize float32 `json:"hardDiskSize"`
|
||||
}
|
||||
|
||||
type InventoryUnitAccessory struct {
|
||||
Id string `json:"id"`
|
||||
UserLabel string `json:"userLabel"`
|
||||
VendorUnitFamilyType string `json:"vendorUnitFamilyType"`
|
||||
VendorUnitTypeNumber string `json:"vendorUnitTypeNumber"`
|
||||
VendorName string `json:"vendorName"`
|
||||
SerialNumber string `json:"serialNumber"`
|
||||
VersionNumber string `json:"versionNumber"`
|
||||
DateOfManufacture string `json:"dateOfManufacture"`
|
||||
DateOfLastService string `json:"dateOfLastService"`
|
||||
ManufacturerData string `json:"manufacturerData"`
|
||||
AccessoryPosition string `json:"accessoryPosition"`
|
||||
AccessoryType string `json:"accessoryType"`
|
||||
AddtionalInformation string `json:"addtionalInformation"`
|
||||
}
|
||||
|
||||
type UpfFunction struct {
|
||||
Id string `json:"id"`
|
||||
UserLabel string `json:"userLabel"`
|
||||
AdministrativeState common.AdministrativeState `json:"administrativeState"`
|
||||
OperationalState common.OperationalState `json:"operationalState"`
|
||||
VnfInstanceId string `json:"vnfInstanceId"`
|
||||
MaxQosFlows int32 `json:"maxQosFlows"`
|
||||
MaxThroughput float32 `json:"maxThroughput"`
|
||||
}
|
||||
|
||||
type EpRpDynN9Upf struct {
|
||||
Id string `json:"id"`
|
||||
UserLabel string `json:"userLabel"`
|
||||
LocIpAddrList string `json:"locIpAddrList"`
|
||||
FarIpSubnetworkList string `json:"farIpSubnetworkList"`
|
||||
}
|
||||
|
||||
type EpRpDynN3Upf struct {
|
||||
Id string `json:"id"`
|
||||
UserLabel string `json:"userLabel"`
|
||||
LocIpAddrList string `json:"locIpAddrList"`
|
||||
FarIpSubnetworkList string `json:"farIpSubnetworkList"`
|
||||
}
|
||||
|
||||
type AmfFunction struct {
|
||||
Id string `json:"id"`
|
||||
UserLabel string `json:"userLabel"`
|
||||
AdministrativeState string `json:"administrativeState"`
|
||||
OperationalState string `json:"operationalState"`
|
||||
VnfInstanceId string `json:"vnfInstanceId"`
|
||||
Fqdn string `json:"fqdn"`
|
||||
}
|
||||
|
||||
type SmfFunction struct {
|
||||
Id string `json:"id"`
|
||||
UserLabel string `json:"userLabel"`
|
||||
AdministrativeState common.AdministrativeState `json:"administrativeState"`
|
||||
OperationalState common.OperationalState `json:"operationalState"`
|
||||
VnfInstanceId string `json:"vnfInstanceId"`
|
||||
Fqdn string `json:"fqdn"`
|
||||
}
|
||||
|
||||
type UdrFunction struct {
|
||||
Id string `json:"id"`
|
||||
UserLabel string `json:"userLabel"`
|
||||
AdministrativeState common.AdministrativeState `json:"administrativeState"`
|
||||
OperationalState common.OperationalState `json:"operationalState"`
|
||||
VnfInstanceId string `json:"vnfInstanceId"`
|
||||
Fqdn string `json:"fqdn"`
|
||||
}
|
||||
|
||||
type AusfFunction struct {
|
||||
Id string `json:"id"`
|
||||
UserLabel string `json:"userLabel"`
|
||||
AdministrativeState common.AdministrativeState `json:"administrativeState"`
|
||||
OperationalState common.OperationalState `json:"operationalState"`
|
||||
VnfInstanceId string `json:"vnfInstanceId"`
|
||||
Fqdn string `json:"fqdn"`
|
||||
}
|
||||
|
||||
type IPResource struct {
|
||||
Id string `json:"id"`
|
||||
UserLabel string `json:"userLabel"`
|
||||
InterfaceType string `json:"interfaceType"`
|
||||
LocIpV4AddrList string `json:"locIpV4AddrList"`
|
||||
LocIpV6AddrList string `json:"locIpV6AddrList"`
|
||||
}
|
||||
@@ -1,540 +0,0 @@
|
||||
package upf
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"be.ems/features/nbi/redisqueue"
|
||||
"be.ems/lib/dborm"
|
||||
"be.ems/lib/log"
|
||||
"be.ems/src/modules/crontask/processor/syncNbiNRM/common"
|
||||
)
|
||||
|
||||
// SyncUpfNbiCM 从ne_info获取UPF网元并同步数据到nbi_cm表
|
||||
func SyncNbiCM() error {
|
||||
log.Info("Starting UPF NBI CM synchronization")
|
||||
|
||||
// 从ne_info表获取UPF类型的网元
|
||||
var upfNEs []common.NeInfo
|
||||
err := dborm.DefaultDB().Table("ne_info").Where("ne_type = ? and status <> 0", "UPF").
|
||||
Find(&upfNEs).Error
|
||||
if err != nil {
|
||||
log.Errorf("Failed to query UPF network elements: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
log.Infof("Found %d UPF network elements", len(upfNEs))
|
||||
|
||||
now := time.Now()
|
||||
|
||||
for i, ne := range upfNEs {
|
||||
adminState, operState := common.ParseStateFromStatus(ne.Status)
|
||||
|
||||
var version string = "-"
|
||||
err := dborm.DefaultDB().Table("ne_version").
|
||||
Where("ne_type = ? and ne_id = ?", ne.NeType, ne.NeId).
|
||||
Pluck("version", &version).Error
|
||||
if err != nil {
|
||||
log.Errorf("Failed to query %s version: %v", ne.NeName, err)
|
||||
return err
|
||||
}
|
||||
|
||||
// ========== ManagedElement ==========
|
||||
managedElement := ManagedElement{
|
||||
Id: fmt.Sprintf("%s-%s-ManagedElement", ne.NeType, ne.NeId),
|
||||
UserLabel: ne.NeName,
|
||||
VendorName: ne.VendorName,
|
||||
ManagedBy: ne.Dn,
|
||||
ManagementIpAddress: "{" + ne.Ip + "}",
|
||||
SwVersion: version,
|
||||
PatchInfo: "-",
|
||||
AdministrativeState: adminState,
|
||||
OperationalState: operState,
|
||||
LocationName: ne.Province,
|
||||
HardwarePlatform: "x86_64",
|
||||
}
|
||||
meJSON, err := json.Marshal(managedElement)
|
||||
if err != nil {
|
||||
log.Errorf("Failed to marshal ManagedElement for UPF ne_id %s: %v", ne.NeId, err)
|
||||
continue
|
||||
}
|
||||
var lastJson string
|
||||
err = dborm.DefaultDB().Table("nbi_cm").
|
||||
Where("ne_type = ? AND ne_id = ? AND object_type = ? AND event_type = ?", ne.NeType, ne.NeId, "ManagedElement", common.ObjectOriginalEvent).
|
||||
Order("timestamp ASC").Pluck("value_json", &lastJson).Error
|
||||
newValueJson := string(meJSON)
|
||||
if err != nil || lastJson == "" {
|
||||
common.InsertNbiCm(ne, version, "ManagedElement", newValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, version, "ManagedElement", newValueJson, common.ObjectCreationEvent)
|
||||
redisqueue.AddNbiCMQueue([]string{strconv.Itoa(nbiCm.Id)})
|
||||
} else {
|
||||
var ids []string
|
||||
added, modified, deleted, _ := common.CompareJSON(lastJson, newValueJson)
|
||||
if len(added) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "ManagedElement", common.ToJson(added), common.ObjectCreationEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(modified) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "ManagedElement", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(deleted) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "ManagedElement", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
|
||||
if len(ids) > 0 {
|
||||
redisqueue.AddNbiCMQueue(ids)
|
||||
common.InsertNbiCm(ne, version, "ManagedElement", newValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
|
||||
// ========== InventoryUnitRack ==========
|
||||
inventoryUnitRack := InventoryUnitRack{
|
||||
Id: fmt.Sprintf("%s-%s-InventoryUnitRack", ne.NeType, ne.NeId),
|
||||
UserLabel: ne.NeName + "-InventoryUnitRack",
|
||||
VendorUnitFamilyType: "5G-UPF",
|
||||
VendorUnitTypeNumber: "UPF-" + ne.NeId,
|
||||
VendorName: ne.VendorName,
|
||||
SerialNumber: "SN-UPF-" + ne.NeId,
|
||||
VersionNumber: "1.2.16",
|
||||
DateOfManufacture: "2023-01-01",
|
||||
DateOfLastService: now.AddDate(0, 0, 360).Format("2006-01-02"),
|
||||
ManufacturerData: "{}",
|
||||
RackPosition: "1-2",
|
||||
}
|
||||
rackJSON, err := json.Marshal(inventoryUnitRack)
|
||||
if err != nil {
|
||||
log.Errorf("Failed to marshal InventoryUnitRack for ne_id %s: %v", ne.NeId, err)
|
||||
} else {
|
||||
var lastRackJson string
|
||||
err = dborm.DefaultDB().Table("nbi_cm").
|
||||
Where("ne_type = ? AND ne_id = ? AND object_type = ? AND event_type = ?", ne.NeType, ne.NeId, "InventoryUnitRack", common.ObjectOriginalEvent).
|
||||
Order("timestamp ASC").Pluck("value_json", &lastRackJson).Error
|
||||
newRackValueJson := string(rackJSON)
|
||||
if err != nil || lastRackJson == "" {
|
||||
common.InsertNbiCm(ne, version, "InventoryUnitRack", newRackValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, version, "InventoryUnitRack", newRackValueJson, common.ObjectCreationEvent)
|
||||
redisqueue.AddNbiCMQueue([]string{strconv.Itoa(nbiCm.Id)})
|
||||
} else {
|
||||
var ids []string
|
||||
added, modified, deleted, _ := common.CompareJSON(lastRackJson, newRackValueJson)
|
||||
if len(added) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "InventoryUnitRack", common.ToJson(added), common.ObjectCreationEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(modified) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "InventoryUnitRack", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(deleted) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "InventoryUnitRack", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
|
||||
if len(ids) > 0 {
|
||||
redisqueue.AddNbiCMQueue(ids)
|
||||
common.InsertNbiCm(ne, version, "InventoryUnitRack", newRackValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ========== InventoryUnitShelf ==========
|
||||
var slotsInfo string = fmt.Sprintf(`{{"slot-%d","-",Unused}}`, i+1)
|
||||
inventoryUnitShelf := InventoryUnitShelf{
|
||||
Id: fmt.Sprintf("%s-%s-InventoryUnitShelf", ne.NeType, ne.NeId),
|
||||
UserLabel: ne.NeName + "-InventoryUnitShelf",
|
||||
VendorUnitFamilyType: "5G-UPF-SHELF",
|
||||
VendorUnitTypeNumber: "UPF-SHELF-" + ne.NeId,
|
||||
VendorName: ne.VendorName,
|
||||
SerialNumber: "SN-UPF-SHELF-" + ne.NeId,
|
||||
VersionNumber: "1.2.15",
|
||||
DateOfManufacture: "2023-01-01",
|
||||
DateOfLastService: now.AddDate(0, 0, 360).Format("2006-01-02"),
|
||||
ManufacturerData: "{}",
|
||||
SlotsInformation: slotsInfo,
|
||||
ShelfPosition: "1",
|
||||
}
|
||||
shelfJSON, err := json.Marshal(inventoryUnitShelf)
|
||||
if err != nil {
|
||||
log.Errorf("Failed to marshal InventoryUnitShelf for ne_id %s: %v", ne.NeId, err)
|
||||
} else {
|
||||
var lastShelfJson string
|
||||
err = dborm.DefaultDB().Table("nbi_cm").
|
||||
Where("ne_type = ? AND ne_id = ? AND object_type = ? AND event_type = ?", ne.NeType, ne.NeId, "InventoryUnitShelf", common.ObjectOriginalEvent).
|
||||
Order("timestamp ASC").Pluck("value_json", &lastShelfJson).Error
|
||||
newShelfValueJson := string(shelfJSON)
|
||||
if err != nil || lastShelfJson == "" {
|
||||
common.InsertNbiCm(ne, version, "InventoryUnitShelf", newShelfValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, version, "InventoryUnitShelf", newShelfValueJson, common.ObjectCreationEvent)
|
||||
redisqueue.AddNbiCMQueue([]string{strconv.Itoa(nbiCm.Id)})
|
||||
} else {
|
||||
var ids []string
|
||||
added, modified, deleted, _ := common.CompareJSON(lastShelfJson, newShelfValueJson)
|
||||
if len(added) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "InventoryUnitShelf", common.ToJson(added), common.ObjectCreationEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(modified) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "InventoryUnitShelf", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(deleted) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "InventoryUnitShelf", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
|
||||
if len(ids) > 0 {
|
||||
redisqueue.AddNbiCMQueue(ids)
|
||||
common.InsertNbiCm(ne, version, "InventoryUnitShelf", newShelfValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ========== InventoryUnitPack ==========
|
||||
inventoryUnitPack := InventoryUnitPack{
|
||||
Id: fmt.Sprintf("%s-%s-InventoryUnitPack", ne.NeType, ne.NeId),
|
||||
UserLabel: ne.NeName + "-InventoryUnitPack",
|
||||
VendorUnitFamilyType: "5G-UPF-PACK",
|
||||
VendorUnitTypeNumber: "UPF-PACK-" + ne.NeId,
|
||||
VendorName: ne.VendorName,
|
||||
SerialNumber: "SN-UPF-PACK-" + ne.NeId,
|
||||
VersionNumber: "1.2.14",
|
||||
DateOfManufacture: "2023-01-01",
|
||||
DateOfLastService: now.AddDate(0, 0, 360).Format("2006-01-02"),
|
||||
ManufacturerData: "{}",
|
||||
PortsInformation: `{{"port-1","Ethernet 10Gbs",Used},{"port-2","Ethernet 10Gbps",Used}, {"port-3","optical 50Gbps",Used}, {"port-4","optical 50Gbps",Unused}}`,
|
||||
PackPosition: "2-2",
|
||||
SlotsOccupied: `{"3","4"}`,
|
||||
}
|
||||
packJSON, err := json.Marshal(inventoryUnitPack)
|
||||
if err != nil {
|
||||
log.Errorf("Failed to marshal InventoryUnitPack for ne_id %s: %v", ne.NeId, err)
|
||||
} else {
|
||||
var lastPackJson string
|
||||
err = dborm.DefaultDB().Table("nbi_cm").
|
||||
Where("ne_type = ? AND ne_id = ? AND object_type = ? AND event_type = ?", ne.NeType, ne.NeId, "InventoryUnitPack", common.ObjectOriginalEvent).
|
||||
Order("timestamp ASC").Pluck("value_json", &lastPackJson).Error
|
||||
newPackValueJson := string(packJSON)
|
||||
if err != nil || lastPackJson == "" {
|
||||
common.InsertNbiCm(ne, version, "InventoryUnitPack", newPackValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, version, "InventoryUnitPack", newPackValueJson, common.ObjectCreationEvent)
|
||||
redisqueue.AddNbiCMQueue([]string{strconv.Itoa(nbiCm.Id)})
|
||||
} else {
|
||||
var ids []string
|
||||
added, modified, deleted, _ := common.CompareJSON(lastPackJson, newPackValueJson)
|
||||
if len(added) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "InventoryUnitPack", common.ToJson(added), common.ObjectCreationEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(modified) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "InventoryUnitPack", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(deleted) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "InventoryUnitPack", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
|
||||
if len(ids) > 0 {
|
||||
redisqueue.AddNbiCMQueue(ids)
|
||||
common.InsertNbiCm(ne, version, "InventoryUnitPack", newPackValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ========== InventoryUnitHost ==========
|
||||
inventoryUnitHost := InventoryUnitHost{
|
||||
Id: fmt.Sprintf("%s-%s-InventoryUnitHost", ne.NeType, ne.NeId),
|
||||
UserLabel: ne.NeName + "-InventoryUnitHost",
|
||||
VendorUnitFamilyType: "5G-UPF-HOST",
|
||||
VendorUnitTypeNumber: "UPF-HOST-" + ne.NeId,
|
||||
VendorName: ne.VendorName,
|
||||
SerialNumber: "SN-UPF-HOST-" + ne.NeId,
|
||||
VersionNumber: "1.2.16",
|
||||
DateOfManufacture: "2023-01-01",
|
||||
DateOfLastService: now.AddDate(0, 0, 360).Format("2006-01-02"),
|
||||
ManufacturerData: "{}",
|
||||
HostPosition: "1",
|
||||
NumberOfCpu: 16,
|
||||
MemSize: 64,
|
||||
HardDiskSize: 1024,
|
||||
}
|
||||
hostJSON, err := json.Marshal(inventoryUnitHost)
|
||||
if err != nil {
|
||||
log.Errorf("Failed to marshal InventoryUnitHost for ne_id %s: %v", ne.NeId, err)
|
||||
} else {
|
||||
var lastHostJson string
|
||||
err = dborm.DefaultDB().Table("nbi_cm").
|
||||
Where("ne_type = ? AND ne_id = ? AND object_type = ? AND event_type = ?", ne.NeType, ne.NeId, "InventoryUnitHost", common.ObjectOriginalEvent).
|
||||
Order("timestamp ASC").Pluck("value_json", &lastHostJson).Error
|
||||
newHostValueJson := string(hostJSON)
|
||||
if err != nil || lastHostJson == "" {
|
||||
common.InsertNbiCm(ne, version, "InventoryUnitHost", newHostValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, version, "InventoryUnitHost", newHostValueJson, common.ObjectCreationEvent)
|
||||
redisqueue.AddNbiCMQueue([]string{strconv.Itoa(nbiCm.Id)})
|
||||
} else {
|
||||
var ids []string
|
||||
added, modified, deleted, _ := common.CompareJSON(lastHostJson, newHostValueJson)
|
||||
if len(added) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "InventoryUnitHost", common.ToJson(added), common.ObjectCreationEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(modified) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "InventoryUnitHost", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(deleted) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "InventoryUnitHost", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
|
||||
if len(ids) > 0 {
|
||||
redisqueue.AddNbiCMQueue(ids)
|
||||
common.InsertNbiCm(ne, version, "InventoryUnitHost", newHostValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ========== InventoryUnitAccessory ==========
|
||||
inventoryUnitAccessory := InventoryUnitAccessory{
|
||||
Id: fmt.Sprintf("%s-%s-InventoryUnitAccessory", ne.NeType, ne.NeId),
|
||||
UserLabel: ne.NeName + "-InventoryUnitAccessory",
|
||||
VendorUnitFamilyType: "5G-UPF-ACC",
|
||||
VendorUnitTypeNumber: "UPF-ACC-" + ne.NeId,
|
||||
VendorName: ne.VendorName,
|
||||
SerialNumber: "SN-UPF-ACC-" + ne.NeId,
|
||||
VersionNumber: "1.2.15",
|
||||
DateOfManufacture: "2023-01-01",
|
||||
DateOfLastService: now.AddDate(0, 0, 360).Format("2006-01-02"),
|
||||
ManufacturerData: "{}",
|
||||
AccessoryPosition: "1",
|
||||
AccessoryType: "FAN",
|
||||
AddtionalInformation: "Cooling system",
|
||||
}
|
||||
accJSON, err := json.Marshal(inventoryUnitAccessory)
|
||||
if err != nil {
|
||||
log.Errorf("Failed to marshal InventoryUnitAccessory for ne_id %s: %v", ne.NeId, err)
|
||||
} else {
|
||||
var lastAccJson string
|
||||
err = dborm.DefaultDB().Table("nbi_cm").
|
||||
Where("ne_type = ? AND ne_id = ? AND object_type = ? AND event_type = ?", ne.NeType, ne.NeId, "InventoryUnitAccessory", common.ObjectOriginalEvent).
|
||||
Order("timestamp ASC").Pluck("value_json", &lastAccJson).Error
|
||||
newAccValueJson := string(accJSON)
|
||||
if err != nil || lastAccJson == "" {
|
||||
common.InsertNbiCm(ne, version, "InventoryUnitAccessory", newAccValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, version, "InventoryUnitAccessory", newAccValueJson, common.ObjectCreationEvent)
|
||||
redisqueue.AddNbiCMQueue([]string{strconv.Itoa(nbiCm.Id)})
|
||||
} else {
|
||||
var ids []string
|
||||
added, modified, deleted, _ := common.CompareJSON(lastAccJson, newAccValueJson)
|
||||
if len(added) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "InventoryUnitAccessory", common.ToJson(added), common.ObjectCreationEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(modified) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "InventoryUnitAccessory", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(deleted) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "InventoryUnitAccessory", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
|
||||
if len(ids) > 0 {
|
||||
redisqueue.AddNbiCMQueue(ids)
|
||||
common.InsertNbiCm(ne, version, "InventoryUnitAccessory", newAccValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var capability int32
|
||||
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)
|
||||
capability = 0
|
||||
}
|
||||
|
||||
// ========== UpfFunction ==========
|
||||
upfFunction := UpfFunction{
|
||||
Id: fmt.Sprintf("%s-%s-UpfFunction", ne.NeType, ne.NeId),
|
||||
UserLabel: ne.NeName + "-UpfFunction",
|
||||
AdministrativeState: adminState,
|
||||
OperationalState: operState,
|
||||
VnfInstanceId: "vnf-" + ne.NeType + "-" + ne.NeId,
|
||||
MaxQosFlows: capability,
|
||||
MaxThroughput: 10.0,
|
||||
}
|
||||
upfJSON, err := json.Marshal(upfFunction)
|
||||
if err != nil {
|
||||
log.Errorf("Failed to marshal UpfFunction for ne_id %s: %v", ne.NeId, err)
|
||||
} else {
|
||||
var lastUpfJson string
|
||||
err = dborm.DefaultDB().Table("nbi_cm").
|
||||
Where("ne_type = ? AND ne_id = ? AND object_type = ? AND event_type = ?", ne.NeType, ne.NeId, "UpfFunction", common.ObjectOriginalEvent).
|
||||
Order("timestamp ASC").Pluck("value_json", &lastUpfJson).Error
|
||||
newUpfValueJson := string(upfJSON)
|
||||
if err != nil || lastUpfJson == "" {
|
||||
common.InsertNbiCm(ne, version, "UpfFunction", newUpfValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, version, "UpfFunction", newUpfValueJson, common.ObjectCreationEvent)
|
||||
redisqueue.AddNbiCMQueue([]string{strconv.Itoa(nbiCm.Id)})
|
||||
} else {
|
||||
var ids []string
|
||||
added, modified, deleted, _ := common.CompareJSON(lastUpfJson, newUpfValueJson)
|
||||
if len(added) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "UpfFunction", common.ToJson(added), common.ObjectCreationEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(modified) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "UpfFunction", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(deleted) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "UpfFunction", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
|
||||
if len(ids) > 0 {
|
||||
redisqueue.AddNbiCMQueue(ids)
|
||||
common.InsertNbiCm(ne, version, "UpfFunction", newUpfValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ========== EpRpDynN3Upf ==========
|
||||
epRpDynN3Upf := EpRpDynN3Upf{
|
||||
Id: fmt.Sprintf("%s-%s-EpRpDynN3Upf", ne.NeType, ne.NeId),
|
||||
UserLabel: ne.NeName + "-EpRpDynN3Upf",
|
||||
LocIpAddrList: "{" + ne.Ip + "}",
|
||||
FarIpSubnetworkList: `{{"Subnetwork":"10.13.1.0","Mask":"255.255.255.255"}}`,
|
||||
}
|
||||
n3JSON, err := json.Marshal(epRpDynN3Upf)
|
||||
if err != nil {
|
||||
log.Errorf("Failed to marshal EpRpDynN3Upf for ne_id %s: %v", ne.NeId, err)
|
||||
} else {
|
||||
var lastN3Json string
|
||||
err = dborm.DefaultDB().Table("nbi_cm").
|
||||
Where("ne_type = ? AND ne_id = ? AND object_type = ? AND event_type = ?", ne.NeType, ne.NeId, "EpRpDynN3Upf", common.ObjectOriginalEvent).
|
||||
Order("timestamp ASC").Pluck("value_json", &lastN3Json).Error
|
||||
newN3ValueJson := string(n3JSON)
|
||||
if err != nil || lastN3Json == "" {
|
||||
common.InsertNbiCm(ne, version, "EpRpDynN3Upf", newN3ValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, version, "EpRpDynN3Upf", newN3ValueJson, common.ObjectCreationEvent)
|
||||
redisqueue.AddNbiCMQueue([]string{strconv.Itoa(nbiCm.Id)})
|
||||
} else {
|
||||
var ids []string
|
||||
added, modified, deleted, _ := common.CompareJSON(lastN3Json, newN3ValueJson)
|
||||
if len(added) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "EpRpDynN3Upf", common.ToJson(added), common.ObjectCreationEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(modified) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "EpRpDynN3Upf", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(deleted) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "EpRpDynN3Upf", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
|
||||
if len(ids) > 0 {
|
||||
redisqueue.AddNbiCMQueue(ids)
|
||||
common.InsertNbiCm(ne, version, "EpRpDynN3Upf", newN3ValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ========== EpRpDynN9Upf ==========
|
||||
epRpDynN9Upf := EpRpDynN9Upf{
|
||||
Id: fmt.Sprintf("%s-%s-EpRpDynN9Upf", ne.NeType, ne.NeId),
|
||||
UserLabel: ne.NeName + "-EpRpDynN9Upf",
|
||||
LocIpAddrList: `{` + ne.Ip + `}`,
|
||||
FarIpSubnetworkList: `{{Subnetwork:10.19.1.0,Mask:255.255.255.255}}`,
|
||||
}
|
||||
n9JSON, err := json.Marshal(epRpDynN9Upf)
|
||||
if err != nil {
|
||||
log.Errorf("Failed to marshal EpRpDynN9Upf for ne_id %s: %v", ne.NeId, err)
|
||||
} else {
|
||||
var lastN9Json string
|
||||
err = dborm.DefaultDB().Table("nbi_cm").
|
||||
Where("ne_type = ? AND ne_id = ? AND object_type = ? AND event_type = ?", ne.NeType, ne.NeId, "EpRpDynN9Upf", common.ObjectOriginalEvent).
|
||||
Order("timestamp ASC").Pluck("value_json", &lastN9Json).Error
|
||||
newN9ValueJson := string(n9JSON)
|
||||
if err != nil || lastN9Json == "" {
|
||||
common.InsertNbiCm(ne, version, "EpRpDynN9Upf", newN9ValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, version, "EpRpDynN9Upf", newN9ValueJson, common.ObjectCreationEvent)
|
||||
redisqueue.AddNbiCMQueue([]string{strconv.Itoa(nbiCm.Id)})
|
||||
} else {
|
||||
var ids []string
|
||||
added, modified, deleted, _ := common.CompareJSON(lastN9Json, newN9ValueJson)
|
||||
if len(added) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "EpRpDynN9Upf", common.ToJson(added), common.ObjectCreationEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(modified) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "EpRpDynN9Upf", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(deleted) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "EpRpDynN9Upf", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
|
||||
if len(ids) > 0 {
|
||||
redisqueue.AddNbiCMQueue(ids)
|
||||
common.InsertNbiCm(ne, version, "EpRpDynN9Upf", newN9ValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ========== IPResource ==========
|
||||
ipResource := IPResource{
|
||||
Id: fmt.Sprintf("%s-%s-IPResource", ne.NeType, ne.NeId),
|
||||
UserLabel: ne.NeName + "-IPResource",
|
||||
InterfaceType: "{Mgt,N3,N4,N9}",
|
||||
LocIpV4AddrList: fmt.Sprintf("{%s,%s,%s,%s}", ne.Ip, ne.Ip, ne.Ip, ne.Ip),
|
||||
LocIpV6AddrList: "{Default,Default,Default,Default}",
|
||||
}
|
||||
ipJSON, err := json.Marshal(ipResource)
|
||||
if err != nil {
|
||||
log.Errorf("Failed to marshal IPResource for UPF ne_id %s: %v", ne.NeId, err)
|
||||
} else {
|
||||
var lastIpJson string
|
||||
err = dborm.DefaultDB().Table("nbi_cm").
|
||||
Where("ne_type = ? AND ne_id = ? AND object_type = ? AND event_type = ?", ne.NeType, ne.NeId, "IPResource", common.ObjectOriginalEvent).
|
||||
Order("timestamp ASC").Pluck("value_json", &lastIpJson).Error
|
||||
newIpValueJson := string(ipJSON)
|
||||
if err != nil || lastIpJson == "" {
|
||||
common.InsertNbiCm(ne, version, "IPResource", newIpValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, version, "IPResource", newIpValueJson, common.ObjectCreationEvent)
|
||||
redisqueue.AddNbiCMQueue([]string{strconv.Itoa(nbiCm.Id)})
|
||||
} else {
|
||||
var ids []string
|
||||
added, modified, deleted, _ := common.CompareJSON(lastIpJson, newIpValueJson)
|
||||
if len(added) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "IPResource", common.ToJson(added), common.ObjectCreationEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(modified) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "IPResource", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
if len(deleted) > 0 {
|
||||
nbiCm := common.InsertNbiCm(ne, version, "IPResource", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
ids = append(ids, strconv.Itoa(nbiCm.Id))
|
||||
}
|
||||
|
||||
if len(ids) > 0 {
|
||||
redisqueue.AddNbiCMQueue(ids)
|
||||
common.InsertNbiCm(ne, version, "IPResource", newIpValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
log.Info("UPF NBI CM synchronization completed")
|
||||
return nil
|
||||
}
|
||||
@@ -397,9 +397,6 @@ func (s *NeInfoController) Add(c *gin.Context) {
|
||||
neLicense.ExpiryDate = v.(string)
|
||||
neLicense.Status = "1"
|
||||
}
|
||||
if v, ok := body.ServerState["capability"]; ok && v != nil {
|
||||
neLicense.Capability = fmt.Sprintf("%v", v)
|
||||
}
|
||||
}
|
||||
|
||||
s.neVersionService.Insert(neVersion)
|
||||
@@ -495,9 +492,6 @@ func (s *NeInfoController) Edit(c *gin.Context) {
|
||||
neLicense.Status = "1"
|
||||
neLicense.UpdateBy = loginUserName
|
||||
}
|
||||
if v, ok := body.ServerState["capability"]; ok && v != nil {
|
||||
neLicense.Capability = fmt.Sprintf("%v", v)
|
||||
}
|
||||
}
|
||||
|
||||
if neVersion.ID != "" {
|
||||
|
||||
@@ -255,7 +255,6 @@ func (s *NeLicenseController) State(c *gin.Context) {
|
||||
neLicense.Status = "1"
|
||||
neLicense.SerialNum = fmt.Sprint(neState["sn"])
|
||||
neLicense.ExpiryDate = fmt.Sprint(neState["expire"])
|
||||
neLicense.Capability = fmt.Sprint(neState["capability"])
|
||||
code, licensePath := s.neLicenseService.ReadLicenseInfo(neLicense)
|
||||
neLicense.ActivationRequestCode = code
|
||||
neLicense.LicensePath = licensePath
|
||||
|
||||
@@ -9,7 +9,6 @@ type NeLicense struct {
|
||||
LicensePath string `json:"licensePath" gorm:"license_path"` // 激活授权文件
|
||||
SerialNum string `json:"serialNum" gorm:"serial_num"` // 序列号
|
||||
ExpiryDate string `json:"expiryDate" gorm:"expiry_date"` // 许可证到期日期
|
||||
Capability string `json:"capability" gorm:"capability"` // 许可证用户容量
|
||||
Status string `json:"status" gorm:"status"` // 状态 0无效 1有效
|
||||
Remark string `json:"remark" gorm:"remark"` // 备注
|
||||
CreateBy string `json:"createBy" gorm:"create_by"` // 创建者
|
||||
|
||||
@@ -14,8 +14,7 @@ import (
|
||||
// 实例化数据层 NeLicense 结构体
|
||||
var NewNeLicense = &NeLicense{
|
||||
selectSql: `select
|
||||
id, ne_type, ne_id, activation_request_code, license_path, serial_num,
|
||||
expiry_date, capability, status, remark, create_by, create_time, update_by, update_time
|
||||
id, ne_type, ne_id, activation_request_code, license_path, serial_num, expiry_date, status, remark, create_by, create_time, update_by, update_time
|
||||
from ne_license`,
|
||||
|
||||
resultMap: map[string]string{
|
||||
@@ -26,7 +25,6 @@ var NewNeLicense = &NeLicense{
|
||||
"license_path": "LicensePath",
|
||||
"serial_num": "SerialNum",
|
||||
"expiry_date": "ExpiryDate",
|
||||
"capability": "Capability",
|
||||
"status": "Status",
|
||||
"remark": "Remark",
|
||||
"create_by": "CreateBy",
|
||||
@@ -204,9 +202,6 @@ func (r *NeLicense) Insert(neLicense model.NeLicense) string {
|
||||
if neLicense.ExpiryDate != "" {
|
||||
params["expiry_date"] = neLicense.ExpiryDate
|
||||
}
|
||||
if neLicense.Capability != "" {
|
||||
params["capability"] = neLicense.Capability
|
||||
}
|
||||
if neLicense.Status != "" {
|
||||
params["status"] = neLicense.Status
|
||||
}
|
||||
@@ -267,9 +262,6 @@ func (r *NeLicense) Update(neLicense model.NeLicense) int64 {
|
||||
if neLicense.ExpiryDate != "" {
|
||||
params["expiry_date"] = neLicense.ExpiryDate
|
||||
}
|
||||
if neLicense.Capability != "" {
|
||||
params["capability"] = neLicense.Capability
|
||||
}
|
||||
if neLicense.Status != "" {
|
||||
params["status"] = neLicense.Status
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package service
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -178,10 +177,6 @@ func (r *NeVersion) Operate(action string, neVersion model.NeVersion, preinput m
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
// commandLine, err = r.operateShellRun(preinput, cmdStrArr, neVersion.NeType, okFlagStr)
|
||||
// if err != nil {
|
||||
// return "", err
|
||||
// }
|
||||
|
||||
// ========= 完成阶段 =========
|
||||
if strings.LastIndex(commandLine, okFlagStr) > 5 {
|
||||
@@ -244,7 +239,7 @@ func (r *NeVersion) operateCommand(action, neType string, neFilePaths []string)
|
||||
pkgCmdStr := fmt.Sprintf("sudo dpkg -i %s", strings.Join(neFilePaths, " "))
|
||||
fileExt := filepath.Ext(strings.ToLower(neFilePaths[0]))
|
||||
if strings.HasSuffix(fileExt, "rpm") {
|
||||
pkgCmdStr = fmt.Sprintf("sudo rpm -Uvh --replacepkgs %s", strings.Join(neFilePaths, " "))
|
||||
pkgCmdStr = fmt.Sprintf("sudo rpm -Uvh --reinstall %s", strings.Join(neFilePaths, " "))
|
||||
}
|
||||
|
||||
// 组合命令输入
|
||||
@@ -262,7 +257,7 @@ func (r *NeVersion) operateCommand(action, neType string, neFilePaths []string)
|
||||
// 升级软件包
|
||||
pkgCmdStr = fmt.Sprintf("sudo M_PARAM=upgrade dpkg -i %s", strings.Join(neFilePaths, " "))
|
||||
if strings.HasSuffix(fileExt, "rpm") {
|
||||
pkgCmdStr = fmt.Sprintf("sudo M_PARAM=upgrade rpm -Uvh --replacepkgs %s", strings.Join(neFilePaths, " "))
|
||||
pkgCmdStr = fmt.Sprintf("sudo M_PARAM=upgrade rpm -Uvh --reinstall %s", strings.Join(neFilePaths, " "))
|
||||
}
|
||||
omcStrArr = append(omcStrArr, pkgCmdStr)
|
||||
}
|
||||
@@ -271,7 +266,7 @@ func (r *NeVersion) operateCommand(action, neType string, neFilePaths []string)
|
||||
|
||||
// 2s后执行omc相关命令
|
||||
cmdStrArr = append(cmdStrArr, fmt.Sprintf("sudo rm -f /tmp/omc_%s.out \n", action))
|
||||
cmdStrArr = append(cmdStrArr, fmt.Sprintf("setsid sh -c \"sleep 2s && %s\" > /tmp/omc_%s.out 2>&1 & \n", strings.Join(omcStrArr, " && "), action))
|
||||
cmdStrArr = append(cmdStrArr, fmt.Sprintf("nohup sh -c \"sleep 2s && %s\" > /tmp/omc_%s.out 2>&1 & \n", strings.Join(omcStrArr, " && "), action))
|
||||
cmdStrArr = append(cmdStrArr, fmt.Sprintf("echo '%s' \n", okFlagStr))
|
||||
return okFlagStr, cmdStrArr, nil
|
||||
} else if neType == "IMS" {
|
||||
@@ -580,7 +575,7 @@ func (r *NeVersion) operateCommand(action, neType string, neFilePaths []string)
|
||||
}
|
||||
|
||||
// 删除软件包
|
||||
cmdStrArr = append(cmdStrArr, fmt.Sprintf("sudo rm -rf %s \n", strings.Join(neFilePaths, " ")))
|
||||
cmdStrArr = append(cmdStrArr, fmt.Sprintf("sudo rm %s \n", strings.Join(neFilePaths, " ")))
|
||||
// 结束
|
||||
cmdStrArr = append(cmdStrArr, fmt.Sprintf("echo '%s' \n", okFlagStr))
|
||||
|
||||
@@ -652,7 +647,7 @@ func (r *NeVersion) operateRun(sshClient *ssh.ConnSSH, preinput map[string]strin
|
||||
}
|
||||
|
||||
// 命令终止符后继续执行命令
|
||||
suffix := strings.HasSuffix(outputStr, "~]# ") || strings.HasSuffix(outputStr, "~$ ") || strings.HasSuffix(outputStr, "~]$ ")
|
||||
suffix := strings.HasSuffix(outputStr, "~]# ") || strings.HasSuffix(outputStr, "~$ ")
|
||||
if len(cmdStrArr) > 0 && suffix {
|
||||
if firstRead {
|
||||
firstRead = false
|
||||
@@ -677,92 +672,6 @@ func (r *NeVersion) operateRun(sshClient *ssh.ConnSSH, preinput map[string]strin
|
||||
return commandLineText, nil
|
||||
}
|
||||
|
||||
// operateRun 操作版本-执行阶段
|
||||
func (r *NeVersion) operateShellRun(preinput map[string]string, cmdStrArr []string, neType string, okFlagStr string) (string, error) {
|
||||
firstRead := true // 首次命令进行记录日志信息
|
||||
commandLineText := "" // 日志信息
|
||||
done := make(chan bool) // 完成信号
|
||||
// 超时退出 120s
|
||||
timeoutTicker := time.NewTicker(120 * time.Second)
|
||||
defer timeoutTicker.Stop()
|
||||
|
||||
go func() {
|
||||
for {
|
||||
select {
|
||||
case <-timeoutTicker.C:
|
||||
done <- true
|
||||
return
|
||||
default:
|
||||
if len(cmdStrArr) > 0 {
|
||||
if firstRead {
|
||||
firstRead = false
|
||||
}
|
||||
// 获取第一个命令并从队列中移除
|
||||
shiftElement := cmdStrArr[0]
|
||||
cmdStrArr = cmdStrArr[1:]
|
||||
|
||||
// 执行命令
|
||||
output, err := executeShellCommand(shiftElement)
|
||||
if err != nil {
|
||||
commandLineText += fmt.Sprintf("Error executing command: %s\n", err.Error())
|
||||
done <- true
|
||||
return
|
||||
}
|
||||
commandLineText += output
|
||||
|
||||
// 检查是否需要预输入
|
||||
if neType == "IMS" {
|
||||
if strings.Contains(output, "(P/I/S-CSCF Config)? <y/n>") {
|
||||
if pisCSCF, ok := preinput["pisCSCF"]; ok && pisCSCF != "" {
|
||||
executeShellCommand(fmt.Sprintf("echo '%s'", pisCSCF))
|
||||
} else {
|
||||
executeShellCommand("echo 'y'")
|
||||
}
|
||||
continue
|
||||
}
|
||||
if strings.Contains(output, "/usr/local/etc/mf directory? (Yes/No, default: No)") {
|
||||
if pisCSCF, ok := preinput["updateMFetc"]; ok && pisCSCF != "" {
|
||||
executeShellCommand(fmt.Sprintf("echo '%s'", pisCSCF))
|
||||
} else {
|
||||
executeShellCommand("echo 'No'")
|
||||
}
|
||||
continue
|
||||
}
|
||||
if strings.Contains(output, "/usr/local/share/mf directory? (Yes/No, default: No)") {
|
||||
if pisCSCF, ok := preinput["updateMFshare"]; ok && pisCSCF != "" {
|
||||
executeShellCommand(fmt.Sprintf("echo '%s'", pisCSCF))
|
||||
} else {
|
||||
executeShellCommand("echo 'No'")
|
||||
}
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
// 检查是否是最后的退出标记
|
||||
if strings.LastIndex(output, okFlagStr) > 5 {
|
||||
done <- true
|
||||
break
|
||||
}
|
||||
} else {
|
||||
done <- true
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}()
|
||||
// 等待写入协程完成
|
||||
<-done
|
||||
|
||||
return commandLineText, nil
|
||||
}
|
||||
|
||||
// executeShellCommand 执行本地 Shell 命令
|
||||
func executeShellCommand(command string) (string, error) {
|
||||
cmd := exec.Command("sh", "-c", command)
|
||||
output, err := cmd.CombinedOutput()
|
||||
return string(output), err
|
||||
}
|
||||
|
||||
// operateDome 操作版本-完成阶段
|
||||
func (r *NeVersion) operateDome(action string, neVersion model.NeVersion) error {
|
||||
if action == "install" {
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
# Makefile for OMC-OMC-crontask project
|
||||
|
||||
PROJECT = OMC
|
||||
VERSION = 2.2508.2
|
||||
VERSION = 2.2503.6
|
||||
LIBDIR = be.ems/lib
|
||||
BINNAME = sshsvc
|
||||
|
||||
|
||||
@@ -1,101 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"reflect"
|
||||
)
|
||||
|
||||
// CompareJSON 比较两个 JSON,返回新增、修改和删除的内容
|
||||
func CompareJSON(json1, json2 string) (map[string]interface{}, map[string]interface{}, map[string]interface{}, error) {
|
||||
var map1, map2 map[string]interface{}
|
||||
|
||||
// 解析 JSON
|
||||
if err := json.Unmarshal([]byte(json1), &map1); err != nil {
|
||||
return nil, nil, nil, fmt.Errorf("failed to parse json1: %v", err)
|
||||
}
|
||||
if err := json.Unmarshal([]byte(json2), &map2); err != nil {
|
||||
return nil, nil, nil, fmt.Errorf("failed to parse json2: %v", err)
|
||||
}
|
||||
|
||||
// 存储新增、修改和删除的内容
|
||||
added := make(map[string]interface{})
|
||||
modified := make(map[string]interface{})
|
||||
deleted := make(map[string]interface{})
|
||||
|
||||
// 递归比较
|
||||
compareMaps(map1, map2, added, modified, deleted, "")
|
||||
|
||||
return added, modified, deleted, nil
|
||||
}
|
||||
|
||||
// compareMaps 递归比较两个 map
|
||||
func compareMaps(map1, map2, added, modified, deleted map[string]interface{}, prefix string) {
|
||||
// 遍历 map1,检查删除或修改
|
||||
for key, val1 := range map1 {
|
||||
fullKey := key
|
||||
if prefix != "" {
|
||||
fullKey = prefix + "." + key
|
||||
}
|
||||
|
||||
val2, exists := map2[key]
|
||||
if !exists {
|
||||
// 如果 key 不存在于 map2,记录为删除
|
||||
deleted[fullKey] = val1
|
||||
} else if !reflect.DeepEqual(val1, val2) {
|
||||
// 如果 key 存在但值不同,记录为修改
|
||||
if reflect.TypeOf(val1) == reflect.TypeOf(val2) && reflect.TypeOf(val1).Kind() == reflect.Map {
|
||||
// 如果值是嵌套对象,递归比较
|
||||
compareMaps(val1.(map[string]interface{}), val2.(map[string]interface{}), added, modified, deleted, fullKey)
|
||||
} else {
|
||||
modified[fullKey] = map[string]interface{}{
|
||||
"old": val1,
|
||||
"new": val2,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 遍历 map2,检查新增
|
||||
for key, val2 := range map2 {
|
||||
fullKey := key
|
||||
if prefix != "" {
|
||||
fullKey = prefix + "." + key
|
||||
}
|
||||
|
||||
if _, exists := map1[key]; !exists {
|
||||
// 如果 key 不存在于 map1,记录为新增
|
||||
added[fullKey] = val2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
json1 := `{
|
||||
"name": "example",
|
||||
"age": 25,
|
||||
"address": {
|
||||
"city": "New York",
|
||||
"zip": "10001"
|
||||
}
|
||||
}`
|
||||
|
||||
json2 := `{
|
||||
"name": "example",
|
||||
"age": 26,
|
||||
"address": {
|
||||
"city": "Los Angeles"
|
||||
},
|
||||
"phone": "123-456-7890"
|
||||
}`
|
||||
|
||||
added, modified, deleted, err := CompareJSON(json1, json2)
|
||||
if err != nil {
|
||||
fmt.Printf("Error: %v\n", err)
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Printf("Added: %v\n", added)
|
||||
fmt.Printf("Modified: %v\n", modified)
|
||||
fmt.Printf("Deleted: %v\n", deleted)
|
||||
}
|
||||
Reference in new issue
Block a user