summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgrabinsk <maciej.grabinski@nokia.com>2019-04-05 15:13:18 +0200
committergrabinsk <maciej.grabinski@nokia.com>2019-04-05 15:13:18 +0200
commit2abfecad9aeb88ba95d62d718376535fb6e00325 (patch)
tree58d92becb52f8882207c948975ef0fcc36c2b669
parentd7fa23e2912dd4a4a28b79bdfbb92c9b33b55f49 (diff)
Add pnfUrl field
Due to changes in the aai client configuration json old parameters aaiHost, aaiProtocol, aaiPort, aaiBasePath, aaiPnfPath will be replaced by pnfUrl Change-Id: Ifd8841f8a80d743a95e3b0ea7d868eda923febca Issue-ID: DCAEGEN2-1398 Signed-off-by: grabinsk <maciej.grabinski@nokia.com>
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/AppConfig.java4
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/CloudConfigParser.java1
-rw-r--r--prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/TestAppConfiguration.java1
-rw-r--r--prh-app-server/src/test/resources/correct_config.json1
-rw-r--r--prh-app-server/src/test/resources/flattened_configuration.json1
-rw-r--r--prh-app-server/src/test/resources/incorrect_config.json1
6 files changed, 9 insertions, 0 deletions
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/AppConfig.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/AppConfig.java
index 2a7661a9..21495740 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/AppConfig.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/AppConfig.java
@@ -117,6 +117,9 @@ public class AppConfig extends PrhAppConfig {
@Value("${dmaap.dmaapUpdateProducerConfiguration.dmaapContentType:}")
public String updateProducerDmaapContentType;
+ @Value("${aai.aaiClientConfiguration.pnfUrl:}")
+ public String pnfUrl;
+
@Value("${aai.aaiClientConfiguration.aaiHost:}")
public String aaiHost;
@@ -222,6 +225,7 @@ public class AppConfig extends PrhAppConfig {
return null;
}
return new ImmutableAaiClientConfiguration.Builder()
+ .pnfUrl(Optional.ofNullable(pnfUrl).filter(isEmpty.negate()).orElse(aaiClientConfiguration.pnfUrl()))
.aaiHost(Optional.ofNullable(aaiHost).filter(isEmpty.negate()).orElse(aaiClientConfiguration.aaiHost()))
.aaiPort(
Optional.ofNullable(aaiPort).filter(p -> !p.toString().isEmpty())
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/CloudConfigParser.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/CloudConfigParser.java
index 2360c075..ec01ff50 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/CloudConfigParser.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/CloudConfigParser.java
@@ -81,6 +81,7 @@ class CloudConfigParser {
AaiClientConfiguration getAaiClientConfig() {
return new ImmutableAaiClientConfiguration.Builder()
+ .pnfUrl(jsonObject.get("aai.aaiClientConfiguration.pnfUrl").getAsString())
.aaiHost(jsonObject.get("aai.aaiClientConfiguration.aaiHost").getAsString())
.aaiPort(jsonObject.get("aai.aaiClientConfiguration.aaiHostPortNumber").getAsInt())
.aaiUserName(jsonObject.get("aai.aaiClientConfiguration.aaiUserName").getAsString())
diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/TestAppConfiguration.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/TestAppConfiguration.java
index 754bdba9..b09d039a 100644
--- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/TestAppConfiguration.java
+++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/TestAppConfiguration.java
@@ -66,6 +66,7 @@ public class TestAppConfiguration {
public static ImmutableAaiClientConfiguration createDefaultAaiClientConfiguration() {
return new ImmutableAaiClientConfiguration.Builder()
+ .pnfUrl("https://aai.onap.svc.cluster.local:8443/aai/v12/network/pnfs/pnf")
.aaiHost("aai.onap.svc.cluster.local")
.aaiPort(8443)
.aaiProtocol("https")
diff --git a/prh-app-server/src/test/resources/correct_config.json b/prh-app-server/src/test/resources/correct_config.json
index 3708b43d..9ef75122 100644
--- a/prh-app-server/src/test/resources/correct_config.json
+++ b/prh-app-server/src/test/resources/correct_config.json
@@ -2,6 +2,7 @@
"configs": {
"aai": {
"aaiClientConfiguration": {
+ "pnfUrl": "https://localhost:8080/aai/v11/network/pnfs/pnf",
"aaiHost": "localhost",
"aaiPort": 8080,
"aaiIgnoreSslCertificateErrors": true,
diff --git a/prh-app-server/src/test/resources/flattened_configuration.json b/prh-app-server/src/test/resources/flattened_configuration.json
index 24ddb51b..3c1cc9ac 100644
--- a/prh-app-server/src/test/resources/flattened_configuration.json
+++ b/prh-app-server/src/test/resources/flattened_configuration.json
@@ -4,6 +4,7 @@
"dmaap.dmaapUpdateProducerConfiguration.dmaapTopicName": "/events/unauthenticated.PNF_UPDATE",
"dmaap.dmaapConsumerConfiguration.timeoutMs": -1,
"dmaap.dmaapConsumerConfiguration.dmaapHostName": "message-router.onap.svc.cluster.local",
+ "aai.aaiClientConfiguration.pnfUrl": "https://aai.onap.svc.cluster.local:8443/aai/v12/network/pnfs/pnf",
"aai.aaiClientConfiguration.aaiPnfPath": "/network/pnfs/pnf",
"aai.aaiClientConfiguration.aaiServiceInstancePath": "/business/customers/customer/${customer}/service-subscriptions/service-subscription/${serviceType}/service-instances/service-instance/${serviceInstanceId}",
"aai.aaiClientConfiguration.aaiUserPassword": "AAI",
diff --git a/prh-app-server/src/test/resources/incorrect_config.json b/prh-app-server/src/test/resources/incorrect_config.json
index 7d562fe6..89f72485 100644
--- a/prh-app-server/src/test/resources/incorrect_config.json
+++ b/prh-app-server/src/test/resources/incorrect_config.json
@@ -2,6 +2,7 @@
"configs": {
"aai": {
"aaiClientConfiguration": {
+ "pnfUrl": "https://localhost:8080/aai/v11/network/pnfs/pnf",
"aaiHost": "localhost",
"aaiPort": 8080,
"aaiIgnoreSslCertificateErrors": true,