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 | |
Dan Timoney | af08389 | 2021-02-25 09:36:40 -0500 | [diff] [blame] | 29 | # Set credentials |
| 30 | export MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-mySecretPassword} |
| 31 | export MYSQL_USER=${MYSQL_USER:-sdnc} |
| 32 | export MYSQL_PASSWORD=${MYSQL_PASSWORD:-test123} |
| 33 | export MYSQL_DATABASE=${MYSQL_DATABASE:-sdncdb} |
| 34 | export ODL_USER=${ODL_USER:-admin} |
| 35 | export ODL_PASSWORD=${ODL_PASSWORD:-Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U} |
| 36 | export ODL_ADMIN_USER=${ODL_ADMIN_USER:-${ODL_USER}} |
| 37 | export ODL_ADMIN_PASSWORD=${ODL_ADMIN_PASSWORD:-${ODL_PASSWORD}} |
| 38 | export DMAAP_USER=${DMAAP_USER:-admin} |
| 39 | export DMAAP_PASSWORD=${DMAAP_PASSWORD:-admin} |
| 40 | export DMAAP_AUTHKEY=${DMAAP_AUTHKEY:-""} |
| 41 | export AAI_TRUSTSTORE_PASSWORD=${AAI_TRUSTSTORE_PASSWORD:-changeit} |
| 42 | export AAI_CLIENT_NAME=${AAI_CLIENT_NAME:-sdnc@sdnc.onap.org} |
| 43 | export AAI_CLIENT_PASSWORD=${AAI_CLIENT_PASSWORD:-demo123456!} |
| 44 | export ANSIBLE_TRUSTSTORE_PASSWORD=${ANSIBLE_TRUSTSTURE_PASSWORD:-changeit} |
| 45 | export HONEYCOMB_USER=${HONEYCOMB_USER:-admin} |
| 46 | export HONEYCOMB_PASSWORD=${HONEYCOMB_PASSWORD:-admin} |
| 47 | export TRUSTSTORE_PASSWORD=${TRUSTSTORE_PASSWORD:-changeit} |
| 48 | export KEYSTORE_PASSWORD=${KEYSTORE_PASSWORD:-adminadmin} |
| 49 | export NENG_USER=${NENG_USER:-ccsdkapps} |
| 50 | export NENG_PASSWORD=${NENG_PASSWORD:-ccsdkapps} |
| 51 | export SO_USER=${SO_USER:-sdncaBpmn} |
| 52 | export SO_PASSWORD=${SO_PASSWORD:-password1$} |
| 53 | export CDS_USER=${CDS_USER:-ccsdkapps} |
| 54 | export CDS_PASSWORD=${CDS_PASSWORD:-ccsdkapps} |
| 55 | export ANSIBLE_USER=${ANSIBLE_USER:-sdnc} |
| 56 | export ANSIBLE_PASSWORD=${ANSIBLE_PASSWORD:-sdnc} |
| 57 | export SQL_CRYPTKEY=${SQL_CRYPTKEY:-fakECryptKey} |
| 58 | export ASDC_USER=${ASDC_USER:-sdnc} |
| 59 | export ASDC_PASSWORD=${ASDC_PASSWORD:-Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U} |
| 60 | |
| 61 | |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 62 | export MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1) |
| 63 | |
| 64 | if [ "$MTU" == "" ]; then |
| 65 | export MTU="1450" |
| 66 | fi |
| 67 | |
| 68 | |
| 69 | # Clone SDNC repo to get docker-compose for SDNC |
| 70 | mkdir -p $WORKSPACE/archives/sdnc |
| 71 | cd $WORKSPACE/archives |
| 72 | git clone -b master --single-branch --depth=1 http://gerrit.onap.org/r/sdnc/oam.git sdnc |
| 73 | cd $WORKSPACE/archives/sdnc |
| 74 | git pull |
| 75 | unset http_proxy https_proxy |
| 76 | cd $WORKSPACE/archives/sdnc/installation/src/main/yaml |
| 77 | |
| 78 | sed -i "s/DMAAP_TOPIC_ENV=.*/DMAAP_TOPIC_ENV="AUTO"/g" docker-compose.yml |
| 79 | docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO |
| 80 | |
| 81 | docker pull $NEXUS_DOCKER_REPO/onap/sdnc-image:$DOCKER_IMAGE_VERSION |
| 82 | docker tag $NEXUS_DOCKER_REPO/onap/sdnc-image:$DOCKER_IMAGE_VERSION onap/sdnc-image:latest |
| 83 | |
| 84 | docker pull $NEXUS_DOCKER_REPO/onap/sdnc-ansible-server-image:$DOCKER_IMAGE_VERSION |
| 85 | docker tag $NEXUS_DOCKER_REPO/onap/sdnc-ansible-server-image:$DOCKER_IMAGE_VERSION onap/sdnc-ansible-server-image:latest |
| 86 | |
| 87 | docker pull $NEXUS_DOCKER_REPO/onap/ccsdk-dgbuilder-image:$CCSDK_DOCKER_IMAGE_VERSION |
| 88 | docker tag $NEXUS_DOCKER_REPO/onap/ccsdk-dgbuilder-image:$CCSDK_DOCKER_IMAGE_VERSION onap/ccsdk-dgbuilder-image:latest |
| 89 | |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 90 | docker pull $NEXUS_DOCKER_REPO/onap/sdnc-ueb-listener-image:$DOCKER_IMAGE_VERSION |
| 91 | docker tag $NEXUS_DOCKER_REPO/onap/sdnc-ueb-listener-image:$DOCKER_IMAGE_VERSION onap/sdnc-ueb-listener-image:latest |
| 92 | |
| 93 | docker pull $NEXUS_DOCKER_REPO/onap/sdnc-dmaap-listener-image:$DOCKER_IMAGE_VERSION |
| 94 | |
| 95 | docker 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 |
| 99 | docker-compose up -d |
| 100 | |
Lasse Kaihlavirta | 6a19ed1 | 2020-11-25 16:30:48 +0200 | [diff] [blame] | 101 | # WAIT 5 minutes maximum and check karaf.log for readiness every 10 seconds |
| 102 | |
| 103 | TIME_OUT=300 |
| 104 | INTERVAL=10 |
| 105 | |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 106 | TIME=0 |
| 107 | while [ "$TIME" -lt "$TIME_OUT" ]; do |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 108 | |
Lasse Kaihlavirta | 6a19ed1 | 2020-11-25 16:30:48 +0200 | [diff] [blame] | 109 | 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] | 110 | |
Lasse Kaihlavirta | 6a19ed1 | 2020-11-25 16:30:48 +0200 | [diff] [blame] | 111 | if [ $? == 0 ] ; then |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 112 | 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)) |
| 119 | done |
| 120 | |
| 121 | if [ "$TIME" -ge "$TIME_OUT" ]; then |
Lasse Kaihlavirta | 6a19ed1 | 2020-11-25 16:30:48 +0200 | [diff] [blame] | 122 | echo TIME OUT: karaf session not started in $TIME_OUT seconds, setup failed |
| 123 | exit 1; |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 124 | fi |
| 125 | |
Lasse Kaihlavirta | 6a19ed1 | 2020-11-25 16:30:48 +0200 | [diff] [blame] | 126 | num_bundles=$(docker exec -i sdnc_controller_container /opt/opendaylight/current/bin/client bundle:list | tail -1 | cut -d' ' -f1) |
| 127 | num_failed_bundles=$(docker exec -i sdnc_controller_container /opt/opendaylight/current/bin/client bundle:list | grep Failure | wc -l) |
| 128 | failed_bundles=$(docker exec -i sdnc_controller_container /opt/opendaylight/current/bin/client bundle:list | grep Failure) |
| 129 | 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] | 130 | |
| 131 | if [ "$num_failed_bundles" -ge 1 ]; then |
| 132 | echo "The following bundle(s) are in a failed state: " |
| 133 | echo " $failed_bundles" |
| 134 | fi |
| 135 | |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 136 | # Pass any variables required by Robot test suites in ROBOT_VARIABLES |
| 137 | ROBOT_VARIABLES="-v SCRIPTS:${SCRIPTS}" |