Merge "Added CSIT for Macroflow with HEAT"
[integration/csit.git] / plans / ccsdk-oran / polmansuite / test / pms_a1sim_sdnc.sh
1 #!/bin/bash
2
3 #  ============LICENSE_START===============================================
4 #  Copyright (C) 2021 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
9 #
10 #       http://www.apache.org/licenses/LICENSE-2.0
11 #
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=================================================
18
19 SHELL_FOLDER=$(cd "$(dirname "$0")";pwd)
20 docker stop $(docker ps -aq)
21 docker system prune -f
22
23 cd ${SHELL_FOLDER}/../config
24 cp application_configuration.json.sdnc application_configuration.json
25
26 cd ${SHELL_FOLDER}/../
27 docker-compose -f docker-compose.yml -f sdnc/docker-compose.yml up -d
28
29 checkStatus(){
30     for i in {1..20}; do
31         res=$($1)
32         echo "$res"
33         expect=$2
34         if [ "$res" == "$expect" ]; then
35             echo -e "$3 is alive!\n"
36             break;
37         else
38             sleep $i
39         fi
40     done
41 }
42 # Healthcheck docker containers
43
44 # check SIM1 status
45 echo "check SIM1 status:"
46 checkStatus "curl -skw %{http_code} http://localhost:30001/" "OK200" "SIM1"
47
48 # check SIM2 status
49 echo "check SIM2 status:"
50 checkStatus "curl -skw %{http_code} http://localhost:30003/" "OK200" "SIM2"
51
52 # check SIM3 status
53 echo "check SIM3 status:"
54 checkStatus "curl -skw %{http_code} http://localhost:30005/" "OK200" "SIM3"
55
56 # check PMS status
57 echo "check PMS status:"
58 checkStatus "curl -skw %{http_code} http://localhost:8081/status" "hunky dory200" "PMS"
59
60 # check SDNC status
61 echo "check SDNC status:"
62 checkStatus "curl -s -o /dev/null -I -w %{http_code} http://localhost:8282/apidoc/explorer/" "200" "SDNC"
63
64 cd ${SHELL_FOLDER}/../data
65 ./preparePmsData.sh
66