aboutsummaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-infra/src
diff options
context:
space:
mode:
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src')
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Onap3gppServiceInstances.java23
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/AaiClientPropertiesImpl.java34
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/resources/application.yaml4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/Onap3gppServiceInstancesTest.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java9
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/Onap3gppServiceInstancesTest/subnetCapability.json (renamed from mso-api-handlers/mso-api-handler-infra/src/main/resources/subnetCapability.json)16
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationFilterResponse.json12
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml5
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql9
10 files changed, 98 insertions, 20 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);
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java
index acd3a8321e..99c0fc23fa 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java
@@ -46,6 +46,7 @@ import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.EnumUtils;
import org.apache.http.HttpStatus;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.apihandler.common.ErrorNumbers;
import org.onap.so.apihandler.common.ResponseBuilder;
import org.onap.so.apihandlerinfra.exceptions.ApiException;
@@ -57,7 +58,6 @@ import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.beans.RequestProcessingData;
import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.exceptions.ValidationException;
-import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.serviceinstancebeans.CloudRequestData;
import org.onap.so.serviceinstancebeans.GetOrchestrationListResponse;
@@ -213,7 +213,7 @@ public class OrchestrationRequests {
if (isRequestProcessingDataRequired(format)) {
List<RequestProcessingData> requestProcessingData =
- requestsDbClient.getRequestProcessingDataBySoRequestId(infraActive.getRequestId());
+ requestsDbClient.getExternalRequestProcessingDataBySoRequestId(infraActive.getRequestId());
if (null != requestProcessingData && !requestProcessingData.isEmpty()) {
request.setRequestProcessingData(mapRequestProcessingData(requestProcessingData));
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/AaiClientPropertiesImpl.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/AaiClientPropertiesImpl.java
index 822627863a..e330d2116c 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/AaiClientPropertiesImpl.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/AaiClientPropertiesImpl.java
@@ -24,6 +24,7 @@ import java.net.MalformedURLException;
import java.net.URL;
import org.onap.aaiclient.client.aai.AAIProperties;
import org.onap.aaiclient.client.aai.AAIVersion;
+import org.onap.so.client.CacheProperties;
import org.onap.so.spring.SpringContextHelper;
import org.springframework.context.ApplicationContext;
@@ -32,6 +33,10 @@ public class AaiClientPropertiesImpl implements AAIProperties {
private String aaiEndpoint;
private String auth;
private String key;
+ private Long readTimeout;
+ private Long connectionTimeout;
+ private boolean enableCaching;
+ private Long cacheMaxAge;
public AaiClientPropertiesImpl() {
@@ -39,6 +44,10 @@ public class AaiClientPropertiesImpl implements AAIProperties {
aaiEndpoint = context.getEnvironment().getProperty("mso.aai.endpoint");
this.auth = context.getEnvironment().getProperty("aai.auth");
this.key = context.getEnvironment().getProperty("mso.msoKey");
+ this.readTimeout = context.getEnvironment().getProperty("aai.readTimeout", Long.class, 60000L);
+ this.connectionTimeout = context.getEnvironment().getProperty("aai.connectionTimeout", Long.class, 60000L);
+ this.enableCaching = context.getEnvironment().getProperty("aai.caching.enabled", Boolean.class, false);
+ this.cacheMaxAge = context.getEnvironment().getProperty("aai.caching.maxAge", Long.class, 60000L);
}
@Override
@@ -65,4 +74,29 @@ public class AaiClientPropertiesImpl implements AAIProperties {
public String getKey() {
return this.key;
}
+
+ @Override
+ public Long getReadTimeout() {
+ return this.readTimeout;
+ }
+
+ @Override
+ public Long getConnectionTimeout() {
+ return this.connectionTimeout;
+ }
+
+ @Override
+ public boolean isCachingEnabled() {
+ return this.enableCaching;
+ }
+
+ @Override
+ public CacheProperties getCacheProperties() {
+ return new AAICacheProperties() {
+ @Override
+ public Long getMaxAge() {
+ return cacheMaxAge;
+ }
+ };
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/application.yaml b/mso-api-handlers/mso-api-handler-infra/src/main/resources/application.yaml
index b46690f2a7..6064f73e23 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/resources/application.yaml
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/resources/application.yaml
@@ -83,3 +83,7 @@ org:
adapters:
network:
encryptionKey: aa3871669d893c7fb8abbcda31b88b4f
+
+subnetCapability:
+ config:
+ file: /app/subnetCapability.json
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/Onap3gppServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/Onap3gppServiceInstancesTest.java
index 95f00c3a39..14a87bf915 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/Onap3gppServiceInstancesTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/Onap3gppServiceInstancesTest.java
@@ -187,7 +187,7 @@ public class Onap3gppServiceInstancesTest extends BaseTest {
String request = "{\"subnetTypes\":[\"AN\"]}";
QuerySubnetCapability subnetCapabilityRequest = MAPPER.readValue(request, QuerySubnetCapability.class);
String expectedResponse =
- "{\"AN\":{\"latency\":\"5\",\"maxNumberofUEs\":\"100\",\"maxThroughput\":\"150\",\"terminalDensity\":\"50\"}}";
+ "{\"AN\":{\"latency\":5,\"maxNumberofUEs\":\"100\",\"maxThroughput\":\"150\",\"terminalDensity\":\"50\"}}";
Response response = objUnderTest.getSliceSubnetCapabilities(subnetCapabilityRequest, "v1");
String actualResponse = (String) response.getEntity();
assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java
index 1f944da7ba..259ce418c6 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java
@@ -486,8 +486,8 @@ public class OrchestrationRequestsTest extends BaseTest {
.withBody(new String(Files.readAllBytes(
Paths.get("src/test/resources/OrchestrationRequest/getOrchestrationRequest.json"))))
.withStatus(HttpStatus.SC_OK)));
- wireMockServer
- .stubFor(get(urlPathEqualTo("/requestProcessingData/search/findBySoRequestIdOrderByGroupingIdDesc/"))
+ wireMockServer.stubFor(get(urlPathEqualTo(
+ "/requestProcessingData/search/findBySoRequestIdAndIsDataInternalOrderByGroupingIdDesc/"))
.withQueryParam("SO_REQUEST_ID", equalTo("00032ab7-1a18-42e5-965d-8ea592502018"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(new String(Files.readAllBytes(Paths
@@ -502,9 +502,10 @@ public class OrchestrationRequestsTest extends BaseTest {
.withBody(new String(Files.readAllBytes(Paths.get(
"src/test/resources/OrchestrationRequest/getOrchestrationRequestInstanceGroup.json"))))
.withStatus(HttpStatus.SC_OK)));
- wireMockServer
- .stubFor(get(urlPathEqualTo("/requestProcessingData/search/findBySoRequestIdOrderByGroupingIdDesc/"))
+ wireMockServer.stubFor(get(urlPathEqualTo(
+ "/requestProcessingData/search/findBySoRequestIdAndIsDataInternalOrderByGroupingIdDesc/"))
.withQueryParam("SO_REQUEST_ID", equalTo("00032ab7-1a18-42e5-965d-8ea592502018"))
+ .withQueryParam("IS_INTERNAL_DATA", equalTo("false"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(new String(Files.readAllBytes(Paths
.get("src/test/resources/OrchestrationRequest/getRequestProcessingData.json"))))
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/subnetCapability.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/Onap3gppServiceInstancesTest/subnetCapability.json
index 0d5acef64a..55b3831502 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/resources/subnetCapability.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/Onap3gppServiceInstancesTest/subnetCapability.json
@@ -1,25 +1,31 @@
{
"AN": {
- "latency": "5",
+ "latency": 5,
"maxNumberofUEs": "100",
"maxThroughput": "150",
"terminalDensity": "50"
},
"CN": {
- "latency": "10",
+ "latency": 10,
"maxThroughput": "50",
"maxNumberofConns": "100"
},
"TN_FH": {
- "latency": "10",
+ "latency": 10,
"maxThroughput": "100"
},
"TN_MH": {
- "latency": "5",
+ "latency": 5,
"maxThroughput": "50"
},
"TN_BH": {
- "latency": "10",
+ "latency": 10,
"maxThroughput": "100"
+ },
+ "AN_NF": {
+ "latency": 5,
+ "maxNumberofUEs": "100",
+ "maxThroughput": "150",
+ "terminalDensity": "50"
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationFilterResponse.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationFilterResponse.json
index 3b2eca7ce2..319e6a9949 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationFilterResponse.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationFilterResponse.json
@@ -64,7 +64,17 @@
"statusMessage": "STATUS: Vf Module has been deleted successfully. FLOW STATUS: Building blocks 1 of 3 completed. ROLLBACK STATUS: Rollback has been completed successfully.",
"percentProgress": 100,
"timestamp": "Thu, 22 Dec 2016 08:30:28 GMT"
- }
+ },
+ "requestProcessingData": [
+ {
+ "groupingId": "7d2e8c07-4d10-456d-bddc-37abf38ca714",
+ "dataPairs": [
+ {
+ "requestAction": "assign"
+ }
+ ]
+ }
+ ]
}
},
{
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml b/mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml
index 1429ac9b52..bcd36b8643 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml
@@ -140,3 +140,8 @@ org:
adapters:
network:
encryptionKey: aa3871669d893c7fb8abbcda31b88b4f
+
+subnetCapability:
+ config:
+ file: src/test/resources/Onap3gppServiceInstancesTest/subnetCapability.json
+
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql b/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql
index fd8c273b57..e0ec216399 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql
@@ -651,7 +651,7 @@ CREATE TABLE `network_resource` (
`TOSCA_NODE_TYPE` varchar(200) DEFAULT NULL,
`AIC_VERSION_MIN` varchar(20) NULL,
`AIC_VERSION_MAX` varchar(20) DEFAULT NULL,
- `ORCHESTRATION_MODE` varchar(20) DEFAULT 'HEAT',
+ `ORCHESTRATION_MODE` varchar(20) NOT NULL DEFAULT 'HEAT',
`CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`RESOURCE_CATEGORY` varchar(200) DEFAULT NULL,
`RESOURCE_SUB_CATEGORY` varchar(200) DEFAULT NULL,
@@ -958,8 +958,8 @@ CREATE TABLE `vf_module_customization` (
`ID` int(13) NOT NULL AUTO_INCREMENT,
`MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL,
`LABEL` varchar(200) DEFAULT NULL,
- `INITIAL_COUNT` int(11) DEFAULT '0',
- `MIN_INSTANCES` int(11) DEFAULT '0',
+ `INITIAL_COUNT` int(11) NOT NULL DEFAULT '0',
+ `MIN_INSTANCES` int(11) NOT NULL DEFAULT '0',
`MAX_INSTANCES` int(11) DEFAULT NULL,
`AVAILABILITY_ZONE_COUNT` int(11) DEFAULT NULL,
`HEAT_ENVIRONMENT_ARTIFACT_UUID` varchar(200) DEFAULT NULL,
@@ -1200,6 +1200,7 @@ CREATE TABLE IF NOT EXISTS `pnf_resource_customization` (
`CDS_BLUEPRINT_NAME` varchar(200) DEFAULT NULL,
`CDS_BLUEPRINT_VERSION` varchar(20) DEFAULT NULL,
`CONTROLLER_ACTOR` varchar(200) DEFAULT NULL,
+ `DEFAULT_SOFTWARE_VERSION` varchar(4000) DEFAULT NULL,
PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`),
KEY `fk_pnf_resource_customization__pnf_resource1_idx` (`PNF_RESOURCE_MODEL_UUID`),
CONSTRAINT `fk_pnf_resource_customization__pnf_resource1` FOREIGN KEY (`PNF_RESOURCE_MODEL_UUID`) REFERENCES `pnf_resource` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
@@ -1492,7 +1493,7 @@ CREATE TABLE IF NOT EXISTS `workflow` (
`RESOURCE_TARGET` varchar(200) NOT NULL,
`SOURCE` varchar(200) NOT NULL,
`TIMEOUT_MINUTES` int(11) DEFAULT NULL,
- `ARTIFACT_CHECKSUM` varchar(200) DEFAULT 'MANUAL RECORD',
+ `ARTIFACT_CHECKSUM` varchar(200) NULL DEFAULT 'MANUAL RECORD',
`CREATION_TIMESTAMP` datetime NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (`ID`),
UNIQUE KEY `UK_workflow` (`ARTIFACT_UUID`,`NAME`,`VERSION`,`SOURCE`)