From 1f3a832e393437f9e373540e6f975480a7b074a7 Mon Sep 17 00:00:00 2001 From: danielhanrahan Date: Wed, 4 Feb 2026 16:42:53 +0000 Subject: [PATCH] Refactor docker compose to remove duplication There are many duplicate service definitions across the compose files, mainly due to having separate configs for with and without replicas. Instead, replica count can be set to 1 by default, and the same config used. Changes: - Use deploy.replicas with default of 1 for ACM services - Remove compose.acm.scale.yml and compose.pdp.scale.yml - Consolidate participant sim configs using YAML anchors - Standardize service names with policy-* prefix - Remove legacy scaling scripts and nginx configurations - Delete broken apex-pdp-medium and -large tests. - Fix intermittent issue in apex-pdp tests using sleep 5s Issue-ID: POLICY-5534 Change-Id: I45546099690ba24c224bd7006c2422a151d266e2 Signed-off-by: danielhanrahan --- compose/compose.acm.scale.yml | 171 ------------------------------- compose/compose.common.yml | 54 ++++------ compose/compose.pdp.scale.yml | 94 ----------------- compose/compose.postgres.yml | 2 +- compose/compose.yaml | 145 +++++++++++++------------- compose/config/nginx/nginx-acm.conf | 17 --- compose/config/nginx/nginx.conf | 18 ---- compose/export-ports.sh | 2 +- compose/metrics/prometheus.yml | 4 +- compose/start-acm-replica.sh | 100 ------------------ compose/start-compose.sh | 54 ++++------ compose/start-multiple-pdp.sh | 86 ---------------- compose/stop-compose.sh | 29 ------ csit/resources/tests/apex-pdp-test.robot | 1 + csit/resources/tests/apex-slas-10.robot | 73 ------------- csit/resources/tests/apex-slas-3.robot | 74 ------------- csit/run-project-csit.sh | 92 ++++------------- 17 files changed, 141 insertions(+), 875 deletions(-) delete mode 100644 compose/compose.acm.scale.yml delete mode 100644 compose/compose.pdp.scale.yml delete mode 100644 compose/config/nginx/nginx-acm.conf delete mode 100644 compose/config/nginx/nginx.conf delete mode 100755 compose/start-acm-replica.sh delete mode 100755 compose/start-multiple-pdp.sh delete mode 100644 csit/resources/tests/apex-slas-10.robot delete mode 100644 csit/resources/tests/apex-slas-3.robot diff --git a/compose/compose.acm.scale.yml b/compose/compose.acm.scale.yml deleted file mode 100644 index 2b1d1bd0..00000000 --- a/compose/compose.acm.scale.yml +++ /dev/null @@ -1,171 +0,0 @@ -# -# ===========LICENSE_START==================================================== -# Copyright (C) 2024-2026 OpenInfra Foundation Europe. All rights reserved. -# ============================================================================ -# 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===================================================== -# - -include: - - compose.yaml - -services: - policy-clamp-runtime-acm-replica: - image: ${CONTAINER_LOCATION}onap/policy-clamp-runtime-acm:${POLICY_CLAMP_VERSION} - hostname: policy-clamp-runtime-acm - depends_on: - - policy-db-migrator - - apex-pdp - - kafka - - jaeger - - policy-clamp-ac-pf-ppnt - - policy-clamp-ac-sim-ppnt-1 - - policy-clamp-ac-sim-ppnt-2 - - policy-clamp-ac-sim-ppnt-3 - expose: - - 6969 - deploy: - mode: replicated - replicas: ${REPLICAS:-2} - restart: - on-failure:3 - environment: - RUNTIME_USER: runtimeUser - RUNTIME_PASSWORD: zb!XztG34 - TIMEZONE: UTC - SQL_HOST: postgres - SQL_PORT: 5432 - SQL_USER: policy_user - SQL_PASSWORD: policy_user - TOPIC_COMM_INFRASTRUCTURE: kafka - ALLOW_TRACING: true - PROMETHEUS_PORT: 6969 - OTEL_SERVICE_NAME: acm-r - OTEL_EXPORTER_OTLP_PROTOCOL: http/protobuf - OTEL_EXPORTER_OTLP_TRACES_PROTOCOL: http/protobuf - OTEL_EXPORTER_OTLP_ENDPOINT: http://jaeger:4318 - OTEL_JAVA_GLOBAL_AUTOCONFIGURE_ENABLED: true - JAVA_TOOL_OPTIONS: >- - -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 - healthcheck: - test: "curl --fail --silent http://localhost:6969/onap/policy/clamp/acm/actuator/health/readiness | grep UP || exit 1" - interval: 30s - timeout: 10s - retries: 5 - start_period: 60s - - policy-clamp-ac-http-ppnt-replica: - image: ${CONTAINER_LOCATION}onap/policy-clamp-ac-http-ppnt:${POLICY_CLAMP_PPNT_VERSION} - hostname: policy-clamp-ac-http-ppnt - depends_on: - - kafka - - jaeger - expose: - - 6969 - deploy: - mode: replicated - replicas: ${REPLICAS:-2} - environment: - HTTP_USER: participantUser - HTTP_PASSWORD: zb!XztG34 - topicCommInfrastructure: kafka - allowTracing: true - OTEL_SERVICE_NAME: http-ppnt - OTEL_EXPORTER_OTLP_PROTOCOL: http/protobuf - OTEL_EXPORTER_OTLP_TRACES_PROTOCOL: http/protobuf - OTEL_EXPORTER_OTLP_ENDPOINT: http://jaeger:4318 - OTEL_JAVA_GLOBAL_AUTOCONFIGURE_ENABLED: true - SPRING_PROFILES_ACTIVE: ${PPNT_PROFILE:-default} - healthcheck: - test: "curl --fail --silent http://localhost:6969/onap/policy/clamp/acm/httpparticipant/health/readiness | grep UP || exit 1" - interval: 30s - timeout: 10s - retries: 5 - start_period: 60s - - policy-clamp-ac-k8s-ppnt-replica: - image: ${CONTAINER_LOCATION}onap/policy-clamp-ac-k8s-ppnt:${POLICY_CLAMP_PPNT_VERSION} - hostname: policy-clamp-ac-k8s-ppnt - depends_on: - - kafka - - jaeger - environment: - HTTP_USER: participantUser - HTTP_PASSWORD: zb!XztG34 - topicCommInfrastructure: kafka - allowTracing: true - OTEL_SERVICE_NAME: k8s-ppnt - OTEL_EXPORTER_OTLP_PROTOCOL: http/protobuf - OTEL_EXPORTER_OTLP_TRACES_PROTOCOL: http/protobuf - OTEL_EXPORTER_OTLP_ENDPOINT: http://jaeger:4318 - OTEL_JAVA_GLOBAL_AUTOCONFIGURE_ENABLED: true - SPRING_PROFILES_ACTIVE: ${PPNT_PROFILE:-default} - expose: - - 6969 - deploy: - mode: replicated - replicas: ${REPLICAS:-2} - healthcheck: - test: "curl --fail --silent http://localhost:6969/onap/policy/clamp/acm/k8sparticipant/health/readiness | grep UP || exit 1" - interval: 30s - timeout: 10s - retries: 5 - start_period: 20s - - policy-clamp-ac-pf-ppnt-replica: - image: ${CONTAINER_LOCATION}onap/policy-clamp-ac-pf-ppnt:${POLICY_CLAMP_PPNT_VERSION} - hostname: policy-clamp-ac-pf-ppnt - depends_on: - - kafka - - jaeger - expose: - - 6969 - deploy: - mode: replicated - replicas: ${REPLICAS:-2} - environment: - API_USER: policyadmin - API_PASSWORD: zb!XztG34 - PAP_USER: policyadmin - PAP_PASSWORD: zb!XztG34 - HTTP_USER: participantUser - HTTP_PASSWORD: zb!XztG34 - topicCommInfrastructure: kafka - allowTracing: true - OTEL_SERVICE_NAME: policy-ppnt - OTEL_EXPORTER_OTLP_PROTOCOL: http/protobuf - OTEL_EXPORTER_OTLP_TRACES_PROTOCOL: http/protobuf - OTEL_EXPORTER_OTLP_ENDPOINT: http://jaeger:4318 - OTEL_JAVA_GLOBAL_AUTOCONFIGURE_ENABLED: true - SPRING_PROFILES_ACTIVE: ${PPNT_PROFILE:-default} - healthcheck: - test: "curl --fail --silent http://localhost:6969/onap/policy/clamp/acm/policyparticipant/health/readiness | grep UP || exit 1" - interval: 30s - timeout: 10s - retries: 5 - start_period: 30s - - nginx: - image: ${CONTAINER_LOCATION}library/nginx:latest - volumes: - - ./config/nginx/nginx-acm.conf:/etc/nginx/nginx.conf:ro - depends_on: - - policy-clamp-runtime-acm-replica - ports: - - ${ACM_PORT}:${ACM_PORT} diff --git a/compose/compose.common.yml b/compose/compose.common.yml index 5d6c3219..9082a001 100644 --- a/compose/compose.common.yml +++ b/compose/compose.common.yml @@ -19,10 +19,10 @@ services: - simulator: + policy-models-simulator: image: ${CONTAINER_LOCATION}onap/policy-models-simulator:${POLICY_MODELS_VERSION} - container_name: simulator - hostname: simulator + container_name: policy-models-simulator + hostname: policy-models-simulator networks: default: aliases: @@ -41,78 +41,61 @@ services: ports: - ${SIMULATOR_PORT}:6666 - policy-clamp-ac-sim-ppnt-1: + x-policy-clamp-ac-sim-ppnt-template: &policy-clamp-ac-sim-ppnt-template image: ${CONTAINER_LOCATION}onap/policy-clamp-ac-sim-ppnt:${POLICY_CLAMP_PPNT_VERSION} - container_name: policy-clamp-ac-sim-ppnt-1 - hostname: policy-clamp-ac-sim-ppnt-1 depends_on: - kafka - jaeger - environment: + environment: &policy-clamp-ac-sim-ppnt-env HTTP_USER: participantUser HTTP_PASSWORD: zb!XztG34 topicCommInfrastructure: kafka allowTracing: true - OTEL_SERVICE_NAME: sim-ppnt-1 OTEL_EXPORTER_OTLP_PROTOCOL: http/protobuf OTEL_EXPORTER_OTLP_TRACES_PROTOCOL: http/protobuf OTEL_EXPORTER_OTLP_ENDPOINT: http://jaeger:4318 SPRING_PROFILES_ACTIVE: ${PPNT_PROFILE:-default} + OTEL_JAVA_GLOBAL_AUTOCONFIGURE_ENABLED: true + + policy-clamp-ac-sim-ppnt-1: + <<: *policy-clamp-ac-sim-ppnt-template + container_name: policy-clamp-ac-sim-ppnt-1 + hostname: policy-clamp-ac-sim-ppnt-1 + environment: + <<: *policy-clamp-ac-sim-ppnt-env + OTEL_SERVICE_NAME: sim-ppnt-1 participantId: 101c62b3-8918-41b9-a747-d21eb79c6c90 applicationName: sim-ppnt-1 groupId: policy-clamp-ac-sim-ppnt-1 supportedElementTypeName: org.onap.policy.clamp.acm.SimAutomationCompositionElement - OTEL_JAVA_GLOBAL_AUTOCONFIGURE_ENABLED: true ports: - ${SIM_PARTICIPANT1_PORT}:6969 policy-clamp-ac-sim-ppnt-2: - image: ${CONTAINER_LOCATION}onap/policy-clamp-ac-sim-ppnt:${POLICY_CLAMP_PPNT_VERSION} + <<: *policy-clamp-ac-sim-ppnt-template container_name: policy-clamp-ac-sim-ppnt-2 hostname: policy-clamp-ac-sim-ppnt-2 - depends_on: - - kafka - - jaeger environment: - HTTP_USER: participantUser - HTTP_PASSWORD: zb!XztG34 - topicCommInfrastructure: kafka - allowTracing: true + <<: *policy-clamp-ac-sim-ppnt-env OTEL_SERVICE_NAME: sim-ppnt-2 - OTEL_EXPORTER_OTLP_PROTOCOL: http/protobuf - OTEL_EXPORTER_OTLP_TRACES_PROTOCOL: http/protobuf - OTEL_EXPORTER_OTLP_ENDPOINT: http://jaeger:4318 - SPRING_PROFILES_ACTIVE: ${PPNT_PROFILE:-default} participantId: 101c62b3-8918-41b9-a747-d21eb79c6c91 applicationName: sim-ppnt-2 groupId: policy-clamp-ac-sim-ppnt-2 supportedElementTypeName: org.onap.policy.clamp.acm.SimAutomationCompositionElement2 - OTEL_JAVA_GLOBAL_AUTOCONFIGURE_ENABLED: true ports: - ${SIM_PARTICIPANT2_PORT}:6969 policy-clamp-ac-sim-ppnt-3: - image: ${CONTAINER_LOCATION}onap/policy-clamp-ac-sim-ppnt:${POLICY_CLAMP_PPNT_VERSION} + <<: *policy-clamp-ac-sim-ppnt-template container_name: policy-clamp-ac-sim-ppnt-3 hostname: policy-clamp-ac-sim-ppnt-3 - depends_on: - - kafka - - jaeger environment: - HTTP_USER: participantUser - HTTP_PASSWORD: zb!XztG34 - topicCommInfrastructure: kafka - allowTracing: true + <<: *policy-clamp-ac-sim-ppnt-env OTEL_SERVICE_NAME: sim-ppnt-3 - OTEL_EXPORTER_OTLP_PROTOCOL: http/protobuf - OTEL_EXPORTER_OTLP_TRACES_PROTOCOL: http/protobuf - OTEL_EXPORTER_OTLP_ENDPOINT: http://jaeger:4318 - SPRING_PROFILES_ACTIVE: ${PPNT_PROFILE:-default} participantId: 101c62b3-8918-41b9-a747-d21eb79c6c92 applicationName: sim-ppnt-3 groupId: policy-clamp-ac-sim-ppnt-3 supportedElementTypeName: org.onap.policy.clamp.acm.SimAutomationCompositionElement3 - OTEL_JAVA_GLOBAL_AUTOCONFIGURE_ENABLED: true ports: - ${SIM_PARTICIPANT3_PORT}:6969 @@ -170,6 +153,7 @@ services: jaeger: image: nexus3.onap.org:10001/jaegertracing/all-in-one:1.58 container_name: jaeger + hostname: jaeger ports: - "4318:4318" - "4317:4317" diff --git a/compose/compose.pdp.scale.yml b/compose/compose.pdp.scale.yml deleted file mode 100644 index b4b199f7..00000000 --- a/compose/compose.pdp.scale.yml +++ /dev/null @@ -1,94 +0,0 @@ -# -# ===========LICENSE_START==================================================== -# Copyright (C) 2023-2024 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. -# ============LICENSE_END===================================================== -# - -include: - - compose.common.yml - - compose.postgres.yml - -services: - api: - image: ${CONTAINER_LOCATION}onap/policy-api:${POLICY_API_VERSION} - container_name: policy-api - hostname: policy-api - depends_on: - - policy-db-migrator - ports: - - ${API_PORT}:6969 - volumes: - - ./config/api/apiParameters.yaml:/opt/app/policy/api/etc/apiParameters.yaml:ro - - ./config/api/logback.xml:/opt/app/policy/api/etc/logback.xml:ro - - ./wait_for_port.sh:/opt/app/policy/api/bin/wait_for_port.sh:ro - entrypoint: ./wait_for_port.sh - command: [ - '-c', './policy-api.sh', - 'policy-db-migrator', '6824' - ] - - pap: - image: ${CONTAINER_LOCATION}onap/policy-pap:${POLICY_PAP_VERSION} - container_name: policy-pap - hostname: policy-pap - depends_on: - - api - - kafka - ports: - - ${PAP_PORT}:6969 - volumes: - - ./config/pap/papParameters.yaml:/opt/app/policy/pap/etc/papParameters.yaml:ro - - ./config/apex-pdp/groups.json:/opt/app/policy/pap/etc/mounted/groups.json:ro - - ./config/pap/logback.xml:/opt/app/policy/pap/etc/logback.xml:ro - - ./wait_for_port.sh:/opt/app/policy/pap/bin/wait_for_port.sh:ro - entrypoint: ./wait_for_port.sh - command: [ - '-c', './policy-pap.sh', - 'api', '6969', - 'kafka', '9092' - ] - - apexpdp: - image: ${CONTAINER_LOCATION}onap/policy-apex-pdp:${POLICY_APEX_PDP_VERSION} - hostname: policy-apex-pdp - depends_on: - - simulator - - kafka - - pap - expose: - - 6969 - - 23324 - deploy: - mode: replicated - replicas: ${REPLICAS:-2} - volumes: - - ./config/apex-pdp/OnapPfConfig.json:/opt/app/policy/apex-pdp/etc/onappf/config/OnapPfConfig.json:ro - - ./config/apex-pdp/logback.xml:/opt/app/policy/apex-pdp/etc/logback.xml:ro - - ./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/apex-pdp/bin/apexOnapPf.sh -c /opt/app/policy/apex-pdp/etc/onappf/config/OnapPfConfig.json', - 'kafka', '9092', - 'pap', '6969' - ] - nginx: - image: ${CONTAINER_LOCATION}library/nginx:latest - volumes: - - ./config/nginx/nginx.conf:/etc/nginx/nginx.conf:ro - depends_on: - - apexpdp - ports: - - ${APEX_PORT}:${APEX_PORT} - - ${APEX_EVENTS_PORT}:${APEX_EVENTS_PORT} diff --git a/compose/compose.postgres.yml b/compose/compose.postgres.yml index bb497cdc..9f311ab2 100644 --- a/compose/compose.postgres.yml +++ b/compose/compose.postgres.yml @@ -43,7 +43,7 @@ services: env_file: config/db-pg/db-pg.conf environment: POSTGRES_PASSWORD: policy_user - SQL_DB: ${SCHEMAS_TO_BE_CREATED} + SQL_DB: policyadmin operationshistory pooling SQL_HOST: postgres volumes: - ./config/db-migrator/init_pg.sh:/opt/app/policy/bin/db_migrator_policy_init_pg.sh:ro diff --git a/compose/compose.yaml b/compose/compose.yaml index d19912b3..751fc587 100644 --- a/compose/compose.yaml +++ b/compose/compose.yaml @@ -22,11 +22,11 @@ include: - compose.common.yml - - compose.${database:-postgres}.yml + - compose.postgres.yml services: - api: + policy-api: image: ${CONTAINER_LOCATION}onap/policy-api:${POLICY_API_VERSION} container_name: policy-api hostname: policy-api @@ -36,7 +36,7 @@ services: - ${API_PORT}:6969 environment: JAVA_TOOL_OPTIONS: >- - -Dlogging.config="/opt/app/policy/api/etc/logback.xml" + -Dlogging.config=/opt/app/policy/api/etc/logback.xml SPRING_PROFILES_ACTIVE: ${API_PROFILE:-default} SPRING_CONFIG_LOCATION: /opt/app/policy/api/etc/apiParameters.yaml volumes: @@ -49,18 +49,18 @@ services: 'policy-db-migrator', '6824' ] - pap: + policy-pap: image: ${CONTAINER_LOCATION}onap/policy-pap:${POLICY_PAP_VERSION} container_name: policy-pap hostname: policy-pap depends_on: - - api + - policy-api - kafka ports: - ${PAP_PORT}:6969 environment: JAVA_TOOL_OPTIONS: >- - -Dlogging.config="/opt/app/policy/pap/etc/logback.xml" + -Dlogging.config=/opt/app/policy/pap/etc/logback.xml SPRING_PROFILES_ACTIVE: ${PAP_PROFILE:-default} SPRING_CONFIG_LOCATION: /opt/app/policy/pap/etc/papParameters.yaml volumes: @@ -71,18 +71,18 @@ services: entrypoint: ./wait_for_port.sh command: [ '-c', 'java -jar /app/pap.jar --group-config-file=/opt/app/policy/pap/etc/mounted/groups.json', - 'api', '6969', + 'policy-api', '6969', 'kafka', '9092' ] - apex-pdp: + policy-apex-pdp: image: ${CONTAINER_LOCATION}onap/policy-apex-pdp:${POLICY_APEX_PDP_VERSION} container_name: policy-apex-pdp hostname: policy-apex-pdp depends_on: - - simulator + - policy-models-simulator - kafka - - pap + - policy-pap ports: - ${APEX_PORT}:6969 - ${APEX_EVENTS_PORT}:23324 @@ -94,15 +94,15 @@ services: command: [ '-c', '/opt/app/policy/apex-pdp/bin/apexOnapPf.sh -c /opt/app/policy/apex-pdp/etc/onappf/config/OnapPfConfig.json', 'kafka', '9092', - 'pap', '6969' + 'policy-pap', '6969' ] - distribution: + policy-distribution: image: ${CONTAINER_LOCATION}onap/policy-distribution:${POLICY_DISTRIBUTION_VERSION} container_name: policy-distribution hostname: policy-distribution depends_on: - - apex-pdp + - policy-apex-pdp ports: - ${DIST_PORT}:6969 volumes: @@ -113,58 +113,59 @@ services: entrypoint: /opt/app/policy/bin/wait_for_port.sh command: [ '-c', './policy-dist.sh', - 'apex-pdp', '6969' + 'policy-apex-pdp', '6969' ] - xacml-pdp: + policy-xacml-pdp: image: ${CONTAINER_LOCATION}onap/policy-xacml-pdp:${POLICY_XACML_PDP_VERSION} container_name: policy-xacml-pdp hostname: policy-xacml-pdp depends_on: - - pap + - policy-pap - kafka ports: - ${XACML_PORT}:6969 - - "30999:3904" + - 30999:3904 volumes: - ./config/xacml-pdp/defaultConfig.json:/opt/app/policy/pdpx/etc/defaultConfig.json:ro - ./config/xacml-pdp/logback.xml:/opt/app/policy/pdpx/etc/logback.xml:ro - - ./config/xacml-pdp/xacml-${database:-postgres}.properties:/opt/app/policy/pdpx/apps/guard/xacml.properties:ro + - ./config/xacml-pdp/xacml-postgres.properties:/opt/app/policy/pdpx/apps/guard/xacml.properties:ro - ./wait_for_port.sh:/opt/app/policy/pdpx/bin/wait_for_port.sh:ro entrypoint: ./wait_for_port.sh command: [ '-c', './policy-pdpx.sh', - 'pap', '6969', + 'policy-pap', '6969', 'kafka', '9092' ] - opa-pdp: - image: ${CONTAINER_LOCATION}onap/policy-opa-pdp:${POLICY_OPA_PDP_VERSION} - container_name: policy-opa-pdp - depends_on: - - kafka - - pap - hostname: policy-opa-pdp - volumes: - - ./config/opa-pdp/config.json:/app/config/config.json:ro - - ./config/opa-pdp/policy-opa-pdp.sh:/app/policy-opa-pdp.sh:ro - - ./wait_for_port.sh:/app/wait_for_port.sh - env_file: "./config/opa-pdp/opa-pdp.env" - entrypoint: sh wait_for_port.sh - command: [ - '-c', './policy-opa-pdp.sh', - 'kafka', '9092', - 'pap', '6969' - ] - ports: - - ${OPA_PDP_PORT}:8282 + policy-opa-pdp: + image: ${CONTAINER_LOCATION}onap/policy-opa-pdp:${POLICY_OPA_PDP_VERSION} + container_name: policy-opa-pdp + hostname: policy-opa-pdp + depends_on: + - kafka + - policy-pap + ports: + - ${OPA_PDP_PORT}:8282 + volumes: + - ./config/opa-pdp/config.json:/app/config/config.json:ro + - ./config/opa-pdp/policy-opa-pdp.sh:/app/policy-opa-pdp.sh:ro + - ./wait_for_port.sh:/app/wait_for_port.sh:ro + env_file: + - ./config/opa-pdp/opa-pdp.env + entrypoint: ./wait_for_port.sh + command: [ + '-c', './policy-opa-pdp.sh', + 'kafka', '9092', + 'policy-pap', '6969' + ] - drools-pdp: + policy-drools-pdp: image: ${CONTAINER_LOCATION}onap/policy-drools:${POLICY_DROOLS_PDP_VERSION} container_name: policy-drools-pdp hostname: policy-drools-pdp depends_on: - - pap + - policy-pap - kafka ports: - ${DROOLS_PORT}:6969 @@ -173,22 +174,22 @@ services: - ./config/drools-pdp/custom:/tmp/policy-install/config:ro - ./wait_for_port.sh:/opt/app/policy/bin/wait_for_port.sh:ro env_file: - - config/drools-pdp/env/base-${database:-postgres}.conf + - config/drools-pdp/env/base-postgres.conf entrypoint: /opt/app/policy/bin/wait_for_port.sh command: [ '-c', '/opt/app/policy/bin/pdpd-entrypoint.sh boot', - 'pap', '6969', + 'policy-pap', '6969', 'kafka', '9092' ] - drools-applications: + policy-drools-apps: image: ${CONTAINER_LOCATION}onap/policy-pdpd-cl:${POLICY_DROOLS_APPS_VERSION} container_name: policy-drools-apps hostname: policy-drools-apps depends_on: - - pap - - xacml-pdp - - simulator + - policy-pap + - policy-xacml-pdp + - policy-models-simulator - kafka ports: - ${DROOLS_APPS_PORT}:6969 @@ -197,13 +198,13 @@ services: - ./config/drools-applications/custom:/tmp/policy-install/config:ro - ./wait_for_port.sh:/opt/app/policy/bin/wait_for_port.sh:ro env_file: - - config/drools-applications/env/base-${database:-postgres}.conf + - config/drools-applications/env/base-postgres.conf - config/drools-applications/env/feature-healthcheck.conf - config/drools-applications/env/feature-pooling-messages.conf entrypoint: /opt/app/policy/bin/wait_for_port.sh command: [ '-c', '/opt/app/policy/bin/pdpd-cl-entrypoint.sh boot', - 'pap', '6969', + 'policy-pap', '6969', 'kafka', '9092', 'aai-sim', '6666', 'sdnc-sim', '6668', @@ -212,10 +213,9 @@ services: policy-clamp-runtime-acm: image: ${CONTAINER_LOCATION}onap/policy-clamp-runtime-acm:${POLICY_CLAMP_VERSION} - container_name: policy-clamp-runtime-acm hostname: policy-clamp-runtime-acm depends_on: - - apex-pdp + - policy-apex-pdp - kafka - jaeger - policy-clamp-ac-pf-ppnt @@ -223,9 +223,9 @@ services: - policy-clamp-ac-sim-ppnt-2 - policy-clamp-ac-sim-ppnt-3 ports: - - ${ACM_PORT}:6969 - restart: - on-failure:3 + - ${ACM_PORT}-${ACM_PORT_END}:6969 + deploy: + replicas: ${ACM_REPLICAS:-1} environment: RUNTIME_USER: runtimeUser RUNTIME_PASSWORD: zb!XztG34 @@ -260,13 +260,14 @@ services: policy-clamp-ac-http-ppnt: image: ${CONTAINER_LOCATION}onap/policy-clamp-ac-http-ppnt:${POLICY_CLAMP_PPNT_VERSION} - container_name: policy-clamp-ac-http-ppnt hostname: policy-clamp-ac-http-ppnt depends_on: - kafka - jaeger - ports: - - "30290:6969" + expose: + - 6969 + deploy: + replicas: ${ACM_REPLICAS:-1} environment: HTTP_USER: participantUser HTTP_PASSWORD: zb!XztG34 @@ -287,11 +288,14 @@ services: policy-clamp-ac-k8s-ppnt: image: ${CONTAINER_LOCATION}onap/policy-clamp-ac-k8s-ppnt:${POLICY_CLAMP_PPNT_VERSION} - container_name: policy-clamp-ac-k8s-ppnt hostname: policy-clamp-ac-k8s-ppnt depends_on: - kafka - jaeger + expose: + - 6969 + deploy: + replicas: ${ACM_REPLICAS:-1} environment: HTTP_USER: participantUser HTTP_PASSWORD: zb!XztG34 @@ -303,8 +307,6 @@ services: OTEL_EXPORTER_OTLP_ENDPOINT: http://jaeger:4318 OTEL_JAVA_GLOBAL_AUTOCONFIGURE_ENABLED: true SPRING_PROFILES_ACTIVE: ${PPNT_PROFILE:-default} - ports: - - "30295:6969" healthcheck: test: "curl --fail --silent http://localhost:6969/onap/policy/clamp/acm/k8sparticipant/health/readiness | grep UP || exit 1" interval: 30s @@ -314,14 +316,15 @@ services: policy-clamp-ac-pf-ppnt: image: ${CONTAINER_LOCATION}onap/policy-clamp-ac-pf-ppnt:${POLICY_CLAMP_PPNT_VERSION} - container_name: policy-clamp-ac-pf-ppnt hostname: policy-clamp-ac-pf-ppnt depends_on: - kafka - - api + - policy-api - jaeger - ports: - - ${POLICY_PARTICIPANT_PORT}:6969 + expose: + - 6969 + deploy: + replicas: ${ACM_REPLICAS:-1} environment: API_USER: policyadmin API_PASSWORD: zb!XztG34 @@ -346,11 +349,14 @@ services: policy-clamp-ac-a1pms-ppnt: image: ${CONTAINER_LOCATION}onap/policy-clamp-ac-a1pms-ppnt:${POLICY_CLAMP_PPNT_VERSION} - container_name: policy-clamp-ac-a1pms-ppnt hostname: policy-clamp-ac-a1pms-ppnt depends_on: - kafka - jaeger + expose: + - 6969 + deploy: + replicas: ${ACM_REPLICAS:-1} environment: HTTP_USER: participantUser HTTP_PASSWORD: zb!XztG34 @@ -361,8 +367,6 @@ services: OTEL_EXPORTER_OTLP_TRACES_PROTOCOL: http/protobuf OTEL_EXPORTER_OTLP_ENDPOINT: http://jaeger:4318 OTEL_JAVA_GLOBAL_AUTOCONFIGURE_ENABLED: true - ports: - - "30296:6969" healthcheck: test: "curl --fail --silent http://localhost:6969/onap/policy/clamp/acm/a1pmsparticipant/health/readiness | grep UP || exit 1" interval: 30s @@ -372,11 +376,14 @@ services: policy-clamp-ac-kserve-ppnt: image: ${CONTAINER_LOCATION}onap/policy-clamp-ac-kserve-ppnt:${POLICY_CLAMP_PPNT_VERSION} - container_name: policy-clamp-ac-kserve-ppnt hostname: policy-clamp-ac-kserve-ppnt depends_on: - kafka - jaeger + expose: + - 6969 + deploy: + replicas: ${ACM_REPLICAS:-1} environment: HTTP_USER: participantUser HTTP_PASSWORD: zb!XztG34 @@ -387,8 +394,6 @@ services: OTEL_EXPORTER_OTLP_TRACES_PROTOCOL: http/protobuf OTEL_EXPORTER_OTLP_ENDPOINT: http://jaeger:4318 OTEL_JAVA_GLOBAL_AUTOCONFIGURE_ENABLED: true - ports: - - "30297:6969" healthcheck: test: "curl --fail --silent http://localhost:6969/onap/policy/clamp/acm/kserveparticipant/health/readiness | grep UP || exit 1" interval: 30s diff --git a/compose/config/nginx/nginx-acm.conf b/compose/config/nginx/nginx-acm.conf deleted file mode 100644 index 59d12109..00000000 --- a/compose/config/nginx/nginx-acm.conf +++ /dev/null @@ -1,17 +0,0 @@ -user nginx; - -events { - worker_connections 1000; -} - -http { - upstream runtime { - server policy-clamp-runtime-acm-replica:6969; - } - server { - listen 30007; - location / { - proxy_pass http://runtime; - } - } -} diff --git a/compose/config/nginx/nginx.conf b/compose/config/nginx/nginx.conf deleted file mode 100644 index 08d65627..00000000 --- a/compose/config/nginx/nginx.conf +++ /dev/null @@ -1,18 +0,0 @@ -user nginx; - -events { - worker_connections 1000; -} - -http { - upstream pdps { - server apexpdp:6969; - server apexpdp:23324; - } - server { - listen 30001; - location / { - proxy_pass http://pdps; - } - } -} diff --git a/compose/export-ports.sh b/compose/export-ports.sh index 09a5a250..830dc0b4 100755 --- a/compose/export-ports.sh +++ b/compose/export-ports.sh @@ -29,7 +29,7 @@ export DROOLS_PORT=30005 export DROOLS_TELEMETRY_PORT=30216 export DIST_PORT=30006 export ACM_PORT=30007 -export POLICY_PARTICIPANT_PORT=30008 +export ACM_PORT_END=30008 export SIM_PARTICIPANT1_PORT=30011 export SIM_PARTICIPANT2_PORT=30013 export SIM_PARTICIPANT3_PORT=30014 diff --git a/compose/metrics/prometheus.yml b/compose/metrics/prometheus.yml index cb182bea..19c0dbee 100644 --- a/compose/metrics/prometheus.yml +++ b/compose/metrics/prometheus.yml @@ -100,8 +100,8 @@ scrape_configs: metrics_path: "/onap/policy/clamp/acm/actuator/prometheus" static_configs: - targets: - - "compose-policy-clamp-runtime-acm-replica-1:6969" - - "compose-policy-clamp-runtime-acm-replica-2:6969" + - "compose-policy-clamp-runtime-acm-1:6969" + - "compose-policy-clamp-runtime-acm-2:6969" basic_auth: username: "runtimeUser" password: "zb!XztG34" diff --git a/compose/start-acm-replica.sh b/compose/start-acm-replica.sh deleted file mode 100755 index 656e5abf..00000000 --- a/compose/start-acm-replica.sh +++ /dev/null @@ -1,100 +0,0 @@ -#!/bin/bash -# -# ============LICENSE_START==================================================== -# Copyright (C) 2025 OpenInfra Foundation Europe. -# ============================================================================= -# 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====================================================== - -# Usage: --start to run the docker compose with acm replicas -# --stop to stop the docker compose containers -# --replicas number of replicas (defaults to 2) - -# Initialize variables -START=false -REPLICAS=2 - -# Parse arguments -while [[ "$#" -gt 0 ]]; do - case $1 in - --start) - START=true - shift - ;; - --stop) - START=false - shift - ;; - --replicas=*) - REPLICAS="${1#*=}" - shift - ;; - --grafana) - grafana=true - shift - ;; - *) - echo "Unknown option: $1" - exit 1 - ;; - esac -done - -if [ -z "${WORKSPACE}" ]; then - WORKSPACE=$(git rev-parse --show-toplevel) - export WORKSPACE -fi - -COMPOSE_FOLDER="${WORKSPACE}"/compose - -cd ${COMPOSE_FOLDER} - -echo "Configuring docker compose..." -source export-ports.sh > /dev/null 2>&1 -source get-versions.sh > /dev/null 2>&1 - -export REPLICAS - -if [ -z "$PROJECT" ]; then - export PROJECT=clamp -fi - -export database=postgres - - -if [ "$START" = true ]; then - if [ "$grafana" = true ]; then - echo "Starting policy-clamp-runtime-acm using ${database} + Grafana/Prometheus" - docker compose -f compose.acm.scale.yml up -d nginx grafana --remove-orphans - echo "Prometheus server: http://localhost:${PROMETHEUS_PORT}" - echo "Grafana server: http://localhost:${GRAFANA_PORT}" - else - docker compose -f compose.acm.scale.yml up -d nginx - fi -else - containers=$(docker compose -f compose.acm.scale.yml ps --all --format '{{.Service}}') - - IFS=$'\n' read -d '' -r -a item_list <<< "$containers" - for item in "${item_list[@]}" - do - if [ -n "$item" ]; then - docker compose -f compose.acm.scale.yml logs $item >> $item.log - fi - done - - docker compose -f compose.acm.scale.yml down -v --remove-orphans -fi - -cd ${WORKSPACE} diff --git a/compose/start-compose.sh b/compose/start-compose.sh index 115b30e4..fb65ab7a 100755 --- a/compose/start-compose.sh +++ b/compose/start-compose.sh @@ -18,12 +18,17 @@ # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END====================================================== -#Usage: $0 [policy-component] [OPTIONS]" -#" OPTIONS:" -#" --grafana start the docker compose with grafana" -#" --mariadb start the docker compose using mariadb" -#" --postgres [default] start the docker compose using postgres db" -#" no policy-component will start all components" +usage() { + cat << EOF +Usage: $0 [policy-component] [OPTIONS] + OPTIONS: + --grafana start docker compose with grafana + --local use local images instead of pulling from registry + --help display this help message + + If no policy-component is specified, all components will be started +EOF +} if [ -z "${WORKSPACE}" ]; then WORKSPACE=$(git rev-parse --show-toplevel) @@ -33,26 +38,18 @@ COMPOSE_FOLDER="${WORKSPACE}"/compose # Set default values for the options grafana=false -database=postgres # Parse the command-line arguments -while [[ $# -gt 0 ]] -do - key="$1" - - case $key in +while [[ $# -gt 0 ]]; do + case "$1" in + --help|-h) + usage + exit 0 + ;; --grafana) grafana=true shift ;; - --mariadb) - database=mariadb - shift - ;; - --postgres) - database=postgres - shift - ;; --local) export USE_LOCAL_IMAGES=true shift @@ -64,7 +61,7 @@ do esac done -cd ${COMPOSE_FOLDER} +cd "${COMPOSE_FOLDER}" echo "Configuring docker compose..." source export-ports.sh > /dev/null 2>&1 @@ -75,24 +72,17 @@ if [ -z "$PROJECT" ]; then export PROJECT=$component fi -export database - if [ -n "$component" ]; then if [ "$grafana" = true ]; then - echo "Starting ${component} using ${database} + Grafana/Prometheus" - docker compose up -d ${component} ${database} grafana - + docker compose up -d "${component}" postgres grafana echo "Prometheus server: http://localhost:${PROMETHEUS_PORT}" echo "Grafana server: http://localhost:${GRAFANA_PORT}" - else - echo "Starting ${component} using ${database}" - docker compose up -d ${component} ${database} + docker compose up -d "${component}" postgres fi else - export PROJECT=api # api has groups.json complete with all 3 pdps - echo "Starting all components using ${database}" + export PROJECT=policy-api # policy-api has groups.json complete with all 3 pdps docker compose up -d fi -cd ${WORKSPACE} +cd "${WORKSPACE}" diff --git a/compose/start-multiple-pdp.sh b/compose/start-multiple-pdp.sh deleted file mode 100755 index b0641b41..00000000 --- a/compose/start-multiple-pdp.sh +++ /dev/null @@ -1,86 +0,0 @@ -#!/bin/bash -# -# ============LICENSE_START==================================================== -# Copyright (C) 2023-2024 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====================================================== - -# Usage: --start to run the docker compose with apex-pdp replicas -# --stop to stop the docker compose containers -# --replicas number of replicas (defaults to 2) - -# Initialize variables -START=false -REPLICAS=2 - -# Parse arguments -while [[ "$#" -gt 0 ]]; do - case $1 in - --start) - START=true - shift - ;; - --stop) - START=false - shift - ;; - --replicas=*) - REPLICAS="${1#*=}" - shift - ;; - *) - echo "Unknown option: $1" - exit 1 - ;; - esac -done - -if [ -z "${WORKSPACE}" ]; then - WORKSPACE=$(git rev-parse --show-toplevel) - export WORKSPACE -fi - -COMPOSE_FOLDER="${WORKSPACE}"/compose - -cd ${COMPOSE_FOLDER} - -source export-ports.sh > /dev/null 2>&1 -source get-versions.sh > /dev/null 2>&1 - -export REPLICAS - -export database=postgres - -if [ "$START" = true ]; then - echo "Configuring docker compose for apex-pdp scaled with ${REPLICAS} replicas..." - docker compose -f compose.pdp.scale.yml up -d apexpdp nginx grafana postgres -else - echo "Collecting logs..." - containers=$(docker compose -f compose.pdp.scale.yml ps --all --format '{{.Service}}') - - IFS=$'\n' read -d '' -r -a item_list <<< "$containers" - for item in "${item_list[@]}" - do - if [ -n "$item" ]; then - docker compose -f compose.pdp.scale.yml logs $item >> $item.log - fi - done - - echo "Stopping compose containers..." - docker compose -f compose.pdp.scale.yml down -v --remove-orphans -fi - -cd ${WORKSPACE} diff --git a/compose/stop-compose.sh b/compose/stop-compose.sh index 81c39816..3f7a2f01 100755 --- a/compose/stop-compose.sh +++ b/compose/stop-compose.sh @@ -24,32 +24,6 @@ if [ -z "${WORKSPACE}" ]; then export WORKSPACE fi -database=postgres - -while [[ $# -gt 0 ]] -do - key="$1" - - case $key in - --mariadb) - database=mariadb - shift - ;; - --postgres) - database=postgres - shift - ;; - *) - component="$1" - shift - ;; - esac -done - -if [ -z "$component" ]; then - export component=api -fi - COMPOSE_FOLDER="${WORKSPACE}"/compose cd ${COMPOSE_FOLDER} @@ -68,9 +42,6 @@ for item in "${item_list[@]}" do if [ -n "$item" ]; then docker compose logs $item >> $item.log - if [ "${DONT_PRINT_LOGS}" == "false" ]; then - cat $item.log - fi fi done diff --git a/csit/resources/tests/apex-pdp-test.robot b/csit/resources/tests/apex-pdp-test.robot index 0de2b908..bbd98d92 100644 --- a/csit/resources/tests/apex-pdp-test.robot +++ b/csit/resources/tests/apex-pdp-test.robot @@ -51,6 +51,7 @@ ExecuteApexTestPnfPolicyWithMetadataSet CreateNodeTemplate /policy/api/v1/nodetemplates 201 ${postjson} 1 DeployPolicy Wait Until Keyword Succeeds 2 min 5 sec QueryPolicyStatus ${policyName} defaultGroup apex ${pdpName} onap.policies.native.Apex + Sleep 5 seconds GetKafkaTopic apex-cl-mgt2 TriggerAndVerifyTestPnfPolicy apex-cl-mgt2 diff --git a/csit/resources/tests/apex-slas-10.robot b/csit/resources/tests/apex-slas-10.robot deleted file mode 100644 index 6803dcd2..00000000 --- a/csit/resources/tests/apex-slas-10.robot +++ /dev/null @@ -1,73 +0,0 @@ -*** Settings *** -Library Collections -Library RequestsLibrary -Library OperatingSystem -Library DateTime -Library Process -Library json -Resource common-library.robot -Resource apex-pdp-common.robot - -*** Test Cases *** -Healthcheck - [Documentation] Runs Apex PDP Health check - ${hcauth}= PolicyAdminAuth - ${resp}= PerformGetRequest ${APEX_IP} /policy/apex-pdp/v1/healthcheck 200 null ${hcauth} - Should Be Equal As Strings ${resp.json()['code']} 200 - Set Suite Variable ${pdpName} ${resp.json()['name']} - -ValidatePolicyExecutionAndEventRateLowComplexity - [Documentation] Validate that a moderate complexity policity can be executed in less than 100ms and minimum 100 events triggered per second - Set Test Variable ${policyName} onap.policies.apex.pnf.metadataSet.Test - ${postjson}= Get File ${CURDIR}/data/${policyName}.json - CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies ${postjson} ${policyName} 1.0.0 - ${postjson}= Get File ${CURDIR}/data/onap.pnf.metadataSet.Test.json - CreateNodeTemplate /policy/api/v1/nodetemplates 201 ${postjson} 1 - DeployPolicy - Wait Until Keyword Succeeds 2 min 5 sec QueryPolicyStatus ${policyName} defaultGroup apex ${pdpName} onap.policies.native.Apex - GetKafkaTopic apex-cl-mgt2 - ${data}= Get Binary File ${CURDIR}/data/VesEventForVnfPolicy.json - ${eventStartTime}= Get Current Date - ${resp}= Run Process ${CURDIR}/kafka_producer.py unauthenticated.dcae_policy_example_output ${data} ${KAFKA_IP} - ${eventEndTime}= Get Current Date - ValidateEventExecution ${eventStartTime} ${eventEndTime} 100 - -ValidatePolicyExecutionAndEventRateHighComplexity - [Documentation] Validate that a high complexity policity can be executed in less than 5000ms and minimum 2 events triggered per second - Set Test Variable ${policyName} onap.policies.native.apex.Sampledomain - ${postjson}= Get File ${CURDIR}/data/${policyName}.json - CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies ${postjson} ${policyName} 1.0.0 - DeployPolicy - Create Session apexSession http://${APEX_EVENTS_IP} max_retries=1 - ${data}= Get Binary File ${CURDIR}/data/event.json - &{headers}= Create Dictionary Content-Type=application/json Accept=application/json - Sleep 60s - ${eventStartTime}= Get Current Date - ${resp}= PUT On Session apexSession /apex/FirstConsumer/EventIn data=${data} headers=${headers} - ${eventEndTime}= Get Current Date - Should Be Equal As Strings ${resp.status_code} 200 - ValidateEventExecution ${eventStartTime} ${eventEndTime} 2 - -ValidatePolicyExecutionAndEventRateModerateComplexity - [Documentation] Validate that a low complexity policity can be executed in less than 1000ms and minimum 10 events triggered per second - Set Test Variable ${policyName} onap.policies.apex.pnf.Test - ${postjson}= Get File ${CURDIR}/data/${policyName}.json - CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies ${postjson} ${policyName} 1.0.0 - DeployPolicy - Wait Until Keyword Succeeds 2 min 5 sec QueryPolicyStatus ${policyName} defaultGroup apex ${pdpName} onap.policies.native.Apex - GetKafkaTopic apex-cl-mgt - ${data}= Get Binary File ${CURDIR}/data/VesEventForPnfPolicy.json - ${eventStartTime}= Get Current Date - ${resp}= Run Process ${CURDIR}/kafka_producer.py unauthenticated.dcae_cl_output ${data} ${KAFKA_IP} - ${eventEndTime}= Get Current Date - ValidateEventExecution ${eventStartTime} ${eventEndTime} 10 - -WaitForPrometheusServer - [Documentation] Sleep time to wait for Prometheus server to gather all metrics - Sleep 5 seconds - -ValidatePolicyExecutionTimes - [Documentation] Validate policy execution times using prometheus metrics - ValidatePolicyExecution pdpa_engine_average_execution_time_seconds{engine_instance_id="NSOApexEngine-0:0.0.1", instance="policy-apex-pdp:6969", job="apex-pdp-metrics"} 5000 - ValidatePolicyExecution pdpa_engine_average_execution_time_seconds{engine_instance_id="MyApexEngine-0:0.0.1"} 1000 - ValidatePolicyExecution pdpa_engine_average_execution_time_seconds{engine_instance_id="NSOApexEngine-1:0.0.1", instance="policy-apex-pdp:6969", job="apex-pdp-metrics"} 100 diff --git a/csit/resources/tests/apex-slas-3.robot b/csit/resources/tests/apex-slas-3.robot deleted file mode 100644 index 9c441e4e..00000000 --- a/csit/resources/tests/apex-slas-3.robot +++ /dev/null @@ -1,74 +0,0 @@ -*** Settings *** -Library Collections -Library RequestsLibrary -Library OperatingSystem -Library DateTime -Library Process -Library json -Resource common-library.robot -Resource apex-pdp-common.robot - -*** Test Cases *** -Healthcheck - [Documentation] Runs Apex PDP Health check - ${hcauth}= PolicyAdminAuth - ${resp}= PerformGetRequest ${APEX_IP} /policy/apex-pdp/v1/healthcheck 200 null ${hcauth} - Should Be Equal As Strings ${resp.json()['code']} 200 - Set Suite Variable ${pdpName} ${resp.json()['name']} - -ValidatePolicyExecutionAndEventRateLowComplexity - [Documentation] Validate that a moderate complexity policy can be executed in less than 100ms and minimum 30 events triggered per second - Set Test Variable ${policyName} onap.policies.apex.pnf.Test - ${postjson}= Get File ${CURDIR}/data/${policyName}.json - CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies ${postjson} ${policyName} 1.0.0 - DeployPolicy - Wait Until Keyword Succeeds 2 min 5 sec QueryPolicyStatus ${policyName} defaultGroup apex ${pdpName} onap.policies.native.Apex - GetKafkaTopic apex-cl-mgt - ${data}= Get Binary File ${CURDIR}/data/VesEventForPnfPolicy.json - ${eventStartTime}= Get Current Date - ${resp}= Run Process ${CURDIR}/kafka_producer.py unauthenticated.dcae_cl_output ${data} ${KAFKA_IP} - ${eventEndTime}= Get Current Date - ValidateEventExecution ${eventStartTime} ${eventEndTime} 30 - -ValidatePolicyExecutionAndEventRateHighComplexity - [Documentation] Validate that a high complexity policy can be executed in less than 5000ms and minimum 0.6 events triggered per second - Set Test Variable ${policyName} onap.policies.apex.pnf.metadataSet.Test - ${postjson}= Get File ${CURDIR}/data/${policyName}.json - CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies ${postjson} ${policyName} 1.0.0 - ${postjson}= Get File ${CURDIR}/data/onap.pnf.metadataSet.Test.json - CreateNodeTemplate /policy/api/v1/nodetemplates 201 ${postjson} 1 - DeployPolicy - Wait Until Keyword Succeeds 2 min 5 sec QueryPolicyStatus ${policyName} defaultGroup apex ${pdpName} onap.policies.native.Apex - GetKafkaTopic apex-cl-mgt2 - ${data}= Get Binary File ${CURDIR}/data/VesEventForVnfPolicy.json - ${eventStartTime}= Get Current Date - ${resp}= Run Process ${CURDIR}/kafka_producer.py unauthenticated.dcae_policy_example_output ${data} ${KAFKA_IP} - ${eventEndTime}= Get Current Date - ValidateEventExecution ${eventStartTime} ${eventEndTime} 0.6 - -ValidatePolicyExecutionAndEventRateModerateComplexity - [Documentation] Validate that a low complexity policy can be executed in less than 1000ms and minimum 3 events triggered per second - Set Test Variable ${policyName} onap.policies.native.apex.Sampledomain - ${postjson}= Get File ${CURDIR}/data/${policyName}.json - CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies ${postjson} ${policyName} 1.0.0 - DeployPolicy - #Wait Until Keyword Succeeds 4 min 5 sec RunEventOnApexEngine - Create Session apexSession http://${APEX_EVENTS_IP} max_retries=1 - ${data}= Get Binary File ${CURDIR}/data/event.json - &{headers}= Create Dictionary Content-Type=application/json Accept=application/json - Sleep 60s - ${eventStartTime}= Get Current Date - ${resp}= PUT On Session apexSession /apex/FirstConsumer/EventIn data=${data} headers=${headers} - Should Be Equal As Strings ${resp.status_code} 200 - ${eventEndTime}= Get Current Date - ValidateEventExecution ${eventStartTime} ${eventEndTime} 3 - -WaitForPrometheusServer - [Documentation] Sleep time to wait for Prometheus server to gather all metrics - Sleep 5 seconds - -ValidatePolicyExecutionTimes - [Documentation] Validate policy execution times using prometheus metrics - ValidatePolicyExecution pdpa_engine_average_execution_time_seconds{engine_instance_id="NSOApexEngine-0:0.0.1", instance="policy-apex-pdp:6969", job="apex-pdp-metrics"} 5000 - ValidatePolicyExecution pdpa_engine_average_execution_time_seconds{engine_instance_id="MyApexEngine-0:0.0.1"} 1000 - ValidatePolicyExecution pdpa_engine_average_execution_time_seconds{engine_instance_id="NSOApexEngine-1:0.0.1", instance="policy-apex-pdp:6969", job="apex-pdp-metrics"} 100 diff --git a/csit/run-project-csit.sh b/csit/run-project-csit.sh index 5ddc1953..64f91eea 100755 --- a/csit/run-project-csit.sh +++ b/csit/run-project-csit.sh @@ -28,15 +28,7 @@ function on_exit(){ rm -rf "${CSAR_DIR}"/csar_temp.csar if [ "${DO_NOT_TEARDOWN}" = false ]; then - # teardown of compose containers for acm-replicas doesn't work with normal stop-compose script - if [ "${ACM_REPLICA_TEARDOWN}" = true ]; then - source "${DOCKER_COMPOSE_DIR}"/start-acm-replica.sh --stop --replicas=2 - elif [ "${APEX_REPLICA_TEARDOWN}" = true ]; then - source "${DOCKER_COMPOSE_DIR}"/start-multiple-pdp.sh --stop --replicas=2 - else - source "${DOCKER_COMPOSE_DIR}"/stop-compose.sh "${PROJECT}" - fi - + source "${DOCKER_COMPOSE_DIR}"/stop-compose.sh "${PROJECT}" mv "${DOCKER_COMPOSE_DIR}"/*.log "${ROBOT_LOG_DIR}" fi @@ -95,38 +87,20 @@ function check_rest_endpoint() { fi } -function export_clamp_variables() { +function setup_clamp() { export ROBOT_FILES="clamp-health-check.robot clamp-db-restore.robot clamp-single-element-test.robot clamp-timeout-test.robot clamp-migrate-rollback.robot clamp-trace-test.robot clamp-slas.robot" export TEST_ENV="docker" export PROJECT="clamp" - export SCHEMAS_TO_BE_CREATED="policyadmin" -} - -function setup_clamp() { - export_clamp_variables - export ACM_REPLICA_TEARDOWN=true - source "${DOCKER_COMPOSE_DIR}"/start-acm-replica.sh --start --replicas=2 --grafana - echo "Waiting 2 minutes for the replicas to be started..." - sleep 120 - # checking on apex-pdp status because acm-r replicas only start after apex-pdp is running - check_rest_endpoint "${PAP_PORT}" - check_rest_endpoint "${APEX_PORT}" - apex_healthcheck - check_rest_endpoint "${ACM_PORT}" -} - -function setup_clamp_simple() { - export_clamp_variables source "${DOCKER_COMPOSE_DIR}"/start-compose.sh policy-clamp-runtime-acm --grafana - echo "Waiting 2 minutes acm-runtime and participants to start..." + echo "Waiting 2 minutes for the replicas to be started..." sleep 120 check_rest_endpoint "${ACM_PORT}" } function setup_api() { export ROBOT_FILES="api-test.robot api-slas.robot" - source "${DOCKER_COMPOSE_DIR}"/start-compose.sh api --grafana + source "${DOCKER_COMPOSE_DIR}"/start-compose.sh policy-api --grafana echo "Waiting 1 minute for policy-api to start..." sleep 60 check_rest_endpoint "${API_PORT}" @@ -135,7 +109,7 @@ function setup_api() { function setup_pap() { export ROBOT_FILES="pap-test.robot pap-slas.robot" export PROJECT="pap" - source "${DOCKER_COMPOSE_DIR}"/start-compose.sh apex-pdp --grafana + source "${DOCKER_COMPOSE_DIR}"/start-compose.sh policy-apex-pdp --grafana echo "Waiting 1 minute for policy-pap to start..." sleep 60 check_rest_endpoint "${PAP_PORT}" @@ -145,7 +119,8 @@ function setup_pap() { function setup_apex() { export ROBOT_FILES="apex-pdp-test.robot apex-slas.robot" - source "${DOCKER_COMPOSE_DIR}"/start-compose.sh apex-pdp --grafana + export PROJECT="apex-pdp" + source "${DOCKER_COMPOSE_DIR}"/start-compose.sh policy-apex-pdp --grafana echo "Waiting 1 minute for apex-pdp to start..." sleep 60 check_rest_endpoint "${PAP_PORT}" @@ -153,31 +128,12 @@ function setup_apex() { apex_healthcheck } -function setup_apex_medium() { - export ROBOT_FILES="apex-slas-3.robot" - export APEX_REPLICA_TEARDOWN=true - source "${DOCKER_COMPOSE_DIR}"/start-multiple-pdp.sh --start --replicas=3 - echo "Waiting 1 minute for apex-pdp to start..." - sleep 60 - check_rest_endpoint "${PAP_PORT}" - check_rest_endpoint "${APEX_PORT}" - apex_healthcheck -} -function setup_apex_large() { - export ROBOT_FILES="apex-slas-10.robot" - export APEX_REPLICA_TEARDOWN=true - source "${DOCKER_COMPOSE_DIR}"/start-multiple-pdp.sh --start --replicas=10 - echo "Waiting 1 minute for apex-pdp to start..." - sleep 60 - check_rest_endpoint "${PAP_PORT}" - check_rest_endpoint "${APEX_PORT}" - apex_healthcheck -} function setup_drools_apps() { export ROBOT_FILES="drools-applications-test.robot drools-applications-slas.robot" - source "${DOCKER_COMPOSE_DIR}"/start-compose.sh drools-applications --grafana + export PROJECT="drools-applications" + source "${DOCKER_COMPOSE_DIR}"/start-compose.sh policy-drools-apps --grafana echo "Waiting 1 minute for drools-pdp and drools-applications to start..." sleep 80 check_rest_endpoint "${PAP_PORT}" @@ -188,7 +144,7 @@ function setup_drools_apps() { function setup_xacml_pdp() { export ROBOT_FILES="xacml-pdp-test.robot xacml-pdp-slas.robot" - source "${DOCKER_COMPOSE_DIR}"/start-compose.sh xacml-pdp --grafana + source "${DOCKER_COMPOSE_DIR}"/start-compose.sh policy-xacml-pdp --grafana echo "Waiting 1 minute for xacml-pdp to start..." sleep 60 check_rest_endpoint "${XACML_PORT}" @@ -197,7 +153,7 @@ function setup_xacml_pdp() { function setup_opa_pdp() { export ROBOT_FILES="opa-pdp-test.robot opa-pdp-slas.robot" export PROJECT="opa-pdp" - source "${DOCKER_COMPOSE_DIR}"/start-compose.sh opa-pdp --grafana + source "${DOCKER_COMPOSE_DIR}"/start-compose.sh policy-opa-pdp --grafana echo "Waiting 3 minutes for OPA-PDP to start..." sleep 180 check_rest_endpoint "${PAP_PORT}" @@ -206,21 +162,22 @@ function setup_opa_pdp() { function setup_drools_pdp() { export ROBOT_FILES="drools-pdp-test.robot" - source "${DOCKER_COMPOSE_DIR}"/start-compose.sh drools-pdp --grafana + source "${DOCKER_COMPOSE_DIR}"/start-compose.sh policy-drools-pdp --grafana echo "Waiting 1 minute for drools-pdp to start..." sleep 60 check_rest_endpoint "${DROOLS_TELEMETRY_PORT}" } function setup_distribution() { + # Prepare CSAR file for distribution test zip -F "${CSAR_DIR}"/sample_csar_with_apex_policy.csar --out "${CSAR_DIR}"/csar_temp.csar -q - # Remake temp directory - sudo rm -rf /tmp/distribution + # Create clean directory for CSAR files (mounted into policy-distribution container) + rm -rf /tmp/distribution mkdir /tmp/distribution export ROBOT_FILES="distribution-test.robot" - source "${DOCKER_COMPOSE_DIR}"/start-compose.sh distribution --grafana + source "${DOCKER_COMPOSE_DIR}"/start-compose.sh policy-distribution --grafana echo "Waiting 1 minute for distribution to start..." sleep 60 check_rest_endpoint "${DIST_PORT}" @@ -243,11 +200,13 @@ function set_project_config() { case $PROJECT in clamp | policy-clamp) + export ACM_REPLICAS=2 setup_clamp ;; clamp-simple | policy-simple) - setup_clamp_simple + export ACM_REPLICAS=1 + setup_clamp ;; api | policy-api) @@ -262,14 +221,6 @@ function set_project_config() { setup_apex ;; - apex-pdp-medium | policy-apex-pdp-medium) - setup_apex_medium - ;; - - apex-pdp-large | policy-apex-pdp-large) - setup_apex_large - ;; - xacml-pdp | policy-xacml-pdp) setup_xacml_pdp ;; @@ -347,14 +298,11 @@ export SCRIPTS="${WORKSPACE}/csit/resources/scripts" export CSAR_DIR="${WORKSPACE}/csit/resources/tests/data/csar" export DOCKER_COMPOSE_DIR="${WORKSPACE}/compose" export ROBOT_FILES="" -export ACM_REPLICA_TEARDOWN=false -export APEX_REPLICA_TEARDOWN=false -export SCHEMAS_TO_BE_CREATED="policyadmin operationshistory pooling" cd "${WORKSPACE}" || exit # recreate the log folder with test results -sudo rm -rf "${ROBOT_LOG_DIR}" +rm -rf "${ROBOT_LOG_DIR}" mkdir -p "${ROBOT_LOG_DIR}" # log into nexus docker -- 2.16.6