blob: a8119f61696dff6011debe72732686e7fa6643c3 [file] [log] [blame]
ramu.n519f54d2017-09-16 16:25:35 +05301#!/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 )"
21source ${WORKSPACE}/test/csit/scripts/sdnc/script1.sh
22
Stilwell, David (stilwelld)cfbb8b12017-09-27 18:08:35 +000023export NEXUS_USERNAME=docker
24export NEXUS_PASSWD=docker
Dan Timoney86ba2b12017-10-04 14:14:15 -040025export NEXUS_DOCKER_REPO=nexus3.onap.org:10001
Stilwell, David (stilwelld)cfbb8b12017-09-27 18:08:35 +000026export DMAAP_TOPIC=AUTO
Timoney, Dan (dt5972)09cb0342018-03-20 10:23:53 -040027export DOCKER_IMAGE_VERSION=1.3-STAGING-latest
28export CCSDK_DOCKER_IMAGE_VERSION=0.2-STAGING-latest
Stilwell, David (stilwelld)cfbb8b12017-09-27 18:08:35 +000029
ramu.n519f54d2017-09-16 16:25:35 +053030export MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1)
31
32if [ "$MTU" == "" ]; then
33 export MTU="1450"
34fi
35
36
37# Clone SDNC repo to get docker-compose for SDNC
38mkdir -p $WORKSPACE/archives/sdnc
39cd $WORKSPACE/archives
Dan Timoney564a58f2017-11-03 16:37:17 -040040git clone -b master --single-branch --depth=1 http://gerrit.onap.org/r/sdnc/oam.git sdnc
ramu.n519f54d2017-09-16 16:25:35 +053041cd $WORKSPACE/archives/sdnc
42git pull
43unset http_proxy https_proxy
44cd $WORKSPACE/archives/sdnc/installation/src/main/yaml
45
46sed -i "s/DMAAP_TOPIC_ENV=.*/DMAAP_TOPIC_ENV="AUTO"/g" docker-compose.yml
Stilwell, David (stilwelld)cfbb8b12017-09-27 18:08:35 +000047docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO
ramu.n519f54d2017-09-16 16:25:35 +053048
Stilwell, David (stilwelld)cfbb8b12017-09-27 18:08:35 +000049docker pull $NEXUS_DOCKER_REPO/onap/sdnc-image:$DOCKER_IMAGE_VERSION
50docker tag $NEXUS_DOCKER_REPO/onap/sdnc-image:$DOCKER_IMAGE_VERSION onap/sdnc-image:latest
ramu.n519f54d2017-09-16 16:25:35 +053051
Timoney, Daniel (dt5972)0d1b36d2018-05-01 16:17:36 -040052docker pull $NEXUS_DOCKER_REPO/onap/sdnc-ansible-server-image:$DOCKER_IMAGE_VERSION
53docker tag $NEXUS_DOCKER_REPO/onap/sdnc-ansible-server-image:$DOCKER_IMAGE_VERSION onap/sdnc-ansible-server-image:latest
54
Stilwell, David (stilwelld)cfbb8b12017-09-27 18:08:35 +000055docker pull $NEXUS_DOCKER_REPO/onap/ccsdk-dgbuilder-image:$CCSDK_DOCKER_IMAGE_VERSION
56docker tag $NEXUS_DOCKER_REPO/onap/ccsdk-dgbuilder-image:$CCSDK_DOCKER_IMAGE_VERSION onap/ccsdk-dgbuilder-image:latest
ramu.n519f54d2017-09-16 16:25:35 +053057
Stilwell, David (stilwelld)cfbb8b12017-09-27 18:08:35 +000058docker pull $NEXUS_DOCKER_REPO/onap/admportal-sdnc-image:$DOCKER_IMAGE_VERSION
59docker tag $NEXUS_DOCKER_REPO/onap/admportal-sdnc-image:$DOCKER_IMAGE_VERSION onap/admportal-sdnc-image:latest
ramu.n519f54d2017-09-16 16:25:35 +053060
Dan Timoney564a58f2017-11-03 16:37:17 -040061docker pull $NEXUS_DOCKER_REPO/onap/sdnc-ueb-listener-image:$DOCKER_IMAGE_VERSION
62docker tag $NEXUS_DOCKER_REPO/onap/sdnc-ueb-listener-image:$DOCKER_IMAGE_VERSION onap/sdnc-ueb-listener-image:latest
63
64docker pull $NEXUS_DOCKER_REPO/onap/sdnc-dmaap-listener-image:$DOCKER_IMAGE_VERSION
65
66docker tag $NEXUS_DOCKER_REPO/onap/sdnc-dmaap-listener-image:$DOCKER_IMAGE_VERSION onap/sdnc-dmaap-listener-image:latest
67
68
ramu.n519f54d2017-09-16 16:25:35 +053069# start SDNC containers with docker compose and configuration from docker-compose.yml
prakash.e98e26ad2018-03-14 20:34:11 +053070docker-compose up -d
ramu.n519f54d2017-09-16 16:25:35 +053071
Dan Timoneyc23c0002017-11-13 09:37:16 -050072# WAIT 10 minutes maximum and test every 5 seconds if SDNC is up using HealthCheck API
73TIME_OUT=1000
ramu.n519f54d2017-09-16 16:25:35 +053074INTERVAL=30
75TIME=0
76while [ "$TIME" -lt "$TIME_OUT" ]; do
77 response=$(curl --write-out '%{http_code}' --silent --output /dev/null -H "Authorization: Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==" -X POST -H "X-FromAppId: csit-sdnc" -H "X-TransactionId: csit-sdnc" -H "Accept: application/json" -H "Content-Type: application/json" http://localhost:8282/restconf/operations/SLI-API:healthcheck ); echo $response
78
79 if [ "$response" == "200" ]; then
80 echo SDNC started in $TIME seconds
81 break;
82 fi
83
84 echo Sleep: $INTERVAL seconds before testing if SDNC is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds
85 sleep $INTERVAL
86 TIME=$(($TIME+$INTERVAL))
87done
88
89if [ "$TIME" -ge "$TIME_OUT" ]; then
90 echo TIME OUT: Docker containers not started in $TIME_OUT seconds... Could cause problems for testing activities...
91fi
92
93#sleep 800
94
95TIME_OUT=1500
96INTERVAL=60
97TIME=0
98while [ "$TIME" -lt "$TIME_OUT" ]; do
99
Timoney, Dan (dt5972)09cb0342018-03-20 10:23:53 -0400100docker exec sdnc_controller_container rm -f /opt/opendaylight/current/etc/host.key
101response=$(docker exec sdnc_controller_container /opt/opendaylight/current/bin/client system:start-level)
102docker exec sdnc_controller_container rm -f /opt/opendaylight/current/etc/host.key
103num_bundles=$(docker exec sdnc_controller_container /opt/opendaylight/current/bin/client bundle:list | tail -1 | cut -d\| -f1)
ramu.n519f54d2017-09-16 16:25:35 +0530104
105 if [ "$response" == "Level 100" ] && [ "$num_bundles" -ge 333 ]; then
106 echo SDNC karaf started in $TIME seconds
107 break;
108 fi
109
110 echo Sleep: $INTERVAL seconds before testing if SDNC is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds
111 sleep $INTERVAL
112 TIME=$(($TIME+$INTERVAL))
113done
114
115if [ "$TIME" -ge "$TIME_OUT" ]; then
116 echo TIME OUT: karaf session not started in $TIME_OUT seconds... Could cause problems for testing activities...
117fi
118
Timoney, Dan (dt5972)09cb0342018-03-20 10:23:53 -0400119response=$(docker exec sdnc_controller_container /opt/opendaylight/current/bin/client system:start-level)
120num_bundles=$(docker exec sdnc_controller_container /opt/opendaylight/current/bin/client bundle:list | tail -1 | cut -d\| -f1)
ramu.n519f54d2017-09-16 16:25:35 +0530121
122 if [ "$response" == "Level 100" ] && [ "$num_bundles" -ge 333 ]; then
Timoney, Dan (dt5972)09cb0342018-03-20 10:23:53 -0400123 num_bundles=$(docker exec sdnc_controller_container /opt/opendaylight/current/bin/client bundle:list | tail -1 | cut -d\| -f1)
124 num_failed_bundles=$(docker exec sdnc_controller_container /opt/opendaylight/current/bin/client bundle:list | grep Failure | wc -l)
125 failed_bundles=$(docker exec sdnc_controller_container /opt/opendaylight/current/bin/client bundle:list | grep Failure)
ramu.n519f54d2017-09-16 16:25:35 +0530126 echo There is/are $num_failed_bundles failed bundles out of $num_bundles installed bundles.
127 fi
128
129if [ "$num_failed_bundles" -ge 1 ]; then
130 echo "The following bundle(s) are in a failed state: "
131 echo " $failed_bundles"
132fi
133
Dan Timoney419c3792017-11-15 11:42:12 -0500134# Sleep additional 5 minutes (300 secs) to give application time to finish
135sleep 300
Stilwell, David (stilwelld)eb661132017-10-27 13:40:09 +0000136
ramu.n519f54d2017-09-16 16:25:35 +0530137# Pass any variables required by Robot test suites in ROBOT_VARIABLES
138ROBOT_VARIABLES="-v SCRIPTS:${SCRIPTS}"
139