blob: 2d2eff3b79e8166a937d4f38e1144ceddd4e2b88 [file] [log] [blame]
Leonardo Bellinid4521922018-03-01 08:48:10 -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#
Leonardo Bellinid280c262018-03-09 04:26:58 -060017echo "### This is ${WORKSPACE}/test/csit/scripts/optf-has/has/has_script.sh"
Leonardo Bellinid4521922018-03-01 08:48:10 -060018#
19# add here whatever commands is needed to prepare the optf/has CSIT testing
20#
21
Leonardo Bellinid280c262018-03-09 04:26:58 -060022# assume the base is /tmp dir
23DIR=/tmp
Leonardo Bellini3a275ec2018-03-08 11:48:47 -060024
25# the directory of the script
Leonardo Bellini3a275ec2018-03-08 11:48:47 -060026echo ${DIR}
27cd ${DIR}
28
Leonardo Bellini3a275ec2018-03-08 11:48:47 -060029# create directory for volume and copy configuration file
Leonardo Bellinib0995b42018-03-17 05:26:31 -050030# run docker containers
31COND_CONF=/tmp/conductor/properties/conductor.conf
32LOG_CONF=/tmp/conductor/properties/log.conf
Leonardo Bellinic26cb0b2018-03-19 11:49:36 -050033IMAGE_NAME=nexus3.onap.org:10001/onap/optf-has
Dileep Ranganathan101f7872018-09-07 02:53:07 -070034IMAGE_VER=1.2.1-SNAPSHOT-latest
Leonardo Bellinib0995b42018-03-17 05:26:31 -050035CERT=/tmp/conductor/properties/cert.cer
36KEY=/tmp/conductor/properties/cert.key
37BUNDLE=/tmp/conductor/properties/cert.pem
38
Leonardo Bellini3a275ec2018-03-08 11:48:47 -060039mkdir -p /tmp/conductor/properties
Leonardo Bellini50ee9d62018-03-15 04:39:25 -050040mkdir -p /tmp/conductor/logs
Leonardo Bellinid280c262018-03-09 04:26:58 -060041cp ${WORKSPACE}/test/csit/scripts/optf-has/has/has-properties/conductor.conf.onap /tmp/conductor/properties/conductor.conf
Leonardo Bellinib0995b42018-03-17 05:26:31 -050042cp ${WORKSPACE}/test/csit/scripts/optf-has/has/has-properties/log.conf.onap /tmp/conductor/properties/log.conf
Leonardo Bellinid280c262018-03-09 04:26:58 -060043cp ${WORKSPACE}/test/csit/scripts/optf-has/has/has-properties/cert.cer /tmp/conductor/properties/cert.cer
44cp ${WORKSPACE}/test/csit/scripts/optf-has/has/has-properties/cert.key /tmp/conductor/properties/cert.key
45cp ${WORKSPACE}/test/csit/scripts/optf-has/has/has-properties/cert.pem /tmp/conductor/properties/cert.pem
Leonardo Bellinib63ed792018-03-13 08:37:24 -050046#chmod -R 777 /tmp/conductor/properties
Leonardo Bellini3a275ec2018-03-08 11:48:47 -060047
Leonardo Bellini50ee9d62018-03-15 04:39:25 -050048MUSIC_IP=`docker inspect --format '{{ .NetworkSettings.Networks.bridge.IPAddress}}' music-tomcat`
49echo "MUSIC_IP=${MUSIC_IP}"
50
Leonardo Bellinib0995b42018-03-17 05:26:31 -050051# change MUSIC reference to the local instance
Leonardo Bellini50ee9d62018-03-15 04:39:25 -050052sed -i -e "s%localhost:8080/MUSIC%${MUSIC_IP}:8080/MUSIC%g" /tmp/conductor/properties/conductor.conf
53
Leonardo Bellini853238d2018-03-27 05:42:06 -050054AAISIM_IP=`docker inspect --format '{{ .NetworkSettings.Networks.bridge.IPAddress}}' aaisim`
55echo "AAISIM_IP=${AAISIM_IP}"
56
Leonardo Bellini67bebbd2018-04-03 03:58:40 -050057# change AAI reference to the local instance
Leonardo Bellini39334cc2018-03-20 11:59:34 -050058sed -i -e "s%localhost:8081/%${AAISIM_IP}:8081/%g" /tmp/conductor/properties/conductor.conf
59
Leonardo Bellini25c75c72018-04-12 08:42:51 -050060MULTICLOUDSIM_IP=`docker inspect --format '{{ .NetworkSettings.Networks.bridge.IPAddress}}' multicloudsim`
61echo "MULTICLOUDSIM_IP=${MULTICLOUDSIM_IP}"
62
63# change MULTICLOUD reference to the local instance
Leonardo Bellini85ca1ca2018-04-20 08:22:16 -050064sed -i -e "s%msb.onap.org:8082/%${MULTICLOUDSIM_IP}:8082/%g" /tmp/conductor/properties/conductor.conf
Leonardo Bellini25c75c72018-04-12 08:42:51 -050065
Leonardo Bellini67bebbd2018-04-03 03:58:40 -050066#onboard conductor into music
Dileep Ranganathanefea1b52018-07-25 05:40:08 -070067echo "Query MUSIC to check for reachability. Query Version"
68curl -vvvvv --noproxy "*" --request GET http://${MUSIC_IP}:8080/MUSIC/rest/v2/version -H "Content-Type: application/json"
69
70echo "Onboard conductor into music"
Leonardo Bellini67bebbd2018-04-03 03:58:40 -050071curl -vvvvv --noproxy "*" --request POST http://${MUSIC_IP}:8080/MUSIC/rest/v2/admin/onboardAppWithMusic -H "Content-Type: application/json" --data @${WORKSPACE}/test/csit/tests/optf-has/has/data/onboard.json
72
Dileep Ranganathan101f7872018-09-07 02:53:07 -070073docker run -d --name cond-cont -v ${COND_CONF}:/usr/local/bin/conductor.conf -v ${LOG_CONF}:/usr/local/bin/log.conf ${IMAGE_NAME}:${IMAGE_VER} python /usr/local/bin/conductor-controller --config-file=/usr/local/bin/conductor.conf
74sleep 20
75docker run -d --name cond-api -p "8091:8091" -v ${COND_CONF}:/usr/local/bin/conductor.conf -v ${LOG_CONF}:/usr/local/bin/log.conf ${IMAGE_NAME}:${IMAGE_VER} python /usr/local/bin/conductor-api --port=8091 -- --config-file=/usr/local/bin/conductor.conf
76sleep 20
77docker run -d --name cond-solv -v ${COND_CONF}:/usr/local/bin/conductor.conf -v ${LOG_CONF}:/usr/local/bin/log.conf ${IMAGE_NAME}:${IMAGE_VER} python /usr/local/bin/conductor-solver --config-file=/usr/local/bin/conductor.conf
78sleep 20
79docker run -d --name cond-resv -v ${COND_CONF}:/usr/local/bin/conductor.conf -v ${LOG_CONF}:/usr/local/bin/log.conf ${IMAGE_NAME}:${IMAGE_VER} python /usr/local/bin/conductor-reservation --config-file=/usr/local/bin/conductor.conf
80sleep 20
81docker run -d --name cond-data -v ${COND_CONF}:/usr/local/bin/conductor.conf -v ${LOG_CONF}:/usr/local/bin/log.conf -v ${CERT}:/usr/local/bin/cert.cer -v ${KEY}:/usr/local/bin/cert.key -v ${BUNDLE}:/usr/local/bin/cert.pem ${IMAGE_NAME}:${IMAGE_VER} python /usr/local/bin/conductor-data --config-file=/usr/local/bin/conductor.conf
82sleep 20
Leonardo Bellini3a275ec2018-03-08 11:48:47 -060083
Leonardo Bellini50ee9d62018-03-15 04:39:25 -050084COND_IP=`docker inspect --format '{{ .NetworkSettings.Networks.bridge.IPAddress}}' cond-api`
85${WORKSPACE}/test/csit/scripts/optf-has/has/wait_for_port.sh ${COND_IP} 8091
86
Leonardo Bellini50ee9d62018-03-15 04:39:25 -050087echo "inspect docker things for tracing purpose"
88docker inspect cond-data
89docker inspect cond-cont
90docker inspect cond-api
91docker inspect cond-solv
92docker inspect cond-resv
93
Leonardo Bellini67bebbd2018-04-03 03:58:40 -050094echo "dump music content just after conductor is started"
Leonardo Bellini853238d2018-03-27 05:42:06 -050095docker exec music-db /usr/bin/nodetool status
96docker exec music-db /usr/bin/cqlsh -unelson24 -pwinman123 -e 'SELECT * FROM system_schema.keyspaces'
97docker exec music-db /usr/bin/cqlsh -unelson24 -pwinman123 -e 'SELECT * FROM admin.keyspace_master'