From f2fcb9701c364343961ef97a48def003e077b55d Mon Sep 17 00:00:00 2001 From: JohnKeeney Date: Thu, 1 Sep 2022 13:52:53 +0100 Subject: Picking CSIT improvements from master->jakara branch Change-Id: I18b527d286f4526102ef25bd7f105baf6f19ad1a Signed-off-by: JohnKeeney Issue-ID: CCSDK-3675 --- csit/scripts/healthcheck/data/preparePmsData.sh | 37 +++++++++++++++++++++++-- csit/scripts/healthcheck/test/pms_a1sim_sdnc.sh | 23 ++++++++------- 2 files changed, 47 insertions(+), 13 deletions(-) (limited to 'csit/scripts/healthcheck') diff --git a/csit/scripts/healthcheck/data/preparePmsData.sh b/csit/scripts/healthcheck/data/preparePmsData.sh index 383ceeb1..69dc92d2 100755 --- a/csit/scripts/healthcheck/data/preparePmsData.sh +++ b/csit/scripts/healthcheck/data/preparePmsData.sh @@ -32,6 +32,8 @@ a1_sim_OSC_port=${2:-30001} a1_sim_STD_port=${3:-30005} httpx=${4:-"http"} SHELL_FOLDER=$(cd "$(dirname "$0")";pwd) +ric1_id="ric1" +ric2_id="ric2" echo "using policy_agent port: "$policy_agent_port echo "using a1-sim-OSC port: "$a1_sim_OSC_port @@ -45,8 +47,25 @@ checkRes (){ exit 1; fi } +checkReturnContains(){ +#arg 1 max time, seconds +#arg 2 command +#arg 3 value (regex) +#arg 4 description + for ((i=0; i<$1; i++)); do + resin=$($2) + exp=$3 + echo "Check \"$4\" Expected to contain: \"$exp\" Received \"$resin\"" + if [[ $resin =~ $exp ]]; then + echo -e "$4 is as expected!\n" + break; + else + sleep 1 + fi + done +} -echo "policy agent status:" +echo "A1 policy management service status:" curlString="curl -skw %{http_code} $httpx://localhost:$policy_agent_port/status" res=$($curlString) echo "$res" @@ -86,7 +105,15 @@ expect="Policy type 2 is OK.201" checkRes echo -e "\n" -for i in {1..60}; do +echo "check $ric1_id sync status:" +checkReturnContains 90 "curl -skw %{http_code} $httpx://localhost:$policy_agent_port/a1-policy/v2/rics/ric?ric_id=$ric1_id" "\"state\"\s*:\s*\"AVAILABLE\"" "$ric1_id status" +echo -e "\n" + +echo "check $ric2_id sync status:" +checkReturnContains 30 "curl -skw %{http_code} $httpx://localhost:$policy_agent_port/a1-policy/v2/rics/ric?ric_id=$ric2_id" "\"state\"\s*:\s*\"AVAILABLE\"" "$ric2_id status" +echo -e "\n" + +for i in {1..300}; do echo "policy types from policy agent:" curlString="curl -skw %{http_code} $httpx://localhost:$policy_agent_port/a1-policy/v2/policy-types" res=$($curlString) @@ -96,10 +123,14 @@ for i in {1..60}; do echo -e "\n" break; else - sleep $i + sleep 1 fi done +docker images +docker ps -a +docker logs policy-agent + echo "create service ric-registration to policy agent:" curlString="curl -k -X PUT -sw %{http_code} -H accept:application/json -H Content-Type:application/json "$httpx://localhost:$policy_agent_port/a1-policy/v2/services" --data-binary @${SHELL_FOLDER}/testdata/v2/service.json" res=$($curlString) diff --git a/csit/scripts/healthcheck/test/pms_a1sim_sdnc.sh b/csit/scripts/healthcheck/test/pms_a1sim_sdnc.sh index c80e68a9..29feb88a 100755 --- a/csit/scripts/healthcheck/test/pms_a1sim_sdnc.sh +++ b/csit/scripts/healthcheck/test/pms_a1sim_sdnc.sh @@ -32,15 +32,15 @@ chmod +x docker-compose ./docker-compose --env-file .env -f docker-compose.yml -f sdnc/docker-compose.yml up -d checkStatus(){ - for i in {1..60}; do - res=$($1) + for ((i=0; i<$1; i++)); do + res=$($2) echo "$res" - expect=$2 + expect=$3 if [ "$res" == "$expect" ]; then - echo -e "$3 is alive!\n" + echo -e "$4 is alive!\n" break; else - sleep $i + sleep 1 fi done } @@ -48,23 +48,26 @@ checkStatus(){ # check SIM1 status echo "check SIM1 status:" -checkStatus "curl -skw %{http_code} http://localhost:30001/" "OK200" "SIM1" +checkStatus 60 "curl -skw %{http_code} http://localhost:30001/" "OK200" "SIM1" # check SIM2 status echo "check SIM2 status:" -checkStatus "curl -skw %{http_code} http://localhost:30003/" "OK200" "SIM2" +checkStatus 60 "curl -skw %{http_code} http://localhost:30003/" "OK200" "SIM2" # check SIM3 status echo "check SIM3 status:" -checkStatus "curl -skw %{http_code} http://localhost:30005/" "OK200" "SIM3" +checkStatus 60 "curl -skw %{http_code} http://localhost:30005/" "OK200" "SIM3" # check PMS status echo "check PMS status:" -checkStatus "curl -skw %{http_code} http://localhost:8081/status" "hunky dory200" "PMS" +checkStatus 60 "curl -skw %{http_code} http://localhost:8081/status" "hunky dory200" "PMS" + +curl -skw %{http_code} http://localhost:8081/actuator/loggers/org.onap.ccsdk.oran.a1policymanagementservice -X POST -H Content-Type:application/json -d '{"configuredLevel":"debug"}' +curl -skw %{http_code} http://localhost:8081/actuator/loggers/org.onap.ccsdk.oran.a1policymanagementservice.tasks -X POST -H Content-Type:application/json -d '{"configuredLevel":"trace"}' # check SDNC status echo "check SDNC status:" -checkStatus "curl -s -o /dev/null -I -w %{http_code} http://localhost:8282/apidoc/explorer/" "200" "SDNC" +checkStatus 300 "curl -s -o /dev/null -I -w %{http_code} http://localhost:8282/apidoc/explorer/" "200" "SDNC" cd ${SHELL_FOLDER}/../data ./preparePmsData.sh -- cgit 1.2.3-korg