Fixing CSIT tests for vnfsdk-refrepo and vnfsdk-marketplace.
[integration/csit.git] / plans / vnfsdk-refrepo / testsuites / setup.sh
1 #!/bin/bash
2 #
3 # Copyright 2016-2017 Huawei Technologies Co., Ltd.
4 # Copyright 2020 Nokia.
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
9 #
10 #     http://www.apache.org/licenses/LICENSE-2.0
11 #
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.
17 #
18 # These scripts are sourced by run-csit.sh.
19
20 VNFSDK_REFREPO_DOCKER_VERSION=1.6.0-STAGING-latest
21
22 #Start market place
23 docker run -d -i -t --name refrepo -p 8702:8702 nexus3.onap.org:10001/onap/vnfsdk/refrepo:$VNFSDK_REFREPO_DOCKER_VERSION
24 DOCKER_IP=`get-docker-network-ip.sh`
25
26 # Wait for Market place initialization
27 echo Wait for VNF Repository initialization
28 # Active waiting with healthcheck and max retry count
29 MAX_RETRY=30
30 TRY=1
31 while (( $(curl -s -o /dev/null -w ''%{http_code}'' ${DOCKER_IP}:8702/onapapi/vnfsdk-marketplace/v1/PackageResource/healthcheck) != 200 )) && (($TRY < $MAX_RETRY)); do
32   sleep 4
33   TRY=$[$TRY+1]
34 done
35
36 REFREPO_IP=`get-instance-ip.sh refrepo`
37
38 # Get refrepo logs for easier debug in case of failure
39 docker logs refrepo
40
41 # Pass any variables required by Robot test suites in ROBOT_VARIABLES
42 ROBOT_VARIABLES="-v SCRIPTS:${SCRIPTS} -v REFREPO_IP:${REFREPO_IP}"
43 echo ${ROBOT_VARIABLES}