3 # Copyright (C) 2022 Nordix Foundation.
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.
16 # ============LICENSE_END=========================================================
18 # Branched from ccsdk/distribution to this repository Feb 23, 2021
27 while [ "$TICKER" -le "$TIME_OUT" ]; do
29 RESPONSE=$(curl --location --request GET 'http://'$1'/manage/health/readiness')
31 if [[ "$RESPONSE" == *"UP"* ]]; then
32 echo "$2 started in $TICKER"
37 TICKER=$((TICKER + INTERVAL))
41 if [ "$TICKER" -ge "$TIME_OUT" ]; then
42 echo TIME OUT: $2 session not started in $TIME_OUT seconds... Could cause problems for testing activities...
46 ###################### setup env ############################
47 # Set env variables for docker compose
48 export LOCAL_IP=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+')
50 source $WORKSPACE/plans/dmi/test.properties
51 export $(cut -d= -f1 $WORKSPACE/plans/dmi/test.properties)
53 ###################### setup ncmp-dmi-plugin ############################
54 mkdir -p $WORKSPACE/archives/ncmp-dmi-plugin
55 cp $WORKSPACE/../docker-compose/*.yml $WORKSPACE/archives/ncmp-dmi-plugin
56 cd $WORKSPACE/archives/ncmp-dmi-plugin
58 # Check Docker Compose version on system
59 docker-compose version
61 # start CPS and PostgreSQL containers with docker compose
64 ####################### setup cps-ncmp ############################
66 cd $WORKSPACE/archives
67 git clone "https://gerrit.onap.org/r/cps"
68 mkdir -p $WORKSPACE/archives/dc-cps-ncmp
69 cat $WORKSPACE/archives/cps/docker-compose/docker-compose.yml
70 cp $WORKSPACE/archives/cps/docker-compose/*.yml $WORKSPACE/archives/dc-cps-ncmp
71 cd $WORKSPACE/archives/dc-cps-ncmp
74 ###################### setup sdnc #######################################
75 source $WORKSPACE/plans/dmi/sdnc/sdnc_setup.sh
77 ###################### setup pnfsim #####################################
78 docker-compose -f $WORKSPACE/plans/dmi/pnfsim/docker-compose.yml up -d
80 # Allow time for netconf-pnp-simulator & SDNC to come up fully
83 ###################### mount pnf-sim as PNFDemo ##########################
88 while [ "$SDNC_TIME" -le "$SDNC_TIME_OUT" ]; do
91 curl --location --request PUT 'http://'$SDNC_HOST:$SDNC_PORT'/restconf/config/network-topology:network-topology/topology/topology-netconf/node/PNFDemo' \
92 --header 'Authorization: Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==' \
93 --header 'Content-Type: application/json' \
98 "netconf-node-topology:protocol": {
101 "netconf-node-topology:host": "'$LOCAL_IP'",
102 "netconf-node-topology:key-based": {
103 "username": "netconf",
104 "key-id": "ODL_private_key_0"
106 "netconf-node-topology:port": 6512,
107 "netconf-node-topology:tcp-only": false,
108 "netconf-node-topology:max-connection-attempts": 5
113 # Verify node has been mounted
115 RESPONSE=$( curl --location --request GET 'http://'$SDNC_HOST:$SDNC_PORT'/restconf/config/network-topology:network-topology/topology/topology-netconf' --header 'Authorization: basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==')
117 if [[ "$RESPONSE" == *"PNFDemo"* ]]; then
118 echo "Node mounted in $SDNC_TIME"
123 SDNC_TIME=$((SDNC_TIME + SDNC_INTERVAL))
127 ####################### verify ncmp-cps health ##########################
129 check_health $CPS_CORE_HOST:$CPS_CORE_MANAGEMENT_PORT 'cps-ncmp'
131 ###################### verify dmi health ##########################
133 check_health $DMI_HOST:$DMI_MANAGEMENT_PORT 'dmi-plugin'
135 ###################### ROBOT Configurations ##########################
136 # Pass variables required for Robot test suites in ROBOT_VARIABLES
137 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_MANAGEMENT_PORT:$DMI_MANAGEMENT_PORT -v CPS_CORE_MANAGEMENT_PORT:$CPS_CORE_MANAGEMENT_PORT -v SDNC_HOST:$SDNC_HOST -v SDNC_PORT:$SDNC_PORT -v DATADIR:$WORKSPACE/data --exitonfailure"