summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoradheli.tavares <adheli.tavares@est.tech>2024-08-15 12:39:19 +0100
committerAdheli Tavares <adheli.tavares@est.tech>2024-08-26 08:21:39 +0000
commitd802fd9a6c6aaffa330a30b68f7896ffebaa4fcd (patch)
tree823eb915f6322a38477d971273a0e43713ce0d06
parent10cf66cdd2cca12dad9f299714e6294ae35752a7 (diff)
Change default database to PostgreSQL
Issue-ID: POLICY-5118 Change-Id: I22ece93aca3cbc5e406e4942ce5255a7b7b60761 Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
-rw-r--r--compose/README.md59
-rw-r--r--compose/compose.acm.scale.yml (renamed from compose/docker-compose.acm.scale.yml)80
-rw-r--r--compose/compose.common.yml143
-rw-r--r--compose/compose.mariadb.yml54
-rw-r--r--compose/compose.pdp.scale.yml (renamed from compose/docker-compose.pdp.scale.yml)51
-rw-r--r--compose/compose.postgres.yml56
-rw-r--r--compose/compose.yaml (renamed from compose/docker-compose.yml)321
-rw-r--r--compose/config/api/apiParameters.yaml30
-rw-r--r--compose/config/api/apiParametersPostgres.yaml84
-rw-r--r--compose/config/clamp/AcRuntimeParameters.yaml27
-rw-r--r--compose/config/clamp/policy-clamp-create-tables.sql275
-rwxr-xr-xcompose/config/db-migrator/init.sh19
-rwxr-xr-xcompose/config/db-migrator/init_pg.sh23
-rw-r--r--compose/config/db-pg/db-pg.conf11
-rwxr-xr-xcompose/config/db-pg/db-pg.sh7
-rwxr-xr-xcompose/config/db/db.sh3
-rw-r--r--compose/config/drools-applications/env/base-mariadb.conf (renamed from compose/config/drools-applications/env/base.conf)1
-rw-r--r--compose/config/drools-applications/env/base-postgres.conf148
-rw-r--r--compose/config/drools-pdp/env/base-mariadb.conf (renamed from compose/config/drools-pdp/env/base.conf)0
-rw-r--r--compose/config/drools-pdp/env/base-postgres.conf138
-rw-r--r--compose/config/pap/papParameters.yaml25
-rw-r--r--compose/config/pap/papParametersPostgres.yaml88
-rw-r--r--compose/config/policy-gui/application.yaml37
-rw-r--r--compose/config/policy-gui/groups.json137
-rw-r--r--compose/config/policy-gui/logback.xml119
-rw-r--r--compose/config/xacml-pdp/xacml-mariadb.properties54
-rw-r--r--compose/config/xacml-pdp/xacml-postgres.properties54
-rw-r--r--compose/docker-compose.postgres.yml194
-rwxr-xr-xcompose/export-ports.sh13
-rwxr-xr-xcompose/get-versions.sh8
-rwxr-xr-xcompose/start-acm-replica.sh60
-rwxr-xr-xcompose/start-compose.sh39
-rwxr-xr-xcompose/start-multiple-pdp.sh62
-rw-r--r--compose/start-postgres-tests.sh37
-rwxr-xr-xcompose/stop-compose.sh34
-rwxr-xr-xcsit/resources/scripts/wait_for_rest.sh2
-rw-r--r--csit/resources/tests/drools-applications-test.robot7
-rwxr-xr-xcsit/run-acm-regression.sh13
-rwxr-xr-xcsit/run-project-csit.sh124
-rwxr-xr-xpolicy-db-migrator/src/main/docker/db-migrator-pg37
40 files changed, 1232 insertions, 1442 deletions
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/docker-compose.acm.scale.yml b/compose/compose.acm.scale.yml
index 676ffa2d..ee6679b2 100644
--- a/compose/docker-compose.acm.scale.yml
+++ b/compose/compose.acm.scale.yml
@@ -16,24 +16,89 @@
# ============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-clamp
+ - 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
- - apex-pdp
expose:
- 6969
deploy:
mode: replicated
- replicas: ${REPLICAS}
+ replicas: ${REPLICAS:-2}
environment:
OTEL_SERVICE_NAME: acm-r
OTEL_EXPORTER_OTLP_PROTOCOL: http/protobuf
@@ -51,7 +116,7 @@ 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',
@@ -68,7 +133,7 @@ services:
- 6969
deploy:
mode: replicated
- replicas: ${REPLICAS}
+ replicas: ${REPLICAS:-2}
environment:
OTEL_SERVICE_NAME: http-ppnt
OTEL_EXPORTER_OTLP_PROTOCOL: http/protobuf
@@ -99,7 +164,7 @@ services:
- 6969
deploy:
mode: replicated
- replicas: ${REPLICAS}
+ 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
@@ -120,7 +185,7 @@ services:
- 6969
deploy:
mode: replicated
- replicas: ${REPLICAS}
+ replicas: ${REPLICAS:-2}
environment:
OTEL_SERVICE_NAME: policy-ppnt
OTEL_EXPORTER_OTLP_PROTOCOL: http/protobuf
@@ -144,4 +209,3 @@ services:
- 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..40404c85
--- /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: 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 242cb3d8..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,4 +91,4 @@ services:
- apexpdp
ports:
- ${APEX_PORT}:${APEX_PORT}
-
+ - ${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 afa05bf8..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:
@@ -290,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:
@@ -323,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
@@ -348,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
@@ -375,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
@@ -399,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
@@ -423,95 +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_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'
- ]
- 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:1.58
- 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 f2ef511a..387e6ffe 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/policyadmin
+ driverClassName: org.postgresql.Driver
username: policy_user
password: policy_user
hikari:
@@ -20,7 +20,7 @@ spring:
maximumPoolSize: 10
jpa:
hibernate:
- ddl-auto: none
+ ddl-auto: update
naming:
physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
implicit-strategy: org.onap.policy.common.spring.utils.CustomImplicitNamingStrategy
@@ -96,26 +96,19 @@ 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
---
+# legacy config
spring:
config:
@@ -144,3 +137,13 @@ runtime:
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/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 4ac3330c..b7e2c8f7 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
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..1e82d0e2
--- /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=unauthenticated.dcae_cl_output
+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..0e0156bd 100644
--- a/compose/config/drools-pdp/env/base.conf
+++ b/compose/config/drools-pdp/env/base-mariadb.conf
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..a883f3f8
--- /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=unauthenticated.dcae_cl_output
+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/pap/papParameters.yaml b/compose/config/pap/papParameters.yaml
index 5b6c640e..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:
@@ -85,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.postgres.yml b/compose/docker-compose.postgres.yml
deleted file mode 100644
index ca96f562..00000000
--- a/compose/docker-compose.postgres.yml
+++ /dev/null
@@ -1,194 +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/${component}/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'
- ]
- xacml-pdp:
- image: ${CONTAINER_LOCATION}onap/policy-xacml-pdp:${POLICY_XACML_PDP_VERSION}
- container_name: policy-xacml-pdp
- hostname: policy-xacml-pdp
- depends_on:
- - postgres
- - kafka
- - pap
- 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
- - ./wait_for_port.sh:/opt/app/policy/pdpx/bin/wait_for_port.sh:ro
- entrypoint: ./wait_for_port.sh
- command: [
- '-c', './policy-pdpx-pg.sh',
- '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
- container_name: zookeeper
- 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 6eaaedb8..8dd2c163 100755
--- a/compose/export-ports.sh
+++ b/compose/export-ports.sh
@@ -17,19 +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.*$//'
- )
- export LOCAL_IMAGES="true"
-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 a51ccef9..0e8f251e 100755
--- a/compose/get-versions.sh
+++ b/compose/get-versions.sh
@@ -25,11 +25,13 @@ if [ -z "${WORKSPACE}" ]; then
export WORKSPACE
fi
+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}
if [ -n "$LOCAL_IMAGES" ] && [ "$LOCAL_IMAGES" = "true" ]; then
@@ -45,8 +47,10 @@ if [ -n "$LOCAL_IMAGES" ] && [ "$LOCAL_IMAGES" = "true" ]; then
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)
@@ -123,7 +127,7 @@ else
getDockerVersion docker
export POLICY_DOCKER_VERSION="$docker_image_version"
- getDockerVersion models "'policy-models-simulator'" 3.0.1
+ getDockerVersion models
export POLICY_MODELS_VERSION="$docker_image_version"
getDockerVersion api
diff --git a/compose/start-acm-replica.sh b/compose/start-acm-replica.sh
index 373261e6..a9e95b88 100755
--- a/compose/start-acm-replica.sh
+++ b/compose/start-acm-replica.sh
@@ -18,15 +18,41 @@
# 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
-if [ -z "$ROBOT_LOG_DIR" ]; then
- export ROBOT_LOG_DIR=/tmp/
-fi
-
COMPOSE_FOLDER="${WORKSPACE}"/compose
cd ${COMPOSE_FOLDER}
@@ -35,6 +61,28 @@ 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.acm.scale.yml up -d nginx
+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 671927ba..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,6 +33,7 @@ COMPOSE_FOLDER="${WORKSPACE}"/compose
# Set default values for the options
grafana=false
+database=postgres
# Parse the command-line arguments
while [[ $# -gt 0 ]]
@@ -43,6 +45,14 @@ do
grafana=true
shift
;;
+ --mariadb)
+ database=mariadb
+ shift
+ ;;
+ --postgres)
+ database=postgres
+ shift
+ ;;
*)
component="$1"
shift
@@ -61,30 +71,23 @@ 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
-
-# always 'docker' if running docker compose
-export TEST_ENV="docker"
+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}"
+
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
- echo "Starting all components..."
+ echo "Starting all components using ${database}"
docker compose up -d
fi
diff --git a/compose/start-multiple-pdp.sh b/compose/start-multiple-pdp.sh
index b97760e7..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,23 +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
-if [ -z "$ROBOT_LOG_DIR" ]; then
- export ROBOT_LOG_DIR=/tmp/
-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}
diff --git a/compose/start-postgres-tests.sh b/compose/start-postgres-tests.sh
deleted file mode 100644
index 2d695911..00000000
--- a/compose/start-postgres-tests.sh
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/bash
-#
-# ============LICENSE_START====================================================
-# Copyright (C) 2023-2024 Nordix Foundation.
-# =============================================================================
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# SPDX-License-Identifier: Apache-2.0
-# ============LICENSE_END======================================================
-
-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 component=${1}
-export REPLICAS=${2}
-docker-compose -f docker-compose.postgres.yml up -d ${component} prometheus
-
-cd ${WORKSPACE} \ No newline at end of file
diff --git a/compose/stop-compose.sh b/compose/stop-compose.sh
index 493f9b57..5811a3e1 100755
--- a/compose/stop-compose.sh
+++ b/compose/stop-compose.sh
@@ -24,14 +24,30 @@ if [ -z "${WORKSPACE}" ]; then
export WORKSPACE
fi
-# always 'docker' if running docker compose
-export TEST_ENV="docker"
-
-# 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
@@ -44,6 +60,8 @@ source get-versions.sh > /dev/null 2>&1
echo "Collecting logs from docker compose containers..."
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}}')
diff --git a/csit/resources/scripts/wait_for_rest.sh b/csit/resources/scripts/wait_for_rest.sh
index e400bbd4..ce47d600 100755
--- a/csit/resources/scripts/wait_for_rest.sh
+++ b/csit/resources/scripts/wait_for_rest.sh
@@ -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=$?
diff --git a/csit/resources/tests/drools-applications-test.robot b/csit/resources/tests/drools-applications-test.robot
index 3c4303ad..8b0a3694 100644
--- a/csit/resources/tests/drools-applications-test.robot
+++ b/csit/resources/tests/drools-applications-test.robot
@@ -69,10 +69,9 @@ DeployDroolsPolicies
[Documentation] Deploys the Policies to Drools
DeployPolicy deploy.drools.policies.json
Sleep 5s
- ${result}= CheckKafkaTopic policy-notification operational.modifyconfig
- Should Contain ${result} deployed-policies
- Should Contain ${result} operational.scaleout
- Should Contain ${result} operational.restart
+ @{otherMessages}= Create List deployed-policies operational.scaleout operational.restart
+ AssertMessageFromTopic policy-notification operational.modifyconfig ${otherMessages}
+
#VcpeExecute
# [Documentation] Executes VCPE Policy
diff --git a/csit/run-acm-regression.sh b/csit/run-acm-regression.sh
index 2c91bcb4..19160027 100755
--- a/csit/run-acm-regression.sh
+++ b/csit/run-acm-regression.sh
@@ -67,10 +67,6 @@ if [ -z "${WORKSPACE}" ]; then
export WORKSPACE
fi
-if [ -z "$ROBOT_LOG_DIR" ]; then
- export ROBOT_LOG_DIR=/tmp/
-fi
-
export SCRIPTS="${WORKSPACE}/csit/resources/scripts"
COMPOSE_FOLDER="${WORKSPACE}"/compose
REGRESSION_FOLDER="${WORKSPACE}"/policy-regression-tests/policy-clamp-regression/
@@ -128,7 +124,9 @@ cd ${COMPOSE_FOLDER}
docker login -u docker -p docker nexus3.onap.org:10001 > /dev/null 2>&1
source export-ports.sh > /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}"
@@ -138,3 +136,8 @@ cd ${REGRESSION_FOLDER}
# Invoke the regression test cases
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-project-csit.sh b/csit/run-project-csit.sh
index cbb62e6d..409209fd 100755
--- a/csit/run-project-csit.sh
+++ b/csit/run-project-csit.sh
@@ -33,7 +33,7 @@ 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
@@ -42,66 +42,65 @@ function docker_stats(){
function setup_clamp() {
export ROBOT_FILES="policy-clamp-test.robot clamp-slas.robot"
- source "${WORKSPACE}"/compose/start-compose.sh policy-clamp-runtime-acm --grafana
+ source ${DOCKER_COMPOSE_DIR}/start-compose.sh policy-clamp-runtime-acm --grafana
sleep 30
- bash "${SCRIPTS}"/wait_for_rest.sh localhost "${ACM_PORT}"
+ bash ${SCRIPTS}/wait_for_rest.sh localhost "${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-acm-replica.sh 2
- 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
+ bash ${SCRIPTS}/wait_for_rest.sh localhost ${APEX_PORT}
+ apex_healthcheck
+ bash ${SCRIPTS}/wait_for_rest.sh localhost ${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}
+ bash ${SCRIPTS}/wait_for_rest.sh localhost ${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}
+ bash ${SCRIPTS}/wait_for_rest.sh localhost ${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 apex-pdp 1
- sleep 10
- bash "${SCRIPTS}"/wait_for_rest.sh localhost ${PAP_PORT}
- bash "${SCRIPTS}"/wait_for_rest.sh localhost ${APEX_PORT}
+ bash ${SCRIPTS}/wait_for_rest.sh localhost ${PAP_PORT}
+ bash ${SCRIPTS}/wait_for_rest.sh localhost ${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}
+ bash ${SCRIPTS}/wait_for_rest.sh localhost ${PAP_PORT}
+ bash ${SCRIPTS}/wait_for_rest.sh localhost ${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}
+ bash ${SCRIPTS}/wait_for_rest.sh localhost ${PAP_PORT}
+ bash ${SCRIPTS}/wait_for_rest.sh localhost ${APEX_PORT}
apex_healthcheck
}
@@ -125,57 +124,49 @@ function apex_healthcheck() {
function setup_drools_apps() {
export ROBOT_FILES="drools-applications-test.robot"
- source "${WORKSPACE}"/compose/start-compose.sh drools-applications
+ source ${DOCKER_COMPOSE_DIR}/start-compose.sh drools-applications
sleep 10
- bash "${SCRIPTS}"/wait_for_rest.sh localhost ${PAP_PORT}
+ bash ${SCRIPTS}/wait_for_rest.sh localhost ${PAP_PORT}
sleep 10
- bash "${SCRIPTS}"/wait_for_rest.sh localhost ${DROOLS_APPS_PORT}
+ bash ${SCRIPTS}/wait_for_rest.sh localhost ${DROOLS_APPS_PORT}
sleep 10
- bash "${SCRIPTS}"/wait_for_rest.sh localhost ${DROOLS_APPS_TELEMETRY_PORT}
+ bash ${SCRIPTS}/wait_for_rest.sh localhost ${DROOLS_APPS_TELEMETRY_PORT}
}
function setup_xacml_pdp() {
export ROBOT_FILES="xacml-pdp-test.robot"
- source "${WORKSPACE}"/compose/start-compose.sh xacml-pdp
+ source ${DOCKER_COMPOSE_DIR}/start-compose.sh xacml-pdp
sleep 10
- bash "${SCRIPTS}"/wait_for_rest.sh localhost "${XACML_PORT}"
-}
-
-function setup_xacml_pdp_postgres() {
- export ROBOT_FILES="xacml-pdp-test.robot"
- source "${WORKSPACE}"/compose/start-postgres-tests.sh xacml-pdp 1
- sleep 10
- bash "${SCRIPTS}"/wait_for_rest.sh localhost "${XACML_PORT}"
+ bash ${SCRIPTS}/wait_for_rest.sh localhost "${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
sleep 30
- bash "${SCRIPTS}"/wait_for_rest.sh localhost ${DROOLS_TELEMETRY_PORT}
+ bash ${SCRIPTS}/wait_for_rest.sh localhost ${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
sleep 10
- bash "${SCRIPTS}"/wait_for_rest.sh localhost "${DIST_PORT}"
+ bash ${SCRIPTS}/wait_for_rest.sh localhost "${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=$?
}
@@ -204,7 +195,7 @@ function set_project_config() {
;;
apex-pdp-postgres | policy-apex-pdp-postgres)
- setup_apex_postgres
+ setup_apex
;;
apex-pdp-medium | policy-apex-pdp-medium)
@@ -219,10 +210,6 @@ function set_project_config() {
setup_xacml_pdp
;;
- xacml-pdp-postgres | policy-xacml-pdp-postgres)
- setup_xacml_pdp_postgres
- ;;
-
drools-pdp | policy-drools-pdp)
setup_drools_pdp
;;
@@ -244,9 +231,18 @@ function set_project_config() {
# 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}
+ 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
}
@@ -261,11 +257,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=""
-# always 'docker' if running docker compose
-export TEST_ENV="docker"
+export ACM_REPLICA_TEARDOWN=false
+export APEX_REPLICA_TEARDOWN=false
cd "${WORKSPACE}"
@@ -284,7 +282,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
@@ -301,9 +299,9 @@ 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/policy-db-migrator/src/main/docker/db-migrator-pg b/policy-db-migrator/src/main/docker/db-migrator-pg
index e282f47b..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.
@@ -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 ${SCHEMA}"
+ 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 $?
}
@@ -276,7 +265,7 @@ function current_release() {
local rc
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 ${SCHEMA}"
+ 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 ${SCHEMA}"
+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 ${SCHEMA};"
+ PSQL="psql -h ${SQL_HOST} -U ${SQL_USER} -w -d ${SCHEMA};"
# Check if the schema has already been installed
current_schema
RETRY=0