rajendrajaiswal | 47b64d7 | 2019-02-06 16:09:24 +0000 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # Place the scripts in run order: |
| 3 | source ${SCRIPTS}/common_functions.sh |
| 4 | |
| 5 | # Clone DMaaP Message Router repo |
| 6 | mkdir -p $WORKSPACE/archives/dmaapmr |
| 7 | cd $WORKSPACE/archives/dmaapmr |
| 8 | git clone --depth 1 http://gerrit.onap.org/r/dmaap/messagerouter/messageservice -b master |
| 9 | sed -i 's/enableCadi: false/enableCadi: "false"/g' /$WORKSPACE/archives/dmaapmr/messageservice/src/main/resources/docker-compose/docker-compose.yml |
| 10 | cd $WORKSPACE/archives/dmaapmr/messageservice/src/main/resources/docker-compose |
| 11 | cp $WORKSPACE/archives/dmaapmr/messageservice/bundleconfig-local/etc/appprops/MsgRtrApi.properties /var/tmp/ |
| 12 | |
| 13 | # start DMaaP MR containers with docker compose and configuration from docker-compose.yml |
| 14 | docker login -u docker -p docker nexus3.onap.org:10001 |
| 15 | docker-compose up -d |
| 16 | |
| 17 | ZOOKEEPER=$(docker ps -a -q --filter="name=zookeeper_1") |
| 18 | KAFKA=$(docker ps -a -q --filter="name=kafka_1") |
| 19 | DMAAP=$(docker ps -a -q --filter="name=dmaap_1") |
| 20 | |
| 21 | # Wait for initialization of Docker contaienr for DMaaP MR, Kafka and Zookeeper |
| 22 | for i in {1..10}; do |
| 23 | if [ $(docker inspect --format '{{ .State.Running }}' $KAFKA) ] && \ |
| 24 | [ $(docker inspect --format '{{ .State.Running }}' $ZOOKEEPER) ] && \ |
| 25 | [ $(docker inspect --format '{{ .State.Running }}' $DMAAP) ] |
| 26 | then |
| 27 | echo "DMaaP Service Running" |
| 28 | break |
| 29 | else |
| 30 | echo sleep $i |
| 31 | sleep $i |
| 32 | fi |
| 33 | done |
| 34 | |
| 35 | # Get IP address of DMAAP, KAFKA, Zookeeper |
| 36 | KAFKA_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $KAFKA) |
| 37 | ZOOKEEPER_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $ZOOKEEPER) |
| 38 | DMAAP_MR_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $DMAAP) |
| 39 | |
| 40 | sleep 2 |
| 41 | # Shutdown DMAAP Container |
| 42 | docker kill $DMAAP |
| 43 | |
| 44 | # Initial docker-compose up and down is for populating kafka and zookeeper IPs in /var/tmp/MsgRtrApi.properites |
| 45 | sed -i -e '/config.zk.servers=/ s/=.*/='$ZOOKEEPER_IP'/' /var/tmp/MsgRtrApi.properties |
| 46 | sed -i -e '/kafka.metadata.broker.list=/ s/=.*/='$KAFKA_IP':9092/' /var/tmp/MsgRtrApi.properties |
| 47 | |
| 48 | # Start DMaaP MR containers with docker compose and configuration from docker-compose.yml |
| 49 | docker login -u docker -p docker nexus3.onap.org:10001 |
| 50 | docker-compose up -d |
| 51 | sleep 5 |
| 52 | |
| 53 | # Clone DMaaP Data Router repo |
| 54 | mkdir -p $WORKSPACE/archives/dmaapdr |
| 55 | cd $WORKSPACE/archives/dmaapdr |
| 56 | git clone --depth 1 https://gerrit.onap.org/r/dmaap/datarouter -b master |
| 57 | cd $WORKSPACE/archives/dmaapdr/datarouter/datarouter-docker-compose/src/main/resources |
| 58 | mkdir docker-compose |
| 59 | cd $WORKSPACE/archives/dmaapdr/datarouter/datarouter-docker-compose/src/main/resources/docker-compose |
| 60 | cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/composefile/docker-compose-e2e.yml $WORKSPACE/archives/dmaapdr/datarouter/datarouter-docker-compose/src/main/resources/docker-compose/docker-compose.yml |
| 61 | |
| 62 | docker login -u docker -p docker nexus3.onap.org:10001 |
| 63 | docker-compose up -d |
| 64 | echo "Disregard the message ERROR: for datarouter-node Container 1234456 is unhealthy, this is expected behaiour at this stage" |
| 65 | docker kill datarouter-prov |
| 66 | docker kill datarouter-node |
| 67 | docker kill cbs |
| 68 | CONSUL_IP=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' consul ) |
| 69 | sed -i -e '/CONSUL_HOST:/ s/:.*/: '$CONSUL_IP'/' docker-compose.yml |
| 70 | MARIADB=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mariadb ) |
| 71 | sed -i 's/datarouter-mariadb/'$MARIADB'/g' $WORKSPACE/archives/dmaapdr/datarouter/datarouter-docker-compose/src/main/resources/prov_data/provserver.properties |
| 72 | docker-compose up -d |
rajendrajaiswal | 8f0afd8 | 2019-02-11 12:30:26 +0000 | [diff] [blame] | 73 | DR_PROV_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' datarouter-prov) |
| 74 | docker kill buscontroller |
| 75 | sed -i 's/dr-prov-ip/'$DR_PROV_IP'/g' docker-compose.yml |
| 76 | docker-compose up -d |
rajendrajaiswal | 47b64d7 | 2019-02-06 16:09:24 +0000 | [diff] [blame] | 77 | |
| 78 | # Wait for initialization of Docker container for datarouter-node, datarouter-prov and mariadb |
| 79 | for i in {1..10}; do |
| 80 | if [ $(docker inspect --format '{{ .State.Running }}' datarouter-node) ] && \ |
| 81 | [ $(docker inspect --format '{{ .State.Running }}' datarouter-prov) ] && \ |
| 82 | [ $(docker inspect --format '{{ .State.Running }}' mariadb) ] |
| 83 | then |
| 84 | echo "DR Service Running" |
| 85 | break |
| 86 | else |
| 87 | echo sleep $i |
| 88 | sleep $i |
| 89 | fi |
| 90 | done |
| 91 | |
| 92 | sleep 5 |
| 93 | |
| 94 | # Get IP address of datarrouger-prov, datarouter-node, fileconsumer-node. |
| 95 | DR_PROV_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' datarouter-prov) |
| 96 | DR_NODE_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' datarouter-node) |
| 97 | DR_GATEWAY_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.Gateway}}{{end}}' datarouter-prov) |
| 98 | |
| 99 | # Get IP address of DMAAP, KAFKA, Zookeeper, ConfigBindingService |
| 100 | DMAAP_MR_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $DMAAP) |
| 101 | KAFKA_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $KAFKA) |
| 102 | ZOOKEEPER_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $ZOOKEEPER) |
| 103 | CBS_IP=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' cbs) |
| 104 | |
| 105 | # Data Router Configuration: |
| 106 | # Create default feed on data router |
| 107 | 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" |
| 108 | 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" |
| 109 | docker exec datarouter-prov /bin/sh -c "echo '${DR_NODE_IP}' dmaap-dr-node >> /etc/hosts" |
| 110 | docker exec datarouter-node /bin/sh -c "echo '${DR_PROV_IP}' dmaap-dr-prov >> /etc/hosts" |
rajendrajaiswal | 8f0afd8 | 2019-02-11 12:30:26 +0000 | [diff] [blame] | 111 | |
| 112 | # Bus Controller Configuration |
| 113 | DMAAPBC_IP=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' buscontroller) |
| 114 | $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/dmaapbc.sh ${DMAAPBC_IP} |
rajendrajaiswal | 47b64d7 | 2019-02-06 16:09:24 +0000 | [diff] [blame] | 115 | |
| 116 | # Consul Configuration for PM Mapper |
| 117 | cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/cbs.json /tmp/cbs.json |
| 118 | sed -i 's/ipaddress/'${CBS_IP}'/g' /tmp/cbs.json |
| 119 | curl --request PUT --data @/tmp/cbs.json http://$CONSUL_IP:8500/v1/agent/service/register |
| 120 | curl 'http://'$CONSUL_IP':8500/v1/kv/pmmapper?dc=dc1' -X PUT -H 'Accept: application/^Con' -H 'Content-Type: application/json' -H 'X-Requested-With: XMLHttpRequest' --data @$WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/config.json |
| 121 | |
| 122 | #Pass any variables required by Robot test suites in ROBOT_VARIABLES |
rajendrajaiswal | 8f0afd8 | 2019-02-11 12:30:26 +0000 | [diff] [blame] | 123 | ROBOT_VARIABLES="-v DR_PROV_IP:${DR_PROV_IP} -v DMAAPBC_IP:${DMAAPBC_IP} -v DMAAP_MR_IP:${DMAAP_MR_IP} -v CBS_IP:${CBS_IP} -v DR_SUBSCIBER_IP:${DR_SUBSCIBER_IP}" |