3 # ============LICENSE_START===============================================
4 # Copyright (C) 2020 Nordix Foundation. All rights reserved.
5 # ========================================================================
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 # ============LICENSE_END=================================================
20 # This is a script that contains container/service management functions and test functions for ECS
22 ################ Test engine functions ################
24 # Create the image var used during the test
25 # arg: <image-tag-suffix> (selects staging, snapshot, release etc)
26 # <image-tag-suffix> is present only for images with staging, snapshot,release tags
28 __check_and_create_image_var ECS "ECS_IMAGE" "ECS_IMAGE_BASE" "ECS_IMAGE_TAG" $1 "$ECS_DISPLAY_NAME"
31 # Pull image from remote repo or use locally built image
32 # arg: <pull-policy-override> <pull-policy-original>
33 # <pull-policy-override> Shall be used for images allowing overriding. For example use a local image when test is started to use released images
34 # <pull-policy-original> Shall be used for images that does not allow overriding
35 # Both var may contain: 'remote', 'remote-remove' or 'local'
37 __check_and_pull_image $1 "$ECS_DISPLAY_NAME" $ECS_APP_NAME ECS_IMAGE
40 # Build image (only for simulator or interfaces stubs owned by the test environment)
41 # arg: <image-tag-suffix> (selects staging, snapshot, release etc)
42 # <image-tag-suffix> is present only for images with staging, snapshot,release tags
44 echo -e $RED" Image for app ECS shall never be built"$ERED
47 # Generate a string for each included image using the app display name and a docker images format string
48 # If a custom image repo is used then also the source image from the local repo is listed
49 # arg: <docker-images-format-string> <file-to-append>
51 echo -e "$ECS_DISPLAY_NAME\t$(docker images --format $1 $ECS_IMAGE)" >> $2
52 if [ ! -z "$ECS_IMAGE_SOURCE" ]; then
53 echo -e "-- source image --\t$(docker images --format $1 $ECS_IMAGE_SOURCE)" >> $2
57 # Scale kubernetes resources to zero
58 # All resources shall be ordered to be scaled to 0, if relevant. If not relevant to scale, then do no action.
59 # This function is called for apps fully managed by the test script
60 __ECS_kube_scale_zero() {
61 __kube_scale_all_resources $KUBE_NONRTRIC_NAMESPACE autotest ECS
64 # Scale kubernetes resources to zero and wait until this has been accomplished, if relevant. If not relevant to scale, then do no action.
65 # This function is called for prestarted apps not managed by the test script.
66 __ECS_kube_scale_zero_and_wait() {
67 __kube_scale_and_wait_all_resources $KUBE_NONRTRIC_NAMESPACE app nonrtric-enrichmentservice
70 # Delete all kube resouces for the app
71 # This function is called for apps managed by the test script.
72 __ECS_kube_delete_all() {
73 __kube_delete_all_resources $KUBE_NONRTRIC_NAMESPACE autotest ECS
77 # This function is called for apps managed by the test script.
78 # args: <log-dir> <file-prexix>
79 __ECS_store_docker_logs() {
80 docker logs $ECS_APP_NAME > $1$2_ecs.log 2>&1
82 #######################################################
86 # Host name may be changed if app started by kube
89 ECS_HOST_NAME=$LOCALHOST_NAME
90 ECS_PATH=$ECS_HTTPX"://"$ECS_HOST_NAME":"$ECS_EXTERNAL_PORT
92 # ECS_ADAPTER used for switch between REST and DMAAP (only REST supported currently)
93 ECS_ADAPTER_TYPE="REST"
96 # Make curl retries towards ECS for http response codes set in this env var, space separated list of codes
99 #Save first worker node the pod is started on
102 ###########################
104 ###########################
106 # All calls to ECS will be directed to the ECS REST interface from now on
108 # (Function for test scripts)
109 use_ecs_rest_http() {
110 echo -e $BOLD"ECS protocol setting"$EBOLD
111 echo -e " Using $BOLD http $EBOLD and $BOLD REST $EBOLD towards ECS"
113 ECS_PATH=$ECS_HTTPX"://"$ECS_HOST_NAME":"$ECS_EXTERNAL_PORT
115 ECS_ADAPTER_TYPE="REST"
116 ECS_ADAPTER=$ECS_PATH
120 # All calls to ECS will be directed to the ECS REST interface from now on
122 # (Function for test scripts)
123 use_ecs_rest_https() {
124 echo -e $BOLD"ECS protocol setting"$EBOLD
125 echo -e " Using $BOLD https $EBOLD and $BOLD REST $EBOLD towards ECS"
127 ECS_PATH=$ECS_HTTPX"://"$ECS_HOST_NAME":"$ECS_EXTERNAL_SECURE_PORT
129 ECS_ADAPTER_TYPE="REST"
130 ECS_ADAPTER=$ECS_PATH
134 # All calls to ECS will be directed to the ECS dmaap interface over http from now on
136 # (Function for test scripts)
137 use_ecs_dmaap_http() {
138 echo -e $BOLD"ECS dmaap protocol setting"$EBOLD
139 echo -e $RED" - NOT SUPPORTED - "$ERED
140 echo -e " Using $BOLD http $EBOLD and $BOLD DMAAP $EBOLD towards ECS"
141 ECS_ADAPTER_TYPE="MR-HTTP"
145 # All calls to ECS will be directed to the ECS dmaap interface over https from now on
147 # (Function for test scripts)
148 use_ecs_dmaap_https() {
149 echo -e $BOLD"RICSIM protocol setting"$EBOLD
150 echo -e $RED" - NOT SUPPORTED - "$ERED
151 echo -e " Using $BOLD https $EBOLD and $BOLD REST $EBOLD towards ECS"
152 ECS_ADAPTER_TYPE="MR-HTTPS"
157 # args: PROXY|NOPROXY <config-file>
158 # (Function for test scripts)
161 echo -e $BOLD"Starting $ECS_DISPLAY_NAME"$EBOLD
163 if [ $RUNMODE == "KUBE" ]; then
165 # Check if app shall be fully managed by the test script
166 __check_included_image "ECS"
169 # Check if app shall only be used by the testscipt
170 __check_prestarted_image "ECS"
173 if [ $retcode_i -ne 0 ] && [ $retcode_p -ne 0 ]; then
174 echo -e $RED"The $ECS_APP_NAME app is not included as managed nor prestarted in this test script"$ERED
175 echo -e $RED"The $ECS_APP_NAME will not be started"$ERED
178 if [ $retcode_i -eq 0 ] && [ $retcode_p -eq 0 ]; then
179 echo -e $RED"The $ECS_APP_NAME app is included both as managed and prestarted in this test script"$ERED
180 echo -e $RED"The $ECS_APP_NAME will not be started"$ERED
185 if [ $retcode_p -eq 0 ]; then
186 echo -e " Using existing $ECS_APP_NAME deployment and service"
187 echo " Setting ECS replicas=1"
188 res_type=$(__kube_get_resource_type $ECS_APP_NAME $KUBE_NONRTRIC_NAMESPACE)
189 __kube_scale $res_type $ECS_APP_NAME $KUBE_NONRTRIC_NAMESPACE 1
192 # Check if app shall be fully managed by the test script
193 if [ $retcode_i -eq 0 ]; then
194 echo -e " Creating $ECS_APP_NAME app and expose service"
196 #Check if nonrtric namespace exists, if not create it
197 __kube_create_namespace $KUBE_NONRTRIC_NAMESPACE
200 export KUBE_NONRTRIC_NAMESPACE
202 export ECS_INTERNAL_PORT
203 export ECS_INTERNAL_SECURE_PORT
204 export ECS_EXTERNAL_PORT
205 export ECS_EXTERNAL_SECURE_PORT
206 export ECS_CONFIG_MOUNT_PATH
207 export ECS_CONFIG_CONFIGMAP_NAME=$ECS_APP_NAME"-config"
208 export ECS_DATA_CONFIGMAP_NAME=$ECS_APP_NAME"-data"
209 export ECS_CONTAINER_MNT_DIR
211 export ECS_DATA_PV_NAME=$ECS_APP_NAME"-pv"
212 export ECS_DATA_PVC_NAME=$ECS_APP_NAME"-pvc"
213 #Create a unique path for the pv each time to prevent a previous volume to be reused
214 export ECS_PV_PATH="ecsdata-"$(date +%s)
216 if [ $1 == "PROXY" ]; then
217 ECS_HTTP_PROXY_CONFIG_PORT=$HTTP_PROXY_CONFIG_PORT #Set if proxy is started
218 ECS_HTTP_PROXY_CONFIG_HOST_NAME=$HTTP_PROXY_CONFIG_HOST_NAME #Set if proxy is started
219 if [ $ECS_HTTP_PROXY_CONFIG_PORT -eq 0 ] || [ -z "$ECS_HTTP_PROXY_CONFIG_HOST_NAME" ]; then
220 echo -e $YELLOW" Warning: HTTP PROXY will not be configured, proxy app not started"$EYELLOW
222 echo " Configured with http proxy"
225 ECS_HTTP_PROXY_CONFIG_PORT=0
226 ECS_HTTP_PROXY_CONFIG_HOST_NAME=""
227 echo " Configured without http proxy"
229 export ECS_HTTP_PROXY_CONFIG_PORT
230 export ECS_HTTP_PROXY_CONFIG_HOST_NAME
232 # Create config map for config
233 datafile=$PWD/tmp/$ECS_CONFIG_FILE
235 output_yaml=$PWD/tmp/ecs_cfc.yaml
236 __kube_create_configmap $ECS_CONFIG_CONFIGMAP_NAME $KUBE_NONRTRIC_NAMESPACE autotest ECS $datafile $output_yaml
239 input_yaml=$SIM_GROUP"/"$ECS_COMPOSE_DIR"/"pv.yaml
240 output_yaml=$PWD/tmp/ecs_pv.yaml
241 __kube_create_instance pv $ECS_APP_NAME $input_yaml $output_yaml
244 input_yaml=$SIM_GROUP"/"$ECS_COMPOSE_DIR"/"pvc.yaml
245 output_yaml=$PWD/tmp/ecs_pvc.yaml
246 __kube_create_instance pvc $ECS_APP_NAME $input_yaml $output_yaml
249 input_yaml=$SIM_GROUP"/"$ECS_COMPOSE_DIR"/"svc.yaml
250 output_yaml=$PWD/tmp/ecs_svc.yaml
251 __kube_create_instance service $ECS_APP_NAME $input_yaml $output_yaml
254 input_yaml=$SIM_GROUP"/"$ECS_COMPOSE_DIR"/"app.yaml
255 output_yaml=$PWD/tmp/ecs_app.yaml
256 __kube_create_instance app $ECS_APP_NAME $input_yaml $output_yaml
259 # Tie the ECS to a worker node so that ECS will always be scheduled to the same worker node if the ECS pod is restarted
260 # A PVC of type hostPath is mounted to ECS, for persistent storage, so the ECS must always be on the node which mounted the volume
262 # Keep the initial worker node in case the pod need to be "restarted" - must be made to the same node due to a volume mounted on the host
263 if [ $retcode_i -eq 0 ]; then
264 __ECS_WORKER_NODE=$(kubectl get pod -l "autotest=ECS" -n $KUBE_NONRTRIC_NAMESPACE -o jsonpath='{.items[*].spec.nodeName}')
265 if [ -z "$__ECS_WORKER_NODE" ]; then
266 echo -e $YELLOW" Cannot find worker node for pod for $ECS_APP_NAME, persistency may not work"$EYELLOW
269 echo -e $YELLOW" Persistency may not work for app $ECS_APP_NAME in multi-worker node config when running it as a prestarted app"$EYELLOW
272 echo " Retrieving host and ports for service..."
273 ECS_HOST_NAME=$(__kube_get_service_host $ECS_APP_NAME $KUBE_NONRTRIC_NAMESPACE)
274 ECS_EXTERNAL_PORT=$(__kube_get_service_port $ECS_APP_NAME $KUBE_NONRTRIC_NAMESPACE "http")
275 ECS_EXTERNAL_SECURE_PORT=$(__kube_get_service_port $ECS_APP_NAME $KUBE_NONRTRIC_NAMESPACE "https")
277 echo " Host IP, http port, https port: $ECS_HOST_NAME $ECS_EXTERNAL_PORT $ECS_EXTERNAL_SECURE_PORT"
279 if [ $ECS_HTTPX == "http" ]; then
280 ECS_PATH=$ECS_HTTPX"://"$ECS_HOST_NAME":"$ECS_EXTERNAL_PORT
282 ECS_PATH=$ECS_HTTPX"://"$ECS_HOST_NAME":"$ECS_EXTERNAL_SECURE_PORT
285 __check_service_start $ECS_APP_NAME $ECS_PATH$ECS_ALIVE_URL
287 if [ $ECS_ADAPTER_TYPE == "REST" ]; then
288 ECS_ADAPTER=$ECS_PATH
291 __check_included_image 'ECS'
292 if [ $? -eq 1 ]; then
293 echo -e $RED"The ECS app is not included in this test script"$ERED
294 echo -e $RED"ECS will not be started"$ERED
304 if [ "$(ls -A $DIR)" ]; then
305 echo -e $BOLD" Cleaning files in mounted dir: $PWD/db"$EBOLD
306 rm -rf db/* &> /dev/null
307 if [ $? -ne 0 ]; then
308 echo -e $RED" Cannot remove database files in: $PWD"$ERED
313 echo " No files in mounted dir or dir does not exists"
318 export ECS_APP_NAME_ALIAS
319 export ECS_HOST_MNT_DIR
320 export ECS_CONTAINER_MNT_DIR
321 export ECS_CONFIG_MOUNT_PATH
322 export ECS_CONFIG_FILE
323 export ECS_INTERNAL_PORT
324 export ECS_EXTERNAL_PORT
325 export ECS_INTERNAL_SECURE_PORT
326 export ECS_EXTERNAL_SECURE_PORT
327 export DOCKER_SIM_NWNAME
328 export ECS_DISPLAY_NAME
330 if [ $1 == "PROXY" ]; then
331 ECS_HTTP_PROXY_CONFIG_PORT=$HTTP_PROXY_CONFIG_PORT #Set if proxy is started
332 ECS_HTTP_PROXY_CONFIG_HOST_NAME=$HTTP_PROXY_CONFIG_HOST_NAME #Set if proxy is started
333 if [ $ECS_HTTP_PROXY_CONFIG_PORT -eq 0 ] || [ -z "$ECS_HTTP_PROXY_CONFIG_HOST_NAME" ]; then
334 echo -e $YELLOW" Warning: HTTP PROXY will not be configured, proxy app not started"$EYELLOW
336 echo " Configured with http proxy"
339 ECS_HTTP_PROXY_CONFIG_PORT=0
340 ECS_HTTP_PROXY_CONFIG_HOST_NAME=""
341 echo " Configured without http proxy"
343 export ECS_HTTP_PROXY_CONFIG_PORT
344 export ECS_HTTP_PROXY_CONFIG_HOST_NAME
346 dest_file=$SIM_GROUP/$ECS_COMPOSE_DIR/$ECS_HOST_MNT_DIR/$ECS_CONFIG_FILE
348 envsubst < $2 > $dest_file
350 __start_container $ECS_COMPOSE_DIR "" NODOCKERARGS 1 $ECS_APP_NAME
352 __check_service_start $ECS_APP_NAME $ECS_PATH$ECS_ALIVE_URL
361 # (Function for test scripts)
363 echo -e $BOLD"Stopping $ECS_DISPLAY_NAME"$EBOLD
365 if [ $RUNMODE == "KUBE" ]; then
367 __check_prestarted_image "ECS"
368 if [ $? -eq 0 ]; then
369 echo -e $YELLOW" Persistency may not work for app $ECS_APP_NAME in multi-worker node config when running it as a prestarted app"$EYELLOW
370 res_type=$(__kube_get_resource_type $ECS_APP_NAME $KUBE_NONRTRIC_NAMESPACE)
371 __kube_scale $res_type $ECS_APP_NAME $KUBE_NONRTRIC_NAMESPACE 0
375 __kube_scale_all_resources $KUBE_NONRTRIC_NAMESPACE autotest ECS
376 echo " Deleting the replica set - a new will be started when the app is started"
377 tmp=$(kubectl delete rs -n $KUBE_NONRTRIC_NAMESPACE -l "autotest=ECS")
378 if [ $? -ne 0 ]; then
379 echo -e $RED" Could not delete replica set "$RED
384 docker stop $ECS_APP_NAME &> ./tmp/.dockererr
385 if [ $? -ne 0 ]; then
386 __print_err "Could not stop $ECS_APP_NAME" $@
392 echo -e $BOLD$GREEN"Stopped"$EGREEN$EBOLD
397 # Start a previously stopped ecs
399 # (Function for test scripts)
400 start_stopped_ecs() {
401 echo -e $BOLD"Starting (the previously stopped) $ECS_DISPLAY_NAME"$EBOLD
403 if [ $RUNMODE == "KUBE" ]; then
405 __check_prestarted_image "ECS"
406 if [ $? -eq 0 ]; then
407 echo -e $YELLOW" Persistency may not work for app $ECS_APP_NAME in multi-worker node config when running it as a prestarted app"$EYELLOW
408 res_type=$(__kube_get_resource_type $ECS_APP_NAME $KUBE_NONRTRIC_NAMESPACE)
409 __kube_scale $res_type $ECS_APP_NAME $KUBE_NONRTRIC_NAMESPACE 1
410 __check_service_start $ECS_APP_NAME $ECS_PATH$ECS_ALIVE_URL
414 # Tie the PMS to the same worker node it was initially started on
415 # A PVC of type hostPath is mounted to PMS, for persistent storage, so the PMS must always be on the node which mounted the volume
416 if [ -z "$__ECS_WORKER_NODE" ]; then
417 echo -e $RED" No initial worker node found for pod "$RED
421 echo -e $BOLD" Setting nodeSelector kubernetes.io/hostname=$__ECS_WORKER_NODE to deployment for $ECS_APP_NAME. Pod will always run on this worker node: $__PA_WORKER_NODE"$BOLD
422 echo -e $BOLD" The mounted volume is mounted as hostPath and only available on that worker node."$BOLD
423 tmp=$(kubectl patch deployment $ECS_APP_NAME -n $KUBE_NONRTRIC_NAMESPACE --patch '{"spec": {"template": {"spec": {"nodeSelector": {"kubernetes.io/hostname": "'$__ECS_WORKER_NODE'"}}}}}')
424 if [ $? -ne 0 ]; then
425 echo -e $YELLOW" Cannot set nodeSelector to deployment for $ECS_APP_NAME, persistency may not work"$EYELLOW
427 __kube_scale deployment $ECS_APP_NAME $KUBE_NONRTRIC_NAMESPACE 1
430 docker start $ECS_APP_NAME &> ./tmp/.dockererr
431 if [ $? -ne 0 ]; then
432 __print_err "Could not start (the stopped) $ECS_APP_NAME" $@
438 __check_service_start $ECS_APP_NAME $ECS_PATH$ECS_ALIVE_URL
439 if [ $? -ne 0 ]; then
446 # Turn on debug level tracing in ECS
448 # (Function for test scripts)
450 echo -e $BOLD"Setting ecs debug logging"$EBOLD
451 curlString="$ECS_PATH$ECS_ACTUATOR -X POST -H Content-Type:application/json -d {\"configuredLevel\":\"debug\"}"
452 result=$(__do_curl "$curlString")
453 if [ $? -ne 0 ]; then
454 __print_err "Could not set debug mode" $@
462 # Turn on trace level tracing in ECS
464 # (Function for test scripts)
466 echo -e $BOLD"Setting ecs trace logging"$EBOLD
467 curlString="$ECS_PATH/actuator/loggers/org.oransc.enrichment -X POST -H Content-Type:application/json -d {\"configuredLevel\":\"trace\"}"
468 result=$(__do_curl "$curlString")
469 if [ $? -ne 0 ]; then
470 __print_err "Could not set trace mode" $@
478 # Perform curl retries when making direct call to ECS for the specified http response codes
479 # Speace separated list of http response codes
480 # args: [<response-code>]*
482 echo -e $BOLD"Do curl retries to the ECS REST inteface for these response codes:$@"$EBOLD
488 # Check the ecs logs for WARNINGs and ERRORs
490 # (Function for test scripts)
492 __check_container_logs "ECS" $ECS_APP_NAME $ECS_LOGPATH WARN ERR
496 # Tests if a variable value in the ECS is equal to a target value and and optional timeout.
497 # Arg: <variable-name> <target-value> - This test set pass or fail depending on if the variable is
498 # equal to the target or not.
499 # Arg: <variable-name> <target-value> <timeout-in-sec> - This test waits up to the timeout seconds
500 # before setting pass or fail depending on if the variable value becomes equal to the target
502 # (Function for test scripts)
504 if [ $# -eq 2 ] || [ $# -eq 3 ]; then
505 __var_test ECS "$ECS_PATH/" $1 "=" $2 $3
507 __print_err "Wrong args to ecs_equal, needs two or three args: <sim-param> <target-value> [ timeout ]" $@
512 ##########################################
513 ######### A1-E Enrichment API ##########
514 ##########################################
515 #Function prefix: ecs_api_a1
517 # API Test function: GET /A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs
518 # args: <response-code> <type-id> <owner-id>|NOOWNER [ EMPTY | <job-id>+ ]
519 # args (flat uri structure): <response-code> <type-id>|NOTYPE <owner-id>|NOOWNER [ EMPTY | <job-id>+ ]
520 # (Function for test scripts)
521 ecs_api_a1_get_job_ids() {
524 if [ -z "$FLAT_A1_EI" ]; then
525 # Valid number of parameters 4,5,6 etc
526 if [ $# -lt 3 ]; then
527 __print_err "<response-code> <type-id> <owner-id>|NOOWNER [ EMPTY | <job-id>+ ]" $@
531 echo -e $YELLOW"INTERFACE - FLAT URI STRUCTURE"$EYELLOW
532 # Valid number of parameters 4,5,6 etc
533 if [ $# -lt 3 ]; then
534 __print_err "<response-code> <type-id>|NOTYPE <owner-id>|NOOWNER [ EMPTY | <job-id>+ ]" $@
539 if [ $3 != "NOWNER" ]; then
543 if [ -z "$FLAT_A1_EI" ]; then
544 query="/A1-EI/v1/eitypes/$2/eijobs$search"
546 if [ $2 != "NOTYPE" ]; then
547 if [ -z "$search" ]; then
548 search="?eiTypeId="$2
550 search=$search"&eiTypeId="$2
553 query="/A1-EI/v1/eijobs$search"
555 res="$(__do_curl_to_api ECS GET $query)"
556 status=${res:${#res}-3}
558 if [ $status -ne $1 ]; then
559 __log_test_fail_status_code $1 $status
563 if [ $# -gt 3 ]; then
564 body=${res:0:${#res}-3}
567 for pid in ${@:4} ; do
568 if [ "$targetJson" != "[" ]; then
569 targetJson=$targetJson","
571 if [ $pid != "EMPTY" ]; then
572 targetJson=$targetJson"\"$pid\""
576 targetJson=$targetJson"]"
577 echo " TARGET JSON: $targetJson" >> $HTTPLOG
578 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
580 if [ $res -ne 0 ]; then
590 # API Test function: GET ​/A1-EI​/v1​/eitypes​/{eiTypeId}
591 # args: <response-code> <type-id> [<schema-file>]
592 # (Function for test scripts)
593 ecs_api_a1_get_type() {
596 if [ $# -lt 2 ] || [ $# -gt 3 ]; then
597 __print_err "<response-code> <type-id> [<schema-file>]" $@
601 query="/A1-EI/v1/eitypes/$2"
602 res="$(__do_curl_to_api ECS GET $query)"
603 status=${res:${#res}-3}
605 if [ $status -ne $1 ]; then
606 __log_test_fail_status_code $1 $status
610 if [ $# -eq 3 ]; then
611 body=${res:0:${#res}-3}
615 __log_test_fail_general "Schema file "$3", does not exist"
618 if [ -z "$FLAT_A1_EI" ]; then
619 targetJson="{\"eiJobParametersSchema\":$schema}"
623 echo " TARGET JSON: $targetJson" >> $HTTPLOG
624 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
626 if [ $res -ne 0 ]; then
636 # API Test function: GET /A1-EI/v1/eitypes
637 # args: <response-code> [ (EMPTY | [<type-id>]+) ]
638 # (Function for test scripts)
639 ecs_api_a1_get_type_ids() {
642 if [ $# -lt 1 ]; then
643 __print_err "<response-code> [ (EMPTY | [<type-id>]+) ]" $@
647 query="/A1-EI/v1/eitypes"
648 res="$(__do_curl_to_api ECS GET $query)"
649 status=${res:${#res}-3}
651 if [ $status -ne $1 ]; then
652 __log_test_fail_status_code $1 $status
655 if [ $# -gt 1 ]; then
656 body=${res:0:${#res}-3}
658 if [ $2 != "EMPTY" ]; then
659 for pid in ${@:2} ; do
660 if [ "$targetJson" != "[" ]; then
661 targetJson=$targetJson","
663 targetJson=$targetJson"\"$pid\""
666 targetJson=$targetJson"]"
667 echo " TARGET JSON: $targetJson" >> $HTTPLOG
668 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
670 if [ $res -ne 0 ]; then
680 # API Test function: GET ​/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}​/status
681 # args: <response-code> <type-id> <job-id> [<status>]
682 # args (flat uri structure): <response-code> <job-id> [<status> [<timeout>]]
683 # (Function for test scripts)
684 ecs_api_a1_get_job_status() {
687 if [ -z "$FLAT_A1_EI" ]; then
688 if [ $# -ne 3 ] && [ $# -ne 4 ]; then
689 __print_err "<response-code> <type-id> <job-id> [<status>]" $@
693 query="/A1-EI/v1/eitypes/$2/eijobs/$3/status"
695 res="$(__do_curl_to_api ECS GET $query)"
696 status=${res:${#res}-3}
698 if [ $status -ne $1 ]; then
699 __log_test_fail_status_code $1 $status
702 if [ $# -eq 4 ]; then
703 body=${res:0:${#res}-3}
704 targetJson="{\"operationalState\": \"$4\"}"
705 echo " TARGET JSON: $targetJson" >> $HTTPLOG
706 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
708 if [ $res -ne 0 ]; then
714 echo -e $YELLOW"INTERFACE - FLAT URI STRUCTURE"$EYELLOW
715 if [ $# -lt 2 ] && [ $# -gt 4 ]; then
716 __print_err "<response-code> <job-id> [<status> [<timeout>]]" $@
720 query="/A1-EI/v1/eijobs/$2/status"
724 res="$(__do_curl_to_api ECS GET $query)"
725 status=${res:${#res}-3}
727 if [ $# -eq 4 ]; then
728 duration=$((SECONDS-start))
729 echo -ne " Response=${status} after ${duration} seconds, waiting for ${3} ${SAMELINE}"
730 if [ $duration -gt $4 ]; then
732 duration=-1 #Last iteration
735 duration=-1 #single test, no wait
738 if [ $status -ne $1 ]; then
739 if [ $duration -eq -1 ]; then
740 __log_test_fail_status_code $1 $status
744 if [ $# -ge 3 ] && [ $status -eq $1 ]; then
745 body=${res:0:${#res}-3}
746 targetJson="{\"eiJobStatus\": \"$3\"}"
747 echo " TARGET JSON: $targetJson" >> $HTTPLOG
748 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
750 if [ $res -ne 0 ]; then
751 if [ $duration -eq -1 ]; then
756 duration=-1 #Goto pass
759 if [ $duration -eq -1 ]; then
760 if [ $# -eq 4 ]; then
775 # API Test function: GET ​/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}
776 # args: <response-code> <type-id> <job-id> [<target-url> <owner-id> <template-job-file>]
777 # args (flat uri structure): <response-code> <job-id> [<type-id> <target-url> <owner-id> <template-job-file>]
778 # (Function for test scripts)
779 ecs_api_a1_get_job() {
782 if [ -z "$FLAT_A1_EI" ]; then
783 if [ $# -ne 3 ] && [ $# -ne 6 ]; then
784 __print_err "<response-code> <type-id> <job-id> [<target-url> <owner-id> <template-job-file>]" $@
787 query="/A1-EI/v1/eitypes/$2/eijobs/$3"
789 echo -e $YELLOW"INTERFACE - FLAT URI STRUCTURE"$EYELLOW
790 if [ $# -ne 2 ] && [ $# -ne 7 ]; then
791 __print_err "<response-code> <job-id> [<type-id> <target-url> <owner-id> <notification-url> <template-job-file>]" $@
794 query="/A1-EI/v1/eijobs/$2"
796 res="$(__do_curl_to_api ECS GET $query)"
797 status=${res:${#res}-3}
799 if [ $status -ne $1 ]; then
800 __log_test_fail_status_code $1 $status
804 if [ -z "$FLAT_A1_EI" ]; then
805 if [ $# -eq 6 ]; then
806 body=${res:0:${#res}-3}
810 jobfile=$(echo "$jobfile" | sed "s/XXXX/$3/g")
812 __log_test_fail_general "Job template file "$6", does not exist"
815 targetJson="{\"targetUri\": \"$4\",\"jobOwner\": \"$5\",\"jobParameters\": $jobfile}"
816 echo " TARGET JSON: $targetJson" >> $HTTPLOG
817 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
819 if [ $res -ne 0 ]; then
825 if [ $# -eq 7 ]; then
826 body=${res:0:${#res}-3}
830 jobfile=$(echo "$jobfile" | sed "s/XXXX/$2/g")
832 __log_test_fail_general "Job template file "$6", does not exist"
835 targetJson="{\"eiTypeId\": \"$3\", \"jobResultUri\": \"$4\",\"jobOwner\": \"$5\",\"jobStatusNotificationUri\": \"$6\",\"jobDefinition\": $jobfile}"
836 echo " TARGET JSON: $targetJson" >> $HTTPLOG
837 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
839 if [ $res -ne 0 ]; then
850 # API Test function: DELETE ​/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}
851 # args: <response-code> <type-id> <job-id>
852 # args (flat uri structure): <response-code> <job-id>
853 # (Function for test scripts)
854 ecs_api_a1_delete_job() {
857 if [ -z "$FLAT_A1_EI" ]; then
858 if [ $# -ne 3 ]; then
859 __print_err "<response-code> <type-id> <job-id>" $@
863 query="/A1-EI/v1/eitypes/$2/eijobs/$3"
865 echo -e $YELLOW"INTERFACE - FLAT URI STRUCTURE"$EYELLOW
866 if [ $# -ne 2 ]; then
867 __print_err "<response-code> <job-id>" $@
870 query="/A1-EI/v1/eijobs/$2"
872 res="$(__do_curl_to_api ECS DELETE $query)"
873 status=${res:${#res}-3}
875 if [ $status -ne $1 ]; then
876 __log_test_fail_status_code $1 $status
884 # API Test function: PUT ​/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}
885 # args: <response-code> <type-id> <job-id> <target-url> <owner-id> <template-job-file>
886 # args (flat uri structure): <response-code> <job-id> <type-id> <target-url> <owner-id> <notification-url> <template-job-file>
887 # (Function for test scripts)
888 ecs_api_a1_put_job() {
891 if [ -z "$FLAT_A1_EI" ]; then
892 if [ $# -lt 6 ]; then
893 __print_err "<response-code> <type-id> <job-id> <target-url> <owner-id> <template-job-file>" $@
898 jobfile=$(echo "$jobfile" | sed "s/XXXX/$3/g")
900 __log_test_fail_general "Job template file "$6", does not exist"
904 inputJson="{\"targetUri\": \"$4\",\"jobOwner\": \"$5\",\"jobParameters\": $jobfile}"
906 echo "$inputJson" > $file
908 query="/A1-EI/v1/eitypes/$2/eijobs/$3"
910 echo -e $YELLOW"INTERFACE - FLAT URI STRUCTURE"$EYELLOW
911 if [ $# -lt 7 ]; then
912 __print_err "<response-code> <job-id> <type-id> <target-url> <owner-id> <notification-url> <template-job-file>" $@
917 jobfile=$(echo "$jobfile" | sed "s/XXXX/$2/g")
919 __log_test_fail_general "Job template file "$7", does not exist"
923 inputJson="{\"eiTypeId\": \"$3\", \"jobResultUri\": \"$4\",\"jobOwner\": \"$5\",\"jobStatusNotificationUri\": \"$6\",\"jobDefinition\": $jobfile}"
925 echo "$inputJson" > $file
927 query="/A1-EI/v1/eijobs/$2"
930 res="$(__do_curl_to_api ECS PUT $query $file)"
931 status=${res:${#res}-3}
933 if [ $status -ne $1 ]; then
934 __log_test_fail_status_code $1 $status
943 ##########################################
944 #### Enrichment Data Producer API ####
945 ##########################################
946 # Function prefix: ecs_api_edp
948 # API Test function: GET /ei-producer/v1/eitypes
949 # API Test function: GET /data-producer/v1/info-types
950 # args: <response-code> [ EMPTY | <type-id>+]
951 # (Function for test scripts)
952 ecs_api_edp_get_type_ids() {
955 if [ $# -lt 1 ]; then
956 __print_err "<response-code> [ EMPTY | <type-id>+]" $@
959 if [[ "$ECS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
960 query="/data-producer/v1/info-types"
962 query="/ei-producer/v1/eitypes"
964 res="$(__do_curl_to_api ECS GET $query)"
965 status=${res:${#res}-3}
967 if [ $status -ne $1 ]; then
968 __log_test_fail_status_code $1 $status
972 if [ $# -gt 1 ]; then
973 body=${res:0:${#res}-3}
975 if [ $2 != "EMPTY" ]; then
976 for pid in ${@:2} ; do
977 if [ "$targetJson" != "[" ]; then
978 targetJson=$targetJson","
980 targetJson=$targetJson"\"$pid\""
983 targetJson=$targetJson"]"
984 echo " TARGET JSON: $targetJson" >> $HTTPLOG
985 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
987 if [ $res -ne 0 ]; then
997 # API Test function: GET /ei-producer/v1/eiproducers/{eiProducerId}/status
998 # API Test function: GET /data-producer/v1/info-producers/{infoProducerId}/status
999 # args: <response-code> <producer-id> [<status> [<timeout>]]
1000 # (Function for test scripts)
1001 ecs_api_edp_get_producer_status() {
1004 if [ $# -lt 2 ] || [ $# -gt 4 ]; then
1005 __print_err "<response-code> <producer-id> [<status> [<timeout>]]" $@
1008 if [[ "$ECS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
1009 query="/data-producer/v1/info-producers/$2/status"
1011 query="/ei-producer/v1/eiproducers/$2/status"
1015 res="$(__do_curl_to_api ECS GET $query)"
1016 status=${res:${#res}-3}
1018 if [ $# -eq 4 ]; then
1019 duration=$((SECONDS-start))
1020 echo -ne " Response=${status} after ${duration} seconds, waiting for ${3} ${SAMELINE}"
1021 if [ $duration -gt $4 ]; then
1023 duration=-1 #Last iteration
1026 duration=-1 #single test, no wait
1029 if [ $status -ne $1 ]; then
1030 if [ $duration -eq -1 ]; then
1031 __log_test_fail_status_code $1 $status
1035 if [ $# -ge 3 ] && [ $status -eq $1 ]; then
1036 body=${res:0:${#res}-3}
1037 targetJson="{\"operational_state\": \"$3\"}"
1038 echo " TARGET JSON: $targetJson" >> $HTTPLOG
1039 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
1041 if [ $res -ne 0 ]; then
1042 if [ $duration -eq -1 ]; then
1043 __log_test_fail_body
1047 duration=-1 #Goto pass
1050 if [ $duration -eq -1 ]; then
1051 if [ $# -eq 4 ]; then
1063 # API Test function: GET /ei-producer/v1/eiproducers
1064 # args (v1_1): <response-code> [ EMPTY | <producer-id>+]
1065 # (Function for test scripts)
1066 ecs_api_edp_get_producer_ids() {
1069 if [ $# -lt 1 ]; then
1070 __print_err "<response-code> [ EMPTY | <producer-id>+]" $@
1074 query="/ei-producer/v1/eiproducers"
1075 res="$(__do_curl_to_api ECS GET $query)"
1076 status=${res:${#res}-3}
1078 if [ $status -ne $1 ]; then
1079 __log_test_fail_status_code $1 $status
1083 if [ $# -gt 1 ]; then
1084 body=${res:0:${#res}-3}
1087 for pid in ${@:2} ; do
1088 if [ "$targetJson" != "[" ]; then
1089 targetJson=$targetJson","
1091 if [ $pid != "EMPTY" ]; then
1092 targetJson=$targetJson"\"$pid\""
1096 targetJson=$targetJson"]"
1097 echo " TARGET JSON: $targetJson" >> $HTTPLOG
1098 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
1100 if [ $res -ne 0 ]; then
1101 __log_test_fail_body
1110 # API Test function: GET /ei-producer/v1/eiproducers
1111 # API Test function: GET /data-producer/v1/info-producers
1112 # args (v1_2): <response-code> [ ( NOTYPE | <type-id> ) [ EMPTY | <producer-id>+] ]
1113 # (Function for test scripts)
1114 ecs_api_edp_get_producer_ids_2() {
1117 if [ $# -lt 1 ]; then
1118 __print_err "<response-code> [ ( NOTYPE | <type-id> ) [ EMPTY | <producer-id>+] ]" $@
1121 if [[ "$ECS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
1122 query="/data-producer/v1/info-producers"
1123 if [ $# -gt 1 ] && [ $2 != "NOTYPE" ]; then
1124 query=$query"?info_type_id=$2"
1127 query="/ei-producer/v1/eiproducers"
1128 if [ $# -gt 1 ] && [ $2 != "NOTYPE" ]; then
1129 query=$query"?ei_type_id=$2"
1132 res="$(__do_curl_to_api ECS GET $query)"
1133 status=${res:${#res}-3}
1135 if [ $status -ne $1 ]; then
1136 __log_test_fail_status_code $1 $status
1140 if [ $# -gt 2 ]; then
1141 body=${res:0:${#res}-3}
1144 for pid in ${@:3} ; do
1145 if [ "$targetJson" != "[" ]; then
1146 targetJson=$targetJson","
1148 if [ $pid != "EMPTY" ]; then
1149 targetJson=$targetJson"\"$pid\""
1153 targetJson=$targetJson"]"
1154 echo " TARGET JSON: $targetJson" >> $HTTPLOG
1155 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
1157 if [ $res -ne 0 ]; then
1158 __log_test_fail_body
1167 # API Test function: GET /ei-producer/v1/eitypes/{eiTypeId}
1168 # args: (v1_1) <response-code> <type-id> [<job-schema-file> (EMPTY | [<producer-id>]+)]
1169 # (Function for test scripts)
1170 ecs_api_edp_get_type() {
1174 if [ $# -eq 2 ]; then
1177 if [ $# -gt 3 ]; then
1180 if [ $paramError -ne 0 ]; then
1181 __print_err "<response-code> <type-id> [<job-schema-file> 'EMPTY' | ([<producer-id>]+)]" $@
1185 query="/ei-producer/v1/eitypes/$2"
1186 res="$(__do_curl_to_api ECS GET $query)"
1187 status=${res:${#res}-3}
1189 if [ $status -ne $1 ]; then
1190 __log_test_fail_status_code $1 $status
1193 if [ $# -gt 3 ]; then
1194 body=${res:0:${#res}-3}
1199 __log_test_fail_general "Job template file "$3", does not exist"
1204 if [ $4 != "EMPTY" ]; then
1205 for pid in ${@:4} ; do
1206 if [ "$targetJson" != "" ]; then
1207 targetJson=$targetJson","
1209 targetJson=$targetJson"\"$pid\""
1212 targetJson="{\"ei_job_data_schema\":$schema, \"ei_producer_ids\": [$targetJson]}"
1214 echo " TARGET JSON: $targetJson" >> $HTTPLOG
1215 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
1217 if [ $res -ne 0 ]; then
1218 __log_test_fail_body
1226 # API Test function: GET /ei-producer/v1/eitypes/{eiTypeId}
1227 # API Test function: GET /data-producer/v1/info-types/{infoTypeId}
1228 # args: (v1_2) <response-code> <type-id> [<job-schema-file> ]
1229 # (Function for test scripts)
1230 ecs_api_edp_get_type_2() {
1234 if [ $# -eq 2 ]; then
1237 if [ $# -eq 3 ]; then
1240 if [ $paramError -ne 0 ]; then
1241 __print_err "<response-code> <type-id> [<job-schema-file> ]" $@
1244 if [[ "$ECS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
1245 query="/data-producer/v1/info-types/$2"
1247 query="/ei-producer/v1/eitypes/$2"
1250 res="$(__do_curl_to_api ECS GET $query)"
1251 status=${res:${#res}-3}
1253 if [ $status -ne $1 ]; then
1254 __log_test_fail_status_code $1 $status
1257 if [ $# -eq 3 ]; then
1258 body=${res:0:${#res}-3}
1263 __log_test_fail_general "Job template file "$3", does not exist"
1266 if [[ "$ECS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
1267 targetJson="{\"info_job_data_schema\":$schema}"
1269 targetJson="{\"ei_job_data_schema\":$schema}"
1272 echo " TARGET JSON: $targetJson" >> $HTTPLOG
1273 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
1275 if [ $res -ne 0 ]; then
1276 __log_test_fail_body
1284 # API Test function: PUT /ei-producer/v1/eitypes/{eiTypeId}
1285 # API Test function: PUT /data-producer/v1/info-types/{infoTypeId}
1286 # args: (v1_2) <response-code> <type-id> <job-schema-file>
1287 # (Function for test scripts)
1288 ecs_api_edp_put_type_2() {
1291 if [ $# -ne 3 ]; then
1292 __print_err "<response-code> <type-id> <job-schema-file>" $@
1296 if [ ! -f $3 ]; then
1297 __log_test_fail_general "Job schema file "$3", does not exist"
1300 if [[ "$ECS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
1302 input_json="{\"info_job_data_schema\":$schema}"
1303 file="./tmp/put_type.json"
1304 echo $input_json > $file
1306 query="/data-producer/v1/info-types/$2"
1309 input_json="{\"ei_job_data_schema\":$schema}"
1310 file="./tmp/put_type.json"
1311 echo $input_json > $file
1313 query="/ei-producer/v1/eitypes/$2"
1315 res="$(__do_curl_to_api ECS PUT $query $file)"
1316 status=${res:${#res}-3}
1318 if [ $status -ne $1 ]; then
1319 __log_test_fail_status_code $1 $status
1327 # API Test function: DELETE /ei-producer/v1/eitypes/{eiTypeId}
1328 # API Test function: DELETE /data-producer/v1/info-types/{infoTypeId}
1329 # args: (v1_2) <response-code> <type-id>
1330 # (Function for test scripts)
1331 ecs_api_edp_delete_type_2() {
1334 if [ $# -ne 2 ]; then
1335 __print_err "<response-code> <type-id>" $@
1339 if [[ "$ECS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
1340 query="/data-producer/v1/info-types/$2"
1342 query="/ei-producer/v1/eitypes/$2"
1344 res="$(__do_curl_to_api ECS DELETE $query)"
1345 status=${res:${#res}-3}
1347 if [ $status -ne $1 ]; then
1348 __log_test_fail_status_code $1 $status
1356 # API Test function: GET /ei-producer/v1/eiproducers/{eiProducerId}
1357 # args: (v1_1) <response-code> <producer-id> [<job-callback> <supervision-callback> (EMPTY | [<type-id> <schema-file>]+) ]
1358 # (Function for test scripts)
1359 ecs_api_edp_get_producer() {
1362 #Possible arg count: 2, 5 6, 8, 10 etc
1364 if [ $# -eq 2 ]; then
1367 if [ $# -eq 5 ] && [ "$5" == "EMPTY" ]; then
1370 variablecount=$(($#-4))
1371 if [ $# -gt 5 ] && [ $(($variablecount%2)) -eq 0 ]; then
1375 if [ $paramError -ne 0 ]; then
1376 __print_err "<response-code> <producer-id> [<job-callback> <supervision-callback> (NOID | [<type-id> <schema-file>]+) ]" $@
1380 query="/ei-producer/v1/eiproducers/$2"
1381 res="$(__do_curl_to_api ECS GET $query)"
1382 status=${res:${#res}-3}
1384 if [ $status -ne $1 ]; then
1385 __log_test_fail_status_code $1 $status
1389 if [ $# -gt 2 ]; then
1390 body=${res:0:${#res}-3}
1392 if [ $# -gt 5 ]; then
1394 for ((i=0; i<$(($#-5)); i=i+2)); do
1395 if [ "$targetJson" != "[" ]; then
1396 targetJson=$targetJson","
1398 if [ -f ${arr[$i+1]} ]; then
1399 schema=$(cat ${arr[$i+1]})
1401 __log_test_fail_general "Schema file "${arr[$i+1]}", does not exist"
1405 targetJson=$targetJson"{\"ei_type_identity\":\"${arr[$i]}\",\"ei_job_data_schema\":$schema}"
1408 targetJson=$targetJson"]"
1409 if [ $# -gt 4 ]; then
1410 targetJson="{\"supported_ei_types\":$targetJson,\"ei_job_callback_url\": \"$3\",\"ei_producer_supervision_callback_url\": \"$4\"}"
1412 echo " TARGET JSON: $targetJson" >> $HTTPLOG
1413 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
1415 if [ $res -ne 0 ]; then
1416 __log_test_fail_body
1425 # API Test function: GET /ei-producer/v1/eiproducers/{eiProducerId}
1426 # API Test function: GET /data-producer/v1/info-producers/{infoProducerId}
1427 # args (v1_2): <response-code> <producer-id> [<job-callback> <supervision-callback> (EMPTY | <type-id>+) ]
1428 # (Function for test scripts)
1429 ecs_api_edp_get_producer_2() {
1432 #Possible arg count: 2, 5, 6, 7, 8 etc
1434 if [ $# -eq 2 ]; then
1437 if [ $# -eq 5 ] && [ "$5" == "EMPTY" ]; then
1440 if [ $# -ge 5 ]; then
1444 if [ $paramError -ne 0 ]; then
1445 __print_err "<response-code> <producer-id> [<job-callback> <supervision-callback> (EMPTY | <type-id>+) ]" $@
1448 if [[ "$ECS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
1449 query="/data-producer/v1/info-producers/$2"
1451 query="/ei-producer/v1/eiproducers/$2"
1453 res="$(__do_curl_to_api ECS GET $query)"
1454 status=${res:${#res}-3}
1456 if [ $status -ne $1 ]; then
1457 __log_test_fail_status_code $1 $status
1461 if [ $# -gt 2 ]; then
1462 body=${res:0:${#res}-3}
1464 if [ $# -gt 4 ] && [ "$5" != "EMPTY" ]; then
1466 for ((i=0; i<$(($#-4)); i=i+1)); do
1467 if [ "$targetJson" != "[" ]; then
1468 targetJson=$targetJson","
1470 targetJson=$targetJson"\"${arr[$i]}\""
1473 targetJson=$targetJson"]"
1474 if [ $# -gt 4 ]; then
1475 if [[ "$ECS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
1476 targetJson="{\"supported_info_types\":$targetJson,\"info_job_callback_url\": \"$3\",\"info_producer_supervision_callback_url\": \"$4\"}"
1478 targetJson="{\"supported_ei_types\":$targetJson,\"ei_job_callback_url\": \"$3\",\"ei_producer_supervision_callback_url\": \"$4\"}"
1481 echo " TARGET JSON: $targetJson" >> $HTTPLOG
1482 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
1484 if [ $res -ne 0 ]; then
1485 __log_test_fail_body
1494 # API Test function: DELETE /ei-producer/v1/eiproducers/{eiProducerId}
1495 # API Test function: DELETE /data-producer/v1/info-producers/{infoProducerId}
1496 # args: <response-code> <producer-id>
1497 # (Function for test scripts)
1498 ecs_api_edp_delete_producer() {
1501 if [ $# -lt 2 ]; then
1502 __print_err "<response-code> <producer-id>" $@
1505 if [[ "$ECS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
1506 query="/data-producer/v1/info-producers/$2"
1508 query="/ei-producer/v1/eiproducers/$2"
1510 res="$(__do_curl_to_api ECS DELETE $query)"
1511 status=${res:${#res}-3}
1513 if [ $status -ne $1 ]; then
1514 __log_test_fail_status_code $1 $status
1522 # API Test function: PUT /ei-producer/v1/eiproducers/{eiProducerId}
1523 # args: (v1_1) <response-code> <producer-id> <job-callback> <supervision-callback> NOTYPE|[<type-id> <schema-file>]+
1524 # (Function for test scripts)
1525 ecs_api_edp_put_producer() {
1528 #Valid number of parametrer 5,6,8,10,
1530 if [ $# -eq 5 ] && [ "$5" == "NOTYPE" ]; then
1532 elif [ $# -gt 5 ] && [ $(($#%2)) -eq 0 ]; then
1535 if [ $paramError -ne 0 ]; then
1536 __print_err "<response-code> <producer-id> <job-callback> <supervision-callback> NOTYPE|[<type-id> <schema-file>]+" $@
1541 if [ $# -gt 5 ]; then
1543 for ((i=0; i<$(($#-5)); i=i+2)); do
1544 if [ "$inputJson" != "[" ]; then
1545 inputJson=$inputJson","
1547 if [ -f ${arr[$i+1]} ]; then
1548 schema=$(cat ${arr[$i+1]})
1550 __log_test_fail_general "Schema file "${arr[$i+1]}", does not exist"
1553 inputJson=$inputJson"{\"ei_type_identity\":\"${arr[$i]}\",\"ei_job_data_schema\":$schema}"
1556 inputJson="\"supported_ei_types\":"$inputJson"]"
1558 inputJson=$inputJson",\"ei_job_callback_url\": \"$3\",\"ei_producer_supervision_callback_url\": \"$4\""
1560 inputJson="{"$inputJson"}"
1562 file="./tmp/.p.json"
1563 echo "$inputJson" > $file
1564 query="/ei-producer/v1/eiproducers/$2"
1565 res="$(__do_curl_to_api ECS PUT $query $file)"
1566 status=${res:${#res}-3}
1568 if [ $status -ne $1 ]; then
1569 __log_test_fail_status_code $1 $status
1577 # API Test function: PUT /ei-producer/v1/eiproducers/{eiProducerId}
1578 # API Test function: PUT /data-producer/v1/info-producers/{infoProducerId}
1579 # args: (v1_2) <response-code> <producer-id> <job-callback> <supervision-callback> NOTYPE|[<type-id>+]
1580 # (Function for test scripts)
1581 ecs_api_edp_put_producer_2() {
1584 #Valid number of parametrer 5,6,8,10,
1586 if [ $# -eq 5 ] && [ "$5" == "NOTYPE" ]; then
1588 elif [ $# -ge 5 ]; then
1591 if [ $paramError -ne 0 ]; then
1592 __print_err "<response-code> <producer-id> <job-callback> <supervision-callback> NOTYPE|[<type-id>+]" $@
1597 if [ $# -gt 4 ] && [ "$5" != "NOTYPE" ]; then
1599 for ((i=0; i<$(($#-4)); i=i+1)); do
1600 if [ "$inputJson" != "[" ]; then
1601 inputJson=$inputJson","
1603 inputJson=$inputJson"\""${arr[$i]}"\""
1606 if [[ "$ECS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
1607 inputJson="\"supported_info_types\":"$inputJson"]"
1609 inputJson=$inputJson",\"info_job_callback_url\": \"$3\",\"info_producer_supervision_callback_url\": \"$4\""
1611 inputJson="{"$inputJson"}"
1613 file="./tmp/.p.json"
1614 echo "$inputJson" > $file
1615 query="/data-producer/v1/info-producers/$2"
1617 inputJson="\"supported_ei_types\":"$inputJson"]"
1619 inputJson=$inputJson",\"ei_job_callback_url\": \"$3\",\"ei_producer_supervision_callback_url\": \"$4\""
1621 inputJson="{"$inputJson"}"
1623 file="./tmp/.p.json"
1624 echo "$inputJson" > $file
1625 query="/ei-producer/v1/eiproducers/$2"
1627 res="$(__do_curl_to_api ECS PUT $query $file)"
1628 status=${res:${#res}-3}
1630 if [ $status -ne $1 ]; then
1631 __log_test_fail_status_code $1 $status
1639 # API Test function: GET /ei-producer/v1/eiproducers/{eiProducerId}/eijobs
1640 # args: (V1-1) <response-code> <producer-id> (EMPTY | [<job-id> <type-id> <target-url> <job-owner> <template-job-file>]+)
1641 # (Function for test scripts)
1642 ecs_api_edp_get_producer_jobs() {
1645 #Valid number of parameter 2,3,7,11
1647 if [ $# -eq 2 ]; then
1650 if [ $# -eq 3 ] && [ "$3" == "EMPTY" ]; then
1653 variablecount=$(($#-2))
1654 if [ $# -gt 3 ] && [ $(($variablecount%5)) -eq 0 ]; then
1657 if [ $paramError -eq 1 ]; then
1658 __print_err "<response-code> <producer-id> (EMPTY | [<job-id> <type-id> <target-url> <job-owner> <template-job-file>]+)" $@
1662 query="/ei-producer/v1/eiproducers/$2/eijobs"
1663 res="$(__do_curl_to_api ECS GET $query)"
1664 status=${res:${#res}-3}
1665 if [ $status -ne $1 ]; then
1666 __log_test_fail_status_code $1 $status
1669 if [ $# -gt 2 ]; then
1670 body=${res:0:${#res}-3}
1672 if [ $# -gt 3 ]; then
1674 for ((i=0; i<$(($#-3)); i=i+5)); do
1675 if [ "$targetJson" != "[" ]; then
1676 targetJson=$targetJson","
1678 if [ -f ${arr[$i+4]} ]; then
1679 jobfile=$(cat ${arr[$i+4]})
1680 jobfile=$(echo "$jobfile" | sed "s/XXXX/${arr[$i]}/g")
1682 __log_test_fail_general "Job template file "${arr[$i+4]}", does not exist"
1685 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}"
1688 targetJson=$targetJson"]"
1690 echo " TARGET JSON: $targetJson" >> $HTTPLOG
1691 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
1693 if [ $res -ne 0 ]; then
1694 __log_test_fail_body
1703 # API Test function: GET /ei-producer/v1/eiproducers/{eiProducerId}/eijobs
1704 # API Test function: GET /data-producer/v1/info-producers/{infoProducerId}/info-jobs
1705 # args: (V1-2) <response-code> <producer-id> (EMPTY | [<job-id> <type-id> <target-url> <job-owner> <template-job-file>]+)
1706 # (Function for test scripts)
1707 ecs_api_edp_get_producer_jobs_2() {
1710 #Valid number of parameter 2,3,7,11
1712 if [ $# -eq 2 ]; then
1715 if [ $# -eq 3 ] && [ "$3" == "EMPTY" ]; then
1718 variablecount=$(($#-2))
1719 if [ $# -gt 3 ] && [ $(($variablecount%5)) -eq 0 ]; then
1722 if [ $paramError -eq 1 ]; then
1723 __print_err "<response-code> <producer-id> (EMPTY | [<job-id> <type-id> <target-url> <job-owner> <template-job-file>]+)" $@
1726 if [[ "$ECS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
1727 query="/data-producer/v1/info-producers/$2/info-jobs"
1729 query="/ei-producer/v1/eiproducers/$2/eijobs"
1731 res="$(__do_curl_to_api ECS GET $query)"
1732 status=${res:${#res}-3}
1733 if [ $status -ne $1 ]; then
1734 __log_test_fail_status_code $1 $status
1737 if [ $# -gt 2 ]; then
1738 body=${res:0:${#res}-3}
1740 if [ $# -gt 3 ]; then
1742 for ((i=0; i<$(($#-3)); i=i+5)); do
1743 if [ "$targetJson" != "[" ]; then
1744 targetJson=$targetJson","
1746 if [ -f ${arr[$i+4]} ]; then
1747 jobfile=$(cat ${arr[$i+4]})
1748 jobfile=$(echo "$jobfile" | sed "s/XXXX/${arr[$i]}/g")
1750 __log_test_fail_general "Job template file "${arr[$i+4]}", does not exist"
1753 if [[ "$ECS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
1754 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\":\"????\"}"
1756 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\":\"????\"}"
1760 targetJson=$targetJson"]"
1762 echo " TARGET JSON: $targetJson" >> $HTTPLOG
1763 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
1765 if [ $res -ne 0 ]; then
1766 __log_test_fail_body
1775 ##########################################
1776 #### Service status ####
1777 ##########################################
1778 # Function prefix: ecs_api_service
1780 # API Test function: GET ​/status
1781 # args: <response-code>
1782 # (Function for test scripts)
1783 ecs_api_service_status() {
1786 if [ $# -lt 1 ]; then
1787 __print_err "<response-code>" $@
1790 res="$(__do_curl_to_api ECS GET /status)"
1791 status=${res:${#res}-3}
1792 if [ $status -ne $1 ]; then
1793 __log_test_fail_status_code $1 $status
1800 ###########################################
1801 ######### Info data consumer API ##########
1802 ###########################################
1803 #Function prefix: ecs_api_idc
1806 # API Test function: GET /data-consumer/v1/info-types
1807 # args: <response-code> [ (EMPTY | [<type-id>]+) ]
1808 # (Function for test scripts)
1809 ecs_api_idc_get_type_ids() {
1812 if [ $# -lt 1 ]; then
1813 __print_err "<response-code> [ (EMPTY | [<type-id>]+) ]" $@
1817 query="/data-consumer/v1/info-types"
1818 res="$(__do_curl_to_api ECS GET $query)"
1819 status=${res:${#res}-3}
1821 if [ $status -ne $1 ]; then
1822 __log_test_fail_status_code $1 $status
1825 if [ $# -gt 1 ]; then
1826 body=${res:0:${#res}-3}
1828 if [ $2 != "EMPTY" ]; then
1829 for pid in ${@:2} ; do
1830 if [ "$targetJson" != "[" ]; then
1831 targetJson=$targetJson","
1833 targetJson=$targetJson"\"$pid\""
1836 targetJson=$targetJson"]"
1837 echo " TARGET JSON: $targetJson" >> $HTTPLOG
1838 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
1840 if [ $res -ne 0 ]; then
1841 __log_test_fail_body
1850 # API Test function: GET /data-consumer/v1/info-jobs
1851 # args: <response-code> <type-id>|NOTYPE <owner-id>|NOOWNER [ EMPTY | <job-id>+ ]
1852 # (Function for test scripts)
1853 ecs_api_idc_get_job_ids() {
1856 # Valid number of parameters 4,5,6 etc
1857 if [ $# -lt 3 ]; then
1858 __print_err "<response-code> <type-id>|NOTYPE <owner-id>|NOOWNER [ EMPTY | <job-id>+ ]" $@
1862 if [ $3 != "NOWNER" ]; then
1866 if [ $2 != "NOTYPE" ]; then
1867 if [ -z "$search" ]; then
1868 search="?infoTypeId="$2
1870 search=$search"&infoTypeId="$2
1873 query="/data-consumer/v1/info-jobs$search"
1875 res="$(__do_curl_to_api ECS GET $query)"
1876 status=${res:${#res}-3}
1878 if [ $status -ne $1 ]; then
1879 __log_test_fail_status_code $1 $status
1883 if [ $# -gt 3 ]; then
1884 body=${res:0:${#res}-3}
1887 for pid in ${@:4} ; do
1888 if [ "$targetJson" != "[" ]; then
1889 targetJson=$targetJson","
1891 if [ $pid != "EMPTY" ]; then
1892 targetJson=$targetJson"\"$pid\""
1896 targetJson=$targetJson"]"
1897 echo " TARGET JSON: $targetJson" >> $HTTPLOG
1898 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
1900 if [ $res -ne 0 ]; then
1901 __log_test_fail_body
1910 # API Test function: GET /data-consumer/v1/info-jobs/{infoJobId}
1911 # args: <response-code> <job-id> [<type-id> <target-url> <owner-id> <template-job-file>]
1912 # (Function for test scripts)
1913 ecs_api_idc_get_job() {
1916 if [ $# -ne 2 ] && [ $# -ne 7 ]; then
1917 __print_err "<response-code> <job-id> [<type-id> <target-url> <owner-id> <notification-url> <template-job-file>]" $@
1920 query="/data-consumer/v1/info-jobs/$2"
1921 res="$(__do_curl_to_api ECS GET $query)"
1922 status=${res:${#res}-3}
1924 if [ $status -ne $1 ]; then
1925 __log_test_fail_status_code $1 $status
1929 if [ $# -eq 7 ]; then
1930 body=${res:0:${#res}-3}
1934 jobfile=$(echo "$jobfile" | sed "s/XXXX/$2/g")
1936 __log_test_fail_general "Job template file "$6", does not exist"
1939 targetJson="{\"info_type_id\": \"$3\", \"job_result_uri\": \"$4\",\"job_owner\": \"$5\",\"status_notification_uri\": \"$6\",\"job_definition\": $jobfile}"
1940 echo " TARGET JSON: $targetJson" >> $HTTPLOG
1941 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
1943 if [ $res -ne 0 ]; then
1944 __log_test_fail_body
1954 # API Test function: PUT ​/data-consumer/v1/info-jobs/{infoJobId}
1955 # args: <response-code> <job-id> <type-id> <target-url> <owner-id> <notification-url> <template-job-file> [ VALIDATE ]
1956 # (Function for test scripts)
1957 ecs_api_idc_put_job() {
1960 if [ $# -lt 7 ] || [ $# -gt 8 ]; then
1961 __print_err "<response-code> <job-id> <type-id> <target-url> <owner-id> <notification-url> <template-job-file> [ VALIDATE ]" $@
1966 jobfile=$(echo "$jobfile" | sed "s/XXXX/$2/g")
1968 __log_test_fail_general "Job template file "$7", does not exist"
1972 inputJson="{\"info_type_id\": \"$3\", \"job_result_uri\": \"$4\",\"job_owner\": \"$5\",\"status_notification_uri\": \"$6\",\"job_definition\": $jobfile}"
1973 file="./tmp/.p.json"
1974 echo "$inputJson" > $file
1976 query="/data-consumer/v1/info-jobs/$2"
1978 if [ $# -eq 8 ]; then
1979 if [ $8 == "VALIDATE" ]; then
1980 query=$query"?typeCheck=true"
1984 res="$(__do_curl_to_api ECS PUT $query $file)"
1985 status=${res:${#res}-3}
1987 if [ $status -ne $1 ]; then
1988 __log_test_fail_status_code $1 $status
1996 # API Test function: DELETE ​/data-consumer/v1/info-jobs/{infoJobId}
1997 # args: <response-code> <job-id>
1998 # (Function for test scripts)
1999 ecs_api_idc_delete_job() {
2002 if [ $# -ne 2 ]; then
2003 __print_err "<response-code> <job-id>" $@
2006 query="/data-consumer/v1/info-jobs/$2"
2007 res="$(__do_curl_to_api ECS DELETE $query)"
2008 status=${res:${#res}-3}
2010 if [ $status -ne $1 ]; then
2011 __log_test_fail_status_code $1 $status
2019 # API Test function: GET ​/data-consumer/v1/info-types/{infoTypeId}
2020 # args: <response-code> <type-id> [<schema-file>]
2021 # (Function for test scripts)
2022 ecs_api_idc_get_type() {
2025 if [ $# -lt 2 ] || [ $# -gt 3 ]; then
2026 __print_err "<response-code> <type-id> [<schema-file>]" $@
2030 query="/data-consumer/v1/info-types/$2"
2031 res="$(__do_curl_to_api ECS GET $query)"
2032 status=${res:${#res}-3}
2034 if [ $status -ne $1 ]; then
2035 __log_test_fail_status_code $1 $status
2039 if [ $# -eq 3 ]; then
2040 body=${res:0:${#res}-3}
2044 __log_test_fail_general "Schema file "$3", does not exist"
2047 targetJson="{\"job_data_schema\":$schema}"
2048 echo " TARGET JSON: $targetJson" >> $HTTPLOG
2049 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
2051 if [ $res -ne 0 ]; then
2052 __log_test_fail_body
2061 # API Test function: GET /data-consumer/v1/info-jobs/{infoJobId}/status
2062 # This test only status during an optional timeout. No test of the list of producers
2063 # args: <response-code> <job-id> [<status> [<timeout>]]
2064 # (Function for test scripts)
2065 ecs_api_idc_get_job_status() {
2068 if [ $# -lt 2 ] && [ $# -gt 4 ]; then
2069 __print_err "<response-code> <job-id> [<status> [<timeout>]]" $@
2073 query="/data-consumer/v1/info-jobs/$2/status"
2077 res="$(__do_curl_to_api ECS GET $query)"
2078 status=${res:${#res}-3}
2080 if [ $# -eq 4 ]; then
2081 duration=$((SECONDS-start))
2082 echo -ne " Response=${status} after ${duration} seconds, waiting for ${3} ${SAMELINE}"
2083 if [ $duration -gt $4 ]; then
2085 duration=-1 #Last iteration
2088 duration=-1 #single test, no wait
2091 if [ $status -ne $1 ]; then
2092 if [ $duration -eq -1 ]; then
2093 __log_test_fail_status_code $1 $status
2097 if [ $# -ge 3 ] && [ $status -eq $1 ]; then
2098 body=${res:0:${#res}-3}
2099 targetJson="{\"info_job_status\": \"$3\"}"
2100 echo " TARGET JSON: $targetJson" >> $HTTPLOG
2101 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
2103 if [ $res -ne 0 ]; then
2104 if [ $duration -eq -1 ]; then
2105 __log_test_fail_body
2109 duration=-1 #Goto pass
2112 if [ $duration -eq -1 ]; then
2113 if [ $# -eq 4 ]; then
2127 # API Test function: GET /data-consumer/v1/info-jobs/{infoJobId}/status
2128 # This function test status and the list of producers with and optional timeout
2129 # args: <response-code> <job-id> [<status> EMPTYPROD|( <prod-count> <producer-id>+ ) [<timeout>]]
2130 # (Function for test scripts)
2131 ecs_api_idc_get_job_status2() {
2135 if [ $# -lt 2 ]; then
2140 if [ $# -gt 2 ]; then
2141 if [ $# -lt 4 ]; then
2144 targetJson="{\"info_job_status\": \"$3\""
2145 if [ "$4" == "EMPTYPROD" ]; then
2146 targetJson=$targetJson",\"producers\": []}"
2147 if [ $# -gt 4 ]; then
2151 targetJson=$targetJson",\"producers\": ["
2152 if [ $# -eq $(($4+5)) ]; then
2154 timeout=${args[$idx]}
2156 for ((ecs_i = 0 ; ecs_i < $4 ; ecs_i++)); do
2158 if [ $ecs_i -gt 0 ]; then
2159 targetJson=$targetJson","
2161 targetJson=$targetJson"\""${args[$idx]}"\""
2163 targetJson=$targetJson"]}"
2167 if [ $param_error -ne 0 ]; then
2168 __print_err "<response-code> <job-id> [<status> EMPTYPROD|( <prod-count> <producer-id>+ ) [<timeout>]]" $@
2172 query="/data-consumer/v1/info-jobs/$2/status"
2176 res="$(__do_curl_to_api ECS GET $query)"
2177 status=${res:${#res}-3}
2179 if [ $# -gt 2 ]; then
2180 duration=$((SECONDS-start))
2181 echo -ne " Response=${status} after ${duration} seconds, waiting for ${3} ${SAMELINE}"
2182 if [ $duration -gt $timeout ]; then
2184 duration=-1 #Last iteration
2187 duration=-1 #single test, no wait
2190 if [ $status -ne $1 ]; then
2191 if [ $duration -eq -1 ]; then
2192 __log_test_fail_status_code $1 $status
2196 if [ $# -gt 2 ] && [ $status -eq $1 ]; then
2197 body=${res:0:${#res}-3}
2198 echo " TARGET JSON: $targetJson" >> $HTTPLOG
2199 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
2201 if [ $res -ne 0 ]; then
2202 if [ $duration -eq -1 ]; then
2203 __log_test_fail_body
2207 duration=-1 #Goto pass
2210 if [ $duration -eq -1 ]; then
2211 if [ $# -eq 4 ]; then
2225 ##########################################
2226 #### Reset jobs ####
2227 ##########################################
2228 # Function prefix: ecs_api_admin
2230 # Admin to remove all jobs
2231 # args: <response-code> [ <type> ]
2232 # (Function for test scripts)
2234 ecs_api_admin_reset() {
2237 if [ -z "$FLAT_A1_EI" ]; then
2238 query="/A1-EI/v1/eitypes/$2/eijobs"
2240 query="/A1-EI/v1/eijobs"
2242 res="$(__do_curl_to_api ECS GET $query)"
2243 status=${res:${#res}-3}
2245 if [ $status -ne 200 ]; then
2246 __log_test_fail_status_code $1 $status
2250 #Remove brackets and response code
2251 body=${res:1:${#res}-4}
2252 list=$(echo ${body//,/ })
2253 list=$(echo ${list//[/})
2254 list=$(echo ${list//]/})
2255 list=$(echo ${list//\"/})
2257 for job in $list; do
2258 if [ -z "$FLAT_A1_EI" ]; then
2259 echo "Not supported for non-flat EI api"
2261 query="/A1-EI/v1/eijobs/$job"
2262 res="$(__do_curl_to_api ECS DELETE $query)"
2263 status=${res:${#res}-3}
2264 if [ $status -ne 204 ]; then
2265 __log_test_fail_status_code $1 $status
2268 echo " Deleted job: "$job
2276 ##########################################
2277 #### Reset jobs and producers ####
2278 ##########################################
2281 # Admin reset to remove all data in ecs; jobs, producers etc
2282 # NOTE - only works in kubernetes and the pod should not be running
2284 # (Function for test scripts)
2286 ecs_kube_pvc_reset() {
2289 pvc_name=$(kubectl get pvc -n nonrtric --no-headers -o custom-columns=":metadata.name" | grep enrichment)
2290 if [ -z "$pvc_name" ]; then
2291 pvc_name=enrichmentservice-pvc
2293 echo " Trying to reset pvc: "$pvc_name
2295 __kube_clean_pvc $ECS_APP_NAME nonrtric $pvc_name /var/enrichment-coordinator-service/database