Almog Laktivi | f0f635f | 2017-11-16 12:58:43 +0200 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # ============LICENSE_START======================================================= |
| 4 | # ONAP CLAMP |
| 5 | # ================================================================================ |
| 6 | # Copyright (C) 2017 AT&T Intellectual Property. All rights |
| 7 | # reserved. |
| 8 | # ================================================================================ |
| 9 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 10 | # you may not use this file except in compliance with the License. |
| 11 | # You may obtain a copy of the License at |
| 12 | # |
| 13 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 14 | # |
| 15 | # Unless required by applicable law or agreed to in writing, software |
| 16 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 18 | # See the License for the specific language governing permissions and |
| 19 | # limitations under the License. |
| 20 | # ============LICENSE_END============================================ |
| 21 | # =================================================================== |
| 22 | # ECOMP is a trademark and service mark of AT&T Intellectual Property. |
| 23 | # |
| 24 | |
| 25 | echo "This is ${WORKSPACE}/test/csit/scripts/vvp/start_vvp_containers.sh" |
| 26 | |
| 27 | export IP=$HOST_IP |
| 28 | export PREFIX='nexus3.onap.org:10001/openecomp/vvp' |
| 29 | export RELEASE='latest' |
| 30 | |
| 31 | #start Engagement Manager pod: |
| 32 | docker run --detach --name vvp-engagementmgr --env HOST_IP=${IP} --env ENVNAME="${ENVIRONMENT}" --env http_proxy=${http_proxy} --env https_proxy=${https_proxy} --env no_proxy=${no_proxy} --env-file ${WORKSPACE}/data/environments/vvp_env --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --memory 4g --memory-swap=4g --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro --volume ${WORKSPACE}/data/logs/engagementmgr/:/var/lib/jetty/logs --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --volume ${WORKSPACE}/data/clone/engagementmgr/django/vvp/settings:/opt/configmaps/settings/ --publish 8443:8443 --publish 8000:8000 ${PREFIX}/engagementmgr:${RELEASE} |
| 33 | |
| 34 | |
| 35 | echo "please wait while Engagement Manager is starting..." |
| 36 | echo "" |
| 37 | c=60 # seconds to wait |
| 38 | REWRITE="\e[25D\e[1A\e[K" |
| 39 | while [ $c -gt 0 ]; do |
| 40 | c=$((c-1)) |
| 41 | sleep 1 |
| 42 | echo -e "${REWRITE}$c" |
| 43 | done |
| 44 | echo -e "" |
| 45 | |
| 46 | TIME_OUT=600 |
| 47 | INTERVAL=5 |
| 48 | TIME=0 |
| 49 | while [ "$TIME" -lt "$TIME_OUT" ]; do |
| 50 | response=$(curl --write-out '%{http_code}' --silent --output /dev/null http://localhost:8000/vvp/v1/engmgr/vendors); echo $response |
| 51 | |
| 52 | if [ "$response" == "200" ]; then |
| 53 | echo VVP-Engagement-Manager well started in $TIME seconds |
| 54 | break; |
| 55 | fi |
| 56 | |
| 57 | echo Sleep: $INTERVAL seconds before testing if VVP-Engagement-Manager is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds |
| 58 | sleep $INTERVAL |
| 59 | TIME=$(($TIME+$INTERVAL)) |
| 60 | done |
| 61 | |
| 62 | if [ "$TIME" -ge "$TIME_OUT" ]; then |
| 63 | echo TIME OUT: Docker containers not started in $TIME_OUT seconds... Could cause problems for tests... |
| 64 | |
| 65 | |