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 | |
rajendrajaiswal | a157470 | 2019-02-14 10:29:45 +0000 | [diff] [blame] | 35 | # Get IP address of KAFKA, Zookeeper |
rajendrajaiswal | 47b64d7 | 2019-02-06 16:09:24 +0000 | [diff] [blame] | 36 | KAFKA_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $KAFKA) |
| 37 | ZOOKEEPER_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $ZOOKEEPER) |
rajendrajaiswal | 47b64d7 | 2019-02-06 16:09:24 +0000 | [diff] [blame] | 38 | |
rajendrajaiswal | 47b64d7 | 2019-02-06 16:09:24 +0000 | [diff] [blame] | 39 | # Shutdown DMAAP Container |
| 40 | docker kill $DMAAP |
| 41 | |
| 42 | # Initial docker-compose up and down is for populating kafka and zookeeper IPs in /var/tmp/MsgRtrApi.properites |
| 43 | sed -i -e '/config.zk.servers=/ s/=.*/='$ZOOKEEPER_IP'/' /var/tmp/MsgRtrApi.properties |
| 44 | sed -i -e '/kafka.metadata.broker.list=/ s/=.*/='$KAFKA_IP':9092/' /var/tmp/MsgRtrApi.properties |
| 45 | |
| 46 | # Start DMaaP MR containers with docker compose and configuration from docker-compose.yml |
| 47 | docker login -u docker -p docker nexus3.onap.org:10001 |
| 48 | docker-compose up -d |
| 49 | sleep 5 |
| 50 | |
rajendrajaiswal | a157470 | 2019-02-14 10:29:45 +0000 | [diff] [blame] | 51 | # Get IP address of DMAAP Message Router. |
| 52 | DMAAP_MR_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $DMAAP) |
| 53 | |
| 54 | # Clone DMaaP Data Router repo and Initialization of Data Router, Consul, Config Binding Service and Buscontroller |
rajendrajaiswal | 47b64d7 | 2019-02-06 16:09:24 +0000 | [diff] [blame] | 55 | mkdir -p $WORKSPACE/archives/dmaapdr |
| 56 | cd $WORKSPACE/archives/dmaapdr |
| 57 | git clone --depth 1 https://gerrit.onap.org/r/dmaap/datarouter -b master |
| 58 | cd $WORKSPACE/archives/dmaapdr/datarouter/datarouter-docker-compose/src/main/resources |
| 59 | mkdir docker-compose |
| 60 | cd $WORKSPACE/archives/dmaapdr/datarouter/datarouter-docker-compose/src/main/resources/docker-compose |
| 61 | 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 |
rajendrajaiswal | a157470 | 2019-02-14 10:29:45 +0000 | [diff] [blame] | 62 | cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/docker-databus-controller.conf /tmp/ |
| 63 | sed -i 's/DMAAPMR/'$DMAAP_MR_IP'/g' /tmp/docker-databus-controller.conf |
rajendrajaiswal | 47b64d7 | 2019-02-06 16:09:24 +0000 | [diff] [blame] | 64 | docker login -u docker -p docker nexus3.onap.org:10001 |
| 65 | docker-compose up -d |
| 66 | echo "Disregard the message ERROR: for datarouter-node Container 1234456 is unhealthy, this is expected behaiour at this stage" |
| 67 | docker kill datarouter-prov |
| 68 | docker kill datarouter-node |
| 69 | docker kill cbs |
| 70 | CONSUL_IP=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' consul ) |
| 71 | sed -i -e '/CONSUL_HOST:/ s/:.*/: '$CONSUL_IP'/' docker-compose.yml |
| 72 | MARIADB=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mariadb ) |
| 73 | sed -i 's/datarouter-mariadb/'$MARIADB'/g' $WORKSPACE/archives/dmaapdr/datarouter/datarouter-docker-compose/src/main/resources/prov_data/provserver.properties |
| 74 | docker-compose up -d |
rajendrajaiswal | 8f0afd8 | 2019-02-11 12:30:26 +0000 | [diff] [blame] | 75 | DR_PROV_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' datarouter-prov) |
| 76 | docker kill buscontroller |
rajendrajaiswal | a157470 | 2019-02-14 10:29:45 +0000 | [diff] [blame] | 77 | sed -i 's/DMAAPDR/'$DR_PROV_IP'/g' docker-compose.yml |
| 78 | sed -i 's/DMAAPMR/'$DMAAP_MR_IP'/g' docker-compose.yml |
rajendrajaiswal | 8f0afd8 | 2019-02-11 12:30:26 +0000 | [diff] [blame] | 79 | docker-compose up -d |
rajendrajaiswal | a157470 | 2019-02-14 10:29:45 +0000 | [diff] [blame] | 80 | sed -i 's/DMAAPDR/'$DR_PROV_IP'/g' /tmp/docker-databus-controller.conf |
rajendrajaiswal | 47b64d7 | 2019-02-06 16:09:24 +0000 | [diff] [blame] | 81 | |
rajendrajaiswal | a157470 | 2019-02-14 10:29:45 +0000 | [diff] [blame] | 82 | # Wait for initialization of Docker container for datarouter-node, datarouter-prov and mariadb, Consul, CBS, Buscontroller |
rajendrajaiswal | 47b64d7 | 2019-02-06 16:09:24 +0000 | [diff] [blame] | 83 | for i in {1..10}; do |
| 84 | if [ $(docker inspect --format '{{ .State.Running }}' datarouter-node) ] && \ |
| 85 | [ $(docker inspect --format '{{ .State.Running }}' datarouter-prov) ] && \ |
rajendrajaiswal | a157470 | 2019-02-14 10:29:45 +0000 | [diff] [blame] | 86 | [ $(docker inspect --format '{{ .State.Running }}' mariadb) ] && \ |
| 87 | [ $(docker inspect --format '{{ .State.Running }}' consul) ] && \ |
| 88 | [ $(docker inspect --format '{{ .State.Running }}' cbs) ] && \ |
| 89 | [ $(docker inspect --format '{{ .State.Running }}' buscontroller) ] |
rajendrajaiswal | 47b64d7 | 2019-02-06 16:09:24 +0000 | [diff] [blame] | 90 | then |
rajendrajaiswal | 140bfd2 | 2019-02-14 14:47:15 +0000 | [diff] [blame] | 91 | echo "Data Router, Consul, Config Binding Service, Buscontroller Services Running" |
rajendrajaiswal | 47b64d7 | 2019-02-06 16:09:24 +0000 | [diff] [blame] | 92 | break |
| 93 | else |
| 94 | echo sleep $i |
| 95 | sleep $i |
| 96 | fi |
| 97 | done |
rajendrajaiswal | 5f3f571 | 2019-02-27 11:35:09 +0000 | [diff] [blame] | 98 | sleep 15 |
rajendrajaiswal | a157470 | 2019-02-14 10:29:45 +0000 | [diff] [blame] | 99 | # Data Router Configuration. |
rajendrajaiswal | 47b64d7 | 2019-02-06 16:09:24 +0000 | [diff] [blame] | 100 | DR_NODE_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' datarouter-node) |
| 101 | DR_GATEWAY_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.Gateway}}{{end}}' datarouter-prov) |
rajendrajaiswal | 47b64d7 | 2019-02-06 16:09:24 +0000 | [diff] [blame] | 102 | 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" |
| 103 | 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" |
| 104 | docker exec datarouter-prov /bin/sh -c "echo '${DR_NODE_IP}' dmaap-dr-node >> /etc/hosts" |
| 105 | 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] | 106 | |
| 107 | # Bus Controller Configuration |
| 108 | DMAAPBC_IP=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' buscontroller) |
| 109 | $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/dmaapbc.sh ${DMAAPBC_IP} |
rajendrajaiswal | 47b64d7 | 2019-02-06 16:09:24 +0000 | [diff] [blame] | 110 | |
| 111 | # Consul Configuration for PM Mapper |
| 112 | cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/cbs.json /tmp/cbs.json |
| 113 | sed -i 's/ipaddress/'${CBS_IP}'/g' /tmp/cbs.json |
| 114 | curl --request PUT --data @/tmp/cbs.json http://$CONSUL_IP:8500/v1/agent/service/register |
| 115 | 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 |
| 116 | |
rajendrajaiswal | a157470 | 2019-02-14 10:29:45 +0000 | [diff] [blame] | 117 | # PM Mapper startup and configuration |
| 118 | mkdir /tmp/docker-compose |
| 119 | cd /tmp/docker-compose |
| 120 | cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/composefile/docker-compose-pmmapper.yml /tmp/docker-compose/docker-compose.yml |
| 121 | CBS_IP=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' cbs) |
| 122 | sed -i 's/CBSIP/'$CBS_IP'/g' docker-compose.yml |
| 123 | sed -i 's/BUSIP/'$DMAAPBC_IP'/g' docker-compose.yml |
JoeOLeary | 667bd59 | 2019-03-05 09:21:26 +0000 | [diff] [blame] | 124 | sed -i 's/DRNODEIP/'$DR_NODE_IP'/g' docker-compose.yml |
rajendrajaiswal | a157470 | 2019-02-14 10:29:45 +0000 | [diff] [blame] | 125 | docker-compose up -d |
rajendrajaiswal | 140bfd2 | 2019-02-14 14:47:15 +0000 | [diff] [blame] | 126 | |
| 127 | # Wait for initialization of Docker container for 3GPP PM Mapper |
| 128 | for i in {1..10}; do |
| 129 | if [ $(docker inspect --format '{{ .State.Running }}' pmmapper) ] |
| 130 | then |
| 131 | echo "PM Mapper Service Running" |
| 132 | break |
| 133 | else |
| 134 | echo sleep $i |
| 135 | sleep $i |
| 136 | fi |
| 137 | done |
rajendrajaiswal | a157470 | 2019-02-14 10:29:45 +0000 | [diff] [blame] | 138 | PMMAPPER_IP=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' pmmapper) |
rajendrajaiswal | 140bfd2 | 2019-02-14 14:47:15 +0000 | [diff] [blame] | 139 | docker exec datarouter-prov /bin/sh -c "echo '${PMMAPPER_IP}' 3gpppmmapper >> /etc/hosts" |
JoeOLeary | 667bd59 | 2019-03-05 09:21:26 +0000 | [diff] [blame] | 140 | docker exec datarouter-node /bin/sh -c "echo '${PMMAPPER_IP}' 3gpppmmapper >> /etc/hosts" |
rajendrajaiswal | a157470 | 2019-02-14 10:29:45 +0000 | [diff] [blame] | 141 | sleep 10 |
rajendrajaiswal | 7f7dab0 | 2019-02-15 10:23:53 +0000 | [diff] [blame] | 142 | docker exec pmmapper /bin/sh -c "cat /var/log/ONAP/dcaegen2/services/pm-mapper/pm-mapper_output.log" > /tmp/pmmapper.log |
| 143 | cat /tmp/pmmapper.log |
rajendrajaiswal | 95e6fa7 | 2019-02-27 13:43:30 +0000 | [diff] [blame] | 144 | docker exec buscontroller /bin/sh -c "cat /opt/app/dmaapbc/logs/ONAP/application.log" |
rajendrajaiswal | a157470 | 2019-02-14 10:29:45 +0000 | [diff] [blame] | 145 | curl -k https://$DR_PROV_IP:8443/internal/prov |
| 146 | |
rajendrajaiswal | 47b64d7 | 2019-02-06 16:09:24 +0000 | [diff] [blame] | 147 | #Pass any variables required by Robot test suites in ROBOT_VARIABLES |
rajendrajaiswal | b60c9ee | 2019-03-15 12:31:17 +0000 | [diff] [blame] | 148 | ROBOT_VARIABLES="-v CONSUL_IP:${CONSUL_IP} -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 PMMAPPER_IP:${PMMAPPER_IP} -v DR_NODE_IP:${DR_NODE_IP}" |