blob: 0a1f9d359a64ce5ea6aa7869e16c986d2c99f99e [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
37# start DMaaP MR containers with docker compose and configuration from docker-compose.yml
38docker login -u docker -p docker nexus3.onap.org:10001
39docker-compose up -d
40
41# Wait for initialization of Docker contaienr for DMaaP MR, Kafka and Zookeeper
42for i in {1..50}; do
43 if [ $(docker inspect --format '{{ .State.Running }}' dockercompose_dmaap_1) ] && \
44 [ $(docker inspect --format '{{ .State.Running }}' dockercompose_zookeeper_1) ] && \
45 [ $(docker inspect --format '{{ .State.Running }}' dockercompose_dmaap_1) ]
46 then
47 echo "DMaaP Service Running"
48 break
49 else
50 echo sleep $i
51 sleep $i
52 fi
53done
54
55
56DMAAP_MR_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' dockercompose_dmaap_1)
57KAFKA_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' dockercompose_kafka_1)
58ZOOKEEPER_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' dockercompose_zookeeper_1)
59
60echo DMAAP_MR_IP=${DMAAP_MR_IP}
61echo KAFKA_IP=${KAFKA_IP}
62echo ZOOKEEPER_IP=${ZOOKEEPER_IP}
63
64# Initial docker-compose up and down is for populating kafka and zookeeper IPs in /var/tmp/MsgRtrApi.properites
65docker-compose down
66
67# Update kafkfa and zookeeper properties in MsgRtrApi.propeties which will be copied to DMaaP Container
68sed -i -e 's/<zookeeper_host>/'$ZOOKEEPER_IP'/' /var/tmp/MsgRtrApi.properties
69sed -i -e 's/<kafka_host>:<kafka_port>/'$KAFKA_IP':9092/' /var/tmp/MsgRtrApi.properties
70
71docker-compose build
72docker login -u docker -p docker nexus3.onap.org:10001
73docker-compose up -d
74
75# Wait for initialization of Docker containers
76for i in {1..50}; do
77 if [ $(docker inspect --format '{{ .State.Running }}' dockercompose_dmaap_1) ] && \
78 [ $(docker inspect --format '{{ .State.Running }}' dockercompose_zookeeper_1) ] && \
79 [ $(docker inspect --format '{{ .State.Running }}' dockercompose_dmaap_1) ]
80 then
81 echo "DMaaP Service Running"
82 break
83 else
84 echo sleep $i
85 sleep $i
86 fi
87done
88
89# Wait for initialization of docker services
90for i in {1..50}; do
91 curl -sS -m 1 ${DMAAP_MR_IP}:3904/events/TestTopic && break
92 echo sleep $i
93 sleep $i
94done
95
96#Pass any variables required by Robot test suites in ROBOT_VARIABLES
97ROBOT_VARIABLES="-v DMAAP_MR_IP:${DMAAP_MR_IP}"