summaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-infra/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/main')
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Onap3gppServiceInstances.java35
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/onap3gppserviceinstancebeans/QuerySubnetCapability.java16
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/resources/subnetCapability.json25
3 files changed, 64 insertions, 12 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 e7b96b16a9..3f05c79dad 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
@@ -23,6 +23,11 @@ package org.onap.so.apihandlerinfra;
import java.sql.Timestamp;
import java.util.HashMap;
import java.util.UUID;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import java.util.function.Function;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
@@ -54,6 +59,7 @@ import org.onap.so.apihandlerinfra.onap3gppserviceinstancebeans.Allocate3gppServ
import org.onap.so.apihandlerinfra.onap3gppserviceinstancebeans.DeAllocate3gppService;
import org.onap.so.apihandlerinfra.onap3gppserviceinstancebeans.Modify3gppService;
import org.onap.so.apihandlerinfra.onap3gppserviceinstancebeans.QuerySubnetCapability;
+import org.onap.so.apihandlerinfra.onap3gppserviceinstancebeans.SubnetTypes;
import org.onap.so.constants.Status;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.ServiceRecipe;
@@ -70,6 +76,7 @@ import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.core.type.TypeReference;
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.info.Info;
@@ -238,8 +245,8 @@ public class Onap3gppServiceInstances {
public Response getSliceSubnetCapabilities(QuerySubnetCapability request, @PathParam("version") String version)
throws ApiException {
logger.debug("Request received {}", request);
- String subnetType = null;
- return getSubnetCapabilities(subnetType, version);
+ List<SubnetTypes> subnetTypes = request.getSubnetTypes();
+ return getSubnetCapabilities(subnetTypes, version);
}
/**
@@ -577,8 +584,28 @@ public class Onap3gppServiceInstances {
}
// To be implemented for fetching Subnet capabilities
- private Response getSubnetCapabilities(String subnetType, String version) throws ApiException {
- return null;
+ private Response getSubnetCapabilities(List<SubnetTypes> subnetTypes, String version) throws ApiException {
+ ObjectMapper oMapper = new ObjectMapper();
+ InputStream inputStream = TypeReference.class.getResourceAsStream("/subnetCapability.json");
+ Map<String, Object> subnetCapability = new HashMap<>();
+ try {
+ subnetCapability = oMapper.readValue(inputStream, Map.class);
+ } catch (Exception e) {
+ logger.debug("Exception while reading subnet capability value from json", e);
+ }
+ Map<String, Object> responseMap = new HashMap<>();
+ for (SubnetTypes value : subnetTypes) {
+ if (subnetCapability.containsKey(value.toString())) {
+ responseMap.put(value.toString(), subnetCapability.get(value.toString()));
+ }
+ }
+ String response = null;
+ try {
+ response = oMapper.writeValueAsString(responseMap);
+ } catch (JsonProcessingException e) {
+ logger.debug("Exception while converting subnet capability object to String {}", e);
+ }
+ return builder.buildResponse(HttpStatus.SC_OK, null, response, version);
}
/**
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/onap3gppserviceinstancebeans/QuerySubnetCapability.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/onap3gppserviceinstancebeans/QuerySubnetCapability.java
index 2e479e1ecb..c66b053609 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/onap3gppserviceinstancebeans/QuerySubnetCapability.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/onap3gppserviceinstancebeans/QuerySubnetCapability.java
@@ -22,26 +22,26 @@ package org.onap.so.apihandlerinfra.onap3gppserviceinstancebeans;
import java.util.List;
+import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Model class for slice subnet capability query
*/
public class QuerySubnetCapability {
- private SubnetTypes subnetType;
+ @JsonProperty("subnetTypes")
+ private List<SubnetTypes> subnetTypes;
- public SubnetTypes getSubnetType() {
- return subnetType;
+ public List<SubnetTypes> getSubnetTypes() {
+ return subnetTypes;
}
- public void setSubnetType(SubnetTypes subnetType) {
- this.subnetType = subnetType;
+ public void setSubnetTypes(List<SubnetTypes> subnetTypes) {
+ this.subnetTypes = subnetTypes;
}
@Override
public String toString() {
- return "QuerySubnetCapability [subnetType=" + subnetType + "]";
+ return "QuerySubnetCapability [subnetType=" + subnetTypes + "]";
}
-
}
-
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/subnetCapability.json b/mso-api-handlers/mso-api-handler-infra/src/main/resources/subnetCapability.json
new file mode 100644
index 0000000000..0d5acef64a
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/resources/subnetCapability.json
@@ -0,0 +1,25 @@
+{
+ "AN": {
+ "latency": "5",
+ "maxNumberofUEs": "100",
+ "maxThroughput": "150",
+ "terminalDensity": "50"
+ },
+ "CN": {
+ "latency": "10",
+ "maxThroughput": "50",
+ "maxNumberofConns": "100"
+ },
+ "TN_FH": {
+ "latency": "10",
+ "maxThroughput": "100"
+ },
+ "TN_MH": {
+ "latency": "5",
+ "maxThroughput": "50"
+ },
+ "TN_BH": {
+ "latency": "10",
+ "maxThroughput": "100"
+ }
+}