summaryrefslogtreecommitdiffstats
path: root/test/csit/plans/vfc-nfvo-driver-vnfm-gvnfm/sanity-check/setup.sh
blob: fed23c5aac492280b9d766392414f1ac79ecd7d6 (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
67
#!/bin/bash
#
# Copyright 2017 ZTE Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Place the scripts in run order:
# Start all process required for executing test case

source ${SCRIPTS}/common_functions.sh


#start msb
docker run -d -p 8500:8500  --name msb_consul consul
MSB_CONSUL_IP=`get-instance-ip.sh msb_consul`
echo MSB_CONSUL_IP=${MSB_CONSUL_IP}
docker run -d  -p 10081:10081  -e CONSUL_IP=$MSB_CONSUL_IP --name msb_discovery nexus3.onap.org:10001/onap/msb/msb_discovery
MSB_DISCOVERY_IP=`get-instance-ip.sh msb_discovery`
echo MSB_DISCOVERY_IP=${MSB_DISCOVERY_IP}
docker run -d -p 80:80 -e CONSUL_IP=$MSB_CONSUL_IP -e SDCLIENT_IP=$MSB_DISCOVERY_IP -e "ROUTE_LABELS=visualRange:1" --name msb_internal_apigateway nexus3.onap.org:10001/onap/msb/msb_apigateway
MSB_IAG_IP=`get-instance-ip.sh msb_internal_apigateway`
echo MSB_IAG_IP=${MSB_IAG_IP}

# Wait for initialization(8500 Consul, 10081 Service Registration & Discovery, 80 api gateway)
for i in {1..10}; do
    curl -sS -m 1 ${MSB_CONSUL_IP}:8500 && curl -sS -m 1 ${MSB_DISCOVERY_IP}:10081 && curl -sS -m 1 ${MSB_IAG_IP}:80 && break
    echo sleep $i
    sleep $i
done

# wait for container initalization
echo sleep 60
sleep 60
# start vfc-gvnfmdriver
docker run -d --name vfc-gvnfmdriver -e MSB_ADDR=${MSB_IAG_IP}:80 nexus3.onap.org:10001/onap/vfc/gvnfmdriver
GVNFMDRIVER_IP=`get-instance-ip.sh vfc-gvnfmdriver`

# Wait for initialization
for i in {1..10}; do
    curl -sS -m 1 ${GVNFMDRIVER_IP}:8484 && break
    echo sleep $i
    sleep $i
done

# start vfc-jujudriver
docker run -d --name vfc-jujudriver -e MSB_ADDR=${MSB_IAG_IP}:80 nexus3.onap.org:10001/onap/vfc/jujudriver
JUJUDRIVER_IP=`get-instance-ip.sh vfc-jujudriver`

# Wait for initialization
for i in {1..10}; do
    curl -sS ${JUJUDRIVER_IP}:8483 && break
    echo sleep $i
    sleep $i
done

# Pass any variables required by Robot test suites in ROBOT_VARIABLES
ROBOT_VARIABLES="-v MSB_IAG_IP:${MSB_IAG_IP} -v GVNFMDRIVER_IP:${GVNFMDRIVER_IP} -v JUJUDRIVER_IP:${JUJUDRIVER_IP}"
docker-compose.yml cp $CURR/.env . cp $CURR/docker-compose.yml . #cd properties_rackspace/ECOMPPORTALAPP #rm system.properties #cp $CURR/system.properties . #cd ../.. # Get image names used below from docker-compose environment file source $CURR/.env # Copy property files to new directory mkdir -p $PROPS_DIR cp -r properties_rackspace/* $PROPS_DIR # Also create logs directory mkdir -p $LOGS_DIR # Refresh images docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO docker pull $NEXUS_DOCKER_REPO/onap/${DB_IMG_NAME}:$DOCKER_IMAGE_VERSION docker pull $NEXUS_DOCKER_REPO/onap/${EP_IMG_NAME}:$DOCKER_IMAGE_VERSION docker pull $NEXUS_DOCKER_REPO/onap/${WMS_IMG_NAME}:$DOCKER_IMAGE_VERSION docker pull $NEXUS_DOCKER_REPO/$CLI_IMG_NAME:$CLI_DOCKER_VERSION # Tag them as expected by docker-compose file docker tag $NEXUS_DOCKER_REPO/onap/${DB_IMG_NAME}:$DOCKER_IMAGE_VERSION $DB_IMG_NAME:$PORTAL_TAG docker tag $NEXUS_DOCKER_REPO/onap/${EP_IMG_NAME}:$DOCKER_IMAGE_VERSION $EP_IMG_NAME:$PORTAL_TAG docker tag $NEXUS_DOCKER_REPO/onap/${WMS_IMG_NAME}:$DOCKER_IMAGE_VERSION $WMS_IMG_NAME:$PORTAL_TAG docker tag $NEXUS_DOCKER_REPO/$CLI_IMG_NAME:$CLI_DOCKER_VERSION $CLI_IMG_NAME:$PORTAL_TAG # compose is not in /usr/bin docker-compose down docker-compose up -d #${HOSTNAME}="portal.api.simpledemo.openecomp.org" #echo "$HOST_IP ${HOSTNAME}" >> /etc/hosts #echo "$HOST_IP portal.api.simpledemo.openecomp.org" >> /etc/hosts #sudo sed -i "2i$HOST_IP portal.api.simpledemo.openecomp.org" /etc/hosts #HOST="portal.api.simpledemo.openecomp.org" #sudo sed -i "/$HOST/ s/.*/$HOST_IP\t$HOST/g" /etc/hosts # insert/update hosts entry ip_address=$HOST_IP host_name="portal.api.simpledemo.openecomp.org" # find existing instances in the host file and save the line numbers matches_in_hosts="$(grep -n $host_name /etc/hosts | cut -f1 -d:)" host_entry="${ip_address} ${host_name}" echo "$host_entry" if [ ! -z "$matches_in_hosts" ] then echo "Updating existing hosts entry." # iterate over the line numbers on which matches were found while read -r line_number; do # replace the text of each line with the desired host entry sudo sed -i '' "${line_number}s/.*/${host_entry} /" /etc/hosts echo "${line_number} ${host_entry}" done <<< "$matches_in_hosts" else echo "Adding new hosts entry." echo "$host_entry" | sudo tee -a /etc/hosts > /dev/null fi # WAIT 5 minutes maximum and test every 5 seconds if Portal up using HealthCheck API TIME_OUT=460 INTERVAL=20 TIME=0 while [ "$TIME" -lt "$TIME_OUT" ]; do response=$(curl --write-out '%{http_code}' --silent --output /dev/null http://portal.api.simpledemo.openecomp.org:8989/ECOMPPORTAL/portalApi/healthCheck); echo $response if [ "$response" == "200" ]; then echo Portal and its database well started in $TIME seconds break; fi echo Sleep: $INTERVAL seconds before testing if Portal is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds sleep $INTERVAL TIME=$(($TIME+$INTERVAL)) done if [ "$TIME" -ge "$TIME_OUT" ]; then echo TIME OUT: Docker containers not started in $TIME_OUT seconds... Could cause problems for tests... fi #sleep 3m #if [ "$TIME" -ge "$TIME_OUT" ]; then # echo TIME OUT: Docker containers not started in $TIME_OUT seconds... Could cause problems for tests... #fi #Get current IP of VM HOST_IP=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $NF}') export HOST_IP=${HOST_IP} docker logs deliveries_portal-apps_1 docker logs deliveries_portal-wms_1