3 # ============LICENSE_START===============================================
4 # Copyright (C) 2021-2023 Nordix Foundation. All rights reserved.
5 # Copyright (C) 2024 OpenInfra Foundation Europe. All rights reserved.
6 # ========================================================================
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
11 # http://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 # ============LICENSE_END=================================================
21 # This is a script that contains management and test functions for A1PMS
23 ################ Test engine functions ################
25 # Create the image var used during the test
26 # arg: <image-tag-suffix> (selects staging, snapshot, release etc)
27 # <image-tag-suffix> is present only for images with staging, snapshot,release tags
28 __A1PMS_imagesetup() {
29 __check_and_create_image_var A1PMS "A1PMS_IMAGE" "A1PMS_IMAGE_BASE" "A1PMS_IMAGE_TAG" $1 "$A1PMS_DISPLAY_NAME" ""
32 # Pull image from remote repo or use locally built image
33 # arg: <pull-policy-override> <pull-policy-original>
34 # <pull-policy-override> Shall be used for images allowing overriding. For example use a local image when test is started to use released images
35 # <pull-policy-original> Shall be used for images that does not allow overriding
36 # Both var may contain: 'remote', 'remote-remove' or 'local'
38 __check_and_pull_image $1 "$A1PMS_DISPLAY_NAME" $A1PMS_APP_NAME A1PMS_IMAGE
41 # Build image (only for simulator or interfaces stubs owned by the test environment)
42 # arg: <image-tag-suffix> (selects staging, snapshot, release etc)
43 # <image-tag-suffix> is present only for images with staging, snapshot,release tags
44 __A1PMS_imagebuild() {
45 echo -e $RED" Image for app A1PMS shall never be built"$ERED
48 # Generate a string for each included image using the app display name and a docker images format string
49 # If a custom image repo is used then also the source image from the local repo is listed
50 # arg: <docker-images-format-string> <file-to-append>
51 __A1PMS_image_data() {
52 echo -e "$A1PMS_DISPLAY_NAME\t$(docker images --format $1 $A1PMS_IMAGE)" >>$2
53 if [ ! -z "$A1PMS_IMAGE_SOURCE" ]; then
54 echo -e "-- source image --\t$(docker images --format $1 $A1PMS_IMAGE_SOURCE)" >>$2
58 # Scale kubernetes resources to zero
59 # All resources shall be ordered to be scaled to 0, if relevant. If not relevant to scale, then do no action.
60 # This function is called for apps fully managed by the test script
61 __A1PMS_kube_scale_zero() {
62 __kube_scale_all_resources $KUBE_NONRTRIC_NAMESPACE autotest A1PMS
65 # Scale kubernetes resources to zero and wait until this has been accomplished, if relevant. If not relevant to scale, then do no action.
66 # This function is called for pre-started apps not managed by the test script.
67 __A1PMS_kube_scale_zero_and_wait() {
68 __kube_scale_and_wait_all_resources $KUBE_NONRTRIC_NAMESPACE app "$KUBE_NONRTRIC_NAMESPACE"-policymanagementservice
71 # Delete all kube resources for the app
72 # This function is called for apps managed by the test script.
73 __A1PMS_kube_delete_all() {
74 __kube_delete_all_resources $KUBE_NONRTRIC_NAMESPACE autotest A1PMS
78 # This function is called for apps managed by the test script.
79 # args: <log-dir> <file-prefix>
80 __A1PMS_store_docker_logs() {
81 if [ $RUNMODE == "KUBE" ]; then
82 kubectl $KUBECONF logs -l "autotest=A1PMS" -n $KUBE_NONRTRIC_NAMESPACE --tail=-1 >$1$2_a1pms.log 2>&1
84 docker logs $A1PMS_APP_NAME >$1$2_a1pms.log 2>&1
88 # Initial setup of protocol, host and ports
89 # This function is called for apps managed by the test script.
91 __A1PMS_initial_setup() {
93 export A1PMS_SIDECAR_JWT_FILE=""
96 # Set app short-name, app name and namespace for logging runtime statistics of kubernetes pods or docker containers
97 # For docker, the namespace shall be excluded
98 # This function is called for apps managed by the test script as well as for pre-started apps.
100 __A1PMS_statistics_setup() {
101 if [ $RUNMODE == "KUBE" ]; then
102 echo "A1PMS $A1PMS_APP_NAME $KUBE_NONRTRIC_NAMESPACE"
104 echo "A1PMS $A1PMS_APP_NAME"
108 # Check application requirements, e.g. helm, the the test needs. Exit 1 if req not satisfied
110 __A1PMS_test_requirements() {
114 #######################################################
116 ###########################
118 ###########################
120 # Set http as the protocol to use for all communication to the A1PMS
122 # (Function for test scripts)
123 use_a1pms_rest_http() {
124 __a1pms_set_protocoll "http" $A1PMS_INTERNAL_PORT $A1PMS_EXTERNAL_PORT
127 # Set https as the protocol to use for all communication to the A1PMS
129 # (Function for test scripts)
130 use_a1pms_rest_https() {
131 __a1pms_set_protocoll "https" $A1PMS_INTERNAL_SECURE_PORT $A1PMS_EXTERNAL_SECURE_PORT
134 # All calls to the a1pms will be directed to the a1pms dmaap interface over http from now on
136 # (Function for test scripts)
137 use_a1pms_dmaap_http() {
138 echo -e $BOLD"$A1PMS_DISPLAY_NAME dmaap protocol setting"$EBOLD
139 echo -e " Using $BOLD http $EBOLD and $BOLD DMAAP $EBOLD towards the a1pms"
140 A1PMS_ADAPTER_TYPE="MR-HTTP"
144 # All calls to the a1pms will be directed to the a1pms dmaap interface over https from now on
146 # (Function for test scripts)
147 use_a1pms_dmaap_https() {
148 echo -e $BOLD"$A1PMS_DISPLAY_NAME dmaap protocol setting"$EBOLD
149 echo -e " Using $BOLD https $EBOLD and $BOLD DMAAP $EBOLD towards the a1pms"
150 echo -e $YELLOW" Setting http instead of https - MR only uses http"$EYELLOW
151 A1PMS_ADAPTER_TYPE="MR-HTTPS"
155 # Setup paths to svc/container for internal and external access
156 # args: <protocol> <internal-port> <external-port>
157 __a1pms_set_protocoll() {
158 echo -e $BOLD"$A1PMS_DISPLAY_NAME protocol setting"$EBOLD
159 echo -e " Using $BOLD $1 $EBOLD towards $A1PMS_DISPLAY_NAME"
161 ## Access to Dmaap adapter
163 A1PMS_SERVICE_PATH=$1"://"$A1PMS_APP_NAME":"$2 # docker access, container->container and script->container via proxy
164 if [ $RUNMODE == "KUBE" ]; then
165 A1PMS_SERVICE_PATH=$1"://"$A1PMS_APP_NAME.$KUBE_NONRTRIC_NAMESPACE":"$3 # kube access, pod->svc and script->svc via proxy
168 # A1PMS_ADAPTER used for switching between REST and DMAAP (only REST supported currently)
169 A1PMS_ADAPTER_TYPE="REST"
170 A1PMS_ADAPTER=$A1PMS_SERVICE_PATH
175 # Make curl retries towards the a1pms for http response codes set in this env var, space separated list of codes
178 #Save first worker node the pod is started on
179 __A1PMS_WORKER_NODE=""
181 # Export env vars for config files, docker compose and kube resources
182 # args: PROXY|NOPROXY
183 __export_a1pms_vars() {
185 export A1PMS_APP_NAME
186 export A1PMS_APP_NAME_ALIAS
187 export A1PMS_DISPLAY_NAME
189 export KUBE_NONRTRIC_NAMESPACE
191 export A1PMS_INTERNAL_PORT
192 export A1PMS_INTERNAL_SECURE_PORT
193 export A1PMS_EXTERNAL_PORT
194 export A1PMS_EXTERNAL_SECURE_PORT
195 export A1PMS_CONFIG_MOUNT_PATH
196 export A1PMS_DATA_MOUNT_PATH
197 export A1PMS_CONFIG_CONFIGMAP_NAME=$A1PMS_APP_NAME"-config"
198 export A1PMS_DATA_CONFIGMAP_NAME=$A1PMS_APP_NAME"-data"
199 export A1PMS_PKG_NAME
200 export A1PMS_CONFIG_KEY
201 export DOCKER_SIM_NWNAME
202 export A1PMS_HOST_MNT_DIR
203 export A1PMS_CONFIG_FILE
205 export A1PMS_DATA_PV_NAME=$A1PMS_APP_NAME"-pv"
206 export A1PMS_DATA_PVC_NAME=$A1PMS_APP_NAME"-pvc"
207 ##Create a unique path for the pv each time to prevent a previous volume to be reused
208 export A1PMS_PV_PATH="a1pmsdata-"$(date +%s)
209 export A1PMS_CONTAINER_MNT_DIR
210 export HOST_PATH_BASE_DIR
212 if [ $1 == "PROXY" ]; then
213 export A1PMS_HTTP_PROXY_CONFIG_PORT=$HTTP_PROXY_CONFIG_PORT #Set if proxy is started
214 export A1PMS_HTTP_PROXY_CONFIG_HOST_NAME=$HTTP_PROXY_CONFIG_HOST_NAME #Set if proxy is started
215 if [ $A1PMS_HTTP_PROXY_CONFIG_PORT -eq 0 ] || [ -z "$A1PMS_HTTP_PROXY_CONFIG_HOST_NAME" ]; then
216 echo -e $YELLOW" Warning: HTTP PROXY will not be configured, proxy app not started"$EYELLOW
218 echo " Configured with http proxy"
221 export A1PMS_HTTP_PROXY_CONFIG_PORT=0
222 export A1PMS_HTTP_PROXY_CONFIG_HOST_NAME=""
223 echo " Configured without http proxy"
228 # args: (docker) PROXY|NOPROXY <config-file>
229 # args: (kube) PROXY|NOPROXY <config-file> [ <data-file>]
230 # (Function for test scripts)
232 echo -e $BOLD"Starting $A1PMS_DISPLAY_NAME"$EBOLD
234 if [ $RUNMODE == "KUBE" ]; then
236 # Check if app shall be fully managed by the test script
237 __check_included_image "A1PMS"
240 # Check if app shall only be used by the test script
241 __check_prestarted_image "A1PMS"
244 if [ $retcode_i -ne 0 ] && [ $retcode_p -ne 0 ]; then
245 echo -e $RED"The $A1PMS_APP_NAME app is not included as managed nor prestarted in this test script"$ERED
246 echo -e $RED"The $A1PMS_APP_NAME will not be started"$ERED
249 if [ $retcode_i -eq 0 ] && [ $retcode_p -eq 0 ]; then
250 echo -e $RED"The $A1PMS_APP_NAME app is included both as managed and prestarted in this test script"$ERED
251 echo -e $RED"The $A1PMS_APP_NAME will not be started"$ERED
255 if [ $retcode_p -eq 0 ]; then
256 echo -e " Using existing $A1PMS_APP_NAME deployment and service"
257 echo " Setting $A1PMS_APP_NAME replicas=1"
258 res_type=$(__kube_get_resource_type $A1PMS_APP_NAME $KUBE_NONRTRIC_NAMESPACE)
259 __kube_scale $res_type $A1PMS_APP_NAME $KUBE_NONRTRIC_NAMESPACE 1
262 if [ $retcode_i -eq 0 ]; then
264 echo -e " Creating $A1PMS_APP_NAME app and expose service"
266 #Check if nonrtric namespace exists, if not create it
267 __kube_create_namespace $KUBE_NONRTRIC_NAMESPACE
269 __export_a1pms_vars $1
271 # Create config map for config
272 configfile=$PWD/tmp/$A1PMS_CONFIG_FILE
274 output_yaml=$PWD/tmp/a1pms-cfc.yaml
275 __kube_create_configmap $A1PMS_CONFIG_CONFIGMAP_NAME $KUBE_NONRTRIC_NAMESPACE autotest A1PMS $configfile $output_yaml
277 # Create config map for data
278 data_json=$PWD/tmp/$A1PMS_DATA_FILE
279 if [ $# -lt 3 ]; then
280 #create empty dummy file
281 echo "{}" >$data_json
285 output_yaml=$PWD/tmp/a1pms-cfd.yaml
286 __kube_create_configmap $A1PMS_DATA_CONFIGMAP_NAME $KUBE_NONRTRIC_NAMESPACE autotest A1PMS $data_json $output_yaml
289 input_yaml=$SIM_GROUP"/"$A1PMS_COMPOSE_DIR"/"pv.yaml
290 output_yaml=$PWD/tmp/a1pms-pv.yaml
291 __kube_create_instance pv $A1PMS_APP_NAME $input_yaml $output_yaml
294 input_yaml=$SIM_GROUP"/"$A1PMS_COMPOSE_DIR"/"pvc.yaml
295 output_yaml=$PWD/tmp/a1pms-pvc.yaml
296 __kube_create_instance pvc $A1PMS_APP_NAME $input_yaml $output_yaml
299 input_yaml=$SIM_GROUP"/"$A1PMS_COMPOSE_DIR"/"svc.yaml
300 output_yaml=$PWD/tmp/a1pmssvc.yaml
301 __kube_create_instance service $A1PMS_APP_NAME $input_yaml $output_yaml
304 input_yaml=$SIM_GROUP"/"$A1PMS_COMPOSE_DIR"/"app.yaml
305 output_yaml=$PWD/tmp/a1pmsapp.yaml
306 if [ -z "$A1PMS_SIDECAR_JWT_FILE" ]; then
307 cat $input_yaml | sed '/#A1PMS_JWT_START/,/#A1PMS_JWT_STOP/d' >$PWD/tmp/a1pmsapp_tmp.yaml
308 input_yaml=$PWD/tmp/a1pmsapp_tmp.yaml
310 __kube_create_instance app $A1PMS_APP_NAME $input_yaml $output_yaml
314 # 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
315 if [ $retcode_i -eq 0 ]; then
316 __A1PMS_WORKER_NODE=$(kubectl $KUBECONF get pod -l "autotest=A1PMS" -n $KUBE_NONRTRIC_NAMESPACE -o jsonpath='{.items[*].spec.nodeName}')
317 if [ -z "$__A1PMS_WORKER_NODE" ]; then
318 echo -e $YELLOW" Cannot find worker node for pod for $A1PMS_APP_NAME, persistency may not work"$EYELLOW
321 echo -e $YELLOW" Persistency may not work for app $A1PMS_APP_NAME in multi-worker node config when running it as a prestarted app"$EYELLOW
324 __check_service_start $A1PMS_APP_NAME $A1PMS_SERVICE_PATH$A1PMS_ALIVE_URL
327 __check_included_image 'A1PMS'
328 if [ $? -eq 1 ]; then
329 echo -e $RED"The A1PMS app is not included in this test script"$ERED
330 echo -e $RED"The A1PMS will not be started"$ERED
337 cd $A1PMS_HOST_MNT_DIR
340 if [ "$(ls -A $DIR)" ]; then
341 echo -e $BOLD" Cleaning files in mounted dir: $PWD/db"$EBOLD
342 rm -rf db/* &>/dev/null
343 if [ $? -ne 0 ]; then
344 echo -e $RED" Cannot remove database files in: $PWD"$ERED
349 echo " No files in mounted dir or dir does not exists"
354 __export_a1pms_vars $1
356 dest_file=$SIM_GROUP/$A1PMS_COMPOSE_DIR/$A1PMS_HOST_MNT_DIR/application.yaml
358 envsubst <$2 >$dest_file
360 __start_container $A1PMS_COMPOSE_DIR "" NODOCKERARGS 1 $A1PMS_APP_NAME
362 __check_service_start $A1PMS_APP_NAME $A1PMS_SERVICE_PATH$A1PMS_ALIVE_URL
365 __collect_endpoint_stats_image_info "A1PMS" $A1PMS_IMAGE
373 # (Function for test scripts)
375 echo -e $BOLD"Stopping $A1PMS_DISPLAY_NAME"$EBOLD
377 if [ $RUNMODE == "KUBE" ]; then
379 __check_prestarted_image "A1PMS"
380 if [ $? -eq 0 ]; then
381 echo -e $YELLOW" Persistency may not work for app $A1PMS_APP_NAME in multi-worker node config when running it as a prestarted app"$EYELLOW
382 res_type=$(__kube_get_resource_type $A1PMS_APP_NAME $KUBE_NONRTRIC_NAMESPACE)
383 __kube_scale $res_type $A1PMS_APP_NAME $KUBE_NONRTRIC_NAMESPACE 0
386 __kube_scale_all_resources $KUBE_NONRTRIC_NAMESPACE autotest A1PMS
387 echo " Deleting the replica set - a new will be started when the app is started"
388 tmp=$(kubectl $KUBECONF delete rs -n $KUBE_NONRTRIC_NAMESPACE -l "autotest=PA")
389 if [ $? -ne 0 ]; then
390 echo -e $RED" Could not delete replica set "$RED
395 docker stop $A1PMS_APP_NAME &>./tmp/.dockererr
396 if [ $? -ne 0 ]; then
397 __print_err "Could not stop $A1PMS_APP_NAME" $@
403 echo -e $BOLD$GREEN"Stopped"$EGREEN$EBOLD
408 # Start a previously stopped a1pms
410 # (Function for test scripts)
411 start_stopped_a1pms() {
412 echo -e $BOLD"Starting (the previously stopped) $A1PMS_DISPLAY_NAME"$EBOLD
414 if [ $RUNMODE == "KUBE" ]; then
416 __check_prestarted_image "A1PMS"
417 if [ $? -eq 0 ]; then
418 echo -e $YELLOW" Persistency may not work for app $A1PMS_APP_NAME in multi-worker node config when running it as a prestarted app"$EYELLOW
419 res_type=$(__kube_get_resource_type $A1PMS_APP_NAME $KUBE_NONRTRIC_NAMESPACE)
420 __kube_scale $res_type $A1PMS_APP_NAME $KUBE_NONRTRIC_NAMESPACE 1
421 __check_service_start $A1PMS_APP_NAME $A1PMS_SERVICE_PATH$A1PMS_ALIVE_URL
425 # Tie the A1PMS to the same worker node it was initially started on
426 # 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
427 if [ -z "$__A1PMS_WORKER_NODE" ]; then
428 echo -e $RED" No initial worker node found for pod "$RED
432 echo -e $BOLD" Setting nodeSelector kubernetes.io/hostname=$__A1PMS_WORKER_NODE to deployment for $A1PMS_APP_NAME. Pod will always run on this worker node: $__A1PMS_WORKER_NODE"$BOLD
433 echo -e $BOLD" The mounted volume is mounted as hostPath and only available on that worker node."$BOLD
434 tmp=$(kubectl $KUBECONF patch deployment $A1PMS_APP_NAME -n $KUBE_NONRTRIC_NAMESPACE --patch '{"spec": {"template": {"spec": {"nodeSelector": {"kubernetes.io/hostname": "'$__A1PMS_WORKER_NODE'"}}}}}')
435 if [ $? -ne 0 ]; then
436 echo -e $YELLOW" Cannot set nodeSelector to deployment for $A1PMS_APP_NAME, persistency may not work"$EYELLOW
438 __kube_scale deployment $A1PMS_APP_NAME $KUBE_NONRTRIC_NAMESPACE 1
441 docker start $A1PMS_APP_NAME &>./tmp/.dockererr
442 if [ $? -ne 0 ]; then
443 __print_err "Could not start (the stopped) $A1PMS_APP_NAME" $@
449 __check_service_start $A1PMS_APP_NAME $A1PMS_SERVICE_PATH$A1PMS_ALIVE_URL
450 if [ $? -ne 0 ]; then
457 # Function to prepare the a1pms configuration according to the current simulator configuration
458 # args: SDNC|NOSDNC <output-file> [ <sim-group> <adapter-class> ]
459 # (Function for test scripts)
460 prepare_a1pms_config() {
461 echo -e $BOLD"Prepare A1PMS config"$EBOLD
463 echo " Writing a1pms config for "$A1PMS_APP_NAME" to file: "$2
465 if [ $# != 2 ] && [ $# != 4 ]; then
467 __print_err "need two or four args, SDNC|NOSDNC <output-file> [ <sim-group> <adapter-class> ]" $@
471 if [ $1 == "SDNC" ]; then
472 echo -e " Config$BOLD including SDNC$EBOLD configuration"
473 elif [ $1 == "NOSDNC" ]; then
474 echo -e " Config$BOLD excluding SDNC$EBOLD configuration"
477 __print_err "need three args, SDNC|NOSDNC <output-file> HEADER|NOHEADER" $@
482 if [ $1 == "SDNC" ]; then
483 config_json=$config_json"\n \"controller\": ["
484 config_json=$config_json"\n {"
485 config_json=$config_json"\n \"name\": \"$SDNC_APP_NAME\","
486 config_json=$config_json"\n \"baseUrl\": \"$SDNC_SERVICE_PATH\","
487 config_json=$config_json"\n \"userName\": \"$SDNC_USER\","
488 config_json=$config_json"\n \"password\": \"$SDNC_PWD\""
489 config_json=$config_json"\n }"
490 config_json=$config_json"\n ],"
492 if [[ "$A1PMS_FEATURE_LEVEL" == *"NO-DMAAP"* ]]; then
495 config_json=$config_json"\n \"streams_publishes\": {"
496 config_json=$config_json"\n \"dmaap_publisher\": {"
497 config_json=$config_json"\n \"type\": \"message-router\","
498 config_json=$config_json"\n \"dmaap_info\": {"
499 config_json=$config_json"\n \"topic_url\": \"$MR_SERVICE_PATH$MR_WRITE_URL\""
500 config_json=$config_json"\n }"
501 config_json=$config_json"\n }"
502 config_json=$config_json"\n },"
503 config_json=$config_json"\n \"streams_subscribes\": {"
504 config_json=$config_json"\n \"dmaap_subscriber\": {"
505 config_json=$config_json"\n \"type\": \"message-router\","
506 config_json=$config_json"\n \"dmaap_info\": {"
507 config_json=$config_json"\n \"topic_url\": \"$MR_SERVICE_PATH$MR_READ_URL\""
508 config_json=$config_json"\n }"
509 config_json=$config_json"\n }"
510 config_json=$config_json"\n },"
513 config_json=$config_json"\n \"ric\": ["
515 if [ $RUNMODE == "KUBE" ]; then
516 result=$(kubectl $KUBECONF get pods -n $KUBE_A1SIM_NAMESPACE -o jsonpath='{.items[?(@.metadata.labels.autotest=="RICSIM")].metadata.name}')
519 if [ $? -eq 0 ] && [ ! -z "$result" ]; then
520 for im in $result; do
521 if [[ $im != *"-0" ]]; then
522 ric_subdomain=$(kubectl $KUBECONF get pod $im -n $KUBE_A1SIM_NAMESPACE -o jsonpath='{.spec.subdomain}')
523 rics=$rics" "$im"."$ric_subdomain"."$KUBE_A1SIM_NAMESPACE
524 let ric_cntr=ric_cntr+1
528 result=$(kubectl $KUBECONF get pods -n $KUBE_A1SIM_NAMESPACE -o jsonpath='{.items[?(@.metadata.labels.autotest=="RICMEDIATORSIM")].metadata.name}')
530 if [ $? -eq 0 ] && [ ! -z "$result" ]; then
531 for im in $result; do
532 if [[ $im != *"-0" ]]; then
533 ric_subdomain=$(kubectl $KUBECONF get pod $im -n $KUBE_A1SIM_NAMESPACE -o jsonpath='{.spec.subdomain}')
534 rics=$rics" "$im"."$ric_subdomain"."$KUBE_A1SIM_NAMESPACE
535 oranrics=$oranrics" "$im"."$ric_subdomain"."$KUBE_A1SIM_NAMESPACE
536 let ric_cntr=ric_cntr+1
540 if [ $ric_cntr -eq 0 ]; then
541 echo $YELLOW"Warning: No rics found for the configuration"$EYELLOW
544 rics=$(docker ps --filter "name=$RIC_SIM_PREFIX" --filter "network=$DOCKER_SIM_NWNAME" --filter "label=a1sim" --filter "status=running" --format {{.Names}})
545 oranrics=$(docker ps --filter "name=$RIC_SIM_PREFIX" --filter "network=$DOCKER_SIM_NWNAME" --filter "label=orana1sim" --filter "status=running" --format {{.Names}})
547 rics="$rics $oranrics"
549 if [ $? -ne 0 ] || [ -z "$rics" ]; then
550 echo -e $RED" FAIL - the names of the running RIC Simulator or ORAN RIC cannot be retrieved." $ERED
557 if [ $cntr -gt 0 ]; then
558 config_json=$config_json"\n ,"
560 config_json=$config_json"\n {"
561 if [ $RUNMODE == "KUBE" ]; then
562 ric_id=${ric%.*.*} #extract pod id from full hosthame
563 ric_id=$(echo "$ric_id" | tr '-' '_')
565 ric_id=$(echo "$ric" | tr '-' '_') #ric var still needs underscore as it is different from the container name
567 echo " Found a1 sim: "$ric
568 config_json=$config_json"\n \"name\": \"$ric_id\","
571 for xric in $oranrics; do
572 if [ $xric == $ric ]; then
576 if [ $xricfound -eq 0 ]; then
577 config_json=$config_json"\n \"baseUrl\": \"$RIC_SIM_HTTPX://$ric:$RIC_SIM_PORT\","
579 config_json=$config_json"\n \"baseUrl\": \"$RICMEDIATOR_SIM_HTTPX://$ric:$RICMEDIATOR_SIM_PORT\","
581 if [ ! -z "$3" ]; then
582 if [[ $ric == "$3"* ]]; then
583 config_json=$config_json"\n \"customAdapterClass\": \"$4\","
586 if [ $1 == "SDNC" ]; then
587 config_json=$config_json"\n \"controller\": \"$SDNC_APP_NAME\","
589 config_json=$config_json"\n \"managedElementIds\": ["
590 config_json=$config_json"\n \"me1_$ric_id\","
591 config_json=$config_json"\n \"me2_$ric_id\""
592 config_json=$config_json"\n ]"
593 config_json=$config_json"\n }"
597 config_json=$config_json"\n ]"
598 config_json=$config_json"\n}"
600 config_json="{\"config\":"$config_json"}"
602 printf "$config_json" >$2
607 # Load the the appl config for the a1pms into a config map
608 a1pms_load_config() {
609 echo -e $BOLD"A1PMS - load config from "$EBOLD$1
610 data_json=$PWD/tmp/$A1PMS_DATA_FILE
612 output_yaml=$PWD/tmp/a1pms-cfd.yaml
613 __kube_create_configmap $A1PMS_APP_NAME"-data" $KUBE_NONRTRIC_NAMESPACE autotest A1PMS $data_json $output_yaml
617 # Turn on debug level tracing in the a1pms
619 # (Function for test scripts)
621 echo -e $BOLD"Setting a1pms debug logging"$EBOLD
622 curlString="$A1PMS_SERVICE_PATH$A1PMS_ACTUATOR -X POST -H Content-Type:application/json -d {\"configuredLevel\":\"debug\"}"
623 result=$(__do_curl "$curlString")
624 if [ $? -ne 0 ]; then
625 __print_err "could not set debug mode" $@
633 # Turn on trace level tracing in the a1pms
635 # (Function for test scripts)
637 echo -e $BOLD"Setting a1pms trace logging"$EBOLD
638 curlString="$A1PMS_SERVICE_PATH$A1PMS_ACTUATOR -X POST -H Content-Type:application/json -d {\"configuredLevel\":\"trace\"}"
639 result=$(__do_curl "$curlString")
640 if [ $? -ne 0 ]; then
641 __print_err "could not set trace mode" $@
649 # Perform curl retries when making direct call to the a1pms for the specified http response codes
650 # Speace separated list of http response codes
651 # args: [<response-code>]*
652 use_a1pms_retries() {
653 echo -e $BOLD"Do curl retries to the a1pms REST inteface for these response codes:$@"$EBOLD
659 # Check the a1pms logs for WARNINGs and ERRORs
661 # (Function for test scripts)
663 __check_container_logs "A1PMS" $A1PMS_APP_NAME $A1PMS_LOGPATH WARN ERR
666 #########################################################
667 #### Test case functions A1 Policy management service
668 #########################################################
670 # This function compare the size, towards a target value, of a json array returned from <url> of the A1PMS.
671 # This is done immediately by setting PASS or FAIL or wait up to and optional timeout before setting PASS or FAIL
672 # args: json:<url> <target-value> [<timeout-in-seconds]
673 # (Function for test scripts)
675 echo "(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >>$HTTPLOG
676 if [ $# -eq 2 ] || [ $# -eq 3 ]; then
677 if [[ $1 == "json:"* ]]; then
678 if [ "$A1PMS_VERSION" == "V2" ]; then
679 __var_test "A1PMS" $A1PMS_SERVICE_PATH$A1PMS_API_PREFIX"/v2/" $1 "=" $2 $3
680 elif [ "$A1PMS_VERSION" == "V3" ]; then
681 echo "var test execution for V3"
682 __var_test "A1PMS" $A1PMS_SERVICE_PATH$A1PMS_API_PREFIX"/v1/" $1 "=" $2 $3
684 __var_test "A1PMS" $A1PMS_SERVICE_PATH"/" $1 "=" $2 $3
689 __print_err "needs two or three args: json:<json-array-param> <target-value> [ timeout ]" $@
693 # API Test function: GET /policies and V2 GET /v2/policy-instances
694 # args: <response-code> <ric-id>|NORIC <service-id>|NOSERVICE <policy-type-id>|NOTYPE [ NOID | [<policy-id> <ric-id> <service-id> EMPTY|<policy-type-id> <template-file>]*]
695 # args(V2): <response-code> <ric-id>|NORIC <service-id>|NOSERVICE <policy-type-id>|NOTYPE [ NOID | [<policy-id> <ric-id> <service-id> EMPTY|<policy-type-id> <transient> <notification-url> <template-file>]*]
696 # (Function for test scripts)
697 a1pms_api_get_policies() {
700 if [ "$A1PMS_VERSION" == "V2" ]; then
702 variableParams=$(($# - 4))
703 if [ $# -lt 4 ]; then
705 elif [ $# -eq 5 ] && [ $5 != "NOID" ]; then
707 elif [ $# -gt 5 ] && [ $(($variableParams % 7)) -ne 0 ]; then
711 if [ $paramError -ne 0 ]; then
712 __print_err "<response-code> <ric-id>|NORIC <service-id>|NOSERVICE <policy-type-id>|NOTYPE [ NOID | [<policy-id> <ric-id> <service-id> EMPTY|<policy-type-id> <transient> <notification-url> <template-file>]*]" $@
717 variableParams=$(($# - 4))
718 if [ $# -lt 4 ]; then
720 elif [ $# -eq 5 ] && [ $5 != "NOID" ]; then
722 elif [ $# -gt 5 ] && [ $(($variableParams % 5)) -ne 0 ]; then
726 if [ $paramError -ne 0 ]; then
727 __print_err "<response-code> <ric-id>|NORIC <service-id>|NOSERVICE <policy-type-id>|NOTYPE [ NOID | [<policy-id> <ric-id> <service-id> EMPTY|<policy-type-id> <template-file>]*]" $@
733 if [ "$A1PMS_VERSION" == "V2" ]; then
734 if [ $2 != "NORIC" ]; then
735 queryparams="?ric_id="$2
737 if [ $3 != "NOSERVICE" ]; then
738 if [ -z $queryparams ]; then
739 queryparams="?service_id="$3
741 queryparams=$queryparams"&service_id="$3
744 if [ $4 != "NOTYPE" ]; then
745 if [ -z $queryparams ]; then
746 queryparams="?policytype_id="$4
748 queryparams=$queryparams"&policytype_id="$4
752 query="/v2/policy-instances"$queryparams
753 res="$(__do_curl_to_api A1PMS GET $query)"
754 status=${res:${#res}-3}
756 if [ $status -ne $1 ]; then
757 __log_test_fail_status_code $1 $status
761 if [ $# -gt 4 ]; then
762 body=${res:0:${#res}-3}
763 if [ $# -eq 5 ] && [ $5 == "NOID" ]; then
769 for ((i = 0; i < $(($# - 4)); i = i + 7)); do
771 if [ "$targetJson" != "[" ]; then
772 targetJson=$targetJson","
774 targetJson=$targetJson"{\"policy_id\":\"$UUID${arr[$i]}\",\"ric_id\":\"${arr[$i + 1]}\",\"service_id\":\"${arr[$i + 2]}\",\"policytype_id\":"
775 if [ "${arr[$i + 3]}" == "EMPTY" ]; then
776 targetJson=$targetJson"\"\","
778 targetJson=$targetJson"\"${arr[$i + 3]}\","
780 targetJson=$targetJson"\"transient\":${arr[$i + 4]},\"status_notification_uri\":\"${arr[$i + 5]}\","
782 sed 's/XXX/'${arr[$i]}'/g' ${arr[$i + 6]} >$file
784 targetJson=$targetJson"\"policy_data\":"$json"}"
788 targetJson=$targetJson"]"
789 targetJson="{\"policies\": $targetJson}"
790 echo "TARGET JSON: $targetJson" >>$HTTPLOG
791 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
793 if [ $res -ne 0 ]; then
799 if [ $2 != "NORIC" ]; then
800 queryparams="?ric="$2
802 if [ $3 != "NOSERVICE" ]; then
803 if [ -z $queryparams ]; then
804 queryparams="?service="$3
806 queryparams=$queryparams"&service="$3
809 if [ $4 != "NOTYPE" ]; then
810 if [ -z $queryparams ]; then
811 queryparams="?type="$4
813 queryparams=$queryparams"&type="$4
817 query="/policies"$queryparams
818 res="$(__do_curl_to_api A1PMS GET $query)"
819 status=${res:${#res}-3}
821 if [ $status -ne $1 ]; then
822 __log_test_fail_status_code $1 $status
826 if [ $# -gt 4 ]; then
827 if [ $# -eq 5 ] && [ $5 == "NOID" ]; then
830 body=${res:0:${#res}-3}
834 for ((i = 0; i < $(($# - 4)); i = i + 5)); do
836 if [ "$targetJson" != "[" ]; then
837 targetJson=$targetJson","
839 targetJson=$targetJson"{\"id\":\"$UUID${arr[$i]}\",\"lastModified\":\"????\",\"ric\":\"${arr[$i + 1]}\",\"service\":\"${arr[$i + 2]}\",\"type\":"
840 if [ "${arr[$i + 3]}" == "EMPTY" ]; then
841 targetJson=$targetJson"\"\","
843 targetJson=$targetJson"\"${arr[$i + 3]}\","
846 sed 's/XXX/'${arr[$i]}'/g' ${arr[$i + 4]} >$file
848 targetJson=$targetJson"\"json\":"$json"}"
852 targetJson=$targetJson"]"
853 echo "TARGET JSON: $targetJson" >>$HTTPLOG
854 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
856 if [ $res -ne 0 ]; then
862 __collect_endpoint_stats "A1PMS" 00 "GET" $A1PMS_API_PREFIX"/v2/policy-instances" $status
868 # API Test function: GET /policy and V2 GET /v2/policies/{policy_id}
869 # args: <response-code> <policy-id> [<template-file>]
870 # args(V2): <response-code> <policy-id> [ <template-file> <service-name> <ric-id> <policytype-id>|NOTYPE <transient> <notification-url>|NOURL ]
872 # (Function for test scripts)
873 a1pms_api_get_policy() {
876 if [ "$A1PMS_VERSION" == "V2" ]; then
877 if [ $# -ne 2 ] && [ $# -ne 8 ]; then
878 __print_err "<response-code> <policy-id> [ <template-file> <service-name> <ric-id> <policytype-id>|NOTYPE <transient> <notification-url>|NOURL ]" $@
881 query="/v2/policies/$UUID$2"
883 if [ $# -lt 2 ] || [ $# -gt 3 ]; then
884 __print_err "<response-code> <policy-id> [<template-file>] " $@
887 query="/policy?id=$UUID$2"
889 res="$(__do_curl_to_api A1PMS GET $query)"
890 status=${res:${#res}-3}
892 if [ $status -ne $1 ]; then
893 __log_test_fail_status_code $1 $status
897 if [ "$A1PMS_VERSION" == "V2" ]; then
898 if [ $# -eq 8 ]; then
900 #Create a policy json to compare with
901 body=${res:0:${#res}-3}
903 targetJson="\"ric_id\":\"$5\",\"policy_id\":\"$UUID$2\",\"service_id\":\"$4\""
904 if [ $7 != "NOTRANSIENT" ]; then
905 targetJson=$targetJson", \"transient\":$7"
907 if [ $6 != "NOTYPE" ]; then
908 targetJson=$targetJson", \"policytype_id\":\"$6\""
910 targetJson=$targetJson", \"policytype_id\":\"\""
912 if [ $8 != "NOURL" ]; then
913 targetJson=$targetJson", \"status_notification_uri\":\"$8\""
916 data=$(sed 's/XXX/'${2}'/g' $3)
917 targetJson=$targetJson", \"policy_data\":$data"
918 targetJson="{$targetJson}"
920 echo "TARGET JSON: $targetJson" >>$HTTPLOG
921 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
922 if [ $res -ne 0 ]; then
928 if [ $# -eq 3 ]; then
929 #Create a policy json to compare with
930 body=${res:0:${#res}-3}
932 sed 's/XXX/'${2}'/g' $3 >$file
934 echo "TARGET JSON: $targetJson" >>$HTTPLOG
935 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
936 if [ $res -ne 0 ]; then
942 __collect_endpoint_stats "A1PMS" 01 "GET" $A1PMS_API_PREFIX"/v2/policies/{policy_id}" $status
947 # API Test function: PUT /policy and V2 PUT /policies
948 # args: <response-code> <service-name> <ric-id> <policytype-id>|NOTYPE <policy-id> <transient>|NOTRANSIENT <template-file> [<count>]
949 # args(V2): <response-code> <service-name> <ric-id> <policytype-id>|NOTYPE <policy-id> <transient>|NOTRANSIENT <notification-url>|NOURL <template-file> [<count>]
950 # (Function for test scripts)
951 a1pms_api_put_policy() {
954 if [ "$A1PMS_VERSION" == "V2" ]; then
955 if [ $# -lt 8 ] || [ $# -gt 9 ]; then
956 __print_err "<response-code> <service-name> <ric-id> <policytype-id>|NOTYPE <policy-id> <transient>|NOTRANSIENT <notification-url>|NOURL <template-file> [<count>]" $@
960 if [ $# -lt 7 ] || [ $# -gt 8 ]; then
961 __print_err "<response-code> <service-name> <ric-id> <policytype-id>|NOTYPE <policy-id> <transient>|NOTRANSIENT <template-file> [<count>]" $@
974 if [ "$A1PMS_VERSION" == "V2" ]; then
977 if [ $# -eq 9 ]; then
982 if [ $# -eq 8 ]; then
987 while [ $count -lt $max ]; do
988 if [ "$A1PMS_VERSION" == "V2" ]; then
992 inputJson="\"ric_id\":\"$ric\",\"policy_id\":\"$UUID$pid\",\"service_id\":\"$serv\""
993 if [ $trans != "NOTRANSIENT" ]; then
994 inputJson=$inputJson", \"transient\":$trans"
996 if [ $pt != "NOTYPE" ]; then
997 inputJson=$inputJson", \"policytype_id\":\"$pt\""
999 inputJson=$inputJson", \"policytype_id\":\"\""
1001 if [ $noti != "NOURL" ]; then
1002 inputJson=$inputJson", \"status_notification_uri\":\"$noti\""
1004 file="./tmp/.p.json"
1005 data=$(sed 's/XXX/'${pid}'/g' $temp)
1006 inputJson=$inputJson", \"policy_data\":$data"
1007 inputJson="{$inputJson}"
1008 echo $inputJson >$file
1010 query="/policy?id=$UUID$pid&ric=$ric&service=$serv"
1012 if [ $pt != "NOTYPE" ]; then
1013 query=$query"&type=$pt"
1016 if [ $trans != NOTRANSIENT ]; then
1017 query=$query"&transient=$trans"
1020 file="./tmp/.p.json"
1021 sed 's/XXX/'${pid}'/g' $temp >$file
1023 res="$(__do_curl_to_api A1PMS PUT $query $file)"
1024 status=${res:${#res}-3}
1025 echo -ne " Executing "$count"("$max")${SAMELINE}"
1026 if [ $status -ne $1 ]; then
1027 echo " Executed "$count"?("$max")"
1028 __log_test_fail_status_code $1 $status
1033 echo -ne " Executed "$count"("$max")${SAMELINE}"
1035 __collect_endpoint_stats "A1PMS" 02 "PUT" $A1PMS_API_PREFIX"/v2/policies" $status $max
1042 # API Test function: PUT /policy and V2 PUT /policies, to run in batch
1043 # args: <response-code> <service-name> <ric-id> <policytype-id>|NOTYPE <policy-id> <transient> <template-file> [<count>]
1044 # args(V2): <response-code> <service-name> <ric-id> <policytype-id>|NOTYPE <policy-id> <transient> <notification-url>|NOURL <template-file> [<count>]
1045 # (Function for test scripts)
1047 a1pms_api_put_policy_batch() {
1050 if [ "$A1PMS_VERSION" == "V2" ]; then
1051 if [ $# -lt 8 ] || [ $# -gt 9 ]; then
1052 __print_err "<response-code> <service-name> <ric-id> <policytype-id>|NOTYPE <policy-id> <transient> <notification-url>|NOURL <template-file> [<count>]" $@
1056 if [ $# -lt 7 ] || [ $# -gt 8 ]; then
1057 __print_err "<response-code> <service-name> <ric-id> <policytype-id>|NOTYPE <policy-id> <transient> <template-file> [<count>]" $@
1069 if [ "$A1PMS_VERSION" == "V2" ]; then
1072 if [ $# -eq 9 ]; then
1077 if [ $# -eq 8 ]; then
1083 while [ $count -lt $max ]; do
1084 if [ "$A1PMS_VERSION" == "V2" ]; then
1085 query="/v2/policies"
1087 inputJson="\"ric_id\":\"$ric\",\"policy_id\":\"$UUID$pid\",\"service_id\":\"$serv\""
1088 if [ $trans != "NOTRANSIENT" ]; then
1089 inputJson=$inputJson", \"transient\":$trans"
1091 if [ $pt != "NOTYPE" ]; then
1092 inputJson=$inputJson", \"policytype_id\":\"$pt\""
1094 inputJson=$inputJson", \"policytype_id\":\"\""
1096 if [ $noti != "NOURL" ]; then
1097 inputJson=$inputJson", \"status_notification_uri\":\"$noti\""
1099 file="./tmp/.p.json"
1100 data=$(sed 's/XXX/'${pid}'/g' $temp)
1101 inputJson=$inputJson", \"policy_data\":$data"
1102 inputJson="{$inputJson}"
1103 echo $inputJson >$file
1105 query="/policy?id=$UUID$pid&ric=$ric&service=$serv"
1107 if [ $pt != "NOTYPE" ]; then
1108 query=$query"&type=$pt"
1111 if [ $trans != NOTRANSIENT ]; then
1112 query=$query"&transient=$trans"
1114 file="./tmp/.p.json"
1115 sed 's/XXX/'${pid}'/g' $temp >$file
1117 res="$(__do_curl_to_api A1PMS PUT_BATCH $query $file)"
1118 status=${res:${#res}-3}
1119 echo -ne " Requesting(batch) "$count"("$max")${SAMELINE}"
1121 if [ $status -ne 200 ]; then
1122 echo " Requested(batch) "$count"?("$max")"
1123 __log_test_fail_status_code 200 $status
1126 cid=${res:0:${#res}-3}
1130 echo -ne " Requested(batch) "$count"("$max")${SAMELINE}"
1137 res="$(__do_curl_to_api A1PMS RESPONSE $cid)"
1138 status=${res:${#res}-3}
1139 echo -ne " Accepting(batch) "$count"("$max")${SAMELINE}"
1141 if [ $status -ne $1 ]; then
1142 echo " Accepted(batch) "$count"?("$max")"
1143 __log_test_fail_status_code $1 $status
1148 echo -ne " Accepted(batch) "$count"("$max")${SAMELINE}"
1150 __collect_endpoint_stats "A1PMS" 02 "PUT" $A1PMS_API_PREFIX"/v2/policies" $1 $max
1158 # API Test function: PUT /policy and V2 PUT /policies, to run in i parallel for a number of rics
1159 # args: <response-code> <service-name> <ric-id-base> <number-of-rics> <policytype-id> <policy-start-id> <transient> <template-file> <count-per-ric> <number-of-threads>
1160 # args(V2): <response-code> <service-name> <ric-id-base> <number-of-rics> <policytype-id> <policy-start-id> <transient> <notification-url>|NOURL <template-file> <count-per-ric> <number-of-threads>
1161 # (Function for test scripts)
1162 a1pms_api_put_policy_parallel() {
1165 if [ "$A1PMS_VERSION" == "V2" ]; then
1166 if [ $# -ne 11 ]; then
1167 __print_err "These all arguments needed <response-code> <service-name> <ric-id-base> <number-of-rics> <policytype-id> <policy-start-id> <transient> <notification-url>|NOURL <template-file> <count-per-ric> <number-of-threads>" $@
1186 if [ "$A1PMS_VERSION" == "V2" ]; then
1199 #if [ $A1PMS_ADAPTER != $RESTBASE ] && [ $A1PMS_ADAPTER != $RESTBASE_SECURE ]; then
1200 if [ $A1PMS_ADAPTER_TYPE != "REST" ]; then
1201 echo " Info - a1pms_api_put_policy_parallel uses only the a1pms REST interface - create over dmaap in parallel is not supported"
1202 echo " Info - will execute over a1pms REST"
1204 if [ "$A1PMS_VERSION" == "V2" ]; then
1205 if [ $serv == "NOSERVICE" ]; then
1208 query="$A1PMS_API_PREFIX/v2/policies"
1210 if [ $serv == "NOSERVICE" ]; then
1213 query="/policy?service=$serv"
1215 if [ $type != "NOTYPE" ]; then
1216 query=$query"&type=$type"
1219 if [ $transient != NOTRANSIENT ]; then
1220 query=$query"&transient=$transient"
1224 urlbase=${A1PMS_ADAPTER}${query}
1227 if [ ! -z "$KUBE_PROXY_PATH" ]; then
1228 httpproxy=$KUBE_PROXY_PATH
1231 for ((i = 1; i <= $pids; i++)); do
1233 if [ -z "$uuid" ]; then
1236 echo "" >"./tmp/.pid${i}.res.txt"
1237 if [ "$A1PMS_VERSION" == "V2" ]; then
1238 echo $resp_code $urlbase $ric_base $num_rics $uuid $start_id $serv $type $transient $noti $template $count $pids $i $httpproxy >"./tmp/.pid${i}.txt"
1240 echo $resp_code $urlbase $ric_base $num_rics $uuid $start_id $template $count $pids $i $httpproxy >"./tmp/.pid${i}.txt"
1243 done | xargs -n 1 -I{} -P $pids bash -c '{
1245 echo " Parallel process $arg started"
1246 tmp=$(< "./tmp/.pid${arg}.txt")
1247 python3 ../common/create_policies_process.py $tmp > ./tmp/.pid${arg}.res.txt
1250 for ((i = 1; i <= $pids; i++)); do
1251 file="./tmp/.pid${i}.res.txt"
1253 if [ -z "$tmp" ]; then
1254 echo " Process $i : unknown result (result file empty"
1258 if [ $res == "0" ]; then
1259 echo " Process $i : OK - "${tmp:1}
1261 echo " Process $i : failed - "${tmp:1}
1266 if [ -z $msg ]; then
1267 __collect_endpoint_stats "A1PMS" 02 "PUT" $A1PMS_API_PREFIX"/v2/policies" $resp_code $(($count * $num_rics))
1268 __log_test_pass " $(($count * $num_rics)) policy request(s) executed"
1271 __log_test_fail_general "One of more processes failed to execute"
1275 # API Test function: V3 POST /policies, to run in i parallel for a number of rics
1276 # args: <response-code> <service-name> <ric-id-base> <number-of-rics> <policytype-id> <policy-start-id> <transient> <template-file> <count-per-ric> <number-of-threads>
1277 # args(V3): <response-code> <service-name> <ric-id-base> <number-of-rics> <policytype-id> <policy-start-id> <transient> <notification-url>|NOURL <template-file> <count-per-ric> <number-of-threads>
1278 # (Function for test scripts)
1279 a1pms_api_post_policy_parallel() {
1282 if [ $# -ne 11 ]; then
1283 __print_err "These all arguments needed <response-code> <service-name> <ric-id-base> <number-of-rics> <policytype-id> <policy-start-id> <transient> <notification-url>|NOURL <template-file> <count-per-ric> <number-of-threads>" $@
1310 #if [ $A1PMS_ADAPTER != $RESTBASE ] && [ $A1PMS_ADAPTER != $RESTBASE_SECURE ]; then
1311 if [ $A1PMS_ADAPTER_TYPE != "REST" ]; then
1312 echo " Info - a1pms_api_put_policy_parallel uses only the a1pms REST interface - create over dmaap in parallel is not supported"
1313 echo " Info - will execute over a1pms REST"
1316 if [ $serv == "NOSERVICE" ]; then
1319 query="$A1PMS_API_PREFIX/v1/policies"
1321 urlbase=${A1PMS_ADAPTER}${query}
1324 if [ ! -z "$KUBE_PROXY_PATH" ]; then
1325 httpproxy=$KUBE_PROXY_PATH
1328 for ((i = 1; i <= $pids; i++)); do
1330 if [ -z "$uuid" ]; then
1333 echo "" >"./tmp/.pid${i}.res.txt"
1334 echo $resp_code $urlbase $ric_base $num_rics $uuid $start_id $serv $type $transient $noti $template $count $pids $i $httpproxy >"./tmp/.pid${i}.txt"
1336 done | xargs -n 1 -I{} -P $pids bash -c '{
1338 echo " Parallel process $arg started"
1339 tmp=$(< "./tmp/.pid${arg}.txt")
1340 python3 ../common/create_policies_process.py $tmp > ./tmp/.pid${arg}.res.txt
1343 for ((i = 1; i <= $pids; i++)); do
1344 file="./tmp/.pid${i}.res.txt"
1346 if [ -z "$tmp" ]; then
1347 echo " Process $i : unknown result (result file empty"
1351 if [ $res == "0" ]; then
1352 echo " Process $i : OK - "${tmp:1}
1354 echo " Process $i : failed - "${tmp:1}
1359 if [ -z $msg ]; then
1360 __collect_endpoint_stats "A1PMS" 02 "POST" $A1PMS_API_PREFIX"/v1/policies" $resp_code $(($count * $num_rics))
1361 __log_test_pass " $(($count * $num_rics)) policy request(s) executed"
1364 __log_test_fail_general "One of more processes failed to execute"
1368 # API Test function: V3 PUT /policies, to run in i parallel for a number of rics
1369 # args: <response-code> <service-name> <ric-id-base> <number-of-rics> <policytype-id> <policy-start-id> <transient> <template-file> <count-per-ric> <number-of-threads> <policy-ids-file-path>
1370 # args(V3): <response-code> <service-name> <ric-id-base> <number-of-rics> <policytype-id> <policy-start-id> <transient> <notification-url>|NOURL <template-file> <count-per-ric> <number-of-threads> <policy-ids-file-path>
1371 # (Function for test scripts)
1372 a1pms_api_update_policy_parallel() {
1375 if [ $# -ne 12 ]; then
1376 __print_err "These all arguments needed <response-code> <service-name> <ric-id-base> <number-of-rics> <policytype-id> <policy-start-id> <transient> <notification-url>|NOURL <template-file> <count-per-ric> <number-of-threads> <policy-ids-file-path>" $@
1402 policy_ids_file_path=$1
1405 #if [ $A1PMS_ADAPTER != $RESTBASE ] && [ $A1PMS_ADAPTER != $RESTBASE_SECURE ]; then
1406 if [ $A1PMS_ADAPTER_TYPE != "REST" ]; then
1407 echo " Info - a1pms_api_put_policy_parallel uses only the a1pms REST interface - create over dmaap in parallel is not supported"
1408 echo " Info - will execute over a1pms REST"
1411 if [ $serv == "NOSERVICE" ]; then
1414 query="$A1PMS_API_PREFIX/v1/policies"
1416 urlbase=${A1PMS_ADAPTER}${query}
1419 if [ ! -z "$KUBE_PROXY_PATH" ]; then
1420 httpproxy=$KUBE_PROXY_PATH
1423 for ((i = 1; i <= $pids; i++)); do
1425 if [ -z "$uuid" ]; then
1428 echo "" >"./tmp/.pid${i}.res.txt"
1429 echo $resp_code $urlbase $ric_base $num_rics $uuid $start_id $serv $type $transient $noti $template $count $pids $i $httpproxy $policy_ids_file_path >"./tmp/.pid${i}.txt"
1431 done | xargs -n 1 -I{} -P $pids bash -c '{
1433 echo " Parallel process $arg started"
1434 tmp=$(< "./tmp/.pid${arg}.txt")
1435 python3 ../common/update_policies_process.py $tmp > ./tmp/.pid${arg}.res.txt
1438 for ((i = 1; i <= $pids; i++)); do
1439 file="./tmp/.pid${i}.res.txt"
1441 if [ -z "$tmp" ]; then
1442 echo " Process $i : unknown result (result file empty"
1446 if [ $res == "0" ]; then
1447 echo " Process $i : OK - "${tmp:1}
1449 echo " Process $i : failed - "${tmp:1}
1454 if [ -z $msg ]; then
1455 __collect_endpoint_stats "A1PMS" 02 "POST" $A1PMS_API_PREFIX"/v1/policies" $resp_code $(($count * $num_rics))
1456 __log_test_pass " $(($count * $num_rics)) policy request(s) executed"
1459 __log_test_fail_general "One of more processes failed to execute"
1463 # API Test function: DELETE /policy and V2 DELETE /v2/policies/{policy_id}
1464 # args: <response-code> <policy-id> [count]
1465 # (Function for test scripts)
1466 a1pms_api_delete_policy() {
1469 if [ $# -lt 2 ] || [ $# -gt 3 ]; then
1470 __print_err "<response-code> <policy-id> [count]" $@
1477 if [ $# -eq 3 ]; then
1483 while [ $count -lt $max ]; do
1484 if [ "$A1PMS_VERSION" == "V2" ]; then
1485 query="/v2/policies/"$UUID$pid
1487 query="/policy?id="$UUID$pid
1489 res="$(__do_curl_to_api A1PMS DELETE $query)"
1490 status=${res:${#res}-3}
1491 echo -ne " Executing "$count"("$max")${SAMELINE}"
1493 if [ $status -ne $1 ]; then
1494 echo " Executed "$count"?("$max")"
1495 __log_test_fail_status_code $1 $status
1501 echo -ne " Executed "$count"("$max")${SAMELINE}"
1503 __collect_endpoint_stats "A1PMS" 03 "DELETE" $A1PMS_API_PREFIX"/v2/policies/{policy_id}" $status $max
1510 # API Test function: DELETE /policy and V2 DELETE /v2/policies/{policy_id}, to run in batch
1511 # args: <response-code> <policy-id> [count]
1512 # (Function for test scripts)
1513 a1pms_api_delete_policy_batch() {
1516 if [ $# -lt 2 ] || [ $# -gt 3 ]; then
1517 __print_err "<response-code> <policy-id> [count]" $@
1524 if [ $# -eq 3 ]; then
1530 while [ $count -lt $max ]; do
1531 if [ "$A1PMS_VERSION" == "V2" ]; then
1532 query="/v2/policies/"$UUID$pid
1534 query="/policy?id="$UUID$pid
1536 res="$(__do_curl_to_api A1PMS DELETE_BATCH $query)"
1537 status=${res:${#res}-3}
1538 echo -ne " Requesting(batch) "$count"("$max")${SAMELINE}"
1540 if [ $status -ne 200 ]; then
1541 echo " Requested(batch) "$count"?("$max")"
1542 __log_test_fail_status_code 200 $status
1545 cid=${res:0:${#res}-3}
1549 echo -ne " Requested(batch) "$count"("$max")${SAMELINE}"
1557 res="$(__do_curl_to_api A1PMS RESPONSE $cid)"
1558 status=${res:${#res}-3}
1559 echo -ne " Deleting(batch) "$count"("$max")${SAMELINE}"
1561 if [ $status -ne $1 ]; then
1562 echo " Deleted(batch) "$count"?("$max")"
1563 __log_test_fail_status_code $1 $status
1568 echo -ne " Deleted(batch) "$count"("$max")${SAMELINE}"
1570 __collect_endpoint_stats "A1PMS" 03 "DELETE" $A1PMS_API_PREFIX"/v2/policies/{policy_id}" $1 $max
1578 # API Test function: DELETE /policy and V2 DELETE /v2/policies/{policy_id}, to run in i parallel for a number of rics
1579 # args: <response-code> <number-of-rics> <policy-start-id> <count-per-ric> <number-of-threads>
1580 # (Function for test scripts)
1581 a1pms_api_delete_policy_parallel() {
1584 if [ $# -ne 5 ]; then
1585 __print_err " <response-code> <ric-id-base> <number-of-rics> <policy-start-id> <count-per-ric> <number-of-threads>" $@
1599 #if [ $A1PMS_ADAPTER != $RESTBASE ] && [ $A1PMS_ADAPTER != $RESTBASE_SECURE ]; then
1600 if [ $A1PMS_ADAPTER_TYPE != "REST" ]; then
1601 echo " Info - a1pms_api_delete_policy_parallel uses only the a1pms REST interface - delete over dmaap in parallel is not supported"
1602 echo " Info - will execute over a1pms REST"
1605 if [ "$A1PMS_VERSION" == "V2" ]; then
1606 query="$A1PMS_API_PREFIX/v2/policies/"
1611 urlbase=${A1PMS_ADAPTER}${query}
1614 if [ ! -z "$KUBE_PROXY_PATH" ]; then
1615 httpproxy=$KUBE_PROXY_PATH
1618 for ((i = 1; i <= $pids; i++)); do
1620 if [ -z "$uuid" ]; then
1623 echo "" >"./tmp/.pid${i}.del.res.txt"
1624 echo $resp_code $urlbase $num_rics $uuid $start_id $count $pids $i $httpproxy >"./tmp/.pid${i}.del.txt"
1626 done | xargs -n 1 -I{} -P $pids bash -c '{
1628 echo " Parallel process $arg started"
1629 tmp=$(< "./tmp/.pid${arg}.del.txt")
1630 python3 ../common/delete_policies_process.py $tmp > ./tmp/.pid${arg}.del.res.txt
1633 for ((i = 1; i <= $pids; i++)); do
1634 file="./tmp/.pid${i}.del.res.txt"
1636 if [ -z "$tmp" ]; then
1637 echo " Process $i : unknown result (result file empty"
1641 if [ $res == "0" ]; then
1642 echo " Process $i : OK - "${tmp:1}
1644 echo " Process $i : failed - "${tmp:1}
1649 if [ -z $msg ]; then
1650 __collect_endpoint_stats "A1PMS" 03 "DELETE" $A1PMS_API_PREFIX"/v2/policies/{policy_id}" $resp_code $(($count * $num_rics))
1651 __log_test_pass " $(($count * $num_rics)) policy request(s) executed"
1655 __log_test_fail_general "One of more processes failed to execute"
1659 # API Test function: V3 DELETE a1policymanagement/v1/policies/{policy_id}, to run in i parallel for a number of rics
1660 # args: <responseCode> <numberOfRics> <PolicyIdsFilePath> <countPerRic> <numberOfThreads>
1661 # (Function for test scripts)
1662 a1pms_api_delete_policy_parallel_v3() {
1665 if [ $# -ne 6 ]; then
1666 __print_err " <responseCode> <numberOfRics> <PolicyIdsFilePath> <StartID> <countPerRic> <numberOfThreads>" $@
1673 policy_ids_file_path=$1
1682 #if [ $A1PMS_ADAPTER != $RESTBASE ] && [ $A1PMS_ADAPTER != $RESTBASE_SECURE ]; then
1683 if [ $A1PMS_ADAPTER_TYPE != "REST" ]; then
1684 echo " Info - a1pms_api_delete_policy_parallel uses only the a1pms REST interface - delete over dmaap in parallel is not supported"
1685 echo " Info - will execute over a1pms REST"
1688 query="$A1PMS_API_PREFIX/v1/policies/"
1689 urlbase=${A1PMS_ADAPTER}${query}
1691 urlbase=${A1PMS_ADAPTER}${query}
1694 if [ ! -z "$KUBE_PROXY_PATH" ]; then
1695 httpproxy=$KUBE_PROXY_PATH
1698 for ((i = 1; i <= $pids; i++)); do
1699 echo "" >"./tmp/.pid${i}.del.res.txt"
1700 echo $resp_code $urlbase $policy_ids_file_path $start_id $pids $i $httpproxy >"./tmp/.pid${i}.del.txt"
1702 done | xargs -n 1 -I{} -P $pids bash -c '{
1704 echo " Parallel process $arg started"
1705 tmp=$(< "./tmp/.pid${arg}.del.txt")
1706 python3 ../common/delete_policies_process_v3.py $tmp > ./tmp/.pid${arg}.del.res.txt
1709 for ((i = 1; i <= $pids; i++)); do
1710 file="./tmp/.pid${i}.del.res.txt"
1712 if [ -z "$tmp" ]; then
1713 echo " Process $i : unknown result (result file empty"
1717 if [ $res == "0" ]; then
1718 echo " Process $i : OK - "${tmp:1}
1720 echo " Process $i : failed - "${tmp:1}
1725 if [ -z $msg ]; then
1726 __collect_endpoint_stats "A1PMS" 03 "DELETE" $A1PMS_API_PREFIX"/v1/policies/{policy_id}" $resp_code $(($count * $num_rics))
1727 __log_test_pass " $(($count * $num_rics)) policy request(s) executed"
1731 __log_test_fail_general "One of more processes failed to execute"
1735 # API Test function: GET /policy and V2 GET /v2/policies/{policy_id}, to run in i parallel for a number of rics
1736 # args: <response-code> <number-of-rics> <policy-start-id> <count-per-ric> <number-of-threads>
1737 # (Function for test scripts)
1738 a1pms_api_get_policy_parallel() {
1741 if [ $# -ne 5 ]; then
1742 __print_err " <response-code> <ric-id-base> <number-of-rics> <policy-start-id> <count-per-ric> <number-of-threads>" $@
1756 #if [ $A1PMS_ADAPTER != $RESTBASE ] && [ $A1PMS_ADAPTER != $RESTBASE_SECURE ]; then
1757 if [ $A1PMS_ADAPTER_TYPE != "REST" ]; then
1758 echo " Info - a1pms_api_get_policy_parallel uses only the a1pms REST interface - GET over dmaap in parallel is not supported"
1759 echo " Info - will execute over a1pms REST"
1762 if [ "$A1PMS_VERSION" == "V2" ]; then
1763 query="$A1PMS_API_PREFIX/v2/policies/"
1768 urlbase=${A1PMS_ADAPTER}${query}
1771 if [ ! -z "$KUBE_PROXY_PATH" ]; then
1772 httpproxy=$KUBE_PROXY_PATH
1775 for ((i = 1; i <= $pids; i++)); do
1777 if [ -z "$uuid" ]; then
1780 echo "" >"./tmp/.pid${i}.get.res.txt"
1781 echo $resp_code $urlbase $num_rics $uuid $start_id $count $pids $i $httpproxy >"./tmp/.pid${i}.get.txt"
1783 done | xargs -n 1 -I{} -P $pids bash -c '{
1785 echo " Parallel process $arg started"
1786 tmp=$(< "./tmp/.pid${arg}.get.txt")
1787 python3 ../common/get_policies_process.py $tmp > ./tmp/.pid${arg}.get.res.txt
1790 for ((i = 1; i <= $pids; i++)); do
1791 file="./tmp/.pid${i}.get.res.txt"
1793 if [ -z "$tmp" ]; then
1794 echo " Process $i : unknown result (result file empty"
1798 if [ $res == "0" ]; then
1799 echo " Process $i : OK - "${tmp:1}
1801 echo " Process $i : failed - "${tmp:1}
1806 if [ -z $msg ]; then
1807 __collect_endpoint_stats "A1PMS" 04 "GET" $A1PMS_API_PREFIX"/v2/policies/{policy_id}" $resp_code $(($count * $num_rics))
1808 __log_test_pass " $(($count * $num_rics)) policy request(s) executed"
1812 __log_test_fail_general "One of more processes failed to execute"
1816 # API Test function: V3 GET a1policymanagement/v1/policies/{policy_id}, to run in i parallel for a number of rics
1817 # args: <response-code> <number-of-rics> <policy-start-id> <count-per-ric> <number-of-threads>
1818 # (Function for test scripts)
1819 a1pms_api_get_policy_parallel_v3() {
1822 if [ $# -ne 6 ]; then
1823 __print_err " <responseCode> <numberOfRics> <PolicyIdsFilePath> <startID> <countPerRic> <numberOfThreads>" $@
1830 policy_ids_file_path=$1
1839 #if [ $A1PMS_ADAPTER != $RESTBASE ] && [ $A1PMS_ADAPTER != $RESTBASE_SECURE ]; then
1840 if [ $A1PMS_ADAPTER_TYPE != "REST" ]; then
1841 echo " Info - a1pms_api_get_policy_parallel uses only the a1pms REST interface - GET over dmaap in parallel is not supported"
1842 echo " Info - will execute over a1pms REST"
1845 query="$A1PMS_API_PREFIX/v1/policies/"
1846 urlbase=${A1PMS_ADAPTER}${query}
1849 if [ ! -z "$KUBE_PROXY_PATH" ]; then
1850 httpproxy=$KUBE_PROXY_PATH
1853 for ((i = 1; i <= $pids; i++)); do
1854 echo "" >"./tmp/.pid${i}.get.res.txt"
1855 echo $resp_code $urlbase $policy_ids_file_path $start_id $pids $i $httpproxy >"./tmp/.pid${i}.get.txt"
1857 done | xargs -n 1 -I{} -P $pids bash -c '{
1859 echo " Parallel process $arg started"
1860 tmp=$(< "./tmp/.pid${arg}.get.txt")
1861 python3 ../common/get_policies_process_v3.py $tmp > ./tmp/.pid${arg}.get.res.txt
1864 for ((i = 1; i <= $pids; i++)); do
1865 file="./tmp/.pid${i}.get.res.txt"
1867 if [ -z "$tmp" ]; then
1868 echo " Process $i : unknown result (result file empty"
1872 if [ $res == "0" ]; then
1873 echo " Process $i : OK - "${tmp:1}
1875 echo " Process $i : failed - "${tmp:1}
1880 if [ -z $msg ]; then
1881 __collect_endpoint_stats "A1PMS" 04 "GET" $A1PMS_API_PREFIX"/v1/policies/{policyId}" $resp_code $(($count * $num_rics))
1882 __log_test_pass " $(($count * $num_rics)) policy request(s) executed"
1886 __log_test_fail_general "One of more processes failed to execute"
1890 # API Test function: GET /policy_ids and V2 GET /v2/policies
1891 # args: <response-code> <ric-id>|NORIC <service-id>|NOSERVICE <type-id>|NOTYPE ([<policy-instance-id]*|NOID)
1892 # (Function for test scripts)
1893 a1pms_api_get_policy_ids() {
1896 if [ $# -lt 4 ]; then
1897 __print_err "<response-code> <ric-id>|NORIC <service-id>|NOSERVICE <type-id>|NOTYPE ([<policy-instance-id]*|NOID)" $@
1903 if [ "$A1PMS_VERSION" == "V2" ]; then
1904 if [ $2 != "NORIC" ]; then
1905 queryparams="?ric_id="$2
1908 if [ $3 != "NOSERVICE" ]; then
1909 if [ -z $queryparams ]; then
1910 queryparams="?service_id="$3
1912 queryparams=$queryparams"&service_id="$3
1915 if [ $4 != "NOTYPE" ]; then
1916 if [ -z $queryparams ]; then
1917 queryparams="?policytype_id="$4
1919 queryparams=$queryparams"&policytype_id="$4
1923 query="/v2/policies"$queryparams
1925 if [ $2 != "NORIC" ]; then
1926 queryparams="?ric="$2
1929 if [ $3 != "NOSERVICE" ]; then
1930 if [ -z $queryparams ]; then
1931 queryparams="?service="$3
1933 queryparams=$queryparams"&service="$3
1936 if [ $4 != "NOTYPE" ]; then
1937 if [ -z $queryparams ]; then
1938 queryparams="?type="$4
1940 queryparams=$queryparams"&type="$4
1944 query="/policy_ids"$queryparams
1947 res="$(__do_curl_to_api A1PMS GET $query)"
1948 status=${res:${#res}-3}
1950 if [ $status -ne $1 ]; then
1951 __log_test_fail_status_code $1 $status
1955 if [ $# -gt 4 ]; then
1956 body=${res:0:${#res}-3}
1959 for pid in ${@:5}; do
1960 if [ "$targetJson" != "[" ]; then
1961 targetJson=$targetJson","
1963 if [ $pid != "NOID" ]; then
1964 targetJson=$targetJson"\"$UUID$pid\""
1968 targetJson=$targetJson"]"
1969 if [ "$A1PMS_VERSION" == "V2" ]; then
1970 targetJson="{\"policy_ids\": $targetJson}"
1972 echo "TARGET JSON: $targetJson" >>$HTTPLOG
1973 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
1975 if [ $res -ne 0 ]; then
1976 __log_test_fail_body
1981 __collect_endpoint_stats "A1PMS" 04 "GET" $A1PMS_API_PREFIX"/v2/policies" $status
1986 # API Test function: V2 GET /v2/policy-types/{policyTypeId}
1987 # args(V2): <response-code> <policy-type-id> [<schema-file>]
1988 # (Function for test scripts)
1989 a1pms_api_get_policy_type() {
1992 if [ "$A1PMS_VERSION" != "V2" ]; then
1993 __log_test_fail_not_supported
1997 if [ $# -lt 2 ] || [ $# -gt 3 ]; then
1998 __print_err "<response-code> <policy-type-id> [<schema-file>]" $@
2001 query="/v2/policy-types/$2"
2003 res="$(__do_curl_to_api A1PMS GET $query)"
2004 status=${res:${#res}-3}
2006 if [ $status -ne $1 ]; then
2007 __log_test_fail_status_code $1 $status
2011 if [ $# -eq 3 ]; then
2013 body=${res:0:${#res}-3}
2016 targetJson="{\"policy_schema\":$targetJson}"
2017 echo "TARGET JSON: $targetJson" >>$HTTPLOG
2018 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
2020 if [ $res -ne 0 ]; then
2021 __log_test_fail_body
2026 __collect_endpoint_stats "A1PMS" 05 "GET" $A1PMS_API_PREFIX"/v2/policy-types/{policyTypeId}" $status
2031 # API Test function: GET /policy_schema
2032 # args: <response-code> <policy-type-id> [<schema-file>]
2033 # (Function for test scripts)
2034 a1pms_api_get_policy_schema() {
2037 if [ "$A1PMS_VERSION" == "V2" ]; then
2038 __log_test_fail_not_supported
2042 if [ $# -lt 2 ] || [ $# -gt 3 ]; then
2043 __print_err "<response-code> <policy-type-id> [<schema-file>]" $@
2046 query="/policy_schema?id=$2"
2047 res="$(__do_curl_to_api A1PMS GET $query)"
2048 status=${res:${#res}-3}
2050 if [ $status -ne $1 ]; then
2051 __log_test_fail_status_code $1 $status
2055 if [ $# -eq 3 ]; then
2057 body=${res:0:${#res}-3}
2061 echo "TARGET JSON: $targetJson" >>$HTTPLOG
2062 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
2064 if [ $res -ne 0 ]; then
2065 __log_test_fail_body
2070 __collect_endpoint_stats "A1PMS" 06 "GET" $A1PMS_API_PREFIX"/v2/policy_schema" $status
2075 # API Test function: GET /policy_schemas
2076 # args: <response-code> <ric-id>|NORIC [<schema-file>|NOFILE]*
2077 # args(V2): <response-code>
2078 # (Function for test scripts)
2079 a1pms_api_get_policy_schemas() {
2082 if [ "$A1PMS_VERSION" == "V2" ]; then
2083 if [ $# -ne 1 ]; then
2084 __print_err "<response-code>" $@
2088 if [ $# -lt 2 ]; then
2089 __print_err "<response-code> <ric-id>|NORIC [<schema-file>|NOFILE]*" $@
2093 if [ "$A1PMS_VERSION" == "V2" ]; then
2094 query="/v2/policy-schemas"
2096 query="/policy_schemas"
2097 if [ $2 != "NORIC" ]; then
2098 query=$query"?ric="$2
2102 res="$(__do_curl_to_api A1PMS GET $query)"
2103 status=${res:${#res}-3}
2105 if [ $status -ne $1 ]; then
2106 __log_test_fail_status_code $1 $status
2110 if [ $# -gt 2 ]; then
2111 body=${res:0:${#res}-3}
2114 for file in ${@:3}; do
2115 if [ "$targetJson" != "[" ]; then
2116 targetJson=$targetJson","
2118 if [ $file == "NOFILE" ]; then
2119 targetJson=$targetJson"{}"
2121 targetJson=$targetJson$(<$file)
2125 targetJson=$targetJson"]"
2126 if [ "$A1PMS_VERSION" == "V2" ]; then
2127 targetJson="{\"policy_schemas\": $targetJson }"
2129 echo "TARGET JSON: $targetJson" >>$HTTPLOG
2130 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
2132 if [ $res -ne 0 ]; then
2133 __log_test_fail_body
2138 __collect_endpoint_stats "A1PMS" 07 "GET" $A1PMS_API_PREFIX"/v2/policy-schemas" $status
2143 # API Test function: GET /policy_status and V2 GET /policies/{policy_id}/status
2144 # arg: <response-code> <policy-id> [ (STD|STD2 <enforce-status>|EMPTY [<reason>|EMPTY])|(OSC <instance-status> <has-been-deleted>) ]
2145 # (Function for test scripts)
2146 a1pms_api_get_policy_status() {
2149 if [ $# -lt 2 ] || [ $# -gt 5 ]; then
2150 __print_err "<response-code> <policy-id> [(STD <enforce-status>|EMPTY [<reason>|EMPTY])|(OSC <instance-status> <has-been-deleted>)]" $@
2155 if [ $# -eq 2 ]; then
2157 elif [ "$3" == "STD" ]; then
2158 targetJson="{\"enforceStatus\":\"$4\""
2159 if [ $# -eq 5 ]; then
2160 targetJson=$targetJson",\"reason\":\"$5\""
2162 targetJson=$targetJson"}"
2163 elif [ "$3" == "STD2" ]; then
2164 if [ $4 == "EMPTY" ]; then
2165 targetJson="{\"enforceStatus\":\"\""
2167 targetJson="{\"enforceStatus\":\"$4\""
2169 if [ $# -eq 5 ]; then
2170 if [ $5 == "EMPTY" ]; then
2171 targetJson=$targetJson",\"enforceReason\":\"\""
2173 targetJson=$targetJson",\"enforceReason\":\"$5\""
2176 targetJson=$targetJson"}"
2177 elif [ "$3" == "OSC" ]; then
2178 if [[ $TEST_ENV_PROFILE =~ ^ORAN-[A-H] ]] || [[ $TEST_ENV_PROFILE =~ ^ONAP-[A-L] ]]; then
2179 targetJson="{\"instance_status\":\"$4\""
2180 if [ $# -eq 5 ]; then
2181 targetJson=$targetJson",\"has_been_deleted\":\"$5\""
2183 targetJson=$targetJson",\"created_at\":\"????\"}"
2185 targetJson="{\"enforceStatus\":\"$4\""
2186 if [ $# -eq 5 ]; then
2187 targetJson=$targetJson",\"enforceReason\":\"$5\"}"
2191 __print_err "<response-code> (STD <enforce-status> [<reason>])|(OSC <instance-status> <has-been-deleted>)" $@
2195 if [ "$A1PMS_VERSION" == "V2" ]; then
2196 query="/v2/policies/$UUID$2/status"
2197 targetJson="{\"last_modified\":\"????\",\"status\":$targetJson}"
2199 query="/policy_status?id="$UUID$2
2202 res="$(__do_curl_to_api A1PMS GET $query)"
2203 status=${res:${#res}-3}
2205 if [ $status -ne $1 ]; then
2206 __log_test_fail_status_code $1 $status
2209 if [ $# -gt 2 ]; then
2210 echo "TARGET JSON: $targetJson" >>$HTTPLOG
2211 body=${res:0:${#res}-3}
2212 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
2214 if [ $res -ne 0 ]; then
2215 __log_test_fail_body
2219 __collect_endpoint_stats "A1PMS" 08 "GET" $A1PMS_API_PREFIX"/v2/policies/{policy_id}/status" $status
2224 # API Test function: GET /policy_types and V2 GET /v2/policy-types
2225 # args: <response-code> [<ric-id>|NORIC [<policy-type-id>|EMPTY [<policy-type-id>]*]]
2226 # (Function for test scripts)
2227 a1pms_api_get_policy_types() {
2230 if [ $# -lt 1 ]; then
2231 __print_err "<response-code> [<ric-id>|NORIC [<policy-type-id>|EMPTY [<policy-type-id>]*]]" $@
2235 if [ "$A1PMS_VERSION" == "V2" ]; then
2236 if [ $# -eq 1 ]; then
2237 query="/v2/policy-types"
2238 elif [ $2 == "NORIC" ]; then
2239 query="/v2/policy-types"
2241 query="/v2/policy-types?ric_id=$2"
2244 if [ $# -eq 1 ]; then
2245 query="/policy_types"
2246 elif [ $2 == "NORIC" ]; then
2247 query="/policy_types"
2249 query="/policy_types?ric=$2"
2253 res="$(__do_curl_to_api A1PMS GET $query)"
2254 status=${res:${#res}-3}
2256 if [ $status -ne $1 ]; then
2257 __log_test_fail_status_code $1 $status
2261 if [ $# -gt 2 ]; then
2262 body=${res:0:${#res}-3}
2265 for pid in ${@:3}; do
2266 if [ "$targetJson" != "[" ]; then
2267 targetJson=$targetJson","
2269 if [ $pid == "EMPTY" ]; then
2272 targetJson=$targetJson"\"$pid\""
2275 targetJson=$targetJson"]"
2276 if [ "$A1PMS_VERSION" == "V2" ]; then
2277 targetJson="{\"policytype_ids\": $targetJson }"
2279 echo "TARGET JSON: $targetJson" >>$HTTPLOG
2280 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
2282 if [ $res -ne 0 ]; then
2283 __log_test_fail_body
2288 __collect_endpoint_stats "A1PMS" 09 "GET" $A1PMS_API_PREFIX"/v2/policy-types" $status
2293 #########################################################
2294 #### Test case functions Health check
2295 #########################################################
2297 # API Test function: GET /status and V2 GET /status or (v1/status for a1pmsV3)
2298 # args: <response-code>
2299 # (Function for test scripts)
2300 a1pms_api_get_status() {
2302 if [ $# -ne 1 ]; then
2303 __print_err "<response-code>" $@
2307 if [ "$A1PMS_VERSION" == "V2" ]; then
2309 elif [ "$A1PMS_VERSION" == "V3" ]; then
2315 res="$(__do_curl_to_api A1PMS GET $query)"
2316 status=${res:${#res}-3}
2318 if [ $status -ne $1 ]; then
2319 __log_test_fail_status_code $1 $status
2323 __collect_endpoint_stats "A1PMS" 10 "GET" ${A1PMS_API_PREFIX}${query} ${status}
2328 # API Test function: GET /status (root) without api prefix
2329 # args: <response-code>
2330 # (Function for test scripts)
2331 a1pms_api_get_status_root() {
2333 if [ $# -ne 1 ]; then
2334 __print_err "<response-code>" $@
2338 TMP_PREFIX=$A1PMS_API_PREFIX
2340 res="$(__do_curl_to_api A1PMS GET $query)"
2341 A1PMS_API_PREFIX=$TMP_PREFIX
2342 status=${res:${#res}-3}
2344 if [ $status -ne $1 ]; then
2345 __log_test_fail_status_code $1 $status
2349 __collect_endpoint_stats "A1PMS" 19 "GET" "/status" $status
2354 #########################################################
2355 #### Test case functions RIC Repository
2356 #########################################################
2358 # API Test function: GET /ric and V2 GET /v2/rics/ric
2359 # args: <reponse-code> <management-element-id> [<ric-id>]
2360 # (V2) args: <reponse-code> <management-element-id>|NOME <ric-id>|<NORIC> [<string-of-ricinfo>]
2361 # (V2) example of <string-of-ricinfo> = "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2,4"
2362 # (V2) format of ric-info: <ric-id>:<list-of-mes>:<list-of-policy-type-ids>
2364 # (Function for test scripts)
2365 a1pms_api_get_ric() {
2368 if [ "$A1PMS_VERSION" == "V2" ]; then
2369 if [ $# -lt 3 ]; then
2370 __print_err "<reponse-code> <management-element-id>|NOME <ric-id>|<NORIC> [string-of-ricinfo>]" $@
2374 if [ $2 != "NOME" ]; then
2375 search="?managed_element_id="$2
2377 if [ $3 != "NORIC" ]; then
2378 if [ -z $search ]; then
2381 search=$search"&ric_id="$3
2384 query="/v2/rics/ric"$search
2386 res="$(__do_curl_to_api A1PMS GET $query)"
2387 status=${res:${#res}-3}
2389 if [ $status -ne $1 ]; then
2390 __log_test_fail_status_code $1 $status
2394 if [ $# -gt 3 ]; then
2395 body=${res:0:${#res}-3}
2396 res=$(python3 ../common/create_rics_json.py "./tmp/.tmp_rics.json" "V2" "$4")
2397 if [ $res -ne 0 ]; then
2398 __log_test_fail_general "Could not create target ric info json"
2402 targetJson=$(<./tmp/.tmp_rics.json)
2403 targetJson=${targetJson:1:${#targetJson}-2} #remove array brackets
2404 echo " TARGET JSON: $targetJson" >>$HTTPLOG
2405 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
2406 if [ $res -ne 0 ]; then
2407 __log_test_fail_body
2412 if [ $# -lt 2 ] || [ $# -gt 3 ]; then
2413 __print_err "<reponse-code> <management-element-id> [<ric-id>]" $@
2417 query="/ric?managedElementId="$2
2419 res="$(__do_curl_to_api A1PMS GET $query)"
2420 status=${res:${#res}-3}
2422 if [ $status -ne $1 ]; then
2423 __log_test_fail_status_code $1 $status
2427 if [ $# -eq 3 ]; then
2428 body=${res:0:${#res}-3}
2429 if [ "$body" != "$3" ]; then
2430 __log_test_fail_body
2436 __collect_endpoint_stats "A1PMS" 11 "GET" $A1PMS_API_PREFIX"/v2/rics/ric" $status
2441 # API test function: GET /rics and V2 GET /v2/rics
2442 # args: <reponse-code> <policy-type-id>|NOTYPE [<space-separate-string-of-ricinfo>]
2443 # example of <space-separate-string-of-ricinfo> = "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2,4 ricsim_g1_1:me2_........."
2444 # format of ric-info: <ric-id>:<list-of-mes>:<list-of-policy-type-ids>
2445 # (Function for test scripts)
2446 a1pms_api_get_rics() {
2449 if [ $# -lt 2 ]; then
2450 __print_err "<reponse-code> <policy-type-id>|NOTYPE [<space-separate-string-of-ricinfo>]" $@
2454 if [ "$A1PMS_VERSION" == "V2" ]; then
2456 if [ $2 != "NOTYPE" ]; then
2457 query="/v2/rics?policytype_id="$2
2461 if [ $2 != "NOTYPE" ]; then
2462 query="/rics?policyType="$2
2466 res="$(__do_curl_to_api A1PMS GET $query)"
2467 status=${res:${#res}-3}
2469 if [ $status -ne $1 ]; then
2470 __log_test_fail_status_code $1 $status
2474 if [ $# -gt 2 ]; then
2475 body=${res:0:${#res}-3}
2476 if [ "$A1PMS_VERSION" == "V2" ]; then
2477 res=$(python3 ../common/create_rics_json.py "./tmp/.tmp_rics.json" "V2" "$3")
2479 res=$(python3 ../common/create_rics_json.py "./tmp/.tmp_rics.json" "V1" "$3")
2481 if [ $res -ne 0 ]; then
2482 __log_test_fail_general "Could not create target ric info json"
2486 targetJson=$(<./tmp/.tmp_rics.json)
2487 if [ "$A1PMS_VERSION" == "V2" ]; then
2488 targetJson="{\"rics\": $targetJson }"
2490 echo "TARGET JSON: $targetJson" >>$HTTPLOG
2491 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
2492 if [ $res -ne 0 ]; then
2493 __log_test_fail_body
2498 __collect_endpoint_stats "A1PMS" 12 "GET" $A1PMS_API_PREFIX"/v2/rics" $status
2503 ##################################################################
2504 #### API Test case functions Service registry and supervision ####
2505 ##################################################################
2507 # API test function: PUT /service and V2 PUT /service
2508 # args: <response-code> <service-name> <keepalive-timeout> <callbackurl>
2509 # (Function for test scripts)
2510 a1pms_api_put_service() {
2512 if [ $# -ne 4 ]; then
2513 __print_err "<response-code> <service-name> <keepalive-timeout> <callbackurl>" $@
2517 if [ "$A1PMS_VERSION" == "V2" ]; then
2518 query="/v2/services"
2519 json="{\"callback_url\": \""$4"\",\"keep_alive_interval_seconds\": \""$3"\",\"service_id\": \""$2"\"}"
2520 elif [ "$A1PMS_VERSION" == "V3" ]; then
2521 query="/v1/services"
2522 json="{\"callbackUrl\": \""$4"\",\"keepAliveIntervalSeconds\": \""$3"\",\"serviceId\": \""$2"\"}"
2525 json="{\"callbackUrl\": \""$4"\",\"keepAliveIntervalSeconds\": \""$3"\",\"serviceName\": \""$2"\"}"
2527 file="./tmp/.tmp.json"
2530 res="$(__do_curl_to_api A1PMS PUT $query $file)"
2531 status=${res:${#res}-3}
2533 if [ $status -ne $1 ]; then
2534 __log_test_fail_status_code $1 $status
2538 __collect_endpoint_stats "A1PMS" 13 "PUT" ${A1PMS_API_PREFIX}${query} ${status}
2543 # API test function: GET /services and V2 GET /v2/services
2544 #args: <response-code> [ (<query-service-name> <target-service-name> <keepalive-timeout> <callbackurl>) | (NOSERVICE <target-service-name> <keepalive-timeout> <callbackurl> [<target-service-name> <keepalive-timeout> <callbackurl>]* )]
2545 # (Function for test scripts)
2546 a1pms_api_get_services() {
2548 #Number of accepted parameters: 1, 2, 4, 7, 10, 13,...
2550 if [ $# -eq 1 ]; then
2552 elif [ $# -eq 2 ] && [ $2 != "NOSERVICE" ]; then
2554 elif [ $# -eq 5 ]; then
2556 elif [ $# -gt 5 ] && [ $2 == "NOSERVICE" ]; then
2558 if [ $(($argLen % 3)) -eq 0 ]; then
2563 if [ $paramError -ne 0 ]; then
2564 __print_err "<response-code> [ (<query-service-name> <target-service-name> <keepalive-timeout> <callbackurl>) | (NOSERVICE <target-service-name> <keepalive-timeout> <callbackurl> [<target-service-name> <keepalive-timeout> <callbackurl>]* )]" $@
2568 if [ "$A1PMS_VERSION" == "V2" ]; then
2569 query="/v2/services"
2571 if [ $# -gt 1 ] && [ $2 != "NOSERVICE" ]; then
2572 query="/v2/services?service_id="$2
2577 if [ $# -gt 1 ] && [ $2 != "NOSERVICE" ]; then
2578 query="/services?name="$2
2581 res="$(__do_curl_to_api A1PMS GET $query)"
2582 status=${res:${#res}-3}
2584 if [ $status -ne $1 ]; then
2585 __log_test_fail_status_code $1 $status
2589 if [ $# -gt 2 ]; then
2590 variableArgCount=$(($# - 2))
2591 body=${res:0:${#res}-3}
2596 while [ $cntr -lt $variableArgCount ]; do
2603 if [ $cntr -gt 0 ]; then
2604 targetJson=$targetJson","
2606 # timeSinceLastActivitySeconds value cannot be checked since value varies
2607 if [ "$A1PMS_VERSION" == "V2" ]; then
2608 targetJson=$targetJson"{\"service_id\": \""$servicename"\",\"keep_alive_interval_seconds\": "$timeout",\"time_since_last_activity_seconds\":\"????\",\"callback_url\": \""$callback"\"}"
2610 targetJson=$targetJson"{\"serviceName\": \""$servicename"\",\"keepAliveIntervalSeconds\": "$timeout",\"timeSinceLastActivitySeconds\":\"????\",\"callbackUrl\": \""$callback"\"}"
2614 targetJson=$targetJson"]"
2615 if [ "$A1PMS_VERSION" == "V2" ]; then
2616 targetJson="{\"service_list\": $targetJson }"
2618 echo "TARGET JSON: $targetJson" >>$HTTPLOG
2619 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
2620 if [ $res -ne 0 ]; then
2621 __log_test_fail_body
2626 __collect_endpoint_stats "A1PMS" 14 "GET" $A1PMS_API_PREFIX"/v2/services" $status
2631 # API test function: GET /services V2 GET /v2/services - (only checking service names)
2632 # args: <response-code> [<service-name>]*"
2633 # (Function for test scripts)
2634 a1pms_api_get_service_ids() {
2637 if [ $# -lt 1 ]; then
2638 __print_err "<response-code> [<service-name>]*" $@
2642 if [ "$A1PMS_VERSION" == "V2" ]; then
2643 query="/v2/services"
2647 res="$(__do_curl_to_api A1PMS GET $query)"
2648 status=${res:${#res}-3}
2650 if [ $status -ne $1 ]; then
2651 __log_test_fail_status_code $1 $status
2655 body=${res:0:${#res}-3}
2657 for rapp in ${@:2}; do
2658 if [ "$targetJson" != "[" ]; then
2659 targetJson=$targetJson","
2661 if [ "$A1PMS_VERSION" == "V2" ]; then
2662 targetJson=$targetJson"{\"callback_url\":\"????\",\"keep_alive_interval_seconds\":\"????\",\"service_id\":\""$rapp"\",\"time_since_last_activity_seconds\":\"????\"}"
2664 targetJson=$targetJson"{\"callbackUrl\":\"????\",\"keepAliveIntervalSeconds\":\"????\",\"serviceName\":\""$rapp"\",\"timeSinceLastActivitySeconds\":\"????\"}"
2668 targetJson=$targetJson"]"
2669 if [ "$A1PMS_VERSION" == "V2" ]; then
2670 targetJson="{\"service_list\": $targetJson }"
2672 echo "TARGET JSON: $targetJson" >>$HTTPLOG
2673 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
2675 if [ $res -ne 0 ]; then
2676 __log_test_fail_body
2680 __collect_endpoint_stats "A1PMS" 14 "GET" $A1PMS_API_PREFIX"/v2/services" $status
2685 # API test function: DELETE /services and V2 DELETE /v2/services/{serviceId}
2686 # args: <response-code> <service-name>
2687 # (Function for test scripts)
2688 a1pms_api_delete_services() {
2691 if [ $# -ne 2 ]; then
2692 __print_err "<response-code> <service-name>" $@
2695 if [ "$A1PMS_VERSION" == "V2" ]; then
2696 query="/v2/services/"$2
2698 query="/services?name="$2
2700 res="$(__do_curl_to_api A1PMS DELETE $query)"
2701 status=${res:${#res}-3}
2703 if [ $status -ne $1 ]; then
2704 __log_test_fail_status_code $1 $status
2708 __collect_endpoint_stats "A1PMS" 15 "DELETE" $A1PMS_API_PREFIX"/v2/services/{serviceId}" $status
2713 # API test function: PUT /services/keepalive and V2 PUT /v2/services/{service_id}/keepalive
2714 # args: <response-code> <service-name>
2715 # (Function for test scripts)
2716 a1pms_api_put_services_keepalive() {
2719 if [ $# -ne 2 ]; then
2720 __print_err "<response-code> <service-name>" $@
2723 if [ "$A1PMS_VERSION" == "V2" ]; then
2724 query="/v2/services/$2/keepalive"
2726 query="/services/keepalive?name="$2
2729 res="$(__do_curl_to_api A1PMS PUT $query)"
2730 status=${res:${#res}-3}
2732 if [ $status -ne $1 ]; then
2733 __log_test_fail_status_code $1 $status
2737 __collect_endpoint_stats "A1PMS" 16 "PUT" $A1PMS_API_PREFIX"/v2/services/{service_id}/keepalive" $status
2742 ##################################################################
2743 #### API Test case functions Configuration ####
2744 ##################################################################
2746 # API Test function: PUT "/v2/configuration" or "/v1/configuration"
2747 # args: <response-code> <config-file>
2748 # (Function for test scripts)
2749 a1pms_api_put_configuration() {
2752 if [ "$A1PMS_VERSION" != "V2" ] && [ "$A1PMS_VERSION" != "V3" ]; then
2753 __log_test_fail_not_supported
2757 if [ $# -ne 2 ]; then
2758 __print_err "<response-code> <config-file>" $@
2761 if [ ! -f $2 ]; then
2762 __log_test_fail_general "Config file "$2", does not exist"
2766 # if [ $RUNMODE == "DOCKER" ]; then #In kube the file already has a header
2767 # inputJson="{\"config\":"$inputJson"}"
2769 file="./tmp/.config.json"
2770 echo $inputJson >$file
2771 if [ "$A1PMS_VERSION" == "V2" ]; then
2772 query="/v2/configuration"
2773 elif [ "$A1PMS_VERSION" == "V3" ]; then
2774 #V3 has baseurl changes 'a1-policy/v2' to 'a1policymanagement/v1'
2775 query="/v1/configuration"
2777 res="$(__do_curl_to_api A1PMS PUT $query $file)"
2778 status=${res:${#res}-3}
2780 if [ $status -ne $1 ]; then
2781 __log_test_fail_status_code $1 $status
2785 __collect_endpoint_stats "A1PMS" 17 "PUT" ${A1PMS_API_PREFIX}${query} ${status}
2790 # API Test function: GET /v2/configuration
2791 # args: <response-code> [<config-file>]
2792 # (Function for test scripts)
2793 a1pms_api_get_configuration() {
2796 if [ "$A1PMS_VERSION" != "V2" ]; then
2797 __log_test_fail_not_supported
2801 if [ $# -lt 1 ] || [ $# -gt 2 ]; then
2802 __print_err "<response-code> [<config-file>]" $@
2805 if [ ! -f $2 ]; then
2806 __log_test_fail_general "Config file "$2" for comparison, does not exist"
2810 query="/v2/configuration"
2811 res="$(__do_curl_to_api A1PMS GET $query)"
2812 status=${res:${#res}-3}
2814 if [ $status -ne $1 ]; then
2815 __log_test_fail_status_code $1 $status
2819 if [ $# -eq 2 ]; then
2821 body=${res:0:${#res}-3}
2824 # if [ $RUNMODE == "DOCKER" ]; then #In kube the file already has a header
2825 # inputJson="{\"config\":"$inputJson"}"
2827 echo "TARGET JSON: $targetJson" >>$HTTPLOG
2828 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
2830 if [ $res -ne 0 ]; then
2831 __log_test_fail_body
2836 __collect_endpoint_stats "A1PMS" 18 "GET" $A1PMS_API_PREFIX"/v2/configuration" $status
2841 ##########################################
2842 #### Reset types and instances ####
2843 ##########################################
2845 # Admin reset to remove all policies and services
2846 # All types and instances etc are removed - types and instances in a1 sims need to be removed separately
2847 # NOTE - only works in kubernetes and the pod should not be running
2849 # (Function for test scripts)
2851 a1pms_kube_pvc_reset() {
2854 pvc_name=$(kubectl $KUBECONF get pvc -n $KUBE_NONRTRIC_NAMESPACE --no-headers -o custom-columns=":metadata.name" | grep policy)
2855 if [ -z "$pvc_name" ]; then
2856 pvc_name=policymanagementservice-vardata-pvc
2858 echo " Trying to reset pvc: "$pvc_name
2859 __kube_clean_pvc $A1PMS_APP_NAME $KUBE_NONRTRIC_NAMESPACE $pvc_name $A1PMS_CONTAINER_MNT_DIR
2865 # args: <realm> <client-name> <client-secret>
2866 a1pms_configure_sec() {
2867 export A1PMS_CREDS_GRANT_TYPE="client_credentials"
2868 export A1PMS_CREDS_CLIENT_SECRET=$3
2869 export A1PMS_CREDS_CLIENT_ID=$2
2870 export A1PMS_AUTH_SERVICE_URL=$KEYCLOAK_SERVICE_PATH$KEYCLOAK_TOKEN_URL_PREFIX/$1/protocol/openid-connect/token
2871 export A1PMS_SIDECAR_MOUNT="/token-cache"
2872 export A1PMS_SIDECAR_JWT_FILE=$A1PMS_SIDECAR_MOUNT"/jwt.txt"
2874 export AUTHSIDECAR_APP_NAME
2875 export AUTHSIDECAR_DISPLAY_NAME