blob: c2feb52d95dc1a14c124920a6f1353f44a2960e3 [file] [log] [blame]
Gary Wu9abb61c2018-09-27 10:38:50 -07001#!/bin/bash
LiamBurkecf7c8ca2019-03-15 15:25:23 +00002# Place the scripts in run order:
Gary Wu9abb61c2018-09-27 10:38:50 -07003source ${SCRIPTS}/common_functions.sh
4
LiamBurkea4516192019-02-11 12:28:55 +00005CSIT=TRUE
6if [ ${CSIT} = "TRUE" ] ; then
7####################################################
8#Executes the below setup in an Docker Environment #
9####################################################
10
11echo "CSIT Test get executed in here"
12SFTP_PORT=22
13VESC_PORT=8080
14export VESC_PORT=${VESC_PORT}
15export CLI_EXEC_CLI_DFC="docker exec dfc /bin/sh -c \"ls /target | grep .gz\""
16
Gary Wu9abb61c2018-09-27 10:38:50 -070017# Clone DMaaP Message Router repo
18mkdir -p $WORKSPACE/archives/dmaapmr
19cd $WORKSPACE/archives/dmaapmr
20git clone --depth 1 http://gerrit.onap.org/r/dmaap/messagerouter/messageservice -b master
LiamBurkeae583be2018-10-16 10:44:12 +000021sed -i 's/enableCadi: false/enableCadi: "false"/g' /$WORKSPACE/archives/dmaapmr/messageservice/src/main/resources/docker-compose/docker-compose.yml
Gary Wu9abb61c2018-09-27 10:38:50 -070022cd $WORKSPACE/archives/dmaapmr/messageservice/src/main/resources/docker-compose
23cp $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
26docker login -u docker -p docker nexus3.onap.org:10001
27docker-compose up -d
28
29ZOOKEEPER=$(docker ps -a -q --filter="name=zookeeper_1")
30KAFKA=$(docker ps -a -q --filter="name=kafka_1")
31DMAAP=$(docker ps -a -q --filter="name=dmaap_1")
32
33# Wait for initialization of Docker contaienr for DMaaP MR, Kafka and Zookeeper
LiamBurkef708f842018-10-10 09:26:26 +000034for i in {1..10}; do
Gary Wu9abb61c2018-09-27 10:38:50 -070035if [ $(docker inspect --format '{{ .State.Running }}' $KAFKA) ] && \
36[ $(docker inspect --format '{{ .State.Running }}' $ZOOKEEPER) ] && \
37[ $(docker inspect --format '{{ .State.Running }}' $DMAAP) ]
38then
39 echo "DMaaP Service Running"
40 break
41else
42 echo sleep $i
43 sleep $i
44fi
45done
46
47# Get IP address of DMAAP, KAFKA, Zookeeper
48KAFKA_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $KAFKA)
49ZOOKEEPER_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $ZOOKEEPER)
50DMAAP_MR_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $DMAAP)
51
52sleep 2
53# Shutdown DMAAP Container
54docker kill $DMAAP
55
56# Initial docker-compose up and down is for populating kafka and zookeeper IPs in /var/tmp/MsgRtrApi.properites
57sed -i -e '/config.zk.servers=/ s/=.*/='$ZOOKEEPER_IP'/' /var/tmp/MsgRtrApi.properties
58sed -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
61docker login -u docker -p docker nexus3.onap.org:10001
62docker-compose up -d
63sleep 5
64
65# Clone DMaaP Data Router repo
66mkdir -p $WORKSPACE/archives/dmaapdr
67cd $WORKSPACE/archives/dmaapdr
68git clone --depth 1 https://gerrit.onap.org/r/dmaap/datarouter -b master
LiamBurke1344ef22018-10-19 15:22:16 +000069cd $WORKSPACE/archives/dmaapdr/datarouter/datarouter-docker-compose/src/main/resources
70mkdir docker-compose
71cd $WORKSPACE/archives/dmaapdr/datarouter/datarouter-docker-compose/src/main/resources/docker-compose
72cp $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 Wu9abb61c2018-09-27 10:38:50 -070074docker login -u docker -p docker nexus3.onap.org:10001
75docker-compose up -d
LiamBurkeca7df552018-10-26 13:57:21 +000076echo "Disregard the message ERROR: for datarouter-node Container 1234456 is unhealthy, this is expected behaiour at this stage"
Gary Wu9abb61c2018-09-27 10:38:50 -070077docker kill vescollector
LiamBurke3608af72019-03-12 22:50:33 +000078docker kill cbs
LiamBurke248195d2019-04-03 10:21:12 +010079sleep 10
LiamBurke3608af72019-03-12 22:50:33 +000080CONSUL_IP=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' consul )
81sed -i -e '/CONSUL_HOST:/ s/:.*/: '$CONSUL_IP'/' docker-compose.yml
Gary Wu9abb61c2018-09-27 10:38:50 -070082HOST_IP=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $NF}')
83sed -i -e '/DMAAPHOST:/ s/:.*/: '$HOST_IP'/' docker-compose.yml
84MARIADB=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mariadb )
LiamBurke1344ef22018-10-19 15:22:16 +000085sed -i 's/datarouter-mariadb/'$MARIADB'/g' $WORKSPACE/archives/dmaapdr/datarouter/datarouter-docker-compose/src/main/resources/prov_data/provserver.properties
Gary Wu9abb61c2018-09-27 10:38:50 -070086docker-compose up -d
LiamBurke248195d2019-04-03 10:21:12 +010087sleep 5
88# Get IP address of datarrouger-prov, datarouter-node, fileconsumer-node.
89DR_PROV_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' datarouter-prov)
90DR_NODE_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' datarouter-node)
91DR_SUBSCIBER_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' fileconsumer-node)
92DR_GATEWAY_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.Gateway}}{{end}}' datarouter-prov)
93
94echo DR_PROV_IP=${DR_PROV_IP}
95echo DR_NODE_IP=${DR_NODE_IP}
96echo DR_GATEWAY_IP=${DR_GATEWAY_IP}
97echo DR_SUBSCIBER_IP=${DR_SUBSCIBER_IP}
98
99docker kill datarouter-node
100docker kill datarouter-prov
101sed -i 's/1.1.1.1/'$DR_NODE_IP'/g' docker-compose.yml
102sed -i 's/2.2.2.2/'$DR_PROV_IP'/g' docker-compose.yml
103docker-compose up -d
Gary Wu9abb61c2018-09-27 10:38:50 -0700104
105# Wait for initialization of Docker container for datarouter-node, datarouter-prov and mariadb
LiamBurkef708f842018-10-10 09:26:26 +0000106for i in {1..10}; do
Gary Wu9abb61c2018-09-27 10:38:50 -0700107 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
117done
118
119sleep 5
Gary Wu9abb61c2018-09-27 10:38:50 -0700120
121docker 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"
122docker 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 Wu9abb61c2018-09-27 10:38:50 -0700123docker exec datarouter-node /bin/sh -c "echo '${DR_SUBSCIBER_IP}' dmaap-dr-subscriber >> /etc/hosts"
124
LiamBurke248195d2019-04-03 10:21:12 +0100125
Gary Wu9abb61c2018-09-27 10:38:50 -0700126# Get IP address of DMAAP, KAFKA, Zookeeper
127DMAAP_MR_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $DMAAP)
128KAFKA_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $KAFKA)
129ZOOKEEPER_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $ZOOKEEPER)
130VESC_IP=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' vescollector)
131SFTP_IP=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' sftp)
132
133export VESC_IP=${VESC_IP}
134export HOST_IP=${HOST_IP}
135export DMAAP_MR_IP=${DMAAP_MR_IP}
136
LiamBurke3608af72019-03-12 22:50:33 +0000137
LiamBurkef8d0c2e2019-03-13 12:47:16 +0000138# Data File Collector configuration :
rajendrajaiswal44762cc2019-07-31 15:45:04 +0000139sed -i 's/5.5.5.5/'$DR_NODE_IP'/g' docker-compose.yml
LiamBurkef8d0c2e2019-03-13 12:47:16 +0000140cp $WORKSPACE/plans/usecases/5G-bulkpm/assets/datafile_endpoints.json /tmp/
141sed -i 's/dmaapmrhost/'${DMAAP_MR_IP}'/g' /tmp/datafile_endpoints.json
142sed -i 's/dmaapdrhost/'${DR_PROV_IP}'/g' /tmp/datafile_endpoints.json
143echo data_endpoints.json to be copied onto the DFC containter
144cat /tmp/datafile_endpoints.json
145docker-compose up -d
146sleep 2
147# DFC is now online
148docker cp dfc:/opt/app/datafile/config/datafile_endpoints.json /tmp/datafile_endpoints.json.fromcontainer
149echo data_endpoints.json from DFC containter
150cat /tmp/datafile_endpoints.json.fromcontainer
151docker cp /tmp/datafile_endpoints.json dfc:/opt/app/datafile/config/
yanhuanwangb7d9f292019-09-10 13:38:46 +0200152docker cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/cert.jks.b64 dfc:/opt/app/datafile/etc/cert/
153docker cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/jks.pass dfc:/opt/app/datafile/etc/cert/
154docker cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/trust.jks.b64 dfc:/opt/app/datafile/etc/cert/
155docker cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/trust.pass dfc:/opt/app/datafile/etc/cert/
156docker cp $WORKSPACE/plans/usecases/5G-bulkpm/assets/application.yaml dfc:/opt/app/datafile/config/
LiamBurkef8d0c2e2019-03-13 12:47:16 +0000157#Increase Logging
yanhuanwangb7d9f292019-09-10 13:38:46 +0200158#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"
LiamBurkef8d0c2e2019-03-13 12:47:16 +0000159docker restart dfc
160sleep 2
161
LiamBurke248195d2019-04-03 10:21:12 +0100162# Wait for initialization of Docker container for datarouter-node, datarouter-prov and mariadb, Consul, CBS
LiamBurke3608af72019-03-12 22:50:33 +0000163for i in {1..10}; do
164 if [ $(docker inspect --format '{{ .State.Running }}' consul) ] && \
rajendrajaiswal44762cc2019-07-31 15:45:04 +0000165 [ $(docker inspect --format '{{ .State.Running }}' cbs) ]
LiamBurke3608af72019-03-12 22:50:33 +0000166 then
LiamBurke248195d2019-04-03 10:21:12 +0100167 echo "Data Router, Consul, Config Binding Service Services Running"
LiamBurke3608af72019-03-12 22:50:33 +0000168 break
169 else
170 echo sleep $i
171 sleep $i
172 fi
173done
174sleep 10
175
LiamBurkecf7c8ca2019-03-15 15:25:23 +0000176pip install jsonschema uuid simplejson
Gary Wu9abb61c2018-09-27 10:38:50 -0700177# Wait container ready
178sleep 2
179
Gary Wu9abb61c2018-09-27 10:38:50 -0700180# Update the File Ready Notification with actual sftp ip address and copy pm files to sftp server.
rajendrajaiswal0d357f32018-09-28 10:18:19 +0100181cp $WORKSPACE/tests/usecases/5G-bulkpm/assets/json_events/FileExistNotification.json $WORKSPACE/tests/usecases/5G-bulkpm/assets/json_events/FileExistNotificationUpdated.json
Gary Wu13111e92018-09-27 11:31:33 -0700182sed -i 's/sftpserver/'${SFTP_IP}'/g' $WORKSPACE/tests/usecases/5G-bulkpm/assets/json_events/FileExistNotificationUpdated.json
LiamBurkea4516192019-02-11 12:28:55 +0000183sed -i 's/sftpport/'${SFTP_PORT}'/g' $WORKSPACE/tests/usecases/5G-bulkpm/assets/json_events/FileExistNotificationUpdated.json
Gary Wu13111e92018-09-27 11:31:33 -0700184docker cp $WORKSPACE/plans/usecases/5G-bulkpm/assets/xNF.pm.xml.gz sftp:/home/admin/
LiamBurkeab2e0982019-04-11 11:43:42 +0100185docker cp $WORKSPACE/tests/dcaegen2-pmmapper/pmmapper/assets/A20181002.0000-1000-0015-1000_5G.xml.gz sftp:/home/admin/
Gary Wu9abb61c2018-09-27 10:38:50 -0700186
187# Data Router Configuration:
188# Create default feed and create file consumer subscriber on data router
egernug6f2874b2019-02-06 15:16:54 +0000189curl -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 Wu13111e92018-09-27 11:31:33 -0700190cp $WORKSPACE/plans/usecases/5G-bulkpm/assets/addSubscriber.json /tmp/addSubscriber.json
Gary Wu9abb61c2018-09-27 10:38:50 -0700191sed -i 's/fileconsumer/'${DR_SUBSCIBER_IP}'/g' /tmp/addSubscriber.json
egernug6f2874b2019-02-06 15:16:54 +0000192curl -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
rajendrajaiswalb99eedc2018-10-02 09:42:23 +0100193sleep 10
LiamBurkef708f842018-10-10 09:26:26 +0000194curl -k https://$DR_PROV_IP:8443/internal/prov
LiamBurkea4516192019-02-11 12:28:55 +0000195
LiamBurkef9d624a2019-04-10 10:41:26 +0100196# Consul Configuration for PM Mapper
197cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/cbs.json /tmp/cbs.json
198sed -i 's/ipaddress/'${CBS_IP}'/g' /tmp/cbs.json
199curl --request PUT --data @/tmp/cbs.json http://$CONSUL_IP:8500/v1/agent/service/register
200curl '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
203mkdir /tmp/docker-compose
204cd /tmp/docker-compose
205cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/composefile/docker-compose-pmmapper.yml /tmp/docker-compose/docker-compose.yml
206CBS_IP=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' cbs)
207sed -i 's/CBSIP/'$CBS_IP'/g' docker-compose.yml
208sed -i 's/1.1.1.1/'$DR_NODE_IP'/g' docker-compose.yml
rajendrajaiswal44762cc2019-07-31 15:45:04 +0000209sed -i 's/4.4.4.4/'$MARIADB'/g' docker-compose.yml
LiamBurkef9d624a2019-04-10 10:41:26 +0100210docker-compose up -d
211
LiamBurkeab2e0982019-04-11 11:43:42 +0100212cd $WORKSPACE/archives/dmaapdr/datarouter/datarouter-docker-compose/src/main/resources/docker-compose
213PMMAPPER_IP=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' pmmapper)
214docker kill datarouter-node
215docker kill datarouter-prov
216sed -i 's/1.1.1.1/'$DR_NODE_IP'/g' docker-compose.yml
217sed -i 's/2.2.2.2/'$DR_PROV_IP'/g' docker-compose.yml
218sed -i 's/3.3.3.3/'$PMMAPPER_IP'/g' docker-compose.yml
219docker-compose up -d
220
LiamBurkef9d624a2019-04-10 10:41:26 +0100221# Setting up PM Mapper certs.
222docker cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/cert.jks.b64 pmmapper:opt/app/pm-mapper/etc/
223docker cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/jks.pass pmmapper:opt/app/pm-mapper/etc/
224docker cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/trust.jks.b64 pmmapper:opt/app/pm-mapper/etc/
225docker cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/trust.pass pmmapper:opt/app/pm-mapper/etc/
226docker restart pmmapper
LiamBurkeab2e0982019-04-11 11:43:42 +0100227sleep 5
LiamBurkef9d624a2019-04-10 10:41:26 +0100228
rajendrajaiswal44762cc2019-07-31 15:45:04 +0000229# Simulation setup for Message Router
230docker cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/mrserver.js mariadb:/
231docker exec mariadb /bin/bash -c "apt update"
232sleep 2
233docker exec mariadb /bin/bash -c "apt install nodejs -y"
234sleep 10
235docker exec mariadb /bin/bash -c "nodejs mrserver.js &" &
236
LiamBurkef9d624a2019-04-10 10:41:26 +0100237# Create PM Mapper feed and create PM Mapper subscriber on data router
LiamBurkeab2e0982019-04-11 11:43:42 +0100238#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
LiamBurkef9d624a2019-04-10 10:41:26 +0100239curl -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
LiamBurkef9d624a2019-04-10 10:41:26 +0100242PMMAPPER_IP=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' pmmapper)
243docker exec pmmapper /bin/sh -c "cat /var/log/ONAP/dcaegen2/services/pm-mapper/pm-mapper_output.log" > /tmp/pmmapper.log
244cat /tmp/pmmapper.log
245docker exec -it datarouter-prov sh -c "curl http://dmaap-dr-node:8080/internal/fetchProv"
246sleep 10
247curl -k https://$DR_PROV_IP:8443/internal/prov
LiamBurkef9d624a2019-04-10 10:41:26 +0100248
249#Pass any variables required by Robot test suites in ROBOT_VARIABLES
250ROBOT_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
LiamBurkea4516192019-02-11 12:28:55 +0000252else
253############################################################
254############################################################
255# Executes the below setup in an ONAP Environment #
256# Make sure the steps in the README are completed first !! #
257############################################################
258############################################################
259SFTP_PORT=2222
260
261cp $WORKSPACE/plans/usecases/5G-bulkpm/teardown.sh $WORKSPACE/plans/usecases/5G-bulkpm/teardown.sh.orig
262cp $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
265DFC_POD=$(kubectl -n onap get pods | grep datafile-collector | awk '{print $1}')
266export DFC_POD=${DFC_POD}
267export CLI_EXEC_CLI_DFC="kubectl exec -n onap ${DFC_POD} -it ls /target | grep .gz"
268
269# Get IP address of datarrouter-prov
270DR_PROV_IP=$(kubectl -n onap -o wide get pods | grep dmaap-dr-prov | awk '{print $6}')
271echo DR_PROV_IP=${DR_PROV_IP}
272DR_NODE_IP=$(kubectl -n onap -o=wide get pods | grep dmaap-dr-node | awk '{print $6}')
273echo DR_NODE_IP=${DR_NODE_IP}
274
275# Get IP address of exposed Ves and its port
276DMAAP_MR_IP=$(kubectl -n onap -o=wide get pods | grep dev-dmaap-message-router | grep -Ev "kafka|zookeeper" | awk '{print $6}')
277VESC_IP=$(kubectl get svc -n onap | grep vesc | awk '{print $4}')
278VESC_PORT=$(kubectl get svc -n onap | grep vesc | awk '{print $5}' | cut -d ":" -f2 | cut -d "/" -f1)
279echo VESC_IP=${VESC_IP}
280echo VESC_PORT=${VESC_PORT}
281
282export VESC_IP=${VESC_IP}
283export VESC_PORT=${VESC_PORT}
284export HOST_IP=${HOST_IP}
285export DMAAP_MR_IP=${DMAAP_MR_IP}
286
287#Get DataFileCollector POD name in this ONAP Deployment
288DFC_POD=$(kubectl -n onap get pods | grep datafile-collector | awk '{print $1}')
289export DFC_POD=${DFC_POD}
290
LiamBurkecf7c8ca2019-03-15 15:25:23 +0000291pip install jsonschema uuid simplejson
LiamBurkea4516192019-02-11 12:28:55 +0000292
293# Clone DMaaP Data Router repo
294mkdir -p $WORKSPACE/archives/dmaapdr
295cd $WORKSPACE/archives/dmaapdr
296git clone --depth 1 https://gerrit.onap.org/r/dmaap/datarouter -b master
297cd $WORKSPACE/archives/dmaapdr/datarouter/datarouter-docker-compose/src/main/resources
298mkdir docker-compose
299cd $WORKSPACE/archives/dmaapdr/datarouter/datarouter-docker-compose/src/main/resources/docker-compose
300cp $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.
303docker login -u docker -p docker nexus3.onap.org:10001
304docker-compose up -d
305
306# Wait container ready
307sleep 2
308HOST_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.
311cp $WORKSPACE/tests/usecases/5G-bulkpm/assets/json_events/FileExistNotification.json $WORKSPACE/tests/usecases/5G-bulkpm/assets/json_events/FileExistNotificationUpdated.json
312sed -i 's/sftpserver/'${HOST_IP}'/g' $WORKSPACE/tests/usecases/5G-bulkpm/assets/json_events/FileExistNotificationUpdated.json
313sed -i 's/sftpport/'${SFTP_PORT}'/g' $WORKSPACE/tests/usecases/5G-bulkpm/assets/json_events/FileExistNotificationUpdated.json
314docker 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
LiamBurkeb86a8bc2019-03-26 22:25:10 +0000317curl -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
LiamBurkea4516192019-02-11 12:28:55 +0000318cp $WORKSPACE/plans/usecases/5G-bulkpm/assets/addSubscriber.json /tmp/addSubscriber.json
319sed -i 's/fileconsumer/'${HOST_IP}'/g' /tmp/addSubscriber.json
LiamBurkeb86a8bc2019-03-26 22:25:10 +0000320curl -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
LiamBurkea4516192019-02-11 12:28:55 +0000321sleep 10
322curl -k https://$DR_PROV_IP:8443/internal/prov
323
324#Pass any variables required by Robot test suites in ROBOT_VARIABLES
325ROBOT_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
LiamBurkecf7c8ca2019-03-15 15:25:23 +0000327fi;