summaryrefslogtreecommitdiffstats
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/CamundaRequestHandler.java3
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java16
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java9
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java13
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java67
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java9
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java5
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java53
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilder.java46
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/exception/AAIEntityNotFound.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java9
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java6
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/CloudConfigurationValidation.java5
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java45
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/MsoRequestTest.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java89
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java186
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesUnitTest.java100
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilderTest.java49
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/client/grm/GRMClientTest.java32
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getRequestProcessingDataArray.json8
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/AAIEntityNotFoundResponse.json8
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ReplaceVfModuleNoCloudConfig.json28
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ReplaceVnfNoCloudConfig.json58
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/VnfLookup.json30
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql7
29 files changed, 663 insertions, 236 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/CamundaRequestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/CamundaRequestHandler.java
index fb7ab3a61e..e9f17c42d0 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/CamundaRequestHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/CamundaRequestHandler.java
@@ -61,7 +61,8 @@ public class CamundaRequestHandler {
if (context.getRetryCount() == 0) {
logger.info("Querying Camunda for process-instance history for requestId: {}", requestId);
} else {
- logger.info("Retry: Querying Camunda for process-instance history for requestId: {}",
+ logger.info(
+ "Retry: Querying Camunda for process-instance history for retryCount: {} and requestId: {}",
context.getRetryCount(), requestId);
}
return restTemplate.exchange(targetUrl, HttpMethod.GET, requestEntity,
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java
index 650922094d..0bcb0f1c86 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java
@@ -295,7 +295,7 @@ public class E2EServiceInstances {
msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException,
"bpelResponse is null", ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(),
- MSO_PROP_APIHANDLER_INFRA, ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL");
+ MSO_PROP_APIHANDLER_INFRA, ErrorCode.BusinessProcessError.getValue(), "Null response from BPEL");
logger.debug(END_OF_THE_TRANSACTION + resp.getEntity().toString());
return resp;
}
@@ -333,7 +333,7 @@ public class E2EServiceInstances {
MsoException.ServiceException, "E2E serviceId " + serviceId + " is not found in DB",
ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, null, version);
logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(),
- MSO_PROP_APIHANDLER_INFRA, ErrorCode.BusinessProcesssError.getValue(),
+ MSO_PROP_APIHANDLER_INFRA, ErrorCode.BusinessProcessError.getValue(),
"Null response from RequestDB when searching by serviceId");
logger.debug(END_OF_THE_TRANSACTION + resp.getEntity());
return resp;
@@ -435,7 +435,7 @@ public class E2EServiceInstances {
msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException,
"bpelResponse is null", ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(),
- MSO_PROP_APIHANDLER_INFRA, ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL");
+ MSO_PROP_APIHANDLER_INFRA, ErrorCode.BusinessProcessError.getValue(), "Null response from BPEL");
logger.debug(END_OF_THE_TRANSACTION + resp.getEntity());
return resp;
}
@@ -549,7 +549,7 @@ public class E2EServiceInstances {
msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException,
"bpelResponse is null", ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(),
- MSO_PROP_APIHANDLER_INFRA, ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL");
+ MSO_PROP_APIHANDLER_INFRA, ErrorCode.BusinessProcessError.getValue(), "Null response from BPEL");
logger.debug(END_OF_THE_TRANSACTION + getBPMNResp.getEntity());
return getBPMNResp;
}
@@ -660,7 +660,7 @@ public class E2EServiceInstances {
msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException,
"bpelResponse is null", ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(),
- MSO_PROP_APIHANDLER_INFRA, ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL");
+ MSO_PROP_APIHANDLER_INFRA, ErrorCode.BusinessProcessError.getValue(), "Null response from BPEL");
logger.debug(END_OF_THE_TRANSACTION + resp.getEntity());
return resp;
}
@@ -760,7 +760,7 @@ public class E2EServiceInstances {
msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException,
"bpelResponse is null", ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(),
- MSO_PROP_APIHANDLER_INFRA, ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL");
+ MSO_PROP_APIHANDLER_INFRA, ErrorCode.BusinessProcessError.getValue(), "Null response from BPEL");
logger.debug(END_OF_THE_TRANSACTION + resp.getEntity());
return resp;
}
@@ -791,7 +791,7 @@ public class E2EServiceInstances {
"Request Failed due to BPEL error with HTTP Status= %1 " + '\n' + camundaJSONResponseBody,
ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, variables, version);
logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_BPEL_RESPONSE_ERROR.toString(),
- requestClient.getUrl(), ErrorCode.BusinessProcesssError.getValue(),
+ requestClient.getUrl(), ErrorCode.BusinessProcessError.getValue(),
"Response from BPEL engine is failed with HTTP Status=" + bpelStatus);
logger.debug(END_OF_THE_TRANSACTION + resp.getEntity());
return resp;
@@ -800,7 +800,7 @@ public class E2EServiceInstances {
"Request Failed due to BPEL error with HTTP Status= %1",
ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, variables, version);
logger.error("", MessageEnum.APIH_BPEL_RESPONSE_ERROR.toString(), requestClient.getUrl(),
- ErrorCode.BusinessProcesssError.getValue(), "Response from BPEL engine is empty");
+ ErrorCode.BusinessProcessError.getValue(), "Response from BPEL engine is empty");
logger.debug(END_OF_THE_TRANSACTION + resp.getEntity());
return resp;
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java
index 4bafb40b32..7e4452aeb3 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java
@@ -200,8 +200,9 @@ public class ManualTasks {
}
if (response == null) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR,
- ErrorCode.BusinessProcesssError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo =
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, ErrorCode.BusinessProcessError)
+ .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
BPMNFailureException bpmnFailureException =
@@ -229,7 +230,7 @@ public class ManualTasks {
} catch (JsonProcessingException e) {
ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR,
- ErrorCode.BusinessProcesssError).build();
+ ErrorCode.BusinessProcessError).build();
ValidateException validateException =
@@ -243,7 +244,7 @@ public class ManualTasks {
return builder.buildResponse(HttpStatus.SC_ACCEPTED, requestId, completeResp, apiVersion);
} else {
ErrorLoggerInfo errorLoggerInfo =
- new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.BusinessProcesssError)
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.BusinessProcessError)
.build();
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java
index 29195977b9..2307a18c1a 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java
@@ -140,18 +140,7 @@ public class MsoRequest {
}
re.setServiceException(se);
}
-
- String requestErrorStr = null;
-
- try {
- ObjectMapper mapper = new ObjectMapper();
- mapper.setSerializationInclusion(Include.NON_DEFAULT);
- requestErrorStr = mapper.writeValueAsString(re);
- } catch (Exception e) {
- logger.error("Exception in buildServiceErrorResponse writing exceptionType to string ", e);
- }
-
- return builder.buildResponse(httpResponseCode, null, requestErrorStr, version);
+ return builder.buildResponse(httpResponseCode, null, re, version);
}
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 cf4e63529c..ae68cc6032 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
@@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -44,6 +44,7 @@ import javax.ws.rs.core.UriInfo;
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.so.apihandler.common.ErrorNumbers;
import org.onap.so.apihandler.common.ResponseBuilder;
import org.onap.so.apihandlerinfra.exceptions.ApiException;
@@ -70,6 +71,7 @@ import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
import org.onap.so.utils.UUIDChecker;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -130,31 +132,36 @@ public class OrchestrationRequests {
infraActiveRequest = infraActiveRequestLookup(requestId);
- try {
- requestProcessingData = requestsDbClient.getRequestProcessingDataBySoRequestId(requestId);
- } catch (Exception e) {
- logger.error("Exception occurred while communicating with RequestDb during requestProcessingData lookup ",
- e);
- ErrorLoggerInfo errorLoggerInfo =
- new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.AvailabilityError).build();
+ if (isRequestProcessingDataRequired(format)) {
+ try {
+ requestProcessingData = requestsDbClient.getExternalRequestProcessingDataBySoRequestId(requestId);
+ } catch (Exception e) {
+ logger.error(
+ "Exception occurred while communicating with RequestDb during requestProcessingData lookup ",
+ e);
+ ErrorLoggerInfo errorLoggerInfo =
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.AvailabilityError)
+ .build();
- ValidateException validateException = new ValidateException.Builder(
- "Exception occurred while communicating with RequestDb during requestProcessingData lookup",
- HttpStatus.SC_NOT_FOUND, ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB).cause(e)
- .errorInfo(errorLoggerInfo).build();
+ ValidateException validateException = new ValidateException.Builder(
+ "Exception occurred while communicating with RequestDb during requestProcessingData lookup",
+ HttpStatus.SC_NOT_FOUND, ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB).cause(e)
+ .errorInfo(errorLoggerInfo).build();
- throw validateException;
+ throw validateException;
+ }
}
Request request = mapInfraActiveRequestToRequest(infraActiveRequest, includeCloudRequest, format);
- if (!requestProcessingData.isEmpty()) {
+ if (null != requestProcessingData && !requestProcessingData.isEmpty()) {
request.setRequestProcessingData(mapRequestProcessingData(requestProcessingData));
}
request.setRequestId(requestId);
orchestrationResponse.setRequest(request);
- return builder.buildResponse(HttpStatus.SC_OK, requestId, orchestrationResponse, apiVersion);
+ return builder.buildResponse(HttpStatus.SC_OK, MDC.get(ONAPLogConstants.MDCs.REQUEST_ID), orchestrationResponse,
+ apiVersion);
}
@GET
@@ -196,21 +203,26 @@ public class OrchestrationRequests {
orchestrationList = new GetOrchestrationListResponse();
List<RequestList> requestLists = new ArrayList<>();
+
for (InfraActiveRequests infraActive : activeRequests) {
- List<RequestProcessingData> requestProcessingData =
- requestsDbClient.getRequestProcessingDataBySoRequestId(infraActive.getRequestId());
RequestList requestList = new RequestList();
Request request = mapInfraActiveRequestToRequest(infraActive, includeCloudRequest, format);
- if (!requestProcessingData.isEmpty()) {
- request.setRequestProcessingData(mapRequestProcessingData(requestProcessingData));
+ if (isRequestProcessingDataRequired(format)) {
+ List<RequestProcessingData> requestProcessingData =
+ requestsDbClient.getRequestProcessingDataBySoRequestId(infraActive.getRequestId());
+ if (null != requestProcessingData && !requestProcessingData.isEmpty()) {
+ request.setRequestProcessingData(mapRequestProcessingData(requestProcessingData));
+ }
}
+
requestList.setRequest(request);
requestLists.add(requestList);
}
orchestrationList.setRequestList(requestLists);
- return builder.buildResponse(HttpStatus.SC_OK, null, orchestrationList, apiVersion);
+ return builder.buildResponse(HttpStatus.SC_OK, MDC.get(ONAPLogConstants.MDCs.REQUEST_ID), orchestrationList,
+ apiVersion);
}
@POST
@@ -524,6 +536,14 @@ public class OrchestrationRequests {
return addedRequestProcessingData;
}
+ protected boolean isRequestProcessingDataRequired(String format) {
+ if (StringUtils.isNotEmpty(format) && format.equalsIgnoreCase(OrchestrationRequestFormat.SIMPLE.name())) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+
protected InfraActiveRequests infraActiveRequestLookup(String requestId) throws ApiException {
InfraActiveRequests infraActiveRequest = null;
try {
@@ -542,8 +562,9 @@ public class OrchestrationRequests {
}
if (infraActiveRequest == null) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR,
- ErrorCode.BusinessProcesssError).build();
+ ErrorLoggerInfo errorLoggerInfo =
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, ErrorCode.BusinessProcessError)
+ .build();
ValidateException validateException = new ValidateException.Builder(
"Null response from RequestDB when searching by RequestId " + requestId, HttpStatus.SC_NOT_FOUND,
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java
index 557ae6c619..b078aed6ac 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java
@@ -154,8 +154,9 @@ public class RequestHandlerUtils extends AbstractRestHandler {
if (response == null) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR,
- ErrorCode.BusinessProcesssError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo =
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, ErrorCode.BusinessProcessError)
+ .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
ClientConnectionException clientException = new ClientConnectionException.Builder(requestClient.getUrl(),
HttpStatus.SC_BAD_GATEWAY, ErrorNumbers.SVC_NO_SERVER_RESOURCES).errorInfo(errorLoggerInfo).build();
updateStatus(currentActiveReq, Status.FAILED, clientException.getMessage());
@@ -220,7 +221,7 @@ public class RequestHandlerUtils extends AbstractRestHandler {
if (camundaJSONResponseBody != null && !camundaJSONResponseBody.isEmpty()) {
ErrorLoggerInfo errorLoggerInfo =
- new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.BusinessProcesssError)
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.BusinessProcessError)
.errorSource(requestClient.getUrl()).build();
BPMNFailureException bpmnException =
new BPMNFailureException.Builder(String.valueOf(bpelStatus) + camundaJSONResponseBody, bpelStatus,
@@ -232,7 +233,7 @@ public class RequestHandlerUtils extends AbstractRestHandler {
} else {
ErrorLoggerInfo errorLoggerInfo =
- new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.BusinessProcesssError)
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.BusinessProcessError)
.errorSource(requestClient.getUrl()).build();
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java
index 7cf9e338a8..65537cbba0 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java
@@ -122,8 +122,9 @@ public class ResumeOrchestrationRequest {
if (infraActiveRequest == null) {
logger.error("No infraActiveRequest record found for requestId: {} in requesteDb lookup", requestId);
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND,
- ErrorCode.BusinessProcesssError).build();
+ ErrorLoggerInfo errorLoggerInfo =
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, ErrorCode.BusinessProcessError)
+ .build();
ValidateException validateException = new ValidateException.Builder(
"Null response from requestDB when searching by requestId: " + requestId, HttpStatus.SC_NOT_FOUND,
ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build();
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
index bb5013085b..a1779ba0fd 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
@@ -46,6 +46,8 @@ import org.onap.so.apihandler.common.RequestClientParameter;
import org.onap.so.apihandlerinfra.exceptions.ApiException;
import org.onap.so.apihandlerinfra.exceptions.RequestDbFailureException;
import org.onap.so.apihandlerinfra.exceptions.ValidateException;
+import org.onap.so.apihandlerinfra.infra.rest.BpmnRequestBuilder;
+import org.onap.so.apihandlerinfra.infra.rest.exception.CloudConfigurationNotFoundException;
import org.onap.so.apihandlerinfra.infra.rest.handler.AbstractRestHandler;
import org.onap.so.apihandlerinfra.infra.rest.validators.RequestValidatorListenerRunner;
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
@@ -56,6 +58,7 @@ import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.exceptions.ValidationException;
import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
+import org.onap.so.serviceinstancebeans.CloudConfiguration;
import org.onap.so.serviceinstancebeans.ModelInfo;
import org.onap.so.serviceinstancebeans.ModelType;
import org.onap.so.serviceinstancebeans.RequestDetails;
@@ -107,6 +110,9 @@ public class ServiceInstances extends AbstractRestHandler {
@Autowired
private RequestValidatorListenerRunner requestValidatorListenerRunner;
+ @Autowired
+ private BpmnRequestBuilder bpmnRequestBuilder;
+
@POST
@Path("/{version:[vV][5-7]}/serviceInstances")
@Consumes(MediaType.APPLICATION_JSON)
@@ -825,10 +831,20 @@ public class ServiceInstances extends AbstractRestHandler {
if (sir.getRequestDetails().getRequestParameters() != null) {
aLaCarte = sir.getRequestDetails().getRequestParameters().getALaCarte();
}
+
requestHandlerUtils.parseRequest(sir, instanceIdMap, action, version, requestJSON, aLaCarte, requestId,
currentActiveReq);
+ if ((action == Action.replaceInstance || action == Action.replaceInstanceRetainAssignments)
+ && (requestScope.equals(ModelType.vnf.toString()) || requestScope.equals(ModelType.vfModule.toString()))
+ && sir.getRequestDetails().getCloudConfiguration() == null) {
+ CloudConfiguration cloudConfiguration =
+ getCloudConfigurationOnReplace(requestScope, instanceIdMap, currentActiveReq);
+ sir.getRequestDetails().setCloudConfiguration(cloudConfiguration);
+ setCloudConfigurationCurrentActiveRequest(cloudConfiguration, currentActiveReq);
+ }
requestHandlerUtils.setInstanceId(currentActiveReq, requestScope, null, instanceIdMap);
+
int requestVersion = Integer.parseInt(version.substring(1));
String instanceName = null;
if (sir.getRequestDetails().getRequestInfo() != null) {
@@ -910,7 +926,9 @@ public class ServiceInstances extends AbstractRestHandler {
ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e).errorInfo(errorLoggerInfo).build();
}
- if (!requestScope.equalsIgnoreCase(ModelType.service.name()) && action != Action.recreateInstance) {
+ if (!requestScope.equalsIgnoreCase(ModelType.service.name()) && action != Action.recreateInstance
+ && !(requestScope.equalsIgnoreCase(ModelType.vnf.name())
+ && (action == Action.replaceInstance || action == Action.replaceInstanceRetainAssignments))) {
aLaCarte = true;
} else if (aLaCarte == null) {
aLaCarte = false;
@@ -1041,7 +1059,6 @@ public class ServiceInstances extends AbstractRestHandler {
String serviceInstanceId;
Boolean aLaCarte = null;
String apiVersion = version.substring(1);
- boolean inProgress = false;
ServiceInstancesRequest sir;
sir = requestHandlerUtils.convertJsonToServiceInstanceRequest(requestJSON, action, requestId, requestUri);
@@ -1051,6 +1068,7 @@ public class ServiceInstances extends AbstractRestHandler {
if (sir.getRequestDetails().getRequestParameters() != null) {
aLaCarte = sir.getRequestDetails().getRequestParameters().getALaCarte();
}
+
requestHandlerUtils.parseRequest(sir, instanceIdMap, action, version, requestJSON, aLaCarte, requestId,
currentActiveReq);
requestHandlerUtils.setInstanceId(currentActiveReq, requestScope, null, instanceIdMap);
@@ -1134,4 +1152,35 @@ public class ServiceInstances extends AbstractRestHandler {
requestScope);
}
+ protected CloudConfiguration getCloudConfigurationOnReplace(String requestScope,
+ HashMap<String, String> instanceIdMap, InfraActiveRequests currentActiveReq) throws ApiException {
+ logger.debug("Replace request is missing cloudConfiguration, autofilling from create.");
+ CloudConfiguration cloudConfiguration = null;
+ if (requestScope.equals(ModelType.vfModule.toString())) {
+ cloudConfiguration = bpmnRequestBuilder.getCloudConfigurationVfModuleReplace(
+ instanceIdMap.get("vnfInstanceId"), instanceIdMap.get("vfModuleInstanceId"));
+ } else {
+ cloudConfiguration = bpmnRequestBuilder.mapCloudConfigurationVnf(instanceIdMap.get("vnfInstanceId"));
+ }
+
+ if (cloudConfiguration == null) {
+ String errorMessage = "CloudConfiguration not found during autofill for replace request.";
+ logger.error(errorMessage);
+ updateStatus(currentActiveReq, Status.FAILED, errorMessage);
+ throw new CloudConfigurationNotFoundException(
+ "CloudConfiguration not found during autofill for replace request.");
+ }
+ return cloudConfiguration;
+ }
+
+ protected void setCloudConfigurationCurrentActiveRequest(CloudConfiguration cloudConfiguration,
+ InfraActiveRequests currentActiveRequest) {
+ if (cloudConfiguration.getLcpCloudRegionId() != null) {
+ currentActiveRequest.setAicCloudRegion(cloudConfiguration.getLcpCloudRegionId());
+ }
+
+ if (cloudConfiguration.getTenantId() != null) {
+ currentActiveRequest.setTenantId(cloudConfiguration.getTenantId());
+ }
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java
index 09a1d9e5a6..edc287ce0a 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java
@@ -203,7 +203,7 @@ public class TasksHandler {
} else {
ErrorLoggerInfo errorLoggerInfo =
- new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.BusinessProcesssError)
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.BusinessProcessError)
.build();
throw new BPMNFailureException.Builder(String.valueOf(bpelStatus), bpelStatus,
ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build();
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilder.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilder.java
index ee2bb586cf..f37713d5b2 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilder.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilder.java
@@ -91,6 +91,16 @@ public class BpmnRequestBuilder {
return createServiceInstancesRequest(vnf, vfModule, modelType);
}
+ public CloudConfiguration getCloudConfigurationVfModuleReplace(String vnfId, String vfModuleId)
+ throws AAIEntityNotFound {
+ GenericVnf vnf = aaiDataRet.getGenericVnf(vnfId);
+ if (vnf == null) {
+ throw new AAIEntityNotFound(GENERIC_VNF_NOT_FOUND_IN_INVENTORY_VNF_ID + vnfId);
+ }
+
+ return mapCloudConfiguration(vnf, vfModuleId);
+ }
+
public ServiceInstancesRequest buildVolumeGroupDeleteRequest(String vnfId, String volumeGroupId)
throws AAIEntityNotFound {
GenericVnf vnf = aaiDataRet.getGenericVnf(vnfId);
@@ -174,7 +184,7 @@ public class BpmnRequestBuilder {
}
requestDetails.setModelInfo(mapVfModuleModelInformation(vfModule, modelType));
- requestDetails.setCloudConfiguration(mapCloudConfiguration(vnf, vfModule));
+ requestDetails.setCloudConfiguration(mapCloudConfiguration(vnf, vfModule.getVfModuleId()));
requestDetails.setRequestParameters(createRequestParameters());
return requestDetails;
}
@@ -264,7 +274,7 @@ public class BpmnRequestBuilder {
return modelInfo;
}
- public CloudConfiguration mapCloudConfiguration(GenericVnf vnf, VfModule vfModule) {
+ public CloudConfiguration mapCloudConfiguration(GenericVnf vnf, String vfModuleId) {
CloudConfiguration cloudConfig = new CloudConfiguration();
AAIResultWrapper wrapper = new AAIResultWrapper(vnf);
Optional<org.onap.so.client.aai.entities.Relationships> relationshipsOpt = wrapper.getRelationships();
@@ -281,7 +291,7 @@ public class BpmnRequestBuilder {
}
if (tenantId == null || cloudOwner == null || lcpRegionId == null) {
- Map<String, String[]> filters = createQueryRequest("vfModuleId", vfModule.getVfModuleId());
+ Map<String, String[]> filters = createQueryRequest("vfModuleId", vfModuleId);
Optional<ServiceInstancesRequest> request = findServiceInstanceRequest(filters);
if (request.isPresent()) {
if (request.get().getRequestDetails() != null
@@ -370,6 +380,36 @@ public class BpmnRequestBuilder {
return cloudConfig;
}
+ public CloudConfiguration mapCloudConfigurationVnf(String vnfId) {
+ CloudConfiguration cloudConfig = new CloudConfiguration();
+ String tenantId = null;
+ String cloudOwner = null;
+ String lcpRegionId = null;
+
+ Map<String, String[]> filters = createQueryRequest("vnfId", vnfId);
+ Optional<ServiceInstancesRequest> request = findServiceInstanceRequest(filters);
+ if (request.isPresent()) {
+ if (request.get().getRequestDetails() != null
+ && request.get().getRequestDetails().getCloudConfiguration() != null) {
+ if (request.get().getRequestDetails().getCloudConfiguration().getTenantId() != null) {
+ tenantId = request.get().getRequestDetails().getCloudConfiguration().getTenantId();
+ }
+ if (request.get().getRequestDetails().getCloudConfiguration().getCloudOwner() != null) {
+ cloudOwner = request.get().getRequestDetails().getCloudConfiguration().getCloudOwner();
+ }
+ if (request.get().getRequestDetails().getCloudConfiguration().getLcpCloudRegionId() != null) {
+ lcpRegionId = request.get().getRequestDetails().getCloudConfiguration().getLcpCloudRegionId();
+ }
+ }
+ } else {
+ throw new CloudConfigurationNotFoundException(CLOUD_CONFIGURATION_COULD_NOT_BE_FOUND);
+ }
+ cloudConfig.setTenantId(tenantId);
+ cloudConfig.setCloudOwner(cloudOwner);
+ cloudConfig.setLcpCloudRegionId(lcpRegionId);
+ return cloudConfig;
+ }
+
public Optional<ServiceInstancesRequest> findServiceInstanceRequest(Map<String, String[]> filters) {
List<InfraActiveRequests> completeRequests = infraActiveRequestsClient.getRequest(filters);
InfraActiveRequests foundRequest = completeRequests.get(0);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/exception/AAIEntityNotFound.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/exception/AAIEntityNotFound.java
index 2153d9a628..e7753b2134 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/exception/AAIEntityNotFound.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/exception/AAIEntityNotFound.java
@@ -20,7 +20,9 @@
package org.onap.so.apihandlerinfra.infra.rest.exception;
-public class AAIEntityNotFound extends Exception {
+import org.onap.so.apihandlerinfra.exceptions.ApiException;
+
+public class AAIEntityNotFound extends ApiException {
public AAIEntityNotFound(String errorMessage) {
super(errorMessage);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java
index 47d6932730..43f957174c 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java
@@ -134,8 +134,9 @@ public class CloudResourcesOrchestration {
}
if (infraActiveRequest == null) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND,
- ErrorCode.BusinessProcesssError).build();
+ ErrorLoggerInfo errorLoggerInfo =
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, ErrorCode.BusinessProcessError)
+ .build();
ValidateException validateException =
new ValidateException.Builder("Orchestration RequestId " + requestId + " is not found in DB",
HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR)
@@ -203,7 +204,7 @@ public class CloudResourcesOrchestration {
if (requestDB == null) {
ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR,
- ErrorCode.BusinessProcesssError).build();
+ ErrorCode.BusinessProcessError).build();
ValidateException validateException =
new ValidateException.Builder("Orchestration RequestId " + requestId + " is not found in DB",
HttpStatus.SC_NO_CONTENT, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR)
@@ -227,7 +228,7 @@ public class CloudResourcesOrchestration {
orchestrationMap = tenantIsolationRequest.getOrchestrationFilters(queryParams);
} catch (ValidationException ex) {
ErrorLoggerInfo errorLoggerInfo =
- new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcesssError)
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcessError)
.build();
ValidateException validateException =
new ValidateException.Builder(ex.getMessage(), HttpStatus.SC_INTERNAL_SERVER_ERROR,
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java
index de5edb5b54..65d3109445 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java
@@ -94,7 +94,7 @@ public class SDCClientHelper {
if (basicAuthCred == null || "".equals(basicAuthCred)) {
ErrorLoggerInfo errorLoggerInfo =
- new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcesssError)
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcessError)
.build();
throw new ValidateException.Builder(
@@ -143,7 +143,7 @@ public class SDCClientHelper {
return client.post(jsonPayload);
} catch (Exception ex) {
ErrorLoggerInfo errorLoggerInfo =
- new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcesssError)
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcessError)
.build();
throw new ValidateException.Builder("Bad request could not post payload", HttpStatus.SC_BAD_REQUEST,
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java
index 3957f86bab..0005d26016 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java
@@ -109,7 +109,7 @@ public class ActivateVnfOperationalEnvironment {
logger.debug(" aai workloadContext: {}", workloadContext);
if (!vidWorkloadContext.equals(workloadContext)) {
ErrorLoggerInfo errorLoggerInfo =
- new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcesssError)
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcessError)
.build();
throw new ValidateException.Builder(
" The vid workloadContext did not match from aai record. " + " vid workloadContext:"
@@ -119,7 +119,7 @@ public class ActivateVnfOperationalEnvironment {
}
if (ecompOperationalEnvironmentId == null) {
ErrorLoggerInfo errorLoggerInfo =
- new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcesssError)
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcessError)
.build();
throw new ValidateException.Builder(
" The ECOMP OE was not in aai record; the value of relationship.relationship-data key: "
@@ -183,7 +183,7 @@ public class ActivateVnfOperationalEnvironment {
} else {
ErrorLoggerInfo errorLoggerInfo =
- new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcesssError)
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcessError)
.build();
String dbErrorMessage = " Failure calling SDC: statusCode: " + statusCode + "; messageId: "
+ jsonResponse.get("messageId") + "; message: " + jsonResponse.get("message");
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java
index 3226a0c313..624a7f6945 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java
@@ -250,7 +250,7 @@ public class ActivateVnfStatusOperationalEnvironment {
String dbErrorMessage = "Failure calling SDC: statusCode: " + statusCode + "; messageId: "
+ jsonResponse.get("messageId") + "; message: " + jsonResponse.get("message");
ErrorLoggerInfo errorLoggerInfo =
- new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcesssError)
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcessError)
.build();
ValidateException validateException =
new ValidateException.Builder(dbErrorMessage, HttpStatus.SC_BAD_REQUEST,
@@ -304,7 +304,7 @@ public class ActivateVnfStatusOperationalEnvironment {
if (status.equals("Failure") && queryServiceModelResponseList.size() == count) {
this.errorMessage = "Overall Activation process is a Failure. " + status;
ErrorLoggerInfo errorLoggerInfo =
- new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcesssError)
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcessError)
.build();
ValidateException validateException =
new ValidateException.Builder(this.errorMessage, HttpStatus.SC_BAD_REQUEST,
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/CloudConfigurationValidation.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/CloudConfigurationValidation.java
index 2207c52048..a89032f50c 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/CloudConfigurationValidation.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/CloudConfigurationValidation.java
@@ -48,11 +48,6 @@ public class CloudConfigurationValidation implements ValidationRule {
|| action == Action.updateInstance)) {
throw new ValidationException("cloudConfiguration");
}
- if ((requestScope.equalsIgnoreCase(ModelType.vnf.name())
- || requestScope.equalsIgnoreCase(ModelType.vfModule.name()))
- && action == Action.replaceInstance) {
- throw new ValidationException("cloudConfiguration");
- }
if (requestScope.equalsIgnoreCase(ModelType.configuration.name())
&& (action == Action.enablePort || action == Action.disablePort
|| action == Action.activateInstance || action == Action.deactivateInstance)) {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java
index 8a112e3fdd..99542f02ff 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java
@@ -26,24 +26,13 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
import static com.shazam.shazamcrest.MatcherAssert.assertThat;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static com.shazam.shazamcrest.MatcherAssert.assertThat;
-import static org.onap.logging.filter.base.Constants.HttpHeaders.ECOMP_REQUEST_ID;
-import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.INVOCATION_ID;
-import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.PARTNER_NAME;
-import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.RESPONSE_CODE;
-import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION;
-import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.LOG_TIMESTAMP;
-import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.SERVICE_NAME;
-import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE;
import static org.onap.logging.filter.base.Constants.HttpHeaders.CLIENT_ID;
+import static org.onap.logging.filter.base.Constants.HttpHeaders.ECOMP_REQUEST_ID;
import java.io.IOException;
-import java.util.Map;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.apache.http.HttpStatus;
import org.junit.Test;
-import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.apihandlerinfra.tasksbeans.RequestDetails;
import org.onap.so.apihandlerinfra.tasksbeans.RequestInfo;
import org.onap.so.apihandlerinfra.tasksbeans.TaskRequestReference;
@@ -59,7 +48,6 @@ import org.springframework.web.util.UriComponentsBuilder;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.tomakehurst.wiremock.http.Fault;
-import ch.qos.logback.classic.spi.ILoggingEvent;
public class ManualTasksTest extends BaseTest {
@@ -108,34 +96,6 @@ public class ManualTasksTest extends BaseTest {
// then
assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
assertThat(realResponse, sameBeanAs(expectedResponse));
-
- for (ILoggingEvent logEvent : TestAppender.events)
- if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter")
- && logEvent.getMarker() != null && logEvent.getMarker().getName().equals("ENTRY")) {
- Map<String, String> mdc = logEvent.getMDCPropertyMap();
- assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
- assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
- assertNotNull(mdc.get(INVOCATION_ID));
- assertEquals("UNKNOWN", mdc.get(PARTNER_NAME));
- assertEquals("tasks/v1/55/complete", mdc.get(SERVICE_NAME));
- assertEquals("INPROGRESS", mdc.get(RESPONSE_STATUS_CODE));
- } else if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter")
- && logEvent.getMarker() != null && logEvent.getMarker().getName().equals("EXIT")) {
- Map<String, String> mdc = logEvent.getMDCPropertyMap();
- assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
- assertNotNull(mdc.get(LOG_TIMESTAMP));
- assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
- assertNotNull(mdc.get(INVOCATION_ID));
- assertEquals("202", mdc.get(RESPONSE_CODE));
- assertEquals("UNKNOWN", mdc.get(PARTNER_NAME));
- assertEquals("tasks/v1/55/complete", mdc.get(SERVICE_NAME));
- assertEquals("COMPLETE", mdc.get(RESPONSE_STATUS_CODE));
- assertNotNull(mdc.get(RESPONSE_DESCRIPTION));
- assertEquals("application/json", response.getHeaders().get(HttpHeaders.CONTENT_TYPE).get(0));
- assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0));
- assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0));
- assertEquals("1.0.0", response.getHeaders().get("X-LatestVersion").get(0));
- }
}
@Test
@@ -161,7 +121,6 @@ public class ManualTasksTest extends BaseTest {
restTemplate.exchange(builder.toUriString(), HttpMethod.POST, entity, String.class);
ObjectMapper mapper = new ObjectMapper();
- mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class);
@@ -198,7 +157,6 @@ public class ManualTasksTest extends BaseTest {
restTemplate.exchange(builder.toUriString(), HttpMethod.POST, entity, String.class);
ObjectMapper mapper = new ObjectMapper();
- mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class);
@@ -240,7 +198,6 @@ public class ManualTasksTest extends BaseTest {
ObjectMapper mapper = new ObjectMapper();
- mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/MsoRequestTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/MsoRequestTest.java
index 86bf8060a7..f1d5a5487f 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/MsoRequestTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/MsoRequestTest.java
@@ -278,10 +278,6 @@ public class MsoRequestTest extends BaseTest {
ServiceInstancesRequest.class),
instanceIdMapTest, Action.createInstance, 5},
{"No valid cloudConfiguration is specified",
- mapper.readValue(inputStream("/CloudConfiguration/CloudConfigurationVnf.json"),
- ServiceInstancesRequest.class),
- instanceIdMapTest, Action.replaceInstance, 5},
- {"No valid cloudConfiguration is specified",
mapper.readValue(inputStream("/CloudConfiguration/CloudConfigurationConfig.json"),
ServiceInstancesRequest.class),
instanceIdMapTest, Action.enablePort, 5},
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 151785dbeb..aa6a3836c1 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
@@ -45,6 +45,7 @@ import javax.ws.rs.core.Response;
import org.apache.http.HttpStatus;
import org.junit.Before;
import org.junit.Test;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.apihandler.common.ErrorNumbers;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
@@ -64,7 +65,6 @@ import org.springframework.http.ResponseEntity;
import org.springframework.web.util.UriComponentsBuilder;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -107,6 +107,18 @@ public class OrchestrationRequestsTest extends BaseTest {
.withBody(new String(Files.readAllBytes(Paths.get(
"src/test/resources/OrchestrationRequest/ActivityInstanceHistoryResponse.json"))))
.withStatus(HttpStatus.SC_OK)));
+ wireMockServer.stubFor(get(
+ ("/requestProcessingData/search/findBySoRequestIdAndIsDataInternalOrderByGroupingIdDesc?SO_REQUEST_ID=00032ab7-1a18-42e5-965d-8ea592502018&IS_INTERNAL_DATA=false"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(new String(Files.readAllBytes(Paths.get(
+ "src/test/resources/OrchestrationRequest/getRequestProcessingDataArray.json"))))
+ .withStatus(HttpStatus.SC_OK)));
+ wireMockServer.stubFor(get(
+ ("/requestProcessingData/search/findBySoRequestIdAndIsDataInternalOrderByGroupingIdDesc?SO_REQUEST_ID=00032ab7-3fb3-42e5-965d-8ea592502017&IS_INTERNAL_DATA=false"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(new String(Files.readAllBytes(Paths.get(
+ "src/test/resources/OrchestrationRequest/getRequestProcessingDataArray.json"))))
+ .withStatus(HttpStatus.SC_OK)));
}
@Test
@@ -117,10 +129,21 @@ public class OrchestrationRequestsTest extends BaseTest {
Request request = ORCHESTRATION_LIST.getRequestList().get(1).getRequest();
testResponse.setRequest(request);
+ testResponse.getRequest().setRequestProcessingData(new ArrayList<RequestProcessingData>());
+ RequestProcessingData e = new RequestProcessingData();
+ e.setGroupingId("7d2e8c07-4d10-456d-bddc-37abf38ca714");
+ e.setTag("pincFabricConfigRequest");
+ List<HashMap<String, String>> data = new ArrayList<HashMap<String, String>>();
+ HashMap<String, String> data1 = new HashMap<String, String>();
+ data1.put("requestAction", "assign");
+ data.add(data1);
+ e.setDataPairs(data);
+ testResponse.getRequest().getRequestProcessingData().add(e);
String testRequestId = request.getRequestId();
HttpHeaders headers = new HttpHeaders();
headers.set("Accept", MediaType.APPLICATION_JSON);
headers.set("Content-Type", MediaType.APPLICATION_JSON);
+ headers.set(ONAPLogConstants.Headers.REQUEST_ID, "1e45215d-b7b3-4c5a-9316-65bdddaf649f");
HttpEntity<Request> entity = new HttpEntity<Request>(null, headers);
UriComponentsBuilder builder = UriComponentsBuilder
@@ -136,7 +159,41 @@ public class OrchestrationRequestsTest extends BaseTest {
assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0));
assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0));
assertEquals("7.0.0", response.getHeaders().get("X-LatestVersion").get(0));
- assertEquals("00032ab7-1a18-42e5-965d-8ea592502018", response.getHeaders().get("X-TransactionID").get(0));
+ assertEquals("1e45215d-b7b3-4c5a-9316-65bdddaf649f", response.getHeaders().get("X-TransactionID").get(0));
+ assertNotNull(response.getBody().getRequest().getFinishTime());
+ }
+
+ @Test
+ public void getOrchestrationRequestSimpleTest() throws Exception {
+ setupTestGetOrchestrationRequest();
+ // TEST VALID REQUEST
+ GetOrchestrationResponse testResponse = new GetOrchestrationResponse();
+
+ Request request = ORCHESTRATION_LIST.getRequestList().get(1).getRequest();
+ request.setRequestProcessingData(null);
+ testResponse.setRequest(request);
+
+ String testRequestId = request.getRequestId();
+ HttpHeaders headers = new HttpHeaders();
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+ headers.set("Content-Type", MediaType.APPLICATION_JSON);
+ headers.set(ONAPLogConstants.Headers.REQUEST_ID, "e5e3c007-9fe9-4a20-8691-bdd20e14504d");
+ HttpEntity<Request> entity = new HttpEntity<Request>(null, headers);
+ UriComponentsBuilder builder = UriComponentsBuilder
+ .fromHttpUrl(createURLWithPort("/onap/so/infra/orchestrationRequests/v7/" + testRequestId))
+ .queryParam("format", "simple");
+
+ ResponseEntity<GetOrchestrationResponse> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, GetOrchestrationResponse.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ assertThat(response.getBody(), sameBeanAs(testResponse).ignoring("request.startTime")
+ .ignoring("request.finishTime").ignoring("request.requestStatus.timeStamp"));
+ assertEquals("application/json", response.getHeaders().get(HttpHeaders.CONTENT_TYPE).get(0));
+ assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0));
+ assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0));
+ assertEquals("7.0.0", response.getHeaders().get("X-LatestVersion").get(0));
+ assertEquals("e5e3c007-9fe9-4a20-8691-bdd20e14504d", response.getHeaders().get("X-TransactionID").get(0));
assertNotNull(response.getBody().getRequest().getFinishTime());
}
@@ -148,6 +205,16 @@ public class OrchestrationRequestsTest extends BaseTest {
Request request = ORCHESTRATION_LIST.getRequestList().get(8).getRequest();
testResponse.setRequest(request);
+ testResponse.getRequest().setRequestProcessingData(new ArrayList<RequestProcessingData>());
+ RequestProcessingData e = new RequestProcessingData();
+ e.setGroupingId("7d2e8c07-4d10-456d-bddc-37abf38ca714");
+ e.setTag("pincFabricConfigRequest");
+ List<HashMap<String, String>> data = new ArrayList<HashMap<String, String>>();
+ HashMap<String, String> data1 = new HashMap<String, String>();
+ data1.put("requestAction", "assign");
+ data.add(data1);
+ e.setDataPairs(data);
+ testResponse.getRequest().getRequestProcessingData().add(e);
String testRequestId = request.getRequestId();
HttpHeaders headers = new HttpHeaders();
headers.set("Accept", MediaType.APPLICATION_JSON);
@@ -184,10 +251,21 @@ public class OrchestrationRequestsTest extends BaseTest {
request.setCloudRequestData(cloudRequestData);
testResponse.setRequest(request);
String testRequestId = request.getRequestId();
+ testResponse.getRequest().setRequestProcessingData(new ArrayList<RequestProcessingData>());
+ RequestProcessingData e = new RequestProcessingData();
+ e.setGroupingId("7d2e8c07-4d10-456d-bddc-37abf38ca714");
+ e.setTag("pincFabricConfigRequest");
+ List<HashMap<String, String>> data = new ArrayList<HashMap<String, String>>();
+ HashMap<String, String> data1 = new HashMap<String, String>();
+ data1.put("requestAction", "assign");
+ data.add(data1);
+ e.setDataPairs(data);
+ testResponse.getRequest().getRequestProcessingData().add(e);
HttpHeaders headers = new HttpHeaders();
headers.set("Accept", MediaType.APPLICATION_JSON);
headers.set("Content-Type", MediaType.APPLICATION_JSON);
+ headers.set(ONAPLogConstants.Headers.REQUEST_ID, "0321e28d-3dde-4b31-9b28-1e0f07231b93");
HttpEntity<Request> entity = new HttpEntity<Request>(null, headers);
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(
@@ -204,7 +282,7 @@ public class OrchestrationRequestsTest extends BaseTest {
assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0));
assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0));
assertEquals("7.0.0", response.getHeaders().get("X-LatestVersion").get(0));
- assertEquals("00032ab7-3fb3-42e5-965d-8ea592502017", response.getHeaders().get("X-TransactionID").get(0));
+ assertEquals("0321e28d-3dde-4b31-9b28-1e0f07231b93", response.getHeaders().get("X-TransactionID").get(0));
}
@Test
@@ -281,7 +359,6 @@ public class OrchestrationRequestsTest extends BaseTest {
public void testUnlockOrchestrationRequest() throws Exception {
setupTestUnlockOrchestrationRequest("0017f68c-eb2d-45bb-b7c7-ec31b37dc349", "UNLOCKED");
ObjectMapper mapper = new ObjectMapper();
- mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true);
String requestJSON =
new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/Request.json")));
HttpHeaders headers = new HttpHeaders();
@@ -317,7 +394,6 @@ public class OrchestrationRequestsTest extends BaseTest {
public void testUnlockOrchestrationRequest_invalid_Json() throws Exception {
setupTestUnlockOrchestrationRequest_invalid_Json();
ObjectMapper mapper = new ObjectMapper();
- mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true);
String requestJSON =
new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/Request.json")));
HttpHeaders headers = new HttpHeaders();
@@ -345,7 +421,7 @@ public class OrchestrationRequestsTest extends BaseTest {
actualRequestError = mapper.readValue(response.getBody(), RequestError.class);
assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatusCode().value());
- assertThat(actualRequestError, sameBeanAs(expectedRequestError));
+ assertThat(expectedRequestError, sameBeanAs(actualRequestError));
}
@Test
@@ -408,6 +484,7 @@ public class OrchestrationRequestsTest extends BaseTest {
assertThat(actualProcessingData, sameBeanAs(expectedDataList));
}
+
public void setupTestGetOrchestrationRequest() throws Exception {
// For testGetOrchestrationRequest
wireMockServer.stubFor(any(urlPathEqualTo("/infraActiveRequests/00032ab7-1a18-42e5-965d-8ea592502018"))
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
index 49510536e5..9f742784d4 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
@@ -29,14 +29,13 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
+import static org.onap.logging.filter.base.Constants.HttpHeaders.CLIENT_ID;
import static org.onap.logging.filter.base.Constants.HttpHeaders.ONAP_REQUEST_ID;
-import static org.onap.so.logger.HttpHeadersConstants.REQUESTOR_ID;
import static org.onap.logging.filter.base.Constants.HttpHeaders.TRANSACTION_ID;
-import static org.onap.logging.filter.base.Constants.HttpHeaders.CLIENT_ID;
+import static org.onap.so.logger.HttpHeadersConstants.REQUESTOR_ID;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
@@ -81,12 +80,10 @@ import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.tomakehurst.wiremock.http.Fault;
-import ch.qos.logback.classic.spi.ILoggingEvent;
public class ServiceInstancesTest extends BaseTest {
private final ObjectMapper mapper = new ObjectMapper();
- private ObjectMapper errorMapper = new ObjectMapper();
@Autowired
private ServiceInstances servInstances;
@@ -108,8 +105,6 @@ public class ServiceInstancesTest extends BaseTest {
@Before
public void beforeClass() {
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
- errorMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
- errorMapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true);
// set headers
headers = new HttpHeaders();
headers.set(ONAPLogConstants.Headers.PARTNER_NAME, "test_name");
@@ -124,7 +119,7 @@ public class ServiceInstancesTest extends BaseTest {
} catch (MalformedURLException e) {
e.printStackTrace();
}
- wireMockServer.stubFor(post(urlMatching(".*/infraActiveRequests.*")).willReturn(aResponse()
+ wireMockServer.stubFor(post(urlMatching(".*/infraActiveRequests/")).willReturn(aResponse()
.withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).withStatus(HttpStatus.SC_OK)));
Mockito.doReturn(null).when(requestsDbClient).getInfraActiveRequestbyRequestId(Mockito.any());
}
@@ -217,37 +212,6 @@ public class ServiceInstancesTest extends BaseTest {
assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class);
assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
-
-
-
- for (ILoggingEvent logEvent : TestAppender.events)
- if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter")
- && logEvent.getMarker() != null && logEvent.getMarker().getName().equals("ENTRY")) {
- Map<String, String> mdc = logEvent.getMDCPropertyMap();
- assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
- assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
- assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID));
- assertEquals("UNKNOWN", mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME));
- assertEquals("onap/so/infra/serviceInstantiation/v5/serviceInstances",
- mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME));
- assertEquals("INPROGRESS", mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
- } else if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter")
- && logEvent.getMarker() != null && logEvent.getMarker().getName().equals("EXIT")) {
- Map<String, String> mdc = logEvent.getMDCPropertyMap();
- assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
- assertNotNull(mdc.get(ONAPLogConstants.MDCs.LOG_TIMESTAMP));
- assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
- assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID));
- assertEquals("202", mdc.get(ONAPLogConstants.MDCs.RESPONSE_CODE));
- assertEquals("UNKNOWN", mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME));
- assertEquals("onap/so/infra/serviceInstantiation/v5/serviceInstances",
- mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME));
- assertEquals("COMPLETE", mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
- assertNotNull(mdc.get(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION));
- assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0));
- assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0));
- assertEquals("5.0.0", response.getHeaders().get("X-LatestVersion").get(0));
- }
}
@Test
@@ -400,15 +364,6 @@ public class ServiceInstancesTest extends BaseTest {
.withStatus(HttpStatus.SC_NOT_FOUND)));
assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatusCode().value());
-
- for (ILoggingEvent logEvent : TestAppender.events) {
- if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.SOAuditLogContainerFilter")
- && logEvent.getMarker() != null && logEvent.getMarker().getName().equals("ENTRY")) {
- Map<String, String> mdc = logEvent.getMDCPropertyMap();
- assertEquals("32807a28-1a14-4b88-b7b3-2950918aa76d", mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
- assertNotNull(mdc.get("PartnerName"));
- }
- }
}
@Test
@@ -907,7 +862,7 @@ public class ServiceInstancesTest extends BaseTest {
ResponseEntity<String> response = sendRequest(inputStream("/NoVnfResource.json"), uri, HttpMethod.POST);
assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value());
- RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class);
+ RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class);
assertEquals("No valid vnfResource is specified", realResponse.getServiceException().getText());
}
@@ -950,6 +905,45 @@ public class ServiceInstancesTest extends BaseTest {
}
@Test
+ public void replaceVnfInstanceNoCloudConfig() throws IOException {
+ wireMockServer.stubFor(post(urlMatching(".*/infraActiveRequests/v1/getInfraActiveRequests.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBodyFile("infra/VnfLookup.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
+ wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
+ wireMockServer.stubFor(get(urlMatching(
+ ".*/vnfResourceCustomization/search/findByModelCustomizationUUID[?]MODEL_CUSTOMIZATION_UUID=68dc9a92-214c-11e7-93ae-92361f002671"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb(
+ "vnfResourceCustomization_ReplaceVnf_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+ wireMockServer.stubFor(get(urlMatching(".*/vnfResourceCustomization/1/vnfResources"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vnfResources_ReplaceVnf_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+ wireMockServer.stubFor(get(urlMatching(
+ ".*/vnfRecipe/search/findFirstVnfRecipeByNfRoleAndAction[?]nfRole=GR-API-DEFAULT&action=replaceInstance"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vnfRecipeReplaceInstance_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+ // expected response
+ ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
+ RequestReferences requestReferences = new RequestReferences();
+ requestReferences.setInstanceId("1882939");
+ requestReferences.setRequestSelfLink(createExpectedSelfLink("v7", "32807a28-1a14-4b88-b7b3-2950918aa76d"));
+ expectedResponse.setRequestReferences(requestReferences);
+ uri = servInstanceuri + "v7"
+ + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/replace";
+ ResponseEntity<String> response =
+ sendRequest(inputStream("/ReplaceVnfNoCloudConfig.json"), uri, HttpMethod.POST, headers);
+
+ assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
+ ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class);
+ assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
+ }
+
+ @Test
public void replaceVnfRecreateInstance() throws IOException {
wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/RecreateInfraVce"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
@@ -1340,7 +1334,7 @@ public class ServiceInstancesTest extends BaseTest {
sendRequest(inputStream("/VfModuleInvalid.json"), uri, HttpMethod.POST, headers);
assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value());
- RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class);
+ RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class);
assertEquals("No valid vfModuleCustomization is specified", realResponse.getServiceException().getText());
}
@@ -1381,6 +1375,44 @@ public class ServiceInstancesTest extends BaseTest {
}
@Test
+ public void replaceVfModuleInstanceNoCloudConfigurationTest() throws IOException {
+ wireMockServer.stubFor(
+ get(urlPathEqualTo("/aai/v19/network/generic-vnfs/generic-vnf/ff305d54-75b4-431b-adb2-eb6b9e5ff000"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBodyFile("infra/Vnf.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
+ wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
+ wireMockServer
+ .stubFor(get(urlMatching(".*/vfModule/search/findFirstVfModuleByModelInvariantUUIDAndModelVersion[?]"
+ + "modelInvariantUUID=78ca26d0-246d-11e7-93ae-92361f002671&modelVersion=2"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vfModule_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+ wireMockServer.stubFor(get(urlMatching(
+ ".*/vnfComponentsRecipe/search/findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction"
+ + "[?]vfModuleModelUUID=GR-API-DEFAULT&vnfComponentType=vfModule&action=replaceInstance"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb(
+ "vnfComponentRecipeDeleteVfModule_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+ // expected response
+ ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
+ RequestReferences requestReferences = new RequestReferences();
+ requestReferences.setInstanceId("1882939");
+ requestReferences.setRequestSelfLink(createExpectedSelfLink("v7", "32807a28-1a14-4b88-b7b3-2950918aa76d"));
+ expectedResponse.setRequestReferences(requestReferences);
+ uri = servInstanceuri + "v7"
+ + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vfModules/ff305d54-75b4-431b-adb2-eb6b9e5ff000/replace";
+ ResponseEntity<String> response =
+ sendRequest(inputStream("/ReplaceVfModuleNoCloudConfig.json"), uri, HttpMethod.POST, headers);
+
+ assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
+ ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class);
+ assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
+ }
+
+ @Test
public void updateVfModuleInstance() throws IOException {
wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
@@ -2143,7 +2175,7 @@ public class ServiceInstancesTest extends BaseTest {
sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST, headers);
assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
- RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class);
+ RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class);
assertEquals("Request Failed due to BPEL error with HTTP Status = 202{\"instanceId\": \"1882939\"}",
realResponse.getServiceException().getText());
}
@@ -2178,7 +2210,7 @@ public class ServiceInstancesTest extends BaseTest {
sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST, headers);
assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
- RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class);
+ RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class);
assertEquals("Exception caught mapping Camunda JSON response to object",
realResponse.getServiceException().getText());
}
@@ -2211,7 +2243,7 @@ public class ServiceInstancesTest extends BaseTest {
sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST, headers);
assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
- RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class);
+ RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class);
assertTrue(realResponse.getServiceException().getText()
.contains("<aetgt:ErrorMessage>Exception in create execution list 500"));
}
@@ -2379,7 +2411,7 @@ public class ServiceInstancesTest extends BaseTest {
sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST, headers);
assertEquals(Response.Status.NOT_ACCEPTABLE.getStatusCode(), response.getStatusCode().value());
- RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class);
+ RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class);
assertEquals("Exception caught mapping Camunda JSON response to object",
realResponse.getServiceException().getText());
}
@@ -2395,7 +2427,7 @@ public class ServiceInstancesTest extends BaseTest {
sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST, headers);
assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
- RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class);
+ RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class);
assertEquals(
"Unable to check for duplicate instance due to error contacting requestDb: org.springframework.web.client.HttpServerErrorException$InternalServerError: 500 Server Error",
realResponse.getServiceException().getText());
@@ -2418,7 +2450,7 @@ public class ServiceInstancesTest extends BaseTest {
sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST, headers);
assertEquals(Response.Status.CONFLICT.getStatusCode(), response.getStatusCode().value());
- RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class);
+ RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class);
assertEquals(
"Error: Locked instance - This service (testService9) already has a request being worked with a status of UNLOCKED (RequestId - f0a35706-efc4-4e27-80ea-a995d7a2a40f). The existing request must finish or be cleaned up before proceeding.",
realResponse.getServiceException().getText());
@@ -2440,7 +2472,7 @@ public class ServiceInstancesTest extends BaseTest {
sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST, headers);
assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
- RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class);
+ RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class);
assertEquals(
"Unable to get process-instance history from Camunda for requestId: f0a35706-efc4-4e27-80ea-a995d7a2a40f due to error: org.springframework.web.client.HttpServerErrorException$InternalServerError: 500 Server Error",
realResponse.getServiceException().getText());
@@ -2457,7 +2489,7 @@ public class ServiceInstancesTest extends BaseTest {
sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST, headers);
assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
- RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class);
+ RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class);
assertEquals(
"Unable to check for duplicate instance due to error contacting requestDb: org.springframework.web.client.HttpServerErrorException$InternalServerError: 500 Server Error",
realResponse.getServiceException().getText());
@@ -2489,7 +2521,7 @@ public class ServiceInstancesTest extends BaseTest {
sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST, headers);
assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
- RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class);
+ RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class);
assertEquals(
"Unable to save instance to db due to error contacting requestDb: org.springframework.web.client.HttpServerErrorException$InternalServerError: 500 Server Error",
realResponse.getServiceException().getText());
@@ -2509,7 +2541,7 @@ public class ServiceInstancesTest extends BaseTest {
sendRequest(inputStream("/ServiceInstancePortConfiguration.json"), uri, HttpMethod.POST, headers);
assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
- RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class);
+ RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class);
assertEquals(
"Unable to save instance to db due to error contacting requestDb: org.springframework.web.client.HttpServerErrorException$InternalServerError: 500 Server Error",
realResponse.getServiceException().getText());
@@ -2526,7 +2558,7 @@ public class ServiceInstancesTest extends BaseTest {
sendRequest(inputStream("/ServiceInstanceParseFail.json"), uri, HttpMethod.POST, headers);
assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
- RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class);
+ RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class);
assertEquals(
"Unable to save instance to db due to error contacting requestDb: org.springframework.web.client.HttpServerErrorException$InternalServerError: 500 Server Error",
realResponse.getServiceException().getText());
@@ -2571,15 +2603,6 @@ public class ServiceInstancesTest extends BaseTest {
ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class);
assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
assertEquals(response.getHeaders().get(TRANSACTION_ID).get(0), "32807a28-1a14-4b88-b7b3-2950918aa76d");
-
- for (ILoggingEvent logEvent : TestAppender.events) {
- if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter")
- && logEvent.getMarker() != null && logEvent.getMarker().getName().equals("ENTRY")) {
- Map<String, String> mdc = logEvent.getMDCPropertyMap();
- assertEquals("32807a28-1a14-4b88-b7b3-2950918aa76d", mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
- assertEquals("VID", mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME));
- }
- }
}
@Test
@@ -2631,7 +2654,7 @@ public class ServiceInstancesTest extends BaseTest {
ResponseEntity<String> response = sendRequest(null, uri, HttpMethod.DELETE);
// then
assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value());
- RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class);
+ RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class);
assertEquals(realResponse.getServiceException().getText(), "No valid X-ONAP-RequestID header is specified");
}
@@ -2644,7 +2667,7 @@ public class ServiceInstancesTest extends BaseTest {
ResponseEntity<String> response = sendRequest(null, uri, HttpMethod.DELETE, noPartnerHeaders);
// then
assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value());
- RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class);
+ RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class);
assertEquals(realResponse.getServiceException().getText(), "No valid X-ONAP-PartnerName header is specified");
}
@@ -2663,7 +2686,7 @@ public class ServiceInstancesTest extends BaseTest {
// then
assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value());
- RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class);
+ RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class);
assertEquals(realResponse.getServiceException().getText(), "No valid X-RequestorID header is specified");
}
@@ -2751,7 +2774,7 @@ public class ServiceInstancesTest extends BaseTest {
ResponseEntity<String> response = sendRequest(inputStream("/UpdateNetwork.json"), uri, HttpMethod.PUT, headers);
assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value());
- RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class);
+ RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class);
assertEquals(realResponse.getServiceException().getText(),
"No valid modelCustomizationId for networkResourceCustomization lookup is specified");
}
@@ -2933,5 +2956,20 @@ public class ServiceInstancesTest extends BaseTest {
Actions action = servInstances.handleReplaceInstance(Action.replaceInstance, sir);
assertEquals(Action.replaceInstanceRetainAssignments, action);
}
+
+ @Test
+ public void getCloudConfigurationAAIEntityNotFoundTest() throws IOException {
+ RequestError expectedResponse =
+ mapper.readValue(inputStream("/AAIEntityNotFoundResponse.json"), RequestError.class);
+ uri = servInstanceuri + "v7"
+ + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vfModules/ff305d54-75b4-431b-adb2-eb6b9e5ff000/replace";
+ ResponseEntity<String> response =
+ sendRequest(inputStream("/ReplaceVfModuleNoCloudConfig.json"), uri, HttpMethod.POST, headers);
+
+ assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
+ RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class);
+ assertThat(expectedResponse, sameBeanAs(realResponse));
+ }
+
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesUnitTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesUnitTest.java
new file mode 100644
index 0000000000..5c3ac0f461
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesUnitTest.java
@@ -0,0 +1,100 @@
+package org.onap.so.apihandlerinfra;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.doReturn;
+import java.util.HashMap;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.apihandlerinfra.exceptions.ApiException;
+import org.onap.so.apihandlerinfra.infra.rest.BpmnRequestBuilder;
+import org.onap.so.apihandlerinfra.infra.rest.exception.CloudConfigurationNotFoundException;
+import org.onap.so.apihandlerinfra.vnfbeans.ModelType;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.serviceinstancebeans.CloudConfiguration;
+
+@RunWith(MockitoJUnitRunner.class)
+public class ServiceInstancesUnitTest {
+
+ @Mock
+ private BpmnRequestBuilder bpmnRequestBuilder;
+
+ @Spy
+ @InjectMocks
+ private ServiceInstances serviceInstances;
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+
+ @Test
+ public void getCloudConfigurationOnReplaceVnfTest() throws ApiException {
+ CloudConfiguration cloudConfiguration = new CloudConfiguration();
+ cloudConfiguration.setTenantId("tenantId");
+ cloudConfiguration.setLcpCloudRegionId("lcpCloudRegionId");
+ String requestScope = ModelType.vnf.toString();
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("vnfInstanceId", "17c10d8e-48f4-4ee6-b162-a801943df6d6");
+ InfraActiveRequests currentActiveRequest = new InfraActiveRequests();
+
+ doReturn(cloudConfiguration).when(bpmnRequestBuilder)
+ .mapCloudConfigurationVnf("17c10d8e-48f4-4ee6-b162-a801943df6d6");
+ CloudConfiguration result =
+ serviceInstances.getCloudConfigurationOnReplace(requestScope, instanceIdMap, currentActiveRequest);
+
+ assertEquals(cloudConfiguration, result);
+ }
+
+ @Test
+ public void getCloudConfigurationOnReplaceVfModuleTest() throws ApiException {
+ CloudConfiguration cloudConfiguration = new CloudConfiguration();
+ cloudConfiguration.setTenantId("tenantId");
+ cloudConfiguration.setLcpCloudRegionId("lcpCloudRegionId");
+ String requestScope = ModelType.vfModule.toString();
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("vnfInstanceId", "17c10d8e-48f4-4ee6-b162-a801943df6d6");
+ instanceIdMap.put("vfModuleInstanceId", "17c10d8e-48f4-4ee6-b162-a801943df6d8");
+ InfraActiveRequests currentActiveRequest = new InfraActiveRequests();
+
+ doReturn(cloudConfiguration).when(bpmnRequestBuilder).getCloudConfigurationVfModuleReplace(
+ "17c10d8e-48f4-4ee6-b162-a801943df6d6", "17c10d8e-48f4-4ee6-b162-a801943df6d8");
+ CloudConfiguration result =
+ serviceInstances.getCloudConfigurationOnReplace(requestScope, instanceIdMap, currentActiveRequest);
+
+ assertEquals(cloudConfiguration, result);
+ }
+
+ @Test
+ public void getCloudConfigurationReturnsNullTest() throws ApiException {
+ String requestScope = ModelType.vfModule.toString();
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("vnfInstanceId", "17c10d8e-48f4-4ee6-b162-a801943df6d6");
+ instanceIdMap.put("vfModuleInstanceId", "17c10d8e-48f4-4ee6-b162-a801943df6d8");
+ InfraActiveRequests currentActiveRequest = new InfraActiveRequests();
+
+ doReturn(null).when(bpmnRequestBuilder).getCloudConfigurationVfModuleReplace(
+ "17c10d8e-48f4-4ee6-b162-a801943df6d6", "17c10d8e-48f4-4ee6-b162-a801943df6d8");
+ thrown.expect(CloudConfigurationNotFoundException.class);
+ thrown.expectMessage("CloudConfiguration not found during autofill for replace request.");
+
+ serviceInstances.getCloudConfigurationOnReplace(requestScope, instanceIdMap, currentActiveRequest);
+ }
+
+ @Test
+ public void setCloudConfigurationCurrentActiveRequestTest() {
+ CloudConfiguration cloudConfiguration = new CloudConfiguration();
+ cloudConfiguration.setTenantId("tenantId");
+ cloudConfiguration.setLcpCloudRegionId("lcpCloudRegionId");
+
+ InfraActiveRequests currentActiveRequest = new InfraActiveRequests();
+ serviceInstances.setCloudConfigurationCurrentActiveRequest(cloudConfiguration, currentActiveRequest);
+
+ assertEquals("tenantId", currentActiveRequest.getTenantId());
+ assertEquals("lcpCloudRegionId", currentActiveRequest.getAicCloudRegion());
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilderTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilderTest.java
index f73da49e0d..faac11715a 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilderTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilderTest.java
@@ -22,9 +22,12 @@ package org.onap.so.apihandlerinfra.infra.rest;
import static com.shazam.shazamcrest.MatcherAssert.assertThat;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.spy;
import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
import java.util.Optional;
import org.junit.Before;
import org.junit.Rule;
@@ -43,8 +46,11 @@ import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
+import org.onap.so.constants.Status;
import org.onap.so.db.request.client.RequestsDbClient;
+import org.onap.so.serviceinstancebeans.CloudConfiguration;
import org.onap.so.serviceinstancebeans.ModelType;
+import org.onap.so.serviceinstancebeans.RequestDetails;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -143,5 +149,48 @@ public class BpmnRequestBuilderTest {
assertThat(actualRequest, sameBeanAs(expectedRequest));
}
+ @Test
+ public void test_getCloudConfigurationVfModuleReplace() throws Exception {
+ String vnfId = "vnfId";
+ String vfModuleId = "vfModuleId";
+
+ GenericVnf vnf = provider.getMapper().readValue(new File(RESOURCE_PATH + "Vnf.json"), GenericVnf.class);
+
+ doReturn(Optional.of(vnf)).when(aaiResourcesClient).get(GenericVnf.class,
+ AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId));
+
+ CloudConfiguration result = reqBuilder.getCloudConfigurationVfModuleReplace(vnfId, vfModuleId);
+ assertEquals("0422ffb57ba042c0800a29dc85ca70f8", result.getTenantId());
+ assertEquals("cloudOwner", result.getCloudOwner());
+ assertEquals("regionOne", result.getLcpCloudRegionId());
+ }
+
+ @Test
+ public void test_mapCloudConfigurationVnf() throws Exception {
+ String vnfId = "6fb01019-c3c4-41fe-b307-d1c56850b687";
+ Map<String, String[]> filters = new HashMap<>();
+ filters.put("vnfId", new String[] {"EQ", vnfId});
+ filters.put("requestStatus", new String[] {"EQ", Status.COMPLETE.toString()});
+ filters.put("action", new String[] {"EQ", "createInstance"});
+
+ ServiceInstancesRequest serviceRequest = new ServiceInstancesRequest();
+ CloudConfiguration cloudConfiguration = new CloudConfiguration();
+ RequestDetails requestDetails = new RequestDetails();
+ cloudConfiguration.setCloudOwner("cloudOwner");
+ cloudConfiguration.setTenantId("tenantId");
+ cloudConfiguration.setLcpCloudRegionId("lcpCloudRegionId");
+ requestDetails.setCloudConfiguration(cloudConfiguration);
+ serviceRequest.setRequestDetails(requestDetails);
+
+ doReturn(filters).when(reqBuilder).createQueryRequest("vnfId", vnfId);
+ doReturn(Optional.of(serviceRequest)).when(reqBuilder).findServiceInstanceRequest(filters);
+
+
+ CloudConfiguration result = reqBuilder.mapCloudConfigurationVnf(vnfId);
+ assertEquals("tenantId", result.getTenantId());
+ assertEquals("cloudOwner", result.getCloudOwner());
+ assertEquals("lcpCloudRegionId", result.getLcpCloudRegionId());
+ }
+
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/client/grm/GRMClientTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/client/grm/GRMClientTest.java
index cfb865c9e1..2e9576cf7c 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/client/grm/GRMClientTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/client/grm/GRMClientTest.java
@@ -28,12 +28,9 @@ import static com.github.tomakehurst.wiremock.client.WireMock.postRequestedFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
import java.io.File;
import java.nio.file.Files;
import java.util.List;
-import java.util.Map;
import javax.ws.rs.core.MediaType;
import org.junit.BeforeClass;
import org.junit.Rule;
@@ -48,7 +45,6 @@ import org.onap.so.client.grm.beans.ServiceEndPointLookupRequest;
import org.onap.so.client.grm.beans.ServiceEndPointRequest;
import org.onap.so.client.grm.exceptions.GRMClientCallFailed;
import org.slf4j.MDC;
-import ch.qos.logback.classic.spi.ILoggingEvent;
public class GRMClientTest extends BaseTest {
@@ -79,36 +75,10 @@ public class GRMClientTest extends BaseTest {
List<ServiceEndPoint> list = sel.getServiceEndPointList();
assertEquals(3, list.size());
- boolean foundInvoke = false;
- boolean foundInvokeReturn = false;
- for (ILoggingEvent logEvent : TestAppender.events)
- if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.SOMetricLogClientFilter")
- && logEvent.getMarker() != null && logEvent.getMarker().getName().equals("INVOKE")) {
- Map<String, String> mdc = logEvent.getMDCPropertyMap();
- assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID));
- assertEquals("GRM", mdc.get("TargetEntity"));
- assertEquals("INPROGRESS", mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
- foundInvoke = true;
- } else if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.SOMetricLogClientFilter")
- && logEvent.getMarker() != null && logEvent.getMarker().getName().equals("INVOKE-RETURN")) {
- Map<String, String> mdc = logEvent.getMDCPropertyMap();
- assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID));
- assertEquals("200", mdc.get(ONAPLogConstants.MDCs.RESPONSE_CODE));
- assertEquals("COMPLETED", mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
- foundInvokeReturn = true;
- }
-
- if (!foundInvoke)
- fail("INVOKE Marker not found");
-
- if (!foundInvokeReturn)
- fail("INVOKE RETURN Marker not found");
-
wireMockServer.verify(postRequestedFor(urlEqualTo("/GRMLWPService/v1/serviceEndPoint/findRunning"))
.withHeader(ONAPLogConstants.Headers.INVOCATION_ID.toString(), matching(uuidRegex))
.withHeader(ONAPLogConstants.Headers.REQUEST_ID.toString(), matching(uuidRegex))
- .withHeader(ONAPLogConstants.Headers.PARTNER_NAME.toString(), equalTo("SO")));
- TestAppender.events.clear();
+ .withHeader(ONAPLogConstants.Headers.PARTNER_NAME.toString(), equalTo("SO.APIH")));
}
@Test
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getRequestProcessingDataArray.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getRequestProcessingDataArray.json
new file mode 100644
index 0000000000..c746020e7f
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getRequestProcessingDataArray.json
@@ -0,0 +1,8 @@
+[{
+ "id": 1,
+ "soRequestId": "00032ab7-na18-42e5-965d-8ea592502018",
+ "groupingId": "7d2e8c07-4d10-456d-bddc-37abf38ca714",
+ "name": "requestAction",
+ "value": "assign",
+ "tag": "pincFabricConfigRequest"
+}]
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/AAIEntityNotFoundResponse.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/AAIEntityNotFoundResponse.json
new file mode 100644
index 0000000000..2004a82ed7
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/AAIEntityNotFoundResponse.json
@@ -0,0 +1,8 @@
+{
+ "requestError": {
+ "serviceException": {
+ "messageId": "SVC0001",
+ "text": "Generic Vnf Not Found In Inventory, VnfId: ff305d54-75b4-431b-adb2-eb6b9e5ff000"
+ }
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ReplaceVfModuleNoCloudConfig.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ReplaceVfModuleNoCloudConfig.json
new file mode 100644
index 0000000000..766d49bee8
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ReplaceVfModuleNoCloudConfig.json
@@ -0,0 +1,28 @@
+{
+ "requestDetails": {
+ "requestInfo": {
+ "source": "VID",
+ "requestorId": "xxxxxx",
+ "instanceName": "testService60"
+ },
+ "requestParameters": {
+ "aLaCarte": true,
+ "autoBuildVfModules": false,
+ "subscriptionServiceType": "test"
+ },
+ "modelInfo":{
+ "modelInvariantId": "f7ce78bb-423b-11e7-93f8-0050569a7968",
+ "modelVersion":"2",
+ "modelVersionId":"78ca26d0-246d-11e7-93ae-92361f002671",
+ "modelType":"vfModule",
+ "modelName":"serviceModel",
+ "modelCustomizationId": "a7f1d08e-b02d-11e6-80f5-76304dec7eb7"
+ },
+ "subscriberInfo": {
+ "globalSubscriberId": "MSO_1610_dev",
+ "subscriberName": "MSO_1610_dev"
+ }
+ }
+}
+
+
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ReplaceVnfNoCloudConfig.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ReplaceVnfNoCloudConfig.json
new file mode 100644
index 0000000000..46873588c0
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ReplaceVnfNoCloudConfig.json
@@ -0,0 +1,58 @@
+{
+ "vnfInstanceId": "ff305d54-75b4-431b-adb2-eb6b9e5ff000",
+ "requestDetails": {
+ "modelInfo": {
+ "modelType": "vnf",
+ "modelInvariantId": "ff5256d2-5a33-55df-13ab-12abad84e7ff",
+ "modelName": "vSAMP12..base..module-0",
+ "modelVersion": "1",
+ "modelVersionId": "1",
+ "modelCustomizationId": "68dc9a92-214c-11e7-93ae-92361f002671"
+ },
+ "requestInfo": {
+ "instanceName": "VNFTEST-10",
+ "source": "VID",
+ "suppressRollback": true,
+ "requestorId": "xxxxxx",
+ "productFamilyId": "FamilyID"
+ },
+ "relatedInstanceList": [
+ {
+ "relatedInstance": {
+ "instanceId": "f7ce78bb-423b-11e7-93f8-0050569a7968",
+ "modelInfo": {
+ "modelType": "service",
+ "modelInvariantId": "ff3514e3-5a33-55df-13ab-12abad84e7ff",
+ "modelVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe",
+ "modelName": "vSAMP12",
+ "modelVersion": "1.0"
+ }
+ }
+ },
+ {
+ "relatedInstance": {
+ "instanceId": "ff305d54-75b4-431b-adb2-eb6b9e5ff000",
+ "instanceDirection": "source",
+ "modelInfo": {
+ "modelType": "vnf",
+ "modelInvariantId": "ff5256d1-5a33-55df-13ab-12abad84e7ff",
+ "modelVersionId": "fe6478e4-ea33-3346-ac12-ab121484a3fe",
+ "modelName": "vSAMP12",
+ "modelVersion": "1.0",
+ "modelCustomizationId": "b0ed83ec-b7b4-4c70-91c2-63feeaf8609b"
+ }
+ }
+ }
+ ],
+ "requestParameters": {
+ "aLaCarte": true,
+ "userParams": []
+ },
+ "platform": {
+ "platformName": "platformName"
+ },
+ "lineOfBusiness": {
+ "lineOfBusinessName": "lobName"
+ }
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/VnfLookup.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/VnfLookup.json
new file mode 100644
index 0000000000..a0a4c14c10
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/VnfLookup.json
@@ -0,0 +1,30 @@
+[
+ {
+ "requestId":"b15f30dc-56b1-4a1a-aaf1-156c0d685142",
+ "action":"createInstance",
+ "requestStatus":"COMPLETE",
+ "statusMessage":"ALaCarte-Vnf-createInstance request was executed correctly.",
+ "flowStatus":"Successfully completed all Building Blocks",
+ "progress":100,
+ "startTime":"2019-11-11T19:28:56.000+0000",
+ "endTime":"2019-11-11T19:29:15.000+0000",
+ "source":"VID",
+ "vnfId":"5b20c24e-cabb-4725-8f88-57ca99a8ffe1",
+ "vnfName":"Robot_VNF_For_Volume_Group",
+ "vnfType":"Vf zrdm5bpxmc02092017-Service/Vf zrdm5bpxmc02092017-VF 0",
+ "tenantId":"0422ffb57ba042c0800a29dc85ca70f8",
+ "requestBody":"{\"requestDetails\": {\"relatedInstanceList\": [{\"relatedInstance\": {\"instanceId\": \"f5435110-b276-4920-9261-a18a5582d357\", \"modelInfo\": {\"modelVersionId\": \"bad955c3-29b2-4a27-932e-28e942cc6480\", \"modelVersion\": \"1\", \"modelName\": \"Vf zrdm5bpxmc02092017-Service\", \"modelInvariantId\": \"b16a9398-ffa3-4041-b78c-2956b8ad9c7b\", \"modelType\": \"service\"}}}], \"requestParameters\": {\"userParams\": [], \"enforceValidNfValues\": false, \"testApi\": \"GR_API\"}, \"lineOfBusiness\": {\"lineOfBusinessName\": \"vSAMP12_14-2XXX-Aug18-9001 - LOB\"}, \"requestInfo\": {\"source\": \"VID\", \"requestorId\": \"az2016\", \"instanceName\": \"Robot_VNF_For_Volume_Group\", \"suppressRollback\": false, \"productFamilyId\": \"06f76284-8710-11e6-ae22-56b6b6499611\"}, \"platform\": {\"platformName\": \"vSAMP12_14-2XXX-Aug18-9001 - Platform\"}, \"modelInfo\": {\"modelName\": \"Vf zrdm5bpxmc02092017-VF\", \"modelVersion\": \"1\", \"modelInvariantId\": \"23122c9b-dd7f-483f-bf0a-e069303db2f7\", \"modelType\": \"vnf\", \"modelCustomizationName\": \"Vf zrdm5bpxmc02092017-VF 0\", \"modelVersionId\": \"d326f424-2312-4dd6-b7fe-364fadbd1ef5\", \"modelCustomizationId\": \"96c23a4a-6887-4b2c-9cce-1e4ea35eaade\"}, \"cloudConfiguration\": {\"cloudOwner\": \"cloudOwner\", \"tenantId\": \"0422ffb57ba042c0800a29dc85ca70f8\", \"lcpCloudRegionId\": \"regionOne\"}}}",
+ "lastModifiedBy":"CamundaBPMN",
+ "modifyTime":"2019-11-11T19:29:15.000+0000",
+ "aicCloudRegion":"regionOne",
+ "serviceInstanceId":"f5435110-b276-4920-9261-a18a5582d357",
+ "requestScope":"vnf",
+ "requestAction":"createInstance",
+ "requestorId":"az2016",
+ "requestUrl":"http://192.168.99.100:9100/onap/so/infra/serviceInstantiation/v7/serviceInstances/f5435110-b276-4920-9261-a18a5582d357/vnfs",
+ "cloudApiRequests":[
+
+ ],
+ "requestURI":"b15f30dc-56b1-4a1a-aaf1-156c0d685142"
+ }
+]
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 a93ffd46a8..55db69b9d2 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
@@ -809,6 +809,10 @@ CREATE TABLE `service` (
`OVERALL_DISTRIBUTION_STATUS` varchar(45),
`ONAP_GENERATED_NAMING` TINYINT(1) DEFAULT NULL,
`NAMING_POLICY` varchar(200) DEFAULT NULL,
+ `CDS_BLUEPRINT_NAME` varchar(200) DEFAULT NULL,
+ `CDS_BLUEPRINT_VERSION` varchar(20) DEFAULT NULL,
+ `CONTROLLER_ACTOR` varchar(200) DEFAULT NULL,
+ `SKIP_POST_INSTANTIATION_CONFIGURATION` boolean default true,
PRIMARY KEY (`MODEL_UUID`),
KEY `fk_service__tosca_csar1_idx` (`TOSCA_CSAR_ARTIFACT_UUID`),
CONSTRAINT `fk_service__tosca_csar1` FOREIGN KEY (`TOSCA_CSAR_ARTIFACT_UUID`) REFERENCES `tosca_csar` (`ARTIFACT_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
@@ -963,6 +967,7 @@ CREATE TABLE `vf_module_customization` (
`CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`VF_MODULE_MODEL_UUID` varchar(200) NOT NULL,
`VNF_RESOURCE_CUSTOMIZATION_ID` int(13) DEFAULT NULL,
+ `SKIP_POST_INSTANTIATION_CONFIGURATION` boolean default true,
PRIMARY KEY (`ID`),
KEY `fk_vf_module_customization__vf_module1_idx` (`VF_MODULE_MODEL_UUID`),
KEY `fk_vf_module_customization__heat_env__heat_environment1_idx` (`HEAT_ENVIRONMENT_ARTIFACT_UUID`),
@@ -1113,6 +1118,7 @@ CREATE TABLE `vnf_resource_customization` (
`SERVICE_MODEL_UUID` varchar(200) NOT NULL,
`NF_DATA_VALID` tinyint(1) DEFAULT '0',
`VNFCINSTANCEGROUP_ORDER` varchar(200) default NULL,
+ `CONTROLLER_ACTOR` varchar(200) DEFAULT NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `UK_vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`,`SERVICE_MODEL_UUID`),
KEY `fk_vnf_resource_customization__vnf_resource1_idx` (`VNF_RESOURCE_MODEL_UUID`),
@@ -1193,6 +1199,7 @@ CREATE TABLE IF NOT EXISTS `pnf_resource_customization` (
`RESOURCE_INPUT` varchar(2000) DEFAULT NULL,
`CDS_BLUEPRINT_NAME` varchar(200) DEFAULT NULL,
`CDS_BLUEPRINT_VERSION` varchar(20) DEFAULT NULL,
+ `CONTROLLER_ACTOR` varchar(200) 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