summaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-infra/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/main/java')
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java481
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2ERequest.java113
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/GetE2EServiceInstanceResponse.java39
3 files changed, 437 insertions, 196 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java
index 26fdba47c4..fb507a69cf 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java
@@ -40,6 +40,8 @@ import javax.ws.rs.core.UriInfo;
import org.apache.http.HttpStatus;
import org.codehaus.jackson.map.ObjectMapper;
import org.openecomp.mso.apihandler.common.ErrorNumbers;
+import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.E2ERequest;
+import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.GetE2EServiceInstanceResponse;
import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.GetOrchestrationListResponse;
import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.GetOrchestrationResponse;
import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.InstanceReferences;
@@ -57,18 +59,18 @@ import org.openecomp.mso.requestsdb.RequestsDatabase;
import com.wordnik.swagger.annotations.Api;
import com.wordnik.swagger.annotations.ApiOperation;
-@Path("/orchestrationRequests")
-@Api(value="/orchestrationRequests",description="API Requests for Orchestration requests")
+@Path("/")
+@Api(value = "/", description = "API Requests for Orchestration requests")
public class OrchestrationRequests {
- public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
+ public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH);
- private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger ();
+ private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger();
+
+ private RequestsDatabase requestsDB = RequestsDatabase.getInstance();
- private RequestsDatabase requestsDB = RequestsDatabase.getInstance();
-
/**
*
*/
@@ -77,66 +79,122 @@ public class OrchestrationRequests {
}
@GET
- @Path("/{version:[vV][2-5]}/{requestId}")
- @ApiOperation(value="Find Orchestrated Requests for a given requestId",response=Response.class)
+ @Path("orchestrationRequests/{version:[vV][2-5]}/{requestId}")
+ @ApiOperation(value = "Find Orchestrated Requests for a given requestId", response = Response.class)
@Produces(MediaType.APPLICATION_JSON)
- public Response getOrchestrationRequest(@PathParam("requestId") String requestId, @PathParam("version") String version) {
+ public Response getOrchestrationRequest(@PathParam("requestId") String requestId,
+ @PathParam("version") String version) {
GetOrchestrationResponse orchestrationResponse = new GetOrchestrationResponse();
- MsoRequest msoRequest = new MsoRequest (requestId);
+ MsoRequest msoRequest = new MsoRequest(requestId);
- long startTime = System.currentTimeMillis ();
+ long startTime = System.currentTimeMillis();
InfraActiveRequests requestDB = null;
- try {
- requestDB = requestsDB.getRequestFromInfraActive(requestId);
-
- } catch (Exception e) {
- msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communciate with Request DB - Infra Request Lookup", e);
- msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
- Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND,
- MsoException.ServiceException,
- e.getMessage (),
- ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB,
- null);
- alarmLogger.sendAlarm ("MsoDatabaseAccessError",
- MsoAlarmLogger.CRITICAL,
- Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB));
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while communciate with Request DB");
- msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
- return response;
-
- }
-
- if(requestDB == null) {
- Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NO_CONTENT,
- MsoException.ServiceException,
- "Orchestration RequestId " + requestId + " is not found in DB",
- ErrorNumbers.SVC_DETAILED_SERVICE_ERROR,
- null);
- msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Null response from RequestDB when searching by RequestId");
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, "Null response from RequestDB when searching by RequestId");
- msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ());
- return resp;
-
- }
-
- Request request = mapInfraActiveRequestToRequest(requestDB);
-
- orchestrationResponse.setRequest(request);
-
- return Response.status(200).entity(orchestrationResponse).build();
+ try {
+ requestDB = requestsDB.getRequestFromInfraActive(requestId);
+
+ } catch (Exception e) {
+ msoLogger.error(MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "",
+ MsoLogger.ErrorCode.AvailabilityError,
+ "Exception while communciate with Request DB - Infra Request Lookup", e);
+ msoRequest.setStatus(org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
+ MsoException.ServiceException, e.getMessage(), ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, null);
+ alarmLogger.sendAlarm("MsoDatabaseAccessError", MsoAlarmLogger.CRITICAL,
+ Messages.errors.get(ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB));
+ msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError,
+ "Exception while communciate with Request DB");
+ msoLogger.debug("End of the transaction, the final response is: " + (String) response.getEntity());
+ return response;
+
+ }
+
+ if (requestDB == null) {
+ Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NO_CONTENT,
+ MsoException.ServiceException, "Orchestration RequestId " + requestId + " is not found in DB",
+ ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, null);
+ msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "",
+ MsoLogger.ErrorCode.BusinessProcesssError,
+ "Null response from RequestDB when searching by RequestId");
+ msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound,
+ "Null response from RequestDB when searching by RequestId");
+ msoLogger.debug("End of the transaction, the final response is: " + (String) resp.getEntity());
+ return resp;
+
+ }
+
+ Request request = mapInfraActiveRequestToRequest(requestDB);
+
+ orchestrationResponse.setRequest(request);
+
+ return Response.status(200).entity(orchestrationResponse).build();
+ }
+
+ @GET
+ @Path("e2eServiceInstances/{version:[vV][3-5]}/{serviceId}/operations/{operationId}")
+ @ApiOperation(value = "Find e2eServiceInstances Requests for a given serviceId and operationId", response = Response.class)
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response getE2EServiceInstances(@PathParam("serviceId") String serviceId,
+ @PathParam("version") String version, @PathParam("operationId") String operationId) {
+
+ GetE2EServiceInstanceResponse e2eServiceResponse = new GetE2EServiceInstanceResponse();
+
+ MsoRequest msoRequest = new MsoRequest(serviceId);
+
+ long startTime = System.currentTimeMillis();
+
+ InfraActiveRequests requestDB = null;
+
+ try {
+ requestDB = requestsDB.getRequestFromInfraActive(serviceId);
+
+ } catch (Exception e) {
+ msoLogger.error(MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "",
+ MsoLogger.ErrorCode.AvailabilityError,
+ "Exception while communciate with Request DB - Infra Request Lookup", e);
+ msoRequest.setStatus(org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
+ MsoException.ServiceException, e.getMessage(), ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, null);
+ alarmLogger.sendAlarm("MsoDatabaseAccessError", MsoAlarmLogger.CRITICAL,
+ Messages.errors.get(ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB));
+ msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError,
+ "Exception while communciate with Request DB");
+ msoLogger.debug("End of the transaction, the final response is: " + (String) response.getEntity());
+ return response;
+
+ }
+
+ if (requestDB == null) {
+ Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NO_CONTENT,
+ MsoException.ServiceException, "E2E serviceId " + serviceId + " is not found in DB",
+ ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, null);
+ msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "",
+ MsoLogger.ErrorCode.BusinessProcesssError,
+ "Null response from RequestDB when searching by serviceId");
+ msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound,
+ "Null response from RequestDB when searching by serviceId");
+ msoLogger.debug("End of the transaction, the final response is: " + (String) resp.getEntity());
+ return resp;
+
+ }
+
+ E2ERequest e2erequest = mapInfraActiveRequestToE2ERequest(requestDB);
+
+ e2eServiceResponse.setE2eRequest(e2erequest);
+
+ return Response.status(200).entity(e2eServiceResponse).build();
}
@GET
- @Path("/{version:[vV][2-5]}")
- @ApiOperation(value="Find Orchestrated Requests for a URI Information",response=Response.class)
+ @Path("orchestrationRequests/{version:[vV][2-5]}")
+ @ApiOperation(value = "Find Orchestrated Requests for a URI Information", response = Response.class)
@Produces(MediaType.APPLICATION_JSON)
public Response getOrchestrationRequest(@Context UriInfo ui, @PathParam("version") String version) {
- long startTime = System.currentTimeMillis ();
+ long startTime = System.currentTimeMillis();
MsoRequest msoRequest = new MsoRequest();
@@ -146,8 +204,7 @@ public class OrchestrationRequests {
GetOrchestrationListResponse orchestrationList = null;
-
- try{
+ try {
Map<String, List<String>> orchestrationMap = msoRequest.getOrchestrationFilters(queryParams);
@@ -157,7 +214,7 @@ public class OrchestrationRequests {
List<RequestList> requestLists = new ArrayList<RequestList>();
- for(InfraActiveRequests infraActive : activeRequests){
+ for (InfraActiveRequests infraActive : activeRequests) {
Request request = mapInfraActiveRequestToRequest(infraActive);
RequestList requestList = new RequestList();
@@ -169,209 +226,241 @@ public class OrchestrationRequests {
orchestrationList.setRequestList(requestLists);
- }catch(Exception e){
- msoLogger.debug ("Get Orchestration Request with Filters Failed : ", e);
- Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR, MsoException.ServiceException,
- "Get Orchestration Request with Filters Failed. " + e.getMessage(),
- ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null);
- msoLogger.error (MessageEnum.APIH_GENERAL_EXCEPTION, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Get Orchestration Request with Filters Failed : " + e);
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataError, "Get Orchestration Request with Filters Failed");
- msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
- return response;
+ } catch (Exception e) {
+ msoLogger.debug("Get Orchestration Request with Filters Failed : ", e);
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR,
+ MsoException.ServiceException, "Get Orchestration Request with Filters Failed. " + e.getMessage(),
+ ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null);
+ msoLogger.error(MessageEnum.APIH_GENERAL_EXCEPTION, MSO_PROP_APIHANDLER_INFRA, "", "",
+ MsoLogger.ErrorCode.BusinessProcesssError, "Get Orchestration Request with Filters Failed : " + e);
+ msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataError,
+ "Get Orchestration Request with Filters Failed");
+ msoLogger.debug("End of the transaction, the final response is: " + (String) response.getEntity());
+ return response;
}
-
- return Response.status(200).entity(orchestrationList).build();
+ return Response.status(200).entity(orchestrationList).build();
}
-
@POST
@Path("/{version: [vV][3-5]}/{requestId}/unlock")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value="Unlock Orchestrated Requests for a given requestId",response=Response.class)
- public Response unlockOrchestrationRequest(String requestJSON, @PathParam("requestId") String requestId, @PathParam("version") String version) {
+ @ApiOperation(value = "Unlock Orchestrated Requests for a given requestId", response = Response.class)
+ public Response unlockOrchestrationRequest(String requestJSON, @PathParam("requestId") String requestId,
+ @PathParam("version") String version) {
- MsoRequest msoRequest = new MsoRequest (requestId);
+ MsoRequest msoRequest = new MsoRequest(requestId);
- long startTime = System.currentTimeMillis ();
- msoLogger.debug ("requestId is: " + requestId);
+ long startTime = System.currentTimeMillis();
+ msoLogger.debug("requestId is: " + requestId);
InfraActiveRequests requestDB = null;
Request request = null;
- msoLogger.debug ("requestId is: " + requestId);
+ msoLogger.debug("requestId is: " + requestId);
ServiceInstancesRequest sir = null;
- try{
+ try {
ObjectMapper mapper = new ObjectMapper();
sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
- } catch(Exception e){
- msoLogger.debug ("Mapping of request to JSON object failed : ", e);
- Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException,
- "Mapping of request to JSON object failed. " + e.getMessage(),
+ } catch (Exception e) {
+ msoLogger.debug("Mapping of request to JSON object failed : ", e);
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST,
+ MsoException.ServiceException, "Mapping of request to JSON object failed. " + e.getMessage(),
ErrorNumbers.SVC_BAD_PARAMETER, null);
- if (msoRequest.getRequestId () != null) {
- msoLogger.debug ("Mapping of request to JSON object failed");
+ if (msoRequest.getRequestId() != null) {
+ msoLogger.debug("Mapping of request to JSON object failed");
}
- msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, requestJSON, e);
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Mapping of request to JSON object failed");
- msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ msoLogger.error(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "",
+ MsoLogger.ErrorCode.SchemaError, requestJSON, e);
+ msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError,
+ "Mapping of request to JSON object failed");
+ msoLogger.debug("End of the transaction, the final response is: " + (String) response.getEntity());
return response;
}
-
- try{
+ try {
msoRequest.parseOrchestration(sir);
} catch (Exception e) {
- msoLogger.debug ("Validation failed: ", e);
- Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException,
- "Error parsing request. " + e.getMessage(),
+ msoLogger.debug("Validation failed: ", e);
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST,
+ MsoException.ServiceException, "Error parsing request. " + e.getMessage(),
ErrorNumbers.SVC_BAD_PARAMETER, null);
- if (msoRequest.getRequestId () != null) {
- msoLogger.debug ("Logging failed message to the database");
+ if (msoRequest.getRequestId() != null) {
+ msoLogger.debug("Logging failed message to the database");
}
- msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, requestJSON, e);
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Validation of the input request failed");
- msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ msoLogger.error(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "",
+ MsoLogger.ErrorCode.SchemaError, requestJSON, e);
+ msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError,
+ "Validation of the input request failed");
+ msoLogger.debug("End of the transaction, the final response is: " + (String) response.getEntity());
return response;
}
try {
requestDB = requestsDB.getRequestFromInfraActive(requestId);
- if(requestDB == null) {
- Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND,
- MsoException.ServiceException,
- "Orchestration RequestId " + requestId + " is not found in DB",
- ErrorNumbers.SVC_DETAILED_SERVICE_ERROR,
- null);
- msoLogger.error (MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Null response from RequestDB when searching by RequestId");
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, "Null response from RequestDB when searching by RequestId");
- msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ());
+ if (requestDB == null) {
+ Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
+ MsoException.ServiceException, "Orchestration RequestId " + requestId + " is not found in DB",
+ ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, null);
+ msoLogger.error(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MSO_PROP_APIHANDLER_INFRA, "", "",
+ MsoLogger.ErrorCode.BusinessProcesssError,
+ "Null response from RequestDB when searching by RequestId");
+ msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound,
+ "Null response from RequestDB when searching by RequestId");
+ msoLogger.debug("End of the transaction, the final response is: " + (String) resp.getEntity());
return resp;
- }else{
+ } else {
request = mapInfraActiveRequestToRequest(requestDB);
RequestStatus reqStatus = request.getRequestStatus();
Status status = Status.valueOf(reqStatus.getRequestState());
- if(status == Status.IN_PROGRESS || status == Status.PENDING){
- msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.UNLOCKED);
- reqStatus.setRequestState(Status.UNLOCKED.toString ());
- requestsDB.updateInfraStatus (requestId,
- Status.UNLOCKED.toString (),
+ if (status == Status.IN_PROGRESS || status == Status.PENDING) {
+ msoRequest.setStatus(org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.UNLOCKED);
+ reqStatus.setRequestState(Status.UNLOCKED.toString());
+ requestsDB.updateInfraStatus(requestId, Status.UNLOCKED.toString(),
Constants.MODIFIED_BY_APIHANDLER);
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "RequestId " + requestId + " has been unlocked");
-
- }else{
- Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_BAD_REQUEST,
- MsoException.ServiceException,
- "Orchestration RequestId " + requestId + " has a status of " + status + " and can not be unlocked",
- ErrorNumbers.SVC_DETAILED_SERVICE_ERROR,
- null);
- msoLogger.error (MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "Orchestration RequestId " + requestId + " has a status of " + status + " and can not be unlocked");
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataError, "Orchestration RequestId " + requestId + " has a status of " + status + " and can not be unlocked");
- msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ());
+ msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
+ "RequestId " + requestId + " has been unlocked");
+
+ } else {
+ Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST,
+ MsoException.ServiceException, "Orchestration RequestId " + requestId + " has a status of "
+ + status + " and can not be unlocked",
+ ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, null);
+ msoLogger.error(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MSO_PROP_APIHANDLER_INFRA, "", "",
+ MsoLogger.ErrorCode.DataError, "Orchestration RequestId " + requestId + " has a status of "
+ + status + " and can not be unlocked");
+ msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataError,
+ "Orchestration RequestId " + requestId + " has a status of " + status
+ + " and can not be unlocked");
+ msoLogger.debug("End of the transaction, the final response is: " + (String) resp.getEntity());
return resp;
}
}
} catch (Exception e) {
- msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communciate with Request DB - Infra Request Lookup", e);
- msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
- Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND,
- MsoException.ServiceException,
- e.getMessage (),
- ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB,
- null);
- alarmLogger.sendAlarm ("MsoDatabaseAccessError",
- MsoAlarmLogger.CRITICAL,
- Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB));
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while communciate with Request DB");
- msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ msoLogger.error(MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "",
+ MsoLogger.ErrorCode.AvailabilityError,
+ "Exception while communciate with Request DB - Infra Request Lookup", e);
+ msoRequest.setStatus(org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
+ MsoException.ServiceException, e.getMessage(), ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, null);
+ alarmLogger.sendAlarm("MsoDatabaseAccessError", MsoAlarmLogger.CRITICAL,
+ Messages.errors.get(ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB));
+ msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError,
+ "Exception while communciate with Request DB");
+ msoLogger.debug("End of the transaction, the final response is: " + (String) response.getEntity());
return response;
}
- return Response.status (HttpStatus.SC_NO_CONTENT).entity ("").build ();
+ return Response.status(HttpStatus.SC_NO_CONTENT).entity("").build();
}
- private Request mapInfraActiveRequestToRequest(InfraActiveRequests requestDB) {
-
-
- Request request = new Request();
-
- ObjectMapper mapper = new ObjectMapper();
- // mapper.configure(Feature.WRAP_ROOT_VALUE, true);
-
- request.setRequestId(requestDB.getRequestId());
- request.setRequestScope(requestDB.getRequestScope());
- request.setRequestType(requestDB.getRequestAction());
-
- InstanceReferences ir = new InstanceReferences();
- if(requestDB.getNetworkId() != null)
- ir.setNetworkInstanceId(requestDB.getNetworkId());
- if(requestDB.getNetworkName() != null)
- ir.setNetworkInstanceName(requestDB.getNetworkName());
- if(requestDB.getServiceInstanceId() != null)
- ir.setServiceInstanceId(requestDB.getServiceInstanceId());
- if(requestDB.getServiceInstanceName() != null)
- ir.setServiceInstanceName(requestDB.getServiceInstanceName());
- if(requestDB.getVfModuleId() != null)
- ir.setVfModuleInstanceId(requestDB.getVfModuleId());
- if(requestDB.getVfModuleName() != null)
- ir.setVfModuleInstanceName(requestDB.getVfModuleName());
- if(requestDB.getVnfId() != null)
- ir.setVnfInstanceId(requestDB.getVnfId());
- if(requestDB.getVnfName() != null)
- ir.setVnfInstanceName(requestDB.getVnfName());
- if(requestDB.getVolumeGroupId() != null)
- ir.setVolumeGroupInstanceId(requestDB.getVolumeGroupId());
- if(requestDB.getVolumeGroupName() != null)
- ir.setVolumeGroupInstanceName(requestDB.getVolumeGroupName());
- if(requestDB.getRequestorId() != null)
+ private Request mapInfraActiveRequestToRequest(InfraActiveRequests requestDB) {
+
+ Request request = new Request();
+
+ ObjectMapper mapper = new ObjectMapper();
+ // mapper.configure(Feature.WRAP_ROOT_VALUE, true);
+
+ request.setRequestId(requestDB.getRequestId());
+ request.setRequestScope(requestDB.getRequestScope());
+ request.setRequestType(requestDB.getRequestAction());
+
+ InstanceReferences ir = new InstanceReferences();
+ if (requestDB.getNetworkId() != null)
+ ir.setNetworkInstanceId(requestDB.getNetworkId());
+ if (requestDB.getNetworkName() != null)
+ ir.setNetworkInstanceName(requestDB.getNetworkName());
+ if (requestDB.getServiceInstanceId() != null)
+ ir.setServiceInstanceId(requestDB.getServiceInstanceId());
+ if (requestDB.getServiceInstanceName() != null)
+ ir.setServiceInstanceName(requestDB.getServiceInstanceName());
+ if (requestDB.getVfModuleId() != null)
+ ir.setVfModuleInstanceId(requestDB.getVfModuleId());
+ if (requestDB.getVfModuleName() != null)
+ ir.setVfModuleInstanceName(requestDB.getVfModuleName());
+ if (requestDB.getVnfId() != null)
+ ir.setVnfInstanceId(requestDB.getVnfId());
+ if (requestDB.getVnfName() != null)
+ ir.setVnfInstanceName(requestDB.getVnfName());
+ if (requestDB.getVolumeGroupId() != null)
+ ir.setVolumeGroupInstanceId(requestDB.getVolumeGroupId());
+ if (requestDB.getVolumeGroupName() != null)
+ ir.setVolumeGroupInstanceName(requestDB.getVolumeGroupName());
+ if (requestDB.getRequestorId() != null)
ir.setRequestorId(requestDB.getRequestorId());
-
request.setInstanceReferences(ir);
- String requestBody = requestDB.getRequestBody();
+ String requestBody = requestDB.getRequestBody();
- RequestDetails requestDetails = null;
+ RequestDetails requestDetails = null;
- try{
- requestDetails = mapper.readValue(requestBody, RequestDetails.class);
+ try {
+ requestDetails = mapper.readValue(requestBody, RequestDetails.class);
- }catch(Exception e){
- msoLogger.debug("Exception caught mapping requestBody to RequestDetails",e);
- }
+ } catch (Exception e) {
+ msoLogger.debug("Exception caught mapping requestBody to RequestDetails", e);
+ }
- request.setRequestDetails(requestDetails);
- String startTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(requestDB.getStartTime()) + " GMT";
- request.setStartTime(startTimeStamp);
+ request.setRequestDetails(requestDetails);
+ String startTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(requestDB.getStartTime())
+ + " GMT";
+ request.setStartTime(startTimeStamp);
- RequestStatus status = new RequestStatus();
- if(requestDB.getStatusMessage() != null){
- status.setStatusMessage(requestDB.getStatusMessage());
- }
+ RequestStatus status = new RequestStatus();
+ if (requestDB.getStatusMessage() != null) {
+ status.setStatusMessage(requestDB.getStatusMessage());
+ }
- if(requestDB.getEndTime() != null){
- String endTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(requestDB.getEndTime()) + " GMT";
- status.setFinishTime(endTimeStamp);
- }
+ if (requestDB.getEndTime() != null) {
+ String endTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(requestDB.getEndTime())
+ + " GMT";
+ status.setFinishTime(endTimeStamp);
+ }
+ if (requestDB.getRequestStatus() != null) {
+ status.setRequestState(requestDB.getRequestStatus());
+ }
- if(requestDB.getRequestStatus() != null){
- status.setRequestState(requestDB.getRequestStatus());
- }
+ if (requestDB.getProgress() != null) {
+ status.setPercentProgress(requestDB.getProgress().intValue());
+ }
- if(requestDB.getProgress() != null){
- status.setPercentProgress(requestDB.getProgress().intValue());
- }
+ request.setRequestStatus(status);
- request.setRequestStatus(status);
+ return request;
+ }
- return request;
- }
- }
+ private E2ERequest mapInfraActiveRequestToE2ERequest(InfraActiveRequests requestDB) {
+
+ E2ERequest e2erequest = new E2ERequest();
+
+ e2erequest.setOperationId(requestDB.getRequestId());
+ // e2erequest.setRequestScope(requestDB.getRequestScope());
+ e2erequest.setOperation(requestDB.getRequestAction());
+ e2erequest.setResult(requestDB.getRequestStatus());
+ e2erequest.setReason(requestDB.getStatusMessage());
+ e2erequest.setUserId(requestDB.getRequestorId());
+ e2erequest.setOperationContent(requestDB.getStatusMessage());
+ e2erequest.setProgress(requestDB.getProgress());
+
+ String startTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(requestDB.getStartTime())
+ + " GMT";
+ e2erequest.setOperateAt(startTimeStamp);
+
+ if (requestDB.getEndTime() != null) {
+ String endTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(requestDB.getEndTime())
+ + " GMT";
+ e2erequest.setFinishedAt(endTimeStamp);
+ }
+
+ return e2erequest;
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2ERequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2ERequest.java
new file mode 100644
index 0000000000..e7ff2f611d
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2ERequest.java
@@ -0,0 +1,113 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans;
+
+import java.sql.Timestamp;
+
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+@JsonSerialize(include = JsonSerialize.Inclusion.NON_DEFAULT)
+public class E2ERequest {
+
+ protected String operationId;
+ protected String operation;
+ protected String result;
+ protected String reason;
+ protected String userId;
+ protected String operationContent;
+ protected long progress;
+ protected String operateAt;
+ protected String finishedAt;
+
+ public String getOperationId() {
+ return operationId;
+ }
+
+ public void setOperationId(String operationId) {
+ this.operationId = operationId;
+ }
+
+ public String getOperation() {
+ return operation;
+ }
+
+ public void setOperation(String operation) {
+ this.operation = operation;
+ }
+
+ public String getResult() {
+ return result;
+ }
+
+ public void setResult(String result) {
+ this.result = result;
+ }
+
+ public String getReason() {
+ return reason;
+ }
+
+ public void setReason(String reason) {
+ this.reason = reason;
+ }
+
+ public String getUserId() {
+ return userId;
+ }
+
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
+
+ public String getOperationContent() {
+ return operationContent;
+ }
+
+ public void setOperationContent(String operationContent) {
+ this.operationContent = operationContent;
+ }
+
+ public long getProgress() {
+ return progress;
+ }
+
+ public void setProgress(long progress) {
+ this.progress = progress;
+ }
+
+ public String getOperateAt() {
+ return operateAt;
+ }
+
+ public void setOperateAt(String operateAt) {
+ this.operateAt = operateAt;
+ }
+
+ public String getFinishedAt() {
+ return finishedAt;
+ }
+
+ public void setFinishedAt(String finishedAt) {
+ this.finishedAt = finishedAt;
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/GetE2EServiceInstanceResponse.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/GetE2EServiceInstanceResponse.java
new file mode 100644
index 0000000000..8145afca6d
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/GetE2EServiceInstanceResponse.java
@@ -0,0 +1,39 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans;
+
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
+public class GetE2EServiceInstanceResponse {
+
+ protected E2ERequest e2eRequest;
+
+ public E2ERequest getE2eRequest() {
+ return e2eRequest;
+ }
+
+ public void setE2eRequest(E2ERequest e2eRequest) {
+ this.e2eRequest = e2eRequest;
+ }
+
+}