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)
23 SCRIPTS="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
24 source "${WORKSPACE}"/plans/usecases-config-over-netconf/config-over-netconf/test.properties
26 export MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1)
28 if [ "$MTU" == "" ]; then
32 export CONFIG_OVER_NETCONF=${CONFIG_OVER_NETCONF}
35 echo "Uninstall docker-py and reinstall docker."
36 pip uninstall -y docker-py
37 pip uninstall -y docker
38 pip install -U docker==2.7.0
40 # Disable Proxy - for local run
41 unset http_proxy https_proxy
43 # Export default Networking bridge created on the host machine
44 export LOCAL_IP=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+')
46 ###################### Netconf-PNP-Simulator Setup ######################
48 # Export Netconf-Pnp Simulator conf path
49 export NETCONF_CONFIG_PATH
51 # Start N etconf-Pnp-Simulator Container with docker-compose and configuration from docker-compose.yml
52 docker-compose -f "${CONFIG_OVER_NETCONF}"/netconf-pnp-simulator/docker-compose.yml up -d
54 # Update default Networking bridge IP in mount.json file
55 sed -i "s/pnfaddr/${LOCAL_IP}/g" "${REQUEST_DATA_PATH}"/mount.xml
57 ############################## SDNC Setup ##############################
59 export SDNC_CERT_PATH="${CERT_SUBPATH}"
61 docker pull "${NEXUS_DOCKER_REPO}"/onap/sdnc-image:"${SDNC_IMAGE_TAG}"
62 docker tag "${NEXUS_DOCKER_REPO}"/onap/sdnc-image:"${SDNC_IMAGE_TAG}" onap/sdnc-image:latest
64 docker pull "${NEXUS_DOCKER_REPO}"/onap/sdnc-ansible-server-image:"${ANSIBLE_IMAGE_TAG}"
65 docker tag "${NEXUS_DOCKER_REPO}"/onap/sdnc-ansible-server-image:"${ANSIBLE_IMAGE_TAG}" onap/sdnc-ansible-server-image:latest
67 docker-compose -f "${CONFIG_OVER_NETCONF}"/sdn/docker-compose.yaml up -d
69 # Check if SDNC Service is healthy and ready
71 SDNC_IP=$(get-instance-ip.sh sdnc_controller_container)
72 RESP_CODE=$(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)
73 if [[ "${RESP_CODE}" == '200' ]]; then
74 echo "SDNC Service is Ready."
77 echo "Waiting for SDNC Service to Start Up..."
81 if [[ "${SDNC_IP}" == 'none' || "${SDNC_IP}" == '' || "${RESP_CODE}" != '200' ]]; then
82 echo "SDNC Service not started Could cause problems for testing activities...!"
85 ############################## CDS Setup ##############################
87 docker pull "${NEXUS_DOCKER_REPO}"/onap/ccsdk-blueprintsprocessor:"${BP_IMAGE_TAG}"
88 docker tag "${NEXUS_DOCKER_REPO}"/onap/ccsdk-blueprintsprocessor:"${BP_IMAGE_TAG}" onap/ccsdk-blueprintsprocessor:latest
90 docker-compose -f "${CONFIG_OVER_NETCONF}"/cds/docker-compose.yaml up -d
92 echo "Sleeping 1 minute"
95 BP_CONTAINER=$(docker ps -a -q --filter="name=bp-rest")
96 CCSDK_MARIADB=$(docker ps -a -q --filter="name=ccsdk-mariadb")
99 if [ $(docker inspect --format='{{ .State.Running }}' "${BP_CONTAINER}") ] &&
100 [ $(docker inspect --format='{{ .State.Running }}' "${CCSDK_MARIADB}") ]; then
101 echo "Blueprint Proc Service Running"
109 ############################ Update Setup ############################
111 RES_KEY=$(uuidgen -r)
112 sed -i "s/pnfaddr/$LOCAL_IP/g" "${REQUEST_DATA_PATH}"/config-deploy.json
113 sed -i "s/pnfaddr/$LOCAL_IP/g" "${REQUEST_DATA_PATH}"/config-assign.json
115 sed -i "s/reskey/$RES_KEY/g" "${REQUEST_DATA_PATH}"/config-deploy.json
116 sed -i "s/reskey/$RES_KEY/g" "${REQUEST_DATA_PATH}"/config-assign.json
118 # Pass any variables required by Robot test suites in ROBOT_VARIABLES
120 ROBOT_VARIABLES+=" -v REPO_IP:${REPO_IP} "
121 ROBOT_VARIABLES+=" -v SCRIPTS:${SCRIPTS} "