summaryrefslogtreecommitdiffstats
path: root/so-cnf-adapter-application/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'so-cnf-adapter-application/src/main')
-rw-r--r--so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/AaiConfiguration.java15
-rw-r--r--so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/aai/AaiService.java30
-rw-r--r--so-cnf-adapter-application/src/main/resources/application.yaml3
3 files changed, 41 insertions, 7 deletions
diff --git a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/AaiConfiguration.java b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/AaiConfiguration.java
new file mode 100644
index 0000000..49f95a6
--- /dev/null
+++ b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/AaiConfiguration.java
@@ -0,0 +1,15 @@
+package org.onap.so.adapters.cnf;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class AaiConfiguration {
+
+ @Value("${aai.enabled:false}")
+ private boolean enabled;
+
+ public boolean isEnabled() {
+ return enabled;
+ }
+}
diff --git a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/aai/AaiService.java b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/aai/AaiService.java
index 4827578..71d34a3 100644
--- a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/aai/AaiService.java
+++ b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/aai/AaiService.java
@@ -1,10 +1,13 @@
package org.onap.so.adapters.cnf.service.aai;
+import org.onap.so.adapters.cnf.AaiConfiguration;
import org.onap.so.adapters.cnf.client.MulticloudClient;
import org.onap.so.adapters.cnf.model.instantiation.AaiRequest;
import org.onap.so.adapters.cnf.model.statuscheck.K8sRbInstanceResourceStatus;
import org.onap.so.adapters.cnf.model.statuscheck.K8sRbInstanceStatus;
import org.onap.so.client.exception.BadResponseException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import java.util.List;
@@ -13,26 +16,39 @@ import java.util.stream.Collectors;
@Service
public class AaiService {
+ private final static Logger log = LoggerFactory.getLogger(AaiService.class);
+
private final MulticloudClient multicloudClient;
private final AaiRequestSender aaiRequestSender;
private final AaiResponseParser responseParser;
+ private final AaiConfiguration aaiConfiguration;
- public AaiService(MulticloudClient multicloudClient, AaiRequestSender aaiRequestSender, AaiResponseParser responseParser) {
+ public AaiService(MulticloudClient multicloudClient,
+ AaiRequestSender aaiRequestSender,
+ AaiResponseParser responseParser,
+ AaiConfiguration aaiConfiguration) {
this.multicloudClient = multicloudClient;
this.aaiRequestSender = aaiRequestSender;
this.responseParser = responseParser;
+ this.aaiConfiguration = aaiConfiguration;
}
public void aaiUpdate(AaiRequest aaiRequest) throws BadResponseException {
- List<ParseResult> parseStatus = parseStatus(aaiRequest);
-
- parseStatus.forEach(status -> aaiRequestSender.sendUpdateRequestToAai(status, aaiRequest));
+ if (aaiConfiguration.isEnabled()) {
+ List<ParseResult> parseStatus = parseStatus(aaiRequest);
+ parseStatus.forEach(status -> aaiRequestSender.sendUpdateRequestToAai(status, aaiRequest));
+ } else {
+ log.info("aai.enabled=false, do not execute aaiUpdate flow");
+ }
}
public void aaiDelete(AaiRequest aaiRequest) throws BadResponseException {
- List<ParseResult> parseStatus = parseStatus(aaiRequest);
-
- parseStatus.forEach(status -> aaiRequestSender.sendDeleteRequestToAai(aaiRequest));
+ if (aaiConfiguration.isEnabled()) {
+ List<ParseResult> parseStatus = parseStatus(aaiRequest);
+ parseStatus.forEach(status -> aaiRequestSender.sendDeleteRequestToAai(aaiRequest));
+ } else {
+ log.info("aai.enabled=false, do not execute aaiDelete flow");
+ }
}
private List<ParseResult> parseStatus(AaiRequest aaiRequest) throws BadResponseException {
diff --git a/so-cnf-adapter-application/src/main/resources/application.yaml b/so-cnf-adapter-application/src/main/resources/application.yaml
index a0e00a7..098ca64 100644
--- a/so-cnf-adapter-application/src/main/resources/application.yaml
+++ b/so-cnf-adapter-application/src/main/resources/application.yaml
@@ -23,6 +23,9 @@
#logging:
# path: logs
+aai:
+ enabled: false
+
spring:
security:
usercredentials: