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 --- .../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 +++++++++++++++++ 8 files changed, 295 insertions(+) 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 (limited to 'testsuites/stability/src/main/resources/setup/config') 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 -- cgit 1.2.3-korg