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 | 6a19ed1 | 2020-11-25 16:30:48 +0200 | [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: |
Lasse Kaihlavirta | 6a19ed1 | 2020-11-25 16:30:48 +0200 | [diff] [blame] | 21 | set -x |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 22 | export NEXUS_USERNAME=docker |
| 23 | export NEXUS_PASSWD=docker |
| 24 | export NEXUS_DOCKER_REPO=nexus3.onap.org:10001 |
| 25 | export DMAAP_TOPIC=AUTO |
Lasse Kaihlavirta | 6a19ed1 | 2020-11-25 16:30:48 +0200 | [diff] [blame] | 26 | export DOCKER_IMAGE_VERSION=2.1-STAGING-latest |
| 27 | export CCSDK_DOCKER_IMAGE_VERSION=1.1-STAGING-latest |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 28 | |
| 29 | export MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1) |
| 30 | |
| 31 | if [ "$MTU" == "" ]; then |
| 32 | export MTU="1450" |
| 33 | fi |
| 34 | |
| 35 | |
| 36 | # Clone SDNC repo to get docker-compose for SDNC |
| 37 | mkdir -p $WORKSPACE/archives/sdnc |
| 38 | cd $WORKSPACE/archives |
| 39 | git clone -b master --single-branch --depth=1 http://gerrit.onap.org/r/sdnc/oam.git sdnc |
| 40 | cd $WORKSPACE/archives/sdnc |
| 41 | git pull |
| 42 | unset http_proxy https_proxy |
| 43 | cd $WORKSPACE/archives/sdnc/installation/src/main/yaml |
| 44 | |
| 45 | sed -i "s/DMAAP_TOPIC_ENV=.*/DMAAP_TOPIC_ENV="AUTO"/g" docker-compose.yml |
| 46 | docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO |
| 47 | |
| 48 | docker pull $NEXUS_DOCKER_REPO/onap/sdnc-image:$DOCKER_IMAGE_VERSION |
| 49 | docker tag $NEXUS_DOCKER_REPO/onap/sdnc-image:$DOCKER_IMAGE_VERSION onap/sdnc-image:latest |
| 50 | |
| 51 | docker pull $NEXUS_DOCKER_REPO/onap/sdnc-ansible-server-image:$DOCKER_IMAGE_VERSION |
| 52 | docker tag $NEXUS_DOCKER_REPO/onap/sdnc-ansible-server-image:$DOCKER_IMAGE_VERSION onap/sdnc-ansible-server-image:latest |
| 53 | |
| 54 | docker pull $NEXUS_DOCKER_REPO/onap/ccsdk-dgbuilder-image:$CCSDK_DOCKER_IMAGE_VERSION |
| 55 | docker tag $NEXUS_DOCKER_REPO/onap/ccsdk-dgbuilder-image:$CCSDK_DOCKER_IMAGE_VERSION onap/ccsdk-dgbuilder-image:latest |
| 56 | |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 57 | docker pull $NEXUS_DOCKER_REPO/onap/sdnc-ueb-listener-image:$DOCKER_IMAGE_VERSION |
| 58 | docker tag $NEXUS_DOCKER_REPO/onap/sdnc-ueb-listener-image:$DOCKER_IMAGE_VERSION onap/sdnc-ueb-listener-image:latest |
| 59 | |
| 60 | docker pull $NEXUS_DOCKER_REPO/onap/sdnc-dmaap-listener-image:$DOCKER_IMAGE_VERSION |
| 61 | |
| 62 | docker 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 |
| 66 | docker-compose up -d |
| 67 | |
Lasse Kaihlavirta | 6a19ed1 | 2020-11-25 16:30:48 +0200 | [diff] [blame] | 68 | # WAIT 5 minutes maximum and check karaf.log for readiness every 10 seconds |
| 69 | |
| 70 | TIME_OUT=300 |
| 71 | INTERVAL=10 |
| 72 | |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 73 | TIME=0 |
| 74 | while [ "$TIME" -lt "$TIME_OUT" ]; do |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 75 | |
Lasse Kaihlavirta | 6a19ed1 | 2020-11-25 16:30:48 +0200 | [diff] [blame] | 76 | docker exec sdnc_controller_container cat /opt/opendaylight/data/log/karaf.log | grep 'warp coils' |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 77 | |
Lasse Kaihlavirta | 6a19ed1 | 2020-11-25 16:30:48 +0200 | [diff] [blame] | 78 | if [ $? == 0 ] ; then |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 79 | 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)) |
| 86 | done |
| 87 | |
| 88 | if [ "$TIME" -ge "$TIME_OUT" ]; then |
Lasse Kaihlavirta | 6a19ed1 | 2020-11-25 16:30:48 +0200 | [diff] [blame] | 89 | echo TIME OUT: karaf session not started in $TIME_OUT seconds, setup failed |
| 90 | exit 1; |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 91 | fi |
| 92 | |
Lasse Kaihlavirta | 6a19ed1 | 2020-11-25 16:30:48 +0200 | [diff] [blame] | 93 | num_bundles=$(docker exec -i sdnc_controller_container /opt/opendaylight/current/bin/client bundle:list | tail -1 | cut -d' ' -f1) |
| 94 | num_failed_bundles=$(docker exec -i sdnc_controller_container /opt/opendaylight/current/bin/client bundle:list | grep Failure | wc -l) |
| 95 | failed_bundles=$(docker exec -i sdnc_controller_container /opt/opendaylight/current/bin/client bundle:list | grep Failure) |
| 96 | echo There is/are $num_failed_bundles failed bundles out of $num_bundles installed bundles. |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 97 | |
| 98 | if [ "$num_failed_bundles" -ge 1 ]; then |
| 99 | echo "The following bundle(s) are in a failed state: " |
| 100 | echo " $failed_bundles" |
| 101 | fi |
| 102 | |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 103 | # Pass any variables required by Robot test suites in ROBOT_VARIABLES |
| 104 | ROBOT_VARIABLES="-v SCRIPTS:${SCRIPTS}" |