diff --git a/.gitignore b/.gitignore index 7206e22..59787aa 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/.vscode/launch.json b/.vscode/launch.json index 3ce5d98..9615621 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -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" }, { diff --git a/README.md b/README.md index f50a3ca..1f2569a 100644 --- a/README.md +++ b/README.md @@ -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`'" ``` diff --git a/build.sh b/build.sh index bb698d8..eba3871 100644 --- a/build.sh +++ b/build.sh @@ -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} diff --git a/build/build/lib/systemd/system/restagent.service b/build/build/lib/systemd/system/omc.service similarity index 66% rename from build/build/lib/systemd/system/restagent.service rename to build/build/lib/systemd/system/omc.service index c44fe65..c4cc4d5 100644 --- a/build/build/lib/systemd/system/restagent.service +++ b/build/build/lib/systemd/system/omc.service @@ -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 diff --git a/build/build/usr/local/omc/etc/default/restconf.yaml b/build/build/usr/local/omc/etc/default/omc.yaml similarity index 68% rename from build/build/usr/local/omc/etc/default/restconf.yaml rename to build/build/usr/local/omc/etc/default/omc.yaml index a758e11..92ca327 100644 --- a/build/build/usr/local/omc/etc/default/restconf.yaml +++ b/build/build/usr/local/omc/etc/default/omc.yaml @@ -3,18 +3,18 @@ # 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 + count: 90 # rest agent listen ipv4/v6 and port, support multiple routines # ip: 0.0.0.0 or ::0, support IPv4/v6 rest: - ipv4: 0.0.0.0 - ipv6: + ipv6: port: 3030 - - ipv4: + - ipv4: ipv6: ::0 port: 6060 @@ -58,15 +58,15 @@ omc: frontUpload: /usr/local/omc/htdocs/front/upload software: /usr/local/omc/software license: /usr/local/omc/license - gtpUri: gtp:192.168.2.119:2152 + gtpUri: gtp:192.168.2.119:2152 checkContentType: false testMode: true rbacMode: true # Alarm module setting # Forward interface: -# email/sms -alarm: +# email/sms +alarm: forwardAlarm: true email: smtp: smtp@ruijie.com.cn @@ -79,7 +79,7 @@ alarm: accessKeySecret: xxxx signName: Ruijie SMSC templateCode: 1000 - + #User authorized information # crypt: mysql/md5/bcrypt # token: true/false to check accessToken @@ -91,7 +91,7 @@ auth: expires: 1800 session: multiple -# Parameter for limit number +# Parameter for limit number # rmuid_maxnum: the max number of rmUID, default: 50 # alarmid_maxnum: the max number of AlarmID, default: 50 # pmid_maxnum: the max number of pmID, default: 50 @@ -108,4 +108,40 @@ params: testConfig: enabled: true - file: /usr/local/omc/etc/testconfig.yaml \ No newline at end of file + 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" diff --git a/build/config/etc/default/restconf.yaml b/build/config/etc/default/omc.yaml similarity index 75% rename from build/config/etc/default/restconf.yaml rename to build/config/etc/default/omc.yaml index 132da7b..28eccaf 100644 --- a/build/config/etc/default/restconf.yaml +++ b/build/config/etc/default/omc.yaml @@ -3,21 +3,21 @@ # 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 + count: 90 # 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, +# clientAuthType: 0:NoClientCert (default), 1:RequestClientCert, 2:RequireAnyClientCert, # 3:VerifyClientCertIfGiven, 4:RequireAndVerifyClientCerts rest: - ipv4: 0.0.0.0 - ipv6: + ipv6: port: 33030 - ipv4: 0.0.0.0 - ipv6: + ipv6: port: 33443 schema: https clientAuthType: 0 @@ -26,9 +26,9 @@ rest: keyFile: /usr/local/omc/etc/certs/omc-server.key webServer: - enabled: true + enabled: false rootDir: /usr/local/omc/htdocs/front - listen: + listen: - addr: :80 schema: http - addr: :443 @@ -86,9 +86,9 @@ 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}' - # true/false to overwrite config file when dpkg ne software + 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 @@ -114,7 +114,7 @@ omc: frontTraceDir: /usr/local/omc/htdocs/front/trace software: /usr/local/omc/software license: /usr/local/omc/license - gtpUri: gtp:192.168.2.119:2152 + gtpUri: gtp:192.168.2.119:2152 checkContentType: false testMode: false rbacMode: true @@ -123,8 +123,8 @@ omc: # Alarm module setting # Forward interface: -# email/sms -alarm: +# email/sms +alarm: forwardAlarm: true email: smtp: smtp.xxx.com @@ -132,14 +132,14 @@ alarm: user: smtpuser@xxx.com password: xxxxxx # TLS skip verify: true/false - tlsSkipVerify: true + tlsSkipVerify: true sms: apiURL: http://smsc.xxx.com accessKeyID: xxx accessKeySecret: xxx signName: XXX SMSC templateCode: 1000 - + # User authorized information # crypt: mysql/md5/bcrypt # token: true/false to check accessToken @@ -154,7 +154,7 @@ auth: publicKey: /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 # alarmid_maxnum: the max number of AlarmID, default: 50 # pmid_maxnum: the max number of pmID, default: 50 @@ -171,4 +171,40 @@ params: testConfig: enabled: false - file: /usr/local/omc/etc/testconfig.yaml \ No newline at end of file + 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" diff --git a/build/config/systemd/restagent.service b/build/config/systemd/omc.service similarity index 68% rename from build/config/systemd/restagent.service rename to build/config/systemd/omc.service index b461745..6945ba9 100644 --- a/build/config/systemd/restagent.service +++ b/build/config/systemd/omc.service @@ -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 diff --git a/build/debbuild/22.04/DEBIAN/postinst b/build/debbuild/22.04/DEBIAN/postinst index 8c6db06..c2c9573 100644 --- a/build/debbuild/22.04/DEBIAN/postinst +++ b/build/debbuild/22.04/DEBIAN/postinst @@ -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 diff --git a/build/debbuild/22.04/DEBIAN/postrm b/build/debbuild/22.04/DEBIAN/postrm index f27c0d5..4ed7e3b 100644 --- a/build/debbuild/22.04/DEBIAN/postrm +++ b/build/debbuild/22.04/DEBIAN/postrm @@ -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 diff --git a/build/debbuild/22.04/usr/local/omc/etc/default/restconf.yaml b/build/debbuild/22.04/usr/local/omc/etc/default/omc.yaml similarity index 76% rename from build/debbuild/22.04/usr/local/omc/etc/default/restconf.yaml rename to build/debbuild/22.04/usr/local/omc/etc/default/omc.yaml index 8adf264..287299c 100644 --- a/build/debbuild/22.04/usr/local/omc/etc/default/restconf.yaml +++ b/build/debbuild/22.04/usr/local/omc/etc/default/omc.yaml @@ -3,19 +3,19 @@ # 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 + count: 90 # rest agent listen ipv4/v6 and port, support multiple routines # ip: 0.0.0.0 or ::0, support IPv4/v6 rest: - ipv4: 0.0.0.0 - ipv6: + ipv6: port: 3030 - ipv4: 0.0.0.0 - ipv6: + ipv6: port: 4443 schema: https caFile: /usr/local/omc/etc/certs/rootca.crt @@ -23,9 +23,9 @@ rest: keyFile: /usr/local/omc/etc/certs/tsa-omc_pri.key webServer: - enabled: true + enabled: false rootDir: /usr/local/omc/htdocs/front - listen: + listen: - addr: :8080 schema: http - addr: :8443 @@ -96,7 +96,7 @@ omc: frontTraceDir: /usr/local/omc/htdocs/front/trace software: /usr/local/omc/software license: /usr/local/omc/license - gtpUri: gtp:192.168.2.119:2152 + gtpUri: gtp:192.168.2.119:2152 checkContentType: false testMode: false rbacMode: true @@ -104,8 +104,8 @@ omc: # Alarm module setting # Forward interface: -# email/sms -alarm: +# email/sms +alarm: forwardAlarm: true email: smtp: smtp@xxx.com @@ -118,7 +118,7 @@ alarm: accessKeySecret: xxx signName: XXX SMSC templateCode: 1000 - + #User authorized information # crypt: mysql/md5/bcrypt # token: true/false to check accessToken @@ -132,7 +132,7 @@ auth: publicKey: /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 # alarmid_maxnum: the max number of AlarmID, default: 50 # pmid_maxnum: the max number of pmID, default: 50 @@ -149,4 +149,40 @@ params: testConfig: enabled: true - file: /usr/local/omc/etc/testconfig.yaml \ No newline at end of file + 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" diff --git a/build/debbuild/DEBIAN/postinst b/build/debbuild/DEBIAN/postinst index 7241552..40d056e 100644 --- a/build/debbuild/DEBIAN/postinst +++ b/build/debbuild/DEBIAN/postinst @@ -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 diff --git a/build/debbuild/DEBIAN/postrm b/build/debbuild/DEBIAN/postrm index f27c0d5..4ed7e3b 100644 --- a/build/debbuild/DEBIAN/postrm +++ b/build/debbuild/DEBIAN/postrm @@ -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 diff --git a/build/debbuild/usr/local/omc/etc/default/restconf.yaml b/build/debbuild/usr/local/omc/etc/default/omc.yaml similarity index 76% rename from build/debbuild/usr/local/omc/etc/default/restconf.yaml rename to build/debbuild/usr/local/omc/etc/default/omc.yaml index 8adf264..287299c 100644 --- a/build/debbuild/usr/local/omc/etc/default/restconf.yaml +++ b/build/debbuild/usr/local/omc/etc/default/omc.yaml @@ -3,19 +3,19 @@ # 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 + count: 90 # rest agent listen ipv4/v6 and port, support multiple routines # ip: 0.0.0.0 or ::0, support IPv4/v6 rest: - ipv4: 0.0.0.0 - ipv6: + ipv6: port: 3030 - ipv4: 0.0.0.0 - ipv6: + ipv6: port: 4443 schema: https caFile: /usr/local/omc/etc/certs/rootca.crt @@ -23,9 +23,9 @@ rest: keyFile: /usr/local/omc/etc/certs/tsa-omc_pri.key webServer: - enabled: true + enabled: false rootDir: /usr/local/omc/htdocs/front - listen: + listen: - addr: :8080 schema: http - addr: :8443 @@ -96,7 +96,7 @@ omc: frontTraceDir: /usr/local/omc/htdocs/front/trace software: /usr/local/omc/software license: /usr/local/omc/license - gtpUri: gtp:192.168.2.119:2152 + gtpUri: gtp:192.168.2.119:2152 checkContentType: false testMode: false rbacMode: true @@ -104,8 +104,8 @@ omc: # Alarm module setting # Forward interface: -# email/sms -alarm: +# email/sms +alarm: forwardAlarm: true email: smtp: smtp@xxx.com @@ -118,7 +118,7 @@ alarm: accessKeySecret: xxx signName: XXX SMSC templateCode: 1000 - + #User authorized information # crypt: mysql/md5/bcrypt # token: true/false to check accessToken @@ -132,7 +132,7 @@ auth: publicKey: /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 # alarmid_maxnum: the max number of AlarmID, default: 50 # pmid_maxnum: the max number of pmID, default: 50 @@ -149,4 +149,40 @@ params: testConfig: enabled: true - file: /usr/local/omc/etc/testconfig.yaml \ No newline at end of file + 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" diff --git a/build/misc/actpkg.sh b/build/misc/actpkg.sh index b69e3a7..8689c0f 100644 --- a/build/misc/actpkg.sh +++ b/build/misc/actpkg.sh @@ -16,7 +16,7 @@ fi case "${extension}" in deb) if [ ${neType} == "OMC" ]; then - systemctl stop restagent.service + systemctl stop omc.service fi expect < ${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 < ${logFile} spawn rpm -Uvh "$filename" diff --git a/build/misc/checkproc.sh b/build/misc/checkproc.sh index 7050999..41585b1 100644 --- a/build/misc/checkproc.sh +++ b/build/misc/checkproc.sh @@ -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..." diff --git a/build/misc/omcsvc.sh b/build/misc/omcsvc.sh index 9f99581..3acd1cd 100644 --- a/build/misc/omcsvc.sh +++ b/build/misc/omcsvc.sh @@ -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 diff --git a/build/misc/rbkpkg.sh b/build/misc/rbkpkg.sh index f8e3803..137be1a 100644 --- a/build/misc/rbkpkg.sh +++ b/build/misc/rbkpkg.sh @@ -16,7 +16,7 @@ fi case "${extension}" in deb) if [ ${neType} == "OMC" ]; then - systemctl stop restagent.service + systemctl stop omc.service fi expect < ${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 < ${logFile} spawn rpm -Uvh "$filename" diff --git a/build/rpmbuild/SPECS/omc.spec b/build/rpmbuild/SPECS/omc.spec index 0e67b59..ee093f7 100644 --- a/build/rpmbuild/SPECS/omc.spec +++ b/build/rpmbuild/SPECS/omc.spec @@ -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 diff --git a/features/aaaa/aaaa.go b/features/aaaa/aaaa.go index f1e445d..9476bf3 100644 --- a/features/aaaa/aaaa.go +++ b/features/aaaa/aaaa.go @@ -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 ( diff --git a/features/cdr/cdrevent.go b/features/cdr/cdrevent.go index b341e5a..de4f6af 100644 --- a/features/cdr/cdrevent.go +++ b/features/cdr/cdrevent.go @@ -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" ) diff --git a/features/cm/license.go b/features/cm/license.go index ef93df0..e2935d7 100644 --- a/features/cm/license.go +++ b/features/cm/license.go @@ -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" ) diff --git a/features/cm/ne.go b/features/cm/ne.go index c2f7282..4adb24d 100644 --- a/features/cm/ne.go +++ b/features/cm/ne.go @@ -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" diff --git a/features/cm/param.go b/features/cm/param.go index 1fcf696..4cb84ab 100644 --- a/features/cm/param.go +++ b/features/cm/param.go @@ -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" diff --git a/features/cm/software.go b/features/cm/software.go index 1f2d65e..ad8d776 100644 --- a/features/cm/software.go +++ b/features/cm/software.go @@ -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" ) diff --git a/features/dbrest/backup.go b/features/dbrest/backup.go index 28b6d31..339d99f 100644 --- a/features/dbrest/backup.go +++ b/features/dbrest/backup.go @@ -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" ) diff --git a/features/dbrest/dbrest.go b/features/dbrest/dbrest.go index 152b93e..c03f9b0 100644 --- a/features/dbrest/dbrest.go +++ b/features/dbrest/dbrest.go @@ -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" diff --git a/features/file/file.go b/features/file/file.go index dd93f48..8f65f8a 100644 --- a/features/file/file.go +++ b/features/file/file.go @@ -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" diff --git a/features/fm/alarm.go b/features/fm/alarm.go index 07bb125..43ae414 100644 --- a/features/fm/alarm.go +++ b/features/fm/alarm.go @@ -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" diff --git a/features/fm/email.go b/features/fm/email.go index d221f25..47ae909 100644 --- a/features/fm/email.go +++ b/features/fm/email.go @@ -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" ) diff --git a/features/fm/smsforward.go b/features/fm/smsforward.go index 10d26e7..8e277ad 100644 --- a/features/fm/smsforward.go +++ b/features/fm/smsforward.go @@ -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" diff --git a/features/fm/ucpcli.go b/features/fm/ucpcli.go index 3cd64ea..9e34a86 100644 --- a/features/fm/ucpcli.go +++ b/features/fm/ucpcli.go @@ -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" diff --git a/features/handle/handle.go b/features/handle/handle.go index 145ce3e..eb3bcf3 100644 --- a/features/handle/handle.go +++ b/features/handle/handle.go @@ -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() diff --git a/features/lm/logbak.go b/features/lm/logbak.go index 6fdd418..77ea3c4 100644 --- a/features/lm/logbak.go +++ b/features/lm/logbak.go @@ -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" diff --git a/features/maintenance/maintenance.go b/features/maintenance/maintenance.go index 08bc17e..ff83490 100644 --- a/features/maintenance/maintenance.go +++ b/features/maintenance/maintenance.go @@ -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" diff --git a/features/mml/mml.go b/features/mml/mml.go index 439544c..75f6498 100644 --- a/features/mml/mml.go +++ b/features/mml/mml.go @@ -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" diff --git a/features/monitor/monitor/monitor.go b/features/monitor/monitor/monitor.go index bcd7f3e..e151763 100644 --- a/features/monitor/monitor/monitor.go +++ b/features/monitor/monitor/monitor.go @@ -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" diff --git a/features/monitor/monitor/task.go b/features/monitor/monitor/task.go index d471236..d6c7a93 100644 --- a/features/monitor/monitor/task.go +++ b/features/monitor/monitor/task.go @@ -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" diff --git a/features/monitor/psnet/psnet.go b/features/monitor/psnet/psnet.go index cd5719e..a43bf9d 100644 --- a/features/monitor/psnet/psnet.go +++ b/features/monitor/psnet/psnet.go @@ -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" diff --git a/features/nbi/nbi.go b/features/nbi/nbi.go index 43bc5bf..645b542 100644 --- a/features/nbi/nbi.go +++ b/features/nbi/nbi.go @@ -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 diff --git a/features/nbi/snmp.go b/features/nbi/snmp.go index d47747f..58c3d88 100644 --- a/features/nbi/snmp.go +++ b/features/nbi/snmp.go @@ -11,7 +11,7 @@ import ( "nms_cxy/lib/log" "nms_cxy/lib/services" - "nms_cxy/restagent/config" + "nms_cxy/omc/config" ) func init() { diff --git a/features/pm/performance.go b/features/pm/performance.go index 0634f54..bf2484e 100644 --- a/features/pm/performance.go +++ b/features/pm/performance.go @@ -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" diff --git a/features/security/account.go b/features/security/account.go index ed6ef26..165c386 100644 --- a/features/security/account.go +++ b/features/security/account.go @@ -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" diff --git a/features/sm/backup.go b/features/sm/backup.go index 9673819..4e1dc45 100644 --- a/features/sm/backup.go +++ b/features/sm/backup.go @@ -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" ) diff --git a/features/state/getstate.go b/features/state/getstate.go index 9499b74..d8222a1 100644 --- a/features/state/getstate.go +++ b/features/state/getstate.go @@ -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" ) diff --git a/features/sys_config/api_sys_config.go b/features/sys_config/api_sys_config.go index 866121f..e62bde1 100644 --- a/features/sys_config/api_sys_config.go +++ b/features/sys_config/api_sys_config.go @@ -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" ) // 参数配置信息接口添加到路由 diff --git a/features/sys_dict_data/api_sys_dict_data.go b/features/sys_dict_data/api_sys_dict_data.go index 6f61196..ec81b6f 100644 --- a/features/sys_dict_data/api_sys_dict_data.go +++ b/features/sys_dict_data/api_sys_dict_data.go @@ -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" ) // 字典类型对应的字典数据信息接口添加到路由 diff --git a/features/sys_dict_type/api_sys_dict_type.go b/features/sys_dict_type/api_sys_dict_type.go index bd34294..e78d541 100644 --- a/features/sys_dict_type/api_sys_dict_type.go +++ b/features/sys_dict_type/api_sys_dict_type.go @@ -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" ) // 字典类型信息接口添加到路由 diff --git a/features/sys_menu/api_sys_menu.go b/features/sys_menu/api_sys_menu.go index c8a74ea..ec802af 100644 --- a/features/sys_menu/api_sys_menu.go +++ b/features/sys_menu/api_sys_menu.go @@ -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" ) diff --git a/features/sys_role/api_sys_role.go b/features/sys_role/api_sys_role.go index 9caefeb..01061a5 100644 --- a/features/sys_role/api_sys_role.go +++ b/features/sys_role/api_sys_role.go @@ -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" ) // 角色接口添加到路由 diff --git a/features/sys_user/api_sys_user.go b/features/sys_user/api_sys_user.go index 8de0f1f..7432db2 100644 --- a/features/sys_user/api_sys_user.go +++ b/features/sys_user/api_sys_user.go @@ -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" ) diff --git a/features/trace/tcpdump.go b/features/trace/tcpdump.go index df4b9fd..fb9ed08 100644 --- a/features/trace/tcpdump.go +++ b/features/trace/tcpdump.go @@ -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 diff --git a/features/trace/trace.go b/features/trace/trace.go index c670a79..f07f21f 100644 --- a/features/trace/trace.go +++ b/features/trace/trace.go @@ -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 ( diff --git a/features/udm_user/api_udm_user.go b/features/udm_user/api_udm_user.go index 8bc1221..959ecbe 100644 --- a/features/udm_user/api_udm_user.go +++ b/features/udm_user/api_udm_user.go @@ -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" diff --git a/features/ue/ue.go b/features/ue/ue.go index 9b498a4..e92db2e 100644 --- a/features/ue/ue.go +++ b/features/ue/ue.go @@ -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" diff --git a/lib/services/services.go b/lib/services/services.go index 2d75beb..79eedae 100644 --- a/lib/services/services.go +++ b/lib/services/services.go @@ -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" ) diff --git a/lib/session/session.go b/lib/session/session.go index 831dbf2..86e438b 100644 --- a/lib/session/session.go +++ b/lib/session/session.go @@ -13,7 +13,7 @@ import ( "nms_cxy/lib/log" "nms_cxy/lib/oauth" - "nms_cxy/restagent/config" + "nms_cxy/omc/config" ) // SessionMgr session manager diff --git a/restagent/config/config.go b/omc/config/config.go similarity index 98% rename from restagent/config/config.go rename to omc/config/config.go index 5ae5e8a..3abb5f0 100644 --- a/restagent/config/config.go +++ b/omc/config/config.go @@ -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 { diff --git a/restagent/config/map.go b/omc/config/map.go similarity index 100% rename from restagent/config/map.go rename to omc/config/map.go diff --git a/restagent/etc/certs/ca.crt b/omc/etc/certs/ca.crt similarity index 100% rename from restagent/etc/certs/ca.crt rename to omc/etc/certs/ca.crt diff --git a/restagent/etc/certs/omc-ca.crt b/omc/etc/certs/omc-ca.crt similarity index 100% rename from restagent/etc/certs/omc-ca.crt rename to omc/etc/certs/omc-ca.crt diff --git a/restagent/etc/certs/omc-server.crt b/omc/etc/certs/omc-server.crt similarity index 100% rename from restagent/etc/certs/omc-server.crt rename to omc/etc/certs/omc-server.crt diff --git a/restagent/etc/certs/omc-server.key b/omc/etc/certs/omc-server.key similarity index 100% rename from restagent/etc/certs/omc-server.key rename to omc/etc/certs/omc-server.key diff --git a/restagent/etc/certs/omc-web.crt b/omc/etc/certs/omc-web.crt similarity index 100% rename from restagent/etc/certs/omc-web.crt rename to omc/etc/certs/omc-web.crt diff --git a/restagent/etc/certs/omc-web.key b/omc/etc/certs/omc-web.key similarity index 100% rename from restagent/etc/certs/omc-web.key rename to omc/etc/certs/omc-web.key diff --git a/restagent/etc/restconf.yaml b/omc/etc/omc.yaml similarity index 97% rename from restagent/etc/restconf.yaml rename to omc/etc/omc.yaml index e5d6476..f98167b 100644 --- a/restagent/etc/restconf.yaml +++ b/omc/etc/omc.yaml @@ -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: diff --git a/restagent/etc/restconf-t.yaml b/omc/etc/restconf-t.yaml similarity index 96% rename from restagent/etc/restconf-t.yaml rename to omc/etc/restconf-t.yaml index 31f0387..0d69e8c 100644 --- a/restagent/etc/restconf-t.yaml +++ b/omc/etc/restconf-t.yaml @@ -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: diff --git a/restagent/etc/testconfig.yaml b/omc/etc/testconfig.yaml similarity index 100% rename from restagent/etc/testconfig.yaml rename to omc/etc/testconfig.yaml diff --git a/restagent/makefile b/omc/makefile similarity index 94% rename from restagent/makefile rename to omc/makefile index 132195a..3ce0c1d 100644 --- a/restagent/makefile +++ b/omc/makefile @@ -3,7 +3,7 @@ PROJECT = OMC VERSION = 2.2403.1 LIBDIR = nms_cxy/lib -BINNAME = restagent +BINNAME = omc .PHONY: build $(BINNAME) build $(BINNAME): diff --git a/restagent/restagent.go b/omc/omc.go similarity index 95% rename from restagent/restagent.go rename to omc/omc.go index d3f8cc7..7bc6966 100644 --- a/restagent/restagent.go +++ b/omc/omc.go @@ -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) diff --git a/restagent/static/helpDoc/zh_doc.pdf b/restagent/static/helpDoc/zh_doc.pdf deleted file mode 100644 index e25d5ca..0000000 Binary files a/restagent/static/helpDoc/zh_doc.pdf and /dev/null differ diff --git a/restagent/static/logo/en_brand.png b/restagent/static/logo/en_brand.png deleted file mode 100644 index 200025e..0000000 Binary files a/restagent/static/logo/en_brand.png and /dev/null differ diff --git a/restagent/static/logo/en_icon.png b/restagent/static/logo/en_icon.png deleted file mode 100644 index 3ed445d..0000000 Binary files a/restagent/static/logo/en_icon.png and /dev/null differ diff --git a/restagent/static/logo/zh_brand.png b/restagent/static/logo/zh_brand.png deleted file mode 100644 index 5810cf5..0000000 Binary files a/restagent/static/logo/zh_brand.png and /dev/null differ diff --git a/restagent/static/logo/zh_icon.png b/restagent/static/logo/zh_icon.png deleted file mode 100644 index a5b6907..0000000 Binary files a/restagent/static/logo/zh_icon.png and /dev/null differ diff --git a/src/framework/config/config.go b/src/framework/config/config.go index 66468f4..bdc31a4 100644 --- a/src/framework/config/config.go +++ b/src/framework/config/config.go @@ -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") diff --git a/src/lib_features/account/account.go b/src/lib_features/account/account.go index 5fa3a22..7059086 100644 --- a/src/lib_features/account/account.go +++ b/src/lib_features/account/account.go @@ -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" ) diff --git a/src/lib_features/config/config.go b/src/lib_features/config/config.go index 59b6497..c0dd41b 100644 --- a/src/lib_features/config/config.go +++ b/src/lib_features/config/config.go @@ -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 指定配置文件读取 diff --git a/src/lib_features/readme.md b/src/lib_features/readme.md index 8e91940..6f43371 100644 --- a/src/lib_features/readme.md +++ b/src/lib_features/readme.md @@ -1,5 +1,5 @@ # 外层 lib 和 features 粘合层 -- config.go 配置合并: restagent.yaml 文件内容,主要是数据库配置 +- config.go 配置合并: omc.yaml 文件内容,主要是数据库配置 - account.go 登录会话生成 token - session.go 中间件方式设置请求头 token 值 diff --git a/src/lib_features/session/session.go b/src/lib_features/session/session.go index 879c16c..1e36c8a 100644 --- a/src/lib_features/session/session.go +++ b/src/lib_features/session/session.go @@ -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" diff --git a/src/modules/crontask/processor/backupEtcFromNE/backupEtcFromNE.go b/src/modules/crontask/processor/backupEtcFromNE/backupEtcFromNE.go index 0bcae18..43354b7 100644 --- a/src/modules/crontask/processor/backupEtcFromNE/backupEtcFromNE.go +++ b/src/modules/crontask/processor/backupEtcFromNE/backupEtcFromNE.go @@ -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" ) diff --git a/src/modules/crontask/processor/genNeStateAlarm/genNeStateAlarm.go b/src/modules/crontask/processor/genNeStateAlarm/genNeStateAlarm.go index 8e4b1be..cd8f9f4 100644 --- a/src/modules/crontask/processor/genNeStateAlarm/genNeStateAlarm.go +++ b/src/modules/crontask/processor/genNeStateAlarm/genNeStateAlarm.go @@ -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" diff --git a/src/modules/crontask/processor/getStateFromNE/getStateFromNE.go b/src/modules/crontask/processor/getStateFromNE/getStateFromNE.go index 686125b..0d0786d 100644 --- a/src/modules/crontask/processor/getStateFromNE/getStateFromNE.go +++ b/src/modules/crontask/processor/getStateFromNE/getStateFromNE.go @@ -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" diff --git a/src/modules/nms_cxy/controller/system.go b/src/modules/nms_cxy/controller/system.go index 1700408..b08d9ae 100644 --- a/src/modules/nms_cxy/controller/system.go +++ b/src/modules/nms_cxy/controller/system.go @@ -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,