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
10 # http://www.apache.org/licenses/LICENSE-2.0
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.
18 # SPDX-License-Identifier: Apache-2.0
19 # ============LICENSE_END=========================================================
21 # @author Rahul Tyagi (rahul.tyagi@est.tech)
24 SCRIPTS="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
25 export PARENT=usecases
26 export SUB_PARENT=config-over-netconf
27 source ${WORKSPACE}/plans/$PARENT/$SUB_PARENT/test.properties
29 export MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1)
31 if [ "$MTU" == "" ]; then
35 # clone integration branch for pnf-simulator
36 mkdir -m 755 -p $WORKSPACE/temp/integration
38 git clone -b dublin --single-branch --depth=1 http://gerrit.onap.org/r/integration.git integration
40 HOST_IP_ADDR=localhost
45 unset http_proxy https_proxy
47 #sed -i "s/DMAAP_TOPIC_ENV=.*/DMAAP_TOPIC_ENV="AUTO"/g" diocker-compose.yml
48 docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO
50 docker pull $NEXUS_DOCKER_REPO/onap/sdnc-image:$SDNC_IMAGE_TAG
51 docker tag $NEXUS_DOCKER_REPO/onap/sdnc-image:$SDNC_IMAGE_TAG onap/sdnc-image:latest
53 docker pull $NEXUS_DOCKER_REPO/onap/sdnc-ansible-server-image:$ANSIBLE_IMAGE_TAG
54 docker tag $NEXUS_DOCKER_REPO/onap/sdnc-ansible-server-image:$ANSIBLE_IMAGE_TAG onap/sdnc-ansible-server-image:latest
56 docker pull $NEXUS_DOCKER_REPO/onap/ccsdk-blueprintsprocessor:$BP_IMAGE_TAG
57 docker tag $NEXUS_DOCKER_REPO/onap/ccsdk-blueprintsprocessor:$BP_IMAGE_TAG onap/ccsdk-blueprintsprocessor:latest
59 export SDNC_CERT_PATH=${CERT_SUBPATH}
60 #sed -i 's/sdnc_controller_container/sdnc_controller_container\n volumes: \n - $SDNC_CERT_PATH:\/opt\/opendaylight\/current\/certs/' docker-compose.yaml
61 # start SDNC containers with docker compose and configuration from docker-compose.yml
70 # WAIT 10 minutes maximum and test every 5 seconds if SDNC is up using HealthCheck API
74 while [ "$TIME" -lt "$TIME_OUT" ]; do
75 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
77 if [ "$response" == "200" ]; then
78 echo SDNC started in $TIME seconds
82 echo Sleep: $INTERVAL seconds before testing if SDNC is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds
84 TIME=$(($TIME+$INTERVAL))
87 export LOCAL_IP=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+')
88 sed -i "s/pnfaddr/$LOCAL_IP/g" $REQUEST_DATA_PATH/mount.xml
91 if [ "$TIME" -ge "$TIME_OUT" ]; then
92 echo TIME OUT: karaf session not started in $TIME_OUT seconds... Could cause problems for testing activities...
95 ########################################## blueprintsprocessor setup ##########################################################
96 source $CDS_DOCKER_PATH/cds_setup.sh
98 ########## update pnf simulator ip in config deploy request ########
100 NETOPEER_CONTAINER=$(docker ps -a -q --filter="name=netopeer")
101 NETOPEER_CONTAINER_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $SDNC_CONTAINER)
102 RES_KEY=$(uuidgen -r)
103 sed -i "s/pnfaddr/$LOCAL_IP/g" $REQUEST_DATA_PATH/config-deploy.json
104 sed -i "s/pnfaddr/$LOCAL_IP/g" $REQUEST_DATA_PATH/config-assign.json
106 sed -i "s/reskey/$RES_KEY/g" $REQUEST_DATA_PATH/config-deploy.json
107 sed -i "s/reskey/$RES_KEY/g" $REQUEST_DATA_PATH/config-assign.json
109 #########################check if server is up gracefully ######################################
114 while [ "$TIME" -lt "$TIME_OUT" ]; do
115 docker exec sdnc_controller_container rm -f /opt/opendaylight/current/etc/host.key
116 response=$(docker exec sdnc_controller_container /opt/opendaylight/current/bin/client system:start-level)
117 docker exec sdnc_controller_container rm -f /opt/opendaylight/current/etc/host.key
119 if [ "$response" == "Level 100" ] ; then
120 echo SDNC karaf started in $TIME seconds
124 echo Sleep: $INTERVAL seconds before testing if SDNC is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds
126 TIME=$(($TIME+$INTERVAL))
129 if [ "$TIME" -ge "$TIME_OUT" ]; then
130 echo TIME OUT: karaf session not started in $TIME_OUT seconds... Could cause problems for testing activities...
133 response=$(docker exec sdnc_controller_container /opt/opendaylight/current/bin/client system:start-level)
135 if [ "$response" == "Level 100" ] ; then
136 num_failed_bundles=$(docker exec sdnc_controller_container /opt/opendaylight/current/bin/client bundle:list | grep Failure | wc -l)
137 failed_bundles=$(docker exec sdnc_controller_container /opt/opendaylight/current/bin/client bundle:list | grep Failure)
138 echo There is/are $num_failed_bundles failed bundles out of $num_bundles installed bundles.
141 if [ "$num_failed_bundles" -ge 1 ]; then
142 echo "The following bundle(s) are in a failed state: "
143 echo " $failed_bundles"
147 # Sleep additional 3 minutes (180 secs) to give application time to finish
151 # Pass any variables required by Robot test suites in ROBOT_VARIABLES
153 ROBOT_VARIABLES="-v SCRIPTS:${SCRIPTS}"