aboutsummaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-infra
diff options
context:
space:
mode:
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra')
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java62
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java19
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java12
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java18
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java58
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java16
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java16
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java22
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java10
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java6
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java6
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/DmaapOperationalEnvClient.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelper.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java6
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java18
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java40
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java6
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java5
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java50
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java51
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelperTest.java1
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelperTest.java5
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironmentTest.java11
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java58
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/vnfoperenv/activateOperationalEnvironmentWithRelationship.json27
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/data.sql14
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql1
31 files changed, 343 insertions, 217 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 84cac6ce5c..de38bc717a 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
@@ -62,9 +62,9 @@ import org.onap.so.db.catalog.beans.ServiceRecipe;
import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.request.beans.OperationStatus;
import org.onap.so.db.request.client.RequestsDbClient;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.serviceinstancebeans.ModelInfo;
import org.onap.so.serviceinstancebeans.ModelType;
import org.onap.so.serviceinstancebeans.RequestDetails;
@@ -235,7 +235,7 @@ public class E2EServiceInstances {
MsoException.ServiceException, "Mapping of request to JSON object failed. " + e.getMessage(),
ErrorNumbers.SVC_BAD_PARAMETER, null, version);
logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.SchemaError.getValue(), requestJSON, e);
+ ErrorCode.SchemaError.getValue(), requestJSON, e);
logger.debug(END_OF_THE_TRANSACTION + response.getEntity().toString());
return response;
@@ -282,7 +282,7 @@ public class E2EServiceInstances {
MsoException.ServiceException, "Failed calling bpmn " + e.getMessage(),
ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
logger.error("", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "",
- MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine",e);
+ ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine",e);
logger.debug(END_OF_THE_TRANSACTION + resp.getEntity().toString());
return resp;
}
@@ -291,7 +291,7 @@ public class E2EServiceInstances {
Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException,
"bpelResponse is null", ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL");
+ ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL");
logger.debug(END_OF_THE_TRANSACTION + resp.getEntity().toString());
return resp;
}
@@ -318,7 +318,7 @@ public class E2EServiceInstances {
operationId);
} catch (Exception e) {
logger.error("{} {} {} {}", MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.AvailabilityError.getValue(),
+ ErrorCode.AvailabilityError.getValue(),
"Exception while communciate with Request DB - Infra Request Lookup", e);
Response response = msoRequest.buildServiceErrorResponse(
HttpStatus.SC_NOT_FOUND, MsoException.ServiceException,
@@ -335,7 +335,7 @@ public class E2EServiceInstances {
"E2E serviceId " + serviceId + " is not found in DB",
ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, null, version);
logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
+ ErrorCode.BusinessProcesssError.getValue(),
"Null response from RequestDB when searching by serviceId");
logger.debug(END_OF_THE_TRANSACTION + resp.getEntity());
return resp;
@@ -368,7 +368,7 @@ public class E2EServiceInstances {
+ e.getMessage(), ErrorNumbers.SVC_BAD_PARAMETER,
null, version);
logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.SchemaError.getValue(), requestJSON, e);
+ ErrorCode.SchemaError.getValue(), requestJSON, e);
logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
return response;
}
@@ -380,7 +380,7 @@ public class E2EServiceInstances {
recipeLookupResult = getServiceInstanceOrchestrationURI(null, action);
} catch (Exception e) {
logger.error(MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Catalog DB", e);
+ ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Catalog DB", e);
Response response = msoRequest.buildServiceErrorResponse(
HttpStatus.SC_NOT_FOUND, MsoException.ServiceException,
@@ -395,7 +395,7 @@ public class E2EServiceInstances {
}
if (recipeLookupResult == null) {
logger.error("{} {} {} {}", MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.DataError.getValue(), "No recipe found in DB");
+ ErrorCode.DataError.getValue(), "No recipe found in DB");
Response response = msoRequest.buildServiceErrorResponse(
HttpStatus.SC_NOT_FOUND, MsoException.ServiceException,
"Recipe does not exist in catalog DB",
@@ -441,7 +441,7 @@ public class E2EServiceInstances {
"Failed calling bpmn " + e.getMessage(),
ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.AvailabilityError.getValue(), "Exception while communicate with BPMN engine");
+ ErrorCode.AvailabilityError.getValue(), "Exception while communicate with BPMN engine");
logger.debug("End of the transaction, the final response is: " + resp.getEntity());
return resp;
}
@@ -452,7 +452,7 @@ public class E2EServiceInstances {
"bpelResponse is null",
ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL");
+ ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL");
logger.debug(END_OF_THE_TRANSACTION + resp.getEntity());
return resp;
}
@@ -484,7 +484,7 @@ public class E2EServiceInstances {
MsoException.ServiceException, "Mapping of request to JSON object failed. " + e.getMessage(),
ErrorNumbers.SVC_BAD_PARAMETER, null, version);
logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.SchemaError.getValue(), requestJSON, e);
+ ErrorCode.SchemaError.getValue(), requestJSON, e);
logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
return response;
}
@@ -502,7 +502,7 @@ public class E2EServiceInstances {
logger.debug("Logging failed message to the database");
}
logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.SchemaError.getValue(), requestJSON, e);
+ ErrorCode.SchemaError.getValue(), requestJSON, e);
logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
return response;
}
@@ -512,7 +512,7 @@ public class E2EServiceInstances {
recipeLookupResult = getServiceInstanceOrchestrationURI(e2eSir.getService().getServiceUuid(), action);
} catch (Exception e) {
logger.error("{} {} {} {}", MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Catalog DB", e);
+ ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Catalog DB", e);
Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
MsoException.ServiceException, "No communication to catalog DB " + e.getMessage(),
ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
@@ -524,7 +524,7 @@ public class E2EServiceInstances {
if (recipeLookupResult == null) {
logger.error("{} {} {} {}", MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.DataError.getValue(), "No recipe found in DB");
+ ErrorCode.DataError.getValue(), "No recipe found in DB");
Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
MsoException.ServiceException, "Recipe does not exist in catalog DB",
ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null, version);
@@ -565,7 +565,7 @@ public class E2EServiceInstances {
ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.AvailabilityError.getValue(), "Exception while communicate with BPMN engine");
+ ErrorCode.AvailabilityError.getValue(), "Exception while communicate with BPMN engine");
logger.debug(END_OF_THE_TRANSACTION + getBPMNResp.getEntity());
return getBPMNResp;
@@ -575,7 +575,7 @@ public class E2EServiceInstances {
Response getBPMNResp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY,
MsoException.ServiceException, "bpelResponse is null", ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL");
+ ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL");
logger.debug(END_OF_THE_TRANSACTION + getBPMNResp.getEntity());
return getBPMNResp;
}
@@ -606,7 +606,7 @@ public class E2EServiceInstances {
MsoException.ServiceException, "Mapping of request to JSON object failed. " + e.getMessage(),
ErrorNumbers.SVC_BAD_PARAMETER, null, version);
logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.SchemaError.getValue(), requestJSON, e);
+ ErrorCode.SchemaError.getValue(), requestJSON, e);
logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
return response;
}
@@ -624,7 +624,7 @@ public class E2EServiceInstances {
logger.debug("Logging failed message to the database");
}
logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.SchemaError.getValue(), requestJSON, e);
+ ErrorCode.SchemaError.getValue(), requestJSON, e);
logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
return response;
}
@@ -634,7 +634,7 @@ public class E2EServiceInstances {
recipeLookupResult = getServiceInstanceOrchestrationURI(e2eSir.getService().getServiceUuid(), action);
} catch (Exception e) {
logger.error("{} {} {} {}", MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Catalog DB", e);
+ ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Catalog DB", e);
Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
MsoException.ServiceException, "No communication to catalog DB " + e.getMessage(),
ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
@@ -644,7 +644,7 @@ public class E2EServiceInstances {
if (recipeLookupResult == null) {
logger.error("{} {} {} {}", MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.DataError.getValue(), "No recipe found in DB");
+ ErrorCode.DataError.getValue(), "No recipe found in DB");
Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
MsoException.ServiceException, "Recipe does not exist in catalog DB",
ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null, version);
@@ -684,7 +684,7 @@ public class E2EServiceInstances {
ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.AvailabilityError.getValue(), "Exception while communicate with BPMN engine");
+ ErrorCode.AvailabilityError.getValue(), "Exception while communicate with BPMN engine");
logger.debug(END_OF_THE_TRANSACTION + resp.getEntity());
return resp;
}
@@ -693,7 +693,7 @@ public class E2EServiceInstances {
Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY,
MsoException.ServiceException, "bpelResponse is null", ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL");
+ ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL");
logger.debug(END_OF_THE_TRANSACTION + resp.getEntity());
return resp;
}
@@ -727,7 +727,7 @@ public class E2EServiceInstances {
+ e.getMessage(), ErrorNumbers.SVC_BAD_PARAMETER,
null, version);
logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.SchemaError.getValue(), requestJSON, e);
+ ErrorCode.SchemaError.getValue(), requestJSON, e);
logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
return response;
}
@@ -738,7 +738,7 @@ public class E2EServiceInstances {
recipeLookupResult = getServiceInstanceOrchestrationURI(null, action);
} catch (Exception e) {
logger.error("{} {} {} {}", MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Catalog DB", e);
+ ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Catalog DB", e);
Response response = msoRequest.buildServiceErrorResponse(
HttpStatus.SC_NOT_FOUND, MsoException.ServiceException,
@@ -751,7 +751,7 @@ public class E2EServiceInstances {
}
if (recipeLookupResult == null) {
logger.error("{} {} {} {}", MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.DataError.getValue(), "No recipe found in DB");
+ ErrorCode.DataError.getValue(), "No recipe found in DB");
Response response = msoRequest.buildServiceErrorResponse(
HttpStatus.SC_NOT_FOUND, MsoException.ServiceException,
@@ -797,7 +797,7 @@ public class E2EServiceInstances {
ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.AvailabilityError.getValue(), "Exception while communicate with BPMN engine", e);
+ ErrorCode.AvailabilityError.getValue(), "Exception while communicate with BPMN engine", e);
logger.debug(END_OF_THE_TRANSACTION + resp.getEntity());
return resp;
}
@@ -808,7 +808,7 @@ public class E2EServiceInstances {
"bpelResponse is null",
ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL");
+ ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL");
logger.debug(END_OF_THE_TRANSACTION + resp.getEntity());
return resp;
}
@@ -846,7 +846,7 @@ public class E2EServiceInstances {
+ '\n' + camundaJSONResponseBody,
ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, variables, version);
logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_RESPONSE_ERROR.toString(), requestClient.getUrl(),
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
+ ErrorCode.BusinessProcesssError.getValue(),
"Response from BPEL engine is failed with HTTP Status=" + bpelStatus);
logger.debug(END_OF_THE_TRANSACTION + resp.getEntity());
return resp;
@@ -859,7 +859,7 @@ public class E2EServiceInstances {
ErrorNumbers.SVC_DETAILED_SERVICE_ERROR,
variables, version);
logger.error("", MessageEnum.APIH_BPEL_RESPONSE_ERROR.toString(), requestClient.getUrl(),
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
+ ErrorCode.BusinessProcesssError.getValue(),
"Response from BPEL engine is empty");
logger.debug(END_OF_THE_TRANSACTION + resp.getEntity());
return resp;
@@ -1023,7 +1023,7 @@ public class E2EServiceInstances {
try {
msoRequest.parse(sir, instanceIdMap, action, version, requestJSON, reqVersion, aLaCarte);
} catch (Exception e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
ValidateException validateException = new ValidateException.Builder("Error parsing request: " + e.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
.errorInfo(errorLoggerInfo).build();
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java
index 07c98c19b9..ad20c5c527 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java
@@ -45,7 +45,6 @@ import javax.ws.rs.core.UriBuilder;
import org.apache.http.HttpStatus;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.http.HttpEntity;
@@ -116,7 +115,6 @@ public class GlobalHealthcheckHandler {
try{
// Generated RequestId
String requestId = requestContext.getProperty("requestId").toString();
- MsoLogger.setLogContext(requestId, null);
logger.info("{} {}", MessageEnum.APIH_GENERATED_REQUEST_ID.toString(), requestId);
// set APIH status, this is the main entry point
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 d686e80352..ad589ddc9c 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
@@ -54,9 +54,9 @@ import org.onap.so.apihandlerinfra.tasksbeans.Value;
import org.onap.so.apihandlerinfra.tasksbeans.Variables;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.exceptions.ValidationException;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -97,8 +97,7 @@ public class ManualTasks {
@Context ContainerRequestContext requestContext) throws ApiException {
String requestId = requestContext.getProperty("requestId").toString();
- MsoLogger.setLogContext(requestId, null);
- logger.info("{} {}", MessageEnum.APIH_GENERATED_REQUEST_ID.toString(), requestId);
+ logger.info("{} {}", MessageEnum.APIH_GENERATED_REQUEST_ID.toString(), requestId);
long startTime = System.currentTimeMillis ();
logger.debug ("requestId is: {}", requestId);
TasksRequest taskRequest = null;
@@ -122,7 +121,7 @@ public class ManualTasks {
}
}catch(IOException e){
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).build();
ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed: " + e.getMessage(),
@@ -131,7 +130,7 @@ public class ManualTasks {
throw validateException;
}
catch(ValidationException e){
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON Object failed. " + e.getMessage(),
@@ -161,7 +160,7 @@ public class ManualTasks {
camundaJsonReq = mapper.writeValueAsString(variablesForComplete);
} catch(JsonProcessingException e){
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.UnknownError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.UnknownError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
ValidateException validateException = new ValidateException.Builder("Mapping of JSON object to Camunda request failed",
@@ -181,7 +180,7 @@ public class ManualTasks {
} catch (Exception e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MsoLogger.ErrorCode.AvailabilityError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, ErrorCode.AvailabilityError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
@@ -192,7 +191,7 @@ public class ManualTasks {
}
if (response == null) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MsoLogger.ErrorCode.BusinessProcesssError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, ErrorCode.BusinessProcesssError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
BPMNFailureException bpmnFailureException = new BPMNFailureException.Builder(String.valueOf(HttpStatus.SC_BAD_GATEWAY),
@@ -218,7 +217,7 @@ public class ManualTasks {
}
catch (JsonProcessingException e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, MsoLogger.ErrorCode.BusinessProcesssError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.BusinessProcesssError).build();
ValidateException validateException = new ValidateException.Builder("Request Failed due to bad response format" ,
@@ -230,7 +229,7 @@ public class ManualTasks {
logger.debug ("End of the transaction, the final response is: {}", completeResp);
return builder.buildResponse(HttpStatus.SC_ACCEPTED, requestId, completeResp, apiVersion);
} else {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, MsoLogger.ErrorCode.BusinessProcesssError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.BusinessProcesssError).build();
BPMNFailureException bpmnFailureException = new BPMNFailureException.Builder(String.valueOf(bpelStatus),
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 886e0d5133..de7d26379c 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
@@ -69,9 +69,9 @@ import org.onap.so.apihandlerinfra.vnfbeans.VnfRequest;
import org.onap.so.db.request.beans.InfraActiveRequests;
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.LogConstants;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
import org.onap.so.serviceinstancebeans.InstanceDirection;
import org.onap.so.serviceinstancebeans.ModelInfo;
@@ -153,7 +153,7 @@ public class MsoRequest {
mapper.setSerializationInclusion(Include.NON_DEFAULT);
requestErrorStr = mapper.writeValueAsString(re);
}catch(Exception e){
- logger.error("{} {} {}", MessageEnum.APIH_VALIDATION_ERROR.toString(), MsoLogger.ErrorCode.DataError.getValue(),
+ logger.error("{} {} {}", MessageEnum.APIH_VALIDATION_ERROR.toString(), ErrorCode.DataError.getValue(),
"Exception in buildServiceErrorResponse writing exceptionType to string ", e);
}
@@ -384,7 +384,7 @@ public class MsoRequest {
aq.setRequestStatus (status.toString ());
aq.setLastModifiedBy (Constants.MODIFIED_BY_APIHANDLER);
} catch (Exception e) {
- logger.error("{} {} {}", MessageEnum.APIH_DB_INSERT_EXC.toString(), MsoLogger.ErrorCode.DataError.getValue(),
+ logger.error("{} {} {}", MessageEnum.APIH_DB_INSERT_EXC.toString(), ErrorCode.DataError.getValue(),
"Exception when creation record request", e);
if (!status.equals (Status.FAILED)) {
@@ -424,7 +424,7 @@ public class MsoRequest {
aq.setLastModifiedBy (Constants.MODIFIED_BY_APIHANDLER);
} catch (Exception e) {
- logger.error("{} {} {}", MessageEnum.APIH_DB_INSERT_EXC.toString(), MsoLogger.ErrorCode.DataError.getValue(),
+ logger.error("{} {} {}", MessageEnum.APIH_DB_INSERT_EXC.toString(), ErrorCode.DataError.getValue(),
"Exception when creation record request", e);
if (!status.equals (Status.FAILED)) {
@@ -452,7 +452,7 @@ public class MsoRequest {
requestsDbClient.save(request);
} catch (Exception e) {
logger.error("{} {} {} {}", MessageEnum.APIH_DB_UPDATE_EXC.toString(), e.getMessage(),
- MsoLogger.ErrorCode.DataError.getValue(), "Exception when updating record in DB");
+ ErrorCode.DataError.getValue(), "Exception when updating record in DB");
logger.debug("Exception: ", e);
}
}
@@ -536,7 +536,7 @@ public class MsoRequest {
return null;
} catch (Exception e) {
- logger.error("{} {} {}", MessageEnum.APIH_DOM2STR_ERROR.toString(), MsoLogger.ErrorCode.DataError.getValue(),
+ logger.error("{} {} {}", MessageEnum.APIH_DOM2STR_ERROR.toString(), ErrorCode.DataError.getValue(),
"Exception in domToStr", e);
}
return null;
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 d74a4de451..f613d3e193 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
@@ -54,9 +54,9 @@ import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.beans.RequestProcessingData;
import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.exceptions.ValidationException;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.serviceinstancebeans.GetOrchestrationListResponse;
import org.onap.so.serviceinstancebeans.GetOrchestrationResponse;
import org.onap.so.serviceinstancebeans.InstanceReferences;
@@ -111,7 +111,7 @@ public class OrchestrationRequests {
} catch (Exception e) {
logger.error("Exception occurred", e);
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, MsoLogger.ErrorCode.AvailabilityError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.AvailabilityError).build();
@@ -126,7 +126,7 @@ public class OrchestrationRequests {
if(infraActiveRequest == null) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MsoLogger.ErrorCode.BusinessProcesssError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, ErrorCode.BusinessProcesssError).build();
ValidateException validateException = new ValidateException.Builder("Orchestration RequestId " + requestId + " is not found in DB",
@@ -169,7 +169,7 @@ public class OrchestrationRequests {
}
}catch(ValidationException ex){
logger.error("Exception occurred", ex);
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.DataError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.DataError).build();
ValidateException validateException = new ValidateException.Builder(ex.getMessage(),
HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_GENERAL_SERVICE_ERROR).cause(ex).errorInfo(errorLoggerInfo).build();
throw validateException;
@@ -217,7 +217,7 @@ public class OrchestrationRequests {
sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
} catch(IOException e){
logger.error("Exception occurred", e);
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).build();
ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed : " + e.getMessage(),
HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build();
@@ -228,7 +228,7 @@ public class OrchestrationRequests {
msoRequest.parseOrchestration(sir);
} catch (Exception e) {
logger.error("Exception occurred", e);
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).build();
ValidateException validateException = new ValidateException.Builder("Error parsing request: " + e.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
.errorInfo(errorLoggerInfo).build();
throw validateException;
@@ -236,7 +236,7 @@ public class OrchestrationRequests {
infraActiveRequest = requestsDbClient.getInfraActiveRequestbyRequestId(requestId);
if(infraActiveRequest == null) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MsoLogger.ErrorCode.BusinessProcesssError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, ErrorCode.BusinessProcesssError).build();
ValidateException validateException = new ValidateException.Builder("Null response from RequestDB when searching by RequestId",
@@ -253,7 +253,7 @@ public class OrchestrationRequests {
requestsDbClient.save(infraActiveRequest);
}else{
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MsoLogger.ErrorCode.DataError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, ErrorCode.DataError).build();
ValidateException validateException = new ValidateException.Builder("Orchestration RequestId " + requestId + " has a status of " + status + " and can not be unlocked",
@@ -324,7 +324,7 @@ public class OrchestrationRequests {
}
} catch (IOException e) {
logger.error("Exception occurred", e);
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).build();
ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed : ",
HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e).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 ec1c4cb362..8c5904fb21 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
@@ -66,9 +66,9 @@ import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.request.beans.InfraActiveRequests;
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.LogConstants;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
import org.onap.so.serviceinstancebeans.ModelInfo;
import org.onap.so.serviceinstancebeans.ModelType;
@@ -125,6 +125,8 @@ import java.util.List;
import java.util.Map;
import java.util.Optional;
+import static org.onap.so.logger.HttpHeadersConstants.REQUESTOR_ID;
+
@Component
@Path("/onap/so/infra/serviceInstantiation")
@Api(value="/onap/so/infra/serviceInstantiation",description="Infrastructure API Requests for Service Instances")
@@ -703,8 +705,8 @@ public class ServiceInstances {
if(!headers.containsKey(ONAPLogConstants.Headers.PARTNER_NAME)){
throw new ValidationException(ONAPLogConstants.Headers.PARTNER_NAME + " header", true);
}
- if(!headers.containsKey(MsoLogger.REQUESTOR_ID)){
- throw new ValidationException(MsoLogger.REQUESTOR_ID + " header", true);
+ if(!headers.containsKey(REQUESTOR_ID)){
+ throw new ValidationException(REQUESTOR_ID + " header", true);
}
}
@@ -799,7 +801,7 @@ public class ServiceInstances {
}
String errorMessage = "VnfType " + vnfType + " and VF Module Model Name " + modelInfo.getModelName() + serviceVersionText + " not found in MSO Catalog DB";
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MsoLogger.ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
VfModuleNotFoundException vfModuleException = new VfModuleNotFoundException.Builder(errorMessage, HttpStatus.SC_NOT_FOUND, ErrorNumbers.SVC_BAD_PARAMETER).errorInfo(errorLoggerInfo).build();
updateStatus(currentActiveReq, Status.FAILED, vfModuleException.getMessage());
@@ -840,7 +842,7 @@ public class ServiceInstances {
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();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, 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();
}
@@ -874,7 +876,7 @@ public class ServiceInstances {
.setRequestUri(requestUri)
.setInstanceGroupId(instanceGroupId).build();
} catch (IOException e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
throw new ValidateException.Builder("Unable to generate RequestClientParamter object" + e.getMessage(), HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_BAD_PARAMETER)
.errorInfo(errorLoggerInfo).build();
}
@@ -895,7 +897,7 @@ public class ServiceInstances {
validateHeaders(requestContext);
} catch (ValidationException e) {
logger.error("Exception occurred", e);
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_VALIDATION_ERROR, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
ValidateException validateException = new ValidateException.Builder(e.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
.errorInfo(errorLoggerInfo).build();
updateStatus(currentActiveReq, Status.FAILED, validateException.getMessage());
@@ -927,7 +929,7 @@ public class ServiceInstances {
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();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, 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();
}
@@ -993,7 +995,7 @@ public class ServiceInstances {
response = requestClient.post(requestClientParameter);
} catch (Exception e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MsoLogger.ErrorCode.AvailabilityError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, ErrorCode.AvailabilityError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
String url = requestClient != null ? requestClient.getUrl() : "";
ClientConnectionException clientException = new ClientConnectionException.Builder(url, HttpStatus.SC_BAD_GATEWAY, ErrorNumbers.SVC_NO_SERVER_RESOURCES).cause(e).errorInfo(errorLoggerInfo).build();
updateStatus(currentActiveReq, Status.FAILED, clientException.getMessage());
@@ -1003,7 +1005,7 @@ public class ServiceInstances {
if (response == null) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MsoLogger.ErrorCode.BusinessProcesssError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, ErrorCode.BusinessProcesssError).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());
@@ -1018,7 +1020,7 @@ public class ServiceInstances {
bpelStatus = respHandler.getStatus ();
} catch (ApiException e) {
logger.error("Exception occurred", e);
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
ValidateException validateException = new ValidateException.Builder("Exception caught mapping Camunda JSON response to object", HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
.errorInfo(errorLoggerInfo).build();
updateStatus(currentActiveReq, Status.FAILED, validateException.getMessage());
@@ -1043,7 +1045,7 @@ public class ServiceInstances {
}
} catch (IOException e) {
logger.error("Exception occurred", e);
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
ValidateException validateException = new ValidateException.Builder("Exception caught mapping Camunda JSON response to object", HttpStatus.SC_NOT_ACCEPTABLE, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
.errorInfo(errorLoggerInfo).build();
updateStatus(currentActiveReq, Status.FAILED, validateException.getMessage());
@@ -1058,7 +1060,7 @@ public class ServiceInstances {
String camundaJSONResponseBody = respHandler.getResponseBody ();
if (camundaJSONResponseBody != null && !camundaJSONResponseBody.isEmpty ()) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, MsoLogger.ErrorCode.BusinessProcesssError).errorSource(requestClient.getUrl()).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.BusinessProcesssError).errorSource(requestClient.getUrl()).build();
BPMNFailureException bpmnException = new BPMNFailureException.Builder(String.valueOf(bpelStatus) + camundaJSONResponseBody, bpelStatus, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR)
.errorInfo(errorLoggerInfo).build();
@@ -1067,7 +1069,7 @@ public class ServiceInstances {
throw bpmnException;
} else {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, MsoLogger.ErrorCode.BusinessProcesssError).errorSource(requestClient.getUrl()).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.BusinessProcesssError).errorSource(requestClient.getUrl()).build();
BPMNFailureException servException = new BPMNFailureException.Builder(String.valueOf(bpelStatus), bpelStatus, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR)
@@ -1153,7 +1155,7 @@ public class ServiceInstances {
}
//List<String> variables = new ArrayList<String>();
//variables.add(dup.getRequestStatus());
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DUPLICATE_FOUND, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DUPLICATE_FOUND, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
DuplicateRequestException dupException = new DuplicateRequestException.Builder(requestScope,instance,dup.getRequestStatus(),dup.getRequestId(), HttpStatus.SC_CONFLICT, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR)
@@ -1172,7 +1174,7 @@ public class ServiceInstances {
dup = infraActiveRequestsClient.checkInstanceNameDuplicate (instanceIdMap, instanceName, requestScope);
}
} catch (Exception e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DUPLICATE_CHECK_EXC, MsoLogger.ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DUPLICATE_CHECK_EXC, ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
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, requestDbFailureException.getMessage());
@@ -1190,7 +1192,7 @@ public class ServiceInstances {
try{
response = restTemplate.exchange(targetUrl, HttpMethod.GET, requestEntity, new ParameterizedTypeReference<List<HistoricProcessInstanceEntity>>(){});
}catch(HttpStatusCodeException e){
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DUPLICATE_CHECK_EXC, MsoLogger.ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DUPLICATE_CHECK_EXC, ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
ContactCamundaException contactCamundaException= new ContactCamundaException.Builder(requestId, e.toString(), HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e)
.errorInfo(errorLoggerInfo).build();
updateStatus(currentActiveReq, Status.FAILED, contactCamundaException.getMessage());
@@ -1232,7 +1234,7 @@ public class ServiceInstances {
} catch (IOException e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
ValidateException validateException = new ValidateException.Builder("Error mapping request: " + e.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
.errorInfo(errorLoggerInfo).build();
@@ -1251,7 +1253,7 @@ public class ServiceInstances {
msoRequest.parse(sir, instanceIdMap, action, version, requestJSON, reqVersion, aLaCarte);
} catch (Exception e) {
logger.error("failed to parse request", e);
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
ValidateException validateException = new ValidateException.Builder("Error parsing request: " + e.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
.errorInfo(errorLoggerInfo).build();
@@ -1276,7 +1278,7 @@ public class ServiceInstances {
try {
recipeLookupResult = getServiceURI(sir, action,alaCarteFlag);
} catch (IOException e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
ValidateException validateException = new ValidateException.Builder(e.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
@@ -1291,7 +1293,7 @@ public class ServiceInstances {
try {
recipeLookupResult = getVnfOrVfModuleUri( sir, action);
} catch (ValidationException e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
ValidateException validateException = new ValidateException.Builder(e.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
@@ -1306,7 +1308,7 @@ public class ServiceInstances {
recipeLookupResult = getNetworkUri( sir, action);
} catch (ValidationException e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
ValidateException validateException = new ValidateException.Builder(e.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
@@ -1320,7 +1322,7 @@ public class ServiceInstances {
}
if (recipeLookupResult == null) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, MsoLogger.ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
RecipeNotFoundException recipeNotFoundExceptionException = new RecipeNotFoundException.Builder("Recipe could not be retrieved from catalog DB.", HttpStatus.SC_NOT_FOUND, ErrorNumbers.SVC_GENERAL_SERVICE_ERROR)
@@ -1852,7 +1854,7 @@ public class ServiceInstances {
if (StringUtils.isBlank(orchestrationUri) || StringUtils.isBlank(timeOut)) {
String error = StringUtils.isBlank(orchestrationUri) ? "ALaCarte Orchestration URI not found in properties" : "ALaCarte Recipe Timeout not found in properties";
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MsoLogger.ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
ValidateException validateException = new ValidateException.Builder(error, HttpStatus.SC_NOT_FOUND, ErrorNumbers.SVC_GENERAL_SERVICE_ERROR)
@@ -1881,7 +1883,7 @@ public class ServiceInstances {
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();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, 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();
}
@@ -1906,7 +1908,7 @@ public class ServiceInstances {
.setALaCarte(aLaCarte)
.setRequestUri(requestUri).build();
} catch (IOException e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
throw new ValidateException.Builder("Unable to generate RequestClientParamter object" + e.getMessage(), HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_BAD_PARAMETER)
.errorInfo(errorLoggerInfo).build();
}
@@ -1922,7 +1924,7 @@ public class ServiceInstances {
if (UUIDChecker.isValidUUID(requestId)) {
return requestId;
} else {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
ValidateException validateException = new ValidateException.Builder("Request Id " + requestId + " is not a valid UUID", HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_BAD_PARAMETER)
.errorInfo(errorLoggerInfo).build();
@@ -1939,7 +1941,7 @@ public class ServiceInstances {
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();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, 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();
}
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 98227f8495..b7bd28f45f 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
@@ -54,9 +54,9 @@ import org.onap.so.apihandlerinfra.tasksbeans.TaskList;
import org.onap.so.apihandlerinfra.tasksbeans.TaskVariableValue;
import org.onap.so.apihandlerinfra.tasksbeans.TaskVariables;
import org.onap.so.apihandlerinfra.tasksbeans.TasksGetResponse;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -163,7 +163,7 @@ public class TasksHandler {
response = requestClient.post(camundaJsonReq);
} catch(JsonProcessingException e){
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).build();
ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed : " + e.getMessage(),
@@ -171,7 +171,7 @@ public class TasksHandler {
throw validateException;
} catch(IOException e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MsoLogger.ErrorCode.AvailabilityError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, ErrorCode.AvailabilityError).build();
BPMNFailureException bpmnFailureException = new BPMNFailureException.Builder(String.valueOf(HttpStatus.SC_BAD_GATEWAY),HttpStatus.SC_BAD_GATEWAY,ErrorNumbers.SVC_NO_SERVER_RESOURCES).build();
throw bpmnFailureException;
}
@@ -203,7 +203,7 @@ public class TasksHandler {
} else {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, MsoLogger.ErrorCode.BusinessProcesssError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.BusinessProcesssError).build();
BPMNFailureException bpmnFailureException = new BPMNFailureException.Builder(String.valueOf(bpelStatus), bpelStatus, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR)
@@ -218,7 +218,7 @@ public class TasksHandler {
jsonResponse = mapper.writeValueAsString(trr);
}
catch (JsonProcessingException e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).build();
ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed : " + e.getMessage(),
@@ -241,7 +241,7 @@ public class TasksHandler {
try {
getResponse = requestClient.get();
}catch(IOException e){
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MsoLogger.ErrorCode.AvailabilityError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, ErrorCode.AvailabilityError).build();
BPMNFailureException validateException = new BPMNFailureException.Builder(String.valueOf(HttpStatus.SC_BAD_GATEWAY), HttpStatus.SC_BAD_GATEWAY, ErrorNumbers.SVC_NO_SERVER_RESOURCES).build();
throw validateException;
}
@@ -253,7 +253,7 @@ public class TasksHandler {
taskList = buildTaskList(taskId, respBody);
}
else {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MsoLogger.ErrorCode.AvailabilityError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, ErrorCode.AvailabilityError).build();
@@ -265,7 +265,7 @@ public class TasksHandler {
}
else {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MsoLogger.ErrorCode.AvailabilityError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, ErrorCode.AvailabilityError).build();
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java
index 00f1d6889d..be8f603a28 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java
@@ -55,8 +55,8 @@ import org.onap.so.apihandlerinfra.tenantisolationbeans.TenantSyncResponse;
import org.onap.so.db.request.beans.InfraActiveRequests;
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.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -124,7 +124,6 @@ public class CloudOrchestration {
private Response cloudOrchestration(String requestJSON, Action action, HashMap<String, String> instanceIdMap, String version, String requestId) throws ApiException{
- MsoLogger.setLogContext(requestId, null);
logger.info("{} {}", MessageEnum.APIH_GENERATED_REQUEST_ID.toString(), requestId);
long startTime = System.currentTimeMillis ();
CloudOrchestrationRequest cor = null;
@@ -135,7 +134,8 @@ public class CloudOrchestration {
try {
tenantIsolationRequest.parse(cor, instanceIdMap, action);
}catch(ValidationException e){
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,MsoLogger.ErrorCode.SchemaError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,
+ ErrorCode.SchemaError).build();
throw new ValidateException.Builder("Mapping of request to JSON object failed. " + e.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER)
@@ -160,7 +160,7 @@ public class CloudOrchestration {
instance = instanceIdMap.get(resourceType + "InstanceId");
}
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DUPLICATE_FOUND, MsoLogger.ErrorCode.SchemaError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DUPLICATE_FOUND, ErrorCode.SchemaError).build();
throw new DuplicateRequestException.Builder(resourceType,instance,dup.getRequestStatus(),dup.getRequestId(), HttpStatus.SC_CONFLICT, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR)
@@ -189,7 +189,8 @@ public class CloudOrchestration {
try {
encodedValue = new String(instanceId.getBytes("UTF-8"));
} catch(UnsupportedEncodingException ex) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,MsoLogger.ErrorCode.DataError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,
+ ErrorCode.DataError).build();
throw new ValidateException.Builder("Could not encode instanceID" + ex.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER)
@@ -210,7 +211,7 @@ public class CloudOrchestration {
try {
return requestsDbClient.checkInstanceNameDuplicate (instanceIdMap, instanceName, requestScope);
} catch (Exception e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DUPLICATE_CHECK_EXC, MsoLogger.ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DUPLICATE_CHECK_EXC, ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
throw new ValidateException.Builder("Duplicate Check Request", HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e)
@@ -226,7 +227,8 @@ public class CloudOrchestration {
return mapper.readValue(requestJSON, CloudOrchestrationRequest.class);
} catch(IOException e){
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,MsoLogger.ErrorCode.SchemaError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,
+ ErrorCode.SchemaError).build();
ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed. " + e.getMessage(), HttpStatus.SC_BAD_REQUEST,ErrorNumbers.SVC_BAD_PARAMETER)
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 9305b80c13..fe74b108ba 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
@@ -45,7 +45,6 @@ import org.apache.http.HttpStatus;
import org.onap.so.apihandler.common.ErrorNumbers;
import org.onap.so.apihandler.common.ResponseBuilder;
import org.onap.so.apihandlerinfra.Constants;
-import org.onap.so.apihandlerinfra.Messages;
import org.onap.so.apihandlerinfra.exceptions.ApiException;
import org.onap.so.apihandlerinfra.exceptions.ValidateException;
@@ -59,9 +58,9 @@ import org.onap.so.apihandlerinfra.tenantisolationbeans.RequestStatus;
import org.onap.so.db.request.beans.InfraActiveRequests;
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.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -103,7 +102,8 @@ public class CloudResourcesOrchestration {
ObjectMapper mapper = new ObjectMapper();
cor = mapper.readValue(requestJSON, CloudOrchestrationRequest.class);
} catch(IOException e){
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,MsoLogger.ErrorCode.SchemaError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,
+ ErrorCode.SchemaError).build();
ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed. " + e.getMessage(), HttpStatus.SC_BAD_REQUEST,ErrorNumbers.SVC_BAD_PARAMETER)
.cause(e).errorInfo(errorLoggerInfo).build();
@@ -113,7 +113,8 @@ public class CloudResourcesOrchestration {
try{
msoRequest.parseOrchestration(cor);
} catch (ValidationException e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,MsoLogger.ErrorCode.SchemaError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,
+ ErrorCode.SchemaError).build();
ValidateException validateException = new ValidateException.Builder(e.getMessage(), HttpStatus.SC_BAD_REQUEST,ErrorNumbers.SVC_BAD_PARAMETER)
.cause(e).errorInfo(errorLoggerInfo).build();
throw validateException;
@@ -126,7 +127,7 @@ public class CloudResourcesOrchestration {
}
if(infraActiveRequest == null) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND,MsoLogger.ErrorCode.BusinessProcesssError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, ErrorCode.BusinessProcesssError).build();
ValidateException validateException = new ValidateException.Builder("Orchestration RequestId " + requestId + " is not found in DB", HttpStatus.SC_BAD_REQUEST,ErrorNumbers.SVC_DETAILED_SERVICE_ERROR)
.errorInfo(errorLoggerInfo).build();
@@ -140,7 +141,8 @@ public class CloudResourcesOrchestration {
infraActiveRequest.setRequestId(requestId);
requestDbClient.save(infraActiveRequest);
}else{
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND,MsoLogger.ErrorCode.DataError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND,
+ ErrorCode.DataError).build();
ValidateException validateException = new ValidateException.Builder("Orchestration RequestId " + requestId + " has a status of " + status + " and can not be unlocked",
HttpStatus.SC_BAD_REQUEST,ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build();
@@ -173,14 +175,14 @@ public class CloudResourcesOrchestration {
try {
requestDB = requestDbClient.getInfraActiveRequestbyRequestId(requestId);
} catch (Exception e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, MsoLogger.ErrorCode.AvailabilityError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.AvailabilityError).build();
ValidateException validateException = new ValidateException.Builder(e.getMessage(), HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e)
.errorInfo(errorLoggerInfo).build();
throw validateException;
}
if(requestDB == null) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MsoLogger.ErrorCode.BusinessProcesssError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, ErrorCode.BusinessProcesssError).build();
ValidateException validateException = new ValidateException.Builder("Orchestration RequestId " + requestId + " is not found in DB",
HttpStatus.SC_NO_CONTENT, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR)
.errorInfo(errorLoggerInfo).build();
@@ -202,7 +204,7 @@ public class CloudResourcesOrchestration {
try{
orchestrationMap = tenantIsolationRequest.getOrchestrationFilters(queryParams);
}catch(ValidationException ex){
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.BusinessProcesssError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcesssError).build();
ValidateException validateException = new ValidateException.Builder(ex.getMessage(),
HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_GENERAL_SERVICE_ERROR).cause(ex)
.errorInfo(errorLoggerInfo).build();
@@ -251,7 +253,7 @@ public class CloudResourcesOrchestration {
ObjectMapper mapper = new ObjectMapper();
requestDetails = mapper.readValue(requestBody, RequestDetails.class);
} catch (IOException e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).build();
ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed. " + e.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER)
.cause(e).errorInfo(errorLoggerInfo).build();
throw validateException;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java
index 3ec3ade959..4be1ec9187 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java
@@ -46,8 +46,8 @@ import org.onap.so.apihandlerinfra.tenantisolationbeans.Action;
import org.onap.so.apihandlerinfra.tenantisolationbeans.Distribution;
import org.onap.so.apihandlerinfra.tenantisolationbeans.Status;
import org.onap.so.exceptions.ValidationException;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.serviceinstancebeans.RequestError;
import org.onap.so.serviceinstancebeans.ServiceException;
import org.slf4j.Logger;
@@ -85,7 +85,8 @@ public class ModelDistributionRequest {
ObjectMapper mapper = new ObjectMapper();
distributionRequest = mapper.readValue(requestJSON, Distribution.class);
} catch(IOException e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,MsoLogger.ErrorCode.SchemaError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,
+ ErrorCode.SchemaError).build();
ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed. " + e.getMessage(), HttpStatus.SC_BAD_REQUEST,ErrorNumbers.SVC_BAD_PARAMETER)
@@ -98,7 +99,8 @@ public class ModelDistributionRequest {
parse(distributionRequest);
} catch(ValidationException e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,MsoLogger.ErrorCode.SchemaError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,
+ ErrorCode.SchemaError).build();
ValidateException validateException = new ValidateException.Builder(e.getMessage(), HttpStatus.SC_BAD_REQUEST,ErrorNumbers.SVC_BAD_PARAMETER)
@@ -148,7 +150,7 @@ public class ModelDistributionRequest {
requestErrorStr = mapper.writeValueAsString(re);
}catch(JsonProcessingException e){
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_VALIDATION_ERROR,MsoLogger.ErrorCode.DataError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_VALIDATION_ERROR, ErrorCode.DataError).build();
ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed. " + e.getMessage(), HttpStatus.SC_BAD_REQUEST,ErrorNumbers.SVC_BAD_PARAMETER)
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java
index 47cbb0c895..82a5d1ebbf 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java
@@ -47,8 +47,8 @@ import org.onap.so.apihandlerinfra.vnfbeans.RequestStatusType;
import org.onap.so.db.request.beans.InfraActiveRequests;
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.logger.MsoLogger;
import org.onap.so.utils.UUIDChecker;
import org.slf4j.Logger;
@@ -84,11 +84,9 @@ public class TenantIsolationRequest {
TenantIsolationRequest (String requestId) {
this.requestId = requestId;
- MsoLogger.setLogContext (requestId, null);
}
TenantIsolationRequest () {
- MsoLogger.setLogContext (requestId, null);
}
void parse(CloudOrchestrationRequest request, HashMap<String,String> instanceIdMap, Action action) throws ValidationException {
@@ -356,7 +354,7 @@ public class TenantIsolationRequest {
requestsDbClient.save(request);
} catch (Exception e) {
logger.error("{} {} {} {}", MessageEnum.APIH_DB_UPDATE_EXC.toString(), e.getMessage(),
- MsoLogger.ErrorCode.DataError.getValue(), "Exception when updating record in DB");
+ ErrorCode.DataError.getValue(), "Exception when updating record in DB");
logger.debug("Exception: ", e);
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java
index 00ce137ee3..98104e9073 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java
@@ -34,8 +34,8 @@ import org.onap.so.apihandlerinfra.tenantisolation.process.CreateVnfOperationalE
import org.onap.so.apihandlerinfra.tenantisolation.process.DeactivateVnfOperationalEnvironment;
import org.onap.so.apihandlerinfra.tenantisolationbeans.Action;
import org.onap.so.apihandlerinfra.tenantisolationbeans.OperationalEnvironment;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.requestsdb.RequestsDBHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -76,7 +76,7 @@ public class TenantIsolationRunnable {
} else if(OperationalEnvironment.VNF.name().equalsIgnoreCase(operationalEnvType)) {
createVnfOpEnv.execute(requestId, cor);
} else {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.DataError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.DataError).build();
ValidateException validateException = new ValidateException.Builder("Invalid OperationalEnvironment Type specified for Create Action",
HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).errorInfo(errorLoggerInfo)
.build();
@@ -90,7 +90,7 @@ public class TenantIsolationRunnable {
} else if(Action.distributionStatus.equals(action)) {
activateVnfStatusOpEnv.execute(requestId, cor);
} else {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.DataError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.DataError).build();
ValidateException validateException = new ValidateException.Builder("Invalid Action specified: " + action,
HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).errorInfo(errorLoggerInfo).build();
throw validateException;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/DmaapOperationalEnvClient.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/DmaapOperationalEnvClient.java
index f718431534..55b1ea6198 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/DmaapOperationalEnvClient.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/DmaapOperationalEnvClient.java
@@ -29,8 +29,8 @@ import org.onap.so.apihandler.common.ErrorNumbers;
import org.onap.so.apihandlerinfra.exceptions.ApiException;
import org.onap.so.apihandlerinfra.exceptions.ValidateException;
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -55,7 +55,7 @@ public class DmaapOperationalEnvClient {
try {
return this.getJson(operationalEnv);
}catch(JsonProcessingException ex){
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).build();
ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed : " + ex.getMessage(),
HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(ex).errorInfo(errorLoggerInfo).build();
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelper.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelper.java
index eb0721270d..de1d9e9cfb 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelper.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelper.java
@@ -50,7 +50,8 @@ public class ActivateVnfDBHelper {
String status,
String recoveryAction,
int retryCount,
- String workloadContext) {
+ String workloadContext,
+ String vnfOperationalEnvironmentId) {
OperationalEnvServiceModelStatus serviceModelStatus = new OperationalEnvServiceModelStatus();
serviceModelStatus.setRequestId(requestId);
serviceModelStatus.setOperationalEnvId(operationalEnvironmentId);
@@ -59,6 +60,7 @@ public class ActivateVnfDBHelper {
serviceModelStatus.setRecoveryAction(recoveryAction);
serviceModelStatus.setRetryCount(new Integer(retryCount));
serviceModelStatus.setWorkloadContext(workloadContext);
+ serviceModelStatus.setVnfOperationalEnvId(vnfOperationalEnvironmentId);
return serviceModelStatus;
}
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 9303e12071..bf5623a9da 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
@@ -37,8 +37,8 @@ import org.onap.so.apihandlerinfra.exceptions.ValidateException;
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
import org.onap.so.client.HttpClient;
import org.onap.so.client.HttpClientFactory;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.utils.CryptoUtils;
import org.onap.so.utils.TargetEntity;
import org.slf4j.Logger;
@@ -86,7 +86,7 @@ public class SDCClientHelper {
String basicAuthCred = getBasicAuth();
if ( basicAuthCred == null || "".equals(basicAuthCred) ) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.BusinessProcesssError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcesssError).build();
ValidateException validateException = new ValidateException.Builder(" SDC credentials 'mso.sdc.client.auth' not setup in properties file!",
HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build();
@@ -131,7 +131,7 @@ public class SDCClientHelper {
try {
return client.post(jsonPayload);
}catch(Exception ex){
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.BusinessProcesssError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcesssError).build();
ValidateException validateException = new ValidateException.Builder("Bad request could not post payload",
HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(ex).errorInfo(errorLoggerInfo).build();
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 f70fe71554..dde45a81c9 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
@@ -28,9 +28,6 @@ import javax.ws.rs.core.Response;
import org.apache.http.HttpStatus;
import org.json.JSONObject;
import org.onap.aai.domain.yang.OperationalEnvironment;
-import org.onap.aai.domain.yang.RelationshipList;
-import org.onap.aai.domain.yang.Relationship;
-import org.onap.aai.domain.yang.RelationshipData;
import org.onap.so.apihandler.common.ErrorNumbers;
import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.apihandlerinfra.exceptions.ApiException;
@@ -47,8 +44,8 @@ import org.onap.so.client.aai.entities.Relationships;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.db.request.beans.OperationalEnvDistributionStatus;
import org.onap.so.db.request.beans.OperationalEnvServiceModelStatus;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.requestsdb.RequestsDBHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -109,17 +106,17 @@ public class ActivateVnfOperationalEnvironment {
String workloadContext = operationalEnv.getWorkloadContext();
logger.debug(" aai workloadContext: {}", workloadContext);
if (!vidWorkloadContext.equals(workloadContext)) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.BusinessProcesssError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcesssError).build();
throw new ValidateException.Builder(" The vid workloadContext did not match from aai record. " + " vid workloadContext:" + vidWorkloadContext + " aai workloadContext:" + workloadContext,
HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build();
}
if (ecompOperationalEnvironmentId==null) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.BusinessProcesssError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcesssError).build();
throw new ValidateException.Builder(" The ECOMP OE was not in aai record; the value of relationship.relationship-data key: " + OPER_ENVIRONMENT_ID_KEY,
HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build();
}
- processActivateSDCRequest(requestId, ecompOperationalEnvironmentId, serviceModelVersionIdList, workloadContext);
+ processActivateSDCRequest(requestId, ecompOperationalEnvironmentId, serviceModelVersionIdList, workloadContext, vnfOperationalEnvironmentId);
}
@@ -134,7 +131,7 @@ public class ActivateVnfOperationalEnvironment {
*/
public void processActivateSDCRequest(String requestId, String operationalEnvironmentId,
List<ServiceModelList> serviceModelVersionIdList,
- String workloadContext) throws ApiException {
+ String workloadContext, String vnfOperationalEnvironmentId) throws ApiException {
JSONObject jsonResponse = null;
int retryCount = 0;
@@ -157,7 +154,8 @@ public class ActivateVnfOperationalEnvironment {
DISTRIBUTION_STATUS_SENT,
recoveryAction,
retryCount,
- workloadContext);
+ workloadContext,
+ vnfOperationalEnvironmentId);
client.save(serviceModelStatus);
String distributionId = "";
@@ -178,7 +176,7 @@ public class ActivateVnfOperationalEnvironment {
client.save(distStatus);
} else {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.BusinessProcesssError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcesssError).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 352bf8fb0b..e09dcd8d2d 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
@@ -24,25 +24,29 @@ package org.onap.so.apihandlerinfra.tenantisolation.process;
import java.util.List;
+import java.util.Optional;
import javax.ws.rs.core.Response;
import org.apache.http.HttpStatus;
import org.json.JSONObject;
+import org.onap.aai.domain.yang.OperationalEnvironment;
import org.onap.so.apihandler.common.ErrorNumbers;
import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.apihandlerinfra.exceptions.ApiException;
import org.onap.so.apihandlerinfra.exceptions.ValidateException;
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
import org.onap.so.apihandlerinfra.tenantisolation.CloudOrchestrationRequest;
+import org.onap.so.apihandlerinfra.tenantisolation.helpers.AAIClientHelper;
import org.onap.so.apihandlerinfra.tenantisolation.helpers.ActivateVnfDBHelper;
import org.onap.so.apihandlerinfra.tenantisolation.helpers.SDCClientHelper;
import org.onap.so.apihandlerinfra.tenantisolationbeans.Distribution;
import org.onap.so.apihandlerinfra.tenantisolationbeans.DistributionStatus;
+import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.db.request.beans.OperationalEnvDistributionStatus;
import org.onap.so.db.request.beans.OperationalEnvServiceModelStatus;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.requestsdb.RequestsDBHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -57,7 +61,8 @@ public class ActivateVnfStatusOperationalEnvironment {
private String errorMessage = "";
private OperationalEnvDistributionStatus queryDistributionDbResponse = null;
private OperationalEnvServiceModelStatus queryServiceModelResponse = null;
-
+ private boolean isOverallSuccess = false;
+
private final int RETRY_COUNT_ZERO = 0;
private final String ERROR_REASON_ABORTED = "ABORTED";
private final String RECOVERY_ACTION_RETRY = "RETRY";
@@ -77,6 +82,8 @@ public class ActivateVnfStatusOperationalEnvironment {
private SDCClientHelper sdcClientHelper;
@Autowired
private RequestsDbClient client;
+ @Autowired
+ private AAIClientHelper aaiHelper;
/**
* The Point-Of-Entry from APIH with activate status from SDC
@@ -107,8 +114,19 @@ public class ActivateVnfStatusOperationalEnvironment {
// to determine the OVERALL status if "COMPLETE" or "FAILURE":
checkOrUpdateOverallStatus(operationalEnvironmentId, this.origRequestId);
+ // Update AAI to ACTIVE if Overall success
+ if (isOverallSuccess) {
+ OperationalEnvironment aaiOpEnv = getAAIOperationalEnvironment(this.queryServiceModelResponse.getVnfOperationalEnvId());
+ if (aaiOpEnv != null) {
+ aaiOpEnv.setOperationalEnvironmentStatus("ACTIVE");
+ aaiHelper.updateAaiOperationalEnvironment(operationalEnvironmentId, aaiOpEnv);
+ }else {
+ requestDb.updateInfraFailureCompletion("Unable to update ACTIVATE status in AAI. ", this.origRequestId, this.queryServiceModelResponse.getVnfOperationalEnvId());
+ }
+ }
+
} catch(Exception e) {
- requestDb.updateInfraFailureCompletion(e.getMessage(), this.origRequestId, this.queryDistributionDbResponse.getOperationalEnvId());
+ requestDb.updateInfraFailureCompletion(e.getMessage(), this.origRequestId, this.queryServiceModelResponse.getVnfOperationalEnvId());
}
}
@@ -236,7 +254,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, MsoLogger.ErrorCode.BusinessProcesssError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcesssError).build();
ValidateException validateException = new ValidateException.Builder(dbErrorMessage,
HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build();
requestDb.updateInfraFailureCompletion(dbErrorMessage, this.origRequestId, operEnvironmentId);
@@ -280,11 +298,12 @@ public class ActivateVnfStatusOperationalEnvironment {
if (status.equals("Completed") && queryServiceModelResponseList.size() == count) {
String messageStatus = "Overall Activation process is complete. " + status;
+ isOverallSuccess = true;
requestDb.updateInfraSuccessCompletion(messageStatus, origRequestId, operationalEnvironmentId);
} else {
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, MsoLogger.ErrorCode.BusinessProcesssError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcesssError).build();
ValidateException validateException = new ValidateException.Builder(this.errorMessage,
HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build();
requestDb.updateInfraFailureCompletion(this.errorMessage, origRequestId, operationalEnvironmentId);
@@ -293,4 +312,15 @@ public class ActivateVnfStatusOperationalEnvironment {
}
}
+
+ /**
+ * Get OperationalEnvironment object
+ * @param operationalEnvironmentId - String
+ * @return operationalEnv - OperationalEnvironment object
+ */
+ private OperationalEnvironment getAAIOperationalEnvironment(String operationalEnvironmentId) {
+ AAIResultWrapper aaiResult = aaiHelper.getAaiOperationalEnvironment(operationalEnvironmentId);
+ Optional<OperationalEnvironment> operationalEnvironmentOpt = aaiResult.asBean(OperationalEnvironment.class);
+ return operationalEnvironmentOpt.isPresent() ? operationalEnvironmentOpt.get() : null;
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java
index 6ba78aa175..e9c9be9dd4 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java
@@ -31,8 +31,8 @@ import org.onap.so.apihandlerinfra.tenantisolation.CloudOrchestrationRequest;
import org.onap.so.apihandlerinfra.tenantisolation.dmaap.DmaapOperationalEnvClient;
import org.onap.so.apihandlerinfra.tenantisolation.helpers.AAIClientHelper;
import org.onap.so.apihandlerinfra.tenantisolation.helpers.AAIClientObjectBuilder;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.requestsdb.RequestsDBHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -75,7 +75,7 @@ public class CreateEcompOperationalEnvironment {
request.getRequestDetails().getRequestParameters().getWorkloadContext(),
"Create");
}catch(Exception e){
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.DataError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.DataError).build();
ValidateException validateException = new ValidateException.Builder("Could not publish DMaap", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
.errorInfo(errorLoggerInfo).build();
requestDb.updateInfraFailureCompletion(e.getMessage(), requestId, request.getOperationalEnvironmentId());
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java
index 2eaba25234..cc3e3aeb16 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java
@@ -47,8 +47,8 @@ import org.onap.so.client.grm.beans.ServiceEndPoint;
import org.onap.so.client.grm.beans.ServiceEndPointList;
import org.onap.so.client.grm.beans.ServiceEndPointRequest;
import org.onap.so.client.grm.beans.Version;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.requestsdb.RequestsDBHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -108,7 +108,7 @@ public class CreateVnfOperationalEnvironment {
requestDb.updateInfraSuccessCompletion("SUCCESSFULLY created VNF operational environment", requestId, request.getOperationalEnvironmentId());
}catch(Exception e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.DataError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.DataError).build();
ValidateException validateException = new ValidateException.Builder(e.getMessage(),
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java
index 2181215ca7..7f8b330727 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java
@@ -34,8 +34,8 @@ import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
import org.onap.so.apihandlerinfra.tenantisolation.CloudOrchestrationRequest;
import org.onap.so.apihandlerinfra.tenantisolation.helpers.AAIClientHelper;
import org.onap.so.client.aai.entities.AAIResultWrapper;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.requestsdb.RequestsDBHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -62,7 +62,7 @@ public class DeactivateVnfOperationalEnvironment {
if(StringUtils.isBlank(operationalEnvironmentStatus)) {
String error = "OperationalEnvironmentStatus is null on OperationalEnvironmentId: " + operationalEnvironmentId;
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.DataError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.DataError).build();
throw new ValidateException.Builder(error, HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR)
.errorInfo(errorLoggerInfo)
.build();
@@ -75,7 +75,7 @@ public class DeactivateVnfOperationalEnvironment {
} else if(!operationalEnvironmentStatus.equalsIgnoreCase("INACTIVE")) {
String error = "Invalid OperationalEnvironmentStatus on OperationalEnvironmentId: " + operationalEnvironmentId;
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.DataError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.DataError).build();
ValidateException validateException = new ValidateException.Builder(error,
HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build();
requestDb.updateInfraFailureCompletion(error, requestId, operationalEnvironmentId);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java
index 7bb1bdf71a..6efcdc47e5 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java
@@ -28,10 +28,9 @@ import org.onap.so.apihandler.common.ErrorNumbers;
import org.onap.so.apihandlerinfra.exceptions.*;
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
-
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
@@ -89,7 +88,7 @@ public class ApiExceptionTest extends BaseTest {
@Test
public void testDuplicateRequestException() throws ApiException {
- ErrorLoggerInfo testLog = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MsoLogger.ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo testLog = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
thrown.expect(DuplicateRequestException.class);
thrown.expectMessage(startsWith("Error: Locked instance"));
thrown.expect(hasProperty("httpResponseCode", is(HttpStatus.SC_NOT_FOUND)));
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 bb78c822f7..1943b42404 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
@@ -29,6 +29,15 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static com.shazam.shazamcrest.MatcherAssert.assertThat;
+import static org.onap.so.logger.MdcConstants.ECOMP_REQUEST_ID;
+import static org.onap.so.logger.MdcConstants.ENDTIME;
+import static org.onap.so.logger.MdcConstants.INVOCATION_ID;
+import static org.onap.so.logger.MdcConstants.PARTNERNAME;
+import static org.onap.so.logger.MdcConstants.RESPONSECODE;
+import static org.onap.so.logger.MdcConstants.RESPONSEDESC;
+import static org.onap.so.logger.MdcConstants.SERVICE_NAME;
+import static org.onap.so.logger.MdcConstants.STATUSCODE;
+import static org.onap.so.logger.MdcConstants.CLIENT_ID;
import java.io.IOException;
import java.util.Map;
@@ -44,7 +53,6 @@ import org.onap.so.apihandlerinfra.tasksbeans.RequestInfo;
import org.onap.so.apihandlerinfra.tasksbeans.TaskRequestReference;
import org.onap.so.apihandlerinfra.tasksbeans.TasksRequest;
import org.onap.so.apihandlerinfra.tasksbeans.ValidResponses;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.serviceinstancebeans.RequestError;
import org.onap.so.serviceinstancebeans.ServiceException;
import org.springframework.http.HttpEntity;
@@ -64,8 +72,6 @@ public class ManualTasksTest extends BaseTest{
private final String basePath = "/tasks/v1/";
-
-
@Test
public void testCreateOpEnvObjectMapperError() throws IOException {
TestAppender.events.clear();
@@ -88,8 +94,8 @@ public class ManualTasksTest extends BaseTest{
HttpHeaders headers = new HttpHeaders();
headers.set("Accept", MediaType.APPLICATION_JSON);
headers.set("Content-Type", MediaType.APPLICATION_JSON);
- headers.set(MsoLogger.ECOMP_REQUEST_ID, "987654321");
- headers.set(MsoLogger.CLIENT_ID, "VID");
+ headers.set(ECOMP_REQUEST_ID, "987654321");
+ headers.set(CLIENT_ID, "VID");
HttpEntity<TasksRequest> entity = new HttpEntity<TasksRequest>(taskReq, headers);
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(basePath) + taskId + "/complete");
@@ -116,22 +122,22 @@ public class ManualTasksTest extends BaseTest{
Map<String,String> mdc = logEvent.getMDCPropertyMap();
assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
- assertNotNull(mdc.get(MsoLogger.INVOCATION_ID));
- assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME));
- assertEquals("tasks/v1/55/complete",mdc.get(MsoLogger.SERVICE_NAME));
- assertEquals("INPROGRESS",mdc.get(MsoLogger.STATUSCODE));
+ assertNotNull(mdc.get(INVOCATION_ID));
+ assertEquals("UNKNOWN",mdc.get(PARTNERNAME));
+ assertEquals("tasks/v1/55/complete",mdc.get(SERVICE_NAME));
+ assertEquals("INPROGRESS",mdc.get(STATUSCODE));
}else if(logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging") &&
logEvent.getMarker() != null && logEvent.getMarker().getName().equals("EXIT")){
Map<String,String> mdc = logEvent.getMDCPropertyMap();
assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
- assertNotNull(mdc.get(MsoLogger.ENDTIME));
+ assertNotNull(mdc.get(ENDTIME));
assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
- assertNotNull(mdc.get(MsoLogger.INVOCATION_ID));
- assertEquals("202",mdc.get(MsoLogger.RESPONSECODE));
- assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME));
- assertEquals("tasks/v1/55/complete",mdc.get(MsoLogger.SERVICE_NAME));
- assertEquals("COMPLETE",mdc.get(MsoLogger.STATUSCODE));
- assertNotNull(mdc.get(MsoLogger.RESPONSEDESC));
+ assertNotNull(mdc.get(INVOCATION_ID));
+ assertEquals("202",mdc.get(RESPONSECODE));
+ assertEquals("UNKNOWN",mdc.get(PARTNERNAME));
+ assertEquals("tasks/v1/55/complete",mdc.get(SERVICE_NAME));
+ assertEquals("COMPLETE",mdc.get(STATUSCODE));
+ assertNotNull(mdc.get(RESPONSEDESC));
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));
@@ -151,8 +157,8 @@ public class ManualTasksTest extends BaseTest{
HttpHeaders headers = new HttpHeaders();
headers.set("Accept", MediaType.APPLICATION_JSON);
headers.set("Content-Type", MediaType.APPLICATION_JSON);
- headers.set(MsoLogger.ECOMP_REQUEST_ID, "987654321");
- headers.set(MsoLogger.CLIENT_ID, "VID");
+ headers.set(ECOMP_REQUEST_ID, "987654321");
+ headers.set(CLIENT_ID, "VID");
HttpEntity<String> entity = new HttpEntity<String>(invalidRequest, headers);
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(basePath) + "55" + "/complete");
@@ -187,8 +193,8 @@ public class ManualTasksTest extends BaseTest{
HttpHeaders headers = new HttpHeaders();
headers.set("Accept", MediaType.APPLICATION_JSON);
headers.set("Content-Type", MediaType.APPLICATION_JSON);
- headers.set(MsoLogger.ECOMP_REQUEST_ID, "987654321");
- headers.set(MsoLogger.CLIENT_ID, "VID");
+ headers.set(ECOMP_REQUEST_ID, "987654321");
+ headers.set(CLIENT_ID, "VID");
HttpEntity<TasksRequest> entity = new HttpEntity<TasksRequest>(taskReq, headers);
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(basePath) + taskId + "/complete");
@@ -227,8 +233,8 @@ public class ManualTasksTest extends BaseTest{
HttpHeaders headers = new HttpHeaders();
headers.set("Accept", MediaType.APPLICATION_JSON);
headers.set("Content-Type", MediaType.APPLICATION_JSON);
- headers.set(MsoLogger.ECOMP_REQUEST_ID, "987654321");
- headers.set(MsoLogger.CLIENT_ID, "VID");
+ headers.set(ECOMP_REQUEST_ID, "987654321");
+ headers.set(CLIENT_ID, "VID");
HttpEntity<TasksRequest> entity = new HttpEntity<TasksRequest>(taskReq, headers);
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(basePath) + taskId + "/complete");
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 d6c794ef2e..17fa011c93 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
@@ -34,6 +34,18 @@ 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.so.logger.HttpHeadersConstants.ONAP_REQUEST_ID;
+import static org.onap.so.logger.HttpHeadersConstants.REQUESTOR_ID;
+import static org.onap.so.logger.MdcConstants.CLIENT_ID;
+import static org.onap.so.logger.MdcConstants.ENDTIME;
+import static org.onap.so.logger.MdcConstants.INVOCATION_ID;
+import static org.onap.so.logger.MdcConstants.PARTNERNAME;
+import static org.onap.so.logger.MdcConstants.RESPONSECODE;
+import static org.onap.so.logger.MdcConstants.RESPONSEDESC;
+import static org.onap.so.logger.MdcConstants.SERVICE_NAME;
+import static org.onap.so.logger.MdcConstants.STATUSCODE;
+import static org.onap.so.logger.HttpHeadersConstants.TRANSACTION_ID;
+
import java.io.File;
import java.io.IOException;
@@ -59,8 +71,7 @@ import org.onap.so.apihandlerinfra.exceptions.RequestDbFailureException;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.ServiceRecipe;
import org.onap.so.db.request.beans.InfraActiveRequests;
-import org.onap.so.logger.LogConstants;
-import org.onap.so.logger.MsoLogger;
+import org.onap.so.logger.HttpHeadersConstants;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
import org.onap.so.serviceinstancebeans.ModelInfo;
import org.onap.so.serviceinstancebeans.RequestDetails;
@@ -117,11 +128,11 @@ public class ServiceInstancesTest extends BaseTest{
// set headers
headers = new HttpHeaders();
headers.set(ONAPLogConstants.Headers.PARTNER_NAME, "test_name");
- headers.set(MsoLogger.TRANSACTION_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
- headers.set(MsoLogger.ONAP_REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
+ headers.set(HttpHeadersConstants.TRANSACTION_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
+ headers.set(ONAP_REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
headers.set(ONAPLogConstants.MDCs.REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
- headers.set(MsoLogger.CLIENT_ID, "VID");
- headers.set(MsoLogger.REQUESTOR_ID, "xxxxxx");
+ headers.set(CLIENT_ID, "VID");
+ headers.set(REQUESTOR_ID, "xxxxxx");
try { // generate one-time port number to avoid RANDOM port number later.
initialUrl = new URL(createURLWithPort(Constants.ORCHESTRATION_REQUESTS_PATH));
initialPort = initialUrl.getPort();
@@ -263,22 +274,22 @@ public class ServiceInstancesTest extends BaseTest{
Map<String,String> mdc = logEvent.getMDCPropertyMap();
assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
- assertNotNull(mdc.get(MsoLogger.INVOCATION_ID));
- assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME));
- assertEquals("onap/so/infra/serviceInstantiation/v5/serviceInstances",mdc.get(MsoLogger.SERVICE_NAME));
- assertEquals("INPROGRESS",mdc.get(MsoLogger.STATUSCODE));
+ assertNotNull(mdc.get(INVOCATION_ID));
+ assertEquals("UNKNOWN",mdc.get(PARTNERNAME));
+ assertEquals("onap/so/infra/serviceInstantiation/v5/serviceInstances",mdc.get(SERVICE_NAME));
+ assertEquals("INPROGRESS",mdc.get(STATUSCODE));
}else if(logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging") &&
logEvent.getMarker() != null && logEvent.getMarker().getName().equals("EXIT")){
Map<String,String> mdc = logEvent.getMDCPropertyMap();
assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
- assertNotNull(mdc.get(MsoLogger.ENDTIME));
+ assertNotNull(mdc.get(ENDTIME));
assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
- assertNotNull(mdc.get(MsoLogger.INVOCATION_ID));
- assertEquals("202",mdc.get(MsoLogger.RESPONSECODE));
- assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME));
- assertEquals("onap/so/infra/serviceInstantiation/v5/serviceInstances",mdc.get(MsoLogger.SERVICE_NAME));
- assertEquals("COMPLETE",mdc.get(MsoLogger.STATUSCODE));
- assertNotNull(mdc.get(MsoLogger.RESPONSEDESC));
+ assertNotNull(mdc.get(INVOCATION_ID));
+ assertEquals("202",mdc.get(RESPONSECODE));
+ assertEquals("UNKNOWN",mdc.get(PARTNERNAME));
+ assertEquals("onap/so/infra/serviceInstantiation/v5/serviceInstances",mdc.get(SERVICE_NAME));
+ assertEquals("COMPLETE",mdc.get(STATUSCODE));
+ assertNotNull(mdc.get(RESPONSEDESC));
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));
@@ -2387,14 +2398,14 @@ 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"));
- assertEquals(response.getHeaders().get(MsoLogger.TRANSACTION_ID).get(0), "32807a28-1a14-4b88-b7b3-2950918aa76d");
+ 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.JaxRsFilterLogging") &&
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(MsoLogger.PARTNERNAME));
+ assertEquals("VID",mdc.get(PARTNERNAME));
}
}
}
@@ -2451,7 +2462,7 @@ public class ServiceInstancesTest extends BaseTest{
public void deleteInstanceGroupNoPartnerNameHeader() throws IOException{
HttpHeaders noPartnerHeaders = new HttpHeaders();
noPartnerHeaders.set(ONAPLogConstants.Headers.REQUEST_ID, "eca3a1b1-43ab-457e-ab1c-367263d148b4");
- noPartnerHeaders.set(MsoLogger.REQUESTOR_ID, "xxxxxx");
+ noPartnerHeaders.set(REQUESTOR_ID, "xxxxxx");
uri = servInstanceuri + "/v7/instanceGroups/e05864f0-ab35-47d0-8be4-56fd9619ba3c";
ResponseEntity<String> response = sendRequest(null, uri, HttpMethod.DELETE, noPartnerHeaders);
//then
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelperTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelperTest.java
index b799394b7a..78315e9fad 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelperTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelperTest.java
@@ -92,6 +92,7 @@ public class AAIClientHelperTest extends BaseTest{
Map<String, String> payload = new HashMap<String, String>();
payload.put("tenant-context", "Test");
payload.put("workload-context", "ECOMPL_PSL");
+ payload.put("operational-environment-status", "ACTIVE");
try {
AAIClientHelper clientHelper = mock(AAIClientHelper.class);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelperTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelperTest.java
index 3e06275fca..6fda6afc50 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelperTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelperTest.java
@@ -41,6 +41,7 @@ import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
public class ActivateVnfDBHelperTest extends BaseTest{
String operationalEnvironmentId = "TEST_operationalEnvironmentId";
+ String vnfOperationalEnvironmentId = "VNF_operationalEnvironmentId";
String requestId = "TEST_requestId";
String origRequestId = "TEST_requestId";
@@ -81,6 +82,7 @@ public class ActivateVnfDBHelperTest extends BaseTest{
expectedServiceModelStatus.setRecoveryAction(recoveryActionRetry);
expectedServiceModelStatus.setRetryCount(new Integer(retryCountThree));
expectedServiceModelStatus.setWorkloadContext(workloadContext1);
+ expectedServiceModelStatus.setVnfOperationalEnvId(vnfOperationalEnvironmentId);
}
@Test
@@ -122,7 +124,8 @@ public class ActivateVnfDBHelperTest extends BaseTest{
statusOk,
recoveryActionRetry,
retryCountThree,
- workloadContext1);
+ workloadContext1,
+ vnfOperationalEnvironmentId);
assertThat(serviceModelStatus1, sameBeanAs(expectedServiceModelStatus));
// prepare updated expected object
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironmentTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironmentTest.java
index 18af7fbaa0..418ed4270a 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironmentTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironmentTest.java
@@ -74,6 +74,7 @@ public class ActivateVnfOperationalEnvironmentTest extends BaseTest{
private final String requestId = "TEST_requestId";
private final String operationalEnvironmentId = "1dfe7154-eae0-44f2-8e7a-8e5e7882e55d";
+ private final String vnfOperationalEnvironmentId = "1dfe7154-eae0-44f2-8e7a-8e5e7882e66d";
private final CloudOrchestrationRequest request = new CloudOrchestrationRequest();
private final String workloadContext = "PVT";
String recoveryActionRetry = "RETRY";
@@ -86,7 +87,7 @@ public class ActivateVnfOperationalEnvironmentTest extends BaseTest{
@Before
public void init(){
stubFor(post(urlPathEqualTo("/operationalEnvServiceModelStatus/"))
- .withRequestBody(equalTo("{\"requestId\":\"TEST_requestId\",\"operationalEnvId\":\"1dfe7154-eae0-44f2-8e7a-8e5e7882e55d\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"SENT\",\"recoveryAction\":\"RETRY\",\"retryCount\":3,\"workloadContext\":\"PVT\",\"createTime\":null,\"modifyTime\":null}"))
+ .withRequestBody(equalTo("{\"requestId\":\"TEST_requestId\",\"operationalEnvId\":\"1dfe7154-eae0-44f2-8e7a-8e5e7882e55d\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"SENT\",\"recoveryAction\":\"RETRY\",\"retryCount\":3,\"workloadContext\":\"PVT\",\"createTime\":null,\"modifyTime\":null,\"vnfOperationalEnvId\":\"1dfe7154-eae0-44f2-8e7a-8e5e7882e66d\"}"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
stubFor(post(urlPathEqualTo("/operationalEnvDistributionStatus/"))
@@ -130,7 +131,7 @@ public class ActivateVnfOperationalEnvironmentTest extends BaseTest{
requestParameters.setWorkloadContext(workloadContext);
requestDetails.setRequestParameters(requestParameters);
- request.setOperationalEnvironmentId(operationalEnvironmentId);
+ request.setOperationalEnvironmentId(vnfOperationalEnvironmentId);
request.setRequestDetails(requestDetails);
JSONObject jsonObject = new JSONObject();
@@ -139,7 +140,7 @@ public class ActivateVnfOperationalEnvironmentTest extends BaseTest{
jsonObject.put("distributionId", sdcDistributionId);
stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json").withBodyFile("vnfoperenv/ecompOperationalEnvironmentWithRelationship.json").withStatus(HttpStatus.SC_ACCEPTED)));
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withBodyFile("vnfoperenv/activateOperationalEnvironmentWithRelationship.json").withStatus(HttpStatus.SC_ACCEPTED)));
stubFor(post(urlPathMatching("/sdc/v1/catalog/services/TEST_serviceModelVersionId/distr.*"))
.willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(jsonObject.toString()).withStatus(HttpStatus.SC_ACCEPTED)));
activateVnf.execute(requestId, request);
@@ -165,7 +166,7 @@ public class ActivateVnfOperationalEnvironmentTest extends BaseTest{
stubFor(post(urlPathMatching("/sdc/v1/catalog/services/TEST_serviceModelVersionId/distr.*"))
.willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(jsonObject.toString()).withStatus(HttpStatus.SC_ACCEPTED)));
- activateVnf.processActivateSDCRequest(requestId, operationalEnvironmentId, serviceModelVersionIdList, workloadContext);
+ activateVnf.processActivateSDCRequest(requestId, operationalEnvironmentId, serviceModelVersionIdList, workloadContext, vnfOperationalEnvironmentId);
}
@Test
@@ -205,7 +206,7 @@ public class ActivateVnfOperationalEnvironmentTest extends BaseTest{
thrown.expect(ValidateException.class);
- activateVnf.processActivateSDCRequest(requestId, operationalEnvironmentId, serviceModelVersionIdList, workloadContext);
+ activateVnf.processActivateSDCRequest(requestId, operationalEnvironmentId, serviceModelVersionIdList, workloadContext, vnfOperationalEnvironmentId);
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java
index a26848bf21..6722941f95 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java
@@ -23,6 +23,7 @@ package org.onap.so.apihandlerinfra.tenantisolation.process;
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.get;
import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.put;
import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
@@ -48,6 +49,7 @@ import org.onap.so.apihandlerinfra.tenantisolation.CloudOrchestrationRequest;
import org.onap.so.apihandlerinfra.tenantisolationbeans.Distribution;
import org.onap.so.apihandlerinfra.tenantisolationbeans.DistributionStatus;
import org.onap.so.apihandlerinfra.tenantisolationbeans.Status;
+import org.onap.so.client.aai.AAIVersion;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.beans.OperationalEnvDistributionStatus;
import org.onap.so.db.request.beans.OperationalEnvServiceModelStatus;
@@ -66,6 +68,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
private final String requestId = "TEST_requestId";
private final String requestIdOrig = "TEST_requestIdOrig";
private final String operationalEnvironmentId = "TEST_operationalEnvironmentId";
+ private final String vnfOperationalEnvironmentId = "VNF_operationalEnvironmentId";
private final CloudOrchestrationRequest request = new CloudOrchestrationRequest();
private final String workloadContext = "TEST_workloadContext";
private final String recoveryActionRetry = "RETRY";
@@ -81,6 +84,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
private final String statusOk = Status.DISTRIBUTION_COMPLETE_OK.toString();
private final String statusError = DistributionStatus.DISTRIBUTION_COMPLETE_ERROR.toString();
private final String statusSent = "SENT";
+ String json = "{\"operational-environment-status\" : \"INACTIVE\"}";
private final ObjectMapper mapper = new ObjectMapper();
@@ -96,6 +100,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountZero);
serviceModelDb.setServiceModelVersionDistrStatus(statusOk);
+ serviceModelDb.setVnfOperationalEnvId(vnfOperationalEnvironmentId);
serviceModelDb.setRequestId(requestIdOrig);
serviceModelDb.setServiceModelVersionId(serviceModelVersionId1);
@@ -104,6 +109,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountZero);
serviceModelDb.setServiceModelVersionDistrStatus(statusOk);
+ serviceModelDb.setVnfOperationalEnvId(vnfOperationalEnvironmentId);
InfraActiveRequests iar = new InfraActiveRequests();
iar.setRequestId(requestIdOrig);
@@ -134,6 +140,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountZero);
serviceModelDb.setServiceModelVersionDistrStatus(statusError);
+ serviceModelDb.setVnfOperationalEnvId(vnfOperationalEnvironmentId);
stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(serviceModelDb))
@@ -169,6 +176,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountTwo);
serviceModelDb.setServiceModelVersionDistrStatus(statusError);
+ serviceModelDb.setVnfOperationalEnvId(vnfOperationalEnvironmentId);
stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(serviceModelDb))
@@ -188,6 +196,8 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountThree);
serviceModelDb.setServiceModelVersionDistrStatus(statusSent);
+ serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
+ serviceModelDb.setVnfOperationalEnvId(vnfOperationalEnvironmentId);
OperationalEnvDistributionStatus distributionDb = new OperationalEnvDistributionStatus();
distributionDb.setDistributionId(sdcDistributionId);
@@ -221,7 +231,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
.withBody(mapper.writeValueAsString(iar))
.withStatus(HttpStatus.SC_OK)));
stubFor(post(urlPathEqualTo("/operationalEnvServiceModelStatus/"))
- .withRequestBody(equalTo("{\"requestId\":\"TEST_requestIdOrig\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"DISTRIBUTION_COMPLETE_OK\",\"recoveryAction\":\"RETRY\",\"retryCount\":0,\"workloadContext\":\"TEST_workloadContext\",\"createTime\":null,\"modifyTime\":null}"))
+ .withRequestBody(equalTo("{\"requestId\":\"TEST_requestIdOrig\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"DISTRIBUTION_COMPLETE_OK\",\"recoveryAction\":\"RETRY\",\"retryCount\":0,\"workloadContext\":\"TEST_workloadContext\",\"createTime\":null,\"modifyTime\":null,\"vnfOperationalEnvId\":\"VNF_operationalEnvironmentId\"}"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
@@ -229,7 +239,12 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
.withRequestBody(equalTo("{\"distributionId\":\"TEST_distributionId\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"requestId\":\"TEST_requestIdOrig\",\"distributionIdStatus\":\"DISTRIBUTION_COMPLETE_OK\",\"distributionIdErrorReason\":\"\",\"createTime\":null,\"modifyTime\":null}"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
-
+
+ stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(json).withStatus(HttpStatus.SC_ACCEPTED)));
+ stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED)));
+
activateVnfStatus.execute(requestId, request);
}
@@ -244,6 +259,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountThree);
serviceModelDb.setServiceModelVersionDistrStatus(statusError);
+ serviceModelDb.setVnfOperationalEnvId(vnfOperationalEnvironmentId);
stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(serviceModelDb))
@@ -294,10 +310,15 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
.withStatus(HttpStatus.SC_OK)));
stubFor(post(urlPathEqualTo("/operationalEnvServiceModelStatus/"))
- .withRequestBody(equalTo("{\"requestId\":\"TEST_requestIdOrig\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"SENT\",\"recoveryAction\":\"RETRY\",\"retryCount\":2,\"workloadContext\":\"TEST_workloadContext\",\"createTime\":null,\"modifyTime\":null}"))
+ .withRequestBody(equalTo("{\"requestId\":\"TEST_requestIdOrig\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"SENT\",\"recoveryAction\":\"RETRY\",\"retryCount\":2,\"workloadContext\":\"TEST_workloadContext\",\"createTime\":null,\"modifyTime\":null,\"vnfOperationalEnvId\":\"VNF_operationalEnvironmentId\"}"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
+ stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(json).withStatus(HttpStatus.SC_ACCEPTED)));
+ stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED)));
+
activateVnfStatus.execute(requestId, request);
}
@@ -312,6 +333,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountZero);
serviceModelDb.setServiceModelVersionDistrStatus(statusError);
+ serviceModelDb.setVnfOperationalEnvId(vnfOperationalEnvironmentId);
OperationalEnvDistributionStatus distributionDb = new OperationalEnvDistributionStatus();
distributionDb.setDistributionId(sdcDistributionId);
@@ -360,6 +382,11 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
+ stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(json).withStatus(HttpStatus.SC_ACCEPTED)));
+ stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED)));
+
try {
activateVnfStatus.execute(requestId, request);
}catch(ApiException e){
@@ -382,6 +409,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountThree);
serviceModelDb.setServiceModelVersionDistrStatus(statusError);
+ serviceModelDb.setVnfOperationalEnvId(vnfOperationalEnvironmentId);
OperationalEnvDistributionStatus distributionDb = new OperationalEnvDistributionStatus();
distributionDb.setDistributionId(sdcDistributionId);
@@ -391,8 +419,6 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
distributionDb.setServiceModelVersionId(serviceModelVersionId);
distributionDb.setDistributionIdErrorReason(null);
-
-
// prepare distribution obj
Distribution distribution = new Distribution();
distribution.setStatus(Status.DISTRIBUTION_COMPLETE_ERROR);
@@ -428,13 +454,18 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
.withBody(mapper.writeValueAsString(iar))
.withStatus(HttpStatus.SC_OK)));
stubFor(post(urlPathEqualTo("/infraActiveRequests/"))
- .withRequestBody(containing("operationalEnvId\":\"TEST_operationalEnvironmentId\""))
+ .withRequestBody(containing("operationalEnvId\":\"VNF_operationalEnvironmentId\""))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
stubFor(post(urlPathMatching("/sdc/v1/catalog/services/.*"))
.willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(jsonMessages.toString()).withStatus(HttpStatus.SC_CONFLICT)));
+ stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(json).withStatus(HttpStatus.SC_ACCEPTED)));
+ stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED)));
+
try {
activateVnfStatus.execute(requestId, request);
}catch(ApiException e){
@@ -455,6 +486,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountThree);
serviceModelDb.setServiceModelVersionDistrStatus(statusError);
+ serviceModelDb.setVnfOperationalEnvId(vnfOperationalEnvironmentId);
OperationalEnvDistributionStatus distributionDb = new OperationalEnvDistributionStatus();
distributionDb.setDistributionId(sdcDistributionId);
@@ -490,7 +522,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
.withBody(mapper.writeValueAsString(iar))
.withStatus(HttpStatus.SC_OK)));
stubFor(post(urlPathEqualTo("/operationalEnvServiceModelStatus/"))
- .withRequestBody(equalTo("{\"requestId\":\"TEST_requestIdOrig\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"DISTRIBUTION_COMPLETE_OK\",\"recoveryAction\":\"SKIP\",\"retryCount\":0,\"workloadContext\":\"TEST_workloadContext\",\"createTime\":null,\"modifyTime\":null}"))
+ .withRequestBody(equalTo("{\"requestId\":\"TEST_requestIdOrig\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"DISTRIBUTION_COMPLETE_OK\",\"recoveryAction\":\"SKIP\",\"retryCount\":0,\"workloadContext\":\"TEST_workloadContext\",\"createTime\":null,\"modifyTime\":null,\"vnfOperationalEnvId\":\"VNF_operationalEnvironmentId\"}"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
@@ -499,6 +531,11 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
+ stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(json).withStatus(HttpStatus.SC_ACCEPTED)));
+ stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED)));
+
activateVnfStatus.execute(requestId, request);
}
@@ -514,6 +551,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountThree);
serviceModelDb.setServiceModelVersionDistrStatus(statusError);
+ serviceModelDb.setVnfOperationalEnvId(vnfOperationalEnvironmentId);
OperationalEnvDistributionStatus distributionDb = new OperationalEnvDistributionStatus();
distributionDb.setDistributionId(sdcDistributionId);
@@ -558,6 +596,12 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
.withRequestBody(containing("{\"requestId\":\"TEST_requestIdOrig\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"DISTRIBUTION_COMPLETE_ERROR\""))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
+
+ stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(json).withStatus(HttpStatus.SC_ACCEPTED)));
+ stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED)));
+
try {
activateVnfStatus.execute(requestId, request);
}catch(ApiException e) {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java
index ce1dde835d..65ec5fade6 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java
@@ -40,8 +40,8 @@ import org.onap.so.apihandlerinfra.tenantisolationbeans.RequestInfo;
import org.onap.so.apihandlerinfra.tenantisolationbeans.RequestParameters;
import org.onap.so.client.aai.AAIVersion;
import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.springframework.beans.factory.annotation.Autowired;
import javax.ws.rs.core.HttpHeaders;
@@ -102,7 +102,7 @@ public class CreateEcompOperationalEnvironmentTest extends BaseTest{
.willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED)));
stubFor(post(urlPathMatching("/events/.*"))
.willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_NOT_FOUND)));
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.DataError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.DataError).build();
ValidateException expectedException = new ValidateException.Builder("Could not publish DMaap", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER)
.errorInfo(errorLoggerInfo).build();
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/vnfoperenv/activateOperationalEnvironmentWithRelationship.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/vnfoperenv/activateOperationalEnvironmentWithRelationship.json
new file mode 100644
index 0000000000..974a824467
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/vnfoperenv/activateOperationalEnvironmentWithRelationship.json
@@ -0,0 +1,27 @@
+{
+ "operational-environment-id": "1dfe7154-eae0-44f2-8e7a-8e5e7882e66d",
+ "operational-environment-name": "Test Managing ECOMP Environment",
+ "operational-environment-type": "ECOMP",
+ "operational-environment-status": "INACTIVE",
+ "tenant-context": "Test",
+ "workload-context": "PVT",
+ "resource-version": "1505228226913",
+ "relationship-list": {
+ "relationship": [{
+ "related-to": "operational-environment",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v13/cloud-infrastructure/operational-environments/operational-environment/1dfe7154-eae0-44f2-8e7a-8e5e7882e55d",
+ "relationship-data": [{
+ "relationship-key": "operational-environment.operational-environment-id",
+ "relationship-value": "1dfe7154-eae0-44f2-8e7a-8e5e7882e55d"
+ }
+ ],
+ "related-to-property": [{
+ "property-key": "operational-environment.operational-environment-name",
+ "property-value": "myOpEnv_IST_un577h_0119"
+ }
+ ]
+ }
+ ]
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/data.sql b/mso-api-handlers/mso-api-handler-infra/src/test/resources/data.sql
index f99f89653f..765b8cf75e 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/data.sql
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/data.sql
@@ -22,9 +22,9 @@ INSERT INTO requestdb.site_status(SITE_NAME, STATUS, CREATION_TIMESTAMP) VALUES
-INSERT INTO requestdb.activate_operational_env_service_model_distribution_status(OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID, SERVICE_MOD_VER_FINAL_DISTR_STATUS, RECOVERY_ACTION, RETRY_COUNT_LEFT, WORKLOAD_CONTEXT, CREATE_TIME, MODIFY_TIME) VALUES
- ('1dfe7154-eae0-44f2-8e7a-8e5e7882e55d', '37305814-4949-45ce-ae24-c378c7ed07d1', '483646fe-36cc-4e90-895a-c472f6da3f74', 'DISTRIBUTION_COMPLETE_OK', 'RETRY', 0, 'VNF_D2D', '2018-02-02 18:44:27', '2018-02-02 18:45:06'),
- ('1dfe7154-eae0-44f2-8e7a-8e5e7882e55d', '7bfa2197-8cbb-4080-b369-56c4d53c4573', '483646fe-36cc-4e90-895a-c472f6da3f74', 'DISTRIBUTION_COMPLETE_OK', 'SKIP', 0, 'VNF_D2D', '2018-02-02 18:44:27', '2018-02-02 18:44:56');
+INSERT INTO requestdb.activate_operational_env_service_model_distribution_status(OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID, SERVICE_MOD_VER_FINAL_DISTR_STATUS, RECOVERY_ACTION, RETRY_COUNT_LEFT, WORKLOAD_CONTEXT, CREATE_TIME, MODIFY_TIME, VNF_OPERATIONAL_ENV_ID) VALUES
+ ('1dfe7154-eae0-44f2-8e7a-8e5e7882e55d', '37305814-4949-45ce-ae24-c378c7ed07d1', '483646fe-36cc-4e90-895a-c472f6da3f74', 'DISTRIBUTION_COMPLETE_OK', 'RETRY', 0, 'VNF_D2D', '2018-02-02 18:44:27', '2018-02-02 18:45:06', 'vnf_1234'),
+ ('1dfe7154-eae0-44f2-8e7a-8e5e7882e55d', '7bfa2197-8cbb-4080-b369-56c4d53c4573', '483646fe-36cc-4e90-895a-c472f6da3f74', 'DISTRIBUTION_COMPLETE_OK', 'SKIP', 0, 'VNF_D2D', '2018-02-02 18:44:27', '2018-02-02 18:44:56', 'vnf_1235');
INSERT INTO requestdb.activate_operational_env_per_distributionid_status(DISTRIBUTION_ID, DISTRIBUTION_ID_STATUS, DISTRIBUTION_ID_ERROR_REASON, CREATE_TIME, MODIFY_TIME, OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID) VALUES
('TEST_distributionId', 'DISTRIBUTION_COMPLETE_OK', NULL, '2018-02-02 18:44:27', '2018-02-02 18:44:56', '1dfe7154-eae0-44f2-8e7a-8e5e7882e55d', '7bfa2197-8cbb-4080-b369-56c4d53c4573', '483646fe-36cc-4e90-895a-c472f6da3f74'),
@@ -276,12 +276,12 @@ VALUES
('vfModule', 'replaceInstance', '1', 'Gr api recipe to replace vf-module', '/mso/async/services/WorkflowActionBB', 180, 'GR-API-DEFAULT'),
('vfModule', 'deactivateAndCloudDelete', '1', 'Gr api recipe to deactivateAndCloudDelete vf-module', '/mso/async/services/WorkflowActionBB', 180, 'GR-API-DEFAULT'),
('vfModule', 'scaleOut', '1', 'Gr api recipe to scale out vfModule', '/mso/async/services/WorkflowActionBB', '180', 'GR-API-DEFAULT');
-INSERT INTO requestdb.activate_operational_env_service_model_distribution_status (OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID,SERVICE_MOD_VER_FINAL_DISTR_STATUS,RECOVERY_ACTION,RETRY_COUNT_LEFT,WORKLOAD_CONTEXT, CREATE_TIME, MODIFY_TIME)
+INSERT INTO requestdb.activate_operational_env_service_model_distribution_status (OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID,SERVICE_MOD_VER_FINAL_DISTR_STATUS,RECOVERY_ACTION,RETRY_COUNT_LEFT,WORKLOAD_CONTEXT, CREATE_TIME, MODIFY_TIME, VNF_OPERATIONAL_ENV_ID)
VALUES
-('1234', 'TEST1234', '00032ab7-3fb3-42e5-965d-8ea592502017', "Test", "Test", 1, 'DEFAULT', '2018-08-14 16:50:59', '2018-08-14 16:50:59');
-INSERT INTO requestdb.activate_operational_env_service_model_distribution_status (OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID,SERVICE_MOD_VER_FINAL_DISTR_STATUS,RECOVERY_ACTION,RETRY_COUNT_LEFT,WORKLOAD_CONTEXT, CREATE_TIME, MODIFY_TIME)
+('1234', 'TEST1234', '00032ab7-3fb3-42e5-965d-8ea592502017', "Test", "Test", 1, 'DEFAULT', '2018-08-14 16:50:59', '2018-08-14 16:50:59', 'vnf_1234');
+INSERT INTO requestdb.activate_operational_env_service_model_distribution_status (OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID,SERVICE_MOD_VER_FINAL_DISTR_STATUS,RECOVERY_ACTION,RETRY_COUNT_LEFT,WORKLOAD_CONTEXT, CREATE_TIME, MODIFY_TIME, VNF_OPERATIONAL_ENV_ID)
VALUES
-('1234', 'TEST1235', '00032ab7-3fb3-42e5-965d-8ea592502017', "Test", "Test", 2, 'DEFAULT', '2018-08-14 16:50:59', '2018-08-14 16:50:59');
+('1234', 'TEST1235', '00032ab7-3fb3-42e5-965d-8ea592502017', "Test", "Test", 2, 'DEFAULT', '2018-08-14 16:50:59', '2018-08-14 16:50:59', 'vnf_1234');
INSERT INTO requestdb.activate_operational_env_per_distributionid_status (DISTRIBUTION_ID, DISTRIBUTION_ID_STATUS, DISTRIBUTION_ID_ERROR_REASON, CREATE_TIME, MODIFY_TIME, OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID)
VALUES
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 5873e147bc..fddd7adbf4 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
@@ -980,6 +980,7 @@ CREATE TABLE `activate_operational_env_service_model_distribution_status` (
`WORKLOAD_CONTEXT` varchar(80) NOT NULL,
`CREATE_TIME` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`MODIFY_TIME` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
+ `VNF_OPERATIONAL_ENV_ID` varchar(45) NOT NULL,
PRIMARY KEY (`OPERATIONAL_ENV_ID`,`SERVICE_MODEL_VERSION_ID`,`REQUEST_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;