Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 1 | #!/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 Kaihlavirta | f02c14d | 2020-10-22 17:26:58 +0300 | [diff] [blame] | 18 | # Modifications copyright (c) 2020 Samsung Electronics Co., Ltd. |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 19 | # |
| 20 | # Place the scripts in run order: |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 21 | export MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1) |
| 22 | export NEXUS_DOCKER_REPO="nexus3.onap.org:10001" |
| 23 | export NEXUS_USERNAME=docker |
| 24 | export NEXUS_PASSWD=docker |
| 25 | export DMAAP_TOPIC=AUTO |
Lasse Kaihlavirta | f02c14d | 2020-10-22 17:26:58 +0300 | [diff] [blame] | 26 | export CCSDK_DOCKER_IMAGE_VERSION=1.1-STAGING-latest |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 27 | |
| 28 | if [ "$MTU" == "" ]; then |
| 29 | export MTU="1450" |
| 30 | fi |
| 31 | |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 32 | # Clone CCSDK repo to get docker-compose for CCSDK |
| 33 | mkdir -p $WORKSPACE/archives/ccsdk |
| 34 | cd $WORKSPACE/archives |
| 35 | git clone -b master --single-branch http://gerrit.onap.org/r/ccsdk/distribution.git ccsdk |
| 36 | cd $WORKSPACE/archives/ccsdk |
| 37 | git pull |
| 38 | unset http_proxy https_proxy |
| 39 | cd $WORKSPACE/archives/ccsdk/src/main/yaml |
| 40 | |
| 41 | sed -i "s/DMAAP_TOPIC_ENV=.*/DMAAP_TOPIC_ENV="AUTO"/g" docker-compose.yml |
| 42 | docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO |
| 43 | |
Timoney, Dan (dt5972) | adab167 | 2019-02-06 12:23:14 -0500 | [diff] [blame] | 44 | docker pull $NEXUS_DOCKER_REPO/onap/ccsdk-odlsli-alpine-image:$CCSDK_DOCKER_IMAGE_VERSION |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 45 | |
| 46 | docker pull $NEXUS_DOCKER_REPO/onap/ccsdk-dgbuilder-image:$CCSDK_DOCKER_IMAGE_VERSION |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 47 | |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 48 | # start CCSDK containers with docker compose and configuration from docker-compose.yml |
| 49 | curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > docker-compose |
| 50 | chmod +x docker-compose |
| 51 | ./docker-compose up -d |
| 52 | |
Lasse Kaihlavirta | f02c14d | 2020-10-22 17:26:58 +0300 | [diff] [blame] | 53 | # WAIT 5 minutes maximum and check karaf.log for readiness every 10 seconds |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 54 | |
Lasse Kaihlavirta | f02c14d | 2020-10-22 17:26:58 +0300 | [diff] [blame] | 55 | TIME_OUT=300 |
| 56 | INTERVAL=10 |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 57 | TIME=0 |
| 58 | while [ "$TIME" -lt "$TIME_OUT" ]; do |
| 59 | |
Lasse Kaihlavirta | f02c14d | 2020-10-22 17:26:58 +0300 | [diff] [blame] | 60 | docker exec ccsdk_odlsli_container cat /opt/opendaylight/data/log/karaf.log | grep 'warp coils' |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 61 | |
Lasse Kaihlavirta | f02c14d | 2020-10-22 17:26:58 +0300 | [diff] [blame] | 62 | if [ $? == 0 ] ; then |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 63 | 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)) |
| 70 | done |
| 71 | |
| 72 | if [ "$TIME" -ge "$TIME_OUT" ]; then |
Lasse Kaihlavirta | f02c14d | 2020-10-22 17:26:58 +0300 | [diff] [blame] | 73 | echo TIME OUT: karaf session not started in $TIME_OUT seconds, setup failed |
| 74 | exit 1; |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 75 | fi |
| 76 | |
Lasse Kaihlavirta | f02c14d | 2020-10-22 17:26:58 +0300 | [diff] [blame] | 77 | num_bundles=$(docker exec -i ccsdk_odlsli_container /opt/opendaylight/current/bin/client bundle:list | tail -1 | cut -d' ' -f1) |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 78 | |
Lasse Kaihlavirta | f02c14d | 2020-10-22 17:26:58 +0300 | [diff] [blame] | 79 | 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 Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 83 | echo There is/are $num_failed_bundles failed bundles out of $num_bundles installed bundles. |
| 84 | fi |
| 85 | |
| 86 | if [ "$num_failed_bundles" -ge 1 ]; then |
| 87 | echo "The following bundle(s) are in a failed state: " |
| 88 | echo " $failed_bundles" |
| 89 | fi |
| 90 | |
| 91 | # Pass any variables required by Robot test suites in ROBOT_VARIABLES |
| 92 | ROBOT_VARIABLES="-v SCRIPTS:${SCRIPTS}" |
| 93 | |