blob: 530d97da1dc03ff2859d473f14c2fe8c35193ab6 [file] [log] [blame]
rajendrajaiswal6823ae72018-09-07 15:23:18 +01001#!/bin/bash
2# Place the scripts in run order:
3#Make sure python-uuid is installed
4
5# Place the scripts in run order:
6source ${SCRIPTS}/dcae-bulkpm/xNFSimulator.sh
7
8# Place the scripts in run order:
9source ${SCRIPTS}/common_functions.sh
10
11#get current host IP addres
12HOST_IP=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $NF}')
13
14VESC_IMAGE=nexus3.onap.org:10001/onap/org.onap.dcaegen2.collectors.ves.vescollector:1.3.1
15echo VESC_IMAGE=${VESC_IMAGE}
16
17# Start DCAE VES Collector
18docker run -d -p 8080:8080/tcp -p 8443:8443/tcp -P --name vesc -e DMAAPHOST=${HOST_IP} ${VESC_IMAGE}
19
20# Clone DMaaP Message Router repo
21mkdir -p $WORKSPACE/archives/dmaapmr
22cd $WORKSPACE/archives/dmaapmr
23#unset http_proxy https_proxy
24git clone --depth 1 http://gerrit.onap.org/r/dmaap/messagerouter/messageservice -b master
25git pull
26cd $WORKSPACE/archives/dmaapmr/messageservice/src/main/resources/docker-compose
27cp $WORKSPACE/archives/dmaapmr/messageservice/bundleconfig-local/etc/appprops/MsgRtrApi.properties /var/tmp/
28
29# Update kafkfa and zookeeper properties in MsgRtrApi.propeties which will be copied to DMaaP Container
30sed -i -e 's#nexus3.onap.org:10001/onap/dmaap/kafka01101:0.0.1#wurstmeister/kafka:1.1.0#' $WORKSPACE/archives/dmaapmr/messageservice/src/main/resources/docker-compose/docker-compose.yml
31
32# start DMaaP MR containers with docker compose and configuration from docker-compose.yml
33docker login -u docker -p docker nexus3.onap.org:10001
34docker-compose up -d
35
36# Wait for initialization of Docker contaienr for DMaaP MR, Kafka and Zookeeper
37for i in {1..50}; do
38if [ $(docker inspect --format '{{ .State.Running }}' dockercompose_kafka_1) ] && \
39[ $(docker inspect --format '{{ .State.Running }}' dockercompose_zookeeper_1) ] && \
40[ $(docker inspect --format '{{ .State.Running }}' dockercompose_dmaap_1) ]
41then
42 echo "DMaaP Service Running"
43 break
44else
45 echo sleep $i
46 sleep $i
47fi
48done
49
50# Get IP address of DMAAP, KAFKA, Zookeeper
51DMAAP_MR_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' dockercompose_dmaap_1)
52KAFKA_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' dockercompose_kafka_1)
53ZOOKEEPER_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' dockercompose_zookeeper_1)
54
55echo DMAAP_MR_IP=${DMAAP_MR_IP}
56echo KAFKA_IP=${KAFKA_IP}
57echo ZOOKEEPER_IP=${ZOOKEEPER_IP}
58
59# Shutdown DMAAP Container
60docker kill dockercompose_dmaap_1
61
62# Initial docker-compose up and down is for populating kafka and zookeeper IPs in /var/tmp/MsgRtrApi.properites
63sed -i -e '/config.zk.servers=/ s/=.*/='$ZOOKEEPER_IP'/' /var/tmp/MsgRtrApi.properties
64sed -i -e '/kafka.metadata.broker.list=/ s/=.*/='$KAFKA_IP':9092/' /var/tmp/MsgRtrApi.properties
65
66# Start DMaaP MR containers with docker compose and configuration from docker-compose.yml
67docker-compose build
68docker login -u docker -p docker nexus3.onap.org:10001
69docker-compose up -d
70sleep 5
71
72# Get IP address of DMAAP, KAFKA, Zookeeper and VESC
73DMAAP_MR_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' dockercompose_dmaap_1)
74KAFKA_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' dockercompose_kafka_1)
75ZOOKEEPER_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' dockercompose_zookeeper_1)
76
77VESC_IP=`get-instance-ip.sh vesc`
78export VESC_IP=${VESC_IP}
79export HOST_IP=${HOST_IP}
80export DMAAP_MR_IP=${DMAAP_MR_IP}
81
82ROBOT_VARIABLES="-v DMAAP_MR_IP:${DMAAP_MR_IP} -v VESC_IP:${VESC_IP}"
83
84pip install jsonschema uuid
85# Wait container ready
86sleep 2