Compare commits
10
Commits
9fa77a139a
...
nbi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
682cb6ecd8 | ||
|
|
7b6ad5ccab | ||
|
|
5dfa6fa04d | ||
|
|
46ccc0ab83 | ||
|
|
d4923d008c | ||
|
|
1a5b2cd15a | ||
|
|
3e7c60ecd0 | ||
|
|
f7f9572aef | ||
|
|
d4b0b12c7b | ||
|
|
13c07004b4 |
No files matched your search
@@ -0,0 +1,10 @@
|
||||
# alarm relation rules
|
||||
derived:
|
||||
- parentCode: 10001
|
||||
childCode: 10002
|
||||
- parentCode: 20001
|
||||
childCode: 20002
|
||||
related:
|
||||
- codes: [30005, 30006, 30007]
|
||||
neType: "AMF"
|
||||
timeWindow: 60 # 秒
|
||||
@@ -0,0 +1,4 @@
|
||||
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,4 +186,14 @@ params:
|
||||
|
||||
testConfig:
|
||||
enabled: false
|
||||
file: /usr/local/omc/etc/testconfig.yaml
|
||||
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 diff suppressed because it is too large.
Load diff
@@ -0,0 +1,269 @@
|
||||
[
|
||||
{
|
||||
"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
@@ -0,0 +1,373 @@
|
||||
[
|
||||
{
|
||||
"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
@@ -0,0 +1,269 @@
|
||||
[
|
||||
{
|
||||
"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
@@ -0,0 +1,373 @@
|
||||
[
|
||||
{
|
||||
"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,17 +1,17 @@
|
||||
/*
|
||||
Navicat Premium Data Transfer
|
||||
|
||||
Source Server : omc@192.168.2.164
|
||||
Source Server : root@192.168.2.165
|
||||
Source Server Type : MariaDB
|
||||
Source Server Version : 100528 (10.5.28-MariaDB)
|
||||
Source Host : 192.168.2.164:33066
|
||||
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 : 100528 (10.5.28-MariaDB)
|
||||
Target Server Version : 100335 (10.3.35-MariaDB)
|
||||
File Encoding : 65001
|
||||
|
||||
Date: 29/04/2025 19:39:13
|
||||
Date: 26/05/2025 17:26:21
|
||||
*/
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
@@ -27,12 +27,13 @@ CREATE TABLE `nbi_cm` (
|
||||
`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('ObjectCreationEvent','ObjectDeletionEvent','ObjectAttributeValueChangeEvent') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'ObjectCreationEvent',
|
||||
`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
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 321573 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||||
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;
|
||||
Executable
+39
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
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,7 +1,7 @@
|
||||
SET NAMES utf8mb4;
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
CREATE TABLE `alarm_relation` (
|
||||
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,
|
||||
|
||||
@@ -1,6 +1,21 @@
|
||||
SET FOREIGN_KEY_CHECKS=0;
|
||||
|
||||
ALTER TABLE `nbi_cm` ADD COLUMN IF NOT EXISTS `event_type` enum('ObjectCreationEvent','ObjectDeletionEvent','ObjectAttributeValueChangeEvent') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'ObjectCreationEvent' AFTER `rm_uid`;
|
||||
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`;
|
||||
|
||||
@@ -25,4 +40,7 @@ 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;
|
||||
@@ -450,6 +450,12 @@ 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
|
||||
@@ -779,6 +785,11 @@ 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)
|
||||
|
||||
@@ -10,6 +10,20 @@ import (
|
||||
"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}
|
||||
@@ -27,7 +41,29 @@ func AddAlarmRelationQueue(ids []string) error {
|
||||
}).Result()
|
||||
|
||||
// 只保留最新2000条消息
|
||||
client.XTrimMaxLen(context.Background(), "alarm_relation", 2000).Result()
|
||||
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
|
||||
}
|
||||
@@ -48,13 +84,34 @@ func AddNbiCMQueue(ids []string) error {
|
||||
}).Result()
|
||||
|
||||
// 只保留最新2000条消息
|
||||
client.XTrimMaxLen(context.Background(), "nbi_cm", 2000).Result()
|
||||
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 AddNbiPMQueue(neType, id string) error {
|
||||
func AddNbiPMQueueOrg(neType, id string) error {
|
||||
payload := map[string]string{"neType": neType, "id": id}
|
||||
payloadBytes, err := json.Marshal(payload)
|
||||
if err != nil {
|
||||
@@ -69,7 +126,28 @@ func AddNbiPMQueue(neType, id string) error {
|
||||
}).Result()
|
||||
|
||||
// 只保留最新2000条消息
|
||||
client.XTrimMaxLen(context.Background(), "nbi_pm", 2000).Result()
|
||||
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
|
||||
}
|
||||
|
||||
+490
-31
@@ -5,7 +5,10 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"math"
|
||||
"math/rand"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -340,9 +343,9 @@ func PostKPIReportFromNF(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
// 推送到redis队列
|
||||
err = redisqueue.AddNbiPMQueue(kpiData.NEType, strconv.Itoa(kpiData.ID))
|
||||
err = redisqueue.AddNbiKpiQueue(kpiData.NEType, strconv.Itoa(kpiData.ID))
|
||||
if err != nil {
|
||||
log.Warn("Failed to AddNbiPMQueue:", err)
|
||||
log.Warn("Failed to AddNbiKpiQueue:", err)
|
||||
}
|
||||
|
||||
services.ResponseStatusOK204NoContent(w)
|
||||
@@ -933,37 +936,449 @@ func PatchMeasureTaskToNF(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
type Measurement struct {
|
||||
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
|
||||
// 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".
|
||||
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", 或者指标项有多个测量项,如Dnn的名称写对应的Dnn"cmnet"/"ims"
|
||||
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.
|
||||
Value int64 `json:"Value"`
|
||||
}
|
||||
|
||||
type KPI struct {
|
||||
KPIID string `json:"KPIID"` // 指标项, 如: SMF.AttCreatePduSession._Dnn
|
||||
KPIID string `json:"KPIID"`
|
||||
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... ")
|
||||
@@ -982,19 +1397,49 @@ func PostMeasurementFromNF(w http.ResponseWriter, r *http.Request) {
|
||||
services.ResponseNotFound404UriNotExist(w, r)
|
||||
return
|
||||
}
|
||||
log.Debug("Request body:", string(body))
|
||||
// measurement := new(dborm.NorthboundPm)
|
||||
//log.Debug("Request body:", string(body))
|
||||
measurement := new(dborm.NorthboundPm)
|
||||
_ = json.Unmarshal(body, &measurement)
|
||||
log.Debug("measurement:", measurement)
|
||||
|
||||
session := dborm.DbClient.XEngine.NewSession()
|
||||
// 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()
|
||||
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)
|
||||
@@ -1002,6 +1447,12 @@ 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)
|
||||
}
|
||||
|
||||
@@ -1009,12 +1460,6 @@ 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 {
|
||||
@@ -1038,9 +1483,7 @@ 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)
|
||||
@@ -1067,10 +1510,26 @@ 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)
|
||||
log.Debug("measurement:", 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)
|
||||
}
|
||||
}
|
||||
|
||||
session := dborm.DbClient.XEngine.NewSession()
|
||||
defer session.Close()
|
||||
|
||||
@@ -29,3 +29,11 @@ func LoadAlarmRelationRules(path string) error {
|
||||
}
|
||||
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)
|
||||
}
|
||||
@@ -126,6 +126,8 @@ type YamlConfig struct {
|
||||
Enabled bool `yaml:"enabled"`
|
||||
File string `yaml:"file"`
|
||||
} `yaml:"testConfig"`
|
||||
|
||||
NbiConfig NbiConfig `yaml:"nbiConfig"`
|
||||
}
|
||||
|
||||
type RestParam struct {
|
||||
@@ -187,6 +189,18 @@ type AlarmConfig struct {
|
||||
} `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"`
|
||||
}
|
||||
|
||||
type MMLParam struct {
|
||||
Sleep int64 `yaml:"sleep"`
|
||||
DeadLine int64 `yaml:"deadLine"`
|
||||
@@ -280,6 +294,15 @@ func ReadConfig(configFile string) {
|
||||
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) {
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
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.2505.1
|
||||
VERSION = 2.2508.2
|
||||
RelDate = `date +%Y%m%d`
|
||||
Release = $(RelDate)
|
||||
RelVer = $(VERSION)-$(RelDate)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
ProcList="restagent sshsvc"
|
||||
ProjectL=omc
|
||||
VERSION=2.2505.1
|
||||
VERSION=2.2508.2
|
||||
RelDate=`date +%Y%m%d`
|
||||
Release=${RelDate}
|
||||
RelVer=${VERSION}-${RelDate}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
schemaPath: ./etc/schema
|
||||
randomMin: 1
|
||||
randomMax: 100
|
||||
mergeMode: merge # none: Merge Mode None/merge: Merge Mode Merge/schema: Merge Mode Schema
|
||||
@@ -159,11 +159,6 @@ alarm:
|
||||
signName: xxx SMSC
|
||||
templateCode: 1000
|
||||
smProxy: smsc
|
||||
# alarm_relation_rules.yaml
|
||||
relationRules:
|
||||
enabled: true
|
||||
file: ./etc/alarm_relation_rules.yaml
|
||||
|
||||
|
||||
# User authorized information
|
||||
# crypt: mysql/md5/bcrypt
|
||||
@@ -208,3 +203,13 @@ 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
@@ -0,0 +1,269 @@
|
||||
[
|
||||
{
|
||||
"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
@@ -0,0 +1,373 @@
|
||||
[
|
||||
{
|
||||
"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.2505.1
|
||||
VERSION = 2.2508.2
|
||||
PLATFORM = amd64
|
||||
ARMPLATFORM = aarch64
|
||||
BUILDDIR = ../../build
|
||||
|
||||
@@ -19,7 +19,7 @@ func SyncNbiCM() error {
|
||||
|
||||
// 从ne_info表获取AMF类型的网元
|
||||
var amfNEs []common.NeInfo
|
||||
err := dborm.DefaultDB().Table("ne_info").Where("ne_type = ?", "AMF").
|
||||
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)
|
||||
@@ -47,7 +47,7 @@ func SyncNbiCM() error {
|
||||
UserLabel: ne.NeName,
|
||||
VendorName: ne.VendorName,
|
||||
ManagedBy: ne.Dn,
|
||||
ManagementIpAddress: ne.Ip,
|
||||
ManagementIpAddress: "{" + ne.Ip + "}",
|
||||
SwVersion: version,
|
||||
PatchInfo: "-",
|
||||
AdministrativeState: adminState,
|
||||
@@ -64,34 +64,34 @@ func SyncNbiCM() error {
|
||||
Order("timestamp ASC").Pluck("value_json", &lastJson).Error
|
||||
newValueJson := string(meJSON)
|
||||
if err != nil || lastJson == "" {
|
||||
common.InsertNbiCm(ne, "ManagedElement", newValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, "ManagedElement", newValueJson, common.ObjectCreationEvent)
|
||||
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, "ManagedElement", common.ToJson(added), common.ObjectCreationEvent)
|
||||
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, "ManagedElement", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
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, "ManagedElement", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
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, "ManagedElement", newValueJson, common.ObjectOriginalEvent)
|
||||
common.InsertNbiCm(ne, version, "ManagedElement", newValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
|
||||
// ========== AmfFunction ==========
|
||||
var capability int
|
||||
err = dborm.DefaultDB().Table("ne_license").Where("ne_type = ? and ne_id = ?", ne.NeType, ne.NeId).
|
||||
err = dborm.DefaultDB().Table("ne_license").Where("ne_type = ? and ne_id = ? and status = 1", ne.NeType, ne.NeId).
|
||||
Pluck("capability", &capability).Error
|
||||
if err != nil {
|
||||
log.Errorf("Failed to query capability for ne_id %s: %v", ne.NeId, err)
|
||||
@@ -104,9 +104,9 @@ func SyncNbiCM() error {
|
||||
OperationalState: operState,
|
||||
VnfInstanceId: "vnf-" + ne.NeType + "-" + ne.NeId,
|
||||
Fqdn: fmt.Sprintf("%s%s.mnc000.mcc460.3gppnetwork.org", strings.ToLower(ne.NeType), ne.NeId),
|
||||
SbiServiceList: "Namf_Communication,Namf_EventExposure,Namf_MT,Namf_Location",
|
||||
AmfGuamiList: "[{\"mcc\":\"460\",\"mnc\":\"000\",\"amfId\":\"" + ne.NeId + "\"}]",
|
||||
SnssaiList: "[{\"sst\":1,\"sd\":\"000001\"}]",
|
||||
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,
|
||||
@@ -122,28 +122,28 @@ func SyncNbiCM() error {
|
||||
Order("timestamp ASC").Pluck("value_json", &lastAmfJson).Error
|
||||
newAmfValueJson := string(amfJSON)
|
||||
if err != nil || lastAmfJson == "" {
|
||||
common.InsertNbiCm(ne, "AmfFunction", newAmfValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, "AmfFunction", newAmfValueJson, common.ObjectCreationEvent)
|
||||
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, "AmfFunction", common.ToJson(added), common.ObjectCreationEvent)
|
||||
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, "AmfFunction", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
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, "AmfFunction", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
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, "AmfFunction", newAmfValueJson, common.ObjectOriginalEvent)
|
||||
common.InsertNbiCm(ne, version, "AmfFunction", newAmfValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,8 +151,8 @@ func SyncNbiCM() error {
|
||||
epRpDynN8Amf := EpRpDynN8Amf{
|
||||
Id: fmt.Sprintf("%s-%s-EpRpDynN8Amf", ne.NeType, ne.NeId),
|
||||
UserLabel: ne.NeName + "-EpRpDynN8Amf",
|
||||
LocIpAddrList: "[\"" + ne.Ip + "\"]",
|
||||
FarIpSubnetworkList: "[\"10.10.0.0/16\"]",
|
||||
LocIpAddrList: `{` + ne.Ip + `}`,
|
||||
FarIpSubnetworkList: `{{Subnetwork:10.10.1.0,Mask:255.255.255.255}}`,
|
||||
}
|
||||
n8JSON, err := json.Marshal(epRpDynN8Amf)
|
||||
if err != nil {
|
||||
@@ -164,28 +164,28 @@ func SyncNbiCM() error {
|
||||
Order("timestamp ASC").Pluck("value_json", &lastN8Json).Error
|
||||
newN8ValueJson := string(n8JSON)
|
||||
if err != nil || lastN8Json == "" {
|
||||
common.InsertNbiCm(ne, "EpRpDynN8Amf", newN8ValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, "EpRpDynN8Amf", newN8ValueJson, common.ObjectCreationEvent)
|
||||
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, "EpRpDynN8Amf", common.ToJson(added), common.ObjectCreationEvent)
|
||||
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, "EpRpDynN8Amf", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
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, "EpRpDynN8Amf", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
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, "EpRpDynN8Amf", newN8ValueJson, common.ObjectOriginalEvent)
|
||||
common.InsertNbiCm(ne, version, "EpRpDynN8Amf", newN8ValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -194,8 +194,8 @@ func SyncNbiCM() error {
|
||||
epRpDynN11Amf := EpRpDynN11Amf{
|
||||
Id: fmt.Sprintf("%s-%s-EpRpDynN11Amf", ne.NeType, ne.NeId),
|
||||
UserLabel: ne.NeName + "-EpRpDynN11Amf",
|
||||
LocIpAddrList: "[\"" + ne.Ip + "\"]",
|
||||
FarIpSubnetworkList: "[\"10.11.0.0/16\"]",
|
||||
LocIpAddrList: `{` + ne.Ip + `}`,
|
||||
FarIpSubnetworkList: `{{Subnetwork:10.11.1.0,Mask:255.255.255.255}}`,
|
||||
}
|
||||
n11JSON, err := json.Marshal(epRpDynN11Amf)
|
||||
if err != nil {
|
||||
@@ -207,28 +207,28 @@ func SyncNbiCM() error {
|
||||
Order("timestamp ASC").Pluck("value_json", &lastN11Json).Error
|
||||
newN11ValueJson := string(n11JSON)
|
||||
if err != nil || lastN11Json == "" {
|
||||
common.InsertNbiCm(ne, "EpRpDynN11Amf", newN11ValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, "EpRpDynN11Amf", newN11ValueJson, common.ObjectCreationEvent)
|
||||
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, "EpRpDynN11Amf", common.ToJson(added), common.ObjectCreationEvent)
|
||||
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, "EpRpDynN11Amf", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
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, "EpRpDynN11Amf", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
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, "EpRpDynN11Amf", newN11ValueJson, common.ObjectOriginalEvent)
|
||||
common.InsertNbiCm(ne, version, "EpRpDynN11Amf", newN11ValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -237,8 +237,8 @@ func SyncNbiCM() error {
|
||||
epRpDynN12Amf := EpRpDynN12Amf{
|
||||
Id: fmt.Sprintf("%s-%s-EpRpDynN12Amf", ne.NeType, ne.NeId),
|
||||
UserLabel: ne.NeName + "-EpRpDynN12Amf",
|
||||
LocIpAddrList: "[\"" + ne.Ip + "\"]",
|
||||
FarIpSubnetworkList: "[\"10.12.0.0/16\"]",
|
||||
LocIpAddrList: `{` + ne.Ip + `}`,
|
||||
FarIpSubnetworkList: `{{Subnetwork:10.12.1.0,Mask:255.255.255.255}}`,
|
||||
}
|
||||
n12JSON, err := json.Marshal(epRpDynN12Amf)
|
||||
if err != nil {
|
||||
@@ -250,28 +250,28 @@ func SyncNbiCM() error {
|
||||
Order("timestamp ASC").Pluck("value_json", &lastN12Json).Error
|
||||
newN12ValueJson := string(n12JSON)
|
||||
if err != nil || lastN12Json == "" {
|
||||
common.InsertNbiCm(ne, "EpRpDynN12Amf", newN12ValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, "EpRpDynN12Amf", newN12ValueJson, common.ObjectCreationEvent)
|
||||
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, "EpRpDynN12Amf", common.ToJson(added), common.ObjectCreationEvent)
|
||||
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, "EpRpDynN12Amf", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
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, "EpRpDynN12Amf", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
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, "EpRpDynN12Amf", newN12ValueJson, common.ObjectOriginalEvent)
|
||||
common.InsertNbiCm(ne, version, "EpRpDynN12Amf", newN12ValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -281,7 +281,7 @@ func SyncNbiCM() error {
|
||||
Id: fmt.Sprintf("%s-%s-IPResource", ne.NeType, ne.NeId),
|
||||
UserLabel: ne.NeName + "-IPResource",
|
||||
InterfaceType: "{Mgt,N8,N11,N12}",
|
||||
LocIpV4AddrList: fmt.Sprintf("{%s,Default,Default,Default}", ne.Ip),
|
||||
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)
|
||||
@@ -294,28 +294,28 @@ func SyncNbiCM() error {
|
||||
Order("timestamp ASC").Pluck("value_json", &lastIpJson).Error
|
||||
newIpValueJson := string(ipJSON)
|
||||
if err != nil || lastIpJson == "" {
|
||||
common.InsertNbiCm(ne, "IPResource", newIpValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, "IPResource", newIpValueJson, common.ObjectCreationEvent)
|
||||
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, "IPResource", common.ToJson(added), common.ObjectCreationEvent)
|
||||
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, "IPResource", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
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, "IPResource", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
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, "IPResource", newIpValueJson, common.ObjectOriginalEvent)
|
||||
common.InsertNbiCm(ne, version, "IPResource", newIpValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,6 +125,8 @@ type NeInfo struct {
|
||||
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"`
|
||||
}
|
||||
|
||||
@@ -73,11 +73,11 @@ func compareMaps(map1, map2, added, modified, deleted map[string]interface{}, pr
|
||||
}
|
||||
}
|
||||
|
||||
func InsertNbiCm(ne NeInfo, objType, valueJson string, eventType EventType) NbiCm {
|
||||
func InsertNbiCm(ne NeInfo, version, objType, valueJson string, eventType EventType) NbiCm {
|
||||
nbiCM := NbiCm{
|
||||
NeType: ne.NeType,
|
||||
NeId: ne.NeId,
|
||||
CmVersion: CmVersion,
|
||||
CmVersion: version,
|
||||
RmUid: ne.RmUid,
|
||||
EventType: eventType,
|
||||
ObjectType: objType,
|
||||
|
||||
@@ -18,7 +18,7 @@ func SyncNbiCM() error {
|
||||
|
||||
// 从ne_info表获取PCF类型的网元
|
||||
var pcfNEs []common.NeInfo
|
||||
err := dborm.DefaultDB().Table("ne_info").Where("ne_type = ?", "PCF").
|
||||
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)
|
||||
@@ -45,7 +45,7 @@ func SyncNbiCM() error {
|
||||
UserLabel: ne.NeName,
|
||||
VendorName: ne.VendorName,
|
||||
ManagedBy: ne.Dn,
|
||||
ManagementIpAddress: ne.Ip,
|
||||
ManagementIpAddress: "{" + ne.Ip + "}",
|
||||
SwVersion: version,
|
||||
PatchInfo: "-",
|
||||
AdministrativeState: adminState,
|
||||
@@ -62,28 +62,28 @@ func SyncNbiCM() error {
|
||||
Order("timestamp ASC").Pluck("value_json", &lastJson).Error
|
||||
newValueJson := string(meJSON)
|
||||
if err != nil || lastJson == "" {
|
||||
common.InsertNbiCm(ne, "ManagedElement", newValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, "ManagedElement", newValueJson, common.ObjectCreationEvent)
|
||||
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, "ManagedElement", common.ToJson(added), common.ObjectCreationEvent)
|
||||
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, "ManagedElement", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
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, "ManagedElement", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
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, "ManagedElement", newValueJson, common.ObjectOriginalEvent)
|
||||
common.InsertNbiCm(ne, version, "ManagedElement", newValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ func SyncNbiCM() error {
|
||||
OperationalState: operState,
|
||||
VnfInstanceId: "vnf-" + ne.NeType + "-" + ne.NeId,
|
||||
Fqdn: fmt.Sprintf("%s%s.mnc000.mcc460.3gppnetwork.org", strings.ToLower(ne.NeType), ne.NeId),
|
||||
SbiServiceList: "Npcf_AMPolicyControl,Npcf_PolicyAuthorization,Npcf_SMPolicyControl,Npcf_BDTPolicyControl",
|
||||
SbiServiceList: "{Npcf_AMPolicyControl,Npcf_PolicyAuthorization,Npcf_SMPolicyControl,Npcf_BDTPolicyControl}",
|
||||
}
|
||||
pcfJSON, err := json.Marshal(pcfFunction)
|
||||
if err != nil {
|
||||
@@ -108,34 +108,34 @@ func SyncNbiCM() error {
|
||||
Order("timestamp ASC").Pluck("value_json", &lastPcfJson).Error
|
||||
newPcfValueJson := string(pcfJSON)
|
||||
if err != nil || lastPcfJson == "" {
|
||||
common.InsertNbiCm(ne, "PcfFunction", newPcfValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, "PcfFunction", newPcfValueJson, common.ObjectCreationEvent)
|
||||
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, "PcfFunction", common.ToJson(added), common.ObjectCreationEvent)
|
||||
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, "PcfFunction", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
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, "PcfFunction", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
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, "PcfFunction", newPcfValueJson, common.ObjectOriginalEvent)
|
||||
common.InsertNbiCm(ne, version, "PcfFunction", newPcfValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
|
||||
// ========== UdrFunction ==========
|
||||
var capability int
|
||||
err = dborm.DefaultDB().Table("ne_license").Where("ne_type = ? and ne_id = ?", ne.NeType, ne.NeId).
|
||||
err = dborm.DefaultDB().Table("ne_license").Where("ne_type = ? and ne_id = ? and status = 1", ne.NeType, ne.NeId).
|
||||
Pluck("capability", &capability).Error
|
||||
if err != nil {
|
||||
log.Errorf("Failed to query capability for ne_id %s: %v", ne.NeId, err)
|
||||
@@ -158,28 +158,28 @@ func SyncNbiCM() error {
|
||||
Order("timestamp ASC").Pluck("value_json", &lastUdrJson).Error
|
||||
newUdrValueJson := string(udrJSON)
|
||||
if err != nil || lastUdrJson == "" {
|
||||
common.InsertNbiCm(ne, "UdrFunction", newUdrValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, "UdrFunction", newUdrValueJson, common.ObjectCreationEvent)
|
||||
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, "UdrFunction", common.ToJson(added), common.ObjectCreationEvent)
|
||||
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, "UdrFunction", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
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, "UdrFunction", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
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, "UdrFunction", newUdrValueJson, common.ObjectOriginalEvent)
|
||||
common.InsertNbiCm(ne, version, "UdrFunction", newUdrValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -202,28 +202,28 @@ func SyncNbiCM() error {
|
||||
Order("timestamp ASC").Pluck("value_json", &lastIpJson).Error
|
||||
newIpValueJson := string(ipJSON)
|
||||
if err != nil || lastIpJson == "" {
|
||||
common.InsertNbiCm(ne, "IPResource", newIpValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, "IPResource", newIpValueJson, common.ObjectCreationEvent)
|
||||
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, "IPResource", common.ToJson(added), common.ObjectCreationEvent)
|
||||
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, "IPResource", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
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, "IPResource", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
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, "IPResource", newIpValueJson, common.ObjectOriginalEvent)
|
||||
common.InsertNbiCm(ne, version, "IPResource", newIpValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,8 +26,8 @@ type SmfFunction struct {
|
||||
VnfInstanceId string `json:"vnfInstanceId"`
|
||||
Fqdn string `json:"fqdn"`
|
||||
SbiServiceList string `json:"sbiServiceList"`
|
||||
MaxPduSessions int `json:"maxPduSessions"`
|
||||
MaxQfi int `json:"maxQfi"`
|
||||
MaxPduSessions int32 `json:"maxPduSessions"`
|
||||
MaxQfi int32 `json:"maxQfi"`
|
||||
UpfList string `json:"upfList"`
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ func SyncNbiCM() error {
|
||||
|
||||
// 从ne_info表获取SMF类型的网元
|
||||
var smfNEs []common.NeInfo
|
||||
err := dborm.DefaultDB().Table("ne_info").Where("ne_type = ?", "SMF").
|
||||
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)
|
||||
@@ -45,7 +45,7 @@ func SyncNbiCM() error {
|
||||
UserLabel: ne.NeName,
|
||||
VendorName: ne.VendorName,
|
||||
ManagedBy: ne.Dn,
|
||||
ManagementIpAddress: ne.Ip,
|
||||
ManagementIpAddress: "{" + ne.Ip + "}",
|
||||
SwVersion: version,
|
||||
PatchInfo: "-",
|
||||
AdministrativeState: adminState,
|
||||
@@ -62,39 +62,45 @@ func SyncNbiCM() error {
|
||||
Order("timestamp ASC").Pluck("value_json", &lastJson).Error
|
||||
newValueJson := string(meJSON)
|
||||
if err != nil || lastJson == "" {
|
||||
common.InsertNbiCm(ne, "ManagedElement", newValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, "ManagedElement", newValueJson, common.ObjectCreationEvent)
|
||||
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, "ManagedElement", common.ToJson(added), common.ObjectCreationEvent)
|
||||
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, "ManagedElement", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
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, "ManagedElement", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
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, "ManagedElement", newValueJson, common.ObjectOriginalEvent)
|
||||
common.InsertNbiCm(ne, version, "ManagedElement", newValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
|
||||
// ========== SmfFunction ==========
|
||||
var capability int
|
||||
err = dborm.DefaultDB().Table("ne_license").Where("ne_type = ? and ne_id = ?", ne.NeType, ne.NeId).
|
||||
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",
|
||||
@@ -102,10 +108,10 @@ func SyncNbiCM() error {
|
||||
OperationalState: operState,
|
||||
VnfInstanceId: "vnf-" + ne.NeType + "-" + ne.NeId,
|
||||
Fqdn: fmt.Sprintf("%s%s.mnc000.mcc460.3gppnetwork.org", strings.ToLower(ne.NeType), ne.NeId),
|
||||
SbiServiceList: "Nsmf_PDUSession,Nsmf_EventExposure",
|
||||
SbiServiceList: "{Nsmf_PDUSession,Nsmf_EventExposure}",
|
||||
MaxPduSessions: capability,
|
||||
MaxQfi: 64,
|
||||
UpfList: "[\"UPF-001\",\"UPF-2\"]",
|
||||
UpfList: "{" + strings.Join(upfNames, ",") + "}",
|
||||
}
|
||||
smfJSON, err := json.Marshal(smfFunction)
|
||||
if err != nil {
|
||||
@@ -118,28 +124,28 @@ func SyncNbiCM() error {
|
||||
Order("timestamp ASC").Pluck("value_json", &lastSmfJson).Error
|
||||
newSmfValueJson := string(smfJSON)
|
||||
if err != nil || lastSmfJson == "" {
|
||||
common.InsertNbiCm(ne, "SmfFunction", newSmfValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, "SmfFunction", newSmfValueJson, common.ObjectCreationEvent)
|
||||
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, "SmfFunction", common.ToJson(added), common.ObjectCreationEvent)
|
||||
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, "SmfFunction", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
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, "SmfFunction", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
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, "SmfFunction", newSmfValueJson, common.ObjectOriginalEvent)
|
||||
common.InsertNbiCm(ne, version, "SmfFunction", newSmfValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,9 +153,9 @@ func SyncNbiCM() error {
|
||||
addrPool := AddrPool{
|
||||
Id: fmt.Sprintf("%s-%s-AddrPool", ne.NeType, ne.NeId),
|
||||
UserLabel: ne.NeName + "-AddrPool",
|
||||
AddrType: "UE",
|
||||
AddrType: "Static",
|
||||
IpVersion: "IPv4",
|
||||
AddrSegList: "[\"10.60.0.0/16\",\"10.61.0.0/16\"]",
|
||||
AddrSegList: `{{StartIp:10.60.1.100,SegLen:100},{StartIp:10.61.1.100,SegLen:100}}`,
|
||||
}
|
||||
addrPoolJSON, err := json.Marshal(addrPool)
|
||||
if err != nil {
|
||||
@@ -161,28 +167,28 @@ func SyncNbiCM() error {
|
||||
Order("timestamp ASC").Pluck("value_json", &lastAddrPoolJson).Error
|
||||
newAddrPoolValueJson := string(addrPoolJSON)
|
||||
if err != nil || lastAddrPoolJson == "" {
|
||||
common.InsertNbiCm(ne, "AddrPool", newAddrPoolValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, "AddrPool", newAddrPoolValueJson, common.ObjectCreationEvent)
|
||||
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, "AddrPool", common.ToJson(added), common.ObjectCreationEvent)
|
||||
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, "AddrPool", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
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, "AddrPool", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
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, "AddrPool", newAddrPoolValueJson, common.ObjectOriginalEvent)
|
||||
common.InsertNbiCm(ne, version, "AddrPool", newAddrPoolValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -191,8 +197,8 @@ func SyncNbiCM() error {
|
||||
epRpDynN7Smf := EpRpDynN7Smf{
|
||||
Id: fmt.Sprintf("%s-%s-EpRpDynN7Smf", ne.NeType, ne.NeId),
|
||||
UserLabel: ne.NeName + "-N7",
|
||||
LocIpAddrList: "[\"" + ne.Ip + "\"]",
|
||||
FarIpSubnetworkList: "[\"10.17.0.0/16\"]",
|
||||
LocIpAddrList: `{` + ne.Ip + `}`,
|
||||
FarIpSubnetworkList: `{{Subnetwork:10.17.1.0,Mask:255.255.255.255}}`,
|
||||
}
|
||||
n7JSON, err := json.Marshal(epRpDynN7Smf)
|
||||
if err != nil {
|
||||
@@ -204,28 +210,28 @@ func SyncNbiCM() error {
|
||||
Order("timestamp ASC").Pluck("value_json", &lastN7Json).Error
|
||||
newN7ValueJson := string(n7JSON)
|
||||
if err != nil || lastN7Json == "" {
|
||||
common.InsertNbiCm(ne, "EpRpDynN7Smf", newN7ValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, "EpRpDynN7Smf", newN7ValueJson, common.ObjectCreationEvent)
|
||||
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, "EpRpDynN7Smf", common.ToJson(added), common.ObjectCreationEvent)
|
||||
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, "EpRpDynN7Smf", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
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, "EpRpDynN7Smf", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
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, "EpRpDynN7Smf", newN7ValueJson, common.ObjectOriginalEvent)
|
||||
common.InsertNbiCm(ne, version, "EpRpDynN7Smf", newN7ValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -234,8 +240,8 @@ func SyncNbiCM() error {
|
||||
epRpDynN10Smf := EpRpDynN10Smf{
|
||||
Id: fmt.Sprintf("%s-%s-EpRpDynN10Smf", ne.NeType, ne.NeId),
|
||||
UserLabel: ne.NeName + "-N10",
|
||||
LocIpAddrList: "[\"" + ne.Ip + "\"]",
|
||||
FarIpSubnetworkList: "[\"10.20.0.0/16\"]",
|
||||
LocIpAddrList: `{` + ne.Ip + `}`,
|
||||
FarIpSubnetworkList: `{{Subnetwork:10.20.1.0,Mask:255.255.255.255}}`,
|
||||
}
|
||||
n10JSON, err := json.Marshal(epRpDynN10Smf)
|
||||
if err != nil {
|
||||
@@ -247,28 +253,28 @@ func SyncNbiCM() error {
|
||||
Order("timestamp ASC").Pluck("value_json", &lastN10Json).Error
|
||||
newN10ValueJson := string(n10JSON)
|
||||
if err != nil || lastN10Json == "" {
|
||||
common.InsertNbiCm(ne, "EpRpDynN10Smf", newN10ValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, "EpRpDynN10Smf", newN10ValueJson, common.ObjectCreationEvent)
|
||||
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, "EpRpDynN10Smf", common.ToJson(added), common.ObjectCreationEvent)
|
||||
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, "EpRpDynN10Smf", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
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, "EpRpDynN10Smf", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
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, "EpRpDynN10Smf", newN10ValueJson, common.ObjectOriginalEvent)
|
||||
common.InsertNbiCm(ne, version, "EpRpDynN10Smf", newN10ValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -291,28 +297,28 @@ func SyncNbiCM() error {
|
||||
Order("timestamp ASC").Pluck("value_json", &lastIpJson).Error
|
||||
newIpValueJson := string(ipJSON)
|
||||
if err != nil || lastIpJson == "" {
|
||||
common.InsertNbiCm(ne, "IPResource", newIpValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, "IPResource", newIpValueJson, common.ObjectCreationEvent)
|
||||
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, "IPResource", common.ToJson(added), common.ObjectCreationEvent)
|
||||
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, "IPResource", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
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, "IPResource", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
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, "IPResource", newIpValueJson, common.ObjectOriginalEvent)
|
||||
common.InsertNbiCm(ne, version, "IPResource", newIpValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ func SyncNbiCM() error {
|
||||
|
||||
// 从ne_info表获取UDM类型的网元
|
||||
var udmNEs []common.NeInfo
|
||||
err := dborm.DefaultDB().Table("ne_info").Where("ne_type = ?", "UDM").
|
||||
err := dborm.DefaultDB().Table("ne_info").Where("ne_type = ? and status <> 0", "UDM").
|
||||
Find(&udmNEs).Error
|
||||
if err != nil {
|
||||
log.Errorf("Failed to query UDM network elements: %v", err)
|
||||
@@ -45,7 +45,7 @@ func SyncNbiCM() error {
|
||||
UserLabel: ne.NeName,
|
||||
VendorName: ne.VendorName,
|
||||
ManagedBy: ne.Dn,
|
||||
ManagementIpAddress: ne.Ip,
|
||||
ManagementIpAddress: "{" + ne.Ip + "}",
|
||||
SwVersion: version,
|
||||
PatchInfo: "-",
|
||||
AdministrativeState: adminState,
|
||||
@@ -62,28 +62,28 @@ func SyncNbiCM() error {
|
||||
Order("timestamp ASC").Pluck("value_json", &lastJson).Error
|
||||
newValueJson := string(meJSON)
|
||||
if err != nil || lastJson == "" {
|
||||
common.InsertNbiCm(ne, "ManagedElement", newValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, "ManagedElement", newValueJson, common.ObjectCreationEvent)
|
||||
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, "ManagedElement", common.ToJson(added), common.ObjectCreationEvent)
|
||||
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, "ManagedElement", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
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, "ManagedElement", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
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, "ManagedElement", newValueJson, common.ObjectOriginalEvent)
|
||||
common.InsertNbiCm(ne, version, "ManagedElement", newValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ func SyncNbiCM() error {
|
||||
OperationalState: operState,
|
||||
VnfInstanceId: "vnf-" + ne.NeType + "-" + ne.NeId,
|
||||
Fqdn: fmt.Sprintf("%s%s.mnc000.mcc460.3gppnetwork.org", strings.ToLower(ne.NeType), ne.NeId),
|
||||
SbiServiceList: "Nudm_UEAuthentication,Nudm_SubscriberDataManagement,Nudm_UEContextManagement",
|
||||
SbiServiceList: "{Nudm_UEAuthentication,Nudm_SubscriberDataManagement,Nudm_UEContextManagement}",
|
||||
}
|
||||
udmJSON, err := json.Marshal(udmFunction)
|
||||
if err != nil {
|
||||
@@ -108,34 +108,34 @@ func SyncNbiCM() error {
|
||||
Order("timestamp ASC").Pluck("value_json", &lastUdmJson).Error
|
||||
newUdmValueJson := string(udmJSON)
|
||||
if err != nil || lastUdmJson == "" {
|
||||
common.InsertNbiCm(ne, "UdmFunction", newUdmValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, "UdmFunction", newUdmValueJson, common.ObjectCreationEvent)
|
||||
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, "UdmFunction", common.ToJson(added), common.ObjectCreationEvent)
|
||||
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, "UdmFunction", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
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, "UdmFunction", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
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, "UdmFunction", newUdmValueJson, common.ObjectOriginalEvent)
|
||||
common.InsertNbiCm(ne, version, "UdmFunction", newUdmValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
|
||||
// ========== UdrFunction ==========
|
||||
var capability int
|
||||
err = dborm.DefaultDB().Table("ne_license").Where("ne_type = ? and ne_id = ?", ne.NeType, ne.NeId).
|
||||
err = dborm.DefaultDB().Table("ne_license").Where("ne_type = ? and ne_id = ? and status = 1", ne.NeType, ne.NeId).
|
||||
Pluck("capability", &capability).Error
|
||||
if err != nil {
|
||||
log.Errorf("Failed to query capability for ne_id %s: %v", ne.NeId, err)
|
||||
@@ -148,7 +148,7 @@ func SyncNbiCM() error {
|
||||
OperationalState: operState,
|
||||
VnfInstanceId: "vnf-UDR-" + ne.NeId,
|
||||
Fqdn: fmt.Sprintf("%s%s.mnc000.mcc460.3gppnetwork.org", strings.ToLower(ne.NeType), ne.NeId),
|
||||
SbiServiceList: "Nudr_DataRepository",
|
||||
SbiServiceList: "{Nudr_DataRepository}",
|
||||
MaxNumSupi: capability,
|
||||
MaxNumMsisdn: capability,
|
||||
}
|
||||
@@ -162,28 +162,28 @@ func SyncNbiCM() error {
|
||||
Order("timestamp ASC").Pluck("value_json", &lastUdrJson).Error
|
||||
newUdrValueJson := string(udrJSON)
|
||||
if err != nil || lastUdrJson == "" {
|
||||
common.InsertNbiCm(ne, "UdrFunction", newUdrValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, "UdrFunction", newUdrValueJson, common.ObjectCreationEvent)
|
||||
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, "UdrFunction", common.ToJson(added), common.ObjectCreationEvent)
|
||||
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, "UdrFunction", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
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, "UdrFunction", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
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, "UdrFunction", newUdrValueJson, common.ObjectOriginalEvent)
|
||||
common.InsertNbiCm(ne, version, "UdrFunction", newUdrValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -196,7 +196,7 @@ func SyncNbiCM() error {
|
||||
OperationalState: operState,
|
||||
VnfInstanceId: "vnf-AUSF-" + ne.NeId,
|
||||
Fqdn: fmt.Sprintf("ausf%s.mnc000.mcc460.3gppnetwork.org", ne.NeId),
|
||||
SbiServiceList: "Nausf_UEAuthentication,Nausf_SoRProtection",
|
||||
SbiServiceList: "{Nausf_UEAuthentication,Nausf_SoRProtection}",
|
||||
}
|
||||
ausfJSON, err := json.Marshal(ausfFunction)
|
||||
if err != nil {
|
||||
@@ -208,28 +208,28 @@ func SyncNbiCM() error {
|
||||
Order("timestamp ASC").Pluck("value_json", &lastAusfJson).Error
|
||||
newAusfValueJson := string(ausfJSON)
|
||||
if err != nil || lastAusfJson == "" {
|
||||
common.InsertNbiCm(ne, "AusfFunction", newAusfValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, "AusfFunction", newAusfValueJson, common.ObjectCreationEvent)
|
||||
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, "AusfFunction", common.ToJson(added), common.ObjectCreationEvent)
|
||||
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, "AusfFunction", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
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, "AusfFunction", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
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, "AusfFunction", newAusfValueJson, common.ObjectOriginalEvent)
|
||||
common.InsertNbiCm(ne, version, "AusfFunction", newAusfValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -252,28 +252,28 @@ func SyncNbiCM() error {
|
||||
Order("timestamp ASC").Pluck("value_json", &lastIpJson).Error
|
||||
newIpValueJson := string(ipJSON)
|
||||
if err != nil || lastIpJson == "" {
|
||||
common.InsertNbiCm(ne, "IPResource", newIpValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, "IPResource", newIpValueJson, common.ObjectCreationEvent)
|
||||
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, "IPResource", common.ToJson(added), common.ObjectCreationEvent)
|
||||
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, "IPResource", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
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, "IPResource", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
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, "IPResource", newIpValueJson, common.ObjectOriginalEvent)
|
||||
common.InsertNbiCm(ne, version, "IPResource", newIpValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ type ManagedElement struct {
|
||||
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 {
|
||||
@@ -39,6 +41,7 @@ type InventoryUnitShelf struct {
|
||||
DateOfManufacture string `json:"dateOfManufacture"`
|
||||
DateOfLastService string `json:"dateOfLastService"`
|
||||
ManufacturerData string `json:"manufacturerData"`
|
||||
SlotsInformation string `json:"slotsInformation"`
|
||||
ShelfPosition string `json:"shelfPosition"`
|
||||
}
|
||||
|
||||
@@ -53,24 +56,26 @@ type InventoryUnitPack struct {
|
||||
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 string `json:"numberOfCpu"`
|
||||
MemSize string `json:"memSize"`
|
||||
HardDiskSize string `json:"hardDiskSize"`
|
||||
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 {
|
||||
@@ -95,8 +100,8 @@ type UpfFunction struct {
|
||||
AdministrativeState common.AdministrativeState `json:"administrativeState"`
|
||||
OperationalState common.OperationalState `json:"operationalState"`
|
||||
VnfInstanceId string `json:"vnfInstanceId"`
|
||||
MaxQosFlows string `json:"maxQosFlows"`
|
||||
MaxThroughput string `json:"maxThroughput"`
|
||||
MaxQosFlows int32 `json:"maxQosFlows"`
|
||||
MaxThroughput float32 `json:"maxThroughput"`
|
||||
}
|
||||
|
||||
type EpRpDynN9Upf struct {
|
||||
|
||||
@@ -18,7 +18,7 @@ func SyncNbiCM() error {
|
||||
|
||||
// 从ne_info表获取UPF类型的网元
|
||||
var upfNEs []common.NeInfo
|
||||
err := dborm.DefaultDB().Table("ne_info").Where("ne_type = ?", "UPF").
|
||||
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)
|
||||
@@ -29,7 +29,7 @@ func SyncNbiCM() error {
|
||||
|
||||
now := time.Now()
|
||||
|
||||
for _, ne := range upfNEs {
|
||||
for i, ne := range upfNEs {
|
||||
adminState, operState := common.ParseStateFromStatus(ne.Status)
|
||||
|
||||
var version string = "-"
|
||||
@@ -47,11 +47,13 @@ func SyncNbiCM() error {
|
||||
UserLabel: ne.NeName,
|
||||
VendorName: ne.VendorName,
|
||||
ManagedBy: ne.Dn,
|
||||
ManagementIpAddress: ne.Ip,
|
||||
ManagementIpAddress: "{" + ne.Ip + "}",
|
||||
SwVersion: version,
|
||||
PatchInfo: "-",
|
||||
AdministrativeState: adminState,
|
||||
OperationalState: operState,
|
||||
LocationName: ne.Province,
|
||||
HardwarePlatform: "x86_64",
|
||||
}
|
||||
meJSON, err := json.Marshal(managedElement)
|
||||
if err != nil {
|
||||
@@ -64,28 +66,28 @@ func SyncNbiCM() error {
|
||||
Order("timestamp ASC").Pluck("value_json", &lastJson).Error
|
||||
newValueJson := string(meJSON)
|
||||
if err != nil || lastJson == "" {
|
||||
common.InsertNbiCm(ne, "ManagedElement", newValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, "ManagedElement", newValueJson, common.ObjectCreationEvent)
|
||||
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, "ManagedElement", common.ToJson(added), common.ObjectCreationEvent)
|
||||
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, "ManagedElement", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
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, "ManagedElement", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
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, "ManagedElement", newValueJson, common.ObjectOriginalEvent)
|
||||
common.InsertNbiCm(ne, version, "ManagedElement", newValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,11 +99,11 @@ func SyncNbiCM() error {
|
||||
VendorUnitTypeNumber: "UPF-" + ne.NeId,
|
||||
VendorName: ne.VendorName,
|
||||
SerialNumber: "SN-UPF-" + ne.NeId,
|
||||
VersionNumber: "1.0.0",
|
||||
VersionNumber: "1.2.16",
|
||||
DateOfManufacture: "2023-01-01",
|
||||
DateOfLastService: now.Format("2006-01-02"),
|
||||
DateOfLastService: now.AddDate(0, 0, 360).Format("2006-01-02"),
|
||||
ManufacturerData: "{}",
|
||||
RackPosition: "1",
|
||||
RackPosition: "1-2",
|
||||
}
|
||||
rackJSON, err := json.Marshal(inventoryUnitRack)
|
||||
if err != nil {
|
||||
@@ -113,33 +115,34 @@ func SyncNbiCM() error {
|
||||
Order("timestamp ASC").Pluck("value_json", &lastRackJson).Error
|
||||
newRackValueJson := string(rackJSON)
|
||||
if err != nil || lastRackJson == "" {
|
||||
common.InsertNbiCm(ne, "InventoryUnitRack", newRackValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, "InventoryUnitRack", newRackValueJson, common.ObjectCreationEvent)
|
||||
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, "InventoryUnitRack", common.ToJson(added), common.ObjectCreationEvent)
|
||||
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, "InventoryUnitRack", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
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, "InventoryUnitRack", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
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, "InventoryUnitRack", newRackValueJson, common.ObjectOriginalEvent)
|
||||
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",
|
||||
@@ -147,10 +150,11 @@ func SyncNbiCM() error {
|
||||
VendorUnitTypeNumber: "UPF-SHELF-" + ne.NeId,
|
||||
VendorName: ne.VendorName,
|
||||
SerialNumber: "SN-UPF-SHELF-" + ne.NeId,
|
||||
VersionNumber: "1.0.0",
|
||||
VersionNumber: "1.2.15",
|
||||
DateOfManufacture: "2023-01-01",
|
||||
DateOfLastService: now.Format("2006-01-02"),
|
||||
DateOfLastService: now.AddDate(0, 0, 360).Format("2006-01-02"),
|
||||
ManufacturerData: "{}",
|
||||
SlotsInformation: slotsInfo,
|
||||
ShelfPosition: "1",
|
||||
}
|
||||
shelfJSON, err := json.Marshal(inventoryUnitShelf)
|
||||
@@ -163,28 +167,28 @@ func SyncNbiCM() error {
|
||||
Order("timestamp ASC").Pluck("value_json", &lastShelfJson).Error
|
||||
newShelfValueJson := string(shelfJSON)
|
||||
if err != nil || lastShelfJson == "" {
|
||||
common.InsertNbiCm(ne, "InventoryUnitShelf", newShelfValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, "InventoryUnitShelf", newShelfValueJson, common.ObjectCreationEvent)
|
||||
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, "InventoryUnitShelf", common.ToJson(added), common.ObjectCreationEvent)
|
||||
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, "InventoryUnitShelf", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
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, "InventoryUnitShelf", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
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, "InventoryUnitShelf", newShelfValueJson, common.ObjectOriginalEvent)
|
||||
common.InsertNbiCm(ne, version, "InventoryUnitShelf", newShelfValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -197,11 +201,13 @@ func SyncNbiCM() error {
|
||||
VendorUnitTypeNumber: "UPF-PACK-" + ne.NeId,
|
||||
VendorName: ne.VendorName,
|
||||
SerialNumber: "SN-UPF-PACK-" + ne.NeId,
|
||||
VersionNumber: "1.0.0",
|
||||
VersionNumber: "1.2.14",
|
||||
DateOfManufacture: "2023-01-01",
|
||||
DateOfLastService: now.Format("2006-01-02"),
|
||||
DateOfLastService: now.AddDate(0, 0, 360).Format("2006-01-02"),
|
||||
ManufacturerData: "{}",
|
||||
SlotsOccupied: "1,2",
|
||||
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 {
|
||||
@@ -213,28 +219,28 @@ func SyncNbiCM() error {
|
||||
Order("timestamp ASC").Pluck("value_json", &lastPackJson).Error
|
||||
newPackValueJson := string(packJSON)
|
||||
if err != nil || lastPackJson == "" {
|
||||
common.InsertNbiCm(ne, "InventoryUnitPack", newPackValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, "InventoryUnitPack", newPackValueJson, common.ObjectCreationEvent)
|
||||
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, "InventoryUnitPack", common.ToJson(added), common.ObjectCreationEvent)
|
||||
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, "InventoryUnitPack", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
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, "InventoryUnitPack", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
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, "InventoryUnitPack", newPackValueJson, common.ObjectOriginalEvent)
|
||||
common.InsertNbiCm(ne, version, "InventoryUnitPack", newPackValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -247,14 +253,14 @@ func SyncNbiCM() error {
|
||||
VendorUnitTypeNumber: "UPF-HOST-" + ne.NeId,
|
||||
VendorName: ne.VendorName,
|
||||
SerialNumber: "SN-UPF-HOST-" + ne.NeId,
|
||||
VersionNumber: "1.0.0",
|
||||
VersionNumber: "1.2.16",
|
||||
DateOfManufacture: "2023-01-01",
|
||||
DateOfLastService: now.Format("2006-01-02"),
|
||||
DateOfLastService: now.AddDate(0, 0, 360).Format("2006-01-02"),
|
||||
ManufacturerData: "{}",
|
||||
HostPosition: "1",
|
||||
NumberOfCpu: "16",
|
||||
MemSize: "64GB",
|
||||
HardDiskSize: "1TB",
|
||||
NumberOfCpu: 16,
|
||||
MemSize: 64,
|
||||
HardDiskSize: 1024,
|
||||
}
|
||||
hostJSON, err := json.Marshal(inventoryUnitHost)
|
||||
if err != nil {
|
||||
@@ -266,28 +272,28 @@ func SyncNbiCM() error {
|
||||
Order("timestamp ASC").Pluck("value_json", &lastHostJson).Error
|
||||
newHostValueJson := string(hostJSON)
|
||||
if err != nil || lastHostJson == "" {
|
||||
common.InsertNbiCm(ne, "InventoryUnitHost", newHostValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, "InventoryUnitHost", newHostValueJson, common.ObjectCreationEvent)
|
||||
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, "InventoryUnitHost", common.ToJson(added), common.ObjectCreationEvent)
|
||||
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, "InventoryUnitHost", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
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, "InventoryUnitHost", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
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, "InventoryUnitHost", newHostValueJson, common.ObjectOriginalEvent)
|
||||
common.InsertNbiCm(ne, version, "InventoryUnitHost", newHostValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -300,9 +306,9 @@ func SyncNbiCM() error {
|
||||
VendorUnitTypeNumber: "UPF-ACC-" + ne.NeId,
|
||||
VendorName: ne.VendorName,
|
||||
SerialNumber: "SN-UPF-ACC-" + ne.NeId,
|
||||
VersionNumber: "1.0.0",
|
||||
VersionNumber: "1.2.15",
|
||||
DateOfManufacture: "2023-01-01",
|
||||
DateOfLastService: now.Format("2006-01-02"),
|
||||
DateOfLastService: now.AddDate(0, 0, 360).Format("2006-01-02"),
|
||||
ManufacturerData: "{}",
|
||||
AccessoryPosition: "1",
|
||||
AccessoryType: "FAN",
|
||||
@@ -318,34 +324,34 @@ func SyncNbiCM() error {
|
||||
Order("timestamp ASC").Pluck("value_json", &lastAccJson).Error
|
||||
newAccValueJson := string(accJSON)
|
||||
if err != nil || lastAccJson == "" {
|
||||
common.InsertNbiCm(ne, "InventoryUnitAccessory", newAccValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, "InventoryUnitAccessory", newAccValueJson, common.ObjectCreationEvent)
|
||||
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, "InventoryUnitAccessory", common.ToJson(added), common.ObjectCreationEvent)
|
||||
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, "InventoryUnitAccessory", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
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, "InventoryUnitAccessory", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
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, "InventoryUnitAccessory", newAccValueJson, common.ObjectOriginalEvent)
|
||||
common.InsertNbiCm(ne, version, "InventoryUnitAccessory", newAccValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var capability int
|
||||
err = dborm.DefaultDB().Table("ne_license").Where("ne_type = ? and ne_id = ?", ne.NeType, ne.NeId).
|
||||
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)
|
||||
@@ -359,8 +365,8 @@ func SyncNbiCM() error {
|
||||
AdministrativeState: adminState,
|
||||
OperationalState: operState,
|
||||
VnfInstanceId: "vnf-" + ne.NeType + "-" + ne.NeId,
|
||||
MaxQosFlows: fmt.Sprintf("%d", capability),
|
||||
MaxThroughput: "10Gbps",
|
||||
MaxQosFlows: capability,
|
||||
MaxThroughput: 10.0,
|
||||
}
|
||||
upfJSON, err := json.Marshal(upfFunction)
|
||||
if err != nil {
|
||||
@@ -372,28 +378,28 @@ func SyncNbiCM() error {
|
||||
Order("timestamp ASC").Pluck("value_json", &lastUpfJson).Error
|
||||
newUpfValueJson := string(upfJSON)
|
||||
if err != nil || lastUpfJson == "" {
|
||||
common.InsertNbiCm(ne, "UpfFunction", newUpfValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, "UpfFunction", newUpfValueJson, common.ObjectCreationEvent)
|
||||
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, "UpfFunction", common.ToJson(added), common.ObjectCreationEvent)
|
||||
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, "UpfFunction", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
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, "UpfFunction", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
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, "UpfFunction", newUpfValueJson, common.ObjectOriginalEvent)
|
||||
common.InsertNbiCm(ne, version, "UpfFunction", newUpfValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -402,8 +408,8 @@ func SyncNbiCM() error {
|
||||
epRpDynN3Upf := EpRpDynN3Upf{
|
||||
Id: fmt.Sprintf("%s-%s-EpRpDynN3Upf", ne.NeType, ne.NeId),
|
||||
UserLabel: ne.NeName + "-EpRpDynN3Upf",
|
||||
LocIpAddrList: "[\"" + ne.Ip + "\"]",
|
||||
FarIpSubnetworkList: "[\"10.13.0.0/16\"]",
|
||||
LocIpAddrList: "{" + ne.Ip + "}",
|
||||
FarIpSubnetworkList: `{{"Subnetwork":"10.13.1.0","Mask":"255.255.255.255"}}`,
|
||||
}
|
||||
n3JSON, err := json.Marshal(epRpDynN3Upf)
|
||||
if err != nil {
|
||||
@@ -415,28 +421,28 @@ func SyncNbiCM() error {
|
||||
Order("timestamp ASC").Pluck("value_json", &lastN3Json).Error
|
||||
newN3ValueJson := string(n3JSON)
|
||||
if err != nil || lastN3Json == "" {
|
||||
common.InsertNbiCm(ne, "EpRpDynN3Upf", newN3ValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, "EpRpDynN3Upf", newN3ValueJson, common.ObjectCreationEvent)
|
||||
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, "EpRpDynN3Upf", common.ToJson(added), common.ObjectCreationEvent)
|
||||
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, "EpRpDynN3Upf", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
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, "EpRpDynN3Upf", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
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, "EpRpDynN3Upf", newN3ValueJson, common.ObjectOriginalEvent)
|
||||
common.InsertNbiCm(ne, version, "EpRpDynN3Upf", newN3ValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -445,8 +451,8 @@ func SyncNbiCM() error {
|
||||
epRpDynN9Upf := EpRpDynN9Upf{
|
||||
Id: fmt.Sprintf("%s-%s-EpRpDynN9Upf", ne.NeType, ne.NeId),
|
||||
UserLabel: ne.NeName + "-EpRpDynN9Upf",
|
||||
LocIpAddrList: "[\"" + ne.Ip + "\"]",
|
||||
FarIpSubnetworkList: "[\"10.19.0.0/16\"]",
|
||||
LocIpAddrList: `{` + ne.Ip + `}`,
|
||||
FarIpSubnetworkList: `{{Subnetwork:10.19.1.0,Mask:255.255.255.255}}`,
|
||||
}
|
||||
n9JSON, err := json.Marshal(epRpDynN9Upf)
|
||||
if err != nil {
|
||||
@@ -458,28 +464,28 @@ func SyncNbiCM() error {
|
||||
Order("timestamp ASC").Pluck("value_json", &lastN9Json).Error
|
||||
newN9ValueJson := string(n9JSON)
|
||||
if err != nil || lastN9Json == "" {
|
||||
common.InsertNbiCm(ne, "EpRpDynN9Upf", newN9ValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, "EpRpDynN9Upf", newN9ValueJson, common.ObjectCreationEvent)
|
||||
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, "EpRpDynN9Upf", common.ToJson(added), common.ObjectCreationEvent)
|
||||
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, "EpRpDynN9Upf", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
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, "EpRpDynN9Upf", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
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, "EpRpDynN9Upf", newN9ValueJson, common.ObjectOriginalEvent)
|
||||
common.InsertNbiCm(ne, version, "EpRpDynN9Upf", newN9ValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -502,28 +508,28 @@ func SyncNbiCM() error {
|
||||
Order("timestamp ASC").Pluck("value_json", &lastIpJson).Error
|
||||
newIpValueJson := string(ipJSON)
|
||||
if err != nil || lastIpJson == "" {
|
||||
common.InsertNbiCm(ne, "IPResource", newIpValueJson, common.ObjectOriginalEvent)
|
||||
nbiCm := common.InsertNbiCm(ne, "IPResource", newIpValueJson, common.ObjectCreationEvent)
|
||||
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, "IPResource", common.ToJson(added), common.ObjectCreationEvent)
|
||||
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, "IPResource", common.ToJson(modified), common.ObjectAttributeValueChangeEvent)
|
||||
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, "IPResource", common.ToJson(deleted), common.ObjectDeletionEvent)
|
||||
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, "IPResource", newIpValueJson, common.ObjectOriginalEvent)
|
||||
common.InsertNbiCm(ne, version, "IPResource", newIpValueJson, common.ObjectOriginalEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
# Makefile for OMC-OMC-crontask project
|
||||
|
||||
PROJECT = OMC
|
||||
VERSION = 2.2505.1
|
||||
VERSION = 2.2508.2
|
||||
LIBDIR = be.ems/lib
|
||||
BINNAME = sshsvc
|
||||
|
||||
|
||||
Reference in new issue
Block a user