Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [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 |
LiamBurke | ae583be | 2018-10-16 10:44:12 +0000 | [diff] [blame] | 9 | sed -i 's/enableCadi: false/enableCadi: "false"/g' /$WORKSPACE/archives/dmaapmr/messageservice/src/main/resources/docker-compose/docker-compose.yml |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 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 |
LiamBurke | f708f84 | 2018-10-10 09:26:26 +0000 | [diff] [blame] | 22 | for i in {1..10}; do |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 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 |
LiamBurke | 1344ef2 | 2018-10-19 15:22:16 +0000 | [diff] [blame] | 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/usecases/5G-bulkpm/composefile/docker-compose-e2e.yml $WORKSPACE/archives/dmaapdr/datarouter/datarouter-docker-compose/src/main/resources/docker-compose/docker-compose.yml |
| 61 | |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 62 | docker login -u docker -p docker nexus3.onap.org:10001 |
| 63 | docker-compose up -d |
LiamBurke | ca7df55 | 2018-10-26 13:57:21 +0000 | [diff] [blame] | 64 | echo "Disregard the message ERROR: for datarouter-node Container 1234456 is unhealthy, this is expected behaiour at this stage" |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 65 | docker kill datarouter-prov |
| 66 | docker kill datarouter-node |
| 67 | docker kill vescollector |
| 68 | HOST_IP=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $NF}') |
| 69 | sed -i -e '/DMAAPHOST:/ s/:.*/: '$HOST_IP'/' docker-compose.yml |
| 70 | MARIADB=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mariadb ) |
LiamBurke | 1344ef2 | 2018-10-19 15:22:16 +0000 | [diff] [blame] | 71 | sed -i 's/datarouter-mariadb/'$MARIADB'/g' $WORKSPACE/archives/dmaapdr/datarouter/datarouter-docker-compose/src/main/resources/prov_data/provserver.properties |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 72 | docker-compose up -d |
| 73 | |
| 74 | # Wait for initialization of Docker container for datarouter-node, datarouter-prov and mariadb |
LiamBurke | f708f84 | 2018-10-10 09:26:26 +0000 | [diff] [blame] | 75 | for i in {1..10}; do |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 76 | if [ $(docker inspect --format '{{ .State.Running }}' datarouter-node) ] && \ |
| 77 | [ $(docker inspect --format '{{ .State.Running }}' datarouter-prov) ] && \ |
| 78 | [ $(docker inspect --format '{{ .State.Running }}' mariadb) ] |
| 79 | then |
| 80 | echo "DR Service Running" |
| 81 | break |
| 82 | else |
| 83 | echo sleep $i |
| 84 | sleep $i |
| 85 | fi |
| 86 | done |
| 87 | |
| 88 | sleep 5 |
| 89 | |
| 90 | # Get IP address of datarrouger-prov, datarouter-node, fileconsumer-node. |
| 91 | DR_PROV_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' datarouter-prov) |
| 92 | DR_NODE_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' datarouter-node) |
| 93 | DR_SUBSCIBER_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' fileconsumer-node) |
| 94 | DR_GATEWAY_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.Gateway}}{{end}}' datarouter-prov) |
| 95 | |
| 96 | echo DR_PROV_IP=${DR_PROV_IP} |
| 97 | echo DR_NODE_IP=${DR_NODE_IP} |
| 98 | echo DR_GATEWAY_IP=${DR_GATEWAY_IP} |
| 99 | echo DR_SUBSCIBER_IP=${DR_SUBSCIBER_IP} |
| 100 | |
| 101 | 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" |
| 102 | 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" |
| 103 | docker exec datarouter-prov /bin/sh -c "echo '${DR_NODE_IP}' dmaap-dr-node >> /etc/hosts" |
| 104 | docker exec datarouter-node /bin/sh -c "echo '${DR_PROV_IP}' dmaap-dr-prov >> /etc/hosts" |
| 105 | docker exec datarouter-node /bin/sh -c "echo '${DR_SUBSCIBER_IP}' dmaap-dr-subscriber >> /etc/hosts" |
| 106 | |
| 107 | # Get IP address of DMAAP, KAFKA, Zookeeper |
| 108 | DMAAP_MR_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $DMAAP) |
| 109 | KAFKA_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $KAFKA) |
| 110 | ZOOKEEPER_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $ZOOKEEPER) |
| 111 | VESC_IP=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' vescollector) |
| 112 | SFTP_IP=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' sftp) |
| 113 | |
| 114 | export VESC_IP=${VESC_IP} |
| 115 | export HOST_IP=${HOST_IP} |
| 116 | export DMAAP_MR_IP=${DMAAP_MR_IP} |
| 117 | |
| 118 | #Pass any variables required by Robot test suites in ROBOT_VARIABLES |
| 119 | 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} -v DR_SUBSCIBER_IP:${DR_SUBSCIBER_IP}" |
| 120 | |
| 121 | pip install jsonschema uuid |
| 122 | # Wait container ready |
| 123 | sleep 2 |
| 124 | |
| 125 | # Data File Collector configuration : |
Gary Wu | 13111e9 | 2018-09-27 11:31:33 -0700 | [diff] [blame] | 126 | cp $WORKSPACE/plans/usecases/5G-bulkpm/assets/datafile_endpoints.json /tmp/ |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 127 | sed -i 's/dmaapmrhost/'${DMAAP_MR_IP}'/g' /tmp/datafile_endpoints.json |
| 128 | sed -i 's/dmaapdrhost/'${DR_PROV_IP}'/g' /tmp/datafile_endpoints.json |
| 129 | docker cp /tmp/datafile_endpoints.json dfc:/config/ |
LiamBurke | ca7df55 | 2018-10-26 13:57:21 +0000 | [diff] [blame] | 130 | #Increase Logging |
| 131 | docker exec dfc /bin/sh -c " sed -i 's/org.onap.dcaegen2.collectors.datafile: ERROR/org.onap.dcaegen2.collectors.datafile: TRACE/g' /config/application.yaml" |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 132 | docker restart dfc |
rajendrajaiswal | a2c1ca2 | 2018-09-30 16:42:27 +0100 | [diff] [blame] | 133 | docker exec dfc /bin/sh -c "echo '${DR_NODE_IP}' dmaap-dr-node >> /etc/hosts" |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 134 | |
| 135 | # SFTP Configuration: |
| 136 | # Update the File Ready Notification with actual sftp ip address and copy pm files to sftp server. |
rajendrajaiswal | 0d357f3 | 2018-09-28 10:18:19 +0100 | [diff] [blame] | 137 | cp $WORKSPACE/tests/usecases/5G-bulkpm/assets/json_events/FileExistNotification.json $WORKSPACE/tests/usecases/5G-bulkpm/assets/json_events/FileExistNotificationUpdated.json |
Gary Wu | 13111e9 | 2018-09-27 11:31:33 -0700 | [diff] [blame] | 138 | sed -i 's/sftpserver/'${SFTP_IP}'/g' $WORKSPACE/tests/usecases/5G-bulkpm/assets/json_events/FileExistNotificationUpdated.json |
| 139 | docker cp $WORKSPACE/plans/usecases/5G-bulkpm/assets/xNF.pm.xml.gz sftp:/home/admin/ |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 140 | |
| 141 | # Data Router Configuration: |
| 142 | # Create default feed and create file consumer subscriber on data router |
Gary Wu | 13111e9 | 2018-09-27 11:31:33 -0700 | [diff] [blame] | 143 | curl -v -X POST -H "Content-Type:application/vnd.att-dr.feed" -H "X-ATT-DR-ON-BEHALF-OF:dradmin" --data-ascii @$WORKSPACE/plans/usecases/5G-bulkpm/assets/createFeed.json --post301 --location-trusted -k https://${DR_PROV_IP}:8443 |
| 144 | cp $WORKSPACE/plans/usecases/5G-bulkpm/assets/addSubscriber.json /tmp/addSubscriber.json |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 145 | sed -i 's/fileconsumer/'${DR_SUBSCIBER_IP}'/g' /tmp/addSubscriber.json |
rajendrajaiswal | a2c1ca2 | 2018-09-30 16:42:27 +0100 | [diff] [blame] | 146 | curl -v -X POST -H "Content-Type:application/vnd.att-dr.subscription" -H "X-ATT-DR-ON-BEHALF-OF:dradmin" --data-ascii @/tmp/addSubscriber.json --post301 --location-trusted -k https://${DR_PROV_IP}:8443/subscribe/1 |
rajendrajaiswal | b99eedc | 2018-10-02 09:42:23 +0100 | [diff] [blame] | 147 | sleep 10 |
LiamBurke | f708f84 | 2018-10-10 09:26:26 +0000 | [diff] [blame] | 148 | curl -k https://$DR_PROV_IP:8443/internal/prov |