X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=test%2Fcommon%2Fsdnc_api_functions.sh;h=2701957fb6757ed0f0ea25a85b3fdb07f36f475d;hb=refs%2Fchanges%2F89%2F10889%2F2;hp=55a6a15dbe1ec4a3d7c17817f8c6e1eeef362e12;hpb=712794e78f2c8f1b2aa57ef687deed6bc47c6b10;p=nonrtric.git diff --git a/test/common/sdnc_api_functions.sh b/test/common/sdnc_api_functions.sh index 55a6a15d..2701957f 100644 --- a/test/common/sdnc_api_functions.sh +++ b/test/common/sdnc_api_functions.sh @@ -1,7 +1,7 @@ #!/bin/bash # ============LICENSE_START=============================================== -# Copyright (C) 2020 Nordix Foundation. All rights reserved. +# Copyright (C) 2020-2023 Nordix Foundation. All rights reserved. # ======================================================================== # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -248,7 +248,7 @@ start_sdnc() { __check_included_image 'SDNC' if [ $? -eq 1 ]; then echo -e $RED"The SDNC A1 Controller app is not included in this test script"$ERED - echo -e $RED"The Policy Agent will not be started"$ERED + echo -e $RED"The A1PMS will not be started"$ERED exit fi @@ -313,7 +313,7 @@ start_stopped_sdnc() { return 0 } -# Check the agent logs for WARNINGs and ERRORs +# Check the sdnc logs for WARNINGs and ERRORs # args: - # (Function for test scripts) check_sdnc_logs() { @@ -638,4 +638,37 @@ controller_api_get_A1_policy_status() { __log_test_pass return 0 -} \ No newline at end of file +} + +# Wait for http status on url +# args: +# (Function for test scripts) +controller_api_wait_for_status_ok() { + __log_conf_start $@ + + if [ $# -ne 2 ]; then + __print_err " " $@ + return 1 + fi + ric_id=$(__find_sim_host $2) + url="$ric_id/" + + TS_START=$SECONDS + while [ $(($TS_START+500)) -gt $SECONDS ]; do + echo -ne " Waiting for http status $1 on $url via sdnc, waited: $(($SECONDS-$TS_START))"$SAMELINE + res=$(__do_curl_to_controller getA1Policy "$url") + retcode=$? + status=${res:${#res}-3} + if [ $retcode -eq 0 ]; then + if [ $status -eq $1 ]; then + echo "" + __log_conf_ok + return 0 + fi + fi + sleep 5 + done + echo "" + __log_conf_fail_general + return 1 +}