From 29065eadcfd111c6fefecdbed38e3ef27bd068ea Mon Sep 17 00:00:00 2001 From: "adheli.tavares" Date: Wed, 24 Apr 2024 10:27:48 +0100 Subject: Fix topic configurations. - adjust kafka configurations - remove UEB references Issue-ID: POLICY-4955 Change-Id: Ie3ff62a0ba5531ae4c0d123f214a50bb7f721807 Signed-off-by: adheli.tavares --- .../onap/policy/drools/features/PolicyEngineFeatureApi.java | 3 ++- .../policy/drools/persistence/FileSystemPersistence.java | 5 +++-- .../drools/protocol/configuration/PdpdConfiguration.java | 4 ++-- .../java/org/onap/policy/drools/system/PolicyEngine.java | 8 +++----- .../drools/system/internal/AggregatedPolicyController.java | 8 ++++---- policy-management/src/main/resources/openapi/openapi.yaml | 12 +++--------- policy-management/src/main/resources/swagger/swagger.json | 12 ++++++------ .../src/main/server-gen/bin/add-secured-participant | 2 +- policy-management/src/main/server-gen/bin/create-api-key | 2 +- .../src/main/server-gen/bin/create-secured-topic | 2 +- policy-management/src/main/server-gen/bin/features | 2 +- policy-management/src/main/server-gen/bin/pdpd-configuration | 7 ++++--- .../java/org/onap/policy/drools/system/PolicyEngineTest.java | 4 ++++ 13 files changed, 35 insertions(+), 36 deletions(-) (limited to 'policy-management/src') diff --git a/policy-management/src/main/java/org/onap/policy/drools/features/PolicyEngineFeatureApi.java b/policy-management/src/main/java/org/onap/policy/drools/features/PolicyEngineFeatureApi.java index 87001ad6..8edf394e 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/features/PolicyEngineFeatureApi.java +++ b/policy-management/src/main/java/org/onap/policy/drools/features/PolicyEngineFeatureApi.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2017-2019 AT&T Intellectual Property. 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. @@ -232,7 +233,7 @@ public interface PolicyEngineFeatureApi extends OrderedService { } /** - * Intercept an event from UEB/DMaaP before the PolicyEngine processes it. + * Intercept an event from Bus before the PolicyEngine processes it. * * @return True if this feature intercepts and takes ownership of the operation * preventing the invocation of lower priority features. False, otherwise. diff --git a/policy-management/src/main/java/org/onap/policy/drools/persistence/FileSystemPersistence.java b/policy-management/src/main/java/org/onap/policy/drools/persistence/FileSystemPersistence.java index d35f5469..9fb76d87 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/persistence/FileSystemPersistence.java +++ b/policy-management/src/main/java/org/onap/policy/drools/persistence/FileSystemPersistence.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2017-2021 AT&T Intellectual Property. 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. @@ -152,13 +153,13 @@ public class FileSystemPersistence implements SystemPersistence { protected Properties getProperties(Path propertiesPath) { if (!Files.exists(propertiesPath)) { - throw new IllegalArgumentException("properties for " + propertiesPath.toString() + " are not persisted."); + throw new IllegalArgumentException("properties for " + propertiesPath + " are not persisted."); } try { return PropertyUtil.getProperties(propertiesPath.toFile()); } catch (final Exception e) { - throw new IllegalArgumentException("can't read properties for " + propertiesPath.toString(), e); + throw new IllegalArgumentException("can't read properties for " + propertiesPath, e); } } diff --git a/policy-management/src/main/java/org/onap/policy/drools/protocol/configuration/PdpdConfiguration.java b/policy-management/src/main/java/org/onap/policy/drools/protocol/configuration/PdpdConfiguration.java index 1201c26e..f008407c 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/protocol/configuration/PdpdConfiguration.java +++ b/policy-management/src/main/java/org/onap/policy/drools/protocol/configuration/PdpdConfiguration.java @@ -242,7 +242,7 @@ public class PdpdConfiguration { } else { throw new IllegalArgumentException( "property \"requestID\" is of type \"java.lang.String\", but got " - + value.getClass().toString()); + + value.getClass()); } } @@ -257,7 +257,7 @@ public class PdpdConfiguration { } else { throw new IllegalArgumentException( "property \"entity\" is of type \"java.lang.String\", but got " - + value.getClass().toString()); + + value.getClass()); } } diff --git a/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngine.java b/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngine.java index 75e7c74a..3fc2e292 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngine.java +++ b/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngine.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2017-2022 AT&T Intellectual Property. 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. @@ -41,13 +42,10 @@ import org.onap.policy.drools.stats.PolicyStatsManager; /** * Policy Engine, the top abstraction for the Drools PDP Policy Engine. It abstracts away a Drools - * PDP Engine from management purposes. This is the best place to looking at the code from a top - * down approach. Other managed entities can be obtained from the PolicyEngine, hierarchically.
+ * PDP Engine from management purposes. This is the best place to looking at the code from a top-down + * approach. Other managed entities can be obtained from the PolicyEngine, hierarchically.
* PolicyEngine 1 --- * PolicyController 1 --- 1 DroolsController 1 --- 1 PolicyContainer 1 --- * * PolicySession
PolicyEngine 1 --- 1 TopicEndpointManager 1 -- * TopicReader 1 --- 1 - * UebTopicReader
PolicyEngine 1 --- 1 TopicEndpointManager 1 -- * TopicReader 1 --- 1 - * DmaapTopicReader
PolicyEngine 1 --- 1 TopicEndpointManager 1 -- * TopicWriter 1 --- 1 - * DmaapTopicWriter
PolicyEngine 1 --- 1 TopicEndpointManager 1 -- * TopicReader 1 --- 1 * RestTopicReader
PolicyEngine 1 --- 1 TopicEndpointManager 1 -- * TopicWriter 1 --- 1 * RestTopicWriter
PolicyEngine 1 --- 1 ManagementServer */ diff --git a/policy-management/src/main/java/org/onap/policy/drools/system/internal/AggregatedPolicyController.java b/policy-management/src/main/java/org/onap/policy/drools/system/internal/AggregatedPolicyController.java index 06b3f4ea..2c85c26e 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/system/internal/AggregatedPolicyController.java +++ b/policy-management/src/main/java/org/onap/policy/drools/system/internal/AggregatedPolicyController.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2021 Nordix Foundation. + * Modifications 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. @@ -140,9 +140,9 @@ public class AggregatedPolicyController implements PolicyController, TopicListen this.name = name; /* - * 1. Register read topics with network infrastructure (ueb, dmaap, rest) 2. Register write - * topics with network infrastructure (ueb, dmaap, rest) 3. Register with drools - * infrastructure + * 1. Register read topics with network infrastructure + * 2. Register write topics with network infrastructure + * 3. Register with drools infrastructure */ // Create/Reuse Readers/Writers for all event sources endpoints diff --git a/policy-management/src/main/resources/openapi/openapi.yaml b/policy-management/src/main/resources/openapi/openapi.yaml index 2e20dd98..da1b17d9 100644 --- a/policy-management/src/main/resources/openapi/openapi.yaml +++ b/policy-management/src/main/resources/openapi/openapi.yaml @@ -2443,8 +2443,8 @@ paths: get: tags: - pdp-d-telemetry - summary: Retrieves the latest events received by an UEB topic - description: This is a Network Communicaton Endpoint source of messages for + summary: Retrieves the latest events received by a topic + description: This is a Network Communication Endpoint source of messages for the Engine operationId: sourceEvents parameters: @@ -2523,7 +2523,7 @@ paths: get: tags: - pdp-d-telemetry - summary: Retrieves the latest events received by an UEB topic + summary: Retrieves the latest events received by a topic description: This is a Network Communication Endpoint source of messages for the Engine operationId: sinkEvents @@ -2935,8 +2935,6 @@ components: topicCommInfrastructure: type: string enum: - - UEB - - DMAAP - KAFKA - NOOP - REST @@ -3008,8 +3006,6 @@ components: topicCommInfrastructure: type: string enum: - - UEB - - DMAAP - KAFKA - NOOP - REST @@ -3885,8 +3881,6 @@ components: topicCommInfrastructure: type: string enum: - - UEB - - DMAAP - KAFKA - NOOP - REST diff --git a/policy-management/src/main/resources/swagger/swagger.json b/policy-management/src/main/resources/swagger/swagger.json index 844c6c2d..b3433208 100644 --- a/policy-management/src/main/resources/swagger/swagger.json +++ b/policy-management/src/main/resources/swagger/swagger.json @@ -3485,8 +3485,8 @@ "/topics/sources/{comm}/{topic}/events" : { "get" : { "tags" : [ "pdp-d-telemetry" ], - "summary" : "Retrieves the latest events received by an UEB topic", - "description" : "This is a Network Communicaton Endpoint source of messages for the Engine", + "summary" : "Retrieves the latest events received by a topic", + "description" : "This is a Network Communication Endpoint source of messages for the Engine", "operationId" : "sourceEvents", "parameters" : [ { "name" : "comm", @@ -3601,7 +3601,7 @@ "/topics/sinks/{comm}/{topic}/events" : { "get" : { "tags" : [ "pdp-d-telemetry" ], - "summary" : "Retrieves the latest events received by an UEB topic", + "summary" : "Retrieves the latest events received by a topic", "description" : "This is a Network Communication Endpoint source of messages for the Engine", "operationId" : "sinkEvents", "parameters" : [ { @@ -4207,7 +4207,7 @@ }, "topicCommInfrastructure" : { "type" : "string", - "enum" : [ "UEB", "DMAAP", "KAFKA", "NOOP", "REST" ] + "enum" : [ "KAFKA", "NOOP", "REST" ] }, "alive" : { "type" : "boolean" @@ -4299,7 +4299,7 @@ }, "topicCommInfrastructure" : { "type" : "string", - "enum" : [ "UEB", "DMAAP", "KAFKA", "NOOP", "REST" ] + "enum" : [ "KAFKA", "NOOP", "REST" ] }, "alive" : { "type" : "boolean" @@ -5571,7 +5571,7 @@ }, "topicCommInfrastructure" : { "type" : "string", - "enum" : [ "UEB", "DMAAP", "KAFKA", "NOOP", "REST" ] + "enum" : [ "KAFKA", "NOOP", "REST" ] }, "alive" : { "type" : "boolean" diff --git a/policy-management/src/main/server-gen/bin/add-secured-participant b/policy-management/src/main/server-gen/bin/add-secured-participant index 3ddc120f..579f4d47 100644 --- a/policy-management/src/main/server-gen/bin/add-secured-participant +++ b/policy-management/src/main/server-gen/bin/add-secured-participant @@ -73,7 +73,7 @@ until [ -z "$1" ]; do done if [ -z "${BUS_HOST}" ]; then - echo "An UEB/KAFKA server must be provided." + echo "A KAFKA server must be provided." echo usage exit 1 diff --git a/policy-management/src/main/server-gen/bin/create-api-key b/policy-management/src/main/server-gen/bin/create-api-key index e57c1e92..6d320729 100644 --- a/policy-management/src/main/server-gen/bin/create-api-key +++ b/policy-management/src/main/server-gen/bin/create-api-key @@ -53,7 +53,7 @@ until [ -z "$1" ]; do done if [ -z "${BUS_HOST}" ]; then - echo "An UEB/KAFKA server must be provided." + echo "A KAFKA server must be provided." echo usage exit 1 diff --git a/policy-management/src/main/server-gen/bin/create-secured-topic b/policy-management/src/main/server-gen/bin/create-secured-topic index 2aed99ae..f5c640f2 100644 --- a/policy-management/src/main/server-gen/bin/create-secured-topic +++ b/policy-management/src/main/server-gen/bin/create-secured-topic @@ -72,7 +72,7 @@ until [ -z "$1" ]; do done if [ -z "${BUS_HOST}" ]; then - echo "An UEB/KAFKA server must be provided." + echo "A KAFKA server must be provided." echo usage exit 1 diff --git a/policy-management/src/main/server-gen/bin/features b/policy-management/src/main/server-gen/bin/features index 93f58239..3343ffc4 100644 --- a/policy-management/src/main/server-gen/bin/features +++ b/policy-management/src/main/server-gen/bin/features @@ -773,7 +773,7 @@ function disableFeatureDeps() rm -f "${LIB}"/"${depJarName}" # case there were multiple features using this library - # re-enable link fron an enabled feature + # re-enable link from an enabled feature for aDepsEnabledMap in ${xDepsEnabledMap}; do if [ $(basename "${aDepsEnabledMap}") = ${depJarName} ]; then ln -s -f "${aDepsEnabledMap}" "${LIB}/" diff --git a/policy-management/src/main/server-gen/bin/pdpd-configuration b/policy-management/src/main/server-gen/bin/pdpd-configuration index 5182f3ad..0be7cef3 100644 --- a/policy-management/src/main/server-gen/bin/pdpd-configuration +++ b/policy-management/src/main/server-gen/bin/pdpd-configuration @@ -38,9 +38,10 @@ function usage() { echo "" } -BUS_PORT=9092 +BUS_PORT=29092 +BUS_HOST=kafka REQUEST_ID="7f5474ca-16a9-42ac-abc0-d86f62296fbc" -TOPIC="PDPD-CONFIGURATION" +TOPIC="pdpd-configuration" # command line options parsing until [ -z "$1" ]; do @@ -88,7 +89,7 @@ until [ -z "$1" ]; do done if [ -z "${BUS_HOST}" ]; then - echo "An UEB/KAFKA server must be provided." + echo "A KAFKA server must be provided." echo usage exit 1 diff --git a/policy-management/src/test/java/org/onap/policy/drools/system/PolicyEngineTest.java b/policy-management/src/test/java/org/onap/policy/drools/system/PolicyEngineTest.java index 20622091..b4915ef4 100644 --- a/policy-management/src/test/java/org/onap/policy/drools/system/PolicyEngineTest.java +++ b/policy-management/src/test/java/org/onap/policy/drools/system/PolicyEngineTest.java @@ -25,6 +25,7 @@ import static org.awaitility.Awaitility.await; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.onap.policy.drools.system.PolicyEngineConstants.TELEMETRY_SERVER_DEFAULT_NAME; import java.io.File; import java.io.IOException; @@ -48,6 +49,7 @@ import org.onap.policy.drools.protocol.coders.EventProtocolCoderConstants; import org.onap.policy.drools.protocol.coders.EventProtocolParams; import org.onap.policy.drools.protocol.coders.JsonProtocolFilter; import org.onap.policy.drools.protocol.configuration.DroolsConfiguration; +import org.onap.policy.drools.server.restful.RestManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -151,6 +153,8 @@ class PolicyEngineTest { void test100Configure() { var manager = (PolicyEngineManager) PolicyEngineConstants.getManager(); var engineProps = manager.defaultTelemetryConfig(); + engineProps.put(PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES + "." + TELEMETRY_SERVER_DEFAULT_NAME + + PolicyEndPointProperties.PROPERTY_HTTP_REST_CLASSES_SUFFIX, RestManager.class.getName()); /* override default port */ engineProps.put(PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES + "." -- cgit 1.2.3-korg