X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=test%2Fcommon%2Fricsim_api_functions.sh;h=d71d11a741c11494168c78e373aefc0b1b553d57;hb=refs%2Fchanges%2F62%2F8262%2F1;hp=435c208f667479e23827213938e4f3b76490f433;hpb=98ce5dc75fc222dadaf26a8a148788b0367bf6ca;p=nonrtric.git diff --git a/test/common/ricsim_api_functions.sh b/test/common/ricsim_api_functions.sh index 435c208f..d71d11a7 100644 --- a/test/common/ricsim_api_functions.sh +++ b/test/common/ricsim_api_functions.sh @@ -58,7 +58,7 @@ __RICSIM_kube_scale_zero() { # This function is called for prestarted apps not managed by the test script. __RICSIM_kube_scale_zero_and_wait() { #__kube_scale_and_wait_all_resources $KUBE_A1SIM_NAMESPACE app $KUBE_A1SIM_NAMESPACE"-"$RIC_SIM_PREFIX - __kube_scale_and_wait_all_resources $KUBE_A1SIM_NAMESPACE app # the values of the app label is not known + __kube_scale_and_wait_all_resources $KUBE_A1SIM_NAMESPACE app $KUBE_A1SIM_NAMESPACE"-a1simulator" } # Delete all kube resouces for the app @@ -72,8 +72,8 @@ __RICSIM_kube_delete_all() { # args: __RICSIM_store_docker_logs() { if [ $RUNMODE == "KUBE" ]; then - for podname in $(kubectl get pods -n $KUBE_A1SIM_NAMESPACE -l "autotest=RICSIM" -o custom-columns=":metadata.name"); do - kubectl logs -n $KUBE_A1SIM_NAMESPACE $podname --tail=-1 > $1$2_$podname.log 2>&1 + for podname in $(kubectl $KUBECONF get pods -n $KUBE_A1SIM_NAMESPACE -l "autotest=RICSIM" -o custom-columns=":metadata.name"); do + kubectl $KUBECONF logs -n $KUBE_A1SIM_NAMESPACE $podname --tail=-1 > $1$2_$podname.log 2>&1 done else @@ -103,7 +103,7 @@ __RICSIM_statisics_setup() { echo -n " RICSIM_G2_$RICSIM_INSTANCE_KUBE ${RIC_SIM_PREFIX}-g2-$RICSIM_INSTANCE_KUBE $KUBE_A1SIM_NAMESPACE " echo -n " RICSIM_G3_$RICSIM_INSTANCE_KUBE ${RIC_SIM_PREFIX}-g3-$RICSIM_INSTANCE_KUBE $KUBE_A1SIM_NAMESPACE " else - if [ $DOCKER_COMPOSE_VERION == "V1" ]; then + if [ $DOCKER_COMPOSE_VERSION == "V1" ]; then echo -n " RICSIM_G1_$RICSIM_INSTANCE ${RIC_SIM_PREFIX}_g1_$RICSIM_INSTANCE " echo -n " RICSIM_G2_$RICSIM_INSTANCE ${RIC_SIM_PREFIX}_g2_$RICSIM_INSTANCE " echo -n " RICSIM_G3_$RICSIM_INSTANCE ${RIC_SIM_PREFIX}_g3_$RICSIM_INSTANCE " @@ -116,6 +116,12 @@ __RICSIM_statisics_setup() { done } +# Check application requirements, e.g. helm, the the test needs. Exit 1 if req not satisfied +# args: - +__RICSIM_test_requirements() { + : +} + ####################################################### @@ -235,7 +241,7 @@ start_ric_simulators() { export RIC_SIM_INTERNAL_PORT export RIC_SIM_INTERNAL_SECURE_PORT - echo -e " Creating $POLICY_AGENT_APP_NAME app and expose service" + echo -e " Creating $RIC_SIM_PREFIX app and expose service" #Check if nonrtric namespace exists, if not create it __kube_create_namespace $KUBE_A1SIM_NAMESPACE @@ -247,7 +253,7 @@ start_ric_simulators() { # Create app input_yaml=$SIM_GROUP"/"$RIC_SIM_COMPOSE_DIR"/"app.yaml - output_yaml=$PWD/tmp/pa_${1}_app.yaml + output_yaml=$PWD/tmp/ric_${1}_app.yaml __kube_create_instance app $RIC_SIM_SET_NAME $input_yaml $output_yaml #Using only instance from index 1 to keep compatability with docker @@ -257,7 +263,6 @@ start_ric_simulators() { done fi else - __check_included_image 'RICSIM' if [ $? -eq 1 ]; then echo -e $RED"The Near-RT RIC Simulator app is not included as managed in this test script"$ERED @@ -281,7 +286,7 @@ start_ric_simulators() { export DOCKER_SIM_NWNAME export RIC_SIM_DISPLAY_NAME - docker_args="--no-recreate --scale $RICSIM_COMPOSE_SERVICE_NAME=$2" + docker_args=" --scale $RICSIM_COMPOSE_SERVICE_NAME=$2" #Create a list of contsiner names #Will be __ @@ -289,7 +294,7 @@ start_ric_simulators() { # -- app_data="" cntr=1 - if [ $DOCKER_COMPOSE_VERION == "V1" ]; then + if [ $DOCKER_COMPOSE_VERSION == "V1" ]; then app_name_prefix=$RIC_SIM_PREFIX"_"$RICSIM_COMPOSE_SERVICE_NAME"_" else app_name_prefix=$RIC_SIM_PREFIX"-"$RICSIM_COMPOSE_SERVICE_NAME"-" @@ -304,7 +309,7 @@ start_ric_simulators() { cntr=1 while [ $cntr -le $2 ]; do - if [ $DOCKER_COMPOSE_VERION == "V1" ]; then + if [ $DOCKER_COMPOSE_VERSION == "V1" ]; then app=$RIC_SIM_PREFIX"_"$RICSIM_COMPOSE_SERVICE_NAME"_"$cntr else app=$RIC_SIM_PREFIX"-"$RICSIM_COMPOSE_SERVICE_NAME"-"$cntr @@ -335,10 +340,14 @@ get_kube_sim_host() { __find_sim_host() { if [ $RUNMODE == "KUBE" ]; then ricname=$(echo "$1" | tr '_' '-') # Kube does not accept underscore in names as docker do - ric_setname="${ricname%-*}" #Extract the stateful set name + if [ -z "$RIC_SIM_COMMON_SVC_NAME" ]; then + ric_setname="${ricname%-*}" #Extract the stateful set name + else + ric_setname=$RIC_SIM_COMMON_SVC_NAME # Use the common svc name in the host name of the sims + fi echo $RIC_SIM_HTTPX"://"$ricname.$ric_setname.$KUBE_A1SIM_NAMESPACE":"$RIC_SIM_PORT else - if [ $DOCKER_COMPOSE_VERION == "V1" ]; then + if [ $DOCKER_COMPOSE_VERSION == "V1" ]; then echo $RIC_SIM_HTTPX"://"$1":"$RIC_SIM_PORT else ricname=$(echo "$1" | tr '_' '-') @@ -367,8 +376,14 @@ __execute_curl_to_sim() { proxyflag=" --proxy-insecure --proxy $KUBE_PROXY_PATH" fi fi - echo " CMD: $2 $proxyflag" >> $HTTPLOG - res="$($2 $proxyflag)" + if [ -z "$KUBE_PROXY_CURL_JWT" ]; then + echo " CMD: $2 $proxyflag" >> $HTTPLOG + res="$($2 $proxyflag)" + else + echo " CMD: $2 $proxyflag -H Authorization: Bearer $KUBE_PROXY_CURL_JWT" >> $HTTPLOG + res=$($2 $proxyflag -H 'Authorization: Bearer '$KUBE_PROXY_CURL_JWT) + fi + echo " RESP: $res" >> $HTTPLOG retcode=$? if [ $retcode -ne 0 ]; then