blob: 0a68ade8835fc027a4d19dedc20f2436ae6fa6f0 [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:
20source ${WORKSPACE}/test/csit/scripts/appc/script1.sh
21export MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1)
22
23
24# Clone APPC repo to get docker-compose for APPC
25mkdir -p $WORKSPACE/archives/appc
26cd $WORKSPACE/archives
27git clone -b master --single-branch http://gerrit.onap.org/r/appc/deployment.git appc
28cd $WORKSPACE/archives/appc
29git pull
30cd $WORKSPACE/archives/appc/docker-compose
31
32sed -i "s/DMAAP_TOPIC_ENV=.*/DMAAP_TOPIC_ENV="AUTO"/g" docker-compose.yml
33docker login -u docker -p docker nexus3.onap.org:10001
34
35docker pull nexus3.onap.org:10001/openecomp/appc-image:1.1-STAGING-latest
36docker tag nexus3.onap.org:10001/openecomp/appc-image:1.1-STAGING-latest openecomp/appc-image:latest
37
38docker pull nexus3.onap.org:10001/openecomp/dgbuilder-sdnc-image:1.1-STAGING-latest
39docker tag nexus3.onap.org:10001/openecomp/dgbuilder-sdnc-image:1.1-STAGING-latest openecomp/dgbuilder-sdnc-image:latest
40
41# start APPC containers with docker compose and configuration from docker-compose.yml
42/opt/docker/docker-compose up -d
43
44# WAIT 5 minutes maximum and test every 5 seconds if APPC is up using HealthCheck API
45TIME_OUT=1000
46INTERVAL=40
47TIME=0
48while [ "$TIME" -lt "$TIME_OUT" ]; do
49 response=$(curl --write-out '%{http_code}' --silent --output /dev/null -H "Authorization: Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==" -X POST -H "X-FromAppId: csit-appc" -H "X-TransactionId: csit-appc" -H "Accept: application/json" -H "Content-Type: application/json" http://localhost:8282/restconf/operations/SLI-API:healthcheck ); echo $response
50
51 if [ "$response" == "200" ]; then
52 echo APPC started in $TIME seconds
53 break;
54 fi
55
56 echo Sleep: $INTERVAL seconds before testing if APPC is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds
57 sleep $INTERVAL
58 TIME=$(($TIME+$INTERVAL))
59done
60
61if [ "$TIME" -ge "$TIME_OUT" ]; then
62 echo TIME OUT: Docker containers not started in $TIME_OUT seconds... Could cause problems for testing activities...
63fi
64
65# Pass any variables required by Robot test suites in ROBOT_VARIABLES
66#ROBOT_VARIABLES="-v TEST:${TEST}"
67