blob: 5a670d28f903c8c1a8fd612b9f68c1152dd0bd97 [file] [log] [blame]
Gary Wu9abb61c2018-09-27 10:38:50 -07001#!/bin/bash
2#
3# ============LICENSE_START=======================================================
4# ONAP DMAAP MR
5# ================================================================================
6# Copyright (C) 2017 AT&T Intellectual Property. All rights
7# reserved.
8# ================================================================================
9# Licensed under the Apache License, Version 2.0 (the "License");
10# you may not use this file except in compliance with the License.
11# You may obtain a copy of the License at
12#
13# http://www.apache.org/licenses/LICENSE-2.0
14#
15# Unless required by applicable law or agreed to in writing, software
16# distributed under the License is distributed on an "AS IS" BASIS,
17# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18# See the License for the specific language governing permissions and
19# limitations under the License.
20# ============LICENSE_END============================================
21# ===================================================================
22# ECOMP is a trademark and service mark of AT&T Intellectual Property.
23#
24# Place the scripts in run order:
25source ${SCRIPTS}/common_functions.sh
26
27# Clone DMaaP Message Router repo
28mkdir -p $WORKSPACE/archives/dmaapmr
29cd $WORKSPACE/archives/dmaapmr
30#unset http_proxy https_proxy
31git clone --depth 1 http://gerrit.onap.org/r/dmaap/messagerouter/messageservice -b master
32git pull
33cd $WORKSPACE/archives/dmaapmr/messageservice/src/main/resources/docker-compose
34cp $WORKSPACE/archives/dmaapmr/messageservice/bundleconfig-local/etc/appprops/MsgRtrApi.properties /var/tmp/
35
36
Gary Wu9abb61c2018-09-27 10:38:50 -070037
38# Update kafkfa and zookeeper properties in MsgRtrApi.propeties which will be copied to DMaaP Container
sunil unnavabd341512018-09-27 16:41:08 -040039sed -i -e 's/<zookeeper_host>/zookeeper/' /var/tmp/MsgRtrApi.properties
40sed -i -e 's/<kafka_host>:<kafka_port>/kafka:9092/' /var/tmp/MsgRtrApi.properties
Gary Wu9abb61c2018-09-27 10:38:50 -070041
sunil unnava0c840812018-10-17 16:20:09 -040042# start DMaaP MR containers with docker compose and configuration from docker-compose.yml
Gary Wu9abb61c2018-09-27 10:38:50 -070043docker-compose build
44docker login -u docker -p docker nexus3.onap.org:10001
sunil unnavabd341512018-09-27 16:41:08 -040045docker-compose up -d
Gary Wu9abb61c2018-09-27 10:38:50 -070046
47# Wait for initialization of Docker containers
48for i in {1..50}; do
49 if [ $(docker inspect --format '{{ .State.Running }}' dockercompose_dmaap_1) ] && \
50 [ $(docker inspect --format '{{ .State.Running }}' dockercompose_zookeeper_1) ] && \
51 [ $(docker inspect --format '{{ .State.Running }}' dockercompose_dmaap_1) ]
52 then
53 echo "DMaaP Service Running"
54 break
55 else
56 echo sleep $i
57 sleep $i
58 fi
59done
60
sunil unnavabd341512018-09-27 16:41:08 -040061DMAAP_MR_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' dockercompose_dmaap_1)
62KAFKA_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' dockercompose_kafka_1)
63ZOOKEEPER_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' dockercompose_zookeeper_1)
64
sunil unnavabd341512018-09-27 16:41:08 -040065echo DMAAP_MR_IP=${DMAAP_MR_IP}
66echo KAFKA_IP=${KAFKA_IP}
67echo ZOOKEEPER_IP=${ZOOKEEPER_IP}
68
Gary Wu9abb61c2018-09-27 10:38:50 -070069# Wait for initialization of docker services
70for i in {1..50}; do
71 curl -sS -m 1 ${DMAAP_MR_IP}:3904/events/TestTopic && break
72 echo sleep $i
73 sleep $i
74done
75
76#Pass any variables required by Robot test suites in ROBOT_VARIABLES
77ROBOT_VARIABLES="-v DMAAP_MR_IP:${DMAAP_MR_IP}"