X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=test%2Fcommon%2Fhttp_proxy_api_functions.sh;h=3e58a7e0028f41b53c8818c9483ac8c642c175b8;hb=7fbe885e3adfb8257d78ac500dba0b53a14f5d52;hp=68df929f1f01bc9e9aa0ebc3fb036b868e5e2e9e;hpb=4f7f0cda2f07f62dcbb2e371fc09764b2337a8e9;p=nonrtric.git diff --git a/test/common/http_proxy_api_functions.sh b/test/common/http_proxy_api_functions.sh index 68df929f..3e58a7e0 100644 --- a/test/common/http_proxy_api_functions.sh +++ b/test/common/http_proxy_api_functions.sh @@ -19,6 +19,70 @@ # This is a script that contains container/service managemnt functions for Http Proxy +################ Test engine functions ################ + +# Create the image var used during the test +# arg: (selects staging, snapshot, release etc) +# is present only for images with staging, snapshot,release tags +__HTTPPROXY_imagesetup() { + __check_and_create_image_var HTTPPROXY "HTTP_PROXY_IMAGE" "HTTP_PROXY_IMAGE_BASE" "HTTP_PROXY_IMAGE_TAG" REMOTE_PROXY "$HTTP_PROXY_DISPLAY_NAME" +} + +# Pull image from remote repo or use locally built image +# arg: +# Shall be used for images allowing overriding. For example use a local image when test is started to use released images +# Shall be used for images that does not allow overriding +# Both var may contain: 'remote', 'remote-remove' or 'local' +__HTTPPROXY_imagepull() { + __check_and_pull_image $2 "$HTTP_PROXY_DISPLAY_NAME" $HTTP_PROXY_APP_NAME HTTP_PROXY_IMAGE +} + +# Build image (only for simulator or interfaces stubs owned by the test environment) +# arg: (selects staging, snapshot, release etc) +# is present only for images with staging, snapshot,release tags +__HTTPPROXY_imagebuild() { + echo -e $RED"Image for app HTTPPROXY shall never be built"$ERED +} + +# Generate a string for each included image using the app display name and a docker images format string +# If a custom image repo is used then also the source image from the local repo is listed +# arg: +__HTTPPROXY_image_data() { + echo -e "$HTTP_PROXY_DISPLAY_NAME\t$(docker images --format $1 $HTTP_PROXY_IMAGE)" >> $2 + if [ ! -z "$HTTP_PROXY_IMAGE_SOURCE" ]; then + echo -e "-- source image --\t$(docker images --format $1 $HTTP_PROXY_IMAGE_SOURCE)" >> $2 + fi +} + +# Scale kubernetes resources to zero +# All resources shall be ordered to be scaled to 0, if relevant. If not relevant to scale, then do no action. +# This function is called for apps fully managed by the test script +__HTTPPROXY_kube_scale_zero() { + __kube_scale_all_resources $KUBE_SIM_NAMESPACE autotest HTTPPROXY +} + +# Scale kubernetes resources to zero and wait until this has been accomplished, if relevant. If not relevant to scale, then do no action. +# This function is called for prestarted apps not managed by the test script. +__HTTPPROXY_kube_scale_zero_and_wait() { + echo -e $RED" NGW replicas kept as is"$ERED +} + +# Delete all kube resouces for the app +# This function is called for apps managed by the test script. +__HTTPPROXY_kube_delete_all() { + __kube_delete_all_resources $KUBE_SIM_NAMESPACE autotest HTTPPROXY +} + +# Store docker logs +# This function is called for apps managed by the test script. +# args: +__HTTPPROXY_store_docker_logs() { + docker logs $HTTP_PROXY_APP_NAME > $1$2_httpproxy.log 2>&1 +} + +####################################################### + + ## Access to Http Proxy Receiver # Host name may be changed if app started by kube # Direct access from script @@ -116,7 +180,9 @@ start_http_proxy() { export HTTP_PROXY_WEB_INTERNAL_PORT export DOCKER_SIM_NWNAME - __start_container $HTTP_PROXY_COMPOSE_DIR NODOCKERARGS 1 $HTTP_PROXY_APP_NAME + export HTTP_PROXY_DISPLAY_NAME + + __start_container $HTTP_PROXY_COMPOSE_DIR "" NODOCKERARGS 1 $HTTP_PROXY_APP_NAME __check_service_start $HTTP_PROXY_APP_NAME $HTTP_PROXY_PATH$HTTP_PROXY_ALIVE_URL