blob: 6a3841ec25b09d8b0af27898beaa08b13142253a [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
Lasse Kaihlavirtaf02c14d2020-10-22 17:26:58 +030018# Modifications copyright (c) 2020 Samsung Electronics Co., Ltd.
Gary Wu9abb61c2018-09-27 10:38:50 -070019#
20# Place the scripts in run order:
Gary Wu9abb61c2018-09-27 10:38:50 -070021export MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1)
22export NEXUS_DOCKER_REPO="nexus3.onap.org:10001"
23export NEXUS_USERNAME=docker
24export NEXUS_PASSWD=docker
25export DMAAP_TOPIC=AUTO
Lasse Kaihlavirtaf02c14d2020-10-22 17:26:58 +030026export CCSDK_DOCKER_IMAGE_VERSION=1.1-STAGING-latest
Gary Wu9abb61c2018-09-27 10:38:50 -070027
28if [ "$MTU" == "" ]; then
29 export MTU="1450"
30fi
31
Gary Wu9abb61c2018-09-27 10:38:50 -070032# Clone CCSDK repo to get docker-compose for CCSDK
33mkdir -p $WORKSPACE/archives/ccsdk
34cd $WORKSPACE/archives
35git clone -b master --single-branch http://gerrit.onap.org/r/ccsdk/distribution.git ccsdk
36cd $WORKSPACE/archives/ccsdk
37git pull
38unset http_proxy https_proxy
39cd $WORKSPACE/archives/ccsdk/src/main/yaml
40
41sed -i "s/DMAAP_TOPIC_ENV=.*/DMAAP_TOPIC_ENV="AUTO"/g" docker-compose.yml
42docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO
43
Timoney, Dan (dt5972)adab1672019-02-06 12:23:14 -050044docker pull $NEXUS_DOCKER_REPO/onap/ccsdk-odlsli-alpine-image:$CCSDK_DOCKER_IMAGE_VERSION
Gary Wu9abb61c2018-09-27 10:38:50 -070045
46docker pull $NEXUS_DOCKER_REPO/onap/ccsdk-dgbuilder-image:$CCSDK_DOCKER_IMAGE_VERSION
Gary Wu9abb61c2018-09-27 10:38:50 -070047
Gary Wu9abb61c2018-09-27 10:38:50 -070048# start CCSDK containers with docker compose and configuration from docker-compose.yml
49curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > docker-compose
50chmod +x docker-compose
51./docker-compose up -d
52
Lasse Kaihlavirtaf02c14d2020-10-22 17:26:58 +030053# WAIT 5 minutes maximum and check karaf.log for readiness every 10 seconds
Gary Wu9abb61c2018-09-27 10:38:50 -070054
Lasse Kaihlavirtaf02c14d2020-10-22 17:26:58 +030055TIME_OUT=300
56INTERVAL=10
Gary Wu9abb61c2018-09-27 10:38:50 -070057TIME=0
58while [ "$TIME" -lt "$TIME_OUT" ]; do
59
Lasse Kaihlavirtaf02c14d2020-10-22 17:26:58 +030060docker exec ccsdk_odlsli_container cat /opt/opendaylight/data/log/karaf.log | grep 'warp coils'
Gary Wu9abb61c2018-09-27 10:38:50 -070061
Lasse Kaihlavirtaf02c14d2020-10-22 17:26:58 +030062 if [ $? == 0 ] ; then
Gary Wu9abb61c2018-09-27 10:38:50 -070063 echo CCSDK karaf started in $TIME seconds
64 break;
65 fi
66
67 echo Sleep: $INTERVAL seconds before testing if CCSDK is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds
68 sleep $INTERVAL
69 TIME=$(($TIME+$INTERVAL))
70done
71
72if [ "$TIME" -ge "$TIME_OUT" ]; then
Lasse Kaihlavirtaf02c14d2020-10-22 17:26:58 +030073 echo TIME OUT: karaf session not started in $TIME_OUT seconds, setup failed
74 exit 1;
Gary Wu9abb61c2018-09-27 10:38:50 -070075fi
76
Lasse Kaihlavirtaf02c14d2020-10-22 17:26:58 +030077num_bundles=$(docker exec -i ccsdk_odlsli_container /opt/opendaylight/current/bin/client bundle:list | tail -1 | cut -d' ' -f1)
Gary Wu9abb61c2018-09-27 10:38:50 -070078
Lasse Kaihlavirtaf02c14d2020-10-22 17:26:58 +030079 if [ "$num_bundles" -ge 333 ]; then
80 num_bundles=$(docker exec -i ccsdk_odlsli_container /opt/opendaylight/current/bin/client bundle:list | tail -1 | cut -d' ' -f1)
81 num_failed_bundles=$(docker exec -i ccsdk_odlsli_container /opt/opendaylight/current/bin/client bundle:list | grep Failure | wc -l)
82 failed_bundles=$(docker exec -i ccsdk_odlsli_container /opt/opendaylight/current/bin/client bundle:list | grep Failure)
Gary Wu9abb61c2018-09-27 10:38:50 -070083 echo There is/are $num_failed_bundles failed bundles out of $num_bundles installed bundles.
84 fi
85
86if [ "$num_failed_bundles" -ge 1 ]; then
87 echo "The following bundle(s) are in a failed state: "
88 echo " $failed_bundles"
89fi
90
91# Pass any variables required by Robot test suites in ROBOT_VARIABLES
92ROBOT_VARIABLES="-v SCRIPTS:${SCRIPTS}"
93