aboutsummaryrefslogtreecommitdiffstats
path: root/plans/policy
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-09-17 17:03:34 -0400
committera.sreekumar <ajith.sreekumar@bell.ca>2020-10-07 14:04:45 +0100
commit00532428c0b83065a8ae87eaa2de579c3918d984 (patch)
tree3f64002563d9338b3f8221ed6a09d532a0be9a1f /plans/policy
parente8725131014daf39725e37d518c5b9766d86ee46 (diff)
Make stand-alone Policy environment
This is a first cut at making it possible to easily run Policy components within a stand-alone environment. Made the following changes: - enhanced wait_for_port.sh to accept a list of hosts/ports - enhanced wait_for_port.sh to accept an optional command to execute when the wait completes - consolidated all of the yml files into a single file - removed "extra" services from the yml so that a component and its dependents can be brought up in a single invocation - modified the component setup.sh With these changes, a developer can clone the csit repo, run detmVers.sh to set the docker image version env variables, and then bring up a component (and its dependents) using: docker-compose -f scripts/policy/docker-compose-all.yml up --detach <component> Note: this does not preload or deploy any policies; that must be done manually via curl. Modified to use new simulator docker image. Also fixed drools-apps CSIT broken due to disabling frankfurt controller. Also removed operational.Apex policy. The csar file used in policy-distribution test is also updated to reflect this change. Issue-ID: POLICY-2742 Change-Id: I412dbd5db9219ad2cdece9693f0b4b9fe7b2eb69 Signed-off-by: Jim Hahn <jrh3@att.com> Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
Diffstat (limited to 'plans/policy')
-rw-r--r--plans/policy/apex-pdp/setup.sh52
-rw-r--r--plans/policy/apex-pdp/teardown.sh7
-rw-r--r--plans/policy/api/setup.sh24
-rwxr-xr-xplans/policy/api/teardown.sh5
-rw-r--r--plans/policy/distribution/setup.sh59
-rw-r--r--plans/policy/distribution/teardown.sh8
-rwxr-xr-xplans/policy/drools-applications/setup.sh38
-rwxr-xr-xplans/policy/drools-applications/teardown.sh4
-rwxr-xr-xplans/policy/drools-pdp/setup.sh25
-rwxr-xr-xplans/policy/drools-pdp/teardown.sh4
-rw-r--r--plans/policy/pap/setup.sh32
-rw-r--r--plans/policy/pap/teardown.sh6
-rw-r--r--plans/policy/xacml-pdp/setup.sh45
-rw-r--r--plans/policy/xacml-pdp/teardown.sh8
14 files changed, 76 insertions, 241 deletions
diff --git a/plans/policy/apex-pdp/setup.sh b/plans/policy/apex-pdp/setup.sh
index d3c1d629..02238e90 100644
--- a/plans/policy/apex-pdp/setup.sh
+++ b/plans/policy/apex-pdp/setup.sh
@@ -20,55 +20,17 @@
# SPDX-License-Identifier: Apache-2.0
# ============LICENSE_END=========================================================
source ${SCRIPTS}/policy/config/policy-csit.conf
-export POLICY_MARIADB_VER
-echo ${GERRIT_BRANCH}
-echo ${POLICY_MARIADB_VER}
echo "Uninstall docker-py and reinstall docker."
pip uninstall -y docker-py
pip uninstall -y docker
pip install -U docker==2.7.0
-# the directory of the script
-DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-echo ${DIR}
-
-# the temp directory used, within $DIR
-# omit the -p parameter to create a temporal directory in the default location
-WORK_DIR=`mktemp -d -p "$DIR"`
-echo ${WORK_DIR}
-
-cd ${WORK_DIR}
-
-# check if tmp dir was created
-if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then
- echo "Could not create temp dir"
- exit 1
-fi
-
sudo apt-get -y install libxml2-utils
-bash ${SCRIPTS}/policy/policy-models-dmaap-sim.sh
-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()' -)"
-export POLICY_API_VERSION="${POLICY_API_VERSION_EXTRACT:0:3}-SNAPSHOT-latest"
-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()' -)"
-export POLICY_PAP_VERSION="${POLICY_PAP_VERSION_EXTRACT:0:3}-SNAPSHOT-latest"
-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()' -)"
-export POLICY_APEX_PDP_VERSION="${POLICY_APEX_PDP_VERSION_EXTRACT:0:3}-SNAPSHOT-latest"
+source ${SCRIPTS}/policy/detmVers.sh
-echo ${POLICY_API_VERSION}
-echo ${POLICY_PAP_VERSION}
-echo ${POLICY_APEX_PDP_VERSION}
-
-# Adding this waiting container due to race condition between pap and mariadb
-docker-compose -f ${WORKSPACE}/scripts/policy/policy-apex-pdp/docker-compose-apex.yml run --rm start_dependencies
-
-#Configure the database
-docker exec --tty mariadb chmod +x /docker-entrypoint-initdb.d/db.sh
-docker exec --tty mariadb /docker-entrypoint-initdb.d/db.sh
-
-# now bring everything else up
-docker-compose -f ${WORKSPACE}/scripts/policy/policy-apex-pdp/docker-compose-apex.yml run --rm start_all
+docker-compose -f ${SCRIPTS}/policy/docker-compose-all.yml up -d apex-pdp
unset http_proxy https_proxy
@@ -76,7 +38,7 @@ POLICY_API_IP=`get-instance-ip.sh policy-api`
POLICY_PAP_IP=`get-instance-ip.sh policy-pap`
MARIADB_IP=`get-instance-ip.sh mariadb`
APEX_IP=`get-instance-ip.sh policy-apex-pdp`
-DMAAP_IP=`get-instance-ip.sh dmaap-simulator`
+DMAAP_IP=`get-instance-ip.sh policy.api.simpledemo.onap.org`
echo PAP IP IS ${POLICY_PAP_IP}
echo MARIADB IP IS ${MARIADB_IP}
@@ -84,4 +46,10 @@ echo API IP IS ${POLICY_API_IP}
echo APEX IP IS ${APEX_IP}
echo DMAAP_IP IS ${DMAAP_IP}
-ROBOT_VARIABLES="-v APEX_IP:${APEX_IP} -v POLICY_API_IP:${POLICY_API_IP} -v POLICY_PAP_IP:${POLICY_PAP_IP}"
+# wait for the app to start up
+${SCRIPTS}/policy/wait_for_port.sh ${APEX_IP} 6969
+
+ROBOT_VARIABLES=""
+ROBOT_VARIABLES="${ROBOT_VARIABLES} -v APEX_IP:${APEX_IP}"
+ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_API_IP:${POLICY_API_IP}"
+ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_PAP_IP:${POLICY_PAP_IP}"
diff --git a/plans/policy/apex-pdp/teardown.sh b/plans/policy/apex-pdp/teardown.sh
index 6c02aea1..86416e6e 100644
--- a/plans/policy/apex-pdp/teardown.sh
+++ b/plans/policy/apex-pdp/teardown.sh
@@ -3,6 +3,7 @@
# Copyright (C) 2018 Ericsson. All rights reserved.
#
# Modifications copyright (c) 2019 Nordix Foundation.
+# Modifications Copyright (C) 2020 AT&T Intellectual Property.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -19,8 +20,4 @@
# SPDX-License-Identifier: Apache-2.0
# ============LICENSE_END=========================================================
-kill-instance.sh policy-apex-pdp
-kill-instance.sh policy-pap
-kill-instance.sh policy-api
-kill-instance.sh mariadb
-kill-instance.sh dmaap-simulator
+docker-compose -f ${WORKSPACE}/scripts/policy/docker-compose-all.yml down -v
diff --git a/plans/policy/api/setup.sh b/plans/policy/api/setup.sh
index b75b492a..550337e9 100644
--- a/plans/policy/api/setup.sh
+++ b/plans/policy/api/setup.sh
@@ -19,9 +19,6 @@
# Select branch
source ${SCRIPTS}/policy/config/policy-csit.conf
-export POLICY_MARIADB_VER
-echo ${GERRIT_BRANCH}
-echo ${POLICY_MARIADB_VER}
echo "Uninstall docker-py and reinstall docker."
pip uninstall -y docker-py
@@ -30,14 +27,9 @@ pip install -U docker==2.7.0
sudo apt-get -y install libxml2-utils
-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()' -)"
-export POLICY_API_VERSION="${POLICY_API_VERSION_EXTRACT:0:3}-SNAPSHOT-latest"
+bash ${SCRIPTS}/policy/get-models-examples.sh
-# download models - it contains the policy definitions
-rm -rf ${WORKSPACE}/models
-cd ${WORKSPACE}
-
-git clone --depth 1 https://gerrit.onap.org/r/policy/models -b ${GERRIT_BRANCH}
+source ${SCRIPTS}/policy/detmVers.sh
DATA=${WORKSPACE}/models/models-examples/src/main/resources/policies
@@ -53,15 +45,8 @@ sed -e 's!"version": "1.0.0"!"version": "2.0.0"!' \
echo ${POLICY_API_VERSION}
-# Adding this waiting container to avoid race condition between api and mariadb containers.
-docker-compose -f ${WORKSPACE}/scripts/policy/docker-compose-api.yml run --rm start_dependencies
-
-#Configure the database
-docker exec --tty mariadb chmod +x /docker-entrypoint-initdb.d/db.sh
-docker exec --tty mariadb /docker-entrypoint-initdb.d/db.sh
+docker-compose -f ${SCRIPTS}/policy/docker-compose-all.yml up -d api
-# now bring everything else up
-docker-compose -f ${WORKSPACE}/scripts/policy/docker-compose-api.yml run --rm start_all
unset http_proxy https_proxy
@@ -71,6 +56,9 @@ MARIADB_IP=`get-instance-ip.sh mariadb`
echo API IP IS ${POLICY_API_IP}
echo MARIADB IP IS ${MARIADB_IP}
+# wait for the app to start up
+${SCRIPTS}/policy/wait_for_port.sh ${POLICY_API_IP} 6969
+
ROBOT_VARIABLES=""
ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_API_IP:${POLICY_API_IP}"
ROBOT_VARIABLES="${ROBOT_VARIABLES} -v DATA:${DATA}"
diff --git a/plans/policy/api/teardown.sh b/plans/policy/api/teardown.sh
index 0572e034..6942e353 100755
--- a/plans/policy/api/teardown.sh
+++ b/plans/policy/api/teardown.sh
@@ -1,6 +1,6 @@
#!/bin/bash
# ============LICENSE_START=======================================================
-# Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+# Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -17,5 +17,4 @@
# SPDX-License-Identifier: Apache-2.0
# ============LICENSE_END=========================================================
-kill-instance.sh policy-api
-kill-instance.sh mariadb
+docker-compose -f ${WORKSPACE}/scripts/policy/docker-compose-all.yml down -v
diff --git a/plans/policy/distribution/setup.sh b/plans/policy/distribution/setup.sh
index 52573b58..73226140 100644
--- a/plans/policy/distribution/setup.sh
+++ b/plans/policy/distribution/setup.sh
@@ -20,63 +20,26 @@
# SPDX-License-Identifier: Apache-2.0
# ============LICENSE_END=========================================================
source ${SCRIPTS}/policy/config/policy-csit.conf
-export POLICY_MARIADB_VER
-echo ${GERRIT_BRANCH}
-echo ${POLICY_MARIADB_VER}
echo "Uninstall docker-py and reinstall docker."
pip uninstall -y docker-py
pip uninstall -y docker
pip install -U docker==2.7.0
-# the directory of the script
-DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-echo ${DIR}
-
-# the temp directory used, within $DIR
-# omit the -p parameter to create a temporal directory in the default location
-WORK_DIR=`mktemp -d -p "$DIR"`
-echo ${WORK_DIR}
-
-cd ${WORK_DIR}
-
-# check if tmp dir was created
-if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then
- echo "Could not create temp dir"
- exit 1
-fi
-
sudo apt-get -y install libxml2-utils
-bash ${SCRIPTS}/policy/policy-models-dmaap-sim.sh
-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()' -)"
-export POLICY_API_VERSION="${POLICY_API_VERSION_EXTRACT:0:3}-SNAPSHOT-latest"
-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()' -)"
-export POLICY_PAP_VERSION="${POLICY_PAP_VERSION_EXTRACT:0:3}-SNAPSHOT-latest"
-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()' -)"
-export POLICY_APEX_PDP_VERSION="${POLICY_APEX_PDP_VERSION_EXTRACT:0:3}-SNAPSHOT-latest"
-POLICY_DISTRIBUTION_VERSION_EXTRACT="$(curl -q --silent https://git.onap.org/policy/distribution/plain/pom.xml?h=${GERRIT_BRANCH} | xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -)"
-export POLICY_DISTRIBUTION_VERSION="${POLICY_DISTRIBUTION_VERSION_EXTRACT:0:3}-SNAPSHOT-latest"
+source ${SCRIPTS}/policy/detmVers.sh
-echo ${POLICY_API_VERSION}
-echo ${POLICY_PAP_VERSION}
-echo ${POLICY_APEX_PDP_VERSION}
-echo ${POLICY_DISTRIBUTION_VERSION}
-
-SCRIPT_DIR=${WORKSPACE}/scripts/policy/policy-distribution
+SCRIPT_DIR=${SCRIPTS}/policy/policy-distribution
# Remaking the csar file in case if the file got corrupted
zip -F ${SCRIPT_DIR}/config/distribution/csar/sample_csar_with_apex_policy.csar --out ${SCRIPT_DIR}/config/distribution/csar/csar_temp.csar
-# Adding this waiting container due to race condition between pap and mariadb
-docker-compose -f ${SCRIPT_DIR}/docker-compose-distribution.yml run --rm start_dependencies
-
-#Configure the database
-docker exec --tty mariadb chmod +x /docker-entrypoint-initdb.d/db.sh
-docker exec --tty mariadb /docker-entrypoint-initdb.d/db.sh
+# Remake temp directory
+rm -rf ${SCRIPT_DIR}/config/distribution/temp
+mkdir ${SCRIPT_DIR}/config/distribution/temp
-# now bring everything else up
-docker-compose -f ${SCRIPT_DIR}/docker-compose-distribution.yml run --rm start_all
+docker-compose -f ${SCRIPTS}/policy/docker-compose-all.yml up -d distribution
unset http_proxy https_proxy
@@ -84,7 +47,7 @@ POLICY_API_IP=`get-instance-ip.sh policy-api`
POLICY_PAP_IP=`get-instance-ip.sh policy-pap`
MARIADB_IP=`get-instance-ip.sh mariadb`
APEX_IP=`get-instance-ip.sh policy-apex-pdp`
-DMAAP_IP=`get-instance-ip.sh dmaap-simulator`
+DMAAP_IP=`get-instance-ip.sh policy.api.simpledemo.onap.org`
POLICY_DISTRIBUTION_IP=`get-instance-ip.sh policy-distribution`
echo PAP IP IS ${POLICY_PAP_IP}
@@ -94,4 +57,10 @@ echo APEX IP IS ${APEX_IP}
echo DMAAP_IP IS ${DMAAP_IP}
echo POLICY_DISTRIBUTION_IP IS ${POLICY_DISTRIBUTION_IP}
-ROBOT_VARIABLES="-v APEX_IP:${APEX_IP} -v SCRIPT_DIR:${SCRIPT_DIR} -v POLICY_DISTRIBUTION_IP:${POLICY_DISTRIBUTION_IP}"
+# wait for the app to start up
+${SCRIPTS}/policy/wait_for_port.sh ${POLICY_DISTRIBUTION_IP} 6969
+
+ROBOT_VARIABLES=""
+ROBOT_VARIABLES="${ROBOT_VARIABLES} -v APEX_IP:${APEX_IP}"
+ROBOT_VARIABLES="${ROBOT_VARIABLES} -v SCRIPT_DIR:${SCRIPT_DIR}"
+ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_DISTRIBUTION_IP:${POLICY_DISTRIBUTION_IP}"
diff --git a/plans/policy/distribution/teardown.sh b/plans/policy/distribution/teardown.sh
index fbbf1de5..86416e6e 100644
--- a/plans/policy/distribution/teardown.sh
+++ b/plans/policy/distribution/teardown.sh
@@ -3,6 +3,7 @@
# Copyright (C) 2018 Ericsson. All rights reserved.
#
# Modifications copyright (c) 2019 Nordix Foundation.
+# Modifications Copyright (C) 2020 AT&T Intellectual Property.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -19,9 +20,4 @@
# SPDX-License-Identifier: Apache-2.0
# ============LICENSE_END=========================================================
-kill-instance.sh policy-apex-pdp
-kill-instance.sh policy-pap
-kill-instance.sh policy-api
-kill-instance.sh mariadb
-kill-instance.sh dmaap-simulator
-kill-instance.sh policy-distribution
+docker-compose -f ${WORKSPACE}/scripts/policy/docker-compose-all.yml down -v
diff --git a/plans/policy/drools-applications/setup.sh b/plans/policy/drools-applications/setup.sh
index 1a1dc331..c4cbfa60 100755
--- a/plans/policy/drools-applications/setup.sh
+++ b/plans/policy/drools-applications/setup.sh
@@ -20,9 +20,6 @@
# OS upgrades
source ${SCRIPTS}/policy/config/policy-csit.conf
-export POLICY_MARIADB_VER
-echo ${GERRIT_BRANCH}
-echo ${POLICY_MARIADB_VER}
SCR2=${WORKSPACE}/scripts/policy/drools-apps
@@ -32,37 +29,15 @@ pip uninstall -y docker
pip install -U docker==2.7.0
sudo apt-get -y install libxml2-utils
-${SCRIPTS}/policy/policy-models-simulators.sh
+bash ${SCRIPTS}/policy/get-models-examples.sh
-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()' -)"
-export POLICY_API_VERSION="${POLICY_API_VERSION_EXTRACT:0:3}-SNAPSHOT-latest"
-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()' -)"
-export POLICY_PAP_VERSION="${POLICY_PAP_VERSION_EXTRACT:0:3}-SNAPSHOT-latest"
-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()' -)"
-export POLICY_XACML_PDP_VERSION="${POLICY_XACML_PDP_VERSION_EXTRACT:0:3}-SNAPSHOT-latest"
-POLICY_DROOLS_APPS_VERSION_EXTRACT="$(curl -q --silent https://git.onap.org/policy/drools-applications/plain/pom.xml?h=${GERRIT_BRANCH} | xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -)"
-echo ${POLICY_DROOLS_APPS_VERSION_EXTRACT}
-export POLICY_DROOLS_APPS_VERSION="${POLICY_DROOLS_APPS_VERSION_EXTRACT:0:3}-SNAPSHOT-latest"
+source ${SCRIPTS}/policy/detmVers.sh
-echo ${POLICY_XACML_PDP_VERSION}
-echo ${POLICY_DROOLS_APPS_VERSION}
-
-echo "user information: $(id)"
-echo "docker and docker-compose versions:"
-docker -v && docker-compose -v
-
-# Adding this waiting container due to race condition between drools and mariadb
-docker-compose -f ${SCR2}/docker-compose-drools-apps.yml run --rm start_dependencies
-
-# Adding this waiting container due to race condition between pap and xacml
-docker-compose -f ${SCR2}/docker-compose-drools-apps.yml run --rm start_pap
-
-# now bring everything else up
-docker-compose -f ${SCR2}/docker-compose-drools-apps.yml run --rm start_all
+docker-compose -f ${SCRIPTS}/policy/docker-compose-all.yml up -d drools-apps
unset http_proxy https_proxy
-DROOLS_IP=`get-instance-ip.sh drools`
+DROOLS_IP=`get-instance-ip.sh drools-apps`
API_IP=`get-instance-ip.sh policy-api`
PAP_IP=`get-instance-ip.sh policy-pap`
XACML_IP=`get-instance-ip.sh policy-xacml-pdp`
@@ -75,10 +50,13 @@ echo PAP IP IS ${PAP_IP}
echo XACML IP IS ${XACML_IP}
echo SIMULATORS IP IS ${SIM_IP}
+# wait for the app to start up
+${SCRIPTS}/policy/wait_for_port.sh ${DROOLS_IP} 6969
+
# give enough time for the controllers to come up
sleep 15
-DATA=${WORKSPACE}/simulators/models/models-examples/src/main/resources/policies
+DATA=${WORKSPACE}/models/models-examples/src/main/resources/policies
ROBOT_VARIABLES=""
ROBOT_VARIABLES="${ROBOT_VARIABLES} -v SCR2:${SCR2}"
diff --git a/plans/policy/drools-applications/teardown.sh b/plans/policy/drools-applications/teardown.sh
index 8b577d8e..67de4a1a 100755
--- a/plans/policy/drools-applications/teardown.sh
+++ b/plans/policy/drools-applications/teardown.sh
@@ -18,6 +18,6 @@
#
mkdir -p $WORKSPACE/archives/
-docker-compose -f ${WORKSPACE}/scripts/policy/drools-apps/docker-compose-drools-apps.yml logs > $WORKSPACE/archives/docker-compose-drools-apps.log
+docker-compose -f ${WORKSPACE}/scripts/policy/docker-compose-all.yml logs > $WORKSPACE/archives/docker-compose-drools-apps.log
-docker-compose -f ${WORKSPACE}/scripts/policy/drools-apps/docker-compose-drools-apps.yml down -v
+docker-compose -f ${WORKSPACE}/scripts/policy/docker-compose-all.yml down -v
diff --git a/plans/policy/drools-pdp/setup.sh b/plans/policy/drools-pdp/setup.sh
index d50106ff..6b951356 100755
--- a/plans/policy/drools-pdp/setup.sh
+++ b/plans/policy/drools-pdp/setup.sh
@@ -24,26 +24,15 @@ pip uninstall -y docker-py
pip uninstall -y docker
pip install -U docker==2.7.0
-echo "user information: $(id)"
-echo "docker information:"
-docker -v && docker-compose -v && docker info
-
# Component Versions
source ${SCRIPTS}/policy/config/policy-csit.conf
-export POLICY_MARIADB_VER
-echo ${GERRIT_BRANCH}
-echo ${POLICY_MARIADB_VER}
sudo apt-get -y install libxml2-utils
-POLICY_DROOLS_VERSION_EXTRACT="$(curl -q --silent https://git.onap.org/policy/drools-applications/plain/pom.xml?h=${GERRIT_BRANCH} | xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -)"
-export POLICY_DROOLS_VERSION="${POLICY_DROOLS_VERSION_EXTRACT:0:3}-SNAPSHOT-latest"
-echo ${POLICY_DROOLS_VERSION}
-docker-compose -f ${WORKSPACE}/scripts/policy/docker-compose-drools.yml up -d
-sleep 2m
+source ${SCRIPTS}/policy/detmVers.sh
-docker container ls -a
+docker-compose -f ${SCRIPTS}/policy/docker-compose-all.yml up -d drools
POLICY_DROOLS_IP=`get-instance-ip.sh drools`
MARIADB_IP=`get-instance-ip.sh mariadb`
@@ -51,10 +40,10 @@ MARIADB_IP=`get-instance-ip.sh mariadb`
echo DROOLS IP IS ${POLICY_DROOLS_IP}
echo MARIADB IP IS ${MARIADB_IP}
-for i in {1..10}; do
- curl -sS ${POLICY_DROOLS_IP}:9696 && break
- echo sleep $i
- sleep $i
-done
+# wait for the app to start up - looking for telemtry service on port 9696
+${SCRIPTS}/policy/wait_for_port.sh ${POLICY_DROOLS_IP} 9696
+
+# give enough time for the controllers to come up
+sleep 15
ROBOT_VARIABLES="-v POLICY_DROOLS_IP:${POLICY_DROOLS_IP}"
diff --git a/plans/policy/drools-pdp/teardown.sh b/plans/policy/drools-pdp/teardown.sh
index e08593d2..5a3f16e5 100755
--- a/plans/policy/drools-pdp/teardown.sh
+++ b/plans/policy/drools-pdp/teardown.sh
@@ -16,5 +16,5 @@
#
mkdir -p $WORKSPACE/archives/
-docker-compose -f ${WORKSPACE}/scripts/policy/docker-compose-drools.yml logs > $WORKSPACE/archives/docker-compose-drools.log
-docker-compose -f ${WORKSPACE}/scripts/policy/docker-compose-drools.yml down -v
+docker-compose -f ${WORKSPACE}/scripts/policy/docker-compose-all.yml logs > $WORKSPACE/archives/docker-compose-drools.log
+docker-compose -f ${WORKSPACE}/scripts/policy/docker-compose-all.yml down -v
diff --git a/plans/policy/pap/setup.sh b/plans/policy/pap/setup.sh
index a89a6daf..a1d153f8 100644
--- a/plans/policy/pap/setup.sh
+++ b/plans/policy/pap/setup.sh
@@ -19,40 +19,21 @@
# ============LICENSE_END=========================================================
source ${SCRIPTS}/policy/config/policy-csit.conf
-export POLICY_MARIADB_VER
-echo ${GERRIT_BRANCH}
-echo ${POLICY_MARIADB_VER}
echo "Uninstall docker-py and reinstall docker."
pip uninstall -y docker-py
pip uninstall -y docker
pip install -U docker==2.7.0
-
sudo apt-get -y install libxml2-utils
-bash ${SCRIPTS}/policy/policy-models-dmaap-sim.sh
-
-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()' -)"
-export POLICY_API_VERSION="${POLICY_API_VERSION_EXTRACT:0:3}-SNAPSHOT-latest"
-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()' -)"
-export POLICY_PAP_VERSION="${POLICY_PAP_VERSION_EXTRACT:0:3}-SNAPSHOT-latest"
-
-echo ${POLICY_API_VERSION}
-echo ${POLICY_PAP_VERSION}
-
-# Adding this waiting container due to race condition between pap and mariadb
-docker-compose -f ${WORKSPACE}/scripts/policy/docker-compose-pap.yml run --rm start_dependencies
+bash ${SCRIPTS}/policy/get-models-examples.sh
-#Configure the database
-docker exec --tty mariadb chmod +x /docker-entrypoint-initdb.d/db.sh
-docker exec --tty mariadb /docker-entrypoint-initdb.d/db.sh
+source ${SCRIPTS}/policy/detmVers.sh
-# now bring everything else up
-docker-compose -f ${WORKSPACE}/scripts/policy/docker-compose-pap.yml run --rm start_all
+docker-compose -f ${SCRIPTS}/policy/docker-compose-all.yml up -d pap
unset http_proxy https_proxy
-
POLICY_PAP_IP=`get-instance-ip.sh policy-pap`
POLICY_API_IP=`get-instance-ip.sh policy-api`
MARIADB_IP=`get-instance-ip.sh mariadb`
@@ -61,7 +42,12 @@ echo PAP IP IS ${POLICY_PAP_IP}
echo API IP IS ${POLICY_API_IP}
echo MARIADB IP IS ${MARIADB_IP}
-DATA=${WORKSPACE}/dmaap-sim/models/models-examples/src/main/resources/policies
+
+# wait for the app to start up
+${SCRIPTS}/policy/wait_for_port.sh ${POLICY_PAP_IP} 6969
+
+
+DATA=${WORKSPACE}/models/models-examples/src/main/resources/policies
ROBOT_VARIABLES=""
ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_PAP_IP:${POLICY_PAP_IP}"
diff --git a/plans/policy/pap/teardown.sh b/plans/policy/pap/teardown.sh
index c2d7e214..cfed2097 100644
--- a/plans/policy/pap/teardown.sh
+++ b/plans/policy/pap/teardown.sh
@@ -1,7 +1,7 @@
#!/bin/bash
# ============LICENSE_START=======================================================
# Copyright (C) 2019 Nordix Foundation.
-# Modifications Copyright (C) 2019 AT&T Intellectual Property.
+# Modifications Copyright (C) 2019-2020 AT&T Intellectual Property.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -18,6 +18,4 @@
# SPDX-License-Identifier: Apache-2.0
# ============LICENSE_END=========================================================
-kill-instance.sh policy-pap
-kill-instance.sh policy-api
-kill-instance.sh mariadb
+docker-compose -f ${WORKSPACE}/scripts/policy/docker-compose-all.yml down -v
diff --git a/plans/policy/xacml-pdp/setup.sh b/plans/policy/xacml-pdp/setup.sh
index d6726c7a..7f557d13 100644
--- a/plans/policy/xacml-pdp/setup.sh
+++ b/plans/policy/xacml-pdp/setup.sh
@@ -18,60 +18,28 @@
# ============LICENSE_END=========================================================
source ${SCRIPTS}/policy/config/policy-csit.conf
-export POLICY_MARIADB_VER
-echo ${GERRIT_BRANCH}
-echo ${POLICY_MARIADB_VER}
echo "Uninstall docker-py and reinstall docker."
pip uninstall -y docker-py
pip uninstall -y docker
pip install -U docker==2.7.0
-# the directory of the script
-DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-echo ${DIR}
-
-# the temp directory used, within $DIR
-# omit the -p parameter to create a temporal directory in the default location
-WORK_DIR=`mktemp -d -p "$DIR"`
-echo ${WORK_DIR}
-
-cd ${WORK_DIR}
-
-# check if tmp dir was created
-if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then
- echo "Could not create temp dir"
- exit 1
-fi
-
SCR_DMAAP=${SCRIPTS}/policy/drools-apps
sudo apt-get -y install libxml2-utils
-bash ${SCRIPTS}/policy/policy-models-dmaap-sim.sh
-
-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()' -)"
-export POLICY_API_VERSION="${POLICY_API_VERSION_EXTRACT:0:3}-SNAPSHOT-latest"
-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()' -)"
-export POLICY_PAP_VERSION="${POLICY_PAP_VERSION_EXTRACT:0:3}-SNAPSHOT-latest"
-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()' -)"
-export POLICY_XACML_PDP_VERSION="${POLICY_XACML_PDP_VERSION_EXTRACT:0:3}-SNAPSHOT-latest"
+bash ${SCRIPTS}/policy/get-models-examples.sh
-echo ${POLICY_API_VERSION}
-echo ${POLICY_PAP_VERSION}
-echo ${POLICY_XACML_PDP_VERSION}
+source ${SCRIPTS}/policy/detmVers.sh
-# Adding this waiting container due to race condition between pap and mariadb
-docker-compose -f ${WORKSPACE}/scripts/policy/policy-xacml-pdp/docker-compose-pdpx.yml run --rm start_dependencies
+docker-compose -f ${SCRIPTS}/policy/docker-compose-all.yml up -d xacml-pdp
-# now bring everything else up
-docker-compose -f ${WORKSPACE}/scripts/policy/policy-xacml-pdp/docker-compose-pdpx.yml run --rm start_all
unset http_proxy https_proxy
POLICY_API_IP=`get-instance-ip.sh policy-api`
MARIADB_IP=`get-instance-ip.sh mariadb`
POLICY_PDPX_IP=`get-instance-ip.sh policy-xacml-pdp`
-DMAAP_IP=`get-instance-ip.sh dmaap-simulator`
+DMAAP_IP=`get-instance-ip.sh policy.api.simpledemo.onap.org`
POLICY_PAP_IP=`get-instance-ip.sh policy-pap`
echo PDP IP IS ${POLICY_PDPX_IP}
@@ -80,7 +48,10 @@ echo PAP IP IS ${POLICY_PAP_IP}
echo MARIADB IP IS ${MARIADB_IP}
echo DMAAP_IP IS ${DMAAP_IP}
-DATA2=${WORKSPACE}/dmaap-sim/models/models-examples/src/main/resources/policies
+# wait for the app to start up
+${SCRIPTS}/policy/wait_for_port.sh ${POLICY_PDPX_IP} 6969
+
+DATA2=${WORKSPACE}/models/models-examples/src/main/resources/policies
ROBOT_VARIABLES=""
ROBOT_VARIABLES="${ROBOT_VARIABLES} -v SCR_DMAAP:${SCR_DMAAP}"
diff --git a/plans/policy/xacml-pdp/teardown.sh b/plans/policy/xacml-pdp/teardown.sh
index 270d6cc6..6942e353 100644
--- a/plans/policy/xacml-pdp/teardown.sh
+++ b/plans/policy/xacml-pdp/teardown.sh
@@ -1,6 +1,6 @@
#!/bin/bash
# ============LICENSE_START=======================================================
-# Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+# Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -17,8 +17,4 @@
# SPDX-License-Identifier: Apache-2.0
# ============LICENSE_END=========================================================
-kill-instance.sh policy-xacml-pdp
-kill-instance.sh policy-pap
-kill-instance.sh policy-api
-kill-instance.sh mariadb
-kill-instance.sh dmaap-simulator
+docker-compose -f ${WORKSPACE}/scripts/policy/docker-compose-all.yml down -v