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/
# 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
vendor

6
.vscode/launch.json vendored
View File

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

View File

@@ -25,15 +25,15 @@ replica-read-only no
```sh
# 安装 Go版本 1.21.6 后进入项目根目录
cd ./restagent
cd ./omc
# 下载依赖
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
go build -ldflags="-s -w" -o restagent
# 打包命名 omc
go build -ldflags="-s -w" -o omc
```
## 打包
@@ -43,5 +43,5 @@ go env -w GOOS=linux
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
ConfigSystemdDir=${EmsBEDir}/build/config/systemd
EmsFEVue3Dir=/home/agtuser/Docker/nginx/html/dist
RESTAGENT=restagent
RESTAGENT=omc
CRONTASK=crontask
SshSvcBin=sshsvc
CapTraceBin=captrace
@@ -41,7 +41,7 @@ Data2htmlBin=data2html
NBI_ALARM=nbi_alarm
NBI_AGENT=nbi_agent
AAAA_AGENT=4a_agent
RestagentDir=${EmsBEDir}/restagent
RestagentDir=${EmsBEDir}/omc
CrontaskDir=/usr/local/omc/bin
SshSvcDir=/usr/local/omc/bin
CapTraceDir=/usr/local/omc/bin
@@ -59,7 +59,7 @@ elif [[ ${RpmArch} =~ "aarch64" ]];then
RelArch=arm64
fi
ProcList="restagent"
ProcList="omc"
cd $EmsBEDir
for procName in $ProcList;do
cd $EmsBEDir/$procName
@@ -75,7 +75,7 @@ case "$1" in
rm -rf ${RpmFEBuildDir}/front/*
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 ${SshSvcDir}/sshsvc ${BuildOMCBinDir}
cp -rf ${CapTraceDir}/captrace ${BuildOMCBinDir}
@@ -132,7 +132,7 @@ case "$1" in
rm -rf ${DebFEBuildDir}/front/*
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 ${SshSvcDir}/sshsvc ${BuildOMCBinDir}
cp -rf ${CapTraceDir}/captrace ${BuildOMCBinDir}

View File

@@ -1,5 +1,5 @@
[Unit]
Description=REST agent daemon
Description=OMC Service daemon
After=network-online.target
[Service]
@@ -7,7 +7,7 @@ Type=simple
LimitNOFILE=65535
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
RestartPreventExitStatus=1
ExecReload=/bin/kill -HUP $MAINPID

View File

@@ -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: /usr/local/omc/log/restagent.log
file: /usr/local/omc/log/omc.log
level: debug
duration: 24
count: 90
@@ -109,3 +109,39 @@ params:
testConfig:
enabled: true
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,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: /usr/local/omc/log/restagent.log
file: /usr/local/omc/log/omc.log
level: debug
duration: 24
count: 90
@@ -26,7 +26,7 @@ rest:
keyFile: /usr/local/omc/etc/certs/omc-server.key
webServer:
enabled: true
enabled: false
rootDir: /usr/local/omc/htdocs/front
listen:
- addr: :80
@@ -86,8 +86,8 @@ ne:
scpdir: /tmp
licensedir: /usr/local/etc/{neType}/license
# backup etc list of IMS, does not contain spaces
etcListIMS: '{*.yaml,mmtel,vars.cfg}'
etcListDefault: '{*.yaml,*.conf,*.cfg}'
etcListIMS: "{*.yaml,mmtel,vars.cfg}"
etcListDefault: "{*.yaml,*.conf,*.cfg}"
# true/false to overwrite config file when dpkg ne software
dpkgOverwrite: false
# dpkg timeout (second)
@@ -172,3 +172,39 @@ params:
testConfig:
enabled: false
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]
Description=OMC rest agent daemon
Description=OMC Service daemon
After=network-online.target mysql.service
[Service]
@@ -7,7 +7,7 @@ Type=simple
LimitNOFILE=65535
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
RestartPreventExitStatus=SIGTERM SIGKILL
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 "* 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 sshsvc.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
fi
systemctl enable restagent.service
systemctl enable omc.service
systemctl enable crontask.service
systemctl enable sshsvc.service
systemctl enable captrace.service
systemctl enable adb.service
systemctl daemon-reload
sudo systemctl stop nginx.service
sudo systemctl stop restagent.service
sudo systemctl stop omc.service
sudo systemctl stop crontask.service
sudo systemctl stop sshsvc.service
sudo systemctl stop captrace.service
@@ -94,11 +94,11 @@ sudo systemctl start adb.service
sudo systemctl start crontask.service
sudo systemctl start sshsvc.service
sudo systemctl start captrace.service
sudo systemctl start restagent.service
sudo systemctl start omc.service
#sudo systemctl restart nginx.service
#sudo systemctl restart adb.service
#sudo systemctl restart crontask.service
#sudo systemctl restart sshsvc.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
systemctl stop nginx.service
systemctl stop restagent.service
systemctl stop omc.service
systemctl stop crontask.service
systemctl stop sshsvc.service
systemctl stop captrace.service
@@ -18,7 +18,7 @@ systemctl stop adb.service
#rm -rf /usr/local/omc
rm -rf /etc/nginx/conf.d/omc.conf
systemctl disable restagent.service
systemctl disable omc.service
systemctl disable crontask.service
systemctl disable sshsvc.service
systemctl disable captrace.service

View File

@@ -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: /usr/local/omc/log/restagent.log
file: /usr/local/omc/log/omc.log
level: debug
duration: 24
count: 90
@@ -23,7 +23,7 @@ rest:
keyFile: /usr/local/omc/etc/certs/tsa-omc_pri.key
webServer:
enabled: true
enabled: false
rootDir: /usr/local/omc/htdocs/front
listen:
- addr: :8080
@@ -150,3 +150,39 @@ params:
testConfig:
enabled: true
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 "* 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 sshsvc.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
fi
systemctl enable restagent.service
systemctl enable omc.service
systemctl enable crontask.service
systemctl enable sshsvc.service
systemctl enable captrace.service
systemctl enable adb.service
systemctl daemon-reload
sudo systemctl stop nginx.service
sudo systemctl stop restagent.service
sudo systemctl stop omc.service
sudo systemctl stop crontask.service
sudo systemctl stop sshsvc.service
sudo systemctl stop captrace.service
@@ -94,11 +94,11 @@ sudo systemctl start adb.service
sudo systemctl start crontask.service
sudo systemctl start sshsvc.service
sudo systemctl start captrace.service
sudo systemctl start restagent.service
sudo systemctl start omc.service
#sudo systemctl restart nginx.service
#sudo systemctl restart adb.service
#sudo systemctl restart crontask.service
#sudo systemctl restart sshsvc.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
systemctl stop nginx.service
systemctl stop restagent.service
systemctl stop omc.service
systemctl stop crontask.service
systemctl stop sshsvc.service
systemctl stop captrace.service
@@ -18,7 +18,7 @@ systemctl stop adb.service
#rm -rf /usr/local/omc
rm -rf /etc/nginx/conf.d/omc.conf
systemctl disable restagent.service
systemctl disable omc.service
systemctl disable crontask.service
systemctl disable sshsvc.service
systemctl disable captrace.service

View File

@@ -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: /usr/local/omc/log/restagent.log
file: /usr/local/omc/log/omc.log
level: debug
duration: 24
count: 90
@@ -23,7 +23,7 @@ rest:
keyFile: /usr/local/omc/etc/certs/tsa-omc_pri.key
webServer:
enabled: true
enabled: false
rootDir: /usr/local/omc/htdocs/front
listen:
- addr: :8080
@@ -150,3 +150,39 @@ params:
testConfig:
enabled: true
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
deb)
if [ ${neType} == "OMC" ]; then
systemctl stop restagent.service
systemctl stop omc.service
fi
expect <<EOF > ${logFile}
spawn dpkg -i --force-all "$filename"
@@ -31,7 +31,7 @@ EOF
;;
rpm)
if [ ${neType} == "OMC" ]; then
systemctl stop restagent.service
systemctl stop omc.service
fi
expect <<EOF > ${logFile}
spawn rpm -Uvh "$filename"

View File

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

View File

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

View File

@@ -16,7 +16,7 @@ fi
case "${extension}" in
deb)
if [ ${neType} == "OMC" ]; then
systemctl stop restagent.service
systemctl stop omc.service
fi
expect <<EOF > ${logFile}
spawn dpkg -i --force-all "$filename"
@@ -31,7 +31,7 @@ EOF
;;
rpm)
if [ ${neType} == "OMC" ]; then
systemctl stop restagent.service
systemctl stop omc.service
fi
expect <<EOF > ${logFile}
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 db/* ${RPM_BUILD_ROOT}/usr/local/db/
#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/sshsvc.service ${RPM_BUILD_ROOT}/lib/systemd/system/sshsvc.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
systemctl daemon-reload
systemctl enable restagent.service
systemctl enable omc.service
systemctl enable crontask.service
systemctl enable sshsvc.service
systemctl enable captrace.service
systemctl enable adb.service
systemctl stop restagent.service
systemctl stop omc.service
systemctl stop crontask.service
systemctl stop sshsvc.service
systemctl stop captrace.service
@@ -126,7 +126,7 @@ systemctl start nginx.service
systemctl start captrace.service
systemctl start sshsvc.service
systemctl start crontask.service
systemctl start restagent.service
systemctl start omc.service
# 卸载时执行
%postun
@@ -139,7 +139,7 @@ rm libwiretap.so
rm libwsutil.so.13
rm libwsutil.so
if [ "$1" = "0" ] ; then
sudo systemctl stop restagent.service
sudo systemctl stop omc.service
sudo systemctl stop crontask.service
sudo systemctl stop sshsvc.service
sudo systemctl stop captrace.service
@@ -147,7 +147,7 @@ sudo systemctl stop adb.service
sudo systemctl stop nginx.service
#rm -rf /usr/local/omc
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 sshsvc.service
sudo systemctl disable captrace.service
@@ -156,7 +156,7 @@ sudo systemctl daemon-reload
else
sudo systemctl daemon-reload
sudo systemctl stop nginx.service
sudo systemctl stop restagent.service
sudo systemctl stop omc.service
sudo systemctl stop crontask.service
sudo systemctl stop sshsvc.service
sudo systemctl stop captrace.service
@@ -166,7 +166,7 @@ sudo systemctl start adb.service
sudo systemctl start crontask.service
sudo systemctl start sshsvc.service
sudo systemctl start captrace.service
sudo systemctl start restagent.service
sudo systemctl start omc.service
fi
# 规定那些文件必须放入安装程序中,如果没有就报错
@@ -187,7 +187,7 @@ fi
/usr/local/omc/static
/usr/local/db
/etc/nginx/conf.d/omc.conf
/lib/systemd/system/restagent.service
/lib/systemd/system/omc.service
/lib/systemd/system/crontask.service
/lib/systemd/system/sshsvc.service
/lib/systemd/system/captrace.service

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -13,7 +13,7 @@ import (
"nms_cxy/lib/core/vo/result"
"nms_cxy/lib/midware"
"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/midware"
"nms_cxy/lib/services"
"nms_cxy/restagent/config"
"nms_cxy/omc/config"
srcConfig "nms_cxy/src/framework/config"
)

View File

@@ -12,7 +12,7 @@ import (
"nms_cxy/lib/core/vo/result"
"nms_cxy/lib/dborm"
"nms_cxy/lib/log"
"nms_cxy/restagent/config"
"nms_cxy/omc/config"
"nms_cxy/src/framework/utils/cmd"
"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)
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 {
ctx.JSON(w, 200, result.ErrMsg(err.Error()))
return
@@ -245,7 +245,7 @@ func TcpdumpNeUPFTask(w http.ResponseWriter, r *http.Request) {
fileLogName := fmt.Sprintf("tmp_%s_%s.log", body.NeType, body.NeId)
filePcapName := fmt.Sprintf("tmp_%s_%s.pcap", body.NeType, body.NeId)
// 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 {
ctx.JSON(w, 200, result.ErrMsg(err.Error()))
return

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -323,7 +323,7 @@ func ReadTestConfigYaml(pfile string) (ret error) {
}
func GetDefaultUserAgent() string {
return "OMC-restagent/" + global.Version
return "OMC/" + global.Version
}
// const defaultConfigFile = "./etc/restconf.yaml"
@@ -337,7 +337,7 @@ func GetDefaultUserAgent() string {
// //global.GoVer = "go version go1.15.7 linux/arm64"
// flag.Parse()
// 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)
// }
// if *ph {

View File

@@ -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/nms_cxy/restagent/log/restagent.log
file: d:/local.git/nms_cxy/omc/log/omc.log
level: trace
duration: 24
count: 2
@@ -45,7 +45,7 @@ database:
host: "192.168.5.59"
port: 3306
name: omc_db_nms_cxy
backup: d:/local.git/be.ems/restagent/database
backup: d:/local.git/be.ems/omc/database
# Redis 缓存数据,数据源声明全小写
redis:

View File

@@ -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/nms_cxy/restagent/log/restagent-t.log
file: d:/local.git/nms_cxy/omc/log/omc-t.log
level: trace
duration: 24
count: 2
@@ -25,7 +25,7 @@ database:
host: 127.0.0.1
port: 33066
name: omc_db
backup: d:/local.git/nms_cxy/restagent/database
backup: d:/local.git/nms_cxy/omc/database
# Redis 缓存数据,数据源声明全小写
redis:

View File

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

View File

@@ -18,7 +18,7 @@ import (
"nms_cxy/lib/global"
"nms_cxy/lib/log"
"nms_cxy/lib/routes"
"nms_cxy/restagent/config"
"nms_cxy/omc/config"
"nms_cxy/src"
"nms_cxy/src/framework/middleware"
libSession "nms_cxy/src/lib_features/session"
@@ -144,10 +144,10 @@ func main() {
conf := config.GetYamlConfig()
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 =========================")
log.Infof("OMC restagent version: %s %s %s", global.Version, global.BuildTime, global.GoVer)
log.InitLogger(conf.Logger.File, conf.Logger.Duration, conf.Logger.Count, "omc", config.GetLogLevel())
fmt.Printf("OMC version: %s\n", global.Version)
log.Infof("========================= OMC startup =========================")
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,
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() {
// --env prod
pflag.String("env", "prod", "Specify Run Environment Configuration local or prod")
// --c /etc/restconf.yaml
// -c /etc/restconf.yaml
pConfig := pflag.StringP("config", "c", "./etc/restconf.yaml", "Specify Configuration File")
// --c /etc/omc.yaml
// -c /etc/omc.yaml
pConfig := pflag.StringP("config", "c", "./etc/omc.yaml", "Specify Configuration File")
// --version
// -V
pVersion := pflag.BoolP("version", "V", false, "Output program version")

View File

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

View File

@@ -5,14 +5,14 @@ import (
libConf "nms_cxy/lib/core/conf"
libGlobal "nms_cxy/lib/global"
libConfig "nms_cxy/restagent/config"
libConfig "nms_cxy/omc/config"
"github.com/spf13/viper"
)
// BuildInfo 程序-V查看编译版本号信息
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 指定配置文件读取

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -241,7 +241,7 @@ func (s *SystemController) RebootApp(c *gin.Context) {
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 {
c.JSON(200, map[string]any{
"requestId": body.RequestId,