Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 1 | #!/bin/bash |
LiamBurke | cf7c8ca | 2019-03-15 15:25:23 +0000 | [diff] [blame] | 2 | # Place the scripts in run order: |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 3 | source ${SCRIPTS}/common_functions.sh |
| 4 | |
LiamBurke | a451619 | 2019-02-11 12:28:55 +0000 | [diff] [blame] | 5 | CSIT=TRUE |
| 6 | if [ ${CSIT} = "TRUE" ] ; then |
| 7 | #################################################### |
| 8 | #Executes the below setup in an Docker Environment # |
| 9 | #################################################### |
| 10 | |
| 11 | echo "CSIT Test get executed in here" |
| 12 | SFTP_PORT=22 |
| 13 | VESC_PORT=8080 |
| 14 | export VESC_PORT=${VESC_PORT} |
| 15 | export CLI_EXEC_CLI_DFC="docker exec dfc /bin/sh -c \"ls /target | grep .gz\"" |
| 16 | |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 17 | # Clone DMaaP Message Router repo |
| 18 | mkdir -p $WORKSPACE/archives/dmaapmr |
| 19 | cd $WORKSPACE/archives/dmaapmr |
| 20 | 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] | 21 | 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] | 22 | cd $WORKSPACE/archives/dmaapmr/messageservice/src/main/resources/docker-compose |
| 23 | cp $WORKSPACE/archives/dmaapmr/messageservice/bundleconfig-local/etc/appprops/MsgRtrApi.properties /var/tmp/ |
| 24 | |
| 25 | # start DMaaP MR containers with docker compose and configuration from docker-compose.yml |
| 26 | docker login -u docker -p docker nexus3.onap.org:10001 |
| 27 | docker-compose up -d |
| 28 | |
| 29 | ZOOKEEPER=$(docker ps -a -q --filter="name=zookeeper_1") |
| 30 | KAFKA=$(docker ps -a -q --filter="name=kafka_1") |
| 31 | DMAAP=$(docker ps -a -q --filter="name=dmaap_1") |
| 32 | |
| 33 | # Wait for initialization of Docker contaienr for DMaaP MR, Kafka and Zookeeper |
LiamBurke | f708f84 | 2018-10-10 09:26:26 +0000 | [diff] [blame] | 34 | for i in {1..10}; do |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 35 | if [ $(docker inspect --format '{{ .State.Running }}' $KAFKA) ] && \ |
| 36 | [ $(docker inspect --format '{{ .State.Running }}' $ZOOKEEPER) ] && \ |
| 37 | [ $(docker inspect --format '{{ .State.Running }}' $DMAAP) ] |
| 38 | then |
| 39 | echo "DMaaP Service Running" |
| 40 | break |
| 41 | else |
| 42 | echo sleep $i |
| 43 | sleep $i |
| 44 | fi |
| 45 | done |
| 46 | |
| 47 | # Get IP address of DMAAP, KAFKA, Zookeeper |
| 48 | KAFKA_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $KAFKA) |
| 49 | ZOOKEEPER_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $ZOOKEEPER) |
| 50 | DMAAP_MR_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $DMAAP) |
| 51 | |
| 52 | sleep 2 |
| 53 | # Shutdown DMAAP Container |
| 54 | docker kill $DMAAP |
| 55 | |
| 56 | # Initial docker-compose up and down is for populating kafka and zookeeper IPs in /var/tmp/MsgRtrApi.properites |
| 57 | sed -i -e '/config.zk.servers=/ s/=.*/='$ZOOKEEPER_IP'/' /var/tmp/MsgRtrApi.properties |
| 58 | sed -i -e '/kafka.metadata.broker.list=/ s/=.*/='$KAFKA_IP':9092/' /var/tmp/MsgRtrApi.properties |
| 59 | |
| 60 | # Start DMaaP MR containers with docker compose and configuration from docker-compose.yml |
| 61 | docker login -u docker -p docker nexus3.onap.org:10001 |
| 62 | docker-compose up -d |
| 63 | sleep 5 |
| 64 | |
| 65 | # Clone DMaaP Data Router repo |
| 66 | mkdir -p $WORKSPACE/archives/dmaapdr |
| 67 | cd $WORKSPACE/archives/dmaapdr |
| 68 | git clone --depth 1 https://gerrit.onap.org/r/dmaap/datarouter -b master |
LiamBurke | 1344ef2 | 2018-10-19 15:22:16 +0000 | [diff] [blame] | 69 | cd $WORKSPACE/archives/dmaapdr/datarouter/datarouter-docker-compose/src/main/resources |
| 70 | mkdir docker-compose |
| 71 | cd $WORKSPACE/archives/dmaapdr/datarouter/datarouter-docker-compose/src/main/resources/docker-compose |
| 72 | 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 |
LiamBurke | 3608af7 | 2019-03-12 22:50:33 +0000 | [diff] [blame] | 73 | cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/docker-databus-controller.conf /tmp/ |
| 74 | sed -i 's/DMAAPMR/'$DMAAP_MR_IP'/g' /tmp/docker-databus-controller.conf |
LiamBurke | 1344ef2 | 2018-10-19 15:22:16 +0000 | [diff] [blame] | 75 | |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 76 | docker login -u docker -p docker nexus3.onap.org:10001 |
| 77 | docker-compose up -d |
LiamBurke | ca7df55 | 2018-10-26 13:57:21 +0000 | [diff] [blame] | 78 | 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] | 79 | docker kill vescollector |
LiamBurke | 3608af7 | 2019-03-12 22:50:33 +0000 | [diff] [blame] | 80 | docker kill cbs |
LiamBurke | 248195d | 2019-04-03 10:21:12 +0100 | [diff] [blame] | 81 | sleep 10 |
LiamBurke | 3608af7 | 2019-03-12 22:50:33 +0000 | [diff] [blame] | 82 | CONSUL_IP=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' consul ) |
| 83 | sed -i -e '/CONSUL_HOST:/ s/:.*/: '$CONSUL_IP'/' docker-compose.yml |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 84 | HOST_IP=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $NF}') |
| 85 | sed -i -e '/DMAAPHOST:/ s/:.*/: '$HOST_IP'/' docker-compose.yml |
| 86 | MARIADB=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mariadb ) |
LiamBurke | 1344ef2 | 2018-10-19 15:22:16 +0000 | [diff] [blame] | 87 | 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] | 88 | docker-compose up -d |
LiamBurke | 248195d | 2019-04-03 10:21:12 +0100 | [diff] [blame] | 89 | sleep 5 |
| 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 kill datarouter-node |
| 102 | docker kill datarouter-prov |
| 103 | sed -i 's/1.1.1.1/'$DR_NODE_IP'/g' docker-compose.yml |
| 104 | sed -i 's/2.2.2.2/'$DR_PROV_IP'/g' docker-compose.yml |
| 105 | docker-compose up -d |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 106 | |
| 107 | # Wait for initialization of Docker container for datarouter-node, datarouter-prov and mariadb |
LiamBurke | f708f84 | 2018-10-10 09:26:26 +0000 | [diff] [blame] | 108 | for i in {1..10}; do |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 109 | if [ $(docker inspect --format '{{ .State.Running }}' datarouter-node) ] && \ |
| 110 | [ $(docker inspect --format '{{ .State.Running }}' datarouter-prov) ] && \ |
| 111 | [ $(docker inspect --format '{{ .State.Running }}' mariadb) ] |
| 112 | then |
| 113 | echo "DR Service Running" |
| 114 | break |
| 115 | else |
| 116 | echo sleep $i |
| 117 | sleep $i |
| 118 | fi |
| 119 | done |
| 120 | |
| 121 | sleep 5 |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 122 | |
| 123 | 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" |
| 124 | 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" |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 125 | docker exec datarouter-node /bin/sh -c "echo '${DR_SUBSCIBER_IP}' dmaap-dr-subscriber >> /etc/hosts" |
| 126 | |
LiamBurke | 248195d | 2019-04-03 10:21:12 +0100 | [diff] [blame] | 127 | |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 128 | # Get IP address of DMAAP, KAFKA, Zookeeper |
| 129 | DMAAP_MR_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $DMAAP) |
| 130 | KAFKA_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $KAFKA) |
| 131 | ZOOKEEPER_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $ZOOKEEPER) |
| 132 | VESC_IP=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' vescollector) |
| 133 | SFTP_IP=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' sftp) |
| 134 | |
| 135 | export VESC_IP=${VESC_IP} |
| 136 | export HOST_IP=${HOST_IP} |
| 137 | export DMAAP_MR_IP=${DMAAP_MR_IP} |
| 138 | |
LiamBurke | 3608af7 | 2019-03-12 22:50:33 +0000 | [diff] [blame] | 139 | |
LiamBurke | f8d0c2e | 2019-03-13 12:47:16 +0000 | [diff] [blame] | 140 | # Data File Collector configuration : |
| 141 | sed -i 's/DR_NODE_IP/'$DR_NODE_IP'/g' docker-compose.yml |
| 142 | cp $WORKSPACE/plans/usecases/5G-bulkpm/assets/datafile_endpoints.json /tmp/ |
| 143 | sed -i 's/dmaapmrhost/'${DMAAP_MR_IP}'/g' /tmp/datafile_endpoints.json |
| 144 | sed -i 's/dmaapdrhost/'${DR_PROV_IP}'/g' /tmp/datafile_endpoints.json |
| 145 | echo data_endpoints.json to be copied onto the DFC containter |
| 146 | cat /tmp/datafile_endpoints.json |
| 147 | docker-compose up -d |
| 148 | sleep 2 |
| 149 | # DFC is now online |
| 150 | docker cp dfc:/opt/app/datafile/config/datafile_endpoints.json /tmp/datafile_endpoints.json.fromcontainer |
| 151 | echo data_endpoints.json from DFC containter |
| 152 | cat /tmp/datafile_endpoints.json.fromcontainer |
| 153 | docker cp /tmp/datafile_endpoints.json dfc:/opt/app/datafile/config/ |
| 154 | #Increase Logging |
LiamBurke | b86a8bc | 2019-03-26 22:25:10 +0000 | [diff] [blame] | 155 | docker exec dfc /bin/sh -c " sed -i 's/org.onap.dcaegen2.collectors.datafile: WARN/org.onap.dcaegen2.collectors.datafile: TRACE/g' /opt/app/datafile/config/application.yaml" |
LiamBurke | f8d0c2e | 2019-03-13 12:47:16 +0000 | [diff] [blame] | 156 | docker restart dfc |
| 157 | sleep 2 |
| 158 | |
LiamBurke | 248195d | 2019-04-03 10:21:12 +0100 | [diff] [blame] | 159 | # Wait for initialization of Docker container for datarouter-node, datarouter-prov and mariadb, Consul, CBS |
LiamBurke | 3608af7 | 2019-03-12 22:50:33 +0000 | [diff] [blame] | 160 | for i in {1..10}; do |
| 161 | if [ $(docker inspect --format '{{ .State.Running }}' consul) ] && \ |
LiamBurke | 248195d | 2019-04-03 10:21:12 +0100 | [diff] [blame] | 162 | [ $(docker inspect --format '{{ .State.Running }}' cbs) ] |
LiamBurke | 3608af7 | 2019-03-12 22:50:33 +0000 | [diff] [blame] | 163 | then |
LiamBurke | 248195d | 2019-04-03 10:21:12 +0100 | [diff] [blame] | 164 | echo "Data Router, Consul, Config Binding Service Services Running" |
LiamBurke | 3608af7 | 2019-03-12 22:50:33 +0000 | [diff] [blame] | 165 | break |
| 166 | else |
| 167 | echo sleep $i |
| 168 | sleep $i |
| 169 | fi |
| 170 | done |
| 171 | sleep 10 |
| 172 | |
LiamBurke | cf7c8ca | 2019-03-15 15:25:23 +0000 | [diff] [blame] | 173 | pip install jsonschema uuid simplejson |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 174 | # Wait container ready |
| 175 | sleep 2 |
| 176 | |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 177 | # 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] | 178 | 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] | 179 | sed -i 's/sftpserver/'${SFTP_IP}'/g' $WORKSPACE/tests/usecases/5G-bulkpm/assets/json_events/FileExistNotificationUpdated.json |
LiamBurke | a451619 | 2019-02-11 12:28:55 +0000 | [diff] [blame] | 180 | sed -i 's/sftpport/'${SFTP_PORT}'/g' $WORKSPACE/tests/usecases/5G-bulkpm/assets/json_events/FileExistNotificationUpdated.json |
Gary Wu | 13111e9 | 2018-09-27 11:31:33 -0700 | [diff] [blame] | 181 | 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] | 182 | |
| 183 | # Data Router Configuration: |
| 184 | # Create default feed and create file consumer subscriber on data router |
egernug | 6f2874b | 2019-02-06 15:16:54 +0000 | [diff] [blame] | 185 | curl -v -X POST -H "Content-Type:application/vnd.dmaap-dr.feed" -H "X-DMAAP-DR-ON-BEHALF-OF:dradmin" --data-ascii @$WORKSPACE/plans/usecases/5G-bulkpm/assets/createFeed.json --post301 --location-trusted -k https://${DR_PROV_IP}:8443 |
Gary Wu | 13111e9 | 2018-09-27 11:31:33 -0700 | [diff] [blame] | 186 | cp $WORKSPACE/plans/usecases/5G-bulkpm/assets/addSubscriber.json /tmp/addSubscriber.json |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 187 | sed -i 's/fileconsumer/'${DR_SUBSCIBER_IP}'/g' /tmp/addSubscriber.json |
egernug | 6f2874b | 2019-02-06 15:16:54 +0000 | [diff] [blame] | 188 | curl -v -X POST -H "Content-Type:application/vnd.dmaap-dr.subscription" -H "X-DMAAP-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] | 189 | sleep 10 |
LiamBurke | f708f84 | 2018-10-10 09:26:26 +0000 | [diff] [blame] | 190 | curl -k https://$DR_PROV_IP:8443/internal/prov |
LiamBurke | a451619 | 2019-02-11 12:28:55 +0000 | [diff] [blame] | 191 | |
LiamBurke | f9d624a | 2019-04-10 10:41:26 +0100 | [diff] [blame^] | 192 | # Consul Configuration for PM Mapper |
| 193 | cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/cbs.json /tmp/cbs.json |
| 194 | sed -i 's/ipaddress/'${CBS_IP}'/g' /tmp/cbs.json |
| 195 | curl --request PUT --data @/tmp/cbs.json http://$CONSUL_IP:8500/v1/agent/service/register |
| 196 | curl 'http://'$CONSUL_IP':8500/v1/kv/pmmapper?dc=dc1' -X PUT -H 'Accept: application/json' -H 'Content-Type: application/json' -H 'X-Requested-With: XMLHttpRequest' --data @$WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/config.json |
| 197 | |
| 198 | # PM Mapper startup and configuration |
| 199 | mkdir /tmp/docker-compose |
| 200 | cd /tmp/docker-compose |
| 201 | cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/composefile/docker-compose-pmmapper.yml /tmp/docker-compose/docker-compose.yml |
| 202 | CBS_IP=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' cbs) |
| 203 | sed -i 's/CBSIP/'$CBS_IP'/g' docker-compose.yml |
| 204 | sed -i 's/1.1.1.1/'$DR_NODE_IP'/g' docker-compose.yml |
| 205 | sed -i 's/4.4.4.4/'$DMAAP_MR_IP'/g' docker-compose.yml |
| 206 | docker-compose up -d |
| 207 | |
| 208 | # Setting up PM Mapper certs. |
| 209 | docker cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/cert.jks.b64 pmmapper:opt/app/pm-mapper/etc/ |
| 210 | docker cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/jks.pass pmmapper:opt/app/pm-mapper/etc/ |
| 211 | docker cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/trust.jks.b64 pmmapper:opt/app/pm-mapper/etc/ |
| 212 | docker cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/trust.pass pmmapper:opt/app/pm-mapper/etc/ |
| 213 | docker restart pmmapper |
| 214 | |
| 215 | # Create PM Mapper feed and create PM Mapper subscriber on data router |
| 216 | curl -v -X POST -H "Content-Type:application/vnd.dmaap-dr.feed" -H "X-DMAAP-DR-ON-BEHALF-OF:pmmapper" --data-ascii @$WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/createFeed.json --post301 --location-trusted -k https://${DR_PROV_IP}:8443 |
| 217 | curl -v -X POST -H "Content-Type:application/vnd.dmaap-dr.subscription" -H "X-DMAAP-DR-ON-BEHALF-OF:pmmapper" --data-ascii @$WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/addSubscriber.json --post301 --location-trusted -k https://${DR_PROV_IP}:8443/subscribe/1 |
| 218 | |
| 219 | # Create PM Mapper tocic in Message Router |
| 220 | curl -v -X POST http://${DMAAP_MR_IP}:3904/topics/create -d @$WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/createTopic.json -H "Content-Type: application/json" |
| 221 | PMMAPPER_IP=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' pmmapper) |
| 222 | docker exec pmmapper /bin/sh -c "cat /var/log/ONAP/dcaegen2/services/pm-mapper/pm-mapper_output.log" > /tmp/pmmapper.log |
| 223 | cat /tmp/pmmapper.log |
| 224 | docker exec -it datarouter-prov sh -c "curl http://dmaap-dr-node:8080/internal/fetchProv" |
| 225 | sleep 10 |
| 226 | curl -k https://$DR_PROV_IP:8443/internal/prov |
| 227 | curl http://${DMAAP_MR_IP}:3904/events/PM_MAPPER/CG1/C1?timeout=1000 |
| 228 | |
| 229 | #Pass any variables required by Robot test suites in ROBOT_VARIABLES |
| 230 | 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 VESC_PORT:${VESC_PORT} -v DR_SUBSCIBER_IP:${DR_SUBSCIBER_IP} -v SFTP_IP:${SFTP_IP}" |
| 231 | |
LiamBurke | a451619 | 2019-02-11 12:28:55 +0000 | [diff] [blame] | 232 | else |
| 233 | ############################################################ |
| 234 | ############################################################ |
| 235 | # Executes the below setup in an ONAP Environment # |
| 236 | # Make sure the steps in the README are completed first !! # |
| 237 | ############################################################ |
| 238 | ############################################################ |
| 239 | SFTP_PORT=2222 |
| 240 | |
| 241 | cp $WORKSPACE/plans/usecases/5G-bulkpm/teardown.sh $WORKSPACE/plans/usecases/5G-bulkpm/teardown.sh.orig |
| 242 | cp $WORKSPACE/plans/usecases/5G-bulkpm/onap.teardown.sh $WORKSPACE/plans/usecases/5G-bulkpm/teardown.sh |
| 243 | |
| 244 | #Get DataFileCollector POD name in this ONAP Deployment |
| 245 | DFC_POD=$(kubectl -n onap get pods | grep datafile-collector | awk '{print $1}') |
| 246 | export DFC_POD=${DFC_POD} |
| 247 | export CLI_EXEC_CLI_DFC="kubectl exec -n onap ${DFC_POD} -it ls /target | grep .gz" |
| 248 | |
| 249 | # Get IP address of datarrouter-prov |
| 250 | DR_PROV_IP=$(kubectl -n onap -o wide get pods | grep dmaap-dr-prov | awk '{print $6}') |
| 251 | echo DR_PROV_IP=${DR_PROV_IP} |
| 252 | DR_NODE_IP=$(kubectl -n onap -o=wide get pods | grep dmaap-dr-node | awk '{print $6}') |
| 253 | echo DR_NODE_IP=${DR_NODE_IP} |
| 254 | |
| 255 | # Get IP address of exposed Ves and its port |
| 256 | DMAAP_MR_IP=$(kubectl -n onap -o=wide get pods | grep dev-dmaap-message-router | grep -Ev "kafka|zookeeper" | awk '{print $6}') |
| 257 | VESC_IP=$(kubectl get svc -n onap | grep vesc | awk '{print $4}') |
| 258 | VESC_PORT=$(kubectl get svc -n onap | grep vesc | awk '{print $5}' | cut -d ":" -f2 | cut -d "/" -f1) |
| 259 | echo VESC_IP=${VESC_IP} |
| 260 | echo VESC_PORT=${VESC_PORT} |
| 261 | |
| 262 | export VESC_IP=${VESC_IP} |
| 263 | export VESC_PORT=${VESC_PORT} |
| 264 | export HOST_IP=${HOST_IP} |
| 265 | export DMAAP_MR_IP=${DMAAP_MR_IP} |
| 266 | |
| 267 | #Get DataFileCollector POD name in this ONAP Deployment |
| 268 | DFC_POD=$(kubectl -n onap get pods | grep datafile-collector | awk '{print $1}') |
| 269 | export DFC_POD=${DFC_POD} |
| 270 | |
LiamBurke | cf7c8ca | 2019-03-15 15:25:23 +0000 | [diff] [blame] | 271 | pip install jsonschema uuid simplejson |
LiamBurke | a451619 | 2019-02-11 12:28:55 +0000 | [diff] [blame] | 272 | |
| 273 | # Clone DMaaP Data Router repo |
| 274 | mkdir -p $WORKSPACE/archives/dmaapdr |
| 275 | cd $WORKSPACE/archives/dmaapdr |
| 276 | git clone --depth 1 https://gerrit.onap.org/r/dmaap/datarouter -b master |
| 277 | cd $WORKSPACE/archives/dmaapdr/datarouter/datarouter-docker-compose/src/main/resources |
| 278 | mkdir docker-compose |
| 279 | cd $WORKSPACE/archives/dmaapdr/datarouter/datarouter-docker-compose/src/main/resources/docker-compose |
| 280 | cp $WORKSPACE/plans/usecases/5G-bulkpm/composefile/onap.docker-compose-e2e $WORKSPACE/archives/dmaapdr/datarouter/datarouter-docker-compose/src/main/resources/docker-compose/docker-compose.yml |
| 281 | |
| 282 | #Statup the SFTP and FileConsumer containers. |
| 283 | docker login -u docker -p docker nexus3.onap.org:10001 |
| 284 | docker-compose up -d |
| 285 | |
| 286 | # Wait container ready |
| 287 | sleep 2 |
| 288 | HOST_IP=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $NF}') |
| 289 | # SFTP Configuration: |
| 290 | # Update the File Ready Notification with actual sftp ip address and copy pm files to sftp server. |
| 291 | cp $WORKSPACE/tests/usecases/5G-bulkpm/assets/json_events/FileExistNotification.json $WORKSPACE/tests/usecases/5G-bulkpm/assets/json_events/FileExistNotificationUpdated.json |
| 292 | sed -i 's/sftpserver/'${HOST_IP}'/g' $WORKSPACE/tests/usecases/5G-bulkpm/assets/json_events/FileExistNotificationUpdated.json |
| 293 | sed -i 's/sftpport/'${SFTP_PORT}'/g' $WORKSPACE/tests/usecases/5G-bulkpm/assets/json_events/FileExistNotificationUpdated.json |
| 294 | docker cp $WORKSPACE/plans/usecases/5G-bulkpm/assets/xNF.pm.xml.gz sftp:/home/admin/ |
| 295 | |
| 296 | # Create default feed and create file consumer subscriber on data router |
LiamBurke | b86a8bc | 2019-03-26 22:25:10 +0000 | [diff] [blame] | 297 | curl -v -X POST -H "Content-Type:application/vnd.dmaap-dr.feed" -H "X-DMAAP-DR-ON-BEHALF-OF:dradmin" --data-ascii @$WORKSPACE/plans/usecases/5G-bulkpm/assets/createFeed.json --post301 --location-trusted -k https://${DR_PROV_IP}:8443 |
LiamBurke | a451619 | 2019-02-11 12:28:55 +0000 | [diff] [blame] | 298 | cp $WORKSPACE/plans/usecases/5G-bulkpm/assets/addSubscriber.json /tmp/addSubscriber.json |
| 299 | sed -i 's/fileconsumer/'${HOST_IP}'/g' /tmp/addSubscriber.json |
LiamBurke | b86a8bc | 2019-03-26 22:25:10 +0000 | [diff] [blame] | 300 | curl -v -X POST -H "Content-Type:application/vnd.dmaap-dr.subscription" -H "X-DMAAP-DR-ON-BEHALF-OF:dradmin" --data-ascii @/tmp/addSubscriber.json --post301 --location-trusted -k https://${DR_PROV_IP}:8443/subscribe/1 |
LiamBurke | a451619 | 2019-02-11 12:28:55 +0000 | [diff] [blame] | 301 | sleep 10 |
| 302 | curl -k https://$DR_PROV_IP:8443/internal/prov |
| 303 | |
| 304 | #Pass any variables required by Robot test suites in ROBOT_VARIABLES |
| 305 | 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 VESC_PORT:${VESC_PORT} -v DR_SUBSCIBER_IP:${DR_SUBSCIBER_IP} -v DFC_POD:${DFC_POD} -v HOST_IP:${HOST_IP} " |
| 306 | |
LiamBurke | cf7c8ca | 2019-03-15 15:25:23 +0000 | [diff] [blame] | 307 | fi; |