summaryrefslogtreecommitdiffstats
path: root/esr-core/distribution/standalone/src/main/assembly
diff options
context:
space:
mode:
Diffstat (limited to 'esr-core/distribution/standalone/src/main/assembly')
-rw-r--r--esr-core/distribution/standalone/src/main/assembly/bin/find_kill_process.bat24
-rw-r--r--esr-core/distribution/standalone/src/main/assembly/bin/initDB.bat34
-rw-r--r--esr-core/distribution/standalone/src/main/assembly/bin/initDB.sh34
-rw-r--r--esr-core/distribution/standalone/src/main/assembly/bin/run.bat41
-rw-r--r--esr-core/distribution/standalone/src/main/assembly/bin/run.sh36
-rw-r--r--esr-core/distribution/standalone/src/main/assembly/bin/stop.bat34
-rw-r--r--esr-core/distribution/standalone/src/main/assembly/bin/stop.sh44
-rw-r--r--esr-core/distribution/standalone/src/main/assembly/conf/extsys.yml77
-rw-r--r--esr-core/distribution/standalone/src/main/assembly/dbscripts/mysql/openo-common-extsys-createobj.sql91
9 files changed, 415 insertions, 0 deletions
diff --git a/esr-core/distribution/standalone/src/main/assembly/bin/find_kill_process.bat b/esr-core/distribution/standalone/src/main/assembly/bin/find_kill_process.bat
new file mode 100644
index 0000000..1dffb1c
--- /dev/null
+++ b/esr-core/distribution/standalone/src/main/assembly/bin/find_kill_process.bat
@@ -0,0 +1,24 @@
+@REM
+@REM Copyright 2016 ZTE Corporation.
+@REM
+@REM Licensed under the Apache License, Version 2.0 (the "License");
+@REM you may not use this file except in compliance with the License.
+@REM You may obtain a copy of the License at
+@REM
+@REM http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing, software
+@REM distributed under the License is distributed on an "AS IS" BASIS,
+@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@REM See the License for the specific language governing permissions and
+@REM limitations under the License.
+@REM
+
+echo %1 | findstr %2 >NUL
+echo ERRORLEVEL=%ERRORLEVEL%
+IF ERRORLEVEL 1 goto findend
+for /f "tokens=1" %%a in (%1) do (
+ echo kill %1
+ taskkill /F /pid %%a
+)
+:findend \ No newline at end of file
diff --git a/esr-core/distribution/standalone/src/main/assembly/bin/initDB.bat b/esr-core/distribution/standalone/src/main/assembly/bin/initDB.bat
new file mode 100644
index 0000000..dd86c3e
--- /dev/null
+++ b/esr-core/distribution/standalone/src/main/assembly/bin/initDB.bat
@@ -0,0 +1,34 @@
+@REM
+@REM Copyright 2016 ZTE Corporation.
+@REM
+@REM Licensed under the Apache License, Version 2.0 (the "License");
+@REM you may not use this file except in compliance with the License.
+@REM You may obtain a copy of the License at
+@REM
+@REM http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing, software
+@REM distributed under the License is distributed on an "AS IS" BASIS,
+@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@REM See the License for the specific language governing permissions and
+@REM limitations under the License.
+@REM
+
+@echo off
+set HOME=%~dp0
+set user=%1
+set password=%2
+set port=%3
+set host=%4
+echo start init extsys db
+echo HOME=%HOME%
+set main_path=%HOME%..\
+cd /d %main_path%
+mysql -u%user% -p%password% -P%port% -h%host% < dbscripts\mysql\openo-common-extsys-createobj.sql
+set "err=%errorlevel%"
+if "%err%"=="0" (
+ echo init extsys db success
+ ) else (
+ echo failed init extsys db
+ pause
+ ) \ No newline at end of file
diff --git a/esr-core/distribution/standalone/src/main/assembly/bin/initDB.sh b/esr-core/distribution/standalone/src/main/assembly/bin/initDB.sh
new file mode 100644
index 0000000..eb2dc24
--- /dev/null
+++ b/esr-core/distribution/standalone/src/main/assembly/bin/initDB.sh
@@ -0,0 +1,34 @@
+#!/bin/bash
+#
+# Copyright 2016 ZTE Corporation.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+DIRNAME=`dirname $0`
+HOME=`cd $DIRNAME/; pwd`
+user=$1
+password=$2
+port=$3
+host=$4
+echo "start init extsys db"
+main_path=$HOME/../
+mysql -u$user -p$password -P$port -h$host <$main_path/dbscripts/mysql/openo-common-extsys-createobj.sql
+sql_result=$?
+if [ $sql_result != 0 ] ; then
+ echo "failed to init extsys database!"
+ exit 1
+fi
+echo "init extsys database success!"
+exit 0
+
diff --git a/esr-core/distribution/standalone/src/main/assembly/bin/run.bat b/esr-core/distribution/standalone/src/main/assembly/bin/run.bat
new file mode 100644
index 0000000..9de9ffa
--- /dev/null
+++ b/esr-core/distribution/standalone/src/main/assembly/bin/run.bat
@@ -0,0 +1,41 @@
+@REM
+@REM Copyright 2016 ZTE Corporation.
+@REM
+@REM Licensed under the Apache License, Version 2.0 (the "License");
+@REM you may not use this file except in compliance with the License.
+@REM You may obtain a copy of the License at
+@REM
+@REM http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing, software
+@REM distributed under the License is distributed on an "AS IS" BASIS,
+@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@REM See the License for the specific language governing permissions and
+@REM limitations under the License.
+@REM
+
+@echo off
+title extsys-service
+
+set RUNHOME=%~dp0
+echo ### RUNHOME: %RUNHOME%
+echo ### Starting extsys-service
+set main_path=%RUNHOME%..\
+cd /d %main_path%
+set JAVA="%JAVA_HOME%\bin\java.exe"
+set port=8312
+set jvm_opts=-Xms50m -Xmx128m
+rem set jvm_opts=%jvm_opts% -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=%port%,server=y,suspend=n
+set class_path=%main_path%;%main_path%extsys-service.jar
+echo ### jvm_opts: %jvm_opts%
+echo ### class_path: %class_path%
+
+%JAVA% -classpath %class_path% %jvm_opts% org.openo.commonservice.extsys.ExtsysApp server %main_path%conf/extsys.yml
+
+IF ERRORLEVEL 1 goto showerror
+exit
+:showerror
+echo WARNING: Error occurred during startup or Server abnormally stopped by way of killing the process,Please check!
+echo After checking, press any key to close
+pause
+exit \ No newline at end of file
diff --git a/esr-core/distribution/standalone/src/main/assembly/bin/run.sh b/esr-core/distribution/standalone/src/main/assembly/bin/run.sh
new file mode 100644
index 0000000..176fc69
--- /dev/null
+++ b/esr-core/distribution/standalone/src/main/assembly/bin/run.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+#
+# Copyright 2016 ZTE Corporation.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+DIRNAME=`dirname $0`
+RUNHOME=`cd $DIRNAME/; pwd`
+echo @RUNHOME@ $RUNHOME
+
+echo @JAVA_HOME@ $JAVA_HOME
+JAVA="$JAVA_HOME/bin/java"
+echo @JAVA@ $JAVA
+main_path=$RUNHOME/../
+cd $main_path
+JAVA_OPTS="-Xms50m -Xmx128m"
+port=8312
+#JAVA_OPTS="$JAVA_OPTS -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=$port,server=y,suspend=n"
+echo @JAVA_OPTS@ $JAVA_OPTS
+
+class_path="$main_path/:$main_path/extsys-service.jar"
+echo @class_path@ $class_path
+
+"$JAVA" $JAVA_OPTS -classpath "$class_path" org.openo.commonservice.extsys.ExtsysApp server "$main_path/conf/extsys.yml"
+
diff --git a/esr-core/distribution/standalone/src/main/assembly/bin/stop.bat b/esr-core/distribution/standalone/src/main/assembly/bin/stop.bat
new file mode 100644
index 0000000..170f240
--- /dev/null
+++ b/esr-core/distribution/standalone/src/main/assembly/bin/stop.bat
@@ -0,0 +1,34 @@
+@REM
+@REM Copyright 2016 ZTE Corporation.
+@REM
+@REM Licensed under the Apache License, Version 2.0 (the "License");
+@REM you may not use this file except in compliance with the License.
+@REM You may obtain a copy of the License at
+@REM
+@REM http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing, software
+@REM distributed under the License is distributed on an "AS IS" BASIS,
+@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@REM See the License for the specific language governing permissions and
+@REM limitations under the License.
+@REM
+
+@echo off
+title stopping extsys-service
+
+set HOME=%~dp0
+set Main_Class="org.openo.commonservice.extsys.ExtsysApp"
+
+echo ================== extsys-service info =============================================
+echo HOME=$HOME
+echo Main_Class=%Main_Class%
+echo ===============================================================================
+
+echo ### Stopping extsys-service
+cd /d %HOME%
+
+for /f "delims=" %%i in ('"%JAVA_HOME%\bin\jcmd"') do (
+ call find_kill_process "%%i" %Main_Class%
+)
+exit \ No newline at end of file
diff --git a/esr-core/distribution/standalone/src/main/assembly/bin/stop.sh b/esr-core/distribution/standalone/src/main/assembly/bin/stop.sh
new file mode 100644
index 0000000..0afe681
--- /dev/null
+++ b/esr-core/distribution/standalone/src/main/assembly/bin/stop.sh
@@ -0,0 +1,44 @@
+#!/bin/bash
+#
+# Copyright 2016 ZTE Corporation.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+DIRNAME=`dirname $0`
+HOME=`cd $DIRNAME/; pwd`
+Main_Class="org.openo.commonservice.extsys.ExtsysApp"
+
+echo ================== catalog-service info =============================================
+echo HOME=$HOME
+echo Main_Class=$Main_Class
+echo ===============================================================================
+cd $HOME; pwd
+
+echo @WORK_DIR@ $HOME
+
+function save_service_pid(){
+ service_pid=`ps -ef | grep $Main_Class | grep -v grep | awk '{print $2}'`
+ echo @service_pid@ $service_pid
+}
+
+function kill_service_process(){
+ ps -p $service_pid
+ if [ $? == 0 ]; then
+ kill -9 $service_pid
+ fi
+}
+
+save_service_pid;
+echo @C_CMD@ kill -9 $service_pid
+kill_service_process;
diff --git a/esr-core/distribution/standalone/src/main/assembly/conf/extsys.yml b/esr-core/distribution/standalone/src/main/assembly/conf/extsys.yml
new file mode 100644
index 0000000..33c939a
--- /dev/null
+++ b/esr-core/distribution/standalone/src/main/assembly/conf/extsys.yml
@@ -0,0 +1,77 @@
+#
+# Copyright 2016 ZTE Corporation.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+template: Hello, %s!
+
+defaultName: ${DW_DEFAULT_NAME:-Stranger}
+# the micro service ip
+serviceIp:
+msbServerAddr: http://127.0.0.1:80
+#database
+database:
+
+ # the name of your JDBC driver
+ driverClass: com.mysql.jdbc.Driver
+
+ # the username
+ user: extsys
+
+ # the password
+ password: extsys
+
+ # the JDBC URL
+ url: jdbc:mysql://127.0.0.1:3306/extsys
+
+# use the simple server factory if you only want to run on a single port
+#server:
+# type: simple
+# connector:
+# type: http
+# port: 8080
+server:
+ type: simple
+ rootPath: '/openoapi/extsys/v1/*'
+ applicationContextPath: /
+ adminContextPath: /admin
+ connector:
+ type: http
+ port: 8100
+
+# Logging settings.
+logging:
+
+ # The default level of all loggers. Can be OFF, ERROR, WARN, INFO, DEBUG, TRACE, or ALL.
+ level: ALL
+
+ # Logger-specific levels.
+ loggers:
+
+ # Sets the level for 'com.example.app' to DEBUG.
+ org.openo.commonservice.extsys.ExtsysApp: INFO
+
+ appenders:
+ - type: console
+ threshold: INFO
+ timeZone: UTC
+ logFormat: "%d{yyyy-MM-dd HH:mm:ss SSS} %-5p [%c][%t] - %m%n"
+ - type: file
+ threshold: INFO
+ logFormat: "%d{yyyy-MM-dd HH:mm:ss SSS} %-5p [%c][%t] - %m%n"
+ currentLogFilename: ./works/logs/extsys.log
+ archivedLogFilenamePattern: ./works/logs/zip/extsys-%d{yyyy-MM-dd}.log.gz
+ archivedFileCount: 7
+ timeZone: UTC
+
diff --git a/esr-core/distribution/standalone/src/main/assembly/dbscripts/mysql/openo-common-extsys-createobj.sql b/esr-core/distribution/standalone/src/main/assembly/dbscripts/mysql/openo-common-extsys-createobj.sql
new file mode 100644
index 0000000..73f2ea0
--- /dev/null
+++ b/esr-core/distribution/standalone/src/main/assembly/dbscripts/mysql/openo-common-extsys-createobj.sql
@@ -0,0 +1,91 @@
+--
+-- Copyright 2016 ZTE Corporation.
+--
+-- Licensed under the Apache License, Version 2.0 (the "License");
+-- you may not use this file except in compliance with the License.
+-- You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+
+/******************drop old database and user***************************/
+use mysql;
+drop database IF EXISTS extsys;
+delete from user where User='extsys';
+FLUSH PRIVILEGES;
+
+/******************create new database and user***************************/
+create database extsys CHARACTER SET utf8;
+
+GRANT ALL PRIVILEGES ON extsys.* TO 'extsys'@'%' IDENTIFIED BY 'extsys' WITH GRANT OPTION;
+GRANT ALL PRIVILEGES ON mysql.* TO 'extsys'@'%' IDENTIFIED BY 'extsys' WITH GRANT OPTION;
+
+GRANT ALL PRIVILEGES ON extsys.* TO 'extsys'@'localhost' IDENTIFIED BY 'extsys' WITH GRANT OPTION;
+GRANT ALL PRIVILEGES ON mysql.* TO 'extsys'@'localhost' IDENTIFIED BY 'extsys' WITH GRANT OPTION;
+FLUSH PRIVILEGES;
+
+use extsys;
+set Names 'utf8';
+/******************drop old table and create new***************************/
+DROP TABLE IF EXISTS extsys_base_table;
+CREATE TABLE extsys_base_table (
+ ID VARCHAR(200) NOT NULL,
+ NAME VARCHAR(200) NULL,
+ TYPE VARCHAR(200) NULL,
+ VENDOR VARCHAR(100) NULL,
+ VERSION VARCHAR(100) NULL,
+ DESCRIPTION VARCHAR(100) NULL,
+ CREATETIME VARCHAR(200) NULL,
+ CATAGORY VARCHAR(200) NULL,
+ CONSTRAINT extsys_base_table PRIMARY KEY(ID)
+);
+DROP TABLE IF EXISTS extsys_ems_table;
+CREATE TABLE extsys_ems_table (
+ EMSID VARCHAR(200) NOT NULL,
+ URL VARCHAR(100) NULL,
+ PRODUCTNAME VARCHAR(100) NULL,
+ USERNAME VARCHAR(100) NULL,
+ PASSWORD VARCHAR(100) NULL,
+ CONSTRAINT extsys_ems_table PRIMARY KEY(EMSID)
+);
+
+DROP TABLE IF EXISTS extsys_sdnc_table;
+CREATE TABLE extsys_sdnc_table (
+ SDNCONTROLLERID VARCHAR(200) NOT NULL,
+ URL VARCHAR(100) NULL,
+ USERNAME VARCHAR(100) NULL,
+ PASSWORD VARCHAR(100) NULL,
+ PRODUCTNAME VARCHAR(100) NULL,
+ PROTOCOL VARCHAR(100) NULL,
+ CONSTRAINT extsys_sdnc_table PRIMARY KEY(SDNCONTROLLERID)
+);
+
+DROP TABLE IF EXISTS extsys_vim_table;
+CREATE TABLE extsys_vim_table (
+ VIMID VARCHAR(200) NOT NULL,
+ URL VARCHAR(100) NULL,
+ USERNAME VARCHAR(100) NULL,
+ PASSWORD VARCHAR(100) NULL,
+ DOMAIN VARCHAR(100) NULL,
+ TENANT VARCHAR(100) NULL,
+ CONSTRAINT extsys_vim_table PRIMARY KEY(VIMID)
+);
+
+DROP TABLE IF EXISTS extsys_vnfm_table;
+CREATE TABLE extsys_vnfm_table (
+ VNFMID VARCHAR(200) NOT NULL,
+ URL VARCHAR(200) NULL,
+ USERNAME VARCHAR(100) NULL,
+ PASSWORD VARCHAR(100) NULL,
+ VIMID VARCHAR(100) NULL,
+ CERTIFICATEURL VARCHAR(200) NULL,
+ CONSTRAINT extsys_vnfm_table PRIMARY KEY(VNFMID)
+);
+
+