Function test updates
Removal of dmaap interface for A1PMS
Removal of old ICS interface
Optimized image sizes for simulators
Integrated ric mediator to the test env
Added testcase for ric mediator
Added testcase for custom adapter in A1PMS
Issue-ID: NONRTRIC-827
Signed-off-by: BjornMagnussonXA <bjorn.magnusson@est.tech>
Change-Id: I49baf0146204a1602fdc411d7187e816997a54db
diff --git a/test/common/README.md b/test/common/README.md
index ef65172..492f204 100644
--- a/test/common/README.md
+++ b/test/common/README.md
@@ -2871,7 +2871,7 @@
| --------- | ----------- |
| `<ric-name>` | The name of the ric to translate into a host name (ip) |
-## Function: generate_policy_uuid ##
+## Function: sim_generate_policy_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.
@@ -3152,7 +3152,7 @@
## License
-Copyright (C) 2020 Nordix Foundation. All rights reserved.
+Copyright (C) 2020-2023 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
diff --git a/test/common/a1pms_api_functions.sh b/test/common/a1pms_api_functions.sh
index ccc424e..e391872 100644
--- a/test/common/a1pms_api_functions.sh
+++ b/test/common/a1pms_api_functions.sh
@@ -1,7 +1,7 @@
#!/bin/bash
# ============LICENSE_START===============================================
-# Copyright (C) 2021 Nordix Foundation. All rights reserved.
+# Copyright (C) 2021-2023 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.
@@ -457,16 +457,16 @@
# Function to perpare the consul configuration according to the current simulator configuration
-# args: SDNC|NOSDNC <output-file>
+# args: SDNC|NOSDNC <output-file> [ <sim-group> <adapter-class> ]
# (Function for test scripts)
prepare_a1pms_config() {
- echo -e $BOLD"Prepare Consul config"$EBOLD
+ echo -e $BOLD"Prepare A1PMS config"$EBOLD
echo " Writing consul config for "$A1PMS_APP_NAME" to file: "$2
- if [ $# != 2 ]; then
+ if [ $# != 2 ] && [ $# != 4 ]; then
((RES_CONF_FAIL++))
- __print_err "need two args, SDNC|NOSDNC <output-file>" $@
+ __print_err "need two or four args, SDNC|NOSDNC <output-file> [ <sim-group> <adapter-class> ]" $@
exit 1
fi
@@ -491,23 +491,26 @@
config_json=$config_json"\n }"
config_json=$config_json"\n ],"
fi
-
- config_json=$config_json"\n \"streams_publishes\": {"
- config_json=$config_json"\n \"dmaap_publisher\": {"
- config_json=$config_json"\n \"type\": \"message-router\","
- config_json=$config_json"\n \"dmaap_info\": {"
- config_json=$config_json"\n \"topic_url\": \"$MR_SERVICE_PATH$MR_WRITE_URL\""
- config_json=$config_json"\n }"
- config_json=$config_json"\n }"
- config_json=$config_json"\n },"
- config_json=$config_json"\n \"streams_subscribes\": {"
- config_json=$config_json"\n \"dmaap_subscriber\": {"
- config_json=$config_json"\n \"type\": \"message-router\","
- config_json=$config_json"\n \"dmaap_info\": {"
- config_json=$config_json"\n \"topic_url\": \"$MR_SERVICE_PATH$MR_READ_URL\""
- config_json=$config_json"\n }"
- config_json=$config_json"\n }"
- config_json=$config_json"\n },"
+ if [[ "$A1PMS_FEATURE_LEVEL" == *"NO-DMAAP"* ]]; then
+ :
+ else
+ config_json=$config_json"\n \"streams_publishes\": {"
+ config_json=$config_json"\n \"dmaap_publisher\": {"
+ config_json=$config_json"\n \"type\": \"message-router\","
+ config_json=$config_json"\n \"dmaap_info\": {"
+ config_json=$config_json"\n \"topic_url\": \"$MR_SERVICE_PATH$MR_WRITE_URL\""
+ config_json=$config_json"\n }"
+ config_json=$config_json"\n }"
+ config_json=$config_json"\n },"
+ config_json=$config_json"\n \"streams_subscribes\": {"
+ config_json=$config_json"\n \"dmaap_subscriber\": {"
+ config_json=$config_json"\n \"type\": \"message-router\","
+ config_json=$config_json"\n \"dmaap_info\": {"
+ config_json=$config_json"\n \"topic_url\": \"$MR_SERVICE_PATH$MR_READ_URL\""
+ config_json=$config_json"\n }"
+ config_json=$config_json"\n }"
+ config_json=$config_json"\n },"
+ fi
config_json=$config_json"\n \"ric\": ["
@@ -524,16 +527,35 @@
fi
done
fi
+ result=$(kubectl $KUBECONF get pods -n $KUBE_A1SIM_NAMESPACE -o jsonpath='{.items[?(@.metadata.labels.autotest=="RICMEDIATORSIM")].metadata.name}')
+ oranrics=""
+ if [ $? -eq 0 ] && [ ! -z "$result" ]; then
+ for im in $result; do
+ if [[ $im != *"-0" ]]; then
+ ric_subdomain=$(kubectl $KUBECONF get pod $im -n $KUBE_A1SIM_NAMESPACE -o jsonpath='{.spec.subdomain}')
+ rics=$rics" "$im"."$ric_subdomain"."$KUBE_A1SIM_NAMESPACE
+ oranrics=$oranrics" "$im"."$ric_subdomain"."$KUBE_A1SIM_NAMESPACE
+ let ric_cntr=ric_cntr+1
+ fi
+ done
+ fi
if [ $ric_cntr -eq 0 ]; then
echo $YELLOW"Warning: No rics found for the configuration"$EYELLOW
fi
else
- rics=$(docker ps --filter "name=$RIC_SIM_PREFIX" --filter "network=$DOCKER_SIM_NWNAME" --filter "status=running" --format {{.Names}})
+ rics=$(docker ps --filter "name=$RIC_SIM_PREFIX" --filter "network=$DOCKER_SIM_NWNAME" --filter "label=a1sim" --filter "status=running" --format {{.Names}})
if [ $? -ne 0 ] || [ -z "$rics" ]; then
echo -e $RED" FAIL - the names of the running RIC Simulator cannot be retrieved." $ERED
((RES_CONF_FAIL++))
return 1
fi
+ oranrics=$(docker ps --filter "name=$RIC_SIM_PREFIX" --filter "network=$DOCKER_SIM_NWNAME" --filter "label=orana1sim" --filter "status=running" --format {{.Names}})
+ if [ $? -ne 0 ] || [ -z "$rics" ]; then
+ echo -e $RED" FAIL - the names of the running RIC Simulator cannot be retrieved." $ERED
+ ((RES_CONF_FAIL++))
+ return 1
+ fi
+ rics="$rics $oranrics"
fi
cntr=0
for ric in $rics; do
@@ -553,7 +575,23 @@
fi
echo " Found a1 sim: "$ric_id
config_json=$config_json"\n \"name\": \"$ric_id\","
- config_json=$config_json"\n \"baseUrl\": \"$RIC_SIM_HTTPX://$ric:$RIC_SIM_PORT\","
+
+ xricfound=0
+ for xric in $oranrics; do
+ if [ $xric == $ric ]; then
+ xricfound=1
+ fi
+ done
+ if [ $xricfound -eq 0 ]; then
+ config_json=$config_json"\n \"baseUrl\": \"$RIC_SIM_HTTPX://$ric:$RIC_SIM_PORT\","
+ else
+ config_json=$config_json"\n \"baseUrl\": \"$RICMEDIATOR_SIM_HTTPX://$ric:$RICMEDIATOR_SIM_PORT\","
+ fi
+ if [ ! -z "$3" ]; then
+ if [[ $ric == "$3"* ]]; then
+ config_json=$config_json"\n \"customAdapterClass\": \"$4\","
+ fi
+ fi
if [ $1 == "SDNC" ]; then
config_json=$config_json"\n \"controller\": \"$SDNC_APP_NAME\","
fi
diff --git a/test/common/chartmus_api_functions.sh b/test/common/chartmus_api_functions.sh
index 7c7a365..3cd8b33 100644
--- a/test/common/chartmus_api_functions.sh
+++ b/test/common/chartmus_api_functions.sh
@@ -1,7 +1,7 @@
#!/bin/bash
# ============LICENSE_START===============================================
-# Copyright (C) 2021 Nordix Foundation. All rights reserved.
+# Copyright (C) 2021-2023 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.
@@ -258,7 +258,7 @@
fi
fi
echo " CMD: $3 -skw %{http_code} $proxyflag" >> $HTTPLOG
- res="$($3 -skw %{http_code} $proxyflag)"
+ res=$($3 -skw %{http_code} $proxyflag)
echo " RESP: $res" >> $HTTPLOG
retcode=$?
if [ $retcode -ne 0 ]; then
diff --git a/test/common/format_endpoint_stats.sh b/test/common/format_endpoint_stats.sh
index 1ccbc82..9edd01a 100755
--- a/test/common/format_endpoint_stats.sh
+++ b/test/common/format_endpoint_stats.sh
@@ -1,7 +1,7 @@
#!/bin/bash
# ============LICENSE_START===============================================
-# Copyright (C) 2021 Nordix Foundation. All rights reserved.
+# Copyright (C) 2021-2023 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.
@@ -133,5 +133,6 @@
echo "Method Endpoint Positive Negative"
cat $SUMMARYFILE | cut -c 4-
+echo "-- end of test report -- "
exit 0
diff --git a/test/common/ics_api_functions.sh b/test/common/ics_api_functions.sh
index 0c067ca..3676fdc 100644
--- a/test/common/ics_api_functions.sh
+++ b/test/common/ics_api_functions.sh
@@ -1,7 +1,7 @@
#!/bin/bash
# ============LICENSE_START===============================================
-# Copyright (C) 2020 Nordix Foundation. All rights reserved.
+# Copyright (C) 2020-2023 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.
@@ -505,43 +505,29 @@
#Function prefix: ics_api_a1
# API Test function: GET /A1-EI/v1/eitypes/{eiTypeId}/eijobs
-# args: <response-code> <type-id> <owner-id>|NOOWNER [ EMPTY | <job-id>+ ]
-# args (flat uri structure): <response-code> <type-id>|NOTYPE <owner-id>|NOOWNER [ EMPTY | <job-id>+ ]
+# args: <response-code> <type-id>|NOTYPE <owner-id>|NOOWNER [ EMPTY | <job-id>+ ]
# (Function for test scripts)
ics_api_a1_get_job_ids() {
__log_test_start $@
- if [ -z "$FLAT_A1_EI" ]; then
- # Valid number of parameters 4,5,6 etc
- if [ $# -lt 3 ]; then
- __print_err "<response-code> <type-id> <owner-id>|NOOWNER [ EMPTY | <job-id>+ ]" $@
- return 1
- fi
- else
- echo -e $YELLOW"INTERFACE - FLAT URI STRUCTURE"$EYELLOW
- # Valid number of parameters 4,5,6 etc
- if [ $# -lt 3 ]; then
- __print_err "<response-code> <type-id>|NOTYPE <owner-id>|NOOWNER [ EMPTY | <job-id>+ ]" $@
- return 1
- fi
+ # Valid number of parameters 4,5,6 etc
+ if [ $# -lt 3 ]; then
+ __print_err "<response-code> <type-id>|NOTYPE <owner-id>|NOOWNER [ EMPTY | <job-id>+ ]" $@
+ return 1
fi
search=""
if [ $3 != "NOWNER" ]; then
search="?owner="$3
fi
- if [ -z "$FLAT_A1_EI" ]; then
- query="/A1-EI/v1/eitypes/$2/eijobs$search"
- else
- if [ $2 != "NOTYPE" ]; then
- if [ -z "$search" ]; then
- search="?eiTypeId="$2
- else
- search=$search"&eiTypeId="$2
- fi
+ if [ $2 != "NOTYPE" ]; then
+ if [ -z "$search" ]; then
+ search="?eiTypeId="$2
+ else
+ search=$search"&eiTypeId="$2
fi
- query="/A1-EI/v1/eijobs$search"
fi
+ query="/A1-EI/v1/eijobs$search"
res="$(__do_curl_to_api ICS GET $query)"
status=${res:${#res}-3}
@@ -605,11 +591,7 @@
__log_test_fail_general "Schema file "$3", does not exist"
return 1
fi
- if [ -z "$FLAT_A1_EI" ]; then
- targetJson="{\"eiJobParametersSchema\":$schema}"
- else
- targetJson=$schema
- fi
+ targetJson=$schema
echo " TARGET JSON: $targetJson" >> $HTTPLOG
res=$(python3 ../common/compare_json.py "$targetJson" "$body")
@@ -668,121 +650,81 @@
}
# API Test function: GET /A1-EI/v1/eitypes/{eiTypeId}/eijobs/{eiJobId}/status
-# args: <response-code> <type-id> <job-id> [<status>]
-# args (flat uri structure): <response-code> <job-id> [<status> [<timeout>]]
+# args: <response-code> <job-id> [<status> [<timeout>]]
# (Function for test scripts)
ics_api_a1_get_job_status() {
__log_test_start $@
- if [ -z "$FLAT_A1_EI" ]; then
- if [ $# -ne 3 ] && [ $# -ne 4 ]; then
- __print_err "<response-code> <type-id> <job-id> [<status>]" $@
- return 1
- fi
+ if [ $# -lt 2 ] && [ $# -gt 4 ]; then
+ __print_err "<response-code> <job-id> [<status> [<timeout>]]" $@
+ return 1
+ fi
- query="/A1-EI/v1/eitypes/$2/eijobs/$3/status"
+ query="/A1-EI/v1/eijobs/$2/status"
+ start=$SECONDS
+ for (( ; ; )); do
res="$(__do_curl_to_api ICS GET $query)"
status=${res:${#res}-3}
- if [ $status -ne $1 ]; then
- __log_test_fail_status_code $1 $status
- return 1
- fi
if [ $# -eq 4 ]; then
+ duration=$((SECONDS-start))
+ echo -ne " Response=${status} after ${duration} seconds, waiting for ${3} ${SAMELINE}"
+ if [ $duration -gt $4 ]; then
+ echo ""
+ duration=-1 #Last iteration
+ fi
+ else
+ duration=-1 #single test, no wait
+ fi
+
+ if [ $status -ne $1 ]; then
+ if [ $duration -eq -1 ]; then
+ __log_test_fail_status_code $1 $status
+ return 1
+ fi
+ fi
+ if [ $# -ge 3 ] && [ $status -eq $1 ]; then
body=${res:0:${#res}-3}
- targetJson="{\"operationalState\": \"$4\"}"
+ targetJson="{\"eiJobStatus\": \"$3\"}"
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
- else
- echo -e $YELLOW"INTERFACE - FLAT URI STRUCTURE"$EYELLOW
- if [ $# -lt 2 ] && [ $# -gt 4 ]; then
- __print_err "<response-code> <job-id> [<status> [<timeout>]]" $@
- return 1
- fi
-
- query="/A1-EI/v1/eijobs/$2/status"
-
- start=$SECONDS
- for (( ; ; )); do
- res="$(__do_curl_to_api ICS GET $query)"
- status=${res:${#res}-3}
-
- if [ $# -eq 4 ]; then
- duration=$((SECONDS-start))
- echo -ne " Response=${status} after ${duration} seconds, waiting for ${3} ${SAMELINE}"
- if [ $duration -gt $4 ]; then
- echo ""
- duration=-1 #Last iteration
- fi
- else
- duration=-1 #single test, no wait
- fi
-
- if [ $status -ne $1 ]; then
if [ $duration -eq -1 ]; then
- __log_test_fail_status_code $1 $status
+ __log_test_fail_body
return 1
fi
- fi
- if [ $# -ge 3 ] && [ $status -eq $1 ]; then
- body=${res:0:${#res}-3}
- targetJson="{\"eiJobStatus\": \"$3\"}"
- echo " TARGET JSON: $targetJson" >> $HTTPLOG
- res=$(python3 ../common/compare_json.py "$targetJson" "$body")
-
- if [ $res -ne 0 ]; then
- if [ $duration -eq -1 ]; then
- __log_test_fail_body
- return 1
- fi
- else
- duration=-1 #Goto pass
- fi
- fi
- if [ $duration -eq -1 ]; then
- if [ $# -eq 4 ]; then
- echo ""
- fi
- __log_test_pass
- return 0
else
- sleep 1
+ duration=-1 #Goto pass
fi
- done
- fi
+ fi
+ if [ $duration -eq -1 ]; then
+ if [ $# -eq 4 ]; then
+ echo ""
+ fi
+ __log_test_pass
+ return 0
+ else
+ sleep 1
+ fi
+ done
__log_test_pass
return 0
}
# API Test function: GET /A1-EI/v1/eitypes/{eiTypeId}/eijobs/{eiJobId}
-# args: <response-code> <type-id> <job-id> [<target-url> <owner-id> <template-job-file>]
-# args (flat uri structure): <response-code> <job-id> [<type-id> <target-url> <owner-id> <template-job-file>]
+# args: <response-code> <job-id> [<type-id> <target-url> <owner-id> <template-job-file>]
# (Function for test scripts)
ics_api_a1_get_job() {
__log_test_start $@
- if [ -z "$FLAT_A1_EI" ]; then
- if [ $# -ne 3 ] && [ $# -ne 6 ]; then
- __print_err "<response-code> <type-id> <job-id> [<target-url> <owner-id> <template-job-file>]" $@
- return 1
- fi
- query="/A1-EI/v1/eitypes/$2/eijobs/$3"
- else
- echo -e $YELLOW"INTERFACE - FLAT URI STRUCTURE"$EYELLOW
- if [ $# -ne 2 ] && [ $# -ne 7 ]; then
- __print_err "<response-code> <job-id> [<type-id> <target-url> <owner-id> <notification-url> <template-job-file>]" $@
- return 1
- fi
- query="/A1-EI/v1/eijobs/$2"
+ if [ $# -ne 2 ] && [ $# -ne 7 ]; then
+ __print_err "<response-code> <job-id> [<type-id> <target-url> <owner-id> <notification-url> <template-job-file>]" $@
+ return 1
fi
+ query="/A1-EI/v1/eijobs/$2"
res="$(__do_curl_to_api ICS GET $query)"
status=${res:${#res}-3}
@@ -791,45 +733,23 @@
return 1
fi
- if [ -z "$FLAT_A1_EI" ]; then
- if [ $# -eq 6 ]; then
- body=${res:0:${#res}-3}
+ if [ $# -eq 7 ]; then
+ body=${res:0:${#res}-3}
- if [ -f $6 ]; then
- jobfile=$(cat $6)
- jobfile=$(echo "$jobfile" | sed "s/XXXX/$3/g")
- else
- __log_test_fail_general "Job template file "$6", does not exist"
- return 1
- fi
- targetJson="{\"targetUri\": \"$4\",\"jobOwner\": \"$5\",\"jobParameters\": $jobfile}"
- 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
+ if [ -f $7 ]; then
+ jobfile=$(cat $7)
+ jobfile=$(echo "$jobfile" | sed "s/XXXX/$2/g")
+ else
+ __log_test_fail_general "Job template file "$6", does not exist"
+ return 1
fi
- else
- if [ $# -eq 7 ]; then
- body=${res:0:${#res}-3}
+ targetJson="{\"eiTypeId\": \"$3\", \"jobResultUri\": \"$4\",\"jobOwner\": \"$5\",\"jobStatusNotificationUri\": \"$6\",\"jobDefinition\": $jobfile}"
+ echo " TARGET JSON: $targetJson" >> $HTTPLOG
+ res=$(python3 ../common/compare_json.py "$targetJson" "$body")
- if [ -f $7 ]; then
- jobfile=$(cat $7)
- jobfile=$(echo "$jobfile" | sed "s/XXXX/$2/g")
- else
- __log_test_fail_general "Job template file "$6", does not exist"
- return 1
- fi
- targetJson="{\"eiTypeId\": \"$3\", \"jobResultUri\": \"$4\",\"jobOwner\": \"$5\",\"jobStatusNotificationUri\": \"$6\",\"jobDefinition\": $jobfile}"
- 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
+ if [ $res -ne 0 ]; then
+ __log_test_fail_body
+ return 1
fi
fi
@@ -838,27 +758,16 @@
}
# API Test function: DELETE /A1-EI/v1/eitypes/{eiTypeId}/eijobs/{eiJobId}
-# args: <response-code> <type-id> <job-id>
-# args (flat uri structure): <response-code> <job-id>
+# args: <response-code> <job-id>
# (Function for test scripts)
ics_api_a1_delete_job() {
__log_test_start $@
- if [ -z "$FLAT_A1_EI" ]; then
- if [ $# -ne 3 ]; then
- __print_err "<response-code> <type-id> <job-id>" $@
- return 1
- fi
-
- query="/A1-EI/v1/eitypes/$2/eijobs/$3"
- else
- echo -e $YELLOW"INTERFACE - FLAT URI STRUCTURE"$EYELLOW
- if [ $# -ne 2 ]; then
- __print_err "<response-code> <job-id>" $@
- return 1
- fi
- query="/A1-EI/v1/eijobs/$2"
+ if [ $# -ne 2 ]; then
+ __print_err "<response-code> <job-id>" $@
+ return 1
fi
+ query="/A1-EI/v1/eijobs/$2"
res="$(__do_curl_to_api ICS DELETE $query)"
status=${res:${#res}-3}
@@ -872,50 +781,28 @@
}
# API Test function: PUT /A1-EI/v1/eitypes/{eiTypeId}/eijobs/{eiJobId}
-# args: <response-code> <type-id> <job-id> <target-url> <owner-id> <template-job-file>
-# args (flat uri structure): <response-code> <job-id> <type-id> <target-url> <owner-id> <notification-url> <template-job-file>
+# args <response-code> <job-id> <type-id> <target-url> <owner-id> <notification-url> <template-job-file>
# (Function for test scripts)
ics_api_a1_put_job() {
__log_test_start $@
- if [ -z "$FLAT_A1_EI" ]; then
- if [ $# -lt 6 ]; then
- __print_err "<response-code> <type-id> <job-id> <target-url> <owner-id> <template-job-file>" $@
- return 1
- fi
- if [ -f $6 ]; then
- jobfile=$(cat $6)
- jobfile=$(echo "$jobfile" | sed "s/XXXX/$3/g")
- else
- __log_test_fail_general "Job template file "$6", does not exist"
- return 1
- fi
-
- inputJson="{\"targetUri\": \"$4\",\"jobOwner\": \"$5\",\"jobParameters\": $jobfile}"
- file="./tmp/.p.json"
- echo "$inputJson" > $file
-
- query="/A1-EI/v1/eitypes/$2/eijobs/$3"
- else
- echo -e $YELLOW"INTERFACE - FLAT URI STRUCTURE"$EYELLOW
- if [ $# -lt 7 ]; then
- __print_err "<response-code> <job-id> <type-id> <target-url> <owner-id> <notification-url> <template-job-file>" $@
- return 1
- fi
- if [ -f $7 ]; then
- jobfile=$(cat $7)
- jobfile=$(echo "$jobfile" | sed "s/XXXX/$2/g")
- else
- __log_test_fail_general "Job template file "$7", does not exist"
- return 1
- fi
-
- inputJson="{\"eiTypeId\": \"$3\", \"jobResultUri\": \"$4\",\"jobOwner\": \"$5\",\"jobStatusNotificationUri\": \"$6\",\"jobDefinition\": $jobfile}"
- file="./tmp/.p.json"
- echo "$inputJson" > $file
-
- query="/A1-EI/v1/eijobs/$2"
+ if [ $# -lt 7 ]; then
+ __print_err "<response-code> <job-id> <type-id> <target-url> <owner-id> <notification-url> <template-job-file>" $@
+ return 1
fi
+ if [ -f $7 ]; then
+ jobfile=$(cat $7)
+ jobfile=$(echo "$jobfile" | sed "s/XXXX/$2/g")
+ else
+ __log_test_fail_general "Job template file "$7", does not exist"
+ return 1
+ fi
+
+ inputJson="{\"eiTypeId\": \"$3\", \"jobResultUri\": \"$4\",\"jobOwner\": \"$5\",\"jobStatusNotificationUri\": \"$6\",\"jobDefinition\": $jobfile}"
+ file="./tmp/.p.json"
+ echo "$inputJson" > $file
+
+ query="/A1-EI/v1/eijobs/$2"
res="$(__do_curl_to_api ICS PUT $query $file)"
status=${res:${#res}-3}
@@ -946,11 +833,7 @@
__print_err "<response-code> [ EMPTY | <type-id>+]" $@
return 1
fi
- if [[ "$ICS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
- query="/data-producer/v1/info-types"
- else
- query="/ei-producer/v1/eitypes"
- fi
+ query="/data-producer/v1/info-types"
res="$(__do_curl_to_api ICS GET $query)"
status=${res:${#res}-3}
@@ -995,11 +878,7 @@
__print_err "<response-code> <producer-id> [<status> [<timeout>]]" $@
return 1
fi
- if [[ "$ICS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
- query="/data-producer/v1/info-producers/$2/status"
- else
- query="/ei-producer/v1/eiproducers/$2/status"
- fi
+ query="/data-producer/v1/info-producers/$2/status"
start=$SECONDS
for (( ; ; )); do
res="$(__do_curl_to_api ICS GET $query)"
@@ -1108,17 +987,10 @@
__print_err "<response-code> [ ( NOTYPE | <type-id> ) [ EMPTY | <producer-id>+] ]" $@
return 1
fi
- if [[ "$ICS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
- query="/data-producer/v1/info-producers"
- if [ $# -gt 1 ] && [ $2 != "NOTYPE" ]; then
- query=$query"?info_type_id=$2&infoTypeId=$2" #info_type_id changed to infoTypeId in F-release.
- #Remove info_type_id when F-release is no longer supported
- fi
- else
- query="/ei-producer/v1/eiproducers"
- if [ $# -gt 1 ] && [ $2 != "NOTYPE" ]; then
- query=$query"?ei_type_id=$2"
- fi
+ query="/data-producer/v1/info-producers"
+ if [ $# -gt 1 ] && [ $2 != "NOTYPE" ]; then
+ query=$query"?info_type_id=$2&infoTypeId=$2" #info_type_id changed to infoTypeId in F-release.
+ #Remove info_type_id when F-release is no longer supported
fi
res="$(__do_curl_to_api ICS GET $query)"
status=${res:${#res}-3}
@@ -1228,20 +1100,14 @@
if [ $# -eq 3 ]; then
paramError=0
fi
- if [[ "$ICS_FEATURE_LEVEL" == *"INFO-TYPE-INFO"* ]]; then
- if [ $# -eq 4 ]; then
- paramError=0
- fi
+ if [ $# -eq 4 ]; then
+ paramError=0
fi
if [ $paramError -ne 0 ]; then
__print_err "<response-code> <type-id> [<job-schema-file> [ <info-type-info> ]]" $@
return 1
fi
- if [[ "$ICS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
- query="/data-producer/v1/info-types/$2"
- else
- query="/ei-producer/v1/eitypes/$2"
- fi
+ query="/data-producer/v1/info-types/$2"
res="$(__do_curl_to_api ICS GET $query)"
status=${res:${#res}-3}
@@ -1269,11 +1135,7 @@
fi
info_data=",\"info_type_information\":$info_data"
fi
- if [[ "$ICS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
- targetJson="{\"info_job_data_schema\":$schema $info_data}"
- else
- targetJson="{\"ei_job_data_schema\":$schema}"
- fi
+ targetJson="{\"info_job_data_schema\":$schema $info_data}"
echo " TARGET JSON: $targetJson" >> $HTTPLOG
res=$(python3 ../common/compare_json.py "$targetJson" "$body")
@@ -1294,16 +1156,9 @@
ics_api_edp_put_type_2() {
__log_test_start $@
- if [[ "$ICS_FEATURE_LEVEL" == *"INFO-TYPE-INFO"* ]]; then
- if [ $# -lt 3 ] || [ $# -gt 4 ]; then
- __print_err "<response-code> <type-id> <job-schema-file> [ <info-type-info> ]" $@
- return 1
- fi
- else
- if [ $# -ne 3 ]; then
- __print_err "<response-code> <type-id> <job-schema-file>" $@
- return 1
- fi
+ if [ $# -lt 3 ] || [ $# -gt 4 ]; then
+ __print_err "<response-code> <type-id> <job-schema-file> [ <info-type-info> ]" $@
+ return 1
fi
if [ ! -f $3 ]; then
@@ -1322,21 +1177,12 @@
info_data=",\"info_type_information\":$info_data"
fi
- if [[ "$ICS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
- schema=$(cat $3)
- input_json="{\"info_job_data_schema\":$schema $info_data}"
- file="./tmp/put_type.json"
- echo $input_json > $file
+ schema=$(cat $3)
+ input_json="{\"info_job_data_schema\":$schema $info_data}"
+ file="./tmp/put_type.json"
+ echo $input_json > $file
- query="/data-producer/v1/info-types/$2"
- else
- schema=$(cat $3)
- input_json="{\"ei_job_data_schema\":$schema}"
- file="./tmp/put_type.json"
- echo $input_json > $file
-
- query="/ei-producer/v1/eitypes/$2"
- fi
+ query="/data-producer/v1/info-types/$2"
res="$(__do_curl_to_api ICS PUT $query $file)"
status=${res:${#res}-3}
@@ -1361,11 +1207,7 @@
return 1
fi
- if [[ "$ICS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
- query="/data-producer/v1/info-types/$2"
- else
- query="/ei-producer/v1/eitypes/$2"
- fi
+ query="/data-producer/v1/info-types/$2"
res="$(__do_curl_to_api ICS DELETE $query)"
status=${res:${#res}-3}
@@ -1470,11 +1312,7 @@
__print_err "<response-code> <producer-id> [<job-callback> <supervision-callback> (EMPTY | <type-id>+) ]" $@
return 1
fi
- if [[ "$ICS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
- query="/data-producer/v1/info-producers/$2"
- else
- query="/ei-producer/v1/eiproducers/$2"
- fi
+ query="/data-producer/v1/info-producers/$2"
res="$(__do_curl_to_api ICS GET $query)"
status=${res:${#res}-3}
@@ -1497,11 +1335,7 @@
fi
targetJson=$targetJson"]"
if [ $# -gt 4 ]; then
- if [[ "$ICS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
- targetJson="{\"supported_info_types\":$targetJson,\"info_job_callback_url\": \"$3\",\"info_producer_supervision_callback_url\": \"$4\"}"
- else
- targetJson="{\"supported_ei_types\":$targetJson,\"ei_job_callback_url\": \"$3\",\"ei_producer_supervision_callback_url\": \"$4\"}"
- fi
+ targetJson="{\"supported_info_types\":$targetJson,\"info_job_callback_url\": \"$3\",\"info_producer_supervision_callback_url\": \"$4\"}"
fi
echo " TARGET JSON: $targetJson" >> $HTTPLOG
res=$(python3 ../common/compare_json.py "$targetJson" "$body")
@@ -1527,11 +1361,7 @@
__print_err "<response-code> <producer-id>" $@
return 1
fi
- if [[ "$ICS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
- query="/data-producer/v1/info-producers/$2"
- else
- query="/ei-producer/v1/eiproducers/$2"
- fi
+ query="/data-producer/v1/info-producers/$2"
res="$(__do_curl_to_api ICS DELETE $query)"
status=${res:${#res}-3}
@@ -1628,27 +1458,15 @@
inputJson=$inputJson"\""${arr[$i]}"\""
done
fi
- if [[ "$ICS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
- inputJson="\"supported_info_types\":"$inputJson"]"
+ inputJson="\"supported_info_types\":"$inputJson"]"
- inputJson=$inputJson",\"info_job_callback_url\": \"$3\",\"info_producer_supervision_callback_url\": \"$4\""
+ inputJson=$inputJson",\"info_job_callback_url\": \"$3\",\"info_producer_supervision_callback_url\": \"$4\""
- inputJson="{"$inputJson"}"
+ inputJson="{"$inputJson"}"
- file="./tmp/.p.json"
- echo "$inputJson" > $file
- query="/data-producer/v1/info-producers/$2"
- else
- inputJson="\"supported_ei_types\":"$inputJson"]"
-
- inputJson=$inputJson",\"ei_job_callback_url\": \"$3\",\"ei_producer_supervision_callback_url\": \"$4\""
-
- inputJson="{"$inputJson"}"
-
- file="./tmp/.p.json"
- echo "$inputJson" > $file
- query="/ei-producer/v1/eiproducers/$2"
- fi
+ file="./tmp/.p.json"
+ echo "$inputJson" > $file
+ query="/data-producer/v1/info-producers/$2"
res="$(__do_curl_to_api ICS PUT $query $file)"
status=${res:${#res}-3}
@@ -1748,11 +1566,7 @@
__print_err "<response-code> <producer-id> (EMPTY | [<job-id> <type-id> <target-url> <job-owner> <template-job-file>]+)" $@
return 1
fi
- if [[ "$ICS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
- query="/data-producer/v1/info-producers/$2/info-jobs"
- else
- query="/ei-producer/v1/eiproducers/$2/eijobs"
- fi
+ query="/data-producer/v1/info-producers/$2/info-jobs"
res="$(__do_curl_to_api ICS GET $query)"
status=${res:${#res}-3}
if [ $status -ne $1 ]; then
@@ -1775,11 +1589,8 @@
__log_test_fail_general "Job template file "${arr[$i+4]}", does not exist"
return 1
fi
- if [[ "$ICS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
- targetJson=$targetJson"{\"info_job_identity\":\"${arr[$i]}\",\"info_type_identity\":\"${arr[$i+1]}\",\"target_uri\":\"${arr[$i+2]}\",\"owner\":\"${arr[$i+3]}\",\"info_job_data\":$jobfile, \"last_updated\":\"????\"}"
- else
- targetJson=$targetJson"{\"ei_job_identity\":\"${arr[$i]}\",\"ei_type_identity\":\"${arr[$i+1]}\",\"target_uri\":\"${arr[$i+2]}\",\"owner\":\"${arr[$i+3]}\",\"ei_job_data\":$jobfile, \"last_updated\":\"????\"}"
- fi
+ targetJson=$targetJson"{\"info_job_identity\":\"${arr[$i]}\",\"info_type_identity\":\"${arr[$i+1]}\",\"target_uri\":\"${arr[$i+2]}\",\"owner\":\"${arr[$i+3]}\",\"info_job_data\":$jobfile, \"last_updated\":\"????\"}"
+
done
fi
targetJson=$targetJson"]"
@@ -2405,11 +2216,7 @@
ics_api_admin_reset() {
__log_test_start $@
- if [ -z "$FLAT_A1_EI" ]; then
- query="/A1-EI/v1/eitypes/$2/eijobs"
- else
- query="/A1-EI/v1/eijobs"
- fi
+ query="/A1-EI/v1/eijobs"
res="$(__do_curl_to_api ICS GET $query)"
status=${res:${#res}-3}
@@ -2426,18 +2233,14 @@
list=$(echo ${list//\"/})
list=$list" "
for job in $list; do
- if [ -z "$FLAT_A1_EI" ]; then
- echo "Not supported for non-flat EI api"
- else
- query="/A1-EI/v1/eijobs/$job"
- res="$(__do_curl_to_api ICS DELETE $query)"
- status=${res:${#res}-3}
- if [ $status -ne 204 ]; then
- __log_test_fail_status_code $1 $status
- return 1
- fi
- echo " Deleted job: "$job
+ query="/A1-EI/v1/eijobs/$job"
+ res="$(__do_curl_to_api ICS DELETE $query)"
+ status=${res:${#res}-3}
+ if [ $status -ne 204 ]; then
+ __log_test_fail_status_code $1 $status
+ return 1
fi
+ echo " Deleted job: "$job
done
__log_test_pass
diff --git a/test/common/prodstub_api_functions.sh b/test/common/prodstub_api_functions.sh
index 7dbef77..c70cd13 100644
--- a/test/common/prodstub_api_functions.sh
+++ b/test/common/prodstub_api_functions.sh
@@ -1,7 +1,7 @@
#!/bin/bash
# ============LICENSE_START===============================================
-# Copyright (C) 2020 Nordix Foundation. All rights reserved.
+# Copyright (C) 2020-2023 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.
@@ -450,11 +450,8 @@
__log_test_fail_general "Template file "$7" for jobdata, does not exist"
return 1
fi
- if [[ "$ICS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
- targetJson="{\"info_job_identity\":\"$3\",\"info_type_identity\":\"$4\",\"target_uri\":\"$5\",\"owner\":\"$6\", \"info_job_data\":$jobfile,\"last_updated\":\"????\"}"
- else
- targetJson="{\"ei_job_identity\":\"$3\",\"ei_type_identity\":\"$4\",\"target_uri\":\"$5\",\"owner\":\"$6\", \"ei_job_data\":$jobfile,\"last_updated\":\"????\"}"
- fi
+ targetJson="{\"ei_job_identity\":\"$3\",\"ei_type_identity\":\"$4\",\"target_uri\":\"$5\",\"owner\":\"$6\", \"ei_job_data\":$jobfile,\"last_updated\":\"????\"}"
+
file="./tmp/.p.json"
echo "$targetJson" > $file
diff --git a/test/common/ricmediatorsim_api_functions.sh b/test/common/ricmediatorsim_api_functions.sh
new file mode 100644
index 0000000..93c2db2
--- /dev/null
+++ b/test/common/ricmediatorsim_api_functions.sh
@@ -0,0 +1,566 @@
+#!/bin/bash
+
+# ============LICENSE_START===============================================
+# Copyright (C) 2023 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 container/service management functions and test functions for RICMEDIATORSIM A1 simulators
+
+################ Test engine functions ################
+
+# Create the image var used during the test
+# arg: <image-tag-suffix> (selects staging, snapshot, release etc)
+# <image-tag-suffix> is present only for images with staging, snapshot,release tags
+__RICMEDIATORSIM_imagesetup() {
+ __check_and_create_image_var RICMEDIATORSIM "RICMEDIATOR_SIM_IMAGE" "RICMEDIATOR_SIM_IMAGE_BASE" "RICMEDIATOR_SIM_IMAGE_TAG" REMOTE_RELEASE_ORAN "$RICMEDIATOR_SIM_DISPLAY_NAME"
+ __check_and_create_image_var RICMEDIATORSIM "RICMEDIATOR_SIM_DB_IMAGE" "RICMEDIATOR_SIM_DB_IMAGE_BASE" "RICMEDIATOR_SIM_DB_IMAGE_TAG" REMOTE_RELEASE_ORAN "$RICMEDIATOR_SIM_DB_DISPLAY_NAME"
+}
+
+# Pull image from remote repo or use locally built image
+# arg: <pull-policy-override> <pull-policy-original>
+# <pull-policy-override> Shall be used for images allowing overriding. For example use a local image when test is started to use released images
+# <pull-policy-original> Shall be used for images that does not allow overriding
+# Both var may contain: 'remote', 'remote-remove' or 'local'
+__RICMEDIATORSIM_imagepull() {
+ __check_and_pull_image $1 "$RICMEDIATOR_SIM_DISPLAY_NAME" $RICMEDIATOR_SIM_PREFIX"_"$RICMEDIATOR_SIM_BASE RICMEDIATOR_SIM_IMAGE
+ __check_and_pull_image $1 "$RICMEDIATOR_SIM_DB_DISPLAY_NAME" $RICMEDIATOR_SIM_PREFIX"_"$RICMEDIATOR_SIM_BASE RICMEDIATOR_SIM_DB_IMAGE
+}
+
+# Build image (only for simulator or interfaces stubs owned by the test environment)
+# arg: <image-tag-suffix> (selects staging, snapshot, release etc)
+# <image-tag-suffix> is present only for images with staging, snapshot,release tags
+__RICMEDIATORSIM_imagebuild() {
+ echo -e $RED" Image for app RICMEDIATORSIM shall never be built"$ERED
+}
+
+# Generate a string for each included image using the app display name and a docker images format string
+# If a custom image repo is used then also the source image from the local repo is listed
+# arg: <docker-images-format-string> <file-to-append>
+__RICMEDIATORSIM_image_data() {
+ echo -e "$RICMEDIATOR_SIM_DISPLAY_NAME\t$(docker images --format $1 $RICMEDIATOR_SIM_IMAGE)" >> $2
+ if [ ! -z "$RICMEDIATOR_SIM_IMAGE_SOURCE" ]; then
+ echo -e "-- source image --\t$(docker images --format $1 $RICMEDIATOR_SIM_IMAGE_SOURCE)" >> $2
+ fi
+ echo -e "$RICMEDIATOR_SIM_DB_DISPLAY_NAME\t$(docker images --format $1 $RICMEDIATOR_SIM_DB_IMAGE)" >> $2
+ if [ ! -z "$RICMEDIATOR_SIM_DB_IMAGE_SOURCE" ]; then
+ echo -e "-- source image --\t$(docker images --format $1 $RICMEDIATOR_SIM_DB_IMAGE_SOURCE)" >> $2
+ fi
+}
+
+# Scale kubernetes resources to zero
+# All resources shall be ordered to be scaled to 0, if relevant. If not relevant to scale, then do no action.
+# This function is called for apps fully managed by the test script
+__RICMEDIATORSIM_kube_scale_zero() {
+ __kube_scale_all_resources $KUBE_A1SIM_NAMESPACE autotest RICMEDIATORSIM
+}
+
+# Scale kubernetes resources to zero and wait until this has been accomplished, if relevant. If not relevant to scale, then do no action.
+# This function is called for prestarted apps not managed by the test script.
+__RICMEDIATORSIM_kube_scale_zero_and_wait() {
+ __kube_scale_and_wait_all_resources $KUBE_A1SIM_NAMESPACE app $KUBE_A1SIM_NAMESPACE"-neara1simulator"
+}
+
+# Delete all kube resouces for the app
+# This function is called for apps managed by the test script.
+__RICMEDIATORSIM_kube_delete_all() {
+ __kube_delete_all_resources $KUBE_A1SIM_NAMESPACE autotest RICMEDIATORSIM
+}
+
+# Store docker logs
+# This function is called for apps managed by the test script.
+# args: <log-dir> <file-prexix>
+__RICMEDIATORSIM_store_docker_logs() {
+ if [ $RUNMODE == "KUBE" ]; then
+ for podname in $(kubectl $KUBECONF get pods -n $KUBE_A1SIM_NAMESPACE -l "autotest=RICMEDIATORSIM" -o custom-columns=":metadata.name"); do
+ kubectl $KUBECONF logs -n $KUBE_A1SIM_NAMESPACE $podname --tail=-1 > $1$2_$podname.log 2>&1
+ done
+ else
+
+ RICMEDIATORs=$(docker ps --filter "name=$RICMEDIATOR_SIM_PREFIX" --filter "network=$DOCKER_SIM_NWNAME" --filter "status=running" --filter "label=orana1sim" --format {{.Names}})
+ for ric in $rics; do
+ docker logs $ric > $1$2_$ric.log 2>&1
+ done
+ fi
+}
+
+# Initial setup of protocol, host and ports
+# This function is called for apps managed by the test script.
+# args: -
+__RICMEDIATORSIM_initial_setup() {
+ use_ricmediator_simulator_http
+}
+
+# Set app short-name, app name and namespace for logging runtime statistics of kubernets pods or docker containers
+# For docker, the namespace shall be excluded
+# This function is called for apps managed by the test script as well as for prestarted apps.
+# args: -
+__RICMEDIATORSIM_statisics_setup() {
+ for ((RICMEDIATOR_SIMINSTANCE=10; RICMEDIATOR_SIMINSTANCE>0; RICMEDIATOR_SIMINSTANCE-- )); do
+ if [ $RUNMODE == "KUBE" ]; then
+ RICMEDIATOR_SIMINSTANCE_KUBE=$(($RICMEDIATOR_SIMINSTANCE-1))
+ echo -n " RICMEDIATOR_SIMG1_$RICMEDIATOR_SIMINSTANCE_KUBE ${RICMEDIATOR_SIM_PREFIX}-g1-$RICMEDIATOR_SIMINSTANCE_KUBE $KUBE_A1SIM_NAMESPACE "
+ echo -n " RICMEDIATOR_SIMG2_$RICMEDIATOR_SIMINSTANCE_KUBE ${RICMEDIATOR_SIM_PREFIX}-g2-$RICMEDIATOR_SIMINSTANCE_KUBE $KUBE_A1SIM_NAMESPACE "
+ echo -n " RICMEDIATOR_SIMG3_$RICMEDIATOR_SIMINSTANCE_KUBE ${RICMEDIATOR_SIM_PREFIX}-g3-$RICMEDIATOR_SIMINSTANCE_KUBE $KUBE_A1SIM_NAMESPACE "
+ echo -n " RICMEDIATOR_SIMG4_$RICMEDIATOR_SIMINSTANCE_KUBE ${RICMEDIATOR_SIM_PREFIX}-g4-$RICMEDIATOR_SIMINSTANCE_KUBE $KUBE_A1SIM_NAMESPACE "
+ else
+ if [ $DOCKER_COMPOSE_VERSION == "V1" ]; then
+ echo -n " RICMEDIATOR_SIMG1_$RICMEDIATOR_SIMINSTANCE ${RICMEDIATOR_SIM_PREFIX}_g1_$RICMEDIATOR_SIMINSTANCE "
+ echo -n " RICMEDIATOR_SIMG2_$RICMEDIATOR_SIMINSTANCE ${RICMEDIATOR_SIM_PREFIX}_g2_$RICMEDIATOR_SIMINSTANCE "
+ echo -n " RICMEDIATOR_SIMG3_$RICMEDIATOR_SIMINSTANCE ${RICMEDIATOR_SIM_PREFIX}_g3_$RICMEDIATOR_SIMINSTANCE "
+ echo -n " RICMEDIATOR_SIMG4_$RICMEDIATOR_SIMINSTANCE ${RICMEDIATOR_SIM_PREFIX}_g4_$RICMEDIATOR_SIMINSTANCE "
+ else
+ echo -n " RICMEDIATOR_SIMG1_$RICMEDIATOR_SIMINSTANCE ${RICMEDIATOR_SIM_PREFIX}-g1-$RICMEDIATOR_SIMINSTANCE "
+ echo -n " RICMEDIATOR_SIMG2_$RICMEDIATOR_SIMINSTANCE ${RICMEDIATOR_SIM_PREFIX}-g2-$RICMEDIATOR_SIMINSTANCE "
+ echo -n " RICMEDIATOR_SIMG3_$RICMEDIATOR_SIMINSTANCE ${RICMEDIATOR_SIM_PREFIX}-g3-$RICMEDIATOR_SIMINSTANCE "
+ echo -n " RICMEDIATOR_SIMG4_$RICMEDIATOR_SIMINSTANCE ${RICMEDIATOR_SIM_PREFIX}-g4-$RICMEDIATOR_SIMINSTANCE "
+ fi
+ fi
+ done
+}
+
+# Check application requirements, e.g. helm, the the test needs. Exit 1 if req not satisfied
+# args: -
+__RICMEDIATORSIM_test_requirements() {
+ :
+}
+
+#######################################################
+
+
+RICMEDIATOR_SIM_HTTPX="http"
+RICMEDIATOR_SIM_PORT=$RICMEDIATOR_SIM_INTERNAL_PORT
+
+
+#Vars for container count
+G1_COUNT=0
+G2_COUNT=0
+G3_COUNT=0
+G4_COUNT=0
+G5_COUNT=0
+
+
+###########################
+### RICMEDIATOR Simulator functions
+###########################
+
+use_ricmediator_simulator_http() {
+ echo -e $BOLD"RICMEDIATORSIM protocol setting"$EBOLD
+ echo -e " Using $BOLD http $EBOLD towards the simulators"
+ RICMEDIATOR_SIM_HTTPX="http"
+ RICMEDIATOR_SIM_PORT=$RICMEDIATOR_SIM_INTERNAL_PORT
+ echo ""
+}
+
+use_ricmediator_simulator_https() {
+ __log_test_fail_not_supported
+}
+
+# Start one group (ricsim_g1, ricsim_g2 .. ricsim_g5) with a number of RIC Simulators using a given A interface
+# 'ricsim' may be set on command line to other prefix
+# args: ricsim_g1|ricsim_g2|ricsim_g3|ricsim_g4|ricsim_g5 <count> <interface-id>
+# (Function for test scripts)
+start_ricmediator_simulators() {
+
+ echo -e $BOLD"Starting $RICMEDIATOR_SIM_DISPLAY_NAME"$EBOLD
+
+ if [ $RUNMODE == "KUBE" ]; then
+
+ # Check if app shall be fully managed by the test script
+ __check_included_image "RICMEDIATORSIM"
+ retcode_i=$?
+
+ # Check if app shall only be used by the testscipt
+ __check_prestarted_image "RICMEDIATORSIM"
+ retcode_p=$?
+
+ if [ $retcode_i -ne 0 ] && [ $retcode_p -ne 0 ]; then
+ echo -e $RED"The $1 app is not included as managed nor prestarted in this test script"$ERED
+ echo -e $RED"The $1 will not be started"$ERED
+ exit
+ fi
+ if [ $retcode_i -eq 0 ] && [ $retcode_p -eq 0 ]; then
+ echo -e $RED"The $1 stub app is included both as managed and prestarted in this test script"$ERED
+ echo -e $RED"The $1 will not be started"$ERED
+ exit
+ fi
+
+ if [ $retcode_p -eq 0 ]; then
+ echo -e " Using existing $1 statefulset and service"
+ echo " Using existing simulator deployment and service for statefulset $1"
+ echo " Setting $1 replicas=$2"
+ __kube_scale statefulset $1 $KUBE_A1SIM_NAMESPACE $2
+ echo ""
+ return
+ fi
+ fi
+
+ RICMEDIATOR1=$RICMEDIATOR_SIM_PREFIX"_g1"
+ RICMEDIATOR2=$RICMEDIATOR_SIM_PREFIX"_g2"
+ RICMEDIATOR3=$RICMEDIATOR_SIM_PREFIX"_g3"
+ RICMEDIATOR4=$RICMEDIATOR_SIM_PREFIX"_g4"
+ RICMEDIATOR5=$RICMEDIATOR_SIM_PREFIX"_g5"
+
+ if [ $# != 3 ]; then
+ ((RES_CONF_FAIL++))
+ __print_err "need three args, $RICMEDIATOR1|$RICMEDIATOR2|$RICMEDIATOR3|$RICMEDIATOR4|$RICMEDIATOR5 <count> <interface-id>" $@
+ exit 1
+ fi
+
+ echo " $2 simulators using basename: $1 on interface: $3"
+ #Set env var for simulator count and A1 interface vesion for the given group
+ if [ $1 == "$RICMEDIATOR1" ]; then
+ G1_COUNT=$2
+ elif [ $1 == "$RICMEDIATOR2" ]; then
+ G2_COUNT=$2
+ elif [ $1 == "$RICMEDIATOR3" ]; then
+ G3_COUNT=$2
+ elif [ $1 == "$RICMEDIATOR4" ]; then
+ G4_COUNT=$2
+ elif [ $1 == "$RICMEDIATOR5" ]; then
+ G5_COUNT=$2
+ else
+ ((RES_CONF_FAIL++))
+ __print_err "need three args, $RICMEDIATOR1|$RICMEDIATOR2|$RICMEDIATOR3|$RICMEDIATOR4|$RICMEDIATOR5 <count> <interface-id>" $@
+ exit 1
+ fi
+
+ if [ $RUNMODE == "KUBE" ]; then
+
+ if [ $retcode_i -eq 0 ]; then
+
+ #export needed env var for statefulset
+ export RICMEDIATOR_SIM_SET_NAME=$(echo "$1" | tr '_' '-') #kube does not accept underscore in names
+ export KUBE_A1SIM_NAMESPACE
+ export RICMEDIATOR_SIM_IMAGE
+ export RICMEDIATOR_SIM_DB_IMAGE
+ #Adding 1 more instance, instance 0 is never used. This is done to keep test scripts compatible
+ # with docker that starts instance index on 1.....
+ export RICMEDIATOR_SIM_COUNT=$(($2+1))
+ export A1_VERSION=$3
+ export RICMEDIATOR_SIM_INTERNAL_PORT
+ export RICMEDIATOR_SIM_INTERNAL_SECURE_PORT
+
+ echo -e " Creating $RICMEDIATOR_SIM_PREFIX app and expose service"
+
+ #Check if nonrtric namespace exists, if not create it
+ __kube_create_namespace $KUBE_A1SIM_NAMESPACE
+
+ # Create service
+ input_yaml=$SIM_GROUP"/"$RICMEDIATOR_SIM_COMPOSE_DIR"/"svc.yaml
+ output_yaml=$PWD/tmp/ric_${1}_svc.yaml
+ __kube_create_instance service $RICMEDIATOR_SIM_SET_NAME $input_yaml $output_yaml
+
+ # Create app
+ input_yaml=$SIM_GROUP"/"$RICMEDIATOR_SIM_COMPOSE_DIR"/"app.yaml
+ output_yaml=$PWD/tmp/ric_${1}_app.yaml
+ __kube_create_instance app $RICMEDIATOR_SIM_SET_NAME $input_yaml $output_yaml
+
+ #Using only instance from index 1 to keep compatability with docker
+ for (( count=1; count<${RICMEDIATOR_SIM_COUNT}; count++ )); do
+ host=$(__find_ricmediatorsim_host $RICMEDIATOR_SIM_SET_NAME"-"$count)
+ __check_service_start $RICMEDIATOR_SIM_SET_NAME"-"$count $host$RICMEDIATOR_SIM_ALIVE_URL
+ done
+ fi
+ else
+ __check_included_image 'RICMEDIATORSIM'
+ if [ $? -eq 1 ]; then
+ echo -e $RED"The Near-RT RICMEDIATOR Simulator app is not included as managed in this test script"$ERED
+ echo -e $RED"Near-RT RICMEDIATOR Simulator will not be started"$ERED
+ exit 1
+ fi
+
+ # Create .env file to compose project, all ric container will get this prefix
+ echo "COMPOSE_PROJECT_NAME="$RICMEDIATOR_SIM_PREFIX > $SIM_GROUP/$RICMEDIATOR_SIM_COMPOSE_DIR/.env
+
+ #extract service name (group), g1, g2, g3, g4 or g5 from var $1
+ #E.g. ricsim_g1 -> g1 is the service name
+ TMP_GRP=$1
+ RICMEDIATOR_SIMCOMPOSE_SERVICE_NAME=$(echo "${TMP_GRP##*_}")
+
+ export RICMEDIATOR_SIMCOMPOSE_A1_VERSION=$3
+ export RICMEDIATOR_SIMCOMPOSE_SERVICE_NAME
+ export RICMEDIATOR_SIM_INTERNAL_PORT
+ export RICMEDIATOR_SIM_INTERNAL_SECURE_PORT
+ export RICMEDIATOR_SIM_CERT_MOUNT_DIR
+ export DOCKER_SIM_NWNAME
+ export RICMEDIATOR_SIM_DISPLAY_NAME
+
+ docker_args=" --scale $RICMEDIATOR_SIMCOMPOSE_SERVICE_NAME=$2"
+
+ #Create a list of contsiner names
+ #Will be <ricsim-prefix>_<service-name>_<index>
+ # or
+ # <ricsim-prefix>-<service-name>-<index>
+ app_data=""
+ cntr=1
+ if [ $DOCKER_COMPOSE_VERSION == "V1" ]; then
+ app_name_prefix=$RICMEDIATOR_SIM_PREFIX"_"$RICMEDIATOR_SIMCOMPOSE_SERVICE_NAME"_"
+ else
+ app_name_prefix=$RICMEDIATOR_SIM_PREFIX"-"$RICMEDIATOR_SIMCOMPOSE_SERVICE_NAME"-"
+ fi
+ while [ $cntr -le $2 ]; do
+ app=$app_name_prefix$cntr
+ app_data="$app_data $app"
+ let cntr=cntr+1
+ done
+
+ __start_container $RICMEDIATOR_SIM_COMPOSE_DIR "" "$docker_args" $2 $app_data
+
+ cntr=1
+ while [ $cntr -le $2 ]; do
+ if [ $DOCKER_COMPOSE_VERSION == "V1" ]; then
+ app=$RICMEDIATOR_SIM_PREFIX"_"$RICMEDIATOR_SIMCOMPOSE_SERVICE_NAME"_"$cntr
+ else
+ app=$RICMEDIATOR_SIM_PREFIX"-"$RICMEDIATOR_SIMCOMPOSE_SERVICE_NAME"-"$cntr
+ fi
+ __check_service_start $app $RICMEDIATOR_SIM_HTTPX"://"$app:$RICMEDIATOR_SIM_PORT$RICMEDIATOR_SIM_ALIVE_URL
+ let cntr=cntr+1
+ done
+
+ fi
+ echo ""
+ return 0
+}
+
+# Translate ric name to kube host name
+# args: <ric-name>
+# For test scripts
+get_kube_ricmediatorsim_host() {
+ name=$(echo "$1" | tr '_' '-') #kube does not accept underscore in names
+ #example gnb_1_2 -> gnb-1-2
+ set_name=$(echo $name | rev | cut -d- -f2- | rev) # Cut index part of ric name to get the name of statefulset
+ # example gnb-g1-2 -> gnb-g1 where gnb-g1-2 is the ric name and gnb-g1 is the set name
+ echo $name"."$set_name"."$KUBE_A1SIM_NAMESPACE
+}
+
+# Helper function to get a the port and host name of a specific ric simulator
+# args: <ric-id>
+# (Not for test scripts)
+__find_ricmediatorsim_host() {
+ if [ $RUNMODE == "KUBE" ]; then
+ ricname=$(echo "$1" | tr '_' '-') # Kube does not accept underscore in names as docker do
+ if [ -z "$RICMEDIATOR_SIM_COMMON_SVC_NAME" ]; then
+ ric_setname="${ricname%-*}" #Extract the stateful set name
+ else
+ ric_setname=$RICMEDIATOR_SIM_COMMON_SVC_NAME # Use the common svc name in the host name of the sims
+ fi
+ echo $RICMEDIATOR_SIM_HTTPX"://"$ricname.$ric_setname.$KUBE_A1SIM_NAMESPACE":"$RICMEDIATOR_SIM_PORT
+ else
+ if [ $DOCKER_COMPOSE_VERSION == "V1" ]; then
+ echo $RICMEDIATOR_SIM_HTTPX"://"$1":"$RICMEDIATOR_SIM_PORT
+ else
+ ricname=$(echo "$1" | tr '_' '-')
+ echo $RICMEDIATOR_SIM_HTTPX"://"$ricname":"$RICMEDIATOR_SIM_PORT
+ fi
+
+ fi
+}
+
+# Generate a UUID to use as prefix for policy ids
+nearsim_generate_policy_uuid() {
+ UUID=$(python3 -c 'import sys,uuid; sys.stdout.write(uuid.uuid4().hex)')
+ #Reduce length to make space for serial id, uses 'a' as marker where the serial id is added
+ UUID=${UUID:0:${#UUID}-4}"a"
+}
+
+# Excute a curl cmd towards a ricsimulator and check the response code.
+# args: <expected-response-code> <curl-cmd-string>
+__execute_curl_to_ricmediatorsim() {
+ echo ${FUNCNAME[1]} "line: "${BASH_LINENO[1]} >> $HTTPLOG
+ proxyflag=""
+ if [ ! -z "$KUBE_PROXY_PATH" ]; then
+ if [ $KUBE_PROXY_HTTPX == "http" ]; then
+ proxyflag=" --proxy $KUBE_PROXY_PATH"
+ else
+ proxyflag=" --proxy-insecure --proxy $KUBE_PROXY_PATH"
+ fi
+ fi
+ if [ -z "$KUBE_PROXY_CURL_JWT" ]; then
+ echo " CMD: $2 $proxyflag" >> $HTTPLOG
+ res="$($2 $proxyflag)"
+ else
+ echo " CMD: $2 $proxyflag -H Authorization: Bearer $KUBE_PROXY_CURL_JWT" >> $HTTPLOG
+ res=$($2 $proxyflag -H 'Authorization: Bearer '$KUBE_PROXY_CURL_JWT)
+ fi
+
+ echo " RESP: $res" >> $HTTPLOG
+ retcode=$?
+ if [ $retcode -ne 0 ]; then
+ ((RES_CONF_FAIL++))
+ echo " RETCODE: "$retcode
+ echo -e $RED" FAIL - fatal error when executing curl."$ERED
+ return 1
+ fi
+ status=${res:${#res}-3}
+ if [ $status -eq $1 ]; then
+ echo -e $GREEN" OK"$EGREEN
+ return 0
+ fi
+ echo -e $RED" FAIL - expected http response: "$1" but got http response: "$status $ERED
+ ((RES_CONF_FAIL++))
+ return 1
+}
+
+# Tests if a variable value in the ricsimulator is equal to a target value and and optional timeout.
+# Arg: <ric-id> <variable-name> <target-value> - This test set pass or fail depending on if the variable is
+# equal to the target or not.
+# Arg: <ric-id> <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)
+ricmediatorsim_equal() {
+ __log_test_fail_not_supported
+ # if [ $# -eq 3 ] || [ $# -eq 4 ]; then
+ # host=$(__find_ricmediatorsim_host $1)
+ # __var_test $1 "$host/counter/" $2 "=" $3 $4
+ # return 0
+ # else
+ # __print_err "needs three or four args: <ric-id> <sim-param> <target-value> [ timeout ]"
+ # return 1
+ # fi
+}
+
+# Print a variable value from the RICMEDIATOR sim.
+# args: <ric-id> <variable-name>
+# (Function for test scripts)
+ricmediatorsim_print() {
+ __log_test_info_not_supported
+ # if [ $# != 2 ]; then
+ # __print_err "need two args, <ric-id> <sim-param>" $@
+ # exit 1
+ # fi
+ # host=$(__find_ricmediatorsim_host $1)
+ # echo -e $BOLD"INFO(${BASH_LINENO[0]}): $1, $2 = $(__do_curl $host/counter/$2)"$EBOLD
+}
+
+# Tests if a variable value in the RICMEDIATOR simulator contains the target string and and optional timeout
+# Arg: <ric-id> <variable-name> <target-value> - This test set pass or fail depending on if the variable contains
+# the target or not.
+# Arg: <ric-id> <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 contains the target
+# value or not.
+# (Function for test scripts)
+ricmediatorsim_contains_str() {
+ __log_test_fail_not_supported
+ # if [ $# -eq 3 ] || [ $# -eq 4 ]; then
+ # host=$(__find_ricmediatorsim_host $1)
+ # __var_test $1 "$host/counter/" $2 "contain_str" $3 $4
+ # return 0
+ # else
+ # __print_err "needs three or four args: <ric-id> <sim-param> <target-value> [ timeout ]"
+ # return 1
+ # fi
+}
+
+# Simulator API: Put a policy type in a ric
+# args: <response-code> <ric-id> <policy-type-id> <policy-type-file>
+# (Function for test scripts)
+ricmediatorsim_put_policy_type() {
+ __log_conf_start $@
+ if [ $# -ne 4 ]; then
+ __print_err "<response-code> <ric-id> <policy-type-id> <policy-type-file>" $@
+ return 1
+ fi
+ host=$(__find_ricmediatorsim_host $2)
+ curlString="curl -X PUT -skw %{http_code} "$host"/a1-p/policytypes/"$3" -H Content-Type:application/json --data-binary @"$4
+ __execute_curl_to_ricmediatorsim $1 "$curlString"
+ return $?
+}
+
+# Simulator API: Delete a policy type in a ric
+# <response-code> <ric-id> <policy-type-id>
+# (Function for test scripts)
+ricmediatorsim_delete_policy_type() {
+ __log_conf_start $@
+ if [ $# -ne 3 ]; then
+ __print_err "<response-code> <ric-id> <policy_type_id>" $@
+ return 1
+ fi
+ host=$(__find_ricmediatorsim_host $2)
+ curlString="curl -X DELETE -skw %{http_code} "$host"/a1-p/policytypes/"$3
+ __execute_curl_to_ricmediatorsim $1 "$curlString"
+ return $?
+}
+
+# Simulator API: Delete instances (and status), for one ric
+# <response-code> <ric-id>
+# (Function for test scripts)
+ricmediatorsim_post_delete_instances() {
+ __log_test_fail_not_supported
+ # __log_conf_start $@
+ # if [ $# -ne 2 ]; then
+ # __print_err "<response-code> <ric-id>" $@
+ # return 1
+ # fi
+ # host=$(__find_ricmediatorsim_host $2)
+ # curlString="curl -X POST -skw %{http_code} "$host"/deleteinstances"
+ # __execute_curl_to_ricmediatorsim $1 "$curlString"
+ # return $?
+}
+
+# Simulator API: Delete all (instances/types/statuses/settings), for one ric
+# <response-code> <ric-id>
+# (Function for test scripts)
+ricmediatorsim_post_delete_all() {
+ __log_test_fail_not_supported
+ # __log_conf_start $@
+ # if [ $# -ne 2 ]; then
+ # __print_err "<response-code> <numericic-id>" $@
+ # return 1
+ # fi
+ # host=$(__find_ricmediatorsim_host $2)
+ # curlString="curl -X POST -skw %{http_code} "$host"/deleteall"
+ # __execute_curl_to_ricmediatorsim $1 "$curlString"
+ # return $?
+}
+
+# Simulator API: Set (or reset) response code for next A1 message, for one ric
+# <response-code> <ric-id> [<forced_response_code>]
+# (Function for test scripts)
+ricmediatorsim_post_forcedresponse() {
+ __log_test_fail_not_supported
+ # __log_conf_start $@
+ # if [ $# -ne 3 ]; then
+ # __print_err "<response-code> <ric-id> <forced_response_code>" $@
+ # return 1
+ # fi
+ # host=$(__find_ricmediatorsim_host $2)
+ # curlString="curl -X POST -skw %{http_code} "$host"/forceresponse"
+ # if [ $# -eq 3 ]; then
+ # curlString=$curlString"?code="$3
+ # fi
+ # __execute_curl_to_ricmediatorsim $1 "$curlString"
+ # return $?
+}
+
+# Simulator API: Set (or reset) A1 response delay, for one ric
+# <response-code> <ric-id> [<delay-in-seconds>]
+# (Function for test scripts)
+ricmediatorsim_post_forcedelay() {
+ __log_test_fail_not_supported
+ # __log_conf_start $@
+ # if [ $# -ne 3 ]; then
+ # __print_err "<response-code> <ric-id> [<delay-in-seconds>]" $@
+ # return 1
+ # fi
+ # host=$(__find_ricmediatorsim_host $2)
+ # curlString="curl -X POST -skw %{http_code} $host/forcedelay"
+ # if [ $# -eq 3 ]; then
+ # curlString=$curlString"?delay="$3
+ # fi
+ # __execute_curl_to_ricmediatorsim $1 "$curlString"
+ # return $?
+}
\ No newline at end of file
diff --git a/test/common/ricsim_api_functions.sh b/test/common/ricsim_api_functions.sh
index d71d11a..5e039b7 100644
--- a/test/common/ricsim_api_functions.sh
+++ b/test/common/ricsim_api_functions.sh
@@ -1,7 +1,7 @@
#!/bin/bash
# ============LICENSE_START===============================================
-# Copyright (C) 2020 Nordix Foundation. All rights reserved.
+# Copyright (C) 2020-2023 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.
@@ -77,7 +77,7 @@
done
else
- rics=$(docker ps --filter "name=$RIC_SIM_PREFIX" --filter "network=$DOCKER_SIM_NWNAME" --filter "status=running" --format {{.Names}})
+ rics=$(docker ps --filter "name=$RIC_SIM_PREFIX" --filter "network=$DOCKER_SIM_NWNAME" --filter "status=running" --filter "label=a1sim" --format {{.Names}})
for ric in $rics; do
docker logs $ric > $1$2_$ric.log 2>&1
done
@@ -286,7 +286,8 @@
export DOCKER_SIM_NWNAME
export RIC_SIM_DISPLAY_NAME
- docker_args=" --scale $RICSIM_COMPOSE_SERVICE_NAME=$2"
+ echo -e $BOLD$YELLOW" Warning: Using docker compose --force-recreate "$EYELLOW$EBOLD
+ docker_args="--force-recreate --scale $RICSIM_COMPOSE_SERVICE_NAME=$2"
#Create a list of contsiner names
#Will be <ricsim-prefix>_<service-name>_<index>
@@ -358,7 +359,7 @@
}
# Generate a UUID to use as prefix for policy ids
-generate_policy_uuid() {
+sim_generate_policy_uuid() {
UUID=$(python3 -c 'import sys,uuid; sys.stdout.write(uuid.uuid4().hex)')
#Reduce length to make space for serial id, uses 'a' as marker where the serial id is added
UUID=${UUID:0:${#UUID}-4}"a"
diff --git a/test/common/sdnc_api_functions.sh b/test/common/sdnc_api_functions.sh
index bab9474..2701957 100644
--- a/test/common/sdnc_api_functions.sh
+++ b/test/common/sdnc_api_functions.sh
@@ -1,7 +1,7 @@
#!/bin/bash
# ============LICENSE_START===============================================
-# Copyright (C) 2020 Nordix Foundation. All rights reserved.
+# Copyright (C) 2020-2023 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.
@@ -638,4 +638,37 @@
__log_test_pass
return 0
-}
\ No newline at end of file
+}
+
+# Wait for http status on url
+# args: <response-code> <ric-id>
+# (Function for test scripts)
+controller_api_wait_for_status_ok() {
+ __log_conf_start $@
+
+ if [ $# -ne 2 ]; then
+ __print_err "<response-code> <ric-id> " $@
+ return 1
+ fi
+ ric_id=$(__find_sim_host $2)
+ url="$ric_id/"
+
+ TS_START=$SECONDS
+ while [ $(($TS_START+500)) -gt $SECONDS ]; do
+ echo -ne " Waiting for http status $1 on $url via sdnc, waited: $(($SECONDS-$TS_START))"$SAMELINE
+ res=$(__do_curl_to_controller getA1Policy "$url")
+ retcode=$?
+ status=${res:${#res}-3}
+ if [ $retcode -eq 0 ]; then
+ if [ $status -eq $1 ]; then
+ echo ""
+ __log_conf_ok
+ return 0
+ fi
+ fi
+ sleep 5
+ done
+ echo ""
+ __log_conf_fail_general
+ return 1
+}
diff --git a/test/common/test_env-onap-jakarta.sh b/test/common/test_env-onap-jakarta.sh
index 7383ddf..98a016b 100644
--- a/test/common/test_env-onap-jakarta.sh
+++ b/test/common/test_env-onap-jakarta.sh
@@ -1,7 +1,7 @@
#!/bin/bash
# ============LICENSE_START===============================================
-# Copyright (C) 2021 Nordix Foundation. All rights reserved.
+# Copyright (C) 2021-2023 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.
@@ -221,8 +221,7 @@
ICS_COMPOSE_DIR="ics" # Dir in simulator_group for docker-compose
ICS_CONFIG_MOUNT_PATH=/opt/app/information-coordinator-service/config # Internal container path for configuration
ICS_CONFIG_FILE=application.yaml # Config file name
-ICS_VERSION="V1-2" # Version where the types are added in the producer registration
-ICS_FEATURE_LEVEL="INFO-TYPES" # Space separated list of features
+ICS_FEATURE_LEVEL="" # Space separated list of features
MR_DMAAP_APP_NAME="message-router" # Name for the Dmaap MR
MR_STUB_APP_NAME="mr-stub" # Name of the MR stub
@@ -305,7 +304,7 @@
SDNC_PWD="Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U" # SNDC PWD
SDNC_API_URL="/rests/operations/A1-ADAPTER-API:" # Base url path for SNDC API (for upgraded sdnc)
#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_ALIVE_URL="/apidoc/explorer/index.html" # Base url path for SNDC API docs (for alive check)
SDNC_COMPOSE_DIR="sdnc"
SDNC_COMPOSE_FILE="docker-compose-2.yml"
SDNC_KUBE_APP_FILE="app2.yaml"
diff --git a/test/common/test_env-onap-kohn.sh b/test/common/test_env-onap-kohn.sh
index cb6c1f7..35aba16 100644
--- a/test/common/test_env-onap-kohn.sh
+++ b/test/common/test_env-onap-kohn.sh
@@ -1,7 +1,7 @@
#!/bin/bash
# ============LICENSE_START===============================================
-# Copyright (C) 2021 Nordix Foundation. All rights reserved.
+# Copyright (C) 2021-2023 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.
@@ -221,8 +221,7 @@
ICS_COMPOSE_DIR="ics" # Dir in simulator_group for docker-compose
ICS_CONFIG_MOUNT_PATH=/opt/app/information-coordinator-service/config # Internal container path for configuration
ICS_CONFIG_FILE=application.yaml # Config file name
-ICS_VERSION="V1-2" # Version where the types are added in the producer registration
-ICS_FEATURE_LEVEL="INFO-TYPES" # Space separated list of features
+ICS_FEATURE_LEVEL="" # Space separated list of features
MR_DMAAP_APP_NAME="message-router" # Name for the Dmaap MR
MR_STUB_APP_NAME="mr-stub" # Name of the MR stub
diff --git a/test/common/test_env-onap-london.sh b/test/common/test_env-onap-london.sh
index dd4c5b3..1ddf958 100644
--- a/test/common/test_env-onap-london.sh
+++ b/test/common/test_env-onap-london.sh
@@ -1,7 +1,7 @@
#!/bin/bash
# ============LICENSE_START===============================================
-# Copyright (C) 2021 Nordix Foundation. All rights reserved.
+# Copyright (C) 2023 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.
@@ -76,44 +76,37 @@
# SDNC A1 Controller remote image and tag
SDNC_A1_CONTROLLER_IMAGE_BASE="onap/sdnc-image"
-SDNC_A1_CONTROLLER_IMAGE_TAG_LOCAL="2.5.0-SNAPSHOT" ###CHECK THIS
-SDNC_A1_CONTROLLER_IMAGE_TAG_REMOTE_SNAPSHOT="2.5.0-STAGING-latest"
-SDNC_A1_CONTROLLER_IMAGE_TAG_REMOTE="2.5.0-STAGING-latest" #Will use snapshot repo
-SDNC_A1_CONTROLLER_IMAGE_TAG_REMOTE_RELEASE="2.5.0"
-
-# SDNC A1 Controller remote image and tag
-SDNC_A1_CONTROLLER_IMAGE_BASE="onap/sdnc-image"
-SDNC_A1_CONTROLLER_IMAGE_TAG_LOCAL="2.4.2-SNAPSHOT" ###CHECK THIS
-SDNC_A1_CONTROLLER_IMAGE_TAG_REMOTE_SNAPSHOT="2.4.2-STAGING-latest"
-SDNC_A1_CONTROLLER_IMAGE_TAG_REMOTE="2.4.2-STAGING-latest" #Will use snapshot repo
-SDNC_A1_CONTROLLER_IMAGE_TAG_REMOTE_RELEASE="2.4.1"
+SDNC_A1_CONTROLLER_IMAGE_TAG_LOCAL="2.5.1-SNAPSHOT" ###CHECK THIS
+SDNC_A1_CONTROLLER_IMAGE_TAG_REMOTE_SNAPSHOT="2.5.1-STAGING-latest"
+SDNC_A1_CONTROLLER_IMAGE_TAG_REMOTE="2.5.1-STAGING-latest" #Will use snapshot repo
+SDNC_A1_CONTROLLER_IMAGE_TAG_REMOTE_RELEASE="2.5.1"
#SDNC DB remote image and tag
#The DB is part of SDNC so handled in the same way as SDNC
SDNC_DB_IMAGE_BASE="mariadb"
SDNC_DB_IMAGE_TAG_REMOTE_PROXY="10.5"
-# ICS image and tag - using f release
+# ICS image and tag - using g release
ICS_IMAGE_BASE="o-ran-sc/nonrtric-plt-informationcoordinatorservice"
-ICS_IMAGE_TAG_REMOTE_RELEASE_ORAN="1.3.1"
+ICS_IMAGE_TAG_REMOTE_RELEASE_ORAN="1.4.1"
#Note: Update var ICS_FEATURE_LEVEL if image version is changed
-# Control Panel image and tag - using f release
+# Control Panel image and tag - using g release
CONTROL_PANEL_IMAGE_BASE="o-ran-sc/nonrtric-controlpanel"
-CONTROL_PANEL_IMAGE_TAG_REMOTE_RELEASE_ORAN="2.3.0"
+CONTROL_PANEL_IMAGE_TAG_REMOTE_RELEASE_ORAN="2.4.0"
-# Gateway image and tags - used f release
+# Gateway image and tags - used g release
NRT_GATEWAY_IMAGE_BASE="o-ran-sc/nonrtric-gateway"
NRT_GATEWAY_IMAGE_TAG_REMOTE_RELEASE_ORAN="1.0.0"
-# RAPP Catalogue image and tags - used f release
+# RAPP Catalogue image and tags - used g release
RAPP_CAT_IMAGE_BASE="o-ran-sc/nonrtric-plt-rappcatalogue"
RAPP_CAT_IMAGE_TAG_REMOTE_RELEASE_ORAN="1.1.0"
-# Near RT RIC Simulator image and tags - used f release
+# Near RT RIC Simulator image and tags - used g release
RIC_SIM_IMAGE_BASE="o-ran-sc/a1-simulator"
-RIC_SIM_IMAGE_TAG_REMOTE_RELEASE_ORAN="2.3.1"
+RIC_SIM_IMAGE_TAG_REMOTE_RELEASE_ORAN="2.4.0"
#MR stub image and tag
MRSTUB_IMAGE_BASE="mrstub"
@@ -209,9 +202,9 @@
A1PMS_CONFIG_FILE="application.yaml" # Container config file name
A1PMS_DATA_FILE="application_configuration.json" # Container data file name
A1PMS_CONTAINER_MNT_DIR="/var/policy-management-service" # Mounted dir in the container
-A1PMS_FEATURE_LEVEL="" # Space separated list of features
-#Preparation for DMAAP removal
-#A1PMS_FEATURE_LEVEL="NO-DMAAP" # Space separated list of features
+A1PMS_FEATURE_LEVEL="NO-DMAAP ADAPTER-CLASS" # Space separated list of features
+A1PMS_ADAPTER_CLASS="" # Class name set by override file
+A1PMS_ADAPTER_POLICY_NAME="" # Policy name set by override file
ICS_APP_NAME="informationservice" # Name for ICS container
ICS_DISPLAY_NAME="Enrichment Coordinator Service" # Display name for ICS container
@@ -230,8 +223,7 @@
ICS_COMPOSE_DIR="ics" # Dir in simulator_group for docker-compose
ICS_CONFIG_MOUNT_PATH=/opt/app/information-coordinator-service/config # Internal container path for configuration
ICS_CONFIG_FILE=application.yaml # Config file name
-ICS_VERSION="V1-2" # Version where the types are added in the producer registration
-ICS_FEATURE_LEVEL="INFO-TYPES" # Space separated list of features
+ICS_FEATURE_LEVEL="" # Space separated list of features
MR_DMAAP_APP_NAME="message-router" # Name for the Dmaap MR
MR_STUB_APP_NAME="mr-stub" # Name of the MR stub
@@ -314,14 +306,14 @@
SDNC_PWD="Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U" # SNDC PWD
SDNC_API_URL="/rests/operations/A1-ADAPTER-API:" # Base url path for SNDC API (for upgraded sdnc)
#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_ALIVE_URL="/apidoc/explorer/index.html" # Base url path for SNDC API docs (for alive check)
SDNC_COMPOSE_DIR="sdnc"
SDNC_COMPOSE_FILE="docker-compose-2.yml"
SDNC_KUBE_APP_FILE="app2.yaml"
SDNC_KARAF_LOG="/opt/opendaylight/data/log/karaf.log" # Path to karaf log
SDNC_RESPONSE_JSON_KEY="A1-ADAPTER-API:output" # Key name for output json in replies from sdnc (for upgraded sdnc)
#SDNC_RESPONSE_JSON_KEY="output" # Key name for output json in replies from sdnc
-SDNC_FEATURE_LEVEL="TRANS_RESP_CODE" # Space separated list of features
+SDNC_FEATURE_LEVEL="TRANS_RESP_CODE NO_NB_HTTPS" # Space separated list of features
# TRANS_RESP_CODE: SDNC return southbound response code
RAPP_CAT_APP_NAME="rappcatalogueservice" # Name for the RAPP Catalogue
diff --git a/test/common/test_env-oran-f-release.sh b/test/common/test_env-oran-f-release.sh
index 42e3e54..9af7d91 100755
--- a/test/common/test_env-oran-f-release.sh
+++ b/test/common/test_env-oran-f-release.sh
@@ -1,7 +1,7 @@
#!/bin/bash
# ============LICENSE_START===============================================
-# Copyright (C) 2020 Nordix Foundation. All rights reserved.
+# Copyright (C) 2020-2023 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.
@@ -297,8 +297,7 @@
ICS_COMPOSE_DIR="ics" # Dir in simulator_group for docker-compose
ICS_CONFIG_MOUNT_PATH=/opt/app/information-coordinator-service/config # Internal container path for configuration
ICS_CONFIG_FILE=application.yaml # Config file name
-ICS_VERSION="V1-2" # Version where the types are decoupled from the producer registration
-ICS_FEATURE_LEVEL="INFO-TYPES TYPE-SUBSCRIPTIONS INFO-TYPE-INFO RESP_CODE_CHANGE_1 DEFAULT_TYPE_VALIDATION" # Space separated list of features
+ICS_FEATURE_LEVEL="TYPE-SUBSCRIPTIONS INFO-TYPE-INFO RESP_CODE_CHANGE_1 DEFAULT_TYPE_VALIDATION" # Space separated list of features
MR_DMAAP_APP_NAME="message-router" # Name for the Dmaap MR
MR_STUB_APP_NAME="mr-stub" # Name of the MR stub
diff --git a/test/common/test_env-oran-g-release.sh b/test/common/test_env-oran-g-release.sh
index cebdeb8..b07cb06 100755
--- a/test/common/test_env-oran-g-release.sh
+++ b/test/common/test_env-oran-g-release.sh
@@ -1,7 +1,7 @@
#!/bin/bash
# ============LICENSE_START===============================================
-# Copyright (C) 2020 Nordix Foundation. All rights reserved.
+# Copyright (C) 2020-2023 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.
@@ -297,8 +297,7 @@
ICS_COMPOSE_DIR="ics" # Dir in simulator_group for docker-compose
ICS_CONFIG_MOUNT_PATH=/opt/app/information-coordinator-service/config # Internal container path for configuration
ICS_CONFIG_FILE=application.yaml # Config file name
-ICS_VERSION="V1-2" # Version where the types are decoupled from the producer registration
-ICS_FEATURE_LEVEL="INFO-TYPES TYPE-SUBSCRIPTIONS INFO-TYPE-INFO RESP_CODE_CHANGE_1 DEFAULT_TYPE_VALIDATION" # Space separated list of features
+ICS_FEATURE_LEVEL="TYPE-SUBSCRIPTIONS INFO-TYPE-INFO RESP_CODE_CHANGE_1 DEFAULT_TYPE_VALIDATION" # Space separated list of features
MR_DMAAP_APP_NAME="message-router" # Name for the Dmaap MR
MR_STUB_APP_NAME="mr-stub" # Name of the MR stub
diff --git a/test/common/test_env-oran-h-release.sh b/test/common/test_env-oran-h-release.sh
index 96c88ca..365c06b 100755
--- a/test/common/test_env-oran-h-release.sh
+++ b/test/common/test_env-oran-h-release.sh
@@ -1,7 +1,7 @@
#!/bin/bash
# ============LICENSE_START===============================================
-# Copyright (C) 2020 Nordix Foundation. All rights reserved.
+# Copyright (C) 2020-2023 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.
@@ -16,7 +16,7 @@
# limitations under the License.
# ============LICENSE_END=================================================
#
-#Profile for ORAN Cherry
+#Profile for ORAN H release
TEST_ENV_PROFILE="ORAN-H-RELEASE"
FLAVOUR="ORAN"
@@ -83,10 +83,10 @@
# Gateway image and tags
NRT_GATEWAY_IMAGE_BASE="o-ran-sc/nonrtric-gateway"
-NRT_GATEWAY_IMAGE_TAG_LOCAL="1.1.0-SNAPSHOT"
-NRT_GATEWAY_IMAGE_TAG_REMOTE_SNAPSHOT="1.1.0-SNAPSHOT"
-NRT_GATEWAY_IMAGE_TAG_REMOTE="1.1.0"
-NRT_GATEWAY_IMAGE_TAG_REMOTE_RELEASE="1.0.0"
+NRT_GATEWAY_IMAGE_TAG_LOCAL="1.2.0-SNAPSHOT"
+NRT_GATEWAY_IMAGE_TAG_REMOTE_SNAPSHOT="1.2.0-SNAPSHOT"
+NRT_GATEWAY_IMAGE_TAG_REMOTE="1.2.0"
+NRT_GATEWAY_IMAGE_TAG_REMOTE_RELEASE="1.2.0"
# SDNC A1 Controller image and tags - Note using released honolulu ONAP image
@@ -122,13 +122,21 @@
RAPP_CAT_IMAGE_TAG_REMOTE_RELEASE="1.2.0"
-# Near RT RIC Simulator image and tags - same version as cherry
+# Near RT RIC Simulator image and tags
RIC_SIM_IMAGE_BASE="o-ran-sc/a1-simulator"
RIC_SIM_IMAGE_TAG_LOCAL="latest"
RIC_SIM_IMAGE_TAG_REMOTE_SNAPSHOT="2.5.0-SNAPSHOT"
RIC_SIM_IMAGE_TAG_REMOTE="2.5.0"
RIC_SIM_IMAGE_TAG_REMOTE_RELEASE="2.5.0"
+# ORAN Near RT RIC Simulator image and tags
+RICMEDIATOR_SIM_IMAGE_BASE="o-ran-sc/ric-plt-a1"
+RICMEDIATOR_SIM_IMAGE_TAG_REMOTE_RELEASE_ORAN="3.0.1"
+
+# ORAN Near RT RIC Simulator DB image and tags
+RICMEDIATOR_SIM_DB_IMAGE_BASE="o-ran-sc/ric-plt-dbaas"
+RICMEDIATOR_SIM_DB_IMAGE_TAG_REMOTE_RELEASE_ORAN="0.6.2"
+
# DMAAP Mediator Service
DMAAP_MED_IMAGE_BASE="o-ran-sc/nonrtric-plt-dmaapmediatorproducer"
DMAAP_MED_IMAGE_TAG_LOCAL="1.2.0-SNAPSHOT"
@@ -278,7 +286,9 @@
A1PMS_CONFIG_FILE="application.yaml" # Container config file name
A1PMS_DATA_FILE="application_configuration.json" # Container data file name
A1PMS_CONTAINER_MNT_DIR="/var/policy-management-service" # Mounted dir in the container
-A1PMS_FEATURE_LEVEL="" # Space separated list of features
+A1PMS_FEATURE_LEVEL="NO-DMAAP ADAPTER-CLASS" # Space separated list of features
+A1PMS_ADAPTER_CLASS="" # Class name set by override file
+A1PMS_ADAPTER_POLICY_NAME="" # Policy name set by override file
ICS_APP_NAME="informationservice" # Name for ICS container
ICS_DISPLAY_NAME="Information Coordinator Service" # Display name for ICS container
@@ -297,8 +307,7 @@
ICS_COMPOSE_DIR="ics" # Dir in simulator_group for docker-compose
ICS_CONFIG_MOUNT_PATH=/opt/app/information-coordinator-service/config # Internal container path for configuration
ICS_CONFIG_FILE=application.yaml # Config file name
-ICS_VERSION="V1-2" # Version where the types are decoupled from the producer registration
-ICS_FEATURE_LEVEL="INFO-TYPES TYPE-SUBSCRIPTIONS INFO-TYPE-INFO RESP_CODE_CHANGE_1 DEFAULT_TYPE_VALIDATION" # Space separated list of features
+ICS_FEATURE_LEVEL="TYPE-SUBSCRIPTIONS INFO-TYPE-INFO RESP_CODE_CHANGE_1 DEFAULT_TYPE_VALIDATION" # Space separated list of features
MR_DMAAP_APP_NAME="message-router" # Name for the Dmaap MR
MR_STUB_APP_NAME="mr-stub" # Name of the MR stub
@@ -360,7 +369,7 @@
# This prefix can be changed from the command line
RIC_SIM_INTERNAL_PORT=8085 # RIC Simulator container internal port (container -> container).
# (external ports allocated by docker)
-RIC_SIM_INTERNAL_SECURE_PORT=8185 # RIC Simulator container internal secure port (container -> container).
+RIC_SIM_INTERNAL_SECURE_PORT=8185 # RIC Simulator container internal secure port (container -> container).
# (external ports allocated by docker)
RIC_SIM_CERT_MOUNT_DIR="./cert"
@@ -368,6 +377,24 @@
RIC_SIM_ALIVE_URL="/" # Base path for alive check
RIC_SIM_COMMON_SVC_NAME="" # Name of svc if one common svc is used for all ric sim groups (stateful sets)
+RICMEDIATOR_SIM_DISPLAY_NAME="ORAN Near-RT RIC A1 Simulator"
+RICMEDIATOR_SIM_DB_DISPLAY_NAME="ORAN Near-RT RIC A1 Simulator DB"
+RICMEDIATOR_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
+RICMEDIATOR_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
+RICMEDIATOR_SIM_INTERNAL_PORT=10000 # RIC Simulator container internal port (container -> container).
+ # (external ports allocated by docker)
+RICMEDIATOR_SIM_INTERNAL_SECURE_PORT=10001 # RIC Simulator container internal secure port (container -> container).
+ # (external ports allocated by docker)
+ # This port number is not supported by app, kept only for consistency with other ric sims
+RICMEDIATOR_SIM_CERT_MOUNT_DIR="./cert"
+
+RICMEDIATOR_SIM_COMPOSE_DIR="ricmediator" # Dir in simulator group for docker compose
+RICMEDIATOR_SIM_ALIVE_URL="/a1-p/healthcheck" # Base path for alive check
+RICMEDIATOR_SIM_COMMON_SVC_NAME="" # Name of svc if one common svc is used for all ric sim groups (stateful sets)
+
+
# For ONAP sdnc
SDNC_APP_NAME="a1controller" # Name of the SNDC A1 Controller container
SDNC_DISPLAY_NAME="SDNC A1 Controller"
diff --git a/test/common/testcase_common.sh b/test/common/testcase_common.sh
index 71d3da7..33e2a38 100755
--- a/test/common/testcase_common.sh
+++ b/test/common/testcase_common.sh
@@ -1,7 +1,7 @@
#!/bin/bash
# ============LICENSE_START===============================================
-# Copyright (C) 2020 Nordix Foundation. All rights reserved.
+# Copyright (C) 2020-22023 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.
@@ -322,8 +322,8 @@
# Function to log the start of a test case
__log_test_start() {
TIMESTAMP=$(date "+%Y-%m-%d %H:%M:%S")
- echo -e $BOLD"TEST $TEST_SEQUENCE_NR (${BASH_LINENO[1]}): ${FUNCNAME[1]}" $@ $EBOLD
- echo "TEST $TEST_SEQUENCE_NR - ${TIMESTAMP}: (${BASH_LINENO[1]}): ${FUNCNAME[1]}" $@ >> $HTTPLOG
+ echo -e $BOLD"TEST $TEST_SEQUENCE_NR - (${BASH_LINENO[1]}) - ${TIMESTAMP}: ${FUNCNAME[1]}" $@ $EBOLD
+ echo "TEST $TEST_SEQUENCE_NR - (${BASH_LINENO[1]}) - ${TIMESTAMP}: ${FUNCNAME[1]}" $@ >> $HTTPLOG
((RES_TEST++))
((TEST_SEQUENCE_NR++))
}
@@ -367,6 +367,12 @@
__check_stop_at_error
}
+# Function to log a test case that is not supported but will not fail
+__log_test_info_not_supported() {
+ echo -e $YELLOW" INFO, function not supported"$YELLOW
+ __print_current_stats
+}
+
# General function to log a passed test case
__log_test_pass() {
if [ $# -gt 0 ]; then
@@ -383,8 +389,8 @@
# Function to log the start of a configuration setup
__log_conf_start() {
TIMESTAMP=$(date "+%Y-%m-%d %H:%M:%S")
- echo -e $BOLD"CONF $CONF_SEQUENCE_NR (${BASH_LINENO[1]}): "${FUNCNAME[1]} $@ $EBOLD
- echo "CONF $CONF_SEQUENCE_NR - ${TIMESTAMP}: (${BASH_LINENO[1]}): "${FUNCNAME[1]} $@ >> $HTTPLOG
+ echo -e $BOLD"CONF $CONF_SEQUENCE_NR - (${BASH_LINENO[1]}) - ${TIMESTAMP}: "${FUNCNAME[1]} $@ $EBOLD
+ echo "CONF $CONF_SEQUENCE_NR - (${BASH_LINENO[1]}) - ${TIMESTAMP}: "${FUNCNAME[1]} $@ >> $HTTPLOG
((CONF_SEQUENCE_NR++))
}
@@ -1535,10 +1541,11 @@
elif [ $1 == "remote" ] || [ $1 == "remote-remove" ]; then
if [ $1 == "remote-remove" ]; then
if [ $RUNMODE == "DOCKER" ]; then
+
echo -ne " Attempt to stop and remove container(s), if running - ${SAMELINE}"
tmp=$(docker ps -aq --filter name=${3} --filter network=${DOCKER_SIM_NWNAME})
if [ $? -eq 0 ] && [ ! -z "$tmp" ]; then
- docker stop $tmp &> ./tmp/.dockererr
+ docker stop -t 0 $tmp &> ./tmp/.dockererr
if [ $? -ne 0 ]; then
((IMAGE_ERR++))
echo ""
@@ -1550,7 +1557,7 @@
echo -ne " Attempt to stop and remove container(s), if running - "$GREEN"stopped"$EGREEN"${SAMELINE}"
tmp=$(docker ps -aq --filter name=${3} --filter network=${DOCKER_SIM_NWNAME}) &> /dev/null
if [ $? -eq 0 ] && [ ! -z "$tmp" ]; then
- docker rm $tmp &> ./tmp/.dockererr
+ docker rm -f $tmp &> ./tmp/.dockererr
if [ $? -ne 0 ]; then
((IMAGE_ERR++))
echo ""
@@ -1697,24 +1704,32 @@
# The following sequence pull the configured images
echo -e $BOLD"Pulling configured images, if needed"$EBOLD
+ __exclude_check=0
if [ ! -z "$IMAGE_REPO_ADR" ] && [ $IMAGE_REPO_POLICY == "local" ]; then
- echo -e $YELLOW" Excluding all remote image check/pull when running with image repo: $IMAGE_REPO_ADR and image policy $IMAGE_REPO_POLICY"$EYELLOW
- else
- for imagename in $APP_SHORT_NAMES; do
- __check_included_image $imagename
- incl=$?
- __check_project_image $imagename
- proj=$?
- if [ $incl -eq 0 ]; then
- if [ $proj -eq 0 ]; then
- START_ARG_MOD=$START_ARG
- __check_image_local_override $imagename
- if [ $? -eq 1 ]; then
- START_ARG_MOD="local"
- fi
- else
- START_ARG_MOD=$START_ARG
+ echo -e $YELLOW" Excluding all remote image check/pull (unless local override) when running with image repo: $IMAGE_REPO_ADR and image policy: $IMAGE_REPO_POLICY"$EYELLOW
+ __exclude_check=1
+ fi
+ for imagename in $APP_SHORT_NAMES; do
+ __check_included_image $imagename
+ incl=$?
+ __check_project_image $imagename
+ proj=$?
+ if [ $incl -eq 0 ]; then
+ if [ $proj -eq 0 ]; then
+ START_ARG_MOD=$START_ARG
+ __check_image_local_override $imagename
+ if [ $? -eq 1 ]; then
+ START_ARG_MOD="local"
fi
+ else
+ START_ARG_MOD=$START_ARG
+ fi
+ __exclude_image_check=0
+ if [ $__exclude_check == 1 ] && [ "$START_ARG_MOD" != "local" ]; then
+ # For to handle locally built images, overriding remote images
+ __exclude_image_check=1
+ fi
+ if [ $__exclude_image_check == 0 ]; then
__check_image_local_build $imagename
#No pull of images built locally
if [ $? -ne 0 ]; then
@@ -1728,11 +1743,12 @@
function_pointer="__"$imagename"_imagepull"
$function_pointer $START_ARG_MOD $START_ARG
fi
- else
- echo -e $YELLOW" Excluding $imagename image from image check/pull"$EYELLOW
fi
- done
- fi
+ else
+ echo -e $YELLOW" Excluding $imagename image from image check/pull"$EYELLOW
+ fi
+ done
+
#Errors in image setting - exit
if [ $IMAGE_ERR -ne 0 ]; then
@@ -1822,8 +1838,8 @@
# Create a table of the images used in the script - from remote repo
echo -e $BOLD"Remote repo images used in this test script"$EBOLD
- echo -e $YELLOW"-- Note: These image will be pulled when the container starts. Images not managed by the test engine --"$EYELLOW
-
+ echo -e $YELLOW"-- Note: These image will be pulled when the container starts. Images not managed by the test engine "$EYELLOW
+ echo -e $YELLOW"-- Note: Images with local override will however be re-tagged and managed by the test engine "$EYELLOW
docker_tmp_file=./tmp/.docker-images-table
format_string="{{.Repository}}\\t{{.Tag}}"
echo -e "Application\tRepository\tTag" > $docker_tmp_file
@@ -2327,7 +2343,7 @@
result=$(kubectl $KUBECONF get $restype -n $namespace -o jsonpath='{.items[?(@.metadata.labels.'$labelname'=="'$labelid'")].metadata.name}')
if [ $? -eq 0 ] && [ ! -z "$result" ]; then
for resid in $result; do
- echo -ne " Ordered caling $restype $resid in namespace $namespace with label $labelname=$labelid to 0"$SAMELINE
+ echo -ne " Ordered scaling $restype $resid in namespace $namespace with label $labelname=$labelid to 0"$SAMELINE
kubectl $KUBECONF scale $restype $resid -n $namespace --replicas=0 1> /dev/null 2> ./tmp/kubeerr
echo -e " Ordered scaling $restype $resid in namespace $namespace with label $labelname=$labelid to 0 $GREEN OK $EGREEN"
done
@@ -3240,8 +3256,8 @@
checkjsonarraycount=1
fi
- echo -e $BOLD"TEST $TEST_SEQUENCE_NR (${BASH_LINENO[1]}): ${1}, ${3} ${4} ${5} within ${6} seconds"$EBOLD
- echo "TEST $TEST_SEQUENCE_NR - ${TIMESTAMP}: (${BASH_LINENO[1]}): ${1}, ${3} ${4} ${5} within ${6} seconds" >> $HTTPLOG
+ echo -e $BOLD"TEST $TEST_SEQUENCE_NR - (${BASH_LINENO[1]}) - ${TIMESTAMP}: ${1}, ${3} ${4} ${5} within ${6} seconds"$EBOLD
+ echo "TEST $TEST_SEQUENCE_NR - (${BASH_LINENO[1]}) - ${TIMESTAMP}: ${1}, ${3} ${4} ${5} within ${6} seconds" >> $HTTPLOG
((RES_TEST++))
((TEST_SEQUENCE_NR++))
@@ -3316,8 +3332,8 @@
checkjsonarraycount=1
fi
- echo -e $BOLD"TEST $TEST_SEQUENCE_NR (${BASH_LINENO[1]}): ${1}, ${3} ${4} ${5}"$EBOLD
- echo "TEST $TEST_SEQUENCE_NR - ${TIMESTAMP}: (${BASH_LINENO[1]}): ${1}, ${3} ${4} ${5}" >> $HTTPLOG
+ echo -e $BOLD"TEST $TEST_SEQUENCE_NR - (${BASH_LINENO[1]}) - ${TIMESTAMP}: ${1}, ${3} ${4} ${5}"$EBOLD
+ echo "TEST $TEST_SEQUENCE_NR - (${BASH_LINENO[1]}) - ${TIMESTAMP}: ${1}, ${3} ${4} ${5}" >> $HTTPLOG
((RES_TEST++))
((TEST_SEQUENCE_NR++))
if [ $checkjsonarraycount -eq 0 ]; then
diff --git a/test/common/testengine_config.sh b/test/common/testengine_config.sh
index 00cfcca..829084f 100644
--- a/test/common/testengine_config.sh
+++ b/test/common/testengine_config.sh
@@ -1,7 +1,7 @@
#!/bin/bash
# ============LICENSE_START===============================================
-# Copyright (C) 2020 Nordix Foundation. All rights reserved.
+# Copyright (C) 2020-2023 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.
@@ -18,13 +18,13 @@
#
# List of short names for all supported apps, including simulators etc
-APP_SHORT_NAMES="A1PMS ICS SDNC CP NGW RC RICSIM HTTPPROXY DMAAPMR MR CR PRODSTUB KUBEPROXY DMAAPMED DMAAPADP PVCCLEANER KAFKAPC CHARTMUS HELMMANAGER LOCALHELM KEYCLOAK ISTIO AUTHSIDECAR"
+APP_SHORT_NAMES="A1PMS ICS SDNC CP NGW RC RICSIM RICMEDIATORSIM HTTPPROXY DMAAPMR MR CR PRODSTUB KUBEPROXY DMAAPMED DMAAPADP PVCCLEANER KAFKAPC CHARTMUS HELMMANAGER LOCALHELM KEYCLOAK ISTIO AUTHSIDECAR"
# List of available apps that built and released of the project
PROJECT_IMAGES="A1PMS ICS SDNC CP NGW RICSIM RC DMAAPMED DMAAPADP HELMMANAGER AUTHSIDECAR"
# List of available apps to override with local or remote staging/snapshot/release image
-AVAILABLE_IMAGES_OVERRIDE="A1PMS ICS SDNC CP NGW RICSIM RC DMAAPMED DMAAPADP HELMMANAGER AUTHSIDECAR"
+AVAILABLE_IMAGES_OVERRIDE="A1PMS ICS SDNC CP NGW RICSIM RICMEDIATORSIM RC DMAAPMED DMAAPADP HELMMANAGER AUTHSIDECAR"
# List of available apps where the image is built by the test environment
LOCAL_IMAGE_BUILD="MR CR PRODSTUB KUBEPROXY HTTPPROXY KAFKAPC"