Leonardo Bellini | d452192 | 2018-03-01 08:48:10 -0600 | [diff] [blame] | 1 | #!/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 Bellini | d280c26 | 2018-03-09 04:26:58 -0600 | [diff] [blame] | 17 | echo "### This is ${WORKSPACE}/test/csit/scripts/optf-has/has/has_script.sh" |
Leonardo Bellini | d452192 | 2018-03-01 08:48:10 -0600 | [diff] [blame] | 18 | # |
| 19 | # add here whatever commands is needed to prepare the optf/has CSIT testing |
| 20 | # |
| 21 | |
Leonardo Bellini | d280c26 | 2018-03-09 04:26:58 -0600 | [diff] [blame] | 22 | # assume the base is /tmp dir |
| 23 | DIR=/tmp |
Leonardo Bellini | 3a275ec | 2018-03-08 11:48:47 -0600 | [diff] [blame] | 24 | |
| 25 | # the directory of the script |
Leonardo Bellini | 3a275ec | 2018-03-08 11:48:47 -0600 | [diff] [blame] | 26 | echo ${DIR} |
| 27 | cd ${DIR} |
| 28 | |
Leonardo Bellini | 3a275ec | 2018-03-08 11:48:47 -0600 | [diff] [blame] | 29 | # create directory for volume and copy configuration file |
Leonardo Bellini | b0995b4 | 2018-03-17 05:26:31 -0500 | [diff] [blame] | 30 | # run docker containers |
| 31 | COND_CONF=/tmp/conductor/properties/conductor.conf |
| 32 | LOG_CONF=/tmp/conductor/properties/log.conf |
Leonardo Bellini | c26cb0b | 2018-03-19 11:49:36 -0500 | [diff] [blame] | 33 | IMAGE_NAME=nexus3.onap.org:10001/onap/optf-has |
Leonardo Bellini | b0995b4 | 2018-03-17 05:26:31 -0500 | [diff] [blame] | 34 | CERT=/tmp/conductor/properties/cert.cer |
| 35 | KEY=/tmp/conductor/properties/cert.key |
| 36 | BUNDLE=/tmp/conductor/properties/cert.pem |
| 37 | |
Leonardo Bellini | 3a275ec | 2018-03-08 11:48:47 -0600 | [diff] [blame] | 38 | mkdir -p /tmp/conductor/properties |
Leonardo Bellini | 50ee9d6 | 2018-03-15 04:39:25 -0500 | [diff] [blame] | 39 | mkdir -p /tmp/conductor/logs |
Leonardo Bellini | d280c26 | 2018-03-09 04:26:58 -0600 | [diff] [blame] | 40 | cp ${WORKSPACE}/test/csit/scripts/optf-has/has/has-properties/conductor.conf.onap /tmp/conductor/properties/conductor.conf |
Leonardo Bellini | b0995b4 | 2018-03-17 05:26:31 -0500 | [diff] [blame] | 41 | cp ${WORKSPACE}/test/csit/scripts/optf-has/has/has-properties/log.conf.onap /tmp/conductor/properties/log.conf |
Leonardo Bellini | d280c26 | 2018-03-09 04:26:58 -0600 | [diff] [blame] | 42 | cp ${WORKSPACE}/test/csit/scripts/optf-has/has/has-properties/cert.cer /tmp/conductor/properties/cert.cer |
| 43 | cp ${WORKSPACE}/test/csit/scripts/optf-has/has/has-properties/cert.key /tmp/conductor/properties/cert.key |
| 44 | cp ${WORKSPACE}/test/csit/scripts/optf-has/has/has-properties/cert.pem /tmp/conductor/properties/cert.pem |
Leonardo Bellini | b63ed79 | 2018-03-13 08:37:24 -0500 | [diff] [blame] | 45 | #chmod -R 777 /tmp/conductor/properties |
Leonardo Bellini | 3a275ec | 2018-03-08 11:48:47 -0600 | [diff] [blame] | 46 | |
Leonardo Bellini | 50ee9d6 | 2018-03-15 04:39:25 -0500 | [diff] [blame] | 47 | MUSIC_IP=`docker inspect --format '{{ .NetworkSettings.Networks.bridge.IPAddress}}' music-tomcat` |
| 48 | echo "MUSIC_IP=${MUSIC_IP}" |
| 49 | |
Leonardo Bellini | b0995b4 | 2018-03-17 05:26:31 -0500 | [diff] [blame] | 50 | # change MUSIC reference to the local instance |
Leonardo Bellini | 50ee9d6 | 2018-03-15 04:39:25 -0500 | [diff] [blame] | 51 | sed -i -e "s%localhost:8080/MUSIC%${MUSIC_IP}:8080/MUSIC%g" /tmp/conductor/properties/conductor.conf |
| 52 | |
Leonardo Bellini | 853238d | 2018-03-27 05:42:06 -0500 | [diff] [blame] | 53 | AAISIM_IP=`docker inspect --format '{{ .NetworkSettings.Networks.bridge.IPAddress}}' aaisim` |
| 54 | echo "AAISIM_IP=${AAISIM_IP}" |
| 55 | |
Leonardo Bellini | 67bebbd | 2018-04-03 03:58:40 -0500 | [diff] [blame] | 56 | # change AAI reference to the local instance |
Leonardo Bellini | 39334cc | 2018-03-20 11:59:34 -0500 | [diff] [blame] | 57 | sed -i -e "s%localhost:8081/%${AAISIM_IP}:8081/%g" /tmp/conductor/properties/conductor.conf |
| 58 | |
Leonardo Bellini | 25c75c7 | 2018-04-12 08:42:51 -0500 | [diff] [blame] | 59 | MULTICLOUDSIM_IP=`docker inspect --format '{{ .NetworkSettings.Networks.bridge.IPAddress}}' multicloudsim` |
| 60 | echo "MULTICLOUDSIM_IP=${MULTICLOUDSIM_IP}" |
| 61 | |
| 62 | # change MULTICLOUD reference to the local instance |
Leonardo Bellini | 85ca1ca | 2018-04-20 08:22:16 -0500 | [diff] [blame] | 63 | sed -i -e "s%msb.onap.org:8082/%${MULTICLOUDSIM_IP}:8082/%g" /tmp/conductor/properties/conductor.conf |
Leonardo Bellini | 25c75c7 | 2018-04-12 08:42:51 -0500 | [diff] [blame] | 64 | |
Leonardo Bellini | 67bebbd | 2018-04-03 03:58:40 -0500 | [diff] [blame] | 65 | #onboard conductor into music |
| 66 | curl -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 |
| 67 | |
Leonardo Bellini | b0995b4 | 2018-03-17 05:26:31 -0500 | [diff] [blame] | 68 | docker run -d --name cond-cont -v ${COND_CONF}:/usr/local/bin/conductor.conf -v ${LOG_CONF}:/usr/local/bin/log.conf ${IMAGE_NAME}:latest python /usr/local/bin/conductor-controller --config-file=/usr/local/bin/conductor.conf |
Leonardo Bellini | 735c8e1 | 2018-03-26 09:58:37 -0500 | [diff] [blame] | 69 | sleep 2 |
Leonardo Bellini | b0995b4 | 2018-03-17 05:26:31 -0500 | [diff] [blame] | 70 | docker 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}:latest python /usr/local/bin/conductor-api --port=8091 -- --config-file=/usr/local/bin/conductor.conf |
Leonardo Bellini | 735c8e1 | 2018-03-26 09:58:37 -0500 | [diff] [blame] | 71 | sleep 2 |
Leonardo Bellini | b0995b4 | 2018-03-17 05:26:31 -0500 | [diff] [blame] | 72 | docker run -d --name cond-solv -v ${COND_CONF}:/usr/local/bin/conductor.conf -v ${LOG_CONF}:/usr/local/bin/log.conf ${IMAGE_NAME}:latest python /usr/local/bin/conductor-solver --config-file=/usr/local/bin/conductor.conf |
Leonardo Bellini | 735c8e1 | 2018-03-26 09:58:37 -0500 | [diff] [blame] | 73 | sleep 2 |
Leonardo Bellini | b0995b4 | 2018-03-17 05:26:31 -0500 | [diff] [blame] | 74 | docker run -d --name cond-resv -v ${COND_CONF}:/usr/local/bin/conductor.conf -v ${LOG_CONF}:/usr/local/bin/log.conf ${IMAGE_NAME}:latest python /usr/local/bin/conductor-reservation --config-file=/usr/local/bin/conductor.conf |
Leonardo Bellini | 735c8e1 | 2018-03-26 09:58:37 -0500 | [diff] [blame] | 75 | sleep 2 |
Leonardo Bellini | b0995b4 | 2018-03-17 05:26:31 -0500 | [diff] [blame] | 76 | docker 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}:latest python /usr/local/bin/conductor-data --config-file=/usr/local/bin/conductor.conf |
Leonardo Bellini | 735c8e1 | 2018-03-26 09:58:37 -0500 | [diff] [blame] | 77 | sleep 2 |
Leonardo Bellini | 3a275ec | 2018-03-08 11:48:47 -0600 | [diff] [blame] | 78 | |
Leonardo Bellini | 50ee9d6 | 2018-03-15 04:39:25 -0500 | [diff] [blame] | 79 | COND_IP=`docker inspect --format '{{ .NetworkSettings.Networks.bridge.IPAddress}}' cond-api` |
| 80 | ${WORKSPACE}/test/csit/scripts/optf-has/has/wait_for_port.sh ${COND_IP} 8091 |
| 81 | |
Leonardo Bellini | 50ee9d6 | 2018-03-15 04:39:25 -0500 | [diff] [blame] | 82 | echo "inspect docker things for tracing purpose" |
| 83 | docker inspect cond-data |
| 84 | docker inspect cond-cont |
| 85 | docker inspect cond-api |
| 86 | docker inspect cond-solv |
| 87 | docker inspect cond-resv |
| 88 | |
Leonardo Bellini | 67bebbd | 2018-04-03 03:58:40 -0500 | [diff] [blame] | 89 | echo "dump music content just after conductor is started" |
Leonardo Bellini | 853238d | 2018-03-27 05:42:06 -0500 | [diff] [blame] | 90 | docker exec music-db /usr/bin/nodetool status |
| 91 | docker exec music-db /usr/bin/cqlsh -unelson24 -pwinman123 -e 'SELECT * FROM system_schema.keyspaces' |
| 92 | docker exec music-db /usr/bin/cqlsh -unelson24 -pwinman123 -e 'SELECT * FROM admin.keyspace_master' |