chore: 打包程序restagent变更omc

This commit is contained in:
TsMask
2024-03-19 20:20:12 +08:00
parent a4c71a4d70
commit b01bc44578
84 changed files with 308 additions and 190 deletions

26
.gitignore vendored
View File

@@ -11,32 +11,6 @@
.idea/ .idea/
# Run temp file and dir # Run temp file and dir
crontask/log/
crontask/ftp/
crontask/database/
crontask/export/
crontask/temp
crontask/crontask
restagent/backup/
restagent/log/
restagent/upload/
restagent/software/
restagent/database/
restagent/license/
restagent/restagent
sshsvc/sshsvc
sshsvc/mmllog/
sshsvc/mmlhome/
sshsvc/log/
captrace/captrace
captrace/log/
tools/loadmconf/loadmconf
tools/loadpconf/loadpconf
reference reference
vendor vendor

6
.vscode/launch.json vendored
View File

@@ -9,16 +9,16 @@
"type": "go", "type": "go",
"request": "launch", "request": "launch",
"mode": "debug", "mode": "debug",
"program": "./restagent/restagent.go", "program": "./omc/omc.go",
"console": "integratedTerminal", "console": "integratedTerminal",
"args": ["--env", "local"] // 走开发配置 "args": ["--env", "local"] // 走开发配置
}, },
{ {
"name": "DEBUG restagent", "name": "DEBUG omc",
"type": "go", "type": "go",
"request": "launch", "request": "launch",
"mode": "debug", "mode": "debug",
"program": "d:/local.git/be.ems/restagent/", "program": "d:/local.git/be.ems/omc/",
"console": "integratedTerminal" "console": "integratedTerminal"
}, },
{ {

View File

@@ -25,15 +25,15 @@ replica-read-only no
```sh ```sh
# 安装 Go版本 1.21.6 后进入项目根目录 # 安装 Go版本 1.21.6 后进入项目根目录
cd ./restagent cd ./omc
# 下载依赖 # 下载依赖
go mod download go mod download
# 调试启动 # 调试启动
go run restagent.go -c ./restagent/etc/restconf.yaml --env local go run omc.go -c ./omc/etc/restconf.yaml --env local
# 打包命名 restagent # 打包命名 omc
go build -ldflags="-s -w" -o restagent go build -ldflags="-s -w" -o omc
``` ```
## 打包 ## 打包
@@ -43,5 +43,5 @@ go env -w GOOS=linux
go env -w GOOS=windows go env -w GOOS=windows
go build -o restagent -v -ldflags "-X 'nms_cxy/lib/global.Version=2.2311.8' -X 'nms_cxy/lib/global.BuildTime=`date`' -X 'nms_cxy/lib/global.GoVer=`go version`'" go build -o omc -v -ldflags "-X 'nms_cxy/lib/global.Version=2.2311.8' -X 'nms_cxy/lib/global.BuildTime=`date`' -X 'nms_cxy/lib/global.GoVer=`go version`'"
``` ```

View File

@@ -33,7 +33,7 @@ OmcInstallDir=/usr/local/omc
ConfigEtcDir=${EmsBEDir}/build/config/etc ConfigEtcDir=${EmsBEDir}/build/config/etc
ConfigSystemdDir=${EmsBEDir}/build/config/systemd ConfigSystemdDir=${EmsBEDir}/build/config/systemd
EmsFEVue3Dir=/home/agtuser/Docker/nginx/html/dist EmsFEVue3Dir=/home/agtuser/Docker/nginx/html/dist
RESTAGENT=restagent RESTAGENT=omc
CRONTASK=crontask CRONTASK=crontask
SshSvcBin=sshsvc SshSvcBin=sshsvc
CapTraceBin=captrace CapTraceBin=captrace
@@ -41,7 +41,7 @@ Data2htmlBin=data2html
NBI_ALARM=nbi_alarm NBI_ALARM=nbi_alarm
NBI_AGENT=nbi_agent NBI_AGENT=nbi_agent
AAAA_AGENT=4a_agent AAAA_AGENT=4a_agent
RestagentDir=${EmsBEDir}/restagent RestagentDir=${EmsBEDir}/omc
CrontaskDir=/usr/local/omc/bin CrontaskDir=/usr/local/omc/bin
SshSvcDir=/usr/local/omc/bin SshSvcDir=/usr/local/omc/bin
CapTraceDir=/usr/local/omc/bin CapTraceDir=/usr/local/omc/bin
@@ -59,7 +59,7 @@ elif [[ ${RpmArch} =~ "aarch64" ]];then
RelArch=arm64 RelArch=arm64
fi fi
ProcList="restagent" ProcList="omc"
cd $EmsBEDir cd $EmsBEDir
for procName in $ProcList;do for procName in $ProcList;do
cd $EmsBEDir/$procName cd $EmsBEDir/$procName
@@ -75,7 +75,7 @@ case "$1" in
rm -rf ${RpmFEBuildDir}/front/* rm -rf ${RpmFEBuildDir}/front/*
rm -rf ${EmsBEDir}/build/rpmbuild/BUILD/usr/local/omc/etc/db/* rm -rf ${EmsBEDir}/build/rpmbuild/BUILD/usr/local/omc/etc/db/*
cp -rf ${RestagentDir}/restagent ${BuildOMCBinDir} cp -rf ${RestagentDir}/omc ${BuildOMCBinDir}
cp -rf ${CrontaskDir}/crontask ${BuildOMCBinDir} cp -rf ${CrontaskDir}/crontask ${BuildOMCBinDir}
cp -rf ${SshSvcDir}/sshsvc ${BuildOMCBinDir} cp -rf ${SshSvcDir}/sshsvc ${BuildOMCBinDir}
cp -rf ${CapTraceDir}/captrace ${BuildOMCBinDir} cp -rf ${CapTraceDir}/captrace ${BuildOMCBinDir}
@@ -132,7 +132,7 @@ case "$1" in
rm -rf ${DebFEBuildDir}/front/* rm -rf ${DebFEBuildDir}/front/*
rm -rf ${DebBuildDir}/usr/local/omc/etc/db/* rm -rf ${DebBuildDir}/usr/local/omc/etc/db/*
cp -rf ${RestagentDir}/restagent ${BuildOMCBinDir} cp -rf ${RestagentDir}/omc ${BuildOMCBinDir}
cp -rf ${CrontaskDir}/crontask ${BuildOMCBinDir} cp -rf ${CrontaskDir}/crontask ${BuildOMCBinDir}
cp -rf ${SshSvcDir}/sshsvc ${BuildOMCBinDir} cp -rf ${SshSvcDir}/sshsvc ${BuildOMCBinDir}
cp -rf ${CapTraceDir}/captrace ${BuildOMCBinDir} cp -rf ${CapTraceDir}/captrace ${BuildOMCBinDir}

View File

@@ -1,5 +1,5 @@
[Unit] [Unit]
Description=REST agent daemon Description=OMC Service daemon
After=network-online.target After=network-online.target
[Service] [Service]
@@ -7,7 +7,7 @@ Type=simple
LimitNOFILE=65535 LimitNOFILE=65535
Restart=always Restart=always
ExecStart=/usr/local/omc/bin/restagent -c /usr/local/omc/etc/restconf.yaml ExecStart=/usr/local/omc/bin/omc -c /usr/local/omc/etc/omc.yaml
RestartSec=2 RestartSec=2
RestartPreventExitStatus=1 RestartPreventExitStatus=1
ExecReload=/bin/kill -HUP $MAINPID ExecReload=/bin/kill -HUP $MAINPID

View File

@@ -3,18 +3,18 @@
# duration: rotation time with xx hours, example: 1/12/24 hours # duration: rotation time with xx hours, example: 1/12/24 hours
# count: rotation count of log, default is 30 rotation # count: rotation count of log, default is 30 rotation
logger: logger:
file: /usr/local/omc/log/restagent.log file: /usr/local/omc/log/omc.log
level: debug level: debug
duration: 24 duration: 24
count: 90 count: 90
# rest agent listen ipv4/v6 and port, support multiple routines # rest agent listen ipv4/v6 and port, support multiple routines
# ip: 0.0.0.0 or ::0, support IPv4/v6 # ip: 0.0.0.0 or ::0, support IPv4/v6
rest: rest:
- ipv4: 0.0.0.0 - ipv4: 0.0.0.0
ipv6: ipv6:
port: 3030 port: 3030
- ipv4: - ipv4:
ipv6: ::0 ipv6: ::0
port: 6060 port: 6060
@@ -58,15 +58,15 @@ omc:
frontUpload: /usr/local/omc/htdocs/front/upload frontUpload: /usr/local/omc/htdocs/front/upload
software: /usr/local/omc/software software: /usr/local/omc/software
license: /usr/local/omc/license license: /usr/local/omc/license
gtpUri: gtp:192.168.2.119:2152 gtpUri: gtp:192.168.2.119:2152
checkContentType: false checkContentType: false
testMode: true testMode: true
rbacMode: true rbacMode: true
# Alarm module setting # Alarm module setting
# Forward interface: # Forward interface:
# email/sms # email/sms
alarm: alarm:
forwardAlarm: true forwardAlarm: true
email: email:
smtp: smtp@ruijie.com.cn smtp: smtp@ruijie.com.cn
@@ -79,7 +79,7 @@ alarm:
accessKeySecret: xxxx accessKeySecret: xxxx
signName: Ruijie SMSC signName: Ruijie SMSC
templateCode: 1000 templateCode: 1000
#User authorized information #User authorized information
# crypt: mysql/md5/bcrypt # crypt: mysql/md5/bcrypt
# token: true/false to check accessToken # token: true/false to check accessToken
@@ -91,7 +91,7 @@ auth:
expires: 1800 expires: 1800
session: multiple session: multiple
# Parameter for limit number # Parameter for limit number
# rmuid_maxnum: the max number of rmUID, default: 50 # rmuid_maxnum: the max number of rmUID, default: 50
# alarmid_maxnum: the max number of AlarmID, default: 50 # alarmid_maxnum: the max number of AlarmID, default: 50
# pmid_maxnum: the max number of pmID, default: 50 # pmid_maxnum: the max number of pmID, default: 50
@@ -108,4 +108,40 @@ params:
testConfig: testConfig:
enabled: true enabled: true
file: /usr/local/omc/etc/testconfig.yaml file: /usr/local/omc/etc/testconfig.yaml
# NMS-中国星网研究院
nmsCXY:
# 注入路由组
routerGroup: "/nms-cxy/api/rest"
# 专业编码2位 核心网HX 无线网WX
professionCode: "HX"
# 厂商编码2位 中信科ZX
vendorCode: "AG"
# OMC编号3位
omcCode: "001"
# 设备序列号
serialNumber: "1153492"
# Kafka配置
kafka:
addrs:
- "192.168.5.59:19092"
- "192.168.5.59:29092"
- "192.168.5.59:39092"
# 启用 Kerberos 认证
krb5:
enable: false
config:
configPath: "/path/to/krb5.conf"
keyTabPath: "/path/to/keytab"
serviceName: "kafka"
realm: "EXAMPLE.COM"
username: "client"
# OSS配置
oss:
bucketname: "omc-bucket"
endpoint: "192.168.5.59:9000"
useSSL: false
accessKeyID: "aOW0r1gfw74G88Z3XZJ6"
secretAccessKey: "9tDErvtCEuVox6LoQu5BOVtycQKcQjlXOGvjl1eD"

View File

@@ -3,21 +3,21 @@
# duration: rotation time with xx hours, example: 1/12/24 hours # duration: rotation time with xx hours, example: 1/12/24 hours
# count: rotation count of log, default is 30 rotation # count: rotation count of log, default is 30 rotation
logger: logger:
file: /usr/local/omc/log/restagent.log file: /usr/local/omc/log/omc.log
level: debug level: debug
duration: 24 duration: 24
count: 90 count: 90
# rest agent listen ipv4/v6 and port, support multiple routines # rest agent listen ipv4/v6 and port, support multiple routines
# ip: 0.0.0.0 or ::0, support IPv4/v6 # ip: 0.0.0.0 or ::0, support IPv4/v6
# clientAuthType: 0:NoClientCert (default), 1:RequestClientCert, 2:RequireAnyClientCert, # clientAuthType: 0:NoClientCert (default), 1:RequestClientCert, 2:RequireAnyClientCert,
# 3:VerifyClientCertIfGiven, 4:RequireAndVerifyClientCerts # 3:VerifyClientCertIfGiven, 4:RequireAndVerifyClientCerts
rest: rest:
- ipv4: 0.0.0.0 - ipv4: 0.0.0.0
ipv6: ipv6:
port: 33030 port: 33030
- ipv4: 0.0.0.0 - ipv4: 0.0.0.0
ipv6: ipv6:
port: 33443 port: 33443
schema: https schema: https
clientAuthType: 0 clientAuthType: 0
@@ -26,9 +26,9 @@ rest:
keyFile: /usr/local/omc/etc/certs/omc-server.key keyFile: /usr/local/omc/etc/certs/omc-server.key
webServer: webServer:
enabled: true enabled: false
rootDir: /usr/local/omc/htdocs/front rootDir: /usr/local/omc/htdocs/front
listen: listen:
- addr: :80 - addr: :80
schema: http schema: http
- addr: :443 - addr: :443
@@ -86,9 +86,9 @@ ne:
scpdir: /tmp scpdir: /tmp
licensedir: /usr/local/etc/{neType}/license licensedir: /usr/local/etc/{neType}/license
# backup etc list of IMS, does not contain spaces # backup etc list of IMS, does not contain spaces
etcListIMS: '{*.yaml,mmtel,vars.cfg}' etcListIMS: "{*.yaml,mmtel,vars.cfg}"
etcListDefault: '{*.yaml,*.conf,*.cfg}' etcListDefault: "{*.yaml,*.conf,*.cfg}"
# true/false to overwrite config file when dpkg ne software # true/false to overwrite config file when dpkg ne software
dpkgOverwrite: false dpkgOverwrite: false
# dpkg timeout (second) # dpkg timeout (second)
dpkgTimeout: 180 dpkgTimeout: 180
@@ -114,7 +114,7 @@ omc:
frontTraceDir: /usr/local/omc/htdocs/front/trace frontTraceDir: /usr/local/omc/htdocs/front/trace
software: /usr/local/omc/software software: /usr/local/omc/software
license: /usr/local/omc/license license: /usr/local/omc/license
gtpUri: gtp:192.168.2.119:2152 gtpUri: gtp:192.168.2.119:2152
checkContentType: false checkContentType: false
testMode: false testMode: false
rbacMode: true rbacMode: true
@@ -123,8 +123,8 @@ omc:
# Alarm module setting # Alarm module setting
# Forward interface: # Forward interface:
# email/sms # email/sms
alarm: alarm:
forwardAlarm: true forwardAlarm: true
email: email:
smtp: smtp.xxx.com smtp: smtp.xxx.com
@@ -132,14 +132,14 @@ alarm:
user: smtpuser@xxx.com user: smtpuser@xxx.com
password: xxxxxx password: xxxxxx
# TLS skip verify: true/false # TLS skip verify: true/false
tlsSkipVerify: true tlsSkipVerify: true
sms: sms:
apiURL: http://smsc.xxx.com apiURL: http://smsc.xxx.com
accessKeyID: xxx accessKeyID: xxx
accessKeySecret: xxx accessKeySecret: xxx
signName: XXX SMSC signName: XXX SMSC
templateCode: 1000 templateCode: 1000
# User authorized information # User authorized information
# crypt: mysql/md5/bcrypt # crypt: mysql/md5/bcrypt
# token: true/false to check accessToken # token: true/false to check accessToken
@@ -154,7 +154,7 @@ auth:
publicKey: /usr/local/omc/etc/certs/omc publicKey: /usr/local/omc/etc/certs/omc
privateKey: /usr/local/omc/etc/certs/omc privateKey: /usr/local/omc/etc/certs/omc
# Parameter for limit number # Parameter for limit number
# rmuid_maxnum: the max number of rmUID, default: 50 # rmuid_maxnum: the max number of rmUID, default: 50
# alarmid_maxnum: the max number of AlarmID, default: 50 # alarmid_maxnum: the max number of AlarmID, default: 50
# pmid_maxnum: the max number of pmID, default: 50 # pmid_maxnum: the max number of pmID, default: 50
@@ -171,4 +171,40 @@ params:
testConfig: testConfig:
enabled: false enabled: false
file: /usr/local/omc/etc/testconfig.yaml file: /usr/local/omc/etc/testconfig.yaml
# NMS-中国星网研究院
nmsCXY:
# 注入路由组
routerGroup: "/nms-cxy/api/rest"
# 专业编码2位 核心网HX 无线网WX
professionCode: "HX"
# 厂商编码2位 中信科ZX
vendorCode: "AG"
# OMC编号3位
omcCode: "001"
# 设备序列号
serialNumber: "1153492"
# Kafka配置
kafka:
addrs:
- "192.168.5.59:19092"
- "192.168.5.59:29092"
- "192.168.5.59:39092"
# 启用 Kerberos 认证
krb5:
enable: false
config:
configPath: "/path/to/krb5.conf"
keyTabPath: "/path/to/keytab"
serviceName: "kafka"
realm: "EXAMPLE.COM"
username: "client"
# OSS配置
oss:
bucketname: "omc-bucket"
endpoint: "192.168.5.59:9000"
useSSL: false
accessKeyID: "aOW0r1gfw74G88Z3XZJ6"
secretAccessKey: "9tDErvtCEuVox6LoQu5BOVtycQKcQjlXOGvjl1eD"

View File

@@ -1,5 +1,5 @@
[Unit] [Unit]
Description=OMC rest agent daemon Description=OMC Service daemon
After=network-online.target mysql.service After=network-online.target mysql.service
[Service] [Service]
@@ -7,7 +7,7 @@ Type=simple
LimitNOFILE=65535 LimitNOFILE=65535
Restart=always Restart=always
ExecStart=/usr/local/omc/bin/restagent -c /usr/local/omc/etc/restconf.yaml ExecStart=/usr/local/omc/bin/omc -c /usr/local/omc/etc/omc.yaml
RestartSec=2 RestartSec=2
RestartPreventExitStatus=SIGTERM SIGKILL RestartPreventExitStatus=SIGTERM SIGKILL
ExecReload=/bin/kill -HUP $MAINPID ExecReload=/bin/kill -HUP $MAINPID

View File

@@ -16,7 +16,7 @@ LogoFileList="zh_brand.png zh_icon.png en_brand.png en_icon.png"
echo "" echo ""
echo "* To start/stop/restart/status omc service, please run:" echo "* To start/stop/restart/status omc service, please run:"
echo " sudo systemctl start/stop/restart/status restagent.service" echo " sudo systemctl start/stop/restart/status omc.service"
echo " sudo systemctl start/stop/restart/status crontask.service" echo " sudo systemctl start/stop/restart/status crontask.service"
echo " sudo systemctl start/stop/restart/status sshsvc.service" echo " sudo systemctl start/stop/restart/status sshsvc.service"
echo " sudo systemctl start/stop/restart/status captrace.service" echo " sudo systemctl start/stop/restart/status captrace.service"
@@ -77,14 +77,14 @@ if [ -e "${NginxSiteAvailable}/default" ]; then
sed -i 's/listen 80 default_server;/listen 1080 default_server;/g' ${NginxSiteAvailable}/default sed -i 's/listen 80 default_server;/listen 1080 default_server;/g' ${NginxSiteAvailable}/default
sed -i 's/listen \[::\]:80 default_server;/listen \[::\]:1080 default_server;/g' ${NginxSiteAvailable}/default sed -i 's/listen \[::\]:80 default_server;/listen \[::\]:1080 default_server;/g' ${NginxSiteAvailable}/default
fi fi
systemctl enable restagent.service systemctl enable omc.service
systemctl enable crontask.service systemctl enable crontask.service
systemctl enable sshsvc.service systemctl enable sshsvc.service
systemctl enable captrace.service systemctl enable captrace.service
systemctl enable adb.service systemctl enable adb.service
systemctl daemon-reload systemctl daemon-reload
sudo systemctl stop nginx.service sudo systemctl stop nginx.service
sudo systemctl stop restagent.service sudo systemctl stop omc.service
sudo systemctl stop crontask.service sudo systemctl stop crontask.service
sudo systemctl stop sshsvc.service sudo systemctl stop sshsvc.service
sudo systemctl stop captrace.service sudo systemctl stop captrace.service
@@ -94,11 +94,11 @@ sudo systemctl start adb.service
sudo systemctl start crontask.service sudo systemctl start crontask.service
sudo systemctl start sshsvc.service sudo systemctl start sshsvc.service
sudo systemctl start captrace.service sudo systemctl start captrace.service
sudo systemctl start restagent.service sudo systemctl start omc.service
#sudo systemctl restart nginx.service #sudo systemctl restart nginx.service
#sudo systemctl restart adb.service #sudo systemctl restart adb.service
#sudo systemctl restart crontask.service #sudo systemctl restart crontask.service
#sudo systemctl restart sshsvc.service #sudo systemctl restart sshsvc.service
#sudo systemctl restart captrace.service #sudo systemctl restart captrace.service
#sudo systemctl restart restagent.service #sudo systemctl restart omc.service

View File

@@ -9,7 +9,7 @@ rm libwiretap.so
rm libwsutil.so.13 rm libwsutil.so.13
rm libwsutil.so rm libwsutil.so
systemctl stop nginx.service systemctl stop nginx.service
systemctl stop restagent.service systemctl stop omc.service
systemctl stop crontask.service systemctl stop crontask.service
systemctl stop sshsvc.service systemctl stop sshsvc.service
systemctl stop captrace.service systemctl stop captrace.service
@@ -18,7 +18,7 @@ systemctl stop adb.service
#rm -rf /usr/local/omc #rm -rf /usr/local/omc
rm -rf /etc/nginx/conf.d/omc.conf rm -rf /etc/nginx/conf.d/omc.conf
systemctl disable restagent.service systemctl disable omc.service
systemctl disable crontask.service systemctl disable crontask.service
systemctl disable sshsvc.service systemctl disable sshsvc.service
systemctl disable captrace.service systemctl disable captrace.service

View File

@@ -3,19 +3,19 @@
# duration: rotation time with xx hours, example: 1/12/24 hours # duration: rotation time with xx hours, example: 1/12/24 hours
# count: rotation count of log, default is 30 rotation # count: rotation count of log, default is 30 rotation
logger: logger:
file: /usr/local/omc/log/restagent.log file: /usr/local/omc/log/omc.log
level: debug level: debug
duration: 24 duration: 24
count: 90 count: 90
# rest agent listen ipv4/v6 and port, support multiple routines # rest agent listen ipv4/v6 and port, support multiple routines
# ip: 0.0.0.0 or ::0, support IPv4/v6 # ip: 0.0.0.0 or ::0, support IPv4/v6
rest: rest:
- ipv4: 0.0.0.0 - ipv4: 0.0.0.0
ipv6: ipv6:
port: 3030 port: 3030
- ipv4: 0.0.0.0 - ipv4: 0.0.0.0
ipv6: ipv6:
port: 4443 port: 4443
schema: https schema: https
caFile: /usr/local/omc/etc/certs/rootca.crt caFile: /usr/local/omc/etc/certs/rootca.crt
@@ -23,9 +23,9 @@ rest:
keyFile: /usr/local/omc/etc/certs/tsa-omc_pri.key keyFile: /usr/local/omc/etc/certs/tsa-omc_pri.key
webServer: webServer:
enabled: true enabled: false
rootDir: /usr/local/omc/htdocs/front rootDir: /usr/local/omc/htdocs/front
listen: listen:
- addr: :8080 - addr: :8080
schema: http schema: http
- addr: :8443 - addr: :8443
@@ -96,7 +96,7 @@ omc:
frontTraceDir: /usr/local/omc/htdocs/front/trace frontTraceDir: /usr/local/omc/htdocs/front/trace
software: /usr/local/omc/software software: /usr/local/omc/software
license: /usr/local/omc/license license: /usr/local/omc/license
gtpUri: gtp:192.168.2.119:2152 gtpUri: gtp:192.168.2.119:2152
checkContentType: false checkContentType: false
testMode: false testMode: false
rbacMode: true rbacMode: true
@@ -104,8 +104,8 @@ omc:
# Alarm module setting # Alarm module setting
# Forward interface: # Forward interface:
# email/sms # email/sms
alarm: alarm:
forwardAlarm: true forwardAlarm: true
email: email:
smtp: smtp@xxx.com smtp: smtp@xxx.com
@@ -118,7 +118,7 @@ alarm:
accessKeySecret: xxx accessKeySecret: xxx
signName: XXX SMSC signName: XXX SMSC
templateCode: 1000 templateCode: 1000
#User authorized information #User authorized information
# crypt: mysql/md5/bcrypt # crypt: mysql/md5/bcrypt
# token: true/false to check accessToken # token: true/false to check accessToken
@@ -132,7 +132,7 @@ auth:
publicKey: /usr/local/omc/etc/certs/omc publicKey: /usr/local/omc/etc/certs/omc
privateKey: /usr/local/omc/etc/certs/omc privateKey: /usr/local/omc/etc/certs/omc
# Parameter for limit number # Parameter for limit number
# rmuid_maxnum: the max number of rmUID, default: 50 # rmuid_maxnum: the max number of rmUID, default: 50
# alarmid_maxnum: the max number of AlarmID, default: 50 # alarmid_maxnum: the max number of AlarmID, default: 50
# pmid_maxnum: the max number of pmID, default: 50 # pmid_maxnum: the max number of pmID, default: 50
@@ -149,4 +149,40 @@ params:
testConfig: testConfig:
enabled: true enabled: true
file: /usr/local/omc/etc/testconfig.yaml file: /usr/local/omc/etc/testconfig.yaml
# NMS-中国星网研究院
nmsCXY:
# 注入路由组
routerGroup: "/nms-cxy/api/rest"
# 专业编码2位 核心网HX 无线网WX
professionCode: "HX"
# 厂商编码2位 中信科ZX
vendorCode: "AG"
# OMC编号3位
omcCode: "001"
# 设备序列号
serialNumber: "1153492"
# Kafka配置
kafka:
addrs:
- "192.168.5.59:19092"
- "192.168.5.59:29092"
- "192.168.5.59:39092"
# 启用 Kerberos 认证
krb5:
enable: false
config:
configPath: "/path/to/krb5.conf"
keyTabPath: "/path/to/keytab"
serviceName: "kafka"
realm: "EXAMPLE.COM"
username: "client"
# OSS配置
oss:
bucketname: "omc-bucket"
endpoint: "192.168.5.59:9000"
useSSL: false
accessKeyID: "aOW0r1gfw74G88Z3XZJ6"
secretAccessKey: "9tDErvtCEuVox6LoQu5BOVtycQKcQjlXOGvjl1eD"

View File

@@ -16,7 +16,7 @@ LogoFileList="zh_brand.png zh_icon.png en_brand.png en_icon.png"
echo "" echo ""
echo "* To start/stop/restart/status omc service, please run:" echo "* To start/stop/restart/status omc service, please run:"
echo " sudo systemctl start/stop/restart/status restagent.service" echo " sudo systemctl start/stop/restart/status omc.service"
echo " sudo systemctl start/stop/restart/status crontask.service" echo " sudo systemctl start/stop/restart/status crontask.service"
echo " sudo systemctl start/stop/restart/status sshsvc.service" echo " sudo systemctl start/stop/restart/status sshsvc.service"
echo " sudo systemctl start/stop/restart/status captrace.service" echo " sudo systemctl start/stop/restart/status captrace.service"
@@ -77,14 +77,14 @@ if [ -e "${NginxSiteAvailable}/default" ]; then
sed -i 's/listen 80 default_server;/listen 1080 default_server;/g' ${NginxSiteAvailable}/default sed -i 's/listen 80 default_server;/listen 1080 default_server;/g' ${NginxSiteAvailable}/default
sed -i 's/listen \[::\]:80 default_server;/listen \[::\]:1080 default_server;/g' ${NginxSiteAvailable}/default sed -i 's/listen \[::\]:80 default_server;/listen \[::\]:1080 default_server;/g' ${NginxSiteAvailable}/default
fi fi
systemctl enable restagent.service systemctl enable omc.service
systemctl enable crontask.service systemctl enable crontask.service
systemctl enable sshsvc.service systemctl enable sshsvc.service
systemctl enable captrace.service systemctl enable captrace.service
systemctl enable adb.service systemctl enable adb.service
systemctl daemon-reload systemctl daemon-reload
sudo systemctl stop nginx.service sudo systemctl stop nginx.service
sudo systemctl stop restagent.service sudo systemctl stop omc.service
sudo systemctl stop crontask.service sudo systemctl stop crontask.service
sudo systemctl stop sshsvc.service sudo systemctl stop sshsvc.service
sudo systemctl stop captrace.service sudo systemctl stop captrace.service
@@ -94,11 +94,11 @@ sudo systemctl start adb.service
sudo systemctl start crontask.service sudo systemctl start crontask.service
sudo systemctl start sshsvc.service sudo systemctl start sshsvc.service
sudo systemctl start captrace.service sudo systemctl start captrace.service
sudo systemctl start restagent.service sudo systemctl start omc.service
#sudo systemctl restart nginx.service #sudo systemctl restart nginx.service
#sudo systemctl restart adb.service #sudo systemctl restart adb.service
#sudo systemctl restart crontask.service #sudo systemctl restart crontask.service
#sudo systemctl restart sshsvc.service #sudo systemctl restart sshsvc.service
#sudo systemctl restart captrace.service #sudo systemctl restart captrace.service
#sudo systemctl restart restagent.service #sudo systemctl restart omc.service

View File

@@ -9,7 +9,7 @@ rm libwiretap.so
rm libwsutil.so.13 rm libwsutil.so.13
rm libwsutil.so rm libwsutil.so
systemctl stop nginx.service systemctl stop nginx.service
systemctl stop restagent.service systemctl stop omc.service
systemctl stop crontask.service systemctl stop crontask.service
systemctl stop sshsvc.service systemctl stop sshsvc.service
systemctl stop captrace.service systemctl stop captrace.service
@@ -18,7 +18,7 @@ systemctl stop adb.service
#rm -rf /usr/local/omc #rm -rf /usr/local/omc
rm -rf /etc/nginx/conf.d/omc.conf rm -rf /etc/nginx/conf.d/omc.conf
systemctl disable restagent.service systemctl disable omc.service
systemctl disable crontask.service systemctl disable crontask.service
systemctl disable sshsvc.service systemctl disable sshsvc.service
systemctl disable captrace.service systemctl disable captrace.service

View File

@@ -3,19 +3,19 @@
# duration: rotation time with xx hours, example: 1/12/24 hours # duration: rotation time with xx hours, example: 1/12/24 hours
# count: rotation count of log, default is 30 rotation # count: rotation count of log, default is 30 rotation
logger: logger:
file: /usr/local/omc/log/restagent.log file: /usr/local/omc/log/omc.log
level: debug level: debug
duration: 24 duration: 24
count: 90 count: 90
# rest agent listen ipv4/v6 and port, support multiple routines # rest agent listen ipv4/v6 and port, support multiple routines
# ip: 0.0.0.0 or ::0, support IPv4/v6 # ip: 0.0.0.0 or ::0, support IPv4/v6
rest: rest:
- ipv4: 0.0.0.0 - ipv4: 0.0.0.0
ipv6: ipv6:
port: 3030 port: 3030
- ipv4: 0.0.0.0 - ipv4: 0.0.0.0
ipv6: ipv6:
port: 4443 port: 4443
schema: https schema: https
caFile: /usr/local/omc/etc/certs/rootca.crt caFile: /usr/local/omc/etc/certs/rootca.crt
@@ -23,9 +23,9 @@ rest:
keyFile: /usr/local/omc/etc/certs/tsa-omc_pri.key keyFile: /usr/local/omc/etc/certs/tsa-omc_pri.key
webServer: webServer:
enabled: true enabled: false
rootDir: /usr/local/omc/htdocs/front rootDir: /usr/local/omc/htdocs/front
listen: listen:
- addr: :8080 - addr: :8080
schema: http schema: http
- addr: :8443 - addr: :8443
@@ -96,7 +96,7 @@ omc:
frontTraceDir: /usr/local/omc/htdocs/front/trace frontTraceDir: /usr/local/omc/htdocs/front/trace
software: /usr/local/omc/software software: /usr/local/omc/software
license: /usr/local/omc/license license: /usr/local/omc/license
gtpUri: gtp:192.168.2.119:2152 gtpUri: gtp:192.168.2.119:2152
checkContentType: false checkContentType: false
testMode: false testMode: false
rbacMode: true rbacMode: true
@@ -104,8 +104,8 @@ omc:
# Alarm module setting # Alarm module setting
# Forward interface: # Forward interface:
# email/sms # email/sms
alarm: alarm:
forwardAlarm: true forwardAlarm: true
email: email:
smtp: smtp@xxx.com smtp: smtp@xxx.com
@@ -118,7 +118,7 @@ alarm:
accessKeySecret: xxx accessKeySecret: xxx
signName: XXX SMSC signName: XXX SMSC
templateCode: 1000 templateCode: 1000
#User authorized information #User authorized information
# crypt: mysql/md5/bcrypt # crypt: mysql/md5/bcrypt
# token: true/false to check accessToken # token: true/false to check accessToken
@@ -132,7 +132,7 @@ auth:
publicKey: /usr/local/omc/etc/certs/omc publicKey: /usr/local/omc/etc/certs/omc
privateKey: /usr/local/omc/etc/certs/omc privateKey: /usr/local/omc/etc/certs/omc
# Parameter for limit number # Parameter for limit number
# rmuid_maxnum: the max number of rmUID, default: 50 # rmuid_maxnum: the max number of rmUID, default: 50
# alarmid_maxnum: the max number of AlarmID, default: 50 # alarmid_maxnum: the max number of AlarmID, default: 50
# pmid_maxnum: the max number of pmID, default: 50 # pmid_maxnum: the max number of pmID, default: 50
@@ -149,4 +149,40 @@ params:
testConfig: testConfig:
enabled: true enabled: true
file: /usr/local/omc/etc/testconfig.yaml file: /usr/local/omc/etc/testconfig.yaml
# NMS-中国星网研究院
nmsCXY:
# 注入路由组
routerGroup: "/nms-cxy/api/rest"
# 专业编码2位 核心网HX 无线网WX
professionCode: "HX"
# 厂商编码2位 中信科ZX
vendorCode: "AG"
# OMC编号3位
omcCode: "001"
# 设备序列号
serialNumber: "1153492"
# Kafka配置
kafka:
addrs:
- "192.168.5.59:19092"
- "192.168.5.59:29092"
- "192.168.5.59:39092"
# 启用 Kerberos 认证
krb5:
enable: false
config:
configPath: "/path/to/krb5.conf"
keyTabPath: "/path/to/keytab"
serviceName: "kafka"
realm: "EXAMPLE.COM"
username: "client"
# OSS配置
oss:
bucketname: "omc-bucket"
endpoint: "192.168.5.59:9000"
useSSL: false
accessKeyID: "aOW0r1gfw74G88Z3XZJ6"
secretAccessKey: "9tDErvtCEuVox6LoQu5BOVtycQKcQjlXOGvjl1eD"

View File

@@ -16,7 +16,7 @@ fi
case "${extension}" in case "${extension}" in
deb) deb)
if [ ${neType} == "OMC" ]; then if [ ${neType} == "OMC" ]; then
systemctl stop restagent.service systemctl stop omc.service
fi fi
expect <<EOF > ${logFile} expect <<EOF > ${logFile}
spawn dpkg -i --force-all "$filename" spawn dpkg -i --force-all "$filename"
@@ -31,7 +31,7 @@ EOF
;; ;;
rpm) rpm)
if [ ${neType} == "OMC" ]; then if [ ${neType} == "OMC" ]; then
systemctl stop restagent.service systemctl stop omc.service
fi fi
expect <<EOF > ${logFile} expect <<EOF > ${logFile}
spawn rpm -Uvh "$filename" spawn rpm -Uvh "$filename"

View File

@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
process_name="restagent" process_name="omc"
if ! pgrep -x "$process_name" >/dev/null; then if ! pgrep -x "$process_name" >/dev/null; then
echo "$process_name is not running. Restarting..." echo "$process_name is not running. Restarting..."

View File

@@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
ProcList="restagent crontask sshsvc captrace adb" ProcList="omc crontask sshsvc captrace adb"
ProcListDesc="adb crontask sshsvc captrace restagent" ProcListDesc="adb crontask sshsvc captrace omc"
BinDir=/usr/local/omc/bin BinDir=/usr/local/omc/bin

View File

@@ -16,7 +16,7 @@ fi
case "${extension}" in case "${extension}" in
deb) deb)
if [ ${neType} == "OMC" ]; then if [ ${neType} == "OMC" ]; then
systemctl stop restagent.service systemctl stop omc.service
fi fi
expect <<EOF > ${logFile} expect <<EOF > ${logFile}
spawn dpkg -i --force-all "$filename" spawn dpkg -i --force-all "$filename"
@@ -31,7 +31,7 @@ EOF
;; ;;
rpm) rpm)
if [ ${neType} == "OMC" ]; then if [ ${neType} == "OMC" ]; then
systemctl stop restagent.service systemctl stop omc.service
fi fi
expect <<EOF > ${logFile} expect <<EOF > ${logFile}
spawn rpm -Uvh "$filename" spawn rpm -Uvh "$filename"

View File

@@ -51,7 +51,7 @@ chmod +rx ${RPM_BUILD_ROOT}/usr/lib64/*
#cp -rf omc/database ${RPM_BUILD_ROOT}/usr/local/omc/ #cp -rf omc/database ${RPM_BUILD_ROOT}/usr/local/omc/
#cp -rf db/* ${RPM_BUILD_ROOT}/usr/local/db/ #cp -rf db/* ${RPM_BUILD_ROOT}/usr/local/db/
#cp -f nginx/omc.conf ${RPM_BUILD_ROOT}/etc/nginx/conf.d/ #cp -f nginx/omc.conf ${RPM_BUILD_ROOT}/etc/nginx/conf.d/
#cp -f systemd/restagent.service ${RPM_BUILD_ROOT}/lib/systemd/system/restagent.service #cp -f systemd/omc.service ${RPM_BUILD_ROOT}/lib/systemd/system/omc.service
#cp -f systemd/crontask.service ${RPM_BUILD_ROOT}/lib/systemd/system/crontask.service #cp -f systemd/crontask.service ${RPM_BUILD_ROOT}/lib/systemd/system/crontask.service
#cp -f systemd/sshsvc.service ${RPM_BUILD_ROOT}/lib/systemd/system/sshsvc.service #cp -f systemd/sshsvc.service ${RPM_BUILD_ROOT}/lib/systemd/system/sshsvc.service
#cp -f systemd/captrace.service ${RPM_BUILD_ROOT}/lib/systemd/system/captrace.service #cp -f systemd/captrace.service ${RPM_BUILD_ROOT}/lib/systemd/system/captrace.service
@@ -110,12 +110,12 @@ if [ ! -e ${OmcDaemon} ]; then ln -s ${OmcBinDir}/omcsvc.sh ${OmcDaemon}; fi
sed -i 's/listen 80;/listen 1080;/g' ${NginxEtcDir}/nginx.conf sed -i 's/listen 80;/listen 1080;/g' ${NginxEtcDir}/nginx.conf
sed -i 's/listen \[::\]:80;/listen \[::\]:1080;/g' ${NginxEtcDir}/nginx.conf sed -i 's/listen \[::\]:80;/listen \[::\]:1080;/g' ${NginxEtcDir}/nginx.conf
systemctl daemon-reload systemctl daemon-reload
systemctl enable restagent.service systemctl enable omc.service
systemctl enable crontask.service systemctl enable crontask.service
systemctl enable sshsvc.service systemctl enable sshsvc.service
systemctl enable captrace.service systemctl enable captrace.service
systemctl enable adb.service systemctl enable adb.service
systemctl stop restagent.service systemctl stop omc.service
systemctl stop crontask.service systemctl stop crontask.service
systemctl stop sshsvc.service systemctl stop sshsvc.service
systemctl stop captrace.service systemctl stop captrace.service
@@ -126,7 +126,7 @@ systemctl start nginx.service
systemctl start captrace.service systemctl start captrace.service
systemctl start sshsvc.service systemctl start sshsvc.service
systemctl start crontask.service systemctl start crontask.service
systemctl start restagent.service systemctl start omc.service
# 卸载时执行 # 卸载时执行
%postun %postun
@@ -139,7 +139,7 @@ rm libwiretap.so
rm libwsutil.so.13 rm libwsutil.so.13
rm libwsutil.so rm libwsutil.so
if [ "$1" = "0" ] ; then if [ "$1" = "0" ] ; then
sudo systemctl stop restagent.service sudo systemctl stop omc.service
sudo systemctl stop crontask.service sudo systemctl stop crontask.service
sudo systemctl stop sshsvc.service sudo systemctl stop sshsvc.service
sudo systemctl stop captrace.service sudo systemctl stop captrace.service
@@ -147,7 +147,7 @@ sudo systemctl stop adb.service
sudo systemctl stop nginx.service sudo systemctl stop nginx.service
#rm -rf /usr/local/omc #rm -rf /usr/local/omc
rm -rf /etc/nginx/conf.d/omc.conf rm -rf /etc/nginx/conf.d/omc.conf
sudo systemctl disable restagent.service sudo systemctl disable omc.service
sudo systemctl disable crontask.service sudo systemctl disable crontask.service
sudo systemctl disable sshsvc.service sudo systemctl disable sshsvc.service
sudo systemctl disable captrace.service sudo systemctl disable captrace.service
@@ -156,7 +156,7 @@ sudo systemctl daemon-reload
else else
sudo systemctl daemon-reload sudo systemctl daemon-reload
sudo systemctl stop nginx.service sudo systemctl stop nginx.service
sudo systemctl stop restagent.service sudo systemctl stop omc.service
sudo systemctl stop crontask.service sudo systemctl stop crontask.service
sudo systemctl stop sshsvc.service sudo systemctl stop sshsvc.service
sudo systemctl stop captrace.service sudo systemctl stop captrace.service
@@ -166,7 +166,7 @@ sudo systemctl start adb.service
sudo systemctl start crontask.service sudo systemctl start crontask.service
sudo systemctl start sshsvc.service sudo systemctl start sshsvc.service
sudo systemctl start captrace.service sudo systemctl start captrace.service
sudo systemctl start restagent.service sudo systemctl start omc.service
fi fi
# 规定那些文件必须放入安装程序中,如果没有就报错 # 规定那些文件必须放入安装程序中,如果没有就报错
@@ -187,7 +187,7 @@ fi
/usr/local/omc/static /usr/local/omc/static
/usr/local/db /usr/local/db
/etc/nginx/conf.d/omc.conf /etc/nginx/conf.d/omc.conf
/lib/systemd/system/restagent.service /lib/systemd/system/omc.service
/lib/systemd/system/crontask.service /lib/systemd/system/crontask.service
/lib/systemd/system/sshsvc.service /lib/systemd/system/sshsvc.service
/lib/systemd/system/captrace.service /lib/systemd/system/captrace.service

View File

@@ -13,7 +13,7 @@ import (
"nms_cxy/lib/log" "nms_cxy/lib/log"
"nms_cxy/lib/oauth" "nms_cxy/lib/oauth"
"nms_cxy/lib/services" "nms_cxy/lib/services"
"nms_cxy/restagent/config" "nms_cxy/omc/config"
) )
var ( var (

View File

@@ -9,7 +9,7 @@ import (
"nms_cxy/lib/global" "nms_cxy/lib/global"
"nms_cxy/lib/log" "nms_cxy/lib/log"
"nms_cxy/lib/services" "nms_cxy/lib/services"
"nms_cxy/restagent/config" "nms_cxy/omc/config"
wsService "nms_cxy/src/modules/ws/service" wsService "nms_cxy/src/modules/ws/service"
) )

View File

@@ -12,7 +12,7 @@ import (
"nms_cxy/lib/dborm" "nms_cxy/lib/dborm"
"nms_cxy/lib/log" "nms_cxy/lib/log"
"nms_cxy/lib/services" "nms_cxy/lib/services"
"nms_cxy/restagent/config" "nms_cxy/omc/config"
"github.com/gorilla/mux" "github.com/gorilla/mux"
) )

View File

@@ -14,7 +14,7 @@ import (
"nms_cxy/lib/global" "nms_cxy/lib/global"
"nms_cxy/lib/log" "nms_cxy/lib/log"
"nms_cxy/lib/services" "nms_cxy/lib/services"
"nms_cxy/restagent/config" "nms_cxy/omc/config"
tokenConst "nms_cxy/src/framework/constants/token" tokenConst "nms_cxy/src/framework/constants/token"
neService "nms_cxy/src/modules/network_element/service" neService "nms_cxy/src/modules/network_element/service"

View File

@@ -7,7 +7,7 @@ import (
"nms_cxy/lib/global" "nms_cxy/lib/global"
"nms_cxy/lib/log" "nms_cxy/lib/log"
"nms_cxy/lib/services" "nms_cxy/lib/services"
"nms_cxy/restagent/config" "nms_cxy/omc/config"
"encoding/json" "encoding/json"
"fmt" "fmt"

View File

@@ -14,7 +14,7 @@ import (
"nms_cxy/lib/global" "nms_cxy/lib/global"
"nms_cxy/lib/log" "nms_cxy/lib/log"
"nms_cxy/lib/services" "nms_cxy/lib/services"
"nms_cxy/restagent/config" "nms_cxy/omc/config"
"github.com/gorilla/mux" "github.com/gorilla/mux"
) )

View File

@@ -14,7 +14,7 @@ import (
"nms_cxy/lib/dborm" "nms_cxy/lib/dborm"
"nms_cxy/lib/log" "nms_cxy/lib/log"
"nms_cxy/lib/services" "nms_cxy/lib/services"
"nms_cxy/restagent/config" "nms_cxy/omc/config"
_ "github.com/go-sql-driver/mysql" _ "github.com/go-sql-driver/mysql"
) )

View File

@@ -14,7 +14,7 @@ import (
"nms_cxy/lib/global" "nms_cxy/lib/global"
"nms_cxy/lib/log" "nms_cxy/lib/log"
"nms_cxy/lib/services" "nms_cxy/lib/services"
"nms_cxy/restagent/config" "nms_cxy/omc/config"
"github.com/gorilla/mux" "github.com/gorilla/mux"
"xorm.io/xorm" "xorm.io/xorm"

View File

@@ -10,7 +10,7 @@ import (
"nms_cxy/lib/file" "nms_cxy/lib/file"
"nms_cxy/lib/log" "nms_cxy/lib/log"
"nms_cxy/lib/services" "nms_cxy/lib/services"
"nms_cxy/restagent/config" "nms_cxy/omc/config"
"github.com/gorilla/mux" "github.com/gorilla/mux"
"github.com/shirou/gopsutil/disk" "github.com/shirou/gopsutil/disk"

View File

@@ -14,7 +14,7 @@ import (
"nms_cxy/lib/global" "nms_cxy/lib/global"
"nms_cxy/lib/log" "nms_cxy/lib/log"
"nms_cxy/lib/services" "nms_cxy/lib/services"
"nms_cxy/restagent/config" "nms_cxy/omc/config"
"nms_cxy/src/framework/utils/date" "nms_cxy/src/framework/utils/date"
neDataModel "nms_cxy/src/modules/network_data/model" neDataModel "nms_cxy/src/modules/network_data/model"
nmsCXYService "nms_cxy/src/modules/nms_cxy/service" nmsCXYService "nms_cxy/src/modules/nms_cxy/service"

View File

@@ -8,7 +8,7 @@ import (
"nms_cxy/lib/dborm" "nms_cxy/lib/dborm"
"nms_cxy/lib/log" "nms_cxy/lib/log"
"nms_cxy/restagent/config" "nms_cxy/omc/config"
"gopkg.in/gomail.v2" "gopkg.in/gomail.v2"
) )

View File

@@ -9,7 +9,7 @@ import (
"nms_cxy/lib/dborm" "nms_cxy/lib/dborm"
"nms_cxy/lib/log" "nms_cxy/lib/log"
"nms_cxy/restagent/config" "nms_cxy/omc/config"
"github.com/linxGnu/gosmpp" "github.com/linxGnu/gosmpp"
"github.com/linxGnu/gosmpp/data" "github.com/linxGnu/gosmpp/data"

View File

@@ -5,7 +5,7 @@ import (
"strings" "strings"
"nms_cxy/lib/log" "nms_cxy/lib/log"
"nms_cxy/restagent/config" "nms_cxy/omc/config"
"github.com/chzyer/readline" "github.com/chzyer/readline"
"github.com/go-gsm/ucp" "github.com/go-gsm/ucp"

View File

@@ -18,7 +18,7 @@ import (
"nms_cxy/lib/oauth" "nms_cxy/lib/oauth"
"nms_cxy/lib/services" "nms_cxy/lib/services"
"nms_cxy/lib/session" "nms_cxy/lib/session"
"nms_cxy/restagent/config" "nms_cxy/omc/config"
) )
var TodoList []stTodo var TodoList []stTodo
@@ -45,7 +45,7 @@ type ApiResponse struct {
ResultMessage interface{} ResultMessage interface{}
} }
var globalSession = session.NewSessManager("restagent") var globalSession = session.NewSessManager("omc")
func init() { func init() {
conf := config.GetYamlConfig() conf := config.GetYamlConfig()

View File

@@ -9,7 +9,7 @@ import (
"nms_cxy/lib/global" "nms_cxy/lib/global"
"nms_cxy/lib/log" "nms_cxy/lib/log"
"nms_cxy/lib/services" "nms_cxy/lib/services"
"nms_cxy/restagent/config" "nms_cxy/omc/config"
"github.com/gorilla/mux" "github.com/gorilla/mux"
"xorm.io/xorm" "xorm.io/xorm"

View File

@@ -14,7 +14,7 @@ import (
"nms_cxy/lib/dborm" "nms_cxy/lib/dborm"
"nms_cxy/lib/log" "nms_cxy/lib/log"
"nms_cxy/lib/services" "nms_cxy/lib/services"
"nms_cxy/restagent/config" "nms_cxy/omc/config"
"github.com/shirou/gopsutil/cpu" "github.com/shirou/gopsutil/cpu"
"github.com/shirou/gopsutil/disk" "github.com/shirou/gopsutil/disk"

View File

@@ -15,7 +15,7 @@ import (
"nms_cxy/lib/log" "nms_cxy/lib/log"
"nms_cxy/lib/mmlp" "nms_cxy/lib/mmlp"
"nms_cxy/lib/services" "nms_cxy/lib/services"
"nms_cxy/restagent/config" "nms_cxy/omc/config"
tokenConst "nms_cxy/src/framework/constants/token" tokenConst "nms_cxy/src/framework/constants/token"

View File

@@ -9,7 +9,7 @@ import (
"nms_cxy/lib/core/utils/ctx" "nms_cxy/lib/core/utils/ctx"
"nms_cxy/lib/dborm" "nms_cxy/lib/dborm"
"nms_cxy/lib/services" "nms_cxy/lib/services"
"nms_cxy/restagent/config" "nms_cxy/omc/config"
"github.com/shirou/gopsutil/disk" "github.com/shirou/gopsutil/disk"
"github.com/shirou/gopsutil/net" "github.com/shirou/gopsutil/net"

View File

@@ -8,7 +8,7 @@ import (
"nms_cxy/lib/dborm" "nms_cxy/lib/dborm"
"nms_cxy/lib/log" "nms_cxy/lib/log"
"nms_cxy/restagent/config" "nms_cxy/omc/config"
"github.com/robfig/cron/v3" "github.com/robfig/cron/v3"
"github.com/shirou/gopsutil/v3/cpu" "github.com/shirou/gopsutil/v3/cpu"

View File

@@ -10,7 +10,7 @@ import (
"nms_cxy/lib/log" "nms_cxy/lib/log"
"nms_cxy/lib/services" "nms_cxy/lib/services"
"nms_cxy/lib/wsinfo" "nms_cxy/lib/wsinfo"
"nms_cxy/restagent/config" "nms_cxy/omc/config"
"github.com/gorilla/websocket" "github.com/gorilla/websocket"
"github.com/shirou/gopsutil/process" "github.com/shirou/gopsutil/process"

View File

@@ -17,7 +17,7 @@ import (
"nms_cxy/lib/oauth" "nms_cxy/lib/oauth"
"nms_cxy/lib/services" "nms_cxy/lib/services"
"nms_cxy/lib/session" "nms_cxy/lib/session"
"nms_cxy/restagent/config" "nms_cxy/omc/config"
) )
type ErrorOAuthResponse struct { type ErrorOAuthResponse struct {
@@ -36,7 +36,7 @@ type ApiResponse struct {
ResultMessage interface{} ResultMessage interface{}
} }
var globalSession = session.NewSessManager("restagent") var globalSession = session.NewSessManager("omc")
var ( var (
MAX_RMUID_NUM int MAX_RMUID_NUM int

View File

@@ -11,7 +11,7 @@ import (
"nms_cxy/lib/log" "nms_cxy/lib/log"
"nms_cxy/lib/services" "nms_cxy/lib/services"
"nms_cxy/restagent/config" "nms_cxy/omc/config"
) )
func init() { func init() {

View File

@@ -14,7 +14,7 @@ import (
"nms_cxy/lib/global" "nms_cxy/lib/global"
"nms_cxy/lib/log" "nms_cxy/lib/log"
"nms_cxy/lib/services" "nms_cxy/lib/services"
"nms_cxy/restagent/config" "nms_cxy/omc/config"
"xorm.io/xorm" "xorm.io/xorm"

View File

@@ -22,7 +22,7 @@ import (
"nms_cxy/lib/log" "nms_cxy/lib/log"
"nms_cxy/lib/oauth" "nms_cxy/lib/oauth"
"nms_cxy/lib/services" "nms_cxy/lib/services"
"nms_cxy/restagent/config" "nms_cxy/omc/config"
srcConfig "nms_cxy/src/framework/config" srcConfig "nms_cxy/src/framework/config"
"nms_cxy/src/framework/i18n" "nms_cxy/src/framework/i18n"
"nms_cxy/src/framework/redis" "nms_cxy/src/framework/redis"

View File

@@ -10,7 +10,7 @@ import (
"nms_cxy/lib/log" "nms_cxy/lib/log"
"nms_cxy/lib/services" "nms_cxy/lib/services"
"nms_cxy/restagent/config" "nms_cxy/omc/config"
_ "github.com/go-sql-driver/mysql" _ "github.com/go-sql-driver/mysql"
) )

View File

@@ -18,7 +18,7 @@ import (
"nms_cxy/lib/global" "nms_cxy/lib/global"
"nms_cxy/lib/log" "nms_cxy/lib/log"
"nms_cxy/lib/services" "nms_cxy/lib/services"
"nms_cxy/restagent/config" "nms_cxy/omc/config"
tokenConst "nms_cxy/src/framework/constants/token" tokenConst "nms_cxy/src/framework/constants/token"
) )

View File

@@ -12,7 +12,7 @@ import (
"nms_cxy/lib/core/vo/result" "nms_cxy/lib/core/vo/result"
"nms_cxy/lib/midware" "nms_cxy/lib/midware"
"nms_cxy/lib/services" "nms_cxy/lib/services"
"nms_cxy/restagent/config" "nms_cxy/omc/config"
) )
// 参数配置信息接口添加到路由 // 参数配置信息接口添加到路由

View File

@@ -13,7 +13,7 @@ import (
"nms_cxy/lib/core/vo/result" "nms_cxy/lib/core/vo/result"
"nms_cxy/lib/midware" "nms_cxy/lib/midware"
"nms_cxy/lib/services" "nms_cxy/lib/services"
"nms_cxy/restagent/config" "nms_cxy/omc/config"
) )
// 字典类型对应的字典数据信息接口添加到路由 // 字典类型对应的字典数据信息接口添加到路由

View File

@@ -12,7 +12,7 @@ import (
"nms_cxy/lib/core/vo/result" "nms_cxy/lib/core/vo/result"
"nms_cxy/lib/midware" "nms_cxy/lib/midware"
"nms_cxy/lib/services" "nms_cxy/lib/services"
"nms_cxy/restagent/config" "nms_cxy/omc/config"
) )
// 字典类型信息接口添加到路由 // 字典类型信息接口添加到路由

View File

@@ -12,7 +12,7 @@ import (
"nms_cxy/lib/core/vo/result" "nms_cxy/lib/core/vo/result"
"nms_cxy/lib/midware" "nms_cxy/lib/midware"
"nms_cxy/lib/services" "nms_cxy/lib/services"
"nms_cxy/restagent/config" "nms_cxy/omc/config"
srcConfig "nms_cxy/src/framework/config" srcConfig "nms_cxy/src/framework/config"
) )

View File

@@ -13,7 +13,7 @@ import (
"nms_cxy/lib/core/vo/result" "nms_cxy/lib/core/vo/result"
"nms_cxy/lib/midware" "nms_cxy/lib/midware"
"nms_cxy/lib/services" "nms_cxy/lib/services"
"nms_cxy/restagent/config" "nms_cxy/omc/config"
) )
// 角色接口添加到路由 // 角色接口添加到路由

View File

@@ -14,7 +14,7 @@ import (
"nms_cxy/lib/core/vo/result" "nms_cxy/lib/core/vo/result"
"nms_cxy/lib/midware" "nms_cxy/lib/midware"
"nms_cxy/lib/services" "nms_cxy/lib/services"
"nms_cxy/restagent/config" "nms_cxy/omc/config"
srcConfig "nms_cxy/src/framework/config" srcConfig "nms_cxy/src/framework/config"
) )

View File

@@ -12,7 +12,7 @@ import (
"nms_cxy/lib/core/vo/result" "nms_cxy/lib/core/vo/result"
"nms_cxy/lib/dborm" "nms_cxy/lib/dborm"
"nms_cxy/lib/log" "nms_cxy/lib/log"
"nms_cxy/restagent/config" "nms_cxy/omc/config"
"nms_cxy/src/framework/utils/cmd" "nms_cxy/src/framework/utils/cmd"
"nms_cxy/src/framework/utils/ssh" "nms_cxy/src/framework/utils/ssh"
) )
@@ -218,7 +218,7 @@ func TcpdumpNeUPFTask(w http.ResponseWriter, r *http.Request) {
fileLogName := fmt.Sprintf("tmp_%s_%s.log", body.NeType, body.NeId) fileLogName := fmt.Sprintf("tmp_%s_%s.log", body.NeType, body.NeId)
filePcapName := fmt.Sprintf("tmp_%s_%s.pcap", body.NeType, body.NeId) filePcapName := fmt.Sprintf("tmp_%s_%s.pcap", body.NeType, body.NeId)
// 复制文件到网元上 // 复制文件到网元上
err := ssh.FileSCPLocalToNe(neInfo.Ip, "C:\\AMP\\Probject\\ems_backend\\restagent\\backup\\upf_pcap", "/tmp") err := ssh.FileSCPLocalToNe(neInfo.Ip, "C:\\AMP\\Probject\\ems_backend\\omc\\backup\\upf_pcap", "/tmp")
if err != nil { if err != nil {
ctx.JSON(w, 200, result.ErrMsg(err.Error())) ctx.JSON(w, 200, result.ErrMsg(err.Error()))
return return
@@ -245,7 +245,7 @@ func TcpdumpNeUPFTask(w http.ResponseWriter, r *http.Request) {
fileLogName := fmt.Sprintf("tmp_%s_%s.log", body.NeType, body.NeId) fileLogName := fmt.Sprintf("tmp_%s_%s.log", body.NeType, body.NeId)
filePcapName := fmt.Sprintf("tmp_%s_%s.pcap", body.NeType, body.NeId) filePcapName := fmt.Sprintf("tmp_%s_%s.pcap", body.NeType, body.NeId)
// cmdStr := "cd /tmp \nexpect /tmp/cat.sh " // cmdStr := "cd /tmp \nexpect /tmp/cat.sh "
err := ssh.FileSCPLocalToNe(neInfo.Ip, "C:\\AMP\\Probject\\ems_backend\\restagent\\backup\\upf_pcap", "/tmp") err := ssh.FileSCPLocalToNe(neInfo.Ip, "C:\\AMP\\Probject\\ems_backend\\omc\\backup\\upf_pcap", "/tmp")
if err != nil { if err != nil {
ctx.JSON(w, 200, result.ErrMsg(err.Error())) ctx.JSON(w, 200, result.ErrMsg(err.Error()))
return return

View File

@@ -17,7 +17,7 @@ import (
"nms_cxy/lib/log" "nms_cxy/lib/log"
"nms_cxy/lib/run" "nms_cxy/lib/run"
"nms_cxy/lib/services" "nms_cxy/lib/services"
"nms_cxy/restagent/config" "nms_cxy/omc/config"
) )
var ( var (

View File

@@ -17,7 +17,7 @@ import (
"nms_cxy/lib/log" "nms_cxy/lib/log"
"nms_cxy/lib/midware" "nms_cxy/lib/midware"
"nms_cxy/lib/services" "nms_cxy/lib/services"
"nms_cxy/restagent/config" "nms_cxy/omc/config"
"nms_cxy/src/framework/middleware/collectlogs" "nms_cxy/src/framework/middleware/collectlogs"
"nms_cxy/src/framework/utils/file" "nms_cxy/src/framework/utils/file"
"nms_cxy/src/framework/utils/ssh" "nms_cxy/src/framework/utils/ssh"

View File

@@ -12,7 +12,7 @@ import (
"nms_cxy/lib/global" "nms_cxy/lib/global"
"nms_cxy/lib/log" "nms_cxy/lib/log"
"nms_cxy/lib/services" "nms_cxy/lib/services"
"nms_cxy/restagent/config" "nms_cxy/omc/config"
tokenConst "nms_cxy/src/framework/constants/token" tokenConst "nms_cxy/src/framework/constants/token"
"github.com/go-resty/resty/v2" "github.com/go-resty/resty/v2"

View File

@@ -20,7 +20,7 @@ import (
"nms_cxy/lib/global" "nms_cxy/lib/global"
"nms_cxy/lib/log" "nms_cxy/lib/log"
"nms_cxy/lib/oauth" "nms_cxy/lib/oauth"
"nms_cxy/restagent/config" "nms_cxy/omc/config"
"github.com/gorilla/mux" "github.com/gorilla/mux"
) )

View File

@@ -13,7 +13,7 @@ import (
"nms_cxy/lib/log" "nms_cxy/lib/log"
"nms_cxy/lib/oauth" "nms_cxy/lib/oauth"
"nms_cxy/restagent/config" "nms_cxy/omc/config"
) )
// SessionMgr session manager // SessionMgr session manager

View File

@@ -323,7 +323,7 @@ func ReadTestConfigYaml(pfile string) (ret error) {
} }
func GetDefaultUserAgent() string { func GetDefaultUserAgent() string {
return "OMC-restagent/" + global.Version return "OMC/" + global.Version
} }
// const defaultConfigFile = "./etc/restconf.yaml" // const defaultConfigFile = "./etc/restconf.yaml"
@@ -337,7 +337,7 @@ func GetDefaultUserAgent() string {
// //global.GoVer = "go version go1.15.7 linux/arm64" // //global.GoVer = "go version go1.15.7 linux/arm64"
// flag.Parse() // flag.Parse()
// if *pv { // if *pv {
// fmt.Printf("OMC restagent version: %s\n%s\n%s\n\n", global.Version, global.BuildTime, global.GoVer) // fmt.Printf("OMC version: %s\n%s\n%s\n\n", global.Version, global.BuildTime, global.GoVer)
// os.Exit(0) // os.Exit(0)
// } // }
// if *ph { // if *ph {

View File

@@ -3,7 +3,7 @@
# duration: rotation time with xx hours, example: 1/12/24 hours # duration: rotation time with xx hours, example: 1/12/24 hours
# count: rotation count of log, default is 30 rotation # count: rotation count of log, default is 30 rotation
logger: logger:
file: d:/local.git/nms_cxy/restagent/log/restagent.log file: d:/local.git/nms_cxy/omc/log/omc.log
level: trace level: trace
duration: 24 duration: 24
count: 2 count: 2
@@ -45,7 +45,7 @@ database:
host: "192.168.5.59" host: "192.168.5.59"
port: 3306 port: 3306
name: omc_db_nms_cxy name: omc_db_nms_cxy
backup: d:/local.git/be.ems/restagent/database backup: d:/local.git/be.ems/omc/database
# Redis 缓存数据,数据源声明全小写 # Redis 缓存数据,数据源声明全小写
redis: redis:

View File

@@ -3,7 +3,7 @@
# duration: rotation time with xx hours, example: 1/12/24 hours # duration: rotation time with xx hours, example: 1/12/24 hours
# count: rotation count of log, default is 30 rotation # count: rotation count of log, default is 30 rotation
logger: logger:
file: d:/local.git/nms_cxy/restagent/log/restagent-t.log file: d:/local.git/nms_cxy/omc/log/omc-t.log
level: trace level: trace
duration: 24 duration: 24
count: 2 count: 2
@@ -25,7 +25,7 @@ database:
host: 127.0.0.1 host: 127.0.0.1
port: 33066 port: 33066
name: omc_db name: omc_db
backup: d:/local.git/nms_cxy/restagent/database backup: d:/local.git/nms_cxy/omc/database
# Redis 缓存数据,数据源声明全小写 # Redis 缓存数据,数据源声明全小写
redis: redis:

View File

@@ -3,7 +3,7 @@
PROJECT = OMC PROJECT = OMC
VERSION = 2.2403.1 VERSION = 2.2403.1
LIBDIR = nms_cxy/lib LIBDIR = nms_cxy/lib
BINNAME = restagent BINNAME = omc
.PHONY: build $(BINNAME) .PHONY: build $(BINNAME)
build $(BINNAME): build $(BINNAME):

View File

@@ -18,7 +18,7 @@ import (
"nms_cxy/lib/global" "nms_cxy/lib/global"
"nms_cxy/lib/log" "nms_cxy/lib/log"
"nms_cxy/lib/routes" "nms_cxy/lib/routes"
"nms_cxy/restagent/config" "nms_cxy/omc/config"
"nms_cxy/src" "nms_cxy/src"
"nms_cxy/src/framework/middleware" "nms_cxy/src/framework/middleware"
libSession "nms_cxy/src/lib_features/session" libSession "nms_cxy/src/lib_features/session"
@@ -144,10 +144,10 @@ func main() {
conf := config.GetYamlConfig() conf := config.GetYamlConfig()
log.InitLogger(conf.Logger.File, conf.Logger.Duration, conf.Logger.Count, "omc:restagent", config.GetLogLevel()) log.InitLogger(conf.Logger.File, conf.Logger.Duration, conf.Logger.Count, "omc", config.GetLogLevel())
fmt.Printf("OMC restagent version: %s\n", global.Version) fmt.Printf("OMC version: %s\n", global.Version)
log.Infof("========================= OMC restagent startup =========================") log.Infof("========================= OMC startup =========================")
log.Infof("OMC restagent version: %s %s %s", global.Version, global.BuildTime, global.GoVer) log.Infof("OMC version: %s %s %s", global.Version, global.BuildTime, global.GoVer)
err := dborm.InitDbClient(conf.Database.Type, conf.Database.User, conf.Database.Password, err := dborm.InitDbClient(conf.Database.Type, conf.Database.User, conf.Database.Password,
conf.Database.Host, conf.Database.Port, conf.Database.Name) conf.Database.Host, conf.Database.Port, conf.Database.Name)

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

View File

@@ -27,9 +27,9 @@ func InitConfig() {
func initFlag() { func initFlag() {
// --env prod // --env prod
pflag.String("env", "prod", "Specify Run Environment Configuration local or prod") pflag.String("env", "prod", "Specify Run Environment Configuration local or prod")
// --c /etc/restconf.yaml // --c /etc/omc.yaml
// -c /etc/restconf.yaml // -c /etc/omc.yaml
pConfig := pflag.StringP("config", "c", "./etc/restconf.yaml", "Specify Configuration File") pConfig := pflag.StringP("config", "c", "./etc/omc.yaml", "Specify Configuration File")
// --version // --version
// -V // -V
pVersion := pflag.BoolP("version", "V", false, "Output program version") pVersion := pflag.BoolP("version", "V", false, "Output program version")

View File

@@ -5,7 +5,7 @@ import (
"nms_cxy/lib/dborm" "nms_cxy/lib/dborm"
"nms_cxy/lib/oauth" "nms_cxy/lib/oauth"
libConfig "nms_cxy/restagent/config" libConfig "nms_cxy/omc/config"
"nms_cxy/src/framework/logger" "nms_cxy/src/framework/logger"
"nms_cxy/src/framework/redis" "nms_cxy/src/framework/redis"
) )

View File

@@ -5,14 +5,14 @@ import (
libConf "nms_cxy/lib/core/conf" libConf "nms_cxy/lib/core/conf"
libGlobal "nms_cxy/lib/global" libGlobal "nms_cxy/lib/global"
libConfig "nms_cxy/restagent/config" libConfig "nms_cxy/omc/config"
"github.com/spf13/viper" "github.com/spf13/viper"
) )
// BuildInfo 程序-V查看编译版本号信息 // BuildInfo 程序-V查看编译版本号信息
func BuildInfo() string { func BuildInfo() string {
return fmt.Sprintf("OMC restagent version: %s\n%s\n%s\n\n", libGlobal.Version, libGlobal.BuildTime, libGlobal.GoVer) return fmt.Sprintf("OMC version: %s\n%s\n%s\n\n", libGlobal.Version, libGlobal.BuildTime, libGlobal.GoVer)
} }
// ConfigRead 指定配置文件读取 // ConfigRead 指定配置文件读取

View File

@@ -1,5 +1,5 @@
# 外层 lib 和 features 粘合层 # 外层 lib 和 features 粘合层
- config.go 配置合并: restagent.yaml 文件内容,主要是数据库配置 - config.go 配置合并: omc.yaml 文件内容,主要是数据库配置
- account.go 登录会话生成 token - account.go 登录会话生成 token
- session.go 中间件方式设置请求头 token 值 - session.go 中间件方式设置请求头 token 值

View File

@@ -3,7 +3,7 @@ package session
import ( import (
"time" "time"
libConfig "nms_cxy/restagent/config" libConfig "nms_cxy/omc/config"
"nms_cxy/src/framework/redis" "nms_cxy/src/framework/redis"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"

View File

@@ -9,7 +9,7 @@ import (
"nms_cxy/lib/dborm" "nms_cxy/lib/dborm"
"nms_cxy/lib/global" "nms_cxy/lib/global"
"nms_cxy/lib/log" "nms_cxy/lib/log"
"nms_cxy/restagent/config" "nms_cxy/omc/config"
"nms_cxy/src/framework/cron" "nms_cxy/src/framework/cron"
) )

View File

@@ -12,7 +12,7 @@ import (
"nms_cxy/lib/dborm" "nms_cxy/lib/dborm"
"nms_cxy/lib/global" "nms_cxy/lib/global"
"nms_cxy/lib/log" "nms_cxy/lib/log"
"nms_cxy/restagent/config" "nms_cxy/omc/config"
"nms_cxy/src/framework/cron" "nms_cxy/src/framework/cron"
"github.com/go-resty/resty/v2" "github.com/go-resty/resty/v2"

View File

@@ -9,7 +9,7 @@ import (
"nms_cxy/lib/dborm" "nms_cxy/lib/dborm"
"nms_cxy/lib/log" "nms_cxy/lib/log"
"nms_cxy/restagent/config" "nms_cxy/omc/config"
"nms_cxy/src/framework/cron" "nms_cxy/src/framework/cron"
"github.com/go-resty/resty/v2" "github.com/go-resty/resty/v2"

View File

@@ -241,7 +241,7 @@ func (s *SystemController) RebootApp(c *gin.Context) {
return return
} }
_, err := cmd.ExecWithCheck("nohup", "sh", "-c", "sleep 2s && service restagent restart", "&") _, err := cmd.ExecWithCheck("nohup", "sh", "-c", "sleep 2s && service omc restart", "&")
if err != nil { if err != nil {
c.JSON(200, map[string]any{ c.JSON(200, map[string]any{
"requestId": body.RequestId, "requestId": body.RequestId,