Restructure test cases and upgraded test environment 05/4805/1
authorBjornMagnussonXA <bjorn.magnusson@est.tech>
Mon, 5 Oct 2020 06:39:40 +0000 (08:39 +0200)
committerBjornMagnussonXA <bjorn.magnusson@est.tech>
Mon, 5 Oct 2020 06:39:54 +0000 (08:39 +0200)
Issue-ID: NONRTRIC-290

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

36 files changed:
test/auto-test/DEMO.sh [new file with mode: 0755]
test/auto-test/FTC1.sh
test/auto-test/FTC10.sh
test/auto-test/FTC100.sh
test/auto-test/FTC110.sh
test/auto-test/FTC1100.sh [new file with mode: 0755]
test/auto-test/FTC150.sh
test/auto-test/FTC300.sh
test/auto-test/FTC310.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/demo-testdata/OSC/hw-agent-modified.json [new file with mode: 0644]
test/auto-test/demo-testdata/OSC/pihw_template.json [new file with mode: 0644]
test/auto-test/demo-testdata/OSC/piqos_template.json [new file with mode: 0644]
test/auto-test/demo-testdata/OSC/pitsa_template.json [new file with mode: 0644]
test/auto-test/demo-testdata/OSC/qos-agent-modified.json [new file with mode: 0644]
test/auto-test/demo-testdata/OSC/sim_hw.json [new file with mode: 0644]
test/auto-test/demo-testdata/OSC/sim_qos.json [new file with mode: 0644]
test/auto-test/demo-testdata/OSC/sim_tsa.json [new file with mode: 0644]
test/auto-test/demo-testdata/OSC/tsa-agent-modified.json [new file with mode: 0644]
test/auto-test/demo-testdata/STD/pi1_template.json [new file with mode: 0644]
test/common/README.md
test/common/agent_api_functions.sh
test/common/api_curl.sh [new file with mode: 0644]
test/common/ecs_api_functions.sh [new file with mode: 0644]
test/common/test_env.sh
test/common/testcase_common.sh
test/common/testsuite_common.sh
test/simulator-group/.gitignore
test/simulator-group/ecs/.gitignore [new file with mode: 0644]
test/simulator-group/ecs/docker-compose.yml [new file with mode: 0644]
test/simulator-group/sdnc_onap/.gitignore [deleted file]
test/simulator-group/sdnc_onap/docker-compose.yml [deleted file]

diff --git a/test/auto-test/DEMO.sh b/test/auto-test/DEMO.sh
new file mode 100755 (executable)
index 0000000..7c0ba47
--- /dev/null
@@ -0,0 +1,147 @@
+#!/usr/bin/env bash
+
+#  ============LICENSE_START===============================================
+#  Copyright (C) 2020 Nordix Foundation. All rights reserved.
+#  ========================================================================
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#  ============LICENSE_END=================================================
+#
+
+TC_ONELINE_DESCR="Preparation demo setup  - populating a number of ric simulators with types and instances"
+
+#App names to exclude checking pulling images for, space separated list
+EXCLUDED_IMAGES="ECS"
+
+. ../common/testcase_common.sh $@
+. ../common/agent_api_functions.sh
+. ../common/ricsimulator_api_functions.sh
+
+#### TEST BEGIN ####
+
+#Local vars in test script
+##########################
+# 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
+
+clean_containers
+
+OSC_NUM_RICS=6
+STD_NUM_RICS=5
+
+start_ric_simulators  $RIC_SIM_PREFIX"_g1" $OSC_NUM_RICS OSC_2.1.0
+
+start_ric_simulators  $RIC_SIM_PREFIX"_g2" $STD_NUM_RICS STD_1.1.3
+
+start_mr #Just to prevent errors in the agent log...
+
+start_control_panel
+
+CR_PATH="https://$CR_APP_NAME:$CR_EXTERNAL_SECURE_PORT/callbacks"
+use_cr_http
+
+start_sdnc
+
+start_consul_cbs
+
+prepare_consul_config      SDNC  ".consul_config.json"
+consul_config_app                  ".consul_config.json"
+
+start_policy_agent
+
+api_get_status 200
+
+# Print the A1 version for OSC
+for ((i=1; i<=$OSC_NUM_RICS; i++))
+do
+    sim_print $RIC_SIM_PREFIX"_g1_"$i interface
+done
+
+
+# Print the A1 version for STD
+for ((i=1; i<=$STD_NUM_RICS; i++))
+do
+    sim_print $RIC_SIM_PREFIX"_g2_"$i interface
+done
+
+
+# Load the polictypes in osc
+for ((i=1; i<=$OSC_NUM_RICS; i++))
+do
+    sim_put_policy_type 201 $RIC_SIM_PREFIX"_g1_"$i 100 demo-testdata/OSC/sim_qos.json
+    sim_put_policy_type 201 $RIC_SIM_PREFIX"_g1_"$i 20008 demo-testdata/OSC/sim_tsa.json
+done
+
+
+#Check the number of schemas and the individual schemas in OSC
+api_equal json:policy_types 3 120
+
+for ((i=1; i<=$OSC_NUM_RICS; i++))
+do
+    api_equal json:policy_types?ric=$RIC_SIM_PREFIX"_g1_"$i 2 120
+done
+
+# Check the schemas in OSC
+for ((i=1; i<=$OSC_NUM_RICS; i++))
+do
+    api_get_policy_schema 200 100 demo-testdata/OSC/qos-agent-modified.json
+    api_get_policy_schema 200 20008 demo-testdata/OSC/tsa-agent-modified.json
+done
+
+
+# Create policies
+use_agent_rest_http
+
+api_put_service 201 "Emergency-response-app" 0 "$CR_PATH/1"
+
+# Create policies in OSC
+for ((i=1; i<=$OSC_NUM_RICS; i++))
+do
+    generate_uuid
+    api_put_policy 201 "Emergency-response-app" $RIC_SIM_PREFIX"_g1_"$i 100 $((3000+$i)) NOTRANSIENT demo-testdata/OSC/piqos_template.json 1
+    generate_uuid
+    api_put_policy 201 "Emergency-response-app" $RIC_SIM_PREFIX"_g1_"$i 20008 $((4000+$i)) NOTRANSIENT demo-testdata/OSC/pitsa_template.json 1
+done
+
+
+# Check the number of policies in OSC
+for ((i=1; i<=$OSC_NUM_RICS; i++))
+do
+    sim_equal $RIC_SIM_PREFIX"_g1_"$i num_instances 2
+done
+
+
+# Create policies in STD
+for ((i=1; i<=$STD_NUM_RICS; i++))
+do
+    generate_uuid
+    api_put_policy 201 "Emergency-response-app" $RIC_SIM_PREFIX"_g2_"$i NOTYPE $((2100+$i)) NOTRANSIENT demo-testdata/STD/pi1_template.json 1
+done
+
+
+# Check the number of policies in STD
+for ((i=1; i<=$STD_NUM_RICS; i++))
+do
+    sim_equal $RIC_SIM_PREFIX"_g2_"$i num_instances 1
+done
+
+check_policy_agent_logs
+
+#### TEST COMPLETE ####
+
+store_logs          END
+
+print_result
index 413b22e..39b6e6d 100755 (executable)
@@ -21,7 +21,7 @@
 TC_ONELINE_DESCR="Sanity test, create service and then create,update and delete a policy using http/https and Agent REST/DMAAP with/without SDNC controller"
 
 #App names to exclude checking pulling images for, space separated list
-EXCLUDED_IMAGES="SDNC_ONAP"
+EXCLUDED_IMAGES="ECS"
 
 . ../common/testcase_common.sh  $@
 . ../common/agent_api_functions.sh
@@ -45,61 +45,49 @@ 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
+            use_simulator_https
+            use_mr_https
+            if [[ $interface = *"SDNC"* ]]; then
+                use_sdnc_https
+            fi
+            if [[ $interface = *"DMAAP"* ]]; then
+                use_agent_dmaap_https
+            else
+                use_agent_rest_https
+            fi
         else
-            # Path to callback receiver
             CR_PATH="http://$CR_APP_NAME:$CR_EXTERNAL_PORT/callbacks"
             use_cr_http
+            use_simulator_http
+            use_mr_http
+            if [[ $interface = *"SDNC"* ]]; then
+                use_sdnc_http
+            fi
+            if [[ $interface = *"DMAAP"* ]]; then
+                use_agent_dmaap_http
+            else
+                use_agent_rest_http
+            fi
         fi
 
         # Clean container and start all needed containers #
         clean_containers
 
-        if [ $__httpx == "HTTPS" ]; then
-            #"Using secure ports towards simulators"
-            use_simulator_https
-        else
-            #"Using non-secure ports towards simulators"
-            use_simulator_http
-        fi
-
         start_ric_simulators ricsim_g1 1  OSC_2.1.0
         start_ric_simulators ricsim_g2 1  STD_1.1.3
 
         start_mr
 
-        if [ $__httpx == "HTTPS" ]; then
-            #echo "Using secure ports between agent and MR"
-            use_mr_https
-        else
-            #"Using non-secure ports between agent and MR"
-            use_mr_http
-        fi
-
         start_cr
 
-        if [ $interface == "REST+SDNC" ] || [ $interface == "DMAAP+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
-        fi
-
         start_consul_cbs
 
-        if [ $interface == "REST+SDNC" ] || [ $interface == "DMAAP+SDNC" ]; then
+        if [[ $interface = *"SDNC"* ]]; then
+            start_sdnc
             prepare_consul_config      SDNC    ".consul_config.json"
         else
             prepare_consul_config      NOSDNC  ".consul_config.json"
@@ -113,25 +101,6 @@ for __httpx in $TESTED_PROTOCOLS ; do
 
         set_agent_debug
 
-        if [ $interface == "DMAAP" ] || [ $interface == "DMAAP+SDNC" ]; then
-            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"
-                use_agent_rest_https
-            else
-                echo "Using non-secure ports towards the agent"
-                use_agent_rest_http
-            fi
-        fi
-
-
         cr_equal received_callbacks 0
         mr_equal requests_submitted 0
 
@@ -189,7 +158,7 @@ for __httpx in $TESTED_PROTOCOLS ; do
 
         cr_equal received_callbacks 0
 
-        if [ $interface == "DMAAP" ] || [ $interface == "DMAAP+SDNC" ]; then
+        if [[ $interface = *"DMAAP"* ]]; then
             VAL=11 # Number of Agent API calls over DMAAP
             mr_equal requests_fetched $VAL
             mr_equal responses_submitted $VAL
@@ -200,7 +169,7 @@ for __httpx in $TESTED_PROTOCOLS ; do
             mr_equal requests_submitted 0
         fi
 
-        if [ $interface == "REST+SDNC" ] || [ $interface == "DMAAP+SDNC" ]; then
+        if [[ $interface = *"SDNC"* ]]; then
             sim_contains_str ricsim_g1_1 remote_hosts "a1-controller"
             sim_contains_str ricsim_g2_1 remote_hosts "a1-controller"
         else
index 2e627fc..754260e 100755 (executable)
@@ -20,7 +20,7 @@
 TC_ONELINE_DESCR="Basic use case, register service, create/update policy, delete policy, de-register service using both STD and OSC interface while mixing REST and Dmaap"
 
 #App names to exclude checking pulling images for, space separated list
-EXCLUDED_IMAGES="SDNC SDNC_ONAP"
+EXCLUDED_IMAGES="SDNC ECS"
 
 . ../common/testcase_common.sh $@
 . ../common/agent_api_functions.sh
@@ -34,7 +34,12 @@ generate_uuid
 ##########################
 # Path to callback receiver
 CR_PATH="http://$CR_APP_NAME:$CR_EXTERNAL_PORT/callbacks"
+
 use_cr_http
+use_simulator_http
+use_mr_http
+use_agent_rest_http
+
 
 clean_containers
 
index 728252d..929f3f2 100755 (executable)
@@ -21,7 +21,7 @@
 TC_ONELINE_DESCR="Full agent API walk through using agent REST/DMAAP and with/without SDNC A1 Controller"
 
 #App names to exclude checking pulling images for, space separated list
-EXCLUDED_IMAGES="SDNC_ONAP"
+EXCLUDED_IMAGES="ECS"
 
 . ../common/testcase_common.sh  $@
 . ../common/agent_api_functions.sh
@@ -44,61 +44,48 @@ 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
+            use_simulator_https
+            use_mr_https
+            if [[ $interface = *"SDNC"* ]]; then
+                use_sdnc_https
+            fi
+            if [[ $interface = *"DMAAP"* ]]; then
+                use_agent_dmaap_https
+            else
+                use_agent_rest_https
+            fi
         else
-            # Path to callback receiver
             CR_PATH="http://$CR_APP_NAME:$CR_EXTERNAL_PORT/callbacks"
             use_cr_http
+            use_simulator_http
+            use_mr_http
+            if [[ $interface = *"SDNC"* ]]; then
+                use_sdnc_http
+            fi
+            if [[ $interface = *"DMAAP"* ]]; then
+                use_agent_dmaap_http
+            else
+                use_agent_rest_http
+            fi
         fi
 
         # Clean container and start all needed containers #
         clean_containers
 
-        if [ $__httpx == "HTTPS" ]; then
-            #"Using secure ports towards simulators"
-            use_simulator_https
-        else
-            #"Using non-secure ports towards simulators"
-            use_simulator_http
-        fi
-
         start_ric_simulators ricsim_g1 1  OSC_2.1.0
         start_ric_simulators ricsim_g2 1  STD_1.1.3
 
         start_mr
 
-        if [ $__httpx == "HTTPS" ]; then
-            #echo "Using secure ports between agent and MR"
-            use_mr_https
-        else
-            #"Using non-secure ports between agent and MR"
-            use_mr_http
-        fi
-
         start_cr
 
-        if [ $interface == "REST+SDNC" ] || [ $interface == "DMAAP+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
-        fi
-
         start_consul_cbs
 
-        if [ $interface == "REST+SDNC" ] || [ $interface == "DMAAP+SDNC" ]; then
+        if [[ $interface = *"SDNC"* ]]; then
+            start_sdnc
             prepare_consul_config      SDNC    ".consul_config.json"
         else
             prepare_consul_config      NOSDNC  ".consul_config.json"
@@ -112,25 +99,6 @@ for __httpx in $TESTED_PROTOCOLS ; do
 
         set_agent_debug
 
-        if [ $interface == "DMAAP" ] || [ $interface == "DMAAP+SDNC" ]; then
-            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"
-                use_agent_rest_https
-            else
-                #"Using non-secure ports towards the agent"
-                use_agent_rest_http
-            fi
-        fi
-
-
         cr_equal received_callbacks 0
         mr_equal requests_submitted 0
 
@@ -148,8 +116,6 @@ for __httpx in $TESTED_PROTOCOLS ; do
         api_equal json:policy_ids 0
 
 
-
-
         echo "############################################"
         echo "############## Health check ################"
         echo "############################################"
@@ -388,7 +354,7 @@ for __httpx in $TESTED_PROTOCOLS ; do
 
         cr_equal received_callbacks 0
 
-        if [ $interface == "DMAAP" ] || [ $interface == "DMAAP+SDNC" ]; then
+        if [[ $interface = *"DMAAP"* ]]; then
             mr_greater requests_submitted 0
             VAL=$(mr_read requests_submitted)
             mr_equal requests_fetched $VAL
@@ -400,7 +366,7 @@ for __httpx in $TESTED_PROTOCOLS ; do
             mr_equal requests_submitted 0
         fi
 
-        if [ $interface == "REST+SDNC" ] || [ $interface == "DMAAP+SDNC" ]; then
+        if [[ $interface = *"SDNC"* ]]; then
             sim_contains_str ricsim_g1_1 remote_hosts "a1-controller"
             sim_contains_str ricsim_g2_1 remote_hosts "a1-controller"
         else
index d6894b5..90b7827 100755 (executable)
@@ -21,7 +21,7 @@
 TC_ONELINE_DESCR="Testing of service registration timeouts and keepalive"
 
 #App names to exclude checking pulling images for, space separated list
-EXCLUDED_IMAGES="SDMC SDNC_ONAP"
+EXCLUDED_IMAGES="SDNC ECS"
 
 . ../common/testcase_common.sh  $@
 . ../common/agent_api_functions.sh
@@ -33,7 +33,11 @@ generate_uuid
 ##########################
 # Path to callback receiver
 CR_PATH="http://$CR_APP_NAME:$CR_EXTERNAL_PORT/callbacks"
+
 use_cr_http
+use_simulator_http
+use_mr_http
+use_agent_rest_http
 
 
 #### TEST BEGIN ####
@@ -57,8 +61,6 @@ start_policy_agent
 
 set_agent_debug
 
-use_agent_rest_http
-
 #Verify no callbacks or dmaap messages has been sent
 cr_equal received_callbacks 0
 mr_equal requests_submitted 0
@@ -187,7 +189,7 @@ sim_equal ricsim_g1_1 num_instances 0
 api_get_service_ids 200
 
 deviation "TR18 Agents sends callback with empty body"
-cr_equal received_callbacks 0
+cr_equal received_callbacks 4
 mr_equal requests_submitted 0
 
 check_policy_agent_logs
diff --git a/test/auto-test/FTC1100.sh b/test/auto-test/FTC1100.sh
new file mode 100755 (executable)
index 0000000..0d3371a
--- /dev/null
@@ -0,0 +1,76 @@
+#!/bin/bash
+
+#  ============LICENSE_START===============================================
+#  Copyright (C) 2020 Nordix Foundation. All rights reserved.
+#  ========================================================================
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#  ============LICENSE_END=================================================
+#
+
+
+TC_ONELINE_DESCR="Experimental ECS test case"
+
+#App names to exclude checking pulling images for, space separated list
+EXCLUDED_IMAGES="SDNC PA CP CR MR RICSIM CONSUL CBS"
+
+. ../common/testcase_common.sh  $@
+. ../common/ecs_api_functions.sh
+
+#### TEST BEGIN ####
+
+clean_containers
+
+use_ecs_rest_https
+
+use_ecs_rest_https
+
+start_ecs
+
+set_ecs_debug
+
+
+
+
+ecs_api_a1_get_job_ids 200
+ecs_api_a1_get_type 200
+ecs_api_a1_get_type_ids 200
+ecs_api_a1_get_job_status 200
+ecs_api_a1_get_job 200
+ecs_api_a1_delete_job 200
+ecs_api_a1_put_job 200
+ecs_api_edp_get_type_ids 200
+ecs_api_edp_get_producer_status 200
+ecs_api_edp_get_producer_ids 200 NOID
+ecs_api_edp_get_type 200
+ecs_api_edp_get_producer 200
+ecs_api_edp_delete_producer 200
+ecs_api_edp_put_producer 200
+ecs_api_edp_get_producer_jobs 200
+ecs_api_sim_post_job_delete_error 200
+ecs_api_sim_get_producer_supervision 200
+ecs_api_sim_post_job_deleted 200
+ecs_api_get_producer_supervision_error 200
+ecs_api_sim_get_job_created_error 200
+ecs_api_sim_get_job_created 200
+ecs_api_service_status 200
+
+
+
+store_logs END
+
+#### TEST COMPLETE ####
+
+
+print_result
+
+auto_clean_containers
index 3e13bf5..042765c 100755 (executable)
@@ -21,7 +21,7 @@
 TC_ONELINE_DESCR="Sample tests of the SDNC A1 controller restconf API using http/https (no agent)"
 
 #App names to exclude checking pulling images for, space separated list
-EXCLUDED_IMAGES="PA CP SDNC_ONAP"
+EXCLUDED_IMAGES="PA CP ECS"
 
 . ../common/testcase_common.sh  $@
 . ../common/controller_api_functions.sh
index 13647c9..9907dd6 100755 (executable)
@@ -20,7 +20,7 @@
 TC_ONELINE_DESCR="Resync 10000 policies using OSC interface over REST"
 
 #App names to exclude checking pulling images for, space separated list
-EXCLUDED_IMAGES="SDNC_ONAP"
+EXCLUDED_IMAGES="ECS"
 
 . ../common/testcase_common.sh  $@
 . ../common/agent_api_functions.sh
@@ -43,34 +43,37 @@ 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
+            use_simulator_https
+            use_mr_https
+            if [[ $interface = *"SDNC"* ]]; then
+                use_sdnc_https
+            fi
+            if [[ $interface = *"DMAAP"* ]]; then
+                use_agent_dmaap_https
+            else
+                use_agent_rest_https
+            fi
         else
-            # Path to callback receiver
             CR_PATH="http://$CR_APP_NAME:$CR_EXTERNAL_PORT/callbacks"
             use_cr_http
+            use_simulator_http
+            use_mr_http
+            if [[ $interface = *"SDNC"* ]]; then
+                use_sdnc_http
+            fi
+            if [[ $interface = *"DMAAP"* ]]; then
+                use_agent_dmaap_http
+            else
+                use_agent_rest_http
+            fi
         fi
 
         # Clean container and start all needed containers #
         clean_containers
 
-        if [ $__httpx == "HTTPS" ]; then
-            #echo "Using secure ports between agent and MR"
-            use_mr_https
-            echo "Using secure ports towards simulators"
-            use_simulator_https
-        else
-            #"Using non-secure ports between agent and MR"
-            use_mr_http
-            echo "Using non-secure ports towards simulators"
-            use_simulator_http
-        fi
-
         start_ric_simulators ricsim_g1 4 OSC_2.1.0
 
         start_ric_simulators ricsim_g2 4 STD_1.1.3
@@ -83,14 +86,7 @@ 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"
+            prepare_consul_config      SDNC    ".consul_config.json"
         else
             prepare_consul_config      NOSDNC  ".consul_config.json"
         fi
@@ -103,24 +99,6 @@ for __httpx in $TESTED_PROTOCOLS ; do
 
         set_agent_debug
 
-        if [[ $interface == *"DMAAP"* ]]; then
-            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"
-                use_agent_rest_https
-            else
-                echo "Using non-secure ports towards the agent"
-                use_agent_rest_http
-            fi
-        fi
-
         api_get_status 200
 
         sim_print ricsim_g1_1 interface
index 7eb3c19..aa6c9e9 100755 (executable)
@@ -21,7 +21,7 @@
 TC_ONELINE_DESCR="Resync of RIC via changes in the consul config"
 
 #App names to exclude checking pulling images for, space separated list
-EXCLUDED_IMAGES="SDNC_ONAP"
+EXCLUDED_IMAGES="ECS"
 
 . ../common/testcase_common.sh  $@
 . ../common/agent_api_functions.sh
index 692d9b5..a4858a1 100755 (executable)
@@ -20,7 +20,7 @@
 TC_ONELINE_DESCR="Change supported policy types and reconfigure rics"
 
 #App names to exclude checking pulling images for, space separated list
-EXCLUDED_IMAGES="SDNC_ONAP"
+EXCLUDED_IMAGES="ECS"
 
 . ../common/testcase_common.sh  $@
 . ../common/agent_api_functions.sh
@@ -78,7 +78,6 @@ for interface in $TESTED_VARIANTS ; do
     start_ric_simulators ricsim_g1 $NUM_RICS OSC_2.1.0
 
     if [[ $interface = *"SDNC"* ]]; then
-        start_sdnc
         prepare_consul_config      SDNC  ".consul_config_all.json"
     else
         prepare_consul_config      NOSDNC  ".consul_config_all.json"
@@ -226,13 +225,13 @@ for interface in $TESTED_VARIANTS ; do
                              ricsim_g1_7:me1_ricsim_g1_7,me2_ricsim_g1_7:3,4,5:???? \
                              ricsim_g1_8:me1_ricsim_g1_8,me2_ricsim_g1_8:4,5:???? "
 
-    sleep 120
+    sleep_wait 120
 
     api_equal json:policy_ids 0
 
     api_get_policy_types 404 ricsim_g1_9
 
-    sim_equal ricsim_g1_9 num_instances 1
+    sim_equal ricsim_g1_9 num_instances 0
 
     api_delete_policy 404 2000
 
@@ -264,7 +263,7 @@ for interface in $TESTED_VARIANTS ; do
                              ricsim_g1_9:me1_ricsim_g1_9,me2_ricsim_g1_9:5:???? \
                              ricsim_g1_10:me1_ricsim_g1_10,me2_ricsim_g1_10:NOTYPE:???? "
 
-    sleep 120
+    sleep_wait 120
 
     api_equal json:policy_ids 0
 
@@ -276,7 +275,7 @@ for interface in $TESTED_VARIANTS ; do
     sim_delete_policy_type 204 ricsim_g1_6 4
     sim_delete_policy_type 204 ricsim_g1_7 4
 
-    sleep 120
+    sleep_wait 120
 
     api_equal json:policy_types?ric=ricsim_g1_1 1 120
     api_equal json:policy_types?ric=ricsim_g1_2 2 120
@@ -319,6 +318,7 @@ for interface in $TESTED_VARIANTS ; do
 
     check_policy_agent_logs
     store_logs          ${interface}
+
 done
 
 
index b1e9f53..92af396 100755 (executable)
@@ -20,7 +20,7 @@
 TC_ONELINE_DESCR="Create 10000 policies in sequence using http/https and Agent REST/DMAAP with/without SDNC controller"
 
 #App names to exclude checking pulling images for, space separated list
-EXCLUDED_IMAGES="SDNC_ONAP"
+EXCLUDED_IMAGES="ECS"
 
 . ../common/testcase_common.sh  $@
 . ../common/agent_api_functions.sh
@@ -49,17 +49,20 @@ 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
+            use_simulator_https
+            use_mr_https
+            use_agent_rest_https
         else
             # Path to callback receiver
             CR_PATH="http://$CR_APP_NAME:$CR_EXTERNAL_PORT/callbacks"
             use_cr_http
+            use_simulator_http
+            use_mr_http
+            use_agent_rest_http
         fi
 
         # Policy instance start id
@@ -67,50 +70,22 @@ for __httpx in $TESTED_PROTOCOLS ; do
 
         clean_containers
 
-        if [ $__httpx == "HTTPS" ]; then
-            #"Using secure ports towards simulators"
-            use_simulator_https
-        else
-            #"Using non-secure ports towards simulators"
-            use_simulator_http
-        fi
-
         start_ric_simulators ricsim_g1 1 OSC_2.1.0
         start_ric_simulators ricsim_g2 1 STD_1.1.3
 
         start_mr
 
-        if [ $__httpx == "HTTPS" ]; then
-            #echo "Using secure ports between agent and MR"
-            use_mr_https
-        else
-            #"Using non-secure ports between agent and MR"
-            use_mr_http
-        fi
-
         start_cr
 
-        if [ $interface == "SDNC" ]; then
-
+        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
-        fi
-
-        start_consul_cbs
-
-        if [ $interface == "SDNC" ]; then
             prepare_consul_config      SDNC    ".consul_config.json"
         else
             prepare_consul_config      NOSDNC  ".consul_config.json"
         fi
 
+        start_consul_cbs
+
         consul_config_app                      ".consul_config.json"
 
         start_control_panel
@@ -119,15 +94,6 @@ for __httpx in $TESTED_PROTOCOLS ; do
 
         set_agent_debug
 
-        if [ $__httpx == "HTTPS" ]; then
-            # "Using secure ports towards the agent"
-            use_agent_rest_https
-        else
-            # "Using non-secure ports towards the agent"
-            use_agent_rest_http
-        fi
-
-
         cr_equal received_callbacks 0
         mr_equal requests_submitted 0
 
index 7fa5ea6..460fb8e 100755 (executable)
@@ -20,7 +20,7 @@
 TC_ONELINE_DESCR="Repeatedly create and delete policies in each RICs for 24h (or configured number of days). Via agent REST/DMAAP/DMAAP_BATCH and SDNC using http or https"
 
 #App names to exclude checking pulling images for, space separated list
-EXCLUDED_IMAGES="SDNC_ONAP"
+EXCLUDED_IMAGES="ECS"
 
 . ../common/testcase_common.sh  $@
 . ../common/agent_api_functions.sh
index b5c991c..d6cc001 100755 (executable)
@@ -20,7 +20,7 @@
 TC_ONELINE_DESCR="Create/delete policies in parallel over a number of ric using a number of child process"
 
 #App names to exclude checking pulling images for, space separated list
-EXCLUDED_IMAGES="SDNC_ONAP"
+EXCLUDED_IMAGES="ECS"
 
 . ../common/testcase_common.sh  $@
 . ../common/agent_api_functions.sh
@@ -51,32 +51,29 @@ 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
+            use_simulator_https
+            use_mr_https
+            if [[ $interface = *"SDNC"* ]]; then
+                use_sdnc_https
+            fi
+            use_agent_rest_https
         else
-            # Path to callback receiver
             CR_PATH="http://$CR_APP_NAME:$CR_EXTERNAL_PORT/callbacks"
             use_cr_http
+            use_simulator_http
+            use_mr_http
+            if [[ $interface = *"SDNC"* ]]; then
+                use_sdnc_http
+            fi
+            use_agent_rest_http
         fi
 
         # Clean container and start all needed containers #
         clean_containers
 
-        if [ $__httpx == "HTTPS" ]; then
-            echo "Using secure ports towards simulators and sdnc"
-            use_simulator_https
-            use_sdnc_https
-        else
-            echo "Using non-secure ports towards simulators and sdnc"
-            use_simulator_http
-            use_sdnc_http
-        fi
-
         start_ric_simulators ricsim_g1 $NUM_RICS OSC_2.1.0
 
         start_consul_cbs
@@ -98,14 +95,6 @@ for __httpx in $TESTED_PROTOCOLS ; do
 
         set_agent_debug
 
-        if [ $__httpx == "HTTPS" ]; then
-            echo "Using secure ports towards the agent"
-            use_agent_rest_https
-        else
-            echo "Using non-secure ports towards the agent"
-            use_agent_rest_http
-        fi
-
         api_get_status 200
 
         for ((i=1; i<=$NUM_RICS; i++))
index c483504..abe648b 100755 (executable)
@@ -20,7 +20,7 @@
 TC_ONELINE_DESCR="Preparation for test of the Control Panel and the Health Check app - populating a number of ric simulators with types and instances"
 
 #App names to exclude checking pulling images for, space separated list
-EXCLUDED_IMAGES="SDNC SDNC_ONAP"
+EXCLUDED_IMAGES="SDNC ECS"
 
 . ../common/testcase_common.sh $@
 . ../common/agent_api_functions.sh
diff --git a/test/auto-test/demo-testdata/OSC/hw-agent-modified.json b/test/auto-test/demo-testdata/OSC/hw-agent-modified.json
new file mode 100644 (file)
index 0000000..5ea5802
--- /dev/null
@@ -0,0 +1,13 @@
+{
+    "$schema": "http://json-schema.org/draft-07/schema#",
+    "title": "2",
+    "description": "Hello World policy type",
+    "type": "object",
+    "properties": {
+      "threshold": {
+        "type": "integer",
+        "default": 0
+      }
+    },
+    "additionalProperties": false
+  }
\ No newline at end of file
diff --git a/test/auto-test/demo-testdata/OSC/pihw_template.json b/test/auto-test/demo-testdata/OSC/pihw_template.json
new file mode 100644 (file)
index 0000000..7574995
--- /dev/null
@@ -0,0 +1,3 @@
+{
+    "threshold": XXX
+}
\ No newline at end of file
diff --git a/test/auto-test/demo-testdata/OSC/piqos_template.json b/test/auto-test/demo-testdata/OSC/piqos_template.json
new file mode 100644 (file)
index 0000000..4446ac5
--- /dev/null
@@ -0,0 +1,9 @@
+{
+    "scope": {
+      "ueId": "0x349d230330ea60XXX",
+      "qosId": "4"
+    },
+    "qosObjectives": {
+      "priorityLevel": 30
+    }
+  }
\ No newline at end of file
diff --git a/test/auto-test/demo-testdata/OSC/pitsa_template.json b/test/auto-test/demo-testdata/OSC/pitsa_template.json
new file mode 100644 (file)
index 0000000..7574995
--- /dev/null
@@ -0,0 +1,3 @@
+{
+    "threshold": XXX
+}
\ No newline at end of file
diff --git a/test/auto-test/demo-testdata/OSC/qos-agent-modified.json b/test/auto-test/demo-testdata/OSC/qos-agent-modified.json
new file mode 100644 (file)
index 0000000..3a012cd
--- /dev/null
@@ -0,0 +1,40 @@
+{
+    "$schema": "http://json-schema.org/draft-07/schema#",
+    "title": "100",
+    "description": "Quality of Service policy type",
+    "type": "object",
+    "properties": {
+      "scope": {
+        "type": "object",
+        "properties": {
+          "ueId": {
+            "type": "string"
+          },
+          "qosId": {
+            "type": "string"
+          }
+        },
+        "additionalProperties": false,
+        "required": [
+          "ueId",
+          "qosId"
+        ]
+      },
+      "qosObjectives": {
+        "type": "object",
+        "properties": {
+          "priorityLevel": {
+            "type": "number"
+          }
+        },
+        "additionalProperties": false,
+        "required": [
+          "priorityLevel"
+        ]
+      }
+    },
+    "additionalProperties": false,
+    "required": [
+      "scope", "qosObjectives"
+    ]
+  }
diff --git a/test/auto-test/demo-testdata/OSC/sim_hw.json b/test/auto-test/demo-testdata/OSC/sim_hw.json
new file mode 100644 (file)
index 0000000..47e0ae0
--- /dev/null
@@ -0,0 +1,18 @@
+{
+    "name": "hwpolicy",
+    "description": "Hellow World policy type",
+    "policy_type_id": 2,
+    "create_schema": {
+      "$schema": "http://json-schema.org/draft-07/schema#",
+      "title": "HW Policy",
+      "description": "Hello World policy type",
+      "type": "object",
+      "properties": {
+        "threshold": {
+          "type": "integer",
+          "default": 0
+        }
+      },
+      "additionalProperties": false
+    }
+  }
\ No newline at end of file
diff --git a/test/auto-test/demo-testdata/OSC/sim_qos.json b/test/auto-test/demo-testdata/OSC/sim_qos.json
new file mode 100644 (file)
index 0000000..92eaa6f
--- /dev/null
@@ -0,0 +1,45 @@
+{
+  "name": "pt1",
+  "description": "pt1 policy type",
+  "policy_type_id": 100,
+  "create_schema": {
+    "$schema": "http://json-schema.org/draft-07/schema#",
+    "title": "OSC_Type1_1.0.0",
+    "description": "Quality of Service policy type",
+    "type": "object",
+    "properties": {
+      "scope": {
+        "type": "object",
+        "properties": {
+          "ueId": {
+            "type": "string"
+          },
+          "qosId": {
+            "type": "string"
+          }
+        },
+        "additionalProperties": false,
+        "required": [
+          "ueId",
+          "qosId"
+        ]
+      },
+      "qosObjectives": {
+        "type": "object",
+        "properties": {
+          "priorityLevel": {
+            "type": "number"
+          }
+        },
+        "additionalProperties": false,
+        "required": [
+          "priorityLevel"
+        ]
+      }
+    },
+    "additionalProperties": false,
+    "required": [
+      "scope", "qosObjectives"
+    ]
+  }
+}
diff --git a/test/auto-test/demo-testdata/OSC/sim_tsa.json b/test/auto-test/demo-testdata/OSC/sim_tsa.json
new file mode 100644 (file)
index 0000000..9227b5e
--- /dev/null
@@ -0,0 +1,18 @@
+{
+  "name": "tsapolicy",
+  "description": "tsa parameters",
+  "policy_type_id": 20008,
+  "create_schema": {
+    "$schema": "http://json-schema.org/draft-07/schema#",
+    "title": "TS Policy",
+    "description": "Traffic Steering - High prio traffic - policy type",
+    "type": "object",
+    "properties": {
+      "threshold": {
+        "type": "integer",
+        "default": 0
+      }
+    },
+    "additionalProperties": false
+  }
+}
\ No newline at end of file
diff --git a/test/auto-test/demo-testdata/OSC/tsa-agent-modified.json b/test/auto-test/demo-testdata/OSC/tsa-agent-modified.json
new file mode 100644 (file)
index 0000000..d9426c7
--- /dev/null
@@ -0,0 +1,13 @@
+{
+    "$schema": "http://json-schema.org/draft-07/schema#",
+    "title": "20008",
+    "description": "Traffic Steering - High prio traffic - policy type",
+    "type": "object",
+    "properties": {
+      "threshold": {
+        "type": "integer",
+        "default": 0
+      }
+    },
+    "additionalProperties": false
+  }
\ No newline at end of file
diff --git a/test/auto-test/demo-testdata/STD/pi1_template.json b/test/auto-test/demo-testdata/STD/pi1_template.json
new file mode 100644 (file)
index 0000000..e06b031
--- /dev/null
@@ -0,0 +1,9 @@
+{
+  "scope": {
+    "ueId": "ueXXX",
+    "qosId": "qosXXX"
+  },
+  "qosObjectives": {
+    "priorityLevel": XXX
+  }
+}
\ No newline at end of file
index 09e8e22..b35966a 100644 (file)
@@ -159,7 +159,7 @@ Function to prepare a Consul config based on the previously configured (and star
 
 | parameter | description |
 | --------- | ----------- |
-| `SDNC|SDNC_ONAP|NOSDNC` | Configure based on a1-controller (SNDC), a1-adapter (SDNC_ONAP) or without a controller/adapter (NOSDNC) |
+| `SDNC|NOSDNC` | Configure based on a1-controller (SNDC) or without a controller/adapter (NOSDNC) |
 | `<output-file>` | The path to the json output file containing the prepared config. This file is used in 'consul_config_app'  |
 
 #### Function: start_consul_cbs ####
@@ -216,18 +216,6 @@ Use https for all API calls towards the SDNC A1 Controller. Note that this funct
 |--|
 | None |
 
-#### Function: start_sdnc_onap ####
-Start the SDNC A1 Adapter container and its database container
-| arg list |
-|--|
-| None |
-
-#### Function: config_sdnc_onap ####
-Configure the SDNC A1 adapter - Not implemented
-| arg list |
-|--|
-| None |
-
 #### Function: start_mr ####
 Start the Message Router stub interface container
 | arg list |
index 2091d65..8ec8fdb 100644 (file)
 
 ### API functiond towards the Policy Agent
 
-# Generic function to query the agent via the REST or DMAAP interface.
-# Used by all other agent api test functions
-# If operation prefix is '_BATCH' the the send and get response is split in two sequences,
-# one for sending the requests and one for receiving the response
-# but only when using the DMAAP interface
-# REST or DMAAP is controlled of the base url of $ADAPTER
-# arg: (GET|PUT|POST|DELETE|GET_BATCH|PUT_BATCH|POST_BATCH|DELETE_BATCH <url> [<file>]) | (RESPONSE <correlation-id>)
-# (Not for test scripts)
-__do_curl_to_agent() {
-    echo "(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
-       paramError=0
-
-    if [ $# -lt 2 ] || [ $# -gt 3 ]; then
-               paramError=1
-    else
-               timeout=""
-               oper=""
-               file=''
-               httpcode=" -sw %{http_code}"
-               accept=''
-               content=''
-               batch=0
-               if [[ $1 == *"_BATCH" ]]; then
-                       batch=1
-               fi
-               if [ $# -gt 2 ]; then
-                       content=" -H Content-Type:application/json"
-               fi
-               if [ $1 == "GET" ] || [ $1 == "GET_BATCH" ]; then
-                       oper="GET"
-                       if [ $# -ne 2 ]; then
-                               paramError=1
-                       fi
-               elif [ $1 == "PUT" ] || [ $1 == "PUT_BATCH" ]; then
-                       oper="PUT"
-                       if [ $# -eq 3 ]; then
-                               file=" --data-binary @$3"
-                       fi
-                       accept=" -H accept:application/json"
-               elif [ $1 == "POST" ] || [ $1 == "POST_BATCH" ]; then
-                       oper="POST"
-                       accept=" -H accept:*/*"
-                       if [ $# -ne 2 ]; then
-                               paramError=1
-                       fi
-               elif [ $1 == "DELETE" ] || [ $1 == "DELETE_BATCH" ]; then
-                       oper="DELETE"
-                       if [ $# -ne 2 ]; then
-                               paramError=1
-                       fi
-               elif [ $1 == "RESPONSE" ]; then
-                       oper="RESPONSE"
-                       if [ $# -ne 2 ]; then
-                               paramError=1
-                       fi
-                       if [ $ADAPTER == $RESTBASE ] || [ $ADAPTER == $RESTBASE_SECURE ]; then
-                               paramError=1
-                       fi
-               else
-                       paramError=1
-               fi
-       fi
-
-    if [ $paramError -eq 1 ]; then
-               ((RES_CONF_FAIL++))
-        echo "-Incorrect number of parameters to __do_curl_agent " $@ >> $HTTPLOG
-        echo "-Expected: (GET|PUT|POST|DELETE|GET_BATCH|PUT_BATCH|POST_BATCH|DELETE_BATCH <url> [<file>]) | (RESPONSE <correlation-id>) [<file>]" >> $HTTPLOG
-        echo "-Returning response 000" >> $HTTPLOG
-        echo "-000"
-        return 1
-    fi
-
-    if [ $ADAPTER == $RESTBASE ] || [ $ADAPTER == $RESTBASE_SECURE ]; then
-        url=" "${ADAPTER}${2}
-        oper=" -X "$oper
-        curlString="curl -k "${oper}${timeout}${httpcode}${accept}${content}${url}${file}
-        echo " CMD: "$curlString >> $HTTPLOG
-               if [ $# -eq 3 ]; then
-                       echo " FILE: $(<$3)" >> $HTTPLOG
-               fi
-
-               # Do retry for configured response codes, otherwise only one attempt
-               maxretries=5
-               while [ $maxretries -ge 0 ]; do
-
-                       let maxretries=maxretries-1
-                       res=$($curlString)
-                       retcode=$?
-                       if [ $retcode -ne 0 ]; then
-                               echo " RETCODE: "$retcode >> $HTTPLOG
-                               echo "000"
-                               return 1
-                       fi
-                       retry=0
-                       echo " RESP: "$res >> $HTTPLOG
-                       status=${res:${#res}-3}
-                       if [ ! -z "${AGENT_RETRY_CODES}" ]; then
-                               for retrycode in $AGENT_RETRY_CODES; do
-                                       if [ $retrycode -eq $status ]; then
-                                               echo -e $RED" Retrying (according to set codes for retry), got status $status....."$ERED  >> $HTTPLOG
-                                               sleep 1
-                                               retry=1
-                                       fi
-                               done
-                       fi
-                       if [ $retry -eq 0 ]; then
-                               maxretries=-1
-                       fi
-               done
-        echo $res
-        return 0
-    else
-               if [ $oper != "RESPONSE" ]; then
-                       requestUrl=$2
-                       if [ $1 == "PUT" ] && [ $# -eq 3 ]; then
-                               payload="$(cat $3 | tr -d '\n' | tr -d ' ' )"
-                               echo "payload: "$payload >> $HTTPLOG
-                               file=" --data-binary "$payload
-                       fi
-                       #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 -k -X POST${timeout}${httpcode}${content}${url}${file}"
-                       echo " CMD: "$curlString >> $HTTPLOG
-                       res=$($curlString)
-                       retcode=$?
-                       if [ $retcode -ne 0 ]; then
-                               echo " RETCODE: "$retcode >> $HTTPLOG
-                               echo "000"
-                               return 1
-                       fi
-                       echo " RESP: "$res >> $HTTPLOG
-                       status=${res:${#res}-3}
-                       if [ $status -ne 200 ]; then
-                               echo "000"
-                               return 1
-                       fi
-                       cid=${res:0:${#res}-3}
-                       if [[ $batch -eq 1 ]]; then
-                               echo $cid"200"
-                               return 0
-                       fi
-               fi
-               if [ $oper == "RESPONSE" ] || [ $batch -eq 0 ]; then
-                       if [ $oper == "RESPONSE" ]; then
-                               cid=$2
-                       fi
-                       url=" "${ADAPTER}"/receive-response?correlationid="${cid}
-                       curlString="curl -k -X GET"${timeout}${httpcode}${url}
-                       echo " CMD: "$curlString >> $HTTPLOG
-                       res=$($curlString)
-                       retcode=$?
-                       if [ $retcode -ne 0 ]; then
-                               echo " RETCODE: "$retcode >> $HTTPLOG
-                               echo "000"
-                               return 1
-                       fi
-                       echo " RESP: "$res >> $HTTPLOG
-                       status=${res:${#res}-3}
-                       TS=$SECONDS
-                       # wait of the reply from the agent...
-                       while [ $status -eq 204 ]; do
-                               if [ $(($SECONDS - $TS)) -gt 90 ]; then
-                                       echo " RETCODE: (timeout after 90s)" >> $HTTPLOG
-                                       echo "000"
-                                       return 1
-                               fi
-                               sleep 0.01
-                               echo " CMD: "$curlString >> $HTTPLOG
-                               res=$($curlString)
-                               if [ $retcode -ne 0 ]; then
-                                       echo " RETCODE: "$retcode >> $HTTPLOG
-                                       echo "000"
-                                       return 1
-                               fi
-                               echo " RESP: "$res >> $HTTPLOG
-                               status=${res:${#res}-3}
-                       done
-                       if [ $status -eq 200 ]; then
-                               body=${res:0:${#res}-3}
-                               echo $body
-                               return 0
-                       fi
-                       echo "Status not 200, returning response 000" >> $HTTPLOG
-                       echo "0000"
-                       return 1
-               fi
-    fi
-}
-
+. ../common/api_curl.sh
 
 #########################################################
 #### Test case functions A1 Policy management service
@@ -274,7 +85,7 @@ api_get_policies() {
        fi
 
        query="/policies"$queryparams
-    res="$(__do_curl_to_agent GET $query)"
+    res="$(__do_curl_to_api PA GET $query)"
     status=${res:${#res}-3}
 
        if [ $status -ne $1 ]; then
@@ -342,7 +153,7 @@ api_get_policy() {
     fi
 
        query="/policy?id=$UUID$2"
-       res="$(__do_curl_to_agent GET $query)"
+       res="$(__do_curl_to_api PA GET $query)"
        status=${res:${#res}-3}
 
        if [ $status -ne $1 ]; then
@@ -410,11 +221,11 @@ api_put_policy() {
 
                file=".p.json"
                sed 's/XXX/'${pid}'/g' $7 > $file
-       res="$(__do_curl_to_agent PUT $query $file)"
+       res="$(__do_curl_to_api PA PUT $query $file)"
        status=${res:${#res}-3}
-               echo -ne " Creating "$count"("$max")${SAMELINE}"
+               echo -ne " Executing "$count"("$max")${SAMELINE}"
                if [ $status -ne $1 ]; then
-                       echo " Created "$count"?("$max")"
+                       echo " Executed "$count"?("$max")"
                        echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                        ((RES_FAIL++))
                        __check_stop_at_error
@@ -423,7 +234,7 @@ api_put_policy() {
 
                let pid=$pid+1
                let count=$count+1
-               echo -ne " Created  "$count"("$max")${SAMELINE}"
+               echo -ne " Executed  "$count"("$max")${SAMELINE}"
        done
        echo ""
 
@@ -469,9 +280,9 @@ api_put_policy_batch() {
 
                file=".p.json"
                sed 's/XXX/'${pid}'/g' $7 > $file
-       res="$(__do_curl_to_agent PUT_BATCH $query $file)"
+       res="$(__do_curl_to_api PA PUT_BATCH $query $file)"
        status=${res:${#res}-3}
-               echo -ne " Requested(batch) "$count"("$max")${SAMELINE}"
+               echo -ne " Requesting(batch) "$count"("$max")${SAMELINE}"
 
                if [ $status -ne 200 ]; then
                        echo " Requested(batch) "$count"?("$max")"
@@ -491,12 +302,12 @@ api_put_policy_batch() {
        count=0
        for cid in $ARR; do
 
-       res="$(__do_curl_to_agent RESPONSE $cid)"
+       res="$(__do_curl_to_api PA RESPONSE $cid)"
        status=${res:${#res}-3}
-               echo -ne " Created(batch) "$count"("$max")${SAMELINE}"
+               echo -ne " Requesting(batch) "$count"("$max")${SAMELINE}"
 
                if [ $status -ne $1 ]; then
-                       echo " Created(batch) "$count"?("$max")"
+                       echo " Requested(batch) "$count"?("$max")"
                        echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                        ((RES_FAIL++))
                        __check_stop_at_error
@@ -504,7 +315,7 @@ api_put_policy_batch() {
                fi
 
                let count=$count+1
-               echo -ne " Created(batch)  "$count"("$max")${SAMELINE}"
+               echo -ne " Requested(batch)  "$count"("$max")${SAMELINE}"
        done
 
        echo ""
@@ -591,7 +402,7 @@ api_put_policy_parallel() {
                fi
        done
        if [ -z $msg ]; then
-               echo " $(($count*$num_rics)) policies created/updated"
+               echo " $(($count*$num_rics)) policy request(s) executed"
                ((RES_PASS++))
                echo -e $GREEN" PASS"$EGREEN
                return 0
@@ -627,12 +438,12 @@ api_delete_policy() {
 
        while [ $count -lt $max ]; do
                query="/policy?id="$UUID$pid
-               res="$(__do_curl_to_agent DELETE $query)"
+               res="$(__do_curl_to_api PA DELETE $query)"
                status=${res:${#res}-3}
-               echo -ne " Deleting "$count"("$max")${SAMELINE}"
+               echo -ne " Executing "$count"("$max")${SAMELINE}"
 
                if [ $status -ne $1 ]; then
-                       echo " Deleted "$count"?("$max")"
+                       echo " Executed "$count"?("$max")"
                        echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                        ((RES_FAIL++))
                        __check_stop_at_error
@@ -640,7 +451,7 @@ api_delete_policy() {
                fi
                let pid=$pid+1
                let count=$count+1
-               echo -ne " Deleted  "$count"("$max")${SAMELINE}"
+               echo -ne " Executed  "$count"("$max")${SAMELINE}"
        done
        echo ""
 
@@ -673,9 +484,9 @@ api_delete_policy_batch() {
        ARR=""
        while [ $count -lt $max ]; do
                query="/policy?id="$UUID$pid
-               res="$(__do_curl_to_agent DELETE_BATCH $query)"
+               res="$(__do_curl_to_api PA DELETE_BATCH $query)"
                status=${res:${#res}-3}
-               echo -ne " Requested(batch) "$count"("$max")${SAMELINE}"
+               echo -ne " Requesting(batch) "$count"("$max")${SAMELINE}"
 
                if [ $status -ne 200 ]; then
                        echo " Requested(batch) "$count"?("$max")"
@@ -696,7 +507,7 @@ api_delete_policy_batch() {
        count=0
        for cid in $ARR; do
 
-       res="$(__do_curl_to_agent RESPONSE $cid)"
+       res="$(__do_curl_to_api PA RESPONSE $cid)"
        status=${res:${#res}-3}
                echo -ne " Deleted(batch) "$count"("$max")${SAMELINE}"
 
@@ -778,7 +589,7 @@ api_delete_policy_parallel() {
                fi
        done
        if [ -z $msg ]; then
-               echo " $(($count*$num_rics)) deleted"
+               echo " $(($count*$num_rics)) policy request(s) executed"
                ((RES_PASS++))
                echo -e $GREEN" PASS"$EGREEN
                return 0
@@ -825,7 +636,7 @@ api_get_policy_ids() {
        fi
 
        query="/policy_ids"$queryparams
-    res="$(__do_curl_to_agent GET $query)"
+    res="$(__do_curl_to_api PA GET $query)"
     status=${res:${#res}-3}
 
        if [ $status -ne $1 ]; then
@@ -879,7 +690,7 @@ api_get_policy_schema() {
     fi
 
        query="/policy_schema?id=$2"
-       res="$(__do_curl_to_agent GET $query)"
+       res="$(__do_curl_to_api PA GET $query)"
        status=${res:${#res}-3}
 
        if [ $status -ne $1 ]; then
@@ -928,7 +739,7 @@ api_get_policy_schemas() {
                query=$query"?ric="$2
        fi
 
-       res="$(__do_curl_to_agent GET $query)"
+       res="$(__do_curl_to_api PA GET $query)"
        status=${res:${#res}-3}
 
        if [ $status -ne $1 ]; then
@@ -1003,7 +814,7 @@ api_get_policy_status() {
 
        query="/policy_status?id="$UUID$2
 
-       res="$(__do_curl_to_agent GET $query)"
+       res="$(__do_curl_to_api PA GET $query)"
     status=${res:${#res}-3}
 
        if [ $status -ne $1 ]; then
@@ -1050,7 +861,7 @@ api_get_policy_types() {
                query="/policy_types?ric=$2"
        fi
 
-    res="$(__do_curl_to_agent GET $query)"
+    res="$(__do_curl_to_api PA GET $query)"
     status=${res:${#res}-3}
 
        if [ $status -ne $1 ]; then
@@ -1107,7 +918,7 @@ api_get_status() {
                return 1
        fi
     query="/status"
-    res="$(__do_curl_to_agent GET $query)"
+    res="$(__do_curl_to_api PA GET $query)"
     status=${res:${#res}-3}
 
        if [ $status -ne $1 ]; then
@@ -1140,7 +951,7 @@ api_get_ric() {
 
        query="/ric?managedElementId="$2
 
-    res="$(__do_curl_to_agent GET $query)"
+    res="$(__do_curl_to_api PA GET $query)"
     status=${res:${#res}-3}
 
        if [ $status -ne $1 ]; then
@@ -1185,7 +996,7 @@ api_get_rics() {
        query="/rics?policyType="$2
        fi
 
-    res="$(__do_curl_to_agent GET $query)"
+    res="$(__do_curl_to_api PA GET $query)"
     status=${res:${#res}-3}
 
        if [ $status -ne $1 ]; then
@@ -1242,7 +1053,7 @@ api_put_service() {
     file=".tmp.json"
        echo "$json" > $file
 
-    res="$(__do_curl_to_agent PUT $query $file)"
+    res="$(__do_curl_to_api PA PUT $query $file)"
     status=${res:${#res}-3}
 
        if [ $status -ne $1 ]; then
@@ -1290,7 +1101,7 @@ api_get_services() {
        query="/services?name="$2
        fi
 
-    res="$(__do_curl_to_agent GET $query)"
+    res="$(__do_curl_to_api PA GET $query)"
     status=${res:${#res}-3}
 
        if [ $status -ne $1 ]; then
@@ -1347,7 +1158,7 @@ api_get_service_ids() {
        fi
 
     query="/services"
-    res="$(__do_curl_to_agent GET $query)"
+    res="$(__do_curl_to_api PA GET $query)"
     status=${res:${#res}-3}
 
        if [ $status -ne $1 ]; then
@@ -1396,7 +1207,7 @@ api_delete_services() {
        fi
 
     query="/services?name="$2
-    res="$(__do_curl_to_agent DELETE $query)"
+    res="$(__do_curl_to_api PA DELETE $query)"
     status=${res:${#res}-3}
 
        if [ $status -ne $1 ]; then
@@ -1425,7 +1236,7 @@ api_put_services_keepalive() {
        fi
 
     query="/services/keepalive?name="$2
-    res="$(__do_curl_to_agent PUT $query)"
+    res="$(__do_curl_to_api PA PUT $query)"
     status=${res:${#res}-3}
 
        if [ $status -ne $1 ]; then
diff --git a/test/common/api_curl.sh b/test/common/api_curl.sh
new file mode 100644 (file)
index 0000000..2aff131
--- /dev/null
@@ -0,0 +1,223 @@
+#!/bin/bash
+
+#  ============LICENSE_START===============================================
+#  Copyright (C) 2020 Nordix Foundation. All rights reserved.
+#  ========================================================================
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#  ============LICENSE_END=================================================
+#
+
+# Generic function to query the agent/ECS via the REST or DMAAP interface.
+# Used by all other agent/ECS api test functions
+# If operation prefix is '_BATCH' the the send and get response is split in two sequences,
+# one for sending the requests and one for receiving the response
+# but only when using the DMAAP interface
+# REST or DMAAP is controlled of the base url of $ADAPTER
+# arg: (PA|ECS GET|PUT|POST|DELETE|GET_BATCH|PUT_BATCH|POST_BATCH|DELETE_BATCH <url> [<file>]) | (PA|ECS RESPONSE <correlation-id>)
+# (Not for test scripts)
+__do_curl_to_api() {
+    echo "(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+       paramError=0
+
+    if [ $# -gt 0 ]; then
+        if [ $1 == "PA" ]; then
+            __ADAPTER=$ADAPTER
+            __RESTBASE=$RESTBASE
+            __RESTBASE_SECURE=$RESTBASE_SECURE
+            __RETRY_CODES=$AGENT_RETRY_CODES
+        elif [ $1 == "ECS" ]; then
+            __ADAPTER=$ECS_ADAPTER
+            __RESTBASE=$ECS_RESTBASE
+            __RESTBASE_SECURE=$ECS_RESTBASE_SECURE
+            __RETRY_CODES=$ECS_RETRY_CODES
+        else
+            paramError=1
+        fi
+    fi
+    if [ $# -lt 3 ] || [ $# -gt 4 ]; then
+               paramError=1
+    else
+               timeout=""
+               oper=""
+               file=''
+               httpcode=" -sw %{http_code}"
+               accept=''
+               content=''
+               batch=0
+               if [[ $2 == *"_BATCH" ]]; then
+                       batch=1
+               fi
+               if [ $# -gt 3 ]; then
+                       content=" -H Content-Type:application/json"
+               fi
+               if [ $2 == "GET" ] || [ $2 == "GET_BATCH" ]; then
+                       oper="GET"
+                       if [ $# -ne 3 ]; then
+                               paramError=1
+                       fi
+               elif [ $2 == "PUT" ] || [ $2 == "PUT_BATCH" ]; then
+                       oper="PUT"
+                       if [ $# -eq 4 ]; then
+                               file=" --data-binary @$4"
+                       fi
+                       accept=" -H accept:application/json"
+               elif [ $2 == "POST" ] || [ $2 == "POST_BATCH" ]; then
+                       oper="POST"
+                       accept=" -H accept:*/*"
+                       if [ $# -ne 3 ]; then
+                               paramError=1
+                       fi
+               elif [ $2 == "DELETE" ] || [ $2 == "DELETE_BATCH" ]; then
+                       oper="DELETE"
+                       if [ $# -ne 3 ]; then
+                               paramError=1
+                       fi
+               elif [ $2 == "RESPONSE" ]; then
+                       oper="RESPONSE"
+                       if [ $# -ne 3 ]; then
+                               paramError=1
+                       fi
+                       if [ $__ADAPTER == $__RESTBASE ] || [ $__ADAPTER == $__RESTBASE_SECURE ]; then
+                               paramError=1
+                       fi
+               else
+                       paramError=1
+               fi
+       fi
+
+    if [ $paramError -eq 1 ]; then
+               ((RES_CONF_FAIL++))
+        echo "-Incorrect number of parameters to __do_curl_agent " $@ >> $HTTPLOG
+        echo "-Expected: (PA|ECS GET|PUT|POST|DELETE|GET_BATCH|PUT_BATCH|POST_BATCH|DELETE_BATCH <url> [<file>]) | (PA|ECS RESPONSE <correlation-id>)" >> $HTTPLOG
+        echo "-Returning response 000" >> $HTTPLOG
+        echo "-000"
+        return 1
+    fi
+
+    if [ $__ADAPTER == $__RESTBASE ] || [ $__ADAPTER == $__RESTBASE_SECURE ]; then
+        url=" "${__ADAPTER}${3}
+        oper=" -X "$oper
+        curlString="curl -k "${oper}${timeout}${httpcode}${accept}${content}${url}${file}
+        echo " CMD: "$curlString >> $HTTPLOG
+               if [ $# -eq 4 ]; then
+                       echo " FILE: $(<$4)" >> $HTTPLOG
+               fi
+
+               # Do retry for configured response codes, otherwise only one attempt
+               maxretries=5
+               while [ $maxretries -ge 0 ]; do
+
+                       let maxretries=maxretries-1
+                       res=$($curlString)
+                       retcode=$?
+                       if [ $retcode -ne 0 ]; then
+                               echo " RETCODE: "$retcode >> $HTTPLOG
+                               echo "000"
+                               return 1
+                       fi
+                       retry=0
+                       echo " RESP: "$res >> $HTTPLOG
+                       status=${res:${#res}-3}
+                       if [ ! -z "${__RETRY_CODES}" ]; then
+                               for retrycode in $__RETRY_CODES; do
+                                       if [ $retrycode -eq $status ]; then
+                                               echo -e $RED" Retrying (according to set codes for retry), got status $status....."$ERED  >> $HTTPLOG
+                                               sleep 1
+                                               retry=1
+                                       fi
+                               done
+                       fi
+                       if [ $retry -eq 0 ]; then
+                               maxretries=-1
+                       fi
+               done
+        echo $res
+        return 0
+    else
+               if [ $oper != "RESPONSE" ]; then
+                       requestUrl=$3
+                       if [ $2 == "PUT" ] && [ $# -eq 4 ]; then
+                               payload="$(cat $4 | tr -d '\n' | tr -d ' ' )"
+                               echo "payload: "$payload >> $HTTPLOG
+                               file=" --data-binary "$payload
+                       fi
+                       #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]))"  "$3")
+                       url=" "${__ADAPTER}"/send-request?url="${requestUrl}"&operation="${oper}
+                       curlString="curl -k -X POST${timeout}${httpcode}${content}${url}${file}"
+                       echo " CMD: "$curlString >> $HTTPLOG
+                       res=$($curlString)
+                       retcode=$?
+                       if [ $retcode -ne 0 ]; then
+                               echo " RETCODE: "$retcode >> $HTTPLOG
+                               echo "000"
+                               return 1
+                       fi
+                       echo " RESP: "$res >> $HTTPLOG
+                       status=${res:${#res}-3}
+                       if [ $status -ne 200 ]; then
+                               echo "000"
+                               return 1
+                       fi
+                       cid=${res:0:${#res}-3}
+                       if [[ $batch -eq 1 ]]; then
+                               echo $cid"200"
+                               return 0
+                       fi
+               fi
+               if [ $oper == "RESPONSE" ] || [ $batch -eq 0 ]; then
+                       if [ $oper == "RESPONSE" ]; then
+                               cid=$3
+                       fi
+                       url=" "${__ADAPTER}"/receive-response?correlationid="${cid}
+                       curlString="curl -k -X GET"${timeout}${httpcode}${url}
+                       echo " CMD: "$curlString >> $HTTPLOG
+                       res=$($curlString)
+                       retcode=$?
+                       if [ $retcode -ne 0 ]; then
+                               echo " RETCODE: "$retcode >> $HTTPLOG
+                               echo "000"
+                               return 1
+                       fi
+                       echo " RESP: "$res >> $HTTPLOG
+                       status=${res:${#res}-3}
+                       TS=$SECONDS
+                       # wait of the reply from the agent/ECS...
+                       while [ $status -eq 204 ]; do
+                               if [ $(($SECONDS - $TS)) -gt 90 ]; then
+                                       echo " RETCODE: (timeout after 90s)" >> $HTTPLOG
+                                       echo "000"
+                                       return 1
+                               fi
+                               sleep 0.01
+                               echo " CMD: "$curlString >> $HTTPLOG
+                               res=$($curlString)
+                               if [ $retcode -ne 0 ]; then
+                                       echo " RETCODE: "$retcode >> $HTTPLOG
+                                       echo "000"
+                                       return 1
+                               fi
+                               echo " RESP: "$res >> $HTTPLOG
+                               status=${res:${#res}-3}
+                       done
+                       if [ $status -eq 200 ]; then
+                               body=${res:0:${#res}-3}
+                               echo $body
+                               return 0
+                       fi
+                       echo "Status not 200, returning response 000" >> $HTTPLOG
+                       echo "0000"
+                       return 1
+               fi
+    fi
+}
\ No newline at end of file
diff --git a/test/common/ecs_api_functions.sh b/test/common/ecs_api_functions.sh
new file mode 100644 (file)
index 0000000..3c37299
--- /dev/null
@@ -0,0 +1,484 @@
+#!/bin/bash
+
+#  ============LICENSE_START===============================================
+#  Copyright (C) 2020 Nordix Foundation. All rights reserved.
+#  ========================================================================
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#  ============LICENSE_END=================================================
+#
+
+# This is a script that contains specific test functions for ECS NB/SB API
+
+. ../common/api_curl.sh
+
+############### EXPERIMENTAL #############
+
+##########################################
+###### Mainly only function skeletons ####
+##########################################
+
+##########################################
+### A1-E Enrichment Data Consumer API ####
+##########################################
+#Function prefix: ecs_api_a1
+
+# API Test function: GET /A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs
+# args: <response-code>
+# (Function for test scripts)
+ecs_api_a1_get_job_ids() {
+       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
+    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+       ((RES_TEST++))
+
+    if [ $# -lt 1 ]; then
+               __print_err "<response-code> [<producer-id>]*|NOID" $@
+               return 1
+       fi
+
+       ((RES_PASS++))
+       echo -e $GREEN" PASS"$EGREEN
+       return 0
+}
+
+# API Test function: GET â€‹/A1-EI​/v1​/eitypes​/{eiTypeId}
+# args: <response-code>
+# (Function for test scripts)
+ecs_api_a1_get_type() {
+       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
+    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+       ((RES_TEST++))
+
+    if [ $# -lt 1 ]; then
+               __print_err "<response-code> [<producer-id>]*|NOID" $@
+               return 1
+       fi
+
+       ((RES_PASS++))
+       echo -e $GREEN" PASS"$EGREEN
+       return 0
+}
+
+# API Test function: GET â€‹/A1-EI​/v1​/eitypes
+# args: <response-code>
+# (Function for test scripts)
+ecs_api_a1_get_type_ids() {
+       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
+    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+       ((RES_TEST++))
+
+    if [ $# -lt 1 ]; then
+               __print_err "<response-code> [<producer-id>]*|NOID" $@
+               return 1
+       fi
+
+       ((RES_PASS++))
+       echo -e $GREEN" PASS"$EGREEN
+       return 0
+}
+
+# API Test function: GET â€‹/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}​/status
+# args: <response-code>
+# (Function for test scripts)
+ecs_api_a1_get_job_status() {
+       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
+    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+       ((RES_TEST++))
+
+    if [ $# -lt 1 ]; then
+               __print_err "<response-code> [<producer-id>]*|NOID" $@
+               return 1
+       fi
+
+       ((RES_PASS++))
+       echo -e $GREEN" PASS"$EGREEN
+       return 0
+}
+
+# API Test function: GET â€‹/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}
+# args: <response-code>
+# (Function for test scripts)
+ecs_api_a1_get_job() {
+       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
+    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+       ((RES_TEST++))
+
+    if [ $# -lt 1 ]; then
+               __print_err "<response-code> [<producer-id>]*|NOID" $@
+               return 1
+       fi
+
+       ((RES_PASS++))
+       echo -e $GREEN" PASS"$EGREEN
+       return 0
+}
+
+# API Test function: DELETE â€‹/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}
+# args: <response-code>
+# (Function for test scripts)
+ecs_api_a1_delete_job() {
+       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
+    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+       ((RES_TEST++))
+
+    if [ $# -lt 1 ]; then
+               __print_err "<response-code> [<producer-id>]*|NOID" $@
+               return 1
+       fi
+
+       ((RES_PASS++))
+       echo -e $GREEN" PASS"$EGREEN
+       return 0
+}
+
+# API Test function: PUT â€‹/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}
+# args: <response-code>
+# (Function for test scripts)
+ecs_api_a1_put_job() {
+       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
+    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+       ((RES_TEST++))
+
+    if [ $# -lt 1 ]; then
+               __print_err "<response-code> [<producer-id>]*|NOID" $@
+               return 1
+       fi
+
+       ((RES_PASS++))
+       echo -e $GREEN" PASS"$EGREEN
+       return 0
+}
+
+
+##########################################
+####   Enrichment Data Producer API   ####
+##########################################
+# Function prefix: ecs_api_edp
+
+# API Test function: GET /ei-producer/v1/eitypes
+# args: <response-code>
+# (Function for test scripts)
+ecs_api_edp_get_type_ids() {
+       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
+    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+       ((RES_TEST++))
+
+    if [ $# -lt 1 ]; then
+               __print_err "<response-code> [<producer-id>]*|NOID" $@
+               return 1
+       fi
+
+       ((RES_PASS++))
+       echo -e $GREEN" PASS"$EGREEN
+       return 0
+}
+
+# API Test function: GET /ei-producer/v1/eiproducers/{eiProducerId}/status
+# args: <response-code>
+# (Function for test scripts)
+ecs_api_edp_get_producer_status() {
+       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
+    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+       ((RES_TEST++))
+
+    if [ $# -lt 1 ]; then
+               __print_err "<response-code> [<producer-id>]*|NOID" $@
+               return 1
+       fi
+
+       ((RES_PASS++))
+       echo -e $GREEN" PASS"$EGREEN
+       return 0
+}
+
+
+# API Test function: GET /ei-producer/v1/eiproducers
+# args: <response-code> [<producer-id>]*|NOID
+# (Function for test scripts)
+ecs_api_edp_get_producer_ids() {
+       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
+    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+       ((RES_TEST++))
+
+    if [ $# -lt 1 ]; then
+               __print_err "<response-code> [<producer-id>]*|NOID" $@
+               return 1
+       fi
+
+       query="/ei-producer/v1/eiproducers"
+    res="$(__do_curl_to_api ECS GET $query)"
+    status=${res:${#res}-3}
+
+       if [ $status -ne $1 ]; then
+               echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
+               ((RES_FAIL++))
+               __check_stop_at_error
+               return 1
+       fi
+
+       if [ $# -gt 1 ]; then
+               body=${res:0:${#res}-3}
+               targetJson="["
+
+               for pid in ${@:2} ; do
+                       if [ "$targetJson" != "[" ]; then
+                               targetJson=$targetJson","
+                       fi
+                       if [ $pid != "NOID" ]; then
+                               targetJson=$targetJson"\"$pid\""
+                       fi
+               done
+
+               targetJson=$targetJson"]"
+               echo "TARGET JSON: $targetJson" >> $HTTPLOG
+               res=$(python3 ../common/compare_json.py "$targetJson" "$body")
+
+               if [ $res -ne 0 ]; then
+                       echo -e $RED" FAIL, returned body not correct"$ERED
+                       ((RES_FAIL++))
+                       __check_stop_at_error
+                       return 1
+               fi
+       fi
+
+       ((RES_PASS++))
+       echo -e $GREEN" PASS"$EGREEN
+       return 0
+}
+
+# API Test function: GET /ei-producer/v1/eitypes/{eiTypeId}
+# args: <response-code>
+# (Function for test scripts)
+ecs_api_edp_get_type() {
+       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
+    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+       ((RES_TEST++))
+
+    if [ $# -lt 1 ]; then
+               __print_err "<response-code> [<producer-id>]*|NOID" $@
+               return 1
+       fi
+
+       ((RES_PASS++))
+       echo -e $GREEN" PASS"$EGREEN
+       return 0
+}
+
+# API Test function: GET /ei-producer/v1/eiproducers/{eiProducerId}
+# args: <response-code>
+# (Function for test scripts)
+ecs_api_edp_get_producer() {
+       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
+    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+       ((RES_TEST++))
+
+    if [ $# -lt 1 ]; then
+               __print_err "<response-code> [<producer-id>]*|NOID" $@
+               return 1
+       fi
+
+       ((RES_PASS++))
+       echo -e $GREEN" PASS"$EGREEN
+       return 0
+}
+
+# API Test function: DELETE /ei-producer/v1/eiproducers/{eiProducerId}
+# args: <response-code>
+# (Function for test scripts)
+ecs_api_edp_delete_producer() {
+       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
+    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+       ((RES_TEST++))
+
+    if [ $# -lt 1 ]; then
+               __print_err "<response-code> [<producer-id>]*|NOID" $@
+               return 1
+       fi
+
+       ((RES_PASS++))
+       echo -e $GREEN" PASS"$EGREEN
+       return 0
+}
+
+# API Test function: PUT /ei-producer/v1/eiproducers/{eiProducerId}
+# args: <response-code>
+# (Function for test scripts)
+ecs_api_edp_put_producer() {
+       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
+    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+       ((RES_TEST++))
+
+    if [ $# -lt 1 ]; then
+               __print_err "<response-code> [<producer-id>]*|NOID" $@
+               return 1
+       fi
+
+       ((RES_PASS++))
+       echo -e $GREEN" PASS"$EGREEN
+       return 0
+}
+
+# API Test function: GET /ei-producer/v1/eiproducers/{eiProducerId}/eijobs
+# args: <response-code>
+# (Function for test scripts)
+ecs_api_edp_get_producer_jobs() {
+       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
+    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+       ((RES_TEST++))
+
+    if [ $# -lt 1 ]; then
+               __print_err "<response-code> [<producer-id>]*|NOID" $@
+               return 1
+       fi
+
+       ((RES_PASS++))
+       echo -e $GREEN" PASS"$EGREEN
+       return 0
+}
+
+
+##########################################
+####        Producer Simulator        ####
+##########################################
+# Function prefix: ecs_api_sim
+
+# API Test function: POST â€‹/producer_simulator​/job_deleted_error
+# args: <response-code>
+# (Function for test scripts)
+ecs_api_sim_post_job_delete_error() {
+       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
+    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+       ((RES_TEST++))
+
+    if [ $# -lt 1 ]; then
+               __print_err "<response-code> [<producer-id>]*|NOID" $@
+               return 1
+       fi
+
+       ((RES_PASS++))
+       echo -e $GREEN" PASS"$EGREEN
+       return 0
+}
+
+# API Test function: GET /producer_simulator​/supervision
+# args: <response-code>
+# (Function for test scripts)
+ecs_api_sim_get_producer_supervision() {
+       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
+    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+       ((RES_TEST++))
+
+    if [ $# -lt 1 ]; then
+               __print_err "<response-code> [<producer-id>]*|NOID" $@
+               return 1
+       fi
+
+       ((RES_PASS++))
+       echo -e $GREEN" PASS"$EGREEN
+       return 0
+}
+
+# API Test function: POST /producer_simulator​/job_deleted
+# args: <response-code>
+# (Function for test scripts)
+ecs_api_sim_post_job_deleted() {
+       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
+    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+       ((RES_TEST++))
+
+    if [ $# -lt 1 ]; then
+               __print_err "<response-code> [<producer-id>]*|NOID" $@
+               return 1
+       fi
+
+       ((RES_PASS++))
+       echo -e $GREEN" PASS"$EGREEN
+       return 0
+}
+
+# API Test function: GET â€‹/producer_simulator​/supervision_error
+# args: <response-code>
+# (Function for test scripts)
+ecs_api_get_producer_supervision_error() {
+       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
+    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+       ((RES_TEST++))
+
+    if [ $# -lt 1 ]; then
+               __print_err "<response-code> [<producer-id>]*|NOID" $@
+               return 1
+       fi
+
+       ((RES_PASS++))
+       echo -e $GREEN" PASS"$EGREEN
+       return 0
+}
+
+# API Test function: POST /producer_simulator​/job_created_error
+# args: <response-code>
+# (Function for test scripts)
+ecs_api_sim_get_job_created_error() {
+       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
+    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+       ((RES_TEST++))
+
+    if [ $# -lt 1 ]; then
+               __print_err "<response-code> [<producer-id>]*|NOID" $@
+               return 1
+       fi
+
+       ((RES_PASS++))
+       echo -e $GREEN" PASS"$EGREEN
+       return 0
+}
+
+# API Test function: POST â€‹/producer_simulator​/job_created
+# args: <response-code>
+# (Function for test scripts)
+ecs_api_sim_get_job_created() {
+       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
+    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+       ((RES_TEST++))
+
+    if [ $# -lt 1 ]; then
+               __print_err "<response-code> [<producer-id>]*|NOID" $@
+               return 1
+       fi
+
+       ((RES_PASS++))
+       echo -e $GREEN" PASS"$EGREEN
+       return 0
+}
+
+
+##########################################
+####          Service status          ####
+##########################################
+# Function prefix: ecs_api_service
+
+# API Test function: GET â€‹/status
+# args: <response-code>
+# (Function for test scripts)
+ecs_api_service_status() {
+       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
+    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+       ((RES_TEST++))
+
+    if [ $# -lt 1 ]; then
+               __print_err "<response-code> [<producer-id>]*|NOID" $@
+               return 1
+       fi
+
+       ((RES_PASS++))
+       echo -e $GREEN" PASS"$EGREEN
+       return 0
+}
\ No newline at end of file
index 8417ece..56d7583 100755 (executable)
@@ -30,6 +30,12 @@ POLICY_AGENT_LOCAL_IMAGE_TAG="2.1.0-SNAPSHOT"
 POLICY_AGENT_REMOTE_IMAGE="nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-policy-agent"
 POLICY_AGENT_REMOTE_IMAGE_TAG="2.1.0"
 
+# Local ECS image and tag
+ECS_LOCAL_IMAGE="o-ran-sc/nonrtric-enrichment-coordinator-service"
+ECS_LOCAL_IMAGE_TAG="1.0.0-SNAPSHOT"
+# Remote ECS image and tag
+ECS_REMOTE_IMAGE="nexus3.o-ran-sc.org:10003/o-ran-sc/nonrtric-enrichment-coordinator-service"
+ECS_REMOTE_IMAGE_TAG="1.0.0-SNAPSHOT"
 
 # Control Panel local image and tag
 CONTROL_PANEL_LOCAL_IMAGE="o-ran-sc/nonrtric-controlpanel"
@@ -53,17 +59,6 @@ SDNC_DB_REMOTE_IMAGE_TAG="5.6"
 #No local image for DB, remote image always used
 
 
-# SDNC ONAP A1 Adapte remote image and tag
-SDNC_ONAP_A1_ADAPTER_REMOTE_IMAGE="nexus3.onap.org:10003/onap/sdnc-image"
-SDNC_ONAP_A1_ADAPTER_REMOTE_IMAGE_TAG="1.8-STAGING-latest"
-#No local image for the A1 adapter, remote image always used
-
-#ONAP A1 Adatper remote image and tag
-SDNC_ONAP_DB_REMOTE_IMAGE="mysql/mysql-server"
-SDNC_ONAP_DB_REMOTE_IMAGE_TAG="5.6"
-#No local image for DB, remote image always used
-
-
 # Near RT RIC Simulator local image and tag
 RIC_SIM_LOCAL_IMAGE="nexus3.o-ran-sc.org:10004/o-ran-sc/a1-simulator"
 RIC_SIM_LOCAL_IMAGE_TAG="latest"
@@ -80,7 +75,6 @@ CONSUL_REMOTE_IMAGE_TAG="1.7.2"
 
 #CBS remote image and tag
 CBS_REMOTE_IMAGE="nexus3.onap.org:10001/onap/org.onap.dcaegen2.platform.configbinding.app-app"
-CBS_REMOTE_IMAGE="onap/org.onap.dcaegen2.platform.configbinding.app-app"
 CBS_REMOTE_IMAGE_TAG="2.3.0"
 #No local image for CBS, remote image always used
 
@@ -107,6 +101,15 @@ export POLICY_AGENT_APP_NAME="policy-agent"                     # Name for Polic
 POLICY_AGENT_LOGPATH="/var/log/policy-agent/application.log"    # Path the application log in the Policy Agent container
 export POLICY_AGENT_APP_NAME_ALIAS="policy-agent-container"     # Alias name, name used by the control panel
 
+export ECS_EXTERNAL_PORT=8082                                   # ECS container external port (host -> container)
+export ECS_INTERNAL_PORT=8082                                   # ECS container internal port (container -> container)
+export ECS_EXTERNAL_SECURE_PORT=8434                            # ECS container external secure port (host -> container)
+export ECS_INTERNAL_SECURE_PORT=8434                            # ECS container internal secure port (container -> container)
+
+export ECS_APP_NAME="ecs"                                       # Name for ECS container
+ECS_LOGPATH="/var/log/ecs/application.log"                      # Path the application log in the ECS container
+export ECS_APP_NAME_ALIAS="ecs-container"                       # Alias name, name used by the control panel
+
 export MR_EXTERNAL_PORT=3905                                    # MR stub container external port (host -> container)
 export MR_INTERNAL_PORT=3905                                    # MR stub container internal port (container -> container)
 export MR_EXTERNAL_SECURE_PORT=3906                             # MR stub container external secure port (host -> container)
@@ -153,30 +156,23 @@ SDNC_API_URL="/restconf/operations/A1-ADAPTER-API:"             # Base url path
 SDNC_ALIVE_URL="/apidoc/explorer/"                              # Base url path for SNDC API docs (for alive check)
 SDNC_KARAF_LOG="/opt/opendaylight/data/log/karaf.log"           # Path to karaf log
 
-export SDNC_ONAP_APP_NAME="a1-adapter"                          # Name of the ONAP A1 Adapter container
-export SDNC_ONAP_EXTERNAL_PORT=8282                             # ONAP A1 Adapter container external port (host -> container)
-export SDNC_ONAP_INTERNAL_PORT=8181                             # ONAP A1 Adapter container internal port (container -> container)
-export SDNC_ONAP_EXTERNAL_SECURE_PORT=8443                      # SNDC A1 Adapter container external securee port (host -> container)
-export SDNC_ONAP_INTERNAL_SECURE_PORT=8343                      # SNDC A1 Adapter container internal secure port (container -> container)
-export SDNC_ONAP_DB_APP_NAME="sdnc-onap-db"                     # Name of the ONAP A1 Adapter DB container
-SDNC_ONAP_USER="admin"                                          # ONAP A1 Adapter username
-SDNC_ONAP_PWD="Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U"     # ONAP A1 Adapter PWD
-SDNC_ONAP_API_URL="/restconf/operations/A1-ADAPTER-API:"        # Base url path for ONAP A1 Adapter API
-SDNC_ONAP_ALIVE_URL="/apidoc/explorer/"                         # Base url path for ONAP A1 Adapter API docs (for alive check)
-SDNC_ONAP_PROPERTIES_FILE="/opt/onap/ccsdk/data/properties/a1-adapter-api-dg.properties"
-SDNC_ONAP_KARAF_LOG="/opt/opendaylight/data/log/karaf.log"      # Path to karaf log
-
 export CONTROL_PANEL_APP_NAME="control-panel"                   # Name of the Control Panel container
 export CONTROL_PANEL_EXTERNAL_PORT=8080                         # Control Panel container external port (host -> container)
 export CONTROL_PANEL_INTERNAL_PORT=8080                         # Control Panel container external port (host -> container)
 CONTROL_PANEL_LOGPATH="/logs/nonrtric-controlpanel.log"         # Path the application log in the Control Panel container
 
 UUID=""                                                         # UUID used as prefix to the policy id to simulate a real UUID
-                                                                # Testscript need to set the UUID to use other this empty prefix is used
+                                                                # Testscript need to set the UUID otherwise this empty prefix is used
 
 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, 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
+                                                                # The values of this var is swiched between the four base url when needed
+ECS_RESTBASE="http://localhost:"$ECS_EXTERNAL_PORT              # Base url to the ECS NB REST interface
+ECS_RESTBASE_SECURE="https://localhost:"$ECS_EXTERNAL_SECURE_PORT # Base url to the secure ECS NB REST interface
+ECS_DMAAPBASE="http://localhost:"$MR_EXTERNAL_PORT              # Base url to the Dmaap adapter, http
+ECS_DMAAPBASE_SECURE="https://localhost:"$MR_EXTERNAL_SECURE_PORT   # Base url to the Dmaap adapter, https
+ECS_ADAPTER=$ECS_RESTBASE                                       # Adapter holds the address the ECS R-APP interface (REST OR DMAAP)
+                                                                # The values of this var is swiched between the four base url when needed
\ No newline at end of file
index 39a593c..a90700a 100755 (executable)
 # Arg: local|remote|remote-remove [auto-clean] [--stop-at-error] [--ricsim-prefix <prefix> ] [ --env-file <environment-filename> ] [--use-local-image <app-nam> [<app-name>]*]
 
 
+# Create a test case id, ATC (Auto Test Case), from the name of the test case script.
+# FTC1.sh -> ATC == FTC1
+ATC=$(basename "${BASH_SOURCE[$i+1]}" .sh)
+
+#Create result file (containing '1' for error) for this test case
+#Will be replaced with a file containing '0' if all test cases pass
+echo "1" > "$PWD/.result$ATC.txt"
+
 #Formatting for 'echo' cmd
 BOLD="\033[1m"
 EBOLD="\033[0m"
@@ -60,7 +68,10 @@ echo "Test case started as: ${BASH_SOURCE[$i+1]} "$@
 #Localhost constant
 LOCALHOST="http://localhost:"
 
-# Make curl retries for http response codes set in this env var, space separated list of codes
+# Make curl retries towards ECS for http response codes set in this env var, space separated list of codes
+ECS_RETRY_CODES=""
+
+# Make curl retries towards the agent for http response codes set in this env var, space separated list of codes
 AGENT_RETRY_CODES=""
 
 # Var to contol if the agent runs in a container (normal = 0) or as application on the local machine ( = 1)
@@ -73,11 +84,17 @@ AUTO_CLEAN=""
 USE_LOCAL_IMAGES=""
 
 # List of available apps to override with local image
-AVAILABLE_LOCAL_IMAGES_OVERRIDE="PA CP SDNC RICSIM"
+AVAILABLE_LOCAL_IMAGES_OVERRIDE="PA ECS CP SDNC RICSIM"
 
 # Use this var (STOP_AT_ERROR=1 in the test script) for debugging/trouble shooting to take all logs and exit at first FAIL test case
 STOP_AT_ERROR=0
 
+# Function to indent cmd output with one space
+indent1() { sed 's/^/ /'; }
+
+# Function to indent cmd output with two spaces
+indent2() { sed 's/^/  /'; }
+
 # Set a description string for the test case
 if [ -z "$TC_ONELINE_DESCR" ]; then
        TC_ONELINE_DESCR="<no-description>"
@@ -91,10 +108,6 @@ if [ -f .tmp_tcsuite_ctr ]; then
        echo $tmpval > .tmp_tcsuite_ctr
 fi
 
-# Create a test case id, ATC (Auto Test Case), from the name of the test case script.
-# FTC1.sh -> ATC == FTC1
-ATC=$(basename "${BASH_SOURCE[$i+1]}" .sh)
-
 # Create the logs dir if not already created in the current dir
 if [ ! -d "logs" ]; then
     mkdir logs
@@ -105,10 +118,6 @@ TESTLOGS=$PWD/logs
 HTTPLOG=$PWD"/.httplog_"$ATC".txt"
 echo "" > $HTTPLOG
 
-#Create result file (containing '1' for error) for this test case
-#Will be replaced with a file containing '0' if script is ok
-
-echo "1" > "$PWD/.result$ATC.txt"
 
 # Create a log dir for the test case
 mkdir -p $TESTLOGS/$ATC
@@ -243,7 +252,7 @@ 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
+       echo -e $RED"Selected env var file does not exist: "$TEST_ENV_VAR_FILE$ERED
        exit 1
 fi
 
@@ -282,13 +291,19 @@ image_list_file=".image-list"
 echo -e " Container\tImage\ttag" > $image_list_file
 
 # Check if image env var is set and if so export the env var with image to use (used by docker compose files)
-# arg: <image name> <script start-arg> <target-variable-name> <image-variable-name> <image-tag-variable-name>
+# arg: <image name> <script start-arg> <target-variable-name> <image-variable-name> <image-tag-variable-name> <app-short-name>
 __check_image_var() {
-       if [ $# -ne 5 ]; then
-               echo "Expected arg: <image name> <script start-arg> <target-variable-name> <image-variable-name> <image-tag-variable-name>"
+       if [ $# -ne 6 ]; then
+               echo "Expected arg: <image name> <script start-arg> <target-variable-name> <image-variable-name> <image-tag-variable-name> <app-short-name>"
                ((IMAGE_ERR++))
                return
        fi
+       __check_excluded_image $6
+       if [ $? -ne 0 ]; then
+               echo -e "$1\t<image-excluded>\t<no-tag>"  >> $image_list_file
+               # Image is excluded since the corresponding app is not used in this test
+               return
+       fi
        tmp=${1}"\t"
        #Create var from the input var names
        image="${!4}"
@@ -319,6 +334,7 @@ __check_image_var() {
 
 
 #Check if app local image shall override remote image
+# Possible IDs for local image override: PA, CP, SDNC, RICSIM, ECS
 __check_image_local_override() {
        for im in $USE_LOCAL_IMAGES; do
                if [ "$1" == "$im" ]; then
@@ -329,6 +345,7 @@ __check_image_local_override() {
 }
 
 #Check if app uses image excluded from this test run
+# Possible IDs for image exclusion: PA, CP, SDNC, RICSIM, MR, CR, CBS, CONSUL, ECS
 __check_excluded_image() {
        for im in $EXCLUDED_IMAGES; do
                if [ "$1" == "$im" ]; then
@@ -344,53 +361,62 @@ echo ""
 if [ $START_ARG == "local" ]; then
 
        #Local agent image
-       __check_image_var " Policy Agent" $START_ARG "POLICY_AGENT_IMAGE" "POLICY_AGENT_LOCAL_IMAGE" "POLICY_AGENT_LOCAL_IMAGE_TAG"
+       __check_image_var " Policy Agent" $START_ARG "POLICY_AGENT_IMAGE" "POLICY_AGENT_LOCAL_IMAGE" "POLICY_AGENT_LOCAL_IMAGE_TAG" PA
 
        #Local Control Panel image
-       __check_image_var " Control Panel" $START_ARG "CONTROL_PANEL_IMAGE" "CONTROL_PANEL_LOCAL_IMAGE" "CONTROL_PANEL_LOCAL_IMAGE_TAG"
+       __check_image_var " Control Panel" $START_ARG "CONTROL_PANEL_IMAGE" "CONTROL_PANEL_LOCAL_IMAGE" "CONTROL_PANEL_LOCAL_IMAGE_TAG" CP
 
        #Local SNDC image
-       __check_image_var " SDNC A1 Controller" $START_ARG "SDNC_A1_CONTROLLER_IMAGE" "SDNC_A1_CONTROLLER_LOCAL_IMAGE" "SDNC_A1_CONTROLLER_LOCAL_IMAGE_TAG"
+       __check_image_var " SDNC A1 Controller" $START_ARG "SDNC_A1_CONTROLLER_IMAGE" "SDNC_A1_CONTROLLER_LOCAL_IMAGE" "SDNC_A1_CONTROLLER_LOCAL_IMAGE_TAG" SDNC
 
        #Local ric sim image
-       __check_image_var " RIC Simulator" $START_ARG "RIC_SIM_IMAGE" "RIC_SIM_LOCAL_IMAGE" "RIC_SIM_LOCAL_IMAGE_TAG"
+       __check_image_var " RIC Simulator" $START_ARG "RIC_SIM_IMAGE" "RIC_SIM_LOCAL_IMAGE" "RIC_SIM_LOCAL_IMAGE_TAG" RICSIM
 
 elif [ $START_ARG == "remote" ] || [ $START_ARG == "remote-remove" ]; then
 
        __check_image_local_override 'PA'
        if [ $? -eq 0 ]; then
                #Remote agent image
-               __check_image_var " Policy Agent" $START_ARG "POLICY_AGENT_IMAGE" "POLICY_AGENT_REMOTE_IMAGE" "POLICY_AGENT_REMOTE_IMAGE_TAG"
+               __check_image_var " Policy Agent" $START_ARG "POLICY_AGENT_IMAGE" "POLICY_AGENT_REMOTE_IMAGE" "POLICY_AGENT_REMOTE_IMAGE_TAG" PA
        else
                #Local agent image
-               __check_image_var " Policy Agent" $START_ARG "POLICY_AGENT_IMAGE" "POLICY_AGENT_LOCAL_IMAGE" "POLICY_AGENT_LOCAL_IMAGE_TAG"
+               __check_image_var " Policy Agent" $START_ARG "POLICY_AGENT_IMAGE" "POLICY_AGENT_LOCAL_IMAGE" "POLICY_AGENT_LOCAL_IMAGE_TAG" PA
        fi
 
        __check_image_local_override 'CP'
        if [ $? -eq 0 ]; then
                #Remote Control Panel image
-               __check_image_var " Control Panel" $START_ARG "CONTROL_PANEL_IMAGE" "CONTROL_PANEL_REMOTE_IMAGE" "CONTROL_PANEL_REMOTE_IMAGE_TAG"
+               __check_image_var " Control Panel" $START_ARG "CONTROL_PANEL_IMAGE" "CONTROL_PANEL_REMOTE_IMAGE" "CONTROL_PANEL_REMOTE_IMAGE_TAG" CP
        else
                #Local Control Panel image
-               __check_image_var " Control Panel" $START_ARG "CONTROL_PANEL_IMAGE" "CONTROL_PANEL_LOCAL_IMAGE" "CONTROL_PANEL_LOCAL_IMAGE_TAG"
+               __check_image_var " Control Panel" $START_ARG "CONTROL_PANEL_IMAGE" "CONTROL_PANEL_LOCAL_IMAGE" "CONTROL_PANEL_LOCAL_IMAGE_TAG" CP
        fi
 
        __check_image_local_override 'SDNC'
        if [ $? -eq 0 ]; then
                #Remote SDNC image
-               __check_image_var " SDNC A1 Controller" $START_ARG "SDNC_A1_CONTROLLER_IMAGE" "SDNC_A1_CONTROLLER_REMOTE_IMAGE" "SDNC_A1_CONTROLLER_REMOTE_IMAGE_TAG"
+               __check_image_var " SDNC A1 Controller" $START_ARG "SDNC_A1_CONTROLLER_IMAGE" "SDNC_A1_CONTROLLER_REMOTE_IMAGE" "SDNC_A1_CONTROLLER_REMOTE_IMAGE_TAG" SDNC
        else
                #Local SNDC image
-               __check_image_var " SDNC A1 Controller" $START_ARG "SDNC_A1_CONTROLLER_IMAGE" "SDNC_A1_CONTROLLER_LOCAL_IMAGE" "SDNC_A1_CONTROLLER_LOCAL_IMAGE_TAG"
+               __check_image_var " SDNC A1 Controller" $START_ARG "SDNC_A1_CONTROLLER_IMAGE" "SDNC_A1_CONTROLLER_LOCAL_IMAGE" "SDNC_A1_CONTROLLER_LOCAL_IMAGE_TAG" SDNC
        fi
 
        __check_image_local_override 'RICSIM'
        if [ $? -eq 0 ]; then
                #Remote ric sim image
-               __check_image_var " RIC Simulator" $START_ARG "RIC_SIM_IMAGE" "RIC_SIM_REMOTE_IMAGE" "RIC_SIM_REMOTE_IMAGE_TAG"
+               __check_image_var " RIC Simulator" $START_ARG "RIC_SIM_IMAGE" "RIC_SIM_REMOTE_IMAGE" "RIC_SIM_REMOTE_IMAGE_TAG" RICSIM
        else
                #Local ric sim image
-               __check_image_var " RIC Simulator" $START_ARG "RIC_SIM_IMAGE" "RIC_SIM_LOCAL_IMAGE" "RIC_SIM_LOCAL_IMAGE_TAG"
+               __check_image_var " RIC Simulator" $START_ARG "RIC_SIM_IMAGE" "RIC_SIM_LOCAL_IMAGE" "RIC_SIM_LOCAL_IMAGE_TAG" RICSIM
+       fi
+
+       __check_image_local_override 'ECS'
+       if [ $? -eq 0 ]; then
+               #Remote ecs image
+               __check_image_var " ECS" $START_ARG "ECS_IMAGE" "ECS_REMOTE_IMAGE" "ECS_REMOTE_IMAGE_TAG" ECS
+       else
+               #Local ecs image
+               __check_image_var " ECS" $START_ARG "ECS_IMAGE" "ECS_LOCAL_IMAGE" "ECS_LOCAL_IMAGE_TAG" ECS
        fi
 
 else
@@ -401,16 +427,11 @@ fi
 
 
 # These images are not built as part of this project official images, just check that env vars are set correctly
-__check_image_var " Message Router" $START_ARG "MRSTUB_IMAGE" "MRSTUB_LOCAL_IMAGE" "MRSTUB_LOCAL_IMAGE_TAG"
-__check_image_var " Callback Receiver" $START_ARG "CR_IMAGE" "CR_LOCAL_IMAGE" "CR_LOCAL_IMAGE_TAG"
-__check_image_var " Consul" $START_ARG "CONSUL_IMAGE" "CONSUL_REMOTE_IMAGE" "CONSUL_REMOTE_IMAGE_TAG"
-__check_image_var " CBS" $START_ARG "CBS_IMAGE" "CBS_REMOTE_IMAGE" "CBS_REMOTE_IMAGE_TAG"
-__check_image_var " SDNC DB" $START_ARG "SDNC_DB_IMAGE" "SDNC_DB_REMOTE_IMAGE" "SDNC_DB_REMOTE_IMAGE_TAG"
-__check_excluded_image 'SDNC_ONAP'
-if [ $? -eq 0 ]; then
-       __check_image_var " SDNC ONAP A1 Adapter" $START_ARG "SDNC_ONAP_A1_ADAPTER_IMAGE" "SDNC_ONAP_A1_ADAPTER_REMOTE_IMAGE" "SDNC_ONAP_A1_ADAPTER_REMOTE_IMAGE_TAG"
-       __check_image_var " SDNC ONAP DB" $START_ARG "SDNC_ONAP_DB_IMAGE" "SDNC_ONAP_DB_REMOTE_IMAGE" "SDNC_ONAP_DB_REMOTE_IMAGE_TAG"
-fi
+__check_image_var " Message Router" $START_ARG "MRSTUB_IMAGE" "MRSTUB_LOCAL_IMAGE" "MRSTUB_LOCAL_IMAGE_TAG" MR
+__check_image_var " Callback Receiver" $START_ARG "CR_IMAGE" "CR_LOCAL_IMAGE" "CR_LOCAL_IMAGE_TAG" CR
+__check_image_var " Consul" $START_ARG "CONSUL_IMAGE" "CONSUL_REMOTE_IMAGE" "CONSUL_REMOTE_IMAGE_TAG" CONSUL
+__check_image_var " CBS" $START_ARG "CBS_IMAGE" "CBS_REMOTE_IMAGE" "CBS_REMOTE_IMAGE_TAG" CBS
+__check_image_var " SDNC DB" $START_ARG "SDNC_DB_IMAGE" "SDNC_DB_REMOTE_IMAGE" "SDNC_DB_REMOTE_IMAGE_TAG" SDNC #Uses sdnc app name
 
 #Errors in image setting - exit
 if [ $IMAGE_ERR -ne 0 ]; then
@@ -493,7 +514,7 @@ __check_and_pull_image() {
                        echo -ne "  Removing image - ${SAMELINE}"
                        tmp="$(docker images -q ${4})" &> /dev/null
                        if [ $? -eq 0 ] && [ ! -z "$tmp" ]; then
-                               docker rmi $4 &> .dockererr
+                               docker rmi --force $4 &> .dockererr
                                if [ $? -ne 0 ]; then
                                        ((IMAGE_ERR++))
                                        echo ""
@@ -529,29 +550,69 @@ __check_and_pull_image() {
 
 echo -e $BOLD"Pulling configured images, if needed"$EBOLD
 
-START_ARG_MOD=$START_ARG
-__check_image_local_override 'PA'
-if [ $? -eq 1 ]; then
-       START_ARG_MOD="local"
+__check_excluded_image 'PA'
+if [ $? -eq 0 ]; then
+       START_ARG_MOD=$START_ARG
+       __check_image_local_override 'PA'
+       if [ $? -eq 1 ]; then
+               START_ARG_MOD="local"
+       fi
+       app="Policy Agent";             __check_and_pull_image $START_ARG_MOD "$app" $POLICY_AGENT_APP_NAME $POLICY_AGENT_IMAGE
+else
+       echo -e $YELLOW" Excluding PA image from image check/pull"$EYELLOW
+fi
+
+__check_excluded_image 'ECS'
+if [ $? -eq 0 ]; then
+       START_ARG_MOD=$START_ARG
+       __check_image_local_override 'ECS'
+       if [ $? -eq 1 ]; then
+               START_ARG_MOD="local"
+       fi
+       app="ECS";             __check_and_pull_image $START_ARG_MOD "$app" $ECS_APP_NAME $ECS_IMAGE
+else
+       echo -e $YELLOW" Excluding ECS image from image check/pull"$EYELLOW
+fi
+
+__check_excluded_image 'CP'
+if [ $? -eq 0 ]; then
+       START_ARG_MOD=$START_ARG
+       __check_image_local_override 'CP'
+       if [ $? -eq 1 ]; then
+               START_ARG_MOD="local"
+       fi
+       app="Non-RT RIC Control Panel"; __check_and_pull_image $START_ARG_MOD "$app" $CONTROL_PANEL_APP_NAME $CONTROL_PANEL_IMAGE
+else
+       echo -e $YELLOW" Excluding Non-RT RIC Control Panel image from image check/pull"$EYELLOW
 fi
-app="Policy Agent";             __check_and_pull_image $START_ARG_MOD "$app" $POLICY_AGENT_APP_NAME $POLICY_AGENT_IMAGE
 
-START_ARG_MOD=$START_ARG
-__check_image_local_override 'CP'
-if [ $? -eq 1 ]; then
-       START_ARG_MOD="local"
+__check_excluded_image 'RICSIM'
+if [ $? -eq 0 ]; then
+       START_ARG_MOD=$START_ARG
+       __check_image_local_override 'RICSIM'
+       if [ $? -eq 1 ]; then
+               START_ARG_MOD="local"
+       fi
+       app="Near-RT RIC Simulator";    __check_and_pull_image $START_ARG_MOD "$app" $RIC_SIM_PREFIX"_"$RIC_SIM_BASE $RIC_SIM_IMAGE
+else
+       echo -e $YELLOW" Excluding Near-RT RIC Simulator image from image check/pull"$EYELLOW
 fi
-app="Non-RT RIC Control Panel"; __check_and_pull_image $START_ARG_MOD "$app" $CONTROL_PANEL_APP_NAME $CONTROL_PANEL_IMAGE
 
-START_ARG_MOD=$START_ARG
-__check_image_local_override 'RICSIM'
-if [ $? -eq 1 ]; then
-       START_ARG_MOD="local"
+
+__check_excluded_image 'CONSUL'
+if [ $? -eq 0 ]; then
+       app="Consul";                   __check_and_pull_image $START_ARG "$app" $CONSUL_APP_NAME $CONSUL_IMAGE
+else
+       echo -e $YELLOW" Excluding Consul image from image check/pull"$EYELLOW
+fi
+
+__check_excluded_image 'CBS'
+if [ $? -eq 0 ]; then
+       app="CBS";                      __check_and_pull_image $START_ARG "$app" $CBS_APP_NAME $CBS_IMAGE
+else
+       echo -e $YELLOW" Excluding CBS image from image check/pull"$EYELLOW
 fi
-app="Near-RT RIC Simulator";    __check_and_pull_image $START_ARG_MOD "$app" $RIC_SIM_PREFIX"_"$RIC_SIM_BASE $RIC_SIM_IMAGE
 
-app="Consul";                   __check_and_pull_image $START_ARG "$app" $CONSUL_APP_NAME $CONSUL_IMAGE
-app="CBS";                      __check_and_pull_image $START_ARG "$app" $CBS_APP_NAME $CBS_IMAGE
 __check_excluded_image 'SDNC'
 if [ $? -eq 0 ]; then
        START_ARG_MOD=$START_ARG
@@ -564,16 +625,6 @@ if [ $? -eq 0 ]; then
 else
        echo -e $YELLOW" Excluding SDNC image and related DB image from image check/pull"$EYELLOW
 fi
-__check_excluded_image 'SDNC_ONAP'
-if [ $? -eq 0 ]; then
-       app="SDNC ONAP A1 Adapter";     __check_and_pull_image $START_ARG "$app" $SDNC_ONAP_APP_NAME $SDNC_ONAP_A1_ADAPTER_IMAGE
-       app="SDNC ONAP DB";             __check_and_pull_image $START_ARG "$app" $SDNC_ONAP_APP_NAME $SDNC_ONAP_DB_IMAGE
-else
-       echo -e $YELLOW" Excluding ONAP SDNC image and related DB image from image check/pull"$EYELLOW
-fi
-# MR stub image not checked, will be built by this script - only local image
-# CR stub image not checked, will be built by this script - only local image
-
 
 #Errors in image setting - exit
 if [ $IMAGE_ERR -ne 0 ]; then
@@ -591,30 +642,40 @@ echo ""
 echo -e $BOLD"Building images needed for test"$EBOLD
 
 curdir=$PWD
-cd $curdir
-cd ../mrstub
-echo " Building mrstub image: mrstub:latest"
-docker build -t mrstub . &> .dockererr
+__check_excluded_image 'MR'
 if [ $? -eq 0 ]; then
-       echo -e  $GREEN" Build Ok"$EGREEN
+       cd $curdir
+       cd ../mrstub
+       echo " Building mrstub image: mrstub:latest"
+       docker build -t mrstub . &> .dockererr
+       if [ $? -eq 0 ]; then
+               echo -e  $GREEN" Build Ok"$EGREEN
+       else
+               echo -e $RED" Build Failed"$ERED
+               ((RES_CONF_FAIL++))
+               cat .dockererr
+       fi
+       cd $curdir
 else
-       echo -e $RED" Build Failed"$ERED
-       ((RES_CONF_FAIL++))
-       cat .dockererr
+       echo -e $YELLOW" Excluding mrstub from image build"$EYELLOW
 fi
-cd $curdir
 
-cd ../cr
-echo " Building Callback Receiver image: callback-receiver:latest"
-docker build -t callback-receiver . &> .dockererr
+__check_excluded_image 'CR'
 if [ $? -eq 0 ]; then
-       echo -e  $GREEN" Build Ok"$EGREEN
+       cd ../cr
+       echo " Building Callback Receiver image: callback-receiver:latest"
+       docker build -t callback-receiver . &> .dockererr
+       if [ $? -eq 0 ]; then
+               echo -e  $GREEN" Build Ok"$EGREEN
+       else
+               echo -e $RED" Build Failed"$ERED
+               ((RES_CONF_FAIL++))
+               cat .dockererr
+       fi
+       cd $curdir
 else
-       echo -e $RED" Build Failed"$ERED
-       ((RES_CONF_FAIL++))
-       cat .dockererr
+       echo -e $YELLOW" Excluding Callback Receiver from image build"$EYELLOW
 fi
-cd $curdir
 
 echo ""
 
@@ -622,25 +683,45 @@ echo ""
 echo -e $BOLD"Local docker registry images used in the this test script"$EBOLD
 
 docker_tmp_file=.docker-images-table
-format_string="{{.Repository}}\\t{{.Tag}}\\t{{.CreatedSince}}\\t{{.Size}}"
-echo -e " Application\tRepository\tTag\tCreated Since\tSize" > $docker_tmp_file
-echo -e " Policy Agent\t$(docker images --format $format_string $POLICY_AGENT_IMAGE)" >>   $docker_tmp_file
-echo -e " Control Panel\t$(docker images --format $format_string $CONTROL_PANEL_IMAGE)" >>   $docker_tmp_file
-echo -e " RIC Simulator\t$(docker images --format $format_string $RIC_SIM_IMAGE)" >>   $docker_tmp_file
-echo -e " Message Router\t$(docker images --format $format_string $MRSTUB_IMAGE)" >>   $docker_tmp_file
-echo -e " Callback Receiver\t$(docker images --format $format_string $CR_IMAGE)" >>   $docker_tmp_file
-echo -e " Consul\t$(docker images --format $format_string $CONSUL_IMAGE)" >>   $docker_tmp_file
-echo -e " CBS\t$(docker images --format $format_string $CBS_IMAGE)" >>   $docker_tmp_file
+format_string="{{.Repository}}\\t{{.Tag}}\\t{{.CreatedSince}}\\t{{.Size}}\\t{{.CreatedAt}}"
+echo -e " Application\tRepository\tTag\tCreated since\tSize\tCreated at" > $docker_tmp_file
+__check_excluded_image 'PA'
+if [ $? -eq 0 ]; then
+       echo -e " Policy Agent\t$(docker images --format $format_string $POLICY_AGENT_IMAGE)" >>   $docker_tmp_file
+fi
+__check_excluded_image 'ECS'
+if [ $? -eq 0 ]; then
+       echo -e " ECS\t$(docker images --format $format_string $ECS_IMAGE)" >>   $docker_tmp_file
+fi
+__check_excluded_image 'CP'
+if [ $? -eq 0 ]; then
+       echo -e " Control Panel\t$(docker images --format $format_string $CONTROL_PANEL_IMAGE)" >>   $docker_tmp_file
+fi
+__check_excluded_image 'RICSIM'
+if [ $? -eq 0 ]; then
+       echo -e " RIC Simulator\t$(docker images --format $format_string $RIC_SIM_IMAGE)" >>   $docker_tmp_file
+fi
+__check_excluded_image 'MR'
+if [ $? -eq 0 ]; then
+       echo -e " Message Router\t$(docker images --format $format_string $MRSTUB_IMAGE)" >>   $docker_tmp_file
+fi
+__check_excluded_image 'CR'
+if [ $? -eq 0 ]; then
+       echo -e " Callback Receiver\t$(docker images --format $format_string $CR_IMAGE)" >>   $docker_tmp_file
+fi
+__check_excluded_image 'CONSUL'
+if [ $? -eq 0 ]; then
+       echo -e " Consul\t$(docker images --format $format_string $CONSUL_IMAGE)" >>   $docker_tmp_file
+fi
+__check_excluded_image 'CBS'
+if [ $? -eq 0 ]; then
+       echo -e " CBS\t$(docker images --format $format_string $CBS_IMAGE)" >>   $docker_tmp_file
+fi
 __check_excluded_image 'SDNC'
 if [ $? -eq 0 ]; then
        echo -e " SDNC A1 Controller\t$(docker images --format $format_string $SDNC_A1_CONTROLLER_IMAGE)" >>   $docker_tmp_file
        echo -e " SDNC DB\t$(docker images --format $format_string $SDNC_DB_IMAGE)" >>   $docker_tmp_file
 fi
-__check_excluded_image 'SDNC_ONAP'
-if [ $? -eq 0 ]; then
-       echo -e " SDNC ONAP A1 Adapter\t$(docker images --format $format_string $SDNC_ONAP_A1_ADAPTER_IMAGE)" >>   $docker_tmp_file
-       echo -e " SDNC ONAP DB\t$(docker images --format $format_string $SDNC_ONAP_DB_IMAGE)" >>   $docker_tmp_file
-fi
 
 column -t -s $'\t' $docker_tmp_file
 
@@ -832,6 +913,15 @@ __check_stop_at_error() {
        return 0
 }
 
+# Check if app name var is set. If so return the app name otherwise return "NOTSET"
+__check_app_name() {
+       if [ $# -eq 1 ]; then
+               echo $1
+       else
+               echo "NOTSET"
+       fi
+}
+
 # Stop and remove all containers
 # args: -
 # (Function for test scripts)
@@ -839,20 +929,20 @@ clean_containers() {
 
        echo -e $BOLD"Stopping and removing all running containers, by container name"$EBOLD
 
-       CONTAINTER_NAMES=("Policy Agent           " $POLICY_AGENT_APP_NAME\
-                                         "Non-RT RIC Simulator(s)" $RIC_SIM_PREFIX\
-                                         "Message Router         " $MR_APP_NAME\
-                                         "Callback Receiver      " $CR_APP_NAME\
-                                         "Control Panel          " $CONTROL_PANEL_APP_NAME\
-                                         "SDNC A1 Controller     " $SDNC_APP_NAME\
-                                         "SDNC DB                " $SDNC_DB_APP_NAME\
-                                         "SDNC ONAP A1 Adapter   " $SDNC_ONAP_APP_NAME\
-                                         "SDNC DB                " $SDNC_ONAP_DB_APP_NAME\
-                                         "CBS                    " $CBS_APP_NAME\
-                                         "Consul                 " $CONSUL_APP_NAME)
+       CONTAINTER_NAMES=("Policy Agent           " $(__check_app_name $POLICY_AGENT_APP_NAME)\
+                                         "ECS                    " $(__check_app_name $ECS_APP_NAME)\
+                                         "Non-RT RIC Simulator(s)" $(__check_app_name $RIC_SIM_PREFIX)\
+                                         "Message Router         " $(__check_app_name $MR_APP_NAME)\
+                                         "Callback Receiver      " $(__check_app_name $CR_APP_NAME)\
+                                         "Control Panel          " $(__check_app_name $CONTROL_PANEL_APP_NAME)\
+                                         "SDNC A1 Controller     " $(__check_app_name $SDNC_APP_NAME)\
+                                         "SDNC DB                " $(__check_app_name $SDNC_DB_APP_NAME)\
+                                         "CBS                    " $(__check_app_name $CBS_APP_NAME)\
+                                         "Consul                 " $(__check_app_name $CONSUL_APP_NAME))
 
        nw=0 # Calc max width of container name, to make a nice table
        for (( i=1; i<${#CONTAINTER_NAMES[@]} ; i+=2 )) ; do
+
                if [ ${#CONTAINTER_NAMES[i]} -gt $nw ]; then
                        nw=${#CONTAINTER_NAMES[i]}
                fi
@@ -861,14 +951,16 @@ clean_containers() {
        for (( i=0; i<${#CONTAINTER_NAMES[@]} ; i+=2 )) ; do
                APP="${CONTAINTER_NAMES[i]}"
                CONTR="${CONTAINTER_NAMES[i+1]}"
-               for((w=${#CONTR}; w<$nw; w=w+1)); do
-                       CONTR="$CONTR "
-               done
-               echo -ne " $APP: $CONTR - ${GREEN}stopping${EGREEN}${SAMELINE}"
-               docker stop $(docker ps -qa --filter name=${CONTR}) &> /dev/null
-               echo -ne " $APP: $CONTR - ${GREEN}stopped${EGREEN}${SAMELINE}"
-               docker rm --force $(docker ps -qa --filter name=${CONTR}) &> /dev/null
-               echo -e  " $APP: $CONTR - ${GREEN}stopped removed${EGREEN}"
+               if [ $CONTR != "NOTSET" ]; then
+                       for((w=${#CONTR}; w<$nw; w=w+1)); do
+                               CONTR="$CONTR "
+                       done
+                       echo -ne " $APP: $CONTR - ${GREEN}stopping${EGREEN}${SAMELINE}"
+                       docker stop $(docker ps -qa --filter name=${CONTR}) &> /dev/null
+                       echo -ne " $APP: $CONTR - ${GREEN}stopped${EGREEN}${SAMELINE}"
+                       docker rm --force $(docker ps -qa --filter name=${CONTR}) &> /dev/null
+                       echo -e  " $APP: $CONTR - ${GREEN}stopped removed${EGREEN}"
+               fi
        done
 
        echo ""
@@ -876,22 +968,30 @@ clean_containers() {
        echo -e $BOLD" Removing docker network"$EBOLD
        TMP=$(docker network ls -q --filter name=$DOCKER_SIM_NWNAME)
        if [ "$TMP" ==  $DOCKER_SIM_NWNAME ]; then
-               docker network rm $DOCKER_SIM_NWNAME
+               docker network rm $DOCKER_SIM_NWNAME | indent2
                if [ $? -ne 0 ];  then
                        echo -e $RED" Cannot remove docker network. Manually remove or disconnect containers from $DOCKER_SIM_NWNAME"$ERED
                        exit 1
                fi
        fi
+       echo -e "$GREEN  Done$EGREEN"
+       echo ""
 
        echo -e $BOLD" Removing all unused docker neworks"$EBOLD
-       docker network prune --force #&> /dev/null
+       docker network prune --force | indent2
+       echo -e "$GREEN  Done$EGREEN"
+       echo ""
 
        echo -e $BOLD" Removing all unused docker volumes"$EBOLD
-       docker volume prune --force #&> /dev/null
+       docker volume prune --force | indent2
+       echo -e "$GREEN  Done$EGREEN"
+       echo ""
 
        echo -e $BOLD" Removing all dangling/untagged docker images"$EBOLD
     docker rmi --force $(docker images -q -f dangling=true) &> /dev/null
        echo ""
+       echo -e "$GREEN  Done$EGREEN"
+       echo ""
 
        CONTRS=$(docker ps | awk '$1 != "CONTAINER" { n++ }; END { print n+0 }')
        if [ $? -eq 0 ]; then
@@ -969,11 +1069,13 @@ __create_docker_network() {
                return 1
        fi
        if [ "$tmp" != $DOCKER_SIM_NWNAME ]; then
-               echo -e "Creating docker network:$BOLD $DOCKER_SIM_NWNAME $EBOLD"
-               docker network create $DOCKER_SIM_NWNAME
+               echo -e " Creating docker network:$BOLD $DOCKER_SIM_NWNAME $EBOLD"
+               docker network create $DOCKER_SIM_NWNAME | indent2
                if [ $? -ne 0 ]; then
                        echo -e $RED" Could not create docker network $DOCKER_SIM_NWNAME"$ERED
                        return 1
+               else
+                       echo -e "$GREEN  Done$EGREEN"
                fi
        else
                echo -e " Docker network $DOCKER_SIM_NWNAME already exists$GREEN OK $EGREEN"
@@ -1177,7 +1279,7 @@ consul_config_app() {
 }
 
 # Function to perpare the consul configuration according to the current simulator configuration
-# args: SDNC|SDNC_ONAP|NOSDNC <output-file>
+# args: SDNC|NOSDNC <output-file>
 # (Function for test scripts)
 prepare_consul_config() {
        echo -e $BOLD"Prepare Consul config"$EBOLD
@@ -1186,19 +1288,17 @@ prepare_consul_config() {
 
        if [ $# != 2 ];  then
                ((RES_CONF_FAIL++))
-       __print_err "need two args,  SDNC|SDNC_ONAP|NOSDNC <output-file>" $@
+       __print_err "need two args,  SDNC|NOSDNC <output-file>" $@
                exit 1
        fi
 
        if [ $1 == "SDNC" ]; then
                echo -e " Config$BOLD including SDNC$EBOLD configuration"
-       elif [ $1 == "SDNC_ONAP" ]; then
-               echo -e " Config$BOLD including SDNC ONAP$EBOLD configuration"
        elif [ $1 == "NOSDNC" ];  then
-               echo -e " Config$BOLD excluding SDNC or SDNC ONAP$EBOLD configuration"
+               echo -e " Config$BOLD excluding SDNC$EBOLD configuration"
        else
                ((RES_CONF_FAIL++))
-       __print_err "need two args,  SDNC|SDNC_ONAP|NOSDNC <output-file>" $@
+       __print_err "need two args,  SDNC|NOSDNC <output-file>" $@
                exit 1
        fi
 
@@ -1217,21 +1317,6 @@ prepare_consul_config() {
                config_json=$config_json"\n                     }"
                config_json=$config_json"\n   ],"
        fi
-       if [ $1 == "SDNC_ONAP" ]; then
-               config_json=$config_json"\n   \"controller\": ["
-               config_json=$config_json"\n                     {"
-               config_json=$config_json"\n                       \"name\": \"$SDNC_ONAP_APP_NAME\","
-               if [ $AGENT_STAND_ALONE -eq 0 ]; then
-                       config_json=$config_json"\n                       \"baseUrl\": \"http://$SDNC_ONAP_APP_NAME:$SDNC_ONAP_INTERNAL_PORT\","
-               else
-                       config_json=$config_json"\n                       \"baseUrl\": \"http://localhost:$SDNC_ONAP_EXTERNAL_PORT\","
-               fi
-               config_json=$config_json"\n                       \"userName\": \"$SDNC_ONAP_USER\","
-               config_json=$config_json"\n                       \"password\": \"$SDNC_ONAP_PWD\""
-               config_json=$config_json"\n                     }"
-               config_json=$config_json"\n   ],"
-       fi
-
 
        config_json=$config_json"\n   \"streams_publishes\": {"
        config_json=$config_json"\n                            \"dmaap_publisher\": {"
@@ -1282,8 +1367,6 @@ prepare_consul_config() {
                fi
                if [ $1 == "SDNC" ]; then
                        config_json=$config_json"\n            \"controller\": \"$SDNC_APP_NAME\","
-               elif [ $1 == "SDNC_ONAP" ]; then
-                       config_json=$config_json"\n            \"controller\": \"$SDNC_ONAP_APP_NAME\","
                fi
                config_json=$config_json"\n            \"managedElementIds\": ["
                config_json=$config_json"\n              \"me1_$ric\","
@@ -1309,7 +1392,12 @@ prepare_consul_config() {
 start_consul_cbs() {
 
        echo -e $BOLD"Starting Consul and CBS"$EBOLD
-
+       __check_excluded_image 'CONSUL'
+       if [ $? -eq 1 ]; then
+               echo -e $RED"The Consul image has not been checked for this test run due to arg to the test script"$ERED
+               echo -e $RED"Consul will not be started"$ERED
+               exit
+       fi
        __start_container consul_cbs NODOCKERARGS  "$CONSUL_APP_NAME" "$CONSUL_EXTERNAL_PORT" "/ui/dc1/kv" "http" \
                                                     "$CBS_APP_NAME" "$CBS_EXTERNAL_PORT" "/healthcheck" "http"
 }
@@ -1319,7 +1407,7 @@ start_consul_cbs() {
 ###########################
 
 use_simulator_http() {
-       echo -e "Using unsecure $BOLD http $EBOLD towards the simulators"
+       echo -e "Using $BOLD http $EBOLD towards the simulators"
        export RIC_SIM_HTTPX="http"
        export RIC_SIM_LOCALHOST=$RIC_SIM_HTTPX"://localhost:"
        export RIC_SIM_PORT=$RIC_SIM_INTERNAL_PORT
@@ -1327,7 +1415,7 @@ use_simulator_http() {
 }
 
 use_simulator_https() {
-       echo -e "Using secure $BOLD https $EBOLD towards the simulators"
+       echo -e "Using $BOLD https $EBOLD towards the simulators"
        export RIC_SIM_HTTPX="https"
        export RIC_SIM_LOCALHOST=$RIC_SIM_HTTPX"://localhost:"
        export RIC_SIM_PORT=$RIC_SIM_INTERNAL_SECURE_PORT
@@ -1342,6 +1430,13 @@ start_ric_simulators() {
 
        echo -e $BOLD"Starting RIC Simulators"$EBOLD
 
+       __check_excluded_image 'RICSIM'
+       if [ $? -eq 1 ]; then
+               echo -e $RED"The Near-RT RIC Simulator image has not been checked for this test run due to arg to the test script"$ERED
+               echo -e $RED"The Near-RT RIC Simulartor(s) will not be started"$ERED
+               exit
+       fi
+
        RIC1=$RIC_SIM_PREFIX"_g1"
        RIC2=$RIC_SIM_PREFIX"_g2"
        RIC3=$RIC_SIM_PREFIX"_g3"
@@ -1398,7 +1493,12 @@ start_ric_simulators() {
 start_control_panel() {
 
        echo -e $BOLD"Starting Control Panel"$EBOLD
-
+       __check_excluded_image 'CP'
+       if [ $? -eq 1 ]; then
+               echo -e $RED"The Control Panel image has not been checked for this test run due to arg to the test script"$ERED
+               echo -e $RED"The Control Panel will not be started"$ERED
+               exit
+       fi
        __start_container control_panel NODOCKERARGS $CONTROL_PANEL_APP_NAME $CONTROL_PANEL_EXTERNAL_PORT "/" "http"
 
 }
@@ -1426,7 +1526,7 @@ start_sdnc() {
 }
 
 use_sdnc_http() {
-       echo -e $BOLD"Using http between agent and SDNC"$EBOLD
+       echo -e "Using $BOLD http $EBOLD towards SDNC"
        export SDNC_HTTPX="http"
        export SDNC_PORT=$SDNC_INTERNAL_PORT
        export SDNC_LOCAL_PORT=$SDNC_EXTERNAL_PORT
@@ -1434,69 +1534,13 @@ use_sdnc_http() {
 }
 
 use_sdnc_https() {
-       echo -e $BOLD"Using https between agent and SDNC"$EBOLD
+       echo -e "Using $BOLD https $EBOLD towards SDNC"
        export SDNC_HTTPX="https"
        export SDNC_PORT=$SDNC_INTERNAL_SECURE_PORT
        export SDNC_LOCAL_PORT=$SDNC_EXTERNAL_SECURE_PORT
        echo ""
 }
 
-#######################
-### SDNC ONAP functions
-#######################
-
-# Start the SDNC ONAP A1 Adapter
-# args: -
-# (Function for test scripts)
-start_sdnc_onap() {
-
-       echo -e $BOLD"Starting SDNC ONAP A1 Adapter"$EBOLD
-
-       __check_excluded_image 'SDNC_ONAP'
-       if [ $? -eq 1 ]; then
-               echo -e $RED"The image for SDNC ONAP and the related DB has not been checked for this test run due to arg to the test script"$ERED
-               echo -e $RED"SDNC ONAP will not be started"$ERED
-               exit
-       fi
-
-       __start_container sdnc_onap NODOCKERARGS $SDNC_ONAP_APP_NAME $SDNC_ONAP_EXTERNAL_PORT $SDNC_ONAP_ALIVE_URL "http"
-
-}
-
-# Configure the SDNC ONAP A1 Adapter
-# args: -
-# (Function for test scripts)
-config_sdnc_onap() {
-
-       echo -e $BOLD"Configuring SDNC ONAP A1 Adapter"$EBOLD
-
-       LOCALFILE=".sdnc_onap.prop"
-       REMOTEFILE="/tmp/.sdnc_onap.prop"
-
-       docker cp $SDNC_ONAP_APP_NAME:$SDNC_ONAP_PROPERTIES_FILE $LOCALFILE
-       if [ $? -ne 0 ]; then
-               echo -e $RED"Could not copy $SDNC_ONAP_PROPERTIES_FILE from $SDNC_ONAP_APP_NAME container"$ERED
-               exit 1
-       fi
-
-
-       #Config of the prop file shall be inserted here
-
-       #Copy file to /tmp and then to final destination, a trick to get correct permission of the file.
-
-       docker cp $LOCALFILE $SDNC_ONAP_APP_NAME:$REMOTEFILE
-       if [ $? -ne 0 ]; then
-               echo -e $RED"Could not copy local $LOCALFILE to $REMOTEFILE in $SDNC_ONAP_APP_NAME container"$ERED
-               exit 1
-       fi
-
-       docker exec -it $SDNC_ONAP_APP_NAME cp $REMOTEFILE $SDNC_ONAP_PROPERTIES_FILE
-       if [ $? -ne 0 ]; then
-               echo -e $RED"Could not copy $REMOTEFILE to $SDNC_ONAP_PROPERTIES_FILE in $SDNC_ONAP_APP_NAME container"$ERED
-               exit 1
-       fi
-}
-
 #####################
 ### MR stub functions
 #####################
@@ -1507,12 +1551,18 @@ config_sdnc_onap() {
 start_mr() {
 
        echo -e $BOLD"Starting Message Router 'mrstub'"$EBOLD
+       __check_excluded_image 'MR'
+       if [ $? -eq 1 ]; then
+               echo -e $RED"The Message Router image has not been checked for this test run due to arg to the test script"$ERED
+               echo -e $RED"The Message Router will not be started"$ERED
+               exit
+       fi
        export MR_CERT_MOUNT_DIR="./cert"
        __start_container mr NODOCKERARGS $MR_APP_NAME $MR_EXTERNAL_PORT "/" "http"
 }
 
 use_mr_http() {
-       echo -e $BOLD"Using http between agent and MR"$EBOLD
+       echo -e "Using $BOLD http $EBOLD towards MR"
        export MR_HTTPX="http"
        export MR_PORT=$MR_INTERNAL_PORT
        export MR_LOCAL_PORT=$MR_EXTERNAL_PORT
@@ -1520,7 +1570,7 @@ use_mr_http() {
 }
 
 use_mr_https() {
-       echo -e $BOLD"Using https between agent and MR"$EBOLD
+       echo -e "Using $BOLD https $EBOLD towards MR"
        export MR_HTTPX="https"
        export MR_PORT=$MR_INTERNAL_SECURE_PORT
        export MR_LOCAL_PORT=$MR_EXTERNAL_SECURE_PORT
@@ -1538,13 +1588,18 @@ use_mr_https() {
 start_cr() {
 
        echo -e $BOLD"Starting Callback Receiver"$EBOLD
-
+       __check_excluded_image 'CR'
+       if [ $? -eq 1 ]; then
+               echo -e $RED"The Callback Receiver image has not been checked for this test run due to arg to the test script"$ERED
+               echo -e $RED"The Callback Receiver will not be started"$ERED
+               exit
+       fi
        __start_container cr NODOCKERARGS $CR_APP_NAME $CR_EXTERNAL_PORT "/" "http"
 
 }
 
 use_cr_http() {
-       echo -e $BOLD"Using http between test script and CR"$EBOLD
+       echo -e "Using $BOLD http $EBOLD towards CR"
        export CR_HTTPX="http"
        export CR_PORT=$CR_INTERNAL_PORT
        export CR_LOCAL_PORT=$CR_EXTERNAL_PORT
@@ -1552,7 +1607,7 @@ use_cr_http() {
 }
 
 use_cr_https() {
-       echo -e $BOLD"Using https between test script and CR"$EBOLD
+       echo -e "Using $BOLD https $EBOLD towards CR"
        export CR_HTTPX="https"
        export CR_PORT=$CR_INTERNAL_SECURE_PORT
        export CR_LOCAL_PORT=$CR_EXTERNAL_SECURE_PORT
@@ -1576,12 +1631,18 @@ start_policy_agent() {
        echo -e $BOLD"Starting Policy Agent"$EBOLD
 
        if [ $AGENT_STAND_ALONE -eq 0 ]; then
+               __check_excluded_image 'PA'
+               if [ $? -eq 1 ]; then
+                       echo -e $RED"The Policy Agent image has not been checked for this test run due to arg to the test script"$ERED
+                       echo -e $RED"The Policy Agent will not be started"$ERED
+                       exit
+               fi
                __start_container policy_agent NODOCKERARGS $POLICY_AGENT_APP_NAME $POLICY_AGENT_EXTERNAL_PORT "/status" "http"
        else
                echo -e $RED"The consul config produced by this test script (filename '<fullpath-to-autotest-dir>.output<file-name>"$ERED
                echo -e $RED"where the file name is the file in the consul_config_app command in this script) must be pointed out by the agent "$ERED
                echo -e $RED"application.yaml"$ERED
-               echo -e $RED"The application jar may need to be built beforefor continuing"$ERED
+               echo -e $RED"The application jar may need to be built before continuing"$ERED
                echo -e $RED"The agent shall now be running on port $POLICY_AGENT_EXTERNAL_PORT for http"$ERED
 
                read -p "<press any key to continue>"
@@ -1594,7 +1655,7 @@ start_policy_agent() {
 # args: -
 # (Function for test scripts)
 use_agent_rest_http() {
-       echo -e $BOLD"Using agent REST interface with http"$EBOLD
+       echo -e "Using $BOLD http $EBOLD and $BOLD REST $EBOLD towards the agent"
        export ADAPTER=$RESTBASE
        echo ""
 }
@@ -1603,7 +1664,7 @@ use_agent_rest_http() {
 # args: -
 # (Function for test scripts)
 use_agent_rest_https() {
-       echo -e $BOLD"Using agent REST interface with https"$EBOLD
+       echo -e "Using $BOLD https $EBOLD and $BOLD REST $EBOLD towards the agent"
        export ADAPTER=$RESTBASE_SECURE
        echo ""
        return 0
@@ -1613,7 +1674,7 @@ use_agent_rest_https() {
 # args: -
 # (Function for test scripts)
 use_agent_dmaap_http() {
-       echo -e $BOLD"Agent using DMAAP http interface"$EBOLD
+       echo -e "Using $BOLD http $EBOLD and $BOLD DMAAP $EBOLD towards the agent"
        export ADAPTER=$DMAAPBASE
        echo ""
        return 0
@@ -1623,7 +1684,7 @@ use_agent_dmaap_http() {
 # args: -
 # (Function for test scripts)
 use_agent_dmaap_https() {
-       echo -e $BOLD"Agent using DMAAP https interface"$EBOLD
+       echo -e "Using $BOLD https $EBOLD and $BOLD REST $EBOLD towards the agent"
        export ADAPTER=$DMAAPBASE_SECURE
        echo ""
        return 0
@@ -1667,6 +1728,103 @@ use_agent_retries() {
        return
 }
 
+###########################
+### ECS functions
+###########################
+
+# Start the ECS
+# args: -
+# (Function for test scripts)
+start_ecs() {
+
+       echo -e $BOLD"Starting ECS"$EBOLD
+       __check_excluded_image 'ECS'
+       if [ $? -eq 1 ]; then
+               echo -e $RED"The ECS image has not been checked for this test run due to arg to the test script"$ERED
+               echo -e $RED"ECS will not be started"$ERED
+               exit
+       fi
+       export ECS_CERT_MOUNT_DIR="./cert"
+       __start_container ecs NODOCKERARGS $ECS_APP_NAME $ECS_EXTERNAL_PORT "/ei-producer/v1/eiproducers" "http"
+}
+
+# All calls to ECS will be directed to the ECS REST interface from now on
+# args: -
+# (Function for test scripts)
+use_ecs_rest_http() {
+       echo -e "Using $BOLD http $EBOLD and $BOLD REST $EBOLD towards ECS"
+       export ECS_ADAPTER=$ECS_RESTBASE
+       echo ""
+}
+
+# All calls to ECS will be directed to the ECS REST interface from now on
+# args: -
+# (Function for test scripts)
+use_ecs_rest_https() {
+       echo -e "Using $BOLD https $EBOLD and $BOLD REST $EBOLD towards ECS"
+       export ECS_ADAPTER=$ECS_RESTBASE_SECURE
+       echo ""
+       return 0
+}
+
+# All calls to ECS will be directed to the ECS dmaap interface over http from now on
+# args: -
+# (Function for test scripts)
+use_ecs_dmaap_http() {
+       echo -e "Using $BOLD http $EBOLD and $BOLD DMAAP $EBOLD towards ECS"
+       export ECS_ADAPTER=$ECS_DMAAPBASE
+       echo ""
+       return 0
+}
+
+# All calls to ECS will be directed to the ECS dmaap interface over https from now on
+# args: -
+# (Function for test scripts)
+use_ecs_dmaap_https() {
+       echo -e "Using $BOLD https $EBOLD and $BOLD REST $EBOLD towards ECS"
+       export ECS_ADAPTER=$ECS_DMAAPBASE_SECURE
+       echo ""
+       return 0
+}
+
+# Turn on debug level tracing in ECS
+# args: -
+# (Function for test scripts)
+set_ecs_debug() {
+       echo -e $BOLD"Setting ecs debug"$EBOLD
+       curl $LOCALHOST$ECS_EXTERNAL_PORT/actuator/loggers/org.oransc.enrichment -X POST  -H 'Content-Type: application/json' -d '{"configuredLevel":"debug"}' &> /dev/null
+       if [ $? -ne 0 ]; then
+               __print_err "could not set debug mode" $@
+               return 1
+       fi
+       echo ""
+       return 0
+}
+
+# Turn on trace level tracing in ECS
+# args: -
+# (Function for test scripts)
+set_ecs_trace() {
+       echo -e $BOLD"Setting agent trace"$EBOLD
+       curl $LOCALHOST$ECS_EXTERNAL_PORT/actuator/loggers/org.oransc.enrichment -X POST  -H 'Content-Type: application/json' -d '{"configuredLevel":"trace"}' &> /dev/null
+       if [ $? -ne 0 ]; then
+               __print_err "could not set trace mode" $@
+               return 1
+       fi
+       echo ""
+       return 0
+}
+
+# Perform curl retries when making direct call to ECS for the specified http response codes
+# Speace separated list of http response codes
+# args: [<response-code>]*
+use_agent_retries() {
+       echo -e $BOLD"Do curl retries to the ECS REST inteface for these response codes:$@"$EBOLD
+       ECS_AGENT_RETRY_CODES=$@
+       echo ""
+       return
+}
+
 #################
 ### Log functions
 #################
@@ -1679,6 +1837,10 @@ check_policy_agent_logs() {
        __check_container_logs "Policy Agent" $POLICY_AGENT_APP_NAME $POLICY_AGENT_LOGPATH
 }
 
+check_ecs_logs() {
+       __check_container_logs "ECS" $ECS_APP_NAME $ECS_LOGPATH
+}
+
 check_control_panel_logs() {
        __check_container_logs "Control Panel" $CONTROL_PANEL_APP_NAME $CONTROL_PANEL_LOGPATH
 }
@@ -1695,7 +1857,7 @@ __check_container_logs() {
                echo $dispname" is not running, no check made"
                return
        fi
-       foundentries="$(docker exec -it $tmp grep WARN $logpath | wc -l)"
+       foundentries="$(docker exec $tmp grep WARN $logpath | wc -l)"
        if [ $? -ne  0 ];then
                echo "  Problem to search $appname log $logpath"
        else
@@ -1705,7 +1867,7 @@ __check_container_logs() {
                        echo -e "  Found \033[1m"$foundentries"\033[0m WARN entries in $appname log $logpath"
                fi
        fi
-       foundentries="$(docker exec -it $tmp grep ERR $logpath | wc -l)"
+       foundentries="$(docker exec $tmp grep ERR $logpath | wc -l)"
        if [ $? -ne  0 ];then
                echo "  Problem to search $appname log $logpath"
        else
@@ -1728,20 +1890,19 @@ store_logs() {
        __print_err "need one arg, <file-prefix>" $@
                exit 1
        fi
-       echo -e $BOLD"Storing all container logs, Policy Agent app log and consul config using prefix: "$1$EBOLD
+       echo -e $BOLD"Storing all container logs using prefix: "$1$EBOLD
 
        docker stats --no-stream > $TESTLOGS/$ATC/$1_docker_stats.log 2>&1
        docker logs $CONSUL_APP_NAME > $TESTLOGS/$ATC/$1_consul.log 2>&1
        docker logs $CBS_APP_NAME > $TESTLOGS/$ATC/$1_cbs.log 2>&1
        docker logs $POLICY_AGENT_APP_NAME > $TESTLOGS/$ATC/$1_policy-agent.log 2>&1
-       docker logs $CONSUL_APP_NAME > $TESTLOGS/$ATC/$1_control-panel.log 2>&1
+       docker logs $ECS_APP_NAME > $TESTLOGS/$ATC/$1_ecs.log 2>&1
+       docker logs $CONTROL_PANEL_APP_NAME > $TESTLOGS/$ATC/$1_control-panel.log 2>&1
        docker logs $MR_APP_NAME > $TESTLOGS/$ATC/$1_mr.log 2>&1
        docker logs $CR_APP_NAME > $TESTLOGS/$ATC/$1_cr.log 2>&1
        cp .httplog_${ATC}.txt $TESTLOGS/$ATC/$1_httplog_${ATC}.txt 2>&1
 
-       docker exec -it $SDNC_APP_NAME cat $SDNC_KARAF_LOG> $TESTLOGS/$ATC/$1_SDNC_karaf.log 2>&1
-
-       docker exec -it $SDNC_ONAP_APP_NAME cat $SDNC_ONAP_KARAF_LOG > $TESTLOGS/$ATC/$1_SDNC_ONAP_karaf.log 2>&1
+       docker exec $SDNC_APP_NAME cat $SDNC_KARAF_LOG> $TESTLOGS/$ATC/$1_SDNC_karaf.log 2>&1
 
        rics=$(docker ps -f "name=$RIC_SIM_PREFIX" --format "{{.Names}}")
        for ric in $rics; do
index 2c5e6c3..bae1b6b 100644 (file)
@@ -29,13 +29,8 @@ if [ $# -gt 0 ]; then
                paramError=0
        fi
 fi
-if [ $# -eq 2 ]; then
-    if [ $2 == "auto-clean" ]; then
-               paramError=0
-    fi
-fi
 if [ $paramError -ne 0 ]; then
-       echo "Expected arg: local|remote|remote-remove [ auto-clean ]"
+       echo "Expected arg: local|remote|remote-remove"
        exit 1
 fi
 
index 25c8fdb..06b4f20 100644 (file)
@@ -1,2 +1,3 @@
 node_modules
-package-lock.json
\ No newline at end of file
+package-lock.json
+.dockererr
diff --git a/test/simulator-group/ecs/.gitignore b/test/simulator-group/ecs/.gitignore
new file mode 100644 (file)
index 0000000..4aa3a7a
--- /dev/null
@@ -0,0 +1,2 @@
+.tmp.json
+.dockererr
\ No newline at end of file
diff --git a/test/simulator-group/ecs/docker-compose.yml b/test/simulator-group/ecs/docker-compose.yml
new file mode 100644 (file)
index 0000000..11cf810
--- /dev/null
@@ -0,0 +1,34 @@
+#  Copyright (C) 2020 Nordix Foundation. All rights reserved.
+#  ========================================================================
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#  ============LICENSE_END=================================================
+#
+version: '3.0'
+networks:
+  default:
+    external:
+      name: ${DOCKER_SIM_NWNAME}
+services:
+  ecs:
+    image: ${ECS_IMAGE}
+    container_name: ${ECS_APP_NAME}
+    networks:
+      default:
+        aliases:
+          - ${ECS_APP_NAME_ALIAS}
+    ports:
+    - ${ECS_EXTERNAL_PORT}:${ECS_INTERNAL_PORT}
+    - ${ECS_EXTERNAL_SECURE_PORT}:${ECS_INTERNAL_SECURE_PORT}
+
+
+
diff --git a/test/simulator-group/sdnc_onap/.gitignore b/test/simulator-group/sdnc_onap/.gitignore
deleted file mode 100644 (file)
index 3384196..0000000
+++ /dev/null
@@ -1 +0,0 @@
-.dockererr
\ No newline at end of file
diff --git a/test/simulator-group/sdnc_onap/docker-compose.yml b/test/simulator-group/sdnc_onap/docker-compose.yml
deleted file mode 100644 (file)
index 7aab1da..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-# ==================================================================================
-#   Modifications Copyright (c) 2019 Nordix Foundation.
-#
-#   Licensed under the Apache License, Version 2.0 (the "License");
-#   you may not use this file except in compliance with the License.
-#   You may obtain a copy of the License at
-#
-#          http://www.apache.org/licenses/LICENSE-2.0
-#
-#   Unless required by applicable law or agreed to in writing, software
-#   distributed under the License is distributed on an "AS IS" BASIS,
-#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#   See the License for the specific language governing permissions and
-#   limitations under the License.
-# ==================================================================================
-version: '2.1'
-
-networks:
-  default:
-    driver: bridge
-    name: ${DOCKER_SIM_NWNAME}
-
-services:
-  db:
-    image: ${SDNC_ONAP_DB_IMAGE}
-    container_name: ${SDNC_ONAP_DB_APP_NAME}
-    networks:
-      - default
-    ports:
-      - "3306"
-    environment:
-      - MYSQL_ROOT_PASSWORD=openECOMP1.0
-      - MYSQL_ROOT_HOST=%
-    logging:
-      driver:   "json-file"
-      options:
-        max-size: "30m"
-        max-file: "5"
-
-  a1-controller:
-    image: ${SDNC_ONAP_A1_ADAPTER_IMAGE}
-    depends_on :
-      - db
-    container_name: ${SDNC_ONAP_APP_NAME}
-    networks:
-      - default
-    entrypoint: ["/opt/onap/sdnc/bin/startODL.sh"]
-    ports:
-      - ${SDNC_ONAP_EXTERNAL_PORT}:${SDNC_ONAP_INTERNAL_PORT}
-      - ${SDNC_ONAP_EXTERNAL_SECURE_PORT}:${SDNC_ONAP_INTERNAL_SECURE_PORT}
-    links:
-      - db:dbhost
-      - db:sdnctldb01
-      - db:sdnctldb02
-    environment:
-      - MYSQL_ROOT_PASSWORD=openECOMP1.0
-      - SDNC_CONFIG_DIR=/opt/onap/sdnc/data/properties
-    logging:
-      driver:   "json-file"
-      options:
-        max-size: "30m"
-        max-file: "5"
-