From: Jim Hahn Date: Thu, 17 Sep 2020 21:03:34 +0000 (-0400) Subject: Make stand-alone Policy environment X-Git-Tag: 7.0.1~15^2 X-Git-Url: https://gerrit.onap.org/r/gitweb?p=integration%2Fcsit.git;a=commitdiff_plain;h=00532428c0b83065a8ae87eaa2de579c3918d984 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 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 Signed-off-by: a.sreekumar --- 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 diff --git a/scripts/policy/config/apex-pdp/OnapPfConfig.json b/scripts/policy/config/apex-pdp/OnapPfConfig.json new file mode 100644 index 00000000..59ba604d --- /dev/null +++ b/scripts/policy/config/apex-pdp/OnapPfConfig.json @@ -0,0 +1,42 @@ +{ + "name":"OnapPfParameterGroup", + "restServerParameters": { + "host": "0.0.0.0", + "port": 6969, + "userName": "healthcheck", + "password": "zb!XztG34", + "https": true + }, + "pdpStatusParameters":{ + "pdpGroup": "defaultGroup", + "timeIntervalMs": 120000, + "pdpType":"apex", + "description":"Pdp Heartbeat", + "supportedPolicyTypes": [ + { + "name": "onap.policies.controlloop.operational.common.Apex", + "version": "1.0.0" + }, + { + "name": "onap.policies.native.Apex", + "version": "1.0.0" + } + ] + }, + "topicParameterGroup": { + "topicSources" : [{ + "topic" : "POLICY-PDP-PAP", + "servers" : [ "policy.api.simpledemo.onap.org" ], + "topicCommInfrastructure" : "dmaap", + "useHttps" : true, + "allowSelfSignedCerts" : true + }], + "topicSinks" : [{ + "topic" : "POLICY-PDP-PAP", + "servers" : [ "policy.api.simpledemo.onap.org" ], + "topicCommInfrastructure" : "dmaap", + "useHttps" : true, + "allowSelfSignedCerts" : true + }] + } +} diff --git a/scripts/policy/policy-distribution/config/distribution/defaultConfig.json b/scripts/policy/config/distribution/defaultConfig.json similarity index 100% rename from scripts/policy/policy-distribution/config/distribution/defaultConfig.json rename to scripts/policy/config/distribution/defaultConfig.json diff --git a/scripts/policy/drools-apps/custom/papDefaultConfig.json b/scripts/policy/config/pap/defaultConfig.json similarity index 100% rename from scripts/policy/drools-apps/custom/papDefaultConfig.json rename to scripts/policy/config/pap/defaultConfig.json diff --git a/scripts/policy/config/pe/base.conf b/scripts/policy/config/pe/base.conf deleted file mode 100644 index 851234f3..00000000 --- a/scripts/policy/config/pe/base.conf +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright 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. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -JAVA_HOME=/usr/local/openjdk-11 -POLICY_HOME=/opt/app/policy -POLICY_LOGS=/var/log/onap -KEYSTORE_PASSWD=Pol1cy_0nap -TRUSTSTORE_PASSWD=Pol1cy_0nap - -JDBC_DRIVER=org.mariadb.jdbc.Driver -JDBC_URL=jdbc:mariadb://mariadb:3306/onap_sdk?connectTimeout=30000&socketTimeout=60000&log=true&sessionVariables=max_statement_time=30 -JDBC_LOG_URL=jdbc:mariadb://mariadb:3306/log?connectTimeout=30000&socketTimeout=60000&log=true&sessionVariables=max_statement_time=30 -JDBC_USER=policy_user -JDBC_PASSWORD=policy_user - -site_name=site_1 -fp_monitor_interval=30 -failed_counter_threshold=3 -test_trans_interval=20 -write_fpc_interval=5 -max_fpc_update_interval=60 -test_via_jmx=false -jmx_fqdn= - -AAF_NAMESPACE=org.onap.policy -AAF_HOST=aaf.api.simpledemo.onap.org - -ENVIRONMENT=TEST - -#Micro Service Model Properties -policy_msOnapName= -policy_msPolicyName= diff --git a/scripts/policy/config/pe/brmsgw-tweaks.sh b/scripts/policy/config/pe/brmsgw-tweaks.sh deleted file mode 100755 index f74730cc..00000000 --- a/scripts/policy/config/pe/brmsgw-tweaks.sh +++ /dev/null @@ -1,40 +0,0 @@ -#! /bin/bash -# Copyright 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. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -PROPS_BUILD="${POLICY_HOME}/etc/build.info" - -PROPS_RUNTIME="${POLICY_HOME}/servers/brmsgw/config.properties" -PROPS_INSTALL="${POLICY_HOME}/install/servers/brmsgw/config.properties" - - -if [ ! -f "${PROPS_BUILD}" ]; then - echo "error: version information does not exist: ${PROPS_BUILD}" - exit 1 -fi - -source "${POLICY_HOME}/etc/build.info" - -if [ -z "${version}" ]; then - echo "error: no version information present" - exit 1 -fi - -for CONFIG in ${PROPS_RUNTIME} ${PROPS_INSTALL}; do - if [ ! -f "${CONFIG}" ]; then - echo "warning: configuration does not exist: ${CONFIG}" - else - sed -i -e "s/brms.dependency.version=.*/brms.dependency.version=${version}/g" "${CONFIG}" - fi -done diff --git a/scripts/policy/config/pe/brmsgw.conf b/scripts/policy/config/pe/brmsgw.conf deleted file mode 100644 index c2db9d12..00000000 --- a/scripts/policy/config/pe/brmsgw.conf +++ /dev/null @@ -1,67 +0,0 @@ -# Copyright 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. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# BRMSpep component installation configuration parameters -BRMSGW_JMX_PORT=9989 - -COMPONENT_X_MX_MB=512 -COMPONENT_X_MS_MB=512 - -REST_PAP_URL=https://pap:9091/pap/ -REST_PDP_ID=https://pdp:8081/pdp/ - -PDP_HTTP_USER_ID=testpdp -PDP_HTTP_PASSWORD=alpha123 -PDP_PAP_PDP_HTTP_USER_ID=testpap -PDP_PAP_PDP_HTTP_PASSWORD=alpha123 - -M2_HOME=/usr/share/java/maven-3 -snapshotRepositoryID=policy-nexus-snapshots -snapshotRepositoryName=Snapshots -snapshotRepositoryURL=http://nexus:8081/nexus/content/repositories/snapshots -releaseRepositoryID=policy-nexus-releases -releaseRepositoryName=Releases -releaseRepositoryURL=http://nexus:8081/nexus/content/repositories/releases -repositoryUsername=admin -repositoryPassword=admin123 -UEB_URL=mr.api.simpledemo.onap.org -UEB_TOPIC=PDPD-CONFIGURATION -UEB_API_KEY= -UEB_API_SECRET= - -groupID=org.onap.policy-engine -artifactID=drlPDPGroup -AMSTERDAM_GROUP_ID=org.onap.policy-engine.drools.amsterdam -AMSTERDAM_ARTIFACT_ID=policy-amsterdam-rules - -# the java property is RESOURCE_NAME (uppercase), but the conf parameter is lowercase -resource_name=brmsgw_1 -node_type=brms_gateway - -#Environment should be Set either DEV, TEST or PROD -ENVIRONMENT=TEST - -#Notification Properties... type can be either websocket, ueb, or dmaap -BRMS_NOTIFICATION_TYPE=websocket -BRMS_UEB_URL=mr.api.simpledemo.onap.org -BRMS_UEB_TOPIC=PDPD-CONFIGURATION -BRMS_UEB_DELAY= -BRMS_CLIENT_ID=python -BRMS_CLIENT_KEY=dGVzdA== -BRMS_UEB_API_KEY= -BRMS_UEB_API_SECRET= - -#Dependency.json file version -BRMS_DEPENDENCY_VERSION=1.5.1 -BRMS_MODELS_DEPENDENCY_VERSION=2.1.2 - diff --git a/scripts/policy/config/pe/console.conf b/scripts/policy/config/pe/console.conf deleted file mode 100644 index ceaad638..00000000 --- a/scripts/policy/config/pe/console.conf +++ /dev/null @@ -1,145 +0,0 @@ -# Copyright 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. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# configs component installation configuration parameters - -# tomcat specific parameters - -TOMCAT_JMX_PORT=9993 -TOMCAT_SHUTDOWN_PORT=8090 -SSL_HTTP_CONNECTOR_PORT=8443 -SSL_HTTP_CONNECTOR_REDIRECT_PORT=8443 -SSL_AJP_CONNECTOR_PORT=8383 -SSL_AJP_CONNECTOR_REDIRECT_PORT=8443 - -TOMCAT_X_MS_MB=2048 -TOMCAT_X_MX_MB=2048 - -# ------------------ console properties --------------------------- - -# -# Authorization Policy - -ROOT_POLICIES=admin -ADMIN_FILE=Policy-Admin.xml - - -# Set your domain here: - -REST_ADMIN_DOMAIN=com - -# -# Location where the GIT repository is located -# -REST_ADMIN_REPOSITORY=repository - -# -# Location where all the user workspaces are located. -# -REST_ADMIN_WORKSPACE=${{POLICY_HOME}}/servers/console/bin/workspace - -# -# These can be set so the Admin Console knows who is logged on. Ideally, you can run the console in a J2EE -# container and setup authentication as you please. Setting HttpSession attribute values will override these -# values set in the properties files. -# -# ((HttpServletRequest) request).getSession().setAttribute("xacml.rest.admin.user.name", "Homer"); -# -# The default policy: Policy-Admin.xml is extremely simple. -# -# You can test authorization within the Admin Console by changing the user id. -# There are 3 supported user ids: -# guest - Read only access -# editor - Read/Write access -# admin - Read/Write/Admin access -# -# An empty or null value for xacml.rest.admin.user.id results in no access to the application at all. -# -# This is for development/demonstration purposes only. A production environment should provide authentication which is -# outside the scope of this application. This application can be used to develop a XACML policy for user authorization -# within this application. -# - -REST_ADMIN_USER_NAME=Administrator -REST_ADMIN_USER_ID=super-admin - -# -# -# Property to declare the max time frame for logs. -# -LOG_TIMEFRAME=30 - -# Property to declare the number of visible rows for users in MicroService Policy -COLUMN_COUNT=3 - -# Dashboard refresh rate in miliseconds -REFRESH_RATE=40000 - -# -# URL location for the PAP servlet. -# - - -REST_PAP_URL=https://pap:9091/pap/ - -# -# Config/Action Properties location. -# - -REST_CONFIG_HOME=${{POLICY_HOME}}/servers/pap/webapps/Config/ -REST_ACTION_HOME=${{POLICY_HOME}}/servers/pap/webapps/Action/ -REST_CONFIG_URL=https://pap:9091/ -REST_CONFIG_WEBAPPS=${{POLICY_HOME}}/servers/pap/webapps/ - -# PAP account information -CONSOLE_PAP_HTTP_USER_ID=testpap -CONSOLE_PAP_HTTP_PASSWORD=alpha123 - - -node_type=pap_admin -resource_name=console_1 - -# The (optional) period of time in seconds between executions of the integrity audit. -# Value < 0 : Audit does not run (default value if property is not present = -1) -# Value = 0 : Audit runs continuously -# Value > 0 : The period of time in seconds between execution of the audit on a particular node -integrity_audit_period_seconds=-1 - -#Automatic Policy Distribution -automatic_push=false - -#Diff of policies for Firewall feature -FW_GETURL= -FW_AUTHOURL= -FW_PROXY= -FW_PORT= - -#SMTP Server Details for Java Mail -onap_smtp_host= -onap_smtp_port=25 -onap_smtp_userName= -onap_smtp_password= -onap_smtp_emailExtension= -onap_application_name= - -#-----------------------ONAP-PORTAL-Properties---------------------- - -ONAP_REDIRECT_URL=http://portal.api.simpledemo.onap.org:8989/ONAPPORTAL/login.htm -ONAP_REST_URL=http://portal.api.simpledemo.onap.org:8989/ONAPPORTAL/auxapi -ONAP_UEB_URL_LIST= -ONAP_PORTAL_INBOX_NAME= -ONAP_UEB_APP_KEY= -ONAP_UEB_APP_SECRET= -ONAP_UEB_APP_MAILBOX_NAME= -APP_DISPLAY_NAME=ONAP Policy -ONAP_SHARED_CONTEXT_REST_URL=http://portal.api.simpledemo.onap.org:8989/ONAPPORTAL/context diff --git a/scripts/policy/config/pe/elk.conf b/scripts/policy/config/pe/elk.conf deleted file mode 100644 index a65fd17d..00000000 --- a/scripts/policy/config/pe/elk.conf +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright 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. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# elasticsearch - -ELK_JMX_PORT=9995 \ No newline at end of file diff --git a/scripts/policy/config/pe/mysql.conf b/scripts/policy/config/pe/mysql.conf deleted file mode 100644 index 0f6ee8c7..00000000 --- a/scripts/policy/config/pe/mysql.conf +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright 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. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# mysql scripts component installation configuration parameters - -# Path to mysql bin -MYSQL_BIN=/usr/local/mysql/bin - diff --git a/scripts/policy/config/pe/pap-tweaks.sh b/scripts/policy/config/pe/pap-tweaks.sh deleted file mode 100755 index 87c6d21d..00000000 --- a/scripts/policy/config/pe/pap-tweaks.sh +++ /dev/null @@ -1,14 +0,0 @@ -#! /bin/bash -# Copyright 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. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. diff --git a/scripts/policy/config/pe/pap.conf b/scripts/policy/config/pe/pap.conf deleted file mode 100644 index 86f5a50c..00000000 --- a/scripts/policy/config/pe/pap.conf +++ /dev/null @@ -1,68 +0,0 @@ -# Copyright 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. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# pap component installation configuration parameters - -# tomcat specific parameters - -TOMCAT_JMX_PORT=9990 -TOMCAT_SHUTDOWN_PORT=9405 -SSL_HTTP_CONNECTOR_PORT=9091 -SSL_AJP_CONNECTOR_PORT=8380 -SSL_AJP_CONNECTOR_REDIRECT_PORT=8443 - -TOMCAT_X_MS_MB=512 -TOMCAT_X_MX_MB=512 - -# pap properties - -PAP_PDPS=${{POLICY_HOME}}/servers/pap/bin/pdps -PAP_URL=https://pap:9091/pap/ - -PAP_INITIATE_PDP=true -PAP_HEARTBEAT_INTERVAL=10000 -PAP_HEARTBEAT_TIMEOUT=10000 - -REST_ADMIN_DOMAIN=com -REST_ADMIN_REPOSITORY=repository -REST_ADMIN_WORKSPACE=workspace - -# PDP related properties - -PAP_PDP_URL=https://pdp:8081/pdp/ -PAP_PDP_HTTP_USER_ID=testpdp -PAP_PDP_HTTP_PASSWORD=alpha123 - -PAP_HTTP_USER_ID=testpap -PAP_HTTP_PASSWORD=alpha123 - -#new values added 10-21-2015 -PROP_PAP_TRANS_WAIT=500000 -PROP_PAP_TRANS_TIMEOUT=5000 -PROP_PAP_AUDIT_TIMEOUT=300000 -PROP_PAP_RUN_AUDIT_FLAG=true -PROP_PAP_AUDIT_FLAG=true - -PROP_PAP_INCOMINGNOTIFICATION_TRIES=4 - - -node_type=pap -resource_name=pap_1 -dependency_groups=paplp_1 -test_via_jmx=true - -# The (optional) period of time in seconds between executions of the integrity audit. -# Value < 0 : Audit does not run (default value if property is not present = -1) -# Value = 0 : Audit runs continuously -# Value > 0 : The period of time in seconds between execution of the audit on a particular node -integrity_audit_period_seconds=-1 diff --git a/scripts/policy/config/pe/paplp.conf b/scripts/policy/config/pe/paplp.conf deleted file mode 100644 index 647625cb..00000000 --- a/scripts/policy/config/pe/paplp.conf +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright 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. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# JVM specific parameters -LOGPARSER_JMX_PORT=9996 -LOGPARSER_X_MS_MB=256 -LOGPARSER_X_MX_MB=256 - -SERVER=https://pap:9091/pap/ -LOGPATH=/var/log/onap/policy/pap/pap-rest.log -PARSERLOGPATH=${{POLICY_HOME}}/servers/paplp/bin/IntegrityMonitor.log - -node_type=logparser -# the java property is RESOURCE_NAME (uppercase), but the conf parameter is lowercase -resource_name=paplp_1 diff --git a/scripts/policy/config/pe/pdp-tweaks.sh b/scripts/policy/config/pe/pdp-tweaks.sh deleted file mode 100755 index 87c6d21d..00000000 --- a/scripts/policy/config/pe/pdp-tweaks.sh +++ /dev/null @@ -1,14 +0,0 @@ -#! /bin/bash -# Copyright 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. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. diff --git a/scripts/policy/config/pe/pdp.conf b/scripts/policy/config/pe/pdp.conf deleted file mode 100644 index 0aa6b0b6..00000000 --- a/scripts/policy/config/pe/pdp.conf +++ /dev/null @@ -1,69 +0,0 @@ -# Copyright 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. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# pdp component installation configuration parameters - -# tomcat specific parameters - -TOMCAT_JMX_PORT=9991 -TOMCAT_SHUTDOWN_PORT=8087 -SSL_HTTP_CONNECTOR_PORT=8081 -SSL_AJP_CONNECTOR_PORT=8381 -SSL_AJP_CONNECTOR_REDIRECT_PORT=8443 - -TOMCAT_X_MS_MB=512 -TOMCAT_X_MX_MB=512 - -# pdp properties - -UEB_CLUSTER=mr.api.simpledemo.onap.org - -REST_PAP_URL=https://pap:9091/pap/ -REST_PDP_ID=https://pdp:8081/pdp/ -REST_PDP_CONFIG=${{POLICY_HOME}}/servers/pdp/bin/config -REST_PDP_WEBAPPS=${{POLICY_HOME}}/servers/pdp/webapps -REST_PDP_REGISTER=true -REST_PDP_REGISTER_SLEEP=15 -REST_PDP_REGISTER_RETRIES=-1 -REST_PDP_MAXCONTENT=999999999 - -# PDP related properties -PDP_HTTP_USER_ID=testpdp -PDP_HTTP_PASSWORD=alpha123 -PDP_PAP_PDP_HTTP_USER_ID=testpap -PDP_PAP_PDP_HTTP_PASSWORD=alpha123 - -node_type=pdp_xacml -resource_name=pdp_1 -dependency_groups=pdplp_1;brmsgw_1 -test_via_jmx=true - -# -# Notification Properties -# Notification type: websocket, ueb or dmaap... if left blank websocket is the default -PDP_NOTIFICATION_TYPE=websocket -PDP_UEB_CLUSTER= -PDP_UEB_TOPIC= -PDP_UEB_DELAY= -PDP_UEB_API_KEY= -PDP_UEB_API_SECRET= -PDP_DMAAP_AAF_LOGIN= -PDP_DMAAP_AAF_PASSWORD= - -#AAF Policy Name space -#Required only, when we use AAF -POLICY_AAF_NAMESPACE= -POLICY_AAF_RESOURCE= - -# Indeterminate resolution -DECISION_INDETERMINATE_RESPONSE=PERMIT diff --git a/scripts/policy/config/pe/pdplp.conf b/scripts/policy/config/pe/pdplp.conf deleted file mode 100644 index 4676b610..00000000 --- a/scripts/policy/config/pe/pdplp.conf +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright 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. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# JVM specific parameters -LOGPARSER_JMX_PORT=9997 -LOGPARSER_X_MS_MB=256 -LOGPARSER_X_MX_MB=256 - -SERVER=https://pdp:8081/pdp/ -LOGPATH=/var/log/onap/policy/pdpx/pdp-rest.log -PARSERLOGPATH=${{POLICY_HOME}}/servers/pdplp/bin/IntegrityMonitor.log - -node_type=logparser -# the java property is RESOURCE_NAME (uppercase), but the conf parameter is lowercase -resource_name=pdplp_1 diff --git a/scripts/policy/config/pe/push-policies.sh b/scripts/policy/config/pe/push-policies.sh deleted file mode 100755 index 65013138..00000000 --- a/scripts/policy/config/pe/push-policies.sh +++ /dev/null @@ -1,506 +0,0 @@ -#! /bin/bash -x -# Copyright 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. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -#########################################Upload BRMS Param Template########################################## - -echo "Upload BRMS Param Template" - -sleep 2 - -wget -O cl-amsterdam-template.drl https://git.onap.org/policy/drools-applications/plain/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl - -sleep 2 - -curl -k -v --silent -X POST --header 'Content-Type: multipart/form-data' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -F "file=@cl-amsterdam-template.drl" -F "importParametersJson={\"serviceName\":\"ClosedLoopControlName\",\"serviceType\":\"BRMSPARAM\"}" 'https://pdp:8081/pdp/api/policyEngineImport' - -echo "PRELOAD_POLICIES is $PRELOAD_POLICIES" - -if [ "$PRELOAD_POLICIES" == "false" ]; then - exit 0 -fi - -#########################################Create BRMS Param policies########################################## - -echo "Create BRMSParam Operational Policies" - -sleep 2 - -echo "Create BRMSParamvFirewall Policy" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/html' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "policyConfigType": "BRMS_PARAM", - "policyName": "com.BRMSParamvFirewall", - "policyDescription": "BRMS Param vFirewall policy", - "policyScope": "com", - "attributes": { - "MATCHING": { - "controller" : "amsterdam" - }, - "RULE": { - "templateName": "ClosedLoopControlName", - "closedLoopControlName": "ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a", - "controlLoopYaml": "controlLoop%3A%0D%0A++version%3A+2.0.0%0D%0A++controlLoopName%3A+ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a%0D%0A++trigger_policy%3A+unique-policy-id-1-modifyConfig%0D%0A++timeout%3A+1200%0D%0A++abatement%3A+false%0D%0A+%0D%0Apolicies%3A%0D%0A++-+id%3A+unique-policy-id-1-modifyConfig%0D%0A++++name%3A+modify+packet+gen+config%0D%0A++++description%3A%0D%0A++++actor%3A+APPC%0D%0A++++recipe%3A+ModifyConfig%0D%0A++++target%3A%0D%0A++++++%23+TBD+-+Cannot+be+known+until+instantiation+is+done%0D%0A++++++resourceID%3A+Eace933104d443b496b8.nodes.heat.vpg%0D%0A++++++type%3A+VNF%0D%0A++++retry%3A+0%0D%0A++++timeout%3A+300%0D%0A++++success%3A+final_success%0D%0A++++failure%3A+final_failure%0D%0A++++failure_timeout%3A+final_failure_timeout%0D%0A++++failure_retries%3A+final_failure_retries%0D%0A++++failure_exception%3A+final_failure_exception%0D%0A++++failure_guard%3A+final_failure_guard" - } - } -}' 'https://pdp:8081/pdp/api/createPolicy' - -sleep 2 - -echo "Create BRMSParamvDNS Policy" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/html' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "policyConfigType": "BRMS_PARAM", - "policyName": "com.BRMSParamvDNS", - "policyDescription": "BRMS Param vDNS policy", - "policyScope": "com", - "attributes": { - "MATCHING": { - "controller" : "amsterdam" - }, - "RULE": { - "templateName": "ClosedLoopControlName", - "closedLoopControlName": "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3", - "controlLoopYaml": "controlLoop%3A%0A++version%3A+2.0.0%0A++controlLoopName%3A+ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3%0A++trigger_policy%3A+unique-policy-id-1-scale-up%0A++timeout%3A+1200%0A++abatement%3A+false%0Apolicies%3A%0A++-+id%3A+unique-policy-id-1-scale-up%0A++++name%3A+Create+a+new+VF+Module%0A++++description%3A%0A++++actor%3A+SO%0A++++recipe%3A+VF+Module+Create%0A++++target%3A%0A++++++type%3A+VNF%0A++++payload%3A%0A++++++requestParameters%3A+%27%7B%22usePreload%22%3Atrue%2C%22userParams%22%3A%5B%5D%7D%27%0A++++++configurationParameters%3A+%27%5B%7B%22ip-addr%22%3A%22%24.vf-module-topology.vf-module-parameters.param%5B9%5D%22%2C%22oam-ip-addr%22%3A%22%24.vf-module-topology.vf-module-parameters.param%5B16%5D%22%2C%22enabled%22%3A%22%24.vf-module-topology.vf-module-parameters.param%5B23%5D%22%7D%5D%27%0A++++retry%3A+0%0A++++timeout%3A+1200%0A++++success%3A+final_success%0A++++failure%3A+final_failure%0A++++failure_timeout%3A+final_failure_timeout%0A++++failure_retries%3A+final_failure_retries%0A++++failure_exception%3A+final_failure_exception%0A++++failure_guard%3A+final_failure_guard" - } - } -}' 'https://pdp:8081/pdp/api/createPolicy' - -sleep 2 - -echo "Create BRMSParamVOLTE Policy" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/html' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "policyConfigType": "BRMS_PARAM", - "policyName": "com.BRMSParamVOLTE", - "policyDescription": "BRMS Param VOLTE policy", - "policyScope": "com", - "attributes": { - "MATCHING": { - "controller" : "amsterdam" - }, - "RULE": { - "templateName": "ClosedLoopControlName", - "closedLoopControlName": "ControlLoop-VOLTE-2179b738-fd36-4843-a71a-a8c24c70c55b", - "controlLoopYaml": "controlLoop%3A%0D%0A++version%3A+2.0.0%0D%0A++controlLoopName%3A+ControlLoop-VOLTE-2179b738-fd36-4843-a71a-a8c24c70c55b%0D%0A++trigger_policy%3A+unique-policy-id-1-restart%0D%0A++timeout%3A+3600%0D%0A++abatement%3A+false%0D%0A+%0D%0Apolicies%3A%0D%0A++-+id%3A+unique-policy-id-1-restart%0D%0A++++name%3A+Restart+the+VM%0D%0A++++description%3A%0D%0A++++actor%3A+VFC%0D%0A++++recipe%3A+Restart%0D%0A++++target%3A%0D%0A++++++type%3A+VM%0D%0A++++retry%3A+3%0D%0A++++timeout%3A+1200%0D%0A++++success%3A+final_success%0D%0A++++failure%3A+final_failure%0D%0A++++failure_timeout%3A+final_failure_timeout%0D%0A++++failure_retries%3A+final_failure_retries%0D%0A++++failure_exception%3A+final_failure_exception%0D%0A++++failure_guard%3A+final_failure_guard" - } - } -}' 'https://pdp:8081/pdp/api/createPolicy' - -sleep 2 - -echo "Create BRMSParamvCPE Policy" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/html' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "policyConfigType": "BRMS_PARAM", - "policyName": "com.BRMSParamvCPE", - "policyDescription": "BRMS Param vCPE policy", - "policyScope": "com", - "attributes": { - "MATCHING": { - "controller" : "amsterdam" - }, - "RULE": { - "templateName": "ClosedLoopControlName", - "closedLoopControlName": "ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e", - "controlLoopYaml": "controlLoop%3A%0D%0A++version%3A+2.0.0%0D%0A++controlLoopName%3A+ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e%0D%0A++trigger_policy%3A+unique-policy-id-1-restart%0D%0A++timeout%3A+3600%0D%0A++abatement%3A+true%0D%0A+%0D%0Apolicies%3A%0D%0A++-+id%3A+unique-policy-id-1-restart%0D%0A++++name%3A+Restart+the+VM%0D%0A++++description%3A%0D%0A++++actor%3A+APPC%0D%0A++++recipe%3A+Restart%0D%0A++++target%3A%0D%0A++++++type%3A+VM%0D%0A++++retry%3A+3%0D%0A++++timeout%3A+1200%0D%0A++++success%3A+final_success%0D%0A++++failure%3A+final_failure%0D%0A++++failure_timeout%3A+final_failure_timeout%0D%0A++++failure_retries%3A+final_failure_retries%0D%0A++++failure_exception%3A+final_failure_exception%0D%0A++++failure_guard%3A+final_failure_guard" - } - } -}' 'https://pdp:8081/pdp/api/createPolicy' - -sleep 2 - -echo "Create BRMSParamvPCI Policy" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/html' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "policyConfigType": "BRMS_PARAM", - "policyName": "com.BRMSParamvPCI", - "policyDescription": "BRMS Param vPCI policy", - "policyScope": "com", - "attributes": { - "MATCHING": { - "controller" : "casablanca" - }, - "RULE": { - "templateName": "ClosedLoopControlName", - "closedLoopControlName": "ControlLoop-vPCI-fb41f388-a5f2-11e8-98d0-529269fb1459", - "controlLoopYaml": "controlLoop%3A%0D%0A++version%3A+3.0.0%0D%0A++controlLoopName%3A+ControlLoop-vPCI-fb41f388-a5f2-11e8-98d0-529269fb1459%0D%0A++trigger_policy%3A+unique-policy-id-123-modifyconfig%0D%0A++timeout%3A+1200%0D%0A++abatement%3A+false%0D%0A+%0D%0Apolicies%3A%0D%0A++-+id%3A+unique-policy-id-123-modifyconfig%0D%0A++++name%3A+modify+PCI+config%0D%0A++++description%3A%0D%0A++++actor%3A+SDNR%0D%0A++++recipe%3A+ModifyConfig%0D%0A++++target%3A%0D%0A++++++%23+These+fields+are+not+used%0D%0A++++++resourceID%3A+Eace933104d443b496b8.nodes.heat.vpg%0D%0A++++++type%3A+VNF%0D%0A++++retry%3A+0%0D%0A++++timeout%3A+300%0D%0A++++success%3A+final_success%0D%0A++++failure%3A+final_failure%0D%0A++++failure_timeout%3A+final_failure_timeout%0D%0A++++failure_retries%3A+final_failure_retries%0D%0A++++failure_exception%3A+final_failure_exception%0D%0A++++failure_guard%3A+final_failure_guard" - } - } -}' 'https://pdp:8081/pdp/api/createPolicy' - -sleep 2 - -echo "Create BRMSParamCCVPN Policy" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/html' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "policyConfigType": "BRMS_PARAM", - "policyName": "com.BRMSParamCCVPN", - "policyDescription": "BRMS Param CCVPN policy", - "policyScope": "com", - "attributes": { - "MATCHING": { - "controller" : "amsterdam" - }, - "RULE": { - "templateName": "ClosedLoopControlName", - "closedLoopControlName": "ControlLoop-CCVPN-2179b738-fd36-4843-a71a-a8c24c70c66b", - "controlLoopYaml": "controlLoop%3A%0D%0A++version%3A+2.0.0%0D%0A++controlLoopName%3A+ControlLoop-CCVPN-2179b738-fd36-4843-a71a-a8c24c70c66b%0D%0A++trigger_policy%3A+unique-policy-id-16-Reroute%0D%0A++timeout%3A+3600%0D%0A++abatement%3A+false%0D%0A+%0D%0Apolicies%3A%0D%0A++-+id%3A+unique-policy-id-16-Reroute%0D%0A++++name%3A+Connectivity Reroute%0D%0A++++description%3A%0D%0A++++actor%3A+SDNC%0D%0A++++recipe%3A+Reroute%0D%0A++++target%3A%0D%0A++++++type%3A+VM%0D%0A++++retry%3A+3%0D%0A++++timeout%3A+1200%0D%0A++++success%3A+final_success%0D%0A++++failure%3A+final_failure%0D%0A++++failure_timeout%3A+final_failure_timeout%0D%0A++++failure_retries%3A+final_failure_retries%0D%0A++++failure_exception%3A+final_failure_exception%0D%0A++++failure_guard%3A+final_failure_guard" - } - } -}' 'https://pdp:8081/pdp/api/createPolicy' - -#########################################Create Micro Service Config policies########################################## - -echo "Create MicroService Config Policies" - -sleep 2 - -echo "Create MicroServicevFirewall Policy" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "configBody": "{ \"service\": \"tca_policy\", \"location\": \"SampleServiceLocation\", \"uuid\": \"test\", \"policyName\": \"MicroServicevFirewall\", \"description\": \"MicroService vFirewall Policy\", \"configName\": \"SampleConfigName\", \"templateVersion\": \"OpenSource.version.1\", \"version\": \"1.1.0\", \"priority\": \"1\", \"policyScope\": \"resource=SampleResource,service=SampleService,type=SampleType,closedLoopControlName=ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\", \"riskType\": \"SampleRiskType\", \"riskLevel\": \"1\", \"guard\": \"False\", \"content\": { \"tca_policy\": { \"domain\": \"measurementsForVfScaling\", \"metricsPerEventName\": [{ \"eventName\": \"vFirewallBroadcastPackets\", \"controlLoopSchemaType\": \"VNF\", \"policyScope\": \"DCAE\", \"policyName\": \"DCAE.Config_tca-hi-lo\", \"policyVersion\": \"v0.0.1\", \"thresholds\": [{ \"closedLoopControlName\": \"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\", \"version\": \"1.0.2\", \"fieldPath\": \"$.event.measurementsForVfScalingFields.vNicUsageArray[*].receivedTotalPacketsDelta\", \"thresholdValue\": 300, \"direction\": \"LESS_OR_EQUAL\", \"severity\": \"MAJOR\", \"closedLoopEventStatus\": \"ONSET\" }, { \"closedLoopControlName\": \"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\", \"version\": \"1.0.2\", \"fieldPath\": \"$.event.measurementsForVfScalingFields.vNicUsageArray[*].receivedTotalPacketsDelta\", \"thresholdValue\": 700, \"direction\": \"GREATER_OR_EQUAL\", \"severity\": \"CRITICAL\", \"closedLoopEventStatus\": \"ONSET\" } ] }] } } }", - "policyConfigType": "MicroService", - "policyName": "com.MicroServicevFirewall", - "onapName": "DCAE" -}' 'https://pdp:8081/pdp/api/createPolicy' - - -sleep 2 - -echo "Create MicroServicevDNS Policy" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "configBody": "{ \"service\": \"tca_policy\", \"location\": \"SampleServiceLocation\", \"uuid\": \"test\", \"policyName\": \"MicroServicevDNS\", \"description\": \"MicroService vDNS Policy\", \"configName\": \"SampleConfigName\", \"templateVersion\": \"OpenSource.version.1\", \"version\": \"1.1.0\", \"priority\": \"1\", \"policyScope\": \"resource=SampleResource,service=SampleService,type=SampleType,closedLoopControlName=ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3\", \"riskType\": \"SampleRiskType\", \"riskLevel\": \"1\", \"guard\": \"False\", \"content\": { \"tca_policy\": { \"domain\": \"measurementsForVfScaling\", \"metricsPerEventName\": [{ \"eventName\": \"vLoadBalancer\", \"controlLoopSchemaType\": \"VM\", \"policyScope\": \"DCAE\", \"policyName\": \"DCAE.Config_tca-hi-lo\", \"policyVersion\": \"v0.0.1\", \"thresholds\": [{ \"closedLoopControlName\": \"ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3\", \"version\": \"1.0.2\", \"fieldPath\": \"$.event.measurementsForVfScalingFields.vNicUsageArray[*].receivedTotalPacketsDelta\", \"thresholdValue\": 300, \"direction\": \"GREATER_OR_EQUAL\", \"severity\": \"CRITICAL\", \"closedLoopEventStatus\": \"ONSET\" }] }] } } }", - "policyConfigType": "MicroService", - "policyName": "com.MicroServicevDNS", - "onapName": "DCAE" -}' 'https://pdp:8081/pdp/api/createPolicy' - - -sleep 2 - -echo "Create MicroServicevCPE Policy" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "configBody": "{ \"service\": \"tca_policy\", \"location\": \"SampleServiceLocation\", \"uuid\": \"test\", \"policyName\": \"MicroServicevCPE\", \"description\": \"MicroService vCPE Policy\", \"configName\": \"SampleConfigName\", \"templateVersion\": \"OpenSource.version.1\", \"version\": \"1.1.0\", \"priority\": \"1\", \"policyScope\": \"resource=SampleResource,service=SampleService,type=SampleType,closedLoopControlName=ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e\", \"riskType\": \"SampleRiskType\", \"riskLevel\": \"1\", \"guard\": \"False\", \"content\": { \"tca_policy\": { \"domain\": \"measurementsForVfScaling\", \"metricsPerEventName\": [{ \"eventName\": \"Measurement_vGMUX\", \"controlLoopSchemaType\": \"VNF\", \"policyScope\": \"DCAE\", \"policyName\": \"DCAE.Config_tca-hi-lo\", \"policyVersion\": \"v0.0.1\", \"thresholds\": [{ \"closedLoopControlName\": \"ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e\", \"version\": \"1.0.2\", \"fieldPath\": \"$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value\", \"thresholdValue\": 0, \"direction\": \"EQUAL\", \"severity\": \"MAJOR\", \"closedLoopEventStatus\": \"ABATED\" }, { \"closedLoopControlName\": \"ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e\", \"version\": \"1.0.2\", \"fieldPath\": \"$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value\", \"thresholdValue\": 0, \"direction\": \"GREATER\", \"severity\": \"CRITICAL\", \"closedLoopEventStatus\": \"ONSET\" }] }] } } }", - "policyConfigType": "MicroService", - "policyName": "com.MicroServicevCPE", - "onapName": "DCAE" -}' 'https://pdp:8081/pdp/api/createPolicy' - -#########################################Create SDNC Naming Policies########################################## - -echo "Create SDNC Naming Policies" - -sleep 2 - -echo "Create SDNC vFW Naming Policy" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "configBody": "{\"service\":\"SDNC-GenerateName\",\"version\":\"CSIT\",\"content\":{\"policy-instance-name\":\"ONAP_VFW_NAMING_TIMESTAMP\",\"naming-models\":[{\"naming-properties\":[{\"property-name\":\"AIC_CLOUD_REGION\"},{\"property-name\":\"nfRole\"},{\"property-name\":\"TIMESTAMP\"},{\"property-value\":\"_\",\"property-name\":\"DELIMITER\"}],\"naming-type\":\"VNF\",\"nfRole\":\"vFW\",\"naming-recipe\":\"AIC_CLOUD_REGION|DELIMITER|nfRole|DELIMITER|TIMESTAMP\"},{\"naming-properties\":[{\"property-name\":\"VNF_NAME\"},{\"property-name\":\"SEQUENCE\",\"increment-sequence\":{\"max\":\"zzz\",\"scope\":\"ENTIRETY\",\"start-value\":\"001\",\"length\":\"3\",\"increment\":\"1\",\"sequence-type\":\"alpha-numeric\"}},{\"property-name\":\"NFC_NAMING_CODE\"},{\"property-value\":\"_\",\"property-name\":\"DELIMITER\"}],\"naming-type\":\"VNFC\",\"nfRole\":\"vFW\",\"naming-recipe\":\"VNF_NAME|DELIMITER|NFC_NAMING_CODE|DELIMITER|SEQUENCE\"},{\"naming-properties\":[{\"property-name\":\"VNF_NAME\"},{\"property-value\":\"_\",\"property-name\":\"DELIMITER\"},{\"property-name\":\"VF_MODULE_LABEL\"},{\"property-name\":\"VF_MODULE_TYPE\"},{\"property-name\":\"SEQUENCE\",\"increment-sequence\":{\"max\":\"zzz\",\"scope\":\"PRECEEDING\",\"start-value\":\"01\",\"length\":\"3\",\"increment\":\"1\",\"sequence-type\":\"alpha-numeric\"}}],\"naming-type\":\"VF-MODULE\",\"nfRole\":\"vFW\",\"naming-recipe\":\"VNF_NAME|DELIMITER|VF_MODULE_LABEL|DELIMITER|VF_MODULE_TYPE|DELIMITER|SEQUENCE\"},{\"naming-properties\":[{\"property-name\":\"VNF_NAME\"}],\"naming-type\":\"KEY\",\"nfRole\":\"vFW\",\"naming-recipe\":\"VNF_NAME\"},{\"naming-properties\":[{\"property-name\":\"VNF_NAME\"},{\"property-value\":\"protected\",\"property-name\":\"CONSTANT\"},{\"property-value\":\"_\",\"property-name\":\"DELIMITER\"}],\"naming-type\":\"protected_private_net_id\",\"nfRole\":\"vFW\",\"naming-recipe\":\"VNF_NAME|DELIMITER|CONSTANT\"},{\"naming-properties\":[{\"property-name\":\"VNF_NAME\"},{\"property-value\":\"unprotected\",\"property-name\":\"CONSTANT\"},{\"property-value\":\"_\",\"property-name\":\"DELIMITER\"}],\"naming-type\":\"unprotected_private_net_id\",\"nfRole\":\"vFW\",\"naming-recipe\":\"VNF_NAME|DELIMITER|CONSTANT\"}]}}", - "policyName": "SDNC_Policy.ONAP_VFW_NAMING_TIMESTAMP", - "policyConfigType": "MicroService", - "onapName": "SDNC", - "riskLevel": "4", - "riskType": "test", - "guard": "false", - "priority": "4", - "description": "ONAP_VFW_NAMING_TIMESTAMP" - }' 'https://pdp:8081/pdp/api/createPolicy' - - sleep 2 - - echo "Create SDNC vPG Naming Policy" - curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "configBody": "{\"service\":\"SDNC-GenerateName\",\"version\":\"CSIT\",\"content\":{\"policy-instance-name\":\"ONAP_VPG_NAMING_TIMESTAMP\",\"naming-models\":[{\"naming-properties\":[{\"property-name\":\"AIC_CLOUD_REGION\"},{\"property-name\":\"nfRole\"},{\"property-name\":\"TIMESTAMP\"},{\"property-value\":\"_\",\"property-name\":\"DELIMITER\"}],\"naming-type\":\"VNF\",\"nfRole\":\"vPG\",\"naming-recipe\":\"AIC_CLOUD_REGION|DELIMITER|nfRole|DELIMITER|TIMESTAMP\"},{\"naming-properties\":[{\"property-name\":\"VNF_NAME\"},{\"property-name\":\"SEQUENCE\",\"increment-sequence\":{\"max\":\"zzz\",\"scope\":\"ENTIRETY\",\"start-value\":\"001\",\"length\":\"3\",\"increment\":\"1\",\"sequence-type\":\"alpha-numeric\"}},{\"property-name\":\"NFC_NAMING_CODE\"},{\"property-value\":\"_\",\"property-name\":\"DELIMITER\"}],\"naming-type\":\"VNFC\",\"nfRole\":\"vPG\",\"naming-recipe\":\"VNF_NAME|DELIMITER|NFC_NAMING_CODE|DELIMITER|SEQUENCE\"},{\"naming-properties\":[{\"property-name\":\"VNF_NAME\"},{\"property-value\":\"_\",\"property-name\":\"DELIMITER\"},{\"property-name\":\"VF_MODULE_LABEL\"},{\"property-name\":\"VF_MODULE_TYPE\"},{\"property-name\":\"SEQUENCE\",\"increment-sequence\":{\"max\":\"zzz\",\"scope\":\"PRECEEDING\",\"start-value\":\"01\",\"length\":\"3\",\"increment\":\"1\",\"sequence-type\":\"alpha-numeric\"}}],\"naming-type\":\"VF-MODULE\",\"nfRole\":\"vPG\",\"naming-recipe\":\"VNF_NAME|DELIMITER|VF_MODULE_LABEL|DELIMITER|VF_MODULE_TYPE|DELIMITER|SEQUENCE\"},{\"naming-properties\":[{\"property-name\":\"VNF_NAME\"}],\"naming-type\":\"KEY\",\"nfRole\":\"vPG\",\"naming-recipe\":\"VNF_NAME\"},{\"naming-properties\":[{\"property-name\":\"VNF_NAME\"},{\"property-value\":\"protected\",\"property-name\":\"CONSTANT\"},{\"property-value\":\"_\",\"property-name\":\"DELIMITER\"}],\"naming-type\":\"protected_private_net_id\",\"nfRole\":\"vPG\",\"naming-recipe\":\"VNF_NAME|DELIMITER|CONSTANT\"},{\"naming-properties\":[{\"property-name\":\"VNF_NAME\"},{\"property-value\":\"unprotected\",\"property-name\":\"CONSTANT\"},{\"property-value\":\"_\",\"property-name\":\"DELIMITER\"}],\"naming-type\":\"unprotected_private_net_id\",\"nfRole\":\"vPG\",\"naming-recipe\":\"VNF_NAME|DELIMITER|CONSTANT\"}]}}", - "policyName": "SDNC_Policy.ONAP_VPG_NAMING_TIMESTAMP", - "policyConfigType": "MicroService", - "onapName": "SDNC", - "riskLevel": "4", - "riskType": "test", - "guard": "false", - "priority": "4", - "description": "ONAP_VPG_NAMING_TIMESTAMP" - }' 'https://pdp:8081/pdp/api/createPolicy' - -#########################################Creating OOF PCI Policies########################################## -sleep 2 - -echo "Create MicroServicevPCI Policy" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "configBody": "{ \"service\": \"tca_policy\", \"location\": \"SampleServiceLocation_pci\", \"uuid\": \"test_pci\", \"policyName\": \"MicroServicevPCI\", \"description\": \"MicroService vPCI Policy\", \"configName\": \"SampleConfigName\", \"templateVersion\": \"OpenSource.version.1\", \"version\": \"1.1.0\", \"priority\": \"1\", \"policyScope\": \"resource=SampleResource,service=SampleService,type=SampleType,closedLoopControlName=ControlLoop-vPCI-fb41f388-a5f2-11e8-98d0-529269fb1459\", \"riskType\": \"SampleRiskType\", \"riskLevel\": \"1\", \"guard\": \"False\", \"content\": { \"tca_policy\": { \"domain\": \"measurementsForVfScaling\", \"metricsPerEventName\": [{ \"eventName\": \"vFirewallBroadcastPackets\", \"controlLoopSchemaType\": \"VNF\", \"policyScope\": \"DCAE\", \"policyName\": \"DCAE.Config_tca-hi-lo\", \"policyVersion\": \"v0.0.1\", \"thresholds\": [{ \"closedLoopControlName\": \"ControlLoop-vPCI-fb41f388-a5f2-11e8-98d0-529269fb1459\", \"version\": \"1.0.2\", \"fieldPath\": \"$.event.executePolicy\", \"thresholdValue\": 1, \"direction\": \"GREATER_OR_EQUAL\", \"severity\": \"MAJOR\", \"closedLoopEventStatus\": \"ONSET\" } ] }] } } }", - "policyConfigType": "MicroService", - "policyName": "com.MicroServicevPCI", - "onapName": "DCAE" -}' 'https://pdp:8081/pdp/api/createPolicy' - -sleep 2 - -echo "Create PCI MS Config Policy" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "policyName": "com.PCIMS_CONFIG_POLICY", - "configBody": "{ \"PCI_NEIGHBOR_CHANGE_CLUSTER_TIMEOUT_IN_SECS\":60, \"PCI_MODCONFIG_POLICY_NAME\":\"ControlLoop-vPCI-fb41f388-a5f2-11e8-98d0-529269fb1459\", \"PCI_OPTMIZATION_ALGO_CATEGORY_IN_OOF\":\"OOF-PCI-OPTIMIZATION\", \"PCI_SDNR_TARGET_NAME\":\"SDNR\" }", - "policyType": "Config", - "attributes" : { "matching" : { "key1" : "value1" } }, - "policyConfigType": "Base", - "onapName": "DCAE", - "configName": "PCIMS_CONFIG_POLICY", - "configBodyType": "JSON" -}' 'https://pdp:8081/pdp/api/createPolicy' - -sleep 2 - -echo "Create OOF Config Policy" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "policyName": "com.OOF_PCI_CONFIG_POLICY", - "configBody": "{ \"ALGO_CATEGORY\":\"OOF-PCI-OPTIMIZATION\", \"PCI_OPTMIZATION_ALGO_NAME\":\"OOF-PCI-OPTIMIZATION-LEVEL1\", \"PCI_OPTIMIZATION_NW_CONSTRAINT\":\"MAX5PCICHANGESONLY\", \"PCI_OPTIMIZATION_PRIORITY\": 2, \"PCI_OPTIMIZATION_TIME_CONSTRAINT\":\"ONLYATNIGHT\" }", - "attributes" : { "matching" : { "key1" : "value1" } }, - "policyType": "Config", - "policyConfigType": "Base", - "onapName": "DCAE", - "configName": "OOF_PCI_CONFIG_POLICY", - "configBodyType": "JSON" -}' 'https://pdp:8081/pdp/api/createPolicy' - -#########################################Creating Decision Guard policies######################################### - -sleep 2 - -echo "Creating Decision Guard policy" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "policyClass": "Decision", - "policyName": "com.AllPermitGuard", - "policyDescription": "Testing all Permit YAML Guard Policy", - "onapName": "PDPD", - "ruleProvider": "GUARD_YAML", - "attributes": { - "MATCHING": { - "actor": ".*", - "recipe": ".*", - "targets": ".*", - "clname": ".*", - "limit": "10", - "timeWindow": "1", - "timeUnits": "minute", - "guardActiveStart": "00:00:01-05:00", - "guardActiveEnd": "23:59:59-05:00" - } - } -}' 'https://pdp:8081/pdp/api/createPolicy' - -sleep 2 - -echo "Creating Decision vDNS Guard - Frequency Limiter policy" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "policyClass": "Decision", - "policyName": "com.vDNS_Frequency", - "policyDescription": "Limit vDNS Scale Up over time period", - "onapName": "PDPD", - "ruleProvider": "GUARD_YAML", - "attributes": { - "MATCHING": { - "actor": "SO", - "recipe": "scaleOut", - "targets": ".*", - "clname": "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3", - "limit": "1", - "timeWindow": "10", - "timeUnits": "minute", - "guardActiveStart": "00:00:01-05:00", - "guardActiveEnd": "23:59:59-05:00" - } - } -}' 'https://pdp:8081/pdp/api/createPolicy' - -sleep 2 - -echo "Creating Decision vDNS Guard - Min/Max policy" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "policyClass": "Decision", - "policyName": "com.vDNS_MinMax", - "policyDescription": "Ensure number of instances within a range", - "onapName": "SampleDemo", - "ruleProvider": "GUARD_MIN_MAX", - "attributes": { - "MATCHING": { - "actor": "SO", - "recipe": "scaleOut", - "targets": ".*", - "clname": "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3", - "min": "1", - "max": "5", - "guardActiveStart": "00:00:01-05:00", - "guardActiveEnd": "23:59:59-05:00" - } - } -}' 'https://pdp:8081/pdp/api/createPolicy' - -#########################################Push Decision policy######################################### - -sleep 2 - -echo "Push Decision policy" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "pdpGroup": "default", - "policyName": "com.AllPermitGuard", - "policyType": "DECISION" -}' 'https://pdp:8081/pdp/api/pushPolicy' - -sleep 2 - -echo "Push Decision policy" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "pdpGroup": "default", - "policyName": "com.vDNS_Frequency", - "policyType": "DECISION" -}' 'https://pdp:8081/pdp/api/pushPolicy' - -sleep 2 - -echo "Push Decision policy" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "pdpGroup": "default", - "policyName": "com.vDNS_MinMax", - "policyType": "DECISION" -}' 'https://pdp:8081/pdp/api/pushPolicy' - -#########################################Pushing BRMS Param policies########################################## - -echo "Pushing BRMSParam Operational policies" - -sleep 2 - -echo "pushPolicy : PUT : com.BRMSParamvFirewall" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "pdpGroup": "default", - "policyName": "com.BRMSParamvFirewall", - "policyType": "BRMS_Param" -}' 'https://pdp:8081/pdp/api/pushPolicy' - -sleep 2 - -echo "pushPolicy : PUT : com.BRMSParamvDNS" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "pdpGroup": "default", - "policyName": "com.BRMSParamvDNS", - "policyType": "BRMS_Param" -}' 'https://pdp:8081/pdp/api/pushPolicy' - -sleep 2 - -echo "pushPolicy : PUT : com.BRMSParamVOLTE" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "pdpGroup": "default", - "policyName": "com.BRMSParamVOLTE", - "policyType": "BRMS_Param" -}' 'https://pdp:8081/pdp/api/pushPolicy' - -sleep 2 - -echo "pushPolicy : PUT : com.BRMSParamvCPE" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "pdpGroup": "default", - "policyName": "com.BRMSParamvCPE", - "policyType": "BRMS_Param" -}' 'https://pdp:8081/pdp/api/pushPolicy' - -sleep 2 - -echo "pushPolicy : PUT : com.BRMSParamvPCI" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "pdpGroup": "default", - "policyName": "com.BRMSParamvPCI", - "policyType": "BRMS_Param" -}' 'https://pdp:8081/pdp/api/pushPolicy' - -sleep 2 - -echo "pushPolicy : PUT : com.BRMSParamCCVPN" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "pdpGroup": "default", - "policyName": "com.BRMSParamCCVPN", - "policyType": "BRMS_Param" -}' 'https://pdp:8081/pdp/api/pushPolicy' - -#########################################Pushing MicroService Config policies########################################## - -echo "Pushing MicroService Config policies" - -sleep 2 - -echo "pushPolicy : PUT : com.MicroServicevFirewall" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "pdpGroup": "default", - "policyName": "com.MicroServicevFirewall", - "policyType": "MicroService" -}' 'https://pdp:8081/pdp/api/pushPolicy' - -sleep 10 - -echo "pushPolicy : PUT : com.MicroServicevDNS" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "pdpGroup": "default", - "policyName": "com.MicroServicevDNS", - "policyType": "MicroService" -}' 'https://pdp:8081/pdp/api/pushPolicy' - -sleep 10 - -echo "pushPolicy : PUT : com.MicroServicevCPE" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "pdpGroup": "default", - "policyName": "com.MicroServicevCPE", - "policyType": "MicroService" -}' 'https://pdp:8081/pdp/api/pushPolicy' - -#########################################Pushing SDNC Naming Policies########################################## -echo "Pushing SDNC Naming Policies" - -sleep 2 - -echo "pushPolicy : PUT : SDNC_Policy.ONAP_VFW_NAMING_TIMESTAMP" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "pdpGroup": "default", - "policyName": "SDNC_Policy.ONAP_VFW_NAMING_TIMESTAMP", - "policyType": "MicroService" -}' 'https://pdp:8081/pdp/api/pushPolicy' - -sleep 10 - -echo "pushPolicy : PUT : SDNC_Policy.ONAP_VPG_NAMING_TIMESTAMP" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "pdpGroup": "default", - "policyName": "SDNC_Policy.ONAP_VPG_NAMING_TIMESTAMP", - "policyType": "MicroService" -}' 'https://pdp:8081/pdp/api/pushPolicy' - - -#########################################Pushing OOF PCI Policies########################################## -sleep 10 - -echo "pushPolicy : PUT : com.MicroServicevPCI" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "pdpGroup": "default", - "policyName": "com.MicroServicevPCI", - "policyType": "MicroService" -}' 'https://pdp:8081/pdp/api/pushPolicy' - -sleep 10 - -echo "pushPolicy : PUT : com.PCIMS_CONFIG_POLICY" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "pdpGroup": "default", - "policyName": "com.PCIMS_CONFIG_POLICY", - "policyType": "Base" -}' 'https://pdp:8081/pdp/api/pushPolicy' - -sleep 10 - -echo "pushPolicy : PUT : com.OOF_PCI_CONFIG_POLICY" -curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ - "pdpGroup": "default", - "policyName": "com.OOF_PCI_CONFIG_POLICY", - "policyType": "Base" -}' 'https://pdp:8081/pdp/api/pushPolicy' diff --git a/scripts/policy/config/sim-all/simParameters.json b/scripts/policy/config/sim-all/simParameters.json index e98acc03..4b009b6f 100644 --- a/scripts/policy/config/sim-all/simParameters.json +++ b/scripts/policy/config/sim-all/simParameters.json @@ -1,8 +1,7 @@ { "dmaapProvider": { "name": "DMaaP simulator", - "topicSweepSec": 300, - "restServerParameters": { } + "topicSweepSec": 300 }, "restServers": [ { @@ -94,5 +93,17 @@ "sink": "APPC-LCM-WRITE", "source": "APPC-LCM-READ" } - ] + ], + "grpcServer": { + "name": "CDS simulator", + "providerClass": "org.onap.policy.simulators.CdsSimulator", + "host": "0.0.0.0", + "port": 6680, + "timeout": 30, + "username": "ccsdkapps", + "password": "ccsdkapps", + "resourceLocation": "org/onap/policy/simulators/cds/", + "successRepeatCount": 0, + "requestedResponseDelayMs": 0 + } } diff --git a/scripts/policy/drools-apps/custom/xacmlDefaultConfig.json b/scripts/policy/config/xacml-pdp/defaultConfig.json similarity index 100% rename from scripts/policy/drools-apps/custom/xacmlDefaultConfig.json rename to scripts/policy/config/xacml-pdp/defaultConfig.json diff --git a/scripts/policy/detmVers.sh b/scripts/policy/detmVers.sh new file mode 100644 index 00000000..d37b4792 --- /dev/null +++ b/scripts/policy/detmVers.sh @@ -0,0 +1,80 @@ +# ============LICENSE_START==================================================== +# Copyright (C) 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. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END====================================================== + +SCRIPTS="${SCRIPTS-scripts}" + +source ${SCRIPTS}/policy/config/policy-csit.conf +export POLICY_MARIADB_VER + +echo POLICY_MARIADB_VER=${POLICY_MARIADB_VER} + +POLICY_MODELS_VERSION=$( + curl -q --silent \ + https://git.onap.org/policy/models/plain/pom.xml?h=${GERRIT_BRANCH} | + xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -) +export POLICY_MODELS_VERSION=${POLICY_MODELS_VERSION:0:3}-SNAPSHOT-latest +echo POLICY_MODELS_VERSION=${POLICY_MODELS_VERSION} + +POLICY_API_VERSION=$( + 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:0:3}-SNAPSHOT-latest +echo POLICY_API_VERSION=${POLICY_API_VERSION} + +POLICY_PAP_VERSION=$( + 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:0:3}-SNAPSHOT-latest +echo POLICY_PAP_VERSION=${POLICY_PAP_VERSION} + +POLICY_XACML_PDP_VERSION=$( + 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:0:3}-SNAPSHOT-latest +echo POLICY_XACML_PDP_VERSION=${POLICY_XACML_PDP_VERSION} + +POLICY_DROOLS_VERSION=$( + curl -q --silent \ + https://git.onap.org/policy/drools-pdp/plain/pom.xml?h=${GERRIT_BRANCH} | + xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -) +export POLICY_DROOLS_VERSION=${POLICY_DROOLS_VERSION:0:3}-SNAPSHOT-latest +echo POLICY_DROOLS_VERSION=${POLICY_DROOLS_VERSION} + +POLICY_DROOLS_APPS_VERSION=$( + 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_APPS_VERSION=${POLICY_DROOLS_APPS_VERSION:0:3}-SNAPSHOT-latest +echo POLICY_DROOLS_APPS_VERSION=${POLICY_DROOLS_APPS_VERSION} + +POLICY_APEX_PDP_VERSION=$( + 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:0:3}-SNAPSHOT-latest +echo POLICY_APEX_PDP_VERSION=${POLICY_APEX_PDP_VERSION} + +POLICY_DISTRIBUTION_VERSION=$( + 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:0:3}-SNAPSHOT-latest +echo POLICY_DISTRIBUTION_VERSION=${POLICY_DISTRIBUTION_VERSION} diff --git a/scripts/policy/docker-compose-all.yml b/scripts/policy/docker-compose-all.yml new file mode 100644 index 00000000..55044c91 --- /dev/null +++ b/scripts/policy/docker-compose-all.yml @@ -0,0 +1,190 @@ +# +# ===========LICENSE_START==================================================== +# Copyright (C) 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. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END===================================================== +# +version: '2' +services: + mariadb: + image: mariadb:${POLICY_MARIADB_VER} + container_name: mariadb + hostname: mariadb + command: ['--lower-case-table-names=1', '--wait_timeout=28800'] + env_file: config/db/db.conf + volumes: + - ./config/db:/docker-entrypoint-initdb.d:ro + expose: + - 3306 + policy.api.simpledemo.onap.org: + image: nexus3.onap.org:10001/onap/policy-models-simulator:${POLICY_MODELS_VERSION} + container_name: policy.api.simpledemo.onap.org + hostname: policy.api.simpledemo.onap.org + volumes: + - ./config/sim-all:/opt/app/policy/simulators/etc/mounted:ro + expose: + - 6666 + - 6668 + - 6669 + - 6670 + - 3905 + api: + image: nexus3.onap.org:10001/onap/policy-api:${POLICY_API_VERSION} + container_name: policy-api + depends_on: + - mariadb + hostname: policy-api + expose: + - 6969 + volumes: + - ./wait_for_port.sh:/opt/app/policy/api/bin/wait_for_port.sh:ro + entrypoint: ./wait_for_port.sh + command: [ + '-c', 'bash ./policy-api.sh', + 'mariadb', '3306' + ] + pap: + image: nexus3.onap.org:10001/onap/policy-pap:${POLICY_PAP_VERSION} + container_name: policy-pap + depends_on: + - mariadb + - policy.api.simpledemo.onap.org + - api + hostname: policy-pap + expose: + - 6969 + volumes: + - ./config/pap/defaultConfig.json:/opt/app/policy/pap/etc/defaultConfig.json:ro + - ./wait_for_port.sh:/opt/app/policy/pap/bin/wait_for_port.sh:ro + entrypoint: ./wait_for_port.sh + command: [ + '-c', 'bash ./policy-pap.sh', + 'mariadb', '3306', + 'policy.api.simpledemo.onap.org', '3905', + 'api', '6969' + ] + xacml-pdp: + image: nexus3.onap.org:10001/onap/policy-xacml-pdp:${POLICY_XACML_PDP_VERSION} + container_name: policy-xacml-pdp + depends_on: + - mariadb + - policy.api.simpledemo.onap.org + - pap + hostname: policy-xacml-pdp + expose: + - 6969 + volumes: + - ./config/xacml-pdp/defaultConfig.json:/opt/app/policy/pdpx/etc/defaultConfig.json:ro + - ./wait_for_port.sh:/opt/app/policy/pdpx/bin/wait_for_port.sh:ro + entrypoint: ./wait_for_port.sh + command: [ + '-c', 'bash ./policy-pdpx.sh', + 'mariadb', '3306', + 'policy.api.simpledemo.onap.org', '3905', + 'pap', '6969' + ] + drools: + image: nexus3.onap.org:10001/onap/policy-drools:${POLICY_DROOLS_VERSION} + container_name: drools + depends_on: + - mariadb + - policy.api.simpledemo.onap.org + - pap + hostname: drools + expose: + - 6969 + - 9696 + volumes: + - ./config/drools/custom:/tmp/policy-install/config:ro + - ./wait_for_port.sh:/opt/app/policy/bin/wait_for_port.sh:ro + env_file: + - config/drools/env/base.conf + entrypoint: /opt/app/policy/bin/wait_for_port.sh + command: [ + '-c', '/opt/app/policy/bin/pdpd-entrypoint.sh boot', + 'mariadb', '3306', + 'policy.api.simpledemo.onap.org', '3905' + ] + drools-apps: + image: nexus3.onap.org:10001/onap/policy-pdpd-cl:${POLICY_DROOLS_APPS_VERSION} + container_name: drools-apps + depends_on: + - mariadb + - policy.api.simpledemo.onap.org + - pap + - xacml-pdp + hostname: drools-apps + expose: + - 6969 + - 9696 + volumes: + - ./config/drools-apps/custom:/tmp/policy-install/config:ro + - ./wait_for_port.sh:/opt/app/policy/bin/wait_for_port.sh:ro + env_file: + - config/drools-apps/env/base.conf + - config/drools-apps/env/feature-healthcheck.conf + - config/drools-apps/env/feature-pooling-dmaap.conf + entrypoint: /opt/app/policy/bin/wait_for_port.sh + command: [ + '-c', '/opt/app/policy/bin/pdpd-cl-entrypoint.sh boot', + 'mariadb', '3306', + 'policy.api.simpledemo.onap.org', '3905', + 'pap', '6969', + 'policy.api.simpledemo.onap.org', '6666', + 'policy.api.simpledemo.onap.org', '6668', + 'policy.api.simpledemo.onap.org', '6669', + 'policy.api.simpledemo.onap.org', '6670' + ] + apex-pdp: + image: nexus3.onap.org:10001/onap/policy-apex-pdp:${POLICY_APEX_PDP_VERSION} + container_name: policy-apex-pdp + depends_on: + - mariadb + - policy.api.simpledemo.onap.org + - pap + hostname: policy-apex-pdp + expose: + - 6969 + - 23324 + volumes: + - ./config/apex-pdp/OnapPfConfig.json:/opt/app/policy/apex-pdp/etc/onappf/config/OnapPfConfig.json:ro + - ./wait_for_port.sh:/opt/app/policy/bin/wait_for_port.sh:ro + entrypoint: /opt/app/policy/bin/wait_for_port.sh + command: [ + '-c', '/opt/app/policy/apex-pdp/bin/apexOnapPf.sh -c /opt/app/policy/apex-pdp/etc/onappf/config/OnapPfConfig.json', + 'mariadb', '3306', + 'policy.api.simpledemo.onap.org', '3905', + 'pap', '6969' + ] + distribution: + image: nexus3.onap.org:10001/onap/policy-distribution:${POLICY_DISTRIBUTION_VERSION} + container_name: policy-distribution + depends_on: + - mariadb + - api + - pap + - apex-pdp + hostname: policy-distribution + volumes: + - ./config/distribution/defaultConfig.json:/opt/app/policy/distribution/etc/defaultConfig.json:ro + - ./policy-distribution/config/distribution/temp/:/opt/app/policy/distribution/etc/temp/:ro + - ./wait_for_port.sh:/opt/app/policy/bin/wait_for_port.sh:ro + entrypoint: /opt/app/policy/bin/wait_for_port.sh + command: [ + '-c', './policy-dist.sh', + 'mariadb', '3306', + 'policy.api.simpledemo.onap.org', '3905', + 'pap', '6969', + 'apex-pdp', '6969' + ] diff --git a/scripts/policy/docker-compose-api.yml b/scripts/policy/docker-compose-api.yml deleted file mode 100644 index e32190f1..00000000 --- a/scripts/policy/docker-compose-api.yml +++ /dev/null @@ -1,54 +0,0 @@ -# Copyright 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. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -version: '2' -services: - mariadb: - image: mariadb:${POLICY_MARIADB_VER} - container_name: mariadb - hostname: mariadb - command: ['--lower-case-table-names=1', '--wait_timeout=28800'] - env_file: config/db/db.conf - volumes: - - ./config/db:/docker-entrypoint-initdb.d - expose: - - 3306 - api: - image: nexus3.onap.org:10001/onap/policy-api:${POLICY_API_VERSION} - container_name: policy-api - depends_on: - - mariadb - hostname: policy-api - expose: - - 6969 - start_dependencies: - image: dadarek/wait-for-dependencies - environment: - TIMEOUT_LENGTH: 60 - container_name: policy-wait - depends_on: - - mariadb - hostname: policy-wait - command: mariadb:3306 - start_all: - image: dadarek/wait-for-dependencies - environment: - TIMEOUT_LENGTH: 60 - container_name: policy-wait-all - depends_on: - - mariadb - - api - hostname: policy-wait-all - command: - mariadb:3306 - api:6969 diff --git a/scripts/policy/docker-compose-drools.yml b/scripts/policy/docker-compose-drools.yml deleted file mode 100644 index 5fc6ef67..00000000 --- a/scripts/policy/docker-compose-drools.yml +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright 2018-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. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -version: '2' -services: - mariadb: - image: mariadb:${POLICY_MARIADB_VER} - container_name: mariadb - hostname: mariadb - command: ['--lower-case-table-names=1', '--wait_timeout=28800'] - env_file: - - ${WORKSPACE}/scripts/policy/config/db/db.conf - volumes: - - ${WORKSPACE}/scripts/policy/config/db:/docker-entrypoint-initdb.d - expose: - - 3306 - nexus: - image: sonatype/nexus:2.14.8-01 - container_name: nexus - hostname: nexus - expose: - - 8081 - drools: - image: nexus3.onap.org:10001/onap/policy-drools:${POLICY_DROOLS_VERSION} - container_name: drools - depends_on: - - mariadb - - nexus - hostname: drools - expose: - - 6969 - - 9696 - volumes: - - ${WORKSPACE}/scripts/policy/config/drools/custom:/tmp/policy-install/config - env_file: - - ${WORKSPACE}/scripts/policy/config/drools/env/base.conf diff --git a/scripts/policy/docker-compose-engine.yml b/scripts/policy/docker-compose-engine.yml deleted file mode 100644 index 1fc5f9f3..00000000 --- a/scripts/policy/docker-compose-engine.yml +++ /dev/null @@ -1,64 +0,0 @@ -# Copyright 2018 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. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -version: '2' -services: - mariadb: - image: mariadb:${POLICY_MARIADB_VER} - container_name: mariadb - hostname: mariadb - command: ['--lower-case-table-names=1', '--wait_timeout=28800'] - env_file: - - ${WORKSPACE}/scripts/policy/config/db/db.conf - volumes: - - ${WORKSPACE}/scripts/policy/config/db:/docker-entrypoint-initdb.d - expose: - - 3306 - nexus: - image: sonatype/nexus:2.14.8-01 - container_name: nexus - hostname: nexus - pap: - image: nexus3.onap.org:10001/onap/policy-pe:${POLICY_ENGINE_VERSION} - environment: - - PRELOAD_POLICIES=${PRELOAD_POLICIES} - container_name: pap - depends_on: - - mariadb - hostname: pap - expose: - - 8443 - - 9091 - command: pap - volumes: - - ${WORKSPACE}/scripts/policy/config/pe:/tmp/policy-install/config - pdp: - image: nexus3.onap.org:10001/onap/policy-pe:${POLICY_ENGINE_VERSION} - container_name: pdp - depends_on: - - pap - hostname: pdp - expose: - - 8081 - command: pdp - volumes: - - ./config/pe:/tmp/policy-install/config - brmsgw: - image: nexus3.onap.org:10001/onap/policy-pe:${POLICY_ENGINE_VERSION} - container_name: brmsgw - depends_on: - - pap - hostname: brmsgw - command: brmsgw - volumes: - - ${WORKSPACE}/scripts/policy/config/pe:/tmp/policy-install/config diff --git a/scripts/policy/docker-compose-pap.yml b/scripts/policy/docker-compose-pap.yml deleted file mode 100644 index 934e1739..00000000 --- a/scripts/policy/docker-compose-pap.yml +++ /dev/null @@ -1,74 +0,0 @@ -# Copyright 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. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -version: '2' -services: - mariadb: - image: mariadb:${POLICY_MARIADB_VER} - container_name: mariadb - hostname: mariadb - command: ['--lower-case-table-names=1', '--wait_timeout=28800'] - env_file: config/db/db.conf - volumes: - - ./config/db:/docker-entrypoint-initdb.d - expose: - - 3306 - message-router: - image: dmaap/simulator - container_name: dmaap-simulator - hostname: dmaap-simulator - expose: - - 3904 - pap: - image: nexus3.onap.org:10001/onap/policy-pap:${POLICY_PAP_VERSION} - container_name: policy-pap - depends_on: - - mariadb - hostname: policy-pap - expose: - - 6969 - api: - image: nexus3.onap.org:10001/onap/policy-api:${POLICY_API_VERSION} - container_name: policy-api - depends_on: - - mariadb - hostname: policy-api - expose: - - 6969 - start_dependencies: - image: dadarek/wait-for-dependencies - environment: - TIMEOUT_LENGTH: 60 - container_name: policy-wait - depends_on: - - mariadb - - message-router - hostname: policy-wait - command: - mariadb:3306 - message-router:3904 - start_all: - image: dadarek/wait-for-dependencies - environment: - TIMEOUT_LENGTH: 60 - container_name: policy-wait-all - depends_on: - - mariadb - - pap - - api - hostname: policy-wait-all - command: - mariadb:3306 - message-router:3904 - pap:6969 - api:6969 diff --git a/scripts/policy/drools-apps/docker-compose-drools-apps.yml b/scripts/policy/drools-apps/docker-compose-drools-apps.yml deleted file mode 100644 index 5098a177..00000000 --- a/scripts/policy/drools-apps/docker-compose-drools-apps.yml +++ /dev/null @@ -1,139 +0,0 @@ -# -# ===========LICENSE_START==================================================== -# Copyright (C) 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. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============LICENSE_END===================================================== -# -version: '2' -services: - mariadb: - image: mariadb:${POLICY_MARIADB_VER} - container_name: mariadb - hostname: mariadb - command: ['--lower-case-table-names=1', '--wait_timeout=28800'] - env_file: ../config/db/db.conf - volumes: - - ../config/db:/docker-entrypoint-initdb.d:ro - expose: - - 3306 - policy.api.simpledemo.onap.org: - image: policy/simulators - container_name: policy.api.simpledemo.onap.org - hostname: policy.api.simpledemo.onap.org - volumes: - - ../config/sim-all:/opt/app/policy/simulators/etc/parameters:ro - expose: - - 6666 - - 6668 - - 6669 - - 6670 - - 3905 - api: - image: nexus3.onap.org:10001/onap/policy-api:${POLICY_API_VERSION} - container_name: policy-api - depends_on: - - mariadb - hostname: policy-api - expose: - - 6969 - pap: - image: nexus3.onap.org:10001/onap/policy-pap:${POLICY_PAP_VERSION} - container_name: policy-pap - depends_on: - - mariadb - hostname: policy-pap - expose: - - 6969 - volumes: - - ./custom/papDefaultConfig.json:/opt/app/policy/pap/etc/defaultConfig.json:ro - policy-xacml-pdp: - image: nexus3.onap.org:10001/onap/policy-xacml-pdp:${POLICY_XACML_PDP_VERSION} - container_name: policy-xacml-pdp - depends_on: - - mariadb - - policy.api.simpledemo.onap.org - hostname: policy-xacml-pdp - expose: - - 6969 - volumes: - - ./custom/xacmlDefaultConfig.json:/opt/app/policy/pdpx/etc/defaultConfig.json:ro - drools: - image: nexus3.onap.org:10001/onap/policy-pdpd-cl:${POLICY_DROOLS_APPS_VERSION} - container_name: drools - depends_on: - - mariadb - - policy.api.simpledemo.onap.org - hostname: drools - expose: - - 6969 - - 9696 - volumes: - - ../config/drools-apps/custom:/tmp/policy-install/config:ro - env_file: - - ../config/drools-apps/env/base.conf - - ../config/drools-apps/env/feature-healthcheck.conf - - ../config/drools-apps/env/feature-pooling-dmaap.conf - start_dependencies: - image: dadarek/wait-for-dependencies - environment: - TIMEOUT_LENGTH: 60 - container_name: policy-wait - depends_on: - - mariadb - - policy.api.simpledemo.onap.org - hostname: policy-wait - command: - mariadb:3306 - policy.api.simpledemo.onap.org:6666 - policy.api.simpledemo.onap.org:6668 - policy.api.simpledemo.onap.org:6669 - policy.api.simpledemo.onap.org:6670 - policy.api.simpledemo.onap.org:3905 - start_pap: - image: dadarek/wait-for-dependencies - environment: - TIMEOUT_LENGTH: 120 - container_name: policy-wait-pap - depends_on: - - mariadb - - policy.api.simpledemo.onap.org - - pap - hostname: policy-wait-pap - command: - mariadb:3306 - policy.api.simpledemo.onap.org:3905 - pap:6969 - start_all: - image: dadarek/wait-for-dependencies - environment: - TIMEOUT_LENGTH: 120 - container_name: policy-wait-all - depends_on: - - mariadb - - policy.api.simpledemo.onap.org - - api - - pap - - policy-xacml-pdp - - drools - hostname: policy-wait-all - command: - mariadb:3306 - policy.api.simpledemo.onap.org:6666 - policy.api.simpledemo.onap.org:6668 - policy.api.simpledemo.onap.org:6669 - policy.api.simpledemo.onap.org:6670 - policy.api.simpledemo.onap.org:3905 - api:6969 - pap:6969 - drools:6969 diff --git a/scripts/policy/policy-xacml-pdp/config/db/db.conf b/scripts/policy/get-models-examples.sh similarity index 68% rename from scripts/policy/policy-xacml-pdp/config/db/db.conf rename to scripts/policy/get-models-examples.sh index b4449118..1860511e 100644 --- a/scripts/policy/policy-xacml-pdp/config/db/db.conf +++ b/scripts/policy/get-models-examples.sh @@ -1,6 +1,8 @@ -# ============LICENSE_START======================================================= -# Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. -# ================================================================================ +#!/bin/bash +# +# ============LICENSE_START=================================================== +# Copyright (C) 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. # You may obtain a copy of the License at @@ -12,9 +14,14 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# ============LICENSE_END===================================================== # -# SPDX-License-Identifier: Apache-2.0 -# ============LICENSE_END========================================================= -MYSQL_ROOT_PASSWORD=secret -MYSQL_USER=policy_user -MYSQL_PASSWORD=policy_user \ No newline at end of file + +source ${SCRIPTS}/policy/config/policy-csit.conf + +rm -rf ${WORKSPACE}/models +mkdir ${WORKSPACE}/models +cd ${WORKSPACE} + +# download models examples +git clone --depth 1 https://gerrit.onap.org/r/policy/models -b ${GERRIT_BRANCH} diff --git a/scripts/policy/policy-apex-pdp/config/db/db.conf b/scripts/policy/policy-apex-pdp/config/db/db.conf deleted file mode 100644 index 4768bfc4..00000000 --- a/scripts/policy/policy-apex-pdp/config/db/db.conf +++ /dev/null @@ -1,16 +0,0 @@ -# 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. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -MYSQL_ROOT_PASSWORD=secret -MYSQL_USER=policy_user -MYSQL_PASSWORD=policy_user diff --git a/scripts/policy/policy-apex-pdp/config/db/db.sh b/scripts/policy/policy-apex-pdp/config/db/db.sh deleted file mode 100644 index 660f2c5a..00000000 --- a/scripts/policy/policy-apex-pdp/config/db/db.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -xv -# 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. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -for db in policyadmin -do - mysql -uroot -p"${MYSQL_ROOT_PASSWORD}" --execute "CREATE DATABASE IF NOT EXISTS ${db};" - mysql -uroot -p"${MYSQL_ROOT_PASSWORD}" --execute "GRANT ALL PRIVILEGES ON \`${db}\`.* TO '${MYSQL_USER}'@'%' ;" -done - -mysql -uroot -p"${MYSQL_ROOT_PASSWORD}" --execute "FLUSH PRIVILEGES;" diff --git a/scripts/policy/policy-apex-pdp/docker-compose-apex.yml b/scripts/policy/policy-apex-pdp/docker-compose-apex.yml deleted file mode 100644 index b7ba21c8..00000000 --- a/scripts/policy/policy-apex-pdp/docker-compose-apex.yml +++ /dev/null @@ -1,92 +0,0 @@ -# Copyright (C) 2019 Nordix Foundation. -# Modifications Copyright (C) 2019 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. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -version: '2' -networks: - default: - driver: bridge -services: - mariadb: - image: mariadb:${POLICY_MARIADB_VER} - container_name: mariadb - hostname: mariadb - command: ['--lower-case-table-names=1', '--wait_timeout=28800'] - env_file: config/db/db.conf - volumes: - - ./config/db:/docker-entrypoint-initdb.d - ports: - - "3306:3306" - message-router: - image: dmaap/simulator - container_name: dmaap-simulator - hostname: dmaap-simulator - ports: - - "3904:3904" - pap: - image: nexus3.onap.org:10001/onap/policy-pap:${POLICY_PAP_VERSION} - container_name: policy-pap - depends_on: - - mariadb - - message-router - hostname: policy-pap - - api: - image: nexus3.onap.org:10001/onap/policy-api:${POLICY_API_VERSION} - container_name: policy-api - depends_on: - - mariadb - hostname: policy-api - apex: - image: nexus3.onap.org:10001/onap/policy-apex-pdp:${POLICY_APEX_PDP_VERSION} - container_name: policy-apex-pdp - depends_on: - - mariadb - - message-router - - pap - hostname: policy-apex-pdp - command: ['/opt/app/policy/apex-pdp/bin/apexOnapPf.sh', '-c', '/opt/app/policy/apex-pdp/etc/onappf/config/OnapPfConfig.json'] - - ports: - - "6969:6969" - - "23324:23324" - start_dependencies: - image: dadarek/wait-for-dependencies - environment: - TIMEOUT_LENGTH: 60 - container_name: policy-wait - depends_on: - - mariadb - - message-router - hostname: policy-wait - command: - mariadb:3306 - message-router:3904 - start_all: - image: dadarek/wait-for-dependencies - environment: - TIMEOUT_LENGTH: 60 - container_name: policy-wait-all - depends_on: - - mariadb - - message-router - - api - - pap - - apex - hostname: policy-wait-all - command: - mariadb:3306 - message-router:3904 - api:6969 - pap:6969 - apex:6969 diff --git a/scripts/policy/policy-distribution/config/db/db.conf b/scripts/policy/policy-distribution/config/db/db.conf deleted file mode 100644 index 4768bfc4..00000000 --- a/scripts/policy/policy-distribution/config/db/db.conf +++ /dev/null @@ -1,16 +0,0 @@ -# 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. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -MYSQL_ROOT_PASSWORD=secret -MYSQL_USER=policy_user -MYSQL_PASSWORD=policy_user diff --git a/scripts/policy/policy-distribution/config/db/db.sh b/scripts/policy/policy-distribution/config/db/db.sh deleted file mode 100644 index 660f2c5a..00000000 --- a/scripts/policy/policy-distribution/config/db/db.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -xv -# 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. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -for db in policyadmin -do - mysql -uroot -p"${MYSQL_ROOT_PASSWORD}" --execute "CREATE DATABASE IF NOT EXISTS ${db};" - mysql -uroot -p"${MYSQL_ROOT_PASSWORD}" --execute "GRANT ALL PRIVILEGES ON \`${db}\`.* TO '${MYSQL_USER}'@'%' ;" -done - -mysql -uroot -p"${MYSQL_ROOT_PASSWORD}" --execute "FLUSH PRIVILEGES;" diff --git a/scripts/policy/policy-distribution/config/distribution/csar/sample_csar_with_apex_policy.csar b/scripts/policy/policy-distribution/config/distribution/csar/sample_csar_with_apex_policy.csar index c2f90eaf..4d293e42 100644 Binary files a/scripts/policy/policy-distribution/config/distribution/csar/sample_csar_with_apex_policy.csar and b/scripts/policy/policy-distribution/config/distribution/csar/sample_csar_with_apex_policy.csar differ diff --git a/scripts/policy/policy-distribution/config/distribution/temp/sample_csar_with_apex_policy.csar b/scripts/policy/policy-distribution/config/distribution/temp/sample_csar_with_apex_policy.csar deleted file mode 100644 index 675e8897..00000000 Binary files a/scripts/policy/policy-distribution/config/distribution/temp/sample_csar_with_apex_policy.csar and /dev/null differ diff --git a/scripts/policy/policy-distribution/docker-compose-distribution.yml b/scripts/policy/policy-distribution/docker-compose-distribution.yml deleted file mode 100644 index f2398908..00000000 --- a/scripts/policy/policy-distribution/docker-compose-distribution.yml +++ /dev/null @@ -1,109 +0,0 @@ -# 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. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -version: '2' -networks: - default: - driver: bridge -services: - mariadb: - image: mariadb:${POLICY_MARIADB_VER} - container_name: mariadb - hostname: mariadb - command: ['--lower-case-table-names=1', '--wait_timeout=28800'] - env_file: config/db/db.conf - volumes: - - ./config/db:/docker-entrypoint-initdb.d - ports: - - "3306:3306" - message-router: - image: dmaap/simulator - container_name: dmaap-simulator - hostname: dmaap-simulator - ports: - - "3904:3904" - policy-pap: - image: nexus3.onap.org:10001/onap/policy-pap:${POLICY_PAP_VERSION} - container_name: policy-pap - depends_on: - - mariadb - - message-router - hostname: policy-pap - - - policy-api: - image: nexus3.onap.org:10001/onap/policy-api:${POLICY_API_VERSION} - container_name: policy-api - depends_on: - - mariadb - hostname: policy-api - - - distribution: - image: nexus3.onap.org:10001/onap/policy-distribution:${POLICY_DISTRIBUTION_VERSION} - container_name: policy-distribution - hostname: policy-distribution - volumes: - - ./config/distribution/defaultConfig.json:/opt/app/policy/distribution/etc/defaultConfig.json - - ./config/distribution/temp/:/opt/app/policy/distribution/etc/temp/ - depends_on: - - mariadb - - message-router - - policy-pap - - policy-api - - apex - - apex: - image: nexus3.onap.org:10001/onap/policy-apex-pdp:${POLICY_APEX_PDP_VERSION} - container_name: policy-apex-pdp - depends_on: - - mariadb - - message-router - - policy-pap - hostname: policy-apex-pdp - command: ['/opt/app/policy/apex-pdp/bin/apexOnapPf.sh', '-c', '/opt/app/policy/apex-pdp/etc/onappf/config/OnapPfConfig.json'] - ports: - - "6969:6969" - - "23324:23324" - start_dependencies: - image: dadarek/wait-for-dependencies - environment: - TIMEOUT_LENGTH: 60 - container_name: policy-wait - depends_on: - - mariadb - - message-router - hostname: policy-wait - command: - mariadb:3306 - message-router:3904 - start_all: - image: dadarek/wait-for-dependencies - environment: - TIMEOUT_LENGTH: 60 - container_name: policy-wait-all - depends_on: - - mariadb - - message-router - - policy-api - - policy-pap - - apex - - distribution - hostname: policy-wait-all - command: - mariadb:3306 - message-router:3904 - policy-api:6969 - policy-pap:6969 - apex:6969 - distribution:6969 diff --git a/scripts/policy/policy-models-dmaap-sim.sh b/scripts/policy/policy-models-dmaap-sim.sh deleted file mode 100644 index 2839e5c3..00000000 --- a/scripts/policy/policy-models-dmaap-sim.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -# ============LICENSE_START======================================================= -# Copyright (C) 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. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# SPDX-License-Identifier: Apache-2.0 -# ============LICENSE_END========================================================= - -source ${SCRIPTS}/policy/config/policy-csit.conf - -rm -rf ${WORKSPACE}/dmaap-sim -mkdir ${WORKSPACE}/dmaap-sim -cd ${WORKSPACE}/dmaap-sim - -POLICY_MODELS_VERSION_EXTRACT="$(curl -q --silent https://git.onap.org/policy/models/plain/pom.xml?h=${GERRIT_BRANCH} | xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -)" -export POLICY_MODELS_VERSION="${POLICY_MODELS_VERSION_EXTRACT}" -echo ${POLICY_MODELS_VERSION} - -# download dmaap tarball and build docker image -git clone --depth 1 https://gerrit.onap.org/r/policy/models -b ${GERRIT_BRANCH} -cd models/models-sim/models-sim-dmaap -item=`curl --silent -L ${NEXUS_URL}/org/onap/policy/models/sim/policy-models-sim-dmaap/${POLICY_MODELS_VERSION} | egrep 'policy-models-sim-dmaap-.*tarball' | cut '-d"' -f2 | egrep 'gz$' | sort | tail -1` -mkdir target -curl -L $item -o target/policy-models-sim-dmaap-${POLICY_MODELS_VERSION}-tarball.tar.gz -bash ./src/main/package/docker/docker_build.sh -cd ${WORKSPACE} diff --git a/scripts/policy/policy-models-simulators.sh b/scripts/policy/policy-models-simulators.sh deleted file mode 100755 index 9e67d487..00000000 --- a/scripts/policy/policy-models-simulators.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -# -# ============LICENSE_START=================================================== -# Copyright (C) 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. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============LICENSE_END===================================================== -# - -source ${SCRIPTS}/policy/config/policy-csit.conf - -rm -rf ${WORKSPACE}/simulators -mkdir ${WORKSPACE}/simulators -cd ${WORKSPACE}/simulators - -POLICY_MODELS_VERSION_EXTRACT="$(curl -q --silent https://git.onap.org/policy/models/plain/pom.xml?h=${GERRIT_BRANCH} | xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -)" -export POLICY_MODELS_VERSION="${POLICY_MODELS_VERSION_EXTRACT}" -echo ${POLICY_MODELS_VERSION} - -# download simulators tarball and build docker image -git clone --depth 1 https://gerrit.onap.org/r/policy/models -b ${GERRIT_BRANCH} -cd models/models-sim/policy-models-simulators -item=`curl --silent -L ${NEXUS_URL}/org/onap/policy/models/sim/policy-models-simulators/${POLICY_MODELS_VERSION} | egrep 'policy-models-simulators-.*tarball' | cut '-d"' -f2 | egrep 'gz$' | sort | tail -1` -mkdir target -curl -L $item -o target/policy-models-simulators-${POLICY_MODELS_VERSION}-tarball.tar.gz -bash ./src/main/package/docker/docker_build.sh - -cd ${WORKSPACE} diff --git a/scripts/policy/policy-xacml-pdp/config/db/db.sh b/scripts/policy/policy-xacml-pdp/config/db/db.sh deleted file mode 100755 index 499764df..00000000 --- a/scripts/policy/policy-xacml-pdp/config/db/db.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -xv -# ============LICENSE_START======================================================= -# Copyright (C) 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. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# SPDX-License-Identifier: Apache-2.0 -# ============LICENSE_END========================================================= - -for db in policyadmin operationshistory -do - mysql -uroot -p"${MYSQL_ROOT_PASSWORD}" --execute "CREATE DATABASE IF NOT EXISTS ${db};" - mysql -uroot -p"${MYSQL_ROOT_PASSWORD}" --execute "GRANT ALL PRIVILEGES ON \`${db}\`.* TO '${MYSQL_USER}'@'%' ;" -done - -mysql -uroot -p"${MYSQL_ROOT_PASSWORD}" --execute "FLUSH PRIVILEGES;" diff --git a/scripts/policy/policy-xacml-pdp/docker-compose-pdpx.yml b/scripts/policy/policy-xacml-pdp/docker-compose-pdpx.yml deleted file mode 100644 index caf8315b..00000000 --- a/scripts/policy/policy-xacml-pdp/docker-compose-pdpx.yml +++ /dev/null @@ -1,88 +0,0 @@ -# ============LICENSE_START======================================================= -# 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. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# SPDX-License-Identifier: Apache-2.0 -# ============LICENSE_END========================================================= -version: '2' -services: - mariadb: - image: mariadb:${POLICY_MARIADB_VER} - container_name: mariadb - hostname: mariadb - command: ['--lower-case-table-names=1', '--wait_timeout=28800'] - env_file: config/db/db.conf - volumes: - - ./config/db:/docker-entrypoint-initdb.d - expose: - - 3306 - message-router: - image: dmaap/simulator - container_name: dmaap-simulator - hostname: dmaap-simulator - expose: - - 3904 - pap: - image: nexus3.onap.org:10001/onap/policy-pap:${POLICY_PAP_VERSION} - container_name: policy-pap - depends_on: - - mariadb - - message-router - hostname: policy-pap - api: - image: nexus3.onap.org:10001/onap/policy-api:${POLICY_API_VERSION} - container_name: policy-api - depends_on: - - mariadb - hostname: policy-api - xacml-pdp: - image: nexus3.onap.org:10001/onap/policy-xacml-pdp:${POLICY_XACML_PDP_VERSION} - container_name: policy-xacml-pdp - depends_on: - - mariadb - - message-router - - pap - hostname: policy-xacml-pdp - expose: - - 6969 - start_dependencies: - image: dadarek/wait-for-dependencies - environment: - TIMEOUT_LENGTH: 60 - container_name: policy-wait - depends_on: - - mariadb - - message-router - hostname: policy-wait - command: - mariadb:3306 - message-router:3904 - start_all: - image: dadarek/wait-for-dependencies - environment: - TIMEOUT_LENGTH: 60 - container_name: policy-wait-all - depends_on: - - mariadb - - message-router - - api - - pap - - xacml-pdp - hostname: policy-wait-all - command: - mariadb:3306 - message-router:3904 - api:6969 - pap:6969 - xacml-pdp:6969 diff --git a/scripts/policy/wait_for_port.sh b/scripts/policy/wait_for_port.sh index 58bf25d0..c50cd970 100755 --- a/scripts/policy/wait_for_port.sh +++ b/scripts/policy/wait_for_port.sh @@ -1,21 +1,40 @@ #!/bin/bash -if [[ $# -ne 2 ]]; then - echo "Usage: wait-for-port hostname port" >&2 +tmout=120 +cmd= + +while getopts c:t: opt; do + case "$opt" in + c) cmd="$OPTARG" ;; + t) tmout="$OPTARG" ;; + esac +done +let nargs=$OPTIND-1 +shift $nargs + +let even_args=$#%2 +if [[ $# -lt 2 || $even_args -ne 0 ]]; then + echo "args: [-t timeout] [-c command] hostname1 port1 hostname2 port2 ..." >&2 exit 1 fi -export host=$1 -export port=$2 +while [[ $# -ge 2 ]]; do + export host=$1 + export port=$2 + shift + shift -echo "Waiting for $host port $port open" -timeout 120 bash -c 'until nc -vz "$host" "$port"; do echo -n "."; sleep 1; done' -rc=$? + echo "Waiting for $host port $port..." + timeout $tmout bash -c 'until nc -vz "$host" "$port"; do echo -n "."; + sleep 1; done' + rc=$? -if [[ $rc != 0 ]]; then + if [[ $rc != 0 ]]; then echo "$host port $port cannot be reached" exit $rc -fi + fi +done + +$cmd -echo "$host port $port is open" exit 0 diff --git a/tests/policy/drools-applications/drools-applications-test.robot b/tests/policy/drools-applications/drools-applications-test.robot index a1ca5e20..0b73ccf8 100644 --- a/tests/policy/drools-applications/drools-applications-test.robot +++ b/tests/policy/drools-applications/drools-applications-test.robot @@ -35,10 +35,10 @@ Controller Log Creating session https://${DROOLS_IP}:9696 ${session}= Create Session policy https://${DROOLS_IP}:9696 auth=${auth} ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= Get Request policy /policy/pdp/engine/controllers/frankfurt/drools/facts headers=${headers} + ${resp}= Get Request policy /policy/pdp/engine/controllers/usecases/drools/facts headers=${headers} Log Received response from policy ${resp.text} Should Be Equal As Strings ${resp.status_code} 200 - Should Be Equal As Strings ${resp.json()['frankfurt']} 0 + Should Be Equal As Strings ${resp.json()['usecases']} 0 MakeTopics [Documentation] Creates the Policy topics