summaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap
diff options
context:
space:
mode:
authorSeshu Kumar M <seshu.kumar.m@huawei.com>2021-02-10 13:23:53 +0000
committerGerrit Code Review <gerrit@onap.org>2021-02-10 13:23:53 +0000
commit180062fb8462fcaf5d81fb311f80fecf382292c5 (patch)
treed93ce2c57cd90627e6aebae8d2f058dfb88b2ff7 /mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap
parent666b56c9241c37b22f631fb88f4a40aedefa2eac (diff)
parentbc0754b45540c56eeb9fc2aa2649a030136d0742 (diff)
Merge "Read subnetCapabilities configuration file from SO pod"
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap')
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Onap3gppServiceInstances.java23
1 files changed, 20 insertions, 3 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Onap3gppServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Onap3gppServiceInstances.java
index b1486c9686..a25a140334 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Onap3gppServiceInstances.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Onap3gppServiceInstances.java
@@ -20,6 +20,9 @@
package org.onap.so.apihandlerinfra;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
import java.sql.Timestamp;
import java.util.HashMap;
import java.util.UUID;
@@ -72,6 +75,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import com.fasterxml.jackson.core.JsonProcessingException;
@@ -124,6 +128,9 @@ public class Onap3gppServiceInstances {
@Autowired
private ResponseHandler responseHandler;
+ @Value("${subnetCapability.config.file}")
+ private String subnetCapabilityConfigFile;
+
/**
* POST Requests for 3GPP Service create Instance on a version provided
*
@@ -583,13 +590,23 @@ public class Onap3gppServiceInstances {
}
}
- // To be implemented for fetching Subnet capabilities
private Response getSubnetCapabilities(List<SubnetTypes> subnetTypes, String version) throws ApiException {
ObjectMapper oMapper = new ObjectMapper();
- InputStream inputStream = TypeReference.class.getResourceAsStream("/subnetCapability.json");
+ String inputFileString = "";
Map<String, Object> subnetCapability = new HashMap<>();
+ BufferedReader br = null;
try {
- subnetCapability = oMapper.readValue(inputStream, Map.class);
+ logger.debug("Reading SubnetCapability file");
+ br = new BufferedReader(new FileReader(new File(subnetCapabilityConfigFile)));
+ StringBuilder sb = new StringBuilder();
+ String line = br.readLine();
+ while (line != null) {
+ sb.append(line);
+ sb.append("\n");
+ line = br.readLine();
+ }
+ inputFileString = sb.toString();
+ subnetCapability = oMapper.readValue(inputFileString, Map.class);
} catch (Exception e) {
logger.debug("Exception while reading subnet capability value from json", e);
}