aboutsummaryrefslogtreecommitdiffstats
path: root/vnfmarket-be
diff options
context:
space:
mode:
authorKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2018-09-08 17:39:57 +0530
committerKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2018-09-10 11:07:22 +0530
commit3f3709eacdcc5a64931e8050290643e064fab752 (patch)
treed1dcf2f658d031a688a5dde6226922e870c7bec1 /vnfmarket-be
parentece47e2af72438edb0b347222d62f3d337e4f8b9 (diff)
VTP: Add installers for VTP in docker
Issue-ID: VNFSDK-304 Change-Id: Id74ab9420ff5ee4cd24b0269c356be3442d214ff Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Diffstat (limited to 'vnfmarket-be')
-rw-r--r--vnfmarket-be/deployment/docker/docker-refrepo/src/main/docker/install-vtp.sh78
-rw-r--r--vnfmarket-be/deployment/docker/docker-refrepo/src/main/docker/vtp-tc.sh113
2 files changed, 191 insertions, 0 deletions
diff --git a/vnfmarket-be/deployment/docker/docker-refrepo/src/main/docker/install-vtp.sh b/vnfmarket-be/deployment/docker/docker-refrepo/src/main/docker/install-vtp.sh
new file mode 100644
index 00000000..bdb51b96
--- /dev/null
+++ b/vnfmarket-be/deployment/docker/docker-refrepo/src/main/docker/install-vtp.sh
@@ -0,0 +1,78 @@
+#!/bin/bash
+#
+# Copyright 2018 Huawei Technologies Co., Ltd.
+#
+# 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.
+#
+
+export _PWD=`pwd`
+
+echo ################ Check for java
+apt-get install -y wget unzip
+
+#check for java
+java -version
+if [ $? == 127 ]
+then
+ apt-get install -y openjdk-8-jre
+fi
+
+echo ################ Install OCLIP
+
+VTP_LATEST_BINARY="https://nexus.onap.org/service/local/artifact/maven/redirect?r=releases&g=org.onap.cli&a=cli-zip&e=zip&v=LATEST"
+VTP_INSTALL_DIR=/opt/vtp
+VTP_ZIP=vtp.zip
+
+mkdir -p $VTP_INSTALL_DIR
+cd $VTP_INSTALL_DIR
+
+wget -O $VTP_ZIP $VTP_LATEST_BINARY
+unzip $VTP_ZIP
+echo clean up the irrelevent products
+rm -rf ./lib/cli-products*.jar
+
+export OPEN_CLI_HOME=$VTP_INSTALL_DIR
+export OPEN_CLI_PRODUCT_IN_USE=onap-vtp
+
+cd $OPEN_CLI_HOME
+
+if [ ! -d ./data ]; then mkdir ./data; fi
+if [ ! -d ./open-cli-schema ]; then mkdir ./open-cli-schema; fi
+
+for cmd in ./bin/oclip.sh ./bin/oclip-rcli.sh ./bin/oclip-cmdflow-server.sh
+do
+ sed '18i export OPEN_CLI_HOME=/opt/vtp' $cmd > ${cmd}_
+ mv ${cmd}_ ${cmd}
+done
+
+chmod +x ./bin/oclip.sh
+chmod +x ./bin/oclip-rcli.sh
+chmod +x ./bin/oclip-cmdflow-server.sh
+
+ln -sf $OPEN_CLI_HOME/bin/oclip-rcli.sh /usr/bin/vtp-cli
+ln -sf $OPEN_CLI_HOME/bin/oclip-cmdflow-server.sh /usr/bin/vtp-tc
+
+echo ################ Deploy sample csar validation test case
+CSARVALIDATOR_LATEST_BINARY="https://nexus.onap.org/service/local/artifact/maven/redirect?r=releases&g=org.onap.vnfsdk.validation&a=csarvalidation-deployment&e=zip&v=LATEST"
+CSARVAL_ZIP=csarvalidator.zip
+wget -O $CSARVAL_ZIP $CSARVALIDATOR_LATEST_BINARY
+unzip -d csarvalidator $CSARVAL_ZIP
+echo install csarvalidator into vtp
+cp csarvalidator/*.jar $VTP_INSTALL_DIR/lib/
+rm -rf csarvalidator $CSARVAL_ZIP $VTP_ZIP
+cd -
+
+echo ################ Install as service
+cp $_PWD/vtp-tc.sh /etc/init.d/vtp-tc && update-rc.d vtp-tc defaults
+
+echo ################ Done
diff --git a/vnfmarket-be/deployment/docker/docker-refrepo/src/main/docker/vtp-tc.sh b/vnfmarket-be/deployment/docker/docker-refrepo/src/main/docker/vtp-tc.sh
new file mode 100644
index 00000000..c2cd5535
--- /dev/null
+++ b/vnfmarket-be/deployment/docker/docker-refrepo/src/main/docker/vtp-tc.sh
@@ -0,0 +1,113 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides: VTP-TC
+# Required-Start: $remote_fs $syslog
+# Required-Stop: $remote_fs $syslog
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Start daemon at boot time
+# Description: Enable service provided by daemon.
+### END INIT INFO
+#
+# Copyright 2018 Huawei Technologies Co., Ltd.
+#
+# 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.
+#
+
+dir="/opt"
+cmd="vtp-tc"
+user="root"
+
+name=`basename $0`
+pid_file="/var/run/$name.pid"
+stdout_log="/var/log/$name.log"
+stderr_log="/var/log/$name.err"
+
+get_pid() {
+ cat "$pid_file"
+}
+
+is_running() {
+ [ -f "$pid_file" ] && ps `get_pid` > /dev/null 2>&1
+}
+
+case "$1" in
+ start)
+ if is_running; then
+ echo "Already started"
+ else
+ echo "Starting $name"
+ cd "$dir"
+ if [ -z "$user" ]; then
+ sudo $cmd >> "$stdout_log" 2>> "$stderr_log" &
+ else
+ sudo -u "$user" $cmd >> "$stdout_log" 2>> "$stderr_log" &
+ fi
+ echo $! > "$pid_file"
+ if ! is_running; then
+ echo "Unable to start, see $stdout_log and $stderr_log"
+ exit 1
+ fi
+ fi
+ ;;
+ stop)
+ if is_running; then
+ echo -n "Stopping $name.."
+ kill `get_pid`
+ for i in {1..10}
+ do
+ if ! is_running; then
+ break
+ fi
+
+ echo -n "."
+ sleep 1
+ done
+ echo
+
+ if is_running; then
+ echo "Not stopped; may still be shutting down or shutdown may have failed"
+ exit 1
+ else
+ echo "Stopped"
+ if [ -f "$pid_file" ]; then
+ rm "$pid_file"
+ fi
+ fi
+ else
+ echo "Not running"
+ fi
+ ;;
+ restart)
+ $0 stop
+ if is_running; then
+ echo "Unable to stop, will not attempt to start"
+ exit 1
+ fi
+ $0 start
+ ;;
+ status)
+ if is_running; then
+ echo "Running"
+ else
+ echo "Stopped"
+ exit 1
+ fi
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart|status}"
+ exit 1
+ ;;
+esac
+
+exit 0