#!/bin/bash
# ============LICENSE_START===============================================
-# Copyright (C) 2020 Nordix Foundation. All rights reserved.
+# Copyright (C) 2020-2023 Nordix Foundation. All rights reserved.
# ========================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# args: -
__ICS_initial_setup() {
use_ics_rest_http
+ export ICS_SIDECAR_JWT_FILE=""
}
# Set app short-name, app name and namespace for logging runtime statistics of kubernets pods or docker containers
export ICS_DATA_PVC_NAME=$ICS_APP_NAME"-pvc"
#Create a unique path for the pv each time to prevent a previous volume to be reused
export ICS_PV_PATH="icsdata-"$(date +%s)
+ export HOST_PATH_BASE_DIR
if [ $1 == "PROXY" ]; then
export ICS_HTTP_PROXY_CONFIG_PORT=$HTTP_PROXY_CONFIG_PORT #Set if proxy is started
# Create app
input_yaml=$SIM_GROUP"/"$ICS_COMPOSE_DIR"/"app.yaml
output_yaml=$PWD/tmp/ics_app.yaml
+ if [ -z "$ICS_SIDECAR_JWT_FILE" ]; then
+ cat $input_yaml | sed '/#ICS_JWT_START/,/#ICS_JWT_STOP/d' > $PWD/tmp/ics_app_tmp.yaml
+ input_yaml=$PWD/tmp/ics_app_tmp.yaml
+ fi
__kube_create_instance app $ICS_APP_NAME $input_yaml $output_yaml
fi
# 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
if [ $retcode_i -eq 0 ]; then
- __ICS_WORKER_NODE=$(kubectl get pod -l "autotest=ICS" -n $KUBE_NONRTRIC_NAMESPACE -o jsonpath='{.items[*].spec.nodeName}')
+ __ICS_WORKER_NODE=$(kubectl $KUBECONF get pod -l "autotest=ICS" -n $KUBE_NONRTRIC_NAMESPACE -o jsonpath='{.items[*].spec.nodeName}')
if [ -z "$__ICS_WORKER_NODE" ]; then
echo -e $YELLOW" Cannot find worker node for pod for $ICS_APP_NAME, persistency may not work"$EYELLOW
fi
fi
else
echo " No files in mounted dir or dir does not exists"
+ mkdir db
fi
cd $curdir
return 0
fi
- # Tie the PMS to the same worker node it was initially started on
- # 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
+ # Tie the ICS to the same worker node it was initially started on
+ # A PVC of type hostPath is mounted to A1PMS, for persistent storage, so the A1PMS must always be on the node which mounted the volume
if [ -z "$__ICS_WORKER_NODE" ]; then
echo -e $RED" No initial worker node found for pod "$RED
((RES_CONF_FAIL++))
return 1
else
- echo -e $BOLD" Setting nodeSelector kubernetes.io/hostname=$__ICS_WORKER_NODE to deployment for $ICS_APP_NAME. Pod will always run on this worker node: $__PA_WORKER_NODE"$BOLD
+ echo -e $BOLD" Setting nodeSelector kubernetes.io/hostname=$__ICS_WORKER_NODE to deployment for $ICS_APP_NAME. Pod will always run on this worker node: $__ICS_WORKER_NODE"$BOLD
echo -e $BOLD" The mounted volume is mounted as hostPath and only available on that worker node."$BOLD
tmp=$(kubectl $KUBECONF patch deployment $ICS_APP_NAME -n $KUBE_NONRTRIC_NAMESPACE --patch '{"spec": {"template": {"spec": {"nodeSelector": {"kubernetes.io/hostname": "'$__ICS_WORKER_NODE'"}}}}}')
if [ $? -ne 0 ]; then
# (Function for test scripts)
set_ics_trace() {
echo -e $BOLD"Setting ics trace logging"$EBOLD
- curlString="$ICS_SERVICE_PATH/actuator/loggers/org.oransc.information -X POST -H Content-Type:application/json -d {\"configuredLevel\":\"trace\"}"
+ curlString="$ICS_SERVICE_PATH$ICS_ACTUATOR -X POST -H Content-Type:application/json -d {\"configuredLevel\":\"trace\"}"
result=$(__do_curl "$curlString")
if [ $? -ne 0 ]; then
__print_err "Could not set trace mode" $@
#Function prefix: ics_api_a1
# API Test function: GET /A1-EI/v1/eitypes/{eiTypeId}/eijobs
-# args: <response-code> <type-id> <owner-id>|NOOWNER [ EMPTY | <job-id>+ ]
-# args (flat uri structure): <response-code> <type-id>|NOTYPE <owner-id>|NOOWNER [ EMPTY | <job-id>+ ]
+# args: <response-code> <type-id>|NOTYPE <owner-id>|NOOWNER [ EMPTY | <job-id>+ ]
# (Function for test scripts)
ics_api_a1_get_job_ids() {
__log_test_start $@
- if [ -z "$FLAT_A1_EI" ]; then
- # Valid number of parameters 4,5,6 etc
- if [ $# -lt 3 ]; then
- __print_err "<response-code> <type-id> <owner-id>|NOOWNER [ EMPTY | <job-id>+ ]" $@
- return 1
- fi
- else
- echo -e $YELLOW"INTERFACE - FLAT URI STRUCTURE"$EYELLOW
- # Valid number of parameters 4,5,6 etc
- if [ $# -lt 3 ]; then
- __print_err "<response-code> <type-id>|NOTYPE <owner-id>|NOOWNER [ EMPTY | <job-id>+ ]" $@
- return 1
- fi
+ # Valid number of parameters 4,5,6 etc
+ if [ $# -lt 3 ]; then
+ __print_err "<response-code> <type-id>|NOTYPE <owner-id>|NOOWNER [ EMPTY | <job-id>+ ]" $@
+ return 1
fi
search=""
if [ $3 != "NOWNER" ]; then
search="?owner="$3
fi
- if [ -z "$FLAT_A1_EI" ]; then
- query="/A1-EI/v1/eitypes/$2/eijobs$search"
- else
- if [ $2 != "NOTYPE" ]; then
- if [ -z "$search" ]; then
- search="?eiTypeId="$2
- else
- search=$search"&eiTypeId="$2
- fi
+ if [ $2 != "NOTYPE" ]; then
+ if [ -z "$search" ]; then
+ search="?eiTypeId="$2
+ else
+ search=$search"&eiTypeId="$2
fi
- query="/A1-EI/v1/eijobs$search"
fi
+ query="/A1-EI/v1/eijobs$search"
res="$(__do_curl_to_api ICS GET $query)"
status=${res:${#res}-3}
__log_test_fail_general "Schema file "$3", does not exist"
return 1
fi
- if [ -z "$FLAT_A1_EI" ]; then
- targetJson="{\"eiJobParametersSchema\":$schema}"
- else
- targetJson=$schema
- fi
+ targetJson=$schema
echo " TARGET JSON: $targetJson" >> $HTTPLOG
res=$(python3 ../common/compare_json.py "$targetJson" "$body")
}
# API Test function: GET /A1-EI/v1/eitypes/{eiTypeId}/eijobs/{eiJobId}/status
-# args: <response-code> <type-id> <job-id> [<status>]
-# args (flat uri structure): <response-code> <job-id> [<status> [<timeout>]]
+# args: <response-code> <job-id> [<status> [<timeout>]]
# (Function for test scripts)
ics_api_a1_get_job_status() {
__log_test_start $@
- if [ -z "$FLAT_A1_EI" ]; then
- if [ $# -ne 3 ] && [ $# -ne 4 ]; then
- __print_err "<response-code> <type-id> <job-id> [<status>]" $@
- return 1
- fi
+ if [ $# -lt 2 ] && [ $# -gt 4 ]; then
+ __print_err "<response-code> <job-id> [<status> [<timeout>]]" $@
+ return 1
+ fi
- query="/A1-EI/v1/eitypes/$2/eijobs/$3/status"
+ query="/A1-EI/v1/eijobs/$2/status"
+ start=$SECONDS
+ for (( ; ; )); do
res="$(__do_curl_to_api ICS GET $query)"
status=${res:${#res}-3}
+ if [ $# -eq 4 ]; then
+ duration=$((SECONDS-start))
+ echo -ne " Response=${status} after ${duration} seconds, waiting for ${3} ${SAMELINE}"
+ if [ $duration -gt $4 ]; then
+ echo ""
+ duration=-1 #Last iteration
+ fi
+ else
+ duration=-1 #single test, no wait
+ fi
+
if [ $status -ne $1 ]; then
- __log_test_fail_status_code $1 $status
- return 1
+ if [ $duration -eq -1 ]; then
+ __log_test_fail_status_code $1 $status
+ return 1
+ fi
fi
- if [ $# -eq 4 ]; then
+ if [ $# -ge 3 ] && [ $status -eq $1 ]; then
body=${res:0:${#res}-3}
- targetJson="{\"operationalState\": \"$4\"}"
+ targetJson="{\"eiJobStatus\": \"$3\"}"
echo " TARGET JSON: $targetJson" >> $HTTPLOG
res=$(python3 ../common/compare_json.py "$targetJson" "$body")
if [ $res -ne 0 ]; then
- __log_test_fail_body
- return 1
- fi
- fi
- else
- echo -e $YELLOW"INTERFACE - FLAT URI STRUCTURE"$EYELLOW
- if [ $# -lt 2 ] && [ $# -gt 4 ]; then
- __print_err "<response-code> <job-id> [<status> [<timeout>]]" $@
- return 1
- fi
-
- query="/A1-EI/v1/eijobs/$2/status"
-
- start=$SECONDS
- for (( ; ; )); do
- res="$(__do_curl_to_api ICS GET $query)"
- status=${res:${#res}-3}
-
- if [ $# -eq 4 ]; then
- duration=$((SECONDS-start))
- echo -ne " Response=${status} after ${duration} seconds, waiting for ${3} ${SAMELINE}"
- if [ $duration -gt $4 ]; then
- echo ""
- duration=-1 #Last iteration
- fi
- else
- duration=-1 #single test, no wait
- fi
-
- if [ $status -ne $1 ]; then
if [ $duration -eq -1 ]; then
- __log_test_fail_status_code $1 $status
+ __log_test_fail_body
return 1
fi
- fi
- if [ $# -ge 3 ] && [ $status -eq $1 ]; then
- body=${res:0:${#res}-3}
- targetJson="{\"eiJobStatus\": \"$3\"}"
- echo " TARGET JSON: $targetJson" >> $HTTPLOG
- res=$(python3 ../common/compare_json.py "$targetJson" "$body")
-
- if [ $res -ne 0 ]; then
- if [ $duration -eq -1 ]; then
- __log_test_fail_body
- return 1
- fi
- else
- duration=-1 #Goto pass
- fi
- fi
- if [ $duration -eq -1 ]; then
- if [ $# -eq 4 ]; then
- echo ""
- fi
- __log_test_pass
- return 0
else
- sleep 1
+ duration=-1 #Goto pass
fi
- done
- fi
+ fi
+ if [ $duration -eq -1 ]; then
+ if [ $# -eq 4 ]; then
+ echo ""
+ fi
+ __log_test_pass
+ return 0
+ else
+ sleep 1
+ fi
+ done
__log_test_pass
return 0
}
# API Test function: GET /A1-EI/v1/eitypes/{eiTypeId}/eijobs/{eiJobId}
-# args: <response-code> <type-id> <job-id> [<target-url> <owner-id> <template-job-file>]
-# args (flat uri structure): <response-code> <job-id> [<type-id> <target-url> <owner-id> <template-job-file>]
+# args: <response-code> <job-id> [<type-id> <target-url> <owner-id> <template-job-file>]
# (Function for test scripts)
ics_api_a1_get_job() {
__log_test_start $@
- if [ -z "$FLAT_A1_EI" ]; then
- if [ $# -ne 3 ] && [ $# -ne 6 ]; then
- __print_err "<response-code> <type-id> <job-id> [<target-url> <owner-id> <template-job-file>]" $@
- return 1
- fi
- query="/A1-EI/v1/eitypes/$2/eijobs/$3"
- else
- echo -e $YELLOW"INTERFACE - FLAT URI STRUCTURE"$EYELLOW
- if [ $# -ne 2 ] && [ $# -ne 7 ]; then
- __print_err "<response-code> <job-id> [<type-id> <target-url> <owner-id> <notification-url> <template-job-file>]" $@
- return 1
- fi
- query="/A1-EI/v1/eijobs/$2"
+ if [ $# -ne 2 ] && [ $# -ne 7 ]; then
+ __print_err "<response-code> <job-id> [<type-id> <target-url> <owner-id> <notification-url> <template-job-file>]" $@
+ return 1
fi
+ query="/A1-EI/v1/eijobs/$2"
res="$(__do_curl_to_api ICS GET $query)"
status=${res:${#res}-3}
return 1
fi
- if [ -z "$FLAT_A1_EI" ]; then
- if [ $# -eq 6 ]; then
- body=${res:0:${#res}-3}
-
- if [ -f $6 ]; then
- jobfile=$(cat $6)
- jobfile=$(echo "$jobfile" | sed "s/XXXX/$3/g")
- else
- __log_test_fail_general "Job template file "$6", does not exist"
- return 1
- fi
- targetJson="{\"targetUri\": \"$4\",\"jobOwner\": \"$5\",\"jobParameters\": $jobfile}"
- echo " TARGET JSON: $targetJson" >> $HTTPLOG
- res=$(python3 ../common/compare_json.py "$targetJson" "$body")
+ if [ $# -eq 7 ]; then
+ body=${res:0:${#res}-3}
- if [ $res -ne 0 ]; then
- __log_test_fail_body
- return 1
- fi
+ if [ -f $7 ]; then
+ jobfile=$(cat $7)
+ jobfile=$(echo "$jobfile" | sed "s/XXXX/$2/g")
+ else
+ __log_test_fail_general "Job template file "$6", does not exist"
+ return 1
fi
- else
- if [ $# -eq 7 ]; then
- body=${res:0:${#res}-3}
-
- if [ -f $7 ]; then
- jobfile=$(cat $7)
- jobfile=$(echo "$jobfile" | sed "s/XXXX/$2/g")
- else
- __log_test_fail_general "Job template file "$6", does not exist"
- return 1
- fi
- targetJson="{\"eiTypeId\": \"$3\", \"jobResultUri\": \"$4\",\"jobOwner\": \"$5\",\"jobStatusNotificationUri\": \"$6\",\"jobDefinition\": $jobfile}"
- echo " TARGET JSON: $targetJson" >> $HTTPLOG
- res=$(python3 ../common/compare_json.py "$targetJson" "$body")
+ targetJson="{\"eiTypeId\": \"$3\", \"jobResultUri\": \"$4\",\"jobOwner\": \"$5\",\"jobStatusNotificationUri\": \"$6\",\"jobDefinition\": $jobfile}"
+ echo " TARGET JSON: $targetJson" >> $HTTPLOG
+ res=$(python3 ../common/compare_json.py "$targetJson" "$body")
- if [ $res -ne 0 ]; then
- __log_test_fail_body
- return 1
- fi
+ if [ $res -ne 0 ]; then
+ __log_test_fail_body
+ return 1
fi
fi
}
# API Test function: DELETE /A1-EI/v1/eitypes/{eiTypeId}/eijobs/{eiJobId}
-# args: <response-code> <type-id> <job-id>
-# args (flat uri structure): <response-code> <job-id>
+# args: <response-code> <job-id>
# (Function for test scripts)
ics_api_a1_delete_job() {
__log_test_start $@
- if [ -z "$FLAT_A1_EI" ]; then
- if [ $# -ne 3 ]; then
- __print_err "<response-code> <type-id> <job-id>" $@
- return 1
- fi
-
- query="/A1-EI/v1/eitypes/$2/eijobs/$3"
- else
- echo -e $YELLOW"INTERFACE - FLAT URI STRUCTURE"$EYELLOW
- if [ $# -ne 2 ]; then
- __print_err "<response-code> <job-id>" $@
- return 1
- fi
- query="/A1-EI/v1/eijobs/$2"
+ if [ $# -ne 2 ]; then
+ __print_err "<response-code> <job-id>" $@
+ return 1
fi
+ query="/A1-EI/v1/eijobs/$2"
res="$(__do_curl_to_api ICS DELETE $query)"
status=${res:${#res}-3}
}
# API Test function: PUT /A1-EI/v1/eitypes/{eiTypeId}/eijobs/{eiJobId}
-# args: <response-code> <type-id> <job-id> <target-url> <owner-id> <template-job-file>
-# args (flat uri structure): <response-code> <job-id> <type-id> <target-url> <owner-id> <notification-url> <template-job-file>
+# args <response-code> <job-id> <type-id> <target-url> <owner-id> <notification-url> <template-job-file>
# (Function for test scripts)
ics_api_a1_put_job() {
__log_test_start $@
- if [ -z "$FLAT_A1_EI" ]; then
- if [ $# -lt 6 ]; then
- __print_err "<response-code> <type-id> <job-id> <target-url> <owner-id> <template-job-file>" $@
- return 1
- fi
- if [ -f $6 ]; then
- jobfile=$(cat $6)
- jobfile=$(echo "$jobfile" | sed "s/XXXX/$3/g")
- else
- __log_test_fail_general "Job template file "$6", does not exist"
- return 1
- fi
-
- inputJson="{\"targetUri\": \"$4\",\"jobOwner\": \"$5\",\"jobParameters\": $jobfile}"
- file="./tmp/.p.json"
- echo "$inputJson" > $file
-
- query="/A1-EI/v1/eitypes/$2/eijobs/$3"
+ if [ $# -lt 7 ]; then
+ __print_err "<response-code> <job-id> <type-id> <target-url> <owner-id> <notification-url> <template-job-file>" $@
+ return 1
+ fi
+ if [ -f $7 ]; then
+ jobfile=$(cat $7)
+ jobfile=$(echo "$jobfile" | sed "s/XXXX/$2/g")
else
- echo -e $YELLOW"INTERFACE - FLAT URI STRUCTURE"$EYELLOW
- if [ $# -lt 7 ]; then
- __print_err "<response-code> <job-id> <type-id> <target-url> <owner-id> <notification-url> <template-job-file>" $@
- return 1
- fi
- if [ -f $7 ]; then
- jobfile=$(cat $7)
- jobfile=$(echo "$jobfile" | sed "s/XXXX/$2/g")
- else
- __log_test_fail_general "Job template file "$7", does not exist"
- return 1
- fi
+ __log_test_fail_general "Job template file "$7", does not exist"
+ return 1
+ fi
- inputJson="{\"eiTypeId\": \"$3\", \"jobResultUri\": \"$4\",\"jobOwner\": \"$5\",\"jobStatusNotificationUri\": \"$6\",\"jobDefinition\": $jobfile}"
- file="./tmp/.p.json"
- echo "$inputJson" > $file
+ inputJson="{\"eiTypeId\": \"$3\", \"jobResultUri\": \"$4\",\"jobOwner\": \"$5\",\"jobStatusNotificationUri\": \"$6\",\"jobDefinition\": $jobfile}"
+ file="./tmp/.p.json"
+ echo "$inputJson" > $file
- query="/A1-EI/v1/eijobs/$2"
- fi
+ query="/A1-EI/v1/eijobs/$2"
res="$(__do_curl_to_api ICS PUT $query $file)"
status=${res:${#res}-3}
__print_err "<response-code> [ EMPTY | <type-id>+]" $@
return 1
fi
- if [[ "$ICS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
- query="/data-producer/v1/info-types"
- else
- query="/ei-producer/v1/eitypes"
- fi
+ query="/data-producer/v1/info-types"
res="$(__do_curl_to_api ICS GET $query)"
status=${res:${#res}-3}
__print_err "<response-code> <producer-id> [<status> [<timeout>]]" $@
return 1
fi
- if [[ "$ICS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
- query="/data-producer/v1/info-producers/$2/status"
- else
- query="/ei-producer/v1/eiproducers/$2/status"
- fi
+ query="/data-producer/v1/info-producers/$2/status"
start=$SECONDS
for (( ; ; )); do
res="$(__do_curl_to_api ICS GET $query)"
__print_err "<response-code> [ ( NOTYPE | <type-id> ) [ EMPTY | <producer-id>+] ]" $@
return 1
fi
- if [[ "$ICS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
- query="/data-producer/v1/info-producers"
- if [ $# -gt 1 ] && [ $2 != "NOTYPE" ]; then
- query=$query"?info_type_id=$2"
- fi
- else
- query="/ei-producer/v1/eiproducers"
- if [ $# -gt 1 ] && [ $2 != "NOTYPE" ]; then
- query=$query"?ei_type_id=$2"
- fi
+ query="/data-producer/v1/info-producers"
+ if [ $# -gt 1 ] && [ $2 != "NOTYPE" ]; then
+ query=$query"?info_type_id=$2&infoTypeId=$2" #info_type_id changed to infoTypeId in F-release.
+ #Remove info_type_id when F-release is no longer supported
fi
res="$(__do_curl_to_api ICS GET $query)"
status=${res:${#res}-3}
if [ $# -eq 3 ]; then
paramError=0
fi
- if [[ "$ICS_FEATURE_LEVEL" == *"INFO-TYPE-INFO"* ]]; then
- if [ $# -eq 4 ]; then
- paramError=0
- fi
+ if [ $# -eq 4 ]; then
+ paramError=0
fi
if [ $paramError -ne 0 ]; then
__print_err "<response-code> <type-id> [<job-schema-file> [ <info-type-info> ]]" $@
return 1
fi
- if [[ "$ICS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
- query="/data-producer/v1/info-types/$2"
- else
- query="/ei-producer/v1/eitypes/$2"
- fi
+ query="/data-producer/v1/info-types/$2"
res="$(__do_curl_to_api ICS GET $query)"
status=${res:${#res}-3}
fi
info_data=",\"info_type_information\":$info_data"
fi
- if [[ "$ICS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
- targetJson="{\"info_job_data_schema\":$schema $info_data}"
- else
- targetJson="{\"ei_job_data_schema\":$schema}"
- fi
+ targetJson="{\"info_job_data_schema\":$schema $info_data}"
echo " TARGET JSON: $targetJson" >> $HTTPLOG
res=$(python3 ../common/compare_json.py "$targetJson" "$body")
ics_api_edp_put_type_2() {
__log_test_start $@
- if [[ "$ICS_FEATURE_LEVEL" == *"INFO-TYPE-INFO"* ]]; then
- if [ $# -lt 3 ] || [ $# -gt 4 ]; then
- __print_err "<response-code> <type-id> <job-schema-file> [ <info-type-info> ]" $@
- return 1
- fi
- else
- if [ $# -ne 3 ]; then
- __print_err "<response-code> <type-id> <job-schema-file>" $@
- return 1
- fi
+ if [ $# -lt 3 ] || [ $# -gt 4 ]; then
+ __print_err "<response-code> <type-id> <job-schema-file> [ <info-type-info> ]" $@
+ return 1
fi
if [ ! -f $3 ]; then
info_data=",\"info_type_information\":$info_data"
fi
- if [[ "$ICS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
- schema=$(cat $3)
- input_json="{\"info_job_data_schema\":$schema $info_data}"
- file="./tmp/put_type.json"
- echo $input_json > $file
-
- query="/data-producer/v1/info-types/$2"
- else
- schema=$(cat $3)
- input_json="{\"ei_job_data_schema\":$schema}"
- file="./tmp/put_type.json"
- echo $input_json > $file
+ schema=$(cat $3)
+ input_json="{\"info_job_data_schema\":$schema $info_data}"
+ file="./tmp/put_type.json"
+ echo $input_json > $file
- query="/ei-producer/v1/eitypes/$2"
- fi
+ query="/data-producer/v1/info-types/$2"
res="$(__do_curl_to_api ICS PUT $query $file)"
status=${res:${#res}-3}
return 1
fi
- if [[ "$ICS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
- query="/data-producer/v1/info-types/$2"
- else
- query="/ei-producer/v1/eitypes/$2"
- fi
+ query="/data-producer/v1/info-types/$2"
res="$(__do_curl_to_api ICS DELETE $query)"
status=${res:${#res}-3}
__print_err "<response-code> <producer-id> [<job-callback> <supervision-callback> (EMPTY | <type-id>+) ]" $@
return 1
fi
- if [[ "$ICS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
- query="/data-producer/v1/info-producers/$2"
- else
- query="/ei-producer/v1/eiproducers/$2"
- fi
+ query="/data-producer/v1/info-producers/$2"
res="$(__do_curl_to_api ICS GET $query)"
status=${res:${#res}-3}
fi
targetJson=$targetJson"]"
if [ $# -gt 4 ]; then
- if [[ "$ICS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
- targetJson="{\"supported_info_types\":$targetJson,\"info_job_callback_url\": \"$3\",\"info_producer_supervision_callback_url\": \"$4\"}"
- else
- targetJson="{\"supported_ei_types\":$targetJson,\"ei_job_callback_url\": \"$3\",\"ei_producer_supervision_callback_url\": \"$4\"}"
- fi
+ targetJson="{\"supported_info_types\":$targetJson,\"info_job_callback_url\": \"$3\",\"info_producer_supervision_callback_url\": \"$4\"}"
fi
echo " TARGET JSON: $targetJson" >> $HTTPLOG
res=$(python3 ../common/compare_json.py "$targetJson" "$body")
__print_err "<response-code> <producer-id>" $@
return 1
fi
- if [[ "$ICS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
- query="/data-producer/v1/info-producers/$2"
- else
- query="/ei-producer/v1/eiproducers/$2"
- fi
+ query="/data-producer/v1/info-producers/$2"
res="$(__do_curl_to_api ICS DELETE $query)"
status=${res:${#res}-3}
inputJson=$inputJson"\""${arr[$i]}"\""
done
fi
- if [[ "$ICS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
- inputJson="\"supported_info_types\":"$inputJson"]"
-
- inputJson=$inputJson",\"info_job_callback_url\": \"$3\",\"info_producer_supervision_callback_url\": \"$4\""
-
- inputJson="{"$inputJson"}"
-
- file="./tmp/.p.json"
- echo "$inputJson" > $file
- query="/data-producer/v1/info-producers/$2"
- else
- inputJson="\"supported_ei_types\":"$inputJson"]"
+ inputJson="\"supported_info_types\":"$inputJson"]"
- inputJson=$inputJson",\"ei_job_callback_url\": \"$3\",\"ei_producer_supervision_callback_url\": \"$4\""
+ inputJson=$inputJson",\"info_job_callback_url\": \"$3\",\"info_producer_supervision_callback_url\": \"$4\""
- inputJson="{"$inputJson"}"
+ inputJson="{"$inputJson"}"
- file="./tmp/.p.json"
- echo "$inputJson" > $file
- query="/ei-producer/v1/eiproducers/$2"
- fi
+ file="./tmp/.p.json"
+ echo "$inputJson" > $file
+ query="/data-producer/v1/info-producers/$2"
res="$(__do_curl_to_api ICS PUT $query $file)"
status=${res:${#res}-3}
__print_err "<response-code> <producer-id> (EMPTY | [<job-id> <type-id> <target-url> <job-owner> <template-job-file>]+)" $@
return 1
fi
- if [[ "$ICS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
- query="/data-producer/v1/info-producers/$2/info-jobs"
- else
- query="/ei-producer/v1/eiproducers/$2/eijobs"
- fi
+ query="/data-producer/v1/info-producers/$2/info-jobs"
res="$(__do_curl_to_api ICS GET $query)"
status=${res:${#res}-3}
if [ $status -ne $1 ]; then
__log_test_fail_general "Job template file "${arr[$i+4]}", does not exist"
return 1
fi
- if [[ "$ICS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
- targetJson=$targetJson"{\"info_job_identity\":\"${arr[$i]}\",\"info_type_identity\":\"${arr[$i+1]}\",\"target_uri\":\"${arr[$i+2]}\",\"owner\":\"${arr[$i+3]}\",\"info_job_data\":$jobfile, \"last_updated\":\"????\"}"
- else
- targetJson=$targetJson"{\"ei_job_identity\":\"${arr[$i]}\",\"ei_type_identity\":\"${arr[$i+1]}\",\"target_uri\":\"${arr[$i+2]}\",\"owner\":\"${arr[$i+3]}\",\"ei_job_data\":$jobfile, \"last_updated\":\"????\"}"
- fi
+ targetJson=$targetJson"{\"info_job_identity\":\"${arr[$i]}\",\"info_type_identity\":\"${arr[$i+1]}\",\"target_uri\":\"${arr[$i+2]}\",\"owner\":\"${arr[$i+3]}\",\"info_job_data\":$jobfile, \"last_updated\":\"????\"}"
+
done
fi
targetJson=$targetJson"]"
ics_api_admin_reset() {
__log_test_start $@
- if [ -z "$FLAT_A1_EI" ]; then
- query="/A1-EI/v1/eitypes/$2/eijobs"
- else
- query="/A1-EI/v1/eijobs"
- fi
+ query="/A1-EI/v1/eijobs"
res="$(__do_curl_to_api ICS GET $query)"
status=${res:${#res}-3}
list=$(echo ${list//\"/})
list=$list" "
for job in $list; do
- if [ -z "$FLAT_A1_EI" ]; then
- echo "Not supported for non-flat EI api"
- else
- query="/A1-EI/v1/eijobs/$job"
- res="$(__do_curl_to_api ICS DELETE $query)"
- status=${res:${#res}-3}
- if [ $status -ne 204 ]; then
- __log_test_fail_status_code $1 $status
- return 1
- fi
- echo " Deleted job: "$job
+ query="/A1-EI/v1/eijobs/$job"
+ res="$(__do_curl_to_api ICS DELETE $query)"
+ status=${res:${#res}-3}
+ if [ $status -ne 204 ]; then
+ __log_test_fail_status_code $1 $status
+ return 1
fi
+ echo " Deleted job: "$job
done
__log_test_pass
__log_test_pass
return 0
+}
+
+# args: <realm> <client-name> <client-secret>
+ics_configure_sec() {
+ export ICS_CREDS_GRANT_TYPE="client_credentials"
+ export ICS_CREDS_CLIENT_SECRET=$3
+ export ICS_CREDS_CLIENT_ID=$2
+ export ICS_AUTH_SERVICE_URL=$KEYCLOAK_SERVICE_PATH$KEYCLOAK_TOKEN_URL_PREFIX/$1/protocol/openid-connect/token
+ export ICS_SIDECAR_MOUNT="/token-cache"
+ export ICS_SIDECAR_JWT_FILE=$ICS_SIDECAR_MOUNT"/jwt.txt"
+
+ export AUTHSIDECAR_APP_NAME
+ export AUTHSIDECAR_DISPLAY_NAME
}
\ No newline at end of file