summaryrefslogtreecommitdiffstats
path: root/testsuites/stability/src/main/resources/setup
diff options
context:
space:
mode:
authorsaul.gill <saul.gill@est.tech>2023-10-16 17:21:15 +0100
committersaul.gill <saul.gill@est.tech>2023-10-16 17:21:19 +0100
commitd1d92a580b4e95f02d9fcbd72f8884140d758ca5 (patch)
treef980fdb6d73b1963b87ebcc67bea3c6ee2197deb /testsuites/stability/src/main/resources/setup
parentf0b1c5bf1662edf6a2a07b79c1ffe7e42e1bb054 (diff)
Add automation for s3p tests
Issue-ID: POLICY-4844 Change-Id: Ia6003d5b492d2731fdd0d17342b4fd1c213c4b91 Signed-off-by: saul.gill <saul.gill@est.tech>
Diffstat (limited to 'testsuites/stability/src/main/resources/setup')
-rw-r--r--testsuites/stability/src/main/resources/setup/config/apiParameters.yaml6
-rw-r--r--testsuites/stability/src/main/resources/setup/config/papParameters.yaml73
-rwxr-xr-xtestsuites/stability/src/main/resources/setup/distribution/bin/policy-dist.sh2
-rw-r--r--testsuites/stability/src/main/resources/setup/docker-compose.yml34
-rwxr-xr-xtestsuites/stability/src/main/resources/setup/start.sh12
-rwxr-xr-xtestsuites/stability/src/main/resources/setup/versions.sh109
6 files changed, 173 insertions, 63 deletions
diff --git a/testsuites/stability/src/main/resources/setup/config/apiParameters.yaml b/testsuites/stability/src/main/resources/setup/config/apiParameters.yaml
index e61653ac..7d486ae8 100644
--- a/testsuites/stability/src/main/resources/setup/config/apiParameters.yaml
+++ b/testsuites/stability/src/main/resources/setup/config/apiParameters.yaml
@@ -2,6 +2,8 @@ server:
port: 6969
ssl:
enabled: false
+ servlet:
+ context-path: /policy/api/v1
spring:
security.user:
@@ -79,4 +81,6 @@ management:
base-path: /
exposure:
include: health,metrics,prometheus
- path-mapping.prometheus: metrics
+ path-mapping:
+ -metrics: plain-metrics
+ -prometheus: metrics \ No newline at end of file
diff --git a/testsuites/stability/src/main/resources/setup/config/papParameters.yaml b/testsuites/stability/src/main/resources/setup/config/papParameters.yaml
index 8249edd7..40203653 100644
--- a/testsuites/stability/src/main/resources/setup/config/papParameters.yaml
+++ b/testsuites/stability/src/main/resources/setup/config/papParameters.yaml
@@ -23,12 +23,18 @@ spring:
server:
port: 6969
+ servlet:
+ context-path: /policy/pap/v1
ssl:
enabled: false
pap:
name: PapGroup
aaf: false
+ topic:
+ pdp-pap.name: POLICY-PDP-PAP
+ notification.name: POLICY-NOTIFICATION
+ heartbeat.name: POLICY-HEARTBEAT
pdpParameters:
heartBeatMs: 120000
updateParameters:
@@ -37,41 +43,42 @@ pap:
stateChangeParameters:
maxRetryCount: 1
maxWaitMs: 30000
+ savePdpStatisticsInDb: true
topicParameterGroup:
topicSources:
- - topic: POLICY-PDP-PAP
- servers:
- - message-router
- topicCommInfrastructure: dmaap
- useHttps: false
- fetchTimeout: 15000
- - topic: POLICY-HEARTBEAT
- effectiveTopic: POLICY-PDP-PAP
- consumerGroup: policy-pap
- servers:
- - message-router
- topicCommInfrastructure: dmaap
- useHttps: false
- fetchTimeout: 15000
+ - topic: POLICY-PDP-PAP
+ servers:
+ - message-router
+ topicCommInfrastructure: dmaap
+ useHttps: false
+ fetchTimeout: 15000
+ - topic: POLICY-HEARTBEAT
+ effectiveTopic: POLICY-PDP-PAP
+ consumerGroup: policy-pap
+ servers:
+ - message-router
+ topicCommInfrastructure: dmaap
+ useHttps: false
+ fetchTimeout: 15000
topicSinks:
- - topic: POLICY-PDP-PAP
- servers:
- - message-router
- topicCommInfrastructure: dmaap
- useHttps: false
- - topic: POLICY-NOTIFICATION
- servers:
- - message-router
- topicCommInfrastructure: dmaap
- useHttps: false
+ - topic: POLICY-PDP-PAP
+ servers:
+ - message-router
+ topicCommInfrastructure: dmaap
+ useHttps: false
+ - topic: POLICY-NOTIFICATION
+ servers:
+ - message-router
+ topicCommInfrastructure: dmaap
+ useHttps: false
healthCheckRestClientParameters:
- - clientName: api
- hostname: policy-api
- port: 6969
- userName: policyadmin
- password: zb!XztG34
- useHttps: false
- basePath: policy/api/v1/healthcheck
+ - clientName: api
+ hostname: policy-api
+ port: 6969
+ userName: policyadmin
+ password: zb!XztG34
+ useHttps: false
+ basePath: policy/api/v1/healthcheck
management:
endpoints:
@@ -79,4 +86,6 @@ management:
base-path: /
exposure:
include: health, metrics, prometheus
- path-mapping.prometheus: metrics
+ path-mapping:
+ -metrics: plain-metrics
+ -prometheus: metrics \ No newline at end of file
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
index 2d781ea1..13924ce1 100755
--- a/testsuites/stability/src/main/resources/setup/distribution/bin/policy-dist.sh
+++ b/testsuites/stability/src/main/resources/setup/distribution/bin/policy-dist.sh
@@ -20,7 +20,7 @@
# ============LICENSE_END=========================================================
#
-JAVA_HOME=/usr/lib/jvm/java-11-openjdk/
+JAVA_HOME=/usr/lib/jvm/java-17-openjdk/
KEYSTORE="${POLICY_HOME}/etc/ssl/policy-keystore"
KEYSTORE_PASSWD="Pol1cy_0nap"
TRUSTSTORE="${POLICY_HOME}/etc/ssl/policy-truststore"
diff --git a/testsuites/stability/src/main/resources/setup/docker-compose.yml b/testsuites/stability/src/main/resources/setup/docker-compose.yml
index 48d1851e..2fd77d7b 100644
--- a/testsuites/stability/src/main/resources/setup/docker-compose.yml
+++ b/testsuites/stability/src/main/resources/setup/docker-compose.yml
@@ -1,5 +1,5 @@
# ============LICENSE_START=======================================================
-# Copyright (C) 2021-2022 Nordix Foundation.
+# Copyright (C) 2021-2023 Nordix Foundation.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -45,9 +45,9 @@ services:
- ./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'
+ '-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}
@@ -83,9 +83,9 @@ services:
- ./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'
+ '-c', './policy-api.sh',
+ 'mariadb', '3306',
+ 'policy-db-migrator', '6824'
]
policy-pap:
image: nexus3.onap.org:10001/onap/policy-pap:${POLICY_PAP_VERSION}
@@ -103,10 +103,10 @@ services:
- ./config/jsonConfigs/papGroups.json:/opt/app/policy/pap/etc/mounted/groups.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'
+ '-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}
@@ -119,12 +119,14 @@ services:
expose:
- 6969
- 9090
+ ports:
+ - 9090: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'
+ '-c', './policy-dist.sh',
+ 'mariadb', '3306',
+ 'message-router', '3904',
+ 'policy-api', '6969',
+ 'policy-pap', '6969'
]
diff --git a/testsuites/stability/src/main/resources/setup/start.sh b/testsuites/stability/src/main/resources/setup/start.sh
index 765c5b64..e227eaff 100755
--- a/testsuites/stability/src/main/resources/setup/start.sh
+++ b/testsuites/stability/src/main/resources/setup/start.sh
@@ -1,6 +1,6 @@
#!/bin/bash
# ============LICENSE_START=======================================================
-# Copyright (c) 2021-2022 Nordix Foundation.
+# Copyright (c) 2021-2023 Nordix Foundation.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -18,7 +18,7 @@
# ============LICENSE_END=========================================================
# load up all the image version
-source "$(pwd)"/versions.sh
+source "$(pwd)"/stability/src/main/resources/setup/versions.sh
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
WORK_DIR=$(mktemp -d -p "$DIR")
@@ -33,7 +33,7 @@ if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then
fi
# bring down maven
-curl -s -S https://dlcdn.apache.org/maven/maven-3/3.8.5/binaries/apache-maven-3.8.5-bin.tar.gz > apache-maven.tar.gz
+curl -s -S https://dlcdn.apache.org/maven/maven-3/3.9.5/binaries/apache-maven-3.9.5-bin.tar.gz > apache-maven.tar.gz
mkdir -p apache-maven && tar -xzvf apache-maven.tar.gz -C apache-maven --strip-components 1
MAVEN="${WORK_DIR}"/apache-maven/bin/mvn
@@ -42,10 +42,14 @@ 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
+docker pull nexus3.onap.org:10001/onap/policy-jre-alpine:${POLICY_DB_MIGRATOR}
+docker tag nexus3.onap.org:10001/onap/policy-jre-alpine:${POLICY_DB_MIGRATOR} onap/policy-jre-alpine:${POLICY_DB_MIGRATOR}
+
+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
diff --git a/testsuites/stability/src/main/resources/setup/versions.sh b/testsuites/stability/src/main/resources/setup/versions.sh
index 1ac71df5..f19f8398 100755
--- a/testsuites/stability/src/main/resources/setup/versions.sh
+++ b/testsuites/stability/src/main/resources/setup/versions.sh
@@ -1,6 +1,6 @@
#!/bin/bash
# ============LICENSE_START=======================================================
-# Copyright (c) 2021 Nordix Foundation.
+# Copyright (c) 2021-2023 Nordix Foundation.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -17,13 +17,104 @@
# SPDX-License-Identifier: Apache-2.0
# ============LICENSE_END=========================================================
-# update versions here
-export POLICY_MARIADB_VER=10.5.8
-export POLICY_DB_MIGRATOR=2.4-SNAPSHOT-latest
-export POLICY_API_VERSION=2.6-SNAPSHOT-latest
-export POLICY_PAP_VERSION=2.6-SNAPSHOT-latest
-export POLICY_MODELS_SIMULATOR=2.6-SNAPSHOT-latest
-export POLICY_DIST_VERSION=2.7-SNAPSHOT-latest
+if [ -z "${WORKSPACE}" ]; then
+ WORKSPACE=$(git rev-parse --show-toplevel)
+ export WORKSPACE
+fi
+
+GERRIT_BRANCH=$(awk -F= '$1 == "defaultbranch" { print $2 }' \
+ "${WORKSPACE}"/.gitreview)
+
+echo GERRIT_BRANCH="${GERRIT_BRANCH}"
+
+export POLICY_MARIADB_VER=10.10.2
+echo POLICY_MARIADB_VER=${POLICY_MARIADB_VER}
+
+export POLICY_POSTGRES_VER=11.1
+echo POLICY_POSTGRES_VER=${POLICY_POSTGRES_VER}
+
+function getDockerVersion
+{
+ REPO=${1}
+ DEFAULT_DOCKER_IMAGE_NAME=${2:-}
+ DEFAULT_DOCKER_IMAGE_VERSION=${3:-}
+
+ REPO_RELEASE_DATA=$(
+ curl -qL --silent \
+ "https://github.com/onap/policy-parent/raw/$GERRIT_BRANCH/integration/src/main/resources/release/pf_release_data.csv" |
+ grep "^policy/$REPO"
+ )
+
+ # shellcheck disable=SC2034
+ read -r repo \
+ latest_released_tag \
+ latest_snapshot_tag \
+ changed_files \
+ docker_images \
+ <<< "$(echo "$REPO_RELEASE_DATA" | tr ',' ' ' )"
+
+ if [[ -z "$docker_images" ]]
+ then
+ if [[ -z "$DEFAULT_DOCKER_IMAGE_NAME" ]]
+ then
+ echo "repo $REPO does not produce a docker image, execution terminated"
+ exit 1
+ else
+ docker_images="$DEFAULT_DOCKER_IMAGE_NAME"
+ fi
+ fi
+
+ # docker_image_version=$(echo "$latest_snapshot_tag" | awk -F \. '{print $1"."$2"-SNAPSHOT-latest"}')
+ docker_image_version=$latest_snapshot_tag
+ docker_image_name=$(echo "$docker_images" | sed -e "s/^.*://" -e "s/^.//" -e "s/.$//")
+
+ if \
+ curl -qL --silent \
+ "https://nexus3.onap.org/service/rest/repository/browse/docker.snapshot/v2/onap/$docker_image_name/tags/" |
+ grep -q "$docker_image_version"
+ then
+ echo "using \"$docker_image_name:$docker_image_version\" docker image for repo \"$repo\""
+ return
+ fi
+
+ docker_image_version="$latest_released_tag"
+ if \
+ curl -qL --silent \
+ "https://nexus3.onap.org/service/rest/repository/browse/docker.release/v2/onap/$docker_image_name/tags/" |
+ grep -q "$docker_image_version"
+ then
+ echo "using \"$docker_image_name:$docker_image_version\" docker image for repo \"$repo\""
+ return
+ fi
+
+ docker_image_version="$DEFAULT_DOCKER_IMAGE_VERSION"
+ if \
+ curl -qL --silent \
+ "https://nexus3.onap.org/service/rest/repository/browse/docker.release/v2/onap/$docker_image_name/tags/" |
+ grep -q "$docker_image_version"
+ then
+ echo "using \"$docker_image_name:$docker_image_version\" docker image for repo \"$repo\""
+ return
+ else
+ echo "docker image \"$docker_image_name:$docker_image_version\" not found for repo \"$repo\""
+ exit 1
+ fi
+}
+
+getDockerVersion docker
+export POLICY_DB_MIGRATOR="$docker_image_version"
+
+getDockerVersion models "'policy-models-simulator'" 3.0.1
+export POLICY_MODELS_SIMULATOR="$docker_image_version"
+
+getDockerVersion api
+export POLICY_API_VERSION="$docker_image_version"
+
+getDockerVersion pap
+export POLICY_PAP_VERSION="$docker_image_version"
+
+getDockerVersion distribution
+export POLICY_DIST_VERSION="$docker_image_version"
echo " MariaDB Version: ${POLICY_MARIADB_VER}"
echo " Policy DB Migrator Version: ${POLICY_DB_MIGRATOR}"
@@ -31,4 +122,4 @@ 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 ""
+echo "" \ No newline at end of file