blob: c78f4a82eb1cf881e92465f9fa94d9f9b7202447 [file] [log] [blame]
Gary Wu9abb61c2018-09-27 10:38:50 -07001#!/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:
20SCRIPTS="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
Gary Wu13111e92018-09-27 11:31:33 -070021source ${WORKSPACE}/scripts/appc/script1.sh
Gary Wu9abb61c2018-09-27 10:38:50 -070022
umry836481be59d2019-10-01 11:10:09 +020023export APPC_DOCKER_IMAGE_VERSION=1.6.2-SNAPSHOT-latest
24export DGBUILDER_DOCKER_IMAGE_VERSION=0.6.0
25export ANSIBLE_DOCKER_IMAGE_VERSION=0.6.1-STAGING-latest
Gary Wu9abb61c2018-09-27 10:38:50 -070026export BRANCH=master
27export SOLUTION_NAME=onap
28
29export NEXUS_USERNAME=docker
30export NEXUS_PASSWD=docker
31export NEXUS_DOCKER_REPO=nexus3.onap.org:10001
32export DMAAP_TOPIC=AUTO
33
34export MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1)
35
36if [ "$MTU" == "" ]; then
37 export MTU="1450"
38fi
39
40
41# Clone APPC repo to get docker-compose for APPC
42mkdir -p $WORKSPACE/archives/appc
43cd $WORKSPACE/archives
44git clone -b $BRANCH --single-branch http://gerrit.onap.org/r/appc/deployment.git appc
45cd $WORKSPACE/archives/appc
46git pull
47cd $WORKSPACE/archives/appc/docker-compose
48sed -i "s/DMAAP_TOPIC_ENV=.*/DMAAP_TOPIC_ENV="$DMAAP_TOPIC"/g" docker-compose.yml
49docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO
Aaron Hay73792ad2018-10-05 20:25:34 +000050
Gary Wu9abb61c2018-09-27 10:38:50 -070051docker pull $NEXUS_DOCKER_REPO/${SOLUTION_NAME}/appc-image:$APPC_DOCKER_IMAGE_VERSION
52docker tag $NEXUS_DOCKER_REPO/${SOLUTION_NAME}/appc-image:$APPC_DOCKER_IMAGE_VERSION ${SOLUTION_NAME}/appc-image:latest
Aaron Hay73792ad2018-10-05 20:25:34 +000053
54docker pull $NEXUS_DOCKER_REPO/${SOLUTION_NAME}/ccsdk-dgbuilder-image:$DGBUILDER_DOCKER_IMAGE_VERSION
55docker tag $NEXUS_DOCKER_REPO/${SOLUTION_NAME}/ccsdk-dgbuilder-image:$DGBUILDER_DOCKER_IMAGE_VERSION ${SOLUTION_NAME}/ccsdk-dgbuilder-image:latest
56
57docker pull $NEXUS_DOCKER_REPO/${SOLUTION_NAME}/ccsdk-ansible-server-image:$ANSIBLE_DOCKER_IMAGE_VERSION
58docker tag $NEXUS_DOCKER_REPO/${SOLUTION_NAME}/ccsdk-ansible-server-image:$ANSIBLE_DOCKER_IMAGE_VERSION ${SOLUTION_NAME}/ccsdk-ansible-server-image:latest
59
Gary Wu9abb61c2018-09-27 10:38:50 -070060docker pull $NEXUS_DOCKER_REPO/${SOLUTION_NAME}/appc-cdt-image:$APPC_DOCKER_IMAGE_VERSION
61docker tag $NEXUS_DOCKER_REPO/${SOLUTION_NAME}/appc-cdt-image:$APPC_DOCKER_IMAGE_VERSION ${SOLUTION_NAME}/appc-cdt-image:latest
62
63# start APPC containers with docker compose and configuration from docker-compose.yml
64docker-compose up -d
65# WAIT 5 minutes maximum and test every 5 seconds if APPC is up using HealthCheck API
66TIME_OUT=2000
67INTERVAL=30
68TIME=0
69while [ "$TIME" -lt "$TIME_OUT" ]; do
70
71startODL_status=$(docker exec appc_controller_container ps -e | grep startODL | wc -l)
72waiting_bundles=$(docker exec appc_controller_container /opt/opendaylight/current/bin/client bundle:list | grep Waiting | wc -l)
73run_level=$(docker exec appc_controller_container /opt/opendaylight/current/bin/client system:start-level)
74
75 if [ "$run_level" == "Level 100" ] && [ "$startODL_status" -lt "1" ] && [ "$waiting_bundles" -lt "1" ] ; then
76 echo APPC started in $TIME seconds
77 break;
78 fi
79
80 echo Sleep: $INTERVAL seconds before testing if APPC is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds
81 sleep $INTERVAL
82 TIME=$(($TIME+$INTERVAL))
83done
84
85if [ "$TIME" -ge "$TIME_OUT" ]; then
86 echo TIME OUT: Docker containers not started in $TIME_OUT seconds... Could cause problems for testing activities...
87fi
88
89sleep 300
90
91# Pass any variables required by Robot test suites in ROBOT_VARIABLES
92ROBOT_VARIABLES="-v SCRIPTS:${SCRIPTS}"