blob: 2934cd58d40df471ce2dcf32ace11177ddb88f82 [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
Dan Timoneyaf083892021-02-25 09:36:40 -050029# Set credentials
30export MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-mySecretPassword}
31export MYSQL_USER=${MYSQL_USER:-sdnc}
32export MYSQL_PASSWORD=${MYSQL_PASSWORD:-test123}
33export MYSQL_DATABASE=${MYSQL_DATABASE:-sdncdb}
34export ODL_USER=${ODL_USER:-admin}
35export ODL_PASSWORD=${ODL_PASSWORD:-Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U}
36export ODL_ADMIN_USER=${ODL_ADMIN_USER:-${ODL_USER}}
37export ODL_ADMIN_PASSWORD=${ODL_ADMIN_PASSWORD:-${ODL_PASSWORD}}
38export DMAAP_USER=${DMAAP_USER:-admin}
39export DMAAP_PASSWORD=${DMAAP_PASSWORD:-admin}
40export DMAAP_AUTHKEY=${DMAAP_AUTHKEY:-""}
41export AAI_TRUSTSTORE_PASSWORD=${AAI_TRUSTSTORE_PASSWORD:-changeit}
42export AAI_CLIENT_NAME=${AAI_CLIENT_NAME:-sdnc@sdnc.onap.org}
43export AAI_CLIENT_PASSWORD=${AAI_CLIENT_PASSWORD:-demo123456!}
44export ANSIBLE_TRUSTSTORE_PASSWORD=${ANSIBLE_TRUSTSTURE_PASSWORD:-changeit}
45export HONEYCOMB_USER=${HONEYCOMB_USER:-admin}
46export HONEYCOMB_PASSWORD=${HONEYCOMB_PASSWORD:-admin}
47export TRUSTSTORE_PASSWORD=${TRUSTSTORE_PASSWORD:-changeit}
48export KEYSTORE_PASSWORD=${KEYSTORE_PASSWORD:-adminadmin}
49export NENG_USER=${NENG_USER:-ccsdkapps}
50export NENG_PASSWORD=${NENG_PASSWORD:-ccsdkapps}
51export SO_USER=${SO_USER:-sdncaBpmn}
52export SO_PASSWORD=${SO_PASSWORD:-password1$}
53export CDS_USER=${CDS_USER:-ccsdkapps}
54export CDS_PASSWORD=${CDS_PASSWORD:-ccsdkapps}
55export ANSIBLE_USER=${ANSIBLE_USER:-sdnc}
56export ANSIBLE_PASSWORD=${ANSIBLE_PASSWORD:-sdnc}
57export SQL_CRYPTKEY=${SQL_CRYPTKEY:-fakECryptKey}
58export ASDC_USER=${ASDC_USER:-sdnc}
59export ASDC_PASSWORD=${ASDC_PASSWORD:-Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U}
60
61
Gary Wu9abb61c2018-09-27 10:38:50 -070062export MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1)
63
64if [ "$MTU" == "" ]; then
65 export MTU="1450"
66fi
67
68
69# Clone SDNC repo to get docker-compose for SDNC
70mkdir -p $WORKSPACE/archives/sdnc
71cd $WORKSPACE/archives
72git clone -b master --single-branch --depth=1 http://gerrit.onap.org/r/sdnc/oam.git sdnc
73cd $WORKSPACE/archives/sdnc
74git pull
75unset http_proxy https_proxy
76cd $WORKSPACE/archives/sdnc/installation/src/main/yaml
77
78sed -i "s/DMAAP_TOPIC_ENV=.*/DMAAP_TOPIC_ENV="AUTO"/g" docker-compose.yml
79docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO
80
81docker pull $NEXUS_DOCKER_REPO/onap/sdnc-image:$DOCKER_IMAGE_VERSION
82docker tag $NEXUS_DOCKER_REPO/onap/sdnc-image:$DOCKER_IMAGE_VERSION onap/sdnc-image:latest
83
84docker pull $NEXUS_DOCKER_REPO/onap/sdnc-ansible-server-image:$DOCKER_IMAGE_VERSION
85docker tag $NEXUS_DOCKER_REPO/onap/sdnc-ansible-server-image:$DOCKER_IMAGE_VERSION onap/sdnc-ansible-server-image:latest
86
87docker pull $NEXUS_DOCKER_REPO/onap/ccsdk-dgbuilder-image:$CCSDK_DOCKER_IMAGE_VERSION
88docker tag $NEXUS_DOCKER_REPO/onap/ccsdk-dgbuilder-image:$CCSDK_DOCKER_IMAGE_VERSION onap/ccsdk-dgbuilder-image:latest
89
Gary Wu9abb61c2018-09-27 10:38:50 -070090docker pull $NEXUS_DOCKER_REPO/onap/sdnc-ueb-listener-image:$DOCKER_IMAGE_VERSION
91docker tag $NEXUS_DOCKER_REPO/onap/sdnc-ueb-listener-image:$DOCKER_IMAGE_VERSION onap/sdnc-ueb-listener-image:latest
92
93docker pull $NEXUS_DOCKER_REPO/onap/sdnc-dmaap-listener-image:$DOCKER_IMAGE_VERSION
94
95docker tag $NEXUS_DOCKER_REPO/onap/sdnc-dmaap-listener-image:$DOCKER_IMAGE_VERSION onap/sdnc-dmaap-listener-image:latest
96
97
98# start SDNC containers with docker compose and configuration from docker-compose.yml
99docker-compose up -d
100
Lasse Kaihlavirta6a19ed12020-11-25 16:30:48 +0200101# WAIT 5 minutes maximum and check karaf.log for readiness every 10 seconds
102
103TIME_OUT=300
104INTERVAL=10
105
Gary Wu9abb61c2018-09-27 10:38:50 -0700106TIME=0
107while [ "$TIME" -lt "$TIME_OUT" ]; do
Gary Wu9abb61c2018-09-27 10:38:50 -0700108
Lasse Kaihlavirta6a19ed12020-11-25 16:30:48 +0200109docker exec sdnc_controller_container cat /opt/opendaylight/data/log/karaf.log | grep 'warp coils'
Gary Wu9abb61c2018-09-27 10:38:50 -0700110
Lasse Kaihlavirta6a19ed12020-11-25 16:30:48 +0200111 if [ $? == 0 ] ; then
Gary Wu9abb61c2018-09-27 10:38:50 -0700112 echo SDNC karaf started in $TIME seconds
113 break;
114 fi
115
116 echo Sleep: $INTERVAL seconds before testing if SDNC is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds
117 sleep $INTERVAL
118 TIME=$(($TIME+$INTERVAL))
119done
120
121if [ "$TIME" -ge "$TIME_OUT" ]; then
Lasse Kaihlavirta6a19ed12020-11-25 16:30:48 +0200122 echo TIME OUT: karaf session not started in $TIME_OUT seconds, setup failed
123 exit 1;
Gary Wu9abb61c2018-09-27 10:38:50 -0700124fi
125
Lasse Kaihlavirta6a19ed12020-11-25 16:30:48 +0200126num_bundles=$(docker exec -i sdnc_controller_container /opt/opendaylight/current/bin/client bundle:list | tail -1 | cut -d' ' -f1)
127num_failed_bundles=$(docker exec -i sdnc_controller_container /opt/opendaylight/current/bin/client bundle:list | grep Failure | wc -l)
128failed_bundles=$(docker exec -i sdnc_controller_container /opt/opendaylight/current/bin/client bundle:list | grep Failure)
129echo There is/are $num_failed_bundles failed bundles out of $num_bundles installed bundles.
Gary Wu9abb61c2018-09-27 10:38:50 -0700130
131if [ "$num_failed_bundles" -ge 1 ]; then
132 echo "The following bundle(s) are in a failed state: "
133 echo " $failed_bundles"
134fi
135
Gary Wu9abb61c2018-09-27 10:38:50 -0700136# Pass any variables required by Robot test suites in ROBOT_VARIABLES
137ROBOT_VARIABLES="-v SCRIPTS:${SCRIPTS}"