From 6346805afd9fcf4c56966751e41ee959391e8788 Mon Sep 17 00:00:00 2001 From: fujinhua Date: Fri, 30 Jun 2017 14:14:29 +0800 Subject: Create seed codes of nfvo Change-Id: I72a426c6be55f8a6a0200f6dedd2486bee067062 Issue-Id: VFC-52 Signed-off-by: fujinhua --- .../plugin-standalone/plugin-standalone.iml | 122 ++++++++++++++++ zte/sfc-driver/plugin-standalone/pom.xml | 160 +++++++++++++++++++++ .../src/main/assembly/conf/console.yml | 63 ++++++++ .../plugin-standalone/src/main/assembly/run.bat | 21 +++ .../plugin-standalone/src/main/assembly/run.sh | 48 +++++++ .../plugin-standalone/src/main/assembly/stop.sh | 47 ++++++ 6 files changed, 461 insertions(+) create mode 100644 zte/sfc-driver/plugin-standalone/plugin-standalone.iml create mode 100644 zte/sfc-driver/plugin-standalone/pom.xml create mode 100644 zte/sfc-driver/plugin-standalone/src/main/assembly/conf/console.yml create mode 100644 zte/sfc-driver/plugin-standalone/src/main/assembly/run.bat create mode 100644 zte/sfc-driver/plugin-standalone/src/main/assembly/run.sh create mode 100644 zte/sfc-driver/plugin-standalone/src/main/assembly/stop.sh (limited to 'zte/sfc-driver/plugin-standalone') diff --git a/zte/sfc-driver/plugin-standalone/plugin-standalone.iml b/zte/sfc-driver/plugin-standalone/plugin-standalone.iml new file mode 100644 index 0000000..5a98a60 --- /dev/null +++ b/zte/sfc-driver/plugin-standalone/plugin-standalone.iml @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/zte/sfc-driver/plugin-standalone/pom.xml b/zte/sfc-driver/plugin-standalone/pom.xml new file mode 100644 index 0000000..e5cd1c7 --- /dev/null +++ b/zte/sfc-driver/plugin-standalone/pom.xml @@ -0,0 +1,160 @@ + + + + + org.openo.nfvo.sfc-driver-parent + sfc-driver-parent + 1.1.0-SNAPSHOT + + 4.0.0 + org.openo.nfvo.sfc-driver-standalone + nfvo-drivers-sdnc-zte-sfc-driver + nfvo/drivers/sdnc/zte/sfc-driver/plugin-standalone + pom + 1.1.0-SNAPSHOT + + + + org.openo.nfvo.sfc-driver + sfc-driver + ${project.version} + + + + + sfc-driver + + + + + + maven-resources-plugin + + + copy-resources + process-resources + + copy-resources + + + ${basedir}/target/assembly/ + + + src/main/assembly/ + false + + **/* + + + + + true + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + 2.8 + + + copy-jar + + copy + + prepare-package + + + + org.openo.nfvo.sfc-driver + sfc-driver + jar + true + target/assembly/ + sfc-service.jar + + + + + + + + org.apache.maven.plugins + maven-antrun-plugin + + + zip + package + + run + + + + + + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + attach-artifacts + package + + attach-artifact + + + + + target/nfvo-drivers-sdnc-zte-sfc-driver-${project.version}.zip + zip + + + + + + + + + + + + diff --git a/zte/sfc-driver/plugin-standalone/src/main/assembly/conf/console.yml b/zte/sfc-driver/plugin-standalone/src/main/assembly/conf/console.yml new file mode 100644 index 0000000..4860afd --- /dev/null +++ b/zte/sfc-driver/plugin-standalone/src/main/assembly/conf/console.yml @@ -0,0 +1,63 @@ +# +# Copyright 2016 [ZTE] and others. +# +# 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} + +msbServiceUrl: http://127.0.0.1:80 + +# 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/ztesdncdriver/v1/*' + applicationContextPath: / + adminContextPath: /admin + connector: + type: http + port: 8411 + +# 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. + com.example: DEBUG + + appenders: + - type: console + threshold: INFO + timeZone: UTC + logFormat: "%-6level [%d{HH:mm:ss.SSS}] [%t] %logger{5} - %X{code} %msg %n" + - type: file + threshold: INFO + logFormat: "%-6level [%d{HH:mm:ss.SSS}] [%t] %logger{5} - %X{code} %msg %n" + currentLogFilename: ./logs/application.log + archivedLogFilenamePattern: ./logs/application-%d{yyyy-MM-dd}-%i.log.gz + archivedFileCount: 7 + timeZone: UTC + diff --git a/zte/sfc-driver/plugin-standalone/src/main/assembly/run.bat b/zte/sfc-driver/plugin-standalone/src/main/assembly/run.bat new file mode 100644 index 0000000..46e88bb --- /dev/null +++ b/zte/sfc-driver/plugin-standalone/src/main/assembly/run.bat @@ -0,0 +1,21 @@ +@REM +@REM Copyright 2016 [ZTE] and others. +@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 + +rem set JAVA_HOME=D:\JDK1.7\jdk\jdk\windows +set port=8789 +set jvm_opts= -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=%port%,server=y,suspend=n + +"%JAVA_HOME%/bin/java" -jar %jvm_opts% sfc-service.jar server conf/console.yml \ No newline at end of file diff --git a/zte/sfc-driver/plugin-standalone/src/main/assembly/run.sh b/zte/sfc-driver/plugin-standalone/src/main/assembly/run.sh new file mode 100644 index 0000000..ae8318a --- /dev/null +++ b/zte/sfc-driver/plugin-standalone/src/main/assembly/run.sh @@ -0,0 +1,48 @@ +#!/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. +# +# Author: Zhang Zhou +# email: zhang.zhou1@zte.com.cn +# + +#JAVA_HOME="/home/conductortest/jdk1.7/jdk/linux" + +DIRNAME=`dirname $0` +RUNHOME=`cd $DIRNAME/; pwd` +echo @RUNHOME@ $RUNHOME + +#JAVA_HOME=$(readlink -f /usr/bin/javac | sed "s:/bin/javac::") +echo @JAVA_HOME@ $JAVA_HOME +JAVA="$JAVA_HOME/bin/java" +echo @JAVA@ $JAVA +JAVA_VERSION=`$JAVA -version 2>&1 |awk 'NR==1{ sub(/"/,""); print substr($3,1,3)}'` +echo @JAVA_VERSION@ $JAVA_VERSION +if [ $JAVA_VERSION = "1.8" ] +then + JAVA_OPTS="-Xms16m -Xmx128m -XX:+UseSerialGC -XX:MaxMetaspaceSize=64m -XX:NewRatio=2" +else + JAVA_OPTS="-Xms16m -Xmx128m -XX:+UseSerialGC -XX:MaxPermSize=64m -XX:NewRatio=2" +fi +port=8779 +#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="$RUNHOME/:$RUNHOME/sfc-service.jar" +echo @class_path@ $class_path + +"$JAVA" $JAVA_OPTS -classpath "$class_path" org.openo.sfc.SfcDriver server "$RUNHOME/conf/console.yml" + + diff --git a/zte/sfc-driver/plugin-standalone/src/main/assembly/stop.sh b/zte/sfc-driver/plugin-standalone/src/main/assembly/stop.sh new file mode 100644 index 0000000..693c429 --- /dev/null +++ b/zte/sfc-driver/plugin-standalone/src/main/assembly/stop.sh @@ -0,0 +1,47 @@ +#!/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. +# +# Author: Zhang Zhou +# email: zhang.zhou1@zte.com.cn +# + +DIRNAME=`dirname $0` +HOME=`cd $DIRNAME/; pwd` +SFC_Main_Class="sfc-service.jar" + +echo ================== sfc info ============================================= +echo HOME=$HOME +echo SFC_Main_Class=$SFC_Main_Class +echo =============================================================================== +cd $HOME; pwd + +echo @WORK_DIR@ $HOME + +function save_sfc_pid(){ + sfc_id=`ps -ef | grep $SFC_Main_Class | grep $HOME | grep -v grep | awk '{print $2}'` + echo $sfc_id +} + +function kill_apiroute_process(){ + ps -p $sfc_id + if [ $? == 0 ]; then + kill -9 $sfc_id + fi +} + +save_sfc_pid; +echo @C_CMD@ kill -9 $sfc_id +kill_apiroute_process; \ No newline at end of file -- cgit 1.2.3-korg