5dba4fe55dac9a145bb06db16bdcc804b4c827e0
[nonrtric.git] / test / usecases / oruclosedlooprecovery / scriptversion / docker-compose / start.sh
1 #  Copyright (C) 2021 Nordix Foundation. All rights reserved.
2 #  ========================================================================
3 #  Licensed under the Apache License, Version 2.0 (the "License");
4 #  you may not use this file except in compliance with the License.
5 #  You may obtain a copy of the License at
6 #
7 #       http://www.apache.org/licenses/LICENSE-2.0
8 #
9 #  Unless required by applicable law or agreed to in writing, software
10 #  distributed under the License is distributed on an "AS IS" BASIS,
11 #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 #  See the License for the specific language governing permissions and
13 #  limitations under the License.
14 #  ============LICENSE_END=================================================
15 #
16
17 SHELL_FOLDER=$(cd "$(dirname "$0")";pwd)
18 docker stop $(docker ps -aq)
19 docker system prune -f
20
21 # build o-ru application image
22 cd ${SHELL_FOLDER}/../app/
23 docker build -t oru-app .
24
25 # build simulator image of sdnr
26 cd ${SHELL_FOLDER}/../simulators/
27 docker build -f Dockerfile-sdnr-sim -t sdnr-simulator .
28
29 # build message generator image
30 docker build -f Dockerfile-message-generator -t message-generator .
31
32 # start up dmaap message router
33 cd ${SHELL_FOLDER}/../../../../docker-compose/
34 docker-compose -f docker-compose.yaml -f mr/docker-compose.yml up -d
35
36 # wait until mr up & running
37 for i in {1..60}; do
38     res=$(curl -o /dev/null -sw %{http_code} http://localhost:3904/topics)
39     echo "$res"
40     expect="200"
41     if [ "$res" == "$expect" ]; then
42         echo -e "dmaap-mr is alive!\n"
43         break;
44     else
45         sleep $i
46     fi
47 done
48
49 # start up oru, message-generator and sdnr-simulator
50 cd ${SHELL_FOLDER}
51 docker-compose up -d