3 # ============LICENSE_START===============================================
4 # Copyright (C) 2020 Nordix Foundation. All rights reserved.
5 # ========================================================================
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 # ============LICENSE_END=================================================
20 # This is a script that contains container/service management functions and test functions for A1 Controller API
22 ################ Test engine functions ################
24 # Create the image var used during the test
25 # arg: <image-tag-suffix> (selects staging, snapshot, release etc)
26 # <image-tag-suffix> is present only for images with staging, snapshot,release tags
31 for oia_name in $ONAP_IMAGES_APP_NAMES; do
32 if [ "$oia_name" == "SDNC" ]; then
33 sdnc_suffix_tag="REMOTE_RELEASE_ONAP"
36 __check_and_create_image_var SDNC "SDNC_A1_CONTROLLER_IMAGE" "SDNC_A1_CONTROLLER_IMAGE_BASE" "SDNC_A1_CONTROLLER_IMAGE_TAG" $sdnc_suffix_tag "$SDNC_DISPLAY_NAME"
37 __check_and_create_image_var SDNC "SDNC_DB_IMAGE" "SDNC_DB_IMAGE_BASE" "SDNC_DB_IMAGE_TAG" REMOTE_PROXY "SDNC DB"
41 # Pull image from remote repo or use locally built image
42 # arg: <pull-policy-override> <pull-policy-original>
43 # <pull-policy-override> Shall be used for images allowing overriding. For example use a local image when test is started to use released images
44 # <pull-policy-original> Shall be used for images that does not allow overriding
45 # Both var may contain: 'remote', 'remote-remove' or 'local'
47 __check_and_pull_image $1 "$SDNC_DISPLAY_NAME" $SDNC_APP_NAME SDNC_A1_CONTROLLER_IMAGE
48 __check_and_pull_image $2 "SDNC DB" $SDNC_APP_NAME SDNC_DB_IMAGE
51 # Build image (only for simulator or interfaces stubs owned by the test environment)
52 # arg: <image-tag-suffix> (selects staging, snapshot, release etc)
53 # <image-tag-suffix> is present only for images with staging, snapshot,release tags
55 echo -e $RED" Image for app SDNC shall never be built"$ERED
58 # Generate a string for each included image using the app display name and a docker images format string
59 # If a custom image repo is used then also the source image from the local repo is listed
60 # arg: <docker-images-format-string> <file-to-append>
62 echo -e "$SDNC_DISPLAY_NAME\t$(docker images --format $1 $SDNC_A1_CONTROLLER_IMAGE)" >> $2
63 if [ ! -z "$SDNC_A1_CONTROLLER_IMAGE_SOURCE" ]; then
64 echo -e "-- source image --\t$(docker images --format $1 $SDNC_A1_CONTROLLER_IMAGE_SOURCE)" >> $2
66 echo -e "SDNC DB\t$(docker images --format $1 $SDNC_DB_IMAGE)" >> $2
67 if [ ! -z "$SDNC_DB_IMAGE_SOURCE" ]; then
68 echo -e "-- source image --\t$(docker images --format $1 $SDNC_DB_IMAGE_SOURCE)" >> $2
72 # Scale kubernetes resources to zero
73 # All resources shall be ordered to be scaled to 0, if relevant. If not relevant to scale, then do no action.
74 # This function is called for apps fully managed by the test script
75 __SDNC_kube_scale_zero() {
76 __kube_scale_all_resources $KUBE_NONRTRIC_NAMESPACE autotest SDNC
79 # Scale kubernetes resources to zero and wait until this has been accomplished, if relevant. If not relevant to scale, then do no action.
80 # This function is called for prestarted apps not managed by the test script.
81 __SDNC_kube_scale_zero_and_wait() {
82 echo -e " SDNC replicas kept as is"
85 # Delete all kube resouces for the app
86 # This function is called for apps managed by the test script.
87 __SDNC_kube_delete_all() {
88 __kube_delete_all_resources $KUBE_NONRTRIC_NAMESPACE autotest SDNC
92 # This function is called for apps managed by the test script.
93 # args: <log-dir> <file-prexix>
94 __SDNC_store_docker_logs() {
95 docker exec -t $SDNC_APP_NAME cat $SDNC_KARAF_LOG> $1$2_SDNC_karaf.log 2>&1
98 #######################################################
102 SDNC_HOST_NAME=$LOCALHOST_NAME
103 SDNC_PATH=$SDNC_HTTPX"://"$SDNC_HOST_NAME":"$SDNC_EXTERNAL_PORT
104 SDNC_API_PATH=$SDNC_HTTPX"://"$SDNC_USER":"$SDNC_PWD"@"$SDNC_HOST_NAME":"$SDNC_EXTERNAL_PORT$SDNC_API_URL
105 #Docker/Kube internal path
106 if [ $RUNMODE == "KUBE" ]; then
107 SDNC_SERVICE_PATH=$SDNC_HTTPX"://"$SDNC_APP_NAME":"$SDNC_EXTERNAL_PORT
109 SDNC_SERVICE_PATH=$SDNC_HTTPX"://"$SDNC_APP_NAME"."$KUBE_NONRTRIC_NAMESPACE":"$SDNC_EXTERNAL_PORT
111 #SDNC_SERVICE_PATH=$SDNC_HTTPX"://"$SDNC_APP_NAME"."$KUBE_NONRTRIC_NAMESPACE":"$SDNC_EXTERNAL_PORT
113 SDNC_SERVICE_PATH=$SDNC_HTTPX"://"$SDNC_APP_NAME":"$SDNC_INTERNAL_PORT
117 echo -e $BOLD"SDNC NB protocol setting"$EBOLD
118 echo -e " Using $BOLD http $EBOLD towards SDNC"
120 SDNC_PATH=$SDNC_HTTPX"://"$SDNC_HOST_NAME":"$SDNC_EXTERNAL_PORT
121 SDNC_API_PATH=$SDNC_HTTPX"://"$SDNC_USER":"$SDNC_PWD"@"$SDNC_HOST_NAME":"$SDNC_EXTERNAL_PORT$SDNC_API_URL
122 if [ $RUNMODE == "KUBE" ]; then
124 SDNC_SERVICE_PATH=$SDNC_HTTPX"://"$SDNC_APP_NAME"."$KUBE_NONRTRIC_NAMESPACE":"$SDNC_EXTERNAL_PORT
126 #SDNC_SERVICE_PATH=$SDNC_HTTPX"://"$SDNC_APP_NAME":"$SDNC_EXTERNAL_PORT
128 SDNC_SERVICE_PATH=$SDNC_HTTPX"://"$SDNC_APP_NAME":"$SDNC_INTERNAL_PORT
134 echo -e $BOLD"SDNC NB protocol setting"$EBOLD
135 echo -e " Using $BOLD https $EBOLD towards SDNC"
137 SDNC_PATH=$SDNC_HTTPX"://"$SDNC_HOST_NAME":"$SDNC_EXTERNAL_SECURE_PORT
138 SDNC_API_PATH=$SDNC_HTTPX"://"$SDNC_USER":"$SDNC_PWD"@"$SDNC_HOST_NAME":"$SDNC_EXTERNAL_SECURE_PORT$SDNC_API_URL
139 if [ $RUNMODE == "KUBE" ]; then
141 SDNC_SERVICE_PATH=$SDNC_HTTPX"://"$SDNC_APP_NAME"."$KUBE_NONRTRIC_NAMESPACE":"$SDNC_EXTERNAL_SECURE_PORT
143 #SDNC_SERVICE_PATH=$SDNC_HTTPX"://"$SDNC_APP_NAME":"$SDNC_EXTERNAL_SECURE_PORT
145 SDNC_SERVICE_PATH=$SDNC_HTTPX"://"$SDNC_APP_NAME":"$SDNC_INTERNAL_SECURE_PORT
154 # Start the SDNC A1 Controller
156 # (Function for test scripts)
159 echo -e $BOLD"Starting $SDNC_DISPLAY_NAME"$EBOLD
161 if [ $RUNMODE == "KUBE" ]; then
163 # Check if app shall be fully managed by the test script
164 __check_included_image "SDNC"
167 # Check if app shall only be used by the testscipt
168 __check_prestarted_image "SDNC"
171 if [ $retcode_i -ne 0 ] && [ $retcode_p -ne 0 ]; then
172 echo -e $RED"The $SDNC_APP_NAME app is not included as managed nor prestarted in this test script"$ERED
173 echo -e $RED"The $SDNC_APP_NAME will not be started"$ERED
176 if [ $retcode_i -eq 0 ] && [ $retcode_p -eq 0 ]; then
177 echo -e $RED"The $SDNC_APP_NAME app is included both as managed and prestarted in this test script"$ERED
178 echo -e $RED"The $SDNC_APP_NAME will not be started"$ERED
183 if [ $retcode_p -eq 0 ]; then
184 echo -e " Using existing $SDNC_APP_NAME deployment and service"
185 echo " Setting SDNC replicas=1"
186 __kube_scale deployment $SDNC_APP_NAME $KUBE_NONRTRIC_NAMESPACE 1
189 # Check if app shall be fully managed by the test script
190 if [ $retcode_i -eq 0 ]; then
192 echo -e " Creating $SDNC_APP_NAME app and expose service"
194 #Check if nonrtric namespace exists, if not create it
195 __kube_create_namespace $KUBE_NONRTRIC_NAMESPACE
197 export KUBE_NONRTRIC_NAMESPACE
199 export SDNC_A1_CONTROLLER_IMAGE
200 export SDNC_INTERNAL_PORT
201 export SDNC_EXTERNAL_PORT
202 export SDNC_INTERNAL_SECURE_PORT
203 export SDNC_EXTERNAL_SECURE_PORT
204 export SDNC_A1_TRUSTSTORE_PASSWORD
205 export SDNC_DB_APP_NAME
211 input_yaml=$SIM_GROUP"/"$SDNC_COMPOSE_DIR"/"svc.yaml
212 output_yaml=$PWD/tmp/sdnc_svc.yaml
213 __kube_create_instance service $SDNC_APP_NAME $input_yaml $output_yaml
216 input_yaml=$SIM_GROUP"/"$SDNC_COMPOSE_DIR"/"$SDNC_KUBE_APP_FILE
217 output_yaml=$PWD/tmp/sdnc_app.yaml
218 __kube_create_instance app $SDNC_APP_NAME $input_yaml $output_yaml
222 echo " Retrieving host and ports for service..."
223 SDNC_HOST_NAME=$(__kube_get_service_host $SDNC_APP_NAME $KUBE_NONRTRIC_NAMESPACE)
224 SDNC_EXTERNAL_PORT=$(__kube_get_service_port $SDNC_APP_NAME $KUBE_NONRTRIC_NAMESPACE "http")
225 SDNC_EXTERNAL_SECURE_PORT=$(__kube_get_service_port $SDNC_APP_NAME $KUBE_NONRTRIC_NAMESPACE "https")
227 echo " Host IP, http port, https port: $SDNC_HOST_NAME $SDNC_EXTERNAL_PORT $SDNC_EXTERNAL_SECURE_PORT"
229 if [ $SDNC_HTTPX == "http" ]; then
230 SDNC_PATH=$SDNC_HTTPX"://"$SDNC_HOST_NAME":"$SDNC_EXTERNAL_PORT
231 SDNC_API_PATH=$SDNC_HTTPX"://"$SDNC_USER":"$SDNC_PWD"@"$SDNC_HOST_NAME":"$SDNC_EXTERNAL_PORT$SDNC_API_URL
233 SDNC_SERVICE_PATH=$SDNC_HTTPX"://"$SDNC_APP_NAME"."$KUBE_NONRTRIC_NAMESPACE":"$SDNC_EXTERNAL_PORT
235 #SDNC_SERVICE_PATH=$SDNC_HTTPX"://"$SDNC_APP_NAME":"$SDNC_EXTERNAL_PORT
237 SDNC_PATH=$SDNC_HTTPX"://"$SDNC_HOST_NAME":"$SDNC_EXTERNAL_SECURE_PORT
238 SDNC_API_PATH=$SDNC_HTTPX"://"$SDNC_USER":"$SDNC_PWD"@"$SDNC_HOST_NAME":"$SDNC_EXTERNAL_SECURE_PORT$SDNC_API_URL
240 SDNC_SERVICE_PATH=$SDNC_HTTPX"://"$SDNC_APP_NAME"."$KUBE_NONRTRIC_NAMESPACE":"$SDNC_EXTERNAL_SECURE_PORT
242 #SDNC_SERVICE_PATH=$SDNC_HTTPX"://"$SDNC_APP_NAME":"$SDNC_EXTERNAL_SECURE_PORT
245 __check_service_start $SDNC_APP_NAME $SDNC_PATH$SDNC_ALIVE_URL
248 __check_included_image 'SDNC'
249 if [ $? -eq 1 ]; then
250 echo -e $RED"The SDNC A1 Controller app is not included in this test script"$ERED
251 echo -e $RED"The Policy Agent will not be started"$ERED
255 export SDNC_DB_APP_NAME
257 export SDNC_INTERNAL_PORT
258 export SDNC_EXTERNAL_PORT
259 export SDNC_INTERNAL_SECURE_PORT
260 export SDNC_EXTERNAL_SECURE_PORT
261 export SDNC_A1_TRUSTSTORE_PASSWORD
262 export DOCKER_SIM_NWNAME
263 export SDNC_DISPLAY_NAME
267 __start_container $SDNC_COMPOSE_DIR $SDNC_COMPOSE_FILE NODOCKERARGS 1 $SDNC_APP_NAME
269 __check_service_start $SDNC_APP_NAME $SDNC_PATH$SDNC_ALIVE_URL
279 # (Function for test scripts)
281 echo -e $BOLD"Stopping $SDNC_DISPLAY_NAME"$EBOLD
283 if [ $RUNMODE == "KUBE" ]; then
284 __log_conf_fail_not_supported " Cannot stop sndc in KUBE mode"
287 docker stop $SDNC_APP_NAME &> ./tmp/.dockererr
288 if [ $? -ne 0 ]; then
289 __print_err "Could not stop $SDNC_APP_NAME" $@
295 echo -e $BOLD$GREEN"Stopped"$EGREEN$EBOLD
300 # Start a previously stopped sdnc
302 # (Function for test scripts)
303 start_stopped_sdnc() {
304 echo -e $BOLD"Starting (the previously stopped) $SDNC_DISPLAY_NAME"$EBOLD
306 if [ $RUNMODE == "KUBE" ]; then
307 __log_conf_fail_not_supported " Cannot restart sndc in KUBE mode"
310 docker start $SDNC_APP_NAME &> ./tmp/.dockererr
311 if [ $? -ne 0 ]; then
312 __print_err "Could not start (the stopped) $SDNC_APP_NAME" $@
318 __check_service_start $SDNC_APP_NAME $SDNC_PATH$SDNC_ALIVE_URL
319 if [ $? -ne 0 ]; then
326 # Check the agent logs for WARNINGs and ERRORs
328 # (Function for test scripts)
330 __check_container_logs "SDNC A1 Controller" $SDNC_APP_NAME $SDNC_KARAF_LOG WARN ERROR
333 # Generic function to query the RICs via the A1-controller API.
334 # args: <operation> <url> [<body>]
335 # <operation>: getA1Policy,putA1Policy,getA1PolicyType,deleteA1Policy,getA1PolicyStatus
336 # response: <json-body><3-digit-response-code>
337 # (Not for test scripts)
338 __do_curl_to_controller() {
339 echo " (${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
340 if [ $# -ne 2 ] && [ $# -ne 3 ]; then
342 echo "-Incorrect number of parameters to __do_curl_to_controller " $@ >> $HTTPLOG
343 echo "-Expected: <operation> <url> [<body>]" >> $HTTPLOG
344 echo "-Returning response 000" >> $HTTPLOG
348 if [ $# -eq 2 ]; then
349 json='{"input":{"near-rt-ric-url":"'$2'"}}'
351 # Escape quotes in the body
352 body=$(echo "$3" | sed 's/"/\\"/g')
353 json='{"input":{"near-rt-ric-url":"'$2'","body":"'"$body"'"}}'
355 payload="./tmp/.sdnc.payload.json"
356 echo "$json" > $payload
357 echo " FILE ($payload) : $json" >> $HTTPLOG
359 if [ $RUNMODE == "KUBE" ]; then
360 if [ ! -z "$KUBE_PROXY_PATH" ]; then
361 if [ $KUBE_PROXY_HTTPX == "http" ]; then
362 proxyflag=" --proxy $KUBE_PROXY_PATH"
364 proxyflag=" --proxy-insecure --proxy $KUBE_PROXY_PATH"
368 curlString="curl -skw %{http_code} $proxyflag -X POST $SDNC_API_PATH$1 -H accept:application/json -H Content-Type:application/json --data-binary @$payload"
369 echo " CMD: "$curlString >> $HTTPLOG
372 echo " RESP: "$res >> $HTTPLOG
373 if [ $retcode -ne 0 ]; then
374 echo " RETCODE: "$retcode >> $HTTPLOG
379 status=${res:${#res}-3}
381 if [ $status -ne 200 ]; then
385 body=${res:0:${#res}-3}
386 echo " JSON: "$body >> $HTTPLOG
387 reply="./tmp/.sdnc-reply.json"
388 echo "$body" > $reply
389 res=$(python3 ../common/extract_sdnc_reply.py $SDNC_RESPONSE_JSON_KEY $reply)
390 echo " EXTRACED BODY+CODE: "$res >> $HTTPLOG
395 # Controller API Test function: getA1Policy (return ids only)
396 # arg: <response-code> (OSC <ric-id> <policy-type-id> [ <policy-id> [<policy-id>]* ]) | ( STD <ric-id> [ <policy-id> [<policy-id>]* ] )
397 # (Function for test scripts)
398 controller_api_get_A1_policy_ids() {
402 if [ $RUNMODE == "KUBE" ]; then
403 ric_id=$(get_kube_sim_host $3)
406 if [ $# -gt 3 ] && [ $2 == "OSC" ]; then
407 url="$RIC_SIM_HTTPX://$ric_id:$RIC_SIM_PORT/a1-p/policytypes/$4/policies"
409 elif [ $# -gt 2 ] && [ $2 == "STD" ]; then
410 url="$RIC_SIM_HTTPX://$ric_id:$RIC_SIM_PORT/A1-P/v1/policies"
414 if [ $paramError -ne 0 ]; then
415 __print_err "<response-code> (OSC <ric-id> <policy-type-id> [ <policy-id> [<policy-id>]* ]) | ( STD <ric-id> [ <policy-id> [<policy-id>]* ] )" $@
419 res=$(__do_curl_to_controller getA1Policy "$url")
421 status=${res:${#res}-3}
423 if [ $retcode -ne 0 ]; then
424 __log_test_fail_status_code $1 $retcode "(likely remote server error)"
428 if [ $status -ne $1 ]; then
429 __log_test_fail_status_code $1 $status
432 body=${res:0:${#res}-3}
436 if [ $2 == "OSC" ]; then
439 for pid in ${@:$start} ; do
440 if [ "$targetJson" != "[" ]; then
441 targetJson=$targetJson","
443 targetJson=$targetJson"\"$UUID$pid\""
445 targetJson=$targetJson"]"
447 echo " TARGET JSON: $targetJson" >> $HTTPLOG
449 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
451 if [ $res -ne 0 ]; then
461 # Controller API Test function: getA1PolicyType
462 # arg: <response-code> OSC <ric-id> <policy-type-id> [<policy-type-file>]
463 # (Function for test scripts)
464 controller_api_get_A1_policy_type() {
468 if [ $RUNMODE == "KUBE" ]; then
469 ric_id=$(get_kube_sim_host $3)
472 if [ $# -gt 3 ] && [ $2 == "OSC" ]; then
473 url="$RIC_SIM_HTTPX://$ric_id:$RIC_SIM_PORT/a1-p/policytypes/$4"
477 if [ $paramError -ne 0 ]; then
478 __print_err "<response-code> OSC <ric-id> <policy-type-id> [<policy-type-file>]" $@
482 res=$(__do_curl_to_controller getA1PolicyType "$url")
484 status=${res:${#res}-3}
486 if [ $retcode -ne 0 ]; then
487 __log_test_fail_status_code $1 $retcode "(likely remote server error)"
491 if [ $status -ne $1 ]; then
492 __log_test_fail_status_code $1 $status
495 body=${res:0:${#res}-3}
497 if [ $# -eq 5 ]; then
499 body=${res:0:${#res}-3}
502 echo " TARGET JSON: $targetJson" >> $HTTPLOG
503 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
505 if [ $res -ne 0 ]; then
515 # Controller API Test function: deleteA1Policy
516 # arg: <response-code> (STD <ric-id> <policy-id>) | (OSC <ric-id> <policy-type-id> <policy-id>)
517 # (Function for test scripts)
518 controller_api_delete_A1_policy() {
522 if [ $RUNMODE == "KUBE" ]; then
523 ric_id=$(get_kube_sim_host $3)
526 if [ $# -eq 5 ] && [ $2 == "OSC" ]; then
527 url="$RIC_SIM_HTTPX://$ric_id:$RIC_SIM_PORT/a1-p/policytypes/$4/policies/$UUID$5"
529 elif [ $# -eq 4 ] && [ $2 == "STD" ]; then
530 url="$RIC_SIM_HTTPX://$ric_id:$RIC_SIM_PORT/A1-P/v1/policies/$UUID$4"
534 if [ $paramError -ne 0 ]; then
535 __print_err "<response-code> (STD <ric-id> <policy-id>) | (OSC <ric-id> <policy-type-id> <policy-id>)" $@
539 res=$(__do_curl_to_controller deleteA1Policy "$url")
541 status=${res:${#res}-3}
543 if [ $retcode -ne 0 ]; then
544 __log_test_fail_status_code $1 $retcode "(likely remote server error)"
548 if [ $status -ne $1 ]; then
549 __log_test_fail_status_code $1 $status
557 # Controller API Test function: putA1Policy
558 # arg: <response-code> (STD <ric-id> <policy-id> <template-file> ) | (OSC <ric-id> <policy-type-id> <policy-id> <template-file>)
559 # (Function for test scripts)
560 controller_api_put_A1_policy() {
564 if [ $RUNMODE == "KUBE" ]; then
565 ric_id=$(get_kube_sim_host $3)
568 if [ $# -eq 6 ] && [ $2 == "OSC" ]; then
569 url="$RIC_SIM_HTTPX://$ric_id:$RIC_SIM_PORT/a1-p/policytypes/$4/policies/$UUID$5"
570 body=$(sed 's/XXX/'${5}'/g' $6)
573 elif [ $# -eq 5 ] && [ $2 == "STD" ]; then
574 url="$RIC_SIM_HTTPX://$ric_id:$RIC_SIM_PORT/A1-P/v1/policies/$UUID$4"
575 body=$(sed 's/XXX/'${4}'/g' $5)
579 if [ $paramError -ne 0 ]; then
580 __print_err "<response-code> (STD <ric-id> <policy-id>) | (OSC <ric-id> <policy-type-id> <policy-id>)" $@
584 res=$(__do_curl_to_controller putA1Policy "$url" "$body")
586 status=${res:${#res}-3}
588 if [ $retcode -ne 0 ]; then
589 __log_test_fail_status_code $1 $retcode "(likely remote server error)"
593 if [ $status -ne $1 ]; then
594 __log_test_fail_status_code $1 $status
603 # Controller API Test function: getA1PolicyStatus
604 # arg: <response-code> (STD <ric-id> <policy-id> <enforce-status> [<reason>]) | (OSC <ric-id> <policy-type-id> <policy-id> <instance-status> <has-been-deleted>)
605 # (Function for test scripts)
606 controller_api_get_A1_policy_status() {
610 if [ $RUNMODE == "KUBE" ]; then
611 ric_id=$(get_kube_sim_host $3)
615 if [ $# -ge 5 ] && [ $2 == "OSC" ]; then
616 url="$RIC_SIM_HTTPX://$ric_id:$RIC_SIM_PORT/a1-p/policytypes/$4/policies/$UUID$5/status"
617 if [ $# -gt 5 ]; then
618 targetJson="{\"instance_status\":\"$6\""
619 targetJson=$targetJson",\"has_been_deleted\":\"$7\""
620 targetJson=$targetJson",\"created_at\":\"????\"}"
623 elif [ $# -ge 4 ] && [ $2 == "STD" ]; then
624 url="$RIC_SIM_HTTPX://$ric_id:$RIC_SIM_PORT/A1-P/v1/policies/$UUID$4/status"
625 if [ $# -gt 4 ]; then
626 targetJson="{\"enforceStatus\":\"$5\""
627 if [ $# -eq 6 ]; then
628 targetJson=$targetJson",\"reason\":\"$6\""
630 targetJson=$targetJson"}"
635 if [ $paramError -ne 0 ]; then
636 __print_err "<response-code> (STD <ric-id> <policy-id> <enforce-status> [<reason>]) | (OSC <ric-id> <policy-type-id> <policy-id> <instance-status> <has-been-deleted>)" $@
640 res=$(__do_curl_to_controller getA1PolicyStatus "$url")
642 status=${res:${#res}-3}
644 if [ $retcode -ne 0 ]; then
645 __log_test_fail_status_code $1 $retcode "(likely remote server error)"
649 if [ $status -ne $1 ]; then
650 __log_test_fail_status_code $1 $status
654 if [ ! -z "$targetJson" ]; then
656 body=${res:0:${#res}-3}
657 echo " TARGET JSON: $targetJson" >> $HTTPLOG
658 res=$(python3 ../common/compare_json.py "$targetJson" "$body")
660 if [ $res -ne 0 ]; then