diff --git a/.gitignore b/.gitignore index 1562caa0..09782aa7 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,6 @@ main # Build Output local/*.sqlite omc + +src/modules2/ +build/database/std2/ diff --git a/build/database/lite/common/ne_config.sql b/build/database/lite/common/ne_config.sql index 2df1a188..db86d9ac 100644 --- a/build/database/lite/common/ne_config.sql +++ b/build/database/lite/common/ne_config.sql @@ -28,18 +28,18 @@ ON "ne_config" ( -- ---------------------------- -- Records of ne_config -- ---------------------------- --- 更新 AMF 配置 20250630 -INSERT INTO "ne_config" VALUES (1, 'AMF', 'system', 'System Config', 'list', '[{"access":"read-write","comment":"","display":"AMF Name","filter":"0~64","name":"amfName","type":"string","value":"AMF","visible":"self"},{"access":"read-write","comment":"0~255","display":"AMF Priority","filter":"0~255","name":"nfPriority","type":"int","value":"255","visible":"self"},{"access":"read-write","comment":"0~255","display":"SBI Relative Capacity","filter":"0~255","name":"relativeCapacity","type":"int","value":"255","visible":"self"},{"access":"read-write","comment":"","display":"SBI Scheme","filter":"{\"0\":\"http\",\"1\":\"https\"}","name":"sbiScheme","type":"enum","value":"0"},{"access":"read-write","comment":"","display":"SBI Server IP","filter":"0~64","name":"sbiServerIp","type":"string","value":"192.168.1.183","visible":"self"},{"access":"read-write","comment":"0~65535","display":"SBI Server Port","filter":"0~65535","name":"sbiServerPort","type":"int","value":"8080"},{"access":"read-write","comment":"","display":"NRF Enabled","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"nrfEnabled","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"NF NRF URI","filter":"0~64","name":"nrfUri","type":"string","value":"http://172.16.5.180:8080"},{"access":"read-write","comment":"","display":"NF AUSF URI","filter":"0~64","name":"ausfUri","type":"string","value":"http://172.16.5.130:8080"},{"access":"read-write","comment":"","display":"NF UDM URI","filter":"0~64","name":"udmUri","type":"string","value":"http://172.16.5.140:8080"},{"access":"read-write","comment":"","display":"NF SMF URI","filter":"0~64","name":"smfUri","type":"string","value":"http://172.16.5.150:8080"},{"access":"read-write","comment":"","display":"NF PCF URI","filter":"0~64","name":"pcfUri","type":"string","value":"http://172.16.5.160:8080"},{"access":"read-write","comment":"","display":"NF Backup AUSF URI","filter":"0~64","name":"backupAusfUri","type":"string","value":"http://172.16.5.131:8080"},{"access":"read-write","comment":"","display":"NF Backup UDM URI","filter":"0~64","name":"backupUdmUri","type":"string","value":"http://172.16.5.141:8080"},{"access":"read-write","comment":"","display":"NF Backup SMF URI","filter":"0~64","name":"backupSmfUri","type":"string","value":"http://172.16.5.151:8080"},{"access":"read-write","comment":"","display":"NF Backup PCF URI","filter":"0~64","name":"backupPcfUri","type":"string","value":"http://172.16.5.161:8080"},{"access":"read-write","comment":"","display":"NF LMF URI","filter":"0~64","name":"lmfUri","type":"string","value":"http://172.16.5.200:8080"},{"access":"read-write","comment":"","display":"NF NEF URI","filter":"0~64","name":"nefUri","type":"string","value":"http://172.16.5.210:8080"},{"access":"read-write","comment":"","display":"Default DNN","filter":"0~64","name":"defaultDnn","type":"string","value":"internet"},{"access":"read-write","comment":"","display":"AUTH Integrity Algorithm","filter":"{\"0\":\"NIA0\",\"1\":\"NIA1\",\"2\":\"NIA2\",\"3\":\"NIA3\"}","name":"integrityAlgorithm","type":"enum","value":"2"},{"access":"read-write","comment":"","display":"AUTH Ciphering Algorithm","filter":"{\"0\":\"NEA0\",\"1\":\"NEA1\",\"2\":\"NEA2\",\"3\":\"NEA3\"}","name":"cipheringAlgorithm","type":"enum","value":"0"},{"access":"read-write","comment":"","display":"T3502","filter":"1~65535","name":"t3502","type":"int","value":"720"},{"access":"read-write","comment":"","display":"T3512","filter":"1~65535","name":"t3512","type":"int","value":"3600"},{"access":"read-write","comment":"","display":"T3513","filter":"1~65535","name":"t3513","type":"int","value":"2"},{"access":"read-write","comment":"","display":"T3522","filter":"1~65535","name":"t3522","type":"int","value":"6"},{"access":"read-write","comment":"","display":"T3550","filter":"1~65535","name":"t3550","type":"int","value":"6"},{"access":"read-write","comment":"","display":"T3555","filter":"1~65535","name":"t3555","type":"int","value":"6"},{"access":"read-write","comment":"","display":"T3560","filter":"1~65535","name":"t3560","type":"int","value":"6"},{"access":"read-write","comment":"","display":"T3565","filter":"1~65535","name":"t3565","type":"int","value":"6"},{"access":"read-write","comment":"","display":"T3570","filter":"1~65535","name":"t3570","type":"int","value":"6"}]', 1, '', 1751271230797, 'public'); -INSERT INTO "ne_config" VALUES (2, 'AMF', 'systemFeatOpt', 'Enable/Disable Features', 'list', '[{"access":"read-write","comment":"","display":"DnnCorrectionEnabled","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"dnnCorrectionEnabled","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"GutiReallocationInPRUEnabled","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"gutiReallocationInPRUEnabled","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"UeRadioCapabilityMatchEnabled","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"ueRadioCapabilityMatchEnabled","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"SupportFollowOnRequestIndication","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"supportFollowOnRequestIndication","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"TriggerInitCtxSetupForAllNASProc","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"triggerInitCtxSetupForAllNASProc","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"SupportAllAllowedNssai","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"supportAllAllowedNssai","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"ImplicitUnsubscribeEnabled","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"implicitUnsubscribeEnabled","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"SupportRRCInactiveReport","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"supportRRCInactiveReport","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"SupportMappedSecurityContext","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"supportMappedSecurityContext","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"OptimizeSignalingProcedure","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"optimizeSignalingProcedure","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"ReAuthInServiceRequestProc","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"reAuthInServiceRequestProc","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"SkipGetSubscribedNssai","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"skipGetSubscribedNssai","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"ForceIdentityRequest","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"forceIdentityRequest","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"CagEnabled","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"cagEnabled","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"CheckSliceInTaEnabled","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"checkSliceInTaEnabled","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"uePolicyEnabled","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"uePolicyEnabled","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"smsOverNasEnabled","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"smsOverNasEnabled","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"statusReportToOmc","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"statusReportToOmc","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"StatusReportEnabled","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"statusReportEnabled","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"GetTraceDataFromUdm","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"getTraceDataFromUdm","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"DisableLocationReportControl","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"disableLocationReportControl","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"SendDnnOiToSmf","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"sendDnnOiToSmf","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"UdsfEnabled","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"udsfEnabled","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"EnableHttpPprof","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"enableHttpPprof","type":"bool","value":"0"}]', 3, '', 1751271230825, 'public'); -INSERT INTO "ne_config" VALUES (3, 'AMF', 'association', 'AMF TNL Association List', 'array', '[{"access":"read-only","comment":"0~15","display":"Index","filter":"0~15","name":"index","type":"int","value":"0"},{"access":"read-write","comment":"","display":"NGAP IP","filter":"0~64","name":"ngapIp","type":"string","value":"192.168.1.183"},{"access":"read-write","comment":"0~65535","display":"NGAP SCTP Port","filter":"0~65535","name":"ngapSctpPort","type":"int","value":"38412"},{"access":"read-write","comment":"0~255","display":"Weight","filter":"0~255","name":"weightFactor","type":"int","value":"255"}]', 5, '', 1751271230831, 'self'); -INSERT INTO "ne_config" VALUES (4, 'AMF', 'guami', 'AMF Served GUAMI List', 'array', '[{"access":"read-only","comment":"0~15","display":"Index","filter":"0~15","name":"index","type":"int","value":"0"},{"access":"read-write","comment":"","display":"PLMN ID","filter":"^[0-9]{5,6}$","name":"plmnId","type":"regex","value":"00101"},{"access":"read-write","comment":"0~255","display":"Region ID","filter":"0~255","name":"regionId","type":"int","value":"1"},{"access":"read-write","comment":"0~1023","display":"Set ID","filter":"0~1023","name":"setId","type":"int","value":"1"},{"access":"read-write","comment":"0~63","display":"Pointer","filter":"0~63","name":"pointer","type":"int","value":"1"}]', 7, '', 1751271230835, 'public'); -INSERT INTO "ne_config" VALUES (5, 'AMF', 'tai', 'AMF Support TAI List', 'array', '[{"access":"read-only","comment":"0~15","display":"Index","filter":"0~15","name":"index","type":"int","value":"0"},{"access":"read-write","comment":"","display":"PLMN ID","filter":"^[0-9]{5,6}$","name":"plmnId","type":"regex","value":"00101"},{"access":"read-write","comment":"0~16777215","display":"TAC","filter":"0~8","name":"tac","type":"string","value":"1"}]', 9, '', 1751271230838, 'public'); -INSERT INTO "ne_config" VALUES (6, 'AMF', 'slice', 'AMF Support Slice List', 'array', '[{"access":"read-only","comment":"0~15","display":"Index","filter":"0~15","name":"index","type":"int","value":"0"},{"access":"read-write","comment":"","display":"PLMN ID","filter":"^[0-9]{5,6}$","name":"plmnId","type":"regex","value":"00101"},{"access":"read-write","comment":"0~127","display":"SST","filter":"0~127","name":"sst","type":"int","value":"1"},{"access":"read-write","comment":"","display":"SD","filter":"^[A-Fa-f0-9]{6}","name":"sd","type":"regex","value":"000001"}]', 11, '', 1751271230843, 'public'); -INSERT INTO "ne_config" VALUES (7, 'AMF', 'whiteInfo', 'Enable Whitelist Feat', 'list', '[{"access":"read-write","comment":"if set true, need to add white list content by ''WhiteList Content'' entry ","display":"IMSI/IMEI Whitelist","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"enableWhitelist","type":"bool","value":"0"}]', 12, '', 1751271230847, 'public'); -INSERT INTO "ne_config" VALUES (8, 'AMF', 'whitelist', ' └── WhiteList Content', 'array', '[{"access":"read-only","comment":"0~65535","display":"Index","filter":"0~65535","name":"index","type":"int","value":"0"},{"access":"read-write","comment":"A.if SIM and device match, IMSI value format:[0-9]{14,15} e.g: 460020021404867 B.if only check IMEI Prefix, IMSI value set ''any''","display":"IMSI Value","filter":"^(|any|[0-9]{14,16})$","name":"imsiValue","type":"regex","value":""},{"access":"read-write","comment":"A.SIM and device match: IMEI value format:[0-9]{15,16} e.g: 8695830452209078 B.if only check IMEI Prefix, IMEI value is imei prefix value[0-9]{3-16} e.g: IMSI:''any'', IMEI:''86958304522'' )","display":"IMEI Value/Prefix","filter":"^(|any|[0-9]{2,16})$","name":"imeiValue","type":"regex","value":""}]', 13, '', 1751271230851, 'public'); -INSERT INTO "ne_config" VALUES (9, 'AMF', '4g5ghoN26Info', 'Enable 4G5GHO N26 Feat', 'list', '[{"access":"read-write","comment":"if set true, need to add MME List by ''4G5GHO Select MME List'' entry ","display":"enable iwkN26(open 4G/5G HO)","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"iwkN26","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"Set AMF Local N26 IP","filter":"0~64","name":"n26Ip","type":"string","value":"192.168.1.183","visible":"self"}]', 16, '', 1751271230858, 'public'); -INSERT INTO "ne_config" VALUES (10, 'AMF', '4g5ghoMmeList', ' └── 4G5GHO Select MME List', 'array', '[{"access":"read-only","comment":"0~32","display":"Index","filter":"0~32","name":"index","type":"int","value":"0"},{"access":"read-write","comment":"\u003cMCC\u003e\u003cMNC\u003e","display":"PLMN ID","filter":"^[0-9]{5,6}$","name":"plmnId","type":"regex","value":"00101"},{"access":"read-write","comment":"","display":"Group ID","filter":"0~65535","name":"groupId","type":"int","value":"4"},{"access":"read-write","comment":"","display":"Code","filter":"0~255","name":"code","type":"int","value":"1"},{"access":"read-write","comment":"","display":"TAC","filter":"0~65535","name":"tac","type":"int","value":"4388"},{"access":"read-write","comment":"IPv4 or IPv6 address","display":"MME IP Address","filter":"^(([0-9]{1,3}\\.){3}[0-9]{1,3}|([0-9a-fA-F]{0,4}:){2,7}[0-9a-fA-F]{0,4})$","name":"ip","type":"string","value":"172.16.5.220"}]', 17, '', 1751271230862, 'public'); -INSERT INTO "ne_config" VALUES (11, 'AMF', 'gnbList', 'Gnb List Config', 'array', '[{"access":"read-only","comment":"0~128","display":"Index","filter":"0~128","name":"index","type":"int","value":"0"},{"access":"read-write","comment":"text content length 0~64","display":"GNB Name","filter":"0~64","name":"name","type":"string","value":""},{"access":"read-write","comment":"text content length 0~64","display":"GNB Address","filter":"0~64","name":"address","type":"string","value":""},{"access":"read-write","comment":"location description. Prohibition of spaces, length of text content 0-64","display":"Position","filter":"0~64","name":"position","type":"string","value":""}]', 19, '', 1751271230865, 'hide'); +-- 更新 AMF 配置 20250828 +INSERT INTO "ne_config" VALUES (1, 'AMF', 'system', 'System Config', 'list', '[{"access":"read-write","comment":"","display":"AMF Name","filter":"0~64","name":"amfName","type":"string","value":"AMF","visible":"self"},{"access":"read-write","comment":"0~255","display":"AMF Priority","filter":"0~255","name":"nfPriority","type":"int","value":"255","visible":"self"},{"access":"read-write","comment":"0~255","display":"SBI Relative Capacity","filter":"0~255","name":"relativeCapacity","type":"int","value":"255","visible":"self"},{"access":"read-write","comment":"","display":"SBI Scheme","filter":"{\"0\":\"http\",\"1\":\"https\"}","name":"sbiScheme","type":"enum","value":"0"},{"access":"read-write","comment":"","display":"SBI Server IP","filter":"0~64","name":"sbiServerIp","type":"string","value":"192.168.1.183","visible":"self"},{"access":"read-write","comment":"0~65535","display":"SBI Server Port","filter":"0~65535","name":"sbiServerPort","type":"int","value":"8080"},{"access":"read-write","comment":"","display":"NRF Enabled","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"nrfEnabled","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"NF NRF URI","filter":"0~64","name":"nrfUri","type":"string","value":"http://172.16.5.180:8080"},{"access":"read-write","comment":"","display":"NF AUSF URI","filter":"0~64","name":"ausfUri","type":"string","value":"http://172.16.5.130:8080"},{"access":"read-write","comment":"","display":"NF UDM URI","filter":"0~64","name":"udmUri","type":"string","value":"http://172.16.5.140:8080"},{"access":"read-write","comment":"","display":"NF SMF URI","filter":"0~64","name":"smfUri","type":"string","value":"http://172.16.5.150:8080"},{"access":"read-write","comment":"","display":"NF PCF URI","filter":"0~64","name":"pcfUri","type":"string","value":"http://172.16.5.160:8080"},{"access":"read-write","comment":"","display":"NF Backup AUSF URI","filter":"0~64","name":"backupAusfUri","type":"string","value":"http://172.16.5.131:8080"},{"access":"read-write","comment":"","display":"NF Backup UDM URI","filter":"0~64","name":"backupUdmUri","type":"string","value":"http://172.16.5.141:8080"},{"access":"read-write","comment":"","display":"NF Backup SMF URI","filter":"0~64","name":"backupSmfUri","type":"string","value":"http://172.16.5.151:8080"},{"access":"read-write","comment":"","display":"NF Backup PCF URI","filter":"0~64","name":"backupPcfUri","type":"string","value":"http://172.16.5.161:8080"},{"access":"read-write","comment":"","display":"NF LMF URI","filter":"0~64","name":"lmfUri","type":"string","value":"http://172.16.5.200:8080"},{"access":"read-write","comment":"","display":"NF NEF URI","filter":"0~64","name":"nefUri","type":"string","value":"http://172.16.5.210:8080"},{"access":"read-write","comment":"","display":"Default DNN","filter":"0~64","name":"defaultDnn","type":"string","value":"internet"},{"access":"read-write","comment":"","display":"AUTH Integrity Algorithm","filter":"{\"0\":\"NIA0\",\"1\":\"NIA1\",\"2\":\"NIA2\",\"3\":\"NIA3\"}","name":"integrityAlgorithm","type":"enum","value":"2"},{"access":"read-write","comment":"","display":"AUTH Ciphering Algorithm","filter":"{\"0\":\"NEA0\",\"1\":\"NEA1\",\"2\":\"NEA2\",\"3\":\"NEA3\"}","name":"cipheringAlgorithm","type":"enum","value":"0"},{"access":"read-write","comment":"","display":"T3502","filter":"1~65535","name":"t3502","type":"int","value":"720"},{"access":"read-write","comment":"","display":"T3512","filter":"1~65535","name":"t3512","type":"int","value":"3600"},{"access":"read-write","comment":"","display":"T3513","filter":"1~65535","name":"t3513","type":"int","value":"2"},{"access":"read-write","comment":"","display":"T3522","filter":"1~65535","name":"t3522","type":"int","value":"6"},{"access":"read-write","comment":"","display":"T3550","filter":"1~65535","name":"t3550","type":"int","value":"6"},{"access":"read-write","comment":"","display":"T3555","filter":"1~65535","name":"t3555","type":"int","value":"6"},{"access":"read-write","comment":"","display":"T3560","filter":"1~65535","name":"t3560","type":"int","value":"6"},{"access":"read-write","comment":"","display":"T3565","filter":"1~65535","name":"t3565","type":"int","value":"6"},{"access":"read-write","comment":"","display":"T3570","filter":"1~65535","name":"t3570","type":"int","value":"6"}]', 1, '', 1756348212145, 'public'); +INSERT INTO "ne_config" VALUES (2, 'AMF', 'systemFeatOpt', 'Enable/Disable Features', 'list', '[{"access":"read-write","comment":"","display":"DnnCorrectionEnabled","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"dnnCorrectionEnabled","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"GutiReallocationInPRUEnabled","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"gutiReallocationInPRUEnabled","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"UeRadioCapabilityMatchEnabled","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"ueRadioCapabilityMatchEnabled","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"SupportFollowOnRequestIndication","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"supportFollowOnRequestIndication","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"TriggerInitCtxSetupForAllNASProc","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"triggerInitCtxSetupForAllNASProc","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"SupportAllAllowedNssai","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"supportAllAllowedNssai","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"ImplicitUnsubscribeEnabled","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"implicitUnsubscribeEnabled","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"SupportRRCInactiveReport","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"supportRRCInactiveReport","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"SupportMappedSecurityContext","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"supportMappedSecurityContext","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"OptimizeSignalingProcedure","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"optimizeSignalingProcedure","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"ReAuthInServiceRequestProc","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"reAuthInServiceRequestProc","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"SkipGetSubscribedNssai","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"skipGetSubscribedNssai","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"ForceIdentityRequest","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"forceIdentityRequest","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"CagEnabled","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"cagEnabled","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"CheckSliceInTaEnabled","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"checkSliceInTaEnabled","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"uePolicyEnabled","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"uePolicyEnabled","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"smsOverNasEnabled","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"smsOverNasEnabled","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"statusReportToOmc","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"statusReportToOmc","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"StatusReportEnabled","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"statusReportEnabled","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"GetTraceDataFromUdm","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"getTraceDataFromUdm","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"DisableLocationReportControl","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"disableLocationReportControl","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"SendDnnOiToSmf","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"sendDnnOiToSmf","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"UdsfEnabled","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"udsfEnabled","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"EnableHttpPprof","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"enableHttpPprof","type":"bool","value":"0"}]', 3, '', 1756348212160, 'public'); +INSERT INTO "ne_config" VALUES (3, 'AMF', 'association', 'AMF TNL Association List', 'array', '[{"access":"read-only","comment":"0~15","display":"Index","filter":"0~15","name":"index","type":"int","value":"0"},{"access":"read-write","comment":"","display":"NGAP IP","filter":"0~64","name":"ngapIp","type":"string","value":"192.168.1.183"},{"access":"read-write","comment":"0~65535","display":"NGAP SCTP Port","filter":"0~65535","name":"ngapSctpPort","type":"int","value":"38412"},{"access":"read-write","comment":"0~255","display":"Weight","filter":"0~255","name":"weightFactor","type":"int","value":"255"}]', 5, '', 1756348212166, 'self'); +INSERT INTO "ne_config" VALUES (4, 'AMF', 'guami', 'AMF Served GUAMI List', 'array', '[{"access":"read-only","comment":"0~15","display":"Index","filter":"0~15","name":"index","type":"int","value":"0"},{"access":"read-write","comment":"","display":"PLMN ID","filter":"^[0-9]{5,6}$","name":"plmnId","type":"regex","value":"00101"},{"access":"read-write","comment":"0~255","display":"Region ID","filter":"0~255","name":"regionId","type":"int","value":"1"},{"access":"read-write","comment":"0~1023","display":"Set ID","filter":"0~1023","name":"setId","type":"int","value":"1"},{"access":"read-write","comment":"0~63","display":"Pointer","filter":"0~63","name":"pointer","type":"int","value":"1"}]', 7, '', 1756348212171, 'public'); +INSERT INTO "ne_config" VALUES (5, 'AMF', 'tai', 'AMF Support TAI List', 'array', '[{"access":"read-only","comment":"Max 32","display":"Index","filter":"0-32","name":"index","type":"int","value":"0"},{"access":"read-write","comment":"MCC and MNC is less than 6 digits.","display":"PLMN ID","filter":"^[0-9]{5,6}$","name":"plmnId","type":"regex","value":"00101"},{"access":"read-write","comment":"Multiple TACs separated by commas (tac1,tac2)","display":"TAC","filter":"0-16777215","name":"tac","type":"string","value":"1"}]', 9, '', 1756348212177, 'public'); +INSERT INTO "ne_config" VALUES (6, 'AMF', 'slice', 'AMF Support Slice List', 'array', '[{"access":"read-only","comment":"0~15","display":"Index","filter":"0~15","name":"index","type":"int","value":"0"},{"access":"read-write","comment":"","display":"PLMN ID","filter":"^[0-9]{5,6}$","name":"plmnId","type":"regex","value":"00101"},{"access":"read-write","comment":"0~127","display":"SST","filter":"0~127","name":"sst","type":"int","value":"1"},{"access":"read-write","comment":"","display":"SD","filter":"^[A-Fa-f0-9]{6}","name":"sd","type":"regex","value":"000001"}]', 11, '', 1756348212183, 'public'); +INSERT INTO "ne_config" VALUES (7, 'AMF', 'whiteInfo', 'Enable Whitelist Feat', 'list', '[{"access":"read-write","comment":"if set true, need to add white list content by ''WhiteList Content'' entry ","display":"IMSI/IMEI Whitelist","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"enableWhitelist","type":"bool","value":"0"}]', 12, '', 1756348212188, 'public'); +INSERT INTO "ne_config" VALUES (8, 'AMF', 'whitelist', ' └── WhiteList Content', 'array', '[{"access":"read-only","comment":"0~65535","display":"Index","filter":"0~65535","name":"index","type":"int","value":"0"},{"access":"read-write","comment":"A.if SIM and device match, IMSI value format:[0-9]{14,15} e.g: 460020021404867 B.if only check IMEI Prefix, IMSI value set ''any''","display":"IMSI Value","filter":"^(|any|[0-9]{14,16})$","name":"imsiValue","type":"regex","value":""},{"access":"read-write","comment":"A.SIM and device match: IMEI value format:[0-9]{15,16} e.g: 8695830452209078 B.if only check IMEI Prefix, IMEI value is imei prefix value[0-9]{3-16} e.g: IMSI:''any'', IMEI:''86958304522'' )","display":"IMEI Value/Prefix","filter":"^(|any|[0-9]{2,16})$","name":"imeiValue","type":"regex","value":""}]', 13, '', 1756348212194, 'public'); +INSERT INTO "ne_config" VALUES (9, 'AMF', '4g5ghoN26Info', 'Enable 4G5GHO N26 Feat', 'list', '[{"access":"read-write","comment":"if set true, need to add MME List by ''4G5GHO Select MME List'' entry ","display":"enable iwkN26(open 4G/5G HO)","filter":"{\"0\":\"false\",\"1\":\"true\"}","name":"iwkN26","type":"bool","value":"0"},{"access":"read-write","comment":"","display":"Set AMF Local N26 IP","filter":"0~64","name":"n26Ip","type":"string","value":"192.168.1.183","visible":"self"}]', 16, '', 1756348212199, 'public'); +INSERT INTO "ne_config" VALUES (10, 'AMF', '4g5ghoMmeList', ' └── 4G5GHO Select MME List', 'array', '[{"access":"read-only","comment":"0~32","display":"Index","filter":"0~32","name":"index","type":"int","value":"0"},{"access":"read-write","comment":"\u003cMCC\u003e\u003cMNC\u003e","display":"PLMN ID","filter":"^[0-9]{5,6}$","name":"plmnId","type":"regex","value":"00101"},{"access":"read-write","comment":"","display":"Group ID","filter":"0~65535","name":"groupId","type":"int","value":"4"},{"access":"read-write","comment":"","display":"Code","filter":"0~255","name":"code","type":"int","value":"1"},{"access":"read-write","comment":"","display":"TAC","filter":"0~65535","name":"tac","type":"int","value":"4388"},{"access":"read-write","comment":"IPv4 or IPv6 address","display":"MME IP Address","filter":"^(([0-9]{1,3}\\.){3}[0-9]{1,3}|([0-9a-fA-F]{0,4}:){2,7}[0-9a-fA-F]{0,4})$","name":"ip","type":"string","value":"172.16.5.220"}]', 17, '', 1756348212204, 'public'); +INSERT INTO "ne_config" VALUES (11, 'AMF', 'gnbList', 'Gnb List Config', 'array', '[{"access":"read-only","comment":"0~128","display":"Index","filter":"0~128","name":"index","type":"int","value":"0"},{"access":"read-write","comment":"text content length 0~64","display":"GNB Name","filter":"0~64","name":"name","type":"string","value":""},{"access":"read-write","comment":"text content length 0~64","display":"GNB Address","filter":"0~64","name":"address","type":"string","value":""},{"access":"read-write","comment":"location description. Prohibition of spaces, length of text content 0-64","display":"Position","filter":"0~64","name":"position","type":"string","value":""}]', 19, '', 1756348212210, 'hide'); INSERT INTO "ne_config" VALUES (20, 'AUSF', 'system', 'System', 'list', '[{"access":"read-write","comment":"","display":"Service IP","filter":"","name":"serviceIP","type":"ipv4","value":"172.16.5.130"},{"access":"read-write","comment":"","display":"Service Port","filter":"0~65535","name":"servicePort","type":"int","value":"8080"},{"access":"read-write","comment":"","display":"Scheme","filter":"{\"0\":\"HTTP\", \"1\":\"HTTPS\"}","name":"scheme","type":"enum","value":"http"},{"access":"read-write","comment":"","display":"NRF URI","filter":"","name":"nrfUri","type":"string","value":"http://172.16.5.180:8080"},{"access":"read-write","comment":"","display":"UDM URI","filter":"","name":"udmUri","type":"string","value":"http://172.16.5.140:8080"},{"access":"read-write","comment":"","display":"Group ID","filter":"","name":"groupId","type":"string","value":"0"}]', 1, '', 1719831209173, 'public'); INSERT INTO "ne_config" VALUES (40, 'IMS', 'system', 'System', 'list', '[{"access":"read-write","comment":"","display":"Label","filter":"","name":"label","type":"string","value":"ims-core"},{"access":"read-only","comment":"","display":"HPLMN MCC","filter":"","name":"hplmnMCC","type":"string","value":"001"},{"access":"read-only","comment":"","display":"HPLMN MNC","filter":"","name":"hplmnMNC","type":"string","value":"01"},{"access":"read-write","comment":"","display":"Local Network IPv4","filter":"","name":"LocalNetworkIPv4","type":"ipv4","value":"172.16.5.110"},{"access":"read-write","comment":"","display":"Public Network IPv4","filter":"","name":"serviceIP","type":"ipv4","value":"172.16.5.110"},{"access":"read-write","comment":"","display":"Public Network IPv6","filter":"","name":"serviceIPv6","type":"ipv6","value":""},{"access":"read-only","comment":"","display":"Domain Name 1","filter":"","name":"domainName1","type":"string","value":"ims.mnc001.mcc001.3gppnetwork.org"},{"access":"read-only","comment":"","display":"Domain Name 2","filter":"","name":"domainName2","type":"string","value":""},{"access":"read-only","comment":"","display":"Domain Name 3","filter":"","name":"domainName3","type":"string","value":""},{"access":"read-only","comment":"","display":"Domain Name 4","filter":"","name":"domainName4","type":"string","value":""},{"access":"read-write","comment":"","display":"MultiIPStack Indicator","filter":"{\"0\":\"false\", \"1\":\"true\"}","name":"multiIPStackInd","type":"bool","value":"false"},{"access":"read-write","comment":"","display":"Register Timer","filter":"120~1000000","name":"registerTimer","type":"int","value":"7200"},{"access":"read-write","comment":"","display":"Max Call Duration","filter":"1800~1000000","name":"maxCallDuration","type":"int","value":"43200"},{"access":"read-write","comment":"","display":"Internal SMS Indicator","filter":"{\"0\":\"false\", \"1\":\"true\"}","name":"internalSMSInd","type":"bool","value":"false"},{"access":"read-write","comment":"","display":"Internal CDR Indicator","filter":"{\"0\":\"false\", \"1\":\"true\"}","name":"internalCDRInd","type":"bool","value":"false"},{"access":"read-write","comment":"","display":"Internal KPI Indicator","filter":"{\"0\":\"false\", \"1\":\"true\"}","name":"internalKPIInd","type":"bool","value":"false"},{"access":"read-write","comment":"","display":"PCF IP Address","filter":"","name":"pcfIP","type":"ipv4","value":"172.16.5.160"}]', 1, '', 1723716862092, 'public'); @@ -156,3 +156,15 @@ INSERT INTO "ne_config" VALUES (301, 'SGWC', 'upfConfig', 'UPF Config', 'array', INSERT INTO "ne_config" VALUES (302, 'SGWC', 'dnnSelectUpf', 'DNN Select UPF', 'array', '[{"access":"read-only","comment":"","display":"Index","filter":"0~65535","name":"index","type":"int","value":"0"},{"access":"read-write","comment":"","display":"DNN","filter":"1~64","name":"dnn","type":"string","value":""},{"access":"read-write","comment":"","display":"UPF ID","filter":"1~64","name":"upfId","type":"string","value":""}]', 5, '', 1734512800811, 'public'); INSERT INTO "ne_config" VALUES (303, 'SGWC', 'dnnTaiSelectUpf', 'DNN TAI Select UPF', 'array', '[{"access":"read-only","comment":"","display":"Index","filter":"0~65535","name":"index","type":"int","value":""},{"access":"read-write","comment":"","display":"DNN","filter":"1~64","name":"dnn","type":"string","value":""},{"access":"read-write","comment":"MCC+MNC+TAC","display":"TAI","filter":"1~64","name":"tai","type":"string","value":""},{"access":"read-write","comment":"","display":"UPF ID","filter":"1~64","name":"upfId","type":"string","value":"upf2-Id"}]', 7, '', 1734512800816, 'public'); INSERT INTO "ne_config" VALUES (304, 'SGWC', 'cdrConfig', 'Charging Data Report Config', 'list', '[{"access":"read-write","comment":"","display":"CDR Enable","filter":"","name":"enable","type":"bool","value":"false"},{"access":"read-write","comment":"","display":"CDR File Name","filter":"1~64","name":"cdrFileName","type":"string","value":"smf.cdr"},{"access":"read-write","comment":"","display":"CDR File Path","filter":"1~256","name":"cdrFilePath","type":"string","value":"/var/log/smfCdr"},{"access":"read-write","comment":"","display":"CDR File Num","filter":"1~999999999","name":"cdrFileNum","type":"int","value":"50"},{"access":"read-write","comment":"Megabytes","display":"CDR File Size","filter":"1~999999","name":"cdrFileSize","type":"int","value":"300"},{"access":"read-write","comment":"Days","display":"CDR File Max Age","filter":"0~9999","name":"cdrFileMaxAge","type":"int","value":"30"},{"access":"read-write","comment":"Seconds","display":"Time Threshold","filter":"0~999999999","name":"timeThreshold","type":"int","value":"600"},{"access":"read-write","comment":"Bytes","display":"Volume Threshold","filter":"","name":"volumeThreshold","type":"int","value":"0~999999999999999"}]', 9, '', 1734512800821, 'public'); + +-- 更新 PGWC 配置 20250828 +INSERT INTO "ne_config" VALUES (320, 'PGWC', 'pgwcSystem', 'PGWC Sytem Config', 'list', '[{"access":"read-write","comment":"","display":"Local S58 IP","filter":"","name":"s58Ip","type":"string","value":"172.16.5.151"},{"access":"read-write","comment":"","display":"N4 IPv4","filter":"","name":"n4Ipv4","type":"ipv4","value":"172.16.5.150"},{"access":"read-write","comment":"","display":"N4 IPv6","filter":"","name":"n4Ipv6","type":"ipv6","value":""},{"access":"read-write","comment":"","display":"N4U IPv4","filter":"","name":"n4UIpv4","type":"ipv4","value":""},{"access":"read-write","comment":"","display":"N4U IPv6","filter":"","name":"n4UIpv6","type":"ipv6","value":""},{"access":"read-write","comment":"","display":"Gx Policy Enable","filter":"","name":"gxEnable","type":"bool","value":""},{"access":"read-write","comment":"","display":"Gx Charging Enable","filter":"","name":"gxChargingEnable","type":"bool","value":""},{"access":"read-write","comment":"","display":"Gy Charging Enable","filter":"","name":"gyChargingEnable","type":"bool","value":""},{"access":"read-write","comment":"","display":"Primary DNS IPv4","filter":"","name":"primaryDnsIpv4","type":"ipv4","value":"114.114.114.114"},{"access":"read-write","comment":"","display":"Secondary DNS IPv4","filter":"","name":"secondaryDnsIpv4","type":"ipv4","value":""},{"access":"read-write","comment":"","display":"Primary DNS IPv6","filter":"","name":"primaryDnsIpv6","type":"ipv6","value":""},{"access":"read-write","comment":"","display":"Secondary DNS IPv6","filter":"","name":"secondaryDnsIpv6","type":"ipv6","value":""},{"access":"read-write","comment":"","display":"Primary PCSCF IPv4","filter":"","name":"primaryPcscfIpv4","type":"ipv4","value":"172.16.5.110"},{"access":"read-write","comment":"","display":"Secondary PCSCF IPv4","filter":"","name":"secondaryPcscfIpv4","type":"ipv4","value":""},{"access":"read-write","comment":"","display":"Primary PCSCF IPv6","filter":"","name":"primaryPcscfIpv6","type":"ipv6","value":""},{"access":"read-write","comment":"","display":"Secondary PCSCF IPv6","filter":"","name":"secondaryPcscfIpv6","type":"ipv6","value":""},{"access":"read-write","comment":"","display":"UE MTU","filter":"0~65535","name":"ueMtu","type":"int","value":""}]', 1, '', 1756349342126, 'public'); +INSERT INTO "ne_config" VALUES (321, 'PGWC', 'localDiameterConfig', 'Local Diameter Config', 'list', '[{"access":"read-write","comment":"","display":"Local Diameter IP","filter":"","name":"ipAddr","type":"string","value":"172.16.5.150"},{"access":"read-write","comment":"","display":"Local Diameter Host Name","filter":"","name":"hostName","type":"string","value":"pgwc.mnc001.mcc001.3gppnetwork.org"},{"access":"read-write","comment":"","display":"Local Diameter Realm Name","filter":"","name":"realmName","type":"string","value":"mnc001.mcc001.3gppnetwork.org"},{"access":"read-write","comment":"","display":"Local Gy Service Context ID","filter":"","name":"gyServiceContextId","type":"string","value":"gy@3gpp"},{"access":"read-write","comment":"","display":"Local Gx Service Context ID","filter":"","name":"gxServiceContextId","type":"string","value":"gx@3gpp"}]', 3, '', 1756349342178, 'public'); +INSERT INTO "ne_config" VALUES (322, 'PGWC', 'remoteGyCfg', 'Remote Gy Config', 'list', '[{"access":"read-write","comment":"","display":"Remote Gy Enable","filter":"","name":"enable","type":"bool","value":"false"},{"access":"read-write","comment":"e.g. ipv4:port;ipv4:port;ipv4:port","display":"Remote Gy Addresses","filter":"","name":"remoteAddrs","type":"string","value":""}]', 5, '', 1756349342184, 'public'); +INSERT INTO "ne_config" VALUES (323, 'PGWC', 'remoteGxCfg', 'Remote Gx Config', 'list', '[{"access":"read-write","comment":"","display":"Remote Gx Enable","filter":"","name":"enable","type":"bool","value":"false"},{"access":"read-write","comment":"e.g. ipv4:port;ipv4:port;ipv4:port","display":"Remote Gx Addresses","filter":"","name":"remoteAddrs","type":"string","value":""}]', 7, '', 1756349342188, 'public'); +INSERT INTO "ne_config" VALUES (324, 'PGWC', 'upfConfig', 'UPF Config', 'array', '[{"access":"read-only","comment":"","display":"Index","filter":"0~2047","name":"index","type":"int","value":""},{"access":"read-write","comment":"","display":"UPF ID","filter":"1~64","name":"id","type":"string","value":""},{"access":"read-write","comment":"e.g. ip:port","display":"Address","filter":"7~45","name":"addr","type":"string","value":""},{"access":"read-write","comment":"IPv4,IPv6,IPv4v6","display":"Ip Pool Type","filter":"","name":"ipPoolType","type":"string","value":"IPv4v6"},{"access":"read-write","comment":"CIDR format, e.g. 192.168.1.0/24","display":"IPv4 Pools","filter":"10~256","name":"ipv4Pools","type":"string","value":""},{"access":"read-write","comment":"CIDR format, e.g. fe80::20c:29ff:fee4:dab7/50","display":"IPv6 Pools","filter":"5~512","name":"ipv6Pools","type":"string","value":""},{"access":"read-write","comment":"","display":"Static IPv4 Enable","filter":"","name":"staticIpv4Enable","type":"bool","value":"false"},{"access":"read-write","comment":"ipv4 format","display":"Static IPv4 Start","filter":"","name":"staticIpv4Start","type":"ipv4","value":""},{"access":"read-write","comment":"ipv4 format","display":"Static IPv4 End","filter":"","name":"staticIpv4End","type":"ipv4","value":""},{"access":"read-write","comment":"","display":"Static IPv6 Enable","filter":"","name":"staticIpv6Enable","type":"bool","value":"false"},{"access":"read-write","comment":"ipv6 format","display":"Static IPv6 Start","filter":"","name":"staticIpv6Start","type":"ipv6","value":""},{"access":"read-write","comment":"ipv6 format","display":"Static IPv6 End","filter":"","name":"staticIpv6End","type":"ipv6","value":""},{"array":[{"access":"read-only","comment":"","display":"Index","filter":"0~2047","name":"index","type":"int","value":""},{"access":"read-write","comment":"","display":"DNN","filter":"1~64","name":"dnn","type":"string","value":""},{"access":"read-write","comment":"IPv4,IPv6,IPv4v6","display":"Ip Pool Type","filter":"","name":"ipPoolType","type":"string","value":"IPv4v6"},{"access":"read-write","comment":"CIDR format, e.g. 192.168.1.0/24","display":"IPv4 Pools","filter":"10~256","name":"ipv4Pools","type":"string","value":""},{"access":"read-write","comment":"CIDR format, e.g. fe80::20c:29ff:fee4:dab7/50","display":"IPv6 Pools","filter":"5~512","name":"ipv6Pools","type":"string","value":""},{"access":"read-write","comment":"","display":"Static IPv4 Enable","filter":"","name":"staticIpv4Enable","type":"bool","value":"false"},{"access":"read-write","comment":"ipv4 format","display":"Static IPv4 Start","filter":"","name":"staticIpv4Start","type":"ipv4","value":""},{"access":"read-write","comment":"ipv4 format","display":"Static IPv4 End","filter":"","name":"staticIpv4End","type":"ipv4","value":""},{"access":"read-write","comment":"","display":"Static IPv6 Enable","filter":"","name":"staticIpv6Enable","type":"bool","value":"false"},{"access":"read-write","comment":"ipv6 format","display":"Static IPv6 Start","filter":"","name":"staticIpv6Start","type":"ipv6","value":""},{"access":"read-write","comment":"ipv6 format","display":"Static IPv6 End","filter":"","name":"staticIpv6End","type":"ipv6","value":""}],"display":"UE DNN IP Pool","name":"ueDnnIpPool"}]', 9, '', 1756349342193, 'public'); +INSERT INTO "ne_config" VALUES (325, 'PGWC', 'dnnSelectUpf', 'DNN Select UPF', 'array', '[{"access":"read-only","comment":"","display":"Index","filter":"0~65535","name":"index","type":"int","value":"0"},{"access":"read-write","comment":"","display":"DNN","filter":"1~64","name":"dnn","type":"string","value":""},{"access":"read-write","comment":"","display":"UPF ID","filter":"1~64","name":"upfId","type":"string","value":""}]', 11, '', 1756349342198, 'public'); +INSERT INTO "ne_config" VALUES (326, 'PGWC', 'dnnTaiSelectUpf', 'DNN TAI Select UPF', 'array', '[{"access":"read-only","comment":"","display":"Index","filter":"0~65535","name":"index","type":"int","value":""},{"access":"read-write","comment":"","display":"DNN","filter":"1~64","name":"dnn","type":"string","value":""},{"access":"read-write","comment":"MCC+MNC+TAC","display":"TAI","filter":"1~64","name":"tai","type":"string","value":""},{"access":"read-write","comment":"","display":"UPF ID","filter":"1~64","name":"upfId","type":"string","value":"upf2-Id"}]', 13, '', 1756349342202, 'public'); +INSERT INTO "ne_config" VALUES (327, 'PGWC', 'localDhcpCfg', 'Local DHCP Config', 'list', '[{"access":"read-write","comment":"","display":"Enable","filter":"","name":"enable","type":"bool","value":"false"},{"access":"read-write","comment":"","display":"Local IP","filter":"","name":"localIp","type":"string","value":""}]', 15, '', 1756349342207, 'public'); +INSERT INTO "ne_config" VALUES (328, 'PGWC', 'dnnselectdhcpserver', 'DNN Select DHCP Server', 'array', '[{"access":"read-only","comment":"","display":"Index","filter":"0~65535","name":"index","type":"int","value":""},{"access":"read-write","comment":"","display":"Enable","filter":"","name":"enable","type":"bool","value":"false"},{"access":"read-write","comment":"","display":"DNN","filter":"1~64","name":"dnn","type":"string","value":""},{"access":"read-write","comment":"e.g. 192.168.1.1","display":"DHCP Server IP","filter":"","name":"dhcpServerAddr","type":"string","value":""}]', 17, '', 1756349342211, 'public'); +INSERT INTO "ne_config" VALUES (329, 'PGWC', 'offlineChargingConfig', 'Offline Charging Config', 'list', '[{"access":"read-write","comment":"","display":"CDR File Name","filter":"1~64","name":"cdrFileName","type":"string","value":"smf.cdr"},{"access":"read-write","comment":"","display":"CDR File Path","filter":"1~256","name":"cdrFilePath","type":"string","value":"/var/log/smfCdr"},{"access":"read-write","comment":"","display":"CDR File Num","filter":"1~999999999","name":"cdrFileNum","type":"int","value":"50"},{"access":"read-write","comment":"Megabytes","display":"CDR File Size","filter":"1~999999","name":"cdrFileSize","type":"int","value":"300"},{"access":"read-write","comment":"Days","display":"CDR File Max Age","filter":"0~9999","name":"cdrFileMaxAge","type":"int","value":"30"},{"access":"read-write","comment":"","display":"Free Subscribers CDR Enable","filter":"","name":"freeSubsCdrEnable","type":"bool","value":"false"},{"access":"read-write","comment":"Seconds","display":"Time Threshold","filter":"0~999999999","name":"timeThreshold","type":"int","value":"600"},{"access":"read-write","comment":"Bytes","display":"Volume Threshold","filter":"0~999999999999999","name":"volumeThreshold","type":"int","value":"0"}]', 19, '', 1756349342216, 'public'); diff --git a/build/database/std/common/ne_config.sql b/build/database/std/common/ne_config.sql index d4d6f635..bac1c46a 100644 --- a/build/database/std/common/ne_config.sql +++ b/build/database/std/common/ne_config.sql @@ -23,18 +23,18 @@ CREATE TABLE `ne_config` ( -- 初始数据对应网元 --- 更新 AMF 配置 20250630 -INSERT INTO `ne_config` VALUES (1, 'AMF', 'system', 'System Config', 'list', '[{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"AMF Name\",\"filter\":\"0~64\",\"name\":\"amfName\",\"type\":\"string\",\"value\":\"AMF\",\"visible\":\"self\"},{\"access\":\"read-write\",\"comment\":\"0~255\",\"display\":\"AMF Priority\",\"filter\":\"0~255\",\"name\":\"nfPriority\",\"type\":\"int\",\"value\":\"255\",\"visible\":\"self\"},{\"access\":\"read-write\",\"comment\":\"0~255\",\"display\":\"SBI Relative Capacity\",\"filter\":\"0~255\",\"name\":\"relativeCapacity\",\"type\":\"int\",\"value\":\"255\",\"visible\":\"self\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"SBI Scheme\",\"filter\":\"{\\\"0\\\":\\\"http\\\",\\\"1\\\":\\\"https\\\"}\",\"name\":\"sbiScheme\",\"type\":\"enum\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"SBI Server IP\",\"filter\":\"0~64\",\"name\":\"sbiServerIp\",\"type\":\"string\",\"value\":\"192.168.1.183\",\"visible\":\"self\"},{\"access\":\"read-write\",\"comment\":\"0~65535\",\"display\":\"SBI Server Port\",\"filter\":\"0~65535\",\"name\":\"sbiServerPort\",\"type\":\"int\",\"value\":\"8080\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"NRF Enabled\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"nrfEnabled\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"NF NRF URI\",\"filter\":\"0~64\",\"name\":\"nrfUri\",\"type\":\"string\",\"value\":\"http://172.16.5.180:8080\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"NF AUSF URI\",\"filter\":\"0~64\",\"name\":\"ausfUri\",\"type\":\"string\",\"value\":\"http://172.16.5.130:8080\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"NF UDM URI\",\"filter\":\"0~64\",\"name\":\"udmUri\",\"type\":\"string\",\"value\":\"http://172.16.5.140:8080\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"NF SMF URI\",\"filter\":\"0~64\",\"name\":\"smfUri\",\"type\":\"string\",\"value\":\"http://172.16.5.150:8080\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"NF PCF URI\",\"filter\":\"0~64\",\"name\":\"pcfUri\",\"type\":\"string\",\"value\":\"http://172.16.5.160:8080\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"NF Backup AUSF URI\",\"filter\":\"0~64\",\"name\":\"backupAusfUri\",\"type\":\"string\",\"value\":\"http://172.16.5.131:8080\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"NF Backup UDM URI\",\"filter\":\"0~64\",\"name\":\"backupUdmUri\",\"type\":\"string\",\"value\":\"http://172.16.5.141:8080\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"NF Backup SMF URI\",\"filter\":\"0~64\",\"name\":\"backupSmfUri\",\"type\":\"string\",\"value\":\"http://172.16.5.151:8080\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"NF Backup PCF URI\",\"filter\":\"0~64\",\"name\":\"backupPcfUri\",\"type\":\"string\",\"value\":\"http://172.16.5.161:8080\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"NF LMF URI\",\"filter\":\"0~64\",\"name\":\"lmfUri\",\"type\":\"string\",\"value\":\"http://172.16.5.200:8080\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"NF NEF URI\",\"filter\":\"0~64\",\"name\":\"nefUri\",\"type\":\"string\",\"value\":\"http://172.16.5.210:8080\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"Default DNN\",\"filter\":\"0~64\",\"name\":\"defaultDnn\",\"type\":\"string\",\"value\":\"internet\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"AUTH Integrity Algorithm\",\"filter\":\"{\\\"0\\\":\\\"NIA0\\\",\\\"1\\\":\\\"NIA1\\\",\\\"2\\\":\\\"NIA2\\\",\\\"3\\\":\\\"NIA3\\\"}\",\"name\":\"integrityAlgorithm\",\"type\":\"enum\",\"value\":\"2\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"AUTH Ciphering Algorithm\",\"filter\":\"{\\\"0\\\":\\\"NEA0\\\",\\\"1\\\":\\\"NEA1\\\",\\\"2\\\":\\\"NEA2\\\",\\\"3\\\":\\\"NEA3\\\"}\",\"name\":\"cipheringAlgorithm\",\"type\":\"enum\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"T3502\",\"filter\":\"1~65535\",\"name\":\"t3502\",\"type\":\"int\",\"value\":\"720\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"T3512\",\"filter\":\"1~65535\",\"name\":\"t3512\",\"type\":\"int\",\"value\":\"3600\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"T3513\",\"filter\":\"1~65535\",\"name\":\"t3513\",\"type\":\"int\",\"value\":\"2\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"T3522\",\"filter\":\"1~65535\",\"name\":\"t3522\",\"type\":\"int\",\"value\":\"6\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"T3550\",\"filter\":\"1~65535\",\"name\":\"t3550\",\"type\":\"int\",\"value\":\"6\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"T3555\",\"filter\":\"1~65535\",\"name\":\"t3555\",\"type\":\"int\",\"value\":\"6\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"T3560\",\"filter\":\"1~65535\",\"name\":\"t3560\",\"type\":\"int\",\"value\":\"6\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"T3565\",\"filter\":\"1~65535\",\"name\":\"t3565\",\"type\":\"int\",\"value\":\"6\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"T3570\",\"filter\":\"1~65535\",\"name\":\"t3570\",\"type\":\"int\",\"value\":\"6\"}]', 1, '', 1751271230797, 'public'); -INSERT INTO `ne_config` VALUES (2, 'AMF', 'systemFeatOpt', 'Enable/Disable Features', 'list', '[{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"DnnCorrectionEnabled\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"dnnCorrectionEnabled\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"GutiReallocationInPRUEnabled\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"gutiReallocationInPRUEnabled\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"UeRadioCapabilityMatchEnabled\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"ueRadioCapabilityMatchEnabled\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"SupportFollowOnRequestIndication\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"supportFollowOnRequestIndication\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"TriggerInitCtxSetupForAllNASProc\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"triggerInitCtxSetupForAllNASProc\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"SupportAllAllowedNssai\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"supportAllAllowedNssai\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"ImplicitUnsubscribeEnabled\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"implicitUnsubscribeEnabled\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"SupportRRCInactiveReport\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"supportRRCInactiveReport\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"SupportMappedSecurityContext\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"supportMappedSecurityContext\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"OptimizeSignalingProcedure\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"optimizeSignalingProcedure\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"ReAuthInServiceRequestProc\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"reAuthInServiceRequestProc\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"SkipGetSubscribedNssai\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"skipGetSubscribedNssai\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"ForceIdentityRequest\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"forceIdentityRequest\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"CagEnabled\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"cagEnabled\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"CheckSliceInTaEnabled\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"checkSliceInTaEnabled\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"uePolicyEnabled\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"uePolicyEnabled\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"smsOverNasEnabled\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"smsOverNasEnabled\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"statusReportToOmc\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"statusReportToOmc\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"StatusReportEnabled\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"statusReportEnabled\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"GetTraceDataFromUdm\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"getTraceDataFromUdm\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"DisableLocationReportControl\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"disableLocationReportControl\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"SendDnnOiToSmf\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"sendDnnOiToSmf\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"UdsfEnabled\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"udsfEnabled\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"EnableHttpPprof\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"enableHttpPprof\",\"type\":\"bool\",\"value\":\"0\"}]', 3, '', 1751271230825, 'public'); -INSERT INTO `ne_config` VALUES (3, 'AMF', 'association', 'AMF TNL Association List', 'array', '[{\"access\":\"read-only\",\"comment\":\"0~15\",\"display\":\"Index\",\"filter\":\"0~15\",\"name\":\"index\",\"type\":\"int\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"NGAP IP\",\"filter\":\"0~64\",\"name\":\"ngapIp\",\"type\":\"string\",\"value\":\"192.168.1.183\"},{\"access\":\"read-write\",\"comment\":\"0~65535\",\"display\":\"NGAP SCTP Port\",\"filter\":\"0~65535\",\"name\":\"ngapSctpPort\",\"type\":\"int\",\"value\":\"38412\"},{\"access\":\"read-write\",\"comment\":\"0~255\",\"display\":\"Weight\",\"filter\":\"0~255\",\"name\":\"weightFactor\",\"type\":\"int\",\"value\":\"255\"}]', 5, '', 1751271230831, 'self'); -INSERT INTO `ne_config` VALUES (4, 'AMF', 'guami', 'AMF Served GUAMI List', 'array', '[{\"access\":\"read-only\",\"comment\":\"0~15\",\"display\":\"Index\",\"filter\":\"0~15\",\"name\":\"index\",\"type\":\"int\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"PLMN ID\",\"filter\":\"^[0-9]{5,6}$\",\"name\":\"plmnId\",\"type\":\"regex\",\"value\":\"00101\"},{\"access\":\"read-write\",\"comment\":\"0~255\",\"display\":\"Region ID\",\"filter\":\"0~255\",\"name\":\"regionId\",\"type\":\"int\",\"value\":\"1\"},{\"access\":\"read-write\",\"comment\":\"0~1023\",\"display\":\"Set ID\",\"filter\":\"0~1023\",\"name\":\"setId\",\"type\":\"int\",\"value\":\"1\"},{\"access\":\"read-write\",\"comment\":\"0~63\",\"display\":\"Pointer\",\"filter\":\"0~63\",\"name\":\"pointer\",\"type\":\"int\",\"value\":\"1\"}]', 7, '', 1751271230835, 'public'); -INSERT INTO `ne_config` VALUES (5, 'AMF', 'tai', 'AMF Support TAI List', 'array', '[{\"access\":\"read-only\",\"comment\":\"0~15\",\"display\":\"Index\",\"filter\":\"0~15\",\"name\":\"index\",\"type\":\"int\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"PLMN ID\",\"filter\":\"^[0-9]{5,6}$\",\"name\":\"plmnId\",\"type\":\"regex\",\"value\":\"00101\"},{\"access\":\"read-write\",\"comment\":\"0~16777215\",\"display\":\"TAC\",\"filter\":\"0~8\",\"name\":\"tac\",\"type\":\"string\",\"value\":\"1\"}]', 9, '', 1751271230838, 'public'); -INSERT INTO `ne_config` VALUES (6, 'AMF', 'slice', 'AMF Support Slice List', 'array', '[{\"access\":\"read-only\",\"comment\":\"0~15\",\"display\":\"Index\",\"filter\":\"0~15\",\"name\":\"index\",\"type\":\"int\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"PLMN ID\",\"filter\":\"^[0-9]{5,6}$\",\"name\":\"plmnId\",\"type\":\"regex\",\"value\":\"00101\"},{\"access\":\"read-write\",\"comment\":\"0~127\",\"display\":\"SST\",\"filter\":\"0~127\",\"name\":\"sst\",\"type\":\"int\",\"value\":\"1\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"SD\",\"filter\":\"^[A-Fa-f0-9]{6}\",\"name\":\"sd\",\"type\":\"regex\",\"value\":\"000001\"}]', 11, '', 1751271230843, 'public'); -INSERT INTO `ne_config` VALUES (7, 'AMF', 'whiteInfo', 'Enable Whitelist Feat', 'list', '[{\"access\":\"read-write\",\"comment\":\"if set true, need to add white list content by \'WhiteList Content\' entry \",\"display\":\"IMSI/IMEI Whitelist\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"enableWhitelist\",\"type\":\"bool\",\"value\":\"0\"}]', 12, '', 1751271230847, 'public'); -INSERT INTO `ne_config` VALUES (8, 'AMF', 'whitelist', ' └── WhiteList Content', 'array', '[{\"access\":\"read-only\",\"comment\":\"0~65535\",\"display\":\"Index\",\"filter\":\"0~65535\",\"name\":\"index\",\"type\":\"int\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"A.if SIM and device match, IMSI value format:[0-9]{14,15} e.g: 460020021404867 B.if only check IMEI Prefix, IMSI value set \'any\'\",\"display\":\"IMSI Value\",\"filter\":\"^(|any|[0-9]{14,16})$\",\"name\":\"imsiValue\",\"type\":\"regex\",\"value\":\"\"},{\"access\":\"read-write\",\"comment\":\"A.SIM and device match: IMEI value format:[0-9]{15,16} e.g: 8695830452209078 B.if only check IMEI Prefix, IMEI value is imei prefix value[0-9]{3-16} e.g: IMSI:\'any\', IMEI:\'86958304522\' )\",\"display\":\"IMEI Value/Prefix\",\"filter\":\"^(|any|[0-9]{2,16})$\",\"name\":\"imeiValue\",\"type\":\"regex\",\"value\":\"\"}]', 13, '', 1751271230851, 'public'); -INSERT INTO `ne_config` VALUES (9, 'AMF', '4g5ghoN26Info', 'Enable 4G5GHO N26 Feat', 'list', '[{\"access\":\"read-write\",\"comment\":\"if set true, need to add MME List by \'4G5GHO Select MME List\' entry \",\"display\":\"enable iwkN26(open 4G/5G HO)\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"iwkN26\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"Set AMF Local N26 IP\",\"filter\":\"0~64\",\"name\":\"n26Ip\",\"type\":\"string\",\"value\":\"192.168.1.183\",\"visible\":\"self\"}]', 16, '', 1751271230858, 'public'); -INSERT INTO `ne_config` VALUES (10, 'AMF', '4g5ghoMmeList', ' └── 4G5GHO Select MME List', 'array', '[{\"access\":\"read-only\",\"comment\":\"0~32\",\"display\":\"Index\",\"filter\":\"0~32\",\"name\":\"index\",\"type\":\"int\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\\u003cMCC\\u003e\\u003cMNC\\u003e\",\"display\":\"PLMN ID\",\"filter\":\"^[0-9]{5,6}$\",\"name\":\"plmnId\",\"type\":\"regex\",\"value\":\"00101\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"Group ID\",\"filter\":\"0~65535\",\"name\":\"groupId\",\"type\":\"int\",\"value\":\"4\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"Code\",\"filter\":\"0~255\",\"name\":\"code\",\"type\":\"int\",\"value\":\"1\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"TAC\",\"filter\":\"0~65535\",\"name\":\"tac\",\"type\":\"int\",\"value\":\"4388\"},{\"access\":\"read-write\",\"comment\":\"IPv4 or IPv6 address\",\"display\":\"MME IP Address\",\"filter\":\"^(([0-9]{1,3}\\\\.){3}[0-9]{1,3}|([0-9a-fA-F]{0,4}:){2,7}[0-9a-fA-F]{0,4})$\",\"name\":\"ip\",\"type\":\"string\",\"value\":\"172.16.5.220\"}]', 17, '', 1751271230862, 'public'); -INSERT INTO `ne_config` VALUES (11, 'AMF', 'gnbList', 'Gnb List Config', 'array', '[{\"access\":\"read-only\",\"comment\":\"0~128\",\"display\":\"Index\",\"filter\":\"0~128\",\"name\":\"index\",\"type\":\"int\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"text content length 0~64\",\"display\":\"GNB Name\",\"filter\":\"0~64\",\"name\":\"name\",\"type\":\"string\",\"value\":\"\"},{\"access\":\"read-write\",\"comment\":\"text content length 0~64\",\"display\":\"GNB Address\",\"filter\":\"0~64\",\"name\":\"address\",\"type\":\"string\",\"value\":\"\"},{\"access\":\"read-write\",\"comment\":\"location description. Prohibition of spaces, length of text content 0-64\",\"display\":\"Position\",\"filter\":\"0~64\",\"name\":\"position\",\"type\":\"string\",\"value\":\"\"}]', 19, '', 1751271230865, 'hide'); +-- 更新 AMF 配置 20250828 +INSERT INTO `ne_config` VALUES (1, 'AMF', 'system', 'System Config', 'list', '[{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"AMF Name\",\"filter\":\"0~64\",\"name\":\"amfName\",\"type\":\"string\",\"value\":\"AMF\",\"visible\":\"self\"},{\"access\":\"read-write\",\"comment\":\"0~255\",\"display\":\"AMF Priority\",\"filter\":\"0~255\",\"name\":\"nfPriority\",\"type\":\"int\",\"value\":\"255\",\"visible\":\"self\"},{\"access\":\"read-write\",\"comment\":\"0~255\",\"display\":\"SBI Relative Capacity\",\"filter\":\"0~255\",\"name\":\"relativeCapacity\",\"type\":\"int\",\"value\":\"255\",\"visible\":\"self\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"SBI Scheme\",\"filter\":\"{\\\"0\\\":\\\"http\\\",\\\"1\\\":\\\"https\\\"}\",\"name\":\"sbiScheme\",\"type\":\"enum\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"SBI Server IP\",\"filter\":\"0~64\",\"name\":\"sbiServerIp\",\"type\":\"string\",\"value\":\"192.168.1.183\",\"visible\":\"self\"},{\"access\":\"read-write\",\"comment\":\"0~65535\",\"display\":\"SBI Server Port\",\"filter\":\"0~65535\",\"name\":\"sbiServerPort\",\"type\":\"int\",\"value\":\"8080\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"NRF Enabled\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"nrfEnabled\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"NF NRF URI\",\"filter\":\"0~64\",\"name\":\"nrfUri\",\"type\":\"string\",\"value\":\"http://172.16.5.180:8080\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"NF AUSF URI\",\"filter\":\"0~64\",\"name\":\"ausfUri\",\"type\":\"string\",\"value\":\"http://172.16.5.130:8080\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"NF UDM URI\",\"filter\":\"0~64\",\"name\":\"udmUri\",\"type\":\"string\",\"value\":\"http://172.16.5.140:8080\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"NF SMF URI\",\"filter\":\"0~64\",\"name\":\"smfUri\",\"type\":\"string\",\"value\":\"http://172.16.5.150:8080\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"NF PCF URI\",\"filter\":\"0~64\",\"name\":\"pcfUri\",\"type\":\"string\",\"value\":\"http://172.16.5.160:8080\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"NF Backup AUSF URI\",\"filter\":\"0~64\",\"name\":\"backupAusfUri\",\"type\":\"string\",\"value\":\"http://172.16.5.131:8080\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"NF Backup UDM URI\",\"filter\":\"0~64\",\"name\":\"backupUdmUri\",\"type\":\"string\",\"value\":\"http://172.16.5.141:8080\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"NF Backup SMF URI\",\"filter\":\"0~64\",\"name\":\"backupSmfUri\",\"type\":\"string\",\"value\":\"http://172.16.5.151:8080\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"NF Backup PCF URI\",\"filter\":\"0~64\",\"name\":\"backupPcfUri\",\"type\":\"string\",\"value\":\"http://172.16.5.161:8080\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"NF LMF URI\",\"filter\":\"0~64\",\"name\":\"lmfUri\",\"type\":\"string\",\"value\":\"http://172.16.5.200:8080\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"NF NEF URI\",\"filter\":\"0~64\",\"name\":\"nefUri\",\"type\":\"string\",\"value\":\"http://172.16.5.210:8080\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"Default DNN\",\"filter\":\"0~64\",\"name\":\"defaultDnn\",\"type\":\"string\",\"value\":\"internet\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"AUTH Integrity Algorithm\",\"filter\":\"{\\\"0\\\":\\\"NIA0\\\",\\\"1\\\":\\\"NIA1\\\",\\\"2\\\":\\\"NIA2\\\",\\\"3\\\":\\\"NIA3\\\"}\",\"name\":\"integrityAlgorithm\",\"type\":\"enum\",\"value\":\"2\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"AUTH Ciphering Algorithm\",\"filter\":\"{\\\"0\\\":\\\"NEA0\\\",\\\"1\\\":\\\"NEA1\\\",\\\"2\\\":\\\"NEA2\\\",\\\"3\\\":\\\"NEA3\\\"}\",\"name\":\"cipheringAlgorithm\",\"type\":\"enum\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"T3502\",\"filter\":\"1~65535\",\"name\":\"t3502\",\"type\":\"int\",\"value\":\"720\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"T3512\",\"filter\":\"1~65535\",\"name\":\"t3512\",\"type\":\"int\",\"value\":\"3600\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"T3513\",\"filter\":\"1~65535\",\"name\":\"t3513\",\"type\":\"int\",\"value\":\"2\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"T3522\",\"filter\":\"1~65535\",\"name\":\"t3522\",\"type\":\"int\",\"value\":\"6\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"T3550\",\"filter\":\"1~65535\",\"name\":\"t3550\",\"type\":\"int\",\"value\":\"6\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"T3555\",\"filter\":\"1~65535\",\"name\":\"t3555\",\"type\":\"int\",\"value\":\"6\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"T3560\",\"filter\":\"1~65535\",\"name\":\"t3560\",\"type\":\"int\",\"value\":\"6\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"T3565\",\"filter\":\"1~65535\",\"name\":\"t3565\",\"type\":\"int\",\"value\":\"6\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"T3570\",\"filter\":\"1~65535\",\"name\":\"t3570\",\"type\":\"int\",\"value\":\"6\"}]', 1, '', 1756348212145, 'public'); +INSERT INTO `ne_config` VALUES (2, 'AMF', 'systemFeatOpt', 'Enable/Disable Features', 'list', '[{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"DnnCorrectionEnabled\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"dnnCorrectionEnabled\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"GutiReallocationInPRUEnabled\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"gutiReallocationInPRUEnabled\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"UeRadioCapabilityMatchEnabled\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"ueRadioCapabilityMatchEnabled\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"SupportFollowOnRequestIndication\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"supportFollowOnRequestIndication\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"TriggerInitCtxSetupForAllNASProc\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"triggerInitCtxSetupForAllNASProc\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"SupportAllAllowedNssai\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"supportAllAllowedNssai\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"ImplicitUnsubscribeEnabled\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"implicitUnsubscribeEnabled\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"SupportRRCInactiveReport\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"supportRRCInactiveReport\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"SupportMappedSecurityContext\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"supportMappedSecurityContext\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"OptimizeSignalingProcedure\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"optimizeSignalingProcedure\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"ReAuthInServiceRequestProc\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"reAuthInServiceRequestProc\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"SkipGetSubscribedNssai\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"skipGetSubscribedNssai\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"ForceIdentityRequest\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"forceIdentityRequest\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"CagEnabled\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"cagEnabled\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"CheckSliceInTaEnabled\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"checkSliceInTaEnabled\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"uePolicyEnabled\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"uePolicyEnabled\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"smsOverNasEnabled\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"smsOverNasEnabled\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"statusReportToOmc\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"statusReportToOmc\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"StatusReportEnabled\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"statusReportEnabled\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"GetTraceDataFromUdm\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"getTraceDataFromUdm\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"DisableLocationReportControl\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"disableLocationReportControl\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"SendDnnOiToSmf\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"sendDnnOiToSmf\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"UdsfEnabled\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"udsfEnabled\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"EnableHttpPprof\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"enableHttpPprof\",\"type\":\"bool\",\"value\":\"0\"}]', 3, '', 1756348212160, 'public'); +INSERT INTO `ne_config` VALUES (3, 'AMF', 'association', 'AMF TNL Association List', 'array', '[{\"access\":\"read-only\",\"comment\":\"0~15\",\"display\":\"Index\",\"filter\":\"0~15\",\"name\":\"index\",\"type\":\"int\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"NGAP IP\",\"filter\":\"0~64\",\"name\":\"ngapIp\",\"type\":\"string\",\"value\":\"192.168.1.183\"},{\"access\":\"read-write\",\"comment\":\"0~65535\",\"display\":\"NGAP SCTP Port\",\"filter\":\"0~65535\",\"name\":\"ngapSctpPort\",\"type\":\"int\",\"value\":\"38412\"},{\"access\":\"read-write\",\"comment\":\"0~255\",\"display\":\"Weight\",\"filter\":\"0~255\",\"name\":\"weightFactor\",\"type\":\"int\",\"value\":\"255\"}]', 5, '', 1756348212166, 'self'); +INSERT INTO `ne_config` VALUES (4, 'AMF', 'guami', 'AMF Served GUAMI List', 'array', '[{\"access\":\"read-only\",\"comment\":\"0~15\",\"display\":\"Index\",\"filter\":\"0~15\",\"name\":\"index\",\"type\":\"int\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"PLMN ID\",\"filter\":\"^[0-9]{5,6}$\",\"name\":\"plmnId\",\"type\":\"regex\",\"value\":\"00101\"},{\"access\":\"read-write\",\"comment\":\"0~255\",\"display\":\"Region ID\",\"filter\":\"0~255\",\"name\":\"regionId\",\"type\":\"int\",\"value\":\"1\"},{\"access\":\"read-write\",\"comment\":\"0~1023\",\"display\":\"Set ID\",\"filter\":\"0~1023\",\"name\":\"setId\",\"type\":\"int\",\"value\":\"1\"},{\"access\":\"read-write\",\"comment\":\"0~63\",\"display\":\"Pointer\",\"filter\":\"0~63\",\"name\":\"pointer\",\"type\":\"int\",\"value\":\"1\"}]', 7, '', 1756348212171, 'public'); +INSERT INTO `ne_config` VALUES (5, 'AMF', 'tai', 'AMF Support TAI List', 'array', '[{\"access\":\"read-only\",\"comment\":\"Max 32\",\"display\":\"Index\",\"filter\":\"0-32\",\"name\":\"index\",\"type\":\"int\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"MCC and MNC is less than 6 digits.\",\"display\":\"PLMN ID\",\"filter\":\"^[0-9]{5,6}$\",\"name\":\"plmnId\",\"type\":\"regex\",\"value\":\"00101\"},{\"access\":\"read-write\",\"comment\":\"Multiple TACs separated by commas (tac1,tac2)\",\"display\":\"TAC\",\"filter\":\"0-16777215\",\"name\":\"tac\",\"type\":\"string\",\"value\":\"1\"}]', 9, '', 1756348212177, 'public'); +INSERT INTO `ne_config` VALUES (6, 'AMF', 'slice', 'AMF Support Slice List', 'array', '[{\"access\":\"read-only\",\"comment\":\"0~15\",\"display\":\"Index\",\"filter\":\"0~15\",\"name\":\"index\",\"type\":\"int\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"PLMN ID\",\"filter\":\"^[0-9]{5,6}$\",\"name\":\"plmnId\",\"type\":\"regex\",\"value\":\"00101\"},{\"access\":\"read-write\",\"comment\":\"0~127\",\"display\":\"SST\",\"filter\":\"0~127\",\"name\":\"sst\",\"type\":\"int\",\"value\":\"1\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"SD\",\"filter\":\"^[A-Fa-f0-9]{6}\",\"name\":\"sd\",\"type\":\"regex\",\"value\":\"000001\"}]', 11, '', 1756348212183, 'public'); +INSERT INTO `ne_config` VALUES (7, 'AMF', 'whiteInfo', 'Enable Whitelist Feat', 'list', '[{\"access\":\"read-write\",\"comment\":\"if set true, need to add white list content by \'WhiteList Content\' entry \",\"display\":\"IMSI/IMEI Whitelist\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"enableWhitelist\",\"type\":\"bool\",\"value\":\"0\"}]', 12, '', 1756348212188, 'public'); +INSERT INTO `ne_config` VALUES (8, 'AMF', 'whitelist', ' └── WhiteList Content', 'array', '[{\"access\":\"read-only\",\"comment\":\"0~65535\",\"display\":\"Index\",\"filter\":\"0~65535\",\"name\":\"index\",\"type\":\"int\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"A.if SIM and device match, IMSI value format:[0-9]{14,15} e.g: 460020021404867 B.if only check IMEI Prefix, IMSI value set \'any\'\",\"display\":\"IMSI Value\",\"filter\":\"^(|any|[0-9]{14,16})$\",\"name\":\"imsiValue\",\"type\":\"regex\",\"value\":\"\"},{\"access\":\"read-write\",\"comment\":\"A.SIM and device match: IMEI value format:[0-9]{15,16} e.g: 8695830452209078 B.if only check IMEI Prefix, IMEI value is imei prefix value[0-9]{3-16} e.g: IMSI:\'any\', IMEI:\'86958304522\' )\",\"display\":\"IMEI Value/Prefix\",\"filter\":\"^(|any|[0-9]{2,16})$\",\"name\":\"imeiValue\",\"type\":\"regex\",\"value\":\"\"}]', 13, '', 1756348212194, 'public'); +INSERT INTO `ne_config` VALUES (9, 'AMF', '4g5ghoN26Info', 'Enable 4G5GHO N26 Feat', 'list', '[{\"access\":\"read-write\",\"comment\":\"if set true, need to add MME List by \'4G5GHO Select MME List\' entry \",\"display\":\"enable iwkN26(open 4G/5G HO)\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"iwkN26\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"Set AMF Local N26 IP\",\"filter\":\"0~64\",\"name\":\"n26Ip\",\"type\":\"string\",\"value\":\"192.168.1.183\",\"visible\":\"self\"}]', 16, '', 1756348212199, 'public'); +INSERT INTO `ne_config` VALUES (10, 'AMF', '4g5ghoMmeList', ' └── 4G5GHO Select MME List', 'array', '[{\"access\":\"read-only\",\"comment\":\"0~32\",\"display\":\"Index\",\"filter\":\"0~32\",\"name\":\"index\",\"type\":\"int\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\\u003cMCC\\u003e\\u003cMNC\\u003e\",\"display\":\"PLMN ID\",\"filter\":\"^[0-9]{5,6}$\",\"name\":\"plmnId\",\"type\":\"regex\",\"value\":\"00101\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"Group ID\",\"filter\":\"0~65535\",\"name\":\"groupId\",\"type\":\"int\",\"value\":\"4\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"Code\",\"filter\":\"0~255\",\"name\":\"code\",\"type\":\"int\",\"value\":\"1\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"TAC\",\"filter\":\"0~65535\",\"name\":\"tac\",\"type\":\"int\",\"value\":\"4388\"},{\"access\":\"read-write\",\"comment\":\"IPv4 or IPv6 address\",\"display\":\"MME IP Address\",\"filter\":\"^(([0-9]{1,3}\\\\.){3}[0-9]{1,3}|([0-9a-fA-F]{0,4}:){2,7}[0-9a-fA-F]{0,4})$\",\"name\":\"ip\",\"type\":\"string\",\"value\":\"172.16.5.220\"}]', 17, '', 1756348212204, 'public'); +INSERT INTO `ne_config` VALUES (11, 'AMF', 'gnbList', 'Gnb List Config', 'array', '[{\"access\":\"read-only\",\"comment\":\"0~128\",\"display\":\"Index\",\"filter\":\"0~128\",\"name\":\"index\",\"type\":\"int\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"text content length 0~64\",\"display\":\"GNB Name\",\"filter\":\"0~64\",\"name\":\"name\",\"type\":\"string\",\"value\":\"\"},{\"access\":\"read-write\",\"comment\":\"text content length 0~64\",\"display\":\"GNB Address\",\"filter\":\"0~64\",\"name\":\"address\",\"type\":\"string\",\"value\":\"\"},{\"access\":\"read-write\",\"comment\":\"location description. Prohibition of spaces, length of text content 0-64\",\"display\":\"Position\",\"filter\":\"0~64\",\"name\":\"position\",\"type\":\"string\",\"value\":\"\"}]', 19, '', 1756348212210, 'hide'); INSERT INTO `ne_config` VALUES (20, 'AUSF', 'system', 'System', 'list', '[{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"Service IP\",\"filter\":\"\",\"name\":\"serviceIP\",\"type\":\"ipv4\",\"value\":\"172.16.5.130\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"Service Port\",\"filter\":\"0~65535\",\"name\":\"servicePort\",\"type\":\"int\",\"value\":\"8080\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"Scheme\",\"filter\":\"{\\\"0\\\":\\\"HTTP\\\", \\\"1\\\":\\\"HTTPS\\\"}\",\"name\":\"scheme\",\"type\":\"enum\",\"value\":\"http\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"NRF URI\",\"filter\":\"\",\"name\":\"nrfUri\",\"type\":\"string\",\"value\":\"http://172.16.5.180:8080\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"UDM URI\",\"filter\":\"\",\"name\":\"udmUri\",\"type\":\"string\",\"value\":\"http://172.16.5.140:8080\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"Group ID\",\"filter\":\"\",\"name\":\"groupId\",\"type\":\"string\",\"value\":\"0\"}]', 1, '', 1719831209173, 'public'); @@ -158,4 +158,16 @@ INSERT INTO `ne_config` VALUES (302, 'SGWC', 'dnnSelectUpf', 'DNN Select UPF', ' INSERT INTO `ne_config` VALUES (303, 'SGWC', 'dnnTaiSelectUpf', 'DNN TAI Select UPF', 'array', '[{\"access\":\"read-only\",\"comment\":\"\",\"display\":\"Index\",\"filter\":\"0~65535\",\"name\":\"index\",\"type\":\"int\",\"value\":\"\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"DNN\",\"filter\":\"1~64\",\"name\":\"dnn\",\"type\":\"string\",\"value\":\"\"},{\"access\":\"read-write\",\"comment\":\"MCC+MNC+TAC\",\"display\":\"TAI\",\"filter\":\"1~64\",\"name\":\"tai\",\"type\":\"string\",\"value\":\"\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"UPF ID\",\"filter\":\"1~64\",\"name\":\"upfId\",\"type\":\"string\",\"value\":\"upf2-Id\"}]', 7, '', 1734512800816, 'public'); INSERT INTO `ne_config` VALUES (304, 'SGWC', 'cdrConfig', 'Charging Data Report Config', 'list', '[{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"CDR Enable\",\"filter\":\"\",\"name\":\"enable\",\"type\":\"bool\",\"value\":\"false\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"CDR File Name\",\"filter\":\"1~64\",\"name\":\"cdrFileName\",\"type\":\"string\",\"value\":\"smf.cdr\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"CDR File Path\",\"filter\":\"1~256\",\"name\":\"cdrFilePath\",\"type\":\"string\",\"value\":\"/var/log/smfCdr\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"CDR File Num\",\"filter\":\"1~999999999\",\"name\":\"cdrFileNum\",\"type\":\"int\",\"value\":\"50\"},{\"access\":\"read-write\",\"comment\":\"Megabytes\",\"display\":\"CDR File Size\",\"filter\":\"1~999999\",\"name\":\"cdrFileSize\",\"type\":\"int\",\"value\":\"300\"},{\"access\":\"read-write\",\"comment\":\"Days\",\"display\":\"CDR File Max Age\",\"filter\":\"0~9999\",\"name\":\"cdrFileMaxAge\",\"type\":\"int\",\"value\":\"30\"},{\"access\":\"read-write\",\"comment\":\"Seconds\",\"display\":\"Time Threshold\",\"filter\":\"0~999999999\",\"name\":\"timeThreshold\",\"type\":\"int\",\"value\":\"600\"},{\"access\":\"read-write\",\"comment\":\"Bytes\",\"display\":\"Volume Threshold\",\"filter\":\"\",\"name\":\"volumeThreshold\",\"type\":\"int\",\"value\":\"0~999999999999999\"}]', 9, '', 1734512800821, 'public'); +-- 更新 PGWC 配置 20250828 +INSERT INTO `ne_config` VALUES (320, 'PGWC', 'pgwcSystem', 'PGWC Sytem Config', 'list', '[{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"Local S58 IP\",\"filter\":\"\",\"name\":\"s58Ip\",\"type\":\"string\",\"value\":\"172.16.5.151\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"N4 IPv4\",\"filter\":\"\",\"name\":\"n4Ipv4\",\"type\":\"ipv4\",\"value\":\"172.16.5.150\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"N4 IPv6\",\"filter\":\"\",\"name\":\"n4Ipv6\",\"type\":\"ipv6\",\"value\":\"\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"N4U IPv4\",\"filter\":\"\",\"name\":\"n4UIpv4\",\"type\":\"ipv4\",\"value\":\"\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"N4U IPv6\",\"filter\":\"\",\"name\":\"n4UIpv6\",\"type\":\"ipv6\",\"value\":\"\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"Gx Policy Enable\",\"filter\":\"\",\"name\":\"gxEnable\",\"type\":\"bool\",\"value\":\"\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"Gx Charging Enable\",\"filter\":\"\",\"name\":\"gxChargingEnable\",\"type\":\"bool\",\"value\":\"\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"Gy Charging Enable\",\"filter\":\"\",\"name\":\"gyChargingEnable\",\"type\":\"bool\",\"value\":\"\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"Primary DNS IPv4\",\"filter\":\"\",\"name\":\"primaryDnsIpv4\",\"type\":\"ipv4\",\"value\":\"114.114.114.114\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"Secondary DNS IPv4\",\"filter\":\"\",\"name\":\"secondaryDnsIpv4\",\"type\":\"ipv4\",\"value\":\"\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"Primary DNS IPv6\",\"filter\":\"\",\"name\":\"primaryDnsIpv6\",\"type\":\"ipv6\",\"value\":\"\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"Secondary DNS IPv6\",\"filter\":\"\",\"name\":\"secondaryDnsIpv6\",\"type\":\"ipv6\",\"value\":\"\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"Primary PCSCF IPv4\",\"filter\":\"\",\"name\":\"primaryPcscfIpv4\",\"type\":\"ipv4\",\"value\":\"172.16.5.110\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"Secondary PCSCF IPv4\",\"filter\":\"\",\"name\":\"secondaryPcscfIpv4\",\"type\":\"ipv4\",\"value\":\"\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"Primary PCSCF IPv6\",\"filter\":\"\",\"name\":\"primaryPcscfIpv6\",\"type\":\"ipv6\",\"value\":\"\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"Secondary PCSCF IPv6\",\"filter\":\"\",\"name\":\"secondaryPcscfIpv6\",\"type\":\"ipv6\",\"value\":\"\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"UE MTU\",\"filter\":\"0~65535\",\"name\":\"ueMtu\",\"type\":\"int\",\"value\":\"\"}]', 1, '', 1756349342126, 'public'); +INSERT INTO `ne_config` VALUES (321, 'PGWC', 'localDiameterConfig', 'Local Diameter Config', 'list', '[{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"Local Diameter IP\",\"filter\":\"\",\"name\":\"ipAddr\",\"type\":\"string\",\"value\":\"172.16.5.150\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"Local Diameter Host Name\",\"filter\":\"\",\"name\":\"hostName\",\"type\":\"string\",\"value\":\"pgwc.mnc001.mcc001.3gppnetwork.org\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"Local Diameter Realm Name\",\"filter\":\"\",\"name\":\"realmName\",\"type\":\"string\",\"value\":\"mnc001.mcc001.3gppnetwork.org\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"Local Gy Service Context ID\",\"filter\":\"\",\"name\":\"gyServiceContextId\",\"type\":\"string\",\"value\":\"gy@3gpp\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"Local Gx Service Context ID\",\"filter\":\"\",\"name\":\"gxServiceContextId\",\"type\":\"string\",\"value\":\"gx@3gpp\"}]', 3, '', 1756349342178, 'public'); +INSERT INTO `ne_config` VALUES (322, 'PGWC', 'remoteGyCfg', 'Remote Gy Config', 'list', '[{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"Remote Gy Enable\",\"filter\":\"\",\"name\":\"enable\",\"type\":\"bool\",\"value\":\"false\"},{\"access\":\"read-write\",\"comment\":\"e.g. ipv4:port;ipv4:port;ipv4:port\",\"display\":\"Remote Gy Addresses\",\"filter\":\"\",\"name\":\"remoteAddrs\",\"type\":\"string\",\"value\":\"\"}]', 5, '', 1756349342184, 'public'); +INSERT INTO `ne_config` VALUES (323, 'PGWC', 'remoteGxCfg', 'Remote Gx Config', 'list', '[{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"Remote Gx Enable\",\"filter\":\"\",\"name\":\"enable\",\"type\":\"bool\",\"value\":\"false\"},{\"access\":\"read-write\",\"comment\":\"e.g. ipv4:port;ipv4:port;ipv4:port\",\"display\":\"Remote Gx Addresses\",\"filter\":\"\",\"name\":\"remoteAddrs\",\"type\":\"string\",\"value\":\"\"}]', 7, '', 1756349342188, 'public'); +INSERT INTO `ne_config` VALUES (324, 'PGWC', 'upfConfig', 'UPF Config', 'array', '[{\"access\":\"read-only\",\"comment\":\"\",\"display\":\"Index\",\"filter\":\"0~2047\",\"name\":\"index\",\"type\":\"int\",\"value\":\"\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"UPF ID\",\"filter\":\"1~64\",\"name\":\"id\",\"type\":\"string\",\"value\":\"\"},{\"access\":\"read-write\",\"comment\":\"e.g. ip:port\",\"display\":\"Address\",\"filter\":\"7~45\",\"name\":\"addr\",\"type\":\"string\",\"value\":\"\"},{\"access\":\"read-write\",\"comment\":\"IPv4,IPv6,IPv4v6\",\"display\":\"Ip Pool Type\",\"filter\":\"\",\"name\":\"ipPoolType\",\"type\":\"string\",\"value\":\"IPv4v6\"},{\"access\":\"read-write\",\"comment\":\"CIDR format, e.g. 192.168.1.0/24\",\"display\":\"IPv4 Pools\",\"filter\":\"10~256\",\"name\":\"ipv4Pools\",\"type\":\"string\",\"value\":\"\"},{\"access\":\"read-write\",\"comment\":\"CIDR format, e.g. fe80::20c:29ff:fee4:dab7/50\",\"display\":\"IPv6 Pools\",\"filter\":\"5~512\",\"name\":\"ipv6Pools\",\"type\":\"string\",\"value\":\"\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"Static IPv4 Enable\",\"filter\":\"\",\"name\":\"staticIpv4Enable\",\"type\":\"bool\",\"value\":\"false\"},{\"access\":\"read-write\",\"comment\":\"ipv4 format\",\"display\":\"Static IPv4 Start\",\"filter\":\"\",\"name\":\"staticIpv4Start\",\"type\":\"ipv4\",\"value\":\"\"},{\"access\":\"read-write\",\"comment\":\"ipv4 format\",\"display\":\"Static IPv4 End\",\"filter\":\"\",\"name\":\"staticIpv4End\",\"type\":\"ipv4\",\"value\":\"\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"Static IPv6 Enable\",\"filter\":\"\",\"name\":\"staticIpv6Enable\",\"type\":\"bool\",\"value\":\"false\"},{\"access\":\"read-write\",\"comment\":\"ipv6 format\",\"display\":\"Static IPv6 Start\",\"filter\":\"\",\"name\":\"staticIpv6Start\",\"type\":\"ipv6\",\"value\":\"\"},{\"access\":\"read-write\",\"comment\":\"ipv6 format\",\"display\":\"Static IPv6 End\",\"filter\":\"\",\"name\":\"staticIpv6End\",\"type\":\"ipv6\",\"value\":\"\"},{\"array\":[{\"access\":\"read-only\",\"comment\":\"\",\"display\":\"Index\",\"filter\":\"0~2047\",\"name\":\"index\",\"type\":\"int\",\"value\":\"\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"DNN\",\"filter\":\"1~64\",\"name\":\"dnn\",\"type\":\"string\",\"value\":\"\"},{\"access\":\"read-write\",\"comment\":\"IPv4,IPv6,IPv4v6\",\"display\":\"Ip Pool Type\",\"filter\":\"\",\"name\":\"ipPoolType\",\"type\":\"string\",\"value\":\"IPv4v6\"},{\"access\":\"read-write\",\"comment\":\"CIDR format, e.g. 192.168.1.0/24\",\"display\":\"IPv4 Pools\",\"filter\":\"10~256\",\"name\":\"ipv4Pools\",\"type\":\"string\",\"value\":\"\"},{\"access\":\"read-write\",\"comment\":\"CIDR format, e.g. fe80::20c:29ff:fee4:dab7/50\",\"display\":\"IPv6 Pools\",\"filter\":\"5~512\",\"name\":\"ipv6Pools\",\"type\":\"string\",\"value\":\"\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"Static IPv4 Enable\",\"filter\":\"\",\"name\":\"staticIpv4Enable\",\"type\":\"bool\",\"value\":\"false\"},{\"access\":\"read-write\",\"comment\":\"ipv4 format\",\"display\":\"Static IPv4 Start\",\"filter\":\"\",\"name\":\"staticIpv4Start\",\"type\":\"ipv4\",\"value\":\"\"},{\"access\":\"read-write\",\"comment\":\"ipv4 format\",\"display\":\"Static IPv4 End\",\"filter\":\"\",\"name\":\"staticIpv4End\",\"type\":\"ipv4\",\"value\":\"\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"Static IPv6 Enable\",\"filter\":\"\",\"name\":\"staticIpv6Enable\",\"type\":\"bool\",\"value\":\"false\"},{\"access\":\"read-write\",\"comment\":\"ipv6 format\",\"display\":\"Static IPv6 Start\",\"filter\":\"\",\"name\":\"staticIpv6Start\",\"type\":\"ipv6\",\"value\":\"\"},{\"access\":\"read-write\",\"comment\":\"ipv6 format\",\"display\":\"Static IPv6 End\",\"filter\":\"\",\"name\":\"staticIpv6End\",\"type\":\"ipv6\",\"value\":\"\"}],\"display\":\"UE DNN IP Pool\",\"name\":\"ueDnnIpPool\"}]', 9, '', 1756349342193, 'public'); +INSERT INTO `ne_config` VALUES (325, 'PGWC', 'dnnSelectUpf', 'DNN Select UPF', 'array', '[{\"access\":\"read-only\",\"comment\":\"\",\"display\":\"Index\",\"filter\":\"0~65535\",\"name\":\"index\",\"type\":\"int\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"DNN\",\"filter\":\"1~64\",\"name\":\"dnn\",\"type\":\"string\",\"value\":\"\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"UPF ID\",\"filter\":\"1~64\",\"name\":\"upfId\",\"type\":\"string\",\"value\":\"\"}]', 11, '', 1756349342198, 'public'); +INSERT INTO `ne_config` VALUES (326, 'PGWC', 'dnnTaiSelectUpf', 'DNN TAI Select UPF', 'array', '[{\"access\":\"read-only\",\"comment\":\"\",\"display\":\"Index\",\"filter\":\"0~65535\",\"name\":\"index\",\"type\":\"int\",\"value\":\"\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"DNN\",\"filter\":\"1~64\",\"name\":\"dnn\",\"type\":\"string\",\"value\":\"\"},{\"access\":\"read-write\",\"comment\":\"MCC+MNC+TAC\",\"display\":\"TAI\",\"filter\":\"1~64\",\"name\":\"tai\",\"type\":\"string\",\"value\":\"\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"UPF ID\",\"filter\":\"1~64\",\"name\":\"upfId\",\"type\":\"string\",\"value\":\"upf2-Id\"}]', 13, '', 1756349342202, 'public'); +INSERT INTO `ne_config` VALUES (327, 'PGWC', 'localDhcpCfg', 'Local DHCP Config', 'list', '[{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"Enable\",\"filter\":\"\",\"name\":\"enable\",\"type\":\"bool\",\"value\":\"false\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"Local IP\",\"filter\":\"\",\"name\":\"localIp\",\"type\":\"string\",\"value\":\"\"}]', 15, '', 1756349342207, 'public'); +INSERT INTO `ne_config` VALUES (328, 'PGWC', 'dnnselectdhcpserver', 'DNN Select DHCP Server', 'array', '[{\"access\":\"read-only\",\"comment\":\"\",\"display\":\"Index\",\"filter\":\"0~65535\",\"name\":\"index\",\"type\":\"int\",\"value\":\"\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"Enable\",\"filter\":\"\",\"name\":\"enable\",\"type\":\"bool\",\"value\":\"false\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"DNN\",\"filter\":\"1~64\",\"name\":\"dnn\",\"type\":\"string\",\"value\":\"\"},{\"access\":\"read-write\",\"comment\":\"e.g. 192.168.1.1\",\"display\":\"DHCP Server IP\",\"filter\":\"\",\"name\":\"dhcpServerAddr\",\"type\":\"string\",\"value\":\"\"}]', 17, '', 1756349342211, 'public'); +INSERT INTO `ne_config` VALUES (329, 'PGWC', 'offlineChargingConfig', 'Offline Charging Config', 'list', '[{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"CDR File Name\",\"filter\":\"1~64\",\"name\":\"cdrFileName\",\"type\":\"string\",\"value\":\"smf.cdr\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"CDR File Path\",\"filter\":\"1~256\",\"name\":\"cdrFilePath\",\"type\":\"string\",\"value\":\"/var/log/smfCdr\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"CDR File Num\",\"filter\":\"1~999999999\",\"name\":\"cdrFileNum\",\"type\":\"int\",\"value\":\"50\"},{\"access\":\"read-write\",\"comment\":\"Megabytes\",\"display\":\"CDR File Size\",\"filter\":\"1~999999\",\"name\":\"cdrFileSize\",\"type\":\"int\",\"value\":\"300\"},{\"access\":\"read-write\",\"comment\":\"Days\",\"display\":\"CDR File Max Age\",\"filter\":\"0~9999\",\"name\":\"cdrFileMaxAge\",\"type\":\"int\",\"value\":\"30\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"Free Subscribers CDR Enable\",\"filter\":\"\",\"name\":\"freeSubsCdrEnable\",\"type\":\"bool\",\"value\":\"false\"},{\"access\":\"read-write\",\"comment\":\"Seconds\",\"display\":\"Time Threshold\",\"filter\":\"0~999999999\",\"name\":\"timeThreshold\",\"type\":\"int\",\"value\":\"600\"},{\"access\":\"read-write\",\"comment\":\"Bytes\",\"display\":\"Volume Threshold\",\"filter\":\"0~999999999999999\",\"name\":\"volumeThreshold\",\"type\":\"int\",\"value\":\"0\"}]', 19, '', 1756349342216, 'public'); + SET FOREIGN_KEY_CHECKS=1; diff --git a/build/database/std/install/alarm.sql b/build/database/std/install/alarm.sql index 8cda201e..e69edc6b 100644 --- a/build/database/std/install/alarm.sql +++ b/build/database/std/install/alarm.sql @@ -1,19 +1,13 @@ -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - -- ---------------------------- -- Table structure for alarm -- ---------------------------- - DROP TABLE IF EXISTS `alarm`; CREATE TABLE `alarm` ( `id` int NOT NULL AUTO_INCREMENT, - `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '网元类型', - `ne_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '网元ID', - `ne_name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元名称', - `province` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元省份地域', - `pv_flag` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元标识虚拟化标识', - `alarm_seq` int DEFAULT '0' COMMENT '告警序号 连续递增', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', + `alarm_seq` int DEFAULT '0' COMMENT '告警序号 同网元类型连续递增', `alarm_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '告警ID', `alarm_title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '告警标题', `alarm_code` int DEFAULT '0' COMMENT '告警状态码', @@ -35,12 +29,9 @@ CREATE TABLE `alarm` ( `clear_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT 'NotClear' COMMENT '清除状态', `clear_time` bigint DEFAULT '0' COMMENT '清除时间', `clear_user` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '清除用户', - `timestamp` bigint DEFAULT '0' COMMENT '创建时间', + `created_at` bigint DEFAULT '0' COMMENT '创建时间', PRIMARY KEY (`id`) USING BTREE, - UNIQUE KEY `uk_uni_ne_aid` (`ne_type`,`ne_id`,`alarm_id`) USING BTREE, - KEY `idx_status_severity_time` (`alarm_status`,`orig_severity`,`event_time`) USING BTREE + UNIQUE KEY `uk_alarm_aid_aseq_atype` (`ne_uid`, `alarm_id`, `alarm_seq`, `alarm_type`) USING BTREE COMMENT '唯一网元资源产生的ID与序号与状态', + KEY `idx_alarm_status_severity_time` (`alarm_status`,`orig_severity`,`event_time`) USING BTREE COMMENT '索引-告警状态_告警级别_事件时间', + KEY `idx_alarm_cn_uid_at` (`core_uid` DESC, `ne_uid` DESC, `created_at` DESC) USING BTREE COMMENT '索引-核心网_资源标识_记录时间' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='告警_记录表'; - -SET FOREIGN_KEY_CHECKS = 1; - --- Dump completed on 2025-02-14 15:26:56 diff --git a/build/database/std/install/alarm_event.sql b/build/database/std/install/alarm_event.sql index 984d03c1..9cf4b537 100644 --- a/build/database/std/install/alarm_event.sql +++ b/build/database/std/install/alarm_event.sql @@ -1,16 +1,13 @@ -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - -- ---------------------------- -- Table structure for alarm_event -- ---------------------------- - DROP TABLE IF EXISTS `alarm_event`; CREATE TABLE `alarm_event` ( `id` int NOT NULL AUTO_INCREMENT, - `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '网元类型', - `ne_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '网元ID', - `alarm_seq` int DEFAULT '0' COMMENT '告警序号 连续递增', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', + `alarm_seq` int DEFAULT '0' COMMENT '告警序号 同网元类型连续递增', `alarm_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '告警ID', `alarm_title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '告警标题', `alarm_code` int DEFAULT '0' COMMENT '告警状态码', @@ -26,12 +23,11 @@ CREATE TABLE `alarm_event` ( `clear_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT 'NotClear' COMMENT '清除状态', `clear_time` bigint DEFAULT '0' COMMENT '清除时间', `clear_user` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '清除用户', - `timestamp` bigint DEFAULT '0' COMMENT '创建时间', + `created_at` bigint DEFAULT '0' COMMENT '创建时间', PRIMARY KEY (`id`) USING BTREE, - UNIQUE KEY `uk_ti_aid_aseq` (`ne_type`,`ne_id`,`alarm_id`,`alarm_seq`) USING BTREE, - KEY `idx_astatus_etime` (`alarm_status`,`event_time`) USING BTREE + UNIQUE KEY `uk_aevent_aid_aseq` (`ne_uid`, `alarm_id`, `alarm_seq`) USING BTREE COMMENT '唯一网元资源产生的ID与序号与状态', + KEY `idx_aevent_status_etime` (`alarm_status`,`event_time`) USING BTREE COMMENT '索引-告警状态_事件时间', + KEY `idx_alarm_event_cn_uid_at` (`core_uid` DESC, `ne_uid` DESC, `created_at` DESC) USING BTREE COMMENT '索引-核心网_资源标识_记录时间' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='告警_事件记录表'; -SET FOREIGN_KEY_CHECKS = 1; - -- Dump completed on 2025-02-14 15:26:56 diff --git a/build/database/std/install/alarm_forward_log.sql b/build/database/std/install/alarm_forward_log.sql index 72686a10..f552f009 100644 --- a/build/database/std/install/alarm_forward_log.sql +++ b/build/database/std/install/alarm_forward_log.sql @@ -1,6 +1,3 @@ -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - -- -- Table structure for table `alarm_forward_log` -- @@ -8,9 +5,10 @@ SET FOREIGN_KEY_CHECKS = 0; DROP TABLE IF EXISTS `alarm_forward_log`; CREATE TABLE `alarm_forward_log` ( `id` int NOT NULL AUTO_INCREMENT, - `ne_type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `ne_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '', - `alarm_seq` int DEFAULT '0' COMMENT '告警序号 连续递增', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', + `alarm_seq` int DEFAULT '0' COMMENT '告警序号 同网元类型连续递增', `alarm_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '告警ID', `alarm_code` int DEFAULT '0' COMMENT '告警状态码', `alarm_title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '告警标题', @@ -22,7 +20,8 @@ CREATE TABLE `alarm_forward_log` ( `type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '转发方式 SMS/EMAIL', `target` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '发送目标用户', `result` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '发送结果', - PRIMARY KEY (`id`) USING BTREE + PRIMARY KEY (`id`) USING BTREE, + KEY `idx_alarm_forward_cn_uid_at` (`core_uid` DESC, `ne_uid` DESC, `created_at` DESC) USING BTREE COMMENT '索引-核心网_资源标识_记录时间' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='告警_转发日志记录'; SET FOREIGN_KEY_CHECKS=1; diff --git a/build/database/std/install/alarm_log.sql b/build/database/std/install/alarm_log.sql index 66239890..75f4f239 100644 --- a/build/database/std/install/alarm_log.sql +++ b/build/database/std/install/alarm_log.sql @@ -1,4 +1,3 @@ --- MariaDB dump 10.19 Distrib 10.6.16-MariaDB, for debian-linux-gnu (x86_64) -- -- Table structure for table `alarm_log` -- @@ -6,9 +5,10 @@ DROP TABLE IF EXISTS `alarm_log`; CREATE TABLE `alarm_log` ( `id` int NOT NULL AUTO_INCREMENT, - `ne_type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `ne_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '', - `alarm_seq` int DEFAULT '0' COMMENT '告警序号 连续递增', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', + `alarm_seq` int DEFAULT '0' COMMENT '告警序号 同网元类型连续递增', `alarm_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '告警ID', `alarm_code` int DEFAULT '0' COMMENT '告警状态码', `alarm_title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '告警标题', @@ -17,7 +17,8 @@ CREATE TABLE `alarm_log` ( `orig_severity` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT 'Minor' COMMENT '严重程度', `event_time` bigint DEFAULT '0' COMMENT '事件产生时间', `created_at` bigint DEFAULT '0' COMMENT '创建时间', - PRIMARY KEY (`id`) USING BTREE + PRIMARY KEY (`id`) USING BTREE, + KEY `idx_alog_cn_uid_at` (`core_uid` DESC, `ne_uid` DESC, `created_at` DESC) USING BTREE COMMENT '索引-核心网_资源标识_记录时间' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='告警_日志记录'; -- Dump completed on 2024-02-18 18:26:55 diff --git a/build/database/std/install/cdr_event.sql b/build/database/std/install/cdr_event.sql index 3dc58836..df480941 100644 --- a/build/database/std/install/cdr_event.sql +++ b/build/database/std/install/cdr_event.sql @@ -7,14 +7,14 @@ SET FOREIGN_KEY_CHECKS = 0; DROP TABLE IF EXISTS `cdr_event`; CREATE TABLE `cdr_event` ( `id` int NOT NULL AUTO_INCREMENT, - `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `ne_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `rm_uid` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', `timestamp` bigint DEFAULT '0' COMMENT '接收到的timestamp秒级存储毫秒时间戳', `cdr_json` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'data JSON String', `created_at` bigint DEFAULT '0' COMMENT '记录创建存储毫秒', PRIMARY KEY (`id`) USING BTREE, - KEY `idx_uid_t` (`rm_uid`,`timestamp`) USING BTREE + KEY `idx_cdr_cn_uid_at` (`core_uid` DESC, `ne_uid` DESC, `created_at` DESC) USING BTREE COMMENT '索引-核心网_资源标识_记录时间' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='CDR事件_基础表结构'; SET FOREIGN_KEY_CHECKS = 1; diff --git a/build/database/std/install/cdr_event_ims.sql b/build/database/std/install/cdr_event_ims.sql index 61a89b7d..21200821 100644 --- a/build/database/std/install/cdr_event_ims.sql +++ b/build/database/std/install/cdr_event_ims.sql @@ -7,14 +7,14 @@ SET FOREIGN_KEY_CHECKS = 0; DROP TABLE IF EXISTS `cdr_event_ims`; CREATE TABLE `cdr_event_ims` ( `id` int NOT NULL AUTO_INCREMENT, - `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `ne_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `rm_uid` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', `timestamp` bigint DEFAULT '0' COMMENT '接收到的timestamp秒级存储毫秒时间戳', `cdr_json` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'data JSON String', `created_at` bigint DEFAULT '0' COMMENT '记录创建存储毫秒', PRIMARY KEY (`id`) USING BTREE, - KEY `idx_ims_uid_t` (`rm_uid`,`timestamp`) USING BTREE + KEY `idx_cdr_ims_cn_uid_at` (`core_uid` DESC, `ne_uid` DESC, `created_at` DESC) USING BTREE COMMENT '索引-核心网_资源标识_记录时间' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='CDR事件_IMS'; SET FOREIGN_KEY_CHECKS = 1; diff --git a/build/database/std/install/cdr_event_sgwc.sql b/build/database/std/install/cdr_event_sgwc.sql index 948db3b1..4aa17e06 100644 --- a/build/database/std/install/cdr_event_sgwc.sql +++ b/build/database/std/install/cdr_event_sgwc.sql @@ -7,14 +7,14 @@ SET FOREIGN_KEY_CHECKS = 0; DROP TABLE IF EXISTS `cdr_event_sgwc`; CREATE TABLE `cdr_event_sgwc` ( `id` int NOT NULL AUTO_INCREMENT, - `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `ne_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `rm_uid` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', `timestamp` bigint DEFAULT '0' COMMENT '接收到的timestamp秒级存储毫秒时间戳', `cdr_json` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'data JSON String', `created_at` bigint DEFAULT '0' COMMENT '记录创建存储毫秒', PRIMARY KEY (`id`) USING BTREE, - KEY `idx_sgwc_uid_t` (`rm_uid`,`timestamp`) USING BTREE + KEY `idx_cdr_sgwc_cn_uid_at` (`core_uid` DESC, `ne_uid` DESC, `created_at` DESC) USING BTREE COMMENT '索引-核心网_资源标识_记录时间' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='CDR事件_SGWC'; SET FOREIGN_KEY_CHECKS = 1; diff --git a/build/database/std/install/cdr_event_smf.sql b/build/database/std/install/cdr_event_smf.sql index 9f84c37a..567aa9fd 100644 --- a/build/database/std/install/cdr_event_smf.sql +++ b/build/database/std/install/cdr_event_smf.sql @@ -7,14 +7,14 @@ SET FOREIGN_KEY_CHECKS = 0; DROP TABLE IF EXISTS `cdr_event_smf`; CREATE TABLE `cdr_event_smf` ( `id` int NOT NULL AUTO_INCREMENT, - `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `ne_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `rm_uid` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', `timestamp` bigint DEFAULT '0' COMMENT '接收到的timestamp秒级存储毫秒时间戳', `cdr_json` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'data JSON String', `created_at` bigint DEFAULT '0' COMMENT '记录创建存储毫秒', PRIMARY KEY (`id`) USING BTREE, - KEY `idx_smf_uid_t` (`rm_uid`,`timestamp`) USING BTREE + KEY `idx_cdr_smf_cn_uid_at` (`core_uid` DESC, `ne_uid` DESC, `created_at` DESC) USING BTREE COMMENT '索引-核心网_资源标识_记录时间' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='CDR事件_SMF'; SET FOREIGN_KEY_CHECKS = 1; diff --git a/build/database/std/install/cdr_event_smsc.sql b/build/database/std/install/cdr_event_smsc.sql index cdbd3f3d..e9fc360a 100644 --- a/build/database/std/install/cdr_event_smsc.sql +++ b/build/database/std/install/cdr_event_smsc.sql @@ -7,14 +7,14 @@ SET FOREIGN_KEY_CHECKS = 0; DROP TABLE IF EXISTS `cdr_event_smsc`; CREATE TABLE `cdr_event_smsc` ( `id` int NOT NULL AUTO_INCREMENT, - `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `ne_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `rm_uid` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', `timestamp` bigint DEFAULT '0' COMMENT '接收到的timestamp秒级存储毫秒时间戳', `cdr_json` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'data JSON String', `created_at` bigint DEFAULT '0' COMMENT '记录创建存储毫秒', PRIMARY KEY (`id`) USING BTREE, - KEY `idx_smsc_uid_t` (`rm_uid`,`timestamp`) USING BTREE + KEY `idx_cdr_smsc_cn_uid_at` (`core_uid` DESC, `ne_uid` DESC, `created_at` DESC) USING BTREE COMMENT '索引-核心网_资源标识_记录时间' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='CDR事件_SMSC'; SET FOREIGN_KEY_CHECKS = 1; diff --git a/build/database/std/install/core_info.sql b/build/database/std/install/core_info.sql index 32546d8f..89787954 100644 --- a/build/database/std/install/core_info.sql +++ b/build/database/std/install/core_info.sql @@ -8,7 +8,7 @@ CREATE TABLE `core_info` ( `name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网名称', `sn` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网序列号', `omc_id` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'OMC安装生成的唯一编码', - `time_zone` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '时区 Asia/Hong_Kong', + `time_zone` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '时区', `longitude` float DEFAULT '0' COMMENT '经度 -180 to 180', `latitude` float DEFAULT '0' COMMENT '纬度 -90 to 90', `address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '地址', @@ -21,4 +21,9 @@ CREATE TABLE `core_info` ( UNIQUE KEY `uk_core_name_sn` (`name`,`sn`) USING BTREE COMMENT '唯一名称和序号定义' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='核心网_基础信息表'; +-- ---------------------------- +-- Records of core_info +-- ---------------------------- +INSERT INTO `core_info` VALUES (1, 'YYMMDDHH', 'Default', '12345678', 'Omachine', '', 0, 0, '', '', 'admin', 1755863386664, 'admin', 1755863386664); + -- Dump completed on 2025-06-04 15:26:56 diff --git a/build/database/std/install/kpi_c_report.sql b/build/database/std/install/kpi_c_report.sql index 51728a56..423836a4 100644 --- a/build/database/std/install/kpi_c_report.sql +++ b/build/database/std/install/kpi_c_report.sql @@ -7,9 +7,9 @@ SET FOREIGN_KEY_CHECKS = 0; DROP TABLE IF EXISTS `kpi_c_report`; CREATE TABLE `kpi_c_report` ( `id` int NOT NULL AUTO_INCREMENT, - `ne_type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `ne_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `rm_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', `date` varchar(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Date of the report yyyy-mm-dd hh:mi:ss', `start_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'Start time of the report hh:mi:ss', `end_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'End time of the report hh:mi:ss', @@ -18,7 +18,7 @@ CREATE TABLE `kpi_c_report` ( `kpi_values` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT 'KPI values JSON String', `created_at` bigint DEFAULT '0' COMMENT 'Creation time 接收到的timestamp秒级存储毫秒时间戳', PRIMARY KEY (`id`) USING BTREE, - KEY `idx_c_uid_at` (`rm_uid`,`created_at`) USING BTREE + KEY `idx_kpic_cn_uid_at` (`core_uid` DESC, `ne_uid` DESC, `created_at` DESC) USING BTREE COMMENT '索引-核心网_资源标识_创建时间' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='KPI_自定义指标数据记录基础表结构'; SET FOREIGN_KEY_CHECKS = 1; diff --git a/build/database/std/install/kpi_c_report_amf.sql b/build/database/std/install/kpi_c_report_amf.sql index 0372832c..85e4d195 100644 --- a/build/database/std/install/kpi_c_report_amf.sql +++ b/build/database/std/install/kpi_c_report_amf.sql @@ -1,15 +1,12 @@ -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - -- ---------------------------- -- Table structure for kpi_c_report_amf -- ---------------------------- DROP TABLE IF EXISTS `kpi_c_report_amf`; CREATE TABLE `kpi_c_report_amf` ( `id` int NOT NULL AUTO_INCREMENT, - `ne_type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `ne_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `rm_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', `date` varchar(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Date of the report yyyy-mm-dd hh:mi:ss', `start_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'Start time of the report hh:mi:ss', `end_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'End time of the report hh:mi:ss', @@ -18,7 +15,5 @@ CREATE TABLE `kpi_c_report_amf` ( `kpi_values` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT 'KPI values JSON String', `created_at` bigint DEFAULT '0' COMMENT 'Creation time 接收到的timestamp秒级存储毫秒时间戳', PRIMARY KEY (`id`) USING BTREE, - KEY `idx_c_amf_uid_at` (`rm_uid`,`created_at`) USING BTREE + KEY `idx_kpic_amf_cn_uid_at` (`core_uid` DESC, `ne_uid` DESC, `created_at` DESC) USING BTREE COMMENT '索引-核心网_资源标识_创建时间' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='KPI_自定义指标数据_AMF'; - -SET FOREIGN_KEY_CHECKS = 1; diff --git a/build/database/std/install/kpi_c_report_ausf.sql b/build/database/std/install/kpi_c_report_ausf.sql index 9ecf25ee..55e212ea 100644 --- a/build/database/std/install/kpi_c_report_ausf.sql +++ b/build/database/std/install/kpi_c_report_ausf.sql @@ -1,15 +1,12 @@ -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - -- ---------------------------- -- Table structure for kpi_c_report_ausf -- ---------------------------- DROP TABLE IF EXISTS `kpi_c_report_ausf`; CREATE TABLE `kpi_c_report_ausf` ( `id` int NOT NULL AUTO_INCREMENT, - `ne_type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `ne_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `rm_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', `date` varchar(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Date of the report yyyy-mm-dd hh:mi:ss', `start_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'Start time of the report hh:mi:ss', `end_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'End time of the report hh:mi:ss', @@ -18,7 +15,5 @@ CREATE TABLE `kpi_c_report_ausf` ( `kpi_values` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT 'KPI values JSON String', `created_at` bigint DEFAULT '0' COMMENT 'Creation time 接收到的timestamp秒级存储毫秒时间戳', PRIMARY KEY (`id`) USING BTREE, - KEY `idx_c_ausf_uid_at` (`rm_uid`,`created_at`) USING BTREE + KEY `idx_kpic_ausf_cn_uid_at` (`core_uid` DESC, `ne_uid` DESC, `created_at` DESC) USING BTREE COMMENT '索引-核心网_资源标识_创建时间' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='KPI_自定义指标数据_AUSF'; - -SET FOREIGN_KEY_CHECKS = 1; diff --git a/build/database/std/install/kpi_c_report_cbc.sql b/build/database/std/install/kpi_c_report_cbc.sql index cc24a082..7bd8dd57 100644 --- a/build/database/std/install/kpi_c_report_cbc.sql +++ b/build/database/std/install/kpi_c_report_cbc.sql @@ -1,15 +1,12 @@ -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - -- ---------------------------- -- Table structure for kpi_c_report_cbc -- ---------------------------- DROP TABLE IF EXISTS `kpi_c_report_cbc`; CREATE TABLE `kpi_c_report_cbc` ( `id` int NOT NULL AUTO_INCREMENT, - `ne_type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `ne_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `rm_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', `date` varchar(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Date of the report yyyy-mm-dd hh:mi:ss', `start_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'Start time of the report hh:mi:ss', `end_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'End time of the report hh:mi:ss', @@ -18,7 +15,5 @@ CREATE TABLE `kpi_c_report_cbc` ( `kpi_values` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT 'KPI values JSON String', `created_at` bigint DEFAULT '0' COMMENT 'Creation time 接收到的timestamp秒级存储毫秒时间戳', PRIMARY KEY (`id`) USING BTREE, - KEY `idx_c_cbc_uid_at` (`rm_uid`,`created_at`) USING BTREE + KEY `idx_kpic_cbc_cn_uid_at` (`core_uid` DESC, `ne_uid` DESC, `created_at` DESC) USING BTREE COMMENT '索引-核心网_资源标识_创建时间' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='KPI_自定义指标数据_CBC'; - -SET FOREIGN_KEY_CHECKS = 1; diff --git a/build/database/std/install/kpi_c_report_hlr.sql b/build/database/std/install/kpi_c_report_hlr.sql index 4716ae0d..d4df9ecc 100644 --- a/build/database/std/install/kpi_c_report_hlr.sql +++ b/build/database/std/install/kpi_c_report_hlr.sql @@ -1,15 +1,12 @@ -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - -- ---------------------------- -- Table structure for kpi_c_report_hlr -- ---------------------------- DROP TABLE IF EXISTS `kpi_c_report_hlr`; CREATE TABLE `kpi_c_report_hlr` ( `id` int NOT NULL AUTO_INCREMENT, - `ne_type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `ne_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `rm_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', `date` varchar(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Date of the report yyyy-mm-dd hh:mi:ss', `start_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'Start time of the report hh:mi:ss', `end_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'End time of the report hh:mi:ss', @@ -18,7 +15,5 @@ CREATE TABLE `kpi_c_report_hlr` ( `kpi_values` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT 'KPI values JSON String', `created_at` bigint DEFAULT '0' COMMENT 'Creation time 接收到的timestamp秒级存储毫秒时间戳', PRIMARY KEY (`id`) USING BTREE, - KEY `idx_c_hlr_uid_at` (`rm_uid`,`created_at`) USING BTREE + KEY `idx_kpic_hlr_cn_uid_at` (`core_uid` DESC, `ne_uid` DESC, `created_at` DESC) USING BTREE COMMENT '索引-核心网_资源标识_创建时间' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='KPI_自定义指标数据_HLR'; - -SET FOREIGN_KEY_CHECKS = 1; diff --git a/build/database/std/install/kpi_c_report_ims.sql b/build/database/std/install/kpi_c_report_ims.sql index 4280d221..c831bc78 100644 --- a/build/database/std/install/kpi_c_report_ims.sql +++ b/build/database/std/install/kpi_c_report_ims.sql @@ -1,15 +1,12 @@ -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - -- ---------------------------- -- Table structure for kpi_c_report_ims -- ---------------------------- DROP TABLE IF EXISTS `kpi_c_report_ims`; CREATE TABLE `kpi_c_report_ims` ( `id` int NOT NULL AUTO_INCREMENT, - `ne_type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `ne_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `rm_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', `date` varchar(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Date of the report yyyy-mm-dd hh:mi:ss', `start_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'Start time of the report hh:mi:ss', `end_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'End time of the report hh:mi:ss', @@ -18,7 +15,5 @@ CREATE TABLE `kpi_c_report_ims` ( `kpi_values` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT 'KPI values JSON String', `created_at` bigint DEFAULT '0' COMMENT 'Creation time 接收到的timestamp秒级存储毫秒时间戳', PRIMARY KEY (`id`) USING BTREE, - KEY `idx_c_ims_uid_at` (`rm_uid`,`created_at`) USING BTREE + KEY `idx_kpic_ims_cn_uid_at` (`core_uid` DESC, `ne_uid` DESC, `created_at` DESC) USING BTREE COMMENT '索引-核心网_资源标识_创建时间' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='KPI_自定义指标数据_IMS'; - -SET FOREIGN_KEY_CHECKS = 1; diff --git a/build/database/std/install/kpi_c_report_mme.sql b/build/database/std/install/kpi_c_report_mme.sql index 0e9fdb68..9567f89e 100644 --- a/build/database/std/install/kpi_c_report_mme.sql +++ b/build/database/std/install/kpi_c_report_mme.sql @@ -1,15 +1,12 @@ -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - -- ---------------------------- -- Table structure for kpi_c_report_mme -- ---------------------------- DROP TABLE IF EXISTS `kpi_c_report_mme`; CREATE TABLE `kpi_c_report_mme` ( `id` int NOT NULL AUTO_INCREMENT, - `ne_type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `ne_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `rm_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', `date` varchar(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Date of the report yyyy-mm-dd hh:mi:ss', `start_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'Start time of the report hh:mi:ss', `end_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'End time of the report hh:mi:ss', @@ -18,7 +15,5 @@ CREATE TABLE `kpi_c_report_mme` ( `kpi_values` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT 'KPI values JSON String', `created_at` bigint DEFAULT '0' COMMENT 'Creation time 接收到的timestamp秒级存储毫秒时间戳', PRIMARY KEY (`id`) USING BTREE, - KEY `idx_c_mme_uid_at` (`rm_uid`,`created_at`) USING BTREE + KEY `idx_kpic_mme_cn_uid_at` (`core_uid` DESC, `ne_uid` DESC, `created_at` DESC) USING BTREE COMMENT '索引-核心网_资源标识_创建时间' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='KPI_自定义指标数据_MME'; - -SET FOREIGN_KEY_CHECKS = 1; diff --git a/build/database/std/install/kpi_c_report_mocngw.sql b/build/database/std/install/kpi_c_report_mocngw.sql index 21635fc3..8803a036 100644 --- a/build/database/std/install/kpi_c_report_mocngw.sql +++ b/build/database/std/install/kpi_c_report_mocngw.sql @@ -1,15 +1,12 @@ -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - -- ---------------------------- -- Table structure for kpi_c_report_mocngw -- ---------------------------- DROP TABLE IF EXISTS `kpi_c_report_mocngw`; CREATE TABLE `kpi_c_report_mocngw` ( `id` int NOT NULL AUTO_INCREMENT, - `ne_type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `ne_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `rm_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', `date` varchar(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Date of the report yyyy-mm-dd hh:mi:ss', `start_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'Start time of the report hh:mi:ss', `end_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'End time of the report hh:mi:ss', @@ -18,7 +15,5 @@ CREATE TABLE `kpi_c_report_mocngw` ( `kpi_values` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT 'KPI values JSON String', `created_at` bigint DEFAULT '0' COMMENT 'Creation time 接收到的timestamp秒级存储毫秒时间戳', PRIMARY KEY (`id`) USING BTREE, - KEY `idx_c_mocngw_uid_at` (`rm_uid`,`created_at`) USING BTREE + KEY `idx_kpic_mocngw_cn_uid_at` (`core_uid` DESC, `ne_uid` DESC, `created_at` DESC) USING BTREE COMMENT '索引-核心网_资源标识_创建时间' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='KPI_自定义指标数据_MOCNGW'; - -SET FOREIGN_KEY_CHECKS = 1; diff --git a/build/database/std/install/kpi_c_report_nssf.sql b/build/database/std/install/kpi_c_report_nssf.sql index edb5e694..5c7002be 100644 --- a/build/database/std/install/kpi_c_report_nssf.sql +++ b/build/database/std/install/kpi_c_report_nssf.sql @@ -1,15 +1,12 @@ -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - -- ---------------------------- -- Table structure for kpi_c_report_nssf -- ---------------------------- DROP TABLE IF EXISTS `kpi_c_report_nssf`; CREATE TABLE `kpi_c_report_nssf` ( `id` int NOT NULL AUTO_INCREMENT, - `ne_type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `ne_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `rm_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', `date` varchar(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Date of the report yyyy-mm-dd hh:mi:ss', `start_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'Start time of the report hh:mi:ss', `end_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'End time of the report hh:mi:ss', @@ -18,7 +15,5 @@ CREATE TABLE `kpi_c_report_nssf` ( `kpi_values` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT 'KPI values JSON String', `created_at` bigint DEFAULT '0' COMMENT 'Creation time 接收到的timestamp秒级存储毫秒时间戳', PRIMARY KEY (`id`) USING BTREE, - KEY `idx_c_nssf_uid_at` (`rm_uid`,`created_at`) USING BTREE + KEY `idx_kpic_nssf_cn_uid_at` (`core_uid` DESC, `ne_uid` DESC, `created_at` DESC) USING BTREE COMMENT '索引-核心网_资源标识_创建时间' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='KPI_自定义指标数据_NSSF'; - -SET FOREIGN_KEY_CHECKS = 1; diff --git a/build/database/std/install/kpi_c_report_pcf.sql b/build/database/std/install/kpi_c_report_pcf.sql index 8b2632d1..6ebb6b39 100644 --- a/build/database/std/install/kpi_c_report_pcf.sql +++ b/build/database/std/install/kpi_c_report_pcf.sql @@ -1,15 +1,12 @@ -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - -- ---------------------------- -- Table structure for kpi_c_report_pcf -- ---------------------------- DROP TABLE IF EXISTS `kpi_c_report_pcf`; CREATE TABLE `kpi_c_report_pcf` ( `id` int NOT NULL AUTO_INCREMENT, - `ne_type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `ne_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `rm_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', `date` varchar(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Date of the report yyyy-mm-dd hh:mi:ss', `start_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'Start time of the report hh:mi:ss', `end_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'End time of the report hh:mi:ss', @@ -18,7 +15,5 @@ CREATE TABLE `kpi_c_report_pcf` ( `kpi_values` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT 'KPI values JSON String', `created_at` bigint DEFAULT '0' COMMENT 'Creation time 接收到的timestamp秒级存储毫秒时间戳', PRIMARY KEY (`id`) USING BTREE, - KEY `idx_c_pcf_uid_at` (`rm_uid`,`created_at`) USING BTREE + KEY `idx_kpic_pcf_cn_uid_at` (`core_uid` DESC, `ne_uid` DESC, `created_at` DESC) USING BTREE COMMENT '索引-核心网_资源标识_创建时间' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='KPI_自定义指标数据_PCF'; - -SET FOREIGN_KEY_CHECKS = 1; diff --git a/build/database/std/install/kpi_c_report_smf.sql b/build/database/std/install/kpi_c_report_smf.sql index 4d811013..91514dfe 100644 --- a/build/database/std/install/kpi_c_report_smf.sql +++ b/build/database/std/install/kpi_c_report_smf.sql @@ -1,15 +1,12 @@ -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - -- ---------------------------- -- Table structure for kpi_c_report_smf -- ---------------------------- DROP TABLE IF EXISTS `kpi_c_report_smf`; CREATE TABLE `kpi_c_report_smf` ( `id` int NOT NULL AUTO_INCREMENT, - `ne_type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `ne_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `rm_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', `date` varchar(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Date of the report yyyy-mm-dd hh:mi:ss', `start_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'Start time of the report hh:mi:ss', `end_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'End time of the report hh:mi:ss', @@ -18,7 +15,5 @@ CREATE TABLE `kpi_c_report_smf` ( `kpi_values` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT 'KPI values JSON String', `created_at` bigint DEFAULT '0' COMMENT 'Creation time 接收到的timestamp秒级存储毫秒时间戳', PRIMARY KEY (`id`) USING BTREE, - KEY `idx_c_smf_uid_at` (`rm_uid`,`created_at`) USING BTREE + KEY `idx_kpic_smf_cn_uid_at` (`core_uid` DESC, `ne_uid` DESC, `created_at` DESC) USING BTREE COMMENT '索引-核心网_资源标识_创建时间' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='KPI_自定义指标数据_SMF'; - -SET FOREIGN_KEY_CHECKS = 1; diff --git a/build/database/std/install/kpi_c_report_smsc.sql b/build/database/std/install/kpi_c_report_smsc.sql index a4751294..188673f3 100644 --- a/build/database/std/install/kpi_c_report_smsc.sql +++ b/build/database/std/install/kpi_c_report_smsc.sql @@ -1,15 +1,12 @@ -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - -- ---------------------------- -- Table structure for kpi_c_report_smsc -- ---------------------------- DROP TABLE IF EXISTS `kpi_c_report_smsc`; CREATE TABLE `kpi_c_report_smsc` ( `id` int NOT NULL AUTO_INCREMENT, - `ne_type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `ne_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `rm_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', `date` varchar(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Date of the report yyyy-mm-dd hh:mi:ss', `start_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'Start time of the report hh:mi:ss', `end_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'End time of the report hh:mi:ss', @@ -18,7 +15,5 @@ CREATE TABLE `kpi_c_report_smsc` ( `kpi_values` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT 'KPI values JSON String', `created_at` bigint DEFAULT '0' COMMENT 'Creation time 接收到的timestamp秒级存储毫秒时间戳', PRIMARY KEY (`id`) USING BTREE, - KEY `idx_c_smsc_uid_at` (`rm_uid`,`created_at`) USING BTREE + KEY `idx_kpic_smsc_cn_uid_at` (`core_uid` DESC, `ne_uid` DESC, `created_at` DESC) USING BTREE COMMENT '索引-核心网_资源标识_创建时间' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='KPI_自定义指标数据_SMSC'; - -SET FOREIGN_KEY_CHECKS = 1; diff --git a/build/database/std/install/kpi_c_report_udm.sql b/build/database/std/install/kpi_c_report_udm.sql index 676ad803..f6d29765 100644 --- a/build/database/std/install/kpi_c_report_udm.sql +++ b/build/database/std/install/kpi_c_report_udm.sql @@ -1,15 +1,12 @@ -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - -- ---------------------------- -- Table structure for kpi_c_report_udm -- ---------------------------- DROP TABLE IF EXISTS `kpi_c_report_udm`; CREATE TABLE `kpi_c_report_udm` ( `id` int NOT NULL AUTO_INCREMENT, - `ne_type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `ne_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `rm_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', `date` varchar(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Date of the report yyyy-mm-dd hh:mi:ss', `start_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'Start time of the report hh:mi:ss', `end_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'End time of the report hh:mi:ss', @@ -18,7 +15,5 @@ CREATE TABLE `kpi_c_report_udm` ( `kpi_values` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT 'KPI values JSON String', `created_at` bigint DEFAULT '0' COMMENT 'Creation time 接收到的timestamp秒级存储毫秒时间戳', PRIMARY KEY (`id`) USING BTREE, - KEY `idx_c_udm_uid_at` (`rm_uid`,`created_at`) USING BTREE + KEY `idx_kpic_udm_cn_uid_at` (`core_uid` DESC, `ne_uid` DESC, `created_at` DESC) USING BTREE COMMENT '索引-核心网_资源标识_创建时间' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='KPI_自定义指标数据_UDM'; - -SET FOREIGN_KEY_CHECKS = 1; diff --git a/build/database/std/install/kpi_c_report_upf.sql b/build/database/std/install/kpi_c_report_upf.sql index 1a2c4682..3996ba8b 100644 --- a/build/database/std/install/kpi_c_report_upf.sql +++ b/build/database/std/install/kpi_c_report_upf.sql @@ -1,15 +1,12 @@ -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - -- ---------------------------- -- Table structure for kpi_c_report_upf -- ---------------------------- DROP TABLE IF EXISTS `kpi_c_report_upf`; CREATE TABLE `kpi_c_report_upf` ( `id` int NOT NULL AUTO_INCREMENT, - `ne_type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `ne_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `rm_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', `date` varchar(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Date of the report yyyy-mm-dd hh:mi:ss', `start_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'Start time of the report hh:mi:ss', `end_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'End time of the report hh:mi:ss', @@ -18,7 +15,5 @@ CREATE TABLE `kpi_c_report_upf` ( `kpi_values` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT 'KPI values JSON String', `created_at` bigint DEFAULT '0' COMMENT 'Creation time 接收到的timestamp秒级存储毫秒时间戳', PRIMARY KEY (`id`) USING BTREE, - KEY `idx_c_upf_uid_at` (`rm_uid`,`created_at`) USING BTREE + KEY `idx_kpic_upf_cn_uid_at` (`core_uid` DESC, `ne_uid` DESC, `created_at` DESC) USING BTREE COMMENT '索引-核心网_资源标识_创建时间' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='KPI_自定义指标数据_UPF'; - -SET FOREIGN_KEY_CHECKS = 1; diff --git a/build/database/std/install/kpi_report.sql b/build/database/std/install/kpi_report.sql index c1e32f3e..cbc73334 100644 --- a/build/database/std/install/kpi_report.sql +++ b/build/database/std/install/kpi_report.sql @@ -1,15 +1,12 @@ -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - -- ---------------------------- -- Table structure for kpi_report -- ---------------------------- DROP TABLE IF EXISTS `kpi_report`; CREATE TABLE `kpi_report` ( `id` int NOT NULL AUTO_INCREMENT, - `ne_type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `ne_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `rm_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', `date` varchar(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Date of the report yyyy-mm-dd hh:mi:ss', `start_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'Start time of the report hh:mi:ss', `end_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'End time of the report hh:mi:ss', @@ -18,7 +15,5 @@ CREATE TABLE `kpi_report` ( `kpi_values` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT 'KPI values JSON String', `created_at` bigint DEFAULT '0' COMMENT 'Creation time 接收到的timestamp秒级存储毫秒时间戳', PRIMARY KEY (`id`) USING BTREE, - KEY `idx_uid_at` (`rm_uid`,`created_at`) USING BTREE + KEY `idx_kpi_cn_uid_at` (`core_uid` DESC, `ne_uid` DESC, `created_at` DESC) USING BTREE COMMENT '索引-核心网_资源标识_记录时间' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='KPI_指标数据记录基础表'; - -SET FOREIGN_KEY_CHECKS = 1; diff --git a/build/database/std/install/kpi_report_amf.sql b/build/database/std/install/kpi_report_amf.sql index a73c8804..ecd5752c 100644 --- a/build/database/std/install/kpi_report_amf.sql +++ b/build/database/std/install/kpi_report_amf.sql @@ -1,15 +1,12 @@ -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - -- ---------------------------- -- Table structure for kpi_report_amf -- ---------------------------- DROP TABLE IF EXISTS `kpi_report_amf`; CREATE TABLE `kpi_report_amf` ( `id` int NOT NULL AUTO_INCREMENT, - `ne_type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `ne_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `rm_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', `date` varchar(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Date of the report yyyy-mm-dd hh:mi:ss', `start_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'Start time of the report hh:mi:ss', `end_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'End time of the report hh:mi:ss', @@ -18,7 +15,5 @@ CREATE TABLE `kpi_report_amf` ( `kpi_values` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT 'KPI values JSON String', `created_at` bigint DEFAULT '0' COMMENT 'Creation time 接收到的timestamp秒级存储毫秒时间戳', PRIMARY KEY (`id`) USING BTREE, - KEY `idx_amf_uid_at` (`rm_uid`,`created_at`) USING BTREE + KEY `idx_kpi_amf_cn_uid_at` (`core_uid` DESC, `ne_uid` DESC, `created_at` DESC) USING BTREE COMMENT '索引-核心网_资源标识_记录时间' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='KPI_指标数据_AMF'; - -SET FOREIGN_KEY_CHECKS = 1; diff --git a/build/database/std/install/kpi_report_ausf.sql b/build/database/std/install/kpi_report_ausf.sql index 9013115c..6c6a736c 100644 --- a/build/database/std/install/kpi_report_ausf.sql +++ b/build/database/std/install/kpi_report_ausf.sql @@ -1,15 +1,12 @@ -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - -- ---------------------------- -- Table structure for kpi_report_ausf -- ---------------------------- DROP TABLE IF EXISTS `kpi_report_ausf`; CREATE TABLE `kpi_report_ausf` ( `id` int NOT NULL AUTO_INCREMENT, - `ne_type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `ne_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `rm_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', `date` varchar(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Date of the report yyyy-mm-dd hh:mi:ss', `start_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'Start time of the report hh:mi:ss', `end_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'End time of the report hh:mi:ss', @@ -18,7 +15,5 @@ CREATE TABLE `kpi_report_ausf` ( `kpi_values` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT 'KPI values JSON String', `created_at` bigint DEFAULT '0' COMMENT 'Creation time 接收到的timestamp秒级存储毫秒时间戳', PRIMARY KEY (`id`) USING BTREE, - KEY `idx_ausf_uid_at` (`rm_uid`,`created_at`) USING BTREE + KEY `idx_kpi_ausf_cn_uid_at` (`core_uid` DESC, `ne_uid` DESC, `created_at` DESC) USING BTREE COMMENT '索引-核心网_资源标识_记录时间' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='KPI_指标数据_AUSF'; - -SET FOREIGN_KEY_CHECKS = 1; diff --git a/build/database/std/install/kpi_report_cbc.sql b/build/database/std/install/kpi_report_cbc.sql index 5faac6cf..95f8f676 100644 --- a/build/database/std/install/kpi_report_cbc.sql +++ b/build/database/std/install/kpi_report_cbc.sql @@ -1,15 +1,12 @@ -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - -- ---------------------------- -- Table structure for kpi_report_cbc -- ---------------------------- DROP TABLE IF EXISTS `kpi_report_cbc`; CREATE TABLE `kpi_report_cbc` ( `id` int NOT NULL AUTO_INCREMENT, - `ne_type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `ne_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `rm_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', `date` varchar(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Date of the report yyyy-mm-dd hh:mi:ss', `start_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'Start time of the report hh:mi:ss', `end_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'End time of the report hh:mi:ss', @@ -18,7 +15,5 @@ CREATE TABLE `kpi_report_cbc` ( `kpi_values` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT 'KPI values JSON String', `created_at` bigint DEFAULT '0' COMMENT 'Creation time 接收到的timestamp秒级存储毫秒时间戳', PRIMARY KEY (`id`) USING BTREE, - KEY `idx_cbc_uid_at` (`rm_uid`,`created_at`) USING BTREE + KEY `idx_kpi_cbc_cn_uid_at` (`core_uid` DESC, `ne_uid` DESC, `created_at` DESC) USING BTREE COMMENT '索引-核心网_资源标识_记录时间' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='KPI_指标数据_CBC'; - -SET FOREIGN_KEY_CHECKS = 1; diff --git a/build/database/std/install/kpi_report_hlr.sql b/build/database/std/install/kpi_report_hlr.sql index 48e101e0..22c42269 100644 --- a/build/database/std/install/kpi_report_hlr.sql +++ b/build/database/std/install/kpi_report_hlr.sql @@ -1,15 +1,12 @@ -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - -- ---------------------------- -- Table structure for kpi_report_hlr -- ---------------------------- DROP TABLE IF EXISTS `kpi_report_hlr`; CREATE TABLE `kpi_report_hlr` ( `id` int NOT NULL AUTO_INCREMENT, - `ne_type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `ne_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `rm_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', `date` varchar(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Date of the report yyyy-mm-dd hh:mi:ss', `start_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'Start time of the report hh:mi:ss', `end_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'End time of the report hh:mi:ss', @@ -18,7 +15,5 @@ CREATE TABLE `kpi_report_hlr` ( `kpi_values` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT 'KPI values JSON String', `created_at` bigint DEFAULT '0' COMMENT 'Creation time 接收到的timestamp秒级存储毫秒时间戳', PRIMARY KEY (`id`) USING BTREE, - KEY `idx_hlr_uid_at` (`rm_uid`,`created_at`) USING BTREE + KEY `idx_kpi_hlr_cn_uid_at` (`core_uid` DESC, `ne_uid` DESC, `created_at` DESC) USING BTREE COMMENT '索引-核心网_资源标识_记录时间' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='KPI_指标数据_HLR'; - -SET FOREIGN_KEY_CHECKS = 1; diff --git a/build/database/std/install/kpi_report_ims.sql b/build/database/std/install/kpi_report_ims.sql index 5ee4b15f..d5b6f162 100644 --- a/build/database/std/install/kpi_report_ims.sql +++ b/build/database/std/install/kpi_report_ims.sql @@ -1,15 +1,12 @@ -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - -- ---------------------------- -- Table structure for kpi_report_ims -- ---------------------------- DROP TABLE IF EXISTS `kpi_report_ims`; CREATE TABLE `kpi_report_ims` ( `id` int NOT NULL AUTO_INCREMENT, - `ne_type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `ne_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `rm_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', `date` varchar(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Date of the report yyyy-mm-dd hh:mi:ss', `start_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'Start time of the report hh:mi:ss', `end_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'End time of the report hh:mi:ss', @@ -18,7 +15,5 @@ CREATE TABLE `kpi_report_ims` ( `kpi_values` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT 'KPI values JSON String', `created_at` bigint DEFAULT '0' COMMENT 'Creation time 接收到的timestamp秒级存储毫秒时间戳', PRIMARY KEY (`id`) USING BTREE, - KEY `idx_ims_uid_at` (`rm_uid`,`created_at`) USING BTREE + KEY `idx_kpi_ims_cn_uid_at` (`core_uid` DESC, `ne_uid` DESC, `created_at` DESC) USING BTREE COMMENT '索引-核心网_资源标识_记录时间' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='KPI_指标数据_IMS'; - -SET FOREIGN_KEY_CHECKS = 1; diff --git a/build/database/std/install/kpi_report_mme.sql b/build/database/std/install/kpi_report_mme.sql index 02024561..ab944ca2 100644 --- a/build/database/std/install/kpi_report_mme.sql +++ b/build/database/std/install/kpi_report_mme.sql @@ -1,15 +1,12 @@ -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - -- ---------------------------- -- Table structure for kpi_report_mme -- ---------------------------- DROP TABLE IF EXISTS `kpi_report_mme`; CREATE TABLE `kpi_report_mme` ( `id` int NOT NULL AUTO_INCREMENT, - `ne_type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `ne_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `rm_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', `date` varchar(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Date of the report yyyy-mm-dd hh:mi:ss', `start_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'Start time of the report hh:mi:ss', `end_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'End time of the report hh:mi:ss', @@ -18,7 +15,5 @@ CREATE TABLE `kpi_report_mme` ( `kpi_values` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT 'KPI values JSON String', `created_at` bigint DEFAULT '0' COMMENT 'Creation time 接收到的timestamp秒级存储毫秒时间戳', PRIMARY KEY (`id`) USING BTREE, - KEY `idx_mme_uid_at` (`rm_uid`,`created_at`) USING BTREE + KEY `idx_kpi_mme_cn_uid_at` (`core_uid` DESC, `ne_uid` DESC, `created_at` DESC) USING BTREE COMMENT '索引-核心网_资源标识_记录时间' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='KPI_指标数据_MME'; - -SET FOREIGN_KEY_CHECKS = 1; diff --git a/build/database/std/install/kpi_report_mocngw.sql b/build/database/std/install/kpi_report_mocngw.sql index 8adbbc71..700c710d 100644 --- a/build/database/std/install/kpi_report_mocngw.sql +++ b/build/database/std/install/kpi_report_mocngw.sql @@ -1,15 +1,12 @@ -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - -- ---------------------------- -- Table structure for kpi_report_mocngw -- ---------------------------- DROP TABLE IF EXISTS `kpi_report_mocngw`; CREATE TABLE `kpi_report_mocngw` ( `id` int NOT NULL AUTO_INCREMENT, - `ne_type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `ne_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `rm_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', `date` varchar(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Date of the report yyyy-mm-dd hh:mi:ss', `start_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'Start time of the report hh:mi:ss', `end_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'End time of the report hh:mi:ss', @@ -18,7 +15,5 @@ CREATE TABLE `kpi_report_mocngw` ( `kpi_values` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT 'KPI values JSON String', `created_at` bigint DEFAULT '0' COMMENT 'Creation time 接收到的timestamp秒级存储毫秒时间戳', PRIMARY KEY (`id`) USING BTREE, - KEY `idx_mocngw_uid_at` (`rm_uid`,`created_at`) USING BTREE + KEY `idx_kpi_mocngw_cn_uid_at` (`core_uid` DESC, `ne_uid` DESC, `created_at` DESC) USING BTREE COMMENT '索引-核心网_资源标识_记录时间' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='KPI_指标数据_MOCNGW'; - -SET FOREIGN_KEY_CHECKS = 1; diff --git a/build/database/std/install/kpi_report_nssf.sql b/build/database/std/install/kpi_report_nssf.sql index c0884abd..f30286e7 100644 --- a/build/database/std/install/kpi_report_nssf.sql +++ b/build/database/std/install/kpi_report_nssf.sql @@ -1,15 +1,12 @@ -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - -- ---------------------------- -- Table structure for kpi_report_nssf -- ---------------------------- DROP TABLE IF EXISTS `kpi_report_nssf`; CREATE TABLE `kpi_report_nssf` ( `id` int NOT NULL AUTO_INCREMENT, - `ne_type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `ne_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `rm_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', `date` varchar(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Date of the report yyyy-mm-dd hh:mi:ss', `start_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'Start time of the report hh:mi:ss', `end_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'End time of the report hh:mi:ss', @@ -18,7 +15,5 @@ CREATE TABLE `kpi_report_nssf` ( `kpi_values` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT 'KPI values JSON String', `created_at` bigint DEFAULT '0' COMMENT 'Creation time 接收到的timestamp秒级存储毫秒时间戳', PRIMARY KEY (`id`) USING BTREE, - KEY `idx_nssf_uid_at` (`rm_uid`,`created_at`) USING BTREE + KEY `idx_kpi_nssf_cn_uid_at` (`core_uid` DESC, `ne_uid` DESC, `created_at` DESC) USING BTREE COMMENT '索引-核心网_资源标识_记录时间' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='KPI_指标数据_NSSF'; - -SET FOREIGN_KEY_CHECKS = 1; diff --git a/build/database/std/install/kpi_report_pcf.sql b/build/database/std/install/kpi_report_pcf.sql index d67e8c00..55b56a00 100644 --- a/build/database/std/install/kpi_report_pcf.sql +++ b/build/database/std/install/kpi_report_pcf.sql @@ -1,15 +1,12 @@ -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - -- ---------------------------- -- Table structure for kpi_report_pcf -- ---------------------------- DROP TABLE IF EXISTS `kpi_report_pcf`; CREATE TABLE `kpi_report_pcf` ( `id` int NOT NULL AUTO_INCREMENT, - `ne_type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `ne_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `rm_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', `date` varchar(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Date of the report yyyy-mm-dd hh:mi:ss', `start_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'Start time of the report hh:mi:ss', `end_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'End time of the report hh:mi:ss', @@ -18,7 +15,5 @@ CREATE TABLE `kpi_report_pcf` ( `kpi_values` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT 'KPI values JSON String', `created_at` bigint DEFAULT '0' COMMENT 'Creation time 接收到的timestamp秒级存储毫秒时间戳', PRIMARY KEY (`id`) USING BTREE, - KEY `idx_pcf_uid_at` (`rm_uid`,`created_at`) USING BTREE + KEY `idx_kpi_pcf_cn_uid_at` (`core_uid` DESC, `ne_uid` DESC, `created_at` DESC) USING BTREE COMMENT '索引-核心网_资源标识_记录时间' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='KPI_指标数据_PCF'; - -SET FOREIGN_KEY_CHECKS = 1; diff --git a/build/database/std/install/kpi_report_smf.sql b/build/database/std/install/kpi_report_smf.sql index 6f2f3fbe..177fb1d7 100644 --- a/build/database/std/install/kpi_report_smf.sql +++ b/build/database/std/install/kpi_report_smf.sql @@ -1,15 +1,12 @@ -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - -- ---------------------------- -- Table structure for kpi_report_smf -- ---------------------------- DROP TABLE IF EXISTS `kpi_report_smf`; CREATE TABLE `kpi_report_smf` ( `id` int NOT NULL AUTO_INCREMENT, - `ne_type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `ne_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `rm_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', `date` varchar(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Date of the report yyyy-mm-dd hh:mi:ss', `start_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'Start time of the report hh:mi:ss', `end_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'End time of the report hh:mi:ss', @@ -18,7 +15,5 @@ CREATE TABLE `kpi_report_smf` ( `kpi_values` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT 'KPI values JSON String', `created_at` bigint DEFAULT '0' COMMENT 'Creation time 接收到的timestamp秒级存储毫秒时间戳', PRIMARY KEY (`id`) USING BTREE, - KEY `idx_smf_uid_at` (`rm_uid`,`created_at`) USING BTREE + KEY `idx_kpi_smf_cn_uid_at` (`core_uid` DESC, `ne_uid` DESC, `created_at` DESC) USING BTREE COMMENT '索引-核心网_资源标识_记录时间' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='KPI_指标数据_SMF'; - -SET FOREIGN_KEY_CHECKS = 1; diff --git a/build/database/std/install/kpi_report_smsc.sql b/build/database/std/install/kpi_report_smsc.sql index 8f07e154..a28a6bd2 100644 --- a/build/database/std/install/kpi_report_smsc.sql +++ b/build/database/std/install/kpi_report_smsc.sql @@ -1,15 +1,12 @@ -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - -- ---------------------------- -- Table structure for kpi_report_smsc -- ---------------------------- DROP TABLE IF EXISTS `kpi_report_smsc`; CREATE TABLE `kpi_report_smsc` ( `id` int NOT NULL AUTO_INCREMENT, - `ne_type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `ne_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `rm_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', `date` varchar(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Date of the report yyyy-mm-dd hh:mi:ss', `start_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'Start time of the report hh:mi:ss', `end_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'End time of the report hh:mi:ss', @@ -18,7 +15,5 @@ CREATE TABLE `kpi_report_smsc` ( `kpi_values` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT 'KPI values JSON String', `created_at` bigint DEFAULT '0' COMMENT 'Creation time 接收到的timestamp秒级存储毫秒时间戳', PRIMARY KEY (`id`) USING BTREE, - KEY `idx_smsc_uid_at` (`rm_uid`,`created_at`) USING BTREE + KEY `idx_kpi_smsc_cn_uid_at` (`core_uid` DESC, `ne_uid` DESC, `created_at` DESC) USING BTREE COMMENT '索引-核心网_资源标识_记录时间' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='KPI_指标数据_SMSC'; - -SET FOREIGN_KEY_CHECKS = 1; diff --git a/build/database/std/install/kpi_report_udm.sql b/build/database/std/install/kpi_report_udm.sql index 5dbc1cd1..520e0e81 100644 --- a/build/database/std/install/kpi_report_udm.sql +++ b/build/database/std/install/kpi_report_udm.sql @@ -1,15 +1,12 @@ -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - -- ---------------------------- -- Table structure for kpi_report_udm -- ---------------------------- DROP TABLE IF EXISTS `kpi_report_udm`; CREATE TABLE `kpi_report_udm` ( `id` int NOT NULL AUTO_INCREMENT, - `ne_type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `ne_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `rm_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', `date` varchar(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Date of the report yyyy-mm-dd hh:mi:ss', `start_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'Start time of the report hh:mi:ss', `end_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'End time of the report hh:mi:ss', @@ -18,7 +15,5 @@ CREATE TABLE `kpi_report_udm` ( `kpi_values` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT 'KPI values JSON String', `created_at` bigint DEFAULT '0' COMMENT 'Creation time 接收到的timestamp秒级存储毫秒时间戳', PRIMARY KEY (`id`) USING BTREE, - KEY `idx_udm_uid_at` (`rm_uid`,`created_at`) USING BTREE + KEY `idx_kpi_udm_cn_uid_at` (`core_uid` DESC, `ne_uid` DESC, `created_at` DESC) USING BTREE COMMENT '索引-核心网_资源标识_记录时间' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='KPI_指标数据_UDM'; - -SET FOREIGN_KEY_CHECKS = 1; diff --git a/build/database/std/install/kpi_report_upf.sql b/build/database/std/install/kpi_report_upf.sql index 28361e26..492b44c2 100644 --- a/build/database/std/install/kpi_report_upf.sql +++ b/build/database/std/install/kpi_report_upf.sql @@ -1,15 +1,12 @@ -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - -- ---------------------------- -- Table structure for kpi_report_upf -- ---------------------------- DROP TABLE IF EXISTS `kpi_report_upf`; CREATE TABLE `kpi_report_upf` ( `id` int NOT NULL AUTO_INCREMENT, - `ne_type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `ne_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `rm_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', `date` varchar(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Date of the report yyyy-mm-dd hh:mi:ss', `start_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'Start time of the report hh:mi:ss', `end_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'End time of the report hh:mi:ss', @@ -18,7 +15,5 @@ CREATE TABLE `kpi_report_upf` ( `kpi_values` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT 'KPI values JSON String', `created_at` bigint DEFAULT '0' COMMENT 'Creation time 接收到的timestamp秒级存储毫秒时间戳', PRIMARY KEY (`id`) USING BTREE, - KEY `idx_upf_uid_at` (`rm_uid`,`created_at`) USING BTREE + KEY `idx_kpi_upf_cn_uid_at` (`core_uid` DESC, `ne_uid` DESC, `created_at` DESC) USING BTREE COMMENT '索引-核心网_资源标识_记录时间' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='KPI_指标数据_UPF'; - -SET FOREIGN_KEY_CHECKS = 1; diff --git a/build/database/std/install/mml_log.sql b/build/database/std/install/mml_log.sql index 22c7ca66..ab80d96b 100644 --- a/build/database/std/install/mml_log.sql +++ b/build/database/std/install/mml_log.sql @@ -5,14 +5,15 @@ DROP TABLE IF EXISTS `mml_log`; CREATE TABLE `mml_log` ( `id` int(11) NOT NULL AUTO_INCREMENT, + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', `user` varchar(32) DEFAULT NULL, `ip` varchar(64) DEFAULT NULL, - `ne_type` varchar(32) DEFAULT NULL, - `ne_id` varchar(32) DEFAULT NULL, `command` varchar(512) DEFAULT NULL COMMENT '命令 ; 分隔', `result` varchar(255) DEFAULT NULL COMMENT '成功和有错误', `log_time` bigint DEFAULT '0' COMMENT '记录时间', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; -- Dump completed on 2024-03-06 17:26:56 diff --git a/build/database/std/install/nb_state.sql b/build/database/std/install/nb_state.sql index 981a96a6..c63dc48c 100644 --- a/build/database/std/install/nb_state.sql +++ b/build/database/std/install/nb_state.sql @@ -1,13 +1,12 @@ -- -- Table structure for table `nb_state` -- - DROP TABLE IF EXISTS `nb_state`; CREATE TABLE `nb_state` ( `id` int NOT NULL AUTO_INCREMENT, - `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '网元类型 AMF MME', - `ne_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '网元ID', - `rm_uid` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '-' COMMENT '资源唯一标识', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', `create_time` bigint DEFAULT '0' COMMENT '创建时间', `address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '基站IP地址', `name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '基站名称', @@ -16,7 +15,5 @@ CREATE TABLE `nb_state` ( `state` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT 'OFF' COMMENT '基站状态 OFF ON', `time` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '-' COMMENT '状态时间', PRIMARY KEY (`id`) USING BTREE, - UNIQUE KEY `uk_state_type_id_uid_cat` (`ne_type`,`ne_id`,`rm_uid`,`create_time`) USING BTREE COMMENT '唯一网元类型和ID' + KEY `idx_nbst_cn_uid_at` (`core_uid` DESC, `ne_uid` DESC, `ne_type` DESC, `create_time` DESC) USING BTREE COMMENT '索引-核心网_资源标识_记录时间' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='基站_状态记录表'; - --- Dump completed on 2025-02-08 12:50:13 diff --git a/build/database/std/install/ne_config_backup.sql b/build/database/std/install/ne_config_backup.sql index f185b1d5..5d01d8e8 100644 --- a/build/database/std/install/ne_config_backup.sql +++ b/build/database/std/install/ne_config_backup.sql @@ -1,13 +1,12 @@ --- MariaDB dump 10.19 Distrib 10.6.16-MariaDB, for debian-linux-gnu (x86_64) -- -- Table structure for table `ne_config_backup` -- - DROP TABLE IF EXISTS `ne_config_backup`; CREATE TABLE `ne_config_backup` ( `id` bigint NOT NULL AUTO_INCREMENT, - `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '网元类型', - `ne_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '网元ID', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', `name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '-' COMMENT '压缩包名称', `path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '压缩包位置', `remark` varchar(400) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '备注', @@ -16,7 +15,5 @@ CREATE TABLE `ne_config_backup` ( `update_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '更新者', `update_time` bigint DEFAULT '0' COMMENT '更新时间', PRIMARY KEY (`id`) USING BTREE, - KEY `idx_cb_type_id` (`ne_type`,`ne_id`) USING BTREE COMMENT '网元类型_网元ID' + KEY `idx_cfgbak_uid_type` (`core_uid`,`ne_uid`,`ne_type`) USING BTREE COMMENT '索引-核心网_资源标识_类型' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='网元_配置文件备份记录'; - --- Dump completed on 2025-02-14 15:26:56 diff --git a/build/database/std/install/ne_host.sql b/build/database/std/install/ne_host.sql index 7cc1b93c..a65bb4ff 100644 --- a/build/database/std/install/ne_host.sql +++ b/build/database/std/install/ne_host.sql @@ -1,6 +1,3 @@ -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - -- -- Table structure for table `ne_host` -- @@ -27,9 +24,11 @@ CREATE TABLE `ne_host` ( UNIQUE KEY `uk_type_group_title` (`host_type`,`group_id`,`title`) USING BTREE COMMENT '同组内名称唯一' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='网元_主机表'; --- 初始数据对应网元 -INSERT INTO `ne_host` VALUES (1, 'ssh', '1', 'OMC_001_22', '127.0.0.1', 22, 'omcuser', '2', '', '', '', '', '', 'system', 1729063407329, '', 0); -INSERT INTO `ne_host` VALUES (2, 'telnet', '1', 'OMC_001_4100', '127.0.0.1', 4100, 'admin', '0', 'NUBonCin4GZgl7o12YjeClE8ToQmYp9KWdhMjSNxc2M=', '', '', '', '', 'system', 1729063407329, '', 0); +-- +-- Dumping data for table `ne_host` +-- +INSERT INTO `ne_host` VALUES (1, 'ssh', '1', 'OMC_001_22', '127.0.0.1', 22, 'omcuser', '2', '', '', '', '', '', 'system', 1756089865994, 'system', 1756089865994); +INSERT INTO `ne_host` VALUES (2, 'telnet', '1', 'OMC_001_4100', '127.0.0.1', 4100, 'admin', '0', 'NUBonCin4GZgl7o12YjeClE8ToQmYp9KWdhMjSNxc2M=', '', '', '', '', 'system', 1756089865994, 'system', 1756089865994); SET FOREIGN_KEY_CHECKS=1; diff --git a/build/database/std/install/ne_host_cmd.sql b/build/database/std/install/ne_host_cmd.sql index eab20f43..2d097a5f 100644 --- a/build/database/std/install/ne_host_cmd.sql +++ b/build/database/std/install/ne_host_cmd.sql @@ -1,11 +1,6 @@ -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - -- -- Table structure for table `ne_host_cmd` -- - - DROP TABLE IF EXISTS `ne_host_cmd`; CREATE TABLE `ne_host_cmd` ( `id` bigint NOT NULL AUTO_INCREMENT COMMENT '命令主键', @@ -21,7 +16,3 @@ CREATE TABLE `ne_host_cmd` ( PRIMARY KEY (`id`) USING BTREE, UNIQUE INDEX `uk_host_type_group_title`(`cmd_type` ASC, `group_id` ASC, `title` ASC) USING BTREE COMMENT '同组内名称唯一' ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '网元主机命令表' ROW_FORMAT = DYNAMIC; - -SET FOREIGN_KEY_CHECKS=1; - --- Dump completed on 2025-02-14 15:26:56 diff --git a/build/database/std/install/ne_info.sql b/build/database/std/install/ne_info.sql index 5a124cb9..00c23937 100644 --- a/build/database/std/install/ne_info.sql +++ b/build/database/std/install/ne_info.sql @@ -1,23 +1,20 @@ -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - -- -- Table structure for table `ne_info` -- DROP TABLE IF EXISTS `ne_info`; CREATE TABLE `ne_info` ( - `id` bigint NOT NULL AUTO_INCREMENT, + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '网元ID', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', - `ne_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元ID', - `rm_uid` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元资源唯一标识', `ne_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元名称', - `ip` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元服务IP', + `ip_addr` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元服务IP', `port` int DEFAULT '0' COMMENT '端口', `pv_flag` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT 'PNF' COMMENT '网元虚拟化标识 物理PNF 虚拟VNF', `province` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT 'AreaNet' COMMENT '省份地域', `vendor_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '-' COMMENT '厂商名称', `dn` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '-' COMMENT '网络标识', - `ne_address` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'MAC地址', + `mac_addr` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'MAC地址', `host_ids` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元主机ID组 数据格式(ssh,telnet) UDM(ssh,telnet,redis) UPF(ssh,telnet,telnet)', `status` int DEFAULT '0' COMMENT '网元状态 0离线 1在线 2配置待下发 3备用模式', `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '备注', @@ -26,12 +23,10 @@ CREATE TABLE `ne_info` ( `update_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '更新者', `update_time` bigint DEFAULT '0' COMMENT '更新时间', PRIMARY KEY (`id`) USING BTREE, - UNIQUE KEY `ux_netype_neid` (`ne_type`,`ne_id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='网元_基础信息表 关联对应版本、授权、主机'; + UNIQUE KEY `uk_core_ne_type` (`core_uid`,`ne_uid`,`ne_type`) USING BTREE COMMENT '唯一核心网_资源标识_类型' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='网元_基础信息表 关联创建版本、授权、主机'; --- 初始网元数据 -INSERT INTO `ne_info` VALUES (1, 'OMC', '001', '4400HXOMC001', 'OMC_001', '127.0.0.1', 33030, 'PNF', 'AreaNet', '-', '-', '-', '1,2', 0, '', 'system', 1713928436971, '', 0); - -SET FOREIGN_KEY_CHECKS=1; - --- Dump completed on 2025-02-14 15:26:56 +-- +-- Dumping data for table `ne_info` +-- +INSERT INTO `ne_info` VALUES (1, 'YYMMDDHH', 'DCTHWYBT', 'OMC', 'OMC_001', '127.0.0.1', 33080, 'PNF', 'Area', '', '', '', '1,2', 1, '', 'system', 1755861727150, 'system', 1756286314456); diff --git a/build/database/std/install/ne_license.sql b/build/database/std/install/ne_license.sql index b5414da5..e8575c54 100644 --- a/build/database/std/install/ne_license.sql +++ b/build/database/std/install/ne_license.sql @@ -1,21 +1,18 @@ -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - -- -- Table structure for table `ne_license` -- - - DROP TABLE IF EXISTS `ne_license`; CREATE TABLE `ne_license` ( `id` bigint NOT NULL AUTO_INCREMENT, - `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '网元类型', - `ne_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '网元ID', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', `activation_request_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '激活申请代码', `license_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '激活授权文件', - `capability` bigint DEFAULT '0' COMMENT '用户容量', `serial_num` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '-' COMMENT '序列号', `expiry_date` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '-' COMMENT '许可证到期日期', + `ue_number` bigint DEFAULT '0' COMMENT '用户容量', + `nb_number` bigint DEFAULT '0' COMMENT '基站容量', `status` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '状态 0无效 1有效', `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '备注', `create_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '创建者', @@ -23,12 +20,10 @@ CREATE TABLE `ne_license` ( `update_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '更新者', `update_time` bigint DEFAULT '0' COMMENT '更新时间', PRIMARY KEY (`id`) USING BTREE, - UNIQUE KEY `uk_lic_type_id` (`ne_type`,`ne_id`) USING BTREE COMMENT '唯一网元类型和网元ID' + UNIQUE KEY `uk_lic_core_ne_type` (`core_uid`,`ne_uid`,`ne_type`) USING BTREE COMMENT '唯一核心网_资源标识_类型' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='网元_授权激活信息'; --- 初始数据对应网元 -INSERT INTO `ne_license` VALUES (1, 'OMC', '001', '', '', 0, '', '', '0', '', 'system', 1713928436971, '', 0); - -SET FOREIGN_KEY_CHECKS=1; - --- Dump completed on 2025-02-14 15:26:56 +-- +-- Dumping data for table `ne_license` +-- +INSERT INTO `ne_license` VALUES (1, 'YYMMDDHH', 'DCTHWYBT', 'OMC', '', '', '-', '-', 0, 0, '1', '', 'system', 1756089692896, 'system', 1756173372114); diff --git a/build/database/std/install/ne_software.sql b/build/database/std/install/ne_software.sql index eff535d5..5a830893 100644 --- a/build/database/std/install/ne_software.sql +++ b/build/database/std/install/ne_software.sql @@ -1,6 +1,3 @@ -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - -- -- Table structure for table `ne_software` -- @@ -19,7 +16,3 @@ CREATE TABLE `ne_software` ( PRIMARY KEY (`id`) USING BTREE, UNIQUE KEY `uk_type_name_version` (`ne_type`,`name`,`version`) USING BTREE COMMENT '唯一网元类型和文件名版本是否唯一' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='网元_软件包'; - -SET FOREIGN_KEY_CHECKS=1; - --- Dump completed on 2025-02-14 15:26:56 diff --git a/build/database/std/install/ne_state.sql b/build/database/std/install/ne_state.sql index 6d44ed7e..1dcdf568 100644 --- a/build/database/std/install/ne_state.sql +++ b/build/database/std/install/ne_state.sql @@ -1,14 +1,12 @@ -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - -- -- Table structure for table `ne_state` -- DROP TABLE IF EXISTS `ne_state`; CREATE TABLE `ne_state` ( `id` int NOT NULL AUTO_INCREMENT, - `ne_type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `ne_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', `version` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '版本', `capability` bigint DEFAULT '0' COMMENT '用户容量', `serial_num` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '序列号', @@ -20,7 +18,5 @@ CREATE TABLE `ne_state` ( `nf_mem_used` bigint DEFAULT '0' COMMENT '内存使用KB-nf', `create_time` bigint DEFAULT '0' COMMENT '创建时间', PRIMARY KEY (`id`) USING BTREE, - KEY `idx_type_id_time` (`ne_type`,`ne_id`,`create_time`) USING BTREE COMMENT 'idx_state_ne_type_id_at' + KEY `idx_state_uid_type` (`core_uid`,`ne_uid`,`ne_type`) USING BTREE COMMENT '索引-核心网_资源标识_类型' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='网元_状态记录内存/CPU/磁盘'; - -SET FOREIGN_KEY_CHECKS=1; diff --git a/build/database/std/install/ne_version.sql b/build/database/std/install/ne_version.sql index 75d06258..8ec813f5 100644 --- a/build/database/std/install/ne_version.sql +++ b/build/database/std/install/ne_version.sql @@ -1,16 +1,12 @@ -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - -- -- Table structure for table `ne_version` -- - - DROP TABLE IF EXISTS `ne_version`; CREATE TABLE `ne_version` ( `id` bigint NOT NULL AUTO_INCREMENT, - `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '网元类型', - `ne_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '网元ID', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', `name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '-' COMMENT '当前包名', `version` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '-' COMMENT '当前版本', `path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '当前软件包', @@ -26,12 +22,10 @@ CREATE TABLE `ne_version` ( `update_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '更新者', `update_time` bigint DEFAULT '0' COMMENT '更新时间', PRIMARY KEY (`id`) USING BTREE, - UNIQUE KEY `uk_ver_type_id` (`ne_type`,`ne_id`) USING BTREE COMMENT '唯一网元类型和ID' + UNIQUE KEY `uk_ver_core_ne_type` (`core_uid`,`ne_uid`,`ne_type`) USING BTREE COMMENT '唯一核心网_资源标识_类型' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='网元_版本信息'; --- 初始数据对应网元 -INSERT INTO `ne_version` VALUES (1, 'OMC', '001', '', '', '', '', '', '', '', '', '', '0', 'system', 1729063407329, '', 0); - -SET FOREIGN_KEY_CHECKS=1; - --- Dump completed on 2025-02-14 15:26:56 +-- +-- Dumping data for table `ne_version` +-- +INSERT INTO `ne_version` VALUES (1, 'YYMMDDHH', 'DCTHWYBT', 'OMC', '-', '-', '-', '', '', '', '', '', '', '', 'system', 1756089685222, 'system', 1756089866077); diff --git a/build/database/std/install/sys_i18n.sql b/build/database/std/install/sys_i18n.sql index 0e7cc1fb..6c6f8abd 100644 --- a/build/database/std/install/sys_i18n.sql +++ b/build/database/std/install/sys_i18n.sql @@ -26,7 +26,7 @@ INSERT INTO `sys_i18n` VALUES (8, 'menu.systemRemark', '系统管理目录', 'Sy INSERT INTO `sys_i18n` VALUES (9, 'menu.monitorRemark', '系统监控目录', 'System Monitor Catalog'); INSERT INTO `sys_i18n` VALUES (10, 'menu.toolsRemark', '系统工具目录', 'System Tools Catalog'); INSERT INTO `sys_i18n` VALUES (11, 'menu.neRemark', '网元配置管理目录', 'NE Configuration Management Catalog'); -INSERT INTO `sys_i18n` VALUES (12, 'menu.ueRemark', '网元终端信息目录', 'Network Element Terminal Information Catalog'); +INSERT INTO `sys_i18n` VALUES (12, 'menu.ueRemark', '终端开户信息目录', 'UE Information Catalog'); INSERT INTO `sys_i18n` VALUES (13, 'menu.security.user', '用户管理', 'User Management'); INSERT INTO `sys_i18n` VALUES (14, 'menu.security.role', '角色管理', 'Role Management'); INSERT INTO `sys_i18n` VALUES (15, 'menu.security.roleUser', '分配角色', 'Assigning Roles'); @@ -79,14 +79,14 @@ INSERT INTO `sys_i18n` VALUES (61, 'menu.neData.udmAuth', 'UDM鉴权用户', 'UD INSERT INTO `sys_i18n` VALUES (62, 'menu.neData.udmSub', 'UDM签约用户', 'UDM Subscribers'); INSERT INTO `sys_i18n` VALUES (63, 'menu.neData.udmVOIP', 'VOIP鉴权用户', 'VOIP Authentication'); INSERT INTO `sys_i18n` VALUES (64, 'menu.neData.udmVolte', 'IMS签约用户', 'IMS Subscribers'); -INSERT INTO `sys_i18n` VALUES (65, 'menu.neData.imsSub', 'IMS在线用户', 'IMS Online Users'); -INSERT INTO `sys_i18n` VALUES (66, 'menu.neData.smfSub', 'UE在线信息', 'UE Online Information'); +INSERT INTO `sys_i18n` VALUES (65, 'menu.neData.imsSub', 'IMS在线语音会话', 'IMS Online Voice Session'); +INSERT INTO `sys_i18n` VALUES (66, 'menu.neData.smfSub', 'SMF在线数据会话', 'SMF Online Data Session'); INSERT INTO `sys_i18n` VALUES (67, 'menu.neData.baseOnline', '基站在线', 'Radio Online'); INSERT INTO `sys_i18n` VALUES (68, 'menu.trace', '跟踪', 'Trace'); INSERT INTO `sys_i18n` VALUES (69, 'menu.trace.task', '网元跟踪任务', 'NE Trace Task'); INSERT INTO `sys_i18n` VALUES (70, 'menu.trace.taskData', '网元跟踪任务数据', 'NE Trace Task Data'); INSERT INTO `sys_i18n` VALUES (71, 'menu.trace.pcap', '信令抓包', 'Signaling Capture'); -INSERT INTO `sys_i18n` VALUES (72, 'menu.fault', '监控', 'Monitor'); +-- INSERT INTO `sys_i18n` VALUES (72, 'menu.fault', '告警', 'Alarm'); INSERT INTO `sys_i18n` VALUES (73, 'config.neData.backupDataFTP', '备份网元数据-同步FTP服务', 'Backup NE Data - Sync Data FTP Service'); INSERT INTO `sys_i18n` VALUES (74, 'config.neData.backupDataFTPRemark', '请通过系统页面进行设置FTP信息', 'Please set the FTP information through the system page.'); INSERT INTO `sys_i18n` VALUES (75, 'job.backup_export_table_sys_log_operate_remark', 'hour: 数据时间从任务执行时间前的小时数\ntableName: 数据表名\ncolumns: 支持字段\nbackupPath: 备份输出路径 /usr/local/omc/backup/{backupPath}', 'hour: data time from the hour before the task execution time \ntableName: data table name \ncolumns: support fields \nbackupPath: backup output path /usr/local/omc/backup/{backupPath}'); @@ -98,11 +98,11 @@ INSERT INTO `sys_i18n` VALUES (80, 'config.sys.user.fristPasswdChange', '用户 INSERT INTO `sys_i18n` VALUES (81, 'menu.trace.pcapRemark', '信令抓包菜单', 'Signaling Capture Menu'); INSERT INTO `sys_i18n` VALUES (82, 'menu.faultRemark', '故障管理目录', 'Fault Management Catalog'); INSERT INTO `sys_i18n` VALUES (83, 'menu.fault.active', '活动告警', 'Active Alarms'); -INSERT INTO `sys_i18n` VALUES (84, 'menu.log', '日志', 'Logs'); +-- INSERT INTO `sys_i18n` VALUES (84, 'menu.log', '日志', 'Logs'); INSERT INTO `sys_i18n` VALUES (85, 'menu.log.mml', 'MML日志', 'MML Logs'); INSERT INTO `sys_i18n` VALUES (86, 'menu.log.alarm', '告警日志', 'Alarm Logs'); INSERT INTO `sys_i18n` VALUES (87, 'menu.log.forwarding', '告警前转日志', 'Alarm Forwarding Logs'); -INSERT INTO `sys_i18n` VALUES (88, 'menu.log.set', '日志设置', 'Log Settings'); +-- INSERT INTO `sys_i18n` VALUES (88, 'menu.log.set', '日志设置', 'Log Settings'); INSERT INTO `sys_i18n` VALUES (89, 'menu.monitor.sessionUser', '用户会话', 'User Sessions'); INSERT INTO `sys_i18n` VALUES (90, 'menu.fault.history', '历史告警', 'Historical Alarms'); INSERT INTO `sys_i18n` VALUES (91, 'menu.fault.set', '设置', 'Settings'); @@ -114,7 +114,7 @@ INSERT INTO `sys_i18n` VALUES (96, 'menu.log.mmlRemark', '操作MML日志', 'Ope INSERT INTO `sys_i18n` VALUES (97, 'menu.log.alarmRemark', '告警日志菜单', 'Alarm Log Menu'); INSERT INTO `sys_i18n` VALUES (98, 'menu.log.securityOldRemark', '安全日志旧layui菜单', 'Security Log Old Layui Menu'); INSERT INTO `sys_i18n` VALUES (99, 'menu.log.forwardingRemark', '告警前转日志菜单', 'Alarm forward log menu'); -INSERT INTO `sys_i18n` VALUES (100, 'menu.log.setRemark', '日志设置菜单', 'Log Settings menu'); +-- INSERT INTO `sys_i18n` VALUES (100, 'menu.log.setRemark', '日志设置菜单', 'Log Settings menu'); INSERT INTO `sys_i18n` VALUES (101, 'menu.monitor.sessionUserRemark', '用户会话旧layui菜单', 'User Session Old Layui Menu'); INSERT INTO `sys_i18n` VALUES (102, 'menu.fault.historyRemark', '历史告警菜单', 'Alarm history menu'); INSERT INTO `sys_i18n` VALUES (103, 'menu.fault.setRemark', '故障通用设置菜单', 'Fault General Setup Menu'); @@ -137,18 +137,18 @@ INSERT INTO `sys_i18n` VALUES (119, 'menu.dashboard.smscCDR.content', '可见短 INSERT INTO `sys_i18n` VALUES (120, 'menu.perf.thresholdRemark', '性能门限菜单', 'Performance Threshold Menu'); INSERT INTO `sys_i18n` VALUES (121, 'menu.perf.kpiRemark', '黄金指标菜单', 'Key Performance Indicator Menu'); INSERT INTO `sys_i18n` VALUES (122, 'menu.perf.customTargetRemark', '自定义指标菜单', 'Custom Indicator Management Menu'); -INSERT INTO `sys_i18n` VALUES (123, 'menu.dashboard.smfCDRByIMSI', '数据流量报表', 'Data Usage Report'); +INSERT INTO `sys_i18n` VALUES (123, 'menu.dashboard.smfCDRByIMSI', 'SMF数据流量报表', 'SMF Data Usage Report'); INSERT INTO `sys_i18n` VALUES (124, 'menu.mmlRemark', 'MML管理目录', 'MML Management Catalog'); INSERT INTO `sys_i18n` VALUES (125, 'menu.mml.neRemark', '网元操作菜单', 'Network Element Operations Menu'); INSERT INTO `sys_i18n` VALUES (126, 'menu.mml.udmRemark', '网元UDM用户数据菜单', 'Network Element UDM User Data Menu'); INSERT INTO `sys_i18n` VALUES (127, 'menu.mml.setRemark', 'MML设置菜单', 'MML Setup Menu'); INSERT INTO `sys_i18n` VALUES (128, 'menu.mml.omcRemark', 'OMC操作菜单', 'OMC Operation Menu'); INSERT INTO `sys_i18n` VALUES (129, 'menu.dashboard.sgwcCDR', '漫游数据话单', 'Roaming Data CDR'); -INSERT INTO `sys_i18n` VALUES (130, 'menu.security', '安全', 'Security'); +INSERT INTO `sys_i18n` VALUES (130, 'menu.neData', '网元数据查询', 'NE Data Query'); INSERT INTO `sys_i18n` VALUES (131, 'menu.system.systemSet', '系统设置', 'System Settings'); INSERT INTO `sys_i18n` VALUES (132, 'menu.system.systemResource', '系统资源', 'System Resources'); INSERT INTO `sys_i18n` VALUES (133, 'log.operate.title.sgwcCDR', '漫游数据话单', 'Roaming Data CDR'); -INSERT INTO `sys_i18n` VALUES (134, 'menu.securityRemark', '安全管理目录', 'Security Management Catalog'); +INSERT INTO `sys_i18n` VALUES (134, 'menu.neDataRemark', '数据查询管理目录', 'Data Query Management Catalog'); INSERT INTO `sys_i18n` VALUES (135, 'menu.system.systemSetRemark', '系统设置菜单', 'System Settings Menu'); INSERT INTO `sys_i18n` VALUES (136, 'menu.system.systemResourceRemark', '系统资源 cpu io network菜单', 'System Resources cpu io network menu'); INSERT INTO `sys_i18n` VALUES (137, 'dictData.offline', '离线', 'Offline'); @@ -311,7 +311,7 @@ INSERT INTO `sys_i18n` VALUES (293, 'job.delete_ne_config_backup', '删除-过 INSERT INTO `sys_i18n` VALUES (294, 'job.delete_ne_config_backup_remark', 'storeDays:表示保留最近天数的数据记录\r\nstoreNum:保留数量,默认保留7个', 'storeDays: indicates that the most recent days of data records are kept.\r\nstoreNum: the number of reservations, the default reservation is 7.'); INSERT INTO `sys_i18n` VALUES (295, 'job.delete_kpi_record', '删除-过期指标记录', 'Delete-Expired KPI Records'); INSERT INTO `sys_i18n` VALUES (296, 'job.delete_kpi_record_remark', 'storeDays:表示保留最近天数的数据记录\r\nneList:表示匹配的网元类型', 'storeDays: Indicates the most recent days of data records retained\r\nneList: Indicates the type of network elements matched'); -INSERT INTO `sys_i18n` VALUES (297, 'menu.neData.backupData', '导出文件', 'Exponted File'); +INSERT INTO `sys_i18n` VALUES (297, 'menu.neData.backupData', '备份文件查询', 'Backup File Query'); INSERT INTO `sys_i18n` VALUES (298, 'config.sys.user.passwordPolicyNot', '未配置密码策略', 'Password policy not configured'); INSERT INTO `sys_i18n` VALUES (299, 'job.export.jobID', '任务编号', 'ID'); INSERT INTO `sys_i18n` VALUES (300, 'job.export.jobName', '任务名称', 'Name'); @@ -476,9 +476,9 @@ INSERT INTO `sys_i18n` VALUES (458, 'dictData.active_alarm_type.environmental', INSERT INTO `sys_i18n` VALUES (459, 'dictData.active_alarm_type.qualityOfService', '服务质量', 'Quality of Service Alarm'); INSERT INTO `sys_i18n` VALUES (460, 'dictType.active_clear_type', '告警清除类型', 'Alarm Clearing Types'); INSERT INTO `sys_i18n` VALUES (461, 'dictType.active_clear_type_remark', '告警清除类型列表', 'List of Alarm Clearing Types'); -INSERT INTO `sys_i18n` VALUES (462, 'dictData.active_clear_type.notCleared', '告警未清除', 'Not cleared'); -INSERT INTO `sys_i18n` VALUES (463, 'dictData.active_clear_type.hand', '手动清除', 'Manually cleared'); -INSERT INTO `sys_i18n` VALUES (464, 'dictData.active_clear_type.auto', '自动清除', 'Automatically cleared'); +INSERT INTO `sys_i18n` VALUES (462, 'dictData.active_clear_type.notCleared', '告警未清除', 'Not Clear'); +INSERT INTO `sys_i18n` VALUES (463, 'dictData.active_clear_type.hand', '手动清除', 'Manual Clear'); +INSERT INTO `sys_i18n` VALUES (464, 'dictData.active_clear_type.auto', '自动清除', 'Auto Clear'); INSERT INTO `sys_i18n` VALUES (465, 'dictType.active_ack_state', '告警确认类型', 'Alarm Acknowledgement Types'); INSERT INTO `sys_i18n` VALUES (466, 'dictType.active_ack_state_remark', '告警确认类型列表', 'Alarm Acknowledgement Type List'); INSERT INTO `sys_i18n` VALUES (467, 'dictData.active_ack_state.unconfirmed', '未确认', 'Not Confirm'); @@ -529,7 +529,7 @@ INSERT INTO `sys_i18n` VALUES (511, 'sys.account.captchaType', '账号自助-验 INSERT INTO `sys_i18n` VALUES (512, 'sys.account.captchaTypeRemark', '使用验证码类型(math数值计算,char字符验证)', 'Using CAPTCHA types (math numeric calculation, char character validation)'); INSERT INTO `sys_i18n` VALUES (513, 'menu.dashboard', '仪表盘', 'Dashboard'); INSERT INTO `sys_i18n` VALUES (514, 'menu.dashboard.overview', '总览', 'Overview'); -INSERT INTO `sys_i18n` VALUES (515, 'menu.dashboard.imsCDR', '语音话单', 'Voice CDR'); +INSERT INTO `sys_i18n` VALUES (515, 'menu.dashboard.imsCDR', 'IMS语音话单', 'IMS Voice CDR'); INSERT INTO `sys_i18n` VALUES (516, 'dictType.cdr_sip_code', 'IMS-Voice-SIP响应代码类别类型', 'IMS-Voice-SIP Response Code Category Type'); INSERT INTO `sys_i18n` VALUES (517, 'dictType.cdr_call_type', 'IMS-呼叫类型', 'IMS-Call Type'); INSERT INTO `sys_i18n` VALUES (518, 'dictType.ue_auth_code', 'UE 事件认证代码类型', 'UE Event Authentication Code Type'); @@ -633,15 +633,15 @@ INSERT INTO `sys_i18n` VALUES (615, 'dictData.ne_version_status.1', '已是最 INSERT INTO `sys_i18n` VALUES (616, 'dictData.ne_version_status.2', '上一版本', 'Previous'); INSERT INTO `sys_i18n` VALUES (617, 'dictData.ne_version_status.3', '有新版本', 'Has New'); INSERT INTO `sys_i18n` VALUES (618, 'menu.fault.event', '事件通知', 'Event Notification'); -INSERT INTO `sys_i18n` VALUES (619, 'menu.dashboard.smfCDR', '数据话单', 'Data CDR'); -INSERT INTO `sys_i18n` VALUES (620, 'log.operate.title.smfCDR', '数据话单', 'Data CDR'); +INSERT INTO `sys_i18n` VALUES (619, 'menu.dashboard.smfCDR', 'SMF数据话单', 'SMF Data CDR'); +INSERT INTO `sys_i18n` VALUES (620, 'log.operate.title.smfCDR', 'SMF数据话单', 'SMF Data CDR'); INSERT INTO `sys_i18n` VALUES (621, 'config.sys.i18nDefaultRemark', '国际化默认语言可选择 en_US、zh_CN', 'Internationalization default language selectable en_US、zh_CN'); INSERT INTO `sys_i18n` VALUES (622, 'config.sys.i18nOpenRemark', '是否显示切换的控件 true/false', 'Whether to display switched controls true/false'); INSERT INTO `sys_i18n` VALUES (623, 'menu.dashboard.mmeUE', '4G 终端事件', '4G UE Events'); INSERT INTO `sys_i18n` VALUES (624, 'log.operate.title.mmeUE', '4G 终端事件', '4G UE Events'); INSERT INTO `sys_i18n` VALUES (625, 'menu.system.user.editPost', '修改用户岗位', 'Modify User Post'); -INSERT INTO `sys_i18n` VALUES (626, 'menu.dashboard.smscCDR', '短信话单', 'SMS CDR'); -INSERT INTO `sys_i18n` VALUES (627, 'log.operate.title.smscCDR', '短信话单', 'SMS CDR'); +INSERT INTO `sys_i18n` VALUES (626, 'menu.dashboard.smscCDR', 'SMSC短信话单', 'SMSC SMS CDR'); +INSERT INTO `sys_i18n` VALUES (627, 'log.operate.title.smscCDR', 'SMSC短信话单', 'SMSC SMS CDR'); INSERT INTO `sys_i18n` VALUES (628, 'menu.trace.pcapFile', '信令抓包文件', 'Signaling Capture File'); INSERT INTO `sys_i18n` VALUES (629, 'menu.trace.taskAnalyze', '网元跟踪任务分析', 'NE Trace Task Analysis'); INSERT INTO `sys_i18n` VALUES (630, 'job.ne_data_udm', '网元数据-UDM用户数据同步', 'NE Data-Sync UDM Data'); @@ -658,7 +658,7 @@ INSERT INTO `sys_i18n` VALUES (640, 'cache.name.oauth2_codes', '客户端授权 INSERT INTO `sys_i18n` VALUES (641, 'cache.name.oauth2_devices', '客户端令牌', 'Oauth2 Token'); INSERT INTO `sys_i18n` VALUES (642, 'job.backup_export_cdr', '备份-CDR数据定期导出', 'Backup-Periodic export of CDR Data'); INSERT INTO `sys_i18n` VALUES (643, 'job.backup_export_cdr_remark', 'dataType: 类型支持 ims/smf/sgwc/smsc\nfileType: 文件类型 csv/xlsx\nhour: 数据时间从任务执行时间前的小时数', 'Backup-Periodic export of dataType: type support ims/smf/sgwc/smsc\nfileType: file type csv/xlsx\nhour: data time from the hour before the task execution time'); -INSERT INTO `sys_i18n` VALUES (644, 'menu.log.exportFile', '导出文件', 'Exported File'); +-- INSERT INTO `sys_i18n` VALUES (644, 'menu.log.exportFile', '导出文件', 'Exported File'); INSERT INTO `sys_i18n` VALUES (645, 'menu.perf.kpiCReport', '自定义指标数据', 'Custom Indicator Data'); INSERT INTO `sys_i18n` VALUES (646, 'menu.trace.taskHLR', 'HLR 跟踪任务', 'HLR Trace Task'); INSERT INTO `sys_i18n` VALUES (647, 'dictType.cdr_cause_code', 'CDR 响应原因代码类别类型', 'CDR Response Reason Code Category Type'); diff --git a/build/database/std/install/trace_task.sql b/build/database/std/install/trace_task.sql index 11083ce0..61802d7d 100644 --- a/build/database/std/install/trace_task.sql +++ b/build/database/std/install/trace_task.sql @@ -1,7 +1,6 @@ -- -- Table structure for table `trace_task` -- - DROP TABLE IF EXISTS `trace_task`; CREATE TABLE `trace_task` ( `id` int NOT NULL AUTO_INCREMENT COMMENT 'ID', @@ -18,9 +17,8 @@ CREATE TABLE `trace_task` ( `create_time` bigint DEFAULT '0' COMMENT '创建时间', `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT '' COMMENT '任务标题', `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT '' COMMENT '备注', - `ne_list` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '网元列表 neType_neId 例如 UDM_001,AMF_001', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_list` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '网元列表 neUid,neUid', `notify_url` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '信息数据通知回调地址UDP 例如udp:192.168.5.58:33033', PRIMARY KEY (`id`) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='跟踪_任务'; - --- Dump completed on 2025-04-14 14:26:59 diff --git a/build/database/std/install/udm_auth.sql b/build/database/std/install/udm_auth.sql index 1f8c493f..200d04ee 100644 --- a/build/database/std/install/udm_auth.sql +++ b/build/database/std/install/udm_auth.sql @@ -1,19 +1,19 @@ -- -- Table structure for table `udm_auth` -- - DROP TABLE IF EXISTS `udm_auth`; CREATE TABLE `udm_auth` ( `id` int NOT NULL AUTO_INCREMENT COMMENT '主键', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', `imsi` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'SIM卡/USIM卡ID', - `ne_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'UDM网元标识', `amf` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'AMF', `status` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '状态', `ki` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'ki', `algo_index` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'algoIndex', `opc` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'OPC', PRIMARY KEY (`id`) USING BTREE, - UNIQUE KEY `uk_auth_imsi_ne` (`imsi`,`ne_id`) USING BTREE COMMENT 'imsi_neid唯一主键' + UNIQUE KEY `uk_udm_auth_imsi_ne` (`ne_uid`,`imsi`) USING BTREE COMMENT '唯一主键-IMSI_网元ID', + KEY `idx_udm_auth_uid_type` (`core_uid`,`ne_uid`,`ne_type`) USING BTREE COMMENT '索引-核心网_资源标识_类型' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='UDM用户数据_鉴权'; - --- Dump completed on 2025-02-14 15:26:56 diff --git a/build/database/std/install/udm_extend.sql b/build/database/std/install/udm_extend.sql index 75f1d33b..8e5d60c6 100644 --- a/build/database/std/install/udm_extend.sql +++ b/build/database/std/install/udm_extend.sql @@ -1,16 +1,16 @@ -- -- Table structure for table `udm_extend` -- - DROP TABLE IF EXISTS `udm_extend`; CREATE TABLE `udm_extend` ( `id` int NOT NULL AUTO_INCREMENT COMMENT '默认ID', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', `imsi` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'SIM卡/USIM卡ID', `msisdn` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '用户电话号码', - `ne_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'UDM网元标识', `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '备注', PRIMARY KEY (`id`) USING BTREE, - UNIQUE KEY `imsi_ne` (`imsi`,`ne_id`) USING BTREE COMMENT 'imsi_ne唯一索引' + UNIQUE KEY `uk_udm_extend_imsi_ne` (`ne_uid`,`imsi`,`msisdn`) USING BTREE COMMENT '唯一索引-SIM卡_网元标识', + KEY `idx_udm_extend_uid_type` (`core_uid`,`ne_uid`) USING BTREE COMMENT '索引-核心网_资源标识_类型' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='UDM用户数据_IMSI扩展信息'; - --- Dump completed on 2025-02-14 15:26:56 diff --git a/build/database/std/install/udm_sub.sql b/build/database/std/install/udm_sub.sql index 7e9075ed..6e833924 100644 --- a/build/database/std/install/udm_sub.sql +++ b/build/database/std/install/udm_sub.sql @@ -1,13 +1,14 @@ -- -- Table structure for table `udm_sub` -- - DROP TABLE IF EXISTS `udm_sub`; CREATE TABLE `udm_sub` ( `id` int NOT NULL AUTO_INCREMENT COMMENT '主键', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', `imsi` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'SIM卡/USIM卡ID', `msisdn` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '用户电话号码', - `ne_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'UDM网元标识', `am_dat` varchar(1500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'AmData', `ambr` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'AmData SubUeAMBRTemp', `nssai` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'AmData SubSNSSAITemp', @@ -36,7 +37,6 @@ CREATE TABLE `udm_sub` ( `smf_sel` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'smfSel', `cag` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'CAG', PRIMARY KEY (`id`) USING BTREE, - UNIQUE KEY `uk_sub_imsi_ne` (`imsi`,`ne_id`) USING BTREE COMMENT 'imsi_neid唯一主键' + UNIQUE KEY `uk_udm_sub_imsi_ne` (`ne_uid`,`imsi`,`msisdn`) USING BTREE COMMENT '唯一索引-SIM卡_网元标识', + KEY `idx_udm_sub_uid_type` (`core_uid`,`ne_uid`) USING BTREE COMMENT '索引-核心网_资源标识_类型' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='UDM用户数据_签约'; - --- Dump completed on 2025-02-14 15:26:56 diff --git a/build/database/std/install/udm_voip.sql b/build/database/std/install/udm_voip.sql index 37837eea..3f5d445c 100644 --- a/build/database/std/install/udm_voip.sql +++ b/build/database/std/install/udm_voip.sql @@ -1,15 +1,15 @@ -- -- Table structure for table `udm_voip` -- - DROP TABLE IF EXISTS `udm_voip`; CREATE TABLE `udm_voip` ( `id` int NOT NULL AUTO_INCREMENT COMMENT '主键', - `ne_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'UDM网元标识', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', `username` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '用户名', `password` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '密码', PRIMARY KEY (`id`) USING BTREE, - UNIQUE KEY `uk_voip_user_ne` (`username`,`ne_id`) USING BTREE COMMENT 'user_neid唯一主键' + UNIQUE KEY `uk_udm_voip_smsc_uid_type` (`ne_uid`,`username`) USING BTREE COMMENT '唯一主键-用户名_网元ID', + KEY `idx_udm_voip_uid_type` (`core_uid`,`ne_uid`) USING BTREE COMMENT '索引-核心网_资源标识_类型' ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='UDM用户数据_VOIP'; - --- Dump completed on 2025-04-22 15:26:56 diff --git a/build/database/std/install/udm_volte_ims.sql b/build/database/std/install/udm_volte_ims.sql index b2debc57..e476228a 100644 --- a/build/database/std/install/udm_volte_ims.sql +++ b/build/database/std/install/udm_volte_ims.sql @@ -1,18 +1,17 @@ -- -- Table structure for table `udm_volte_ims` -- - DROP TABLE IF EXISTS `udm_volte_ims`; CREATE TABLE `udm_volte_ims` ( `id` int NOT NULL AUTO_INCREMENT COMMENT '主键', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', `imsi` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'SIM卡/USIM卡ID', `msisdn` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '用户电话号码', - `ne_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'UDM网元标识', `tag` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '0=VoIP, 1=VoLTE', `vni` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'VNI', PRIMARY KEY (`id`) USING BTREE, - UNIQUE KEY `uk_volte_imsi_ne` (`imsi`,`msisdn`,`ne_id`) USING BTREE COMMENT 'imsi_msisdn_neid唯一主键', - KEY `idx_volte_tag` (`tag`) USING BTREE COMMENT 'tag索引' + UNIQUE KEY `uk_udm_volte_imsi_ne` (`ne_uid`,`imsi`,`msisdn`) USING BTREE COMMENT 'imsi_msisdn_neid唯一主键', + KEY `idx_udm_volte_uid_tag` (`core_uid`,`ne_uid`,`tag`) USING BTREE COMMENT '索引-核心网_资源标识_类型' ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='UDM用户数据_VolteIMS用户'; - --- Dump completed on 2025-04-22 15:26:56 diff --git a/build/database/std/install/ue_event.sql b/build/database/std/install/ue_event.sql index 7e5ad74e..474da052 100644 --- a/build/database/std/install/ue_event.sql +++ b/build/database/std/install/ue_event.sql @@ -4,15 +4,13 @@ DROP TABLE IF EXISTS `ue_event`; CREATE TABLE `ue_event` ( `id` int NOT NULL AUTO_INCREMENT, - `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `ne_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `rm_uid` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '可能没有', - `timestamp` bigint DEFAULT '48' COMMENT '接收到的时间', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', + `timestamp` bigint DEFAULT '0' COMMENT '接收到时间戳', `event_type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '事件类型', `event_json` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'data JSON String', `created_at` bigint DEFAULT '0' COMMENT '记录创建存储毫秒', PRIMARY KEY (`id`) USING BTREE, - KEY `idx_type_t` (`event_type`,`timestamp`) USING BTREE + KEY `idx_ue_uid_type_at` (`core_uid` DESC, `ne_uid` DESC,`event_type` DESC, `timestamp` DESC) USING BTREE COMMENT '索引-核心网_资源标识_类型_时间' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='UE事件_基础表结构'; - --- Dump completed on 2025-02-14 15:26:56 diff --git a/build/database/std/install/ue_event_amf.sql b/build/database/std/install/ue_event_amf.sql index 768e0826..b472f560 100644 --- a/build/database/std/install/ue_event_amf.sql +++ b/build/database/std/install/ue_event_amf.sql @@ -4,15 +4,15 @@ DROP TABLE IF EXISTS `ue_event_amf`; CREATE TABLE `ue_event_amf` ( `id` int NOT NULL AUTO_INCREMENT, - `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `ne_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `rm_uid` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '可能没有', - `timestamp` bigint DEFAULT '48' COMMENT '接收到的时间', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', + `timestamp` bigint DEFAULT '0' COMMENT '接收到时间戳', `event_type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '事件类型', `event_json` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'data JSON String', `created_at` bigint DEFAULT '0' COMMENT '记录创建存储毫秒', PRIMARY KEY (`id`) USING BTREE, - KEY `idx_amf_type_t` (`event_type`,`timestamp`) USING BTREE + KEY `idx_ue_amf_uid_type_at` (`core_uid` DESC, `ne_uid` DESC,`event_type` DESC, `timestamp` DESC) USING BTREE COMMENT '索引-核心网_资源标识_类型_时间' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='UE事件_AMF终端接入'; -- Dump completed on 2025-02-14 15:26:56 diff --git a/build/database/std/install/ue_event_mme.sql b/build/database/std/install/ue_event_mme.sql index e6548fce..4cc1d78c 100644 --- a/build/database/std/install/ue_event_mme.sql +++ b/build/database/std/install/ue_event_mme.sql @@ -4,15 +4,15 @@ DROP TABLE IF EXISTS `ue_event_mme`; CREATE TABLE `ue_event_mme` ( `id` int NOT NULL AUTO_INCREMENT, - `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `ne_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', - `rm_uid` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '可能没有', - `timestamp` bigint DEFAULT '48' COMMENT '接收到的时间', + `core_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '核心网唯一标识', + `ne_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '网元唯一标识', + `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网元类型', + `timestamp` bigint DEFAULT '0' COMMENT '接收到时间戳', `event_type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '事件类型', `event_json` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'data JSON String', `created_at` bigint DEFAULT '0' COMMENT '记录创建存储毫秒', PRIMARY KEY (`id`) USING BTREE, - KEY `idx_mme_type_t` (`event_type`,`timestamp`) USING BTREE + KEY `idx_ue_mme_uid_type_at` (`core_uid` DESC, `ne_uid` DESC,`event_type` DESC, `timestamp` DESC) USING BTREE COMMENT '索引-核心网_资源标识_类型_时间' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='UE事件_MME终端接入'; -- Dump completed on 2025-02-14 15:26:56 diff --git a/local/omc.yaml b/local/omc.yaml index 3c876f8f..27a08dec 100644 --- a/local/omc.yaml +++ b/local/omc.yaml @@ -47,7 +47,7 @@ database: port: 13306 # mysql port username: "root" # mysql username password: "1000omc@kp!" # mysql password - database: "omc_db_mainv2" # mysql database + database: "omc_db_mainv3" # mysql database logging: true # lite: lite lite: diff --git a/local/param/amf_param_config.yaml b/local/param/amf_param_config.yaml index c0677940..180ad498 100644 --- a/local/param/amf_param_config.yaml +++ b/local/param/amf_param_config.yaml @@ -469,23 +469,23 @@ amf: type: "int" value: "0" access: "read-only" - filter: "0~15" + filter: "0-32" display: "Index" - comment: "0~15" + comment: "Max 32" - name: "plmnId" type: "regex" value: "00101" access: "read-write" filter: "^[0-9]{5,6}$" display: "PLMN ID" - comment: "" + comment: "MCC and MNC is less than 6 digits." - name: "tac" type: "string" value: "1" access: "read-write" - filter: "0~8" + filter: "0-16777215" display: "TAC" - comment: "0~16777215" + comment: "Multiple TACs separated by commas (tac1,tac2)" slice: display: "AMF Support Slice List" sort: 11 diff --git a/local/param/pgwc_param_config.yaml b/local/param/pgwc_param_config.yaml new file mode 100644 index 00000000..2c7168c6 --- /dev/null +++ b/local/param/pgwc_param_config.yaml @@ -0,0 +1,534 @@ +pgwc: + pgwcSystem: + display: "PGWC Sytem Config" + sort: 1 + list: + - name: "s58Ip" + type: "string" + value: "172.16.5.151" + access: "read-write" + filter: '' + display: "Local S58 IP" + comment: "" + - name: "n4Ipv4" + type: "ipv4" + value: "172.16.5.150" + access: "read-write" + filter: "" + display: "N4 IPv4" + comment: "" + - name: "n4Ipv6" + type: "ipv6" + value: "" + access: "read-write" + filter: "" + display: "N4 IPv6" + comment: "" + - name: "n4UIpv4" + type: "ipv4" + value: "" + access: "read-write" + filter: "" + display: "N4U IPv4" + comment: "" + - name: "n4UIpv6" + type: "ipv6" + value: "" + access: "read-write" + filter: "" + display: "N4U IPv6" + comment: "" + - name: "gxEnable" + type: "bool" + value: "" + access: "read-write" + filter: '' + display: "Gx Policy Enable" + comment: "" + - name: "gxChargingEnable" + type: "bool" + value: "" + access: "read-write" + filter: '' + display: "Gx Charging Enable" + comment: "" + - name: "gyChargingEnable" + type: "bool" + value: "" + access: "read-write" + filter: '' + display: "Gy Charging Enable" + comment: "" + - name: "primaryDnsIpv4" + type: "ipv4" + value: "114.114.114.114" + access: "read-write" + filter: "" + display: "Primary DNS IPv4" + comment: "" + - name: "secondaryDnsIpv4" + type: "ipv4" + value: "" + access: "read-write" + filter: "" + display: "Secondary DNS IPv4" + comment: "" + - name: "primaryDnsIpv6" + type: "ipv6" + value: "" + access: "read-write" + filter: "" + display: "Primary DNS IPv6" + comment: "" + - name: "secondaryDnsIpv6" + type: "ipv6" + value: "" + access: "read-write" + filter: "" + display: "Secondary DNS IPv6" + comment: "" + - name: "primaryPcscfIpv4" + type: "ipv4" + value: "172.16.5.110" + access: "read-write" + filter: "" + display: "Primary PCSCF IPv4" + comment: "" + - name: "secondaryPcscfIpv4" + type: "ipv4" + value: "" + access: "read-write" + filter: "" + display: "Secondary PCSCF IPv4" + comment: "" + - name: "primaryPcscfIpv6" + type: "ipv6" + value: "" + access: "read-write" + filter: "" + display: "Primary PCSCF IPv6" + comment: "" + - name: "secondaryPcscfIpv6" + type: "ipv6" + value: "" + access: "read-write" + filter: "" + display: "Secondary PCSCF IPv6" + comment: "" + - name: "ueMtu" + type: "int" + value: "" + access: "read-write" + filter: "0~65535" + display: "UE MTU" + comment: "" + localDiameterConfig: + display: "Local Diameter Config" + sort: 3 + list: + - name: "ipAddr" + type: "string" + value: "172.16.5.150" + access: "read-write" + filter: '' + display: "Local Diameter IP" + comment: "" + - name: "hostName" + type: "string" + value: "pgwc.mnc001.mcc001.3gppnetwork.org" + access: "read-write" + filter: '' + display: "Local Diameter Host Name" + comment: "" + - name: "realmName" + type: "string" + value: "mnc001.mcc001.3gppnetwork.org" + access: "read-write" + filter: '' + display: "Local Diameter Realm Name" + comment: "" + - name: "gyServiceContextId" + type: "string" + value: "gy@3gpp" + access: "read-write" + filter: '' + display: "Local Gy Service Context ID" + comment: "" + - name: "gxServiceContextId" + type: "string" + value: "gx@3gpp" + access: "read-write" + filter: '' + display: "Local Gx Service Context ID" + comment: "" + remoteGyCfg: + display: "Remote Gy Config" + sort: 5 + list: + - name: "enable" + type: "bool" + value: 'false' + access: "read-write" + filter: "" + display: "Remote Gy Enable" + comment: "" + - name: "remoteAddrs" + type: "string" + value: "" + access: "read-write" + filter: '' + display: "Remote Gy Addresses" + comment: "e.g. ipv4:port;ipv4:port;ipv4:port" + remoteGxCfg: + display: "Remote Gx Config" + sort: 7 + list: + - name: "enable" + type: "bool" + value: 'false' + access: "read-write" + filter: "" + display: "Remote Gx Enable" + comment: "" + - name: "remoteAddrs" + type: "string" + value: "" + access: "read-write" + filter: '' + display: "Remote Gx Addresses" + comment: "e.g. ipv4:port;ipv4:port;ipv4:port" + upfConfig: + display: "UPF Config" + sort: 9 + array: + - name: "index" + type: "int" + value: "" + access: "read-only" + filter: "0~2047" + display: "Index" + comment: "" + - name: "id" + type: "string" + value: "" + access: "read-write" + filter: "1~64" + display: "UPF ID" + comment: "" + - name: "addr" + type: "string" + value: "" + access: "read-write" + filter: "7~45" + display: "Address" + comment: "e.g. ip:port" + - name: "ipPoolType" + type: "string" + value: "IPv4v6" + access: "read-write" + filter: "" + display: "Ip Pool Type" + comment: "IPv4,IPv6,IPv4v6" + - name: "ipv4Pools" + type: "string" + value: "" + access: "read-write" + filter: "10~256" + display: "IPv4 Pools" + comment: "CIDR format, e.g. 192.168.1.0/24" + - name: "ipv6Pools" + type: "string" + value: "" + access: "read-write" + filter: "5~512" + display: "IPv6 Pools" + comment: "CIDR format, e.g. fe80::20c:29ff:fee4:dab7/50" + - name: "staticIpv4Enable" + type: "bool" + value: "false" + access: "read-write" + filter: "" + display: "Static IPv4 Enable" + comment: "" + - name: "staticIpv4Start" + type: "ipv4" + value: "" + access: "read-write" + filter: "" + display: "Static IPv4 Start" + comment: "ipv4 format" + - name: "staticIpv4End" + type: "ipv4" + value: "" + access: "read-write" + filter: "" + display: "Static IPv4 End" + comment: "ipv4 format" + - name: "staticIpv6Enable" + type: "bool" + value: "false" + access: "read-write" + filter: "" + display: "Static IPv6 Enable" + comment: "" + - name: "staticIpv6Start" + type: "ipv6" + value: "" + access: "read-write" + filter: "" + display: "Static IPv6 Start" + comment: "ipv6 format" + - name: "staticIpv6End" + type: "ipv6" + value: "" + access: "read-write" + filter: "" + display: "Static IPv6 End" + comment: "ipv6 format" + - name: "ueDnnIpPool" + display: "UE DNN IP Pool" + array: + - name: "index" + type: "int" + value: "" + access: "read-only" + filter: "0~2047" + display: "Index" + comment: "" + - name: "dnn" + type: "string" + value: "" + access: "read-write" + filter: "1~64" + display: "DNN" + comment: "" + - name: "ipPoolType" + type: "string" + value: "IPv4v6" + access: "read-write" + filter: "" + display: "Ip Pool Type" + comment: "IPv4,IPv6,IPv4v6" + - name: "ipv4Pools" + type: "string" + value: "" + access: "read-write" + filter: "10~256" + display: "IPv4 Pools" + comment: "CIDR format, e.g. 192.168.1.0/24" + - name: "ipv6Pools" + type: "string" + value: "" + access: "read-write" + filter: "5~512" + display: "IPv6 Pools" + comment: "CIDR format, e.g. fe80::20c:29ff:fee4:dab7/50" + - name: "staticIpv4Enable" + type: "bool" + value: "false" + access: "read-write" + filter: "" + display: "Static IPv4 Enable" + comment: "" + - name: "staticIpv4Start" + type: "ipv4" + value: "" + access: "read-write" + filter: "" + display: "Static IPv4 Start" + comment: "ipv4 format" + - name: "staticIpv4End" + type: "ipv4" + value: "" + access: "read-write" + filter: "" + display: "Static IPv4 End" + comment: "ipv4 format" + - name: "staticIpv6Enable" + type: "bool" + value: "false" + access: "read-write" + filter: "" + display: "Static IPv6 Enable" + comment: "" + - name: "staticIpv6Start" + type: "ipv6" + value: "" + access: "read-write" + filter: "" + display: "Static IPv6 Start" + comment: "ipv6 format" + - name: "staticIpv6End" + type: "ipv6" + value: "" + access: "read-write" + filter: "" + display: "Static IPv6 End" + comment: "ipv6 format" + dnnSelectUpf: + display: "DNN Select UPF" + sort: 11 + array: + - name: "index" + type: "int" + value: "0" + access: "read-only" + filter: "0~65535" + display: "Index" + comment: "" + - name: "dnn" + type: "string" + value: "" + access: "read-write" + filter: "1~64" + display: "DNN" + comment: "" + - name: "upfId" + type: "string" + value: "" + access: "read-write" + filter: "1~64" + display: "UPF ID" + comment: "" + dnnTaiSelectUpf: + display: "DNN TAI Select UPF" + sort: 13 + array: + - name: "index" + type: "int" + value: "" + access: "read-only" + filter: "0~65535" + display: "Index" + comment: "" + - name: "dnn" + type: "string" + value: "" + access: "read-write" + filter: "1~64" + display: "DNN" + comment: "" + - name: "tai" + type: "string" + value: "" + access: "read-write" + filter: "1~64" + display: "TAI" + comment: "MCC+MNC+TAC" + - name: "upfId" + type: "string" + value: "upf2-Id" + access: "read-write" + filter: "1~64" + display: "UPF ID" + comment: "" + localDhcpCfg: + display: "Local DHCP Config" + sort: 15 + list: + - name: "enable" + type: "bool" + value: "false" + access: "read-write" + filter: "" + display: "Enable" + comment: "" + - name: "localIp" + type: "string" + value: "" + access: "read-write" + filter: "" + display: "Local IP" + comment: "" + dnnselectdhcpserver: + display: "DNN Select DHCP Server" + sort: 17 + array: + - name: "index" + type: "int" + value: "" + access: "read-only" + filter: "0~65535" + display: "Index" + comment: "" + - name: "enable" + type: "bool" + value: "false" + access: "read-write" + filter: "" + display: "Enable" + comment: "" + - name: "dnn" + type: "string" + value: "" + access: "read-write" + filter: "1~64" + display: "DNN" + comment: "" + - name: "dhcpServerAddr" + type: "string" + value: "" + access: "read-write" + filter: "" + display: "DHCP Server IP" + comment: "e.g. 192.168.1.1" + offlineChargingConfig: + display: "Offline Charging Config" + sort: 19 + list: + - name: "cdrFileName" + type: "string" + value: "smf.cdr" + access: "read-write" + filter: "1~64" + display: "CDR File Name" + comment: "" + - name: "cdrFilePath" + type: "string" + value: "/var/log/smfCdr" + access: "read-write" + filter: "1~256" + display: "CDR File Path" + comment: "" + - name: "cdrFileNum" + type: "int" + value: "50" + access: "read-write" + filter: "1~999999999" + display: "CDR File Num" + comment: "" + - name: "cdrFileSize" + type: "int" + value: "300" + access: "read-write" + filter: "1~999999" + display: "CDR File Size" + comment: "Megabytes" + - name: "cdrFileMaxAge" + type: "int" + value: "30" + access: "read-write" + filter: "0~9999" + display: "CDR File Max Age" + comment: "Days" + - name: "freeSubsCdrEnable" + type: "bool" + value: "false" + access: "read-write" + filter: "" + display: "Free Subscribers CDR Enable" + comment: "" + - name: "timeThreshold" + type: "int" + value: "600" + access: "read-write" + filter: "0~999999999" + display: "Time Threshold" + comment: "Seconds" + - name: "volumeThreshold" + type: "int" + value: "0" + access: "read-write" + filter: "0~999999999999999" + display: "Volume Threshold" + comment: "Bytes" diff --git a/src/app.go b/src/app.go index ec80a4a0..d565d2c2 100644 --- a/src/app.go +++ b/src/app.go @@ -11,6 +11,7 @@ import ( "be.ems/src/modules/auth" "be.ems/src/modules/chart" "be.ems/src/modules/common" + "be.ems/src/modules/core" "be.ems/src/modules/crontask" "be.ems/src/modules/monitor" ne "be.ems/src/modules/ne" @@ -89,6 +90,8 @@ func ModulesRoute(app *gin.Engine) { // 通用模块 common.Setup(app) + // 核心网功能模块 + core.Setup(app) // 网元功能模块 ne.Setup(app) // 网元数据模块 diff --git a/src/modules/core/controller/core_info.go b/src/modules/core/controller/core_info.go index fa0acaa4..8f456cc1 100644 --- a/src/modules/core/controller/core_info.go +++ b/src/modules/core/controller/core_info.go @@ -41,7 +41,6 @@ type CoreInfoController struct { // @Description The list of network element information is all unpaginated // @Router /core/info/list/all [get] func (s CoreInfoController) ListAll(c *gin.Context) { - language := reqctx.AcceptLanguage(c) var querys struct { CoreUID string `form:"coreUid"` // 核心网唯一标识 Name string `form:"name"` // 名称 @@ -66,7 +65,7 @@ func (s CoreInfoController) ListAll(c *gin.Context) { } neList := s.coreInfoService.Find(core) if len(neList) == 0 { - c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) + c.JSON(200, resp.ErrMsg("not found data")) return } c.JSON(200, resp.OkData(neList)) diff --git a/src/modules/crontask/processor/backup_export_cdr/backup_export_cdr.go b/src/modules/crontask/processor/backup_export_cdr/backup_export_cdr.go index e1e7646f..7e0eeadd 100644 --- a/src/modules/crontask/processor/backup_export_cdr/backup_export_cdr.go +++ b/src/modules/crontask/processor/backup_export_cdr/backup_export_cdr.go @@ -65,22 +65,22 @@ func (s *BackupExportCDRProcessor) Execute(data any) (any, error) { case "ims": neList := s.neInfoService.Find(neModel.NeInfo{NeType: "IMS"}, false, false) for _, ne := range neList { - result[ne.NeName] = s.exportIMS(params.Hour, ne.RmUID, params.FileType) + result[ne.NeName] = s.exportIMS(ne.CoreUID, ne.NeUID, params.Hour, params.FileType) } case "smsc": neList := s.neInfoService.Find(neModel.NeInfo{NeType: "SMSC"}, false, false) for _, ne := range neList { - result[ne.NeName] = s.exportSMSC(params.Hour, ne.RmUID, params.FileType) + result[ne.NeName] = s.exportSMSC(ne.CoreUID, ne.NeUID, params.Hour, params.FileType) } case "smf": neList := s.neInfoService.Find(neModel.NeInfo{NeType: "SMF"}, false, false) for _, ne := range neList { - result[ne.NeName] = s.exportSMF(params.Hour, ne.RmUID, params.FileType) + result[ne.NeName] = s.exportSMF(ne.CoreUID, ne.NeUID, params.Hour, params.FileType) } case "sgwc": neList := s.neInfoService.Find(neModel.NeInfo{NeType: "SGWC"}, false, false) for _, ne := range neList { - result[ne.NeName] = s.exportSGWC(params.Hour, ne.RmUID, params.FileType) + result[ne.NeName] = s.exportSGWC(ne.CoreUID, ne.NeUID, params.Hour, params.FileType) } } } @@ -90,7 +90,7 @@ func (s *BackupExportCDRProcessor) Execute(data any) (any, error) { } // exportIMS 导出IMS-CDR会话事件数据 -func (s BackupExportCDRProcessor) exportIMS(hour int, rmUID, fileType string) string { +func (s BackupExportCDRProcessor) exportIMS(coreUid, neUid string, hour int, fileType string) string { // 前 hour 小时 now := time.Now() end := time.Date(now.Year(), now.Month(), now.Day(), now.Hour(), 0, 0, 0, now.Location()) @@ -100,11 +100,12 @@ func (s BackupExportCDRProcessor) exportIMS(hour int, rmUID, fileType string) st query := map[string]string{ "sortField": "timestamp", "sortOrder": "asc", - "rmUID": rmUID, + "coreUid": coreUid, + "neUid": neUid, "beginTime": fmt.Sprint(start.UnixMilli()), "endTime": fmt.Sprint(end.UnixMilli()), "pageNum": fmt.Sprint(1), - "pageSize": fmt.Sprint(30000), + "pageSize": fmt.Sprint(1000_0000), } rows, total := s.cdrEventService.FindByPage("IMS", query) if total == 0 { @@ -113,7 +114,7 @@ func (s BackupExportCDRProcessor) exportIMS(hour int, rmUID, fileType string) st // 导出文件名称 fileName := fmt.Sprintf("ims_cdr_event_export_%d_%s.%s", len(rows), date.ParseDateToStr(end, date.YYYYMMDDHHMMSS), fileType) - filePath := filepath.Join(s.backupService.BACKUP_DIR, "/cdr/ims_cdr_event", fileName) + filePath := filepath.Join(s.backupService.BACKUP_DIR, "/cdr/ims_cdr_event", coreUid, neUid, fileName) if runtime.GOOS == "windows" { filePath = fmt.Sprintf("C:%s", filePath) } @@ -225,7 +226,7 @@ func (s BackupExportCDRProcessor) exportIMS(hour int, rmUID, fileType string) st data = append(data, []string{ fmt.Sprint(row.ID), - row.NeName, + row.NeUID, recordType, callTypeLable, caller, @@ -352,7 +353,7 @@ func (s BackupExportCDRProcessor) exportIMS(hour int, rmUID, fileType string) st dataCells = append(dataCells, map[string]any{ "A" + idx: row.ID, - "B" + idx: row.NeName, + "B" + idx: row.NeUID, "C" + idx: recordType, "D" + idx: callTypeLable, "E" + idx: caller, @@ -379,7 +380,7 @@ func (s BackupExportCDRProcessor) exportIMS(hour int, rmUID, fileType string) st } // exportSMSC 导出SMSC-CDR会话事件数据 -func (s BackupExportCDRProcessor) exportSMSC(hour int, rmUID, fileType string) string { +func (s BackupExportCDRProcessor) exportSMSC(coreUid, neUid string, hour int, fileType string) string { // 前 hour 小时 now := time.Now() end := time.Date(now.Year(), now.Month(), now.Day(), now.Hour(), 0, 0, 0, now.Location()) @@ -389,11 +390,12 @@ func (s BackupExportCDRProcessor) exportSMSC(hour int, rmUID, fileType string) s query := map[string]string{ "sortField": "timestamp", "sortOrder": "asc", - "rmUID": rmUID, + "coreUid": coreUid, + "neUid": neUid, "beginTime": fmt.Sprint(start.UnixMilli()), "endTime": fmt.Sprint(end.UnixMilli()), "pageNum": fmt.Sprint(1), - "pageSize": fmt.Sprint(30000), + "pageSize": fmt.Sprint(1000_0000), } rows, total := s.cdrEventService.FindByPage("SMSC", query) if total == 0 { @@ -402,7 +404,7 @@ func (s BackupExportCDRProcessor) exportSMSC(hour int, rmUID, fileType string) s // 导出文件名称 fileName := fmt.Sprintf("smsc_cdr_event_export_%d_%s.%s", len(rows), date.ParseDateToStr(end, date.YYYYMMDDHHMMSS), fileType) - filePath := filepath.Join(s.backupService.BACKUP_DIR, "/cdr/smsc_cdr_event", fileName) + filePath := filepath.Join(s.backupService.BACKUP_DIR, "/cdr/smsc_cdr_event", coreUid, neUid, fileName) if runtime.GOOS == "windows" { filePath = fmt.Sprintf("C:%s", filePath) } @@ -481,7 +483,7 @@ func (s BackupExportCDRProcessor) exportSMSC(hour int, rmUID, fileType string) s data = append(data, []string{ fmt.Sprint(row.ID), - row.NeName, + row.NeUID, recordType, serviceType, caller, @@ -572,7 +574,7 @@ func (s BackupExportCDRProcessor) exportSMSC(hour int, rmUID, fileType string) s dataCells = append(dataCells, map[string]any{ "A" + idx: row.ID, - "B" + idx: row.NeName, + "B" + idx: row.NeUID, "C" + idx: recordType, "D" + idx: serviceType, "E" + idx: caller, @@ -596,7 +598,7 @@ func (s BackupExportCDRProcessor) exportSMSC(hour int, rmUID, fileType string) s } // exportSMF 导出SMF-CDR会话事件数据 -func (s BackupExportCDRProcessor) exportSMF(hour int, rmUID, fileType string) string { +func (s BackupExportCDRProcessor) exportSMF(coreUid, neUid string, hour int, fileType string) string { // 前 hour 小时 now := time.Now() end := time.Date(now.Year(), now.Month(), now.Day(), now.Hour(), 0, 0, 0, now.Location()) @@ -605,11 +607,12 @@ func (s BackupExportCDRProcessor) exportSMF(hour int, rmUID, fileType string) st query := map[string]string{ "sortField": "timestamp", "sortOrder": "asc", - "rmUID": rmUID, + "coreUid": coreUid, + "neUid": neUid, "beginTime": fmt.Sprint(start.UnixMilli()), "endTime": fmt.Sprint(end.UnixMilli()), "pageNum": fmt.Sprint(1), - "pageSize": fmt.Sprint(30000), + "pageSize": fmt.Sprint(1000_0000), } rows, total := s.cdrEventService.FindByPage("SMF", query) if total == 0 { @@ -618,7 +621,7 @@ func (s BackupExportCDRProcessor) exportSMF(hour int, rmUID, fileType string) st // 导出文件名称 fileName := fmt.Sprintf("smf_cdr_event_export_%d_%s.%s", len(rows), date.ParseDateToStr(end, date.YYYYMMDDHHMMSS), fileType) - filePath := filepath.Join(s.backupService.BACKUP_DIR, "/cdr/smf_cdr_event", fileName) + filePath := filepath.Join(s.backupService.BACKUP_DIR, "/cdr/smf_cdr_event", coreUid, neUid, fileName) if runtime.GOOS == "windows" { filePath = fmt.Sprintf("C:%s", filePath) } @@ -780,8 +783,8 @@ func (s BackupExportCDRProcessor) exportSMF(hour int, rmUID, fileType string) st data = append(data, []string{ fmt.Sprint(row.ID), chargingID, - row.NeName, - row.RmUid, + row.NeType, + row.NeUID, subscriptionIDData, subscriptionIDType, fmt.Sprint(dataVolumeUplink), @@ -967,8 +970,8 @@ func (s BackupExportCDRProcessor) exportSMF(hour int, rmUID, fileType string) st dataCells = append(dataCells, map[string]any{ "A" + idx: row.ID, "B" + idx: chargingID, - "C" + idx: row.NeName, - "D" + idx: row.RmUid, + "C" + idx: row.NeType, + "D" + idx: row.NeUID, "E" + idx: subscriptionIDData, "F" + idx: subscriptionIDType, "G" + idx: dataVolumeUplink, @@ -1004,7 +1007,7 @@ func (s BackupExportCDRProcessor) exportSMF(hour int, rmUID, fileType string) st } // exportSGWC 导出SGWC-CDR会话事件数据 -func (s BackupExportCDRProcessor) exportSGWC(hour int, rmUID, fileType string) string { +func (s BackupExportCDRProcessor) exportSGWC(coreUid, neUid string, hour int, fileType string) string { // 前 hour 小时 now := time.Now() end := time.Date(now.Year(), now.Month(), now.Day(), now.Hour(), 0, 0, 0, now.Location()) @@ -1013,11 +1016,12 @@ func (s BackupExportCDRProcessor) exportSGWC(hour int, rmUID, fileType string) s query := map[string]string{ "sortField": "timestamp", "sortOrder": "asc", - "rmUID": rmUID, + "coreUid": coreUid, + "neUid": neUid, "beginTime": fmt.Sprint(start.UnixMilli()), "endTime": fmt.Sprint(end.UnixMilli()), "pageNum": fmt.Sprint(1), - "pageSize": fmt.Sprint(30000), + "pageSize": fmt.Sprint(1000_0000), } rows, total := s.cdrEventService.FindByPage("SGWC", query) if total == 0 { @@ -1026,7 +1030,7 @@ func (s BackupExportCDRProcessor) exportSGWC(hour int, rmUID, fileType string) s // 导出文件名称 fileName := fmt.Sprintf("sgwc_cdr_event_export_%d_%s.%s", len(rows), date.ParseDateToStr(end, date.YYYYMMDDHHMMSS), fileType) - filePath := filepath.Join(s.backupService.BACKUP_DIR, "/cdr/sgwc_cdr_event", fileName) + filePath := filepath.Join(s.backupService.BACKUP_DIR, "/cdr/sgwc_cdr_event", coreUid, neUid, fileName) if runtime.GOOS == "windows" { filePath = fmt.Sprintf("C:%s", filePath) } @@ -1190,8 +1194,8 @@ func (s BackupExportCDRProcessor) exportSGWC(hour int, rmUID, fileType string) s data = append(data, []string{ fmt.Sprint(row.ID), - row.NeName, - row.RmUid, + row.NeType, + row.NeUID, chargingID, servedIMSI, servedMSISDN, @@ -1381,8 +1385,8 @@ func (s BackupExportCDRProcessor) exportSGWC(hour int, rmUID, fileType string) s dataCells = append(dataCells, map[string]any{ "A" + idx: row.ID, - "B" + idx: row.NeName, - "C" + idx: row.RmUid, + "B" + idx: row.NeType, + "C" + idx: row.NeUID, "D" + idx: chargingID, "E" + idx: servedIMSI, "F" + idx: servedMSISDN, diff --git a/src/modules/crontask/processor/backup_export_table/backup_export_table.go b/src/modules/crontask/processor/backup_export_table/backup_export_table.go index 1133470c..34972f6e 100644 --- a/src/modules/crontask/processor/backup_export_table/backup_export_table.go +++ b/src/modules/crontask/processor/backup_export_table/backup_export_table.go @@ -343,8 +343,8 @@ func (s BackupExportTableProcessor) exportSMF(hour int, columns []string, filePa if col == "id" { arr[i] = fmt.Sprintf("%d", row.ID) } - if col == "neName" || col == "ne_name" { - arr[i] = fmt.Sprintf("%v", row.NeName) + if col == "neType" || col == "ne_type" { + arr[i] = fmt.Sprintf("%v", row.NeType) } // 单层json if strings.HasPrefix("json", col) { @@ -462,8 +462,8 @@ func (s BackupExportTableProcessor) exportIMS(hour int, columns []string, filePa if col == "id" { arr[i] = fmt.Sprintf("%d", row.ID) } - if col == "neName" || col == "ne_name" { - arr[i] = fmt.Sprintf("%v", row.NeName) + if col == "neType" || col == "ne_type" { + arr[i] = fmt.Sprintf("%v", row.NeType) } // 单层json if strings.HasPrefix("json", col) { @@ -652,8 +652,8 @@ func (s BackupExportTableProcessor) exportSMSC(hour int, columns []string, fileP if v == "id" { arr[i] = fmt.Sprintf("%d", row.ID) } - if v == "neName" || v == "ne_name" { - arr[i] = fmt.Sprintf("%v", row.NeName) + if v == "neType" || v == "ne_type" { + arr[i] = fmt.Sprintf("%v", row.NeType) } // 单层json if strings.HasPrefix("json", v) { @@ -841,8 +841,8 @@ func (s BackupExportTableProcessor) exportSGWC(hour int, columns []string, fileP if v == "id" { arr[i] = fmt.Sprintf("%d", row.ID) } - if v == "neName" || v == "ne_name" { - arr[i] = fmt.Sprintf("%v", row.NeName) + if v == "neType" || v == "ne_type" { + arr[i] = fmt.Sprintf("%v", row.NeType) } // 单层json if strings.HasPrefix("json", v) { diff --git a/src/modules/crontask/processor/backup_export_udm/backup_export_udm.go b/src/modules/crontask/processor/backup_export_udm/backup_export_udm.go index dacd60d5..8c65f36a 100644 --- a/src/modules/crontask/processor/backup_export_udm/backup_export_udm.go +++ b/src/modules/crontask/processor/backup_export_udm/backup_export_udm.go @@ -63,13 +63,13 @@ func (s *BackupExportUDMProcessor) Execute(data any) (any, error) { for _, v := range params.DataType { switch v { case "auth": - result[fmt.Sprintf("%s-%s", neInfo.NeId, v)] = s.exportAuth(neInfo.NeId, params.FileType) + result[fmt.Sprintf("%s-%s", neInfo.NeUID, v)] = s.exportAuth(neInfo.CoreUID, neInfo.NeUID, params.FileType) case "sub": - result[fmt.Sprintf("%s-%s", neInfo.NeId, v)] = s.exportSub(neInfo.NeId, params.FileType) + result[fmt.Sprintf("%s-%s", neInfo.NeUID, v)] = s.exportSub(neInfo.CoreUID, neInfo.NeUID, params.FileType) case "voip": - result[fmt.Sprintf("%s-%s", neInfo.NeId, v)] = s.exportVOIP(neInfo.NeId, params.FileType) + result[fmt.Sprintf("%s-%s", neInfo.NeUID, v)] = s.exportVOIP(neInfo.CoreUID, neInfo.NeUID, params.FileType) case "volte": - result[fmt.Sprintf("%s-%s", neInfo.NeId, v)] = s.exportVolte(neInfo.NeId, params.FileType) + result[fmt.Sprintf("%s-%s", neInfo.NeUID, v)] = s.exportVolte(neInfo.CoreUID, neInfo.NeUID, params.FileType) } } } @@ -79,14 +79,14 @@ func (s *BackupExportUDMProcessor) Execute(data any) (any, error) { } // exportAuth 导出鉴权用户数据 -func (s BackupExportUDMProcessor) exportAuth(neId, fileType string) string { - rows := s.udmAuthService.Find(neDataModel.UDMAuthUser{NeId: neId}) +func (s BackupExportUDMProcessor) exportAuth(coreUid, neUid, fileType string) string { + rows := s.udmAuthService.Find(neDataModel.UDMAuthUser{CoreUID: coreUid, NeUID: neUid}) if len(rows) <= 0 { return "no data" } // 文件名 - fileName := fmt.Sprintf("auth_%s_export_%s.%s", neId, time.Now().Format("20060102150405"), fileType) + fileName := fmt.Sprintf("auth_%s_export_%s.%s", neUid, time.Now().Format("20060102150405"), fileType) filePath := filepath.Join("/usr/local/omc/backup/udm_data/auth", fileName) if runtime.GOOS == "windows" { filePath = fmt.Sprintf("C:%s", filePath) @@ -133,14 +133,14 @@ func (s BackupExportUDMProcessor) exportAuth(neId, fileType string) string { } // exportSub 导出签约用户数据 -func (s BackupExportUDMProcessor) exportSub(neId, fileType string) string { - rows := s.udmSubService.Find(neDataModel.UDMSubUser{NeId: neId}) +func (s BackupExportUDMProcessor) exportSub(coreUid, neUid, fileType string) string { + rows := s.udmSubService.Find(neDataModel.UDMSubUser{CoreUID: coreUid, NeUID: neUid}) if len(rows) <= 0 { return "no data" } // 文件名 - fileName := fmt.Sprintf("sub_%s_export_%s.%s", neId, time.Now().Format("20060102150405"), fileType) + fileName := fmt.Sprintf("sub_%s_export_%s.%s", neUid, time.Now().Format("20060102150405"), fileType) filePath := filepath.Join("/usr/local/omc/backup/udm_data/sub", fileName) if runtime.GOOS == "windows" { filePath = fmt.Sprintf("C:%s", filePath) @@ -181,14 +181,14 @@ func (s BackupExportUDMProcessor) exportSub(neId, fileType string) string { } // exportVOIP 导出VOIP用户数据 -func (s BackupExportUDMProcessor) exportVOIP(neId, fileType string) string { - rows := s.udmVOIPService.Find(neDataModel.UDMVOIPUser{NeId: neId}) +func (s BackupExportUDMProcessor) exportVOIP(coreUid, neUid, fileType string) string { + rows := s.udmVOIPService.Find(neDataModel.UDMVOIPUser{CoreUID: coreUid, NeUID: neUid}) if len(rows) <= 0 { return "no data" } // 文件名 - fileName := fmt.Sprintf("voip_%s_export_%s.%s", neId, time.Now().Format("20060102150405"), fileType) + fileName := fmt.Sprintf("voip_%s_export_%s.%s", neUid, time.Now().Format("20060102150405"), fileType) filePath := filepath.Join("/usr/local/omc/backup/udm_data/voip", fileName) if runtime.GOOS == "windows" { filePath = fmt.Sprintf("C:%s", filePath) @@ -227,14 +227,14 @@ func (s BackupExportUDMProcessor) exportVOIP(neId, fileType string) string { } // exportVolte 导出Volte用户数据 -func (s BackupExportUDMProcessor) exportVolte(neId, fileType string) string { - rows := s.udmVolteIMSService.Find(neDataModel.UDMVolteIMSUser{NeId: neId}) +func (s BackupExportUDMProcessor) exportVolte(coreUid, neUid, fileType string) string { + rows := s.udmVolteIMSService.Find(neDataModel.UDMVolteIMSUser{CoreUID: coreUid, NeUID: neUid}) if len(rows) <= 0 { return "no data" } // 文件名 - fileName := fmt.Sprintf("volte_%s_export_%s.%s", neId, time.Now().Format("20060102150405"), fileType) + fileName := fmt.Sprintf("volte_%s_export_%s.%s", neUid, time.Now().Format("20060102150405"), fileType) filePath := filepath.Join("/usr/local/omc/backup/udm_data/volte", fileName) if runtime.GOOS == "windows" { filePath = fmt.Sprintf("C:%s", filePath) diff --git a/src/modules/crontask/processor/delete_ne_config_backup/delete_ne_config_backup.go b/src/modules/crontask/processor/delete_ne_config_backup/delete_ne_config_backup.go index 678f5b67..07b886a4 100644 --- a/src/modules/crontask/processor/delete_ne_config_backup/delete_ne_config_backup.go +++ b/src/modules/crontask/processor/delete_ne_config_backup/delete_ne_config_backup.go @@ -55,18 +55,17 @@ func (s *DeleteNeConfigBackupProcessor) Execute(data any) (any, error) { neList := s.neInfoService.Find(neModel.NeInfo{}, false, false) for _, neInfo := range neList { - neTypeAndId := fmt.Sprintf("%s_%s", neInfo.NeType, neInfo.NeId) tx := db.DB("").Model(&neModel.NeConfigBackup{}) - tx = tx.Where("ne_type = ? and ne_id = ?", neInfo.NeType, neInfo.NeId) + tx = tx.Where("core_uid = ? and ne_uid = ?", neInfo.CoreUID, neInfo.NeUID) // 查询数量为0直接返回 var total int64 = 0 if err := tx.Count(&total).Error; err != nil { - result[neTypeAndId] = err.Error() + result[neInfo.NeUID] = err.Error() continue } if total <= int64(params.StoreNum) { - result[neTypeAndId] = "less than storeNum" + result[neInfo.NeUID] = "less than storeNum" continue } @@ -74,11 +73,11 @@ func (s *DeleteNeConfigBackupProcessor) Execute(data any) (any, error) { var lastCreateTime int64 = 0 lastTx := tx.Select("create_time").Order("create_time DESC").Limit(1) if err := lastTx.Find(&lastCreateTime).Error; err != nil { - result[neTypeAndId] = err.Error() + result[neInfo.NeUID] = err.Error() continue } if lastCreateTime <= 1e12 { - result[neTypeAndId] = "no data" + result[neInfo.NeUID] = "no data" continue } @@ -89,22 +88,22 @@ func (s *DeleteNeConfigBackupProcessor) Execute(data any) (any, error) { // 删除小于最后时间的数据 delTx := tx.Delete("create_time < ?", ltTime.UnixMilli()) if err := delTx.Error; err != nil { - result[neTypeAndId] = err.Error() + result[neInfo.NeUID] = err.Error() continue } - result[neTypeAndId] = tx.RowsAffected + result[neInfo.NeUID] = tx.RowsAffected // 删除本地文件 - s.deleteFile(neInfo.NeType, neInfo.NeId, ltTime) + s.deleteFile(neInfo.CoreUID, neInfo.NeUID, ltTime) } return result, nil } // deleteFile 删除本地文件 -func (s DeleteNeConfigBackupProcessor) deleteFile(neType, neId string, oldFileDate time.Time) { +func (s DeleteNeConfigBackupProcessor) deleteFile(neType, neUid string, oldFileDate time.Time) { neTypeLower := strings.ToLower(neType) - localPath := fmt.Sprintf("/usr/local/omc/backup/ne_config/%s/%s ", neTypeLower, neId) + localPath := fmt.Sprintf("/usr/local/omc/backup/ne_config/%s/%s ", neTypeLower, neUid) files, err := os.ReadDir(localPath) if err != nil { logger.Errorf("logger Remove ne_config File ReadDir err: %v", err.Error()) @@ -113,7 +112,7 @@ func (s DeleteNeConfigBackupProcessor) deleteFile(neType, neId string, oldFileDa for _, file := range files { // 跳过非指定文件名 // zipFileName := fmt.Sprintf("%s-%s-etc-%s.zip", neTypeLower, neInfo.NeId, date.ParseDateToStr(time.Now(), date.YYYYMMDDHHMMSS)) - fileName := fmt.Sprintf("%s-%s-etc-", neTypeLower, neId) + fileName := fmt.Sprintf("%s-%s-etc-", neTypeLower, neUid) if !strings.HasPrefix(file.Name(), fileName) { continue } diff --git a/src/modules/crontask/processor/ne_alarm_state_check/ne_alarm_state_check.go b/src/modules/crontask/processor/ne_alarm_state_check/ne_alarm_state_check.go index a91663b0..c0736a5f 100644 --- a/src/modules/crontask/processor/ne_alarm_state_check/ne_alarm_state_check.go +++ b/src/modules/crontask/processor/ne_alarm_state_check/ne_alarm_state_check.go @@ -75,7 +75,7 @@ func (s *NeAlarmStateCheckProcessor) Execute(data any) (any, error) { } // 创建告警 alarm := oam.Alarm{ - NeUid: neInfo.RmUID, // 网元唯一标识 + NeUid: neInfo.NeUID, // 网元唯一标识 AlarmTime: time.Now().UnixMilli(), // 事件产生时间 AlarmId: params.AlarmId, // 告警ID 唯一,清除时对应 AlarmCode: constants.ALARM_STATE_CHECK, // 告警状态码 @@ -89,7 +89,7 @@ func (s *NeAlarmStateCheckProcessor) Execute(data any) (any, error) { LocationInfo: "NE State: Heartbeat", // 告警定位信息 } if err = oamService.NewAlarm.Resolve(alarm); err == nil { - result[neInfo.RmUID] = "state alarm" + result[neInfo.NeUID] = "state alarm" } } diff --git a/src/modules/crontask/processor/ne_alarm_state_check_cmd/ne_alarm_state_check_cmd.go b/src/modules/crontask/processor/ne_alarm_state_check_cmd/ne_alarm_state_check_cmd.go index 0ed093ac..c64e29e3 100644 --- a/src/modules/crontask/processor/ne_alarm_state_check_cmd/ne_alarm_state_check_cmd.go +++ b/src/modules/crontask/processor/ne_alarm_state_check_cmd/ne_alarm_state_check_cmd.go @@ -118,7 +118,7 @@ func (s *NeAlarmStateCheckCMDProcessor) Execute(data any) (any, error) { if len(warnMsg) > 0 { currentTime := time.Now() validTimes := []time.Time{} - if v, ok := triggerCount.Load(neInfo.RmUID); ok { + if v, ok := triggerCount.Load(neInfo.NeUID); ok { times := v.([]time.Time) // 清理过期的记录:10秒前的触发记录不再计入 for _, t := range times { @@ -127,11 +127,11 @@ func (s *NeAlarmStateCheckCMDProcessor) Execute(data any) (any, error) { } } validTimes = append(validTimes, currentTime) - triggerCount.Store(neInfo.RmUID, validTimes) + triggerCount.Store(neInfo.NeUID, validTimes) } else { // 事件第一次触发,初始化记录 validTimes = append(validTimes, currentTime) - triggerCount.Store(neInfo.RmUID, validTimes) + triggerCount.Store(neInfo.NeUID, validTimes) } if int64(len(validTimes)) >= triggerMax { err = fmt.Errorf("greater than %s", strings.Join(warnMsg, ", ")) @@ -155,7 +155,7 @@ func (s *NeAlarmStateCheckCMDProcessor) Execute(data any) (any, error) { params.AlarmId = fmt.Sprintf("%d%d", constants.ALARM_CMD_CHECK, alarmTime) // 创建告警 alarm := oam.Alarm{ - NeUid: neInfo.RmUID, // 网元唯一标识 + NeUid: neInfo.NeUID, // 网元唯一标识 AlarmTime: alarmTime, // 事件产生时间 AlarmId: params.AlarmId, // 告警ID 唯一,清除时对应 AlarmCode: constants.ALARM_CMD_CHECK, // 告警状态码 @@ -169,9 +169,9 @@ func (s *NeAlarmStateCheckCMDProcessor) Execute(data any) (any, error) { LocationInfo: "NE CPU/Menory/Disk: Heartbeat", // 告警定位信息 } if err = oamService.NewAlarm.Resolve(alarm); err == nil { - result[neInfo.RmUID] = "cmd alarm" + result[neInfo.NeUID] = "cmd alarm" } - triggerCount.Delete(neInfo.RmUID) + triggerCount.Delete(neInfo.NeUID) } // 返回结果,用于记录执行结果 @@ -222,8 +222,9 @@ func (s NeAlarmStateCheckCMDProcessor) serverState(state map[string]any) (float6 // 插入网元状态记录 neState := neDataModel.NEState{ + CoreUID: fmt.Sprint(state["coreUid"]), + NeUID: fmt.Sprint(state["neUid"]), NeType: fmt.Sprint(state["neType"]), - NeId: fmt.Sprint(state["neId"]), Version: fmt.Sprint(state["version"]), Capability: parse.Number(state["capability"]), SerialNum: fmt.Sprint(state["sn"]), @@ -240,7 +241,7 @@ func (s NeAlarmStateCheckCMDProcessor) serverState(state map[string]any) (float6 ltTime := time.Now().AddDate(0, 0, -7).UnixMilli() s.neStateService.DeleteByTime(ltTime) // 推送ws消息 - groupID := fmt.Sprintf("%s_%s_%s", wsService.GROUP_NE_STATE, neState.NeType, neState.NeId) + groupID := fmt.Sprintf("%s_%s_%s", wsService.GROUP_NE_STATE, neState.CoreUID, neState.NeUID) s.wsSendService.ByGroupID(groupID, neState) return sysCpuUsage, sysMemUsage, sysDiskUsage diff --git a/src/modules/crontask/processor/ne_alarm_state_check_license/ne_alarm_state_check_license.go b/src/modules/crontask/processor/ne_alarm_state_check_license/ne_alarm_state_check_license.go index 9428c5ef..d73b3321 100644 --- a/src/modules/crontask/processor/ne_alarm_state_check_license/ne_alarm_state_check_license.go +++ b/src/modules/crontask/processor/ne_alarm_state_check_license/ne_alarm_state_check_license.go @@ -91,7 +91,7 @@ func (s *NeAlarmStateCheckLicenseProcessor) Execute(data any) (any, error) { params.AlarmId = fmt.Sprintf("%d%d", constants.ALARM_LICENSE_CHECK, neInfo.CreateTime) // 创建告警 alarm := oam.Alarm{ - NeUid: neInfo.RmUID, // 网元唯一标识 + NeUid: neInfo.NeUID, // 网元唯一标识 AlarmTime: time.Now().UnixMilli(), // 事件产生时间 AlarmId: params.AlarmId, // 告警ID 唯一,清除时对应 AlarmCode: constants.ALARM_LICENSE_CHECK, // 告警状态码 @@ -105,7 +105,7 @@ func (s *NeAlarmStateCheckLicenseProcessor) Execute(data any) (any, error) { LocationInfo: "NE License: Heartbeat", // 告警定位信息 } if err = oamService.NewAlarm.Resolve(alarm); err == nil { - result[neInfo.RmUID] = "license alarm" + result[neInfo.NeUID] = "license alarm" } } diff --git a/src/modules/crontask/processor/ne_config_backup/ne_config_backup.go b/src/modules/crontask/processor/ne_config_backup/ne_config_backup.go index fd1712dd..6e7ee27c 100644 --- a/src/modules/crontask/processor/ne_config_backup/ne_config_backup.go +++ b/src/modules/crontask/processor/ne_config_backup/ne_config_backup.go @@ -1,7 +1,6 @@ package ne_config_backup import ( - "fmt" "path/filepath" "be.ems/src/framework/cron" @@ -38,34 +37,34 @@ func (s *NeConfigBackupProcessor) Execute(data any) (any, error) { neList := s.neInfoService.Find(neModel.NeInfo{}, false, false) for _, neInfo := range neList { - neTypeAndId := fmt.Sprintf("%s_%s", neInfo.NeType, neInfo.NeId) // 将网元文件备份到本地 zipFilePath, err := s.neConfigBackupService.FileNeToLocal(neInfo) if err != nil { - result[neTypeAndId] = err.Error() + result[neInfo.NeUID] = err.Error() continue } // 新增备份记录 item := neModel.NeConfigBackup{ + CoreUID: neInfo.CoreUID, + NeUID: neInfo.NeUID, NeType: neInfo.NeType, - NeId: neInfo.NeId, Name: filepath.Base(zipFilePath), Path: zipFilePath, CreateBy: "system", } rows := s.neConfigBackupService.Insert(item) if rows <= 0 { - result[neTypeAndId] = "failed" + result[neInfo.NeUID] = "failed" continue } msg := "ok" // 上传到FTP服务器 if err := s.backupService.FTPPushFile(zipFilePath, ""); err != nil { - result[neTypeAndId] = msg + ", ftp err:" + err.Error() + result[neInfo.NeUID] = msg + ", ftp err:" + err.Error() } - result[neTypeAndId] = msg + result[neInfo.NeUID] = msg } return result, nil diff --git a/src/modules/crontask/processor/ne_data_udm/ne_data_udm.go b/src/modules/crontask/processor/ne_data_udm/ne_data_udm.go index 97e3cef5..d739d163 100644 --- a/src/modules/crontask/processor/ne_data_udm/ne_data_udm.go +++ b/src/modules/crontask/processor/ne_data_udm/ne_data_udm.go @@ -11,18 +11,22 @@ import ( ) var NewProcessor = &NeDataUDM{ - udmAuthService: neDataService.NewUDMAuthUser, - udmSubService: neDataService.NewUDMSubUser, - neInfoService: neService.NewNeInfo, - count: 0, + count: 0, + neInfoService: neService.NewNeInfo, + udmAuthService: neDataService.NewUDMAuthUser, + udmSubService: neDataService.NewUDMSubUser, + udmVOIPService: neDataService.NewUDMVOIPUser, + udmVolteIMSService: neDataService.NewUDMVolteIMSUser, } // NeDataUDM 网元配置文件定期备份 type NeDataUDM struct { - udmAuthService *neDataService.UDMAuthUser // UDM鉴权信息 - udmSubService *neDataService.UDMSubUser // UDM签约信息 - neInfoService *neService.NeInfo // 网元信息服务 - count int // 执行次数 + count int // 执行次数 + neInfoService *neService.NeInfo // 网元信息服务 + udmAuthService *neDataService.UDMAuthUser // UDM鉴权信息服务 + udmSubService *neDataService.UDMSubUser // UDM签约信息服务 + udmVOIPService *neDataService.UDMVOIPUser // UDMVOIP信息服务 + udmVolteIMSService *neDataService.UDMVolteIMSUser // UDMVolteIMS信息服务 } func (s *NeDataUDM) Execute(data any) (any, error) { @@ -37,8 +41,10 @@ func (s *NeDataUDM) Execute(data any) (any, error) { neList := s.neInfoService.Find(neModel.NeInfo{NeType: "UDM"}, false, false) for _, neInfo := range neList { - result[fmt.Sprintf("AuthNumber_%s", neInfo.NeId)] = s.udmAuthService.ResetData(neInfo.NeId) - result[fmt.Sprintf("SubNumber_%s", neInfo.NeId)] = s.udmSubService.ResetData(neInfo.NeId) + result[fmt.Sprintf("AuthNumber_%s", neInfo.NeUID)] = s.udmAuthService.ResetData(neInfo.CoreUID, neInfo.NeUID) + result[fmt.Sprintf("SubNumber_%s", neInfo.NeUID)] = s.udmSubService.ResetData(neInfo.CoreUID, neInfo.NeUID) + result[fmt.Sprintf("VOIPNumber_%s", neInfo.NeUID)] = s.udmVOIPService.ResetData(neInfo.CoreUID, neInfo.NeUID) + result[fmt.Sprintf("VolteIMSNumber_%s", neInfo.NeUID)] = s.udmVolteIMSService.ResetData(neInfo.CoreUID, neInfo.NeUID) } return result, nil diff --git a/src/modules/ne/controller/action.go b/src/modules/ne/controller/action.go index 30c5aef4..bb3026a4 100644 --- a/src/modules/ne/controller/action.go +++ b/src/modules/ne/controller/action.go @@ -15,27 +15,26 @@ import ( "be.ems/src/framework/ssh" "be.ems/src/framework/utils/file" "be.ems/src/framework/utils/generate" - neService "be.ems/src/modules/ne/service" + "be.ems/src/modules/ne/service" ) // 实例化控制层 NeActionController 结构体 var NewNeAction = &NeActionController{ - neInfoService: neService.NewNeInfo, + neInfoService: service.NewNeInfo, } // 网元处理请求 // // PATH /action type NeActionController struct { - // 网元信息服务 - neInfoService *neService.NeInfo + neInfoService *service.NeInfo // 网元信息服务 } -// 从本地到网元发送文件 +// 从本地到网元-发送文件 // -// POST /pushFile +// POST /file/push // -// @Tags ne +// @Tags network_element/action // @Accept json // @Produce json // @Param data body object true "Request Param" @@ -43,12 +42,12 @@ type NeActionController struct { // @Security TokenAuth // @Summary Sending files from local to network elements // @Description Sending files from local to network elements -// @Router /ne/action/pushFile [post] -func (s *NeActionController) PushFile(c *gin.Context) { +// @Router /ne/action/file/push [post] +func (s *NeActionController) FilePush(c *gin.Context) { language := reqctx.AcceptLanguage(c) var body struct { - NeType string `json:"neType" binding:"required"` - NeID string `json:"neId" binding:"required"` + CoreUID string `json:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `json:"neUid" binding:"required"` // 网元唯一标识 UploadPath string `json:"uploadPath" binding:"required"` DelTemp bool `json:"delTemp"` // 删除本地临时文件 } @@ -59,14 +58,14 @@ func (s *NeActionController) PushFile(c *gin.Context) { } // 查询网元获取IP - neInfo := s.neInfoService.FindByNeTypeAndNeID(body.NeType, body.NeID) - if neInfo.NeId != body.NeID || neInfo.IP == "" { + neInfo := s.neInfoService.FindByCoreUidAndNeUid(body.CoreUID, body.NeUID) + if neInfo.CoreUID != body.CoreUID || neInfo.NeUID != body.NeUID { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } // 网元主机的SSH客户端 - sshClient, err := s.neInfoService.NeRunSSHClient(neInfo.NeType, neInfo.NeId) + sshClient, err := s.neInfoService.NeRunSSHClient(neInfo.CoreUID, neInfo.NeUID) if err != nil { c.JSON(200, resp.ErrMsg(err.Error())) return @@ -99,15 +98,15 @@ func (s *NeActionController) PushFile(c *gin.Context) { c.JSON(200, resp.OkData(filepath.ToSlash(neFilePath))) } -// 从网元到本地获取文件 +// 从网元到本地-获取文件 // -// GET /pullFile +// GET /file/pull // -// @Tags ne +// @Tags network_element/action // @Accept json // @Produce json -// @Param neType query string true "NE Type" Enums(IMS,AMF,AUSF,UDM,SMF,PCF,NSSF,NRF,UPF,MME,CBC,OMC,SGWC,SMSC) default(UPF) -// @Param neId query string true "NE ID" default(001) +// @Param coreUid query string true "CoreUID" default(8I73Y01Z) +// @Param neUid query string true "NeUID" default(5AKF59BZ) // @Param path query string true "dir path" default(/var/log) // @Param fileName query string true "file name" // @Param delTemp query boolean false "Delete Temp File" default(false) @@ -115,31 +114,31 @@ func (s *NeActionController) PushFile(c *gin.Context) { // @Security TokenAuth // @Summary Getting files from the network element to the local // @Description Getting files from the network element to the local -// @Router /ne/action/pullFile [get] -func (s *NeActionController) PullFile(c *gin.Context) { +// @Router /ne/action/file/pull [get] +func (s *NeActionController) FilePull(c *gin.Context) { language := reqctx.AcceptLanguage(c) - var querys struct { - NeType string `form:"neType" binding:"required"` - NeID string `form:"neId" binding:"required"` + var query struct { + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `form:"neUid" binding:"required"` // 网元唯一标识 Path string `form:"path" binding:"required"` FileName string `form:"fileName" binding:"required"` DelTemp bool `form:"delTemp"` // 删除本地临时文件 } - if err := c.ShouldBindQuery(&querys); err != nil { + if err := c.ShouldBindQuery(&query); err != nil { errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs)) return } // 查询网元获取IP - neInfo := s.neInfoService.FindByNeTypeAndNeID(querys.NeType, querys.NeID) - if neInfo.NeId != querys.NeID || neInfo.IP == "" { + neInfo := s.neInfoService.FindByCoreUidAndNeUid(query.CoreUID, query.NeUID) + if neInfo.CoreUID != query.CoreUID || neInfo.NeUID != query.NeUID { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } // 网元主机的SSH客户端 - sshClient, err := s.neInfoService.NeRunSSHClient(neInfo.NeType, neInfo.NeId) + sshClient, err := s.neInfoService.NeRunSSHClient(neInfo.CoreUID, neInfo.NeUID) if err != nil { c.JSON(200, resp.ErrMsg(err.Error())) return @@ -153,8 +152,8 @@ func (s *NeActionController) PullFile(c *gin.Context) { } defer sftpClient.Close() - nePath := filepath.ToSlash(filepath.Join(querys.Path, querys.FileName)) - fileName := generate.Code(6) + "_" + querys.FileName + nePath := filepath.ToSlash(filepath.Join(query.Path, query.FileName)) + fileName := generate.Code(6) + "_" + query.FileName localFilePath := filepath.Join("/tmp/omc/pull", fileName) if runtime.GOOS == "windows" { localFilePath = fmt.Sprintf("C:%s", localFilePath) @@ -166,34 +165,34 @@ func (s *NeActionController) PullFile(c *gin.Context) { } defer func() { - if querys.DelTemp { + if query.DelTemp { _ = os.Remove(localFilePath) } }() c.FileAttachment(localFilePath, fileName) } -// 从网元到本地获取目录压缩为ZIP +// 从网元到本地-获取目录压缩为ZIP // -// GET /pullDirZip +// GET /file/pull/dirzip // -// @Tags ne +// @Tags network_element/action // @Accept json // @Produce json -// @Param neType query string true "NE Type" Enums(IMS,AMF,AUSF,UDM,SMF,PCF,NSSF,NRF,UPF,MME,CBC,OMC,SGWC,SMSC) default(UPF) -// @Param neId query string true "NE ID" default(001) +// @Param coreUid query string true "CoreUID" default(8I73Y01Z) +// @Param neUid query string true "NeUID" default(5AKF59BZ) // @Param path query string true "dir path" default(/var/log) // @Param delTemp query boolean false "Delete Temp File" default(false) // @Success 200 {object} object "Response Results" // @Security TokenAuth // @Summary Get directories compressed to ZIP from the network element to the local area // @Description Get directories compressed to ZIP from the network element to the local area -// @Router /ne/action/pullDirZip [get] -func (s *NeActionController) PullDirZip(c *gin.Context) { +// @Router /ne/action/file/pull/dirzip [get] +func (s *NeActionController) FilePullDirZip(c *gin.Context) { language := reqctx.AcceptLanguage(c) var querys struct { - NeType string `form:"neType" binding:"required"` - NeID string `form:"neId" binding:"required"` + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `form:"neUid" binding:"required"` // 网元唯一标识 Path string `form:"path" binding:"required"` DelTemp bool `form:"delTemp"` // 删除本地临时文件 } @@ -204,14 +203,14 @@ func (s *NeActionController) PullDirZip(c *gin.Context) { } // 查询网元获取IP - neInfo := s.neInfoService.FindByNeTypeAndNeID(querys.NeType, querys.NeID) - if neInfo.NeId != querys.NeID || neInfo.IP == "" { + neInfo := s.neInfoService.FindByCoreUidAndNeUid(querys.CoreUID, querys.NeUID) + if neInfo.CoreUID != querys.CoreUID || neInfo.NeUID != querys.NeUID { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } // 网元主机的SSH客户端 - sshClient, err := s.neInfoService.NeRunSSHClient(neInfo.NeType, neInfo.NeId) + sshClient, err := s.neInfoService.NeRunSSHClient(neInfo.CoreUID, neInfo.NeUID) if err != nil { c.JSON(200, resp.ErrMsg(err.Error())) return @@ -239,7 +238,7 @@ func (s *NeActionController) PullDirZip(c *gin.Context) { } // 压缩zip文件名 - zipFileName := fmt.Sprintf("%s-%s-%s.zip", neInfo.NeType, neInfo.NeId, dirName) + zipFileName := fmt.Sprintf("%s-%s-%s.zip", neInfo.NeType, neInfo.NeUID, dirName) zipFilePath := filepath.Join(localFilePath, zipFileName) if err := file.CompressZipByDir(zipFilePath, localDirFilePath); err != nil { c.JSON(200, resp.ErrMsg(err.Error())) @@ -254,11 +253,11 @@ func (s *NeActionController) PullDirZip(c *gin.Context) { c.FileAttachment(zipFilePath, zipFileName) } -// 查看网元端文件内容 +// 网元端文件查看内容 // -// GET /viewFile +// GET /file/view // -// @Tags ne +// @Tags network_element/action // @Accept json // @Produce json // @Param neType query string true "NE Type" Enums(IMS,AMF,AUSF,UDM,SMF,PCF,NSSF,NRF,UPF,MME,CBC,OMC,SGWC,SMSC) default(UPF) @@ -269,12 +268,12 @@ func (s *NeActionController) PullDirZip(c *gin.Context) { // @Security TokenAuth // @Summary Viewing the contents of a file on the network element side // @Description Viewing the contents of a file on the network element side -// @Router /ne/action/viewFile [get] -func (s *NeActionController) ViewFile(c *gin.Context) { +// @Router /ne/action/file/view [get] +func (s *NeActionController) FileView(c *gin.Context) { language := reqctx.AcceptLanguage(c) var querys struct { - NeType string `form:"neType" binding:"required"` - NeID string `form:"neId" binding:"required"` + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `form:"neUid" binding:"required"` // 网元唯一标识 Path string `form:"path" binding:"required"` FileName string `form:"fileName" binding:"required"` } @@ -285,14 +284,14 @@ func (s *NeActionController) ViewFile(c *gin.Context) { } // 查询网元获取IP - neInfo := s.neInfoService.FindByNeTypeAndNeID(querys.NeType, querys.NeID) - if neInfo.NeId != querys.NeID || neInfo.IP == "" { + neInfo := s.neInfoService.FindByCoreUidAndNeUid(querys.CoreUID, querys.NeUID) + if neInfo.CoreUID != querys.CoreUID || neInfo.NeUID != querys.NeUID { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } // 网元主机的SSH客户端 - sshClient, err := s.neInfoService.NeRunSSHClient(neInfo.NeType, neInfo.NeId) + sshClient, err := s.neInfoService.NeRunSSHClient(neInfo.CoreUID, neInfo.NeUID) if err != nil { c.JSON(200, resp.ErrMsg(err.Error())) return @@ -313,9 +312,9 @@ func (s *NeActionController) ViewFile(c *gin.Context) { // 网元端文件列表 // -// GET /files +// GET /file/list // -// @Tags ne +// @Tags network_element/action // @Accept json // @Produce json // @Param neType query string true "NE Type" Enums(IMS,AMF,AUSF,UDM,SMF,PCF,NSSF,NRF,UPF,MME,CBC,OMC,SGWC,SMSC) default(UPF) @@ -328,12 +327,12 @@ func (s *NeActionController) ViewFile(c *gin.Context) { // @Security TokenAuth // @Summary List of files on the network element side // @Description List of files on the network element side -// @Router /ne/action/files [get] -func (s *NeActionController) Files(c *gin.Context) { +// @Router /ne/action/file/list [get] +func (s *NeActionController) FileList(c *gin.Context) { language := reqctx.AcceptLanguage(c) var querys struct { - NeType string `form:"neType" binding:"required"` - NeID string `form:"neId" binding:"required"` + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `form:"neUid" binding:"required"` // 网元唯一标识 Path string `form:"path" binding:"required"` PageNum int64 `form:"pageNum" binding:"required"` PageSize int64 `form:"pageSize" binding:"required"` @@ -346,14 +345,14 @@ func (s *NeActionController) Files(c *gin.Context) { } // 查询网元获取IP - neInfo := s.neInfoService.FindByNeTypeAndNeID(querys.NeType, querys.NeID) - if neInfo.NeId != querys.NeID || neInfo.IP == "" { + neInfo := s.neInfoService.FindByCoreUidAndNeUid(querys.CoreUID, querys.NeUID) + if neInfo.CoreUID != querys.CoreUID || neInfo.NeUID != querys.NeUID { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } // 网元主机的SSH客户端 - sshClient, err := s.neInfoService.NeRunSSHClient(neInfo.NeType, neInfo.NeId) + sshClient, err := s.neInfoService.NeRunSSHClient(neInfo.CoreUID, neInfo.NeUID) if err != nil { c.JSON(200, resp.ErrMsg(err.Error())) return @@ -395,7 +394,7 @@ func (s *NeActionController) Files(c *gin.Context) { // // PUT /service // -// @Tags ne +// @Tags network_element/action // @Accept json // @Produce json // @Param data body object true "Request Param" @@ -407,9 +406,9 @@ func (s *NeActionController) Files(c *gin.Context) { func (s *NeActionController) Service(c *gin.Context) { language := reqctx.AcceptLanguage(c) var body struct { - NeType string `json:"neType" binding:"required"` - NeID string `json:"neId" binding:"required"` - Action string `json:"action" binding:"required,oneof=start restart stop reboot poweroff"` // 操作行为 + CoreUID string `json:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `json:"neUid" binding:"required"` // 网元唯一标识 + Action string `json:"action" binding:"required,oneof=start restart stop reboot poweroff"` // 操作行为 } if err := c.ShouldBindBodyWithJSON(&body); err != nil { errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) @@ -418,8 +417,8 @@ func (s *NeActionController) Service(c *gin.Context) { } // 查询网元获取IP - neInfo := s.neInfoService.FindByNeTypeAndNeID(body.NeType, body.NeID) - if neInfo.NeId != body.NeID || neInfo.IP == "" { + neInfo := s.neInfoService.FindByCoreUidAndNeUid(body.CoreUID, body.NeUID) + if neInfo.CoreUID != body.CoreUID || neInfo.NeUID != body.NeUID { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } @@ -444,7 +443,7 @@ func (s *NeActionController) Service(c *gin.Context) { cmdStr = "sudo shutdown -h now" } - _, err := s.neInfoService.NeRunSSHCmd(body.NeType, body.NeID, cmdStr) + _, err := s.neInfoService.NeRunSSHCmd(neInfo.CoreUID, neInfo.NeUID, cmdStr) if err != nil { c.JSON(200, resp.ErrMsg(err.Error())) return diff --git a/src/modules/ne/controller/ne_config.go b/src/modules/ne/controller/ne_config.go index 38b10ca7..47d18bb9 100644 --- a/src/modules/ne/controller/ne_config.go +++ b/src/modules/ne/controller/ne_config.go @@ -160,7 +160,7 @@ func (s NeConfigController) Remove(c *gin.Context) { // // GET /list/:neType // -// @Tags ne/config +// @Tags network_element/config // @Accept json // @Produce json // @Param neType path string true "NE Type" Enums(IMS,AMF,AUSF,UDM,SMF,PCF,NSSF,NRF,UPF,MME,CBC,OMC,SGWC,SMSC) @@ -183,7 +183,7 @@ func (s NeConfigController) ListByNeType(c *gin.Context) { // // GET /data // -// @Tags ne/config +// @Tags network_element/config // @Accept json // @Produce json // @Param neType query string true "NE Type" Enums(IMS,AMF,AUSF,UDM,SMF,PCF,NSSF,NRF,UPF,MME,CBC,OMC,SGWC,SMSC) @@ -197,8 +197,8 @@ func (s NeConfigController) ListByNeType(c *gin.Context) { func (s NeConfigController) DataInfo(c *gin.Context) { language := reqctx.AcceptLanguage(c) var query struct { - NeType string `form:"neType" binding:"required"` // 网元类型 - NeId string `form:"neId" binding:"required"` // 网元ID + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `form:"neUid" binding:"required"` // 网元唯一标识 ParamName string `form:"paramName" binding:"required"` // 可用属性 } if err := c.ShouldBindQuery(&query); err != nil { @@ -207,13 +207,13 @@ func (s NeConfigController) DataInfo(c *gin.Context) { return } - neInfo := s.neInfoService.FindByNeTypeAndNeID(query.NeType, query.NeId) - if neInfo.NeId != query.NeId || neInfo.IP == "" { + neInfo := s.neInfoService.FindByCoreUidAndNeUid(query.CoreUID, query.NeUID) + if neInfo.CoreUID != query.CoreUID || neInfo.NeUID != query.NeUID { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } - if query.NeType == "OMC" { + if neInfo.NeType == "OMC" { resData := s.neConfigService.GetOMCYaml(query.ParamName) c.JSON(200, resp.OkData(resData)) return @@ -233,7 +233,7 @@ func (s NeConfigController) DataInfo(c *gin.Context) { // // PUT /data // -// @Tags ne/config +// @Tags network_element/config // @Accept json // @Produce json // @Param data body object true "Request Param" @@ -245,8 +245,8 @@ func (s NeConfigController) DataInfo(c *gin.Context) { func (s NeConfigController) DataEdit(c *gin.Context) { language := reqctx.AcceptLanguage(c) var body struct { - NeType string `json:"neType" binding:"required"` // 网元类型 - NeId string `json:"neId" binding:"required"` // 网元ID + CoreUID string `json:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `json:"neUid" binding:"required"` // 网元唯一标识 ParamName string `json:"paramName" binding:"required"` ParamData map[string]any `json:"paramData" binding:"required"` Loc string `json:"loc"` // 仅array使用与数据对象内index一致,有多层时划分嵌套层(index/subParamName/index) @@ -257,12 +257,12 @@ func (s NeConfigController) DataEdit(c *gin.Context) { return } - neInfo := s.neInfoService.FindByNeTypeAndNeID(body.NeType, body.NeId) - if neInfo.NeId != body.NeId || neInfo.IP == "" { + neInfo := s.neInfoService.FindByCoreUidAndNeUid(body.CoreUID, body.NeUID) + if neInfo.CoreUID != body.CoreUID || neInfo.NeUID != body.NeUID { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } - if body.NeType == "OMC" { + if neInfo.NeType == "OMC" { err := s.neConfigService.ModifyOMCYaml(body.ParamName, body.Loc, body.ParamData) if err != nil { c.JSON(200, resp.ErrMsg(err.Error())) @@ -289,7 +289,7 @@ func (s NeConfigController) DataEdit(c *gin.Context) { // // POST /data // -// @Tags ne/config +// @Tags network_element/config // @Accept json // @Produce json // @Param data body object true "Request Param" @@ -301,8 +301,8 @@ func (s NeConfigController) DataEdit(c *gin.Context) { func (s NeConfigController) DataAdd(c *gin.Context) { language := reqctx.AcceptLanguage(c) var body struct { - NeType string `json:"neType" binding:"required"` // 网元类型 - NeId string `json:"neId" binding:"required"` // 网元ID + CoreUID string `json:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `json:"neUid" binding:"required"` // 网元唯一标识 ParamName string `json:"paramName" binding:"required"` // 根据配置可选值 ParamData map[string]any `json:"paramData" binding:"required"` // 数据对象 Loc string `json:"loc" binding:"required"` // 与数据对象内index一致,有多层时划分嵌套层(index/subParamName/index) @@ -313,8 +313,14 @@ func (s NeConfigController) DataAdd(c *gin.Context) { return } + neInfo := s.neInfoService.FindByCoreUidAndNeUid(body.CoreUID, body.NeUID) + if neInfo.CoreUID != body.CoreUID || neInfo.NeUID != body.NeUID { + c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) + return + } + // 检查是否array - info := s.neConfigService.FindByNeTypeAndParamName(body.NeType, body.ParamName) + info := s.neConfigService.FindByNeTypeAndParamName(neInfo.NeType, body.ParamName) if info.ParamType != "array" { c.JSON(200, resp.ErrMsg("this attribute does not support adding")) return @@ -326,12 +332,6 @@ func (s NeConfigController) DataAdd(c *gin.Context) { return } - neInfo := s.neInfoService.FindByNeTypeAndNeID(body.NeType, body.NeId) - if neInfo.NeId != body.NeId || neInfo.IP == "" { - c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) - return - } - // 网元直连 resData, err := neFetchlink.NeConfigAdd(neInfo, body.ParamName, body.Loc, body.ParamData) if err != nil { @@ -345,7 +345,7 @@ func (s NeConfigController) DataAdd(c *gin.Context) { // // DELETE /data // -// @Tags ne/config +// @Tags network_element/config // @Accept json // @Produce json // @Param neType query string true "NE Type" Enums(IMS,AMF,AUSF,UDM,SMF,PCF,NSSF,NRF,UPF,MME,CBC,OMC,SGWC,SMSC) @@ -360,8 +360,8 @@ func (s NeConfigController) DataAdd(c *gin.Context) { func (s NeConfigController) DataRemove(c *gin.Context) { language := reqctx.AcceptLanguage(c) var query struct { - NeType string `form:"neType" binding:"required"` // 网元类型 - NeId string `form:"neId" binding:"required"` // 网元ID + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `form:"neUid" binding:"required"` // 网元唯一标识 ParamName string `form:"paramName" binding:"required"` Loc string `form:"loc" binding:"required"` // 与数据对象内index一致,有多层时划分嵌套层(index/subParamName/index) } @@ -371,16 +371,16 @@ func (s NeConfigController) DataRemove(c *gin.Context) { return } - // 检查是否array - info := s.neConfigService.FindByNeTypeAndParamName(query.NeType, query.ParamName) - if info.ParamType != "array" { - c.JSON(200, resp.ErrMsg("this attribute does not support adding")) + neInfo := s.neInfoService.FindByCoreUidAndNeUid(query.CoreUID, query.NeUID) + if neInfo.CoreUID != query.CoreUID || neInfo.NeUID != query.NeUID { + c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } - neInfo := s.neInfoService.FindByNeTypeAndNeID(query.NeType, query.NeId) - if neInfo.NeId != query.NeId || neInfo.IP == "" { - c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) + // 检查是否array + info := s.neConfigService.FindByNeTypeAndParamName(neInfo.NeType, query.ParamName) + if info.ParamType != "array" { + c.JSON(200, resp.ErrMsg("this attribute does not support adding")) return } diff --git a/src/modules/ne/controller/ne_config_backup.go b/src/modules/ne/controller/ne_config_backup.go index 0b73a002..57f51bac 100644 --- a/src/modules/ne/controller/ne_config_backup.go +++ b/src/modules/ne/controller/ne_config_backup.go @@ -10,10 +10,8 @@ import ( "be.ems/src/framework/reqctx" "be.ems/src/framework/resp" "be.ems/src/framework/utils/file" - "be.ems/src/framework/utils/parse" "be.ems/src/modules/ne/model" neService "be.ems/src/modules/ne/service" - systemService "be.ems/src/modules/system/service" "github.com/gin-gonic/gin" ) @@ -22,7 +20,6 @@ import ( var NewNeConfigBackup = &NeConfigBackupController{ neConfigBackupService: neService.NewNeConfigBackup, neInfoService: neService.NewNeInfo, - sysConfigService: systemService.NewSysConfig, } // 网元配置文件备份记录 @@ -31,7 +28,6 @@ var NewNeConfigBackup = &NeConfigBackupController{ type NeConfigBackupController struct { neConfigBackupService *neService.NeConfigBackup // 网元配置文件备份记录服务 neInfoService *neService.NeInfo // 网元信息服务 - sysConfigService *systemService.SysConfig // 参数配置服务 } // 网元配置文件备份记录列表 @@ -39,6 +35,11 @@ type NeConfigBackupController struct { // GET /list func (s NeConfigBackupController) List(c *gin.Context) { query := reqctx.QueryMap(c) + coreUid, coreUidOk := query["coreUid"] + if !coreUidOk || coreUid == "" { + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: coreUid is empty")) + return + } rows, total := s.neConfigBackupService.FindByPage(query) c.JSON(200, resp.OkData(map[string]any{"rows": rows, "total": total})) } @@ -48,19 +49,29 @@ func (s NeConfigBackupController) List(c *gin.Context) { // GET /download?id=xx func (s NeConfigBackupController) Download(c *gin.Context) { language := reqctx.AcceptLanguage(c) - id := parse.Number(c.Query("id")) - if id <= 0 { - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: id is empty")) + var query struct { + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `form:"neUid" binding:"required"` // 网元唯一标识 + ID int64 `form:"id" binding:"required"` // 记录ID + } + if err := c.ShouldBindQuery(&query); err != nil { + errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs)) return } - item := s.neConfigBackupService.FindById(id) - if item.ID != id { - // 没有可访问主机命令数据! + // 检查是否存在 + rows := s.neConfigBackupService.Find(model.NeConfigBackup{ + CoreUID: query.CoreUID, + NeUID: query.NeUID, + ID: query.ID, + }) + if len(rows) <= 0 { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "neConfigBackup.noData"))) return } + item := rows[0] if _, err := os.Stat(item.Path); err != nil { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "neConfigBackup.notFoundFile"))) return @@ -74,9 +85,11 @@ func (s NeConfigBackupController) Download(c *gin.Context) { func (s NeConfigBackupController) Edit(c *gin.Context) { language := reqctx.AcceptLanguage(c) var body struct { - ID int64 `json:"id" binding:"required"` // 记录ID - Name string `json:"name" binding:"required"` // 名称 - Remark string `json:"remark" binding:"required"` // 备注 + CoreUID string `json:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `json:"neUid" binding:"required"` // 网元唯一标识 + ID int64 `json:"id" binding:"required"` // 记录ID + Name string `json:"name" binding:"required"` // 名称 + Remark string `json:"remark" binding:"required"` // 备注 } if err := c.ShouldBindBodyWithJSON(&body); err != nil { errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) @@ -85,18 +98,21 @@ func (s NeConfigBackupController) Edit(c *gin.Context) { } // 检查是否存在 - data := s.neConfigBackupService.FindById(body.ID) - if data.ID != body.ID { - // 没有可访问主机命令数据! - c.JSON(200, resp.ErrMsg(i18n.TKey(language, "neConfig.noData"))) + rows := s.neConfigBackupService.Find(model.NeConfigBackup{ + CoreUID: body.CoreUID, + NeUID: body.NeUID, + ID: body.ID, + }) + if len(rows) <= 0 { + c.JSON(200, resp.ErrMsg(i18n.TKey(language, "neConfigBackup.noData"))) return } - + data := rows[0] data.Name = body.Name data.Remark = body.Remark data.UpdateBy = reqctx.LoginUserToUserName(c) - rows := s.neConfigBackupService.Update(data) - if rows > 0 { + ups := s.neConfigBackupService.Update(data) + if ups > 0 { c.JSON(200, resp.Ok(nil)) return } @@ -108,21 +124,18 @@ func (s NeConfigBackupController) Edit(c *gin.Context) { // DELETE /?id=xx func (s NeConfigBackupController) Remove(c *gin.Context) { language := reqctx.AcceptLanguage(c) - id := c.Query("id") - if id == "" { - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: id is empty")) + var query struct { + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `form:"neUid" binding:"required"` // 网元唯一标识 + ID int64 `form:"id" binding:"required"` // 记录ID + } + if err := c.ShouldBindQuery(&query); err != nil { + errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs)) return } - // 处理字符转id数组后去重 - uniqueIDs := parse.RemoveDuplicatesToArray(id, ",") - // 转换成int64数组类型 - ids := make([]int64, 0) - for _, v := range uniqueIDs { - ids = append(ids, parse.Number(v)) - } - - rows, err := s.neConfigBackupService.DeleteByIds(ids) + rows, err := s.neConfigBackupService.DeleteByIds(query.ID, query.CoreUID, query.NeUID) if err != nil { c.JSON(200, resp.ErrMsg(i18n.TKey(language, err.Error()))) return @@ -137,10 +150,10 @@ func (s NeConfigBackupController) Remove(c *gin.Context) { func (s NeConfigBackupController) Import(c *gin.Context) { language := reqctx.AcceptLanguage(c) var body struct { - NeType string `json:"neType" binding:"required"` - NeId string `json:"neId" binding:"required"` - Type string `json:"type" binding:"required,oneof=backup upload"` // 导入类型 - Path string `json:"path" binding:"required"` // 文件路径 + CoreUID string `json:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `json:"neUid" binding:"required"` // 网元唯一标识 + Type string `json:"type" binding:"required,oneof=backup upload"` // 导入类型 backup upload + Path string `json:"path" binding:"required"` // 备份文件zip文件路径 } if err := c.ShouldBindBodyWithJSON(&body); err != nil { errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) @@ -153,8 +166,8 @@ func (s NeConfigBackupController) Import(c *gin.Context) { } // 查网元 - neInfo := s.neInfoService.FindByNeTypeAndNeID(body.NeType, body.NeId) - if neInfo.NeId != body.NeId || neInfo.IP == "" { + neInfo := s.neInfoService.FindByCoreUidAndNeUid(body.CoreUID, body.NeUID) + if neInfo.CoreUID != body.CoreUID || neInfo.NeUID != body.NeUID { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } @@ -176,8 +189,8 @@ func (s NeConfigBackupController) Import(c *gin.Context) { func (s NeConfigBackupController) Export(c *gin.Context) { language := reqctx.AcceptLanguage(c) var body struct { - NeType string `json:"neType" binding:"required"` - NeId string `json:"neId" binding:"required"` + CoreUID string `json:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `json:"neUid" binding:"required"` // 网元唯一标识 } if err := c.ShouldBindBodyWithJSON(&body); err != nil { errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) @@ -185,8 +198,8 @@ func (s NeConfigBackupController) Export(c *gin.Context) { return } // 查网元 - neInfo := s.neInfoService.FindByNeTypeAndNeID(body.NeType, body.NeId) - if neInfo.NeId != body.NeId || neInfo.IP == "" { + neInfo := s.neInfoService.FindByCoreUidAndNeUid(body.CoreUID, body.NeUID) + if neInfo.CoreUID != body.CoreUID || neInfo.NeUID != body.NeUID { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } @@ -198,8 +211,9 @@ func (s NeConfigBackupController) Export(c *gin.Context) { } // 新增备份记录 item := model.NeConfigBackup{ + CoreUID: neInfo.CoreUID, + NeUID: neInfo.NeUID, NeType: neInfo.NeType, - NeId: neInfo.NeId, Name: filepath.Base(zipFilePath), Path: zipFilePath, CreateBy: reqctx.LoginUserToUserName(c), diff --git a/src/modules/ne/controller/ne_host.go b/src/modules/ne/controller/ne_host.go index 8cc25b1c..78c612fc 100644 --- a/src/modules/ne/controller/ne_host.go +++ b/src/modules/ne/controller/ne_host.go @@ -182,7 +182,7 @@ func (s NeHostController) Remove(c *gin.Context) { // // POST /test // -// @Tags ne +// @Tags network_element/host // @Accept json // @Produce json // @Param data body object true "Request Param" @@ -261,7 +261,7 @@ func (s NeHostController) Test(c *gin.Context) { // // POST /cmd // -// @Tags ne +// @Tags network_element/host // @Accept json // @Produce json // @Param data body object true "Request Param" @@ -344,7 +344,7 @@ func (s NeHostController) Cmd(c *gin.Context) { // // POST /checkBySSH // -// @Tags ne +// @Tags network_element/host // @Accept json // @Produce json // @Param data body object true "Request Param" @@ -446,7 +446,7 @@ func (s NeHostController) CheckBySSH(c *gin.Context) { // // POST /authorizedBySSH // -// @Tags ne +// @Tags network_element/host // @Accept json // @Produce json // @Param data body object true "Request Param" diff --git a/src/modules/ne/controller/ne_info.go b/src/modules/ne/controller/ne_info.go index 1adb3507..f101384b 100644 --- a/src/modules/ne/controller/ne_info.go +++ b/src/modules/ne/controller/ne_info.go @@ -2,7 +2,6 @@ package controller import ( "fmt" - "strings" "sync" "be.ems/src/framework/i18n" @@ -18,18 +17,14 @@ import ( // 实例化控制层 NeInfoController 结构体 var NewNeInfo = &NeInfoController{ - neInfoService: service.NewNeInfo, - neLicenseService: service.NewNeLicense, - neVersionService: service.NewNeVersion, + neInfoService: service.NewNeInfo, } // 网元信息请求 // // PATH /info type NeInfoController struct { - neInfoService *service.NeInfo // 网元信息服务 - neLicenseService *service.NeLicense // 网元授权激活信息服务 - neVersionService *service.NeVersion // 网元版本信息服务 + neInfoService *service.NeInfo // 网元信息服务 } // neStateCacheMap 网元状态缓存最后一次成功的信息 @@ -40,11 +35,11 @@ var mutex sync.Mutex // // GET /state // -// @Tags ne +// @Tags network_element/info // @Accept json // @Produce json -// @Param neType query string true "NE Type" Enums(IMS,AMF,AUSF,UDM,SMF,PCF,NSSF,NRF,UPF,MME,CBC,OMC,SGWC,SMSC) -// @Param neId query string true "NE ID" default(001) +// @Param coreUid query string true "CoreUID" default(8I73Y01Z) +// @Param neUid query string true "NeUID" default(5AKF59BZ) // @Success 200 {object} object "Response Results" // @Security TokenAuth // @Summary Network element information state @@ -52,22 +47,22 @@ var mutex sync.Mutex // @Router /ne/info/state [get] func (s NeInfoController) State(c *gin.Context) { language := reqctx.AcceptLanguage(c) - var querys struct { - NeType string `form:"neType" binding:"required"` - NeId string `form:"neId" binding:"required"` + var query struct { + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `form:"neUid" binding:"required"` // 网元唯一标识 } - if err := c.ShouldBindQuery(&querys); err != nil { + if err := c.ShouldBindQuery(&query); err != nil { errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs)) return } - neInfo := s.neInfoService.FindByNeTypeAndNeID(querys.NeType, querys.NeId) - if neInfo.NeId != querys.NeId || neInfo.IP == "" { + neInfo := s.neInfoService.FindByCoreUidAndNeUid(query.CoreUID, query.NeUID) + if neInfo.CoreUID != query.CoreUID || neInfo.NeUID != query.NeUID { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } - neKey := fmt.Sprintf("%s_%s", neInfo.NeType, neInfo.NeId) + neKey := fmt.Sprintf("%s_%s", neInfo.CoreUID, neInfo.NeUID) // 网元直连 resData, err := neFetchlink.NeState(neInfo) @@ -79,11 +74,12 @@ func (s NeInfoController) State(c *gin.Context) { resDataCache.(map[string]any)["online"] = false } else { resDataCache = map[string]any{ - "online": false, - "neId": neInfo.NeId, - "neName": neInfo.NeName, - "neType": neInfo.NeType, - "neIP": neInfo.IP, + "online": false, + "coreUid": neInfo.CoreUID, + "neUid": neInfo.NeUID, + "neType": neInfo.NeType, + "neName": neInfo.NeName, + "neIP": neInfo.IPAddr, } } neStateCacheMap.Store(neKey, resDataCache) @@ -100,34 +96,34 @@ func (s NeInfoController) State(c *gin.Context) { c.JSON(200, resp.OkData(resData)) } -// 网元neType和neID查询 +// 网元信息查询 // -// GET /byTypeAndID +// GET /nf // -// @Tags ne +// @Tags network_element/info // @Accept json // @Produce json -// @Param neType query string true "NE Type" Enums(IMS,AMF,AUSF,UDM,SMF,PCF,NSSF,NRF,UPF,MME,CBC,OMC,SGWC,SMSC) -// @Param neId query string true "NE ID" default(001) +// @Param coreUid query string true "CoreUID" default(8I73Y01Z) +// @Param neUid query string true "NeUID" default(5AKF59BZ) // @Success 200 {object} object "Response Results" // @Security TokenAuth // @Summary Network element neType and neID queries // @Description Network element neType and neID queries -// @Router /ne/info/byTypeAndID [get] -func (s NeInfoController) NeTypeAndID(c *gin.Context) { +// @Router /ne/info/nf [get] +func (s NeInfoController) Nf(c *gin.Context) { language := reqctx.AcceptLanguage(c) - var querys struct { - NeType string `form:"neType" binding:"required"` - NeID string `form:"neId" binding:"required"` + var query struct { + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `form:"neUid" binding:"required"` // 网元唯一标识 } - if err := c.ShouldBindQuery(&querys); err != nil { + if err := c.ShouldBindQuery(&query); err != nil { errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs)) return } - neInfo := s.neInfoService.FindByNeTypeAndNeID(querys.NeType, querys.NeID) - if neInfo.NeId != querys.NeID || neInfo.IP == "" { + neInfo := s.neInfoService.FindByCoreUidAndNeUid(query.CoreUID, query.NeUID) + if neInfo.CoreUID != query.CoreUID || neInfo.NeUID != query.NeUID { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } @@ -136,25 +132,27 @@ func (s NeInfoController) NeTypeAndID(c *gin.Context) { // 网元信息列表全部无分页 // -// GET /listAll +// GET /list/all // -// @Tags ne +// @Tags network_element/info // @Accept json // @Produce json +// @Param coreUid query string true "CoreUID" default(8I73Y01Z) +// @Param neUid query string true "NeUID" default(5AKF59BZ) // @Param neType query string true "NE Type" -// @Param neId query string true "NE ID" default(001) // @Param bandStatus query boolean true "With status information" // @Param bandHost query boolean true "With host information" // @Success 200 {object} object "Response Results" // @Security TokenAuth // @Summary The list of network element information is all unpaginated // @Description The list of network element information is all unpaginated -// @Router /ne/info/listAll [get] +// @Router /ne/info/list/all [get] func (s NeInfoController) ListAll(c *gin.Context) { language := reqctx.AcceptLanguage(c) var querys struct { + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `form:"neUid"` // 网元唯一标识 NeType string `form:"neType"` - NeId string `form:"neId"` BandStatus bool `form:"bandStatus"` BandHost bool `form:"bandHost"` } @@ -166,12 +164,15 @@ func (s NeInfoController) ListAll(c *gin.Context) { // 查询实体参数 ne := model.NeInfo{} + if querys.CoreUID != "" { + ne.CoreUID = querys.CoreUID + } + if querys.NeUID != "" { + ne.NeUID = querys.NeUID + } if querys.NeType != "" { ne.NeType = querys.NeType } - if querys.NeId != "" { - ne.NeId = querys.NeId - } neList := s.neInfoService.Find(ne, querys.BandStatus, querys.BandHost) if len(neList) == 0 { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) @@ -182,7 +183,7 @@ func (s NeInfoController) ListAll(c *gin.Context) { // 网元端Para5G配置文件读取 // -// GET /para5GFile +// GET /file/para5g func (s NeInfoController) Para5GFileRead(c *gin.Context) { data, err := s.neInfoService.NeConfPara5GRead() if err != nil { @@ -194,7 +195,7 @@ func (s NeInfoController) Para5GFileRead(c *gin.Context) { // 网元端Para5G配置文件写入 // -// PUT /para5GFile +// PUT /file/para5g func (s NeInfoController) Para5GFileWrite(c *gin.Context) { var body struct { Content map[string]any `json:"content" binding:"required"` // 内容 @@ -216,11 +217,11 @@ func (s NeInfoController) Para5GFileWrite(c *gin.Context) { // 网元端OAM配置文件读取 // -// GET /oamFile +// GET /file/oam func (s NeInfoController) OAMFileRead(c *gin.Context) { var querys struct { - NeType string `form:"neType" binding:"required"` - NeID string `form:"neId" binding:"required"` + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `form:"neUid" binding:"required"` // 网元唯一标识 } if err := c.ShouldBindQuery(&querys); err != nil { errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) @@ -228,7 +229,7 @@ func (s NeInfoController) OAMFileRead(c *gin.Context) { return } - data, err := s.neInfoService.NeConfOAMReadSync(querys.NeType, querys.NeID) + data, err := s.neInfoService.NeConfOAMReadSync(querys.CoreUID, querys.NeUID) if err != nil { c.JSON(200, resp.ErrMsg(err.Error())) return @@ -238,12 +239,12 @@ func (s NeInfoController) OAMFileRead(c *gin.Context) { // 网元端OAM配置文件写入 // -// PUT /oamFile +// PUT /file/oam func (s NeInfoController) OAMFileWrite(c *gin.Context) { language := reqctx.AcceptLanguage(c) var body struct { - NeType string `json:"neType" binding:"required"` - NeID string `json:"neId" binding:"required"` + CoreUID string `json:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `json:"neUid" binding:"required"` // 网元唯一标识 Content map[string]any `json:"content" binding:"required"` // 内容 Sync bool `json:"sync"` // 同步到网元 } @@ -254,8 +255,8 @@ func (s NeInfoController) OAMFileWrite(c *gin.Context) { } // 查询网元获取IP - neInfo := s.neInfoService.FindByNeTypeAndNeID(body.NeType, body.NeID) - if neInfo.NeId != body.NeID || neInfo.IP == "" { + neInfo := s.neInfoService.FindByCoreUidAndNeUid(body.CoreUID, body.NeUID) + if neInfo.CoreUID != body.CoreUID || neInfo.NeUID != body.NeUID { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } @@ -272,7 +273,7 @@ func (s NeInfoController) OAMFileWrite(c *gin.Context) { // // GET /list // -// @Tags ne +// @Tags network_element/info // @Accept json // @Produce json // @Param bandStatus query boolean false "The result carries the state of the network element" @@ -287,6 +288,11 @@ func (s NeInfoController) OAMFileWrite(c *gin.Context) { // @Router /ne/info/list [get] func (s NeInfoController) List(c *gin.Context) { query := reqctx.QueryMap(c) + coreUid, coreUidOk := query["coreUid"] + if !coreUidOk || coreUid == "" { + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: coreUid is empty")) + return + } bandStatus := false if v, ok := query["bandStatus"]; ok { bandStatus = parse.Boolean(v) @@ -297,9 +303,9 @@ func (s NeInfoController) List(c *gin.Context) { // 网元信息 // -// GET /:id +// GET / // -// @Tags ne +// @Tags network_element/info // @Accept json // @Produce json // @Param value path string true "Row ID" @@ -307,30 +313,34 @@ func (s NeInfoController) List(c *gin.Context) { // @Security TokenAuth // @Summary Network element information // @Description Network element information -// @Router /ne/info/{value} [get] +// @Router /ne/info [get] func (s NeInfoController) Info(c *gin.Context) { language := reqctx.AcceptLanguage(c) - id := parse.Number(c.Param("id")) - if id <= 0 { - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: id is empty")) + var query struct { + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + ID int64 `form:"id" binding:"required"` // ID + } + if err := c.ShouldBindQuery(&query); err != nil { + errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs)) return } - neHost := s.neInfoService.FindById(id, true) - if neHost.ID != id { + info := s.neInfoService.FindById(query.ID, true) + if info.ID != query.ID || info.CoreUID != query.CoreUID { // 没有可访问网元信息数据! c.JSON(200, resp.ErrMsg(i18n.TKey(language, "neInfo.noData"))) return } - c.JSON(200, resp.OkData(neHost)) + c.JSON(200, resp.OkData(info)) } // 网元信息新增 // // POST / // -// @Tags ne +// @Tags network_element/info // @Accept json // @Produce json // @Param data body object true "Request Param" @@ -340,7 +350,6 @@ func (s NeInfoController) Info(c *gin.Context) { // @Description Network element information addition // @Router /ne/info [post] func (s NeInfoController) Add(c *gin.Context) { - language := reqctx.AcceptLanguage(c) var body model.NeInfo err := c.ShouldBindBodyWithJSON(&body) if err != nil { @@ -352,68 +361,12 @@ func (s NeInfoController) Add(c *gin.Context) { c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: id not is empty")) return } - - // 检查属性值唯一 - uniqueInfo := s.neInfoService.CheckUniqueNeTypeAndNeId(body.NeType, body.NeId, 0) - if !uniqueInfo { - // 网元信息操作【%s】失败,同类型下标识已存在 - msg := i18n.TTemplate(language, "neInfo.errKeyExists", map[string]any{"key": body.NeId}) - c.JSON(200, resp.ErrMsg(msg)) + if body.CoreUID == "" { + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: coreUid is empty")) return } - // 获取网元状态是否正常 - body.ServerState, err = neFetchlink.NeState(body) - if err != nil { - body.Status = 0 - } else { - // 网元状态设置为在线 - body.Status = 1 - if parse.Boolean(body.ServerState["standby"]) { - body.Status = 3 - } - // 下发网管配置信息给网元 - if _, err = neFetchlink.NeConfigOMC(body); err != nil { - body.Status = 2 - } - } - - loginUserName := reqctx.LoginUserToUserName(c) - // 新增Version信息 - neVersion := model.NeVersion{ - NeType: body.NeType, - NeId: body.NeId, - CreateBy: loginUserName, - } - // 新增License信息 - neLicense := model.NeLicense{ - NeType: body.NeType, - NeId: body.NeId, - CreateBy: loginUserName, - } - - // 已有网元可获取的信息 - if body.ServerState != nil { - if v, ok := body.ServerState["version"]; ok && v != nil { - neVersion.Name = "-" - neVersion.Path = "-" - neVersion.Version = fmt.Sprint(v) - } - if v, ok := body.ServerState["capability"]; ok && v != nil { - neLicense.Capability = parse.Number(v) - } - if v, ok := body.ServerState["sn"]; ok && v != nil { - neLicense.SerialNum = fmt.Sprint(v) - } - if v, ok := body.ServerState["expire"]; ok && v != nil { - neLicense.ExpiryDate = fmt.Sprint(v) - neLicense.Status = "1" - } - } - - s.neVersionService.Insert(neVersion) - s.neLicenseService.Insert(neLicense) - body.CreateBy = loginUserName + body.CreateBy = reqctx.LoginUserToUserName(c) insertId := s.neInfoService.Insert(body) if insertId > 0 { c.JSON(200, resp.OkData(insertId)) @@ -426,7 +379,7 @@ func (s NeInfoController) Add(c *gin.Context) { // // PUT / // -// @Tags ne +// @Tags network_element/info // @Accept json // @Produce json // @Param data body object true "Request Param" @@ -449,15 +402,6 @@ func (s NeInfoController) Edit(c *gin.Context) { return } - // 检查属性值唯一 - uniqueInfo := s.neInfoService.CheckUniqueNeTypeAndNeId(body.NeType, body.NeId, body.ID) - if !uniqueInfo { - // 网元信息操作【%s】失败,同类型下标识已存在 - msg := i18n.TTemplate(language, "neInfo.errKeyExists", map[string]any{"key": body.NeId}) - c.JSON(200, resp.ErrMsg(msg)) - return - } - // 检查是否存在 neInfo := s.neInfoService.FindById(body.ID, false) if neInfo.ID != body.ID { @@ -465,71 +409,10 @@ func (s NeInfoController) Edit(c *gin.Context) { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "neInfo.noData"))) return } - // 赋予主机ID - if neInfo.HostIDs != "" && len(body.Hosts) > 0 { - hostIDs := strings.Split(neInfo.HostIDs, ",") - for index, id := range hostIDs { - body.Hosts[index].ID = parse.Number(id) - } - } - // 获取网元状态是否正常 - body.ServerState, err = neFetchlink.NeState(neInfo) - if err != nil { - body.Status = 0 - } else { - // 网元状态设置为在线 - body.Status = 1 - if parse.Boolean(body.ServerState["standby"]) { - body.Status = 3 - } - // 下发网管配置信息给网元 - if _, err = neFetchlink.NeConfigOMC(body); err != nil { - body.Status = 2 - } - } - - loginUserName := reqctx.LoginUserToUserName(c) - neLicense := s.neLicenseService.FindByNeTypeAndNeID(neInfo.NeType, neInfo.NeId) - neVersion := s.neVersionService.FindByNeTypeAndNeID(neInfo.NeType, neInfo.NeId) - - // 已有网元可获取的信息 - if body.ServerState != nil { - if v, ok := body.ServerState["version"]; ok && v != nil { - neVersion.Name = "-" - neVersion.Path = "-" - neVersion.Version = fmt.Sprint(v) - neVersion.UpdateBy = loginUserName - } - if v, ok := body.ServerState["capability"]; ok && v != nil { - neLicense.Capability = parse.Number(v) - } - if v, ok := body.ServerState["sn"]; ok && v != nil { - neLicense.SerialNum = fmt.Sprint(v) - } - if v, ok := body.ServerState["expire"]; ok && v != nil { - neLicense.ExpiryDate = fmt.Sprint(v) - neLicense.Status = "1" - neLicense.UpdateBy = loginUserName - } - } - - if neVersion.ID <= 0 { - if neVersion.NeType != body.NeType || neVersion.NeId != body.NeId { - neVersion.NeType = body.NeType - neVersion.NeId = body.NeId - } - s.neVersionService.Update(neVersion) - } - if neLicense.ID <= 0 { - if neLicense.NeType != body.NeType || neLicense.NeId != body.NeId { - neLicense.NeType = body.NeType - neLicense.NeId = body.NeId - } - s.neLicenseService.Update(neLicense) - } - - body.UpdateBy = loginUserName + body.CoreUID = neInfo.CoreUID + body.NeUID = neInfo.NeUID + body.UpdateBy = reqctx.LoginUserToUserName(c) rows := s.neInfoService.Update(body) if rows > 0 { c.JSON(200, resp.Ok(nil)) @@ -542,7 +425,7 @@ func (s NeInfoController) Edit(c *gin.Context) { // // DELETE /:id // -// @Tags ne +// @Tags network_element/info // @Accept json // @Produce json // @Param value path string true "Row ID" @@ -553,21 +436,18 @@ func (s NeInfoController) Edit(c *gin.Context) { // @Router /ne/info [delete] func (s NeInfoController) Remove(c *gin.Context) { language := reqctx.AcceptLanguage(c) - id := c.Param("id") - if id == "" { - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: id is empty")) + var query struct { + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `form:"neUid" binding:"required"` // 网元唯一标识 + ID int64 `form:"id" binding:"required"` // 记录ID + } + if err := c.ShouldBindQuery(&query); err != nil { + errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs)) return } - // 处理字符转id数组后去重 - uniqueIDs := parse.RemoveDuplicatesToArray(id, ",") - // 转换成int64数组类型 - ids := make([]int64, 0) - for _, v := range uniqueIDs { - ids = append(ids, parse.Number(v)) - } - - rows, err := s.neInfoService.DeleteByIds(ids) + rows, err := s.neInfoService.DeleteById(query.ID, query.CoreUID, query.NeUID) if err != nil { c.JSON(200, resp.ErrMsg(i18n.TKey(language, err.Error()))) return diff --git a/src/modules/ne/controller/ne_license.go b/src/modules/ne/controller/ne_license.go index c1933faa..582f5dd5 100644 --- a/src/modules/ne/controller/ne_license.go +++ b/src/modules/ne/controller/ne_license.go @@ -33,7 +33,7 @@ type NeLicenseController struct { // // GET /list // -// @Tags ne +// @Tags network_element/license // @Accept json // @Produce json // @Param neType query string false "NE Type" Enums(IMS,AMF,AUSF,UDM,SMF,PCF,NSSF,NRF,UPF,MME,CBC,OMC,SGWC,SMSC) @@ -48,6 +48,11 @@ type NeLicenseController struct { // @Router /ne/license/list [get] func (s *NeLicenseController) List(c *gin.Context) { query := reqctx.QueryMap(c) + coreUid, coreUidOk := query["coreUid"] + if !coreUidOk || coreUid == "" { + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: coreUid is empty")) + return + } rows, total := s.neLicenseService.FindByPage(query) // 过滤屏蔽授权文件 @@ -62,17 +67,21 @@ func (s *NeLicenseController) List(c *gin.Context) { // 网元授权激活信息 // -// GET /:id +// GET / func (s *NeLicenseController) Info(c *gin.Context) { language := reqctx.AcceptLanguage(c) - id := parse.Number(c.Param("id")) - if id <= 0 { - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: id is empty")) + var query struct { + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + ID int64 `form:"id" binding:"required"` // ID + } + if err := c.ShouldBindQuery(&query); err != nil { + errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs)) return } - neLicense := s.neLicenseService.FindById(id) - if neLicense.ID != id { + neLicense := s.neLicenseService.FindById(query.ID) + if neLicense.ID != query.ID || neLicense.CoreUID != query.CoreUID { // 没有可访问网元授权激活数据! c.JSON(200, resp.ErrMsg(i18n.TKey(language, "neLicense.noData"))) return @@ -81,25 +90,25 @@ func (s *NeLicenseController) Info(c *gin.Context) { c.JSON(200, resp.OkData(neLicense)) } -// 网元neType和neID查询 +// 网元信息查询 // -// GET /byTypeAndID +// GET /nf // -// @Tags ne +// @Tags network_element/license // @Accept json // @Produce json -// @Param neType query string true "NE Type" Enums(IMS,AMF,AUSF,UDM,SMF,PCF,NSSF,NRF,UPF,MME,CBC,OMC,SGWC,SMSC) -// @Param neId query string true "NE ID" default(001) +// @Param coreUid query string true "CoreUID" default(8I73Y01Z) +// @Param neUid query string true "NeUID" default(5AKF59BZ) // @Success 200 {object} object "Response Results" // @Security TokenAuth // @Summary Network element neType and neID queries // @Description Network element neType and neID queries -// @Router /ne/license/byTypeAndID [get] -func (s *NeLicenseController) NeTypeAndID(c *gin.Context) { +// @Router /ne/license/nf [get] +func (s *NeLicenseController) Nf(c *gin.Context) { language := reqctx.AcceptLanguage(c) var querys struct { - NeType string `form:"neType" binding:"required"` - NeId string `form:"neId" binding:"required"` + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `form:"neUid" binding:"required"` // 网元唯一标识 } if err := c.ShouldBindQuery(&querys); err != nil { errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) @@ -107,8 +116,8 @@ func (s *NeLicenseController) NeTypeAndID(c *gin.Context) { return } - neLicense := s.neLicenseService.FindByNeTypeAndNeID(querys.NeType, querys.NeId) - if neLicense.NeId != querys.NeId { + neLicense := s.neLicenseService.FindByCoreUidAndNeUid(querys.CoreUID, querys.NeUID) + if neLicense.CoreUID != querys.CoreUID || neLicense.NeUID != querys.NeUID { // 没有可访问网元授权激活数据! c.JSON(200, resp.ErrMsg(i18n.TKey(language, "neLicense.noData"))) return @@ -121,7 +130,7 @@ func (s *NeLicenseController) NeTypeAndID(c *gin.Context) { // // GET /code // -// @Tags ne +// @Tags network_element/license // @Accept json // @Produce json // @Param neType query string true "NE Type" Enums(IMS,AMF,AUSF,UDM,SMF,PCF,NSSF,NRF,UPF,MME,CBC,OMC,SGWC,SMSC) @@ -134,8 +143,8 @@ func (s *NeLicenseController) NeTypeAndID(c *gin.Context) { func (s *NeLicenseController) Code(c *gin.Context) { language := reqctx.AcceptLanguage(c) var querys struct { - NeType string `form:"neType" binding:"required"` - NeId string `form:"neId" binding:"required"` + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `form:"neUid" binding:"required"` // 网元唯一标识 } if err := c.ShouldBindQuery(&querys); err != nil { errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) @@ -144,8 +153,8 @@ func (s *NeLicenseController) Code(c *gin.Context) { } // 检查是否存在授权记录 - neLicense := s.neLicenseService.FindByNeTypeAndNeID(querys.NeType, querys.NeId) - if neLicense.NeId != querys.NeId { + neLicense := s.neLicenseService.FindByCoreUidAndNeUid(querys.CoreUID, querys.NeUID) + if neLicense.CoreUID != querys.CoreUID || neLicense.NeUID != querys.NeUID { // 没有可访问网元授权激活数据! c.JSON(200, resp.ErrMsg(i18n.TKey(language, "neLicense.noData"))) return @@ -157,9 +166,10 @@ func (s *NeLicenseController) Code(c *gin.Context) { if licensePath != "" { neLicense.LicensePath = licensePath } else { - neLicense.Capability = 0 neLicense.SerialNum = "" neLicense.ExpiryDate = "" + neLicense.UeNumber = 0 + neLicense.NbNumber = 0 neLicense.Status = "0" } neLicense.UpdateBy = reqctx.LoginUserToUserName(c) @@ -172,7 +182,7 @@ func (s *NeLicenseController) Code(c *gin.Context) { // // POST /change // -// @Tags ne +// @Tags network_element/license // @Accept json // @Produce json // @Param data body object true "Request Param" @@ -192,8 +202,8 @@ func (s *NeLicenseController) Change(c *gin.Context) { } // 检查是否存在授权记录 - neLicense := s.neLicenseService.FindByNeTypeAndNeID(body.NeType, body.NeId) - if neLicense.NeId != body.NeId { + neLicense := s.neLicenseService.FindByCoreUidAndNeUid(body.CoreUID, body.NeUID) + if neLicense.CoreUID != body.CoreUID || neLicense.NeUID != body.NeUID { // 没有可访问网元授权激活数据! c.JSON(200, resp.ErrMsg(i18n.TKey(language, "neLicense.noData"))) return @@ -224,7 +234,7 @@ func (s *NeLicenseController) Change(c *gin.Context) { // // GET /state // -// @Tags ne +// @Tags network_element/license // @Accept json // @Produce json // @Param neType query string true "NE Type" Enums(IMS,AMF,AUSF,UDM,SMF,PCF,NSSF,NRF,UPF,MME,CBC,OMC,SGWC,SMSC) @@ -237,8 +247,8 @@ func (s *NeLicenseController) Change(c *gin.Context) { func (s *NeLicenseController) State(c *gin.Context) { language := reqctx.AcceptLanguage(c) var querys struct { - NeType string `form:"neType" binding:"required"` - NeId string `form:"neId" binding:"required"` + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `form:"neUid" binding:"required"` // 网元唯一标识 } if err := c.ShouldBindQuery(&querys); err != nil { c.JSON(400, resp.CodeMsg(400, i18n.TKey(language, "app.common.err400"))) @@ -246,24 +256,25 @@ func (s *NeLicenseController) State(c *gin.Context) { } // 检查是否存在授权记录 - neLicense := s.neLicenseService.FindByNeTypeAndNeID(querys.NeType, querys.NeId) - if neLicense.NeId != querys.NeId { + neLicense := s.neLicenseService.FindByCoreUidAndNeUid(querys.CoreUID, querys.NeUID) + if neLicense.CoreUID != querys.CoreUID || neLicense.NeUID != querys.NeUID { // 没有可访问网元授权激活数据! c.JSON(200, resp.ErrMsg(i18n.TKey(language, "neLicense.noData"))) return } // 查询网元获取IP获取网元状态 - neInfo := s.neInfoService.FindByNeTypeAndNeID(neLicense.NeType, neLicense.NeId) - if neInfo.NeId != neLicense.NeId || neInfo.IP == "" { + neInfo := s.neInfoService.FindByCoreUidAndNeUid(neLicense.CoreUID, neLicense.NeUID) + if neInfo.CoreUID != neLicense.CoreUID || neInfo.NeUID != neLicense.NeUID { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } if neState, err := neFetchlink.NeState(neInfo); err == nil && neState["sn"] != nil { neLicense.Status = "1" - neLicense.Capability = parse.Number(neState["capability"]) neLicense.SerialNum = fmt.Sprint(neState["sn"]) neLicense.ExpiryDate = fmt.Sprint(neState["expire"]) + neLicense.UeNumber = parse.Number(neState["ueNumber"]) + neLicense.NbNumber = parse.Number(neState["nbNumber"]) } else { neLicense.Status = "0" } @@ -280,9 +291,10 @@ func (s *NeLicenseController) State(c *gin.Context) { if neLicense.Status == "1" { c.JSON(200, resp.OkData(map[string]any{ - "capability": neLicense.Capability, - "sn": neLicense.SerialNum, - "expire": neLicense.ExpiryDate, + "sn": neLicense.SerialNum, + "expire": neLicense.ExpiryDate, + "ueNumber": neLicense.UeNumber, + "nbNumber": neLicense.NbNumber, })) return } diff --git a/src/modules/ne/controller/ne_software.go b/src/modules/ne/controller/ne_software.go index 7f7b4a0f..817b9c88 100644 --- a/src/modules/ne/controller/ne_software.go +++ b/src/modules/ne/controller/ne_software.go @@ -101,7 +101,7 @@ func (s NeSoftwareController) Add(c *gin.Context) { }) if len(neSoftwares) > 0 { neSoftware := neSoftwares[0] - s.neSoftwareService.DeleteByIds([]int64{neSoftware.ID}) + s.neSoftwareService.DeleteByIds([]int64{neSoftware.ID}, false) } // 检查属性值唯一 @@ -183,7 +183,7 @@ func (s NeSoftwareController) Remove(c *gin.Context) { ids = append(ids, parse.Number(v)) } - rows, err := s.neSoftwareService.DeleteByIds(ids) + rows, err := s.neSoftwareService.DeleteByIds(ids, true) if err != nil { c.JSON(200, resp.ErrMsg(i18n.TKey(language, err.Error()))) return diff --git a/src/modules/ne/controller/ne_version.go b/src/modules/ne/controller/ne_version.go index 42da7139..26cbdadd 100644 --- a/src/modules/ne/controller/ne_version.go +++ b/src/modules/ne/controller/ne_version.go @@ -6,22 +6,21 @@ import ( "be.ems/src/framework/i18n" "be.ems/src/framework/reqctx" "be.ems/src/framework/resp" - "be.ems/src/framework/utils/parse" - neService "be.ems/src/modules/ne/service" + ne "be.ems/src/modules/ne/service" "github.com/gin-gonic/gin" ) // 实例化控制层 NeVersionController 结构体 var NewNeVersion = &NeVersionController{ - neVersionService: neService.NewNeVersion, + neVersionService: ne.NewNeVersion, } // 网元版本请求 // // PATH /version type NeVersionController struct { - neVersionService *neService.NeVersion // 网元版本服务 + neVersionService *ne.NeVersion // 网元版本服务 } // 网元版本列表 @@ -29,23 +28,32 @@ type NeVersionController struct { // GET /list func (s *NeVersionController) List(c *gin.Context) { query := reqctx.QueryMap(c) + coreUid, coreUidOk := query["coreUid"] + if !coreUidOk || coreUid == "" { + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: coreUid is empty")) + return + } rows, total := s.neVersionService.FindByPage(query, true) c.JSON(200, resp.OkData(map[string]any{"total": total, "rows": rows})) } // 网元版本信息 // -// GET /:id +// GET / func (s *NeVersionController) Info(c *gin.Context) { language := reqctx.AcceptLanguage(c) - id := parse.Number(c.Param("id")) - if id <= 0 { - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: id is empty")) + var query struct { + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + ID int64 `form:"id" binding:"required"` // 记录ID + } + if err := c.ShouldBindQuery(&query); err != nil { + errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs)) return } - neVersion := s.neVersionService.FindById(id) - if neVersion.ID != id { + neVersion := s.neVersionService.FindById(query.ID) + if neVersion.ID != query.ID || neVersion.CoreUID != query.CoreUID { // 没有可访问网元版本数据! c.JSON(200, resp.ErrMsg(i18n.TKey(language, "neVersion.noData"))) return @@ -54,11 +62,36 @@ func (s *NeVersionController) Info(c *gin.Context) { c.JSON(200, resp.OkData(neVersion)) } +// 网元信息查询 +// +// GET /nf +func (s *NeVersionController) Nf(c *gin.Context) { + language := reqctx.AcceptLanguage(c) + var querys struct { + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `form:"neUid" binding:"required"` // 网元唯一标识 + } + if err := c.ShouldBindQuery(&querys); err != nil { + errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs)) + return + } + + neVersion := s.neVersionService.FindByCoreUidAndNeUid(querys.CoreUID, querys.NeUID) + if neVersion.CoreUID != querys.CoreUID || neVersion.NeUID != querys.NeUID { + // 没有可访问网元授权激活数据! + c.JSON(200, resp.ErrMsg(i18n.TKey(language, "neLicense.noData"))) + return + } + + c.JSON(200, resp.OkData(neVersion)) +} + // 网元版本操作 // // POST /operate // -// @Tags ne +// @Tags network_element/version // @Accept json // @Produce json // @Param data body object true "Request Param" @@ -70,9 +103,9 @@ func (s *NeVersionController) Info(c *gin.Context) { func (s *NeVersionController) Operate(c *gin.Context) { language := reqctx.AcceptLanguage(c) var body struct { + CoreUID string `json:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `json:"neUid" binding:"required"` // 网元唯一标识 Action string `json:"action" binding:"required,oneof=install upgrade rollback"` // 操作行为 - NeType string `json:"neType" gorm:"ne_type" binding:"required"` // 网元类型 - NeId string `json:"neId" gorm:"ne_id" binding:"required"` // 网元ID Preinput map[string]string `json:"preinput" ` // 预先输入参数 } if err := c.ShouldBindBodyWithJSON(&body); err != nil { @@ -81,8 +114,8 @@ func (s *NeVersionController) Operate(c *gin.Context) { return } - neVersion := s.neVersionService.FindByNeTypeAndNeID(body.NeType, body.NeId) - if neVersion.NeId != body.NeId { + neVersion := s.neVersionService.FindByCoreUidAndNeUid(body.CoreUID, body.NeUID) + if neVersion.CoreUID != body.CoreUID || neVersion.NeUID != body.NeUID { // 没有可访问网元版本数据! c.JSON(200, resp.ErrMsg(i18n.TKey(language, "neVersion.noData"))) return diff --git a/src/modules/ne/fetch_link/alarm.go b/src/modules/ne/fetch_link/alarm.go index 42603fd1..286d8f1b 100644 --- a/src/modules/ne/fetch_link/alarm.go +++ b/src/modules/ne/fetch_link/alarm.go @@ -13,7 +13,7 @@ import ( // AlarmHistory 告警历史记录 func AlarmHistory(neInfo model.NeInfo) ([]map[string]any, error) { // 网元参数配置信息 - neUrl := fmt.Sprintf("http://%s:%d/api/rest/faultManagement/v1/elementType/%s/objectType/alarms", neInfo.IP, neInfo.Port, strings.ToLower(neInfo.NeType)) + neUrl := fmt.Sprintf("http://%s:%d/api/rest/faultManagement/v1/elementType/%s/objectType/alarms", neInfo.IPAddr, neInfo.Port, strings.ToLower(neInfo.NeType)) resBytes, err := fetch.Get(neUrl, nil, 60_000) var resData []map[string]any if err != nil { diff --git a/src/modules/ne/fetch_link/amf.go b/src/modules/ne/fetch_link/amf.go index db3edbad..31b897cc 100644 --- a/src/modules/ne/fetch_link/amf.go +++ b/src/modules/ne/fetch_link/amf.go @@ -16,7 +16,7 @@ import ( // // 返回结果 [] func AMFNbInfoList(neInfo model.NeInfo, data map[string]string) ([]map[string]any, error) { - neUrl := fmt.Sprintf("http://%s:%d/api/rest/ueManagement/v1/elementType/amf/objectType/nbInfo", neInfo.IP, neInfo.Port) + neUrl := fmt.Sprintf("http://%s:%d/api/rest/ueManagement/v1/elementType/amf/objectType/nbInfo", neInfo.IPAddr, neInfo.Port) // 查询参数拼接 query := []string{} if v, ok := data["id"]; ok && v != "" { @@ -59,7 +59,7 @@ func AMFNbInfoList(neInfo model.NeInfo, data map[string]string) ([]map[string]an // // 返回结果 [] func AMFGnbStateList(neInfo model.NeInfo) ([]map[string]any, error) { - neUrl := fmt.Sprintf("http://%s:%d/api/rest/ueManagement/v1/elementType/amf/objectType/nbState", neInfo.IP, neInfo.Port) + neUrl := fmt.Sprintf("http://%s:%d/api/rest/ueManagement/v1/elementType/amf/objectType/nbState", neInfo.IPAddr, neInfo.Port) resBytes, err := fetch.Get(neUrl, nil, 60_000) if err != nil { errStr := err.Error() diff --git a/src/modules/ne/fetch_link/hlr.go b/src/modules/ne/fetch_link/hlr.go index 9b999e77..622bc4d2 100644 --- a/src/modules/ne/fetch_link/hlr.go +++ b/src/modules/ne/fetch_link/hlr.go @@ -18,7 +18,7 @@ import ( // data参数 {traceID:"跟踪任务ID", imsi:"IMSI和MSISDN必填一个,都带的话以IMSI为准", msisdn:""} func HLRTraceStart(neInfo model.NeInfo, data map[string]any) (string, error) { // 网元参数配置新增(array) - neUrl := fmt.Sprintf("http://%s:%d/trace-manage/v1/add-task", neInfo.IP, neInfo.Port) + neUrl := fmt.Sprintf("http://%s:%d/trace-manage/v1/add-task", neInfo.IPAddr, neInfo.Port) resBytes, err := fetch.PostJSON(neUrl, data, nil) var resData map[string]string if err != nil { @@ -45,7 +45,7 @@ func HLRTraceStart(neInfo model.NeInfo, data map[string]any) (string, error) { // data参数 {traceIDArray: ["跟踪任务ID数组"]} func HLRTraceStop(neInfo model.NeInfo, data map[string]any) (string, error) { // 网元参数配置新增(array) - neUrl := fmt.Sprintf("http://%s:%d/trace-manage/v1/delete-task", neInfo.IP, neInfo.Port) + neUrl := fmt.Sprintf("http://%s:%d/trace-manage/v1/delete-task", neInfo.IPAddr, neInfo.Port) resBytes, err := fetch.PostJSON(neUrl, data, nil) var resData map[string]string if err != nil { diff --git a/src/modules/ne/fetch_link/ims.go b/src/modules/ne/fetch_link/ims.go index 52d4cbb8..49ad1518 100644 --- a/src/modules/ne/fetch_link/ims.go +++ b/src/modules/ne/fetch_link/ims.go @@ -15,7 +15,7 @@ import ( // // 返回结果 0 func IMSUeSessionNum(neInfo model.NeInfo) (int64, error) { - neUrl := fmt.Sprintf("http://%s:%d/api/rest/ueManagement/v1/elementType/ims/objectType/ueNum", neInfo.IP, neInfo.Port) + neUrl := fmt.Sprintf("http://%s:%d/api/rest/ueManagement/v1/elementType/ims/objectType/ueNum", neInfo.IPAddr, neInfo.Port) resBytes, err := fetch.Get(neUrl, nil, 60_000) if err != nil { errStr := err.Error() @@ -47,7 +47,7 @@ func IMSUeSessionNum(neInfo model.NeInfo) (int64, error) { // // 返回结果 [] func IMSUeSessionList(neInfo model.NeInfo, data map[string]string) ([]map[string]any, error) { - neUrl := fmt.Sprintf("http://%s:%d/api/rest/ueManagement/v1/elementType/ims/objectType/ueInfo", neInfo.IP, neInfo.Port) + neUrl := fmt.Sprintf("http://%s:%d/api/rest/ueManagement/v1/elementType/ims/objectType/ueInfo", neInfo.IPAddr, neInfo.Port) // 查询参数拼接 query := []string{} if v, ok := data["imsi"]; ok && v != "" { diff --git a/src/modules/ne/fetch_link/mme.go b/src/modules/ne/fetch_link/mme.go index b084569d..c7650004 100644 --- a/src/modules/ne/fetch_link/mme.go +++ b/src/modules/ne/fetch_link/mme.go @@ -16,7 +16,7 @@ import ( // // 返回结果 [] func MMENbInfoList(neInfo model.NeInfo, data map[string]string) ([]map[string]any, error) { - neUrl := fmt.Sprintf("http://%s:%d/api/rest/ueManagement/v1/elementType/mme/objectType/nbInfo", neInfo.IP, neInfo.Port) + neUrl := fmt.Sprintf("http://%s:%d/api/rest/ueManagement/v1/elementType/mme/objectType/nbInfo", neInfo.IPAddr, neInfo.Port) // 查询参数拼接 query := []string{} if v, ok := data["id"]; ok && v != "" { @@ -59,7 +59,7 @@ func MMENbInfoList(neInfo model.NeInfo, data map[string]string) ([]map[string]an // // 返回结果 [] func MMEEnbStateList(neInfo model.NeInfo) ([]map[string]any, error) { - neUrl := fmt.Sprintf("http://%s:%d/api/rest/ueManagement/v1/elementType/mme/objectType/nbState", neInfo.IP, neInfo.Port) + neUrl := fmt.Sprintf("http://%s:%d/api/rest/ueManagement/v1/elementType/mme/objectType/nbState", neInfo.IPAddr, neInfo.Port) resBytes, err := fetch.Get(neUrl, nil, 60_000) if err != nil { errStr := err.Error() diff --git a/src/modules/ne/fetch_link/n3iwf.go b/src/modules/ne/fetch_link/n3iwf.go index 3beabd4c..8ef54f5e 100644 --- a/src/modules/ne/fetch_link/n3iwf.go +++ b/src/modules/ne/fetch_link/n3iwf.go @@ -16,7 +16,7 @@ import ( // // 返回结果 {"rows":[],"total":0} func N3IWFSubInfoList(neInfo model.NeInfo, data map[string]string) (map[string]any, error) { - neUrl := fmt.Sprintf("http://%s:%d/api/rest/ueManagement/v1/elementType/n3iwf/objectType/ueInfo", neInfo.IP, neInfo.Port) + neUrl := fmt.Sprintf("http://%s:%d/api/rest/ueManagement/v1/elementType/n3iwf/objectType/ueInfo", neInfo.IPAddr, neInfo.Port) // 查询参数拼接 query := []string{} if v, ok := data["imsi"]; ok && v != "" { diff --git a/src/modules/ne/fetch_link/ne_config.go b/src/modules/ne/fetch_link/ne_config.go index d1546387..5ad6105e 100644 --- a/src/modules/ne/fetch_link/ne_config.go +++ b/src/modules/ne/fetch_link/ne_config.go @@ -13,14 +13,14 @@ import ( // NeConfigOMC 网元配置对端网管信息 func NeConfigOMC(neInfo model.NeInfo) (map[string]any, error) { // 网元配置对端网管信息 - neUrl := fmt.Sprintf("http://%s:%d/api/rest/systemManagement/v1/elementType/%s/objectType/config/omcNeConfig", neInfo.IP, neInfo.Port, strings.ToLower(neInfo.NeType)) + neUrl := fmt.Sprintf("http://%s:%d/api/rest/systemManagement/v1/elementType/%s/objectType/config/omcNeConfig", neInfo.IPAddr, neInfo.Port, strings.ToLower(neInfo.NeType)) resBytes, err := fetch.PutJSON(neUrl, map[string]any{ - "neId": neInfo.NeId, - "neName": neInfo.NeName, + "rmUID": neInfo.CoreUID, + "neId": neInfo.NeName, + "neName": neInfo.NeUID, "port": neInfo.Port, "province": neInfo.Province, "pvFlag": neInfo.PvFlag, - "rmUID": neInfo.RmUID, "vendorName": neInfo.VendorName, "dn": neInfo.Dn, }, nil) @@ -53,7 +53,7 @@ func NeConfigOMC(neInfo model.NeInfo) (map[string]any, error) { // NeConfigInfo 网元配置信息 func NeConfigInfo(neInfo model.NeInfo, paramName string) (map[string]any, error) { // 网元参数配置信息 - neUrl := fmt.Sprintf("http://%s:%d/api/rest/systemManagement/v1/elementType/%s/objectType/config/%s", neInfo.IP, neInfo.Port, strings.ToLower(neInfo.NeType), paramName) + neUrl := fmt.Sprintf("http://%s:%d/api/rest/systemManagement/v1/elementType/%s/objectType/config/%s", neInfo.IPAddr, neInfo.Port, strings.ToLower(neInfo.NeType), paramName) resBytes, err := fetch.Get(neUrl, nil, 30_000) if err != nil { logger.Warnf("NeConfigInfo Get \"%s\"", neUrl) @@ -82,7 +82,7 @@ func NeConfigUpdate(neInfo model.NeInfo, paramName, loc string, data map[string] loc = fmt.Sprintf("?loc=%v", loc) } // 网元参数配置新增(array) - neUrl := fmt.Sprintf("http://%s:%d/api/rest/systemManagement/v1/elementType/%s/objectType/config/%s%s", neInfo.IP, neInfo.Port, strings.ToLower(neInfo.NeType), paramName, loc) + neUrl := fmt.Sprintf("http://%s:%d/api/rest/systemManagement/v1/elementType/%s/objectType/config/%s%s", neInfo.IPAddr, neInfo.Port, strings.ToLower(neInfo.NeType), paramName, loc) resBytes, err := fetch.PutJSON(neUrl, data, nil) var resData map[string]any if err != nil { @@ -112,7 +112,7 @@ func NeConfigUpdate(neInfo model.NeInfo, paramName, loc string, data map[string] // NeConfigAdd 网元配置新增 array func NeConfigAdd(neInfo model.NeInfo, paramName, loc string, data map[string]any) (map[string]any, error) { // 网元参数配置新增(array) - neUrl := fmt.Sprintf("http://%s:%d/api/rest/systemManagement/v1/elementType/%s/objectType/config/%s?loc=%v", neInfo.IP, neInfo.Port, strings.ToLower(neInfo.NeType), paramName, loc) + neUrl := fmt.Sprintf("http://%s:%d/api/rest/systemManagement/v1/elementType/%s/objectType/config/%s?loc=%v", neInfo.IPAddr, neInfo.Port, strings.ToLower(neInfo.NeType), paramName, loc) resBytes, err := fetch.PostJSON(neUrl, data, nil) var resData map[string]any if err != nil { @@ -142,7 +142,7 @@ func NeConfigAdd(neInfo model.NeInfo, paramName, loc string, data map[string]any // NeConfigDelete 网元配置删除 array func NeConfigDelete(neInfo model.NeInfo, paramName, loc string) (map[string]any, error) { // 网元参数配置删除(array) - neUrl := fmt.Sprintf("http://%s:%d/api/rest/systemManagement/v1/elementType/%s/objectType/config/%s?loc=%v", neInfo.IP, neInfo.Port, strings.ToLower(neInfo.NeType), paramName, loc) + neUrl := fmt.Sprintf("http://%s:%d/api/rest/systemManagement/v1/elementType/%s/objectType/config/%s?loc=%v", neInfo.IPAddr, neInfo.Port, strings.ToLower(neInfo.NeType), paramName, loc) resBytes, err := fetch.Delete(neUrl, nil) var resData map[string]any if err != nil { diff --git a/src/modules/ne/fetch_link/ne_state.go b/src/modules/ne/fetch_link/ne_state.go index beb2ce13..c98e386b 100644 --- a/src/modules/ne/fetch_link/ne_state.go +++ b/src/modules/ne/fetch_link/ne_state.go @@ -8,13 +8,14 @@ import ( "be.ems/src/framework/logger" "be.ems/src/framework/utils/fetch" + "be.ems/src/framework/utils/parse" "be.ems/src/modules/ne/model" ) // NeState 获取网元端服务状态 func NeState(neInfo model.NeInfo) (map[string]any, error) { // 网元状态 - neUrl := fmt.Sprintf("http://%s:%d/api/rest/systemManagement/v1/elementType/%s/objectType/systemState", neInfo.IP, neInfo.Port, strings.ToLower(neInfo.NeType)) + neUrl := fmt.Sprintf("http://%s:%d/api/rest/systemManagement/v1/elementType/%s/objectType/systemState", neInfo.IPAddr, neInfo.Port, strings.ToLower(neInfo.NeType)) resBytes, err := fetch.Get(neUrl, nil, 1000) if err != nil { logger.Errorf("NeState %s", err.Error()) @@ -39,11 +40,12 @@ func NeState(neInfo model.NeInfo) (map[string]any, error) { } } - return map[string]any{ + info := map[string]any{ + "coreUid": neInfo.CoreUID, + "neUid": neInfo.NeUID, "neType": neInfo.NeType, - "neId": neInfo.NeId, "neName": neInfo.NeName, - "neIP": neInfo.IP, + "neIP": neInfo.IPAddr, "refreshTime": time.Now().UnixMilli(), // 获取时间 "standby": resData["standby"], // 是否备用服务 "version": resData["version"], @@ -55,5 +57,18 @@ func NeState(neInfo model.NeInfo) (map[string]any, error) { "cpu": resData["cpuUsage"], "mem": resData["memUsage"], "disk": resData["diskSpace"], - }, nil + } + + if ueNumber, ok := resData["capability"]; ok { + info["ueNumber"] = parse.Number(ueNumber) + } else { + info["ueNumber"] = 0 + } + if nbNumber, ok := resData["nbNumber"]; ok { + info["nbNumber"] = parse.Number(nbNumber) + } else { + info["nbNumber"] = 0 + } + + return info, nil } diff --git a/src/modules/ne/fetch_link/ne_trace.go b/src/modules/ne/fetch_link/ne_trace.go index 71e104e6..1e988952 100644 --- a/src/modules/ne/fetch_link/ne_trace.go +++ b/src/modules/ne/fetch_link/ne_trace.go @@ -13,7 +13,7 @@ import ( // NeTraceAdd 网元跟踪任务新增 func NeTraceAdd(neInfo model.NeInfo, data any) (map[string]any, error) { // 跟踪任务创建 - neUrl := fmt.Sprintf("http://%s:%d/api/rest/traceManagement/v2/%s/subscriptions", neInfo.IP, neInfo.Port, neInfo.NeType) + neUrl := fmt.Sprintf("http://%s:%d/api/rest/traceManagement/v2/%s/subscriptions", neInfo.IPAddr, neInfo.Port, neInfo.NeType) resBytes, err := fetch.PostJSON(neUrl, data, nil) var resData map[string]any if err != nil { @@ -41,7 +41,7 @@ func NeTraceAdd(neInfo model.NeInfo, data any) (map[string]any, error) { // NeTraceDelete 网元跟踪任务删除 func NeTraceDelete(neInfo model.NeInfo, traceId string) (map[string]any, error) { - neUrl := fmt.Sprintf("http://%s:%d/api/rest/traceManagement/v2/%s/subscriptions?id=%s", neInfo.IP, neInfo.Port, neInfo.NeType, traceId) + neUrl := fmt.Sprintf("http://%s:%d/api/rest/traceManagement/v2/%s/subscriptions?id=%s", neInfo.IPAddr, neInfo.Port, neInfo.NeType, traceId) resBytes, err := fetch.Delete(neUrl, nil) var resData map[string]any if err != nil { diff --git a/src/modules/ne/fetch_link/nssf.go b/src/modules/ne/fetch_link/nssf.go index ce4b7f91..6fe99212 100644 --- a/src/modules/ne/fetch_link/nssf.go +++ b/src/modules/ne/fetch_link/nssf.go @@ -13,7 +13,7 @@ import ( // // 返回结果 {"rows":[],"total":0} func NSSFSubInfoList(neInfo model.NeInfo) (map[string]any, error) { - neUrl := fmt.Sprintf("http://%s:%d/api/rest/ueManagement/v1/elementType/nssf/objectType/subscriptions", neInfo.IP, neInfo.Port) + neUrl := fmt.Sprintf("http://%s:%d/api/rest/ueManagement/v1/elementType/nssf/objectType/subscriptions", neInfo.IPAddr, neInfo.Port) resBytes, err := fetch.Get(neUrl, nil, 60_000) if err != nil { logger.Warnf("NSSFSubInfo Get \"%s\"", neUrl) @@ -54,7 +54,7 @@ func NSSFSubInfoList(neInfo model.NeInfo) (map[string]any, error) { // // 返回结果 {"rows":[],"total":0} func NSSFAvailableAMFList(neInfo model.NeInfo) (map[string]any, error) { - neUrl := fmt.Sprintf("http://%s:%d/api/rest/ueManagement/v1/elementType/nssf/objectType/availableAMFs", neInfo.IP, neInfo.Port) + neUrl := fmt.Sprintf("http://%s:%d/api/rest/ueManagement/v1/elementType/nssf/objectType/availableAMFs", neInfo.IPAddr, neInfo.Port) resBytes, err := fetch.Get(neUrl, nil, 60_000) if err != nil { logger.Warnf("NSSFAvailableAMFList Get \"%s\"", neUrl) diff --git a/src/modules/ne/fetch_link/pcf.go b/src/modules/ne/fetch_link/pcf.go index 8af0fa4c..3748032f 100644 --- a/src/modules/ne/fetch_link/pcf.go +++ b/src/modules/ne/fetch_link/pcf.go @@ -12,7 +12,7 @@ import ( // PCFRuleInfo PCF策略配置查询信息 func PCFRuleInfo(neInfo model.NeInfo, data map[string]string) ([]map[string]any, error) { - neUrl := fmt.Sprintf("http://%s:%d/api/rest/ueManagement/v1/elementType/pcf/objectType/ueInfo", neInfo.IP, neInfo.Port) + neUrl := fmt.Sprintf("http://%s:%d/api/rest/ueManagement/v1/elementType/pcf/objectType/ueInfo", neInfo.IPAddr, neInfo.Port) // 查询参数拼接 query := []string{} if v, ok := data["imsi"]; ok && v != "" { @@ -56,7 +56,7 @@ func PCFRuleInfo(neInfo model.NeInfo, data map[string]string) ([]map[string]any, // PCFRuleAdd PCF策略配置添加 func PCFRuleAdd(neInfo model.NeInfo, data any) error { - neUrl := fmt.Sprintf("http://%s:%d/api/rest/ueManagement/v1/elementType/pcf/objectType/ueInfo", neInfo.IP, neInfo.Port) + neUrl := fmt.Sprintf("http://%s:%d/api/rest/ueManagement/v1/elementType/pcf/objectType/ueInfo", neInfo.IPAddr, neInfo.Port) resBytes, err := fetch.PostJSON(neUrl, data, nil) if err != nil { errStr := err.Error() @@ -85,7 +85,7 @@ func PCFRuleAdd(neInfo model.NeInfo, data any) error { // PCFRuleAddBatch PCF策略配置批量添加 func PCFRuleAddBatch(neInfo model.NeInfo, data map[string]any, num int64) error { - neUrl := fmt.Sprintf("http://%s:%d/api/rest/ueManagement/v1/elementType/pcf/objectType/ueInfo/batch/%d", neInfo.IP, neInfo.Port, num) + neUrl := fmt.Sprintf("http://%s:%d/api/rest/ueManagement/v1/elementType/pcf/objectType/ueInfo/batch/%d", neInfo.IPAddr, neInfo.Port, num) resBytes, err := fetch.PostJSON(neUrl, data, nil) if err != nil { errStr := err.Error() @@ -114,7 +114,7 @@ func PCFRuleAddBatch(neInfo model.NeInfo, data map[string]any, num int64) error // PCFRuleUpdate PCF策略配置修改 func PCFRuleUpdate(neInfo model.NeInfo, data map[string]any) error { - neUrl := fmt.Sprintf("http://%s:%d/api/rest/ueManagement/v1/elementType/pcf/objectType/ueInfo", neInfo.IP, neInfo.Port) + neUrl := fmt.Sprintf("http://%s:%d/api/rest/ueManagement/v1/elementType/pcf/objectType/ueInfo", neInfo.IPAddr, neInfo.Port) resBytes, err := fetch.PutJSON(neUrl, data, nil) if err != nil { errStr := err.Error() @@ -139,7 +139,7 @@ func PCFRuleUpdate(neInfo model.NeInfo, data map[string]any) error { // PCFRuleUpdateBatch PCF策略配置批量修改 func PCFRuleUpdateBatch(neInfo model.NeInfo, data map[string]any, num int64) error { - neUrl := fmt.Sprintf("http://%s:%d/api/rest/ueManagement/v1/elementType/pcf/objectType/ueInfo/batch/%d", neInfo.IP, neInfo.Port, num) + neUrl := fmt.Sprintf("http://%s:%d/api/rest/ueManagement/v1/elementType/pcf/objectType/ueInfo/batch/%d", neInfo.IPAddr, neInfo.Port, num) resBytes, err := fetch.PutJSON(neUrl, data, nil) if err != nil { errStr := err.Error() @@ -164,7 +164,7 @@ func PCFRuleUpdateBatch(neInfo model.NeInfo, data map[string]any, num int64) err // PCFRuleDelete PCF策略配置删除 func PCFRuleDelete(neInfo model.NeInfo, imsi string) error { - neUrl := fmt.Sprintf("http://%s:%d/api/rest/ueManagement/v1/elementType/pcf/objectType/ueInfo?imsi=%s", neInfo.IP, neInfo.Port, imsi) + neUrl := fmt.Sprintf("http://%s:%d/api/rest/ueManagement/v1/elementType/pcf/objectType/ueInfo?imsi=%s", neInfo.IPAddr, neInfo.Port, imsi) resBytes, err := fetch.Delete(neUrl, nil) if err != nil { errStr := err.Error() @@ -193,7 +193,7 @@ func PCFRuleDelete(neInfo model.NeInfo, imsi string) error { // PCFRuleDeleteBatch PCF策略配置批量删除 func PCFRuleDeleteBatch(neInfo model.NeInfo, imsi string, num int64) error { - neUrl := fmt.Sprintf("http://%s:%d/api/rest/ueManagement/v1/elementType/pcf/objectType/ueInfo/batch/%d?imsi=%s", neInfo.IP, neInfo.Port, num, imsi) + neUrl := fmt.Sprintf("http://%s:%d/api/rest/ueManagement/v1/elementType/pcf/objectType/ueInfo/batch/%d?imsi=%s", neInfo.IPAddr, neInfo.Port, num, imsi) resBytes, err := fetch.Delete(neUrl, nil) if err != nil { errStr := err.Error() @@ -222,7 +222,7 @@ func PCFRuleDeleteBatch(neInfo model.NeInfo, imsi string, num int64) error { // PCFRuleExport PCF策略配置导出 func PCFRuleExport(neInfo model.NeInfo, data map[string]string) ([]byte, error) { - neUrl := fmt.Sprintf("http://%s:%d/api/rest/ueManagement/v1/elementType/pcf/objectType/ueInfo/file/export", neInfo.IP, neInfo.Port) + neUrl := fmt.Sprintf("http://%s:%d/api/rest/ueManagement/v1/elementType/pcf/objectType/ueInfo/file/export", neInfo.IPAddr, neInfo.Port) // 查询参数拼接 query := []string{} if v, ok := data["fileType"]; ok && v != "" { @@ -243,7 +243,7 @@ func PCFRuleExport(neInfo model.NeInfo, data map[string]string) ([]byte, error) // PCFRuleImport PCF策略配置导入 func PCFRuleImport(neInfo model.NeInfo, data map[string]any) (string, error) { - neUrl := fmt.Sprintf("http://%s:%d/api/rest/ueManagement/v1/elementType/pcf/objectType/ueInfo/file/import", neInfo.IP, neInfo.Port) + neUrl := fmt.Sprintf("http://%s:%d/api/rest/ueManagement/v1/elementType/pcf/objectType/ueInfo/file/import", neInfo.IPAddr, neInfo.Port) resBytes, err := fetch.PutJSON(neUrl, data, nil) var resData map[string]any if err != nil { diff --git a/src/modules/ne/fetch_link/smf.go b/src/modules/ne/fetch_link/smf.go index 073b6adb..e96e87ab 100644 --- a/src/modules/ne/fetch_link/smf.go +++ b/src/modules/ne/fetch_link/smf.go @@ -15,7 +15,7 @@ import ( // // 返回结果 0 func SMFSubNum(neInfo model.NeInfo) (int64, error) { - neUrl := fmt.Sprintf("http://%s:%d/api/rest/ueManagement/v1/elementType/smf/objectType/ueNum", neInfo.IP, neInfo.Port) + neUrl := fmt.Sprintf("http://%s:%d/api/rest/ueManagement/v1/elementType/smf/objectType/ueNum", neInfo.IPAddr, neInfo.Port) resBytes, err := fetch.Get(neUrl, nil, 60_000) if err != nil { errStr := err.Error() @@ -47,7 +47,7 @@ func SMFSubNum(neInfo model.NeInfo) (int64, error) { // // 返回结果 {"rows":[],"total":0} func SMFSubInfoList(neInfo model.NeInfo, data map[string]string) (map[string]any, error) { - neUrl := fmt.Sprintf("http://%s:%d/api/rest/ueManagement/v1/elementType/smf/objectType/ueInfo", neInfo.IP, neInfo.Port) + neUrl := fmt.Sprintf("http://%s:%d/api/rest/ueManagement/v1/elementType/smf/objectType/ueInfo", neInfo.IPAddr, neInfo.Port) // 查询参数拼接 query := []string{} if v, ok := data["imsi"]; ok && v != "" { diff --git a/src/modules/ne/model/ne_config_backup.go b/src/modules/ne/model/ne_config_backup.go index 978e06c3..e2d7864d 100644 --- a/src/modules/ne/model/ne_config_backup.go +++ b/src/modules/ne/model/ne_config_backup.go @@ -3,15 +3,16 @@ package model // NeConfigBackup 网元配置文件备份记录 ne_config_backup type NeConfigBackup struct { ID int64 `json:"id" gorm:"column:id;primaryKey;autoIncrement"` - NeType string `json:"neType" gorm:"column:ne_type"` // 网元类型 - NeId string `json:"neId" gorm:"column:ne_id"` // 网元ID - Name string `json:"name" gorm:"column:name"` // 压缩包名称 - Path string `json:"path" gorm:"column:path"` // 压缩包位置 - Remark string `json:"remark" gorm:"column:remark"` // 备注 - CreateBy string `json:"createBy" gorm:"column:create_by"` // 创建者 - CreateTime int64 `json:"createTime" gorm:"column:create_time"` // 创建时间 - UpdateBy string `json:"updateBy" gorm:"column:update_by"` // 更新者 - UpdateTime int64 `json:"updateTime" gorm:"column:update_time"` // 更新时间 + CoreUID string `json:"coreUid" gorm:"column:core_uid" binding:"required"` // 核心网唯一标识 + NeUID string `json:"neUid" gorm:"column:ne_uid" binding:"required"` // 网元唯一标识 + NeType string `json:"neType" gorm:"column:ne_type" binding:"required"` // 网元类型 + Name string `json:"name" gorm:"column:name"` // 压缩包名称 + Path string `json:"path" gorm:"column:path"` // 压缩包位置 + Remark string `json:"remark" gorm:"column:remark"` // 备注 + CreateBy string `json:"createBy" gorm:"column:create_by"` // 创建者 + CreateTime int64 `json:"createTime" gorm:"column:create_time"` // 创建时间 + UpdateBy string `json:"updateBy" gorm:"column:update_by"` // 更新者 + UpdateTime int64 `json:"updateTime" gorm:"column:update_time"` // 更新时间 // ====== 非数据库字段属性 ====== diff --git a/src/modules/ne/model/ne_info.go b/src/modules/ne/model/ne_info.go index d17862df..d36b2a50 100644 --- a/src/modules/ne/model/ne_info.go +++ b/src/modules/ne/model/ne_info.go @@ -2,18 +2,18 @@ package model // NeInfo 网元信息对象 ne_info type NeInfo struct { - ID int64 `json:"id" gorm:"column:id;primaryKey;autoIncrement"` + ID int64 `json:"id" gorm:"column:id;primaryKey;autoIncrement"` // 网元ID + CoreUID string `json:"coreUid" gorm:"column:core_uid" binding:"required"` // 核心网唯一标识 + NeUID string `json:"neUid" gorm:"column:ne_uid"` // 网元唯一标识 NeType string `json:"neType" gorm:"column:ne_type" binding:"required"` // 网元类型 - NeId string `json:"neId" gorm:"column:ne_id" binding:"required"` // 网元ID - RmUID string `json:"rmUid" gorm:"column:rm_uid"` // 网元资源唯一标识 NeName string `json:"neName" gorm:"column:ne_name"` // 网元名称 - IP string `json:"ip" gorm:"column:ip" binding:"required"` // 网元服务IP + IPAddr string `json:"ipAddr" gorm:"column:ip_addr" binding:"required"` // 网元服务IP Port int64 `json:"port" gorm:"column:port" binding:"required,number,max=65535,min=1"` // 端口 PvFlag string `json:"pvFlag" gorm:"column:pv_flag" binding:"omitempty,oneof=PNF VNF"` // 网元虚拟化标识 物理PNF 虚拟VNF Province string `json:"province" gorm:"column:province"` // 省份地域 VendorName string `json:"vendorName" gorm:"column:vendor_name"` // 厂商名称 Dn string `json:"dn" gorm:"column:dn"` // 网络标识 - NeAddress string `json:"neAddress" gorm:"column:ne_address"` // MAC地址 + MacAddr string `json:"macAddr" gorm:"column:mac_addr"` // MAC地址 HostIDs string `json:"hostIds" gorm:"column:host_ids"` // 网元主机ID组 数据格式(ssh,telnet) UDM(ssh,telnet,redis) UPF(ssh,telnet,telnet) Status int64 `json:"status" gorm:"column:status"` // 网元状态 0离线 1在线 2配置待下发 3备用模式 Remark string `json:"remark" gorm:"column:remark"` // 备注 diff --git a/src/modules/ne/model/ne_license.go b/src/modules/ne/model/ne_license.go index 9731d8f0..2396ff89 100644 --- a/src/modules/ne/model/ne_license.go +++ b/src/modules/ne/model/ne_license.go @@ -3,13 +3,15 @@ package model // NeLicense 网元授权激活信息 ne_license type NeLicense struct { ID int64 `json:"id" gorm:"column:id;primaryKey;autoIncrement"` + CoreUID string `json:"coreUid" gorm:"column:core_uid" binding:"required"` // 核心网唯一标识 + NeUID string `json:"neUid" gorm:"column:ne_uid" binding:"required"` // 网元唯一标识 NeType string `json:"neType" gorm:"column:ne_type" binding:"required"` // 网元类型 - NeId string `json:"neId" gorm:"column:ne_id" binding:"required"` // 网元ID ActivationRequestCode string `json:"activationRequestCode" gorm:"column:activation_request_code"` // 激活申请代码 LicensePath string `json:"licensePath" gorm:"column:license_path"` // 激活授权文件 - Capability int64 `json:"capability" gorm:"column:capability"` // 容量 SerialNum string `json:"serialNum" gorm:"column:serial_num"` // 序列号 ExpiryDate string `json:"expiryDate" gorm:"column:expiry_date"` // 许可证到期日期 + UeNumber int64 `json:"ueNumber" gorm:"ue_number"` // 用户容量 + NbNumber int64 `json:"nbNumber" gorm:"nb_number"` // 基站容量 Status string `json:"status" gorm:"column:status"` // 状态 0无效 1有效 Remark string `json:"remark" gorm:"column:remark"` // 备注 CreateBy string `json:"createBy" gorm:"column:create_by"` // 创建者 diff --git a/src/modules/ne/model/ne_version.go b/src/modules/ne/model/ne_version.go index 9bd651ad..3d64902a 100644 --- a/src/modules/ne/model/ne_version.go +++ b/src/modules/ne/model/ne_version.go @@ -3,22 +3,23 @@ package model // NeVersion 网元版本信息 ne_version type NeVersion struct { ID int64 `json:"id" gorm:"column:id;primaryKey;autoIncrement"` - NeType string `json:"neType" gorm:"column:ne_type" binding:"required"` // 网元类型 - NeId string `json:"neId" gorm:"column:ne_id" binding:"required"` // 网元ID - Name string `json:"name" gorm:"column:name"` // 当前包名 - Version string `json:"version" gorm:"column:version" binding:"required"` // 当前版本 - Path string `json:"path" gorm:"column:path" binding:"required"` // 当前软件包 - PreName string `json:"preName" gorm:"column:pre_name"` // 上一版本包名 - PreVersion string `json:"preVersion" gorm:"column:pre_version"` // 上一版本 - PrePath string `json:"prePath" gorm:"column:pre_path"` // 上一版本软件包 - NewName string `json:"newName" gorm:"column:new_name"` // 新版本包名 - NewVersion string `json:"newVersion" gorm:"column:new_version"` // 新版本 - NewPath string `json:"newPath" gorm:"column:new_path"` // 新版本软件包 - Status string `json:"status" gorm:"column:status"` // 当前状态 1当前版本 2上一版本 3有新版本 - CreateBy string `json:"createBy" gorm:"column:create_by"` // 创建者 - CreateTime int64 `json:"createTime" gorm:"column:create_time"` // 创建时间 - UpdateBy string `json:"updateBy" gorm:"column:update_by"` // 更新者 - UpdateTime int64 `json:"updateTime" gorm:"column:update_time"` // 更新时间 + CoreUID string `json:"coreUid" gorm:"column:core_uid" binding:"required"` // 核心网唯一标识 + NeUID string `json:"neUid" gorm:"column:ne_uid" binding:"required"` // 网元唯一标识 + NeType string `json:"neType" gorm:"column:ne_type" binding:"required"` // 网元类型 + Name string `json:"name" gorm:"column:name"` // 当前包名 + Version string `json:"version" gorm:"column:version" binding:"required"` // 当前版本 + Path string `json:"path" gorm:"column:path" binding:"required"` // 当前软件包 + PreName string `json:"preName" gorm:"column:pre_name"` // 上一版本包名 + PreVersion string `json:"preVersion" gorm:"column:pre_version"` // 上一版本 + PrePath string `json:"prePath" gorm:"column:pre_path"` // 上一版本软件包 + NewName string `json:"newName" gorm:"column:new_name"` // 新版本包名 + NewVersion string `json:"newVersion" gorm:"column:new_version"` // 新版本 + NewPath string `json:"newPath" gorm:"column:new_path"` // 新版本软件包 + Status string `json:"status" gorm:"column:status"` // 当前状态 1当前版本 2上一版本 3有新版本 + CreateBy string `json:"createBy" gorm:"column:create_by"` // 创建者 + CreateTime int64 `json:"createTime" gorm:"column:create_time"` // 创建时间 + UpdateBy string `json:"updateBy" gorm:"column:update_by"` // 更新者 + UpdateTime int64 `json:"updateTime" gorm:"column:update_time"` // 更新时间 } // TableName 表名称 diff --git a/src/modules/ne/ne.go b/src/modules/ne/ne.go index 9fe37d2e..0b6dee61 100644 --- a/src/modules/ne/ne.go +++ b/src/modules/ne/ne.go @@ -12,7 +12,7 @@ import ( // 模块路由注册 func Setup(router *gin.Engine) { - logger.Infof("开始加载 ====> ne 模块路由") + logger.Infof("开始加载 ====> network_element 模块路由") // 启动时需要的初始参数 InitLoad() @@ -20,26 +20,26 @@ func Setup(router *gin.Engine) { // 网元操作处理 neActionGroup := router.Group("/ne/action") { - neActionGroup.GET("/files", + neActionGroup.GET("/file/list", middleware.AuthorizeUser(nil), - controller.NewNeAction.Files, + controller.NewNeAction.FileList, ) - neActionGroup.GET("/pullFile", + neActionGroup.GET("/file/pull/dirzip", middleware.AuthorizeUser(nil), - controller.NewNeAction.PullFile, + controller.NewNeAction.FilePullDirZip, ) - neActionGroup.POST("/pushFile", + neActionGroup.GET("/file/pull", + middleware.AuthorizeUser(nil), + controller.NewNeAction.FilePull, + ) + neActionGroup.POST("/file/push", middleware.AuthorizeUser(nil), collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.neAction", collectlogs.BUSINESS_TYPE_IMPORT)), - controller.NewNeAction.PushFile, + controller.NewNeAction.FilePush, ) - neActionGroup.GET("/pullDirZip", + neActionGroup.GET("/file/view", middleware.AuthorizeUser(nil), - controller.NewNeAction.PullDirZip, - ) - neActionGroup.GET("/viewFile", - middleware.AuthorizeUser(nil), - controller.NewNeAction.ViewFile, + controller.NewNeAction.FileView, ) neActionGroup.PUT("/service", middleware.AuthorizeUser(nil), @@ -55,28 +55,28 @@ func Setup(router *gin.Engine) { middleware.AuthorizeUser(nil), controller.NewNeInfo.State, ) - neInfoGroup.GET("/byTypeAndID", + neInfoGroup.GET("/nf", middleware.AuthorizeUser(nil), - controller.NewNeInfo.NeTypeAndID, + controller.NewNeInfo.Nf, ) - neInfoGroup.GET("/listAll", + neInfoGroup.GET("/list/all", middleware.AuthorizeUser(nil), controller.NewNeInfo.ListAll, ) - neInfoGroup.GET("/para5GFile", + neInfoGroup.GET("/file/para5g", middleware.AuthorizeUser(nil), controller.NewNeInfo.Para5GFileRead, ) - neInfoGroup.PUT("/para5GFile", + neInfoGroup.PUT("/file/para5g", middleware.AuthorizeUser(nil), collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.neInfo", collectlogs.BUSINESS_TYPE_OTHER)), controller.NewNeInfo.Para5GFileWrite, ) - neInfoGroup.GET("/oamFile", + neInfoGroup.GET("/file/oam", middleware.AuthorizeUser(nil), controller.NewNeInfo.OAMFileRead, ) - neInfoGroup.PUT("/oamFile", + neInfoGroup.PUT("/file/oam", middleware.AuthorizeUser(nil), collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.neInfo", collectlogs.BUSINESS_TYPE_OTHER)), controller.NewNeInfo.OAMFileWrite, @@ -85,7 +85,7 @@ func Setup(router *gin.Engine) { middleware.AuthorizeUser(nil), controller.NewNeInfo.List, ) - neInfoGroup.GET("/:id", + neInfoGroup.GET("", middleware.CryptoApi(false, true), middleware.AuthorizeUser(nil), controller.NewNeInfo.Info, @@ -102,7 +102,7 @@ func Setup(router *gin.Engine) { collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.neInfo", collectlogs.BUSINESS_TYPE_UPDATE)), controller.NewNeInfo.Edit, ) - neInfoGroup.DELETE(":id", + neInfoGroup.DELETE("", middleware.AuthorizeUser(nil), collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.neInfo", collectlogs.BUSINESS_TYPE_DELETE)), controller.NewNeInfo.Remove, @@ -193,10 +193,14 @@ func Setup(router *gin.Engine) { middleware.AuthorizeUser(nil), controller.NewNeVersion.List, ) - neVersionGroup.GET("/:id", + neVersionGroup.GET("", middleware.AuthorizeUser(nil), controller.NewNeVersion.Info, ) + neVersionGroup.GET("/nf", + middleware.AuthorizeUser(nil), + controller.NewNeVersion.Nf, + ) neVersionGroup.POST("/operate", middleware.AuthorizeUser(nil), collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.neVersion", collectlogs.BUSINESS_TYPE_OTHER)), @@ -244,13 +248,13 @@ func Setup(router *gin.Engine) { middleware.AuthorizeUser(nil), controller.NewNeLicense.List, ) - neLicenseGroup.GET("/:id", + neLicenseGroup.GET("", middleware.AuthorizeUser(nil), controller.NewNeLicense.Info, ) - neLicenseGroup.GET("/byTypeAndID", + neLicenseGroup.GET("/nf", middleware.AuthorizeUser(nil), - controller.NewNeLicense.NeTypeAndID, + controller.NewNeLicense.Nf, ) neLicenseGroup.GET("/code", middleware.AuthorizeUser(nil), @@ -357,8 +361,8 @@ func Setup(router *gin.Engine) { // InitLoad 初始参数 func InitLoad() { // 启动时,清除缓存-网元类型 - service.NewNeInfo.ClearNeCacheByNeType("*") - service.NewNeInfo.FindByRmuid("") + service.NewNeInfo.ClearNeCacheByCoreUid("*") + service.NewNeInfo.RefreshNeCacheByCoreUid("*") // 启动时,网元公共参数数据记录到全局变量 if para5GMap, err := service.NewNeInfo.NeConfPara5GRead(); para5GMap != nil && err == nil { service.NewNeInfo.NeConfPara5GWirte(para5GMap, nil) diff --git a/src/modules/ne/repository/ne_config_backup.go b/src/modules/ne/repository/ne_config_backup.go index aeb5d0cf..80bbfae7 100644 --- a/src/modules/ne/repository/ne_config_backup.go +++ b/src/modules/ne/repository/ne_config_backup.go @@ -22,8 +22,11 @@ func (r NeConfigBackup) SelectByPage(query map[string]string) ([]model.NeConfigB if v, ok := query["neType"]; ok && v != "" { tx = tx.Where("ne_type = ?", v) } - if v, ok := query["neId"]; ok && v != "" { - tx = tx.Where("ne_id = ?", v) + if v, ok := query["coreUid"]; ok && v != "" { + tx = tx.Where("core_uid = ?", v) + } + if v, ok := query["neUid"]; ok && v != "" { + tx = tx.Where("ne_uid = ?", v) } if v, ok := query["name"]; ok && v != "" { tx = tx.Where("name like ?", fmt.Sprintf("%%%s%%", v)) @@ -49,6 +52,32 @@ func (r NeConfigBackup) SelectByPage(query map[string]string) ([]model.NeConfigB return rows, total } +// Select 查询集合 +func (r NeConfigBackup) Select(param model.NeConfigBackup) []model.NeConfigBackup { + tx := db.DB("").Model(&model.NeConfigBackup{}) + // 查询条件拼接 + if param.CoreUID != "" { + tx = tx.Where("core_uid = ?", param.CoreUID) + } + if param.NeUID != "" { + tx = tx.Where("ne_uid = ?", param.NeUID) + } + if param.NeType != "" { + tx = tx.Where("ne_type = ?", param.NeType) + } + if param.CreateBy != "" { + tx = tx.Where("create_by like ?", fmt.Sprintf("%s%%", param.CreateBy)) + } + + // 查询数据 + rows := []model.NeConfigBackup{} + if err := tx.Find(&rows).Error; err != nil { + logger.Errorf("query find err => %v", err.Error()) + return rows + } + return rows +} + // SelectByIds 通过ID查询信息 func (r NeConfigBackup) SelectByIds(ids []int64) []model.NeConfigBackup { rows := []model.NeConfigBackup{} diff --git a/src/modules/ne/repository/ne_info.go b/src/modules/ne/repository/ne_info.go index 53c7aedb..37096906 100644 --- a/src/modules/ne/repository/ne_info.go +++ b/src/modules/ne/repository/ne_info.go @@ -41,6 +41,7 @@ func (r NeInfo) neListSort(arr []model.NeInfo) []model.NeInfo { "CHF", "HLR", "SGWC", + "PGWC", "IP-SM-GW", "MMTel-AS", "I-CSCF", @@ -73,11 +74,11 @@ func (r NeInfo) SelectByPage(query map[string]string) ([]model.NeInfo, int64) { if v, ok := query["neType"]; ok && v != "" { tx = tx.Where("ne_type = ?", v) } - if v, ok := query["neId"]; ok && v != "" { - tx = tx.Where("ne_id = ?", v) + if v, ok := query["coreUid"]; ok && v != "" { + tx = tx.Where("core_uid = ?", v) } - if v, ok := query["rmUid"]; ok && v != "" { - tx = tx.Where("rmUid like ?", fmt.Sprintf("%s%%", v)) + if v, ok := query["neUid"]; ok && v != "" { + tx = tx.Where("ne_uid like ?", fmt.Sprintf("%s%%", v)) } // 查询结果 @@ -92,7 +93,7 @@ func (r NeInfo) SelectByPage(query map[string]string) ([]model.NeInfo, int64) { // 查询数据分页 pageNum, pageSize := db.PageNumSize(query["pageNum"], query["pageSize"]) tx = tx.Limit(pageSize).Offset(pageSize * pageNum) - err := tx.Order("ne_type asc, ne_id asc").Find(&rows).Error + err := tx.Order("ne_type asc").Find(&rows).Error if err != nil { logger.Errorf("query find err => %v", err.Error()) return rows, total @@ -173,24 +174,32 @@ func (r NeInfo) SelectList(neInfo model.NeInfo) []model.NeInfo { if neInfo.NeType != "" { tx = tx.Where("ne_type = ?", neInfo.NeType) } - if neInfo.NeId != "" { - tx = tx.Where("ne_id = ?", neInfo.NeId) + if neInfo.CoreUID != "" { + tx = tx.Where("core_uid = ?", neInfo.CoreUID) + } + if neInfo.NeUID != "" { + tx = tx.Where("ne_uid = ?", neInfo.NeUID) } // 查询数据 rows := []model.NeInfo{} - if err := tx.Order("ne_type asc, ne_id asc").Find(&rows).Error; err != nil { + if err := tx.Order("ne_type asc").Find(&rows).Error; err != nil { logger.Errorf("query find err => %v", err.Error()) return rows } return r.neListSort(rows) } -// SelectNeInfoByNeTypeAndNeID 通过ne_type和ne_id查询网元信息 -func (r NeInfo) SelectNeInfoByNeTypeAndNeID(neType, neID string) model.NeInfo { +// SelectNeInfoByCoreUidAndNeUid 通过core_uid和ne_uid查询网元信息 +// coreUid 为*或空字符时,根据neUid查询 +func (r NeInfo) SelectNeInfoByCoreUidAndNeUid(coreUid, neUid string) model.NeInfo { tx := db.DB("").Model(&model.NeInfo{}) // 构建查询条件 - tx = tx.Where("ne_type = ? and ne_id = ?", neType, neID) + if coreUid == "*" || coreUid == "" { + tx = tx.Where("ne_uid = ?", neUid) + } else { + tx = tx.Where("core_uid = ? and ne_uid = ?", coreUid, neUid) + } // 查询数据 row := model.NeInfo{} if err := tx.Limit(1).Find(&row).Error; err != nil { @@ -200,25 +209,6 @@ func (r NeInfo) SelectNeInfoByNeTypeAndNeID(neType, neID string) model.NeInfo { return row } -// CheckUniqueNeTypeAndNeId 校验同类型下标识是否唯一 -func (r NeInfo) CheckUniqueNeTypeAndNeId(neInfo model.NeInfo) int64 { - tx := db.DB("").Model(&model.NeInfo{}) - // 查询条件拼接 - if neInfo.NeType != "" { - tx = tx.Where("ne_type = ?", neInfo.NeType) - } - if neInfo.NeId != "" { - tx = tx.Where("ne_id = ?", neInfo.NeType) - } - // 查询数据 - var id int64 = 0 - if err := tx.Limit(1).Select("id").Find(&id).Error; err != nil { - logger.Errorf("query find err => %v", err.Error()) - return id - } - return id -} - // UpdateState 修改状态 func (r NeInfo) UpdateState(id int64, status int64) int64 { if id <= 0 { diff --git a/src/modules/ne/repository/ne_license.go b/src/modules/ne/repository/ne_license.go index 9b1fa3b6..768a4b8c 100644 --- a/src/modules/ne/repository/ne_license.go +++ b/src/modules/ne/repository/ne_license.go @@ -22,14 +22,17 @@ func (r NeLicense) SelectByPage(query map[string]string) ([]model.NeLicense, int if v, ok := query["neType"]; ok && v != "" { tx = tx.Where("ne_type = ?", v) } - if v, ok := query["neId"]; ok && v != "" { - tx = tx.Where("ne_id = ?", v) + if v, ok := query["neUid"]; ok && v != "" { + tx = tx.Where("ne_uid = ?", v) + } + if v, ok := query["coreUid"]; ok && v != "" { + tx = tx.Where("core_uid = ?", v) } if v, ok := query["expiryDate"]; ok && v != "" { - tx = tx.Where("expiry_date = ?", v) + tx = tx.Where("expiry_date like ?", fmt.Sprintf("%s%%", v)) } if v, ok := query["serialNum"]; ok && v != "" { - tx = tx.Where("serial_num = ?", v) + tx = tx.Where("serial_num like ?", fmt.Sprintf("%s%%", v)) } if v, ok := query["createBy"]; ok && v != "" { tx = tx.Where("create_by like ?", fmt.Sprintf("%s%%", v)) @@ -60,15 +63,21 @@ func (r NeLicense) SelectByPage(query map[string]string) ([]model.NeLicense, int func (r NeLicense) Select(param model.NeLicense) []model.NeLicense { tx := db.DB("").Model(&model.NeLicense{}) // 查询条件拼接 + if param.CoreUID != "" { + tx = tx.Where("core_uid = ?", param.CoreUID) + } + if param.NeUID != "" { + tx = tx.Where("ne_uid = ?", param.NeUID) + } if param.NeType != "" { tx = tx.Where("ne_type = ?", param.NeType) } - if param.NeId != "" { - tx = tx.Where("ne_id = ?", param.NeId) - } if param.ExpiryDate != "" { tx = tx.Where("expiry_date = ?", param.ExpiryDate) } + if param.SerialNum != "" { + tx = tx.Where("serial_num = ?", param.SerialNum) + } if param.CreateBy != "" { tx = tx.Where("create_by like ?", fmt.Sprintf("%s%%", param.CreateBy)) } diff --git a/src/modules/ne/repository/ne_version.go b/src/modules/ne/repository/ne_version.go index 2f068c0b..f9dd4903 100644 --- a/src/modules/ne/repository/ne_version.go +++ b/src/modules/ne/repository/ne_version.go @@ -22,8 +22,11 @@ func (r NeVersion) SelectByPage(query map[string]string) ([]model.NeVersion, int if v, ok := query["neType"]; ok && v != "" { tx = tx.Where("ne_type = ?", v) } - if v, ok := query["neId"]; ok && v != "" { - tx = tx.Where("ne_id = ?", v) + if v, ok := query["coreUid"]; ok && v != "" { + tx = tx.Where("core_uid = ?", v) + } + if v, ok := query["neUid"]; ok && v != "" { + tx = tx.Where("ne_uid = ?", v) } if v, ok := query["version"]; ok && v != "" { tx = tx.Where("version like ?", fmt.Sprintf("%s%%", v)) @@ -57,11 +60,11 @@ func (r NeVersion) SelectByPage(query map[string]string) ([]model.NeVersion, int func (r NeVersion) Select(param model.NeVersion) []model.NeVersion { tx := db.DB("").Model(&model.NeVersion{}) // 查询条件拼接 - if param.NeType != "" { - tx = tx.Where("ne_type = ?", param.NeType) + if param.CoreUID != "" { + tx = tx.Where("core_uid = ?", param.CoreUID) } - if param.NeId != "" { - tx = tx.Where("ne_id = ?", param.NeId) + if param.NeUID != "" { + tx = tx.Where("ne_uid = ?", param.NeUID) } if param.Version != "" { tx = tx.Where("version like ?", fmt.Sprintf("%s%%", param.Version)) diff --git a/src/modules/ne/service/ne_config_backup.go b/src/modules/ne/service/ne_config_backup.go index ce81ea12..0299aee7 100644 --- a/src/modules/ne/service/ne_config_backup.go +++ b/src/modules/ne/service/ne_config_backup.go @@ -28,6 +28,11 @@ func (s NeConfigBackup) FindByPage(query map[string]string) ([]model.NeConfigBac return s.neConfigBackupRepository.SelectByPage(query) } +// Find 查询 +func (s NeConfigBackup) Find(param model.NeConfigBackup) []model.NeConfigBackup { + return s.neConfigBackupRepository.Select(param) +} + // FindById 通过ID查询 func (s NeConfigBackup) FindById(id int64) model.NeConfigBackup { if id <= 0 { @@ -51,19 +56,20 @@ func (s NeConfigBackup) Update(item model.NeConfigBackup) int64 { } // DeleteByIds 批量删除信息 -func (s NeConfigBackup) DeleteByIds(ids []int64) (int64, error) { +func (s NeConfigBackup) DeleteByIds(id int64, coreUid string, neUid string) (int64, error) { // 检查是否存在 - data := s.neConfigBackupRepository.SelectByIds(ids) - if len(data) <= 0 { + data := s.neConfigBackupRepository.SelectByIds([]int64{id}) + if len(data) != 1 { return 0, fmt.Errorf("neConfigBackup.noData") } - if len(data) == len(ids) { - rows := s.neConfigBackupRepository.DeleteByIds(ids) - return rows, nil + for _, v := range data { + if v.CoreUID != coreUid || v.NeUID != neUid { + return 0, fmt.Errorf("data not match, id: %d", v.ID) + } } - // 删除信息失败! - return 0, fmt.Errorf("delete fail") + rows := s.neConfigBackupRepository.DeleteByIds([]int64{id}) + return rows, nil } // FileLocalToNe 网元配置文件复制到网元端覆盖 @@ -74,13 +80,13 @@ func (s NeConfigBackup) FileLocalToNe(neInfo model.NeInfo, localFile string) err if runtime.GOOS == "windows" { omcPath = fmt.Sprintf("C:%s", omcPath) } - localDirPath := fmt.Sprintf("%s/%s/%s/backup/tmp_import", omcPath, neTypeLower, neInfo.NeId) + localDirPath := fmt.Sprintf("%s/%s/%s/backup/tmp_import", omcPath, neTypeLower, neInfo.NeUID) if err := file.UnZip(localFile, localDirPath); err != nil { return fmt.Errorf("unzip err") } // 网元主机的SSH客户端 - sshClient, err := NewNeInfo.NeRunSSHClient(neInfo.NeType, neInfo.NeId) + sshClient, err := NewNeInfo.NeRunSSHClient(neInfo.CoreUID, neInfo.NeUID) if err != nil { return fmt.Errorf("ne info ssh client err") } @@ -93,7 +99,7 @@ func (s NeConfigBackup) FileLocalToNe(neInfo model.NeInfo, localFile string) err defer sftpClient.Close() // 网元配置端上的临时目录 - neDirTemp := fmt.Sprintf("/tmp/omc/ne_config/%s/%s", neTypeLower, neInfo.NeId) + neDirTemp := fmt.Sprintf("/tmp/omc/ne_config/%s/%s", neTypeLower, neInfo.NeUID) sshClient.RunCMD(fmt.Sprintf("sudo mkdir -p /tmp/omc/ne_config && sudo chmod 777 -R /tmp/omc && sudo rm -rf %s", neDirTemp)) // 复制到网元端 if err = sftpClient.CopyDirLocalToRemote(localDirPath, neDirTemp); err != nil { @@ -134,7 +140,7 @@ func (s NeConfigBackup) FileLocalToNe(neInfo model.NeInfo, localFile string) err // FileNeToLocal 网元备份文件网元端复制到本地 func (s NeConfigBackup) FileNeToLocal(neInfo model.NeInfo) (string, error) { // 网元主机的SSH客户端 - sshClient, err := NewNeInfo.NeRunSSHClient(neInfo.NeType, neInfo.NeId) + sshClient, err := NewNeInfo.NeRunSSHClient(neInfo.CoreUID, neInfo.NeUID) if err != nil { return "", fmt.Errorf("ne info ssh client err") } @@ -152,11 +158,11 @@ func (s NeConfigBackup) FileNeToLocal(neInfo model.NeInfo) (string, error) { if runtime.GOOS == "windows" { omcPath = fmt.Sprintf("C:%s", omcPath) } - localDirPath := fmt.Sprintf("%s/%s/%s/from_ne_tmp", omcPath, neTypeLower, neInfo.NeId) + localDirPath := fmt.Sprintf("%s/%s/%s/from_ne_tmp", omcPath, neTypeLower, neInfo.NeUID) // 网元配置文件先复制到临时目录 sshClient.RunCMD("sudo mkdir -p /tmp/omc/ne_config && sudo chmod 777 -R /tmp/omc") - neDirTemp := fmt.Sprintf("/tmp/omc/ne_config/%s/%s", neTypeLower, neInfo.NeId) + neDirTemp := fmt.Sprintf("/tmp/omc/ne_config/%s/%s", neTypeLower, neInfo.NeUID) switch neTypeLower { case "ims": // ims目录 @@ -188,8 +194,8 @@ func (s NeConfigBackup) FileNeToLocal(neInfo model.NeInfo) (string, error) { } // 压缩zip文件名 - zipFileName := fmt.Sprintf("%s-%s-etc-%s.zip", neTypeLower, neInfo.NeId, date.ParseDateToStr(time.Now(), date.YYYYMMDDHHMMSS)) - zipFilePath := fmt.Sprintf("%s/%s/%s/%s", omcPath, neTypeLower, neInfo.NeId, zipFileName) + zipFileName := fmt.Sprintf("%s-%s-etc-%s.zip", neTypeLower, neInfo.NeUID, date.ParseDateToStr(time.Now(), date.YYYYMMDDHHMMSS)) + zipFilePath := fmt.Sprintf("%s/%s/%s/%s", omcPath, neTypeLower, neInfo.NeUID, zipFileName) if err := file.CompressZipByDir(zipFilePath, localDirPath); err != nil { return "", fmt.Errorf("compress zip err") } diff --git a/src/modules/ne/service/ne_info.go b/src/modules/ne/service/ne_info.go index 556cbea7..b941fbe8 100644 --- a/src/modules/ne/service/ne_info.go +++ b/src/modules/ne/service/ne_info.go @@ -35,10 +35,11 @@ type NeInfo struct { Para5GData map[string]string } -// FindByNeTypeAndNeID 通过ne_type和ne_id查询网元信息 -func (r NeInfo) FindByNeTypeAndNeID(neType, neID string) model.NeInfo { +// FindByCoreUidAndNeUid 通过core_uid和ne_uid查询网元信息 +// coreUid 为*时,根据neUid查询 +func (r NeInfo) FindByCoreUidAndNeUid(coreUid string, neUid string) model.NeInfo { var neInfo model.NeInfo - key := fmt.Sprintf("%s:%s:%s", constants.CACHE_NE_INFO, strings.ToUpper(neType), neID) + key := fmt.Sprintf("%s:%s:*:%s", constants.CACHE_NE_INFO, coreUid, neUid) jsonStr, _ := redis.Get("", key) if len(jsonStr) > 7 { err := json.Unmarshal([]byte(jsonStr), &neInfo) @@ -46,8 +47,8 @@ func (r NeInfo) FindByNeTypeAndNeID(neType, neID string) model.NeInfo { neInfo = model.NeInfo{} } } else { - neInfo = r.neInfoRepository.SelectNeInfoByNeTypeAndNeID(neType, neID) - if neInfo.ID != 0 && neInfo.NeId == neID { + neInfo = r.neInfoRepository.SelectNeInfoByCoreUidAndNeUid(coreUid, neUid) + if neInfo.CoreUID == coreUid && neInfo.NeUID == neUid { redis.Del("", key) values, _ := json.Marshal(neInfo) redis.Set("", key, string(values), 0) @@ -56,36 +57,27 @@ func (r NeInfo) FindByNeTypeAndNeID(neType, neID string) model.NeInfo { return neInfo } -// RefreshByNeTypeAndNeID 通过ne_type和ne_id刷新redis中的缓存 -func (r NeInfo) RefreshByNeTypeAndNeID(neType, neID string) model.NeInfo { +// RefreshByCoreUidAndNeUid 通过core_id和ne_uid刷新缓存 +func (r NeInfo) RefreshByCoreUidAndNeUid(coreuid string, neUid string) model.NeInfo { var neInfo model.NeInfo - key := fmt.Sprintf("%s:%s:%s", constants.CACHE_NE_INFO, strings.ToUpper(neType), neID) + if coreuid == "*" || coreuid == "" { + return neInfo + } + key := fmt.Sprintf("%s:%s:*:%s", constants.CACHE_NE_INFO, coreuid, neUid) redis.Del("", key) - neInfo = r.neInfoRepository.SelectNeInfoByNeTypeAndNeID(neType, neID) - if neInfo.ID != 0 && neInfo.NeId == neID { + neInfo = r.neInfoRepository.SelectNeInfoByCoreUidAndNeUid(coreuid, neUid) + if neInfo.CoreUID == coreuid && neInfo.NeUID == neUid { values, _ := json.Marshal(neInfo) redis.Set("", key, string(values), 0) } return neInfo } -// ClearNeCacheByNeType 清除网元类型缓存 -func (r NeInfo) ClearNeCacheByNeType(neType string) bool { - key := fmt.Sprintf("%s:*", constants.CACHE_NE_INFO) - if neType != "*" { - key = fmt.Sprintf("%s:%s*", constants.CACHE_NE_INFO, neType) - } - keys, err := redis.GetKeys("", key) - if err != nil { - return false - } - return redis.DelKeys("", keys) == nil -} - -// FindByNeType 通过ne_type查询网元信息 -func (r NeInfo) FindByNeType(neType string) []model.NeInfo { +// FindByCoreUidAndNeType 通过core_uid和ne_type查询网元信息 +// coreUid 为*时,根据neType查询 +func (r NeInfo) FindByCoreUidAndNeType(coreUid string, neType string) []model.NeInfo { neInfo := make([]model.NeInfo, 0) - key := fmt.Sprintf("%s:%s:*", constants.CACHE_NE_INFO, strings.ToUpper(neType)) + key := fmt.Sprintf("%s:%s:%s:*", constants.CACHE_NE_INFO, coreUid, neType) cacheKeys, _ := redis.GetKeys("", key) if len(cacheKeys) > 0 { for _, key := range cacheKeys { @@ -98,9 +90,9 @@ func (r NeInfo) FindByNeType(neType string) []model.NeInfo { } return neInfo } else { - neInfo = r.neInfoRepository.SelectList(model.NeInfo{NeType: neType}) + neInfo = r.neInfoRepository.SelectList(model.NeInfo{CoreUID: coreUid, NeType: neType}) for _, v := range neInfo { - key := fmt.Sprintf("%s:%s:%s", constants.CACHE_NE_INFO, strings.ToUpper(v.NeType), v.NeId) + key := fmt.Sprintf("%s:%s:%s:%s", constants.CACHE_NE_INFO, v.CoreUID, v.NeType, v.NeUID) redis.Del("", key) values, _ := json.Marshal(v) redis.Set("", key, string(values), 0) @@ -109,35 +101,33 @@ func (r NeInfo) FindByNeType(neType string) []model.NeInfo { return neInfo } -// FindByRmuid 通过rmUID查询网元信息 -func (r NeInfo) FindByRmuid(rmUid string) model.NeInfo { - var neInfo model.NeInfo - cacheKeys, _ := redis.GetKeys("", constants.CACHE_NE_INFO+":*") - if len(cacheKeys) > 0 { - for _, key := range cacheKeys { - var v model.NeInfo - jsonStr, _ := redis.Get("", key) - if len(jsonStr) > 7 { - json.Unmarshal([]byte(jsonStr), &v) - } - if v.RmUID == rmUid { - neInfo = v - break - } - } - } else { - neInfos := r.Find(neInfo, false, false) - for _, v := range neInfos { - key := fmt.Sprintf("%s:%s:%s", constants.CACHE_NE_INFO, strings.ToUpper(v.NeType), v.NeId) - redis.Del("", key) - values, _ := json.Marshal(v) - redis.Set("", key, string(values), 0) - if v.RmUID == rmUid { - neInfo = v - } - } +// ClearNeCacheByCoreUidOrNeUid 清除核心网下网元信息缓存 +// coreUid 核心网唯一标识 *表示清除所有 +func (r NeInfo) ClearNeCacheByCoreUid(coreUid string) bool { + key := fmt.Sprintf("%s:*", constants.CACHE_NE_INFO) + if coreUid != "*" { + key = fmt.Sprintf("%s:%s:*", constants.CACHE_NE_INFO, coreUid) + } + keys, err := redis.GetKeys("", key) + if err != nil { + return false + } + return redis.DelKeys("", keys) == nil +} + +// RefreshNeCacheByCoreUid 刷新核心网下网元信息缓存 +// coreUid 核心网唯一标识 *表示所有 +func (r NeInfo) RefreshNeCacheByCoreUid(coreUid string) { + if coreUid == "*" { + coreUid = "" + } + neInfos := r.Find(model.NeInfo{CoreUID: coreUid}, false, false) + for _, v := range neInfos { + key := fmt.Sprintf("%s:%s:%s:%s", constants.CACHE_NE_INFO, v.CoreUID, v.NeType, v.NeUID) + redis.Del("", key) + values, _ := json.Marshal(v) + redis.Set("", key, string(values), 0) } - return neInfo } // FindByPage 根据条件分页查询 @@ -252,6 +242,27 @@ func (r NeInfo) FindById(id int64, bandHost bool) model.NeInfo { // Insert 新增信息 func (r NeInfo) Insert(neInfo model.NeInfo) int64 { + if neInfo.CoreUID == "" { + return 0 + } + neInfo.NeUID = strings.ToUpper(generate.Code(8)) + + // 获取网元状态是否正常 + serverState, err := neFetchlink.NeState(neInfo) + if err != nil { + neInfo.Status = 0 + } else { + // 网元状态设置为在线 + neInfo.Status = 1 + if parse.Boolean(serverState["standby"]) { + neInfo.Status = 3 + } + // 下发网管配置信息给网元 + if _, err = neFetchlink.NeConfigOMC(neInfo); err != nil { + neInfo.Status = 2 + } + } + // 主机信息新增 if neInfo.Hosts != nil { uuid := generate.Code(4) @@ -270,20 +281,75 @@ func (r NeInfo) Insert(neInfo model.NeInfo) int64 { insertId := r.neInfoRepository.Insert(neInfo) if insertId > 0 { - // 刷新缓存 - r.RefreshByNeTypeAndNeID(neInfo.NeType, neInfo.NeId) + // 新增Version信息 + neVersion := model.NeVersion{ + CoreUID: neInfo.CoreUID, + NeUID: neInfo.NeUID, + NeType: neInfo.NeType, + CreateBy: neInfo.CreateBy, + } + if v, ok := serverState["version"]; ok && v != nil { + neVersion.Name = "-" + neVersion.Path = "-" + neVersion.Version = fmt.Sprint(v) + } + NewNeVersion.Insert(neVersion) + + // 新增License信息 + neLicense := model.NeLicense{ + CoreUID: neInfo.CoreUID, + NeUID: neInfo.NeUID, + NeType: neInfo.NeType, + CreateBy: neInfo.CreateBy, + } + if v, ok := serverState["sn"]; ok && v != nil { + neLicense.SerialNum = fmt.Sprint(v) + } + if v, ok := serverState["expire"]; ok && v != nil { + neLicense.ExpiryDate = fmt.Sprint(v) + neLicense.Status = "1" + } + if v, ok := serverState["ueNumber"]; ok && v != nil { + neLicense.UeNumber = parse.Number(v) + } + if v, ok := serverState["nbNumber"]; ok && v != nil { + neLicense.NbNumber = parse.Number(v) + } + NewNeLicense.Insert(neLicense) + + r.RefreshByCoreUidAndNeUid(neInfo.CoreUID, neInfo.NeUID) // 刷新缓存 } return insertId } // Update 修改信息 func (r NeInfo) Update(neInfo model.NeInfo) int64 { + // 获取网元状态是否正常 + serverState, err := neFetchlink.NeState(neInfo) + if err != nil { + neInfo.Status = 0 + } else { + // 网元状态设置为在线 + neInfo.Status = 1 + if parse.Boolean(serverState["standby"]) { + neInfo.Status = 3 + } + // 下发网管配置信息给网元 + if _, err = neFetchlink.NeConfigOMC(neInfo); err != nil { + neInfo.Status = 2 + } + } + // 主机信息更新 - if neInfo.Hosts != nil { + if neInfo.HostIDs != "" && len(neInfo.Hosts) > 0 { + hostIDs := strings.Split(neInfo.HostIDs, ",") + for index, id := range hostIDs { + neInfo.Hosts[index].ID = parse.Number(id) + } uuid := generate.Code(4) for _, host := range neInfo.Hosts { if host.ID != 0 { - host.Title = fmt.Sprintf("%s_%d_%s", neInfo.NeName, host.Port, uuid) + host.Title = fmt.Sprintf("%s_%d_%s", neInfo.NeType, host.Port, uuid) host.GroupID = "1" host.UpdateBy = neInfo.UpdateBy r.neHostService.Update(host) @@ -293,73 +359,99 @@ func (r NeInfo) Update(neInfo model.NeInfo) int64 { num := r.neInfoRepository.Update(neInfo) if num > 0 { - // 刷新缓存 - r.RefreshByNeTypeAndNeID(neInfo.NeType, neInfo.NeId) + // 版本信息更新 + neVersion := NewNeVersion.FindByCoreUidAndNeUid(neInfo.CoreUID, neInfo.NeUID) + if neVersion.ID != 0 { + if neVersion.NeType != neInfo.NeType { + neVersion.NeType = neInfo.NeType + } + if v, ok := serverState["version"]; ok && v != neVersion.Version { + neVersion.Name = "-" + neVersion.Path = "-" + neVersion.Version = fmt.Sprint(v) + } + neVersion.UpdateBy = neInfo.UpdateBy + NewNeVersion.Update(neVersion) + } + + // License信息更新 + neLicense := NewNeLicense.FindByCoreUidAndNeUid(neInfo.CoreUID, neInfo.NeUID) + if neLicense.ID != 0 { + if neLicense.NeType != neInfo.NeType { + neLicense.NeType = neInfo.NeType + } + if v, ok := serverState["sn"]; ok && v != nil { + neLicense.SerialNum = fmt.Sprint(v) + } + if v, ok := serverState["expire"]; ok && v != nil { + neLicense.ExpiryDate = fmt.Sprint(v) + neLicense.Status = "1" + } + if v, ok := serverState["ueNumber"]; ok && v != nil { + neLicense.UeNumber = parse.Number(v) + } + if v, ok := serverState["nbNumber"]; ok && v != nil { + neLicense.NbNumber = parse.Number(v) + } + neLicense.UpdateBy = neInfo.UpdateBy + NewNeLicense.Update(neLicense) + } + + r.RefreshByCoreUidAndNeUid(neInfo.CoreUID, neInfo.NeUID) // 刷新缓存 } return num } // DeleteByIds 批量删除信息 -func (r NeInfo) DeleteByIds(ids []int64) (int64, error) { +func (r NeInfo) DeleteById(id int64, coreUid, neUid string) (int64, error) { // 检查是否存在 - infos := r.neInfoRepository.SelectByIds(ids) - if len(infos) <= 0 { - return 0, fmt.Errorf("neHostCmd.noData") + arr := r.neInfoRepository.SelectByIds([]int64{id}) + if len(arr) != 1 { + return 0, fmt.Errorf("not match id") } - if len(infos) == len(ids) { - for _, v := range infos { - // 主机信息删除 - if v.HostIDs != "" { - hostIds := make([]int64, 0) - arr := strings.Split(v.HostIDs, ",") - for _, hostId := range arr { - hostIds = append(hostIds, parse.Number(hostId)) - } - r.neHostService.DeleteByIds(hostIds, false) - } - // 删除License - neLicense := NewNeLicense.FindByNeTypeAndNeID(v.NeType, v.NeId) - if neLicense.NeId == v.NeId { - NewNeLicense.DeleteByIds([]int64{neLicense.ID}) - } - // 删除Version - neVersion := NewNeVersion.FindByNeTypeAndNeID(v.NeType, v.NeId) - if neVersion.NeId == v.NeId { - NewNeVersion.DeleteByIds([]int64{neVersion.ID}) - } - // 缓存信息删除 - redis.Del("", fmt.Sprintf("%s:%s:%s", constants.CACHE_NE_INFO, v.NeType, v.NeId)) + for _, v := range arr { + if v.CoreUID != coreUid || v.NeUID != neUid { + return 0, fmt.Errorf("data not match, id: %d", v.ID) } - rows := r.neInfoRepository.DeleteByIds(ids) - return rows, nil } - // 删除信息失败! - return 0, fmt.Errorf("delete fail") -} - -// CheckUniqueNeTypeAndNeId 校验同类型下标识是否唯一 -func (r NeInfo) CheckUniqueNeTypeAndNeId(neType, neId string, id int64) bool { - uniqueId := r.neInfoRepository.CheckUniqueNeTypeAndNeId(model.NeInfo{ - NeType: neType, - NeId: neId, - }) - if uniqueId == id { - return true + for _, v := range arr { + // 主机信息删除 + if v.HostIDs != "" { + hostIds := make([]int64, 0) + arr := strings.Split(v.HostIDs, ",") + for _, hostId := range arr { + hostIds = append(hostIds, parse.Number(hostId)) + } + r.neHostService.DeleteByIds(hostIds, false) + } + // 删除License + neLicense := NewNeLicense.FindByCoreUidAndNeUid(v.CoreUID, v.NeUID) + if neLicense.CoreUID == v.CoreUID && neLicense.NeUID == v.NeUID { + NewNeLicense.DeleteByIds([]int64{neLicense.ID}) + } + // 删除Version + neVersion := NewNeVersion.FindByCoreUidAndNeUid(v.CoreUID, v.NeUID) + if neVersion.CoreUID == v.CoreUID && neVersion.NeUID == v.NeUID { + NewNeVersion.DeleteByIds([]int64{neVersion.ID}) + } + // 缓存信息删除 + redis.Del("", fmt.Sprintf("%s:%s:%s:%s", constants.CACHE_NE_INFO, v.CoreUID, v.NeType, v.NeUID)) } - return uniqueId == 0 + rows := r.neInfoRepository.DeleteByIds([]int64{id}) + return rows, nil } // NeRunSSHClient 网元主机的SSH客户端-为创建相关连接,注意结束后 Close() -func (r NeInfo) NeRunSSHClient(neType, neId string) (*ssh.ConnSSH, error) { - neInfo := r.FindByNeTypeAndNeID(neType, neId) - if neInfo.NeId != neId { - logger.Errorf("NeRunSSHClient NeType:%s NeID:%s not found", neType, neId) +func (r NeInfo) NeRunSSHClient(coreUid, neUid string) (*ssh.ConnSSH, error) { + neInfo := r.FindByCoreUidAndNeUid(coreUid, neUid) + if neInfo.CoreUID != coreUid || neInfo.NeUID != neUid { + logger.Errorf("NeRunSSHClient CoreUID:%s or NeUID:%s not found", coreUid, neUid) return nil, fmt.Errorf("neinfo not found") } // 取主机信息 if neInfo.HostIDs == "" { - logger.Errorf("NeRunSSHClient NeType:%s NeID:%s hostId not found", neType, neId) + logger.Errorf("NeRunSSHClient CoreUID:%s or NeUID:%s hostId not found", coreUid, neUid) return nil, fmt.Errorf("neinfo hostId not found") } hostIds := strings.Split(neInfo.HostIDs, ",") @@ -395,15 +487,15 @@ func (r NeInfo) NeRunSSHClient(neType, neId string) (*ssh.ConnSSH, error) { } // NeRunSSHCmd 网元主机的SSH客户端发送cmd命令 -func (r NeInfo) NeRunSSHCmd(neType, neId, cmd string) (string, error) { - sshClient, err := r.NeRunSSHClient(neType, neId) +func (r NeInfo) NeRunSSHCmd(coreUid, neUid string, cmdStr string) (string, error) { + sshClient, err := r.NeRunSSHClient(coreUid, neUid) if err != nil { return "", err } defer sshClient.Close() // 执行命令 - output, err := sshClient.RunCMD(cmd) + output, err := sshClient.RunCMD(cmdStr) if err != nil { logger.Errorf("NeRunSSHCmd RunCMD %s err => %s", output, err.Error()) return "", fmt.Errorf("neinfo ssh run cmd err") @@ -413,15 +505,15 @@ func (r NeInfo) NeRunSSHCmd(neType, neId, cmd string) (string, error) { // NeRunTelnetClient 网元主机的Telnet客户端-为创建相关连接,注意结束后 Close() // num 是网元主机telnet 1:4100 2:5200(UPF标准版) -func (r NeInfo) NeRunTelnetClient(neType, neId string, num int) (*telnet.ConnTelnet, error) { - neInfo := r.FindByNeTypeAndNeID(neType, neId) - if neInfo.NeId != neId { - logger.Errorf("NeRunTelnetClient NeType:%s NeID:%s not found", neType, neId) +func (r NeInfo) NeRunTelnetClient(coreUid, neUid string, num int) (*telnet.ConnTelnet, error) { + neInfo := r.FindByCoreUidAndNeUid(coreUid, neUid) + if neInfo.CoreUID != coreUid || neInfo.NeUID != neUid { + logger.Errorf("NeRunSSHClient CoreUID:%s or NeUID:%s not found", coreUid, neUid) return nil, fmt.Errorf("neinfo not found") } // 取主机信息 if neInfo.HostIDs == "" { - logger.Errorf("NeRunTelnetClient NeType:%s NeID:%s hostId not found", neType, neId) + logger.Errorf("NeRunTelnetClient CoreUID:%s or NeUID:%s hostId not found", coreUid, neUid) return nil, fmt.Errorf("neinfo hostId not found") } hostIds := strings.Split(neInfo.HostIDs, ",") @@ -449,15 +541,15 @@ func (r NeInfo) NeRunTelnetClient(neType, neId string, num int) (*telnet.ConnTel // NeRunRedisClient 网元主机的Redis客户端-为创建相关连接,注意结束后 Close() // 暂时只有UDM有Redis配置项 -func (r NeInfo) NeRunRedisClient(neType, neId string) (*redis.ConnRedis, error) { - neInfo := r.FindByNeTypeAndNeID(neType, neId) - if neInfo.NeId != neId { - logger.Errorf("NeRunRedisClient NeType:%s NeID:%s not found", neType, neId) +func (r NeInfo) NeRunRedisClient(coreUid, neUid string) (*redis.ConnRedis, error) { + neInfo := r.FindByCoreUidAndNeUid(coreUid, neUid) + if neInfo.CoreUID != coreUid || neInfo.NeUID != neUid { + logger.Errorf("NeRunRedisClient CoreUid:%s NeUid:%s not found", coreUid, neUid) return nil, fmt.Errorf("neinfo not found") } // 取主机信息 if neInfo.HostIDs == "" { - logger.Errorf("NeRunRedisClient NeType:%s NeID:%s hostId not found", neType, neId) + logger.Errorf("NeRunRedisClient CoreUid:%s NeUid:%s hostId not found", coreUid, neUid) return nil, fmt.Errorf("neinfo hostId not found") } hostIds := strings.Split(neInfo.HostIDs, ",") @@ -484,8 +576,14 @@ func (r NeInfo) NeRunRedisClient(neType, neId string) (*redis.ConnRedis, error) } // NeConfOAMReadSync 网元OAM配置文件读取 -func (r NeInfo) NeConfOAMReadSync(neType, neId string) (map[string]any, error) { - oamData, err := r.neConfOAMRead(neType, neId, true) +func (r NeInfo) NeConfOAMReadSync(coreUid, neUid string) (map[string]any, error) { + neInfo := r.FindByCoreUidAndNeUid(coreUid, neUid) + if neInfo.CoreUID != coreUid || neInfo.NeUID != neUid { + logger.Errorf("NeRunRedisClient CoreUid:%s NeUid:%s not found", coreUid, neUid) + return nil, fmt.Errorf("neinfo not found") + } + + oamData, err := r.neConfOAMRead(neInfo, true) if err != nil { return nil, err } @@ -500,7 +598,7 @@ func (r NeInfo) NeConfOAMReadSync(neType, neId string) (map[string]any, error) { } oamData["httpManageCfg"] = item delete(oamData, "httpmanagecfg") - r.neConfOAMWirte(neType, neId, oamData, false) + r.neConfOAMWirte(neInfo, oamData, false) } // 对网管HTTP配置 if v, ok := oamData["oamconfig"]; ok && v != nil { @@ -515,7 +613,7 @@ func (r NeInfo) NeConfOAMReadSync(neType, neId string) (map[string]any, error) { } oamData["oamConfig"] = item delete(oamData, "oamconfig") - r.neConfOAMWirte(neType, neId, oamData, false) + r.neConfOAMWirte(neInfo, oamData, false) } // 对网管SNMP配置 if v, ok := oamData["snmpconfig"]; ok && v != nil { @@ -526,14 +624,14 @@ func (r NeInfo) NeConfOAMReadSync(neType, neId string) (map[string]any, error) { } oamData["snmpConfig"] = item delete(oamData, "snmpconfig") - r.neConfOAMWirte(neType, neId, oamData, false) + r.neConfOAMWirte(neInfo, oamData, false) } // 对网管KPI上报配置 if v, ok := oamData["kpiconfig"]; ok && v != nil { item := v.(map[string]any) oamData["kpiConfig"] = item delete(oamData, "kpiconfig") - r.neConfOAMWirte(neType, neId, oamData, false) + r.neConfOAMWirte(neInfo, oamData, false) } // NSSF和MME 配置KPIconfig名不一致时 @@ -541,7 +639,7 @@ func (r NeInfo) NeConfOAMReadSync(neType, neId string) (map[string]any, error) { item := v.(map[string]any) oamData["kpiConfig"] = item delete(oamData, "KPIconfig") - r.neConfOAMWirte(neType, neId, oamData, false) + r.neConfOAMWirte(neInfo, oamData, false) } return oamData, nil @@ -591,11 +689,11 @@ func (r NeInfo) neConfOAMData() map[string]any { } // neConfOAMRead 网元OAM配置文件读取 sync从网元端同步到本地 -func (r NeInfo) neConfOAMRead(neType, neId string, sync bool) (map[string]any, error) { - neTypeLower := strings.ToLower(neType) +func (r NeInfo) neConfOAMRead(neInfo model.NeInfo, sync bool) (map[string]any, error) { + neTypeLower := strings.ToLower(neInfo.NeType) fileName := "oam_manager.yaml" // 网管本地路径 - localFilePath := fmt.Sprintf("/usr/local/omc/backup/ne_config/%s/%s/%s", neTypeLower, neId, fileName) + localFilePath := fmt.Sprintf("/usr/local/omc/backup/ne_config/%s/%s/%s", neTypeLower, neInfo.NeUID, fileName) if runtime.GOOS == "windows" { localFilePath = fmt.Sprintf("C:%s", localFilePath) } @@ -603,7 +701,7 @@ func (r NeInfo) neConfOAMRead(neType, neId string, sync bool) (map[string]any, e // 从网元端同步到本地 if sync { // 网元主机的SSH客户端 - sshClient, err := r.NeRunSSHClient(neType, neId) + sshClient, err := r.NeRunSSHClient(neInfo.CoreUID, neInfo.NeUID) if err != nil { return nil, fmt.Errorf("ne info ssh client err") } @@ -631,7 +729,7 @@ func (r NeInfo) neConfOAMRead(neType, neId string, sync bool) (map[string]any, e // return nil, fmt.Errorf("read file error") // 无保留文件时返回默认文件数据 oamData := r.neConfOAMData() - r.neConfOAMWirte(neType, neId, oamData, false) + r.neConfOAMWirte(neInfo, oamData, false) return oamData, nil } content := string(bytes) @@ -646,15 +744,15 @@ func (r NeInfo) neConfOAMRead(neType, neId string, sync bool) (map[string]any, e } // neConfOAMWirte 网元OAM配置文件写入 content内容 sync同步到网元端 -func (r NeInfo) neConfOAMWirte(neType, neId string, content any, sync bool) error { - neTypeLower := strings.ToLower(neType) +func (r NeInfo) neConfOAMWirte(neInfo model.NeInfo, content any, sync bool) error { + neTypeLower := strings.ToLower(neInfo.NeType) fileName := "oam_manager.yaml" // 网管本地路径 omcPath := "/usr/local/omc/backup/ne_config" if runtime.GOOS == "windows" { omcPath = fmt.Sprintf("C:%s", omcPath) } - localFilePath := fmt.Sprintf("%s/%s/%s/%s", omcPath, neTypeLower, neId, fileName) + localFilePath := fmt.Sprintf("%s/%s/%s/%s", omcPath, neTypeLower, neInfo.NeUID, fileName) // 写入文件 if err := parse.ConvertConfigToFile("yaml", localFilePath, content); err != nil { @@ -664,7 +762,7 @@ func (r NeInfo) neConfOAMWirte(neType, neId string, content any, sync bool) erro // 同步到网元端 if sync { // 网元主机的SSH客户端 - sshClient, err := r.NeRunSSHClient(neType, neId) + sshClient, err := r.NeRunSSHClient(neInfo.CoreUID, neInfo.NeUID) if err != nil { return err } @@ -692,7 +790,7 @@ func (r NeInfo) neConfOAMWirte(neType, neId string, content any, sync bool) erro // NeConfOAMWirteSync 网元OAM配置文件生成并同步 func (r NeInfo) NeConfOAMWirteSync(neInfo model.NeInfo, content map[string]any, sync bool) error { - oamData, err := r.neConfOAMRead(neInfo.NeType, neInfo.NeId, false) + oamData, err := r.neConfOAMRead(neInfo, false) if oamData == nil || err != nil { return fmt.Errorf("error read OAM file info") } @@ -703,13 +801,13 @@ func (r NeInfo) NeConfOAMWirteSync(neInfo model.NeInfo, content map[string]any, httpManageCfg = neConfOAMData["httpManageCfg"].(map[string]any) } httpManageCfg["port"] = neInfo.Port - if strings.Contains(neInfo.IP, ":") { + if strings.Contains(neInfo.IPAddr, ":") { httpManageCfg["ipType"] = "ipv6" - httpManageCfg["ipv6"] = neInfo.IP + httpManageCfg["ipv6"] = neInfo.IPAddr } - if strings.Contains(neInfo.IP, ".") { + if strings.Contains(neInfo.IPAddr, ".") { httpManageCfg["ipType"] = "ipv4" - httpManageCfg["ipv4"] = neInfo.IP + httpManageCfg["ipv4"] = neInfo.IPAddr } delete(httpManageCfg, "iptype") delete(oamData, "httpmanagecfg") @@ -723,8 +821,8 @@ func (r NeInfo) NeConfOAMWirteSync(neInfo model.NeInfo, content map[string]any, } delete(oamConfig, "neconfig") oamConfig["neConfig"] = map[string]string{ - "neId": neInfo.NeId, - "rmUid": neInfo.RmUID, + "coreId": neInfo.CoreUID, + "neUid": neInfo.NeUID, "neName": neInfo.NeName, "dn": neInfo.Dn, "vendorName": neInfo.VendorName, @@ -770,13 +868,13 @@ func (r NeInfo) NeConfOAMWirteSync(neInfo model.NeInfo, content map[string]any, neConfOAMData := r.neConfOAMData() snmpConfig = neConfOAMData["snmpConfig"].(map[string]any) } - if strings.Contains(neInfo.IP, ":") { + if strings.Contains(neInfo.IPAddr, ":") { snmpConfig["ipType"] = "ipv6" - snmpConfig["ipv6"] = neInfo.IP + snmpConfig["ipv6"] = neInfo.IPAddr } - if strings.Contains(neInfo.IP, ".") { + if strings.Contains(neInfo.IPAddr, ".") { snmpConfig["ipType"] = "ipv4" - snmpConfig["ipv4"] = neInfo.IP + snmpConfig["ipv4"] = neInfo.IPAddr } delete(snmpConfig, "iptype") if snmpEnable, ok := content["snmpEnable"]; ok && snmpEnable != nil { @@ -808,7 +906,7 @@ func (r NeInfo) NeConfOAMWirteSync(neInfo model.NeInfo, content map[string]any, delete(oamData, "kpiconfig") oamData["kpiConfig"] = kpiConfig - if err := r.neConfOAMWirte(neInfo.NeType, neInfo.NeId, oamData, sync); err != nil { + if err := r.neConfOAMWirte(neInfo, oamData, sync); err != nil { return fmt.Errorf("error wirte OAM file info") } return nil @@ -858,7 +956,7 @@ func (r *NeInfo) NeConfPara5GWirte(content map[string]any, syncNE []string) erro // 网元主机的SSH客户端 sshClient, err := r.NeRunSSHClient(ti[0], ti[1]) if err != nil { - errMsg = append(errMsg, fmt.Sprintf("%s : %s", ti, err.Error())) + errMsg = append(errMsg, fmt.Sprintf("core_ne %s : %s", ti, err.Error())) continue } defer sshClient.Close() diff --git a/src/modules/ne/service/ne_license.go b/src/modules/ne/service/ne_license.go index d6d6f2e0..c6eb557e 100644 --- a/src/modules/ne/service/ne_license.go +++ b/src/modules/ne/service/ne_license.go @@ -71,23 +71,11 @@ func (r *NeLicense) DeleteByIds(ids []int64) (int64, error) { return 0, fmt.Errorf("delete fail") } -// FindByTypeAndID 通过网元类型和网元ID查询 -func (r *NeLicense) FindByTypeAndID(neType, neId string) model.NeLicense { +// FindByCoreUidAndNeUid 通过核心网和网元唯一标识查询 +func (r *NeLicense) FindByCoreUidAndNeUid(coreUid, neUid string) model.NeLicense { neLicenses := r.neLicenseRepository.Select(model.NeLicense{ - NeType: neType, - NeId: neId, - }) - if len(neLicenses) > 0 { - return neLicenses[0] - } - return model.NeLicense{} -} - -// FindByNeTypeAndNeID 通过ne_type和ne_id查询信息 -func (r *NeLicense) FindByNeTypeAndNeID(neType, neId string) model.NeLicense { - neLicenses := r.neLicenseRepository.Select(model.NeLicense{ - NeType: neType, - NeId: neId, + CoreUID: coreUid, + NeUID: neUid, }) if len(neLicenses) > 0 { return neLicenses[0] @@ -104,12 +92,12 @@ func (r *NeLicense) ReadLicenseInfo(neLicense model.NeLicense) (string, string) if runtime.GOOS == "windows" { omcPath = fmt.Sprintf("C:%s", omcPath) } - omcPath = fmt.Sprintf("%s/%s/%s", omcPath, neTypeLower, neLicense.NeId) + omcPath = fmt.Sprintf("%s/%s/%s", omcPath, neTypeLower, neLicense.NeUID) // 网元端授权文件路径 nePath := fmt.Sprintf("/usr/local/etc/%s/license", neTypeLower) // 网元主机的SSH客户端 - sshClient, err := NewNeInfo.NeRunSSHClient(neLicense.NeType, neLicense.NeId) + sshClient, err := NewNeInfo.NeRunSSHClient(neLicense.CoreUID, neLicense.NeUID) if err != nil { return "", "" } @@ -154,7 +142,7 @@ func (r *NeLicense) UploadLicense(neLicense model.NeLicense) error { } // 网元主机的SSH客户端 - sshClient, err := NewNeInfo.NeRunSSHClient(neLicense.NeType, neLicense.NeId) + sshClient, err := NewNeInfo.NeRunSSHClient(neLicense.CoreUID, neLicense.NeUID) if err != nil { return err } diff --git a/src/modules/ne/service/ne_software.go b/src/modules/ne/service/ne_software.go index 7e2276cd..4e4ef39c 100644 --- a/src/modules/ne/service/ne_software.go +++ b/src/modules/ne/service/ne_software.go @@ -87,7 +87,7 @@ func (r NeSoftware) Update(neSoftware model.NeSoftware) int64 { } // DeleteByIds 批量删除信息 -func (r NeSoftware) DeleteByIds(ids []int64) (int64, error) { +func (r NeSoftware) DeleteByIds(ids []int64, delFile bool) (int64, error) { // 检查是否存在 rows := r.neSoftwareRepository.SelectByIds(ids) if len(rows) <= 0 { @@ -95,14 +95,16 @@ func (r NeSoftware) DeleteByIds(ids []int64) (int64, error) { } if len(rows) == len(ids) { - // 遍历软件包列表进行文件删除 - for _, row := range rows { - // 检查文件是否存在 - filePath := file.ParseUploadFileAbsPath(row.Path) - if _, err := os.Stat(filePath); err != nil { - continue + if delFile { + // 遍历软件包列表进行文件删除 + for _, row := range rows { + // 检查文件是否存在 + filePath := file.ParseUploadFileAbsPath(row.Path) + if _, err := os.Stat(filePath); err != nil { + continue + } + os.Remove(filePath) } - os.Remove(filePath) } rows := r.neSoftwareRepository.DeleteByIds(ids) return rows, nil diff --git a/src/modules/ne/service/ne_version.go b/src/modules/ne/service/ne_version.go index b70f86f1..cea09d7c 100644 --- a/src/modules/ne/service/ne_version.go +++ b/src/modules/ne/service/ne_version.go @@ -55,8 +55,8 @@ func (r NeVersion) checkNeVersion(arr *[]model.NeVersion) { for i := range *arr { item := (*arr)[i] // 查询网元获取IP - neInfo := r.neInfoService.FindByNeTypeAndNeID(item.NeType, item.NeId) - if neInfo.NeId != item.NeId || neInfo.IP == "" { + neInfo := r.neInfoService.FindByCoreUidAndNeUid(item.CoreUID, item.NeUID) + if neInfo.CoreUID != item.CoreUID || neInfo.NeUID != item.NeUID { continue } result, err := neFetchlink.NeState(neInfo) @@ -72,9 +72,8 @@ func (r NeVersion) checkNeVersion(arr *[]model.NeVersion) { item.Path = "-" item.Version = ver } - if item.NeType != neInfo.NeType || item.NeId != neInfo.NeId { + if item.NeType != neInfo.NeType { item.NeType = neInfo.NeType - item.NeId = neInfo.NeId } r.Update(item) (*arr)[i] = item @@ -119,11 +118,11 @@ func (r NeVersion) DeleteByIds(ids []int64) (int64, error) { return 0, fmt.Errorf("delete fail") } -// FindByNeTypeAndNeID 通过网元类型和网元ID查询 -func (r NeVersion) FindByNeTypeAndNeID(neType, neId string) model.NeVersion { +// FindByCoreUidAndNeUid 通过核心网和网元唯一标识查询 +func (r NeVersion) FindByCoreUidAndNeUid(coreUid, neUid string) model.NeVersion { neVersions := r.neVersionRepository.Select(model.NeVersion{ - NeType: neType, - NeId: neId, + CoreUID: coreUid, + NeUID: neUid, }) if len(neVersions) > 0 { return neVersions[0] @@ -136,7 +135,7 @@ func (r NeVersion) FindByNeTypeAndNeID(neType, neId string) model.NeVersion { // action 安装行为:install upgrade rollback func (r NeVersion) Operate(action string, neVersion model.NeVersion, preinput map[string]string) (string, error) { // 网元主机的SSH客户端 - sshClient, err := r.neInfoService.NeRunSSHClient(neVersion.NeType, neVersion.NeId) + sshClient, err := r.neInfoService.NeRunSSHClient(neVersion.CoreUID, neVersion.NeUID) if err != nil { return "", err } @@ -162,7 +161,7 @@ func (r NeVersion) Operate(action string, neVersion model.NeVersion, preinput ma if para5GMap == nil || err != nil { return "", fmt.Errorf("error read para5G file info") } - if err := r.neInfoService.NeConfPara5GWirte(para5GMap, []string{fmt.Sprintf("%s@%s", neVersion.NeType, neVersion.NeId)}); err != nil { + if err := r.neInfoService.NeConfPara5GWirte(para5GMap, []string{fmt.Sprintf("%s@%s", neVersion.CoreUID, neVersion.NeUID)}); err != nil { return "", fmt.Errorf("error wirte para5G file info") } } @@ -694,8 +693,8 @@ func (r NeVersion) operateRun(sshClient *ssh.ConnSSH, preinput map[string]string func (r NeVersion) operateDome(action string, neVersion model.NeVersion) error { if action == "install" { // 网元信息 - neInfo := r.neInfoService.FindByNeTypeAndNeID(neVersion.NeType, neVersion.NeId) - if neInfo.NeId != neVersion.NeId { + neInfo := r.neInfoService.FindByCoreUidAndNeUid(neVersion.CoreUID, neVersion.NeUID) + if neInfo.CoreUID != neVersion.CoreUID || neInfo.NeUID != neVersion.NeUID { return fmt.Errorf("error found neinfo") } @@ -717,29 +716,29 @@ func (r NeVersion) operateDome(action string, neVersion model.NeVersion) error { // IMS 配置 imsNEs := r.neInfoService.Find(model.NeInfo{NeType: "IMS"}, false, false) for _, v := range imsNEs { - r.neInfoService.NeRunSSHCmd(v.NeType, v.NeId, smscIPCMD) - r.neInfoService.NeRunSSHCmd(v.NeType, v.NeId, smscHostCMD) - r.neInfoService.NeRunSSHCmd(v.NeType, v.NeId, smsHost) - r.neInfoService.NeRunSSHCmd(v.NeType, v.NeId, "sudo sed -i '/^#!define WITH_SMS/ s/^/#/' /usr/local/etc/ims/vars.cfg") - r.neInfoService.NeRunSSHCmd(v.NeType, v.NeId, "ims-stop || true && ims-start") + r.neInfoService.NeRunSSHCmd(v.CoreUID, v.NeUID, smscIPCMD) + r.neInfoService.NeRunSSHCmd(v.CoreUID, v.NeUID, smscHostCMD) + r.neInfoService.NeRunSSHCmd(v.CoreUID, v.NeUID, smsHost) + r.neInfoService.NeRunSSHCmd(v.CoreUID, v.NeUID, "sudo sed -i '/^#!define WITH_SMS/ s/^/#/' /usr/local/etc/ims/vars.cfg") + r.neInfoService.NeRunSSHCmd(v.CoreUID, v.NeUID, "ims-stop || true && ims-start") } // UDM 配置 smscASName := fmt.Sprintf("sudo sed -i \"/- name: 'sms_as'/{n;s|serverName: .*|serverName: 'sip:%s:5060'|}\" /usr/local/etc/udm/as.yaml", para5GData["SMSC_IP"]) smscASAddress := fmt.Sprintf("sudo sed -i \"/- name: 'sms_as'/{n;n;n;s|diameterAddress: .*|diameterAddress: 'smsc.ims.%s.3gppnetwork.org'|}\" /usr/local/etc/udm/as.yaml", mnc_mcc) udmNEs := r.neInfoService.Find(model.NeInfo{NeType: "UDM"}, false, false) for _, v := range udmNEs { - r.neInfoService.NeRunSSHCmd(v.NeType, v.NeId, smscIPCMD) - r.neInfoService.NeRunSSHCmd(v.NeType, v.NeId, smscHostCMD) - r.neInfoService.NeRunSSHCmd(v.NeType, v.NeId, smscASName) - r.neInfoService.NeRunSSHCmd(v.NeType, v.NeId, smscASAddress) - r.neInfoService.NeRunSSHCmd(v.NeType, v.NeId, "sudo service udm restart") + r.neInfoService.NeRunSSHCmd(v.CoreUID, v.NeUID, smscIPCMD) + r.neInfoService.NeRunSSHCmd(v.CoreUID, v.NeUID, smscHostCMD) + r.neInfoService.NeRunSSHCmd(v.CoreUID, v.NeUID, smscASName) + r.neInfoService.NeRunSSHCmd(v.CoreUID, v.NeUID, smscASAddress) + r.neInfoService.NeRunSSHCmd(v.CoreUID, v.NeUID, "sudo service udm restart") } } } // 更新Version - verInfo := r.FindByNeTypeAndNeID(neVersion.NeType, neVersion.NeId) - if verInfo.NeId == neVersion.NeId { + verInfo := r.FindByCoreUidAndNeUid(neVersion.CoreUID, neVersion.NeUID) + if verInfo.CoreUID == neVersion.CoreUID && verInfo.NeUID == neVersion.NeUID { curName := verInfo.Name curVersion := verInfo.Version curPath := verInfo.Path diff --git a/src/modules/ne_data/controller/all_alarm.go b/src/modules/ne_data/controller/all_alarm.go index 858b9481..3c2fae2c 100644 --- a/src/modules/ne_data/controller/all_alarm.go +++ b/src/modules/ne_data/controller/all_alarm.go @@ -99,7 +99,8 @@ func (s AlarmController) Remove(c *gin.Context) { // PUT /clear func (s AlarmController) Clear(c *gin.Context) { var body struct { - Ids []int64 `json:"ids" binding:"required"` + CoreUID string `json:"coreUid" form:"coreUid" binding:"required"` // 核心网唯一标识 + Id int64 `json:"id" binding:"required"` } if err := c.ShouldBindBodyWithJSON(&body); err != nil { errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) @@ -108,7 +109,12 @@ func (s AlarmController) Clear(c *gin.Context) { } clearUser := reqctx.LoginUserToUserName(c) - rows, err := s.alarmService.ClearByIds(body.Ids, clearUser, constants.ALARM_CLEAR_TYPE_MANUAL_CLEAR) + rows, err := s.alarmService.ClearById( + body.Id, + body.CoreUID, + clearUser, + constants.ALARM_CLEAR_TYPE_MANUAL_CLEAR, + ) if err != nil { c.JSON(200, resp.ErrMsg(err.Error())) return @@ -121,8 +127,9 @@ func (s AlarmController) Clear(c *gin.Context) { // PUT /ack func (s AlarmController) Ack(c *gin.Context) { var body struct { - Ids []int64 `json:"ids" binding:"required"` - AckState bool `json:"ackState" binding:"omitempty"` + CoreUID string `json:"coreUid" form:"coreUid" binding:"required"` // 核心网唯一标识 + Id int64 `json:"id" binding:"required"` + AckState bool `json:"ackState" binding:"omitempty"` } if err := c.ShouldBindBodyWithJSON(&body); err != nil { errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) @@ -131,7 +138,12 @@ func (s AlarmController) Ack(c *gin.Context) { } ackUser := reqctx.LoginUserToUserName(c) - rows, err := s.alarmService.AckByIds(body.Ids, ackUser, constants.ALARM_ACK_STATE_ACK) + rows, err := s.alarmService.AckById( + body.Id, + body.CoreUID, + ackUser, + constants.ALARM_ACK_STATE_ACK, + ) if err != nil { c.JSON(200, resp.ErrMsg(err.Error())) return @@ -144,6 +156,7 @@ func (s AlarmController) Ack(c *gin.Context) { // GET /count/severity func (s AlarmController) CountSeverity(c *gin.Context) { var query struct { + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 AlarmStatus string `json:"alarmStatus" form:"alarmStatus" binding:"required,oneof=Clear Active"` // 告警状态 } if err := c.ShouldBindQuery(&query); err != nil { @@ -152,7 +165,7 @@ func (s AlarmController) CountSeverity(c *gin.Context) { return } - data := s.alarmService.CountSeverity(query.AlarmStatus) + data := s.alarmService.CountSeverity(query.CoreUID, query.AlarmStatus) c.JSON(200, resp.OkData(data)) } @@ -161,6 +174,7 @@ func (s AlarmController) CountSeverity(c *gin.Context) { // GET /count/type func (s AlarmController) CountType(c *gin.Context) { var query struct { + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 AlarmStatus string `json:"alarmStatus" form:"alarmStatus" binding:"required,oneof=Clear Active"` // 告警状态 } if err := c.ShouldBindQuery(&query); err != nil { @@ -169,15 +183,16 @@ func (s AlarmController) CountType(c *gin.Context) { return } - data := s.alarmService.CountType(query.AlarmStatus) + data := s.alarmService.CountType(query.CoreUID, query.AlarmStatus) c.JSON(200, resp.OkData(data)) } // 告警状态前几排名 // -// GET /count/ne -func (s AlarmController) CountNe(c *gin.Context) { +// GET /count/top +func (s AlarmController) CountTop(c *gin.Context) { var query struct { + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 AlarmStatus string `json:"alarmStatus" form:"alarmStatus" binding:"required,oneof=Clear Active"` // 告警状态 Top int `json:"top" form:"top" binding:"required"` // 前几 } @@ -187,7 +202,7 @@ func (s AlarmController) CountNe(c *gin.Context) { return } - data := s.alarmService.CountNe(query.AlarmStatus, query.Top) + data := s.alarmService.CountNe(query.CoreUID, query.AlarmStatus, query.Top) c.JSON(200, resp.OkData(data)) } diff --git a/src/modules/ne_data/controller/all_kpi.go b/src/modules/ne_data/controller/all_kpi.go index 639ab969..6241239e 100644 --- a/src/modules/ne_data/controller/all_kpi.go +++ b/src/modules/ne_data/controller/all_kpi.go @@ -55,12 +55,11 @@ func (s KPIController) KPIData(c *gin.Context) { } // 查询网元获取IP - neInfo := s.neInfoService.FindByNeTypeAndNeID(querys.NeType, querys.NeID) - if neInfo.NeId != querys.NeID || neInfo.IP == "" { + neInfo := s.neInfoService.FindByCoreUidAndNeUid(querys.CoreUID, querys.NeUID) + if neInfo.CoreUID != querys.CoreUID || neInfo.NeUID != querys.NeUID { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } - querys.RmUID = neInfo.RmUID // 查询数据 kpiData := s.kpiReportService.FindData(querys) diff --git a/src/modules/ne_data/controller/all_kpi_c.go b/src/modules/ne_data/controller/all_kpi_c.go index 5f7159b2..b640dafa 100644 --- a/src/modules/ne_data/controller/all_kpi_c.go +++ b/src/modules/ne_data/controller/all_kpi_c.go @@ -57,12 +57,11 @@ func (s KPICController) KPIData(c *gin.Context) { } // 查询网元获取IP - neInfo := s.neInfoService.FindByNeTypeAndNeID(querys.NeType, querys.NeID) - if neInfo.NeId != querys.NeID || neInfo.IP == "" { + neInfo := s.neInfoService.FindByCoreUidAndNeUid(querys.CoreUID, querys.NeUID) + if neInfo.CoreUID != querys.CoreUID || neInfo.NeUID != querys.NeUID { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } - querys.RmUID = neInfo.RmUID // 查询数据 kpiData := s.kpicReportService.FindData(querys) diff --git a/src/modules/ne_data/controller/all_nb_state.go b/src/modules/ne_data/controller/all_nb_state.go index 6054f3d3..6ee9fec9 100644 --- a/src/modules/ne_data/controller/all_nb_state.go +++ b/src/modules/ne_data/controller/all_nb_state.go @@ -58,12 +58,11 @@ func (s NBStateController) List(c *gin.Context) { } // 查询网元信息 rmUID - neInfo := s.neInfoService.FindByNeTypeAndNeID(query.NeType, query.NeID) - if neInfo.NeId != query.NeID || neInfo.IP == "" { + neInfo := s.neInfoService.FindByCoreUidAndNeUid(query.CoreUID, query.NeUID) + if neInfo.CoreUID != query.CoreUID || neInfo.NeUID != query.NeUID { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } - query.RmUID = neInfo.RmUID // 查询数据 rows, total := s.nbStateService.FindByPage(query) @@ -97,12 +96,12 @@ func (s NBStateController) Export(c *gin.Context) { querys.PageSize = 10000 } // 查询网元信息 rmUID - neInfo := s.neInfoService.FindByNeTypeAndNeID(querys.NeType, querys.NeID) - if neInfo.NeId != querys.NeID || neInfo.IP == "" { + neInfo := s.neInfoService.FindByCoreUidAndNeUid(querys.CoreUID, querys.NeUID) + if neInfo.CoreUID != querys.CoreUID || neInfo.NeUID != querys.NeUID { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } - querys.RmUID = neInfo.RmUID + rows, total := s.nbStateService.FindByPage(querys) if total == 0 { // 导出数据记录为空 diff --git a/src/modules/ne_data/controller/amf.go b/src/modules/ne_data/controller/amf.go index b40ceaaf..548410a1 100644 --- a/src/modules/ne_data/controller/amf.go +++ b/src/modules/ne_data/controller/amf.go @@ -54,13 +54,19 @@ func (s *AMFController) UEList(c *gin.Context) { if pageSize > 10000 { query["pageSize"] = "10000" } - // 查询网元信息 rmUID - neInfo := s.neInfoService.FindByNeTypeAndNeID(query["neType"], query["neId"]) - if neInfo.NeType == "" { + coreUid := c.DefaultQuery("coreUid", "") + neUid := c.DefaultQuery("neUid", "") + if coreUid == "" || neUid == "" { + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "coreUid or neUid is empty")) + return + } + + // 查询网元获取IP + neInfo := s.neInfoService.FindByCoreUidAndNeUid(coreUid, neUid) + if neInfo.CoreUID != coreUid || neInfo.NeUID != neUid { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } - query["rmUID"] = neInfo.RmUID rows, total := s.ueEventService.FindByPage(neInfo.NeType, query) c.JSON(200, resp.OkData(map[string]any{"rows": rows, "total": total})) } @@ -124,13 +130,19 @@ func (s *AMFController) UEExport(c *gin.Context) { if pageSize > 10000 { query["pageSize"] = "10000" } - // 查询网元信息 rmUID - neInfo := s.neInfoService.FindByNeTypeAndNeID(query["neType"], query["neId"]) - if neInfo.NeType == "" { + coreUid := c.DefaultQuery("coreUid", "") + neUid := c.DefaultQuery("neUid", "") + if coreUid == "" || neUid == "" { + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "coreUid or neUid is empty")) + return + } + + // 查询网元获取IP + neInfo := s.neInfoService.FindByCoreUidAndNeUid(coreUid, neUid) + if neInfo.CoreUID != coreUid || neInfo.NeUID != neUid { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } - query["rmUID"] = neInfo.RmUID rows, total := s.ueEventService.FindByPage(neInfo.NeType, query) if total == 0 { // 导出数据记录为空 @@ -167,8 +179,9 @@ func (s *AMFController) UEExport(c *gin.Context) { func (s *AMFController) NbInfoList(c *gin.Context) { language := reqctx.AcceptLanguage(c) var query struct { - NeId string `form:"neId" binding:"required"` - NbId string `form:"id"` + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `form:"neUid" binding:"required"` // 网元唯一标识 + NbId string `form:"id"` } if err := c.ShouldBindQuery(&query); err != nil { errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) @@ -177,8 +190,8 @@ func (s *AMFController) NbInfoList(c *gin.Context) { } // 查询网元信息 - neInfo := s.neInfoService.FindByNeTypeAndNeID("AMF", query.NeId) - if neInfo.NeId != query.NeId || neInfo.IP == "" { + neInfo := s.neInfoService.FindByCoreUidAndNeUid(query.CoreUID, query.NeUID) + if neInfo.CoreUID != query.CoreUID || neInfo.NeUID != query.NeUID { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } @@ -210,15 +223,19 @@ func (s *AMFController) NbInfoList(c *gin.Context) { // @Router /neData/amf/nb/list-cfg [get] func (s *AMFController) NbStateList(c *gin.Context) { language := reqctx.AcceptLanguage(c) - neId := c.Query("neId") - if neId == "" { - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId is empty")) + var query struct { + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `form:"neUid" binding:"required"` // 网元唯一标识 + } + if err := c.ShouldBindQuery(&query); err != nil { + errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs)) return } // 查询网元信息 - neInfo := s.neInfoService.FindByNeTypeAndNeID("AMF", neId) - if neInfo.NeId != neId || neInfo.IP == "" { + neInfo := s.neInfoService.FindByCoreUidAndNeUid(query.CoreUID, query.NeUID) + if neInfo.CoreUID != query.CoreUID || neInfo.NeUID != query.NeUID { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } diff --git a/src/modules/ne_data/controller/ims.go b/src/modules/ne_data/controller/ims.go index a1d26115..d9d73d68 100644 --- a/src/modules/ne_data/controller/ims.go +++ b/src/modules/ne_data/controller/ims.go @@ -55,13 +55,19 @@ func (s *IMSController) CDRList(c *gin.Context) { if pageSize > 10000 { query["pageSize"] = "10000" } - // 查询网元信息 rmUID - neInfo := s.neInfoService.FindByNeTypeAndNeID(query["neType"], query["neId"]) - if neInfo.NeType == "" { + coreUid := c.DefaultQuery("coreUid", "") + neUid := c.DefaultQuery("neUid", "") + if coreUid == "" || neUid == "" { + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "coreUid or neUid is empty")) + return + } + + // 查询网元获取IP + neInfo := s.neInfoService.FindByCoreUidAndNeUid(coreUid, neUid) + if neInfo.CoreUID != coreUid || neInfo.NeUID != neUid { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } - query["rmUID"] = neInfo.RmUID rows, total := s.cdrEventService.FindByPage(neInfo.NeType, query) c.JSON(200, resp.OkData(map[string]any{"rows": rows, "total": total})) } @@ -125,13 +131,19 @@ func (s *IMSController) CDRExport(c *gin.Context) { if pageSize > 10000 { query["pageSize"] = "10000" } - // 查询网元信息 rmUID - neInfo := s.neInfoService.FindByNeTypeAndNeID(query["neType"], query["neId"]) - if neInfo.NeType == "" { + coreUid := c.DefaultQuery("coreUid", "") + neUid := c.DefaultQuery("neUid", "") + if coreUid == "" || neUid == "" { + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "coreUid or neUid is empty")) + return + } + + // 查询网元获取IP + neInfo := s.neInfoService.FindByCoreUidAndNeUid(coreUid, neUid) + if neInfo.CoreUID != coreUid || neInfo.NeUID != neUid { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } - query["rmUID"] = neInfo.RmUID rows, total := s.cdrEventService.FindByPage(neInfo.NeType, query) if total == 0 { // 导出数据记录为空 @@ -166,15 +178,19 @@ func (s *IMSController) CDRExport(c *gin.Context) { // @Router /neData/ims/session/num [get] func (s *IMSController) UeSessionNum(c *gin.Context) { language := reqctx.AcceptLanguage(c) - neId := c.Query("neId") - if neId == "" { - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId is empty")) + var query struct { + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `form:"neUid" binding:"required"` // 网元唯一标识 + } + if err := c.ShouldBindQuery(&query); err != nil { + errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs)) return } // 查询网元信息 - neInfo := s.neInfoService.FindByNeTypeAndNeID("IMS", neId) - if neInfo.NeId != neId || neInfo.IP == "" { + neInfo := s.neInfoService.FindByCoreUidAndNeUid(query.CoreUID, query.NeUID) + if neInfo.CoreUID != query.CoreUID || neInfo.NeUID != query.NeUID { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } @@ -207,9 +223,10 @@ func (s *IMSController) UeSessionNum(c *gin.Context) { func (s *IMSController) UeSessionList(c *gin.Context) { language := reqctx.AcceptLanguage(c) var query struct { - NeId string `form:"neId" binding:"required"` - IMSI string `form:"imsi"` - MSISDN string `form:"msisdn"` + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `form:"neUid" binding:"required"` // 网元唯一标识 + IMSI string `form:"imsi"` + MSISDN string `form:"msisdn"` } if err := c.ShouldBindQuery(&query); err != nil { errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) @@ -218,8 +235,8 @@ func (s *IMSController) UeSessionList(c *gin.Context) { } // 查询网元信息 - neInfo := s.neInfoService.FindByNeTypeAndNeID("IMS", query.NeId) - if neInfo.NeId != query.NeId || neInfo.IP == "" { + neInfo := s.neInfoService.FindByCoreUidAndNeUid(query.CoreUID, query.NeUID) + if neInfo.CoreUID != query.CoreUID || neInfo.NeUID != query.NeUID { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } diff --git a/src/modules/ne_data/controller/mme.go b/src/modules/ne_data/controller/mme.go index 10dae9cb..9738f674 100644 --- a/src/modules/ne_data/controller/mme.go +++ b/src/modules/ne_data/controller/mme.go @@ -54,13 +54,19 @@ func (s *MMEController) UEList(c *gin.Context) { if pageSize > 10000 { query["pageSize"] = "10000" } - // 查询网元信息 rmUID - neInfo := s.neInfoService.FindByNeTypeAndNeID(query["neType"], query["neId"]) - if neInfo.NeType == "" { + coreUid := c.DefaultQuery("coreUid", "") + neUid := c.DefaultQuery("neUid", "") + if coreUid == "" || neUid == "" { + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "coreUid or neUid is empty")) + return + } + + // 查询网元获取IP + neInfo := s.neInfoService.FindByCoreUidAndNeUid(coreUid, neUid) + if neInfo.CoreUID != coreUid || neInfo.NeUID != neUid { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } - query["rmUID"] = neInfo.RmUID rows, total := s.ueEventService.FindByPage(neInfo.NeType, query) c.JSON(200, resp.OkData(map[string]any{"rows": rows, "total": total})) } @@ -124,13 +130,19 @@ func (s *MMEController) UEExport(c *gin.Context) { if pageSize > 10000 { query["pageSize"] = "10000" } - // 查询网元信息 rmUID - neInfo := s.neInfoService.FindByNeTypeAndNeID(query["neType"], query["neId"]) - if neInfo.NeType == "" { + coreUid := c.DefaultQuery("coreUid", "") + neUid := c.DefaultQuery("neUid", "") + if coreUid == "" || neUid == "" { + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "coreUid or neUid is empty")) + return + } + + // 查询网元获取IP + neInfo := s.neInfoService.FindByCoreUidAndNeUid(coreUid, neUid) + if neInfo.CoreUID != coreUid || neInfo.NeUID != neUid { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } - query["rmUID"] = neInfo.RmUID rows, total := s.ueEventService.FindByPage(neInfo.NeType, query) if total == 0 { // 导出数据记录为空 @@ -167,8 +179,9 @@ func (s *MMEController) UEExport(c *gin.Context) { func (s *MMEController) NbInfoList(c *gin.Context) { language := reqctx.AcceptLanguage(c) var query struct { - NeId string `form:"neId" binding:"required"` - NbId string `form:"id"` + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `form:"neUid" binding:"required"` // 网元唯一标识 + NbId string `form:"id"` } if err := c.ShouldBindQuery(&query); err != nil { errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) @@ -177,8 +190,8 @@ func (s *MMEController) NbInfoList(c *gin.Context) { } // 查询网元信息 - neInfo := s.neInfoService.FindByNeTypeAndNeID("MME", query.NeId) - if neInfo.NeId != query.NeId || neInfo.IP == "" { + neInfo := s.neInfoService.FindByCoreUidAndNeUid(query.CoreUID, query.NeUID) + if neInfo.CoreUID != query.CoreUID || neInfo.NeUID != query.NeUID { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } @@ -210,15 +223,19 @@ func (s *MMEController) NbInfoList(c *gin.Context) { // @Router /neData/mme/nb/list-cfg [get] func (s *MMEController) NbStateList(c *gin.Context) { language := reqctx.AcceptLanguage(c) - neId := c.Query("neId") - if neId == "" { - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId is empty")) + var query struct { + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `form:"neUid" binding:"required"` // 网元唯一标识 + } + if err := c.ShouldBindQuery(&query); err != nil { + errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs)) return } // 查询网元信息 - neInfo := s.neInfoService.FindByNeTypeAndNeID("MME", neId) - if neInfo.NeId != neId || neInfo.IP == "" { + neInfo := s.neInfoService.FindByCoreUidAndNeUid(query.CoreUID, query.NeUID) + if neInfo.CoreUID != query.CoreUID || neInfo.NeUID != query.NeUID { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } diff --git a/src/modules/ne_data/controller/n3iwf.go b/src/modules/ne_data/controller/n3iwf.go index 2b0e5a10..a2a7ecbe 100644 --- a/src/modules/ne_data/controller/n3iwf.go +++ b/src/modules/ne_data/controller/n3iwf.go @@ -41,8 +41,9 @@ type N3IWFController struct { func (s N3IWFController) SubUserList(c *gin.Context) { language := reqctx.AcceptLanguage(c) var query struct { - NeId string `form:"neId" binding:"required"` - IMSI string `form:"imsi"` + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `form:"neUid" binding:"required"` // 网元唯一标识 + IMSI string `form:"imsi"` } if err := c.ShouldBindQuery(&query); err != nil { errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) @@ -51,8 +52,8 @@ func (s N3IWFController) SubUserList(c *gin.Context) { } // 查询网元信息 - neInfo := s.neInfoService.FindByNeTypeAndNeID("N3IWF", query.NeId) - if neInfo.NeId != query.NeId || neInfo.IP == "" { + neInfo := s.neInfoService.FindByCoreUidAndNeUid(query.CoreUID, query.NeUID) + if neInfo.CoreUID != query.CoreUID || neInfo.NeUID != query.NeUID { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } diff --git a/src/modules/ne_data/controller/nssf.go b/src/modules/ne_data/controller/nssf.go index 950a7a82..a1043e25 100644 --- a/src/modules/ne_data/controller/nssf.go +++ b/src/modules/ne_data/controller/nssf.go @@ -40,7 +40,8 @@ type NSSFController struct { func (s NSSFController) SubUserList(c *gin.Context) { language := reqctx.AcceptLanguage(c) var query struct { - NeId string `form:"neId" binding:"required"` + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `form:"neUid" binding:"required"` // 网元唯一标识 } if err := c.ShouldBindQuery(&query); err != nil { errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) @@ -49,8 +50,8 @@ func (s NSSFController) SubUserList(c *gin.Context) { } // 查询网元信息 - neInfo := s.neInfoService.FindByNeTypeAndNeID("NSSF", query.NeId) - if neInfo.NeId != query.NeId || neInfo.IP == "" { + neInfo := s.neInfoService.FindByCoreUidAndNeUid(query.CoreUID, query.NeUID) + if neInfo.CoreUID != query.CoreUID || neInfo.NeUID != query.NeUID { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } @@ -81,7 +82,8 @@ func (s NSSFController) SubUserList(c *gin.Context) { func (s NSSFController) AvailableList(c *gin.Context) { language := reqctx.AcceptLanguage(c) var query struct { - NeId string `form:"neId" binding:"required"` + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `form:"neUid" binding:"required"` // 网元唯一标识 } if err := c.ShouldBindQuery(&query); err != nil { errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) @@ -90,8 +92,8 @@ func (s NSSFController) AvailableList(c *gin.Context) { } // 查询网元信息 - neInfo := s.neInfoService.FindByNeTypeAndNeID("NSSF", query.NeId) - if neInfo.NeId != query.NeId || neInfo.IP == "" { + neInfo := s.neInfoService.FindByCoreUidAndNeUid(query.CoreUID, query.NeUID) + if neInfo.CoreUID != query.CoreUID || neInfo.NeUID != query.NeUID { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } diff --git a/src/modules/ne_data/controller/pcf.go b/src/modules/ne_data/controller/pcf.go index 22206746..342dc338 100644 --- a/src/modules/ne_data/controller/pcf.go +++ b/src/modules/ne_data/controller/pcf.go @@ -28,7 +28,7 @@ type PCFController struct { // // GET /rule/list // -// @Tags ne_data/pcf +// @Tags network_data/pcf // @Accept json // @Produce json // @Param neId query string true "NE ID" default(001) @@ -38,13 +38,14 @@ type PCFController struct { // @Security TokenAuth // @Summary Policy Configuration List // @Description Policy Configuration List -// @Router /neData/pcf/rule/list [get] +// @Router /ne/link/pcf/rule/list [get] func (s PCFController) RuleInfoList(c *gin.Context) { language := reqctx.AcceptLanguage(c) var query struct { - NeId string `form:"neId" binding:"required"` - IMSI string `form:"imsi"` - MSISDN string `form:"msisdn"` + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `form:"neUid" binding:"required"` // 网元唯一标识 + IMSI string `form:"imsi"` + MSISDN string `form:"msisdn"` } if err := c.ShouldBindQuery(&query); err != nil { errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) @@ -53,8 +54,8 @@ func (s PCFController) RuleInfoList(c *gin.Context) { } // 查询网元信息 - neInfo := s.neInfoService.FindByNeTypeAndNeID("PCF", query.NeId) - if neInfo.NeId != query.NeId || neInfo.IP == "" { + neInfo := s.neInfoService.FindByCoreUidAndNeUid(query.CoreUID, query.NeUID) + if neInfo.CoreUID != query.CoreUID || neInfo.NeUID != query.NeUID { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } @@ -76,7 +77,7 @@ func (s PCFController) RuleInfoList(c *gin.Context) { // // POST /rule // -// @Tags ne_data/pcf +// @Tags network_data/pcf // @Accept json // @Produce json // @Param data body object true "Request Param" @@ -84,12 +85,13 @@ func (s PCFController) RuleInfoList(c *gin.Context) { // @Security TokenAuth // @Summary Policy Configuration Additions // @Description Policy Configuration Additions -// @Router /neData/pcf/rule [post] +// @Router /ne/link/pcf/rule [post] func (s PCFController) RuleInfoAdd(c *gin.Context) { language := reqctx.AcceptLanguage(c) var body struct { - NeId string `json:"neId" binding:"required"` // 网元ID - Num int64 `json:"num"` // 批量添加,默认0单条,大于1时imsi/msisdn会累加数值 + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `form:"neUid" binding:"required"` // 网元唯一标识 + Num int64 `json:"num"` // 批量添加 大于1时imsi/msisdn会累加数值 ParamData map[string]any `json:"paramData" binding:"required"` // 参数数据 // Imsi string `json:"imsi" binding:"required"` // Msisdn string `json:"msisdn" binding:"required"` @@ -109,15 +111,15 @@ func (s PCFController) RuleInfoAdd(c *gin.Context) { } // 查询网元信息 - neInfo := s.neInfoService.FindByNeTypeAndNeID("PCF", body.NeId) - if neInfo.NeId != body.NeId || neInfo.IP == "" { + neInfo := s.neInfoService.FindByCoreUidAndNeUid(body.CoreUID, body.NeUID) + if neInfo.CoreUID != body.CoreUID || neInfo.NeUID != body.NeUID { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } // 网元直连 var err error - if body.Num > 0 { // 批量添加 + if body.Num > 1 { // 批量添加 err = neFetchlink.PCFRuleAddBatch(neInfo, body.ParamData, body.Num) } else { // 单条添加 err = neFetchlink.PCFRuleAdd(neInfo, body.ParamData) @@ -133,7 +135,7 @@ func (s PCFController) RuleInfoAdd(c *gin.Context) { // // PUT /rule // -// @Tags ne_data/pcf +// @Tags network_data/pcf // @Accept json // @Produce json // @Param data body object true "Request Param" @@ -141,11 +143,12 @@ func (s PCFController) RuleInfoAdd(c *gin.Context) { // @Security TokenAuth // @Summary Policy Configuration Updates // @Description Policy Configuration Updates -// @Router /neData/pcf/rule [put] +// @Router /ne/link/pcf/rule [put] func (s PCFController) RuleInfoEdit(c *gin.Context) { language := reqctx.AcceptLanguage(c) var body struct { - NeId string `json:"neId" binding:"required"` // 网元ID + CoreUID string `json:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `json:"neUid" binding:"required"` // 网元唯一标识 Num int64 `json:"num"` // 更新数量 ParamData map[string]any `json:"paramData" binding:"required"` // 参数数据 // Imsi string `json:"imsi" binding:"required"` @@ -166,8 +169,8 @@ func (s PCFController) RuleInfoEdit(c *gin.Context) { } // 查询网元信息 - neInfo := s.neInfoService.FindByNeTypeAndNeID("PCF", body.NeId) - if neInfo.NeId != body.NeId || neInfo.IP == "" { + neInfo := s.neInfoService.FindByCoreUidAndNeUid(body.CoreUID, body.NeUID) + if neInfo.CoreUID != body.CoreUID || neInfo.NeUID != body.NeUID { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } @@ -190,7 +193,7 @@ func (s PCFController) RuleInfoEdit(c *gin.Context) { // // DELETE /rule // -// @Tags ne_data/pcf +// @Tags network_data/pcf // @Accept json // @Produce json // @Param neId query string true "NE ID" default(001) @@ -200,13 +203,14 @@ func (s PCFController) RuleInfoEdit(c *gin.Context) { // @Security TokenAuth // @Summary Policy Configuration Deletion // @Description Policy Configuration Deletion -// @Router /neData/pcf/rule [delete] +// @Router /ne/link/pcf/rule [delete] func (s PCFController) RuleInfoRemove(c *gin.Context) { language := reqctx.AcceptLanguage(c) var query struct { - NeId string `form:"neId" binding:"required"` // 网元ID - IMSI string `form:"imsi" binding:"required"` // IMSi, 带数量时为批量删除 - Num int64 `form:"num"` // 删除数量 + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `form:"neUid" binding:"required"` // 网元唯一标识 + IMSI string `form:"imsi" binding:"required"` // IMSi, 带数量时为批量删除 + Num int64 `form:"num"` // 删除数量 } if err := c.ShouldBindQuery(&query); err != nil { errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) @@ -215,15 +219,15 @@ func (s PCFController) RuleInfoRemove(c *gin.Context) { } // 查询网元信息 - neInfo := s.neInfoService.FindByNeTypeAndNeID("PCF", query.NeId) - if neInfo.NeId != query.NeId || neInfo.IP == "" { + neInfo := s.neInfoService.FindByCoreUidAndNeUid(query.CoreUID, query.NeUID) + if neInfo.CoreUID != query.CoreUID || neInfo.NeUID != query.NeUID { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } // 网元直连 var err error - if query.Num > 0 { // 批量删除 + if query.Num > 1 { // 批量删除 err = neFetchlink.PCFRuleDeleteBatch(neInfo, query.IMSI, query.Num) } else { // 单条删除 err = neFetchlink.PCFRuleDelete(neInfo, query.IMSI) @@ -239,7 +243,7 @@ func (s PCFController) RuleInfoRemove(c *gin.Context) { // // GET /rule/export // -// @Tags ne_data/pcf +// @Tags network_data/pcf // @Accept json // @Produce json // @Param neId query string true "NE ID" default(001) @@ -248,11 +252,12 @@ func (s PCFController) RuleInfoRemove(c *gin.Context) { // @Security TokenAuth // @Summary Policy Configuration Export // @Description Policy Configuration Export -// @Router /neData/pcf/rule/export [get] +// @Router /ne/link/pcf/rule/export [get] func (s PCFController) RuleInfoExport(c *gin.Context) { language := reqctx.AcceptLanguage(c) var query struct { - NeId string `form:"neId" binding:"required"` + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `form:"neUid" binding:"required"` // 网元唯一标识 FileType string `form:"fileType" binding:"required,oneof=txt"` // 文件类型 } if err := c.ShouldBindQuery(&query); err != nil { @@ -262,8 +267,8 @@ func (s PCFController) RuleInfoExport(c *gin.Context) { } // 查询网元信息 - neInfo := s.neInfoService.FindByNeTypeAndNeID("PCF", query.NeId) - if neInfo.NeId != query.NeId || neInfo.IP == "" { + neInfo := s.neInfoService.FindByCoreUidAndNeUid(query.CoreUID, query.NeUID) + if neInfo.CoreUID != query.CoreUID || neInfo.NeUID != query.NeUID { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } @@ -284,7 +289,7 @@ func (s PCFController) RuleInfoExport(c *gin.Context) { // // PUT /rule/import // -// @Tags ne_data/pcf +// @Tags network_data/pcf // @Accept json // @Produce json // @Param neId query string true "NE ID" default(001) @@ -294,11 +299,12 @@ func (s PCFController) RuleInfoExport(c *gin.Context) { // @Security TokenAuth // @Summary Policy Configuration Import // @Description Policy Configuration Import -// @Router /neData/pcf/rule/import [put] +// @Router /ne/link/pcf/rule/import [put] func (s PCFController) RuleInfoImport(c *gin.Context) { language := reqctx.AcceptLanguage(c) var body struct { - NeId string `json:"neId" binding:"required"` + CoreUID string `json:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `json:"neUid" binding:"required"` // 网元唯一标识 FileType string `json:"fileType" binding:"required,oneof=txt"` // 文件类型 FilePath string `json:"filePath" binding:"required"` // 网元端文件所在绝对路径 } @@ -309,8 +315,8 @@ func (s PCFController) RuleInfoImport(c *gin.Context) { } // 查询网元信息 - neInfo := s.neInfoService.FindByNeTypeAndNeID("PCF", body.NeId) - if neInfo.NeId != body.NeId || neInfo.IP == "" { + neInfo := s.neInfoService.FindByCoreUidAndNeUid(body.CoreUID, body.NeUID) + if neInfo.CoreUID != body.CoreUID || neInfo.NeUID != body.NeUID { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } diff --git a/src/modules/ne_data/controller/sgwc.go b/src/modules/ne_data/controller/sgwc.go index 0ed363c4..d54f0f8e 100644 --- a/src/modules/ne_data/controller/sgwc.go +++ b/src/modules/ne_data/controller/sgwc.go @@ -55,13 +55,19 @@ func (s *SGWCController) CDRList(c *gin.Context) { if pageSize > 10000 { query["pageSize"] = "10000" } - // 查询网元信息 rmUID - neInfo := s.neInfoService.FindByNeTypeAndNeID(query["neType"], query["neId"]) - if neInfo.NeType == "" { + coreUid := c.DefaultQuery("coreUid", "") + neUid := c.DefaultQuery("neUid", "") + if coreUid == "" || neUid == "" { + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "coreUid or neUid is empty")) + return + } + + // 查询网元获取IP + neInfo := s.neInfoService.FindByCoreUidAndNeUid(coreUid, neUid) + if neInfo.CoreUID != coreUid || neInfo.NeUID != neUid { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } - query["rmUID"] = neInfo.RmUID rows, total := s.cdrEventService.FindByPage(neInfo.NeType, query) c.JSON(200, resp.OkData(map[string]any{"rows": rows, "total": total})) } @@ -125,13 +131,19 @@ func (s *SGWCController) CDRExport(c *gin.Context) { if pageSize > 10000 { query["pageSize"] = "10000" } - // 查询网元信息 rmUID - neInfo := s.neInfoService.FindByNeTypeAndNeID(query["neType"], query["neId"]) - if neInfo.NeType == "" { + coreUid := c.DefaultQuery("coreUid", "") + neUid := c.DefaultQuery("neUid", "") + if coreUid == "" || neUid == "" { + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "coreUid or neUid is empty")) + return + } + + // 查询网元获取IP + neInfo := s.neInfoService.FindByCoreUidAndNeUid(coreUid, neUid) + if neInfo.CoreUID != coreUid || neInfo.NeUID != neUid { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } - query["rmUID"] = neInfo.RmUID rows, total := s.cdrEventService.FindByPage(neInfo.NeType, query) if total == 0 { // 导出数据记录为空 diff --git a/src/modules/ne_data/controller/smf.go b/src/modules/ne_data/controller/smf.go index ac5e054a..925a851a 100644 --- a/src/modules/ne_data/controller/smf.go +++ b/src/modules/ne_data/controller/smf.go @@ -57,13 +57,19 @@ func (s *SMFController) CDRList(c *gin.Context) { if pageSize > 10000 { query["pageSize"] = "10000" } - // 查询网元信息 rmUID - neInfo := s.neInfoService.FindByNeTypeAndNeID(query["neType"], query["neId"]) - if neInfo.NeType == "" { + coreUid := c.DefaultQuery("coreUid", "") + neUid := c.DefaultQuery("neUid", "") + if coreUid == "" || neUid == "" { + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "coreUid or neUid is empty")) + return + } + + // 查询网元获取IP + neInfo := s.neInfoService.FindByCoreUidAndNeUid(coreUid, neUid) + if neInfo.CoreUID != coreUid || neInfo.NeUID != neUid { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } - query["rmUID"] = neInfo.RmUID rows, total := s.cdrEventService.FindByPage(neInfo.NeType, query) c.JSON(200, resp.OkData(map[string]any{"rows": rows, "total": total})) } @@ -127,13 +133,19 @@ func (s *SMFController) CDRExport(c *gin.Context) { if pageSize > 10000 { query["pageSize"] = "10000" } - // 查询网元信息 rmUID - neInfo := s.neInfoService.FindByNeTypeAndNeID(query["neType"], query["neId"]) - if neInfo.NeType == "" { + coreUid := c.DefaultQuery("coreUid", "") + neUid := c.DefaultQuery("neUid", "") + if coreUid == "" || neUid == "" { + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "coreUid or neUid is empty")) + return + } + + // 查询网元获取IP + neInfo := s.neInfoService.FindByCoreUidAndNeUid(coreUid, neUid) + if neInfo.CoreUID != coreUid || neInfo.NeUID != neUid { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } - query["rmUID"] = neInfo.RmUID rows, total := s.cdrEventService.FindByPage(neInfo.NeType, query) if total == 0 { // 导出数据记录为空 @@ -169,7 +181,8 @@ func (s *SMFController) CDRExport(c *gin.Context) { func (s *SMFController) SubUserNum(c *gin.Context) { language := reqctx.AcceptLanguage(c) var query struct { - NeId string `form:"neId" binding:"required"` + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `form:"neUid" binding:"required"` // 网元唯一标识 } if err := c.ShouldBindQuery(&query); err != nil { errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) @@ -178,8 +191,8 @@ func (s *SMFController) SubUserNum(c *gin.Context) { } // 查询网元信息 - neInfo := s.neInfoService.FindByNeTypeAndNeID("SMF", query.NeId) - if neInfo.NeId != query.NeId || neInfo.IP == "" { + neInfo := s.neInfoService.FindByCoreUidAndNeUid(query.CoreUID, query.NeUID) + if neInfo.CoreUID != query.CoreUID || neInfo.NeUID != query.NeUID { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } @@ -214,7 +227,8 @@ func (s *SMFController) SubUserNum(c *gin.Context) { func (s *SMFController) SubUserList(c *gin.Context) { language := reqctx.AcceptLanguage(c) var query struct { - NeId string `form:"neId" binding:"required"` + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `form:"neUid" binding:"required"` // 网元唯一标识 IMSI string `form:"imsi"` MSISDN string `form:"msisdn"` Upstate string `form:"upstate"` @@ -227,8 +241,8 @@ func (s *SMFController) SubUserList(c *gin.Context) { } // 查询网元信息 - neInfo := s.neInfoService.FindByNeTypeAndNeID("SMF", query.NeId) - if neInfo.NeId != query.NeId || neInfo.IP == "" { + neInfo := s.neInfoService.FindByCoreUidAndNeUid(query.CoreUID, query.NeUID) + if neInfo.CoreUID != query.CoreUID || neInfo.NeUID != query.NeUID { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } @@ -256,7 +270,7 @@ func (s *SMFController) SubUserList(c *gin.Context) { imsiStr = strings.TrimPrefix(imsiStr, "imsi-") item["imsi"] = imsiStr // 查UDM拓展信息 - info := s.UDMExtendService.FindByIMSIAndNeID(imsiStr, "%") + info := s.UDMExtendService.FindByIMSIAndNeID(neInfo.CoreUID, "%", imsiStr) item["remark"] = info.Remark } if v, ok := item["msisdn"]; ok && v != nil { diff --git a/src/modules/ne_data/controller/smsc.go b/src/modules/ne_data/controller/smsc.go index 3b637475..302d5861 100644 --- a/src/modules/ne_data/controller/smsc.go +++ b/src/modules/ne_data/controller/smsc.go @@ -54,13 +54,19 @@ func (s *SMSCController) CDRList(c *gin.Context) { if pageSize > 10000 { query["pageSize"] = "10000" } - // 查询网元信息 rmUID - neInfo := s.neInfoService.FindByNeTypeAndNeID(query["neType"], query["neId"]) - if neInfo.NeType == "" { + coreUid := c.DefaultQuery("coreUid", "") + neUid := c.DefaultQuery("neUid", "") + if coreUid == "" || neUid == "" { + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "coreUid or neUid is empty")) + return + } + + // 查询网元获取IP + neInfo := s.neInfoService.FindByCoreUidAndNeUid(coreUid, neUid) + if neInfo.CoreUID != coreUid || neInfo.NeUID != neUid { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } - query["rmUID"] = neInfo.RmUID rows, total := s.cdrEventService.FindByPage(neInfo.NeType, query) c.JSON(200, resp.OkData(map[string]any{"rows": rows, "total": total})) } @@ -124,13 +130,19 @@ func (s *SMSCController) CDRExport(c *gin.Context) { if pageSize > 10000 { query["pageSize"] = "10000" } - // 查询网元信息 rmUID - neInfo := s.neInfoService.FindByNeTypeAndNeID(query["neType"], query["neId"]) - if neInfo.NeType == "" { + coreUid := c.DefaultQuery("coreUid", "") + neUid := c.DefaultQuery("neUid", "") + if coreUid == "" || neUid == "" { + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "coreUid or neUid is empty")) + return + } + + // 查询网元获取IP + neInfo := s.neInfoService.FindByCoreUidAndNeUid(coreUid, neUid) + if neInfo.CoreUID != coreUid || neInfo.NeUID != neUid { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } - query["rmUID"] = neInfo.RmUID rows, total := s.cdrEventService.FindByPage(neInfo.NeType, query) if total == 0 { // 导出数据记录为空 diff --git a/src/modules/ne_data/controller/udm_auth.go b/src/modules/ne_data/controller/udm_auth.go index f750774a..4dc43199 100644 --- a/src/modules/ne_data/controller/udm_auth.go +++ b/src/modules/ne_data/controller/udm_auth.go @@ -16,14 +16,14 @@ import ( neFetchlink "be.ems/src/modules/ne/fetch_link" neService "be.ems/src/modules/ne/service" "be.ems/src/modules/ne_data/model" - neDataService "be.ems/src/modules/ne_data/service" + "be.ems/src/modules/ne_data/service" "github.com/gin-gonic/gin" ) // 实例化控制层 UDMAuthController 结构体 var NewUDMAuth = &UDMAuthController{ - udmAuthService: neDataService.NewUDMAuthUser, + udmAuthService: service.NewUDMAuthUser, neInfoService: neService.NewNeInfo, } @@ -31,15 +31,15 @@ var NewUDMAuth = &UDMAuthController{ // // PATH /udm/auth type UDMAuthController struct { - udmAuthService *neDataService.UDMAuthUser // UDM鉴权信息服务 - neInfoService *neService.NeInfo // 网元信息服务 + udmAuthService *service.UDMAuthUser // UDM鉴权信息服务 + neInfoService *neService.NeInfo // 网元信息服务 } // UDM鉴权用户重载数据 // -// PUT /resetData/:neId +// PUT /reset // -// @Tags ne_data/udm/auth +// @Tags network_data/udm/auth // @Accept json // @Produce json // @Param neId path string true "NE ID" default(001) @@ -47,15 +47,19 @@ type UDMAuthController struct { // @Security TokenAuth // @Summary UDM Authentication User Data Refresh // @Description UDM Authenticated User Data List Refresh Synchronization Latest -// @Router /neData/udm/auth/resetData/{neId} [put] +// @Router /ne/link/udm/auth/reset [put] func (s *UDMAuthController) ResetData(c *gin.Context) { - neId := c.Param("neId") - if neId == "" { - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId is empty")) + var query struct { + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `form:"neUid" binding:"required"` // 网元唯一标识 + } + if err := c.ShouldBindQuery(&query); err != nil { + errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs)) return } - data := s.udmAuthService.ResetData(neId) + data := s.udmAuthService.ResetData(query.CoreUID, query.NeUID) c.JSON(200, resp.OkData(data)) } @@ -63,7 +67,7 @@ func (s *UDMAuthController) ResetData(c *gin.Context) { // // GET /list // -// @Tags ne_data/udm/auth +// @Tags network_data/udm/auth // @Accept json // @Produce json // @Param neId query string true "NE ID" default(001) @@ -74,44 +78,49 @@ func (s *UDMAuthController) ResetData(c *gin.Context) { // @Security TokenAuth // @Summary UDM Authentication User List // @Description UDM Authentication User List -// @Router /neData/udm/auth/list [get] +// @Router /ne/link/udm/auth/list [get] func (s *UDMAuthController) List(c *gin.Context) { query := reqctx.QueryMap(c) - rows, total := s.udmAuthService.FindByPage(query) - c.JSON(200, resp.OkData(map[string]any{"rows": rows, "total": total})) + total, rows := s.udmAuthService.FindByPage(query) + c.JSON(200, resp.OkData(map[string]any{"total": total, "rows": rows})) } // UDM鉴权用户信息 // // GET /:neId/:imsi // -// @Tags ne_data/udm/auth +// @Tags network_data/udm/auth // @Accept json // @Produce json -// @Param neId path string true "NE ID" default(001) -// @Param value path string true "IMSI" +// @Param coreUid query string true "NE ID" default(001) +// @Param neUid query string true "NE ID" default(001) +// @Param imsi query string true "IMSI" // @Success 200 {object} object "Response Results" // @Security TokenAuth // @Summary UDM Authentication User Information // @Description UDM Authentication User Information -// @Router /neData/udm/auth/{neId}/{value} [get] +// @Router /ne/link/udm/auth [get] func (s *UDMAuthController) Info(c *gin.Context) { language := reqctx.AcceptLanguage(c) - neId := c.Param("neId") - imsi := c.Param("imsi") - if neId == "" || imsi == "" { - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId/imsi is empty")) + var query struct { + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `form:"neUid" binding:"required"` // 网元唯一标识 + IMSI string `form:"imsi" binding:"required"` // 网元唯一标识 + } + if err := c.ShouldBindQuery(&query); err != nil { + errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs)) return } - // 查询网元获取IP - neInfo := s.neInfoService.FindByNeTypeAndNeID("UDM", neId) - if neInfo.NeId != neId || neInfo.IP == "" { + // 查询网元信息 + neInfo := s.neInfoService.FindByCoreUidAndNeUid(query.CoreUID, query.NeUID) + if neInfo.CoreUID != query.CoreUID || neInfo.NeUID != query.NeUID || neInfo.NeType != "UDM" { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } // 网元主机的Telnet客户端 - telnetClient, err := s.neInfoService.NeRunTelnetClient("UDM", neId, 1) + telnetClient, err := s.neInfoService.NeRunTelnetClient(neInfo.CoreUID, neInfo.NeUID, 1) if err != nil { c.JSON(200, resp.ErrMsg(err.Error())) return @@ -119,7 +128,7 @@ func (s *UDMAuthController) Info(c *gin.Context) { defer telnetClient.Close() // 发送MML - cmd := fmt.Sprintf("dsp authdat:imsi=%s", imsi) + cmd := fmt.Sprintf("dsp authdat:imsi=%s", query.IMSI) data, err := telnet.ConvertToMap(telnetClient, cmd) if err != nil { c.JSON(200, resp.ErrMsg(err.Error())) @@ -132,16 +141,16 @@ func (s *UDMAuthController) Info(c *gin.Context) { } // 解析返回的数据 - u := s.udmAuthService.ParseInfo(imsi, neId, data) - s.udmAuthService.Insert(neId, u) + u := s.udmAuthService.ParseInfo(neInfo.CoreUID, neInfo.NeUID, query.IMSI, data) + s.udmAuthService.Insert(neInfo.CoreUID, neInfo.NeUID, u) c.JSON(200, resp.OkData(u)) } // UDM鉴权用户新增 // -// POST /:neId +// POST / // -// @Tags ne_data/udm/auth +// @Tags network_data/udm/auth // @Accept json // @Produce json // @Param neId path string true "NE ID" default(001) @@ -150,12 +159,13 @@ func (s *UDMAuthController) Info(c *gin.Context) { // @Security TokenAuth // @Summary UDM Authentication User Added // @Description UDM Authentication User Added -// @Router /neData/udm/auth/{neId} [post] +// @Router /ne/link/udm/auth [post] func (s *UDMAuthController) Add(c *gin.Context) { language := reqctx.AcceptLanguage(c) - neId := c.Param("neId") - if neId == "" { - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId is empty")) + // 传入数量大于0时,为批量新增 + num := parse.Number(c.Query("num")) + if num < 0 { + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: num is empty")) return } @@ -171,19 +181,38 @@ func (s *UDMAuthController) Add(c *gin.Context) { } // 查询网元获取IP - neInfo := s.neInfoService.FindByNeTypeAndNeID("UDM", neId) - if neInfo.NeId != neId || neInfo.IP == "" { + neInfo := s.neInfoService.FindByCoreUidAndNeUid(body.CoreUID, body.NeUID) + if neInfo.CoreUID != body.CoreUID || neInfo.NeUID != body.NeUID || neInfo.NeType != "UDM" { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } // 网元主机的Telnet客户端 - telnetClient, err := s.neInfoService.NeRunTelnetClient("UDM", neId, 1) + telnetClient, err := s.neInfoService.NeRunTelnetClient(neInfo.CoreUID, neInfo.NeUID, 1) if err != nil { c.JSON(200, resp.ErrMsg(err.Error())) return } defer telnetClient.Close() + // 批量新增 + if num > 1 { + // 发送MML + cmd := fmt.Sprintf("baa authdat:start_imsi=%s,sub_num=%d,", body.IMSI, num) + cmd += s.udmAuthService.ParseCommandParams(body) + data, err := telnet.ConvertToStr(telnetClient, cmd) + if err != nil { + c.JSON(200, resp.ErrMsg(err.Error())) + return + } + + // 命令ok时 + if strings.Contains(data, "ok") { + s.udmAuthService.LoadData(neInfo.CoreUID, neInfo.NeUID, body.IMSI, num) + } + c.JSON(200, resp.OkData(data)) + return + } + // 发送MML cmd := fmt.Sprintf("add authdat:imsi=%s,", body.IMSI) cmd += s.udmAuthService.ParseCommandParams(body) @@ -195,81 +224,16 @@ func (s *UDMAuthController) Add(c *gin.Context) { // 命令ok时 if strings.Contains(data, "ok") { - s.udmAuthService.Insert(neId, body) - } - c.JSON(200, resp.OkData(data)) -} - -// UDM鉴权用户批量新增 -// -// POST /:neId/:num -// -// @Tags ne_data/udm/auth -// @Accept json -// @Produce json -// @Param neId path string true "NE ID" default(001) -// @Param value path number true "Number of releases, value includes start imsi" -// @Param data body object true "Request Param" -// @Success 200 {object} object "Response Results" -// @Security TokenAuth -// @Summary UDM Authentication User Batch Add -// @Description UDM Authentication User Batch Add -// @Router /neData/udm/auth/{neId}/{value} [post] -func (s *UDMAuthController) Adds(c *gin.Context) { - language := reqctx.AcceptLanguage(c) - neId := c.Param("neId") - num := c.Param("num") - if neId == "" || num == "" { - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId/num is empty")) - return - } - - var body model.UDMAuthUser - if err := c.ShouldBindBodyWithJSON(&body); err != nil { - errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs)) - return - } - if body.IMSI == "" { - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: imsi is empty")) - return - } - - // 查询网元获取IP - neInfo := s.neInfoService.FindByNeTypeAndNeID("UDM", neId) - if neInfo.NeId != neId || neInfo.IP == "" { - c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) - return - } - // 网元主机的Telnet客户端 - telnetClient, err := s.neInfoService.NeRunTelnetClient("UDM", neId, 1) - if err != nil { - c.JSON(200, resp.ErrMsg(err.Error())) - return - } - defer telnetClient.Close() - - // 发送MML - cmd := fmt.Sprintf("baa authdat:start_imsi=%s,sub_num=%s,", body.IMSI, num) - cmd += s.udmAuthService.ParseCommandParams(body) - data, err := telnet.ConvertToStr(telnetClient, cmd) - if err != nil { - c.JSON(200, resp.ErrMsg(err.Error())) - return - } - - // 命令ok时 - if strings.Contains(data, "ok") { - s.udmAuthService.LoadData(neId, body.IMSI, num) + s.udmAuthService.Insert(neInfo.CoreUID, neInfo.NeUID, body) } c.JSON(200, resp.OkData(data)) } // UDM鉴权用户修改 // -// PUT /:neId +// PUT / // -// @Tags ne_data/udm/auth +// @Tags network_data/udm/auth // @Accept json // @Produce json // @Param neId path string true "NE ID" default(001) @@ -278,15 +242,9 @@ func (s *UDMAuthController) Adds(c *gin.Context) { // @Security TokenAuth // @Summary UDM Authenticated User Modification // @Description UDM Authenticated User Modification -// @Router /neData/udm/auth/{neId} [put] +// @Router /ne/link/udm/auth [put] func (s *UDMAuthController) Edit(c *gin.Context) { language := reqctx.AcceptLanguage(c) - neId := c.Param("neId") - if neId == "" { - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId is empty")) - return - } - var body model.UDMAuthUser if err := c.ShouldBindBodyWithJSON(&body); err != nil { errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) @@ -299,13 +257,13 @@ func (s *UDMAuthController) Edit(c *gin.Context) { } // 查询网元获取IP - neInfo := s.neInfoService.FindByNeTypeAndNeID("UDM", neId) - if neInfo.NeId != neId || neInfo.IP == "" { + neInfo := s.neInfoService.FindByCoreUidAndNeUid(body.CoreUID, body.NeUID) + if neInfo.CoreUID != body.CoreUID || neInfo.NeUID != body.NeUID || neInfo.NeType != "UDM" { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } // 网元主机的Telnet客户端 - telnetClient, err := s.neInfoService.NeRunTelnetClient("UDM", neId, 1) + telnetClient, err := s.neInfoService.NeRunTelnetClient(neInfo.CoreUID, neInfo.NeUID, 1) if err != nil { c.JSON(200, resp.ErrMsg(err.Error())) return @@ -323,7 +281,7 @@ func (s *UDMAuthController) Edit(c *gin.Context) { // 命令ok时 if strings.Contains(data, "ok") { - s.udmAuthService.Insert(neId, body) + s.udmAuthService.Insert(neInfo.CoreUID, neInfo.NeUID, body) } c.JSON(200, resp.OkData(data)) } @@ -332,7 +290,7 @@ func (s *UDMAuthController) Edit(c *gin.Context) { // // DELETE /:neId/:imsi // -// @Tags ne_data/udm/auth +// @Tags network_data/udm/auth // @Accept json // @Produce json // @Param neId path string true "NE ID" default(001) @@ -341,38 +299,59 @@ func (s *UDMAuthController) Edit(c *gin.Context) { // @Security TokenAuth // @Summary UDM Authenticated User Deletion // @Description UDM Authenticated User Deletion -// @Router /neData/udm/auth/{neId}/{value} [delete] +// @Router /ne/link/udm/auth/{neId}/{value} [delete] func (s *UDMAuthController) Remove(c *gin.Context) { language := reqctx.AcceptLanguage(c) - neId := c.Param("neId") - imsi := c.Param("imsi") - if neId == "" || imsi == "" { - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId/imsi is empty")) + var query struct { + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `form:"neUid" binding:"required"` // 网元唯一标识 + IMSI string `form:"imsi" binding:"required"` // IMSi + Num int64 `form:"num"` // 批量数量 + } + if err := c.ShouldBindQuery(&query); err != nil { + errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs)) return } - // 处理字符转id数组后去重 - imsiArr := strings.Split(imsi, ",") - uniqueIDs := parse.RemoveDuplicates(imsiArr) - if len(uniqueIDs) <= 0 { - c.JSON(200, resp.Err(nil)) - return - } - - // 查询网元获取IP - neInfo := s.neInfoService.FindByNeTypeAndNeID("UDM", neId) - if neInfo.NeId != neId || neInfo.IP == "" { + // 查询网元信息 + neInfo := s.neInfoService.FindByCoreUidAndNeUid(query.CoreUID, query.NeUID) + if neInfo.CoreUID != query.CoreUID || neInfo.NeUID != query.NeUID || neInfo.NeType != "UDM" { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } // 网元主机的Telnet客户端 - telnetClient, err := s.neInfoService.NeRunTelnetClient("UDM", neId, 1) + telnetClient, err := s.neInfoService.NeRunTelnetClient(neInfo.CoreUID, neInfo.NeUID, 1) if err != nil { c.JSON(200, resp.ErrMsg(err.Error())) return } defer telnetClient.Close() + if query.Num > 0 { + // 发送MML + cmd := fmt.Sprintf("bde authdat:start_imsi=%s,sub_num=%d", query.IMSI, query.Num) + data, err := telnet.ConvertToStr(telnetClient, cmd) + if err != nil { + c.JSON(200, resp.ErrMsg(err.Error())) + return + } + + // 命令ok时 + if strings.Contains(data, "ok") { + s.udmAuthService.LoadData(neInfo.CoreUID, neInfo.NeUID, query.IMSI, query.Num) + } + c.JSON(200, resp.OkData(data)) + return + } + + // 处理字符转id数组后去重 + imsiArr := strings.Split(query.IMSI, ",") + uniqueIDs := parse.RemoveDuplicates(imsiArr) + if len(uniqueIDs) <= 0 { + c.JSON(200, resp.Err(nil)) + return + } resultData := map[string]string{} for _, imsi := range uniqueIDs { // 发送MML @@ -384,7 +363,7 @@ func (s *UDMAuthController) Remove(c *gin.Context) { } // 命令ok时 if strings.Contains(data, "ok") { - s.udmAuthService.Delete(imsi, neId) + s.udmAuthService.Delete(neInfo.CoreUID, neInfo.NeUID, imsi) } resultData[imsi] = data } @@ -392,65 +371,11 @@ func (s *UDMAuthController) Remove(c *gin.Context) { c.JSON(200, resp.OkData(resultData)) } -// UDM鉴权用户批量删除 -// -// DELETE /:neId/:imsi/:num -// -// @Tags ne_data/udm/auth -// @Accept json -// @Produce json -// @Param neId path string true "NE ID" default(001) -// @Param imsi path string true "IMSI" -// @Param num path number true "Number of releases, value includes start imsi" -// @Success 200 {object} object "Response Results" -// @Security TokenAuth -// @Summary UDM Authentication User Batch Deletion -// @Description UDM Authentication User Batch Deletion -// @Router /neData/udm/auth/{neId}/{imsi}/{num} [delete] -func (s *UDMAuthController) Removes(c *gin.Context) { - language := reqctx.AcceptLanguage(c) - neId := c.Param("neId") - imsi := c.Param("imsi") - num := c.Param("num") - if neId == "" || imsi == "" || num == "" { - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId/imsi/num is empty")) - return - } - - // 查询网元获取IP - neInfo := s.neInfoService.FindByNeTypeAndNeID("UDM", neId) - if neInfo.NeId != neId || neInfo.IP == "" { - c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) - return - } - // 网元主机的Telnet客户端 - telnetClient, err := s.neInfoService.NeRunTelnetClient("UDM", neId, 1) - if err != nil { - c.JSON(200, resp.ErrMsg(err.Error())) - return - } - defer telnetClient.Close() - - // 发送MML - cmd := fmt.Sprintf("bde authdat:start_imsi=%s,sub_num=%s", imsi, num) - data, err := telnet.ConvertToStr(telnetClient, cmd) - if err != nil { - c.JSON(200, resp.ErrMsg(err.Error())) - return - } - - // 命令ok时 - if strings.Contains(data, "ok") { - s.udmAuthService.LoadData(neId, imsi, num) - } - c.JSON(200, resp.OkData(data)) -} - // UDM鉴权用户导出 // // GET /export // -// @Tags ne_data/udm/auth +// @Tags network_data/udm/auth // @Accept json // @Produce json // @Param neId query string true "NE ID" default(001) @@ -462,16 +387,15 @@ func (s *UDMAuthController) Removes(c *gin.Context) { // @Security TokenAuth // @Summary UDM Authenticated User Export // @Description UDM Authenticated User Export -// @Router /neData/udm/auth/export [get] +// @Router /ne/link/udm/auth/export [get] func (s *UDMAuthController) Export(c *gin.Context) { language := reqctx.AcceptLanguage(c) - // 查询结果,根据查询条件结果,单页最大值限制 - neId := c.Query("neId") - fileType := c.Query("type") - if neId == "" { - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId is empty")) + neUid := c.Query("neUid") + if c.Query("coreUid") == "" || neUid == "" { + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: coreUid or neUid is empty")) return } + fileType := c.Query("type") if !(fileType == "csv" || fileType == "txt") { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "ne.udm.errImportUserSubFileFormat"))) return @@ -484,8 +408,6 @@ func (s *UDMAuthController) Export(c *gin.Context) { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.exportEmpty"))) return } - - // rows := s.udmAuthService.SelectList(model.UDMAuthUser{NeId: neId}) if len(rows) <= 0 { // 导出数据记录为空 c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.exportEmpty"))) @@ -493,7 +415,7 @@ func (s *UDMAuthController) Export(c *gin.Context) { } // 文件名 - fileName := fmt.Sprintf("udm_auth_user_export_%s_%d.%s", neId, time.Now().UnixMilli(), fileType) + fileName := fmt.Sprintf("udm_auth_user_export_%s_%d.%s", neUid, time.Now().UnixMilli(), fileType) filePath := filepath.Join(file.ParseUploadFileDir(constants.UPLOAD_EXPORT), fileName) if fileType == "csv" { @@ -538,7 +460,7 @@ func (s *UDMAuthController) Export(c *gin.Context) { // // POST /import // -// @Tags ne_data/udm/auth +// @Tags network_data/udm/auth // @Accept json // @Produce json // @Param data body object true "Request Param" @@ -546,11 +468,12 @@ func (s *UDMAuthController) Export(c *gin.Context) { // @Security TokenAuth // @Summary UDM Authenticated User Import // @Description UDM Authenticated User Import -// @Router /neData/udm/auth/import [post] +// @Router /ne/link/udm/auth/import [post] func (s *UDMAuthController) Import(c *gin.Context) { language := reqctx.AcceptLanguage(c) var body struct { - NeId string `json:"neId" binding:"required"` // 网元ID + CoreUID string `json:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `json:"neUid" binding:"required"` // 网元唯一标识 UploadPath string `json:"uploadPath" binding:"required"` // 上传文件路径 TypeVal string `json:"typeVal" binding:"required,oneof=default k4"` // default: 默认导入方式, k4: k4类型导入方式 TypeData any `json:"typeData"` // k4类型的数据密钥 @@ -567,15 +490,14 @@ func (s *UDMAuthController) Import(c *gin.Context) { return } - // 查询网元获取IP - neInfo := s.neInfoService.FindByNeTypeAndNeID("UDM", body.NeId) - if neInfo.NeId != body.NeId || neInfo.IP == "" { + // 查询网元信息 + neInfo := s.neInfoService.FindByCoreUidAndNeUid(body.CoreUID, body.NeUID) + if neInfo.CoreUID != body.CoreUID || neInfo.NeUID != body.NeUID || neInfo.NeType != "UDM" { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } - // 网元主机的SSH客户端 - sshClient, err := s.neInfoService.NeRunSSHClient(neInfo.NeType, neInfo.NeId) + sshClient, err := s.neInfoService.NeRunSSHClient(neInfo.CoreUID, neInfo.NeUID) if err != nil { c.JSON(200, resp.ErrMsg(err.Error())) return @@ -599,7 +521,7 @@ func (s *UDMAuthController) Import(c *gin.Context) { } // 网元主机的Telnet客户端 - telnetClient, err := s.neInfoService.NeRunTelnetClient(neInfo.NeType, neInfo.NeId, 1) + telnetClient, err := s.neInfoService.NeRunTelnetClient(neInfo.CoreUID, neInfo.NeUID, 1) if err != nil { c.JSON(200, resp.ErrMsg(err.Error())) return @@ -618,7 +540,7 @@ func (s *UDMAuthController) Import(c *gin.Context) { // K4类型发特定请求 if body.TypeVal == "k4" { - resultMsg, resultErr = neFetchlink.UDMImportAuth(neInfo.IP, map[string]any{ + resultMsg, resultErr = neFetchlink.UDMImportAuth(neInfo.IPAddr, map[string]any{ "path": neFilePath, "k4": body.TypeData, }) } @@ -632,11 +554,11 @@ func (s *UDMAuthController) Import(c *gin.Context) { if strings.Contains(resultMsg, "ok") { if strings.HasSuffix(body.UploadPath, ".csv") { data := file.ReadFileCSV(localFilePath) - go s.udmAuthService.InsertData(neInfo.NeId, "csv", data) + go s.udmAuthService.InsertData(neInfo.CoreUID, neInfo.NeUID, "csv", data) } if strings.HasSuffix(body.UploadPath, ".txt") { data := file.ReadFileTXTLine(",", localFilePath) - go s.udmAuthService.InsertData(neInfo.NeId, "txt", data) + go s.udmAuthService.InsertData(neInfo.CoreUID, neInfo.NeUID, "txt", data) } } c.JSON(200, resp.OkMsg(resultMsg)) diff --git a/src/modules/ne_data/controller/udm_sub.go b/src/modules/ne_data/controller/udm_sub.go index 99580be0..4af9a5f2 100644 --- a/src/modules/ne_data/controller/udm_sub.go +++ b/src/modules/ne_data/controller/udm_sub.go @@ -15,14 +15,14 @@ import ( "be.ems/src/framework/utils/parse" neService "be.ems/src/modules/ne/service" "be.ems/src/modules/ne_data/model" - neDataService "be.ems/src/modules/ne_data/service" + "be.ems/src/modules/ne_data/service" "github.com/gin-gonic/gin" ) // 实例化控制层 UDMSubController 结构体 var NewUDMSub = &UDMSubController{ - udmSubService: neDataService.NewUDMSubUser, + udmSubService: service.NewUDMSubUser, neInfoService: neService.NewNeInfo, } @@ -30,15 +30,15 @@ var NewUDMSub = &UDMSubController{ // // PATH /udm/sub type UDMSubController struct { - udmSubService *neDataService.UDMSubUser // UDM签约信息服务 - neInfoService *neService.NeInfo // 网元信息服务 + udmSubService *service.UDMSubUser // UDM签约信息服务 + neInfoService *neService.NeInfo // 网元信息服务 } // UDM签约用户重载数据 // -// PUT /resetData/:neId +// PUT /reset // -// @Tags ne_data/udm/sub +// @Tags network_data/udm/sub // @Accept json // @Produce json // @Param neId path string true "NE ID" default(001) @@ -46,15 +46,19 @@ type UDMSubController struct { // @Security TokenAuth // @Summary UDM Subscriber User Reload Data // @Description UDM Subscriber User Reload Data -// @Router /neData/udm/sub/resetData/{neId} [put] +// @Router /ne/link/udm/sub/reset [put] func (s *UDMSubController) ResetData(c *gin.Context) { - neId := c.Param("neId") - if neId == "" { - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId is empty")) + var query struct { + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `form:"neUid" binding:"required"` // 网元唯一标识 + } + if err := c.ShouldBindQuery(&query); err != nil { + errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs)) return } - data := s.udmSubService.ResetData(neId) + data := s.udmSubService.ResetData(query.CoreUID, query.NeUID) c.JSON(200, resp.OkData(data)) } @@ -62,7 +66,7 @@ func (s *UDMSubController) ResetData(c *gin.Context) { // // GET /list // -// @Tags ne_data/udm/sub +// @Tags network_data/udm/sub // @Accept json // @Produce json // @Param neId query string true "NE ID" default(001) @@ -74,18 +78,18 @@ func (s *UDMSubController) ResetData(c *gin.Context) { // @Security TokenAuth // @Summary UDM Subscriber User List // @Description UDM Subscriber User List -// @Router /neData/udm/sub/list [get] +// @Router /ne/link/udm/sub/list [get] func (s *UDMSubController) List(c *gin.Context) { query := reqctx.QueryMap(c) - rows, total := s.udmSubService.FindByPage(query) - c.JSON(200, resp.OkData(map[string]any{"rows": rows, "total": total})) + total, rows := s.udmSubService.FindByPage(query) + c.JSON(200, resp.OkData(map[string]any{"total": total, "rows": rows})) } // UDM签约用户信息 // -// GET /:neId/:imsi +// GET / // -// @Tags ne_data/udm/sub +// @Tags network_data/udm/sub // @Accept json // @Produce json // @Param neId path string true "NE ID" default(001) @@ -94,24 +98,28 @@ func (s *UDMSubController) List(c *gin.Context) { // @Security TokenAuth // @Summary UDM Subscriber User Information // @Description UDM Subscriber User Information -// @Router /neData/udm/sub/{neId}/{value} [get] +// @Router /ne/link/udm/sub [get] func (s *UDMSubController) Info(c *gin.Context) { language := reqctx.AcceptLanguage(c) - neId := c.Param("neId") - imsi := c.Param("imsi") - if neId == "" || imsi == "" { - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId or imsi is empty")) + var query struct { + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `form:"neUid" binding:"required"` // 网元唯一标识 + IMSI string `form:"imsi" binding:"required"` // 网元唯一标识 + } + if err := c.ShouldBindQuery(&query); err != nil { + errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs)) return } - // 查询网元获取IP - neInfo := s.neInfoService.FindByNeTypeAndNeID("UDM", neId) - if neInfo.NeId != neId || neInfo.IP == "" { + // 查询网元信息 + neInfo := s.neInfoService.FindByCoreUidAndNeUid(query.CoreUID, query.NeUID) + if neInfo.CoreUID != query.CoreUID || neInfo.NeUID != query.NeUID || neInfo.NeType != "UDM" { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } // 网元主机的Telnet客户端 - telnetClient, err := s.neInfoService.NeRunTelnetClient("UDM", neId, 1) + telnetClient, err := s.neInfoService.NeRunTelnetClient(neInfo.CoreUID, neInfo.NeUID, 1) if err != nil { c.JSON(200, resp.ErrMsg(err.Error())) return @@ -119,7 +127,7 @@ func (s *UDMSubController) Info(c *gin.Context) { defer telnetClient.Close() // 发送MML - cmd := fmt.Sprintf("dsp udmuser:imsi=%s", imsi) + cmd := fmt.Sprintf("dsp udmuser:imsi=%s", query.IMSI) data, err := telnet.ConvertToMap(telnetClient, cmd) if err != nil { c.JSON(200, resp.ErrMsg(err.Error())) @@ -132,16 +140,16 @@ func (s *UDMSubController) Info(c *gin.Context) { } // 解析返回的数据 - u := s.udmSubService.ParseInfo(imsi, neId, data) - s.udmSubService.Insert(neId, u) + u := s.udmSubService.ParseInfo(neInfo.CoreUID, neInfo.NeUID, query.IMSI, data) + s.udmSubService.Insert(neInfo.CoreUID, neInfo.NeUID, u) c.JSON(200, resp.OkData(u)) } // UDM签约用户新增 // -// POST /:neId +// POST / // -// @Tags ne_data/udm/sub +// @Tags network_data/udm/sub // @Accept json // @Produce json // @Param neId path string true "NE ID" default(001) @@ -150,12 +158,13 @@ func (s *UDMSubController) Info(c *gin.Context) { // @Security TokenAuth // @Summary UDM Subscriber User Added // @Description UDM Subscriber User Added -// @Router /neData/udm/sub/{neId} [post] +// @Router /ne/link/udm/sub [post] func (s *UDMSubController) Add(c *gin.Context) { language := reqctx.AcceptLanguage(c) - neId := c.Param("neId") - if neId == "" { - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId is empty")) + // 传入数量大于0时,为批量新增 + num := parse.Number(c.Query("num")) + if num < 0 { + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: num is empty")) return } @@ -171,19 +180,41 @@ func (s *UDMSubController) Add(c *gin.Context) { } // 查询网元获取IP - neInfo := s.neInfoService.FindByNeTypeAndNeID("UDM", neId) - if neInfo.NeId != neId || neInfo.IP == "" { + neInfo := s.neInfoService.FindByCoreUidAndNeUid(body.CoreUID, body.NeUID) + if neInfo.CoreUID != body.CoreUID || neInfo.NeUID != body.NeUID || neInfo.NeType != "UDM" { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } // 网元主机的Telnet客户端 - telnetClient, err := s.neInfoService.NeRunTelnetClient("UDM", neId, 1) + telnetClient, err := s.neInfoService.NeRunTelnetClient(neInfo.CoreUID, neInfo.NeUID, 1) if err != nil { c.JSON(200, resp.ErrMsg(err.Error())) return } defer telnetClient.Close() + // 批量新增 + if num > 1 { + // 发送MML + cmd := fmt.Sprintf("baa udmuser:start_imsi=%s,start_msisdn=%s,sub_num=%d,", body.IMSI, body.MSISDN, num) + cmd += s.udmSubService.ParseCommandParams(body) + // 去除msisdn参数,避免重复 + omemsisdn := fmt.Sprintf(",msisdn=%s,", body.MSISDN) + cmd = strings.Replace(cmd, omemsisdn, ",", 1) + data, err := telnet.ConvertToStr(telnetClient, cmd) + if err != nil { + c.JSON(200, resp.ErrMsg(err.Error())) + return + } + + // 命令ok时 + if strings.Contains(data, "ok") { + s.udmSubService.LoadData(neInfo.CoreUID, neInfo.NeUID, body.IMSI, num, body.Remark) + } + c.JSON(200, resp.OkData(data)) + return + } + // 发送MML cmd := fmt.Sprintf("add udmuser:imsi=%s,", body.IMSI) cmd += s.udmSubService.ParseCommandParams(body) @@ -195,85 +226,16 @@ func (s *UDMSubController) Add(c *gin.Context) { // 命令ok时 if strings.Contains(data, "ok") { - body.NeId = neId - s.udmSubService.Insert(neId, body) - } - c.JSON(200, resp.OkData(data)) -} - -// UDM签约用户批量新增 -// -// POST /:neId/:num -// -// @Tags ne_data/udm/sub -// @Accept json -// @Produce json -// @Param neId path string true "NE ID" default(001) -// @Param value path number true "Number of releases, value includes start imsi" default(1) -// @Param data body object true "Request Param" -// @Success 200 {object} object "Response Results" -// @Security TokenAuth -// @Summary UDM Subscriber User Batch Add -// @Description UDM Subscriber User Batch Add -// @Router /neData/udm/sub/{neId}/{value} [post] -func (s *UDMSubController) Adds(c *gin.Context) { - language := reqctx.AcceptLanguage(c) - neId := c.Param("neId") - num := c.Param("num") - if neId == "" || num == "" { - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId/num is empty")) - return - } - - var body model.UDMSubUser - if err := c.ShouldBindBodyWithJSON(&body); err != nil { - errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs)) - return - } - if len(body.IMSI) != 15 { - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: IMSI length is not 15 bits")) - return - } - - // 查询网元获取IP - neInfo := s.neInfoService.FindByNeTypeAndNeID("UDM", neId) - if neInfo.NeId != neId || neInfo.IP == "" { - c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) - return - } - // 网元主机的Telnet客户端 - telnetClient, err := s.neInfoService.NeRunTelnetClient("UDM", neId, 1) - if err != nil { - c.JSON(200, resp.ErrMsg(err.Error())) - return - } - defer telnetClient.Close() - - // 发送MML - cmd := fmt.Sprintf("baa udmuser:start_imsi=%s,start_msisdn=%s,sub_num=%s,", body.IMSI, body.MSISDN, num) - cmd += s.udmSubService.ParseCommandParams(body) - // 去除msisdn参数,避免重复 - omemsisdn := fmt.Sprintf(",msisdn=%s,", body.MSISDN) - cmd = strings.Replace(cmd, omemsisdn, ",", 1) - data, err := telnet.ConvertToStr(telnetClient, cmd) - if err != nil { - c.JSON(200, resp.ErrMsg(err.Error())) - return - } - - // 命令ok时 - if strings.Contains(data, "ok") { - s.udmSubService.LoadData(neId, body.IMSI, num, body.Remark) + s.udmSubService.Insert(neInfo.CoreUID, neInfo.NeUID, body) } c.JSON(200, resp.OkData(data)) } // UDM签约用户修改 // -// PUT /:neId +// PUT / // -// @Tags ne_data/udm/sub +// @Tags network_data/udm/sub // @Accept json // @Produce json // @Param neId path string true "NE ID" default(001) @@ -282,7 +244,7 @@ func (s *UDMSubController) Adds(c *gin.Context) { // @Security TokenAuth // @Summary UDM Subscriber User Modification // @Description UDM Subscriber User Modification -// @Router /neData/udm/sub/{neId} [put] +// @Router /ne/link/udm/sub [put] func (s *UDMSubController) Edit(c *gin.Context) { language := reqctx.AcceptLanguage(c) neId := c.Param("neId") @@ -303,13 +265,13 @@ func (s *UDMSubController) Edit(c *gin.Context) { } // 查询网元获取IP - neInfo := s.neInfoService.FindByNeTypeAndNeID("UDM", neId) - if neInfo.NeId != neId || neInfo.IP == "" { + neInfo := s.neInfoService.FindByCoreUidAndNeUid(body.CoreUID, body.NeUID) + if neInfo.CoreUID != body.CoreUID || neInfo.NeUID != body.NeUID || neInfo.NeType != "UDM" { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } // 网元主机的Telnet客户端 - telnetClient, err := s.neInfoService.NeRunTelnetClient("UDM", neId, 1) + telnetClient, err := s.neInfoService.NeRunTelnetClient(neInfo.CoreUID, neInfo.NeUID, 1) if err != nil { c.JSON(200, resp.ErrMsg(err.Error())) return @@ -327,17 +289,16 @@ func (s *UDMSubController) Edit(c *gin.Context) { // 命令ok时 if strings.Contains(data, "ok") { - body.NeId = neId - s.udmSubService.Insert(neId, body) + s.udmSubService.Insert(neInfo.CoreUID, neInfo.NeUID, body) } c.JSON(200, resp.OkData(data)) } // UDM签约用户删除 // -// DELETE /:neId/:imsi +// DELETE / // -// @Tags ne_data/udm/sub +// @Tags network_data/udm/sub // @Accept json // @Produce json // @Param neId path string true "NE ID" default(001) @@ -346,38 +307,58 @@ func (s *UDMSubController) Edit(c *gin.Context) { // @Security TokenAuth // @Summary UDM Subscriber User Deletion // @Description UDM Subscriber User Deletion -// @Router /neData/udm/sub/{neId}/{value} [delete] +// @Router /ne/link/udm/sub [delete] func (s *UDMSubController) Remove(c *gin.Context) { language := reqctx.AcceptLanguage(c) - neId := c.Param("neId") - imsi := c.Param("imsi") - if neId == "" || len(imsi) < 15 { - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId/imsi is empty")) + var query struct { + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `form:"neUid" binding:"required"` // 网元唯一标识 + IMSI string `form:"imsi" binding:"required"` // IMSi + Num int64 `form:"num"` // 批量数量 + } + if err := c.ShouldBindQuery(&query); err != nil { + errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs)) return } - // 处理字符转id数组后去重 - imsiArr := strings.Split(imsi, ",") - uniqueIDs := parse.RemoveDuplicates(imsiArr) - if len(uniqueIDs) <= 0 { - c.JSON(200, resp.Err(nil)) - return - } - - // 查询网元获取IP - neInfo := s.neInfoService.FindByNeTypeAndNeID("UDM", neId) - if neInfo.NeId != neId || neInfo.IP == "" { + // 查询网元信息 + neInfo := s.neInfoService.FindByCoreUidAndNeUid(query.CoreUID, query.NeUID) + if neInfo.CoreUID != query.CoreUID || neInfo.NeUID != query.NeUID || neInfo.NeType != "UDM" { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } // 网元主机的Telnet客户端 - telnetClient, err := s.neInfoService.NeRunTelnetClient("UDM", neId, 1) + telnetClient, err := s.neInfoService.NeRunTelnetClient(neInfo.CoreUID, neInfo.NeUID, 1) if err != nil { c.JSON(200, resp.ErrMsg(err.Error())) return } defer telnetClient.Close() + if query.Num > 0 { + // 发送MML + cmd := fmt.Sprintf("bde udmuser:start_imsi=%s,sub_num=%d", query.IMSI, query.Num) + data, err := telnet.ConvertToStr(telnetClient, cmd) + if err != nil { + c.JSON(200, resp.ErrMsg(err.Error())) + return + } + + // 命令ok时 + if strings.Contains(data, "ok") { + s.udmSubService.LoadData(neInfo.CoreUID, neInfo.NeUID, query.IMSI, query.Num, "-(Deleted)-") + } + c.JSON(200, resp.OkData(data)) + } + + // 处理字符转id数组后去重 + imsiArr := strings.Split(query.IMSI, ",") + uniqueIDs := parse.RemoveDuplicates(imsiArr) + if len(uniqueIDs) <= 0 { + c.JSON(200, resp.Err(nil)) + return + } resultData := map[string]string{} for _, imsi := range uniqueIDs { // 发送MML @@ -389,7 +370,7 @@ func (s *UDMSubController) Remove(c *gin.Context) { } // 命令ok时 if strings.Contains(data, "ok") { - s.udmSubService.Delete(neId, imsi) + s.udmSubService.Delete(neInfo.CoreUID, neInfo.NeUID, imsi) } resultData[imsi] = data } @@ -397,65 +378,11 @@ func (s *UDMSubController) Remove(c *gin.Context) { c.JSON(200, resp.OkData(resultData)) } -// UDM签约用户批量删除 -// -// DELETE /:neId/:imsi/:num -// -// @Tags ne_data/udm/sub -// @Accept json -// @Produce json -// @Param neId path string true "NE ID" default(001) -// @Param imsi path string true "IMSI" -// @Param num path number true "Number of releases, value includes start imsi" -// @Success 200 {object} object "Response Results" -// @Security TokenAuth -// @Summary UDM Subscriber User Batch Deletion -// @Description UDM Subscriber User Batch Deletion -// @Router /neData/udm/sub/{neId}/{imsi}/{num} [delete] -func (s *UDMSubController) Removes(c *gin.Context) { - language := reqctx.AcceptLanguage(c) - neId := c.Param("neId") - imsi := c.Param("imsi") - num := c.Param("num") - if neId == "" || len(imsi) < 15 || num == "" { - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId/imsi/num is empty")) - return - } - - // 查询网元获取IP - neInfo := s.neInfoService.FindByNeTypeAndNeID("UDM", neId) - if neInfo.NeId != neId || neInfo.IP == "" { - c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) - return - } - // 网元主机的Telnet客户端 - telnetClient, err := s.neInfoService.NeRunTelnetClient("UDM", neId, 1) - if err != nil { - c.JSON(200, resp.ErrMsg(err.Error())) - return - } - defer telnetClient.Close() - - // 发送MML - cmd := fmt.Sprintf("bde udmuser:start_imsi=%s,sub_num=%s", imsi, num) - data, err := telnet.ConvertToStr(telnetClient, cmd) - if err != nil { - c.JSON(200, resp.ErrMsg(err.Error())) - return - } - - // 命令ok时 - if strings.Contains(data, "ok") { - s.udmSubService.LoadData(neId, imsi, num, "-(Deleted)-") - } - c.JSON(200, resp.OkData(data)) -} - // UDM签约用户导出 // // GET /export // -// @Tags ne_data/udm/sub +// @Tags network_data/udm/sub // @Accept json // @Produce json // @Param neId query string true "NE ID" default(001) @@ -468,16 +395,15 @@ func (s *UDMSubController) Removes(c *gin.Context) { // @Security TokenAuth // @Summary UDM Subscriber User Export // @Description UDM Subscriber User Export -// @Router /neData/udm/sub/export [post] +// @Router /ne/link/udm/sub/export [post] func (s *UDMSubController) Export(c *gin.Context) { language := reqctx.AcceptLanguage(c) - // 查询结果,根据查询条件结果,单页最大值限制 - neId := c.Query("neId") - fileType := c.Query("type") - if neId == "" || fileType == "" { - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId or type is empty")) + neUid := c.Query("neUid") + if c.Query("coreUid") == "" || neUid == "" { + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: coreUid or neUid is empty")) return } + fileType := c.Query("type") if !(fileType == "csv" || fileType == "txt") { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "ne.udm.errImportUserSubFileFormat"))) return @@ -490,8 +416,6 @@ func (s *UDMSubController) Export(c *gin.Context) { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.exportEmpty"))) return } - - // rows := s.udmSubService.SelectList(model.UDMSubUser{NeId: neId}) if len(rows) <= 0 { // 导出数据记录为空 c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.exportEmpty"))) @@ -499,7 +423,7 @@ func (s *UDMSubController) Export(c *gin.Context) { } // 文件名 - fileName := fmt.Sprintf("udm_sub_user_export_%s_%d.%s", neId, time.Now().UnixMilli(), fileType) + fileName := fmt.Sprintf("udm_sub_user_export_%s_%d.%s", neUid, time.Now().UnixMilli(), fileType) filePath := filepath.Join(file.ParseUploadFileDir(constants.UPLOAD_EXPORT), fileName) if fileType == "csv" { @@ -538,7 +462,7 @@ func (s *UDMSubController) Export(c *gin.Context) { // // POST /import // -// @Tags ne_data/udm/sub +// @Tags network_data/udm/sub // @Accept json // @Produce json // @Param data body object true "Request Param" @@ -546,11 +470,12 @@ func (s *UDMSubController) Export(c *gin.Context) { // @Security TokenAuth // @Summary UDM Subscriber User Import // @Description UDM Subscriber User Import -// @Router /neData/udm/sub/import [post] +// @Router /ne/link/udm/sub/import [post] func (s *UDMSubController) Import(c *gin.Context) { language := reqctx.AcceptLanguage(c) var body struct { - NeId string `json:"neId" binding:"required"` + CoreUID string `json:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `json:"neUid" binding:"required"` // 网元唯一标识 UploadPath string `json:"uploadPath" binding:"required"` } if err := c.ShouldBindBodyWithJSON(&body); err != nil { @@ -565,15 +490,14 @@ func (s *UDMSubController) Import(c *gin.Context) { return } - // 查询网元获取IP - neInfo := s.neInfoService.FindByNeTypeAndNeID("UDM", body.NeId) - if neInfo.NeId != body.NeId || neInfo.IP == "" { + // 查询网元信息 + neInfo := s.neInfoService.FindByCoreUidAndNeUid(body.CoreUID, body.NeUID) + if neInfo.CoreUID != body.CoreUID || neInfo.NeUID != body.NeUID || neInfo.NeType != "UDM" { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } - // 网元主机的SSH客户端 - sshClient, err := s.neInfoService.NeRunSSHClient(neInfo.NeType, neInfo.NeId) + sshClient, err := s.neInfoService.NeRunSSHClient(neInfo.CoreUID, neInfo.NeUID) if err != nil { c.JSON(200, resp.ErrMsg(err.Error())) return @@ -597,7 +521,7 @@ func (s *UDMSubController) Import(c *gin.Context) { } // 网元主机的Telnet客户端 - telnetClient, err := s.neInfoService.NeRunTelnetClient(neInfo.NeType, neInfo.NeId, 1) + telnetClient, err := s.neInfoService.NeRunTelnetClient(neInfo.CoreUID, neInfo.NeUID, 1) if err != nil { c.JSON(200, resp.ErrMsg(err.Error())) return @@ -616,11 +540,11 @@ func (s *UDMSubController) Import(c *gin.Context) { if strings.Contains(data, "ok") { if strings.HasSuffix(body.UploadPath, ".csv") { data := file.ReadFileCSV(localFilePath) - go s.udmSubService.InsertData(neInfo.NeId, "csv", data) + go s.udmSubService.InsertData(neInfo.CoreUID, neInfo.NeUID, "csv", data) } if strings.HasSuffix(body.UploadPath, ".txt") { data := file.ReadFileTXTLine(",", localFilePath) - go s.udmSubService.InsertData(neInfo.NeId, "txt", data) + go s.udmSubService.InsertData(neInfo.CoreUID, neInfo.NeUID, "txt", data) } } c.JSON(200, resp.OkMsg(data)) diff --git a/src/modules/ne_data/controller/udm_voip.go b/src/modules/ne_data/controller/udm_voip.go index 4d5fba06..b789ecb8 100644 --- a/src/modules/ne_data/controller/udm_voip.go +++ b/src/modules/ne_data/controller/udm_voip.go @@ -15,14 +15,14 @@ import ( "be.ems/src/framework/utils/parse" neService "be.ems/src/modules/ne/service" "be.ems/src/modules/ne_data/model" - neDataService "be.ems/src/modules/ne_data/service" + "be.ems/src/modules/ne_data/service" "github.com/gin-gonic/gin" ) // 实例化控制层 UDMVOIPController 结构体 var NewUDMVOIP = &UDMVOIPController{ - udmVOIPService: neDataService.NewUDMVOIPUser, + udmVOIPService: service.NewUDMVOIPUser, neInfoService: neService.NewNeInfo, } @@ -30,31 +30,36 @@ var NewUDMVOIP = &UDMVOIPController{ // // PATH /udm/voip type UDMVOIPController struct { - udmVOIPService *neDataService.UDMVOIPUser // UDMVOIP信息服务 - neInfoService *neService.NeInfo // 网元信息服务 + udmVOIPService *service.UDMVOIPUser // UDMVOIP信息服务 + neInfoService *neService.NeInfo // 网元信息服务 } // UDMVOIP用户重载数据 // -// PUT /resetData/:neId +// PUT /reset // -// @Tags ne_data/udm/voip +// @Tags network_data/udm/voip // @Accept json // @Produce json -// @Param neId path string true "NE ID" default(001) +// @Param coreUid query string true "CoreUID" default(001) +// @Param neUid query string true "NeUID" default(001) // @Success 200 {object} object "Response Results" // @Security TokenAuth // @Summary UDM VOIP User Data Refresh // @Description UDM VOIP User Data List Refresh Synchronization Latest -// @Router /neData/udm/voip/resetData/{neId} [put] +// @Router /ne/link/udm/voip/reset [put] func (s *UDMVOIPController) ResetData(c *gin.Context) { - neId := c.Param("neId") - if neId == "" { - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId is empty")) + var query struct { + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `form:"neUid" binding:"required"` // 网元唯一标识 + } + if err := c.ShouldBindQuery(&query); err != nil { + errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs)) return } - data := s.udmVOIPService.ResetData(neId) + data := s.udmVOIPService.ResetData(query.CoreUID, query.NeUID) c.JSON(200, resp.OkData(data)) } @@ -62,10 +67,11 @@ func (s *UDMVOIPController) ResetData(c *gin.Context) { // // GET /list // -// @Tags ne_data/udm/voip +// @Tags network_data/udm/voip // @Accept json // @Produce json -// @Param neId query string true "NE ID" default(001) +// @Param coreUid query string true "CoreUID" default(001) +// @Param neUid query string true "NeUID" default(001) // @Param username query string false "User Name" // @Param pageNum query number true "pageNum" default(1) // @Param pageSize query number true "pageSize" default(10) @@ -73,18 +79,18 @@ func (s *UDMVOIPController) ResetData(c *gin.Context) { // @Security TokenAuth // @Summary UDM VOIP User List // @Description UDM VOIP User List -// @Router /neData/udm/voip/list [get] +// @Router /ne/link/udm/voip/list [get] func (s *UDMVOIPController) List(c *gin.Context) { query := reqctx.QueryMap(c) - rows, total := s.udmVOIPService.FindByPage(query) - c.JSON(200, resp.OkData(map[string]any{"rows": rows, "total": total})) + total, rows := s.udmVOIPService.FindByPage(query) + c.JSON(200, resp.OkData(map[string]any{"total": total, "rows": rows})) } // UDMVOIP用户信息 // -// GET /:neId/:username +// GET / // -// @Tags ne_data/udm/voip +// @Tags network_data/udm/voip // @Accept json // @Produce json // @Param neId path string true "NE ID" default(001) @@ -93,24 +99,28 @@ func (s *UDMVOIPController) List(c *gin.Context) { // @Security TokenAuth // @Summary UDM VOIP User Information // @Description UDM VOIP User Information -// @Router /neData/udm/voip/{neId}/{value} [get] +// @Router /ne/link/udm/voip [get] func (s *UDMVOIPController) Info(c *gin.Context) { language := reqctx.AcceptLanguage(c) - neId := c.Param("neId") - username := c.Param("username") - if neId == "" || username == "" { - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId or username is empty")) + var query struct { + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `form:"neUid" binding:"required"` // 网元唯一标识 + UserName string `form:"username" binding:"required"` // 用户名 + } + if err := c.ShouldBindQuery(&query); err != nil { + errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs)) return } - // 查询网元获取IP - neInfo := s.neInfoService.FindByNeTypeAndNeID("UDM", neId) - if neInfo.NeId != neId || neInfo.IP == "" { + // 查询网元信息 + neInfo := s.neInfoService.FindByCoreUidAndNeUid(query.CoreUID, query.NeUID) + if neInfo.CoreUID != query.CoreUID || neInfo.NeUID != query.NeUID || neInfo.NeType != "UDM" { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } // 网元主机的Telnet客户端 - telnetClient, err := s.neInfoService.NeRunTelnetClient("UDM", neId, 1) + telnetClient, err := s.neInfoService.NeRunTelnetClient(neInfo.CoreUID, neInfo.NeUID, 1) if err != nil { c.JSON(200, resp.ErrMsg(err.Error())) return @@ -118,7 +128,7 @@ func (s *UDMVOIPController) Info(c *gin.Context) { defer telnetClient.Close() // 发送MML - cmd := fmt.Sprintf("dsp voip:username=%s", username) + cmd := fmt.Sprintf("dsp voip:username=%s", query.UserName) data, err := telnet.ConvertToMap(telnetClient, cmd) if err != nil { c.JSON(200, resp.ErrMsg(err.Error())) @@ -131,9 +141,9 @@ func (s *UDMVOIPController) Info(c *gin.Context) { } // 解析返回的数据 - u := s.udmVOIPService.ParseInfo(neId, data) - if u.ID != "" { - s.udmVOIPService.Insert(neId, u.UserName) + u := s.udmVOIPService.ParseInfo(neInfo.CoreUID, neInfo.NeUID, data) + if u.ID > 0 { + s.udmVOIPService.Insert(neInfo.CoreUID, neInfo.NeUID, u.UserName) c.JSON(200, resp.OkData(u)) return } @@ -142,9 +152,9 @@ func (s *UDMVOIPController) Info(c *gin.Context) { // UDMVOIP用户新增 // -// POST /:neId +// POST / // -// @Tags ne_data/udm/voip +// @Tags network_data/udm/voip // @Accept json // @Produce json // @Param neId path string true "NE ID" default(001) @@ -153,12 +163,13 @@ func (s *UDMVOIPController) Info(c *gin.Context) { // @Security TokenAuth // @Summary UDM VOIP User Added // @Description UDM VOIP User Added -// @Router /neData/udm/voip/{neId} [post] +// @Router /ne/link/udm/voip [post] func (s *UDMVOIPController) Add(c *gin.Context) { language := reqctx.AcceptLanguage(c) - neId := c.Param("neId") - if neId == "" { - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId is empty")) + // 传入数量大于0时,为批量新增 + num := parse.Number(c.Query("num")) + if num < 1 { + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: num is empty")) return } @@ -173,20 +184,38 @@ func (s *UDMVOIPController) Add(c *gin.Context) { return } - // 查询网元获取IP - neInfo := s.neInfoService.FindByNeTypeAndNeID("UDM", neId) - if neInfo.NeId != neId || neInfo.IP == "" { + // 查询网元信息 + neInfo := s.neInfoService.FindByCoreUidAndNeUid(body.CoreUID, body.NeUID) + if neInfo.CoreUID != body.CoreUID || neInfo.NeUID != body.NeUID || neInfo.NeType != "UDM" { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } // 网元主机的Telnet客户端 - telnetClient, err := s.neInfoService.NeRunTelnetClient("UDM", neId, 1) + telnetClient, err := s.neInfoService.NeRunTelnetClient(neInfo.CoreUID, neInfo.NeUID, 1) if err != nil { c.JSON(200, resp.ErrMsg(err.Error())) return } defer telnetClient.Close() + // 批量新增 + if num > 1 { + // 发送MML + cmd := fmt.Sprintf("baa voip:sub_num=%d,start_username=%s,password=%s", num, body.UserName, body.Password) + data, err := telnet.ConvertToStr(telnetClient, cmd) + if err != nil { + c.JSON(200, resp.ErrMsg(err.Error())) + return + } + + // 命令ok时 + if strings.Contains(data, "ok") { + s.udmVOIPService.LoadData(neInfo.CoreUID, neInfo.NeUID, body.UserName, num) + } + c.JSON(200, resp.OkData(data)) + return + } + // 发送MML cmd := fmt.Sprintf("add voip:username=%s,password=%s", body.UserName, body.Password) data, err := telnet.ConvertToStr(telnetClient, cmd) @@ -197,80 +226,16 @@ func (s *UDMVOIPController) Add(c *gin.Context) { // 命令ok时 if strings.Contains(data, "ok") { - s.udmVOIPService.Insert(neId, body.UserName) - } - c.JSON(200, resp.OkData(data)) -} - -// UDMVOIP用户批量新增 -// -// POST /:neId/:num -// -// @Tags ne_data/udm/voip -// @Accept json -// @Produce json -// @Param neId path string true "NE ID" default(001) -// @Param value path number true "Number of releases, value includes start username" -// @Param data body object true "Request Param" -// @Success 200 {object} object "Response Results" -// @Security TokenAuth -// @Summary UDM VOIP User Batch Add -// @Description UDM VOIP User Batch Add -// @Router /neData/udm/voip/{neId}/{value} [post] -func (s *UDMVOIPController) Adds(c *gin.Context) { - language := reqctx.AcceptLanguage(c) - neId := c.Param("neId") - num := c.Param("num") - if neId == "" || num == "" { - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId or num is empty")) - return - } - - var body model.UDMVOIPUser - if err := c.ShouldBindBodyWithJSON(&body); err != nil { - errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs)) - return - } - if body.UserName == "" { - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: username is empty")) - return - } - - // 查询网元获取IP - neInfo := s.neInfoService.FindByNeTypeAndNeID("UDM", neId) - if neInfo.NeId != neId || neInfo.IP == "" { - c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) - return - } - // 网元主机的Telnet客户端 - telnetClient, err := s.neInfoService.NeRunTelnetClient("UDM", neId, 1) - if err != nil { - c.JSON(200, resp.ErrMsg(err.Error())) - return - } - defer telnetClient.Close() - - // 发送MML - cmd := fmt.Sprintf("baa voip:sub_num=%s,start_username=%s,password=%s", num, body.UserName, body.Password) - data, err := telnet.ConvertToStr(telnetClient, cmd) - if err != nil { - c.JSON(200, resp.ErrMsg(err.Error())) - return - } - - // 命令ok时 - if strings.Contains(data, "ok") { - s.udmVOIPService.LoadData(neId, body.UserName, num) + s.udmVOIPService.Insert(neInfo.CoreUID, neInfo.NeUID, body.UserName) } c.JSON(200, resp.OkData(data)) } // UDMVOIP用户删除 // -// DELETE /:neId/:username +// DELETE / // -// @Tags ne_data/udm/voip +// @Tags network_data/udm/voip // @Accept json // @Produce json // @Param neId path string true "NE ID" default(001) @@ -279,38 +244,59 @@ func (s *UDMVOIPController) Adds(c *gin.Context) { // @Security TokenAuth // @Summary UDM VOIP User Deletion // @Description UDM VOIP User Deletion -// @Router /neData/udm/voip/{neId}/{value} [delete] +// @Router /ne/link/udm/voip [delete] func (s *UDMVOIPController) Remove(c *gin.Context) { language := reqctx.AcceptLanguage(c) - neId := c.Param("neId") - username := c.Param("username") - if neId == "" || username == "" { - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId or username is empty")) + var query struct { + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `form:"neUid" binding:"required"` // 网元唯一标识 + UserName string `form:"username" binding:"required"` // 用户名 + Num int64 `form:"num"` // 批量数量 + } + if err := c.ShouldBindQuery(&query); err != nil { + errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs)) return } - // 处理字符转id数组后去重 - usernameArr := strings.Split(username, ",") - uniqueIDs := parse.RemoveDuplicates(usernameArr) - if len(uniqueIDs) <= 0 { - c.JSON(200, resp.Err(nil)) - return - } - - // 查询网元获取IP - neInfo := s.neInfoService.FindByNeTypeAndNeID("UDM", neId) - if neInfo.NeId != neId || neInfo.IP == "" { + // 查询网元信息 + neInfo := s.neInfoService.FindByCoreUidAndNeUid(query.CoreUID, query.NeUID) + if neInfo.CoreUID != query.CoreUID || neInfo.NeUID != query.NeUID || neInfo.NeType != "UDM" { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } // 网元主机的Telnet客户端 - telnetClient, err := s.neInfoService.NeRunTelnetClient("UDM", neId, 1) + telnetClient, err := s.neInfoService.NeRunTelnetClient(neInfo.CoreUID, neInfo.NeUID, 1) if err != nil { c.JSON(200, resp.ErrMsg(err.Error())) return } defer telnetClient.Close() + if query.Num > 1 { + // 发送MML + cmd := fmt.Sprintf("bde voip:start_username=%s,sub_num=%d", query.UserName, query.Num) + data, err := telnet.ConvertToStr(telnetClient, cmd) + if err != nil { + c.JSON(200, resp.ErrMsg(err.Error())) + return + } + + // 命令ok时 + if strings.Contains(data, "ok") { + s.udmVOIPService.LoadData(neInfo.CoreUID, neInfo.NeUID, query.UserName, query.Num) + } + c.JSON(200, resp.OkData(data)) + return + } + + // 处理字符转id数组后去重 + imsiArr := strings.Split(query.UserName, ",") + uniqueIDs := parse.RemoveDuplicates(imsiArr) + if len(uniqueIDs) <= 0 { + c.JSON(200, resp.Err(nil)) + return + } resultData := map[string]string{} for _, v := range uniqueIDs { // 发送MML @@ -322,7 +308,7 @@ func (s *UDMVOIPController) Remove(c *gin.Context) { } // 命令ok时 if strings.Contains(data, "ok") { - s.udmVOIPService.Delete(v, neId) + s.udmVOIPService.Delete(neInfo.CoreUID, neInfo.NeUID, v) } resultData[v] = data } @@ -330,65 +316,11 @@ func (s *UDMVOIPController) Remove(c *gin.Context) { c.JSON(200, resp.OkData(resultData)) } -// UDMVOIP用户批量删除 -// -// DELETE /:neId/:username/:num -// -// @Tags ne_data/udm/voip -// @Accept json -// @Produce json -// @Param neId path string true "NE ID" default(001) -// @Param username path string true "User Name" -// @Param num path number true "Number of releases, value includes start username" -// @Success 200 {object} object "Response Results" -// @Security TokenAuth -// @Summary UDM VOIP User Batch Deletion -// @Description UDM VOIP User Batch Deletion -// @Router /neData/udm/voip/{neId}/{username}/{num} [delete] -func (s *UDMVOIPController) Removes(c *gin.Context) { - language := reqctx.AcceptLanguage(c) - neId := c.Param("neId") - username := c.Param("username") - num := c.Param("num") - if neId == "" || username == "" || num == "" { - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId/username/num is empty")) - return - } - - // 查询网元获取IP - neInfo := s.neInfoService.FindByNeTypeAndNeID("UDM", neId) - if neInfo.NeId != neId || neInfo.IP == "" { - c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) - return - } - // 网元主机的Telnet客户端 - telnetClient, err := s.neInfoService.NeRunTelnetClient("UDM", neId, 1) - if err != nil { - c.JSON(200, resp.ErrMsg(err.Error())) - return - } - defer telnetClient.Close() - - // 发送MML - cmd := fmt.Sprintf("bde voip:start_username=%s,sub_num=%s", username, num) - data, err := telnet.ConvertToStr(telnetClient, cmd) - if err != nil { - c.JSON(200, resp.ErrMsg(err.Error())) - return - } - - // 命令ok时 - if strings.Contains(data, "ok") { - s.udmVOIPService.LoadData(neId, username, num) - } - c.JSON(200, resp.OkData(data)) -} - // UDMVOIP用户导出 // // GET /export // -// @Tags ne_data/udm/voip +// @Tags network_data/udm/voip // @Accept json // @Produce json // @Param neId query string true "NE ID" default(001) @@ -400,7 +332,7 @@ func (s *UDMVOIPController) Removes(c *gin.Context) { // @Security TokenAuth // @Summary UDM VOIP User Export // @Description UDM VOIP User Export -// @Router /neData/udm/voip/export [get] +// @Router /ne/link/udm/voip/export [get] func (s *UDMVOIPController) Export(c *gin.Context) { language := reqctx.AcceptLanguage(c) // 查询结果,根据查询条件结果,单页最大值限制 @@ -468,7 +400,7 @@ func (s *UDMVOIPController) Export(c *gin.Context) { // // POST /import // -// @Tags ne_data/udm/voip +// @Tags network_data/udm/voip // @Accept json // @Produce json // @Param data body object true "Request Param" @@ -476,11 +408,12 @@ func (s *UDMVOIPController) Export(c *gin.Context) { // @Security TokenAuth // @Summary UDM VOIP User Import // @Description UDM VOIP User Import -// @Router /neData/udm/voip/import [post] +// @Router /ne/link/udm/voip/import [post] func (s *UDMVOIPController) Import(c *gin.Context) { language := reqctx.AcceptLanguage(c) var body struct { - NeId string `json:"neId" binding:"required"` // 网元ID + CoreUID string `json:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `json:"neUid" binding:"required"` // 网元唯一标识 UploadPath string `json:"uploadPath" binding:"required"` // 上传文件路径 } if err := c.ShouldBindBodyWithJSON(&body); err != nil { @@ -495,15 +428,14 @@ func (s *UDMVOIPController) Import(c *gin.Context) { return } - // 查询网元获取IP - neInfo := s.neInfoService.FindByNeTypeAndNeID("UDM", body.NeId) - if neInfo.NeId != body.NeId || neInfo.IP == "" { + // 查询网元信息 + neInfo := s.neInfoService.FindByCoreUidAndNeUid(body.CoreUID, body.NeUID) + if neInfo.CoreUID != body.CoreUID || neInfo.NeUID != body.NeUID || neInfo.NeType != "UDM" { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } - // 网元主机的SSH客户端 - sshClient, err := s.neInfoService.NeRunSSHClient(neInfo.NeType, neInfo.NeId) + sshClient, err := s.neInfoService.NeRunSSHClient(neInfo.CoreUID, neInfo.NeUID) if err != nil { c.JSON(200, resp.ErrMsg(err.Error())) return @@ -527,7 +459,7 @@ func (s *UDMVOIPController) Import(c *gin.Context) { } // 网元主机的Telnet客户端 - telnetClient, err := s.neInfoService.NeRunTelnetClient(neInfo.NeType, neInfo.NeId, 1) + telnetClient, err := s.neInfoService.NeRunTelnetClient(neInfo.CoreUID, neInfo.NeUID, 1) if err != nil { c.JSON(200, resp.ErrMsg(err.Error())) return @@ -550,11 +482,11 @@ func (s *UDMVOIPController) Import(c *gin.Context) { if strings.Contains(resultMsg, "ok") { if strings.HasSuffix(body.UploadPath, ".csv") { data := file.ReadFileCSV(localFilePath) - go s.udmVOIPService.InsertData(neInfo.NeId, "csv", data) + go s.udmVOIPService.InsertData(neInfo.CoreUID, neInfo.NeUID, "csv", data) } if strings.HasSuffix(body.UploadPath, ".txt") { data := file.ReadFileTXTLine(",", localFilePath) - go s.udmVOIPService.InsertData(neInfo.NeId, "txt", data) + go s.udmVOIPService.InsertData(neInfo.CoreUID, neInfo.NeUID, "txt", data) } } c.JSON(200, resp.OkMsg(resultMsg)) diff --git a/src/modules/ne_data/controller/udm_volte_ims.go b/src/modules/ne_data/controller/udm_volte_ims.go index 054283fb..7b2f0159 100644 --- a/src/modules/ne_data/controller/udm_volte_ims.go +++ b/src/modules/ne_data/controller/udm_volte_ims.go @@ -15,14 +15,14 @@ import ( "be.ems/src/framework/utils/parse" neService "be.ems/src/modules/ne/service" "be.ems/src/modules/ne_data/model" - neDataService "be.ems/src/modules/ne_data/service" + "be.ems/src/modules/ne_data/service" "github.com/gin-gonic/gin" ) // 实例化控制层 UDMVolteIMSController 结构体 var NewUDMVolteIMS = &UDMVolteIMSController{ - udmVolteIMSService: neDataService.NewUDMVolteIMSUser, + udmVolteIMSService: service.NewUDMVolteIMSUser, neInfoService: neService.NewNeInfo, } @@ -30,31 +30,36 @@ var NewUDMVolteIMS = &UDMVolteIMSController{ // // PATH /udm/volte-ims type UDMVolteIMSController struct { - udmVolteIMSService *neDataService.UDMVolteIMSUser // UDMVolteIMS信息服务 - neInfoService *neService.NeInfo // 网元信息服务 + udmVolteIMSService *service.UDMVolteIMSUser // UDMVolteIMS信息服务 + neInfoService *neService.NeInfo // 网元信息服务 } // UDMVolteIMS用户重载数据 // -// PUT /resetData/:neId +// PUT /reset // -// @Tags ne_data/udm/volte-ims +// @Tags network_data/udm/volte-ims // @Accept json // @Produce json -// @Param neId path string true "NE ID" default(001) +// @Param coreUid query string true "CoreUID" default(001) +// @Param neUid query string true "NeUID" default(001) // @Success 200 {object} object "Response Results" // @Security TokenAuth // @Summary UDM VolteIMS User Data Refresh // @Description UDM Authenticated User Data List Refresh Synchronization Latest -// @Router /neData/udm/volte-ims/resetData/{neId} [put] +// @Router /ne/link/udm/volte-ims/reset [put] func (s *UDMVolteIMSController) ResetData(c *gin.Context) { - neId := c.Param("neId") - if neId == "" { - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId is empty")) + var query struct { + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `form:"neUid" binding:"required"` // 网元唯一标识 + } + if err := c.ShouldBindQuery(&query); err != nil { + errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs)) return } - data := s.udmVolteIMSService.ResetData(neId) + data := s.udmVolteIMSService.ResetData(query.CoreUID, query.NeUID) c.JSON(200, resp.OkData(data)) } @@ -62,7 +67,7 @@ func (s *UDMVolteIMSController) ResetData(c *gin.Context) { // // GET /list // -// @Tags ne_data/udm/volte-ims +// @Tags network_data/udm/volte-ims // @Accept json // @Produce json // @Param neId query string true "NE ID" default(001) @@ -73,18 +78,18 @@ func (s *UDMVolteIMSController) ResetData(c *gin.Context) { // @Security TokenAuth // @Summary UDM VolteIMS User List // @Description UDM VolteIMS User List -// @Router /neData/udm/volte-ims/list [get] +// @Router /ne/link/udm/volte-ims/list [get] func (s *UDMVolteIMSController) List(c *gin.Context) { query := reqctx.QueryMap(c) - rows, total := s.udmVolteIMSService.FindByPage(query) - c.JSON(200, resp.OkData(map[string]any{"rows": rows, "total": total})) + total, rows := s.udmVolteIMSService.FindByPage(query) + c.JSON(200, resp.OkData(map[string]any{"total": total, "rows": rows})) } // UDMVolteIMS用户信息 // -// GET /:neId/:imsi +// GET / // -// @Tags ne_data/udm/volte-ims +// @Tags network_data/udm/volte-ims // @Accept json // @Produce json // @Param neId path string true "NE ID" default(001) @@ -94,34 +99,30 @@ func (s *UDMVolteIMSController) List(c *gin.Context) { // @Security TokenAuth // @Summary UDM VolteIMS User Information // @Description UDM VolteIMS User Information -// @Router /neData/udm/volte-ims/{neId}/{value} [get] +// @Router /ne/link/udm/volte-ims [get] func (s *UDMVolteIMSController) Info(c *gin.Context) { language := reqctx.AcceptLanguage(c) - neId := c.Param("neId") - imsi := c.Param("imsi") - msisdn := c.Query("msisdn") - volte := c.Query("volte") - if neId == "" || imsi == "" { - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId or imsi is empty")) - return + var query struct { + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `form:"neUid" binding:"required"` // 网元唯一标识 + IMSI string `form:"imsi" binding:"required"` // IMSi + MSISDN string `form:"msisdn" binding:"required"` // MSISDN + Volte string `form:"volte" binding:"required,oneof=0 1"` // Volte } - if msisdn == "" { - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: msisdn is required")) - return - } - if volte == "" || !(volte == "0" || volte == "1") { - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: volte is required")) + if err := c.ShouldBindQuery(&query); err != nil { + errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs)) return } - // 查询网元获取IP - neInfo := s.neInfoService.FindByNeTypeAndNeID("UDM", neId) - if neInfo.NeId != neId || neInfo.IP == "" { + // 查询网元信息 + neInfo := s.neInfoService.FindByCoreUidAndNeUid(query.CoreUID, query.NeUID) + if neInfo.CoreUID != query.CoreUID || neInfo.NeUID != query.NeUID || neInfo.NeType != "UDM" { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } // 网元主机的Telnet客户端 - telnetClient, err := s.neInfoService.NeRunTelnetClient("UDM", neId, 1) + telnetClient, err := s.neInfoService.NeRunTelnetClient(neInfo.CoreUID, neInfo.NeUID, 1) if err != nil { c.JSON(200, resp.ErrMsg(err.Error())) return @@ -129,7 +130,7 @@ func (s *UDMVolteIMSController) Info(c *gin.Context) { defer telnetClient.Close() // 发送MML - cmd := fmt.Sprintf("dsp imsuser:imsi=%s,msisdn=%s,volte=%s", imsi, msisdn, volte) + cmd := fmt.Sprintf("dsp imsuser:imsi=%s,msisdn=%s,volte=%s", query.IMSI, query.MSISDN, query.Volte) data, err := telnet.ConvertToMap(telnetClient, cmd) if err != nil { c.JSON(200, resp.ErrMsg(err.Error())) @@ -142,9 +143,9 @@ func (s *UDMVolteIMSController) Info(c *gin.Context) { } // 解析返回的数据 - u := s.udmVolteIMSService.ParseInfo(neId, data) - if u.ID != "" { - s.udmVolteIMSService.InsertByIMSI(imsi, neId) + u := s.udmVolteIMSService.ParseInfo(neInfo.CoreUID, neInfo.NeUID, data) + if u.ID > 0 { + s.udmVolteIMSService.InsertByIMSI(neInfo.CoreUID, neInfo.NeUID, query.IMSI) c.JSON(200, resp.OkData(u)) return } @@ -153,9 +154,9 @@ func (s *UDMVolteIMSController) Info(c *gin.Context) { // UDMVolteIMS用户新增 // -// POST /:neId +// POST / // -// @Tags ne_data/udm/volte-ims +// @Tags network_data/udm/volte-ims // @Accept json // @Produce json // @Param neId path string true "NE ID" default(001) @@ -164,12 +165,13 @@ func (s *UDMVolteIMSController) Info(c *gin.Context) { // @Security TokenAuth // @Summary UDM VolteIMS User Added // @Description UDM VolteIMS User Added If VoIP tag=0, then MSISDN and IMSI need to be the same. -// @Router /neData/udm/volte-ims/{neId} [post] +// @Router /ne/link/udm/volte-ims [post] func (s *UDMVolteIMSController) Add(c *gin.Context) { language := reqctx.AcceptLanguage(c) - neId := c.Param("neId") - if neId == "" { - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId is empty")) + // 传入数量大于0时,为批量新增 + num := parse.Number(c.Query("num")) + if num < 0 { + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: num is less than 0")) return } @@ -184,22 +186,40 @@ func (s *UDMVolteIMSController) Add(c *gin.Context) { return } - // 查询网元获取IP - neInfo := s.neInfoService.FindByNeTypeAndNeID("UDM", neId) - if neInfo.NeId != neId || neInfo.IP == "" { + // 查询网元信息 + neInfo := s.neInfoService.FindByCoreUidAndNeUid(body.CoreUID, body.NeUID) + if neInfo.CoreUID != body.CoreUID || neInfo.NeUID != body.NeUID || neInfo.NeType != "UDM" { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } // 网元主机的Telnet客户端 - telnetClient, err := s.neInfoService.NeRunTelnetClient("UDM", neId, 1) + telnetClient, err := s.neInfoService.NeRunTelnetClient(neInfo.CoreUID, neInfo.NeUID, 1) if err != nil { c.JSON(200, resp.ErrMsg(err.Error())) return } defer telnetClient.Close() + // 批量新增 + if num > 1 { + // 发送MML + cmd := fmt.Sprintf("baa imsuser:sub_num=%d,start_imsi=%s,start_msisdn=%s,volte=%s,vni=%s", num, body.IMSI, body.MSISDN, body.Tag, body.VNI) + data, err := telnet.ConvertToStr(telnetClient, cmd) + if err != nil { + c.JSON(200, resp.ErrMsg(err.Error())) + return + } + + // 命令ok时 + if strings.Contains(data, "ok") { + s.udmVolteIMSService.LoadData(neInfo.CoreUID, neInfo.NeUID, body.IMSI, num) + } + c.JSON(200, resp.OkData(data)) + return + } + // 检查同IMSI下msisdn是否存在 - hasMsisdns := s.udmVolteIMSService.Find(model.UDMVolteIMSUser{IMSI: body.IMSI, MSISDN: body.MSISDN, NeId: neId}) + hasMsisdns := s.udmVolteIMSService.Find(model.UDMVolteIMSUser{IMSI: body.IMSI, MSISDN: body.MSISDN, NeUID: neInfo.NeUID}) if len(hasMsisdns) > 0 { c.JSON(200, resp.ErrMsg("IMSI and MSISDN already exist")) return @@ -215,217 +235,92 @@ func (s *UDMVolteIMSController) Add(c *gin.Context) { // 命令ok时 if strings.Contains(data, "ok") { - s.udmVolteIMSService.InsertByIMSI(body.IMSI, neId) - } - c.JSON(200, resp.OkData(data)) -} - -// UDMVolteIMS用户批量新增 -// -// POST /:neId/:num -// -// @Tags ne_data/udm/volte-ims -// @Accept json -// @Produce json -// @Param neId path string true "NE ID" default(001) -// @Param value path number true "Number of releases, value includes start imsi" -// @Param data body object true "Request Param" -// @Success 200 {object} object "Response Results" -// @Security TokenAuth -// @Summary UDM VolteIMS User Batch Add -// @Description UDM VolteIMS User Batch Add -// @Router /neData/udm/volte-ims/{neId}/{value} [post] -func (s *UDMVolteIMSController) Adds(c *gin.Context) { - language := reqctx.AcceptLanguage(c) - neId := c.Param("neId") - num := c.Param("num") - if neId == "" || num == "" { - c.JSON(400, resp.CodeMsg(400, i18n.TKey(language, "app.common.err400"))) - return - } - - var body model.UDMVolteIMSUser - if err := c.ShouldBindBodyWithJSON(&body); err != nil { - errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs)) - return - } - if body.IMSI == "" { - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: imsi is empty")) - return - } - - // 查询网元获取IP - neInfo := s.neInfoService.FindByNeTypeAndNeID("UDM", neId) - if neInfo.NeId != neId || neInfo.IP == "" { - c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) - return - } - // 网元主机的Telnet客户端 - telnetClient, err := s.neInfoService.NeRunTelnetClient("UDM", neId, 1) - if err != nil { - c.JSON(200, resp.ErrMsg(err.Error())) - return - } - defer telnetClient.Close() - - // 发送MML - cmd := fmt.Sprintf("baa imsuser:sub_num=%s,start_imsi=%s,start_msisdn=%s,volte=%s,vni=%s", num, body.IMSI, body.MSISDN, body.Tag, body.VNI) - data, err := telnet.ConvertToStr(telnetClient, cmd) - if err != nil { - c.JSON(200, resp.ErrMsg(err.Error())) - return - } - - // 命令ok时 - if strings.Contains(data, "ok") { - s.udmVolteIMSService.LoadData(neId, body.IMSI, num) + s.udmVolteIMSService.InsertByIMSI(neInfo.CoreUID, neInfo.NeUID, body.IMSI) } c.JSON(200, resp.OkData(data)) } // UDMVolteIMS用户删除 // -// DELETE /:neId/:imsi +// DELETE / // -// @Tags ne_data/udm/volte-ims +// @Tags network_data/udm/volte-ims // @Accept json // @Produce json -// @Param neId path string true "NE ID" default(001) -// @Param value path string true "IMSI, multiple separated by a , sign" +// @Param coreUid query string true "CoreUID" default(001) +// @Param neUid query string true "NeUID" default(001) +// @Param imsi query string true "IMSI" +// @Param num query number true "Number of releases, value includes start imsi" // @Param msisdn query string false "MSISDN" // @Success 200 {object} object "Response Results" // @Security TokenAuth -// @Summary UDM Authenticated User Deletion -// @Description UDM Authenticated User Deletion -// @Router /neData/udm/volte-ims/{neId}/{value} [delete] -func (s *UDMVolteIMSController) Remove(c *gin.Context) { - language := reqctx.AcceptLanguage(c) - neId := c.Param("neId") - imsi_msisdn := c.Param("imsi") - volte := c.Query("volte") - if neId == "" || imsi_msisdn == "" { - c.JSON(400, resp.CodeMsg(400, i18n.TKey(language, "app.common.err400"))) - return - } - if volte == "" || !(volte == "0" || volte == "1") { - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: volte is required")) - return - } - - // 查询网元获取IP - neInfo := s.neInfoService.FindByNeTypeAndNeID("UDM", neId) - if neInfo.NeId != neId || neInfo.IP == "" { - c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) - return - } - // 网元主机的Telnet客户端 - telnetClient, err := s.neInfoService.NeRunTelnetClient("UDM", neId, 1) - if err != nil { - c.JSON(200, resp.ErrMsg(err.Error())) - return - } - defer telnetClient.Close() - - imsiArr := strings.Split(imsi_msisdn, ",") - // 处理字符转id数组后去重 - uniqueIDs := parse.RemoveDuplicates(imsiArr) - if len(uniqueIDs) <= 0 { - c.JSON(200, resp.Err(nil)) - return - } - resultData := map[string]string{} - for _, im := range uniqueIDs { - imArr := strings.SplitN(im, "_", 2) - if len(imArr) != 2 { - resultData[im] = "format should be imsi_msisdn" - continue - } - // 发送MML - cmd := fmt.Sprintf("del imsuser:imsi=%s,msisdn=%s,volte=%s", imArr[0], imArr[1], volte) - data, err := telnet.ConvertToStr(telnetClient, cmd) - if err != nil { - resultData[im] = err.Error() - continue - } - // 命令ok时 - if strings.Contains(data, "ok") { - s.udmVolteIMSService.Delete(imArr[0], neId) - } - resultData[im] = data - } - c.JSON(200, resp.OkData(resultData)) -} - -// UDMVolteIMS用户批量删除 -// -// DELETE /:neId/:imsi/:num -// -// @Tags ne_data/udm/volte-ims -// @Accept json -// @Produce json -// @Param neId path string true "NE ID" default(001) -// @Param imsi path string true "IMSI" -// @Param num path number true "Number of releases, value includes start imsi" -// @Success 200 {object} object "Response Results" -// @Security TokenAuth // @Summary UDM VolteIMS User Batch Deletion // @Description UDM VolteIMS User Batch Deletion -// @Router /neData/udm/volte-ims/{neId}/{imsi}/{num} [delete] -func (s *UDMVolteIMSController) Removes(c *gin.Context) { +// @Router /ne/link/udm/volte-ims [delete] +func (s *UDMVolteIMSController) Remove(c *gin.Context) { language := reqctx.AcceptLanguage(c) - neId := c.Param("neId") - imsi_msisdn := c.Param("imsi") - num := c.Param("num") - volte := c.Query("volte") - if neId == "" || imsi_msisdn == "" || num == "" { - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId/imsi/num is empty")) - return + var query struct { + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `form:"neUid" binding:"required"` // 网元唯一标识 + IMSI string `form:"imsi" binding:"required"` // IMSi, 带数量时为批量 + MSISDN string `form:"msisdn" binding:"required"` // MSISDN, 带数量时为批量 + Volte string `form:"volte" binding:"required,oneof=0 1"` // volte + Num int64 `form:"num"` // 批量数量 } - if volte == "" || !(volte == "0" || volte == "1") { - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: volte is required")) + if err := c.ShouldBindQuery(&query); err != nil { + errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs)) return } - // 查询网元获取IP - neInfo := s.neInfoService.FindByNeTypeAndNeID("UDM", neId) - if neInfo.NeId != neId || neInfo.IP == "" { + // 查询网元信息 + neInfo := s.neInfoService.FindByCoreUidAndNeUid(query.CoreUID, query.NeUID) + if neInfo.CoreUID != query.CoreUID || neInfo.NeUID != query.NeUID || neInfo.NeType != "UDM" { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } // 网元主机的Telnet客户端 - telnetClient, err := s.neInfoService.NeRunTelnetClient("UDM", neId, 1) + telnetClient, err := s.neInfoService.NeRunTelnetClient(neInfo.CoreUID, neInfo.NeUID, 1) if err != nil { c.JSON(200, resp.ErrMsg(err.Error())) return } defer telnetClient.Close() - imArr := strings.SplitN(imsi_msisdn, "_", 2) - if len(imArr) != 2 { - c.JSON(200, resp.ErrMsg("format should be imsi_msisdn")) + // 批量更新 + if query.Num > 1 { + // 发送MML + cmd := "" + if query.Volte == "0" { + cmd = fmt.Sprintf("bde imsuser:start_msisdn=%s,sub_num=%d,volte=0", query.MSISDN, query.Num) + } + if query.Volte == "1" { + cmd = fmt.Sprintf("bde imsuser:start_imsi=%s,start_msisdn=%s,sub_num=%d,volte=1", query.IMSI, query.MSISDN, query.Num) + } + data, err := telnet.ConvertToStr(telnetClient, cmd) + if err != nil { + c.JSON(200, resp.ErrMsg(err.Error())) + return + } + + // 命令ok时 + if strings.Contains(data, "ok") { + s.udmVolteIMSService.LoadData(neInfo.CoreUID, neInfo.NeUID, query.IMSI, query.Num) + } + c.JSON(200, resp.OkData(data)) return } - imsi := imArr[0] - msisdn := imArr[1] // 发送MML - cmd := "" - if volte == "0" { - cmd = fmt.Sprintf("bde imsuser:start_msisdn=%s,sub_num=%s,volte=0", msisdn, num) - } - if volte == "1" { - cmd = fmt.Sprintf("bde imsuser:start_imsi=%s,start_msisdn=%s,sub_num=%s,volte=1", imsi, msisdn, num) - } + cmd := fmt.Sprintf("del imsuser:imsi=%s,msisdn=%s,volte=%s", query.IMSI, query.MSISDN, query.Volte) data, err := telnet.ConvertToStr(telnetClient, cmd) if err != nil { c.JSON(200, resp.ErrMsg(err.Error())) return } - // 命令ok时 if strings.Contains(data, "ok") { - s.udmVolteIMSService.LoadData(neId, imsi, num) + s.udmVolteIMSService.Delete(neInfo.CoreUID, neInfo.NeUID, query.IMSI) } c.JSON(200, resp.OkData(data)) } @@ -434,10 +329,11 @@ func (s *UDMVolteIMSController) Removes(c *gin.Context) { // // GET /export // -// @Tags ne_data/udm/volte-ims +// @Tags network_data/udm/volte-ims // @Accept json // @Produce json -// @Param neId query string true "NE ID" default(001) +// @Param coreUid query string true "CoreUID" default(001) +// @Param neUid query string true "NeUID" default(001) // @Param type query string true "File Type" Enums(csv,txt) default(txt) // @Param imsi query string false "IMSI" // @Param pageNum query number true "pageNum" default(1) @@ -446,16 +342,15 @@ func (s *UDMVolteIMSController) Removes(c *gin.Context) { // @Security TokenAuth // @Summary UDM Authenticated User Export // @Description UDM Authenticated User Export -// @Router /neData/udm/volte-ims/export [get] +// @Router /ne/link/udm/volte-ims/export [get] func (s *UDMVolteIMSController) Export(c *gin.Context) { language := reqctx.AcceptLanguage(c) - // 查询结果,根据查询条件结果,单页最大值限制 - neId := c.Query("neId") - fileType := c.Query("type") - if neId == "" { - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId is empty")) + neUid := c.Query("neUid") + if c.Query("coreUid") == "" || neUid == "" { + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: coreUid or neUid is empty")) return } + fileType := c.Query("type") if !(fileType == "csv" || fileType == "txt") { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "ne.udm.errImportUserSubFileFormat"))) return @@ -475,7 +370,7 @@ func (s *UDMVolteIMSController) Export(c *gin.Context) { } // 文件名 - fileName := fmt.Sprintf("udm_volte_user_export_%s_%d.%s", neId, time.Now().UnixMilli(), fileType) + fileName := fmt.Sprintf("udm_volte_user_export_%s_%d.%s", neUid, time.Now().UnixMilli(), fileType) filePath := filepath.Join(file.ParseUploadFileDir(constants.UPLOAD_EXPORT), fileName) if fileType == "csv" { @@ -512,7 +407,7 @@ func (s *UDMVolteIMSController) Export(c *gin.Context) { // // POST /import // -// @Tags ne_data/udm/volte-ims +// @Tags network_data/udm/volte-ims // @Accept json // @Produce json // @Param data body object true "Request Param" @@ -520,11 +415,12 @@ func (s *UDMVolteIMSController) Export(c *gin.Context) { // @Security TokenAuth // @Summary UDM Authenticated User Import // @Description UDM Authenticated User Import -// @Router /neData/udm/volte-ims/import [post] +// @Router /ne/link/udm/volte-ims/import [post] func (s *UDMVolteIMSController) Import(c *gin.Context) { language := reqctx.AcceptLanguage(c) var body struct { - NeId string `json:"neId" binding:"required"` // 网元ID + CoreUID string `json:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `json:"neUid" binding:"required"` // 网元唯一标识 UploadPath string `json:"uploadPath" binding:"required"` // 上传文件路径 } if err := c.ShouldBindBodyWithJSON(&body); err != nil { @@ -539,15 +435,14 @@ func (s *UDMVolteIMSController) Import(c *gin.Context) { return } - // 查询网元获取IP - neInfo := s.neInfoService.FindByNeTypeAndNeID("UDM", body.NeId) - if neInfo.NeId != body.NeId || neInfo.IP == "" { + // 查询网元信息 + neInfo := s.neInfoService.FindByCoreUidAndNeUid(body.CoreUID, body.NeUID) + if neInfo.CoreUID != body.CoreUID || neInfo.NeUID != body.NeUID || neInfo.NeType != "UDM" { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } - // 网元主机的SSH客户端 - sshClient, err := s.neInfoService.NeRunSSHClient(neInfo.NeType, neInfo.NeId) + sshClient, err := s.neInfoService.NeRunSSHClient(neInfo.CoreUID, neInfo.NeUID) if err != nil { c.JSON(200, resp.ErrMsg(err.Error())) return @@ -571,7 +466,7 @@ func (s *UDMVolteIMSController) Import(c *gin.Context) { } // 网元主机的Telnet客户端 - telnetClient, err := s.neInfoService.NeRunTelnetClient(neInfo.NeType, neInfo.NeId, 1) + telnetClient, err := s.neInfoService.NeRunTelnetClient(neInfo.CoreUID, neInfo.NeUID, 1) if err != nil { c.JSON(200, resp.ErrMsg(err.Error())) return @@ -594,11 +489,11 @@ func (s *UDMVolteIMSController) Import(c *gin.Context) { if strings.Contains(resultMsg, "ok") { if strings.HasSuffix(body.UploadPath, ".csv") { data := file.ReadFileCSV(localFilePath) - go s.udmVolteIMSService.InsertData(neInfo.NeId, "csv", data) + go s.udmVolteIMSService.InsertData(neInfo.CoreUID, neInfo.NeUID, "csv", data) } if strings.HasSuffix(body.UploadPath, ".txt") { data := file.ReadFileTXTLine(",", localFilePath) - go s.udmVolteIMSService.InsertData(neInfo.NeId, "txt", data) + go s.udmVolteIMSService.InsertData(neInfo.CoreUID, neInfo.NeUID, "txt", data) } } c.JSON(200, resp.OkMsg(resultMsg)) diff --git a/src/modules/ne_data/controller/upf.go b/src/modules/ne_data/controller/upf.go index 57bf60e5..40e81a4c 100644 --- a/src/modules/ne_data/controller/upf.go +++ b/src/modules/ne_data/controller/upf.go @@ -31,7 +31,7 @@ type UPFController struct { // // GET /flow-total // -// @Tags ne_data/upf +// @Tags network_data/upf // @Accept json // @Produce json // @Param neId query string true "NE ID" default(001) @@ -40,26 +40,32 @@ type UPFController struct { // @Security TokenAuth // @Summary Total number of flows N3 upstream N6 downstream // @Description Total number of flows N3 upstream N6 downstream -// @Router /neData/upf/flow-total [get] +// @Router /ne/link/upf/flow-total [get] func (s UPFController) FlowTotal(c *gin.Context) { language := reqctx.AcceptLanguage(c) var querys struct { - NeID string `form:"neId" binding:"required"` - Day int `form:"day"` + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `form:"neUid" binding:"required"` // 网元唯一标识 + Day int `form:"day"` } - if err := c.ShouldBindQuery(&querys); querys.Day < 0 || err != nil { + if err := c.ShouldBindQuery(&querys); err != nil { errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs)) return } + if querys.Day < 0 || querys.Day > 30 { + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "day must be between 0 and 30")) + return + } + // 查询网元获取IP - neInfo := s.neInfoService.FindByNeTypeAndNeID("UPF", querys.NeID) - if neInfo.NeId != querys.NeID || neInfo.IP == "" { + neInfo := s.neInfoService.FindByCoreUidAndNeUid(querys.CoreUID, querys.NeUID) + if neInfo.CoreUID != querys.CoreUID || neInfo.NeUID != querys.NeUID { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } - up, down := s.kpiReportService.UPFTodayFlowFind(neInfo.RmUID, querys.Day) + up, down := s.kpiReportService.UPFTodayFlowFind(neInfo.NeUID, querys.Day) c.JSON(200, resp.OkData(map[string]int64{"up": up, "down": down})) } diff --git a/src/modules/ne_data/model/alarm.go b/src/modules/ne_data/model/alarm.go index d0a2e104..822aab93 100644 --- a/src/modules/ne_data/model/alarm.go +++ b/src/modules/ne_data/model/alarm.go @@ -3,11 +3,9 @@ package model // Alarm 告警记录 type Alarm struct { ID int64 `json:"id" gorm:"column:id;primaryKey;autoIncrement"` + CoreUID string `json:"coreUid" gorm:"column:core_uid"` // 核心网唯一标识 + NeUID string `json:"neUid" gorm:"column:ne_uid"` // 网元唯一标识 NeType string `json:"neType" gorm:"column:ne_type"` // 网元类型 - NeId string `json:"neId" gorm:"column:ne_id"` // 网元ID - NeName string `json:"neName" gorm:"column:ne_name"` // 网元名称 - Province string `json:"province" gorm:"column:province"` // 网元省份地域 - PvFlag string `json:"pvFlag" gorm:"column:pv_flag"` // 网元标识虚拟化标识 AlarmSeq int64 `json:"alarmSeq" gorm:"column:alarm_seq"` // 告警序号 连续递增 AlarmId string `json:"alarmId" gorm:"column:alarm_id"` // 告警ID AlarmTitle string `json:"alarmTitle" gorm:"column:alarm_title"` // 告警标题 @@ -30,7 +28,7 @@ type Alarm struct { ClearType string `json:"clearType" gorm:"column:clear_type"` // 清除状态 ClearTime int64 `json:"clearTime" gorm:"column:clear_time"` // 清除时间 ClearUser string `json:"clearUser" gorm:"column:clear_user"` // 清除用户 - Timestamp int64 `json:"timestamp" gorm:"column:timestamp"` // 创建时间 + CreatedAt int64 `json:"createdAt" gorm:"column:created_at"` // 记录创建存储毫秒 } // TableName 表名称 @@ -40,10 +38,9 @@ func (*Alarm) TableName() string { // AlarmQuery 告警数据查询参数结构体 type AlarmQuery struct { - NeType string `json:"neType" form:"neType"` // 网元类型 - NeID string `json:"neId" form:"neId"` // 网元ID - NeName string `json:"neName" form:"neName"` - PvFlag string `json:"pvFlag" form:"pvFlag"` + CoreUID string `json:"coreUid" form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `json:"neUid" form:"neUid"` // 网元唯一标识 + NeType string `json:"neType" form:"neType"` // 网元类型 AlarmCode string `json:"alarmCode" form:"alarmCode"` AlarmType string `json:"alarmType" form:"alarmType"` AlarmStatus string `json:"alarmStatus" form:"alarmStatus" binding:"omitempty,oneof=Clear Active"` // 告警状态 diff --git a/src/modules/ne_data/model/alarm_event.go b/src/modules/ne_data/model/alarm_event.go index d157f0e3..61657cd7 100644 --- a/src/modules/ne_data/model/alarm_event.go +++ b/src/modules/ne_data/model/alarm_event.go @@ -3,9 +3,10 @@ package model // AlarmEvent 告警_事件记录表 type AlarmEvent struct { ID int64 `json:"id" gorm:"column:id;primaryKey;autoIncrement"` + CoreUID string `json:"coreUid" gorm:"column:core_uid"` // 核心网唯一标识 + NeUID string `json:"neUid" gorm:"column:ne_uid"` // 网元唯一标识 NeType string `json:"neType" gorm:"column:ne_type"` // 网元类型 - NeId string `json:"neId" gorm:"column:ne_id"` // 网元ID - AlarmSeq int64 `json:"alarmSeq" gorm:"column:alarm_seq"` // 告警序号 同网元类型连续递增 + AlarmSeq int64 `json:"alarmSeq" gorm:"column:alarm_seq"` // 告警序号 连续递增 AlarmId string `json:"alarmId" gorm:"column:alarm_id"` // 告警ID AlarmTitle string `json:"alarmTitle" gorm:"column:alarm_title"` // 告警标题 AlarmCode int64 `json:"alarmCode" gorm:"column:alarm_code"` // 告警状态码 @@ -21,7 +22,7 @@ type AlarmEvent struct { ClearType string `json:"clearType" gorm:"column:clear_type"` // 清除状态 ClearTime int64 `json:"clearTime" gorm:"column:clear_time"` // 清除时间 ClearUser string `json:"clearUser" gorm:"column:clear_user"` // 清除用户 - Timestamp int64 `json:"timestamp" gorm:"column:timestamp"` // 创建时间 + CreatedAt int64 `json:"createdAt" gorm:"column:created_at"` // 记录创建存储毫秒 } // TableName 表名称 @@ -31,8 +32,9 @@ func (*AlarmEvent) TableName() string { // AlarmEventQuery 告警事件数据查询参数结构体 type AlarmEventQuery struct { - NeType string `json:"neType" form:"neType"` // 网元类型 - NeID string `json:"neId" form:"neId"` // 网元ID + CoreUID string `json:"coreUid" form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `json:"neUid" form:"neUid"` // 网元唯一标识 + NeType string `json:"neType" form:"neType"` // 网元类型 AlarmCode string `json:"alarmCode" form:"alarmCode"` AlarmStatus string `json:"alarmStatus" form:"alarmStatus" binding:"omitempty,oneof=Clear Active"` // 告警状态 BeginTime int64 `json:"beginTime" form:"beginTime"` // 开始时间 查event_time diff --git a/src/modules/ne_data/model/alarm_forward_log.go b/src/modules/ne_data/model/alarm_forward_log.go index 93e9bb11..28ec4d7d 100644 --- a/src/modules/ne_data/model/alarm_forward_log.go +++ b/src/modules/ne_data/model/alarm_forward_log.go @@ -3,8 +3,9 @@ package model // AlarmForwardLog 告警_转发日志记录 type AlarmForwardLog struct { ID int64 `json:"id" gorm:"column:id;primaryKey;autoIncrement"` - NeType string `json:"neType" gorm:"column:ne_type"` - NeId string `json:"neId" gorm:"column:ne_id"` + CoreUID string `json:"coreUid" gorm:"column:core_uid"` // 核心网唯一标识 + NeUID string `json:"neUid" gorm:"column:ne_uid"` // 网元唯一标识 + NeType string `json:"neType" gorm:"column:ne_type"` // 网元类型 AlarmSeq int64 `json:"alarmSeq" gorm:"column:alarm_seq"` // 告警序号 连续递增 AlarmId string `json:"alarmId" gorm:"column:alarm_id"` // 告警ID AlarmCode int64 `json:"alarmCode" gorm:"column:alarm_code"` // 告警状态码 @@ -26,9 +27,10 @@ func (*AlarmForwardLog) TableName() string { // AlarmForwardLogQuery 告警转发日志数据查询参数结构体 type AlarmForwardLogQuery struct { - NeType string `json:"neType" form:"neType"` // 网元类型 - NeID string `json:"neId" form:"neId"` // 网元ID - BeginTime int64 `json:"beginTime" form:"beginTime"` // 开始时间 + CoreUID string `json:"coreUid" form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `json:"neUid" form:"neUid"` // 网元唯一标识 + NeType string `json:"neType" form:"neType"` // 网元类型 + BeginTime int64 `json:"beginTime" form:"beginTime"` // 开始时间 EndTime int64 `json:"endTime" form:"endTime"` SortField string `json:"sortField" form:"sortField" binding:"omitempty,oneof=event_time id"` // 排序字段,填写结果字段 SortOrder string `json:"sortOrder" form:"sortOrder" binding:"omitempty,oneof=asc desc"` // 排序升降序,asc desc diff --git a/src/modules/ne_data/model/alarm_log.go b/src/modules/ne_data/model/alarm_log.go index 841308bd..6ae25738 100644 --- a/src/modules/ne_data/model/alarm_log.go +++ b/src/modules/ne_data/model/alarm_log.go @@ -3,8 +3,9 @@ package model // AlarmLog 告警_日志记录 type AlarmLog struct { ID int64 `json:"id" gorm:"column:id;primaryKey;autoIncrement"` - NeType string `json:"neType" gorm:"column:ne_type"` - NeId string `json:"neId" gorm:"column:ne_id"` + CoreUID string `json:"coreUid" gorm:"column:core_uid"` // 核心网唯一标识 + NeUID string `json:"neUid" gorm:"column:ne_uid"` // 网元唯一标识 + NeType string `json:"neType" gorm:"column:ne_type"` // 网元类型 AlarmSeq int64 `json:"alarmSeq" gorm:"column:alarm_seq"` // 告警序号 连续递增 AlarmId string `json:"alarmId" gorm:"column:alarm_id"` // 告警ID AlarmCode int64 `json:"alarmCode" gorm:"column:alarm_code"` // 告警状态码 @@ -23,8 +24,9 @@ func (*AlarmLog) TableName() string { // AlarmLogQuery 告警日志数据查询参数结构体 type AlarmLogQuery struct { + CoreUID string `json:"coreUid" form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `json:"neUid" form:"neUid"` // 网元唯一标识 NeType string `json:"neType" form:"neType"` // 网元类型 - NeID string `json:"neId" form:"neId"` // 网元ID AlarmStatus string `json:"alarmStatus" form:"alarmStatus" binding:"omitempty,oneof=Clear Active"` // 告警状态 OrigSeverity string `json:"origSeverity" form:"origSeverity"` // 告警类型 BeginTime int64 `json:"beginTime" form:"beginTime"` // 开始时间 查event_time diff --git a/src/modules/ne_data/model/cdr_event.go b/src/modules/ne_data/model/cdr_event.go index 8b713d13..7e330280 100644 --- a/src/modules/ne_data/model/cdr_event.go +++ b/src/modules/ne_data/model/cdr_event.go @@ -3,9 +3,9 @@ package model // CDREvent CDR会话对象 cdr_event type CDREvent struct { ID int64 `json:"id" gorm:"column:id;primaryKey;autoIncrement"` - NeType string `json:"neType" gorm:"column:ne_type"` - NeName string `json:"neName" gorm:"column:ne_name"` - RmUid string `json:"rmUid" gorm:"column:rm_uid"` // 可能没有 + CoreUID string `json:"coreUid" gorm:"column:core_uid"` // 核心网唯一标识 + NeUID string `json:"neUid" gorm:"column:ne_uid"` // 网元唯一标识 + NeType string `json:"neType" gorm:"column:ne_type"` // 网元类型 Timestamp int64 `json:"timestamp" gorm:"column:timestamp"` // 接收到的timestamp秒级存储毫秒时间戳 CdrJson string `json:"cdrJSON" gorm:"column:cdr_json"` // data JSON String CreatedAt int64 `json:"createdAt" gorm:"column:created_at"` // 记录创建存储毫秒 diff --git a/src/modules/ne_data/model/kpi_c_report.go b/src/modules/ne_data/model/kpi_c_report.go index 9cd6aedf..7d0516ac 100644 --- a/src/modules/ne_data/model/kpi_c_report.go +++ b/src/modules/ne_data/model/kpi_c_report.go @@ -22,9 +22,9 @@ func (*KpiCTitle) TableName() string { // KpiCReport 自定义指标报表信息对象 type KpiCReport struct { ID int64 `json:"id" gorm:"column:id;primaryKey;autoIncrement"` - NeType string `json:"neType" gorm:"column:ne_type"` - NeName string `json:"neName" gorm:"column:ne_name"` - RmUid string `json:"rmUid" gorm:"column:rm_uid"` + CoreUID string `json:"coreUid" gorm:"column:core_uid"` // 核心网唯一标识 + NeUID string `json:"neUid" gorm:"column:ne_uid"` // 网元唯一标识 + NeType string `json:"neType" gorm:"column:ne_type"` // 网元类型 Date string `json:"date" gorm:"column:date"` // Date of the report yyyy-mm-dd hh:mi:ss StartTime string `json:"startTime" gorm:"column:start_time"` // Start time of the report hh:mi:ss EndTime string `json:"endTime" gorm:"column:end_time"` // End time of the report hh:mi:ss @@ -41,10 +41,11 @@ func (*KpiCReport) TableName() string { // KPICQuery 指标查询参数结构体 type KPICQuery struct { - NeType string `form:"neType" binding:"required"` - NeID string `form:"neId" binding:"required"` - BeginTime int64 `form:"beginTime" binding:"required"` // 开始时间戳(毫秒)1739361200999 - EndTime int64 `form:"endTime" binding:"required"` // 结束时间戳(毫秒)1739361210088 + CoreUID string `json:"coreUid" form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `json:"neUid" form:"neUid" binding:"required"` // 网元唯一标识 + NeType string `json:"neType" form:"neType" binding:"required"` // 网元类型 + BeginTime int64 `form:"beginTime" binding:"required"` // 开始时间戳(毫秒)1739361200999 + EndTime int64 `form:"endTime" binding:"required"` // 结束时间戳(毫秒)1739361210088 Interval int64 `form:"interval" binding:"required,oneof=5 60 300 900 1800 3600"` RmUID string `form:"rmUID"` SortField string `form:"sortField" binding:"omitempty,oneof=timeGroup"` diff --git a/src/modules/ne_data/model/kpi_report.go b/src/modules/ne_data/model/kpi_report.go index 0e75cf7e..910b1b64 100644 --- a/src/modules/ne_data/model/kpi_report.go +++ b/src/modules/ne_data/model/kpi_report.go @@ -19,9 +19,9 @@ func (*KpiTitle) TableName() string { // KpiReport 指标报表信息对象 type KpiReport struct { ID int64 `json:"id" gorm:"column:id;primaryKey;autoIncrement"` - NeType string `json:"neType" gorm:"column:ne_type"` - NeName string `json:"neName" gorm:"column:ne_name"` - RmUid string `json:"rmUid" gorm:"column:rm_uid"` + CoreUID string `json:"coreUid" gorm:"column:core_uid"` // 核心网唯一标识 + NeUID string `json:"neUid" gorm:"column:ne_uid"` // 网元唯一标识 + NeType string `json:"neType" gorm:"column:ne_type"` // 网元类型 Date string `json:"date" gorm:"column:date"` // Date of the report yyyy-mm-dd hh:mi:ss StartTime string `json:"startTime" gorm:"column:start_time"` // Start time of the report hh:mi:ss EndTime string `json:"endTime" gorm:"column:end_time"` // End time of the report hh:mi:ss @@ -38,12 +38,12 @@ func (*KpiReport) TableName() string { // KPIQuery 指标查询参数结构体 type KPIQuery struct { - NeType string `form:"neType" binding:"required"` - NeID string `form:"neId" binding:"required"` - BeginTime int64 `form:"beginTime" binding:"required"` // 开始时间戳(毫秒)1739361200999 - EndTime int64 `form:"endTime" binding:"required"` // 结束时间戳(毫秒)1739361210088 + CoreUID string `json:"coreUid" form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `json:"neUid" form:"neUid" binding:"required"` // 网元唯一标识 + NeType string `json:"neType" form:"neType" binding:"required"` // 网元类型 + BeginTime int64 `form:"beginTime" binding:"required"` // 开始时间戳(毫秒)1739361200999 + EndTime int64 `form:"endTime" binding:"required"` // 结束时间戳(毫秒)1739361210088 Interval int64 `form:"interval" binding:"required,oneof=5 60 300 900 1800 3600"` - RmUID string `form:"rmUID"` SortField string `form:"sortField" binding:"omitempty,oneof=timeGroup"` SortOrder string `form:"sortOrder" binding:"omitempty,oneof=asc desc"` } diff --git a/src/modules/ne_data/model/nb_state.go b/src/modules/ne_data/model/nb_state.go index 6f422a42..7a76f545 100644 --- a/src/modules/ne_data/model/nb_state.go +++ b/src/modules/ne_data/model/nb_state.go @@ -3,9 +3,9 @@ package model // NBState 基站状态记录表 nb_state type NBState struct { ID int64 `json:"id" gorm:"column:id;primaryKey;autoIncrement"` - NeType string `json:"neType" gorm:"column:ne_type"` // 网元类型 AMF MME - NeId string `json:"neId" gorm:"column:ne_id"` // 网元ID - RmUid string `json:"rmUid" gorm:"column:rm_uid"` // 资源唯一标识 + CoreUID string `json:"coreUid" gorm:"column:core_uid"` // 核心网唯一标识 + NeUID string `json:"neUid" gorm:"column:ne_uid"` // 网元唯一标识 + NeType string `json:"neType" gorm:"column:ne_type"` // 网元类型 CreateTime int64 `json:"createTime" gorm:"column:create_time"` // 创建时间 Address string `json:"address" gorm:"column:address"` // 基站IP地址 NbName string `json:"nbName" gorm:"column:nb_name"` // 基站设备名称 @@ -22,8 +22,9 @@ func (*NBState) TableName() string { // NBStateQuery 查询参数结构体 type NBStateQuery struct { - NeType string `json:"neType" form:"neType" binding:"required"` - NeID string `json:"neId" form:"neId" binding:"required"` + CoreUID string `json:"coreUid" form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `json:"neUid" form:"neUid" binding:"required"` // 网元唯一标识 + NeType string `json:"neType" form:"neType"` // 网元类型 PageNum int64 `json:"pageNum" form:"pageNum" binding:"required"` PageSize int64 `json:"pageSize" form:"pageSize" binding:"required"` Status string `json:"status" form:"status"` @@ -31,5 +32,4 @@ type NBStateQuery struct { EndTime string `json:"endTime" form:"endTime"` SortField string `json:"sortField" form:"sortField" binding:"omitempty,oneof=id create_time"` // 排序字段,填写结果字段 SortOrder string `json:"sortOrder" form:"sortOrder" binding:"omitempty,oneof=asc desc"` // 排序升降序,asc desc - RmUID string `json:"rmUID" form:"rmUID"` } diff --git a/src/modules/ne_data/model/ne_state.go b/src/modules/ne_data/model/ne_state.go index b875f58f..ea8c56b9 100644 --- a/src/modules/ne_data/model/ne_state.go +++ b/src/modules/ne_data/model/ne_state.go @@ -3,8 +3,9 @@ package model // NEState 网元状态记录表 ne_state type NEState struct { ID int64 `json:"id" gorm:"column:id;primaryKey;autoIncrement"` - NeType string `json:"neType" gorm:"column:ne_type"` - NeId string `json:"neId" gorm:"column:ne_id"` + CoreUID string `json:"coreUid" gorm:"column:core_uid"` // 核心网唯一标识 + NeUID string `json:"neUid" gorm:"column:ne_uid"` // 网元唯一标识 + NeType string `json:"neType" gorm:"column:ne_type"` // 网元类型 Version string `json:"version" gorm:"column:version"` // 版本 Capability int64 `json:"capability" gorm:"column:capability"` // 用户容量 SerialNum string `json:"serialNum" gorm:"column:serial_num"` // 序列号 @@ -24,8 +25,9 @@ func (*NEState) TableName() string { // NEStateQuery 查询参数结构体 type NEStateQuery struct { - NeType string `json:"neType" form:"neType" binding:"required"` - NeID string `json:"neId" form:"neId" binding:"required"` + CoreUID string `json:"coreUid" form:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `json:"neUid" form:"neUid" binding:"required"` // 网元唯一标识 + NeType string `json:"neType" form:"neType"` // 网元类型 PageNum int64 `json:"pageNum" form:"pageNum" binding:"required"` PageSize int64 `json:"pageSize" form:"pageSize" binding:"required"` BeginTime string `json:"beginTime" form:"beginTime"` diff --git a/src/modules/ne_data/model/udm_auth.go b/src/modules/ne_data/model/udm_auth.go index fed24077..7f8e3308 100644 --- a/src/modules/ne_data/model/udm_auth.go +++ b/src/modules/ne_data/model/udm_auth.go @@ -2,9 +2,11 @@ package model // UDMAuthUser UDM鉴权用户 udm_auth type UDMAuthUser struct { - ID string `json:"id" gorm:"column:id;primaryKey;autoIncrement"` // 默认ID + ID int64 `json:"id" gorm:"column:id;primaryKey;autoIncrement"` // 主键 + CoreUID string `json:"coreUid" gorm:"column:core_uid"` // 核心网唯一标识 + NeUID string `json:"neUid" gorm:"column:ne_uid"` // 网元唯一标识 + NeType string `json:"neType" gorm:"column:ne_type"` // 网元类型 IMSI string `json:"imsi" gorm:"column:imsi"` // SIM卡/USIM卡ID - NeId string `json:"neId" gorm:"column:ne_id"` // UDM网元标识 Amf string `json:"amf" gorm:"column:amf"` // AMF Ki string `json:"ki" gorm:"column:ki"` // ki AlgoIndex string `json:"algoIndex" gorm:"column:algo_index"` // algoIndex diff --git a/src/modules/ne_data/model/udm_extend.go b/src/modules/ne_data/model/udm_extend.go index f4aac39b..52ba6a30 100644 --- a/src/modules/ne_data/model/udm_extend.go +++ b/src/modules/ne_data/model/udm_extend.go @@ -2,11 +2,14 @@ package model // UDMExtend UDM用户IMSI扩展信息 udm_extend type UDMExtend struct { - ID string `json:"id" gorm:"column:id;primaryKey;autoIncrement"` // 默认ID - IMSI string `json:"imsi" gorm:"column:imsi"` // SIM卡/USIM卡ID - MSISDN string `json:"msisdn" gorm:"column:msisdn"` // 用户电话号码 - NeId string `json:"neId" gorm:"column:ne_id"` // UDM网元标识-子系统 - Remark string `json:"remark" gorm:"column:remark"` // 备注 + ID int64 `json:"id" gorm:"column:id;primaryKey;autoIncrement"` // 主键 + CoreUID string `json:"coreUid" gorm:"column:core_uid"` // 核心网唯一标识 + NeUID string `json:"neUid" gorm:"column:ne_uid"` // 网元唯一标识 + NeType string `json:"neType" gorm:"column:ne_type"` // 网元类型 + IMSI string `json:"imsi" gorm:"column:imsi"` // SIM卡/USIM卡ID + MSISDN string `json:"msisdn" gorm:"column:msisdn"` // 用户电话号码 + + Remark string `json:"remark" gorm:"column:remark"` // 备注 } // TableName 表名称 diff --git a/src/modules/ne_data/model/udm_sub.go b/src/modules/ne_data/model/udm_sub.go index 9ff03c5f..08165d56 100644 --- a/src/modules/ne_data/model/udm_sub.go +++ b/src/modules/ne_data/model/udm_sub.go @@ -2,10 +2,12 @@ package model // UDMSubUser UDM签约用户 udm_sub type UDMSubUser struct { - ID string `json:"id" gorm:"column:id;primaryKey;autoIncrement"` // 主键 - IMSI string `json:"imsi" gorm:"column:imsi"` // SIM卡/USIM卡ID - MSISDN string `json:"msisdn" gorm:"column:msisdn"` // 用户电话号码 - NeId string `json:"neId" gorm:"column:ne_id"` // UDM网元标识 + ID int64 `json:"id" gorm:"column:id;primaryKey;autoIncrement"` // 主键 + CoreUID string `json:"coreUid" gorm:"column:core_uid"` // 核心网唯一标识 + NeUID string `json:"neUid" gorm:"column:ne_uid"` // 网元唯一标识 + NeType string `json:"neType" gorm:"column:ne_type"` // 网元类型 + IMSI string `json:"imsi" gorm:"column:imsi"` // SIM卡/USIM卡ID + MSISDN string `json:"msisdn" gorm:"column:msisdn"` // 用户电话号码 AmDat string `json:"amDat" gorm:"column:am_dat"` // AmData UeAmbrTpl string `json:"ambr" gorm:"column:ambr"` // AmData SubUeAMBRTemp diff --git a/src/modules/ne_data/model/udm_voip.go b/src/modules/ne_data/model/udm_voip.go index 2fbd1ae9..c25eb9cd 100644 --- a/src/modules/ne_data/model/udm_voip.go +++ b/src/modules/ne_data/model/udm_voip.go @@ -2,8 +2,10 @@ package model // UDMVOIPUser UDMVOIP用户 udm_voip type UDMVOIPUser struct { - ID string `json:"id" gorm:"column:id;primaryKey;autoIncrement"` // 主键 - NeId string `json:"neId" gorm:"column:ne_id"` // UDM网元标识 + ID int64 `json:"id" gorm:"column:id;primaryKey;autoIncrement"` // 主键 + CoreUID string `json:"coreUid" gorm:"column:core_uid"` // 核心网唯一标识 + NeUID string `json:"neUid" gorm:"column:ne_uid"` // 网元唯一标识 + NeType string `json:"neType" gorm:"column:ne_type"` // 网元类型 UserName string `json:"username" gorm:"column:username"` // 用户名 Password string `json:"password" gorm:"column:password"` // 密码 diff --git a/src/modules/ne_data/model/udm_volte_ims.go b/src/modules/ne_data/model/udm_volte_ims.go index 0dd4277b..340e7bde 100644 --- a/src/modules/ne_data/model/udm_volte_ims.go +++ b/src/modules/ne_data/model/udm_volte_ims.go @@ -2,10 +2,12 @@ package model // UDMVolteIMSUser UDMVolteIMS用户 udm_volte_ims type UDMVolteIMSUser struct { - ID string `json:"id" gorm:"column:id;primaryKey;autoIncrement"` // 主键 - IMSI string `json:"imsi" gorm:"column:imsi"` // SIM卡/USIM卡ID - MSISDN string `json:"msisdn" gorm:"column:msisdn"` // 用户电话号码 - NeId string `json:"neId" gorm:"column:ne_id"` // UDM网元标识 + ID int64 `json:"id" gorm:"column:id;primaryKey;autoIncrement"` // 主键 + CoreUID string `json:"coreUid" gorm:"column:core_uid"` // 核心网唯一标识 + NeUID string `json:"neUid" gorm:"column:ne_uid"` // 网元唯一标识 + NeType string `json:"neType" gorm:"column:ne_type"` // 网元类型 + IMSI string `json:"imsi" gorm:"column:imsi"` // SIM卡/USIM卡ID + MSISDN string `json:"msisdn" gorm:"column:msisdn"` // 用户电话号码 Tag string `json:"tag" gorm:"column:tag"` // 0=VoIP, 1=VoLTE VNI string `json:"vni" gorm:"column:vni"` // VNI diff --git a/src/modules/ne_data/model/ue_event.go b/src/modules/ne_data/model/ue_event.go index 5b0b309d..cadabc3c 100644 --- a/src/modules/ne_data/model/ue_event.go +++ b/src/modules/ne_data/model/ue_event.go @@ -3,9 +3,9 @@ package model // UEEvent UE会话对象 ue_event type UEEvent struct { ID int64 `json:"id" gorm:"column:id;primaryKey;autoIncrement"` - NeType string `json:"neType" gorm:"column:ne_type"` - NeName string `json:"neName" gorm:"column:ne_name"` - RmUID string `json:"rmUID" gorm:"column:rm_uid"` // 可能没有 + CoreUID string `json:"coreUid" gorm:"column:core_uid"` // 核心网唯一标识 + NeUID string `json:"neUid" gorm:"column:ne_uid"` // 网元唯一标识 + NeType string `json:"neType" gorm:"column:ne_type"` // 网元类型 Timestamp int64 `json:"timestamp" gorm:"column:timestamp"` // 接收到时间 EventType string `json:"eventType" gorm:"column:event_type"` // 事件类型 EventJSONStr string `json:"eventJSON" gorm:"column:event_json"` // data JSON String diff --git a/src/modules/ne_data/ne_data.go b/src/modules/ne_data/ne_data.go index 312a9014..0276001e 100644 --- a/src/modules/ne_data/ne_data.go +++ b/src/modules/ne_data/ne_data.go @@ -108,9 +108,9 @@ func Setup(router *gin.Engine) { middleware.AuthorizeUser(nil), controller.NewAlarm.CountSeverity, ) - alarmGroup.GET("/count/ne", + alarmGroup.GET("/count/top", middleware.AuthorizeUser(nil), - controller.NewAlarm.CountNe, + controller.NewAlarm.CountTop, ) } @@ -137,8 +137,8 @@ func Setup(router *gin.Engine) { ) } - // 网元状态记录信息 - neStateGroup := neDataGroup.Group("/ne-state") + // 网元状态历史记录信息 + neStateGroup := neDataGroup.Group("/state/ne") { neStateGroup.GET("/list", middleware.AuthorizeUser(nil), @@ -147,7 +147,7 @@ func Setup(router *gin.Engine) { } // 基站状态历史记录信息 含AMF/MME - nbStateGroup := neDataGroup.Group("/nb-state") + nbStateGroup := neDataGroup.Group("/state/nb") { nbStateGroup.GET("/list", middleware.AuthorizeUser(nil), @@ -159,6 +159,25 @@ func Setup(router *gin.Engine) { ) } + // 备份数据 + backupGroup := neDataGroup.Group("/backup") + { + backupGroup.GET("/ftp", + middleware.AuthorizeUser(nil), + controller.NewBackup.FTPInfo, + ) + backupGroup.PUT("/ftp", + middleware.AuthorizeUser(nil), + collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.backup", collectlogs.BUSINESS_TYPE_OTHER)), + controller.NewBackup.FTPUpdate, + ) + backupGroup.POST("/ftp", + middleware.AuthorizeUser(nil), + collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.backup", collectlogs.BUSINESS_TYPE_OTHER)), + controller.NewBackup.FTPPush, + ) + } + // 网元IMS imsGroup := neDataGroup.Group("/ims") { @@ -253,7 +272,7 @@ func Setup(router *gin.Engine) { middleware.AuthorizeUser(nil), controller.NewAMF.NbInfoList, ) - amfGroup.GET("/nb/list-cfg", + amfGroup.GET("/nb/addrs", middleware.AuthorizeUser(nil), controller.NewAMF.NbStateList, ) @@ -291,29 +310,10 @@ func Setup(router *gin.Engine) { ) } - // 备份数据 - backupGroup := neDataGroup.Group("/backup") - { - backupGroup.GET("/ftp", - middleware.AuthorizeUser(nil), - controller.NewBackup.FTPInfo, - ) - backupGroup.PUT("/ftp", - middleware.AuthorizeUser(nil), - collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.backup", collectlogs.BUSINESS_TYPE_OTHER)), - controller.NewBackup.FTPUpdate, - ) - backupGroup.POST("/ftp", - middleware.AuthorizeUser(nil), - collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.backup", collectlogs.BUSINESS_TYPE_OTHER)), - controller.NewBackup.FTPPush, - ) - } - // 网元UDM 鉴权用户信息 udmAuthGroup := neDataGroup.Group("/udm/auth") { - udmAuthGroup.PUT("/resetData/:neId", + udmAuthGroup.PUT("/reset", repeat.RepeatSubmit(5), middleware.AuthorizeUser(nil), collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmAuth", collectlogs.BUSINESS_TYPE_CLEAN)), @@ -323,35 +323,25 @@ func Setup(router *gin.Engine) { middleware.AuthorizeUser(nil), controller.NewUDMAuth.List, ) - udmAuthGroup.GET("/:neId/:imsi", + udmAuthGroup.GET("", middleware.AuthorizeUser(nil), controller.NewUDMAuth.Info, ) - udmAuthGroup.POST("/:neId", + udmAuthGroup.POST("", middleware.AuthorizeUser(nil), collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmAuth", collectlogs.BUSINESS_TYPE_INSERT)), controller.NewUDMAuth.Add, ) - udmAuthGroup.POST("/:neId/:num", - middleware.AuthorizeUser(nil), - collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmAuth", collectlogs.BUSINESS_TYPE_INSERT)), - controller.NewUDMAuth.Adds, - ) - udmAuthGroup.PUT("/:neId", + udmAuthGroup.PUT("", middleware.AuthorizeUser(nil), collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmAuth", collectlogs.BUSINESS_TYPE_UPDATE)), controller.NewUDMAuth.Edit, ) - udmAuthGroup.DELETE("/:neId/:imsi", + udmAuthGroup.DELETE("", middleware.AuthorizeUser(nil), collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmAuth", collectlogs.BUSINESS_TYPE_DELETE)), controller.NewUDMAuth.Remove, ) - udmAuthGroup.DELETE("/:neId/:imsi/:num", - middleware.AuthorizeUser(nil), - collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmAuth", collectlogs.BUSINESS_TYPE_DELETE)), - controller.NewUDMAuth.Removes, - ) udmAuthGroup.GET("/export", middleware.AuthorizeUser(nil), collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmAuth", collectlogs.BUSINESS_TYPE_EXPORT)), @@ -367,7 +357,7 @@ func Setup(router *gin.Engine) { // 网元UDM 签约用户信息 udmSubGroup := neDataGroup.Group("/udm/sub") { - udmSubGroup.PUT("/resetData/:neId", + udmSubGroup.PUT("/reset", repeat.RepeatSubmit(5), middleware.AuthorizeUser(nil), collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmSub", collectlogs.BUSINESS_TYPE_CLEAN)), @@ -377,35 +367,25 @@ func Setup(router *gin.Engine) { middleware.AuthorizeUser(nil), controller.NewUDMSub.List, ) - udmSubGroup.GET("/:neId/:imsi", + udmSubGroup.GET("", middleware.AuthorizeUser(nil), controller.NewUDMSub.Info, ) - udmSubGroup.POST("/:neId", + udmSubGroup.POST("", middleware.AuthorizeUser(nil), collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmSub", collectlogs.BUSINESS_TYPE_INSERT)), controller.NewUDMSub.Add, ) - udmSubGroup.POST("/:neId/:num", - middleware.AuthorizeUser(nil), - collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmSub", collectlogs.BUSINESS_TYPE_INSERT)), - controller.NewUDMSub.Adds, - ) - udmSubGroup.PUT("/:neId", + udmSubGroup.PUT("", middleware.AuthorizeUser(nil), collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmSub", collectlogs.BUSINESS_TYPE_UPDATE)), controller.NewUDMSub.Edit, ) - udmSubGroup.DELETE("/:neId/:imsi", + udmSubGroup.DELETE("", middleware.AuthorizeUser(nil), collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmSub", collectlogs.BUSINESS_TYPE_DELETE)), controller.NewUDMSub.Remove, ) - udmSubGroup.DELETE("/:neId/:imsi/:num", - middleware.AuthorizeUser(nil), - collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmSub", collectlogs.BUSINESS_TYPE_DELETE)), - controller.NewUDMSub.Removes, - ) udmSubGroup.GET("/export", middleware.AuthorizeUser(nil), collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmSub", collectlogs.BUSINESS_TYPE_EXPORT)), @@ -421,7 +401,7 @@ func Setup(router *gin.Engine) { // 网元UDM VOIP用户信息 udmVOIPGroup := neDataGroup.Group("/udm/voip") { - udmVOIPGroup.PUT("/resetData/:neId", + udmVOIPGroup.PUT("/reset", repeat.RepeatSubmit(5), middleware.AuthorizeUser(nil), collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmVOIP", collectlogs.BUSINESS_TYPE_CLEAN)), @@ -431,30 +411,20 @@ func Setup(router *gin.Engine) { middleware.AuthorizeUser(nil), controller.NewUDMVOIP.List, ) - udmVOIPGroup.GET("/:neId/:username", + udmVOIPGroup.GET("", middleware.AuthorizeUser(nil), controller.NewUDMVOIP.Info, ) - udmVOIPGroup.POST("/:neId", + udmVOIPGroup.POST("", middleware.AuthorizeUser(nil), collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmVOIP", collectlogs.BUSINESS_TYPE_INSERT)), controller.NewUDMVOIP.Add, ) - udmVOIPGroup.POST("/:neId/:num", - middleware.AuthorizeUser(nil), - collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmVOIP", collectlogs.BUSINESS_TYPE_INSERT)), - controller.NewUDMVOIP.Adds, - ) - udmVOIPGroup.DELETE("/:neId/:username", + udmVOIPGroup.DELETE("", middleware.AuthorizeUser(nil), collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmVOIP", collectlogs.BUSINESS_TYPE_DELETE)), controller.NewUDMVOIP.Remove, ) - udmVOIPGroup.DELETE("/:neId/:username/:num", - middleware.AuthorizeUser(nil), - collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmVOIP", collectlogs.BUSINESS_TYPE_DELETE)), - controller.NewUDMVOIP.Removes, - ) udmVOIPGroup.GET("/export", middleware.AuthorizeUser(nil), collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmVOIP", collectlogs.BUSINESS_TYPE_EXPORT)), @@ -470,7 +440,7 @@ func Setup(router *gin.Engine) { // 网元UDM VolteIMS用户信息 udmVolteIMSGroup := neDataGroup.Group("/udm/volte-ims") { - udmVolteIMSGroup.PUT("/resetData/:neId", + udmVolteIMSGroup.PUT("/reset", repeat.RepeatSubmit(5), middleware.AuthorizeUser(nil), collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmVolteIMS", collectlogs.BUSINESS_TYPE_CLEAN)), @@ -480,30 +450,20 @@ func Setup(router *gin.Engine) { middleware.AuthorizeUser(nil), controller.NewUDMVolteIMS.List, ) - udmVolteIMSGroup.GET("/:neId/:imsi", + udmVolteIMSGroup.GET("", middleware.AuthorizeUser(nil), controller.NewUDMVolteIMS.Info, ) - udmVolteIMSGroup.POST("/:neId", + udmVolteIMSGroup.POST("", middleware.AuthorizeUser(nil), collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmVolteIMS", collectlogs.BUSINESS_TYPE_INSERT)), controller.NewUDMVolteIMS.Add, ) - udmVolteIMSGroup.POST("/:neId/:num", - middleware.AuthorizeUser(nil), - collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmVolteIMS", collectlogs.BUSINESS_TYPE_INSERT)), - controller.NewUDMVolteIMS.Adds, - ) - udmVolteIMSGroup.DELETE("/:neId/:imsi", + udmVolteIMSGroup.DELETE("", middleware.AuthorizeUser(nil), collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmVolteIMS", collectlogs.BUSINESS_TYPE_DELETE)), controller.NewUDMVolteIMS.Remove, ) - udmVolteIMSGroup.DELETE("/:neId/:imsi/:num", - middleware.AuthorizeUser(nil), - collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmVolteIMS", collectlogs.BUSINESS_TYPE_DELETE)), - controller.NewUDMVolteIMS.Removes, - ) udmVolteIMSGroup.GET("/export", middleware.AuthorizeUser(nil), collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmVolteIMS", collectlogs.BUSINESS_TYPE_EXPORT)), @@ -537,7 +497,7 @@ func Setup(router *gin.Engine) { middleware.AuthorizeUser(nil), controller.NewMME.NbInfoList, ) - mmeGroup.GET("/nb/list-cfg", + mmeGroup.GET("/nb/addrs", middleware.AuthorizeUser(nil), controller.NewMME.NbStateList, ) diff --git a/src/modules/ne_data/repository/alarm.go b/src/modules/ne_data/repository/alarm.go index 03ceb16c..826010ea 100644 --- a/src/modules/ne_data/repository/alarm.go +++ b/src/modules/ne_data/repository/alarm.go @@ -1,7 +1,6 @@ package repository import ( - "fmt" "strings" "time" @@ -23,17 +22,14 @@ func (r Alarm) SelectByPage(query model.AlarmQuery) ([]model.Alarm, int64) { if query.NeType != "" { tx = tx.Where("ne_type = ?", query.NeType) } - if query.NeID != "" { - tx = tx.Where("ne_id = ?", query.NeID) + if query.NeUID != "" { + tx = tx.Where("ne_uid = ?", query.NeUID) } - if query.NeName != "" { - tx = tx.Where("ne_name = ?", query.NeName) - } - if query.PvFlag != "" { - tx = tx.Where("pv_flag = ?", query.PvFlag) + if query.CoreUID != "" { + tx = tx.Where("core_uid = ?", query.CoreUID) } if query.AlarmCode != "" { - tx = tx.Where("alarm_code like ?", fmt.Sprintf("%%%s%%", query.AlarmCode)) + tx = tx.Where("alarm_code = ?", query.AlarmCode) } if query.AlarmType != "" { tx = tx.Where("alarm_type in (?)", strings.Split(query.AlarmType, ",")) @@ -88,11 +84,11 @@ func (r Alarm) Select(param model.Alarm) []model.Alarm { if param.NeType != "" { tx = tx.Where("ne_type = ?", param.NeType) } - if param.NeId != "" { - tx = tx.Where("ne_id = ?", param.NeId) + if param.NeUID != "" { + tx = tx.Where("ne_uid = ?", param.NeUID) } - if param.NeName != "" { - tx = tx.Where("ne_name = ?", param.NeName) + if param.CoreUID != "" { + tx = tx.Where("core_uid = ?", param.CoreUID) } if param.AlarmCode > 0 { tx = tx.Where("alarm_code = ?", param.AlarmCode) @@ -107,9 +103,6 @@ func (r Alarm) Select(param model.Alarm) []model.Alarm { eventTypes := strings.Split(param.OrigSeverity, ",") tx = tx.Where("orig_severity in (%s)", eventTypes) } - if param.PvFlag != "" { - tx = tx.Where("pv_flag = ?", param.PvFlag) - } // 查询数据 rows := []model.Alarm{} @@ -139,8 +132,8 @@ func (r Alarm) SelectByIds(ids []int64) []model.Alarm { // Insert 新增信息 返回新增数据ID func (r Alarm) Insert(param model.Alarm) int64 { - if param.Timestamp == 0 { - param.Timestamp = time.Now().UnixMilli() + if param.CreatedAt == 0 { + param.CreatedAt = time.Now().UnixMilli() } // 执行插入 if err := db.DB("").Create(¶m).Error; err != nil { @@ -158,7 +151,7 @@ func (r Alarm) Update(param model.Alarm) int64 { tx := db.DB("").Model(&model.Alarm{}) // 构建查询条件 tx = tx.Where("id = ?", param.ID) - tx = tx.Omit("id", "timestamp") + tx = tx.Omit("id", "created_at") // 执行更新 if err := tx.Updates(param).Error; err != nil { logger.Errorf("update err => %v", err.Error()) @@ -181,9 +174,9 @@ func (r Alarm) DeleteByIds(ids []int64) int64 { } // SelectAlarmSeqLast 查询网元告警最后一条序号 -func (r Alarm) SelectAlarmSeqLast(neType, neId string) int64 { +func (r Alarm) SelectAlarmSeqLast(coreUid, neUid string) int64 { tx := db.DB("").Model(&model.Alarm{}) - tx = tx.Where("ne_type=? and ne_id=?", neType, neId) + tx = tx.Where("core_uid=? and ne_uid=?", coreUid, neUid) tx = tx.Select("alarm_seq").Order("alarm_seq DESC") // 查询数据 var alarmSeq int64 = 0 @@ -195,10 +188,10 @@ func (r Alarm) SelectAlarmSeqLast(neType, neId string) int64 { } // GroupTotal 分组统计 -func (r Alarm) GroupTotal(alarmStatus string, group string, limit int) []map[string]any { +func (r Alarm) GroupTotal(coreUid, alarmStatus string, group string, limit int) []map[string]any { tx := db.DB("").Model(&model.Alarm{}) tx = tx.Select("count(*) as total", group) - tx = tx.Where("alarm_status=?", alarmStatus) + tx = tx.Where("core_uid=? and alarm_status=? ", coreUid, alarmStatus) tx = tx.Group(group).Order("total DESC") // 查询数据 var rows []map[string]any = make([]map[string]any, 0) diff --git a/src/modules/ne_data/repository/alarm_event.go b/src/modules/ne_data/repository/alarm_event.go index 0284ec91..3d69ced2 100644 --- a/src/modules/ne_data/repository/alarm_event.go +++ b/src/modules/ne_data/repository/alarm_event.go @@ -1,6 +1,7 @@ package repository import ( + "fmt" "time" "be.ems/src/framework/database/db" @@ -21,20 +22,23 @@ func (r AlarmEvent) SelectByPage(query model.AlarmEventQuery) ([]model.AlarmEven if query.NeType != "" { tx = tx.Where("ne_type = ?", query.NeType) } - if query.NeID != "" { - tx = tx.Where("ne_id = ?", query.NeID) + if query.NeUID != "" { + tx = tx.Where("ne_uid = ?", query.NeUID) + } + if query.CoreUID != "" { + tx = tx.Where("core_uid = ?", query.CoreUID) } if query.AlarmCode != "" { - tx = tx.Where("alarm_code = ?", query.AlarmCode) + tx = tx.Where("alarm_code like ?", fmt.Sprintf("%s%%", query.AlarmCode)) } if query.AlarmStatus != "" { tx = tx.Where("alarm_status = ?", query.AlarmStatus) } if query.BeginTime != 0 { - tx = tx.Where("event_time >= ?", query.BeginTime) + tx = tx.Where("created_at >= ?", query.BeginTime) } if query.EndTime != 0 { - tx = tx.Where("event_time <= ?", query.EndTime) + tx = tx.Where("created_at <= ?", query.EndTime) } // 查询结果 @@ -73,8 +77,11 @@ func (r AlarmEvent) Select(param model.AlarmEvent) []model.AlarmEvent { if param.NeType != "" { tx = tx.Where("ne_type = ?", param.NeType) } - if param.NeId != "" { - tx = tx.Where("ne_id = ?", param.NeId) + if param.NeUID != "" { + tx = tx.Where("ne_uid = ?", param.NeUID) + } + if param.CoreUID != "" { + tx = tx.Where("core_uid = ?", param.CoreUID) } if param.AlarmId != "" { tx = tx.Where("alarm_id = ?", param.AlarmId) @@ -113,8 +120,8 @@ func (r AlarmEvent) SelectByIds(ids []int64) []model.AlarmEvent { // Insert 新增信息 返回新增数据ID func (r AlarmEvent) Insert(param model.AlarmEvent) int64 { - if param.Timestamp == 0 { - param.Timestamp = time.Now().UnixMilli() + if param.CreatedAt == 0 { + param.CreatedAt = time.Now().UnixMilli() } // 执行插入 if err := db.DB("").Create(¶m).Error; err != nil { @@ -132,7 +139,7 @@ func (r AlarmEvent) Update(param model.AlarmEvent) int64 { tx := db.DB("").Model(&model.AlarmEvent{}) // 构建查询条件 tx = tx.Where("id = ?", param.ID) - tx = tx.Omit("id", "timestamp") + tx = tx.Omit("id", "created_at") // 执行更新 if err := tx.Updates(param).Error; err != nil { logger.Errorf("update err => %v", err.Error()) @@ -155,9 +162,9 @@ func (r AlarmEvent) DeleteByIds(ids []int64) int64 { } // SelectAlarmEventSeqLast 查询网元告警最后一条序号 -func (r AlarmEvent) SelectAlarmEventSeqLast(neType, neId string) int64 { +func (r AlarmEvent) SelectAlarmEventSeqLast(coreUid, neUid string) int64 { tx := db.DB("").Model(&model.AlarmEvent{}) - tx = tx.Where("ne_type=? and ne_id=?", neType, neId) + tx = tx.Where("core_uid=? and ne_uid=?", coreUid, neUid) tx = tx.Select("alarm_seq").Order("alarm_seq DESC") // 查询数据 var AlarmEventSeq int64 = 0 diff --git a/src/modules/ne_data/repository/alarm_forward_log.go b/src/modules/ne_data/repository/alarm_forward_log.go index 203043ee..4594fc64 100644 --- a/src/modules/ne_data/repository/alarm_forward_log.go +++ b/src/modules/ne_data/repository/alarm_forward_log.go @@ -21,8 +21,11 @@ func (r AlarmForwardLog) SelectByPage(query model.AlarmForwardLogQuery) ([]model if query.NeType != "" { tx = tx.Where("ne_type = ?", query.NeType) } - if query.NeID != "" { - tx = tx.Where("ne_id = ?", query.NeID) + if query.NeUID != "" { + tx = tx.Where("ne_uid = ?", query.NeUID) + } + if query.CoreUID != "" { + tx = tx.Where("core_uid = ?", query.CoreUID) } if query.BeginTime != 0 { tx = tx.Where("created_at >= ?", query.BeginTime) diff --git a/src/modules/ne_data/repository/alarm_log.go b/src/modules/ne_data/repository/alarm_log.go index 6e070e55..fd3ae55f 100644 --- a/src/modules/ne_data/repository/alarm_log.go +++ b/src/modules/ne_data/repository/alarm_log.go @@ -21,8 +21,11 @@ func (r AlarmLog) SelectByPage(query model.AlarmLogQuery) ([]model.AlarmLog, int if query.NeType != "" { tx = tx.Where("ne_type = ?", query.NeType) } - if query.NeID != "" { - tx = tx.Where("ne_id = ?", query.NeID) + if query.NeUID != "" { + tx = tx.Where("ne_uid = ?", query.NeUID) + } + if query.CoreUID != "" { + tx = tx.Where("core_uid = ?", query.CoreUID) } if query.AlarmStatus != "" { tx = tx.Where("alarm_status = ?", query.AlarmStatus) diff --git a/src/modules/ne_data/repository/cdr_event.go b/src/modules/ne_data/repository/cdr_event.go index 2b5569b3..2dacc067 100644 --- a/src/modules/ne_data/repository/cdr_event.go +++ b/src/modules/ne_data/repository/cdr_event.go @@ -2,6 +2,7 @@ package repository import ( "fmt" + "sort" "strings" "time" @@ -22,8 +23,11 @@ func (r CDREvent) SelectByPage(neType string, query map[string]string) ([]model. tableName := fmt.Sprintf("cdr_event_%s", strings.ToLower(neType)) tx := db.DB("").Table(tableName).Model(&model.CDREvent{}) // 查询条件拼接 - if v, ok := query["rmUID"]; ok && v != "" { - tx = tx.Where("rm_uid = ?", v) + if v, ok := query["coreUid"]; ok && v != "" { + tx = tx.Where("core_uid = ?", v) + } + if v, ok := query["neUid"]; ok && v != "" { + tx = tx.Where("ne_uid = ?", v) } if v, ok := query["beginTime"]; ok && v != "" { if len(v) == 10 { @@ -91,26 +95,64 @@ func (r CDREvent) SelectByPage(neType string, query map[string]string) ([]model. // 分页 pageNum, pageSize := db.PageNumSize(query["pageNum"], query["pageSize"]) - tx = tx.Offset(int(pageNum * pageSize)).Limit(int(pageSize)) - - // 排序 - if v, ok := query["sortField"]; ok && v != "" { - sortSql := v - if o, ok := query["sortOrder"]; ok && o != "" { - if o == "desc" { - sortSql += " desc " - } else { - sortSql += " asc " - } - } - tx = tx.Order(sortSql) + if pageNum == 0 && pageSize > int(total) { + pageSize = int(total) } + tx = tx.Offset(int(pageNum * pageSize)).Limit(int(pageSize)) // 查询数据 if err := tx.Find(&rows).Error; err != nil { logger.Errorf("query err => %v", err) } + // 排序 + if v, ok := query["sortField"]; ok && v != "" { + sortField := v + sortOrder := "asc" + if o, ok := query["sortOrder"]; ok && o != "" { + if o == "desc" { + sortOrder = "desc" + } else { + sortOrder = "asc" + } + } + sort.SliceStable(rows, func(i, j int) bool { + // 支持的排序字段映射 + fieldGetters := map[string]func(*model.CDREvent) any{ + "id": func(row *model.CDREvent) any { return row.ID }, + "timestamp": func(row *model.CDREvent) any { return row.Timestamp }, + // 可添加更多支持的字段 + } + + // 获取字段 getter 函数 + getter, ok := fieldGetters[sortField] + if !ok { + // 非法字段,使用默认排序(id升序) + return rows[i].ID < rows[j].ID + } + + // 获取比较值 + valI, valJ := getter(&rows[i]), getter(&rows[j]) + + // 根据字段类型进行比较 + switch v := valI.(type) { + case int64: + if sortOrder == "desc" { + return v > valJ.(int64) + } + return v < valJ.(int64) + case string: + if sortOrder == "desc" { + return v > valJ.(string) + } + return v < valJ.(string) + default: + // 不支持的字段类型,使用默认排序 + return rows[i].ID < rows[j].ID + } + }) + } + return rows, total } diff --git a/src/modules/ne_data/repository/kpi_c_report.go b/src/modules/ne_data/repository/kpi_c_report.go index aa7daa31..7512c31e 100644 --- a/src/modules/ne_data/repository/kpi_c_report.go +++ b/src/modules/ne_data/repository/kpi_c_report.go @@ -2,6 +2,7 @@ package repository import ( "fmt" + "sort" "strings" "time" @@ -28,8 +29,11 @@ func (r KpiCReport) SelectKPI(query model.KPICQuery) []model.KpiCReport { tableName := fmt.Sprintf("kpi_c_report_%s", strings.ToLower(query.NeType)) tx.Table(tableName) // 构建查询条件 - if query.RmUID != "" { - tx = tx.Where("rm_uid = ?", query.RmUID) + if query.NeUID != "" { + tx = tx.Where("ne_uid = ?", query.NeUID) + } + if query.CoreUID != "" { + tx = tx.Where("core_uid = ?", query.CoreUID) } if query.BeginTime != 0 { tx = tx.Where("created_at >= ?", query.BeginTime) @@ -37,19 +41,52 @@ func (r KpiCReport) SelectKPI(query model.KPICQuery) []model.KpiCReport { if query.EndTime != 0 { tx = tx.Where("created_at <= ?", query.EndTime) } - // 排序 - if query.SortField == "" || query.SortField == "timeGroup" { - query.SortField = "created_at" - } - if query.SortOrder == "" { - query.SortOrder = "desc" - } - tx = tx.Order(fmt.Sprintf("%s %s", query.SortField, query.SortOrder)) // 查询数据 if err := tx.Find(&rows).Error; err != nil { logger.Errorf("query find err => %v", err.Error()) return rows } + // 排序 + if query.SortField != "" { + sortField := query.SortField + sortOrder := query.SortOrder + sort.SliceStable(rows, func(i, j int) bool { + // 支持的排序字段映射 + fieldGetters := map[string]func(*model.KpiCReport) any{ + "id": func(row *model.KpiCReport) any { return row.ID }, + "timeGroup": func(row *model.KpiCReport) any { return row.CreatedAt }, + "createdAt": func(row *model.KpiCReport) any { return row.CreatedAt }, + // 可添加更多支持的字段 + } + + // 获取字段 getter 函数 + getter, ok := fieldGetters[sortField] + if !ok { + // 非法字段,使用默认排序(id升序) + return rows[i].ID < rows[j].ID + } + + // 获取比较值 + valI, valJ := getter(&rows[i]), getter(&rows[j]) + + // 根据字段类型进行比较 + switch v := valI.(type) { + case int64: + if sortOrder == "desc" { + return v > valJ.(int64) + } + return v < valJ.(int64) + case string: + if sortOrder == "desc" { + return v > valJ.(string) + } + return v < valJ.(string) + default: + // 不支持的字段类型,使用默认排序 + return rows[i].ID < rows[j].ID + } + }) + } return rows } diff --git a/src/modules/ne_data/repository/kpi_report.go b/src/modules/ne_data/repository/kpi_report.go index 1e0b3105..f404da6a 100644 --- a/src/modules/ne_data/repository/kpi_report.go +++ b/src/modules/ne_data/repository/kpi_report.go @@ -2,6 +2,7 @@ package repository import ( "fmt" + "sort" "strings" "time" @@ -28,8 +29,11 @@ func (r KpiReport) SelectKPI(query model.KPIQuery) []model.KpiReport { tableName := fmt.Sprintf("kpi_report_%s", strings.ToLower(query.NeType)) tx = tx.Table(tableName) // 构建查询条件 - if query.RmUID != "" { - tx = tx.Where("rm_uid = ?", query.RmUID) + if query.NeUID != "" { + tx = tx.Where("ne_uid = ?", query.NeUID) + } + if query.CoreUID != "" { + tx = tx.Where("core_uid = ?", query.CoreUID) } if query.BeginTime != 0 { tx = tx.Where("created_at >= ?", query.BeginTime) @@ -37,25 +41,58 @@ func (r KpiReport) SelectKPI(query model.KPIQuery) []model.KpiReport { if query.EndTime != 0 { tx = tx.Where("created_at <= ?", query.EndTime) } - // 排序 - if query.SortField == "" || query.SortField == "timeGroup" { - query.SortField = "created_at" - } - if query.SortOrder == "" { - query.SortOrder = "desc" - } - tx = tx.Order(fmt.Sprintf("%s %s", query.SortField, query.SortOrder)) // 查询数据 if err := tx.Find(&rows).Error; err != nil { logger.Errorf("query find err => %v", err.Error()) return rows } + // 排序 + if query.SortField != "" { + sortField := query.SortField + sortOrder := query.SortOrder + sort.SliceStable(rows, func(i, j int) bool { + // 支持的排序字段映射 + fieldGetters := map[string]func(*model.KpiReport) any{ + "id": func(row *model.KpiReport) any { return row.ID }, + "timeGroup": func(row *model.KpiReport) any { return row.CreatedAt }, + "createdAt": func(row *model.KpiReport) any { return row.CreatedAt }, + // 可添加更多支持的字段 + } + + // 获取字段 getter 函数 + getter, ok := fieldGetters[sortField] + if !ok { + // 非法字段,使用默认排序(id升序) + return rows[i].ID < rows[j].ID + } + + // 获取比较值 + valI, valJ := getter(&rows[i]), getter(&rows[j]) + + // 根据字段类型进行比较 + switch v := valI.(type) { + case int64: + if sortOrder == "desc" { + return v > valJ.(int64) + } + return v < valJ.(int64) + case string: + if sortOrder == "desc" { + return v > valJ.(string) + } + return v < valJ.(string) + default: + // 不支持的字段类型,使用默认排序 + return rows[i].ID < rows[j].ID + } + }) + } return rows } // Insert 新增信息 返回新增数据ID func (r KpiReport) Insert(param model.KpiReport) int64 { - if param.NeType == "" { + if param.CoreUID == "" || param.NeUID == "" || param.NeType == "" { return 0 } if param.CreatedAt == 0 { @@ -72,11 +109,11 @@ func (r KpiReport) Insert(param model.KpiReport) int64 { } // SelectUPF 查询UPF数据 N3上行,N6下行 -func (r KpiReport) SelectUPF(rmUID string, beginTime, endTime int64) []model.KpiReport { +func (r KpiReport) SelectUPF(coreUid, neUid string, beginTime, endTime int64) []model.KpiReport { tx := db.DB("").Model(&model.KpiReport{}) // 表名 tx = tx.Table("kpi_report_upf") - tx = tx.Where("rm_uid = ?", rmUID) + tx = tx.Where("core_uid = ? and ne_uid = ?", coreUid, neUid) tx = tx.Where("created_at >= ?", beginTime) tx = tx.Where("created_at <= ?", endTime) // 查询数据 diff --git a/src/modules/ne_data/repository/nb_state.go b/src/modules/ne_data/repository/nb_state.go index b1fc515c..2ea3d757 100644 --- a/src/modules/ne_data/repository/nb_state.go +++ b/src/modules/ne_data/repository/nb_state.go @@ -21,11 +21,11 @@ func (r NBState) SelectByPage(query model.NBStateQuery) ([]model.NBState, int64) if query.NeType != "" { tx = tx.Where("ne_type = ?", query.NeType) } - if query.NeID != "" { - tx = tx.Where("ne_id = ?", query.NeID) + if query.NeUID != "" { + tx = tx.Where("ne_uid = ?", query.NeUID) } - if query.RmUID != "" { - tx = tx.Where("rm_uid = ?", query.RmUID) + if query.CoreUID != "" { + tx = tx.Where("core_uid = ?", query.CoreUID) } if query.Status != "" { tx = tx.Where("state = ?", query.Status) diff --git a/src/modules/ne_data/repository/ne_state.go b/src/modules/ne_data/repository/ne_state.go index c3b96b5c..dedcfaa6 100644 --- a/src/modules/ne_data/repository/ne_state.go +++ b/src/modules/ne_data/repository/ne_state.go @@ -21,8 +21,11 @@ func (r NEState) SelectByPage(query model.NEStateQuery) ([]model.NEState, int64) if query.NeType != "" { tx = tx.Where("ne_type = ?", query.NeType) } - if query.NeID != "" { - tx = tx.Where("ne_id = ?", query.NeID) + if query.NeUID != "" { + tx = tx.Where("ne_uid = ?", query.NeUID) + } + if query.CoreUID != "" { + tx = tx.Where("core_uid = ?", query.CoreUID) } if query.BeginTime != "" { startTime := query.BeginTime diff --git a/src/modules/ne_data/repository/udm_auth.go b/src/modules/ne_data/repository/udm_auth.go index 82bae023..99dc6a79 100644 --- a/src/modules/ne_data/repository/udm_auth.go +++ b/src/modules/ne_data/repository/udm_auth.go @@ -16,10 +16,10 @@ var NewUDMAuthUser = &UDMAuthUser{} type UDMAuthUser struct{} // ClearAndInsert 清空ne_id后新增实体 -func (r *UDMAuthUser) ClearAndInsert(neId string, uArr []model.UDMAuthUser) int64 { +func (r *UDMAuthUser) ClearAndInsert(coreUid, neUid string, uArr []model.UDMAuthUser) int64 { // 不指定neID时,用 TRUNCATE 清空表快 // _, err := datasource.ExecDB("", "TRUNCATE TABLE udm_auth", nil) - result := db.DB("").Where("ne_id = ?", neId).Unscoped().Delete(&model.UDMAuthUser{}) + result := db.DB("").Where("core_uid = ? and ne_uid = ?", coreUid, neUid).Unscoped().Delete(&model.UDMAuthUser{}) if result.Error != nil { logger.Errorf("Delete err => %v", result.Error) } @@ -33,8 +33,11 @@ func (r *UDMAuthUser) SelectPage(query map[string]string) ([]model.UDMAuthUser, if v, ok := query["imsi"]; ok && v != "" { tx = tx.Where("imsi like ?", fmt.Sprintf("%%%s%%", v)) } - if v, ok := query["neId"]; ok && v != "" { - tx = tx.Where("ne_id = ?", v) + if v, ok := query["neUid"]; ok && v != "" { + tx = tx.Where("ne_uid = ?", v) + } + if v, ok := query["coreUid"]; ok && v != "" { + tx = tx.Where("core_uid = ?", v) } if v, ok := query["imsis"]; ok && v != "" { arr := strings.Split(v, ",") @@ -83,8 +86,11 @@ func (r *UDMAuthUser) SelectList(u model.UDMAuthUser) []model.UDMAuthUser { if u.IMSI != "" { tx = tx.Where("imsi = ?", u.IMSI) } - if u.NeId != "" { - tx = tx.Where("ne_id = ?", u.NeId) + if u.NeUID != "" { + tx = tx.Where("ne_uid = ?", u.NeUID) + } + if u.CoreUID != "" { + tx = tx.Where("core_uid = ?", u.CoreUID) } // 查询数据 @@ -95,12 +101,13 @@ func (r *UDMAuthUser) SelectList(u model.UDMAuthUser) []model.UDMAuthUser { return arr } -// SelectByIMSIAndNeID 通过imsi和ne_id查询 -func (r *UDMAuthUser) SelectByIMSIAndNeID(imsi, neId string) model.UDMAuthUser { +// SelectByIMSI 通过imsi查询 +func (r *UDMAuthUser) SelectByIMSI(coreUid, neUid, imsi string) model.UDMAuthUser { tx := db.DB("").Model(&model.UDMAuthUser{}) item := model.UDMAuthUser{} // 查询条件拼接 - tx = tx.Where("imsi = ? and ne_id = ?", imsi, neId) + tx = tx.Where("core_uid = ? and ne_uid = ?", coreUid, neUid) + tx = tx.Where("imsi = ?", imsi) // 查询数据 if err := tx.Order("imsi asc").Limit(1).Find(&item).Error; err != nil { logger.Errorf("query err => %v", err) @@ -118,8 +125,11 @@ func (r *UDMAuthUser) Inserts(uArr []model.UDMAuthUser) int64 { } // Delete 删除实体 -func (r *UDMAuthUser) Delete(imsi, neId string) int64 { - tx := db.DB("").Where("imsi = ? and ne_id = ?", imsi, neId).Delete(&model.UDMAuthUser{}) +func (r *UDMAuthUser) DeleteByIMSI(coreUid, neUid, imsi string) int64 { + tx := db.DB("") + tx = tx.Where("core_uid = ? and ne_uid = ?", coreUid, neUid) + tx = tx.Where("imsi = ?", imsi) + tx.Delete(&model.UDMAuthUser{}) if err := tx.Error; err != nil { logger.Errorf("Delete err => %v", err) } @@ -127,8 +137,11 @@ func (r *UDMAuthUser) Delete(imsi, neId string) int64 { } // DeletePrefixByIMSI 删除前缀匹配的实体 -func (r *UDMAuthUser) DeletePrefixByIMSI(imsi, neId string) int64 { - tx := db.DB("").Where("imsi like ? and ne_id = ?", fmt.Sprintf("%s%%", imsi), neId).Delete(&model.UDMAuthUser{}) +func (r *UDMAuthUser) DeletePrefixByIMSI(coreUid, neUid, imsiPrefix string) int64 { + tx := db.DB("") + tx = tx.Where("core_uid = ? and ne_uid = ?", coreUid, neUid) + tx = tx.Where("imsi like ?", fmt.Sprintf("%s%%", imsiPrefix)) + tx.Delete(&model.UDMAuthUser{}) if err := tx.Error; err != nil { logger.Errorf("DeletePrefixByIMSI err => %v", err) } diff --git a/src/modules/ne_data/repository/udm_extend.go b/src/modules/ne_data/repository/udm_extend.go index 2b0cfa4a..3a59084e 100644 --- a/src/modules/ne_data/repository/udm_extend.go +++ b/src/modules/ne_data/repository/udm_extend.go @@ -21,8 +21,11 @@ func (r UDMExtend) SelectByPage(query map[string]string) ([]model.UDMExtend, int if v, ok := query["imsi"]; ok && v != "" { tx = tx.Where("imsi like ?", fmt.Sprintf("%%%s%%", v)) } - if v, ok := query["neId"]; ok && v != "" { - tx = tx.Where("ne_id = ?", v) + if v, ok := query["neUid"]; ok && v != "" { + tx = tx.Where("ne_uid = ?", v) + } + if v, ok := query["coreUid"]; ok && v != "" { + tx = tx.Where("core_uid = ?", v) } // 查询结果 @@ -61,8 +64,11 @@ func (r *UDMExtend) SelectList(u model.UDMExtend) []model.UDMExtend { if u.IMSI != "" { tx = tx.Where("imsi = ?", u.IMSI) } - if u.NeId != "" { - tx = tx.Where("ne_id = ?", u.NeId) + if u.NeUID != "" { + tx = tx.Where("ne_uid = ?", u.NeUID) + } + if u.CoreUID != "" { + tx = tx.Where("core_uid = ?", u.CoreUID) } tx = tx.Order("imsi asc") // 查询数据 @@ -74,14 +80,16 @@ func (r *UDMExtend) SelectList(u model.UDMExtend) []model.UDMExtend { return rows } -// SelectByIMSIAndNeID 通过imsi和ne_id查询 neId为%时模糊imsi查询 -func (r *UDMExtend) SelectByIMSIAndNeID(imsi, neId string) model.UDMExtend { +// SelectByIMSI 通过imsi查询 neUid为%时模糊imsi查询 +func (r *UDMExtend) SelectByIMSI(coreUid, neUid, imsi string) model.UDMExtend { tx := db.DB("").Model(&model.UDMExtend{}) - // 构建查询条件 - if neId == "%" { + // 查询条件拼接 + if neUid == "%" { + tx = tx.Where("core_uid = ?", coreUid) tx = tx.Where("imsi like ?", fmt.Sprintf("%s%%", imsi)) } else { - tx = tx.Where(" imsi = ? and ne_id = ?", imsi, neId) + tx = tx.Where("core_uid = ? and ne_uid = ?", coreUid, neUid) + tx = tx.Where("imsi = ?", imsi) } // 查询数据 rows := []model.UDMExtend{} @@ -103,13 +111,16 @@ func (r *UDMExtend) Inserts(uArr []model.UDMExtend) int64 { return tx.RowsAffected } -// Delete 删除实体 neId为%时模糊imsi前缀 -func (r *UDMExtend) Delete(imsi, neId string) int64 { +// Delete 删除实体 neUid为%时模糊imsi前缀 +func (r *UDMExtend) DeleteByIMSI(coreUid, neUid, imsi string) int64 { tx := db.DB("") - if neId == "%" { + // 查询条件拼接 + if neUid == "%" { + tx = tx.Where("core_uid = ?", coreUid) tx = tx.Where("imsi like ?", fmt.Sprintf("%s%%", imsi)) } else { - tx = tx.Where(" imsi = ? and ne_id = ?", imsi, neId) + tx = tx.Where("core_uid = ? and ne_uid = ?", coreUid, neUid) + tx = tx.Where("imsi = ?", imsi) } tx = tx.Delete(&model.UDMExtend{}) if err := tx.Error; err != nil { diff --git a/src/modules/ne_data/repository/udm_sub.go b/src/modules/ne_data/repository/udm_sub.go index 36f2eac4..2d7b13fb 100644 --- a/src/modules/ne_data/repository/udm_sub.go +++ b/src/modules/ne_data/repository/udm_sub.go @@ -16,10 +16,10 @@ var NewUDMSub = &UDMSubUser{} type UDMSubUser struct{} // ClearAndInsert 清空ne_id后新增实体 -func (r *UDMSubUser) ClearAndInsert(neId string, u []model.UDMSubUser) int64 { +func (r *UDMSubUser) ClearAndInsert(coreUid, neUid string, u []model.UDMSubUser) int64 { // 不指定neID时,用 TRUNCATE 清空表快 // _, err := datasource.ExecDB("", "TRUNCATE TABLE udm_sub", nil) - result := db.DB("").Where("ne_id = ?", neId).Unscoped().Delete(&model.UDMSubUser{}) + result := db.DB("").Where("core_uid = ? and ne_uid = ?", neUid).Unscoped().Delete(&model.UDMSubUser{}) if result.Error != nil { logger.Errorf("Delete err => %v", result.Error) } @@ -36,8 +36,11 @@ func (r *UDMSubUser) SelectPage(query map[string]string) ([]model.UDMSubUser, in if v, ok := query["msisdn"]; ok && v != "" { tx = tx.Where("msisdn like ?", fmt.Sprintf("%%%s%%", v)) } - if v, ok := query["neId"]; ok && v != "" { - tx = tx.Where("ne_id =?", v) + if v, ok := query["coreUid"]; ok && v != "" { + tx = tx.Where("core_uid = ?", v) + } + if v, ok := query["neUid"]; ok && v != "" { + tx = tx.Where("ne_uid = ?", v) } if v, ok := query["imsis"]; ok && v != "" { arr := strings.Split(v, ",") @@ -86,10 +89,12 @@ func (r *UDMSubUser) SelectList(u model.UDMSubUser) []model.UDMSubUser { if u.IMSI != "" { tx = tx.Where("imsi = ?", u.IMSI) } - if u.NeId != "" { - tx = tx.Where("ne_id = ?", u.NeId) + if u.NeUID != "" { + tx = tx.Where("ne_uid = ?", u.NeUID) + } + if u.CoreUID != "" { + tx = tx.Where("core_uid = ?", u.CoreUID) } - // 查询数据 arr := []model.UDMSubUser{} if err := tx.Order("imsi asc").Find(&arr).Error; err != nil { @@ -98,12 +103,13 @@ func (r *UDMSubUser) SelectList(u model.UDMSubUser) []model.UDMSubUser { return arr } -// SelectByIMSIAndNeID 通过imsi和ne_id查询 -func (r *UDMSubUser) SelectByIMSIAndNeID(imsi, neId string) model.UDMSubUser { +// SelectByIMSIAndNeID 通过imsi查询 +func (r *UDMSubUser) SelectByIMSI(coreUid, neUid, imsi string) model.UDMSubUser { tx := db.DB("").Model(&model.UDMSubUser{}) item := model.UDMSubUser{} // 查询条件拼接 - tx = tx.Where("imsi = ? and ne_id = ?", imsi, neId) + tx = tx.Where("core_uid = ? and ne_uid = ?", coreUid, neUid) + tx = tx.Where("imsi = ?", imsi) // 查询数据 if err := tx.Order("imsi asc").Limit(1).Find(&item).Error; err != nil { logger.Errorf("query err => %v", err) @@ -120,9 +126,12 @@ func (r *UDMSubUser) Inserts(uArr []model.UDMSubUser) int64 { return tx.RowsAffected } -// Delete 删除实体 -func (r *UDMSubUser) Delete(imsi, neId string) int64 { - tx := db.DB("").Where("imsi = ? and ne_id = ?", imsi, neId).Delete(&model.UDMSubUser{}) +// DeleteByIMSI 删除实体 +func (r *UDMSubUser) DeleteByIMSI(coreUid, neUid, imsi string) int64 { + tx := db.DB("") + tx = tx.Where("core_uid = ? and ne_uid = ?", coreUid, neUid) + tx = tx.Where("imsi = ?", imsi) + tx.Delete(&model.UDMSubUser{}) if err := tx.Error; err != nil { logger.Errorf("Delete err => %v", err) } @@ -130,8 +139,11 @@ func (r *UDMSubUser) Delete(imsi, neId string) int64 { } // DeletePrefixByIMSI 删除前缀匹配的实体 -func (r *UDMSubUser) DeletePrefixByIMSI(imsiPrefix, neId string) int64 { - tx := db.DB("").Where("imsi like ? and ne_id = ?", fmt.Sprintf("%s%%", imsiPrefix), neId).Delete(&model.UDMSubUser{}) +func (r *UDMSubUser) DeletePrefixByIMSI(coreUid, neUid, imsiPrefix string) int64 { + tx := db.DB("") + tx = tx.Where("core_uid = ? and ne_uid = ?", coreUid, neUid) + tx = tx.Where("imsi like ?", fmt.Sprintf("%s%%", imsiPrefix)) + tx.Delete(&model.UDMSubUser{}) if err := tx.Error; err != nil { logger.Errorf("DeletePrefixByIMSI err => %v", err) } diff --git a/src/modules/ne_data/repository/udm_voip.go b/src/modules/ne_data/repository/udm_voip.go index 3b1d166b..604fbddd 100644 --- a/src/modules/ne_data/repository/udm_voip.go +++ b/src/modules/ne_data/repository/udm_voip.go @@ -16,10 +16,10 @@ var NewUDMVOIPUser = &UDMVOIPUser{} type UDMVOIPUser struct{} // ClearAndInsert 清空ne_id后新增实体 -func (r UDMVOIPUser) ClearAndInsert(neId string, uArr []model.UDMVOIPUser) int64 { +func (r UDMVOIPUser) ClearAndInsert(coreUid, neUid string, uArr []model.UDMVOIPUser) int64 { // 不指定neID时,用 TRUNCATE 清空表快 // _, err := datasource.ExecDB("", "TRUNCATE TABLE udm_voip", nil) - result := db.DB("").Where("ne_id = ?", neId).Unscoped().Delete(&model.UDMVOIPUser{}) + result := db.DB("").Where("core_uid = ? and ne_uid = ?", coreUid, neUid).Unscoped().Delete(&model.UDMVOIPUser{}) if result.Error != nil { logger.Errorf("Delete err => %v", result.Error) } @@ -33,8 +33,11 @@ func (r UDMVOIPUser) SelectPage(query map[string]string) ([]model.UDMVOIPUser, i if v, ok := query["username"]; ok && v != "" { tx = tx.Where("username like ?", fmt.Sprintf("%%%s%%", v)) } - if v, ok := query["neId"]; ok && v != "" { - tx = tx.Where("ne_id = ?", v) + if v, ok := query["coreUid"]; ok && v != "" { + tx = tx.Where("core_uid = ?", v) + } + if v, ok := query["neUid"]; ok && v != "" { + tx = tx.Where("ne_uid = ?", v) } if v, ok := query["usernames"]; ok && v != "" { arr := strings.Split(v, ",") @@ -85,8 +88,11 @@ func (r UDMVOIPUser) SelectList(u model.UDMVOIPUser) []model.UDMVOIPUser { if u.UserName != "" { tx = tx.Where("username = ?", u.UserName) } - if u.NeId != "" { - tx = tx.Where("ne_id = ?", u.NeId) + if u.NeUID != "" { + tx = tx.Where("ne_uid = ?", u.NeUID) + } + if u.CoreUID != "" { + tx = tx.Where("core_uid = ?", u.CoreUID) } // 查询数据 @@ -97,12 +103,13 @@ func (r UDMVOIPUser) SelectList(u model.UDMVOIPUser) []model.UDMVOIPUser { return arr } -// SelectByUserNameAndNeID 通过username和ne_id查询 -func (r UDMVOIPUser) SelectByUserNameAndNeID(username, neId string) model.UDMVOIPUser { +// SelectByUserName 通过username查询 +func (r UDMVOIPUser) SelectByUserName(coreUid, neUid, username string) model.UDMVOIPUser { tx := db.DB("").Model(&model.UDMVOIPUser{}) item := model.UDMVOIPUser{} // 查询条件拼接 - tx = tx.Where("username = ? and ne_id = ?", username, neId) + tx = tx.Where("core_uid = ? and ne_uid = ?", coreUid, neUid) + tx = tx.Where("username = ?", username) // 查询数据 if err := tx.Order("username asc").Limit(1).Find(&item).Error; err != nil { logger.Errorf("query err => %v", err) @@ -119,9 +126,12 @@ func (r UDMVOIPUser) Inserts(uArr []model.UDMVOIPUser) int64 { return tx.RowsAffected } -// Delete 删除实体 -func (r UDMVOIPUser) Delete(username, neId string) int64 { - tx := db.DB("").Where("username = ? and ne_id = ?", username, neId).Delete(&model.UDMVOIPUser{}) +// DeleteByUserName 删除实体 +func (r UDMVOIPUser) DeleteByUserName(coreUid, neUid, username string) int64 { + tx := db.DB("") + tx = tx.Where("core_uid = ? and ne_uid = ?", coreUid, neUid) + tx = tx.Where("username = ?", username) + tx.Delete(&model.UDMVOIPUser{}) if err := tx.Error; err != nil { logger.Errorf("Delete err => %v", err) } @@ -129,8 +139,11 @@ func (r UDMVOIPUser) Delete(username, neId string) int64 { } // DeletePrefixByUserName 删除前缀匹配的实体 -func (r UDMVOIPUser) DeletePrefixByUserName(username, neId string) int64 { - tx := db.DB("").Where("username like ? and ne_id = ?", fmt.Sprintf("%s%%", username), neId).Delete(&model.UDMVOIPUser{}) +func (r UDMVOIPUser) DeletePrefixByUserName(coreUid, neUid, usernamePrefix string) int64 { + tx := db.DB("") + tx = tx.Where("core_uid = ? and ne_uid = ?", coreUid, neUid) + tx = tx.Where("username like ?", fmt.Sprintf("%s%%", usernamePrefix)) + tx.Delete(&model.UDMVOIPUser{}) if err := tx.Error; err != nil { logger.Errorf("DeletePrefixByUserName err => %v", err) } diff --git a/src/modules/ne_data/repository/udm_volte_ims.go b/src/modules/ne_data/repository/udm_volte_ims.go index ad5956ee..9157e8ce 100644 --- a/src/modules/ne_data/repository/udm_volte_ims.go +++ b/src/modules/ne_data/repository/udm_volte_ims.go @@ -16,10 +16,10 @@ var NewUDMVolteIMSUser = &UDMVolteIMSUser{} type UDMVolteIMSUser struct{} // ClearAndInsert 清空ne_id后新增实体 -func (r UDMVolteIMSUser) ClearAndInsert(neId string, uArr []model.UDMVolteIMSUser) int64 { +func (r UDMVolteIMSUser) ClearAndInsert(coreUid, neUid string, uArr []model.UDMVolteIMSUser) int64 { // 不指定neID时,用 TRUNCATE 清空表快 // _, err := datasource.ExecDB("", "TRUNCATE TABLE udm_volte_ims", nil) - result := db.DB("").Where("ne_id = ?", neId).Unscoped().Delete(&model.UDMVolteIMSUser{}) + result := db.DB("").Where("core_uid = ? and ne_uid = ?", coreUid, neUid).Unscoped().Delete(&model.UDMVolteIMSUser{}) if result.Error != nil { logger.Errorf("Delete err => %v", result.Error) } @@ -36,8 +36,11 @@ func (r UDMVolteIMSUser) SelectPage(query map[string]string) ([]model.UDMVolteIM if v, ok := query["msisdn"]; ok && v != "" { tx = tx.Where("msisdn like ?", fmt.Sprintf("%%%s%%", v)) } - if v, ok := query["neId"]; ok && v != "" { - tx = tx.Where("ne_id = ?", v) + if v, ok := query["coreUid"]; ok && v != "" { + tx = tx.Where("core_uid = ?", v) + } + if v, ok := query["neUid"]; ok && v != "" { + tx = tx.Where("ne_uid = ?", v) } if v, ok := query["tag"]; ok && v != "" { tx = tx.Where("tag = ?", v) @@ -91,12 +94,15 @@ func (r UDMVolteIMSUser) SelectPage(query map[string]string) ([]model.UDMVolteIM func (r UDMVolteIMSUser) SelectList(u model.UDMVolteIMSUser) []model.UDMVolteIMSUser { tx := db.DB("").Model(&model.UDMVolteIMSUser{}) // 查询条件拼接 + if u.NeUID != "" { + tx = tx.Where("ne_uid = ?", u.NeUID) + } + if u.CoreUID != "" { + tx = tx.Where("core_uid = ?", u.CoreUID) + } if u.IMSI != "" { tx = tx.Where("imsi = ?", u.IMSI) } - if u.NeId != "" { - tx = tx.Where("ne_id = ?", u.NeId) - } if u.Tag != "" { tx = tx.Where("tag = ?", u.Tag) } @@ -109,12 +115,13 @@ func (r UDMVolteIMSUser) SelectList(u model.UDMVolteIMSUser) []model.UDMVolteIMS return arr } -// SelectByIMSIAndMSISDNAndNeID 通过imsi,msisdn,ne_id查询 -func (r UDMVolteIMSUser) SelectByIMSIAndMSISDNAndNeID(imsi, msisdn, neId string) model.UDMVolteIMSUser { +// SelectByIMSIAndMSISDN 通过imsi,msisdn查询 +func (r UDMVolteIMSUser) SelectByIMSIAndMSISDN(coreUid, neUid, imsi, msisdn string) model.UDMVolteIMSUser { tx := db.DB("").Model(&model.UDMVolteIMSUser{}) item := model.UDMVolteIMSUser{} // 查询条件拼接 - tx = tx.Where("imsi = ? and msisdn = ? and ne_id = ?", imsi, msisdn, neId) + tx = tx.Where("core_uid = ? and ne_uid = ?", coreUid, neUid) + tx = tx.Where("imsi = ? and msisdn = ?", imsi, msisdn) // 查询数据 if err := tx.Order("imsi asc").Limit(1).Find(&item).Error; err != nil { logger.Errorf("query err => %v", err) @@ -132,8 +139,11 @@ func (r UDMVolteIMSUser) Inserts(uArr []model.UDMVolteIMSUser) int64 { } // Delete 删除实体 -func (r UDMVolteIMSUser) Delete(imsi, neId string) int64 { - tx := db.DB("").Where("imsi = ? and ne_id = ?", imsi, neId).Delete(&model.UDMVolteIMSUser{}) +func (r UDMVolteIMSUser) DeleteByIMSI(coreUid, neUid, imsi string) int64 { + tx := db.DB("") + tx = tx.Where("core_uid = ? and ne_uid = ?", coreUid, neUid) + tx = tx.Where("imsi = ?", imsi) + tx.Delete(&model.UDMVolteIMSUser{}) if err := tx.Error; err != nil { logger.Errorf("Delete err => %v", err) } @@ -141,8 +151,11 @@ func (r UDMVolteIMSUser) Delete(imsi, neId string) int64 { } // DeletePrefixByIMSI 删除前缀匹配的实体 -func (r UDMVolteIMSUser) DeletePrefixByIMSI(imsi, neId string) int64 { - tx := db.DB("").Where("imsi like ? and ne_id = ?", fmt.Sprintf("%s%%", imsi), neId).Delete(&model.UDMVolteIMSUser{}) +func (r UDMVolteIMSUser) DeletePrefixByIMSI(coreUid, neUid, imsiPrefix string) int64 { + tx := db.DB("") + tx = tx.Where("core_uid = ? and ne_uid = ?", coreUid, neUid) + tx = tx.Where("imsi like ?", fmt.Sprintf("%s%%", imsiPrefix)) + tx.Delete(&model.UDMVolteIMSUser{}) if err := tx.Error; err != nil { logger.Errorf("DeletePrefixByIMSI err => %v", err) } diff --git a/src/modules/ne_data/repository/ue_event.go b/src/modules/ne_data/repository/ue_event.go index df390a04..9a734aeb 100644 --- a/src/modules/ne_data/repository/ue_event.go +++ b/src/modules/ne_data/repository/ue_event.go @@ -2,6 +2,7 @@ package repository import ( "fmt" + "sort" "strings" "time" @@ -22,8 +23,11 @@ func (r UEEvent) SelectByPage(neType string, query map[string]string) ([]model.U tableName := fmt.Sprintf("ue_event_%s", strings.ToLower(neType)) tx := db.DB("").Table(tableName).Model(&model.CDREvent{}) // 查询条件拼接 - if v, ok := query["rmUID"]; ok && v != "" { - tx = tx.Where("rm_uid = ?", v) + if v, ok := query["coreUid"]; ok && v != "" { + tx = tx.Where("core_uid = ?", v) + } + if v, ok := query["neUid"]; ok && v != "" { + tx = tx.Where("ne_uid = ?", v) } if v, ok := query["beginTime"]; ok && v != "" { if len(v) == 10 { @@ -58,24 +62,59 @@ func (r UEEvent) SelectByPage(neType string, query map[string]string) ([]model.U pageNum, pageSize := db.PageNumSize(query["pageNum"], query["pageSize"]) tx = tx.Offset(int(pageNum * pageSize)).Limit(int(pageSize)) - // 排序 - if v, ok := query["sortField"]; ok && v != "" { - sortSql := v - if o, ok := query["sortOrder"]; ok && o != "" { - if o == "desc" { - sortSql += " desc " - } else { - sortSql += " asc " - } - } - tx = tx.Order(sortSql) - } - // 查询数据 if err := tx.Find(&rows).Error; err != nil { logger.Errorf("query err => %v", err) } + // 排序 + if v, ok := query["sortField"]; ok && v != "" { + sortField := v + sortOrder := "asc" + if o, ok := query["sortOrder"]; ok && o != "" { + if o == "desc" { + sortOrder = "desc" + } else { + sortOrder = "asc" + } + } + sort.SliceStable(rows, func(i, j int) bool { + // 支持的排序字段映射 + fieldGetters := map[string]func(*model.UEEvent) any{ + "id": func(row *model.UEEvent) any { return row.ID }, + "timestamp": func(row *model.UEEvent) any { return row.CreatedAt }, + "createdAt": func(row *model.UEEvent) any { return row.CreatedAt }, + // 可添加更多支持的字段 + } + + // 获取字段 getter 函数 + getter, ok := fieldGetters[sortField] + if !ok { + // 非法字段,使用默认排序(id升序) + return rows[i].ID < rows[j].ID + } + + // 获取比较值 + valI, valJ := getter(&rows[i]), getter(&rows[j]) + + // 根据字段类型进行比较 + switch v := valI.(type) { + case int64: + if sortOrder == "desc" { + return v > valJ.(int64) + } + return v < valJ.(int64) + case string: + if sortOrder == "desc" { + return v > valJ.(string) + } + return v < valJ.(string) + default: + // 不支持的字段类型,使用默认排序 + return rows[i].ID < rows[j].ID + } + }) + } return rows, total } diff --git a/src/modules/ne_data/service/alarm.go b/src/modules/ne_data/service/alarm.go index c906bc0b..5b73f428 100644 --- a/src/modules/ne_data/service/alarm.go +++ b/src/modules/ne_data/service/alarm.go @@ -64,60 +64,66 @@ func (r Alarm) DeleteByIds(ids []int64) (int64, error) { } // FindAlarmSeqLast 查询网元告警最后一条序号 -func (s Alarm) FindAlarmSeqLast(neType, neId string) int64 { - return s.alarmRepository.SelectAlarmSeqLast(neType, neId) +func (s Alarm) FindAlarmSeqLast(coreUid, neUid string) int64 { + return s.alarmRepository.SelectAlarmSeqLast(coreUid, neUid) } -// ClearByIds 批量清除告警信息 -func (r Alarm) ClearByIds(ids []int64, clearUser, clearType string) (int64, error) { +// ClearById 清除告警信息 +func (r Alarm) ClearById(id int64, coreUid, clearUser, clearType string) (int64, error) { // 检查是否存在 - arr := r.alarmRepository.SelectByIds(ids) - if len(arr) <= 0 { - return 0, fmt.Errorf("no data") + arr := r.alarmRepository.SelectByIds([]int64{id}) + if len(arr) != 1 { + return 0, fmt.Errorf("not match id") } - if len(arr) == len(ids) { - var rows int64 = 0 - for _, v := range arr { - // 状态检查AlarmCode变更告警ID - if v.AlarmCode == constants.ALARM_STATE_CHECK || v.AlarmCode == constants.ALARM_CMD_CHECK || v.AlarmCode == constants.ALARM_LICENSE_CHECK { - v.AlarmId = fmt.Sprintf("%d%d", v.AlarmCode, v.EventTime) - } - v.AlarmStatus = oam.ALARM_STATUS_CLEAR - // 告警清除 - v.ClearType = clearType - v.ClearUser = clearUser - v.ClearTime = time.Now().UnixMilli() - rows += r.alarmRepository.Update(v) + for _, v := range arr { + if v.CoreUID != coreUid { + return 0, fmt.Errorf("data not match, id: %d", v.ID) } - return rows, nil } - return 0, fmt.Errorf("clear fail") + + var rows int64 = 0 + for _, v := range arr { + // 状态检查AlarmCode变更告警ID + if v.AlarmCode == constants.ALARM_STATE_CHECK || v.AlarmCode == constants.ALARM_CMD_CHECK || v.AlarmCode == constants.ALARM_LICENSE_CHECK { + v.AlarmId = fmt.Sprintf("%d%d", v.AlarmCode, v.EventTime) + } + v.AlarmStatus = oam.ALARM_STATUS_CLEAR + // 告警清除 + v.ClearType = clearType + v.ClearUser = clearUser + v.ClearTime = time.Now().UnixMilli() + rows += r.alarmRepository.Update(v) + } + return rows, nil } -// AckByIds 批量确认清除告警信息 -func (r Alarm) AckByIds(ids []int64, ackUser, ackState string) (int64, error) { +// AckById 确认清除告警信息 +func (r Alarm) AckById(id int64, coreUid, ackUser, ackState string) (int64, error) { // 检查是否存在 - arr := r.alarmRepository.SelectByIds(ids) - if len(arr) <= 0 { - return 0, fmt.Errorf("no data") + arr := r.alarmRepository.SelectByIds([]int64{id}) + if len(arr) != 1 { + return 0, fmt.Errorf("not match id") } - if len(arr) == len(ids) { - var rows int64 = 0 - for _, v := range arr { - v.AckState = ackState - v.AckTime = time.Now().UnixMilli() - v.AckUser = ackUser - rows += r.alarmRepository.Update(v) + for _, v := range arr { + if v.CoreUID != coreUid { + return 0, fmt.Errorf("data not match, id: %d", v.ID) } - return rows, nil } - return 0, fmt.Errorf("ack fail") + + var rows int64 = 0 + for _, v := range arr { + v.AckState = ackState + v.AckTime = time.Now().UnixMilli() + v.AckUser = ackUser + rows += r.alarmRepository.Update(v) + } + return rows, nil } // CountType 告警类别数量 -func (s Alarm) CountType(alarmStatus string) []map[string]any { +func (s Alarm) CountType(coreUid, alarmStatus string) []map[string]any { data := []map[string]any{} alarmTypeArr := []string{ oam.ALARM_TYPE_COMMUNICATION_ALARM, @@ -134,7 +140,7 @@ func (s Alarm) CountType(alarmStatus string) []map[string]any { } // 告警类别数量 - rows := s.alarmRepository.GroupTotal(alarmStatus, "alarm_type", -1) + rows := s.alarmRepository.GroupTotal(coreUid, alarmStatus, "alarm_type", -1) for _, item := range data { for _, v := range rows { str := fmt.Sprint(v["alarm_type"]) @@ -148,7 +154,7 @@ func (s Alarm) CountType(alarmStatus string) []map[string]any { } // CountSeverity 告警级别数量 -func (s Alarm) CountSeverity(alarmStatus string) []map[string]any { +func (s Alarm) CountSeverity(coreUid, alarmStatus string) []map[string]any { data := []map[string]any{} alarmTypeArr := []string{ oam.ALARM_SEVERITY_CRITICAL, @@ -164,7 +170,7 @@ func (s Alarm) CountSeverity(alarmStatus string) []map[string]any { } // 数量 - rows := s.alarmRepository.GroupTotal(alarmStatus, "perceived_severity", -1) + rows := s.alarmRepository.GroupTotal(coreUid, alarmStatus, "perceived_severity", -1) for _, item := range data { for _, v := range rows { str := fmt.Sprint(v["perceived_severity"]) @@ -178,8 +184,8 @@ func (s Alarm) CountSeverity(alarmStatus string) []map[string]any { } // CountNe 告警状态前几排名 -func (s Alarm) CountNe(alarmStatus string, top int) []map[string]any { - data := s.alarmRepository.GroupTotal(alarmStatus, "ne_type", top) +func (s Alarm) CountNe(coreUid, alarmStatus string, top int) []map[string]any { + data := s.alarmRepository.GroupTotal(coreUid, alarmStatus, "ne_type", top) for _, v := range data { v["neType"] = fmt.Sprint(v["ne_type"]) v["total"] = parse.Number(v["total"]) @@ -252,8 +258,8 @@ func (r Alarm) ExportXlsx(rows []model.Alarm, fileName, language, alarmStatus st "E" + idx: row.AlarmId, "F" + idx: row.AlarmCode, "G" + idx: row.NeType, - "H" + idx: row.NeName, - "I" + idx: row.NeId, + "H" + idx: row.NeUID, + "I" + idx: row.CoreUID, } if alarmStatus == "0" { clearTimeStr := date.ParseDateToStr(row.ClearTime, date.YYYY_MM_DDTHH_MM_SSZ) diff --git a/src/modules/ne_data/service/alarm_event.go b/src/modules/ne_data/service/alarm_event.go index 2f142f31..79b66cef 100644 --- a/src/modules/ne_data/service/alarm_event.go +++ b/src/modules/ne_data/service/alarm_event.go @@ -57,29 +57,32 @@ func (r AlarmEvent) DeleteByIds(ids []int64) (int64, error) { } // FindAlarmEventSeqLast 查询网元告警最后一条序号 -func (s AlarmEvent) FindAlarmEventSeqLast(neType, neId string) int64 { - return s.alarmEventRepository.SelectAlarmEventSeqLast(neType, neId) +func (s AlarmEvent) FindAlarmEventSeqLast(coreUid, neUid string) int64 { + return s.alarmEventRepository.SelectAlarmEventSeqLast(coreUid, neUid) } -// ClearByIds 批量清除告警信息 -func (r AlarmEvent) ClearByIds(ids []int64, clearUser, clearType string) (int64, error) { +// ClearById 清除告警信息 +func (r AlarmEvent) ClearById(id int64, coreUid, clearUser, clearType string) (int64, error) { // 检查是否存在 - arr := r.alarmEventRepository.SelectByIds(ids) - if len(arr) <= 0 { - return 0, fmt.Errorf("no data") + arr := r.alarmEventRepository.SelectByIds([]int64{id}) + if len(arr) != 1 { + return 0, fmt.Errorf("not match id") } - if len(arr) == len(ids) { - var rows int64 = 0 - for _, v := range arr { - v.AlarmStatus = oam.ALARM_STATUS_CLEAR - // 告警清除 - v.ClearType = clearType - v.ClearUser = clearUser - v.ClearTime = time.Now().UnixMilli() - rows += r.alarmEventRepository.Update(v) + for _, v := range arr { + if v.CoreUID != coreUid { + return 0, fmt.Errorf("data not match, id: %d", v.ID) } - return rows, nil } - return 0, fmt.Errorf("clear fail") + + var rows int64 = 0 + for _, v := range arr { + v.AlarmStatus = oam.ALARM_STATUS_CLEAR + // 告警清除 + v.ClearType = clearType + v.ClearUser = clearUser + v.ClearTime = time.Now().UnixMilli() + rows += r.alarmEventRepository.Update(v) + } + return rows, nil } diff --git a/src/modules/ne_data/service/cbc_message.go b/src/modules/ne_data/service/cbc_message.go index 2d0101fe..8f4463b7 100644 --- a/src/modules/ne_data/service/cbc_message.go +++ b/src/modules/ne_data/service/cbc_message.go @@ -322,11 +322,11 @@ func (s *CBCMessage) handleStatusChange(msg model.CBCMessage, oldStatus, newStat // 这个方法需要根据你的实际网元管理系统来实现 func (s *CBCMessage) getCBCNetworkElement(neId string) (string, int64, error) { // 查询网元信息 - neInfo := neService.NewNeInfo.FindByNeTypeAndNeID("CBC", neId) - if neInfo.IP == "" { + neInfo := neService.NewNeInfo.FindByCoreUidAndNeUid("CBC", neId) + if neInfo.IPAddr == "" { return "", 0, fmt.Errorf("CBC network element not found for neId: %s", neId) } - return neInfo.IP, neInfo.Port, nil + return neInfo.IPAddr, neInfo.Port, nil } // CBCHTTPClient CBC网元HTTP客户端 diff --git a/src/modules/ne_data/service/cdr_event.go b/src/modules/ne_data/service/cdr_event.go index 2f3b5a17..70b8191b 100644 --- a/src/modules/ne_data/service/cdr_event.go +++ b/src/modules/ne_data/service/cdr_event.go @@ -128,7 +128,7 @@ func (r CDREvent) ExportSMSC(rows []model.CDREvent, fileName, language string) ( dataCells = append(dataCells, map[string]any{ "A" + idx: row.ID, - "B" + idx: row.NeName, + "B" + idx: row.NeUID, "C" + idx: recordType, "D" + idx: serviceType, "E" + idx: caller, @@ -301,8 +301,8 @@ func (r CDREvent) ExportSMF(rows []model.CDREvent, fileName string) (string, err dataCells = append(dataCells, map[string]any{ "A" + idx: row.ID, "B" + idx: chargingID, - "C" + idx: row.NeName, - "D" + idx: row.RmUid, + "C" + idx: row.CoreUID, + "D" + idx: row.NeUID, "E" + idx: subscriptionIDData, "F" + idx: subscriptionIDType, "G" + idx: dataVolumeUplink, @@ -489,8 +489,8 @@ func (r CDREvent) ExportSGWC(rows []model.CDREvent, fileName string) (string, er dataCells = append(dataCells, map[string]any{ "A" + idx: row.ID, - "B" + idx: row.NeName, - "C" + idx: row.RmUid, + "B" + idx: row.NeUID, + "C" + idx: row.CoreUID, "D" + idx: chargingID, "E" + idx: servedIMSI, "F" + idx: servedMSISDN, @@ -627,7 +627,7 @@ func (r CDREvent) ExportIMS(rows []model.CDREvent, fileName, language string) (s dataCells = append(dataCells, map[string]any{ "A" + idx: row.ID, - "B" + idx: row.NeName, + "B" + idx: row.NeUID, "C" + idx: recordType, "D" + idx: callTypeLable, "E" + idx: caller, diff --git a/src/modules/ne_data/service/kpi_c_report.go b/src/modules/ne_data/service/kpi_c_report.go index 866fff1a..3046e3b8 100644 --- a/src/modules/ne_data/service/kpi_c_report.go +++ b/src/modules/ne_data/service/kpi_c_report.go @@ -48,8 +48,8 @@ func (s KpiCReport) FindData(query model.KPICQuery) []map[string]any { item := map[string]any{ "neType": row.NeType, - "neName": row.NeName, - "rmUID": row.RmUid, + "neUid": row.NeUID, + "coreUID": row.CoreUID, "startIndex": row.Index, "timeGroup": row.CreatedAt, } diff --git a/src/modules/ne_data/service/kpi_report.go b/src/modules/ne_data/service/kpi_report.go index db59c5e0..5f6da201 100644 --- a/src/modules/ne_data/service/kpi_report.go +++ b/src/modules/ne_data/service/kpi_report.go @@ -46,8 +46,8 @@ func (s KpiReport) FindData(query model.KPIQuery) []map[string]any { item := map[string]any{ "neType": row.NeType, - "neName": row.NeName, - "rmUID": row.RmUid, + "neUid": row.NeUID, + "coreUID": row.CoreUID, "startIndex": row.Index, "timeGroup": row.CreatedAt, } @@ -174,7 +174,7 @@ func (r KpiReport) TitleInsert(param model.KpiTitle) int64 { // UPFTodayFlowFind 查询UPF总流量 N3上行 N6下行 // day 统计天数 // down * 8 / 1000 / 1000 单位M -func (r KpiReport) UPFTodayFlowFind(rmUID string, day int) (int64, int64) { +func (r KpiReport) UPFTodayFlowFind(neUid string, day int) (int64, int64) { // 获取当前日期 now := time.Now() var upTotal, downTotal int64 @@ -182,7 +182,7 @@ func (r KpiReport) UPFTodayFlowFind(rmUID string, day int) (int64, int64) { // 查询最近day天的数据 for i := 0; i <= day; i++ { dateKey := now.AddDate(0, 0, -i).Format("2006-01-02") - key := fmt.Sprintf("%s:UPF_FLOW:%s:%s", constants.CACHE_NE_DATA, rmUID, dateKey) + key := fmt.Sprintf("%s:UPF_FLOW:%s:%s", constants.CACHE_NE_DATA, neUid, dateKey) // 读取缓存数据 up, err := redis.GetHash("", key, "up") @@ -202,10 +202,10 @@ func (r KpiReport) UPFTodayFlowFind(rmUID string, day int) (int64, int64) { } // UPFTodayFlow UPF流量今日统计 -func (r KpiReport) UPFTodayFlowUpdate(rmUID string, upValue, downValue int64) error { +func (r KpiReport) UPFTodayFlowUpdate(neUid string, upValue, downValue int64) error { // 按日期存储统计数据 dateKey := time.Now().Format("2006-01-02") - key := fmt.Sprintf("%s:UPF_FLOW:%s:%s", constants.CACHE_NE_DATA, rmUID, dateKey) + key := fmt.Sprintf("%s:UPF_FLOW:%s:%s", constants.CACHE_NE_DATA, neUid, dateKey) // 使用HIncrBy实时累加统计值 if err := redis.IncrBy("", key, "up", upValue); err != nil { @@ -232,16 +232,16 @@ func (r KpiReport) UPFTodayFlowLoad(day int) { if len(jsonStr) > 7 { json.Unmarshal([]byte(jsonStr), &v) } - if v.NeType == "UPF" && v.RmUID != "" { + if v.NeType == "UPF" && v.NeUID != "" { // 查询最近day天的数据 for i := 0; i <= day; i++ { dateKey := now.AddDate(0, 0, -i).Format("2006-01-02") - key := fmt.Sprintf("%s:UPF_FLOW:%s:%s", constants.CACHE_NE_DATA, v.RmUID, dateKey) + key := fmt.Sprintf("%s:UPF_FLOW:%s:%s", constants.CACHE_NE_DATA, v.NeUID, dateKey) // 根据传入天数计算时间范围 beginTime := now.AddDate(0, 0, -i).Truncate(24 * time.Hour).UnixMilli() endTime := beginTime + 24*60*60*1000 - 1 // 查询历史数据 - rows := r.kpiReportRepository.SelectUPF(v.RmUID, beginTime, endTime) + rows := r.kpiReportRepository.SelectUPF(v.CoreUID, v.NeUID, beginTime, endTime) var upTotal, downTotal int64 // 处理历史数据 diff --git a/src/modules/ne_data/service/udm_auth.go b/src/modules/ne_data/service/udm_auth.go index 3140affc..7ec12698 100644 --- a/src/modules/ne_data/service/udm_auth.go +++ b/src/modules/ne_data/service/udm_auth.go @@ -23,13 +23,13 @@ type UDMAuthUser struct { } // dataByRedis UDM鉴权用户 db:0 中 ausf:* -func (r *UDMAuthUser) dataByRedis(imsi, neId string) []model.UDMAuthUser { +func (r *UDMAuthUser) dataByRedis(coreUid, neUid, imsi string) []model.UDMAuthUser { arr := []model.UDMAuthUser{} key := fmt.Sprintf("ausf:%s", imsi) - source := fmt.Sprintf("UDM_%s", neId) + source := fmt.Sprintf("UDM_%s", neUid) // 网元主机的Redis客户端 - redisClient, err := neService.NewNeInfo.NeRunRedisClient("UDM", neId) + redisClient, err := neService.NewNeInfo.NeRunRedisClient(coreUid, neUid) if err != nil { return arr } @@ -64,12 +64,14 @@ func (r *UDMAuthUser) dataByRedis(imsi, neId string) []model.UDMAuthUser { amf = strings.Replace(v, "\r\n", "", 1) } a := model.UDMAuthUser{ + CoreUID: coreUid, + NeUID: neUid, + NeType: "UDM", IMSI: imsi, Amf: amf, Ki: m["ki"], AlgoIndex: m["algo"], Opc: m["opc"], - NeId: neId, } arr = append(arr, a) } @@ -77,20 +79,20 @@ func (r *UDMAuthUser) dataByRedis(imsi, neId string) []model.UDMAuthUser { } // ResetData 重置鉴权用户数据,清空数据库重新同步Redis数据 -func (r *UDMAuthUser) ResetData(neId string) int64 { - authArr := r.dataByRedis("*", neId) +func (r *UDMAuthUser) ResetData(coreUid, neUid string) int64 { + authArr := r.dataByRedis(coreUid, neUid, "*") // 数据清空后添加 - go r.udmAuthRepository.ClearAndInsert(neId, authArr) + go r.udmAuthRepository.ClearAndInsert(coreUid, neUid, authArr) return int64(len(authArr)) } // ParseInfo 解析单个用户imsi鉴权信息 data从命令MML得到的结果 -func (r *UDMAuthUser) ParseInfo(imsi, neId string, data map[string]string) model.UDMAuthUser { - u := r.udmAuthRepository.SelectByIMSIAndNeID(imsi, neId) - +func (r *UDMAuthUser) ParseInfo(coreUid, neUid, imsi string, data map[string]string) model.UDMAuthUser { + u := r.udmAuthRepository.SelectByIMSI(coreUid, neUid, imsi) + u.CoreUID = coreUid + u.NeUID = neUid + u.NeType = "UDM" // 用于更新 - u.IMSI = imsi - u.NeId = neId u.Amf = data["amf"] u.Ki = data["ki"] u.AlgoIndex = data["algo"] @@ -110,17 +112,17 @@ func (r *UDMAuthUser) Find(u model.UDMAuthUser) []model.UDMAuthUser { // Insert 从数据中读取后删除imsi再存入数据库 // imsi长度15,ki长度32,opc长度0或者32 -func (r *UDMAuthUser) Insert(neId string, u model.UDMAuthUser) int64 { - uArr := r.dataByRedis(u.IMSI, neId) +func (r *UDMAuthUser) Insert(coreUid, neUid string, u model.UDMAuthUser) int64 { + uArr := r.dataByRedis(coreUid, neUid, u.IMSI) if len(uArr) > 0 { - r.udmAuthRepository.Delete(u.IMSI, neId) + r.udmAuthRepository.DeleteByIMSI(coreUid, neUid, u.IMSI) return r.udmAuthRepository.Inserts(uArr) } return 0 } // InsertData 导入文件数据 dataType目前两种:txt/csv -func (r *UDMAuthUser) InsertData(neId, dataType string, data any) int64 { +func (r *UDMAuthUser) InsertData(coreUid, neUid, dataType string, data any) int64 { // imsi截取前缀,重新获取部分数据 prefixes := make(map[string]struct{}) @@ -149,9 +151,9 @@ func (r *UDMAuthUser) InsertData(neId, dataType string, data any) int64 { var num int64 = 0 for prefix := range prefixes { // 直接删除前缀的记录 - r.udmAuthRepository.DeletePrefixByIMSI(prefix, neId) + r.udmAuthRepository.DeletePrefixByIMSI(coreUid, neUid, prefix) // keys ausf:4600001000004* - arr := r.dataByRedis(prefix+"*", neId) + arr := r.dataByRedis(coreUid, neUid, prefix+"*") if len(arr) > 0 { num += r.udmAuthRepository.Inserts(arr) } @@ -160,21 +162,20 @@ func (r *UDMAuthUser) InsertData(neId, dataType string, data any) int64 { } // Delete 删除单个不重新加载 -func (r *UDMAuthUser) Delete(imsi, neId string) int64 { - return r.udmAuthRepository.Delete(imsi, neId) +func (r *UDMAuthUser) Delete(coreUid, neUid, imsi string) int64 { + return r.udmAuthRepository.DeleteByIMSI(coreUid, neUid, imsi) } // LoadData 重新加载从imsi开始num的数据 -func (r *UDMAuthUser) LoadData(neId, imsi, num string) { +func (r *UDMAuthUser) LoadData(coreUid, neUid, imsi string, num int64) { startIMSI, _ := strconv.ParseInt(imsi, 10, 64) - subNum, _ := strconv.ParseInt(num, 10, 64) var i int64 - for i = 0; i < subNum; i++ { + for i = 0; i < num; i++ { keyIMSI := fmt.Sprintf("%015d", startIMSI+i) // 删除原数据 - r.udmAuthRepository.Delete(keyIMSI, neId) + r.udmAuthRepository.DeleteByIMSI(coreUid, neUid, keyIMSI) // 加载数据 - arr := r.dataByRedis(keyIMSI, neId) + arr := r.dataByRedis(coreUid, neUid, keyIMSI) if len(arr) < 1 { continue } diff --git a/src/modules/ne_data/service/udm_extend.go b/src/modules/ne_data/service/udm_extend.go index 3542ff54..410e5a41 100644 --- a/src/modules/ne_data/service/udm_extend.go +++ b/src/modules/ne_data/service/udm_extend.go @@ -17,17 +17,17 @@ type UDMExtend struct { } // FindByIMSIAndNeID 通过IMSI和网元标识查询信息 neId为%时模糊imsi查询 -func (r UDMExtend) FindByIMSIAndNeID(imsi, neId string) model.UDMExtend { - return r.UDMExtendRepository.SelectByIMSIAndNeID(imsi, neId) +func (r UDMExtend) FindByIMSIAndNeID(coreUid, neUid, imsi string) model.UDMExtend { + return r.UDMExtendRepository.SelectByIMSI(coreUid, neUid, imsi) } // Save 新增或修改信息 func (r UDMExtend) Save(u model.UDMExtend) bool { - r.UDMExtendRepository.Delete(u.IMSI, u.NeId) + r.UDMExtendRepository.DeleteByIMSI(u.CoreUID, u.NeUID, u.IMSI) return r.UDMExtendRepository.Inserts([]model.UDMExtend{u}) > 0 } // Delete 删除信息 neId为%时模糊imsi查询 -func (r UDMExtend) Delete(imsi, neId string) int64 { - return r.UDMExtendRepository.Delete(imsi, neId) +func (r UDMExtend) Delete(coreUid, neUid, imsi string) int64 { + return r.UDMExtendRepository.DeleteByIMSI(coreUid, neUid, imsi) } diff --git a/src/modules/ne_data/service/udm_sub.go b/src/modules/ne_data/service/udm_sub.go index 7c9486aa..424042a2 100644 --- a/src/modules/ne_data/service/udm_sub.go +++ b/src/modules/ne_data/service/udm_sub.go @@ -24,13 +24,13 @@ type UDMSubUser struct { } // dataByRedis UDM签约用户 db:0 中 udm-sd:* -func (r *UDMSubUser) dataByRedis(imsi, neId string) []model.UDMSubUser { +func (r *UDMSubUser) dataByRedis(coreUid, neUid, imsi string) []model.UDMSubUser { arr := []model.UDMSubUser{} key := fmt.Sprintf("udm-sd:%s", imsi) - source := fmt.Sprintf("UDM_%s", neId) + source := fmt.Sprintf("UDM_%s", neUid) // 网元主机的Redis客户端 - redisClient, err := neService.NewNeInfo.NeRunRedisClient("UDM", neId) + redisClient, err := neService.NewNeInfo.NeRunRedisClient(coreUid, neUid) if err != nil { return arr } @@ -61,12 +61,14 @@ func (r *UDMSubUser) dataByRedis(imsi, neId string) []model.UDMSubUser { } a := model.UDMSubUser{ - IMSI: imsi, // udm-sd:360000100000130 - MSISDN: m["gpsi"], // 8612300000130 - NeId: neId, - SmfSel: m["smf-sel"], // def_snssai - SmData: m["sm-dat"], // 1-000001&cmnet&ims&3gnet - Cag: m["cag"], // def_cag + CoreUID: coreUid, + NeUID: neUid, + NeType: "UDM", + IMSI: imsi, // udm-sd:360000100000130 + MSISDN: m["gpsi"], // 8612300000130 + SmfSel: m["smf-sel"], // def_snssai + SmData: m["sm-dat"], // 1-000001&cmnet&ims&3gnet + Cag: m["cag"], // def_cag } // def_ambr,def_nssai,0,def_arfb,def_sar,3,1,12000,1,1000,0,1,- @@ -123,16 +125,16 @@ func (r *UDMSubUser) dataByRedis(imsi, neId string) []model.UDMSubUser { } // ResetData 重置鉴权用户数据,清空数据库重新同步Redis数据 -func (r *UDMSubUser) ResetData(neId string) int64 { - subArr := r.dataByRedis("*", neId) +func (r *UDMSubUser) ResetData(coreUid, neUid string) int64 { + subArr := r.dataByRedis(coreUid, neUid, "*") // 数据清空后添加 - go r.udmSubRepository.ClearAndInsert(neId, subArr) + go r.udmSubRepository.ClearAndInsert(coreUid, neUid, subArr) return int64(len(subArr)) } // ParseInfo 解析单个用户imsi签约信息 data从命令MML得到的结果 -func (r *UDMSubUser) ParseInfo(imsi, neId string, data map[string]string) model.UDMSubUser { - u := r.udmSubRepository.SelectByIMSIAndNeID(imsi, neId) +func (r *UDMSubUser) ParseInfo(coreUid, neUid, imsi string, data map[string]string) model.UDMSubUser { + u := r.udmSubRepository.SelectByIMSI(coreUid, neUid, imsi) cnType, _ := strconv.ParseInt(data["CNType"][:4], 0, 64) // 0x03(EPC|5GC) rat, _ := strconv.ParseInt(data["RAT"][:4], 0, 64) // 0x00(VIRTUAL|WLAN|EUTRA|NR) @@ -142,9 +144,11 @@ func (r *UDMSubUser) ParseInfo(imsi, neId string, data map[string]string) model. } // 用于更新 + u.CoreUID = coreUid + u.NeUID = neUid + u.NeType = "UDM" u.IMSI = imsi u.MSISDN = msisdn - u.NeId = neId u.UeAmbrTpl = data["AMBR"] u.NssaiTpl = data["NSSAI"] u.AreaForbiddenTpl = data["AreaForbidden"] @@ -172,7 +176,7 @@ func (r *UDMSubUser) ParseInfo(imsi, neId string, data map[string]string) model. } // 补充用户拓展信息 - info := r.UDMExtendRepository.SelectByIMSIAndNeID(imsi, neId) + info := r.UDMExtendRepository.SelectByIMSI(coreUid, neUid, imsi) if info.IMSI == imsi { u.Remark = info.Remark } @@ -191,18 +195,20 @@ func (r *UDMSubUser) Find(u model.UDMSubUser) []model.UDMSubUser { // Insert 从数据中读取后删除imsi再存入数据库 // imsi长度15,ki长度32,opc长度0或者32 -func (r *UDMSubUser) Insert(neId string, u model.UDMSubUser) int64 { - uArr := r.dataByRedis(u.IMSI, neId) +func (r *UDMSubUser) Insert(coreUid, neUid string, u model.UDMSubUser) int64 { + uArr := r.dataByRedis(coreUid, neUid, u.IMSI) if len(uArr) > 0 { - r.udmSubRepository.Delete(u.IMSI, neId) + r.udmSubRepository.DeleteByIMSI(coreUid, neUid, u.IMSI) // 新增到拓展信息 if u.Remark != "" { - r.UDMExtendRepository.Delete(u.IMSI, "%") + r.UDMExtendRepository.DeleteByIMSI(coreUid, "%", u.IMSI) r.UDMExtendRepository.Inserts([]model.UDMExtend{{ - IMSI: u.IMSI, - MSISDN: u.MSISDN, - NeId: u.NeId, - Remark: u.Remark, + CoreUID: u.CoreUID, + NeUID: u.NeUID, + NeType: u.NeType, + IMSI: u.IMSI, + MSISDN: u.MSISDN, + Remark: u.Remark, }}) } return r.udmSubRepository.Inserts(uArr) @@ -211,7 +217,7 @@ func (r *UDMSubUser) Insert(neId string, u model.UDMSubUser) int64 { } // InsertData 导入文件数据 dataType目前两种:txt/csv -func (r *UDMSubUser) InsertData(neId, dataType string, data any) int64 { +func (r *UDMSubUser) InsertData(coreUid, neUid, dataType string, data any) int64 { // imsi截取前缀,重新获取部分数据 prefixes := make(map[string]struct{}) @@ -240,9 +246,9 @@ func (r *UDMSubUser) InsertData(neId, dataType string, data any) int64 { var num int64 = 0 for prefix := range prefixes { // keys udm-sd:4600001000004* - arr := r.dataByRedis(prefix+"*", neId) + arr := r.dataByRedis(coreUid, neUid, prefix+"*") if len(arr) > 0 { - r.udmSubRepository.DeletePrefixByIMSI(prefix, neId) + r.udmSubRepository.DeletePrefixByIMSI(coreUid, neUid, prefix) num += r.udmSubRepository.Inserts(arr) } } @@ -250,27 +256,26 @@ func (r *UDMSubUser) InsertData(neId, dataType string, data any) int64 { } // Delete 删除单个不重新加载 -func (r *UDMSubUser) Delete(neId, imsi string) int64 { +func (r *UDMSubUser) Delete(coreUid, neUid, imsi string) int64 { // 删除拓展信息 - r.UDMExtendRepository.Delete(imsi, neId) - return r.udmSubRepository.Delete(imsi, neId) + r.UDMExtendRepository.DeleteByIMSI(coreUid, neUid, imsi) + return r.udmSubRepository.DeleteByIMSI(coreUid, neUid, imsi) } // LoadData 重新加载从imsi开始num的数据 // remark不为空,则新增到拓展信息,删除标记为-(Deleted)- -func (r *UDMSubUser) LoadData(neId, imsi, num, remark string) { +func (r *UDMSubUser) LoadData(coreUid, neUid, imsi string, num int64, remark string) { startIMSI, _ := strconv.ParseInt(imsi, 10, 64) - subNum, _ := strconv.ParseInt(num, 10, 64) var i int64 - for i = 0; i < subNum; i++ { + for i = 0; i < num; i++ { keyIMSI := fmt.Sprintf("%015d", startIMSI+i) // 删除原数据 - r.udmSubRepository.Delete(keyIMSI, neId) + r.udmSubRepository.DeleteByIMSI(coreUid, neUid, keyIMSI) if remark == "-(Deleted)-" { - r.UDMExtendRepository.Delete(keyIMSI, "%") + r.UDMExtendRepository.DeleteByIMSI(coreUid, "%", keyIMSI) } // 加载数据,删除标记为-(Deleted)-加载为空不插入 - arr := r.dataByRedis(keyIMSI, neId) + arr := r.dataByRedis(coreUid, neUid, keyIMSI) if len(arr) < 1 { continue } @@ -280,13 +285,15 @@ func (r *UDMSubUser) LoadData(neId, imsi, num, remark string) { uarr := make([]model.UDMExtend, 0, len(arr)) for _, v := range arr { uarr = append(uarr, model.UDMExtend{ - IMSI: v.IMSI, - MSISDN: v.MSISDN, - NeId: v.NeId, - Remark: remark, + CoreUID: v.CoreUID, + NeUID: v.NeUID, + NeType: v.NeType, + IMSI: v.IMSI, + MSISDN: v.MSISDN, + Remark: remark, }) } - r.UDMExtendRepository.Delete(keyIMSI, neId) + r.UDMExtendRepository.DeleteByIMSI(coreUid, neUid, keyIMSI) r.UDMExtendRepository.Inserts(uarr) } } diff --git a/src/modules/ne_data/service/udm_voip.go b/src/modules/ne_data/service/udm_voip.go index 30457b73..f4a9afa0 100644 --- a/src/modules/ne_data/service/udm_voip.go +++ b/src/modules/ne_data/service/udm_voip.go @@ -23,13 +23,13 @@ type UDMVOIPUser struct { } // dataByRedis UDMVOIP用户 db:0 中 voip:* -func (r UDMVOIPUser) dataByRedis(username, neId string) []model.UDMVOIPUser { +func (r UDMVOIPUser) dataByRedis(coreUid, neUid, username string) []model.UDMVOIPUser { arr := []model.UDMVOIPUser{} key := fmt.Sprintf("voip:%s", username) - source := fmt.Sprintf("UDM_%s", neId) + source := fmt.Sprintf("UDM_%s", neUid) // 网元主机的Redis客户端 - redisClient, err := neService.NewNeInfo.NeRunRedisClient("UDM", neId) + redisClient, err := neService.NewNeInfo.NeRunRedisClient(coreUid, neUid) if err != nil { return arr } @@ -56,7 +56,9 @@ func (r UDMVOIPUser) dataByRedis(username, neId string) []model.UDMVOIPUser { } a := model.UDMVOIPUser{ - NeId: neId, + CoreUID: coreUid, + NeUID: neUid, + NeType: "UDM", UserName: username, Password: m["password"], } @@ -66,23 +68,25 @@ func (r UDMVOIPUser) dataByRedis(username, neId string) []model.UDMVOIPUser { } // ResetData 重置VOIP用户数据,清空数据库重新同步Redis数据 -func (r UDMVOIPUser) ResetData(neId string) int64 { - arr := r.dataByRedis("*", neId) +func (r UDMVOIPUser) ResetData(coreUid, neUid string) int64 { + arr := r.dataByRedis(coreUid, neUid, "*") // 数据清空后添加 - go r.udmVOIPRepository.ClearAndInsert(neId, arr) + go r.udmVOIPRepository.ClearAndInsert(coreUid, neUid, arr) return int64(len(arr)) } // ParseInfo 解析单个用户userName信息 data从命令MML得到的结果 -func (r UDMVOIPUser) ParseInfo(neId string, data map[string]string) model.UDMVOIPUser { +func (r UDMVOIPUser) ParseInfo(coreUid, neUid string, data map[string]string) model.UDMVOIPUser { u := model.UDMVOIPUser{ - NeId: neId, + CoreUID: coreUid, + NeUID: neUid, + NeType: "UDM", UserName: data["username"], Password: data["password"], } // 赋予ID - item := r.udmVOIPRepository.SelectByUserNameAndNeID(u.UserName, neId) - if item.ID != "" { + item := r.udmVOIPRepository.SelectByUserName(coreUid, neUid, u.UserName) + if item.ID > 0 { u.ID = item.ID } return u @@ -99,17 +103,17 @@ func (r UDMVOIPUser) Find(u model.UDMVOIPUser) []model.UDMVOIPUser { } // Insert 从数据中读取后删除username再存入数据库 -func (r UDMVOIPUser) Insert(neId string, username string) int64 { - uArr := r.dataByRedis(username, neId) +func (r UDMVOIPUser) Insert(coreUid, neUid string, username string) int64 { + uArr := r.dataByRedis(coreUid, neUid, username) if len(uArr) > 0 { - r.udmVOIPRepository.Delete(username, neId) + r.udmVOIPRepository.DeleteByUserName(coreUid, neUid, username) return r.udmVOIPRepository.Inserts(uArr) } return 0 } // InsertData 导入文件数据 dataType目前两种:txt/csv -func (r UDMVOIPUser) InsertData(neId, dataType string, data any) int64 { +func (r UDMVOIPUser) InsertData(coreUid, neUid, dataType string, data any) int64 { // imsi截取前缀,重新获取部分数据 prefixes := make(map[string]struct{}) @@ -138,9 +142,9 @@ func (r UDMVOIPUser) InsertData(neId, dataType string, data any) int64 { var num int64 = 0 for prefix := range prefixes { // 直接删除前缀的记录 - r.udmVOIPRepository.DeletePrefixByUserName(prefix, neId) + r.udmVOIPRepository.DeletePrefixByUserName(coreUid, neUid, prefix) // keys voip:4600001000004* - arr := r.dataByRedis(prefix+"*", neId) + arr := r.dataByRedis(coreUid, neUid, prefix+"*") if len(arr) > 0 { num += r.udmVOIPRepository.Inserts(arr) } @@ -149,21 +153,20 @@ func (r UDMVOIPUser) InsertData(neId, dataType string, data any) int64 { } // Delete 删除单个不重新加载 -func (r UDMVOIPUser) Delete(username, neId string) int64 { - return r.udmVOIPRepository.Delete(username, neId) +func (r UDMVOIPUser) Delete(coreUid, neUid, username string) int64 { + return r.udmVOIPRepository.DeleteByUserName(coreUid, neUid, username) } // LoadData 重新加载从username开始num的数据 -func (r UDMVOIPUser) LoadData(neId, username, num string) { +func (r UDMVOIPUser) LoadData(coreUid, neUid, username string, num int64) { startUserName, _ := strconv.ParseInt(username, 10, 64) - subNum, _ := strconv.ParseInt(num, 10, 64) var i int64 - for i = 0; i < subNum; i++ { + for i = 0; i < num; i++ { keyUserName := fmt.Sprintf("%d", startUserName+i) // 删除原数据 - r.udmVOIPRepository.Delete(keyUserName, neId) + r.udmVOIPRepository.DeleteByUserName(coreUid, neUid, keyUserName) // 加载数据 - arr := r.dataByRedis(keyUserName, neId) + arr := r.dataByRedis(coreUid, neUid, keyUserName) if len(arr) < 1 { continue } diff --git a/src/modules/ne_data/service/udm_volte_ims.go b/src/modules/ne_data/service/udm_volte_ims.go index 181bc86e..8ad98f51 100644 --- a/src/modules/ne_data/service/udm_volte_ims.go +++ b/src/modules/ne_data/service/udm_volte_ims.go @@ -23,13 +23,13 @@ type UDMVolteIMSUser struct { } // dataByRedis UDMVolteIMS用户 db:0 中 volte:* -func (r UDMVolteIMSUser) dataByRedis(imsi, neId string) []model.UDMVolteIMSUser { +func (r UDMVolteIMSUser) dataByRedis(coreUid, neUid, imsi string) []model.UDMVolteIMSUser { arr := []model.UDMVolteIMSUser{} key := fmt.Sprintf("volte:%s", imsi) - source := fmt.Sprintf("UDM_%s", neId) + source := fmt.Sprintf("UDM_%s", neUid) // 网元主机的Redis客户端 - redisClient, err := neService.NewNeInfo.NeRunRedisClient("UDM", neId) + redisClient, err := neService.NewNeInfo.NeRunRedisClient(coreUid, neUid) if err != nil { return arr } @@ -63,11 +63,13 @@ func (r UDMVolteIMSUser) dataByRedis(imsi, neId string) []model.UDMVolteIMSUser } a := model.UDMVolteIMSUser{ - NeId: neId, - IMSI: keys[1], - MSISDN: keys[2], - Tag: m["tag"], // volte = tag - VNI: vni, + CoreUID: coreUid, + NeUID: neUid, + NeType: "UDM", + IMSI: keys[1], + MSISDN: keys[2], + Tag: m["tag"], // volte = tag + VNI: vni, } arr = append(arr, a) } @@ -75,15 +77,15 @@ func (r UDMVolteIMSUser) dataByRedis(imsi, neId string) []model.UDMVolteIMSUser } // ResetData 重置VolteIMS用户数据,清空数据库重新同步Redis数据 -func (r UDMVolteIMSUser) ResetData(neId string) int64 { - authArr := r.dataByRedis("*", neId) +func (r UDMVolteIMSUser) ResetData(coreUid, neUid string) int64 { + authArr := r.dataByRedis(coreUid, neUid, "*") // 数据清空后添加 - go r.udmVolteIMSRepository.ClearAndInsert(neId, authArr) + go r.udmVolteIMSRepository.ClearAndInsert(coreUid, neUid, authArr) return int64(len(authArr)) } // ParseInfo 解析单个用户imsi信息 data从命令MML得到的结果 -func (r UDMVolteIMSUser) ParseInfo(neId string, data map[string]string) model.UDMVolteIMSUser { +func (r UDMVolteIMSUser) ParseInfo(coreUid, neUid string, data map[string]string) model.UDMVolteIMSUser { // "110011200004217@ims.mnc001.mcc110.3gppnetwork.org" vni := "" impiParts := strings.Split(data["impi"], "@") @@ -95,15 +97,16 @@ func (r UDMVolteIMSUser) ParseInfo(neId string, data map[string]string) model.UD } u := model.UDMVolteIMSUser{ - NeId: neId, - IMSI: data["imsi"], - MSISDN: data["msisdn"], - Tag: data["volte_tag"], - VNI: vni, + CoreUID: coreUid, + NeUID: neUid, + IMSI: data["imsi"], + MSISDN: data["msisdn"], + Tag: data["volte_tag"], + VNI: vni, } // 赋予ID - item := r.udmVolteIMSRepository.SelectByIMSIAndMSISDNAndNeID(u.IMSI, u.MSISDN, neId) - if item.ID != "" { + item := r.udmVolteIMSRepository.SelectByIMSIAndMSISDN(coreUid, neUid, u.IMSI, u.MSISDN) + if item.ID > 0 { u.ID = item.ID } return u @@ -121,17 +124,17 @@ func (r UDMVolteIMSUser) Find(u model.UDMVolteIMSUser) []model.UDMVolteIMSUser { // InsertByIMSI 从数据中读取后删除imsi再存入数据库 // imsi长度15 -func (r UDMVolteIMSUser) InsertByIMSI(imsi, neId string) int64 { - uArr := r.dataByRedis(imsi+":*", neId) +func (r UDMVolteIMSUser) InsertByIMSI(coreUid, neUid, imsi string) int64 { + uArr := r.dataByRedis(coreUid, neUid, imsi+":*") if len(uArr) > 0 { - r.udmVolteIMSRepository.Delete(imsi, neId) + r.udmVolteIMSRepository.DeleteByIMSI(coreUid, neUid, imsi) return r.udmVolteIMSRepository.Inserts(uArr) } return 0 } // InsertData 导入文件数据 dataType目前两种:txt/csv -func (r UDMVolteIMSUser) InsertData(neId, dataType string, data any) int64 { +func (r UDMVolteIMSUser) InsertData(coreUid, neUid, dataType string, data any) int64 { // imsi截取前缀,重新获取部分数据 prefixes := make(map[string]struct{}) @@ -160,9 +163,9 @@ func (r UDMVolteIMSUser) InsertData(neId, dataType string, data any) int64 { var num int64 = 0 for prefix := range prefixes { // 直接删除前缀的记录 - r.udmVolteIMSRepository.DeletePrefixByIMSI(prefix, neId) + r.udmVolteIMSRepository.DeletePrefixByIMSI(coreUid, neUid, prefix) // keys voip:4600001000004* - arr := r.dataByRedis(prefix+"*", neId) + arr := r.dataByRedis(coreUid, neUid, prefix+"*") if len(arr) > 0 { num += r.udmVolteIMSRepository.Inserts(arr) } @@ -171,24 +174,23 @@ func (r UDMVolteIMSUser) InsertData(neId, dataType string, data any) int64 { } // Delete 删除单个不重新加载 -func (r UDMVolteIMSUser) Delete(imsi, neId string) int64 { - return r.udmVolteIMSRepository.Delete(imsi, neId) +func (r UDMVolteIMSUser) Delete(coreUid, neUid, imsi string) int64 { + return r.udmVolteIMSRepository.DeleteByIMSI(coreUid, neUid, imsi) } // LoadData 重新加载从imsi开始num的数据 -func (r UDMVolteIMSUser) LoadData(neId, imsiOrMsisdn, num string) { +func (r UDMVolteIMSUser) LoadData(coreUid, neUid, imsiOrMsisdn string, num int64) { startIMSIOrMsisdn, _ := strconv.ParseInt(imsiOrMsisdn, 10, 64) - subNum, _ := strconv.ParseInt(num, 10, 64) var i int64 - for i = 0; i < subNum; i++ { + for i = 0; i < num; i++ { keyIMSI := fmt.Sprintf("%015d", startIMSIOrMsisdn+i) if !strings.HasPrefix(imsiOrMsisdn, "0") { keyIMSI = fmt.Sprintf("%d", startIMSIOrMsisdn+i) } // 删除原数据 - r.udmVolteIMSRepository.Delete(keyIMSI, neId) + r.udmVolteIMSRepository.DeleteByIMSI(coreUid, neUid, keyIMSI) // 加载数据 - arr := r.dataByRedis(keyIMSI+":*", neId) + arr := r.dataByRedis(coreUid, neUid, keyIMSI+":*") if len(arr) < 1 { continue } diff --git a/src/modules/notification/service/email.go b/src/modules/notification/service/email.go index 8a9c7dbf..2cf9fba3 100644 --- a/src/modules/notification/service/email.go +++ b/src/modules/notification/service/email.go @@ -14,11 +14,12 @@ import ( "be.ems/src/framework/logger" "be.ems/src/framework/utils/date" "be.ems/src/framework/utils/parse" + neModel "be.ems/src/modules/ne/model" neDataModel "be.ems/src/modules/ne_data/model" ) // EmailAlarm 发告警邮件 -func EmailAlarm(a neDataModel.Alarm, neIP string) error { +func EmailAlarm(a neDataModel.Alarm, neInfo neModel.NeInfo) error { emailList := fmt.Sprint(config.Get("notification.email.list")) if len(emailList) == 0 { return fmt.Errorf("email list is empty") @@ -43,8 +44,8 @@ func EmailAlarm(a neDataModel.Alarm, neIP string) error { // 参数值 data := map[string]any{ "AlarmSeq": a.AlarmSeq, - "NeName": a.NeName, - "NeIp": neIP, + "NeName": neInfo.NeName, + "NeIp": neInfo.IPAddr, "AlarmTitle": a.AlarmTitle, "OrigSeverity": a.OrigSeverity, "AlarmTime": date.ParseDateToStr(a.EventTime, time.RFC3339), diff --git a/src/modules/notification/service/smsc.go b/src/modules/notification/service/smsc.go index 0807adce..2c499738 100644 --- a/src/modules/notification/service/smsc.go +++ b/src/modules/notification/service/smsc.go @@ -15,6 +15,7 @@ import ( "be.ems/src/framework/logger" "be.ems/src/framework/utils/date" "be.ems/src/framework/utils/parse" + neModel "be.ems/src/modules/ne/model" neDataModel "be.ems/src/modules/ne_data/model" ) @@ -90,7 +91,7 @@ func newSubmitSM(destSM string, message string) (*pdu.SubmitSM, error) { } // SMSCAlarm 发告警短信 -func SMSCAlarm(a neDataModel.Alarm, neIP string) error { +func SMSCAlarm(a neDataModel.Alarm, neInfo neModel.NeInfo) error { mobileList := fmt.Sprint(config.Get("notification.smsc.list")) if len(mobileList) == 0 { return fmt.Errorf("smsc list is empty") @@ -100,7 +101,7 @@ func SMSCAlarm(a neDataModel.Alarm, neIP string) error { textBodyTemplate := `Alarm Notification Sequence: {{.AlarmSeq}}, NE Name: {{.NeName}} - NE IP: {{.NeIp}} + NE IP: {{.NeIPAddr}} Title: {{.AlarmTitle}} Severity: {{.OrigSeverity}} Event Time: {{.AlarmTime}} @@ -113,8 +114,8 @@ func SMSCAlarm(a neDataModel.Alarm, neIP string) error { // 参数值 data := map[string]any{ "AlarmSeq": a.AlarmSeq, - "NeName": a.NeName, - "NeIp": neIP, + "NeName": neInfo.NeName, + "NeIPAddr": neInfo.IPAddr, "AlarmTitle": a.AlarmTitle, "OrigSeverity": a.OrigSeverity, "AlarmTime": date.ParseDateToStr(a.EventTime, time.RFC3339), diff --git a/src/modules/oam/controller/api_rest.go b/src/modules/oam/controller/api_rest.go index 3074c05e..faca2aae 100644 --- a/src/modules/oam/controller/api_rest.go +++ b/src/modules/oam/controller/api_rest.go @@ -627,7 +627,7 @@ func (s APIRestController) ResolveAlarmHistory(c *gin.Context) { if elementTypeValue == "all" { neInfos = neService.NewNeInfo.Find(neModel.NeInfo{}, false, false) } else { - neInfos = neService.NewNeInfo.FindByNeType(strings.ToUpper(elementTypeValue)) + neInfos = neService.NewNeInfo.FindByCoreUidAndNeType("*", strings.ToUpper(elementTypeValue)) } for _, neInfo := range neInfos { data, err := neFetchlink.AlarmHistory(neInfo) @@ -636,7 +636,7 @@ func (s APIRestController) ResolveAlarmHistory(c *gin.Context) { continue } if len(data) == 0 { - logger.Warnf("not found sync alarms %s", neInfo.RmUID) + logger.Warnf("not found sync alarms %s", neInfo.CoreUID) continue } diff --git a/src/modules/oam/service/alarm.go b/src/modules/oam/service/alarm.go index dc3c92ca..23ff94d7 100644 --- a/src/modules/oam/service/alarm.go +++ b/src/modules/oam/service/alarm.go @@ -8,6 +8,7 @@ import ( "be.ems/src/framework/utils/parse" "github.com/tsmask/go-oam" + neModel "be.ems/src/modules/ne/model" neService "be.ems/src/modules/ne/service" neDataModel "be.ems/src/modules/ne_data/model" neDataService "be.ems/src/modules/ne_data/service" @@ -34,29 +35,22 @@ type Alarm struct { alarmEventService *neDataService.AlarmEvent alarmLogService *neDataService.AlarmLog alarmForwardLogService *neDataService.AlarmForwardLog - - alarm neDataModel.Alarm } // Resolve 接收处理 func (s *Alarm) Resolve(a oam.Alarm) error { // 是否存在网元 - neInfo := s.neInfoService.FindByRmuid(a.NeUid) - if neInfo.NeType == "" || neInfo.RmUID != a.NeUid { + neInfo := s.neInfoService.FindByCoreUidAndNeUid("*", a.NeUid) + if neInfo.NeType == "" || neInfo.NeUID != a.NeUid { return fmt.Errorf("resolve alarm network element does not exist %s", a.NeUid) } - // seq 告警序号 - lastSeq := neDataService.NewAlarm.FindAlarmSeqLast(neInfo.NeType, neInfo.NeId) - // 告警信息 - s.alarm = neDataModel.Alarm{ + alarm := neDataModel.Alarm{ + CoreUID: neInfo.CoreUID, NeType: neInfo.NeType, - NeId: neInfo.NeId, - NeName: neInfo.NeName, - Province: neInfo.Province, - PvFlag: neInfo.PvFlag, - AlarmSeq: lastSeq + 1, + NeUID: neInfo.NeUID, + AlarmSeq: 0, AlarmId: a.AlarmId, AlarmTitle: a.AlarmTitle, AlarmCode: int64(a.AlarmCode), @@ -64,7 +58,7 @@ func (s *Alarm) Resolve(a oam.Alarm) error { AlarmType: a.AlarmType, OrigSeverity: a.PerceivedSeverity, PerceivedSeverity: a.PerceivedSeverity, - ObjectUid: neInfo.RmUID, + ObjectUid: neInfo.NeUID, ObjectName: neInfo.NeName, ObjectType: neInfo.NeType, LocationInfo: a.LocationInfo, @@ -77,11 +71,11 @@ func (s *Alarm) Resolve(a oam.Alarm) error { // 进行清除 if a.AlarmStatus == oam.ALARM_STATUS_CLEAR { if a.PerceivedSeverity == oam.ALARM_SEVERITY_EVENT { - if err := s.clearEvent(); err != nil { + if err := s.clearEvent(alarm); err != nil { return err } } else { - if err := s.clear(); err != nil { + if err := s.clear(alarm); err != nil { return err } } @@ -90,40 +84,45 @@ func (s *Alarm) Resolve(a oam.Alarm) error { // 进行新增 if a.AlarmStatus == oam.ALARM_STATUS_ACTIVE { if a.PerceivedSeverity == oam.ALARM_SEVERITY_EVENT { - if err := s.addEvent(); err != nil { + alarmSeq, err := s.addEvent(alarm) + if err != nil { return err } + alarm.AlarmSeq = alarmSeq } else { - if err := s.add(); err != nil { + alarmSeq, err := s.add(alarm) + if err != nil { return err } + alarm.AlarmSeq = alarmSeq } } // 记录日志 - if err := s.saveLog(); err != nil { + if err := s.saveLog(alarm); err != nil { return err } // 推送 - s.wsService.ByGroupID(fmt.Sprintf("%s_%s_%s", wsService.GROUP_ALARM, neInfo.NeType, neInfo.NeId), s.alarm) + s.wsService.ByGroupID(fmt.Sprintf("%s_%s_%s", wsService.GROUP_ALARM, neInfo.CoreUID, neInfo.NeUID), alarm) // 通知 - go s.notify(neInfo.IP) + go s.notify(alarm, neInfo) return nil } // saveLog 记录日志 -func (s *Alarm) saveLog() error { +func (s *Alarm) saveLog(alarm neDataModel.Alarm) error { alarmLog := neDataModel.AlarmLog{ - NeType: s.alarm.NeType, - NeId: s.alarm.NeId, - AlarmSeq: s.alarm.AlarmSeq, - AlarmId: s.alarm.AlarmId, - AlarmTitle: s.alarm.AlarmTitle, - AlarmCode: s.alarm.AlarmCode, - AlarmStatus: s.alarm.AlarmStatus, - AlarmType: s.alarm.AlarmType, - OrigSeverity: s.alarm.PerceivedSeverity, - EventTime: s.alarm.EventTime, + CoreUID: alarm.CoreUID, + NeUID: alarm.NeUID, + NeType: alarm.NeType, + AlarmSeq: alarm.AlarmSeq, + AlarmId: alarm.AlarmId, + AlarmTitle: alarm.AlarmTitle, + AlarmCode: alarm.AlarmCode, + AlarmStatus: alarm.AlarmStatus, + AlarmType: alarm.AlarmType, + OrigSeverity: alarm.PerceivedSeverity, + EventTime: alarm.EventTime, } insertId := s.alarmLogService.Insert(alarmLog) if insertId <= 0 { @@ -133,133 +132,140 @@ func (s *Alarm) saveLog() error { } // add 新增告警 -func (s *Alarm) add() error { +func (s *Alarm) add(alarm neDataModel.Alarm) (int64, error) { // 检查网元告警ID是否唯一 alarmIdArr := s.alarmService.Find(neDataModel.Alarm{ - NeType: s.alarm.NeType, - NeId: s.alarm.NeId, - AlarmId: s.alarm.AlarmId, + CoreUID: alarm.CoreUID, + NeUID: alarm.NeUID, + NeType: alarm.NeType, + AlarmId: alarm.AlarmId, }) if len(alarmIdArr) > 0 { - return fmt.Errorf("already exists alarmId:%s", s.alarm.AlarmId) + return 0, fmt.Errorf("already exists alarmId:%s", alarm.AlarmId) } - insertId := s.alarmService.Insert(s.alarm) + // seq 告警序号 + lastSeq := neDataService.NewAlarm.FindAlarmSeqLast(alarm.CoreUID, alarm.NeUID) + alarm.AlarmSeq = lastSeq + 1 + insertId := s.alarmService.Insert(alarm) if insertId > 0 { - s.alarm.ID = insertId - return nil + alarm.ID = insertId + return alarm.AlarmSeq, nil } - return fmt.Errorf("add alarm fail") + return 0, fmt.Errorf("add alarm fail") } // clear 清除告警 -func (s *Alarm) clear() error { +func (s *Alarm) clear(alarm neDataModel.Alarm) error { // 检查网元告警ID是否唯一 alarmIdArr := s.alarmService.Find(neDataModel.Alarm{ - NeType: s.alarm.NeType, - NeId: s.alarm.NeId, - AlarmId: s.alarm.AlarmId, + CoreUID: alarm.CoreUID, + NeUID: alarm.NeUID, + NeType: alarm.NeType, + AlarmId: alarm.AlarmId, }) if len(alarmIdArr) != 1 { - return fmt.Errorf("not exists alarmId:%s", s.alarm.AlarmId) + return fmt.Errorf("not exists alarmId:%s", alarm.AlarmId) } // 告警清除 - rows, _ := s.alarmService.ClearByIds([]int64{alarmIdArr[0].ID}, s.alarm.ObjectUid, constants.ALARM_CLEAR_TYPE_AUTO_CLEAR) + rows, _ := s.alarmService.ClearById(alarmIdArr[0].ID, alarm.CoreUID, alarm.ObjectUid, constants.ALARM_CLEAR_TYPE_AUTO_CLEAR) if rows > 0 { return nil } - return fmt.Errorf("clear fail alarmId:%s", s.alarm.AlarmId) + return fmt.Errorf("clear fail alarmId:%s", alarm.AlarmId) } // addEvent 新增告警事件 -func (s *Alarm) addEvent() error { +func (s Alarm) addEvent(alarm neDataModel.Alarm) (int64, error) { // 检查网元告警ID是否唯一 alarmIdArr := s.alarmEventService.Find(neDataModel.AlarmEvent{ - NeType: s.alarm.NeType, - NeId: s.alarm.NeId, - AlarmId: s.alarm.AlarmId, + CoreUID: alarm.CoreUID, + NeUID: alarm.NeUID, + NeType: alarm.NeType, + AlarmId: alarm.AlarmId, }) if len(alarmIdArr) > 0 { - return fmt.Errorf("event already exists alarmId:%s", s.alarm.AlarmId) + return 0, fmt.Errorf("event already exists alarmId:%s", alarm.AlarmId) } // seq 告警序号 - lastSeq := s.alarmEventService.FindAlarmEventSeqLast(s.alarm.NeType, s.alarm.NeId) + lastSeq := s.alarmEventService.FindAlarmEventSeqLast(alarm.CoreUID, alarm.NeUID) alarmEvent := neDataModel.AlarmEvent{ - NeType: s.alarm.NeType, - NeId: s.alarm.NeId, + CoreUID: alarm.CoreUID, + NeUID: alarm.NeUID, + NeType: alarm.NeType, AlarmSeq: lastSeq + 1, - AlarmId: s.alarm.AlarmId, - AlarmTitle: s.alarm.AlarmTitle, - AlarmCode: s.alarm.AlarmCode, - EventTime: s.alarm.EventTime, - ObjectUid: s.alarm.ObjectUid, - ObjectName: s.alarm.ObjectName, - ObjectType: s.alarm.ObjectType, - LocationInfo: s.alarm.LocationInfo, - AlarmStatus: s.alarm.AlarmStatus, - SpecificProblem: s.alarm.SpecificProblem, - SpecificProblemId: s.alarm.SpecificProblemId, - AddInfo: s.alarm.AddInfo, + AlarmId: alarm.AlarmId, + AlarmTitle: alarm.AlarmTitle, + AlarmCode: alarm.AlarmCode, + EventTime: alarm.EventTime, + ObjectUid: alarm.ObjectUid, + ObjectName: alarm.ObjectName, + ObjectType: alarm.ObjectType, + LocationInfo: alarm.LocationInfo, + AlarmStatus: alarm.AlarmStatus, + SpecificProblem: alarm.SpecificProblem, + SpecificProblemId: alarm.SpecificProblemId, + AddInfo: alarm.AddInfo, } insertId := s.alarmEventService.Insert(alarmEvent) if insertId > 0 { alarmEvent.ID = insertId // 网元重启后,清除活动告警 - if s.alarm.AlarmCode == constants.ALARM_EVENT_REBOOT { + if alarm.AlarmCode == constants.ALARM_EVENT_REBOOT { rows := s.alarmService.Find(neDataModel.Alarm{ - NeType: s.alarm.NeType, - NeId: s.alarm.NeId, + CoreUID: alarm.CoreUID, + NeUID: alarm.NeUID, + NeType: alarm.NeType, AlarmStatus: oam.ALARM_STATUS_ACTIVE, }) - ids := make([]int64, 0) for _, v := range rows { - ids = append(ids, v.ID) + s.alarmService.ClearById(v.ID, alarm.CoreUID, alarm.ObjectUid, constants.ALARM_CLEAR_TYPE_AUTO_CLEAR) } - s.alarmService.ClearByIds(ids, s.alarm.ObjectUid, constants.ALARM_CLEAR_TYPE_AUTO_CLEAR) } // 网元重启后,有跟踪任务的需要重新补发启动任务 - if s.alarm.AlarmCode == constants.ALARM_EVENT_REBOOT { - traceService.NewTraceTask.RunUnstopped(s.alarm.NeType, s.alarm.NeId) + if alarm.AlarmCode == constants.ALARM_EVENT_REBOOT { + traceService.NewTraceTask.RunUnstopped(alarm.CoreUID, alarm.NeUID) } - return nil + return alarmEvent.AlarmSeq, nil } - return fmt.Errorf("event add fail") + return 0, fmt.Errorf("event add fail") } // clearEvent 清除告警事件 -func (s *Alarm) clearEvent() error { +func (s Alarm) clearEvent(alarm neDataModel.Alarm) error { alarmEventService := neDataService.NewAlarmEvent // 检查网元告警ID是否唯一 alarmIdArr := alarmEventService.Find(neDataModel.AlarmEvent{ - NeType: s.alarm.NeType, - NeId: s.alarm.NeId, - AlarmId: s.alarm.AlarmId, + CoreUID: alarm.CoreUID, + NeUID: alarm.NeUID, + NeType: alarm.NeType, + AlarmId: alarm.AlarmId, }) if len(alarmIdArr) != 1 { - return fmt.Errorf("event not exists alarmId:%s", s.alarm.AlarmId) + return fmt.Errorf("event not exists alarmId:%s", alarm.AlarmId) } // 告警清除 - rows, _ := s.alarmEventService.ClearByIds([]int64{alarmIdArr[0].ID}, s.alarm.ObjectUid, constants.ALARM_CLEAR_TYPE_AUTO_CLEAR) + rows, _ := s.alarmEventService.ClearById(alarmIdArr[0].ID, alarm.CoreUID, alarm.ObjectUid, constants.ALARM_CLEAR_TYPE_AUTO_CLEAR) if rows > 0 { return nil } - return fmt.Errorf("event clear fail alarmId:%s", s.alarm.AlarmId) + return fmt.Errorf("event clear fail alarmId:%s", alarm.AlarmId) } // notify 通知 -func (s *Alarm) notify(neIp string) { +func (s Alarm) notify(alarm neDataModel.Alarm, neInfo neModel.NeInfo) { // 邮箱 emailEnable := parse.Boolean(config.Get("notification.email.enable")) if emailEnable { emailList := fmt.Sprint(config.Get("notification.email.emailList")) emailResult := "Sent Successfully!" - emailErr := notificationService.EmailAlarm(s.alarm, neIp) + emailErr := notificationService.EmailAlarm(alarm, neInfo) if emailErr != nil { emailResult = emailErr.Error() } - s.notifyLog("EMAIL", emailList, emailResult) + s.notifyLog(alarm, "EMAIL", emailList, emailResult) } // 短信 @@ -267,27 +273,28 @@ func (s *Alarm) notify(neIp string) { if smscEnable { mobileList := fmt.Sprint(config.Get("notification.smsc.mobileList")) smscResult := "Sent Successfully!" - smscErr := notificationService.SMSCAlarm(s.alarm, neIp) + smscErr := notificationService.SMSCAlarm(alarm, neInfo) if smscErr != nil { smscResult = smscErr.Error() } - s.notifyLog("SMSC", mobileList, smscResult) + s.notifyLog(alarm, "SMS", mobileList, smscResult) } } // notifyLog 通知日志 -func (s *Alarm) notifyLog(forwardBy, toUser, result string) error { +func (s Alarm) notifyLog(alarm neDataModel.Alarm, forwardBy, toUser, result string) error { alarmForwardLog := neDataModel.AlarmForwardLog{ - NeType: s.alarm.NeType, - NeId: s.alarm.NeId, - AlarmSeq: s.alarm.AlarmSeq, - AlarmId: s.alarm.AlarmId, - AlarmTitle: s.alarm.AlarmTitle, - AlarmCode: s.alarm.AlarmCode, - AlarmStatus: s.alarm.AlarmStatus, - AlarmType: s.alarm.AlarmType, - OrigSeverity: s.alarm.OrigSeverity, - EventTime: s.alarm.EventTime, + CoreUID: alarm.CoreUID, + NeUID: alarm.NeUID, + NeType: alarm.NeType, + AlarmSeq: alarm.AlarmSeq, + AlarmId: alarm.AlarmId, + AlarmTitle: alarm.AlarmTitle, + AlarmCode: alarm.AlarmCode, + AlarmStatus: alarm.AlarmStatus, + AlarmType: alarm.AlarmType, + OrigSeverity: alarm.OrigSeverity, + EventTime: alarm.EventTime, Type: forwardBy, Target: toUser, Result: result, diff --git a/src/modules/oam/service/cdr.go b/src/modules/oam/service/cdr.go index b9e3531a..1fd6b893 100644 --- a/src/modules/oam/service/cdr.go +++ b/src/modules/oam/service/cdr.go @@ -32,16 +32,16 @@ func (s *CDR) Resolve(c oam.CDR) error { return fmt.Errorf("cdr data is nil") } // 是否存在网元 - neInfo := s.neInfoService.FindByRmuid(c.NeUid) - if neInfo.NeType == "" || neInfo.RmUID != c.NeUid { + neInfo := s.neInfoService.FindByCoreUidAndNeUid("*", c.NeUid) + if neInfo.NeType == "" || neInfo.NeUID != c.NeUid { return fmt.Errorf("resolve cdr network element does not exist %s", c.NeUid) } cdrByte, _ := json.Marshal(c.Data) cdrEvent := neDataModel.CDREvent{ + CoreUID: neInfo.CoreUID, + NeUID: neInfo.NeUID, NeType: neInfo.NeType, - NeName: neInfo.NeName, - RmUid: neInfo.RmUID, Timestamp: c.RecordTime, CdrJson: string(cdrByte), CreatedAt: c.RecordTime, @@ -58,14 +58,14 @@ func (s *CDR) Resolve(c oam.CDR) error { dataMap := c.Data.(map[string]any) v, ok := dataMap["recordType"] if ok && (v == "MOC" || v == "MTSM") { - s.wsService.ByGroupID(fmt.Sprintf("%s_%s", wsService.GROUP_IMS_CDR, neInfo.NeId), cdrEvent) + s.wsService.ByGroupID(fmt.Sprintf("%s_%s_%s", wsService.GROUP_IMS_CDR, neInfo.CoreUID, neInfo.NeUID), cdrEvent) } case "SMF": - s.wsService.ByGroupID(fmt.Sprintf("%s_%s", wsService.GROUP_SMF_CDR, neInfo.NeId), cdrEvent) + s.wsService.ByGroupID(fmt.Sprintf("%s_%s_%s", wsService.GROUP_SMF_CDR, neInfo.CoreUID, neInfo.NeUID), cdrEvent) case "SMSC": - s.wsService.ByGroupID(fmt.Sprintf("%s_%s", wsService.GROUP_SMSC_CDR, neInfo.NeId), cdrEvent) + s.wsService.ByGroupID(fmt.Sprintf("%s_%s_%s", wsService.GROUP_SMSC_CDR, neInfo.CoreUID, neInfo.NeUID), cdrEvent) case "SGWC": - s.wsService.ByGroupID(fmt.Sprintf("%s_%s", wsService.GROUP_SGWC_CDR, neInfo.NeId), cdrEvent) + s.wsService.ByGroupID(fmt.Sprintf("%s_%s_%s", wsService.GROUP_SGWC_CDR, neInfo.CoreUID, neInfo.NeUID), cdrEvent) } return nil } diff --git a/src/modules/oam/service/kpi.go b/src/modules/oam/service/kpi.go index 3aadbb3a..1f6e171e 100644 --- a/src/modules/oam/service/kpi.go +++ b/src/modules/oam/service/kpi.go @@ -40,8 +40,8 @@ func (s *KPI) Resolve(k oam.KPI) error { return fmt.Errorf("kpi data is nil") } // 是否存在网元 - neInfo := s.neInfoService.FindByRmuid(k.NeUid) - if neInfo.NeType == "" || neInfo.RmUID != k.NeUid { + neInfo := s.neInfoService.FindByCoreUidAndNeUid("*", k.NeUid) + if neInfo.NeType == "" || neInfo.NeUID != k.NeUid { return fmt.Errorf("resolve kpi network element does not exist %s", k.NeUid) } @@ -98,9 +98,9 @@ func (s KPI) saveKPIData(neInfo neModel.NeInfo, k oam.KPI, index int64) error { // KPI 信息 kpiData := neDataModel.KpiReport{ + CoreUID: neInfo.CoreUID, + NeUID: neInfo.NeUID, NeType: neInfo.NeType, - NeName: neInfo.NeName, - RmUid: neInfo.RmUID, Date: recordDate, StartTime: recordStartTime, EndTime: recordEndTime, @@ -117,9 +117,9 @@ func (s KPI) saveKPIData(neInfo neModel.NeInfo, k oam.KPI, index int64) error { // 指标事件对象 data := map[string]any{ + "coreUid": kpiData.CoreUID, + "neUid": kpiData.NeUID, "neType": kpiData.NeType, - "neName": kpiData.NeName, - "rmUID": kpiData.RmUid, "startIndex": kpiData.Index, "timeGroup": kpiData.CreatedAt, // kip_id ... @@ -129,12 +129,12 @@ func (s KPI) saveKPIData(neInfo neModel.NeInfo, k oam.KPI, index int64) error { } // 推送到ws订阅组 - s.wsService.ByGroupID(fmt.Sprintf("%s_%s_%s", wsService.GROUP_KPI, neInfo.NeType, neInfo.NeId), data) + s.wsService.ByGroupID(fmt.Sprintf("%s_%s_%s", wsService.GROUP_KPI, neInfo.CoreUID, neInfo.NeUID), data) // 更新UPF总流量 if neInfo.NeType == "UPF" { upValue := parse.Number(data["UPF.03"]) downValue := parse.Number(data["UPF.06"]) - s.kpiReportService.UPFTodayFlowUpdate(neInfo.RmUID, upValue, downValue) + s.kpiReportService.UPFTodayFlowUpdate(neInfo.NeUID, upValue, downValue) } return nil } @@ -205,9 +205,9 @@ func (s KPI) saveKPIDataC(neInfo neModel.NeInfo, k oam.KPI, index int64) error { // KPI 信息 kpiCData := neDataModel.KpiCReport{ + CoreUID: neInfo.CoreUID, + NeUID: neInfo.NeUID, NeType: neInfo.NeType, - NeName: neInfo.NeName, - RmUid: neInfo.RmUID, Date: recordDate, StartTime: recordStartTime, EndTime: recordEndTime, @@ -224,9 +224,9 @@ func (s KPI) saveKPIDataC(neInfo neModel.NeInfo, k oam.KPI, index int64) error { // 指标事件对象 data := map[string]any{ + "coreUid": kpiCData.CoreUID, + "neUid": kpiCData.NeUID, "neType": kpiCData.NeType, - "neName": kpiCData.NeName, - "rmUID": kpiCData.RmUid, "startIndex": kpiCData.Index, "timeGroup": kpiCData.CreatedAt, // kip_id ... @@ -236,6 +236,6 @@ func (s KPI) saveKPIDataC(neInfo neModel.NeInfo, k oam.KPI, index int64) error { } // 推送到ws订阅组 - s.wsService.ByGroupID(fmt.Sprintf("%s_%s_%s", wsService.GROUP_KPI_C, neInfo.NeType, neInfo.NeId), data) + s.wsService.ByGroupID(fmt.Sprintf("%s_%s_%s", wsService.GROUP_KPI_C, neInfo.CoreUID, neInfo.NeUID), data) return nil } diff --git a/src/modules/oam/service/nb_state.go b/src/modules/oam/service/nb_state.go index 5ad9b077..6aad804d 100644 --- a/src/modules/oam/service/nb_state.go +++ b/src/modules/oam/service/nb_state.go @@ -30,15 +30,15 @@ type NBState struct { // Resolve 接收处理 func (s *NBState) Resolve(n oam.NBState) error { // 是否存在网元 - neInfo := s.neInfoService.FindByRmuid(n.NeUid) - if neInfo.NeType == "" || neInfo.RmUID != n.NeUid { + neInfo := s.neInfoService.FindByCoreUidAndNeUid("*", n.NeUid) + if neInfo.NeType == "" || neInfo.NeUID != n.NeUid { return fmt.Errorf("resolve nb_state network element does not exist %s", n.NeUid) } nbState := neDataModel.NBState{ + CoreUID: neInfo.CoreUID, + NeUID: neInfo.NeUID, NeType: neInfo.NeType, - NeId: neInfo.NeId, - RmUid: neInfo.RmUID, Address: n.Address, Name: n.Name, Position: n.Position, @@ -56,10 +56,10 @@ func (s *NBState) Resolve(n oam.NBState) error { switch neInfo.NeType { case "AMF": s.wsService.ByGroupID(wsService.GROUP_AMF_NB, nbState) - s.wsService.ByGroupID(fmt.Sprintf("%s_%s", wsService.GROUP_AMF_NB, neInfo.NeId), nbState) + s.wsService.ByGroupID(fmt.Sprintf("%s_%s_%s", wsService.GROUP_AMF_NB, neInfo.CoreUID, neInfo.NeUID), nbState) case "MME": s.wsService.ByGroupID(wsService.GROUP_MME_NB, nbState) - s.wsService.ByGroupID(fmt.Sprintf("%s_%s", wsService.GROUP_MME_NB, neInfo.NeId), nbState) + s.wsService.ByGroupID(fmt.Sprintf("%s_%s_%s", wsService.GROUP_MME_NB, neInfo.CoreUID, neInfo.NeUID), nbState) } return nil } diff --git a/src/modules/oam/service/ue_nb.go b/src/modules/oam/service/ue_nb.go index 833f91cd..8351ee60 100644 --- a/src/modules/oam/service/ue_nb.go +++ b/src/modules/oam/service/ue_nb.go @@ -29,16 +29,16 @@ type UENB struct { // Resolve 接收处理 func (s *UENB) Resolve(u oam.UENB) error { // 是否存在网元 - neInfo := s.neInfoService.FindByRmuid(u.NeUid) - if neInfo.NeType == "" || neInfo.RmUID != u.NeUid { + neInfo := s.neInfoService.FindByCoreUidAndNeUid("*", u.NeUid) + if neInfo.NeType == "" || neInfo.NeUID != u.NeUid { return fmt.Errorf("resolve ue_nb network element does not exist %s", u.NeUid) } uenbByte, _ := json.Marshal(u) uenbEvent := neDataModel.UEEvent{ + CoreUID: neInfo.CoreUID, + NeUID: neInfo.NeUID, NeType: neInfo.NeType, - NeName: neInfo.NeName, - RmUID: neInfo.RmUID, Timestamp: u.RecordTime, EventType: u.Type, EventJSONStr: string(uenbByte), @@ -52,11 +52,9 @@ func (s *UENB) Resolve(u oam.UENB) error { // 推送到ws订阅组 switch neInfo.NeType { case "AMF": - s.wsService.ByGroupID(wsService.GROUP_AMF_UE, uenbEvent) - s.wsService.ByGroupID(fmt.Sprintf("%s_%s", wsService.GROUP_AMF_UE, neInfo.NeId), uenbEvent) + s.wsService.ByGroupID(fmt.Sprintf("%s_%s_%s", wsService.GROUP_AMF_UE, neInfo.CoreUID, neInfo.NeUID), uenbEvent) case "MME": - s.wsService.ByGroupID(wsService.GROUP_MME_UE, uenbEvent) - s.wsService.ByGroupID(fmt.Sprintf("%s_%s", wsService.GROUP_MME_UE, neInfo.NeId), uenbEvent) + s.wsService.ByGroupID(fmt.Sprintf("%s_%s_%s", wsService.GROUP_MME_UE, neInfo.CoreUID, neInfo.NeUID), uenbEvent) } return nil } diff --git a/src/modules/system/repository/sys_user.go b/src/modules/system/repository/sys_user.go index 962df1b2..a2bd1c52 100644 --- a/src/modules/system/repository/sys_user.go +++ b/src/modules/system/repository/sys_user.go @@ -77,7 +77,7 @@ func (r SysUser) SelectByPage(query map[string]string, dataScopeSQL string) ([]m // 查询数据分页 pageNum, pageSize := db.PageNumSize(query["pageNum"], query["pageSize"]) tx = tx.Limit(pageSize).Offset(pageSize * pageNum) - err := tx.Order("user_id desc").Find(&rows).Error + err := tx.Order("login_time desc").Find(&rows).Error if err != nil { logger.Errorf("query find err => %v", err.Error()) return rows, total diff --git a/src/modules/tool/controller/iperf.go b/src/modules/tool/controller/iperf.go index 25c3558e..07f424cf 100644 --- a/src/modules/tool/controller/iperf.go +++ b/src/modules/tool/controller/iperf.go @@ -49,8 +49,8 @@ type IPerfController struct { func (s *IPerfController) Version(c *gin.Context) { language := reqctx.AcceptLanguage(c) var query struct { - NeType string `form:"neType" binding:"required"` // 网元类型 - NeId string `form:"neId" binding:"required"` // 网元ID + CoreUid string `form:"coreUid" binding:"required"` // 核心网唯一资源标识 + NeUid string `form:"neUid" binding:"required"` // 网元唯一资源标识 Version string `form:"version" binding:"required,oneof=V2 V3"` // 版本 } if err := c.ShouldBindQuery(&query); err != nil { @@ -59,7 +59,7 @@ func (s *IPerfController) Version(c *gin.Context) { return } - output, err := s.iperfService.Version(query.NeType, query.NeId, query.Version) + output, err := s.iperfService.Version(query.CoreUid, query.NeUid, query.Version) if err != nil { c.JSON(200, resp.ErrMsg(i18n.TKey(language, err.Error()))) return @@ -84,8 +84,8 @@ func (s *IPerfController) Version(c *gin.Context) { func (s *IPerfController) Install(c *gin.Context) { language := reqctx.AcceptLanguage(c) var body struct { - NeType string `json:"neType" binding:"required"` // 网元类型 - NeId string `json:"neId" binding:"required"` // 网元ID + CoreUid string `form:"coreUid" binding:"required"` // 核心网唯一资源标识 + NeUid string `form:"neUid" binding:"required"` // 网元唯一资源标识 Version string `form:"version" binding:"required,oneof=V2 V3"` // 版本 } if err := c.ShouldBindBodyWithJSON(&body); err != nil { @@ -94,7 +94,7 @@ func (s *IPerfController) Install(c *gin.Context) { return } - if err := s.iperfService.Install(body.NeType, body.NeId, body.Version); err != nil { + if err := s.iperfService.Install(body.CoreUid, body.NeUid, body.Version); err != nil { c.JSON(200, resp.ErrMsg(i18n.TKey(language, err.Error()))) return } @@ -121,10 +121,10 @@ func (s *IPerfController) Install(c *gin.Context) { func (s *IPerfController) Run(c *gin.Context) { language := reqctx.AcceptLanguage(c) var query struct { - NeType string `form:"neType" binding:"required"` // 网元类型 - NeId string `form:"neId" binding:"required"` // 网元标识id - Cols int `form:"cols"` // 终端单行字符数 - Rows int `form:"rows"` // 终端显示行数 + CoreUid string `form:"coreUid" binding:"required"` // 核心网唯一资源标识 + NeUid string `form:"neUid" binding:"required"` // 网元唯一资源标识 + Cols int `form:"cols"` // 终端单行字符数 + Rows int `form:"rows"` // 终端显示行数 } if err := c.ShouldBindQuery(&query); err != nil { errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) @@ -140,7 +140,7 @@ func (s *IPerfController) Run(c *gin.Context) { } // 网元主机的SSH客户端 - sshClient, err := neService.NewNeInfo.NeRunSSHClient(query.NeType, query.NeId) + sshClient, err := neService.NewNeInfo.NeRunSSHClient(query.CoreUid, query.NeUid) if err != nil { c.JSON(200, resp.ErrMsg(err.Error())) return diff --git a/src/modules/tool/controller/mml.go b/src/modules/tool/controller/mml.go index 8f862e7e..84ef3a7d 100644 --- a/src/modules/tool/controller/mml.go +++ b/src/modules/tool/controller/mml.go @@ -65,8 +65,8 @@ func (s MMLController) LogList(c *gin.Context) { func (s MMLController) Command(c *gin.Context) { language := reqctx.AcceptLanguage(c) var body struct { - NeType string `json:"neType" binding:"required"` // 网元类型 - NeId string `json:"neId" binding:"required"` // 网元ID + CoreUID string `json:"coreUid" binding:"required"` // 核心网唯一标识 + NeUID string `json:"neUid" binding:"required"` // 网元唯一标识 Command []string `json:"command" binding:"required"` // 命令 Type string `json:"type" binding:"required,oneof=General Standard"` // 类型UPF标准版 General Standard } @@ -77,26 +77,26 @@ func (s MMLController) Command(c *gin.Context) { } // 查询网元获取IP - neInfo := s.neInfoService.FindByNeTypeAndNeID(body.NeType, body.NeId) - if neInfo.NeId != body.NeId || neInfo.IP == "" { + neInfo := s.neInfoService.FindByCoreUidAndNeUid(body.CoreUID, body.NeUID) + if neInfo.CoreUID != body.CoreUID || neInfo.NeUID != body.NeUID { c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } // 网元主机的Telnet客户端 num := 1 - if body.NeType == "UPF" && body.Type == "Standard" { + if neInfo.NeType == "UPF" && body.Type == "Standard" { num = 2 } - telnetClient, err := s.neInfoService.NeRunTelnetClient(neInfo.NeType, neInfo.NeId, num) + telnetClient, err := s.neInfoService.NeRunTelnetClient(neInfo.NeType, neInfo.NeUID, num) if err != nil { c.JSON(200, resp.ErrMsg(err.Error())) return } defer telnetClient.Close() - if body.NeType != "IMS" { + if neInfo.NeType != "IMS" { telnetClient.RunCMD("\r\n") } - if body.NeType == "UPF" && body.Type == "Standard" { + if neInfo.NeType == "UPF" && body.Type == "Standard" { telnetClient.WindowChange(1024, 1024) } // 发送MML @@ -117,8 +117,9 @@ func (s MMLController) Command(c *gin.Context) { // 记录日志 mmlLog := model.MMLLog{ - NeType: body.NeType, - NeId: body.NeId, + CoreUID: neInfo.CoreUID, + NeUID: neInfo.NeUID, + NeType: neInfo.NeType, User: reqctx.LoginUserToUserName(c), Ip: c.ClientIP(), Command: strings.Join(body.Command, ";"), diff --git a/src/modules/tool/controller/ping.go b/src/modules/tool/controller/ping.go index 6ef17fd4..a4ec8ad3 100644 --- a/src/modules/tool/controller/ping.go +++ b/src/modules/tool/controller/ping.go @@ -119,8 +119,8 @@ func (s *PingController) StatisticsOn(c *gin.Context) { func (s *PingController) Version(c *gin.Context) { language := reqctx.AcceptLanguage(c) var query struct { - NeType string `form:"neType" binding:"required"` // 网元类型 - NeID string `form:"neId" binding:"required"` // 网元ID + CoreUid string `form:"coreUid" binding:"required"` // 核心网唯一资源标识 + NeUid string `form:"neUid" binding:"required"` // 网元唯一资源标识 } if err := c.ShouldBindQuery(&query); err != nil { errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) @@ -128,7 +128,7 @@ func (s *PingController) Version(c *gin.Context) { return } - output, err := s.pingService.Version(query.NeType, query.NeID) + output, err := s.pingService.Version(query.CoreUid, query.NeUid) if err != nil { c.JSON(200, resp.ErrMsg(i18n.TKey(language, err.Error()))) return @@ -156,10 +156,10 @@ func (s *PingController) Version(c *gin.Context) { func (s *PingController) Run(c *gin.Context) { language := reqctx.AcceptLanguage(c) var query struct { - NeType string `form:"neType" binding:"required"` // 网元类型 - NeId string `form:"neId" binding:"required"` // 网元标识id - Cols int `form:"cols"` // 终端单行字符数 - Rows int `form:"rows"` // 终端显示行数 + CoreUid string `form:"coreUid" binding:"required"` // 核心网唯一资源标识 + NeUid string `form:"neUid" binding:"required"` // 网元唯一资源标识 + Cols int `form:"cols"` // 终端单行字符数 + Rows int `form:"rows"` // 终端显示行数 } if err := c.ShouldBindQuery(&query); err != nil { errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) @@ -175,7 +175,7 @@ func (s *PingController) Run(c *gin.Context) { } // 网元主机的SSH客户端 - sshClient, err := neService.NewNeInfo.NeRunSSHClient(query.NeType, query.NeId) + sshClient, err := neService.NewNeInfo.NeRunSSHClient(query.CoreUid, query.NeUid) if err != nil { c.JSON(200, resp.ErrMsg(err.Error())) return diff --git a/src/modules/tool/model/mml_log.go b/src/modules/tool/model/mml_log.go index 383a0943..3c98da4f 100644 --- a/src/modules/tool/model/mml_log.go +++ b/src/modules/tool/model/mml_log.go @@ -3,10 +3,11 @@ package model // MMLLog MML网元命令 type MMLLog struct { ID int64 `json:"id" gorm:"column:id;primaryKey;autoIncrement"` + CoreUID string `json:"coreUid" gorm:"column:core_uid"` // 核心网唯一标识 + NeUID string `json:"neUid" gorm:"column:ne_uid"` // 网元唯一标识 + NeType string `json:"neType" gorm:"column:ne_type"` // 网元类型 User string `json:"user" gorm:"column:user"` Ip string `json:"ip" gorm:"column:ip"` - NeType string `json:"neType" gorm:"column:ne_type"` - NeId string `json:"neId" gorm:"column:ne_id"` Command string `json:"command" gorm:"column:command"` // 命令 Result string `json:"result" gorm:"column:result"` LogTime int64 `json:"logTime" gorm:"column:log_time"` diff --git a/src/modules/tool/repository/mml_log.go b/src/modules/tool/repository/mml_log.go index 52422396..333d2fc6 100644 --- a/src/modules/tool/repository/mml_log.go +++ b/src/modules/tool/repository/mml_log.go @@ -19,6 +19,12 @@ type MMLLog struct{} func (r MMLLog) SelectByPage(query map[string]string) ([]model.MMLLog, int64) { tx := db.DB("").Model(&model.MMLLog{}) // 查询条件拼接 + if v, ok := query["coreUid"]; ok && v != "" { + tx = tx.Where("core_uid = ?", v) + } + if v, ok := query["neUid"]; ok && v != "" { + tx = tx.Where("ne_uid = ?", v) + } if v, ok := query["neType"]; ok && v != "" { tx = tx.Where("ne_type = ?", v) } diff --git a/src/modules/tool/service/iperf.go b/src/modules/tool/service/iperf.go index 988ca0a3..83a85696 100644 --- a/src/modules/tool/service/iperf.go +++ b/src/modules/tool/service/iperf.go @@ -22,7 +22,7 @@ var NewIPerf = &IPerf{} type IPerf struct{} // Version 查询版本信息 -func (s *IPerf) Version(meType, neId, version string) (string, error) { +func (s *IPerf) Version(coreUid, neUid, version string) (string, error) { if version != "V2" && version != "V3" { return "", fmt.Errorf("iperf version is required V2 or V3") } @@ -32,7 +32,7 @@ func (s *IPerf) Version(meType, neId, version string) (string, error) { } // 网元主机的SSH客户端 - sshClient, err := neService.NewNeInfo.NeRunSSHClient(meType, neId) + sshClient, err := neService.NewNeInfo.NeRunSSHClient(coreUid, neUid) if err != nil { return "", err } @@ -50,13 +50,13 @@ func (s *IPerf) Version(meType, neId, version string) (string, error) { } // Install 安装iperf3 -func (s *IPerf) Install(meType, neId, version string) error { +func (s *IPerf) Install(coreUid, neUid, version string) error { if version != "V2" && version != "V3" { return fmt.Errorf("iperf version is required V2 or V3") } // 网元主机的SSH客户端 - sshClient, err := neService.NewNeInfo.NeRunSSHClient(meType, neId) + sshClient, err := neService.NewNeInfo.NeRunSSHClient(coreUid, neUid) if err != nil { return err } diff --git a/src/modules/tool/service/ping.go b/src/modules/tool/service/ping.go index 9e128fea..d6e2966e 100644 --- a/src/modules/tool/service/ping.go +++ b/src/modules/tool/service/ping.go @@ -136,9 +136,9 @@ func (s *Ping) StatisticsOn(client *wsModel.WSClient, reqMsg wsModel.WSRequest) } // Version 查询版本信息 -func (s *Ping) Version(meType, neId string) (string, error) { +func (s *Ping) Version(coreUid, neUid string) (string, error) { // 检查是否安装ping - output, err := neService.NewNeInfo.NeRunSSHCmd(meType, neId, "ping -V") + output, err := neService.NewNeInfo.NeRunSSHCmd(coreUid, neUid, "ping -V") if err != nil { return "", fmt.Errorf("ping not installed") } diff --git a/src/modules/trace/controller/tcpdump.go b/src/modules/trace/controller/tcpdump.go index e81b66e5..929bab70 100644 --- a/src/modules/trace/controller/tcpdump.go +++ b/src/modules/trace/controller/tcpdump.go @@ -39,9 +39,9 @@ type TCPdumpController struct { func (s *TCPdumpController) DumpStart(c *gin.Context) { language := reqctx.AcceptLanguage(c) var body struct { - NeType string `json:"neType" binding:"required"` // 网元类型 - NeId string `json:"neId" binding:"required"` // 网元ID - Cmd string `json:"cmd" binding:"required"` // 命令 "-n -s 0 -v" + CoreUid string `form:"coreUid" binding:"required"` // 核心网唯一资源标识 + NeUid string `form:"neUid" binding:"required"` // 网元唯一资源标识 + Cmd string `json:"cmd" binding:"required"` // 命令 "-n -s 0 -v" } if err := c.ShouldBindBodyWithJSON(&body); err != nil { errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) @@ -49,7 +49,7 @@ func (s *TCPdumpController) DumpStart(c *gin.Context) { return } - taskCode, err := s.tcpdumpService.DumpStart(body.NeType, body.NeId, body.Cmd) + taskCode, err := s.tcpdumpService.DumpStart(body.CoreUid, body.NeUid, body.Cmd) if err != nil { c.JSON(200, resp.ErrMsg(i18n.TKey(language, err.Error()))) return @@ -73,8 +73,8 @@ func (s *TCPdumpController) DumpStart(c *gin.Context) { func (s *TCPdumpController) DumpStop(c *gin.Context) { language := reqctx.AcceptLanguage(c) var body struct { - NeType string `json:"neType" binding:"required"` // 网元类型 - NeId string `json:"neId" binding:"required"` // 网元ID + CoreUid string `json:"coreUid" binding:"required"` // 核心网唯一资源标识 + NeUid string `json:"neUid" binding:"required"` // 网元唯一资源标识 TaskCode string `json:"taskCode" binding:"required"` // 任务码,停止任务并查看日志信息 } if err := c.ShouldBindBodyWithJSON(&body); err != nil { @@ -83,7 +83,7 @@ func (s *TCPdumpController) DumpStop(c *gin.Context) { return } - logFiles, err := s.tcpdumpService.DumpStop(body.NeType, body.NeId, body.TaskCode) + logFiles, err := s.tcpdumpService.DumpStop(body.CoreUid, body.NeUid, body.TaskCode) if err != nil { c.JSON(200, resp.ErrMsg(i18n.TKey(language, err.Error()))) return @@ -107,9 +107,9 @@ func (s *TCPdumpController) DumpStop(c *gin.Context) { func (s *TCPdumpController) UPFTrace(c *gin.Context) { language := reqctx.AcceptLanguage(c) var body struct { - NeType string `json:"neType" binding:"required"` // 网元类型 - NeId string `json:"neId" binding:"required"` // 网元ID - Cmd string `json:"cmd" binding:"required"` // 命令 + CoreUid string `json:"coreUid" binding:"required"` // 核心网唯一资源标识 + NeUid string `json:"neUid" binding:"required"` // 网元唯一资源标识 + Cmd string `json:"cmd" binding:"required"` // 命令 } if err := c.ShouldBindBodyWithJSON(&body); err != nil { errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) @@ -117,7 +117,7 @@ func (s *TCPdumpController) UPFTrace(c *gin.Context) { return } - msg, err := s.tcpdumpService.UPFTrace(body.NeType, body.NeId, body.Cmd) + msg, err := s.tcpdumpService.UPFTrace(body.CoreUid, body.NeUid, body.Cmd) if err != nil { c.JSON(200, resp.ErrMsg(i18n.TKey(language, err.Error()))) return diff --git a/src/modules/trace/controller/trace_task.go b/src/modules/trace/controller/trace_task.go index 75a4db94..c7ef698f 100644 --- a/src/modules/trace/controller/trace_task.go +++ b/src/modules/trace/controller/trace_task.go @@ -8,7 +8,6 @@ import ( "be.ems/src/framework/i18n" "be.ems/src/framework/reqctx" "be.ems/src/framework/resp" - "be.ems/src/framework/utils/parse" "be.ems/src/modules/trace/model" traceService "be.ems/src/modules/trace/service" @@ -33,26 +32,36 @@ type TraceTaskController struct { // GET /list func (s *TraceTaskController) List(c *gin.Context) { query := reqctx.QueryMap(c) + coreUid, coreUidOk := query["coreUid"] + if !coreUidOk || coreUid == "" { + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: coreUid is empty")) + return + } + rows, total := s.traceTaskService.FindByPage(query) c.JSON(200, resp.OkData(map[string]any{"rows": rows, "total": total})) } // 跟踪任务信息 // -// GET /:id +// GET / func (s *TraceTaskController) Info(c *gin.Context) { - id := parse.Number(c.Param("id")) - if id <= 0 { - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: id is empty")) + var query struct { + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + ID int64 `form:"id" binding:"required"` // ID + } + if err := c.ShouldBindQuery(&query); err != nil { + errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs)) return } - data := s.traceTaskService.FindById(id) - if data.ID == id { - c.JSON(200, resp.OkData(data)) + data := s.traceTaskService.FindById(query.ID) + if data.ID != query.ID || data.CoreUID != query.CoreUID { + c.JSON(200, resp.ErrMsg("not found")) return } - c.JSON(200, resp.Err(nil)) + c.JSON(200, resp.OkData(data)) } // 跟踪任务新增 @@ -84,21 +93,17 @@ func (s *TraceTaskController) Add(c *gin.Context) { // DELETE /:id func (s *TraceTaskController) Remove(c *gin.Context) { language := reqctx.AcceptLanguage(c) - id := c.Param("id") - if id == "" { - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: id is empty")) + var query struct { + CoreUID string `form:"coreUid" binding:"required"` // 核心网唯一标识 + ID int64 `form:"id" binding:"required"` // 记录ID + } + if err := c.ShouldBindQuery(&query); err != nil { + errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err)) + c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs)) return } - // 处理字符转id数组后去重 - uniqueIDs := parse.RemoveDuplicatesToArray(id, ",") - // 转换成int64数组类型 - ids := make([]int64, 0) - for _, v := range uniqueIDs { - ids = append(ids, parse.Number(v)) - } - - rows, err := s.traceTaskService.DeleteByIds(ids) + rows, err := s.traceTaskService.DeleteByIds(query.ID, query.CoreUID) if err != nil { c.JSON(200, resp.ErrMsg(i18n.TKey(language, err.Error()))) return diff --git a/src/modules/trace/controller/trace_task_hlr.go b/src/modules/trace/controller/trace_task_hlr.go index a70eb536..202dabd2 100644 --- a/src/modules/trace/controller/trace_task_hlr.go +++ b/src/modules/trace/controller/trace_task_hlr.go @@ -186,8 +186,8 @@ func (s *TraceTaskHlrController) File(c *gin.Context) { func (s *TraceTaskHlrController) FilePull(c *gin.Context) { language := reqctx.AcceptLanguage(c) var querys struct { - NeType string `form:"neType" binding:"required"` - NeID string `form:"neId" binding:"required"` + CoreUid string `form:"coreUid" binding:"required"` // 核心网唯一资源标识 + NeUid string `form:"neUid" binding:"required"` // 网元唯一资源标识 Path string `form:"path" binding:"required"` FileName string `form:"fileName" binding:"required"` DelTemp bool `form:"delTemp"` // 删除本地临时文件 @@ -199,14 +199,14 @@ func (s *TraceTaskHlrController) FilePull(c *gin.Context) { } // 查询网元获取IP - neInfo := s.neInfoService.FindByNeTypeAndNeID(querys.NeType, querys.NeID) - if neInfo.NeId != querys.NeID || neInfo.IP == "" { - c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, i18n.TKey(language, "app.common.noNEInfo"))) + neInfo := s.neInfoService.FindByCoreUidAndNeUid(querys.CoreUid, querys.NeUid) + if neInfo.CoreUID != querys.CoreUid || neInfo.NeUID != querys.NeUid { + c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo"))) return } // 网元主机的SSH客户端 - sshClient, err := s.neInfoService.NeRunSSHClient(neInfo.NeType, neInfo.NeId) + sshClient, err := s.neInfoService.NeRunSSHClient(neInfo.CoreUID, neInfo.NeUID) if err != nil { c.JSON(200, resp.ErrMsg(err.Error())) return diff --git a/src/modules/trace/model/trace_task.go b/src/modules/trace/model/trace_task.go index 4a2ff489..3b6de854 100644 --- a/src/modules/trace/model/trace_task.go +++ b/src/modules/trace/model/trace_task.go @@ -16,7 +16,8 @@ type TraceTask struct { CreateTime int64 `json:"createTime" gorm:"column:create_time"` // 创建时间 Title string `json:"title" gorm:"column:title" binding:"required"` // 任务标题 Remark string `json:"remark" gorm:"column:remark"` // 备注 - NeList string `json:"neList" gorm:"column:ne_list" binding:"required"` // 网元列表 neType_neId 例如 UDM_001,AMF_001 + CoreUID string `json:"coreUid" gorm:"column:core_uid" binding:"required"` // 核心网唯一标识 + NeList string `json:"neList" gorm:"column:ne_list" binding:"required"` // 网元列表 neUid,neUid NotifyUrl string `json:"notifyUrl" gorm:"column:notify_url"` // 信息数据通知回调地址UDP 例如udp:192.168.5.58:33033 } diff --git a/src/modules/trace/repository/trace_task.go b/src/modules/trace/repository/trace_task.go index b2a788b3..3f0d5e8f 100644 --- a/src/modules/trace/repository/trace_task.go +++ b/src/modules/trace/repository/trace_task.go @@ -118,11 +118,11 @@ func (r TraceTask) SelectByIds(ids []int64) []model.TraceTask { } // SelectByUnstopped 查询未停止的任务补发 -func (r TraceTask) SelectByUnstopped(neStr string) []model.TraceTask { +func (r TraceTask) SelectByUnstopped(coreUid, neUid string) []model.TraceTask { rows := []model.TraceTask{} tx := db.DB("").Model(&model.TraceTask{}) // 构建查询条件 - tx = tx.Where("end_time > ? and ne_list like ?", time.Now().UnixMilli(), fmt.Sprintf("%%%s%%", neStr)) + tx = tx.Where("end_time > ? and core_uid = ? and ne_list like ?", time.Now().UnixMilli(), coreUid, fmt.Sprintf("%%%s%%", neUid)) // 查询数据 if err := tx.Find(&rows).Error; err != nil { logger.Errorf("query find err => %v", err.Error()) diff --git a/src/modules/trace/service/tcpdump.go b/src/modules/trace/service/tcpdump.go index cb0bd187..4255715f 100644 --- a/src/modules/trace/service/tcpdump.go +++ b/src/modules/trace/service/tcpdump.go @@ -27,19 +27,19 @@ type TCPdump struct { var dumpPIDMap sync.Map // DumpStart 触发tcpdump开始抓包 -func (s *TCPdump) DumpStart(neType, neId, cmdStr string) (string, error) { +func (s *TCPdump) DumpStart(coreUid, neUid, cmdStr string) (string, error) { // 命令检查 if strings.Contains(cmdStr, "-w") { return "", fmt.Errorf("command cannot contain -w") } // 查询网元获取IP - neInfo := s.neInfoService.FindByNeTypeAndNeID(neType, neId) - if neInfo.NeId != neId || neInfo.IP == "" { + neInfo := s.neInfoService.FindByCoreUidAndNeUid(coreUid, neUid) + if neInfo.CoreUID != coreUid || neInfo.NeUID != neUid { return "", fmt.Errorf("app.common.noNEInfo") } // 网元主机的SSH客户端 - sshClient, err := s.neInfoService.NeRunSSHClient(neInfo.NeType, neInfo.NeId) + sshClient, err := s.neInfoService.NeRunSSHClient(coreUid, neUid) if err != nil { return "", err } @@ -55,7 +55,7 @@ func (s *TCPdump) DumpStart(neType, neId, cmdStr string) (string, error) { taskCode := time.Now().Format("20060102150405") // 存放文件目录 /usr/local/omc/tcpdump/udm/001/20240817104241 - neDirTemp := fmt.Sprintf("/usr/local/omc/tcpdump/%s/%s/%s", strings.ToLower(neInfo.NeType), neInfo.NeId, taskCode) + neDirTemp := fmt.Sprintf("/usr/local/omc/tcpdump/%s/%s/%s", strings.ToLower(neInfo.NeType), neInfo.NeUID, taskCode) sshClient.RunCMD(fmt.Sprintf("sudo mkdir -p %s && sudo chmod 777 -R /usr/local/omc/tcpdump", neDirTemp)) // 命令拼装 @@ -80,36 +80,36 @@ func (s *TCPdump) DumpStart(neType, neId, cmdStr string) (string, error) { } // 日志文件行号 - PIDMap := s.logFileLastLine(neType, sshClient) + PIDMap := s.logFileLastLine(neInfo.NeType, sshClient) PIDMap["neType"] = neInfo.NeType - PIDMap["neId"] = neInfo.NeId + PIDMap["neUid"] = neInfo.NeUID PIDMap["taskCode"] = taskCode PIDMap["pid"] = outputPID PIDMap["cmd"] = sendCmd // 检查进程 ps aux | grep tcpdump // 强杀 sudo pkill tcpdump - pidKey := fmt.Sprintf("%s_%s_%s", strings.ToLower(neInfo.NeType), neInfo.NeId, taskCode) + pidKey := fmt.Sprintf("%s_%s", neInfo.NeUID, taskCode) dumpPIDMap.Store(pidKey, PIDMap) return taskCode, err } // DumpStop 停止已存在抓包句柄 -func (s *TCPdump) DumpStop(neType, neId, taskCode string) ([]string, error) { +func (s *TCPdump) DumpStop(coreUid, neUid, taskCode string) ([]string, error) { // 查询网元获取IP - neInfo := s.neInfoService.FindByNeTypeAndNeID(neType, neId) - if neInfo.NeId != neId || neInfo.IP == "" { + neInfo := s.neInfoService.FindByCoreUidAndNeUid(coreUid, neUid) + if neInfo.CoreUID != coreUid || neInfo.NeUID != neUid { return []string{}, fmt.Errorf("app.common.noNEInfo") } // 网元主机的SSH客户端 - sshClient, err := s.neInfoService.NeRunSSHClient(neInfo.NeType, neInfo.NeId) + sshClient, err := s.neInfoService.NeRunSSHClient(coreUid, neUid) if err != nil { return []string{}, err } defer sshClient.Close() // 是否存在执行过的进程 - pidKey := fmt.Sprintf("%s_%s_%s", strings.ToLower(neInfo.NeType), neInfo.NeId, taskCode) + pidKey := fmt.Sprintf("%s_%s_%s", strings.ToLower(neInfo.NeType), neInfo.NeUID, taskCode) PIDMap, ok := dumpPIDMap.Load(pidKey) if !ok || PIDMap == nil { return []string{}, fmt.Errorf("tcpdump is not running") @@ -121,7 +121,7 @@ func (s *TCPdump) DumpStop(neType, neId, taskCode string) ([]string, error) { s.logFileLastLineToFile(PIDMap.(map[string]string), sshClient) // 存放文件目录 /usr/local/omc/tcpdump/udm/001/20240817104241 - neDirTemp := fmt.Sprintf("/usr/local/omc/tcpdump/%s/%s/%s", strings.ToLower(neInfo.NeType), neInfo.NeId, taskCode) + neDirTemp := fmt.Sprintf("/usr/local/omc/tcpdump/%s/%s/%s", strings.ToLower(neInfo.NeType), neInfo.NeUID, taskCode) // 命令拼装 sendCmd := fmt.Sprintf("pids=$(pgrep -P %s) && [ -n \"$pids\" ] && sudo kill $pids;sudo timeout 2s ls %s", pid, neDirTemp) // pids=$(pgrep -P 1914341) && [ -n "$pids" ] && sudo kill $pids;sudo timeout 2s ls /usr/local/omc/tcpdump/udm/001/20240817104241 @@ -180,10 +180,10 @@ func (s *TCPdump) logFileLastLineToFile(PIDMap map[string]string, sshClient *ssh defer sftpClient.Close() neType := PIDMap["neType"] - neId := PIDMap["neId"] + neUid := PIDMap["neUid"] taskCode := PIDMap["taskCode"] // 存放文件目录 /usr/local/omc/tcpdump/udm/001/20240817104241 - neDirTemp := fmt.Sprintf("/usr/local/omc/tcpdump/%s/%s/%s", strings.ToLower(neType), neId, taskCode) + neDirTemp := fmt.Sprintf("/usr/local/omc/tcpdump/%s/%s/%s", strings.ToLower(neType), neUid, taskCode) sshClient.RunCMD(fmt.Sprintf("sudo mkdir -p %s && sudo chmod 777 -R /usr/local/omc/tcpdump", neDirTemp)) lastLineMap := s.logFileLastLine(neType, sshClient) @@ -208,25 +208,25 @@ func (s *TCPdump) logFileLastLineToFile(PIDMap map[string]string, sshClient *ssh } // UPFTrace UPF标准版内部抓包 -func (s *TCPdump) UPFTrace(neType, neId, cmdStr string) (string, error) { +func (s *TCPdump) UPFTrace(coreUid, neUid, cmdStr string) (string, error) { // 命令检查 if strings.Contains(cmdStr, "file") { return "", fmt.Errorf("command cannot contain file") } // 查询网元获取IP - neInfo := s.neInfoService.FindByNeTypeAndNeID(neType, neId) - if neInfo.NeId != neId || neInfo.IP == "" { + neInfo := s.neInfoService.FindByCoreUidAndNeUid(coreUid, neUid) + if neInfo.CoreUID != coreUid || neInfo.NeUID != neUid { return "", fmt.Errorf("app.common.noNEInfo") } // 网元主机的SSH客户端 - sshClient, err := s.neInfoService.NeRunSSHClient(neInfo.NeType, neInfo.NeId) + sshClient, err := s.neInfoService.NeRunSSHClient(coreUid, neUid) if err != nil { return "", err } defer sshClient.Close() // 网元主机的Telnet客户端 - telnetClient, err := s.neInfoService.NeRunTelnetClient("UPF", neInfo.NeId, 2) + telnetClient, err := s.neInfoService.NeRunTelnetClient(coreUid, neUid, 2) if err != nil { return "", err } @@ -234,7 +234,7 @@ func (s *TCPdump) UPFTrace(neType, neId, cmdStr string) (string, error) { telnetClient.RunCMD("") // 再次排空信息 // 命令拼装 - fileName := fmt.Sprintf("%s_%s_part_%s.pcap ", neInfo.NeType, neInfo.NeId, time.Now().Format("20060102150405")) + fileName := fmt.Sprintf("%s_%s_part_%s.pcap ", neInfo.NeType, neInfo.NeUID, time.Now().Format("20060102150405")) pcapCmd := fmt.Sprintf("%s\r\n", cmdStr) // 以off结尾是停止抓包,不需要写文件 if !strings.Contains(cmdStr, "off") { diff --git a/src/modules/trace/service/trace_task.go b/src/modules/trace/service/trace_task.go index ad3414e1..4bb54b65 100644 --- a/src/modules/trace/service/trace_task.go +++ b/src/modules/trace/service/trace_task.go @@ -216,14 +216,14 @@ func (r TraceTask) createTaskToNe(task *model.TraceTask, ignoreErr bool) error { logger.Warnf("ne type id is error") continue } - neInfo := neService.NewNeInfo.FindByNeTypeAndNeID(neTypeIDArr[0], neTypeIDArr[1]) - if neInfo.NeType != neTypeIDArr[0] || neInfo.IP == "" { - logger.Warnf("ne type id is not exist") + neInfo := neService.NewNeInfo.FindByCoreUidAndNeUid(task.CoreUID, neTypeIDArr[1]) + if neInfo.CoreUID != task.CoreUID || neInfo.NeUID != neTypeIDArr[1] { + logger.Warnf("ne uid is not exist") continue } if err := r.traceNeTask(neInfo, *task); err != nil { - logger.Errorf("ne type id is %s to %s error: %s", task.TraceId, neTypeID, err.Error()) - errNe = append(errNe, neTypeID) + logger.Errorf("ne uid is %s to %s error: %s", task.TraceId, neTypeIDArr[1], err.Error()) + errNe = append(errNe, neTypeIDArr[1]) continue } } @@ -234,10 +234,11 @@ func (r TraceTask) createTaskToNe(task *model.TraceTask, ignoreErr bool) error { for _, neTypeID := range neList { neTypeIDArr := strings.Split(neTypeID, "_") if len(neTypeIDArr) != 2 { + logger.Warnf("ne type id is error") continue } - neInfo := neService.NewNeInfo.FindByNeTypeAndNeID(neTypeIDArr[0], neTypeIDArr[1]) - if neInfo.NeType != neTypeIDArr[0] || neInfo.IP == "" { + neInfo := neService.NewNeInfo.FindByCoreUidAndNeUid(task.CoreUID, neTypeIDArr[1]) + if neInfo.CoreUID != task.CoreUID || neInfo.NeUID != neTypeIDArr[1] { continue } neFetchlink.NeTraceDelete(neInfo, task.TraceId) @@ -294,49 +295,51 @@ func (r TraceTask) traceNeTask(neInfo neModel.NeInfo, task model.TraceTask) erro } // DeleteByIds 批量删除信息 -func (r TraceTask) DeleteByIds(ids []int64) (int64, error) { +func (r TraceTask) DeleteByIds(id int64, coreUid string) (int64, error) { // 检查是否存在 - rows := r.traceTaskRepository.SelectByIds(ids) - if len(rows) <= 0 { + rows := r.traceTaskRepository.SelectByIds([]int64{id}) + if len(rows) != 1 { return 0, fmt.Errorf("not data") } - if len(rows) == len(ids) { - // 删除数据同时给网元发送停止任务 - for _, v := range rows { - // 删除数据 - r.traceDataRepository.DeleteByTraceId(v.TraceId) + for _, v := range rows { + if v.CoreUID != coreUid { + return 0, fmt.Errorf("data not match, id: %d", v.ID) + } + } + // 删除数据同时给网元发送停止任务 + for _, v := range rows { + // 删除数据 + r.traceDataRepository.DeleteByTraceId(v.TraceId) - // 网元列表 - neList := strings.Split(v.NeList, ",") - if len(neList) <= 0 { + // 网元列表 + neList := strings.Split(v.NeList, ",") + if len(neList) <= 0 { + continue + } + // 停止任务 + for _, neTypeID := range neList { + neTypeIDArr := strings.Split(neTypeID, "_") + if len(neTypeIDArr) != 2 { + logger.Warnf("ne type id is error") continue } - // 停止任务 - for _, neTypeID := range neList { - neTypeIDArr := strings.Split(neTypeID, "_") - if len(neTypeIDArr) != 2 { - continue - } - neInfo := neService.NewNeInfo.FindByNeTypeAndNeID(neTypeIDArr[0], neTypeIDArr[1]) - if neInfo.NeType != neTypeIDArr[0] || neInfo.IP == "" { - continue - } - neFetchlink.NeTraceDelete(neInfo, v.TraceId) + neInfo := neService.NewNeInfo.FindByCoreUidAndNeUid(v.CoreUID, neTypeIDArr[1]) + if neInfo.CoreUID != v.CoreUID || neInfo.NeUID != neTypeIDArr[1] { + continue } + neFetchlink.NeTraceDelete(neInfo, v.TraceId) } - - num := r.traceTaskRepository.DeleteByIds(ids) - return num, nil } - // 删除信息失败! - return 0, fmt.Errorf("delete fail") + + num := r.traceTaskRepository.DeleteByIds([]int64{id}) + return num, nil + } // RunUnstopped 启动跟踪未停止的任务 -func (r TraceTask) RunUnstopped(neType string, neId string) { - neStr := fmt.Sprintf("%s_%s", neType, neId) - tasks := r.traceTaskRepository.SelectByUnstopped(neStr) +func (r TraceTask) RunUnstopped(coreUid, neUid string) { + tasks := r.traceTaskRepository.SelectByUnstopped(coreUid, neUid) for _, task := range tasks { r.createTaskToNe(&task, true) } diff --git a/src/modules/trace/service/trace_task_hlr.go b/src/modules/trace/service/trace_task_hlr.go index 60e7ef56..c8a56d6a 100644 --- a/src/modules/trace/service/trace_task_hlr.go +++ b/src/modules/trace/service/trace_task_hlr.go @@ -60,7 +60,7 @@ func (r *TraceTaskHlr) DeleteByIds(ids []int64) (int64, error) { if len(rows) == len(ids) { // 停止任务 - neInfos := r.neInfoService.Find(neModel.NeInfo{NeType: "UDM"}, false, false) + neInfos := r.neInfoService.Find(neModel.NeInfo{NeType: "HLR"}, false, false) for _, r := range rows { if r.Status == "0" { continue @@ -98,12 +98,13 @@ func (r *TraceTaskHlr) Start(task model.TraceTaskHlr) (int64, error) { } // 发送创建任务 - neInfos := r.neInfoService.Find(neModel.NeInfo{NeType: "UDM"}, false, false) + neInfos := r.neInfoService.Find(neModel.NeInfo{NeType: "HLR"}, false, false) for _, neInfo := range neInfos { hlrItem := map[string]any{ - "neType": neInfo.NeType, - "neId": neInfo.NeId, - "msg": "", + "coreUid": neInfo.CoreUID, + "neUid": neInfo.NeUID, + "neType": neInfo.NeType, + "msg": "", } msg, err := neFetchlink.HLRTraceStart(neInfo, data) if err != nil { @@ -129,12 +130,13 @@ func (r *TraceTaskHlr) Start(task model.TraceTaskHlr) (int64, error) { func (r *TraceTaskHlr) Stop(task model.TraceTaskHlr) error { hlrList := []map[string]any{} // 发送停止任务 - neInfos := r.neInfoService.Find(neModel.NeInfo{NeType: "UDM"}, false, false) + neInfos := r.neInfoService.Find(neModel.NeInfo{NeType: "HLR"}, false, false) for _, neInfo := range neInfos { hlrItem := map[string]any{ - "neType": neInfo.NeType, - "neId": neInfo.NeId, - "msg": "", + "coreUid": neInfo.CoreUID, + "neUid": neInfo.NeUID, + "neType": neInfo.NeType, + "msg": "", } msg, err := neFetchlink.HLRTraceStop(neInfo, map[string]any{ "traceIDArray": []string{task.TraceId}, @@ -161,7 +163,7 @@ func (r *TraceTaskHlr) Stop(task model.TraceTaskHlr) error { func (r *TraceTaskHlr) File(traceId, dirPath string) ([]map[string]any, error) { hlrList := []map[string]any{} // 查询所有匹配的网元类型 - neInfos := r.neInfoService.Find(neModel.NeInfo{NeType: "UDM"}, false, false) + neInfos := r.neInfoService.Find(neModel.NeInfo{NeType: "HLR"}, false, false) if len(neInfos) == 0 { return nil, fmt.Errorf("not found network element") } @@ -169,14 +171,15 @@ func (r *TraceTaskHlr) File(traceId, dirPath string) ([]map[string]any, error) { // 遍历多个网元主机获取文件 for _, neInfo := range neInfos { hlrItem := map[string]any{ - "neType": neInfo.NeType, - "neId": neInfo.NeId, - "neName": neInfo.NeName, - "err": "", + "coreUid": neInfo.CoreUID, + "neUid": neInfo.NeUID, + "neType": neInfo.NeType, + "neName": neInfo.NeName, + "err": "", } // 网元主机的SSH客户端 - sshClient, err := r.neInfoService.NeRunSSHClient(neInfo.NeType, neInfo.NeId) + sshClient, err := r.neInfoService.NeRunSSHClient(neInfo.CoreUID, neInfo.NeUID) if err != nil { hlrItem["err"] = "ssh link fail" hlrList = append(hlrList, hlrItem) diff --git a/src/modules/trace/trace.go b/src/modules/trace/trace.go index 41f03496..75995624 100644 --- a/src/modules/trace/trace.go +++ b/src/modules/trace/trace.go @@ -99,7 +99,7 @@ func Setup(router *gin.Engine) { middleware.AuthorizeUser(nil), controller.NewTraceTask.List, ) - taskGroup.GET("/:id", + taskGroup.GET("", middleware.AuthorizeUser(nil), controller.NewTraceTask.Info, ) @@ -108,7 +108,7 @@ func Setup(router *gin.Engine) { collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.task", collectlogs.BUSINESS_TYPE_INSERT)), controller.NewTraceTask.Add, ) - taskGroup.DELETE("/:id", + taskGroup.DELETE("", middleware.AuthorizeUser(nil), collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.task", collectlogs.BUSINESS_TYPE_DELETE)), controller.NewTraceTask.Remove, diff --git a/src/modules/ws/processor/cdr_connect.go b/src/modules/ws/processor/cdr_connect.go index a678b8f9..cf124215 100644 --- a/src/modules/ws/processor/cdr_connect.go +++ b/src/modules/ws/processor/cdr_connect.go @@ -22,12 +22,17 @@ func GetCDRConnect(requestID string, data any) ([]byte, error) { query[k] = fmt.Sprintf("%v", v) } - // 查询网元信息 rmUID - neInfo := neInfoService.NewNeInfo.FindByNeTypeAndNeID(query["neType"], query["neId"]) - if neInfo.NeType == "" { + coreUid, coreUidOk := query["coreUid"] + neUid, neUidOk := query["neUid"] + if !coreUidOk || !neUidOk || coreUid == "" || neUid == "" { + return nil, fmt.Errorf("query coreUid or neUid is empty") + } + + // 查询网元获取IP + neInfo := neInfoService.NewNeInfo.FindByCoreUidAndNeUid(coreUid, neUid) + if neInfo.CoreUID != coreUid || neInfo.NeUID != neUid { return nil, fmt.Errorf("query neinfo not found") } - query["rmUID"] = neInfo.RmUID rows, total := neDataService.NewCDREvent.FindByPage(neInfo.NeType, query) resultByte, err := json.Marshal(resp.Ok(map[string]any{ "requestId": requestID, diff --git a/src/modules/ws/processor/ne_state.go b/src/modules/ws/processor/ne_state.go index 976d759c..1a4ebe9a 100644 --- a/src/modules/ws/processor/ne_state.go +++ b/src/modules/ws/processor/ne_state.go @@ -14,8 +14,8 @@ import ( func GetNeState(requestID string, data any) ([]byte, error) { msgByte, _ := json.Marshal(data) var querys struct { - NeType string `json:"neType" form:"neType" binding:"required"` - NeID string `json:"neId" form:"neId" binding:"required"` + CoreUid string `json:"coreUid" binding:"required"` // 核心网唯一资源标识 + NeUid string `json:"neUid" binding:"required"` // 网元唯一资源标识 } err := json.Unmarshal(msgByte, &querys) if err != nil { @@ -23,13 +23,13 @@ func GetNeState(requestID string, data any) ([]byte, error) { return nil, fmt.Errorf("query data structure error") } - if querys.NeType == "" || querys.NeID == "" { - return nil, fmt.Errorf("query neType any neId empty") + if querys.CoreUid == "" || querys.NeUid == "" { + return nil, fmt.Errorf("query coreUid/neUid empty") } // 查询网元获取IP - neInfo := neService.NewNeInfo.FindByNeTypeAndNeID(querys.NeType, querys.NeID) - if neInfo.NeId != querys.NeID || neInfo.IP == "" { + neInfo := neService.NewNeInfo.FindByCoreUidAndNeUid(querys.CoreUid, querys.NeUid) + if neInfo.CoreUID != querys.CoreUid || neInfo.NeUID != querys.NeUid { return nil, fmt.Errorf("no matching network element information found") } @@ -39,11 +39,12 @@ func GetNeState(requestID string, data any) ([]byte, error) { resultByte, err := json.Marshal(resp.Ok(map[string]any{ "requestId": requestID, "data": map[string]any{ - "online": false, - "neId": neInfo.NeId, - "neName": neInfo.NeName, - "neType": neInfo.NeType, - "neIP": neInfo.IP, + "online": false, + "coreUid": neInfo.CoreUID, + "neUid": neInfo.NeUID, + "neName": neInfo.NeName, + "neType": neInfo.NeType, + "neIPAddr": neInfo.IPAddr, }, })) return resultByte, err diff --git a/src/modules/ws/processor/ue_connect.go b/src/modules/ws/processor/ue_connect.go index 941828ea..0b9bbe36 100644 --- a/src/modules/ws/processor/ue_connect.go +++ b/src/modules/ws/processor/ue_connect.go @@ -22,12 +22,17 @@ func GetUEConnect(requestID string, data any) ([]byte, error) { query[k] = fmt.Sprintf("%v", v) } - // 查询网元信息 rmUID - neInfo := neService.NewNeInfo.FindByNeTypeAndNeID(query["neType"], query["neId"]) - if neInfo.NeType == "" { + coreUid, coreUidOk := query["coreUid"] + neUid, neUidOk := query["neUid"] + if !coreUidOk || !neUidOk || coreUid == "" || neUid == "" { + return nil, fmt.Errorf("query coreUid or neUid is empty") + } + + // 查询网元获取IP + neInfo := neService.NewNeInfo.FindByCoreUidAndNeUid(coreUid, neUid) + if neInfo.CoreUID != coreUid || neInfo.NeUID != neUid { return nil, fmt.Errorf("query neinfo not found") } - query["rmUID"] = neInfo.RmUID rows, total := neDataService.NewUEEvent.FindByPage(neInfo.NeType, query) resultByte, err := json.Marshal(resp.Ok(map[string]any{ "requestId": requestID, diff --git a/src/modules/ws/processor/upf_total_flow.go b/src/modules/ws/processor/upf_total_flow.go index bb48dce5..9e5020aa 100644 --- a/src/modules/ws/processor/upf_total_flow.go +++ b/src/modules/ws/processor/upf_total_flow.go @@ -6,7 +6,6 @@ import ( "be.ems/src/framework/logger" "be.ems/src/framework/resp" - neService "be.ems/src/modules/ne/service" neDataService "be.ems/src/modules/ne_data/service" ) @@ -14,9 +13,8 @@ import ( func GetUPFTotalFlow(requestID string, data any) ([]byte, error) { msgByte, _ := json.Marshal(data) var querys struct { - NeType string `json:"neType" form:"neType" binding:"required"` - NeID string `json:"neId" form:"neId" binding:"required"` - Day int `json:"day" binding:"required"` + NeUID string `json:"neUid"` // 网元唯一标识 + Day int `json:"day"` } err := json.Unmarshal(msgByte, &querys) if err != nil { @@ -24,17 +22,11 @@ func GetUPFTotalFlow(requestID string, data any) ([]byte, error) { return nil, fmt.Errorf("query data structure error") } - if querys.NeType == "" || querys.NeID == "" || querys.Day < 0 { - return nil, fmt.Errorf("query neType any neId empty or day less 0 ") + if querys.NeUID == "" || querys.Day < 0 { + return nil, fmt.Errorf("query rmUid empty or day less 0 ") } - // 查询网元获取IP - neInfo := neService.NewNeInfo.FindByNeTypeAndNeID(querys.NeType, querys.NeID) - if neInfo.NeId != querys.NeID || neInfo.IP == "" { - return nil, fmt.Errorf("no matching network element information found") - } - - up, down := neDataService.NewKpiReport.UPFTodayFlowFind(neInfo.RmUID, querys.Day) + up, down := neDataService.NewKpiReport.UPFTodayFlowFind(querys.NeUID, querys.Day) resultByte, err := json.Marshal(resp.Ok(map[string]any{ "requestId": requestID,