Aaron Hay | 5a7cb08 | 2017-08-21 19:09:35 +0000 | [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 |
| 18 | # |
| 19 | # Place the scripts in run order: |
Aaron Hay | db1e9c5 | 2017-08-24 15:06:59 +0000 | [diff] [blame] | 20 | SCRIPTS="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
Aaron Hay | 5a7cb08 | 2017-08-21 19:09:35 +0000 | [diff] [blame] | 21 | source ${WORKSPACE}/test/csit/scripts/appc/script1.sh |
Aaron Hay | 320028c | 2018-01-16 21:29:29 +0000 | [diff] [blame] | 22 | |
Patrick Brady | c21eb72 | 2018-05-22 14:40:02 -0700 | [diff] [blame^] | 23 | export APPC_DOCKER_IMAGE_VERSION=1.4.0-SNAPSHOT-latest |
Aaron Hay | ccbb893 | 2018-05-07 12:28:56 -0400 | [diff] [blame] | 24 | export CCSDK_DOCKER_IMAGE_VERSION=0.2-STAGING-latest |
Aaron Hay | 32818c8 | 2018-04-13 18:36:35 +0000 | [diff] [blame] | 25 | export BRANCH=master |
| 26 | export SOLUTION_NAME=onap |
Aaron Hay | db1e9c5 | 2017-08-24 15:06:59 +0000 | [diff] [blame] | 27 | |
Aaron Hay | 0e795a7 | 2017-09-20 03:14:04 +0000 | [diff] [blame] | 28 | export NEXUS_USERNAME=docker |
| 29 | export NEXUS_PASSWD=docker |
| 30 | export NEXUS_DOCKER_REPO=nexus3.onap.org:10001 |
| 31 | export DMAAP_TOPIC=AUTO |
Aaron Hay | 0e795a7 | 2017-09-20 03:14:04 +0000 | [diff] [blame] | 32 | |
Aaron Hay | 5a7cb08 | 2017-08-21 19:09:35 +0000 | [diff] [blame] | 33 | export MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1) |
| 34 | |
Aaron Hay | 0f33e96 | 2017-09-12 14:03:37 -0400 | [diff] [blame] | 35 | if [ "$MTU" == "" ]; then |
| 36 | export MTU="1450" |
| 37 | fi |
| 38 | |
Aaron Hay | 5a7cb08 | 2017-08-21 19:09:35 +0000 | [diff] [blame] | 39 | |
| 40 | # Clone APPC repo to get docker-compose for APPC |
| 41 | mkdir -p $WORKSPACE/archives/appc |
| 42 | cd $WORKSPACE/archives |
Aaron Hay | 320028c | 2018-01-16 21:29:29 +0000 | [diff] [blame] | 43 | git clone -b $BRANCH --single-branch http://gerrit.onap.org/r/appc/deployment.git appc |
Aaron Hay | 5a7cb08 | 2017-08-21 19:09:35 +0000 | [diff] [blame] | 44 | cd $WORKSPACE/archives/appc |
| 45 | git pull |
| 46 | cd $WORKSPACE/archives/appc/docker-compose |
Aaron Hay | 0e795a7 | 2017-09-20 03:14:04 +0000 | [diff] [blame] | 47 | sed -i "s/DMAAP_TOPIC_ENV=.*/DMAAP_TOPIC_ENV="$DMAAP_TOPIC"/g" docker-compose.yml |
| 48 | docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO |
Aaron Hay | 320028c | 2018-01-16 21:29:29 +0000 | [diff] [blame] | 49 | docker pull $NEXUS_DOCKER_REPO/${SOLUTION_NAME}/appc-image:$APPC_DOCKER_IMAGE_VERSION |
| 50 | docker tag $NEXUS_DOCKER_REPO/${SOLUTION_NAME}/appc-image:$APPC_DOCKER_IMAGE_VERSION ${SOLUTION_NAME}/appc-image:latest |
Aaron Hay | 570a18a | 2018-04-30 01:43:48 -0400 | [diff] [blame] | 51 | docker pull $NEXUS_DOCKER_REPO/${SOLUTION_NAME}/ccsdk-dgbuilder-image:$CCSDK_DOCKER_IMAGE_VERSION |
| 52 | docker tag $NEXUS_DOCKER_REPO/${SOLUTION_NAME}/ccsdk-dgbuilder-image:$CCSDK_DOCKER_IMAGE_VERSION ${SOLUTION_NAME}/ccsdk-dgbuilder-image:latest |
| 53 | docker pull $NEXUS_DOCKER_REPO/${SOLUTION_NAME}/appc-cdt-image:$APPC_DOCKER_IMAGE_VERSION |
| 54 | docker tag $NEXUS_DOCKER_REPO/${SOLUTION_NAME}/appc-cdt-image:$APPC_DOCKER_IMAGE_VERSION ${SOLUTION_NAME}/appc-cdt-image:latest |
| 55 | |
Aaron Hay | 5a7cb08 | 2017-08-21 19:09:35 +0000 | [diff] [blame] | 56 | # start APPC containers with docker compose and configuration from docker-compose.yml |
Aaron Hay | 0f33e96 | 2017-09-12 14:03:37 -0400 | [diff] [blame] | 57 | docker-compose up -d |
Aaron Hay | 5a7cb08 | 2017-08-21 19:09:35 +0000 | [diff] [blame] | 58 | # WAIT 5 minutes maximum and test every 5 seconds if APPC is up using HealthCheck API |
Aaron Hay | 30a68eb | 2017-09-25 20:28:30 +0000 | [diff] [blame] | 59 | TIME_OUT=2000 |
Aaron Hay | db1e9c5 | 2017-08-24 15:06:59 +0000 | [diff] [blame] | 60 | INTERVAL=30 |
Aaron Hay | 5a7cb08 | 2017-08-21 19:09:35 +0000 | [diff] [blame] | 61 | TIME=0 |
| 62 | while [ "$TIME" -lt "$TIME_OUT" ]; do |
Aaron Hay | 5a7cb08 | 2017-08-21 19:09:35 +0000 | [diff] [blame] | 63 | |
Aaron Hay | 30a68eb | 2017-09-25 20:28:30 +0000 | [diff] [blame] | 64 | startODL_status=$(docker exec appc_controller_container ps -e | grep startODL | wc -l) |
Aaron Hay | 32818c8 | 2018-04-13 18:36:35 +0000 | [diff] [blame] | 65 | waiting_bundles=$(docker exec appc_controller_container /opt/opendaylight/current/bin/client bundle:list | grep Waiting | wc -l) |
| 66 | run_level=$(docker exec appc_controller_container /opt/opendaylight/current/bin/client system:start-level) |
Aaron Hay | 30a68eb | 2017-09-25 20:28:30 +0000 | [diff] [blame] | 67 | |
| 68 | if [ "$run_level" == "Level 100" ] && [ "$startODL_status" -lt "1" ] && [ "$waiting_bundles" -lt "1" ] ; then |
Aaron Hay | 5a7cb08 | 2017-08-21 19:09:35 +0000 | [diff] [blame] | 69 | echo APPC started in $TIME seconds |
| 70 | break; |
| 71 | fi |
| 72 | |
| 73 | echo Sleep: $INTERVAL seconds before testing if APPC is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds |
| 74 | sleep $INTERVAL |
| 75 | TIME=$(($TIME+$INTERVAL)) |
| 76 | done |
| 77 | |
| 78 | if [ "$TIME" -ge "$TIME_OUT" ]; then |
Aaron Hay | 30a68eb | 2017-09-25 20:28:30 +0000 | [diff] [blame] | 79 | echo TIME OUT: Docker containers not started in $TIME_OUT seconds... Could cause problems for testing activities... |
Aaron Hay | 5a7cb08 | 2017-08-21 19:09:35 +0000 | [diff] [blame] | 80 | fi |
| 81 | |
Aaron Hay | 30a68eb | 2017-09-25 20:28:30 +0000 | [diff] [blame] | 82 | sleep 300 |
Aaron Hay | db1e9c5 | 2017-08-24 15:06:59 +0000 | [diff] [blame] | 83 | |
Aaron Hay | 5a7cb08 | 2017-08-21 19:09:35 +0000 | [diff] [blame] | 84 | # Pass any variables required by Robot test suites in ROBOT_VARIABLES |
Aaron Hay | db1e9c5 | 2017-08-24 15:06:59 +0000 | [diff] [blame] | 85 | ROBOT_VARIABLES="-v SCRIPTS:${SCRIPTS}" |