aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java14
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java14
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java3
4 files changed, 22 insertions, 11 deletions
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 b09d676b57..7ed60384a5 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
@@ -403,7 +403,7 @@ public class E2EServiceInstances {
msoRequest.createErrorRequestRecord(Status.FAILED, requestId,
"Exception while communciate with " + "Catalog DB", action, ModelType.service.name(), requestJSON,
- null);
+ null, null);
logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
return response;
}
@@ -415,7 +415,7 @@ public class E2EServiceInstances {
ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null, version);
msoRequest.createErrorRequestRecord(Status.FAILED, requestId, "Recipe does not exist in catalog DB", action,
- ModelType.service.name(), requestJSON, null);
+ ModelType.service.name(), requestJSON, null, null);
logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
return response;
}
@@ -493,7 +493,7 @@ public class E2EServiceInstances {
msoRequest.createErrorRequestRecord(Status.FAILED, requestId,
"Exception while communciate with " + "Catalog DB", action, ModelType.service.name(), requestJSON,
- null);
+ null, null);
logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
return response;
}
@@ -505,7 +505,7 @@ public class E2EServiceInstances {
ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null, version);
msoRequest.createErrorRequestRecord(Status.FAILED, requestId, "Recipe does not exist in catalog DB", action,
- ModelType.service.name(), requestJSON, null);
+ ModelType.service.name(), requestJSON, null, null);
logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
return response;
}
@@ -725,7 +725,7 @@ public class E2EServiceInstances {
msoRequest.createErrorRequestRecord(Status.FAILED, requestId,
"No communication to catalog DB " + e.getMessage(), action, ModelType.service.name(), requestJSON,
- null);
+ null, null);
logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
return response;
}
@@ -737,7 +737,7 @@ public class E2EServiceInstances {
MsoException.ServiceException, "Recipe does not exist in catalog DB",
ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null, version);
msoRequest.createErrorRequestRecord(Status.FAILED, requestId, "No recipe found in DB", action,
- ModelType.service.name(), requestJSON, null);
+ ModelType.service.name(), requestJSON, null, null);
logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
return response;
}
@@ -958,7 +958,7 @@ public class E2EServiceInstances {
ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build();
msoRequest.createErrorRequestRecord(Status.FAILED, requestId, validateException.getMessage(), action,
- ModelType.service.name(), requestJSON, null);
+ ModelType.service.name(), requestJSON, null, null);
throw validateException;
}
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 bf76cd3174..64c42a0498 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
@@ -451,7 +451,7 @@ public class MsoRequest {
}
public void createErrorRequestRecord(Status status, String requestId, String errorMessage, Actions action,
- String requestScope, String requestJSON, String serviceInstanceId) {
+ String requestScope, String requestJSON, String serviceInstanceId, ServiceInstancesRequest sir) {
try {
InfraActiveRequests request = new InfraActiveRequests(requestId);
Timestamp startTimeStamp = new Timestamp(System.currentTimeMillis());
@@ -469,6 +469,17 @@ public class MsoRequest {
Timestamp endTimeStamp = new Timestamp(System.currentTimeMillis());
request.setEndTime(endTimeStamp);
request.setRequestUrl(MDC.get(LogConstants.HTTP_URL));
+ if (sir != null) {
+ if (sir.getRequestDetails() != null && sir.getRequestDetails().getRequestInfo() != null) {
+ request.setRequestorId(sir.getRequestDetails().getRequestInfo().getRequestorId());
+ request.setSource(sir.getRequestDetails().getRequestInfo().getSource());
+ if (ModelType.service.name().equalsIgnoreCase(requestScope)) {
+ if (sir.getRequestDetails().getRequestInfo().getInstanceName() != null) {
+ request.setServiceInstanceName(sir.getRequestDetails().getRequestInfo().getInstanceName());
+ }
+ }
+ }
+ }
requestsDbClient.save(request);
} catch (Exception e) {
logger.error("Exception when updating record in DB", e);
@@ -476,7 +487,6 @@ public class MsoRequest {
}
}
-
public Response buildResponse(int httpResponseCode, String errorCode, InfraActiveRequests inProgress) {
return buildResponseWithError(httpResponseCode, errorCode, inProgress, null);
}
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 60e9c3b30a..cddb1ada31 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
@@ -326,7 +326,7 @@ public class RequestHandlerUtils extends AbstractRestHandler {
String requestScope = requestScopeFromUri(requestUri);
msoRequest.createErrorRequestRecord(Status.FAILED, requestId, validateException.getMessage(), action,
- requestScope, requestJSON, null);
+ requestScope, requestJSON, null, null);
throw validateException;
}
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 2c8e92633c..7924ca304a 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
@@ -830,7 +830,8 @@ public class ServiceInstances extends AbstractRestHandler {
} catch (ApiException e) {
msoRequest.createErrorRequestRecord(Status.FAILED, requestId, e.getMessage(), action, requestScope,
requestJSON, requestHandlerUtils
- .getServiceInstanceIdForValidationError(sir, instanceIdMap, requestScope).orElse(null));
+ .getServiceInstanceIdForValidationError(sir, instanceIdMap, requestScope).orElse(null),
+ sir);
throw e;
}