X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=test%2Fcommon%2Ftestcase_common.sh;h=39a593c8e720b0963ba2d79e5833e814d6ce4834;hb=575869c5ed7533f22b0c7db05fdbbbb8e00e09fc;hp=d694ef10c487742430293dd98cbeb8c37d822e18;hpb=8d10bf1fee8093ec4c2a3d3530fded002daf83b6;p=nonrtric.git diff --git a/test/common/testcase_common.sh b/test/common/testcase_common.sh index d694ef10..39a593c8 100755 --- a/test/common/testcase_common.sh +++ b/test/common/testcase_common.sh @@ -18,7 +18,7 @@ # # This is a script that contains all the functions needed for auto test -# Arg: local|remote|remote-remove [auto-clean] [--stop-at-error] [--ricsim-prefix ] [--use-local-image []*] +# Arg: local|remote|remote-remove [auto-clean] [--stop-at-error] [--ricsim-prefix ] [ --env-file ] [--use-local-image []*] #Formatting for 'echo' cmd @@ -52,33 +52,11 @@ fi # Just resetting any previous echo formatting... echo -ne $EBOLD -# source test environment variables -. ../common/test_env.sh +# default test environment variables +TEST_ENV_VAR_FILE="../common/test_env.sh" echo "Test case started as: ${BASH_SOURCE[$i+1]} "$@ -#Vars for A1 interface version and container count -G1_A1_VERSION="" -G2_A1_VERSION="" -G3_A1_VERSION="" -G1_COUNT=0 -G2_COUNT=0 -G3_COUNT=0 - -# Vars to switch between http and https. Extra curl flag needed for https -export RIC_SIM_HTTPX="http" -export RIC_SIM_LOCALHOST=$RIC_SIM_HTTPX"://localhost:" -export RIC_SIM_PORT=$RIC_SIM_INTERNAL_PORT -export RIC_SIM_CERT_MOUNT_DIR="./cert" - -export MR_HTTPX="http" -export MR_PORT=$MR_INTERNAL_PORT -export MR_LOCAL_PORT=$MR_EXTERNAL_PORT #When agent is running outside the docker net - -export SDNC_HTTPX="http" -export SDNC_PORT=$SDNC_INTERNAL_PORT -export SDNC_LOCAL_PORT=$SDNC_EXTERNAL_PORT #When agent is running outside the docker net - #Localhost constant LOCALHOST="http://localhost:" @@ -215,6 +193,19 @@ while [ $paramerror -eq 0 ] && [ $foundparm -eq 0 ]; do 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 + else + echo "Option set - Overriding test_env.sh with: "$1 + shift; + foundparm=0 + fi + fi + fi if [ $paramerror -eq 0 ]; then if [ "$1" == "--use-local-image" ]; then USE_LOCAL_IMAGES="" @@ -243,10 +234,45 @@ if [ $paramerror -eq 0 ] && [ $# -gt 0 ]; then fi if [ $paramerror -eq 1 ]; then - echo -e $RED"Expected arg: local|remote|remote-remove [auto-clean] [--stop-at-error] [--ricsim-prefix ] [--use-local-image []*]"$ERED + echo -e $RED"Expected arg: local|remote|remote-remove [auto-clean] [--stop-at-error] [--ricsim-prefix ] [ --env-file ] [--use-local-image []*]"$ERED + exit 1 +fi + +# sourcing the selected env variables for the test case +if [ -f "$TEST_ENV_VAR_FILE" ]; then + echo -e $BOLD"Sourcing env vars from: "$TEST_ENV_VAR_FILE$EBOLD + . $TEST_ENV_VAR_FILE +else + echo -e $RED"Selected env var fle does not exist: "$TEST_ENV_VAR_FILE$ERED exit 1 fi +#Vars for A1 interface version and container count +G1_A1_VERSION="" +G2_A1_VERSION="" +G3_A1_VERSION="" +G1_COUNT=0 +G2_COUNT=0 +G3_COUNT=0 + +# Vars to switch between http and https. Extra curl flag needed for https +export RIC_SIM_HTTPX="http" +export RIC_SIM_LOCALHOST=$RIC_SIM_HTTPX"://localhost:" +export RIC_SIM_PORT=$RIC_SIM_INTERNAL_PORT +export RIC_SIM_CERT_MOUNT_DIR="./cert" + +export MR_HTTPX="http" +export MR_PORT=$MR_INTERNAL_PORT +export MR_LOCAL_PORT=$MR_EXTERNAL_PORT #When agent is running outside the docker net + +export CR_HTTPX="http" +export CR_PORT=$CR_INTERNAL_PORT +export CR_LOCAL_PORT=$CR_EXTERNAL_PORT #When CR is running outside the docker net + +export SDNC_HTTPX="http" +export SDNC_PORT=$SDNC_INTERNAL_PORT +export SDNC_LOCAL_PORT=$SDNC_EXTERNAL_PORT #When agent is running outside the docker net + echo -e $BOLD"Checking configured image setting for this test case"$EBOLD #Temp var to check for image variable name errors @@ -1517,6 +1543,22 @@ start_cr() { } +use_cr_http() { + echo -e $BOLD"Using http between test script and CR"$EBOLD + export CR_HTTPX="http" + export CR_PORT=$CR_INTERNAL_PORT + export CR_LOCAL_PORT=$CR_EXTERNAL_PORT + echo "" +} + +use_cr_https() { + echo -e $BOLD"Using https between test script and CR"$EBOLD + export CR_HTTPX="https" + export CR_PORT=$CR_INTERNAL_SECURE_PORT + export CR_LOCAL_PORT=$CR_EXTERNAL_SECURE_PORT + echo "" +} + ########################### ### Policy Agents functions ########################### @@ -1567,16 +1609,25 @@ use_agent_rest_https() { return 0 } -# All calls to the agent will be directed to the agent dmaap interface from now on +# All calls to the agent will be directed to the agent dmaap interface over http from now on # args: - # (Function for test scripts) -use_agent_dmaap() { - echo -e $BOLD"Agent using DMAAP interface"$EBOLD +use_agent_dmaap_http() { + echo -e $BOLD"Agent using DMAAP http interface"$EBOLD export ADAPTER=$DMAAPBASE echo "" return 0 } +# All calls to the agent will be directed to the agent dmaap interface over https from now on +# args: - +# (Function for test scripts) +use_agent_dmaap_https() { + echo -e $BOLD"Agent using DMAAP https interface"$EBOLD + export ADAPTER=$DMAAPBASE_SECURE + echo "" + return 0 +} # Turn on debug level tracing in the agent # args: -