aboutsummaryrefslogtreecommitdiffstats
path: root/a1-policy-management
diff options
context:
space:
mode:
authorPatrikBuhr <patrik.buhr@est.tech>2021-03-26 12:19:42 +0100
committerPatrikBuhr <patrik.buhr@est.tech>2021-03-26 12:21:13 +0100
commitac6773591fcfc1e0d5f23038b3c37e9612ca9a9e (patch)
treed091811b4d31502b0c29376c3f85d6ca388d6b51 /a1-policy-management
parent7a052f6652ffc9965f3c0d2cdc8b7385d1029f3f (diff)
Ingnoring RIC faulty configuration entries
Ignoring RIC figuration entries where the baseUrl is empty. Change-Id: I50e63c964375d009a927290ab1ba0895a7f8888c Issue-ID: CCSDK-3227 Signed-off-by: PatrikBuhr <patrik.buhr@est.tech>
Diffstat (limited to 'a1-policy-management')
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfigParser.java10
-rw-r--r--a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfigParserTest.java2
-rw-r--r--a1-policy-management/src/test/resources/test_application_configuration_with_dmaap_config.json10
3 files changed, 19 insertions, 3 deletions
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfigParser.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfigParser.java
index bc1f62a4..a6af2023 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfigParser.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfigParser.java
@@ -39,11 +39,14 @@ import javax.validation.constraints.NotNull;
import org.immutables.gson.Gson;
import org.immutables.value.Value;
import org.onap.ccsdk.oran.a1policymanagementservice.exceptions.ServiceException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Parser for the Json representing of the component configuration.
*/
public class ApplicationConfigParser {
+ private static final Logger logger = LoggerFactory.getLogger(ApplicationConfigParser.class);
private static final String CONFIG = "config";
private static final String CONTROLLER = "controller";
@@ -109,7 +112,6 @@ public class ApplicationConfigParser {
throw new ServiceException(
"Configuration error, controller configuration not found: " + ric.controllerName());
}
-
}
}
@@ -124,7 +126,11 @@ public class ApplicationConfigParser {
.managedElementIds(parseManagedElementIds(get(ricAsJson, "managedElementIds").getAsJsonArray())) //
.controllerName(controllerNameElement != null ? controllerNameElement.getAsString() : "") //
.build();
- result.add(ricConfig);
+ if (!ricConfig.baseUrl().isEmpty()) {
+ result.add(ricConfig);
+ } else {
+ logger.error("RIC configuration error {}, baseUrl is empty", ricConfig.ricId());
+ }
}
return result;
}
diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfigParserTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfigParserTest.java
index 0a75fd30..5e218582 100644
--- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfigParserTest.java
+++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfigParserTest.java
@@ -69,6 +69,8 @@ class ApplicationConfigParserTest {
.password("password") //
.build(); //
assertEquals(expectedControllerConfig, controllers.get("controller1"), "controller contents");
+
+ assertEquals(2, result.ricConfigs().size());
}
private JsonObject getJsonRootObject() throws JsonIOException, JsonSyntaxException, IOException {
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
index 61ab31e8..ed1501dd 100644
--- 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
@@ -25,6 +25,14 @@
"kista_3",
"kista_4"
]
+ },
+ {
+ "name": "ric3_noBaseURL",
+ "baseUrl": "",
+ "managedElementIds": [
+ "kista_3",
+ "kista_4"
+ ]
}
],
"streams_publishes": {
@@ -44,4 +52,4 @@
}
}
}
-} \ No newline at end of file
+}