Clean-up existing docker-compose solutions
[oam.git] / solution / integration / smo / non-rt-ric / test / pms_a1sim.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 unset http_proxy https_proxy
20 SHELL_FOLDER=$(cd "$(dirname "$0")";pwd)
21 docker stop $(docker ps -aq)
22 docker system prune -f
23 docker network create oam
24 docker network create smo
25
26 cd ${SHELL_FOLDER}/../config/pms/
27 cp application_configuration.json.nosdnc application_configuration.json
28
29 cd ${SHELL_FOLDER}/../
30 docker-compose up -d
31
32 checkStatus(){
33     for i in {1..60}; do
34         res=$($1)
35         echo "$res"
36         expect=$2
37         if [ "$res" == "$expect" ]; then
38             echo -e "$3 is alive!\n"
39             break;
40         else
41             sleep $i
42         fi
43     done
44 }
45 # Healthcheck docker containers
46
47 # check SIM1 status
48 echo "check SIM1 status:"
49 checkStatus "curl -skw %{http_code} http://localhost:30001/" "OK200" "SIM1"
50
51 # check SIM2 status
52 echo "check SIM2 status:"
53 checkStatus "curl -skw %{http_code} http://localhost:30003/" "OK200" "SIM2"
54
55 # check SIM3 status
56 echo "check SIM3 status:"
57 checkStatus "curl -skw %{http_code} http://localhost:30005/" "OK200" "SIM3"
58
59 # check PMS status
60 echo "check PMS status:"
61 checkStatus "curl -skw %{http_code} http://localhost:8091/status" "hunky dory200" "PMS"
62
63 cd ${SHELL_FOLDER}/../data
64 ./preparePmsData.sh
65 ./prepareIcsData.sh
66
67