aboutsummaryrefslogtreecommitdiffstats
path: root/vnfmarket-be/deployment/install/vtp_install.sh
diff options
context:
space:
mode:
authorKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2019-03-14 09:44:32 +0800
committerKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2019-03-14 13:23:40 +0800
commitd0cbdfcdb2eb51a8cb962a109d8e14c93525e12b (patch)
treecd61bcf62284199868a1be1c9a60f3a0d635823c /vnfmarket-be/deployment/install/vtp_install.sh
parent2c484fac1b261a1f24851fe7f67fe6f64724ad3d (diff)
Add VVP deployment in VTP scripts
Issue-ID: VNFSDK-352 Change-Id: I606263a1df9739e1dff809523006bf82c384657c Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Diffstat (limited to 'vnfmarket-be/deployment/install/vtp_install.sh')
-rw-r--r--vnfmarket-be/deployment/install/vtp_install.sh267
1 files changed, 168 insertions, 99 deletions
diff --git a/vnfmarket-be/deployment/install/vtp_install.sh b/vnfmarket-be/deployment/install/vtp_install.sh
index 90c8a018..7c71977a 100644
--- a/vnfmarket-be/deployment/install/vtp_install.sh
+++ b/vnfmarket-be/deployment/install/vtp_install.sh
@@ -21,12 +21,9 @@
# source < this file >
#
# Install:
-# vtp_download
-# vtp_backend_install
-# vtp_controller_install
+# vtp_setup
# Start:
# vtp_start
-# vtp_trace
# Stop:
# vtp_stop
# Uninstall
@@ -39,6 +36,8 @@ export VTP_DOWNLOAD_URL="https://nexus.onap.org/content/repositories/autorelease
export CSAR_VALIDATE_DOWNLOAD_URL="https://nexus.onap.org/content/repositories/autorelease-114111/org/onap/vnfsdk/validation/csarvalidation-deployment/1.1.5/csarvalidation-deployment-1.1.5.zip"
export TOMCAT8_DOWNLOAD_URL="https://archive.apache.org/dist/tomcat/tomcat-8/v8.5.30/bin/apache-tomcat-8.5.30.tar.gz"
export SAMPLE_VTP_CSAR="https://github.com/onap/vnfsdk-validation/raw/master/csarvalidation/src/test/resources/VoLTE.csar"
+export VVP_GITHUB="https://github.com/onap/vvp-validation-scripts"
+export SAMPLE_VTP_HOT="https://git.openstack.org/cgit/openstack/heat-templates/plain/hot/hello_world.yaml"
export VTP_STAGE_DIR=/opt/vtp_stage
@@ -46,125 +45,195 @@ export OPEN_CLI_HOME=/opt/oclip
export PATH=$OPEN_CLI_HOME/bin:$PATH
export CATALINA_HOME=/opt/controller
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/
-
+export ONAP_VVP_HOME=$VTP_STAGE_DIR/vvp-validation-scripts/ice_validator
export VTP_TRACK_MARK=++++++++++++++++++++++++
function vtp_download() {
- echo $VTP_TRACK_MARK Downloading VTP binaries and setup the dependencies ...
-
- apt-get install -y tar wget unzip
-
- mkdir -p $VTP_STAGE_DIR
-
- if [ ! -f $VTP_STAGE_DIR/CLI.zip ]
- then
- wget -O $VTP_STAGE_DIR/CLI.zip $OCLIP_DOWNLOAD_URL
- else
- echo $VTP_TRACK_MARK $OCLIP_DOWNLOAD_URL already downloded
- fi
-
- if [ ! -f $VTP_STAGE_DIR/CSAR-VALIDATE.zip ]
- then
- wget -O $VTP_STAGE_DIR/CSAR-VALIDATE.zip $CSAR_VALIDATE_DOWNLOAD_URL
- wget -O $VTP_STAGE_DIR/CSAR.csar $SAMPLE_VTP_CSAR
- else
- echo $VTP_TRACK_MARK $CSAR_VALIDATE_DOWNLOAD_URL already downloded
- fi
-
- if [ ! -f $VTP_STAGE_DIR/TOMCAT.tar.gz ]
- then
- wget -O $VTP_STAGE_DIR/TOMCAT.tar.gz $TOMCAT8_DOWNLOAD_URL
- else
- echo $VTP_TRACK_MARK $TOMCAT8_DOWNLOAD_URL already downloded
- fi
-
- if [ ! -f $VTP_STAGE_DIR/VTP.zip ]
- then
- wget -O $VTP_STAGE_DIR/VTP.zip $VTP_DOWNLOAD_URL
- else
- echo $VTP_TRACK_MARK $VTP_DOWNLOAD_URL already downloded
- fi
-
- if [ ! -d $JAVA_HOME ]
- then
- apt-get install -y openjdk-8-jre
- else
- echo $VTP_TRACK_MARK JAVA already installed
- fi
+ echo $VTP_TRACK_MARK Downloading VTP binaries and setup the dependencies ...
+
+ apt-get install -y tar wget unzip git python3 python3-pip
+ pip3 install --upgrade pip
+
+ mkdir -p $VTP_STAGE_DIR
+
+ if [ ! -f $VTP_STAGE_DIR/CLI.zip ]
+ then
+ wget -O $VTP_STAGE_DIR/CLI.zip $OCLIP_DOWNLOAD_URL
+ else
+ echo $VTP_TRACK_MARK $OCLIP_DOWNLOAD_URL already downloded
+ fi
+
+ if [ ! -f $VTP_STAGE_DIR/CSAR-VALIDATE.zip ]
+ then
+ wget -O $VTP_STAGE_DIR/CSAR-VALIDATE.zip $CSAR_VALIDATE_DOWNLOAD_URL
+ wget -O $VTP_STAGE_DIR/CSAR.csar $SAMPLE_VTP_CSAR
+ else
+ echo $VTP_TRACK_MARK $CSAR_VALIDATE_DOWNLOAD_URL already downloded
+ fi
+
+ if [ ! -f $VTP_STAGE_DIR/TOMCAT.tar.gz ]
+ then
+ wget -O $VTP_STAGE_DIR/TOMCAT.tar.gz $TOMCAT8_DOWNLOAD_URL
+ else
+ echo $VTP_TRACK_MARK $TOMCAT8_DOWNLOAD_URL already downloded
+ fi
+
+ if [ ! -f $VTP_STAGE_DIR/VTP.zip ]
+ then
+ wget -O $VTP_STAGE_DIR/VTP.zip $VTP_DOWNLOAD_URL
+ else
+ echo $VTP_TRACK_MARK $VTP_DOWNLOAD_URL already downloded
+ fi
+
+ if [ ! -d $VTP_STAGE_DIR/vvp-validation-scripts ]
+ then
+ git clone $VVP_GITHUB $VTP_STAGE_DIR/vvp-validation-scripts
+ mkdir -p $VTP_STAGE_DIR/HOT
+ wget -O $VTP_STAGE_DIR/HOT/HOT.yaml $SAMPLE_VTP_HOT
+ else
+ echo $VTP_TRACK_MARK $VTP_DOWNLOAD_URL already cloned
+ fi
+
+ if [ ! -d $JAVA_HOME ]
+ then
+ apt-get install -y openjdk-8-jre
+ else
+ echo $VTP_TRACK_MARK JAVA already installed
+ fi
}
function vtp_backend_install() {
- if [ ! -f $OPEN_CLI_HOME/bin/oclip.sh ]
- then
- echo $VTP_TRACK_MARK Installing VTP Backend...
-
- mkdir -p $OPEN_CLI_HOME
- unzip $VTP_STAGE_DIR/CLI.zip -d $OPEN_CLI_HOME
- ln -s $OPEN_CLI_HOME/bin/oclip.sh $OPEN_CLI_HOME/bin/oclip
-
- echo $VTP_TRACK_MARK Installing CSAR Validation Test cases
- mkdir -p $OPEN_CLI_HOME/CSAR-VALIDATE
- unzip $VTP_STAGE_DIR/CSAR-VALIDATE.zip -d $OPEN_CLI_HOME/CSAR-VALIDATE
- cp $OPEN_CLI_HOME/CSAR-VALIDATE/validation-csar-*.jar $OPEN_CLI_HOME/lib
-
- echo $VTP_TRACK_MARK Configuring VTP Backend...
- cp $OPEN_CLI_HOME/conf/oclip.service /etc/systemd/system
- systemctl daemon-reload
- systemctl status oclip
- else
- echo "VTP Backend already installed"
- fi
+ if [ ! -f $OPEN_CLI_HOME/bin/oclip.sh ]
+ then
+ echo $VTP_TRACK_MARK Installing VTP Backend...
+
+ mkdir -p $OPEN_CLI_HOME
+ unzip $VTP_STAGE_DIR/CLI.zip -d $OPEN_CLI_HOME
+ ln -s $OPEN_CLI_HOME/bin/oclip.sh $OPEN_CLI_HOME/bin/oclip
+
+ echo $VTP_TRACK_MARK Configuring VTP Backend...
+ cp $OPEN_CLI_HOME/conf/oclip.service /etc/systemd/system
+ systemctl daemon-reload
+ systemctl status oclip
+ else
+ echo "VTP Backend already installed"
+ fi
+}
+
+function vtp_csar_validation_install() {
+ echo "$VTP_TRACK_MARK Installing CSAR Validation Test cases (TOSCA & HEAT)"
+ mkdir -p $OPEN_CLI_HOME/CSAR-VALIDATE
+ unzip $VTP_STAGE_DIR/CSAR-VALIDATE.zip -d $OPEN_CLI_HOME/CSAR-VALIDATE
+ cp $OPEN_CLI_HOME/CSAR-VALIDATE/validation-csar-*.jar $OPEN_CLI_HOME/lib
}
function vtp_controller_install() {
- if [ ! -d $CATALINA_HOME ]
- then
- echo $VTP_TRACK_MARK Installing Tomcat 8.5.3 ...
- mkdir -p $CATALINA_HOME
- tar --strip-components=1 -xf $VTP_STAGE_DIR/TOMCAT.tar.gz -C $CATALINA_HOME
- rm -rf $CATALINA_HOME/webapps
- mkdir -p $CATALINA_HOME/webapps/ROOT
-
- unzip $VTP_STAGE_DIR/VTP.zip -d $CATALINA_HOME/webapps/ROOT
- echo 'export CATALINA_OPTS="$CATALINA_OPTS -Xms64m -Xmx256m -XX:MaxPermSize=64m"' > $CATALINA_HOME/bin/setenv.sh
- echo 'export JAVA_OPTS="$JAVA_OPTS -Djava.security.egd=file:/dev/./urandom"' >> $CATALINA_HOME/bin/setenv.sh
- else
- echo "VTP Controller already installed"
- fi
+ if [ ! -d $CATALINA_HOME ]
+ then
+ echo $VTP_TRACK_MARK Installing Tomcat 8.5.3 ...
+ mkdir -p $CATALINA_HOME
+ tar --strip-components=1 -xf $VTP_STAGE_DIR/TOMCAT.tar.gz -C $CATALINA_HOME
+ rm -rf $CATALINA_HOME/webapps
+ mkdir -p $CATALINA_HOME/webapps/ROOT
+
+ unzip $VTP_STAGE_DIR/VTP.zip -d $CATALINA_HOME/webapps/ROOT
+ echo 'export CATALINA_OPTS="$CATALINA_OPTS -Xms64m -Xmx256m -XX:MaxPermSize=64m"' > $CATALINA_HOME/bin/setenv.sh
+ echo 'export JAVA_OPTS="$JAVA_OPTS -Djava.security.egd=file:/dev/./urandom"' >> $CATALINA_HOME/bin/setenv.sh
+ else
+ echo "VTP Controller already installed"
+ fi
}
function vtp_start() {
- echo $VTP_TRACK_MARK Starting VTP Backend...
- systemctl start oclip
- systemctl status oclip --no-pager
+ echo $VTP_TRACK_MARK Starting VTP Backend...
+ systemctl start oclip
+ systemctl status oclip --no-pager
- echo $VTP_TRACK_MARK Starting VTP Controller...
- $CATALINA_HOME/bin/startup.sh
+ echo $VTP_TRACK_MARK Starting VTP Controller...
+ $CATALINA_HOME/bin/startup.sh
}
function vtp_stop() {
- echo $VTP_TRACK_MARK Starting VTP Backend...
- systemctl stop oclip
- systemctl status oclip --no-pager
+ echo $VTP_TRACK_MARK Stoping VTP Backend...
+ systemctl stop oclip
+ systemctl status oclip --no-pager
- echo $VTP_TRACK_MARK Starting VTP Controller...
- $CATALINA_HOME/bin/shutdown.sh
+ echo $VTP_TRACK_MARK Stoping VTP Controller...
+ $CATALINA_HOME/bin/shutdown.sh
}
function vtp_purge() {
- #Stop services
- vtp_stop
+ #Stop services
+ vtp_stop
+
+ #Stop tracking
+ jobs -p | xargs kill -9
- #Stop tracking
- jobs -p | xargs kill -9
+ echo $VTP_TRACK_MARK Purging VTP...
+ rm -rf $OPEN_CLI_HOME
+ rm -rf $CATALINA_HOME
- echo $VTP_TRACK_MARK Purging VTP...
- rm -rf $OPEN_CLI_HOME
- rm -rf $CATALINA_HOME
+ vtp_vvp_uninstall
}
function vtp_trace() {
- tailf $CATALINA_HOME/logs/catalina.out &
- tailf $OPEN_CLI_HOME/logs/open-cli.log &
+ tailf $CATALINA_HOME/logs/catalina.out &
+ tailf $OPEN_CLI_HOME/logs/open-cli.log &
+}
+
+function vtp_vvp_install() {
+ echo $VTP_TRACK_MARK Installing VVP scripts
+ _CWD=`pwd`
+ cd $VTP_STAGE_DIR/vvp-validation-scripts
+ pip install -r requirements.txt
+ cd $_CWD
+}
+
+function vtp_vvp_uninstall() {
+ echo $VTP_TRACK_MARK Installing VVP scripts
+ _CWD=`pwd`
+ cd $VTP_STAGE_DIR/vvp-validation-scripts
+ pip uninstall -y -r requirements.txt
+ cd $_CWD
+}
+
+function vtp_sample_scenario_install() {
+ echo $VTP_TRACK_MARK Installing sample scenarios...
+ mkdir -p $OPEN_CLI_HOME/open-cli-schema/sample-scenarios
+ cp -r $CATALINA_HOME/webapps/ROOT/WEB-INF/classes/sample-vtp-scenarios/open-cli-schema/ $OPEN_CLI_HOME/open-cli-schema/sample-scenarios
+}
+
+function vtp_test() {
+ oclip --product onap-vtp csar-validate --csar $VTP_STAGE_DIR/CSAR.csar
+ oclip --product onap-vtp hot-validate --hot-folder $VTP_STAGE_DIR/HOT --format json
+}
+
+function vtp_setup() {
+ vtp_download
+ vtp_backend_install
+ vtp_controller_install
+ vtp_csar_validation_install
+ vtp_vvp_install
+ vtp_sample_scenario_install
+ vtp_start
+ vtp_test
}
+if [[ $1 == '--install' ]]
+then
+ vtp_setup
+elif [[ $1 == '--uninstall' ]]
+then
+ vtp_purge
+elif [[ $1 == '--stop' ]]
+then
+ vtp_stop
+elif [[ $1 == '--start' ]]
+then
+ vtp_start
+elif [[ $1 == '--verify' ]]
+then
+ vtp_test
+else
+ echo "$0 [ --install | --uninstall | --start | --stop | --verify]"
+fi \ No newline at end of file