aboutsummaryrefslogtreecommitdiffstats
path: root/plans
diff options
context:
space:
mode:
authorGary Wu <gwu@futurewei.com>2019-05-28 17:17:03 +0000
committerGerrit Code Review <gerrit@onap.org>2019-05-28 17:17:03 +0000
commit7027bed4a8d1a34a49a268999f0cc28fdff99f0e (patch)
treee3ca43c07e6a01c7279ef0ee684288631b013ae5 /plans
parentb52c1a9b7f060b87429a38f41f7e0e41f2bdbe61 (diff)
parentb4f69621e134b308dcbc2c90075508fda872ca43 (diff)
Merge "Xacml-PDP CSIT tests with DmaaP Simulator"
Diffstat (limited to 'plans')
-rw-r--r--plans/policy/xacml-pdp/setup.sh79
-rw-r--r--plans/policy/xacml-pdp/teardown.sh4
2 files changed, 78 insertions, 5 deletions
diff --git a/plans/policy/xacml-pdp/setup.sh b/plans/policy/xacml-pdp/setup.sh
index e7882822..96ae4715 100644
--- a/plans/policy/xacml-pdp/setup.sh
+++ b/plans/policy/xacml-pdp/setup.sh
@@ -17,16 +17,85 @@
# SPDX-License-Identifier: Apache-2.0
# ============LICENSE_END=========================================================
-docker run -d --name policy-xacml-pdp -p 6969:6969 -it nexus3.onap.org:10001/onap/policy-xacml-pdp:2.0.0-SNAPSHOT-latest
-docker ps -a
-sleep 5
+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
+
+# bring down maven
+mkdir maven
+cd maven
+curl -O http://apache.claz.org/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
+tar -xzvf apache-maven-3.3.9-bin.tar.gz
+ls -l
+export PATH=${PATH}:${WORK_DIR}/maven/apache-maven-3.3.9/bin
+${WORK_DIR}/maven/apache-maven-3.3.9/bin/mvn -v
+cd ..
+
+git clone http://gerrit.onap.org/r/oparent
+git clone --depth 1 https://gerrit.onap.org/r/policy/models -b master
+cd models/models-sim/models-sim-dmaap
+${WORK_DIR}/maven/apache-maven-3.3.9/bin/mvn clean install -DskipTests --settings ${WORK_DIR}/oparent/settings.xml
+bash ./src/main/package/docker/docker_build.sh
+cd ${WORKSPACE}
+rm -rf ${WORK_DIR}
+sleep 3
+
+# 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 ${WORKSPACE}/scripts/policy/policy-xacml-pdp/docker-compose-pdpx.yml up -d
+
+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`
-echo PDP-X IP IS ${POLICY_PDPX_IP}
+DMAAP_IP=`get-instance-ip.sh dmaap-simulator`
+POLICY_PAP_IP=`get-instance-ip.sh policy-pap`
+
+
+echo PDP IP IS ${POLICY_PDPX_IP}
+echo API IP IS ${POLICY_API_IP}
+echo PAP IP IS ${POLICY_PAP_IP}
+echo MARIADB IP IS ${MARIADB_IP}
+echo DMAAP_IP IS ${DMAAP_IP}
+
# Wait for initialization
for i in {1..10}; do
+ curl -sS ${MARIADB_IP}:3306 && break
+ echo sleep $i
+ sleep $i
+done
+for i in {1..10}; do
curl -sS ${POLICY_PDPX_IP}:6969 && break
echo sleep $i
sleep $i
done
+for i in {1..10}; do
+ curl -sS ${DMAAP_IP}:3904 && break
+ echo sleep $i
+ sleep $i
+done
+
+#Configure the database
+docker exec -it mariadb chmod +x /docker-entrypoint-initdb.d/db.sh
+docker exec -it mariadb /docker-entrypoint-initdb.d/db.sh
-ROBOT_VARIABLES="-v POLICY_PDPX_IP:${POLICY_PDPX_IP}"
+ROBOT_VARIABLES="-v POLICY_PDPX_IP:${POLICY_PDPX_IP} -v POLICY_API_IP:${POLICY_API_IP} -v POLICY_PAP_IP:${POLICY_PAP_IP}"
diff --git a/plans/policy/xacml-pdp/teardown.sh b/plans/policy/xacml-pdp/teardown.sh
index a81ee6b1..270d6cc6 100644
--- a/plans/policy/xacml-pdp/teardown.sh
+++ b/plans/policy/xacml-pdp/teardown.sh
@@ -18,3 +18,7 @@
# ============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