diff options
180 files changed, 8726 insertions, 5499 deletions
@@ -31,11 +31,6 @@ repositories: - 'policy/docker' committers: - <<: *onap_releng_ptl - - name: 'Pamela Dragosh' - email: 'pd1248@att.com' - company: 'ATT' - id: 'pdragosh' - timezone: 'America/New_York' - name: 'Jorge Hernandez' email: 'jorge.hernandez-herrero@att.com' company: 'ATT' @@ -46,6 +41,11 @@ committers: company: 'Bell Canada' id: 'ramverma' timezone: 'America/Montreal' + - name: 'Liam Fallon' + email: 'liam.fallon@est.tech' + id: 'liamfallon' + company: 'Ericsson' + timezone: 'Europe/Ireland' - name: 'Ramesh Murugan Iyer' email: 'ramesh.murugan.iyer@est.tech' company: 'Ericsson' @@ -89,3 +89,7 @@ tsc: - type: 'Addition' name: 'Adheli Tavares' link: https://lists.onap.org/g/onap-tsc/message/9296 + #Stepped Down + - type: 'Removal' + name: 'Pamela Dragosh' + link: https://lists.onap.org/g/onap-tsc/message/9550 diff --git a/compose/README.md b/compose/README.md index ada34e1c..290bdf4e 100644 --- a/compose/README.md +++ b/compose/README.md @@ -4,7 +4,7 @@ The PF docker compose starts a small instance of docker containers for PF compon ## Features -- Starts all components, including Prometheus/Grafana dashboard and GUI (ACM and Apex) +- Starts all components, including Prometheus/Grafana dashboard - Can start specific components - Expose fixed ports so all the REST endpoints can be called with localhost:component_port @@ -21,17 +21,11 @@ Things to be installed beforehand: Assuming the docker repository has been cloned and workdir is ../docker/compose -- Install all PF components (excluding GUI) +- Install all PF components ```sh ./start-compose.sh ``` -- Install all PF components + GUI - -```sh -./start-compose.sh --gui -``` - - Install an specific PF component (accepted options: api pap apex-pdp distribution drools-pdp drools-apps xacml-pdp policy-clamp-runtime-acm) @@ -56,11 +50,13 @@ policy-clamp-runtime-acm) ./start-compose.sh apex-pdp --grafana ``` -## Docker image localization +## Docker image download localization The docker images are always downloaded from nexus repository, but if needed to build a local -image, edit the ``export-ports.sh`` script and change the variable ``CONTAINER_LOCATION`` -to be empty. +image, edit the ``get-versions.sh`` script and change the variable ``LOCAL_IMAGES`` +to `true` or edit the image tag in the docker compose file. +Changing the variable to `true` will ensure that the newly built images locally are being used +by not requesting a download from nexus and using the image tagged as latest. ## Docker image versions @@ -71,10 +67,10 @@ Note: if latest Policy-API docker image is 2.8-SNAPSHOT-latest, but on nexus it 2 days ago and in local environment it's 3 months old - it will use the 3 months old image, so it's recommended to keep an eye on it. -If needed, the version can be edited on docker-compose.yml and docker-compose.gui.yml +If needed, the version can be edited on any docker compose yml file. i.e: need to change db-migrator version -from docker-compose.yml: +from compose.{database}.yml: ``image: ${CONTAINER_LOCATION}onap/policy-db-migrator:${POLICY_DOCKER_VERSION}`` replace the ${POLICY_DOCKER_VERSION} for the specific version needed @@ -82,19 +78,42 @@ replace the ${POLICY_DOCKER_VERSION} for the specific version needed ## Logs -To collect the docker-compose logs, simply run the following: +Use ``docker compose logs`` or `docker logs ${container_name}` instructions on how to collect logs. + +## Uninstall + +Simply run the ``stop-compose.sh`` script. This will also generate logs from the services started with compose. ```sh -./start-compose.sh logs +./stop-compose.sh ``` -Note: these are logs for installation only, not actual application usage -It will generate a ``docker-compose.log`` file with the result. +## Database support -## Uninstall +From Oslo version onwards, this docker compose setup uses Postgres database as default; MariaDB is still available, +but support might be limited. -Simply run the ``stop-compose.sh`` script. +To start docker compose with MariaDB, add a flag to use it: ```sh -./stop-compose.sh +# that will start apex-pdp and its dependencies (pap, api, mariadb, simulator) +./start-compose.sh apex-pdp --mariadb +# that will start apex-pdp and its dependencies (pap, api, postgres, simulator) +./start-compose.sh apex-pdp ``` + +### Docker compose files + +To make it easier and clear how the docker compose system works, there are three files describing the services +- compose.common.yml + - Has policy services that don't connect directly to database: apex-pdp and distribution + - Simulator service + - ACM-R Participants that don't connect directly to database. + - Messaging services (kafka, zookeeper) + - Metrics services (prometheus, grafana, jaeger) +- compose.postgres.yml + - All policy services that connect directly to database with Postgres configurations + - Postgres database and policy-db-migrator working towards it +- compose.mariadb.yml + - All policy services that connect directly to database with MariaDB configurations + - MariaDB database and policy-db-migrator working towards it diff --git a/compose/compose.acm.scale.yml b/compose/compose.acm.scale.yml new file mode 100644 index 00000000..ee6679b2 --- /dev/null +++ b/compose/compose.acm.scale.yml @@ -0,0 +1,211 @@ +# +# ===========LICENSE_START==================================================== +# Copyright (C) 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/clamp/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' + ] + + 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 + - kafka + - pap + ports: + - ${APEX_PORT}:6969 + - ${APEX_EVENTS_PORT}:23324 + 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' + ] + + 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-http-ppnt-replica + - policy-clamp-ac-k8s-ppnt-replica + - policy-clamp-ac-pf-ppnt-replica + - policy-clamp-ac-sim-ppnt + expose: + - 6969 + deploy: + mode: replicated + replicas: ${REPLICAS:-2} + environment: + 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 + # Tracing can be configured for grpc or http - default is http + #OTEL_EXPORTER_OTLP_PROTOCOL: grpc + #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 + - ./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 + entrypoint: /opt/app/policy/bin/wait_for_port.sh + command: [ + '-c', './acm-runtime.sh', + 'apex-pdp', '6969', + 'kafka', '9092', + 'policy-clamp-ac-http-ppnt', '6969', + 'policy-clamp-ac-k8s-ppnt', '6969', + 'policy-clamp-ac-pf-ppnt', '6969', + 'policy-clamp-ac-sim-ppnt', '6969' + ] + 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: + 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 + volumes: + - ./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 + entrypoint: /opt/app/policy/bin/wait_for_port.sh + command: [ + '-c', './http-participant.sh', + 'kafka', '9092' + ] + 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: + 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 + expose: + - 6969 + deploy: + mode: replicated + replicas: ${REPLICAS:-2} + volumes: + - ./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 + entrypoint: /opt/app/policy/bin/wait_for_port.sh + command: [ + '-c', './kubernetes-participant.sh', + 'kafka', '9092' + ] + 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: + 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 + volumes: + - ./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 + entrypoint: /opt/app/policy/bin/wait_for_port.sh + command: [ + '-c', './policy-participant.sh', + 'kafka', '9092' + ] + 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 new file mode 100644 index 00000000..47212adb --- /dev/null +++ b/compose/compose.common.yml @@ -0,0 +1,143 @@ +# +# ===========LICENSE_START==================================================== +# Copyright (C) 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===================================================== +# + +services: + + simulator: + image: ${CONTAINER_LOCATION}onap/policy-models-simulator:${POLICY_MODELS_VERSION} + container_name: simulator + hostname: simulator + networks: + default: + aliases: + - aai-sim + - grpc-sim + - sdnc-sim + - so-sim + - vfc-sim + volumes: + - ./config/sim-all:/opt/app/policy/simulators/etc/mounted:ro + - ./config/sim-all/logback.xml:/opt/app/policy/simulators/etc/mounted/logback.xml:ro + expose: + - 6666 + - 6668 + - 6669 + - 6670 + - 6680 + ports: + - ${SIMULATOR_PORT}:6666 + + policy-clamp-ac-sim-ppnt: + 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: + - kafka + - jaeger + environment: + OTEL_SERVICE_NAME: sim-ppnt + 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} + ports: + - ${SIM_PARTICIPANT_PORT}:6969 + volumes: + - ./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 + entrypoint: /opt/app/policy/bin/wait_for_port.sh + command: [ + '-c', './sim-participant.sh', + 'kafka', '9092' + ] + +# metrics services: + prometheus: + image: nexus3.onap.org:10001/prom/prometheus:latest + container_name: prometheus + hostname: prometheus + ports: + - ${PROMETHEUS_PORT}:9090 + volumes: + - ./metrics/prometheus.yml:/etc/prometheus/prometheus.yml + + grafana: + image: nexus3.onap.org:10001/grafana/grafana:latest + container_name: grafana + hostname: grafana + depends_on: + - prometheus + ports: + - ${GRAFANA_PORT}:3000 + volumes: + - ./metrics/dashboard.yaml:/etc/grafana/provisioning/dashboards/dashboard.yaml + - ./metrics/datasource.yaml:/etc/grafana/provisioning/datasources/datasource.yaml + - ./metrics/dashboards:/var/lib/grafana/dashboards + +# messaging services: + zookeeper: + image: confluentinc/cp-zookeeper:latest + container_name: zookeeper + hostname: zookeeper + ports: + - "2181:2181" + environment: + ZOOKEEPER_CLIENT_PORT: 2181 + + kafka: + image: confluentinc/cp-kafka:latest + container_name: kafka + hostname: kafka + depends_on: + - zookeeper + ports: + - "9092:9092" + - "29092:29092" + environment: + KAFKA_BROKER_ID: 1 + KAFKA_ZOOKEEPER_CONNECT: "zookeeper:2181" + KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT + KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092,PLAINTEXT_HOST://localhost:29092 + KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT + KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 + KAFKA_ADVERTISED_HOST_NAME: kafka + + jaeger: + image: jaegertracing/all-in-one:1.58 + container_name: jaeger + ports: + - "4318:4318" + - "4317:4317" + - "14250:14250" + - "16686:16686" + environment: + - COLLECTOR_OTLP_ENABLED=true + +# integration tests: + csit-tests: + image: onap/policy-csit-robot:latest + container_name: policy-csit + hostname: policy-csit + volumes: + - ${ROBOT_LOG_DIR:-/tmp}:/tmp/results + - /tmp/distribution:/tmp/distribution + environment: + ROBOT_FILE: ${ROBOT_FILES:-none} + TEST_ENV: ${TEST_ENV:-docker} diff --git a/compose/compose.mariadb.yml b/compose/compose.mariadb.yml new file mode 100644 index 00000000..2dbae99f --- /dev/null +++ b/compose/compose.mariadb.yml @@ -0,0 +1,54 @@ +# +# ===========LICENSE_START==================================================== +# Copyright (C) 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===================================================== +# + +# Services running against mariadb + +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', '--default-authentication-plugin=mysql_native_password' ] + env_file: config/db/db.conf + volumes: + - ./config/db:/docker-entrypoint-initdb.d:ro + ports: + - "3306:3306" + + policy-db-migrator: + image: ${CONTAINER_LOCATION}onap/policy-db-migrator:${POLICY_DOCKER_VERSION} + container_name: policy-db-migrator + hostname: policy-db-migrator + depends_on: + - mariadb + expose: + - 6824 + env_file: config/db/db.conf + environment: + SQL_DB: policyadmin clampacm pooling operationshistory + SQL_HOST: mariadb + volumes: + - ./config/db-migrator/init.sh:/opt/app/policy/bin/db_migrator_policy_init.sh: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/bin/db_migrator_policy_init.sh', + 'mariadb', '3306' + ] diff --git a/compose/docker-compose.pdp.scale.yml b/compose/compose.pdp.scale.yml index a10264a5..b4b199f7 100644 --- a/compose/docker-compose.pdp.scale.yml +++ b/compose/compose.pdp.scale.yml @@ -16,21 +16,63 @@ # ============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: - - mariadb - simulator - kafka - pap - hostname: policy-apex-pdp expose: - 6969 - 23324 deploy: mode: replicated - replicas: ${REPLICAS} + 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 @@ -38,7 +80,6 @@ services: 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', - 'mariadb', '3306', 'kafka', '9092', 'pap', '6969' ] @@ -50,25 +91,4 @@ services: - apexpdp ports: - ${APEX_PORT}:${APEX_PORT} - zookeeper: - image: confluentinc/cp-zookeeper:latest - environment: - ZOOKEEPER_CLIENT_PORT: 2181 - ZOOKEEPER_TICK_TIME: 2000 - ports: - - 2181:2181 - kafka: - image: confluentinc/cp-kafka:latest - container_name: kafka - depends_on: - - zookeeper - ports: - - 29092:29092 - - 9092:9092 - environment: - KAFKA_BROKER_ID: 1 - KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 - KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092,PLAINTEXT_HOST://localhost:29092 - KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT - KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT - KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 + - ${APEX_EVENTS_PORT}:${APEX_EVENTS_PORT} diff --git a/compose/compose.postgres.yml b/compose/compose.postgres.yml new file mode 100644 index 00000000..50403236 --- /dev/null +++ b/compose/compose.postgres.yml @@ -0,0 +1,56 @@ +# +# ===========LICENSE_START==================================================== +# Copyright (C) 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===================================================== +# + +# Services running against postgres database + +services: + postgres: + image: nexus3.onap.org:10001/library/postgres:${POLICY_POSTGRES_VER} + container_name: postgres + hostname: postgres + command: [ '--idle_in_transaction_session_timeout=28800' ] + env_file: config/db-pg/db-pg.conf + volumes: + - ./config/db-pg:/docker-entrypoint-initdb.d:ro + expose: + - 5432 + ports: + - "5432:5432" + + policy-db-migrator: + image: ${CONTAINER_LOCATION}onap/policy-db-migrator:${POLICY_DOCKER_VERSION} + container_name: policy-db-migrator + hostname: policy-db-migrator + depends_on: + - postgres + expose: + - 6824 + env_file: config/db-pg/db-pg.conf + environment: + POSTGRES_PASSWORD: policy_user + SQL_DB: policyadmin clampacm pooling operationshistory + SQL_HOST: postgres + volumes: + - ./config/db-migrator/init_pg.sh:/opt/app/policy/bin/db_migrator_policy_init_pg.sh: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/bin/db_migrator_policy_init_pg.sh', + 'postgres', '5432' + ] diff --git a/compose/docker-compose.yml b/compose/compose.yaml index d5a2cc78..a151ad42 100644 --- a/compose/docker-compose.yml +++ b/compose/compose.yaml @@ -18,83 +18,12 @@ # ============LICENSE_END===================================================== # +include: + - compose.common.yml + - compose.${database:-postgres}.yml + 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', '--default-authentication-plugin=mysql_native_password' ] - env_file: ./config/db/db.conf - volumes: - - ./config/db:/docker-entrypoint-initdb.d:ro - - ./config/clamp/policy-clamp-create-tables.sql:/tmp/policy-clamp-create-tables.sql - ports: - - "3306:3306" - policy-db-migrator: - image: ${CONTAINER_LOCATION}onap/policy-db-migrator:${POLICY_DOCKER_VERSION} - 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/init.sh:/opt/app/policy/bin/db_migrator_policy_init.sh: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/bin/db_migrator_policy_init.sh', - 'mariadb', '3306' - ] - policy-db-migrator-clamp: - image: ${CONTAINER_LOCATION}onap/policy-db-migrator:${POLICY_DOCKER_VERSION} - container_name: policy-db-migrator-clamp - hostname: policy-db-migrator-clamp - depends_on: - - mariadb - expose: - - 6824 - env_file: ./config/db/db.conf - environment: - SQL_DB: clampacm - SQL_HOST: mariadb - volumes: - - ./config/db-migrator/init.sh:/opt/app/policy/bin/db_migrator_policy_init.sh: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/bin/db_migrator_policy_init.sh', - 'mariadb', '3306' - ] - simulator: - image: ${CONTAINER_LOCATION}onap/policy-models-simulator:${POLICY_MODELS_VERSION} - container_name: simulator - hostname: simulator - networks: - default: - aliases: - - aai-sim - - grpc-sim - - sdnc-sim - - so-sim - - vfc-sim - volumes: - - ./config/sim-all:/opt/app/policy/simulators/etc/mounted:ro - - ./config/sim-all/logback.xml:/opt/app/policy/simulators/etc/mounted/logback.xml:ro - expose: - - 6666 - - 6668 - - 6669 - - 6670 - - 6680 - ports: - - ${SIMULATOR_PORT}:6666 + api: image: ${CONTAINER_LOCATION}onap/policy-api:${POLICY_API_VERSION} container_name: policy-api @@ -103,6 +32,8 @@ services: - policy-db-migrator ports: - ${API_PORT}:6969 + environment: + SPRING_PROFILES_ACTIVE: ${API_PROFILE:-default} 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 @@ -110,61 +41,102 @@ services: entrypoint: ./wait_for_port.sh command: [ '-c', './policy-api.sh', - 'mariadb', '3306', 'policy-db-migrator', '6824' ] + pap: image: ${CONTAINER_LOCATION}onap/policy-pap:${POLICY_PAP_VERSION} container_name: policy-pap hostname: policy-pap depends_on: - - mariadb - - kafka - api + - kafka ports: - ${PAP_PORT}:6969 + environment: + SPRING_PROFILES_ACTIVE: ${PAP_PROFILE:-default} volumes: - ./config/pap/papParameters.yaml:/opt/app/policy/pap/etc/papParameters.yaml:ro - - ./config/${PROJECT}/groups.json:/opt/app/policy/pap/etc/mounted/groups.json:ro + - ./config/${PROJECT:-api}/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', - 'mariadb', '3306', + 'api', '6969', + 'kafka', '9092' + ] + + 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 + - kafka + - pap + ports: + - ${APEX_PORT}:6969 + - ${APEX_EVENTS_PORT}:23324 + 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', - 'api', '6969' + 'pap', '6969' ] + + distribution: + image: ${CONTAINER_LOCATION}onap/policy-distribution:${POLICY_DISTRIBUTION_VERSION} + container_name: policy-distribution + hostname: policy-distribution + depends_on: + - apex-pdp + ports: + - ${DIST_PORT}:6969 + volumes: + - ./config/distribution/defaultConfig.json:/opt/app/policy/distribution/etc/defaultConfig.json:ro + - /tmp/distribution/:/opt/app/policy/distribution/etc/temp/:ro + - ./config/distribution/logback.xml:/opt/app/policy/distribution/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', './policy-dist.sh', + 'apex-pdp', '6969' + ] + xacml-pdp: image: ${CONTAINER_LOCATION}onap/policy-xacml-pdp:${POLICY_XACML_PDP_VERSION} container_name: policy-xacml-pdp hostname: policy-xacml-pdp depends_on: - - mariadb - - kafka - pap + - kafka ports: - ${XACML_PORT}:6969 - "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 - ./wait_for_port.sh:/opt/app/policy/pdpx/bin/wait_for_port.sh:ro entrypoint: ./wait_for_port.sh command: [ '-c', './policy-pdpx.sh', - 'mariadb', '3306', - 'kafka', '9092', - 'pap', '6969' + 'pap', '6969', + 'kafka', '9092' ] + drools-pdp: image: ${CONTAINER_LOCATION}onap/policy-drools:${POLICY_DROOLS_PDP_VERSION} container_name: policy-drools-pdp hostname: policy-drools-pdp depends_on: - - mariadb - - kafka - pap + - kafka ports: - ${DROOLS_PORT}:6969 - ${DROOLS_TELEMETRY_PORT}:9696 @@ -172,23 +144,23 @@ 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.conf + - config/drools-pdp/env/base-${database:-postgres}.conf entrypoint: /opt/app/policy/bin/wait_for_port.sh command: [ '-c', '/opt/app/policy/bin/pdpd-entrypoint.sh boot', - 'mariadb', '3306', + 'pap', '6969', 'kafka', '9092' ] + drools-applications: image: ${CONTAINER_LOCATION}onap/policy-pdpd-cl:${POLICY_DROOLS_APPS_VERSION} container_name: policy-drools-apps hostname: policy-drools-apps depends_on: - - mariadb - - simulator - - kafka - pap - xacml-pdp + - simulator + - kafka ports: - ${DROOLS_APPS_PORT}:6969 - ${DROOLS_APPS_TELEMETRY_PORT}:9696 @@ -196,80 +168,32 @@ 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.conf - - ./config/drools-applications/env/feature-healthcheck.conf - - ./config/drools-applications/env/feature-pooling-messages.conf + - config/drools-applications/env/base-${database:-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', - 'mariadb', '3306', - 'kafka', '9092', 'pap', '6969', + 'kafka', '9092', 'aai-sim', '6666', 'sdnc-sim', '6668', 'so-sim', '6669', 'vfc-sim', '6670' ] - apex-pdp: - image: ${CONTAINER_LOCATION}onap/policy-apex-pdp:${POLICY_APEX_PDP_VERSION} - container_name: policy-apex-pdp - hostname: policy-apex-pdp - depends_on: - - mariadb - - simulator - - kafka - - pap - ports: - - ${APEX_PORT}:6969 - - ${APEX_EVENTS_PORT}:23324 - 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', - 'mariadb', '3306', - 'kafka', '9092', - 'pap', '6969' - ] - distribution: - image: ${CONTAINER_LOCATION}onap/policy-distribution:${POLICY_DISTRIBUTION_VERSION} - container_name: policy-distribution - hostname: policy-distribution - depends_on: - - mariadb - - api - - pap - - apex-pdp - ports: - - ${DIST_PORT}:6969 - volumes: - - ./config/distribution/defaultConfig.json:/opt/app/policy/distribution/etc/defaultConfig.json:ro - - /tmp/distribution/:/opt/app/policy/distribution/etc/temp/:ro - - ./config/distribution/logback.xml:/opt/app/policy/distribution/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', './policy-dist.sh', - 'mariadb', '3306', - 'kafka', '9092', - 'pap', '6969', - 'apex-pdp', '6969' - ] + 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: - - policy-db-migrator-clamp + - apex-pdp - kafka - jaeger - policy-clamp-ac-http-ppnt - policy-clamp-ac-k8s-ppnt - policy-clamp-ac-pf-ppnt - policy-clamp-ac-sim-ppnt - - apex-pdp ports: - ${ACM_PORT}:6969 environment: @@ -277,6 +201,7 @@ services: OTEL_EXPORTER_OTLP_PROTOCOL: http/protobuf OTEL_EXPORTER_OTLP_TRACES_PROTOCOL: http/protobuf OTEL_EXPORTER_OTLP_ENDPOINT: http://jaeger:4318 + SPRING_PROFILES_ACTIVE: ${CLAMP_PROFILE:-default} # Tracing can be configured for grpc or http - default is http #OTEL_EXPORTER_OTLP_PROTOCOL: grpc #OTEL_EXPORTER_OTLP_TRACES_PROTOCOL: grpc @@ -289,12 +214,11 @@ services: entrypoint: /opt/app/policy/bin/wait_for_port.sh command: [ '-c', './acm-runtime.sh', - 'mariadb', '3306', + 'apex-pdp', '6969', 'kafka', '9092', 'policy-clamp-ac-http-ppnt', '6969', 'policy-clamp-ac-k8s-ppnt', '6969', - 'policy-clamp-ac-pf-ppnt', '6969', - 'apex-pdp', '6969' + 'policy-clamp-ac-pf-ppnt', '6969' ] policy-clamp-ac-http-ppnt: @@ -311,6 +235,7 @@ services: 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} volumes: - ./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 @@ -321,6 +246,7 @@ services: '-c', './http-participant.sh', 'kafka', '9092' ] + 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 @@ -333,6 +259,7 @@ services: 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} ports: - "30295:6969" volumes: @@ -345,6 +272,7 @@ services: '-c', './kubernetes-participant.sh', 'kafka', '9092' ] + 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 @@ -360,6 +288,7 @@ services: 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} volumes: - ./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 @@ -371,6 +300,7 @@ services: 'kafka', '9092', 'api', '6969' ] + 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 @@ -395,6 +325,7 @@ services: '-c', './a1pms-participant.sh', 'kafka', '9092' ] + 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 @@ -419,93 +350,3 @@ services: '-c', './kserve-participant.sh', 'kafka', '9092' ] - policy-clamp-ac-sim-ppnt: - image: ${CONTAINER_LOCATION}onap/policy-clamp-ac-sim-ppnt:${POLICY_CLAMP_VERSION} - container_name: policy-clamp-ac-sim-ppnt - hostname: policy-clamp-ac-sim-ppnt - depends_on: - - kafka - - jaeger - environment: - OTEL_SERVICE_NAME: sim-ppnt - OTEL_EXPORTER_OTLP_PROTOCOL: http/protobuf - OTEL_EXPORTER_OTLP_TRACES_PROTOCOL: http/protobuf - OTEL_EXPORTER_OTLP_ENDPOINT: http://jaeger:4318 - ports: - - ${SIM_PARTICIPANT_PORT}:6969 - volumes: - - ./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 - entrypoint: /opt/app/policy/bin/wait_for_port.sh - command: [ - '-c', './sim-participant.sh', - 'kafka', '9092' - ] - prometheus: - image: nexus3.onap.org:10001/prom/prometheus:latest - container_name: prometheus - hostname: prometheus - ports: - - ${PROMETHEUS_PORT}:9090 - volumes: - - ./metrics/prometheus.yml:/etc/prometheus/prometheus.yml - grafana: - image: nexus3.onap.org:10001/grafana/grafana:latest - container_name: grafana - hostname: grafana - depends_on: - - prometheus - ports: - - ${GRAFANA_PORT}:3000 - volumes: - - ./metrics/dashboard.yaml:/etc/grafana/provisioning/dashboards/dashboard.yaml - - ./metrics/datasource.yaml:/etc/grafana/provisioning/datasources/datasource.yaml - - ./metrics/dashboards:/var/lib/grafana/dashboards - zookeeper: - image: confluentinc/cp-zookeeper:latest - container_name: zookeeper - hostname: zookeeper - ports: - - "2181:2181" - environment: - ZOOKEEPER_CLIENT_PORT: 2181 - kafka: - image: confluentinc/cp-kafka:latest - container_name: kafka - hostname: kafka - depends_on: - - zookeeper - ports: - - 9092:9092 - - 29092:29092 - environment: - KAFKA_BROKER_ID: 1 - KAFKA_ZOOKEEPER_CONNECT: "zookeeper:2181" - KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT - KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092,PLAINTEXT_HOST://localhost:29092 - KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT - KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 - KAFKA_ADVERTISED_HOST_NAME: kafka - csit-tests: - image: policy-csit-robot:latest - container_name: policy-csit - hostname: policy-csit - volumes: - - ${ROBOT_LOG_DIR}:/tmp/results - - /tmp/distribution:/tmp/distribution - environment: - ROBOT_FILE: ${ROBOT_FILES} - TEST_ENV: ${TEST_ENV} - - jaeger: - image: jaegertracing/all-in-one:latest - container_name: jaeger - ports: - - 4318:4318 - - 4317:4317 - - 14250:14250 - - 16686:16686 - environment: - - COLLECTOR_OTLP_ENABLED=true diff --git a/compose/config/api/apiParameters.yaml b/compose/config/api/apiParameters.yaml index 51e7f368..3d8de256 100644 --- a/compose/config/api/apiParameters.yaml +++ b/compose/config/api/apiParameters.yaml @@ -10,10 +10,9 @@ spring: name: policyadmin password: zb!XztG34 mvc.converters.preferred-json-mapper: gson - datasource: - url: jdbc:mariadb://mariadb:3306/policyadmin - driverClassName: org.mariadb.jdbc.Driver + url: jdbc:postgresql://postgres:5432/policyadmin + driverClassName: org.postgresql.Driver username: policy_user password: policy_user jpa: @@ -30,8 +29,8 @@ policy-api: database: name: PolicyProviderParameterGroup implementation: org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl - driver: org.mariadb.jdbc.Driver - url: jdbc:mariadb://mariadb:3306/policyadmin + driver: org.postgresql.Driver + url: jdbc:postgresql://postgres:5432/policyadmin user: policy_user password: policy_user persistenceUnit: PolicyDb @@ -82,3 +81,24 @@ management: path-mapping: -metrics: plain-metrics -prometheus: metrics + +--- + +spring: + config: + activate: + on-profile: mariadb + datasource: + url: jdbc:mariadb://mariadb:3306/policyadmin + driverClassName: org.mariadb.jdbc.Driver + username: policy_user + password: policy_user + +database: + name: PolicyProviderParameterGroup + implementation: org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl + driver: org.mariadb.jdbc.Driver + url: jdbc:mariadb://mariadb:3306/policyadmin + user: policy_user + password: policy_user + persistenceUnit: PolicyDb diff --git a/compose/config/api/apiParametersPostgres.yaml b/compose/config/api/apiParametersPostgres.yaml deleted file mode 100644 index c0b23e94..00000000 --- a/compose/config/api/apiParametersPostgres.yaml +++ /dev/null @@ -1,84 +0,0 @@ -server: - port: 6969 - ssl: - enabled: false - servlet: - context-path: /policy/api/v1 - -spring: - security.user: - name: policyadmin - password: zb!XztG34 - mvc.converters.preferred-json-mapper: gson - - datasource: - url: jdbc:postgresql://postgres:5432/policyadmin - driverClassName: org.postgresql.Driver - username: policy_user - password: policy_user - jpa: - hibernate: - ddl-auto: none - naming: - physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl - implicit-strategy: org.onap.policy.common.spring.utils.CustomImplicitNamingStrategy - -policy-api: - name: ApiGroup - aaf: false - -database: - name: PolicyProviderParameterGroup - implementation: org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl - driver: org.postgresql.Driver - url: jdbc:postgresql://postgres:5432/policyadmin - user: policy_user - password: policy_user - persistenceUnit: PolicyDb - -policy-preload: - policyTypes: - - policytypes/onap.policies.monitoring.tcagen2.yaml - - policytypes/onap.policies.monitoring.tcagen2.v2.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 - policies: - - policies/sdnc.policy.naming.input.tosca.yaml - -management: - endpoints: - web: - base-path: / - exposure: - include: health,metrics,prometheus - path-mapping: - -metrics: plain-metrics - -prometheus: metrics diff --git a/compose/config/clamp/AcRuntimeParameters.yaml b/compose/config/clamp/AcRuntimeParameters.yaml index dbcbc562..1a58aa34 100644 --- a/compose/config/clamp/AcRuntimeParameters.yaml +++ b/compose/config/clamp/AcRuntimeParameters.yaml @@ -9,8 +9,8 @@ spring: converters: preferred-json-mapper: gson datasource: - url: jdbc:mariadb://${mariadb.host:mariadb}:${mariadb.port:3306}/clampacm - driverClassName: org.mariadb.jdbc.Driver + url: jdbc:postgresql://postgres:5432/clampacm + driverClassName: org.postgresql.Driver username: policy_user password: policy_user hikari: @@ -96,20 +96,54 @@ metrics: # Tracing can be configured for grpc or http - default is http -#tracing: -# enabled: true -# exporter: -# endpoint: http://jaeger:4317 -# protocol: grpc -# sampler: -# jaeger-remote: -# endpoint: http://jaeger:14250 tracing: enabled: true exporter: endpoint: http://jaeger:4318/v1/traces protocol: http +# protocol: grpc sampler: jaeger-remote: endpoint: http://jaeger:14250 + +--- +# legacy config + +spring: + config: + activate: + on-profile: legacy +runtime: + participantParameters: + heartBeatMs: 20000 + maxStatusWaitMs: 150000 + 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 + +--- +# mariadb config +spring: + config: + activate: + on-profile: mariadb + datasource: + url: jdbc:mariadb://${mariadb.host:mariadb}:${mariadb.port:3306}/clampacm + driverClassName: org.mariadb.jdbc.Driver diff --git a/compose/config/clamp/HttpParticipantParameters.yaml b/compose/config/clamp/HttpParticipantParameters.yaml index 62e309c3..9f9e2f0f 100644 --- a/compose/config/clamp/HttpParticipantParameters.yaml +++ b/compose/config/clamp/HttpParticipantParameters.yaml @@ -73,3 +73,29 @@ tracing: sampler: jaeger-remote: endpoint: http://jaeger:14250 + +# legacy config +--- + +spring: + config: + activate: + on-profile: legacy +participant: + intermediaryParameters: + reportingTimeIntervalMs: 120000 + 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 diff --git a/compose/config/clamp/KubernetesParticipantParameters.yaml b/compose/config/clamp/KubernetesParticipantParameters.yaml index 76ae9696..ab96f51c 100644 --- a/compose/config/clamp/KubernetesParticipantParameters.yaml +++ b/compose/config/clamp/KubernetesParticipantParameters.yaml @@ -87,3 +87,31 @@ logging: chart: api: enabled: false + +# legacy config +--- + +spring: + config: + activate: + on-profile: legacy +participant: + intermediaryParameters: + reportingTimeIntervalMs: 120000 + 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 diff --git a/compose/config/clamp/PolicyParticipantParameters.yaml b/compose/config/clamp/PolicyParticipantParameters.yaml index a65eeb03..c7af9dd1 100644 --- a/compose/config/clamp/PolicyParticipantParameters.yaml +++ b/compose/config/clamp/PolicyParticipantParameters.yaml @@ -84,3 +84,31 @@ server: enabled: false servlet: context-path: /onap/policy/clamp/acm/policyparticipant + +# legacy config +--- + +spring: + config: + activate: + on-profile: legacy +participant: + intermediaryParameters: + reportingTimeIntervalMs: 120000 + 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 diff --git a/compose/config/clamp/SimulatorParticipantParameters.yaml b/compose/config/clamp/SimulatorParticipantParameters.yaml index 6f6a5131..996404f4 100644 --- a/compose/config/clamp/SimulatorParticipantParameters.yaml +++ b/compose/config/clamp/SimulatorParticipantParameters.yaml @@ -77,4 +77,30 @@ tracing: protocol: http sampler: jaeger-remote: - endpoint: http://jaeger:14250
\ No newline at end of file + endpoint: http://jaeger:14250 + +# legacy config +--- + +spring: + config: + activate: + on-profile: legacy +participant: + intermediaryParameters: + reportingTimeIntervalMs: 120000 + 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 diff --git a/compose/config/clamp/policy-clamp-create-tables.sql b/compose/config/clamp/policy-clamp-create-tables.sql deleted file mode 100644 index 5d655ad5..00000000 --- a/compose/config/clamp/policy-clamp-create-tables.sql +++ /dev/null @@ -1,275 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * Copyright (C) 2022 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========================================================= - */ - -create table if not exists dictionary ( - name varchar(255) not null, - created_by varchar(255), - created_timestamp datetime(6) not null, - updated_by varchar(255), - updated_timestamp datetime(6) not null, - dictionary_second_level integer, - dictionary_type varchar(255), - primary key (name) - ) engine=InnoDB; - -create table if not exists dictionary_elements ( - short_name varchar(255) not null, - created_by varchar(255), - created_timestamp datetime(6) not null, - updated_by varchar(255), - updated_timestamp datetime(6) not null, - description varchar(255) not null, - name varchar(255) not null, - subdictionary_name varchar(255), - type varchar(255) not null, - primary key (short_name) - ) engine=InnoDB; - -create table if not exists dictionary_to_dictionaryelements ( - dictionary_name varchar(255) not null, - dictionary_element_short_name varchar(255) not null, - primary key (dictionary_name, dictionary_element_short_name) - ) engine=InnoDB; - -create table if not exists hibernate_sequence ( - next_val bigint -) engine=InnoDB; - -insert into hibernate_sequence values ( 1 ); - -create table if not exists loop_element_models ( - name varchar(255) not null, - created_by varchar(255), - created_timestamp datetime(6) not null, - updated_by varchar(255), - updated_timestamp datetime(6) not null, - blueprint_yaml MEDIUMTEXT, - dcae_blueprint_id varchar(255), - loop_element_type varchar(255) not null, - short_name varchar(255), - primary key (name) - ) engine=InnoDB; - -create table if not exists loop_logs ( - id bigint not null, - log_component varchar(255) not null, - log_instant datetime(6) not null, - log_type varchar(255) not null, - message MEDIUMTEXT not null, - loop_id varchar(255) not null, - primary key (id) - ) engine=InnoDB; - -create table if not exists loop_templates ( - name varchar(255) not null, - created_by varchar(255), - created_timestamp datetime(6) not null, - updated_by varchar(255), - updated_timestamp datetime(6) not null, - allowed_loop_type varchar(255), - blueprint_yaml MEDIUMTEXT, - dcae_blueprint_id varchar(255), - maximum_instances_allowed integer, - svg_representation MEDIUMTEXT, - unique_blueprint boolean default false, - service_uuid varchar(255), - primary key (name) - ) engine=InnoDB; - -create table if not exists loopelementmodels_to_policymodels ( - loop_element_name varchar(255) not null, - policy_model_type varchar(255) not null, - policy_model_version varchar(255) not null, - primary key (loop_element_name, policy_model_type, policy_model_version) - ) engine=InnoDB; - -create table if not exists loops ( - name varchar(255) not null, - created_by varchar(255), - created_timestamp datetime(6) not null, - updated_by varchar(255), - updated_timestamp datetime(6) not null, - dcae_deployment_id varchar(255), - dcae_deployment_status_url varchar(255), - global_properties_json json, - last_computed_state varchar(255) not null, - svg_representation MEDIUMTEXT, - loop_template_name varchar(255) not null, - service_uuid varchar(255), - primary key (name) - ) engine=InnoDB; - -create table if not exists loops_to_microservicepolicies ( - loop_name varchar(255) not null, - microservicepolicy_name varchar(255) not null, - primary key (loop_name, microservicepolicy_name) - ) engine=InnoDB; - -create table if not exists looptemplates_to_loopelementmodels ( - loop_element_model_name varchar(255) not null, - loop_template_name varchar(255) not null, - flow_order integer not null, - primary key (loop_element_model_name, loop_template_name) - ) engine=InnoDB; - -create table if not exists micro_service_policies ( - name varchar(255) not null, - created_by varchar(255), - created_timestamp datetime(6) not null, - updated_by varchar(255), - updated_timestamp datetime(6) not null, - configurations_json json, - json_representation json not null, - pdp_group varchar(255), - pdp_sub_group varchar(255), - context varchar(255), - dcae_blueprint_id varchar(255), - dcae_deployment_id varchar(255), - dcae_deployment_status_url varchar(255), - device_type_scope varchar(255), - shared bit not null, - loop_element_model_id varchar(255), - policy_model_type varchar(255), - policy_model_version varchar(255), - primary key (name) - ) engine=InnoDB; - -create table if not exists operational_policies ( - name varchar(255) not null, - created_by varchar(255), - created_timestamp datetime(6) not null, - updated_by varchar(255), - updated_timestamp datetime(6) not null, - configurations_json json, - json_representation json not null, - pdp_group varchar(255), - pdp_sub_group varchar(255), - loop_element_model_id varchar(255), - policy_model_type varchar(255), - policy_model_version varchar(255), - loop_id varchar(255) not null, - primary key (name) - ) engine=InnoDB; - -create table if not exists policy_models ( - policy_model_type varchar(255) not null, - version varchar(255) not null, - created_by varchar(255), - created_timestamp datetime(6) not null, - updated_by varchar(255), - updated_timestamp datetime(6) not null, - policy_acronym varchar(255), - policy_tosca MEDIUMTEXT, - policy_pdp_group json, - primary key (policy_model_type, version) - ) engine=InnoDB; - -create table if not exists services ( - service_uuid varchar(255) not null, - name varchar(255) not null, - resource_details json, - service_details json, - version varchar(255), - primary key (service_uuid) - ) engine=InnoDB; - -alter table dictionary_to_dictionaryelements - add constraint FK68hjjinnm8nte2owstd0xwp23 - foreign key (dictionary_element_short_name) - references dictionary_elements (short_name); - -alter table dictionary_to_dictionaryelements - add constraint FKtqfxg46gsxwlm2gkl6ne3cxfe - foreign key (dictionary_name) - references dictionary (name); - -alter table loop_logs - add constraint FK1j0cda46aickcaoxqoo34khg2 - foreign key (loop_id) - references loops (name); - -alter table loop_templates - add constraint FKn692dk6281wvp1o95074uacn6 - foreign key (service_uuid) - references services (service_uuid); - -alter table loopelementmodels_to_policymodels - add constraint FK23j2q74v6kaexefy0tdabsnda - foreign key (policy_model_type, policy_model_version) - references policy_models (policy_model_type, version); - -alter table loopelementmodels_to_policymodels - add constraint FKjag1iu0olojfwryfkvb5o0rk5 - foreign key (loop_element_name) - references loop_element_models (name); - -alter table loops - add constraint FK844uwy82wt0l66jljkjqembpj - foreign key (loop_template_name) - references loop_templates (name); - -alter table loops - add constraint FK4b9wnqopxogwek014i1shqw7w - foreign key (service_uuid) - references services (service_uuid); - -alter table loops_to_microservicepolicies - add constraint FKle255jmi7b065fwbvmwbiehtb - foreign key (microservicepolicy_name) - references micro_service_policies (name); - -alter table loops_to_microservicepolicies - add constraint FK8avfqaf7xl71l7sn7a5eri68d - foreign key (loop_name) - references loops (name); - -alter table looptemplates_to_loopelementmodels - add constraint FK1k7nbrbugvqa0xfxkq3cj1yn9 - foreign key (loop_element_model_name) - references loop_element_models (name); - -alter table looptemplates_to_loopelementmodels - add constraint FKj29yxyw0x7ue6mwgi6d3qg748 - foreign key (loop_template_name) - references loop_templates (name); - -alter table micro_service_policies - add constraint FKqvvdypacbww07fuv8xvlvdjgl - foreign key (loop_element_model_id) - references loop_element_models (name); - -alter table micro_service_policies - add constraint FKn17j9ufmyhqicb6cvr1dbjvkt - foreign key (policy_model_type, policy_model_version) - references policy_models (policy_model_type, version); - -alter table operational_policies - add constraint FKi9kh7my40737xeuaye9xwbnko - foreign key (loop_element_model_id) - references loop_element_models (name); - -alter table operational_policies - add constraint FKlsyhfkoqvkwj78ofepxhoctip - foreign key (policy_model_type, policy_model_version) - references policy_models (policy_model_type, version); - -alter table operational_policies - add constraint FK1ddoggk9ni2bnqighv6ecmuwu - foreign key (loop_id) - references loops (name); diff --git a/compose/config/db-migrator/init.sh b/compose/config/db-migrator/init.sh index 047d947e..a8eb25a3 100755 --- a/compose/config/db-migrator/init.sh +++ b/compose/config/db-migrator/init.sh @@ -1,6 +1,6 @@ #!/bin/sh # ============LICENSE_START==================================================== -# Copyright (C) 2021 Nordix Foundation. +# Copyright (C) 2021, 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. @@ -22,14 +22,21 @@ export SQL_USER=${MYSQL_USER} export SQL_PASSWORD=${MYSQL_PASSWORD} export SCRIPT_DIRECTORY=sql -/opt/app/policy/bin/prepare_upgrade.sh ${SQL_DB} +for schema in ${SQL_DB}; do + echo "Initializing $schema..." + /opt/app/policy/bin/prepare_upgrade.sh ${schema} -/opt/app/policy/bin/db-migrator -s ${SQL_DB} -o report + /opt/app/policy/bin/db-migrator -s ${schema} -o report -/opt/app/policy/bin/db-migrator -s ${SQL_DB} -o upgrade -rc=$? + /opt/app/policy/bin/db-migrator -s ${schema} -o upgrade + rc=$? -/opt/app/policy/bin/db-migrator -s ${SQL_DB} -o report + /opt/app/policy/bin/db-migrator -s ${schema} -o report + + if [ "$rc" != 0 ]; then + break + fi +done nc -l -p 6824 diff --git a/compose/config/db-migrator/init_pg.sh b/compose/config/db-migrator/init_pg.sh index 9b5f38e1..712d0d23 100755 --- a/compose/config/db-migrator/init_pg.sh +++ b/compose/config/db-migrator/init_pg.sh @@ -1,6 +1,6 @@ #!/bin/sh # ============LICENSE_START==================================================== -# Copyright (C) 2022 Nordix Foundation. +# Copyright (C) 2022, 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. @@ -18,18 +18,25 @@ # ============LICENSE_END====================================================== export POLICY_HOME=/opt/app/policy -export SQL_USER=${MYSQL_USER} -export SQL_PASSWORD=${MYSQL_PASSWORD} +export SQL_USER=${PGSQL_USER} +export SQL_PASSWORD=${PGSQL_PASSWORD} export SCRIPT_DIRECTORY=postgres -/opt/app/policy/bin/prepare_upgrade.sh ${SQL_DB} +for schema in ${SQL_DB}; do + echo "Initializing $schema..." + /opt/app/policy/bin/prepare_upgrade.sh ${schema} -/opt/app/policy/bin/db-migrator-pg -s ${SQL_DB} -o report + /opt/app/policy/bin/db-migrator-pg -s ${schema} -o report -/opt/app/policy/bin/db-migrator-pg -s ${SQL_DB} -o upgrade -rc=$? + /opt/app/policy/bin/db-migrator-pg -s ${schema} -o upgrade + rc=$? -/opt/app/policy/bin/db-migrator-pg -s ${SQL_DB} -o report + /opt/app/policy/bin/db-migrator-pg -s ${schema} -o report + + if [ "$rc" != 0 ]; then + break + fi +done nc -l -p 6824 diff --git a/compose/config/db-pg/db-pg.conf b/compose/config/db-pg/db-pg.conf index d4d58cec..ee26454e 100644 --- a/compose/config/db-pg/db-pg.conf +++ b/compose/config/db-pg/db-pg.conf @@ -1,4 +1,4 @@ -# Copyright 2022 Nordix Foundation. All rights reserved +# Copyright (C) 2022, 2024 Nordix Foundation. 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. @@ -11,7 +11,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -MYSQL_ROOT_PASSWORD=secret -MYSQL_USER=policy_user -MYSQL_PASSWORD=policy_user -PGPASSWORD=policy_user
\ No newline at end of file +PGSQL_ROOT_PASSWORD=secret +PGSQL_USER=policy_user +PGSQL_PASSWORD=policy_user +PGPASSWORD=policy_user +POSTGRES_PASSWORD=policy_user diff --git a/compose/config/db-pg/db-pg.sh b/compose/config/db-pg/db-pg.sh index 14816f08..681191f9 100755 --- a/compose/config/db-pg/db-pg.sh +++ b/compose/config/db-pg/db-pg.sh @@ -1,5 +1,5 @@ #!/bin/bash -xv -# Copyright 2022 Nordix Foundation. All rights reserved +# Copyright (C) 2022, 2024 Nordix Foundation. 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. @@ -13,10 +13,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -psql -U postgres -d postgres --command "CREATE USER ${MYSQL_USER} WITH PASSWORD '${MYSQL_PASSWORD}';" +psql -U postgres -d postgres --command "CREATE USER ${PGSQL_USER} WITH PASSWORD '${PGSQL_PASSWORD}';" for db in migration pooling policyadmin policyclamp operationshistory clampacm do psql -U postgres -d postgres --command "CREATE DATABASE ${db};" - psql -U postgres -d postgres --command "GRANT ALL PRIVILEGES ON DATABASE ${db} TO ${MYSQL_USER} ;" + psql -U postgres -d postgres --command "ALTER DATABASE ${db} OWNER TO ${PGSQL_USER} ;" + psql -U postgres -d postgres --command "GRANT ALL PRIVILEGES ON DATABASE ${db} TO ${PGSQL_USER} ;" done
\ No newline at end of file diff --git a/compose/config/db/db.sh b/compose/config/db/db.sh index 0363ed8a..a916abc0 100755 --- a/compose/config/db/db.sh +++ b/compose/config/db/db.sh @@ -1,6 +1,6 @@ #!/bin/bash -xv # Copyright 2019,2021 AT&T Intellectual Property. All rights reserved -# Modifications Copyright (c) 2022 Nordix Foundation. +# Modifications Copyright (c) 2022, 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. @@ -21,4 +21,3 @@ do done mysql -uroot -p"${MYSQL_ROOT_PASSWORD}" --execute "FLUSH PRIVILEGES;" -mysql -u"${MYSQL_USER}" -p"${MYSQL_PASSWORD}" -f policyclamp < /tmp/policy-clamp-create-tables.sql diff --git a/compose/config/drools-applications/env/base.conf b/compose/config/drools-applications/env/base-mariadb.conf index 0f677239..20b290a2 100644 --- a/compose/config/drools-applications/env/base.conf +++ b/compose/config/drools-applications/env/base-mariadb.conf @@ -53,6 +53,7 @@ SQL_PASSWORD=policy_user SQL_PORT=3306 JDBC_URL=jdbc:mariadb://mariadb:3306/ JDBC_OPTS= +JDBC_DRIVER=org.mariadb.jdbc.Driver MYSQL_CMD= # HTTP Servers @@ -104,7 +105,7 @@ PDP_HTTPS=false # DCAE Kafka -DCAE_TOPIC=unauthenticated.dcae_cl_output +DCAE_TOPIC=dcae_topic DCAE_SERVERS=kafka:9092 DCAE_CONSUMER_GROUP=dcae.policy.shared @@ -141,3 +142,10 @@ SDNC_PORT=6668 SDNC_CONTEXT_URI= SDNC_USERNAME= SDNC_PASSWORD= + +# CDS + +CDS_GRPC_HOST=grpc-sim +CDS_GRPC_PORT=6680 +CDS_GRPC_USERNAME="ccsdkapps" +CDS_GRPC_PASSWORD="ccsdkapps" diff --git a/compose/config/drools-applications/env/base-postgres.conf b/compose/config/drools-applications/env/base-postgres.conf new file mode 100644 index 00000000..2abb5e20 --- /dev/null +++ b/compose/config/drools-applications/env/base-postgres.conf @@ -0,0 +1,148 @@ +# ============LICENSE_START================================================== +# Copyright (C) 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==================================================== + +# JVM options + +JVM_OPTIONS=-server -Xms512m -Xmx512m + +# SYSTEM software configuration + +DEBUG=y +POLICY_HOME=/opt/app/policy +POLICY_LOGS=/var/log/onap/policy/pdpd +KEYSTORE_PASSWD=Pol1cy_0nap +TRUSTSTORE_PASSWD=Pol1cy_0nap + +# Telemetry credentials + +TELEMETRY_PORT=9696 +TELEMETRY_HOST=0.0.0.0 +TELEMETRY_USER=demo@people.osaaf.org +TELEMETRY_PASSWORD=demo123456! + +# nexus repository + +SNAPSHOT_REPOSITORY_ID= +SNAPSHOT_REPOSITORY_URL= +RELEASE_REPOSITORY_ID= +RELEASE_REPOSITORY_URL= +REPOSITORY_USERNAME= +REPOSITORY_PASSWORD= +REPOSITORY_OFFLINE=true + +# Relational (SQL) DB access + +SQL_HOST=postgres +SQL_USER=policy_user +SQL_PASSWORD=policy_user +SQL_PORT=5432 +JDBC_URL=jdbc:postgresql://postgres:5432/ +JDBC_OPTS= +JDBC_DRIVER=org.postgresql.Driver + +# HTTP Servers + +HTTP_SERVER_HTTPS=false +PROMETHEUS=true + +# kafka server + +KAFKA_SERVERS=kafka:9092 +KAFKA_HTTPS=false + +# LIVENESS Checks + +LIVENESS_CONTROLLERS=* + +# PDP-D Kafka configuration channel + +PDPD_CONFIGURATION_TOPIC=pdpd-configuration +PDPD_CONFIGURATION_SERVERS=kafka:9092 +PDPD_CONFIGURATION_API_KEY= +PDPD_CONFIGURATION_API_SECRET= +PDPD_CONFIGURATION_CONSUMER_GROUP= +PDPD_CONFIGURATION_CONSUMER_INSTANCE= +PDPD_CONFIGURATION_PARTITION_KEY= + +# PAP-PDP configuration channel + +POLICY_PDP_PAP_TOPIC=policy-pdp-pap +POLICY_PDP_PAP_API_KEY= +POLICY_PDP_PAP_API_SECRET= +POLICY_PDP_PAP_POLICYTYPES=onap.policies.controlloop.operational.common.Drools + +# PAP + +PAP_HOST=policy-pap +PAP_USERNAME=policyadmin +PAP_PASSWORD=zb!XztG34 + +# PDP-X + +GUARD_DISABLED=false +PDP_HOST=policy-xacml-pdp +PDP_PORT=6969 +PDP_CONTEXT_URI=policy/pdpx/v1/ +PDP_USERNAME=policyadmin +PDP_PASSWORD=zb!XztG34 +PDP_HTTPS=false + +# DCAE Kafka + +DCAE_TOPIC=dcae_topic +DCAE_SERVERS=kafka:9092 +DCAE_CONSUMER_GROUP=dcae.policy.shared + +# AAI + +AAI_HOST=aai-sim +AAI_PORT=6666 +AAI_CONTEXT_URI= +AAI_USERNAME=policy@policy.onap.org +AAI_PASSWORD=demo123456! +AAI_HTTPS=false + +# MSO + +SO_HOST=so-sim +SO_PORT=6669 +SO_CONTEXT_URI= +SO_URL=http://so-sim:6669/ +SO_USERNAME=InfraPortalClient +SO_PASSWORD='password1$' + +# VFC + +VFC_HOST=vfc-sim +VFC_PORT=6670 +VFC_CONTEXT_URI= +VFC_USERNAME= +VFC_PASSWORD= + +# SDNC + +SDNC_HOST=sdnc-sim +SDNC_PORT=6668 +SDNC_CONTEXT_URI= +SDNC_USERNAME= +SDNC_PASSWORD= + +# CDS + +CDS_GRPC_HOST=grpc-sim +CDS_GRPC_PORT=6680 +CDS_GRPC_USERNAME="ccsdkapps" +CDS_GRPC_PASSWORD="ccsdkapps" diff --git a/compose/config/drools-pdp/env/base.conf b/compose/config/drools-pdp/env/base-mariadb.conf index 0e0156bd..95aac748 100644 --- a/compose/config/drools-pdp/env/base.conf +++ b/compose/config/drools-pdp/env/base-mariadb.conf @@ -95,7 +95,7 @@ GUARD_DISABLED=false # DCAE Kafka -DCAE_TOPIC=unauthenticated.dcae_cl_output +DCAE_TOPIC=dcae_topic DCAE_SERVERS= DCAE_CONSUMER_GROUP=dcae.policy.shared diff --git a/compose/config/drools-pdp/env/base-postgres.conf b/compose/config/drools-pdp/env/base-postgres.conf new file mode 100644 index 00000000..64a1d57d --- /dev/null +++ b/compose/config/drools-pdp/env/base-postgres.conf @@ -0,0 +1,138 @@ +# ============LICENSE_START======================================================= +# Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. +# Modifications Copyright (C) 2021 Bell Canada. All rights reserved. +# Modification Copyright 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========================================================= + +# JVM options + +JVM_OPTIONS=-server -Xms512m -Xmx512m + +# SYSTEM software configuration + +DEBUG=y +POLICY_HOME=/opt/app/policy +POLICY_LOGS=/var/log/onap/policy/pdpd +KEYSTORE_PASSWD=Pol1cy_0nap +TRUSTSTORE_PASSWD=Pol1cy_0nap + +# Telemetry credentials + +TELEMETRY_PORT=9696 +TELEMETRY_HOST=0.0.0.0 +TELEMETRY_USER=demo@people.osaaf.org +TELEMETRY_PASSWORD=demo123456! + +# nexus repository + +SNAPSHOT_REPOSITORY_ID=policy-nexus-snapshots +SNAPSHOT_REPOSITORY_URL=http://nexus:8081/nexus/content/repositories/snapshots/ +RELEASE_REPOSITORY_ID=policy-nexus-releases +RELEASE_REPOSITORY_URL=http://nexus:8081/nexus/content/repositories/releases/ +REPOSITORY_USERNAME=admin +REPOSITORY_PASSWORD=admin123 +REPOSITORY_OFFLINE=false + +# Relational (SQL) DB access + +SQL_HOST=postgres +SQL_USER=policy_user +SQL_PASSWORD=policy_user +SQL_PORT=5432 +JDBC_URL=jdbc:postgresql://postgres:5432/ +JDBC_OPTS= +JDBC_DRIVER=org.postgresql.Driver + +# HTTP Servers + +HTTP_SERVER_HTTPS=false +PROMETHEUS=true + +# PDP-D Kafka configuration channel + +PDPD_CONFIGURATION_TOPIC=pdpd-configuration +PDPD_CONFIGURATION_API_KEY= +PDPD_CONFIGURATION_API_SECRET= +PDPD_CONFIGURATION_CONSUMER_GROUP= +PDPD_CONFIGURATION_CONSUMER_INSTANCE= +PDPD_CONFIGURATION_PARTITION_KEY= + +# PAP-PDP configuration channel + +POLICY_PDP_PAP_TOPIC=policy-pdp-pap +POLICY_PDP_PAP_API_KEY= +POLICY_PDP_PAP_API_SECRET= + +# PAP + +PAP_HOST= +PAP_USERNAME= +PAP_PASSWORD= + +# PDP-X + +PDP_HOST= +PDP_PORT= +PDP_CONTEXT_URI=policy/pdpx/v1/ +PDP_USERNAME= +PDP_PASSWORD= +PDP_CLIENT_USERNAME= +PDP_CLIENT_PASSWORD= +PDP_ENVIRONMENT= +GUARD_DISABLED=false + +# DCAE Kafka + +DCAE_TOPIC=dcae_topic +DCAE_SERVERS= +DCAE_CONSUMER_GROUP=dcae.policy.shared + +# kafka server + +KAFKA_SERVERS=kafka:9092 +KAFKA_HTTPS=false + +# AAI + +AAI_HOST=aai.api.simpledemo.onap.org +AAI_PORT=8443 +AAI_CONTEXT_URI= +AAI_USERNAME=policy@policy.onap.org +AAI_PASSWORD=demo123456! + +# MSO + +SO_HOST=vm1.mso.simpledemo.onap.org +SO_PORT=8080 +SO_CONTEXT_URI=onap/so/infra/ +SO_URL=http://vm1.mso.simpledemo.onap.org:8080/onap/so/infra +SO_USERNAME=InfraPortalClient +SO_PASSWORD='password1$' + +# VFC + +VFC_HOST= +VFC_PORT= +VFC_CONTEXT_URI=api/nslcm/v1/ +VFC_USERNAME= +VFC_PASSWORD= + +# SDNC + +SDNC_HOST= +SDNC_PORT= +SDNC_CONTEXT_URI=restconf/operations/ +SDNC_USERNAME= +SDNC_PASSWORD= diff --git a/compose/config/nginx/nginx-acm.conf b/compose/config/nginx/nginx-acm.conf new file mode 100644 index 00000000..59d12109 --- /dev/null +++ b/compose/config/nginx/nginx-acm.conf @@ -0,0 +1,17 @@ +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/pap/papParameters.yaml b/compose/config/pap/papParameters.yaml index 51aaec38..57b540bb 100644 --- a/compose/config/pap/papParameters.yaml +++ b/compose/config/pap/papParameters.yaml @@ -7,8 +7,8 @@ spring: converters: preferred-json-mapper: gson datasource: - url: jdbc:mariadb://mariadb:3306/policyadmin - driverClassName: org.mariadb.jdbc.Driver + url: jdbc:postgresql://postgres:5432/policyadmin + driverClassName: org.postgresql.Driver username: policy_user password: policy_user jpa: @@ -27,7 +27,6 @@ server: pap: name: PapGroup - aaf: false topic: pdp-pap.name: policy-pdp-pap notification.name: policy-notification @@ -86,3 +85,24 @@ management: path-mapping: -metrics: plain-metrics -prometheus: metrics + +--- + +spring: + config: + activate: + on-profile: mariadb + datasource: + url: jdbc:mariadb://mariadb:3306/policyadmin + driverClassName: org.mariadb.jdbc.Driver + username: policy_user + password: policy_user + +database: + name: PolicyProviderParameterGroup + implementation: org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl + driver: org.mariadb.jdbc.Driver + url: jdbc:mariadb://mariadb:3306/policyadmin + user: policy_user + password: policy_user + persistenceUnit: PolicyDb diff --git a/compose/config/pap/papParametersPostgres.yaml b/compose/config/pap/papParametersPostgres.yaml deleted file mode 100644 index 30ef7751..00000000 --- a/compose/config/pap/papParametersPostgres.yaml +++ /dev/null @@ -1,88 +0,0 @@ -spring: - security: - user: - name: policyadmin - password: zb!XztG34 - http: - converters: - preferred-json-mapper: gson - datasource: - url: jdbc:postgresql://postgres:5432/policyadmin - driverClassName: org.postgresql.Driver - username: policy_user - password: policy_user - jpa: - hibernate: - ddl-auto: none - naming: - physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl - implicit-strategy: org.onap.policy.common.spring.utils.CustomImplicitNamingStrategy - -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: - maxRetryCount: 1 - maxWaitMs: 30000 - stateChangeParameters: - maxRetryCount: 1 - maxWaitMs: 30000 - savePdpStatisticsInDb: true - topicParameterGroup: - topicSources: - - topic: ${pap.topic.pdp-pap.name} - servers: - - kafka:9092 - topicCommInfrastructure: kafka - useHttps: false - fetchTimeout: 15000 - - topic: ${pap.topic.heartbeat.name} - effectiveTopic: ${pap.topic.pdp-pap.name} - consumerGroup: policy-pap - servers: - - kafka:9092 - topicCommInfrastructure: kafka - useHttps: false - fetchTimeout: 15000 - topicSinks: - - topic: ${pap.topic.pdp-pap.name} - servers: - - kafka:9092 - topicCommInfrastructure: kafka - useHttps: false - - topic: ${pap.topic.notification.name} - servers: - - kafka:9092 - topicCommInfrastructure: kafka - useHttps: false - healthCheckRestClientParameters: - - clientName: api - hostname: policy-api - port: 6969 - userName: policyadmin - password: zb!XztG34 - useHttps: false - basePath: policy/api/v1/healthcheck - -management: - endpoints: - web: - base-path: / - exposure: - include: health, metrics, prometheus - path-mapping: - -metrics: plain-metrics - -prometheus: metrics diff --git a/compose/config/policy-gui/application.yaml b/compose/config/policy-gui/application.yaml deleted file mode 100644 index 30de64bf..00000000 --- a/compose/config/policy-gui/application.yaml +++ /dev/null @@ -1,37 +0,0 @@ -# -# ===========LICENSE_START==================================================== -# Copyright (C) 2022 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===================================================== -# -server: - port: 2445 - ssl: - enabled: false - -clamp: - url: http://policy-clamp-be:8445 - disable-ssl-validation: true - disable-ssl-hostname-check: true - -apex-editor: - upload-url: - upload-userid: - -management: - endpoints: - web: - exposure: - include: health, metrics, prometheus - diff --git a/compose/config/policy-gui/groups.json b/compose/config/policy-gui/groups.json deleted file mode 100644 index 6ee30e1c..00000000 --- a/compose/config/policy-gui/groups.json +++ /dev/null @@ -1,137 +0,0 @@ -{ - "groups": [ - { - "name": "defaultGroup", - "version": "1.0.0", - "description": "The default group that registers all supported policy types and pdps.", - "pdpGroupState": "ACTIVE", - "pdpSubgroups": [ - { - "pdpType": "xacml", - "supportedPolicyTypes": [ - { - "name": "onap.policies.controlloop.guard.common.FrequencyLimiter", - "version": "1.0.0" - }, - { - "name": "onap.policies.controlloop.guard.common.MinMax", - "version": "1.0.0" - }, - { - "name": "onap.policies.controlloop.guard.common.Blacklist", - "version": "1.0.0" - }, - { - "name": "onap.policies.controlloop.guard.common.Filter", - "version": "1.0.0" - }, - { - "name": "onap.policies.controlloop.guard.coordination.FirstBlocksSecond", - "version": "1.0.0" - }, - { - "name": "onap.policies.monitoring.*", - "version": "1.0.0" - }, - { - "name": "onap.policies.optimization.*", - "version": "1.0.0" - }, - { - "name": "onap.policies.optimization.resource.AffinityPolicy", - "version": "1.0.0" - }, - { - "name": "onap.policies.optimization.resource.DistancePolicy", - "version": "1.0.0" - }, - { - "name": "onap.policies.optimization.resource.HpaPolicy", - "version": "1.0.0" - }, - { - "name": "onap.policies.optimization.resource.OptimizationPolicy", - "version": "1.0.0" - }, - { - "name": "onap.policies.optimization.resource.PciPolicy", - "version": "1.0.0" - }, - { - "name": "onap.policies.optimization.service.QueryPolicy", - "version": "1.0.0" - }, - { - "name": "onap.policies.optimization.service.SubscriberPolicy", - "version": "1.0.0" - }, - { - "name": "onap.policies.optimization.resource.Vim_fit", - "version": "1.0.0" - }, - { - "name": "onap.policies.optimization.resource.VnfPolicy", - "version": "1.0.0" - }, - { - "name": "onap.policies.native.Xacml", - "version": "1.0.0" - }, - { - "name": "onap.policies.Naming", - "version": "1.0.0" - }, - { - "name": "onap.policies.match.*", - "version": "1.0.0" - } - ], - "currentInstanceCount": 0, - "desiredInstanceCount": 1, - "policies": [ - { - "name": "SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP", - "version": "1.0.0" - } - ] - }, - { - "pdpType": "drools", - "supportedPolicyTypes": [ - { - "name": "onap.policies.controlloop.operational.common.Drools", - "version": "1.0.0" - }, - { - "name": "onap.policies.native.drools.Controller", - "version": "1.0.0" - }, - { - "name": "onap.policies.native.drools.Artifact", - "version": "1.0.0" - } - ], - "currentInstanceCount": 0, - "desiredInstanceCount": 1, - "policies": [] - }, - { - "pdpType": "apex", - "supportedPolicyTypes": [ - { - "name": "onap.policies.controlloop.operational.common.Apex", - "version": "1.0.0" - }, - { - "name": "onap.policies.native.Apex", - "version": "1.0.0" - } - ], - "currentInstanceCount": 0, - "desiredInstanceCount": 1, - "policies": [] - } - ] - } - ] -} diff --git a/compose/config/policy-gui/logback.xml b/compose/config/policy-gui/logback.xml deleted file mode 100644 index 04bc5671..00000000 --- a/compose/config/policy-gui/logback.xml +++ /dev/null @@ -1,119 +0,0 @@ -<!-- - ============LICENSE_START======================================================= - policy-gui - ================================================================================ - Copyright (C) 2021-2022 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========================================================= - --> - -<configuration scan="true" scanPeriod="30 seconds" debug="false"> - - <property name="logDir" value="${POLICY_LOGS}" /> - - <property name="errorLog" value="error" /> - <property name="debugLog" value="debug" /> - <property name="networkLog" value="network" /> - - <property name="debugPattern" - value="[%d{yyyy-MM-dd'T'HH:mm:ss.SSS+00:00, UTC}|%level|%logger{0}|%thread] %msg%n" /> - <property name="errorPattern" value="${debugPattern}" /> - <property name="networkPattern" value="[%d{yyyy-MM-dd'T'HH:mm:ss.SSS+00:00, UTC}|%t]%m%n" /> - - <appender name="ErrorOut" class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>${logDir}/${errorLog}.log</file> - <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> - <fileNamePattern>${logDir}/${errorLog}.%d{yyyy-MM-dd}.%i.log.zip - </fileNamePattern> - <maxFileSize>50MB</maxFileSize> - <maxHistory>30</maxHistory> - <totalSizeCap>10GB</totalSizeCap> - </rollingPolicy> - <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> - <level>WARN</level> - </filter> - <encoder> - <pattern>${errorPattern}</pattern> - </encoder> - </appender> - - <appender name="AsyncErrorOut" class="ch.qos.logback.classic.AsyncAppender"> - <appender-ref ref="ErrorOut" /> - </appender> - - <appender name="DebugOut" class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>${logDir}/${debugLog}.log</file> - <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> - <fileNamePattern>${logDir}/${debugLog}.%d{yyyy-MM-dd}.%i.log.zip - </fileNamePattern> - <maxFileSize>50MB</maxFileSize> - <maxHistory>30</maxHistory> - <totalSizeCap>10GB</totalSizeCap> - </rollingPolicy> - <encoder> - <pattern>${debugPattern}</pattern> - </encoder> - </appender> - - <appender name="AsyncDebugOut" class="ch.qos.logback.classic.AsyncAppender"> - <appender-ref ref="DebugOut" /> - </appender> - - <appender name="NetworkOut" class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>${logDir}/${networkLog}.log</file> - <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> - <fileNamePattern>${logDir}/${networkLog}.%d{yyyy-MM-dd}.%i.log.zip - </fileNamePattern> - <maxFileSize>50MB</maxFileSize> - <maxHistory>30</maxHistory> - <totalSizeCap>10GB</totalSizeCap> - </rollingPolicy> - <encoder> - <pattern>${networkPattern}</pattern> - </encoder> - </appender> - - <appender name="AsyncNetworkOut" class="ch.qos.logback.classic.AsyncAppender"> - <appender-ref ref="NetworkOut" /> - </appender> - - <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> - <encoder> - <Pattern>[%d{yyyy-MM-dd'T'HH:mm:ss.SSS+00:00, UTC}|%level|%logger{0}|%thread] %msg%n</Pattern> - </encoder> - </appender> - - <appender name="AsyncStdOut" class="ch.qos.logback.classic.AsyncAppender"> - <appender-ref ref="STDOUT" /> - </appender> - - <logger name="network" level="INFO" additivity="false"> - <appender-ref ref="AsyncNetworkOut" /> - <appender-ref ref="AsyncStdOut" /> - </logger> - - <logger name="org.eclipse.jetty.server.RequestLog" level="info" additivity="false"> - <appender-ref ref="AsyncNetworkOut" /> - <appender-ref ref="AsyncStdOut" /> - </logger> - - <logger name="org.eclipse.jetty" level="ERROR" /> - - <root level="INFO"> - <appender-ref ref="AsyncDebugOut" /> - <appender-ref ref="AsyncErrorOut" /> - <appender-ref ref="AsyncStdOut" /> - </root> - -</configuration>
\ No newline at end of file diff --git a/compose/config/xacml-pdp/xacml-mariadb.properties b/compose/config/xacml-pdp/xacml-mariadb.properties new file mode 100644 index 00000000..ede93c70 --- /dev/null +++ b/compose/config/xacml-pdp/xacml-mariadb.properties @@ -0,0 +1,54 @@ +# +# Properties that the embedded PDP engine uses to configure and load +# +# Standard API Factories +# +xacml.dataTypeFactory=com.att.research.xacml.std.StdDataTypeFactory +xacml.pdpEngineFactory=com.att.research.xacmlatt.pdp.ATTPDPEngineFactory +xacml.pepEngineFactory=com.att.research.xacml.std.pep.StdEngineFactory +xacml.pipFinderFactory=com.att.research.xacml.std.pip.StdPIPFinderFactory +xacml.traceEngineFactory=com.att.research.xacml.std.trace.LoggingTraceEngineFactory +# +# AT&T PDP Implementation Factories +# +xacml.att.evaluationContextFactory=com.att.research.xacmlatt.pdp.std.StdEvaluationContextFactory +xacml.att.combiningAlgorithmFactory=com.att.research.xacmlatt.pdp.std.StdCombiningAlgorithmFactory +xacml.att.functionDefinitionFactory=com.att.research.xacmlatt.pdp.std.StdFunctionDefinitionFactory +# +# ONAP PDP Implementation Factories +# +xacml.att.policyFinderFactory=org.onap.policy.pdp.xacml.application.common.OnapPolicyFinderFactory + +# +# Use a root combining algorithm +# +xacml.att.policyFinderFactory.combineRootPolicies=urn:oasis:names:tc:xacml:3.0:policy-combining-algorithm:deny-overrides + +# +# PIP Engine Definitions +# +count-recent-operations.classname=org.onap.policy.pdp.xacml.application.common.operationshistory.CountRecentOperationsPip +count-recent-operations.issuer=urn:org:onap:xacml:guard:count-recent-operations +count-recent-operations.name=CountRecentOperations +count-recent-operations.description=Returns operation counts based on time window +count-recent-operations.persistenceunit=OperationsHistoryPU + +get-operation-outcome.classname=org.onap.policy.pdp.xacml.application.common.operationshistory.GetOperationOutcomePip +get-operation-outcome.issuer=urn:org:onap:xacml:guard:get-operation-outcome +get-operation-outcome.name=GetOperationOutcome +get-operation-outcome.description=Returns operation outcome +get-operation-outcome.persistenceunit=OperationsHistoryPU + +# +# Make pips available to finder +# +xacml.pip.engines=count-recent-operations,get-operation-outcome + +# +# JPA Properties +# +eclipselink.target-database=MySQL +jakarta.persistence.jdbc.driver=org.mariadb.jdbc.Driver +jakarta.persistence.jdbc.url=jdbc:mariadb://mariadb:3306/operationshistory +jakarta.persistence.jdbc.user=policy_user +jakarta.persistence.jdbc.password=policy_user diff --git a/compose/config/xacml-pdp/xacml-postgres.properties b/compose/config/xacml-pdp/xacml-postgres.properties new file mode 100644 index 00000000..a3446c4c --- /dev/null +++ b/compose/config/xacml-pdp/xacml-postgres.properties @@ -0,0 +1,54 @@ +# +# Properties that the embedded PDP engine uses to configure and load +# +# Standard API Factories +# +xacml.dataTypeFactory=com.att.research.xacml.std.StdDataTypeFactory +xacml.pdpEngineFactory=com.att.research.xacmlatt.pdp.ATTPDPEngineFactory +xacml.pepEngineFactory=com.att.research.xacml.std.pep.StdEngineFactory +xacml.pipFinderFactory=com.att.research.xacml.std.pip.StdPIPFinderFactory +xacml.traceEngineFactory=com.att.research.xacml.std.trace.LoggingTraceEngineFactory +# +# AT&T PDP Implementation Factories +# +xacml.att.evaluationContextFactory=com.att.research.xacmlatt.pdp.std.StdEvaluationContextFactory +xacml.att.combiningAlgorithmFactory=com.att.research.xacmlatt.pdp.std.StdCombiningAlgorithmFactory +xacml.att.functionDefinitionFactory=com.att.research.xacmlatt.pdp.std.StdFunctionDefinitionFactory +# +# ONAP PDP Implementation Factories +# +xacml.att.policyFinderFactory=org.onap.policy.pdp.xacml.application.common.OnapPolicyFinderFactory + +# +# Use a root combining algorithm +# +xacml.att.policyFinderFactory.combineRootPolicies=urn:oasis:names:tc:xacml:3.0:policy-combining-algorithm:deny-overrides + +# +# PIP Engine Definitions +# +count-recent-operations.classname=org.onap.policy.pdp.xacml.application.common.operationshistory.CountRecentOperationsPip +count-recent-operations.issuer=urn:org:onap:xacml:guard:count-recent-operations +count-recent-operations.name=CountRecentOperations +count-recent-operations.description=Returns operation counts based on time window +count-recent-operations.persistenceunit=OperationsHistoryPU + +get-operation-outcome.classname=org.onap.policy.pdp.xacml.application.common.operationshistory.GetOperationOutcomePip +get-operation-outcome.issuer=urn:org:onap:xacml:guard:get-operation-outcome +get-operation-outcome.name=GetOperationOutcome +get-operation-outcome.description=Returns operation outcome +get-operation-outcome.persistenceunit=OperationsHistoryPU + +# +# Make pips available to finder +# +xacml.pip.engines=count-recent-operations,get-operation-outcome + +# +# JPA Properties +# +eclipselink.target-database=PostgreSQL +jakarta.persistence.jdbc.driver=org.postgresql.Driver +jakarta.persistence.jdbc.url=jdbc:postgresql://postgres:5432/operationshistory +jakarta.persistence.jdbc.user=policy_user +jakarta.persistence.jdbc.password=policy_user diff --git a/compose/docker-compose.gui.yml b/compose/docker-compose.gui.yml deleted file mode 100644 index e2e98b54..00000000 --- a/compose/docker-compose.gui.yml +++ /dev/null @@ -1,63 +0,0 @@ -# -# ===========LICENSE_START==================================================== -# Copyright 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===================================================== -# - -services: - policy-gui: - image: ${CONTAINER_LOCATION}onap/policy-gui:latest - container_name: policy-gui - depends_on: - - policy-clamp-backend - hostname: policy-gui - environment: - CLAMP_URL: http://policy-clamp-backend:8445 - CLAMP_DISABLE_SSL_VALIDATION: "true" - ports: - - "2445:2445" - volumes: - - ./config/policy-gui/application.yaml:/opt/app/policy/gui/etc/application.yml - - ./config/policy-gui/logback.xml:/opt/app/policy/gui/etc/logback.xml:ro - - ./wait_for_port.sh:/opt/app/policy/gui/bin/wait_for_port.sh:ro - entrypoint: ./policy-gui.sh - working_dir: /opt/app/policy/gui/bin - command: ./policy-gui.sh - policy-clamp-backend: - image: ${CONTAINER_LOCATION}onap/policy-clamp-backend:latest - container_name: policy-clamp-backend - depends_on: - - policy-clamp-runtime-acm - - distribution - hostname: policy-clamp-backend - environment: - POLICY_API_HOST: api - POLICY_PAP_HOST: pap - MARIADB_HOST: mariadb - RUNTIME_HOST: policy-clamp-runtime-acm - ports: - - "8445:8445" - volumes: - - ./config/clamp/ClampBackend.properties:/opt/policy/clamp/config/ClampBackend.properties:ro - - ./config/clamp/logback-backend.xml:/opt/policy/clamp/config/logback.xml:ro - working_dir: /opt/policy/clamp - command: java - -Djava.security.egd=file:/dev/./urandom - -XX:MinRAMPercentage=50 - -XX:MaxRAMPercentage=75 - -jar ./policy-clamp-backend.jar - --spring.config.name=ClampBackend - --spring.config.location=/opt/policy/clamp/config/ClampBackend.properties -
\ No newline at end of file diff --git a/compose/docker-compose.postgres.yml b/compose/docker-compose.postgres.yml deleted file mode 100644 index fee55d97..00000000 --- a/compose/docker-compose.postgres.yml +++ /dev/null @@ -1,171 +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===================================================== -# - -services: - postgres: - image: nexus3.onap.org:10001/library/postgres:${POLICY_POSTGRES_VER} - container_name: postgres - hostname: postgres - command: [ '--idle_in_transaction_session_timeout=28800' ] - env_file: config/db-pg/db-pg.conf - volumes: - - ./config/db-pg:/docker-entrypoint-initdb.d:ro - expose: - - 5432 - ports: - - "5432:5432" - policy-db-migrator: - image: ${CONTAINER_LOCATION}onap/policy-db-migrator:${POLICY_DOCKER_VERSION} - container_name: policy-db-migrator - hostname: policy-db-migrator - depends_on: - - postgres - expose: - - 6824 - env_file: config/db-pg/db-pg.conf - environment: - SQL_DB: policyadmin - SQL_HOST: postgres - PGPASSWORD: policy_user - volumes: - - ./config/db-migrator/init_pg.sh:/opt/app/policy/bin/db_migrator_policy_init_pg.sh: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/bin/db_migrator_policy_init_pg.sh', - 'postgres', '5432' - ] - simulator: - image: ${CONTAINER_LOCATION}onap/policy-models-simulator:${POLICY_MODELS_VERSION} - container_name: simulator - hostname: simulator - networks: - default: - aliases: - - aai-sim - - grpc-sim - - sdnc-sim - - so-sim - - vfc-sim - volumes: - - ./config/sim-all:/opt/app/policy/simulators/etc/mounted:ro - - ./config/sim-all/logback.xml:/opt/app/policy/simulators/etc/mounted/logback.xml:ro - expose: - - 6666 - - 6668 - - 6669 - - 6670 - - 6680 - ports: - - ${SIMULATOR_PORT}:6666 - api: - image: ${CONTAINER_LOCATION}onap/policy-api:${POLICY_API_VERSION} - container_name: policy-api - depends_on: - - policy-db-migrator - hostname: policy-api - ports: - - ${API_PORT}:6969 - volumes: - - ./config/api/apiParametersPostgres.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', - 'postgres', '5432', - 'policy-db-migrator', '6824' - ] - pap: - image: ${CONTAINER_LOCATION}onap/policy-pap:${POLICY_PAP_VERSION} - container_name: policy-pap - depends_on: - - postgres - - kafka - - api - hostname: policy-pap - ports: - - ${PAP_PORT}:6969 - volumes: - - ./config/pap/papParametersPostgres.yaml:/opt/app/policy/pap/etc/papParameters.yaml:ro - - ./config/${PROJECT}/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', - 'postgres', '5432', - 'kafka', '9092', - 'api', '6969' - ] - apex-pdp: - image: ${CONTAINER_LOCATION}onap/policy-apex-pdp:${POLICY_APEX_PDP_VERSION} - container_name: policy-apex-pdp - depends_on: - - postgres - - simulator - - kafka - - pap - hostname: policy-apex-pdp - ports: - - ${APEX_PORT}:6969 - - ${APEX_EVENTS_PORT}:23324 - 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', - 'postgres', '5432', - 'kafka', '9092', - 'pap', '6969' - ] - prometheus: - image: nexus3.onap.org:10001/prom/prometheus:latest - container_name: prometheus - hostname: prometheus - ports: - - ${PROMETHEUS_PORT}:9090 - volumes: - - ./metrics/prometheus.yml:/etc/prometheus/prometheus.yml - - zookeeper: - image: confluentinc/cp-zookeeper:latest - environment: - ZOOKEEPER_CLIENT_PORT: 2181 - ZOOKEEPER_TICK_TIME: 2000 - ports: - - 2181:2181 - - kafka: - image: confluentinc/cp-kafka:latest - container_name: kafka - depends_on: - - zookeeper - ports: - - 29092:29092 - - 9092:9092 - environment: - KAFKA_BROKER_ID: 1 - KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 - KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092,PLAINTEXT_HOST://localhost:29092 - KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT - KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT - KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 diff --git a/compose/export-ports.sh b/compose/export-ports.sh index a3422daa..8dd2c163 100755 --- a/compose/export-ports.sh +++ b/compose/export-ports.sh @@ -17,18 +17,6 @@ # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END========================================================= -if $(docker images | grep -q "onap\/policy-api") -then - export CONTAINER_LOCATION=$( - docker images | - grep onap/policy-api | - head -1 | - sed 's/onap\/policy-api.*$//' - ) -else - export CONTAINER_LOCATION="nexus3.onap.org:10001/" -fi - # EXPLICITLY ASSIGN PORTS FOR TESTING PURPOSES export APEX_PORT=30001 export APEX_EVENTS_PORT=23324 diff --git a/compose/get-versions.sh b/compose/get-versions.sh index 13dc3653..0e8f251e 100755 --- a/compose/get-versions.sh +++ b/compose/get-versions.sh @@ -25,115 +25,133 @@ if [ -z "${WORKSPACE}" ]; then export WORKSPACE fi -GERRIT_BRANCH=$(awk -F= '$1 == "defaultbranch" { print $2 }' \ - "${WORKSPACE}"/.gitreview) - -echo GERRIT_BRANCH="${GERRIT_BRANCH}" +LOCAL_IMAGES=false +#default values export POLICY_MARIADB_VER=10.10.2 echo POLICY_MARIADB_VER=${POLICY_MARIADB_VER} -export POLICY_POSTGRES_VER=11.1 +export POLICY_POSTGRES_VER=16.4 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" ]] +if [ -n "$LOCAL_IMAGES" ] && [ "$LOCAL_IMAGES" = "true" ]; then + echo "Running with local images." + export POLICY_DOCKER_VERSION="latest" + export POLICY_MODELS_VERSION="latest" + export POLICY_API_VERSION="latest" + export POLICY_PAP_VERSION="latest" + export POLICY_APEX_PDP_VERSION="latest" + export POLICY_DROOLS_PDP_VERSION="latest" + export POLICY_XACML_PDP_VERSION="latest" + export POLICY_DISTRIBUTION_VERSION="latest" + export POLICY_CLAMP_VERSION="latest" + export POLICY_CLAMP_PPNT_VERSION=$POLICY_CLAMP_VERSION + export POLICY_DROOLS_APPS_VERSION="latest" + export CONTAINER_LOCATION="" + +else + export CONTAINER_LOCATION="nexus3.onap.org:10001/" + GERRIT_BRANCH=$(awk -F= '$1 == "defaultbranch" { print $2 }' \ + "${WORKSPACE}"/.gitreview) + + echo GERRIT_BRANCH="${GERRIT_BRANCH}" + + 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 - echo "repo $REPO does not produce a docker image, execution terminated" - exit 1 + 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 - docker_images="$DEFAULT_DOCKER_IMAGE_NAME" + echo "docker image \"$docker_image_name:$docker_image_version\" not found for repo \"$repo\"" + exit 1 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_DOCKER_VERSION="$docker_image_version" - -getDockerVersion models "'policy-models-simulator'" 3.0.1 -export POLICY_MODELS_VERSION="$docker_image_version" - -getDockerVersion api -export POLICY_API_VERSION="$docker_image_version" - -getDockerVersion pap -export POLICY_PAP_VERSION="$docker_image_version" - -getDockerVersion apex-pdp -export POLICY_APEX_PDP_VERSION="$docker_image_version" - -getDockerVersion drools-pdp -export POLICY_DROOLS_PDP_VERSION="$docker_image_version" - -getDockerVersion xacml-pdp -export POLICY_XACML_PDP_VERSION="$docker_image_version" - -getDockerVersion distribution -export POLICY_DISTRIBUTION_VERSION="$docker_image_version" - -getDockerVersion clamp -export POLICY_CLAMP_VERSION="$docker_image_version" -export POLICY_CLAMP_PPNT_VERSION=$POLICY_CLAMP_VERSION - -getDockerVersion gui -export POLICY_GUI_VERSION="$docker_image_version" - -getDockerVersion drools-applications -export POLICY_DROOLS_APPS_VERSION="$docker_image_version" + } + + getDockerVersion docker + export POLICY_DOCKER_VERSION="$docker_image_version" + + getDockerVersion models + export POLICY_MODELS_VERSION="$docker_image_version" + + getDockerVersion api + export POLICY_API_VERSION="$docker_image_version" + + getDockerVersion pap + export POLICY_PAP_VERSION="$docker_image_version" + + getDockerVersion apex-pdp + export POLICY_APEX_PDP_VERSION="$docker_image_version" + + getDockerVersion drools-pdp + export POLICY_DROOLS_PDP_VERSION="$docker_image_version" + + getDockerVersion xacml-pdp + export POLICY_XACML_PDP_VERSION="$docker_image_version" + + getDockerVersion distribution + export POLICY_DISTRIBUTION_VERSION="$docker_image_version" + + getDockerVersion clamp + export POLICY_CLAMP_VERSION="$docker_image_version" + export POLICY_CLAMP_PPNT_VERSION=$POLICY_CLAMP_VERSION + + getDockerVersion drools-applications + export POLICY_DROOLS_APPS_VERSION="$docker_image_version" +fi
\ No newline at end of file diff --git a/compose/metrics/dashboards/dashboard-apex-pdp.json b/compose/metrics/dashboards/dashboard-apex-pdp.json index e0199a47..d8dc1106 100644 --- a/compose/metrics/dashboards/dashboard-apex-pdp.json +++ b/compose/metrics/dashboards/dashboard-apex-pdp.json @@ -3,7 +3,10 @@ "list": [ { "builtIn": 1, - "datasource": "-- Grafana --", + "datasource": { + "type": "datasource", + "uid": "grafana" + }, "enable": true, "hide": true, "iconColor": "rgba(0, 211, 255, 1)", @@ -22,12 +25,16 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, - "id": 7, + "id": 8, "links": [], "liveNow": false, "panels": [ { "collapsed": false, + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "gridPos": { "h": 1, "w": 24, @@ -36,10 +43,23 @@ }, "id": 19, "panels": [], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "refId": "A" + } + ], "title": "Quick Info", "type": "row" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Uptime per pod for Policy APEX-PDP application calculated in days", "fieldConfig": { "defaults": { @@ -60,7 +80,8 @@ "value": 80 } ] - } + }, + "unit": "s" }, "overrides": [] }, @@ -76,25 +97,29 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "vertical", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [], "fields": "", "values": false }, + "showPercentChange": false, "text": { "titleSize": 16 }, - "textMode": "value_and_name" + "textMode": "value_and_name", + "wideLayout": true }, - "pluginVersion": "8.3.4", + "pluginVersion": "11.1.0", "targets": [ { "datasource": { "type": "prometheus", "uid": "dkSf71fnz" }, + "editorMode": "code", "exemplar": true, - "expr": "(time() - process_start_time_seconds{job=\"apex-pdp-metrics\"}) / 86400", + "expr": "(time() - process_start_time_seconds{job=\"apex-pdp-metrics\"})", "format": "time_series", "instant": false, "interval": "", @@ -103,11 +128,14 @@ } ], "title": "Process Uptime (days)", - "transformations": [], "transparent": true, "type": "stat" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Policy APEX-PDP CPU Usage Monitoring", "fieldConfig": { "defaults": { @@ -170,6 +198,8 @@ }, "id": 26, "options": { + "minVizHeight": 75, + "minVizWidth": 75, "orientation": "auto", "reduceOptions": { "calcs": [ @@ -180,9 +210,10 @@ }, "showThresholdLabels": false, "showThresholdMarkers": false, + "sizing": "auto", "text": {} }, - "pluginVersion": "8.3.4", + "pluginVersion": "11.1.0", "targets": [ { "datasource": { @@ -190,7 +221,7 @@ "uid": "dkSf71fnz" }, "exemplar": true, - "expr": "irate(process_cpu_seconds_total{job=\"apex-pdp-metrics\"}[5m])*100", + "expr": "irate(process_cpu_seconds_total{job=\"apex-pdp-metrics\"}[$__range])*100", "interval": "", "legendFormat": "{{pod}}", "refId": "A" @@ -200,6 +231,10 @@ "type": "gauge" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Policy APEX-PDP Memory Usage Monitoring", "fieldConfig": { "defaults": { @@ -265,6 +300,8 @@ }, "id": 27, "options": { + "minVizHeight": 75, + "minVizWidth": 75, "orientation": "auto", "reduceOptions": { "calcs": [ @@ -274,9 +311,10 @@ "values": false }, "showThresholdLabels": false, - "showThresholdMarkers": false + "showThresholdMarkers": false, + "sizing": "auto" }, - "pluginVersion": "8.3.4", + "pluginVersion": "11.1.0", "targets": [ { "datasource": { @@ -296,6 +334,10 @@ }, { "collapsed": false, + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "gridPos": { "h": 1, "w": 24, @@ -304,10 +346,23 @@ }, "id": 17, "panels": [], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "refId": "A" + } + ], "title": "System", "type": "row" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Policy APEX-PDP CPU Usage Monitoring", "fieldConfig": { "defaults": { @@ -315,6 +370,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -326,6 +384,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineStyle": { "fill": "solid" @@ -395,8 +454,8 @@ ] }, "gridPos": { - "h": 14, - "w": 12, + "h": 8, + "w": 7, "x": 0, "y": 8 }, @@ -410,6 +469,7 @@ ], "displayMode": "table", "placement": "bottom", + "showLegend": true, "sortBy": "Max", "sortDesc": true }, @@ -425,7 +485,7 @@ "uid": "dkSf71fnz" }, "exemplar": true, - "expr": "irate(process_cpu_seconds_total{job=\"apex-pdp-metrics\"}[5m])*100", + "expr": "irate(process_cpu_seconds_total{job=\"apex-pdp-metrics\"}[$__range])*100", "interval": "", "legendFormat": "system: {{pod}}", "refId": "A" @@ -435,6 +495,10 @@ "type": "timeseries" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Policy APEX-PDP Memory Usage Monitoring", "fieldConfig": { "defaults": { @@ -442,6 +506,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -453,6 +520,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineStyle": { "fill": "solid" @@ -522,9 +590,9 @@ ] }, "gridPos": { - "h": 11, - "w": 12, - "x": 12, + "h": 8, + "w": 8, + "x": 7, "y": 8 }, "id": 13, @@ -537,6 +605,7 @@ ], "displayMode": "table", "placement": "bottom", + "showLegend": true, "sortBy": "Last", "sortDesc": false }, @@ -563,6 +632,10 @@ "type": "timeseries" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Policy APEX-PDP JVM Threads", "fieldConfig": { "defaults": { @@ -570,6 +643,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -581,6 +657,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -616,10 +693,10 @@ "overrides": [] }, "gridPos": { - "h": 13, - "w": 12, - "x": 12, - "y": 19 + "h": 8, + "w": 8, + "x": 15, + "y": 8 }, "id": 8, "options": { @@ -630,7 +707,8 @@ "mean" ], "displayMode": "table", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { "mode": "multi", @@ -680,18 +758,35 @@ }, { "collapsed": false, + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 32 + "y": 16 }, "id": 15, "panels": [], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "refId": "A" + } + ], "title": "Garbage Collection", "type": "row" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "GC operations per second", "fieldConfig": { "defaults": { @@ -699,6 +794,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -710,6 +808,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 1, @@ -748,7 +847,7 @@ "h": 8, "w": 12, "x": 0, - "y": 33 + "y": 17 }, "id": 10, "options": { @@ -759,7 +858,8 @@ "last" ], "displayMode": "table", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { "mode": "single", @@ -773,7 +873,7 @@ "uid": "dkSf71fnz" }, "exemplar": true, - "expr": "rate(jvm_gc_collection_seconds_count{job=\"apex-pdp-metrics\"}[5m])", + "expr": "rate(jvm_gc_collection_seconds_count{job=\"apex-pdp-metrics\"}[$__range])", "interval": "", "legendFormat": "{{ gc }} : {{ pod }}", "refId": "A" @@ -783,6 +883,10 @@ "type": "timeseries" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Average GC Time", "fieldConfig": { "defaults": { @@ -790,6 +894,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -801,6 +908,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 1, @@ -838,7 +946,7 @@ "h": 8, "w": 12, "x": 12, - "y": 33 + "y": 17 }, "id": 22, "options": { @@ -847,7 +955,8 @@ "last" ], "displayMode": "table", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { "mode": "single", @@ -861,7 +970,7 @@ "uid": "dkSf71fnz" }, "exemplar": true, - "expr": "rate(jvm_gc_collection_seconds_sum{job=\"apex-pdp-metrics\"}[5m])/rate(jvm_gc_collection_seconds_count{job=\"apex-pdp-metrics\"}[5m])", + "expr": "rate(jvm_gc_collection_seconds_sum{job=\"apex-pdp-metrics\"}[$__range])/rate(jvm_gc_collection_seconds_count{job=\"apex-pdp-metrics\"}[$__range])", "interval": "", "legendFormat": "avg {{ gc }} : {{ pod }}", "refId": "A" @@ -872,18 +981,35 @@ }, { "collapsed": false, + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 41 + "y": 25 }, "id": 21, "panels": [], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "refId": "A" + } + ], "title": "Requests", "type": "row" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Policy Deployments Total for APEX-PDP", "fieldConfig": { "defaults": { @@ -895,8 +1021,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -912,11 +1037,15 @@ "h": 8, "w": 12, "x": 0, - "y": 42 + "y": 26 }, "id": 12, "options": { "displayMode": "gradient", + "maxVizHeight": 300, + "minVizHeight": 16, + "minVizWidth": 8, + "namePlacement": "auto", "orientation": "auto", "reduceOptions": { "calcs": [ @@ -925,9 +1054,11 @@ "fields": "", "values": false }, - "showUnfilled": true + "showUnfilled": true, + "sizing": "auto", + "valueMode": "color" }, - "pluginVersion": "8.3.4", + "pluginVersion": "11.1.0", "targets": [ { "datasource": { @@ -1005,6 +1136,10 @@ "type": "bargauge" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Policy Executions Total for APEX-PDP per instance", "fieldConfig": { "defaults": { @@ -1016,8 +1151,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1033,11 +1167,15 @@ "h": 8, "w": 12, "x": 12, - "y": 42 + "y": 26 }, "id": 30, "options": { "displayMode": "gradient", + "maxVizHeight": 300, + "minVizHeight": 16, + "minVizWidth": 8, + "namePlacement": "auto", "orientation": "auto", "reduceOptions": { "calcs": [ @@ -1046,9 +1184,11 @@ "fields": "", "values": false }, - "showUnfilled": true + "showUnfilled": true, + "sizing": "auto", + "valueMode": "color" }, - "pluginVersion": "8.3.4", + "pluginVersion": "11.1.0", "targets": [ { "datasource": { @@ -1091,18 +1231,35 @@ }, { "collapsed": false, + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 50 + "y": 34 }, "id": 34, "panels": [], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "refId": "A" + } + ], "title": "Engine Stats", "type": "row" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Policy Engine States for APEX-PDP per engine per instance", "fieldConfig": { "defaults": { @@ -1158,13 +1315,14 @@ "h": 8, "w": 12, "x": 0, - "y": 51 + "y": 35 }, "id": 31, "options": { "legend": { "displayMode": "table", "placement": "right", + "showLegend": true, "values": [ "value" ] @@ -1200,6 +1358,10 @@ "type": "piechart" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Uptime per engine for Policy APEX-PDP application calculated in days", "fieldConfig": { "defaults": { @@ -1212,8 +1374,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1229,7 +1390,7 @@ "h": 8, "w": 12, "x": 12, - "y": 51 + "y": 35 }, "id": 32, "options": { @@ -1237,6 +1398,7 @@ "graphMode": "area", "justifyMode": "center", "orientation": "auto", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -1244,9 +1406,11 @@ "fields": "", "values": false }, - "textMode": "auto" + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "8.3.4", + "pluginVersion": "11.1.0", "targets": [ { "datasource": { @@ -1263,60 +1427,30 @@ } ], "title": "Engine Uptime (days)", - "transformations": [], "transparent": true, "type": "stat" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Number of APEX event execution counter per engine thread", "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, - "custom": { - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 + "color": "green" } ] }, - "unit": "ops" + "unit": "none" }, "overrides": [] }, @@ -1324,38 +1458,50 @@ "h": 8, "w": 12, "x": 0, - "y": 59 + "y": 43 }, "id": 35, "options": { - "legend": { - "calcs": [], - "displayMode": "table", - "placement": "right" + "colorMode": "value", + "graphMode": "none", + "justifyMode": "center", + "orientation": "vertical", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false }, - "tooltip": { - "mode": "single", - "sort": "none" - } + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "8.4.5", + "pluginVersion": "11.1.0", "targets": [ { "datasource": { "type": "prometheus", "uid": "dkSf71fnz" }, + "editorMode": "code", "exemplar": true, - "expr": "avg by (engine_instance_id)(rate(pdpa_engine_event_executions{job=\"apex-pdp-metrics\"}[5m]))", + "expr": "pdpa_engine_event_executions{job=\"apex-pdp-metrics\"}", "interval": "", "legendFormat": "{{ engine_instance_id }}", + "range": true, "refId": "A" } ], "title": "Engine Executions", - "type": "timeseries" + "type": "stat" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Average time taken to execute an APEX policy in seconds per engine instance per pod", "fieldConfig": { "defaults": { @@ -1363,6 +1509,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -1374,6 +1523,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -1395,8 +1545,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1412,7 +1561,7 @@ "h": 8, "w": 12, "x": 12, - "y": 59 + "y": 43 }, "id": 36, "options": { @@ -1423,6 +1572,7 @@ ], "displayMode": "table", "placement": "bottom", + "showLegend": true, "sortBy": "Last *", "sortDesc": true }, @@ -1449,79 +1599,98 @@ "type": "timeseries" }, { - "cards": {}, - "color": { - "cardColor": "#b4ff00", - "colorScale": "sqrt", - "colorScheme": "interpolateSpectral", - "exponent": 0.5, - "mode": "spectrum" - }, - "dataFormat": "tsbuckets", + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Time taken to execute the last APEX policy in seconds expressed as a histogram over time", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "fillOpacity": 80, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineWidth": 1, + "stacking": { + "group": "A", + "mode": "none" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "orange", + "value": 80 + } + ] + } + }, + "overrides": [] + }, "gridPos": { "h": 8, "w": 12, "x": 0, - "y": 67 + "y": 51 }, - "heatmap": {}, - "hideZeroBuckets": true, - "highlightCards": true, "id": 38, - "legend": { - "show": true - }, "maxDataPoints": 100, - "reverseYBuckets": false, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + } + }, + "pluginVersion": "11.1.0", "targets": [ { "datasource": { "type": "prometheus", "uid": "dkSf71fnz" }, - "exemplar": true, - "expr": "sum by(le)(increase(pdpa_engine_last_execution_time_bucket{job=\"apex-pdp-metrics\"}[$__interval]))", - "format": "heatmap", + "editorMode": "code", + "exemplar": false, + "expr": "sum (increase(pdpa_engine_last_execution_time_bucket{job=\"apex-pdp-metrics\"}[$__range])) by (le)", + "format": "time_series", + "instant": false, "interval": "", "legendFormat": "{{ le }}", + "range": true, "refId": "A" } ], "title": "Engine Latency distribution", - "tooltip": { - "show": true, - "showHistogram": false - }, - "tooltipDecimals": 0, - "transparent": true, - "type": "heatmap", - "xAxis": { - "show": true - }, - "yAxis": { - "format": "s", - "logBase": 1, - "show": true - }, - "yBucketBound": "upper" + "type": "histogram" } ], "refresh": "", - "schemaVersion": 34, - "style": "dark", + "schemaVersion": 39, "tags": [], "templating": { "list": [] }, "time": { - "from": "now-3h", + "from": "now-30m", "to": "now" }, "timepicker": {}, "timezone": "", - "title": "Policy APEX-PDP Jakarta", + "title": "Policy APEX-PDP", "uid": "DM56uTogk", - "version": 2, + "version": 3, "weekStart": "" }
\ No newline at end of file diff --git a/compose/metrics/dashboards/dashboard-api.json b/compose/metrics/dashboards/dashboard-api.json index 8046cfe4..505477f6 100644 --- a/compose/metrics/dashboards/dashboard-api.json +++ b/compose/metrics/dashboards/dashboard-api.json @@ -3,7 +3,10 @@ "list": [ { "builtIn": 1, - "datasource": "-- Grafana --", + "datasource": { + "type": "datasource", + "uid": "grafana" + }, "enable": true, "hide": true, "iconColor": "rgba(0, 211, 255, 1)", @@ -22,12 +25,16 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, - "id": 1, + "id": 9, "links": [], "liveNow": false, "panels": [ { "collapsed": false, + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "gridPos": { "h": 1, "w": 24, @@ -36,10 +43,23 @@ }, "id": 19, "panels": [], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "refId": "A" + } + ], "title": "Quick Info", "type": "row" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Uptime per pod for Policy API application calculated in days", "fieldConfig": { "defaults": { @@ -60,7 +80,8 @@ "value": 80 } ] - } + }, + "unit": "s" }, "overrides": [] }, @@ -76,23 +97,27 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "auto", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [], "fields": "", "values": false }, + "showPercentChange": false, "text": {}, - "textMode": "value_and_name" + "textMode": "value_and_name", + "wideLayout": true }, - "pluginVersion": "8.3.4", + "pluginVersion": "11.1.0", "targets": [ { "datasource": { "type": "prometheus", "uid": "dkSf71fnz" }, + "editorMode": "code", "exemplar": false, - "expr": "process_uptime_seconds{job=\"api-metrics\"} * 86400", + "expr": "process_uptime_seconds{job=\"api-metrics\"}", "format": "time_series", "instant": false, "interval": "", @@ -101,11 +126,14 @@ } ], "title": "Process Uptime (days)", - "transformations": [], "transparent": true, "type": "stat" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Policy API CPU Usage Monitoring", "fieldConfig": { "defaults": { @@ -168,6 +196,8 @@ }, "id": 26, "options": { + "minVizHeight": 75, + "minVizWidth": 75, "orientation": "auto", "reduceOptions": { "calcs": [ @@ -177,9 +207,10 @@ "values": false }, "showThresholdLabels": false, - "showThresholdMarkers": false + "showThresholdMarkers": false, + "sizing": "auto" }, - "pluginVersion": "8.3.4", + "pluginVersion": "11.1.0", "targets": [ { "datasource": { @@ -197,6 +228,10 @@ "type": "gauge" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Policy API Memory Usage Monitoring", "fieldConfig": { "defaults": { @@ -262,6 +297,8 @@ }, "id": 27, "options": { + "minVizHeight": 75, + "minVizWidth": 75, "orientation": "auto", "reduceOptions": { "calcs": [ @@ -271,9 +308,10 @@ "values": false }, "showThresholdLabels": false, - "showThresholdMarkers": false + "showThresholdMarkers": false, + "sizing": "auto" }, - "pluginVersion": "8.3.4", + "pluginVersion": "11.1.0", "targets": [ { "datasource": { @@ -305,6 +343,10 @@ }, { "collapsed": false, + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "gridPos": { "h": 1, "w": 24, @@ -313,10 +355,23 @@ }, "id": 17, "panels": [], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "refId": "A" + } + ], "title": "System", "type": "row" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Policy API CPU Usage Monitoring", "fieldConfig": { "defaults": { @@ -324,6 +379,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -335,6 +393,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineStyle": { "fill": "solid" @@ -404,8 +463,8 @@ ] }, "gridPos": { - "h": 14, - "w": 12, + "h": 9, + "w": 8, "x": 0, "y": 11 }, @@ -419,6 +478,7 @@ ], "displayMode": "table", "placement": "bottom", + "showLegend": true, "sortBy": "Max", "sortDesc": true }, @@ -457,7 +517,7 @@ "uid": "dkSf71fnz" }, "exemplar": true, - "expr": "avg_over_time(process_cpu_usage{job=\"api-metrics\"}[1h]) * 100", + "expr": "avg_over_time(process_cpu_usage{job=\"api-metrics\"}[$__range]) * 100", "hide": false, "interval": "", "legendFormat": "process_1h: {{pod}}", @@ -468,6 +528,10 @@ "type": "timeseries" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Policy API Memory Usage Monitoring", "fieldConfig": { "defaults": { @@ -475,6 +539,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -486,6 +553,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineStyle": { "fill": "solid" @@ -555,9 +623,9 @@ ] }, "gridPos": { - "h": 11, - "w": 12, - "x": 12, + "h": 9, + "w": 8, + "x": 8, "y": 11 }, "id": 13, @@ -570,6 +638,7 @@ ], "displayMode": "table", "placement": "bottom", + "showLegend": true, "sortBy": "Last", "sortDesc": false }, @@ -608,6 +677,10 @@ "type": "timeseries" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Policy API JVM Threads", "fieldConfig": { "defaults": { @@ -615,6 +688,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -626,6 +702,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -661,10 +738,10 @@ "overrides": [] }, "gridPos": { - "h": 13, - "w": 12, - "x": 12, - "y": 22 + "h": 9, + "w": 7, + "x": 16, + "y": 11 }, "id": 8, "options": { @@ -674,7 +751,8 @@ "last" ], "displayMode": "table", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { "mode": "multi", @@ -724,18 +802,35 @@ }, { "collapsed": false, + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 35 + "y": 20 }, "id": 15, "panels": [], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "refId": "A" + } + ], "title": "Garbage Collection", "type": "row" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "GC operations per second", "fieldConfig": { "defaults": { @@ -743,6 +838,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -754,6 +852,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 1, @@ -792,7 +891,7 @@ "h": 8, "w": 12, "x": 0, - "y": 36 + "y": 21 }, "id": 10, "options": { @@ -803,7 +902,8 @@ "last" ], "displayMode": "table", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { "mode": "single", @@ -817,7 +917,7 @@ "uid": "dkSf71fnz" }, "exemplar": true, - "expr": "rate(jvm_gc_pause_seconds_count{job=\"api-metrics\"}[1h])", + "expr": "rate(jvm_gc_pause_seconds_count{job=\"api-metrics\"}[$__range])", "interval": "", "legendFormat": "{{action}} ({{cause}}) : {{ pod }}", "refId": "A" @@ -827,6 +927,10 @@ "type": "timeseries" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Average GC Time", "fieldConfig": { "defaults": { @@ -834,6 +938,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -845,6 +952,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 1, @@ -882,7 +990,7 @@ "h": 8, "w": 12, "x": 12, - "y": 36 + "y": 21 }, "id": 22, "options": { @@ -891,7 +999,8 @@ "last" ], "displayMode": "table", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { "mode": "single", @@ -905,9 +1014,9 @@ "uid": "dkSf71fnz" }, "exemplar": true, - "expr": "rate(jvm_gc_pause_seconds_sum{job=\"api-metrics\"}[1h])/rate(jvm_gc_pause_seconds_count{job=\"api-metrics\"}[1h])", + "expr": "rate(jvm_gc_pause_seconds_sum{job=\"api-metrics\"}[$__range])/rate(jvm_gc_pause_seconds_count{job=\"api-metrics\"}[$__range])", "interval": "", - "legendFormat": "avg {{action}} ({{cause}}) : {{ pod }}", + "legendFormat": "avg {{action}} ({{cause}})", "refId": "A" } ], @@ -916,18 +1025,35 @@ }, { "collapsed": false, + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 44 + "y": 29 }, "id": 21, "panels": [], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "refId": "A" + } + ], "title": "Requests", "type": "row" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "HTTP API requests rate filtered by URI and REST method", "fieldConfig": { "defaults": { @@ -935,6 +1061,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -946,6 +1075,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineStyle": { "fill": "solid" @@ -970,8 +1100,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -987,7 +1116,7 @@ "h": 8, "w": 12, "x": 0, - "y": 45 + "y": 30 }, "id": 12, "options": { @@ -997,6 +1126,7 @@ ], "displayMode": "table", "placement": "bottom", + "showLegend": true, "sortBy": "Last", "sortDesc": true }, @@ -1012,7 +1142,7 @@ "uid": "dkSf71fnz" }, "exemplar": true, - "expr": "avg by(method,uri) (rate(http_server_requests_seconds_count{job=\"api-metrics\"}[5m]))", + "expr": "avg by(method,uri) (rate(http_server_requests_seconds_count{job=\"api-metrics\"}[$__range]))", "interval": "", "legendFormat": "{{ method }} - {{ uri }}", "refId": "A" @@ -1022,6 +1152,10 @@ "type": "timeseries" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Time taken for an API request filtered by REST method and URI", "fieldConfig": { "defaults": { @@ -1029,6 +1163,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -1040,6 +1177,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineStyle": { "fill": "solid" @@ -1064,8 +1202,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1081,7 +1218,7 @@ "h": 8, "w": 12, "x": 12, - "y": 45 + "y": 30 }, "id": 23, "options": { @@ -1092,6 +1229,7 @@ ], "displayMode": "table", "placement": "bottom", + "showLegend": true, "sortBy": "Last", "sortDesc": true }, @@ -1117,6 +1255,10 @@ "type": "timeseries" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Stats for Policy API Operations", "fieldConfig": { "defaults": { @@ -1128,8 +1270,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1144,11 +1285,15 @@ "h": 8, "w": 12, "x": 0, - "y": 53 + "y": 38 }, "id": 24, "options": { "displayMode": "gradient", + "maxVizHeight": 300, + "minVizHeight": 16, + "minVizWidth": 8, + "namePlacement": "auto", "orientation": "vertical", "reduceOptions": { "calcs": [ @@ -1158,11 +1303,13 @@ "values": false }, "showUnfilled": false, + "sizing": "auto", "text": { "titleSize": 12 - } + }, + "valueMode": "color" }, - "pluginVersion": "8.3.4", + "pluginVersion": "11.1.0", "targets": [ { "datasource": { @@ -1277,6 +1424,10 @@ "type": "bargauge" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Stats for Policy Types API operations", "fieldConfig": { "defaults": { @@ -1288,8 +1439,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1304,11 +1454,15 @@ "h": 8, "w": 12, "x": 12, - "y": 53 + "y": 38 }, "id": 28, "options": { "displayMode": "gradient", + "maxVizHeight": 300, + "minVizHeight": 16, + "minVizWidth": 8, + "namePlacement": "auto", "orientation": "vertical", "reduceOptions": { "calcs": [ @@ -1318,11 +1472,13 @@ "values": false }, "showUnfilled": false, + "sizing": "auto", "text": { "titleSize": 12 - } + }, + "valueMode": "color" }, - "pluginVersion": "8.3.4", + "pluginVersion": "11.1.0", "targets": [ { "datasource": { @@ -1438,20 +1594,19 @@ } ], "refresh": "", - "schemaVersion": 34, - "style": "dark", + "schemaVersion": 39, "tags": [], "templating": { "list": [] }, "time": { - "from": "now-3h", + "from": "now-30m", "to": "now" }, "timepicker": {}, "timezone": "", - "title": "Policy API Jakarta", + "title": "Policy API", "uid": "DM56uKltt", - "version": 2, + "version": 3, "weekStart": "" }
\ No newline at end of file diff --git a/compose/metrics/dashboards/dashboard-distribution.json b/compose/metrics/dashboards/dashboard-distribution.json index 1a53fcbc..21024895 100644 --- a/compose/metrics/dashboards/dashboard-distribution.json +++ b/compose/metrics/dashboards/dashboard-distribution.json @@ -3,7 +3,10 @@ "list": [ { "builtIn": 1, - "datasource": "-- Grafana --", + "datasource": { + "type": "datasource", + "uid": "grafana" + }, "enable": true, "hide": true, "iconColor": "rgba(0, 211, 255, 1)", @@ -22,12 +25,16 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, - "id": 5, + "id": 9, "links": [], "liveNow": false, "panels": [ { "collapsed": false, + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "gridPos": { "h": 1, "w": 24, @@ -36,10 +43,23 @@ }, "id": 19, "panels": [], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "refId": "A" + } + ], "title": "Quick Info", "type": "row" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Uptime for Policy Distribution application", "fieldConfig": { "defaults": { @@ -66,7 +86,7 @@ "overrides": [] }, "gridPos": { - "h": 9, + "h": 8, "w": 8, "x": 0, "y": 1 @@ -77,6 +97,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "auto", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -84,10 +105,12 @@ "fields": "", "values": false }, + "showPercentChange": false, "text": {}, - "textMode": "auto" + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "8.3.4", + "pluginVersion": "11.1.0", "targets": [ { "datasource": { @@ -104,11 +127,14 @@ } ], "title": "Process Uptime", - "transformations": [], "transparent": true, "type": "stat" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Policy Distribution CPU Usage Monitoring", "fieldConfig": { "defaults": { @@ -135,11 +161,13 @@ "gridPos": { "h": 8, "w": 7, - "x": 9, + "x": 8, "y": 1 }, "id": 26, "options": { + "minVizHeight": 75, + "minVizWidth": 75, "orientation": "auto", "reduceOptions": { "calcs": [ @@ -149,9 +177,10 @@ "values": false }, "showThresholdLabels": false, - "showThresholdMarkers": false + "showThresholdMarkers": false, + "sizing": "auto" }, - "pluginVersion": "8.3.4", + "pluginVersion": "11.1.0", "targets": [ { "datasource": { @@ -169,6 +198,10 @@ "type": "gauge" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Policy Distribution Memory Usage Monitoring", "fieldConfig": { "defaults": { @@ -197,12 +230,14 @@ }, "gridPos": { "h": 8, - "w": 6, - "x": 17, + "w": 7, + "x": 15, "y": 1 }, "id": 27, "options": { + "minVizHeight": 75, + "minVizWidth": 75, "orientation": "auto", "reduceOptions": { "calcs": [ @@ -212,9 +247,10 @@ "values": false }, "showThresholdLabels": false, - "showThresholdMarkers": false + "showThresholdMarkers": false, + "sizing": "auto" }, - "pluginVersion": "8.3.4", + "pluginVersion": "11.1.0", "targets": [ { "datasource": { @@ -234,18 +270,35 @@ }, { "collapsed": false, + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 10 + "y": 9 }, "id": 17, "panels": [], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "refId": "A" + } + ], "title": "System", "type": "row" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Policy Distribution CPU Usage Monitoring", "fieldConfig": { "defaults": { @@ -253,6 +306,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -264,6 +320,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineStyle": { "fill": "solid" @@ -302,10 +359,10 @@ "overrides": [] }, "gridPos": { - "h": 14, - "w": 12, + "h": 9, + "w": 8, "x": 0, - "y": 11 + "y": 10 }, "id": 2, "options": { @@ -317,6 +374,7 @@ ], "displayMode": "table", "placement": "bottom", + "showLegend": true, "sortBy": "Max", "sortDesc": true }, @@ -331,41 +389,23 @@ "type": "prometheus", "uid": "dkSf71fnz" }, + "editorMode": "code", "exemplar": true, - "expr": "avg_over_time(process_cpu_seconds_total{job=\"distribution-metrics\"}[1m]) * 100", + "expr": "avg_over_time(process_cpu_seconds_total{job=\"distribution-metrics\"}[$__rate_interval])", "interval": "", "legendFormat": "system: {{pod}}", + "range": true, "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "dkSf71fnz" - }, - "exemplar": true, - "expr": "avg_over_time(process_cpu_seconds_total{job=\"distribution-metrics\"}[5m]) * 100", - "hide": false, - "interval": "", - "legendFormat": "process: {{pod}}", - "refId": "B" - }, - { - "datasource": { - "type": "prometheus", - "uid": "dkSf71fnz" - }, - "exemplar": true, - "expr": "avg_over_time(process_cpu_seconds_total{job=\"distribution-metrics\"}[1h]) * 100", - "hide": false, - "interval": "", - "legendFormat": "process_1h: {{pod}}", - "refId": "C" } ], "title": "CPU Usage", "type": "timeseries" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Policy Distribution Memory Usage Monitoring", "fieldConfig": { "defaults": { @@ -373,6 +413,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -384,6 +427,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineStyle": { "fill": "solid" @@ -422,10 +466,10 @@ "overrides": [] }, "gridPos": { - "h": 11, - "w": 12, - "x": 12, - "y": 11 + "h": 9, + "w": 7, + "x": 8, + "y": 10 }, "id": 13, "options": { @@ -437,6 +481,7 @@ ], "displayMode": "table", "placement": "bottom", + "showLegend": true, "sortBy": "Last", "sortDesc": false }, @@ -463,6 +508,10 @@ "type": "timeseries" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Policy Distribution JVM Threads", "fieldConfig": { "defaults": { @@ -470,6 +519,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -481,6 +533,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -516,10 +569,10 @@ "overrides": [] }, "gridPos": { - "h": 13, - "w": 12, - "x": 12, - "y": 22 + "h": 9, + "w": 7, + "x": 15, + "y": 10 }, "id": 8, "options": { @@ -529,7 +582,8 @@ "last" ], "displayMode": "table", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { "mode": "multi", @@ -579,18 +633,35 @@ }, { "collapsed": false, + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 35 + "y": 19 }, "id": 15, "panels": [], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "refId": "A" + } + ], "title": "Garbage Collection", "type": "row" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "GC operations per second", "fieldConfig": { "defaults": { @@ -598,6 +669,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -609,6 +683,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 1, @@ -647,7 +722,7 @@ "h": 8, "w": 12, "x": 0, - "y": 36 + "y": 20 }, "id": 10, "options": { @@ -658,7 +733,8 @@ "last" ], "displayMode": "table", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { "mode": "single", @@ -671,10 +747,12 @@ "type": "prometheus", "uid": "dkSf71fnz" }, + "editorMode": "code", "exemplar": true, - "expr": "rate(jvm_gc_collection_seconds_count{job=\"distribution-metrics\"}[1h])", + "expr": "rate(jvm_gc_collection_seconds_count{job=\"distribution-metrics\"}[$__range])", "interval": "", "legendFormat": "{{action}} ({{cause}}) : {{ pod }}", + "range": true, "refId": "A" } ], @@ -682,6 +760,10 @@ "type": "timeseries" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Average GC Time", "fieldConfig": { "defaults": { @@ -689,6 +771,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -700,6 +785,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 1, @@ -737,7 +823,7 @@ "h": 8, "w": 12, "x": 12, - "y": 36 + "y": 20 }, "id": 22, "options": { @@ -746,7 +832,8 @@ "last" ], "displayMode": "table", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { "mode": "single", @@ -760,7 +847,7 @@ "uid": "dkSf71fnz" }, "exemplar": true, - "expr": "rate(jvm_gc_collection_seconds_sum{job=\"distribution-metrics\"}[1h])/rate(jvm_gc_collection_seconds_count{job=\"distribution-metrics\"}[1h])", + "expr": "rate(jvm_gc_collection_seconds_sum{job=\"distribution-metrics\"}[$__range])/rate(jvm_gc_collection_seconds_count{job=\"distribution-metrics\"}[$__range])", "interval": "", "legendFormat": "avg {{action}} ({{cause}}) : {{ pod }}", "refId": "A" @@ -771,18 +858,35 @@ }, { "collapsed": false, + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 44 + "y": 28 }, "id": 21, "panels": [], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "refId": "A" + } + ], "title": "Statistics", "type": "row" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Stats for Distribution Statistics Count", "fieldConfig": { "defaults": { @@ -807,14 +911,18 @@ "overrides": [] }, "gridPos": { - "h": 11, - "w": 12, + "h": 7, + "w": 13, "x": 0, - "y": 45 + "y": 29 }, "id": 32, "options": { "displayMode": "gradient", + "maxVizHeight": 300, + "minVizHeight": 16, + "minVizWidth": 8, + "namePlacement": "auto", "orientation": "vertical", "reduceOptions": { "calcs": [ @@ -824,21 +932,25 @@ "values": false }, "showUnfilled": false, + "sizing": "auto", "text": { "titleSize": 12 - } + }, + "valueMode": "color" }, - "pluginVersion": "8.3.4", + "pluginVersion": "11.1.0", "targets": [ { "datasource": { "type": "prometheus", "uid": "dkSf71fnz" }, + "editorMode": "code", "exemplar": true, - "expr": "sum(total_distribution_received_count{job=\"distribution-metrics\"})", + "expr": "sum(total_distribution_received_count_total{job=\"distribution-metrics\"})", "interval": "", "legendFormat": "Total Count", + "range": true, "refId": "A" }, { @@ -858,11 +970,13 @@ "type": "prometheus", "uid": "dkSf71fnz" }, + "editorMode": "code", "exemplar": true, - "expr": "sum(distribution_failure_count{job=\"distribution-metrics\"})", + "expr": "sum(distribution_success_count_total{job=\"distribution-metrics\"})", "hide": false, "interval": "", "legendFormat": "Failure Count", + "range": true, "refId": "C" }, { @@ -870,11 +984,13 @@ "type": "prometheus", "uid": "dkSf71fnz" }, + "editorMode": "code", "exemplar": true, - "expr": "sum(total_download_received_count{job=\"distribution-metrics\"})", + "expr": "sum(total_download_received_count_total{job=\"distribution-metrics\"})", "hide": false, "interval": "", "legendFormat": "Total Download Count", + "range": true, "refId": "D" }, { @@ -882,11 +998,13 @@ "type": "prometheus", "uid": "dkSf71fnz" }, + "editorMode": "code", "exemplar": true, - "expr": "sum(download_success_count{job=\"distribution-metrics\"})", + "expr": "sum(download_success_count_total{job=\"distribution-metrics\"})", "hide": false, "interval": "", "legendFormat": "Download Success Count", + "range": true, "refId": "E" }, { @@ -894,11 +1012,13 @@ "type": "prometheus", "uid": "dkSf71fnz" }, + "editorMode": "code", "exemplar": true, - "expr": "sum(download_failure_count{job=\"distribution-metrics\"})", + "expr": "sum(download_failure_count_total{job=\"distribution-metrics\"})", "hide": false, "interval": "", "legendFormat": "Download Failure Count", + "range": true, "refId": "F" } ], @@ -908,20 +1028,19 @@ } ], "refresh": "", - "schemaVersion": 34, - "style": "dark", + "schemaVersion": 39, "tags": [], "templating": { "list": [] }, "time": { - "from": "now-24h", + "from": "now-30m", "to": "now" }, "timepicker": {}, "timezone": "", "title": "Policy Distribution", "uid": "5HkCopg4z", - "version": 5, + "version": 6, "weekStart": "" }
\ No newline at end of file diff --git a/compose/metrics/dashboards/dashboard-drools-apps.json b/compose/metrics/dashboards/dashboard-drools-apps.json index a8049274..b5f13bfb 100644 --- a/compose/metrics/dashboards/dashboard-drools-apps.json +++ b/compose/metrics/dashboards/dashboard-drools-apps.json @@ -3,7 +3,10 @@ "list": [ { "builtIn": 1, - "datasource": "-- Grafana --", + "datasource": { + "type": "datasource", + "uid": "grafana" + }, "enable": true, "hide": true, "iconColor": "rgba(0, 211, 255, 1)", @@ -22,12 +25,16 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, - "id": 10, + "id": 9, "links": [], "liveNow": false, "panels": [ { - "collapsed": true, + "collapsed": false, + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "gridPos": { "h": 1, "w": 24, @@ -35,1034 +42,1202 @@ "y": 0 }, "id": 19, - "panels": [ + "panels": [], + "targets": [ { - "description": "Uptime per pod for Policy Drools-APPS application calculated in days", - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "refId": "A" + } + ], + "title": "Quick Info", + "type": "row" + }, + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "description": "Uptime per pod for Policy Drools-APPS application calculated in days", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "decimals": 1, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null }, - "decimals": 1, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] + { + "color": "red", + "value": 80 } - }, - "overrides": [] + ] + }, + "unit": "s" + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 6, + "x": 0, + "y": 1 + }, + "id": 4, + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "vertical", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [], + "fields": "", + "values": false + }, + "showPercentChange": false, + "text": { + "titleSize": 16 + }, + "textMode": "value_and_name", + "wideLayout": true + }, + "pluginVersion": "11.1.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" }, - "gridPos": { - "h": 6, - "w": 6, - "x": 0, - "y": 1 + "editorMode": "code", + "exemplar": true, + "expr": "(time() - process_start_time_seconds{job=\"drools-apps-metrics\"})", + "format": "time_series", + "instant": false, + "interval": "", + "legendFormat": " ", + "refId": "A" + } + ], + "title": "Process Uptime", + "transparent": true, + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "description": "Policy Drools-APPS CPU Usage Monitoring", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" }, - "id": 4, - "options": { - "colorMode": "value", - "graphMode": "none", - "justifyMode": "auto", - "orientation": "vertical", - "reduceOptions": { - "calcs": [], - "fields": "", - "values": false - }, - "text": { - "titleSize": 16 - }, - "textMode": "value_and_name" + "decimals": 2, + "mappings": [], + "max": 100, + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] }, - "pluginVersion": "8.3.4", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "dkSf71fnz" - }, - "exemplar": true, - "expr": "(time() - process_start_time_seconds{job=\"drools-apps-metrics\"}) / 86400", - "format": "time_series", - "instant": false, - "interval": "", - "legendFormat": "{{ pod }}", - "refId": "A" - } - ], - "title": "Process Uptime (days)", - "transformations": [], - "transparent": true, - "type": "stat" + "unit": "percent" }, - { - "description": "Policy Drools-APPS CPU Usage Monitoring", - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "decimals": 2, - "mappings": [], - "max": 100, - "min": 0, - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - } - ] - }, - "unit": "percent" + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "process-1h: dev-policy-api-69f54f45cc-wq6xq" }, - "overrides": [ + "properties": [ { - "matcher": { - "id": "byName", - "options": "process-1h: dev-policy-api-69f54f45cc-wq6xq" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "dark-purple", - "mode": "fixed" - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "process_1h: dev-policy-api-69f54f45cc-wq6xq" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "dark-purple", - "mode": "fixed" - } - } - ] + "id": "color", + "value": { + "fixedColor": "dark-purple", + "mode": "fixed" + } } ] }, - "gridPos": { - "h": 6, - "w": 8, - "x": 7, - "y": 1 - }, - "id": 26, - "options": { - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "last" - ], - "fields": "", - "values": false + { + "matcher": { + "id": "byName", + "options": "process_1h: dev-policy-api-69f54f45cc-wq6xq" }, - "showThresholdLabels": false, - "showThresholdMarkers": false, - "text": {} - }, - "pluginVersion": "8.3.4", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "dkSf71fnz" - }, - "exemplar": true, - "expr": "irate(process_cpu_seconds_total{job=\"drools-apps-metrics\"}[5m])*100", - "interval": "", - "legendFormat": "{{pod}}", - "refId": "A" - } + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "dark-purple", + "mode": "fixed" + } + } + ] + } + ] + }, + "gridPos": { + "h": 6, + "w": 8, + "x": 7, + "y": 1 + }, + "id": 26, + "options": { + "minVizHeight": 75, + "minVizWidth": 75, + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "last" ], - "title": "CPU Usage", - "type": "gauge" + "fields": "", + "values": false }, + "showThresholdLabels": false, + "showThresholdMarkers": false, + "sizing": "auto", + "text": {} + }, + "pluginVersion": "11.1.0", + "targets": [ { - "description": "Policy Drools-APPS Memory Usage Monitoring", - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "mappings": [], - "max": 100, - "min": 0, - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "percent" - }, - "overrides": [ + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "editorMode": "code", + "exemplar": true, + "expr": "irate(process_cpu_seconds_total{job=\"drools-apps-metrics\"}[$__range])", + "interval": "", + "legendFormat": "{{pod}}", + "range": true, + "refId": "A" + } + ], + "title": "CPU Usage", + "type": "gauge" + }, + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "description": "Policy Drools-APPS Memory Usage Monitoring", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "mappings": [], + "max": 100, + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ { - "matcher": { - "id": "byName", - "options": "{area=\"heap\", container=\"policy-api\", endpoint=\"policy-api\", id=\"Tenured Gen\", instance=\"10.42.7.19:6969\", job=\"policy-api\", namespace=\"onap\", pod=\"dev-policy-api-69f54f45cc-sb56v\", service=\"policy-api\"}" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "text", - "mode": "fixed" - } - } - ] + "color": "green", + "value": null }, { - "matcher": { - "id": "byName", - "options": "Tenured Gen - dev-policy-api-69f54f45cc-wq6xq" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "dark-purple", - "mode": "fixed" - } - } - ] + "color": "red", + "value": 80 } ] }, - "gridPos": { - "h": 6, - "w": 8, - "x": 16, - "y": 1 - }, - "id": 27, - "options": { - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "last" - ], - "fields": "", - "values": false + "unit": "percent" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "{area=\"heap\", container=\"policy-api\", endpoint=\"policy-api\", id=\"Tenured Gen\", instance=\"10.42.7.19:6969\", job=\"policy-api\", namespace=\"onap\", pod=\"dev-policy-api-69f54f45cc-sb56v\", service=\"policy-api\"}" }, - "showThresholdLabels": false, - "showThresholdMarkers": false + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "text", + "mode": "fixed" + } + } + ] }, - "pluginVersion": "8.3.4", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "dkSf71fnz" - }, - "exemplar": true, - "expr": "100 * jvm_memory_bytes_used{area=\"heap\", job=\"drools-apps-metrics\"} / jvm_memory_bytes_max{area=\"heap\", job=\"drools-apps-metrics\"}", - "hide": false, - "interval": "", - "legendFormat": "Heap : {{ pod }}", - "refId": "A" - } + { + "matcher": { + "id": "byName", + "options": "Tenured Gen - dev-policy-api-69f54f45cc-wq6xq" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "dark-purple", + "mode": "fixed" + } + } + ] + } + ] + }, + "gridPos": { + "h": 6, + "w": 8, + "x": 16, + "y": 1 + }, + "id": 27, + "options": { + "minVizHeight": 75, + "minVizWidth": 75, + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "last" ], - "title": "Memory Usage", - "type": "gauge" + "fields": "", + "values": false + }, + "showThresholdLabels": false, + "showThresholdMarkers": false, + "sizing": "auto" + }, + "pluginVersion": "11.1.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "editorMode": "code", + "exemplar": true, + "expr": "(jvm_memory_bytes_used{area=\"heap\", job=\"drools-apps-metrics\"} / jvm_memory_bytes_max{area=\"heap\", job=\"drools-apps-metrics\"}) * 100", + "hide": false, + "interval": "", + "legendFormat": "__auto", + "range": true, + "refId": "A" } ], - "title": "Quick Info", - "type": "row" + "title": "Memory Usage", + "type": "gauge" }, { - "collapsed": true, + "collapsed": false, + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 1 + "y": 7 }, "id": 17, - "panels": [ + "panels": [], + "targets": [ { - "description": "Policy Drools-APPS CPU Usage Monitoring", - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineStyle": { - "fill": "solid" - }, - "lineWidth": 1, - "pointSize": 1, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "percent" + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "refId": "A" + } + ], + "title": "System", + "type": "row" + }, + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "description": "Policy Drools-APPS CPU Usage Monitoring", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineStyle": { + "fill": "solid" + }, + "lineWidth": 1, + "pointSize": 1, + "scaleDistribution": { + "type": "linear" }, - "overrides": [ + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ { - "matcher": { - "id": "byName", - "options": "process-1h: dev-policy-api-69f54f45cc-wq6xq" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "dark-purple", - "mode": "fixed" - } - } - ] + "color": "green", + "value": null }, { - "matcher": { - "id": "byName", - "options": "process_1h: dev-policy-api-69f54f45cc-wq6xq" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "dark-purple", - "mode": "fixed" - } - } - ] + "color": "red", + "value": 80 } ] }, - "gridPos": { - "h": 14, - "w": 12, - "x": 0, - "y": 2 - }, - "id": 2, - "options": { - "legend": { - "calcs": [ - "max", - "mean", - "last" - ], - "displayMode": "table", - "placement": "bottom", - "sortBy": "Max", - "sortDesc": true + "unit": "percent" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "process-1h: dev-policy-api-69f54f45cc-wq6xq" }, - "tooltip": { - "mode": "single", - "sort": "none" - } + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "dark-purple", + "mode": "fixed" + } + } + ] }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "dkSf71fnz" - }, - "exemplar": true, - "expr": "irate(process_cpu_seconds_total{job=\"drools-apps-metrics\"}[5m])*100", - "interval": "", - "legendFormat": "system: {{pod}}", - "refId": "A" - } + { + "matcher": { + "id": "byName", + "options": "process_1h: dev-policy-api-69f54f45cc-wq6xq" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "dark-purple", + "mode": "fixed" + } + } + ] + } + ] + }, + "gridPos": { + "h": 9, + "w": 8, + "x": 0, + "y": 8 + }, + "id": 2, + "options": { + "legend": { + "calcs": [ + "max", + "mean", + "last" ], - "title": "CPU Usage", - "type": "timeseries" + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "sortBy": "Max", + "sortDesc": true }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ { - "description": "Policy Drools-APPS Memory Usage Monitoring", - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineStyle": { - "fill": "solid" - }, - "lineWidth": 1, - "pointSize": 1, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "percent" + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "editorMode": "code", + "exemplar": true, + "expr": "irate(process_cpu_seconds_total{job=\"drools-apps-metrics\"}[$__range])*100", + "interval": "", + "legendFormat": "system: {{pod}}", + "range": true, + "refId": "A" + } + ], + "title": "CPU Usage", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "description": "Policy Drools-APPS Memory Usage Monitoring", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false }, - "overrides": [ + "insertNulls": false, + "lineInterpolation": "linear", + "lineStyle": { + "fill": "solid" + }, + "lineWidth": 1, + "pointSize": 1, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ { - "matcher": { - "id": "byName", - "options": "{area=\"heap\", container=\"policy-api\", endpoint=\"policy-api\", id=\"Tenured Gen\", instance=\"10.42.7.19:6969\", job=\"policy-api\", namespace=\"onap\", pod=\"dev-policy-api-69f54f45cc-sb56v\", service=\"policy-api\"}" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "text", - "mode": "fixed" - } - } - ] + "color": "green", + "value": null }, { - "matcher": { - "id": "byName", - "options": "Tenured Gen - dev-policy-api-69f54f45cc-wq6xq" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "dark-purple", - "mode": "fixed" - } - } - ] + "color": "red", + "value": 80 } ] }, - "gridPos": { - "h": 11, - "w": 12, - "x": 12, - "y": 2 - }, - "id": 13, - "options": { - "legend": { - "calcs": [ - "max", - "mean", - "last" - ], - "displayMode": "table", - "placement": "bottom", - "sortBy": "Last", - "sortDesc": false + "unit": "percent" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "{area=\"heap\", container=\"policy-api\", endpoint=\"policy-api\", id=\"Tenured Gen\", instance=\"10.42.7.19:6969\", job=\"policy-api\", namespace=\"onap\", pod=\"dev-policy-api-69f54f45cc-sb56v\", service=\"policy-api\"}" }, - "tooltip": { - "mode": "single", - "sort": "none" - } + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "text", + "mode": "fixed" + } + } + ] }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "dkSf71fnz" - }, - "exemplar": true, - "expr": "100 * jvm_memory_bytes_used{area=\"heap\", job=\"drools-apps-metrics\"} / jvm_memory_bytes_max{area=\"heap\", job=\"drools-apps-metrics\"}", - "hide": false, - "interval": "", - "legendFormat": "Heap : {{ pod }}", - "refId": "A" - } + { + "matcher": { + "id": "byName", + "options": "Tenured Gen - dev-policy-api-69f54f45cc-wq6xq" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "dark-purple", + "mode": "fixed" + } + } + ] + } + ] + }, + "gridPos": { + "h": 9, + "w": 8, + "x": 8, + "y": 8 + }, + "id": 13, + "options": { + "legend": { + "calcs": [ + "max", + "mean", + "last" ], - "title": "Memory Usage", - "type": "timeseries" + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "sortBy": "Last", + "sortDesc": false }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ { - "description": "Policy Drools-APPS JVM Threads", - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "never", - "spanNulls": true, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "short" - }, - "overrides": [] + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" }, - "gridPos": { - "h": 13, - "w": 12, - "x": 12, - "y": 13 + "exemplar": true, + "expr": "100 * jvm_memory_bytes_used{area=\"heap\", job=\"drools-apps-metrics\"} / jvm_memory_bytes_max{area=\"heap\", job=\"drools-apps-metrics\"}", + "hide": false, + "interval": "", + "legendFormat": "Heap : {{ pod }}", + "refId": "A" + } + ], + "title": "Memory Usage", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "description": "Policy Drools-APPS JVM Threads", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" }, - "id": 8, - "options": { - "legend": { - "calcs": [ - "max", - "last", - "mean" - ], - "displayMode": "table", - "placement": "bottom" + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false }, - "tooltip": { - "mode": "multi", - "sort": "none" - } - }, - "pluginVersion": "8.4.5", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "dkSf71fnz" - }, - "exemplar": true, - "expr": "jvm_threads_current{job=\"drools-apps-metrics\"}", - "interval": "", - "legendFormat": "Live Threads: {{ pod }}", - "refId": "A" + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" }, - { - "datasource": { - "type": "prometheus", - "uid": "dkSf71fnz" - }, - "exemplar": true, - "expr": "jvm_threads_peak{job=\"drools-apps-metrics\"}", - "hide": false, - "interval": "", - "legendFormat": "Peak Threads: {{ pod }}", - "refId": "B" + "showPoints": "never", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "none" }, - { - "datasource": { - "type": "prometheus", - "uid": "dkSf71fnz" - }, - "exemplar": true, - "expr": "jvm_threads_daemon{job=\"drools-apps-metrics\"}", - "hide": false, - "interval": "", - "legendFormat": "Daemon Threads: {{ pod }}", - "refId": "C" + "thresholdsStyle": { + "mode": "off" } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 7, + "x": 16, + "y": 8 + }, + "id": 8, + "options": { + "legend": { + "calcs": [ + "max", + "last", + "mean" ], - "title": "JVM threads", - "type": "timeseries" + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "8.4.5", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "exemplar": true, + "expr": "jvm_threads_current{job=\"drools-apps-metrics\"}", + "interval": "", + "legendFormat": "Live Threads: {{ pod }}", + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "exemplar": true, + "expr": "jvm_threads_peak{job=\"drools-apps-metrics\"}", + "hide": false, + "interval": "", + "legendFormat": "Peak Threads: {{ pod }}", + "refId": "B" + }, + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "exemplar": true, + "expr": "jvm_threads_daemon{job=\"drools-apps-metrics\"}", + "hide": false, + "interval": "", + "legendFormat": "Daemon Threads: {{ pod }}", + "refId": "C" } ], - "title": "System", - "type": "row" + "title": "JVM threads", + "type": "timeseries" }, { - "collapsed": true, + "collapsed": false, + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 2 + "y": 17 }, "id": 15, - "panels": [ + "panels": [], + "targets": [ { - "description": "GC operations per second", - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 1, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "ops" - }, - "overrides": [] + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" }, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 3 + "refId": "A" + } + ], + "title": "Garbage Collection", + "type": "row" + }, + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "description": "GC operations per second", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" }, - "id": 10, - "options": { - "legend": { - "calcs": [ - "max", - "mean", - "last" - ], - "displayMode": "table", - "placement": "bottom" + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 1, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" }, - "tooltip": { - "mode": "single", - "sort": "none" + "thresholdsStyle": { + "mode": "off" } }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "dkSf71fnz" + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null }, - "exemplar": true, - "expr": "rate(jvm_gc_collection_seconds_count{job=\"drools-apps-metrics\"}[5m])", - "interval": "", - "legendFormat": "{{ gc }} : {{ pod }}", - "refId": "A" - } + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "ops" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 18 + }, + "id": 10, + "options": { + "legend": { + "calcs": [ + "max", + "mean", + "last" ], - "title": "Collection", - "type": "timeseries" + "displayMode": "table", + "placement": "bottom", + "showLegend": true }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ { - "description": "Average GC Time", - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 1, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [] + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" }, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 3 + "editorMode": "code", + "exemplar": true, + "expr": "rate(jvm_gc_collection_seconds_count{job=\"drools-apps-metrics\"}[$__range])", + "interval": "", + "legendFormat": "{{ gc }} : {{ pod }}", + "range": true, + "refId": "A" + } + ], + "title": "Collection", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "description": "Average GC Time", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" }, - "id": 22, - "options": { - "legend": { - "calcs": [ - "last" - ], - "displayMode": "table", - "placement": "bottom" + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 1, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" }, - "tooltip": { - "mode": "single", - "sort": "none" + "thresholdsStyle": { + "mode": "off" } }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "dkSf71fnz" + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null }, - "exemplar": true, - "expr": "rate(jvm_gc_collection_seconds_sum{job=\"drools-apps-metrics\"}[5m])/rate(jvm_gc_collection_seconds_count{job=\"drools-apps-metrics\"}[5m])", - "interval": "", - "legendFormat": "avg {{ gc }} : {{ pod }}", - "refId": "A" - } + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 18 + }, + "id": 22, + "options": { + "legend": { + "calcs": [ + "last" ], - "title": "Pause Durations", - "type": "timeseries" + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "editorMode": "code", + "exemplar": true, + "expr": "rate(jvm_gc_collection_seconds_sum{job=\"drools-apps-metrics\"}[$__range])/rate(jvm_gc_collection_seconds_count{job=\"drools-apps-metrics\"}[$__range])", + "interval": "", + "legendFormat": "avg {{ gc }} : {{ pod }}", + "range": true, + "refId": "A" } ], - "title": "Garbage Collection", - "type": "row" + "title": "Pause Durations", + "type": "timeseries" }, { - "collapsed": true, + "collapsed": false, + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 3 + "y": 26 }, "id": 21, - "panels": [ + "panels": [], + "targets": [ { - "description": "Policy Deployments Total for Drools-APPS", - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "none" - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 4 + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" }, - "id": 12, - "options": { - "displayMode": "gradient", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "showUnfilled": true + "refId": "A" + } + ], + "title": "Requests", + "type": "row" + }, + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "description": "Policy Deployments Total for Drools-APPS", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" }, - "pluginVersion": "8.3.4", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "dkSf71fnz" - }, - "exemplar": true, - "expr": "avg by(job)(pdpd_policy_deployments_total{job=\"drools-apps-metrics\", operation=\"deploy\", status=\"SUCCESS\"})", - "interval": "", - "legendFormat": "Deploy - Success", - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "dkSf71fnz" - }, - "exemplar": true, - "expr": "avg by(job)(pdpd_policy_deployments_total{job=\"drools-apps-metrics\", operation=\"deploy\", status=\"FAILURE\"})", - "hide": false, - "interval": "", - "legendFormat": "Deploy - Failure", - "refId": "B" - }, - { - "datasource": { - "type": "prometheus", - "uid": "dkSf71fnz" - }, - "exemplar": true, - "expr": "avg by(job)(pdpd_policy_deployments_total{job=\"drools-apps-metrics\", operation=\"undeploy\", status=\"SUCCESS\"})", - "hide": false, - "interval": "", - "legendFormat": "Undeploy - Success", - "refId": "D" - }, - { - "datasource": { - "type": "prometheus", - "uid": "dkSf71fnz" + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null }, - "exemplar": true, - "expr": "avg by(job)(pdpd_policy_deployments_total{job=\"drools-apps-metrics\", operation=\"undeploy\", status=\"FAILURE\"})", - "hide": false, - "interval": "", - "legendFormat": "Undeploy - Failure", - "refId": "E" - } + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "none" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 27 + }, + "id": 12, + "options": { + "displayMode": "gradient", + "maxVizHeight": 300, + "minVizHeight": 16, + "minVizWidth": 8, + "namePlacement": "top", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" ], - "title": "Policy Deployments Total", - "type": "bargauge" + "fields": "", + "values": false }, + "showUnfilled": true, + "sizing": "auto", + "valueMode": "color" + }, + "pluginVersion": "11.1.0", + "targets": [ { - "description": "Policy Executions Total for Drools-APPS per instance", - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "none" - }, - "overrides": [] + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" }, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 4 + "editorMode": "code", + "exemplar": true, + "expr": "avg by(job)(pdpd_policy_deployments_total{job=\"drools-apps-metrics\", operation=\"deploy\", status=\"SUCCESS\"})", + "interval": "", + "legendFormat": "Deploy - Success", + "range": true, + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" }, - "id": 30, - "options": { - "displayMode": "gradient", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "showUnfilled": true + "exemplar": true, + "expr": "avg by(job)(pdpd_policy_deployments_total{job=\"drools-apps-metrics\", operation=\"deploy\", status=\"FAILURE\"})", + "hide": false, + "interval": "", + "legendFormat": "Deploy - Failure", + "refId": "B" + }, + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" }, - "pluginVersion": "8.3.4", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "dkSf71fnz" - }, - "exemplar": true, - "expr": "pdpd_policy_executions_latency_seconds_count{job=\"drools-apps-metrics\", status=\"SUCCESS\"}", - "interval": "", - "legendFormat": "Executions - Count", - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "dkSf71fnz" + "exemplar": true, + "expr": "avg by(job)(pdpd_policy_deployments_total{job=\"drools-apps-metrics\", operation=\"undeploy\", status=\"SUCCESS\"})", + "hide": false, + "interval": "", + "legendFormat": "Undeploy - Success", + "refId": "D" + }, + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "exemplar": true, + "expr": "avg by(job)(pdpd_policy_deployments_total{job=\"drools-apps-metrics\", operation=\"undeploy\", status=\"FAILURE\"})", + "hide": false, + "interval": "", + "legendFormat": "Undeploy - Failure", + "refId": "E" + } + ], + "title": "Policy Deployments Total", + "type": "bargauge" + }, + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "description": "Policy Executions Total for Drools-APPS per instance", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null }, - "exemplar": true, - "expr": "pdpd_policy_executions_latency_seconds_sum{job=\"drools-apps-metrics\"}", - "hide": false, - "interval": "", - "legendFormat": "Executions - Sum", - "refId": "B" - } + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "none" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 27 + }, + "id": 30, + "options": { + "displayMode": "gradient", + "maxVizHeight": 300, + "minVizHeight": 16, + "minVizWidth": 8, + "namePlacement": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" ], - "title": "Policy Executions", - "type": "bargauge" + "fields": "", + "values": false + }, + "showUnfilled": false, + "sizing": "auto", + "valueMode": "color" + }, + "pluginVersion": "11.1.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "exemplar": true, + "expr": "pdpd_policy_executions_latency_seconds_count{job=\"drools-apps-metrics\", status=\"SUCCESS\"}", + "interval": "", + "legendFormat": "Executions - Count", + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "editorMode": "code", + "exemplar": true, + "expr": "irate(pdpd_policy_executions_latency_seconds_sum{job=\"drools-apps-metrics\", status=\"SUCCESS\"}[$__range])", + "hide": false, + "interval": "", + "legendFormat": "Executions - Latency (success)", + "range": true, + "refId": "B" + }, + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "editorMode": "code", + "exemplar": true, + "expr": "irate(pdpd_policy_executions_latency_seconds_sum{job=\"drools-apps-metrics\", status=\"FAIL\"}[$__range])", + "hide": false, + "interval": "", + "legendFormat": "Executions - Latency (fail)", + "range": true, + "refId": "C" } ], - "title": "Requests", - "type": "row" + "title": "Policy Executions", + "type": "bargauge" } ], "refresh": "", - "schemaVersion": 34, - "style": "dark", + "schemaVersion": 39, "tags": [], "templating": { "list": [] }, "time": { - "from": "now-3h", + "from": "now-30m", "to": "now" }, "timepicker": {}, "timezone": "", "title": "Policy Drools-APPS", "uid": "i9l6oyz4z", - "version": 3, + "version": 4, "weekStart": "" }
\ No newline at end of file diff --git a/compose/metrics/dashboards/dashboard-drools-pdp.json b/compose/metrics/dashboards/dashboard-drools-pdp.json deleted file mode 100644 index 683d7686..00000000 --- a/compose/metrics/dashboards/dashboard-drools-pdp.json +++ /dev/null @@ -1,1150 +0,0 @@ -{ - "annotations": { - "list": [ - { - "builtIn": 1, - "datasource": "-- Grafana --", - "enable": true, - "hide": true, - "iconColor": "rgba(0, 211, 255, 1)", - "name": "Annotations & Alerts", - "target": { - "limit": 100, - "matchAny": false, - "tags": [], - "type": "dashboard" - }, - "type": "dashboard" - } - ] - }, - "description": "Grafana Dashboard for Policy Drools-PDP", - "editable": true, - "fiscalYearStartMonth": 0, - "graphTooltip": 0, - "id": 9, - "links": [], - "liveNow": false, - "panels": [ - { - "collapsed": false, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 0 - }, - "id": 19, - "panels": [], - "title": "Quick Info", - "type": "row" - }, - { - "description": "Uptime per pod for Policy Drools-PDP application calculated in days", - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "decimals": 1, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 6, - "w": 6, - "x": 0, - "y": 1 - }, - "id": 4, - "options": { - "colorMode": "value", - "graphMode": "none", - "justifyMode": "auto", - "orientation": "vertical", - "reduceOptions": { - "calcs": [], - "fields": "", - "values": false - }, - "text": { - "titleSize": 16 - }, - "textMode": "value_and_name" - }, - "pluginVersion": "8.3.4", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "dkSf71fnz" - }, - "exemplar": true, - "expr": "(time() - process_start_time_seconds{job=\"drools-pdp-metrics\"}) / 86400", - "format": "time_series", - "instant": false, - "interval": "", - "legendFormat": "process_uptime: {{ pod }}", - "refId": "A" - } - ], - "title": "Process Uptime (days)", - "transformations": [], - "transparent": true, - "type": "stat" - }, - { - "description": "Policy Drools-PDP CPU Usage Monitoring", - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "decimals": 2, - "mappings": [], - "max": 100, - "min": 0, - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "percent" - }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "process-1h: dev-policy-api-69f54f45cc-wq6xq" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "dark-purple", - "mode": "fixed" - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "process_1h: dev-policy-api-69f54f45cc-wq6xq" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "dark-purple", - "mode": "fixed" - } - } - ] - } - ] - }, - "gridPos": { - "h": 6, - "w": 8, - "x": 7, - "y": 1 - }, - "id": 26, - "options": { - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "last" - ], - "fields": "", - "values": false - }, - "showThresholdLabels": false, - "showThresholdMarkers": false, - "text": {} - }, - "pluginVersion": "8.3.4", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "dkSf71fnz" - }, - "exemplar": true, - "expr": "irate(process_cpu_seconds_total{job=\"drools-pdp-metrics\"}[5m])*100", - "interval": "", - "legendFormat": "{{pod}}", - "refId": "A" - } - ], - "title": "CPU Usage", - "type": "gauge" - }, - { - "description": "Policy Drools-PDP Memory Usage Monitoring", - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "mappings": [], - "max": 100, - "min": 0, - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "percent" - }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "{area=\"heap\", container=\"policy-api\", endpoint=\"policy-api\", id=\"Tenured Gen\", instance=\"10.42.7.19:6969\", job=\"policy-api\", namespace=\"onap\", pod=\"dev-policy-api-69f54f45cc-sb56v\", service=\"policy-api\"}" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "text", - "mode": "fixed" - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Tenured Gen - dev-policy-api-69f54f45cc-wq6xq" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "dark-purple", - "mode": "fixed" - } - } - ] - } - ] - }, - "gridPos": { - "h": 6, - "w": 8, - "x": 16, - "y": 1 - }, - "id": 27, - "options": { - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "last" - ], - "fields": "", - "values": false - }, - "showThresholdLabels": false, - "showThresholdMarkers": false - }, - "pluginVersion": "8.3.4", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "dkSf71fnz" - }, - "exemplar": true, - "expr": "100 * jvm_memory_bytes_used{area=\"heap\", job=\"drools-pdp-metrics\"} / jvm_memory_bytes_max{area=\"heap\", job=\"drools-pdp-metrics\"}", - "hide": false, - "interval": "", - "legendFormat": "Heap : {{ pod }}", - "refId": "A" - } - ], - "title": "Memory Usage", - "type": "gauge" - }, - { - "collapsed": false, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 7 - }, - "id": 17, - "panels": [], - "title": "System", - "type": "row" - }, - { - "description": "Policy Drools-PDP CPU Usage Monitoring", - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineStyle": { - "fill": "solid" - }, - "lineWidth": 1, - "pointSize": 1, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "percent" - }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "process-1h: dev-policy-api-69f54f45cc-wq6xq" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "dark-purple", - "mode": "fixed" - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "process_1h: dev-policy-api-69f54f45cc-wq6xq" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "dark-purple", - "mode": "fixed" - } - } - ] - } - ] - }, - "gridPos": { - "h": 14, - "w": 12, - "x": 0, - "y": 8 - }, - "id": 2, - "options": { - "legend": { - "calcs": [ - "max", - "mean", - "last" - ], - "displayMode": "table", - "placement": "bottom", - "sortBy": "Max", - "sortDesc": true - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "dkSf71fnz" - }, - "exemplar": true, - "expr": "irate(process_cpu_seconds_total{job=\"drools-pdp-metrics\"}[5m])*100", - "interval": "", - "legendFormat": "system: {{pod}}", - "refId": "A" - } - ], - "title": "CPU Usage", - "type": "timeseries" - }, - { - "description": "Policy Drools-PDP Memory Usage Monitoring", - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineStyle": { - "fill": "solid" - }, - "lineWidth": 1, - "pointSize": 1, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "percent" - }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "{area=\"heap\", container=\"policy-api\", endpoint=\"policy-api\", id=\"Tenured Gen\", instance=\"10.42.7.19:6969\", job=\"policy-api\", namespace=\"onap\", pod=\"dev-policy-api-69f54f45cc-sb56v\", service=\"policy-api\"}" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "text", - "mode": "fixed" - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Tenured Gen - dev-policy-api-69f54f45cc-wq6xq" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "dark-purple", - "mode": "fixed" - } - } - ] - } - ] - }, - "gridPos": { - "h": 11, - "w": 12, - "x": 12, - "y": 8 - }, - "id": 13, - "options": { - "legend": { - "calcs": [ - "max", - "mean", - "last" - ], - "displayMode": "table", - "placement": "bottom", - "sortBy": "Last", - "sortDesc": false - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "dkSf71fnz" - }, - "exemplar": true, - "expr": "100 * jvm_memory_bytes_used{area=\"heap\", job=\"drools-pdp-metrics\"} / jvm_memory_bytes_max{area=\"heap\", job=\"drools-pdp-metrics\"}", - "hide": false, - "interval": "", - "legendFormat": "Heap : {{ pod }}", - "refId": "A" - } - ], - "title": "Memory Usage", - "type": "timeseries" - }, - { - "description": "Policy Drools-PDP JVM Threads", - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "never", - "spanNulls": true, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "gridPos": { - "h": 13, - "w": 12, - "x": 12, - "y": 19 - }, - "id": 8, - "options": { - "legend": { - "calcs": [ - "max", - "last", - "mean" - ], - "displayMode": "table", - "placement": "bottom" - }, - "tooltip": { - "mode": "multi", - "sort": "none" - } - }, - "pluginVersion": "8.4.5", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "dkSf71fnz" - }, - "exemplar": true, - "expr": "jvm_threads_current{job=\"drools-pdp-metrics\"}", - "interval": "", - "legendFormat": "Live Threads: {{ pod }}", - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "dkSf71fnz" - }, - "exemplar": true, - "expr": "jvm_threads_peak{job=\"drools-pdp-metrics\"}", - "hide": false, - "interval": "", - "legendFormat": "Peak Threads: {{ pod }}", - "refId": "B" - }, - { - "datasource": { - "type": "prometheus", - "uid": "dkSf71fnz" - }, - "exemplar": true, - "expr": "jvm_threads_daemon{job=\"policy-drools-pdp\"}", - "hide": false, - "interval": "", - "legendFormat": "Daemon Threads: {{ pod }}", - "refId": "C" - } - ], - "title": "JVM threads", - "type": "timeseries" - }, - { - "collapsed": false, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 32 - }, - "id": 15, - "panels": [], - "title": "Garbage Collection", - "type": "row" - }, - { - "description": "GC operations per second", - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 1, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "ops" - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 33 - }, - "id": 10, - "options": { - "legend": { - "calcs": [ - "max", - "mean", - "last" - ], - "displayMode": "table", - "placement": "bottom" - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "dkSf71fnz" - }, - "exemplar": true, - "expr": "rate(jvm_gc_collection_seconds_count{job=\"drools-pdp-metrics\"}[5m])", - "interval": "", - "legendFormat": "{{ gc }} : {{ pod }}", - "refId": "A" - } - ], - "title": "Collection", - "type": "timeseries" - }, - { - "description": "Average GC Time", - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 1, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 33 - }, - "id": 22, - "options": { - "legend": { - "calcs": [ - "last" - ], - "displayMode": "table", - "placement": "bottom" - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "dkSf71fnz" - }, - "exemplar": true, - "expr": "rate(jvm_gc_collection_seconds_sum{job=\"drools-pdp-metrics\"}[5m])/rate(jvm_gc_collection_seconds_count{job=\"drools-pdp-metrics\"}[5m])", - "interval": "", - "legendFormat": "avg {{ gc }} : {{ pod }}", - "refId": "A" - } - ], - "title": "Pause Durations", - "type": "timeseries" - }, - { - "collapsed": false, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 41 - }, - "id": 21, - "panels": [], - "title": "Requests", - "type": "row" - }, - { - "description": "Policy Deployments Total for Drools-PDP", - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "none" - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 42 - }, - "id": 12, - "options": { - "displayMode": "gradient", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "showUnfilled": true - }, - "pluginVersion": "8.3.4", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "dkSf71fnz" - }, - "exemplar": true, - "expr": "avg by(job)(pdpd_policy_deployments_total{job=\"drools-pdp-metrics\", operation=\"deploy\", status=\"SUCCESS\"})", - "interval": "", - "legendFormat": "Deploy - Success", - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "dkSf71fnz" - }, - "exemplar": true, - "expr": "avg by(job)(pdpd_policy_deployments_total{job=\"drools-pdp-metrics\", operation=\"deploy\", status=\"FAILURE\"})", - "hide": false, - "interval": "", - "legendFormat": "Deploy - Failure", - "refId": "B" - }, - { - "datasource": { - "type": "prometheus", - "uid": "dkSf71fnz" - }, - "exemplar": true, - "expr": "avg by(job)(pdpd_policy_deployments_total{job=\"drools-pdp-metrics\", operation=\"undeploy\", status=\"SUCCESS\"})", - "hide": false, - "interval": "", - "legendFormat": "Undeploy - Success", - "refId": "D" - }, - { - "datasource": { - "type": "prometheus", - "uid": "dkSf71fnz" - }, - "exemplar": true, - "expr": "avg by(job)(pdpd_policy_deployments_total{job=\"drools-pdp-metrics\", operation=\"undeploy\", status=\"FAILURE\"})", - "hide": false, - "interval": "", - "legendFormat": "Undeploy - Failure", - "refId": "E" - } - ], - "title": "Policy Deployments Total", - "type": "bargauge" - }, - { - "description": "Policy Executions Total for Drools-PDP per instance", - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "none" - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 42 - }, - "id": 30, - "options": { - "displayMode": "gradient", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "showUnfilled": true - }, - "pluginVersion": "8.3.4", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "dkSf71fnz" - }, - "exemplar": true, - "expr": "pdpd_policy_executions_latency_seconds_count{job=\"drools-pdp-metrics\"}", - "hide": false, - "interval": "", - "legendFormat": "Executions - Count", - "refId": "B" - }, - { - "datasource": { - "type": "prometheus", - "uid": "dkSf71fnz" - }, - "exemplar": true, - "expr": "pdpd_policy_executions_latency_seconds_sum{job=\"drools-pdp-metrics\"}", - "hide": false, - "interval": "", - "legendFormat": "Executions - Sum", - "refId": "C" - } - ], - "title": "Policy Executions", - "type": "bargauge" - }, - { - "collapsed": false, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 50 - }, - "id": 34, - "panels": [], - "title": "Logging", - "type": "row" - }, - { - "description": "Policy number of log entries for Drool-PDP", - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 24, - "x": 0, - "y": 51 - }, - "id": 36, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto" - }, - "pluginVersion": "8.3.4", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "dkSf71fnz" - }, - "exemplar": true, - "expr": "logback_appender_total{job=\"drools-pdp-metrics\"}", - "interval": "", - "legendFormat": "Level", - "refId": "A" - } - ], - "title": "Logback Total", - "type": "stat" - } - ], - "refresh": "", - "schemaVersion": 34, - "style": "dark", - "tags": [], - "templating": { - "list": [] - }, - "time": { - "from": "now-3h", - "to": "now" - }, - "timepicker": {}, - "timezone": "", - "title": "Policy Drools-PDP", - "uid": "ro24hskVz", - "version": 2, - "weekStart": "" -}
\ No newline at end of file diff --git a/compose/metrics/dashboards/dashboard-for-springboot.json b/compose/metrics/dashboards/dashboard-for-springboot.json index 0eed3f7f..d7654df8 100644 --- a/compose/metrics/dashboards/dashboard-for-springboot.json +++ b/compose/metrics/dashboards/dashboard-for-springboot.json @@ -3,7 +3,10 @@ "list": [ { "builtIn": 1, - "datasource": "-- Grafana --", + "datasource": { + "type": "datasource", + "uid": "grafana" + }, "enable": true, "hide": true, "iconColor": "rgba(0, 211, 255, 1)", @@ -23,13 +26,16 @@ "fiscalYearStartMonth": 0, "gnetId": 14430, "graphTooltip": 0, - "id": 1, - "iteration": 1645635034981, + "id": 5, "links": [], "liveNow": false, "panels": [ { "collapsed": false, + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "gridPos": { "h": 1, "w": 24, @@ -38,6 +44,15 @@ }, "id": 54, "panels": [], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "refId": "A" + } + ], "title": "Basic Statistics", "type": "row" }, @@ -87,13 +102,13 @@ "y": 1 }, "id": 52, - "links": [], "maxDataPoints": 100, "options": { "colorMode": "value", "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -101,11 +116,17 @@ "fields": "", "values": false }, - "textMode": "auto" + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "8.3.4", + "pluginVersion": "11.1.0", "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "expr": "process_uptime_seconds{application=\"$application\",instance=\"$instance\"}", "format": "time_series", "intervalFactor": 2, @@ -163,13 +184,13 @@ "y": 1 }, "id": 56, - "links": [], "maxDataPoints": 100, "options": { "colorMode": "value", "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -177,11 +198,17 @@ "fields": "", "values": false }, - "textMode": "auto" + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "8.3.4", + "pluginVersion": "11.1.0", "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "expr": "process_start_time_seconds{application=\"$application\",instance=\"$instance\"}*1000", "format": "time_series", "intervalFactor": 2, @@ -246,9 +273,10 @@ "y": 1 }, "id": 58, - "links": [], "maxDataPoints": 100, "options": { + "minVizHeight": 75, + "minVizWidth": 75, "orientation": "horizontal", "reduceOptions": { "calcs": [ @@ -258,11 +286,16 @@ "values": false }, "showThresholdLabels": false, - "showThresholdMarkers": true + "showThresholdMarkers": true, + "sizing": "auto" }, - "pluginVersion": "8.3.4", + "pluginVersion": "11.1.0", "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "expr": "sum(jvm_memory_used_bytes{application=\"$application\",instance=\"$instance\",area=\"heap\"})*100/sum(jvm_memory_max_bytes{application=\"$application\",instance=\"$instance\",area=\"heap\"})", "format": "time_series", "intervalFactor": 1, @@ -336,9 +369,10 @@ "y": 1 }, "id": 60, - "links": [], "maxDataPoints": 100, "options": { + "minVizHeight": 75, + "minVizWidth": 75, "orientation": "horizontal", "reduceOptions": { "calcs": [ @@ -348,11 +382,16 @@ "values": false }, "showThresholdLabels": false, - "showThresholdMarkers": true + "showThresholdMarkers": true, + "sizing": "auto" }, - "pluginVersion": "8.3.4", + "pluginVersion": "11.1.0", "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "expr": "sum(jvm_memory_used_bytes{application=\"$application\",instance=\"$instance\",area=\"nonheap\"})*100/sum(jvm_memory_max_bytes{application=\"$application\",instance=\"$instance\",area=\"nonheap\"})", "format": "time_series", "intervalFactor": 2, @@ -365,58 +404,97 @@ "type": "gauge" }, { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, "datasource": { "type": "prometheus", "uid": "dkSf71fnz" }, "fieldConfig": { "defaults": { - "links": [] + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "links": [], + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "short" }, "overrides": [] }, - "fill": 1, - "fillGradient": 0, "gridPos": { "h": 7, "w": 12, "x": 0, "y": 7 }, - "hiddenSeries": false, "id": 95, - "legend": { - "alignAsTable": true, - "avg": true, - "current": true, - "max": true, - "min": true, - "show": true, - "total": false, - "values": true - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", "options": { - "alertThreshold": true + "legend": { + "calcs": [ + "mean", + "lastNotNull", + "max", + "min" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } }, - "percentage": false, "pluginVersion": "8.3.4", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "expr": "system_cpu_usage{instance=\"$instance\",application=\"$application\"}", "format": "time_series", "intervalFactor": 1, @@ -424,6 +502,10 @@ "refId": "A" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "expr": "process_cpu_usage{instance=\"$instance\",application=\"$application\"}", "format": "time_series", "intervalFactor": 1, @@ -431,89 +513,101 @@ "refId": "B" } ], - "thresholds": [], - "timeRegions": [], "title": "CPU Usage", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } + "type": "timeseries" }, { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, "datasource": { "type": "prometheus", "uid": "dkSf71fnz" }, "fieldConfig": { "defaults": { - "links": [] + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "links": [], + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "short" }, "overrides": [] }, - "fill": 1, - "fillGradient": 0, "gridPos": { "h": 7, "w": 12, "x": 12, "y": 7 }, - "hiddenSeries": false, "id": 96, - "legend": { - "alignAsTable": true, - "avg": true, - "current": true, - "max": true, - "min": true, - "show": true, - "total": false, - "values": true - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", "options": { - "alertThreshold": true + "legend": { + "calcs": [ + "mean", + "lastNotNull", + "max", + "min" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } }, - "percentage": false, "pluginVersion": "8.3.4", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "expr": "system_load_average_1m{instance=\"$instance\",application=\"$application\"}", "format": "time_series", "intervalFactor": 1, @@ -521,6 +615,10 @@ "refId": "A" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "expr": "system_cpu_count{instance=\"$instance\",application=\"$application\"}", "format": "time_series", "intervalFactor": 1, @@ -528,35 +626,8 @@ "refId": "B" } ], - "thresholds": [], - "timeRegions": [], "title": "Load Average", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } + "type": "timeseries" }, { "datasource": { @@ -569,6 +640,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -580,6 +654,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -622,20 +697,25 @@ "y": 14 }, "id": 66, - "links": [], "options": { "legend": { "calcs": [], "displayMode": "list", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { - "mode": "single" + "mode": "single", + "sort": "none" } }, "pluginVersion": "8.3.4", "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "expr": "http_server_requests_seconds_count{instance=\"$instance\",application=\"$application\"}", "format": "time_series", "interval": "", @@ -658,6 +738,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -669,6 +752,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -711,20 +795,25 @@ "y": 14 }, "id": 110, - "links": [], "options": { "legend": { "calcs": [], "displayMode": "list", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { - "mode": "single" + "mode": "single", + "sort": "none" } }, "pluginVersion": "8.3.4", "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "expr": "http_server_requests_seconds_sum{instance=\"$instance\",application=\"$application\"}", "format": "time_series", "interval": "", @@ -747,6 +836,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -758,6 +850,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -800,20 +893,25 @@ "y": 14 }, "id": 111, - "links": [], "options": { "legend": { "calcs": [], "displayMode": "list", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { - "mode": "single" + "mode": "single", + "sort": "none" } }, "pluginVersion": "8.3.4", "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "expr": "http_server_requests_seconds_max{instance=\"$instance\",application=\"$application\"}", "format": "time_series", "interval": "", @@ -827,6 +925,10 @@ }, { "collapsed": false, + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "gridPos": { "h": 1, "w": 24, @@ -835,6 +937,15 @@ }, "id": 48, "panels": [], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "refId": "A" + } + ], "title": "JVM Statistics - Memory", "type": "row" }, @@ -849,6 +960,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -860,6 +974,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -902,7 +1017,6 @@ "y": 21 }, "id": 85, - "links": [], "options": { "legend": { "calcs": [ @@ -912,10 +1026,12 @@ "min" ], "displayMode": "table", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { - "mode": "single" + "mode": "single", + "sort": "none" } }, "pluginVersion": "8.3.4", @@ -923,6 +1039,10 @@ "repeatDirection": "h", "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "expr": "jvm_memory_used_bytes{instance=\"$instance\",application=\"$application\",id=\"$memory_pool_heap\"}", "format": "time_series", "intervalFactor": 1, @@ -930,6 +1050,10 @@ "refId": "C" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "expr": "jvm_memory_committed_bytes{instance=\"$instance\",application=\"$application\",id=\"$memory_pool_heap\"}", "format": "time_series", "intervalFactor": 1, @@ -937,6 +1061,10 @@ "refId": "A" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "expr": "jvm_memory_max_bytes{instance=\"$instance\",application=\"$application\",id=\"$memory_pool_heap\"}", "format": "time_series", "intervalFactor": 1, @@ -948,12 +1076,19 @@ "type": "timeseries" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -965,6 +1100,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -1007,7 +1143,6 @@ "y": 31 }, "id": 88, - "links": [], "options": { "legend": { "calcs": [ @@ -1017,10 +1152,12 @@ "min" ], "displayMode": "table", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { - "mode": "single" + "mode": "single", + "sort": "none" } }, "pluginVersion": "8.3.4", @@ -1071,12 +1208,19 @@ "type": "timeseries" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -1088,6 +1232,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -1127,10 +1272,9 @@ "h": 8, "w": 12, "x": 12, - "y": 31 + "y": 41 }, "id": 80, - "links": [], "options": { "legend": { "calcs": [ @@ -1138,10 +1282,12 @@ "max" ], "displayMode": "list", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { - "mode": "single" + "mode": "single", + "sort": "none" } }, "pluginVersion": "8.3.4", @@ -1152,7 +1298,7 @@ "uid": "dkSf71fnz" }, "exemplar": true, - "expr": "irate(jvm_classes_unloaded_classes_total{instance=\"$instance\"}[5m])", + "expr": "irate(jvm_classes_unloaded_classes_total{instance=\"$instance\"}[$__range])", "format": "time_series", "interval": "", "intervalFactor": 1, @@ -1164,12 +1310,19 @@ "type": "timeseries" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -1181,6 +1334,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -1220,18 +1374,19 @@ "h": 7, "w": 12, "x": 12, - "y": 39 + "y": 49 }, "id": 83, - "links": [], "options": { "legend": { "calcs": [], "displayMode": "list", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { - "mode": "single" + "mode": "single", + "sort": "none" } }, "pluginVersion": "8.3.4", @@ -1267,12 +1422,19 @@ "type": "timeseries" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -1284,6 +1446,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -1327,7 +1490,6 @@ "y": 51 }, "id": 50, - "links": [], "options": { "legend": { "calcs": [ @@ -1337,10 +1499,12 @@ "min" ], "displayMode": "table", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { - "mode": "single" + "mode": "single", + "sort": "none" } }, "pluginVersion": "8.3.4", @@ -1363,12 +1527,19 @@ "type": "timeseries" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -1380,6 +1551,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -1422,15 +1594,16 @@ "y": 56 }, "id": 78, - "links": [], "options": { "legend": { "calcs": [], "displayMode": "list", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { - "mode": "single" + "mode": "single", + "sort": "none" } }, "pluginVersion": "8.3.4", @@ -1441,7 +1614,7 @@ "uid": "dkSf71fnz" }, "exemplar": true, - "expr": "irate(jvm_gc_memory_allocated_bytes_total{instance=\"$instance\"}[5m])", + "expr": "irate(jvm_gc_memory_allocated_bytes_total{instance=\"$instance\"}[$__range])", "format": "time_series", "interval": "", "intervalFactor": 1, @@ -1454,7 +1627,7 @@ "uid": "dkSf71fnz" }, "exemplar": true, - "expr": "irate(jvm_gc_memory_promoted_bytes_total{instance=\"$instance\"}[5m])", + "expr": "irate(jvm_gc_memory_promoted_bytes_total{instance=\"$instance\"}[$__range])", "format": "time_series", "interval": "", "intervalFactor": 1, @@ -1476,6 +1649,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -1487,6 +1663,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -1529,20 +1706,25 @@ "y": 59 }, "id": 82, - "links": [], "options": { "legend": { "calcs": [], "displayMode": "list", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { - "mode": "single" + "mode": "single", + "sort": "none" } }, "pluginVersion": "8.3.4", "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "expr": "jvm_buffer_memory_used_bytes{instance=\"$instance\",application=\"$application\",id=\"direct\"}", "format": "time_series", "intervalFactor": 1, @@ -1550,6 +1732,10 @@ "refId": "A" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "expr": "jvm_buffer_total_capacity_bytes{instance=\"$instance\",application=\"$application\",id=\"direct\"}", "format": "time_series", "intervalFactor": 1, @@ -1561,12 +1747,19 @@ "type": "timeseries" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -1578,6 +1771,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -1620,7 +1814,6 @@ "y": 66 }, "id": 68, - "links": [], "options": { "legend": { "calcs": [ @@ -1630,10 +1823,12 @@ "min" ], "displayMode": "table", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { - "mode": "single" + "mode": "single", + "sort": "none" } }, "pluginVersion": "8.3.4", @@ -1683,6 +1878,10 @@ }, { "collapsed": false, + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "gridPos": { "h": 1, "w": 24, @@ -1691,16 +1890,32 @@ }, "id": 72, "panels": [], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "refId": "A" + } + ], "title": "JVM Statistics - GC", "type": "row" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -1712,6 +1927,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -1754,7 +1970,6 @@ "y": 75 }, "id": 74, - "links": [], "options": { "legend": { "calcs": [ @@ -1764,10 +1979,12 @@ "sum" ], "displayMode": "table", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { - "mode": "single" + "mode": "single", + "sort": "none" } }, "pluginVersion": "8.3.4", @@ -1778,7 +1995,7 @@ "uid": "dkSf71fnz" }, "exemplar": true, - "expr": "irate(jvm_gc_pause_seconds_count{instance=\"$instance\"}[5m])", + "expr": "irate(jvm_gc_pause_seconds_count{instance=\"$instance\"}[$__range])", "format": "time_series", "interval": "", "intervalFactor": 1, @@ -1800,6 +2017,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -1811,6 +2031,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -1853,7 +2074,6 @@ "y": 75 }, "id": 76, - "links": [], "options": { "legend": { "calcs": [ @@ -1863,16 +2083,22 @@ "sum" ], "displayMode": "table", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { - "mode": "single" + "mode": "single", + "sort": "none" } }, "pluginVersion": "8.3.4", "targets": [ { - "expr": "irate(jvm_gc_pause_seconds_sum{instance=\"$instance\",application=\"$application\"}[5m])", + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "expr": "irate(jvm_gc_pause_seconds_sum{instance=\"$instance\",application=\"$application\"}[$__range])", "format": "time_series", "intervalFactor": 1, "legendFormat": "{{action}} [{{cause}}]", @@ -1884,6 +2110,10 @@ }, { "collapsed": false, + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "gridPos": { "h": 1, "w": 24, @@ -1892,92 +2122,32 @@ }, "id": 34, "panels": [], - "title": "HikariCP Statistics", - "type": "row" - }, - { - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [ - { - "options": { - "match": "null", - "result": { - "text": "N/A" - } - }, - "type": "special" - } - ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "none" - }, - "overrides": [] - }, - "gridPos": { - "h": 4, - "w": 4, - "x": 0, - "y": 86 - }, - "id": 44, - "links": [], - "maxDataPoints": 100, - "options": { - "colorMode": "none", - "graphMode": "none", - "justifyMode": "auto", - "orientation": "horizontal", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "/^hikaricp_connections{app=\"orders\",app_kubernetes_io_instance=\"mushop\",app_kubernetes_io_name=\"orders\",instance=\"10.1.0.72:80\",job=\"kubernetes-pods\",kubernetes_namespace=\"mushop\",kubernetes_pod_name=\"mushop-orders-67bb8f45c8-5cr5p\",mockmode=\"false\",pod_template_hash=\"67bb8f45c8\",pool=\"HikariPool-1\",version=\"local\"}$/", - "values": false - }, - "textMode": "auto" - }, - "pluginVersion": "8.3.4", "targets": [ { "datasource": { "type": "prometheus", "uid": "dkSf71fnz" }, - "exemplar": true, - "expr": "hikaricp_connections{instance=\"$instance\",application=\"$application\",pool=\"$hikaricp\"}", - "format": "time_series", - "interval": "", - "intervalFactor": 1, - "legendFormat": "", "refId": "A" } ], - "title": "Connections Size", - "type": "stat" + "title": "HikariCP Statistics", + "type": "row" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -1989,6 +2159,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -2026,12 +2197,11 @@ }, "gridPos": { "h": 8, - "w": 20, - "x": 4, + "w": 12, + "x": 0, "y": 86 }, "id": 36, - "links": [], "options": { "legend": { "calcs": [ @@ -2041,10 +2211,12 @@ "min" ], "displayMode": "table", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { - "mode": "single" + "mode": "single", + "sort": "none" } }, "pluginVersion": "8.3.4", @@ -2091,82 +2263,6 @@ "type": "timeseries" }, { - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [ - { - "options": { - "match": "null", - "result": { - "text": "N/A" - } - }, - "type": "special" - } - ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "none" - }, - "overrides": [] - }, - "gridPos": { - "h": 4, - "w": 4, - "x": 0, - "y": 90 - }, - "id": 46, - "links": [], - "maxDataPoints": 100, - "options": { - "colorMode": "none", - "graphMode": "none", - "justifyMode": "auto", - "orientation": "horizontal", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "/^hikaricp_connections_timeout_total{app=\"orders\",app_kubernetes_io_instance=\"mushop\",app_kubernetes_io_name=\"orders\",instance=\"10.1.0.72:80\",job=\"kubernetes-pods\",kubernetes_namespace=\"mushop\",kubernetes_pod_name=\"mushop-orders-67bb8f45c8-5cr5p\",mockmode=\"false\",pod_template_hash=\"67bb8f45c8\",pool=\"HikariPool-1\",version=\"local\"}$/", - "values": false - }, - "textMode": "auto" - }, - "pluginVersion": "8.3.4", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "dkSf71fnz" - }, - "exemplar": true, - "expr": "hikaricp_connections_timeout_total{instance=\"$instance\",application=\"$application\",pool=\"$hikaricp\"}", - "format": "time_series", - "interval": "", - "intervalFactor": 1, - "legendFormat": "", - "refId": "A" - } - ], - "title": "Connection Timeout Count", - "type": "stat" - }, - { "datasource": { "type": "prometheus", "uid": "dkSf71fnz" @@ -2177,6 +2273,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -2188,6 +2287,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -2224,34 +2324,39 @@ "overrides": [] }, "gridPos": { - "h": 6, - "w": 8, - "x": 0, - "y": 94 + "h": 8, + "w": 12, + "x": 12, + "y": 86 }, - "id": 38, - "links": [], + "id": 40, "options": { "legend": { "calcs": [], "displayMode": "list", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { - "mode": "single" + "mode": "single", + "sort": "none" } }, "pluginVersion": "8.3.4", "targets": [ { - "expr": "hikaricp_connections_creation_seconds_sum{instance=\"$instance\",application=\"$application\",pool=\"$hikaricp\"} / hikaricp_connections_creation_seconds_count{instance=\"$instance\",application=\"$application\",pool=\"$hikaricp\"}", + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "expr": "hikaricp_connections_acquire_seconds_sum{instance=\"$instance\",application=\"$application\",pool=\"$hikaricp\"} / hikaricp_connections_acquire_seconds_count{instance=\"$instance\",application=\"$application\",pool=\"$hikaricp\"}", "format": "time_series", "intervalFactor": 1, - "legendFormat": "Creation Time", + "legendFormat": "Acquire Time", "refId": "A" } ], - "title": "Connection Creation Time", + "title": "Connection Acquire Time", "type": "timeseries" }, { @@ -2265,6 +2370,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -2276,6 +2384,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -2314,32 +2423,37 @@ "gridPos": { "h": 6, "w": 8, - "x": 8, + "x": 0, "y": 94 }, - "id": 42, - "links": [], + "id": 38, "options": { "legend": { "calcs": [], "displayMode": "list", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { - "mode": "single" + "mode": "single", + "sort": "none" } }, "pluginVersion": "8.3.4", "targets": [ { - "expr": "hikaricp_connections_usage_seconds_sum{instance=\"$instance\",application=\"$application\",pool=\"$hikaricp\"} / hikaricp_connections_usage_seconds_count{instance=\"$instance\",application=\"$application\",pool=\"$hikaricp\"}", + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "expr": "hikaricp_connections_creation_seconds_sum{instance=\"$instance\",application=\"$application\",pool=\"$hikaricp\"} / hikaricp_connections_creation_seconds_count{instance=\"$instance\",application=\"$application\",pool=\"$hikaricp\"}", "format": "time_series", "intervalFactor": 1, - "legendFormat": "Usage Time", + "legendFormat": "Creation Time", "refId": "A" } ], - "title": "Connection Usage Time", + "title": "Connection Creation Time", "type": "timeseries" }, { @@ -2353,6 +2467,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -2364,6 +2481,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -2402,36 +2520,45 @@ "gridPos": { "h": 6, "w": 8, - "x": 16, + "x": 8, "y": 94 }, - "id": 40, - "links": [], + "id": 42, "options": { "legend": { "calcs": [], "displayMode": "list", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { - "mode": "single" + "mode": "single", + "sort": "none" } }, "pluginVersion": "8.3.4", "targets": [ { - "expr": "hikaricp_connections_acquire_seconds_sum{instance=\"$instance\",application=\"$application\",pool=\"$hikaricp\"} / hikaricp_connections_acquire_seconds_count{instance=\"$instance\",application=\"$application\",pool=\"$hikaricp\"}", + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "expr": "hikaricp_connections_usage_seconds_sum{instance=\"$instance\",application=\"$application\",pool=\"$hikaricp\"} / hikaricp_connections_usage_seconds_count{instance=\"$instance\",application=\"$application\",pool=\"$hikaricp\"}", "format": "time_series", "intervalFactor": 1, - "legendFormat": "Acquire Time", + "legendFormat": "Usage Time", "refId": "A" } ], - "title": "Connection Acquire Time", + "title": "Connection Usage Time", "type": "timeseries" }, { "collapsed": false, + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "gridPos": { "h": 1, "w": 24, @@ -2440,10 +2567,23 @@ }, "id": 101, "panels": [], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "refId": "A" + } + ], "title": "Database Stats", "type": "row" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "", "fieldConfig": { "defaults": { @@ -2483,7 +2623,6 @@ "y": 101 }, "id": 102, - "links": [], "maxDataPoints": 100, "options": { "colorMode": "value", @@ -2495,6 +2634,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "last" @@ -2502,9 +2642,11 @@ "fields": "", "values": false }, - "textMode": "auto" + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "8.3.4", + "pluginVersion": "11.1.0", "targets": [ { "datasource": { @@ -2526,6 +2668,10 @@ "type": "stat" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "", "fieldConfig": { "defaults": { @@ -2565,7 +2711,6 @@ "y": 101 }, "id": 106, - "links": [], "maxDataPoints": 100, "options": { "colorMode": "value", @@ -2577,6 +2722,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "last" @@ -2584,9 +2730,11 @@ "fields": "", "values": false }, - "textMode": "auto" + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "8.3.4", + "pluginVersion": "11.1.0", "targets": [ { "datasource": { @@ -2608,6 +2756,10 @@ "type": "stat" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "", "fieldConfig": { "defaults": { @@ -2647,7 +2799,6 @@ "y": 101 }, "id": 108, - "links": [], "maxDataPoints": 100, "options": { "colorMode": "value", @@ -2659,6 +2810,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "last" @@ -2666,9 +2818,11 @@ "fields": "", "values": false }, - "textMode": "auto" + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "8.3.4", + "pluginVersion": "11.1.0", "targets": [ { "datasource": { @@ -2690,6 +2844,10 @@ "type": "stat" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "", "fieldConfig": { "defaults": { @@ -2697,6 +2855,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -2708,6 +2869,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -2760,7 +2922,6 @@ "y": 104 }, "id": 107, - "links": [], "maxDataPoints": 100, "options": { "legend": { @@ -2770,10 +2931,12 @@ "max" ], "displayMode": "table", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { - "mode": "single" + "mode": "single", + "sort": "none" } }, "pluginVersion": "8.3.4", @@ -2784,7 +2947,7 @@ "uid": "dkSf71fnz" }, "exemplar": true, - "expr": "sum(rate(spring_data_repository_invocations_seconds_max{instance=\"$instance\"}[5m]))", + "expr": "sum(rate(spring_data_repository_invocations_seconds_max{instance=\"$instance\"}[$__range]))", "format": "time_series", "interval": "", "intervalFactor": 1, @@ -2799,6 +2962,10 @@ }, { "collapsed": false, + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "gridPos": { "h": 1, "w": 24, @@ -2807,6 +2974,15 @@ }, "id": 18, "panels": [], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "refId": "A" + } + ], "title": "HTTP Statistics", "type": "row" }, @@ -2821,6 +2997,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -2832,6 +3011,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -2874,21 +3054,26 @@ "y": 113 }, "id": 4, - "links": [], "options": { "legend": { "calcs": [], "displayMode": "table", - "placement": "right" + "placement": "right", + "showLegend": true }, "tooltip": { - "mode": "single" + "mode": "single", + "sort": "none" } }, "pluginVersion": "8.3.4", "targets": [ { - "expr": "irate(http_server_requests_seconds_count{instance=\"$instance\",application=\"$application\",uri!~\".*actuator.*\"}[5m])", + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "expr": "irate(http_server_requests_seconds_count{instance=\"$instance\",application=\"$application\",uri!~\".*actuator.*\"}[$__range])", "format": "time_series", "interval": "", "intervalFactor": 1, @@ -2910,6 +3095,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -2921,6 +3109,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -2963,7 +3152,6 @@ "y": 120 }, "id": 2, - "links": [], "options": { "legend": { "calcs": [ @@ -2972,19 +3160,27 @@ "min" ], "displayMode": "table", - "placement": "right" + "placement": "right", + "showLegend": true }, "tooltip": { - "mode": "single" + "mode": "single", + "sort": "none" } }, "pluginVersion": "8.3.4", "targets": [ { - "expr": "irate(http_server_requests_seconds_sum{instance=\"$instance\",application=\"$application\",exception=\"None\",uri!~\".*actuator.*\"}[5m]) / irate(http_server_requests_seconds_count{instance=\"$instance\",application=\"$application\",exception=\"None\",uri!~\".*actuator.*\"}[5m])", + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "editorMode": "code", + "expr": "irate(http_server_requests_seconds_sum{instance=\"$instance\"}[$__range]) / irate(http_server_requests_seconds_count{instance=\"$instance\"}[$__range])", "format": "time_series", "intervalFactor": 1, "legendFormat": "{{method}} [{{status}}] - {{uri}}", + "range": true, "refId": "A" } ], @@ -2993,6 +3189,10 @@ }, { "collapsed": false, + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "gridPos": { "h": 1, "w": 24, @@ -3001,6 +3201,15 @@ }, "id": 8, "panels": [], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "refId": "A" + } + ], "title": "Logback Statistics", "type": "row" }, @@ -3015,6 +3224,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -3026,6 +3238,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -3068,7 +3281,6 @@ "y": 128 }, "id": 6, - "links": [], "options": { "legend": { "calcs": [ @@ -3079,20 +3291,28 @@ "sum" ], "displayMode": "table", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { - "mode": "single" + "mode": "single", + "sort": "none" } }, "pluginVersion": "8.3.4", "targets": [ { "alias": "", - "expr": "irate(logback_events_total{instance=\"$instance\",application=\"$application\",level=\"info\"}[5m])", + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "editorMode": "code", + "expr": "irate(logback_events_total{instance=\"$instance\",level=\"info\"}[$__range])", "format": "time_series", "intervalFactor": 1, "legendFormat": "info", + "range": true, "rawSql": "SELECT\n $__time(time_column),\n value1\nFROM\n metric_table\nWHERE\n $__timeFilter(time_column)\n", "refId": "A" } @@ -3111,6 +3331,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -3122,6 +3345,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -3164,7 +3388,6 @@ "y": 128 }, "id": 10, - "links": [], "options": { "legend": { "calcs": [ @@ -3175,20 +3398,28 @@ "sum" ], "displayMode": "table", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { - "mode": "single" + "mode": "single", + "sort": "none" } }, "pluginVersion": "8.3.4", "targets": [ { "alias": "", - "expr": "irate(logback_events_total{instance=\"$instance\",application=\"$application\",level=\"error\"}[5m])", + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "editorMode": "code", + "expr": "irate(logback_events_total{instance=\"$instance\",level=\"error\"}[$__range])", "format": "time_series", "intervalFactor": 1, "legendFormat": "error", + "range": true, "rawSql": "SELECT\n $__time(time_column),\n value1\nFROM\n metric_table\nWHERE\n $__timeFilter(time_column)\n", "refId": "A" } @@ -3207,6 +3438,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -3218,6 +3452,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -3240,8 +3475,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -3260,7 +3494,6 @@ "y": 135 }, "id": 14, - "links": [], "options": { "legend": { "calcs": [ @@ -3271,20 +3504,28 @@ "sum" ], "displayMode": "table", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { - "mode": "single" + "mode": "single", + "sort": "none" } }, "pluginVersion": "8.3.4", "targets": [ { "alias": "", - "expr": "irate(logback_events_total{instance=\"$instance\",application=\"$application\",level=\"warn\"}[5m])", + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "editorMode": "code", + "expr": "irate(logback_events_total{instance=\"$instance\",level=\"warn\"}[$__range])", "format": "time_series", "intervalFactor": 1, "legendFormat": "warn", + "range": true, "rawSql": "SELECT\n $__time(time_column),\n value1\nFROM\n metric_table\nWHERE\n $__timeFilter(time_column)\n", "refId": "A" } @@ -3303,6 +3544,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -3314,6 +3558,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -3336,8 +3581,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -3356,7 +3600,6 @@ "y": 135 }, "id": 16, - "links": [], "options": { "legend": { "calcs": [ @@ -3367,17 +3610,23 @@ "sum" ], "displayMode": "table", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { - "mode": "single" + "mode": "single", + "sort": "none" } }, "pluginVersion": "8.3.4", "targets": [ { "alias": "", - "expr": "irate(logback_events_total{instance=\"$instance\",application=\"$application\",level=\"debug\"}[5m])", + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "expr": "irate(logback_events_total{instance=\"$instance\",application=\"$application\",level=\"debug\"}[$__range])", "format": "time_series", "intervalFactor": 1, "legendFormat": "debug", @@ -3399,6 +3648,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -3410,6 +3662,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -3432,8 +3685,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -3452,7 +3704,6 @@ "y": 135 }, "id": 20, - "links": [], "options": { "legend": { "calcs": [ @@ -3463,20 +3714,28 @@ "sum" ], "displayMode": "table", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { - "mode": "single" + "mode": "single", + "sort": "none" } }, "pluginVersion": "8.3.4", "targets": [ { "alias": "", - "expr": "irate(logback_events_total{instance=\"$instance\",application=\"$application\",level=\"trace\"}[5m])", + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "editorMode": "code", + "expr": "irate(logback_events_total{instance=\"$instance\",level=\"trace\"}[$__range])", "format": "time_series", "intervalFactor": 1, "legendFormat": "trace", + "range": true, "rawSql": "SELECT\n $__time(time_column),\n value1\nFROM\n metric_table\nWHERE\n $__timeFilter(time_column)\n", "refId": "A" } @@ -3486,8 +3745,7 @@ } ], "refresh": "10s", - "schemaVersion": 34, - "style": "dark", + "schemaVersion": 39, "tags": [], "templating": { "list": [ @@ -3554,10 +3812,9 @@ }, { "current": { - "isNone": true, "selected": false, - "text": "None", - "value": "" + "text": "HikariPool-1", + "value": "HikariPool-1" }, "datasource": { "type": "prometheus", @@ -3646,7 +3903,7 @@ ] }, "time": { - "from": "now-15m", + "from": "now-30m", "to": "now" }, "timepicker": { @@ -3676,6 +3933,6 @@ "timezone": "", "title": "Spring Boot Statistics & Endpoint Metrics", "uid": "OS7-NUiGz", - "version": 1, + "version": 2, "weekStart": "" }
\ No newline at end of file diff --git a/compose/metrics/dashboards/dashboard-jvm-basic.json b/compose/metrics/dashboards/dashboard-jvm-basic.json index dce01fc8..a7c26052 100644 --- a/compose/metrics/dashboards/dashboard-jvm-basic.json +++ b/compose/metrics/dashboards/dashboard-jvm-basic.json @@ -3,7 +3,10 @@ "list": [ { "builtIn": 1, - "datasource": "-- Grafana --", + "datasource": { + "type": "datasource", + "uid": "grafana" + }, "enable": true, "hide": true, "iconColor": "rgba(0, 211, 255, 1)", @@ -19,7 +22,10 @@ "type": "dashboard" }, { - "datasource": "dkSf71fnz", + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "enable": true, "expr": "resets(process_uptime_seconds{job=\"$job\"}[1m]) > 0", "iconColor": "rgba(255, 96, 96, 1)", @@ -37,13 +43,16 @@ "fiscalYearStartMonth": 0, "gnetId": 4701, "graphTooltip": 1, - "id": 4, - "iteration": 1645634994099, + "id": 5, "links": [], "liveNow": false, "panels": [ { "collapsed": false, + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "gridPos": { "h": 1, "w": 24, @@ -52,10 +61,23 @@ }, "id": 125, "panels": [], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "refId": "A" + } + ], "title": "Quick Facts", "type": "row" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "fieldConfig": { "defaults": { "color": { @@ -97,13 +119,13 @@ "y": 1 }, "id": 63, - "links": [], "maxDataPoints": 100, "options": { "colorMode": "value", "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -111,22 +133,26 @@ "fields": "", "values": false }, - "textMode": "auto" + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "8.3.4", + "pluginVersion": "11.1.0", "targets": [ { "datasource": { "type": "prometheus", "uid": "dkSf71fnz" }, + "editorMode": "code", "exemplar": true, - "expr": "time()-process_start_time_seconds{job=\"$job\"}", + "expr": "(time()-process_start_time_seconds{job=\"$job\"})", "format": "time_series", "interval": "", "intervalFactor": 2, "legendFormat": "", "metric": "", + "range": true, "refId": "A", "step": 14400 } @@ -179,13 +205,13 @@ "y": 1 }, "id": 92, - "links": [], "maxDataPoints": 100, "options": { "colorMode": "value", "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -193,11 +219,17 @@ "fields": "", "values": false }, - "textMode": "auto" + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "8.3.4", + "pluginVersion": "11.1.0", "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "expr": "process_start_time_seconds{job=\"$job\"}*1000", "format": "time_series", "intervalFactor": 2, @@ -211,6 +243,10 @@ "type": "stat" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "fieldConfig": { "defaults": { "color": { @@ -256,13 +292,13 @@ "y": 1 }, "id": 65, - "links": [], "maxDataPoints": 100, "options": { "colorMode": "value", "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -270,9 +306,11 @@ "fields": "", "values": false }, - "textMode": "auto" + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "8.3.4", + "pluginVersion": "11.1.0", "targets": [ { "datasource": { @@ -293,6 +331,10 @@ "type": "stat" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "fieldConfig": { "defaults": { "color": { @@ -348,13 +390,13 @@ "y": 1 }, "id": 75, - "links": [], "maxDataPoints": 100, "options": { "colorMode": "value", "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -362,9 +404,11 @@ "fields": "", "values": false }, - "textMode": "auto" + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "8.3.4", + "pluginVersion": "11.1.0", "targets": [ { "datasource": { @@ -386,6 +430,10 @@ }, { "collapsed": false, + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "gridPos": { "h": 1, "w": 24, @@ -394,16 +442,32 @@ }, "id": 127, "panels": [], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "refId": "A" + } + ], "title": "JVM Memory", "type": "row" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -415,6 +479,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -457,7 +522,6 @@ "y": 5 }, "id": 24, - "links": [], "options": { "legend": { "calcs": [ @@ -465,10 +529,12 @@ "max" ], "displayMode": "list", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { - "mode": "single" + "mode": "single", + "sort": "none" } }, "pluginVersion": "8.3.4", @@ -521,12 +587,19 @@ "type": "timeseries" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -538,6 +611,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -580,7 +654,6 @@ "y": 5 }, "id": 25, - "links": [], "options": { "legend": { "calcs": [ @@ -588,10 +661,12 @@ "max" ], "displayMode": "list", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { - "mode": "single" + "mode": "single", + "sort": "none" } }, "pluginVersion": "8.3.4", @@ -644,12 +719,19 @@ "type": "timeseries" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -661,6 +743,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -703,7 +786,6 @@ "y": 5 }, "id": 26, - "links": [], "options": { "legend": { "calcs": [ @@ -711,10 +793,12 @@ "max" ], "displayMode": "list", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { - "mode": "single" + "mode": "single", + "sort": "none" } }, "pluginVersion": "8.3.4", @@ -767,12 +851,19 @@ "type": "timeseries" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -784,6 +875,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -826,7 +918,6 @@ "y": 5 }, "id": 86, - "links": [], "options": { "legend": { "calcs": [ @@ -834,10 +925,12 @@ "max" ], "displayMode": "list", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { - "mode": "single" + "mode": "single", + "sort": "none" } }, "pluginVersion": "8.3.4", @@ -890,6 +983,10 @@ }, { "collapsed": false, + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "gridPos": { "h": 1, "w": 24, @@ -898,16 +995,32 @@ }, "id": 128, "panels": [], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "refId": "A" + } + ], "title": "JVM Misc", "type": "row" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -919,6 +1032,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -963,7 +1077,6 @@ "y": 13 }, "id": 106, - "links": [], "options": { "legend": { "calcs": [ @@ -971,10 +1084,12 @@ "max" ], "displayMode": "list", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { - "mode": "single" + "mode": "single", + "sort": "none" } }, "pluginVersion": "8.3.4", @@ -984,14 +1099,16 @@ "type": "prometheus", "uid": "dkSf71fnz" }, + "editorMode": "code", "exemplar": true, - "expr": "rate(process_cpu_seconds_total{job=\"$job\"}[5m])", + "expr": "rate(process_cpu_seconds_total{job=\"$job\"}[$__range])", "format": "time_series", "hide": false, "interval": "", "intervalFactor": 1, "legendFormat": "system + process", "metric": "", + "range": true, "refId": "A", "step": 2400 }, @@ -1000,13 +1117,15 @@ "type": "prometheus", "uid": "dkSf71fnz" }, + "editorMode": "code", "exemplar": true, - "expr": "avg_over_time(process_cpu_usage{job=\"$job\"}[1h])", + "expr": "avg_over_time(process_cpu_usage{job=\"$job\"}[$__range])", "format": "time_series", "hide": false, "interval": "", "intervalFactor": 1, "legendFormat": "process-1h", + "range": true, "refId": "C" } ], @@ -1014,12 +1133,19 @@ "type": "timeseries" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -1031,6 +1157,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -1074,17 +1201,18 @@ "y": 13 }, "id": 61, - "links": [], "options": { "legend": { "calcs": [ "lastNotNull" ], "displayMode": "list", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { - "mode": "single" + "mode": "single", + "sort": "none" } }, "pluginVersion": "8.3.4", @@ -1126,12 +1254,19 @@ "type": "timeseries" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -1143,6 +1278,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -1186,17 +1322,18 @@ "y": 13 }, "id": 32, - "links": [], "options": { "legend": { "calcs": [ "lastNotNull" ], "displayMode": "list", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { - "mode": "single" + "mode": "single", + "sort": "none" } }, "pluginVersion": "8.3.4", @@ -1264,12 +1401,19 @@ "type": "timeseries" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -1281,6 +1425,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -1413,17 +1558,18 @@ "y": 13 }, "id": 124, - "links": [], "options": { "legend": { "calcs": [ "lastNotNull" ], "displayMode": "list", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { - "mode": "single" + "mode": "single", + "sort": "none" } }, "pluginVersion": "8.3.4", @@ -1447,6 +1593,10 @@ }, { "collapsed": false, + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "gridPos": { "h": 1, "w": 24, @@ -1456,16 +1606,32 @@ "id": 129, "panels": [], "repeat": "persistence_counts", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "refId": "A" + } + ], "title": "JVM Memory Pools (Heap)", "type": "row" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -1477,6 +1643,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -1519,17 +1686,18 @@ "y": 21 }, "id": 3, - "links": [], "options": { "legend": { "calcs": [ "lastNotNull" ], "displayMode": "list", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { - "mode": "single" + "mode": "single", + "sort": "none" } }, "pluginVersion": "8.3.4", @@ -1589,6 +1757,10 @@ }, { "collapsed": false, + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "gridPos": { "h": 1, "w": 24, @@ -1597,16 +1769,32 @@ }, "id": 130, "panels": [], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "refId": "A" + } + ], "title": "JVM Memory Pools (Non-Heap)", "type": "row" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -1618,6 +1806,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -1660,17 +1849,18 @@ "y": 29 }, "id": 78, - "links": [], "options": { "legend": { "calcs": [ "lastNotNull" ], "displayMode": "list", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { - "mode": "single" + "mode": "single", + "sort": "none" } }, "pluginVersion": "8.3.4", @@ -1730,6 +1920,10 @@ }, { "collapsed": false, + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "gridPos": { "h": 1, "w": 24, @@ -1738,16 +1932,32 @@ }, "id": 131, "panels": [], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "refId": "A" + } + ], "title": "Garbage Collection", "type": "row" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -1759,6 +1969,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -1801,7 +2012,6 @@ "y": 37 }, "id": 98, - "links": [], "options": { "legend": { "calcs": [ @@ -1809,10 +2019,12 @@ "max" ], "displayMode": "list", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { - "mode": "single" + "mode": "single", + "sort": "none" } }, "pluginVersion": "8.3.4", @@ -1822,13 +2034,15 @@ "type": "prometheus", "uid": "dkSf71fnz" }, + "editorMode": "code", "exemplar": true, - "expr": "sum(rate(jvm_gc_collection_seconds_count{job=\"xacml-pdp-metrics\"}[5m]))", + "expr": "sum(rate(jvm_gc_collection_seconds_count{job=\"$job\"}[$__range]))", "format": "time_series", "hide": false, "interval": "", "intervalFactor": 1, "legendFormat": "rate", + "range": true, "refId": "A" } ], @@ -1836,12 +2050,19 @@ "type": "timeseries" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -1853,6 +2074,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -1895,7 +2117,6 @@ "y": 37 }, "id": 101, - "links": [], "options": { "legend": { "calcs": [ @@ -1903,10 +2124,12 @@ "max" ], "displayMode": "list", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { - "mode": "single" + "mode": "single", + "sort": "none" } }, "pluginVersion": "8.3.4", @@ -1917,7 +2140,7 @@ "uid": "dkSf71fnz" }, "exemplar": true, - "expr": "sum(rate(jvm_gc_collection_seconds_sum{job=\"$job\"}[5m]))/sum(rate(jvm_gc_collection_seconds_count{job=\"$job\"}[5m]))", + "expr": "sum(rate(jvm_gc_collection_seconds_sum{job=\"$job\"}[$__range]))/sum(rate(jvm_gc_collection_seconds_count{job=\"$job\"}[$__range]))", "format": "time_series", "hide": false, "instant": false, @@ -1944,12 +2167,19 @@ "type": "timeseries" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -1961,6 +2191,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -2003,7 +2234,6 @@ "y": 37 }, "id": 99, - "links": [], "options": { "legend": { "calcs": [ @@ -2011,10 +2241,12 @@ "max" ], "displayMode": "list", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { - "mode": "single" + "mode": "single", + "sort": "none" } }, "pluginVersion": "8.3.4", @@ -2025,7 +2257,7 @@ "uid": "dkSf71fnz" }, "exemplar": true, - "expr": "sum(rate(jvm_memory_pool_allocated_bytes_total{job=\"$job\"}[5m]))", + "expr": "sum(rate(jvm_memory_pool_allocated_bytes_total{job=\"$job\"}[$__range]))", "format": "time_series", "interval": "", "intervalFactor": 1, @@ -2038,7 +2270,7 @@ "uid": "dkSf71fnz" }, "exemplar": true, - "expr": "sum(rate(jvm_memory_pool_allocated_bytes_created{job=\"$job\"}[5m]))", + "expr": "sum(rate(jvm_memory_pool_allocated_bytes_created{job=\"$job\"}[$__range]))", "format": "time_series", "interval": "", "intervalFactor": 1, @@ -2051,6 +2283,10 @@ }, { "collapsed": false, + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "gridPos": { "h": 1, "w": 24, @@ -2059,16 +2295,32 @@ }, "id": 132, "panels": [], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "refId": "A" + } + ], "title": "Classloading", "type": "row" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -2080,6 +2332,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -2122,7 +2375,6 @@ "y": 45 }, "id": 37, - "links": [], "options": { "legend": { "calcs": [ @@ -2130,10 +2382,12 @@ "max" ], "displayMode": "list", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { - "mode": "single" + "mode": "single", + "sort": "none" } }, "pluginVersion": "8.3.4", @@ -2143,6 +2397,7 @@ "type": "prometheus", "uid": "dkSf71fnz" }, + "editorMode": "code", "exemplar": true, "expr": "jvm_classes_loaded{job=\"$job\"}", "format": "time_series", @@ -2150,20 +2405,45 @@ "intervalFactor": 2, "legendFormat": "loaded", "metric": "", + "range": true, "refId": "A", "step": 1200 + }, + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "disableTextWrap": false, + "editorMode": "code", + "expr": "jvm_classes_loaded_total{job=\"$job\"}", + "fullMetaSearch": false, + "hide": false, + "includeNullMetadata": true, + "instant": false, + "legendFormat": "__auto", + "range": true, + "refId": "B", + "useBackend": false } ], "title": "Classes loaded", "type": "timeseries" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -2175,6 +2455,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -2216,7 +2497,6 @@ "y": 45 }, "id": 38, - "links": [], "options": { "legend": { "calcs": [ @@ -2224,10 +2504,12 @@ "max" ], "displayMode": "list", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { - "mode": "single" + "mode": "single", + "sort": "none" } }, "pluginVersion": "8.3.4", @@ -2237,16 +2519,36 @@ "type": "prometheus", "uid": "dkSf71fnz" }, + "editorMode": "code", "exemplar": true, - "expr": "delta(jvm_classes_loaded{job=\"$job\"}[5m])", + "expr": "delta(jvm_classes_loaded_classes{job=\"$job\"}[$__range])", "format": "time_series", "hide": false, "interval": "", "intervalFactor": 1, "legendFormat": "delta-1m", "metric": "", + "range": true, "refId": "A", "step": 1200 + }, + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "editorMode": "code", + "exemplar": true, + "expr": "delta(jvm_classes_loaded_total{job=\"$job\"}[$__range])", + "format": "time_series", + "hide": false, + "interval": "", + "intervalFactor": 1, + "legendFormat": "delta-1m", + "metric": "", + "range": true, + "refId": "B", + "step": 1200 } ], "title": "Class delta", @@ -2254,6 +2556,10 @@ }, { "collapsed": false, + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "gridPos": { "h": 1, "w": 24, @@ -2262,16 +2568,32 @@ }, "id": 133, "panels": [], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "refId": "A" + } + ], "title": "Buffer Pools", "type": "row" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -2283,6 +2605,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -2325,17 +2648,18 @@ "y": 53 }, "id": 33, - "links": [], "options": { "legend": { "calcs": [ "lastNotNull" ], "displayMode": "list", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { - "mode": "single" + "mode": "single", + "sort": "none" } }, "pluginVersion": "8.3.4", @@ -2375,12 +2699,19 @@ "type": "timeseries" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -2392,6 +2723,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -2435,7 +2767,6 @@ "y": 53 }, "id": 83, - "links": [], "options": { "legend": { "calcs": [ @@ -2443,10 +2774,12 @@ "max" ], "displayMode": "list", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { - "mode": "single" + "mode": "single", + "sort": "none" } }, "pluginVersion": "8.3.4", @@ -2471,12 +2804,19 @@ "type": "timeseries" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -2488,6 +2828,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -2530,7 +2871,6 @@ "y": 53 }, "id": 85, - "links": [], "options": { "legend": { "calcs": [ @@ -2538,10 +2878,12 @@ "max" ], "displayMode": "list", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { - "mode": "single" + "mode": "single", + "sort": "none" } }, "pluginVersion": "8.3.4", @@ -2577,16 +2919,23 @@ "step": 2400 } ], - "title": "Mapped Buffers", + "title": "Mapped Buffers (Bytes)", "type": "timeseries" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -2598,6 +2947,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -2641,7 +2991,6 @@ "y": 53 }, "id": 84, - "links": [], "options": { "legend": { "calcs": [ @@ -2649,10 +2998,12 @@ "max" ], "displayMode": "list", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { - "mode": "single" + "mode": "single", + "sort": "none" } }, "pluginVersion": "8.3.4", @@ -2678,16 +3029,15 @@ } ], "refresh": "30s", - "schemaVersion": 34, - "style": "dark", + "schemaVersion": 39, "tags": [], "templating": { "list": [ { "current": { "selected": false, - "text": "apex-pdp-metrics", - "value": "apex-pdp-metrics" + "text": "xacml-pdp-metrics", + "value": "xacml-pdp-metrics" }, "datasource": { "type": "prometheus", @@ -2716,7 +3066,7 @@ ] }, "time": { - "from": "now-24h", + "from": "now-30m", "to": "now" }, "timepicker": { @@ -2748,6 +3098,6 @@ "timezone": "browser", "title": "JVM Basic Metrics", "uid": "SLdKRfB7z", - "version": 1, + "version": 2, "weekStart": "" }
\ No newline at end of file diff --git a/compose/metrics/dashboards/dashboard-pap.json b/compose/metrics/dashboards/dashboard-pap.json index 275fe83c..13e03f6a 100644 --- a/compose/metrics/dashboards/dashboard-pap.json +++ b/compose/metrics/dashboards/dashboard-pap.json @@ -3,7 +3,10 @@ "list": [ { "builtIn": 1, - "datasource": "-- Grafana --", + "datasource": { + "type": "datasource", + "uid": "grafana" + }, "enable": true, "hide": true, "iconColor": "rgba(0, 211, 255, 1)", @@ -22,12 +25,16 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, - "id": 4, + "id": 6, "links": [], "liveNow": false, "panels": [ { "collapsed": false, + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "gridPos": { "h": 1, "w": 24, @@ -36,10 +43,23 @@ }, "id": 19, "panels": [], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "refId": "A" + } + ], "title": "Quick Info", "type": "row" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Uptime per pod for Policy PAP application calculated in days", "fieldConfig": { "defaults": { @@ -60,7 +80,8 @@ "value": 80 } ] - } + }, + "unit": "s" }, "overrides": [] }, @@ -76,23 +97,27 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "auto", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [], "fields": "", "values": false }, + "showPercentChange": false, "text": {}, - "textMode": "value_and_name" + "textMode": "value_and_name", + "wideLayout": true }, - "pluginVersion": "8.3.4", + "pluginVersion": "11.1.0", "targets": [ { "datasource": { "type": "prometheus", "uid": "dkSf71fnz" }, + "editorMode": "code", "exemplar": true, - "expr": "process_uptime_seconds{job=\"pap-metrics\"} / 86400", + "expr": "process_uptime_seconds{job=\"pap-metrics\"}", "format": "time_series", "instant": false, "interval": "", @@ -101,11 +126,14 @@ } ], "title": "Process Uptime (days)", - "transformations": [], "transparent": true, "type": "stat" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Policy PAP CPU Usage Monitoring", "fieldConfig": { "defaults": { @@ -168,6 +196,8 @@ }, "id": 26, "options": { + "minVizHeight": 75, + "minVizWidth": 75, "orientation": "auto", "reduceOptions": { "calcs": [ @@ -178,9 +208,10 @@ }, "showThresholdLabels": false, "showThresholdMarkers": false, + "sizing": "auto", "text": {} }, - "pluginVersion": "8.3.4", + "pluginVersion": "11.1.0", "targets": [ { "datasource": { @@ -198,6 +229,10 @@ "type": "gauge" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Policy PAP Memory Usage Monitoring", "fieldConfig": { "defaults": { @@ -258,11 +293,13 @@ "gridPos": { "h": 6, "w": 8, - "x": 15, + "x": 14, "y": 1 }, "id": 27, "options": { + "minVizHeight": 75, + "minVizWidth": 75, "orientation": "auto", "reduceOptions": { "calcs": [ @@ -272,9 +309,10 @@ "values": false }, "showThresholdLabels": false, - "showThresholdMarkers": false + "showThresholdMarkers": false, + "sizing": "auto" }, - "pluginVersion": "8.3.4", + "pluginVersion": "11.1.0", "targets": [ { "datasource": { @@ -306,6 +344,10 @@ }, { "collapsed": false, + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "gridPos": { "h": 1, "w": 24, @@ -314,10 +356,23 @@ }, "id": 17, "panels": [], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "refId": "A" + } + ], "title": "System", "type": "row" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Policy PAP CPU Usage Monitoring", "fieldConfig": { "defaults": { @@ -325,6 +380,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -336,6 +394,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineStyle": { "fill": "solid" @@ -405,8 +464,8 @@ ] }, "gridPos": { - "h": 14, - "w": 12, + "h": 9, + "w": 8, "x": 0, "y": 8 }, @@ -420,6 +479,7 @@ ], "displayMode": "table", "placement": "bottom", + "showLegend": true, "sortBy": "Max", "sortDesc": true }, @@ -458,7 +518,7 @@ "uid": "dkSf71fnz" }, "exemplar": true, - "expr": "avg_over_time(process_cpu_usage{job=\"pap-metrics\"}[1h]) * 100", + "expr": "avg_over_time(process_cpu_usage{job=\"pap-metrics\"}[$__range]) * 100", "hide": false, "interval": "", "legendFormat": "process_1h: {{pod}}", @@ -469,6 +529,10 @@ "type": "timeseries" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Policy PAP Memory Usage Monitoring", "fieldConfig": { "defaults": { @@ -476,6 +540,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -487,6 +554,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineStyle": { "fill": "solid" @@ -556,9 +624,9 @@ ] }, "gridPos": { - "h": 11, - "w": 12, - "x": 12, + "h": 9, + "w": 7, + "x": 8, "y": 8 }, "id": 13, @@ -571,6 +639,7 @@ ], "displayMode": "table", "placement": "bottom", + "showLegend": true, "sortBy": "Last", "sortDesc": false }, @@ -609,6 +678,10 @@ "type": "timeseries" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Policy PAP JVM Threads", "fieldConfig": { "defaults": { @@ -616,6 +689,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -627,6 +703,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -662,10 +739,10 @@ "overrides": [] }, "gridPos": { - "h": 13, - "w": 12, - "x": 12, - "y": 19 + "h": 9, + "w": 7, + "x": 15, + "y": 8 }, "id": 8, "options": { @@ -675,7 +752,8 @@ "last" ], "displayMode": "table", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { "mode": "multi", @@ -725,18 +803,35 @@ }, { "collapsed": false, + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 32 + "y": 17 }, "id": 15, "panels": [], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "refId": "A" + } + ], "title": "Garbage Collection", "type": "row" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "GC operations per second", "fieldConfig": { "defaults": { @@ -744,6 +839,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -755,6 +853,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 1, @@ -793,7 +892,7 @@ "h": 8, "w": 12, "x": 0, - "y": 33 + "y": 18 }, "id": 10, "options": { @@ -804,7 +903,8 @@ "last" ], "displayMode": "table", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { "mode": "single", @@ -818,7 +918,7 @@ "uid": "dkSf71fnz" }, "exemplar": true, - "expr": "rate(jvm_gc_pause_seconds_count{job=\"pap-metrics\"}[1h])", + "expr": "rate(jvm_gc_pause_seconds_count{job=\"pap-metrics\"}[$__range])", "interval": "", "legendFormat": "{{action}} ({{cause}}) : {{ pod }}", "refId": "A" @@ -828,6 +928,10 @@ "type": "timeseries" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Average GC Time", "fieldConfig": { "defaults": { @@ -835,6 +939,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -846,6 +953,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 1, @@ -883,7 +991,7 @@ "h": 8, "w": 12, "x": 12, - "y": 33 + "y": 18 }, "id": 22, "options": { @@ -892,7 +1000,8 @@ "last" ], "displayMode": "table", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { "mode": "single", @@ -906,7 +1015,7 @@ "uid": "dkSf71fnz" }, "exemplar": true, - "expr": "rate(jvm_gc_pause_seconds_sum{job=\"pap-metrics\"}[1h])/rate(jvm_gc_pause_seconds_count{job=\"pap-metrics\"}[1h])", + "expr": "rate(jvm_gc_pause_seconds_sum{job=\"pap-metrics\"}[$__range])/rate(jvm_gc_pause_seconds_count{job=\"pap-metrics\"}[$__range])", "interval": "", "legendFormat": "avg {{action}} ({{cause}}) : {{ pod }}", "refId": "A" @@ -917,18 +1026,35 @@ }, { "collapsed": false, + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 41 + "y": 26 }, "id": 21, "panels": [], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "refId": "A" + } + ], "title": "Requests", "type": "row" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Total number of PAP requests per second filtered by URI and REST method", "fieldConfig": { "defaults": { @@ -936,6 +1062,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -947,6 +1076,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineStyle": { "fill": "solid" @@ -971,8 +1101,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -988,7 +1117,7 @@ "h": 8, "w": 12, "x": 0, - "y": 42 + "y": 27 }, "id": 12, "options": { @@ -998,6 +1127,7 @@ ], "displayMode": "table", "placement": "bottom", + "showLegend": true, "sortBy": "Last", "sortDesc": true }, @@ -1014,7 +1144,7 @@ "uid": "dkSf71fnz" }, "exemplar": true, - "expr": "avg by(method,uri) (rate(http_server_requests_seconds_count{job=\"pap-metrics\"}[5m]))", + "expr": "avg by(method,uri) (rate(http_server_requests_seconds_count{job=\"pap-metrics\"}[$__range]))", "interval": "", "legendFormat": "{{ method }} - {{ uri }}", "refId": "A" @@ -1024,6 +1154,10 @@ "type": "timeseries" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Time taken for PAP request filtered by REST method and URI", "fieldConfig": { "defaults": { @@ -1031,6 +1165,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -1042,6 +1179,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineStyle": { "fill": "solid" @@ -1066,8 +1204,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1083,7 +1220,7 @@ "h": 8, "w": 12, "x": 12, - "y": 42 + "y": 27 }, "id": 23, "options": { @@ -1094,6 +1231,7 @@ ], "displayMode": "table", "placement": "bottom", + "showLegend": true, "sortBy": "Max", "sortDesc": true }, @@ -1119,6 +1257,10 @@ "type": "timeseries" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Percentage of PAP calls that passed filtered by method and URI", "fieldConfig": { "defaults": { @@ -1130,8 +1272,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1147,10 +1288,12 @@ "h": 11, "w": 12, "x": 0, - "y": 50 + "y": 35 }, "id": 29, "options": { + "minVizHeight": 75, + "minVizWidth": 75, "orientation": "auto", "reduceOptions": { "calcs": [ @@ -1161,11 +1304,12 @@ }, "showThresholdLabels": false, "showThresholdMarkers": true, + "sizing": "auto", "text": { "titleSize": 12 } }, - "pluginVersion": "8.3.4", + "pluginVersion": "11.1.0", "targets": [ { "datasource": { @@ -1183,6 +1327,10 @@ "type": "gauge" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Stats for Policy PAP Deployment/Undeployment Operations", "fieldConfig": { "defaults": { @@ -1194,8 +1342,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1210,11 +1357,15 @@ "h": 11, "w": 12, "x": 12, - "y": 50 + "y": 35 }, "id": 24, "options": { "displayMode": "gradient", + "maxVizHeight": 300, + "minVizHeight": 16, + "minVizWidth": 8, + "namePlacement": "auto", "orientation": "vertical", "reduceOptions": { "calcs": [ @@ -1224,11 +1375,13 @@ "values": false }, "showUnfilled": false, + "sizing": "auto", "text": { "titleSize": 12 - } + }, + "valueMode": "color" }, - "pluginVersion": "8.3.4", + "pluginVersion": "11.1.0", "targets": [ { "datasource": { @@ -1309,20 +1462,19 @@ } ], "refresh": "", - "schemaVersion": 34, - "style": "dark", + "schemaVersion": 39, "tags": [], "templating": { "list": [] }, "time": { - "from": "now-3h", + "from": "now-30m", "to": "now" }, "timepicker": {}, "timezone": "", - "title": "Policy PAP Jakarta", + "title": "Policy PAP", "uid": "DM56uKldd", - "version": 2, + "version": 3, "weekStart": "" }
\ No newline at end of file diff --git a/compose/metrics/dashboards/dashboard-xacml-pdp.json b/compose/metrics/dashboards/dashboard-xacml-pdp.json index a1c10c5b..75b776bf 100644 --- a/compose/metrics/dashboards/dashboard-xacml-pdp.json +++ b/compose/metrics/dashboards/dashboard-xacml-pdp.json @@ -3,7 +3,10 @@ "list": [ { "builtIn": 1, - "datasource": "-- Grafana --", + "datasource": { + "type": "datasource", + "uid": "grafana" + }, "enable": true, "hide": true, "iconColor": "rgba(0, 211, 255, 1)", @@ -22,12 +25,16 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, - "id": 5, + "id": 6, "links": [], "liveNow": false, "panels": [ { "collapsed": false, + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "gridPos": { "h": 1, "w": 24, @@ -36,10 +43,23 @@ }, "id": 19, "panels": [], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "refId": "A" + } + ], "title": "Quick Info", "type": "row" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Uptime per pod for Policy XACML-PDP application calculated in days", "fieldConfig": { "defaults": { @@ -60,7 +80,8 @@ "value": 80 } ] - } + }, + "unit": "s" }, "overrides": [] }, @@ -76,25 +97,29 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "vertical", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [], "fields": "", "values": false }, + "showPercentChange": false, "text": { "titleSize": 16 }, - "textMode": "value_and_name" + "textMode": "value_and_name", + "wideLayout": true }, - "pluginVersion": "8.3.4", + "pluginVersion": "11.1.0", "targets": [ { "datasource": { "type": "prometheus", "uid": "dkSf71fnz" }, + "editorMode": "code", "exemplar": true, - "expr": "(time() - process_start_time_seconds{job=\"xacml-pdp-metrics\"}) / 86400", + "expr": "(time() - process_start_time_seconds{job=\"xacml-pdp-metrics\"})", "format": "time_series", "instant": false, "interval": "", @@ -102,12 +127,15 @@ "refId": "A" } ], - "title": "Process Uptime (days)", - "transformations": [], + "title": "Process Uptime", "transparent": true, "type": "stat" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Policy XACML-PDP CPU Usage Monitoring", "fieldConfig": { "defaults": { @@ -164,12 +192,14 @@ }, "gridPos": { "h": 6, - "w": 8, - "x": 7, + "w": 6, + "x": 6, "y": 1 }, "id": 26, "options": { + "minVizHeight": 75, + "minVizWidth": 75, "orientation": "auto", "reduceOptions": { "calcs": [ @@ -180,9 +210,10 @@ }, "showThresholdLabels": false, "showThresholdMarkers": false, + "sizing": "auto", "text": {} }, - "pluginVersion": "8.3.4", + "pluginVersion": "11.1.0", "targets": [ { "datasource": { @@ -190,7 +221,7 @@ "uid": "dkSf71fnz" }, "exemplar": true, - "expr": "irate(process_cpu_seconds_total{job=\"xacml-pdp-metrics\"}[5m])*100", + "expr": "irate(process_cpu_seconds_total{job=\"xacml-pdp-metrics\"}[$__range])*100", "interval": "", "legendFormat": "{{pod}}", "refId": "A" @@ -200,6 +231,10 @@ "type": "gauge" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Policy XACML-PDP Memory Usage Monitoring", "fieldConfig": { "defaults": { @@ -259,12 +294,14 @@ }, "gridPos": { "h": 6, - "w": 8, - "x": 16, + "w": 6, + "x": 12, "y": 1 }, "id": 27, "options": { + "minVizHeight": 75, + "minVizWidth": 75, "orientation": "auto", "reduceOptions": { "calcs": [ @@ -274,9 +311,10 @@ "values": false }, "showThresholdLabels": false, - "showThresholdMarkers": false + "showThresholdMarkers": false, + "sizing": "auto" }, - "pluginVersion": "8.3.4", + "pluginVersion": "11.1.0", "targets": [ { "datasource": { @@ -296,6 +334,10 @@ }, { "collapsed": false, + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "gridPos": { "h": 1, "w": 24, @@ -304,10 +346,23 @@ }, "id": 17, "panels": [], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "refId": "A" + } + ], "title": "System", "type": "row" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Policy XACML-PDP CPU Usage Monitoring", "fieldConfig": { "defaults": { @@ -315,6 +370,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -326,6 +384,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineStyle": { "fill": "solid" @@ -395,8 +454,8 @@ ] }, "gridPos": { - "h": 14, - "w": 12, + "h": 9, + "w": 8, "x": 0, "y": 8 }, @@ -410,6 +469,7 @@ ], "displayMode": "table", "placement": "bottom", + "showLegend": true, "sortBy": "Max", "sortDesc": true }, @@ -424,10 +484,12 @@ "type": "prometheus", "uid": "dkSf71fnz" }, + "editorMode": "code", "exemplar": true, - "expr": "irate(process_cpu_seconds_total{job=\"xacml-pdp-metrics\"}[5m])*100", + "expr": "irate(process_cpu_seconds_total{job=\"xacml-pdp-metrics\"}[$__range])*100", "interval": "", "legendFormat": "system: {{pod}}", + "range": true, "refId": "A" } ], @@ -435,6 +497,10 @@ "type": "timeseries" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Policy XACML-PDP Memory Usage Monitoring", "fieldConfig": { "defaults": { @@ -442,6 +508,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -453,6 +522,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineStyle": { "fill": "solid" @@ -522,9 +592,9 @@ ] }, "gridPos": { - "h": 11, - "w": 12, - "x": 12, + "h": 9, + "w": 7, + "x": 8, "y": 8 }, "id": 13, @@ -537,6 +607,7 @@ ], "displayMode": "table", "placement": "bottom", + "showLegend": true, "sortBy": "Last", "sortDesc": false }, @@ -551,11 +622,13 @@ "type": "prometheus", "uid": "dkSf71fnz" }, + "editorMode": "code", "exemplar": true, - "expr": "100 * jvm_memory_bytes_used{area=\"heap\", job=\"xacml-pdp-metrics\"} / jvm_memory_bytes_max{area=\"heap\", job=\"xacml-pdp-metrics\"}", + "expr": "100 * (jvm_memory_bytes_used{area=\"heap\", job=\"xacml-pdp-metrics\"} / jvm_memory_bytes_max{area=\"heap\", job=\"xacml-pdp-metrics\"})", "hide": false, "interval": "", "legendFormat": "Heap : {{ pod }}", + "range": true, "refId": "A" } ], @@ -563,6 +636,10 @@ "type": "timeseries" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Policy XACML-PDP JVM Threads", "fieldConfig": { "defaults": { @@ -570,6 +647,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -581,6 +661,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -616,10 +697,10 @@ "overrides": [] }, "gridPos": { - "h": 13, - "w": 12, - "x": 12, - "y": 19 + "h": 9, + "w": 8, + "x": 15, + "y": 8 }, "id": 8, "options": { @@ -630,7 +711,8 @@ "mean" ], "displayMode": "table", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { "mode": "multi", @@ -680,18 +762,35 @@ }, { "collapsed": false, + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 32 + "y": 17 }, "id": 15, "panels": [], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "refId": "A" + } + ], "title": "Garbage Collection", "type": "row" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "GC operations per second", "fieldConfig": { "defaults": { @@ -699,6 +798,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -710,6 +812,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 1, @@ -748,7 +851,7 @@ "h": 8, "w": 12, "x": 0, - "y": 33 + "y": 18 }, "id": 10, "options": { @@ -759,7 +862,8 @@ "last" ], "displayMode": "table", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { "mode": "single", @@ -772,10 +876,12 @@ "type": "prometheus", "uid": "dkSf71fnz" }, + "editorMode": "code", "exemplar": true, - "expr": "rate(jvm_gc_collection_seconds_count{job=\"xacml-pdp-metrics\"}[5m])", + "expr": "rate(jvm_gc_collection_seconds_count{job=\"xacml-pdp-metrics\"}[$__range])", "interval": "", "legendFormat": "{{ gc }} : {{ pod }}", + "range": true, "refId": "A" } ], @@ -783,6 +889,10 @@ "type": "timeseries" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Average GC Time", "fieldConfig": { "defaults": { @@ -790,6 +900,9 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -801,6 +914,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 1, @@ -838,7 +952,7 @@ "h": 8, "w": 12, "x": 12, - "y": 33 + "y": 18 }, "id": 22, "options": { @@ -847,7 +961,8 @@ "last" ], "displayMode": "table", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { "mode": "single", @@ -860,10 +975,12 @@ "type": "prometheus", "uid": "dkSf71fnz" }, + "editorMode": "code", "exemplar": true, - "expr": "rate(jvm_gc_collection_seconds_sum{job=\"xacml-pdp-metrics\"}[5m])/rate(jvm_gc_collection_seconds_count{job=\"xacml-pdp-metrics\"}[5m])", + "expr": "rate(jvm_gc_collection_seconds_sum{job=\"xacml-pdp-metrics\"}[$__range])/rate(jvm_gc_collection_seconds_count{job=\"xacml-pdp-metrics\"}[$__range])", "interval": "", "legendFormat": "avg {{ gc }} : {{ pod }}", + "range": true, "refId": "A" } ], @@ -872,18 +989,35 @@ }, { "collapsed": false, + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 41 + "y": 26 }, "id": 21, "panels": [], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "refId": "A" + } + ], "title": "Requests", "type": "row" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Policy Deployments Total for XACML-PDP", "fieldConfig": { "defaults": { @@ -912,11 +1046,15 @@ "h": 8, "w": 12, "x": 0, - "y": 42 + "y": 27 }, "id": 12, "options": { "displayMode": "gradient", + "maxVizHeight": 300, + "minVizHeight": 16, + "minVizWidth": 8, + "namePlacement": "auto", "orientation": "auto", "reduceOptions": { "calcs": [ @@ -925,9 +1063,11 @@ "fields": "", "values": false }, - "showUnfilled": true + "showUnfilled": true, + "sizing": "auto", + "valueMode": "color" }, - "pluginVersion": "8.3.4", + "pluginVersion": "11.1.0", "targets": [ { "datasource": { @@ -981,6 +1121,10 @@ "type": "bargauge" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Policy Decisions Total for XACML-PDP per instance", "fieldConfig": { "defaults": { @@ -1009,11 +1153,15 @@ "h": 8, "w": 12, "x": 12, - "y": 42 + "y": 27 }, "id": 30, "options": { "displayMode": "gradient", + "maxVizHeight": 300, + "minVizHeight": 16, + "minVizWidth": 8, + "namePlacement": "auto", "orientation": "auto", "reduceOptions": { "calcs": [ @@ -1022,9 +1170,11 @@ "fields": "", "values": false }, - "showUnfilled": true + "showUnfilled": true, + "sizing": "auto", + "valueMode": "color" }, - "pluginVersion": "8.3.4", + "pluginVersion": "11.1.0", "targets": [ { "datasource": { @@ -1065,98 +1215,22 @@ ], "title": "Policy Decisions", "type": "bargauge" - }, - { - "collapsed": false, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 50 - }, - "id": 34, - "panels": [], - "title": "Logging", - "type": "row" - }, - { - "description": "Policy number of log entries for XACML-PDP", - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 24, - "x": 0, - "y": 51 - }, - "id": 36, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto" - }, - "pluginVersion": "8.3.4", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "dkSf71fnz" - }, - "exemplar": true, - "expr": "logback_appender_total{job=\"xacml-pdp-metrics\"}", - "interval": "", - "legendFormat": "Level", - "refId": "A" - } - ], - "title": "Logback Total", - "type": "stat" } ], "refresh": "", - "schemaVersion": 34, - "style": "dark", + "schemaVersion": 39, "tags": [], "templating": { "list": [] }, "time": { - "from": "now-3h", + "from": "now-30m", "to": "now" }, "timepicker": {}, "timezone": "", "title": "Policy XACML-PDP", "uid": "Fk_2HkmVk", - "version": 2, + "version": 3, "weekStart": "" }
\ No newline at end of file diff --git a/compose/metrics/dashboards/sla-metrics.json b/compose/metrics/dashboards/sla-metrics.json index 5287b546..d48be38f 100644 --- a/compose/metrics/dashboards/sla-metrics.json +++ b/compose/metrics/dashboards/sla-metrics.json @@ -3,7 +3,10 @@ "list": [ { "builtIn": 1, - "datasource": "-- Grafana --", + "datasource": { + "type": "datasource", + "uid": "grafana" + }, "enable": true, "hide": true, "iconColor": "rgba(0, 211, 255, 1)", @@ -24,12 +27,15 @@ "gnetId": 14430, "graphTooltip": 0, "id": 3, - "iteration": 1673599566103, "links": [], "liveNow": false, "panels": [ { "collapsed": false, + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "gridPos": { "h": 1, "w": 24, @@ -38,10 +44,23 @@ }, "id": 54, "panels": [], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "refId": "A" + } + ], "title": "Basic Statistics", "type": "row" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "fieldConfig": { "defaults": { "color": { @@ -83,13 +102,13 @@ "y": 1 }, "id": 52, - "links": [], "maxDataPoints": 100, "options": { "colorMode": "value", "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -97,9 +116,11 @@ "fields": "", "values": false }, - "textMode": "auto" + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "8.3.4", + "pluginVersion": "11.1.0", "targets": [ { "datasource": { @@ -121,6 +142,10 @@ "type": "stat" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "fieldConfig": { "defaults": { "color": { @@ -161,13 +186,13 @@ "y": 1 }, "id": 56, - "links": [], "maxDataPoints": 100, "options": { "colorMode": "value", "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -175,9 +200,11 @@ "fields": "", "values": false }, - "textMode": "auto" + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "8.3.4", + "pluginVersion": "11.1.0", "targets": [ { "datasource": { @@ -199,6 +226,10 @@ "type": "stat" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "fieldConfig": { "defaults": { "color": { @@ -246,9 +277,10 @@ "y": 7 }, "id": 58, - "links": [], "maxDataPoints": 100, "options": { + "minVizHeight": 75, + "minVizWidth": 75, "orientation": "horizontal", "reduceOptions": { "calcs": [ @@ -258,9 +290,10 @@ "values": false }, "showThresholdLabels": false, - "showThresholdMarkers": true + "showThresholdMarkers": true, + "sizing": "auto" }, - "pluginVersion": "8.3.4", + "pluginVersion": "11.1.0", "targets": [ { "datasource": { @@ -281,6 +314,10 @@ "type": "gauge" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "fieldConfig": { "defaults": { "color": { @@ -338,9 +375,10 @@ "y": 7 }, "id": 60, - "links": [], "maxDataPoints": 100, "options": { + "minVizHeight": 75, + "minVizWidth": 75, "orientation": "horizontal", "reduceOptions": { "calcs": [ @@ -350,9 +388,10 @@ "values": false }, "showThresholdLabels": false, - "showThresholdMarkers": true + "showThresholdMarkers": true, + "sizing": "auto" }, - "pluginVersion": "8.3.4", + "pluginVersion": "11.1.0", "targets": [ { "datasource": { @@ -373,12 +412,19 @@ "type": "gauge" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -390,6 +436,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -432,7 +479,6 @@ "y": 13 }, "id": 96, - "links": [], "options": { "legend": { "calcs": [ @@ -442,10 +488,12 @@ "min" ], "displayMode": "table", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { - "mode": "single" + "mode": "single", + "sort": "none" } }, "pluginVersion": "8.3.4", @@ -481,12 +529,19 @@ "type": "timeseries" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -498,6 +553,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -540,7 +596,6 @@ "y": 21 }, "id": 95, - "links": [], "options": { "legend": { "calcs": [ @@ -550,10 +605,12 @@ "min" ], "displayMode": "table", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { - "mode": "single" + "mode": "single", + "sort": "none" } }, "pluginVersion": "8.3.4", @@ -589,6 +646,10 @@ "type": "timeseries" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "fieldConfig": { "defaults": { "color": { @@ -627,8 +688,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -655,7 +715,8 @@ "max" ], "displayMode": "table", - "placement": "right" + "placement": "right", + "showLegend": true }, "tooltip": { "mode": "single" @@ -679,6 +740,10 @@ }, { "collapsed": false, + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "gridPos": { "h": 1, "w": 24, @@ -687,10 +752,23 @@ }, "id": 18, "panels": [], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "refId": "A" + } + ], "title": "HTTP Statistics", "type": "row" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "fieldConfig": { "defaults": { "color": { @@ -730,8 +808,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -750,7 +827,6 @@ "y": 37 }, "id": 4, - "links": [], "options": { "legend": { "calcs": [ @@ -758,7 +834,8 @@ "sum" ], "displayMode": "table", - "placement": "right" + "placement": "right", + "showLegend": true }, "tooltip": { "mode": "single" @@ -772,7 +849,7 @@ "uid": "dkSf71fnz" }, "exemplar": true, - "expr": "rate(http_server_requests_seconds_count{uri!~\".*metrics.*|.*prometheus.*\"}[5m])", + "expr": "rate(http_server_requests_seconds_count{uri!~\".*metrics.*|.*prometheus.*\"}[$__range])", "format": "time_series", "interval": "", "intervalFactor": 1, @@ -784,6 +861,10 @@ "type": "timeseries" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "fieldConfig": { "defaults": { "color": { @@ -823,8 +904,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -843,7 +923,6 @@ "y": 47 }, "id": 2, - "links": [], "options": { "legend": { "calcs": [ @@ -853,7 +932,8 @@ "lastNotNull" ], "displayMode": "table", - "placement": "right" + "placement": "right", + "showLegend": true }, "tooltip": { "mode": "single" @@ -867,7 +947,7 @@ "uid": "dkSf71fnz" }, "exemplar": true, - "expr": "irate(http_server_requests_seconds_sum{job=~\"api-metrics|acm-metrics|pap-metrics\",outcome=\"SUCCESS\",uri!~\".*metrics.*|.*prometheus.*\"}[5m]) / irate(http_server_requests_seconds_count{job=~\"api-metrics|acm-metrics|pap-metrics\",outcome=\"SUCCESS\",uri!~\".*metrics.*|.*prometheus.*\"}[5m])", + "expr": "irate(http_server_requests_seconds_sum{job=~\"api-metrics|acm-metrics|pap-metrics\",outcome=\"SUCCESS\",uri!~\".*metrics.*|.*prometheus.*\"}[$__range]) / irate(http_server_requests_seconds_count{job=~\"api-metrics|acm-metrics|pap-metrics\",outcome=\"SUCCESS\",uri!~\".*metrics.*|.*prometheus.*\"}[$__range])", "format": "time_series", "interval": "", "intervalFactor": 1, @@ -879,6 +959,10 @@ "type": "timeseries" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "fieldConfig": { "defaults": { "color": { @@ -918,8 +1002,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -938,7 +1021,6 @@ "y": 57 }, "id": 111, - "links": [], "options": { "legend": { "calcs": [ @@ -946,7 +1028,8 @@ "max" ], "displayMode": "table", - "placement": "right" + "placement": "right", + "showLegend": true }, "tooltip": { "mode": "single" @@ -973,6 +1056,10 @@ }, { "collapsed": false, + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "gridPos": { "h": 1, "w": 24, @@ -981,10 +1068,23 @@ }, "id": 115, "panels": [], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "refId": "A" + } + ], "title": "Deployment statistics", "type": "row" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "fieldConfig": { "defaults": { "mappings": [], @@ -992,8 +1092,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1044,6 +1143,10 @@ "type": "stat" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "fieldConfig": { "defaults": { "mappings": [], @@ -1051,8 +1154,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1103,6 +1205,10 @@ "type": "stat" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "fieldConfig": { "defaults": { "mappings": [], @@ -1110,8 +1216,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1162,6 +1267,10 @@ "type": "stat" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "fieldConfig": { "defaults": { "mappings": [], @@ -1169,8 +1278,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1221,6 +1329,10 @@ "type": "stat" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Policy Executions Total for APEX-PDP", "fieldConfig": { "defaults": { @@ -1229,8 +1341,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1305,6 +1416,10 @@ "type": "stat" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "fieldConfig": { "defaults": { "color": { @@ -1343,8 +1458,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1371,7 +1485,8 @@ "max" ], "displayMode": "table", - "placement": "right" + "placement": "right", + "showLegend": true }, "tooltip": { "mode": "single" @@ -1384,7 +1499,7 @@ "uid": "dkSf71fnz" }, "exemplar": true, - "expr": "irate(pap_policy_deployments_seconds_sum[5m])/irate(pap_policy_deployments_seconds_count[5m])", + "expr": "irate(pap_policy_deployments_seconds_sum[$__range])/irate(pap_policy_deployments_seconds_count[$__range])", "interval": "", "legendFormat": "{{operation}} - {{status}}", "refId": "A" @@ -1395,6 +1510,10 @@ }, { "collapsed": false, + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "gridPos": { "h": 1, "w": 24, @@ -1403,10 +1522,23 @@ }, "id": 124, "panels": [], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, + "refId": "A" + } + ], "title": "Apex-PDP", "type": "row" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "fieldConfig": { "defaults": { "color": { @@ -1448,8 +1580,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1504,6 +1635,10 @@ "type": "stat" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "", "fieldConfig": { "defaults": { @@ -1516,8 +1651,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1571,10 +1705,13 @@ } ], "title": "Engine Uptime (since last start)", - "transformations": [], "type": "stat" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Number of APEX event execution counter per engine thread", "fieldConfig": { "defaults": { @@ -1614,8 +1751,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1642,7 +1778,8 @@ "max" ], "displayMode": "table", - "placement": "right" + "placement": "right", + "showLegend": true }, "tooltip": { "mode": "single", @@ -1657,7 +1794,7 @@ "uid": "dkSf71fnz" }, "exemplar": true, - "expr": "rate(pdpa_engine_average_execution_time_seconds{job=\"apex-pdp-metrics\"}[5m])", + "expr": "rate(pdpa_engine_average_execution_time_seconds{job=\"apex-pdp-metrics\"}[$__range])", "format": "time_series", "interval": "", "legendFormat": "{{ engine_instance_id }}", @@ -1668,6 +1805,10 @@ "type": "timeseries" }, { + "datasource": { + "type": "prometheus", + "uid": "dkSf71fnz" + }, "description": "Number of APEX event execution counter per engine thread", "fieldConfig": { "defaults": { @@ -1700,6 +1841,7 @@ "legend": { "displayMode": "table", "placement": "right", + "showLegend": true, "values": [ "value" ] @@ -1736,14 +1878,13 @@ } ], "refresh": "10s", - "schemaVersion": 34, - "style": "dark", + "schemaVersion": 39, "tags": [], "templating": { "list": [] }, "time": { - "from": "now-5m", + "from": "now-30m", "to": "now" }, "timepicker": { @@ -1773,6 +1914,6 @@ "timezone": "", "title": "SLA's Metrics", "uid": "ySoel0jnk", - "version": 6, + "version": 7, "weekStart": "" }
\ No newline at end of file diff --git a/compose/metrics/prometheus.yml b/compose/metrics/prometheus.yml index c3d87f57..5ff5f949 100644 --- a/compose/metrics/prometheus.yml +++ b/compose/metrics/prometheus.yml @@ -1,6 +1,6 @@ # # ===========LICENSE_START==================================================== -# Copyright (C) 2022-2023 Nordix Foundation. +# Copyright (C) 2022-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. @@ -58,7 +58,7 @@ scrape_configs: - job_name: "drools-apps-metrics" static_configs: - targets: - - "drools-apps:9696" + - "policy-drools-apps:9696" basic_auth: username: "demo@people.osaaf.org" password: "demo123456!" @@ -66,7 +66,7 @@ scrape_configs: - job_name: "drools-pdp-metrics" static_configs: - targets: - - "drools:9696" + - "policy-drools:9696" basic_auth: username: "demo@people.osaaf.org" password: "demo123456!" diff --git a/compose/start-acm-replica.sh b/compose/start-acm-replica.sh new file mode 100755 index 00000000..a9e95b88 --- /dev/null +++ b/compose/start-acm-replica.sh @@ -0,0 +1,88 @@ +#!/bin/bash +# +# ============LICENSE_START==================================================== +# Copyright (C) 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 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 + ;; + *) + 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 + docker compose -f compose.acm.scale.yml up -d nginx +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 a5da09d8..013aba6f 100755 --- a/compose/start-compose.sh +++ b/compose/start-compose.sh @@ -20,8 +20,9 @@ #Usage: $0 [policy-component] [OPTIONS]" #" OPTIONS:" -#" --grafana start the docker compose with grafana" -#" --gui start the docker compose with gui" +#" --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" if [ -z "${WORKSPACE}" ]; then @@ -32,7 +33,7 @@ COMPOSE_FOLDER="${WORKSPACE}"/compose # Set default values for the options grafana=false -gui=false +database=postgres # Parse the command-line arguments while [[ $# -gt 0 ]] @@ -44,10 +45,13 @@ do grafana=true shift ;; - --gui) - gui=true - shift 2 - break; + --mariadb) + database=mariadb + shift + ;; + --postgres) + database=postgres + shift ;; *) component="$1" @@ -67,38 +71,24 @@ if [ -z "$PROJECT" ]; then export PROJECT=$component fi -# docker compose fails when not running CSIT -if [ -z "$ROBOT_LOG_DIR" ]; then - export ROBOT_LOG_DIR=/tmp/ -fi +export database if [ -n "$component" ]; then - if [ "$component" == "logs" ]; then - echo "Collecting logs..." - docker compose logs > docker-compose.log - elif [ "$grafana" = true ]; then - echo "Starting ${component} application with Grafana" - docker compose up -d "${component}" grafana + if [ "$grafana" = true ]; then + echo "Starting ${component} using ${database} + Grafana/Prometheus" + docker compose up -d ${component} ${database} grafana + echo "Prometheus server: http://localhost:${PROMETHEUS_PORT}" echo "Grafana server: http://localhost:${GRAFANA_PORT}" - elif [ "$gui" = true ]; then - echo "Starting application with gui..." - docker compose -f docker-compose.yml -f docker-compose.gui.yml up -d "${component}" policy-gui - echo "Clamp GUI: https://localhost:2445/clamp" + else - echo "Starting ${component} application" - docker compose up -d "${component}" + echo "Starting ${component} using ${database}" + docker compose up -d ${component} ${database} fi else export PROJECT=api # api has groups.json complete with all 3 pdps - if [ "$gui" = true ]; then - echo "Starting application with gui..." - docker compose -f docker-compose.yml -f docker-compose.gui.yml up -d - echo "Clamp GUI: https://localhost:2445/clamp" - else - echo "Starting all components..." - docker compose up -d - fi + echo "Starting all components using ${database}" + docker compose up -d fi cd ${WORKSPACE} diff --git a/compose/start-multiple-pdp.sh b/compose/start-multiple-pdp.sh index 30572875..b0641b41 100755 --- a/compose/start-multiple-pdp.sh +++ b/compose/start-multiple-pdp.sh @@ -1,7 +1,7 @@ #!/bin/bash # # ============LICENSE_START==================================================== -# Copyright (C) 2023 Nordix Foundation. +# 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. @@ -18,19 +18,69 @@ # 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} -echo "Configuring docker compose..." source export-ports.sh > /dev/null 2>&1 source get-versions.sh > /dev/null 2>&1 -export REPLICAS=${1} -docker-compose -f docker-compose.yml -f docker-compose.pdp.scale.yml up -d apexpdp nginx grafana +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}
\ No newline at end of file +cd ${WORKSPACE} diff --git a/compose/start-postgres-tests.sh b/compose/start-postgres-tests.sh deleted file mode 100644 index 1c08600a..00000000 --- a/compose/start-postgres-tests.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash -# -# ============LICENSE_START==================================================== -# Copyright (C) 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. -# 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====================================================== - -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=${1} -docker-compose -f docker-compose.postgres.yml up -d apex-pdp prometheus - -cd ${WORKSPACE}
\ No newline at end of file diff --git a/compose/stop-compose.sh b/compose/stop-compose.sh index 013fbe1e..5811a3e1 100755 --- a/compose/stop-compose.sh +++ b/compose/stop-compose.sh @@ -24,11 +24,30 @@ if [ -z "${WORKSPACE}" ]; then export WORKSPACE fi -# docker compose fails when not running CSIT -if [ -z "$ROBOT_LOG_DIR" ]; then - export ROBOT_LOG_DIR=/tmp/ - export ROBOT_FILES=none - export PROJECT=api +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 @@ -39,7 +58,9 @@ source export-ports.sh > /dev/null 2>&1 source get-versions.sh > /dev/null 2>&1 echo "Collecting logs from docker compose containers..." -rm -rf docker_compose.log +rm -rf *.log + +#COMPOSE_FILES="-f compose.${database}.yml -f compose.pdp.scale.yml -f compose.acm.scale.yml" # this will collect logs by service instead of mixing all together containers=$(docker compose ps --all --format '{{.Service}}') @@ -48,14 +69,10 @@ IFS=$'\n' read -d '' -r -a item_list <<< "$containers" for item in "${item_list[@]}" do if [ -n "$item" ]; then - echo "======== Logs from ${item} ========" >> docker_compose.log - docker compose logs $item >> docker_compose.log - echo "===================================" >> docker_compose.log + docker compose logs $item >> $item.log fi done -cat docker_compose.log - echo "Tearing down containers..." docker compose down -v --remove-orphans diff --git a/csit/resources/scripts/build-csit-docker-image.sh b/csit/resources/scripts/build-csit-docker-image.sh index d4686422..c80afc4f 100755 --- a/csit/resources/scripts/build-csit-docker-image.sh +++ b/csit/resources/scripts/build-csit-docker-image.sh @@ -46,7 +46,7 @@ docker image rm -f ${ROBOT_DOCKER_IMAGE} clone_models echo "Build robot framework docker image" -docker build . --file Dockerfile --tag "${ROBOT_DOCKER_IMAGE}" --no-cache +docker build . --file Dockerfile --tag "onap/${ROBOT_DOCKER_IMAGE}" --quiet docker save -o policy-csit-robot.tar ${ROBOT_DOCKER_IMAGE}:latest rm -rf ${WORKSPACE}/csit/resources/policy-csit-robot.tar diff --git a/csit/resources/scripts/wait_for_rest.sh b/csit/resources/scripts/wait_for_rest.sh index e400bbd4..9732bc54 100755 --- a/csit/resources/scripts/wait_for_rest.sh +++ b/csit/resources/scripts/wait_for_rest.sh @@ -1,6 +1,6 @@ #!/bin/sh # ============LICENSE_START==================================================== -# Copyright (C) 2023 Nordix Foundation. +# 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. @@ -54,7 +54,7 @@ do do if command -v docker > /dev/null 2>&1 then - docker ps --format "table {{ .Names }}\t{{ .Status }}" + docker ps --format "table {{ .Image }}\t{{ .Names }}\t{{ .Status }}" fi curl "http://$host:$port" > /dev/null 2>&1 rc=$? @@ -66,8 +66,7 @@ do sleep 5 fi done - if [ $rc -ne 0 ] - then + if [ $rc -ne 0 ]; then echo "$host port $port REST cannot be detected" exit $rc fi diff --git a/csit/resources/tests/apex-pdp-common.robot b/csit/resources/tests/apex-pdp-common.robot index e6458318..81924604 100644 --- a/csit/resources/tests/apex-pdp-common.robot +++ b/csit/resources/tests/apex-pdp-common.robot @@ -4,7 +4,7 @@ Library RequestsLibrary Library OperatingSystem Library json Library Process -Resource ${CURDIR}/common-library.robot +Resource common-library.robot *** Keywords *** @@ -31,14 +31,6 @@ CheckLogMessage ${result}= CheckKafkaTopic ${topic} ${status} Should Contain ${result} ${expectedMsg} -ValidatePolicyExecution - [Arguments] ${url} ${executionTime} - [Documentation] Check that policy execution under X milliseconds - ${resp}= QueryPrometheus ${url} - ${rawNumber}= Evaluate ${resp['data']['result'][0]['value'][1]} - ${actualTime}= Set Variable ${rawNumber * ${1000}} - Should Be True ${actualTime} <= ${executionTime} - ValidateEventExecution [Arguments] ${eventStartTime} ${eventEndTime} ${eventsNo} [Documentation] Check that X amount of events were exeuted per second diff --git a/csit/resources/tests/apex-pdp-test.robot b/csit/resources/tests/apex-pdp-test.robot index 42be4415..3989ec46 100644 --- a/csit/resources/tests/apex-pdp-test.robot +++ b/csit/resources/tests/apex-pdp-test.robot @@ -4,8 +4,8 @@ Library RequestsLibrary Library OperatingSystem Library json Library Process -Resource ${CURDIR}/common-library.robot -Resource ${CURDIR}/apex-pdp-common.robot +Resource common-library.robot +Resource apex-pdp-common.robot *** Test Cases *** @@ -20,7 +20,7 @@ ExecuteApexSampleDomainPolicy # [Tags] docker Set Test Variable ${policyName} onap.policies.native.apex.Sampledomain ${postjson}= Get File ${CURDIR}/data/${policyName}.json - CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} ${policyName} 1.0.0 + 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 Wait Until Keyword Succeeds 4 min 5 sec RunEventOnApexEngine @@ -28,7 +28,7 @@ ExecuteApexSampleDomainPolicy ExecuteApexTestPnfPolicy Set Test Variable ${policyName} onap.policies.apex.pnf.Test ${postjson}= Get File ${CURDIR}/data/${policyName}.json - CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} ${policyName} 1.0.0 + 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 @@ -37,7 +37,7 @@ ExecuteApexTestPnfPolicy #ExecuteApexTestVnfPolicy # Set Test Variable ${policyName} onap.policies.apex.vnf.Test # ${postjson}= Get File ${CURDIR}/data/${policyName}.json -# CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} ${policyName} 1.0.0 +# 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 # GetTopic apex-cl-mgt @@ -46,9 +46,9 @@ ExecuteApexTestPnfPolicy ExecuteApexTestPnfPolicyWithMetadataSet Set Test Variable ${policyName} onap.policies.apex.pnf.metadataSet.Test ${postjson}= Get File ${CURDIR}/data/${policyName}.json - CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} ${policyName} 1.0.0 + 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 200 ${postjson} 1 + 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 diff --git a/csit/resources/tests/apex-slas-10.robot b/csit/resources/tests/apex-slas-10.robot index 53779774..2a56a665 100644 --- a/csit/resources/tests/apex-slas-10.robot +++ b/csit/resources/tests/apex-slas-10.robot @@ -5,8 +5,8 @@ Library OperatingSystem Library DateTime Library Process Library json -Resource ${CURDIR}/common-library.robot -Resource ${CURDIR}/apex-pdp-common.robot +Resource common-library.robot +Resource apex-pdp-common.robot *** Test Cases *** Healthcheck @@ -20,9 +20,9 @@ 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 - CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} ${policyName} 1.0.0 + 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 200 ${postjson} 1 + 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 @@ -36,7 +36,7 @@ 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 - CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} ${policyName} 1.0.0 + 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 @@ -52,7 +52,7 @@ 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 - CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} ${policyName} 1.0.0 + 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 diff --git a/csit/resources/tests/apex-slas-3.robot b/csit/resources/tests/apex-slas-3.robot index 048e2e76..1ceb9b77 100644 --- a/csit/resources/tests/apex-slas-3.robot +++ b/csit/resources/tests/apex-slas-3.robot @@ -5,8 +5,8 @@ Library OperatingSystem Library DateTime Library Process Library json -Resource ${CURDIR}/common-library.robot -Resource ${CURDIR}/apex-pdp-common.robot +Resource common-library.robot +Resource apex-pdp-common.robot *** Test Cases *** Healthcheck @@ -20,7 +20,7 @@ ValidatePolicyExecutionAndEventRateLowComplexity [Documentation] Validate that a moderate complexity policity 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 - CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} ${policyName} 1.0.0 + 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 @@ -34,9 +34,9 @@ ValidatePolicyExecutionAndEventRateHighComplexity [Documentation] Validate that a high complexity policity 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 - CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} ${policyName} 1.0.0 + 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 200 ${postjson} 1 + 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 @@ -50,7 +50,7 @@ ValidatePolicyExecutionAndEventRateModerateComplexity [Documentation] Validate that a low complexity policity 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 - CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} ${policyName} 1.0.0 + 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 diff --git a/csit/resources/tests/apex-slas.robot b/csit/resources/tests/apex-slas.robot index 69b24521..760bc348 100644 --- a/csit/resources/tests/apex-slas.robot +++ b/csit/resources/tests/apex-slas.robot @@ -5,8 +5,8 @@ Library OperatingSystem Library DateTime Library Process Library json -Resource ${CURDIR}/common-library.robot -Resource ${CURDIR}/apex-pdp-common.robot +Resource common-library.robot +Resource apex-pdp-common.robot *** Test Cases *** Healthcheck @@ -17,10 +17,10 @@ Healthcheck Set Suite Variable ${pdpName} ${resp.json()['name']} ValidatePolicyExecutionAndEventRateLowComplexity - [Documentation] Validate that a moderate complexity policity can be executed in less than 100ms and minimum 10 events triggered per second + [Documentation] Validate that a moderate complexity policy can be executed in less than 100ms and minimum 10 events triggered per second Set Test Variable ${policyName} onap.policies.apex.pnf.Test ${postjson}= Get File ${CURDIR}/data/${policyName}.json - CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} ${policyName} 1.0.0 + 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 @@ -31,10 +31,10 @@ ValidatePolicyExecutionAndEventRateLowComplexity ValidateEventExecution ${eventStartTime} ${eventEndTime} 10 ValidatePolicyExecutionAndEventRateModerateComplexity - [Documentation] Validate that a low complexity policity can be executed in less than 1000ms and minimum 1 events triggered per second + [Documentation] Validate that a low complexity policy can be executed in less than 1000ms and minimum 1 events triggered per second Set Test Variable ${policyName} onap.policies.native.apex.Sampledomain ${postjson}= Get File ${CURDIR}/data/${policyName}.json - CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} ${policyName} 1.0.0 + CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies ${postjson} ${policyName} 1.0.0 DeployPolicy ${eventStartTime}= Get Current Date Wait Until Keyword Succeeds 4 min 5 sec RunEventOnApexEngine @@ -42,12 +42,12 @@ ValidatePolicyExecutionAndEventRateModerateComplexity ValidateEventExecution ${eventStartTime} ${eventEndTime} 1 ValidatePolicyExecutionAndEventRateHighComplexity - [Documentation] Validate that a high complexity policity can be executed in less than 5000ms and minimum 0.2 events triggered per second + [Documentation] Validate that a high complexity policy can be executed in less than 5000ms and minimum 0.2 events triggered per second Set Test Variable ${policyName} onap.policies.apex.pnf.metadataSet.Test ${postjson}= Get File ${CURDIR}/data/${policyName}.json - CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} ${policyName} 1.0.0 + 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 200 ${postjson} 1 + 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 diff --git a/csit/resources/tests/api-slas.robot b/csit/resources/tests/api-slas.robot index 1c549aa9..165f14a3 100644 --- a/csit/resources/tests/api-slas.robot +++ b/csit/resources/tests/api-slas.robot @@ -3,7 +3,7 @@ Library Collections Library RequestsLibrary Library OperatingSystem Library json -Resource ${CURDIR}/common-library.robot +Resource common-library.robot *** Keywords *** ValidateResponseTimeForApi diff --git a/csit/resources/tests/api-test.robot b/csit/resources/tests/api-test.robot index bce58231..29c2fba4 100644 --- a/csit/resources/tests/api-test.robot +++ b/csit/resources/tests/api-test.robot @@ -3,121 +3,121 @@ Library Collections Library RequestsLibrary Library OperatingSystem Library json -Resource ${CURDIR}/common-library.robot +Resource common-library.robot *** Test Cases *** Healthcheck - [Documentation] Verify policy api health check - ${resp}= GetReq /policy/api/v1/healthcheck - Should Be Equal As Strings ${resp.json()['code']} 200 - Should Be Equal As Strings ${resp.json()['healthy']} True - Should Be Equal As Strings ${resp.json()['message']} alive + [Documentation] Verify policy api health check + ${resp}= GetReq /policy/api/v1/healthcheck + Should Be Equal As Strings ${resp.json()['code']} 200 + Should Be Equal As Strings ${resp.json()['healthy']} True + Should Be Equal As Strings ${resp.json()['message']} alive RetrievePolicyTypes - [Documentation] Retrieve all policy types - FetchPolicyTypes /policy/api/v1/policytypes 37 + [Documentation] Retrieve all policy types + FetchPolicyTypes /policy/api/v1/policytypes 37 CreateTCAPolicyTypeV1 - [Documentation] Create an existing policy type with modification and keeping the same version should result in error. - CreatePolicyType /policy/api/v1/policytypes 406 onap.policy.monitoring.tcagen2.v1.json null null + [Documentation] Create an existing policy type with modification and keeping the same version should result in error. + CreatePolicyType /policy/api/v1/policytypes 406 onap.policy.monitoring.tcagen2.v1.json null null CreateTCAPolicyTypeV2 - [Documentation] Create an existing policy type with modification and keeping the same version should result in error. - CreatePolicyType /policy/api/v1/policytypes 406 onap.policy.monitoring.tcagen2.v2.json null null + [Documentation] Create an existing policy type with modification and keeping the same version should result in error. + CreatePolicyType /policy/api/v1/policytypes 406 onap.policy.monitoring.tcagen2.v2.json null null CreateTCAPolicyTypeV3 - [Documentation] Create a policy type named 'onap.policies.monitoring.tcagen2' and version '3.0.0' - CreatePolicyType /policy/api/v1/policytypes 200 onap.policy.monitoring.tcagen2.v3.json onap.policies.monitoring.tcagen2 3.0.0 + [Documentation] Create a policy type named 'onap.policies.monitoring.tcagen2' and version '3.0.0' + CreatePolicyType /policy/api/v1/policytypes 201 onap.policy.monitoring.tcagen2.v3.json onap.policies.monitoring.tcagen2 3.0.0 RetrieveMonitoringPolicyTypes - [Documentation] Retrieve all monitoring related policy types - FetchPolicyTypes /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2 2 + [Documentation] Retrieve all monitoring related policy types + FetchPolicyTypes /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2 2 CreateNewMonitoringPolicyV1 - [Documentation] Create a policy named 'onap.restart.tca' and version '1.0.0' using specific api - ${postjson}= Get file ${DATA}/vCPE.policy.monitoring.input.tosca.json - CreatePolicy /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies 200 ${postjson} onap.restart.tca 1.0.0 + [Documentation] Create a policy named 'onap.restart.tca' and version '1.0.0' using specific api + ${postjson}= Get file ${DATA}/vCPE.policy.monitoring.input.tosca.json + CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies ${postjson} onap.restart.tca 1.0.0 CreateNewMonitoringPolicyV1Again - [Documentation] Create an existing policy with modification and keeping the same version should result in error. - ${postjson}= Get file ${DATA}/vCPE.policy.monitoring.input.tosca.v1_2.json - CreatePolicy /policy/api/v1/policies 406 ${postjson} null null + [Documentation] Create an existing policy with modification and keeping the same version should result in error. + ${postjson}= Get file ${DATA}/vCPE.policy.monitoring.input.tosca.v1_2.json + CreatePolicy /policy/api/v1/policies 406 ${postjson} null null CreateNewMonitoringPolicyV2 - [Documentation] Create a policy named 'onap.restart.tca' and version '2.0.0' using generic api - ${postjson}= Get file ${DATA}/vCPE.policy.monitoring.input.tosca.v2.json - CreatePolicy /policy/api/v1/policies 200 ${postjson} onap.restart.tca 2.0.0 + [Documentation] Create a policy named 'onap.restart.tca' and version '2.0.0' using generic api + ${postjson}= Get file ${DATA}/vCPE.policy.monitoring.input.tosca.v2.json + CreatePolicySuccessfully /policy/api/v1/policies ${postjson} onap.restart.tca 2.0.0 CreateNodeTemplates - [Documentation] Create node templates in database using specific api - ${postjson}= Get file ${NODETEMPLATES}/nodetemplates.metadatasets.input.tosca.json - CreateNodeTemplate /policy/api/v1/nodetemplates 200 ${postjson} 3 + [Documentation] Create node templates in database using specific api + ${postjson}= Get file ${NODETEMPLATES}/nodetemplates.metadatasets.input.tosca.json + CreateNodeTemplate /policy/api/v1/nodetemplates 201 ${postjson} 3 RetrievePoliciesOfType - [Documentation] Retrieve all policies belonging to a specific Policy Type - FetchPolicies /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies 2 + [Documentation] Retrieve all policies belonging to a specific Policy Type + FetchPolicies /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies 2 RetrieveAllPolicies - [Documentation] Retrieve all policies - FetchPolicies /policy/api/v1/policies 3 + [Documentation] Retrieve all policies + FetchPolicies /policy/api/v1/policies 3 RetrieveSpecificPolicy - [Documentation] Retrieve a policy named 'onap.restart.tca' and version '1.0.0' using generic api - FetchPolicy /policy/api/v1/policies/onap.restart.tca/versions/1.0.0 onap.restart.tca + [Documentation] Retrieve a policy named 'onap.restart.tca' and version '1.0.0' using generic api + FetchPolicy /policy/api/v1/policies/onap.restart.tca/versions/1.0.0 onap.restart.tca RetrieveAllNodeTemplates - [Documentation] Retrieve all node templates - FetchNodeTemplates /policy/api/v1/nodetemplates 3 + [Documentation] Retrieve all node templates + FetchNodeTemplates /policy/api/v1/nodetemplates 3 RetrieveSpecificNodeTemplate - [Documentation] Retrieve a node template named 'apexMetadata_grpc' and version '1.2.1' using generic api - FetchNodeTemplate /policy/api/v1/nodetemplates/apexMetadata_grpc/versions/1.2.1 apexMetadata_grpc + [Documentation] Retrieve a node template named 'apexMetadata_grpc' and version '1.2.1' using generic api + FetchNodeTemplate /policy/api/v1/nodetemplates/apexMetadata_grpc/versions/1.2.1 apexMetadata_grpc DeleteSpecificNodeTemplate - [Documentation] Delete a node template named 'apexMetadata_adaptive' and version '2.3.1' using generic api - DeleteReq /policy/api/v1/nodetemplates/apexMetadata_adaptive/versions/2.3.1 200 - DeleteReq /policy/api/v1/nodetemplates/apexMetadata_adaptive/versions/2.3.1 404 + [Documentation] Delete a node template named 'apexMetadata_adaptive' and version '2.3.1' using generic api + DeleteReq /policy/api/v1/nodetemplates/apexMetadata_adaptive/versions/2.3.1 200 + DeleteReq /policy/api/v1/nodetemplates/apexMetadata_adaptive/versions/2.3.1 404 DeleteSpecificPolicy - [Documentation] Delete a policy named 'onap.restart.tca' and version '1.0.0' using generic api - DeleteReq /policy/api/v1/policies/onap.restart.tca/versions/1.0.0 200 - DeleteReq /policy/api/v1/policies/onap.restart.tca/versions/1.0.0 404 + [Documentation] Delete a policy named 'onap.restart.tca' and version '1.0.0' using generic api + DeleteReq /policy/api/v1/policies/onap.restart.tca/versions/1.0.0 200 + DeleteReq /policy/api/v1/policies/onap.restart.tca/versions/1.0.0 404 DeleteSpecificPolicyV2 - [Documentation] Delete a policy named 'onap.restart.tca' and version '2.0.0' using specific api - DeleteReq /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies/onap.restart.tca/versions/2.0.0 200 - DeleteReq /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies/onap.restart.tca/versions/2.0.0 404 + [Documentation] Delete a policy named 'onap.restart.tca' and version '2.0.0' using specific api + DeleteReq /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies/onap.restart.tca/versions/2.0.0 200 + DeleteReq /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies/onap.restart.tca/versions/2.0.0 404 DeleteSpecificPolicyTypeV1 - [Documentation] Delete a policy type named 'onap.policies.monitoring.tcagen2' and version '1.0.0' - DeleteReq /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0 200 - DeleteReq /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0 404 + [Documentation] Delete a policy type named 'onap.policies.monitoring.tcagen2' and version '1.0.0' + DeleteReq /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0 200 + DeleteReq /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0 404 DeleteSpecificPolicyTypeV2 - [Documentation] Delete a policy type named 'onap.policies.monitoring.tcagen2' and version '2.0.0' - DeleteReq /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/2.0.0 200 - DeleteReq /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/2.0.0 404 + [Documentation] Delete a policy type named 'onap.policies.monitoring.tcagen2' and version '2.0.0' + DeleteReq /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/2.0.0 200 + DeleteReq /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/2.0.0 404 DeleteSpecificPolicyTypeV3 - [Documentation] Delete a policy type named 'onap.policies.monitoring.tcagen2' and version '3.0.0' - DeleteReq /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/3.0.0 200 - DeleteReq /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/3.0.0 404 + [Documentation] Delete a policy type named 'onap.policies.monitoring.tcagen2' and version '3.0.0' + DeleteReq /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/3.0.0 200 + DeleteReq /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/3.0.0 404 Metrics [Documentation] Verify policy-api is exporting prometheus metrics ${auth}= PolicyAdminAuth ${resp}= GetMetrics ${POLICY_API_IP} ${auth} /policy/api/v1/ - Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="GET",outcome="SUCCESS",status="200",uri="/healthcheck",} 1.0 - Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="GET",outcome="SUCCESS",status="200",uri="/policytypes",} 1.0 - Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="GET",outcome="SUCCESS",status="200",uri="/policies",} 1.0 - Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="GET",outcome="SUCCESS",status="200",uri="/policies/{policyId}/versions/{policyVersion}",} 1.0 - Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="GET",outcome="SUCCESS",status="200",uri="/policytypes/{policyTypeId}/versions/{policyTypeVersion}/policies",} 1.0 - Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="POST",outcome="SUCCESS",status="200",uri="/policytypes/{policyTypeId}/versions/{policyTypeVersion}/policies",} 1.0 - Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="POST",outcome="SUCCESS",status="200",uri="/policytypes",} 1.0 - Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="DELETE",outcome="SUCCESS",status="200",uri="/policies/{policyId}/versions/{policyVersion}",} 1.0 - Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="DELETE",outcome="SUCCESS",status="200",uri="/policytypes/{policyTypeId}/versions/{versionId}",} 3.0 - Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="DELETE",outcome="SUCCESS",status="200",uri="/policytypes/{policyTypeId}/versions/{policyTypeVersion}/policies/{policyId}/versions/{policyVersion}",} 1.0 + Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="GET",outcome="SUCCESS",status="200",uri="/healthcheck"} 1 + Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="GET",outcome="SUCCESS",status="200",uri="/policytypes"} 1 + Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="GET",outcome="SUCCESS",status="200",uri="/policies"} 1 + Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="GET",outcome="SUCCESS",status="200",uri="/policies/{policyId}/versions/{policyVersion}"} 1 + Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="GET",outcome="SUCCESS",status="200",uri="/policytypes/{policyTypeId}/versions/{policyTypeVersion}/policies"} 1 + Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="POST",outcome="SUCCESS",status="201",uri="/policytypes/{policyTypeId}/versions/{policyTypeVersion}/policies"} 1 + Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="POST",outcome="SUCCESS",status="201",uri="/policytypes"} 1 + Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="DELETE",outcome="SUCCESS",status="200",uri="/policies/{policyId}/versions/{policyVersion}"} 1 + Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="DELETE",outcome="SUCCESS",status="200",uri="/policytypes/{policyTypeId}/versions/{versionId}"} 3 + Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="DELETE",outcome="SUCCESS",status="200",uri="/policytypes/{policyTypeId}/versions/{policyTypeVersion}/policies/{policyId}/versions/{policyVersion}"} 1 Should Contain ${resp.text} http_server_requests_seconds_sum Should Contain ${resp.text} http_server_requests_seconds_max Should Contain ${resp.text} spring_data_repository_invocations_seconds_count @@ -128,53 +128,52 @@ Metrics *** Keywords *** GetReq - [Arguments] ${url} - ${auth}= PolicyAdminAuth - ${resp}= PerformGetRequest ${POLICY_API_IP} ${url} 200 null ${auth} - RETURN ${resp} + [Arguments] ${url} + ${auth}= PolicyAdminAuth + ${resp}= PerformGetRequest ${POLICY_API_IP} ${url} 200 null ${auth} + RETURN ${resp} DeleteReq - [Arguments] ${url} ${expectedstatus} - ${auth}= PolicyAdminAuth - ${resp}= PerformDeleteRequest ${POLICY_API_IP} ${url} ${expectedstatus} ${auth} - RETURN ${resp} + [Arguments] ${url} ${expectedstatus} + ${auth}= PolicyAdminAuth + ${resp}= PerformDeleteRequest ${POLICY_API_IP} ${url} ${expectedstatus} ${auth} + RETURN ${resp} CreatePolicyType - [Arguments] ${url} ${expectedstatus} ${jsonfile} ${policytypename} ${policytypeversion} - [Documentation] Create the specific policy type - ${postjson}= Get file ${CURDIR}/data/${jsonfile} - ${auth}= PolicyAdminAuth - ${resp}= PerformPostRequest ${POLICY_API_IP} ${url} ${expectedstatus} ${postjson} null ${auth} - Run Keyword If ${expectedstatus}==200 List Should Contain Value ${resp.json()['policy_types']} ${policytypename} - Run Keyword If ${expectedstatus}==200 Should Be Equal As Strings ${resp.json()['policy_types']['${policytypename}']['version']} ${policytypeversion} + [Arguments] ${url} ${expectedstatus} ${jsonfile} ${policytypename} ${policytypeversion} + [Documentation] Create the specific policy type + ${postjson}= Get file ${CURDIR}/data/${jsonfile} + ${auth}= PolicyAdminAuth + ${resp}= PerformPostRequest ${POLICY_API_IP} ${url} ${expectedstatus} ${postjson} null ${auth} + Run Keyword If ${expectedstatus}==200 List Should Contain Value ${resp.json()['policy_types']} ${policytypename} + Run Keyword If ${expectedstatus}==200 Should Be Equal As Strings ${resp.json()['policy_types']['${policytypename}']['version']} ${policytypeversion} FetchPolicyTypes - [Arguments] ${url} ${expectedLength} - [Documentation] Fetch all policy types - ${resp}= GetReq ${url} - Length Should Be ${resp.json()['policy_types']} ${expectedLength} + [Arguments] ${url} ${expectedLength} + [Documentation] Fetch all policy types + ${resp}= GetReq ${url} + Length Should Be ${resp.json()['policy_types']} ${expectedLength} FetchPolicy - [Arguments] ${url} ${keyword} - [Documentation] Fetch the specific policy - ${resp}= GetReq ${url} - Dictionary Should Contain Key ${resp.json()['topology_template']['policies'][0]} ${keyword} + [Arguments] ${url} ${keyword} + [Documentation] Fetch the specific policy + ${resp}= GetReq ${url} + Dictionary Should Contain Key ${resp.json()['topology_template']['policies'][0]} ${keyword} FetchPolicies - [Arguments] ${url} ${expectedLength} - [Documentation] Fetch all policies - ${resp}= GetReq ${url} - Length Should Be ${resp.json()['topology_template']['policies']} ${expectedLength} - + [Arguments] ${url} ${expectedLength} + [Documentation] Fetch all policies + ${resp}= GetReq ${url} + Length Should Be ${resp.json()['topology_template']['policies']} ${expectedLength} FetchNodeTemplates - [Arguments] ${url} ${expectedLength} - [Documentation] Fetch all node templates - ${resp}= GetReq ${url} - Length Should Be ${resp.json()} ${expectedLength} + [Arguments] ${url} ${expectedLength} + [Documentation] Fetch all node templates + ${resp}= GetReq ${url} + Length Should Be ${resp.json()} ${expectedLength} FetchNodeTemplate - [Arguments] ${url} ${keyword} - [Documentation] Fetch the specific node template - ${resp}= GetReq ${url} - Dictionary Should Contain Value ${resp.json()[0]} ${keyword} + [Arguments] ${url} ${keyword} + [Documentation] Fetch the specific node template + ${resp}= GetReq ${url} + Dictionary Should Contain Value ${resp.json()[0]} ${keyword} diff --git a/csit/resources/tests/clamp-slas.robot b/csit/resources/tests/clamp-slas.robot new file mode 100644 index 00000000..18a83d7a --- /dev/null +++ b/csit/resources/tests/clamp-slas.robot @@ -0,0 +1,57 @@ +*** Settings *** +Library Collections +Library RequestsLibrary +Library OperatingSystem +Library json +Resource common-library.robot + +*** Keywords *** +ValidateResponseTimeForClamp + [Arguments] ${uri} ${method} + [Documentation] Check if uri response is under the 1500ms required time for clamp metrics + ValidateResponseTime acm-metrics ${uri} ${method} 1500 + +*** Test Cases *** +WaitForPrometheusServer + [Documentation] Sleep time to wait for Prometheus server to gather all metrics + Sleep 1 minute + +ValidateResponseTimeForHealthcheck + [Documentation] Validate component healthcheck response time + ValidateResponseTimeForClamp /health GET + +ValidateResponseTimeQueryAcDefinition + [Documentation] Validate query AC Definitions response time + ValidateResponseTimeForClamp /v2/compositions/{compositionId} GET + +ValidateResponseTimeQueryAcInstance + [Documentation] Validate query AC instance response time + ValidateResponseTimeForClamp /v2/compositions/{compositionId}/instances/{instanceId} GET + +ValidateResponseTimeQueryAcInstances + [Documentation] Validate query all AC instances response time + ValidateResponseTimeForClamp /v2/compositions/{compositionId}/instances GET + +ValidateResponseTimeStateChange + [Documentation] Validate AC instance StateChange response time + ValidateResponseTimeForClamp /v2/compositions/{compositionId}/instances/{instanceId} PUT + +ValidateResponseTimeCallParticipants + [Documentation] Validate call AC participants response time + ValidateResponseTimeForClamp /v2/participants PUT + +ValidateResponseTimeCommissioning + [Documentation] Validate commission AC Definitions response time + ValidateResponseTimeForClamp /v2/compositions POST + +ValidateResponseTimeInstantiation + [Documentation] Validate create AC Instance response time + ValidateResponseTimeForClamp /v2/compositions/{compositionId}/instances POST + +ValidateResponseTimeDeleteInstance + [Documentation] Validate delete AC Instance response time + ValidateResponseTimeForClamp /v2/compositions/{compositionId}/instances/{instanceId} DELETE + +ValidateResponseTimeDeleteDefinition + [Documentation] Validate delete AC Definition response time + ValidateResponseTimeForClamp /v2/compositions/{compositionId} DELETE
\ No newline at end of file diff --git a/csit/resources/tests/common-library.robot b/csit/resources/tests/common-library.robot index a585bc97..e0b1c0f1 100644 --- a/csit/resources/tests/common-library.robot +++ b/csit/resources/tests/common-library.robot @@ -3,6 +3,7 @@ Library Collections Library RequestsLibrary Library OperatingSystem Library json +Library Process *** Keywords *** @@ -50,15 +51,21 @@ CreatePolicy [Documentation] Create the specific policy ${policyadmin}= PolicyAdminAuth ${resp}= PerformPostRequest ${POLICY_API_IP} ${url} ${expectedstatus} ${postjson} null ${policyadmin} - Run Keyword If ${expectedstatus}==200 Dictionary Should Contain Key ${resp.json()['topology_template']['policies'][0]} ${policyname} - Run Keyword If ${expectedstatus}==200 Should Be Equal As Strings ${resp.json()['topology_template']['policies'][0]['${policyname}']['version']} ${policyversion} + +CreatePolicySuccessfully + [Arguments] ${url} ${postjson} ${policyname} ${policyversion} + [Documentation] Create the specific policy + ${policyadmin}= PolicyAdminAuth + ${resp}= PerformPostRequest ${POLICY_API_IP} ${url} 201 ${postjson} null ${policyadmin} + Dictionary Should Contain Key ${resp.json()['topology_template']['policies'][0]} ${policyname} + Should Be Equal As Strings ${resp.json()['topology_template']['policies'][0]['${policyname}']['version']} ${policyversion} CreateNodeTemplate [Arguments] ${url} ${expectedstatus} ${postjson} ${nodeTemplateListLength} [Documentation] Create the node templates ${policyadmin}= PolicyAdminAuth ${resp}= PerformPostRequest ${POLICY_API_IP} ${url} ${expectedstatus} ${postjson} \ ${policyadmin} - Run Keyword If ${expectedstatus}==200 Length Should Be ${resp.json()['topology_template']['node_templates']} ${nodeTemplateListLength} + Run Keyword If ${expectedstatus}==201 Length Should Be ${resp.json()['topology_template']['node_templates']} ${nodeTemplateListLength} QueryPdpGroups @@ -123,28 +130,6 @@ VerifyTracingWorks Log Received response from jaeger ${resp.text} RETURN ${resp} -VerifyKafkaInTraces - [Arguments] ${domain} ${service} - Log Creating session http://${domain} - ${session}= Create Session jaeger http://${domain} - ${tags}= Create Dictionary otel.library.name=io.opentelemetry.kafka-clients-2.6 messaging.system=kafka - ${tags_json}= evaluate json.dumps(${tags}) json - ${params}= Create Dictionary service=${service} tags=${tags_json} operation=policy-acruntime-participant send lookback=1h limit=10 - ${resp}= GET On Session jaeger /api/traces params=${params} expected_status=200 - Log Received response from jaeger ${resp.text} - RETURN ${resp} - -VerifyHttpInTraces - [Arguments] ${domain} ${service} - Log Creating session http://${domain} - ${session}= Create Session jaeger http://${domain} - ${tags}= Create Dictionary uri=/v2/compositions/{compositionId} - ${tags_json}= evaluate json.dumps(${tags}) json - ${params}= Create Dictionary service=${service} tags=${tags_json} operation=http put /v2/compositions/{compositionId} lookback=1h limit=10 - ${resp}= GET On Session jaeger /api/traces params=${params} expected_status=200 - Log Received response from jaeger ${resp.text} - RETURN ${resp} - QueryPrometheus [Arguments] ${query} ${params}= Create Dictionary query=${query} @@ -164,9 +149,19 @@ ValidateResponseTime CheckKafkaTopic [Arguments] ${topic} ${expected_status} ${resp}= Run Process ${CURDIR}/kafka_consumer.py ${topic} 60 ${expected_status} ${KAFKA_IP} + Log ${resp.stdout} Should Contain ${resp.stdout} ${expected_status} RETURN ${resp.stdout} GetKafkaTopic [Arguments] ${topic} - ${resp}= Run Process ${CURDIR}/make_topics.py ${topic} ${KAFKA_IP}
\ No newline at end of file + ${resp}= Run Process ${CURDIR}/make_topics.py ${topic} ${KAFKA_IP} + Log ${resp.stdout} + +ValidatePolicyExecution + [Arguments] ${url} ${executionTime} + [Documentation] Check that policy execution under X milliseconds + ${resp}= QueryPrometheus ${url} + ${rawNumber}= Evaluate ${resp['data']['result'][0]['value'][1]} + ${actualTime}= Set Variable ${rawNumber * ${1000}} + Should Be True ${actualTime} <= ${executionTime}
\ No newline at end of file diff --git a/csit/resources/tests/data/PrepareAC.json b/csit/resources/tests/data/PrepareAC.json new file mode 100644 index 00000000..bc3a3c0a --- /dev/null +++ b/csit/resources/tests/data/PrepareAC.json @@ -0,0 +1,3 @@ +{ + "subOrder": "PREPARE" +} diff --git a/csit/resources/tests/data/ReviewAC.json b/csit/resources/tests/data/ReviewAC.json new file mode 100644 index 00000000..e4d74348 --- /dev/null +++ b/csit/resources/tests/data/ReviewAC.json @@ -0,0 +1,3 @@ +{ + "subOrder": "REVIEW" +} diff --git a/csit/resources/tests/data/RunningCommand.json b/csit/resources/tests/data/RunningCommand.json deleted file mode 100644 index 56980e64..00000000 --- a/csit/resources/tests/data/RunningCommand.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "instantiationCommand": { - "orderedState": "RUNNING" - } -} diff --git a/csit/resources/tests/data/SettingSimPropertiesFail.json b/csit/resources/tests/data/SettingSimPropertiesFail.json new file mode 100644 index 00000000..0e0de30e --- /dev/null +++ b/csit/resources/tests/data/SettingSimPropertiesFail.json @@ -0,0 +1,26 @@ +{ + "deploySuccess": false, + "undeploySuccess": false, + "lockSuccess": false, + "unlockSuccess": false, + "deleteSuccess": false, + "updateSuccess": false, + "migrateSuccess": false, + "migratePrecheck": false, + "prepare": false, + "review": false, + "primeSuccess": false, + "deprimeSuccess": false, + "deployTimerMs": 100, + "undeployTimerMs": 100, + "lockTimerMs": 100, + "unlockTimerMs": 100, + "updateTimerMs": 100, + "migrateTimerMs": 100, + "migratePrecheckTimerMs": 100, + "prepareTimerMs": 100, + "reviewTimerMs": 100, + "deleteTimerMs": 100, + "primeTimerMs": 100, + "deprimeTimerMs": 100 +} diff --git a/csit/resources/tests/data/SettingSimPropertiesSuccess.json b/csit/resources/tests/data/SettingSimPropertiesSuccess.json new file mode 100644 index 00000000..14fbe01a --- /dev/null +++ b/csit/resources/tests/data/SettingSimPropertiesSuccess.json @@ -0,0 +1,26 @@ +{ + "deploySuccess": true, + "undeploySuccess": true, + "lockSuccess": true, + "unlockSuccess": true, + "deleteSuccess": true, + "updateSuccess": true, + "migrateSuccess": true, + "migratePrecheck": true, + "prepare": true, + "review": true, + "primeSuccess": true, + "deprimeSuccess": true, + "deployTimerMs": 100, + "undeployTimerMs": 100, + "lockTimerMs": 100, + "unlockTimerMs": 100, + "updateTimerMs": 100, + "migrateTimerMs": 100, + "migratePrecheckTimerMs": 100, + "prepareTimerMs": 100, + "reviewTimerMs": 100, + "deleteTimerMs": 100, + "primeTimerMs": 100, + "deprimeTimerMs": 100 +} diff --git a/csit/resources/tests/data/SettingSimPropertiesTimeout.json b/csit/resources/tests/data/SettingSimPropertiesTimeout.json new file mode 100644 index 00000000..a63c3044 --- /dev/null +++ b/csit/resources/tests/data/SettingSimPropertiesTimeout.json @@ -0,0 +1,26 @@ +{ + "deploySuccess": true, + "undeploySuccess": true, + "lockSuccess": true, + "unlockSuccess": true, + "deleteSuccess": true, + "updateSuccess": true, + "migrateSuccess": true, + "migratePrecheck": true, + "prepare": true, + "review": true, + "primeSuccess": true, + "deprimeSuccess": true, + "deployTimerMs": 260000, + "undeployTimerMs": 260000, + "lockTimerMs": 260000, + "unlockTimerMs": 260000, + "updateTimerMs": 260000, + "migrateTimerMs": 260000, + "migratePrecheckTimerMs": 260000, + "prepareTimerMs": 260000, + "reviewTimerMs": 260000, + "deleteTimerMs": 260000, + "primeTimerMs": 260000, + "deprimeTimerMs": 260000 +} diff --git a/csit/resources/tests/data/ac-definition-migration-from.yaml b/csit/resources/tests/data/ac-definition-migration-from.yaml index 273cfec3..f11b174c 100644 --- a/csit/resources/tests/data/ac-definition-migration-from.yaml +++ b/csit/resources/tests/data/ac-definition-migration-from.yaml @@ -57,6 +57,11 @@ node_types: first start phase is zero. Automation Composition Elements are started in their start_phase order and stopped in reverse start phase order. Automation Composition Elements with the same start phase are started and stopped simultaneously + stage: + type: list + description: A list indicating the stages in which this automation composition element will be started, the + first stage is zero. Automation Composition Elements are started in their stage order. + Automation Composition Elements with the same stage are started simultaneously. org.onap.policy.clamp.acm.AutomationComposition: version: 1.0.1 @@ -118,6 +123,7 @@ topology_template: properties: provider: ONAP startPhase: 0 + stage: [1,2] onap.policy.clamp.ac.element.Sim_BridgeAutomationCompositionElement: version: 1.2.3 @@ -127,6 +133,7 @@ topology_template: properties: provider: ONAP startPhase: 0 + stage: [0,1] onap.policy.clamp.ac.element.Sim_SinkAutomationCompositionElement: version: 1.2.3 @@ -136,6 +143,7 @@ topology_template: properties: provider: ONAP startPhase: 0 + stage: [0,2] onap.policy.clamp.ac.element.AutomationCompositionDefinition: version: 1.2.3 diff --git a/csit/resources/tests/data/ac-definition-migration-to.yaml b/csit/resources/tests/data/ac-definition-migration-to.yaml index efc550b0..179fe11c 100644 --- a/csit/resources/tests/data/ac-definition-migration-to.yaml +++ b/csit/resources/tests/data/ac-definition-migration-to.yaml @@ -57,6 +57,11 @@ node_types: first start phase is zero. Automation Composition Elements are started in their start_phase order and stopped in reverse start phase order. Automation Composition Elements with the same start phase are started and stopped simultaneously + stage: + type: list + description: A list indicating the stages in which this automation composition element will be started, the + first stage is zero. Automation Composition Elements are started in their stage order. + Automation Composition Elements with the same stage are started simultaneously. org.onap.policy.clamp.acm.AutomationComposition: version: 1.0.1 @@ -118,6 +123,7 @@ topology_template: properties: provider: ONAP startPhase: 0 + stage: [1,2] onap.policy.clamp.ac.element.Sim_BridgeAutomationCompositionElement: version: 1.2.4 @@ -127,8 +133,9 @@ topology_template: properties: provider: ONAP startPhase: 0 + stage: [0,1] - onap.policy.clamp.ac.element.Sim_SinkAutomationCompositionElement: + onap.policy.clamp.ac.element.Sim_NewAutomationCompositionElement: version: 1.2.4 type: org.onap.policy.clamp.acm.SimAutomationCompositionElement type_version: 1.0.0 @@ -136,6 +143,7 @@ topology_template: properties: provider: ONAP startPhase: 0 + stage: [0,2] onap.policy.clamp.ac.element.AutomationCompositionDefinition: version: 1.2.4 @@ -149,5 +157,5 @@ topology_template: version: 1.2.4 - name: onap.policy.clamp.ac.element.Sim_BridgeAutomationCompositionElement version: 1.2.4 - - name: onap.policy.clamp.ac.element.Sim_SinkAutomationCompositionElement + - name: onap.policy.clamp.ac.element.Sim_NewAutomationCompositionElement version: 1.2.4 diff --git a/csit/resources/tests/data/ac-instance-migration-to.yaml b/csit/resources/tests/data/ac-instance-migration-to.yaml index 65b684a3..68a31a59 100644 --- a/csit/resources/tests/data/ac-instance-migration-to.yaml +++ b/csit/resources/tests/data/ac-instance-migration-to.yaml @@ -47,10 +47,10 @@ elements: - configurationEntityId: myParameterToUpdate: TEXTPLACEHOLDER - 709c62b3-8918-41b9-a747-d21eb79c6c36: - id: 709c62b3-8918-41b9-a747-d21eb79c6c36 + 709c62b3-8918-41b9-a747-d21eb79c6c37: + id: 709c62b3-8918-41b9-a747-d21eb79c6c37 definition: - name: onap.policy.clamp.ac.element.Sim_SinkAutomationCompositionElement + name: onap.policy.clamp.ac.element.Sim_NewAutomationCompositionElement version: 1.2.4 description: Sink Automation Composition Element for the Demo properties: diff --git a/csit/resources/tests/data/ac-instance-precheck-migration.yaml b/csit/resources/tests/data/ac-instance-precheck-migration.yaml new file mode 100644 index 00000000..3380c157 --- /dev/null +++ b/csit/resources/tests/data/ac-instance-precheck-migration.yaml @@ -0,0 +1,60 @@ +# ============LICENSE_START======================================================= +# Copyright (C) 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========================================================= +name: Instance-Migration-To +version: 1.0.1 +compositionId: COMPOSITIONIDPLACEHOLDER +instanceId: INSTACEIDPLACEHOLDER +compositionTargetId: COMPOSITIONTARGETIDPLACEHOLDER +precheck: true +description: Demo automation composition instance 0 +elements: + + 709c62b3-8918-41b9-a747-d21eb79c6c34: + id: 709c62b3-8918-41b9-a747-d21eb79c6c34 + definition: + name: onap.policy.clamp.ac.element.Sim_StarterAutomationCompositionElement + version: 1.2.4 + description: Starter Automation Composition Element for the Demo + properties: + baseUrl: http://10.101.0.249:30800 + configurationEntities: + - configurationEntityId: + myParameterToUpdate: text updated for migration + + 709c62b3-8918-41b9-a747-d21eb79c6c35: + id: 709c62b3-8918-41b9-a747-d21eb79c6c35 + definition: + name: onap.policy.clamp.ac.element.Sim_BridgeAutomationCompositionElement + version: 1.2.4 + description: Bridge Automation Composition Element for the Demo + properties: + baseUrl: http://10.101.0.249:30801 + configurationEntities: + - configurationEntityId: + myParameterToUpdate: TEXTPLACEHOLDER + + 709c62b3-8918-41b9-a747-d21eb79c6c37: + id: 709c62b3-8918-41b9-a747-d21eb79c6c37 + definition: + name: onap.policy.clamp.ac.element.Sim_NewAutomationCompositionElement + version: 1.2.4 + description: Sink Automation Composition Element for the Demo + properties: + configurationEntities: + - configurationEntityId: + myParameterToUpdate: text updated for migration diff --git a/csit/resources/tests/data/deploy.drools.policies.json b/csit/resources/tests/data/drools/deploy.drools.policies.json index 24c90d0d..24c90d0d 100644 --- a/csit/resources/tests/data/deploy.drools.policies.json +++ b/csit/resources/tests/data/drools/deploy.drools.policies.json diff --git a/csit/resources/tests/data/deploy.xacml.policies.json b/csit/resources/tests/data/drools/deploy.xacml.policies.json index 46da9021..46da9021 100644 --- a/csit/resources/tests/data/deploy.xacml.policies.json +++ b/csit/resources/tests/data/drools/deploy.xacml.policies.json diff --git a/csit/resources/tests/data/vcpeOnset.json b/csit/resources/tests/data/drools/vcpeOnset.json index 7dd9d5a0..7dd9d5a0 100644 --- a/csit/resources/tests/data/vcpeOnset.json +++ b/csit/resources/tests/data/drools/vcpeOnset.json diff --git a/csit/resources/tests/data/vdnsOnset.json b/csit/resources/tests/data/drools/vdnsOnset.json index 13f69095..13f69095 100644 --- a/csit/resources/tests/data/vdnsOnset.json +++ b/csit/resources/tests/data/drools/vdnsOnset.json diff --git a/csit/resources/tests/data/vfwOnset.json b/csit/resources/tests/data/drools/vfwOnset.json index 7782867a..7782867a 100644 --- a/csit/resources/tests/data/vfwOnset.json +++ b/csit/resources/tests/data/drools/vfwOnset.json diff --git a/csit/resources/tests/distribution-test.robot b/csit/resources/tests/distribution-test.robot index b8b49248..d5fc10e1 100644 --- a/csit/resources/tests/distribution-test.robot +++ b/csit/resources/tests/distribution-test.robot @@ -3,7 +3,7 @@ Library Collections Library RequestsLibrary Library OperatingSystem Library json -Resource ${CURDIR}/common-library.robot +Resource common-library.robot *** Test Cases *** diff --git a/csit/resources/tests/drools-applications-slas.robot b/csit/resources/tests/drools-applications-slas.robot new file mode 100644 index 00000000..a153925d --- /dev/null +++ b/csit/resources/tests/drools-applications-slas.robot @@ -0,0 +1,14 @@ +*** Settings *** +Library OperatingSystem +Resource common-library.robot + +*** Test Cases *** +WaitForPrometheusServer + [Documentation] Sleep time to wait for Prometheus server to gather all metrics + Sleep 1 minute + +ValidatePolicyExecutionTimes + [Documentation] Validate policy execution times using prometheus metrics + ValidatePolicyExecution pdpd_policy_executions_latency_seconds_count{controller="usecases",controlloop="ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3",policy="operational.scaleout:1.0.0",status="SUCCESS", instance="policy-drools-apps:9696", job="drools-apps-metrics"} 1000 + ValidatePolicyExecution pdpd_policy_deployments_total{state="ACTIVE",operation="deploy",status="SUCCESS", instance="policy-drools-apps:9696", job="drools-apps-metrics"} 3000 + diff --git a/csit/resources/tests/drools-applications-test.robot b/csit/resources/tests/drools-applications-test.robot index edbc1df6..4ceb288b 100644 --- a/csit/resources/tests/drools-applications-test.robot +++ b/csit/resources/tests/drools-applications-test.robot @@ -10,144 +10,188 @@ Resource common-library.robot *** Test Cases *** Alive [Documentation] Runs Policy PDP Alive Check - ${resp}= PeformGetRequest /policy/pdp/engine ${DROOLS_IP_2} 200 + ${resp}= PerformGetRequestOnDrools /policy/pdp/engine ${DROOLS_IP_2} 200 Should Be Equal As Strings ${resp.json()['alive']} True Metrics [Documentation] Verify drools-apps is exporting metrics - ${resp}= PeformGetRequest /metrics ${DROOLS_IP_2} 200 + ${resp}= PerformGetRequestOnDrools /metrics ${DROOLS_IP_2} 200 Should Contain ${resp.text} jvm_threads_current Healthcheck [Documentation] Runs Policy PDP-D Health check - ${resp}= PeformGetRequest /healthcheck ${DROOLS_IP} 200 + ${resp}= PerformGetRequestOnDrools /healthcheck ${DROOLS_IP} 200 Should Be Equal As Strings ${resp.json()['healthy']} True -#Controller -# [Documentation] Checks controller is up -# Wait Until Keyword Succeeds 2 min 15 sec VerifyController +Controller + [Documentation] Checks controller is up + Wait Until Keyword Succeeds 2 min 15 sec VerifyController -MakeTopics - [Documentation] Creates the Policy topics +AssertTopicsOnKafkaClient + [Documentation] Verify that the Policy topics policy-pdp-pap and policy-cl-mgt are available on kafka GetKafkaTopic policy-pdp-pap GetKafkaTopic policy-cl-mgt +CheckTopics + [Documentation] List the topics registered with TopicManager + ${resp}= PerformGetRequestOnDrools /policy/pdp/engine/topics ${DROOLS_IP_2} 200 + Should Contain ${resp.text} policy-cl-mgt + Should Contain ${resp.text} policy-pdp-pap + Should Contain ${resp.text} dcae_topic + +CheckEngineFeatures + [Documentation] List the features available in the drools engine + ${resp}= PerformGetRequestOnDrools /policy/pdp/engine/features ${DROOLS_IP_2} 200 + Should Contain ${resp.text} "org.onap.policy.drools.lifecycle.LifecycleFeature" + Should Contain ${resp.text} "org.onap.policy.drools.apps.controlloop.feature.usecases.UsecasesFeature" + Should Contain ${resp.text} "org.onap.policy.drools.healthcheck.HealthCheckFeature" + +CheckPolicyTypes + [Documentation] Check if the needed Policy types are available + ${auth}= PolicyAdminAuth + ${resp}= PerformGetRequest ${POLICY_API_IP} /policy/api/v1/policytypes 200 null ${auth} + Should Contain ${resp.text} onap.policies.monitoring.tcagen2 + Should Contain ${resp.text} onap.policies.controlloop.operational.common.Drools + CreateVcpeXacmlPolicy [Documentation] Create VCPE Policy for Xacml - PerformPostRequest /policy/api/v1/policies null ${POLICY_API_IP} vCPE.policy.monitoring.input.tosca.yaml ${DATA} yaml 200 + CreatePolicy vCPE.policy.monitoring.input.tosca.yaml yaml CreateVcpeDroolsPolicy [Documentation] Create VCPE Policy for Drools - PerformPostRequest /policy/api/v1/policies null ${POLICY_API_IP} vCPE.policy.operational.input.tosca.yaml ${DATA} yaml 200 + CreatePolicy vCPE.policy.operational.input.tosca.yaml yaml CreateVdnsXacmlPolicy [Documentation] Create VDNS Policy for Xacml - PerformPostRequest /policy/api/v1/policies null ${POLICY_API_IP} vDNS.policy.monitoring.input.tosca.yaml ${DATA} yaml 200 + CreatePolicy vDNS.policy.monitoring.input.tosca.yaml yaml CreateVdnsDroolsPolicy [Documentation] Create VDNS Policy for Drools - PerformPostRequest /policy/api/v1/policies null ${POLICY_API_IP} vDNS.policy.operational.input.tosca.json ${DATA} json 200 + CreatePolicy vDNS.policy.operational.input.tosca.json json CreateVfwXacmlPolicy [Documentation] Create VFW Policy for Xacml - PerformPostRequest /policy/api/v1/policies null ${POLICY_API_IP} vFirewall.policy.monitoring.input.tosca.yaml ${DATA} yaml 200 + CreatePolicy vFirewall.policy.monitoring.input.tosca.yaml yaml CreateVfwDroolsPolicy [Documentation] Create VFW Policy for Drools - PerformPostRequest /policy/api/v1/policies null ${POLICY_API_IP} vFirewall.policy.operational.input.tosca.json ${DATA} json 200 + CreatePolicy vFirewall.policy.operational.input.tosca.json json + +CheckCreatedPolicies + [Documentation] Verify that all created policies are available for deployment + ${auth}= PolicyAdminAuth + ${resp}= PerformGetRequest ${POLICY_API_IP} /policy/api/v1/policies 200 null ${auth} + #vcpe xacml + Should Contain ${resp.text} onap.restart.tca + #vcpe drools + Should Contain ${resp.text} operational.restart + #vnds xacml + Should Contain ${resp.text} onap.scaleout.tca + #vnds drools + Should Contain ${resp.text} operational.scaleout + #vfirewall xacml + Should Contain ${resp.text} onap.vfirewall.tca + #vfirewall drools + Should Contain ${resp.text} operational.modifyconfig DeployXacmlPolicies [Documentation] Deploys the Policies to Xacml - PerformPostRequest /policy/pap/v1/pdps/deployments/batch null ${POLICY_PAP_IP} deploy.xacml.policies.json ${CURDIR}/data json 202 + DeployPolicy deploy.xacml.policies.json Sleep 5s - ${result}= CheckKafkaTopic policy-notification onap.vfirewall.tca - Should Contain ${result} deployed-policies - Should Contain ${result} onap.scaleout.tca - Should Contain ${result} onap.restart.tca - -# Uncomment the drools policy deployment once the drools pdp code is fixed -#DeployDroolsPolicies -# [Documentation] Deploys the Policies to Drools -# PerformPostRequest /policy/pap/v1/pdps/deployments/batch null ${POLICY_PAP_IP} deploy.drools.policies.json ${CURDIR}/data json 202 -# Sleep 5s -# ${result}= CheckKafkaTopic policy-notification operational.modifyconfig -# Should Contain ${result} deployed-policies -# Should Contain ${result} operational.scaleout -# Should Contain ${result} operational.restart -# -#VcpeExecute -# [Documentation] Executes VCPE Policy -# OnSet ${CURDIR}/data/vcpeOnset.json -# ${result}= CheckKafkaTopic policy-cl-mgt ACTIVE -# Should Contain ${result} ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e -# ${result}= CheckKafkaTopic policy-cl-mgt OPERATION -# Should Contain ${result} ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e -# Should Contain ${result} Sending guard query for APPC Restart -# ${result}= CheckKafkaTopic policy-cl-mgt OPERATION -# Should Contain ${result} ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e -# Should Contain ${result} Guard result for APPC Restart is Permit -# ${result}= CheckKafkaTopic policy-cl-mgt OPERATION -# Should Contain ${result} ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e -# Should Contain ${result} actor=APPC,operation=Restart -# ${result}= CheckKafkaTopic policy-cl-mgt OPERATION: SUCCESS -# Should Contain ${result} ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e -# Should Contain ${result} actor=APPC,operation=Restart -# ${result}= CheckKafkaTopic policy-cl-mgt FINAL: SUCCESS -# Should Contain ${result} ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e -# Should Contain ${result} APPC -# Should Contain ${result} Restart + @{otherMessages}= Create List deployed-policies onap.scaleout.tca onap.restart.tca + AssertMessageFromTopic policy-notification onap.vfirewall.tca ${otherMessages} + +VerifyDeployedXacmlPolicies + [Documentation] Verify if xacml policies were deployed correctly + ${resp}= GetDeployedPolicies + @{policies}= Create List onap.vfirewall.tca onap.scaleout.tca onap.restart.tca + FOR ${policy} IN @{policies} + Should Contain ${resp.text} ${policy} + END + +DeployDroolsPolicies + [Documentation] Deploys the Policies to Drools + DeployPolicy deploy.drools.policies.json + Sleep 5s + @{otherMessages}= Create List deployed-policies operational.scaleout operational.restart + AssertMessageFromTopic policy-notification operational.modifyconfig ${otherMessages} + +VerifyDeployedDroolsPolicies + [Documentation] Verify if drools policies were deployed correctly + ${resp}= GetDeployedPolicies + @{policies}= Create List operational.modifyconfig operational.scaleout operational.restart + FOR ${policy} IN @{policies} + Should Contain ${resp.text} ${policy} + END + +VcpeExecute + [Documentation] Executes VCPE Policy + OnSet ${CURDIR}/data/drools/vcpeOnset.json + ${policyExecuted}= Set Variable ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e + @{otherMessages}= Create List ACTIVE + AssertMessageFromTopic policy-cl-mgt ${policyExecuted} ${otherMessages} + + @{otherMessages}= Create List ${policyExecuted} OPERATION + AssertMessageFromTopic policy-cl-mgt Sending guard query for APPC Restart ${otherMessages} + + AssertMessageFromTopic policy-cl-mgt Guard result for APPC Restart is Permit ${otherMessages} + + AssertMessageFromTopic policy-cl-mgt actor=APPC,operation=Restart ${otherMessages} + +# @{otherMessages}= Create List OPERATION: SUCCESS actor=APPC,operation=Restart +# AssertMessageFromTopic policy-cl-mgt ${policyExecuted} ${otherMessages} # -#VdnsExecute -# [Documentation] Executes VDNS Policy -# OnSet ${CURDIR}/data/vdnsOnset.json -# ${result}= CheckKafkaTopic policy-cl-mgt ACTIVE -# Should Contain ${result} ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3 -# ${result}= CheckKafkaTopic policy-cl-mgt OPERATION -# Should Contain ${result} ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3 -# Should Contain ${result} Sending guard query for SO VF Module Create -# ${result}= CheckKafkaTopic policy-cl-mgt OPERATION -# Should Contain ${result} ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3 -# Should Contain ${result} Guard result for SO VF Module Create is Permit -# ${result}= CheckKafkaTopic policy-cl-mgt OPERATION -# Should Contain ${result} ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3 -# Should Contain ${result} actor=SO,operation=VF Module Create -# ${result}= CheckKafkaTopic policy-cl-mgt OPERATION: SUCCESS -# Should Contain ${result} ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3 -# Should Contain ${result} actor=SO,operation=VF Module Create -# ${result}= CheckKafkaTopic policy-cl-mgt FINAL: SUCCESS -# Should Contain ${result} ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3 -# Should Contain ${result} SO -# Should Contain ${result} VF Module Create +# @{otherMessages}= Create List FINAL: SUCCESS APPC Restart +# AssertMessageFromTopic policy-cl-mgt ${policyExecuted} ${otherMessages} + +VdnsExecute + [Documentation] Executes VDNS Policy + OnSet ${CURDIR}/data/drools/vdnsOnset.json + ${policyExecuted}= Set Variable ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3 + @{otherMessages}= Create List ACTIVE + AssertMessageFromTopic policy-cl-mgt ${policyExecuted} ${otherMessages} + + @{otherMessages}= Create List ${policyExecuted} OPERATION + AssertMessageFromTopic policy-cl-mgt Sending guard query for SO VF Module Create ${otherMessages} + + AssertMessageFromTopic policy-cl-mgt Guard result for SO VF Module Create is Permit ${otherMessages} + + AssertMessageFromTopic policy-cl-mgt actor=SO,operation=VF Module Create ${otherMessages} + + @{otherMessages}= Create List ${policyExecuted} OPERATION: SUCCESS + AssertMessageFromTopic policy-cl-mgt actor=SO,operation=VF Module Create ${otherMessages} + + @{otherMessages}= Create List ${policyExecuted} FINAL: SUCCESS SO + AssertMessageFromTopic policy-cl-mgt VF Module Create ${otherMessages} + +VfwExecute + [Documentation] Executes VFW Policy + OnSet ${CURDIR}/data/drools/vfwOnset.json + ${policyExecuted}= Set Variable ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a + @{otherMessages}= Create List ACTIVE + AssertMessageFromTopic policy-cl-mgt ${policyExecuted} ${otherMessages} + + @{otherMessages}= Create List ${policyExecuted} OPERATION + AssertMessageFromTopic policy-cl-mgt Sending guard query for APPC ModifyConfig ${otherMessages} + + AssertMessageFromTopic policy-cl-mgt Guard result for APPC ModifyConfig is Permit ${otherMessages} + + AssertMessageFromTopic policy-cl-mgt actor=APPC,operation=ModifyConfig ${otherMessages} + +# @{otherMessages}= Create List OPERATION: SUCCESS actor=APPC,operation=ModifyConfig +# AssertMessageFromTopic policy-cl-mgt ${policyExecuted} ${otherMessages} # -#VfwExecute -# [Documentation] Executes VFW Policy -# OnSet ${CURDIR}/data/vfwOnset.json -# ${result}= CheckKafkaTopic policy-cl-mgt ACTIVE -# Should Contain ${result} ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a -# ${result}= CheckKafkaTopic policy-cl-mgt OPERATION -# Should Contain ${result} ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a -# Should Contain ${result} Sending guard query for APPC ModifyConfig -# ${result}= CheckKafkaTopic policy-cl-mgt OPERATION -# Should Contain ${result} ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a -# Should Contain ${result} Guard result for APPC ModifyConfig is Permit -# ${result}= CheckKafkaTopic policy-cl-mgt OPERATION -# Should Contain ${result} ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a -# Should Contain ${result} actor=APPC,operation=ModifyConfig -# ${result}= CheckKafkaTopic policy-cl-mgt OPERATION: SUCCESS -# Should Contain ${result} ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a -# Should Contain ${result} actor=APPC,operation=ModifyConfig -# ${result}= CheckKafkaTopic policy-cl-mgt FINAL: SUCCESS -# Should Contain ${result} ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a -# Should Contain ${result} APPC -# Should Contain ${result} ModifyConfig +# @{otherMessages}= Create List FINAL: SUCCESS APPC ModifyConfig +# AssertMessageFromTopic policy-cl-mgt ${policyExecuted} ${otherMessages} + *** Keywords *** VerifyController - ${resp}= PeformGetRequest /policy/pdp/engine/controllers/usecases/drools/facts ${DROOLS_IP_2} 200 + ${resp}= PerformGetRequestOnDrools /policy/pdp/engine/controllers/usecases/drools/facts ${DROOLS_IP_2} 200 Should Be Equal As Strings ${resp.json()['usecases']} 1 -PeformGetRequest +PerformGetRequestOnDrools [Arguments] ${url} ${domain} ${expectedstatus} ${auth}= Create List demo@people.osaaf.org demo123456! Log Creating session http://${domain} @@ -158,19 +202,45 @@ PeformGetRequest RETURN ${resp} PerformPostRequest - [Arguments] ${url} ${params} ${domain} ${jsonfile} ${filepath} ${contenttype} ${expectedstatus} + [Arguments] ${url} ${domain} ${file} ${folder} ${contenttype} ${expectedstatus} ${auth}= Create List policyadmin zb!XztG34 - ${postjson}= Get file ${filepath}/${jsonfile} + ${body}= Get file ${folder}/${file} Log Creating session http://${domain} ${session}= Create Session policy http://${domain} auth=${auth} ${headers}= Create Dictionary Accept=application/${contenttype} Content-Type=application/${contenttype} - ${resp}= POST On Session policy ${url} params=${params} data=${postjson} headers=${headers} expected_status=${expectedstatus} + ${resp}= POST On Session policy ${url} data=${body} headers=${headers} expected_status=${expectedstatus} Log Received response from policy ${resp.text} RETURN ${resp} OnSet [Arguments] ${file} ${data}= Get File ${file} - ${resp}= Run Process ${CURDIR}/kafka_producer.py unauthenticated.dcae_cl_output ${data} ${KAFKA_IP} + ${resp}= Run Process ${CURDIR}/kafka_producer.py dcae_topic ${data} ${KAFKA_IP} Log Response from kafka ${resp.stdout} RETURN ${resp.stdout} + +CreatePolicy + [Arguments] ${policyFile} ${contenttype} + PerformPostRequest /policy/api/v1/policies ${POLICY_API_IP} ${policyFile} ${DATA} ${contenttype} 201 + +DeployPolicy + [Arguments] ${policyName} + PerformPostRequest /policy/pap/v1/pdps/deployments/batch ${POLICY_PAP_IP} ${policyName} ${CURDIR}/data/drools json 202 + +AssertMessageFromTopic + [Arguments] ${topic} ${topicMessage} ${otherMessages} + ${response}= Wait Until Keyword Succeeds 4 x 10 sec CheckKafkaTopic ${topic} ${topicMessage} + FOR ${msg} IN @{otherMessages} + Should Contain ${response} ${msg} + END + +GetDeployedPolicies + ${auth}= PolicyAdminAuth + ${resp}= PerformGetRequest ${POLICY_PAP_IP} /policy/pap/v1/policies/deployed 200 null ${auth} + RETURN ${resp} + +VerifyEventsOnTopic + [Arguments] ${topic} ${type} + ${resp}= PerformGetRequestOnDrools /policy/pdp/engine/topics/${type}/kafka/${topic}/events ${DROOLS_IP_2} 200 + Log Events: ${resp.json()} + RETURN ${resp} diff --git a/csit/resources/tests/kafka_consumer.py b/csit/resources/tests/kafka_consumer.py index fa173f47..53a2e39f 100755 --- a/csit/resources/tests/kafka_consumer.py +++ b/csit/resources/tests/kafka_consumer.py @@ -27,34 +27,28 @@ import sys import time -def consume_kafka_topic(topic, expected_values, timeout, bootstrap_server): +def consume_kafka_topic(topic, expected_msg, sec_timeout, bootstrap_server): config = { - 'bootstrap.servers': bootstrap_server, - 'group.id': 'testgrp', - 'auto.offset.reset': 'earliest' + 'bootstrap.servers': bootstrap_server, + 'group.id': 'testgrp', + 'auto.offset.reset': 'earliest' } consumer = Consumer(config) consumer.subscribe([topic]) try: start_time = time.time() - while time.time() - start_time < timeout: - msg = consumer.poll(1.0) - if msg is None: - continue - if msg.error(): - if msg.error().code() == KafkaException._PARTITION_EOF: - sys.stderr.write(f"Reached end of topic {msg.topic()} / partition {msg.partition()}\n") - print('ERROR') - sys.exit(404) - else: - # Error - raise KafkaException(msg.error()) - else: - # Message received - message = msg.value().decode('utf-8') - if expected_values in message: - print(message) - sys.exit(200) + while time.time() - start_time < sec_timeout: + msg = consumer.poll(1.0) + if msg is None: + continue + if msg.error(): + raise KafkaException(msg.error()) + else: + # Message received + message = msg.value().decode('utf-8') + if expected_msg in message: + print(message) + sys.exit(200) finally: consumer.close() @@ -63,5 +57,5 @@ if __name__ == '__main__': topic_name = sys.argv[1] timeout = int(sys.argv[2]) # timeout in seconds for verifying the kafka topic expected_values = sys.argv[3] - bootstrap_server = sys.argv[4] - consume_kafka_topic(topic_name, expected_values, timeout, bootstrap_server) + server = sys.argv[4] + consume_kafka_topic(topic_name, expected_values, timeout, server) diff --git a/csit/resources/tests/kafka_producer.py b/csit/resources/tests/kafka_producer.py index a7d45647..e960b934 100755 --- a/csit/resources/tests/kafka_producer.py +++ b/csit/resources/tests/kafka_producer.py @@ -24,6 +24,7 @@ from confluent_kafka import Producer import sys + def post_to_kafka(topic, message, bootstrap_server): conf = {'bootstrap.servers': bootstrap_server} @@ -37,5 +38,6 @@ def post_to_kafka(topic, message, bootstrap_server): finally: producer.flush() + if __name__ == '__main__': post_to_kafka(sys.argv[1], sys.argv[2], sys.argv[3]) diff --git a/csit/resources/tests/make_topics.py b/csit/resources/tests/make_topics.py index 82b1dc39..bf6d6e34 100755 --- a/csit/resources/tests/make_topics.py +++ b/csit/resources/tests/make_topics.py @@ -24,18 +24,19 @@ from confluent_kafka.admin import AdminClient, NewTopic import sys + def create_topic(bootstrap_servers, topic_name, num_partitions=2, replication_factor=2): admin_client = AdminClient({'bootstrap.servers': bootstrap_servers}) # Define the topic configuration - topic = NewTopic(topic_name, num_partitions=num_partitions, replication_factor=replication_factor) + new_topic = NewTopic(topic_name, num_partitions=num_partitions, replication_factor=replication_factor) # Create the topic - admin_client.create_topics([topic]) + admin_client.create_topics([new_topic]) if __name__ == '__main__': - topic_name = sys.argv[1] - bootstrap_servers = sys.argv[2] + topic = sys.argv[1] + servers = sys.argv[2] - create_topic(bootstrap_servers, topic_name) + create_topic(servers, topic) diff --git a/csit/resources/tests/pap-slas.robot b/csit/resources/tests/pap-slas.robot index 4a044675..e241ee9f 100644 --- a/csit/resources/tests/pap-slas.robot +++ b/csit/resources/tests/pap-slas.robot @@ -3,7 +3,7 @@ Library Collections Library RequestsLibrary Library OperatingSystem Library json -Resource ${CURDIR}/common-library.robot +Resource common-library.robot *** Keywords *** ValidateResponseTimeForPap diff --git a/csit/resources/tests/pap-test.robot b/csit/resources/tests/pap-test.robot index 13bf16ed..e66820c7 100644 --- a/csit/resources/tests/pap-test.robot +++ b/csit/resources/tests/pap-test.robot @@ -3,7 +3,7 @@ Library Collections Library RequestsLibrary Library OperatingSystem Library json -Resource ${CURDIR}/common-library.robot +Resource common-library.robot *** Keywords *** GetReq @@ -19,17 +19,17 @@ CheckUndeploymentStatus LoadPolicy [Documentation] Create a policy named 'onap.restart.tca' and version '1.0.0' using specific api ${postjson}= Get file ${DATA}/vCPE.policy.monitoring.input.tosca.json - CreatePolicy /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies 200 ${postjson} onap.restart.tca 1.0.0 + CreatePolicy /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies 201 ${postjson} onap.restart.tca 1.0.0 LoadPolicyWithMetadataSet [Documentation] Create a policy named 'operational.apex.decisionMaker' and version '1.0.0' using specific api ${postjson}= Get file ${CURDIR}/data/apex.policy.decisionmaker.input.tosca.json - CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} operational.apex.decisionMaker 1.0.0 + CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies ${postjson} operational.apex.decisionMaker 1.0.0 LoadNodeTemplates [Documentation] Create node templates in database using specific api ${postjson}= Get file ${NODETEMPLATES}/nodetemplates.metadatasets.input.tosca.json - CreateNodeTemplate /policy/api/v1/nodetemplates 200 ${postjson} 3 + CreateNodeTemplate /policy/api/v1/nodetemplates 201 ${postjson} 3 Healthcheck [Documentation] Verify policy pap health check @@ -46,11 +46,11 @@ Metrics [Documentation] Verify policy pap is exporting prometheus metrics ${auth}= PolicyAdminAuth ${resp}= GetMetrics ${POLICY_PAP_IP} ${auth} /policy/pap/v1/ - Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="GET",outcome="SUCCESS",status="200",uri="/healthcheck",} - Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="GET",outcome="SUCCESS",status="200",uri="/components/healthcheck",} 1.0 - Should Contain ${resp.text} spring_data_repository_invocations_seconds_count{exception="None",method="save",repository="PdpGroupRepository",state="SUCCESS",} 1.0 - Should Contain ${resp.text} spring_data_repository_invocations_seconds_count{exception="None",method="findByKeyName",repository="PdpGroupRepository",state="SUCCESS",} 1.0 - Should Contain ${resp.text} spring_data_repository_invocations_seconds_count{exception="None",method="findAll",repository="PolicyStatusRepository",state="SUCCESS",} + Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="GET",outcome="SUCCESS",status="200",uri="/healthcheck"} + Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="GET",outcome="SUCCESS",status="200",uri="/components/healthcheck"} 1 + Should Contain ${resp.text} spring_data_repository_invocations_seconds_count{exception="None",method="save",repository="PdpGroupRepository",state="SUCCESS"} 1 + Should Contain ${resp.text} spring_data_repository_invocations_seconds_count{exception="None",method="findByKeyName",repository="PdpGroupRepository",state="SUCCESS"} 1 + Should Contain ${resp.text} spring_data_repository_invocations_seconds_count{exception="None",method="findAll",repository="PolicyStatusRepository",state="SUCCESS"} AddPdpGroup [Documentation] Add a new PdpGroup named 'testGroup' in the policy database diff --git a/csit/resources/tests/policy-clamp-test.robot b/csit/resources/tests/policy-clamp-test.robot index 9d69520a..1c2ea031 100644 --- a/csit/resources/tests/policy-clamp-test.robot +++ b/csit/resources/tests/policy-clamp-test.robot @@ -9,463 +9,598 @@ Resource common-library.robot *** Test Cases *** HealthcheckAcm - [Documentation] Healthcheck on Clamp Acm - ${auth}= Create List runtimeUser zb!XztG34 - Log Creating session http://${POLICY_RUNTIME_ACM_IP} - ${session}= Create Session ACM http://${POLICY_RUNTIME_ACM_IP} auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= GET On Session ACM /onap/policy/clamp/acm/health headers=${headers} - Log Received response from ACM healthcheck {resp.text} - Should Be Equal As Strings ${resp.status_code} 200 + [Documentation] Healthcheck on Clamp Acm + ${auth}= ClampAuth + ${resp}= MakeGetRequest ACM ${POLICY_RUNTIME_ACM_IP} onap/policy/clamp/acm/health ${auth} + Should Be Equal As Strings ${resp.status_code} 200 HealthcheckParticipantSim - [Documentation] Healthcheck on Participant Simulator - ${auth}= Create List participantUser zb!XztG34 - Log Creating session http://${POLICY_PARTICIPANT_SIM_IP} - ${session}= Create Session participant http://${POLICY_PARTICIPANT_SIM_IP} auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= GET On Session participant /onap/policy/simparticipant/health headers=${headers} - Log Received response from participant healthcheck {resp.text} - Should Be Equal As Strings ${resp.status_code} 200 + [Documentation] Healthcheck on Participant Simulator + ${auth}= ParticipantAuth + ${resp}= MakeGetRequest participant ${POLICY_PARTICIPANT_SIM_IP} /onap/policy/simparticipant/health ${auth} + Should Be Equal As Strings ${resp.status_code} 200 HealthcheckApi - [Documentation] Healthcheck on policy-api - Wait Until Keyword Succeeds 5 min 10 sec VerifyHealthcheckApi + [Documentation] Healthcheck on policy-api + Wait Until Keyword Succeeds 5 min 10 sec VerifyHealthcheckApi HealthcheckPap - [Documentation] Healthcheck on policy-pap - Wait Until Keyword Succeeds 5 min 10 sec VerifyHealthcheckPap + [Documentation] Healthcheck on policy-pap + Wait Until Keyword Succeeds 5 min 10 sec VerifyHealthcheckPap RegisterParticipants - [Documentation] Register Participants. - ${auth}= Create List runtimeUser zb!XztG34 - Log Creating session http://${POLICY_RUNTIME_ACM_IP} - ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} - ${resp}= PUT On Session policy /onap/policy/clamp/acm/v2/participants - Log Received response from runtime acm ${resp.text} - Should Be Equal As Strings ${resp.status_code} 202 + [Documentation] Register Participants. + ${auth}= ClampAuth + Log Creating session http://${POLICY_RUNTIME_ACM_IP} + ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} + ${resp}= PUT On Session policy /onap/policy/clamp/acm/v2/participants + Log Received response from runtime acm ${resp.text} + Should Be Equal As Strings ${resp.status_code} 202 CommissionAutomationComposition - [Documentation] Commission automation composition definition. - ${auth}= Create List runtimeUser zb!XztG34 - Log Creating session http://${POLICY_RUNTIME_ACM_IP} - ${postyaml}= Get file ${CURDIR}/data/acelement-usecase.yaml - ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} - ${headers}= Create Dictionary Accept=application/yaml Content-Type=application/yaml - ${resp}= POST On Session policy /onap/policy/clamp/acm/v2/compositions data=${postyaml} headers=${headers} - Log Received response from runtime acm ${resp.text} - ${respyaml}= yaml.Safe Load ${resp.text} - set Suite variable ${compositionId} ${respyaml["compositionId"]} - Should Be Equal As Strings ${resp.status_code} 201 + [Documentation] Commission automation composition definition. + ${auth}= ClampAuth + ${postyaml}= Get file ${CURDIR}/data/acelement-usecase.yaml + ${resp}= MakeYamlPostRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions ${postyaml} ${auth} + ${respyaml}= yaml.Safe Load ${resp.text} + set Suite variable ${compositionId} ${respyaml["compositionId"]} + Should Be Equal As Strings ${resp.status_code} 201 CommissionAcDefinitionMigrationFrom - [Documentation] Commission automation composition definition From. - ${auth}= Create List runtimeUser zb!XztG34 - Log Creating session http://${POLICY_RUNTIME_ACM_IP} - ${postyaml}= Get file ${CURDIR}/data/ac-definition-migration-from.yaml - ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} - ${headers}= Create Dictionary Accept=application/yaml Content-Type=application/yaml - ${resp}= POST On Session policy /onap/policy/clamp/acm/v2/compositions data=${postyaml} headers=${headers} - Log Received response from runtime acm ${resp.text} - ${respyaml}= yaml.Safe Load ${resp.text} - set Suite variable ${compositionFromId} ${respyaml["compositionId"]} - Should Be Equal As Strings ${resp.status_code} 201 + [Documentation] Commission automation composition definition From. + ${auth}= ClampAuth + ${postyaml}= Get file ${CURDIR}/data/ac-definition-migration-from.yaml + ${resp}= MakeYamlPostRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions ${postyaml} ${auth} + ${respyaml}= yaml.Safe Load ${resp.text} + set Suite variable ${compositionFromId} ${respyaml["compositionId"]} + Should Be Equal As Strings ${resp.status_code} 201 CommissionAcDefinitionMigrationTo - [Documentation] Commission automation composition definition To. - ${auth}= Create List runtimeUser zb!XztG34 - Log Creating session http://${POLICY_RUNTIME_ACM_IP} - ${postyaml}= Get file ${CURDIR}/data/ac-definition-migration-to.yaml - ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} - ${headers}= Create Dictionary Accept=application/yaml Content-Type=application/yaml - ${resp}= POST On Session policy /onap/policy/clamp/acm/v2/compositions data=${postyaml} headers=${headers} - Log Received response from runtime acm ${resp.text} - ${respyaml}= yaml.Safe Load ${resp.text} - set Suite variable ${compositionToId} ${respyaml["compositionId"]} - Should Be Equal As Strings ${resp.status_code} 201 + [Documentation] Commission automation composition definition To. + ${auth}= ClampAuth + ${postyaml}= Get file ${CURDIR}/data/ac-definition-migration-to.yaml + ${resp}= MakeYamlPostRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions ${postyaml} ${auth} + ${respyaml}= yaml.Safe Load ${resp.text} + set Suite variable ${compositionToId} ${respyaml["compositionId"]} + Should Be Equal As Strings ${resp.status_code} 201 PrimeACDefinitions - [Documentation] Prime automation composition definition - ${auth}= Create List runtimeUser zb!XztG34 - Log Creating session http://${POLICY_RUNTIME_ACM_IP} - ${postjson}= Get file ${CURDIR}/data/ACPriming.json - ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= PUT On Session policy /onap/policy/clamp/acm/v2/compositions/${compositionId} data=${postjson} headers=${headers} - Should Be Equal As Strings ${resp.status_code} 202 - Wait Until Keyword Succeeds 2 min 5 sec VerifyPriming ${compositionId} PRIMED + [Documentation] Prime automation composition definition + ${auth}= ClampAuth + ${postjson}= Get file ${CURDIR}/data/ACPriming.json + ${resp}= MakeJsonPutRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionId} ${postjson} ${auth} + Should Be Equal As Strings ${resp.status_code} 202 + Wait Until Keyword Succeeds 2 min 5 sec VerifyPriming ${compositionId} PRIMED + +FailPrimeACDefinitionFrom + [Documentation] Prime automation composition definition Migration From. + SetParticipantSimFail + ${auth}= ClampAuth + ${postjson}= Get file ${CURDIR}/data/ACPriming.json + ${resp}= MakeJsonPutRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionFromId} ${postjson} ${auth} + Should Be Equal As Strings ${resp.status_code} 202 + Wait Until Keyword Succeeds 2 min 5 sec VerifyFailedPriming ${compositionFromId} PrimeACDefinitionFrom - [Documentation] Prime automation composition definition Migration From. - ${auth}= Create List runtimeUser zb!XztG34 - Log Creating session http://${POLICY_RUNTIME_ACM_IP} - ${postjson}= Get file ${CURDIR}/data/ACPriming.json - ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= PUT On Session policy /onap/policy/clamp/acm/v2/compositions/${compositionFromId} data=${postjson} headers=${headers} - Should Be Equal As Strings ${resp.status_code} 202 - Wait Until Keyword Succeeds 2 min 5 sec VerifyPriming ${compositionFromId} PRIMED + [Documentation] Prime automation composition definition Migration From. + SetParticipantSimSuccess + ${auth}= ClampAuth + ${postjson}= Get file ${CURDIR}/data/ACPriming.json + ${resp}= MakeJsonPutRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionFromId} ${postjson} ${auth} + Should Be Equal As Strings ${resp.status_code} 202 + Wait Until Keyword Succeeds 2 min 5 sec VerifyPriming ${compositionFromId} PRIMED PrimeACDefinitionTo - [Documentation] Prime automation composition definition Migration To. - ${auth}= Create List runtimeUser zb!XztG34 - Log Creating session http://${POLICY_RUNTIME_ACM_IP} - ${postjson}= Get file ${CURDIR}/data/ACPriming.json - ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= PUT On Session policy /onap/policy/clamp/acm/v2/compositions/${compositionToId} data=${postjson} headers=${headers} - Should Be Equal As Strings ${resp.status_code} 202 - Wait Until Keyword Succeeds 2 min 5 sec VerifyPriming ${compositionToId} PRIMED + [Documentation] Prime automation composition definition Migration To. + ${auth}= ClampAuth + ${postjson}= Get file ${CURDIR}/data/ACPriming.json + ${resp}= MakeJsonPutRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionToId} ${postjson} ${auth} + Should Be Equal As Strings ${resp.status_code} 202 + Wait Until Keyword Succeeds 2 min 5 sec VerifyPriming ${compositionToId} PRIMED InstantiateAutomationComposition - [Documentation] Instantiate automation composition. - ${auth}= Create List runtimeUser zb!XztG34 - Log Creating session http://${POLICY_RUNTIME_ACM_IP} - Run Keyword If '${TEST_ENV}'=='k8s' set Suite variable ${instantiationfile} AcK8s.json - - ... ELSE set Suite variable ${instantiationfile} AcDocker.json - ${postjson}= Get file ${CURDIR}/data/${instantiationfile} - ${updatedpostjson}= Replace String ${postjson} COMPOSITIONIDPLACEHOLDER ${compositionId} - ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= POST On Session policy /onap/policy/clamp/acm/v2/compositions/${compositionId}/instances data=${updatedpostjson} headers=${headers} - Log Received response from runtime acm ${resp.text} - ${respyaml}= yaml.Safe Load ${resp.text} - set Suite variable ${instanceId} ${respyaml["instanceId"]} - Should Be Equal As Strings ${resp.status_code} 201 + [Documentation] Instantiate automation composition. + ${auth}= ClampAuth + Run Keyword If '${TEST_ENV}'=='k8s' set Suite variable ${instantiationfile} AcK8s.json + + ... ELSE set Suite variable ${instantiationfile} AcDocker.json + ${postjson}= Get file ${CURDIR}/data/${instantiationfile} + ${updatedpostjson}= Replace String ${postjson} COMPOSITIONIDPLACEHOLDER ${compositionId} + ${resp}= MakeJsonPostRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionId}/instances ${updatedpostjson} ${auth} + ${respyaml}= yaml.Safe Load ${resp.text} + set Suite variable ${instanceId} ${respyaml["instanceId"]} + Should Be Equal As Strings ${resp.status_code} 201 InstantiateAutomationCompositionMigrationFrom - [Documentation] Instantiate automation composition migration. - ${auth}= Create List runtimeUser zb!XztG34 - Log Creating session http://${POLICY_RUNTIME_ACM_IP} - ${postyaml}= Get file ${CURDIR}/data/ac-instance-migration-from.yaml - ${updatedpostyaml}= Replace String ${postyaml} COMPOSITIONIDPLACEHOLDER ${compositionFromId} - ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} - ${headers}= Create Dictionary Accept=application/yaml Content-Type=application/yaml - ${resp}= POST On Session policy /onap/policy/clamp/acm/v2/compositions/${compositionFromId}/instances data=${updatedpostyaml} headers=${headers} - Log Received response from runtime acm ${resp.text} - ${respyaml}= yaml.Safe Load ${resp.text} - set Suite variable ${instanceMigrationId} ${respyaml["instanceId"]} - Should Be Equal As Strings ${resp.status_code} 201 + [Documentation] Instantiate automation composition migration. + ${auth}= ClampAuth + ${postyaml}= Get file ${CURDIR}/data/ac-instance-migration-from.yaml + ${updatedpostyaml}= Replace String ${postyaml} COMPOSITIONIDPLACEHOLDER ${compositionFromId} + ${resp}= MakeYamlPostRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionFromId}/instances ${updatedpostyaml} ${auth} + ${respyaml}= yaml.Safe Load ${resp.text} + set Suite variable ${instanceMigrationId} ${respyaml["instanceId"]} + Should Be Equal As Strings ${resp.status_code} 201 + +FailDeployAutomationCompositionMigration + [Documentation] Fail Deploy automation composition. + SetParticipantSimFail + ${auth}= ClampAuth + ${postjson}= Get file ${CURDIR}/data/DeployAC.json + ${resp}= MakeJsonPutRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionFromId}/instances/${instanceMigrationId} ${postjson} ${auth} + Should Be Equal As Strings ${resp.status_code} 202 + Wait Until Keyword Succeeds 2 min 5 sec VerifyStateChangeResult ${compositionFromId} ${instanceMigrationId} FAILED + +TimeoutDeployAutomationCompositionMigration + [Documentation] Timeout Deploy automation composition. + SetParticipantSimTimeout + ${auth}= ClampAuth + ${postjson}= Get file ${CURDIR}/data/DeployAC.json + ${resp}= MakeJsonPutRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionFromId}/instances/${instanceMigrationId} ${postjson} ${auth} + Should Be Equal As Strings ${resp.status_code} 202 + +PrepareAutomationComposition + [Documentation] Prepare automation composition. + ${auth}= ClampAuth + ${postjson}= Get file ${CURDIR}/data/PrepareAC.json + ${resp}= MakeJsonPutRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionId}/instances/${instanceId} ${postjson} ${auth} + Should Be Equal As Strings ${resp.status_code} 202 + Wait Until Keyword Succeeds 10 min 5 sec VerifySubStatus ${compositionId} ${instanceId} DeployAutomationComposition - [Documentation] Deploy automation composition. - ${auth}= Create List runtimeUser zb!XztG34 - Log Creating session http://${POLICY_RUNTIME_ACM_IP} - ${postjson}= Get file ${CURDIR}/data/DeployAC.json - ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= PUT On Session policy /onap/policy/clamp/acm/v2/compositions/${compositionId}/instances/${instanceId} data=${postjson} headers=${headers} - Log Received response from runtime acm ${resp.text} - Should Be Equal As Strings ${resp.status_code} 202 - Wait Until Keyword Succeeds 10 min 5 sec VerifyDeployStatus ${compositionId} ${instanceId} DEPLOYED + [Documentation] Deploy automation composition. + ${auth}= ClampAuth + ${postjson}= Get file ${CURDIR}/data/DeployAC.json + ${resp}= MakeJsonPutRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionId}/instances/${instanceId} ${postjson} ${auth} + Should Be Equal As Strings ${resp.status_code} 202 + Wait Until Keyword Succeeds 10 min 5 sec VerifyDeployStatus ${compositionId} ${instanceId} DEPLOYED CheckTraces - [Documentation] Verify that traces are being recorded in jaeger - Log Verifying Jaeger traces - ${acmResp}= VerifyTracingWorks ${JAEGER_IP} acm-r - ${httpResp}= VerifyTracingWorks ${JAEGER_IP} http-ppnt - ${policyResp}= VerifyTracingWorks ${JAEGER_IP} policy-ppnt - ${k8sResp}= VerifyTracingWorks ${JAEGER_IP} k8s-ppnt - Should Not Be Empty ${acmResp.json()["data"][0]["spans"][0]["spanID"]} - Log Received spanID is ${acmResp.json()["data"][0]["spans"][0]["spanID"]} - Should Not Be Empty ${httpResp.json()["data"][0]["spans"][0]["spanID"]} - Should Not Be Empty ${policyResp.json()["data"][0]["spans"][0]["spanID"]} - Should Not Be Empty ${k8sResp.json()["data"][0]["spans"][0]["spanID"]} + [Documentation] Verify that traces are being recorded in jaeger + Log Verifying Jaeger traces + ${acmResp}= VerifyTracingWorks ${JAEGER_IP} acm-r + ${httpResp}= VerifyTracingWorks ${JAEGER_IP} http-ppnt + ${policyResp}= VerifyTracingWorks ${JAEGER_IP} policy-ppnt + ${k8sResp}= VerifyTracingWorks ${JAEGER_IP} k8s-ppnt + Should Not Be Empty ${acmResp.json()["data"][0]["spans"][0]["spanID"]} + Log Received spanID is ${acmResp.json()["data"][0]["spans"][0]["spanID"]} + Should Not Be Empty ${httpResp.json()["data"][0]["spans"][0]["spanID"]} + Should Not Be Empty ${policyResp.json()["data"][0]["spans"][0]["spanID"]} + Should Not Be Empty ${k8sResp.json()["data"][0]["spans"][0]["spanID"]} CheckKafkaPresentInTraces - [Documentation] Verify that kafka traces are being recorded in jaeger - Log Verifying Kafka Jaeger traces - ${acmResp}= VerifyKafkaInTraces ${JAEGER_IP} acm-r - ${httpResp}= VerifyKafkaInTraces ${JAEGER_IP} http-ppnt - ${policyResp}= VerifyKafkaInTraces ${JAEGER_IP} policy-ppnt - ${k8sResp}= VerifyKafkaInTraces ${JAEGER_IP} k8s-ppnt - Should Not Be Empty ${acmResp.json()["data"][0]["spans"][0]["spanID"]} - Log Received spanID is ${acmResp.json()["data"][0]["spans"][0]["spanID"]} - Should Not Be Empty ${httpResp.json()["data"][0]["spans"][0]["spanID"]} - Should Not Be Empty ${policyResp.json()["data"][0]["spans"][0]["spanID"]} - Should Not Be Empty ${k8sResp.json()["data"][0]["spans"][0]["spanID"]} + [Documentation] Verify that kafka traces are being recorded in jaeger + Log Verifying Kafka Jaeger traces + ${acmResp}= VerifyKafkaInTraces ${JAEGER_IP} acm-r + ${httpResp}= VerifyKafkaInTraces ${JAEGER_IP} http-ppnt + ${policyResp}= VerifyKafkaInTraces ${JAEGER_IP} policy-ppnt + ${k8sResp}= VerifyKafkaInTraces ${JAEGER_IP} k8s-ppnt + Should Not Be Empty ${acmResp.json()["data"][0]["spans"][0]["spanID"]} + Log Received spanID is ${acmResp.json()["data"][0]["spans"][0]["spanID"]} + Should Not Be Empty ${httpResp.json()["data"][0]["spans"][0]["spanID"]} + Should Not Be Empty ${policyResp.json()["data"][0]["spans"][0]["spanID"]} + Should Not Be Empty ${k8sResp.json()["data"][0]["spans"][0]["spanID"]} CheckHttpPresentInAcmTraces - [Documentation] Verify that http traces are being recorded in jaeger - Log Verifying Http Jaeger traces - ${acmResp}= VerifyHttpInTraces ${JAEGER_IP} acm-r - Should Not Be Empty ${acmResp.json()["data"][0]["spans"][0]["spanID"]} - Log Received spanID is ${acmResp.json()["data"][0]["spans"][0]["spanID"]} + [Documentation] Verify that http traces are being recorded in jaeger + Log Verifying Http Jaeger traces + ${acmResp}= VerifyHttpInTraces ${JAEGER_IP} acm-r + Should Not Be Empty ${acmResp.json()["data"][0]["spans"][0]["spanID"]} + Log Received spanID is ${acmResp.json()["data"][0]["spans"][0]["spanID"]} QueryPolicies - [Documentation] Verify the new policies deployed - ${auth}= Create List policyadmin zb!XztG34 - Sleep 10s - Log Creating session http://${POLICY_PAP_IP} - ${session}= Create Session policy http://${POLICY_PAP_IP} auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= GET On Session policy /policy/pap/v1/policies/deployed headers=${headers} - Log Received response from policy-pap {resp.text} - Should Be Equal As Strings ${resp.status_code} 200 - Dictionary Should Contain Value ${resp.json()[0]} onap.policies.native.apex.ac.element + [Documentation] Verify the new policies deployed + ${auth}= PolicyAdminAuth + Sleep 10s + Log Creating session http://${POLICY_PAP_IP} + ${session}= Create Session policy http://${POLICY_PAP_IP} auth=${auth} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= GET On Session policy /policy/pap/v1/policies/deployed headers=${headers} + Log Received response from policy-pap {resp.text} + Should Be Equal As Strings ${resp.status_code} 200 + Dictionary Should Contain Value ${resp.json()[0]} onap.policies.native.apex.ac.element QueryPolicyTypes - [Documentation] Verify the new policy types created - ${auth}= Create List policyadmin zb!XztG34 - Sleep 10s - Log Creating session http://${POLICY_API_IP}:6969 - ${session}= Create Session policy http://${POLICY_API_IP} auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= GET On Session policy /policy/api/v1/policytypes headers=${headers} - Log Received response from policy-api ${resp.text} - Should Be Equal As Strings ${resp.status_code} 200 - List Should Contain Value ${resp.json()['policy_types']} onap.policies.native.Apex + [Documentation] Verify the new policy types created + ${auth}= PolicyAdminAuth + Sleep 10s + Log Creating session http://${POLICY_API_IP}:6969 + ${session}= Create Session policy http://${POLICY_API_IP} auth=${auth} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= GET On Session policy /policy/api/v1/policytypes headers=${headers} + Log Received response from policy-api ${resp.text} + Should Be Equal As Strings ${resp.status_code} 200 + List Should Contain Value ${resp.json()['policy_types']} onap.policies.native.Apex + +ReviewAutomationComposition + [Documentation] Review automation composition. + ${auth}= ClampAuth + ${postjson}= Get file ${CURDIR}/data/ReviewAC.json + ${resp}= MakeJsonPutRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionId}/instances/${instanceId} ${postjson} ${auth} + Should Be Equal As Strings ${resp.status_code} 202 + Wait Until Keyword Succeeds 10 min 5 sec VerifySubStatus ${compositionId} ${instanceId} + +CheckTimeoutAutomationComposition + [Documentation] Timeout Deploy automation composition. + Wait Until Keyword Succeeds 5 min 5 sec VerifyStateChangeResult ${compositionFromId} ${instanceMigrationId} TIMEOUT DeployAutomationCompositionMigration - [Documentation] Deploy automation composition. - ${auth}= Create List runtimeUser zb!XztG34 - Log Creating session http://${POLICY_RUNTIME_ACM_IP} - ${postjson}= Get file ${CURDIR}/data/DeployAC.json - ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= PUT On Session policy /onap/policy/clamp/acm/v2/compositions/${compositionFromId}/instances/${instanceMigrationId} data=${postjson} headers=${headers} - Log Received response from runtime acm ${resp.text} - Should Be Equal As Strings ${resp.status_code} 202 - Wait Until Keyword Succeeds 10 min 5 sec VerifyDeployStatus ${compositionFromId} ${instanceMigrationId} DEPLOYED + [Documentation] Deploy automation composition. + SetParticipantSimSuccess + ${auth}= ClampAuth + ${postjson}= Get file ${CURDIR}/data/DeployAC.json + ${resp}= MakeJsonPutRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionFromId}/instances/${instanceMigrationId} ${postjson} ${auth} + Should Be Equal As Strings ${resp.status_code} 202 + Wait Until Keyword Succeeds 2 min 5 sec VerifyDeployStatus ${compositionFromId} ${instanceMigrationId} DEPLOYED SendOutPropertiesToRuntime - [Documentation] Send Out Properties To Runtime - ${auth}= Create List participantUser zb!XztG34 - Log Creating session http://${POLICY_PARTICIPANT_SIM_IP} - ${postjson}= Get file ${CURDIR}/data/OutProperties.json - ${updatedpostjson}= Replace String ${postjson} INSTACEIDPLACEHOLDER ${instanceMigrationId} - ${updatedpostjson}= Replace String ${updatedpostjson} TEXTPLACEHOLDER MyTextToSend - ${session}= Create Session policy http://${POLICY_PARTICIPANT_SIM_IP} auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= PUT On Session policy /onap/policy/simparticipant/v2/datas data=${updatedpostjson} headers=${headers} - Log Received response from participant sim ${resp.text} - Should Be Equal As Strings ${resp.status_code} 200 - Wait Until Keyword Succeeds 2 min 5 sec VerifyPropertiesUpdated ${compositionFromId} ${instanceMigrationId} MyTextToSend + [Documentation] Send Out Properties To Runtime + ${auth}= ParticipantAuth + ${postjson}= Get file ${CURDIR}/data/OutProperties.json + ${updatedpostjson}= Replace String ${postjson} INSTACEIDPLACEHOLDER ${instanceMigrationId} + ${updatedpostjson}= Replace String ${updatedpostjson} TEXTPLACEHOLDER MyTextToSend + ${resp}= MakeJsonPutRequest participant ${POLICY_PARTICIPANT_SIM_IP} /onap/policy/simparticipant/v2/datas ${updatedpostjson} ${auth} + Should Be Equal As Strings ${resp.status_code} 200 + Wait Until Keyword Succeeds 2 min 5 sec VerifyPropertiesUpdated ${compositionFromId} ${instanceMigrationId} MyTextToSend AutomationCompositionUpdate - [Documentation] Update of an automation composition. - ${auth}= Create List runtimeUser zb!XztG34 - Log Creating session http://${POLICY_RUNTIME_ACM_IP} - ${postyaml}= Get file ${CURDIR}/data/ac-instance-update.yaml - ${updatedpostyaml}= Replace String ${postyaml} COMPOSITIONIDPLACEHOLDER ${compositionFromId} - ${updatedpostyaml}= Replace String ${updatedpostyaml} INSTACEIDPLACEHOLDER ${instanceMigrationId} - ${updatedpostyaml}= Replace String ${updatedpostyaml} TEXTPLACEHOLDER MyTextUpdated - ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} - ${headers}= Create Dictionary Accept=application/yaml Content-Type=application/yaml - ${resp}= POST On Session policy /onap/policy/clamp/acm/v2/compositions/${compositionFromId}/instances data=${updatedpostyaml} headers=${headers} - Log Received response from runtime acm ${resp.text} - Should Be Equal As Strings ${resp.status_code} 200 - Wait Until Keyword Succeeds 2 min 5 sec VerifyDeployStatus ${compositionFromId} ${instanceMigrationId} DEPLOYED - VerifyPropertiesUpdated ${compositionFromId} ${instanceMigrationId} MyTextUpdated - VerifyParticipantSim ${instanceMigrationId} MyTextUpdated + [Documentation] Update of an automation composition. + ${auth}= ClampAuth + ${postyaml}= Get file ${CURDIR}/data/ac-instance-update.yaml + ${updatedpostyaml}= Replace String ${postyaml} COMPOSITIONIDPLACEHOLDER ${compositionFromId} + ${updatedpostyaml}= Replace String ${updatedpostyaml} INSTACEIDPLACEHOLDER ${instanceMigrationId} + ${updatedpostyaml}= Replace String ${updatedpostyaml} TEXTPLACEHOLDER MyTextUpdated + ${resp}= MakeYamlPostRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionFromId}/instances ${updatedpostyaml} ${auth} + Should Be Equal As Strings ${resp.status_code} 200 + Wait Until Keyword Succeeds 2 min 5 sec VerifyDeployStatus ${compositionFromId} ${instanceMigrationId} DEPLOYED + VerifyPropertiesUpdated ${compositionFromId} ${instanceMigrationId} MyTextUpdated + VerifyParticipantSim ${instanceMigrationId} MyTextUpdated + +PrecheckAutomationCompositionMigration + [Documentation] Precheck Migration of an automation composition. + ${auth}= ClampAuth + ${postyaml}= Get file ${CURDIR}/data/ac-instance-precheck-migration.yaml + ${updatedpostyaml}= Replace String ${postyaml} COMPOSITIONIDPLACEHOLDER ${compositionFromId} + ${updatedpostyaml}= Replace String ${updatedpostyaml} COMPOSITIONTARGETIDPLACEHOLDER ${compositionToId} + ${updatedpostyaml}= Replace String ${updatedpostyaml} INSTACEIDPLACEHOLDER ${instanceMigrationId} + ${updatedpostyaml}= Replace String ${updatedpostyaml} TEXTPLACEHOLDER TextForMigration + ${resp}= MakeYamlPostRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionFromId}/instances ${updatedpostyaml} ${auth} + Should Be Equal As Strings ${resp.status_code} 200 + Wait Until Keyword Succeeds 2 min 5 sec VerifySubStatus ${compositionFromId} ${instanceMigrationId} AutomationCompositionMigrationTo - [Documentation] Migration of an automation composition. - ${auth}= Create List runtimeUser zb!XztG34 - Log Creating session http://${POLICY_RUNTIME_ACM_IP} - ${postyaml}= Get file ${CURDIR}/data/ac-instance-migration-to.yaml - ${updatedpostyaml}= Replace String ${postyaml} COMPOSITIONIDPLACEHOLDER ${compositionFromId} - ${updatedpostyaml}= Replace String ${updatedpostyaml} COMPOSITIONTARGETIDPLACEHOLDER ${compositionToId} - ${updatedpostyaml}= Replace String ${updatedpostyaml} INSTACEIDPLACEHOLDER ${instanceMigrationId} - ${updatedpostyaml}= Replace String ${updatedpostyaml} TEXTPLACEHOLDER TextForMigration - ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} - ${headers}= Create Dictionary Accept=application/yaml Content-Type=application/yaml - ${resp}= POST On Session policy /onap/policy/clamp/acm/v2/compositions/${compositionFromId}/instances data=${updatedpostyaml} headers=${headers} - Log Received response from runtime acm ${resp.text} - Should Be Equal As Strings ${resp.status_code} 200 - Wait Until Keyword Succeeds 10 min 5 sec VerifyDeployStatus ${compositionToId} ${instanceMigrationId} DEPLOYED - VerifyPropertiesUpdated ${compositionToId} ${instanceMigrationId} TextForMigration - VerifyParticipantSim ${instanceMigrationId} TextForMigration + [Documentation] Migration of an automation composition. + ${auth}= ClampAuth + ${postyaml}= Get file ${CURDIR}/data/ac-instance-migration-to.yaml + ${updatedpostyaml}= Replace String ${postyaml} COMPOSITIONIDPLACEHOLDER ${compositionFromId} + ${updatedpostyaml}= Replace String ${updatedpostyaml} COMPOSITIONTARGETIDPLACEHOLDER ${compositionToId} + ${updatedpostyaml}= Replace String ${updatedpostyaml} INSTACEIDPLACEHOLDER ${instanceMigrationId} + ${updatedpostyaml}= Replace String ${updatedpostyaml} TEXTPLACEHOLDER TextForMigration + ${resp}= MakeYamlPostRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionFromId}/instances ${updatedpostyaml} ${auth} + Should Be Equal As Strings ${resp.status_code} 200 + Wait Until Keyword Succeeds 2 min 5 sec VerifyDeployStatus ${compositionToId} ${instanceMigrationId} DEPLOYED + VerifyPropertiesUpdated ${compositionToId} ${instanceMigrationId} TextForMigration + VerifyParticipantSim ${instanceMigrationId} TextForMigration + VerifyMigratedElementsRuntime ${compositionToId} ${instanceMigrationId} + VerifyMigratedElementsSim ${instanceMigrationId} UnDeployAutomationComposition - [Documentation] UnDeploy automation composition. - ${auth}= Create List runtimeUser zb!XztG34 - Log Creating session http://${POLICY_RUNTIME_ACM_IP} - ${postjson}= Get file ${CURDIR}/data/UndeployAC.json - ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= PUT On Session policy /onap/policy/clamp/acm/v2/compositions/${compositionId}/instances/${instanceId} data=${postjson} headers=${headers} - Log Received response from runtime acm ${resp.text} - Should Be Equal As Strings ${resp.status_code} 202 - Wait Until Keyword Succeeds 10 min 5 sec VerifyDeployStatus ${compositionId} ${instanceId} UNDEPLOYED + [Documentation] UnDeploy automation composition. + ${auth}= ClampAuth + ${postjson}= Get file ${CURDIR}/data/UndeployAC.json + ${resp}= MakeJsonPutRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionId}/instances/${instanceId} ${postjson} ${auth} + Should Be Equal As Strings ${resp.status_code} 202 + Wait Until Keyword Succeeds 10 min 5 sec VerifyDeployStatus ${compositionId} ${instanceId} UNDEPLOYED + +FailUnDeployAutomationCompositionMigrationTo + [Documentation] Fail UnDeploy automation composition migrated. + SetParticipantSimFail + ${auth}= ClampAuth + ${postjson}= Get file ${CURDIR}/data/UndeployAC.json + ${resp}= MakeJsonPutRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionToId}/instances/${instanceMigrationId} ${postjson} ${auth} + Should Be Equal As Strings ${resp.status_code} 202 + Wait Until Keyword Succeeds 2 min 5 sec VerifyStateChangeResult ${compositionToId} ${instanceMigrationId} FAILED UnDeployAutomationCompositionMigrationTo - [Documentation] UnDeploy automation composition migrated. - ${auth}= Create List runtimeUser zb!XztG34 - Log Creating session http://${POLICY_RUNTIME_ACM_IP} - ${postjson}= Get file ${CURDIR}/data/UndeployAC.json - ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= PUT On Session policy /onap/policy/clamp/acm/v2/compositions/${compositionToId}/instances/${instanceMigrationId} data=${postjson} headers=${headers} - Log Received response from runtime acm ${resp.text} - Should Be Equal As Strings ${resp.status_code} 202 - Wait Until Keyword Succeeds 10 min 5 sec VerifyDeployStatus ${compositionToId} ${instanceMigrationId} UNDEPLOYED + [Documentation] UnDeploy automation composition migrated. + SetParticipantSimSuccess + ${auth}= ClampAuth + ${postjson}= Get file ${CURDIR}/data/UndeployAC.json + ${resp}= MakeJsonPutRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionToId}/instances/${instanceMigrationId} ${postjson} ${auth} + Should Be Equal As Strings ${resp.status_code} 202 + Wait Until Keyword Succeeds 2 min 5 sec VerifyDeployStatus ${compositionToId} ${instanceMigrationId} UNDEPLOYED UnInstantiateAutomationComposition - [Documentation] Delete automation composition instance. - ${auth}= Create List runtimeUser zb!XztG34 - Log Creating session http://${POLICY_RUNTIME_ACM_IP} - ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= DELETE On Session policy /onap/policy/clamp/acm/v2/compositions/${compositionId}/instances/${instanceId} headers=${headers} - Log Received response from runtime acm ${resp.text} - Should Be Equal As Strings ${resp.status_code} 202 - Wait Until Keyword Succeeds 1 min 5 sec VerifyUninstantiated ${compositionId} + [Documentation] Delete automation composition instance. + ${auth}= ClampAuth + Log Creating session http://${POLICY_RUNTIME_ACM_IP} + ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= DELETE On Session policy /onap/policy/clamp/acm/v2/compositions/${compositionId}/instances/${instanceId} headers=${headers} + Log Received response from runtime acm ${resp.text} + Should Be Equal As Strings ${resp.status_code} 202 + Wait Until Keyword Succeeds 1 min 5 sec VerifyUninstantiated ${compositionId} + +FailUnInstantiateAutomationCompositionMigrationTo + [Documentation] Fail Delete automation composition instance migrated. + SetParticipantSimFail + ${auth}= ClampAuth + Log Creating session http://${POLICY_RUNTIME_ACM_IP} + ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= DELETE On Session policy /onap/policy/clamp/acm/v2/compositions/${compositionToId}/instances/${instanceMigrationId} headers=${headers} + Log Received response from runtime acm ${resp.text} + Should Be Equal As Strings ${resp.status_code} 202 + Wait Until Keyword Succeeds 2 min 5 sec VerifyStateChangeResult ${compositionToId} ${instanceMigrationId} FAILED UnInstantiateAutomationCompositionMigrationTo - [Documentation] Delete automation composition instance migrated. - ${auth}= Create List runtimeUser zb!XztG34 - Log Creating session http://${POLICY_RUNTIME_ACM_IP} - ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= DELETE On Session policy /onap/policy/clamp/acm/v2/compositions/${compositionToId}/instances/${instanceMigrationId} headers=${headers} - Log Received response from runtime acm ${resp.text} - Should Be Equal As Strings ${resp.status_code} 202 - Wait Until Keyword Succeeds 1 min 5 sec VerifyUninstantiated ${compositionToId} + [Documentation] Delete automation composition instance migrated. + SetParticipantSimSuccess + ${auth}= ClampAuth + Log Creating session http://${POLICY_RUNTIME_ACM_IP} + ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= DELETE On Session policy /onap/policy/clamp/acm/v2/compositions/${compositionToId}/instances/${instanceMigrationId} headers=${headers} + Log Received response from runtime acm ${resp.text} + Should Be Equal As Strings ${resp.status_code} 202 + Wait Until Keyword Succeeds 1 min 5 sec VerifyUninstantiated ${compositionToId} DePrimeACDefinitions - [Documentation] DePrime automation composition definition - ${auth}= Create List runtimeUser zb!XztG34 - Log Creating session http://${POLICY_RUNTIME_ACM_IP} - ${postjson}= Get file ${CURDIR}/data/ACDepriming.json - ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= PUT On Session policy /onap/policy/clamp/acm/v2/compositions/${compositionId} data=${postjson} headers=${headers} - Should Be Equal As Strings ${resp.status_code} 202 - Wait Until Keyword Succeeds 2 min 5 sec VerifyPriming ${compositionId} COMMISSIONED + [Documentation] DePrime automation composition definition + ${auth}= ClampAuth + ${postjson}= Get file ${CURDIR}/data/ACDepriming.json + ${resp}= MakeJsonPutRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionId} ${postjson} ${auth} + Should Be Equal As Strings ${resp.status_code} 202 + Wait Until Keyword Succeeds 2 min 5 sec VerifyPriming ${compositionId} COMMISSIONED + +FailDePrimeACDefinitionsFrom + [Documentation] Fail DePrime automation composition definition migration From. + SetParticipantSimFail + ${auth}= ClampAuth + ${postjson}= Get file ${CURDIR}/data/ACDepriming.json + ${resp}= MakeJsonPutRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionFromId} ${postjson} ${auth} + Should Be Equal As Strings ${resp.status_code} 202 + Wait Until Keyword Succeeds 2 min 5 sec VerifyFailedPriming ${compositionFromId} DePrimeACDefinitionsFrom - [Documentation] DePrime automation composition definition migration From. - ${auth}= Create List runtimeUser zb!XztG34 - Log Creating session http://${POLICY_RUNTIME_ACM_IP} - ${postjson}= Get file ${CURDIR}/data/ACDepriming.json - ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= PUT On Session policy /onap/policy/clamp/acm/v2/compositions/${compositionFromId} data=${postjson} headers=${headers} - Should Be Equal As Strings ${resp.status_code} 202 - Wait Until Keyword Succeeds 2 min 5 sec VerifyPriming ${compositionFromId} COMMISSIONED + [Documentation] DePrime automation composition definition migration From. + SetParticipantSimSuccess + ${auth}= ClampAuth + ${postjson}= Get file ${CURDIR}/data/ACDepriming.json + ${resp}= MakeJsonPutRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionFromId} ${postjson} ${auth} + Should Be Equal As Strings ${resp.status_code} 202 + Wait Until Keyword Succeeds 2 min 5 sec VerifyPriming ${compositionFromId} COMMISSIONED DePrimeACDefinitionsTo - [Documentation] DePrime automation composition definition migration To. - ${auth}= Create List runtimeUser zb!XztG34 - Log Creating session http://${POLICY_RUNTIME_ACM_IP} - ${postjson}= Get file ${CURDIR}/data/ACDepriming.json - ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= PUT On Session policy /onap/policy/clamp/acm/v2/compositions/${compositionToId} data=${postjson} headers=${headers} - Should Be Equal As Strings ${resp.status_code} 202 - Wait Until Keyword Succeeds 2 min 5 sec VerifyPriming ${compositionToId} COMMISSIONED + [Documentation] DePrime automation composition definition migration To. + ${auth}= ClampAuth + ${postjson}= Get file ${CURDIR}/data/ACDepriming.json + ${resp}= MakeJsonPutRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionToId} ${postjson} ${auth} + Should Be Equal As Strings ${resp.status_code} 202 + Wait Until Keyword Succeeds 2 min 5 sec VerifyPriming ${compositionToId} COMMISSIONED DeleteACDefinition - [Documentation] Delete automation composition definition. - ${auth}= Create List runtimeUser zb!XztG34 - Log Creating session http://${POLICY_RUNTIME_ACM_IP} - ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} - ${headers}= Create Dictionary Accept=application/yaml Content-Type=application/yaml - ${resp}= DELETE On Session policy /onap/policy/clamp/acm/v2/compositions/${compositionId} headers=${headers} - Log Received response from runtime acm ${resp.text} - Should Be Equal As Strings ${resp.status_code} 200 + [Documentation] Delete automation composition definition. + ${auth}= ClampAuth + Log Creating session http://${POLICY_RUNTIME_ACM_IP} + ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} + ${headers}= Create Dictionary Accept=application/yaml Content-Type=application/yaml + ${resp}= DELETE On Session policy /onap/policy/clamp/acm/v2/compositions/${compositionId} headers=${headers} + Log Received response from runtime acm ${resp.text} + Should Be Equal As Strings ${resp.status_code} 200 DeleteACDefinitionFrom - [Documentation] Delete automation composition definition migration From. - ${auth}= Create List runtimeUser zb!XztG34 - Log Creating session http://${POLICY_RUNTIME_ACM_IP} - ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} - ${headers}= Create Dictionary Accept=application/yaml Content-Type=application/yaml - ${resp}= DELETE On Session policy /onap/policy/clamp/acm/v2/compositions/${compositionFromId} headers=${headers} - Log Received response from runtime acm ${resp.text} - Should Be Equal As Strings ${resp.status_code} 200 + [Documentation] Delete automation composition definition migration From. + ${auth}= ClampAuth + Log Creating session http://${POLICY_RUNTIME_ACM_IP} + ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} + ${headers}= Create Dictionary Accept=application/yaml Content-Type=application/yaml + ${resp}= DELETE On Session policy /onap/policy/clamp/acm/v2/compositions/${compositionFromId} headers=${headers} + Log Received response from runtime acm ${resp.text} + Should Be Equal As Strings ${resp.status_code} 200 DeleteACDefinitionTo - [Documentation] Delete automation composition definition migration To. - ${auth}= Create List runtimeUser zb!XztG34 - Log Creating session http://${POLICY_RUNTIME_ACM_IP} - ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} - ${headers}= Create Dictionary Accept=application/yaml Content-Type=application/yaml - ${resp}= DELETE On Session policy /onap/policy/clamp/acm/v2/compositions/${compositionToId} headers=${headers} - Log Received response from runtime acm ${resp.text} - Should Be Equal As Strings ${resp.status_code} 200 + [Documentation] Delete automation composition definition migration To. + ${auth}= ClampAuth + Log Creating session http://${POLICY_RUNTIME_ACM_IP} + ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} + ${headers}= Create Dictionary Accept=application/yaml Content-Type=application/yaml + ${resp}= DELETE On Session policy /onap/policy/clamp/acm/v2/compositions/${compositionToId} headers=${headers} + Log Received response from runtime acm ${resp.text} + Should Be Equal As Strings ${resp.status_code} 200 *** Keywords *** VerifyHealthcheckApi - [Documentation] Verify Healthcheck on policy-api - ${auth}= Create List policyadmin zb!XztG34 - Log Creating session http://${POLICY_API_IP} - ${session}= Create Session policy http://${POLICY_API_IP} auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= GET On Session policy /policy/api/v1/health headers=${headers} - Log Received response from policy-api healthcheck ${resp.text} - Should Be Equal As Strings ${resp.status_code} 200 + [Documentation] Verify Healthcheck on policy-api + ${auth}= PolicyAdminAuth + ${resp}= MakeGetRequest policy ${POLICY_API_IP} /policy/api/v1/health ${auth} + Should Be Equal As Strings ${resp.status_code} 200 VerifyHealthcheckPap - [Documentation] Verify Healthcheck on policy-pap - ${auth}= Create List policyadmin zb!XztG34 - Log Creating session http://${POLICY_PAP_IP} - ${session}= Create Session policy http://${POLICY_PAP_IP} auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= GET On Session policy /policy/pap/v1/health headers=${headers} - Log Received response from policy-pap healthcheck ${resp.text} - Should Be Equal As Strings ${resp.status_code} 200 + [Documentation] Verify Healthcheck on policy-pap + ${auth}= PolicyAdminAuth + ${resp}= MakeGetRequest policy ${POLICY_PAP_IP} /policy/pap/v1/health ${auth} + Should Be Equal As Strings ${resp.status_code} 200 VerifyPriming [Arguments] ${theCompositionId} ${primestate} [Documentation] Verify the AC definitions are primed to the participants - ${auth}= Create List runtimeUser zb!XztG34 - Log Creating session http://${POLICY_RUNTIME_ACM_IP} - ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= GET On Session policy /onap/policy/clamp/acm/v2/compositions/${theCompositionId} headers=${headers} + ${auth}= ClampAuth + ${resp}= MakeGetRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${theCompositionId} ${auth} Should Be Equal As Strings ${resp.status_code} 200 + Should Be Equal As Strings ${resp.json()['stateChangeResult']} NO_ERROR Run Keyword If ${resp.status_code}==200 Should Be Equal As Strings ${resp.json()['state']} ${primestate} +VerifyFailedPriming + [Arguments] ${theCompositionId} + [Documentation] Verify the AC definitions are primed to the participants + ${auth}= ClampAuth + ${resp}= MakeGetRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${theCompositionId} ${auth} + Should Be Equal As Strings ${resp.status_code} 200 + Run Keyword If ${resp.status_code}==200 Should Be Equal As Strings ${resp.json()['stateChangeResult']} FAILED + VerifyDeployStatus - [Arguments] ${theCompositionId} ${theInstanceId} ${deploystate} - [Documentation] Verify the Deploy status of automation composition. - ${auth}= Create List runtimeUser zb!XztG34 - Log Creating session http://${POLICY_RUNTIME_ACM_IP} - ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= GET On Session policy /onap/policy/clamp/acm/v2/compositions/${theCompositionId}/instances/${theInstanceId} headers=${headers} - Should Be Equal As Strings ${resp.status_code} 200 - Run Keyword If ${resp.status_code}==200 Should Be Equal As Strings ${resp.json()['deployState']} ${deploystate} + [Arguments] ${theCompositionId} ${theInstanceId} ${deploystate} + [Documentation] Verify the Deploy status of automation composition. + ${auth}= ClampAuth + ${resp}= MakeGetRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${theCompositionId}/instances/${theInstanceId} ${auth} + Should Be Equal As Strings ${resp.status_code} 200 + Should Be Equal As Strings ${resp.json()['stateChangeResult']} NO_ERROR + Run Keyword If ${resp.status_code}==200 Should Be Equal As Strings ${resp.json()['deployState']} ${deploystate} + +VerifySubStatus + [Arguments] ${theCompositionId} ${theInstanceId} + [Documentation] Verify the Sub status of automation composition. + ${auth}= ClampAuth + ${resp}= MakeGetRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${theCompositionId}/instances/${theInstanceId} ${auth} + Should Be Equal As Strings ${resp.status_code} 200 + Should Be Equal As Strings ${resp.json()['stateChangeResult']} NO_ERROR + Run Keyword If ${resp.status_code}==200 Should Be Equal As Strings ${resp.json()['subState']} NONE + +VerifyStateChangeResult + [Arguments] ${theCompositionId} ${theInstanceId} ${stateChangeResult} + [Documentation] Verify the Deploy status of automation composition. + ${auth}= ClampAuth + ${resp}= MakeGetRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${theCompositionId}/instances/${theInstanceId} ${auth} + Should Be Equal As Strings ${resp.status_code} 200 + Run Keyword If ${resp.status_code}==200 Should Be Equal As Strings ${resp.json()['stateChangeResult']} ${stateChangeResult} VerifyPropertiesUpdated - [Arguments] ${theCompositionId} ${theInstanceId} ${textToFind} - [Documentation] Verify the Deploy status of automation composition. - ${auth}= Create List runtimeUser zb!XztG34 - Log Creating session http://${POLICY_RUNTIME_ACM_IP} - ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= GET On Session policy /onap/policy/clamp/acm/v2/compositions/${theCompositionId}/instances/${theInstanceId} headers=${headers} - Should Be Equal As Strings ${resp.status_code} 200 - ${respstring} Convert To String ${resp.json()} - Run Keyword If ${resp.status_code}==200 Should Match Regexp ${respstring} ${textToFind} + [Arguments] ${theCompositionId} ${theInstanceId} ${textToFind} + [Documentation] Verify the Deploy status of automation composition. + ${auth}= ClampAuth + ${resp}= MakeGetRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${theCompositionId}/instances/${theInstanceId} ${auth} + Should Be Equal As Strings ${resp.status_code} 200 + ${respstring} Convert To String ${resp.json()} + Run Keyword If ${resp.status_code}==200 Should Match Regexp ${respstring} ${textToFind} + +VerifyMigratedElementsRuntime + [Arguments] ${theCompositionId} ${theInstanceId} + [Documentation] Verify the Instance elements after Migration + ${auth}= ClampAuth + ${resp}= MakeGetRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${theCompositionId}/instances/${theInstanceId} ${auth} + Should Be Equal As Strings ${resp.status_code} 200 + ${respstring} Convert To String ${resp.json()} + Should Match Regexp ${respstring} Sim_NewAutomationCompositionElement + Should Not Match Regexp ${respstring} Sim_SinkAutomationCompositionElement + ${respstring} Convert To String ${resp.json()['elements']['709c62b3-8918-41b9-a747-d21eb79c6c34']['outProperties']['stage']} + Should Be Equal As Strings ${respstring} [1, 2] + ${respstring} Convert To String ${resp.json()['elements']['709c62b3-8918-41b9-a747-d21eb79c6c35']['outProperties']['stage']} + Should Be Equal As Strings ${respstring} [0, 1] + ${respstring} Convert To String ${resp.json()['elements']['709c62b3-8918-41b9-a747-d21eb79c6c37']['outProperties']['stage']} + Should Be Equal As Strings ${respstring} [0, 2] + +VerifyMigratedElementsSim + [Arguments] ${theInstanceId} + [Documentation] Query on Participant Simulator + ${auth}= ParticipantAuth + ${resp}= MakeGetRequest participant ${POLICY_PARTICIPANT_SIM_IP} /onap/policy/simparticipant/v2/instances/${theInstanceId} ${auth} + Should Be Equal As Strings ${resp.status_code} 200 + ${respstring} Convert To String ${resp.json()} + Should Match Regexp ${respstring} Sim_NewAutomationCompositionElement + Should Not Match Regexp ${respstring} Sim_SinkAutomationCompositionElement VerifyParticipantSim - [Arguments] ${theInstanceId} ${textToFind} - [Documentation] Query on Participant Simulator - ${auth}= Create List participantUser zb!XztG34 - Log Creating session http://${POLICY_PARTICIPANT_SIM_IP} - ${session}= Create Session ACM http://${POLICY_PARTICIPANT_SIM_IP} auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= GET On Session ACM /onap/policy/simparticipant/v2/instances/${theInstanceId} headers=${headers} - Log Received response from participant {resp.text} - Should Be Equal As Strings ${resp.status_code} 200 - ${respstring} Convert To String ${resp.json()} - Should Match Regexp ${respstring} ${textToFind} + [Arguments] ${theInstanceId} ${textToFind} + [Documentation] Query on Participant Simulator + ${auth}= ParticipantAuth + ${resp}= MakeGetRequest participant ${POLICY_PARTICIPANT_SIM_IP} /onap/policy/simparticipant/v2/instances/${theInstanceId} ${auth} + Should Be Equal As Strings ${resp.status_code} 200 + ${respstring} Convert To String ${resp.json()} + Should Match Regexp ${respstring} ${textToFind} VerifyUninstantiated - [Arguments] ${theCompositionId} - [Documentation] Verify the Uninstantiation of automation composition. - ${auth}= Create List runtimeUser zb!XztG34 - Log Creating session http://${POLICY_RUNTIME_ACM_IP} - ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= GET On Session policy /onap/policy/clamp/acm/v2/compositions/${theCompositionId}/instances headers=${headers} - Should Be Equal As Strings ${resp.status_code} 200 - Run Keyword If ${resp.status_code}==200 Length Should Be ${resp.json()['automationCompositionList']} 0 - - + [Arguments] ${theCompositionId} + [Documentation] Verify the Uninstantiation of automation composition. + ${auth}= ClampAuth + ${resp}= MakeGetRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${theCompositionId}/instances ${auth} + Should Be Equal As Strings ${resp.status_code} 200 + Run Keyword If ${resp.status_code}==200 Length Should Be ${resp.json()['automationCompositionList']} 0 + +SetParticipantSimFail + [Documentation] Set Participant Simulator Fail. + ${auth}= ParticipantAuth + ${postjson}= Get file ${CURDIR}/data/SettingSimPropertiesFail.json + ${resp}= MakeJsonPutRequest participant ${POLICY_PARTICIPANT_SIM_IP} /onap/policy/simparticipant/v2/parameters ${postjson} ${auth} + Should Be Equal As Strings ${resp.status_code} 200 + +SetParticipantSimSuccess + [Documentation] Set Participant Simulator Success. + ${auth}= ParticipantAuth + ${postjson}= Get file ${CURDIR}/data/SettingSimPropertiesSuccess.json + ${resp}= MakeJsonPutRequest participant ${POLICY_PARTICIPANT_SIM_IP} /onap/policy/simparticipant/v2/parameters ${postjson} ${auth} + Should Be Equal As Strings ${resp.status_code} 200 + +SetParticipantSimTimeout + [Documentation] Set Participant Simulator Timeout. + ${auth}= ParticipantAuth + ${postjson}= Get file ${CURDIR}/data/SettingSimPropertiesTimeout.json + ${resp}= MakeJsonPutRequest participant ${POLICY_PARTICIPANT_SIM_IP} /onap/policy/simparticipant/v2/parameters ${postjson} ${auth} + Should Be Equal As Strings ${resp.status_code} 200 + +ClampAuth + ${auth}= Create List runtimeUser zb!XztG34 + RETURN ${auth} + +ParticipantAuth + ${auth}= Create List participantUser zb!XztG34 + RETURN ${auth} + +MakeYamlPostRequest + [Arguments] ${name} ${domain} ${url} ${postyaml} ${auth} + Log Creating session http://${domain} + ${session}= Create Session ${name} http://${domain} auth=${auth} + ${headers} Create Dictionary Accept=application/yaml Content-Type=application/yaml + ${resp}= POST On Session ${name} ${url} data=${postyaml} headers=${headers} + Log Received response from ${name} ${resp.text} + RETURN ${resp} + +MakeJsonPostRequest + [Arguments] ${name} ${domain} ${url} ${postjson} ${auth} + Log Creating session http://${domain} + ${session}= Create Session ${name} http://${domain} auth=${auth} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= POST On Session ${name} ${url} data=${postjson} headers=${headers} + Log Received response from ${name} ${resp.text} + RETURN ${resp} + +MakeJsonPutRequest + [Arguments] ${name} ${domain} ${url} ${postjson} ${auth} + Log Creating session http://${domain} + ${session}= Create Session ${name} http://${domain} auth=${auth} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= PUT On Session ${name} ${url} data=${postjson} headers=${headers} + Log Received response from ${name} ${resp.text} + RETURN ${resp} + +MakeGetRequest + [Arguments] ${name} ${domain} ${url} ${auth} + Log Creating session http://${domain} + ${session}= Create Session ${name} http://${domain} auth=${auth} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= GET On Session ${name} ${url} headers=${headers} + Log Received response from ${name} {resp.text} + RETURN ${resp} + +VerifyKafkaInTraces + [Arguments] ${domain} ${service} + Log Creating session http://${domain} + ${session}= Create Session jaeger http://${domain} + ${tags}= Create Dictionary otel.library.name=io.opentelemetry.kafka-clients-2.6 messaging.system=kafka + ${tags_json}= evaluate json.dumps(${tags}) json + ${params}= Create Dictionary service=${service} tags=${tags_json} operation=policy-acruntime-participant publish lookback=1h limit=10 + ${resp}= GET On Session jaeger /api/traces params=${params} expected_status=200 + Log Received response from jaeger ${resp.text} + RETURN ${resp} + +VerifyHttpInTraces + [Arguments] ${domain} ${service} + Log Creating session http://${domain} + ${session}= Create Session jaeger http://${domain} + ${tags}= Create Dictionary uri=/v2/compositions/{compositionId} + ${tags_json}= evaluate json.dumps(${tags}) json + ${params}= Create Dictionary service=${service} tags=${tags_json} operation=http put /v2/compositions/{compositionId} lookback=1h limit=10 + ${resp}= GET On Session jaeger /api/traces params=${params} expected_status=200 + Log Received response from jaeger ${resp.text} + RETURN ${resp} diff --git a/csit/resources/tests/xacml-pdp-slas.robot b/csit/resources/tests/xacml-pdp-slas.robot new file mode 100644 index 00000000..e3d2d910 --- /dev/null +++ b/csit/resources/tests/xacml-pdp-slas.robot @@ -0,0 +1,30 @@ +*** Settings *** +Library OperatingSystem +Resource common-library.robot + +*** Test Cases *** +WaitForPrometheusServer + [Documentation] Sleep time to wait for Prometheus server to gather all metrics + Sleep 1 minute + +ValidatePolicyDecisionsGauge + [Documentation] Validate policy execution gauge using prometheus metrics + ValidatePrometheusMetric pdpx_policy_decisions_created{application="optimization",status="permit", instance="policy-xacml-pdp:6969", job="xacml-pdp-metrics"} 1.8E9 + ValidatePrometheusMetric pdpx_policy_decisions_created{application="guard",status="not_applicable", instance="policy-xacml-pdp:6969", job="xacml-pdp-metrics"} 1.8E9 + ValidatePrometheusMetric pdpx_policy_decisions_created{application="monitoring",status="permit", instance="policy-xacml-pdp:6969", job="xacml-pdp-metrics"} 1.8E9 + ValidatePrometheusMetric pdpx_policy_decisions_created{application="naming",status="permit", instance="policy-xacml-pdp:6969", job="xacml-pdp-metrics"} 1.8E9 + +ValidatePolicyDecisionsTotalCounter + [Documentation] Validate policy decision counters using prometheus metrics + ValidatePrometheusMetric pdpx_policy_decisions_total{application="optimization",status="permit", instance="policy-xacml-pdp:6969", job="xacml-pdp-metrics"} 1 + ValidatePrometheusMetric pdpx_policy_decisions_total{application="guard",status="not_applicable", instance="policy-xacml-pdp:6969", job="xacml-pdp-metrics"} 1 + ValidatePrometheusMetric pdpx_policy_decisions_total{application="monitoring",status="permit", instance="policy-xacml-pdp:6969", job="xacml-pdp-metrics"} 2 + ValidatePrometheusMetric pdpx_policy_decisions_total{application="naming",status="permit", instance="policy-xacml-pdp:6969", job="xacml-pdp-metrics"} 1 + +*** Keywords *** +ValidatePrometheusMetric + [Arguments] ${url} ${expectedLimit} + [Documentation] Check that the policy execution is under X limit + ${resp}= QueryPrometheus ${url} + ${actualValue}= Evaluate ${resp['data']['result'][0]['value'][1]} + Should Be True ${actualValue} <= ${expectedLimit} diff --git a/csit/resources/tests/xacml-pdp-test.robot b/csit/resources/tests/xacml-pdp-test.robot index cddecab9..4eaca607 100644 --- a/csit/resources/tests/xacml-pdp-test.robot +++ b/csit/resources/tests/xacml-pdp-test.robot @@ -4,7 +4,7 @@ Library RequestsLibrary Library OperatingSystem Library Process Library json -Resource ${CURDIR}/common-library.robot +Resource common-library.robot *** Test Cases *** Healthcheck @@ -37,12 +37,12 @@ ExecuteXacmlPolicy CreateMonitorPolicy [Documentation] Create a Monitoring policy ${postjson}= Get file ${DATA}/vCPE.policy.monitoring.input.tosca.json - CreatePolicy /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies 200 ${postjson} onap.restart.tca 1.0.0 + CreatePolicy /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies 201 ${postjson} onap.restart.tca 1.0.0 CreateOptimizationPolicy [Documentation] Create an Optimization policy ${postjson}= Get file ${DATA}/vCPE.policies.optimization.input.tosca.json - CreatePolicy /policy/api/v1/policytypes/onap.policies.optimization.resource.AffinityPolicy/versions/1.0.0/policies 200 ${postjson} OSDF_CASABLANCA.Affinity_Default 1.0.0 + CreatePolicy /policy/api/v1/policytypes/onap.policies.optimization.resource.AffinityPolicy/versions/1.0.0/policies 201 ${postjson} OSDF_CASABLANCA.Affinity_Default 1.0.0 GetDefaultDecision [Documentation] Get Default Decision with no policies in Xacml PDP diff --git a/csit/run-acm-regression.sh b/csit/run-acm-regression.sh index 5f77d214..19160027 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 find_release_profile() { + if [ $1 == 'master' ] || [[ "$(echo "$1" | cut -c1 )" > 'n' ]]; then + echo "default" + else + echo "default,legacy" + fi +} + +# Legacy config files for versions before 8.0.0 +function find_version_profile() { + if [[ "$(printf '%s\n' "$1" "8.0.0" | sort -V | head -n 1)" == "8.0.0" ]]; then + echo "default" + else + echo "default,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,66 @@ if [ -z "${WORKSPACE}" ]; then export WORKSPACE 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_PROFILE=$(find_release_profile "$DEFAULT_BRANCH") + export PPNT_PROFILE="$CLAMP_PROFILE" + echo "Using $CLAMP_PROFILE profile for ACM-R and $PPNT_PROFILE profile 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_PROFILE=$(find_release_profile $2) + export PPNT_PROFILE=$(find_release_profile $3) + echo "Using $CLAMP_PROFILE profile for ACM-R and $PPNT_PROFILE profile 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_PROFILE=$(find_version_profile "$2") + export PPNT_PROFILE=$(find_version_profile "$3") + echo "Using $CLAMP_PROFILE profile for ACM-R and $PPNT_PROFILE profile 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" +export CONTAINER_LOCATION="nexus3.onap.org:10001/" + +docker compose up -d "policy-clamp-runtime-acm" # wait for the app to start up "${SCRIPTS}"/wait_for_rest.sh localhost "${ACM_PORT}" @@ -65,4 +134,10 @@ 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 + +cd ${COMPOSE_FOLDER} +source stop-compose.sh clamp +mv ${COMPOSE_FOLDER}/*.log ${REGRESSION_FOLDER} + +cd ${REGRESSION_FOLDER} diff --git a/csit/run-k8s-csit.sh b/csit/run-k8s-csit.sh index c7d04032..feab0437 100755 --- a/csit/run-k8s-csit.sh +++ b/csit/run-k8s-csit.sh @@ -28,11 +28,11 @@ export GERRIT_BRANCH=$(awk -F= '$1 == "defaultbranch" { print $2 }' "${WORKSPACE CSIT_SCRIPT="scripts/run-test.sh" ROBOT_DOCKER_IMAGE="policy-csit-robot" -POLICY_CLAMP_ROBOT="policy-clamp-test.robot" +POLICY_CLAMP_ROBOT="policy-clamp-test.robot clamp-slas.robot" POLICY_API_ROBOT="api-test.robot api-slas.robot" POLICY_PAP_ROBOT="pap-test.robot pap-slas.robot" POLICY_APEX_PDP_ROBOT="apex-pdp-test.robot apex-slas.robot" -POLICY_XACML_PDP_ROBOT="xacml-pdp-test.robot" +POLICY_XACML_PDP_ROBOT="xacml-pdp-test.robot xacml-pdp-slas.robot" POLICY_DROOLS_PDP_ROBOT="drools-pdp-test.robot" POLICY_DISTRIBUTION_ROBOT="distribution-test.robot" @@ -47,6 +47,7 @@ POLICY_K8S_PPNT_CONTAINER="policy-clamp-ac-k8s-ppnt" POLICY_HTTP_PPNT_CONTAINER="policy-clamp-ac-http-ppnt" POLICY_SIM_PPNT_CONTAINER="policy-clamp-ac-sim-ppnt" POLICY_PF_PPNT_CONTAINER="policy-clamp-ac-pf-ppnt" +JAEGER_CONTAINER="jaeger" KAFKA_CONTAINER="kafka-deployment" ZK_CONTAINER="zookeeper-deployment" KAFKA_DIR=${WORKSPACE}/helm/cp-kafka @@ -68,7 +69,7 @@ function spin_microk8s_cluster() { if [ "$exitcode" -ne 0 ]; then echo "Microk8s cluster not available, Spinning up the cluster.." - sudo snap install microk8s --classic --channel=1.26/stable + sudo snap install microk8s --classic --channel=1.30/stable if [ "${?}" -ne 0 ]; then echo "Failed to install kubernetes cluster. Aborting.." @@ -76,8 +77,8 @@ function spin_microk8s_cluster() { fi echo "Microk8s cluster installed successfully" sudo usermod -a -G microk8s $USER - echo "Enabling DNS and helm3 plugins" - sudo microk8s.enable dns helm3 hostpath-storage + echo "Enabling DNS and Storage plugins" + sudo microk8s.enable dns hostpath-storage echo "Creating configuration file for Microk8s" sudo mkdir -p $HOME/.kube sudo chown -R $USER:$USER $HOME/.kube @@ -95,8 +96,8 @@ function spin_microk8s_cluster() { exitcode="${?}" if [ "$exitcode" -ne 0 ]; then - echo "Kubectl not available, Spinning up the cluster.." - sudo snap install kubectl --classic --channel=1.26/stable + echo "Kubectl not available, Installing.." + sudo snap install kubectl --classic --channel=1.30/stable if [ "${?}" -ne 0 ]; then echo "Failed to install Kubectl. Aborting.." @@ -109,6 +110,26 @@ function spin_microk8s_cluster() { echo "----------------------------------------" return 0 fi + + echo "Verify if helm is running.." + helm version + exitcode="${?}" + + if [ "$exitcode" -ne 0 ]; then + echo "Helm not available, Installing.." + sudo snap install helm --classic --channel=3.7 + + if [ "${?}" -ne 0 ]; then + echo "Failed to install Helm client. Aborting.." + return 1 + fi + echo "Helm installation completed" + echo "----------------------------------------" + else + echo "Helm is already running" + echo "----------------------------------------" + return 0 + fi } function install_kafka() { @@ -120,17 +141,17 @@ function install_kafka() { function uninstall_policy() { echo "Removing the policy helm deployment" - sudo microk8s helm uninstall csit-policy - sudo microk8s helm uninstall prometheus - sudo microk8s helm uninstall csit-robot - sudo kubectl delete deploy $ZK_CONTAINER $KAFKA_CONTAINER + helm uninstall csit-policy + helm uninstall prometheus + helm uninstall csit-robot + kubectl delete deploy $ZK_CONTAINER $KAFKA_CONTAINER rm -rf ${WORKSPACE}/helm/policy/Chart.lock if [ "$PROJECT" == "clamp" ] || [ "$PROJECT" == "policy-clamp" ]; then - sudo microk8s helm uninstall policy-chartmuseum - sudo microk8s helm repo remove chartmuseum-git policy-chartmuseum + helm uninstall policy-chartmuseum + helm repo remove chartmuseum-git policy-chartmuseum fi sudo rm -rf /dockerdata-nfs/mariadb-galera/ - sudo microk8s kubectl delete pvc --all + kubectl delete pvc --all echo "Policy deployment deleted" echo "Clean up docker" docker image prune -f @@ -139,6 +160,8 @@ function uninstall_policy() { function teardown_cluster() { echo "Removing k8s cluster and k8s configuration file" sudo snap remove microk8s;rm -rf $HOME/.kube/config + sudo snap remove helm; + sudo snap remove kubectl; echo "MicroK8s Cluster removed" } @@ -172,14 +195,14 @@ function start_csit() { while [[ ${POD_READY_STATUS} != "1/1" ]]; do echo "Waiting for chartmuseum pod to come up..." sleep 5 - POD_READY_STATUS=$(sudo microk8s kubectl get pods | grep -e "policy-chartmuseum" | awk '{print $2}') + POD_READY_STATUS=$(kubectl get pods | grep -e "policy-chartmuseum" | awk '{print $2}') done push_acelement_chart fi echo "Installing Robot framework pod for running CSIT" cd ${WORKSPACE}/helm mkdir -p ${ROBOT_LOG_DIR} - sudo microk8s helm install csit-robot robot --set robot="$ROBOT_FILE" --set "readiness={${READINESS_CONTAINERS[*]}}" --set robotLogDir=$ROBOT_LOG_DIR + helm install csit-robot robot --set robot="$ROBOT_FILE" --set "readiness={${READINESS_CONTAINERS[*]}}" --set robotLogDir=$ROBOT_LOG_DIR print_robot_log fi } @@ -189,17 +212,17 @@ function print_robot_log() { while [[ ${count_pods} -eq 0 ]]; do echo "Waiting for pods to come up..." sleep 5 - count_pods=$(sudo microk8s kubectl get pods --output name | wc -l) + count_pods=$(kubectl get pods --output name | wc -l) done - robotpod=$(sudo microk8s kubectl get po | grep policy-csit) + robotpod=$(kubectl get po | grep policy-csit) podName=$(echo "$robotpod" | awk '{print $1}') echo "The robot tests will begin once the policy components {${READINESS_CONTAINERS[*]}} are up and running..." - sudo microk8s kubectl wait --for=jsonpath='{.status.phase}'=Running --timeout=18m pod/"$podName" + kubectl wait --for=jsonpath='{.status.phase}'=Running --timeout=18m pod/"$podName" echo "Policy deployment status:" - sudo microk8s kubectl get po - sudo microk8s kubectl get all -A + kubectl get po + kubectl get all -A echo "Robot Test logs:" - sudo microk8s kubectl logs -f "$podName" + kubectl logs -f "$podName" } function clone_models() { @@ -235,10 +258,11 @@ function set_project_config() { clamp | policy-clamp) export ROBOT_FILE=$POLICY_CLAMP_ROBOT export READINESS_CONTAINERS=($POLICY_CLAMP_CONTAINER,$POLICY_APEX_CONTAINER,$POLICY_PF_PPNT_CONTAINER,$POLICY_K8S_PPNT_CONTAINER, - $POLICY_HTTP_PPNT_CONTAINER,$POLICY_SIM_PPNT_CONTAINER) + $POLICY_HTTP_PPNT_CONTAINER,$POLICY_SIM_PPNT_CONTAINER,$JAEGER_CONTAINER) export SET_VALUES="--set $POLICY_CLAMP_CONTAINER.enabled=true --set $POLICY_APEX_CONTAINER.enabled=true --set $POLICY_PF_PPNT_CONTAINER.enabled=true --set $POLICY_K8S_PPNT_CONTAINER.enabled=true - --set $POLICY_HTTP_PPNT_CONTAINER.enabled=true --set $POLICY_SIM_PPNT_CONTAINER.enabled=true" + --set $POLICY_HTTP_PPNT_CONTAINER.enabled=true --set $POLICY_SIM_PPNT_CONTAINER.enabled=true + --set $JAEGER_CONTAINER.enabled=true" install_chartmuseum ;; @@ -273,8 +297,7 @@ function set_project_config() { distribution | policy-distribution) export ROBOT_FILE=($POLICY_DISTRIBUTION_ROBOT) - export READINESS_CONTAINERS=($POLICY_APEX_CONTAINER,$POLICY_API_CONTAINER,$POLICY_PAP_CONTAINER, - $POLICY_DISTRIBUTION_CONTAINER) + export READINESS_CONTAINERS=($POLICY_APEX_CONTAINER,$POLICY_API_CONTAINER,$POLICY_PAP_CONTAINER,$POLICY_DISTRIBUTION_CONTAINER) export SET_VALUES="--set $POLICY_APEX_CONTAINER.enabled=true --set $POLICY_DISTRIBUTION_CONTAINER.enabled=true" ;; @@ -295,29 +318,32 @@ function set_project_config() { } function install_chartmuseum () { + echo "---------------------------------------------" echo "Installing Chartmuseum helm repository..." - sudo microk8s helm repo add chartmuseum-git https://chartmuseum.github.io/charts - sudo microk8s helm repo update - sudo microk8s helm install policy-chartmuseum chartmuseum-git/chartmuseum --set env.open.DISABLE_API=false --set service.type=NodePort --set service.nodePort=30208 - sudo microk8s helm plugin install https://github.com/chartmuseum/helm-push + helm repo add chartmuseum-git https://chartmuseum.github.io/charts + helm repo update + helm install policy-chartmuseum chartmuseum-git/chartmuseum --set env.open.DISABLE_API=false --set service.type=NodePort --set service.nodePort=30208 + helm plugin install https://github.com/chartmuseum/helm-push echo "---------------------------------------------" } function push_acelement_chart() { echo "Pushing acelement chart to the chartmuseum repo..." - sudo microk8s helm repo add policy-chartmuseum http://localhost:30208 + helm repo add policy-chartmuseum http://localhost:30208 # download clamp repo git clone -b "${GERRIT_BRANCH}" --single-branch https://github.com/onap/policy-clamp.git "${WORKSPACE}"/csit/resources/tests/clamp ACELEMENT_CHART=${WORKSPACE}/csit/resources/tests/clamp/examples/src/main/resources/clamp/acm/acelement-helm/acelement - sudo microk8s helm cm-push $ACELEMENT_CHART policy-chartmuseum - sudo microk8s helm repo update + helm cm-push $ACELEMENT_CHART policy-chartmuseum + helm repo update rm -rf ${WORKSPACE}/csit/resources/tests/clamp/ echo "-------------------------------------------" } function get_pod_name() { - microk8s kubectl get pods --no-headers -o custom-columns=':metadata.name' | grep $1 + pods=$(kubectl get pods --no-headers -o custom-columns=':metadata.name' | grep $1) + read -rd '' -a pod_array <<< "$pods" + echo "${pod_array[@]}" } wait_for_pods_running() { @@ -326,11 +352,10 @@ wait_for_pods_running() { local timeout_seconds="$1" shift - IFS=',' read -ra pod_names <<< "$1" + IFS=',' read -ra pod_names <<< "$@" shift local pending_pods=("${pod_names[@]}") - local start_time start_time=$(date +%s) @@ -341,26 +366,42 @@ wait_for_pods_running() { elapsed_time=$((current_time - start_time)) if [ "$elapsed_time" -ge "$timeout_seconds" ]; then - echo "Timed out waiting for all pods to reach 'Running' state." + echo "Timed out waiting for the pods to reach 'Running' state." + echo "Printing the current status of the deployment before exiting.." + kubectl get po; + kubectl describe pods; + echo "------------------------------------------------------------" + for pod in "${pending_pods[@]}"; do + echo "Logs of the pod $pod" + kubectl logs $pod + echo "---------------------------------------------------------" + done exit 1 fi local newly_running_pods=() for pod_name_prefix in "${pending_pods[@]}"; do - local pod_name=$(get_pod_name "$pod_name_prefix") - local pod_status - local pod_ready - - pod_status=$(kubectl get pod "$pod_name" -n "$namespace" --no-headers -o custom-columns=STATUS:.status.phase 2>/dev/null) - pod_ready=$(kubectl get pod "$pod_name" -o jsonpath='{.status.containerStatuses[*].ready}') - - if [ "$pod_status" == "Running" ] && [ "$pod_ready" == "true" ]; then - echo "Pod '$pod_name' in namespace '$namespace' is now in 'Running' state and 'Readiness' is true" - else - newly_running_pods+=("$pod_name") - echo "Waiting for pod '$pod_name' in namespace '$namespace' to reach 'Running' and 'Ready' state..." + local pod_names=$(get_pod_name "$pod_name_prefix") + IFS=' ' read -r -a pod_array <<< "$pod_names" + if [ "${#pod_array[@]}" -eq 0 ]; then + echo "*** Error: No pods found for the deployment $pod_name_prefix . Exiting ***" + return -1 fi + for pod in "${pod_array[@]}"; do + local pod_status + local pod_ready + pod_status=$(kubectl get pod "$pod" -n "$namespace" --no-headers -o custom-columns=STATUS:.status.phase 2>/dev/null) + pod_ready=$(kubectl get pod "$pod" -o jsonpath='{.status.containerStatuses[*].ready}') + + if [ "$pod_status" == "Running" ] && [ "$pod_ready" == "true" ]; then + echo "Pod '$pod' in namespace '$namespace' is now in 'Running' state and 'Readiness' is true" + else + newly_running_pods+=("$pod") + echo "Waiting for pod '$pod' in namespace '$namespace' to reach 'Running' and 'Ready' state..." + fi + + done done pending_pods=("${newly_running_pods[@]}") @@ -371,7 +412,6 @@ wait_for_pods_running() { echo "All specified pods are in the 'Running and Ready' state. Exiting the function." } - OPERATION="$1" PROJECT="$2" if [ -z "$3" ] @@ -397,10 +437,10 @@ if [ $OPERATION == "install" ]; then ${WORKSPACE}/compose/loaddockerimage.sh fi cd ${WORKSPACE}/helm || exit - sudo microk8s helm dependency build policy - sudo microk8s helm install csit-policy policy ${SET_VALUES} - sudo microk8s helm install prometheus prometheus - wait_for_pods_running default 480 $READINESS_CONTAINERS + helm dependency build policy + helm install csit-policy policy ${SET_VALUES} + helm install prometheus prometheus + wait_for_pods_running default 900 ${READINESS_CONTAINERS[@]} echo "Policy chart installation completed" echo "-------------------------------------------" fi diff --git a/csit/run-project-csit.sh b/csit/run-project-csit.sh index 678bfe2a..e355d5ff 100755 --- a/csit/run-project-csit.sh +++ b/csit/run-project-csit.sh @@ -18,6 +18,23 @@ # limitations under the License. # +# even with forced finish, clean up docker containers +function on_exit(){ + rm -rf ${CSAR_DIR}/csar_temp.csar + + # 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 + + mv ${DOCKER_COMPOSE_DIR}/*.log ${ROBOT_LOG_DIR} + exit $RC +} + function docker_stats(){ # General memory details if [ "$(uname -s)" == "Darwin" ] @@ -33,135 +50,153 @@ function docker_stats(){ fi # Memory details per Docker - docker ps --format "table {{ .Names }}\t{{ .Status }}" + docker ps --format "table {{ .Image }}\t{{ .Names }}\t{{ .Status }}" echo docker stats --no-stream echo } +function apex_healthcheck() { + sleep 20 + + healthy=false + + while [ $healthy = false ] + do + msg=`curl -s -k --user 'policyadmin:zb!XztG34' http://localhost:${APEX_PORT}/policy/apex-pdp/v1/healthcheck` + echo "${msg}" | grep -q true + if [ "${?}" -eq 0 ] + then + healthy=true + break + fi + sleep 10s + done + + if [ $healthy = false ]; then + exit 2 + fi +} + +function check_rest_endpoint() { + bash ${SCRIPTS}/wait_for_rest.sh localhost "${1}" + rc=$? + if [ $rc -ne 0 ]; then + on_exit + fi +} + function setup_clamp() { + export ROBOT_FILES="policy-clamp-test.robot clamp-slas.robot" + source ${DOCKER_COMPOSE_DIR}/start-compose.sh policy-clamp-runtime-acm --grafana + sleep 30 + check_rest_endpoint "${ACM_PORT}" +} + +function setup_clamp_replica() { + export ACM_REPLICA_TEARDOWN=true export ROBOT_FILES="policy-clamp-test.robot" export TEST_ENV="docker" - source "${WORKSPACE}"/compose/start-compose.sh policy-clamp-runtime-acm - sleep 30 - bash "${SCRIPTS}"/wait_for_rest.sh localhost "${ACM_PORT}" + export PROJECT=clamp + source ${DOCKER_COMPOSE_DIR}/start-acm-replica.sh --start --replicas=2 + echo "Waiting a minute for the replicas to be started..." + sleep 60 + # 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_api() { export ROBOT_FILES="api-test.robot api-slas.robot" - source "${WORKSPACE}"/compose/start-compose.sh api --grafana + source ${DOCKER_COMPOSE_DIR}/start-compose.sh api --grafana sleep 10 - bash "${SCRIPTS}"/wait_for_rest.sh localhost ${API_PORT} + check_rest_endpoint ${API_PORT} } function setup_pap() { export ROBOT_FILES="pap-test.robot pap-slas.robot" - source "${WORKSPACE}"/compose/start-compose.sh apex-pdp --grafana + source ${DOCKER_COMPOSE_DIR}/start-compose.sh apex-pdp --grafana sleep 10 - bash "${SCRIPTS}"/wait_for_rest.sh localhost ${PAP_PORT} + check_rest_endpoint ${PAP_PORT} } function setup_apex() { export ROBOT_FILES="apex-pdp-test.robot apex-slas.robot" - source "${WORKSPACE}"/compose/start-compose.sh apex-pdp --grafana + source ${DOCKER_COMPOSE_DIR}/start-compose.sh apex-pdp --grafana sleep 10 - bash "${SCRIPTS}"/wait_for_rest.sh localhost ${PAP_PORT} - bash "${SCRIPTS}"/wait_for_rest.sh localhost ${APEX_PORT} - apex_healthcheck -} - -function setup_apex_postgres() { - export ROBOT_FILES="apex-pdp-test.robot" - source "${WORKSPACE}"/compose/start-postgres-tests.sh 1 - sleep 10 - bash "${SCRIPTS}"/wait_for_rest.sh localhost ${PAP_PORT} - bash "${SCRIPTS}"/wait_for_rest.sh localhost ${APEX_PORT} + check_rest_endpoint ${PAP_PORT} + check_rest_endpoint ${APEX_PORT} apex_healthcheck } function setup_apex_medium() { export SUITES="apex-slas-3.robot" - source "${WORKSPACE}"/compose/start-multiple-pdp.sh 3 + export APEX_REPLICA_TEARDOWN=true + source ${DOCKER_COMPOSE_DIR}/start-multiple-pdp.sh --start --replicas=3 sleep 10 - bash "${SCRIPTS}"/wait_for_rest.sh localhost ${PAP_PORT} - bash "${SCRIPTS}"/wait_for_rest.sh localhost ${APEX_PORT} + check_rest_endpoint ${PAP_PORT} + check_rest_endpoint ${APEX_PORT} apex_healthcheck } function setup_apex_large() { export ROBOT_FILES="apex-slas-10.robot" - source "${WORKSPACE}"/compose/start-multiple-pdp.sh 10 + export APEX_REPLICA_TEARDOWN=true + source ${DOCKER_COMPOSE_DIR}/start-multiple-pdp.sh --start --replicas=10 sleep 10 - bash "${SCRIPTS}"/wait_for_rest.sh localhost ${PAP_PORT} - bash "${SCRIPTS}"/wait_for_rest.sh localhost ${APEX_PORT} + check_rest_endpoint ${PAP_PORT} + check_rest_endpoint ${APEX_PORT} apex_healthcheck } -function apex_healthcheck() { - sleep 20 - - healthy=false - - while [ $healthy = false ] - do - msg=`curl -s -k --user 'policyadmin:zb!XztG34' http://localhost:${APEX_PORT}/policy/apex-pdp/v1/healthcheck` - echo "${msg}" | grep -q true - if [ "${?}" -eq 0 ] - then - healthy=true - break - fi - sleep 10s - done -} - function setup_drools_apps() { - export ROBOT_FILES="drools-applications-test.robot" - source "${WORKSPACE}"/compose/start-compose.sh drools-applications + export ROBOT_FILES="drools-applications-test.robot drools-applications-slas.robot" + source ${DOCKER_COMPOSE_DIR}/start-compose.sh drools-applications --grafana sleep 10 - bash "${SCRIPTS}"/wait_for_rest.sh localhost ${PAP_PORT} + check_rest_endpoint ${PAP_PORT} sleep 10 - bash "${SCRIPTS}"/wait_for_rest.sh localhost ${DROOLS_APPS_PORT} + check_rest_endpoint ${DROOLS_APPS_PORT} sleep 10 - bash "${SCRIPTS}"/wait_for_rest.sh localhost ${DROOLS_APPS_TELEMETRY_PORT} + check_rest_endpoint ${DROOLS_APPS_TELEMETRY_PORT} } function setup_xacml_pdp() { - export ROBOT_FILES="xacml-pdp-test.robot" - source "${WORKSPACE}"/compose/start-compose.sh xacml-pdp + export ROBOT_FILES="xacml-pdp-test.robot xacml-pdp-slas.robot" + source ${DOCKER_COMPOSE_DIR}/start-compose.sh xacml-pdp --grafana sleep 10 - bash "${SCRIPTS}"/wait_for_rest.sh localhost "${XACML_PORT}" + check_rest_endpoint "${XACML_PORT}" } function setup_drools_pdp() { export ROBOT_FILES="drools-pdp-test.robot" - source "${WORKSPACE}"/compose/start-compose.sh drools-pdp + source ${DOCKER_COMPOSE_DIR}/start-compose.sh drools-pdp --grafana sleep 30 - bash "${SCRIPTS}"/wait_for_rest.sh localhost ${DROOLS_TELEMETRY_PORT} + check_rest_endpoint ${DROOLS_TELEMETRY_PORT} } function setup_distribution() { - zip -F ${WORKSPACE}/csit/resources/tests/data/csar/sample_csar_with_apex_policy.csar \ - --out ${WORKSPACE}/csit/resources/tests/data/csar/csar_temp.csar -q + 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 sudo mkdir /tmp/distribution export ROBOT_FILES="distribution-test.robot" - source "${WORKSPACE}"/compose/start-compose.sh distribution + source ${DOCKER_COMPOSE_DIR}/start-compose.sh distribution --grafana sleep 10 - bash "${SCRIPTS}"/wait_for_rest.sh localhost "${DIST_PORT}" + check_rest_endpoint "${DIST_PORT}" } function build_robot_image() { - bash "${SCRIPTS}"/build-csit-docker-image.sh + bash ${SCRIPTS}/build-csit-docker-image.sh cd ${WORKSPACE} } function run_robot() { - docker compose -f "${WORKSPACE}"/compose/docker-compose.yml up csit-tests + docker compose -f ${DOCKER_COMPOSE_DIR}/compose.yaml up csit-tests export RC=$? } @@ -173,6 +208,10 @@ function set_project_config() { setup_clamp ;; + clamp-replica | policy-clamp-replica) + setup_clamp_replica + ;; + api | policy-api) setup_api ;; @@ -190,11 +229,11 @@ function set_project_config() { ;; apex-pdp-medium | policy-apex-pdp-medium) - setup_apex + setup_apex_medium ;; apex-pdp-large | policy-apex-pdp-large) - setup_apex + setup_apex_large ;; xacml-pdp | policy-xacml-pdp) @@ -220,14 +259,6 @@ function set_project_config() { esac } -# even with forced finish, clean up docker containers -function on_exit(){ - rm -rf ${WORKSPACE}/csit/resources/tests/data/csar/csar_temp.csar - source ${WORKSPACE}/compose/stop-compose.sh - cp ${WORKSPACE}/compose/*.log ${WORKSPACE}/csit/archives/${PROJECT} - exit $RC -} - # ensure that teardown and other finalizing steps are always executed trap on_exit EXIT @@ -239,9 +270,13 @@ fi export GERRIT_BRANCH=$(awk -F= '$1 == "defaultbranch" { print $2 }' "${WORKSPACE}"/.gitreview) export PROJECT="${1}" -export ROBOT_LOG_DIR=${WORKSPACE}/csit/archives/${PROJECT} +export ROBOT_LOG_DIR="${WORKSPACE}/csit/archives/${PROJECT}" 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 cd "${WORKSPACE}" @@ -260,7 +295,7 @@ if [[ $compose_version == *"Docker Compose version"* ]]; then else echo "Docker Compose Plugin not installed. Installing now..." sudo mkdir -p /usr/local/lib/docker/cli-plugins - sudo curl -SL https://github.com/docker/compose/releases/download/v2.27.0/docker-compose-linux-x86_64 -o /usr/local/lib/docker/cli-plugins/docker-compose + sudo curl -SL https://github.com/docker/compose/releases/download/v2.29.1/docker-compose-linux-x86_64 -o /usr/local/lib/docker/cli-plugins/docker-compose sudo chmod +x /usr/local/lib/docker/cli-plugins/docker-compose fi @@ -270,16 +305,16 @@ unset http_proxy https_proxy export ROBOT_FILES -# use a separate script to build a CSIT docker image, to containerize the test run +# use a separate script to build a CSIT docker image, to isolate the test run if [ "${2}" == "--skip-build-csit" ]; then echo "Skipping build csit robot image" else build_robot_image fi -docker_stats | tee "${WORKSPACE}/csit/archives/${PROJECT}/_sysinfo-1-after-setup.txt" +docker_stats | tee "${ROBOT_LOG_DIR}/_sysinfo-1-after-setup.txt" # start the CSIT container and run the tests run_robot -docker ps --format "table {{ .Names }}\t{{ .Status }}" +docker ps --format "table {{ .Image }}\t{{ .Names }}\t{{ .Status }}" diff --git a/csit/start-s3p-tests.sh b/csit/start-s3p-tests.sh index 2e397eb5..41974601 100755 --- a/csit/start-s3p-tests.sh +++ b/csit/start-s3p-tests.sh @@ -29,7 +29,7 @@ function start_kubernetes() { function install_jmeter() { #NOTE: $TESTDIR is set by the component triggering this script - cd ${TESTDIR}/automate-performance + cd ${TESTDIR}/automate-s3p-test sudo apt-get update @@ -72,7 +72,7 @@ function on_exit() { function teardown() { echo "Removing temp directories.." - rm -r ${TESTDIR}/automate-performance + rm -r ${TESTDIR}/automate-s3p-test echo "Removed directories" @@ -102,7 +102,7 @@ then echo "===========================" echo "Executing tests" echo "===========================" - cd ${TESTDIR}/automate-performance || exit + cd ${TESTDIR}/automate-s3p-test || exit nohup jmeter -n -t $2 -l s3pTestResults.jtl # TODO: Generate report on on_exit() @@ -113,4 +113,4 @@ then teardown else echo "Invalid arguments provided. Usage: $0 [option..] {run | uninstall}" -fi
\ No newline at end of file +fi diff --git a/helm/policy/Chart.yaml b/helm/policy/Chart.yaml index 6947078b..9eb39120 100755 --- a/helm/policy/Chart.yaml +++ b/helm/policy/Chart.yaml @@ -78,3 +78,8 @@ dependencies: version: ~11.x-0 repository: 'file://components/policy-clamp-ac-a1pms-ppnt' condition: policy-clamp-ac-a1pms-ppnt.enabled + - name: jaeger-all-in-one + version: 0.1.12 + repository: https://raw.githubusercontent.com/hansehe/jaeger-all-in-one/master/helm/charts + alias: jaeger + condition: jaeger.enabled diff --git a/helm/policy/components/policy-api/resources/config/apiParameters.yaml b/helm/policy/components/policy-api/resources/config/apiParameters.yaml index 48e1df64..3d593260 100644 --- a/helm/policy/components/policy-api/resources/config/apiParameters.yaml +++ b/helm/policy/components/policy-api/resources/config/apiParameters.yaml @@ -38,7 +38,7 @@ spring: jpa: properties: hibernate: - dialect: org.hibernate.dialect.MariaDB103Dialect + format_sql: true hibernate: ddl-auto: none naming: diff --git a/helm/policy/components/policy-clamp-ac-a1pms-ppnt/resources/config/A1pmsParticipantParameters.yaml b/helm/policy/components/policy-clamp-ac-a1pms-ppnt/resources/config/A1pmsParticipantParameters.yaml index f2589482..14de491c 100755 --- a/helm/policy/components/policy-clamp-ac-a1pms-ppnt/resources/config/A1pmsParticipantParameters.yaml +++ b/helm/policy/components/policy-clamp-ac-a1pms-ppnt/resources/config/A1pmsParticipantParameters.yaml @@ -16,6 +16,8 @@ # ============LICENSE_END========================================================= spring: + application: + name: {{ .Values.applicationName }} security: user: name: participantUser @@ -53,6 +55,7 @@ participant: - "{{ .Values.global.kafkaServer }}:9092" topicCommInfrastructure: kafka fetchTimeout: 15000 + allowTracing: {{ include "policy-clamp-ac-a1pms-ppnt.jaeger-enabled" . }} additionalProps: group.id: policy-clamp-ac-a1pms-ppnt - topic: ${participant.intermediaryParameters.topics.syncTopic} @@ -60,17 +63,24 @@ participant: - "{{ .Values.global.kafkaServer }}:9092" topicCommInfrastructure: kafka fetchTimeout: 15000 + allowTracing: {{ include "policy-clamp-ac-a1pms-ppnt.jaeger-enabled" . }} topicSinks: - topic: ${participant.intermediaryParameters.topics.operationTopic} servers: - "{{ .Values.global.kafkaServer }}:9092" topicCommInfrastructure: kafka + allowTracing: {{ include "policy-clamp-ac-a1pms-ppnt.jaeger-enabled" . }} participantSupportedElementTypes: - typeName: org.onap.policy.clamp.acm.A1PMSAutomationCompositionElement typeVersion: 1.0.1 management: + tracing: + propagation: + produce: [{{ .Values.jaeger.producer.type }}] + sampling: + probability: {{ .Values.jaeger.sampling.probability }} endpoints: web: base-path: / @@ -83,4 +93,13 @@ server: ssl: enabled: false +tracing: + enabled: {{ .Values.jaeger.enabled }} + exporter: + endpoint: {{ .Values.jaeger.collector.host }}:{{ include "policy-clamp-ac-a1pms-ppnt.exporter-port" . }} + protocol: {{ .Values.jaeger.collector.protocol }} + sampler: + jaeger-remote: + endpoint: {{ .Values.jaeger.collector.host }}:{{ .Values.jaeger.collector.portJaegerGrpc }} + diff --git a/helm/policy/components/policy-clamp-ac-a1pms-ppnt/resources/config/a1pms-participant.sh b/helm/policy/components/policy-clamp-ac-a1pms-ppnt/resources/config/a1pms-participant.sh new file mode 100644 index 00000000..88ff3b88 --- /dev/null +++ b/helm/policy/components/policy-clamp-ac-a1pms-ppnt/resources/config/a1pms-participant.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env sh +# +# ============LICENSE_START======================================================= +# Copyright (C) 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========================================================= +# + +KEYSTORE="${KEYSTORE:-$POLICY_HOME/etc/ssl/policy-keystore}" +TRUSTSTORE="${TRUSTSTORE:-$POLICY_HOME/etc/ssl/policy-truststore}" +KEYSTORE_PASSWD="${KEYSTORE_PASSWD:-Pol1cy_0nap}" +TRUSTSTORE_PASSWD="${TRUSTSTORE_PASSWD:-Pol1cy_0nap}" + +if [ "$#" -eq 1 ]; then + CONFIG_FILE=$1 +fi + +if [ -z "$CONFIG_FILE" ]; then + CONFIG_FILE="${POLICY_HOME}/etc/A1pmsParticipantParameters.yaml" +fi + +echo "Policy clamp A1 Pms participant config file: $CONFIG_FILE" + +if [ -f "${POLICY_HOME}/etc/mounted/policy-truststore" ]; then + echo "overriding policy-truststore" + cp -f "${POLICY_HOME}"/etc/mounted/policy-truststore "${TRUSTSTORE}" +fi + +if [ -f "${POLICY_HOME}/etc/mounted/policy-keystore" ]; then + echo "overriding policy-keystore" + cp -f "${POLICY_HOME}"/etc/mounted/policy-keystore "${KEYSTORE}" +fi + +if [ -f "${POLICY_HOME}/etc/mounted/logback.xml" ]; then + echo "overriding logback xml file" + cp -f "${POLICY_HOME}"/etc/mounted/logback.xml "${POLICY_HOME}"/etc/ +fi + +$JAVA_HOME/bin/java \ + -Dlogging.config="${POLICY_HOME}/etc/logback.xml" \ + -Dserver.ssl.keyStore="${KEYSTORE}" \ + -Dserver.ssl.keyStorePassword="${KEYSTORE_PASSWD}" \ + -Djavax.net.ssl.trustStore="${TRUSTSTORE}" \ + -Djavax.net.ssl.trustStorePassword="${TRUSTSTORE_PASSWD}" \ + -Dotel.java.global-autoconfigure.enabled=true \ + -jar /app/app.jar \ + --spring.config.location="${CONFIG_FILE}" diff --git a/helm/policy/components/policy-clamp-ac-a1pms-ppnt/templates/_helpers.tpl b/helm/policy/components/policy-clamp-ac-a1pms-ppnt/templates/_helpers.tpl new file mode 100644 index 00000000..8f05017b --- /dev/null +++ b/helm/policy/components/policy-clamp-ac-a1pms-ppnt/templates/_helpers.tpl @@ -0,0 +1,58 @@ +{{/* +# +# ============LICENSE_START======================================================= +# Copyright (C) 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========================================================= +# +*/}} + +{{/* +This helper defines which exporter port must be used depending on protocol +*/}} +{{- define "policy-clamp-ac-a1pms-ppnt.exporter-port" }} + {{- $jaegerExporterPort := .Values.jaeger.collector.portOtlpGrpc -}} + {{- if .Values.jaeger.collector.protocol -}} + {{- if eq .Values.jaeger.collector.protocol "http" -}} + {{- $jaegerExporterPort = .Values.jaeger.collector.portOtlpHttp -}} + {{- end -}} + {{- end -}} + {{- $jaegerExporterPort -}} +{{- end -}} + +{{/* +This helper defines whether Jaeger is enabled or not. +*/}} +{{- define "policy-clamp-ac-a1pms-ppnt.jaeger-enabled" }} + {{- $jaegerEnabled := "false" -}} + {{- if .Values.jaeger -}} + {{- if .Values.jaeger.enabled -}} + {{- $jaegerEnabled = .Values.jaeger.enabled -}} + {{- end -}} + {{- end -}} + {{- $jaegerEnabled -}} +{{- end -}} + +{{/* +This helper defines whether jaeger is using http or grpc protocol +*/}} +{{- define "policy-clamp-ac-a1pms-ppnt.jaeger-protocol" }} + {{- $protocol := "grpc" -}} + {{- if eq .Values.jaeger.collector.protocol "http" -}} + {{- $protocol = "http/protobuf" -}} + {{- end -}} + {{- $protocol -}} +{{- end -}}
\ No newline at end of file diff --git a/helm/policy/components/policy-clamp-ac-a1pms-ppnt/templates/configmap.yaml b/helm/policy/components/policy-clamp-ac-a1pms-ppnt/templates/configmap.yaml index 619906af..f8bd6c18 100755 --- a/helm/policy/components/policy-clamp-ac-a1pms-ppnt/templates/configmap.yaml +++ b/helm/policy/components/policy-clamp-ac-a1pms-ppnt/templates/configmap.yaml @@ -1,6 +1,6 @@ {{/* # ============LICENSE_START======================================================= -# Copyright (C) 2023 Nordix Foundation. All rights reserved. +# Copyright (C) 2023-2024 Nordix Foundation. 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. @@ -28,4 +28,4 @@ metadata: chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} heritage: Helm data: -{{ tpl (.Files.Glob "resources/config/*.{xml,yaml}").AsConfig . | indent 2 }}
\ No newline at end of file +{{ tpl (.Files.Glob "resources/config/*.{xml,yaml,sh}").AsConfig . | indent 2 }}
\ No newline at end of file diff --git a/helm/policy/components/policy-clamp-ac-a1pms-ppnt/templates/deployment.yaml b/helm/policy/components/policy-clamp-ac-a1pms-ppnt/templates/deployment.yaml index e68d6550..bec288f5 100755 --- a/helm/policy/components/policy-clamp-ac-a1pms-ppnt/templates/deployment.yaml +++ b/helm/policy/components/policy-clamp-ac-a1pms-ppnt/templates/deployment.yaml @@ -1,6 +1,6 @@ {{/* # ============LICENSE_START======================================================= -# Copyright (C) 2023 Nordix Foundation. +# 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. @@ -77,6 +77,18 @@ spec: imagePullPolicy: {{ .Values.global.pullPolicy }} command: ["/opt/app/policy/clamp/bin/a1pms-participant.sh"] args: ["/opt/app/policy/clamp/etc/mounted/A1pmsParticipantParameters.yaml"] + {{- $jaegerEnabled := tpl "policy-clamp-ac-a1pms-ppnt.jaeger-enabled" . | trimSuffix "\n" -}} + {{- if $jaegerEnabled }} + env: + - name: OTEL_SERVICE_NAME + value: {{ .Values.applicationName }} + - name: OTEL_EXPORTER_OTLP_PROTOCOL + value: {{ include "policy-clamp-ac-a1pms-ppnt.jaeger-protocol" . }} + - name: OTEL_EXPORTER_OTLP_TRACES_PROTOCOL + value: {{ include "policy-clamp-ac-a1pms-ppnt.jaeger-protocol" . }} + - name: OTEL_EXPORTER_OTLP_ENDPOINT + value: {{ printf "%s:%s" (.Values.jaeger.collector.host) (include "policy-clamp-ac-a1pms-ppnt.exporter-port" .) }} + {{- end }} ports: - containerPort: 8086 name: a1pms-api @@ -100,6 +112,9 @@ spec: readOnly: true - mountPath: /opt/app/policy/clamp/etc/mounted name: ac-a1pms-ppnt-config-processed + - mountPath: /opt/app/policy/clamp/bin/a1pms-participant.sh + name: ac-a1pms-ppnt-config + subPath: a1pms-participant.sh resources: {{ toYaml .Values.resources.small | indent 12 }} {{- if .Values.nodeSelector }} diff --git a/helm/policy/components/policy-clamp-ac-a1pms-ppnt/values.yaml b/helm/policy/components/policy-clamp-ac-a1pms-ppnt/values.yaml index b700dd0a..556fe6c0 100755 --- a/helm/policy/components/policy-clamp-ac-a1pms-ppnt/values.yaml +++ b/helm/policy/components/policy-clamp-ac-a1pms-ppnt/values.yaml @@ -78,3 +78,20 @@ serviceAccount: nameOverride: policy-clamp-ac-a1pms-ppnt roles: - create + +jaeger: + service: + name: jaeger + enabled: true + sampling: + probability: "1.0" + producer: + type: B3,W3C,B3_MULTI + collector: + protocol: grpc + host: "http://jaeger" + portOtlpGrpc: 4317 + portOtlpHttp: 4318 + portJaegerGrpc: 14250 + +applicationName: a1pms-ppnt diff --git a/helm/policy/components/policy-clamp-ac-http-ppnt/resources/config/HttpParticipantParameters.yaml b/helm/policy/components/policy-clamp-ac-http-ppnt/resources/config/HttpParticipantParameters.yaml index 9bb0d0e2..160144a3 100644 --- a/helm/policy/components/policy-clamp-ac-http-ppnt/resources/config/HttpParticipantParameters.yaml +++ b/helm/policy/components/policy-clamp-ac-http-ppnt/resources/config/HttpParticipantParameters.yaml @@ -17,6 +17,8 @@ # ============LICENSE_END========================================================= spring: + application: + name: {{ .Values.applicationName }} autoconfigure: exclude: > org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration, @@ -46,6 +48,7 @@ participant: topicCommInfrastructure: kafka fetchTimeout: 15000 useHttps: false + allowTracing: {{ include "policy-clamp-ac-http-ppnt.jaeger-enabled" . }} additionalProps: group.id: policy-clamp-ac-http-ppnt - topic: ${participant.intermediaryParameters.topics.syncTopic} @@ -54,18 +57,25 @@ participant: topicCommInfrastructure: kafka fetchTimeout: 15000 useHttps: false + allowTracing: {{ include "policy-clamp-ac-http-ppnt.jaeger-enabled" . }} topicSinks: - topic: ${participant.intermediaryParameters.topics.operationTopic} servers: - "{{ .Values.global.kafkaServer }}:9092" topicCommInfrastructure: kafka useHttps: false + allowTracing: {{ include "policy-clamp-ac-http-ppnt.jaeger-enabled" . }} participantSupportedElementTypes: - typeName: org.onap.policy.clamp.acm.HttpAutomationCompositionElement typeVersion: 1.0.0 management: + tracing: + propagation: + produce: [{{ .Values.jaeger.producer.type }}] + sampling: + probability: {{ .Values.jaeger.sampling.probability }} endpoints: web: base-path: / @@ -78,3 +88,12 @@ server: ssl: enabled: false + +tracing: + enabled: {{ .Values.jaeger.enabled }} + exporter: + endpoint: {{ .Values.jaeger.collector.host }}:{{ include "policy-clamp-ac-http-ppnt.exporter-port" . }} + protocol: {{ .Values.jaeger.collector.protocol }} + sampler: + jaeger-remote: + endpoint: {{ .Values.jaeger.collector.host }}:{{ .Values.jaeger.collector.portJaegerGrpc }}
\ No newline at end of file diff --git a/helm/policy/components/policy-clamp-ac-http-ppnt/resources/config/http-participant.sh b/helm/policy/components/policy-clamp-ac-http-ppnt/resources/config/http-participant.sh new file mode 100755 index 00000000..e35fb868 --- /dev/null +++ b/helm/policy/components/policy-clamp-ac-http-ppnt/resources/config/http-participant.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env sh +# +# ============LICENSE_START======================================================= +# Copyright (C) 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========================================================= +# + +KEYSTORE="${KEYSTORE:-$POLICY_HOME/etc/ssl/policy-keystore}" +TRUSTSTORE="${TRUSTSTORE:-$POLICY_HOME/etc/ssl/policy-truststore}" +KEYSTORE_PASSWD="${KEYSTORE_PASSWD:-Pol1cy_0nap}" +TRUSTSTORE_PASSWD="${TRUSTSTORE_PASSWD:-Pol1cy_0nap}" + +if [ "$#" -eq 1 ]; then + CONFIG_FILE=$1 +fi + +if [ -z "$CONFIG_FILE" ]; then + CONFIG_FILE="${POLICY_HOME}/etc/HttpParticipantParameters.yaml" +fi + +echo "Policy clamp HTTP participant config file: $CONFIG_FILE" + +if [ -f "${POLICY_HOME}/etc/mounted/policy-truststore" ]; then + echo "overriding policy-truststore" + cp -f "${POLICY_HOME}"/etc/mounted/policy-truststore "${TRUSTSTORE}" +fi + +if [ -f "${POLICY_HOME}/etc/mounted/policy-keystore" ]; then + echo "overriding policy-keystore" + cp -f "${POLICY_HOME}"/etc/mounted/policy-keystore "${KEYSTORE}" +fi + +if [ -f "${POLICY_HOME}/etc/mounted/logback.xml" ]; then + echo "overriding logback xml file" + cp -f "${POLICY_HOME}"/etc/mounted/logback.xml "${POLICY_HOME}"/etc/ +fi + +$JAVA_HOME/bin/java \ + -Dlogging.config="${POLICY_HOME}/etc/logback.xml" \ + -Dserver.ssl.keyStore="${KEYSTORE}" \ + -Dserver.ssl.keyStorePassword="${KEYSTORE_PASSWD}" \ + -Djavax.net.ssl.trustStore="${TRUSTSTORE}" \ + -Djavax.net.ssl.trustStorePassword="${TRUSTSTORE_PASSWD}" \ + -Dotel.java.global-autoconfigure.enabled=true \ + -jar /app/app.jar \ + --spring.config.location="${CONFIG_FILE}" diff --git a/helm/policy/components/policy-clamp-ac-http-ppnt/templates/_helpers.tpl b/helm/policy/components/policy-clamp-ac-http-ppnt/templates/_helpers.tpl new file mode 100644 index 00000000..7aed996d --- /dev/null +++ b/helm/policy/components/policy-clamp-ac-http-ppnt/templates/_helpers.tpl @@ -0,0 +1,58 @@ +{{/* +# +# ============LICENSE_START======================================================= +# Copyright (C) 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========================================================= +# +*/}} + +{{/* +This helper defines which exporter port must be used depending on protocol +*/}} +{{- define "policy-clamp-ac-http-ppnt.exporter-port" }} + {{- $jaegerExporterPort := .Values.jaeger.collector.portOtlpGrpc -}} + {{- if .Values.jaeger.collector.protocol -}} + {{- if eq .Values.jaeger.collector.protocol "http" -}} + {{- $jaegerExporterPort = .Values.jaeger.collector.portOtlpHttp -}} + {{- end -}} + {{- end -}} + {{- $jaegerExporterPort -}} +{{- end -}} + +{{/* +This helper defines whether Jaeger is enabled or not. +*/}} +{{- define "policy-clamp-ac-http-ppnt.jaeger-enabled" }} + {{- $jaegerEnabled := "false" -}} + {{- if .Values.jaeger -}} + {{- if .Values.jaeger.enabled -}} + {{- $jaegerEnabled = .Values.jaeger.enabled -}} + {{- end -}} + {{- end -}} + {{- $jaegerEnabled -}} +{{- end -}} + +{{/* +This helper defines whether jaeger is using http or grpc protocol +*/}} +{{- define "policy-clamp-ac-http-ppnt.jaeger-protocol" }} + {{- $protocol := "grpc" -}} + {{- if eq .Values.jaeger.collector.protocol "http" -}} + {{- $protocol = "http/protobuf" -}} + {{- end -}} + {{- $protocol -}} +{{- end -}}
\ No newline at end of file diff --git a/helm/policy/components/policy-clamp-ac-http-ppnt/templates/configmap.yaml b/helm/policy/components/policy-clamp-ac-http-ppnt/templates/configmap.yaml index 0b755aaf..380833ca 100644 --- a/helm/policy/components/policy-clamp-ac-http-ppnt/templates/configmap.yaml +++ b/helm/policy/components/policy-clamp-ac-http-ppnt/templates/configmap.yaml @@ -1,6 +1,6 @@ {{/* # ============LICENSE_START======================================================= -# Copyright (C) 2023 Nordix Foundation. All rights reserved. +# Copyright (C) 2023-2024 Nordix Foundation. 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. @@ -29,4 +29,4 @@ metadata: release: release heritage: Helm data: -{{ tpl (.Files.Glob "resources/config/*.{xml,yaml}").AsConfig . | indent 2 }} +{{ tpl (.Files.Glob "resources/config/*.{xml,yaml,sh}").AsConfig . | indent 2 }} diff --git a/helm/policy/components/policy-clamp-ac-http-ppnt/templates/deployment.yaml b/helm/policy/components/policy-clamp-ac-http-ppnt/templates/deployment.yaml index ecdaa030..1cb3e9e3 100644 --- a/helm/policy/components/policy-clamp-ac-http-ppnt/templates/deployment.yaml +++ b/helm/policy/components/policy-clamp-ac-http-ppnt/templates/deployment.yaml @@ -1,6 +1,6 @@ {{/* # ============LICENSE_START======================================================= -# Copyright (C) 2023 Nordix Foundation. +# 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. @@ -75,6 +75,18 @@ spec: imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} command: ["/opt/app/policy/clamp/bin/http-participant.sh"] args: ["/opt/app/policy/clamp/etc/mounted/HttpParticipantParameters.yaml"] + {{- $jaegerEnabled := tpl "policy-clamp-ac-http-ppnt.jaeger-enabled" . | trimSuffix "\n" -}} + {{- if $jaegerEnabled }} + env: + - name: OTEL_SERVICE_NAME + value: {{ .Values.applicationName }} + - name: OTEL_EXPORTER_OTLP_PROTOCOL + value: {{ include "policy-clamp-ac-http-ppnt.jaeger-protocol" . }} + - name: OTEL_EXPORTER_OTLP_TRACES_PROTOCOL + value: {{ include "policy-clamp-ac-http-ppnt.jaeger-protocol" . }} + - name: OTEL_EXPORTER_OTLP_ENDPOINT + value: {{ printf "%s:%s" (.Values.jaeger.collector.host) (include "policy-clamp-ac-http-ppnt.exporter-port" .) }} + {{- end }} ports: - containerPort: 8084 name: http-api @@ -98,6 +110,9 @@ spec: readOnly: true - mountPath: /opt/app/policy/clamp/etc/mounted name: ac-http-ppnt-config-processed + - mountPath: /opt/app/policy/clamp/bin/http-participant.sh + name: ac-http-ppnt-config + subPath: http-participant.sh resources: {{ toYaml .Values.resources.small | indent 12 }} {{- if .Values.nodeSelector }} diff --git a/helm/policy/components/policy-clamp-ac-http-ppnt/values.yaml b/helm/policy/components/policy-clamp-ac-http-ppnt/values.yaml index a4f05ea7..82686b55 100644 --- a/helm/policy/components/policy-clamp-ac-http-ppnt/values.yaml +++ b/helm/policy/components/policy-clamp-ac-http-ppnt/values.yaml @@ -88,3 +88,20 @@ serviceAccount: roles: - read + +jaeger: + service: + name: jaeger + enabled: true + sampling: + probability: "1.0" + producer: + type: B3,W3C,B3_MULTI + collector: + protocol: grpc + host: "http://jaeger" + portOtlpGrpc: 4317 + portOtlpHttp: 4318 + portJaegerGrpc: 14250 + +applicationName: http-ppnt
\ No newline at end of file diff --git a/helm/policy/components/policy-clamp-ac-k8s-ppnt/resources/config/KubernetesParticipantParameters.yaml b/helm/policy/components/policy-clamp-ac-k8s-ppnt/resources/config/KubernetesParticipantParameters.yaml index bd526540..4eedc0da 100644 --- a/helm/policy/components/policy-clamp-ac-k8s-ppnt/resources/config/KubernetesParticipantParameters.yaml +++ b/helm/policy/components/policy-clamp-ac-k8s-ppnt/resources/config/KubernetesParticipantParameters.yaml @@ -17,6 +17,8 @@ # ============LICENSE_END========================================================= spring: + application: + name: k8s-ppnt autoconfigure: exclude: > org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration, @@ -49,6 +51,7 @@ participant: topicCommInfrastructure: kafka fetchTimeout: 15000 useHttps: false + allowTracing: {{ include "policy-clamp-ac-k8s-ppnt.jaeger-enabled" . }} additionalProps: group.id: policy-clamp-ac-k8s-ppnt - @@ -58,6 +61,7 @@ participant: topicCommInfrastructure: kafka fetchTimeout: 15000 useHttps: false + allowTracing: {{ include "policy-clamp-ac-k8s-ppnt.jaeger-enabled" . }} topicSinks: - topic: ${participant.intermediaryParameters.topics.operationTopic} @@ -65,12 +69,18 @@ participant: - "{{ .Values.global.kafkaServer }}:9092" topicCommInfrastructure: kafka useHttps: false + allowTracing: {{ include "policy-clamp-ac-k8s-ppnt.jaeger-enabled" . }} participantSupportedElementTypes: - typeName: org.onap.policy.clamp.acm.K8SMicroserviceAutomationCompositionElement typeVersion: 1.0.0 management: + tracing: + propagation: + produce: [{{ .Values.jaeger.producer.type }}] + sampling: + probability: {{ .Values.jaeger.sampling.probability }} endpoints: web: base-path: / @@ -104,3 +114,13 @@ chart: enabled: false # Permitted list of helm repositories. Values are updated from values.yaml + + +tracing: + enabled: {{ .Values.jaeger.enabled }} + exporter: + endpoint: {{ .Values.jaeger.collector.host }}:{{ include "policy-clamp-ac-k8s-ppnt.exporter-port" . }} + protocol: {{ .Values.jaeger.collector.protocol }} + sampler: + jaeger-remote: + endpoint: {{ .Values.jaeger.collector.host }}:{{ .Values.jaeger.collector.portJaegerGrpc }}
\ No newline at end of file diff --git a/helm/policy/components/policy-clamp-ac-k8s-ppnt/resources/config/kubernetes-participant.sh b/helm/policy/components/policy-clamp-ac-k8s-ppnt/resources/config/kubernetes-participant.sh new file mode 100755 index 00000000..ce08684d --- /dev/null +++ b/helm/policy/components/policy-clamp-ac-k8s-ppnt/resources/config/kubernetes-participant.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env sh +# +# ============LICENSE_START======================================================= +# Copyright (C) 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========================================================= +# + +KEYSTORE="${KEYSTORE:-$POLICY_HOME/etc/ssl/policy-keystore}" +TRUSTSTORE="${TRUSTSTORE:-$POLICY_HOME/etc/ssl/policy-truststore}" +KEYSTORE_PASSWD="${KEYSTORE_PASSWD:-Pol1cy_0nap}" +TRUSTSTORE_PASSWD="${TRUSTSTORE_PASSWD:-Pol1cy_0nap}" + +if [ "$#" -eq 1 ]; then + CONFIG_FILE=$1 +fi + +if [ -z "$CONFIG_FILE" ]; then + CONFIG_FILE="${POLICY_HOME}/etc/KubernetesParticipantParameters.yaml" +fi + +echo "Policy clamp Kubernetes participant config file: $CONFIG_FILE" + +if [ -f "${POLICY_HOME}/etc/mounted/policy-truststore" ]; then + echo "overriding policy-truststore" + cp -f "${POLICY_HOME}"/etc/mounted/policy-truststore "${TRUSTSTORE}" +fi + +if [ -f "${POLICY_HOME}/etc/mounted/policy-keystore" ]; then + echo "overriding policy-keystore" + cp -f "${POLICY_HOME}"/etc/mounted/policy-keystore "${KEYSTORE}" +fi + +if [ -f "${POLICY_HOME}/etc/mounted/logback.xml" ]; then + echo "overriding logback xml file" + cp -f "${POLICY_HOME}"/etc/mounted/logback.xml "${POLICY_HOME}"/etc/ +fi + +$JAVA_HOME/bin/java \ + -Dlogging.config="${POLICY_HOME}/etc/logback.xml" \ + -Dserver.ssl.keyStore="${KEYSTORE}" \ + -Dserver.ssl.keyStorePassword="${KEYSTORE_PASSWD}" \ + -Djavax.net.ssl.trustStore="${TRUSTSTORE}" \ + -Djavax.net.ssl.trustStorePassword="${TRUSTSTORE_PASSWD}" \ + -Dotel.java.global-autoconfigure.enabled=true \ + -jar /app/app.jar \ + --spring.config.location="${CONFIG_FILE}" diff --git a/helm/policy/components/policy-clamp-ac-k8s-ppnt/templates/_helpers.tpl b/helm/policy/components/policy-clamp-ac-k8s-ppnt/templates/_helpers.tpl new file mode 100644 index 00000000..83b494f6 --- /dev/null +++ b/helm/policy/components/policy-clamp-ac-k8s-ppnt/templates/_helpers.tpl @@ -0,0 +1,58 @@ +{{/* +# +# ============LICENSE_START======================================================= +# Copyright (C) 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========================================================= +# +*/}} + +{{/* +This helper defines which exporter port must be used depending on protocol +*/}} +{{- define "policy-clamp-ac-k8s-ppnt.exporter-port" }} + {{- $jaegerExporterPort := .Values.jaeger.collector.portOtlpGrpc -}} + {{- if .Values.jaeger.collector.protocol -}} + {{- if eq .Values.jaeger.collector.protocol "http" -}} + {{- $jaegerExporterPort = .Values.jaeger.collector.portOtlpHttp -}} + {{- end -}} + {{- end -}} + {{- $jaegerExporterPort -}} +{{- end -}} + +{{/* +This helper defines whether Jaeger is enabled or not. +*/}} +{{- define "policy-clamp-ac-k8s-ppnt.jaeger-enabled" }} + {{- $jaegerEnabled := "false" -}} + {{- if .Values.jaeger -}} + {{- if .Values.jaeger.enabled -}} + {{- $jaegerEnabled = .Values.jaeger.enabled -}} + {{- end -}} + {{- end -}} + {{- $jaegerEnabled -}} +{{- end -}} + +{{/* +This helper defines whether jaeger is using http or grpc protocol +*/}} +{{- define "policy-clamp-ac-k8s-ppnt.jaeger-protocol" }} + {{- $protocol := "grpc" -}} + {{- if eq .Values.jaeger.collector.protocol "http" -}} + {{- $protocol = "http/protobuf" -}} + {{- end -}} + {{- $protocol -}} +{{- end -}}
\ No newline at end of file diff --git a/helm/policy/components/policy-clamp-ac-k8s-ppnt/templates/deployment.yaml b/helm/policy/components/policy-clamp-ac-k8s-ppnt/templates/deployment.yaml index fa90535f..e0f7a52e 100644 --- a/helm/policy/components/policy-clamp-ac-k8s-ppnt/templates/deployment.yaml +++ b/helm/policy/components/policy-clamp-ac-k8s-ppnt/templates/deployment.yaml @@ -1,6 +1,6 @@ {{/* # ============LICENSE_START======================================================= -# Copyright (C) 2022 Nordix Foundation. +# Copyright (C) 2022-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. @@ -78,6 +78,18 @@ spec: imagePullPolicy: {{ .Values.global.pullPolicy }} command: ["/opt/app/policy/clamp/bin/kubernetes-participant.sh"] args: ["/opt/app/policy/clamp/etc/mounted/KubernetesParticipantParameters.yaml"] + {{- $jaegerEnabled := tpl "policy-clamp-ac-k8s-ppnt.jaeger-enabled" . | trimSuffix "\n" -}} + {{- if $jaegerEnabled }} + env: + - name: OTEL_SERVICE_NAME + value: {{ .Values.applicationName }} + - name: OTEL_EXPORTER_OTLP_PROTOCOL + value: {{ include "policy-clamp-ac-k8s-ppnt.jaeger-protocol" . }} + - name: OTEL_EXPORTER_OTLP_TRACES_PROTOCOL + value: {{ include "policy-clamp-ac-k8s-ppnt.jaeger-protocol" . }} + - name: OTEL_EXPORTER_OTLP_ENDPOINT + value: {{ printf "%s:%s" (.Values.jaeger.collector.host) (include "policy-clamp-ac-k8s-ppnt.exporter-port" .) }} + {{- end }} ports: - containerPort: 8083 name: http-api @@ -101,6 +113,9 @@ spec: readOnly: true - mountPath: /opt/app/policy/clamp/etc/mounted name: ac-k8s-ppnt-config-processed + - mountPath: /opt/app/policy/clamp/bin/kubernetes-participant.sh + name: ac-k8s-ppnt-config + subPath: kubernetes-participant.sh resources: {{ toYaml .Values.resources.small | indent 12 }} {{- if .Values.nodeSelector }} diff --git a/helm/policy/components/policy-clamp-ac-k8s-ppnt/values.yaml b/helm/policy/components/policy-clamp-ac-k8s-ppnt/values.yaml index 934b1bb5..dfbda305 100644 --- a/helm/policy/components/policy-clamp-ac-k8s-ppnt/values.yaml +++ b/helm/policy/components/policy-clamp-ac-k8s-ppnt/values.yaml @@ -98,3 +98,20 @@ repoList: protocols: - http - https + +jaeger: + service: + name: jaeger + enabled: true + sampling: + probability: "1.0" + producer: + type: B3,W3C,B3_MULTI + collector: + protocol: grpc + host: "http://jaeger" + portOtlpGrpc: 4317 + portOtlpHttp: 4318 + portJaegerGrpc: 14250 + +applicationName: k8s-ppnt
\ No newline at end of file diff --git a/helm/policy/components/policy-clamp-ac-kserve-ppnt/resources/config/KserveParticipantParameters.yaml b/helm/policy/components/policy-clamp-ac-kserve-ppnt/resources/config/KserveParticipantParameters.yaml index 6e854c9a..3b71737f 100755 --- a/helm/policy/components/policy-clamp-ac-kserve-ppnt/resources/config/KserveParticipantParameters.yaml +++ b/helm/policy/components/policy-clamp-ac-kserve-ppnt/resources/config/KserveParticipantParameters.yaml @@ -16,6 +16,8 @@ # ============LICENSE_END========================================================= spring: + application: + name: kserve-ppnt cloud: kubernetes: enabled: false @@ -52,18 +54,21 @@ participant: - "{{ .Values.global.kafkaServer }}:9092" topicCommInfrastructure: kafka fetchTimeout: 15000 + allowTracing: {{ include "policy-clamp-ac-kserve-ppnt.jaeger-enabled" . }} additionalProps: group.id: policy-clamp-ac-kserve-ppnt - topic: ${participant.intermediaryParameters.topics.syncTopic} servers: - "{{ .Values.global.kafkaServer }}:9092" topicCommInfrastructure: kafka + allowTracing: {{ include "policy-clamp-ac-kserve-ppnt.jaeger-enabled" . }} fetchTimeout: 15000 topicSinks: - topic: ${participant.intermediaryParameters.topics.operationTopic} servers: - "{{ .Values.global.kafkaServer }}:9092" topicCommInfrastructure: kafka + allowTracing: {{ include "policy-clamp-ac-kserve-ppnt.jaeger-enabled" . }} participantSupportedElementTypes: - typeName: org.onap.policy.clamp.acm.KserveAutomationCompositionElement @@ -76,6 +81,11 @@ customresourcedefinition: grace-period: 10 management: + tracing: + propagation: + produce: [{{ .Values.jaeger.producer.type }}] + sampling: + probability: {{ .Values.jaeger.sampling.probability }} endpoints: web: base-path: / @@ -89,3 +99,11 @@ server: enabled: false +tracing: + enabled: {{ .Values.jaeger.enabled }} + exporter: + endpoint: {{ .Values.jaeger.collector.host }}:{{ include "policy-clamp-ac-kserve-ppnt.exporter-port" . }} + protocol: {{ .Values.jaeger.collector.protocol }} + sampler: + jaeger-remote: + endpoint: {{ .Values.jaeger.collector.host }}:{{ .Values.jaeger.collector.portJaegerGrpc }} diff --git a/helm/policy/components/policy-clamp-ac-kserve-ppnt/resources/config/kserve-participant.sh b/helm/policy/components/policy-clamp-ac-kserve-ppnt/resources/config/kserve-participant.sh new file mode 100644 index 00000000..7da0b0f6 --- /dev/null +++ b/helm/policy/components/policy-clamp-ac-kserve-ppnt/resources/config/kserve-participant.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env sh +# +# ============LICENSE_START======================================================= +# Copyright (C) 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========================================================= +# + +KEYSTORE="${KEYSTORE:-$POLICY_HOME/etc/ssl/policy-keystore}" +TRUSTSTORE="${TRUSTSTORE:-$POLICY_HOME/etc/ssl/policy-truststore}" +KEYSTORE_PASSWD="${KEYSTORE_PASSWD:-Pol1cy_0nap}" +TRUSTSTORE_PASSWD="${TRUSTSTORE_PASSWD:-Pol1cy_0nap}" + +if [ "$#" -eq 1 ]; then + CONFIG_FILE=$1 +fi + +if [ -z "$CONFIG_FILE" ]; then + CONFIG_FILE="${POLICY_HOME}/etc/KserveParticipantParameters.yaml" +fi + +echo "Policy clamp Kserve participant config file: $CONFIG_FILE" + +if [ -f "${POLICY_HOME}/etc/mounted/policy-truststore" ]; then + echo "overriding policy-truststore" + cp -f "${POLICY_HOME}"/etc/mounted/policy-truststore "${TRUSTSTORE}" +fi + +if [ -f "${POLICY_HOME}/etc/mounted/policy-keystore" ]; then + echo "overriding policy-keystore" + cp -f "${POLICY_HOME}"/etc/mounted/policy-keystore "${KEYSTORE}" +fi + +if [ -f "${POLICY_HOME}/etc/mounted/logback.xml" ]; then + echo "overriding logback xml file" + cp -f "${POLICY_HOME}"/etc/mounted/logback.xml "${POLICY_HOME}"/etc/ +fi + +$JAVA_HOME/bin/java \ + -Dlogging.config="${POLICY_HOME}/etc/logback.xml" \ + -Dserver.ssl.keyStore="${KEYSTORE}" \ + -Dserver.ssl.keyStorePassword="${KEYSTORE_PASSWD}" \ + -Djavax.net.ssl.trustStore="${TRUSTSTORE}" \ + -Djavax.net.ssl.trustStorePassword="${TRUSTSTORE_PASSWD}" \ + -Dotel.java.global-autoconfigure.enabled=true \ + -jar /app/app.jar \ + --spring.config.location="${CONFIG_FILE}" diff --git a/helm/policy/components/policy-clamp-ac-kserve-ppnt/templates/_helpers.tpl b/helm/policy/components/policy-clamp-ac-kserve-ppnt/templates/_helpers.tpl new file mode 100644 index 00000000..a2882871 --- /dev/null +++ b/helm/policy/components/policy-clamp-ac-kserve-ppnt/templates/_helpers.tpl @@ -0,0 +1,58 @@ +{{/* +# +# ============LICENSE_START======================================================= +# Copyright (C) 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========================================================= +# +*/}} + +{{/* +This helper defines which exporter port must be used depending on protocol +*/}} +{{- define "policy-clamp-ac-kserve-ppnt.exporter-port" }} + {{- $jaegerExporterPort := .Values.jaeger.collector.portOtlpGrpc -}} + {{- if .Values.jaeger.collector.protocol -}} + {{- if eq .Values.jaeger.collector.protocol "http" -}} + {{- $jaegerExporterPort = .Values.jaeger.collector.portOtlpHttp -}} + {{- end -}} + {{- end -}} + {{- $jaegerExporterPort -}} +{{- end -}} + +{{/* +This helper defines whether Jaeger is enabled or not. +*/}} +{{- define "policy-clamp-ac-kserve-ppnt.jaeger-enabled" }} + {{- $jaegerEnabled := "false" -}} + {{- if .Values.jaeger -}} + {{- if .Values.jaeger.enabled -}} + {{- $jaegerEnabled = .Values.jaeger.enabled -}} + {{- end -}} + {{- end -}} + {{- $jaegerEnabled -}} +{{- end -}} + +{{/* +This helper defines whether jaeger is using http or grpc protocol +*/}} +{{- define "policy-clamp-ac-kserve-ppnt.jaeger-protocol" }} + {{- $protocol := "grpc" -}} + {{- if eq .Values.jaeger.collector.protocol "http" -}} + {{- $protocol = "http/protobuf" -}} + {{- end -}} + {{- $protocol -}} +{{- end -}}
\ No newline at end of file diff --git a/helm/policy/components/policy-clamp-ac-kserve-ppnt/templates/configmap.yaml b/helm/policy/components/policy-clamp-ac-kserve-ppnt/templates/configmap.yaml index 619906af..f8bd6c18 100755 --- a/helm/policy/components/policy-clamp-ac-kserve-ppnt/templates/configmap.yaml +++ b/helm/policy/components/policy-clamp-ac-kserve-ppnt/templates/configmap.yaml @@ -1,6 +1,6 @@ {{/* # ============LICENSE_START======================================================= -# Copyright (C) 2023 Nordix Foundation. All rights reserved. +# Copyright (C) 2023-2024 Nordix Foundation. 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. @@ -28,4 +28,4 @@ metadata: chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} heritage: Helm data: -{{ tpl (.Files.Glob "resources/config/*.{xml,yaml}").AsConfig . | indent 2 }}
\ No newline at end of file +{{ tpl (.Files.Glob "resources/config/*.{xml,yaml,sh}").AsConfig . | indent 2 }}
\ No newline at end of file diff --git a/helm/policy/components/policy-clamp-ac-kserve-ppnt/templates/deployment.yaml b/helm/policy/components/policy-clamp-ac-kserve-ppnt/templates/deployment.yaml index 60d50322..f8f53287 100755 --- a/helm/policy/components/policy-clamp-ac-kserve-ppnt/templates/deployment.yaml +++ b/helm/policy/components/policy-clamp-ac-kserve-ppnt/templates/deployment.yaml @@ -1,6 +1,6 @@ {{/* # ============LICENSE_START======================================================= -# Copyright (C) 2023 Nordix Foundation. +# 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. @@ -77,6 +77,18 @@ spec: imagePullPolicy: {{ .Values.global.pullPolicy }} command: ["/opt/app/policy/clamp/bin/kserve-participant.sh"] args: ["/opt/app/policy/clamp/etc/mounted/KserveParticipantParameters.yaml"] + {{- $jaegerEnabled := tpl "policy-clamp-ac-kserve-ppnt.jaeger-enabled" . | trimSuffix "\n" -}} + {{- if $jaegerEnabled }} + env: + - name: OTEL_SERVICE_NAME + value: {{ .Values.applicationName }} + - name: OTEL_EXPORTER_OTLP_PROTOCOL + value: {{ include "policy-clamp-ac-kserve-ppnt.jaeger-protocol" . }} + - name: OTEL_EXPORTER_OTLP_TRACES_PROTOCOL + value: {{ include "policy-clamp-ac-kserve-ppnt.jaeger-protocol" . }} + - name: OTEL_EXPORTER_OTLP_ENDPOINT + value: {{ printf "%s:%s" (.Values.jaeger.collector.host) (include "policy-clamp-ac-kserve-ppnt.exporter-port" .) }} + {{- end }} ports: - containerPort: 8087 name: kserve-api @@ -100,6 +112,9 @@ spec: readOnly: true - mountPath: /opt/app/policy/clamp/etc/mounted name: ac-kserve-ppnt-config-processed + - mountPath: /opt/app/policy/clamp/bin/kserve-participant.sh + name: ac-kserve-ppnt-config + subPath: kserve-participant.sh resources: {{ toYaml .Values.resources.small | indent 12 }} {{- if .Values.nodeSelector }} diff --git a/helm/policy/components/policy-clamp-ac-kserve-ppnt/values.yaml b/helm/policy/components/policy-clamp-ac-kserve-ppnt/values.yaml index 444c5bf2..0f354edf 100755 --- a/helm/policy/components/policy-clamp-ac-kserve-ppnt/values.yaml +++ b/helm/policy/components/policy-clamp-ac-kserve-ppnt/values.yaml @@ -78,3 +78,20 @@ serviceAccount: nameOverride: policy-clamp-ac-kserve-ppnt roles: - create + +jaeger: + service: + name: jaeger + enabled: true + sampling: + probability: "1.0" + producer: + type: B3,W3C,B3_MULTI + collector: + protocol: grpc + host: "http://jaeger" + portOtlpGrpc: 4317 + portOtlpHttp: 4318 + portJaegerGrpc: 14250 + +applicationName: kserve-ppnt
\ No newline at end of file diff --git a/helm/policy/components/policy-clamp-ac-pf-ppnt/resources/config/PolicyParticipantParameters.yaml b/helm/policy/components/policy-clamp-ac-pf-ppnt/resources/config/PolicyParticipantParameters.yaml index f7308e61..5753fe83 100644 --- a/helm/policy/components/policy-clamp-ac-pf-ppnt/resources/config/PolicyParticipantParameters.yaml +++ b/helm/policy/components/policy-clamp-ac-pf-ppnt/resources/config/PolicyParticipantParameters.yaml @@ -17,6 +17,8 @@ # ============LICENSE_END========================================================= spring: + application: + name: pf-ppnt autoconfigure: exclude: > org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration, @@ -65,6 +67,7 @@ participant: topicCommInfrastructure: kafka fetchTimeout: 15000 useHttps: false + allowTracing: {{ include "policy-clamp-ac-pf-ppnt.jaeger-enabled" . }} additionalProps: group.id: policy-clamp-ac-pf-ppnt - @@ -74,6 +77,7 @@ participant: topicCommInfrastructure: kafka fetchTimeout: 15000 useHttps: false + allowTracing: {{ include "policy-clamp-ac-pf-ppnt.jaeger-enabled" . }} topicSinks: - topic: ${participant.intermediaryParameters.topics.operationTopic} @@ -81,12 +85,18 @@ participant: - "{{ .Values.global.kafkaServer }}:9092" topicCommInfrastructure: kafka useHttps: false + allowTracing: {{ include "policy-clamp-ac-pf-ppnt.jaeger-enabled" . }} participantSupportedElementTypes: - typeName: org.onap.policy.clamp.acm.PolicyAutomationCompositionElement typeVersion: 1.0.0 management: + tracing: + propagation: + produce: [{{ .Values.jaeger.producer.type }}] + sampling: + probability: {{ .Values.jaeger.sampling.probability }} endpoints: web: base-path: / @@ -99,3 +109,12 @@ server: context-path: /onap/policyparticipant ssl: enabled: false + +tracing: + enabled: {{ .Values.jaeger.enabled }} + exporter: + endpoint: {{ .Values.jaeger.collector.host }}:{{ include "policy-clamp-ac-pf-ppnt.exporter-port" . }} + protocol: {{ .Values.jaeger.collector.protocol }} + sampler: + jaeger-remote: + endpoint: {{ .Values.jaeger.collector.host }}:{{ .Values.jaeger.collector.portJaegerGrpc }}
\ No newline at end of file diff --git a/helm/policy/components/policy-clamp-ac-pf-ppnt/resources/config/policy-participant.sh b/helm/policy/components/policy-clamp-ac-pf-ppnt/resources/config/policy-participant.sh new file mode 100755 index 00000000..f36c2b37 --- /dev/null +++ b/helm/policy/components/policy-clamp-ac-pf-ppnt/resources/config/policy-participant.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env sh +# +# ============LICENSE_START======================================================= +# Copyright (C) 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========================================================= +# + +KEYSTORE="${KEYSTORE:-$POLICY_HOME/etc/ssl/policy-keystore}" +TRUSTSTORE="${TRUSTSTORE:-$POLICY_HOME/etc/ssl/policy-truststore}" +KEYSTORE_PASSWD="${KEYSTORE_PASSWD:-Pol1cy_0nap}" +TRUSTSTORE_PASSWD="${TRUSTSTORE_PASSWD:-Pol1cy_0nap}" + +if [ "$#" -eq 1 ]; then + CONFIG_FILE=$1 +fi + +if [ -z "$CONFIG_FILE" ]; then + CONFIG_FILE="${POLICY_HOME}/etc/PolicyParticipantParameters.yaml" +fi + +echo "Policy clamp policy participant config file: $CONFIG_FILE" + +if [ -f "${POLICY_HOME}/etc/mounted/policy-truststore" ]; then + echo "overriding policy-truststore" + cp -f "${POLICY_HOME}"/etc/mounted/policy-truststore "${TRUSTSTORE}" +fi + +if [ -f "${POLICY_HOME}/etc/mounted/policy-keystore" ]; then + echo "overriding policy-keystore" + cp -f "${POLICY_HOME}"/etc/mounted/policy-keystore "${KEYSTORE}" +fi + +if [ -f "${POLICY_HOME}/etc/mounted/logback.xml" ]; then + echo "overriding logback xml file" + cp -f "${POLICY_HOME}"/etc/mounted/logback.xml "${POLICY_HOME}"/etc/ +fi + +$JAVA_HOME/bin/java \ + -Dlogging.config="${POLICY_HOME}/etc/logback.xml" \ + -Dserver.ssl.keyStore="${KEYSTORE}" \ + -Dserver.ssl.keyStorePassword="${KEYSTORE_PASSWD}" \ + -Djavax.net.ssl.trustStore="${TRUSTSTORE}" \ + -Djavax.net.ssl.trustStorePassword="${TRUSTSTORE_PASSWD}" \ + -Dotel.java.global-autoconfigure.enabled=true \ + -jar /app/app.jar \ + --spring.config.location="${CONFIG_FILE}" diff --git a/helm/policy/components/policy-clamp-ac-pf-ppnt/templates/_helpers.tpl b/helm/policy/components/policy-clamp-ac-pf-ppnt/templates/_helpers.tpl new file mode 100644 index 00000000..a5f3a1f1 --- /dev/null +++ b/helm/policy/components/policy-clamp-ac-pf-ppnt/templates/_helpers.tpl @@ -0,0 +1,58 @@ +{{/* +# +# ============LICENSE_START======================================================= +# Copyright (C) 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========================================================= +# +*/}} + +{{/* +This helper defines which exporter port must be used depending on protocol +*/}} +{{- define "policy-clamp-ac-pf-ppnt.exporter-port" }} + {{- $jaegerExporterPort := .Values.jaeger.collector.portOtlpGrpc -}} + {{- if .Values.jaeger.collector.protocol -}} + {{- if eq .Values.jaeger.collector.protocol "http" -}} + {{- $jaegerExporterPort = .Values.jaeger.collector.portOtlpHttp -}} + {{- end -}} + {{- end -}} + {{- $jaegerExporterPort -}} +{{- end -}} + +{{/* +This helper defines whether Jaeger is enabled or not. +*/}} +{{- define "policy-clamp-ac-pf-ppnt.jaeger-enabled" }} + {{- $jaegerEnabled := "false" -}} + {{- if .Values.jaeger -}} + {{- if .Values.jaeger.enabled -}} + {{- $jaegerEnabled = .Values.jaeger.enabled -}} + {{- end -}} + {{- end -}} + {{- $jaegerEnabled -}} +{{- end -}} + +{{/* +This helper defines whether jaeger is using http or grpc protocol +*/}} +{{- define "policy-clamp-ac-pf-ppnt.jaeger-protocol" }} + {{- $protocol := "grpc" -}} + {{- if eq .Values.jaeger.collector.protocol "http" -}} + {{- $protocol = "http/protobuf" -}} + {{- end -}} + {{- $protocol -}} +{{- end -}}
\ No newline at end of file diff --git a/helm/policy/components/policy-clamp-ac-pf-ppnt/templates/configmap.yaml b/helm/policy/components/policy-clamp-ac-pf-ppnt/templates/configmap.yaml index 1319768a..2faeffcc 100644 --- a/helm/policy/components/policy-clamp-ac-pf-ppnt/templates/configmap.yaml +++ b/helm/policy/components/policy-clamp-ac-pf-ppnt/templates/configmap.yaml @@ -1,6 +1,6 @@ {{/* # ============LICENSE_START======================================================= -# Copyright (C) 2023 Nordix Foundation. All rights reserved. +# Copyright (C) 2023-2024 Nordix Foundation. 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. @@ -29,4 +29,4 @@ metadata: release: RELEASE heritage: Helm data: -{{ tpl (.Files.Glob "resources/config/*.{xml,yaml}").AsConfig . | indent 2 }} +{{ tpl (.Files.Glob "resources/config/*.{xml,yaml,sh}").AsConfig . | indent 2 }} diff --git a/helm/policy/components/policy-clamp-ac-pf-ppnt/templates/deployment.yaml b/helm/policy/components/policy-clamp-ac-pf-ppnt/templates/deployment.yaml index bcb3dae5..7e921cbd 100644 --- a/helm/policy/components/policy-clamp-ac-pf-ppnt/templates/deployment.yaml +++ b/helm/policy/components/policy-clamp-ac-pf-ppnt/templates/deployment.yaml @@ -1,6 +1,6 @@ {{/* # ============LICENSE_START======================================================= -# Copyright (C) 2023 Nordix Foundation. +# 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. @@ -95,6 +95,18 @@ spec: imagePullPolicy: {{ .Values.global.pullPolicy }} command: ["/opt/app/policy/clamp/bin/policy-participant.sh"] args: ["/opt/app/policy/clamp/etc/mounted/PolicyParticipantParameters.yaml"] + {{- $jaegerEnabled := tpl "policy-clamp-ac-pf-ppnt.jaeger-enabled" . | trimSuffix "\n" -}} + {{- if $jaegerEnabled }} + env: + - name: OTEL_SERVICE_NAME + value: {{ .Values.applicationName }} + - name: OTEL_EXPORTER_OTLP_PROTOCOL + value: {{ include "policy-clamp-ac-pf-ppnt.jaeger-protocol" . }} + - name: OTEL_EXPORTER_OTLP_TRACES_PROTOCOL + value: {{ include "policy-clamp-ac-pf-ppnt.jaeger-protocol" . }} + - name: OTEL_EXPORTER_OTLP_ENDPOINT + value: {{ printf "%s:%s" (.Values.jaeger.collector.host) (include "policy-clamp-ac-pf-ppnt.exporter-port" .) }} + {{- end }} ports: - containerPort: 6969 name: http-api @@ -118,6 +130,9 @@ spec: readOnly: true - mountPath: /opt/app/policy/clamp/etc/mounted name: ac-pf-ppnt-config-processed + - mountPath: /opt/app/policy/clamp/bin/policy-participant.sh + name: ac-pf-ppnt-config + subPath: policy-participant.sh resources: {{ toYaml .Values.resources.small | indent 12 }} {{- if .Values.nodeSelector }} diff --git a/helm/policy/components/policy-clamp-ac-pf-ppnt/values.yaml b/helm/policy/components/policy-clamp-ac-pf-ppnt/values.yaml index af38e9c4..314fc237 100644 --- a/helm/policy/components/policy-clamp-ac-pf-ppnt/values.yaml +++ b/helm/policy/components/policy-clamp-ac-pf-ppnt/values.yaml @@ -94,3 +94,19 @@ serviceAccount: roles: - read +jaeger: + service: + name: jaeger + enabled: true + sampling: + probability: "1.0" + producer: + type: B3,W3C,B3_MULTI + collector: + protocol: grpc + host: "http://jaeger" + portOtlpGrpc: 4317 + portOtlpHttp: 4318 + portJaegerGrpc: 14250 + +applicationName: policy-ppnt diff --git a/helm/policy/components/policy-clamp-ac-sim-ppnt/resources/config/SimulatorParticipantParameters.yaml b/helm/policy/components/policy-clamp-ac-sim-ppnt/resources/config/SimulatorParticipantParameters.yaml index 7f178207..f8932ecb 100644 --- a/helm/policy/components/policy-clamp-ac-sim-ppnt/resources/config/SimulatorParticipantParameters.yaml +++ b/helm/policy/components/policy-clamp-ac-sim-ppnt/resources/config/SimulatorParticipantParameters.yaml @@ -17,6 +17,8 @@ # ============LICENSE_END========================================================= spring: + application: + name: sim-ppnt autoconfigure: exclude: - org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration @@ -47,6 +49,7 @@ participant: topicCommInfrastructure: kafka fetchTimeout: 15000 useHttps: false + allowTracing: {{ include "policy-clamp-ac-sim-ppnt.jaeger-enabled" . }} additionalProps: group.id: policy-clamp-ac-sim-ppnt - topic: ${participant.intermediaryParameters.topics.syncTopic} @@ -55,18 +58,25 @@ participant: topicCommInfrastructure: kafka fetchTimeout: 15000 useHttps: false + allowTracing: {{ include "policy-clamp-ac-sim-ppnt.jaeger-enabled" . }} topicSinks: - topic: ${participant.intermediaryParameters.topics.operationTopic} servers: - "{{ .Values.global.kafkaServer }}:9092" topicCommInfrastructure: kafka useHttps: false + allowTracing: {{ include "policy-clamp-ac-sim-ppnt.jaeger-enabled" . }} participantSupportedElementTypes: - typeName: org.onap.policy.clamp.acm.SimAutomationCompositionElement typeVersion: 1.0.0 management: + tracing: + propagation: + produce: [{{ .Values.jaeger.producer.type }}] + sampling: + probability: {{ .Values.jaeger.sampling.probability }} endpoints: web: base-path: / @@ -78,3 +88,12 @@ server: context-path: /onap/policy/simparticipant ssl: enabled: false + +tracing: + enabled: {{ .Values.jaeger.enabled }} + exporter: + endpoint: {{ .Values.jaeger.collector.host }}:{{ include "policy-clamp-ac-sim-ppnt.exporter-port" . }} + protocol: {{ .Values.jaeger.collector.protocol }} + sampler: + jaeger-remote: + endpoint: {{ .Values.jaeger.collector.host }}:{{ .Values.jaeger.collector.portJaegerGrpc }}
\ No newline at end of file diff --git a/helm/policy/components/policy-clamp-ac-sim-ppnt/resources/config/sim-participant.sh b/helm/policy/components/policy-clamp-ac-sim-ppnt/resources/config/sim-participant.sh new file mode 100755 index 00000000..556f4ef8 --- /dev/null +++ b/helm/policy/components/policy-clamp-ac-sim-ppnt/resources/config/sim-participant.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env sh +# +# ============LICENSE_START======================================================= +# Copyright (C) 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========================================================= +# + +KEYSTORE="${KEYSTORE:-$POLICY_HOME/etc/ssl/policy-keystore}" +TRUSTSTORE="${TRUSTSTORE:-$POLICY_HOME/etc/ssl/policy-truststore}" +KEYSTORE_PASSWD="${KEYSTORE_PASSWD:-Pol1cy_0nap}" +TRUSTSTORE_PASSWD="${TRUSTSTORE_PASSWD:-Pol1cy_0nap}" + +if [ "$#" -eq 1 ]; then + CONFIG_FILE=$1 +fi + +if [ -z "$CONFIG_FILE" ]; then + CONFIG_FILE="${POLICY_HOME}/etc/SimulatorParticipantParameters.yaml" +fi + +echo "Policy clamp Simulator participant config file: $CONFIG_FILE" + +if [ -f "${POLICY_HOME}/etc/mounted/policy-truststore" ]; then + echo "overriding policy-truststore" + cp -f "${POLICY_HOME}"/etc/mounted/policy-truststore "${TRUSTSTORE}" +fi + +if [ -f "${POLICY_HOME}/etc/mounted/policy-keystore" ]; then + echo "overriding policy-keystore" + cp -f "${POLICY_HOME}"/etc/mounted/policy-keystore "${KEYSTORE}" +fi + +if [ -f "${POLICY_HOME}/etc/mounted/logback.xml" ]; then + echo "overriding logback xml file" + cp -f "${POLICY_HOME}"/etc/mounted/logback.xml "${POLICY_HOME}"/etc/ +fi + +$JAVA_HOME/bin/java \ + -Dlogging.config="${POLICY_HOME}/etc/logback.xml" \ + -Dserver.ssl.keyStore="${KEYSTORE}" \ + -Dserver.ssl.keyStorePassword="${KEYSTORE_PASSWD}" \ + -Djavax.net.ssl.trustStore="${TRUSTSTORE}" \ + -Djavax.net.ssl.trustStorePassword="${TRUSTSTORE_PASSWD}" \ + -Dotel.java.global-autoconfigure.enabled=true \ + -jar /app/app.jar \ + --spring.config.location="${CONFIG_FILE}" diff --git a/helm/policy/components/policy-clamp-ac-sim-ppnt/templates/_helpers.tpl b/helm/policy/components/policy-clamp-ac-sim-ppnt/templates/_helpers.tpl new file mode 100644 index 00000000..5f19df88 --- /dev/null +++ b/helm/policy/components/policy-clamp-ac-sim-ppnt/templates/_helpers.tpl @@ -0,0 +1,58 @@ +{{/* +# +# ============LICENSE_START======================================================= +# Copyright (C) 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========================================================= +# +*/}} + +{{/* +This helper defines which exporter port must be used depending on protocol +*/}} +{{- define "policy-clamp-ac-sim-ppnt.exporter-port" }} + {{- $jaegerExporterPort := .Values.jaeger.collector.portOtlpGrpc -}} + {{- if .Values.jaeger.collector.protocol -}} + {{- if eq .Values.jaeger.collector.protocol "http" -}} + {{- $jaegerExporterPort = .Values.jaeger.collector.portOtlpHttp -}} + {{- end -}} + {{- end -}} + {{- $jaegerExporterPort -}} +{{- end -}} + +{{/* +This helper defines whether Jaeger is enabled or not. +*/}} +{{- define "policy-clamp-ac-sim-ppnt.jaeger-enabled" }} + {{- $jaegerEnabled := "false" -}} + {{- if .Values.jaeger -}} + {{- if .Values.jaeger.enabled -}} + {{- $jaegerEnabled = .Values.jaeger.enabled -}} + {{- end -}} + {{- end -}} + {{- $jaegerEnabled -}} +{{- end -}} + +{{/* +This helper defines whether jaeger is using http or grpc protocol +*/}} +{{- define "policy-clamp-ac-sim-ppnt.jaeger-protocol" }} + {{- $protocol := "grpc" -}} + {{- if eq .Values.jaeger.collector.protocol "http" -}} + {{- $protocol = "http/protobuf" -}} + {{- end -}} + {{- $protocol -}} +{{- end -}}
\ No newline at end of file diff --git a/helm/policy/components/policy-clamp-ac-sim-ppnt/templates/configmap.yaml b/helm/policy/components/policy-clamp-ac-sim-ppnt/templates/configmap.yaml index 34fe4046..65578217 100644 --- a/helm/policy/components/policy-clamp-ac-sim-ppnt/templates/configmap.yaml +++ b/helm/policy/components/policy-clamp-ac-sim-ppnt/templates/configmap.yaml @@ -29,4 +29,4 @@ metadata: release: release heritage: Helm data: -{{ tpl (.Files.Glob "resources/config/*.{xml,yaml}").AsConfig . | indent 2 }} +{{ tpl (.Files.Glob "resources/config/*.{xml,yaml,sh}").AsConfig . | indent 2 }} diff --git a/helm/policy/components/policy-clamp-ac-sim-ppnt/templates/deployment.yaml b/helm/policy/components/policy-clamp-ac-sim-ppnt/templates/deployment.yaml index 65260edd..446f000b 100644 --- a/helm/policy/components/policy-clamp-ac-sim-ppnt/templates/deployment.yaml +++ b/helm/policy/components/policy-clamp-ac-sim-ppnt/templates/deployment.yaml @@ -75,6 +75,18 @@ spec: imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} command: ["/opt/app/policy/clamp/bin/sim-participant.sh"] args: ["/opt/app/policy/clamp/etc/mounted/SimulatorParticipantParameters.yaml"] + {{- $jaegerEnabled := tpl "policy-clamp-ac-sim-ppnt.jaeger-enabled" . | trimSuffix "\n" -}} + {{- if $jaegerEnabled }} + env: + - name: OTEL_SERVICE_NAME + value: {{ .Values.applicationName }} + - name: OTEL_EXPORTER_OTLP_PROTOCOL + value: {{ include "policy-clamp-ac-sim-ppnt.jaeger-protocol" . }} + - name: OTEL_EXPORTER_OTLP_TRACES_PROTOCOL + value: {{ include "policy-clamp-ac-sim-ppnt.jaeger-protocol" . }} + - name: OTEL_EXPORTER_OTLP_ENDPOINT + value: {{ printf "%s:%s" (.Values.jaeger.collector.host) (include "policy-clamp-ac-sim-ppnt.exporter-port" .) }} + {{- end }} ports: - containerPort: 6969 name: http-api @@ -98,6 +110,9 @@ spec: readOnly: true - mountPath: /opt/app/policy/clamp/etc/mounted name: ac-sim-ppnt-config-processed + - mountPath: /opt/app/policy/clamp/bin/sim-participant.sh + name: ac-sim-ppnt-config + subPath: sim-participant.sh resources: {{ toYaml .Values.resources.small | indent 12 }} {{- if .Values.nodeSelector }} diff --git a/helm/policy/components/policy-clamp-ac-sim-ppnt/values.yaml b/helm/policy/components/policy-clamp-ac-sim-ppnt/values.yaml index 45fccdd0..95fe91c7 100644 --- a/helm/policy/components/policy-clamp-ac-sim-ppnt/values.yaml +++ b/helm/policy/components/policy-clamp-ac-sim-ppnt/values.yaml @@ -87,3 +87,20 @@ serviceAccount: roles: - read +jaeger: + service: + name: jaeger + enabled: true + sampling: + probability: "1.0" + producer: + type: B3,W3C,B3_MULTI + collector: + protocol: grpc + host: "http://jaeger" + portOtlpGrpc: 4317 + portOtlpHttp: 4318 + portJaegerGrpc: 14250 + +applicationName: sim-ppnt + diff --git a/helm/policy/components/policy-clamp-runtime-acm/resources/config/acRuntimeParameters.yaml b/helm/policy/components/policy-clamp-runtime-acm/resources/config/acRuntimeParameters.yaml index c33cf6ba..7b8ceea7 100755 --- a/helm/policy/components/policy-clamp-runtime-acm/resources/config/acRuntimeParameters.yaml +++ b/helm/policy/components/policy-clamp-runtime-acm/resources/config/acRuntimeParameters.yaml @@ -17,6 +17,8 @@ # ============LICENSE_END========================================================= spring: + application: + name: {{ .Values.applicationName }} security: user: name: ${RUNTIME_USER} @@ -42,7 +44,6 @@ spring: implicit-strategy: org.onap.policy.common.spring.utils.CustomImplicitNamingStrategy properties: hibernate: - dialect: org.hibernate.dialect.MariaDB103Dialect format_sql: true security: @@ -77,6 +78,7 @@ runtime: topicCommInfrastructure: kafka useHttps: false fetchTimeout: 15000 + allowTracing: {{ include "policy-clamp-runtime-acm.jaeger-enabled" . }} additionalProps: group.id: policy-clamp-runtime-acm topicSinks: @@ -86,11 +88,13 @@ runtime: - {{ .Values.global.kafkaServer }}:9092 topicCommInfrastructure: kafka useHttps: false + allowTracing: {{ include "policy-clamp-runtime-acm.jaeger-enabled" . }} - topic: ${runtime.topics.syncTopic} servers: - {{ .Values.global.kafkaServer }}:9092 topicCommInfrastructure: kafka + allowTracing: {{ include "policy-clamp-runtime-acm.jaeger-enabled" . }} useHttps: false acmParameters: toscaElementName: {{ .Values.customNaming.toscaElementName }} @@ -99,8 +103,22 @@ runtime: management: + tracing: + propagation: + produce: [{{ .Values.jaeger.producer.type }}] + sampling: + probability: {{ .Values.jaeger.sampling.probability }} endpoints: web: base-path: / exposure: include: health, metrics, prometheus + +tracing: + enabled: {{ .Values.jaeger.enabled }} + exporter: + endpoint: {{ .Values.jaeger.collector.host }}:{{ include "policy-clamp-runtime-acm.exporter-port" . }} + protocol: {{ .Values.jaeger.collector.protocol }} + sampler: + jaeger-remote: + endpoint: {{ .Values.jaeger.collector.host }}:{{ .Values.jaeger.collector.portJaegerGrpc }}
\ No newline at end of file diff --git a/helm/policy/components/policy-clamp-runtime-acm/resources/config/acm-runtime.sh b/helm/policy/components/policy-clamp-runtime-acm/resources/config/acm-runtime.sh new file mode 100755 index 00000000..695c08fc --- /dev/null +++ b/helm/policy/components/policy-clamp-runtime-acm/resources/config/acm-runtime.sh @@ -0,0 +1,66 @@ +#!/usr/bin/env sh +# +# ============LICENSE_START======================================================= +# Copyright (C) 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========================================================= +# + +KEYSTORE="${KEYSTORE:-$POLICY_HOME/etc/ssl/policy-keystore}" +TRUSTSTORE="${TRUSTSTORE:-$POLICY_HOME/etc/ssl/policy-truststore}" +KEYSTORE_PASSWD="${KEYSTORE_PASSWD:-Pol1cy_0nap}" +TRUSTSTORE_PASSWD="${TRUSTSTORE_PASSWD:-Pol1cy_0nap}" + +if [ "$#" -eq 1 ]; then + CONFIG_FILE=$1 +fi + +if [ -z "$CONFIG_FILE" ]; then + CONFIG_FILE="${POLICY_HOME}/etc/AcRuntimeParameters.yaml" +fi + +echo "Policy clamp runtime acm config file: $CONFIG_FILE" + +if [ -f "${POLICY_HOME}/etc/mounted/policy-truststore" ]; then + echo "overriding policy-truststore" + cp -f "${POLICY_HOME}"/etc/mounted/policy-truststore "${TRUSTSTORE}" +fi + +if [ -f "${POLICY_HOME}/etc/mounted/policy-keystore" ]; then + echo "overriding policy-keystore" + cp -f "${POLICY_HOME}"/etc/mounted/policy-keystore "${KEYSTORE}" +fi + +if [ -f "${POLICY_HOME}/etc/mounted/logback.xml" ]; then + echo "overriding logback xml file" + cp -f "${POLICY_HOME}"/etc/mounted/logback.xml "${POLICY_HOME}"/etc/ +fi + +$JAVA_HOME/bin/java \ + -Dlogging.config="${POLICY_HOME}/etc/logback.xml" \ + -Dserver.ssl.keyStore="${KEYSTORE}" \ + -Dserver.ssl.keyStorePassword="${KEYSTORE_PASSWD}" \ + -Djavax.net.ssl.trustStore="${TRUSTSTORE}" \ + -Djavax.net.ssl.trustStorePassword="${TRUSTSTORE_PASSWD}" \ + -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 \ + -Dotel.java.global-autoconfigure.enabled=true \ + -jar /app/app.jar \ + --spring.config.location="${CONFIG_FILE}" diff --git a/helm/policy/components/policy-clamp-runtime-acm/templates/_helpers.tpl b/helm/policy/components/policy-clamp-runtime-acm/templates/_helpers.tpl new file mode 100644 index 00000000..9e02361d --- /dev/null +++ b/helm/policy/components/policy-clamp-runtime-acm/templates/_helpers.tpl @@ -0,0 +1,58 @@ +{{/* +# +# ============LICENSE_START======================================================= +# Copyright (C) 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========================================================= +# +*/}} + +{{/* +This helper defines which exporter port must be used depending on protocol +*/}} +{{- define "policy-clamp-runtime-acm.exporter-port" }} + {{- $jaegerExporterPort := .Values.jaeger.collector.portOtlpGrpc -}} + {{- if .Values.jaeger.collector.protocol -}} + {{- if eq .Values.jaeger.collector.protocol "http" -}} + {{- $jaegerExporterPort = .Values.jaeger.collector.portOtlpHttp -}} + {{- end -}} + {{- end -}} + {{- $jaegerExporterPort -}} +{{- end -}} + +{{/* +This helper defines whether Jaeger is enabled or not. +*/}} +{{- define "policy-clamp-runtime-acm.jaeger-enabled" }} + {{- $jaegerEnabled := "false" -}} + {{- if .Values.jaeger -}} + {{- if .Values.jaeger.enabled -}} + {{- $jaegerEnabled = .Values.jaeger.enabled -}} + {{- end -}} + {{- end -}} + {{- $jaegerEnabled -}} +{{- end -}} + +{{/* +This helper defines whether jaeger is using http or grpc protocol +*/}} +{{- define "policy-clamp-runtime-acm.jaeger-protocol" }} + {{- $protocol := "grpc" -}} + {{- if eq .Values.jaeger.collector.protocol "http" -}} + {{- $protocol = "http/protobuf" -}} + {{- end -}} + {{- $protocol -}} +{{- end -}}
\ No newline at end of file diff --git a/helm/policy/components/policy-clamp-runtime-acm/templates/configmap.yaml b/helm/policy/components/policy-clamp-runtime-acm/templates/configmap.yaml index 309dc45e..43f6e270 100644 --- a/helm/policy/components/policy-clamp-runtime-acm/templates/configmap.yaml +++ b/helm/policy/components/policy-clamp-runtime-acm/templates/configmap.yaml @@ -1,6 +1,6 @@ {{/* # ============LICENSE_START======================================================= -# Copyright (C) 2022 Nordix Foundation. All rights reserved. +# Copyright (C) 2022-2024 Nordix Foundation. 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. @@ -34,4 +34,4 @@ binaryData: {{- end }} {{- end }} data: -{{ tpl (.Files.Glob "resources/config/*.{json,xml,yaml}").AsConfig . | indent 2 }} +{{ tpl (.Files.Glob "resources/config/*.{json,xml,yaml,sh}").AsConfig . | indent 2 }} diff --git a/helm/policy/components/policy-clamp-runtime-acm/templates/deployment.yaml b/helm/policy/components/policy-clamp-runtime-acm/templates/deployment.yaml index b1253a42..9175c433 100644 --- a/helm/policy/components/policy-clamp-runtime-acm/templates/deployment.yaml +++ b/helm/policy/components/policy-clamp-runtime-acm/templates/deployment.yaml @@ -1,6 +1,6 @@ {{/* # ============LICENSE_START======================================================= -# Copyright (C) 2022 Nordix Foundation. +# Copyright (C) 2022-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. @@ -96,6 +96,18 @@ spec: imagePullPolicy: {{ .Values.global.pullPolicy }} command: ["/opt/app/policy/clamp/bin/acm-runtime.sh"] args: ["/opt/app/policy/clamp/etc/mounted/acRuntimeParameters.yaml"] + {{- $jaegerEnabled := tpl "policy-clamp-ac-a1pms-ppnt.jaeger-enabled" . | trimSuffix "\n" -}} + {{- if $jaegerEnabled }} + env: + - name: OTEL_SERVICE_NAME + value: {{ .Values.applicationName }} + - name: OTEL_EXPORTER_OTLP_PROTOCOL + value: {{ include "policy-clamp-runtime-acm.jaeger-protocol" . }} + - name: OTEL_EXPORTER_OTLP_TRACES_PROTOCOL + value: {{ include "policy-clamp-runtime-acm.jaeger-protocol" . }} + - name: OTEL_EXPORTER_OTLP_ENDPOINT + value: {{ printf "%s:%s" (.Values.jaeger.collector.host) (include "policy-clamp-runtime-acm.exporter-port" .) }} + {{- end }} ports: - containerPort: {{ .Values.service.ports.port }} name: http-api @@ -119,6 +131,9 @@ spec: readOnly: true - mountPath: /opt/app/policy/clamp/etc/mounted name: ac-runtime-config-processed + - mountPath: /opt/app/policy/clamp/bin/acm-runtime.sh + name: ac-runtime-config + subPath: acm-runtime.sh resources: {{ toYaml .Values.resources.small | indent 12 }} {{- if .Values.nodeSelector }} diff --git a/helm/policy/components/policy-clamp-runtime-acm/values.yaml b/helm/policy/components/policy-clamp-runtime-acm/values.yaml index c4473822..82487e69 100644 --- a/helm/policy/components/policy-clamp-runtime-acm/values.yaml +++ b/helm/policy/components/policy-clamp-runtime-acm/values.yaml @@ -93,3 +93,21 @@ serviceAccount: customNaming: toscaElementName: org.onap.policy.clamp.acm.AutomationCompositionElement toscaCompositionName: org.onap.policy.clamp.acm.AutomationComposition + + +jaeger: + service: + name: jaeger + enabled: true + sampling: + probability: "1.0" + producer: + type: B3,W3C,B3_MULTI + collector: + protocol: grpc + host: "http://jaeger" + portOtlpGrpc: 4317 + portOtlpHttp: 4318 + portJaegerGrpc: 14250 + +applicationName: acm-r
\ No newline at end of file diff --git a/helm/policy/components/policy-pap/resources/config/papParameters.yaml b/helm/policy/components/policy-pap/resources/config/papParameters.yaml index 646b5ea8..85315a17 100644 --- a/helm/policy/components/policy-pap/resources/config/papParameters.yaml +++ b/helm/policy/components/policy-pap/resources/config/papParameters.yaml @@ -34,7 +34,7 @@ spring: jpa: properties: hibernate: - dialect: org.hibernate.dialect.MariaDB103Dialect + format_sql: true hibernate: ddl-auto: none naming: diff --git a/helm/policy/values.yaml b/helm/policy/values.yaml index 9e5347d5..fabc016b 100755 --- a/helm/policy/values.yaml +++ b/helm/policy/values.yaml @@ -62,7 +62,7 @@ policy-pap: policy-clamp-ac-k8s-ppnt: enabled: false policy-clamp-runtime-acm: - enabled: false + enabled: true policy-apex-pdp: enabled: false policy-clamp-ac-pf-ppnt: @@ -81,7 +81,10 @@ policy-clamp-ac-kserve-ppnt: enabled: false policy-clamp-ac-a1pms-ppnt: enabled: false - +jaeger: + enabled: false + fullnameOverride: jaeger + enableHttpOpenTelemetryCollector: true ################################################################# # DB configuration defaults. ################################################################# diff --git a/policy-db-migrator/pom.xml b/policy-db-migrator/pom.xml index c068eb33..776a1c71 100644 --- a/policy-db-migrator/pom.xml +++ b/policy-db-migrator/pom.xml @@ -24,7 +24,7 @@ <parent> <groupId>org.onap.policy.docker</groupId> <artifactId>docker</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>4.0.1-SNAPSHOT</version> </parent> <artifactId>policy-db-migrator</artifactId> diff --git a/policy-db-migrator/smoke-test/mariadb-clamp-tests.sh b/policy-db-migrator/smoke-test/mariadb-clamp-tests.sh new file mode 100644 index 00000000..052128d0 --- /dev/null +++ b/policy-db-migrator/smoke-test/mariadb-clamp-tests.sh @@ -0,0 +1,219 @@ +#!/bin/sh +# ============LICENSE_START==================================================== +# Copyright (C) 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====================================================== +# shellcheck disable=SC2039 +# shellcheck disable=SC2086 +# shellcheck disable=SC2012 +echo "Start of test $(date +%F-%T)" + +export POLICY_HOME=/opt/app/policy +export SQL_USER=${MYSQL_USER} +export SQL_PASSWORD=${MYSQL_PASSWORD} +export SCRIPT_DIRECTORY=sql +export SCHEMA=clampacm + +# Test variables +TOTAL_COUNT=0 +A_UPGRADE_COUNT=$(ls /home/${SQL_DB}/sql/1400/upgrade/*.sql | wc -l) +A_DOWNGRADE_COUNT=$(ls /home/${SQL_DB}/sql/1400/downgrade/*.sql | wc -l) +TOTAL_SQLS_UPGRADE=$A_UPGRADE_COUNT +TOTAL_SQLS_DOWNGRADE=$A_DOWNGRADE_COUNT + +B_UPGRADE_COUNT=$(ls /home/${SQL_DB}/sql/1500/upgrade/*.sql | wc -l) +B_DOWNGRADE_COUNT=$(ls /home/${SQL_DB}/sql/1500/downgrade/*.sql | wc -l) +TOTAL_SQLS_UPGRADE=$(($TOTAL_SQLS_UPGRADE+$B_UPGRADE_COUNT)) +TOTAL_SQLS_DOWNGRADE=$(($TOTAL_SQLS_DOWNGRADE+$B_DOWNGRADE_COUNT)) + +C_UPGRADE_COUNT=$(ls /home/${SQL_DB}/sql/1600/upgrade/*.sql | wc -l) +C_DOWNGRADE_COUNT=$(ls /home/${SQL_DB}/sql/1600/downgrade/*.sql | wc -l) +TOTAL_SQLS_UPGRADE=$(($TOTAL_SQLS_UPGRADE+$C_UPGRADE_COUNT)) +TOTAL_SQLS_DOWNGRADE=$(($TOTAL_SQLS_DOWNGRADE+$C_DOWNGRADE_COUNT)) + +NEW_SQL_EXECUTIONS=0 +START_VERSION="" +PREVIOUS_SQL_EXECUTIONS=0 +END_VERSION="" +RECENT_SQL_EXECUTIONS=0 +END_STATUS=0 +TEST_STATUS="FAIL" +TEST_MSG="" +TESTS=0 +PASSED=0 +FAILED=0 + +run_sql() { + local user="${1}" password="${2}" schema="${3}" sql="${4}" + MYSQL="mysql -u${user} -p${password} -h ${SQL_HOST} ${schema}" + ${MYSQL} --execute "${sql}" + return $? +} + +start_test() { + echo "" + echo "############################################################################################################" + echo "" + let TESTS=$TESTS+1 + reportStatus=$(/opt/app/policy/bin/db-migrator -s ${SQL_DB} -o report | tail -2) + echo "Starting test $TESTS" + echo "$reportStatus" + START_VERSION=$(echo $reportStatus | cut -f13 -d' ') + PREVIOUS_SQL_EXECUTIONS=$(echo $reportStatus | cut -f1 -d' ') + + if [ "${START_VERSION}" == "" ]; then + START_VERSION="0" + PREVIOUS_SQL_EXECUTIONS=0 + fi +} + +end_test() { + reportStatus=$(/opt/app/policy/bin/db-migrator -s ${SQL_DB} -o report | tail -2) + echo "Ending test $TESTS" + echo "$reportStatus" + END_VERSION=$(echo $reportStatus | cut -f13 -d' ') + RECENT_SQL_EXECUTIONS=$(echo $reportStatus | cut -f1 -d' ') + END_STATUS=$(echo $reportStatus | cut -f7 -d' ') +} + +check_results() { + local status="${1}" operation="${2}" startVer="${3}" endVer="${4}" newRecords="${5}" filesRan="${6}" + + echo "" + echo "Test summary: status:$status, operation:$operation, from:$startVer, to:$endVer, new executions:$newRecords, sqlFiles:$filesRan" + # Convert to number + startVer=$(echo ${startVer} | awk '{$0=int($0)}1') + endVer=$(echo ${endVer} | awk '{$0=int($0)}1') + + if [ ${startVer} -eq ${endVer} ] && [ $newRecords -eq $filesRan ] && [ $newRecords -eq 0 ]; then + TEST_MSG="No ${operation} required" + TEST_STATUS="PASS" + let PASSED=$PASSED+1 + elif [ $status -eq 1 ] && [ "${operation}" == "upgrade" ] && [ ${startVer} -le ${endVer} ] && [ $newRecords -eq $filesRan ]; then + TEST_MSG="Successful ${operation}" + TEST_STATUS="PASS" + let PASSED=$PASSED+1 + elif [ $status -eq 1 ] && [ "${operation}" == "downgrade" ] && [ ${startVer} -ge ${endVer} ] && [ $newRecords -eq $filesRan ]; then + TEST_MSG="Successful ${operation}" + TEST_STATUS="PASS" + let PASSED=$PASSED+1 + else + TEST_MSG="Errors occurred during ${operation}" + TEST_STATUS="FAIL" + let FAILED=$FAILED+1 + fi + echo "" + echo "*** Test $TESTS: $TEST_STATUS , $TEST_MSG, current version: $END_VERSION ***" + echo "" +} + +# Test 1 - Upgrade to 1600 +start_test +/opt/app/policy/bin/prepare_upgrade.sh ${SQL_DB} +/opt/app/policy/bin/db-migrator -s ${SQL_DB} -o upgrade -t 1600 +end_test +let TOTAL_COUNT=$A_UPGRADE_COUNT+$B_UPGRADE_COUNT+$C_UPGRADE_COUNT +check_results $END_STATUS 'upgrade' "${START_VERSION}" "${END_VERSION}" $RECENT_SQL_EXECUTIONS $TOTAL_COUNT + +sleep 5 + +# Test 2 - downgrade to 1500 +start_test +/opt/app/policy/bin/prepare_downgrade.sh ${SQL_DB} +/opt/app/policy/bin/db-migrator -s ${SQL_DB} -o downgrade -f 1600 -t 1500 +end_test +let NEW_SQL_EXECUTIONS=$RECENT_SQL_EXECUTIONS-$PREVIOUS_SQL_EXECUTIONS +check_results $END_STATUS 'downgrade' "${START_VERSION}" "${END_VERSION}" $NEW_SQL_EXECUTIONS $C_DOWNGRADE_COUNT + +sleep 5 + +# Test 3 - downgrade to 1400 +start_test +/opt/app/policy/bin/prepare_downgrade.sh ${SQL_DB} +/opt/app/policy/bin/db-migrator -s ${SQL_DB} -o downgrade -f 1500 -t 1400 +end_test +let NEW_SQL_EXECUTIONS=$RECENT_SQL_EXECUTIONS-$PREVIOUS_SQL_EXECUTIONS +check_results $END_STATUS 'downgrade' "${START_VERSION}" "${END_VERSION}" $NEW_SQL_EXECUTIONS $B_DOWNGRADE_COUNT + +sleep 5 + +# Test 4 - upgrade to 1500 +start_test +/opt/app/policy/bin/prepare_upgrade.sh ${SQL_DB} +/opt/app/policy/bin/db-migrator -s ${SQL_DB} -o upgrade -f 1400 -t 1500 +end_test +let NEW_SQL_EXECUTIONS=$RECENT_SQL_EXECUTIONS-$PREVIOUS_SQL_EXECUTIONS +check_results $END_STATUS 'upgrade' "${START_VERSION}" "${END_VERSION}" $NEW_SQL_EXECUTIONS $B_UPGRADE_COUNT + +sleep 5 + +# Test 5 - upgrade to 1600 +start_test +/opt/app/policy/bin/prepare_upgrade.sh ${SQL_DB} +/opt/app/policy/bin/db-migrator -s ${SQL_DB} -o upgrade -f 1500 -t 1600 +end_test +let NEW_SQL_EXECUTIONS=$RECENT_SQL_EXECUTIONS-$PREVIOUS_SQL_EXECUTIONS +check_results $END_STATUS 'upgrade' "${START_VERSION}" "${END_VERSION}" $NEW_SQL_EXECUTIONS $C_UPGRADE_COUNT + +sleep 5 + +# Test 6 - run upgrade on db where tables already exist and migration schema is empty +start_test +/opt/app/policy/bin/prepare_downgrade.sh ${SQL_DB} +/opt/app/policy/bin/db-migrator -s ${SQL_DB} -o downgrade -f 1600 -t 1400 +run_sql "root" "${MYSQL_ROOT_PASSWORD}" "${SCHEMA}" "DROP DATABASE IF EXISTS migration;" +/opt/app/policy/bin/prepare_upgrade.sh ${SQL_DB} +/opt/app/policy/bin/db-migrator -s ${SQL_DB} -o upgrade -t 1600 +end_test +let NEW_SQL_EXECUTIONS=$RECENT_SQL_EXECUTIONS-$PREVIOUS_SQL_EXECUTIONS +let TOTAL_COUNT=$C_DOWNGRADE_COUNT+$C_UPGRADE_COUNT+$B_DOWNGRADE_COUNT+$B_UPGRADE_COUNT +check_results $END_STATUS 'upgrade' "1400" "${END_VERSION}" $NEW_SQL_EXECUTIONS $TOTAL_COUNT + +sleep 5 + +# Test 7 - Full downgrade +start_test +/opt/app/policy/bin/prepare_downgrade.sh ${SQL_DB} +/opt/app/policy/bin/db-migrator -s ${SQL_DB} -o downgrade -f 1600 -t 0 +end_test +let NEW_SQL_EXECUTIONS=$RECENT_SQL_EXECUTIONS-$PREVIOUS_SQL_EXECUTIONS +check_results $END_STATUS 'downgrade' "${START_VERSION}" "0" $NEW_SQL_EXECUTIONS $TOTAL_SQLS_DOWNGRADE + +sleep 5 + +# Test 8 - Full upgrade +start_test +/opt/app/policy/bin/prepare_upgrade.sh ${SQL_DB} +/opt/app/policy/bin/db-migrator -s ${SQL_DB} -o upgrade +end_test +let NEW_SQL_EXECUTIONS=$RECENT_SQL_EXECUTIONS-$PREVIOUS_SQL_EXECUTIONS +check_results $END_STATUS 'upgrade' "0" "${END_VERSION}" $NEW_SQL_EXECUTIONS $TOTAL_SQLS_UPGRADE + +# Install database +/opt/app/policy/bin/prepare_upgrade.sh ${SQL_DB} +/opt/app/policy/bin/db-migrator -s ${SQL_DB} -o upgrade +/opt/app/policy/bin/db-migrator -s ${SQL_DB} -o report + +echo +echo "-----------------------------------------------------------------------" +echo "Number of Tests: $TESTS, Tests Passed: $PASSED, Tests Failed: $FAILED" +echo "-----------------------------------------------------------------------" + +echo "End of test $(date +%F-%T)" + +nc -lk -p 6824 + +exit 0 diff --git a/policy-db-migrator/smoke-test/postgres-clamp-tests.sh b/policy-db-migrator/smoke-test/postgres-clamp-tests.sh new file mode 100644 index 00000000..98832520 --- /dev/null +++ b/policy-db-migrator/smoke-test/postgres-clamp-tests.sh @@ -0,0 +1,206 @@ +#!/bin/sh +# ============LICENSE_START==================================================== +# Copyright (C) 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====================================================== +# shellcheck disable=SC2039 +# shellcheck disable=SC2086 +# shellcheck disable=SC2012 +echo "Start of test $(date +%F-%T)" + +export POLICY_HOME=/opt/app/policy +export SQL_USER=${MYSQL_USER} +export SQL_PASSWORD=${MYSQL_PASSWORD} +export SCRIPT_DIRECTORY=postgres +export SCHEMA=clampacm + +# Test variables +TOTAL_COUNT=0 +A_UPGRADE_COUNT=$(ls /home/${SQL_DB}/postgres/1400/upgrade/*.sql | wc -l) +A_DOWNGRADE_COUNT=$(ls /home/${SQL_DB}/postgres/1400/downgrade/*.sql | wc -l) +TOTAL_SQLS_UPGRADE=$A_UPGRADE_COUNT +TOTAL_SQLS_DOWNGRADE=$A_DOWNGRADE_COUNT + +B_UPGRADE_COUNT=$(ls /home/${SQL_DB}/postgres/1500/upgrade/*.sql | wc -l) +B_DOWNGRADE_COUNT=$(ls /home/${SQL_DB}/postgres/1500/downgrade/*.sql | wc -l) +TOTAL_SQLS_UPGRADE=$(($TOTAL_SQLS_UPGRADE+$B_UPGRADE_COUNT)) +TOTAL_SQLS_DOWNGRADE=$(($TOTAL_SQLS_DOWNGRADE+$B_DOWNGRADE_COUNT)) + +C_UPGRADE_COUNT=$(ls /home/${SQL_DB}/postgres/1600/upgrade/*.sql | wc -l) +C_DOWNGRADE_COUNT=$(ls /home/${SQL_DB}/postgres/1600/downgrade/*.sql | wc -l) +TOTAL_SQLS_UPGRADE=$(($TOTAL_SQLS_UPGRADE+$C_UPGRADE_COUNT)) +TOTAL_SQLS_DOWNGRADE=$(($TOTAL_SQLS_DOWNGRADE+$C_DOWNGRADE_COUNT)) + +NEW_SQL_EXECUTIONS=0 +PREVIOUS_SQL_EXECUTIONS=0 +RECENT_SQL_EXECUTIONS=0 +TEST_STATUS="FAIL" +TEST_MSG="" +TESTS=0 +PASSED=0 +FAILED=0 + +run_sql() { + local user="${1}" schema="${2}" sql="${3}" + PGSQL="psql -U ${user} -d ${schema} -h ${SQL_HOST}" + ${PGSQL} --command "${sql}" + return $? +} + +start_test() { + echo "" + echo "############################################################################################################" + echo "" + let TESTS=$TESTS+1 + echo "Starting test $TESTS" + PREVIOUS_SQL_EXECUTIONS=$RECENT_SQL_EXECUTIONS +} + +end_test() { + echo "Ending test $TESTS" + reportStatus=$(/opt/app/policy/bin/db-migrator-pg -s ${SQL_DB} -o report | tail -3) + echo "Status: $reportStatus" + RECENT_SQL_EXECUTIONS=$(echo $reportStatus | cut -f1 -d' ' | sed 's/(//') +} + +check_results() { + local operation="${1}" startVer="${2}" endVer="${3}" newRecords="${4}" filesRan="${5}" + + echo "" + echo "Test summary: operation:$operation, from:$startVer, to:$endVer, new executions:$newRecords, sqlFiles:$filesRan" + # Convert to number + startVer=$(echo ${startVer} | awk '{$0=int($0)}1') + endVer=$(echo ${endVer} | awk '{$0=int($0)}1') + + if [ ${startVer} -eq ${endVer} ] && [ $newRecords -eq $filesRan ] && [ $newRecords -eq 0 ]; then + TEST_MSG="No ${operation} required" + TEST_STATUS="PASS" + let PASSED=$PASSED+1 + elif [ "${operation}" == "upgrade" ] && [ ${startVer} -le ${endVer} ] && [ $newRecords -eq $filesRan ]; then + TEST_MSG="Successful ${operation}" + TEST_STATUS="PASS" + let PASSED=$PASSED+1 + elif [ "${operation}" == "downgrade" ] && [ ${startVer} -ge ${endVer} ] && [ $newRecords -eq $filesRan ]; then + TEST_MSG="Successful ${operation}" + TEST_STATUS="PASS" + let PASSED=$PASSED+1 + else + TEST_MSG="Errors occurred during ${operation}" + TEST_STATUS="FAIL" + let FAILED=$FAILED+1 + fi + echo "" + echo "*** Test $TESTS: $TEST_STATUS , $TEST_MSG, current version: $END_VERSION ***" + echo "" +} + +# Test 1 - Upgrade to 1600 +start_test +/opt/app/policy/bin/prepare_upgrade.sh ${SQL_DB} +/opt/app/policy/bin/db-migrator-pg -s ${SQL_DB} -o upgrade -t 1600 +end_test +let TOTAL_COUNT=$A_UPGRADE_COUNT+$B_UPGRADE_COUNT+$C_UPGRADE_COUNT +check_results 'upgrade' "0" "1600" $RECENT_SQL_EXECUTIONS $TOTAL_COUNT + +sleep 5 + +# Test 2 - downgrade to 1500 +start_test +/opt/app/policy/bin/prepare_downgrade.sh ${SQL_DB} +/opt/app/policy/bin/db-migrator-pg -s ${SQL_DB} -o downgrade -f 1600 -t 1500 +end_test +let NEW_SQL_EXECUTIONS=$RECENT_SQL_EXECUTIONS-$PREVIOUS_SQL_EXECUTIONS +check_results 'downgrade' "1600" "1500" $NEW_SQL_EXECUTIONS $C_DOWNGRADE_COUNT + +sleep 5 + +# Test 3 - downgrade to 1400 +start_test +/opt/app/policy/bin/prepare_downgrade.sh ${SQL_DB} +/opt/app/policy/bin/db-migrator-pg -s ${SQL_DB} -o downgrade -f 1500 -t 1400 +end_test +let NEW_SQL_EXECUTIONS=$RECENT_SQL_EXECUTIONS-$PREVIOUS_SQL_EXECUTIONS +check_results 'downgrade' "1500" "1400" $NEW_SQL_EXECUTIONS $B_DOWNGRADE_COUNT + +sleep 5 + +# Test 4 - upgrade to 1500 +start_test +/opt/app/policy/bin/prepare_upgrade.sh ${SQL_DB} +/opt/app/policy/bin/db-migrator-pg -s ${SQL_DB} -o upgrade -f 1400 -t 1500 +end_test +let NEW_SQL_EXECUTIONS=$RECENT_SQL_EXECUTIONS-$PREVIOUS_SQL_EXECUTIONS +check_results 'upgrade' "1400" "1500" $NEW_SQL_EXECUTIONS $B_UPGRADE_COUNT + +sleep 5 + +# Test 5 - upgrade to 1600 +start_test +/opt/app/policy/bin/prepare_upgrade.sh ${SQL_DB} +/opt/app/policy/bin/db-migrator-pg -s ${SQL_DB} -o upgrade -f 1500 -t 1600 +end_test +let NEW_SQL_EXECUTIONS=$RECENT_SQL_EXECUTIONS-$PREVIOUS_SQL_EXECUTIONS +check_results 'upgrade' "1500" "1600" $NEW_SQL_EXECUTIONS $C_UPGRADE_COUNT + +sleep 5 + +# Test 6 - run upgrade on db where tables already exist and migration schema is empty +start_test +/opt/app/policy/bin/prepare_downgrade.sh ${SQL_DB} +/opt/app/policy/bin/db-migrator-pg -s ${SQL_DB} -o downgrade -f 1600 -t 1400 +run_sql $SQL_USER "migration" "DROP TABLE IF EXISTS migration;" +/opt/app/policy/bin/prepare_upgrade.sh ${SQL_DB} +/opt/app/policy/bin/db-migrator-pg -s ${SQL_DB} -o upgrade -t 1600 +end_test +let NEW_SQL_EXECUTIONS=$RECENT_SQL_EXECUTIONS-$PREVIOUS_SQL_EXECUTIONS +let TOTAL_COUNT=$B_UPGRADE_COUNT+$B_DOWNGRADE_COUNT+$C_UPGRADE_COUNT+$C_DOWNGRADE_COUNT +check_results 'upgrade' "1600" "1600" $NEW_SQL_EXECUTIONS $TOTAL_COUNT + +#sleep 5 + +# Test 7 - Full downgrade +start_test +/opt/app/policy/bin/prepare_downgrade.sh ${SQL_DB} +/opt/app/policy/bin/db-migrator-pg -s ${SQL_DB} -o downgrade -f 1600 -t 0 +end_test +let NEW_SQL_EXECUTIONS=$RECENT_SQL_EXECUTIONS-$PREVIOUS_SQL_EXECUTIONS +check_results 'downgrade' "1600" "0" $NEW_SQL_EXECUTIONS $TOTAL_SQLS_DOWNGRADE + +sleep 5 + +# Test 6 - Full upgrade +start_test +/opt/app/policy/bin/prepare_upgrade.sh ${SQL_DB} +/opt/app/policy/bin/db-migrator-pg -s ${SQL_DB} -o upgrade +end_test +let NEW_SQL_EXECUTIONS=$RECENT_SQL_EXECUTIONS-$PREVIOUS_SQL_EXECUTIONS +check_results 'upgrade' "0" "1600" $NEW_SQL_EXECUTIONS $TOTAL_SQLS_UPGRADE + +# Install database +/opt/app/policy/bin/prepare_upgrade.sh ${SQL_DB} +/opt/app/policy/bin/db-migrator-pg -s ${SQL_DB} -o upgrade +/opt/app/policy/bin/db-migrator-pg -s ${SQL_DB} -o report + +echo +echo "-----------------------------------------------------------------------" +echo "Number of Tests: $TESTS, Tests Passed: $PASSED, Tests Failed: $FAILED" +echo "-----------------------------------------------------------------------" + +echo "End of test $(date +%F-%T)" + +nc -lk -p 6824 + +exit 0 diff --git a/policy-db-migrator/src/main/docker/Dockerfile b/policy-db-migrator/src/main/docker/Dockerfile index 06b7beae..5e1fef5b 100644 --- a/policy-db-migrator/src/main/docker/Dockerfile +++ b/policy-db-migrator/src/main/docker/Dockerfile @@ -19,7 +19,7 @@ # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END========================================================= #------------------------------------------------------------------------------- -FROM onap/policy-jre-alpine:3.1.4-SNAPSHOT +FROM onap/policy-jre-alpine:4.0.1-SNAPSHOT LABEL maintainer="Policy Team" LABEL org.opencontainers.image.title="Policy db-migrator" @@ -54,10 +54,7 @@ COPY --chown=policy:policy ./db-migrator $POLICY_BIN/ COPY --chown=policy:policy ./db-migrator-pg $POLICY_BIN/ COPY --chown=policy:policy ./prepare_upgrade.sh $POLICY_BIN/ COPY --chown=policy:policy ./prepare_downgrade.sh $POLICY_BIN/ -COPY --chown=policy:policy ./config/policyadmin/sql /home/policyadmin/sql -COPY --chown=policy:policy ./config/policyadmin/postgres /home/policyadmin/postgres -COPY --chown=policy:policy ./config/clampacm/sql /home/clampacm/sql -COPY --chown=policy:policy ./config/clampacm/postgres /home/clampacm/postgres +COPY --chown=policy:policy ./config /home WORKDIR $POLICY_BIN USER policy:policy diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/upgrade/0100-automationcomposition.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/upgrade/0100-automationcomposition.sql index e0cbb692..8ef33cbb 100644 --- a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/upgrade/0100-automationcomposition.sql +++ b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/upgrade/0100-automationcomposition.sql @@ -17,4 +17,4 @@ * ============LICENSE_END========================================================= */ -ALTER TABLE automationcomposition ADD lastMsg timestamp without time zone, ADD phase SMALLINT; +ALTER TABLE automationcomposition ADD lastMsg timestamp without time zone DEFAULT Now(), ADD phase SMALLINT; diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/upgrade/0200-automationcompositiondefinition.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/upgrade/0200-automationcompositiondefinition.sql index 2c8d382a..66313c04 100644 --- a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/upgrade/0200-automationcompositiondefinition.sql +++ b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/upgrade/0200-automationcompositiondefinition.sql @@ -17,4 +17,4 @@ * ============LICENSE_END========================================================= */ -ALTER TABLE automationcompositiondefinition ADD lastMsg timestamp without time zone; +ALTER TABLE automationcompositiondefinition ADD lastMsg timestamp without time zone DEFAULT Now(); diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1600/downgrade/0100-automationcomposition.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1600/downgrade/0100-automationcomposition.sql new file mode 100644 index 00000000..f0897cfe --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1600/downgrade/0100-automationcomposition.sql @@ -0,0 +1,20 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 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========================================================= + */ + +ALTER TABLE automationcomposition DROP subState; diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1600/downgrade/0200-automationcompositionelement.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1600/downgrade/0200-automationcompositionelement.sql new file mode 100644 index 00000000..ef6f3c79 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1600/downgrade/0200-automationcompositionelement.sql @@ -0,0 +1,20 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 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========================================================= + */ + +ALTER TABLE automationcompositionelement DROP subState, DROP stage; diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1600/upgrade/0100-automationcomposition.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1600/upgrade/0100-automationcomposition.sql new file mode 100644 index 00000000..b3ec5f96 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1600/upgrade/0100-automationcomposition.sql @@ -0,0 +1,20 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 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========================================================= + */ + +ALTER TABLE automationcomposition ADD subState SMALLINT DEFAULT NULL; diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1600/upgrade/0200-automationcompositionelement.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1600/upgrade/0200-automationcompositionelement.sql new file mode 100644 index 00000000..3e91bbf7 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1600/upgrade/0200-automationcompositionelement.sql @@ -0,0 +1,20 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 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========================================================= + */ + +ALTER TABLE automationcompositionelement ADD subState SMALLINT DEFAULT NULL, ADD stage SMALLINT DEFAULT NULL; diff --git a/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/0700-ac_compositionId_index.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/0700-ac_compositionId_index.sql index cadcea93..a699e565 100644 --- a/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/0700-ac_compositionId_index.sql +++ b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/0700-ac_compositionId_index.sql @@ -17,4 +17,4 @@ * ============LICENSE_END========================================================= */ -DROP INDEX ac_element_fk ON clampacm.automationcompositionelement;
\ No newline at end of file +DROP INDEX ac_compositionId ON clampacm.automationcomposition; diff --git a/policy-db-migrator/src/main/docker/config/clampacm/sql/1500/upgrade/0100-automationcomposition.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1500/upgrade/0100-automationcomposition.sql index 933e4bda..103a616c 100644 --- a/policy-db-migrator/src/main/docker/config/clampacm/sql/1500/upgrade/0100-automationcomposition.sql +++ b/policy-db-migrator/src/main/docker/config/clampacm/sql/1500/upgrade/0100-automationcomposition.sql @@ -17,4 +17,4 @@ * ============LICENSE_END========================================================= */ -ALTER TABLE automationcomposition ADD lastMsg datetime(6), ADD phase TINYINT; +ALTER TABLE automationcomposition ADD lastMsg datetime(6) DEFAULT Now(), ADD phase TINYINT; diff --git a/policy-db-migrator/src/main/docker/config/clampacm/sql/1500/upgrade/0200-automationcompositiondefinition.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1500/upgrade/0200-automationcompositiondefinition.sql index 0f0af093..5a0c05ad 100644 --- a/policy-db-migrator/src/main/docker/config/clampacm/sql/1500/upgrade/0200-automationcompositiondefinition.sql +++ b/policy-db-migrator/src/main/docker/config/clampacm/sql/1500/upgrade/0200-automationcompositiondefinition.sql @@ -17,4 +17,4 @@ * ============LICENSE_END========================================================= */ -ALTER TABLE automationcompositiondefinition ADD lastMsg datetime(6); +ALTER TABLE automationcompositiondefinition ADD lastMsg datetime(6) DEFAULT Now(); diff --git a/policy-db-migrator/src/main/docker/config/clampacm/sql/1600/downgrade/0100-automationcomposition.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1600/downgrade/0100-automationcomposition.sql new file mode 100644 index 00000000..f0897cfe --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/sql/1600/downgrade/0100-automationcomposition.sql @@ -0,0 +1,20 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 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========================================================= + */ + +ALTER TABLE automationcomposition DROP subState; diff --git a/policy-db-migrator/src/main/docker/config/clampacm/sql/1600/downgrade/0200-automationcompositionelement.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1600/downgrade/0200-automationcompositionelement.sql new file mode 100644 index 00000000..ef6f3c79 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/sql/1600/downgrade/0200-automationcompositionelement.sql @@ -0,0 +1,20 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 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========================================================= + */ + +ALTER TABLE automationcompositionelement DROP subState, DROP stage; diff --git a/policy-db-migrator/src/main/docker/config/clampacm/sql/1600/upgrade/0100-automationcomposition.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1600/upgrade/0100-automationcomposition.sql new file mode 100644 index 00000000..7e0fd078 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/sql/1600/upgrade/0100-automationcomposition.sql @@ -0,0 +1,20 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 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========================================================= + */ + +ALTER TABLE automationcomposition ADD subState TINYINT DEFAULT NULL NULL; diff --git a/policy-db-migrator/src/main/docker/config/clampacm/sql/1600/upgrade/0200-automationcompositionelement.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1600/upgrade/0200-automationcompositionelement.sql new file mode 100644 index 00000000..06ce9a9d --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/sql/1600/upgrade/0200-automationcompositionelement.sql @@ -0,0 +1,20 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 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========================================================= + */ + +ALTER TABLE automationcompositionelement ADD subState TINYINT DEFAULT NULL NULL, ADD stage TINYINT DEFAULT NULL NULL; diff --git a/policy-db-migrator/src/main/docker/config/operationshistory/postgres/1600/downgrade/0100-ophistory_id_sequence.sql b/policy-db-migrator/src/main/docker/config/operationshistory/postgres/1600/downgrade/0100-ophistory_id_sequence.sql new file mode 100644 index 00000000..a1af817d --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/operationshistory/postgres/1600/downgrade/0100-ophistory_id_sequence.sql @@ -0,0 +1,19 @@ +/* +* ============LICENSE_START======================================================= +* Copyright (C) 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========================================================= +*/ + +DROP TABLE IF EXISTS ophistory_id_sequence; diff --git a/policy-db-migrator/src/main/docker/config/operationshistory/postgres/1600/downgrade/0110-operationshistory.sql b/policy-db-migrator/src/main/docker/config/operationshistory/postgres/1600/downgrade/0110-operationshistory.sql new file mode 100644 index 00000000..eb348002 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/operationshistory/postgres/1600/downgrade/0110-operationshistory.sql @@ -0,0 +1,19 @@ +/* +* ============LICENSE_START======================================================= +* Copyright (C) 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========================================================= +*/ + +DROP TABLE IF EXISTS operationshistory; diff --git a/policy-db-migrator/src/main/docker/config/operationshistory/postgres/1600/upgrade/0100-ophistory_id_sequence.sql b/policy-db-migrator/src/main/docker/config/operationshistory/postgres/1600/upgrade/0100-ophistory_id_sequence.sql new file mode 100644 index 00000000..cbb775b0 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/operationshistory/postgres/1600/upgrade/0100-ophistory_id_sequence.sql @@ -0,0 +1,28 @@ +/* +* ============LICENSE_START======================================================= +* Copyright (C) 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========================================================= +*/ + +CREATE TABLE ophistory_id_sequence +( + SEQ_NAME VARCHAR(50) NOT NULL, + SEQ_COUNT BIGINT NOT NULL, + PRIMARY KEY (SEQ_NAME) +); + +-- Initialize the sequence +INSERT INTO ophistory_id_sequence (SEQ_NAME, SEQ_COUNT) +VALUES ('SEQ_GEN', 1); diff --git a/policy-db-migrator/src/main/docker/config/operationshistory/postgres/1600/upgrade/0110-operationshistory.sql b/policy-db-migrator/src/main/docker/config/operationshistory/postgres/1600/upgrade/0110-operationshistory.sql new file mode 100644 index 00000000..0515bcb7 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/operationshistory/postgres/1600/upgrade/0110-operationshistory.sql @@ -0,0 +1,36 @@ +/* +* ============LICENSE_START======================================================= +* Copyright (C) 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========================================================= +*/ + +CREATE TABLE operationshistory +( + id BIGINT NOT NULL, + closedLoopName VARCHAR(255), + requestId VARCHAR(50), + subrequestId VARCHAR(50), + actor VARCHAR(50), + operation VARCHAR(50), + target VARCHAR(50), + starttime TIMESTAMP, + outcome VARCHAR(50), + message VARCHAR(255), + endtime TIMESTAMP, + PRIMARY KEY (id) +); + +CREATE INDEX operationshistory_clreqid_index ON operationshistory (requestId, closedLoopName); +CREATE INDEX operationshistory_target_index ON operationshistory (target, operation, actor, endtime); diff --git a/policy-db-migrator/src/main/docker/config/operationshistory/sql/1600/downgrade/0100-ophistory_id_sequence.sql b/policy-db-migrator/src/main/docker/config/operationshistory/sql/1600/downgrade/0100-ophistory_id_sequence.sql new file mode 100644 index 00000000..a1af817d --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/operationshistory/sql/1600/downgrade/0100-ophistory_id_sequence.sql @@ -0,0 +1,19 @@ +/* +* ============LICENSE_START======================================================= +* Copyright (C) 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========================================================= +*/ + +DROP TABLE IF EXISTS ophistory_id_sequence; diff --git a/policy-db-migrator/src/main/docker/config/operationshistory/sql/1600/downgrade/0110-operationshistory.sql b/policy-db-migrator/src/main/docker/config/operationshistory/sql/1600/downgrade/0110-operationshistory.sql new file mode 100644 index 00000000..eb348002 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/operationshistory/sql/1600/downgrade/0110-operationshistory.sql @@ -0,0 +1,19 @@ +/* +* ============LICENSE_START======================================================= +* Copyright (C) 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========================================================= +*/ + +DROP TABLE IF EXISTS operationshistory; diff --git a/policy-db-migrator/src/main/docker/config/operationshistory/sql/1600/upgrade/0100-ophistory_id_sequence.sql b/policy-db-migrator/src/main/docker/config/operationshistory/sql/1600/upgrade/0100-ophistory_id_sequence.sql new file mode 100644 index 00000000..cbb775b0 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/operationshistory/sql/1600/upgrade/0100-ophistory_id_sequence.sql @@ -0,0 +1,28 @@ +/* +* ============LICENSE_START======================================================= +* Copyright (C) 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========================================================= +*/ + +CREATE TABLE ophistory_id_sequence +( + SEQ_NAME VARCHAR(50) NOT NULL, + SEQ_COUNT BIGINT NOT NULL, + PRIMARY KEY (SEQ_NAME) +); + +-- Initialize the sequence +INSERT INTO ophistory_id_sequence (SEQ_NAME, SEQ_COUNT) +VALUES ('SEQ_GEN', 1); diff --git a/policy-db-migrator/src/main/docker/config/operationshistory/sql/1600/upgrade/0110-operationshistory.sql b/policy-db-migrator/src/main/docker/config/operationshistory/sql/1600/upgrade/0110-operationshistory.sql new file mode 100644 index 00000000..d4e4aee2 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/operationshistory/sql/1600/upgrade/0110-operationshistory.sql @@ -0,0 +1,36 @@ +/* +* ============LICENSE_START======================================================= +* Copyright (C) 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========================================================= +*/ + +CREATE TABLE operationshistory ( + id BIGINT NOT NULL, + closedLoopName VARCHAR(255), + requestId VARCHAR(50), + subrequestId VARCHAR(50), + actor VARCHAR(50), + operation VARCHAR(50), + target VARCHAR(50), + starttime DATETIME, + outcome VARCHAR(50), + message VARCHAR(255), + endtime DATETIME, + PRIMARY KEY (id) +); + +CREATE INDEX operationshistory_clreqid_index ON operationshistory (requestId, closedLoopName); +CREATE INDEX operationshistory_target_index ON operationshistory (target, operation, actor, endtime); + diff --git a/policy-db-migrator/src/main/docker/config/pooling/postgres/1600/downgrade/0100-distributed.locking.sql b/policy-db-migrator/src/main/docker/config/pooling/postgres/1600/downgrade/0100-distributed.locking.sql new file mode 100644 index 00000000..fa213827 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/pooling/postgres/1600/downgrade/0100-distributed.locking.sql @@ -0,0 +1,21 @@ +/* +* ============LICENSE_START======================================================= +* feature-distributed-locking +* =============================================================================== +* Copyright (C) 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========================================================= +*/ + +DROP TABLE IF EXISTS locks; diff --git a/policy-db-migrator/src/main/docker/config/pooling/postgres/1600/upgrade/0100-distributed.locking.sql b/policy-db-migrator/src/main/docker/config/pooling/postgres/1600/upgrade/0100-distributed.locking.sql new file mode 100644 index 00000000..5df8a14f --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/pooling/postgres/1600/upgrade/0100-distributed.locking.sql @@ -0,0 +1,31 @@ +/* +* ============LICENSE_START======================================================= +* feature-distributed-locking +* =============================================================================== +* Copyright (C) 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========================================================= +*/ + +CREATE TABLE IF NOT EXISTS locks +( + resourceId VARCHAR(128) PRIMARY KEY, + host VARCHAR(128), + owner VARCHAR(128), + expirationTime TIMESTAMP DEFAULT '1971-01-01 00:00:00' +); + +-- Add indexes +CREATE INDEX idx_expirationTime ON locks(expirationTime); +CREATE INDEX idx_host ON locks(host); diff --git a/policy-db-migrator/src/main/docker/config/pooling/sql/1600/downgrade/0100-distributed.locking.sql b/policy-db-migrator/src/main/docker/config/pooling/sql/1600/downgrade/0100-distributed.locking.sql new file mode 100644 index 00000000..75676767 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/pooling/sql/1600/downgrade/0100-distributed.locking.sql @@ -0,0 +1,21 @@ +/* +* ============LICENSE_START======================================================= +* feature-distributed-locking +* ================================================================================ +* Copyright (C) 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========================================================= +*/ + +drop table if exists locks; diff --git a/policy-db-migrator/src/main/docker/config/pooling/sql/1600/upgrade/0100-distributed.locking.sql b/policy-db-migrator/src/main/docker/config/pooling/sql/1600/upgrade/0100-distributed.locking.sql new file mode 100644 index 00000000..e7250bac --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/pooling/sql/1600/upgrade/0100-distributed.locking.sql @@ -0,0 +1,32 @@ +/* +* ============LICENSE_START======================================================= +* feature-distributed-locking +* ================================================================================ +* Copyright (C) 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========================================================= +*/ + +SET foreign_key_checks=0; + +CREATE TABLE if NOT EXISTS locks( + resourceId VARCHAR(128), + host VARCHAR(128), + owner VARCHAR(128), + expirationTime TIMESTAMP DEFAULT '1971-01-01 00:00:00.000000', + PRIMARY KEY (resourceId), + INDEX idx_expirationTime(expirationTime), + INDEX idx_host(host)); + +SET foreign_key_checks=1; diff --git a/policy-db-migrator/src/main/docker/db-migrator b/policy-db-migrator/src/main/docker/db-migrator index 2261a394..4e1a3df7 100755 --- a/policy-db-migrator/src/main/docker/db-migrator +++ b/policy-db-migrator/src/main/docker/db-migrator @@ -41,7 +41,7 @@ # to be upgraded/downgraded. # # The repository of upgrade/downgrade scripts is located in the -# /home/${SQL_DB}/sql directory. +# /home/${SCHEMA}/sql directory. # Two additional scripts have been provided to prepare the directories/files # needed to perform the upgrade/downgrade. # diff --git a/policy-db-migrator/src/main/docker/db-migrator-pg b/policy-db-migrator/src/main/docker/db-migrator-pg index 49ed2e61..bfa8d4aa 100755 --- a/policy-db-migrator/src/main/docker/db-migrator-pg +++ b/policy-db-migrator/src/main/docker/db-migrator-pg @@ -3,8 +3,7 @@ # ============LICENSE_START======================================================= # ONAP # ================================================================================ -# Copyright (C) 2022 Nordix Foundation. -# Modification Copyright 2024 Nordix Foundation. +# Copyright (C) 2022, 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. @@ -41,7 +40,7 @@ # to be upgraded/downgraded. # # The repository of upgrade/downgrade scripts is located in the -# /home/${SQL_DB}/sql directory. +# /home/${SCHEMA}/sql directory. # Two additional scripts have been provided to prepare the directories/files # needed to perform the upgrade/downgrade. # @@ -111,7 +110,7 @@ function current_schema() { local rc local query="SELECT count(table_name) from information_schema.tables where table_schema='${SCHEMA}'" - PSQL="psql -h ${SQL_HOST} -U ${SQL_USER} -d ${SQL_DB}" + PSQL="psql -h ${SQL_HOST} -U ${SQL_USER} -w -d ${SCHEMA}" TABLES_IN_SCHEMA=$(${PSQL} -X -A --tuples-only --quiet --command "${query}") if [ ${TABLES_IN_SCHEMA} -gt 0 ] && [ "${BASE_VERSION}" \> "${CURRENT_RELEASE}" ]; then set_current_release "${BASE_VERSION}" @@ -133,13 +132,7 @@ function ensure_metadata() { local sql rc - PSQL="psql -h ${SQL_HOST} -U ${SQL_USER} -d ${METADATA_DB}" - sql="SELECT 'CREATE DATABASE migration' WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'migration');" - ${PSQL} --command "${sql}" - rc=$? - if [ ${rc} -ne 0 ]; then - return ${rc} - fi + PSQL="psql -h ${SQL_HOST} -U ${SQL_USER} -w -d ${METADATA_DB}" sql="CREATE TABLE IF NOT EXISTS ${METADATA_TABLE} " sql=${sql}"(name VARCHAR(60) NOT NULL, version VARCHAR(20), " @@ -160,7 +153,7 @@ function ensure_metadata_schema() { local sql rc - PSQL="psql -h ${SQL_HOST} -U ${SQL_USER} -d ${METADATA_DB}" + PSQL="psql -h ${SQL_HOST} -U ${SQL_USER} -w -d ${METADATA_DB}" sql="CREATE TABLE IF NOT EXISTS ${METADATA_HISTORY} " sql=${sql}"(ID bigserial, script VARCHAR(80) NOT NULL, " sql=${sql}"operation VARCHAR(10), from_version VARCHAR(20), to_version VARCHAR(20), tag VARCHAR(20), " @@ -170,10 +163,6 @@ function ensure_metadata_schema() { if [ ${rc} -ne 0 ]; then return ${rc} fi - - sql="SELECT 'CREATE DATABASE migration' WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'policyadmin');" - ${PSQL} --command "${sql}" - return $? } ##################################################### @@ -258,7 +247,7 @@ function set_current_release() { sql=${sql}"VALUES('${SCHEMA}', '${CURRENT_RELEASE}') " sql=${sql}"ON CONFLICT (name) DO UPDATE SET version='${CURRENT_RELEASE}';" - PSQL="psql -h ${SQL_HOST} -U ${SQL_USER} -d ${METADATA_DB}" + PSQL="psql -h ${SQL_HOST} -U ${SQL_USER} -w -d ${METADATA_DB}" ${PSQL} --command "${sql}" return $? } @@ -274,9 +263,9 @@ function current_release() { fi local rc - local query="SELECT version FROM schema_versions WHERE name='${SQL_DB}'" + local query="SELECT version FROM schema_versions WHERE name='${SCHEMA}'" - PSQL="psql -h ${SQL_HOST} -U ${SQL_USER} -d ${METADATA_DB}" + PSQL="psql -h ${SQL_HOST} -U ${SQL_USER} -w -d ${METADATA_DB}" CURRENT_RELEASE=$(${PSQL} -X -A -t --command "${query}") if [ -z "${CURRENT_RELEASE}" ]; then @@ -332,7 +321,7 @@ function last_operation_status() { query=${query}"(SELECT MAX(id) from ${METADATA_HISTORY}) " query=${query}"AND success::integer=0" - PSQL="psql -h ${SQL_HOST} -U ${SQL_USER} -d ${METADATA_DB}" + PSQL="psql -h ${SQL_HOST} -U ${SQL_USER} -w -d ${METADATA_DB}" row=$(${PSQL} --tuples-only --quiet --command "${query}") if [ "${row}" != "" ]; then @@ -367,7 +356,7 @@ function track_script() { local sql="INSERT INTO ${METADATA_HISTORY}(script,operation,from_version,to_version,tag,success,atTime) " sql=${sql}"VALUES ('${script}','${operation}','${from_version}','${to_version}','${tag}','${success}',now()) " - PSQL="psql -h ${SQL_HOST} -U ${SQL_USER} -d ${METADATA_DB}" + PSQL="psql -h ${SQL_HOST} -U ${SQL_USER} -w -d ${METADATA_DB}" ${PSQL} --command "${sql}" return $? } @@ -387,7 +376,7 @@ function run_script() { echo echo "> ${operation} ${script}" - PSQL="psql -h ${SQL_HOST} -U ${SQL_USER} -d ${SQL_DB}" + PSQL="psql -h ${SQL_HOST} -U ${SQL_USER} -w -d ${SCHEMA}" ${PSQL} <"${scriptPath}" local rc=$? if [ ${rc} -ne 0 ]; then @@ -510,7 +499,7 @@ function erase() { set -x fi - PSQL="psql -h ${SQL_HOST} -U ${SQL_USER} -d ${METADATA_DB}" + PSQL="psql -h ${SQL_HOST} -U ${SQL_USER} -w -d ${METADATA_DB}" local updateMetadata="UPDATE ${METADATA_TABLE} SET version='${ZERO_VERSION}';" ${PSQL} --command "${updateMetadata}" @@ -531,7 +520,7 @@ function report() { set -x fi - PSQL="psql -h ${SQL_HOST} -U ${SQL_USER} -d ${METADATA_DB}" + PSQL="psql -h ${SQL_HOST} -U ${SQL_USER} -w -d ${METADATA_DB}" local versionSql="SELECT * FROM ${METADATA_TABLE} WHERE name='${SCHEMA}';" ${PSQL} --command "${versionSql}" @@ -633,7 +622,7 @@ if [ -z "${SQL_HOST}" ] || [ -z "${SQL_USER}" ] || [ -z "${SQL_PASSWORD}" ]; the exit 4 fi -PSQL="psql -h ${SQL_HOST} -U ${SQL_USER} -d ${SQL_DB}" +PSQL="psql -h ${SQL_HOST} -U ${SQL_USER} -w -d ${SCHEMA}" if ! ${PSQL} --command '\l'; then echo "error: No DB connectivity to ${SQL_HOST} for ${SQL_USER}" exit 5 @@ -703,7 +692,7 @@ for dbPath in ${SCHEMA_S}; do fi fi - PSQL="psql -h ${SQL_HOST} -U ${SQL_USER} -d ${SQL_DB};" + PSQL="psql -h ${SQL_HOST} -U ${SQL_USER} -w -d ${SCHEMA};" # Check if the schema has already been installed current_schema RETRY=0 diff --git a/policy-jdk/alpine/pom.xml b/policy-jdk/alpine/pom.xml index ca310255..a6e47af0 100644 --- a/policy-jdk/alpine/pom.xml +++ b/policy-jdk/alpine/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.onap.policy.docker</groupId> <artifactId>policy-jdk</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>4.0.1-SNAPSHOT</version> </parent> <packaging>pom</packaging> diff --git a/policy-jdk/alpine/src/main/docker/Dockerfile b/policy-jdk/alpine/src/main/docker/Dockerfile index b0a73a9e..e868c5b3 100644 --- a/policy-jdk/alpine/src/main/docker/Dockerfile +++ b/policy-jdk/alpine/src/main/docker/Dockerfile @@ -1,7 +1,7 @@ # ============LICENSE_START======================================================= # Copyright (C) 2019 Tieto. All rights reserved. # Modifications Copyright (C) 2020, 2021 AT&T Intellectual Property. All rights reserved. -# Modifications Copyright (C) 2020, 2022-2023 Nordix Foundation. +# Modifications Copyright (C) 2020, 2022-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. @@ -18,7 +18,7 @@ # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END========================================================= -FROM alpine:3.18.2 +FROM alpine:3.20.3 LABEL maintainer="Policy Team" LABEL org.opencontainers.image.title="Policy JRE Alpine" @@ -75,16 +75,15 @@ RUN apk update && \ adduser -S --shell /bin/sh -G policy policy && \ mkdir -p ${POLICY_HOME}/ && \ chown policy:policy ${POLICY_HOME} && \ - mkdir -p /usr/lib/jvm/ && \ - ln -s /opt/java/openjdk /usr/lib/jvm/default-jvm && \ - python3 -m ensurepip && \ - pip3 install --no-cache --upgrade pip setuptools + mkdir -p /usr/lib/jvm/ && ln -s /opt/java/openjdk /usr/lib/jvm/default-jvm # Install python/pip -RUN apk add --update --no-cache python3 && ln -sf python3 /usr/bin/python -RUN python3 -m ensurepip -RUN pip3 install --no-cache --upgrade pip setuptools - +RUN apk add --no-cache python3 && \ + rm /usr/lib/python3.*/EXTERNALLY-MANAGED && \ + if [ ! -e /usr/bin/python ]; then ln -sf python3 /usr/bin/python ; fi && \ + python -m ensurepip && \ + if [ ! -e /usr/bin/pip ]; then ln -s pip3 /usr/bin/pip ; fi && \ + pip install --no-cache --upgrade pip setuptools # Tell docker that all future commands should be run as the onap user USER $user diff --git a/policy-jdk/pom.xml b/policy-jdk/pom.xml index 410ec374..dced9b41 100644 --- a/policy-jdk/pom.xml +++ b/policy-jdk/pom.xml @@ -24,7 +24,7 @@ <parent> <groupId>org.onap.policy.docker</groupId> <artifactId>docker</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>4.0.1-SNAPSHOT</version> </parent> <artifactId>policy-jdk</artifactId> diff --git a/policy-jre/alpine/pom.xml b/policy-jre/alpine/pom.xml index 9d60d4b0..a1fb46d7 100644 --- a/policy-jre/alpine/pom.xml +++ b/policy-jre/alpine/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.onap.policy.docker</groupId> <artifactId>policy-jre</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>4.0.1-SNAPSHOT</version> </parent> <packaging>pom</packaging> diff --git a/policy-jre/alpine/src/main/docker/Dockerfile b/policy-jre/alpine/src/main/docker/Dockerfile index d8af19f8..c5c0273d 100644 --- a/policy-jre/alpine/src/main/docker/Dockerfile +++ b/policy-jre/alpine/src/main/docker/Dockerfile @@ -1,7 +1,7 @@ # ============LICENSE_START======================================================= # Copyright (C) 2019 Tieto. All rights reserved. # Modifications Copyright (C) 2020, 2021 AT&T Intellectual Property. All rights reserved. -# Modifications Copyright (C) 2020, 2022-2023 Nordix Foundation. +# Modifications Copyright (C) 2020, 2022-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. @@ -18,7 +18,7 @@ # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END========================================================= -FROM alpine:3.18.2 +FROM alpine:3.20.3 LABEL maintainer="Policy Team" LABEL org.opencontainers.image.title="Policy JRE Alpine" diff --git a/policy-jre/pom.xml b/policy-jre/pom.xml index eeaff490..57f39c29 100644 --- a/policy-jre/pom.xml +++ b/policy-jre/pom.xml @@ -24,7 +24,7 @@ <parent> <groupId>org.onap.policy.docker</groupId> <artifactId>docker</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>4.0.1-SNAPSHOT</version> </parent> <artifactId>policy-jre</artifactId> diff --git a/policy-regression-tests/pom.xml b/policy-regression-tests/pom.xml index d0dcdade..ffc5176b 100644 --- a/policy-regression-tests/pom.xml +++ b/policy-regression-tests/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>org.onap.policy.docker</groupId> <artifactId>docker</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>4.0.1-SNAPSHOT</version> </parent> <groupId>org.onap.policy.regression</groupId> @@ -25,13 +25,13 @@ <parent> <groupId>org.onap.policy.parent</groupId> <artifactId>integration</artifactId> - <version>5.0.0-SNAPSHOT</version> + <version>5.0.1-SNAPSHOT</version> <relativePath /> </parent> <groupId>org.onap.policy.docker</groupId> <artifactId>docker</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>4.0.1-SNAPSHOT</version> <packaging>pom</packaging> <name>policy-docker</name> diff --git a/releases/4.0.0-container.yaml b/releases/4.0.0-container.yaml new file mode 100644 index 00000000..bab7d393 --- /dev/null +++ b/releases/4.0.0-container.yaml @@ -0,0 +1,12 @@ +distribution_type: 'container' +container_release_tag: '4.0.0' +project: 'policy-docker' +log_dir: 'policy-docker-maven-docker-stage-master/1047' +ref: 8e03046e2b07df88c2356c86116111d8fb22dc6a +containers: + - name: 'policy-jre-alpine' + version: '4.0.0-20240712T0754' + - name: 'policy-jdk-alpine' + version: '4.0.0-20240712T0754' + - name: 'policy-db-migrator' + version: '4.0.0-20240712T0754' diff --git a/version.properties b/version.properties index 19e0714b..bac52448 100644 --- a/version.properties +++ b/version.properties @@ -4,7 +4,7 @@ major=4 minor=0 -patch=0 +patch=1 base_version=${major}.${minor}.${patch} |