+ if [ $paramerror -eq 0 ]; then
+ if [ "$1" == "--stop-at-error" ]; then
+ STOP_AT_ERROR=1
+ echo "Option set - Stop at first error"
+ shift;
+ foundparm=0
+ fi
+ fi
+ if [ $paramerror -eq 0 ]; then
+ if [ "$1" == "--ricsim-prefix" ]; then
+ shift;
+ TMP_RIC_SIM_PREFIX=$1 #RIC_SIM_PREFIX need to be updated after sourcing of the env file
+ if [ -z "$1" ]; then
+ paramerror=1
+ if [ -z "$paramerror_str" ]; then
+ paramerror_str="No prefix found for flag: '--ricsim-prefix'"
+ fi
+ else
+ echo "Option set - Overriding RIC_SIM_PREFIX with: "$1
+ shift;
+ foundparm=0
+ fi
+ fi
+ fi
+ if [ $paramerror -eq 0 ]; then
+ if [ "$1" == "--env-file" ]; then
+ shift;
+ TEST_ENV_VAR_FILE=$1
+ if [ -z "$1" ]; then
+ paramerror=1
+ if [ -z "$paramerror_str" ]; then
+ paramerror_str="No env file found for flag: '--env-file'"
+ fi
+ else
+ echo "Option set - Reading test env from: "$1
+ shift;
+ foundparm=0
+ fi
+ fi
+ fi
+ if [ $paramerror -eq 0 ]; then
+ if [ "$1" == "--use-local-image" ]; then
+ USE_LOCAL_IMAGES=""
+ shift
+ while [ $# -gt 0 ] && [[ "$1" != "--"* ]]; do
+ USE_LOCAL_IMAGES=$USE_LOCAL_IMAGES" "$1
+ if [[ "$AVAILABLE_IMAGES_OVERRIDE" != *"$1"* ]]; then
+ paramerror=1
+ if [ -z "$paramerror_str" ]; then
+ paramerror_str="App name $1 is not available for local override for flag: '--use-local-image'"
+ fi
+ fi
+ shift;
+ done
+ foundparm=0
+ if [ -z "$USE_LOCAL_IMAGES" ]; then
+ paramerror=1
+ if [ -z "$paramerror_str" ]; then
+ paramerror_str="No app name found for flag: '--use-local-image'"
+ fi
+ else
+ echo "Option set - Overriding with local images for app(s):"$USE_LOCAL_IMAGES
+ fi
+ fi
+ fi
+ if [ $paramerror -eq 0 ]; then
+ if [ "$1" == "--use-snapshot-image" ]; then
+ USE_SNAPSHOT_IMAGES=""
+ shift
+ while [ $# -gt 0 ] && [[ "$1" != "--"* ]]; do
+ USE_SNAPSHOT_IMAGES=$USE_SNAPSHOT_IMAGES" "$1
+ if [[ "$AVAILABLE_IMAGES_OVERRIDE" != *"$1"* ]]; then
+ paramerror=1
+ if [ -z "$paramerror_str" ]; then
+ paramerror_str="App name $1 is not available for snapshot override for flag: '--use-snapshot-image'"
+ fi
+ fi
+ shift;
+ done
+ foundparm=0
+ if [ -z "$USE_SNAPSHOT_IMAGES" ]; then
+ paramerror=1
+ if [ -z "$paramerror_str" ]; then
+ paramerror_str="No app name found for flag: '--use-snapshot-image'"
+ fi
+ else
+ echo "Option set - Overriding with snapshot images for app(s):"$USE_SNAPSHOT_IMAGES
+ fi
+ fi
+ fi
+ if [ $paramerror -eq 0 ]; then
+ if [ "$1" == "--use-staging-image" ]; then
+ USE_STAGING_IMAGES=""
+ shift
+ while [ $# -gt 0 ] && [[ "$1" != "--"* ]]; do
+ USE_STAGING_IMAGES=$USE_STAGING_IMAGES" "$1
+ if [[ "$AVAILABLE_IMAGES_OVERRIDE" != *"$1"* ]]; then
+ paramerror=1
+ if [ -z "$paramerror_str" ]; then
+ paramerror_str="App name $1 is not available for staging override for flag: '--use-staging-image'"
+ fi
+ fi
+ shift;
+ done
+ foundparm=0
+ if [ -z "$USE_STAGING_IMAGES" ]; then
+ paramerror=1
+ if [ -z "$paramerror_str" ]; then
+ paramerror_str="No app name found for flag: '--use-staging-image'"
+ fi
+ else
+ echo "Option set - Overriding with staging images for app(s):"$USE_STAGING_IMAGES
+ fi
+ fi
+ fi
+ if [ $paramerror -eq 0 ]; then
+ if [ "$1" == "--use-release-image" ]; then
+ USE_RELEASE_IMAGES=""
+ shift
+ while [ $# -gt 0 ] && [[ "$1" != "--"* ]]; do
+ USE_RELEASE_IMAGES=$USE_RELEASE_IMAGES" "$1
+ if [[ "$AVAILABLE_IMAGES_OVERRIDE" != *"$1"* ]]; then
+ paramerror=1
+ if [ -z "$paramerror_str" ]; then
+ paramerror_str="App name $1 is not available for release override for flag: '--use-release-image'"
+ fi
+ fi
+ shift;
+ done
+ foundparm=0
+ if [ -z "$USE_RELEASE_IMAGES" ]; then
+ paramerror=1
+ if [ -z "$paramerror_str" ]; then
+ paramerror_str="No app name found for flag: '--use-release-image'"
+ fi
+ else
+ echo "Option set - Overriding with release images for app(s):"$USE_RELEASE_IMAGES
+ fi
+ fi
+ fi
+ if [ $paramerror -eq 0 ]; then
+ if [ "$1" == "--image-repo" ]; then
+ shift;
+ IMAGE_REPO_ADR=$1
+ if [ -z "$1" ]; then
+ paramerror=1
+ if [ -z "$paramerror_str" ]; then
+ paramerror_str="No image repo url found for : '--image-repo'"
+ fi
+ else
+ echo "Option set - Image repo url: "$1
+ shift;
+ foundparm=0
+ fi
+ fi
+ fi
+ if [ $paramerror -eq 0 ]; then
+ if [ "$1" == "--repo-policy" ]; then
+ shift;
+ IMAGE_REPO_POLICY=$1
+ if [ -z "$1" ]; then
+ paramerror=1
+ if [ -z "$paramerror_str" ]; then
+ paramerror_str="No policy found for : '--repo-policy'"
+ fi
+ else
+ if [ "$1" == "local" ] || [ "$1" == "remote" ]; then
+ echo "Option set - Image repo policy: "$1
+ shift;
+ foundparm=0
+ else
+ paramerror=1
+ if [ -z "$paramerror_str" ]; then
+ paramerror_str="Repo policy shall be 'local' or 'remote'"
+ fi
+ fi
+ fi
+ fi
+ fi
+ if [ $paramerror -eq 0 ]; then
+ if [ "$1" == "--cluster-timeout" ]; then
+ shift;
+ CLUSTER_TIME_OUT=$1
+ if [ -z "$1" ]; then
+ paramerror=1
+ if [ -z "$paramerror_str" ]; then
+ paramerror_str="No timeout value found for : '--cluster-timeout'"
+ fi
+ else
+ #Check if positive int
+ case ${CLUSTER_TIME_OUT#[+]} in
+ *[!0-9]* | '')
+ paramerror=1
+ if [ -z "$paramerror_str" ]; then
+ paramerror_str="Value for '--cluster-timeout' not an int : "$CLUSTER_TIME_OUT
+ fi
+ ;;
+ * ) ;; # Ok
+ esac
+ echo "Option set - Cluster timeout: "$1
+ shift;
+ foundparm=0
+ fi
+ fi
+ fi
+ if [ $paramerror -eq 0 ]; then
+ if [ "$1" == "--override" ]; then
+ shift;
+ TEST_ENV_VAR_FILE_OVERRIDE=$1
+ if [ -z "$1" ]; then
+ paramerror=1
+ if [ -z "$paramerror_str" ]; then
+ paramerror_str="No env file found for flag: '--override'"
+ fi
+ else
+ if [ ! -f $TEST_ENV_VAR_FILE_OVERRIDE ]; then
+ paramerror=1
+ if [ -z "$paramerror_str" ]; then
+ paramerror_str="File for '--override' does not exist : "$TEST_ENV_VAR_FILE_OVERRIDE
+ fi
+ fi
+ echo "Option set - Override env from: "$1
+ shift;
+ foundparm=0
+ fi
+ fi
+ fi
+ if [ $paramerror -eq 0 ]; then
+ if [ "$1" == "--pre-clean" ]; then
+ PRE_CLEAN=1
+ echo "Option set - Pre-clean of kube/docker resouces"
+ shift;
+ foundparm=0
+ fi
+ fi
+ if [ $paramerror -eq 0 ]; then
+ if [ "$1" == "--print-stats" ]; then
+ PRINT_CURRENT_STATS=1
+ echo "Option set - Print stats after every test-case and config"
+ shift;
+ foundparm=0
+ fi
+ fi
+ if [ $paramerror -eq 0 ]; then
+ if [ "$1" == "--gen-stats" ]; then
+ COLLECT_RUNTIME_STATS=1
+ echo "Option set - Collect runtime statistics"
+ shift;
+ foundparm=0
+ fi
+ fi
+ if [ $paramerror -eq 0 ]; then
+ if [ "$1" == "--delete-namespaces" ]; then
+ if [ $RUNMODE == "DOCKER" ]; then
+ DELETE_KUBE_NAMESPACES=0
+ echo "Option ignored - Delete namespaces (ignored when running docker)"
+ else
+ if [ -z "KUBE_PRESTARTED_IMAGES" ]; then
+ DELETE_KUBE_NAMESPACES=0
+ echo "Option ignored - Delete namespaces (ignored when using prestarted apps)"
+ else
+ DELETE_KUBE_NAMESPACES=1
+ echo "Option set - Delete namespaces"
+ fi
+ fi
+ shift;
+ foundparm=0
+ fi
+ fi
+ if [ $paramerror -eq 0 ]; then
+ if [ "$1" == "--delete-containers" ]; then
+ if [ $RUNMODE == "DOCKER" ]; then
+ DELETE_CONTAINERS=1
+ echo "Option set - Delete containers started by previous test(s)"
+ else
+ echo "Option ignored - Delete containers (ignored when running kube)"
+ fi
+ shift;
+ foundparm=0
+ fi
+ fi
+ if [ $paramerror -eq 0 ]; then
+ if [ "$1" == "--endpoint-stats" ]; then
+ COLLECT_ENDPOINT_STATS=1
+ echo "Option set - Collect endpoint statistics"
+ shift;
+ foundparm=0
+ fi
+ fi
+
+done
+echo ""