2 # ============LICENSE_START=======================================================
3 # Copyright (C) 2018 Ericsson. All rights reserved.
5 # Modifications copyright (c) 2019 Nordix Foundation.
6 # Modifications Copyright (C) 2020 AT&T Intellectual Property.
7 # ================================================================================
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
12 # http://www.apache.org/licenses/LICENSE-2.0
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.
20 # SPDX-License-Identifier: Apache-2.0
21 # ============LICENSE_END=========================================================
22 source ${SCRIPTS}/policy/config/policy-csit.conf
23 export POLICY_MARIADB_VER
25 echo ${POLICY_MARIADB_VER}
27 echo "Uninstall docker-py and reinstall docker."
28 pip uninstall -y docker-py
29 pip uninstall -y docker
30 pip install -U docker==2.7.0
32 # the directory of the script
33 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
36 # the temp directory used, within $DIR
37 # omit the -p parameter to create a temporal directory in the default location
38 WORK_DIR=`mktemp -d -p "$DIR"`
43 # check if tmp dir was created
44 if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then
45 echo "Could not create temp dir"
49 sudo apt-get -y install libxml2-utils
50 bash ${SCRIPTS}/policy/policy-models-dmaap-sim.sh
52 POLICY_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()' -)"
53 export POLICY_API_VERSION="${POLICY_API_VERSION_EXTRACT:0:3}-SNAPSHOT-latest"
54 POLICY_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()' -)"
55 export POLICY_PAP_VERSION="${POLICY_PAP_VERSION_EXTRACT:0:3}-SNAPSHOT-latest"
56 POLICY_APEX_PDP_VERSION_EXTRACT="$(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()' -)"
57 export POLICY_APEX_PDP_VERSION="${POLICY_APEX_PDP_VERSION_EXTRACT:0:3}-SNAPSHOT-latest"
59 echo ${POLICY_API_VERSION}
60 echo ${POLICY_PAP_VERSION}
61 echo ${POLICY_APEX_PDP_VERSION}
63 # Adding this waiting container due to race condition between pap and mariadb
64 docker-compose -f ${WORKSPACE}/scripts/policy/policy-apex-pdp/docker-compose-apex.yml run --rm start_dependencies
66 #Configure the database
67 docker exec --tty mariadb chmod +x /docker-entrypoint-initdb.d/db.sh
68 docker exec --tty mariadb /docker-entrypoint-initdb.d/db.sh
70 # now bring everything else up
71 docker-compose -f ${WORKSPACE}/scripts/policy/policy-apex-pdp/docker-compose-apex.yml run --rm start_all
73 unset http_proxy https_proxy
75 POLICY_API_IP=`get-instance-ip.sh policy-api`
76 POLICY_PAP_IP=`get-instance-ip.sh policy-pap`
77 MARIADB_IP=`get-instance-ip.sh mariadb`
78 APEX_IP=`get-instance-ip.sh policy-apex-pdp`
79 DMAAP_IP=`get-instance-ip.sh dmaap-simulator`
81 echo PAP IP IS ${POLICY_PAP_IP}
82 echo MARIADB IP IS ${MARIADB_IP}
83 echo API IP IS ${POLICY_API_IP}
84 echo APEX IP IS ${APEX_IP}
85 echo DMAAP_IP IS ${DMAAP_IP}
87 ROBOT_VARIABLES="-v APEX_IP:${APEX_IP} -v POLICY_API_IP:${POLICY_API_IP} -v POLICY_PAP_IP:${POLICY_PAP_IP}"