blob: 1e61726ba4bacfbd906104f90fe824917a705e9c [file] [log] [blame]
Gary Wu9abb61c2018-09-27 10:38:50 -07001#!/bin/bash
2# ============LICENSE_START=======================================================
3# Copyright (C) 2018 Ericsson. All rights reserved.
a.sreekumar7d80c382019-05-07 13:36:39 +00004#
5# Modifications copyright (c) 2019 Nordix Foundation.
Jim Hahn954af932019-06-03 15:00:08 -04006# Modifications Copyright (C) 2019 AT&T Intellectual Property.
Gary Wu9abb61c2018-09-27 10:38:50 -07007# ================================================================================
8# Licensed under the Apache License, Version 2.0 (the "License");
9# you may not use this file except in compliance with the License.
10# You may obtain a copy of the License at
11#
12# http://www.apache.org/licenses/LICENSE-2.0
13#
14# Unless required by applicable law or agreed to in writing, software
15# distributed under the License is distributed on an "AS IS" BASIS,
16# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17# See the License for the specific language governing permissions and
18# limitations under the License.
19#
20# SPDX-License-Identifier: Apache-2.0
21# ============LICENSE_END=========================================================
22
a.sreekumar7d80c382019-05-07 13:36:39 +000023echo "Uninstall docker-py and reinstall docker."
24pip uninstall -y docker-py
25pip uninstall -y docker
26pip install -U docker==2.7.0
Gary Wu9abb61c2018-09-27 10:38:50 -070027
a.sreekumar7d80c382019-05-07 13:36:39 +000028# the directory of the script
29DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
30echo ${DIR}
31
32# the temp directory used, within $DIR
33# omit the -p parameter to create a temporal directory in the default location
34WORK_DIR=`mktemp -d -p "$DIR"`
35echo ${WORK_DIR}
36
37cd ${WORK_DIR}
38
39# check if tmp dir was created
40if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then
41 echo "Could not create temp dir"
42 exit 1
43fi
44
45# bring down maven
46mkdir maven
47cd maven
48curl -O http://apache.claz.org/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
49tar -xzvf apache-maven-3.3.9-bin.tar.gz
50ls -l
51export PATH=${PATH}:${WORK_DIR}/maven/apache-maven-3.3.9/bin
52${WORK_DIR}/maven/apache-maven-3.3.9/bin/mvn -v
53cd ..
54
55git clone http://gerrit.onap.org/r/oparent
56git clone --depth 1 https://gerrit.onap.org/r/policy/models -b master
57cd models/models-sim/models-sim-dmaap
58${WORK_DIR}/maven/apache-maven-3.3.9/bin/mvn clean install -DskipTests --settings ${WORK_DIR}/oparent/settings.xml
59bash ./src/main/package/docker/docker_build.sh
60cd ${WORKSPACE}
61rm -rf ${WORK_DIR}
62sleep 3
63
64# Adding this waiting container due to race condition between pap and mariadb
65docker-compose -f ${WORKSPACE}/scripts/policy/policy-apex-pdp/docker-compose-apex.yml run --rm start_dependencies
Jim Hahn954af932019-06-03 15:00:08 -040066
67#Configure the database
68docker exec -it mariadb chmod +x /docker-entrypoint-initdb.d/db.sh
69docker exec -it mariadb /docker-entrypoint-initdb.d/db.sh
70
71# now bring everything else up
72docker-compose -f ${WORKSPACE}/scripts/policy/policy-apex-pdp/docker-compose-apex.yml run --rm start_all
73
74unset http_proxy https_proxy
a.sreekumar7d80c382019-05-07 13:36:39 +000075
76POLICY_API_IP=`get-instance-ip.sh policy-api`
77POLICY_PAP_IP=`get-instance-ip.sh policy-pap`
78MARIADB_IP=`get-instance-ip.sh mariadb`
79APEX_IP=`get-instance-ip.sh policy-apex-pdp`
80DMAAP_IP=`get-instance-ip.sh dmaap-simulator`
81
82echo PAP IP IS ${POLICY_PAP_IP}
83echo MARIADB IP IS ${MARIADB_IP}
84echo API IP IS ${POLICY_API_IP}
Gary Wu9abb61c2018-09-27 10:38:50 -070085echo APEX IP IS ${APEX_IP}
a.sreekumar7d80c382019-05-07 13:36:39 +000086echo DMAAP_IP IS ${DMAAP_IP}
87
a.sreekumar7d80c382019-05-07 13:36:39 +000088ROBOT_VARIABLES="-v APEX_IP:${APEX_IP} -v POLICY_API_IP:${POLICY_API_IP} -v POLICY_PAP_IP:${POLICY_PAP_IP}"