From dfc5d564659ea5faccceaf5ecb7eb6fbc54bd701 Mon Sep 17 00:00:00 2001 From: rameshiyer27 Date: Mon, 29 Jan 2024 17:51:52 +0000 Subject: Remove Dmaap from PAP Issue-ID: POLICY-4402 Signed-off-by: rameshiyer27 Change-Id: Ib1715bde8b4d0ca78b3c74c62784d5579900c2d4 --- .../pap/main/rest/DmaapGetTopicResponse.java | 37 --------------------- .../pap/main/rest/KafkaGetTopicResponse.java | 38 ++++++++++++++++++++++ .../rest/PolicyComponentsHealthCheckProvider.java | 18 +++++----- main/src/main/resources/application.yaml | 20 ++++++------ .../TestPolicyComponentsHealthCheckProvider.java | 20 ++++++------ .../policy/pap/main/rest/e2e/End2EndContext.java | 4 +-- main/src/test/resources/application-test-e2e.yaml | 4 +-- .../resources/parameters/MinimumParameters.json | 8 ++--- .../resources/parameters/PapConfigParameters.json | 4 +-- .../parameters/PapConfigParametersStd.json | 8 ++--- .../parameters/PapConfigParameters_Postgres.json | 6 ++-- .../src/main/resources/etc/papParameters.yaml | 20 ++++++------ .../papsetup/config/pap/etc/defaultConfig.json | 8 ++--- 13 files changed, 98 insertions(+), 97 deletions(-) delete mode 100644 main/src/main/java/org/onap/policy/pap/main/rest/DmaapGetTopicResponse.java create mode 100644 main/src/main/java/org/onap/policy/pap/main/rest/KafkaGetTopicResponse.java diff --git a/main/src/main/java/org/onap/policy/pap/main/rest/DmaapGetTopicResponse.java b/main/src/main/java/org/onap/policy/pap/main/rest/DmaapGetTopicResponse.java deleted file mode 100644 index 82886509..00000000 --- a/main/src/main/java/org/onap/policy/pap/main/rest/DmaapGetTopicResponse.java +++ /dev/null @@ -1,37 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2021 Bell Canada. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.pap.main.rest; - -import java.util.List; -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; - -/** - * Class to capture get topic response from dmaap. - */ -@Getter -@Setter -@ToString -public class DmaapGetTopicResponse { - - private List topics; -} diff --git a/main/src/main/java/org/onap/policy/pap/main/rest/KafkaGetTopicResponse.java b/main/src/main/java/org/onap/policy/pap/main/rest/KafkaGetTopicResponse.java new file mode 100644 index 00000000..dd63a507 --- /dev/null +++ b/main/src/main/java/org/onap/policy/pap/main/rest/KafkaGetTopicResponse.java @@ -0,0 +1,38 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2021 Bell Canada. All rights reserved. + * Modifications Copyright (C) 2024 Nordix Foundation. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.pap.main.rest; + +import java.util.List; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +/** + * Class to capture get topic response from kafka. + */ +@Getter +@Setter +@ToString +public class KafkaGetTopicResponse { + + private List topics; +} diff --git a/main/src/main/java/org/onap/policy/pap/main/rest/PolicyComponentsHealthCheckProvider.java b/main/src/main/java/org/onap/policy/pap/main/rest/PolicyComponentsHealthCheckProvider.java index 02d27605..32d43143 100644 --- a/main/src/main/java/org/onap/policy/pap/main/rest/PolicyComponentsHealthCheckProvider.java +++ b/main/src/main/java/org/onap/policy/pap/main/rest/PolicyComponentsHealthCheckProvider.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019-2020, 2022-2023 Nordix Foundation. + * Copyright (C) 2019-2020, 2022-2024 Nordix Foundation. * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2020-2022 Bell Canada. All rights reserved. * ================================================================================ @@ -204,8 +204,8 @@ public class PolicyComponentsHealthCheckProvider { HealthCheckReport clientReport; try { Response resp = httpClient.get(); - if (httpClient.getName().equalsIgnoreCase("dmaap")) { - clientReport = verifyDmaapClient(httpClient, resp); + if (httpClient.getName().equalsIgnoreCase("kafka")) { + clientReport = verifyKafkaClient(httpClient, resp); } else { clientReport = replaceIpWithHostname(resp.readEntity(HealthCheckReport.class), httpClient.getBaseUrl()); } @@ -244,12 +244,12 @@ public class PolicyComponentsHealthCheckProvider { return report; } - private HealthCheckReport verifyDmaapClient(HttpClient httpClient, Response resp) { - DmaapGetTopicResponse dmaapResponse = resp.readEntity(DmaapGetTopicResponse.class); - var topicVerificationStatus = (dmaapResponse.getTopics() != null - && dmaapResponse.getTopics().contains(topicPolicyPdpPap)); - String message = (topicVerificationStatus ? "PAP to DMaaP connection check is successful" - : "PAP to DMaaP connection check failed"); + private HealthCheckReport verifyKafkaClient(HttpClient httpClient, Response resp) { + KafkaGetTopicResponse kafkaResponse = resp.readEntity(KafkaGetTopicResponse.class); + var topicVerificationStatus = (kafkaResponse.getTopics() != null + && kafkaResponse.getTopics().contains(topicPolicyPdpPap)); + String message = (topicVerificationStatus ? "PAP to Kafka connection check is successful" + : "PAP to Kafka connection check failed"); int code = (topicVerificationStatus ? resp.getStatus() : 503); return createHealthCheckReport(httpClient.getName(), httpClient.getBaseUrl(), code, topicVerificationStatus, message); diff --git a/main/src/main/resources/application.yaml b/main/src/main/resources/application.yaml index 2a3d1620..12716072 100644 --- a/main/src/main/resources/application.yaml +++ b/main/src/main/resources/application.yaml @@ -43,25 +43,25 @@ pap: topicSources: - topic: ${pap.topic.pdp-pap.name} servers: - - message-router - topicCommInfrastructure: dmaap + - kafka + topicCommInfrastructure: NOOP fetchTimeout: 15000 - topic: ${pap.topic.heartbeat.name} effectiveTopic: ${pap.topic.pdp-pap.name} consumerGroup: policy-pap servers: - - message-router - topicCommInfrastructure: dmaap + - kafka + topicCommInfrastructure: NOOP fetchTimeout: 15000 topicSinks: - topic: ${pap.topic.pdp-pap.name} servers: - - message-router - topicCommInfrastructure: dmaap + - kafka + topicCommInfrastructure: NOOP - topic: ${pap.topic.notification.name} servers: - - message-router - topicCommInfrastructure: dmaap + - kafka + topicCommInfrastructure: NOOP healthCheckRestClientParameters: - clientName: api hostname: policy-api @@ -77,8 +77,8 @@ pap: password: zb!XztG34 useHttps: true basePath: healthcheck - - clientName: dmaap - hostname: message-router + - clientName: kafka + hostname: kafka port: 3905 useHttps: true basePath: topics diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/TestPolicyComponentsHealthCheckProvider.java b/main/src/test/java/org/onap/policy/pap/main/rest/TestPolicyComponentsHealthCheckProvider.java index 41597218..60712c06 100644 --- a/main/src/test/java/org/onap/policy/pap/main/rest/TestPolicyComponentsHealthCheckProvider.java +++ b/main/src/test/java/org/onap/policy/pap/main/rest/TestPolicyComponentsHealthCheckProvider.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2020, 2022-2023 Nordix Foundation. + * Copyright (C) 2020, 2022-2024 Nordix Foundation. * Modifications Copyright (C) 2020-2021 AT&T Corp. * Modifications Copyright (C) 2020-2022 Bell Canada. All rights reserved. * ================================================================================ @@ -136,10 +136,10 @@ class TestPolicyComponentsHealthCheckProvider { when(response2.readEntity(HealthCheckReport.class)).thenReturn(createReport(HttpURLConnection.HTTP_OK, true)); when(client2.get()).thenReturn(response2); - when(client3.getName()).thenReturn("dmaap"); - when(client3.getBaseUrl()).thenReturn("message-router"); + when(client3.getName()).thenReturn("kafka"); + when(client3.getBaseUrl()).thenReturn("kafka"); when(response3.getStatus()).thenReturn(HttpURLConnection.HTTP_OK); - when(response3.readEntity(DmaapGetTopicResponse.class)).thenReturn(createDmaapResponse()); + when(response3.readEntity(KafkaGetTopicResponse.class)).thenReturn(createKafkaResponse()); when(client3.get()).thenReturn(response3); List clients = new ArrayList<>(); clients.add(client1); @@ -193,17 +193,17 @@ class TestPolicyComponentsHealthCheckProvider { assertFalse(report2.isHealthy()); when(response3.getStatus()).thenReturn(HttpURLConnection.HTTP_INTERNAL_ERROR); - when(response3.readEntity(DmaapGetTopicResponse.class)).thenReturn(null); + when(response3.readEntity(KafkaGetTopicResponse.class)).thenReturn(null); Map result3 = callFetchPolicyComponentsHealthStatus(); assertFalse((Boolean) result3.get(HEALTHY)); - HealthCheckReport report3 = (HealthCheckReport) result3.get("dmaap"); + HealthCheckReport report3 = (HealthCheckReport) result3.get("kafka"); assertFalse(report3.isHealthy()); when(response3.getStatus()).thenReturn(HttpURLConnection.HTTP_OK); - when(response3.readEntity(DmaapGetTopicResponse.class)).thenReturn(new DmaapGetTopicResponse()); + when(response3.readEntity(KafkaGetTopicResponse.class)).thenReturn(new KafkaGetTopicResponse()); Map result4 = callFetchPolicyComponentsHealthStatus(); assertFalse((Boolean) result4.get(HEALTHY)); - HealthCheckReport report4 = (HealthCheckReport) result4.get("dmaap"); + HealthCheckReport report4 = (HealthCheckReport) result4.get("kafka"); assertFalse(report4.isHealthy()); } @@ -260,8 +260,8 @@ class TestPolicyComponentsHealthCheckProvider { } } - private DmaapGetTopicResponse createDmaapResponse() { - DmaapGetTopicResponse response = new DmaapGetTopicResponse(); + private KafkaGetTopicResponse createKafkaResponse() { + KafkaGetTopicResponse response = new KafkaGetTopicResponse(); response.setTopics(List.of("POLICY-PDP-PAP")); return response; } diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/e2e/End2EndContext.java b/main/src/test/java/org/onap/policy/pap/main/rest/e2e/End2EndContext.java index c0c98adc..c6a67483 100644 --- a/main/src/test/java/org/onap/policy/pap/main/rest/e2e/End2EndContext.java +++ b/main/src/test/java/org/onap/policy/pap/main/rest/e2e/End2EndContext.java @@ -3,7 +3,7 @@ * ONAP PAP * ================================================================================ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2022-2023 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. @@ -144,7 +144,7 @@ public class End2EndContext { } /** - * Starts the threads that read the "DMaaP" queues.. + * Starts the threads that read the "kafka" queues. */ public void startThreads() { if (running) { diff --git a/main/src/test/resources/application-test-e2e.yaml b/main/src/test/resources/application-test-e2e.yaml index 23920f1d..01f35758 100644 --- a/main/src/test/resources/application-test-e2e.yaml +++ b/main/src/test/resources/application-test-e2e.yaml @@ -63,8 +63,8 @@ pap: password: zb!XztG34 useHttps: true basePath: healthcheck - - clientName: dmaap - hostname: message-router + - clientName: kafka + hostname: kafka port: 3905 useHttps: true basePath: topics diff --git a/main/src/test/resources/parameters/MinimumParameters.json b/main/src/test/resources/parameters/MinimumParameters.json index 80125305..bf2f4b54 100644 --- a/main/src/test/resources/parameters/MinimumParameters.json +++ b/main/src/test/resources/parameters/MinimumParameters.json @@ -29,13 +29,13 @@ "topicParameterGroup": { "topicSources" : [{ "topic" : "POLICY-PDP-PAP", - "servers" : [ "message-router" ], - "topicCommInfrastructure" : "dmaap" + "servers" : [ "kafka" ], + "topicCommInfrastructure" : "NOOP" }], "topicSinks" : [{ "topic" : "POLICY-PDP-PAP", - "servers" : [ "message-router" ], - "topicCommInfrastructure" : "dmaap" + "servers" : [ "kafka" ], + "topicCommInfrastructure" : "NOOP" }] }, "healthCheckRestClientParameters":[{ diff --git a/main/src/test/resources/parameters/PapConfigParameters.json b/main/src/test/resources/parameters/PapConfigParameters.json index debdc47c..b7604706 100644 --- a/main/src/test/resources/parameters/PapConfigParameters.json +++ b/main/src/test/resources/parameters/PapConfigParameters.json @@ -69,8 +69,8 @@ "basePath": "healthcheck" }, { - "clientName": "dmaap", - "hostname": "message-router", + "clientName": "kafka", + "hostname": "kafka", "port": 3905, "useHttps": true, "basePath": "topics" diff --git a/main/src/test/resources/parameters/PapConfigParametersStd.json b/main/src/test/resources/parameters/PapConfigParametersStd.json index 1b5b0eff..b5ad3304 100644 --- a/main/src/test/resources/parameters/PapConfigParametersStd.json +++ b/main/src/test/resources/parameters/PapConfigParametersStd.json @@ -31,14 +31,14 @@ "topicParameterGroup": { "topicSources" : [{ "topic" : "POLICY-PDP-PAP", - "servers" : [ "message-router" ], + "servers" : [ "kafka" ], "topicCommInfrastructure" : "noop" }, { "topic" : "POLICY-HEARTBEAT", "effectiveTopic": "POLICY-PDP-PAP", "consumerGroup": "policy-pap", - "servers" : [ "message-router" ], + "servers" : [ "kafka" ], "topicCommInfrastructure" : "noop" }], "topicSinks" : [{ @@ -70,8 +70,8 @@ "basePath": "healthcheck" }, { - "clientName": "dmaap", - "hostname": "message-router", + "clientName": "kafka", + "hostname": "kafka", "port": 3905, "useHttps": true, "basePath": "topics" diff --git a/main/src/test/resources/parameters/PapConfigParameters_Postgres.json b/main/src/test/resources/parameters/PapConfigParameters_Postgres.json index 46d25b10..5f92936a 100644 --- a/main/src/test/resources/parameters/PapConfigParameters_Postgres.json +++ b/main/src/test/resources/parameters/PapConfigParameters_Postgres.json @@ -31,16 +31,16 @@ "topicSources" : [{ "topic" : "POLICY-PDP-PAP", "servers" : [ "localhost:3904" ], - "topicCommInfrastructure" : "dmaap" + "topicCommInfrastructure" : "NOOP" }], "topicSinks" : [{ "topic" : "POLICY-PDP-PAP", "servers" : [ "localhost:3904" ], - "topicCommInfrastructure" : "dmaap" + "topicCommInfrastructure" : "NOOP" },{ "topic" : "POLICY-NOTIFICATION", "servers" : [ "localhost:3904" ], - "topicCommInfrastructure" : "dmaap" + "topicCommInfrastructure" : "NOOP" }] }, "healthCheckRestClientParameters":[{ diff --git a/packages/policy-pap-tarball/src/main/resources/etc/papParameters.yaml b/packages/policy-pap-tarball/src/main/resources/etc/papParameters.yaml index af230ffe..4d37affe 100644 --- a/packages/policy-pap-tarball/src/main/resources/etc/papParameters.yaml +++ b/packages/policy-pap-tarball/src/main/resources/etc/papParameters.yaml @@ -40,25 +40,25 @@ pap: topicSources: - topic: POLICY-PDP-PAP servers: - - message-router - topicCommInfrastructure: dmaap + - kafka + topicCommInfrastructure: NOOP fetchTimeout: 15000 - topic: POLICY-HEARTBEAT effectiveTopic: POLICY-PDP-PAP consumerGroup: policy-pap servers: - - message-router - topicCommInfrastructure: dmaap + - kafka + topicCommInfrastructure: NOOP fetchTimeout: 15000 topicSinks: - topic: POLICY-PDP-PAP servers: - - message-router - topicCommInfrastructure: dmaap + - kafka + topicCommInfrastructure: NOOP - topic: POLICY-NOTIFICATION servers: - - message-router - topicCommInfrastructure: dmaap + - kafka + topicCommInfrastructure: NOOP healthCheckRestClientParameters: - clientName: api hostname: policy-api @@ -74,8 +74,8 @@ pap: password: zb!XztG34 useHttps: true basePath: healthcheck - - clientName: dmaap - hostname: message-router + - clientName: kafka + hostname: kafka port: 3905 useHttps: true basePath: topics diff --git a/testsuites/stability/src/main/resources/papsetup/config/pap/etc/defaultConfig.json b/testsuites/stability/src/main/resources/papsetup/config/pap/etc/defaultConfig.json index f7149b4a..144eca4d 100644 --- a/testsuites/stability/src/main/resources/papsetup/config/pap/etc/defaultConfig.json +++ b/testsuites/stability/src/main/resources/papsetup/config/pap/etc/defaultConfig.json @@ -32,7 +32,7 @@ "topicSources" : [{ "topic" : "POLICY-PDP-PAP", "servers" : [ "10.2.0.41:3904" ], - "topicCommInfrastructure" : "dmaap", + "topicCommInfrastructure" : "NOOP", "fetchTimeout": 15000 }, { @@ -40,18 +40,18 @@ "effectiveTopic": "POLICY-PDP-PAP", "consumerGroup": "policy-pap", "servers" : [ "10.2.0.41:3904" ], - "topicCommInfrastructure" : "dmaap", + "topicCommInfrastructure" : "NOOP", "fetchTimeout": 15000 }], "topicSinks" : [{ "topic" : "POLICY-PDP-PAP", "servers" : [ "10.2.0.41:3904" ], - "topicCommInfrastructure" : "dmaap" + "topicCommInfrastructure" : "NOOP" }, { "topic" : "POLICY-NOTIFICATION", "servers" : [ "10.2.0.41:3904" ], - "topicCommInfrastructure" : "dmaap" + "topicCommInfrastructure" : "NOOP" }] } } -- cgit 1.2.3-korg