summaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2018-10-11 13:55:37 -0400
committerRob Daugherty <rd472p@att.com>2018-10-12 10:10:16 -0400
commit6ba0a22bc952232d14d2d24c5f73a42aae2791a9 (patch)
tree9046e63bccb77ca3e2df4ae7ceab44cc238dd074 /mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap
parent58c1d90a787979e507f559d7075aac8a1428df42 (diff)
Dynamic Cloud Owner Support
added in cloud configuration object to request params Fix Bean scanning so it picks up the resttemplate removed unnecessary RestTemplate Bean configurations corrected typo in CloudConfiguration class updated gr api test cases with dynamic cloud owner updated groovy files to allow for dynamic cloud owner values updated GR API layer to include cloud owner added enum for default cloud owner add cloud owner variable to camunda in mapping removed references to att-aic from BBInputSetup updated aai schema dependency to 1.3.1 from 1.3.0 Fixed incorrect type AAIUri and updated logging in the method. use existing service instance id instead of generating Pass cloudOwner to process to propagate to subprocesses. NOTE: our aai-schema dependency is 1.3.1-SNAPSHOT to be compatible with the cloud owner changes here. The releaesed 1.3.0 version is NOT compatible. Change-Id: I43b46774b77981d1c8bfe7c7a79b9434889e62ae Issue-ID: SO-1128 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com> Signed-off-by: Rob Daugherty <rd472p@att.com>
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap')
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java49
1 files changed, 36 insertions, 13 deletions
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 bb7df4b7be..fb6076e1a4 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
@@ -45,6 +45,7 @@ import org.onap.so.apihandlerinfra.exceptions.BPMNFailureException;
import org.onap.so.apihandlerinfra.exceptions.ClientConnectionException;
import org.onap.so.apihandlerinfra.exceptions.DuplicateRequestException;
import org.onap.so.apihandlerinfra.exceptions.RecipeNotFoundException;
+import org.onap.so.apihandlerinfra.exceptions.RequestDbFailureException;
import org.onap.so.apihandlerinfra.exceptions.ValidateException;
import org.onap.so.apihandlerinfra.exceptions.VfModuleNotFoundException;
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
@@ -109,6 +110,7 @@ public class ServiceInstances {
private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH,MsoRequest.class);
private static String NAME = "name";
private static String VALUE = "value";
+ private static final String SAVE_TO_DB = "save instance to db";
@Autowired
private Environment env;
@@ -740,7 +742,13 @@ public class ServiceInstances {
if (sir.getCorrelationId() != null) {
correlationId = sir.getCorrelationId();
}
- infraActiveRequestsClient.save(currentActiveReq);
+ try{
+ infraActiveRequestsClient.save(currentActiveReq);
+ }catch(Exception e){
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, MsoLogger.ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ throw new RequestDbFailureException.Builder(SAVE_TO_DB, e.toString(), HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e)
+ .errorInfo(errorLoggerInfo).build();
+ }
if(!requestScope.equalsIgnoreCase(ModelType.service.name())){
aLaCarte = true;
@@ -870,7 +878,13 @@ public class ServiceInstances {
currentActiveReq.setRequestStatus(Status.IN_PROGRESS.name());
setInstanceId(currentActiveReq, requestScope, jsonResponse.getRequestReferences().getInstanceId(), new HashMap<>());
- infraActiveRequestsClient.save(currentActiveReq);
+ try{
+ infraActiveRequestsClient.save(currentActiveReq);
+ }catch(Exception e){
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, MsoLogger.ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ throw new RequestDbFailureException.Builder(SAVE_TO_DB, e.toString(), HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e)
+ .errorInfo(errorLoggerInfo).build();
+ }
return builder.buildResponse(HttpStatus.SC_ACCEPTED, requestId, jsonResponse, apiVersion);
}
}
@@ -983,14 +997,10 @@ public class ServiceInstances {
}
} catch (Exception e) {
ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DUPLICATE_CHECK_EXC, MsoLogger.ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
-
-
- ValidateException validateException = new ValidateException.Builder("Duplicate Check Request", HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e)
+ RequestDbFailureException requestDbFailureException = new RequestDbFailureException.Builder("check for duplicate instance", e.toString(), HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e)
.errorInfo(errorLoggerInfo).build();
-
- updateStatus(currentActiveReq, Status.FAILED, validateException.getMessage());
-
- throw validateException;
+ updateStatus(currentActiveReq, Status.FAILED, requestDbFailureException.getMessage());
+ throw requestDbFailureException;
}
return dup;
}
@@ -1016,7 +1026,7 @@ public class ServiceInstances {
}
private void parseRequest(ServiceInstancesRequest sir, HashMap<String, String> instanceIdMap, Actions action, String version,
- String requestJSON, Boolean aLaCarte, String requestId, InfraActiveRequests currentActiveReq) throws ValidateException {
+ String requestJSON, Boolean aLaCarte, String requestId, InfraActiveRequests currentActiveReq) throws ValidateException, RequestDbFailureException {
int reqVersion = Integer.parseInt(version.substring(1));
try {
msoRequest.parse(sir, instanceIdMap, action, version, requestJSON, reqVersion, aLaCarte);
@@ -1218,6 +1228,7 @@ public class ServiceInstances {
targetConfiguration.setAicNodeClli(sourceCloudConfiguration.getAicNodeClli());
targetConfiguration.setTenantId(sourceCloudConfiguration.getTenantId());
targetConfiguration.setLcpCloudRegionId(sourceCloudConfiguration.getLcpCloudRegionId());
+ targetConfiguration.setCloudOwner(sourceCloudConfiguration.getCloudOwner());
return Optional.of(targetConfiguration);
}
return Optional.empty();
@@ -1633,7 +1644,13 @@ public class ServiceInstances {
if (sir.getCorrelationId() != null) {
correlationId = sir.getCorrelationId();
}
- infraActiveRequestsClient.save(currentActiveReq);
+ try{
+ infraActiveRequestsClient.save(currentActiveReq);
+ }catch(Exception e){
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, MsoLogger.ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ throw new RequestDbFailureException.Builder(SAVE_TO_DB, e.toString(), HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e)
+ .errorInfo(errorLoggerInfo).build();
+ }
if(!requestScope.equalsIgnoreCase(ModelType.service.name())){
aLaCarte = true;
@@ -1660,14 +1677,20 @@ public class ServiceInstances {
throw validateException;
}
}
- public void updateStatus(InfraActiveRequests aq, Status status, String errorMessage){
+ public void updateStatus(InfraActiveRequests aq, Status status, String errorMessage) throws RequestDbFailureException{
if ((status == Status.FAILED) || (status == Status.COMPLETE)) {
aq.setStatusMessage (errorMessage);
aq.setProgress(new Long(100));
aq.setRequestStatus(status.toString());
Timestamp endTimeStamp = new Timestamp (System.currentTimeMillis());
aq.setEndTime (endTimeStamp);
- infraActiveRequestsClient.save(aq);
+ try{
+ infraActiveRequestsClient.save(aq);
+ }catch(Exception e){
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, MsoLogger.ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ throw new RequestDbFailureException.Builder(SAVE_TO_DB, e.toString(), HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e)
+ .errorInfo(errorLoggerInfo).build();
+ }
}
}
}