diff options
author | Michael Mokry <michael.mokry@att.com> | 2019-05-13 13:09:17 -0500 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2019-05-24 16:38:04 -0400 |
commit | b4f69621e134b308dcbc2c90075508fda872ca43 (patch) | |
tree | acabae76e3067091c4a5b5b816b1dc759ba28654 /plans/policy/xacml-pdp | |
parent | db4c4a5f83b674d6c04f9e6f3355171b13d67fa4 (diff) |
Xacml-PDP CSIT tests with DmaaP Simulator
1. Added test cases for creating policy, deploying policy, and getting a
decision for monitoring policies
2. Included statistics check between some tests
3. Modified to use dmaap simulator, policy-pap, and policy-api for end
to end tests
5. UPDATE: made changes per Ajith's review
6. Removed most config overrides and changed dmaap to message-router
where appropriate
Change-Id: Ia9935193f189f249e11f23b2ffe49f87090b7b54
Issue-ID: POLICY-1767
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'plans/policy/xacml-pdp')
-rw-r--r-- | plans/policy/xacml-pdp/setup.sh | 79 | ||||
-rw-r--r-- | plans/policy/xacml-pdp/teardown.sh | 4 |
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 |