Michael Mokry | 88f4d47 | 2019-03-04 12:00:05 -0600 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # ============LICENSE_START======================================================= |
Bilal A | 9f54c00 | 2020-01-16 16:12:19 +0000 | [diff] [blame] | 3 | # Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. |
Michael Mokry | 88f4d47 | 2019-03-04 12:00:05 -0600 | [diff] [blame] | 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 | # |
| 17 | # SPDX-License-Identifier: Apache-2.0 |
| 18 | # ============LICENSE_END========================================================= |
| 19 | |
Bilal A | d46ab2e | 2019-06-07 21:25:59 +0000 | [diff] [blame] | 20 | source ${SCRIPTS}/policy/config/policy-csit.conf |
| 21 | export POLICY_MARIADB_VER |
| 22 | echo ${GERRIT_BRANCH} |
| 23 | echo ${POLICY_MARIADB_VER} |
| 24 | |
Michael Mokry | b4f6962 | 2019-05-13 13:09:17 -0500 | [diff] [blame] | 25 | echo "Uninstall docker-py and reinstall docker." |
| 26 | pip uninstall -y docker-py |
| 27 | pip uninstall -y docker |
| 28 | pip install -U docker==2.7.0 |
| 29 | |
| 30 | # the directory of the script |
| 31 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
| 32 | echo ${DIR} |
| 33 | |
| 34 | # the temp directory used, within $DIR |
| 35 | # omit the -p parameter to create a temporal directory in the default location |
| 36 | WORK_DIR=`mktemp -d -p "$DIR"` |
| 37 | echo ${WORK_DIR} |
| 38 | |
| 39 | cd ${WORK_DIR} |
| 40 | |
| 41 | # check if tmp dir was created |
| 42 | if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then |
| 43 | echo "Could not create temp dir" |
| 44 | exit 1 |
| 45 | fi |
| 46 | |
Bilal A | d46ab2e | 2019-06-07 21:25:59 +0000 | [diff] [blame] | 47 | sudo apt-get -y install libxml2-utils |
Bilal A | 9f54c00 | 2020-01-16 16:12:19 +0000 | [diff] [blame] | 48 | bash ${SCRIPTS}/policy/policy-models-dmaap-sim.sh |
| 49 | |
Bilal A | 71e5737 | 2019-12-17 02:17:57 +0000 | [diff] [blame] | 50 | 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()' -)" |
| 51 | export POLICY_API_VERSION="${POLICY_API_VERSION_EXTRACT:0:3}-SNAPSHOT-latest" |
| 52 | 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()' -)" |
| 53 | export POLICY_PAP_VERSION="${POLICY_PAP_VERSION_EXTRACT:0:3}-SNAPSHOT-latest" |
| 54 | POLICY_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()' -)" |
| 55 | export POLICY_XACML_PDP_VERSION="${POLICY_XACML_PDP_VERSION_EXTRACT:0:3}-SNAPSHOT-latest" |
Bilal A | d46ab2e | 2019-06-07 21:25:59 +0000 | [diff] [blame] | 56 | |
| 57 | echo ${POLICY_API_VERSION} |
| 58 | echo ${POLICY_PAP_VERSION} |
| 59 | echo ${POLICY_XACML_PDP_VERSION} |
Bilal A | 9f54c00 | 2020-01-16 16:12:19 +0000 | [diff] [blame] | 60 | |
Michael Mokry | b4f6962 | 2019-05-13 13:09:17 -0500 | [diff] [blame] | 61 | # Adding this waiting container due to race condition between pap and mariadb |
| 62 | docker-compose -f ${WORKSPACE}/scripts/policy/policy-xacml-pdp/docker-compose-pdpx.yml run --rm start_dependencies |
Jim Hahn | 954af93 | 2019-06-03 15:00:08 -0400 | [diff] [blame] | 63 | |
Jim Hahn | 954af93 | 2019-06-03 15:00:08 -0400 | [diff] [blame] | 64 | # now bring everything else up |
| 65 | docker-compose -f ${WORKSPACE}/scripts/policy/policy-xacml-pdp/docker-compose-pdpx.yml run --rm start_all |
Michael Mokry | b4f6962 | 2019-05-13 13:09:17 -0500 | [diff] [blame] | 66 | |
| 67 | unset http_proxy https_proxy |
| 68 | |
| 69 | POLICY_API_IP=`get-instance-ip.sh policy-api` |
| 70 | MARIADB_IP=`get-instance-ip.sh mariadb` |
Michael Mokry | 88f4d47 | 2019-03-04 12:00:05 -0600 | [diff] [blame] | 71 | POLICY_PDPX_IP=`get-instance-ip.sh policy-xacml-pdp` |
Michael Mokry | b4f6962 | 2019-05-13 13:09:17 -0500 | [diff] [blame] | 72 | DMAAP_IP=`get-instance-ip.sh dmaap-simulator` |
| 73 | POLICY_PAP_IP=`get-instance-ip.sh policy-pap` |
| 74 | |
Michael Mokry | b4f6962 | 2019-05-13 13:09:17 -0500 | [diff] [blame] | 75 | echo PDP IP IS ${POLICY_PDPX_IP} |
| 76 | echo API IP IS ${POLICY_API_IP} |
| 77 | echo PAP IP IS ${POLICY_PAP_IP} |
| 78 | echo MARIADB IP IS ${MARIADB_IP} |
| 79 | echo DMAAP_IP IS ${DMAAP_IP} |
| 80 | |
Jim Hahn | 514799f | 2020-04-20 12:05:50 -0400 | [diff] [blame^] | 81 | DATA2=${WORKSPACE}/dmaap-sim/models/models-examples/src/main/resources/policies |
| 82 | |
| 83 | ROBOT_VARIABLES="" |
| 84 | ROBOT_VARIABLES="${ROBOT_VARIABLES} -v DATA2:${DATA2}" |
| 85 | ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_PDPX_IP:${POLICY_PDPX_IP}" |
| 86 | ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_API_IP:${POLICY_API_IP}" |
| 87 | ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_PAP_IP:${POLICY_PAP_IP}" |