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
23 # Host name may be changed if app started by kube
26 ECS_HOST_NAME=$LOCALHOST_NAME
27 ECS_PATH=$ECS_HTTPX"://"$ECS_HOST_NAME":"$ECS_EXTERNAL_PORT
29 # ECS_ADAPTER used for switch between REST and DMAAP (only REST supported currently)
30 ECS_ADAPTER_TYPE="REST"
33 # Make curl retries towards ECS for http response codes set in this env var, space separated list of codes
36 ###########################
38 ###########################
40 # All calls to ECS will be directed to the ECS REST interface from now on
42 # (Function for test scripts)
44 echo -e $BOLD"ECS protocol setting"$EBOLD
45 echo -e " Using $BOLD http $EBOLD and $BOLD REST $EBOLD towards ECS"
47 ECS_PATH=$ECS_HTTPX"://"$ECS_HOST_NAME":"$ECS_EXTERNAL_PORT
49 ECS_ADAPTER_TYPE="REST"
54 # All calls to ECS will be directed to the ECS REST interface from now on
56 # (Function for test scripts)
57 use_ecs_rest_https() {
58 echo -e $BOLD"ECS protocol setting"$EBOLD
59 echo -e " Using $BOLD https $EBOLD and $BOLD REST $EBOLD towards ECS"
61 ECS_PATH=$ECS_HTTPX"://"$ECS_HOST_NAME":"$ECS_EXTERNAL_SECURE_PORT
63 ECS_ADAPTER_TYPE="REST"
68 # All calls to ECS will be directed to the ECS dmaap interface over http from now on
70 # (Function for test scripts)
71 use_ecs_dmaap_http() {
72 echo -e $BOLD"ECS dmaap protocol setting"$EBOLD
73 echo -e $RED" - NOT SUPPORTED - "$ERED
74 echo -e " Using $BOLD http $EBOLD and $BOLD DMAAP $EBOLD towards ECS"
75 ECS_ADAPTER_TYPE="MR-HTTP"
79 # All calls to ECS will be directed to the ECS dmaap interface over https from now on
81 # (Function for test scripts)
82 use_ecs_dmaap_https() {
83 echo -e $BOLD"RICSIM protocol setting"$EBOLD
84 echo -e $RED" - NOT SUPPORTED - "$ERED
85 echo -e " Using $BOLD https $EBOLD and $BOLD REST $EBOLD towards ECS"
86 ECS_ADAPTER_TYPE="MR-HTTPS"
91 # args: PROXY|NOPROXY <config-file>
92 # (Function for test scripts)
95 echo -e $BOLD"Starting $ECS_DISPLAY_NAME"$EBOLD
97 if [ $RUNMODE == "KUBE" ]; then
99 # Check if app shall be fully managed by the test script
100 __check_included_image "ECS"
103 # Check if app shall only be used by the testscipt
104 __check_prestarted_image "ECS"
107 if [ $retcode_i -ne 0 ] && [ $retcode_p -ne 0 ]; then
108 echo -e $RED"The $ECS_APP_NAME app is not included as managed nor prestarted in this test script"$ERED
109 echo -e $RED"The $ECS_APP_NAME will not be started"$ERED
112 if [ $retcode_i -eq 0 ] && [ $retcode_p -eq 0 ]; then
113 echo -e $RED"The $ECS_APP_NAME app is included both as managed and prestarted in this test script"$ERED
114 echo -e $RED"The $ECS_APP_NAME will not be started"$ERED
119 if [ $retcode_p -eq 0 ]; then
120 echo -e " Using existing $ECS_APP_NAME deployment and service"
121 echo " Setting ECS replicas=1"
122 __kube_scale deployment $ECS_APP_NAME $KUBE_NONRTRIC_NAMESPACE 1
125 # Check if app shall be fully managed by the test script
126 if [ $retcode_i -eq 0 ]; then
127 echo -e " Creating $ECS_APP_NAME app and expose service"
129 #Check if nonrtric namespace exists, if not create it
130 __kube_create_namespace $KUBE_NONRTRIC_NAMESPACE
133 export KUBE_NONRTRIC_NAMESPACE
135 export ECS_INTERNAL_PORT
136 export ECS_INTERNAL_SECURE_PORT
137 export ECS_EXTERNAL_PORT
138 export ECS_EXTERNAL_SECURE_PORT
139 export ECS_CONFIG_MOUNT_PATH
140 export ECS_CONFIG_CONFIGMAP_NAME=$ECS_APP_NAME"-config"
141 export ECS_DATA_CONFIGMAP_NAME=$ECS_APP_NAME"-data"
142 export ECS_CONTAINER_MNT_DIR
144 if [ $1 == "PROXY" ]; then
145 ECS_HTTP_PROXY_CONFIG_PORT=$HTTP_PROXY_CONFIG_PORT #Set if proxy is started
146 ECS_HTTP_PROXY_CONFIG_HOST_NAME=$HTTP_PROXY_CONFIG_HOST_NAME #Set if proxy is started
147 if [ $ECS_HTTP_PROXY_CONFIG_PORT -eq 0 ] || [ -z "$ECS_HTTP_PROXY_CONFIG_HOST_NAME" ]; then
148 echo -e $YELLOW" Warning: HTTP PROXY will not be configured, proxy app not started"$EYELLOW
150 echo " Configured with http proxy"
153 ECS_HTTP_PROXY_CONFIG_PORT=0
154 ECS_HTTP_PROXY_CONFIG_HOST_NAME=""
155 echo " Configured without http proxy"
157 export ECS_HTTP_PROXY_CONFIG_PORT
158 export ECS_HTTP_PROXY_CONFIG_HOST_NAME
160 # Create config map for config
161 datafile=$PWD/tmp/$ECS_CONFIG_FILE
163 output_yaml=$PWD/tmp/ecs_cfc.yaml
164 __kube_create_configmap $ECS_CONFIG_CONFIGMAP_NAME $KUBE_NONRTRIC_NAMESPACE autotest ECS $datafile $output_yaml
167 input_yaml=$SIM_GROUP"/"$ECS_COMPOSE_DIR"/"pvc.yaml
168 output_yaml=$PWD/tmp/ecs_pvc.yaml
169 __kube_create_instance pvc $ECS_APP_NAME $input_yaml $output_yaml
172 input_yaml=$SIM_GROUP"/"$ECS_COMPOSE_DIR"/"svc.yaml
173 output_yaml=$PWD/tmp/ecs_svc.yaml
174 __kube_create_instance service $ECS_APP_NAME $input_yaml $output_yaml
177 input_yaml=$SIM_GROUP"/"$ECS_COMPOSE_DIR"/"app.yaml
178 output_yaml=$PWD/tmp/ecs_app.yaml
179 __kube_create_instance app $ECS_APP_NAME $input_yaml $output_yaml
182 echo " Retrieving host and ports for service..."
183 ECS_HOST_NAME=$(__kube_get_service_host $ECS_APP_NAME $KUBE_NONRTRIC_NAMESPACE)
184 ECS_EXTERNAL_PORT=$(__kube_get_service_port $ECS_APP_NAME $KUBE_NONRTRIC_NAMESPACE "http")
185 ECS_EXTERNAL_SECURE_PORT=$(__kube_get_service_port $ECS_APP_NAME $KUBE_NONRTRIC_NAMESPACE "https")
187 echo " Host IP, http port, https port: $ECS_HOST_NAME $ECS_EXTERNAL_PORT $ECS_EXTERNAL_SECURE_PORT"
189 if [ $ECS_HTTPX == "http" ]; then
190 ECS_PATH=$ECS_HTTPX"://"$ECS_HOST_NAME":"$ECS_EXTERNAL_PORT
192 ECS_PATH=$ECS_HTTPX"://"$ECS_HOST_NAME":"$ECS_EXTERNAL_SECURE_PORT
195 __check_service_start $ECS_APP_NAME $ECS_PATH$ECS_ALIVE_URL
197 if [ $ECS_ADAPTER_TYPE == "REST" ]; then
198 ECS_ADAPTER=$ECS_PATH
201 __check_included_image 'ECS'
202 if [ $? -eq 1 ]; then
203 echo -e $RED"The ECS app is not included in this test script"$ERED
204 echo -e $RED"ECS will not be started"$ERED
214 if [ "$(ls -A $DIR)" ]; then
215 echo -e $BOLD" Cleaning files in mounted dir: $PWD/db"$EBOLD
216 rm -rf db/* &> /dev/null
217 if [ $? -ne 0 ]; then
218 echo -e $RED" Cannot remove database files in: $PWD"$ERED
223 echo " No files in mounted dir or dir does not exists"
228 export ECS_APP_NAME_ALIAS
229 export ECS_HOST_MNT_DIR
230 export ECS_CONTAINER_MNT_DIR
231 export ECS_CONFIG_MOUNT_PATH
232 export ECS_CONFIG_FILE
233 export ECS_INTERNAL_PORT
234 export ECS_EXTERNAL_PORT
235 export ECS_INTERNAL_SECURE_PORT
236 export ECS_EXTERNAL_SECURE_PORT
237 export DOCKER_SIM_NWNAME
239 if [ $1 == "PROXY" ]; then
240 ECS_HTTP_PROXY_CONFIG_PORT=$HTTP_PROXY_CONFIG_PORT #Set if proxy is started
241 ECS_HTTP_PROXY_CONFIG_HOST_NAME=$HTTP_PROXY_CONFIG_HOST_NAME #Set if proxy is started
242 if [ $ECS_HTTP_PROXY_CONFIG_PORT -eq 0 ] || [ -z "$ECS_HTTP_PROXY_CONFIG_HOST_NAME" ]; then
243 echo -e $YELLOW" Warning: HTTP PROXY will not be configured, proxy app not started"$EYELLOW
245 echo " Configured with http proxy"
248 ECS_HTTP_PROXY_CONFIG_PORT=0
249 ECS_HTTP_PROXY_CONFIG_HOST_NAME=""
250 echo " Configured without http proxy"
252 export ECS_HTTP_PROXY_CONFIG_PORT
253 export ECS_HTTP_PROXY_CONFIG_HOST_NAME
255 dest_file=$SIM_GROUP/$ECS_COMPOSE_DIR/$ECS_HOST_MNT_DIR/$ECS_CONFIG_FILE
257 envsubst < $2 > $dest_file
259 __start_container $ECS_COMPOSE_DIR NODOCKERARGS 1 $ECS_APP_NAME
261 __check_service_start $ECS_APP_NAME $ECS_PATH$ECS_ALIVE_URL
269 # (Function for test scripts)
271 echo -e $BOLD"Re-starting ECS"$EBOLD
272 docker restart $ECS_APP_NAME &> ./tmp/.dockererr
273 if [ $? -ne 0 ]; then
274 __print_err "Could not restart $ECS_APP_NAME" $@
280 __check_service_start $ECS_APP_NAME $ECS_PATH$ECS_ALIVE_URL
285 # Turn on debug level tracing in ECS
287 # (Function for test scripts)
289 echo -e $BOLD"Setting ecs debug logging"$EBOLD
290 curlString="$ECS_PATH$ECS_ACTUATOR -X POST -H Content-Type:application/json -d {\"configuredLevel\":\"debug\"}"
291 result=$(__do_curl "$curlString")
292 if [ $? -ne 0 ]; then
293 __print_err "Could not set debug mode" $@
301 # Turn on trace level tracing in ECS
303 # (Function for test scripts)
305 echo -e $BOLD"Setting ecs trace logging"$EBOLD
306 curlString="$ECS_PATH/actuator/loggers/org.oransc.enrichment -X POST -H Content-Type:application/json -d {\"configuredLevel\":\"trace\"}"
307 result=$(__do_curl "$curlString")
308 if [ $? -ne 0 ]; then
309 __print_err "Could not set trace mode" $@
317 # Perform curl retries when making direct call to ECS for the specified http response codes
318 # Speace separated list of http response codes
319 # args: [<response-code>]*
321 echo -e $BOLD"Do curl retries to the ECS REST inteface for these response codes:$@"$EBOLD
328 # Tests if a variable value in the ECS is equal to a target value and and optional timeout.
329 # Arg: <variable-name> <target-value> - This test set pass or fail depending on if the variable is
330 # equal to the target or not.
331 # Arg: <variable-name> <target-value> <timeout-in-sec> - This test waits up to the timeout seconds
332 # before setting pass or fail depending on if the variable value becomes equal to the target
334 # (Function for test scripts)
336 if [ $# -eq 2 ] || [ $# -eq 3 ]; then
337 __var_test ECS "$ECS_PATH/" $1 "=" $2 $3
339 __print_err "Wrong args to ecs_equal, needs two or three args: <sim-param> <target-value> [ timeout ]" $@
344 ##########################################
345 ######### A1-E Enrichment API ##########
346 ##########################################
347 #Function prefix: ecs_api_a1
349 # API Test function: GET /A1-EI/v1/eitypes/{eiTypeId}/eijobs
350 # args: <response-code> <type-id> <owner-id>|NOOWNER [ EMPTY | <job-id>+ ]
351 # args (flat uri structure): <response-code> <type-id>|NOTYPE <owner-id>|NOOWNER [ EMPTY | <job-id>+ ]
352 # (Function for test scripts)
353 ecs_api_a1_get_job_ids() {
356 if [ -z "$FLAT_A1_EI" ]; then
357 # Valid number of parameters 4,5,6 etc
358 if [ $# -lt 3 ]; then
359 __print_err "<response-code> <type-id> <owner-id>|NOOWNER [ EMPTY | <job-id>+ ]" $@
363 echo -e $YELLOW"USING NOT CONFIRMED INTERFACE - FLAT URI STRUCTURE"$EYELLOW
364 # Valid number of parameters 4,5,6 etc
365 if [ $# -lt 3 ]; then
366 __print_err "<response-code> <type-id>|NOTYPE <owner-id>|NOOWNER [ EMPTY | <job-id>+ ]" $@
371 if [ $3 != "NOWNER" ]; then
375 if [ -z "$FLAT_A1_EI" ]; then
376 query="/A1-EI/v1/eitypes/$2/eijobs$search"
378 if [ $2 != "NOTYPE" ]; then
379 if [ -z "$search" ]; then
380 search="?eiTypeId="$2
382 search=$search"&eiTypeId="$2
385 query="/A1-EI/v1/eijobs$search"
387 res="$(__do_curl_to_api ECS GET $query)"
388 status=${res:${#res}-3}
390 if [ $status -ne $1 ]; then
391 __log_test_fail_status_code $1 $status
395 if [ $# -gt 3 ]; then
396 body=${res:0:${#res}-3}
399 for pid in ${@:4} ; do
400 if [ "$targetJson" != "[" ]; then
401 targetJson=$targetJson","
403 if [ $pid != "EMPTY" ]; then
404 targetJson=$targetJson"\"$pid\""
408 targetJson=$targetJson"]"
409 echo " TARGET JSON: $targetJson" >> $HTTPLOG
410 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
412 if [ $res -ne 0 ]; then
422 # API Test function: GET /A1-EI/v1/eitypes/{eiTypeId}
423 # args: <response-code> <type-id> [<schema-file>]
424 # (Function for test scripts)
425 ecs_api_a1_get_type() {
428 if [ $# -lt 2 ] || [ $# -gt 3 ]; then
429 __print_err "<response-code> <type-id> [<schema-file>]" $@
433 query="/A1-EI/v1/eitypes/$2"
434 res="$(__do_curl_to_api ECS GET $query)"
435 status=${res:${#res}-3}
437 if [ $status -ne $1 ]; then
438 __log_test_fail_status_code $1 $status
442 if [ $# -eq 3 ]; then
443 body=${res:0:${#res}-3}
447 __log_test_fail_general "Schema file "$3", does not exist"
450 if [ -z "$FLAT_A1_EI" ]; then
451 targetJson="{\"eiJobParametersSchema\":$schema}"
455 echo " TARGET JSON: $targetJson" >> $HTTPLOG
456 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
458 if [ $res -ne 0 ]; then
468 # API Test function: GET /A1-EI/v1/eitypes
469 # args: <response-code> [ (EMPTY | [<type-id>]+) ]
470 # (Function for test scripts)
471 ecs_api_a1_get_type_ids() {
474 if [ $# -lt 1 ]; then
475 __print_err "<response-code> [ (EMPTY | [<type-id>]+) ]" $@
479 query="/A1-EI/v1/eitypes"
480 res="$(__do_curl_to_api ECS GET $query)"
481 status=${res:${#res}-3}
483 if [ $status -ne $1 ]; then
484 __log_test_fail_status_code $1 $status
487 if [ $# -gt 1 ]; then
488 body=${res:0:${#res}-3}
490 if [ $2 != "EMPTY" ]; then
491 for pid in ${@:2} ; do
492 if [ "$targetJson" != "[" ]; then
493 targetJson=$targetJson","
495 targetJson=$targetJson"\"$pid\""
498 targetJson=$targetJson"]"
499 echo " TARGET JSON: $targetJson" >> $HTTPLOG
500 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
502 if [ $res -ne 0 ]; then
512 # API Test function: GET /A1-EI/v1/eitypes/{eiTypeId}/eijobs/{eiJobId}/status
513 # args: <response-code> <type-id> <job-id> [<status>]
514 # args (flat uri structure): <response-code> <job-id> [<status> [<timeout>]]
515 # (Function for test scripts)
516 ecs_api_a1_get_job_status() {
519 if [ -z "$FLAT_A1_EI" ]; then
520 if [ $# -ne 3 ] && [ $# -ne 4 ]; then
521 __print_err "<response-code> <type-id> <job-id> [<status>]" $@
525 query="/A1-EI/v1/eitypes/$2/eijobs/$3/status"
527 res="$(__do_curl_to_api ECS GET $query)"
528 status=${res:${#res}-3}
530 if [ $status -ne $1 ]; then
531 __log_test_fail_status_code $1 $status
534 if [ $# -eq 4 ]; then
535 body=${res:0:${#res}-3}
536 targetJson="{\"operationalState\": \"$4\"}"
537 echo " TARGET JSON: $targetJson" >> $HTTPLOG
538 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
540 if [ $res -ne 0 ]; then
546 echo -e $YELLOW"USING NOT CONFIRMED INTERFACE - FLAT URI STRUCTURE"$EYELLOW
547 if [ $# -lt 2 ] && [ $# -gt 4 ]; then
548 __print_err "<response-code> <job-id> [<status> [<timeout>]]" $@
552 query="/A1-EI/v1/eijobs/$2/status"
556 res="$(__do_curl_to_api ECS GET $query)"
557 status=${res:${#res}-3}
559 if [ $# -eq 4 ]; then
560 duration=$((SECONDS-start))
561 echo -ne " Response=${status} after ${duration} seconds, waiting for ${3} ${SAMELINE}"
562 if [ $duration -gt $4 ]; then
564 duration=-1 #Last iteration
567 duration=-1 #single test, no wait
570 if [ $status -ne $1 ]; then
571 if [ $duration -eq -1 ]; then
572 __log_test_fail_status_code $1 $status
576 if [ $# -ge 3 ] && [ $status -eq $1 ]; then
577 body=${res:0:${#res}-3}
578 targetJson="{\"eiJobStatus\": \"$3\"}"
579 echo " TARGET JSON: $targetJson" >> $HTTPLOG
580 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
582 if [ $res -ne 0 ]; then
583 if [ $duration -eq -1 ]; then
588 duration=-1 #Goto pass
591 if [ $duration -eq -1 ]; then
592 if [ $# -eq 4 ]; then
607 # API Test function: GET /A1-EI/v1/eitypes/{eiTypeId}/eijobs/{eiJobId}
608 # args: <response-code> <type-id> <job-id> [<target-url> <owner-id> <template-job-file>]
609 # args (flat uri structure): <response-code> <job-id> [<type-id> <target-url> <owner-id> <template-job-file>]
610 # (Function for test scripts)
611 ecs_api_a1_get_job() {
614 if [ -z "$FLAT_A1_EI" ]; then
615 if [ $# -ne 3 ] && [ $# -ne 6 ]; then
616 __print_err "<response-code> <type-id> <job-id> [<target-url> <owner-id> <template-job-file>]" $@
619 query="/A1-EI/v1/eitypes/$2/eijobs/$3"
621 echo -e $YELLOW"USING NOT CONFIRMED INTERFACE - FLAT URI STRUCTURE"$EYELLOW
622 if [ $# -ne 2 ] && [ $# -ne 7 ]; then
623 __print_err "<response-code> <job-id> [<type-id> <target-url> <owner-id> <notification-url> <template-job-file>]" $@
626 query="/A1-EI/v1/eijobs/$2"
628 res="$(__do_curl_to_api ECS GET $query)"
629 status=${res:${#res}-3}
631 if [ $status -ne $1 ]; then
632 __log_test_fail_status_code $1 $status
636 if [ -z "$FLAT_A1_EI" ]; then
637 if [ $# -eq 6 ]; then
638 body=${res:0:${#res}-3}
642 jobfile=$(echo "$jobfile" | sed "s/XXXX/$3/g")
644 _log_test_fail_general "Job template file "$6", does not exist"
647 targetJson="{\"targetUri\": \"$4\",\"jobOwner\": \"$5\",\"jobParameters\": $jobfile}"
648 echo " TARGET JSON: $targetJson" >> $HTTPLOG
649 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
651 if [ $res -ne 0 ]; then
657 if [ $# -eq 7 ]; then
658 body=${res:0:${#res}-3}
662 jobfile=$(echo "$jobfile" | sed "s/XXXX/$2/g")
664 _log_test_fail_general "Job template file "$6", does not exist"
667 targetJson="{\"eiTypeId\": \"$3\", \"jobResultUri\": \"$4\",\"jobOwner\": \"$5\",\"jobStatusNotificationUri\": \"$6\",\"jobDefinition\": $jobfile}"
668 echo " TARGET JSON: $targetJson" >> $HTTPLOG
669 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
671 if [ $res -ne 0 ]; then
682 # API Test function: DELETE /A1-EI/v1/eitypes/{eiTypeId}/eijobs/{eiJobId}
683 # args: <response-code> <type-id> <job-id>
684 # args (flat uri structure): <response-code> <job-id>
685 # (Function for test scripts)
686 ecs_api_a1_delete_job() {
689 if [ -z "$FLAT_A1_EI" ]; then
690 if [ $# -ne 3 ]; then
691 __print_err "<response-code> <type-id> <job-id>" $@
695 query="/A1-EI/v1/eitypes/$2/eijobs/$3"
697 echo -e $YELLOW"USING NOT CONFIRMED INTERFACE - FLAT URI STRUCTURE"$EYELLOW
698 if [ $# -ne 2 ]; then
699 __print_err "<response-code> <job-id>" $@
702 query="/A1-EI/v1/eijobs/$2"
704 res="$(__do_curl_to_api ECS DELETE $query)"
705 status=${res:${#res}-3}
707 if [ $status -ne $1 ]; then
708 __log_test_fail_status_code $1 $status
716 # API Test function: PUT /A1-EI/v1/eitypes/{eiTypeId}/eijobs/{eiJobId}
717 # args: <response-code> <type-id> <job-id> <target-url> <owner-id> <template-job-file>
718 # args (flat uri structure): <response-code> <job-id> <type-id> <target-url> <owner-id> <notification-url> <template-job-file>
719 # (Function for test scripts)
720 ecs_api_a1_put_job() {
723 if [ -z "$FLAT_A1_EI" ]; then
724 if [ $# -lt 6 ]; then
725 __print_err "<response-code> <type-id> <job-id> <target-url> <owner-id> <template-job-file>" $@
730 jobfile=$(echo "$jobfile" | sed "s/XXXX/$3/g")
732 _log_test_fail_general "Job template file "$6", does not exist"
736 inputJson="{\"targetUri\": \"$4\",\"jobOwner\": \"$5\",\"jobParameters\": $jobfile}"
738 echo "$inputJson" > $file
740 query="/A1-EI/v1/eitypes/$2/eijobs/$3"
742 echo -e $YELLOW"USING NOT CONFIRMED INTERFACE - FLAT URI STRUCTURE"$EYELLOW
743 if [ $# -lt 7 ]; then
744 __print_err "<response-code> <job-id> <type-id> <target-url> <owner-id> <notification-url> <template-job-file>" $@
749 jobfile=$(echo "$jobfile" | sed "s/XXXX/$2/g")
751 _log_test_fail_general "Job template file "$7", does not exist"
755 inputJson="{\"eiTypeId\": \"$3\", \"jobResultUri\": \"$4\",\"jobOwner\": \"$5\",\"jobStatusNotificationUri\": \"$6\",\"jobDefinition\": $jobfile}"
757 echo "$inputJson" > $file
759 query="/A1-EI/v1/eijobs/$2"
762 res="$(__do_curl_to_api ECS PUT $query $file)"
763 status=${res:${#res}-3}
765 if [ $status -ne $1 ]; then
766 __log_test_fail_status_code $1 $status
775 ##########################################
776 #### Enrichment Data Producer API ####
777 ##########################################
778 # Function prefix: ecs_api_edp
780 # API Test function: GET /ei-producer/v1/eitypes
781 # args: <response-code> [ EMPTY | <type-id>+]
782 # (Function for test scripts)
783 ecs_api_edp_get_type_ids() {
786 if [ $# -lt 1 ]; then
787 __print_err "<response-code> [ EMPTY | <type-id>+]" $@
791 query="/ei-producer/v1/eitypes"
792 res="$(__do_curl_to_api ECS GET $query)"
793 status=${res:${#res}-3}
795 if [ $status -ne $1 ]; then
796 __log_test_fail_status_code $1 $status
800 if [ $# -gt 1 ]; then
801 body=${res:0:${#res}-3}
803 if [ $2 != "EMPTY" ]; then
804 for pid in ${@:2} ; do
805 if [ "$targetJson" != "[" ]; then
806 targetJson=$targetJson","
808 targetJson=$targetJson"\"$pid\""
811 targetJson=$targetJson"]"
812 echo " TARGET JSON: $targetJson" >> $HTTPLOG
813 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
815 if [ $res -ne 0 ]; then
825 # API Test function: GET /ei-producer/v1/eiproducers/{eiProducerId}/status
826 # args: <response-code> <producer-id> [<status> [<timeout>]]
827 # (Function for test scripts)
828 ecs_api_edp_get_producer_status() {
831 if [ $# -lt 2 ] || [ $# -gt 4 ]; then
832 __print_err "<response-code> <producer-id> [<status> [<timeout>]]" $@
836 query="/ei-producer/v1/eiproducers/$2/status"
839 res="$(__do_curl_to_api ECS GET $query)"
840 status=${res:${#res}-3}
842 if [ $# -eq 4 ]; then
843 duration=$((SECONDS-start))
844 echo -ne " Response=${status} after ${duration} seconds, waiting for ${3} ${SAMELINE}"
845 if [ $duration -gt $4 ]; then
847 duration=-1 #Last iteration
850 duration=-1 #single test, no wait
853 if [ $status -ne $1 ]; then
854 if [ $duration -eq -1 ]; then
855 __log_test_fail_status_code $1 $status
859 if [ $# -ge 3 ] && [ $status -eq $1 ]; then
860 body=${res:0:${#res}-3}
861 targetJson="{\"operational_state\": \"$3\"}"
862 echo " TARGET JSON: $targetJson" >> $HTTPLOG
863 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
865 if [ $res -ne 0 ]; then
866 if [ $duration -eq -1 ]; then
871 duration=-1 #Goto pass
874 if [ $duration -eq -1 ]; then
875 if [ $# -eq 4 ]; then
887 # API Test function: GET /ei-producer/v1/eiproducers
888 # args (v1_1): <response-code> [ EMPTY | <producer-id>+]
889 # (Function for test scripts)
890 ecs_api_edp_get_producer_ids() {
893 if [ $# -lt 1 ]; then
894 __print_err "<response-code> [ EMPTY | <producer-id>+]" $@
898 query="/ei-producer/v1/eiproducers"
899 res="$(__do_curl_to_api ECS GET $query)"
900 status=${res:${#res}-3}
902 if [ $status -ne $1 ]; then
903 __log_test_fail_status_code $1 $status
907 if [ $# -gt 1 ]; then
908 body=${res:0:${#res}-3}
911 for pid in ${@:2} ; do
912 if [ "$targetJson" != "[" ]; then
913 targetJson=$targetJson","
915 if [ $pid != "EMPTY" ]; then
916 targetJson=$targetJson"\"$pid\""
920 targetJson=$targetJson"]"
921 echo " TARGET JSON: $targetJson" >> $HTTPLOG
922 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
924 if [ $res -ne 0 ]; then
934 # API Test function: GET /ei-producer/v1/eiproducers
935 # args (v1_2): <response-code> [ ( NOTYPE | <type-id> ) [ EMPTY | <producer-id>+] ]
936 # (Function for test scripts)
937 ecs_api_edp_get_producer_ids_2() {
940 if [ $# -lt 1 ]; then
941 __print_err "<response-code> [ ( NOTYPE | <type-id> ) [ EMPTY | <producer-id>+] ]" $@
945 query="/ei-producer/v1/eiproducers"
946 if [ $# -gt 1 ] && [ $2 != "NOTYPE" ]; then
947 query=$query"?ei_type_id=$2"
949 res="$(__do_curl_to_api ECS GET $query)"
950 status=${res:${#res}-3}
952 if [ $status -ne $1 ]; then
953 __log_test_fail_status_code $1 $status
957 if [ $# -gt 2 ]; then
958 body=${res:0:${#res}-3}
961 for pid in ${@:3} ; do
962 if [ "$targetJson" != "[" ]; then
963 targetJson=$targetJson","
965 if [ $pid != "EMPTY" ]; then
966 targetJson=$targetJson"\"$pid\""
970 targetJson=$targetJson"]"
971 echo " TARGET JSON: $targetJson" >> $HTTPLOG
972 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
974 if [ $res -ne 0 ]; then
984 # API Test function: GET /ei-producer/v1/eitypes/{eiTypeId}
985 # args: (v1_1) <response-code> <type-id> [<job-schema-file> (EMPTY | [<producer-id>]+)]
986 # (Function for test scripts)
987 ecs_api_edp_get_type() {
991 if [ $# -eq 2 ]; then
994 if [ $# -gt 3 ]; then
997 if [ $paramError -ne 0 ]; then
998 __print_err "<response-code> <type-id> [<job-schema-file> 'EMPTY' | ([<producer-id>]+)]" $@
1002 query="/ei-producer/v1/eitypes/$2"
1003 res="$(__do_curl_to_api ECS GET $query)"
1004 status=${res:${#res}-3}
1006 if [ $status -ne $1 ]; then
1007 __log_test_fail_status_code $1 $status
1010 if [ $# -gt 3 ]; then
1011 body=${res:0:${#res}-3}
1016 __log_test_fail_general "Job template file "$3", does not exist"
1021 if [ $4 != "EMPTY" ]; then
1022 for pid in ${@:4} ; do
1023 if [ "$targetJson" != "" ]; then
1024 targetJson=$targetJson","
1026 targetJson=$targetJson"\"$pid\""
1029 targetJson="{\"ei_job_data_schema\":$schema, \"ei_producer_ids\": [$targetJson]}"
1031 echo " TARGET JSON: $targetJson" >> $HTTPLOG
1032 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
1034 if [ $res -ne 0 ]; then
1035 __log_test_fail_body
1043 # API Test function: GET /ei-producer/v1/eitypes/{eiTypeId}
1044 # args: (v1_2) <response-code> <type-id> [<job-schema-file> ]
1045 # (Function for test scripts)
1046 ecs_api_edp_get_type_2() {
1050 if [ $# -eq 2 ]; then
1053 if [ $# -eq 3 ]; then
1056 if [ $paramError -ne 0 ]; then
1057 __print_err "<response-code> <type-id> [<job-schema-file> ]" $@
1061 query="/ei-producer/v1/eitypes/$2"
1062 res="$(__do_curl_to_api ECS GET $query)"
1063 status=${res:${#res}-3}
1065 if [ $status -ne $1 ]; then
1066 __log_test_fail_status_code $1 $status
1069 if [ $# -eq 3 ]; then
1070 body=${res:0:${#res}-3}
1075 __log_test_fail_general "Job template file "$3", does not exist"
1079 targetJson="{\"ei_job_data_schema\":$schema}"
1081 echo " TARGET JSON: $targetJson" >> $HTTPLOG
1082 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
1084 if [ $res -ne 0 ]; then
1085 __log_test_fail_body
1093 # API Test function: PUT /ei-producer/v1/eitypes/{eiTypeId}
1094 # args: (v1_2) <response-code> <type-id> <job-schema-file>
1095 # (Function for test scripts)
1096 ecs_api_edp_put_type_2() {
1099 if [ $# -ne 3 ]; then
1100 __print_err "<response-code> <type-id> <job-schema-file>" $@
1104 if [ ! -f $3 ]; then
1105 __log_test_fail_general "Job schema file "$3", does not exist"
1109 input_json="{\"ei_job_data_schema\":$schema}"
1110 file="./tmp/put_type.json"
1111 echo $input_json > $file
1113 query="/ei-producer/v1/eitypes/$2"
1114 res="$(__do_curl_to_api ECS PUT $query $file)"
1115 status=${res:${#res}-3}
1117 if [ $status -ne $1 ]; then
1118 __log_test_fail_status_code $1 $status
1126 # API Test function: DELETE /ei-producer/v1/eitypes/{eiTypeId}
1127 # args: (v1_2) <response-code> <type-id>
1128 # (Function for test scripts)
1129 ecs_api_edp_delete_type_2() {
1132 if [ $# -ne 2 ]; then
1133 __print_err "<response-code> <type-id>" $@
1137 query="/ei-producer/v1/eitypes/$2"
1138 res="$(__do_curl_to_api ECS DELETE $query)"
1139 status=${res:${#res}-3}
1141 if [ $status -ne $1 ]; then
1142 __log_test_fail_status_code $1 $status
1150 # API Test function: GET /ei-producer/v1/eiproducers/{eiProducerId}
1151 # args: (v1_1) <response-code> <producer-id> [<job-callback> <supervision-callback> (EMPTY | [<type-id> <schema-file>]+) ]
1152 # (Function for test scripts)
1153 ecs_api_edp_get_producer() {
1156 #Possible arg count: 2, 5 6, 8, 10 etc
1158 if [ $# -eq 2 ]; then
1161 if [ $# -eq 5 ] && [ "$5" == "EMPTY" ]; then
1164 variablecount=$(($#-4))
1165 if [ $# -gt 5 ] && [ $(($variablecount%2)) -eq 0 ]; then
1169 if [ $paramError -ne 0 ]; then
1170 __print_err "<response-code> <producer-id> [<job-callback> <supervision-callback> (NOID | [<type-id> <schema-file>]+) ]" $@
1174 query="/ei-producer/v1/eiproducers/$2"
1175 res="$(__do_curl_to_api ECS GET $query)"
1176 status=${res:${#res}-3}
1178 if [ $status -ne $1 ]; then
1179 __log_test_fail_status_code $1 $status
1183 if [ $# -gt 2 ]; then
1184 body=${res:0:${#res}-3}
1186 if [ $# -gt 5 ]; then
1188 for ((i=0; i<$(($#-5)); i=i+2)); do
1189 if [ "$targetJson" != "[" ]; then
1190 targetJson=$targetJson","
1192 if [ -f ${arr[$i+1]} ]; then
1193 schema=$(cat ${arr[$i+1]})
1195 _log_test_fail_general "Schema file "${arr[$i+1]}", does not exist"
1199 targetJson=$targetJson"{\"ei_type_identity\":\"${arr[$i]}\",\"ei_job_data_schema\":$schema}"
1202 targetJson=$targetJson"]"
1203 if [ $# -gt 4 ]; then
1204 targetJson="{\"supported_ei_types\":$targetJson,\"ei_job_callback_url\": \"$3\",\"ei_producer_supervision_callback_url\": \"$4\"}"
1206 echo " TARGET JSON: $targetJson" >> $HTTPLOG
1207 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
1209 if [ $res -ne 0 ]; then
1210 __log_test_fail_body
1219 # API Test function: GET /ei-producer/v1/eiproducers/{eiProducerId}
1220 # args (v1_2): <response-code> <producer-id> [<job-callback> <supervision-callback> (EMPTY | <type-id>+) ]
1221 # (Function for test scripts)
1222 ecs_api_edp_get_producer_2() {
1225 #Possible arg count: 2, 5, 6, 7, 8 etc
1227 if [ $# -eq 2 ]; then
1230 if [ $# -eq 5 ] && [ "$5" == "EMPTY" ]; then
1233 if [ $# -ge 5 ]; then
1237 if [ $paramError -ne 0 ]; then
1238 __print_err "<response-code> <producer-id> [<job-callback> <supervision-callback> (EMPTY | <type-id>+) ]" $@
1242 query="/ei-producer/v1/eiproducers/$2"
1243 res="$(__do_curl_to_api ECS GET $query)"
1244 status=${res:${#res}-3}
1246 if [ $status -ne $1 ]; then
1247 __log_test_fail_status_code $1 $status
1251 if [ $# -gt 2 ]; then
1252 body=${res:0:${#res}-3}
1254 if [ $# -gt 4 ] && [ "$5" != "EMPTY" ]; then
1256 for ((i=0; i<$(($#-4)); i=i+1)); do
1257 if [ "$targetJson" != "[" ]; then
1258 targetJson=$targetJson","
1260 targetJson=$targetJson"\"${arr[$i]}\""
1263 targetJson=$targetJson"]"
1264 if [ $# -gt 4 ]; then
1265 targetJson="{\"supported_ei_types\":$targetJson,\"ei_job_callback_url\": \"$3\",\"ei_producer_supervision_callback_url\": \"$4\"}"
1267 echo " TARGET JSON: $targetJson" >> $HTTPLOG
1268 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
1270 if [ $res -ne 0 ]; then
1271 __log_test_fail_body
1280 # API Test function: DELETE /ei-producer/v1/eiproducers/{eiProducerId}
1281 # args: <response-code> <producer-id>
1282 # (Function for test scripts)
1283 ecs_api_edp_delete_producer() {
1286 if [ $# -lt 2 ]; then
1287 __print_err "<response-code> <producer-id>" $@
1291 query="/ei-producer/v1/eiproducers/$2"
1292 res="$(__do_curl_to_api ECS DELETE $query)"
1293 status=${res:${#res}-3}
1295 if [ $status -ne $1 ]; then
1296 __log_test_fail_status_code $1 $status
1304 # API Test function: PUT /ei-producer/v1/eiproducers/{eiProducerId}
1305 # args: (v1_1) <response-code> <producer-id> <job-callback> <supervision-callback> NOTYPE|[<type-id> <schema-file>]+
1306 # (Function for test scripts)
1307 ecs_api_edp_put_producer() {
1310 #Valid number of parametrer 5,6,8,10,
1312 if [ $# -eq 5 ] && [ "$5" == "NOTYPE" ]; then
1314 elif [ $# -gt 5 ] && [ $(($#%2)) -eq 0 ]; then
1317 if [ $paramError -ne 0 ]; then
1318 __print_err "<response-code> <producer-id> <job-callback> <supervision-callback> NOTYPE|[<type-id> <schema-file>]+" $@
1323 if [ $# -gt 5 ]; then
1325 for ((i=0; i<$(($#-5)); i=i+2)); do
1326 if [ "$inputJson" != "[" ]; then
1327 inputJson=$inputJson","
1329 if [ -f ${arr[$i+1]} ]; then
1330 schema=$(cat ${arr[$i+1]})
1332 _log_test_fail_general "Schema file "${arr[$i+1]}", does not exist"
1335 inputJson=$inputJson"{\"ei_type_identity\":\"${arr[$i]}\",\"ei_job_data_schema\":$schema}"
1338 inputJson="\"supported_ei_types\":"$inputJson"]"
1340 inputJson=$inputJson",\"ei_job_callback_url\": \"$3\",\"ei_producer_supervision_callback_url\": \"$4\""
1342 inputJson="{"$inputJson"}"
1344 file="./tmp/.p.json"
1345 echo "$inputJson" > $file
1346 query="/ei-producer/v1/eiproducers/$2"
1347 res="$(__do_curl_to_api ECS PUT $query $file)"
1348 status=${res:${#res}-3}
1350 if [ $status -ne $1 ]; then
1351 __log_test_fail_status_code $1 $status
1359 # API Test function: PUT /ei-producer/v1/eiproducers/{eiProducerId}
1360 # args: (v1_2) <response-code> <producer-id> <job-callback> <supervision-callback> NOTYPE|[<type-id>+]
1361 # (Function for test scripts)
1362 ecs_api_edp_put_producer_2() {
1365 #Valid number of parametrer 5,6,8,10,
1367 if [ $# -eq 5 ] && [ "$5" == "NOTYPE" ]; then
1369 elif [ $# -ge 5 ]; then
1372 if [ $paramError -ne 0 ]; then
1373 __print_err "<response-code> <producer-id> <job-callback> <supervision-callback> NOTYPE|[<type-id>+]" $@
1378 if [ $# -gt 4 ] && [ "$5" != "NOTYPE" ]; then
1380 for ((i=0; i<$(($#-4)); i=i+1)); do
1381 if [ "$inputJson" != "[" ]; then
1382 inputJson=$inputJson","
1384 inputJson=$inputJson"\""${arr[$i]}"\""
1387 inputJson="\"supported_ei_types\":"$inputJson"]"
1389 inputJson=$inputJson",\"ei_job_callback_url\": \"$3\",\"ei_producer_supervision_callback_url\": \"$4\""
1391 inputJson="{"$inputJson"}"
1393 file="./tmp/.p.json"
1394 echo "$inputJson" > $file
1395 query="/ei-producer/v1/eiproducers/$2"
1396 res="$(__do_curl_to_api ECS PUT $query $file)"
1397 status=${res:${#res}-3}
1399 if [ $status -ne $1 ]; then
1400 __log_test_fail_status_code $1 $status
1408 # API Test function: GET /ei-producer/v1/eiproducers/{eiProducerId}/eijobs
1409 # args: (V1-1) <response-code> <producer-id> (EMPTY | [<job-id> <type-id> <target-url> <job-owner> <template-job-file>]+)
1410 # (Function for test scripts)
1411 ecs_api_edp_get_producer_jobs() {
1414 #Valid number of parameter 2,3,7,11
1416 if [ $# -eq 2 ]; then
1419 if [ $# -eq 3 ] && [ "$3" == "EMPTY" ]; then
1422 variablecount=$(($#-2))
1423 if [ $# -gt 3 ] && [ $(($variablecount%5)) -eq 0 ]; then
1426 if [ $paramError -eq 1 ]; then
1427 __print_err "<response-code> <producer-id> (EMPTY | [<job-id> <type-id> <target-url> <job-owner> <template-job-file>]+)" $@
1431 query="/ei-producer/v1/eiproducers/$2/eijobs"
1432 res="$(__do_curl_to_api ECS GET $query)"
1433 status=${res:${#res}-3}
1434 if [ $status -ne $1 ]; then
1435 __log_test_fail_status_code $1 $status
1438 if [ $# -gt 2 ]; then
1439 body=${res:0:${#res}-3}
1441 if [ $# -gt 3 ]; then
1443 for ((i=0; i<$(($#-3)); i=i+5)); do
1444 if [ "$targetJson" != "[" ]; then
1445 targetJson=$targetJson","
1447 if [ -f ${arr[$i+4]} ]; then
1448 jobfile=$(cat ${arr[$i+4]})
1449 jobfile=$(echo "$jobfile" | sed "s/XXXX/${arr[$i]}/g")
1451 _log_test_fail_general "Job template file "${arr[$i+4]}", does not exist"
1454 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}"
1457 targetJson=$targetJson"]"
1459 echo " TARGET JSON: $targetJson" >> $HTTPLOG
1460 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
1462 if [ $res -ne 0 ]; then
1463 __log_test_fail_body
1472 # API Test function: GET /ei-producer/v1/eiproducers/{eiProducerId}/eijobs
1473 # args: (V1-2) <response-code> <producer-id> (EMPTY | [<job-id> <type-id> <target-url> <job-owner> <template-job-file>]+)
1474 # (Function for test scripts)
1475 ecs_api_edp_get_producer_jobs_2() {
1478 #Valid number of parameter 2,3,7,11
1480 if [ $# -eq 2 ]; then
1483 if [ $# -eq 3 ] && [ "$3" == "EMPTY" ]; then
1486 variablecount=$(($#-2))
1487 if [ $# -gt 3 ] && [ $(($variablecount%5)) -eq 0 ]; then
1490 if [ $paramError -eq 1 ]; then
1491 __print_err "<response-code> <producer-id> (EMPTY | [<job-id> <type-id> <target-url> <job-owner> <template-job-file>]+)" $@
1495 query="/ei-producer/v1/eiproducers/$2/eijobs"
1496 res="$(__do_curl_to_api ECS GET $query)"
1497 status=${res:${#res}-3}
1498 if [ $status -ne $1 ]; then
1499 __log_test_fail_status_code $1 $status
1502 if [ $# -gt 2 ]; then
1503 body=${res:0:${#res}-3}
1505 if [ $# -gt 3 ]; then
1507 for ((i=0; i<$(($#-3)); i=i+5)); do
1508 if [ "$targetJson" != "[" ]; then
1509 targetJson=$targetJson","
1511 if [ -f ${arr[$i+4]} ]; then
1512 jobfile=$(cat ${arr[$i+4]})
1513 jobfile=$(echo "$jobfile" | sed "s/XXXX/${arr[$i]}/g")
1515 _log_test_fail_general "Job template file "${arr[$i+4]}", does not exist"
1518 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\":\"????\"}"
1521 targetJson=$targetJson"]"
1523 echo " TARGET JSON: $targetJson" >> $HTTPLOG
1524 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
1526 if [ $res -ne 0 ]; then
1527 __log_test_fail_body
1536 ##########################################
1537 #### Service status ####
1538 ##########################################
1539 # Function prefix: ecs_api_service
1541 # API Test function: GET /status
1542 # args: <response-code>
1543 # (Function for test scripts)
1544 ecs_api_service_status() {
1547 if [ $# -lt 1 ]; then
1548 __print_err "<response-code> [<producer-id>]*|NOID" $@
1551 res="$(__do_curl_to_api ECS GET /status)"
1552 status=${res:${#res}-3}
1553 if [ $status -ne $1 ]; then
1554 __log_test_fail_status_code $1 $status
1562 ##########################################
1563 #### Reset jobs ####
1564 ##########################################
1565 # Function prefix: ecs_api_admin
1567 # Admin to remove all jobs
1568 # args: <response-code> [ <type> ]
1569 # (Function for test scripts)
1571 ecs_api_admin_reset() {
1574 if [ -z "$FLAT_A1_EI" ]; then
1575 query="/A1-EI/v1/eitypes/$2/eijobs"
1577 query="/A1-EI/v1/eijobs"
1579 res="$(__do_curl_to_api ECS GET $query)"
1580 status=${res:${#res}-3}
1582 if [ $status -ne 200 ]; then
1583 __log_test_fail_status_code $1 $status
1587 #Remove brackets and response code
1588 body=${res:1:${#res}-4}
1589 list=$(echo ${body//,/ })
1590 list=$(echo ${list//[/})
1591 list=$(echo ${list//]/})
1592 list=$(echo ${list//\"/})
1594 for job in $list; do
1595 if [ -z "$FLAT_A1_EI" ]; then
1596 echo "Not supported for non-flat EI api"
1598 query="/A1-EI/v1/eijobs/$job"
1599 res="$(__do_curl_to_api ECS DELETE $query)"
1600 status=${res:${#res}-3}
1601 if [ $status -ne 204 ]; then
1602 __log_test_fail_status_code $1 $status
1605 echo " Deleted job: "$job