Distribution S3P Testing for Istanbul 23/124623/4
authoradheli.tavares <adheli.tavares@est.tech>
Thu, 30 Sep 2021 12:50:40 +0000 (13:50 +0100)
committeradheli.tavares <adheli.tavares@est.tech>
Thu, 7 Oct 2021 16:42:46 +0000 (17:42 +0100)
Issue-ID: POLICY-3654
Change-Id: Ib410008418a6d94948270fea1c37e20eb0c59003
Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
23 files changed:
packages/policy-distribution-tarball/src/main/resources/etc/defaultConfig.json
packages/policy-distribution-tarball/src/main/resources/etc/s3pConfig.json
testsuites/performance/src/main/resources/testplans/performance.jmx
testsuites/performance/src/main/resources/testplans/run_test.sh [moved from testsuites/stability/src/main/resources/distributionsetup/setup_distribution.sh with 52% similarity]
testsuites/stability/src/main/resources/setup/config/db-migrator/db_migrator_policy_init.sh [new file with mode: 0755]
testsuites/stability/src/main/resources/setup/config/db/db.conf [moved from testsuites/stability/src/main/resources/simulatorsetup/config/db/db.conf with 100% similarity]
testsuites/stability/src/main/resources/setup/config/db/db.sh [moved from testsuites/stability/src/main/resources/simulatorsetup/config/db/db.sh with 93% similarity]
testsuites/stability/src/main/resources/setup/config/jsonConfigs/apiConfigFile.json [new file with mode: 0644]
testsuites/stability/src/main/resources/setup/config/jsonConfigs/dmaapSimConfig.json [new file with mode: 0644]
testsuites/stability/src/main/resources/setup/config/jsonConfigs/papConfigFile.json [new file with mode: 0644]
testsuites/stability/src/main/resources/setup/config/jsonConfigs/pdpSimConfig.json [new file with mode: 0644]
testsuites/stability/src/main/resources/setup/config/wait_for_port.sh [new file with mode: 0755]
testsuites/stability/src/main/resources/setup/distribution/bin/policy-dist.sh [moved from testsuites/stability/src/main/resources/distributionsetup/distribution/bin/policy-dist.sh with 83% similarity, mode: 0755]
testsuites/stability/src/main/resources/setup/distribution/etc/defaultConfig.json [moved from testsuites/stability/src/main/resources/distributionsetup/distribution/etc/defaultConfig.json with 96% similarity]
testsuites/stability/src/main/resources/setup/distribution/etc/logback.xml [moved from testsuites/stability/src/main/resources/distributionsetup/distribution/etc/logback.xml with 98% similarity]
testsuites/stability/src/main/resources/setup/docker-compose.yml [new file with mode: 0644]
testsuites/stability/src/main/resources/setup/down.sh [moved from testsuites/stability/src/main/resources/simulatorsetup/docker-compose.yml with 52% similarity, mode: 0755]
testsuites/stability/src/main/resources/setup/start.sh [new file with mode: 0755]
testsuites/stability/src/main/resources/setup/versions.sh [new file with mode: 0755]
testsuites/stability/src/main/resources/simulatorsetup/config/pdp/OnapPfConfig.json [deleted file]
testsuites/stability/src/main/resources/simulatorsetup/setup_components.sh [deleted file]
testsuites/stability/src/main/resources/testplans/run_test.sh [new file with mode: 0755]
testsuites/stability/src/main/resources/testplans/stability.jmx

index 9ad5d6b..a9c9a13 100644 (file)
@@ -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"
             }
         }
     },
index 430b81a..f293b98 100644 (file)
@@ -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"
             }
         }
     },
index d92fe04..2115cde 100644 (file)
             </elementProp>
             <stringProp name="HTTPSampler.domain">${PAP_HOST}</stringProp>
             <stringProp name="HTTPSampler.port">${PAP_PORT}</stringProp>
-            <stringProp name="HTTPSampler.protocol">https</stringProp>
+            <stringProp name="HTTPSampler.protocol">http</stringProp>
             <stringProp name="HTTPSampler.contentEncoding"></stringProp>
             <stringProp name="HTTPSampler.path">/policy/pap/v1/pdps</stringProp>
             <stringProp name="HTTPSampler.method">GET</stringProp>
             </elementProp>
             <stringProp name="HTTPSampler.domain">${PAP_HOST}</stringProp>
             <stringProp name="HTTPSampler.port">${PAP_PORT}</stringProp>
-            <stringProp name="HTTPSampler.protocol">https</stringProp>
+            <stringProp name="HTTPSampler.protocol">http</stringProp>
             <stringProp name="HTTPSampler.contentEncoding"></stringProp>
             <stringProp name="HTTPSampler.path">/policy/pap/v1/pdps</stringProp>
             <stringProp name="HTTPSampler.method">GET</stringProp>
         <AuthManager guiclass="AuthPanel" testclass="AuthManager" testname="HTTP Authorization Manager" enabled="true">
           <collectionProp name="AuthManager.auth_list">
             <elementProp name="" elementType="Authorization">
-              <stringProp name="Authorization.url">https://${PAP_HOST}:${PAP_PORT}/policy/pap/v1</stringProp>
+              <stringProp name="Authorization.url">http://${PAP_HOST}:${PAP_PORT}/policy/pap/v1</stringProp>
               <stringProp name="Authorization.username">healthcheck</stringProp>
               <stringProp name="Authorization.password">zb!XztG34</stringProp>
               <stringProp name="Authorization.domain"></stringProp>
               <stringProp name="Authorization.realm"></stringProp>
             </elementProp>
             <elementProp name="" elementType="Authorization">
-              <stringProp name="Authorization.url">https://${API_HOST}:${API_PORT}/policy/api/v1</stringProp>
+              <stringProp name="Authorization.url">http://${API_HOST}:${API_PORT}/policy/api/v1</stringProp>
               <stringProp name="Authorization.username">healthcheck</stringProp>
               <stringProp name="Authorization.password">zb!XztG34</stringProp>
               <stringProp name="Authorization.domain"></stringProp>
@@ -1,6 +1,6 @@
 #!/bin/bash
 # ============LICENSE_START=======================================================
-#  Copyright (c) 2020-2021 Nordix Foundation.
+#  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.
 # SPDX-License-Identifier: Apache-2.0
 # ============LICENSE_END=========================================================
 
-# the directory of the script
 DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
-echo ${DIR}
+JMETER_HOME=~/jmeter/apache-jmeter-5.4.1/
 
-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
+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)
 
-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
+${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/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 (executable)
index 0000000..2efdca7
--- /dev/null
@@ -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
@@ -13,7 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-for db in policyadmin
+for db in 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}'@'%' ;"
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 (file)
index 0000000..0071512
--- /dev/null
@@ -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 (file)
index 0000000..fc08b0a
--- /dev/null
@@ -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 (file)
index 0000000..456735b
--- /dev/null
@@ -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 (file)
index 0000000..396b9f7
--- /dev/null
@@ -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 (executable)
index 0000000..63e2a49
--- /dev/null
@@ -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
@@ -53,4 +53,4 @@ 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
+$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
                     "clientName": "policy-api",
                     "hostname": "policy-api",
                     "port": 6969,
-                    "useHttps": true,
+                    "useHttps": false,
                     "userName": "healthcheck",
                     "password": "zb!XztG34"
                 },
                 "papParameters": {
                     "clientName": "policy-pap",
                     "hostname": "policy-pap",
-                    "port": 7000,
-                    "useHttps": true,
+                    "port": 6969,
+                    "useHttps": false,
                     "userName": "healthcheck",
                     "password": "zb!XztG34"
                 },
@@ -21,7 +21,7 @@
 
 <configuration scan="true" scanPeriod="30 seconds" debug="false">
 
-    <property name="logDir" value="/home/policydistribution/logs" />
+    <property name="logDir" value="/home/policydistribution" />
 
     <property name="errorLog" value="error" />
     <property name="debugLog" value="debug" />
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 (file)
index 0000000..e36a0c8
--- /dev/null
@@ -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'
+      ]
old mode 100644 (file)
new mode 100755 (executable)
similarity index 52%
rename from testsuites/stability/src/main/resources/simulatorsetup/docker-compose.yml
rename to testsuites/stability/src/main/resources/setup/down.sh
index 7eb2fb2..7554322
@@ -1,27 +1,22 @@
-# Copyright (C) 2020 Nordix Foundation.
-#
+#!/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
+#      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
+#
+# 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 (executable)
index 0000000..2f72cb0
--- /dev/null
@@ -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 (executable)
index 0000000..44829d1
--- /dev/null
@@ -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/pdp/OnapPfConfig.json b/testsuites/stability/src/main/resources/simulatorsetup/config/pdp/OnapPfConfig.json
deleted file mode 100644 (file)
index de31d50..0000000
+++ /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/setup_components.sh b/testsuites/stability/src/main/resources/simulatorsetup/setup_components.sh
deleted file mode 100755 (executable)
index 55fea5d..0000000
+++ /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 (executable)
index 0000000..6ce3234
--- /dev/null
@@ -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}"
index d29ffda..5f800d1 100644 (file)
@@ -35,7 +35,7 @@
           </elementProp>
           <elementProp name="API_HOST" elementType="Argument">
             <stringProp name="Argument.name">API_HOST</stringProp>
-            <stringProp name="Argument.value">${__P(host,10.2.0.110)}</stringProp>
+            <stringProp name="Argument.value">${__P(apihost,172.28.0.7)}</stringProp>
             <stringProp name="Argument.metadata">=</stringProp>
           </elementProp>
           <elementProp name="API_PORT" elementType="Argument">
           </elementProp>
           <elementProp name="PAP_HOST" elementType="Argument">
             <stringProp name="Argument.name">PAP_HOST</stringProp>
-            <stringProp name="Argument.value">${__P(host,10.2.0.110)}</stringProp>
+            <stringProp name="Argument.value">${__P(paphost,172.28.0.8)}</stringProp>
             <stringProp name="Argument.metadata">=</stringProp>
           </elementProp>
           <elementProp name="PAP_PORT" elementType="Argument">
             <stringProp name="Argument.name">PAP_PORT</stringProp>
-            <stringProp name="Argument.value">7000</stringProp>
+            <stringProp name="Argument.value">6969</stringProp>
             <stringProp name="Argument.metadata">=</stringProp>
           </elementProp>
           <elementProp name="DISTRIBUTION_HOST" elementType="Argument">
             <stringProp name="Argument.name">DISTRIBUTION_HOST</stringProp>
-            <stringProp name="Argument.value">${__P(distributionhost,127.0.0.1)}</stringProp>
+            <stringProp name="Argument.value">${__P(disthost,172.28.0.2)}</stringProp>
             <stringProp name="Argument.metadata">=</stringProp>
           </elementProp>
           <elementProp name="DISTRIBUTION_PORT" elementType="Argument">
             <stringProp name="Argument.name">DISTRIBUTION_PORT</stringProp>
-            <stringProp name="Argument.value">7002</stringProp>
+            <stringProp name="Argument.value">6969</stringProp>
             <stringProp name="Argument.metadata">=</stringProp>
           </elementProp>
           <elementProp name="TESTCSARLOCATION" elementType="Argument">
         <AuthManager guiclass="AuthPanel" testclass="AuthManager" testname="HTTP Authorization Manager" enabled="true">
           <collectionProp name="AuthManager.auth_list">
             <elementProp name="" elementType="Authorization">
-              <stringProp name="Authorization.url">https://${PAP_HOST}:${PAP_PORT}/policy/pap/v1</stringProp>
+              <stringProp name="Authorization.url">http://${PAP_HOST}:${PAP_PORT}/policy/pap/v1</stringProp>
               <stringProp name="Authorization.username">healthcheck</stringProp>
               <stringProp name="Authorization.password">zb!XztG34</stringProp>
               <stringProp name="Authorization.domain"></stringProp>
               <stringProp name="Authorization.realm"></stringProp>
             </elementProp>
             <elementProp name="" elementType="Authorization">
-              <stringProp name="Authorization.url">https://${API_HOST}:${API_PORT}/policy/api/v1</stringProp>
+              <stringProp name="Authorization.url">http://${API_HOST}:${API_PORT}/policy/api/v1</stringProp>
               <stringProp name="Authorization.username">healthcheck</stringProp>
               <stringProp name="Authorization.password">zb!XztG34</stringProp>
               <stringProp name="Authorization.domain"></stringProp>
             </elementProp>
             <stringProp name="HTTPSampler.domain">${PAP_HOST}</stringProp>
             <stringProp name="HTTPSampler.port">${PAP_PORT}</stringProp>
-            <stringProp name="HTTPSampler.protocol">https</stringProp>
+            <stringProp name="HTTPSampler.protocol">http</stringProp>
             <stringProp name="HTTPSampler.contentEncoding"></stringProp>
             <stringProp name="HTTPSampler.path">/policy/pap/v1/pdps</stringProp>
             <stringProp name="HTTPSampler.method">GET</stringProp>
             </elementProp>
             <stringProp name="HTTPSampler.domain">${PAP_HOST}</stringProp>
             <stringProp name="HTTPSampler.port">${PAP_PORT}</stringProp>
-            <stringProp name="HTTPSampler.protocol">https</stringProp>
+            <stringProp name="HTTPSampler.protocol">http</stringProp>
             <stringProp name="HTTPSampler.contentEncoding"></stringProp>
             <stringProp name="HTTPSampler.path">policy/pap/v1/policies/deployed</stringProp>
             <stringProp name="HTTPSampler.method">GET</stringProp>
             </elementProp>
             <stringProp name="HTTPSampler.domain">${PAP_HOST}</stringProp>
             <stringProp name="HTTPSampler.port">${PAP_PORT}</stringProp>
-            <stringProp name="HTTPSampler.protocol">https</stringProp>
+            <stringProp name="HTTPSampler.protocol">http</stringProp>
             <stringProp name="HTTPSampler.contentEncoding"></stringProp>
             <stringProp name="HTTPSampler.path">/policy/pap/v1/pdps/policies/operational.apex.sampledomain</stringProp>
             <stringProp name="HTTPSampler.method">DELETE</stringProp>
             </elementProp>
             <stringProp name="HTTPSampler.domain">${API_HOST}</stringProp>
             <stringProp name="HTTPSampler.port">${API_PORT}</stringProp>
-            <stringProp name="HTTPSampler.protocol">https</stringProp>
+            <stringProp name="HTTPSampler.protocol">http</stringProp>
             <stringProp name="HTTPSampler.contentEncoding"></stringProp>
             <stringProp name="HTTPSampler.path">/policy/api/v1/policytypes/operational.apex.sampledomain/versions/1.0.0/policies/operational.apex.sampledomain/versions/1.0.0</stringProp>
             <stringProp name="HTTPSampler.method">DELETE</stringProp>
             </elementProp>
             <stringProp name="HTTPSampler.domain">${PAP_HOST}</stringProp>
             <stringProp name="HTTPSampler.port">${PAP_PORT}</stringProp>
-            <stringProp name="HTTPSampler.protocol">https</stringProp>
+            <stringProp name="HTTPSampler.protocol">http</stringProp>
             <stringProp name="HTTPSampler.contentEncoding"></stringProp>
             <stringProp name="HTTPSampler.path">/policy/pap/v1/pdps</stringProp>
             <stringProp name="HTTPSampler.method">GET</stringProp>