blob: 643d54fe9f2bddf496ae63a9c620f6f72caf6a6f [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
23export MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1)
24
25if [ "$MTU" == "" ]; then
26 export MTU="1450"
27fi
28
29
30# Clone SDNC repo to get docker-compose for SDNC
31mkdir -p $WORKSPACE/archives/sdnc
32cd $WORKSPACE/archives
33git clone -b master --single-branch http://gerrit.onap.org/r/sdnc/oam.git sdnc
34cd $WORKSPACE/archives/sdnc
35git pull
36unset http_proxy https_proxy
37cd $WORKSPACE/archives/sdnc/installation/src/main/yaml
38
39sed -i "s/DMAAP_TOPIC_ENV=.*/DMAAP_TOPIC_ENV="AUTO"/g" docker-compose.yml
40docker login -u docker -p docker nexus3.onap.org:10001
41
42docker pull nexus3.onap.org:10001/onap/sdnc-image:latest
43docker tag nexus3.onap.org:10001/onap/sdnc-image:latest onap/sdnc-image:latest
44
45docker pull nexus3.onap.org:10001/onap/ccsdk-dgbuilder-image:latest
46docker tag nexus3.onap.org:10001/onap/ccsdk-dgbuilder-image:latest onap/ccsdk-dgbuilder-image:latest
47
48docker pull nexus3.onap.org:10001/onap/admportal-sdnc-image:latest
49docker tag nexus3.onap.org:10001/onap/admportal-sdnc-image:latest onap/admportal-sdnc-image:latest
50
51# start SDNC containers with docker compose and configuration from docker-compose.yml
52curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > docker-compose
53chmod +x docker-compose
54./docker-compose up -d
55
56# WAIT 5 minutes maximum and test every 5 seconds if SDNC is up using HealthCheck API
57TIME_OUT=500
58INTERVAL=30
59TIME=0
60while [ "$TIME" -lt "$TIME_OUT" ]; do
61 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
62
63 if [ "$response" == "200" ]; then
64 echo SDNC started in $TIME seconds
65 break;
66 fi
67
68 echo Sleep: $INTERVAL seconds before testing if SDNC is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds
69 sleep $INTERVAL
70 TIME=$(($TIME+$INTERVAL))
71done
72
73if [ "$TIME" -ge "$TIME_OUT" ]; then
74 echo TIME OUT: Docker containers not started in $TIME_OUT seconds... Could cause problems for testing activities...
75fi
76
77#sleep 800
78
79TIME_OUT=1500
80INTERVAL=60
81TIME=0
82while [ "$TIME" -lt "$TIME_OUT" ]; do
83
84response=$(docker exec sdnc_controller_container /opt/opendaylight/current/bin/client -u karaf system:start-level)
85num_bundles=$(docker exec sdnc_controller_container /opt/opendaylight/current/bin/client -u karaf bundle:list | tail -1 | cut -d\| -f1)
86
87 if [ "$response" == "Level 100" ] && [ "$num_bundles" -ge 333 ]; then
88 echo SDNC karaf started in $TIME seconds
89 break;
90 fi
91
92 echo Sleep: $INTERVAL seconds before testing if SDNC is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds
93 sleep $INTERVAL
94 TIME=$(($TIME+$INTERVAL))
95done
96
97if [ "$TIME" -ge "$TIME_OUT" ]; then
98 echo TIME OUT: karaf session not started in $TIME_OUT seconds... Could cause problems for testing activities...
99fi
100
101response=$(docker exec sdnc_controller_container /opt/opendaylight/current/bin/client -u karaf system:start-level)
102num_bundles=$(docker exec sdnc_controller_container /opt/opendaylight/current/bin/client -u karaf bundle:list | tail -1 | cut -d\| -f1)
103
104 if [ "$response" == "Level 100" ] && [ "$num_bundles" -ge 333 ]; then
105 num_bundles=$(docker exec sdnc_controller_container /opt/opendaylight/current/bin/client -u karaf bundle:list | tail -1 | cut -d\| -f1)
106 num_failed_bundles=$(docker exec sdnc_controller_container /opt/opendaylight/current/bin/client -u karaf bundle:list | grep Failure | wc -l)
107 failed_bundles=$(docker exec sdnc_controller_container /opt/opendaylight/current/bin/client -u karaf bundle:list | grep Failure)
108 echo There is/are $num_failed_bundles failed bundles out of $num_bundles installed bundles.
109 fi
110
111if [ "$num_failed_bundles" -ge 1 ]; then
112 echo "The following bundle(s) are in a failed state: "
113 echo " $failed_bundles"
114fi
115
116# Pass any variables required by Robot test suites in ROBOT_VARIABLES
117ROBOT_VARIABLES="-v SCRIPTS:${SCRIPTS}"
118