diff options
Diffstat (limited to 'plans/policy/apex-pdp')
-rw-r--r-- | plans/policy/apex-pdp/setup.sh | 77 | ||||
-rw-r--r-- | plans/policy/apex-pdp/teardown.sh | 8 |
2 files changed, 79 insertions, 6 deletions
diff --git a/plans/policy/apex-pdp/setup.sh b/plans/policy/apex-pdp/setup.sh index c97072d4..96396462 100644 --- a/plans/policy/apex-pdp/setup.sh +++ b/plans/policy/apex-pdp/setup.sh @@ -1,6 +1,8 @@ #!/bin/bash # ============LICENSE_START======================================================= # Copyright (C) 2018 Ericsson. All rights reserved. +# +# Modifications copyright (c) 2019 Nordix Foundation. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,16 +19,81 @@ # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END========================================================= -docker run -d --name apex -p 12561:12561 -p 23324:23324 -it nexus3.onap.org:10001/onap/policy-apex-pdp:2.0-SNAPSHOT-latest /bin/bash -c "/opt/app/policy/apex-pdp/bin/apexEngine.sh -c /opt/app/policy/apex-pdp/examples/config/SampleDomain/RESTServerJsonEvent.json" +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-apex-pdp/docker-compose-apex.yml run --rm start_dependencies +docker-compose -f ${WORKSPACE}/scripts/policy/policy-apex-pdp/docker-compose-apex.yml up -d + +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` -APEX_IP=`get-instance-ip.sh apex` +echo PAP IP IS ${POLICY_PAP_IP} +echo MARIADB IP IS ${MARIADB_IP} +echo API IP IS ${POLICY_API_IP} echo APEX IP IS ${APEX_IP} +echo DMAAP_IP IS ${DMAAP_IP} + # Wait for initialization for i in {1..10}; do - curl -sS ${APEX_IP}:23324 && break + curl -sS ${MARIADB_IP}:3306 && break + echo sleep $i + sleep $i +done +for i in {1..10}; do + curl -sS ${APEX_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 -sleep 10 +#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 APEX_IP:${APEX_IP}" +ROBOT_VARIABLES="-v APEX_IP:${APEX_IP} -v POLICY_API_IP:${POLICY_API_IP} -v POLICY_PAP_IP:${POLICY_PAP_IP}" diff --git a/plans/policy/apex-pdp/teardown.sh b/plans/policy/apex-pdp/teardown.sh index ca8e92e6..6c02aea1 100644 --- a/plans/policy/apex-pdp/teardown.sh +++ b/plans/policy/apex-pdp/teardown.sh @@ -1,6 +1,8 @@ #!/bin/bash # ============LICENSE_START======================================================= # Copyright (C) 2018 Ericsson. All rights reserved. +# +# Modifications copyright (c) 2019 Nordix Foundation. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,4 +19,8 @@ # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END========================================================= -kill-instance.sh apex +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 |