blob: d6726c7a72576ac6a08c1f3eddfdd2490e3f7156 [file] [log] [blame]
Michael Mokry88f4d472019-03-04 12:00:05 -06001#!/bin/bash
2# ============LICENSE_START=======================================================
Bilal A9f54c002020-01-16 16:12:19 +00003# Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
Michael Mokry88f4d472019-03-04 12:00:05 -06004# ================================================================================
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#
17# SPDX-License-Identifier: Apache-2.0
18# ============LICENSE_END=========================================================
19
Bilal Ad46ab2e2019-06-07 21:25:59 +000020source ${SCRIPTS}/policy/config/policy-csit.conf
21export POLICY_MARIADB_VER
22echo ${GERRIT_BRANCH}
23echo ${POLICY_MARIADB_VER}
24
Michael Mokryb4f69622019-05-13 13:09:17 -050025echo "Uninstall docker-py and reinstall docker."
26pip uninstall -y docker-py
27pip uninstall -y docker
28pip install -U docker==2.7.0
29
30# the directory of the script
31DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
32echo ${DIR}
33
34# the temp directory used, within $DIR
35# omit the -p parameter to create a temporal directory in the default location
36WORK_DIR=`mktemp -d -p "$DIR"`
37echo ${WORK_DIR}
38
39cd ${WORK_DIR}
40
41# check if tmp dir was created
42if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then
43 echo "Could not create temp dir"
44 exit 1
45fi
46
Jim Hahn2d949212020-05-11 10:13:32 -040047SCR_DMAAP=${SCRIPTS}/policy/drools-apps
48
Bilal Ad46ab2e2019-06-07 21:25:59 +000049sudo apt-get -y install libxml2-utils
Bilal A9f54c002020-01-16 16:12:19 +000050bash ${SCRIPTS}/policy/policy-models-dmaap-sim.sh
51
Bilal A71e57372019-12-17 02:17:57 +000052POLICY_API_VERSION_EXTRACT="$(curl -q --silent https://git.onap.org/policy/api/plain/pom.xml?h=${GERRIT_BRANCH} | xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -)"
53export POLICY_API_VERSION="${POLICY_API_VERSION_EXTRACT:0:3}-SNAPSHOT-latest"
54POLICY_PAP_VERSION_EXTRACT="$(curl -q --silent https://git.onap.org/policy/pap/plain/pom.xml?h=${GERRIT_BRANCH} | xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -)"
55export POLICY_PAP_VERSION="${POLICY_PAP_VERSION_EXTRACT:0:3}-SNAPSHOT-latest"
56POLICY_XACML_PDP_VERSION_EXTRACT="$(curl -q --silent https://git.onap.org/policy/xacml-pdp/plain/pom.xml?h=${GERRIT_BRANCH} | xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -)"
57export POLICY_XACML_PDP_VERSION="${POLICY_XACML_PDP_VERSION_EXTRACT:0:3}-SNAPSHOT-latest"
Bilal Ad46ab2e2019-06-07 21:25:59 +000058
59echo ${POLICY_API_VERSION}
60echo ${POLICY_PAP_VERSION}
61echo ${POLICY_XACML_PDP_VERSION}
Bilal A9f54c002020-01-16 16:12:19 +000062
Michael Mokryb4f69622019-05-13 13:09:17 -050063# Adding this waiting container due to race condition between pap and mariadb
64docker-compose -f ${WORKSPACE}/scripts/policy/policy-xacml-pdp/docker-compose-pdpx.yml run --rm start_dependencies
Jim Hahn954af932019-06-03 15:00:08 -040065
Jim Hahn954af932019-06-03 15:00:08 -040066# now bring everything else up
67docker-compose -f ${WORKSPACE}/scripts/policy/policy-xacml-pdp/docker-compose-pdpx.yml run --rm start_all
Michael Mokryb4f69622019-05-13 13:09:17 -050068
69unset http_proxy https_proxy
70
71POLICY_API_IP=`get-instance-ip.sh policy-api`
72MARIADB_IP=`get-instance-ip.sh mariadb`
Michael Mokry88f4d472019-03-04 12:00:05 -060073POLICY_PDPX_IP=`get-instance-ip.sh policy-xacml-pdp`
Michael Mokryb4f69622019-05-13 13:09:17 -050074DMAAP_IP=`get-instance-ip.sh dmaap-simulator`
75POLICY_PAP_IP=`get-instance-ip.sh policy-pap`
76
Michael Mokryb4f69622019-05-13 13:09:17 -050077echo PDP IP IS ${POLICY_PDPX_IP}
78echo API IP IS ${POLICY_API_IP}
79echo PAP IP IS ${POLICY_PAP_IP}
80echo MARIADB IP IS ${MARIADB_IP}
81echo DMAAP_IP IS ${DMAAP_IP}
82
Jim Hahn514799f2020-04-20 12:05:50 -040083DATA2=${WORKSPACE}/dmaap-sim/models/models-examples/src/main/resources/policies
84
85ROBOT_VARIABLES=""
Jim Hahn2d949212020-05-11 10:13:32 -040086ROBOT_VARIABLES="${ROBOT_VARIABLES} -v SCR_DMAAP:${SCR_DMAAP}"
Jim Hahn514799f2020-04-20 12:05:50 -040087ROBOT_VARIABLES="${ROBOT_VARIABLES} -v DATA2:${DATA2}"
88ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_PDPX_IP:${POLICY_PDPX_IP}"
89ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_API_IP:${POLICY_API_IP}"
90ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_PAP_IP:${POLICY_PAP_IP}"