diff options
author | rameshiyer27 <ramesh.murugan.iyer@est.tech> | 2024-07-17 23:19:44 +0000 |
---|---|---|
committer | Ramesh Murugan Iyer <ramesh.murugan.iyer@est.tech> | 2024-07-18 15:32:35 +0000 |
commit | 9c4e66a4e0e2713667e16f4a62db23363fab8556 (patch) | |
tree | ab82d9f57fe41a1c286b807159f891056b03d884 | |
parent | 0b5f65dcc6419218cad5d93ee3b872e7665ab1c6 (diff) |
Add version support in regression test suite
Issue-ID: POLICY-5077
Signed-off-by: zrrmmua <ramesh.murugan.iyer@est.tech>
Change-Id: I92c0306fa8ef03fc90a2453ec15f14dd0ecb0806
-rw-r--r-- | compose/config/clamp/legacy/AcRuntimeParameters.yaml | 74 | ||||
-rw-r--r-- | compose/config/clamp/legacy/HttpParticipantParameters.yaml | 45 | ||||
-rw-r--r-- | compose/config/clamp/legacy/KubernetesParticipantParameters.yaml | 66 | ||||
-rw-r--r-- | compose/config/clamp/legacy/PolicyParticipantParameters.yaml | 63 | ||||
-rw-r--r-- | compose/config/clamp/legacy/SimulatorParticipantParameters.yaml | 50 | ||||
-rw-r--r-- | compose/docker-compose.yml | 13 | ||||
-rwxr-xr-x | csit/run-acm-regression.sh | 124 | ||||
-rwxr-xr-x | csit/run-k8s-csit.sh | 2 |
8 files changed, 404 insertions, 33 deletions
diff --git a/compose/config/clamp/legacy/AcRuntimeParameters.yaml b/compose/config/clamp/legacy/AcRuntimeParameters.yaml new file mode 100644 index 00000000..656b3f9f --- /dev/null +++ b/compose/config/clamp/legacy/AcRuntimeParameters.yaml @@ -0,0 +1,74 @@ +spring: + security: + user: + name: runtimeUser + password: zb!XztG34 + mvc: + converters: + preferred-json-mapper: gson + datasource: + url: jdbc:mariadb://${mariadb.host:mariadb}:${mariadb.port:3306}/clampacm + driverClassName: org.mariadb.jdbc.Driver + username: policy_user + password: policy_user + hikari: + connectionTimeout: 30000 + idleTimeout: 600000 + maxLifetime: 1800000 + maximumPoolSize: 10 + jpa: + hibernate: + ddl-auto: none + naming: + physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl + implicit-strategy: org.onap.policy.common.spring.utils.CustomImplicitNamingStrategy + properties: + hibernate: + format_sql: true + +security: + enable-csrf: false + +server: + servlet: + context-path: /onap/policy/clamp/acm + port: 6969 + ssl: + enabled: false + error: + path: /error + +runtime: + participantParameters: + heartBeatMs: 20000 + maxStatusWaitMs: 200000 + topicParameterGroup: + topicSources: + - + topic: policy-acruntime-participant + servers: + - ${topicServer:kafka:9092} + topicCommInfrastructure: kafka + fetchTimeout: 15000 + useHttps: false + topicSinks: + - + topic: policy-acruntime-participant + servers: + - ${topicServer:kafka:9092} + topicCommInfrastructure: kafka + useHttps: false + acmParameters: + toscaElementName: org.onap.policy.clamp.acm.AutomationCompositionElement + toscaCompositionName: org.onap.policy.clamp.acm.AutomationComposition + +management: + endpoints: + web: + base-path: / + exposure: + include: health, metrics, prometheus + +metrics: + security: + disabled: false diff --git a/compose/config/clamp/legacy/HttpParticipantParameters.yaml b/compose/config/clamp/legacy/HttpParticipantParameters.yaml new file mode 100644 index 00000000..a26a81d0 --- /dev/null +++ b/compose/config/clamp/legacy/HttpParticipantParameters.yaml @@ -0,0 +1,45 @@ +spring: + security: + user: + name: participantUser + password: zb!XztG34 + autoconfigure: + exclude: > + org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration, + org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration, + org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration +security: + enable-csrf: false +participant: + intermediaryParameters: + reportingTimeIntervalMs: 120000 + description: Participant Description + participantId: 101c62b3-8918-41b9-a747-d21eb79c6c01 + clampAutomationCompositionTopics: + topicSources: + - topic: policy-acruntime-participant + servers: + - ${topicServer:kafka:9092} + topicCommInfrastructure: kafka + fetchTimeout: 15000 + useHttps: false + topicSinks: + - topic: policy-acruntime-participant + servers: + - ${topicServer:kafka:9092} + topicCommInfrastructure: kafka + useHttps: false + participantSupportedElementTypes: + - typeName: org.onap.policy.clamp.acm.HttpAutomationCompositionElement + typeVersion: 1.0.0 +management: + endpoints: + web: + exposure: + include: health, metrics, prometheus +server: + port: 6969 + ssl: + enabled: false + servlet: + context-path: /onap/policy/clamp/acm/httpparticipant diff --git a/compose/config/clamp/legacy/KubernetesParticipantParameters.yaml b/compose/config/clamp/legacy/KubernetesParticipantParameters.yaml new file mode 100644 index 00000000..449e9617 --- /dev/null +++ b/compose/config/clamp/legacy/KubernetesParticipantParameters.yaml @@ -0,0 +1,66 @@ +spring: + security: + user: + name: participantUser + password: zb!XztG34 + autoconfigure: + exclude: > + org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration, + org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration, + org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration +security: + enable-csrf: false + +participant: + localChartDirectory: /home/policy/local-charts + infoFileName: CHART_INFO.json + intermediaryParameters: + reportingTimeIntervalMs: 120000 + description: Participant Description + participantId: 101c62b3-8918-41b9-a747-d21eb79c6c02 + clampAutomationCompositionTopics: + topicSources: + - + topic: policy-acruntime-participant + servers: + - ${topicServer:kafka:9092} + topicCommInfrastructure: kafka + fetchTimeout: 15000 + useHttps: false + topicSinks: + - + topic: policy-acruntime-participant + servers: + - ${topicServer:kafka:9092} + topicCommInfrastructure: kafka + useHttps: false + participantSupportedElementTypes: + - typeName: org.onap.policy.clamp.acm.K8SMicroserviceAutomationCompositionElement + typeVersion: 1.0.0 + +management: + endpoints: + web: + exposure: + include: health, metrics, prometheus +server: + port: 6969 + ssl: + enabled: false + servlet: + context-path: /onap/policy/clamp/acm/k8sparticipant + +logging: + # Configuration of logging + level: + ROOT: ERROR + org.springframework: ERROR + org.springframework.data: ERROR + org.springframework.web.reactive.function.client.ExchangeFunctions: ERROR + org.onap.policy.clamp.acm.participant.kubernetes: INFO + file: + name: /var/log/onap/policy/clamp/application.log + +chart: + api: + enabled: false diff --git a/compose/config/clamp/legacy/PolicyParticipantParameters.yaml b/compose/config/clamp/legacy/PolicyParticipantParameters.yaml new file mode 100644 index 00000000..307e0b60 --- /dev/null +++ b/compose/config/clamp/legacy/PolicyParticipantParameters.yaml @@ -0,0 +1,63 @@ +spring: + security: + user: + name: participantUser + password: zb!XztG34 + autoconfigure: + exclude: > + org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration, + org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration, + org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration +participant: + pdpGroup: defaultGroup + pdpType: apex + policyApiParameters: + clientName: api + hostname: policy-api + port: 6969 + userName: policyadmin + password: zb!XztG34 + useHttps: false + allowSelfSignedCerts: true + policyPapParameters: + clientName: pap + hostname: policy-pap + port: 6969 + userName: policyadmin + password: zb!XztG34 + useHttps: false + allowSelfSignedCerts: true + intermediaryParameters: + reportingTimeIntervalMs: 120000 + description: Participant Description + participantId: 101c62b3-8918-41b9-a747-d21eb79c6c03 + clampAutomationCompositionTopics: + topicSources: + - + topic: policy-acruntime-participant + servers: + - ${topicServer:kafka:9092} + topicCommInfrastructure: kafka + fetchTimeout: 15000 + useHttps: false + topicSinks: + - + topic: policy-acruntime-participant + servers: + - ${topicServer:kafka:9092} + topicCommInfrastructure: kafka + useHttps: false + participantSupportedElementTypes: + - typeName: org.onap.policy.clamp.acm.PolicyAutomationCompositionElement + typeVersion: 1.0.0 +management: + endpoints: + web: + exposure: + include: health, metrics, prometheus +server: + port: 6969 + ssl: + enabled: false + servlet: + context-path: /onap/policy/clamp/acm/policyparticipant diff --git a/compose/config/clamp/legacy/SimulatorParticipantParameters.yaml b/compose/config/clamp/legacy/SimulatorParticipantParameters.yaml new file mode 100644 index 00000000..acc1db66 --- /dev/null +++ b/compose/config/clamp/legacy/SimulatorParticipantParameters.yaml @@ -0,0 +1,50 @@ +spring: + security: + user: + name: participantUser + password: zb!XztG34 + autoconfigure: + exclude: + - org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration + - org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration + - org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration + - org.springframework.boot.autoconfigure.data.web.SpringDataWebAutoConfiguration + +security: + enable-csrf: false +participant: + intermediaryParameters: + reportingTimeIntervalMs: 120000 + description: Participant Description + participantId: ${participantId:101c62b3-8918-41b9-a747-d21eb79c6c90} + clampAutomationCompositionTopics: + topicSources: + - topic: policy-acruntime-participant + servers: + - ${topicServer:kafka:9092} + topicCommInfrastructure: kafka + fetchTimeout: 15000 + useHttps: false + topicSinks: + - topic: policy-acruntime-participant + servers: + - ${topicServer:kafka:9092} + topicCommInfrastructure: kafka + useHttps: false + participantSupportedElementTypes: + - + typeName: ${supportedElementTypeName:org.onap.policy.clamp.acm.SimAutomationCompositionElement} + typeVersion: ${supportedElementTypeVersion:1.0.0} + +management: + endpoints: + web: + base-path: / + exposure: + include: health, metrics, prometheus +server: + port: 6969 + ssl: + enabled: false + servlet: + context-path: /onap/policy/simparticipant diff --git a/compose/docker-compose.yml b/compose/docker-compose.yml index 49c63779..b44da88f 100644 --- a/compose/docker-compose.yml +++ b/compose/docker-compose.yml @@ -282,7 +282,7 @@ services: #OTEL_EXPORTER_OTLP_TRACES_PROTOCOL: grpc #OTEL_EXPORTER_OTLP_ENDPOINT: http://jaeger:4317 volumes: - - ./config/clamp/AcRuntimeParameters.yaml:/opt/app/policy/clamp/etc/AcRuntimeParameters.yaml + - ./${CLAMP_CONFIG_PATH:-config/clamp}/AcRuntimeParameters.yaml:/opt/app/policy/clamp/etc/AcRuntimeParameters.yaml - ./config/clamp/logback.xml:/opt/app/policy/clamp/etc/logback.xml:ro - ./config/clamp/acm-runtime.sh:/opt/app/policy/clamp/bin/acm-runtime.sh:rw - ./wait_for_port.sh:/opt/app/policy/bin/wait_for_port.sh:ro @@ -312,7 +312,7 @@ services: OTEL_EXPORTER_OTLP_TRACES_PROTOCOL: http/protobuf OTEL_EXPORTER_OTLP_ENDPOINT: http://jaeger:4318 volumes: - - ./config/clamp/HttpParticipantParameters.yaml:/opt/app/policy/clamp/etc/HttpParticipantParameters.yaml + - ./${PPNT_CONFIG_PATH:-config/clamp}/HttpParticipantParameters.yaml:/opt/app/policy/clamp/etc/HttpParticipantParameters.yaml - ./config/clamp/http-participant.sh:/opt/app/policy/clamp/bin/http-participant.sh:rw - ./config/clamp/logback.xml:/opt/app/policy/clamp/etc/logback.xml:ro - ./wait_for_port.sh:/opt/app/policy/bin/wait_for_port.sh:ro @@ -336,7 +336,7 @@ services: ports: - "30295:6969" volumes: - - ./config/clamp/KubernetesParticipantParameters.yaml:/opt/app/policy/clamp/etc/KubernetesParticipantParameters.yaml + - ./${PPNT_CONFIG_PATH:-config/clamp}/KubernetesParticipantParameters.yaml:/opt/app/policy/clamp/etc/KubernetesParticipantParameters.yaml - ./config/clamp/kubernetes-participant.sh:/opt/app/policy/clamp/bin/kubernetes-participant.sh:rw - ./config/clamp/logback.xml:/opt/app/policy/clamp/etc/logback.xml:ro - ./wait_for_port.sh:/opt/app/policy/bin/wait_for_port.sh:ro @@ -361,7 +361,7 @@ services: OTEL_EXPORTER_OTLP_TRACES_PROTOCOL: http/protobuf OTEL_EXPORTER_OTLP_ENDPOINT: http://jaeger:4318 volumes: - - ./config/clamp/PolicyParticipantParameters.yaml:/opt/app/policy/clamp/etc/PolicyParticipantParameters.yaml:ro + - ./${PPNT_CONFIG_PATH:-config/clamp}/PolicyParticipantParameters.yaml:/opt/app/policy/clamp/etc/PolicyParticipantParameters.yaml:ro - ./config/clamp/policy-participant.sh:/opt/app/policy/clamp/bin/policy-participant.sh:rw - ./config/clamp/logback.xml:/opt/app/policy/clamp/etc/logback.xml:ro - ./wait_for_port.sh:/opt/app/policy/bin/wait_for_port.sh:ro @@ -420,7 +420,7 @@ services: 'kafka', '9092' ] policy-clamp-ac-sim-ppnt: - image: ${CONTAINER_LOCATION}onap/policy-clamp-ac-sim-ppnt:${POLICY_CLAMP_VERSION} + image: ${CONTAINER_LOCATION}onap/policy-clamp-ac-sim-ppnt:${POLICY_CLAMP_PPNT_VERSION} container_name: policy-clamp-ac-sim-ppnt hostname: policy-clamp-ac-sim-ppnt depends_on: @@ -434,7 +434,7 @@ services: ports: - ${SIM_PARTICIPANT_PORT}:6969 volumes: - - ./config/clamp/SimulatorParticipantParameters.yaml:/opt/app/policy/clamp/etc/SimulatorParticipantParameters.yaml:ro + - ./${PPNT_CONFIG_PATH:-config/clamp}/SimulatorParticipantParameters.yaml:/opt/app/policy/clamp/etc/SimulatorParticipantParameters.yaml:ro - ./config/clamp/sim-participant.sh:/opt/app/policy/clamp/bin/sim-participant.sh:rw - ./config/clamp/logback.xml:/opt/app/policy/clamp/etc/logback.xml:ro - ./wait_for_port.sh:/opt/app/policy/bin/wait_for_port.sh:ro @@ -509,3 +509,4 @@ services: - 16686:16686 environment: - COLLECTOR_OTLP_ENABLED=true + diff --git a/csit/run-acm-regression.sh b/csit/run-acm-regression.sh index 5f77d214..677c2630 100755 --- a/csit/run-acm-regression.sh +++ b/csit/run-acm-regression.sh @@ -16,23 +16,50 @@ # # Script to run the ACM regression test suite in cucumber. -# Deploys ACM-R and participants in two different release versions for testing backward compatibility. - -if [ $# -eq 0 ] -then - echo "No release versions provided. Testing ACM-R and participants with the default version" - echo "Usage: $0 <acm_release> <compatibility_test_release>" - ACM_RELEASE=$(awk -F= '$1 == "defaultbranch" { print $2 }' \ - "${WORKSPACE}"/.gitreview) - PPNT_RELEASE=$ACM_RELEASE -fi - -if [ $1 ]; then - ACM_RELEASE=$1 -fi - -if [ $2 ]; then - PPNT_RELEASE=$2 +# Deploys ACM-R and participants in two different release branch/versions for testing backward compatibility. + +function usage() { + echo "Usage: $0 --release <acmr-release_branch> <ppnt-release_branch> | --version <acmr-version> <ppnt-version>" + exit 1 +} + +# Legacy config files for releases up to 'newdelhi' +function release_config_path() { + if [ $1 == 'master' ] || [[ "$(echo "$1" | cut -c1 )" > 'n' ]]; then + echo "config/clamp" + else + echo "config/clamp/legacy" + fi +} + +# Legacy config files for versions before 8.0.0 +function version_config_path() { + if [[ "$(printf '%s\n' "$1" "8.0.0" | sort -V | head -n 1)" == "8.0.0" ]]; then + echo "config/clamp" + else + echo "config/clamp/legacy" + fi +} + +function validate_version() { + local version=$1 + if [[ ! $version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "Invalid version format: $version. Expected format: x.y.z where x, y, and z are numbers." + usage + fi +} + +function validate_release() { + local release=$1 + if [[ ! $release =~ ^[a-zA-Z._-]+$ ]]; then + echo "Invalid release format: $release. Expected a string release name" + usage + fi +} + +# Invalid input +if [ "$#" -ne 0 ] && [ "$#" -ne 3 ]; then + usage fi if [ -z "${WORKSPACE}" ]; then @@ -40,24 +67,68 @@ if [ -z "${WORKSPACE}" ]; then export WORKSPACE fi +if [ -z "$ROBOT_LOG_DIR" ]; then + export ROBOT_LOG_DIR=/tmp/ +fi export SCRIPTS="${WORKSPACE}/csit/resources/scripts" - COMPOSE_FOLDER="${WORKSPACE}"/compose REGRESSION_FOLDER="${WORKSPACE}"/policy-regression-tests/policy-clamp-regression/ export PROJECT='clamp' +DEFAULT_BRANCH=$(awk -F= '$1 == "defaultbranch" { print $2 }' \ + "${WORKSPACE}"/.gitreview) -# Sign in to nexus3 docker repo -docker login -u docker -p docker nexus3.onap.org:10001 +# Run from default branch +if [ $# -eq 0 ] +then + echo "Usage: $0 --release <acmr-release_branch> <ppnt-release_branch> | --version <acmr-version> <ppnt-version>" + echo "*** No release_branch/versions provided. Default branch will be used." + echo "Fetching image versions for all components..." + source ${COMPOSE_FOLDER}/get-versions-regression.sh $DEFAULT_BRANCH $DEFAULT_BRANCH > /dev/null 2>&1 + echo "Starting Regression with ACM-R and PPNT from the default release branch $DEFAULT_BRANCH ***" + export CLAMP_CONFIG_PATH=$(release_config_path "$DEFAULT_BRANCH") + export PPNT_CONFIG_PATH="$CLAMP_CONFIG_PATH" + echo "Using configuration file located at $CLAMP_CONFIG_PATH for ACM-R and $PPNT_CONFIG_PATH for PPNTS." + +# Run with specific release/version +elif [ "$#" -gt 0 ] +then + case $1 in + --release) + validate_release $2 + validate_release $3 + echo "Fetching image versions for all components..." + source ${COMPOSE_FOLDER}/get-versions-regression.sh $2 $3 > /dev/null 2>&1 + echo "*** Starting Regression with ACM-R from branch $2 and PPNT from branch $3 ***" + export CLAMP_CONFIG_PATH=$(release_config_path $2) + export PPNT_CONFIG_PATH=$(release_config_path $3) + echo "Using configuration file located at $CLAMP_CONFIG_PATH for ACM-R and $PPNT_CONFIG_PATH for PPNTS." + ;; + --version) + validate_version $2 + validate_version $3 + echo "Fetching image versions for all components..." + source ${COMPOSE_FOLDER}/get-versions-regression.sh $DEFAULT_BRANCH $DEFAULT_BRANCH > /dev/null 2>&1 + export POLICY_CLAMP_VERSION=$2 + export POLICY_CLAMP_PPNT_VERSION=$3 + echo "*** Starting Regression with ACM-R version $2 and PPNT version $3 ***" + export CLAMP_CONFIG_PATH=$(version_config_path "$2") + export PPNT_CONFIG_PATH=$(version_config_path "$3") + echo "Using configuration file located at $CLAMP_CONFIG_PATH for ACM-R and $PPNT_CONFIG_PATH for PPNTS." + ;; + *) + echo "Unknown parameter: $1" + usage + ;; + esac +fi +echo "*** Configure docker compose and trigger deployment***" cd ${COMPOSE_FOLDER} - -echo "Configuring docker compose..." - +docker login -u docker -p docker nexus3.onap.org:10001 > /dev/null 2>&1 source export-ports.sh > /dev/null 2>&1 -source get-versions-regression.sh $ACM_RELEASE $PPNT_RELEASE > /dev/null 2>&1 -docker-compose -f docker-compose.yml up -d "policy-clamp-runtime-acm" +docker compose -f docker-compose.yml up -d "policy-clamp-runtime-acm" # wait for the app to start up "${SCRIPTS}"/wait_for_rest.sh localhost "${ACM_PORT}" @@ -65,4 +136,5 @@ docker-compose -f docker-compose.yml up -d "policy-clamp-runtime-acm" cd ${REGRESSION_FOLDER} # Invoke the regression test cases -mvn clean test -Dtests.skip=false
\ No newline at end of file +mvn clean test -Dtests.skip=false + diff --git a/csit/run-k8s-csit.sh b/csit/run-k8s-csit.sh index 7a5fe03c..6502c348 100755 --- a/csit/run-k8s-csit.sh +++ b/csit/run-k8s-csit.sh @@ -431,7 +431,7 @@ if [ $OPERATION == "install" ]; then sudo helm dependency build policy sudo helm install csit-policy policy ${SET_VALUES} sudo helm install prometheus prometheus - wait_for_pods_running default 600 ${READINESS_CONTAINERS[@]} + wait_for_pods_running default 900 ${READINESS_CONTAINERS[@]} echo "Policy chart installation completed" echo "-------------------------------------------" fi |