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 | |
LiamBurke | c5fa595 | 2018-09-17 14:34:05 +0100 | [diff] [blame] | 11 | # Clone DMaaP Data Router repo |
| 12 | mkdir -p $WORKSPACE/archives/dmaapdr |
| 13 | cd $WORKSPACE/archives/dmaapdr |
rajendrajaiswal | 6823ae7 | 2018-09-07 15:23:18 +0100 | [diff] [blame] | 14 | |
LiamBurke | c5fa595 | 2018-09-17 14:34:05 +0100 | [diff] [blame] | 15 | git clone --depth 1 https://gerrit.onap.org/r/dmaap/datarouter -b master |
| 16 | cd datarouter |
| 17 | git pull |
| 18 | cd $WORKSPACE/archives/dmaapdr/datarouter/docker-compose/ |
| 19 | |
| 20 | # start DMaaP DR containers with docker compose and configuration from docker-compose.yml |
| 21 | docker login -u docker -p docker nexus3.onap.org:10001 |
| 22 | docker-compose up -d |
| 23 | |
| 24 | # Wait for initialization of Docker container for datarouter-node, datarouter-prov and mariadb |
| 25 | for i in {1..50}; do |
| 26 | if [ $(docker inspect --format '{{ .State.Running }}' datarouter-node) ] && \ |
| 27 | [ $(docker inspect --format '{{ .State.Running }}' datarouter-prov) ] && \ |
| 28 | [ $(docker inspect --format '{{ .State.Running }}' mariadb) ] |
| 29 | then |
| 30 | echo "DR Service Running" |
| 31 | break |
| 32 | else |
| 33 | echo sleep $i |
| 34 | sleep $i |
| 35 | fi |
| 36 | done |
| 37 | |
| 38 | DR_PROV_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' datarouter-prov) |
| 39 | DR_NODE_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' datarouter-node) |
| 40 | DR_GATEWAY_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.Gateway}}{{end}}' datarouter-prov) |
| 41 | |
| 42 | #Add the DR_NODE_IP to /etc/hosts |
| 43 | sudo echo "${DR_NODE_IP} dmaap-dr-node" >> /etc/hosts |
| 44 | sudo echo "${DR_PROV_IP} dmaap-dr-prov" >> /etc/hosts |
| 45 | |
| 46 | echo DR_PROV_IP=${DR_PROV_IP} |
| 47 | echo DR_NODE_IP=${DR_NODE_IP} |
| 48 | echo DR_GATEWAY_IP=${DR_GATEWAY_IP} |
| 49 | |
| 50 | docker exec -i datarouter-prov sh -c "curl -k -X PUT https://$DR_PROV_IP:8443/internal/api/NODES?val=dmaap-dr-node\|$DR_GATEWAY_IP" |
| 51 | docker exec -i datarouter-prov sh -c "curl -k -X PUT https://$DR_PROV_IP:8443/internal/api/PROV_AUTH_ADDRESSES?val=dmaap-dr-prov\|$DR_GATEWAY_IP" |
| 52 | |
| 53 | # Start DCAE VES Collector |
| 54 | cd $WORKSPACE/ |
| 55 | HOST_IP=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $NF}') |
rajendrajaiswal | 6823ae7 | 2018-09-07 15:23:18 +0100 | [diff] [blame] | 56 | VESC_IMAGE=nexus3.onap.org:10001/onap/org.onap.dcaegen2.collectors.ves.vescollector:1.3.1 |
| 57 | echo VESC_IMAGE=${VESC_IMAGE} |
| 58 | |
LiamBurke | c5fa595 | 2018-09-17 14:34:05 +0100 | [diff] [blame] | 59 | docker run -d --name vesc -e DMAAPHOST=${HOST_IP} ${VESC_IMAGE} |
| 60 | VESC_IP=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' vesc) |
rajendrajaiswal | 6823ae7 | 2018-09-07 15:23:18 +0100 | [diff] [blame] | 61 | |
| 62 | # Clone DMaaP Message Router repo |
| 63 | mkdir -p $WORKSPACE/archives/dmaapmr |
| 64 | cd $WORKSPACE/archives/dmaapmr |
rajendrajaiswal | 6823ae7 | 2018-09-07 15:23:18 +0100 | [diff] [blame] | 65 | git clone --depth 1 http://gerrit.onap.org/r/dmaap/messagerouter/messageservice -b master |
| 66 | git pull |
| 67 | cd $WORKSPACE/archives/dmaapmr/messageservice/src/main/resources/docker-compose |
| 68 | cp $WORKSPACE/archives/dmaapmr/messageservice/bundleconfig-local/etc/appprops/MsgRtrApi.properties /var/tmp/ |
| 69 | |
rajendrajaiswal | 6823ae7 | 2018-09-07 15:23:18 +0100 | [diff] [blame] | 70 | # start DMaaP MR containers with docker compose and configuration from docker-compose.yml |
| 71 | docker login -u docker -p docker nexus3.onap.org:10001 |
| 72 | docker-compose up -d |
| 73 | |
LiamBurke | c5fa595 | 2018-09-17 14:34:05 +0100 | [diff] [blame] | 74 | ZOOKEEPER=$(docker ps -a -q --filter="name=zookeeper_1") |
| 75 | KAFKA=$(docker ps -a -q --filter="name=kafka_1") |
| 76 | DMAAP=$(docker ps -a -q --filter="name=dmaap_1") |
| 77 | |
rajendrajaiswal | 6823ae7 | 2018-09-07 15:23:18 +0100 | [diff] [blame] | 78 | # Wait for initialization of Docker contaienr for DMaaP MR, Kafka and Zookeeper |
| 79 | for i in {1..50}; do |
LiamBurke | c5fa595 | 2018-09-17 14:34:05 +0100 | [diff] [blame] | 80 | if [ $(docker inspect --format '{{ .State.Running }}' $KAFKA) ] && \ |
| 81 | [ $(docker inspect --format '{{ .State.Running }}' $ZOOKEEPER) ] && \ |
| 82 | [ $(docker inspect --format '{{ .State.Running }}' $DMAAP) ] |
rajendrajaiswal | 6823ae7 | 2018-09-07 15:23:18 +0100 | [diff] [blame] | 83 | then |
| 84 | echo "DMaaP Service Running" |
| 85 | break |
| 86 | else |
| 87 | echo sleep $i |
| 88 | sleep $i |
| 89 | fi |
| 90 | done |
| 91 | |
| 92 | # Get IP address of DMAAP, KAFKA, Zookeeper |
LiamBurke | c5fa595 | 2018-09-17 14:34:05 +0100 | [diff] [blame] | 93 | DMAAP_MR_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $DMAAP) |
| 94 | KAFKA_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $KAFKA) |
| 95 | ZOOKEEPER_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $ZOOKEEPER) |
rajendrajaiswal | 6823ae7 | 2018-09-07 15:23:18 +0100 | [diff] [blame] | 96 | |
| 97 | echo DMAAP_MR_IP=${DMAAP_MR_IP} |
| 98 | echo KAFKA_IP=${KAFKA_IP} |
| 99 | echo ZOOKEEPER_IP=${ZOOKEEPER_IP} |
| 100 | |
| 101 | # Shutdown DMAAP Container |
LiamBurke | c5fa595 | 2018-09-17 14:34:05 +0100 | [diff] [blame] | 102 | docker kill $DMAAP |
rajendrajaiswal | 6823ae7 | 2018-09-07 15:23:18 +0100 | [diff] [blame] | 103 | |
| 104 | # Initial docker-compose up and down is for populating kafka and zookeeper IPs in /var/tmp/MsgRtrApi.properites |
| 105 | sed -i -e '/config.zk.servers=/ s/=.*/='$ZOOKEEPER_IP'/' /var/tmp/MsgRtrApi.properties |
| 106 | sed -i -e '/kafka.metadata.broker.list=/ s/=.*/='$KAFKA_IP':9092/' /var/tmp/MsgRtrApi.properties |
| 107 | |
| 108 | # Start DMaaP MR containers with docker compose and configuration from docker-compose.yml |
| 109 | docker-compose build |
| 110 | docker login -u docker -p docker nexus3.onap.org:10001 |
| 111 | docker-compose up -d |
| 112 | sleep 5 |
| 113 | |
rajendrajaiswal | 6823ae7 | 2018-09-07 15:23:18 +0100 | [diff] [blame] | 114 | export VESC_IP=${VESC_IP} |
| 115 | export HOST_IP=${HOST_IP} |
| 116 | export DMAAP_MR_IP=${DMAAP_MR_IP} |
LiamBurke | c5fa595 | 2018-09-17 14:34:05 +0100 | [diff] [blame] | 117 | #Pass any variables required by Robot test suites in ROBOT_VARIABLES |
| 118 | ROBOT_VARIABLES="-v DR_PROV_IP:${DR_PROV_IP} -v DR_NODE_IP:${DR_NODE_IP} -v DMAAP_MR_IP:${DMAAP_MR_IP} -v VESC_IP:${VESC_IP}" |
rajendrajaiswal | 6823ae7 | 2018-09-07 15:23:18 +0100 | [diff] [blame] | 119 | |
| 120 | pip install jsonschema uuid |
| 121 | # Wait container ready |
LiamBurke | c5fa595 | 2018-09-17 14:34:05 +0100 | [diff] [blame] | 122 | sleep 2 |