blob: 406743303a2753388d0cb335760f9967d064634e [file] [log] [blame]
Aaron Hay5a7cb082017-08-21 19:09:35 +00001#!/bin/bash
2#
3# Copyright 2016-2017 Huawei Technologies Co., Ltd.
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#
17# Modifications copyright (c) 2017 AT&T Intellectual Property
18#
19# Place the scripts in run order:
Aaron Haydb1e9c52017-08-24 15:06:59 +000020SCRIPTS="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
Aaron Hay5a7cb082017-08-21 19:09:35 +000021source ${WORKSPACE}/test/csit/scripts/appc/script1.sh
Aaron Hay320028c2018-01-16 21:29:29 +000022amsterdam="$(echo ${WORKSPACE} | grep amsterdam | wc -l)"
23
24if [ "$amsterdam" != "1" ]; then
25 export APPC_DOCKER_IMAGE_VERSION=1.3.0-SNAPSHOT-latest
26 export CCSDK_DOCKER_IMAGE_VERSION=0.1-STAGING-latest
27 export BRANCH=master
28 export SOLUTION_NAME=onap
29else
30 export APPC_DOCKER_IMAGE_VERSION=v1.2.0
31 export CCSDK_DOCKER_IMAGE_VERSION=v0.1.0
32 export BRANCH=amsterdam
33 export SOLUTION_NAME=openecomp
34fi
Aaron Haydb1e9c52017-08-24 15:06:59 +000035
Aaron Hay0e795a72017-09-20 03:14:04 +000036export NEXUS_USERNAME=docker
37export NEXUS_PASSWD=docker
38export NEXUS_DOCKER_REPO=nexus3.onap.org:10001
39export DMAAP_TOPIC=AUTO
Aaron Hay0e795a72017-09-20 03:14:04 +000040
Aaron Hay5a7cb082017-08-21 19:09:35 +000041export MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1)
42
Aaron Hay0f33e962017-09-12 14:03:37 -040043if [ "$MTU" == "" ]; then
44 export MTU="1450"
45fi
46
Aaron Hay5a7cb082017-08-21 19:09:35 +000047
48# Clone APPC repo to get docker-compose for APPC
49mkdir -p $WORKSPACE/archives/appc
50cd $WORKSPACE/archives
Aaron Hay320028c2018-01-16 21:29:29 +000051git clone -b $BRANCH --single-branch http://gerrit.onap.org/r/appc/deployment.git appc
Aaron Hay5a7cb082017-08-21 19:09:35 +000052cd $WORKSPACE/archives/appc
53git pull
54cd $WORKSPACE/archives/appc/docker-compose
Aaron Hay0e795a72017-09-20 03:14:04 +000055sed -i "s/DMAAP_TOPIC_ENV=.*/DMAAP_TOPIC_ENV="$DMAAP_TOPIC"/g" docker-compose.yml
56docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO
Aaron Hay320028c2018-01-16 21:29:29 +000057docker pull $NEXUS_DOCKER_REPO/${SOLUTION_NAME}/appc-image:$APPC_DOCKER_IMAGE_VERSION
58docker tag $NEXUS_DOCKER_REPO/${SOLUTION_NAME}/appc-image:$APPC_DOCKER_IMAGE_VERSION ${SOLUTION_NAME}/appc-image:latest
Aaron Hay30a68eb2017-09-25 20:28:30 +000059docker pull $NEXUS_DOCKER_REPO/onap/ccsdk-dgbuilder-image:$CCSDK_DOCKER_IMAGE_VERSION
60docker tag $NEXUS_DOCKER_REPO/onap/ccsdk-dgbuilder-image:$CCSDK_DOCKER_IMAGE_VERSION onap/ccsdk-dgbuilder-image:latest
Aaron Hay5a7cb082017-08-21 19:09:35 +000061# start APPC containers with docker compose and configuration from docker-compose.yml
Aaron Hay0f33e962017-09-12 14:03:37 -040062docker-compose up -d
Aaron Hay5a7cb082017-08-21 19:09:35 +000063# WAIT 5 minutes maximum and test every 5 seconds if APPC is up using HealthCheck API
Aaron Hay30a68eb2017-09-25 20:28:30 +000064TIME_OUT=2000
Aaron Haydb1e9c52017-08-24 15:06:59 +000065INTERVAL=30
Aaron Hay5a7cb082017-08-21 19:09:35 +000066TIME=0
67while [ "$TIME" -lt "$TIME_OUT" ]; do
Aaron Hay5a7cb082017-08-21 19:09:35 +000068
Aaron Hay30a68eb2017-09-25 20:28:30 +000069startODL_status=$(docker exec appc_controller_container ps -e | grep startODL | wc -l)
70waiting_bundles=$(docker exec appc_controller_container /opt/opendaylight/current/bin/client -u karaf bundle:list | grep Waiting | wc -l)
71run_level=$(docker exec appc_controller_container /opt/opendaylight/current/bin/client -u karaf system:start-level)
72
73 if [ "$run_level" == "Level 100" ] && [ "$startODL_status" -lt "1" ] && [ "$waiting_bundles" -lt "1" ] ; then
Aaron Hay5a7cb082017-08-21 19:09:35 +000074 echo APPC started in $TIME seconds
75 break;
76 fi
77
78 echo Sleep: $INTERVAL seconds before testing if APPC is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds
79 sleep $INTERVAL
80 TIME=$(($TIME+$INTERVAL))
81done
82
83if [ "$TIME" -ge "$TIME_OUT" ]; then
Aaron Hay30a68eb2017-09-25 20:28:30 +000084 echo TIME OUT: Docker containers not started in $TIME_OUT seconds... Could cause problems for testing activities...
Aaron Hay5a7cb082017-08-21 19:09:35 +000085fi
86
Aaron Hay30a68eb2017-09-25 20:28:30 +000087sleep 300
Aaron Haydb1e9c52017-08-24 15:06:59 +000088
Aaron Hay5a7cb082017-08-21 19:09:35 +000089# Pass any variables required by Robot test suites in ROBOT_VARIABLES
Aaron Haydb1e9c52017-08-24 15:06:59 +000090ROBOT_VARIABLES="-v SCRIPTS:${SCRIPTS}"