3 # Copyright 2016-2017 Huawei Technologies Co., Ltd.
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
9 # http://www.apache.org/licenses/LICENSE-2.0
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.
17 # Modifications copyright (c) 2017 AT&T Intellectual Property
19 # Place the scripts in run order:
20 SCRIPTS="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
21 source ${WORKSPACE}/scripts/sdnc/script1.sh
22 export DOCKER_SDNC_TAG=1.8-STAGING-latest
23 export NEXUS_USERNAME=docker
24 export NEXUS_PASSWD=docker
25 export NEXUS_DOCKER_REPO=nexus3.onap.org:10001
26 export DMAAP_TOPIC=AUTO
27 export DOCKER_IMAGE_VERSION=1.8-STAGING-latest
28 export CCSDK_DOCKER_IMAGE_VERSION=0.7-STAGING-latest
29 export SDNC_GERRIT_BRANCH=frankfurt
30 export INTEGRATION_GERRIT_BRANCH=master
32 export MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1)
34 if [ "$MTU" == "" ]; then
38 # Clone SDNC repo to get docker-compose for SDNC
39 mkdir -p $WORKSPACE/archives/integration
40 cd $WORKSPACE/archives
41 git clone -b ${INTEGRATION_GERRIT_BRANCH} --single-branch --depth=1 http://gerrit.onap.org/r/integration.git integration
42 cd $WORKSPACE/archives/integration
44 HOST_IP_ADDR=localhost
45 # Clone SDNC repo to get docker-compose for SDNC
46 mkdir -p $WORKSPACE/archives/sdnc
47 cd $WORKSPACE/archives
48 git clone -b ${SDNC_GERRIT_BRANCH} --single-branch --depth=1 http://gerrit.onap.org/r/sdnc/oam.git sdnc
49 cd $WORKSPACE/archives/sdnc
51 unset http_proxy https_proxy
52 cd $WORKSPACE/archives/sdnc/installation/src/main/yaml
54 sed -i "s/DMAAP_TOPIC_ENV=.*/DMAAP_TOPIC_ENV=\"AUTO\"/g" docker-compose.yml
55 docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO
57 docker pull $NEXUS_DOCKER_REPO/onap/sdnc-image:$DOCKER_SDNC_TAG
58 docker tag $NEXUS_DOCKER_REPO/onap/sdnc-image:$DOCKER_SDNC_TAG onap/sdnc-image:latest
60 docker pull $NEXUS_DOCKER_REPO/onap/sdnc-ansible-server-image:$DOCKER_IMAGE_VERSION
61 docker tag $NEXUS_DOCKER_REPO/onap/sdnc-ansible-server-image:$DOCKER_IMAGE_VERSION onap/sdnc-ansible-server-image:latest
63 docker pull $NEXUS_DOCKER_REPO/onap/ccsdk-dgbuilder-image:$CCSDK_DOCKER_IMAGE_VERSION
64 docker tag $NEXUS_DOCKER_REPO/onap/ccsdk-dgbuilder-image:$CCSDK_DOCKER_IMAGE_VERSION onap/ccsdk-dgbuilder-image:latest
66 docker pull $NEXUS_DOCKER_REPO/onap/admportal-sdnc-image:$DOCKER_IMAGE_VERSION
67 docker tag $NEXUS_DOCKER_REPO/onap/admportal-sdnc-image:$DOCKER_IMAGE_VERSION onap/admportal-sdnc-image:latest
69 docker pull $NEXUS_DOCKER_REPO/onap/sdnc-ueb-listener-image:$DOCKER_IMAGE_VERSION
70 docker tag $NEXUS_DOCKER_REPO/onap/sdnc-ueb-listener-image:$DOCKER_IMAGE_VERSION onap/sdnc-ueb-listener-image:latest
72 docker pull $NEXUS_DOCKER_REPO/onap/sdnc-dmaap-listener-image:$DOCKER_IMAGE_VERSION
74 docker tag $NEXUS_DOCKER_REPO/onap/sdnc-dmaap-listener-image:$DOCKER_IMAGE_VERSION onap/sdnc-dmaap-listener-image:latest
76 CERT_SUBPATH=plans/sdnc/sdnc_netconf_tls_post_deploy/certs
78 export SDNC_CERT_PATH=${WORKSPACE}/${CERT_SUBPATH}
79 sed -i 's/sdnc_controller_container/sdnc_controller_container\n volumes: \n - $SDNC_CERT_PATH:\/opt\/opendaylight\/current\/certs/' docker-compose.yml
80 # start SDNC containers with docker compose and configuration from docker-compose.yml
83 # PNF simulator has permission problems - creates files as root, which causes build to be unstable
84 # Commenting it out for now, since netconf mount is not working anyway.
85 # cd $WORKSPACE/archives/integration/test/mocks/pnfsimulator/pnfsimulator
86 # docker-compose up -d
88 # WAIT 10 minutes maximum and test every 5 seconds if SDNC is up using HealthCheck API
92 while [ "$TIME" -lt "$TIME_OUT" ]; do
93 response=$(curl --write-out '%{http_code}' --silent --output /dev/null -H "Authorization: Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==" -X POST -H "X-FromAppId: csit-sdnc" -H "X-TransactionId: csit-sdnc" -H "Accept: application/json" -H "Content-Type: application/json" http://localhost:8282/restconf/operations/SLI-API:healthcheck ); echo $response
95 if [ "$response" == "200" ]; then
96 echo SDNC started in $TIME seconds
100 echo Sleep: $INTERVAL seconds before testing if SDNC is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds
102 TIME=$(($TIME+$INTERVAL))
105 export PNF_IP=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+')
106 sed -i "s/pnfaddr/$PNF_IP/g" $WORKSPACE/tests/sdnc/sdnc_netconf_tls_post_deploy/data/mount.xml
108 if [ "$TIME" -ge "$TIME_OUT" ]; then
109 echo TIME OUT: Docker containers not started in $TIME_OUT seconds... Could cause problems for testing activities...
117 while [ "$TIME" -lt "$TIME_OUT" ]; do
118 response=$(docker exec -ti sdnc_controller_container /opt/opendaylight/current/bin/client system:start-level)
120 if grep -q 'Level 100' <<< ${response}; then
121 echo SDNC karaf started in $TIME seconds
125 echo Sleep: $INTERVAL seconds before testing if SDNC is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds
127 TIME=$(($TIME+$INTERVAL))
130 if [ "$TIME" -ge "$TIME_OUT" ]; then
131 echo TIME OUT: karaf session not started in $TIME_OUT seconds... Could cause problems for testing activities...
134 response=$(docker exec -ti sdnc_controller_container /opt/opendaylight/current/bin/client system:start-level)
136 if grep -q 'Level 100' <<< ${response}; then
137 num_failed_bundles=$(docker exec -ti sdnc_controller_container /opt/opendaylight/current/bin/client bundle:list | grep Failure | wc -l)
138 failed_bundles=$(docker exec -ti sdnc_controller_container /opt/opendaylight/current/bin/client bundle:list | grep Failure)
139 echo There is/are $num_failed_bundles failed bundles out of $num_bundles installed bundles.
142 if [ "$num_failed_bundles" -ge 1 ]; then
143 echo "The following bundle(s) are in a failed state: "
144 echo " $failed_bundles"
147 # Sleep additional 5 minutes (300 secs) to give application time to finish
150 # Pass any variables required by Robot test suites in ROBOT_VARIABLES
151 ROBOT_VARIABLES="-v SCRIPTS:${SCRIPTS}"