3 # Copyright 2016-2017 Huawei Technologies Co., Ltd.
4 # Modifications Copyright (C) 2022 Nordix Foundation.
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 # Modifications copyright (c) 2017 AT&T Intellectual Property
19 # Modifications copyright (c) 2020-2021 Samsung Electronics Co., Ltd.
20 # Modifications Copyright (C) 2021 Pantheon.tech
21 # Modifications Copyright (C) 2021 Bell Canada.
22 # Modifications Copyright (C) 2021 Nordix Foundation.
24 # Branched from ccsdk/distribution to this repository Feb 23, 2021
33 while [ "$TICKER" -le "$TIME_OUT" ]; do
35 RESPONSE=$(curl --location --request GET 'http://'$1'/manage/health/readiness')
37 if [[ "$RESPONSE" == *"UP"* ]]; then
38 echo "$2 started in $TICKER"
43 TICKER=$((TICKER + INTERVAL))
47 if [ "$TICKER" -ge "$TIME_OUT" ]; then
48 echo TIME OUT: $2 session not started in $TIME_OUT seconds... Could cause problems for testing activities...
52 ###################### setup env ############################
53 # Set env variables for docker compose
54 export LOCAL_IP=$((ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+') || hostname -I | awk '{print $1}')
56 source $WORKSPACE/plans/cps/test.properties
57 export $(cut -d= -f1 $WORKSPACE/plans/cps/test.properties)
59 ###################### setup cps-ncmp ############################
60 mkdir -p $WORKSPACE/archives/dc-cps
61 cp $WORKSPACE/../docker-compose/*.yml $WORKSPACE/archives/dc-cps
62 cd $WORKSPACE/archives/dc-cps
64 curl -L https://github.com/docker/compose/releases/download/1.29.2/docker-compose-`uname -s`-`uname -m` > docker-compose
65 chmod +x docker-compose
66 docker-compose version
68 # start CPS/NCMP, DMI, and PostgreSQL containers with docker compose
71 ###################### setup sdnc #######################################
72 source $WORKSPACE/plans/cps/sdnc/sdnc_setup.sh
74 ###################### setup pnfsim #####################################
75 docker-compose -f $WORKSPACE/plans/cps/pnfsim/docker-compose.yml up -d
77 # Allow time for netconf-pnp-simulator & SDNC to come up fully
80 ###################### mount pnf-sim as PNFDemo ##########################
85 while [ "$SDNC_TIME" -le "$SDNC_TIME_OUT" ]; do
88 curl --location --request PUT 'http://'$SDNC_HOST:$SDNC_PORT'/restconf/config/network-topology:network-topology/topology/topology-netconf/node/PNFDemo' \
89 --header 'Authorization: Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==' \
90 --header 'Content-Type: application/json' \
95 "netconf-node-topology:protocol": {
98 "netconf-node-topology:host": "'$LOCAL_IP'",
99 "netconf-node-topology:key-based": {
100 "username": "netconf",
101 "key-id": "ODL_private_key_0"
103 "netconf-node-topology:port": 6512,
104 "netconf-node-topology:tcp-only": false,
105 "netconf-node-topology:max-connection-attempts": 5
110 # Verify node has been mounted
112 RESPONSE=$( curl --location --request GET 'http://'$SDNC_HOST:$SDNC_PORT'/restconf/config/network-topology:network-topology/topology/topology-netconf' --header 'Authorization: basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==')
114 if [[ "$RESPONSE" == *"PNFDemo"* ]]; then
115 echo "Node mounted in $SDNC_TIME"
120 SDNC_TIME=$((SDNC_TIME + SDNC_INTERVAL))
124 ###################### verify ncmp-cps health ##########################
126 check_health $CPS_CORE_HOST:$CPS_CORE_MANAGEMENT_PORT 'cps-ncmp'
128 ###################### verify dmi health ##########################
130 check_health $DMI_HOST:$DMI_MANAGEMENT_PORT 'dmi-plugin'
132 ###################### ROBOT Configurations ##########################
133 # Pass variables required for Robot test suites in ROBOT_VARIABLES
134 ROBOT_VARIABLES="-v CPS_CORE_HOST:$CPS_CORE_HOST -v CPS_CORE_PORT:$CPS_CORE_PORT -v DMI_HOST:$LOCAL_IP -v DMI_PORT:$DMI_PORT -v CPS_CORE_MANAGEMENT_PORT:$CPS_CORE_MANAGEMENT_PORT -v DATADIR:$WORKSPACE/data --exitonfailure"