blob: fcedbecf03305a70055ead0188ef87616c7f4344 [file] [log] [blame]
tragait3ae5ef42019-09-06 11:31:59 +01001#!/bin/bash
2#
3# ============LICENSE_START=======================================================
4# Copyright (C) 2019 Nordix Foundation.
5# ================================================================================
6# Licensed under the Apache License, Version 2.0 (the "License");
7# you may not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS,
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17#
18# SPDX-License-Identifier: Apache-2.0
19# ============LICENSE_END=========================================================
20
21# @author Rahul Tyagi (rahul.tyagi@est.tech)
22
23
24SCRIPTS="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
efiacor125390b2020-05-06 01:14:00 +010025export PARENT=usecases-config-over-netconf
tragait3ae5ef42019-09-06 11:31:59 +010026export SUB_PARENT=config-over-netconf
27source ${WORKSPACE}/plans/$PARENT/$SUB_PARENT/test.properties
28
29export MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1)
30
31if [ "$MTU" == "" ]; then
32 export MTU="1450"
33fi
34
35# clone integration branch for pnf-simulator
36mkdir -m 755 -p $WORKSPACE/temp/integration
37cd $WORKSPACE/temp
38git clone -b dublin --single-branch --depth=1 http://gerrit.onap.org/r/integration.git integration
39
40HOST_IP_ADDR=localhost
41
42# setup sdnc
43
44cd $SDNC_DOCKER_PATH
45unset http_proxy https_proxy
46
tragaitcd8b66c2020-02-05 17:02:20 +000047docker pull $NETOPEER_DOCKER_REPO:$NETOPEER_IMAGE_TAG
48docker tag $NETOPEER_DOCKER_REPO:$NETOPEER_IMAGE_TAG $NETOPEER_DOCKER_REPO:latest
tragait3ae5ef42019-09-06 11:31:59 +010049#sed -i "s/DMAAP_TOPIC_ENV=.*/DMAAP_TOPIC_ENV="AUTO"/g" diocker-compose.yml
50docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO
51
52docker pull $NEXUS_DOCKER_REPO/onap/sdnc-image:$SDNC_IMAGE_TAG
53docker tag $NEXUS_DOCKER_REPO/onap/sdnc-image:$SDNC_IMAGE_TAG onap/sdnc-image:latest
54
55docker pull $NEXUS_DOCKER_REPO/onap/sdnc-ansible-server-image:$ANSIBLE_IMAGE_TAG
56docker tag $NEXUS_DOCKER_REPO/onap/sdnc-ansible-server-image:$ANSIBLE_IMAGE_TAG onap/sdnc-ansible-server-image:latest
57
58docker pull $NEXUS_DOCKER_REPO/onap/ccsdk-blueprintsprocessor:$BP_IMAGE_TAG
59docker tag $NEXUS_DOCKER_REPO/onap/ccsdk-blueprintsprocessor:$BP_IMAGE_TAG onap/ccsdk-blueprintsprocessor:latest
60
61export SDNC_CERT_PATH=${CERT_SUBPATH}
62#sed -i 's/sdnc_controller_container/sdnc_controller_container\n volumes: \n - $SDNC_CERT_PATH:\/opt\/opendaylight\/current\/certs/' docker-compose.yaml
63# start SDNC containers with docker compose and configuration from docker-compose.yml
64docker-compose up -d
65
66# start pnf simulator
67
68cd $INT_DOCKER_PATH
69
70./simulator.sh start&
71
72# WAIT 10 minutes maximum and test every 5 seconds if SDNC is up using HealthCheck API
73TIME_OUT=1000
74INTERVAL=30
75TIME=0
76while [ "$TIME" -lt "$TIME_OUT" ]; do
tragaitcd8b66c2020-02-05 17:02:20 +000077 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 );
78 echo $response
tragait3ae5ef42019-09-06 11:31:59 +010079
80 if [ "$response" == "200" ]; then
81 echo SDNC started in $TIME seconds
82 break;
83 fi
84
85 echo Sleep: $INTERVAL seconds before testing if SDNC is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds
86 sleep $INTERVAL
87 TIME=$(($TIME+$INTERVAL))
88done
89
90export LOCAL_IP=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+')
91sed -i "s/pnfaddr/$LOCAL_IP/g" $REQUEST_DATA_PATH/mount.xml
92
93
94if [ "$TIME" -ge "$TIME_OUT" ]; then
95 echo TIME OUT: karaf session not started in $TIME_OUT seconds... Could cause problems for testing activities...
96fi
97
98########################################## blueprintsprocessor setup ##########################################################
99source $CDS_DOCKER_PATH/cds_setup.sh
100
101########## update pnf simulator ip in config deploy request ########
102
103NETOPEER_CONTAINER=$(docker ps -a -q --filter="name=netopeer")
104NETOPEER_CONTAINER_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $SDNC_CONTAINER)
105RES_KEY=$(uuidgen -r)
106sed -i "s/pnfaddr/$LOCAL_IP/g" $REQUEST_DATA_PATH/config-deploy.json
107sed -i "s/pnfaddr/$LOCAL_IP/g" $REQUEST_DATA_PATH/config-assign.json
108
109sed -i "s/reskey/$RES_KEY/g" $REQUEST_DATA_PATH/config-deploy.json
110sed -i "s/reskey/$RES_KEY/g" $REQUEST_DATA_PATH/config-assign.json
111
112#########################check if server is up gracefully ######################################
113
tragait3ae5ef42019-09-06 11:31:59 +0100114# Sleep additional 3 minutes (180 secs) to give application time to finish
115
116sleep 150
117
118# Pass any variables required by Robot test suites in ROBOT_VARIABLES
119
120ROBOT_VARIABLES="-v SCRIPTS:${SCRIPTS}"