Compare commits
23 Commits
85f7e3e4d8
...
2.2410.4-2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
54ed5c5e53 | ||
| 1ed5e91aa8 | |||
|
|
b00bb1eec0 | ||
|
|
a10052660f | ||
|
|
5f4859bdd2 | ||
| e335c75b53 | |||
| 8348ecc30b | |||
| 8ab91bab70 | |||
|
|
8b251a22ca | ||
| a1010c84e5 | |||
|
|
32852c95d8 | ||
|
|
c6c40e55d9 | ||
|
|
a0297990d9 | ||
|
|
6de6e32041 | ||
|
|
4170093610 | ||
|
|
88485221a0 | ||
|
|
e260795d3a | ||
|
|
44536f34d4 | ||
| 0adc47628f | |||
| 18701c7c41 | |||
| 9e5b4c1bf1 | |||
| 587e7a65f0 | |||
| 7be1132430 |
8
.vscode/launch.json
vendored
8
.vscode/launch.json
vendored
@@ -18,7 +18,7 @@
|
||||
"type": "go",
|
||||
"request": "launch",
|
||||
"mode": "debug",
|
||||
"program": "d:/local.git/be.ems/restagent/",
|
||||
"program": "d:/omc.git/be.ems/restagent/",
|
||||
"console": "integratedTerminal"
|
||||
},
|
||||
{
|
||||
@@ -26,7 +26,7 @@
|
||||
"type": "go",
|
||||
"request": "launch",
|
||||
"mode": "debug",
|
||||
"program": "d:/local.git/be.ems/sshsvc/sshsvc.go",
|
||||
"program": "d:/omc.git/be.ems/sshsvc/sshsvc.go",
|
||||
"console": "integratedTerminal"
|
||||
},
|
||||
{
|
||||
@@ -34,7 +34,7 @@
|
||||
"type": "go",
|
||||
"request": "launch",
|
||||
"mode": "debug",
|
||||
"program": "d:/local.git/be.ems/crontask",
|
||||
"program": "d:/omc.git/be.ems/crontask",
|
||||
"console": "integratedTerminal"
|
||||
},
|
||||
{
|
||||
@@ -42,7 +42,7 @@
|
||||
"type": "go",
|
||||
"request": "launch",
|
||||
"mode": "debug",
|
||||
"program": "d:/local.git/be.ems/tools/encode",
|
||||
"program": "d:/omc.git/be.ems/tools/encode",
|
||||
"console": "integratedTerminal"
|
||||
}
|
||||
]
|
||||
|
||||
11
CHANGELOG.md
11
CHANGELOG.md
@@ -1,6 +1,15 @@
|
||||
# 版本发布日志
|
||||
|
||||
## 2.2410.2-20241018
|
||||
## 2.2410.4-20241102
|
||||
|
||||
- 新增 直连网元信息取得hostname/os属性值
|
||||
- 新增 UDM鉴权签约imsi多查询
|
||||
- 更新 更新系统菜单新增关键指标概览
|
||||
- 更新 定时任务周期同步更新UDM用户数据
|
||||
- 更新 AMF/SMF参数配置项数据
|
||||
- 修复 SMSC安装时关联修改IMS和UDM配置
|
||||
|
||||
## 2.2410.3-20241018
|
||||
|
||||
- 新增 网元主机支持redis配置项
|
||||
- 新增 菜单功能iperf3/ping网络测试工具
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# level: /trace/debug/info/error/warn/error/fatal, default: debug
|
||||
# duration: saved days, default is 30 days
|
||||
logger:
|
||||
file: d:/local.git/be.ems/captrace/log/captrace.log
|
||||
file: d:/omc.git/be.ems/captrace/log/captrace.log
|
||||
level: trace
|
||||
duration: 24
|
||||
count: 10
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Makefile for rest agent project
|
||||
|
||||
PROJECT = OMC
|
||||
VERSION = 2.2410.2
|
||||
VERSION = 2.2410.4
|
||||
PLATFORM = amd64
|
||||
ARMPLATFORM = aarch64
|
||||
BUILDDIR = ../../build
|
||||
|
||||
@@ -80,6 +80,34 @@ amf:
|
||||
filter: "0~64"
|
||||
display: "PCF URI"
|
||||
comment: ""
|
||||
- name: "backupAusfUri"
|
||||
type: "string"
|
||||
value: "http://172.16.5.131:8080"
|
||||
access: "read-write"
|
||||
filter: "0~64"
|
||||
display: "Backup AUSF URI"
|
||||
comment: ""
|
||||
- name: "backupUdmUri"
|
||||
type: "string"
|
||||
value: "http://172.16.5.141:8080"
|
||||
access: "read-write"
|
||||
filter: "0~64"
|
||||
display: "Backup UDM URI"
|
||||
comment: ""
|
||||
- name: "backupSmfUri"
|
||||
type: "string"
|
||||
value: "http://172.16.5.151:8080"
|
||||
access: "read-write"
|
||||
filter: "0~64"
|
||||
display: "Backup SMF URI"
|
||||
comment: ""
|
||||
- name: "backupPcfUri"
|
||||
type: "string"
|
||||
value: "http://172.16.5.161:8080"
|
||||
access: "read-write"
|
||||
filter: "0~64"
|
||||
display: "Backup PCF URI"
|
||||
comment: ""
|
||||
- name: "lmfUri"
|
||||
type: "string"
|
||||
value: "http://172.16.5.200:8080"
|
||||
@@ -471,4 +499,3 @@ amf:
|
||||
filter: '{"0":"false","1":"true"}'
|
||||
display: "statusReportEnabled"
|
||||
comment: ""
|
||||
|
||||
|
||||
@@ -72,14 +72,14 @@ smf:
|
||||
access: "read-write"
|
||||
filter: ""
|
||||
display: "PCF URI"
|
||||
comment: ""
|
||||
comment: "URI1;URI2"
|
||||
- name: "udmUri"
|
||||
type: "string"
|
||||
value: "http://172.16.5.140:8080"
|
||||
access: "read-write"
|
||||
filter: ""
|
||||
display: "UDM URI"
|
||||
comment: ""
|
||||
comment: "URI1;URI2"
|
||||
- name: "chfEnable"
|
||||
type: "bool"
|
||||
value: "false"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# level: /trace/debug/info/error/warn/error/fatal, default: debug
|
||||
# duration: saved days, default is 30 days
|
||||
logger:
|
||||
file: d:/local.git/be.ems/crontask/log/crontask.log
|
||||
file: d:/omc.git/be.ems/crontask/log/crontask.log
|
||||
level: trace
|
||||
duration: 24
|
||||
count: 10
|
||||
@@ -26,7 +26,7 @@ database:
|
||||
port: 33066
|
||||
name: omc_db
|
||||
connParam: charset=utf8mb4&collation=utf8mb4_general_ci&parseTime=True&interpolateParams=True
|
||||
backup: d:/local.git/be.ems/restagent/database
|
||||
backup: d:/omc.git/be.ems/restagent/database
|
||||
|
||||
# northbound interface, cm/pm
|
||||
# duration(day): saved days
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Makefile for OMC-OMC-crontask project
|
||||
|
||||
PROJECT = OMC
|
||||
VERSION = 2.2410.2
|
||||
VERSION = 2.2410.4
|
||||
LIBDIR = be.ems/lib
|
||||
BINNAME = crontask
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Makefile for rest agent project
|
||||
|
||||
PROJECT = OMC
|
||||
VERSION = 2.2410.2
|
||||
VERSION = 2.2410.4
|
||||
RelDate = `date +%Y%m%d`
|
||||
Release = $(RelDate)
|
||||
RelVer = $(VERSION)-$(RelDate)
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -657,7 +657,7 @@ INSERT INTO `sys_dict_data` VALUES (2146, 2146, 'menu.dashboard.smscCDR', '短
|
||||
INSERT INTO `sys_dict_data` VALUES (2147, 2147, 'log.operate.title.smscCDR', '短信话单', 'i18n_zh', '', '', '1', 'supervisor', 1705550000000, '', 0, '');
|
||||
INSERT INTO `sys_dict_data` VALUES (2148, 2148, 'menu.trace.pcapFile', '信令抓包文件', 'i18n_zh', '', '', '1', 'supervisor', 1705550000000, '', 0, '');
|
||||
INSERT INTO `sys_dict_data` VALUES (2149, 2149, 'menu.trace.taskAnalyze', '跟踪数据分析', 'i18n_zh', '', '', '1', 'supervisor', 1705550000000, '', 0, '');
|
||||
-- INSERT INTO `sys_dict_data` VALUES (2150, 2150, 'dictData.udm_sub_cn_type.3', '5G&4G', 'i18n_zh', '', '', '1', 'supervisor', 1705550000000, '', 0, '');
|
||||
INSERT INTO `sys_dict_data` VALUES (2150, 2150, 'job.ne_data_udm', '网元数据-UDM数据刷新同步', 'i18n_zh', '', '', '1', 'supervisor', 1730173767412, '', 0, '');
|
||||
INSERT INTO `sys_dict_data` VALUES (2151, 2151, 'menu.system.setting.doc', '系统使用文档', 'i18n_zh', '', '', '1', 'supervisor', 1705550000000, '', 0, '');
|
||||
INSERT INTO `sys_dict_data` VALUES (2152, 2152, 'menu.system.setting.official', '官网链接', 'i18n_zh', '', '', '1', 'supervisor', 1705550000000, '', 0, '');
|
||||
INSERT INTO `sys_dict_data` VALUES (2153, 2153, 'menu.system.setting.lock', '锁屏操作', 'i18n_zh', '', '', '1', 'supervisor', 1705550000000, '', 0, '');
|
||||
|
||||
@@ -657,7 +657,7 @@ INSERT INTO `sys_dict_data` VALUES (4146, 4146, 'menu.dashboard.smscCDR', 'SMS C
|
||||
INSERT INTO `sys_dict_data` VALUES (4147, 4147, 'log.operate.title.smscCDR', 'SMS CDR', 'i18n_en', '', '', '1', 'supervisor', 1705550000000, '', 0, '');
|
||||
INSERT INTO `sys_dict_data` VALUES (4148, 4148, 'menu.trace.pcapFile', 'Signaling Capture File', 'i18n_en', '', '', '1', 'supervisor', 1718441035866, '', 0, '');
|
||||
INSERT INTO `sys_dict_data` VALUES (4149, 4149, 'menu.trace.taskAnalyze', 'Tracking Data Analysis', 'i18n_en', '', '', '1', 'supervisor', 1718441035866, '', 0, '');
|
||||
-- INSERT INTO `sys_dict_data` VALUES (4150, 4150, 'dictData.udm_sub_cn_type.3', '5G&4G', 'i18n_en', '', '', '1', 'supervisor', 1718441035866, '', 0, '');
|
||||
INSERT INTO `sys_dict_data` VALUES (4150, 4150, 'job.ne_data_udm', 'NE Data Sync UDM', 'i18n_en', '', '', '1', 'supervisor', 1730173767412, '', 0, '');
|
||||
INSERT INTO `sys_dict_data` VALUES (4151, 4151, 'menu.system.setting.doc', 'System User Documentation', 'i18n_en', '', '', '1', 'supervisor', 1705550000000, '', 0, '');
|
||||
INSERT INTO `sys_dict_data` VALUES (4152, 4152, 'menu.system.setting.official', 'Official Website', 'i18n_en', '', '', '1', 'supervisor', 1705550000000, '', 0, '');
|
||||
INSERT INTO `sys_dict_data` VALUES (4153, 4153, 'menu.system.setting.lock', 'Lockscreen Operation', 'i18n_en', '', '', '1', 'supervisor', 1705550000000, '', 0, '');
|
||||
|
||||
@@ -30,6 +30,7 @@ CREATE TABLE `sys_job` (
|
||||
-- ----------------------------
|
||||
INSERT INTO `sys_job` VALUES (1, 'job.monitor_sys_resource', 'SYSTEM', 'monitor_sys_resource', '{\"interval\":5}', '0 0/5 * * * ?', '3', '0', '1', '0', 'supervisor', 1698478134839, 'supervisor', 1700571615807, 'job.monitor_sys_resource_remark');
|
||||
INSERT INTO `sys_job` VALUES (2, 'job.ne_config_backup', 'SYSTEM', 'ne_config_backup', '', '0 30 0 * * ?', '3', '0', '1', '1', 'supervisor', 1698478134839, 'supervisor', 1700571615807, 'job.ne_config_backup_remark');
|
||||
INSERT INTO `sys_job` VALUES (3, 'job.ne_data_udm', 'SYSTEM', 'ne_data_udm', '', '0 0 0/2 * * ?', '3', '0', '1', '1', 'supervisor', 1730173767412, '', 0, '');
|
||||
INSERT INTO `sys_job` VALUES (4, 'job.delExpiredNeBackup', 'SYSTEM', 'delExpiredNeBackup', '{\"duration\":60}', '0 20 0 * * ?', '3', '0', '0', '1', 'supervisor', 1698478134840, NULL, 0, 'job.delExpiredNeBackupRemark');
|
||||
INSERT INTO `sys_job` VALUES (5, 'job.deleteExpiredAlarmRecord', 'SYSTEM', 'deleteExpiredRecord', '{\"duration\":90,\"tableName\":\"alarm\",\"colName\":\"event_time\",\"extras\":\"alarm_status=\'0\'\"}', '0 10 0 * * ?', '3', '0', '1', '1', 'supervisor', 1698478134841, NULL, 0, 'job.deleteExpiredAlarmRecordRemark');
|
||||
INSERT INTO `sys_job` VALUES (6, 'job.deleteExpiredKpiRecord', 'SYSTEM', 'deleteExpiredRecord', '{\"duration\":30,\"tableName\":\"gold_kpi\",\"colName\":\"date\"}', '0 15 0 * * ?', '3', '0', '1', '1', 'supervisor', 1698478134842, 'supervisor', 1700570673113, 'job.deleteExpiredKpiRecordRemark');
|
||||
|
||||
@@ -664,7 +664,7 @@ REPLACE INTO `sys_dict_data` VALUES (2146, 2146, 'menu.dashboard.smscCDR', '短
|
||||
REPLACE INTO `sys_dict_data` VALUES (2147, 2147, 'log.operate.title.smscCDR', '短信话单', 'i18n_zh', '', '', '1', 'supervisor', 1705550000000, '', 0, '');
|
||||
REPLACE INTO `sys_dict_data` VALUES (2148, 2148, 'menu.trace.pcapFile', '信令抓包文件', 'i18n_zh', '', '', '1', 'supervisor', 1705550000000, '', 0, '');
|
||||
REPLACE INTO `sys_dict_data` VALUES (2149, 2149, 'menu.trace.taskAnalyze', '跟踪数据分析', 'i18n_zh', '', '', '1', 'supervisor', 1705550000000, '', 0, '');
|
||||
-- REPLACE INTO `sys_dict_data` VALUES (2150, 2150, 'dictData.udm_sub_cn_type.3', '5G&4G', 'i18n_zh', '', '', '1', 'supervisor', 1705550000000, '', 0, '');
|
||||
REPLACE INTO `sys_dict_data` VALUES (2150, 2150, 'job.ne_data_udm', '网元数据-UDM数据刷新同步', 'i18n_zh', '', '', '1', 'supervisor', 1730173767412, '', 0, '');
|
||||
REPLACE INTO `sys_dict_data` VALUES (2151, 2151, 'menu.system.setting.doc', '系统使用文档', 'i18n_zh', '', '', '1', 'supervisor', 1705550000000, '', 0, '');
|
||||
REPLACE INTO `sys_dict_data` VALUES (2152, 2152, 'menu.system.setting.official', '官网链接', 'i18n_zh', '', '', '1', 'supervisor', 1705550000000, '', 0, '');
|
||||
REPLACE INTO `sys_dict_data` VALUES (2153, 2153, 'menu.system.setting.lock', '锁屏操作', 'i18n_zh', '', '', '1', 'supervisor', 1705550000000, '', 0, '');
|
||||
|
||||
@@ -659,7 +659,7 @@ REPLACE INTO `sys_dict_data` VALUES (4146, 4146, 'menu.dashboard.smscCDR', 'SMS
|
||||
REPLACE INTO `sys_dict_data` VALUES (4147, 4147, 'log.operate.title.smscCDR', 'SMS CDR', 'i18n_en', '', '', '1', 'supervisor', 1705550000000, '', 0, '');
|
||||
REPLACE INTO `sys_dict_data` VALUES (4148, 4148, 'menu.trace.pcapFile', 'Signaling Capture File', 'i18n_en', '', '', '1', 'supervisor', 1718441035866, '', 0, '');
|
||||
REPLACE INTO `sys_dict_data` VALUES (4149, 4149, 'menu.trace.taskAnalyze', 'Tracking Data Analysis', 'i18n_en', '', '', '1', 'supervisor', 1718441035866, '', 0, '');
|
||||
-- REPLACE INTO `sys_dict_data` VALUES (4150, 4150, 'dictData.udm_sub_cn_type.3', '5G&4G', 'i18n_en', '', '', '1', 'supervisor', 1718441035866, '', 0, '');
|
||||
REPLACE INTO `sys_dict_data` VALUES (4150, 4150, 'job.ne_data_udm', 'NE Data Sync UDM', 'i18n_en', '', '', '1', 'supervisor', 1730173767412, '', 0, '');
|
||||
REPLACE INTO `sys_dict_data` VALUES (4151, 4151, 'menu.system.setting.doc', 'System User Documentation', 'i18n_en', '', '', '1', 'supervisor', 1705550000000, '', 0, '');
|
||||
REPLACE INTO `sys_dict_data` VALUES (4152, 4152, 'menu.system.setting.official', 'Official Website', 'i18n_en', '', '', '1', 'supervisor', 1705550000000, '', 0, '');
|
||||
REPLACE INTO `sys_dict_data` VALUES (4153, 4153, 'menu.system.setting.lock', 'Lockscreen Operation', 'i18n_en', '', '', '1', 'supervisor', 1705550000000, '', 0, '');
|
||||
|
||||
@@ -34,6 +34,7 @@ MODIFY COLUMN `target_params` varchar(2048) CHARACTER SET utf8mb4 COLLATE utf8mb
|
||||
|
||||
REPLACE INTO `sys_job` VALUES (1, 'job.monitor_sys_resource', 'SYSTEM', 'monitor_sys_resource', '{\"interval\":5}', '0 0/5 * * * ?', '3', '0', '1', '0', 'supervisor', 1698478134839, 'supervisor', 1700571615807, 'job.monitor_sys_resource_remark');
|
||||
REPLACE INTO `sys_job` VALUES (2, 'job.ne_config_backup', 'SYSTEM', 'ne_config_backup', '', '0 30 0 * * ?', '3', '0', '1', '1', 'supervisor', 1698478134839, 'supervisor', 1700571615807, 'job.ne_config_backup_remark');
|
||||
REPLACE INTO `sys_job` VALUES (3, 'job.ne_data_udm', 'SYSTEM', 'ne_data_udm', '', '0 0 0/2 * * ?', '3', '0', '1', '1', 'supervisor', 1730173767412, '', 0, '');
|
||||
REPLACE INTO `sys_job` VALUES (4, 'job.delExpiredNeBackup', 'SYSTEM', 'delExpiredNeBackup', '{\"duration\":60}', '0 20 0 * * ?', '3', '0', '0', '1', 'supervisor', 1698478134840, NULL, 0, 'job.delExpiredNeBackupRemark');
|
||||
REPLACE INTO `sys_job` VALUES (5, 'job.deleteExpiredAlarmRecord', 'SYSTEM', 'deleteExpiredRecord', '{\"duration\":90,\"tableName\":\"alarm\",\"colName\":\"event_time\",\"extras\":\"alarm_status=\'0\'\"}', '0 10 0 * * ?', '3', '0', '1', '1', 'supervisor', 1698478134841, NULL, 0, 'job.deleteExpiredAlarmRecordRemark');
|
||||
REPLACE INTO `sys_job` VALUES (6, 'job.deleteExpiredKpiRecord', 'SYSTEM', 'deleteExpiredRecord', '{\"duration\":30,\"tableName\":\"gold_kpi\",\"colName\":\"date\"}', '0 15 0 * * ?', '3', '0', '1', '1', 'supervisor', 1698478134842, 'supervisor', 1700570673113, 'job.deleteExpiredKpiRecordRemark');
|
||||
|
||||
@@ -3,6 +3,7 @@ package features
|
||||
import (
|
||||
"be.ems/features/cm"
|
||||
"be.ems/features/lm"
|
||||
"be.ems/features/nbi"
|
||||
"be.ems/features/pm"
|
||||
"be.ems/lib/log"
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -12,10 +13,10 @@ func InitServiceEngine(r *gin.Engine) {
|
||||
log.Info("======init feature group gin.Engine")
|
||||
|
||||
// featuresGroup := r.Group("/")
|
||||
// 注册 各个features 模块的路由
|
||||
// register features routers
|
||||
pm.InitSubServiceRoute(r)
|
||||
lm.InitSubServiceRoute(r)
|
||||
cm.InitSubServiceRoute(r)
|
||||
|
||||
nbi.InitSubServiceRoute(r)
|
||||
// return featuresGroup
|
||||
}
|
||||
|
||||
257
features/nbi/file/controller.go
Normal file
257
features/nbi/file/controller.go
Normal file
@@ -0,0 +1,257 @@
|
||||
package nbi_file
|
||||
|
||||
import (
|
||||
"archive/zip"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"be.ems/lib/dborm"
|
||||
"be.ems/lib/file"
|
||||
"be.ems/lib/global"
|
||||
"be.ems/lib/log"
|
||||
"be.ems/lib/services"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type SysJobResponse struct {
|
||||
SysJob
|
||||
TableName string `json:"tableName"`
|
||||
TableDisplay string `json:"tableDisplay"`
|
||||
FilePath string `json:"filePath"`
|
||||
}
|
||||
|
||||
type TargetParams struct {
|
||||
Duration int `json:"duration"`
|
||||
TableName string `json:"tableName"`
|
||||
Columns string `json:"columns"` // exported column name of time string
|
||||
TimeCol string `json:"timeCol"` // time stamp of column name
|
||||
TimeUnit string `json:"timeUnit"` // timestamp unit: second/micro/milli
|
||||
Extras string `json:"extras"` // extras condition for where
|
||||
FilePath string `json:"filePath"` // file path
|
||||
}
|
||||
|
||||
func (m *FileNBI) GetFileList(c *gin.Context) {
|
||||
var querys FileNBIQuery
|
||||
|
||||
querys.Category = c.Param("category")
|
||||
querys.Type = c.Param("type")
|
||||
if err := c.ShouldBindQuery(&querys); err != nil {
|
||||
c.JSON(http.StatusOK, services.ErrResp(err.Error()))
|
||||
return
|
||||
}
|
||||
|
||||
if querys.Path == "" {
|
||||
tableName := ""
|
||||
ok := false
|
||||
switch querys.Category {
|
||||
case "cdr":
|
||||
tableName, ok = CDRTableMapper[querys.Type]
|
||||
if tableName == "" || !ok {
|
||||
c.JSON(http.StatusOK, services.ErrResp(fmt.Sprintf("invalid CDR file type: %s", querys.Type)))
|
||||
return
|
||||
}
|
||||
case "log":
|
||||
tableName, ok = LogTableMapper[querys.Type]
|
||||
if tableName == "" || !ok {
|
||||
c.JSON(http.StatusOK, services.ErrResp(fmt.Sprintf("invalid log file type: %s", querys.Type)))
|
||||
return
|
||||
}
|
||||
default:
|
||||
c.JSON(http.StatusOK, services.ErrResp(fmt.Sprintf("invalid log file category: %s", querys.Category)))
|
||||
return
|
||||
}
|
||||
|
||||
s := SysJob{}
|
||||
where := fmt.Sprintf("invoke_target='%s' and status=1 and JSON_UNQUOTE(JSON_EXTRACT(target_params,'$.tableName'))='%s'", INVOKE_FILE_EXPORT, tableName)
|
||||
_, err := dborm.XEngDB().Table(s.TableName()).
|
||||
Select("JSON_UNQUOTE(JSON_EXTRACT(target_params, '$.filePath')) as file_path").
|
||||
Where(where).
|
||||
Get(&querys.Path)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusOK, services.ErrResp(err.Error()))
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
files, err := file.GetFileInfo(querys.Path, querys.Suffix)
|
||||
if err != nil {
|
||||
log.Error("failed to GetFileInfo:", err)
|
||||
c.JSON(http.StatusOK, services.ErrResp(err.Error()))
|
||||
return
|
||||
}
|
||||
|
||||
// split files list
|
||||
lenNum := int64(len(files))
|
||||
start := (querys.PageNum - 1) * querys.PageSize
|
||||
end := start + querys.PageSize
|
||||
var splitList []file.FileInfo
|
||||
if start >= lenNum {
|
||||
splitList = []file.FileInfo{}
|
||||
} else if end >= lenNum {
|
||||
splitList = files[start:]
|
||||
} else {
|
||||
splitList = files[start:end]
|
||||
}
|
||||
total := len(files)
|
||||
c.JSON(http.StatusOK, services.TotalDataResp(splitList, total))
|
||||
}
|
||||
|
||||
func (m *FileNBI) Total(c *gin.Context) {
|
||||
dir := c.Query("path")
|
||||
|
||||
fileCount, dirCount, err := file.GetFileAndDirCount(dir)
|
||||
if err != nil {
|
||||
log.Error("failed to GetFileAndDirCount:", err)
|
||||
c.JSON(http.StatusOK, services.ErrResp(err.Error()))
|
||||
return
|
||||
}
|
||||
total := fileCount + dirCount
|
||||
c.JSON(http.StatusOK, services.TotalResp(int64(total)))
|
||||
}
|
||||
|
||||
func (m *FileNBI) GetSingleFileHandler(c *gin.Context) {
|
||||
var querys FileNBIQuery
|
||||
|
||||
querys.Category = c.Param("category")
|
||||
querys.Type = c.Param("type")
|
||||
querys.DateIndex = c.Param("dateIndex")
|
||||
if err := c.ShouldBindQuery(&querys); err != nil {
|
||||
c.JSON(http.StatusOK, services.ErrResp(err.Error()))
|
||||
return
|
||||
}
|
||||
|
||||
tableName := ""
|
||||
if querys.Path == "" {
|
||||
ok := false
|
||||
switch querys.Category {
|
||||
case "cdr":
|
||||
tableName, ok = CDRTableMapper[querys.Type]
|
||||
if tableName == "" || !ok {
|
||||
c.JSON(http.StatusOK, services.ErrResp(fmt.Sprintf("invalid CDR file type: %s", querys.Type)))
|
||||
return
|
||||
}
|
||||
case "log":
|
||||
tableName, ok = LogTableMapper[querys.Type]
|
||||
if tableName == "" || !ok {
|
||||
c.JSON(http.StatusOK, services.ErrResp(fmt.Sprintf("invalid log file type: %s", querys.Type)))
|
||||
return
|
||||
}
|
||||
default:
|
||||
c.JSON(http.StatusOK, services.ErrResp(fmt.Sprintf("invalid log file category: %s", querys.Category)))
|
||||
return
|
||||
}
|
||||
|
||||
s := SysJob{}
|
||||
where := fmt.Sprintf("invoke_target='%s' and status=1 and JSON_UNQUOTE(JSON_EXTRACT(target_params,'$.tableName'))='%s'", INVOKE_FILE_EXPORT, tableName)
|
||||
_, err := dborm.XEngDB().Table(s.TableName()).
|
||||
Select("JSON_UNQUOTE(JSON_EXTRACT(target_params, '$.filePath')) as file_path").
|
||||
Where(where).
|
||||
Get(&querys.Path)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusOK, services.ErrResp(err.Error()))
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
fileName := tableName + "_export_" + querys.DateIndex + "0000" + ".csv"
|
||||
filePath := filepath.Join(querys.Path, fileName)
|
||||
|
||||
file, err := os.Open(filePath)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusOK, services.ErrResp(err.Error()))
|
||||
return
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
if _, err := os.Stat(filePath); os.IsNotExist(err) {
|
||||
c.JSON(http.StatusOK, services.ErrResp(err.Error()))
|
||||
return
|
||||
}
|
||||
|
||||
c.Header("Content-Disposition", "attachment; filename="+fileName)
|
||||
c.Header("Content-Type", "application/octet-stream")
|
||||
c.File(filePath)
|
||||
}
|
||||
|
||||
func (m *FileNBI) GetMultiFileHandler(c *gin.Context) {
|
||||
var querys FileNBIQuery
|
||||
|
||||
querys.Category = c.Param("category")
|
||||
querys.Type = c.Param("type")
|
||||
if err := c.ShouldBindQuery(&querys); err != nil {
|
||||
c.JSON(http.StatusOK, services.ErrResp(err.Error()))
|
||||
return
|
||||
}
|
||||
|
||||
tableName := ""
|
||||
if querys.Path == "" {
|
||||
ok := false
|
||||
switch querys.Category {
|
||||
case "cdr":
|
||||
tableName, ok = CDRTableMapper[querys.Type]
|
||||
if tableName == "" || !ok {
|
||||
c.JSON(http.StatusOK, services.ErrResp(fmt.Sprintf("invalid CDR file type: %s", querys.Type)))
|
||||
return
|
||||
}
|
||||
case "log":
|
||||
tableName, ok = LogTableMapper[querys.Type]
|
||||
if tableName == "" || !ok {
|
||||
c.JSON(http.StatusOK, services.ErrResp(fmt.Sprintf("invalid log file type: %s", querys.Type)))
|
||||
return
|
||||
}
|
||||
default:
|
||||
c.JSON(http.StatusOK, services.ErrResp(fmt.Sprintf("invalid log file category: %s", querys.Category)))
|
||||
return
|
||||
}
|
||||
|
||||
s := SysJob{}
|
||||
where := fmt.Sprintf("invoke_target='%s' and status=1 and JSON_UNQUOTE(JSON_EXTRACT(target_params,'$.tableName'))='%s'", INVOKE_FILE_EXPORT, tableName)
|
||||
_, err := dborm.XEngDB().Table(s.TableName()).
|
||||
Select("JSON_UNQUOTE(JSON_EXTRACT(target_params, '$.filePath')) as file_path").
|
||||
Where(where).
|
||||
Get(&querys.Path)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusOK, services.ErrResp(err.Error()))
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
zipWriter := zip.NewWriter(c.Writer)
|
||||
defer zipWriter.Close()
|
||||
|
||||
for _, fileName := range querys.FileNames {
|
||||
filePath := filepath.Join(querys.Path, fileName)
|
||||
|
||||
file, err := os.Open(filePath)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusOK, services.ErrResp(err.Error()))
|
||||
return
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
if _, err := os.Stat(filePath); os.IsNotExist(err) {
|
||||
c.JSON(http.StatusOK, services.ErrResp(err.Error()))
|
||||
return
|
||||
}
|
||||
writer, err := zipWriter.Create(filepath.Base(fileName))
|
||||
if err != nil {
|
||||
c.JSON(http.StatusOK, services.ErrResp(err.Error()))
|
||||
return
|
||||
}
|
||||
|
||||
if _, err := io.Copy(writer, file); err != nil {
|
||||
c.JSON(http.StatusOK, services.ErrResp(err.Error()))
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
zipFile := tableName + "_export_" + time.Now().Local().Format(global.DateData) + ".zip"
|
||||
c.Header("Content-Disposition", "attachment; filename="+zipFile)
|
||||
c.Header("Content-Type", "application/zip")
|
||||
//c.File(filePath)
|
||||
}
|
||||
47
features/nbi/file/model.go
Normal file
47
features/nbi/file/model.go
Normal file
@@ -0,0 +1,47 @@
|
||||
package nbi_file
|
||||
|
||||
import (
|
||||
"be.ems/lib/file"
|
||||
)
|
||||
|
||||
const (
|
||||
INVOKE_FILE_EXPORT = "exportTable"
|
||||
)
|
||||
|
||||
var CDRTableMapper map[string]string = map[string]string{
|
||||
"ims": "cdr_event_ims",
|
||||
"smf": "cdr_event_smf",
|
||||
"smsc": "cdr_event_smsc",
|
||||
"sms": "cdr_event_smsc",
|
||||
}
|
||||
|
||||
var LogTableMapper map[string]string = map[string]string{
|
||||
"operate": "sys_log_operate",
|
||||
"security": "sys_log_login",
|
||||
"alarm": "alarm_log",
|
||||
}
|
||||
|
||||
type SysJob struct {
|
||||
JobID int64 `gorm:"column:job_id;primary_key;auto_increment" json:"job_id"` //任务ID
|
||||
InvokeTarget string `gorm:"column:invoke_target" json:"invoke_target"` //调用目标字符串
|
||||
TargetParams string `gorm:"column:target_params;type:json" json:"target_params,omitempty"` //调用目标传入参数
|
||||
}
|
||||
|
||||
func (s *SysJob) TableName() string {
|
||||
return "sys_job"
|
||||
}
|
||||
|
||||
type FileNBI struct {
|
||||
file.FileInfo
|
||||
}
|
||||
|
||||
type FileNBIQuery struct {
|
||||
Category string `form:"category" binding:"required"`
|
||||
Type string `form:"type" binding:"required"`
|
||||
DateIndex string `form:"dateIndex"`
|
||||
Path string `json:"path" form:"path"`
|
||||
FileNames []string `json:"fileName" form:"fileName"`
|
||||
Suffix string `form:"suffix"`
|
||||
PageNum int64 `form:"pageNum"`
|
||||
PageSize int64 `form:"pageSize"`
|
||||
}
|
||||
26
features/nbi/file/route.go
Normal file
26
features/nbi/file/route.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package nbi_file
|
||||
|
||||
import (
|
||||
"be.ems/src/framework/middleware"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// Register Routes for file_export
|
||||
func Register(r *gin.RouterGroup) {
|
||||
fileNBI := r.Group("/file")
|
||||
{
|
||||
var f *FileNBI
|
||||
fileNBI.GET("/:category/:type/list",
|
||||
middleware.PreAuthorize(nil),
|
||||
f.GetFileList,
|
||||
)
|
||||
fileNBI.GET("/:category/:type/:dateIndex",
|
||||
middleware.PreAuthorize(nil),
|
||||
f.GetSingleFileHandler,
|
||||
)
|
||||
fileNBI.GET("/:category/:type",
|
||||
middleware.PreAuthorize(nil),
|
||||
f.GetMultiFileHandler,
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,6 @@ import (
|
||||
"be.ems/lib/log"
|
||||
"be.ems/lib/oauth"
|
||||
"be.ems/lib/services"
|
||||
"be.ems/lib/session"
|
||||
"be.ems/restagent/config"
|
||||
)
|
||||
|
||||
@@ -35,7 +34,7 @@ type ApiResponse struct {
|
||||
ResultMessage interface{}
|
||||
}
|
||||
|
||||
var globalSession = session.NewSessManager("restagent")
|
||||
//var globalSession = session.NewSessManager("restagent")
|
||||
|
||||
var (
|
||||
MAX_RMUID_NUM int
|
||||
|
||||
16
features/nbi/service.go
Normal file
16
features/nbi/service.go
Normal file
@@ -0,0 +1,16 @@
|
||||
// log management package
|
||||
|
||||
package nbi
|
||||
|
||||
import (
|
||||
nbi_file "be.ems/features/nbi/file"
|
||||
"be.ems/lib/log"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func InitSubServiceRoute(r *gin.Engine) {
|
||||
log.Info("======init North-Bound Interface group gin.Engine")
|
||||
|
||||
nbiGroup := r.Group("/nbi")
|
||||
nbi_file.Register(nbiGroup)
|
||||
}
|
||||
@@ -54,28 +54,28 @@ func GetNRMByUri(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
// error processing ...
|
||||
// 401-1 response
|
||||
token, ret := globalSession.IsCarriedToken(r)
|
||||
if ret == false {
|
||||
log.Error("AccessToken is not carried")
|
||||
services.ResponseUnauthorized401AccessTokenNotCarried(w)
|
||||
return
|
||||
}
|
||||
// token, ret := globalSession.IsCarriedToken(r)
|
||||
// if ret == false {
|
||||
// log.Error("AccessToken is not carried")
|
||||
// services.ResponseUnauthorized401AccessTokenNotCarried(w)
|
||||
// return
|
||||
// }
|
||||
|
||||
// 401-2 response
|
||||
if globalSession.IsValidToken(token) == false {
|
||||
log.Error("AccessToken fails or does not exist")
|
||||
services.ResponseUnauthorized401AccessTokenNotExist(w)
|
||||
return
|
||||
}
|
||||
// if globalSession.IsValidToken(token) == false {
|
||||
// log.Error("AccessToken fails or does not exist")
|
||||
// services.ResponseUnauthorized401AccessTokenNotExist(w)
|
||||
// return
|
||||
// }
|
||||
// response 403 Forbidden, permissions deny
|
||||
// todo...
|
||||
plist := globalSession.GetPermissionFromSession(token)
|
||||
log.Debug("permission list:", plist)
|
||||
if len(plist) == 0 || plist[0] == false {
|
||||
log.Error("User permission deny")
|
||||
services.ResponseForbidden403NotPermission(w)
|
||||
return
|
||||
}
|
||||
// plist := globalSession.GetPermissionFromSession(token)
|
||||
// log.Debug("permission list:", plist)
|
||||
// if len(plist) == 0 || plist[0] == false {
|
||||
// log.Error("User permission deny")
|
||||
// services.ResponseForbidden403NotPermission(w)
|
||||
// return
|
||||
// }
|
||||
|
||||
vars := mux.Vars(r)
|
||||
qeuryUri := vars["apiCategory"] + "/" + vars["elementTypeValue"] + "/" + vars["objectTypeValue"]
|
||||
|
||||
@@ -9,14 +9,15 @@ import (
|
||||
)
|
||||
|
||||
type FileInfo struct {
|
||||
FileType string `json:"fileType"` // 文件类型
|
||||
FileMode string `json:"fileMode"` // 文件的权限
|
||||
LinkCount int64 `json:"linkCount"` // 硬链接数目
|
||||
Owner string `json:"owner"` // 所属用户
|
||||
Group string `json:"group"` // 所属组
|
||||
Size int64 `json:"size"` // 文件的大小
|
||||
ModifiedTime int64 `json:"modifiedTime"` // 最后修改时间,单位为秒
|
||||
FileName string `json:"fileName"` // 文件的名称
|
||||
FileType string `json:"fileType"` // file type: file/directory
|
||||
FileMode string `json:"fileMode"` // file mode
|
||||
LinkCount int64 `json:"linkCount"` // link count
|
||||
Owner string `json:"owner"` // owner
|
||||
Group string `json:"group"` // group
|
||||
Size int64 `json:"size"` // size: xx byte
|
||||
ModifiedTime int64 `json:"modifiedTime"` // last modified time:seconds
|
||||
FilePath string `json:"filePath"` // file path
|
||||
FileName string `json:"fileName"` // file name
|
||||
}
|
||||
|
||||
func GetFileInfo(dir, suffix string) ([]FileInfo, error) {
|
||||
@@ -48,6 +49,7 @@ func GetFileInfo(dir, suffix string) ([]FileInfo, error) {
|
||||
Group: "-",
|
||||
Size: info.Size(),
|
||||
ModifiedTime: info.ModTime().Unix(),
|
||||
FilePath: dir,
|
||||
FileName: info.Name(),
|
||||
}
|
||||
files = append(files, fileInfo)
|
||||
|
||||
30
makefile
30
makefile
@@ -3,23 +3,26 @@
|
||||
ProjectL = omc
|
||||
ProjectU = OMC
|
||||
PROJECT = $(ProjectL)
|
||||
VERSION = 2.2410.2
|
||||
VERSION = 2.2410.4
|
||||
RelDate = `date +%Y%m%d`
|
||||
Release = $(RelDate)
|
||||
RelVer = $(VERSION)-$(RelDate)
|
||||
PLATFORM = amd64
|
||||
ARMPLATFORM = aarch64
|
||||
GitLocalRoot = $(HOME)/local.git
|
||||
GitLocalRoot = $(HOME)/omc.git
|
||||
EmsBuildRoot=$(GitLocalRoot)/build.ems
|
||||
BuildDir = $(EmsBuildRoot)/build
|
||||
CustomizedDir = $(EmsBuildRoot)/customized
|
||||
BuildOMCDir = $(BuildDir)/usr/local/omc
|
||||
BuildOMCBinDir = $(BuildOMCDir)/bin
|
||||
BuildOMCEtcDir = $(BuildOMCDir)/etc
|
||||
BuildLibDir = $(BuildDir)/lib
|
||||
BuildLibSystemDir = $(BuildLibDir)/systemd/system
|
||||
DebBuildDir = $(EmsBuildRoot)/debbuild
|
||||
DebBuildOMCDir = $(EmsBuildRoot)/debbuild/usr/local/omc
|
||||
DebFEBuildDir = $(EmsBuildRoot)/debbuild/usr/local/omc/htdocs
|
||||
DebBuild2204Dir = $(EmsBuildRoot)/debbuild/22.04
|
||||
DebBuild2204OMCDir = $(EmsBuildRoot)/debbuild/22.04/usr/local/omc
|
||||
DebFEBuild2204Dir = $(EmsBuildRoot)/debbuild/22.04/usr/local/omc/htdocs
|
||||
RpmBuildDir = $(EmsBuildRoot)/rpmbuild
|
||||
RpmFEBuildDir = $(RpmBuildDir)/BUILD/usr/local/omc/htdocs
|
||||
@@ -54,11 +57,14 @@ RestagentSize = 29525312
|
||||
BinWriterDir = $(HOME)/bin
|
||||
ifeq ($(shell grep VERSION_ID /etc/os-release), VERSION_ID="22.04")
|
||||
DebBuildDir := $(DebBuild2204Dir)
|
||||
DebBuildOMCDir := $(DebBuild2204OMCDir)
|
||||
DebFEBuildDir := $(DebFEBuild2204Dir)
|
||||
#DebPkgFile := $(PROJECT)-$(VERSION)-22.04-$(Release).$(PLATFORM).deb
|
||||
DebPkgFile := $(PROJECT)-r$(VERSION)-$(Release)-ub22.deb
|
||||
DebPkgFileBA := $(PROJECT)-r$(VERSION)-$(Release)-ub22-ba.deb
|
||||
else ifeq ($(shell grep VERSION_ID /etc/os-release), VERSION_ID="18.04")
|
||||
DebPkgFile := $(PROJECT)-r$(VERSION)-$(Release)-ub18.deb
|
||||
DebPkgFileBA := $(PROJECT)-r$(VERSION)-$(Release)-ub18-ba.deb
|
||||
endif
|
||||
|
||||
.PHONY: all $(RESTAGENT) $(CRONTASK) $(SshSvcBin) $(CapTraceBin) $(Data2htmlBin)
|
||||
@@ -101,7 +107,7 @@ dist:
|
||||
--exclude=../crontask/crontask \
|
||||
--exclude=../initems/initems
|
||||
|
||||
deb: $(BINNAME)
|
||||
pre_build: $(BINNAME)
|
||||
# clear build cache
|
||||
rm -rf $(FrontBuildDir)/front/*
|
||||
rm -rf $(DebFEBuildDir)/front/*
|
||||
@@ -123,6 +129,14 @@ deb: $(BINNAME)
|
||||
chmod 755 $(DebBuildDir)/DEBIAN/postinst
|
||||
chmod 755 $(DebBuildDir)/DEBIAN/postrm
|
||||
cp -rf $(BuildDir)/* $(DebBuildDir)/
|
||||
|
||||
replace_chinese:
|
||||
@find $(DebBuildOMCDir)/etc/db -type f -name '*.sql' -exec sed -i '' 's/[一-龥]//g' {} +
|
||||
@echo "Replace all chinese charecter."
|
||||
|
||||
deb: pre_build
|
||||
cp -rf $(CustomizedDir)/agt.d $(DebBuildOMCDir)/static
|
||||
cp -rf $(CustomizedDir)/omc.d $(DebBuildOMCDir)/static
|
||||
#cp -rf $(BuildDir)/nginx/* $(DebBuildDir)/etc/nginx/conf.d
|
||||
#cp -rf $(BuildDir)/systemd/*.service $(DebBuildDir)/lib/systemd/system/
|
||||
chmod +x $(DebBuildDir)/usr/local/omc/bin/*
|
||||
@@ -131,6 +145,16 @@ deb: $(BINNAME)
|
||||
perl -0777 -i -pe 's/ne:\n user: root/ne:\n user: omcuser/g' $(DebBuildDir)/usr/local/omc/etc/default/restconf.yaml
|
||||
dpkg -b $(DebBuildDir) $(ReleaseDebs)/$(DebPkgFile)
|
||||
|
||||
badeb: pre_build replace_chinese
|
||||
cp -rf $(CustomizedDir)/ba.d $(DebBuildOMCDir)/static
|
||||
#cp -rf $(BuildDir)/nginx/* $(DebBuildDir)/etc/nginx/conf.d
|
||||
#cp -rf $(BuildDir)/systemd/*.service $(DebBuildDir)/lib/systemd/system/
|
||||
chmod +x $(DebBuildDir)/usr/local/omc/bin/*
|
||||
#sed -i.bak 's/YYYYMMDD/$(shell date +"%Y%m%d")/g' $(DebBuildDir)/DEBIAN/control
|
||||
sed -i 's/YYYYMMDD/$(shell date +"%Y%m%d")/g' $(DebBuildDir)/DEBIAN/control
|
||||
perl -0777 -i -pe 's/ne:\n user: root/ne:\n user: omcuser/g' $(DebBuildDir)/usr/local/omc/etc/default/restconf.yaml
|
||||
dpkg -b $(DebBuildDir) $(ReleaseDebs)/$(DebPkgFileBA)
|
||||
|
||||
rpm: $(BINNAME)
|
||||
# clear build cache
|
||||
rm -rf $(FrontBuildDir)/front/*
|
||||
|
||||
@@ -20,6 +20,9 @@ check_args() {
|
||||
elif [ "${C_ARG_LOWER}" == "omc" ]; then
|
||||
C_ARG_UPPER="OMC"
|
||||
sed -i 's/VENDORS=.*/VENDORS=OMC/' /usr/local/omc/etc/omc.conf
|
||||
elif [ "${C_ARG_LOWER}" == "agt" ]; then
|
||||
C_ARG_UPPER="AGT"
|
||||
sed -i 's/VENDORS=.*/VENDORS=AGT/' /usr/local/omc/etc/omc.conf
|
||||
fi
|
||||
;;
|
||||
m)
|
||||
@@ -65,6 +68,10 @@ case "${M_ARG}" in
|
||||
done
|
||||
cp -rf ${CustomizedDir}/logo/* ${OMCStaticDir}/logo
|
||||
cp -rf ${CustomizedDir}/doc/* ${OMCStaticDir}/helpDoc
|
||||
if [ "${C_ARG_LOWER}" == "ba" ]; then
|
||||
rm -rf ${OMCStaticDir}/logo/zh_*
|
||||
rm -rf ${OMCStaticDir}/helpDoc/zh_*
|
||||
fi
|
||||
#perl -0777 -i -pe 's/omcuser/bluearcus/g' ${OMCRootDir}/etc/default/restconf.yaml
|
||||
#perl -0777 -i -pe 's/omcuser/bluearcus/g' ${OMCBinDir}/nehosts
|
||||
if [ $? = 0 ]; then
|
||||
@@ -88,6 +95,10 @@ case "${M_ARG}" in
|
||||
done
|
||||
cp -rf ${CustomizedDir}/logo/* ${OMCStaticDir}/logo
|
||||
cp -rf ${CustomizedDir}/doc/* ${OMCStaticDir}/helpDoc
|
||||
if [ "${C_ARG_LOWER}" == "ba" ]; then
|
||||
rm -rf ${OMCStaticDir}/logo/zh_*
|
||||
rm -rf ${OMCStaticDir}/helpDoc/zh_*
|
||||
fi
|
||||
if [ $? = 0 ]; then
|
||||
echo "done"
|
||||
fi
|
||||
|
||||
62
misc/upgconf.sh
Normal file
62
misc/upgconf.sh
Normal file
@@ -0,0 +1,62 @@
|
||||
#!/bin/bash
|
||||
|
||||
config_file="/usr/local/omc/etc/restconf.yaml"
|
||||
temp_file="/tmp/temp.yaml"
|
||||
|
||||
declare -A insert_lines=(
|
||||
[156]=" dataCoding: 0"
|
||||
[157]=" serviceNumber: \"OMC\""
|
||||
)
|
||||
|
||||
declare -A update_lines=(
|
||||
["deadLine: 10"]="deadLine: 600"
|
||||
)
|
||||
|
||||
# check if exist file
|
||||
if [[ ! -f $config_file ]]; then
|
||||
echo "NOT FOUND config file: $config_file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
insert_if_missing() {
|
||||
local line_number="$1"
|
||||
local line_content="$2"
|
||||
local current_content=$(sed -n "${line_number}p" "$config_file")
|
||||
|
||||
if [[ "$current_content" != "$line_content" ]]; then
|
||||
# insert line to config file
|
||||
echo -n "Inserting '$line_content' into line ${line_number} ... "
|
||||
awk -v n="$line_number" -v line="$line_content" 'NR==n {print line} {print}' "$config_file" >"$temp_file" && mv "$temp_file" "$config_file"
|
||||
if [ $? = 0 ]; then
|
||||
echo "done"
|
||||
fi
|
||||
else
|
||||
echo "Exist '$line_content' at line ${line_number}"
|
||||
fi
|
||||
}
|
||||
|
||||
# function:update line content
|
||||
update_lines_content() {
|
||||
local old_line="$1"
|
||||
local new_line="$2"
|
||||
echo -n "Updating '$old_line' to line '$new_line' ..."
|
||||
sed -i "s/$old_line/$new_line/" "$config_file"
|
||||
if [ $? = 0 ]; then
|
||||
echo "done"
|
||||
fi
|
||||
}
|
||||
|
||||
#line_numbers=(156 157)
|
||||
line_numbers=$(for key in "${!insert_lines[@]}"; do echo "$key"; done | sort -n)
|
||||
|
||||
# insert process
|
||||
#for line_number in "${line_numbers[@]}"; do
|
||||
#for line_number in "${!insert_lines[@]}"; do
|
||||
for line_number in $line_numbers; do
|
||||
insert_if_missing "$line_number" "${insert_lines[$line_number]}"
|
||||
done
|
||||
|
||||
# update process
|
||||
for old_line in "${!update_lines[@]}"; do
|
||||
update_lines_content "$old_line" "${update_lines[$old_line]}"
|
||||
done
|
||||
14
mkpkg.sh
14
mkpkg.sh
@@ -2,7 +2,7 @@
|
||||
|
||||
ProcList="restagent crontask sshsvc captrace data2html"
|
||||
ProjectL=omc
|
||||
VERSION=2.2410.2
|
||||
VERSION=2.2410.4
|
||||
RelDate=`date +%Y%m%d`
|
||||
Release=${RelDate}
|
||||
RelVer=${VERSION}-${RelDate}
|
||||
@@ -10,7 +10,7 @@ Ky10Arch=ky10.aarch64
|
||||
RpmPkgName=${ProjectL}-${RelVer}.ky10.aarch64.rpm
|
||||
RpmPkgRename=${ProjectL}-r${RelVer}-ky10.rpm
|
||||
DebPkgName=${ProjectL}-r${RelVer}-ub*.deb
|
||||
GitLocalRoot=${HOME}/local.git
|
||||
GitLocalRoot=${HOME}/omc.git
|
||||
EmsBEDir=${GitLocalRoot}/be.ems
|
||||
EmsBuildRoot=${GitLocalRoot}/build.ems
|
||||
RpmArch=`arch`
|
||||
@@ -53,11 +53,17 @@ case "$1" in
|
||||
make deb
|
||||
cd $ReleaseDir/"$1"s/$RelArch
|
||||
rm -f omc-md5sum.txt
|
||||
# rpm --addsign *.rpm
|
||||
md5sum $DebPkgName >omc-md5sum.txt
|
||||
;;
|
||||
badeb)
|
||||
cd $EmsBEDir
|
||||
make badeb
|
||||
cd $ReleaseDir/"$1"s/$RelArch
|
||||
rm -f omc-md5sum.txt
|
||||
md5sum $DebPkgName >omc-md5sum.txt
|
||||
;;
|
||||
*)
|
||||
echo "make omc package"
|
||||
echo "Usage: $0 rpm|deb <db>"
|
||||
echo "Usage: $0 rpm|deb|badeb <db>"
|
||||
;;
|
||||
esac
|
||||
@@ -3,7 +3,7 @@
|
||||
# duration: rotation time with xx hours, example: 1/12/24 hours
|
||||
# count: rotation count of log, default is 30 rotation
|
||||
logger:
|
||||
file: d:/local.git/be.ems/restagent/log/restagent.log
|
||||
file: d:/omc.git/be.ems/restagent/log/restagent.log
|
||||
level: trace
|
||||
duration: 24
|
||||
count: 2
|
||||
@@ -27,7 +27,7 @@ rest:
|
||||
|
||||
webServer:
|
||||
enabled: false
|
||||
rootDir: d:/local.git/fe.ems.vue3/dist
|
||||
rootDir: d:/omc.git/fe.ems.vue3/dist
|
||||
listen:
|
||||
- addr: :80
|
||||
schema: http
|
||||
@@ -46,7 +46,7 @@ database:
|
||||
port: 33066
|
||||
name: omc_db
|
||||
connParam: charset=utf8mb4&collation=utf8mb4_general_ci&parseTime=True&interpolateParams=True
|
||||
backup: d:/local.git/be.ems/restagent/database
|
||||
backup: d:/omc.git/be.ems/restagent/database
|
||||
|
||||
# Redis 缓存数据,数据源声明全小写
|
||||
redis:
|
||||
@@ -113,8 +113,8 @@ omc:
|
||||
binDir: ./bin
|
||||
backup: ./backup
|
||||
upload: ./upload
|
||||
frontUpload: d:/local.git/fe.ems/upload
|
||||
frontTraceDir: d:/local.git/fe.ems/trace
|
||||
frontUpload: d:/omc.git/fe.ems/upload
|
||||
frontTraceDir: d:/omc.git/fe.ems/trace
|
||||
software: ./software
|
||||
license: ./license
|
||||
gtpUri: gtp:192.168.2.219:2152
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
# count: rotation count of log, default is 30 rotation
|
||||
# pprof: false(default)/true to disable/enable pprof
|
||||
logger:
|
||||
file: d:/local.git/be.ems/restagent/log/restagent.log
|
||||
file: d:/omc.git/be.ems/restagent/log/restagent.log
|
||||
level: trace
|
||||
duration: 24
|
||||
count: 2
|
||||
@@ -24,7 +24,7 @@ rest:
|
||||
|
||||
webServer:
|
||||
enabled: true
|
||||
rootDir: d:/local.git/fe.ems.vue3/dist
|
||||
rootDir: d:/omc.git/fe.ems.vue3/dist
|
||||
listen:
|
||||
- addr: :80
|
||||
schema: http
|
||||
@@ -43,7 +43,7 @@ database:
|
||||
port: 33066
|
||||
name: "omc_db"
|
||||
connParam: charset=utf8mb4&collation=utf8mb4_general_ci&parseTime=True&interpolateParams=True
|
||||
backup: d:/local.git/be.ems/restagent/database
|
||||
backup: d:/omc.git/be.ems/restagent/database
|
||||
|
||||
# Redis data cache
|
||||
redis:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Makefile for rest agent project
|
||||
|
||||
PROJECT = OMC
|
||||
VERSION = 2.2410.2
|
||||
VERSION = 2.2410.4
|
||||
PLATFORM = amd64
|
||||
ARMPLATFORM = aarch64
|
||||
BUILDDIR = ../../build
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# 项目信息
|
||||
framework:
|
||||
name: "OMC"
|
||||
version: "2.2410.2"
|
||||
version: "2.2410.4"
|
||||
|
||||
# 应用服务配置
|
||||
server:
|
||||
|
||||
45
src/modules/crontask/processor/ne_data_udm/ne_data_udm.go
Normal file
45
src/modules/crontask/processor/ne_data_udm/ne_data_udm.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package ne_data_udm
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"be.ems/src/framework/cron"
|
||||
"be.ems/src/framework/logger"
|
||||
neDataService "be.ems/src/modules/network_data/service"
|
||||
neModel "be.ems/src/modules/network_element/model"
|
||||
neService "be.ems/src/modules/network_element/service"
|
||||
)
|
||||
|
||||
var NewProcessor = &NeDataUDM{
|
||||
udmAuthService: neDataService.NewUDMAuthUser,
|
||||
udmSubService: neDataService.NewUDMSubUser,
|
||||
neInfoService: neService.NewNeInfo,
|
||||
count: 0,
|
||||
}
|
||||
|
||||
// NeDataUDM 网元配置文件定期备份
|
||||
type NeDataUDM struct {
|
||||
udmAuthService *neDataService.UDMAuthUser // UDM鉴权信息
|
||||
udmSubService *neDataService.UDMSubUser // UDM签约信息
|
||||
neInfoService *neService.NeInfo // 网元信息服务
|
||||
count int // 执行次数
|
||||
}
|
||||
|
||||
func (s *NeDataUDM) Execute(data any) (any, error) {
|
||||
s.count++ // 执行次数加一
|
||||
options := data.(cron.JobData)
|
||||
sysJob := options.SysJob
|
||||
logger.Infof("重复 %v 任务ID %s", options.Repeat, sysJob.JobID)
|
||||
// 返回结果,用于记录执行结果
|
||||
result := map[string]any{
|
||||
"count": s.count,
|
||||
}
|
||||
|
||||
neList := s.neInfoService.SelectList(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)
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
"be.ems/src/modules/crontask/processor/getStateFromNE"
|
||||
processorMonitorSysResource "be.ems/src/modules/crontask/processor/monitor_sys_resource"
|
||||
processorNeConfigBackup "be.ems/src/modules/crontask/processor/ne_config_backup"
|
||||
processorNeDataUDM "be.ems/src/modules/crontask/processor/ne_data_udm"
|
||||
"be.ems/src/modules/crontask/processor/removeFile"
|
||||
)
|
||||
|
||||
@@ -19,6 +20,8 @@ func InitCronQueue() {
|
||||
cron.CreateQueue("monitor_sys_resource", processorMonitorSysResource.NewProcessor)
|
||||
// 网元-网元配置文件定期备份
|
||||
cron.CreateQueue("ne_config_backup", processorNeConfigBackup.NewProcessor)
|
||||
// 网元数据-UDM数据刷新同步
|
||||
cron.CreateQueue("ne_data_udm", processorNeDataUDM.NewProcessor)
|
||||
// delete expired NE backup file
|
||||
cron.CreateQueue("delExpiredNeBackup", delExpiredNeBackup.NewProcessor)
|
||||
cron.CreateQueue("deleteExpiredRecord", deleteExpiredRecord.NewProcessor)
|
||||
|
||||
@@ -123,17 +123,30 @@ func (s *SMFController) CDRExport(c *gin.Context) {
|
||||
headerCells := map[string]string{
|
||||
"A1": "ID",
|
||||
"B1": "Charging ID",
|
||||
"C1": "Subscriber ID Data",
|
||||
"D1": "Subscriber ID Type",
|
||||
"E1": "Data Volume Uplink",
|
||||
"F1": "Data Volume Downlink",
|
||||
"G1": "Data Total Volume",
|
||||
"H1": "Duration",
|
||||
"I1": "Invocation Time",
|
||||
"J1": "PDU Session Charging Information",
|
||||
"C1": "NE Name",
|
||||
"D1": "Resource Unique ID",
|
||||
"E1": "Subscriber ID Data",
|
||||
"F1": "Subscriber ID Type",
|
||||
"G1": "Data Volume Uplink",
|
||||
"H1": "Data Volume Downlink",
|
||||
"I1": "Data Total Volume",
|
||||
"J1": "Duration",
|
||||
"K1": "Invocation Time",
|
||||
"L1": "User Identifier",
|
||||
"M1": "SSC Mode",
|
||||
"N1": "DNN ID",
|
||||
"O1": "PDU Type",
|
||||
"P1": "RAT Type",
|
||||
"Q1": "PDU IPv4 Address",
|
||||
"R1": "Network Function IPv4",
|
||||
"S1": "PDU IPv6 Address Swith Prefix",
|
||||
"T1": "Record Network Function ID",
|
||||
"U1": "Record Type",
|
||||
"V1": "Record Opening Time",
|
||||
}
|
||||
// 从第二行开始的数据
|
||||
dataCells := make([]map[string]any, 0)
|
||||
|
||||
for i, row := range rows {
|
||||
idx := strconv.Itoa(i + 2)
|
||||
// 解析 JSON 字符串为 map
|
||||
@@ -158,12 +171,22 @@ func (s *SMFController) CDRExport(c *gin.Context) {
|
||||
subscriptionIDData = sub["subscriptionIDData"].(string)
|
||||
}
|
||||
}
|
||||
|
||||
// 网络功能 IPv4 地址
|
||||
networkFunctionIPv4Address := ""
|
||||
if v, ok := cdrJSON["nFunctionConsumerInformation"]; ok && v != nil {
|
||||
if conInfo, conInfoOk := v.(map[string]any); conInfoOk && conInfo != nil {
|
||||
networkFunctionIPv4Address = conInfo["networkFunctionIPv4Address"].(string)
|
||||
}
|
||||
}
|
||||
|
||||
// 数据量上行链路
|
||||
dataVolumeUplink := []string{}
|
||||
// 数据量下行链路
|
||||
dataVolumeDownlink := []string{}
|
||||
// 数据总量
|
||||
dataTotalVolume := []string{}
|
||||
|
||||
if v, ok := cdrJSON["listOfMultipleUnitUsage"]; ok && v != nil {
|
||||
usageList := v.([]any)
|
||||
if len(usageList) > 0 {
|
||||
@@ -198,32 +221,31 @@ func (s *SMFController) CDRExport(c *gin.Context) {
|
||||
invocationTimestamp = v.(string)
|
||||
}
|
||||
// 记录打开时间
|
||||
pduSessionChargingInformation := ""
|
||||
User_Identifier := ""
|
||||
SSC_Mode := ""
|
||||
RAT_Type := ""
|
||||
DNN_ID := ""
|
||||
PDU_Type := ""
|
||||
PDU_IPv4 := ""
|
||||
PDU_IPv6 := ""
|
||||
if v, ok := cdrJSON["pDUSessionChargingInformation"]; ok && v != nil {
|
||||
pduInfo := v.(map[string]any)
|
||||
|
||||
User_Identifier := ""
|
||||
if v, ok := pduInfo["userIdentifier"]; ok && v != nil {
|
||||
User_Identifier = v.(string)
|
||||
}
|
||||
SSC_Mode := ""
|
||||
if v, ok := pduInfo["sSCMode"]; ok && v != nil {
|
||||
SSC_Mode = v.(string)
|
||||
}
|
||||
RAT_Type := ""
|
||||
if v, ok := pduInfo["rATType"]; ok && v != nil {
|
||||
RAT_Type = v.(string)
|
||||
}
|
||||
DNN_ID := ""
|
||||
if v, ok := pduInfo["dNNID"]; ok && v != nil {
|
||||
DNN_ID = v.(string)
|
||||
}
|
||||
PDU_Type := ""
|
||||
if v, ok := pduInfo["pDUType"]; ok && v != nil {
|
||||
PDU_Type = v.(string)
|
||||
}
|
||||
PDU_IPv4 := ""
|
||||
PDU_IPv6 := ""
|
||||
if v, ok := pduInfo["pDUAddress"]; ok && v != nil {
|
||||
pDUAddress := v.(map[string]any)
|
||||
if addr, ok := pDUAddress["pDUIPv4Address"]; ok && addr != nil {
|
||||
@@ -234,24 +256,54 @@ func (s *SMFController) CDRExport(c *gin.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
pduSessionChargingInformation = fmt.Sprintf(`User Identifier: %s
|
||||
SSC Mode: %s RAT Type: %s DNN ID: %s
|
||||
PDU Type: %s
|
||||
PDU IPv4 Address: %s
|
||||
PDU IPv6 Addres Swith Prefix: %s`, User_Identifier, SSC_Mode, RAT_Type, DNN_ID, PDU_Type, PDU_IPv4, PDU_IPv6)
|
||||
// pduSessionChargingInformation = fmt.Sprintf(`User Identifier: %s
|
||||
// SSC Mode: %s RAT Type: %s DNN ID: %s
|
||||
// PDU Type: %s
|
||||
// PDU IPv4 Address: %s
|
||||
// PDU IPv6 Addres Swith Prefix: %s`, User_Identifier, SSC_Mode, RAT_Type, DNN_ID, PDU_Type, PDU_IPv4, PDU_IPv6)
|
||||
}
|
||||
|
||||
// 记录网络参数ID
|
||||
recordNFID := ""
|
||||
if v, ok := cdrJSON["recordingNetworkFunctionID"]; ok && v != nil {
|
||||
recordNFID = v.(string)
|
||||
}
|
||||
|
||||
//记录开始时间
|
||||
recordOpeningTime := ""
|
||||
if v, ok := cdrJSON["recordOpeningTime"]; ok && v != nil {
|
||||
recordOpeningTime = v.(string)
|
||||
}
|
||||
|
||||
//记录类型
|
||||
recordType := ""
|
||||
if v, ok := cdrJSON["recordType"]; ok && v != nil {
|
||||
recordType = v.(string)
|
||||
}
|
||||
|
||||
dataCells = append(dataCells, map[string]any{
|
||||
"A" + idx: row.ID,
|
||||
"B" + idx: chargingID,
|
||||
"C" + idx: subscriptionIDData,
|
||||
"D" + idx: subscriptionIDType,
|
||||
"E" + idx: strings.Join(dataVolumeUplink, ","),
|
||||
"F" + idx: strings.Join(dataVolumeDownlink, ","),
|
||||
"G" + idx: strings.Join(dataTotalVolume, ","),
|
||||
"H" + idx: duration,
|
||||
"I" + idx: invocationTimestamp,
|
||||
"J" + idx: pduSessionChargingInformation,
|
||||
"C" + idx: row.NeName,
|
||||
"D" + idx: row.RmUID,
|
||||
"E" + idx: subscriptionIDData,
|
||||
"F" + idx: subscriptionIDType,
|
||||
"G" + idx: strings.Join(dataVolumeUplink, ","),
|
||||
"H" + idx: strings.Join(dataVolumeDownlink, ","),
|
||||
"I" + idx: strings.Join(dataTotalVolume, ","),
|
||||
"J" + idx: duration,
|
||||
"K" + idx: invocationTimestamp,
|
||||
"L" + idx: User_Identifier,
|
||||
"M" + idx: SSC_Mode,
|
||||
"N" + idx: DNN_ID,
|
||||
"O" + idx: PDU_Type,
|
||||
"P" + idx: RAT_Type,
|
||||
"Q" + idx: PDU_IPv4,
|
||||
"R" + idx: networkFunctionIPv4Address,
|
||||
"S" + idx: PDU_IPv6,
|
||||
"T" + idx: recordNFID,
|
||||
"U" + idx: recordType,
|
||||
"V" + idx: recordOpeningTime,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -381,7 +381,7 @@ func (s *UDMAuthController) Export(c *gin.Context) {
|
||||
|
||||
// 文件名
|
||||
fileName := fmt.Sprintf("udm_auth_user_export_%s_%d.%s", neId, time.Now().UnixMilli(), fileType)
|
||||
filePath := fmt.Sprintf("%s/%s", file.ParseUploadFileDir(uploadsubpath.EXPORT), fileName)
|
||||
filePath := filepath.Join(file.ParseUploadFileDir(uploadsubpath.EXPORT), fileName)
|
||||
|
||||
if fileType == "csv" {
|
||||
// 转换数据
|
||||
|
||||
@@ -22,7 +22,7 @@ import (
|
||||
|
||||
// 实例化控制层 UDMSubController 结构体
|
||||
var NewUDMSub = &UDMSubController{
|
||||
udmSubService: neDataService.NewUDMSub,
|
||||
udmSubService: neDataService.NewUDMSubUser,
|
||||
neInfoService: neService.NewNeInfo,
|
||||
}
|
||||
|
||||
@@ -386,7 +386,7 @@ func (s *UDMSubController) Export(c *gin.Context) {
|
||||
|
||||
// 文件名
|
||||
fileName := fmt.Sprintf("udm_sub_user_export_%s_%d.%s", neId, time.Now().UnixMilli(), fileType)
|
||||
filePath := fmt.Sprintf("%s/%s", file.ParseUploadFileDir(uploadsubpath.EXPORT), fileName)
|
||||
filePath := filepath.Join(file.ParseUploadFileDir(uploadsubpath.EXPORT), fileName)
|
||||
|
||||
if fileType == "csv" {
|
||||
// 转换数据
|
||||
|
||||
@@ -74,6 +74,13 @@ func (r *UDMAuthUser) SelectPage(query map[string]any) map[string]any {
|
||||
conditions = append(conditions, "ne_id = ?")
|
||||
params = append(params, v)
|
||||
}
|
||||
if v, ok := query["imsis"]; ok && v != "" {
|
||||
placeholder := repo.KeyPlaceholderByQuery(len(v.([]any)))
|
||||
conditions = append(conditions, fmt.Sprintf("imsi in (%s)", placeholder))
|
||||
for _, v := range v.([]any) {
|
||||
params = append(params, v.(string))
|
||||
}
|
||||
}
|
||||
|
||||
// 构建查询条件语句
|
||||
whereSql := ""
|
||||
|
||||
@@ -110,6 +110,13 @@ func (r *UDMSubUser) SelectPage(query map[string]any) map[string]any {
|
||||
conditions = append(conditions, "ne_id = ?")
|
||||
params = append(params, v)
|
||||
}
|
||||
if v, ok := query["imsis"]; ok && v != "" {
|
||||
placeholder := repo.KeyPlaceholderByQuery(len(v.([]any)))
|
||||
conditions = append(conditions, fmt.Sprintf("imsi in (%s)", placeholder))
|
||||
for _, v := range v.([]any) {
|
||||
params = append(params, v.(string))
|
||||
}
|
||||
}
|
||||
|
||||
// 构建查询条件语句
|
||||
whereSql := ""
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
)
|
||||
|
||||
// 实例化服务层 UDMSubUser 结构体
|
||||
var NewUDMSub = &UDMSubUser{
|
||||
var NewUDMSubUser = &UDMSubUser{
|
||||
udmSubRepository: repository.NewUDMSub,
|
||||
udmUserInfoRepository: repository.NewUDMUserInfo,
|
||||
}
|
||||
|
||||
@@ -49,6 +49,8 @@ func NeState(neInfo model.NeInfo) (map[string]any, error) {
|
||||
"capability": resData["capability"],
|
||||
"sn": resData["serialNum"],
|
||||
"expire": resData["expiryDate"],
|
||||
"hostname": resData["hostName"],
|
||||
"os": resData["osInfo"],
|
||||
"cpu": resData["cpuUsage"],
|
||||
"mem": resData["memUsage"],
|
||||
"disk": resData["diskSpace"],
|
||||
|
||||
@@ -657,11 +657,40 @@ func (r *NeVersion) operateDome(action string, neVersion model.NeVersion) error
|
||||
if neInfo.NeId != neVersion.NeId {
|
||||
return fmt.Errorf("error found neinfo")
|
||||
}
|
||||
|
||||
// ========= 网元OAM配置文件 start ==========
|
||||
if err := NewNeInfo.NeConfOAMWirteSync(neInfo, nil, true); err != nil {
|
||||
return fmt.Errorf("error wirte OAM file info")
|
||||
}
|
||||
// ========= 网元OAM配置文件 end ===========
|
||||
|
||||
// SMSC配置修改IMS和UDM 配置
|
||||
if neInfo.NeType == "SMSC" {
|
||||
para5GData := NewNeInfo.Para5GData
|
||||
mnc_mcc := fmt.Sprintf("mnc%s.mcc%s", para5GData["MNC_DOMAIN"], para5GData["MCC"])
|
||||
smscHost := fmt.Sprintf("%s smsc.ims.%s.3gppnetwork.org", para5GData["SMSC_IP"], mnc_mcc)
|
||||
smscHostCMD := fmt.Sprintf("grep -qxF '%s' /etc/hosts || echo '%s' | sudo tee -a /etc/hosts \n", smscHost, smscHost)
|
||||
smscIPCMD := fmt.Sprintf("grep -qxF '%s smsc' /etc/hosts || echo '%s smsc' | sudo tee -a /etc/hosts \n", para5GData["SMSC_IP"], para5GData["SMSC_IP"])
|
||||
// IMS 配置
|
||||
imsNEs := NewNeInfo.SelectList(model.NeInfo{NeType: "IMS"}, false, false)
|
||||
for _, v := range imsNEs {
|
||||
NewNeInfo.NeRunSSHCmd(v.NeType, v.NeId, smscIPCMD)
|
||||
NewNeInfo.NeRunSSHCmd(v.NeType, v.NeId, smscHostCMD)
|
||||
NewNeInfo.NeRunSSHCmd(v.NeType, v.NeId, "sudo sed -i '/^#!define WITH_SMS/ s/^/#/' /usr/local/etc/ims/vars.cfg")
|
||||
NewNeInfo.NeRunSSHCmd(v.NeType, v.NeId, "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;s|diameterAddress: .*|diameterAddress: smsc.ims.%s.3gppnetwork.org|}' /usr/local/etc/udm/as.yaml", mnc_mcc)
|
||||
udmNEs := NewNeInfo.SelectList(model.NeInfo{NeType: "UDM"}, false, false)
|
||||
for _, v := range udmNEs {
|
||||
NewNeInfo.NeRunSSHCmd(v.NeType, v.NeId, smscIPCMD)
|
||||
NewNeInfo.NeRunSSHCmd(v.NeType, v.NeId, smscHostCMD)
|
||||
NewNeInfo.NeRunSSHCmd(v.NeType, v.NeId, smscASName)
|
||||
NewNeInfo.NeRunSSHCmd(v.NeType, v.NeId, smscASAddress)
|
||||
NewNeInfo.NeRunSSHCmd(v.NeType, v.NeId, "sudo service udm restart")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 更新Version
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# duration: rotation time with xx hours, example: 1/12/24 hours
|
||||
# count: rotation count of log, default is 30 rotation
|
||||
logger:
|
||||
file: d:/local.git/be.ems/sshsvc/log/sshsvc.log
|
||||
file: d:/omc.git/be.ems/sshsvc/log/sshsvc.log
|
||||
level: trace
|
||||
duration: 24
|
||||
count: 30
|
||||
@@ -13,7 +13,7 @@ logger:
|
||||
# count: rotation count of log, default is 30 rotation
|
||||
# level: cmd/ret log cmd/log cmd & result
|
||||
logmml:
|
||||
file: d:/local.git/be.ems/sshsvc/mmllog/omcmml.log
|
||||
file: d:/omc.git/be.ems/sshsvc/mmllog/omcmml.log
|
||||
duration: 24
|
||||
count: 30
|
||||
level: ret
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Makefile for OMC-OMC-crontask project
|
||||
|
||||
PROJECT = OMC
|
||||
VERSION = 2.2410.2
|
||||
VERSION = 2.2410.4
|
||||
LIBDIR = be.ems/lib
|
||||
BINNAME = sshsvc
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
Home=/home/simon
|
||||
GitLocalRoot=${Home}/local.git
|
||||
GitLocalRoot=${Home}/omc.git
|
||||
EmsBEDir=${GitLocalRoot}/be.ems
|
||||
user="root"
|
||||
password="1000omc@kp!"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
Home=/home/simon
|
||||
GitLocalRoot=${Home}/local.git
|
||||
GitLocalRoot=${Home}/omc.git
|
||||
EmsBEDir=${GitLocalRoot}/be.ems
|
||||
EMSBuildDir=${GitLocalRoot}/build.ems
|
||||
user="root"
|
||||
|
||||
Reference in New Issue
Block a user