1
0

merge: 合并代码20240531

This commit is contained in:
TsMask
2024-06-01 18:56:18 +08:00
parent 3cc193f57d
commit 3b50e2f3f8
129 changed files with 3705 additions and 11065 deletions

View File

@@ -20,6 +20,11 @@ type YamlConfig struct {
Count int `yaml:"count"`
} `yaml:"logger"`
Pprof struct {
Enabled bool `yaml:"enabled"`
Addr string `yaml:"addr"`
} `yaml:"pprof"`
// Rest []struct {
// IPv4 string `yaml:"ipv4"`
// IPv6 string `yaml:"ipv6"`
@@ -76,30 +81,7 @@ type YamlConfig struct {
CmdTimeout int `yaml:"cmdTimeout"`
} `yaml:"omc"`
Alarm struct {
ForwardAlarm bool `yaml:"forwardAlarm"`
SMProxy string `yaml:"smProxy"`
Email struct {
Smtp string `yaml:"smtp"`
Port uint16 `yaml:"port"`
User string `yaml:"user"`
Password string `yaml:"password"`
TlsSkipVerify bool `yaml:"tlsSkipVerify"`
} `yaml:"email"`
SMS struct {
ApiURL string `yaml:"apiURL"`
AccessKeyID string `yaml:"AccessKeyID"`
AccessKeySecret string `yaml:"accessKeySecret"`
SignName string `yaml:"signName"`
TemplateCode string `yaml:"templateCode"`
} `yaml:"sms"`
SMSC struct {
Addr string `yaml:"addr"`
SystemID string `yaml:"systemID"`
Password string `yaml:"password"`
SystemType string `yaml:"systemType"`
} `yaml:"smsc"`
} `yaml:"alarm"`
Alarm AlarmConfig `yaml:"alarm"`
MML MMLParam `yaml:"mml"`
@@ -164,6 +146,32 @@ type DbConfig struct {
Backup string `yaml:"backup"`
}
type AlarmConfig struct {
SplitEventAlarm bool `yaml:"splitEventAlarm"`
ForwardAlarm bool `yaml:"forwardAlarm"`
SMProxy string `yaml:"smProxy"`
Email struct {
Smtp string `yaml:"smtp"`
Port uint16 `yaml:"port"`
User string `yaml:"user"`
Password string `yaml:"password"`
TlsSkipVerify bool `yaml:"tlsSkipVerify"`
} `yaml:"email"`
SMS struct {
ApiURL string `yaml:"apiURL"`
AccessKeyID string `yaml:"AccessKeyID"`
AccessKeySecret string `yaml:"accessKeySecret"`
SignName string `yaml:"signName"`
TemplateCode string `yaml:"templateCode"`
} `yaml:"sms"`
SMSC struct {
Addr string `yaml:"addr"`
SystemID string `yaml:"systemID"`
Password string `yaml:"password"`
SystemType string `yaml:"systemType"`
} `yaml:"smsc"`
}
type MMLParam struct {
Port int `yaml:"port"`
Port2 int `yaml:"port2"`
@@ -175,7 +183,6 @@ type MMLParam struct {
User string `yaml:"user"`
Password string `ymal:"password"`
MmlHome string `yaml:"mmlHome"`
Upload string `yaml:"upload"`
}
type TestDatas struct {
@@ -223,6 +230,9 @@ func NewYamlConfig() YamlConfig {
SizeCol: 128,
BufferSize: 65535,
},
Alarm: AlarmConfig{
SplitEventAlarm: true,
},
}
}

View File

@@ -3,20 +3,40 @@
# 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-t.log
file: d:/local.git/be.ems/restagent/log/restagent.log
level: trace
duration: 24
count: 2
# rest agent listen ipv4/v6 and port, support multiple routines
# ip: 0.0.0.0 or ::0, support IPv4/v6
# clientAuthType: 0:NoClientCert (default), 1:RequestClientCert, 2:RequireAnyClientCert,
# 3:VerifyClientCertIfGiven, 4:RequireAndVerifyClientCerts
rest:
- ipv4: 0.0.0.0
ipv6:
port: 33030
- ipv4: 0.0.0.0
ipv6:
port: 36060
port: 33443
scheme: https
clientAuthType: 0
caFile: ./etc/certs/omc-ca.crt
certFile: ./etc/certs/omc-server.crt
keyFile: ./etc/certs/omc-server.key
webServer:
enabled: false
rootDir: d:/local.git/fe.ems.vue3/dist
listen:
- addr: :80
schema: http
- addr: :443
scheme: https
clientAuthType: 0
caFile: ./etc/certs/omc-ca.crt
certFile: ./etc/certs/omc-server.crt
keyFile: ./etc/certs/omc-server.key
database:
type: mysql
@@ -25,6 +45,7 @@ database:
host: 127.0.0.1
port: 33066
name: omc_db
connParam: charset=utf8mb4&collation=utf8mb4_general_ci&parseTime=True&interpolateParams=True
backup: d:/local.git/be.ems/restagent/database
# Redis 缓存数据,数据源声明全小写
@@ -33,25 +54,34 @@ redis:
# OMC系统使用库
default:
port: 6379 # Redis port
host: "192.168.2.166" # Redis host
password: ""
host: "192.168.2.219" # Redis host
password: "123456"
db: 10 # Redis db_num
# UDM网元用户库
udmuser:
port: 6379 # Redis port
host: "192.168.2.166"
password: ""
host: "192.168.2.219"
password: "123456"
db: 0 # Redis db_num
# 多个数据源时可以用这个指定默认的数据源
defaultDataSourceName: "default"
# sleep: time delay for after write buffer (millisecond)
# deadLine: timeout for io read and write (second)
mml:
port: 4100
port2: 5002
sleep: 200
deadLine: 10
sizeRow: 100
sizeCol: 128
bufferSize: 65535
user: admin
password: admin
mmlHome: ./mmlhome
upload: /home/manager
# NE config
ne:
user: root
etcdir: /usr/local/etc
@@ -59,6 +89,13 @@ ne:
omcdir: /usr/local/omc
scpdir: /tmp
licensedir: /usr/local/etc/{neType}/license
# backup etc list of IMS,no space
etcListIMS: '{*.yaml,mmtel,vars.cfg}'
etcListDefault: '{*.yaml,*.conf,*.cfg}'
# true/false to overwrite config file when dpkg ne software
dpkgOverwrite: false
# dpkg timeout (second)
dpkgTimeout: 180
# chk2ne: true/false, if put OmcNeConfig parameters to NE
omc:
@@ -71,42 +108,55 @@ omc:
vendor: ""
dn: 4600
chk2ne: false
sn: 13750650
sn: "-"
checksign: false
rootDir: ./
binDir: ./bin
backup: ./backup
upload: ./upload
frontUpload: d:/local.git/fe.ems/upload
frontTraceDir: d:/local.git/fe.ems/trace
software: ./software
license: ./license
gtpUri: gtp:192.168.2.119:2152
gtpUri: gtp:192.168.2.219:2152
checkContentType: false
testMode: false
rbacMode: true
runDir:
cmdTimeout: 120
# Alarm module setting
# Forward interface:
# email/sms
# email/sms
# smProxy: sms(Short Message Service)/smsc(SMS Centre)
alarm:
forwardAlarm: true
email:
smtp: smtp@xxx.com.cn
smtp: mail.agrandtech.com
port: 25
user: smtpuser
password: smtpuser@omc
user: smtpext@agrandtech.com
password: "1000smtp@omc!"
# TLS skip verify: true/false
tlsSkipVerify: true
smProxy: smsc
sms:
apiURL: http://smsc.xxx.com.cn/
apiURL: http://smsc.xxx.com/
accessKeyID: xxxx
accessKeySecret: xxxx
signName: xxx SMSC
templateCode: 1000
smsc:
addr: "192.168.13.114:2775"
systemID: "omc"
password: "omc123"
systemType: "UTRAN"
#User authorized information
# crypt: mysql/md5/bcrypt
# token: true/false to check accessToken
# expires for session, unit: second
# Support single/multiple session of user
#
auth:
crypt: bcrypt
token: true
@@ -129,6 +179,18 @@ params:
subidmaxnum: 20
urimaxlen: 2100000
rmuidregexp: "[0-9]{4}[A-Z]{2}[A-Z]{2}[0-9A-Z]{1}[0-9A-Z]{3}[0-9A-Z]{1,16}"
testConfig:
enabled: true
file: ./etc/testconfig.yaml
file: ./etc/testconfig.yaml
# 静态文件配置, 相对项目根路径或填绝对路径
staticFile:
# 默认资源dir目录需要预先创建
default:
prefix: "/static"
dir: "./static"
# 文件上传资源目录映射,与项目目录同级
upload:
prefix: "/upload"
dir: "./upload"

View File

@@ -2,11 +2,16 @@
# level: /trace/debug/info/warn/error/fatal, default: debug
# duration: rotation time with xx hours, example: 1/12/24 hours
# 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
level: trace
duration: 24
count: 2
count: 2
pprof:
enabled: true
addr: :36060
# rest agent listen ipv4/v6 and port, support multiple routines
# ip: 0.0.0.0 or ::0, support IPv4/v6
@@ -16,9 +21,17 @@ rest:
- ipv4: 0.0.0.0
ipv6:
port: 33040
- ipv4: 0.0.0.0
ipv6:
port: 34443
scheme: https
clientAuthType: 0
caFile: ./etc/certs/omc-ca.crt
certFile: ./etc/certs/omc-server.crt
keyFile: ./etc/certs/omc-server.key
webServer:
enabled: false
enabled: true
rootDir: d:/local.git/fe.ems.vue3/dist
listen:
- addr: :80
@@ -33,10 +46,10 @@ webServer:
database:
type: mysql
user: root
password: "root@1234"
host: "192.168.5.59"
port: 3306
name: "omc_db"
password: 1000omc@kp!
host: 127.0.0.1
port: 33066
name: omc_db
connParam: charset=utf8mb4&collation=utf8mb4_general_ci&parseTime=True&interpolateParams=True
backup: d:/local.git/be.ems/restagent/database
@@ -46,14 +59,14 @@ redis:
# OMC系统使用库
default:
port: 6379 # Redis port
host: "192.168.5.59" # Redis host
password: "redis@1234"
host: "192.168.2.219" # Redis host
password: "123456"
db: 10 # Redis db_num
# UDM网元用户库
udmuser:
port: 6379 # Redis port
host: "172.60.5.140"
password: "helloearth"
host: "192.168.2.219"
password: "123456"
db: 0 # Redis db_num
# 多个数据源时可以用这个指定默认的数据源
defaultDataSourceName: "default"
@@ -71,11 +84,10 @@ mml:
user: admin
password: admin
mmlHome: ./mmlhome
upload: /home/agtuser
# NE config
ne:
user: agtuser
user: root
etcdir: /usr/local/etc
bindir: /usr/local/bin
omcdir: /usr/local/omc
@@ -119,9 +131,10 @@ omc:
# Alarm module setting
# Forward interface:
# email/sms
# email/sms
# smProxy: sms(Short Message Service)/smsc(SMS Centre)
alarm:
forwardAlarm: false
forwardAlarm: true
email:
smtp: mail.agrandtech.com
port: 25
@@ -129,8 +142,9 @@ alarm:
password: "1000smtp@omc!"
# TLS skip verify: true/false
tlsSkipVerify: true
smProxy: smsc
sms:
apiURL: http://smsc.xxx.com.cn/
apiURL: http://smsc.xxx.com/
accessKeyID: xxxx
accessKeySecret: xxxx
signName: xxx SMSC
@@ -175,12 +189,12 @@ testConfig:
file: ./etc/testconfig.yaml
# 静态文件配置, 相对项目根路径或填绝对路径
# staticFile:
# # 默认资源dir目录需要预先创建
# default:
# prefix: "/static"
# dir: "./static"
# # 文件上传资源目录映射,与项目目录同级
# upload:
# prefix: "/upload"
# dir: "./upload"
staticFile:
# 默认资源dir目录需要预先创建
default:
prefix: "/static"
dir: "./static"
# 文件上传资源目录映射,与项目目录同级
upload:
prefix: "/upload"
dir: "./upload"

View File

@@ -1,7 +1,7 @@
# Makefile for rest agent project
PROJECT = OMC
VERSION = 2.2404.6
VERSION = 2.2405.4
PLATFORM = amd64
ARMPLATFORM = aarch64
BUILDDIR = ../../build

View File

@@ -9,6 +9,8 @@ import (
"strconv"
"strings"
_ "net/http/pprof"
"be.ems/features/dbrest"
"be.ems/features/event"
"be.ems/features/fm"
@@ -185,12 +187,20 @@ func HttpListenWebServer(addr string) {
}
func main() {
// src 配置中心初始加载
src.ConfigurationInit()
app := src.AppEngine()
conf := config.GetYamlConfig()
if conf.Pprof.Enabled {
// 启用pprof HTTP服务
go func() {
fmt.Println(http.ListenAndServe(conf.Pprof.Addr, nil))
}()
}
log.InitLogger(conf.Logger.File, conf.Logger.Duration, conf.Logger.Count, "omc:restagent", config.GetLogLevel())
fmt.Printf("OMC restagent version: %s\n", global.Version)
log.Infof("========================= OMC restagent startup =========================")
@@ -241,9 +251,6 @@ func main() {
// AMF上报的UE事件, 无前缀,暂时特殊处理
app.POST(event.UriUEEvent, event.PostUEEventFromAMF)
// 开启监控采集
// monitor.StartMonitor(false, "")
var listenLocalhost bool = false
for _, rest := range conf.Rest {
// ipv4 goroutines