Add lightynode support to testutils.py
[transportpce.git] / tests / install_honeynode.sh
1 #!/bin/sh
2
3 #set -x
4
5 VERSIONS_LIST=${@:-"1.2.1 2.2.1 7.1"}
6
7 #check if curl exists
8 if ! [ -x "$(command -v curl)" ];then
9     echo "curl is not installed." >&2
10     exit 1
11 fi
12 #check if unzip exists
13 if ! [ -x "$(command -v unzip)" ];then
14     echo "unzip is not installed." >&2
15     exit 1
16 fi
17
18 for VERSION in $VERSIONS_LIST
19 do
20     case "$VERSION" in
21         "1.2.1") PLUGIN_VERSION=1.0.9
22         #update 1.2.1 openroadm device configuration samples to be compliant with honeynode
23         #device models ("multi-wavelegnth" instead of "multi-wavelength" whose typo has been solved with 2.2.1 device models)
24         sed -i_ 's/multi-wavelegnth/multi-wavelength/g' $(dirname $0)/sample_configs/openroadm/1.2.1/oper-ROADM*.xml
25         ;;
26         "2.2.1") PLUGIN_VERSION=2.0.10
27         ;;
28         "7.1") PLUGIN_VERSION=7.1.9
29         ;;
30         *) echo "unsupported device version" >&2
31         continue
32         ;;
33     esac
34     TARGET_DIR=$(dirname $0)/honeynode/$VERSION
35     INSTALL_DIR=$TARGET_DIR/honeynode-simulator
36     ARTIFACT_ZIPFILE=$TARGET_DIR/artifact.zip
37     TARGET_URL="https://gitlab.com/api/v4/projects/17518226/jobs/artifacts/honeynode-plugin-aggregator-$PLUGIN_VERSION/download?job=mvn-build"
38
39     #clean honeynode install directory
40
41     if [ -d "$INSTALL_DIR" ];then
42         echo "Removing $INSTALL_DIR directory"
43         rm -rf $INSTALL_DIR
44     fi
45
46     #download honeynode  and install it
47     #complete source code can be found at https://gitlab.com/Orange-OpenSource/lfn/odl/honeynode-simulator.git
48
49     echo "Installing honeynode for $VERSION devices to $INSTALL_DIR directory "
50     curl --retry-delay 10 --retry 3 -sS --location --request GET $TARGET_URL -o $ARTIFACT_ZIPFILE || exit 2
51     unzip -q $ARTIFACT_ZIPFILE -d $TARGET_DIR
52     rm -f $ARTIFACT_ZIPFILE
53
54 done
55 exit