#!/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.
 
 # Install JMeter
 mkdir -p ~/jmeter
-wget https://dlcdn.apache.org//jmeter/binaries/apache-jmeter-5.5.zip # check if valid version
+wget https://archive.apache.org/dist/jmeter/binaries/apache-jmeter-5.5.zip # check if valid version
 unzip -q -d ~/jmeter apache-jmeter-5.5.zip
 rm apache-jmeter-5.5.zip
 
 
     "topicParameterGroup": {
         "topicSources": [
             {
-                "topic": "POLICY-PDP-PAP",
+                "topic": "policy-pdp-pap",
                 "servers": [
-                    "message-router:3904"
+                    "kafka:9092"
                 ],
-                "topicCommInfrastructure": "dmaap"
+                "fetchTimeout": 15000,
+                "topicCommInfrastructure": "kafka"
             }
         ],
         "topicSinks": [
             {
-                "topic": "POLICY-PDP-PAP",
+                "topic": "policy-pdp-pap",
                 "servers": [
-                    "message-router:3904"
+                    "kafka:9092"
                 ],
-                "topicCommInfrastructure": "dmaap"
+                "topicCommInfrastructure": "kafka"
             }
         ]
     }
 
     username: policy_user
     password: policy_user
   jpa:
-    properties:
-      hibernate:
-        dialect: org.hibernate.dialect.MariaDB103Dialect
     hibernate:
       ddl-auto: none
       naming:
   name: PapGroup
   aaf: false
   topic:
-    pdp-pap.name: POLICY-PDP-PAP
-    notification.name: POLICY-NOTIFICATION
-    heartbeat.name: POLICY-HEARTBEAT
+    pdp-pap.name: policy-pdp-pap
+    notification.name: policy-notification
+    heartbeat.name: policy-heartbeat
   pdpParameters:
     heartBeatMs: 120000
     updateParameters:
   savePdpStatisticsInDb: true
   topicParameterGroup:
     topicSources:
-      - topic: POLICY-PDP-PAP
+      - topic: ${pap.topic.pdp-pap.name}
         servers:
-          - message-router
-        topicCommInfrastructure: dmaap
+          - kafka:9092
+        topicCommInfrastructure: kafka
         useHttps: false
         fetchTimeout: 15000
-      - topic: POLICY-HEARTBEAT
-        effectiveTopic: POLICY-PDP-PAP
+      - topic: ${pap.topic.heartbeat.name}
+        effectiveTopic: ${pap.topic.pdp-pap.name}
         consumerGroup: policy-pap
         servers:
-          - message-router
-        topicCommInfrastructure: dmaap
+          - kafka:9092
+        topicCommInfrastructure: kafka
         useHttps: false
         fetchTimeout: 15000
     topicSinks:
-      - topic: POLICY-PDP-PAP
+      - topic: ${pap.topic.pdp-pap.name}
         servers:
-          - message-router
-        topicCommInfrastructure: dmaap
+          - kafka:9092
+        topicCommInfrastructure: kafka
         useHttps: false
-      - topic: POLICY-NOTIFICATION
+      - topic: ${pap.topic.notification.name}
         servers:
-          - message-router
-        topicCommInfrastructure: dmaap
+          - kafka:9092
+        topicCommInfrastructure: kafka
         useHttps: false
   healthCheckRestClientParameters:
     - clientName: api
         include: health, metrics, prometheus
       path-mapping:
         -metrics: plain-metrics
-        -prometheus: metrics
\ No newline at end of file
+        -prometheus: metrics
 
 # ============LICENSE_START=======================================================
-# Copyright (C) 2021-2023 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.
       '/opt/app/policy/bin/db_migrator_policy_init.sh',
       'mariadb', '3306'
     ]
-  simulator:
-    image: nexus3.onap.org:10001/onap/policy-models-simulator:${POLICY_MODELS_SIMULATOR}
-    container_name: simulator
-    hostname: simulator
-    networks:
-      default:
-        aliases:
-          - message-router
-    expose:
-      - 3904
-    volumes:
-      - ./config/jsonConfigs/dmaapSimConfig.json:/opt/app/policy/simulators/etc/mounted/simParameters.json:ro
+
   pdp:
     image: pdp/simulator
     container_name: pdp-simulator
     depends_on:
-      - simulator
+      - kafka
     hostname: pdp-simulator
     volumes:
       - ./config/wait_for_port.sh:/opt/app/policy/pdp-sim/bin/wait_for_port.sh:ro
       - 6969
     depends_on:
       - policy-db-migrator
-      - simulator
+      - kafka
       - policy-api
     volumes:
       - ./config/wait_for_port.sh:/opt/app/policy/pap/bin/wait_for_port.sh:ro
     command: [
       '-c', './policy-pap.sh',
       'mariadb', '3306',
-      'message-router', '3904',
+      'kafka', '9092',
       'policy-api', '6969'
     ]
   policy-dist:
     command: [
       '-c', './policy-dist.sh',
       'mariadb', '3306',
-      'message-router', '3904',
+      'kafka', '9092',
       'policy-api', '6969',
       'policy-pap', '6969'
     ]
+
+  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