blob: 22e813dfc19435594e35370cb2c6a48d2ba340a0 [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=========================================================
Bilal Ad46ab2e2019-06-07 21:25:59 +000022source ${SCRIPTS}/policy/config/policy-csit.conf
23export POLICY_MARIADB_VER
24echo ${GERRIT_BRANCH}
25echo ${POLICY_MARIADB_VER}
Gary Wu9abb61c2018-09-27 10:38:50 -070026
a.sreekumar7d80c382019-05-07 13:36:39 +000027echo "Uninstall docker-py and reinstall docker."
28pip uninstall -y docker-py
29pip uninstall -y docker
30pip install -U docker==2.7.0
Gary Wu9abb61c2018-09-27 10:38:50 -070031
a.sreekumar7d80c382019-05-07 13:36:39 +000032# the directory of the script
33DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
34echo ${DIR}
35
36# the temp directory used, within $DIR
37# omit the -p parameter to create a temporal directory in the default location
38WORK_DIR=`mktemp -d -p "$DIR"`
39echo ${WORK_DIR}
40
41cd ${WORK_DIR}
42
43# check if tmp dir was created
44if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then
45 echo "Could not create temp dir"
46 exit 1
47fi
48
49# bring down maven
50mkdir maven
51cd maven
52curl -O http://apache.claz.org/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
53tar -xzvf apache-maven-3.3.9-bin.tar.gz
54ls -l
55export PATH=${PATH}:${WORK_DIR}/maven/apache-maven-3.3.9/bin
56${WORK_DIR}/maven/apache-maven-3.3.9/bin/mvn -v
57cd ..
58
59git clone http://gerrit.onap.org/r/oparent
Bilal Ad46ab2e2019-06-07 21:25:59 +000060git clone --depth 1 https://gerrit.onap.org/r/policy/models -b ${GERRIT_BRANCH}
a.sreekumar7d80c382019-05-07 13:36:39 +000061cd models/models-sim/models-sim-dmaap
62${WORK_DIR}/maven/apache-maven-3.3.9/bin/mvn clean install -DskipTests --settings ${WORK_DIR}/oparent/settings.xml
63bash ./src/main/package/docker/docker_build.sh
64cd ${WORKSPACE}
65rm -rf ${WORK_DIR}
66sleep 3
67
Bilal Ad46ab2e2019-06-07 21:25:59 +000068sudo apt-get -y install libxml2-utils
69export POLICY_API_VERSION="$(curl -q --silent https://git.onap.org/policy/api/plain/pom.xml?h=${GERRIT_BRANCH} | xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -)"
70export POLICY_PAP_VERSION="$(curl -q --silent https://git.onap.org/policy/pap/plain/pom.xml?h=${GERRIT_BRANCH} | xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -)"
71export POLICY_APEX_PDP_VERSION="$(curl -q --silent https://git.onap.org/policy/apex-pdp/plain/pom.xml?h=${GERRIT_BRANCH} | xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -)"
72
73echo ${POLICY_API_VERSION}
74echo ${POLICY_PAP_VERSION}
75echo ${POLICY_APEX_PDP_VERSION}
76
a.sreekumar7d80c382019-05-07 13:36:39 +000077# Adding this waiting container due to race condition between pap and mariadb
78docker-compose -f ${WORKSPACE}/scripts/policy/policy-apex-pdp/docker-compose-apex.yml run --rm start_dependencies
Jim Hahn954af932019-06-03 15:00:08 -040079
80#Configure the database
81docker exec -it mariadb chmod +x /docker-entrypoint-initdb.d/db.sh
82docker exec -it mariadb /docker-entrypoint-initdb.d/db.sh
83
84# now bring everything else up
85docker-compose -f ${WORKSPACE}/scripts/policy/policy-apex-pdp/docker-compose-apex.yml run --rm start_all
86
87unset http_proxy https_proxy
a.sreekumar7d80c382019-05-07 13:36:39 +000088
89POLICY_API_IP=`get-instance-ip.sh policy-api`
90POLICY_PAP_IP=`get-instance-ip.sh policy-pap`
91MARIADB_IP=`get-instance-ip.sh mariadb`
92APEX_IP=`get-instance-ip.sh policy-apex-pdp`
93DMAAP_IP=`get-instance-ip.sh dmaap-simulator`
94
95echo PAP IP IS ${POLICY_PAP_IP}
96echo MARIADB IP IS ${MARIADB_IP}
97echo API IP IS ${POLICY_API_IP}
Gary Wu9abb61c2018-09-27 10:38:50 -070098echo APEX IP IS ${APEX_IP}
a.sreekumar7d80c382019-05-07 13:36:39 +000099echo DMAAP_IP IS ${DMAAP_IP}
100
a.sreekumar7d80c382019-05-07 13:36:39 +0000101ROBOT_VARIABLES="-v APEX_IP:${APEX_IP} -v POLICY_API_IP:${POLICY_API_IP} -v POLICY_PAP_IP:${POLICY_PAP_IP}"