From de4d0f86a327469fb64645c2bcd3aeea7832ad25 Mon Sep 17 00:00:00 2001 From: BjornMagnussonXA Date: Sun, 29 Nov 2020 16:04:06 +0100 Subject: [PATCH] Added r-app catalogue to demo test case Change name of the 'oran-master' test profile to 'oran-cherry' No impact to delivered images - this is only function test updates Issue-ID: NONRTRIC-345 Signed-off-by: BjornMagnussonXA Change-Id: I02b0afda5a8deab0637ee80641eff9e46bc828de --- test/auto-test/FTC1.sh | 2 +- test/auto-test/FTC10.sh | 2 +- test/auto-test/FTC100.sh | 2 +- test/auto-test/FTC110.sh | 2 +- test/auto-test/FTC1100.sh | 2 +- test/auto-test/FTC150.sh | 2 +- test/auto-test/FTC1800.sh | 2 +- test/auto-test/FTC300.sh | 2 +- test/auto-test/FTC310.sh | 2 +- test/auto-test/FTC350.sh | 2 +- test/auto-test/FTC800.sh | 2 +- test/auto-test/FTC810.sh | 2 +- test/auto-test/FTC850.sh | 2 +- test/auto-test/FTC900.sh | 2 +- test/auto-test/PM_DEMO.sh | 2 +- test/auto-test/PM_EI_DEMO.sh | 17 +- test/auto-test/README.md | 6 +- test/common/README.md | 84 +++++++++- test/common/api_curl.sh | 7 +- test/common/rapp_catalogue_api_functions.sh | 178 +++++++++++++++++++++ ..._env-oran-master.sh => test_env-oran-cherry.sh} | 29 +++- test/common/testcase_common.sh | 74 ++++++++- test/simulator-group/rapp_catalogue/.gitignore | 2 + .../rapp_catalogue/docker-compose.yml | 34 ++++ test/simulator-group/sim-monitor.js | 52 +++++- 25 files changed, 481 insertions(+), 32 deletions(-) create mode 100644 test/common/rapp_catalogue_api_functions.sh rename test/common/{test_env-oran-master.sh => test_env-oran-cherry.sh} (90%) create mode 100644 test/simulator-group/rapp_catalogue/.gitignore create mode 100644 test/simulator-group/rapp_catalogue/docker-compose.yml diff --git a/test/auto-test/FTC1.sh b/test/auto-test/FTC1.sh index 1fd48e38..144ac364 100755 --- a/test/auto-test/FTC1.sh +++ b/test/auto-test/FTC1.sh @@ -24,7 +24,7 @@ TC_ONELINE_DESCR="Sanity test, create service and then create,update and delete INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC" #SUPPORTED TEST ENV FILE -SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-MASTER" +SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-CHERRY" . ../common/testcase_common.sh $@ . ../common/agent_api_functions.sh diff --git a/test/auto-test/FTC10.sh b/test/auto-test/FTC10.sh index e0d6ecb1..ca545b2e 100755 --- a/test/auto-test/FTC10.sh +++ b/test/auto-test/FTC10.sh @@ -23,7 +23,7 @@ TC_ONELINE_DESCR="Basic use case, register service, create/update policy, delete INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM" #SUPPORTED TEST ENV FILE -SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-MASTER" +SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-CHERRY" . ../common/testcase_common.sh $@ . ../common/agent_api_functions.sh diff --git a/test/auto-test/FTC100.sh b/test/auto-test/FTC100.sh index e3570414..4b2e1629 100755 --- a/test/auto-test/FTC100.sh +++ b/test/auto-test/FTC100.sh @@ -25,7 +25,7 @@ INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC" #SUPPORTED TEST ENV FILE -SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-MASTER" +SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-CHERRY" . ../common/testcase_common.sh $@ . ../common/agent_api_functions.sh diff --git a/test/auto-test/FTC110.sh b/test/auto-test/FTC110.sh index 6171ec38..0406c405 100755 --- a/test/auto-test/FTC110.sh +++ b/test/auto-test/FTC110.sh @@ -24,7 +24,7 @@ TC_ONELINE_DESCR="Testing of service registration timeouts and keepalive" INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM" #SUPPORTED TEST ENV FILE -SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-MASTER" +SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-CHERRY" . ../common/testcase_common.sh $@ . ../common/agent_api_functions.sh diff --git a/test/auto-test/FTC1100.sh b/test/auto-test/FTC1100.sh index 266b3b50..9921108f 100755 --- a/test/auto-test/FTC1100.sh +++ b/test/auto-test/FTC1100.sh @@ -24,7 +24,7 @@ TC_ONELINE_DESCR="ECS full intefaces walkthrough" INCLUDED_IMAGES="ECS PRODSTUB CR RICSIM CP" #SUPPORTED TEST ENV FILE -SUPPORTED_PROFILES="ONAP-MASTER ORAN-MASTER" +SUPPORTED_PROFILES="ONAP-MASTER ORAN-CHERRY" . ../common/testcase_common.sh $@ . ../common/ecs_api_functions.sh diff --git a/test/auto-test/FTC150.sh b/test/auto-test/FTC150.sh index 60108ba9..daeb3c7c 100755 --- a/test/auto-test/FTC150.sh +++ b/test/auto-test/FTC150.sh @@ -24,7 +24,7 @@ TC_ONELINE_DESCR="Sample tests of the SDNC A1 controller restconf API using http INCLUDED_IMAGES="RICSIM SDNC" #SUPPORTED TEST ENV FILE -SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-MASTER" +SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-CHERRY" . ../common/testcase_common.sh $@ . ../common/controller_api_functions.sh diff --git a/test/auto-test/FTC1800.sh b/test/auto-test/FTC1800.sh index d8ecc85e..048a0111 100755 --- a/test/auto-test/FTC1800.sh +++ b/test/auto-test/FTC1800.sh @@ -24,7 +24,7 @@ TC_ONELINE_DESCR="ECS Create 10000 jobs and restart, test job persisency" INCLUDED_IMAGES="ECS PRODSTUB CR CP" #SUPPORTED TEST ENV FILE -SUPPORTED_PROFILES="ONAP-MASTER ORAN-MASTER" +SUPPORTED_PROFILES="ONAP-MASTER ORAN-CHERRY" . ../common/testcase_common.sh $@ . ../common/ecs_api_functions.sh diff --git a/test/auto-test/FTC300.sh b/test/auto-test/FTC300.sh index f33146ff..39732825 100755 --- a/test/auto-test/FTC300.sh +++ b/test/auto-test/FTC300.sh @@ -23,7 +23,7 @@ TC_ONELINE_DESCR="Resync 10000 policies using OSC and STD interface" INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC" #SUPPORTED TEST ENV FILE -SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-MASTER" +SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-CHERRY" . ../common/testcase_common.sh $@ . ../common/agent_api_functions.sh diff --git a/test/auto-test/FTC310.sh b/test/auto-test/FTC310.sh index 994d0ca3..eec45420 100755 --- a/test/auto-test/FTC310.sh +++ b/test/auto-test/FTC310.sh @@ -24,7 +24,7 @@ TC_ONELINE_DESCR="Resync of RIC via changes in the consul config or pushed confi INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM" #SUPPORTED TEST ENV FILE -SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-MASTER" +SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-CHERRY" . ../common/testcase_common.sh $@ . ../common/agent_api_functions.sh diff --git a/test/auto-test/FTC350.sh b/test/auto-test/FTC350.sh index 3c6f4437..0605944d 100755 --- a/test/auto-test/FTC350.sh +++ b/test/auto-test/FTC350.sh @@ -23,7 +23,7 @@ TC_ONELINE_DESCR="Change supported policy types and reconfigure rics" INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC" #SUPPORTED TEST ENV FILE -SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-MASTER" +SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-CHERRY" . ../common/testcase_common.sh $@ . ../common/agent_api_functions.sh diff --git a/test/auto-test/FTC800.sh b/test/auto-test/FTC800.sh index 401d3101..c90940c7 100755 --- a/test/auto-test/FTC800.sh +++ b/test/auto-test/FTC800.sh @@ -23,7 +23,7 @@ TC_ONELINE_DESCR="Create 10000 policies in sequence using http/https and Agent R INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC" #SUPPORTED TEST ENV FILE -SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-MASTER" +SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-CHERRY" . ../common/testcase_common.sh $@ . ../common/agent_api_functions.sh diff --git a/test/auto-test/FTC810.sh b/test/auto-test/FTC810.sh index 74ecf72e..7ac759cb 100755 --- a/test/auto-test/FTC810.sh +++ b/test/auto-test/FTC810.sh @@ -23,7 +23,7 @@ TC_ONELINE_DESCR="Repeatedly create and delete policies in each RICs for 24h (or INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC" #SUPPORTED TEST ENV FILE -SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-MASTER" +SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-CHERRY" . ../common/testcase_common.sh $@ . ../common/agent_api_functions.sh diff --git a/test/auto-test/FTC850.sh b/test/auto-test/FTC850.sh index 26a5ffa1..3b65b10a 100755 --- a/test/auto-test/FTC850.sh +++ b/test/auto-test/FTC850.sh @@ -23,7 +23,7 @@ TC_ONELINE_DESCR="Create/delete policies in parallel over a number of rics using INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC" #SUPPORTED TEST ENV FILE -SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-MASTER" +SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-CHERRY" . ../common/testcase_common.sh $@ . ../common/agent_api_functions.sh diff --git a/test/auto-test/FTC900.sh b/test/auto-test/FTC900.sh index ea3ef87c..356301e8 100755 --- a/test/auto-test/FTC900.sh +++ b/test/auto-test/FTC900.sh @@ -23,7 +23,7 @@ TC_ONELINE_DESCR="Preparation for test of the Control Panel and the Health Check INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM" #SUPPORTED TEST ENV FILE -SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-MASTER" +SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-CHERRY" . ../common/testcase_common.sh $@ . ../common/agent_api_functions.sh diff --git a/test/auto-test/PM_DEMO.sh b/test/auto-test/PM_DEMO.sh index ce54a5ff..c43ad3eb 100755 --- a/test/auto-test/PM_DEMO.sh +++ b/test/auto-test/PM_DEMO.sh @@ -23,7 +23,7 @@ TC_ONELINE_DESCR="Preparation demo setup - populating a number of ric simulator INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC" #SUPPORTED TEST ENV FILE -SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-MASTER" +SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-CHERRY" . ../common/testcase_common.sh $@ . ../common/agent_api_functions.sh diff --git a/test/auto-test/PM_EI_DEMO.sh b/test/auto-test/PM_EI_DEMO.sh index 2bca307a..bb33025c 100755 --- a/test/auto-test/PM_EI_DEMO.sh +++ b/test/auto-test/PM_EI_DEMO.sh @@ -20,10 +20,10 @@ TC_ONELINE_DESCR="Preparation demo setup - policy management and enrichment information" #App names to include in the test, space separated list -INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC ECS PRODSTUB" +INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC ECS PRODSTUB RC" #SUPPORTED TEST ENV FILE -SUPPORTED_PROFILES="ONAP-MASTER ORAN-MASTER" +SUPPORTED_PROFILES="ONAP-MASTER ORAN-CHERRY" . ../common/testcase_common.sh $@ . ../common/agent_api_functions.sh @@ -31,6 +31,7 @@ SUPPORTED_PROFILES="ONAP-MASTER ORAN-MASTER" . ../common/ecs_api_functions.sh . ../common/prodstub_api_functions.sh . ../common/cr_api_functions.sh +. ../common/rapp_catalogue_api_functions.sh #### TEST BEGIN #### @@ -43,6 +44,7 @@ use_sdnc_https use_simulator_https use_ecs_rest_https use_prod_stub_https +use_rapp_catalogue_http # https not yet supported if [ "$PMS_VERSION" == "V2" ]; then notificationurl=$CR_PATH"/test" @@ -70,16 +72,27 @@ consul_config_app ".consul_config.json" start_policy_agent +start_rapp_catalogue + start_cr start_prod_stub start_ecs +start_rapp_catalogue + set_agent_trace set_ecs_trace + +rapp_cat_api_get_services 200 EMPTY + +rapp_cat_api_put_service 201 "Emergency-response-app" v1 "Emergency-response-app" "Emergency-response-app" + +rapp_cat_api_get_services 200 "Emergency-response-app" v1 "Emergency-response-app" "Emergency-response-app" + api_get_status 200 # Print the A1 version for STD 2.X diff --git a/test/auto-test/README.md b/test/auto-test/README.md index 95e523cb..82ff47b9 100644 --- a/test/auto-test/README.md +++ b/test/auto-test/README.md @@ -15,7 +15,7 @@ The test scripts uses configuration from a single file, found in `../common/test ## How to run A test script, for example FTC1, is executed from the cmd line using the script filename and one or more parameters: - ./FTC1.sh remote. + ./FTC1.sh remote --env-file ../common/test_env-oran-cherry See the README.md in `../common/` for all details about available parameters and their meaning. @@ -53,6 +53,10 @@ It is strongly suggested to look at the existing test scripts, it is probably ea TC_ONELINE_DESCR="" +INCLUDED_IMAGES= + +SUPPORTED_PROFILES= + . ../common/testcase_common.sh $@ < other scripts need to be sourced for specific interfaces> diff --git a/test/common/README.md b/test/common/README.md index 4cde5323..a434ad87 100644 --- a/test/common/README.md +++ b/test/common/README.md @@ -16,7 +16,7 @@ The included functions are described in detail further below. 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. Also partly used for the Callback receiver api. +A common curl based function for the agent and ecs apis. Also partly used for the Callback receiver and RAPP Catalogue apis. `agent_api_functions.sh` \ Contains functions for adapting towards the Policy Agent API, also via dmaap (using a message-router stub interface) @@ -33,6 +33,9 @@ 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. +`rapp_catalogue_api_functions.sh` \ +Contains functions for adapting towards the RAPP Catalogue. + `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'. @@ -76,7 +79,7 @@ The script can be started with these arguments | `--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 ` | 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 file with environment variables (the previous default, test_env.sh, replaced with one env file for each branch in test/common) | -| `--use-local-image []*` | 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 | +| `--use-local-image []*` | only 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, RC for Policy Agent, Control Panel, A1-controller, Ric simulator, RAPP Catalogue | ## Function: print_result ## @@ -1528,8 +1531,6 @@ With the timeout, the test waits up to the timeout seconds before setting pass o # Description of functions in cr_api_function.sh # - - ## 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. @@ -1559,6 +1560,81 @@ Check the contents of all ric events received for a callback id. | `EMPTY` | Indicator for an empty list | | `` | Id of the ric | +# Description of functions in rapp_catalogue_api_function.sh # + +## Function: rc_equal ## +Tests if a variable value in the RAPP Catalogue 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. +See the 'cr' dir for more details. +| arg list | +|--| +| ` [ ]` | + +| parameter | description | +| --------- | ----------- | +| `` | Variable name in the RC | +| `` | Target value for the variable | +| `` | Max time to wait for the variable to reach the target value | + +## Function: rapp_cat_api_get_services() ## +Check all registered services. + +| arg list | +|--| +| ` [( )+ | EMPTY ]` | + +| parameter | description | +| --------- | ----------- | +| `` | Expected http response code | +| `` | Id of the service | +| `` | Version of the service | +| `` | Dislay name of the service | +| `` | Description of the service | +| `EMPTY` | Indicator for an empty list | + +## Function: rapp_cat_api_put_service() ## +Register a services. + +| arg list | +|--| +| ` ` | + +| parameter | description | +| --------- | ----------- | +| `` | Expected http response code | +| `` | Id of the service | +| `` | Version of the service | +| `` | Dislay name of the service | +| `` | Description of the service | + +## Function: rapp_cat_api_get_service() ## +Check a registered service. + +| arg list | +|--| +| ` ` | + +| parameter | description | +| --------- | ----------- | +| `` | Expected http response code | +| `` | Id of the service | +| `` | Version of the service | +| `` | Dislay name of the service | +| `` | Description of the service | + +## Function: rapp_cat_api_delete_service() ## +Check a registered service. + +| arg list | +|--| +| ` ` | + +| parameter | description | +| --------- | ----------- | +| `` | Expected http response code | +| `` | Id of the service | + ## License diff --git a/test/common/api_curl.sh b/test/common/api_curl.sh index cd3e9790..c7e5c908 100644 --- a/test/common/api_curl.sh +++ b/test/common/api_curl.sh @@ -23,7 +23,7 @@ # one for sending the requests and one for receiving the response # but only when using the DMAAP interface # REST or DMAAP is controlled of the base url of $ADAPTER -# arg: (PA|ECS GET|PUT|POST|DELETE|GET_BATCH|PUT_BATCH|POST_BATCH|DELETE_BATCH []) | (PA|ECS RESPONSE ) +# arg: (PA|ECS|CR|RC GET|PUT|POST|DELETE|GET_BATCH|PUT_BATCH|POST_BATCH|DELETE_BATCH []) | (PA|ECS RESPONSE ) # (Not for test scripts) __do_curl_to_api() { TIMESTAMP=$(date "+%Y-%m-%d %H:%M:%S") @@ -45,6 +45,11 @@ __do_curl_to_api() { __ADAPTER=$CR_ADAPTER __RESTBASE=$CR_RESTBASE __RESTBASE_SECURE=$CR_RESTBASE_SECURE + __RETRY_CODES="" + elif [ $1 == "RC" ]; then + __ADAPTER=$RC_ADAPTER + __RESTBASE=$RC_RESTBASE + __RESTBASE_SECURE=$RC_RESTBASE_SECURE __RETRY_CODES="" else paramError=1 diff --git a/test/common/rapp_catalogue_api_functions.sh b/test/common/rapp_catalogue_api_functions.sh new file mode 100644 index 00000000..dce28f3d --- /dev/null +++ b/test/common/rapp_catalogue_api_functions.sh @@ -0,0 +1,178 @@ +#!/bin/bash + +# ============LICENSE_START=============================================== +# Copyright (C) 2020 Nordix Foundation. All rights reserved. +# ======================================================================== +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END================================================= +# + +# This is a script that contains specific test functions for RAPP Catalogue API + +. ../common/api_curl.sh + +# Tests if a variable value in the RAPP Catalogue is equal to a target value and and optional timeout. +# Arg: - This test set pass or fail depending on if the variable is +# equal to the target or not. +# Arg: - 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) +rc_equal() { + if [ $# -eq 2 ] || [ $# -eq 3 ]; then + __var_test RC "$LOCALHOST$RC_EXTERNAL_PORT/" $1 "=" $2 $3 + else + __print_err "Wrong args to ecs_equal, needs two or three args: [ timeout ]" $@ + fi +} + + +########################################## +######### RAPP Catalogue API ########## +########################################## +#Function prefix: rapp_cat_api + +# API Test function: GET /services +# args: [( )+ | EMPTY ] +# (Function for test scripts) +rapp_cat_api_get_services() { + __log_test_start $@ + + if [ $# -lt 1 ]; then + __print_err " [( )+ | EMPTY ]" $@ + return 1 + fi + query="/services" + res="$(__do_curl_to_api RC GET $query)" + status=${res:${#res}-3} + + if [ $status -ne $1 ]; then + __log_test_fail_status_code $1 $status + return 1 + fi + + if [ $# -gt 1 ]; then + body=${res:0:${#res}-3} + targetJson="[" + arr=(${@:2}) + + if [ $# -eq 2 ]; then + targetJson="[]" + else + for ((i=0; i<$(($#-1)); i=i+4)); do + if [ "$targetJson" != "[" ]; then + targetJson=$targetJson"," + fi + targetJson=$targetJson"{\"name\": \"${arr[$i]}\",\"version\": \"${arr[$i+1]}\",\"display_name\": \"${arr[$i+2]}\",\"description\": \"${arr[$i+3]}\",\"registrationDate\": \"????\"}" + done + targetJson=$targetJson"]" + fi + echo " TARGET JSON: $targetJson" >> $HTTPLOG + res=$(python3 ../common/compare_json.py "$targetJson" "$body") + + if [ $res -ne 0 ]; then + __log_test_fail_body + return 1 + fi + fi + + __log_test_pass + return 0 +} + +# API Test function: PUT ​/services/{service-id} +# args: +# (Function for test scripts) +rapp_cat_api_put_service() { + __log_test_start $@ + + if [ $# -ne 5 ]; then + __print_err " " $@ + return 1 + fi + + inputJson="{\"version\": \"$3\",\"display_name\": \"$4\",\"description\": \"$5\"}" + file="./tmp/.p.json" + echo "$inputJson" > $file + query="/services/$2" + res="$(__do_curl_to_api RC PUT $query $file)" + status=${res:${#res}-3} + + if [ $status -ne $1 ]; then + __log_test_fail_status_code $1 $status + return 1 + fi + + __log_test_pass + return 0 +} + +# API Test function: GET ​/services/{service-id} +# args: +# (Function for test scripts) +rapp_cat_api_get_service() { + __log_test_start $@ + + if [ $# -lt 2 ] || [ $# -gt 5 ]; then + __print_err " " $@ + return 1 + fi + + query="/services/$2" + res="$(__do_curl_to_api RC GET $query)" + status=${res:${#res}-3} + + if [ $status -ne $1 ]; then + __log_test_fail_status_code $1 $status + return 1 + fi + + if [ $# -gt 2 ]; then + body=${res:0:${#res}-3} + targetJson="{\"name\": \"$2\",\"version\": \"$3\",\"display_name\": \"$4\",\"description\": \"$5\",\"registrationDate\": \"????\"}" + echo " TARGET JSON: $targetJson" >> $HTTPLOG + res=$(python3 ../common/compare_json.py "$targetJson" "$body") + + if [ $res -ne 0 ]; then + __log_test_fail_body + return 1 + fi + fi + + __log_test_pass + return 0 +} + +# API Test function: DELETE ​/services/{service-id} +# args: +# (Function for test scripts) +rapp_cat_api_delete_service() { + __log_test_start $@ + + if [ $# -ne 2 ]; then + __print_err " " $@ + return 1 + fi + + query="/services/$2" + res="$(__do_curl_to_api RC DELETE $query)" + status=${res:${#res}-3} + + if [ $status -ne $1 ]; then + __log_test_fail_status_code $1 $status + return 1 + fi + + __log_test_pass + return 0 +} diff --git a/test/common/test_env-oran-master.sh b/test/common/test_env-oran-cherry.sh similarity index 90% rename from test/common/test_env-oran-master.sh rename to test/common/test_env-oran-cherry.sh index c0e28f6b..4650768e 100755 --- a/test/common/test_env-oran-master.sh +++ b/test/common/test_env-oran-cherry.sh @@ -16,8 +16,8 @@ # limitations under the License. # ============LICENSE_END================================================= # -#Profile for ORAN master -TEST_ENV_PROFILE="ORAN-MASTER" +#Profile for ORAN Cherry +TEST_ENV_PROFILE="ORAN-CHERRY" NEXUS_PROXY_REPO="nexus3.onap.org:10001/" # Set up the image and tags for the test. Do not add the image tag to the image names. @@ -37,8 +37,8 @@ POLICY_AGENT_REMOTE_IMAGE_TAG="2.1.0" 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" +ECS_REMOTE_IMAGE="nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-enrichment-coordinator-service" +ECS_REMOTE_IMAGE_TAG="1.0.0" # Control Panel local image and tag CONTROL_PANEL_LOCAL_IMAGE="o-ran-sc/nonrtric-controlpanel" @@ -56,6 +56,14 @@ SDNC_A1_CONTROLLER_REMOTE_IMAGE="nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-a1- SDNC_A1_CONTROLLER_REMOTE_IMAGE_TAG="2.1.0" +# RAPP Catalogue local image and tag +RAPP_CAT_LOCAL_IMAGE="o-ran-sc/nonrtric-r-app-catalogue" +RAPP_CAT_LOCAL_IMAGE_TAG="1.0.0-SNAPSHOT" +# RAPP Catalogue remote image and tag +RAPP_CAT_REMOTE_IMAGE="nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-r-app-catalogue" +RAPP_CAT_REMOTE_IMAGE_TAG="1.0.0" + + #SDNC DB remote image and tag SDNC_DB_REMOTE_IMAGE=$NEXUS_PROXY_REPO"mysql/mysql-server" SDNC_DB_REMOTE_IMAGE_TAG="5.6" @@ -175,6 +183,13 @@ SDNC_API_URL="/restconf/operations/A1-ADAPTER-API:" # Base url path SDNC_ALIVE_URL="/apidoc/explorer/" # Base url path for SNDC API docs (for alive check) SDNC_KARAF_LOG="/opt/opendaylight/data/log/karaf.log" # Path to karaf log +export RAPP_CAT_EXTERNAL_PORT=8680 # RAPP Catalogue container external port (host -> container) +export RAPP_CAT_INTERNAL_PORT=8080 # RAPP Catalogue container internal port (container -> container) +export RAPP_CAT_EXTERNAL_SECURE_PORT=8633 # RAPP Catalogue container external secure port (host -> container) +export RAPP_CAT_INTERNAL_SECURE_PORT=8433 # RAPP Catalogue container internal secure port (container -> container) +export RAPP_CAT_APP_NAME="rapp-catalogue" # Name for the RAPP Catalogue + + 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) @@ -200,4 +215,8 @@ ECS_ADAPTER=$ECS_RESTBASE # Adapter holds CR_RESTBASE="http://localhost:"$CR_EXTERNAL_PORT # Base url to the Callback receiver REST interface CR_RESTBASE_SECURE="https://localhost:"$CR_EXTERNAL_SECURE_PORT # Base url to the secure Callback receiver REST interface CR_ADAPTER=$CR_RESTBASE # Adapter holds the address the CR admin interface (REST only) - # The values of this var is swiched between the two base url when needed \ No newline at end of file + # The values of this var is swiched between the two base url when needed + +RC_RESTBASE="http://localhost:"$RAPP_CAT_EXTERNAL_PORT # Base url to the RAPP Catalogue REST interface +RC_RESTBASE_SECURE="https://localhost:"$RAPP_CAT_EXTERNAL_SECURE_PORT # Base url to the secure RAPP Catalogue REST interface +RC_ADAPTER=$RC_RESTBASE # Adapter holds the address the RAPP Catalogue interface \ No newline at end of file diff --git a/test/common/testcase_common.sh b/test/common/testcase_common.sh index dd9e57ac..f2783f39 100755 --- a/test/common/testcase_common.sh +++ b/test/common/testcase_common.sh @@ -84,7 +84,7 @@ AUTO_CLEAN="" USE_LOCAL_IMAGES="" # List of available apps to override with local image -AVAILABLE_LOCAL_IMAGES_OVERRIDE="PA ECS CP SDNC RICSIM" +AVAILABLE_LOCAL_IMAGES_OVERRIDE="PA ECS CP SDNC RICSIM RC" # Use this var (STOP_AT_ERROR=1 in the test script) for debugging/trouble shooting to take all logs and exit at first FAIL test case STOP_AT_ERROR=0 @@ -164,7 +164,7 @@ rm $DEVIATION_FILE &> /dev/null trap_fnc() { if [ $? -eq 127 ]; then - echo -e $RED"Function not found, set script to FAIL"$ERED + echo -e $RED"Function not found, setting script to FAIL"$ERED ((RES_CONF_FAIL++)) fi } @@ -405,13 +405,17 @@ export CR_PATH="$CR_HTTPX://$CR_APP_NAME:$CR_PORT$CR_APP_CALLBACK" export PROD_STUB_HTTPX="http" export PROD_STUB_PORT=$PROD_STUB_INTERNAL_PORT -export PROD_STUB_LOCAL_PORT=$PROD_STUB_EXTERNAL_PORT #When CR is running outside the docker net +export PROD_STUB_LOCAL_PORT=$PROD_STUB_EXTERNAL_PORT #When Prodstub is running outside the docker net export PROD_STUB_LOCALHOST=$PROD_STUB_HTTPX"://localhost:"$PROD_STUB_LOCAL_PORT export SDNC_HTTPX="http" export SDNC_PORT=$SDNC_INTERNAL_PORT export SDNC_LOCAL_PORT=$SDNC_EXTERNAL_PORT #When agent is running outside the docker net +export RAPP_CAT_HTTPX="http" +export RAPP_CAT_PORT=$RAPP_CAT_INTERNAL_PORT +export RAPP_CAT_LOCAL_PORT=$RAPP_CAT_EXTERNAL_PORT #When Rapp catalogue is running outside the docker net + echo -e $BOLD"Checking configured image setting for this test case"$EBOLD #Temp var to check for image variable name errors @@ -550,6 +554,15 @@ elif [ $START_ARG == "remote" ] || [ $START_ARG == "remote-remove" ]; then __check_image_var " ECS" $START_ARG "ECS_IMAGE" "ECS_LOCAL_IMAGE" "ECS_LOCAL_IMAGE_TAG" ECS fi + __check_image_local_override 'RC' + if [ $? -eq 0 ]; then + #Remote ecs image + __check_image_var " RC" $START_ARG "RAPP_CAT_IMAGE" "RAPP_CAT_REMOTE_IMAGE" "RAPP_CAT_REMOTE_IMAGE_TAG" RC + else + #Local ecs image + __check_image_var " RC" $START_ARG "RAPP_CAT_IMAGE" "RAPP_CAT_LOCAL_IMAGE" "RAPP_CAT_LOCAL_IMAGE_TAG" RC + fi + else #Should never get here.... echo "Unknow args: "$@ @@ -718,6 +731,18 @@ else echo -e $YELLOW" Excluding Non-RT RIC Control Panel image from image check/pull"$EYELLOW fi +__check_included_image 'RC' +if [ $? -eq 0 ]; then + START_ARG_MOD=$START_ARG + __check_image_local_override 'RC' + if [ $? -eq 1 ]; then + START_ARG_MOD="local" + fi + app="RAPP Catalogue"; __check_and_pull_image $START_ARG_MOD "$app" $RAPP_CAT_APP_NAME $RAPP_CAT_IMAGE +else + echo -e $YELLOW" Excluding RAPP Catalogue image from image check/pull"$EYELLOW +fi + __check_included_image 'RICSIM' if [ $? -eq 0 ]; then START_ARG_MOD=$START_ARG @@ -856,6 +881,10 @@ __check_included_image 'RICSIM' if [ $? -eq 0 ]; then echo -e " RIC Simulator\t$(docker images --format $format_string $RIC_SIM_IMAGE)" >> $docker_tmp_file fi +__check_included_image 'RC' +if [ $? -eq 0 ]; then + echo -e " RAPP Catalogue\t$(docker images --format $format_string $RAPP_CAT_IMAGE)" >> $docker_tmp_file +fi __check_included_image 'MR' if [ $? -eq 0 ]; then echo -e " Message Router\t$(docker images --format $format_string $MRSTUB_IMAGE)" >> $docker_tmp_file @@ -1091,6 +1120,7 @@ clean_containers() { CONTAINTER_NAMES=("Policy Agent " $(__check_app_name $POLICY_AGENT_APP_NAME)\ "ECS " $(__check_app_name $ECS_APP_NAME)\ + "RAPP Catalogue " $(__check_app_name $RAPP_CAT_APP_NAME)\ "Non-RT RIC Simulator(s)" $(__check_app_name $RIC_SIM_PREFIX)\ "Message Router " $(__check_app_name $MR_APP_NAME)\ "Callback Receiver " $(__check_app_name $CR_APP_NAME)\ @@ -1680,6 +1710,44 @@ start_control_panel() { } +########################### +### RAPP Catalogue +########################### + +# Start the RAPP Catalogue container +# args: - +# (Function for test scripts) +start_rapp_catalogue() { + + echo -e $BOLD"Starting RAPP Catalogue"$EBOLD + + __check_included_image 'RC' + if [ $? -eq 1 ]; then + echo -e $RED"The RAPP Catalogue image has not been checked for this test run due to arg to the test script"$ERED + echo -e $RED"The RAPP Catalogue will not be started"$ERED + exit + fi + __start_container rapp_catalogue NODOCKERARGS $RAPP_CAT_APP_NAME $RAPP_CAT_EXTERNAL_PORT "/services" "http" +} + +use_rapp_catalogue_http() { + echo -e $BOLD"RAPP Catalogue protocol setting"$EBOLD + echo -e " Using $BOLD http $EBOLD towards the RAPP Catalogue" + export RAPP_CAT_HTTPX="http" + export RAPP_CAT_PORT=$RAPP_CAT_INTERNAL_PORT + export RAPP_CAT_LOCAL_PORT=$RAPP_CAT_EXTERNAL_PORT + echo "" +} + +use_rapp_catalogue_https() { + echo -e $BOLD"RAPP Catalogue protocol setting"$EBOLD + echo -e " Using $BOLD https $EBOLD towards the RAPP Catalogue" + export RAPP_CAT_HTTPX="https" + export RAPP_CAT_PORT=$RAPP_CAT_INTERNAL_PORT + export RAPP_CAT_LOCAL_PORT=$RAPP_CAT_EXTERNAL_PORT + echo "" +} + ################## ### SDNC functions ################## diff --git a/test/simulator-group/rapp_catalogue/.gitignore b/test/simulator-group/rapp_catalogue/.gitignore new file mode 100644 index 00000000..4aa3a7ae --- /dev/null +++ b/test/simulator-group/rapp_catalogue/.gitignore @@ -0,0 +1,2 @@ +.tmp.json +.dockererr \ No newline at end of file diff --git a/test/simulator-group/rapp_catalogue/docker-compose.yml b/test/simulator-group/rapp_catalogue/docker-compose.yml new file mode 100644 index 00000000..1cf35f77 --- /dev/null +++ b/test/simulator-group/rapp_catalogue/docker-compose.yml @@ -0,0 +1,34 @@ +# ============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================================================= +# +version: '3.0' +networks: + default: + external: + name: nonrtric-docker-net +services: + rapp-catalogue: + image: ${RAPP_CAT_IMAGE} + container_name: ${RAPP_CAT_APP_NAME} + networks: + - default + ports: + - ${RAPP_CAT_EXTERNAL_PORT}:${RAPP_CAT_INTERNAL_PORT} + - ${RAPP_CAT_EXTERNAL_SECURE_PORT}:${RAPP_CAT_INTERNAL_SECURE_PORT} + + + + diff --git a/test/simulator-group/sim-monitor.js b/test/simulator-group/sim-monitor.js index 7a220263..9a0616d5 100644 --- a/test/simulator-group/sim-monitor.js +++ b/test/simulator-group/sim-monitor.js @@ -26,6 +26,7 @@ var AGENT_PORT="8081" var CR_PORT="8090" var ECS_PORT="8083" var PRODSTUB_PORT="8092" +var RC_PORT="8680" var http = require('http'); @@ -212,8 +213,12 @@ var refreshCount_ecs=-1 var refreshCount_cr=-1 +var refreshCount_rc=-1 + var ricbasename="ricsim" +var rc_services="" + function fetchAllMetrics_pol() { console.log("Fetching policy metrics " + refreshCount_pol) @@ -711,6 +716,42 @@ function fetchAllMetrics_cr() { }, 500) } +function fetchAllMetrics_rc() { + + console.log("Fetching RC services - timer:" + refreshCount_ecs) + + if (refreshCount_rc < 0) { + refreshCount_rc = -1 + return + } else { + refreshCount_rc = refreshCount_rc - 1 + } + setTimeout(() => { + + if (checkFunctionFlag("rc_stat")) { + getSimCtr(LOCALHOST+RC_PORT+"/services", 0, function(data, index) { + var tmp_serv="" + try { + var jd=JSON.parse(data); + for(var i=0;i 0) { + tmp_serv=tmp_serv+"," + } + tmp_serv=tmp_serv+jd[i]["name"] + } + + } + catch (err) { + tmp_serv="no_response" + } + rc_services=tmp_serv + }); + clearFlag("rc_stat") + } + fetchAllMetrics_rc(); + }, 500) +} + // Monitor for CR db app.get("/mon3",function(req, res){ @@ -810,7 +851,6 @@ app.get("/mon2",function(req, res){ htmlStr=htmlStr+"
"; for(i=0;i" htmlStr=htmlStr+s @@ -876,6 +916,12 @@ app.get("/mon",function(req, res){ } refreshCount_pol=5 + if (refreshCount_rc < 0) { + refreshCount_rc=5 + fetchAllMetrics_rc() + } + refreshCount_rc=5 + var bn=req.query.basename if (bn == undefined) { @@ -919,6 +965,10 @@ app.get("/mon",function(req, res){ "Callbacks fetched:...................." + formatDataRow(cr2) + "
" + "Number of waiting callback messages:.." + formatDataRow(cr3) + "
" + "" + + "

R-APP Catalogue

" + + "" + + "Services:............................." + formatIdRowCompact(rc_services) + "
" + + "
" + "

Near-RT RIC Simulators

" + "" -- 2.16.6