blob: 63d2ef93fd025a661e05308a222d29b57505d647 [file] [log] [blame]
Leonardo Bellini4dfc5ca2018-03-01 10:56:57 -06001#!/bin/bash
2#
3# Copyright 2016-2017 Huawei Technologies Co., Ltd.
4#
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
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
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#
17
18#
19# add here eventual scripts needed for music
20#
Leonardo Bellini4dfc5ca2018-03-01 10:56:57 -060021echo "# music scripts calling";
Leonardo Bellini4dfc5ca2018-03-01 10:56:57 -060022source ${WORKSPACE}/test/csit/scripts/music/music-scripts/music_script.sh
23
24#
Leonardo Bellini4dfc5ca2018-03-01 10:56:57 -060025# add here all the configuration steps eventually needed to be carried out for music CSIT testing
26#
Leonardo Bellini4dfc5ca2018-03-01 10:56:57 -060027echo "# music configuration step";
Leonardo Bellinid5739462018-03-14 03:59:33 -050028
29CASS_IMG=nexus3.onap.org:10001/onap/music/cassandra_music:latest
30TOMCAT_IMG=nexus3.onap.org:10001/library/tomcat:8.0
31ZK_IMG=nexus3.onap.org:10001/library/zookeeper:3.4
32MUSIC_IMG=nexus3.onap.org:10001/onap/music/music:latest
33WORK_DIR=/tmp/music
34CASS_USERNAME=nelson24
35CASS_PASSWORD=winman123
Leonardo Bellinide47fd42018-03-07 12:07:30 -060036MUSIC_SOURCE_PROPERTIES=${WORKSPACE}/test/csit/scripts/music/music-properties
37MUSIC_PROPERTIES=/tmp/music/properties
38MUSIC_LOGS=/tmp/music/logs
Leonardo Bellinide47fd42018-03-07 12:07:30 -060039mkdir -p ${MUSIC_PROPERTIES}
40mkdir -p ${MUSIC_LOGS}
41
Leonardo Bellinid5739462018-03-14 03:59:33 -050042cp ${MUSIC_SOURCE_PROPERTIES}/* ${WORK_DIR}/properties
Leonardo Bellinide47fd42018-03-07 12:07:30 -060043
Leonardo Bellinid5739462018-03-14 03:59:33 -050044# Create Volume for mapping war file and tomcat
45docker volume create --name music-vol;
Leonardo Bellinide47fd42018-03-07 12:07:30 -060046
Leonardo Bellinid5739462018-03-14 03:59:33 -050047# Create a network for all the containers to run in.
48docker network create music-net;
Leonardo Bellinide47fd42018-03-07 12:07:30 -060049
Leonardo Bellinid5739462018-03-14 03:59:33 -050050# Start Cassandra
51docker run -d --name music-db --network music-net -p "7000:7000" -p "7001:7001" -p "7199:7199" -p "9042:9042" -p "9160:9160" -e CASSUSER=${CASS_USERNAME} -e CASSPASS=${CASS_PASSWORD} ${CASS_IMG};
52
53# Start Music war
54docker run -d --name music-war -v music-vol:/app ${MUSIC_IMG};
55
56# Start Zookeeper
57docker run -d --name music-zk --network music-net -p "2181:2181" -p "2888:2888" -p "3888:3888" ${ZK_IMG};
58
59# Delay for Cassandra
60sleep 20;
61
62# Start Up tomcat - Needs to have properties,logs dir and war file volume mapped.
63docker run -d --name music-tomcat --network music-net -p "8080:8080" -v music-vol:/usr/local/tomcat/webapps -v ${WORK_DIR}/properties:/opt/app/music/etc:ro -v ${WORK_DIR}/logs:/opt/app/music/logs ${TOMCAT_IMG};
64
65# Connect tomcat to host bridge network so that its port can be seen.
66docker network connect bridge music-tomcat;
67
68##################################
Leonardo Bellinide47fd42018-03-07 12:07:30 -060069
70#
71# add here below the start of all docker containers needed for music CSIT testing
72#
Leonardo Bellinide47fd42018-03-07 12:07:30 -060073
74CASSA_IP=`docker inspect --format '{{ .NetworkSettings.Networks.bridge.IPAddress}}' music-db`
75echo "CASSANDRA_IP=${CASSA_IP}"
76
77ZOO_IP=`docker inspect --format '{{ .NetworkSettings.Networks.bridge.IPAddress}}' music-zk`
78echo "ZOOKEEPER_IP=${ZOO_IP}"
79
80${WORKSPACE}/test/csit/scripts/music/music-scripts/wait_for_port.sh ${CASSA_IP} 9042
81
Leonardo Bellinide47fd42018-03-07 12:07:30 -060082TOMCAT_IP=`docker inspect --format '{{ .NetworkSettings.Networks.bridge.IPAddress}}' music-tomcat`
83echo "TOMCAT_IP=${TOMCAT_IP}"
84
Leonardo Bellini293263e2018-03-09 07:34:07 -060085${WORKSPACE}/test/csit/scripts/music/music-scripts/wait_for_port.sh ${TOMCAT_IP} 8080
Leonardo Bellinide47fd42018-03-07 12:07:30 -060086
87
Leonardo Bellinid5739462018-03-14 03:59:33 -050088echo "inspect docker things for tracing purpose"
89docker inspect music-db
90docker inspect music-zk
91docker inspect music-tomcat
92docker inspect music-war
93docker volume inspect music-vol
94docker network inspect music-net
Leonardo Bellinide47fd42018-03-07 12:07:30 -060095
96
Leonardo Bellini4dfc5ca2018-03-01 10:56:57 -060097
98
99#
100# add here all ROBOT_VARIABLES settings
101#
Leonardo Bellini4dfc5ca2018-03-01 10:56:57 -0600102echo "# music robot variables settings";
Leonardo Bellini293263e2018-03-09 07:34:07 -0600103ROBOT_VARIABLES="-v MUSIC_HOSTNAME:http://${TOMCAT_IP} -v MUSIC_PORT:8080 -v COND_HOSTNAME:http://localhost -v COND_PORT:8091"
Leonardo Bellini4dfc5ca2018-03-01 10:56:57 -0600104
105echo ${ROBOT_VARIABLES}
106
107
108