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 |
| 73 | |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 74 | docker login -u docker -p docker nexus3.onap.org:10001 |
| 75 | docker-compose up -d |
LiamBurke | ca7df55 | 2018-10-26 13:57:21 +0000 | [diff] [blame] | 76 | 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] | 77 | docker kill vescollector |
LiamBurke | 3608af7 | 2019-03-12 22:50:33 +0000 | [diff] [blame] | 78 | docker kill cbs |
LiamBurke | 248195d | 2019-04-03 10:21:12 +0100 | [diff] [blame] | 79 | sleep 10 |
LiamBurke | 3608af7 | 2019-03-12 22:50:33 +0000 | [diff] [blame] | 80 | CONSUL_IP=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' consul ) |
| 81 | sed -i -e '/CONSUL_HOST:/ s/:.*/: '$CONSUL_IP'/' docker-compose.yml |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 82 | HOST_IP=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $NF}') |
| 83 | sed -i -e '/DMAAPHOST:/ s/:.*/: '$HOST_IP'/' docker-compose.yml |
| 84 | MARIADB=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mariadb ) |
LiamBurke | 1344ef2 | 2018-10-19 15:22:16 +0000 | [diff] [blame] | 85 | 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] | 86 | docker-compose up -d |
LiamBurke | 248195d | 2019-04-03 10:21:12 +0100 | [diff] [blame] | 87 | sleep 5 |
| 88 | # Get IP address of datarrouger-prov, datarouter-node, fileconsumer-node. |
| 89 | DR_PROV_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' datarouter-prov) |
| 90 | DR_NODE_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' datarouter-node) |
| 91 | DR_SUBSCIBER_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' fileconsumer-node) |
| 92 | DR_GATEWAY_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.Gateway}}{{end}}' datarouter-prov) |
| 93 | |
| 94 | echo DR_PROV_IP=${DR_PROV_IP} |
| 95 | echo DR_NODE_IP=${DR_NODE_IP} |
| 96 | echo DR_GATEWAY_IP=${DR_GATEWAY_IP} |
| 97 | echo DR_SUBSCIBER_IP=${DR_SUBSCIBER_IP} |
| 98 | |
| 99 | docker kill datarouter-node |
| 100 | docker kill datarouter-prov |
| 101 | sed -i 's/1.1.1.1/'$DR_NODE_IP'/g' docker-compose.yml |
| 102 | sed -i 's/2.2.2.2/'$DR_PROV_IP'/g' docker-compose.yml |
| 103 | docker-compose up -d |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 104 | |
| 105 | # Wait for initialization of Docker container for datarouter-node, datarouter-prov and mariadb |
LiamBurke | f708f84 | 2018-10-10 09:26:26 +0000 | [diff] [blame] | 106 | for i in {1..10}; do |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 107 | if [ $(docker inspect --format '{{ .State.Running }}' datarouter-node) ] && \ |
| 108 | [ $(docker inspect --format '{{ .State.Running }}' datarouter-prov) ] && \ |
| 109 | [ $(docker inspect --format '{{ .State.Running }}' mariadb) ] |
| 110 | then |
| 111 | echo "DR Service Running" |
| 112 | break |
| 113 | else |
| 114 | echo sleep $i |
| 115 | sleep $i |
| 116 | fi |
| 117 | done |
| 118 | |
| 119 | sleep 5 |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 120 | |
| 121 | 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" |
| 122 | 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] | 123 | docker exec datarouter-node /bin/sh -c "echo '${DR_SUBSCIBER_IP}' dmaap-dr-subscriber >> /etc/hosts" |
| 124 | |
LiamBurke | 248195d | 2019-04-03 10:21:12 +0100 | [diff] [blame] | 125 | |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 126 | # Get IP address of DMAAP, KAFKA, Zookeeper |
| 127 | DMAAP_MR_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $DMAAP) |
| 128 | KAFKA_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $KAFKA) |
| 129 | ZOOKEEPER_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $ZOOKEEPER) |
| 130 | VESC_IP=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' vescollector) |
| 131 | SFTP_IP=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' sftp) |
| 132 | |
| 133 | export VESC_IP=${VESC_IP} |
| 134 | export HOST_IP=${HOST_IP} |
| 135 | export DMAAP_MR_IP=${DMAAP_MR_IP} |
| 136 | |
LiamBurke | 3608af7 | 2019-03-12 22:50:33 +0000 | [diff] [blame] | 137 | |
LiamBurke | f8d0c2e | 2019-03-13 12:47:16 +0000 | [diff] [blame] | 138 | # Data File Collector configuration : |
rajendrajaiswal | 44762cc | 2019-07-31 15:45:04 +0000 | [diff] [blame] | 139 | sed -i 's/5.5.5.5/'$DR_NODE_IP'/g' docker-compose.yml |
LiamBurke | f8d0c2e | 2019-03-13 12:47:16 +0000 | [diff] [blame] | 140 | cp $WORKSPACE/plans/usecases/5G-bulkpm/assets/datafile_endpoints.json /tmp/ |
| 141 | sed -i 's/dmaapmrhost/'${DMAAP_MR_IP}'/g' /tmp/datafile_endpoints.json |
| 142 | sed -i 's/dmaapdrhost/'${DR_PROV_IP}'/g' /tmp/datafile_endpoints.json |
| 143 | echo data_endpoints.json to be copied onto the DFC containter |
| 144 | cat /tmp/datafile_endpoints.json |
| 145 | docker-compose up -d |
| 146 | sleep 2 |
| 147 | # DFC is now online |
| 148 | docker cp dfc:/opt/app/datafile/config/datafile_endpoints.json /tmp/datafile_endpoints.json.fromcontainer |
| 149 | echo data_endpoints.json from DFC containter |
| 150 | cat /tmp/datafile_endpoints.json.fromcontainer |
| 151 | docker cp /tmp/datafile_endpoints.json dfc:/opt/app/datafile/config/ |
yanhuanwang | b7d9f29 | 2019-09-10 13:38:46 +0200 | [diff] [blame] | 152 | docker cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/cert.jks.b64 dfc:/opt/app/datafile/etc/cert/ |
| 153 | docker cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/jks.pass dfc:/opt/app/datafile/etc/cert/ |
| 154 | docker cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/trust.jks.b64 dfc:/opt/app/datafile/etc/cert/ |
| 155 | docker cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/trust.pass dfc:/opt/app/datafile/etc/cert/ |
| 156 | docker cp $WORKSPACE/plans/usecases/5G-bulkpm/assets/application.yaml dfc:/opt/app/datafile/config/ |
LiamBurke | f8d0c2e | 2019-03-13 12:47:16 +0000 | [diff] [blame] | 157 | #Increase Logging |
yanhuanwang | b7d9f29 | 2019-09-10 13:38:46 +0200 | [diff] [blame] | 158 | #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] | 159 | docker restart dfc |
| 160 | sleep 2 |
| 161 | |
LiamBurke | 248195d | 2019-04-03 10:21:12 +0100 | [diff] [blame] | 162 | # 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] | 163 | for i in {1..10}; do |
| 164 | if [ $(docker inspect --format '{{ .State.Running }}' consul) ] && \ |
rajendrajaiswal | 44762cc | 2019-07-31 15:45:04 +0000 | [diff] [blame] | 165 | [ $(docker inspect --format '{{ .State.Running }}' cbs) ] |
LiamBurke | 3608af7 | 2019-03-12 22:50:33 +0000 | [diff] [blame] | 166 | then |
LiamBurke | 248195d | 2019-04-03 10:21:12 +0100 | [diff] [blame] | 167 | echo "Data Router, Consul, Config Binding Service Services Running" |
LiamBurke | 3608af7 | 2019-03-12 22:50:33 +0000 | [diff] [blame] | 168 | break |
| 169 | else |
| 170 | echo sleep $i |
| 171 | sleep $i |
| 172 | fi |
| 173 | done |
| 174 | sleep 10 |
| 175 | |
LiamBurke | cf7c8ca | 2019-03-15 15:25:23 +0000 | [diff] [blame] | 176 | pip install jsonschema uuid simplejson |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 177 | # Wait container ready |
| 178 | sleep 2 |
| 179 | |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 180 | # 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] | 181 | 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] | 182 | 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] | 183 | 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] | 184 | docker cp $WORKSPACE/plans/usecases/5G-bulkpm/assets/xNF.pm.xml.gz sftp:/home/admin/ |
LiamBurke | ab2e098 | 2019-04-11 11:43:42 +0100 | [diff] [blame] | 185 | docker cp $WORKSPACE/tests/dcaegen2-pmmapper/pmmapper/assets/A20181002.0000-1000-0015-1000_5G.xml.gz sftp:/home/admin/ |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 186 | |
| 187 | # Data Router Configuration: |
| 188 | # Create default feed and create file consumer subscriber on data router |
egernug | 6f2874b | 2019-02-06 15:16:54 +0000 | [diff] [blame] | 189 | 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] | 190 | cp $WORKSPACE/plans/usecases/5G-bulkpm/assets/addSubscriber.json /tmp/addSubscriber.json |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 191 | sed -i 's/fileconsumer/'${DR_SUBSCIBER_IP}'/g' /tmp/addSubscriber.json |
egernug | 6f2874b | 2019-02-06 15:16:54 +0000 | [diff] [blame] | 192 | 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] | 193 | sleep 10 |
LiamBurke | f708f84 | 2018-10-10 09:26:26 +0000 | [diff] [blame] | 194 | curl -k https://$DR_PROV_IP:8443/internal/prov |
LiamBurke | a451619 | 2019-02-11 12:28:55 +0000 | [diff] [blame] | 195 | |
LiamBurke | f9d624a | 2019-04-10 10:41:26 +0100 | [diff] [blame] | 196 | # Consul Configuration for PM Mapper |
| 197 | cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/cbs.json /tmp/cbs.json |
| 198 | sed -i 's/ipaddress/'${CBS_IP}'/g' /tmp/cbs.json |
| 199 | curl --request PUT --data @/tmp/cbs.json http://$CONSUL_IP:8500/v1/agent/service/register |
| 200 | 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 |
| 201 | |
| 202 | # PM Mapper startup and configuration |
| 203 | mkdir /tmp/docker-compose |
| 204 | cd /tmp/docker-compose |
tragait | cd8b66c | 2020-02-05 17:02:20 +0000 | [diff] [blame] | 205 | cp $WORKSPACE/plans/usecases/5G-bulkpm/composefile/docker-compose-pmmapper.yml /tmp/docker-compose/docker-compose.yml |
LiamBurke | f9d624a | 2019-04-10 10:41:26 +0100 | [diff] [blame] | 206 | CBS_IP=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' cbs) |
| 207 | sed -i 's/CBSIP/'$CBS_IP'/g' docker-compose.yml |
| 208 | sed -i 's/1.1.1.1/'$DR_NODE_IP'/g' docker-compose.yml |
rajendrajaiswal | 44762cc | 2019-07-31 15:45:04 +0000 | [diff] [blame] | 209 | sed -i 's/4.4.4.4/'$MARIADB'/g' docker-compose.yml |
LiamBurke | f9d624a | 2019-04-10 10:41:26 +0100 | [diff] [blame] | 210 | docker-compose up -d |
| 211 | |
LiamBurke | ab2e098 | 2019-04-11 11:43:42 +0100 | [diff] [blame] | 212 | cd $WORKSPACE/archives/dmaapdr/datarouter/datarouter-docker-compose/src/main/resources/docker-compose |
| 213 | PMMAPPER_IP=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' pmmapper) |
| 214 | docker kill datarouter-node |
| 215 | docker kill datarouter-prov |
| 216 | sed -i 's/1.1.1.1/'$DR_NODE_IP'/g' docker-compose.yml |
| 217 | sed -i 's/2.2.2.2/'$DR_PROV_IP'/g' docker-compose.yml |
| 218 | sed -i 's/3.3.3.3/'$PMMAPPER_IP'/g' docker-compose.yml |
| 219 | docker-compose up -d |
| 220 | |
LiamBurke | f9d624a | 2019-04-10 10:41:26 +0100 | [diff] [blame] | 221 | # Setting up PM Mapper certs. |
| 222 | docker cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/cert.jks.b64 pmmapper:opt/app/pm-mapper/etc/ |
| 223 | docker cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/jks.pass pmmapper:opt/app/pm-mapper/etc/ |
| 224 | docker cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/trust.jks.b64 pmmapper:opt/app/pm-mapper/etc/ |
| 225 | docker cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/trust.pass pmmapper:opt/app/pm-mapper/etc/ |
| 226 | docker restart pmmapper |
LiamBurke | ab2e098 | 2019-04-11 11:43:42 +0100 | [diff] [blame] | 227 | sleep 5 |
LiamBurke | f9d624a | 2019-04-10 10:41:26 +0100 | [diff] [blame] | 228 | |
rajendrajaiswal | 44762cc | 2019-07-31 15:45:04 +0000 | [diff] [blame] | 229 | # Simulation setup for Message Router |
| 230 | docker cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/mrserver.js mariadb:/ |
| 231 | docker exec mariadb /bin/bash -c "apt update" |
| 232 | sleep 2 |
| 233 | docker exec mariadb /bin/bash -c "apt install nodejs -y" |
| 234 | sleep 10 |
| 235 | docker exec mariadb /bin/bash -c "nodejs mrserver.js &" & |
| 236 | |
LiamBurke | f9d624a | 2019-04-10 10:41:26 +0100 | [diff] [blame] | 237 | # Create PM Mapper feed and create PM Mapper subscriber on data router |
LiamBurke | ab2e098 | 2019-04-11 11:43:42 +0100 | [diff] [blame] | 238 | #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 |
LiamBurke | f9d624a | 2019-04-10 10:41:26 +0100 | [diff] [blame] | 239 | 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 |
| 240 | |
| 241 | # Create PM Mapper tocic in Message Router |
LiamBurke | f9d624a | 2019-04-10 10:41:26 +0100 | [diff] [blame] | 242 | PMMAPPER_IP=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' pmmapper) |
| 243 | docker exec pmmapper /bin/sh -c "cat /var/log/ONAP/dcaegen2/services/pm-mapper/pm-mapper_output.log" > /tmp/pmmapper.log |
| 244 | cat /tmp/pmmapper.log |
| 245 | docker exec -it datarouter-prov sh -c "curl http://dmaap-dr-node:8080/internal/fetchProv" |
| 246 | sleep 10 |
| 247 | curl -k https://$DR_PROV_IP:8443/internal/prov |
LiamBurke | f9d624a | 2019-04-10 10:41:26 +0100 | [diff] [blame] | 248 | |
| 249 | #Pass any variables required by Robot test suites in ROBOT_VARIABLES |
| 250 | 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}" |
| 251 | |
LiamBurke | a451619 | 2019-02-11 12:28:55 +0000 | [diff] [blame] | 252 | else |
| 253 | ############################################################ |
| 254 | ############################################################ |
| 255 | # Executes the below setup in an ONAP Environment # |
| 256 | # Make sure the steps in the README are completed first !! # |
| 257 | ############################################################ |
| 258 | ############################################################ |
| 259 | SFTP_PORT=2222 |
| 260 | |
| 261 | cp $WORKSPACE/plans/usecases/5G-bulkpm/teardown.sh $WORKSPACE/plans/usecases/5G-bulkpm/teardown.sh.orig |
| 262 | cp $WORKSPACE/plans/usecases/5G-bulkpm/onap.teardown.sh $WORKSPACE/plans/usecases/5G-bulkpm/teardown.sh |
| 263 | |
| 264 | #Get DataFileCollector POD name in this ONAP Deployment |
| 265 | DFC_POD=$(kubectl -n onap get pods | grep datafile-collector | awk '{print $1}') |
| 266 | export DFC_POD=${DFC_POD} |
| 267 | export CLI_EXEC_CLI_DFC="kubectl exec -n onap ${DFC_POD} -it ls /target | grep .gz" |
| 268 | |
| 269 | # Get IP address of datarrouter-prov |
| 270 | DR_PROV_IP=$(kubectl -n onap -o wide get pods | grep dmaap-dr-prov | awk '{print $6}') |
| 271 | echo DR_PROV_IP=${DR_PROV_IP} |
| 272 | DR_NODE_IP=$(kubectl -n onap -o=wide get pods | grep dmaap-dr-node | awk '{print $6}') |
| 273 | echo DR_NODE_IP=${DR_NODE_IP} |
| 274 | |
| 275 | # Get IP address of exposed Ves and its port |
| 276 | DMAAP_MR_IP=$(kubectl -n onap -o=wide get pods | grep dev-dmaap-message-router | grep -Ev "kafka|zookeeper" | awk '{print $6}') |
| 277 | VESC_IP=$(kubectl get svc -n onap | grep vesc | awk '{print $4}') |
| 278 | VESC_PORT=$(kubectl get svc -n onap | grep vesc | awk '{print $5}' | cut -d ":" -f2 | cut -d "/" -f1) |
| 279 | echo VESC_IP=${VESC_IP} |
| 280 | echo VESC_PORT=${VESC_PORT} |
| 281 | |
| 282 | export VESC_IP=${VESC_IP} |
| 283 | export VESC_PORT=${VESC_PORT} |
| 284 | export HOST_IP=${HOST_IP} |
| 285 | export DMAAP_MR_IP=${DMAAP_MR_IP} |
| 286 | |
| 287 | #Get DataFileCollector POD name in this ONAP Deployment |
| 288 | DFC_POD=$(kubectl -n onap get pods | grep datafile-collector | awk '{print $1}') |
| 289 | export DFC_POD=${DFC_POD} |
| 290 | |
LiamBurke | cf7c8ca | 2019-03-15 15:25:23 +0000 | [diff] [blame] | 291 | pip install jsonschema uuid simplejson |
LiamBurke | a451619 | 2019-02-11 12:28:55 +0000 | [diff] [blame] | 292 | |
| 293 | # Clone DMaaP Data Router repo |
| 294 | mkdir -p $WORKSPACE/archives/dmaapdr |
| 295 | cd $WORKSPACE/archives/dmaapdr |
| 296 | git clone --depth 1 https://gerrit.onap.org/r/dmaap/datarouter -b master |
| 297 | cd $WORKSPACE/archives/dmaapdr/datarouter/datarouter-docker-compose/src/main/resources |
| 298 | mkdir docker-compose |
| 299 | cd $WORKSPACE/archives/dmaapdr/datarouter/datarouter-docker-compose/src/main/resources/docker-compose |
| 300 | 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 |
| 301 | |
| 302 | #Statup the SFTP and FileConsumer containers. |
| 303 | docker login -u docker -p docker nexus3.onap.org:10001 |
| 304 | docker-compose up -d |
| 305 | |
| 306 | # Wait container ready |
| 307 | sleep 2 |
| 308 | HOST_IP=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $NF}') |
| 309 | # SFTP Configuration: |
| 310 | # Update the File Ready Notification with actual sftp ip address and copy pm files to sftp server. |
| 311 | cp $WORKSPACE/tests/usecases/5G-bulkpm/assets/json_events/FileExistNotification.json $WORKSPACE/tests/usecases/5G-bulkpm/assets/json_events/FileExistNotificationUpdated.json |
| 312 | sed -i 's/sftpserver/'${HOST_IP}'/g' $WORKSPACE/tests/usecases/5G-bulkpm/assets/json_events/FileExistNotificationUpdated.json |
| 313 | sed -i 's/sftpport/'${SFTP_PORT}'/g' $WORKSPACE/tests/usecases/5G-bulkpm/assets/json_events/FileExistNotificationUpdated.json |
| 314 | docker cp $WORKSPACE/plans/usecases/5G-bulkpm/assets/xNF.pm.xml.gz sftp:/home/admin/ |
| 315 | |
| 316 | # Create default feed and create file consumer subscriber on data router |
LiamBurke | b86a8bc | 2019-03-26 22:25:10 +0000 | [diff] [blame] | 317 | 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] | 318 | cp $WORKSPACE/plans/usecases/5G-bulkpm/assets/addSubscriber.json /tmp/addSubscriber.json |
| 319 | sed -i 's/fileconsumer/'${HOST_IP}'/g' /tmp/addSubscriber.json |
LiamBurke | b86a8bc | 2019-03-26 22:25:10 +0000 | [diff] [blame] | 320 | 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] | 321 | sleep 10 |
| 322 | curl -k https://$DR_PROV_IP:8443/internal/prov |
| 323 | |
| 324 | #Pass any variables required by Robot test suites in ROBOT_VARIABLES |
| 325 | 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} " |
| 326 | |
LiamBurke | cf7c8ca | 2019-03-15 15:25:23 +0000 | [diff] [blame] | 327 | fi; |