blob: 43afc4e85aee8a279e4f51a109af66f010e9f994 [file] [log] [blame]
Michael Lando451a3402017-02-19 10:28:42 +02001#!/bin/bash
2
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +03003#
4# Constants:
5#
6
7WORKSPACE="${WORKSPACE:-}"
8SUCCESS=0
9FAILURE=1
10
Yuli Shlosberg0875ce02018-01-25 13:53:36 +020011CS_PASSWORD="onap123#@!"
12SDC_USER="asdc_user"
13SDC_PASSWORD="Aa1234%^!"
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +030014
Yuli Shlosberg958c32d2018-02-15 12:04:46 +020015JETTY_BASE="/var/lib/jetty"
kooperb087a8b2019-04-04 14:03:36 +000016SDC_CERT_DIR="onap/cert"
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +030017
18RELEASE=latest
kaihlavib2372712019-05-27 16:28:23 +030019DCAE_RELEASE=latest
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +030020LOCAL=false
21RUNTESTS=false
Tal Gitelmanef4b94e2018-08-02 17:11:25 +030022BE_DEBUG_PORT="--publish 4000:4000"
23FE_DEBUG_PORT="--publish 6000:6000"
Tal Gitelmanc4d387d2019-03-28 11:00:54 +020024ONBOARD_DEBUG_PORT="--publish 4001:4001"
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +030025
26
27# Java Options:
Gitelman, Tal (tg851x)328388b2018-03-22 13:03:44 +020028BE_JAVA_OPTIONS="-Xdebug -agentlib:jdwp=transport=dt_socket,address=4000,server=y,suspend=n -Xmx1536m -Xms1536m"
29FE_JAVA_OPTIONS="-Xdebug -agentlib:jdwp=transport=dt_socket,address=6000,server=y,suspend=n -Xmx256m -Xms256m"
Avi Zivc175a0d2018-03-15 13:21:44 +020030ONBOARD_BE_JAVA_OPTIONS="-Xdebug -agentlib:jdwp=transport=dt_socket,address=4001,server=y,suspend=n -Xmx1g -Xms1g"
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +030031DCAE_BE_JAVA_OPTIONS="-XX:MaxPermSize=256m -Xmx1024m -Dconfig.home=config -Dlog.home=/var/lib/jetty/logs/ -Dlogging.config=config/dcae-be/logback-spring.xml"
32DCAE_FE_JAVA_OPTIONS="-XX:MaxPermSize=256m -Xmx1024m -Dconfig.home=config -Dlog.home=/var/lib/jetty/logs/ -Dlogging.config=config/dcae-fe/logback-spring.xml"
Yuli Shlosbergaf70a202018-09-25 17:16:48 +030033SIM_JAVA_OPTIONS=" -Xmx128m -Xms128m -Xss1m -Dlog4j.configuration=file:///${JETTY_BASE}/config/sdc-simulator/log4j.properties"
Yuli Shlosbergf59a2252018-03-21 11:14:08 +020034API_TESTS_JAVA_OPTIONS="-Xmx512m -Xms512m"
35UI_TESTS_JAVA_OPTIONS="-Xmx1024m -Xms1024m"
dekstroza83520062018-05-03 16:47:08 +010036#Define this as variable, so it can be excluded in run commands on Docker for OSX, as /etc/localtime cant be mounted there.
37LOCAL_TIME_MOUNT_CMD="--volume /etc/localtime:/etc/localtime:ro"
38# If os is OSX, unset this, so /etc/localtime is not mounted, otherwise leave it be
39if [[ "$OSTYPE" == "darwin"* ]]; then
40 LOCAL_TIME_MOUNT_CMD=""
41fi
42
43
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +030044#
45# Functions:
46#
47
Michael Lando451a3402017-02-19 10:28:42 +020048
Grinberg Motic3bda482017-02-23 11:24:34 +020049function usage {
kaihlavib2372712019-05-27 16:28:23 +030050 echo "usage: docker_run.sh [ -r|--release <RELEASE-NAME> ] [ -e|--environment <ENV-NAME> ] [ -p|--port <Docker-hub-port>] [ -l|--local <Run-without-pull>] [ -sim|--simulator <Run-with-simulator>] [ -ta <run api tests with the supplied test suit>] [ -tu <run ui tests with the supplied test suit>] [ -ta <run api tests with the supplied test suit>] [ -tu <run ui tests with the supplied test suit>] [ -tad <run api tests with the default test suit>] [ -tu <run ui tests with the default test suit>] [ -dcae|--dcae <Run-with DCAE using label DCAE-RELEASE-NAME>][ -h|--help ]"
Michael Landodc856bb2018-08-13 13:27:52 +030051 echo "start dockers built locally example: docker_run.sh -l"
52 echo "start dockers built locally and simulator example: docker_run.sh -l -sim"
kaihlavib2372712019-05-27 16:28:23 +030053 echo "start dockers, pull from onap nexus according to release and simulator example: docker_run.sh -r 1.5-STAGING-latest -sim"
54 echo "start dockers with DCAE, pull from onap nexus according to respective releases: docker_run.sh -r 1.5-STAGING-latest -dcae 1.3-STAGING-latest"
Michael Landodc856bb2018-08-13 13:27:52 +030055 echo "start dockers built locally and run api tests docker example: docker_run.sh -l -tad"
56 echo "start dockers built locally and run only the catalog be example: docker_run.sh -l -d sdc-BE "
Michael Lando451a3402017-02-19 10:28:42 +020057}
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +030058#
Michael Lando451a3402017-02-19 10:28:42 +020059
60
Grinberg Motic3bda482017-02-23 11:24:34 +020061function cleanup {
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +030062 echo "Performing old dockers cleanup"
Yuli Shlosberg958c32d2018-02-15 12:04:46 +020063
64 if [ "$1" == "all" ] ; then
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +030065 docker_ids=`docker ps -a | egrep -v "onap/sdc-simulator" | egrep "ecomp-nexus:${PORT}/sdc|sdc|Exit}|dcae" | awk '{print $1}'`
Yuli Shlosberg958c32d2018-02-15 12:04:46 +020066 for X in ${docker_ids}
67 do
68 docker rm -f ${X}
69 done
70 else
71 echo "performing $1 docker cleanup"
72 tmp=`docker ps -a -q --filter="name=$1"`
Yuli Shlosberg474996a2018-02-27 18:55:25 +020073 if [[ ! -z "$tmp" ]]; then
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +030074 docker rm -f ${tmp}
75 fi
Yuli Shlosberg958c32d2018-02-15 12:04:46 +020076 fi
Grinberg Motic3bda482017-02-23 11:24:34 +020077}
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +030078#
Grinberg Motic3bda482017-02-23 11:24:34 +020079
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +030080
Grinberg Motic3bda482017-02-23 11:24:34 +020081function dir_perms {
Michael Lando4b9b9472018-06-02 19:14:05 +030082 mkdir -p ${WORKSPACE}/data/logs/BE/SDC/SDC-BE
83 mkdir -p ${WORKSPACE}/data/logs/FE/SDC/SDC-FE
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +030084
85 mkdir -p ${WORKSPACE}/data/logs/DCAE-BE/DCAE
86 mkdir -p ${WORKSPACE}/data/logs/DCAE-FE/DCAE
87
Michael Lando4b9b9472018-06-02 19:14:05 +030088 mkdir -p ${WORKSPACE}/data/logs/sdc-api-tests/ExtentReport
89 mkdir -p ${WORKSPACE}/data/logs/ONBOARD/SDC/ONBOARD-BE
Yuli Shlosbergf59a2252018-03-21 11:14:08 +020090 mkdir -p ${WORKSPACE}/data/logs/sdc-api-tests/target
91 mkdir -p ${WORKSPACE}/data/logs/sdc-ui-tests/ExtentReport
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +030092 mkdir -p ${WORKSPACE}/data/logs/sdc-ui-tests/target
93 mkdir -p ${WORKSPACE}/data/logs/docker_logs
94 mkdir -p ${WORKSPACE}/data/logs/WS
kooperb087a8b2019-04-04 14:03:36 +000095 echo "create dir"
Liang Ding19fe5d22019-04-18 18:59:53 -070096 echo "${WORKSPACE}/data/${SDC_CERT_DIR}"
kooperb087a8b2019-04-04 14:03:36 +000097 mkdir -p ${WORKSPACE}/data/${SDC_CERT_DIR}
Michael Lando4b9b9472018-06-02 19:14:05 +030098 chmod -R 777 ${WORKSPACE}/data/logs
Grinberg Motic3bda482017-02-23 11:24:34 +020099}
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300100#
101
Yuli Shlosberg36604c72018-02-25 16:03:45 +0200102
Yuli Shlosbergb4deec12018-02-25 20:24:44 +0200103function docker_logs {
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300104 docker logs $1 > ${WORKSPACE}/data/logs/docker_logs/$1_docker.log
Yuli Shlosbergb4deec12018-02-25 20:24:44 +0200105}
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300106#
Yuli Shlosbergb4deec12018-02-25 20:24:44 +0200107
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300108
109#
110# Readiness Prob
111#
112
113function ready_probe {
Michael Lando4b9b9472018-06-02 19:14:05 +0300114 docker exec $1 /var/lib/ready-probe.sh > /dev/null 2>&1
115 rc=$?
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300116 if [[ ${rc} == 0 ]]; then
117 echo DOCKER $1 start finished in $2 seconds
118 return ${SUCCESS}
Michael Lando4b9b9472018-06-02 19:14:05 +0300119 fi
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300120 return ${FAILURE}
Yuli Shlosberg0875ce02018-01-25 13:53:36 +0200121}
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300122#
Yuli Shlosberg0875ce02018-01-25 13:53:36 +0200123
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200124
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300125function probe_docker {
126 MATCH=`docker logs --tail 30 $1 | grep "DOCKER STARTED"`
127 echo MATCH is -- ${MATCH}
Avi Zivc175a0d2018-03-15 13:21:44 +0200128
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300129 if [ -n "$MATCH" ] ; then
130 echo DOCKER start finished in $2 seconds
131 return ${SUCCESS}
Michael Lando4b9b9472018-06-02 19:14:05 +0300132 fi
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300133 return ${FAILURE}
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200134}
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300135#
136
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200137
138function probe_es {
Michael Lando4b9b9472018-06-02 19:14:05 +0300139 health_Check_http_code=$(curl --noproxy "*" -o /dev/null -w '%{http_code}' http://${IP}:9200/_cluster/health?wait_for_status=yellow&timeout=120s)
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300140 if [[ "$health_Check_http_code" -eq 200 ]] ; then
141 echo DOCKER start finished in $1 seconds
142 return ${SUCCESS}
143 fi
144 return ${FAILURE}
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200145}
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300146#
147
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200148
Yuli Shlosbergf59a2252018-03-21 11:14:08 +0200149function probe_sim {
Michael Lando4b9b9472018-06-02 19:14:05 +0300150 if lsof -Pi :8285 -sTCP:LISTEN -t >/dev/null ; then
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300151 echo "Already running"
152 return ${SUCCESS}
Michael Lando4b9b9472018-06-02 19:14:05 +0300153 else
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300154 echo "Not running"
155 return ${FAILURE}
Michael Lando4b9b9472018-06-02 19:14:05 +0300156 fi
Yuli Shlosbergf59a2252018-03-21 11:14:08 +0200157}
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300158#
Yuli Shlosbergf59a2252018-03-21 11:14:08 +0200159
Yuli Shlosberg0875ce02018-01-25 13:53:36 +0200160
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300161function probe_dcae_be {
162 health_check_http_code=$(curl -i -o /dev/null -w '%{http_code}' http://${IP}:8082/dcae/conf/composition)
163 if [[ "${health_check_http_code}" -eq 200 ]] ; then
164 echo DOCKER start finished in $1 seconds
165 return ${SUCCESS}
Michael Lando4b9b9472018-06-02 19:14:05 +0300166 fi
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300167 return ${FAILURE}
Yuli Shlosberg0875ce02018-01-25 13:53:36 +0200168}
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300169#
170
171function probe_dcae_fe {
172 health_check_http_code=$(curl -i -o /dev/null -w '%{http_code}' http://${IP}:8183/dcaed/healthCheck)
173 if [[ "${health_check_http_code}" -eq 200 ]] ; then
174 echo DOCKER start finished in $1 seconds
175 return ${SUCCESS}
176 fi
177 return ${FAILURE}
178}
179#
180
181
182# Not applicable for current release. Return Success in any case
183function probe_dcae_tools {
184 health_check_http_code=$(curl -i -o /dev/null -w '%{http_code}' http://${IP}:8082/dcae/getResourcesByMonitoringTemplateCategory)
185 if [[ "${health_check_http_code}" -eq 200 ]] ; then
186 echo DOCKER start finished in $1 seconds
187 return ${SUCCESS}
188 fi
189 return ${SUCCESS}
190}
191#
192
193
Yuli Shlosberg5571a862017-10-03 18:18:51 +0300194function monitor_docker {
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300195 DOCKER_NAME=$1
196 echo "Monitor ${DOCKER_NAME} Docker"
Idan Amitdb3d5542017-12-07 11:33:32 +0200197 sleep 5
198 TIME_OUT=900
199 INTERVAL=20
200 TIME=0
Avi Zivc175a0d2018-03-15 13:21:44 +0200201
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300202 while [ "$TIME" -lt "$TIME_OUT" ]; do
203
204 case ${DOCKER_NAME} in
205
206 sdc-cs)
207 ready_probe ${DOCKER_NAME} ${TIME} ;
208 status=$? ;
209 ;;
210 sdc-es)
211 probe_es ${TIME} ;
212 status=$? ;
213 ;;
214 sdc-BE)
215 ready_probe ${DOCKER_NAME} ${TIME} ;
216 status=$? ;
217 ;;
218 sdc-FE)
219 ready_probe ${DOCKER_NAME} ${TIME} ;
220 status=$? ;
221 ;;
222 sdc-onboard-BE)
223 ready_probe ${DOCKER_NAME} ${TIME} ;
224 status=$? ;
225 ;;
226 dcae-be)
227 probe_dcae_be ${TIME} ;
228 status=$? ;
229 ;;
230 dcae-fe)
231 probe_dcae_fe ${TIME} ;
232 status=$? ;
233 ;;
234 dcae-tools)
235 probe_dcae_tools ;
236 status=$? ;
237 ;;
238 *)
239 probe_docker ${DOCKER_NAME} ${TIME};
240 status=$? ;
241 ;;
242
243 esac
244
245 if [ ${status} == ${SUCCESS} ] ; then
246 break;
Idan Amitdb3d5542017-12-07 11:33:32 +0200247 fi
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300248
249 echo "Sleep: ${INTERVAL} seconds before testing if ${DOCKER_NAME} DOCKER is up. Total wait time up now is: ${TIME} seconds. Timeout is: ${TIME_OUT} seconds"
250 sleep ${INTERVAL}
Idan Amitdb3d5542017-12-07 11:33:32 +0200251 TIME=$(($TIME+$INTERVAL))
252 done
Yuli Shlosberg5571a862017-10-03 18:18:51 +0300253
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300254 docker_logs ${DOCKER_NAME}
Yuli Shlosberg36604c72018-02-25 16:03:45 +0200255
Idan Amitdb3d5542017-12-07 11:33:32 +0200256 if [ "$TIME" -ge "$TIME_OUT" ]; then
257 echo -e "\e[1;31mTIME OUT: DOCKER was NOT fully started in $TIME_OUT seconds... Could cause problems ...\e[0m"
258 fi
Yuli Shlosberg5571a862017-10-03 18:18:51 +0300259}
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300260#
261
Yuli Shlosberg5571a862017-10-03 18:18:51 +0300262
Yuli Shlosbergd1bb2e52018-01-15 11:51:21 +0200263function healthCheck {
Yuli Shlosberg474996a2018-02-27 18:55:25 +0200264 curl --noproxy "*" ${IP}:9200/_cluster/health?pretty=true
Yuli Shlosbergd1bb2e52018-01-15 11:51:21 +0200265
266 echo "BE health-Check:"
Yuli Shlosberg474996a2018-02-27 18:55:25 +0200267 curl --noproxy "*" http://${IP}:8080/sdc2/rest/healthCheck
Yuli Shlosbergd1bb2e52018-01-15 11:51:21 +0200268
269 echo ""
270 echo ""
271 echo "FE health-Check:"
Yuli Shlosberg474996a2018-02-27 18:55:25 +0200272 curl --noproxy "*" http://${IP}:8181/sdc1/rest/healthCheck
Yuli Shlosbergd1bb2e52018-01-15 11:51:21 +0200273
274
275 echo ""
276 echo ""
Yuli Shlosberg474996a2018-02-27 18:55:25 +0200277 healthCheck_http_code=$(curl --noproxy "*" -o /dev/null -w '%{http_code}' -H "Accept: application/json" -H "Content-Type: application/json" -H "USER_ID: jh0003" http://${IP}:8080/sdc2/rest/v1/user/demo;)
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300278 if [[ ${healthCheck_http_code} != 200 ]]; then
Yuli Shlosbergd1bb2e52018-01-15 11:51:21 +0200279 echo "Error [${healthCheck_http_code}] while user existance check"
280 return ${healthCheck_http_code}
281 fi
282 echo "check user existance: OK"
283 return ${healthCheck_http_code}
284}
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300285#
Yuli Shlosbergd1bb2e52018-01-15 11:51:21 +0200286
Tal Gitelmane224d0b2017-10-17 15:24:25 +0300287
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300288function command_exit_status {
289 status=$1
290 docker=$2
291 if [ "${status}" != "0" ] ; then
292 echo "[ ERROR ] Docker ${docker} run command exit with status [${status}]"
293 fi
294}
295#
296
297
298#
299# Run Containers
300#
301
302#Elastic-Search
303function sdc-es {
304 DOCKER_NAME="sdc-es"
305 echo "docker run sdc-elasticsearch..."
306 if [ ${LOCAL} = false ]; then
307 echo "pulling code"
308 docker pull ${PREFIX}/sdc-elasticsearch:${RELEASE}
309 fi
310 docker run -dit --name ${DOCKER_NAME} --env ENVNAME="${DEP_ENV}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --env ES_JAVA_OPTS="-Xms512m -Xmx512m" --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 ${LOCAL_TIME_MOUNT_CMD} --env ES_HEAP_SIZE=1024M --volume ${WORKSPACE}/data/ES:/usr/share/elasticsearch/data --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --publish 9200:9200 --publish 9300:9300 ${PREFIX}/sdc-elasticsearch:${RELEASE} /bin/sh
311 command_exit_status $? ${DOCKER_NAME}
312 echo "please wait while ES is starting..."
313 monitor_docker ${DOCKER_NAME}
314}
315#
316
317
318#Init-Elastic-Search
319function sdc-init-es {
320 DOCKER_NAME="sdc-init-es"
321 echo "docker run sdc-init-elasticsearch..."
322 if [ ${LOCAL} = false ]; then
323 echo "pulling code"
324 docker pull ${PREFIX}/sdc-init-elasticsearch:${RELEASE}
325 fi
326 echo "Running sdc-init-es"
327 docker run --name ${DOCKER_NAME} --env ENVNAME="${DEP_ENV}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 ${LOCAL_TIME_MOUNT_CMD} --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments ${PREFIX}/sdc-init-elasticsearch:${RELEASE} > /dev/null 2>&1
328 rc=$?
329 docker_logs ${DOCKER_NAME}
330 if [[ ${rc} != 0 ]]; then exit ${rc}; fi
331}
332#
333
334
335#Cassandra
336function sdc-cs {
337 DOCKER_NAME="sdc-cs"
338 echo "docker run sdc-cassandra..."
339 if [ ${LOCAL} = false ]; then
340 docker pull ${PREFIX}/sdc-cassandra:${RELEASE}
341 fi
342 docker run -dit --name ${DOCKER_NAME} --env RELEASE="${RELEASE}" --env CS_PASSWORD="${CS_PASSWORD}" --env ENVNAME="${DEP_ENV}" --env HOST_IP=${IP} --env MAX_HEAP_SIZE="1536M" --env HEAP_NEWSIZE="512M" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 ${LOCAL_TIME_MOUNT_CMD} --volume ${WORKSPACE}/data/CS:/var/lib/cassandra --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --publish 9042:9042 --publish 9160:9160 ${PREFIX}/sdc-cassandra:${RELEASE} /bin/sh
343 command_exit_status $? ${DOCKER_NAME}
344 echo "please wait while CS is starting..."
345 monitor_docker ${DOCKER_NAME}
346}
347#
348
349
350#Cassandra-init
351function sdc-cs-init {
352 DOCKER_NAME="sdc-cs-init"
353 echo "docker run sdc-cassandra-init..."
354 if [ ${LOCAL} = false ]; then
355 docker pull ${PREFIX}/sdc-cassandra-init:${RELEASE}
356 fi
357 docker run --name ${DOCKER_NAME} --env RELEASE="${RELEASE}" --env SDC_USER="${SDC_USER}" --env SDC_PASSWORD="${SDC_PASSWORD}" --env CS_PASSWORD="${CS_PASSWORD}" --env ENVNAME="${DEP_ENV}" --env HOST_IP=${IP} --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 ${LOCAL_TIME_MOUNT_CMD} --volume ${WORKSPACE}/data/CS:/var/lib/cassandra --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --volume ${WORKSPACE}/data/CS-Init:/root/chef-solo/cache ${PREFIX}/sdc-cassandra-init:${RELEASE} > /dev/null 2>&1
358 rc=$?
359 docker_logs ${DOCKER_NAME}
360 if [[ ${rc} != 0 ]]; then exit ${rc}; fi
361}
362#
363
364
365#Onboard Cassandra-init
366function sdc-cs-onboard-init {
367 DOCKER_NAME="sdc-cs-onboard-init"
368 echo "docker run sdc-cs-onboard-init..."
369 if [ ${LOCAL} = false ]; then
370 docker pull ${PREFIX}/sdc-onboard-cassandra-init:${RELEASE}
371 fi
372 docker run --name ${DOCKER_NAME} --env RELEASE="${RELEASE}" --env CS_HOST_IP=${IP} --env SDC_USER="${SDC_USER}" --env SDC_PASSWORD="${SDC_PASSWORD}" --env CS_PASSWORD="${CS_PASSWORD}" --env ENVNAME="${DEP_ENV}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 ${LOCAL_TIME_MOUNT_CMD} --volume ${WORKSPACE}/data/CS:/var/lib/cassandra --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --volume ${WORKSPACE}/data/CS-Init:/root/chef-solo/cache ${PREFIX}/sdc-onboard-cassandra-init:${RELEASE}
373 rc=$?
374 docker_logs ${DOCKER_NAME}
375 if [[ ${rc} != 0 ]]; then exit ${rc}; fi
376}
377#
378
379
380#Kibana
381function sdc-kbn {
382 DOCKER_NAME="sdc-kbn"
383 echo "docker run sdc-kibana..."
384 if [ ${LOCAL} = false ]; then
385 docker pull ${PREFIX}/sdc-kibana:${RELEASE}
386 docker run --detach --name ${DOCKER_NAME} --env ENVNAME="${DEP_ENV}" --env NODE_OPTIONS="--max-old-space-size=200" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 ${LOCAL_TIME_MOUNT_CMD} --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --publish 5601:5601 ${PREFIX}/sdc-kibana:${RELEASE}
387 command_exit_status $? ${DOCKER_NAME}
388 fi
389}
390#
391
392
393#Back-End
394function sdc-BE {
395 DOCKER_NAME="sdc-BE"
396 echo "docker run sdc-backend..."
397 if [ ${LOCAL} = false ]; then
398 docker pull ${PREFIX}/sdc-backend:${RELEASE}
399 else
Tal Gitelmanef4b94e2018-08-02 17:11:25 +0300400 ADDITIONAL_ARGUMENTS=${BE_DEBUG_PORT}
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300401 fi
402 docker run --detach --name ${DOCKER_NAME} --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --env cassandra_ssl_enabled="false" --env JAVA_OPTIONS="${BE_JAVA_OPTIONS}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 ${LOCAL_TIME_MOUNT_CMD} --volume ${WORKSPACE}/data/logs/BE/:/var/lib/jetty/logs --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --publish 8443:8443 --publish 8080:8080 ${ADDITIONAL_ARGUMENTS} ${PREFIX}/sdc-backend:${RELEASE}
403 command_exit_status $? ${DOCKER_NAME}
404 echo "please wait while BE is starting..."
405 monitor_docker ${DOCKER_NAME}
406}
407#
408
409
410# Back-End-Init
411function sdc-BE-init {
412 DOCKER_NAME="sdc-BE-init"
413 echo "docker run sdc-backend-init..."
414 if [ ${LOCAL} = false ]; then
415 docker pull ${PREFIX}/sdc-backend-init:${RELEASE}
416 fi
417 docker run --name ${DOCKER_NAME} --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 ${LOCAL_TIME_MOUNT_CMD} --volume ${WORKSPACE}/data/logs/BE/:/var/lib/jetty/logs --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments ${PREFIX}/sdc-backend-init:${RELEASE} > /dev/null 2>&1
418 rc=$?
419 docker_logs ${DOCKER_NAME}
420 if [[ ${rc} != 0 ]]; then exit ${rc}; fi
421}
422#
423
424
425# Onboard Back-End
426function sdc-onboard-BE {
427 DOCKER_NAME="sdc-onboard-BE"
428 echo "docker run sdc-onboard-BE ..."
429# TODO Check the dir_perms action . do we need it here ??
430# dir_perms
431 if [ ${LOCAL} = false ]; then
432 docker pull ${PREFIX}/sdc-onboard-backend:${RELEASE}
433 else
434 ADDITIONAL_ARGUMENTS=${ONBOARD_DEBUG_PORT}
435 fi
kooperb087a8b2019-04-04 14:03:36 +0000436 docker run --detach --name ${DOCKER_NAME} --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --env cassandra_ssl_enabled="false" --env SDC_CLUSTER_NAME="SDC-CS-${DEP_ENV}" --env SDC_USER="${SDC_USER}" --env SDC_PASSWORD="${SDC_PASSWORD}" --env SDC_CERT_DIR="${SDC_CERT_DIR}" --env JAVA_OPTIONS="${ONBOARD_BE_JAVA_OPTIONS}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 ${LOCAL_TIME_MOUNT_CMD} --volume ${WORKSPACE}/data/${SDC_CERT_DIR}:/var/lib/jetty/onap/cert --volume ${WORKSPACE}/data/logs/ONBOARD:/var/lib/jetty/logs --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --publish 8445:8445 --publish 8081:8081 ${ADDITIONAL_ARGUMENTS} ${PREFIX}/sdc-onboard-backend:${RELEASE}
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300437 command_exit_status $? ${DOCKER_NAME}
438 echo "please wait while sdc-onboard-BE is starting..."
439 monitor_docker ${DOCKER_NAME}
440}
441#
442
443
444# Front-End
445function sdc-FE {
446 DOCKER_NAME="sdc-FE"
447 echo "docker run sdc-frontend..."
448 if [ ${LOCAL} = false ]; then
449 docker pull ${PREFIX}/sdc-frontend:${RELEASE}
Tal Gitelmanef4b94e2018-08-02 17:11:25 +0300450 else
451 ADDITIONAL_ARGUMENTS=${FE_DEBUG_PORT}
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300452 fi
shrikantawachard139e092019-01-16 12:37:16 +0530453 docker run --detach --name ${DOCKER_NAME} --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --env JAVA_OPTIONS="${FE_JAVA_OPTIONS}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 ${LOCAL_TIME_MOUNT_CMD} --volume ${WORKSPACE}/data/logs/FE/:/var/lib/jetty/logs --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --volume ${WORKSPACE}/data/environments/plugins-configuration.yaml:${JETTY_BASE}/config/catalog-fe/plugins-configuration.yaml --publish 9443:9443 --publish 8181:8181 ${ADDITIONAL_ARGUMENTS} ${PREFIX}/sdc-frontend:${RELEASE}
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300454 command_exit_status $? ${DOCKER_NAME}
455 echo "please wait while FE is starting....."
456 monitor_docker ${DOCKER_NAME}
457}
458#
459
460
461# DCAE BackEnd
462function dcae-be {
463 if [ ! ${DCAE_ENABLE} ] ; then
464 return
465 fi
466 DOCKER_NAME="dcae-be"
467 echo "docker run ${DOCKER_NAME}..."
468 if [ ${LOCAL} = false ]; then
kaihlavib2372712019-05-27 16:28:23 +0300469 docker pull ${PREFIX}/${DOCKER_NAME}:${DCAE_RELEASE}
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300470 fi
kaihlavib2372712019-05-27 16:28:23 +0300471 docker run --detach --name ${DOCKER_NAME} --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --env JAVA_OPTIONS="${DCAE_BE_JAVA_OPTIONS}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 ${LOCAL_TIME_MOUNT_CMD} --volume ${WORKSPACE}/data/logs/DCAE-BE/:/var/lib/jetty/logs --volume ${WORKSPACE}/data/environments:/var/opt/dcae-be/chef-solo/environments --publish 8444:8444 --publish 8082:8082 ${PREFIX}/${DOCKER_NAME}:${DCAE_RELEASE}
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300472 command_exit_status $? ${DOCKER_NAME}
473 echo "please wait while ${DOCKER_NAME^^} is starting....."
474 monitor_docker ${DOCKER_NAME}
475}
476#
477
478
479# DCAE Configuration
480function dcae-tools {
481 if [ ! ${DCAE_ENABLE} ] ; then
482 return
483 fi
484 DOCKER_NAME="dcae-tools"
485 echo "docker run ${DOCKER_NAME}..."
486 if [ ${LOCAL} = false ]; then
kaihlavib2372712019-05-27 16:28:23 +0300487 docker pull ${PREFIX}/${DOCKER_NAME}:${DCAE_RELEASE}
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300488 fi
kaihlavib2372712019-05-27 16:28:23 +0300489 docker run --detach --name ${DOCKER_NAME} --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" ${LOCAL_TIME_MOUNT_CMD} --volume ${WORKSPACE}/data/logs/BE/:/var/lib/jetty/logs --volume ${WORKSPACE}/data/environments:/var/opt/dcae-tools/chef-solo/environments ${PREFIX}/${DOCKER_NAME}:${DCAE_RELEASE}
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300490 command_exit_status $? ${DOCKER_NAME}
491 echo "please wait while ${DOCKER_NAME^^} is starting....."
492 monitor_docker ${DOCKER_NAME}
493
494}
495#
496
497
498# DCAE FrontEnd
499function dcae-fe {
500 if [ ! ${DCAE_ENABLE} ] ; then
501 return
502 fi
503 DOCKER_NAME="dcae-fe"
504 echo "docker run ${DOCKER_NAME}..."
505 if [ ${LOCAL} = false ]; then
kaihlavib2372712019-05-27 16:28:23 +0300506 docker pull ${PREFIX}/${DOCKER_NAME}:${DCAE_RELEASE}
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300507 fi
kaihlavib2372712019-05-27 16:28:23 +0300508 docker run --detach --name ${DOCKER_NAME} --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --env JAVA_OPTIONS="${DCAE_FE_JAVA_OPTIONS}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 ${LOCAL_TIME_MOUNT_CMD} --volume ${WORKSPACE}/data/logs/DCAE-FE/:/var/lib/jetty/logs --volume ${WORKSPACE}/data/environments:/var/opt/dcae-fe/chef-solo/environments/ --publish 9444:9444 --publish 8183:8183 ${PREFIX}/${DOCKER_NAME}:${DCAE_RELEASE}
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300509 command_exit_status $? ${DOCKER_NAME}
510 echo "please wait while ${DOCKER_NAME^^} is starting....."
511 monitor_docker ${DOCKER_NAME}
512
513}
514#
515
516
517# apis-sanity
518function sdc-api-tests {
519 if [[ ${RUN_API_TESTS} = true ]] ; then
Yuli Shlosbergd0eaeca2018-07-19 17:54:15 +0300520 healthCheck
521 healthCheck_http_code=$?
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300522 if [[ ${healthCheck_http_code} == 200 ]] ; then
523 echo "docker run sdc-api-tests..."
524 echo "Trigger sdc-api-tests docker, please wait..."
525
526 if [ ${LOCAL} = false ]; then
527 docker pull ${PREFIX}/sdc-api-tests:${RELEASE}
528 fi
529
AndyWalshec1835f32019-04-25 11:20:38 +0000530 docker run --detach --name sdc-api-tests --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --env JAVA_OPTIONS="${API_TESTS_JAVA_OPTIONS}" --env SUITE_NAME=${API_SUITE} --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 ${LOCAL_TIME_MOUNT_CMD} --volume ${WORKSPACE}/data/logs/sdc-api-tests/target:/var/lib/tests/target --volume ${WORKSPACE}/data/logs/sdc-api-tests/ExtentReport:/var/lib/tests/ExtentReport --volume ${WORKSPACE}/data/logs/sdc-api-tests/outputCsar:/var/lib/tests/outputCsar --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --volume ${WORKSPACE}/data/${SDC_CERT_DIR}:/var/lib/tests/cert --publish 9560:9560 ${PREFIX}/sdc-api-tests:${RELEASE} echo "please wait while SDC-API-TESTS is starting....."
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300531 monitor_docker sdc-api-tests
532 fi
533 fi
534}
535#
536
537
538# ui-sanity
539function sdc-ui-tests {
540
541 if [[ ${RUN_UI_TESTS} = true ]] ; then
Yuli Shlosbergd0eaeca2018-07-19 17:54:15 +0300542 healthCheck
543 healthCheck_http_code=$?
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300544 if [[ ${healthCheck_http_code} == 200 ]]; then
545 echo "docker run sdc-ui-tets..."
546 echo "Trigger sdc-ui-tests docker, please wait..."
547
548 if [ ${LOCAL} = false ]; then
549 docker pull ${PREFIX}/sdc-ui-tests:${RELEASE}
550 fi
Michael Landodc856bb2018-08-13 13:27:52 +0300551 RUN_SIMULATOR=true;
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300552 sdc-sim
553 docker run --detach --name sdc-ui-tests --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --env JAVA_OPTIONS="${UI_TESTS_JAVA_OPTIONS}" --env SUITE_NAME=${UI_SUITE} --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 ${LOCAL_TIME_MOUNT_CMD} --volume ${WORKSPACE}/data/logs/sdc-ui-tests/target:/var/lib/tests/target --volume ${WORKSPACE}/data/logs/sdc-ui-tests/ExtentReport:/var/lib/tests/ExtentReport --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --publish 5901:5901 --publish 6901:6901 ${PREFIX}/sdc-ui-tests:${RELEASE}
554 echo "please wait while SDC-UI-TESTS is starting....."
555 monitor_docker sdc-ui-tests
556 fi
557 fi
558}
559#
560
561
562# SDC-Simulator
563function sdc-sim {
Lianhao Lu26166842018-09-07 10:42:10 +0800564 if [ "${RUN_SIMULATOR}" == true ]; then
Michael Landodc856bb2018-08-13 13:27:52 +0300565 echo "docker run sdc-webSimulator..."
566 if [ ${LOCAL} = false ]; then
567 docker pull ${PREFIX}/sdc-simulator:${RELEASE}
568 fi
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300569
Michael Landodc856bb2018-08-13 13:27:52 +0300570 probe_sim
571 sim_stat=$?
Michael Landob751c962018-08-20 11:34:04 +0300572 if [ ${sim_stat} == 1 ]; then
Michael Landodc856bb2018-08-13 13:27:52 +0300573 docker run \
574 --detach \
575 --name sdc-sim \
576 --env FE_URL="${FE_URL}" \
577 --env JAVA_OPTIONS="${SIM_JAVA_OPTIONS}" \
578 --env ENVNAME="${DEP_ENV}" \
579 ${LOCAL_TIME_MOUNT_CMD} \
580 --volume ${WORKSPACE}/data/logs/WS/:/var/lib/jetty/logs \
581 --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments \
582 --publish 8285:8080 \
583 --publish 8286:8443 ${PREFIX}/sdc-simulator:${RELEASE}
584 echo "please wait while SDC-WEB-SIMULATOR is starting....."
585 monitor_docker sdc-sim
586 fi
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300587 fi
588}
589#
590
591
592#
593# Main
594#
595
596# Handle command line arguments
Idan Amitdb3d5542017-12-07 11:33:32 +0200597while [ $# -gt 0 ]; do
Michael Lando451a3402017-02-19 10:28:42 +0200598 case $1 in
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300599
Idan Amitdb3d5542017-12-07 11:33:32 +0200600 # -r | --release - The specific docker version to pull and deploy
Yuli Shlosberg0566f582017-11-26 19:05:23 +0200601 -r | --release )
602 shift 1 ;
603 RELEASE=$1;
604 shift 1;;
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300605
Idan Amitdb3d5542017-12-07 11:33:32 +0200606 # -e | --environment - The environment name you want to deploy
Yuli Shlosberg0566f582017-11-26 19:05:23 +0200607 -e | --environment )
608 shift 1;
609 DEP_ENV=$1;
610 shift 1 ;;
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300611
Idan Amitdb3d5542017-12-07 11:33:32 +0200612 # -p | --port - The port from which to connect to the docker nexus
Yuli Shlosberg0566f582017-11-26 19:05:23 +0200613 -p | --port )
614 shift 1 ;
615 PORT=$1;
616 shift 1 ;;
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300617
Idan Amitdb3d5542017-12-07 11:33:32 +0200618 # -l | --local - Use this for deploying your local dockers without pulling them first
Yuli Shlosberg0566f582017-11-26 19:05:23 +0200619 -l | --local )
620 LOCAL=true;
621 shift 1;;
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300622
Yuli Shlosbergf59a2252018-03-21 11:14:08 +0200623 # -ta - Use this for running the APIs sanity docker after all other dockers have been deployed
624 -ta )
625 shift 1 ;
626 API_SUITE=$1;
627 RUN_API_TESTS=true;
628 shift 1 ;;
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300629
Yuli Shlosbergf59a2252018-03-21 11:14:08 +0200630 # -tu - Use this for running the UI sanity docker after all other dockers have been deployed
631 -tu )
632 shift 1 ;
633 UI_SUITE=$1;
634 RUN_UI_TESTS=true;
635 shift 1 ;;
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300636
Yuli Shlosbergf59a2252018-03-21 11:14:08 +0200637 # -tad - Use this for running the DEFAULT suite of tests in APIs sanity docker after all other dockers have been deployed
638 -tad | -t )
639 API_SUITE="onapApiSanity";
640 RUN_API_TESTS=true;
641 shift 1 ;;
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300642
Yuli Shlosbergf59a2252018-03-21 11:14:08 +0200643 # -tud - Use this for running the DEFAULT suite of tests in UI sanity docker after all other dockers have been deployed
644 -tud )
645 UI_SUITE="onapUiSanity";
646 RUN_UI_TESTS=true;
Yuli Shlosberg0566f582017-11-26 19:05:23 +0200647 shift 1 ;;
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300648
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200649 # -d | --docker - The init specified docker
650 -d | --docker )
651 shift 1 ;
652 DOCKER=$1;
653 shift 1 ;;
Michael Landodc856bb2018-08-13 13:27:52 +0300654 # -sim | --simulator run the simulator
655 -sim | --simulator )
kaihlavib2372712019-05-27 16:28:23 +0300656 RUN_SIMULATOR=true;
657 shift 1 ;;
Michael Landodc856bb2018-08-13 13:27:52 +0300658 # -sim | --simulator run the simulator
659 -u | --fe_url )
kaihlavib2372712019-05-27 16:28:23 +0300660 shift 1 ;
661 FE_URL=$1;
662 shift 1 ;;
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300663 # -dcae | --dcae - Use this to deploy DCAE upon SDC
664 -dcae | --dcae )
kaihlavib2372712019-05-27 16:28:23 +0300665 shift 1 ;
666 DCAE_RELEASE=$1;
667 shift 1;
668 DCAE_ENABLE='True';;
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300669
Idan Amitdb3d5542017-12-07 11:33:32 +0200670 # -h | --help - Display the help message with all the available run options
Yuli Shlosberg0566f582017-11-26 19:05:23 +0200671 -h | --help )
672 usage;
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300673 exit ${SUCCESS};;
674
Yuli Shlosberg0566f582017-11-26 19:05:23 +0200675 * )
676 usage;
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300677 exit ${FAILURE};;
Michael Lando451a3402017-02-19 10:28:42 +0200678 esac
Michael Lando451a3402017-02-19 10:28:42 +0200679done
680
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300681
liang dingd73c2872018-09-27 19:07:02 -0700682#Prefix those with WORKSPACE so it can be set to something other than /opt
dekstroza83520062018-05-03 16:47:08 +0100683[ -f ${WORKSPACE}/opt/config/env_name.txt ] && DEP_ENV=$(cat ${WORKSPACE}/opt/config/env_name.txt) || echo ${DEP_ENV}
684[ -f ${WORKSPACE}/opt/config/nexus_username.txt ] && NEXUS_USERNAME=$(cat ${WORKSPACE}/opt/config/nexus_username.txt) || NEXUS_USERNAME=release
685[ -f ${WORKSPACE}/opt/config/nexus_password.txt ] && NEXUS_PASSWD=$(cat ${WORKSPACE}/opt/config/nexus_password.txt) || NEXUS_PASSWD=sfWU3DFVdBr7GVxB85mTYgAW
686[ -f ${WORKSPACE}/opt/config/nexus_docker_repo.txt ] && NEXUS_DOCKER_REPO=$(cat ${WORKSPACE}/opt/config/nexus_docker_repo.txt) || NEXUS_DOCKER_REPO=nexus3.onap.org:${PORT}
687[ -f ${WORKSPACE}/opt/config/nexus_username.txt ] && docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO
Michael Lando451a3402017-02-19 10:28:42 +0200688
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300689
Yuli Shlosbergd1bb2e52018-01-15 11:51:21 +0200690export IP=`ip route get 8.8.8.8 | awk '/src/{ print $7 }'`
dekstroza83520062018-05-03 16:47:08 +0100691#If OSX, then use this to get IP
692if [[ "$OSTYPE" == "darwin"* ]]; then
693 export IP=$(ipconfig getifaddr en0)
694fi
Idan Amitdb3d5542017-12-07 11:33:32 +0200695export PREFIX=${NEXUS_DOCKER_REPO}'/onap'
Idan Amitc7f57ec2017-08-31 14:26:21 +0300696
697if [ ${LOCAL} = true ]; then
Idan Amitdb3d5542017-12-07 11:33:32 +0200698 PREFIX='onap'
Idan Amitc7f57ec2017-08-31 14:26:21 +0300699fi
Michael Lando451a3402017-02-19 10:28:42 +0200700
701echo ""
702
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200703if [ -z "${DOCKER}" ]; then
Michael Lando4b9b9472018-06-02 19:14:05 +0300704 cleanup all
Yuli Shlosbergf59a2252018-03-21 11:14:08 +0200705 dir_perms
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200706 sdc-es
707 sdc-init-es
708 sdc-cs
709 sdc-cs-init
Gitelman, Tal (tg851x)19c9bda2018-03-19 19:07:30 +0200710# sdc-kbn
Avi Zivc175a0d2018-03-15 13:21:44 +0200711 sdc-cs-onboard-init
712 sdc-onboard-BE
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200713 sdc-BE
714 sdc-BE-init
715 sdc-FE
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300716 dcae-be
717 dcae-tools
718 dcae-fe
719 healthCheck
Michael Landodc856bb2018-08-13 13:27:52 +0300720 sdc-sim
Yuli Shlosbergf59a2252018-03-21 11:14:08 +0200721 sdc-api-tests
Areli, Fuss (af732p)062d4c12018-06-03 18:49:19 +0300722 sdc-ui-tests
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200723else
724 cleanup ${DOCKER}
svishnev0b698c42018-03-08 15:50:44 +0200725 dir_perms
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200726 ${DOCKER}
Yuli Shlosberge07a5162018-02-26 10:11:10 +0200727 healthCheck
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200728fi