X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=tests%2Finstall_honeynode.sh;h=6ed3dd3ba73056327db68091cabd6611b49d5377;hb=8d3c52f42c45987cdd8328cd918ca56f3400c016;hp=ce31f6f817d5ab243002493dbd1f30902139b7a3;hpb=8450c7d0372e20bbe2ddbd56079d8cfa29319767;p=transportpce.git diff --git a/tests/install_honeynode.sh b/tests/install_honeynode.sh index ce31f6f81..6ed3dd3ba 100755 --- a/tests/install_honeynode.sh +++ b/tests/install_honeynode.sh @@ -1,7 +1,9 @@ -#/bin/sh +#!/bin/sh #set -x +VERSIONS_LIST=${@:-"1.2.1 2.2.1 7.1"} + #check if curl exists if ! [ -x "$(command -v curl)" ];then echo "curl is not installed." >&2 @@ -13,24 +15,38 @@ if ! [ -x "$(command -v unzip)" ];then exit 1 fi -#clean honeynode directories +for VERSION in $VERSIONS_LIST +do + case "$VERSION" in + "1.2.1") PLUGIN_VERSION=1.0.8 + ;; + "2.2.1") PLUGIN_VERSION=2.0.8 + ;; + "7.1") PLUGIN_VERSION=7.1.5 + ;; + *) echo "unsupported device version" >&2 + continue + ;; + esac + TARGET_DIR=$(dirname $0)/honeynode/$VERSION + INSTALL_DIR=$TARGET_DIR/honeynode-simulator + ARTIFACT_ZIPFILE=$TARGET_DIR/artifact.zip + TARGET_URL="https://gitlab.com/api/v4/projects/17518226/jobs/artifacts/honeynode-plugin-aggregator-$PLUGIN_VERSION/download?job=mvn-build" -if [ -d "$(dirname $0)/honeynode/1.2.1/honeynode-simulator" ];then - echo "Removing $(dirname $0)/honeynode/1.2.1/honeynode-simulator directory" - rm -rf $(dirname $0)/honeynode/1.2.1/honeynode-simulator -fi -if [ -d "$(dirname $0)/honeynode/2.2.1/honeynode-simulator" ];then - echo "Removing $(dirname $0)/honeynode/2.2.1/honeynode-simulator directory" - rm -rf $(dirname $0)/honeynode/2.2.1/honeynode-simulator -fi -#download honeynode for 1.2.1 devices and install it -#complete source code can be found at https://gitlab.com/Orange-OpenSource/lfn/odl/honeynode-simulator.git -echo "Installing honeynode for 1.2.1 devices to $(dirname $0)/honeynode/1.2.1/honeynode-simulator directory " -curl --location --request GET "https://gitlab.com/api/v4/projects/17518226/jobs/artifacts/honeynode-plugin-aggregator-1.0.3/download?job=mvn-build" -o $(dirname $0)/honeynode/1.2.1/artifact.zip -unzip $(dirname $0)/honeynode/1.2.1/artifact.zip -d $(dirname $0)/honeynode/1.2.1 -rm -f $(dirname $0)/honeynode/1.2.1/artifact.zip -#download honeynode for 2.2.1 devices and install it -echo "Installing honeynode for 2.2.1 devices to $(dirname $0)/honeynode/2.2.1/honeynode-simulator directory " -curl --location --request GET "https://gitlab.com/api/v4/projects/17518226/jobs/artifacts/honeynode-plugin-aggregator-2.0.4/download?job=mvn-build" -o $(dirname $0)/honeynode/2.2.1/artifact.zip -unzip $(dirname $0)/honeynode/2.2.1/artifact.zip -d $(dirname $0)/honeynode/2.2.1 -rm -f $(dirname $0)/honeynode/2.2.1/artifact.zip + #clean honeynode install directory + + if [ -d "$INSTALL_DIR" ];then + echo "Removing $INSTALL_DIR directory" + rm -rf $INSTALL_DIR + fi + + #download honeynode and install it + #complete source code can be found at https://gitlab.com/Orange-OpenSource/lfn/odl/honeynode-simulator.git + + echo "Installing honeynode for $VERSION devices to $INSTALL_DIR directory " + curl --retry-delay 10 --retry 3 -sS --location --request GET $TARGET_URL -o $ARTIFACT_ZIPFILE || exit 2 + unzip -q $ARTIFACT_ZIPFILE -d $TARGET_DIR + rm -f $ARTIFACT_ZIPFILE + +done +exit