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