rajendrajaiswal | 6823ae7 | 2018-09-07 15:23:18 +0100 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # Place the scripts in run order: |
| 3 | #Make sure python-uuid is installed |
| 4 | |
| 5 | # Place the scripts in run order: |
| 6 | source ${SCRIPTS}/dcae-bulkpm/xNFSimulator.sh |
| 7 | |
| 8 | # Place the scripts in run order: |
| 9 | source ${SCRIPTS}/common_functions.sh |
| 10 | |
| 11 | #get current host IP addres |
| 12 | HOST_IP=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $NF}') |
| 13 | |
| 14 | VESC_IMAGE=nexus3.onap.org:10001/onap/org.onap.dcaegen2.collectors.ves.vescollector:1.3.1 |
| 15 | echo VESC_IMAGE=${VESC_IMAGE} |
| 16 | |
| 17 | # Start DCAE VES Collector |
| 18 | docker 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 |
| 21 | mkdir -p $WORKSPACE/archives/dmaapmr |
| 22 | cd $WORKSPACE/archives/dmaapmr |
| 23 | #unset http_proxy https_proxy |
| 24 | git clone --depth 1 http://gerrit.onap.org/r/dmaap/messagerouter/messageservice -b master |
| 25 | git pull |
| 26 | cd $WORKSPACE/archives/dmaapmr/messageservice/src/main/resources/docker-compose |
| 27 | cp $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 |
| 30 | sed -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 |
| 33 | docker login -u docker -p docker nexus3.onap.org:10001 |
| 34 | docker-compose up -d |
| 35 | |
| 36 | # Wait for initialization of Docker contaienr for DMaaP MR, Kafka and Zookeeper |
| 37 | for i in {1..50}; do |
| 38 | if [ $(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) ] |
| 41 | then |
| 42 | echo "DMaaP Service Running" |
| 43 | break |
| 44 | else |
| 45 | echo sleep $i |
| 46 | sleep $i |
| 47 | fi |
| 48 | done |
| 49 | |
| 50 | # Get IP address of DMAAP, KAFKA, Zookeeper |
| 51 | DMAAP_MR_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' dockercompose_dmaap_1) |
| 52 | KAFKA_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' dockercompose_kafka_1) |
| 53 | ZOOKEEPER_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' dockercompose_zookeeper_1) |
| 54 | |
| 55 | echo DMAAP_MR_IP=${DMAAP_MR_IP} |
| 56 | echo KAFKA_IP=${KAFKA_IP} |
| 57 | echo ZOOKEEPER_IP=${ZOOKEEPER_IP} |
| 58 | |
| 59 | # Shutdown DMAAP Container |
| 60 | docker kill dockercompose_dmaap_1 |
| 61 | |
| 62 | # Initial docker-compose up and down is for populating kafka and zookeeper IPs in /var/tmp/MsgRtrApi.properites |
| 63 | sed -i -e '/config.zk.servers=/ s/=.*/='$ZOOKEEPER_IP'/' /var/tmp/MsgRtrApi.properties |
| 64 | sed -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 |
| 67 | docker-compose build |
| 68 | docker login -u docker -p docker nexus3.onap.org:10001 |
| 69 | docker-compose up -d |
| 70 | sleep 5 |
| 71 | |
| 72 | # Get IP address of DMAAP, KAFKA, Zookeeper and VESC |
| 73 | DMAAP_MR_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' dockercompose_dmaap_1) |
| 74 | KAFKA_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' dockercompose_kafka_1) |
| 75 | ZOOKEEPER_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' dockercompose_zookeeper_1) |
| 76 | |
| 77 | VESC_IP=`get-instance-ip.sh vesc` |
| 78 | export VESC_IP=${VESC_IP} |
| 79 | export HOST_IP=${HOST_IP} |
| 80 | export DMAAP_MR_IP=${DMAAP_MR_IP} |
| 81 | |
| 82 | ROBOT_VARIABLES="-v DMAAP_MR_IP:${DMAAP_MR_IP} -v VESC_IP:${VESC_IP}" |
| 83 | |
| 84 | pip install jsonschema uuid |
| 85 | # Wait container ready |
| 86 | sleep 2 |