blob: be9802b54353fb42925d86f34be0511eaa76aa6b [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 Bellinid4521922018-03-01 08:48:10 -060017echo "### This is ${WORKSPACE}/test/csit/scripts/optf/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 Bellini3a275ec2018-03-08 11:48:47 -060022# assume the base is /opt
23DIR=/opt
24#cd /opt
25
26# the directory of the script
27#DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
28echo ${DIR}
29cd ${DIR}
30
31# the temp directory used, within $DIR
32# omit the -p parameter to create a temporal directory in the default location
33WORK_DIR=`mktemp -d -p "$DIR"`
34echo ${WORK_DIR}
35
36cd ${WORK_DIR}
37
38# check if tmp dir was created
39if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then
40 echo "Could not create temp dir"
41 exit 1
42fi
43
44
45git clone https://gerrit.onap.org/r/optf/has
46cd has
47cd conductor/docker
48
49sed -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
50sed -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
51sed -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
52sed -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
53sed -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
54
55
56# ./build-dockers.sh
57docker build -t api api/
58docker build -t controller controller/
59docker build -t data data/
60docker build -t solver solver/
61docker build -t reservation reservation/
62
63
64# create directory for volume and copy configuration file
65mkdir -p /tmp/conductor/properties
66cp ${WORKSPACE}/test/csit/scripts/optf/has/has-properties/conductor.conf.onap /tmp/conductor/properties/conductor.conf
67cp ${WORKSPACE}/test/csit/scripts/optf/has/has-properties/cert.cer /tmp/conductor/properties/cert.cer
68cp ${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
75docker run -d --name cond-cont -v /tmp/conductor/properties/conductor.conf:/usr/local/bin/conductor.conf controller
76docker run -d --name cond-api -p 8091:8091 -v /tmp/conductor/properties/conductor.conf:/usr/local/bin/conductor.conf api
77docker run -d --name cond-solv -v /tmp/conductor/properties/conductor.conf:/usr/local/bin/conductor.conf solver
78docker run -d --name cond-resv -v /tmp/conductor/properties/conductor.conf:/usr/local/bin/conductor.conf reservation
79
80# wait a while before continuing
81sleep 30