From 4090169f9d979edb8693d17fe9c01f31ba3fe6a5 Mon Sep 17 00:00:00 2001 From: Gilles Thouenon Date: Fri, 2 Feb 2024 17:52:55 +0100 Subject: [PATCH] Add a tox profile to install lightynode - create a new tox profile that install lightynode - fix a bug when lightynode directory was not present - adapt the shell script to be able to specify eiter a specific released or snapshot version to install - make tox fail when download fails JIRA: TRNSPRTPCE-754 Signed-off-by: Gilles Thouenon Change-Id: I8660893e48a02d6c355fb6d63778ee5667cd2b69 --- tests/install_lightynode.sh | 21 +++++++++++++++++---- tox.ini | 7 +++++++ 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/tests/install_lightynode.sh b/tests/install_lightynode.sh index 50102621d..6d1f52e20 100755 --- a/tests/install_lightynode.sh +++ b/tests/install_lightynode.sh @@ -2,6 +2,8 @@ #set -x +PLUGIN_VERSION=${1:-19.1.0.3} + #check if curl exists if ! [ -x "$(command -v curl)" ];then echo "curl is not installed." >&2 @@ -13,11 +15,22 @@ if ! [ -x "$(command -v unzip)" ];then exit 1 fi -PLUGIN_VERSION=18.1.0.8 +if [ -n "$2" ];then + echo "Using lighynode version $1 $2" + FILE_NAME="lighty-openroadm-device-$(echo $1 | cut -d - -f 1)-$2-bin.zip" + TARGET_URL="https://gitlab.com/api/v4/projects/36076125/packages/maven/io/lighty/transportpce/netconf/device/lighty-openroadm-device/$PLUGIN_VERSION/${FILE_NAME}" +else + echo "Using lighynode version $PLUGIN_VERSION" + 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" +fi + TARGET_DIR=$(dirname $0)/lightynode INSTALL_DIR=$TARGET_DIR/lightynode-openroadm-device ARTIFACT_ZIPFILE=$TARGET_DIR/artifact.zip -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" +if ! [ -d "$TARGET_DIR" ];then + echo "Creating 'lightynode' directory." + mkdir lightynode +fi #clean lightynode install directory if [ -d "$INSTALL_DIR" ];then @@ -28,8 +41,8 @@ fi #download lightynode and install it #complete source code can be found at https://gitlab.com/Orange-OpenSource/lfn/odl/lightynode-simulator.git echo "Installing lightynode device 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 +curl --retry-delay 10 --retry 3 -sS --fail --location --request GET $TARGET_URL -o $ARTIFACT_ZIPFILE || exit 2 +unzip -q -o $ARTIFACT_ZIPFILE -d $TARGET_DIR rm -f $ARTIFACT_ZIPFILE mv $TARGET_DIR/lighty-openroadm-device-$PLUGIN_VERSION $INSTALL_DIR diff --git a/tox.ini b/tox.ini index 1c3d9abf6..2f79e5810 100644 --- a/tox.ini +++ b/tox.ini @@ -62,6 +62,13 @@ changedir = {toxinidir}/lighty commands = ./build.sh +[testenv:sims] +passenv = USE_SIMS +allowlist_externals = install_lightynode.sh +depends = buildcontroller +commands = + ./install_lightynode.sh {posargs:} + [testenv:sims121] passenv = USE_SIMS allowlist_externals = install_sims.sh -- 2.36.6