diff options
63 files changed, 1498 insertions, 1407 deletions
diff --git a/plans/policy/drools-applications/setup.sh b/plans/policy/drools-applications/setup.sh index e550cdb0..c66c4929 100755 --- a/plans/policy/drools-applications/setup.sh +++ b/plans/policy/drools-applications/setup.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. @@ -16,6 +16,9 @@ # # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END========================================================= + +# OS upgrades + source ${SCRIPTS}/policy/config/policy-csit.conf export POLICY_MARIADB_VER echo ${GERRIT_BRANCH} @@ -32,18 +35,15 @@ echo ${POLICY_DROOLS_APPS_VERSION_EXTRACT} export POLICY_DROOLS_APPS_VERSION="${POLICY_DROOLS_APPS_VERSION_EXTRACT:0:3}-SNAPSHOT-latest" echo ${POLICY_DROOLS_APPS_VERSION} -docker login -u docker -p docker nexus3.onap.org:10001 +echo "user information: $(id)" +echo "docker and docker-compose versions:" +docker -v && docker-compose -v -# Adding this waiting container to avoid race condition between api and mariadb containers. -docker-compose -f ${WORKSPACE}/scripts/policy/docker-compose-drools-apps.yml run --rm start_dependencies -docker logs mariadb docker container ls -a docker-compose -f ${WORKSPACE}/scripts/policy/docker-compose-drools-apps.yml up -d -sleep 1m +sleep 2m -docker logs mariadb -docker logs drools docker container ls -a POLICY_DROOLS_IP=`get-instance-ip.sh drools` @@ -52,17 +52,13 @@ MARIADB_IP=`get-instance-ip.sh mariadb` echo DROOLS IP IS ${POLICY_DROOLS_IP} echo MARIADB IP IS ${MARIADB_IP} -# Wait for initialization -for i in {1..10}; do - curl -sS ${MARIADB_IP}:3306 && break - echo sleep $i - sleep $i -done - for i in {1..10}; do curl -sS ${POLICY_DROOLS_IP}:6969 && break echo sleep $i sleep $i done +# to give enough time to the usecases controller to come up +sleep 2m + ROBOT_VARIABLES="-v POLICY_DROOLS_IP:${POLICY_DROOLS_IP}" diff --git a/plans/policy/drools-applications/teardown.sh b/plans/policy/drools-applications/teardown.sh index 48ab171d..886b1ea3 100755 --- a/plans/policy/drools-applications/teardown.sh +++ b/plans/policy/drools-applications/teardown.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright 2019 AT&T Intellectual Property. All rights reserved. +# 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. @@ -14,5 +14,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -kill-instance.sh drools -kill-instance.sh mariadb + +mkdir -p $WORKSPACE/archives/ + +docker-compose -f ${WORKSPACE}/scripts/policy/docker-compose-drools-apps.yml logs > $WORKSPACE/archives/docker-compose-drools-apps.log +docker-compose -f ${WORKSPACE}/scripts/policy/docker-compose-drools-apps.yml down -v diff --git a/plans/policy/drools-pdp/setup.sh b/plans/policy/drools-pdp/setup.sh index 4851cd7e..d50106ff 100755 --- a/plans/policy/drools-pdp/setup.sh +++ b/plans/policy/drools-pdp/setup.sh @@ -1,7 +1,7 @@ #!/bin/bash -# -# Copyright 2017 AT&T Intellectual Property. All rights reserved. -# +# ============LICENSE_START======================================================= +# Copyright 2017-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 @@ -14,21 +14,47 @@ # See the License for the specific language governing permissions and # limitations under the License. # -# Place the scripts in run order: -source ${SCRIPTS}/common_functions.sh +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= + +# OS upgrades + +echo "Uninstall docker-py and reinstall docker." +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 + +docker container ls -a -docker login -u docker -p docker nexus3.onap.org:10001 -docker pull nexus3.onap.org:10001/onap/policy-common-alpine:1.4.0 -docker tag nexus3.onap.org:10001/onap/policy-common-alpine:1.4.0 onap/policy-common-alpine:1.4.0 +POLICY_DROOLS_IP=`get-instance-ip.sh drools` +MARIADB_IP=`get-instance-ip.sh mariadb` -source ${WORKSPACE}/scripts/policy/drools-pdp-script.sh +echo DROOLS IP IS ${POLICY_DROOLS_IP} +echo MARIADB IP IS ${MARIADB_IP} -# Pass any variables required by Robot test suites in ROBOT_VARIABLES -ROBOT_VARIABLES="-v IP:${IP} -v POLICY_IP:${POLICY_IP} -v PDP_IP:${PDP_IP} -v DOCKER_IP:${DOCKER_IP}" -export PDP_IP=${PDP_IP} -export POLICY_IP=${POLICY_IP} -export DOCKER_IP=${DOCKER_IP} +for i in {1..10}; do + curl -sS ${POLICY_DROOLS_IP}:9696 && break + echo sleep $i + sleep $i +done -#Get current IP of VM -HOST_IP=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $NF}') -export HOST_IP=${HOST_IP} +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 303ccff1..e08593d2 100755 --- a/plans/policy/drools-pdp/teardown.sh +++ b/plans/policy/drools-pdp/teardown.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright 2017 AT&T Intellectual Property. All rights reserved. +# Copyright 2017-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. @@ -15,21 +15,6 @@ # limitations under the License. # -function kill_instance() { -local name=$1 -docker logs "${name}" >> "${WORKSPACE}"/archives/"${name}".log -docker kill "${name}" -docker rm -v "${name}" -} - -mkdir -p "${WORKSPACE}"/archives - -kill_instance drools -kill_instance pdp -kill_instance brmsgw -kill_instance pap -kill_instance nexus -kill_instance mariadb - -rm -fr "${WORK_DIR}" - +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 diff --git a/plans/policy/health/setup.sh b/plans/policy/health/setup.sh deleted file mode 100755 index 1b1155d8..00000000 --- a/plans/policy/health/setup.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# -# Copyright 2017, 2019 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. -# -# Place the scripts in run order: -source ${SCRIPTS}/common_functions.sh - -docker login -u docker -p docker nexus3.onap.org:10001 -docker pull nexus3.onap.org:10001/onap/policy-common-alpine:1.4.0 -docker tag nexus3.onap.org:10001/onap/policy-common-alpine:1.4.0 onap/policy-common-alpine:1.4.0 - -source ${WORKSPACE}/scripts/policy/engine.sh - -# Pass any variables required by Robot test suites in ROBOT_VARIABLES -ROBOT_VARIABLES="-v IP:${IP} -v POLICY_IP:${POLICY_IP} -v PDP_IP:${PDP_IP} -v DOCKER_IP:${DOCKER_IP}" -export PDP_IP=${PDP_IP} -export POLICY_IP=${POLICY_IP} -export DOCKER_IP=${DOCKER_IP} - -#Get current IP of VM -HOST_IP=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $NF}') -export HOST_IP=${HOST_IP} diff --git a/plans/policy/health/testplan.txt b/plans/policy/health/testplan.txt deleted file mode 100644 index 6bad34fc..00000000 --- a/plans/policy/health/testplan.txt +++ /dev/null @@ -1,3 +0,0 @@ -# Test suites are relative paths under [integration/csit.git]/tests/. -# Place the suites in run order. -policy/engine diff --git a/scripts/policy/config/db/db.sh b/scripts/policy/config/db/db.sh index 9ab2be2f..24b04003 100755 --- a/scripts/policy/config/db/db.sh +++ b/scripts/policy/config/db/db.sh @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -for db in policyadmin +for db in support onap_sdk log migration operationshistory10 pooling 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}'@'%' ;" diff --git a/scripts/policy/config/drools-apps/custom/features.pre.sh b/scripts/policy/config/drools-apps/custom/features.pre.sh new file mode 100755 index 00000000..93d6c6b9 --- /dev/null +++ b/scripts/policy/config/drools-apps/custom/features.pre.sh @@ -0,0 +1,19 @@ +#!/bin/bash -x +# ============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========================================================= + +features disable distributed-locking +features enable controlloop-utils diff --git a/scripts/policy/config/drools-apps/custom/noop.pre.sh b/scripts/policy/config/drools-apps/custom/noop.pre.sh new file mode 100755 index 00000000..d73c5e00 --- /dev/null +++ b/scripts/policy/config/drools-apps/custom/noop.pre.sh @@ -0,0 +1,27 @@ +#!/bin/bash -x +# ============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========================================================= + +sed -i "s/^dmaap/noop/g" \ + ${POLICY_HOME}/config/amsterdam-controller.properties \ + ${POLICY_HOME}/config/engine.properties \ + ${POLICY_HOME}/config/feature-lifecycle.properties \ + ${POLICY_HOME}/config/usecases-controller.properties + +chmod 644 ${POLICY_HOME}/config/amsterdam-controller.properties \ + ${POLICY_HOME}/config/engine.properties \ + ${POLICY_HOME}/config/feature-lifecycle.properties \ + ${POLICY_HOME}/config/usecases-controller.properties diff --git a/scripts/policy/config/drools-apps/custom/standalone-settings.xml b/scripts/policy/config/drools-apps/custom/standalone-settings.xml new file mode 100644 index 00000000..ebd6dd2a --- /dev/null +++ b/scripts/policy/config/drools-apps/custom/standalone-settings.xml @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ============LICENSE_START======================================================= + Base Package + ================================================================================ + Copyright (C) 2017-2019 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========================================================= + --> + + +<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> + + <offline>true</offline> + + <profiles> + + <profile> + <id>policy-local</id> + + <repositories> + <repository> + <id>file-repository</id> + <url>file:${user.home}/.m2/file-repository</url> + <releases> + <enabled>true</enabled> + <updatePolicy>always</updatePolicy> + </releases> + <snapshots> + <enabled>true</enabled> + <updatePolicy>always</updatePolicy> + </snapshots> + </repository> + </repositories> + + </profile> + + </profiles> + + <activeProfiles> + <activeProfile>policy-local</activeProfile> + </activeProfiles> + +</settings> diff --git a/scripts/policy/config/drools/base.conf b/scripts/policy/config/drools-apps/env/base.conf index 1e57226a..d8d0f4ed 100644 --- a/scripts/policy/config/drools/base.conf +++ b/scripts/policy/config/drools-apps/env/base.conf @@ -20,6 +20,7 @@ JVM_OPTIONS=-server -Xms512m -Xmx512m # SYSTEM software configuration +DEBUG=y POLICY_HOME=/opt/app/policy POLICY_LOGS=/var/log/onap/policy/pdpd KEYSTORE_PASSWD=Pol1cy_0nap @@ -40,12 +41,13 @@ RELEASE_REPOSITORY_ID= RELEASE_REPOSITORY_URL= REPOSITORY_USERNAME= REPOSITORY_PASSWORD= +REPOSITORY_OFFLINE=true # Relational (SQL) DB access -SQL_HOST= -SQL_USER= -SQL_PASSWORD= +SQL_HOST=mariadb +SQL_USER=policy_user +SQL_PASSWORD=policy_user # AAF diff --git a/scripts/policy/config/drools/feature-healthcheck.conf b/scripts/policy/config/drools-apps/env/feature-healthcheck.conf index c205e9f7..1c710547 100644 --- a/scripts/policy/config/drools/feature-healthcheck.conf +++ b/scripts/policy/config/drools-apps/env/feature-healthcheck.conf @@ -1,5 +1,5 @@ # ============LICENSE_START======================================================= -# Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. +# 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. diff --git a/scripts/policy/config/drools-apps/env/feature-pooling-dmaap.conf b/scripts/policy/config/drools-apps/env/feature-pooling-dmaap.conf new file mode 100644 index 00000000..3808e3d9 --- /dev/null +++ b/scripts/policy/config/drools-apps/env/feature-pooling-dmaap.conf @@ -0,0 +1,17 @@ +# ============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========================================================= + +POOLING_TOPIC=POOLING diff --git a/scripts/policy/config/drools/custom/noop.pre.sh b/scripts/policy/config/drools/custom/noop.pre.sh new file mode 100755 index 00000000..63bdc4cf --- /dev/null +++ b/scripts/policy/config/drools/custom/noop.pre.sh @@ -0,0 +1,22 @@ +#!/bin/bash -x +# ============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========================================================= + +sed -i "s/^dmaap/noop/g" \ + ${POLICY_HOME}/config/engine.properties \ + ${POLICY_HOME}/config/feature-lifecycle.properties + +chmod 644 ${POLICY_HOME}/config/engine.properties ${POLICY_HOME}/config/feature-lifecycle.properties diff --git a/scripts/policy/config/drools/env/base.conf b/scripts/policy/config/drools/env/base.conf new file mode 100644 index 00000000..8fef8a28 --- /dev/null +++ b/scripts/policy/config/drools/env/base.conf @@ -0,0 +1,120 @@ +# ============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========================================================= + +# JVM options + +JVM_OPTIONS=-server -Xms512m -Xmx512m + +# SYSTEM software configuration + +DEBUG=y +POLICY_HOME=/opt/app/policy +POLICY_LOGS=/var/log/onap/policy/pdpd +KEYSTORE_PASSWD=Pol1cy_0nap +TRUSTSTORE_PASSWD=Pol1cy_0nap + +# Telemetry credentials + +TELEMETRY_PORT=9696 +TELEMETRY_HOST=0.0.0.0 +TELEMETRY_USER=demo@people.osaaf.org +TELEMETRY_PASSWORD=demo123456! + +# nexus repository + +SNAPSHOT_REPOSITORY_ID=policy-nexus-snapshots +SNAPSHOT_REPOSITORY_URL=http://nexus:8081/nexus/content/repositories/snapshots/ +RELEASE_REPOSITORY_ID=policy-nexus-releases +RELEASE_REPOSITORY_URL=http://nexus:8081/nexus/content/repositories/releases/ +REPOSITORY_USERNAME=admin +REPOSITORY_PASSWORD=admin123 +REPOSITORY_OFFLINE=false + +# Relational (SQL) DB access + +SQL_HOST=mariadb +SQL_USER=policy_user +SQL_PASSWORD=policy_user + +# AAF + +AAF=false +AAF_NAMESPACE=org.onap.policy +AAF_HOST=aaf.api.simpledemo.onap.org + +# PDP-D DMaaP configuration channel + +PDPD_CONFIGURATION_TOPIC=PDPD-CONFIGURATION +PDPD_CONFIGURATION_API_KEY= +PDPD_CONFIGURATION_API_SECRET= +PDPD_CONFIGURATION_CONSUMER_GROUP= +PDPD_CONFIGURATION_CONSUMER_INSTANCE= +PDPD_CONFIGURATION_PARTITION_KEY= + +# PAP-PDP configuration channel + +POLICY_PDP_PAP_TOPIC=POLICY-PDP-PAP +POLICY_PDP_PAP_API_KEY= +POLICY_PDP_PAP_API_SECRET= + +# PAP + +PAP_HOST= +PAP_USERNAME= +PAP_PASSWORD= + +# PDP-X + +PDP_HOST= +PDP_USERNAME= +PDP_PASSWORD= +PDP_CLIENT_USERNAME= +PDP_CLIENT_PASSWORD= +PDP_ENVIRONMENT= + +# DCAE DMaaP + +DCAE_TOPIC=unauthenticated.DCAE_CL_OUTPUT +DCAE_SERVERS= +DCAE_CONSUMER_GROUP=dcae.policy.shared + +# Open DMaaP + +DMAAP_SERVERS=mr.api.simpledemo.onap.org + +# AAI + +AAI_URL=https://aai.api.simpledemo.onap.org:8443 +AAI_USERNAME=policy@policy.onap.org +AAI_PASSWORD=demo123456! + +# MSO + +SO_URL=http://vm1.mso.simpledemo.onap.org:8080/onap/so/infra +SO_USERNAME=InfraPortalClient +SO_PASSWORD=password1$ + +# VFC + +VFC_URL= +VFC_USERNAME= +VFC_PASSWORD= + +# SDNC + +SDNC_URL= +SDNC_USERNAME= +SDNC_PASSWORD= diff --git a/scripts/policy/config/pe/base.conf b/scripts/policy/config/pe/base.conf new file mode 100644 index 00000000..851234f3 --- /dev/null +++ b/scripts/policy/config/pe/base.conf @@ -0,0 +1,43 @@ +# 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 new file mode 100755 index 00000000..f74730cc --- /dev/null +++ b/scripts/policy/config/pe/brmsgw-tweaks.sh @@ -0,0 +1,40 @@ +#! /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 new file mode 100644 index 00000000..c2db9d12 --- /dev/null +++ b/scripts/policy/config/pe/brmsgw.conf @@ -0,0 +1,67 @@ +# 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 new file mode 100644 index 00000000..ceaad638 --- /dev/null +++ b/scripts/policy/config/pe/console.conf @@ -0,0 +1,145 @@ +# 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 new file mode 100644 index 00000000..a65fd17d --- /dev/null +++ b/scripts/policy/config/pe/elk.conf @@ -0,0 +1,16 @@ +# 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/plans/policy/health/teardown.sh b/scripts/policy/config/pe/mysql.conf index 303ccff1..0f6ee8c7 100755..100644 --- a/plans/policy/health/teardown.sh +++ b/scripts/policy/config/pe/mysql.conf @@ -1,35 +1,18 @@ -#!/bin/bash -# -# Copyright 2017 AT&T Intellectual Property. All rights reserved. +# 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 +# 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. -# - -function kill_instance() { -local name=$1 -docker logs "${name}" >> "${WORKSPACE}"/archives/"${name}".log -docker kill "${name}" -docker rm -v "${name}" -} - -mkdir -p "${WORKSPACE}"/archives - -kill_instance drools -kill_instance pdp -kill_instance brmsgw -kill_instance pap -kill_instance nexus -kill_instance mariadb +# mysql scripts component installation configuration parameters -rm -fr "${WORK_DIR}" +# 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 new file mode 100755 index 00000000..87c6d21d --- /dev/null +++ b/scripts/policy/config/pe/pap-tweaks.sh @@ -0,0 +1,14 @@ +#! /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 new file mode 100644 index 00000000..86f5a50c --- /dev/null +++ b/scripts/policy/config/pe/pap.conf @@ -0,0 +1,68 @@ +# 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 new file mode 100644 index 00000000..647625cb --- /dev/null +++ b/scripts/policy/config/pe/paplp.conf @@ -0,0 +1,25 @@ +# 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 new file mode 100755 index 00000000..87c6d21d --- /dev/null +++ b/scripts/policy/config/pe/pdp-tweaks.sh @@ -0,0 +1,14 @@ +#! /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 new file mode 100644 index 00000000..0aa6b0b6 --- /dev/null +++ b/scripts/policy/config/pe/pdp.conf @@ -0,0 +1,69 @@ +# 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 new file mode 100644 index 00000000..4676b610 --- /dev/null +++ b/scripts/policy/config/pe/pdplp.conf @@ -0,0 +1,25 @@ +# 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 new file mode 100755 index 00000000..65013138 --- /dev/null +++ b/scripts/policy/config/pe/push-policies.sh @@ -0,0 +1,506 @@ +#! /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/docker-compose-drools-apps.yml b/scripts/policy/docker-compose-drools-apps.yml index 14a2161f..704de81b 100644 --- a/scripts/policy/docker-compose-drools-apps.yml +++ b/scripts/policy/docker-compose-drools-apps.yml @@ -1,4 +1,4 @@ -# Copyright 2019 AT&T Intellectual Property. All rights reserved +# 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. @@ -34,14 +34,8 @@ services: - 6969 - 9696 volumes: - - ${WORKSPACE}/scripts/policy/config/drools:/tmp/policy-install/config - environment: - - DEBUG=y - start_dependencies: - image: dadarek/wait-for-dependencies - container_name: policy-wait - depends_on: - - mariadb - hostname: policy-wait - command: mariadb:3306 - + - ${WORKSPACE}/scripts/policy/config/drools-apps/custom:/tmp/policy-install/config + env_file: + - ${WORKSPACE}/scripts/policy/config/drools-apps/env/base.conf + - ${WORKSPACE}/scripts/policy/config/drools-apps/env/feature-healthcheck.conf + - ${WORKSPACE}/scripts/policy/config/drools-apps/env/feature-pooling-dmaap.conf diff --git a/scripts/policy/docker-compose-drools.yml b/scripts/policy/docker-compose-drools.yml index ffee9cdc..974b465f 100644 --- a/scripts/policy/docker-compose-drools.yml +++ b/scripts/policy/docker-compose-drools.yml @@ -1,4 +1,4 @@ -# Copyright 2018 AT&T Intellectual Property. All rights reserved +# 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. @@ -14,42 +14,34 @@ version: '2' services: mariadb: - image: mariadb:10.2.14 + 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 + env_file: + - ${WORKSPACE}/scripts/policy/config/db/db.conf volumes: - - ./config/db:/docker-entrypoint-initdb.d + - ${WORKSPACE}/scripts/policy/config/db:/docker-entrypoint-initdb.d expose: - - 3306 + - 3306 nexus: image: sonatype/nexus:2.14.8-01 container_name: nexus hostname: nexus - pap: - image: onap/policy-pe - environment: - - PRELOAD_POLICIES=${PRELOAD_POLICIES} - container_name: pap - depends_on: - - mariadb - hostname: pap expose: - - 8443 - - 9091 - command: pap - volumes: - - ./config/pe:/tmp/policy-install/config + - 8081 drools: - image: onap/policy-drools + image: nexus3.onap.org:10001/onap/policy-drools:${POLICY_DROOLS_VERSION} + user: 1000:1000 container_name: drools depends_on: - - mariadb - - nexus + - mariadb + - nexus hostname: drools expose: - - 6969 - - 9696 + - 6969 + - 9696 volumes: - - ./config/drools:/tmp/policy-install/config + - ${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 index e67729e2..1fc5f9f3 100644 --- a/scripts/policy/docker-compose-engine.yml +++ b/scripts/policy/docker-compose-engine.yml @@ -14,13 +14,14 @@ version: '2' services: mariadb: - image: mariadb:10.2.14 + 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 + env_file: + - ${WORKSPACE}/scripts/policy/config/db/db.conf volumes: - - ./config/db:/docker-entrypoint-initdb.d + - ${WORKSPACE}/scripts/policy/config/db:/docker-entrypoint-initdb.d expose: - 3306 nexus: @@ -28,7 +29,7 @@ services: container_name: nexus hostname: nexus pap: - image: onap/policy-pe + image: nexus3.onap.org:10001/onap/policy-pe:${POLICY_ENGINE_VERSION} environment: - PRELOAD_POLICIES=${PRELOAD_POLICIES} container_name: pap @@ -40,9 +41,9 @@ services: - 9091 command: pap volumes: - - ./config/pe:/tmp/policy-install/config + - ${WORKSPACE}/scripts/policy/config/pe:/tmp/policy-install/config pdp: - image: onap/policy-pe + image: nexus3.onap.org:10001/onap/policy-pe:${POLICY_ENGINE_VERSION} container_name: pdp depends_on: - pap @@ -53,23 +54,11 @@ services: volumes: - ./config/pe:/tmp/policy-install/config brmsgw: - image: onap/policy-pe + image: nexus3.onap.org:10001/onap/policy-pe:${POLICY_ENGINE_VERSION} container_name: brmsgw depends_on: - pap hostname: brmsgw command: brmsgw volumes: - - ./config/pe:/tmp/policy-install/config - drools: - image: onap/policy-drools - container_name: drools - depends_on: - - mariadb - - nexus - hostname: drools - expose: - - 6969 - - 9696 - volumes: - - ./config/drools:/tmp/policy-install/config + - ${WORKSPACE}/scripts/policy/config/pe:/tmp/policy-install/config diff --git a/scripts/policy/drools-pdp-script.sh b/scripts/policy/drools-pdp-script.sh deleted file mode 100755 index 6e14931f..00000000 --- a/scripts/policy/drools-pdp-script.sh +++ /dev/null @@ -1,246 +0,0 @@ -#!/bin/bash -x -# -# Copyright 2017-2019 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. -# -echo "This is ${WORKSPACE}/scripts/policy/drools-pdp-script.sh" - - -# the directory of the script -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -echo ${DIR} - -# the temp directory used, within $DIR -# omit the -p parameter to create a temporal directory in the default location -WORK_DIR=`mktemp -d -p "$DIR"` -echo ${WORK_DIR} - -cd ${WORK_DIR} - -# check if tmp dir was created -if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then - echo "Could not create temp dir" - exit 1 -fi - -# bring down maven -mkdir maven -cd maven -# download maven from automatically selected mirror server -curl -vLO "https://www.apache.org/dyn/mirrors/mirrors.cgi?cca2=us&preferred=http://apache.claz.org/&action=download&filename=maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz" -if ! tar -xzvf apache-maven-3.3.9-bin.tar.gz ; then - echo "Installation of maven has failed!" - exit 1 -fi -ls -l -export PATH=${PATH}:${WORK_DIR}/maven/apache-maven-3.3.9/bin -${WORK_DIR}/maven/apache-maven-3.3.9/bin/mvn -v -cd .. - -ifconfig - -export IP=`ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $NF}'` -if [ -z "$IP" ]; then - echo "Could not determine IP address" - exit 1 -fi -echo $IP - -if ! ifconfig docker0; then - export DOCKER_IP="$IP" -else - export DOCKER_IP=`ifconfig docker0 | awk -F: '/inet addr/ {gsub(/ .*/,"",$2); print $2}'` -fi -echo $DOCKER_IP - -git clone http://gerrit.onap.org/r/oparent - -git clone http://gerrit.onap.org/r/policy/engine -cd engine/packages/docker -${WORK_DIR}/maven/apache-maven-3.3.9/bin/mvn prepare-package --settings ${WORK_DIR}/oparent/settings.xml -docker build -t onap/policy-pe target/policy-pe - -cd ${WORK_DIR} -git clone http://gerrit.onap.org/r/policy/drools-pdp -cd drools-pdp/packages/docker -${WORK_DIR}/maven/apache-maven-3.3.9/bin/mvn prepare-package --settings ${WORK_DIR}/oparent/settings.xml -docker build -t onap/policy-drools target/policy-drools - -cd ${WORK_DIR} -git clone http://gerrit.onap.org/r/policy/docker -cd docker - -chmod +x config/drools/drools-tweaks.sh - -echo $IP > config/pe/ip_addr.txt -ls -l config/pe/ip_addr.txt -cat config/pe/ip_addr.txt - -export MTU=9126 - -export PRELOAD_POLICIES=false -docker-compose -f docker-compose-integration.yml up -d - -if [ ! $? -eq 0 ]; then - echo "Docker compose failed" - exit 1 -fi - -docker ps - -POLICY_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' drools` -echo ${POLICY_IP} - -PDP_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' pdp` -echo ${PDP_IP} - -PAP_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' pap` -echo ${PAP_IP} - -BRMS_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' brmsgw` -echo ${BRMS_IP} - -NEXUS_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' nexus` -echo ${NEXUS_IP} - -MARIADB_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' mariadb` -echo ${MARIADB_IP} - -sleep 3m - -docker logs mariadb 2>&1 | grep -q "mysqld: ready for connections" -if [ $? -eq 0 ]; then - # mariadb is ok - sleep a little longer for others - sleep 2m - -else - echo mariadb is not ready - echo Restarting... - - docker kill drools pdp pap brmsgw nexus mariadb - docker rm -f drools pdp pap brmsgw nexus mariadb - - docker-compose -f docker-compose-integration.yml up -d - - if [ ! $? -eq 0 ]; then - echo "Docker compose failed" - exit 1 - fi - - docker ps - - POLICY_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' drools` - echo ${POLICY_IP} - - PDP_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' pdp` - echo ${PDP_IP} - - PAP_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' pap` - echo ${PAP_IP} - - BRMS_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' brmsgw` - echo ${BRMS_IP} - - NEXUS_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' nexus` - echo ${NEXUS_IP} - - MARIADB_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' mariadb` - echo ${MARIADB_IP} - - sleep 5m -fi - -netstat -tnl - -${DIR}/wait_for_port.sh ${MARIADB_IP} 3306 -rc=$? -if [[ $rc != 0 ]]; then - echo "cannot open ${MARIADB_IP} 3306" - telnet ${MARIADB_IP} 3306 < /dev/null - nc -vz ${MARIADB_IP} 3306 - docker logs mariadb - exit $rc -fi - -${DIR}/wait_for_port.sh ${NEXUS_IP} 8081 -rc=$? -if [[ $rc != 0 ]]; then - echo "cannot open ${NEXUS_IP} 8081" - telnet ${NEXUS_IP} 8081 < /dev/null - nc -vz ${NEXUS_IP} 8081 - docker logs nexus - exit $rc -fi - -${DIR}/wait_for_port.sh ${POLICY_IP} 9696 -rc=$? -if [[ $rc != 0 ]]; then - echo "cannot open ${POLICY_IP} 9696" - telnet ${POLICY_IP} 9696 < /dev/null - nc -vz ${POLICY_IP} 9696 - docker logs drools - exit $rc -fi - -${DIR}/wait_for_port.sh ${PAP_IP} 9091 -rc=$? -if [[ $rc != 0 ]]; then - echo "cannot open ${PAP_IP} 9091" - telnet ${PAP_IP} 9091 < /dev/null - nc -vz ${PAP_IP} 9091 - docker logs pap - exit $rc -fi - -${DIR}/wait_for_port.sh ${PDP_IP} 8081 -rc=$? -if [[ $rc != 0 ]]; then - echo "cannot open ${PDP_IP} 8081" - telnet ${PDP_IP} 8081 < /dev/null - nc -vz ${PDP_IP} 8081 - docker logs pdp - exit $rc -fi - -${DIR}/wait_for_port.sh ${BRMS_IP} 9989 -rc=$? -if [[ $rc != 0 ]]; then - echo "cannot open ${BRMS_IP} 9989" - telnet ${BRMS_IP} 9989" < /dev/null - nc -vz ${BRMS_IP} 9989" - docker logs brmsgw - exit $rc -fi - -docker logs drools -docker logs pap -docker logs pdp -docker logs brmsgw - -TIME_OUT=300 -INTERVAL=20 -TIME=0 -while [ "$TIME" -lt "$TIME_OUT" ]; do - curl -k -i --user "demo@people.osaaf.org:demo123456!" -H "ContentType: application/json" -H "Accept: application/json" https://${POLICY_IP}:9696/healthcheck && break - - echo Sleep: $INTERVAL seconds before testing if Policy is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds - sleep $INTERVAL - TIME=$(($TIME+$INTERVAL)) - -done - -# -# Add more sleep for everything to settle -# -sleep 3m diff --git a/scripts/policy/engine.sh b/scripts/policy/engine.sh deleted file mode 100755 index 3e9f3d42..00000000 --- a/scripts/policy/engine.sh +++ /dev/null @@ -1,264 +0,0 @@ -#!/bin/bash -x -# -# Copyright 2017-2019 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. -# -echo "This is ${WORKSPACE}/scripts/policy/engine.sh" - - -# the directory of the script -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -echo ${DIR} - -# the temp directory used, within $DIR -# omit the -p parameter to create a temporal directory in the default location -WORK_DIR=`mktemp -d -p "$DIR"` -echo ${WORK_DIR} - -cd ${WORK_DIR} - -# check if tmp dir was created -if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then - echo "Could not create temp dir" - exit 1 -fi - -# bring down maven -mkdir maven -cd maven -# download maven from automatically selected mirror server -curl -vLO "https://www.apache.org/dyn/mirrors/mirrors.cgi?cca2=us&preferred=http://apache.claz.org/&action=download&filename=maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz" -if ! tar -xzvf apache-maven-3.3.9-bin.tar.gz ; then - echo "Installation of maven has failed!" - exit 1 -fi -ls -l -export PATH=${PATH}:${WORK_DIR}/maven/apache-maven-3.3.9/bin -${WORK_DIR}/maven/apache-maven-3.3.9/bin/mvn -v -cd .. - -ifconfig - -export IP=`ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $NF}'` -if [ -z "$IP" ]; then - echo "Could not determine IP address" - exit 1 -fi -echo $IP - -if ! ifconfig docker0; then - export DOCKER_IP="$IP" -else - export DOCKER_IP=`ifconfig docker0 | awk -F: '/inet addr/ {gsub(/ .*/,"",$2); print $2}'` -fi -echo $DOCKER_IP - -git clone http://gerrit.onap.org/r/oparent - -git clone http://gerrit.onap.org/r/policy/engine -cd engine/packages/docker -${WORK_DIR}/maven/apache-maven-3.3.9/bin/mvn prepare-package --settings ${WORK_DIR}/oparent/settings.xml -docker build -t onap/policy-pe target/policy-pe - -cd ${WORK_DIR} -git clone http://gerrit.onap.org/r/policy/drools-pdp -cd drools-pdp/packages/docker -${WORK_DIR}/maven/apache-maven-3.3.9/bin/mvn prepare-package --settings ${WORK_DIR}/oparent/settings.xml -docker build -t onap/policy-drools target/policy-drools - -cd ${WORK_DIR} -git clone http://gerrit.onap.org/r/policy/docker -cd docker - -chmod +x config/drools/drools-tweaks.sh - -echo $IP > config/pe/ip_addr.txt -ls -l config/pe/ip_addr.txt -cat config/pe/ip_addr.txt - -export MTU=9126 - -export PRELOAD_POLICIES=false -docker-compose -f docker-compose-integration.yml up -d - -if [ ! $? -eq 0 ]; then - echo "Docker compose failed" - exit 1 -fi - -docker ps - -POLICY_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' drools` -echo ${POLICY_IP} - -PDP_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' pdp` -echo ${PDP_IP} - -PAP_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' pap` -echo ${PAP_IP} - -BRMS_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' brmsgw` -echo ${BRMS_IP} - -NEXUS_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' nexus` -echo ${NEXUS_IP} - -MARIADB_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' mariadb` -echo ${MARIADB_IP} - -sleep 3m - -docker logs mariadb 2>&1 | grep -q "mysqld: ready for connections" -if [ $? -eq 0 ]; then - # mariadb is ok - sleep a little longer for others - sleep 2m - -else - echo mariadb is not ready - echo Restarting... - - docker kill drools pdp pap brmsgw nexus mariadb - docker rm -f drools pdp pap brmsgw nexus mariadb - - docker-compose -f docker-compose-integration.yml up -d - - if [ ! $? -eq 0 ]; then - echo "Docker compose failed" - exit 1 - fi - - docker ps - - POLICY_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' drools` - echo ${POLICY_IP} - - PDP_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' pdp` - echo ${PDP_IP} - - PAP_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' pap` - echo ${PAP_IP} - - BRMS_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' brmsgw` - echo ${BRMS_IP} - - NEXUS_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' nexus` - echo ${NEXUS_IP} - - MARIADB_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' mariadb` - echo ${MARIADB_IP} - - sleep 5m -fi - -netstat -tnl - -${DIR}/wait_for_port.sh ${MARIADB_IP} 3306 -rc=$? -if [[ $rc != 0 ]]; then - echo "cannot open ${MARIADB_IP} 3306" - telnet ${MARIADB_IP} 3306 < /dev/null - nc -vz ${MARIADB_IP} 3306 - docker logs mariadb - exit $rc -fi - -${DIR}/wait_for_port.sh ${NEXUS_IP} 8081 -rc=$? -if [[ $rc != 0 ]]; then - echo "cannot open ${NEXUS_IP} 8081" - netstat -tnl - telnet ${NEXUS_IP} 8081 < /dev/null - nc -vz ${NEXUS_IP} 8081 - docker logs nexus - exit $rc -fi - -${DIR}/wait_for_port.sh ${POLICY_IP} 9696 -rc=$? -if [[ $rc != 0 ]]; then - echo "cannot open ${POLICY_IP} 9696" - netstat -tnl - telnet ${POLICY_IP} 9696 < /dev/null - nc -vz ${POLICY_IP} 9696 - docker logs drools - exit $rc -fi - -${DIR}/wait_for_port.sh ${PAP_IP} 9091 -rc=$? -if [[ $rc != 0 ]]; then - echo "cannot open ${PAP_IP} 9091" - netstat -tnl - telnet ${PAP_IP} 9091 < /dev/null - nc -vz ${PAP_IP} 9091 - docker logs pap - exit $rc -fi - -${DIR}/wait_for_port.sh ${PDP_IP} 8081 -rc=$? -if [[ $rc != 0 ]]; then - echo "cannot open ${PDP_IP} 8081" - netstat -tnl - telnet ${PDP_IP} 8081 < /dev/null - nc -vz ${PDP_IP} 8081 - docker logs pdp - exit $rc -fi - -${DIR}/wait_for_port.sh ${BRMS_IP} 9989 -rc=$? -if [[ $rc != 0 ]]; then - echo "cannot open ${BRMS_IP} 9989" - netstat -tnl - telnet ${BRMS_IP} 9989" < /dev/null - nc -vz ${BRMS_IP} 9989" - docker logs brmsgw - exit $rc -fi - -docker logs drools -docker logs pap -docker logs pdp -docker logs brmsgw - -TIME_OUT=300 -INTERVAL=20 -TIME=0 -while [ "$TIME" -lt "$TIME_OUT" ]; do - curl -k -i --user "demo@people.osaaf.org:demo123456!" -H "ContentType: application/json" -H "Accept: application/json" https://${POLICY_IP}:6969/healthcheck && break - - echo Sleep: $INTERVAL seconds before testing if Policy is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds - sleep $INTERVAL - TIME=$(($TIME+$INTERVAL)) - -done - -TIME_OUT=300 -INTERVAL=20 -TIME=0 -while [ "$TIME" -lt "$TIME_OUT" ]; do - - curl -k -i -v -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'ClientAuth: cHl0aG9uOnRlc3Q=' -H 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' -H 'Environment: TEST' -d '{"policyName": ".*"}' https://${PDP_IP}:8081/pdp/api/getConfig && break - -echo Sleep: $INTERVAL seconds before testing if Policy is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds - sleep $INTERVAL - TIME=$(($TIME+$INTERVAL)) - -done - -# -# Add more sleep for everything to settle -# -sleep 3m 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 Binary files differindex 76f45ea5..3b1ed6f3 100644 --- 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 diff --git a/tests/policy/apex-pdp/data/onap.policies.controlloop.operational.Apex.json b/tests/policy/apex-pdp/data/onap.policies.controlloop.operational.Apex.json index 810d970d..ed030d1d 100644 --- a/tests/policy/apex-pdp/data/onap.policies.controlloop.operational.Apex.json +++ b/tests/policy/apex-pdp/data/onap.policies.controlloop.operational.Apex.json @@ -50,17 +50,17 @@ "default": "1.0.0" }, "id": { - "type": "int", + "type": "integer", "description": "Specifies the engine id", "required": true }, "instance_count": { - "type": "int", + "type": "integer", "description": "Specifies the number of engine threads that should be run", "required": true }, "deployment_port": { - "type": "int", + "type": "integer", "description": "Specifies the port to connect to for engine administration", "required": false, "default": 1 @@ -68,14 +68,12 @@ "policy_model_file_name": { "type": "string", "description": "The name of the file from which to read the APEX policy model", - "required": false, - "default": "" + "required": false }, "policy_type_impl": { "type": "string", "description": "The policy type implementation from which to read the APEX policy model", - "required": false, - "default": "" + "required": false }, "periodic_event_period": { "type": "string", @@ -119,7 +117,7 @@ "required": false }, "synchronous_mode": { - "type": "bool", + "type": "boolean", "description": "Specifies the event handler is syncronous (receive event and send response)", "required": false, "default": false @@ -127,17 +125,15 @@ "synchronous_peer": { "type": "string", "description": "The peer event handler (output for input or input for output) of this event handler in synchronous mode, this parameter is mandatory if the event handler is in synchronous mode", - "required": false, - "default": "" + "required": false }, "synchronous_timeout": { - "type": "int", + "type": "integer", "description": "The timeout in milliseconds for responses to be issued by APEX torequests, this parameter is mandatory if the event handler is in synchronous mode", - "required": false, - "default": "" + "required": false }, "requestor_mode": { - "type": "bool", + "type": "boolean", "description": "Specifies the event handler is in requestor mode (send event and wait for response mode)", "required": false, "default": false @@ -145,14 +141,12 @@ "requestor_peer": { "type": "string", "description": "The peer event handler (output for input or input for output) of this event handler in requestor mode, this parameter is mandatory if the event handler is in requestor mode", - "required": false, - "default": "" + "required": false }, "requestor_timeout": { - "type": "int", + "type": "integer", "description": "The timeout in milliseconds for wait for responses to requests, this parameter is mandatory if the event handler is in requestor mode", - "required": false, - "default": "" + "required": false } } }, @@ -186,7 +180,7 @@ } } }, - "onap.datatypes.policies.controlloop.operational.apex.Environmental": { + "onap.datatypes.policies.controlloop.operational.apex.Environment": { "derived_from": "tosca.datatypes.Root", "properties": { "name": { @@ -237,7 +231,7 @@ } }, "locking": { - "type": "onap.datatypes.policies.controlloop.operational.apex.plugin", + "type": "onap.datatypes.policies.controlloop.operational.apex.Plugin", "description": "The plugin to be used for locking context in and between APEX PDPs at runtime", "required": false }, diff --git a/tests/policy/apex-pdp/data/onap.policies.controlloop.operational.Apex.tosca.json b/tests/policy/apex-pdp/data/onap.policies.controlloop.operational.Apex.tosca.json index b58e5b5b..d03d8fae 100644 --- a/tests/policy/apex-pdp/data/onap.policies.controlloop.operational.Apex.tosca.json +++ b/tests/policy/apex-pdp/data/onap.policies.controlloop.operational.Apex.tosca.json @@ -6,7 +6,6 @@ "operational.sampledomain": { "type": "onap.policies.controlloop.operational.Apex", "type_version": "1.0.0", - "derived_from": "tosca.policies.Root", "name": "onap.policies.controlloop.Operational.apex.sampledomain", "version": "1.0.0", "properties": { diff --git a/tests/policy/api/api-test.robot b/tests/policy/api/api-test.robot index 19aa18ab..76c1bdc6 100644 --- a/tests/policy/api/api-test.robot +++ b/tests/policy/api/api-test.robot @@ -39,7 +39,7 @@ RetrievePolicyTypes Should Be Equal As Strings ${resp.json()['version']} 1.0.0 CreateTCAPolicyTypeV1 - [Documentation] Create TCA Policy Type Version 1 + [Documentation] Create TCA Policy Type Version 1. Trying to create an existing policy type with any change and same version should cause error. ${auth}= Create List healthcheck zb!XztG34 ${postjson}= Get file ${CURDIR}/data/onap.policy.monitoring.cdap.tca.hi.lo.app.v1.json Log Creating session https://${POLICY_API_IP}:6969 @@ -90,9 +90,9 @@ CreateNewMonitoringPolicyV1 Dictionary Should Contain Key ${postjsonobject['topology_template']['policies'][0]} onap.restart.tca SimpleCreateNewMonitoringPolicyV1 - [Documentation] Create a new Monitoring TCA policiy version 1 using simple endpoint + [Documentation] Create a new Monitoring TCA policiy version 1 using simple endpoint. Trying to create an existing policy with any change and same version should cause error. ${auth}= Create List healthcheck zb!XztG34 - ${postjson}= Get file ${CURDIR}/data/vCPE.policy.monitoring.input.tosca.v1.json + ${postjson}= Get file ${CURDIR}/data/vCPE.policy.monitoring.input.tosca.v1_2.json Log Creating session https://${POLICY_API_IP}:6969 ${session}= Create Session policy https://${POLICY_API_IP}:6969 auth=${auth} ${headers}= Create Dictionary Accept=application/json Content-Type=application/json diff --git a/tests/policy/api/data/onap.policy.monitoring.cdap.tca.hi.lo.app.v1.json b/tests/policy/api/data/onap.policy.monitoring.cdap.tca.hi.lo.app.v1.json index f06247d7..1db64f83 100644 --- a/tests/policy/api/data/onap.policy.monitoring.cdap.tca.hi.lo.app.v1.json +++ b/tests/policy/api/data/onap.policy.monitoring.cdap.tca.hi.lo.app.v1.json @@ -3,6 +3,7 @@ "policy_types": { "onap.policies.Monitoring": { "derived_from": "tosca.policies.Root", + "version": "1.0.0", "description": "a base policy type for all policies that governs monitoring provisioning" }, "onap.policies.monitoring.cdap.tca.hi.lo.app": { @@ -210,4 +211,4 @@ } } } -}
\ No newline at end of file +} diff --git a/tests/policy/api/data/vCPE.policy.monitoring.input.tosca.v1_2.json b/tests/policy/api/data/vCPE.policy.monitoring.input.tosca.v1_2.json new file mode 100644 index 00000000..a3faae4d --- /dev/null +++ b/tests/policy/api/data/vCPE.policy.monitoring.input.tosca.v1_2.json @@ -0,0 +1,52 @@ +{ + "tosca_definitions_version": "tosca_simple_yaml_1_0_0", + "topology_template": { + "policies": [ + { + "onap.restart.tca": { + "type": "onap.policies.monitoring.cdap.tca.hi.lo.app", + "version": "1.0.0", + "type_version": "1.0.0", + "description": "monitoring policy", + "metadata": { + "policy-id": "onap.restart.tca" + }, + "properties": { + "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" + } + ] + } + ] + } + } + } + } + ] + } +} diff --git a/tests/policy/drools-applications/drools-applications-test.robot b/tests/policy/drools-applications/drools-applications-test.robot index cf4d3cea..1c9ea1d8 100644 --- a/tests/policy/drools-applications/drools-applications-test.robot +++ b/tests/policy/drools-applications/drools-applications-test.robot @@ -15,3 +15,26 @@ Alive Log Received response from policy ${resp.text} Should Be Equal As Strings ${resp.status_code} 200 Should Be Equal As Strings ${resp.json()['alive']} True + +Healthcheck + [Documentation] Runs Policy PDP-D Health check + ${auth}= Create List demo@people.osaaf.org demo123456! + Log Creating session https://${POLICY_DROOLS_IP}:6969/healthcheck + ${session}= Create Session policy https://${POLICY_DROOLS_IP}:6969 auth=${auth} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= Get Request policy /healthcheck 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()['healthy']} True + +Usecases + [Documentation] Checks usecases controller is up + ${auth}= Create List demo@people.osaaf.org demo123456! + Log Creating session https://${POLICY_DROOLS_IP}:9696 + ${session}= Create Session policy https://${POLICY_DROOLS_IP}:9696 auth=${auth} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${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()['usecases']} 0 + diff --git a/tests/policy/drools-pdp/drools-pdp-test.robot b/tests/policy/drools-pdp/drools-pdp-test.robot index fdb46a92..cf4d3cea 100644 --- a/tests/policy/drools-pdp/drools-pdp-test.robot +++ b/tests/policy/drools-pdp/drools-pdp-test.robot @@ -8,8 +8,8 @@ Library json Alive [Documentation] Runs Policy PDP Alive Check ${auth}= Create List demo@people.osaaf.org demo123456! - Log Creating session https://${POLICY_IP}:9696 - ${session}= Create Session policy https://${POLICY_IP}:9696 auth=${auth} + Log Creating session https://${POLICY_DROOLS_IP}:9696 + ${session}= Create Session policy https://${POLICY_DROOLS_IP}:9696 auth=${auth} ${headers}= Create Dictionary Accept=application/json Content-Type=application/json ${resp}= Get Request policy /policy/pdp/engine headers=${headers} Log Received response from policy ${resp.text} diff --git a/tests/policy/engine/Policy-CSIT.robot b/tests/policy/engine/Policy-CSIT.robot deleted file mode 100644 index e55ccac8..00000000 --- a/tests/policy/engine/Policy-CSIT.robot +++ /dev/null @@ -1,425 +0,0 @@ -*** Settings *** -Documentation Policy ONAP CSIT Test cases -Library String -Library HttpLibrary.HTTP -LIbrary Process -Library BuiltIn -Library ONAPLibrary.Templating -Resource policy_interface.robot - -*** Variables *** -${RESOURCE_PATH_CREATE} /pdp/api/createPolicy -${RESOURCE_PATH_CREATE_PUSH} /pdp/api/pushPolicy -${RESOURCE_PATH_CREATE_DELETE} /pdp/api/deletePolicy -${RESOURCE_PATH_GET_CONFIG} /pdp/api/getConfig -${RESOURCE_PATH_LISTPOLICY} /pdp/api/listPolicy -${CREATE_CONFIG_VFW_TEMPLATE} configpolicy_vFW_R1.jinja -${CREATE_CONFIG_VDNS_TEMPLATE} configpolicy_vDNS_R1.jinja -${CREATE_CONFIG_VCPE_TEMPLATE} configpolicy_vCPE_R1.jinja -${CREATE_OPS_VFW_TEMPLATE} opspolicy_VFW_R1.jinja -${CREATE_OOF_HPA_TEMPLATE} oofpolicy_HPA_R1.jinja -${CREATE_SDNC_VFW_TEMPLATE} sdncnamingpolicy_vFW.jinja -${CREATE_SDNC_VPG_TEMPLATE} sdncnamingpolicy_vPG.jinja -${PUSH_POLICY_TEMPLATE} pushpolicy.jinja -${MULTIPLE_PUSH_POLICY_TEMPLATE} multiple_pushpolicy.jinja -${MULTIPLE_UNPUSH_POLICY_TEMPLATE} multiple_unpushpolicy.jinja -${CREATE_OPS_VDNS_TEMPLATE} opspolicy_VDNS_R1.jinja -${DEL_POLICY_TEMPLATE} deletepolicy.jinja -${GETCONFIG_TEMPLATE} getconfigpolicy.jinja -${GETOOF_TEMPLATE} getoofpolicy.jinja -${LISTPOLICY_TEMPLATE} listpolicy.jinja -${CONFIG_POLICY_VFW_NAME} vFirewall -${CONFIG_POLICY_VFW_TYPE} MicroService -${CONFIG_POLICY_VDNS_NAME} vLoadBalancer -${CONFIG_POLICY_VDNS_TYPE} MicroService -${OPS_POLICY_VFW_NAME} vFirewall -${OPS_POLICY_VFW_TYPE} BRMS_PARAM -${OPS_POLICY_VDNS_NAME} vLoadBalancer -${OPS_POLICY_VDNS_TYPE} BRMS_PARAM -${CONFIG_POLICY_VCPE_NAME} vCPE -${CONFIG_POLICY_VCPE_TYPE} MicroService -${OPS_POLICY_VCPE_NAME} vCPE -${OPS_POLICY_VCPE_TYPE} BRMS_PARAM -${OPS_POLICY_VOLTE_NAME} VoLTE -${OPS_POLICY_VOLTE_TYPE} BRMS_PARAM -${OOF_POLICY_HPA_NAME} HPA -${OOF_POLICY_HPA_TYPE} Optimization -${SDNC_POLICY_VFW_NAME} ONAP_vFW_Naming -${SDNC_POLICY_VPG_NAME} ONAP_vPG_Naming -${MULTIPLE_PUSH_POLICY_NAME1} com.testBase1 -${MULTIPLE_PUSH_POLICY_NAME2} com.testBase2 -${MULTIPLE_PUSH_POLICY_NAME3} com.testBase3 -${file_path} ../testsuite/robot/assets/templates/ControlLoopDemo__closedLoopControlName.drl -${RESOURCE_PATH_UPLOAD} /pdp/api/policyEngineImport?importParametersJson=%7B%22serviceName%22%3A%22Manyu456%22%2C%20%22serviceType%22%3A%22BRMSPARAM%22%7D -${CREATE_OPS_VCPE_TEMPLATE} opspolicy_vCPE_R1.jinja -${CREATE_OPS_VOLTE_TEMPLATE} opspolicy_vOLTE_R1.jinja - - -*** Test Cases *** -Policy Health check - Run Policy Health Check - -VFW Config Policy - ${CONFIG_POLICY_VFW_NAME}= Create Config VFW Policy - Push Config Policy ${CONFIG_POLICY_VFW_NAME} ${CONFIG_POLICY_VFW_TYPE} - #VFW Policy Tests - -VDNS Config Policy - ${CONFIG_POLICY_VDNS_NAME}= Create Config VDNS Policy - Push Config Policy ${CONFIG_POLICY_VDNS_NAME} ${CONFIG_POLICY_VDNS_TYPE} - #VDNS Policy Tests - -VCPE Config Policy - ${CONFIG_POLICY_VCPE_NAME}= Create Config VCPE Policy - Push Config Policy ${CONFIG_POLICY_VCPE_NAME} ${CONFIG_POLICY_VCPE_TYPE} - #VCPE Policy Tests - -VFW Ops Policy - ${OPS_POLICY_VFW_NAME}= Create Ops VFW Policy - Push Ops Policy ${OPS_POLICY_VFW_NAME} ${OPS_POLICY_VFW_TYPE} - -VDNS Ops Policy - ${OPS_POLICY_VDNS_NAME}= Create Ops VDNS Policy - Push Ops Policy ${OPS_POLICY_VDNS_NAME} ${OPS_POLICY_VDNS_TYPE} - -VCPE Ops Policy - ${OPS_POLICY_VCPE_NAME}= Create Ops VCPE Policy - Push Ops Policy ${OPS_POLICY_VCPE_NAME} ${OPS_POLICY_VCPE_TYPE} - -VOLTE Ops Policy - ${OPS_POLICY_VOLTE_NAME}= Create Ops VOLTE Policy - Push Ops Policy ${OPS_POLICY_VOLTE_NAME} ${OPS_POLICY_VOLTE_TYPE} - #VOLTE Policy Tests - -VFW SDNC Naming Policy - ${SDNC_POLICY_VFW_NAME}= Create VFW SDNC Naming Policy - Push Config Policy ${SDNC_POLICY_VFW_NAME} ${CONFIG_POLICY_VFW_TYPE} - #VFW Policy Tests - -VPG SDNC Naming Policy - ${SDNC_POLICY_VPG_NAME}= Create VPG SDNC Naming Policy - Push Config Policy ${SDNC_POLICY_VPG_NAME} ${CONFIG_POLICY_VFW_TYPE} - #VPG Policy Tests - -HPA OOF Policy - ${OOF_POLICY_HPA_NAME}= Create OOF HPA Policy - Push Config Policy ${OOF_POLICY_HPA_NAME} ${OOF_POLICY_HPA_TYPE} - #HPA Policy Tests - -VFW Get Configs Policy - Sleep 5s - Get Configs VFW Policy - -VDNS Get Configs Policy - Sleep 5s - Get Configs VDNS Policy - -VCPE Get Configs Policy - Sleep 5s - Get Configs VCPE Policy - -HPA Get OOF Policy - Sleep 5s - Get OOF HPA Policy - -ListPolicy - ListPolicy test com.Config_Sample.1.xml - -Multiple Push Policy - ${MULTIPLE_PUSH_POLICY_NAME1}= Create Ops VDNS Policy - ${MULTIPLE_PUSH_POLICY_NAME2}= Create Ops VDNS Policy - ${MULTIPLE_PUSH_POLICY_NAME3}= Create Ops VDNS Policy - Push Multiple Policy test ${MULTIPLE_PUSH_POLICY_NAME1} ${MULTIPLE_PUSH_POLICY_NAME2} ${MULTIPLE_PUSH_POLICY_NAME3} ${OPS_POLICY_VDNS_TYPE} - Sleep 5s - Delete Multiple Policy test ${MULTIPLE_PUSH_POLICY_NAME1} ${MULTIPLE_PUSH_POLICY_NAME2} ${MULTIPLE_PUSH_POLICY_NAME3} ${OPS_POLICY_VDNS_TYPE} - -*** Keywords *** - -VFW Policy Tests - ${CONFIG_POLICY_VFW_NAME}= Create Config VFW Policy - Push Config Policy ${CONFIG_POLICY_VFW_NAME} ${CONFIG_POLICY_VFW_TYPE} - Get Configs VFW Policy - ${OPS_POLICY_VFW_NAME}= Create Ops VFW Policy - Push Ops Policy ${OPS_POLICY_VFW_NAME} ${OPS_POLICY_VFW_TYPE} - ${SDNC_POLICY_VFW_NAME}= Create VFW SDNC Naming Policy - Push Config Policy ${CONFIG_POLICY_VFW_NAME} ${CONFIG_POLICY_VFW_TYPE} - -VDNS Policy Tests - ${CONFIG_POLICY_VDNS_NAME}= Create Config VDNS Policy - Push Config Policy ${CONFIG_POLICY_VDNS_NAME} ${CONFIG_POLICY_VDNS_TYPE} - Get Configs VDNS Policy - ${OPS_POLICY_VDNS_NAME}= Create Ops VDNS Policy - Push Ops Policy ${OPS_POLICY_VDNS_NAME} ${OPS_POLICY_VDNS_TYPE} - -VCPE Policy Tests - ${CONFIG_POLICY_VCPE_NAME}= Create Config VCPE Policy - Push Config Policy ${CONFIG_POLICY_VCPE_NAME} ${CONFIG_POLICY_VCPE_TYPE} - Get Configs VCPE Policy - ${OPS_POLICY_VCPE_NAME}= Create Ops VCPE Policy - Push Ops Policy ${OPS_POLICY_VCPE_NAME} ${OPS_POLICY_VCPE_TYPE} - -VPG Policy Tests - ${SDNC_POLICY_VPG_NAME}= Create VPG SDNC Naming Policy - Push Config Policy ${SDNC_POLICY_VPG_NAME} ${CONFIG_POLICY_VFW_TYPE} - -VOLTE Policy Tests - ${OPS_POLICY_VOLTE_NAME}= Create Ops VOLTE Policy - Push Ops Policy ${OPS_POLICY_VOLTE_NAME} ${OPS_POLICY_VOLTE_TYPE} - -HPA Policy Tests - ${OOF_POLICY_HPA_NAME}= Create OOF HPA Policy - Push Config Policy ${OOF_POLICY_HPA_NAME} ${OOF_POLICY_HPA_TYPE} - Get OOF HPA Policy - -Get Configs VFW Policy - [Documentation] Get Config Policy for VFW - Create Environment policy ${CURDIR} - ${getconfigpolicy}= Catenate .*${CONFIG_POLICY_VFW_NAME}* - ${configpolicy_name}= Create Dictionary config_policy_name=${getconfigpolicy} - ${output} = Apply Template policy ${GETCONFIG_TEMPLATE} ${configpolicy_name} - ${get_resp} = Run Policy Get Configs Request ${RESOURCE_PATH_GET_CONFIG} ${output} - Should Be Equal As Strings ${get_resp.status_code} 200 - -Create OOF HPA Policy - [Documentation] Create OOF Policy - Create Environment policy ${CURDIR} - ${randompolicyname} = Create Policy Name - ${policyname1}= Catenate com.${randompolicyname}_HPA - ${OOF_POLICY_HPA_NAME}= Set Test Variable ${policyname1} - ${hpapolicy}= Create Dictionary policy_name=${policyname1} - ${output} = Apply Template policy ${CREATE_OOF_HPA_TEMPLATE} ${hpapolicy} - ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} - Log ${put_resp} - Should Be Equal As Strings ${put_resp.status_code} 200 - [Return] ${policyname1} - -Get OOF HPA Policy - [Documentation] Get OOF Policy for HPA - Create Environment policy ${CURDIR} - ${gethpapolicy}= Catenate .*${OOF_POLICY_HPA_NAME}* - ${hpapolicy_name}= Create Dictionary oof_policy_name=${gethpapolicy} - ${output} = Apply Template policy ${GETOOF_TEMPLATE} ${hpapolicy_name} - ${get_resp} = Run Policy Get Configs Request ${RESOURCE_PATH_GET_CONFIG} ${output} - Should Be Equal As Strings ${get_resp.status_code} 200 - -Create Config VFW Policy - [Documentation] Create Config Policy - Create Environment policy ${CURDIR} - ${randompolicyname} = Create Policy Name - ${policyname1}= Catenate com.${randompolicyname}_vFirewall - ${CONFIG_POLICY_VFW_NAME}= Set Test Variable ${policyname1} - ${configpolicy}= Create Dictionary policy_name=${policyname1} - ${output} = Apply Template policy ${CREATE_CONFIG_VFW_TEMPLATE} ${configpolicy} - ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} - Should Be Equal As Strings ${put_resp.status_code} 200 - [Return] ${policyname1} - -Create VPG SDNC Naming Policy - [Documentation] Create VPG SDNC Naming Policy - Create Environment policy ${CURDIR} - ${randompolicyname} = Create Policy Name - ${policyname1}= Catenate com.${randompolicyname}_ONAP_vPG_Naming - ${SDNC_POLICY_VPG_NAME}= Set Test Variable ${policyname1} - ${sdncpolicy}= Create Dictionary policy_name=${policyname1} - ${output} = Apply Template policy ${CREATE_SDNC_VPG_TEMPLATE} ${sdncpolicy} - ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} - Should Be Equal As Strings ${put_resp.status_code} 200 - [Return] ${policyname1} - -Create VFW SDNC Naming Policy - [Documentation] Create VFW SDNC Naming Policy - Create Environment policy ${CURDIR} - ${randompolicyname} = Create Policy Name - ${policyname1}= Catenate com.${randompolicyname}_ONAP_vFW_Naming - ${SDNC_POLICY_VFW_NAME}= Set Test Variable ${policyname1} - ${sdncpolicy}= Create Dictionary policy_name=${policyname1} - ${output} = Apply Template policy ${CREATE_SDNC_VFW_TEMPLATE} ${sdncpolicy} - ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} - Should Be Equal As Strings ${put_resp.status_code} 200 - [Return] ${policyname1} - -Create Policy Name - [Documentation] Generate Policy Name - [Arguments] ${prefix}=CSIT_ - ${random}= Generate Random String 15 [LOWER][NUMBERS] - ${policyname}= Catenate ${prefix}${random} - [Return] ${policyname} - -Create Ops VFW Policy - [Documentation] Create Operational Policy - Create Environment policy ${CURDIR} - ${randompolicyname} = Create Policy Name - ${policyname1}= Catenate com.${randompolicyname}_vFirewall - ${OPS_POLICY_VFW_NAME}= Set Test Variable ${policyname1} - ${dict}= Create Dictionary policy_name=${policyname1} - ${output} = Apply Template policy ${CREATE_OPS_VFW_TEMPLATE} ${dict} - ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} - Log ${put_resp} - Should Be Equal As Strings ${put_resp.status_code} 200 - [Return] ${policyname1} - -Push Ops Policy - [Documentation] Push Ops Policy - [Arguments] ${policyname} ${policytype} - Create Environment policy ${CURDIR} - ${dict}= Create Dictionary policy_name=${policyname} policy_type=${policytype} - ${output} = Apply Template policy ${PUSH_POLICY_TEMPLATE} ${dict} - ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE_PUSH} ${output} - Should Be Equal As Strings ${put_resp.status_code} 200 - -Push Config Policy - [Documentation] Push Config Policy - [Arguments] ${policyname} ${policytype} - Create Environment policy ${CURDIR} - ${dict}= Create Dictionary policy_name=${policyname} policy_type=${policytype} - ${output} = Apply Template policy ${PUSH_POLICY_TEMPLATE} ${dict} - ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE_PUSH} ${output} - Should Be Equal As Strings ${put_resp.status_code} 200 - -Delete Ops Policy - [Documentation] Delete Config Policy - [Arguments] ${policy_name} - Create Environment policy ${CURDIR} - ${policyname3}= Catenate com.Config_BRMS_Param_${policyname}.1.xml - ${dict}= Create Dictionary policy_name=${policyname3} - ${output} = Apply Template policy ${DEL_POLICY_TEMPLATE} ${dict} - ${put_resp} = Run Policy Delete Request ${RESOURCE_PATH_CREATE_DELETE} ${output} - Should Be Equal As Strings ${put_resp.status_code} 200 - -Delete Config Policy - [Documentation] Delete Ops Policy - [Arguments] ${policy_name} - Create Environment policy ${CURDIR} - ${policyname3}= Catenate com.Config_MS_com.${policy_name}.1.xml - ${dict}= Create Dictionary policy_name=${policyname3} - ${output} = Apply Template policy ${DEL_POLICY_TEMPLATE} ${dict} - ${put_resp} = Run Policy Delete Request ${RESOURCE_PATH_CREATE_DELETE} ${output} - Should Be Equal As Strings ${put_resp.status_code} 200 - -Delete OOF Policy - [Documentation] Delete OOF Policy - [Arguments] ${policy_name} - Create Environment policy ${CURDIR} - ${policyname3}= Catenate com.Config_OOF_${policy_name}.1.xml - ${dict}= Create Dictionary policy_name=${policyname3} - ${output} = Apply Template policy ${DEL_POLICY_TEMPLATE} ${dict} - ${put_resp} = Run Policy Delete Request ${RESOURCE_PATH_CREATE_DELETE} ${output} - Should Be Equal As Strings ${put_resp.status_code} 200 - -Get Configs VDNS Policy - [Documentation] Get Config Policy for VDNS - Create Environment policy ${CURDIR} - ${getconfigpolicy}= Catenate .*${CONFIG_POLICY_VDNS_NAME}* - ${configpolicy_name}= Create Dictionary config_policy_name=${getconfigpolicy} - ${output} = Apply Template policy ${GETCONFIG_TEMPLATE} ${configpolicy_name} - ${get_resp} = Run Policy Get Configs Request ${RESOURCE_PATH_GET_CONFIG} ${output} - Should Be Equal As Strings ${get_resp.status_code} 200 - -Create Config VDNS Policy - [Documentation] Create Config Policy - Create Environment policy ${CURDIR} - ${randompolicyname} = Create Policy Name - ${policyname1}= Catenate com.${randompolicyname}_vLoadBalancer - ${CONFIG_POLICY_VDNS_NAME}= Set Test Variable ${policyname1} - ${configpolicy}= Create Dictionary policy_name=${policyname1} - ${output} = Apply Template policy ${CREATE_CONFIG_VDNS_TEMPLATE} ${configpolicy} - ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} - Should Be Equal As Strings ${put_resp.status_code} 200 - [Return] ${policyname1} - -Create Ops VDNS Policy - [Documentation] Create Operational Policy - Create Environment policy ${CURDIR} - ${randompolicyname} = Create Policy Name - ${policyname1}= Catenate com.${randompolicyname}_vLoadBalancer - ${OPS_POLICY_VDNS_NAME}= Set Test Variable ${policyname1} - ${dict}= Create Dictionary policy_name=${policyname1} - ${output} = Apply Template policy ${CREATE_OPS_VDNS_TEMPLATE} ${dict} - ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} - Log ${put_resp} - Should Be Equal As Strings ${put_resp.status_code} 200 - [Return] ${policyname1} - -Create Config VCPE Policy - [Documentation] Create Config Policy - Create Environment policy ${CURDIR} - ${randompolicyname} = Create Policy Name - ${policyname1}= Catenate com.${randompolicyname}_vCPE - ${CONFIG_POLICY_VCPE_NAME}= Set Test Variable ${policyname1} - ${configpolicy}= Create Dictionary policy_name=${policyname1} - ${output} = Apply Template policy ${CREATE_CONFIG_VCPE_TEMPLATE} ${configpolicy} - ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} - Should Be Equal As Strings ${put_resp.status_code} 200 - [Return] ${policyname1} - -Get Configs VCPE Policy - [Documentation] Get Config Policy for VCPE - Create Environment policy ${CURDIR} - ${getconfigpolicy}= Catenate .*${CONFIG_POLICY_VCPE_NAME}* - ${configpolicy_name}= Create Dictionary config_policy_name=${getconfigpolicy} - ${output} = Apply Template policy ${GETCONFIG_TEMPLATE} ${configpolicy_name} - ${get_resp} = Run Policy Get Configs Request ${RESOURCE_PATH_GET_CONFIG} ${output} - Should Be Equal As Strings ${get_resp.status_code} 200 - -Create Ops vCPE Policy - [Documentation] Create Operational Policy - Create Environment policy ${CURDIR} - ${randompolicyname} = Create Policy Name - ${policyname1}= Catenate com.${randompolicyname}_vCPE - ${OPS_POLICY_VCPE_NAME}= Set Test Variable ${policyname1} - ${dict}= Create Dictionary policy_name=${policyname1} - ${output} = Apply Template policy ${CREATE_OPS_VCPE_TEMPLATE} ${dict} - ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} - Log ${put_resp} - Should Be Equal As Strings ${put_resp.status_code} 200 - [Return] ${policyname1} - -Create Ops VolTE Policy - [Documentation] Create Operational Policy - Create Environment policy ${CURDIR} - ${randompolicyname} = Create Policy Name - ${policyname1}= Catenate com.${randompolicyname}_VoLTE - ${dict}= Create Dictionary policy_name=${policyname1} - ${output} = Apply Template policy ${CREATE_OPS_VOLTE_TEMPLATE} ${dict} - ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} - Log ${put_resp} - Should Be Equal As Strings ${put_resp.status_code} 200 - [Return] ${policyname1} - -Upload DRL file - [Documentation] Upload DRL file1 - ${file_data}= Get Binary File ${file_path} - ${files}= Create Dictionary file=${file_data} - #${CONFIG_POLICY_VDNS_NAME}= Set Test Variable ${policyname1} - # ${files2} = {'file': open('../testsuite/robot/assets/templates/ControlLoopDemo__closedLoopControlName.drl', 'rb')} - # ${files}= Create Dictionary file ${file_data} - ${put_resp} = Run Policy Post form Request ${RESOURCE_PATH_UPLOAD} ${files} - Should Be Equal As Strings ${put_resp.status_code} 200 - -ListPolicy test - [Documentation] Listing Config Policies - [Arguments] ${policy_name} - Create Environment policy ${CURDIR} - ${dict}= Create Dictionary policy_name=${policy_name} - ${output} = Apply Template policy ${LISTPOLICY_TEMPLATE} ${dict} - ${put_resp} = policy_interface.Run Policy Post Request ${RESOURCE_PATH_LISTPOLICY} ${output} - Should Be Equal As Strings ${put_resp.status_code} 200 - -Push Multiple Policy test - [Documentation] Push Multiple Policy - [Arguments] ${policyname1} ${policyname2} ${policyname3} ${policytype} - Create Environment policy ${CURDIR} - ${dict}= Create Dictionary policy_name1=${policyname1} policy_name2=${policyname2} policy_name3=${policyname3} policy_type=${policytype} - ${output} = Apply Template policy ${MULTIPLE_PUSH_POLICY_TEMPLATE} ${dict} - ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE_PUSH} ${output} - Should Be Equal As Strings ${put_resp.status_code} 200 - -Delete Multiple Policy test - [Documentation] Delete Multiple Policy - [Arguments] ${policyname1} ${policyname2} ${policyname3} ${policytype} - Create Environment policy ${CURDIR} - ${dict}= Create Dictionary policy_name1=${policyname1} policy_name2=${policyname2} policy_name3=${policyname3} policy_type=${policytype} - ${output} = Apply Template policy ${MULTIPLE_UNPUSH_POLICY_TEMPLATE} ${dict} - ${put_resp} = Run Policy Delete Request ${RESOURCE_PATH_CREATE_DELETE} ${output} - Should Be Equal As Strings ${put_resp.status_code} 200 - diff --git a/tests/policy/engine/__init__.robot b/tests/policy/engine/__init__.robot deleted file mode 100644 index c7970e6a..00000000 --- a/tests/policy/engine/__init__.robot +++ /dev/null @@ -1,2 +0,0 @@ -*** Settings *** -Documentation Policy - Suite 1 diff --git a/tests/policy/engine/configpolicy_vCPE_R1.jinja b/tests/policy/engine/configpolicy_vCPE_R1.jinja deleted file mode 100644 index 6bcd74fe..00000000 --- a/tests/policy/engine/configpolicy_vCPE_R1.jinja +++ /dev/null @@ -1,7 +0,0 @@ -{ - "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\": { \"policyVersion\": \"v0.0.1\", \"threshholds\": [{ \"severity\": \"MAJOR\", \"fieldPath\": \"$$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value\", \"thresholdValue\": \"0\", \"closedLoopEventStatus\": \"ABATED\", \"closedLoopControlName\": \"ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e\", \"version\": \"1.0.2\", \"direction\": \"EQUAL\" }, { \"severity\": \"CRITICAL\", \"fieldPath\": \"$$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value\", \"thresholdValue\": \"0\", \"closedLoopEventStatus\": \"ONSET\", \"closedLoopControlName\": \"ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e\", \"version\": \"1.0.2\", \"direction\": \"GREATER\" }], \"policyName\": \"DCAE.Config_tca-hi-lo\", \"controlLoopSchemaType\": \"VNF\", \"policyScope\": \"DCAE\", \"eventName\": \"Measurement_vGMUX\" } }", - "policyConfigType": "MicroService", - "policyName": "{{policy_name}}", - "onapName": "DCAE", - "priority": "5" -} diff --git a/tests/policy/engine/configpolicy_vDNS_R1.jinja b/tests/policy/engine/configpolicy_vDNS_R1.jinja deleted file mode 100644 index a2c3eeb9..00000000 --- a/tests/policy/engine/configpolicy_vDNS_R1.jinja +++ /dev/null @@ -1,7 +0,0 @@ -{ - "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\": { \"policyVersion\": \"v0.0.1\", \"threshholds\": [{ \"severity\": \"CRITICAL\", \"fieldPath\": \"$$.event.measurementsForVfScalingFields.vNicUsageArray[*].receivedTotalPacketsDelta\", \"thresholdValue\": \"300\", \"closedLoopEventStatus\": \"ONSET\", \"closedLoopControlName\": \"ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3\", \"version\": \"1.0.2\", \"direction\": \"GREATER_OR_EQUAL\" }], \"policyName\": \"DCAE.Config_tca-hi-lo\", \"controlLoopSchemaType\": \"VM\", \"policyScope\": \"DCAE\", \"eventName\": \"vLoadBalancer\" } }", - "policyConfigType": "MicroService", - "policyName": "{{policy_name}}", - "onapName": "DCAE", - "priority": "5" -} diff --git a/tests/policy/engine/configpolicy_vFW_R1.jinja b/tests/policy/engine/configpolicy_vFW_R1.jinja deleted file mode 100644 index b843a0b0..00000000 --- a/tests/policy/engine/configpolicy_vFW_R1.jinja +++ /dev/null @@ -1,7 +0,0 @@ -{ - "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\": {\"policyVersion\": \"v0.0.1\",\"threshholds\": [{\"severity\": \"MAJOR\",\"fieldPath\": \"$$.event.measurementsForVfScalingFields.vNicUsageArray[*].receivedTotalPacketsDelta\",\"thresholdValue\": \"300\",\"closedLoopEventStatus\": \"ONSET\",\"closedLoopControlName\": \"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\",\"version\": \"1.0.2\",\"direction\": \"LESS_OR_EQUAL\"}, {\"severity\": \"CRITICAL\",\"fieldPath\": \"$$.event.measurementsForVfScalingFields.vNicUsageArray[*].receivedTotalPacketsDelta\",\"thresholdValue\": \"700\",\"closedLoopEventStatus\": \"ONSET\",\"closedLoopControlName\": \"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\",\"version\": \"1.0.2\",\"direction\": \"GREATER_OR_EQUAL\"}],\"policyName\": \"DCAE.Config_tca-hi-lo\",\"controlLoopSchemaType\": \"VNF\",\"policyScope\": \"DCAE\",\"eventName\": \"vFirewallBroadcastPackets\"}}", - "policyConfigType": "MicroService", - "policyName": "{{policy_name}}", - "onapName": "DCAE", - "priority": "5" -} diff --git a/tests/policy/engine/createpolicy.jinja b/tests/policy/engine/createpolicy.jinja deleted file mode 100644 index bbb1f1ad..00000000 --- a/tests/policy/engine/createpolicy.jinja +++ /dev/null @@ -1,21 +0,0 @@ -{ - "policyConfigType": "BRMS_PARAM", - "policyName": "{{policy_name}}", - "policyDescription": "Create BRMS Param policy", - "attributes": { - "RULE": { - "templateName": "ClosedLoopDemo_closedLoopControlName", - "aaiNamedQueryUUID": "2", - "aaiPassword": "2", - "aaiPatternMatch": "2", - "aaiURL": "2", - "actor": "2", - "appcTopic": "2", - "closedLoopControlName": "2", - "msoPassword": "2", - "msoURL": "2", - "msoUsername": "2", - "aaiUsername": "3" - } - } -} diff --git a/tests/policy/engine/deletepolicy.jinja b/tests/policy/engine/deletepolicy.jinja deleted file mode 100644 index 73c5badf..00000000 --- a/tests/policy/engine/deletepolicy.jinja +++ /dev/null @@ -1,5 +0,0 @@ -{ - "pdpGroup": "default", - "policyComponent": "PDP", - "policyName": "{{policy_name}}" -} diff --git a/tests/policy/engine/getconfigpolicy.jinja b/tests/policy/engine/getconfigpolicy.jinja deleted file mode 100644 index 11e8cae6..00000000 --- a/tests/policy/engine/getconfigpolicy.jinja +++ /dev/null @@ -1,8 +0,0 @@ -{ - "configAttributes" : { - }, - "configName" : ".*", - "ecompName" : "DCAE", - "policyName" : "{{config_policy_name}}", - "unique" : false -}
\ No newline at end of file diff --git a/tests/policy/engine/getoofpolicy.jinja b/tests/policy/engine/getoofpolicy.jinja deleted file mode 100644 index 3c7dd755..00000000 --- a/tests/policy/engine/getoofpolicy.jinja +++ /dev/null @@ -1,6 +0,0 @@ -{ - "configAttributes" : { - }, - "policyName" : "{{oof_policy_name}}", - "unique" : false -} diff --git a/tests/policy/engine/global_properties.robot b/tests/policy/engine/global_properties.robot deleted file mode 100644 index e0c816ea..00000000 --- a/tests/policy/engine/global_properties.robot +++ /dev/null @@ -1,30 +0,0 @@ -*** Settings *** -Documentation store all properties that can change or are used in multiple places here -... format is all caps with underscores between words and prepended with GLOBAL -... make sure you prepend them with GLOBAL so that other files can easily see it is from this file. - - -*** Variables *** -${GLOBAL_APPLICATION_ID} robot-ete -${GLOBAL_MSO_STATUS_PATH} /ecomp/mso/infra/orchestrationRequests/v2/ -${GLOBAL_SELENIUM_BROWSER} chrome -${GLOBAL_SELENIUM_BROWSER_CAPABILITIES} Create Dictionary -${GLOBAL_SELENIUM_DELAY} 0 -${GLOBAL_SELENIUM_BROWSER_IMPLICIT_WAIT} 5 -${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} 15 -${GLOBAL_OPENSTACK_HEAT_SERVICE_TYPE} orchestration -${GLOBAL_OPENSTACK_CINDER_SERVICE_TYPE} volume -${GLOBAL_OPENSTACK_NOVA_SERVICE_TYPE} compute -${GLOBAL_OPENSTACK_NEUTRON_SERVICE_TYPE} network -${GLOBAL_OPENSTACK_GLANCE_SERVICE_TYPE} image -${GLOBAL_OPENSTACK_KEYSTONE_SERVICE_TYPE} identity -${GLOBAL_AAI_CLOUD_OWNER} Rackspace -${GLOBAL_BUILD_NUMBER} 31 -${GLOBAL_VM_PRIVATE_KEY} ${EXECDIR}/robot/assets/keys/robot_ssh_private_key.pvt -# policy info - everything is from the private oam network (also called ecomp private network) -${GLOBAL_POLICY_SERVER_URL} https://%{PDP_IP}:8081 -${GLOBAL_POLICY_AUTH} dGVzdHBkcDphbHBoYTEyMw== -${GLOBAL_POLICY_CLIENTAUTH} cHl0aG9uOnRlc3Q= -${GLOBAL_POLICY_HEALTHCHECK_URL} https://%{POLICY_IP}:6969 -${GLOBAL_POLICY_USERNAME} demo@people.osaaf.org -${GLOBAL_POLICY_PASSWORD} demo123456! diff --git a/tests/policy/engine/listpolicy.jinja b/tests/policy/engine/listpolicy.jinja deleted file mode 100644 index ce2d3df0..00000000 --- a/tests/policy/engine/listpolicy.jinja +++ /dev/null @@ -1,3 +0,0 @@ -{ - "policyName": "{{policy_name}}" -} diff --git a/tests/policy/engine/multiple_pushpolicy.jinja b/tests/policy/engine/multiple_pushpolicy.jinja deleted file mode 100644 index bda0da08..00000000 --- a/tests/policy/engine/multiple_pushpolicy.jinja +++ /dev/null @@ -1,5 +0,0 @@ -{ - "policyName":"{{policy_name1}},{{policy_name2}},{{policy_name3}}", - "policyType":"{{policy_type}}", - "pdpGroup":"default" -} diff --git a/tests/policy/engine/multiple_unpushpolicy.jinja b/tests/policy/engine/multiple_unpushpolicy.jinja deleted file mode 100644 index 55fb8810..00000000 --- a/tests/policy/engine/multiple_unpushpolicy.jinja +++ /dev/null @@ -1,6 +0,0 @@ -{ - "policyName": "{{policy_name1}},{{policy_name2}},{{policy_name3}}", - "policyType": "{{policy_type}}", - "policyComponent": "PDP", - "pdpGroup": "default" -} diff --git a/tests/policy/engine/oofpolicy_HPA_R1.jinja b/tests/policy/engine/oofpolicy_HPA_R1.jinja deleted file mode 100644 index 6834ceb6..00000000 --- a/tests/policy/engine/oofpolicy_HPA_R1.jinja +++ /dev/null @@ -1,6 +0,0 @@ -{ - "configBody": "{\"service\":\"hpaPolicy\",\"policyName\":\"testWorkingTOSCA\",\"description\":\"testing\",\"templateVersion\":\"OpenSource.version.1\",\"version\":\"CSIT\",\"priority\":\"5\",\"riskType\":\"SampleRiskType\",\"riskLevel\":\"3\",\"guard\":\"False\",\"content\":{\"identity\":\"testIdentity\",\"policyScope\":[\"test1\",\"test2\",\"test3\"],\"policyType\":\"hpaPolicy\",\"resources\":\"testResources1\",\"flavorFeatures\":[{\"flavorLabel\":\"testFlavor\",\"flavorProperties\":[{\"score\":\"testScore\",\"featureAttributes\":[{\"unit\":\"testUnit\",\"attribute\":\"teatFeatureAttribute\",\"value\":\"testValue\",\"operator\":\"any\"}],\"mandatory\":\"testMandatory\",\"hpaFeature\":\"testHAPFeature\",\"architecture\":\"testArch\"}]}]}}", - "policyConfigType": "Optimization", - "policyName": "{{policy_name}}", - "onapName": "OOF" -} diff --git a/tests/policy/engine/opspolicy_VDNS_R1.jinja b/tests/policy/engine/opspolicy_VDNS_R1.jinja deleted file mode 100644 index 8b1e6d2d..00000000 --- a/tests/policy/engine/opspolicy_VDNS_R1.jinja +++ /dev/null @@ -1,16 +0,0 @@ -{ - "policyConfigType": "BRMS_PARAM", - "policyName": "{{policy_name}}", - "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%0D%0A++version%3A+2.0.0%0D%0A++controlLoopName%3A+ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3%0D%0A++trigger_policy%3A+unique-policy-id-1-scale-up%0D%0A++timeout%3A+1200%0D%0A++abatement%3A+false%0D%0Apolicies%3A%0D%0A++-+id%3A+unique-policy-id-1-scale-up%0D%0A++++name%3A+Create+a+new+VF+Module%0D%0A++++description%3A%0D%0A++++actor%3A+SO%0D%0A++++recipe%3A+VF+Module+Create%0D%0A++++target%3A%0D%0A++++++type%3A+VNF%0D%0A++++retry%3A+0%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" - } - } -}
\ No newline at end of file diff --git a/tests/policy/engine/opspolicy_VFW_R1.jinja b/tests/policy/engine/opspolicy_VFW_R1.jinja deleted file mode 100644 index 0a6977df..00000000 --- a/tests/policy/engine/opspolicy_VFW_R1.jinja +++ /dev/null @@ -1,16 +0,0 @@ -{ - "policyConfigType": "BRMS_PARAM", - "policyName": "{{policy_name}}", - "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" - } - } -} diff --git a/tests/policy/engine/opspolicy_vCPE_R1.jinja b/tests/policy/engine/opspolicy_vCPE_R1.jinja deleted file mode 100644 index a04a0c1e..00000000 --- a/tests/policy/engine/opspolicy_vCPE_R1.jinja +++ /dev/null @@ -1,16 +0,0 @@ -{ - "policyConfigType": "BRMS_PARAM", - "policyName": "{{policy_name}}", - "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" - } - } -}
\ No newline at end of file diff --git a/tests/policy/engine/opspolicy_vOLTE_R1.jinja b/tests/policy/engine/opspolicy_vOLTE_R1.jinja deleted file mode 100644 index 67119659..00000000 --- a/tests/policy/engine/opspolicy_vOLTE_R1.jinja +++ /dev/null @@ -1,16 +0,0 @@ -{ - "policyConfigType": "BRMS_PARAM", - "policyName": "{{policy_name}}", - "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" - } - } -}
\ No newline at end of file diff --git a/tests/policy/engine/policy_interface.robot b/tests/policy/engine/policy_interface.robot deleted file mode 100644 index da7fdd87..00000000 --- a/tests/policy/engine/policy_interface.robot +++ /dev/null @@ -1,66 +0,0 @@ -*** Settings *** -Documentation The main interface for interacting with Policy. It handles low level stuff like managing the http request library and Policy required fields -Library RequestsLibrary -Library String -Library Collections -Resource global_properties.robot - -*** Variables *** -${POLICY_HEALTH_CHECK_PATH} /healthcheck - -*** Keywords *** - -Run Policy Health Check - [Documentation] Runs Policy Health check - ${auth}= Create List ${GLOBAL_POLICY_USERNAME} ${GLOBAL_POLICY_PASSWORD} - Log Creating session ${GLOBAL_POLICY_SERVER_URL} - ${session}= Create Session policy ${GLOBAL_POLICY_HEALTHCHECK_URL} auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= Get Request policy ${POLICY_HEALTH_CHECK_PATH} headers=${headers} - Log Received response from policy ${resp.text} - Should Be Equal As Strings ${resp.status_code} 200 - Should Be True ${resp.json()['healthy']} - @{ITEMS}= Copy List ${resp.json()['details']} - :FOR ${ELEMENT} IN @{ITEMS} - \ Should Be Equal As Strings ${ELEMENT['code']} 200 - \ Should Be True ${ELEMENT['healthy']} - -Run Policy Put Request - [Documentation] Runs Policy Put request - [Arguments] ${data_path} ${data} - Log Creating session ${GLOBAL_POLICY_SERVER_URL} - ${session}= Create Session policy ${GLOBAL_POLICY_SERVER_URL} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json Authorization=Basic ${GLOBAL_POLICY_AUTH} ClientAuth=${GLOBAL_POLICY_CLIENTAUTH} Environment=TEST - ${resp}= Put Request policy ${data_path} data=${data} headers=${headers} - Log Received response from policy ${resp.text} - [Return] ${resp} - -Run Policy Post Request - [Documentation] Runs Policy Post request - [Arguments] ${data_path} ${data} - Log Creating session ${GLOBAL_POLICY_SERVER_URL} - ${session}= Create Session policy ${GLOBAL_POLICY_SERVER_URL} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json Authorization=Basic ${GLOBAL_POLICY_AUTH} ClientAuth=${GLOBAL_POLICY_CLIENTAUTH} Environment=TEST - ${resp}= Post Request policy ${data_path} data=${data} headers=${headers} - Log Received response from policy ${resp.text} - [Return] ${resp} - -Run Policy Delete Request - [Documentation] Runs Policy Delete request - [Arguments] ${data_path} ${data} - Log Creating session ${GLOBAL_POLICY_SERVER_URL} - ${session}= Create Session policy ${GLOBAL_POLICY_SERVER_URL} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json Authorization=Basic ${GLOBAL_POLICY_AUTH} ClientAuth=${GLOBAL_POLICY_CLIENTAUTH} Environment=TEST - ${resp}= Delete Request policy ${data_path} data=${data} headers=${headers} - Log Received response from policy ${resp.text} - [Return] ${resp} - -Run Policy Get Configs Request - [Documentation] Runs Policy Get Configs request - [Arguments] ${data_path} ${data} - Log Creating session ${GLOBAL_POLICY_SERVER_URL} - ${session}= Create Session policy ${GLOBAL_POLICY_SERVER_URL} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json Authorization=Basic ${GLOBAL_POLICY_AUTH} ClientAuth=${GLOBAL_POLICY_CLIENTAUTH} - ${resp}= Post Request policy ${data_path} data=${data} headers=${headers} - Log Received response from policy ${resp.text} - [Return] ${resp} diff --git a/tests/policy/engine/pushpolicy.jinja b/tests/policy/engine/pushpolicy.jinja deleted file mode 100644 index a1faaede..00000000 --- a/tests/policy/engine/pushpolicy.jinja +++ /dev/null @@ -1,5 +0,0 @@ -{ - "policyName":"{{policy_name}}", - "policyType":"{{policy_type}}", - "pdpGroup":"default" -}
\ No newline at end of file diff --git a/tests/policy/engine/sdncnamingpolicy_vFW.jinja b/tests/policy/engine/sdncnamingpolicy_vFW.jinja deleted file mode 100644 index a012d59c..00000000 --- a/tests/policy/engine/sdncnamingpolicy_vFW.jinja +++ /dev/null @@ -1,11 +0,0 @@ -{ - "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": "{{policy_name}}", - "policyConfigType": "MicroService", - "onapName": "SDNC", - "riskLevel": "4", - "riskType": "test", - "guard": "false", - "priority": "4", - "description": "ONAP_VFW_NAMING_TIMESTAMP" -}
\ No newline at end of file diff --git a/tests/policy/engine/sdncnamingpolicy_vPG.jinja b/tests/policy/engine/sdncnamingpolicy_vPG.jinja deleted file mode 100644 index 9aa4f505..00000000 --- a/tests/policy/engine/sdncnamingpolicy_vPG.jinja +++ /dev/null @@ -1,11 +0,0 @@ -{ - "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": "{{policy_name}}", - "policyName": "{{policy_name}}", - "policyConfigType": "MicroService", - "onapName": "SDNC", - "riskLevel": "4", - "riskType": "test", - "guard": "false", - "priority": "4", - "description": "ONAP_VPG_NAMING_TIMESTAMP" -}
\ No newline at end of file |