From f66761dcab725dc97ee23f7c658753f4faf9bf0f Mon Sep 17 00:00:00 2001 From: "adheli.tavares" Date: Thu, 30 Sep 2021 13:50:40 +0100 Subject: Distribution S3P Testing for Istanbul Issue-ID: POLICY-3654 Change-Id: Ib410008418a6d94948270fea1c37e20eb0c59003 Signed-off-by: adheli.tavares --- .../src/main/resources/etc/defaultConfig.json | 2 +- .../src/main/resources/etc/s3pConfig.json | 2 +- .../src/main/resources/testplans/performance.jmx | 8 +- .../src/main/resources/testplans/run_test.sh | 30 +++++ .../distribution/bin/policy-dist.sh | 56 --------- .../distribution/etc/defaultConfig.json | 75 ------------ .../distributionsetup/distribution/etc/logback.xml | 110 ----------------- .../distributionsetup/setup_distribution.sh | 34 ------ .../config/db-migrator/db_migrator_policy_init.sh | 35 ++++++ .../src/main/resources/setup/config/db/db.conf | 16 +++ .../src/main/resources/setup/config/db/db.sh | 22 ++++ .../setup/config/jsonConfigs/apiConfigFile.json | 57 +++++++++ .../setup/config/jsonConfigs/dmaapSimConfig.json | 15 +++ .../setup/config/jsonConfigs/papConfigFile.json | 70 +++++++++++ .../setup/config/jsonConfigs/pdpSimConfig.json | 25 ++++ .../main/resources/setup/config/wait_for_port.sh | 55 +++++++++ .../setup/distribution/bin/policy-dist.sh | 56 +++++++++ .../setup/distribution/etc/defaultConfig.json | 75 ++++++++++++ .../resources/setup/distribution/etc/logback.xml | 110 +++++++++++++++++ .../src/main/resources/setup/docker-compose.yml | 130 +++++++++++++++++++++ .../stability/src/main/resources/setup/down.sh | 22 ++++ .../stability/src/main/resources/setup/start.sh | 62 ++++++++++ .../stability/src/main/resources/setup/versions.sh | 34 ++++++ .../resources/simulatorsetup/config/db/db.conf | 16 --- .../main/resources/simulatorsetup/config/db/db.sh | 22 ---- .../simulatorsetup/config/pdp/OnapPfConfig.json | 21 ---- .../resources/simulatorsetup/docker-compose.yml | 27 ----- .../resources/simulatorsetup/setup_components.sh | 68 ----------- .../src/main/resources/testplans/run_test.sh | 30 +++++ .../src/main/resources/testplans/stability.jmx | 24 ++-- 30 files changed, 862 insertions(+), 447 deletions(-) create mode 100755 testsuites/performance/src/main/resources/testplans/run_test.sh delete mode 100644 testsuites/stability/src/main/resources/distributionsetup/distribution/bin/policy-dist.sh delete mode 100644 testsuites/stability/src/main/resources/distributionsetup/distribution/etc/defaultConfig.json delete mode 100644 testsuites/stability/src/main/resources/distributionsetup/distribution/etc/logback.xml delete mode 100755 testsuites/stability/src/main/resources/distributionsetup/setup_distribution.sh create mode 100755 testsuites/stability/src/main/resources/setup/config/db-migrator/db_migrator_policy_init.sh create mode 100644 testsuites/stability/src/main/resources/setup/config/db/db.conf create mode 100644 testsuites/stability/src/main/resources/setup/config/db/db.sh create mode 100644 testsuites/stability/src/main/resources/setup/config/jsonConfigs/apiConfigFile.json create mode 100644 testsuites/stability/src/main/resources/setup/config/jsonConfigs/dmaapSimConfig.json create mode 100644 testsuites/stability/src/main/resources/setup/config/jsonConfigs/papConfigFile.json create mode 100644 testsuites/stability/src/main/resources/setup/config/jsonConfigs/pdpSimConfig.json create mode 100755 testsuites/stability/src/main/resources/setup/config/wait_for_port.sh create mode 100755 testsuites/stability/src/main/resources/setup/distribution/bin/policy-dist.sh create mode 100644 testsuites/stability/src/main/resources/setup/distribution/etc/defaultConfig.json create mode 100644 testsuites/stability/src/main/resources/setup/distribution/etc/logback.xml create mode 100644 testsuites/stability/src/main/resources/setup/docker-compose.yml create mode 100755 testsuites/stability/src/main/resources/setup/down.sh create mode 100755 testsuites/stability/src/main/resources/setup/start.sh create mode 100755 testsuites/stability/src/main/resources/setup/versions.sh delete mode 100644 testsuites/stability/src/main/resources/simulatorsetup/config/db/db.conf delete mode 100644 testsuites/stability/src/main/resources/simulatorsetup/config/db/db.sh delete mode 100644 testsuites/stability/src/main/resources/simulatorsetup/config/pdp/OnapPfConfig.json delete mode 100644 testsuites/stability/src/main/resources/simulatorsetup/docker-compose.yml delete mode 100755 testsuites/stability/src/main/resources/simulatorsetup/setup_components.sh create mode 100755 testsuites/stability/src/main/resources/testplans/run_test.sh diff --git a/packages/policy-distribution-tarball/src/main/resources/etc/defaultConfig.json b/packages/policy-distribution-tarball/src/main/resources/etc/defaultConfig.json index 9ad5d6bc..a9c9a136 100644 --- a/packages/policy-distribution-tarball/src/main/resources/etc/defaultConfig.json +++ b/packages/policy-distribution-tarball/src/main/resources/etc/defaultConfig.json @@ -63,7 +63,7 @@ "parameterClassName": "org.onap.policy.distribution.reception.decoding.policy.file.PolicyDecoderFileInCsarToPolicyParameterGroup", "parameters": { "policyFileName": "tosca_policy", - "policyTypeFileName": "tosca_policy_type", + "policyTypeFileName": "tosca_policy_type" } } }, diff --git a/packages/policy-distribution-tarball/src/main/resources/etc/s3pConfig.json b/packages/policy-distribution-tarball/src/main/resources/etc/s3pConfig.json index 430b81a1..f293b98c 100644 --- a/packages/policy-distribution-tarball/src/main/resources/etc/s3pConfig.json +++ b/packages/policy-distribution-tarball/src/main/resources/etc/s3pConfig.json @@ -42,7 +42,7 @@ "parameterClassName": "org.onap.policy.distribution.reception.decoding.policy.file.PolicyDecoderFileInCsarToPolicyParameterGroup", "parameters": { "policyFileName": "tosca_policy", - "policyTypeFileName": "tosca_policy_type", + "policyTypeFileName": "tosca_policy_type" } } }, diff --git a/testsuites/performance/src/main/resources/testplans/performance.jmx b/testsuites/performance/src/main/resources/testplans/performance.jmx index d92fe041..2115cdee 100644 --- a/testsuites/performance/src/main/resources/testplans/performance.jmx +++ b/testsuites/performance/src/main/resources/testplans/performance.jmx @@ -285,7 +285,7 @@ ${PAP_HOST} ${PAP_PORT} - https + http /policy/pap/v1/pdps GET @@ -400,7 +400,7 @@ ${PAP_HOST} ${PAP_PORT} - https + http /policy/pap/v1/pdps GET @@ -537,14 +537,14 @@ - https://${PAP_HOST}:${PAP_PORT}/policy/pap/v1 + http://${PAP_HOST}:${PAP_PORT}/policy/pap/v1 healthcheck zb!XztG34 - https://${API_HOST}:${API_PORT}/policy/api/v1 + http://${API_HOST}:${API_PORT}/policy/api/v1 healthcheck zb!XztG34 diff --git a/testsuites/performance/src/main/resources/testplans/run_test.sh b/testsuites/performance/src/main/resources/testplans/run_test.sh new file mode 100755 index 00000000..44a98d38 --- /dev/null +++ b/testsuites/performance/src/main/resources/testplans/run_test.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# ============LICENSE_START======================================================= +# Copyright (c) 2021 Nordix Foundation. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= + +DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +JMETER_HOME=~/jmeter/apache-jmeter-5.4.1/ + +POLICY_API_IP=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' policy-api) +POLICY_PAP_IP=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' policy-pap) +POLICY_DISTRIBUTION_IP=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' policy-distribution) + +${JMETER_HOME}/bin/jmeter -n -t "${DIR}"/performance.jmx -Jduration=14400 \ + -Japihost="${POLICY_API_IP}" \ + -Jpaphost="${POLICY_PAP_IP}" \ + -Jdisthost="${POLICY_DISTRIBUTION_IP}" diff --git a/testsuites/stability/src/main/resources/distributionsetup/distribution/bin/policy-dist.sh b/testsuites/stability/src/main/resources/distributionsetup/distribution/bin/policy-dist.sh deleted file mode 100644 index dc1dd702..00000000 --- a/testsuites/stability/src/main/resources/distributionsetup/distribution/bin/policy-dist.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/sh -# -# ============LICENSE_START======================================================= -# Copyright (C) 2020 Ericsson. All rights reserved. -# Modifications Copyright (C) 2019-2021 Nordix Foundation. -# ================================================================================ -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# SPDX-License-Identifier: Apache-2.0 -# ============LICENSE_END========================================================= -# - -JAVA_HOME=/usr/lib/jvm/java-11-openjdk/ -KEYSTORE="${POLICY_HOME}/etc/ssl/policy-keystore" -KEYSTORE_PASSWD="Pol1cy_0nap" -TRUSTSTORE="${POLICY_HOME}/etc/ssl/policy-truststore" -TRUSTSTORE_PASSWD="Pol1cy_0nap" - -if [ "$#" -eq 1 ]; then - CONFIG_FILE=$1 -else - CONFIG_FILE=${CONFIG_FILE} -fi - -if [ -z "$CONFIG_FILE" ]; then - CONFIG_FILE="${POLICY_HOME}/etc/defaultConfig.json" -fi - -if [[ -f "${POLICY_HOME}"/etc/mounted/policy-truststore ]]; then - echo "overriding policy-truststore" - cp -f "${POLICY_HOME}"/etc/mounted/policy-truststore "${TRUSTSTORE}" -fi - -if [[ -f "${POLICY_HOME}"/etc/mounted/policy-keystore ]]; then - echo "overriding policy-keystore" - cp -f "${POLICY_HOME}"/etc/mounted/policy-keystore "${KEYSTORE}" -fi - -if [[ -f "${POLICY_HOME}"/etc/mounted/logback.xml ]]; then - echo "overriding logback.xml" - cp -f "${POLICY_HOME}"/etc/mounted/logback.xml "${POLICY_HOME}"/etc/ -fi - -echo "Policy distribution config file: $CONFIG_FILE" - -$JAVA_HOME/bin/java -Dcom.sun.management.jmxremote.rmi.port=9090 -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=9090 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.local.only=false -Djava.rmi.server.hostname=127.0.0.1 -cp "${POLICY_HOME}/etc:${POLICY_HOME}/lib/*" -Dlogback.configurationFile=$POLICY_HOME/etc/logback.xml -Djavax.net.ssl.keyStore="$KEYSTORE" -Djavax.net.ssl.keyStorePassword="$KEYSTORE_PASSWD" -Djavax.net.ssl.trustStore="$TRUSTSTORE" -Djavax.net.ssl.trustStorePassword="$TRUSTSTORE_PASSWD" org.onap.policy.distribution.main.startstop.Main -c $CONFIG_FILE diff --git a/testsuites/stability/src/main/resources/distributionsetup/distribution/etc/defaultConfig.json b/testsuites/stability/src/main/resources/distributionsetup/distribution/etc/defaultConfig.json deleted file mode 100644 index ec36c7ae..00000000 --- a/testsuites/stability/src/main/resources/distributionsetup/distribution/etc/defaultConfig.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "name": "SDCDistributionGroup", - "restServerParameters": { - "host": "0.0.0.0", - "port": 6969, - "userName": "healthcheck", - "password": "zb!XztG34" - }, - "receptionHandlerParameters": { - "S3PReceptionHandler": { - "receptionHandlerType": "File", - "receptionHandlerClassName": "org.onap.policy.distribution.reception.handling.file.FileSystemReceptionHandler", - "receptionHandlerConfigurationName": "fileConfiguration", - "pluginHandlerParameters": { - "policyDecoders": { - "ToscaPolicyDecoder":{ - "decoderType":"ToscaPolicyDecoder", - "decoderClassName":"org.onap.policy.distribution.reception.decoding.policy.file.PolicyDecoderFileInCsarToPolicy", - "decoderConfigurationName": "toscaPolicyDecoderConfiguration" - } - }, - "policyForwarders": { - "LifeCycleApiForwarder": { - "forwarderType": "LifeCycleAPI", - "forwarderClassName": "org.onap.policy.distribution.forwarding.lifecycle.api.LifecycleApiPolicyForwarder", - "forwarderConfigurationName": "lifecycleApiConfiguration" - } - } - } - } - }, - "receptionHandlerConfigurationParameters": { - "fileConfiguration": { - "parameterClassName": "org.onap.policy.distribution.reception.handling.file.FileSystemReceptionHandlerConfigurationParameterGroup", - "parameters": { - "watchPath": "/home/policydistribution", - "maxThread": 1 - } - } - }, - "policyDecoderConfigurationParameters": { - "toscaPolicyDecoderConfiguration":{ - "parameterClassName":"org.onap.policy.distribution.reception.decoding.policy.file.PolicyDecoderFileInCsarToPolicyParameterGroup", - "parameters":{ - "policyFileName": "tosca_policy", - "policyTypeFileName": "tosca_policy_type" - } - } - }, - - "policyForwarderConfigurationParameters": { - "lifecycleApiConfiguration": { - "parameterClassName": "org.onap.policy.distribution.forwarding.lifecycle.api.LifecycleApiForwarderParameters", - "parameters": { - "apiParameters": { - "clientName": "policy-api", - "hostname": "policy-api", - "port": 6969, - "useHttps": true, - "userName": "healthcheck", - "password": "zb!XztG34" - }, - "papParameters": { - "clientName": "policy-pap", - "hostname": "policy-pap", - "port": 7000, - "useHttps": true, - "userName": "healthcheck", - "password": "zb!XztG34" - }, - "deployPolicies": true - } - } - } -} diff --git a/testsuites/stability/src/main/resources/distributionsetup/distribution/etc/logback.xml b/testsuites/stability/src/main/resources/distributionsetup/distribution/etc/logback.xml deleted file mode 100644 index f1fbde3e..00000000 --- a/testsuites/stability/src/main/resources/distributionsetup/distribution/etc/logback.xml +++ /dev/null @@ -1,110 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - ${logDir}/${errorLog}.log - - ${logDir}/${errorLog}.%d{yyyy-MM-dd}.%i.log.zip - - 50MB - 30 - 10GB - - - WARN - - - ${errorPattern} - - - - - - - - - ${logDir}/${debugLog}.log - - ${logDir}/${debugLog}.%d{yyyy-MM-dd}.%i.log.zip - - 50MB - 30 - 10GB - - - ${debugPattern} - - - - - - - - - ${logDir}/${networkLog}.log - - ${logDir}/${networkLog}.%d{yyyy-MM-dd}.%i.log.zip - - 50MB - 30 - 10GB - - - ${networkPattern} - - - - - - - - - - - - - - - - - - - - - diff --git a/testsuites/stability/src/main/resources/distributionsetup/setup_distribution.sh b/testsuites/stability/src/main/resources/distributionsetup/setup_distribution.sh deleted file mode 100755 index 54bb88a7..00000000 --- a/testsuites/stability/src/main/resources/distributionsetup/setup_distribution.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# ============LICENSE_START======================================================= -# Copyright (c) 2020-2021 Nordix Foundation. -# ================================================================================ -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# SPDX-License-Identifier: Apache-2.0 -# ============LICENSE_END========================================================= - -# the directory of the script -DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -echo ${DIR} - -if [ "$#" -lt 2 ]; then - echo "PAP and PolicyAPI IPs should be passed as two parameters. PAP IP goes first." - exit 1 -else - PAP=$1 - echo "PAP IP: ${PAP}" - API=$2 - echo "Policy API IP: $API" -fi - -docker run -v /tmp/policydistribution/distributionmount:/home/policydistribution --add-host policy-api:${API} --add-host policy-pap:${PAP} -p 6969:6969 -p 9090:9090 --name policy-distribution -v ${DIR}/distribution/bin/policy-dist.sh:/opt/app/policy/distribution/bin/policy-dist.sh -v ${DIR}/distribution/etc/defaultConfig.json:/opt/app/policy/distribution/etc/defaultConfig.json -v ${DIR}/distribution/etc/logback.xml:/opt/app/policy/distribution/etc/logback.xml -d --rm nexus3.onap.org:10001/onap/policy-distribution:2.5.2-SNAPSHOT diff --git a/testsuites/stability/src/main/resources/setup/config/db-migrator/db_migrator_policy_init.sh b/testsuites/stability/src/main/resources/setup/config/db-migrator/db_migrator_policy_init.sh new file mode 100755 index 00000000..2efdca7b --- /dev/null +++ b/testsuites/stability/src/main/resources/setup/config/db-migrator/db_migrator_policy_init.sh @@ -0,0 +1,35 @@ +#!/bin/sh +# ============LICENSE_START==================================================== +# Copyright (C) 2021 Nordix Foundation. +# ============================================================================= +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END====================================================== + +export POLICY_HOME=/opt/app/policy +export SQL_USER=policy_user +export SQL_PASSWORD=policy_user +export SQL_DB=policyadmin +export SQL_HOST=mariadb + +/opt/app/policy/bin/prepare_upgrade.sh "${SQL_DB}" + +/opt/app/policy/bin/db-migrator -s "${SQL_DB}" -o upgrade +rc=$? + +/opt/app/policy/bin/db-migrator -s "${SQL_DB}" -o report + +nc -l -p 6824 + +exit $rc diff --git a/testsuites/stability/src/main/resources/setup/config/db/db.conf b/testsuites/stability/src/main/resources/setup/config/db/db.conf new file mode 100644 index 00000000..8fbbd566 --- /dev/null +++ b/testsuites/stability/src/main/resources/setup/config/db/db.conf @@ -0,0 +1,16 @@ +# Copyright (C) 2020 Nordix Foundation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +MYSQL_ROOT_PASSWORD=secret +MYSQL_USER=policy_user +MYSQL_PASSWORD=policy_user diff --git a/testsuites/stability/src/main/resources/setup/config/db/db.sh b/testsuites/stability/src/main/resources/setup/config/db/db.sh new file mode 100644 index 00000000..a6242152 --- /dev/null +++ b/testsuites/stability/src/main/resources/setup/config/db/db.sh @@ -0,0 +1,22 @@ +#!/bin/bash -xv +# Copyright (C) 2020 Nordix Foundation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +for db in migration 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}'@'%' ;" +done + +mysql -uroot -p"${MYSQL_ROOT_PASSWORD}" --execute "FLUSH PRIVILEGES;" diff --git a/testsuites/stability/src/main/resources/setup/config/jsonConfigs/apiConfigFile.json b/testsuites/stability/src/main/resources/setup/config/jsonConfigs/apiConfigFile.json new file mode 100644 index 00000000..00715129 --- /dev/null +++ b/testsuites/stability/src/main/resources/setup/config/jsonConfigs/apiConfigFile.json @@ -0,0 +1,57 @@ +{ + "name": "ApiGroup", + "restServerParameters": { + "host": "0.0.0.0", + "port": 6969, + "userName": "healthcheck", + "password": "zb!XztG34", + "https": false, + "aaf": false, + "prometheus": false + }, + "databaseProviderParameters": { + "name": "PolicyProviderParameterGroup", + "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl", + "databaseDriver": "org.mariadb.jdbc.Driver", + "databaseUrl": "jdbc:mariadb://mariadb:3306/policyadmin", + "databaseUser": "policy_user", + "databasePassword": "policy_user", + "persistenceUnit": "PolicyMariaDb" + }, + "preloadPolicyTypes": [ + "policytypes/onap.policies.monitoring.tcagen2.yaml", + "policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.yaml", + "policytypes/onap.policies.monitoring.dcae-restconfcollector.yaml", + "policytypes/onap.policies.monitoring.dcae-pm-subscription-handler.yaml", + "policytypes/onap.policies.monitoring.dcae-pm-mapper.yaml", + "policytypes/onap.policies.Optimization.yaml", + "policytypes/onap.policies.optimization.Resource.yaml", + "policytypes/onap.policies.optimization.Service.yaml", + "policytypes/onap.policies.optimization.resource.AffinityPolicy.yaml", + "policytypes/onap.policies.optimization.resource.DistancePolicy.yaml", + "policytypes/onap.policies.optimization.resource.HpaPolicy.yaml", + "policytypes/onap.policies.optimization.resource.OptimizationPolicy.yaml", + "policytypes/onap.policies.optimization.resource.PciPolicy.yaml", + "policytypes/onap.policies.optimization.service.QueryPolicy.yaml", + "policytypes/onap.policies.optimization.service.SubscriberPolicy.yaml", + "policytypes/onap.policies.optimization.resource.Vim_fit.yaml", + "policytypes/onap.policies.optimization.resource.VnfPolicy.yaml", + "policytypes/onap.policies.controlloop.guard.Common.yaml", + "policytypes/onap.policies.controlloop.guard.common.Blacklist.yaml", + "policytypes/onap.policies.controlloop.guard.common.FrequencyLimiter.yaml", + "policytypes/onap.policies.controlloop.guard.common.MinMax.yaml", + "policytypes/onap.policies.controlloop.guard.common.Filter.yaml", + "policytypes/onap.policies.controlloop.guard.coordination.FirstBlocksSecond.yaml", + "policytypes/onap.policies.Naming.yaml", + "policytypes/onap.policies.Match.yaml", + "policytypes/onap.policies.native.Drools.yaml", + "policytypes/onap.policies.native.Xacml.yaml", + "policytypes/onap.policies.native.Apex.yaml", + "policytypes/onap.policies.controlloop.operational.Common.yaml", + "policytypes/onap.policies.controlloop.operational.common.Apex.yaml", + "policytypes/onap.policies.controlloop.operational.common.Drools.yaml" + ], + "preloadPolicies" : [ + "policies/sdnc.policy.naming.input.tosca.yaml" + ] +} diff --git a/testsuites/stability/src/main/resources/setup/config/jsonConfigs/dmaapSimConfig.json b/testsuites/stability/src/main/resources/setup/config/jsonConfigs/dmaapSimConfig.json new file mode 100644 index 00000000..fc08b0a8 --- /dev/null +++ b/testsuites/stability/src/main/resources/setup/config/jsonConfigs/dmaapSimConfig.json @@ -0,0 +1,15 @@ +{ + "dmaapProvider": { + "name": "DMaaP simulator", + "topicSweepSec": 900 + }, + "restServers": [ + { + "name": "DMaaP simulator", + "providerClass": "org.onap.policy.models.sim.dmaap.rest.DmaapSimRestControllerV1", + "host": "0.0.0.0", + "port": 3904, + "https": false + } + ] +} \ No newline at end of file diff --git a/testsuites/stability/src/main/resources/setup/config/jsonConfigs/papConfigFile.json b/testsuites/stability/src/main/resources/setup/config/jsonConfigs/papConfigFile.json new file mode 100644 index 00000000..456735be --- /dev/null +++ b/testsuites/stability/src/main/resources/setup/config/jsonConfigs/papConfigFile.json @@ -0,0 +1,70 @@ +{ + "name": "PapGroup", + "restServerParameters": { + "host": "0.0.0.0", + "port": 6969, + "userName": "healthcheck", + "password": "zb!XztG34", + "https": false, + "aaf": false, + "prometheus": true + }, + "pdpParameters": { + "heartBeatMs": 20000, + "updateParameters": { + "maxRetryCount": 1, + "maxWaitMs": 30000 + }, + "stateChangeParameters": { + "maxRetryCount": 1, + "maxWaitMs": 30000 + } + }, + "databaseProviderParameters": { + "name": "PolicyProviderParameterGroup", + "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl", + "databaseDriver": "org.mariadb.jdbc.Driver", + "databaseUrl": "jdbc:mariadb://mariadb:3306/policyadmin", + "databaseUser": "policy_user", + "databasePassword": "policy_user", + "persistenceUnit": "PolicyMariaDb" + }, + "savePdpStatisticsInDb": true, + "topicParameterGroup": { + "topicSources" : [{ + "topic" : "POLICY-PDP-PAP", + "servers" : [ "message-router:3904" ], + "topicCommInfrastructure" : "dmaap", + "useHttps": false + }, + { + "topic" : "POLICY-HEARTBEAT", + "effectiveTopic": "POLICY-PDP-PAP", + "consumerGroup": "policy-pap", + "servers" : [ "message-router:3904" ], + "topicCommInfrastructure" : "dmaap", + "useHttps": false + }], + "topicSinks" : [{ + "topic" : "POLICY-PDP-PAP", + "servers" : [ "message-router:3904" ], + "topicCommInfrastructure" : "dmaap", + "useHttps": false + }, + { + "topic" : "POLICY-NOTIFICATION", + "servers" : [ "message-router:3904" ], + "topicCommInfrastructure" : "dmaap", + "useHttps": false + }] + }, + "healthCheckRestClientParameters":[{ + "clientName": "api", + "hostname": "policy-api", + "port": 6969, + "userName": "healthcheck", + "password": "zb!XztG34", + "useHttps": false, + "basePath": "policy/api/v1/healthcheck" + }] +} diff --git a/testsuites/stability/src/main/resources/setup/config/jsonConfigs/pdpSimConfig.json b/testsuites/stability/src/main/resources/setup/config/jsonConfigs/pdpSimConfig.json new file mode 100644 index 00000000..396b9f7a --- /dev/null +++ b/testsuites/stability/src/main/resources/setup/config/jsonConfigs/pdpSimConfig.json @@ -0,0 +1,25 @@ +{ + "name":"OnapPfParameterGroup", + "pdpStatusParameters": { + "pdpGroup": "defaultGroup", + "timeIntervalMs": 120000, + "pdpType":"apex", + "description":"Pdp Heartbeat", + "supportedPolicyTypes":[ + {"name":"onap.policies.controlloop.operational.common.Apex","version":"1.0.0"}, + {"name":"onap.policies.native.Apex","version":"1.0.0"} + ] + }, + "topicParameterGroup": { + "topicSources" : [{ + "topic" : "POLICY-PDP-PAP", + "servers" : [ "message-router:3904" ], + "topicCommInfrastructure" : "dmaap" + }], + "topicSinks" : [{ + "topic" : "POLICY-PDP-PAP", + "servers" : [ "message-router:3904" ], + "topicCommInfrastructure" : "dmaap" + }] + } +} diff --git a/testsuites/stability/src/main/resources/setup/config/wait_for_port.sh b/testsuites/stability/src/main/resources/setup/config/wait_for_port.sh new file mode 100755 index 00000000..63e2a493 --- /dev/null +++ b/testsuites/stability/src/main/resources/setup/config/wait_for_port.sh @@ -0,0 +1,55 @@ +#!/bin/sh +# ============LICENSE_START==================================================== +# Copyright (C) 2020 Nordix Foundation. +# ============================================================================= +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END====================================================== + +time_out=120 +cmd= +while getopts c:t: opt; do + case "$opt" in + c) cmd="$OPTARG" ;; + t) time_out="$OPTARG" ;; + esac +done +nargs=$(expr $OPTIND - 1) +shift $nargs + +even_args=$(expr $# % 2) +if [ $# -lt 2 -o "$even_args" -ne 0 ]; then + echo "args: [-t timeout] [-c command] hostname1 port1 hostname2 port2 ..." >&2 + exit 1 +fi + +while [ $# -ge 2 ]; do + export host=$1 + export port=$2 + shift + shift + + echo "Waiting for $host port $port..." + timeout "$time_out" sh -c 'until nc -vz "$host" "$port"; do echo -n "."; sleep 1; done' + rc=$? + + if [ $rc != 0 ]; then + echo "$host port $port cannot be reached" + exit $rc + fi +done + +$cmd + +exit 0 diff --git a/testsuites/stability/src/main/resources/setup/distribution/bin/policy-dist.sh b/testsuites/stability/src/main/resources/setup/distribution/bin/policy-dist.sh new file mode 100755 index 00000000..2d781ea1 --- /dev/null +++ b/testsuites/stability/src/main/resources/setup/distribution/bin/policy-dist.sh @@ -0,0 +1,56 @@ +#!/bin/sh +# +# ============LICENSE_START======================================================= +# Copyright (C) 2020 Ericsson. All rights reserved. +# Modifications Copyright (C) 2019-2021 Nordix Foundation. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= +# + +JAVA_HOME=/usr/lib/jvm/java-11-openjdk/ +KEYSTORE="${POLICY_HOME}/etc/ssl/policy-keystore" +KEYSTORE_PASSWD="Pol1cy_0nap" +TRUSTSTORE="${POLICY_HOME}/etc/ssl/policy-truststore" +TRUSTSTORE_PASSWD="Pol1cy_0nap" + +if [ "$#" -eq 1 ]; then + CONFIG_FILE=$1 +else + CONFIG_FILE=${CONFIG_FILE} +fi + +if [ -z "$CONFIG_FILE" ]; then + CONFIG_FILE="${POLICY_HOME}/etc/defaultConfig.json" +fi + +if [[ -f "${POLICY_HOME}"/etc/mounted/policy-truststore ]]; then + echo "overriding policy-truststore" + cp -f "${POLICY_HOME}"/etc/mounted/policy-truststore "${TRUSTSTORE}" +fi + +if [[ -f "${POLICY_HOME}"/etc/mounted/policy-keystore ]]; then + echo "overriding policy-keystore" + cp -f "${POLICY_HOME}"/etc/mounted/policy-keystore "${KEYSTORE}" +fi + +if [[ -f "${POLICY_HOME}"/etc/mounted/logback.xml ]]; then + echo "overriding logback.xml" + cp -f "${POLICY_HOME}"/etc/mounted/logback.xml "${POLICY_HOME}"/etc/ +fi + +echo "Policy distribution config file: $CONFIG_FILE" + +$JAVA_HOME/bin/java -Dcom.sun.management.jmxremote.rmi.port=9090 -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=9090 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.local.only=false -cp "${POLICY_HOME}/etc:${POLICY_HOME}/lib/*" -Dlogback.configurationFile=$POLICY_HOME/etc/logback.xml -Djavax.net.ssl.keyStore="$KEYSTORE" -Djavax.net.ssl.keyStorePassword="$KEYSTORE_PASSWD" -Djavax.net.ssl.trustStore="$TRUSTSTORE" -Djavax.net.ssl.trustStorePassword="$TRUSTSTORE_PASSWD" org.onap.policy.distribution.main.startstop.Main -c $CONFIG_FILE diff --git a/testsuites/stability/src/main/resources/setup/distribution/etc/defaultConfig.json b/testsuites/stability/src/main/resources/setup/distribution/etc/defaultConfig.json new file mode 100644 index 00000000..22970c40 --- /dev/null +++ b/testsuites/stability/src/main/resources/setup/distribution/etc/defaultConfig.json @@ -0,0 +1,75 @@ +{ + "name": "SDCDistributionGroup", + "restServerParameters": { + "host": "0.0.0.0", + "port": 6969, + "userName": "healthcheck", + "password": "zb!XztG34" + }, + "receptionHandlerParameters": { + "S3PReceptionHandler": { + "receptionHandlerType": "File", + "receptionHandlerClassName": "org.onap.policy.distribution.reception.handling.file.FileSystemReceptionHandler", + "receptionHandlerConfigurationName": "fileConfiguration", + "pluginHandlerParameters": { + "policyDecoders": { + "ToscaPolicyDecoder":{ + "decoderType":"ToscaPolicyDecoder", + "decoderClassName":"org.onap.policy.distribution.reception.decoding.policy.file.PolicyDecoderFileInCsarToPolicy", + "decoderConfigurationName": "toscaPolicyDecoderConfiguration" + } + }, + "policyForwarders": { + "LifeCycleApiForwarder": { + "forwarderType": "LifeCycleAPI", + "forwarderClassName": "org.onap.policy.distribution.forwarding.lifecycle.api.LifecycleApiPolicyForwarder", + "forwarderConfigurationName": "lifecycleApiConfiguration" + } + } + } + } + }, + "receptionHandlerConfigurationParameters": { + "fileConfiguration": { + "parameterClassName": "org.onap.policy.distribution.reception.handling.file.FileSystemReceptionHandlerConfigurationParameterGroup", + "parameters": { + "watchPath": "/home/policydistribution", + "maxThread": 1 + } + } + }, + "policyDecoderConfigurationParameters": { + "toscaPolicyDecoderConfiguration":{ + "parameterClassName":"org.onap.policy.distribution.reception.decoding.policy.file.PolicyDecoderFileInCsarToPolicyParameterGroup", + "parameters":{ + "policyFileName": "tosca_policy", + "policyTypeFileName": "tosca_policy_type" + } + } + }, + + "policyForwarderConfigurationParameters": { + "lifecycleApiConfiguration": { + "parameterClassName": "org.onap.policy.distribution.forwarding.lifecycle.api.LifecycleApiForwarderParameters", + "parameters": { + "apiParameters": { + "clientName": "policy-api", + "hostname": "policy-api", + "port": 6969, + "useHttps": false, + "userName": "healthcheck", + "password": "zb!XztG34" + }, + "papParameters": { + "clientName": "policy-pap", + "hostname": "policy-pap", + "port": 6969, + "useHttps": false, + "userName": "healthcheck", + "password": "zb!XztG34" + }, + "deployPolicies": true + } + } + } +} diff --git a/testsuites/stability/src/main/resources/setup/distribution/etc/logback.xml b/testsuites/stability/src/main/resources/setup/distribution/etc/logback.xml new file mode 100644 index 00000000..2b77efb6 --- /dev/null +++ b/testsuites/stability/src/main/resources/setup/distribution/etc/logback.xml @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + + + ${logDir}/${errorLog}.log + + ${logDir}/${errorLog}.%d{yyyy-MM-dd}.%i.log.zip + + 50MB + 30 + 10GB + + + WARN + + + ${errorPattern} + + + + + + + + + ${logDir}/${debugLog}.log + + ${logDir}/${debugLog}.%d{yyyy-MM-dd}.%i.log.zip + + 50MB + 30 + 10GB + + + ${debugPattern} + + + + + + + + + ${logDir}/${networkLog}.log + + ${logDir}/${networkLog}.%d{yyyy-MM-dd}.%i.log.zip + + 50MB + 30 + 10GB + + + ${networkPattern} + + + + + + + + + + + + + + + + + + + + + diff --git a/testsuites/stability/src/main/resources/setup/docker-compose.yml b/testsuites/stability/src/main/resources/setup/docker-compose.yml new file mode 100644 index 00000000..e36a0c8b --- /dev/null +++ b/testsuites/stability/src/main/resources/setup/docker-compose.yml @@ -0,0 +1,130 @@ +# Copyright (C) 2020 Nordix Foundation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: '3' +services: + mariadb: + image: nexus3.onap.org:10001/mariadb:${POLICY_MARIADB_VER} + container_name: mariadb + hostname: mariadb + command: [ '--lower-case-table-names=1', '--wait_timeout=28800' ] + env_file: config/db/db.conf + volumes: + - ./config/db:/docker-entrypoint-initdb.d:ro + expose: + - 3306 + policy-db-migrator: + image: nexus3.onap.org:10001/onap/policy-db-migrator:${POLICY_DB_MIGRATOR} + container_name: policy-db-migrator + hostname: policy-db-migrator + depends_on: + - mariadb + expose: + - 6824 + env_file: config/db/db.conf + environment: + SQL_DB: policyadmin + SQL_HOST: mariadb + volumes: + - ./config/db-migrator/db_migrator_policy_init.sh:/opt/app/policy/bin/db_migrator_policy_init.sh:ro + - ./config/wait_for_port.sh:/opt/app/policy/bin/wait_for_port.sh:ro + entrypoint: /opt/app/policy/bin/wait_for_port.sh + command: [ + '-c', + '/opt/app/policy/bin/db_migrator_policy_init.sh', + 'mariadb', '3306' + ] + simulator: + image: nexus3.onap.org:10001/onap/policy-models-simulator:${POLICY_MODELS_SIMULATOR} + container_name: simulator + hostname: simulator + networks: + default: + aliases: + - message-router + expose: + - 3904 + volumes: + - ./config/jsonConfigs/dmaapSimConfig.json:/opt/app/policy/simulators/etc/mounted/simParameters.json:ro + pdp: + image: pdp/simulator + container_name: pdp-simulator + depends_on: + - simulator + hostname: pdp-simulator + volumes: + - ./config/wait_for_port.sh:/opt/app/policy/pdp-sim/bin/wait_for_port.sh:ro + - ./config/jsonConfigs/pdpSimConfig.json:/opt/app/policy/pdp-sim/etc/config/OnapPfConfig.json:ro + entrypoint: /opt/app/policy/pdp-sim/bin/wait_for_port.sh + command: [ + '-c', '/opt/app/policy/pdp-sim/bin/pdp-sim.sh', + 'message-router', '3904', + ] + policy-api: + image: nexus3.onap.org:10001/onap/policy-api:${POLICY_API_VERSION} + container_name: policy-api + hostname: policy-api + expose: + - 6969 + depends_on: + - policy-db-migrator + volumes: + - ./config/jsonConfigs/apiConfigFile.json:/opt/app/policy/api/etc/defaultConfig.json:ro + - ./config/wait_for_port.sh:/opt/app/policy/api/bin/wait_for_port.sh:ro + entrypoint: /opt/app/policy/api/bin/wait_for_port.sh + command: [ + '-c', './policy-api.sh', + 'mariadb', '3306', + 'policy-db-migrator', '6824' + ] + policy-pap: + image: nexus3.onap.org:10001/onap/policy-pap:${POLICY_PAP_VERSION} + container_name: policy-pap + hostname: policy-pap + expose: + - 6969 + depends_on: + - policy-db-migrator + - simulator + - policy-api + volumes: + - ./config/wait_for_port.sh:/opt/app/policy/pap/bin/wait_for_port.sh:ro + - ./config/jsonConfigs/papConfigFile.json:/opt/app/policy/pap/etc/defaultConfig.json:ro + entrypoint: /opt/app/policy/pap/bin/wait_for_port.sh + command: [ + '-c', './policy-pap.sh', + 'mariadb', '3306', + 'message-router', '3904', + 'policy-api', '6969' + ] + policy-dist: + image: nexus3.onap.org:10001/onap/policy-distribution:${POLICY_DIST_VERSION} + volumes: + - /tmp/policydistribution/distributionmount:/home/policydistribution + - ./distribution/bin/policy-dist.sh:/opt/app/policy/distribution/bin/policy-dist.sh + - ./distribution/etc/defaultConfig.json:/opt/app/policy/distribution/etc/defaultConfig.json + - ./distribution/etc/logback.xml:/opt/app/policy/distribution/etc/logback.xml + - ./config/wait_for_port.sh:/opt/app/policy/bin/wait_for_port.sh:ro + expose: + - 6969 + - 9090 + container_name: policy-distribution + entrypoint: /opt/app/policy/bin/wait_for_port.sh + command: [ + '-c', './policy-dist.sh', + 'mariadb', '3306', + 'message-router', '3904', + 'policy-api', '6969', + 'policy-pap', '6969' + ] diff --git a/testsuites/stability/src/main/resources/setup/down.sh b/testsuites/stability/src/main/resources/setup/down.sh new file mode 100755 index 00000000..75543224 --- /dev/null +++ b/testsuites/stability/src/main/resources/setup/down.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# ============LICENSE_START======================================================= +# Copyright (c) 2021 Nordix Foundation. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= + +source "$(pwd)"/versions.sh +docker-compose down +docker ps diff --git a/testsuites/stability/src/main/resources/setup/start.sh b/testsuites/stability/src/main/resources/setup/start.sh new file mode 100755 index 00000000..2f72cb04 --- /dev/null +++ b/testsuites/stability/src/main/resources/setup/start.sh @@ -0,0 +1,62 @@ +#!/bin/bash +# ============LICENSE_START======================================================= +# Copyright (c) 2021 Nordix Foundation. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= + +# load up all the image version +source "$(pwd)"/versions.sh + +DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +WORK_DIR=$(mktemp -d -p "$DIR") +echo "${WORK_DIR}" + +cd "${WORK_DIR}" || exit + +# 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 +curl -O -s -S https://dlcdn.apache.org/maven/maven-3/3.8.3/binaries/apache-maven-3.8.3-bin.tar.gz +tar -xzvf apache-maven-3.8.3-bin.tar.gz +MAVEN="${WORK_DIR}"/apache-maven-3.8.3/bin/mvn +$MAVEN -v +echo "" + +# clone oparent for maven settings and models for building pdp/simulator +git clone http://gerrit.onap.org/r/oparent +git clone --depth 1 https://gerrit.onap.org/r/policy/models -b master + +cd models/models-sim/policy-models-sim-pdp || exit +$MAVEN clean install -DskipTests --settings "${WORK_DIR}"/oparent/settings.xml +bash ./src/main/package/docker/docker_build.sh + +cd "$DIR" || exit +rm -rf "${WORK_DIR}" +echo "" + +sudo mkdir -p /tmp/policydistribution/distributionmount +sudo chmod -R a+trwx /tmp + +# start containers on the background +docker-compose up --detach +echo "" + +# check if all containers are up +docker ps diff --git a/testsuites/stability/src/main/resources/setup/versions.sh b/testsuites/stability/src/main/resources/setup/versions.sh new file mode 100755 index 00000000..44829d15 --- /dev/null +++ b/testsuites/stability/src/main/resources/setup/versions.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# ============LICENSE_START======================================================= +# Copyright (c) 2021 Nordix Foundation. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= + +# update versions here +export POLICY_MARIADB_VER=10.5.8 +export POLICY_DB_MIGRATOR=2.3.1-SNAPSHOT +export POLICY_API_VERSION=2.5.1-SNAPSHOT +export POLICY_PAP_VERSION=2.5.1-SNAPSHOT +export POLICY_MODELS_SIMULATOR=2.5.1-SNAPSHOT +export POLICY_DIST_VERSION=2.6.1-SNAPSHOT + +echo " MariaDB Version: ${POLICY_MARIADB_VER}" +echo " Policy DB Migrator Version: ${POLICY_DB_MIGRATOR}" +echo " Policy API Version: ${POLICY_API_VERSION}" +echo " Policy PAP Version: ${POLICY_PAP_VERSION}" +echo "Policy Models Simulator Version: ${POLICY_MODELS_SIMULATOR}" +echo " Policy Distribution Version: ${POLICY_DIST_VERSION}" +echo "" diff --git a/testsuites/stability/src/main/resources/simulatorsetup/config/db/db.conf b/testsuites/stability/src/main/resources/simulatorsetup/config/db/db.conf deleted file mode 100644 index 8fbbd566..00000000 --- a/testsuites/stability/src/main/resources/simulatorsetup/config/db/db.conf +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (C) 2020 Nordix Foundation. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -MYSQL_ROOT_PASSWORD=secret -MYSQL_USER=policy_user -MYSQL_PASSWORD=policy_user diff --git a/testsuites/stability/src/main/resources/simulatorsetup/config/db/db.sh b/testsuites/stability/src/main/resources/simulatorsetup/config/db/db.sh deleted file mode 100644 index 86bf9411..00000000 --- a/testsuites/stability/src/main/resources/simulatorsetup/config/db/db.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -xv -# Copyright (C) 2020 Nordix Foundation. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -for db in policyadmin -do - mysql -uroot -p"${MYSQL_ROOT_PASSWORD}" --execute "CREATE DATABASE IF NOT EXISTS ${db};" - mysql -uroot -p"${MYSQL_ROOT_PASSWORD}" --execute "GRANT ALL PRIVILEGES ON \`${db}\`.* TO '${MYSQL_USER}'@'%' ;" -done - -mysql -uroot -p"${MYSQL_ROOT_PASSWORD}" --execute "FLUSH PRIVILEGES;" diff --git a/testsuites/stability/src/main/resources/simulatorsetup/config/pdp/OnapPfConfig.json b/testsuites/stability/src/main/resources/simulatorsetup/config/pdp/OnapPfConfig.json deleted file mode 100644 index de31d50f..00000000 --- a/testsuites/stability/src/main/resources/simulatorsetup/config/pdp/OnapPfConfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name":"OnapPfParameterGroup", - "pdpStatusParameters":{ - "timeIntervalMs": 120000, - "pdpType":"apex", - "description":"Pdp Heartbeat", - "supportedPolicyTypes":[{"name":"onap.policies.controlloop.operational.Apex","version":"1.0.0"}] - }, - "topicParameterGroup": { - "topicSources" : [{ - "topic" : "POLICY-PDP-PAP", - "servers" : [ "message-router" ], - "topicCommInfrastructure" : "dmaap" - }], - "topicSinks" : [{ - "topic" : "POLICY-PDP-PAP", - "servers" : [ "message-router" ], - "topicCommInfrastructure" : "dmaap" - }] - } -} diff --git a/testsuites/stability/src/main/resources/simulatorsetup/docker-compose.yml b/testsuites/stability/src/main/resources/simulatorsetup/docker-compose.yml deleted file mode 100644 index 7eb2fb2e..00000000 --- a/testsuites/stability/src/main/resources/simulatorsetup/docker-compose.yml +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright (C) 2020 Nordix Foundation. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -version: '2' -services: - message-router: - image: dmaap/simulator - container_name: dmaap-simulator - hostname: dmaap-simulator - ports: - - "3904:3904" - pdp: - image: pdp/simulator - container_name: pdp-simulator - depends_on: - - message-router - hostname: pdp-simulator diff --git a/testsuites/stability/src/main/resources/simulatorsetup/setup_components.sh b/testsuites/stability/src/main/resources/simulatorsetup/setup_components.sh deleted file mode 100755 index 55fea5dd..00000000 --- a/testsuites/stability/src/main/resources/simulatorsetup/setup_components.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/bash -# ============LICENSE_START======================================================= -# Copyright (c) 2020-2021 Nordix Foundation. -# ================================================================================ -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# SPDX-License-Identifier: Apache-2.0 -# ============LICENSE_END========================================================= - -# the directory of the script -DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -echo ${DIR} - -# change to VM IP -POLICY_API_HOST=127.0.0.1 - -# the temp directory used, within $DIR -# omit the -p parameter to create a temporal directory in the default location -WORK_DIR=$(mktemp -d -p "$DIR") -echo ${WORK_DIR} - -cd ${WORK_DIR} - -# check if tmp dir was created -if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then - echo "Could not create temp dir" - exit 1 -fi - -# bring down maven -mkdir maven -cd maven -curl -O http://apache.claz.org/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz -tar -xzvf apache-maven-3.3.9-bin.tar.gz -ls -l -${WORK_DIR}/maven/apache-maven-3.3.9/bin/mvn -v -cd .. - -git clone http://gerrit.onap.org/r/oparent -git clone --depth 1 https://gerrit.onap.org/r/policy/models -b master - -cd models/models-sim/models-sim-dmaap -${WORK_DIR}/maven/apache-maven-3.3.9/bin/mvn clean install -DskipTests --settings ${WORK_DIR}/oparent/settings.xml -bash ./src/main/package/docker/docker_build.sh - -cd ../policy-models-sim-pdp -${WORK_DIR}/maven/apache-maven-3.3.9/bin/mvn clean install -DskipTests --settings ${WORK_DIR}/oparent/settings.xml -bash ./src/main/package/docker/docker_build.sh - -cd ${DIR} -rm -rf ${WORK_DIR} - -docker run -p 3306:3306 -v ${DIR}/config/db:/docker-entrypoint-initdb.d --name mariadb --env-file ${DIR}/config/db/db.conf -d --rm mariadb:10.2.14 --lower-case-table-names=1 --wait_timeout=28800 -docker run -p 3904:3904 -d --name message-router --rm dmaap/simulator:latest -sleep 10 -docker run --link message-router:message-router -d --rm --name pdp-simulator pdp/simulator:latest -docker run -p 6969:6969 --link mariadb:mariadb --name policy-api -d --rm nexus3.onap.org:10001/onap/policy-api:2.4.2-SNAPSHOT -docker run -p 7000:6969 --link mariadb:mariadb --link message-router:message-router --name policy-pap --add-host policy-api:${POLICY_API_HOST} -d --rm nexus3.onap.org:10001/onap/policy-pap:2.4.2-SNAPSHOT diff --git a/testsuites/stability/src/main/resources/testplans/run_test.sh b/testsuites/stability/src/main/resources/testplans/run_test.sh new file mode 100755 index 00000000..6ce32345 --- /dev/null +++ b/testsuites/stability/src/main/resources/testplans/run_test.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# ============LICENSE_START======================================================= +# Copyright (c) 2021 Nordix Foundation. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= + +DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +JMETER_HOME=~/jmeter/apache-jmeter-5.4.1/ + +POLICY_API_IP=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' policy-api) +POLICY_PAP_IP=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' policy-pap) +POLICY_DISTRIBUTION_IP=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' policy-distribution) + +${JMETER_HOME}/bin/jmeter -n -t "${DIR}"/stability.jmx -Jduration=259200 \ + -Japihost="${POLICY_API_IP}" \ + -Jpaphost="${POLICY_PAP_IP}" \ + -Jdisthost="${POLICY_DISTRIBUTION_IP}" diff --git a/testsuites/stability/src/main/resources/testplans/stability.jmx b/testsuites/stability/src/main/resources/testplans/stability.jmx index d29ffda8..5f800d12 100644 --- a/testsuites/stability/src/main/resources/testplans/stability.jmx +++ b/testsuites/stability/src/main/resources/testplans/stability.jmx @@ -35,7 +35,7 @@ API_HOST - ${__P(host,10.2.0.110)} + ${__P(apihost,172.28.0.7)} = @@ -45,22 +45,22 @@ PAP_HOST - ${__P(host,10.2.0.110)} + ${__P(paphost,172.28.0.8)} = PAP_PORT - 7000 + 6969 = DISTRIBUTION_HOST - ${__P(distributionhost,127.0.0.1)} + ${__P(disthost,172.28.0.2)} = DISTRIBUTION_PORT - 7002 + 6969 = @@ -107,14 +107,14 @@ - https://${PAP_HOST}:${PAP_PORT}/policy/pap/v1 + http://${PAP_HOST}:${PAP_PORT}/policy/pap/v1 healthcheck zb!XztG34 - https://${API_HOST}:${API_PORT}/policy/api/v1 + http://${API_HOST}:${API_PORT}/policy/api/v1 healthcheck zb!XztG34 @@ -292,7 +292,7 @@ ${PAP_HOST} ${PAP_PORT} - https + http /policy/pap/v1/pdps GET @@ -358,7 +358,7 @@ ${PAP_HOST} ${PAP_PORT} - https + http policy/pap/v1/policies/deployed GET @@ -440,7 +440,7 @@ ${PAP_HOST} ${PAP_PORT} - https + http /policy/pap/v1/pdps/policies/operational.apex.sampledomain DELETE @@ -470,7 +470,7 @@ ${API_HOST} ${API_PORT} - https + http /policy/api/v1/policytypes/operational.apex.sampledomain/versions/1.0.0/policies/operational.apex.sampledomain/versions/1.0.0 DELETE @@ -503,7 +503,7 @@ ${PAP_HOST} ${PAP_PORT} - https + http /policy/pap/v1/pdps GET -- cgit 1.2.3-korg