Updates to test env and A1function test 79/4879/2
authorBjornMagnussonXA <bjorn.magnusson@est.tech>
Thu, 22 Oct 2020 07:55:25 +0000 (09:55 +0200)
committerBjornMagnussonXA <bjorn.magnusson@est.tech>
Thu, 22 Oct 2020 09:37:56 +0000 (11:37 +0200)
Issue-ID: NONRTRIC-303

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

18 files changed:
test/auto-test/FTC1100.sh
test/auto-test/FTC150.sh
test/auto-test/testdata/ecs/job-template2.json [new file with mode: 0644]
test/common/README.md
test/common/ecs_api_functions.sh
test/common/prodstub_api_functions.sh
test/common/test_env-onap-guilin.sh [new file with mode: 0644]
test/common/test_env-onap-master.sh [new file with mode: 0644]
test/common/test_env-oran-master.sh [new file with mode: 0755]
test/common/test_env.sh [changed mode: 0755->0644]
test/common/testcase_common.sh
test/jenkins/run_test.sh
test/prodstub/.gitignore
test/prodstub/app/prodstub.py
test/prodstub/app/requirements.txt
test/prodstub/basic_test.sh
test/prodstub/prod-stub-build-start.sh
test/simulator-group/sim-monitor.js

index a61f1bb..63c2931 100755 (executable)
@@ -44,9 +44,13 @@ set_ecs_debug
 set_ecs_trace
 
 # Setup prodstub sim to accept calls for producers, types and jobs
-prodstub_arm_supervision 200 prod-a
-prodstub_arm_supervision 200 prod-b
-prodstub_arm_supervision 200 prod-c
+prodstub_arm_producer 200 prod-a
+prodstub_arm_producer 200 prod-b
+prodstub_arm_producer 200 prod-c
+
+prodstub_arm_producer 200 prod-d
+prodstub_arm_type 200 prod-d type4
+prodstub_arm_job_create 200 prod-d job8
 
 prodstub_arm_type 200 prod-a type1
 prodstub_arm_type 200 prod-b type2
@@ -56,22 +60,22 @@ prodstub_disarm_type 200 prod-b type3
 prodstub_arm_type 200 prod-b type1
 prodstub_disarm_type 200 prod-b type1
 
-prodstub_arm_create 200 prod-a job1
-prodstub_arm_create 200 prod-a job2
-prodstub_arm_create 200 prod-b job3
+prodstub_arm_job_create 200 prod-a job1
+prodstub_arm_job_create 200 prod-a job2
+prodstub_arm_job_create 200 prod-b job3
 
-prodstub_arm_delete 200 prod-a job1
-prodstub_arm_delete 200 prod-a job2
-prodstub_arm_delete 200 prod-b job3
+prodstub_arm_job_delete 200 prod-a job1
+prodstub_arm_job_delete 200 prod-a job2
+prodstub_arm_job_delete 200 prod-b job3
 
-prodstub_arm_create 200 prod-b job4
-prodstub_arm_create 200 prod-a job4
+prodstub_arm_job_create 200 prod-b job4
+prodstub_arm_job_create 200 prod-a job4
 
-prodstub_arm_create 200 prod-b job5
-prodstub_arm_create 200 prod-a job5
-prodstub_arm_delete 200 prod-a job5
+prodstub_arm_job_create 200 prod-b job5
+prodstub_arm_job_create 200 prod-a job5
+prodstub_arm_job_delete 200 prod-a job5
 
-prodstub_arm_create 200 prod-b job6
+prodstub_arm_job_create 200 prod-b job6
 
 # ecs status
 ecs_api_service_status 200
@@ -211,7 +215,28 @@ ecs_api_a1_delete_job 204 type2 job3
 ecs_api_edp_delete_producer 204 prod-b
 
 
-check_sndc_logs
+prodstub_equal create/prod-d/job8 0
+prodstub_equal delete/prod-d/job8 0
+
+ecs_api_edp_put_producer 201 prod-d http://producer-stub:8092/callbacks/create/prod-d http://producer-stub:8092/callbacks/delete/prod-d http://producer-stub:8092/callbacks/supervision/prod-d type4 testdata/ecs/ei-type-1.json
+
+ecs_api_a1_get_job_ids 200 type4 NOWNER EMPTY
+
+ecs_api_a1_put_job 201 type4 job8 http://localhost:80/target8 ric4 testdata/ecs/job-template.json
+
+prodstub_equal create/prod-d/job8 1
+prodstub_equal delete/prod-d/job8 0
+
+ecs_api_a1_get_job_ids 200 type4 NOWNER job8
+
+ecs_api_edp_put_producer 200 prod-d http://producer-stub:8092/callbacks/create/prod-d http://producer-stub:8092/callbacks/delete/prod-d http://producer-stub:8092/callbacks/supervision/prod-d NOTYPE
+
+ecs_api_a1_get_job_ids 404 type4 NOWNER
+
+prodstub_equal create/prod-d/job8 1
+prodstub_equal delete/prod-d/job8 0
+
+check_sdnc_logs
 
 check_ecs_logs
 
index ead424c..bb527be 100755 (executable)
@@ -29,6 +29,11 @@ INCLUDED_IMAGES="RICSIM SDNC"
 
 #### TEST BEGIN ####
 
+FLAVOUR="ORAN"
+if [[ $SDNC_A1_CONTROLLER_IMAGE == *"onap"* ]]; then
+    FLAVOUR="ONAP"
+fi
+
 generate_uuid
 
 #Test agent and simulator protocol versions (others are http only)
@@ -83,9 +88,18 @@ for __nb_httpx in $NB_TESTED_PROTOCOLS ; do
         controller_api_get_A1_policy_type 200 OSC ricsim_g1_1 1 testdata/OSC/sim_1.json
         controller_api_get_A1_policy_type 404 OSC ricsim_g1_1 99
 
-        controller_api_put_A1_policy 202 OSC ricsim_g1_1 1 4000 testdata/OSC/pi1_template.json
+        RESP=202
+        if [ $FLAVOUR == "ONAP" ]; then
+            RESP=200
+        fi
+        controller_api_put_A1_policy $RESP OSC ricsim_g1_1 1 4000 testdata/OSC/pi1_template.json
         controller_api_put_A1_policy 404 OSC ricsim_g1_1 5 1001 testdata/OSC/pi1_template.json
-        controller_api_put_A1_policy 201 STD ricsim_g2_1   5000 testdata/STD/pi1_template.json
+
+        RESP=201
+        if [ $FLAVOUR == "ONAP" ]; then
+            RESP=200
+        fi
+        controller_api_put_A1_policy $RESP STD ricsim_g2_1   5000 testdata/STD/pi1_template.json
 
         controller_api_get_A1_policy_ids 200 OSC ricsim_g1_1 1 4000
         controller_api_get_A1_policy_ids 200 STD ricsim_g2_1 5000
@@ -97,8 +111,17 @@ for __nb_httpx in $NB_TESTED_PROTOCOLS ; do
         controller_api_get_A1_policy_status 200 OSC ricsim_g1_1 1 4000 "$VAL" "false"
         controller_api_get_A1_policy_status 200 STD ricsim_g2_1 5000 "UNDEFINED"
 
-        controller_api_delete_A1_policy 202 OSC ricsim_g1_1 1 4000
-        controller_api_delete_A1_policy 204 STD ricsim_g2_1 5000
+        RESP=202
+        if [ $FLAVOUR == "ONAP" ]; then
+            RESP=200
+        fi
+        controller_api_delete_A1_policy $RESP OSC ricsim_g1_1 1 4000
+
+        RESP=204
+        if [ $FLAVOUR == "ONAP" ]; then
+            RESP=200
+        fi
+        controller_api_delete_A1_policy $RESP STD ricsim_g2_1 5000
 
         check_sdnc_logs
 
diff --git a/test/auto-test/testdata/ecs/job-template2.json b/test/auto-test/testdata/ecs/job-template2.json
new file mode 100644 (file)
index 0000000..c1126ea
--- /dev/null
@@ -0,0 +1,6 @@
+{
+    "jobparam1":"value1_XXXX",
+    "jobparam2":"value2_XXXX",
+    "jobparam3":"value3_XXXX",
+    "jobparam4":"value3_XXXX"
+}
\ No newline at end of file
index b35966a..7492113 100644 (file)
@@ -1,12 +1,12 @@
-## Introduction ##
+# Introduction #
 This dir contains most scripts needed for the auto-test environment. There are scripts with functions to adapt to the apis of the components of the Non-RT RIC; Policy Agent, A1 Controller and Ric (A1) simulator.
 Some of the scripts can also be used for other kinds of tests, for example basic tests.
 
 ## Overview for common test scripts and files ##
 
-`test_env.sh` \
+`test_env*.sh` \
 Common env variables for test in the auto-test dir. All configuration of port numbers, image names and version etc shall be made in this file.
-Used by the auto test scripts/suites but could be used for other test script as well. It is possible to configure a test case with a different file using the command line argument '--env-file'.
+Used by the auto test scripts/suites but could be used for other test script as well. The test cases shall be started with the file for the intended target using command line argument '--env-file'. There are preconfigured env files, pattern 'test_env*.sh', in ../common.
 
 `testcase_common.sh` \
 Common functions for auto test cases in the auto-test dir. This script is the foundation of test auto environment which sets up images and enviroment variables needed by this script as well as the script adapting to the APIs.
@@ -15,15 +15,24 @@ The included functions are described in detail further below.
 `testsuite_common.sh` \
 Common functions for running two or more auto test scripts as a suite.
 
+`api_curl.sh` \
+A common curl based function for the agent and ecs apis.
+
 `agent_api_functions.sh` \
 Contains functions for adapting towards the Policy Agent API, also via dmaap (using a message-router stub interface)
 
+`ecs_api_functions.sh` \
+Contains functions for adapting towards the ECS API
+
 `controller_api_functions.sh` \
 Contains functions for adaping towards the A1-controller API.
 
 `ricsimulator_api_functions.sh` \
 Contains functions for adapting towards the RIC (A1) simulator admin API.
 
+`prodstub_api_functions.sh` \
+Contains functions for adapting towards the Producer stub interface - simulates a producer.
+
 `compare_json.py` \
 A python script to compare two json obects for equality. Note that the comparsion always sort json-arrays before comparing (that is, it does not care about the order of items within the array). In addition, the target json object may specify individual parameter values where equality is 'dont care'.
 
@@ -47,9 +56,9 @@ A script for executing a curl call with a specific url and optional payload. It
 
 
 
-## Descriptions of functions in testcase_common.sh ##
+# Description of functions in testcase_common.sh #
 
-#### Script args ####
+## Script args ##
 The script can be started with these arguments
 
 | arg list |
@@ -64,23 +73,23 @@ The script can be started with these arguments
 | `auto-clean` | all containers will be automatically stopped and removed when the test case is complete. Requires the function 'auto_clean_containers' to be included last in the applicable auto-test script |
 | `--stop-at-error` | intended for debugging and make the script stop at first 'FAIL' and save all logs with a prefix 'STOP_AT_ERROR' |
 | `--ricsim-prefix <prefix>` | use another prefix for the ric simulator container name than the standard 'ricsim'. Note that the testscript has to read and use the env var `$RIC_SIM_PREFIX` instead of a hardcoded name of the ric(s). |
-| `--env-file` | point to a different file with environment variables, instead of the default 'test_env.sh' |
+| `--env-file` | point to a file with environment variables (the previous default, test_env.sh, replaced with one env file for each branch in test/common) |
 | `--use-local-image <app-nam> [<app-name>]*` | nnly applicable when running as 'remote' or 'remote-remove'. Mainly for debugging when a locally built image shall be used together with other remote images from nexus.Accepts a space separated list of PA, CP, RICSIM, SDNC for Policy Agent, Control Panel, A1-controller and the Ric simulator |
 
 
-#### Function: print_result ####
+## Function: print_result ##
 Print a test report of an auto-test script.
 | arg list |
 |--|
 | None |
 
-#### Function: start_timer ####
+## Function: start_timer ##
 Start a timer for time measurement. Only one timer can be running.
 | arg list |
 |--|
 | None - but any args will be printed (It is good practice to use same args for this function as for the `print_timer`) |
 
-#### Function: print_timer ####
+## Function: print_timer ##
 Print the value of the timer (in seconds) previously started by 'start_timer'. (Note that timer is still running after this function). The result of the timer as well as the args to the function will also be printed in the test report.
 | arg list |
 |--|
@@ -90,7 +99,7 @@ Print the value of the timer (in seconds) previously started by 'start_timer'. (
 | --------- | ----------- |
 | `<timer-message-to-print>` | Any text message to be printed along with the timer result.(It is good practice to use same args for this function as for the `start_timer`) |
 
-#### Function: print_and_reset_timer ####
+## Function: print_and_reset_timer ##
 Print the value of the timer (in seconds) previously started by 'start_timer'. Also reset the timer to 0. The result of the timer as well as the args to the function will also be printed in the test report.
 | arg list |
 |--|
@@ -100,7 +109,7 @@ Print the value of the timer (in seconds) previously started by 'start_timer'. A
 | --------- | ----------- |
 | `<timer-message-to-print>` | Any text message to be printed along with the timer result.(It is good practice to use same args for this function as for the `start_timer`) |
 
-#### Function: deviation ####
+## Function: deviation ##
 Mark a test as a deviation from the requirements. The list of deviations will be printed in the test report.
 | arg list |
 |--|
@@ -110,19 +119,19 @@ Mark a test as a deviation from the requirements. The list of deviations will be
 | --------- | ----------- |
 | `<deviation-message-to-print>` | Any text message describing the deviation. The text will also be printed in the test report. The intention is to mark known deviations, compared to required functionality |
 
-#### Function: clean_containers ####
+## Function: clean_containers ##
 Stop and remove all containers. Containers not part of the test are not affected.
 | arg list |
 |--|
 | None |
 
-#### Function: auto_clean_containers ####
+## Function: auto_clean_containers ##
 Stop and remove all containers. Containers not part of the test are not affected. This function has effect only if the test script is started with arg `auto-clean`. This intention is to use this function as the last step in an auto-test script.
 | arg list |
 |--|
 | None |
 
-#### Function: sleep_wait ####
+## Function: sleep_wait ##
 Make the script sleep for a number of seconds.
 | arg list |
 |--|
@@ -133,14 +142,14 @@ Make the script sleep for a number of seconds.
 | `<sleep-time-in-sec> ` | Number of seconds to sleep |
 | `<any-text-in-quotes-to-be-printed>` | Optional. The text will be printed, if present |
 
-#### Function: generate_uuid ####
+## Function: generate_uuid ##
 Geneate a UUID prefix to use along with the policy instance number when creating/deleting policies. Sets the env var UUID.
 UUID is then automatically added to the policy id in GET/PUT/DELETE.
 | arg list |
 |--|
 | None |
 
-#### Function: consul_config_app ####
+## Function: consul_config_app ##
 Function to load a json config from a file into consul for the Policy Agent
 
 | arg list |
@@ -151,7 +160,7 @@ Function to load a json config from a file into consul for the Policy Agent
 | --------- | ----------- |
 | `<json-config-file>` | The path to the json file to be loaded to Consul/CBS |
 
-#### Function: prepare_consul_config ####
+## Function: prepare_consul_config ##
 Function to prepare a Consul config based on the previously configured (and started simulators). Note that all simulator must be running and the test script has to configure if http or https shall be used for the components (this is done by the functions 'use_simulator_http', 'use_simulator_https', 'use_sdnc_http', 'use_sdnc_https', 'use_mr_http', 'use_mr_https')
 | arg list |
 |--|
@@ -162,25 +171,25 @@ Function to prepare a Consul config based on the previously configured (and star
 | `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 ####
+## Function: start_consul_cbs ##
 Start the Consul and CBS containers
 | arg list |
 |--|
 | None |
 
-#### Function: use_simulator_http ####
+## Function: use_simulator_http ##
 Use http for all API calls (A1) toward the simulator. This is the default. Admin API calls to the simulator are not affected. Note that this function shall be called before preparing the config for Consul.
 | arg list |
 |--|
 | None |
 
-#### Function: use_simulator_https ####
+## Function: use_simulator_https ##
 Use https for all API calls (A1) toward the simulator. Admin API calls to the simulator are not affected. Note that this function shall be called before preparing the config for Consul.
 | arg list |
 |--|
 | None |
 
-#### Function: start_ric_simulators ####
+## Function: start_ric_simulators ##
 Start a group of simulator where a group may contain 1 more simulators.
 | arg list |
 |--|
@@ -192,116 +201,134 @@ Start a group of simulator where a group may contain 1 more simulators.
 |`<count>`| And integer, 1 or greater. Specifies the number of simulators to start|
 |`<interface-id>`| Shall be the interface id of the simulator. See the repo 'a1-interface' for the available ids. |
 
-#### Function: start_control_panel ####
+## Function: start_control_panel ##
 Start the Control Panel container
 | arg list |
 |--|
 | None |
 
-#### Function: start_sdnc ####
+## Function: start_sdnc ##
 Start the SDNC A1 Controller container and its database container
 | arg list |
 |--|
 | None |
 
-#### Function: use_sdnc_http ####
+## Function: use_sdnc_http ##
 Use http for all API calls towards the SDNC A1 Controller. This is the default. Note that this function shall be called before preparing the config for Consul.
 | arg list |
 |--|
 | None |
 
-#### Function: use_sdnc_http ####
+## Function: use_sdnc_http ##
 Use https for all API calls towards the SDNC A1 Controller. Note that this function shall be called before preparing the config for Consul.
 | arg list |
 |--|
 | None |
 
-#### Function: start_mr ####
+## Function: start_mr ##
 Start the Message Router stub interface container
 | arg list |
 |--|
 | None |
 
-#### Function: use_mr_http ####
+## Function: use_mr_http ##
 Use http for all Dmaap calls to the MR. This is the default. The admin API is not affected. Note that this function shall be called before preparing the config for Consul.
 | arg list |
 |--|
 | None |
 
-#### Function: use_mr_https ####
+## Function: use_mr_https ##
 Use https for all Dmaap call to the MR. The admin API is not affected. Note that this function shall be called before preparing the config for Consul.
 | arg list |
 |--|
 | None |
 
-#### Function: start_cr ####
+## Function: start_cr ##
 Start the Callback Receiver container
 | arg list |
 |--|
 | None |
 
-#### Function: use_cr_http ####
+## Function: use_cr_http ##
 Use http for getting event from CR.  The admin API is not affected. This is the default.
 | arg list |
 |--|
 | None |
 
-#### Function: use_cr_https ####
+## Function: use_cr_https ##
 Use https for getting event from CR. The admin API is not affected.
 Note: Not yet used as callback event is not fully implemented/deciced.
 | arg list |
 |--|
 | None |
 
-#### Function: start_policy_agent ####
+## Function: start_prod_stub ##
+Start the Producer stubb container
+| arg list |
+|--|
+| None |
+
+## Function: use_prod_stub_http ##
+Use http for the API.  The admin API is not affected. This is the default protocol.
+| arg list |
+|--|
+| None |
+
+## Function: use_prod_stub_https ##
+Use https for the API. The admin API is not affected.
+| arg list |
+|--|
+| None |
+
+## Function: start_policy_agent ##
 Start the Policy Agent container. If the test script is configured to use a stand alone Policy Agent (for example other container or stand alone app) the script will prompt for starting the stand alone Policy Agent.
 | arg list |
 |--|
 | None |
 
-#### Function: use_agent_stand_alone ####
+## Function: use_agent_stand_alone ##
 Configure to run the Policy Agent as a stand alone container or app. See also 'start_policy_agent'
 | arg list |
 |--|
 | None |
 
-#### Function: use_agent_rest_http ####
+## Function: use_agent_rest_http ##
 Use http for all API calls to the Policy Agent. This is the default.
 | arg list |
 |--|
 | None |
 
-#### Function: use_agent_rest_https ####
+## Function: use_agent_rest_https ##
 Use https for all API calls to the Policy Agent.
 | arg list |
 |--|
 | None |
 
-#### Function: use_agent_dmaap_http ####
+## Function: use_agent_dmaap_http ##
 Send and recieve all API calls to the Policy Agent over Dmaap via the MR over http.
 | arg list |
 |--|
 | None |
 
-#### Function: use_agent_dmaap_https ####
+## Function: use_agent_dmaap_https ##
 Send and recieve all API calls to the Policy Agent over Dmaap via the MR over https.
 | arg list |
 |--|
 | None |
 
-#### Function: set_agent_debug ####
+## Function: set_agent_debug ##
 Configure the Policy Agent log on debug level. The Policy Agent must be running.
 | arg list |
 |--|
 | None |
 
-#### Function: set_agent_trace ####
+## Function: set_agent_trace ##
 Configure the Policy Agent log on trace level. The Policy Agent must be running.
 | arg list |
 |--|
 | None |
 
-#### Function: use_agent_retries ####
+## Function: use_agent_retries ##
 Configure the Policy Agent to make upto 5 retries if an API calls return any of the specified http return codes.
 | arg list |
 |--|
@@ -311,19 +338,73 @@ Configure the Policy Agent to make upto 5 retries if an API calls return any of
 | --------- | ----------- |
 | `[<response-code>]*` | A space separated list of http response codes, may be empty to reset to 'no codes'.  |
 
-#### Function: check_policy_agent_logs ####
+## Function: start_ecs ##
+Start the ECS container.
+| arg list |
+|--|
+| None |
+
+## Function: use_ecs_rest_http ##
+Use http for all API calls to the ECS. This is the default protocol.
+| arg list |
+|--|
+| None |
+
+## Function: use_ecs_rest_https ##
+Use https for all API calls to the ECS.
+| arg list |
+|--|
+| None |
+
+## Function: use_ecs_dmaap_http ##
+Send and recieve all API calls to the ECS over Dmaap via the MR using http.
+| arg list |
+|--|
+| None |
+
+## Function: use_ecs_dmaap_https ##
+Send and recieve all API calls to the ECS over Dmaap via the MR using https.
+| arg list |
+|--|
+| None |
+
+## Function: set_ecs_debug ##
+Configure the ECS log on debug level. The ECS must be running.
+| arg list |
+|--|
+| None |
+
+## Function: set_ecs_trace ##
+Configure the ECS log on trace level. The ECS must be running.
+| arg list |
+|--|
+| None |
+
+## Function: check_policy_agent_logs ##
 Check the Policy Agent log for any warnings and errors and print the count of each.
 | arg list |
 |--|
 | None |
 
-#### Function: check_control_panel_logs ####
+## Function: check_ecs_logs ##
+Check the ECS log for any warnings and errors and print the count of each.
+| arg list |
+|--|
+| None |
+
+## Function: check_control_panel_logs ##
 Check the Control Panel log for any warnings and errors and print the count of each.
 | arg list |
 |--|
 | None |
 
-#### Function: store_logs ####
+## Function: check_sdnc_logs ##
+Check the SDNC log for any warnings and errors and print the count of each.
+| arg list |
+|--|
+| None |
+
+## Function: store_logs ##
 Take a snap-shot of all logs for all running containers and stores them in `./logs/<ATC-id>`. All logs will get the specified prefix in the file name. In general, one of the last steps in an auto-test script shall be to call this function. If logs shall be taken several times during a test script, different prefixes shall be used each time.
 | arg list |
 |--|
@@ -334,7 +415,7 @@ Take a snap-shot of all logs for all running containers and stores them in `./lo
 | `<logfile-prefix>` | Log file prefix  |
 
 
-#### Function: cr_equal ####
+## Function: cr_equal ##
 Tests if a variable value in the Callback Receiver (CR) simulator is equal to a target value.
 Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
 With the timeout, the test waits up to the timeout seconds before setting pass or fail depending on if the variable value becomes equal to the target value or not.
@@ -349,7 +430,7 @@ See the 'cr' dir for more details.
 | `<target-value>` | Target value for the variable  |
 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value  |
 
-#### Function: mr_equal ####
+## Function: mr_equal ##
 Tests if a variable value in the Message Router (MR) simulator is equal to a target value.
 Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
 With the timeout, the test waits up to the timeout seconds before setting pass or fail depending on if the variable value becomes equal to the target value or not.
@@ -364,7 +445,7 @@ See the 'mrstub' dir for more details.
 | `<target-value>` | Target value for the variable  |
 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value  |
 
-#### Function: mr_greater ####
+## Function: mr_greater ##
 Tests if a variable value in the Message Router (MR) simulator is greater than a target value.
 Without the timeout, the test sets pass or fail immediately depending on if the variable is greater than the target or not.
 With the timeout, the test waits up to the timeout seconds before setting pass or fail depending on if the variable value becomes greater than the target value or not.
@@ -379,7 +460,7 @@ See the 'mrstub' dir for more details.
 | `<target-value>` | Target value for the variable  |
 | `<timeout-in-sec>` | Max time to wait for the variable to become grater than the target value  |
 
-#### Function: mr_read ####
+## Function: mr_read ##
 Reads the value of a variable in the Message Router (MR) simulator. The value is intended to be passed to a env variable in the test script.
 See the 'mrstub' dir for more details.
 | arg list |
@@ -390,7 +471,7 @@ See the 'mrstub' dir for more details.
 | --------- | ----------- |
 | `<variable-name>` | Variable name in the MR  |
 
-#### Function: mr_print ####
+## Function: mr_print ##
 Prints the value of a variable in the Message Router (MR) simulator.
 See the 'mrstub' dir for more details.
 | arg list |
@@ -401,21 +482,35 @@ See the 'mrstub' dir for more details.
 | --------- | ----------- |
 | `<variable-name>` | Variable name in the MR  |
 
-## Descriptions of functions in testsuite_common.sh ##
-#### Function: suite_setup ####
+## Function: indent1 ##
+Indent every line of a command output with one space char.
+| arg list |
+|--|
+| None |
+
+## Function: indent2 ##
+Indent every line of a command output with two space chars.
+| arg list |
+|--|
+| None |
+
+# Description of functions in testsuite_common.sh #
+
+## Function: suite_setup ##
 Sets up the test suite and prints out a heading.
 | arg list |
 |--|
 | None |
 
-#### suite_complete ####
+## suite_complete ##
 Print out the overall result of the executed test cases.
 | arg list |
 |--|
 | None |
 
-## Descriptions of functions in agent_api_function.sh ##
-#### Function: api_equal() ####
+# Description of functions in agent_api_function.sh #
+
+## Function: api_equal() ##
 
 Tests if the array length of a json array in the Policy Agent simulator is equal to a target value.
 Without the timeout, the test sets pass or fail immediately depending on if the array length is equal to the target or not.
@@ -431,7 +526,7 @@ See the 'cr' dir for more details.
 | `<target-value>` | Target value for the length  |
 | `<timeout-in-sec>` | Max time to wait for the length to reach the target value  |
 
-#### Function: api_get_policies() ####
+## Function: api_get_policies() ##
 Test of GET '/policies' and optional check of the array of returned policies.
 To test the response code only, provide the response code parameter as well as the following three parameters.
 To also test the response payload add the 'NOID' for an expected empty array or repeat the last five parameters for each expected policy.
@@ -454,7 +549,7 @@ To also test the response payload add the 'NOID' for an expected empty array or
 | `<template-file>` |  Path to the template file for the policy (same template used when creating the policy) |
 
 
-#### Function: api_get_policy() ####
+## Function: api_get_policy() ##
 Test of GET /policy and optional check of the returned json payload.
 To test the the response code only, provide the expected response code and policy id.
 To test the contents of the returned json payload, add a path to the template file used when creating the policy.
@@ -468,7 +563,7 @@ To test the contents of the returned json payload, add a path to the template fi
 | `<policy-id>` |  Id of the policy |
 | `<template-file>` |  Path to the template file for the policy (same template used when creating the policy) |
 
-#### Function: api_put_policy() ####
+## Function: api_put_policy() ##
 Test of PUT '/policy'.
 To test the response code only, provide the response code parameter as well as the following three parameters.
 To also test the response payload add the 'NOID' for an expected empty array or repeat the last five parameters for each expected policy.
@@ -487,12 +582,12 @@ To also test the response payload add the 'NOID' for an expected empty array or
 | `<template-file>` |  Path to the template file for the policy |
 | `<count>` |  An optional count (default is 1). If a value greater than 1 is given, the policy ids will use the given policy id as the first id and add 1 to that id for each new policy |
 
-#### Function: api_put_policy_batch() ####
+## Function: api_put_policy_batch() ##
 This tests the same as function 'api_put_policy' except that all put requests are sent to dmaap in one go and then the responses are polled one by one.
 If the agent api is not configured to use dmaap (see 'use_agent_dmaap', 'use_agent_rest_http' and 'use_agent_rest_https'), an error message is printed.
 For arg list and parameters, see 'api_put_policy'.
 
-#### Function: api_put_policy_parallel() ####
+## Function: api_put_policy_parallel() ##
 This tests the same as function 'api_put_policy' except that the policy create is spread out over a number of processes and it only uses the agent rest API. The total number of policies created is determined by the product of the parameters 'number-of-rics' and 'count'. The parameter 'number-of-threads' shall be selected to be not evenly divisible by the product of the parameters 'number-of-rics' and 'count' - this is to ensure that one process does not handle the creation of all the policies in one ric.
 | arg list |
 |--|
@@ -509,7 +604,7 @@ This tests the same as function 'api_put_policy' except that the policy create i
 | `<count-per-ric>` |  Number of policies per ric |
 | `<number-of-threads>` |  Number of threads (processes) to run in parallel |
 
-#### Function: api_delete_policy() ####
+## Function: api_delete_policy() ##
 This tests the DELETE /policy. Removes the indicated policy or a 'count' number of policies starting with 'policy-id' as the first id.
 | arg list |
 |--|
@@ -521,12 +616,12 @@ This tests the DELETE /policy. Removes the indicated policy or a 'count' number
 | `<policy-id>` |  Id of the policy |
 | `<count>` |  An optional count of policies to delete. The 'policy-id' will be the first id to be deleted. |
 
-#### Function: api_delete_policy_batch() ####
+## Function: api_delete_policy_batch() ##
 This tests the same as function 'api_delete_policy' except that all delete requests are sent to dmaap in one go and then the responses are polled one by one.
 If the agent api is not configured to used dmaap (see 'use_agent_dmaap', 'use_agent_rest_http' and 'use_agent_rest_https'), an error message is printed.
 For arg list and parameters, see 'api_delete_policy'.
 
-#### Function: api_delete_policy_parallel() ####
+## Function: api_delete_policy_parallel() ##
 This tests the same as function 'api_delete_policy' except that the policy delete is spread out over a number of processes and it only uses the agent rest API. The total number of policies deleted is determined by the product of the parameters 'number-of-rics' and 'count'. The parameter 'number-of-threads' shall be selected to be not evenly divisible by the product of the parameters 'number-of-rics' and 'count' - this is to ensure that one process does not handle the deletion of all the policies in one ric.
 | arg list |
 |--|
@@ -540,7 +635,7 @@ This tests the same as function 'api_delete_policy' except that the policy delet
 | `<number-of-threads>` |  Number of threads (processes) to run in parallel |
 
 
-#### Function: api_get_policy_ids() ####
+## Function: api_get_policy_ids() ##
 
 Test of GET '/policy_ids'.
 To test response code only, provide the response code parameter as well as the following three parameters.
@@ -561,7 +656,7 @@ To also test the response payload add the 'NOID' for an expected empty array or
 | `NOID` |  Indicator that no policy id is provided - indicate empty list of policies|
 | `<policy-instance-id>` |  Id of the policy |
 
-#### Function: api_get_policy_schema() ####
+## Function: api_get_policy_schema() ##
 Test of GET /policy_schema and optional check of the returned json schema.
 To test the response code only, provide the expected response code and policy type id.
 To test the contents of the returned json schema, add a path to a schema file to compare with.
@@ -575,7 +670,7 @@ To test the contents of the returned json schema, add a path to a schema file to
 | `<policy-type-id>` |  Id of the policy type |
 | `<schema-file>` |  Path to the schema file for the policy type |
 
-#### Function: api_get_policy_schemas() ####
+## Function: api_get_policy_schemas() ##
 Test of GET /policy_schemas and optional check of the returned json schemas.
 To test the response code only, provide the expected response code and ric id (or NORIC if no ric is given).
 To test the contents of the returned json schema, add a path to a schema file to compare with (or NOFILE to represent an empty '{}' type)
@@ -591,7 +686,7 @@ To test the contents of the returned json schema, add a path to a schema file to
 | `<schema-file>` |  Path to the schema file for the policy type |
 | `NOFILE` |  Indicate the template for an empty type |
 
-#### Function: api_get_policy_status() ####
+## Function: api_get_policy_status() ##
 Test of GET /policy_status.
 | arg list |
 |--|
@@ -608,7 +703,7 @@ Test of GET /policy_status.
 | `<instance-status>` |  Instance status |
 | `<has-been-deleted>` |  Deleted status, true or false |
 
-#### Function: api_get_policy_types() ####
+## Function: api_get_policy_types() ##
 Test of GET /policy_types and optional check of the returned ids.
 To test the response code only, provide the expected response code and ric id (or NORIC if no ric is given).
 To test the contents of the returned json payload, add the list of expected policy type id (or 'EMPTY' for the '{}' type)
@@ -625,7 +720,7 @@ To test the contents of the returned json payload, add the list of expected poli
 | `<policy-type-id>` |  Id of the policy type |
 | `EMPTY` |  Indicate the empty type |
 
-#### Function: api_get_status() ####
+## Function: api_get_status() ##
 Test of GET /status
 | arg list |
 |--|
@@ -635,7 +730,7 @@ Test of GET /status
 | --------- | ----------- |
 | `<response-code>` | Expected http response code |
 
-#### Function: api_get_ric() ####
+## Function: api_get_ric() ##
 Test of GET /ric
 To test the response code only, provide the expected response code and managed element id.
 To test the returned ric id, provide the expected ric id.
@@ -649,7 +744,7 @@ To test the returned ric id, provide the expected ric id.
 | `<managed-element-id>` |  Id of the managed element |
 | `<ric-id>` |  Id of the ric |
 
-#### Function: api_get_rics() ####
+## Function: api_get_rics() ##
 Test of GET /rics and optional check of the returned json payload (ricinfo).
 To test the response code only, provide the expected response code and policy type id (or NOTYPE if no type is given).
 To test also the returned payload, add the formatted string of info in the returned payload.
@@ -666,7 +761,7 @@ Example `<space-separate-string-of-ricinfo> = "ricsim_g1_1:me1_ricsim_g1_1,me2_r
 | `NOTYPE>` |  No type given |
 | `<space-separate-string-of-ricinfo>` |  A space separated string of ric info - needs to be quoted |
 
-#### Function: api_put_service() ####
+## Function: api_put_service() ##
 Test of PUT /service
 | arg list |
 |--|
@@ -679,7 +774,7 @@ Test of PUT /service
 | `<keepalive-timeout>` |  Timeout value |
 | `<callbackurl>` |  Callback url |
 
-#### Function: api_get_services() ####
+## Function: api_get_services() ##
 Test of GET /service and optional check of the returned json payload.
 To test only the response code, omit all parameters except the expected response code.
 To test the returned json, provide the parameters after the response code.
@@ -696,7 +791,7 @@ To test the returned json, provide the parameters after the response code.
 | `<callbackurl>` |  Callback url |
 | `NOSERVICE` |  Indicator of no target service name |
 
-#### Function: api_get_service_ids() ####
+## Function: api_get_service_ids() ##
 Test of GET /services
 | arg list |
 |--|
@@ -707,7 +802,7 @@ Test of GET /services
 | `<response-code>` | Expected http response code |
 | `<service-name>` |  Service name |
 
-#### Function: api_delete_services() ####
+## Function: api_delete_services() ##
 Test of DELETE /services
 | arg list |
 |--|
@@ -718,7 +813,7 @@ Test of DELETE /services
 | `<response-code>` | Expected http response code |
 | `<service-name>` |  Service name |
 
-#### Function: api_put_services_keepalive() ####
+## Function: api_put_services_keepalive() ##
 Test of PUT /services/keepalive
 | arg list |
 |--|
@@ -729,10 +824,10 @@ Test of PUT /services/keepalive
 | `<response-code>` | Expected http response code |
 | `<service-name>` |  Service name |
 
-## Descriptions of functions in ricsimulator_api_functions.sh ##
+# Description of functions in ricsimulator_api_functions.sh #
 The functions below only use the admin interface of the simulator, no usage of the A1 interface.
 
-#### Function: sim_equal ####
+## Function: sim_equal ##
 Tests if a variable value in the RIC simulator is equal to a target value.
 Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
 With the timeout, the test waits up to the timeout seconds before setting pass or fail depending on if the variable value becomes equal to the target value or not.
@@ -747,7 +842,7 @@ See the 'a1-interface' repo for more details.
 | `<target-value>` | Target value for the variable  |
 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value  |
 
-#### Function: sim_print ####
+## Function: sim_print ##
 Prints the value of a variable in the RIC simulator.
 See the 'a1-interface' repo for more details.
 | arg list |
@@ -759,7 +854,7 @@ See the 'a1-interface' repo for more details.
 | `<variable-name>` | Variable name in the RIC simulator  |
 
 
-#### Function: sim_contains_str ####
+## Function: sim_contains_str ##
 Tests if a variable value in the RIC simulator contains a target string.
 Without the timeout, the test sets pass or fail immediately depending on if the variable contains the target string or not.
 With the timeout, the test waits up to the timeout seconds before setting pass or fail depending on if the variable value contains the target string or not.
@@ -774,7 +869,7 @@ See the 'a1-interface' repo for more details.
 | `<target-value>` | Target substring for the variable  |
 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value  |
 
-#### Function: sim_put_policy_type ####
+## Function: sim_put_policy_type ##
 Loads a policy type to the simulator
 | arg list |
 |--|
@@ -787,7 +882,7 @@ Loads a policy type to the simulator
 | `<policy-type-id>` |  Id of the policy type |
 | `<policy-type-file>` |  Path to the schema file of the policy type |
 
-#### Function: sim_delete_policy_type ####
+## Function: sim_delete_policy_type ##
 Deletes a policy type from the simulator
 | arg list |
 |--|
@@ -799,7 +894,7 @@ Deletes a policy type from the simulator
 | `<ric-id>` |  Id of the ric |
 | `<policy-type-id>` |  Id of the policy type |
 
-#### Function: sim_post_delete_instances ####
+## Function: sim_post_delete_instances ##
 Deletes all instances (and status), for one ric
 | arg list |
 |--|
@@ -811,7 +906,7 @@ Deletes all instances (and status), for one ric
 | `<ric-id>` |  Id of the ric |
 
 
-#### Function: sim_post_delete_all ####
+## Function: sim_post_delete_all ##
 Deletes all types, instances (and status), for one ric
 | arg list |
 |--|
@@ -822,7 +917,7 @@ Deletes all types, instances (and status), for one ric
 | `<response-code>` | Expected http response code |
 | `<ric-id>` |  Id of the ric |
 
-#### Function: sim_post_forcedresponse ####
+## Function: sim_post_forcedresponse ##
 Sets (or resets) response code for next (one) A1 message, for one ric.
 The intention is to simulate error response on the A1 interface.
 | arg list |
@@ -835,7 +930,7 @@ The intention is to simulate error response on the A1 interface.
 | `<ric-id>` |  Id of the ric |
 | `<forced_response_code>` |  Http response code to send |
 
-#### Function: sim_post_forcedelay ####
+## Function: sim_post_forcedelay ##
 Sets (or resets) A1 response delay, for one ric
 The intention is to delay responses on the A1 interface. Setting remains until removed.
 | arg list |
@@ -849,10 +944,10 @@ The intention is to delay responses on the A1 interface. Setting remains until r
 | `<delay-in-seconds>` |  Delay in seconds. If omitted, the delay is removed |
 
 
-## Descriptions of functions in controller_api_functions.sh ##
+# Description of functions in controller_api_functions.sh #
 The file contains a selection of the possible API tests towards the a1-controller
 
-#### Function: controller_api_get_A1_policy_ids ####
+## Function: controller_api_get_A1_policy_ids ##
 Test of GET policy ids towards OSC or STD type simulator.
 To test response code only, provide the response code, 'OSC' + policy type or 'STD'
 To test the response payload, include the ids of the expexted response.
@@ -870,7 +965,7 @@ To test the response payload, include the ids of the expexted response.
 | `STD` |  Indicator of status of Standarized A1 |
 
 
-#### Function: controller_api_get_A1_policy_type ####
+## Function: controller_api_get_A1_policy_type ##
 Test of GET a policy type (OSC only)
 | arg list |
 |--|
@@ -884,7 +979,7 @@ Test of GET a policy type (OSC only)
 | `policy-type-id>` |  Id of the policy type |
 | `policy-type-file>` |  Optional schema file to compare the returned type with |
 
-#### Function: controller_api_delete_A1_policy ####
+## Function: controller_api_delete_A1_policy ##
 Deletes a policy instance
 | arg list |
 |--|
@@ -900,7 +995,7 @@ Deletes a policy instance
 | `OSC` |  Indicator of status of Non-Standarized OSC A1 |
 | `policy-type-file>` |  Optional schema file to compare the returned type with |
 
-#### Function: controller_api_put_A1_policy ####
+## Function: controller_api_put_A1_policy ##
 Creates a policy instance
 | arg list |
 |--|
@@ -916,7 +1011,7 @@ Creates a policy instance
 | `OSC` |  Indicator of status of Non-Standarized OSC A1 |
 | `<policy-type-id>` |  Id of the policy type |
 
-#### Function: controller_api_get_A1_policy_status ####
+## Function: controller_api_get_A1_policy_status ##
 Checks the status of a policy
  arg list |
 |--|
@@ -935,6 +1030,345 @@ Checks the status of a policy
 | `<instance-status>` |  Instance status |
 | `<has-been-deleted>` |  Deleted status, true or false |
 
+
+
+
+# Description of functions in ecs_api_function.sh #
+
+## Function: ecs_api_a1_get_job_ids() ##
+Test of GET '/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs' and optional check of the array of returned job ids.
+To test the response code only, provide the response code parameter as well as a type id and an owner id.
+To also test the response payload add the 'EMPTY' for an expected empty array or repeat the last parameter for each expected job id.
+| arg list |
+|--|
+| `<response-code> <type-id>  <owner-id>|NOOWNER [ EMPTY | <job-id>+ ]` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<type-id>` | Id of the EI type  |
+| `<owner-id>` | Id of the job owner  |
+| `NOOWNER` | No owner is given  |
+| `<job-id>` | Id of the expected job  |
+| `EMPTY` | The expected list of job id shall be empty  |
+
+## Function: ecs_api_a1_get_type() ##
+Test of GET '/A1-EI​/v1​/eitypes​/{eiTypeId}' and optional check of the returned schema.
+To test the response code only, provide the response code parameter as well as the type-id.
+To also test the response payload add a path to the expected schema file.
+| arg list |
+|--|
+| `<response-code> <type-id> [<schema-file>]` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<type-id>` | Id of the EI type  |
+| `<schema-file>` | Path to a schema file to compare with the returned schema  |
+
+## Function: ecs_api_a1_get_type_ids() ##
+Test of GET '/A1-EI​/v1​/eitypes' and optional check of returned list of type ids.
+To test the response code only, provide the response only.
+To also test the response payload add the list of expected type ids (or EMPTY if the list is expected to be empty).
+| arg list |
+|--|
+| `<response-code> [ (EMPTY | [<type-id>]+) ]` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `EMPTY` | The expected list of type ids shall be empty  |
+| `<type-id>` | Id of the EI type  |
+
+## Function: ecs_api_a1_get_job_status() ##
+Test of GET '/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}​/status' and optional check of the returned status.
+To test the response code only, provide the response code, type id and job id.
+To also test the response payload add the expected status.
+| arg list |
+|--|
+| `<response-code> <type-id> <job-id> [<status>]` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<type-id>` | Id of the EI type  |
+| `<job-id>` | Id of the job  |
+| `<status>` | Expected status  |
+
+## Function: ecs_api_a1_get_job() ##
+Test of GET '/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}' and optional check of the returned job.
+To test the response code only, provide the response code, type id and job id.
+To also test the response payload add the remaining parameters.
+| arg list |
+|--|
+| `<response-code> <type-id> <job-id> [<target-url> <owner-id> <template-job-file>]` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<type-id>` | Id of the EI type  |
+| `<job-id>` | Id of the job  |
+| `<target-url>` | Expected target url for the job  |
+| `<owner-id>` | Expected owner for the job  |
+| `<template-job-file>` | Path to a job template for job parameters of the job  |
+
+## Function: ecs_api_a1_delete_job() ##
+Test of DELETE '/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}'.
+To test, provide all the specified parameters.
+| arg list |
+|--|
+| `<response-code> <type-id> <job-id> |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<type-id>` | Id of the EI type  |
+| `<job-id>` | Id of the job  |
+
+## Function: ecs_api_a1_put_job() ##
+Test of PUT '/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}'.
+To test, provide all the specified parameters.
+| arg list |
+|--|
+| `<response-code> <type-id> <job-id> <target-url> <owner-id> <template-job-file>` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<type-id>` | Id of the EI type  |
+| `<job-id>` | Id of the job  |
+| `<target-url>` | Target url for the job  |
+| `<owner-id>` | Owner of the job  |
+| `<template-job-file>` | Path to a job template for job parameters of the job  |
+
+## Function: ecs_api_edp_get_type_ids() ##
+Test of GET '/ei-producer/v1/eitypes' and an optional check of the returned list of type ids.
+To test the response code only, provide the response code.
+To also test the response payload add list of expected type ids (or EMPTY if the list is expected to be empty).
+| arg list |
+|--|
+| `<response-code> [ EMPTY | <type-id>+]` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<type-id>` | Id of the EI type  |
+| `EMPTY` | The expected list of type ids shall be empty  |
+
+## Function: ecs_api_edp_get_producer_status() ##
+Test of GET '/ei-producer/v1/eiproducers/{eiProducerId}/status' and optional check of the returned status.
+To test the response code only, provide the response code and producer id.
+To also test the response payload add the expected status.
+| arg list |
+|--|
+| `<response-code> <producer-id> [<status>]` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<producer-id>` | Id of the producer  |
+| `<status>` | The expected status string  |
+
+## Function: ecs_api_edp_get_producer_ids() ##
+Test of GET '/ei-producer/v1/eiproducers' and optional check of the returned producer ids.
+To test the response code only, provide the response.
+To also test the response payload add the list of expected producer-ids (or EMPTY if the list of ids is expected to be empty).
+| arg list |
+|--|
+| `<response-code> [ EMPTY | <producer-id>+]` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<producer-id>` | Id of the producer  |
+| `EMPTY` | The expected list of type ids shall be empty  |
+
+## Function: ecs_api_edp_get_type() ##
+Test of GET '/ei-producer/v1/eitypes/{eiTypeId}' and optional check of the returned type.
+To test the response code only, provide the response and the type-id.
+To also test the response payload add a path to a job schema file and a list expected producer-id (or EMPTY if the list of ids is expected to be empty).
+| arg list |
+|--|
+| `<response-code> <type-id> [<job-schema-file> (EMPTY | [<producer-id>]+)]` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<type-id>` | Id of the EI type  |
+| `<job-schema-file>` | Path to a job schema file  |
+| `<producer-id>` | Id of the producer  |
+| `EMPTY` | The expected list of type ids shall be empty  |
+
+## Function: ecs_api_edp_get_producer() ##
+Test of GET '/ei-producer/v1/eiproducers/{eiProducerId}' and optional check of the returned producer.
+To test the response code only, provide the response and the producer-id.
+To also test the response payload add the remaining parameters defining thee producer.
+| arg list |
+|--|
+| `<response-code> <producer-id> [<create-callback> <delete-callback> <supervision-callback> (EMPTY | [<type-id> <schema-file>]+) ]` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<producer-id>` | Id of the producer  |
+| `<create-callback>` | Callback for create job  |
+| `<delete-callback>` | Callback for delete job  |
+| `<supervision-callback>` | Callback for producer supervision  |
+| `<type-id>` | Id of the EI type  |
+| `<schema-file>` | Path to a schema file  |
+| `EMPTY` | The expected list of type schema pairs shall be empty  |
+
+## Function: ecs_api_edp_delete_producer() ##
+Test of DELETE '/ei-producer/v1/eiproducers/{eiProducerId}'.
+To test, provide all parameters.
+| arg list |
+|--|
+| `<response-code> <producer-id>` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<producer-id>` | Id of the producer  |
+
+## Function: ecs_api_edp_put_producer() ##
+Test of PUT '/ei-producer/v1/eiproducers/{eiProducerId}'.
+To test, provide all parameters. The list of type/schema pair may be empty.
+| arg list |
+|--|
+| `<response-code> <producer-id> <create-callback> <delete-callback> <supervision-callback> (EMPTY | [<type-id> <schema-file>]+)` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<producer-id>` | Id of the producer  |
+| `<create-callback>` | Callback for create job  |
+| `<delete-callback>` | Callback for delete job  |
+| `<supervision-callback>` | Callback for producer supervision  |
+| `<type-id>` | Id of the EI type  |
+| `<schema-file>` | Path to a schema file  |
+| `EMPTY` | The list of type/schema pairs is empty  |
+
+## Function: ecs_api_edp_get_producer_jobs() ##
+Test of GET '/ei-producer/v1/eiproducers/{eiProducerId}/eijobs' and optional check of the returned producer job.
+To test the response code only, provide the response and the producer-id.
+To also test the response payload add the remaining parameters.
+| arg list |
+|--|
+| `<response-code> <producer-id> (EMPTY | [<job-id> <type-id> <target-url> <template-job-file>]+)` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<producer-id>` | Id of the producer  |
+| `<job-id>` | Id of the job  |
+| `<type-id>` | Id of the EI type  |
+| `<target-url>` | Target url for data delivery  |
+| `<template-job-file>` | Path to a job template file  |
+| `EMPTY` | The list of job/type/target/job-file tuples is empty  |
+
+## Function: ecs_api_service_status() ##
+Test of GET '/status'.
+| arg list |
+|--|
+| `<response-code>` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+
+
+# Description of functions in prodstub_api_function.sh #
+
+## Function: prodstub_arm_producer() ##
+Preconfigure the prodstub with a producer. The producer supervision response code is optional, if not given the response code will be set to 200.
+| arg list |
+|--|
+| `<response-code> <producer-id> [<forced_response_code>]` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<producer-id>` | Id of the producer  |
+| `<forced_response_code>` | Forced response code for the producer callback url |
+
+## Function: prodstub_arm_job_create() ##
+Preconfigure the prodstub with a job or update an existing job. Optional create/update job response code, if not given the response code will be set to 200/201 depending on if the job has been previously created or not.
+| arg list |
+|--|
+| `<response-code> <job-id> [<forced_response_code>]` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<job-id>` | Id of the job  |
+| `<forced_response_code>` | Forced response code for the create callback url |
+
+## Function: prodstub_arm_job_delete() ##
+Preconfigure the prodstub with a job. Optional delete job response code, if not given the response code will be set to 204/404 depending on if the job exists or not.
+| arg list |
+|--|
+| `<response-code> <job-id> [<forced_response_code>]` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<job-id>` | Id of the job  |
+| `<forced_response_code>` | Forced response code for the delete callback url |
+
+## Function: prodstub_arm_type() ##
+Preconfigure the prodstub with a type for a producer. Can be called multiple times to add more types.
+| arg list |
+|--|
+| `<response-code> <producer-id> <type-id>` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<producer-id>` | Id of the producer  |
+| `<type-id>` | Id of the type  |
+
+## Function: prodstub_disarm_type() ##
+Remove a type for the producer in the rodstub. Can be called multiple times to remove more types.
+| arg list |
+|--|
+| `<response-code> <producer-id> <type-id>` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<producer-id>` | Id of the producer  |
+| `<type-id>` | Id of the type  |
+
+## Function: prodstub_check_jobdata() ##
+Check a job in the prodstub towards the list of provided parameters.
+| arg list |
+|--|
+| `<response-code> <producer-id> <job-id> <type-id> <target-url> <template-job-file>` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<producer-id>` | Id of the producer  |
+| `<job-id>` | Id of the job  |
+| `<type-id>` | Id of the type  |
+| `<target-url>` | Target url for data delivery  |
+| `<template-job-file>` | Path to a job template file  |
+
+## Function: prodstub_equal ##
+Tests if a variable value in the prodstub is equal to a target value.
+Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
+With the timeout, the test waits up to the timeout seconds before setting pass or fail depending on if the variable value becomes equal to the target value or not.
+| arg list |
+|--|
+| `<variable-name> <target-value> [ <timeout-in-sec> ]` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<variable-name>` | Variable name in the prostub  |
+| `<target-value>` | Target value for the variable  |
+| `<timeout-in-sec>` | Max time to wait for the variable to reach the target value  |
+
+
 ## License
 
 Copyright (C) 2020 Nordix Foundation. All rights reserved.
index 6c726b9..dfa6e4b 100644 (file)
@@ -143,16 +143,16 @@ ecs_api_a1_get_type() {
        return 0
 }
 
-# API Test function: GET â€‹/A1-EI​/v1​/eitypes
-# args: <response-code> (EMPTY | [<type-id>]+)
+# API Test function: GET /A1-EI/v1/eitypes
+# args: <response-code> [ (EMPTY | [<type-id>]+) ]
 # (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 2 ]; then
-               __print_err "<response-code> (EMPTY | [<type-id>]+)" $@
+    if [ $# -lt 1 ]; then
+               __print_err "<response-code> [ (EMPTY | [<type-id>]+) ]" $@
                return 1
        fi
 
@@ -166,25 +166,27 @@ ecs_api_a1_get_type_ids() {
                __check_stop_at_error
                return 1
        fi
-       body=${res:0:${#res}-3}
-       targetJson="["
-       if [ $2 != "EMPTY" ]; then
-               for pid in ${@:2} ; do
-                       if [ "$targetJson" != "[" ]; then
-                               targetJson=$targetJson","
-                       fi
-                       targetJson=$targetJson"\"$pid\""
-               done
-       fi
-       targetJson=$targetJson"]"
-       echo " TARGET JSON: $targetJson" >> $HTTPLOG
-       res=$(python3 ../common/compare_json.py "$targetJson" "$body")
+       if [ $# -gt 1 ]; then
+               body=${res:0:${#res}-3}
+               targetJson="["
+               if [ $2 != "EMPTY" ]; then
+                       for pid in ${@:2} ; do
+                               if [ "$targetJson" != "[" ]; then
+                                       targetJson=$targetJson","
+                               fi
+                               targetJson=$targetJson"\"$pid\""
+                       done
+               fi
+               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
+               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++))
@@ -425,7 +427,7 @@ ecs_api_edp_get_producer_status() {
        ((RES_TEST++))
 
     if [ $# -lt 2 ] || [ $# -gt 3 ]; then
-               __print_err "<response-code> <producer-id> <status>" $@
+               __print_err "<response-code> <producer-id> [<status>]" $@
                return 1
        fi
 
@@ -514,7 +516,7 @@ ecs_api_edp_get_producer_ids() {
 }
 
 # API Test function: GET /ei-producer/v1/eitypes/{eiTypeId}
-# args: <response-code> <type-id> [<job-schema-file> (NOID | [<producer-id>]+)]
+# args: <response-code> <type-id> [<job-schema-file> (EMPTY | [<producer-id>]+)]
 # (Function for test scripts)
 ecs_api_edp_get_type() {
        echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
@@ -529,7 +531,7 @@ ecs_api_edp_get_type() {
                paramError=0
        fi
     if [ $paramError -ne 0 ]; then
-               __print_err "<response-code> <type-id> [<job-schema-file> NOID | ([<producer-id>]+)]" $@
+               __print_err "<response-code> <type-id> [<job-schema-file> 'EMPTY' | ([<producer-id>]+)]" $@
                return 1
        fi
 
index b41c79b..f30b876 100644 (file)
@@ -61,7 +61,7 @@ __execute_curl_to_prodstub() {
 # Prodstub API: Set (or reset) response code for producer supervision
 # <response-code> <producer-id> [<forced_response_code>]
 # (Function for test scripts)
-prodstub_arm_supervision() {
+prodstub_arm_producer() {
        echo -e $BOLD"CONF(${BASH_LINENO[0]}): "${FUNCNAME[0]} $@ $EBOLD
     echo "CONF(${BASH_LINENO[0]}): "${FUNCNAME[0]} $@  >> $HTTPLOG
        if [ $# -ne 2 ] && [ $# -ne 3 ]; then
@@ -86,7 +86,7 @@ prodstub_arm_supervision() {
 # Prodstub API: Set (or reset) response code job create
 # <response-code> <producer-id> <job-id> [<forced_response_code>]
 # (Function for test scripts)
-prodstub_arm_create() {
+prodstub_arm_job_create() {
        echo -e $BOLD"CONF(${BASH_LINENO[0]}): "${FUNCNAME[0]} $@ $EBOLD
     echo "CONF(${BASH_LINENO[0]}): "${FUNCNAME[0]} $@  >> $HTTPLOG
        if [ $# -ne 3 ] && [ $# -ne 4 ]; then
@@ -111,7 +111,7 @@ prodstub_arm_create() {
 # Prodstub API: Set (or reset) response code job delete
 # <response-code> <producer-id> <job-id> [<forced_response_code>]
 # (Function for test scripts)
-prodstub_arm_delete() {
+prodstub_arm_job_delete() {
        echo -e $BOLD"CONF(${BASH_LINENO[0]}): "${FUNCNAME[0]} $@ $EBOLD
     echo "CONF(${BASH_LINENO[0]}): "${FUNCNAME[0]} $@  >> $HTTPLOG
        if [ $# -ne 3 ] && [ $# -ne 4 ]; then
@@ -207,4 +207,20 @@ prodstub_check_jobdata() {
         ((RES_FAIL++))
     fi
        return $retcode
+}
+
+# Tests if a variable value in the prod stub is equal to a target value and and optional timeout.
+# Arg: <variable-name> <target-value> - This test set pass or fail depending on if the variable is
+# equal to the target or not.
+# Arg: <variable-name> <target-value> <timeout-in-sec>  - This test waits up to the timeout seconds
+# before setting pass or fail depending on if the variable value becomes equal to the target
+# value or not.
+# (Function for test scripts)
+prodstub_equal() {
+       if [ $# -eq 2 ] || [ $# -eq 3 ]; then
+               __var_test "PRODSTUB" "$LOCALHOST$PROD_STUB_EXTERNAL_PORT/counter/" $1 "=" $2 $3
+       else
+               ((RES_CONF_FAIL++))
+               __print_err "Wrong args to prodstub_equal, needs two or three args: <sim-param> <target-value> [ timeout ]" $@
+       fi
 }
\ No newline at end of file
diff --git a/test/common/test_env-onap-guilin.sh b/test/common/test_env-onap-guilin.sh
new file mode 100644 (file)
index 0000000..e7a9030
--- /dev/null
@@ -0,0 +1,147 @@
+#!/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=================================================
+#
+
+# Set up the image and tags for the test. Do not add the image tag to the image names.
+
+# NOTE: A env var for each container is created by the test script.
+# This var will point to the local or remote var depending on how
+# the test script is started. The name format is <container-name>_IMAGE, ie with 'LOCAL' or 'REMOTE'.
+
+# Tag for guilin branch
+# Remote Policy Agent image and tag
+POLICY_AGENT_REMOTE_IMAGE="nexus3.onap.org:10003/onap/ccsdk-oran-a1policymanagementservice"
+POLICY_AGENT_REMOTE_IMAGE_TAG="1.0.1-SNAPSHOT"
+
+
+# Control Panel remote image and tag
+CONTROL_PANEL_REMOTE_IMAGE="nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-controlpanel"
+CONTROL_PANEL_REMOTE_IMAGE_TAG="2.0.0"
+
+# Tag for guilin branch
+# SDNC A1 Controller remote image and tag
+SDNC_A1_CONTROLLER_REMOTE_IMAGE="nexus3.onap.org:10003/onap/sdnc-image"
+SDNC_A1_CONTROLLER_REMOTE_IMAGE_TAG="2.0.2-STAGING-latest"
+
+
+#SDNC DB remote image and tag
+SDNC_DB_REMOTE_IMAGE="mysql/mysql-server"
+SDNC_DB_REMOTE_IMAGE_TAG="5.6"
+#No local image for DB, remote image always used
+
+
+# Near RT RIC Simulator remote image and tag
+RIC_SIM_REMOTE_IMAGE="nexus3.o-ran-sc.org:10004/o-ran-sc/a1-simulator"
+RIC_SIM_REMOTE_IMAGE_TAG="2.0.0"
+
+
+#Consul remote image and tag
+CONSUL_REMOTE_IMAGE="consul"
+CONSUL_REMOTE_IMAGE_TAG="1.7.2"
+#No local image for Consul, remote image always used
+
+
+#CBS remote image and tag
+CBS_REMOTE_IMAGE="nexus3.onap.org:10001/onap/org.onap.dcaegen2.platform.configbinding.app-app"
+CBS_REMOTE_IMAGE_TAG="2.3.0"
+#No local image for CBS, remote image always used
+
+
+#MR stub image and tag
+MRSTUB_LOCAL_IMAGE="mrstub"
+MRSTUB_LOCAL_IMAGE_TAG="latest"
+#No remote image for MR stub, local image always used
+
+#Callback receiver image and tag
+CR_LOCAL_IMAGE="callback-receiver"
+CR_LOCAL_IMAGE_TAG="latest"
+#No remote image for CR, local image always used
+
+# Common env var for auto-test. Vars used by docker-compose need to be exported
+export DOCKER_SIM_NWNAME="nonrtric-docker-net"                  # Name of docker private network
+
+export POLICY_AGENT_EXTERNAL_PORT=8081                          # Policy Agent container external port (host -> container)
+export POLICY_AGENT_INTERNAL_PORT=8081                          # Policy Agent container internal port (container -> container)
+export POLICY_AGENT_EXTERNAL_SECURE_PORT=8433                   # Policy Agent container external secure port (host -> container)
+export POLICY_AGENT_INTERNAL_SECURE_PORT=8433                   # Policy Agent container internal secure port (container -> container)
+
+export POLICY_AGENT_APP_NAME="policy-agent"                     # Name for Policy Agent container
+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 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)
+export MR_INTERNAL_SECURE_PORT=3906                             # MR stub container internal secure port (container -> container)
+export MR_APP_NAME="message-router"                             # Name for the MR
+export MR_READ_URL="/events/A1-POLICY-AGENT-READ/users/policy-agent?timeout=15000&limit=100" # Path to read messages from MR
+export MR_WRITE_URL="/events/A1-POLICY-AGENT-WRITE"             # Path write messages to MR
+
+export CR_EXTERNAL_PORT=8090                                    # Callback receiver container external port (host -> container)
+export CR_INTERNAL_PORT=8090                                    # Callback receiver container internal port (container -> container)
+export CR_EXTERNAL_SECURE_PORT=8091                             # Callback receiver container external secure port (host -> container)
+export CR_INTERNAL_SECURE_PORT=8091                             # Callback receiver container internal secure port (container -> container)
+export CR_APP_NAME="callback-receiver"                          # Name for the Callback receiver
+
+export CONSUL_HOST="consul-server"                              # Host name of consul
+export CONSUL_EXTERNAL_PORT=8500                                # Consul container external port (host -> container)
+export CONSUL_INTERNAL_PORT=8500                                # Consul container internal port (container -> container)
+export CONSUL_APP_NAME="polman-consul"                          # Name for consul container
+
+export CBS_APP_NAME="polman-cbs"                                # Name for CBS container
+export CBS_EXTERNAL_PORT=10000                                  # CBS container external port (host -> container)
+export CBS_INTERNAL_PORT=10000                                  # CBS container internal port (container -> container)
+export CONFIG_BINDING_SERVICE="config-binding-service"          # Host name of CBS
+
+export RIC_SIM_BASE="g"                                         # Base name of the RIC Simulator container, shall be the group code
+                                                                # Note, a prefix is added to each container name by the .env file in the 'ric' dir
+RIC_SIM_PREFIX="ricsim"                                         # Prefix added to ric container name, added in the .env file in the 'ric' dir
+                                                                # This prefix can be changed from the command line
+export RIC_SIM_INTERNAL_PORT=8085                               # RIC Simulator container internal port (container -> container).
+                                                                # (external ports allocated by docker)
+export RIC_SIM_INTERNAL_SECURE_PORT=8185                        # RIC Simulator container internal secure port (container -> container).
+                                                                # (external ports allocated by docker)
+
+export SDNC_APP_NAME="a1-controller"                            # Name of the SNDC A1 Controller container
+export SDNC_EXTERNAL_PORT=8282                                  # SNDC A1 Controller container external port (host -> container)
+export SDNC_INTERNAL_PORT=8181                                  # SNDC A1 Controller container internal port (container -> container)
+export SDNC_EXTERNAL_SECURE_PORT=8443                           # SNDC A1 Controller container external securee port (host -> container)
+export SDNC_INTERNAL_SECURE_PORT=8443                           # SNDC A1 Controller container internal secure port (container -> container)
+export SDNC_DB_APP_NAME="sdnc-db"                               # Name of the SDNC DB container
+export SDNC_A1_TRUSTSTORE_PASSWORD="a1adapter"                  # SDNC truststore password
+SDNC_USER="admin"                                               # SDNC username
+SDNC_PWD="Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U"          # SNDC PWD
+SDNC_API_URL="/restconf/operations/A1-ADAPTER-API:"             # Base url path for SNDC API
+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 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
+
+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
diff --git a/test/common/test_env-onap-master.sh b/test/common/test_env-onap-master.sh
new file mode 100644 (file)
index 0000000..7ecd687
--- /dev/null
@@ -0,0 +1,188 @@
+#!/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=================================================
+#
+
+# Set up the image and tags for the test. Do not add the image tag to the image names.
+
+# NOTE: A env var for each container is created by the test script.
+# This var will point to the local or remote var depending on how
+# the test script is started. The name format is <container-name>_IMAGE, ie with 'LOCAL' or 'REMOTE'.
+
+# Local Policy Agent image and tag
+POLICY_AGENT_LOCAL_IMAGE="onap/ccsdk-oran-a1policymanagementservice"
+POLICY_AGENT_LOCAL_IMAGE_TAG="1.1.0-SNAPSHOT"
+# Remote Policy Agent image and tag
+POLICY_AGENT_REMOTE_IMAGE="nexus3.onap.org:10003/onap/ccsdk-oran-a1policymanagementservice"
+POLICY_AGENT_REMOTE_IMAGE_TAG="1.1.0-SNAPSHOT"
+
+# 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"
+CONTROL_PANEL_LOCAL_IMAGE_TAG="2.0.0-SNAPSHOT"
+# Control Panel remote image and tag
+CONTROL_PANEL_REMOTE_IMAGE="nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-controlpanel"
+CONTROL_PANEL_REMOTE_IMAGE_TAG="2.0.0"
+
+
+# SDNC A1 Controller remote image and tag
+SDNC_A1_CONTROLLER_REMOTE_IMAGE="nexus3.onap.org:10003/onap/sdnc-image"
+SDNC_A1_CONTROLLER_REMOTE_IMAGE_TAG="2.1.0-STAGING-latest"
+
+
+#SDNC DB remote image and tag
+SDNC_DB_REMOTE_IMAGE="mysql/mysql-server"
+SDNC_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="o-ran-sc/a1-simulator"
+RIC_SIM_LOCAL_IMAGE_TAG="latest"
+# Near RT RIC Simulator remote image and tag
+RIC_SIM_REMOTE_IMAGE="nexus3.o-ran-sc.org:10004/o-ran-sc/a1-simulator"
+RIC_SIM_REMOTE_IMAGE_TAG="2.0.0"
+
+
+#Consul remote image and tag
+CONSUL_REMOTE_IMAGE="consul"
+CONSUL_REMOTE_IMAGE_TAG="1.7.2"
+#No local image for Consul, remote image always used
+
+
+#CBS remote image and tag
+CBS_REMOTE_IMAGE="nexus3.onap.org:10001/onap/org.onap.dcaegen2.platform.configbinding.app-app"
+CBS_REMOTE_IMAGE_TAG="2.3.0"
+#No local image for CBS, remote image always used
+
+
+#MR stub image and tag
+MRSTUB_LOCAL_IMAGE="mrstub"
+MRSTUB_LOCAL_IMAGE_TAG="latest"
+#No remote image for MR stub, local image always used
+
+#Callback receiver image and tag
+CR_LOCAL_IMAGE="callback-receiver"
+CR_LOCAL_IMAGE_TAG="latest"
+#No remote image for CR, local image always used
+
+#Producer stub image and tag
+PROD_STUB_LOCAL_IMAGE="producer-stub"
+PROD_STUB_LOCAL_IMAGE_TAG="latest"
+#No remote image for producer stub, local image always used
+
+# Common env var for auto-test. Vars used by docker-compose need to be exported
+export DOCKER_SIM_NWNAME="nonrtric-docker-net"                  # Name of docker private network
+
+export POLICY_AGENT_EXTERNAL_PORT=8081                          # Policy Agent container external port (host -> container)
+export POLICY_AGENT_INTERNAL_PORT=8081                          # Policy Agent container internal port (container -> container)
+export POLICY_AGENT_EXTERNAL_SECURE_PORT=8433                   # Policy Agent container external secure port (host -> container)
+export POLICY_AGENT_INTERNAL_SECURE_PORT=8433                   # Policy Agent container internal secure port (container -> container)
+
+export POLICY_AGENT_APP_NAME="policy-agent"                     # Name for Policy Agent container
+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=8083                                   # ECS container external port (host -> container)
+export ECS_INTERNAL_PORT=8083                                   # 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/enrichment-coordinator-service/application.log" # Path the application log in the ECS container
+export ECS_APP_NAME_ALIAS="enrichment-service-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)
+export MR_INTERNAL_SECURE_PORT=3906                             # MR stub container internal secure port (container -> container)
+export MR_APP_NAME="message-router"                             # Name for the MR
+export MR_READ_URL="/events/A1-POLICY-AGENT-READ/users/policy-agent?timeout=15000&limit=100" # Path to read messages from MR
+export MR_WRITE_URL="/events/A1-POLICY-AGENT-WRITE"             # Path write messages to MR
+
+export CR_EXTERNAL_PORT=8090                                    # Callback receiver container external port (host -> container)
+export CR_INTERNAL_PORT=8090                                    # Callback receiver container internal port (container -> container)
+export CR_EXTERNAL_SECURE_PORT=8091                             # Callback receiver container external secure port (host -> container)
+export CR_INTERNAL_SECURE_PORT=8091                             # Callback receiver container internal secure port (container -> container)
+export CR_APP_NAME="callback-receiver"                          # Name for the Callback receiver
+
+export PROD_STUB_EXTERNAL_PORT=8092                             # Producer stub container external port (host -> container)
+export PROD_STUB_INTERNAL_PORT=8092                             # Producer stub container internal port (container -> container)
+export PROD_STUB_EXTERNAL_SECURE_PORT=8093                      # Producer stub container external secure port (host -> container)
+export PROD_STUB_INTERNAL_SECURE_PORT=8093                      # Producer stub container internal secure port (container -> container)
+export PROD_STUB_APP_NAME="producer-stub"                       # Name for the Producer stub
+
+export CONSUL_HOST="consul-server"                              # Host name of consul
+export CONSUL_EXTERNAL_PORT=8500                                # Consul container external port (host -> container)
+export CONSUL_INTERNAL_PORT=8500                                # Consul container internal port (container -> container)
+export CONSUL_APP_NAME="polman-consul"                          # Name for consul container
+
+export CBS_APP_NAME="polman-cbs"                                # Name for CBS container
+export CBS_EXTERNAL_PORT=10000                                  # CBS container external port (host -> container)
+export CBS_INTERNAL_PORT=10000                                  # CBS container internal port (container -> container)
+export CONFIG_BINDING_SERVICE="config-binding-service"          # Host name of CBS
+
+export RIC_SIM_BASE="g"                                         # Base name of the RIC Simulator container, shall be the group code
+                                                                # Note, a prefix is added to each container name by the .env file in the 'ric' dir
+RIC_SIM_PREFIX="ricsim"                                         # Prefix added to ric container name, added in the .env file in the 'ric' dir
+                                                                # This prefix can be changed from the command line
+export RIC_SIM_INTERNAL_PORT=8085                               # RIC Simulator container internal port (container -> container).
+                                                                # (external ports allocated by docker)
+export RIC_SIM_INTERNAL_SECURE_PORT=8185                        # RIC Simulator container internal secure port (container -> container).
+                                                                # (external ports allocated by docker)
+
+export SDNC_APP_NAME="a1-controller"                            # Name of the SNDC A1 Controller container
+export SDNC_EXTERNAL_PORT=8282                                  # SNDC A1 Controller container external port (host -> container)
+export SDNC_INTERNAL_PORT=8181                                  # SNDC A1 Controller container internal port (container -> container)
+export SDNC_EXTERNAL_SECURE_PORT=8443                           # SNDC A1 Controller container external securee port (host -> container)
+export SDNC_INTERNAL_SECURE_PORT=8443                           # SNDC A1 Controller container internal secure port (container -> container)
+export SDNC_DB_APP_NAME="sdnc-db"                               # Name of the SDNC DB container
+export SDNC_A1_TRUSTSTORE_PASSWORD="a1adapter"                  # SDNC truststore password
+SDNC_USER="admin"                                               # SDNC username
+SDNC_PWD="Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U"          # SNDC PWD
+SDNC_API_URL="/restconf/operations/A1-ADAPTER-API:"             # Base url path for SNDC API
+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 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
+
+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
+                                                                # 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
diff --git a/test/common/test_env-oran-master.sh b/test/common/test_env-oran-master.sh
new file mode 100755 (executable)
index 0000000..b24ecae
--- /dev/null
@@ -0,0 +1,190 @@
+#!/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=================================================
+#
+
+# Set up the image and tags for the test. Do not add the image tag to the image names.
+
+# NOTE: A env var for each container is created by the test script.
+# This var will point to the local or remote var depending on how
+# the test script is started. The name format is <container-name>_IMAGE, ie with 'LOCAL' or 'REMOTE'.
+
+# Local Policy Agent image and tag
+POLICY_AGENT_LOCAL_IMAGE="o-ran-sc/nonrtric-policy-agent"
+POLICY_AGENT_LOCAL_IMAGE_TAG="2.1.0-SNAPSHOT"
+# Remote Policy Agent image and tag
+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"
+CONTROL_PANEL_LOCAL_IMAGE_TAG="2.0.0-SNAPSHOT"
+# Control Panel remote image and tag
+CONTROL_PANEL_REMOTE_IMAGE="nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-controlpanel"
+CONTROL_PANEL_REMOTE_IMAGE_TAG="2.0.0"
+
+
+# SDNC A1 Controller local image and tag
+SDNC_A1_CONTROLLER_LOCAL_IMAGE="o-ran-sc/nonrtric-a1-controller"
+SDNC_A1_CONTROLLER_LOCAL_IMAGE_TAG="2.1.0-SNAPSHOT"
+# SDNC A1 Controller remote image and tag
+SDNC_A1_CONTROLLER_REMOTE_IMAGE="nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-a1-controller"
+SDNC_A1_CONTROLLER_REMOTE_IMAGE_TAG="2.1.0"
+
+
+#SDNC DB remote image and tag
+SDNC_DB_REMOTE_IMAGE="mysql/mysql-server"
+SDNC_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="o-ran-sc/a1-simulator"
+RIC_SIM_LOCAL_IMAGE_TAG="latest"
+# Near RT RIC Simulator remote image and tag
+RIC_SIM_REMOTE_IMAGE="nexus3.o-ran-sc.org:10004/o-ran-sc/a1-simulator"
+RIC_SIM_REMOTE_IMAGE_TAG="2.0.0"
+
+
+#Consul remote image and tag
+CONSUL_REMOTE_IMAGE="consul"
+CONSUL_REMOTE_IMAGE_TAG="1.7.2"
+#No local image for Consul, remote image always used
+
+
+#CBS remote image and tag
+CBS_REMOTE_IMAGE="nexus3.onap.org:10001/onap/org.onap.dcaegen2.platform.configbinding.app-app"
+CBS_REMOTE_IMAGE_TAG="2.3.0"
+#No local image for CBS, remote image always used
+
+
+#MR stub image and tag
+MRSTUB_LOCAL_IMAGE="mrstub"
+MRSTUB_LOCAL_IMAGE_TAG="latest"
+#No remote image for MR stub, local image always used
+
+#Callback receiver image and tag
+CR_LOCAL_IMAGE="callback-receiver"
+CR_LOCAL_IMAGE_TAG="latest"
+#No remote image for CR, local image always used
+
+#Producer stub image and tag
+PROD_STUB_LOCAL_IMAGE="producer-stub"
+PROD_STUB_LOCAL_IMAGE_TAG="latest"
+#No remote image for producer stub, local image always used
+
+# Common env var for auto-test. Vars used by docker-compose need to be exported
+export DOCKER_SIM_NWNAME="nonrtric-docker-net"                  # Name of docker private network
+
+export POLICY_AGENT_EXTERNAL_PORT=8081                          # Policy Agent container external port (host -> container)
+export POLICY_AGENT_INTERNAL_PORT=8081                          # Policy Agent container internal port (container -> container)
+export POLICY_AGENT_EXTERNAL_SECURE_PORT=8433                   # Policy Agent container external secure port (host -> container)
+export POLICY_AGENT_INTERNAL_SECURE_PORT=8433                   # Policy Agent container internal secure port (container -> container)
+
+export POLICY_AGENT_APP_NAME="policy-agent"                     # Name for Policy Agent container
+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=8083                                   # ECS container external port (host -> container)
+export ECS_INTERNAL_PORT=8083                                   # 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/enrichment-coordinator-service/application.log" # Path the application log in the ECS container
+export ECS_APP_NAME_ALIAS="enrichment-service-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)
+export MR_INTERNAL_SECURE_PORT=3906                             # MR stub container internal secure port (container -> container)
+export MR_APP_NAME="message-router"                             # Name for the MR
+export MR_READ_URL="/events/A1-POLICY-AGENT-READ/users/policy-agent?timeout=15000&limit=100" # Path to read messages from MR
+export MR_WRITE_URL="/events/A1-POLICY-AGENT-WRITE"             # Path write messages to MR
+
+export CR_EXTERNAL_PORT=8090                                    # Callback receiver container external port (host -> container)
+export CR_INTERNAL_PORT=8090                                    # Callback receiver container internal port (container -> container)
+export CR_EXTERNAL_SECURE_PORT=8091                             # Callback receiver container external secure port (host -> container)
+export CR_INTERNAL_SECURE_PORT=8091                             # Callback receiver container internal secure port (container -> container)
+export CR_APP_NAME="callback-receiver"                          # Name for the Callback receiver
+
+export PROD_STUB_EXTERNAL_PORT=8092                             # Producer stub container external port (host -> container)
+export PROD_STUB_INTERNAL_PORT=8092                             # Producer stub container internal port (container -> container)
+export PROD_STUB_EXTERNAL_SECURE_PORT=8093                      # Producer stub container external secure port (host -> container)
+export PROD_STUB_INTERNAL_SECURE_PORT=8093                      # Producer stub container internal secure port (container -> container)
+export PROD_STUB_APP_NAME="producer-stub"                       # Name for the Producer stub
+
+export CONSUL_HOST="consul-server"                              # Host name of consul
+export CONSUL_EXTERNAL_PORT=8500                                # Consul container external port (host -> container)
+export CONSUL_INTERNAL_PORT=8500                                # Consul container internal port (container -> container)
+export CONSUL_APP_NAME="polman-consul"                          # Name for consul container
+
+export CBS_APP_NAME="polman-cbs"                                # Name for CBS container
+export CBS_EXTERNAL_PORT=10000                                  # CBS container external port (host -> container)
+export CBS_INTERNAL_PORT=10000                                  # CBS container internal port (container -> container)
+export CONFIG_BINDING_SERVICE="config-binding-service"          # Host name of CBS
+
+export RIC_SIM_BASE="g"                                         # Base name of the RIC Simulator container, shall be the group code
+                                                                # Note, a prefix is added to each container name by the .env file in the 'ric' dir
+RIC_SIM_PREFIX="ricsim"                                         # Prefix added to ric container name, added in the .env file in the 'ric' dir
+                                                                # This prefix can be changed from the command line
+export RIC_SIM_INTERNAL_PORT=8085                               # RIC Simulator container internal port (container -> container).
+                                                                # (external ports allocated by docker)
+export RIC_SIM_INTERNAL_SECURE_PORT=8185                        # RIC Simulator container internal secure port (container -> container).
+                                                                # (external ports allocated by docker)
+
+export SDNC_APP_NAME="a1-controller"                            # Name of the SNDC A1 Controller container
+export SDNC_EXTERNAL_PORT=8282                                  # SNDC A1 Controller container external port (host -> container)
+export SDNC_INTERNAL_PORT=8181                                  # SNDC A1 Controller container internal port (container -> container)
+export SDNC_EXTERNAL_SECURE_PORT=8443                           # SNDC A1 Controller container external securee port (host -> container)
+export SDNC_INTERNAL_SECURE_PORT=8443                           # SNDC A1 Controller container internal secure port (container -> container)
+export SDNC_DB_APP_NAME="sdnc-db"                               # Name of the SDNC DB container
+export SDNC_A1_TRUSTSTORE_PASSWORD=""                           # SDNC truststore password
+SDNC_USER="admin"                                               # SDNC username
+SDNC_PWD="Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U"          # SNDC PWD
+SDNC_API_URL="/restconf/operations/A1-ADAPTER-API:"             # Base url path for SNDC API
+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 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 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 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
old mode 100755 (executable)
new mode 100644 (file)
index e86f834..293e993
@@ -106,8 +106,8 @@ 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_PORT=8083                                   # ECS container external port (host -> container)
+export ECS_INTERNAL_PORT=8083                                   # 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)
 
@@ -186,4 +186,4 @@ ECS_RESTBASE_SECURE="https://localhost:"$ECS_EXTERNAL_SECURE_PORT # Base url to
 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
+                                                                # The values of this var is swiched between the four base url when needed
index ed02c7b..f8ff19f 100755 (executable)
@@ -61,7 +61,7 @@ fi
 echo -ne $EBOLD
 
 # default test environment variables
-TEST_ENV_VAR_FILE="../common/test_env.sh"
+TEST_ENV_VAR_FILE=""
 
 echo "Test case started as: ${BASH_SOURCE[$i+1]} "$@
 
@@ -215,7 +215,7 @@ while [ $paramerror -eq 0 ] && [ $foundparm -eq 0 ]; do
                        if [ -z "$1" ]; then
                                paramerror=1
                        else
-                               echo "Option set - Overriding test_env.sh with: "$1
+                               echo "Option set - Reading test env from: "$1
                                shift;
                                foundparm=0
                        fi
@@ -259,6 +259,9 @@ if [ -f "$TEST_ENV_VAR_FILE" ]; then
        . $TEST_ENV_VAR_FILE
 else
        echo -e $RED"Selected env var file does not exist: "$TEST_ENV_VAR_FILE$ERED
+       echo " Select one of following env var file matching the intended target of the test"
+       echo " Restart the test using the flag '--env-file <path-to-env-file>"
+       ls ../common/test_env* | indent1
        exit 1
 fi
 
@@ -321,7 +324,7 @@ __check_image_var() {
        tag="${!5}"
 
        if [ -z $image ]; then
-               echo -e $RED"\$"$4" not set in test_env"$ERED
+               echo -e $RED"\$"$4" not set in $TEST_ENV_VAR_FILE"$ERED
                ((IMAGE_ERR++))
                echo ""
                tmp=$tmp"<no-image>\t"
@@ -329,7 +332,7 @@ __check_image_var() {
                tmp=$tmp$image"\t"
        fi
        if [ -z $tag ]; then
-               echo -e $RED"\$"$5" not set in test_env"$ERED
+               echo -e $RED"\$"$5" not set in $TEST_ENV_VAR_FILE"$ERED
                ((IMAGE_ERR++))
                echo ""
                tmp=$tmp"<no-tag>\t"
@@ -464,13 +467,13 @@ if [ -z "$SIM_GROUP" ]; then
        SIM_GROUP=$PWD/../simulator-group
        if [ ! -d  $SIM_GROUP ]; then
                echo "Trying to set env var SIM_GROUP to dir 'simulator-group' in the nontrtric repo, but failed."
-               echo -e $RED"Please set the SIM_GROUP manually in the test_env.sh"$ERED
+               echo -e $RED"Please set the SIM_GROUP manually in the applicable $TEST_ENV_VAR_FILE"$ERED
                exit 1
        else
                echo " SIM_GROUP auto set to: " $SIM_GROUP
        fi
 elif [ $SIM_GROUP = *simulator_group ]; then
-       echo -e $RED"Env var SIM_GROUP does not seem to point to dir 'simulator-group' in the repo, check common/test_env.sh"$ERED
+       echo -e $RED"Env var SIM_GROUP does not seem to point to dir 'simulator-group' in the repo, check $TEST_ENV_VAR_FILE"$ERED
        exit 1
 else
        echo " SIM_GROUP env var already set to: " $SIM_GROUP
@@ -1765,7 +1768,11 @@ use_agent_dmaap_https() {
 # (Function for test scripts)
 set_agent_debug() {
        echo -e $BOLD"Setting agent debug"$EBOLD
-       curlString="$LOCALHOST$POLICY_AGENT_EXTERNAL_PORT/actuator/loggers/org.oransc.policyagent -X POST  -H Content-Type:application/json -d {\"configuredLevel\":\"debug\"}"
+       actuator="/actuator/loggers/org.oransc.policyagent"
+       if [[ $POLICY_AGENT_IMAGE = *"onap"* ]]; then
+               actuator="/actuator/loggers/org.onap.ccsdk.oran.a1policymanagementservice"
+       fi
+       curlString="$LOCALHOST$POLICY_AGENT_EXTERNAL_PORT$actuator -X POST  -H Content-Type:application/json -d {\"configuredLevel\":\"debug\"}"
        result=$(__do_curl "$curlString")
        if [ $? -ne 0 ]; then
                __print_err "could not set debug mode" $@
@@ -1781,7 +1788,11 @@ set_agent_debug() {
 # (Function for test scripts)
 set_agent_trace() {
        echo -e $BOLD"Setting agent trace"$EBOLD
-       curlString="$LOCALHOST$POLICY_AGENT_EXTERNAL_PORT/actuator/loggers/org.oransc.policyagent -X POST  -H Content-Type:application/json -d {\"configuredLevel\":\"trace\"}"
+       actuator="/actuator/loggers/org.oransc.policyagent"
+       if [[ $POLICY_AGENT_IMAGE = *"onap"* ]]; then
+               actuator="/actuator/loggers/org.onap.ccsdk.oran.a1policymanagementservice"
+       fi
+       curlString="$LOCALHOST$POLICY_AGENT_EXTERNAL_PORT$actuator -X POST  -H Content-Type:application/json -d {\"configuredLevel\":\"trace\"}"
        result=$(__do_curl "$curlString")
        if [ $? -ne 0 ]; then
                __print_err "could not set trace mode" $@
@@ -2031,6 +2042,11 @@ store_logs() {
                done
        fi
 
+       __check_included_image 'PRODSTUB'
+       if [ $? -eq 0 ]; then
+               docker logs $PROD_STUB_APP_NAME > $TESTLOGS/$ATC/$1_prodstub.log 2>&1
+       fi
+
        echo ""
 }
 
index e7262e4..3f000c7 100755 (executable)
@@ -33,7 +33,7 @@ clean_docker(){
 # Run auto-test scripts
 cd ../auto-test/
 clean_docker
-bash FTC10.sh remote auto-clean --use-local-image PA SDNC
+bash FTC10.sh remote auto-clean --env-file ../common/test_env-oran-master.sh --use-local-image PA SDNC
 
 echo "--> run_integration.sh END"
 
index 4aa3a7a..ab11497 100644 (file)
@@ -1,2 +1,3 @@
+.p.json
 .tmp.json
-.dockererr
\ No newline at end of file
+.dockererr
index c21a7ab..df4898d 100644 (file)
 from flask import Flask
 from flask import request
 
+import requests
+
 import json
 from jsonschema import validate
 
+import threading
+import time
+import datetime
+
 app = Flask(__name__)
 
 # # list of callback messages
@@ -44,7 +50,6 @@ ARM_CREATE_RESPONSE="/arm/create/<string:producer_id>/<string:job_id>"
 ARM_DELETE_RESPONSE="/arm/delete/<string:producer_id>/<string:job_id>"
 ARM_SUPERVISION_RESPONSE="/arm/supervision/<string:producer_id>"
 ARM_TYPE="/arm/type/<string:producer_id>/<string:type_id>"
-
 COUNTER_SUPERVISION="/counter/supervision/<string:producer_id>"
 COUNTER_CREATE="/counter/create/<string:producer_id>/<string:job_id>"
 COUNTER_DELETE="/counter/delete/<string:producer_id>/<string:job_id>"
@@ -62,6 +67,8 @@ PRODUCER_OR_JOB_NOT_FOUND="producer or job not found"
 PRODUCER_NOT_FOUND="producer not found"
 TYPE_NOT_FOUND="type not found"
 TYPE_IN_USE="type is in use in a job"
+JOB_NOT_FOUND="job not found"
+JOB_DATA_NOT_FOUND="job data not found"
 JSON_CORRUPT="json in request is corrupt or missing"
 
 #Producer and job db, including armed responses
@@ -72,6 +79,7 @@ db={}
 #  supervision counter
 #  job
 #    job json
+#    target_type
 #    armed response for create
 #    armed response for delete
 #    create counter
@@ -109,6 +117,8 @@ def setup_callback_dict(producer_id, job_id):
         job_dict['json']=None
         job_dict['create_counter']=0
         job_dict['delete_counter']=0
+        job_dict['delivering']=False
+        job_dict['delivery_attempts']=0
     return job_dict
 
 
@@ -121,6 +131,9 @@ def get_callback_dict(producer_id, job_id):
     if (producer_id in db.keys()):
         producer_dict=db[producer_id]
 
+    if (producer_dict is None):
+        return None
+
     if (job_id is None):
         return producer_dict
 
@@ -141,6 +154,17 @@ def recursive_search(s_dict, s_key, s_id):
 
     return False
 
+# Helper function to find all job dicts
+def get_all_jobs():
+    job_dicts={}
+    for producer_key in db:
+        producer_dict = db[producer_key]
+        for job_key in producer_dict:
+            job_dict = producer_dict[job_key]
+            if (isinstance(job_dict, dict)):
+                job_dicts[job_key]=job_dict
+    return job_dicts
+
 # I'm alive function
 # response: always 200
 @app.route('/',
@@ -150,7 +174,7 @@ def index():
 
 # Arm the create callback with a response code
 # Omitting the query parameter switch to response back to the standard 200/201 response
-# URI and parameters (PUT): /arm/create/<producer_id>/<job-id>[?response=<resonsecode>]
+# URI and parameters (PUT): /arm/create/<producer_id>/<job_id>[?response=<resonsecode>]
 # Setting
 # response: 200 (400 if incorrect query params)
 @app.route(ARM_CREATE_RESPONSE,
@@ -166,6 +190,7 @@ def arm_create(producer_id, job_id):
         if (len(request.args) != 1):
             return UNKNOWN_QUERY_PARAMETERS,400
 
+
     print("Arm create received for producer: "+str(producer_id)+" and job: "+str(job_id)+" and response: "+str(arm_response))
 
     job_dict=setup_callback_dict(producer_id, job_id)
@@ -176,7 +201,7 @@ def arm_create(producer_id, job_id):
         else:
             job_dict['create_response']=200
     else:
-        job_dict['create_response']=arm_response
+        job_dict['create_response']=int(arm_response)
 
     return "",200
 
@@ -209,7 +234,7 @@ def arm_delete(producer_id, job_id):
         else:
             job_dict['delete_response']=204
     else:
-        job_dict['delete_response']=arm_response
+        job_dict['delete_response']=int(arm_response)
 
     return "",200
 
@@ -236,7 +261,7 @@ def arm_supervision(producer_id):
     if (arm_response is None):
         producer_dict['supervision_response']=200
     else:
-        producer_dict['supervision_response']=arm_response
+        producer_dict['supervision_response']=int(arm_response)
 
     return "",200
 
@@ -282,6 +307,7 @@ def disarm_type(producer_id, type_id):
 
     return "",200
 
+
 # Callback for create job
 # URI and parameters (POST): /callbacks/create/<producer_id>
 # response 201 at create, 200 at update or other configured response code
@@ -304,7 +330,7 @@ def callback_create(producer_id):
     type_list=producer_dict['types']
     type_id=req_json_dict['ei_type_identity']
     if (type_id not in type_list):
-        return TYPE_NOT_FOUND
+        return TYPE_NOT_FOUND, 400
 
     job_id=req_json_dict['ei_job_identity']
     job_dict=get_callback_dict(producer_id, job_id)
@@ -317,6 +343,7 @@ def callback_create(producer_id):
         return_code=job_dict['create_response']
         if ((job_dict['create_response'] == 200) or (job_dict['create_response'] == 201)):
             job_dict['json']=req_json_dict
+            job_dict['delivering']=True
             if (job_dict['create_response'] == 201): #Set up next response code if create was ok
                 job_dict['create_response'] = 200
             if (job_dict['delete_response'] == 404):
@@ -328,7 +355,7 @@ def callback_create(producer_id):
     else:
         return JOBID_NO_MATCH, 400
 
-    return return_msg,return_code
+    return return_msg, return_code
 
 # Callback for delete job
 # URI and parameters (POST): /callbacks/delete/<producer_id>
@@ -358,6 +385,7 @@ def callback_delete(producer_id):
         if (job_dict['delete_response'] == 204):
             job_dict['json']=None
             job_dict['delete_response']=404
+            job_dict['delivering']=False
             if (job_dict['create_response'] == 200):
                 job_dict['create_response'] = 201 # reset create response if delete was ok
         else:
@@ -390,7 +418,7 @@ def callback_supervision(producer_id):
 
     return return_msg,producer_dict['supervision_response']
 
-# Callback for supervision of producer
+# Get the job definition for a job
 # URI and parameters (GET): "/jobdata/<string:producer_id>/<string:job_id>"
 # response: 200 or 204
 @app.route(JOB_DATA,
@@ -399,12 +427,49 @@ def get_jobdata(producer_id, job_id):
 
     print("Get job data received for producer: "+str(producer_id)+" and job: "+str(job_id))
 
-    job_dict=setup_callback_dict(producer_id, job_id)
+    job_dict=get_callback_dict(producer_id, job_id)
+
+    if (job_dict is None):
+        return PRODUCER_OR_JOB_NOT_FOUND,400
+
     if (job_dict['json'] is None):
         return "",204
     else:
         return json.dumps(job_dict['json']), 200
 
+# Start data delivery for a job, action : START or STOP
+# URI and parameters (POST): "/jobdata/<string:producer_id>/<string:job_id>?action=action"
+# response: 200 or 204
+@app.route(JOB_DATA,
+     methods=['POST'])
+def start_jobdata(producer_id, job_id):
+
+    action=request.args.get('action')
+
+    if (action is None):
+        return UNKNOWN_QUERY_PARAMETERS,400
+    else:
+        if (len(request.args) != 1):
+            return UNKNOWN_QUERY_PARAMETERS,400
+        else:
+            if ((action != "START") and (action != "STOP")):
+                return UNKNOWN_QUERY_PARAMETERS,400
+
+    print("Job data action received for producer: "+str(producer_id)+" and job: "+str(job_id) + " action: " + action)
+
+    job_dict=get_callback_dict(producer_id, job_id)
+    if (job_dict is None):
+        return JOB_NOT_FOUND,404
+
+    if (job_dict['json'] is None):
+        return JOB_DATA_NOT_FOUND, 400
+    else:
+        if (action == "START"):
+            job_dict['delivering']=True
+        else:
+            job_dict['delivering']=False
+        return "",200
+
 
 # Counter for create calls for a job
 # URI and parameters (GET): "/counter/create/<string:producer_id>/<string:job_id>"
@@ -414,7 +479,7 @@ def get_jobdata(producer_id, job_id):
 def counter_create(producer_id, job_id):
     job_dict=get_callback_dict(producer_id, job_id)
     if (job_dict is None):
-        return -1,200
+        return "-1",200
     return str(job_dict['create_counter']),200
 
 # Counter for delete calls for a job
@@ -425,7 +490,7 @@ def counter_create(producer_id, job_id):
 def counter_delete(producer_id, job_id):
     job_dict=get_callback_dict(producer_id, job_id)
     if (job_dict is None):
-        return -1,200
+        return "-1",200
     return str(job_dict['delete_counter']),200
 
 # Counter for supervision calls for a producer
@@ -436,7 +501,7 @@ def counter_delete(producer_id, job_id):
 def counter_supervision(producer_id):
     producer_dict=get_callback_dict(producer_id, None)
     if (producer_dict is None):
-        return -1,200
+        return "-1",200
     return str(producer_dict['supervision_counter']),200
 
 # Get status info
@@ -457,7 +522,36 @@ def reset():
     db={}
     return "",200
 
+
+def datadelivery() :
+    while True:
+        try:
+            job_dicts=get_all_jobs()
+            for key in job_dicts:
+                job=job_dicts[key]
+                if (job['delivering'] == True and job['json'] != None):
+                    url=job['json']['target_uri']
+
+                    data={}
+                    data["date"]=str(datetime.datetime.now())
+                    data["job"]=""+key
+                    data["sequence_no"]=""+str(job['delivery_attempts'])
+                    data["value"]=str(100)
+                    print("Sending "+json.dumps(data))
+
+                    requests.post(url, json=data, verify=False, timeout=2) #NOSONAR
+                    job['delivery_attempts'] += 1
+        except Exception as err:
+            print("Error during data delivery: "+ str(err))
+        time.sleep(1)
+
+
 ### Main function ###
 
+print("Starting data delivery thread")
+thread = threading.Thread(target=datadelivery, args=())
+thread.daemon = True
+thread.start()
+
 if __name__ == "__main__":
     app.run(port=HOST_PORT, host=HOST_IP)
index cc0dabf..d33cdac 100644 (file)
@@ -1,3 +1,3 @@
 Flask==1.1.1
 jsonschema==3.2.0
-
+requests==2.24.0
index c0af24e..a17c804 100755 (executable)
@@ -30,12 +30,12 @@ fi
 
 if [ $1 == "nonsecure" ]; then
     #Default http port for the simulator
-    PORT=8092
+    PORT=8992
     # Set http protocol
     HTTPX="http"
 else
     #Default https port for the simulator
-    PORT=8093
+    PORT=8993
     # Set https protocol
     HTTPX="https"
 fi
@@ -43,11 +43,229 @@ fi
 # source function to do curl and check result
 . ../common/do_curl_function.sh
 
-echo "===  hello world ==="
+echo "=== hello world ==="
 RESULT="OK"
 do_curl GET / 200
 
+echo "=== reset ==="
+RESULT=""
+do_curl GET /reset 200
 
+echo "=== status ==="
+RESULT="json:{}"
+do_curl GET /status 200
+
+# Basic admin
+
+echo "===  check supervision counter ==="
+RESULT="-1"
+do_curl GET /counter/supervision/prod-x 200
+
+echo "===  check create counter ==="
+RESULT="-1"
+do_curl GET /counter/create/prod-x/job-x 200
+
+echo "===  check delete counter ==="
+RESULT="-1"
+do_curl GET /counter/delete/prod-x/job-x 200
+
+## Create/update a producer
+
+echo "===  create producer ==="
+RESULT="Unknown query parameter(s)"
+do_curl PUT /arm/supervision/prod-x?test=201 400
+
+echo "===  create producer ==="
+RESULT=""
+do_curl PUT /arm/supervision/prod-x?response=201 200
+
+echo "===  update producer ==="
+RESULT=""
+do_curl PUT /arm/supervision/prod-x?response=400 200
+
+echo "===  update producer ==="
+RESULT=""
+do_curl PUT /arm/supervision/prod-x 200
+
+## Add types to a producere
+
+echo "===  add type 10 ==="
+RESULT=""
+do_curl PUT /arm/type/prod-x/10 200
+
+echo "===  add type 15 ==="
+RESULT=""
+do_curl PUT /arm/type/prod-x/15 200
+
+## check the db
+
+echo "=== status ==="
+RESULT="json:{\"prod-x\": {\"supervision_response\": 200, \"supervision_counter\": 0, \"types\": [\"10\", \"15\"]}}"
+do_curl GET /status 200
+
+## Add type
+echo "===  add type 20 ==="
+RESULT=""
+do_curl PUT /arm/type/prod-x/20 200
+
+echo "=== status ==="
+RESULT="json:{\"prod-x\": {\"supervision_response\": 200, \"supervision_counter\": 0, \"types\": [\"10\", \"15\", \"20\"]}}"
+do_curl GET /status 200
+
+## remove type
+echo "===  remove type 20 ==="
+RESULT=""
+do_curl DELETE /arm/type/prod-x/20 200
+
+echo "=== status ==="
+RESULT="json:{\"prod-x\": {\"supervision_response\": 200, \"supervision_counter\": 0, \"types\": [\"10\", \"15\"]}}"
+do_curl GET /status 200
+
+## producer supervision
+echo "===  check supervision counter ==="
+RESULT="0"
+do_curl GET /counter/supervision/prod-x 200
+
+echo "===  supervision producer ==="
+RESULT=""
+do_curl GET /callbacks/supervision/prod-x 200
+
+echo "===  update producer ==="
+RESULT=""
+do_curl PUT /arm/supervision/prod-x?response=400 200
+
+echo "===  callback supervision producer ==="
+RESULT="returning configured response code"
+do_curl GET /callbacks/supervision/prod-x 400
+
+## check the db
+
+echo "=== status ==="
+RESULT="json:{\"prod-x\": {\"supervision_response\": 400, \"supervision_counter\": 2, \"types\": [\"10\", \"15\"]}}"
+do_curl GET /status 200
+
+## create/update job
+
+echo "===  add job ==="
+RESULT=""
+do_curl PUT /arm/create/prod-x/job-y 200
+
+echo "===  update job ==="
+RESULT=""
+do_curl PUT /arm/create/prod-x/job-y?response=405 200
+
+## check the db
+
+echo "=== status ==="
+RESULT="json:{\"prod-x\": {\"supervision_response\": 400, \"supervision_counter\": 2, \"types\": [\"10\", \"15\"], \"job-y\": {\"create_response\": 405, \"delete_response\": 404, \"json\": null, \"create_counter\": 0, \"delete_counter\": 0, \"delivering\": false, \"delivery_attempts\": 0}}}"
+do_curl GET /status 200
+
+## add delete response for job
+
+echo "===  update job ==="
+RESULT=""
+do_curl PUT /arm/delete/prod-x/job-y?response=407 200
+
+## check the db
+
+echo "=== status ==="
+RESULT="json:{\"prod-x\": {\"supervision_response\": 400, \"supervision_counter\": 2, \"types\": [\"10\", \"15\"], \"job-y\": {\"create_response\": 405, \"delete_response\": 407, \"json\": null, \"create_counter\": 0, \"delete_counter\": 0, \"delivering\": false, \"delivery_attempts\": 0}}}"
+do_curl GET /status 200
+
+## Get jobdata
+echo "=== job data ==="
+RESULT=""
+do_curl GET /jobdata/prod-x/job-y 204
+
+##  callback create
+
+echo "===  add job ==="
+RESULT=""
+do_curl PUT /arm/create/prod-x/job-1 200
+RESULT=""
+do_curl PUT /arm/delete/prod-x/job-1 200
+
+echo "===  callback create job ==="
+RESULT=""
+echo "{\"ei_job_identity\": \"job-1\", \"ei_job_data\": {}, \"target_uri\": \"http://localhost:80\",\"ei_type_identity\": \"10\"}" > .p.json
+do_curl POST /callbacks/create/prod-x 201 .p.json
+
+echo "===  callback create job -update ==="
+RESULT=""
+echo "{\"ei_job_identity\": \"job-1\", \"ei_job_data\": {}, \"target_uri\": \"http://localhost:80\",\"ei_type_identity\": \"10\"}" > .p.json
+do_curl POST /callbacks/create/prod-x 200 .p.json
+
+## Get jobdata
+echo "=== job data ==="
+RESULT="json:{\"ei_job_identity\": \"job-1\", \"ei_job_data\": {}, \"target_uri\": \"http://localhost:80\", \"ei_type_identity\": \"10\"}"
+do_curl GET /jobdata/prod-x/job-1 200
+
+## check the db
+
+echo "=== status ==="
+RESULT="json:{\"prod-x\": {\"supervision_response\": 400, \"supervision_counter\": 2, \"types\": [\"10\", \"15\"], \"job-y\": {\"create_response\": 405, \"delete_response\": 407, \"json\": null, \"create_counter\": 0, \"delete_counter\": 0, \"delivering\": false, \"delivery_attempts\": 0}, \"job-1\": {\"create_response\": 200, \"delete_response\": 204, \"json\": {\"ei_job_identity\": \"job-1\", \"ei_job_data\": {}, \"target_uri\": \"http://localhost:80\", \"ei_type_identity\": \"10\"}, \"create_counter\": 2, \"delete_counter\": 0, \"delivering\": false, \"delivery_attempts\": 0}}}"
+do_curl GET /status 200
+
+# create and delete job tests
+echo "===  set job create response ==="
+RESULT=""
+do_curl PUT /arm/create/prod-x/job-1?response=404 200
+
+echo "===  callback create job -update ==="
+RESULT="returning configured response code"
+echo "{\"ei_job_identity\": \"job-1\", \"ei_job_data\": {}, \"target_uri\": \"http://localhost:80\",\"ei_type_identity\": \"10\"}" > .p.json
+do_curl POST /callbacks/create/prod-x 404 .p.json
+
+echo "===  set job delete response ==="
+RESULT=""
+do_curl PUT /arm/delete/prod-x/job-1?response=404 200
+
+echo "===  callback delete job==="
+RESULT="returning configured response code"
+echo "{\"ei_job_identity\": \"job-1\", \"ei_job_data\": {}, \"target_uri\": \"http://localhost:80\",\"ei_type_identity\": \"10\"}" > .p.json
+do_curl POST /callbacks/delete/prod-x 404 .p.json
+
+echo "===  set job delete response ==="
+RESULT=""
+do_curl PUT /arm/delete/prod-x/job-1 200
+
+echo "===  callback delete job==="
+RESULT=""
+echo "{\"ei_job_identity\": \"job-1\", \"ei_job_data\": {}, \"target_uri\": \"http://localhost:80\",\"ei_type_identity\": \"10\"}" > .p.json
+do_curl POST /callbacks/delete/prod-x 204 .p.json
+
+## check the db
+
+echo "=== status ==="
+RESULT="json:{\"prod-x\": {\"supervision_response\": 400, \"supervision_counter\": 2, \"types\": [\"10\", \"15\"], \"job-y\": {\"create_response\": 405, \"delete_response\": 407, \"json\": null, \"create_counter\": 0, \"delete_counter\": 0, \"delivering\": false, \"delivery_attempts\": 0}, \"job-1\": {\"create_response\": 404, \"delete_response\": 404, \"json\": null, \"create_counter\": 3, \"delete_counter\": 2, \"delivering\": false, \"delivery_attempts\": 0}}}"
+do_curl GET /status 200
+
+
+##  data delivery
+
+echo "===  update producer ==="
+RESULT=""
+do_curl PUT /arm/create/prod-x/job-1 200
+
+echo "===  callback create job ==="
+RESULT=""
+echo "{\"ei_job_identity\": \"job-1\", \"ei_job_data\": {}, \"target_uri\": \"http://localhost:80\",\"ei_type_identity\": \"10\"}" > .p.json
+do_curl POST /callbacks/create/prod-x 201 .p.json
+
+echo "=== data delivery start ==="
+RESULT="job not found"
+do_curl POST /jobdata/prod-x/job-x?action=START 404
+
+echo "=== data delivery start ==="
+RESULT=""
+do_curl POST /jobdata/prod-x/job-1?action=START 200
+
+echo "sleep 5"
+sleep 5
+
+echo "=== data delivery stop ==="
+RESULT=""
+do_curl POST /jobdata/prod-x/job-1?action=STOP 200
 
 echo "********************"
 echo "*** All tests ok ***"
index 7f111b6..b16e613 100755 (executable)
 
 #Builds the producer stub container and starts it in interactive mode
 
-docker build -t producer-stub .
+NAME="producer-stub-test"
+IMAGE_NAME="producer-stub-test-image"
 
-docker run -it -p 8092:8092 -p 8093:8093 --name producer-stub producer-stub
+docker build -t $IMAGE_NAME .
+
+docker stop $NAME
+docker rm -f $NAME
+docker run -it -p 8992:8092 -p 8993:8093 --name $NAME $IMAGE_NAME
index 17d3205..b746ae5 100644 (file)
@@ -24,6 +24,9 @@ var LOCALHOST="http://127.0.0.1:"
 var MRSTUB_PORT="3905"
 var AGENT_PORT="8081"
 var CR_PORT="8090"
+var ECS_PORT="8083"
+var PRODSTUB_PORT="8092"
+
 var http = require('http');
 
 var express = require('express');
@@ -37,11 +40,10 @@ app.get("/",function(req, res){
        res.send("ok");
 })
 
-//Get parameter valuue from other server
+//Get parameter value from other server
 function getSimCtr(url, index, cb) {
     var data = '';
 
-    //console.log("URL: "+ url + " - ")
     try {
         http.get(url, (resp) => {
             // A chunk of data has been recieved.
@@ -162,6 +164,7 @@ var ag1=""
 var ag2=""
 var ag3=""
 var ag4=""
+var ag5=""
 
 //Status variables for callback receiver
 var cr1=""
@@ -179,21 +182,42 @@ var simvar2=[]
 var simvar3=[]
 var simvar4=[]
 var simvar5=[]
+var simvar6=[]
+
+//Status variables, for parameters values fetched from ecs
+var ecs1="", ecs2="", ecs3="", ecs4="", ecs_types="-", ecs_producers="-";
+var ecs_producer_arr=new Array(0)
+var ecs_producer_type_arr=new Array(0)
+var ecs_producer_jobs_arr=new Array(0)
+var ecs_producer_status_arr=new Array(0)
+
+//Status variables, for parameters values fetched from prodstub
+var ps2="", ps3="", ps4="", ps_types="-", ps_producers="-";
+var ps_producer_type_arr=new Array(0)
+var ps_producer_jobs_arr=new Array(0)
+var ps_producer_delivery_arr=new Array(0)
 
 //Counts the number of get request for the html page
 var getCtr=0
 
-var refreshInterval=4000
+var refreshCount_pol=-1
+
+var refreshCount_ecs=-1
 
 var ricbasename="ricsim"
 
-function fetchAllMetrics() {
+function fetchAllMetrics_pol() {
+
+    console.log("Fetching policy metrics " + refreshCount_pol)
+
+    if (refreshCount_pol < 0) {
+        refreshCount_pol = -1
+        return
+    } else {
+        refreshCount_pol = refreshCount_pol - 1
+    }
     setTimeout(() => {
 
-        console.log("Fetching all metics data")
-        if (refreshInterval < 20000) {
-            refreshInterval+=100
-        }
         if (getCtr%3 == 0) {
             //Extract the port numbers from the running simulators, for every 3 calls
             const { exec } = require('child_process');
@@ -250,6 +274,12 @@ function fetchAllMetrics() {
                     clearFlag("simvar5_"+index)
                 });
             }
+            if (checkFunctionFlag("simvar6_"+index)) {
+                getSimCtr(LOCALHOST+simports[index]+"/counter/datadelivery", index, function(data,index) {
+                    simvar6[index] = data;
+                    clearFlag("simvar6_"+index)
+                });
+            }
         }
 
         //MR - get metrics values from the MR stub
@@ -352,9 +382,9 @@ function fetchAllMetrics() {
                 clearFlag("ag3")
             });
         }
+
         if (checkFunctionFlag("ag4")) {
             getSimCtr(LOCALHOST+AGENT_PORT+"/policy_ids", 0, function(data, index) {
-                ag4=""
                 try {
                     var jd=JSON.parse(data);
                     ag4=""+jd.length
@@ -366,19 +396,349 @@ function fetchAllMetrics() {
             });
         }
 
+        if (checkFunctionFlag("ag5")) {
+            getSimCtr(LOCALHOST+AGENT_PORT+"/rics", 0, function(data, index) {
+                try {
+                    var jd=JSON.parse(data);
+                    ag5=""+jd.length
+                }
+                catch (err) {
+                    ag5=""
+                }
+                clearFlag("ag5")
+            });
+        }
+
+        fetchAllMetrics_pol();
 
-        fetchAllMetrics();
-    }, refreshInterval)
+    }, 500)
 }
 
-fetchAllMetrics();
+function fetchAllMetrics_ecs() {
+
+    console.log("Fetching enrichment metrics - timer:" + refreshCount_ecs)
+
+    if (refreshCount_ecs < 0) {
+        refreshCount_ecs = -1
+        return
+    } else {
+        refreshCount_ecs = refreshCount_ecs - 1
+    }
+    setTimeout(() => {
+
+        if (checkFunctionFlag("ecs_stat")) {
+            getSimCtr(LOCALHOST+ECS_PORT+"/status", 0, function(data, index) {
+                ecs1=""
+                ecs2=""
+                ecs3=""
+                ecs4=""
+                try {
+                    var jd=JSON.parse(data);
+                    ecs1=jd["status"]
+                    ecs2=""+jd["no_of_producers"]
+                    ecs3=""+jd["no_of_types"]
+                    ecs4=""+jd["no_of_jobs"]
+                }
+                catch (err) {
+                    ecs1="error response"
+                    ecs2="error response"
+                    ecs3="error response"
+                    ecs4="error response"
+                }
+            });
+
+            getSimCtr(LOCALHOST+ECS_PORT+"/ei-producer/v1/eitypes", 0, function(data, index) {
+                ecs_types="-"
+                try {
+                    var jd=JSON.parse(data);
+                    for(var i=0;i<jd.length;i++) {
+                        if (ecs_types.length == 1) {
+                            ecs_types=""
+                        }
+                        ecs_types=""+ecs_types+jd[i]+" "
+                    }
+                }
+                catch (err) {
+                    ecs_types="error response"
+                }
+            });
+
+            getSimCtr(LOCALHOST+ECS_PORT+"/ei-producer/v1/eiproducers", 0, function(data, index) {
+                ecs_producers="-"
+                try {
+                    var jd=JSON.parse(data);
+                    var tmp_ecs_producer_arr=new Array(jd.length)
+                    for(var i=0;i<jd.length;i++) {
+                        if (ecs_producers.length == 1) {
+                            ecs_producers=""
+                        }
+                        ecs_producers=""+ecs_producers+jd[i]+" "
+                        tmp_ecs_producer_arr[i]=jd[i]
+                    }
+                    ecs_producer_arr = tmp_ecs_producer_arr
+                }
+                catch (err) {
+                    ecs_producers="error response"
+                    ecs_producer_arr=new Array(0)
+                }
+            });
+
+            ecs_producer_type_arr = JSON.parse(JSON.stringify(ecs_producer_arr))
+            for(var x=0;x<ecs_producer_type_arr.length;x++) {
+                getSimCtr(LOCALHOST+ECS_PORT+"/ei-producer/v1/eiproducers/"+ecs_producer_type_arr[x], x, function(data, x) {
+                    var row=""+ecs_producer_type_arr[x]+" : "
+                    try {
+                        var jd=JSON.parse(data);
+                        var jda=jd["supported_ei_types"]
+                        for(var j=0;j<jda.length;j++) {
+                            row=""+row+jda[j]["ei_type_identity"]+" "
+                        }
+                        ecs_producer_type_arr[x]=row
+                    }
+                    catch (err) {
+                        ecs_producer_type_arr=new Array(0)
+                    }
+                });
+            }
 
-setInterval(() => {
-    console.log("Setting interval "+refreshInterval+"ms")
-}, refreshInterval)
+            ecs_producer_jobs_arr = JSON.parse(JSON.stringify(ecs_producer_arr))
+            for(var x=0;x<ecs_producer_jobs_arr.length;x++) {
+                getSimCtr(LOCALHOST+ECS_PORT+"/ei-producer/v1/eiproducers/"+ecs_producer_jobs_arr[x]+"/eijobs", x, function(data, x) {
+                    var row=""+ecs_producer_jobs_arr[x]+" : "
+                    try {
+                        var jd=JSON.parse(data);
+                        for(var j=0;j<jd.length;j++) {
+                            var jda=jd[j]
+                            row=""+row+jda["ei_job_identity"]+"("+jda["ei_type_identity"]+") "
+                        }
+                        ecs_producer_jobs_arr[x]=row
+                    }
+                    catch (err) {
+                        ecs_producer_jobs_arr=new Array(0)
+                    }
+                });
+            }
 
+            ecs_producer_status_arr = JSON.parse(JSON.stringify(ecs_producer_arr))
+            for(var x=0;x<ecs_producer_status_arr.length;x++) {
+                getSimCtr(LOCALHOST+ECS_PORT+"/ei-producer/v1/eiproducers/"+ecs_producer_status_arr[x]+"/status", x, function(data, x) {
+                    var row=""+ecs_producer_status_arr[x]+" : "
+                    try {
+                        var jd=JSON.parse(data);
+                        row=""+row+jd["operational_state"]
+                        ecs_producer_status_arr[x]=row
+                    }
+                    catch (err) {
+                        ecs_producer_status_arr=new Array(0)
+                    }
+                });
+            }
+            clearFlag("ecs_stat")
+        }
+        if (checkFunctionFlag("prodstub_stat")) {
+            getSimCtr(LOCALHOST+PRODSTUB_PORT+"/status", x, function(data, x) {
+                var ctr2_map=new Map()
+                var ctr3_map=new Map()
+                var ctr2=0
+                var ctr4=0
+                ps_producers=""
+                ps_types=""
+                ps_producer_type_arr=new Array()
+                ps_producer_jobs_arr=new Array()
+                ps_producer_delivery_arr=new Array()
+                ps2=""
+                ps3=""
+                ps4=""
+                try {
+                    var jp=JSON.parse(data);
+                    for(var prod_name in jp) {
+                        ctr2_map.set(prod_name, prod_name)
+                        ctr2 += 1
+                        var jj=jp[prod_name]
+                        var row=""+prod_name+" : "
+                        var rowj=""+prod_name+" : "
+                        var rowd=""+prod_name+" : "
+                        ps_producers += prod_name + " "
+                        for(var ji in jj) {
+                            if (ji == "types") {
+                                var ta=jj[ji]
+                                for(var i=0;i<ta.length;i++) {
+                                    ctr3_map.set(ta[i], ta[i])
+                                    row += " "+ta[i]
+                                }
+                            } else if (ji == "supervision_response") {
+                            } else if (ji == "supervision_counter") {
+                            } else if (ji == "types") {
+                            } else {
+                                ctr4 += 1
+                                rowj += " "+ji
+                                rowd += " "+ji
+                                var job_data=jj[ji]["json"]
+                                if (job_data != undefined) {
+                                    rowj += "("+job_data["ei_type_identity"]+")"
+                                }
+                                rowd += "("+jj[ji]["delivery_attempts"]+")"
+                            }
+                        }
+                        ps_producer_type_arr[(ctr2-1)]=row
+                        ps_producer_jobs_arr[(ctr2-1)]=rowj
+                        ps_producer_delivery_arr[(ctr2-1)]=rowd
+                    }
+                    ps2=""+ctr2_map.size
+                    ps3=""+ctr3_map.size
+                    for(const [key, value] of ctr3_map.entries()) {
+                        ps_types += key + " "
+                    }
+                    ps4=""+ctr4
+                }
+                catch (err) {
+                    console.error(err);
+                    ps_producers="error response"
+                    ps_types="error response"
+                    ps_producer_type_arr=new Array()
+                    ps_producer_jobs_arr=new Array()
+                    ps_producer_delivery_arr=new Array()
+                    ps2="error response"
+                    ps3="error response"
+                    ps4="error response"
+                }
+            });
+            clearFlag("prodstub_stat")
+        }
+
+        fetchAllMetrics_ecs();
+
+    }, 500)
+}
+
+// Monitor for ECS
+app.get("/mon2",function(req, res){
+
+    console.log("Creating enrichment metrics - timer: " + refreshCount_ecs)
+
+    if (refreshCount_ecs < 0) {
+        refreshCount_ecs=5
+        fetchAllMetrics_ecs()
+    }
+    refreshCount_ecs=5
+
+    var summary=req.query.summary
+
+    if (summary == undefined) {
+        return res.redirect('/mon2?summary=false');
+    }
+
+  //Build web page
+       var htmlStr = "<!DOCTYPE html>" +
+          "<html>" +
+          "<head>" +
+            "<meta http-equiv=\"refresh\" content=\"2\">"+  //2 sec auto refresh
+            "<title>Enrichment coordinator service and producer stub</title>"+
+            "</head>" +
+            "<body>" +
+            "<font size=\"-3\" face=\"summary\">"
+            if (summary == "false") {
+                htmlStr=htmlStr+"<p>Set query param '?summary' to true to only show summary statistics</p>"
+            } else {
+                htmlStr=htmlStr+"<p>Set query param '?summary' to false to only show full statistics</p>"
+            }
+            htmlStr=htmlStr+"</font>" +
+            "<h3>Enrichment Coordinator Service</h3>" +
+            "<font face=\"monospace\">" +
+            "Status:..........." + formatDataRow(ecs1) + "<br>" +
+            "Producers:........" + formatDataRow(ecs2) + "<br>" +
+            "Types:............" + formatDataRow(ecs3) + "<br>" +
+            "Jobs:............." + formatDataRow(ecs4) + "<br>" +
+            "</font>"
+            if (summary == "false") {
+                htmlStr=htmlStr+
+                "<h4>Details</h4>" +
+                "<font face=\"monospace\">" +
+                "Producer ids:....." + formatDataRow(ecs_producers) + "<br>" +
+                "Type ids:........." + formatDataRow(ecs_types) + "<br>" +
+                "<br>";
+                for(var i=0;i<ecs_producer_type_arr.length;i++) {
+                    var tmp=ecs_producer_type_arr[i]
+                    if (tmp != undefined) {
+                        var s = "Producer types...." + formatDataRow(ecs_producer_type_arr[i]) + "<br>"
+                        htmlStr=htmlStr+s
+                    }
+                }
+                htmlStr=htmlStr+"<br>";
+                for(var i=0;i<ecs_producer_jobs_arr.length;i++) {
+                    var tmp=ecs_producer_jobs_arr[i]
+                    if (tmp != undefined) {
+                        var s = "Producer jobs....." + formatDataRow(ecs_producer_jobs_arr[i]) + "<br>"
+                        htmlStr=htmlStr+s
+                    }
+                }
+                htmlStr=htmlStr+"<br>";
+                for(var i=0;i<ecs_producer_status_arr.length;i++) {
+                    var tmp=ecs_producer_status_arr[i]
+                    if (tmp != undefined) {
+                        var s = "Producer status..." + formatDataRow(ecs_producer_status_arr[i]) + "<br>"
+                        htmlStr=htmlStr+s
+                    }
+                }
+                htmlStr=htmlStr+"<br>"+"<br>" +
+                "</font>"
+            }
+            htmlStr=htmlStr+
+            "<h3>Producer stub</h3>" +
+            "<font face=\"monospace\">" +
+            "Producers:........" + formatDataRow(ps2) + "<br>" +
+            "Types:............" + formatDataRow(ps3) + "<br>" +
+            "Jobs:............." + formatDataRow(ps4) + "<br>" +
+            "</font>"
+            if (summary == "false") {
+                htmlStr=htmlStr+
+                "<h4>Details</h4>" +
+                "<font face=\"monospace\">" +
+                "Producer ids:....." + formatDataRow(ps_producers) + "<br>" +
+                "Type ids:........." + formatDataRow(ps_types) + "<br>" +
+                "<br>";
+                for(var i=0;i<ps_producer_type_arr.length;i++) {
+                    var tmp=ps_producer_type_arr[i]
+                    if (tmp != undefined) {
+                        var s = "Producer types...." + formatDataRow(ps_producer_type_arr[i]) + "<br>"
+                        htmlStr=htmlStr+s
+                    }
+                }
+                htmlStr=htmlStr+"<br>";
+                for(var i=0;i<ps_producer_jobs_arr.length;i++) {
+                    var tmp=ps_producer_jobs_arr[i]
+                    if (tmp != undefined) {
+                        var s = "Producer jobs....." + formatDataRow(ps_producer_jobs_arr[i]) + "<br>"
+                        htmlStr=htmlStr+s
+                    }
+                }
+                htmlStr=htmlStr+"<br>";
+                for(var i=0;i<ps_producer_delivery_arr.length;i++) {
+                    var tmp=ps_producer_delivery_arr[i]
+                    if (tmp != undefined) {
+                        var s = "Producer delivery." + formatDataRow(ps_producer_delivery_arr[i]) + "<br>"
+                        htmlStr=htmlStr+s
+                    }
+                }
+            }
+            htmlStr=htmlStr+
+            "</font>" +
+           "</body>" +
+          "</html>";
+       res.send(htmlStr);
+})
+
+// Monitor for policy management
 app.get("/mon",function(req, res){
 
+    console.log("Creating policy metrics page " + refreshCount_pol)
+
+    if (refreshCount_pol < 0) {
+        refreshCount_pol=5
+        fetchAllMetrics_pol()
+    }
+    refreshCount_pol=5
+
     var bn=req.query.basename
 
     if (bn == undefined) {
@@ -388,9 +748,7 @@ app.get("/mon",function(req, res){
         ricbasename=bn
     }
 
-    refreshInterval=2000
-
-  //Build web page
+    //Build web page
        var htmlStr = "<!DOCTYPE html>" +
           "<html>" +
           "<head>" +
@@ -407,6 +765,7 @@ app.get("/mon",function(req, res){
             "Services:............................." + formatIdRowCompact(ag2) + "<br>" +
             "Types:................................" + formatIdRowCompact(ag3) + "<br>" +
             "Number of instances:.................." + formatDataRow(ag4) + "<br>" +
+            "Near-RT RICs:........................." + formatDataRow(ag5) + "<br>" +
             "</font>" +
             "<h3>MR Stub interface</h3>" +
             "<font face=\"monospace\">"+
@@ -428,12 +787,14 @@ app.get("/mon",function(req, res){
 
             htmlStr=htmlStr+padding("Near-RT RIC Simulator name", 35,"&nbsp;")
             htmlStr=htmlStr+padding("Types", 10,"&nbsp;")
-            htmlStr=htmlStr+padding("Instances", 10,"&nbsp;")+"<br>"
-            htmlStr=htmlStr+padding("",55,"=")+"<br>"
+            htmlStr=htmlStr+padding("Instances", 12,"&nbsp;")
+            htmlStr=htmlStr+padding("Data delivery", 12,"&nbsp;")+"<br>"
+            htmlStr=htmlStr+padding("",70,"=")+"<br>"
             for(var simIndex=0;simIndex<simnames.length;simIndex++) {
                 htmlStr=htmlStr+padding(simnames[simIndex]+ " ("+simports[simIndex]+")",35,"&nbsp;");
                 htmlStr=htmlStr+padding(simvar2[simIndex],10,"&nbsp;")
-                htmlStr=htmlStr+padding(simvar1[simIndex],10,"&nbsp;")
+                htmlStr=htmlStr+padding(simvar1[simIndex],12    ,"&nbsp;")
+                htmlStr=htmlStr+padding(simvar6[simIndex],12,"&nbsp;")
                 htmlStr=htmlStr+"<br>";
             }
 
@@ -469,4 +830,5 @@ var httpServer = http.createServer(app);
 var httpPort=9999;
 httpServer.listen(httpPort);
 console.log("Simulator monitor listening (http) at "+httpPort);
-console.log("Open the web page on localhost:9999/mon to view the statistics page.")
\ No newline at end of file
+console.log("Open the web page on localhost:9999/mon to view the policy statistics page.")
+console.log("Open the web page on localhost:9999/mon2 to view the enrichment statistics page.")
\ No newline at end of file