50102621db6348c9020576a6b03f675833c27dc8
[transportpce.git] / tests / install_lightynode.sh
1 #!/bin/sh
2
3 #set -x
4
5 #check if curl exists
6 if ! [ -x "$(command -v curl)" ];then
7     echo "curl is not installed." >&2
8     exit 1
9 fi
10 #check if unzip exists
11 if ! [ -x "$(command -v unzip)" ];then
12     echo "unzip is not installed." >&2
13     exit 1
14 fi
15
16 PLUGIN_VERSION=18.1.0.8
17 TARGET_DIR=$(dirname $0)/lightynode
18 INSTALL_DIR=$TARGET_DIR/lightynode-openroadm-device
19 ARTIFACT_ZIPFILE=$TARGET_DIR/artifact.zip
20 TARGET_URL="https://gitlab.com/api/v4/projects/36076125/packages/maven/io/lighty/transportpce/netconf/device/lighty-openroadm-device/$PLUGIN_VERSION/lighty-openroadm-device-$PLUGIN_VERSION-bin.zip"
21
22 #clean lightynode install directory
23 if [ -d "$INSTALL_DIR" ];then
24     echo "Removing $INSTALL_DIR directory"
25     rm -rf $INSTALL_DIR
26 fi
27
28 #download lightynode  and install it
29 #complete source code can be found at https://gitlab.com/Orange-OpenSource/lfn/odl/lightynode-simulator.git
30 echo "Installing lightynode device to $INSTALL_DIR directory "
31 curl --retry-delay 10 --retry 3 -sS --location --request GET $TARGET_URL -o $ARTIFACT_ZIPFILE || exit 2
32 unzip -q $ARTIFACT_ZIPFILE -d $TARGET_DIR
33 rm -f $ARTIFACT_ZIPFILE
34 mv $TARGET_DIR/lighty-openroadm-device-$PLUGIN_VERSION $INSTALL_DIR
35
36 #update 1.2.1 openroadm device configuration samples to be compliant with 1.2.1
37 #device models ("multi-wavelegnth" instead of "multi-wavelength" whose typo has been solved with 2.2.1 device models)
38 sed -i_ 's/multi-wavelength/multi-wavelegnth/g' $(dirname $0)/sample_configs/openroadm/1.2.1/oper-ROADM*.xml