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 cd $CPS_HOME/docker-compose
62 curl -L https://github.com/docker/compose/releases/download/1.29.2/docker-compose-`uname -s`-`uname -m` > docker-compose
63 chmod +x docker-compose
64 docker-compose version
66 # start CPS/NCMP, DMI Plugin, and PostgreSQL containers with docker compose
67 docker-compose --profile dmi-service up -d
69 ###################### setup sdnc #######################################
70 source $WORKSPACE/plans/cps/sdnc/sdnc_setup.sh
72 ###################### setup pnfsim #####################################
73 docker-compose -f $WORKSPACE/plans/cps/pnfsim/docker-compose.yml up -d
75 # Allow time for netconf-pnp-simulator & SDNC to come up fully
78 ###################### mount pnf-sim as PNFDemo ##########################
83 while [ "$SDNC_TIME" -le "$SDNC_TIME_OUT" ]; do
86 curl --location --request PUT 'http://'$SDNC_HOST:$SDNC_PORT'/restconf/config/network-topology:network-topology/topology/topology-netconf/node/PNFDemo' \
87 --header 'Authorization: Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==' \
88 --header 'Content-Type: application/json' \
93 "netconf-node-topology:protocol": {
96 "netconf-node-topology:host": "'$LOCAL_IP'",
97 "netconf-node-topology:key-based": {
98 "username": "netconf",
99 "key-id": "ODL_private_key_0"
101 "netconf-node-topology:port": 6512,
102 "netconf-node-topology:tcp-only": false,
103 "netconf-node-topology:max-connection-attempts": 5
108 # Verify node has been mounted
110 RESPONSE=$( curl --location --request GET 'http://'$SDNC_HOST:$SDNC_PORT'/restconf/config/network-topology:network-topology/topology/topology-netconf' --header 'Authorization: basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==')
112 if [[ "$RESPONSE" == *"PNFDemo"* ]]; then
113 echo "Node mounted in $SDNC_TIME"
118 SDNC_TIME=$((SDNC_TIME + SDNC_INTERVAL))
122 ###################### verify ncmp-cps health ##########################
124 check_health $CPS_CORE_HOST:$CPS_CORE_MANAGEMENT_PORT 'cps-ncmp'
126 ###################### verify dmi health ##########################
128 check_health $DMI_HOST:$DMI_MANAGEMENT_PORT 'dmi-plugin'
130 ###################### ROBOT Configurations ##########################
131 # Pass variables required for Robot test suites in ROBOT_VARIABLES
132 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 DMI_CSIT_STUB_HOST:$LOCAL_IP -v DMI_CSIT_STUB_PORT:$DMI_DEMO_STUB_PORT -v CPS_CORE_MANAGEMENT_PORT:$CPS_CORE_MANAGEMENT_PORT -v DATADIR:$WORKSPACE/data --exitonfailure"