diff options
Diffstat (limited to 'vnfmarket-be/deployment')
-rw-r--r-- | vnfmarket-be/deployment/install/vtp_install.sh | 267 |
1 files changed, 134 insertions, 133 deletions
diff --git a/vnfmarket-be/deployment/install/vtp_install.sh b/vnfmarket-be/deployment/install/vtp_install.sh index 7c71977a..a6a425cc 100644 --- a/vnfmarket-be/deployment/install/vtp_install.sh +++ b/vnfmarket-be/deployment/install/vtp_install.sh @@ -49,191 +49,192 @@ 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 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 + 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 + git checkout casablanca + 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 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 + 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 Stoping 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 Stoping 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 + 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 + 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 + 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 + 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 + 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 + 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 + vtp_setup elif [[ $1 == '--uninstall' ]] then - vtp_purge + vtp_purge elif [[ $1 == '--stop' ]] then - vtp_stop + vtp_stop elif [[ $1 == '--start' ]] then - vtp_start + vtp_start elif [[ $1 == '--verify' ]] then - vtp_test + vtp_test else - echo "$0 [ --install | --uninstall | --start | --stop | --verify]" + echo "$0 [ --install | --uninstall | --start | --stop | --verify]" fi
\ No newline at end of file |