Updated some function test cases with https 27/4527/1
authorBjornMagnussonXA <bjorn.magnusson@est.tech>
Mon, 10 Aug 2020 12:16:24 +0000 (14:16 +0200)
committerBjornMagnussonXA <bjorn.magnusson@est.tech>
Mon, 10 Aug 2020 15:13:23 +0000 (17:13 +0200)
Change-Id: Ic4f75e47db5b23e66024967a974c4c807ff4f07e

Issue-ID: NONRTRIC-268

Signed-off-by: BjornMagnussonXA <bjorn.magnusson@est.tech>
Change-Id: Ibb1e8a09bbd6e7e1d0a388e4cfd89cac6bff0093

15 files changed:
test/auto-test/FTC1.sh
test/auto-test/FTC10.sh
test/auto-test/FTC100.sh
test/auto-test/FTC110.sh
test/auto-test/FTC300.sh
test/auto-test/FTC350.sh
test/auto-test/FTC800.sh
test/auto-test/FTC810.sh
test/auto-test/FTC850.sh
test/auto-test/FTC900.sh
test/auto-test/Suite-all.sh
test/common/README.md
test/common/agent_api_functions.sh
test/common/test_env.sh
test/common/testcase_common.sh

index 2eaf0f3..413b22e 100755 (executable)
@@ -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"
index 45e7bdd..2e627fc 100755 (executable)
@@ -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"
index 0c4af6b..728252d 100755 (executable)
@@ -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"
index 8427ad1..d6894b5 100755 (executable)
@@ -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 ####
index 3d575db..13647c9 100755 (executable)
@@ -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"
index 416a77d..692d9b5 100755 (executable)
@@ -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))
index 1bb6578..b1e9f53 100755 (executable)
@@ -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))
 
index e9f19f8..7fa5ea6 100755 (executable)
@@ -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"
index 32e450f..b5c991c 100755 (executable)
@@ -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
index 05b6ff6..c483504 100755 (executable)
@@ -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
 
index 342596d..9a51d3b 100755 (executable)
@@ -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
 
 ##########################################
 
index 9f8af39..73ced4b 100644 (file)
@@ -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 |
index 1e1077b..2091d65 100644 (file)
@@ -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=$?
index ee48e8b..391b596 100755 (executable)
@@ -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
index d694ef1..a69df91 100755 (executable)
@@ -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: -