#!/bin/bash
#
# Copyright 2024 Nordix Foundation.

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# Script to run the ACM regression test suite in cucumber.
# Deploys ACM-R and participants in two different release branch/versions for testing backward compatibility.

function usage() {
  echo "Usage: $0 --release <acmr-release_branch> <ppnt-release_branch> | --version <acmr-version> <ppnt-version>"
  exit 1
}

# Legacy config files for releases up to 'newdelhi'
function release_config_path() {
  if [ $1 == 'master' ] || [[ "$(echo "$1" | cut -c1 )" > 'n' ]]; then
    echo "config/clamp"
  else
    echo "config/clamp/legacy"
  fi
}

# Legacy config files for versions before 8.0.0
function version_config_path() {
  if [[ "$(printf '%s\n' "$1" "8.0.0" | sort -V | head -n 1)" == "8.0.0" ]]; then
    echo "config/clamp"
  else
    echo "config/clamp/legacy"
  fi
}

function validate_version() {
    local version=$1
    if [[ ! $version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
        echo "Invalid version format: $version. Expected format: x.y.z where x, y, and z are numbers."
        usage
    fi
}

function validate_release() {
    local release=$1
    if [[ ! $release =~ ^[a-zA-Z._-]+$ ]]; then
        echo "Invalid release format: $release. Expected a string release name"
        usage
    fi
}

# Invalid input
if [ "$#" -ne 0 ] && [ "$#" -ne 3 ]; then
  usage
fi

if [ -z "${WORKSPACE}" ]; then
    WORKSPACE=$(git rev-parse --show-toplevel)
    export WORKSPACE
fi

if [ -z "$ROBOT_LOG_DIR" ]; then
  export ROBOT_LOG_DIR=/tmp/
fi

export SCRIPTS="${WORKSPACE}/csit/resources/scripts"
COMPOSE_FOLDER="${WORKSPACE}"/compose
REGRESSION_FOLDER="${WORKSPACE}"/policy-regression-tests/policy-clamp-regression/
export PROJECT='clamp'
DEFAULT_BRANCH=$(awk -F= '$1 == "defaultbranch" { print $2 }' \
                            "${WORKSPACE}"/.gitreview)

# Run from default branch
if [ $# -eq 0 ]
then
  echo "Usage: $0 --release <acmr-release_branch> <ppnt-release_branch> | --version <acmr-version> <ppnt-version>"
  echo "*** No release_branch/versions provided. Default branch will be used."
  echo "Fetching image versions for all components..."
  source ${COMPOSE_FOLDER}/get-versions-regression.sh $DEFAULT_BRANCH $DEFAULT_BRANCH > /dev/null 2>&1
  echo "Starting Regression with ACM-R and PPNT from the default release branch $DEFAULT_BRANCH ***"
  export CLAMP_CONFIG_PATH=$(release_config_path "$DEFAULT_BRANCH")
  export PPNT_CONFIG_PATH="$CLAMP_CONFIG_PATH"
  echo "Using configuration file located at $CLAMP_CONFIG_PATH for ACM-R and $PPNT_CONFIG_PATH for PPNTS."

# Run with specific release/version
elif [ "$#" -gt 0 ]
then
  case $1 in
    --release)
      validate_release $2
      validate_release $3
      echo "Fetching image versions for all components..."
      source ${COMPOSE_FOLDER}/get-versions-regression.sh $2 $3 > /dev/null 2>&1
      echo "*** Starting Regression with ACM-R from branch $2 and PPNT from branch $3 ***"
      export CLAMP_CONFIG_PATH=$(release_config_path $2)
      export PPNT_CONFIG_PATH=$(release_config_path $3)
      echo "Using configuration file located at $CLAMP_CONFIG_PATH for ACM-R and $PPNT_CONFIG_PATH for PPNTS." 
      ;;
    --version)
      validate_version $2
      validate_version $3
      echo "Fetching image versions for all components..."
      source ${COMPOSE_FOLDER}/get-versions-regression.sh $DEFAULT_BRANCH $DEFAULT_BRANCH > /dev/null 2>&1
      export POLICY_CLAMP_VERSION=$2
      export POLICY_CLAMP_PPNT_VERSION=$3
      echo "*** Starting Regression with ACM-R version $2 and PPNT version $3 ***"
      export CLAMP_CONFIG_PATH=$(version_config_path "$2")
      export PPNT_CONFIG_PATH=$(version_config_path "$3")
      echo "Using configuration file located at $CLAMP_CONFIG_PATH for ACM-R and $PPNT_CONFIG_PATH for PPNTS."
      ;;
    *)
      echo "Unknown parameter: $1"
      usage
      ;;
  esac
fi

echo "*** Configure docker compose and trigger deployment***"
cd ${COMPOSE_FOLDER}
docker login -u docker -p docker nexus3.onap.org:10001 > /dev/null 2>&1
source export-ports.sh > /dev/null 2>&1

docker compose -f docker-compose.yml up -d "policy-clamp-runtime-acm"

# wait for the app to start up
"${SCRIPTS}"/wait_for_rest.sh localhost "${ACM_PORT}"

cd ${REGRESSION_FOLDER}

# Invoke the regression test cases
mvn clean test -Dtests.skip=false

