From 496156d78828c000cbde44c96cc37c57032f2244 Mon Sep 17 00:00:00 2001 From: BjornMagnussonXA Date: Mon, 10 Aug 2020 14:16:24 +0200 Subject: [PATCH] Updated some function test cases with https Change-Id: Ic4f75e47db5b23e66024967a974c4c807ff4f07e Issue-ID: NONRTRIC-268 Signed-off-by: BjornMagnussonXA Change-Id: Ibb1e8a09bbd6e7e1d0a388e4cfd89cac6bff0093 --- test/auto-test/FTC1.sh | 31 ++++++++++++++++++++----------- test/auto-test/FTC10.sh | 15 ++++++++------- test/auto-test/FTC100.sh | 26 +++++++++++++++++++------- test/auto-test/FTC110.sh | 1 + test/auto-test/FTC300.sh | 32 ++++++++++++++++++++++++++------ test/auto-test/FTC350.sh | 1 + test/auto-test/FTC800.sh | 23 ++++++++++++++++++++--- test/auto-test/FTC810.sh | 25 ++++++++++++++++++------- test/auto-test/FTC850.sh | 14 ++++++++++++-- test/auto-test/FTC900.sh | 1 + test/auto-test/Suite-all.sh | 20 ++++++++++---------- test/common/README.md | 23 +++++++++++++++++++++-- test/common/agent_api_functions.sh | 6 +++--- test/common/test_env.sh | 3 ++- test/common/testcase_common.sh | 35 ++++++++++++++++++++++++++++++++--- 15 files changed, 194 insertions(+), 62 deletions(-) diff --git a/test/auto-test/FTC1.sh b/test/auto-test/FTC1.sh index 2eaf0f39..413b22e4 100755 --- a/test/auto-test/FTC1.sh +++ b/test/auto-test/FTC1.sh @@ -29,11 +29,6 @@ EXCLUDED_IMAGES="SDNC_ONAP" #### TEST BEGIN #### -#Local vars in test script -########################## - -# Path to callback receiver -CR_PATH="http://$CR_APP_NAME:$CR_EXTERNAL_PORT/callbacks" generate_uuid @@ -50,6 +45,18 @@ for __httpx in $TESTED_PROTOCOLS ; do echo "#####################################################################" echo "#####################################################################" + #Local vars in test script + ########################## + + if [ $__httpx == "HTTPS" ]; then + # Path to callback receiver + CR_PATH="https://$CR_APP_NAME:$CR_EXTERNAL_SECURE_PORT/callbacks" + use_cr_https + else + # Path to callback receiver + CR_PATH="http://$CR_APP_NAME:$CR_EXTERNAL_PORT/callbacks" + use_cr_http + fi # Clean container and start all needed containers # clean_containers @@ -77,7 +84,7 @@ for __httpx in $TESTED_PROTOCOLS ; do start_cr - if [ $interface == "SDNC" ]; then + if [ $interface == "REST+SDNC" ] || [ $interface == "DMAAP+SDNC" ]; then start_sdnc @@ -102,16 +109,18 @@ for __httpx in $TESTED_PROTOCOLS ; do start_control_panel - if [ $interface == "REST+SDNC" ] || [ $interface == "DMAAP+SDNC" ]; then - start_sdnc - fi - start_policy_agent set_agent_debug if [ $interface == "DMAAP" ] || [ $interface == "DMAAP+SDNC" ]; then - use_agent_dmaap + if [ $__httpx == "HTTPS" ]; then + echo "Using secure ports towards dmaap" + use_agent_dmaap_https + else + echo "Using non-secure ports towards dmaap" + use_agent_dmaap_http + fi else if [ $__httpx == "HTTPS" ]; then echo "Using secure ports towards the agent" diff --git a/test/auto-test/FTC10.sh b/test/auto-test/FTC10.sh index 45e7bdd8..2e627fc8 100755 --- a/test/auto-test/FTC10.sh +++ b/test/auto-test/FTC10.sh @@ -34,6 +34,7 @@ generate_uuid ########################## # Path to callback receiver CR_PATH="http://$CR_APP_NAME:$CR_EXTERNAL_PORT/callbacks" +use_cr_http clean_containers @@ -79,7 +80,7 @@ api_put_policy 201 "service1" ricsim_g1_1 1 2000 NOTRANSIENT testdata/OSC/pi1_te sim_equal ricsim_g1_1 num_instances 1 -use_agent_dmaap +use_agent_dmaap_http api_put_policy 201 "service1" ricsim_g1_1 1 3000 NOTRANSIENT testdata/OSC/pi1_template.json 1 @@ -93,7 +94,7 @@ api_put_policy 201 "service1" ricsim_g2_1 NOTYPE 2100 NOTRANSIENT testdata/STD/p sim_equal ricsim_g2_1 num_instances 1 -use_agent_dmaap +use_agent_dmaap_http api_put_policy 201 "service1" ricsim_g2_1 NOTYPE 3100 NOTRANSIENT testdata/STD/pi1_template.json 1 @@ -110,7 +111,7 @@ api_put_policy 200 "service1" ricsim_g1_1 1 2000 NOTRANSIENT testdata/OSC/pi1_te sim_equal ricsim_g1_1 num_instances 2 -use_agent_dmaap +use_agent_dmaap_http api_put_policy 200 "service1" ricsim_g1_1 1 3000 NOTRANSIENT testdata/OSC/pi1_template.json 1 @@ -125,7 +126,7 @@ api_put_policy 200 "service1" ricsim_g2_1 NOTYPE 2100 NOTRANSIENT testdata/STD/p sim_equal ricsim_g2_1 num_instances 2 -use_agent_dmaap +use_agent_dmaap_http api_put_policy 200 "service1" ricsim_g2_1 NOTYPE 3100 NOTRANSIENT testdata/STD/pi1_template.json 1 @@ -139,11 +140,11 @@ api_get_policy 200 3100 testdata/STD/pi1_template.json # Remove policies -use_agent_dmaap +use_agent_dmaap_http api_delete_policy 204 2000 use_agent_rest_http api_delete_policy 204 3000 -use_agent_dmaap +use_agent_dmaap_http api_delete_policy 204 2100 use_agent_rest_http api_delete_policy 204 3100 @@ -164,7 +165,7 @@ api_get_policy 404 2100 api_get_policy 404 3100 # Remove the service -use_agent_dmaap +use_agent_dmaap_http api_delete_services 204 "service1" api_get_services 404 "service1" diff --git a/test/auto-test/FTC100.sh b/test/auto-test/FTC100.sh index 0c4af6bf..728252d0 100755 --- a/test/auto-test/FTC100.sh +++ b/test/auto-test/FTC100.sh @@ -31,12 +31,6 @@ EXCLUDED_IMAGES="SDNC_ONAP" generate_uuid -#Local vars in test script -########################## - -# Path to callback receiver -CR_PATH="http://$CR_APP_NAME:$CR_EXTERNAL_PORT/callbacks" - # Tested variants of REST/DMAAP/SDNC config TESTED_VARIANTS="REST DMAAP REST+SDNC DMAAP+SDNC" #Test agent and simulator protocol versions (others are http only) @@ -50,6 +44,18 @@ for __httpx in $TESTED_PROTOCOLS ; do echo "#####################################################################" echo "#####################################################################" + #Local vars in test script + ########################## + + if [ $__httpx == "HTTPS" ]; then + # Path to callback receiver + CR_PATH="https://$CR_APP_NAME:$CR_EXTERNAL_SECURE_PORT/callbacks" + use_cr_https + else + # Path to callback receiver + CR_PATH="http://$CR_APP_NAME:$CR_EXTERNAL_PORT/callbacks" + use_cr_http + fi # Clean container and start all needed containers # clean_containers @@ -107,7 +113,13 @@ for __httpx in $TESTED_PROTOCOLS ; do set_agent_debug if [ $interface == "DMAAP" ] || [ $interface == "DMAAP+SDNC" ]; then - use_agent_dmaap + if [ $__httpx == "HTTPS" ]; then + echo "Using secure ports towards dmaap" + use_agent_dmaap_https + else + echo "Using non-secure ports towards dmaap" + use_agent_dmaap_http + fi else if [ $__httpx == "HTTPS" ]; then #"Using secure ports towards the agent" diff --git a/test/auto-test/FTC110.sh b/test/auto-test/FTC110.sh index 8427ad14..d6894b50 100755 --- a/test/auto-test/FTC110.sh +++ b/test/auto-test/FTC110.sh @@ -33,6 +33,7 @@ generate_uuid ########################## # Path to callback receiver CR_PATH="http://$CR_APP_NAME:$CR_EXTERNAL_PORT/callbacks" +use_cr_http #### TEST BEGIN #### diff --git a/test/auto-test/FTC300.sh b/test/auto-test/FTC300.sh index 3d575db3..13647c9f 100755 --- a/test/auto-test/FTC300.sh +++ b/test/auto-test/FTC300.sh @@ -30,11 +30,6 @@ EXCLUDED_IMAGES="SDNC_ONAP" generate_uuid -#Local vars in test script -########################## -# Path to callback receiver -CR_PATH="https://$CR_APP_NAME:$CR_EXTERNAL_SECURE_PORT/callbacks" - # Tested variants of REST/DMAAP/SDNC config TESTED_VARIANTS="REST DMAAP REST+SDNC DMAAP+SDNC DMAAP_BATCH DMAAP_BATCH+SDNC" #Test agent and simulator protocol versions (others are http only) @@ -48,6 +43,18 @@ for __httpx in $TESTED_PROTOCOLS ; do echo "#####################################################################" echo "#####################################################################" + #Local vars in test script + ########################## + + if [ $__httpx == "HTTPS" ]; then + # Path to callback receiver + CR_PATH="https://$CR_APP_NAME:$CR_EXTERNAL_SECURE_PORT/callbacks" + use_cr_https + else + # Path to callback receiver + CR_PATH="http://$CR_APP_NAME:$CR_EXTERNAL_PORT/callbacks" + use_cr_http + fi # Clean container and start all needed containers # clean_containers @@ -76,6 +83,13 @@ for __httpx in $TESTED_PROTOCOLS ; do if [[ $interface = *"SDNC"* ]]; then start_sdnc + if [ $__httpx == "HTTPS" ]; then + # "Using secure ports towards SDNC" + use_sdnc_https + else + #"Using non-secure ports towards SDNC" + use_sdnc_http + fi prepare_consul_config SDNC ".consul_config.json" else prepare_consul_config NOSDNC ".consul_config.json" @@ -90,7 +104,13 @@ for __httpx in $TESTED_PROTOCOLS ; do set_agent_debug if [[ $interface == *"DMAAP"* ]]; then - use_agent_dmaap + if [ $__httpx == "HTTPS" ]; then + echo "Using secure ports towards dmaap" + use_agent_dmaap_https + else + echo "Using non-secure ports towards dmaap" + use_agent_dmaap_http + fi else if [ $__httpx == "HTTPS" ]; then echo "Using secure ports towards the agent" diff --git a/test/auto-test/FTC350.sh b/test/auto-test/FTC350.sh index 416a77dc..692d9b56 100755 --- a/test/auto-test/FTC350.sh +++ b/test/auto-test/FTC350.sh @@ -34,6 +34,7 @@ generate_uuid ########################## # Path to callback receiver CR_PATH="http://$CR_APP_NAME:$CR_EXTERNAL_PORT/callbacks" +use_cr_http NUM_RICS=10 NUM_RICS_2=$(($NUM_RICS-2)) diff --git a/test/auto-test/FTC800.sh b/test/auto-test/FTC800.sh index 1bb6578f..b1e9f53f 100755 --- a/test/auto-test/FTC800.sh +++ b/test/auto-test/FTC800.sh @@ -32,8 +32,6 @@ generate_uuid #Local vars in test script ########################## -# Path to callback receiver -CR_PATH="http://$CR_APP_NAME:$CR_EXTERNAL_PORT/callbacks" # Number of policies in each sequence NUM_POLICIES=10000 @@ -51,6 +49,19 @@ for __httpx in $TESTED_PROTOCOLS ; do echo "#####################################################################" echo "#####################################################################" + #Local vars in test script + ########################## + + if [ $__httpx == "HTTPS" ]; then + # Path to callback receiver + CR_PATH="https://$CR_APP_NAME:$CR_EXTERNAL_SECURE_PORT/callbacks" + use_cr_https + else + # Path to callback receiver + CR_PATH="http://$CR_APP_NAME:$CR_EXTERNAL_PORT/callbacks" + use_cr_http + fi + # Policy instance start id START_ID=1 @@ -147,7 +158,13 @@ for __httpx in $TESTED_PROTOCOLS ; do sim_equal ricsim_g2_1 num_instances $NUM_POLICIES - use_agent_dmaap + if [ $__httpx == "HTTPS" ]; then + echo "Using secure ports towards dmaap" + use_agent_dmaap_https + else + echo "Using non-secure ports towards dmaap" + use_agent_dmaap_http + fi START_ID=$(($START_ID+$NUM_POLICIES)) diff --git a/test/auto-test/FTC810.sh b/test/auto-test/FTC810.sh index e9f19f8c..7fa5ea6e 100755 --- a/test/auto-test/FTC810.sh +++ b/test/auto-test/FTC810.sh @@ -32,8 +32,7 @@ generate_uuid #Local vars in test script ########################## -# Path to callback receiver -CR_PATH="http://$CR_APP_NAME:$CR_EXTERNAL_PORT/callbacks" + # Number of RICs per interface type (OSC and STD) NUM_RICS=30 # Number of policy instances per RIC @@ -43,14 +42,20 @@ DAYS=3 clean_containers -# use http or https for all apis -HTTPX=https +# use HTTP or HTTPS for all apis +HTTPX=HTTPS -if [ $HTTPX == "http" ]; then +if [ $HTTPX == "HTTP" ]; then + # Path to callback receiver + CR_PATH="http://$CR_APP_NAME:$CR_EXTERNAL_PORT/callbacks" + use_cr_http use_agent_rest_http use_sdnc_http use_simulator_http else + # Path to callback receiver + CR_PATH="https://$CR_APP_NAME:$CR_EXTERNAL_SECURE_PORT/callbacks" + use_cr_https use_agent_rest_https use_sdnc_https use_simulator_https @@ -142,13 +147,19 @@ while [ $(($SECONDS-$TEST_START)) -lt $TEST_DURATION ]; do echo "############################################" if [ $interface == "REST" ] || [ $interface == "REST_PARALLEL" ]; then - if [ $HTTPX == "http" ]; then + if [ $HTTPX == "HTTP" ]; then use_agent_rest_http else use_agent_rest_https fi else - use_agent_dmaap + if [ $HTTPX == "HTTPS" ]; then + echo "Using secure ports towards dmaap" + use_agent_dmaap_https + else + echo "Using non-secure ports towards dmaap" + use_agent_dmaap_http + fi fi echo "Create $NUM_INSTANCES instances in each OSC RIC" diff --git a/test/auto-test/FTC850.sh b/test/auto-test/FTC850.sh index 32e450f2..b5c991c3 100755 --- a/test/auto-test/FTC850.sh +++ b/test/auto-test/FTC850.sh @@ -30,8 +30,6 @@ EXCLUDED_IMAGES="SDNC_ONAP" #Local vars in test script ########################## -# Path to callback receiver -CR_PATH="http://$CR_APP_NAME:$CR_EXTERNAL_PORT/callbacks" # Tested variants of REST/DMAAP/SDNC config TESTED_VARIANTS="REST REST+SDNC" @@ -53,6 +51,18 @@ for __httpx in $TESTED_PROTOCOLS ; do echo "#####################################################################" echo "#####################################################################" + #Local vars in test script + ########################## + + if [ $__httpx == "HTTPS" ]; then + # Path to callback receiver + CR_PATH="https://$CR_APP_NAME:$CR_EXTERNAL_SECURE_PORT/callbacks" + use_cr_https + else + # Path to callback receiver + CR_PATH="http://$CR_APP_NAME:$CR_EXTERNAL_PORT/callbacks" + use_cr_http + fi # Clean container and start all needed containers # clean_containers diff --git a/test/auto-test/FTC900.sh b/test/auto-test/FTC900.sh index 05b6ff63..c483504d 100755 --- a/test/auto-test/FTC900.sh +++ b/test/auto-test/FTC900.sh @@ -32,6 +32,7 @@ EXCLUDED_IMAGES="SDNC SDNC_ONAP" ########################## # Path to callback receiver CR_PATH="http://$CR_APP_NAME:$CR_EXTERNAL_PORT/callbacks" +use_cr_http clean_containers diff --git a/test/auto-test/Suite-all.sh b/test/auto-test/Suite-all.sh index 342596d6..9a51d3bb 100755 --- a/test/auto-test/Suite-all.sh +++ b/test/auto-test/Suite-all.sh @@ -26,22 +26,22 @@ suite_setup ############# TEST CASES ################# ARG1=$1 -./FTC1.sh $1 +./FTC1.sh $ARG1 if [ $ARG1 == "remote-remove" ]; then #Prevent image removal for every test case ARG1="remote" fi -./FTC10.sh $1 -./FTC100.sh $1 -./FTC110.sh $1 -./FTC150.sh $1 -./FTC300.sh $1 -./FTC310.sh $1 -./FTC350.sh $1 -./FTC800.sh $1 -./FTC850.sh $1 +./FTC10.sh $ARG1 +./FTC100.sh $ARG1 +./FTC110.sh $ARG1 +./FTC150.sh $ARG1 +./FTC300.sh $ARG1 +./FTC310.sh $ARG1 +./FTC350.sh $ARG1 +./FTC800.sh $ARG1 +./FTC850.sh $ARG1 ########################################## diff --git a/test/common/README.md b/test/common/README.md index 9f8af39e..73ced4b3 100644 --- a/test/common/README.md +++ b/test/common/README.md @@ -250,6 +250,19 @@ Start the Callback Receiver container |--| | None | +#### Function: use_cr_http #### +Use http for getting event from CR. The admin API is not affected. This is the default. +| arg list | +|--| +| None | + +#### Function: use_cr_https #### +Use https for getting event from CR. The admin API is not affected. +Note: Not yet used as callback event is not fully implemented/deciced. +| arg list | +|--| +| None | + #### Function: start_policy_agent #### Start the Policy Agent container. If the test script is configured to use a stand alone Policy Agent (for example other container or stand alone app) the script will prompt for starting the stand alone Policy Agent. | arg list | @@ -274,8 +287,14 @@ Use https for all API calls to the Policy Agent. |--| | None | -#### Function: use_agent_dmaap #### -Send and recieve all API calls to the Policy Agent over Dmaap via the MR. +#### Function: use_agent_dmaap_http #### +Send and recieve all API calls to the Policy Agent over Dmaap via the MR over http. +| arg list | +|--| +| None | + +#### Function: use_agent_dmaap_https #### +Send and recieve all API calls to the Policy Agent over Dmaap via the MR over https. | arg list | |--| | None | diff --git a/test/common/agent_api_functions.sh b/test/common/agent_api_functions.sh index 1e1077b2..2091d65a 100644 --- a/test/common/agent_api_functions.sh +++ b/test/common/agent_api_functions.sh @@ -76,7 +76,7 @@ __do_curl_to_agent() { if [ $# -ne 2 ]; then paramError=1 fi - if ! [ $ADAPTER == $DMAAPBASE ]; then + if [ $ADAPTER == $RESTBASE ] || [ $ADAPTER == $RESTBASE_SECURE ]; then paramError=1 fi else @@ -143,7 +143,7 @@ __do_curl_to_agent() { #urlencode the request url since it will be carried by send-request url requestUrl=$(python3 -c "from __future__ import print_function; import urllib.parse, sys; print(urllib.parse.quote(sys.argv[1]))" "$2") url=" "${ADAPTER}"/send-request?url="${requestUrl}"&operation="${oper} - curlString="curl -X POST${timeout}${httpcode}${content}${url}${file}" + curlString="curl -k -X POST${timeout}${httpcode}${content}${url}${file}" echo " CMD: "$curlString >> $HTTPLOG res=$($curlString) retcode=$? @@ -169,7 +169,7 @@ __do_curl_to_agent() { cid=$2 fi url=" "${ADAPTER}"/receive-response?correlationid="${cid} - curlString="curl -X GET"${timeout}${httpcode}${url} + curlString="curl -k -X GET"${timeout}${httpcode}${url} echo " CMD: "$curlString >> $HTTPLOG res=$($curlString) retcode=$? diff --git a/test/common/test_env.sh b/test/common/test_env.sh index ee48e8b1..391b596c 100755 --- a/test/common/test_env.sh +++ b/test/common/test_env.sh @@ -175,6 +175,7 @@ UUID="" # UUID used as p RESTBASE="http://localhost:"$POLICY_AGENT_EXTERNAL_PORT # Base url to the Agent NB REST interface RESTBASE_SECURE="https://localhost:"$POLICY_AGENT_EXTERNAL_SECURE_PORT # Base url to the secure Agent NB REST interface -DMAAPBASE="http://localhost:"$MR_EXTERNAL_PORT # Base url to the Dmaap adapter +DMAAPBASE="http://localhost:"$MR_EXTERNAL_PORT # Base url to the Dmaap adapter, http +DMAAPBASE_SECURE="https://localhost:"$MR_EXTERNAL_SECURE_PORT # Base url to the Dmaap adapter, https ADAPTER=$RESTBASE # Adapter holds the address the agent R-APP interface (REST OR DMAAP) # The values of this var is swiched between the two base url when needed \ No newline at end of file diff --git a/test/common/testcase_common.sh b/test/common/testcase_common.sh index d694ef10..a69df911 100755 --- a/test/common/testcase_common.sh +++ b/test/common/testcase_common.sh @@ -75,6 +75,10 @@ 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 @@ -1517,6 +1521,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 +1587,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: - -- 2.16.6