aboutsummaryrefslogtreecommitdiffstats
path: root/plans/dcaegen2-services-son-handler/testsuites/setup.sh
blob: 76fefb85b9dba76addfeb0cccf01a8691599a624 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash

docker login -u docker -p docker nexus3.onap.org:10001

TEST_PLANS_DIR=$WORKSPACE/plans/dcaegen2-services-son-handler/testsuites
TEST_SCRIPTS_DIR=$WORKSPACE/scripts/dcaegen2-services-son-handler/sonhandler/cps-sonhandler
TEST_ROBOT_DIR=$WORKSPACE/tests/dcaegen2-services-son-handler/testcases
TEST_SCRIPTS_CPS_DIR=$WORKSPACE/scripts/dcaegen2-services-son-handler/sonhandler/cps-sonhandler/cps

docker-compose up -d

ZOOKEEPER_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' zookeeper)
KAFKA_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' kafka)
DMAAP_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' dmaap)
SONHMS_POSTGRES_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' sonhms-postgres)
SONHMS_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' sonhms.onap)

echo "Waiting for dmaap to come up ..."
for i in {1..10}; do
    dmaap_state=$(curl --write-out '%{http_code}' --silent --output /dev/null $DMAAP_IP:3904/topics)
    if [ $dmaap_state == "200" ]
    then
      break
    else
      sleep 60
    fi
done

#create topics
curl --header "Content-type: application/json" \
--request POST \
--data '{"topicName": "DCAE_CL_RSP"}' \
http://$DMAAP_IP:3904/events/DCAE_CL_RSP

curl --header "Content-type: application/json" \
--request POST \
--data '{"topicName": "unauthenticated.SEC_FAULT_OUTPUT"}' \
http://$DMAAP_IP:3904/events/unauthenticated.SEC_FAULT_OUTPUT

curl --header "Content-type: application/json" \
--request POST \
--data '{"topicName": "unauthenticated.VES_MEASUREMENT_OUTPUT"}' \
http://$DMAAP_IP:3904/events/unauthenticated.VES_MEASUREMENT_OUTPUT

curl --header "Content-type: application/json" \
--request POST \
--data '{"topicName": "unauthenticated.DCAE_CL_OUTPUT"}' \
http://$DMAAP_IP:3904/events/unauthenticated.DCAE_CL_OUTPUT
echo "topics created"

#build configdb-oof-sim image
cd $TEST_SCRIPTS_DIR
docker build -t configdb_oof_sim .

#run configdb-oof-sim
docker run -d --name configdb_oof_sim --network=testsuites_sonhms-default -p "5000:5000"  configdb_oof_sim:latest;
sleep 60
CONFIGDB_OOF_SIM_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' configdb_oof_sim)
echo "CONFIGDB_OOF_SIM_IP=${CONFIGDB_OOF_SIM_IP}"

# CPS set up
cd $TEST_SCRIPTS_CPS_DIR
sh cps-setup.sh


ROBOT_VARIABLES="-v ZOOKEEPER_IP:${ZOOKEEPER_IP} -v KAFKA_IP:${KAFKA_IP} -v DMAAP_IP:${DMAAP_IP} -v SONHMS_POSTGRES_IP:${SONHMS_POSTGRES_IP} -v SONHMS_IP:${SONHMS_IP} -v CONFIGDB_OOF_SIM_IP:${CONFIGDB_OOF_SIM_IP} -v TEST_ROBOT_DIR:${TEST_ROBOT_DIR}"