Override tests with external images 66/8566/2
authorBjornMagnussonXA <bjorn.magnusson@est.tech>
Wed, 15 Jun 2022 08:19:00 +0000 (10:19 +0200)
committerBjornMagnussonXA <bjorn.magnusson@est.tech>
Thu, 16 Jun 2022 08:05:03 +0000 (10:05 +0200)
Issue-ID: NONRTRIC-767
Signed-off-by: BjornMagnussonXA <bjorn.magnusson@est.tech>
Change-Id: Ibbda7a72db36442ae1c4962b80f2ca3d327adce4

test/auto-test/override_external_a1pms.sh [moved from test/auto-test/override_alternative_a1pms.sh with 67% similarity]
test/common/README.md
test/common/testcase_common.sh

similarity index 67%
rename from test/auto-test/override_alternative_a1pms.sh
rename to test/auto-test/override_external_a1pms.sh
index 7cae22e..9da7c7c 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/bash
 ################################################################################
-#   Copyright (c) 2021 Nordix Foundation.                                      #
+#   Copyright (c) 2022 Nordix Foundation.                                      #
 #                                                                              #
 #   Licensed under the Apache License, Version 2.0 (the "License");            #
 #   you may not use this file except in compliance with the License.           #
 #   limitations under the License.                                             #
 ################################################################################
 
-# Override file for running the latest alternative a1 pms image
+# Override file for running external a1 pms image
 
-# NOTE: This image is aussmed to be located in a different image repo (other than oran and onap)
-# NOTE: Begin with manually pulling the image to your local docker image reqistry
-# NOTE: Re-tag the image to: alternative-a1pms:<image-tag>     (use same tage is specified in var A1PMS_IMAGE_TAG_LOCAL below)
-# NOTE: Run the test using the flags "--use-local-image A1PMS --override override_alternative_a1pms.sh"
+# NOTE: This image is assumed to be located in a different image repo (other than oran and onap)
+# NOTE: The image tag "EXTERNAL" indicate that the IMAGE_BASE var contains the full image repo path
 
-A1PMS_IMAGE_BASE="alternative-a1pms"
-A1PMS_IMAGE_TAG_LOCAL="1.4.0-SNAPSHOT"
+A1PMS_IMAGE_BASE="<full image repo path - except the image tag>"
+A1PMS_IMAGE_TAG_EXTERNAL="<tag>"
index d46b416..c61debb 100644 (file)
@@ -173,7 +173,7 @@ The script can be started with these arguments
 
 | arg list |
 |--|
-| `remote\|remote-remove docker\|kube --env-file <environment-filename> [release] [auto-clean] [--stop-at-error] [--ricsim-prefix <prefix> ] [--use-local-image <app-nam>+]  [--use-snapshot-image <app-nam>+] [--use-staging-image <app-nam>+] [--use-release-image <app-nam>+] [--image-repo <repo-address>] [--repo-policy local\|remote] [--cluster-timeout <timeout-in-seconds>]  [--print-stats]` |
+| `remote\|remote-remove docker\|kube --env-file <environment-filename> [release] [auto-clean] [--stop-at-error] [--ricsim-prefix <prefix> ] [--use-local-image <app-nam>+]  [--use-snapshot-image <app-nam>+] [--use-staging-image <app-nam>+] [--use-release-image <app-nam>+] [--use-external-image <app-nam>+] [--image-repo <repo-address>] [--repo-policy local\|remote] [--cluster-timeout <timeout-in-seconds>]  [--print-stats]` |
 
 | parameter | description |
 |-|-|
@@ -190,6 +190,7 @@ The script can be started with these arguments
 | `--use-snapshot-image` | The script will use images from the nexus snapshot repo for the supplied apps, space separated list of app short names |
 | `--use-staging-image` | The script will use images from the nexus staging repo for the supplied apps, space separated list of app short names |
 | `--use-release-image` | The script will use images from the nexus release repo for the supplied apps, space separated list of app short names |
+| `--use-external-image` | The script will use images from an external repo for the supplied apps, space separated list of app short names |
 | `--image-repo` |  Url to optional image repo. Only locally built images will be re-tagged and pushed to this repo |
 | `-repo-policy` |  Policy controlling which images to re-tag and push to image repo in param --image-repo. Can be set to 'local' (push only locally built images) or 'remote' (push locally built images and images from nexus repo). Default is 'local' |
 | `--cluster-timeout` |  Optional timeout for cluster where it takes time to obtain external ip/host-name. Timeout in seconds |
index 47d8ced..235b2d1 100755 (executable)
@@ -26,7 +26,7 @@
 __print_args() {
        echo "Args: remote|remote-remove docker|kube --env-file <environment-filename> [release] [auto-clean] [--stop-at-error] "
        echo "      [--ricsim-prefix <prefix> ] [--use-local-image <app-nam>+]  [--use-snapshot-image <app-nam>+]"
-       echo "      [--use-staging-image <app-nam>+] [--use-release-image <app-nam>+] [--image-repo <repo-address>]"
+       echo "      [--use-staging-image <app-nam>+] [--use-release-image <app-nam>+] [--use-external-image <app-nam>+] [--image-repo <repo-address>]"
        echo "      [--repo-policy local|remote] [--cluster-timeout <timeout-in seconds>] [--print-stats]"
        echo "      [--override <override-environment-filename>] [--pre-clean] [--gen-stats] [--delete-namespaces]"
        echo "      [--delete-containers] [--endpoint-stats] [--kubeconfig <config-file>] [--host-path-dir <local-host-dir>]"
@@ -55,6 +55,7 @@ if [ $# -eq 1 ] && [ "$1" == "help" ]; then
        echo "--use-snapshot-image  -  The script will use images from the nexus snapshot repo for the supplied apps, space separated list of app short names"
        echo "--use-staging-image   -  The script will use images from the nexus staging repo for the supplied apps, space separated list of app short names"
        echo "--use-release-image   -  The script will use images from the nexus release repo for the supplied apps, space separated list of app short names"
+       echo "--use-external-image   - The script will use images from the external (non oran/onap) repo for the supplied apps, space separated list of app short names"
        echo "--image-repo          -  Url to optional image repo. Only locally built images will be re-tagged and pushed to this repo"
        echo "--repo-policy         -  Policy controlling which images to re-tag and push if param --image-repo is set. Default is 'local'"
        echo "--cluster-timeout     -  Optional timeout for cluster where it takes time to obtain external ip/host-name. Timeout in seconds. "
@@ -123,6 +124,8 @@ USE_STAGING_IMAGES=""
 # Var to hold the app names to use remote release images for
 USE_RELEASE_IMAGES=""
 
+# Var to hold the app names to use external release images for
+USE_EXTERNAL_IMAGES=""
 
 # Use this var (STOP_AT_ERROR=1 in the test script) for debugging/trouble shooting to take all logs and exit at first FAIL test case
 STOP_AT_ERROR=0
@@ -681,6 +684,31 @@ while [ $paramerror -eq 0 ] && [ $foundparm -eq 0 ]; do
                        fi
                fi
        fi
+       if [ $paramerror -eq 0 ]; then
+               if [ "$1" == "--use-external-image" ]; then
+                       USE_EXTERNAL_IMAGES=""
+                       shift
+                       while [ $# -gt 0 ] && [[ "$1" != "--"* ]]; do
+                               USE_EXTERNAL_IMAGES=$USE_EXTERNAL_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-external-image'"
+                                       fi
+                               fi
+                               shift;
+                       done
+                       foundparm=0
+                       if [ -z "$USE_EXTERNAL_IMAGES" ]; then
+                               paramerror=1
+                               if [ -z "$paramerror_str" ]; then
+                                       paramerror_str="No app name found for flag: '--use-use-external-image'"
+                               fi
+                       else
+                               echo "Option set - Overriding with external images for app(s):"$USE_EXTERNAL_IMAGES
+                       fi
+               fi
+       fi
        if [ $paramerror -eq 0 ]; then
                if [ "$1" == "--image-repo" ]; then
                        shift;
@@ -1249,7 +1277,7 @@ __check_and_create_image_var() {
                if [ "$5" == "REMOTE_RELEASE_ORAN" ]; then
                        image=$NEXUS_RELEASE_REPO_ORAN$image
                fi
-               #No nexus repo added for local images, tag: LOCAL
+               #No nexus repo added for local images, tag: LOCAL and other tags
                tmp=$tmp$image"\t"
        fi
        if [ -z $tag ]; then
@@ -1429,6 +1457,12 @@ __check_image_override() {
                        ((CTR++))
                fi
        done
+       for im in $USE_EXTERNAL_IMAGES; do
+               if [ "$1" == "$im" ]; then
+                       suffix="EXTERNAL"
+                       ((CTR++))
+               fi
+       done
        echo $suffix
        if [ $CTR -gt 1 ]; then
                exit 1