Removal of usage of DMaaP 97/133397/4
authorPatrikBuhr <patrik.buhr@est.tech>
Thu, 23 Feb 2023 11:39:31 +0000 (12:39 +0100)
committerKAPIL SINGAL <ks220y@att.com>
Mon, 27 Feb 2023 14:38:18 +0000 (14:38 +0000)
Issue-ID: CCSDK-3852
Signed-off-by: PatrikBuhr <patrik.buhr@est.tech>
Change-Id: I88a370ea81f56763f54fde472c30d894c0df04e3

63 files changed:
a1-policy-management/README.md
a1-policy-management/config/README
a1-policy-management/config/application.yaml
a1-policy-management/pom.xml
a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/Application.java
a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/aspect/LogAspect.java
a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1AdapterJsonHelper.java
a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1ClientFactory.java
a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1UriBuilder.java
a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/CcsdkA1AdapterClient.java
a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/OscA1Client.java
a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientVersion2.java
a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfig.java
a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfigParser.java
a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ConfigurationFile.java
a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/WebClientConfig.java
a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/ServiceCallbackInfo.java
a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/ServiceCallbacks.java
a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/VoidResponse.java
a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationController.java
a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/Consts.java
a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ErrorResponse.java
a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyIdList.java
a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyInfoList.java
a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyTypeIdList.java
a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyTypeInfo.java
a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicInfo.java
a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicInfoList.java
a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceStatusList.java
a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapMessageConsumer.java [deleted file]
a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapMessageHandler.java [deleted file]
a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapRequestMessage.java [deleted file]
a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapResponseMessage.java [deleted file]
a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSupervision.java
a1-policy-management/src/main/resources/application_configuration_schema.json
a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/aspect/LogAspectTest.java
a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1ClientFactoryTest.java
a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1ClientHelper.java
a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/AsyncRestClientTest.java
a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/CcsdkA1AdapterClientTest.java
a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/OscA1ClientTest.java
a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientV2Test.java
a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfigParserTest.java
a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfigTest.java
a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ConfigurationFileTest.java
a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConcurrencyTestRunnable.java
a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationControllerTest.java
a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RappSimulatorController.java
a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapMessageConsumerTest.java [deleted file]
a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapMessageHandlerTest.java [deleted file]
a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RefreshConfigTaskTest.java
a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSupervisionTest.java
a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSynchronizationTaskTest.java
a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/utils/MockA1Client.java
a1-policy-management/src/test/resources/test_application_configuration.json
a1-policy-management/src/test/resources/test_application_configuration_with_dmaap_config.json [deleted file]
csit/scripts/healthcheck/config/application_configuration.json.nosdnc
csit/scripts/healthcheck/config/application_configuration.json.sdnc
csit/scripts/healthcheck/test/setup.sh
docs/consumedapis/consumedapis.rst
docs/guide/developer-guide.rst
docs/media/ONAP-A1ControllerArchitecture.png
docs/offeredapis/offeredapis.rst

index c25b29d..1457d02 100644 (file)
@@ -36,10 +36,6 @@ To Run Policy Management Service in Local:
 In the folder /opt/app/policy-agent/config/, create a soft link with below command,
 ln -s <path to test_application_configuration.json> application_configuration.json
 
-To Run Policy Management Service in Local with the DMaaP polling turned on:
-In the folder /opt/app/policy-agent/config/, create a soft link with below command,
-ln -s <path to test_application_configuration_with_dmaap_config.json> application_configuration.json
-
 The Policy Management Service can be run stand alone in a simulated test mode. Then it simulates RICs.
 The REST API is published on port 8081 and it is started by command:
 mvn -Dtest=MockPolicyManagementService test
@@ -47,35 +43,11 @@ mvn -Dtest=MockPolicyManagementService test
 The backend server publishes live API documentation at the
 URL `http://your-host-name-here:8081/swagger-ui.html`
 
-The Policy Management Service uses A1-POLICY-AGENT-READ & A1-POLICY-AGENT-WRITE topic for subscribe & Publish to the DMaap.
-Sample Request Message to DMaaP:
-{
-  "type": "request",
-  "target": "policy-management-service",
-  "timestamp": "2019-05-14T11:44:51.36Z",
-  "operation": "GET",
-  "correlationId": "c09ac7d1-de62-0016-2000-e63701125557-201",
-  "apiVersion": "1.0",
-  "originatorId": "849e6c6b420",
-  "requestId": "23343221",
-  "url": "/policies?type=type1&ric=ric1&service=service1"
-}
-
-Sample Response Message to DMaaP:
-{
-  "type": "response",
-  "timestamp": "2019-05-14T11:44:51.36Z",
-  "correlationId": "c09ac7d1-de62-0016-2000-e63701125557-201",
-  "originatorId": "849e6c6b420",
-  "requestId": "23343221",
-  "status": "200 OK",
-  "message": []
-}
 
 ## License
 
 ONAP : ccsdk oran
-Copyright (C) 2019-2022 Nordix Foundation. All rights reserved.
+Copyright (C) 2019-2023 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.
 You may obtain a copy of the License at
index 42e0b7b..38d4f3d 100644 (file)
@@ -29,7 +29,7 @@ keytool -list -v -keystore truststore.jks -storepass policy_agent
 ## License
 
 ONAP : ccsdk oran
-Copyright (C) 2020 Nordix Foundation. All rights reserved.
+Copyright (C) 2020-2023 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.
 You may obtain a copy of the License at
index 8f37aaa..44e0b07 100644 (file)
@@ -2,7 +2,7 @@
 # ============LICENSE_START=======================================================
 # ONAP : ccsdk oran
 # ================================================================================
-# Copyright (C) 2020 Nordix Foundation. All rights reserved.
+# Copyright (C) 2020-2023 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.
index 14dd68f..6497a3e 100644 (file)
@@ -3,7 +3,7 @@
   ~ ============LICENSE_START=======================================================
   ~ ONAP : ccsdk oran
   ~ ================================================================================
-  ~ Copyright (C) 2020 Nordix Foundation. All rights reserved.
+  ~ Copyright (C) 2020-2023 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.
@@ -37,8 +37,8 @@
         <springfox.version>3.0.0</springfox.version>
         <gson.version>2.10.1</gson.version>
         <json.version>20220924</json.version>
-        <formatter-maven-plugin.version>2.13.0</formatter-maven-plugin.version>
-        <spotless-maven-plugin.version>2.5.0</spotless-maven-plugin.version>
+        <formatter-maven-plugin.version>2.13.0</formatter-maven-plugin.version>        
+        <spotless-maven-plugin.version>1.24.3</spotless-maven-plugin.version>
         <commons-io.version>2.11.0</commons-io.version>
         <guava.version>31.0.1-jre</guava.version>
         <snakeyaml.version>1.32</snakeyaml.version><!-- overrides version included via spring-boot-starter to address CVE-2022-38750 CVE-2022-38752 CVE-2022-25857. Remove later if possible -->
index 259a5ba..6f45864 100644 (file)
@@ -22,7 +22,6 @@ package org.onap.ccsdk.oran.a1policymanagementservice;
 
 import java.lang.invoke.MethodHandles;
 
-import org.onap.ccsdk.oran.a1policymanagementservice.dmaap.DmaapMessageConsumer;
 import org.onap.ccsdk.oran.a1policymanagementservice.tasks.RefreshConfigTask;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -40,9 +39,6 @@ public class Application {
     @Autowired
     private RefreshConfigTask configRefresh;
 
-    @Autowired
-    private DmaapMessageConsumer dmaapMessageConsumer;
-
     private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
 
     public static void main(String[] args) {
@@ -68,16 +64,4 @@ public class Application {
     public CommandLineRunner configRefreshRunner(ApplicationContext ctx) {
         return args -> configRefresh.start();
     }
-
-    /**
-     * Starts the DMaaP message consumer service.
-     *
-     * @param ctx the application context.
-     *
-     * @return the command line runner for the DMaaP message consumer service.
-     */
-    @Bean
-    public CommandLineRunner dmaapMessageConsumerRunner(ApplicationContext ctx) {
-        return args -> dmaapMessageConsumer.start();
-    }
 }
index 1c40f04..e41ebe1 100644 (file)
@@ -2,7 +2,7 @@
  * ========================LICENSE_START=================================
  * ONAP : ccsdk oran
  * ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 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.
index 60dca3b..ab93ea3 100644 (file)
@@ -2,7 +2,7 @@
  * ========================LICENSE_START=================================
  * ONAP : ccsdk oran
  * ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 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.
index 0956aa1..14738a9 100644 (file)
@@ -2,7 +2,7 @@
  * ========================LICENSE_START=================================
  * ONAP : ccsdk oran
  * ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 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.
index 801cb4d..d6d890d 100644 (file)
@@ -2,7 +2,7 @@
  * ========================LICENSE_START=================================
  * ONAP : ccsdk oran
  * ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 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.
index 9c32d79..225d2f7 100644 (file)
@@ -2,7 +2,7 @@
  * ========================LICENSE_START=================================
  * ONAP : ccsdk oran
  * ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 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.
index 1d567a8..62115b5 100644 (file)
@@ -2,7 +2,7 @@
  * ========================LICENSE_START=================================
  * ONAP : ccsdk oran
  * ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 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.
index 24990a1..c61ecb8 100644 (file)
@@ -2,7 +2,7 @@
  * ========================LICENSE_START=================================
  * ONAP : ccsdk oran
  * ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 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.
index 796d6ad..358680a 100644 (file)
@@ -100,12 +100,6 @@ public class ApplicationConfig {
 
     private Map<String, RicConfig> ricConfigs = new HashMap<>();
 
-    @Getter
-    private String dmaapConsumerTopicUrl;
-
-    @Getter
-    private String dmaapProducerTopicUrl;
-
     private Map<String, ControllerConfig> controllerConfigs = new HashMap<>();
 
     private WebClientConfig webClientConfig = null;
@@ -174,9 +168,6 @@ public class ApplicationConfig {
         Collection<RicConfigUpdate> modifications = new ArrayList<>();
         this.controllerConfigs = parserResult.getControllerConfigs();
 
-        this.dmaapConsumerTopicUrl = parserResult.getDmaapConsumerTopicUrl();
-        this.dmaapProducerTopicUrl = parserResult.getDmaapProducerTopicUrl();
-
         Map<String, RicConfig> newRicConfigs = new HashMap<>();
         for (RicConfig newConfig : parserResult.getRicConfigs()) {
             RicConfig oldConfig = this.ricConfigs.get(newConfig.getRicId());
@@ -202,5 +193,4 @@ public class ApplicationConfig {
     public boolean isS3Enabled() {
         return !(Strings.isNullOrEmpty(s3EndpointOverride) || Strings.isNullOrEmpty(s3Bucket));
     }
-
 }
index 6c178d3..9df901f 100644 (file)
@@ -36,7 +36,6 @@ import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.Map.Entry;
 import java.util.Set;
 
 import lombok.Builder;
@@ -70,44 +69,23 @@ public class ApplicationConfigParser {
         @Builder.Default
         private Map<String, ControllerConfig> controllerConfigs = new HashMap<>();
 
-        @Builder.Default
-        private String dmaapConsumerTopicUrl = "";
-
-        @Builder.Default
-        private String dmaapProducerTopicUrl = "";
-
     }
 
     public ConfigParserResult parse(JsonObject root) throws ServiceException {
 
         validateJsonObjectAgainstSchema(root);
 
-        String dmaapProducerTopicUrl = "";
-        String dmaapConsumerTopicUrl = "";
-
         JsonObject pmsConfigJson = root.getAsJsonObject(CONFIG);
 
         if (pmsConfigJson == null) {
             throw new ServiceException("Missing root configuration \"" + CONFIG + "\" in JSON: " + root);
         }
 
-        JsonObject json = pmsConfigJson.getAsJsonObject("streams_publishes");
-        if (json != null) {
-            dmaapProducerTopicUrl = parseDmaapConfig(json);
-        }
-
-        json = pmsConfigJson.getAsJsonObject("streams_subscribes");
-        if (json != null) {
-            dmaapConsumerTopicUrl = parseDmaapConfig(json);
-        }
-
         List<RicConfig> ricConfigs = parseRics(pmsConfigJson);
         Map<String, ControllerConfig> controllerConfigs = parseControllerConfigs(pmsConfigJson);
         checkConfigurationConsistency(ricConfigs, controllerConfigs);
 
         return ConfigParserResult.builder() //
-                .dmaapConsumerTopicUrl(dmaapConsumerTopicUrl) //
-                .dmaapProducerTopicUrl(dmaapProducerTopicUrl) //
                 .ricConfigs(ricConfigs) //
                 .controllerConfigs(controllerConfigs) //
                 .build();
@@ -236,17 +214,6 @@ public class ApplicationConfigParser {
         return get(obj, memberName).getAsJsonArray();
     }
 
-    private String parseDmaapConfig(JsonObject streamCfg) throws ServiceException {
-        Set<Entry<String, JsonElement>> streamConfigEntries = streamCfg.entrySet();
-        if (streamConfigEntries.size() != 1) {
-            throw new ServiceException(
-                    "Invalid configuration. Number of streams must be one, config: " + streamConfigEntries);
-        }
-        JsonObject streamConfigEntry = streamConfigEntries.iterator().next().getValue().getAsJsonObject();
-        JsonObject dmaapInfo = get(streamConfigEntry, "dmaap_info").getAsJsonObject();
-        return getAsString(dmaapInfo, "topic_url");
-    }
-
     private static String getAsString(JsonObject obj, String memberName) throws ServiceException {
         return get(obj, memberName).getAsString();
     }
index efe2fa2..7f5af45 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ========================LICENSE_START=================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 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.
index e71f855..04367e0 100644 (file)
@@ -2,7 +2,7 @@
  * ========================LICENSE_START=================================
  * ONAP : ccsdk oran
  * ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 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.
index c5436cd..ec23f83 100644 (file)
@@ -2,7 +2,7 @@
  * ========================LICENSE_START=================================
  * ONAP : ccsdk oran
  * ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 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.
index b028cd6..67b56f8 100644 (file)
@@ -2,7 +2,7 @@
  * ========================LICENSE_START=================================
  * ONAP : ccsdk oran
  * ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 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.
index 6470abf..001226d 100644 (file)
@@ -2,7 +2,7 @@
  * ========================LICENSE_START=================================
  * ONAP : ccsdk oran
  * ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 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.
index c8d9e4c..0d0919d 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ========================LICENSE_START=================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 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.
index 5642100..7f954e9 100644 (file)
@@ -2,7 +2,7 @@
  * ========================LICENSE_START=================================
  * ONAP : ccsdk oran
  * ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 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.
index 82a21ae..6bc5a6d 100644 (file)
@@ -2,7 +2,7 @@
  * ========================LICENSE_START=================================
  * ONAP : ccsdk oran
  * ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 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.
index 4e55c50..35c1c94 100644 (file)
@@ -2,7 +2,7 @@
  * ========================LICENSE_START=================================
  * ONAP : ccsdk oran
  * ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 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.
index 04f7e1e..ae1aed9 100644 (file)
@@ -2,7 +2,7 @@
  * ========================LICENSE_START=================================
  * ONAP : ccsdk oran
  * ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 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.
index c2610b0..0da2e65 100644 (file)
@@ -2,7 +2,7 @@
  * ========================LICENSE_START=================================
  * ONAP : ccsdk oran
  * ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 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.
index 591c1ca..1f0e447 100644 (file)
@@ -2,7 +2,7 @@
  * ========================LICENSE_START=================================
  * ONAP : ccsdk oran
  * ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 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.
index 4492770..6843cd1 100644 (file)
@@ -2,7 +2,7 @@
  * ========================LICENSE_START=================================
  * ONAP : ccsdk oran
  * ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 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.
index f5612f9..715c15b 100644 (file)
@@ -2,7 +2,7 @@
  * ========================LICENSE_START=================================
  * ONAP : ccsdk oran
  * ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 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.
index e6aa8d4..5559389 100644 (file)
@@ -2,7 +2,7 @@
  * ========================LICENSE_START=================================
  * ONAP : ccsdk oran
  * ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 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.
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapMessageConsumer.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapMessageConsumer.java
deleted file mode 100644 (file)
index 94888c3..0000000
+++ /dev/null
@@ -1,235 +0,0 @@
-/*-
- * ========================LICENSE_START=================================
- * ONAP : ccsdk oran
- * ======================================================================
- * Copyright (C) 2020 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.
- * 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===================================
- */
-
-package org.onap.ccsdk.oran.a1policymanagementservice.dmaap;
-
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonParser;
-
-import java.lang.invoke.MethodHandles;
-import java.time.Duration;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.onap.ccsdk.oran.a1policymanagementservice.clients.AsyncRestClient;
-import org.onap.ccsdk.oran.a1policymanagementservice.clients.AsyncRestClientFactory;
-import org.onap.ccsdk.oran.a1policymanagementservice.clients.SecurityContext;
-import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ApplicationConfig;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.http.HttpStatus;
-import org.springframework.stereotype.Component;
-
-import reactor.core.publisher.Flux;
-import reactor.core.publisher.FluxSink;
-import reactor.core.publisher.Mono;
-
-/**
- * The class fetches incoming requests from DMAAP. It uses the timeout parameter
- * that lets the MessageRouter keep the connection with the Kafka open until
- * requests are sent in.
- *
- * <p>
- * this service will regularly check the configuration and start polling DMaaP
- * if the configuration is added. If the DMaaP configuration is removed, then
- * the service will stop polling and resume checking for configuration.
- *
- * <p>
- * Each received request is processed by {@link DmaapMessageHandler}.
- */
-@Component
-public class DmaapMessageConsumer {
-
-    protected static final Duration TIME_BETWEEN_DMAAP_RETRIES = Duration.ofSeconds(10);
-
-    private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-
-    private final ApplicationConfig applicationConfig;
-
-    private DmaapMessageHandler dmaapMessageHandler = null;
-
-    private final Gson gson;
-
-    private final AsyncRestClientFactory restClientFactory;
-
-    private final InfiniteFlux infiniteSubmitter = new InfiniteFlux();
-
-    @Value("${server.http-port}")
-    private int localServerHttpPort;
-
-    private static class InfiniteFlux {
-        private FluxSink<Integer> sink;
-        private int counter = 0;
-
-        public synchronized Flux<Integer> start() {
-            stop();
-            return Flux.create(this::next).doOnRequest(this::onRequest);
-        }
-
-        public synchronized void stop() {
-            if (this.sink != null) {
-                this.sink.complete();
-                this.sink = null;
-            }
-        }
-
-        void onRequest(long no) {
-            for (long i = 0; i < no; ++i) {
-                sink.next(counter++);
-            }
-        }
-
-        void next(FluxSink<Integer> sink) {
-            this.sink = sink;
-            sink.next(counter++);
-        }
-
-    }
-
-    @Autowired
-    public DmaapMessageConsumer(ApplicationConfig applicationConfig, SecurityContext securityContext) {
-        this.applicationConfig = applicationConfig;
-        GsonBuilder gsonBuilder = new GsonBuilder();
-        this.gson = gsonBuilder.create();
-        this.restClientFactory = new AsyncRestClientFactory(applicationConfig.getWebClientConfig(), securityContext);
-    }
-
-    /**
-     * Starts the DMAAP consumer. If there is a DMaaP configuration, it will start
-     * polling for messages. Otherwise it will check regularly for the
-     * configuration.
-     *
-     */
-    public void start() {
-        infiniteSubmitter.stop();
-
-        createTask().subscribe(//
-                value -> logger.debug("DmaapMessageConsumer next: {}", value), //
-                throwable -> logger.error("DmaapMessageConsumer error: {}", throwable.getMessage()), //
-                () -> logger.warn("DmaapMessageConsumer stopped") //
-        );
-    }
-
-    protected Flux<String> createTask() {
-        return infiniteFlux() //
-                .flatMap(notUsed -> fetchFromDmaap(), 1) //
-                .doOnNext(message -> logger.debug("Message Reveived from DMAAP : {}", message)) //
-                .flatMap(this::parseReceivedMessage, 1)//
-                .flatMap(this::handleDmaapMsg, 1) //
-                .onErrorResume(throwable -> Mono.empty());
-    }
-
-    protected Flux<Integer> infiniteFlux() {
-        return infiniteSubmitter.start();
-    }
-
-    protected Mono<Object> delay() {
-        return Mono.delay(TIME_BETWEEN_DMAAP_RETRIES).flatMap(o -> Mono.empty());
-    }
-
-    private <T> List<T> parseList(String jsonString, Class<T> clazz) {
-        List<T> result = new ArrayList<>();
-        JsonArray jsonArr = JsonParser.parseString(jsonString).getAsJsonArray();
-        for (JsonElement jsonElement : jsonArr) {
-            // The element can either be a JsonObject or a JsonString
-            if (jsonElement.isJsonPrimitive()) {
-                T json = gson.fromJson(jsonElement.getAsString(), clazz);
-                result.add(json);
-            } else {
-                T json = gson.fromJson(jsonElement.toString(), clazz);
-                result.add(json);
-            }
-        }
-        return result;
-    }
-
-    protected boolean isDmaapConfigured() {
-        String producerTopicUrl = applicationConfig.getDmaapProducerTopicUrl();
-        String consumerTopicUrl = applicationConfig.getDmaapConsumerTopicUrl();
-        return (producerTopicUrl != null && consumerTopicUrl != null && !producerTopicUrl.isEmpty()
-                && !consumerTopicUrl.isEmpty());
-    }
-
-    protected Mono<String> handleDmaapMsg(DmaapRequestMessage dmaapRequestMessage) {
-        return getDmaapMessageHandler().handleDmaapMsg(dmaapRequestMessage);
-    }
-
-    protected Mono<String> getFromMessageRouter(String topicUrl) {
-        logger.trace("getFromMessageRouter {}", topicUrl);
-        AsyncRestClient c = restClientFactory.createRestClientNoHttpProxy("");
-        return c.get(topicUrl);
-    }
-
-    protected Flux<DmaapRequestMessage> parseReceivedMessage(String jsonString) {
-        try {
-            logger.trace("parseMessages {}", jsonString);
-            return Flux.fromIterable(parseList(jsonString, DmaapRequestMessage.class));
-        } catch (Exception e) {
-            logger.error("parseMessages error {}", jsonString);
-            return sendErrorResponse("Could not parse: " + jsonString) //
-                    .flatMapMany(s -> Flux.empty());
-        }
-    }
-
-    protected Mono<String> sendErrorResponse(String response) {
-        logger.debug("sendErrorResponse {}", response);
-        DmaapRequestMessage fakeRequest = DmaapRequestMessage.builder() //
-                .apiVersion("") //
-                .correlationId("") //
-                .operation(DmaapRequestMessage.Operation.PUT) //
-                .originatorId("") //
-                .payload(null) //
-                .requestId("") //
-                .target("") //
-                .timestamp("") //
-                .url("URL") //
-                .build();
-        return getDmaapMessageHandler().sendDmaapResponse(response, fakeRequest, HttpStatus.BAD_REQUEST) //
-                .onErrorResume(e -> Mono.empty());
-    }
-
-    private Mono<String> fetchFromDmaap() {
-        if (!this.isDmaapConfigured()) {
-            return delay().flatMap(o -> Mono.empty());
-        }
-        logger.debug("fetchFromDmaap");
-        String topicUrl = this.applicationConfig.getDmaapConsumerTopicUrl();
-
-        return getFromMessageRouter(topicUrl) //
-                .onErrorResume(throwable -> delay().flatMap(o -> Mono.empty()));
-    }
-
-    private DmaapMessageHandler getDmaapMessageHandler() {
-        if (this.dmaapMessageHandler == null) {
-            String pmsBaseUrl = "http://localhost:" + this.localServerHttpPort;
-            AsyncRestClient pmsClient = restClientFactory.createRestClientNoHttpProxy(pmsBaseUrl);
-            AsyncRestClient producer =
-                    restClientFactory.createRestClientNoHttpProxy(this.applicationConfig.getDmaapProducerTopicUrl());
-            this.dmaapMessageHandler = new DmaapMessageHandler(producer, pmsClient);
-        }
-        return this.dmaapMessageHandler;
-    }
-
-}
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapMessageHandler.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapMessageHandler.java
deleted file mode 100644 (file)
index 022dec0..0000000
+++ /dev/null
@@ -1,144 +0,0 @@
-/*-
- * ========================LICENSE_START=================================
- * ONAP : ccsdk oran
- * ======================================================================
- * Copyright (C) 2020 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.
- * 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===================================
- */
-
-package org.onap.ccsdk.oran.a1policymanagementservice.dmaap;
-
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import com.google.gson.JsonObject;
-
-import java.lang.invoke.MethodHandles;
-
-import org.onap.ccsdk.oran.a1policymanagementservice.clients.AsyncRestClient;
-import org.onap.ccsdk.oran.a1policymanagementservice.dmaap.DmaapRequestMessage.Operation;
-import org.onap.ccsdk.oran.a1policymanagementservice.exceptions.ServiceException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.reactive.function.client.WebClientException;
-import org.springframework.web.reactive.function.client.WebClientResponseException;
-import reactor.core.publisher.Mono;
-
-/**
- * The class handles incoming requests from DMAAP.
- * <p>
- * That means: invoke a REST call towards this services and to send back a
- * response though DMAAP
- */
-public class DmaapMessageHandler {
-    private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-    private static Gson gson = new GsonBuilder().create();
-    private final AsyncRestClient dmaapClient;
-    private final AsyncRestClient pmsClient;
-
-    public DmaapMessageHandler(AsyncRestClient dmaapClient, AsyncRestClient pmsClient) {
-        this.pmsClient = pmsClient;
-        this.dmaapClient = dmaapClient;
-    }
-
-    public Mono<String> handleDmaapMsg(DmaapRequestMessage dmaapRequestMessage) {
-        return this.invokePolicyManagementService(dmaapRequestMessage) //
-                .onErrorResume(t -> handlePolicyManagementServiceCallError(t, dmaapRequestMessage)) //
-                .flatMap(response -> sendDmaapResponse(response.getBody(), dmaapRequestMessage,
-                        response.getStatusCode()))
-                .doOnError(t -> logger.warn("Failed to handle DMAAP message : {}", t.getMessage()))//
-                .onErrorResume(t -> Mono.empty());
-    }
-
-    private Mono<ResponseEntity<String>> handlePolicyManagementServiceCallError(Throwable error,
-            DmaapRequestMessage dmaapRequestMessage) {
-        logger.debug("Policy Management Service call failed: {}", error.getMessage());
-        HttpStatus status = HttpStatus.INTERNAL_SERVER_ERROR;
-        String errorMessage = error.getMessage();
-        if (error instanceof WebClientResponseException) {
-            WebClientResponseException exception = (WebClientResponseException) error;
-            status = exception.getStatusCode();
-            errorMessage = exception.getResponseBodyAsString();
-        } else if (error instanceof ServiceException) {
-            status = HttpStatus.BAD_REQUEST;
-            errorMessage = error.getMessage();
-        } else if (!(error instanceof WebClientException)) {
-            logger.warn("Unexpected exception ", error);
-        }
-        return sendDmaapResponse(errorMessage, dmaapRequestMessage, status) //
-                .flatMap(notUsed -> Mono.empty());
-    }
-
-    public Mono<String> sendDmaapResponse(String response, DmaapRequestMessage dmaapRequestMessage, HttpStatus status) {
-        return createDmaapResponseMessage(dmaapRequestMessage, response, status) //
-                .flatMap(this::sendToDmaap) //
-                .onErrorResume(this::handleResponseCallError);
-    }
-
-    private Mono<ResponseEntity<String>> invokePolicyManagementService(DmaapRequestMessage dmaapRequestMessage) {
-        DmaapRequestMessage.Operation operation = dmaapRequestMessage.getOperation();
-        String uri = dmaapRequestMessage.getUrl();
-
-        if (operation == Operation.DELETE) {
-            return pmsClient.deleteForEntity(uri);
-        } else if (operation == Operation.GET) {
-            return pmsClient.getForEntity(uri);
-        } else if (operation == Operation.PUT) {
-            return pmsClient.putForEntity(uri, payload(dmaapRequestMessage));
-        } else if (operation == Operation.POST) {
-            return pmsClient.postForEntity(uri, payload(dmaapRequestMessage));
-        } else {
-            return Mono.error(new ServiceException("Not implemented operation: " + operation));
-        }
-    }
-
-    private String payload(DmaapRequestMessage message) {
-        JsonObject payload = message.getPayload();
-        if (payload != null) {
-            return gson.toJson(payload);
-        } else {
-            logger.warn("Expected payload in message from DMAAP: {}", message);
-            return "";
-        }
-    }
-
-    private Mono<String> sendToDmaap(String body) {
-        logger.debug("sendToDmaap: {} ", body);
-        return dmaapClient.post("", "[" + body + "]");
-    }
-
-    private Mono<String> handleResponseCallError(Throwable t) {
-        logger.warn("Failed to send response to DMaaP: {}", t.getMessage());
-        return Mono.empty();
-    }
-
-    private Mono<String> createDmaapResponseMessage(DmaapRequestMessage dmaapRequestMessage, String response,
-            HttpStatus status) {
-        DmaapResponseMessage dmaapResponseMessage = DmaapResponseMessage.builder() //
-                .status(status.toString()) //
-                .message(response == null ? "" : response) //
-                .type("response") //
-                .correlationId(
-                        dmaapRequestMessage.getCorrelationId() == null ? "" : dmaapRequestMessage.getCorrelationId()) //
-                .originatorId(
-                        dmaapRequestMessage.getOriginatorId() == null ? "" : dmaapRequestMessage.getOriginatorId()) //
-                .requestId(dmaapRequestMessage.getRequestId() == null ? "" : dmaapRequestMessage.getRequestId()) //
-                .timestamp(dmaapRequestMessage.getTimestamp() == null ? "" : dmaapRequestMessage.getTimestamp()) //
-                .build();
-        String str = gson.toJson(dmaapResponseMessage);
-        return Mono.just(str);
-    }
-}
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapRequestMessage.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapRequestMessage.java
deleted file mode 100644 (file)
index 10dc981..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*-
- * ========================LICENSE_START=================================
- * ONAP : ccsdk oran
- * ======================================================================
- * Copyright (C) 2020 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.
- * 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===================================
- */
-
-package org.onap.ccsdk.oran.a1policymanagementservice.dmaap;
-
-import com.google.gson.JsonObject;
-
-import lombok.Builder;
-import lombok.EqualsAndHashCode;
-import lombok.Getter;
-
-@Getter
-@Builder
-@EqualsAndHashCode
-public class DmaapRequestMessage {
-
-    public enum Operation {
-        PUT, GET, DELETE, POST
-    }
-
-    String correlationId;
-
-    String target;
-
-    String timestamp;
-
-    String apiVersion;
-
-    String originatorId;
-
-    String requestId;
-
-    Operation operation;
-
-    String url;
-
-    JsonObject payload;
-}
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapResponseMessage.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapResponseMessage.java
deleted file mode 100644 (file)
index 6477855..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*-
- * ========================LICENSE_START=================================
- * ONAP : ccsdk oran
- * ======================================================================
- * Copyright (C) 2020 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.
- * 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===================================
- */
-
-package org.onap.ccsdk.oran.a1policymanagementservice.dmaap;
-
-import lombok.Builder;
-import lombok.EqualsAndHashCode;
-import lombok.Getter;
-
-@Getter
-@Builder
-@EqualsAndHashCode
-public class DmaapResponseMessage {
-
-    String type;
-
-    String correlationId;
-
-    String timestamp;
-
-    String originatorId;
-
-    String requestId;
-
-    String status;
-
-    String message;
-}
index 3f0d3a0..f11e30f 100644 (file)
@@ -2,7 +2,7 @@
  * ========================LICENSE_START=================================
  * ONAP : ccsdk oran
  * ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 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.
index 947db33..8476951 100644 (file)
@@ -54,8 +54,8 @@
                 },
                 "controller": {
                   "type": "string"
-                }, 
-                "customAdapterClass" : {
+                },
+                "customAdapterClass": {
                   "type": "string"
                 },
                 "managedElementIds": {
               "additionalProperties": false
             }
           ]
-        },
-        "streams_publishes": {
-          "type": "object",
-          "properties": {
-            "dmaap_publisher": {
-              "type": "object",
-              "properties": {
-                "type": {
-                  "type": "string"
-                },
-                "dmaap_info": {
-                  "type": "object",
-                  "properties": {
-                    "topic_url": {
-                      "type": "string"
-                    }
-                  },
-                  "required": [
-                    "topic_url"
-                  ],
-                  "additionalProperties": false
-                }
-              },
-              "required": [
-                "type",
-                "dmaap_info"
-              ],
-              "additionalProperties": false
-            }
-          },
-          "required": [
-            "dmaap_publisher"
-          ],
-           "additionalProperties": false
-        },
-        "streams_subscribes": {
-          "type": "object",
-          "properties": {
-            "dmaap_subscriber": {
-              "type": "object",
-              "properties": {
-                "type": {
-                  "type": "string"
-                },
-                "dmaap_info": {
-                  "type": "object",
-                  "properties": {
-                    "topic_url": {
-                      "type": "string"
-                    }
-                  },
-                  "required": [
-                    "topic_url"
-                  ],
-                  "additionalProperties": false
-                }
-              },
-              "required": [
-                "type",
-                "dmaap_info"
-              ],
-               "additionalProperties": false
-            }
-          },
-          "required": [
-            "dmaap_subscriber"
-          ],
-           "additionalProperties": false
         }
       },
       "required": [
         "ric"
       ],
-      "additionalProperties": false
+      "additionalProperties": true
     }
   },
   "required": [
index f888244..cada8bc 100644 (file)
@@ -2,7 +2,7 @@
  * ========================LICENSE_START=================================
  * ONAP : ccsdk oran
  * ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 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.
index a715191..ef4ad1c 100644 (file)
@@ -2,7 +2,7 @@
  * ========================LICENSE_START=================================
  * ONAP : ccsdk oran
  * ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 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.
index 56dc7ed..b42edb8 100644 (file)
@@ -2,7 +2,7 @@
  * ========================LICENSE_START=================================
  * ONAP : ccsdk oran
  * ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 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.
index 9676942..12ac46d 100644 (file)
@@ -2,7 +2,7 @@
  * ========================LICENSE_START=================================
  * ONAP : ccsdk oran
  * ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 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.
index b2fc84a..9bd10f3 100644 (file)
@@ -2,7 +2,7 @@
  * ========================LICENSE_START=================================
  * ONAP : ccsdk oran
  * ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 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.
index 731c83a..c376d90 100644 (file)
@@ -2,7 +2,7 @@
  * ========================LICENSE_START=================================
  * ONAP : ccsdk oran
  * ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 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.
index 0af8a17..40154b4 100644 (file)
@@ -2,7 +2,7 @@
  * ========================LICENSE_START=================================
  * ONAP : ccsdk oran
  * ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 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.
index 61543c0..e43f401 100644 (file)
@@ -2,7 +2,7 @@
  * ========================LICENSE_START=================================
  * ONAP : ccsdk oran
  * ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 Nordix Foundation. All rights reserved.
  * ======================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -28,7 +28,6 @@ import static org.mockito.Mockito.when;
 
 import com.google.common.base.Charsets;
 import com.google.common.io.Resources;
-import com.google.gson.Gson;
 import com.google.gson.JsonIOException;
 import com.google.gson.JsonObject;
 import com.google.gson.JsonParser;
@@ -61,14 +60,6 @@ class ApplicationConfigParserTest {
 
         ApplicationConfigParser.ConfigParserResult result = parserUnderTest.parse(jsonRootObject);
 
-        String topicUrl = result.getDmaapProducerTopicUrl();
-        assertEquals("http://admin:admin@localhost:6845/events/A1-POLICY-AGENT-WRITE", topicUrl, "controller contents");
-
-        topicUrl = result.getDmaapConsumerTopicUrl();
-        assertEquals(
-                "http://admin:admin@localhost:6845/events/A1-POLICY-AGENT-READ/users/policy-agent?timeout=15000&limit=100",
-                topicUrl, "controller contents");
-
         Map<String, ControllerConfig> controllers = result.getControllerConfigs();
         assertEquals(1, controllers.size(), "size");
         ControllerConfig expectedControllerConfig = ControllerConfig.builder() //
@@ -90,70 +81,11 @@ class ApplicationConfigParserTest {
     }
 
     private static InputStream getCorrectJson() throws IOException {
-        URL url = ApplicationConfigParser.class.getClassLoader()
-                .getResource("test_application_configuration_with_dmaap_config.json");
+        URL url = ApplicationConfigParser.class.getClassLoader().getResource("test_application_configuration.json");
         String string = Resources.toString(url, Charsets.UTF_8);
         return new ByteArrayInputStream((string.getBytes(StandardCharsets.UTF_8)));
     }
 
-    @Test
-    @DisplayName("test when Dmaap Config Has Several Streams Publishing")
-    void whenDmaapConfigHasSeveralStreamsPublishing() throws Exception {
-        JsonObject jsonRootObject = getJsonRootObject();
-        JsonObject json = jsonRootObject.getAsJsonObject("config").getAsJsonObject("streams_publishes");
-        JsonObject fake_info_object = new JsonObject();
-        fake_info_object.addProperty("fake_info", "fake");
-        json.add("fake_info_object", new Gson().toJsonTree(fake_info_object));
-        DataPublishing data = new Gson().fromJson(json.toString(), DataPublishing.class);
-        final String expectedMessage =
-                "Invalid configuration. Number of streams must be one, config: " + data.toString();
-
-        Exception actualException = assertThrows(ServiceException.class, () -> parserUnderTest.parse(jsonRootObject));
-
-        assertEquals(expectedMessage, actualException.getMessage(),
-                "Wrong error message when the DMaaP config has several streams publishing");
-    }
-
-    class DataPublishing {
-        private JsonObject dmaap_publisher;
-        private JsonObject fake_info_object;
-
-        @Override
-        public String toString() {
-            return String.format("[dmaap_publisher=%s, fake_info_object=%s]", dmaap_publisher.toString(),
-                    fake_info_object.toString());
-        }
-    }
-
-    @Test
-    @DisplayName("test when Dmaap Config Has Several Streams Subscribing")
-    void whenDmaapConfigHasSeveralStreamsSubscribing() throws Exception {
-        JsonObject jsonRootObject = getJsonRootObject();
-        JsonObject json = jsonRootObject.getAsJsonObject("config").getAsJsonObject("streams_subscribes");
-        JsonObject fake_info_object = new JsonObject();
-        fake_info_object.addProperty("fake_info", "fake");
-        json.add("fake_info_object", new Gson().toJsonTree(fake_info_object));
-        DataSubscribing data = new Gson().fromJson(json.toString(), DataSubscribing.class);
-        final String expectedMessage =
-                "Invalid configuration. Number of streams must be one, config: " + data.toString();
-
-        Exception actualException = assertThrows(ServiceException.class, () -> parserUnderTest.parse(jsonRootObject));
-
-        assertEquals(expectedMessage, actualException.getMessage(),
-                "Wrong error message when the DMaaP config has several streams subscribing");
-    }
-
-    private class DataSubscribing {
-        private JsonObject dmaap_subscriber;
-        private JsonObject fake_info_object;
-
-        @Override
-        public String toString() {
-            return String.format("[dmaap_subscriber=%s, fake_info_object=%s]", dmaap_subscriber.toString(),
-                    fake_info_object.toString());
-        }
-    }
-
     @Test
     @DisplayName("test when Wrong Member Name In Object")
     void whenWrongMemberNameInObject() throws Exception {
@@ -180,10 +112,4 @@ class ApplicationConfigParserTest {
 
         assertThat(actualException.getMessage()).contains("Json schema validation failure");
     }
-
-    JsonObject getDmaapInfo(JsonObject jsonRootObject, String streamsPublishesOrSubscribes,
-            String dmaapPublisherOrSubscriber) throws Exception {
-        return jsonRootObject.getAsJsonObject("config").getAsJsonObject(streamsPublishesOrSubscribes)
-                .getAsJsonObject(dmaapPublisherOrSubscriber).getAsJsonObject("dmaap_info");
-    }
 }
index 39a8aa8..15e4739 100644 (file)
@@ -2,7 +2,7 @@
  * ========================LICENSE_START=================================
  * ONAP : ccsdk oran
  * ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 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.
@@ -55,8 +55,6 @@ class ApplicationConfigTest {
     ConfigParserResult configParserResult(RicConfig... rics) {
         return ConfigParserResult.builder() //
                 .ricConfigs(Arrays.asList(rics)) //
-                .dmaapConsumerTopicUrl("dmaapConsumerTopicUrl") //
-                .dmaapProducerTopicUrl("dmaapProducerTopicUrl") //
                 .controllerConfigs(new HashMap<>()) //
                 .build();
     }
index 7875cfb..b79a4ca 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ========================LICENSE_START=================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 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.
index 4e535ab..0bf212a 100644 (file)
@@ -2,7 +2,7 @@
  * ========================LICENSE_START=================================
  * ONAP : ccsdk oran
  * ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 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.
index 3c5b1d9..c0a6b4e 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ========================LICENSE_START=================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 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.
@@ -134,8 +134,8 @@ class ConfigurationControllerTest {
     }
 
     private String configAsString() throws Exception {
-        File configFile = new File(getClass().getClassLoader()
-                .getResource("test_application_configuration_with_dmaap_config.json").getFile());
+        File configFile =
+                new File(getClass().getClassLoader().getResource("test_application_configuration.json").getFile());
         return FileUtils.readFileToString(configFile, "UTF-8");
     }
 
index 371bd95..337c479 100644 (file)
@@ -2,7 +2,7 @@
  * ========================LICENSE_START=================================
  * O-RAN-SC
  * %%
- * Copyright (C) 2020 Nordix Foundation
+ * Copyright (C) 2020-2023 Nordix Foundation
  * %%
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapMessageConsumerTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapMessageConsumerTest.java
deleted file mode 100644 (file)
index 7abc5db..0000000
+++ /dev/null
@@ -1,215 +0,0 @@
-/*-
- * ========================LICENSE_START=================================
- * ONAP : ccsdk oran
- * ======================================================================
- * Copyright (C) 2020 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.
- * 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===================================
- */
-
-package org.onap.ccsdk.oran.a1policymanagementservice.dmaap;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import com.google.gson.JsonObject;
-
-import java.util.ArrayList;
-
-import org.junit.Assert;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.DisplayName;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.Mock;
-import org.mockito.junit.jupiter.MockitoExtension;
-import org.onap.ccsdk.oran.a1policymanagementservice.clients.AsyncRestClient;
-import org.onap.ccsdk.oran.a1policymanagementservice.clients.SecurityContext;
-import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ApplicationConfig;
-import org.onap.ccsdk.oran.a1policymanagementservice.dmaap.DmaapRequestMessage.Operation;
-import org.onap.ccsdk.oran.a1policymanagementservice.exceptions.ServiceException;
-import org.onap.ccsdk.oran.a1policymanagementservice.utils.LoggingUtils;
-
-import reactor.core.publisher.Flux;
-import reactor.core.publisher.Mono;
-
-@ExtendWith(MockitoExtension.class)
-class DmaapMessageConsumerTest {
-    @Mock
-    private ApplicationConfig applicationConfigMock;
-    @Mock
-    private AsyncRestClient messageRouterConsumerMock;
-    @Mock
-    private DmaapMessageHandler messageHandlerMock;
-
-    private DmaapMessageConsumer messageConsumerUnderTest;
-
-    private Gson gson = new GsonBuilder().create();
-
-    @AfterEach
-    void resetLogging() {
-        LoggingUtils.getLogListAppender(DmaapMessageConsumer.class);
-    }
-
-    private void setTaskNumberOfLoops(int number) {
-        ArrayList<Integer> l = new ArrayList<>();
-        for (int i = 0; i < number; ++i) {
-            l.add(i);
-        }
-        Flux<Integer> f = Flux.fromIterable(l);
-        doReturn(f).when(messageConsumerUnderTest).infiniteFlux();
-    }
-
-    private void disableTaskDelay() {
-        doReturn(Mono.empty()).when(messageConsumerUnderTest).delay();
-    }
-
-    @Test
-    @DisplayName("successful Case dmaap Not Configured then Sleep And Retry Until Config")
-    void successfulCase_dmaapNotConfigured_thenSleepAndRetryUntilConfig() throws Exception {
-        messageConsumerUnderTest = spy(new DmaapMessageConsumer(applicationConfigMock, new SecurityContext("")));
-
-        setTaskNumberOfLoops(3);
-        disableTaskDelay();
-
-        when(this.applicationConfigMock.getDmaapConsumerTopicUrl()).thenReturn("getDmaapConsumerTopicUrl");
-        doReturn(false, false, true).when(messageConsumerUnderTest).isDmaapConfigured();
-        doReturn(Mono.just(dmaapRequestMessageString())).when(messageConsumerUnderTest)
-                .getFromMessageRouter(anyString());
-
-        doReturn(Mono.just("responseFromHandler")).when(messageConsumerUnderTest).handleDmaapMsg(any());
-
-        String s = messageConsumerUnderTest.createTask().blockLast();
-        assertEquals("responseFromHandler", s);
-        verify(messageConsumerUnderTest, times(2)).delay();
-        verify(messageConsumerUnderTest, times(1)).handleDmaapMsg(any());
-    }
-
-    @Test
-    @DisplayName("return Error From Dmapp then Sleep And Retry")
-    void returnErrorFromDmapp_thenSleepAndRetry() throws Exception {
-        messageConsumerUnderTest = spy(new DmaapMessageConsumer(applicationConfigMock, new SecurityContext("")));
-
-        setTaskNumberOfLoops(2);
-        disableTaskDelay();
-        setUpMrConfig();
-
-        {
-            Mono<String> dmaapError = Mono.error(new ServiceException("dmaapError"));
-            Mono<String> dmaapResponse = Mono.just(dmaapRequestMessageString());
-            doReturn(dmaapError, dmaapResponse).when(messageConsumerUnderTest).getFromMessageRouter(anyString());
-        }
-
-        doReturn(Mono.just("response1")).when(messageConsumerUnderTest).handleDmaapMsg(any());
-
-        String s = messageConsumerUnderTest.createTask().blockLast();
-
-        verify(messageConsumerUnderTest, times(2)).getFromMessageRouter(anyString());
-        verify(messageConsumerUnderTest, times(0)).sendErrorResponse(anyString());
-        verify(messageConsumerUnderTest, times(1)).delay();
-        verify(messageConsumerUnderTest, times(1)).handleDmaapMsg(any());
-        assertEquals("response1", s);
-    }
-
-    @Test
-    @DisplayName("unParsable Message then Send Response And Continue")
-    void unParsableMessage_thenSendResponseAndContinue() throws Exception {
-        messageConsumerUnderTest = spy(new DmaapMessageConsumer(applicationConfigMock, new SecurityContext("")));
-        setTaskNumberOfLoops(2);
-        setUpMrConfig();
-
-        {
-            Mono<String> dmaapError = Mono.just("Non valid JSON \"");
-            Mono<String> dmaapResponse = Mono.just(dmaapRequestMessageString());
-            doReturn(dmaapError, dmaapResponse).when(messageConsumerUnderTest).getFromMessageRouter(anyString());
-        }
-
-        doReturn(Mono.just("response1")).when(messageConsumerUnderTest).handleDmaapMsg(any());
-
-        String s = messageConsumerUnderTest.createTask().blockLast();
-        assertEquals("response1", s);
-
-        verify(messageConsumerUnderTest, times(2)).getFromMessageRouter(anyString());
-        verify(messageConsumerUnderTest, times(1)).sendErrorResponse(anyString());
-        verify(messageConsumerUnderTest, times(0)).delay();
-        verify(messageConsumerUnderTest, times(1)).handleDmaapMsg(dmaapRequestMessage());
-    }
-
-    private String dmaapRequestMessageString() {
-        String json = gson.toJson(dmaapRequestMessage());
-        return jsonArray(json);
-    }
-
-    @Test
-    @DisplayName("test Message Parsing")
-    void testMessageParsing() throws ServiceException {
-        messageConsumerUnderTest = new DmaapMessageConsumer(applicationConfigMock, new SecurityContext(""));
-        String json = gson.toJson(dmaapRequestMessage());
-        {
-            String jsonArrayOfObject = jsonArray(json);
-            DmaapRequestMessage parsedMessage =
-                    messageConsumerUnderTest.parseReceivedMessage(jsonArrayOfObject).blockLast();
-            assertNotNull(parsedMessage);
-            assertNotNull(parsedMessage.getPayload());
-
-            Assert.assertEquals(dmaapRequestMessage(), parsedMessage);
-        }
-        {
-            String jsonArrayOfString = jsonArray(quote(json));
-            DmaapRequestMessage parsedMessage =
-                    messageConsumerUnderTest.parseReceivedMessage(jsonArrayOfString).blockLast();
-            assertNotNull(parsedMessage);
-            assertNotNull(parsedMessage.getPayload());
-            Assert.assertEquals(dmaapRequestMessage(), parsedMessage);
-        }
-
-    }
-
-    private void setUpMrConfig() {
-        when(applicationConfigMock.getDmaapConsumerTopicUrl()).thenReturn("url");
-        when(applicationConfigMock.getDmaapProducerTopicUrl()).thenReturn("url");
-    }
-
-    private String jsonArray(String s) {
-        return "[" + s + "]";
-    }
-
-    private String quote(String s) {
-        return "\"" + s.replace("\"", "\\\"") + "\"";
-    }
-
-    private DmaapRequestMessage dmaapRequestMessage() {
-        return DmaapRequestMessage.builder() //
-                .apiVersion("apiVersion") //
-                .correlationId("correlationId") //
-                .operation(Operation.PUT) //
-                .originatorId("originatorId") //
-                .payload(new JsonObject()) //
-                .requestId("requestId") //
-                .target("target") //
-                .timestamp("timestamp") //
-                .url("URL") //
-                .build();
-    }
-
-}
diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapMessageHandlerTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapMessageHandlerTest.java
deleted file mode 100644 (file)
index 2ec3664..0000000
+++ /dev/null
@@ -1,254 +0,0 @@
-/*-
- * ========================LICENSE_START=================================
- * ONAP : ccsdk oran
- * ======================================================================
- * Copyright (C) 2019-2020 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.
- * 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===================================
- */
-
-package org.onap.ccsdk.oran.a1policymanagementservice.dmaap;
-
-import static ch.qos.logback.classic.Level.WARN;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.verifyNoMoreInteractions;
-
-import ch.qos.logback.classic.spi.ILoggingEvent;
-import ch.qos.logback.core.read.ListAppender;
-
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import com.google.gson.JsonObject;
-
-import java.io.IOException;
-import java.nio.charset.Charset;
-
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.DisplayName;
-import org.junit.jupiter.api.Test;
-import org.mockito.ArgumentCaptor;
-import org.onap.ccsdk.oran.a1policymanagementservice.clients.AsyncRestClient;
-import org.onap.ccsdk.oran.a1policymanagementservice.dmaap.DmaapRequestMessage.Operation;
-import org.onap.ccsdk.oran.a1policymanagementservice.utils.LoggingUtils;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.reactive.function.client.WebClientResponseException;
-
-import reactor.core.publisher.Mono;
-import reactor.test.StepVerifier;
-
-class DmaapMessageHandlerTest {
-    private static final String URL = "url";
-
-    private final AsyncRestClient dmaapClient = mock(AsyncRestClient.class);
-    private final AsyncRestClient pmsClient = mock(AsyncRestClient.class);
-    private DmaapMessageHandler testedObject;
-    private Gson gson = new GsonBuilder().create(); //
-
-    @BeforeEach
-    private void setUp() throws Exception {
-        testedObject = spy(new DmaapMessageHandler(dmaapClient, pmsClient));
-    }
-
-    JsonObject payloadAsJson() {
-        return gson.fromJson(payloadAsString(), JsonObject.class);
-    }
-
-    String payloadAsString() {
-        return "{\"param\":\"value\"}";
-    }
-
-    DmaapRequestMessage dmaapRequestMessage(Operation operation) {
-        JsonObject payload = ((operation == Operation.PUT || operation == Operation.POST) ? payloadAsJson() : null);
-        return DmaapRequestMessage.builder() //
-                .apiVersion("apiVersion") //
-                .correlationId("correlationId") //
-                .operation(operation) //
-                .originatorId("originatorId") //
-                .payload(payload) //
-                .requestId("requestId") //
-                .target("target") //
-                .timestamp("timestamp") //
-                .url(URL) //
-                .build();
-    }
-
-    private Mono<ResponseEntity<String>> okResponse() {
-        ResponseEntity<String> entity = new ResponseEntity<>("OK", HttpStatus.OK);
-        return Mono.just(entity);
-    }
-
-    private Mono<ResponseEntity<String>> notOkResponse() {
-        ResponseEntity<String> entity = new ResponseEntity<>("NOK", HttpStatus.BAD_GATEWAY);
-        return Mono.just(entity);
-    }
-
-    @Test
-    @DisplayName("test successful Delete")
-    void successfulDelete() throws IOException {
-        doReturn(okResponse()).when(pmsClient).deleteForEntity(anyString());
-        doReturn(Mono.just("OK")).when(dmaapClient).post(anyString(), anyString());
-
-        DmaapRequestMessage message = dmaapRequestMessage(Operation.DELETE);
-
-        StepVerifier //
-                .create(testedObject.handleDmaapMsg(message)) //
-                .expectSubscription() //
-                .expectNext("OK") //
-                .verifyComplete(); //
-
-        verify(pmsClient).deleteForEntity(URL);
-        verifyNoMoreInteractions(pmsClient);
-
-        verify(dmaapClient).post(anyString(), anyString());
-
-        verifyNoMoreInteractions(dmaapClient);
-    }
-
-    @Test
-    @DisplayName("test successful Get")
-    void successfulGet() throws IOException {
-        doReturn(okResponse()).when(pmsClient).getForEntity(anyString());
-        doReturn(Mono.just("OK")).when(dmaapClient).post(anyString(), anyString());
-
-        DmaapRequestMessage message = dmaapRequestMessage(Operation.GET);
-        StepVerifier //
-                .create(testedObject.handleDmaapMsg(message)) //
-                .expectSubscription() //
-                .expectNext("OK") //
-                .verifyComplete(); //
-
-        verify(pmsClient).getForEntity(URL);
-        verifyNoMoreInteractions(pmsClient);
-
-        verify(dmaapClient).post(anyString(), anyString());
-        verifyNoMoreInteractions(dmaapClient);
-    }
-
-    @Test
-    @DisplayName("test exception From Pms When Get then Post Error")
-    void exceptionFromPmsWhenGet_thenPostError() throws IOException {
-        String errorBody = "Unavailable";
-        WebClientResponseException webClientResponseException = new WebClientResponseException(
-                HttpStatus.SERVICE_UNAVAILABLE.value(), "", (HttpHeaders) null, errorBody.getBytes(), (Charset) null);
-        doReturn(Mono.error(webClientResponseException)).when(pmsClient).getForEntity(anyString());
-        doReturn(Mono.just("OK")).when(dmaapClient).post(anyString(), anyString());
-
-        DmaapRequestMessage message = dmaapRequestMessage(Operation.GET);
-        StepVerifier //
-                .create(testedObject.handleDmaapMsg(message)) //
-                .expectSubscription() //
-                .verifyComplete(); //
-
-        ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
-        verify(dmaapClient).post(anyString(), captor.capture());
-        String actualMessage = captor.getValue();
-        assertThat(actualMessage).contains(HttpStatus.SERVICE_UNAVAILABLE.toString()) //
-                .contains(errorBody);
-    }
-
-    @Test
-    @DisplayName("test successful Put")
-    void successfulPut() throws IOException {
-        doReturn(okResponse()).when(pmsClient).putForEntity(anyString(), anyString());
-        doReturn(Mono.just("OK")).when(dmaapClient).post(anyString(), anyString());
-
-        DmaapRequestMessage message = dmaapRequestMessage(Operation.PUT);
-        StepVerifier //
-                .create(testedObject.handleDmaapMsg(message)) //
-                .expectSubscription() //
-                .expectNext("OK") //
-                .verifyComplete(); //
-
-        verify(pmsClient).putForEntity(URL, payloadAsString());
-        verifyNoMoreInteractions(pmsClient);
-
-        verify(dmaapClient).post(anyString(), anyString());
-        verifyNoMoreInteractions(dmaapClient);
-    }
-
-    @Test
-    @DisplayName("test successful Post")
-    void successfulPost() throws IOException {
-        doReturn(okResponse()).when(pmsClient).postForEntity(anyString(), anyString());
-        doReturn(Mono.just("OK")).when(dmaapClient).post(anyString(), anyString());
-
-        DmaapRequestMessage message = dmaapRequestMessage(Operation.POST);
-        StepVerifier //
-                .create(testedObject.handleDmaapMsg(message)) //
-                .expectSubscription() //
-                .expectNext("OK") //
-                .verifyComplete(); //
-
-        verify(pmsClient).postForEntity(URL, payloadAsString());
-        verifyNoMoreInteractions(pmsClient);
-
-        verify(dmaapClient).post(anyString(), anyString());
-        verifyNoMoreInteractions(dmaapClient);
-    }
-
-    @Test
-    @DisplayName("test exception When Calling Pms then Error Response")
-    void exceptionWhenCallingPms_thenErrorResponse() throws IOException {
-
-        doReturn(notOkResponse()).when(pmsClient).putForEntity(anyString(), anyString());
-        doReturn(Mono.just("OK")).when(dmaapClient).post(anyString(), anyString());
-
-        DmaapRequestMessage message = dmaapRequestMessage(Operation.PUT);
-        testedObject.handleDmaapMsg(message).block();
-
-        verify(pmsClient).putForEntity(anyString(), anyString());
-        verifyNoMoreInteractions(pmsClient);
-
-        ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
-        verify(dmaapClient).post(anyString(), captor.capture());
-        String actualMessage = captor.getValue();
-        assertThat(actualMessage).as("Message \"%s\" sent to DMaaP contains %s", actualMessage, HttpStatus.BAD_GATEWAY)
-                .contains(HttpStatus.BAD_GATEWAY.toString());
-
-        verifyNoMoreInteractions(dmaapClient);
-    }
-
-    @Test
-    @DisplayName("test put Without Payload then Not Found Response With Warning")
-    void putWithoutPayload_thenNotFoundResponseWithWarning() throws Exception {
-        DmaapRequestMessage message = DmaapRequestMessage.builder() //
-                .apiVersion("apiVersion") //
-                .correlationId("correlationId") //
-                .operation(DmaapRequestMessage.Operation.PUT) //
-                .originatorId("originatorId") //
-                .payload(null) //
-                .requestId("requestId") //
-                .target("target") //
-                .timestamp("timestamp") //
-                .url(URL) //
-                .build();
-
-        final ListAppender<ILoggingEvent> logAppender =
-                LoggingUtils.getLogListAppender(DmaapMessageHandler.class, WARN);
-
-        doReturn(notOkResponse()).when(pmsClient).putForEntity(anyString(), anyString());
-        testedObject.handleDmaapMsg(message).block();
-
-        assertThat(logAppender.list.get(0).getFormattedMessage())
-                .startsWith("Expected payload in message from DMAAP: ");
-    }
-
-}
index a2d20ac..d84359a 100644 (file)
@@ -40,7 +40,6 @@ import java.time.Duration;
 import java.util.Arrays;
 import java.util.Optional;
 import java.util.Properties;
-import java.util.Vector;
 
 import org.junit.jupiter.api.DisplayName;
 import org.junit.jupiter.api.Test;
@@ -74,13 +73,6 @@ class RefreshConfigTaskTest {
     @Mock
     ConfigurationFile configurationFileMock;
 
-    private static final String RIC_1_NAME = "ric1";
-    private static final RicConfig CORRECT_RIC_CONIFG = RicConfig.builder() //
-            .ricId(RIC_1_NAME) //
-            .baseUrl("http://localhost:8080/") //
-            .managedElementIds(new Vector<String>(Arrays.asList("kista_1", "kista_2"))) //
-            .build();
-
     private RefreshConfigTask createTestObject(boolean configFileExists) {
         return createTestObject(configFileExists, spy(new Rics()), new Policies(appConfig), true);
     }
@@ -120,10 +112,9 @@ class RefreshConfigTaskTest {
 
         verify(refreshTaskUnderTest.rics, times(2)).put(any(Ric.class));
 
-        Iterable<RicConfig> ricConfigs = appConfig.getRicConfigs();
-        RicConfig ricConfig = ricConfigs.iterator().next();
+        java.util.Collection<RicConfig> ricConfigs = appConfig.getRicConfigs();
         assertThat(ricConfigs).isNotNull();
-        assertThat(ricConfig).isEqualTo(CORRECT_RIC_CONIFG);
+        assertThat(ricConfigs).hasSize(2);
     }
 
     @Test
index 7b5e976..1b41ce0 100644 (file)
@@ -2,7 +2,7 @@
  * ========================LICENSE_START=================================
  * ONAP : ccsdk oran
  * ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 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.
index 1f933cd..c2f419f 100644 (file)
@@ -2,7 +2,7 @@
  * ========================LICENSE_START=================================
  * ONAP : ccsdk oran
  * ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 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.
index 80bfff7..91b762c 100644 (file)
@@ -2,7 +2,7 @@
  * ========================LICENSE_START=================================
  * ONAP : ccsdk oran
  * ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 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.
index fef2382..c9f67a4 100644 (file)
@@ -1,10 +1,20 @@
 {
    "config": {
-      "description": "Application configuration",
+      "description": "Test",
+      "controller": [
+         {
+            "name": "controller1",
+            "baseUrl": "http://localhost:8083/",
+            "userName": "user",
+            "password": "password"
+         }
+      ],
       "ric": [
          {
             "name": "ric1",
-            "baseUrl": "http://localhost:8080/",
+            "controller": "controller1",
+            "baseUrl": "http://localhost:8083/",
+            "customAdapterClass": "org.onap.ccsdk.oran.a1policymanagementservice.clients.StdA1ClientVersion2$Factory",
             "managedElementIds": [
                "kista_1",
                "kista_2"
          },
          {
             "name": "ric2",
-            "baseUrl": "http://localhost:8081/",
-            "customAdapterClass": "org.onap.ccsdk.oran.a1policymanagementservice.clients.StdA1ClientVersion2$Factory",
+            "baseUrl": "http://localhost:8085/",
+            "managedElementIds": [
+               "kista_3",
+               "kista_4"
+            ]
+         },
+         {
+            "name": "ric3_noBaseURL",
+            "baseUrl": "",
             "managedElementIds": [
                "kista_3",
                "kista_4"
             ]
          }
-      ],
-      "streams_publishes": {
-         "dmaap_publisher": {
-            "type": "message_router",
-            "dmaap_info": {
-               "topic_url": "http://admin:admin@localhost:6845/events/A1-POLICY-AGENT-WRITE"
-            }
-         }
-      },
-      "streams_subscribes": {
-         "dmaap_subscriber": {
-            "type": "message_router",
-            "dmaap_info": {
-               "topic_url": "http://admin:admin@localhost:6845/events/A1-POLICY-AGENT-READ/users/policy-agent?timeout=15000&limit=100"
-            }
-         }
-      }
+      ]      
    }
 }
diff --git a/a1-policy-management/src/test/resources/test_application_configuration_with_dmaap_config.json b/a1-policy-management/src/test/resources/test_application_configuration_with_dmaap_config.json
deleted file mode 100644 (file)
index 6e1de75..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-{
-   "config": {
-      "description": "Test",
-      "controller": [
-         {
-            "name": "controller1",
-            "baseUrl": "http://localhost:8083/",
-            "userName": "user",
-            "password": "password"
-         }
-      ],
-      "ric": [
-         {
-            "name": "ric1",
-            "controller": "controller1",
-            "baseUrl": "http://localhost:8083/",
-            "customAdapterClass": "org.onap.ccsdk.oran.a1policymanagementservice.clients.StdA1ClientVersion2$Factory",
-            "managedElementIds": [
-               "kista_1",
-               "kista_2"
-            ]
-         },
-         {
-            "name": "ric2",
-            "baseUrl": "http://localhost:8085/",
-            "managedElementIds": [
-               "kista_3",
-               "kista_4"
-            ]
-         },
-         {
-            "name": "ric3_noBaseURL",
-            "baseUrl": "",
-            "managedElementIds": [
-               "kista_3",
-               "kista_4"
-            ]
-         }
-      ],
-      "streams_publishes": {
-         "dmaap_publisher": {
-            "type": "message_router",
-            "dmaap_info": {
-               "topic_url": "http://admin:admin@localhost:6845/events/A1-POLICY-AGENT-WRITE"
-            }
-         }
-      },
-      "streams_subscribes": {
-         "dmaap_subscriber": {
-            "type": "message_router",
-            "dmaap_info": {
-               "topic_url": "http://admin:admin@localhost:6845/events/A1-POLICY-AGENT-READ/users/policy-agent?timeout=15000&limit=100"
-            }
-         }
-      }
-   }
-}
\ No newline at end of file
index 800a54e..e0305e9 100644 (file)
@@ -1,6 +1,6 @@
 {
     "description":"Application configuration",
-    "config":{     
+    "config":{
        "ric":[
           {
              "name":"ric1",
                "kista_2"
             ]
           }
-       ],
-       "streams_publishes":{
-          "dmaap_publisher":{
-             "type":"message_router",
-             "dmaap_info":{
-                "topic_url":"http://dmaap-mr:3904/events/A1-POLICY-AGENT-WRITE"
-             }
-          }
-       },
-       "streams_subscribes":{
-          "dmaap_subscriber":{
-             "type":"message_router",
-             "dmaap_info":{
-                "topic_url":"http://dmaap-mr:3904/events/A1-POLICY-AGENT-READ/users/policy-agent?timeout=15000&limit=100"
-             }
-          }
-       }
+       ]
     }
  }
index d38efb8..6518310 100644 (file)
                "kista_2"
             ]
           }
-       ],
-       "streams_publishes":{
-          "dmaap_publisher":{
-             "type":"message_router",
-             "dmaap_info":{
-                "topic_url":"http://dmaap-mr:3904/events/A1-POLICY-AGENT-WRITE"
-             }
-          }
-       },
-       "streams_subscribes":{
-          "dmaap_subscriber":{
-             "type":"message_router",
-             "dmaap_info":{
-                "topic_url":"http://dmaap-mr:3904/events/A1-POLICY-AGENT-READ/users/policy-agent?timeout=15000&limit=100"
-             }
-          }
-       }
+       ]
     }
  }
index c751e6d..7ddde91 100755 (executable)
@@ -7,9 +7,6 @@ export ODL_USER=${ODL_USER:-admin}
 export ODL_PASSWORD=${ODL_PASSWORD:-Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U}
 export ODL_ADMIN_USER=${ODL_ADMIN_USER:-${ODL_USER}}
 export ODL_ADMIN_PASSWORD=${ODL_ADMIN_PASSWORD:-${ODL_PASSWORD}}
-export DMAAP_USER=${DMAAP_USER:-admin}
-export DMAAP_PASSWORD=${DMAAP_PASSWORD:-admin}
-export DMAAP_AUTHKEY=${DMAAP_AUTHKEY:-""}
 export AAI_TRUSTSTORE_PASSWORD=${AAI_TRUSTSTORE_PASSWORD:-changeit}
 export AAI_CLIENT_NAME=${AAI_CLIENT_NAME:-sdnc@sdnc.onap.org}
 export AAI_CLIENT_PASSWORD=${AAI_CLIENT_PASSWORD:-demo123456!}
index 6c5d33d..515a2b5 100755 (executable)
@@ -8,24 +8,16 @@ Consumed APIs
 The A1 Policy Management Service consumes two ONAP APIs and the A1-P API.
 
 
-**********************
-DMaaP API (deprecated)
-**********************
-
-The A1 Policy Management Service API can also be accessed using *ONAP DMaaP*. To support this the `DMaaP Message Router API <https://docs.onap.org/projects/onap-dmaap-messagerouter-messageservice/en/latest/offeredapis/api.html>`_ is used.  
-
-Note: this functionality is deprecated, and will be removed in future versions. 
-
 *****************************************
 O-RAN A1 Interface for A1 Policies (A1-P)
 *****************************************
 
-Southbound, the ONAP A1 Policy functions communicate with *near-RT-RIC* RAN functions using the **A1** interface, as defined by the `O-RAN Alliance <https://www.o-ran.org>`_   
-The *A1 Interface - Application Protocol Specification (A1-AP)* describes this interface. The specification can be viewed from the `O-RAN Alliance <https://www.o-ran.org>`_ website. 
+Southbound, the ONAP A1 Policy functions communicate with *near-RT-RIC* RAN functions using the **A1** interface, as defined by the `O-RAN Alliance <https://www.o-ran.org>`_
+The *A1 Interface - Application Protocol Specification (A1-AP)* describes this interface. The specification can be viewed from the `O-RAN Alliance <https://www.o-ran.org>`_ website.
 
 The **Kohn** ONAP A1 Policy functions implement the *A1 Policy* parts (*A1-P*) of A1-AP versions *v1.1*, *v2.0* and *v3.0*
 
-An opensource implementation of a `near-RT-RIC <https://wiki.o-ran-sc.org/pages/viewpage.action?pageId=1179659>`_ is available from the `O-RAN Software Community <https://o-ran-sc.org>`_. It supports a pre-spec version of the A1-AP. The ONAP A1 Policy functions described here also supports this A1 version (*A1-OSC*). 
+An opensource implementation of a `near-RT-RIC <https://wiki.o-ran-sc.org/pages/viewpage.action?pageId=1179659>`_ is available from the `O-RAN Software Community <https://o-ran-sc.org>`_. It supports a pre-spec version of the A1-AP. The ONAP A1 Policy functions described here also supports this A1 version (*A1-OSC*).
 
-An opensource implementation of an `A1 Simulator <https://wiki.o-ran-sc.org/pages/viewpage.action?pageId=3604819>`_ is also available from the `O-RAN Software Community <https://o-ran-sc.org>`_. It supports all versions of A1-AP. 
+An opensource implementation of an `A1 Simulator <https://wiki.o-ran-sc.org/pages/viewpage.action?pageId=3604819>`_ is also available from the `O-RAN Software Community <https://o-ran-sc.org>`_. It supports all versions of A1-AP.
 
index c26bf48..d3b1646 100644 (file)
@@ -32,10 +32,9 @@ A1 Policy Management Service provides a REST API for management of policies. It
    * Query functions that can find all policies in a RIC, all policies owned by a service (R-APP), all policies of a type etc.
    * Maps O1 resources (ManagedElement) as defined in O1 to the controlling RIC.
 
-The Policy Management Service can be accessed over the REST API, and with an equivalent interface using DMaaP. See :ref:`pms_api` for more information about the API.
-Note that DMaaP is deprecated and the possibility to access this service using DMaaP is deprecated and will be removed. 
+The Policy Management Service can be accessed over the REST API. See :ref:`pms_api` for more information about the API.
 
-The configured A1 policies are stored persistently to survive a service restart. 
+The configured A1 policies are stored persistently to survive a service restart.
 
 Dependencies
 ------------
@@ -56,7 +55,7 @@ Configuration
 -------------
 
 There are two configuration files for A1 Policy Management Service, *config/application_configuration.json* and *config/application.yaml*
-The first (*config/application_configuration.json*) contains configuration needed by the application, such as which near-RT-RICs, or controller to use. DMaaP topic can also be configured, but is deprecated.
+The first (*config/application_configuration.json*) contains configuration needed by the application, such as which near-RT-RICs, or controller to use.
 The second (*config/application.yaml*) contains logging and security configurations.
 
 For more information about these configuration files can be found as comments in the sample files provided with the source code, or on the `ONAP wiki <https://wiki.onap.org/display/DW/O-RAN+A1+Policies+in+ONAP+Kohn>`_
@@ -89,15 +88,13 @@ The component has configuration that can be updated in runtime. This configurati
 The configuration includes:
 
   * Optional Controller configuration, e.g. an SDNC instance (with A1-Adapter)
-  
+
     * (If no 'Contoller' is configured, the A1 Policy Management Service will connect direct to near-RT-RICs, bypassing the SDNC controller)
   * One entry for each near-RT-RIC, which includes:
-  
+
     * The base URL of the near-RT-RIC
     * A optional list of O1 identifiers that near-RT-RIC is controlling. An application can query this service which near-RT-RIC should be addressed for which component (e.g. cells, sectors, locations, etc.) .
     * An optional reference to the controller to use, or excluded if the near-RT-RIC should be accessed directly from the A1 Policy Management Service.
-   
- * Optional configuration for using of DMaaP (deprecated). There can be one stream for requests to the component and an other stream for responses.
 
 For details about the syntax of the file, there is an example in source code repository */config/application_configuration.json*. This file is also included in the docker container */opt/app/policy-agent/data/application_configuration.json_example*.
 
@@ -141,7 +138,7 @@ In order to configure a HTTP Proxy for southbound connections:
   * Modify file: *odlsli/src/main/properties/a1-adapter-api-dg.properties*. This file is found in CCSDK/distribution for SDNC.
   * In a running container this file is found at */opt/onap/ccsdk/data/properties/a1-adapter-api-dg.properties*
   * Variable a1Mediator.proxy.url must contain the full Proxy URL
-  
+
 After this configuration has been changed the A1 adapter needs to be either rebuilt, or restarted if the configuration is changed inside a container, or re-read by the container if externally accessible (e.g. K8s ConfigMap).
 
 
index b32d702..0d549f5 100644 (file)
Binary files a/docs/media/ONAP-A1ControllerArchitecture.png and b/docs/media/ONAP-A1ControllerArchitecture.png differ
index fd65ebf..28f0083 100644 (file)
@@ -20,7 +20,6 @@ Overall architecture for O-RAN A1 Policy functions
 
 This picture provides a overview of ONAP's A1 Controller architecture,
 integration with other ONAP components and API resource/operation provided.
-Note that DMaaP is deprecated and will be removed in later releases. 
 
 .. image:: ../media/ONAP-A1ControllerArchitecture.png
    :width: 500pt