3 # Copyright 2016-2017 Huawei Technologies Co., Ltd.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # Modifications copyright (c) 2017 AT&T Intellectual Property
18 # Modifications copyright (c) 2020-2021 Samsung Electronics Co., Ltd.
19 # Modifications Copyright (C) 2021 Pantheon.tech
20 # Modifications Copyright (C) 2021 Bell Canada.
21 # Modifications Copyright (C) 2021 Nordix Foundation.
23 # Branched from ccsdk/distribution to this repository Feb 23, 2021
32 while [ "$TICKER" -le "$TIME_OUT" ]; do
34 RESPONSE=$(curl --location --request GET 'http://'$1'/manage/health/readiness')
36 if [[ "$RESPONSE" == *"UP"* ]]; then
37 echo "$2 started in $TICKER"
42 TICKER=$((TICKER + INTERVAL))
46 if [ "$TICKER" -ge "$TIME_OUT" ]; then
47 echo TIME OUT: $2 session not started in $TIME_OUT seconds... Could cause problems for testing activities...
51 ###################### setup env ############################
52 # Set env variables for docker compose
53 export LOCAL_IP=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+')
55 source $WORKSPACE/plans/cps/test.properties
56 export $(cut -d= -f1 $WORKSPACE/plans/cps/test.properties)
58 ###################### setup cps-ncmp ############################
59 mkdir -p $WORKSPACE/archives/dc-cps
60 cp $WORKSPACE/../docker-compose/*.yml $WORKSPACE/archives/dc-cps
61 cd $WORKSPACE/archives/dc-cps
63 # download docker-compose of a required version (1.25.0 supports configuration of version 3.7)
64 curl -L https://github.com/docker/compose/releases/download/1.25.0/docker-compose-`uname -s`-`uname -m` > docker-compose
65 chmod +x docker-compose
67 # start CPS and PostgreSQL containers with docker compose
68 ./docker-compose up -d
70 ###################### setup onap-dmi-plugin ############################
72 cd $WORKSPACE/archives
73 git clone "https://gerrit.onap.org/r/cps/ncmp-dmi-plugin"
74 mkdir -p $WORKSPACE/archives/dc-dmi
75 cat $WORKSPACE/archives/ncmp-dmi-plugin/docker-compose/docker-compose.yml
76 cp $WORKSPACE/archives/ncmp-dmi-plugin/docker-compose/*.yml $WORKSPACE/archives/dc-dmi
77 cd $WORKSPACE/archives/dc-dmi
78 # copy docker-compose (downloaded already for cps)
79 cp $WORKSPACE/archives/dc-cps/docker-compose .
80 chmod +x docker-compose
81 ./docker-compose up -d
83 ###################### setup sdnc #######################################
84 source $WORKSPACE/plans/cps/sdnc/sdnc_setup.sh
86 ###################### setup pnfsim #####################################
87 docker-compose -f $WORKSPACE/plans/cps/pnfsim/docker-compose.yml up -d
89 # Allow time for netconf-pnp-simulator & SDNC to come up fully
92 ###################### mount pnf-sim as PNFDemo ##########################
97 while [ "$SDNC_TIME" -le "$SDNC_TIME_OUT" ]; do
100 curl --location --request PUT 'http://'$SDNC_HOST:$SDNC_PORT'/restconf/config/network-topology:network-topology/topology/topology-netconf/node/PNFDemo' \
101 --header 'Authorization: Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==' \
102 --header 'Content-Type: application/json' \
106 "node-id": "PNFDemo",
107 "netconf-node-topology:protocol": {
110 "netconf-node-topology:host": "'$LOCAL_IP'",
111 "netconf-node-topology:key-based": {
112 "username": "netconf",
113 "key-id": "ODL_private_key_0"
115 "netconf-node-topology:port": 6512,
116 "netconf-node-topology:tcp-only": false,
117 "netconf-node-topology:max-connection-attempts": 5
122 # Verify node has been mounted
124 RESPONSE=$( curl --location --request GET 'http://'$SDNC_HOST:$SDNC_PORT'/restconf/config/network-topology:network-topology/topology/topology-netconf' --header 'Authorization: basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==')
126 if [[ "$RESPONSE" == *"PNFDemo"* ]]; then
127 echo "Node mounted in $SDNC_TIME"
132 SDNC_TIME=$((SDNC_TIME + SDNC_INTERVAL))
136 ###################### verify ncmp-cps health ##########################
138 check_health $CPS_CORE_HOST:$CPS_CORE_MANAGEMENT_PORT 'cps-ncmp'
140 ###################### verify dmi health ##########################
142 check_health $DMI_HOST:$DMI_MANAGEMENT_PORT 'dmi-plugin'
144 ###################### ROBOT Configurations ##########################
145 # Pass variables required for Robot test suites in ROBOT_VARIABLES
146 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"