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 | d452192 | 2018-03-01 08:48:10 -0600 | [diff] [blame] | 17 | echo "### This is ${WORKSPACE}/test/csit/scripts/optf/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 | 3a275ec | 2018-03-08 11:48:47 -0600 | [diff] [blame] | 22 | # assume the base is /opt |
| 23 | DIR=/opt |
| 24 | #cd /opt |
| 25 | |
| 26 | # the directory of the script |
| 27 | #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
| 28 | echo ${DIR} |
| 29 | cd ${DIR} |
| 30 | |
| 31 | # the temp directory used, within $DIR |
| 32 | # omit the -p parameter to create a temporal directory in the default location |
| 33 | WORK_DIR=`mktemp -d -p "$DIR"` |
| 34 | echo ${WORK_DIR} |
| 35 | |
| 36 | cd ${WORK_DIR} |
| 37 | |
| 38 | # check if tmp dir was created |
| 39 | if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then |
| 40 | echo "Could not create temp dir" |
| 41 | exit 1 |
| 42 | fi |
| 43 | |
| 44 | |
| 45 | git clone https://gerrit.onap.org/r/optf/has |
| 46 | cd has |
| 47 | cd conductor/docker |
| 48 | |
Amjath khan | fc106b7 | 2018-03-08 13:52:19 -0500 | [diff] [blame^] | 49 | #sed -i -e "s%FROM python:2\.7%FROM python:2\.7\\nENV http_proxy http:\/\/one\.proxy\.att\.com:8080\\nENV https_proxy http:\/\/one\.proxy\.att\.com:8080%g" api/Dockerfile |
| 50 | #sed -i -e "s%FROM python:2\.7%FROM python:2\.7\\nENV http_proxy http:\/\/one\.proxy\.att\.com:8080\\nENV https_proxy http:\/\/one\.proxy\.att\.com:8080%g" controller/Dockerfile |
| 51 | #sed -i -e "s%FROM python:2\.7%FROM python:2\.7\\nENV http_proxy http:\/\/one\.proxy\.att\.com:8080\\nENV https_proxy http:\/\/one\.proxy\.att\.com:8080%g" data/Dockerfile |
| 52 | #sed -i -e "s%FROM python:2\.7%FROM python:2\.7\\nENV http_proxy http:\/\/one\.proxy\.att\.com:8080\\nENV https_proxy http:\/\/one\.proxy\.att\.com:8080%g" reservation/Dockerfile |
| 53 | #sed -i -e "s%FROM python:2\.7%FROM python:2\.7\\nENV http_proxy http:\/\/one\.proxy\.att\.com:8080\\nENV https_proxy http:\/\/one\.proxy\.att\.com:8080%g" solver/Dockerfile |
Leonardo Bellini | 3a275ec | 2018-03-08 11:48:47 -0600 | [diff] [blame] | 54 | |
| 55 | |
| 56 | # ./build-dockers.sh |
| 57 | docker build -t api api/ |
| 58 | docker build -t controller controller/ |
| 59 | docker build -t data data/ |
| 60 | docker build -t solver solver/ |
| 61 | docker build -t reservation reservation/ |
| 62 | |
| 63 | |
| 64 | # create directory for volume and copy configuration file |
| 65 | mkdir -p /tmp/conductor/properties |
| 66 | cp ${WORKSPACE}/test/csit/scripts/optf/has/has-properties/conductor.conf.onap /tmp/conductor/properties/conductor.conf |
| 67 | cp ${WORKSPACE}/test/csit/scripts/optf/has/has-properties/cert.cer /tmp/conductor/properties/cert.cer |
| 68 | cp ${WORKSPACE}/test/csit/scripts/optf/has/has-properties/cert.key /tmp/conductor/properties/cert.key |
| 69 | |
| 70 | |
| 71 | |
| 72 | # run docker containers |
| 73 | #docker run -d --name cond-data -v /tmp/conductor/properties/conductor.conf:/usr/local/bin/conductor.conf -v /tmp/conductor/properties/cert.key:/usr/local/bin/cert.key -v /tmp/conductor/properties/cert.cer:/usr/local/bin/cert.cer data |
| 74 | #docker run -d --name cond-data -v /tmp/conductor/properties/conductor.conf:/usr/local/bin/conductor.conf data |
| 75 | docker run -d --name cond-cont -v /tmp/conductor/properties/conductor.conf:/usr/local/bin/conductor.conf controller |
| 76 | docker run -d --name cond-api -p 8091:8091 -v /tmp/conductor/properties/conductor.conf:/usr/local/bin/conductor.conf api |
| 77 | docker run -d --name cond-solv -v /tmp/conductor/properties/conductor.conf:/usr/local/bin/conductor.conf solver |
| 78 | docker run -d --name cond-resv -v /tmp/conductor/properties/conductor.conf:/usr/local/bin/conductor.conf reservation |
| 79 | |
| 80 | # wait a while before continuing |
| 81 | sleep 30 |