blob: 99753dfbc2015a69da229bf977fe71d9aab3b74a [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 Kaihlavirta6a19ed12020-11-25 16:30:48 +020018# Modifications copyright (c) 2020 Samsung Electronics Co., Ltd.
Gary Wu9abb61c2018-09-27 10:38:50 -070019#
20# Place the scripts in run order:
Lasse Kaihlavirta6a19ed12020-11-25 16:30:48 +020021set -x
Gary Wu9abb61c2018-09-27 10:38:50 -070022export NEXUS_USERNAME=docker
23export NEXUS_PASSWD=docker
24export NEXUS_DOCKER_REPO=nexus3.onap.org:10001
25export DMAAP_TOPIC=AUTO
Lasse Kaihlavirta6a19ed12020-11-25 16:30:48 +020026export DOCKER_IMAGE_VERSION=2.1-STAGING-latest
27export CCSDK_DOCKER_IMAGE_VERSION=1.1-STAGING-latest
Gary Wu9abb61c2018-09-27 10:38:50 -070028
29export MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1)
30
31if [ "$MTU" == "" ]; then
32 export MTU="1450"
33fi
34
35
36# Clone SDNC repo to get docker-compose for SDNC
37mkdir -p $WORKSPACE/archives/sdnc
38cd $WORKSPACE/archives
39git clone -b master --single-branch --depth=1 http://gerrit.onap.org/r/sdnc/oam.git sdnc
40cd $WORKSPACE/archives/sdnc
41git pull
42unset http_proxy https_proxy
43cd $WORKSPACE/archives/sdnc/installation/src/main/yaml
44
45sed -i "s/DMAAP_TOPIC_ENV=.*/DMAAP_TOPIC_ENV="AUTO"/g" docker-compose.yml
46docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO
47
48docker pull $NEXUS_DOCKER_REPO/onap/sdnc-image:$DOCKER_IMAGE_VERSION
49docker tag $NEXUS_DOCKER_REPO/onap/sdnc-image:$DOCKER_IMAGE_VERSION onap/sdnc-image:latest
50
51docker pull $NEXUS_DOCKER_REPO/onap/sdnc-ansible-server-image:$DOCKER_IMAGE_VERSION
52docker tag $NEXUS_DOCKER_REPO/onap/sdnc-ansible-server-image:$DOCKER_IMAGE_VERSION onap/sdnc-ansible-server-image:latest
53
54docker pull $NEXUS_DOCKER_REPO/onap/ccsdk-dgbuilder-image:$CCSDK_DOCKER_IMAGE_VERSION
55docker tag $NEXUS_DOCKER_REPO/onap/ccsdk-dgbuilder-image:$CCSDK_DOCKER_IMAGE_VERSION onap/ccsdk-dgbuilder-image:latest
56
Gary Wu9abb61c2018-09-27 10:38:50 -070057docker pull $NEXUS_DOCKER_REPO/onap/sdnc-ueb-listener-image:$DOCKER_IMAGE_VERSION
58docker tag $NEXUS_DOCKER_REPO/onap/sdnc-ueb-listener-image:$DOCKER_IMAGE_VERSION onap/sdnc-ueb-listener-image:latest
59
60docker pull $NEXUS_DOCKER_REPO/onap/sdnc-dmaap-listener-image:$DOCKER_IMAGE_VERSION
61
62docker tag $NEXUS_DOCKER_REPO/onap/sdnc-dmaap-listener-image:$DOCKER_IMAGE_VERSION onap/sdnc-dmaap-listener-image:latest
63
64
65# start SDNC containers with docker compose and configuration from docker-compose.yml
66docker-compose up -d
67
Lasse Kaihlavirta6a19ed12020-11-25 16:30:48 +020068# WAIT 5 minutes maximum and check karaf.log for readiness every 10 seconds
69
70TIME_OUT=300
71INTERVAL=10
72
Gary Wu9abb61c2018-09-27 10:38:50 -070073TIME=0
74while [ "$TIME" -lt "$TIME_OUT" ]; do
Gary Wu9abb61c2018-09-27 10:38:50 -070075
Lasse Kaihlavirta6a19ed12020-11-25 16:30:48 +020076docker exec sdnc_controller_container cat /opt/opendaylight/data/log/karaf.log | grep 'warp coils'
Gary Wu9abb61c2018-09-27 10:38:50 -070077
Lasse Kaihlavirta6a19ed12020-11-25 16:30:48 +020078 if [ $? == 0 ] ; then
Gary Wu9abb61c2018-09-27 10:38:50 -070079 echo SDNC karaf started in $TIME seconds
80 break;
81 fi
82
83 echo Sleep: $INTERVAL seconds before testing if SDNC is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds
84 sleep $INTERVAL
85 TIME=$(($TIME+$INTERVAL))
86done
87
88if [ "$TIME" -ge "$TIME_OUT" ]; then
Lasse Kaihlavirta6a19ed12020-11-25 16:30:48 +020089 echo TIME OUT: karaf session not started in $TIME_OUT seconds, setup failed
90 exit 1;
Gary Wu9abb61c2018-09-27 10:38:50 -070091fi
92
Lasse Kaihlavirta6a19ed12020-11-25 16:30:48 +020093num_bundles=$(docker exec -i sdnc_controller_container /opt/opendaylight/current/bin/client bundle:list | tail -1 | cut -d' ' -f1)
94num_failed_bundles=$(docker exec -i sdnc_controller_container /opt/opendaylight/current/bin/client bundle:list | grep Failure | wc -l)
95failed_bundles=$(docker exec -i sdnc_controller_container /opt/opendaylight/current/bin/client bundle:list | grep Failure)
96echo There is/are $num_failed_bundles failed bundles out of $num_bundles installed bundles.
Gary Wu9abb61c2018-09-27 10:38:50 -070097
98if [ "$num_failed_bundles" -ge 1 ]; then
99 echo "The following bundle(s) are in a failed state: "
100 echo " $failed_bundles"
101fi
102
Gary Wu9abb61c2018-09-27 10:38:50 -0700103# Pass any variables required by Robot test suites in ROBOT_VARIABLES
104ROBOT_VARIABLES="-v SCRIPTS:${SCRIPTS}"