diff options
40 files changed, 929 insertions, 557 deletions
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcAdapterRest.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcAdapterRest.java index ef3c1b79ca..48da1aba71 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcAdapterRest.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcAdapterRest.java @@ -35,6 +35,7 @@ import org.openecomp.mso.adapters.vfc.model.NsOperationKey; import org.openecomp.mso.adapters.vfc.model.RestfulResponse; import org.openecomp.mso.adapters.vfc.util.JsonUtil; import org.openecomp.mso.adapters.vfc.util.ValidateUtil; +import org.openecomp.mso.logger.MessageEnum; import org.openecomp.mso.logger.MsoLogger; /** @@ -70,7 +71,7 @@ public class VfcAdapterRest { public Response createNfvoNs(String data) { try { ValidateUtil.assertObjectNotNull(data); - LOGGER.debug("body from request is {}" + data); + LOGGER.info(MessageEnum.RA_NS_EXC, "Create NS Request Received.Body from request is :\n" + data, "org.openecomp.mso.adapters.vfc.VfcAdapterRest", "VFC Adapter"); NSResourceInputParameter nsInput = JsonUtil.unMarshal(data, NSResourceInputParameter.class); RestfulResponse rsp = driverMgr.createNs(nsInput); return buildResponse(rsp); @@ -95,7 +96,7 @@ public class VfcAdapterRest { try { ValidateUtil.assertObjectNotNull(data); - LOGGER.debug("body from request is {}" + data); + LOGGER.info(MessageEnum.RA_NS_EXC, "Delete NS Request Received.Body from request is :\n" + data, "org.openecomp.mso.adapters.vfc.VfcAdapterRest", "VFC Adapter"); NsOperationKey nsOperationKey = JsonUtil.unMarshal(data, NsOperationKey.class); RestfulResponse rsp = driverMgr.deleteNs(nsOperationKey, nsInstanceId); return buildResponse(rsp); @@ -120,7 +121,7 @@ public class VfcAdapterRest { public Response queryNfvoJobStatus(String data, @PathParam("jobId") String jobId) { try { ValidateUtil.assertObjectNotNull(data); - LOGGER.debug("body from request is {}" + data); + LOGGER.info(MessageEnum.RA_NS_EXC, "Query Job Request Received.Body from request is :\n" + data, "org.openecomp.mso.adapters.vfc.VfcAdapterRest", "VFC Adapter"); NsOperationKey nsOperationKey = JsonUtil.unMarshal(data, NsOperationKey.class); RestfulResponse rsp = driverMgr.getNsProgress(nsOperationKey, jobId); return buildResponse(rsp); @@ -145,7 +146,7 @@ public class VfcAdapterRest { public Response instantiateNfvoNs(String data, @PathParam("nsInstanceId") String nsInstanceId) { try { ValidateUtil.assertObjectNotNull(data); - LOGGER.debug("body from request is {}" + data); + LOGGER.info(MessageEnum.RA_NS_EXC, "Instantiate Ns Request Received.Body from request is :\n" + data, "org.openecomp.mso.adapters.vfc.VfcAdapterRest", "VFC Adapter"); NSResourceInputParameter nsInput = JsonUtil.unMarshal(data, NSResourceInputParameter.class); RestfulResponse rsp = driverMgr.instantiateNs(nsInstanceId, nsInput); return buildResponse(rsp); @@ -170,7 +171,7 @@ public class VfcAdapterRest { public Response terminateNfvoNs(String data, @PathParam("nsInstanceId") String nsInstanceId) { try { ValidateUtil.assertObjectNotNull(data); - LOGGER.debug("body from request is {}" + data); + LOGGER.info(MessageEnum.RA_NS_EXC, "Terminate Ns Request Received.Body from request is :\n" + data, "org.openecomp.mso.adapters.vfc.VfcAdapterRest", "VFC Adapter"); NsOperationKey nsOperationKey = JsonUtil.unMarshal(data, NsOperationKey.class); RestfulResponse rsp = driverMgr.terminateNs(nsOperationKey, nsInstanceId); return buildResponse(rsp); diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcManager.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcManager.java index 35c8eade0c..8d820bcf01 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcManager.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcManager.java @@ -40,11 +40,11 @@ import org.openecomp.mso.adapters.vfc.model.RestfulResponse; import org.openecomp.mso.adapters.vfc.util.JsonUtil; import org.openecomp.mso.adapters.vfc.util.RestfulUtil; import org.openecomp.mso.adapters.vfc.util.ValidateUtil; +import org.openecomp.mso.logger.MessageEnum; +import org.openecomp.mso.logger.MsoLogger; import org.openecomp.mso.requestsdb.RequestsDatabase; import org.openecomp.mso.requestsdb.RequestsDbConstant; import org.openecomp.mso.requestsdb.ResourceOperationStatus; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; /** * VF-C Manager <br> @@ -56,355 +56,355 @@ import org.slf4j.LoggerFactory; */ public class VfcManager { - private static final Logger LOGGER = LoggerFactory.getLogger(VfcManager.class); - - /** - * nfvo url map - */ - private static Map<String, String> nfvoUrlMap; - - static { - nfvoUrlMap = new HashMap<>(); - nfvoUrlMap.put(Step.CREATE, CommonConstant.NFVO_CREATE_URL); - nfvoUrlMap.put(Step.INSTANTIATE, CommonConstant.NFVO_INSTANTIATE_URL); - nfvoUrlMap.put(Step.TERMINATE, CommonConstant.NFVO_TERMINATE_URL); - nfvoUrlMap.put(Step.DELETE, CommonConstant.NFVO_DELETE_URL); - nfvoUrlMap.put(Step.QUERY, CommonConstant.NFVO_QUERY_URL); - } - - public VfcManager() { - - } - - /** - * create network service <br> - * - * @param segInput input parameters for current node from http request - * @return - * @since ONAP Amsterdam Release - */ - public RestfulResponse createNs(NSResourceInputParameter segInput) throws ApplicationException { - - // Step1: get service template by node type - String csarId = segInput.getNsOperationKey().getNodeTemplateUUID(); - // nsdId for NFVO is "id" in the response, while for SDNO is "servcice template id" - LOGGER.info("serviceTemplateId is {}, id is {}", csarId); - - LOGGER.info("create ns -> begin"); - // Step2: Prepare url and method type - String url = getUrl(null, CommonConstant.Step.CREATE); - String methodType = CommonConstant.MethodType.POST; - - // Step3: Prepare restful parameters and options - NsCreateReq oRequest = new NsCreateReq(); - oRequest.setCsarId(csarId); - oRequest.setNsName(segInput.getNsServiceName()); - oRequest.setDescription(segInput.getNsServiceDescription()); - CustomerModel context = new CustomerModel(); - context.setGlobalCustomerId(segInput.getNsOperationKey().getGlobalSubscriberId()); - context.setServiceType(segInput.getNsOperationKey().getServiceType()); - oRequest.setContext(context); - String createReq = JsonUtil.marshal(oRequest); - - // Step4: Call NFVO or SDNO lcm to create ns - RestfulResponse createRsp = RestfulUtil.send(url, methodType, createReq); - ValidateUtil.assertObjectNotNull(createRsp); - LOGGER.info("create ns response status is : {}", createRsp.getStatus()); - LOGGER.info("create ns response content is : {}", createRsp.getResponseContent()); - - // Step 5: save resource operation information - ResourceOperationStatus nsOperInfo = (RequestsDatabase.getInstance()) - .getResourceOperationStatus(segInput.getNsOperationKey().getServiceId(), - segInput.getNsOperationKey().getOperationId(), - segInput.getNsOperationKey().getNodeTemplateUUID()); - nsOperInfo.setStatus(RequestsDbConstant.Status.PROCESSING); - (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo); - - if (!HttpCode.isSucess(createRsp.getStatus())) { - LOGGER.error("update segment operation status : fail to create ns"); - nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR); - nsOperInfo.setErrorCode(String.valueOf(createRsp.getStatus())); - (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo); - throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, - DriverExceptionID.FAIL_TO_CREATE_NS); - } - @SuppressWarnings("unchecked") - Map<String, String> rsp = JsonUtil.unMarshal(createRsp.getResponseContent(), Map.class); - String nsInstanceId = rsp.get(CommonConstant.NS_INSTANCE_ID); - if (ValidateUtil.isStrEmpty(nsInstanceId)) { - LOGGER.error("Invalid instanceId from create operation"); - throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, - DriverExceptionID.INVALID_RESPONSEE_FROM_CREATE_OPERATION); + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); + + /** + * nfvo url map + */ + private static Map<String, String> nfvoUrlMap; + + static { + nfvoUrlMap = new HashMap<>(); + nfvoUrlMap.put(Step.CREATE, CommonConstant.NFVO_CREATE_URL); + nfvoUrlMap.put(Step.INSTANTIATE, CommonConstant.NFVO_INSTANTIATE_URL); + nfvoUrlMap.put(Step.TERMINATE, CommonConstant.NFVO_TERMINATE_URL); + nfvoUrlMap.put(Step.DELETE, CommonConstant.NFVO_DELETE_URL); + nfvoUrlMap.put(Step.QUERY, CommonConstant.NFVO_QUERY_URL); } - LOGGER.info("create ns -> end"); - - return createRsp; - } - - /** - * delete network service <br> - * - * @param nsOperationKey The operation key of the NS resource - * @param nsInstanceId The NS instance id - * @return - * @since ONAP Amsterdam Release - */ - public RestfulResponse deleteNs(NsOperationKey nsOperationKey, String nsInstanceId) - throws ApplicationException { - LOGGER.info("delete ns -> begin"); - // Step1: prepare url and methodType - String url = getUrl(nsInstanceId, CommonConstant.Step.DELETE); - String methodType = CommonConstant.MethodType.DELETE; - - // Step2: prepare restful parameters and options - RestfulResponse deleteRsp = RestfulUtil.send(url, methodType, ""); - ValidateUtil.assertObjectNotNull(deleteRsp); - LOGGER.info("delete ns response status is : {}", deleteRsp.getStatus()); - LOGGER.info("delete ns response content is : {}", deleteRsp.getResponseContent()); - LOGGER.info("delete ns -> end"); - ResourceOperationStatus nsOperInfo = - (RequestsDatabase.getInstance()).getResourceOperationStatus(nsOperationKey.getServiceId(), - nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateUUID()); - if (!HttpCode.isSucess(deleteRsp.getStatus())) { - LOGGER.error("fail to delete ns"); - - nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR); - nsOperInfo.setErrorCode(String.valueOf(deleteRsp.getStatus())); - nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.TERMINATE_NS_FAILED); - (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo); - throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, - DriverExceptionID.FAIL_TO_DELETE_NS); + + public VfcManager() { + } - // Step4: update service segment operation status - nsOperInfo.setStatus(RequestsDbConstant.Status.FINISHED); - nsOperInfo.setErrorCode(String.valueOf(deleteRsp.getStatus())); - (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo); - LOGGER.info("update segment operaton status for delete -> end"); - - return deleteRsp; - - } - - /** - * instantiate network service <br> - * - * @param nsInstanceId The NS instance id - * @param segInput input parameters for current node from http request - * @return - * @since ONAP Amsterdam Release - */ - public RestfulResponse instantiateNs(String nsInstanceId, NSResourceInputParameter segInput) - throws ApplicationException { - // Call the NFVO or SDNO service to instantiate service - LOGGER.info("instantiate ns -> begin"); - - // Step1: Prepare restful parameters and options - NsInstantiateReq oRequest = new NsInstantiateReq(); - oRequest.setNsInstanceId(nsInstanceId); - NsParameters nsParameters = segInput.getNsParameters(); - oRequest.setLocationConstraints(nsParameters.getLocationConstraints()); - oRequest.setAdditionalParamForNs(nsParameters.getAdditionalParamForNs()); - String instReq = JsonUtil.marshal(oRequest); - // Step2: prepare url and - String url = getUrl(nsInstanceId, CommonConstant.Step.INSTANTIATE); - String methodType = CommonConstant.MethodType.POST; - - RestfulResponse instRsp = RestfulUtil.send(url, methodType, instReq); - ResourceOperationStatus nsOperInfo = (RequestsDatabase.getInstance()) - .getResourceOperationStatus(segInput.getNsOperationKey().getServiceId(), - segInput.getNsOperationKey().getOperationId(), + /** + * create network service <br> + * + * @param segInput input parameters for current node from http request + * @return + * @since ONAP Amsterdam Release + */ + public RestfulResponse createNs(NSResourceInputParameter segInput) throws ApplicationException { + + // Step1: get service template by node type + String csarId = segInput.getNsOperationKey().getNodeTemplateUUID(); + // nsdId for NFVO is "id" in the response, while for SDNO is "servcice template id" + logInfoMsg("serviceTemplateId is , id is " + csarId); + logInfoMsg("create ns -> begin"); + // Step2: Prepare url and method type + String url = getUrl(null, CommonConstant.Step.CREATE); + String methodType = CommonConstant.MethodType.POST; + + // Step3: Prepare restful parameters and options + NsCreateReq oRequest = new NsCreateReq(); + oRequest.setCsarId(csarId); + oRequest.setNsName(segInput.getNsServiceName()); + oRequest.setDescription(segInput.getNsServiceDescription()); + CustomerModel context = new CustomerModel(); + context.setGlobalCustomerId(segInput.getNsOperationKey().getGlobalSubscriberId()); + context.setServiceType(segInput.getNsOperationKey().getServiceType()); + oRequest.setContext(context); + String createReq = JsonUtil.marshal(oRequest); + logInfoMsg("create ns request: \n" + createReq); + // Step4: Call NFVO or SDNO lcm to create ns + RestfulResponse createRsp = RestfulUtil.send(url, methodType, createReq); + ValidateUtil.assertObjectNotNull(createRsp); + logInfoMsg("create ns response status is : " + createRsp.getStatus()); + logInfoMsg("create ns response content is : " + createRsp.getResponseContent()); + + // Step 5: save resource operation information + ResourceOperationStatus nsOperInfo = (RequestsDatabase.getInstance()).getResourceOperationStatus( + segInput.getNsOperationKey().getServiceId(), segInput.getNsOperationKey().getOperationId(), segInput.getNsOperationKey().getNodeTemplateUUID()); - ValidateUtil.assertObjectNotNull(instRsp); - if (!HttpCode.isSucess(instRsp.getStatus())) { - LOGGER.error("update segment operation status : fail to instantiate ns"); - nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR); - nsOperInfo.setErrorCode(String.valueOf(instRsp.getStatus())); - nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.INSTANTIATE_NS_FAILED); + nsOperInfo.setStatus(RequestsDbConstant.Status.PROCESSING); (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo); - throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, - DriverExceptionID.FAIL_TO_INSTANTIATE_NS); - } - LOGGER.info("instantiate ns response status is : {}", instRsp.getStatus()); - LOGGER.info("instantiate ns response content is : {}", instRsp.getResponseContent()); - ValidateUtil.assertObjectNotNull(instRsp.getResponseContent()); - @SuppressWarnings("unchecked") - Map<String, String> rsp = JsonUtil.unMarshal(instRsp.getResponseContent(), Map.class); - String jobId = rsp.get(CommonConstant.JOB_ID); - if (ValidateUtil.isStrEmpty(jobId)) { - LOGGER.error("Invalid jobId from instantiate operation"); - nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR); - nsOperInfo.setErrorCode(String.valueOf(instRsp.getStatus())); - nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.INSTANTIATE_NS_FAILED); - (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo); - throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, - DriverExceptionID.INVALID_RESPONSE_FROM_INSTANTIATE_OPERATION); - } - LOGGER.info("instantiate ns -> end"); - // Step 3: update segment operation job id - LOGGER.info("update resource operation status job id -> begin"); - nsOperInfo.setJobId(jobId); - (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo); - LOGGER.info("update segment operation job id -> end"); - - return instRsp; - } - - /** - * terminate network service <br> - * - * @param nsOperationKey The operation key for NS resource - * @param nsInstanceId The NS instance id - * @return - * @since ONAP Amsterdam Release - */ - public RestfulResponse terminateNs(NsOperationKey nsOperationKey, String nsInstanceId) - throws ApplicationException { - // Step1: save segment operation info for delete process - LOGGER.info("save segment operation for delete process"); - ResourceOperationStatus nsOperInfo = - (RequestsDatabase.getInstance()).getResourceOperationStatus(nsOperationKey.getServiceId(), - nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateUUID()); - nsOperInfo.setStatus(RequestsDbConstant.Status.PROCESSING); - (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo); - - LOGGER.info("terminate ns -> begin"); - // Step2: prepare url and method type - String url = getUrl(nsInstanceId, CommonConstant.Step.TERMINATE); - String methodType = CommonConstant.MethodType.POST; - - // Step3: prepare restful parameters and options - Map<String, String> reqBody = new HashMap<>(); - reqBody.put("nsInstanceId", nsInstanceId); - reqBody.put("terminationType", "graceful"); - reqBody.put("gracefulTerminationTimeout", "60"); - - // Step4: Call the NFVO or SDNO service to terminate service - RestfulResponse terminateRsp = RestfulUtil.send(url, methodType, JsonUtil.marshal(reqBody)); - ValidateUtil.assertObjectNotNull(terminateRsp); - LOGGER.info("terminate ns response status is : {}", terminateRsp.getStatus()); - LOGGER.info("terminate ns response content is : {}", terminateRsp.getResponseContent()); - // Step 3: update segment operation - if (!HttpCode.isSucess(terminateRsp.getStatus())) { - LOGGER.error("fail to instantiate ns"); - nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR); - nsOperInfo.setErrorCode(String.valueOf(terminateRsp.getStatus())); - nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.TERMINATE_NS_FAILED); - (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo); - - throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, - DriverExceptionID.FAIL_TO_TERMINATE_NS); + + if(!HttpCode.isSucess(createRsp.getStatus())) { + logInfoMsg("update segment operation status : fail to create ns"); + nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR); + nsOperInfo.setErrorCode(String.valueOf(createRsp.getStatus())); + (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo); + throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_CREATE_NS); + } + @SuppressWarnings("unchecked") + Map<String, String> rsp = JsonUtil.unMarshal(createRsp.getResponseContent(), Map.class); + String nsInstanceId = rsp.get(CommonConstant.NS_INSTANCE_ID); + if(ValidateUtil.isStrEmpty(nsInstanceId)) { + logInfoMsg("Invalid instanceId from create operation"); + throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, + DriverExceptionID.INVALID_RESPONSEE_FROM_CREATE_OPERATION); + } + logInfoMsg("create ns -> end"); + return createRsp; } - @SuppressWarnings("unchecked") - Map<String, String> rsp = JsonUtil.unMarshal(terminateRsp.getResponseContent(), Map.class); - String jobId = rsp.get(CommonConstant.JOB_ID); - if (ValidateUtil.isStrEmpty(jobId)) { - LOGGER.error("Invalid jobId from terminate operation"); - nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR); - nsOperInfo.setErrorCode(String.valueOf(terminateRsp.getStatus())); - nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.TERMINATE_NS_FAILED); - (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo); - throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, - DriverExceptionID.INVALID_RESPONSE_FROM_TERMINATE_OPERATION); + + /** + * delete network service <br> + * + * @param nsOperationKey The operation key of the NS resource + * @param nsInstanceId The NS instance id + * @return + * @since ONAP Amsterdam Release + */ + public RestfulResponse deleteNs(NsOperationKey nsOperationKey, String nsInstanceId) throws ApplicationException { + + logInfoMsg("delete ns -> begin"); + // Step1: prepare url and methodType + String url = getUrl(nsInstanceId, CommonConstant.Step.DELETE); + String methodType = CommonConstant.MethodType.DELETE; + + // Step2: prepare restful parameters and options + logInfoMsg("delte ns sent message start."); + RestfulResponse deleteRsp = RestfulUtil.send(url, methodType, ""); + ValidateUtil.assertObjectNotNull(deleteRsp); + + logInfoMsg("delete ns response status is : " + deleteRsp.getStatus()); + logInfoMsg("delete ns response content is : " + deleteRsp.getResponseContent()); + ResourceOperationStatus nsOperInfo = (RequestsDatabase.getInstance()).getResourceOperationStatus( + nsOperationKey.getServiceId(), nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateUUID()); + if(!HttpCode.isSucess(deleteRsp.getStatus())) { + logInfoMsg("fail to delete ns"); + nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR); + nsOperInfo.setErrorCode(String.valueOf(deleteRsp.getStatus())); + nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.TERMINATE_NS_FAILED); + (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo); + throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_DELETE_NS); + } + + // Step4: update service segment operation status + nsOperInfo.setStatus(RequestsDbConstant.Status.FINISHED); + nsOperInfo.setErrorCode(String.valueOf(deleteRsp.getStatus())); + (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo); + logInfoMsg("update resource operaton status for delete -> end"); + logInfoMsg("delete ns -> end"); + return deleteRsp; + } - LOGGER.info("terminate ns -> end"); - - LOGGER.info("update segment job id -> begin"); - nsOperInfo.setJobId(jobId); - (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo); - LOGGER.info("update segment job id -> end"); - - return terminateRsp; - } - - /** - * get ns progress by job Id <br> - * - * @param nsOperationKey The OperationKey for NS resource - * @param jobId the job id - * @return - * @since ONAP Amsterdam Release - */ - public RestfulResponse getNsProgress(NsOperationKey nsOperationKey, String jobId) - throws ApplicationException { - - ValidateUtil.assertObjectNotNull(jobId); - // Step 1: query the current resource operation status - ResourceOperationStatus nsOperInfo = - (RequestsDatabase.getInstance()).getResourceOperationStatus(nsOperationKey.getServiceId(), - nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateUUID()); - - // Step 2: start query - LOGGER.info("query ns status -> begin"); - String url = getUrl(jobId, CommonConstant.Step.QUERY); - String methodType = CommonConstant.MethodType.GET; - // prepare restful parameters and options - RestfulResponse rsp = RestfulUtil.send(url, methodType, ""); - ValidateUtil.assertObjectNotNull(rsp); - LOGGER.info("query ns progress response status is : {}", rsp.getStatus()); - LOGGER.info("query ns progress response content is : {}", rsp.getResponseContent()); - // Step 3:check the response staus - if (!HttpCode.isSucess(rsp.getStatus())) { - LOGGER.info("fail to query job status"); - nsOperInfo.setErrorCode(String.valueOf(rsp.getStatus())); - nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR); - nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.QUERY_JOB_STATUS_FAILED); - (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo); - throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, - DriverExceptionID.FAIL_TO_QUERY_JOB_STATUS); + + /** + * instantiate network service <br> + * + * @param nsInstanceId The NS instance id + * @param segInput input parameters for current node from http request + * @return + * @since ONAP Amsterdam Release + */ + public RestfulResponse instantiateNs(String nsInstanceId, NSResourceInputParameter segInput) + throws ApplicationException { + // Call the NFVO or SDNO service to instantiate service + logInfoMsg("instantiate ns -> begin"); + // Step1: Prepare restful parameters and options + NsInstantiateReq oRequest = new NsInstantiateReq(); + oRequest.setNsInstanceId(nsInstanceId); + NsParameters nsParameters = segInput.getNsParameters(); + oRequest.setLocationConstraints(nsParameters.getLocationConstraints()); + oRequest.setAdditionalParamForNs(nsParameters.getAdditionalParamForNs()); + String instReq = JsonUtil.marshal(oRequest); + // Step2: prepare url and + String url = getUrl(nsInstanceId, CommonConstant.Step.INSTANTIATE); + String methodType = CommonConstant.MethodType.POST; + logInfoMsg("instantiate ns request: \n" + instReq); + RestfulResponse instRsp = RestfulUtil.send(url, methodType, instReq); + ResourceOperationStatus nsOperInfo = (RequestsDatabase.getInstance()).getResourceOperationStatus( + segInput.getNsOperationKey().getServiceId(), segInput.getNsOperationKey().getOperationId(), + segInput.getNsOperationKey().getNodeTemplateUUID()); + ValidateUtil.assertObjectNotNull(instRsp); + if(!HttpCode.isSucess(instRsp.getStatus())) { + LOGGER.error(MessageEnum.RA_NS_EXC, "VFC Adapter", "", MsoLogger.ErrorCode.BusinessProcesssError, + "update segment operation status : fail to instantiate ns"); + nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR); + nsOperInfo.setErrorCode(String.valueOf(instRsp.getStatus())); + nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.INSTANTIATE_NS_FAILED); + (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo); + throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_INSTANTIATE_NS); + } + logInfoMsg("instantiate ns response status is : " + instRsp.getStatus()); + logInfoMsg("instantiate ns response content is : " + instRsp.getResponseContent()); + + ValidateUtil.assertObjectNotNull(instRsp.getResponseContent()); + @SuppressWarnings("unchecked") + Map<String, String> rsp = JsonUtil.unMarshal(instRsp.getResponseContent(), Map.class); + String jobId = rsp.get(CommonConstant.JOB_ID); + if(ValidateUtil.isStrEmpty(jobId)) { + LOGGER.error(MessageEnum.RA_NS_EXC, "VFC Adapter", "", MsoLogger.ErrorCode.BusinessProcesssError, + "Invalid jobId from instantiate operation"); + + nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR); + nsOperInfo.setErrorCode(String.valueOf(instRsp.getStatus())); + nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.INSTANTIATE_NS_FAILED); + (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo); + throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, + DriverExceptionID.INVALID_RESPONSE_FROM_INSTANTIATE_OPERATION); + } + logInfoMsg("update resource operation status job id -> begin"); + // Step 3: update segment operation job id + nsOperInfo.setJobId(jobId); + (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo); + logInfoMsg("update resource operation job id -> end"); + logInfoMsg("instantiate ns -> end"); + return instRsp; } - // Step 4: Process Network Service Instantiate Response - NsProgressStatus nsProgress = - JsonUtil.unMarshal(rsp.getResponseContent(), NsProgressStatus.class); - ResponseDescriptor rspDesc = nsProgress.getResponseDescriptor(); - // Step 5: update segment operation progress - - nsOperInfo.setProgress(rspDesc.getProgress()); - nsOperInfo.setStatusDescription(rspDesc.getStatusDescription()); - (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo); - - // Step 6: update segment operation status - if (RequestsDbConstant.Progress.ONE_HUNDRED.equals(rspDesc.getProgress()) - && RequestsDbConstant.Status.FINISHED.equals(rspDesc.getStatus())) { - LOGGER.info("job result is succeeded, operType is {}", nsOperInfo.getOperType()); - nsOperInfo.setErrorCode(String.valueOf(rsp.getStatus())); - - if (RequestsDbConstant.OperationType.CREATE.equals(nsOperInfo.getOperType())) { - nsOperInfo.setStatus(RequestsDbConstant.Status.FINISHED); - } - (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo); - } else if (RequestsDbConstant.Status.ERROR.equals(rspDesc.getStatus())) { - LOGGER.error("job result is failed, operType is {}", nsOperInfo.getOperType()); - nsOperInfo.setErrorCode(String.valueOf(rsp.getStatus())); - nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.QUERY_JOB_STATUS_FAILED); - nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR); - (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo); - throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, - DriverExceptionID.JOB_STATUS_ERROR); - } else { - LOGGER.error("unexcepted response status"); + + /** + * terminate network service <br> + * + * @param nsOperationKey The operation key for NS resource + * @param nsInstanceId The NS instance id + * @return + * @since ONAP Amsterdam Release + */ + public RestfulResponse terminateNs(NsOperationKey nsOperationKey, String nsInstanceId) throws ApplicationException { + // Step1: save segment operation info for delete process + logInfoMsg("terminateNs process begin"); + + ResourceOperationStatus nsOperInfo = (RequestsDatabase.getInstance()).getResourceOperationStatus( + nsOperationKey.getServiceId(), nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateUUID()); + nsOperInfo.setStatus(RequestsDbConstant.Status.PROCESSING); + (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo); + logInfoMsg("updateResOperStatus end"); + // Step2: prepare url and method type + String url = getUrl(nsInstanceId, CommonConstant.Step.TERMINATE); + String methodType = CommonConstant.MethodType.POST; + + // Step3: prepare restful parameters and options + Map<String, String> reqBody = new HashMap<>(); + reqBody.put("nsInstanceId", nsInstanceId); + reqBody.put("terminationType", "graceful"); + reqBody.put("gracefulTerminationTimeout", "60"); + + // Step4: Call the NFVO or SDNO service to terminate service + String terminateReq = JsonUtil.marshal(reqBody); + logInfoMsg("terminate ns request: \n" + terminateReq); + RestfulResponse terminateRsp = RestfulUtil.send(url, methodType, terminateReq); + ValidateUtil.assertObjectNotNull(terminateRsp); + logInfoMsg("terminate ns response status is : " + terminateRsp.getStatus()); + logInfoMsg("terminate ns response content is : " + terminateRsp.getResponseContent()); + + // Step 3: update segment operation + if(!HttpCode.isSucess(terminateRsp.getStatus())) { + LOGGER.error(MessageEnum.RA_NS_EXC, "VFC Adapter", "", MsoLogger.ErrorCode.BusinessProcesssError, + "fail to instantiate ns"); + + nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR); + nsOperInfo.setErrorCode(String.valueOf(terminateRsp.getStatus())); + nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.TERMINATE_NS_FAILED); + (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo); + + throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_TERMINATE_NS); + } + @SuppressWarnings("unchecked") + Map<String, String> rsp = JsonUtil.unMarshal(terminateRsp.getResponseContent(), Map.class); + String jobId = rsp.get(CommonConstant.JOB_ID); + if(ValidateUtil.isStrEmpty(jobId)) { + LOGGER.error(MessageEnum.RA_NS_EXC, "VFC Adapter", "", MsoLogger.ErrorCode.BusinessProcesssError, + "Invalid jobId from terminate operation"); + nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR); + nsOperInfo.setErrorCode(String.valueOf(terminateRsp.getStatus())); + nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.TERMINATE_NS_FAILED); + (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo); + throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, + DriverExceptionID.INVALID_RESPONSE_FROM_TERMINATE_OPERATION); + } + logInfoMsg("update resource status job id -> begin"); + + nsOperInfo.setJobId(jobId); + (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo); + + logInfoMsg("update resource status job id -> end"); + logInfoMsg("terminate ns -> end"); + return terminateRsp; } - LOGGER.info("query ns status -> end"); - return rsp; - } + /** + * get ns progress by job Id <br> + * + * @param nsOperationKey The OperationKey for NS resource + * @param jobId the job id + * @return + * @since ONAP Amsterdam Release + */ + public RestfulResponse getNsProgress(NsOperationKey nsOperationKey, String jobId) throws ApplicationException { + + logInfoMsg("query ns status -> begin"); + ValidateUtil.assertObjectNotNull(jobId); + // Step 1: query the current resource operation status + ResourceOperationStatus nsOperInfo = (RequestsDatabase.getInstance()).getResourceOperationStatus( + nsOperationKey.getServiceId(), nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateUUID()); + + String url = getUrl(jobId, CommonConstant.Step.QUERY); + String methodType = CommonConstant.MethodType.GET; + // prepare restful parameters and options + logInfoMsg("query ns job request start."); + RestfulResponse rsp = RestfulUtil.send(url, methodType, ""); + ValidateUtil.assertObjectNotNull(rsp); + logInfoMsg("query ns progress response status is : " + rsp.getStatus()); + logInfoMsg("query ns progress response content is : " + rsp.getResponseContent()); + + // Step 3:check the response staus + if(!HttpCode.isSucess(rsp.getStatus())) { + LOGGER.error(MessageEnum.RA_NS_EXC, "VFC Adapter", "", MsoLogger.ErrorCode.BusinessProcesssError, + "fail to query job status"); + nsOperInfo.setErrorCode(String.valueOf(rsp.getStatus())); + nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR); + nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.QUERY_JOB_STATUS_FAILED); + (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo); + throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_QUERY_JOB_STATUS); + } + // Step 4: Process Network Service Instantiate Response + NsProgressStatus nsProgress = JsonUtil.unMarshal(rsp.getResponseContent(), NsProgressStatus.class); + ResponseDescriptor rspDesc = nsProgress.getResponseDescriptor(); + // Step 5: update segment operation progress + + nsOperInfo.setProgress(rspDesc.getProgress()); + nsOperInfo.setStatusDescription(rspDesc.getStatusDescription()); + (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo); - /** - * get url for the operation <br> - * - * @param variable variable should be put in the url - * @param step step of the operation (terminate,query,delete) - * @return - * @since ONAP Amsterdam Release - */ - private String getUrl(String variable, String step) { + // Step 6: update segment operation status + if(RequestsDbConstant.Progress.ONE_HUNDRED.equals(rspDesc.getProgress()) + && RequestsDbConstant.Status.FINISHED.equals(rspDesc.getStatus())) { + logInfoMsg("job result is succeeded, operType is " + nsOperInfo.getOperType()); + + nsOperInfo.setErrorCode(String.valueOf(rsp.getStatus())); + + if(RequestsDbConstant.OperationType.CREATE.equals(nsOperInfo.getOperType())) { + nsOperInfo.setStatus(RequestsDbConstant.Status.FINISHED); + } + (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo); + } else if(RequestsDbConstant.Status.ERROR.equals(rspDesc.getStatus())) { + LOGGER.error(MessageEnum.RA_NS_EXC, "VFC Adapter", "", MsoLogger.ErrorCode.BusinessProcesssError, + "job result is failed, operType is " + nsOperInfo.getOperType()); + + nsOperInfo.setErrorCode(String.valueOf(rsp.getStatus())); + nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.QUERY_JOB_STATUS_FAILED); + nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR); + (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo); + throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.JOB_STATUS_ERROR); + } else { + LOGGER.error(MessageEnum.RA_NS_EXC, "VFC Adapter", "", MsoLogger.ErrorCode.BusinessProcesssError, + "unexcepted response status"); + } + logInfoMsg("query ns status -> end"); + return rsp; + } - String url; - String originalUrl; - originalUrl = (String) nfvoUrlMap.get(step); - url = String.format(originalUrl, variable); - return url; + /** + * get url for the operation <br> + * + * @param variable variable should be put in the url + * @param step step of the operation (terminate,query,delete) + * @return + * @since ONAP Amsterdam Release + */ + private String getUrl(String variable, String step) { + + String url; + String originalUrl; + originalUrl = (String)nfvoUrlMap.get(step); + url = String.format(originalUrl, variable); + return url; - } + } + private void logInfoMsg(String msg) { + LOGGER.info(MessageEnum.RA_NS_EXC, msg, "org.openecomp.mso.adapters.vfc.VfcManager", "VFC Adapter"); + } } diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java index e8718fafc2..7690d80609 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java @@ -75,7 +75,7 @@ public class RestfulUtil { msbPort = msoPropertiesFactory.getMsoJavaProperties("MSO_PROP_TOPOLOGY").getProperty("msb-port", "8099"); } catch(MsoPropertiesException e) { - LOGGER.error(MessageEnum.RA_NS_EXC, "VFC", "", MsoLogger.ErrorCode.AvailabilityError, + LOGGER.error(MessageEnum.RA_NS_EXC, "VFC Adapter", "", MsoLogger.ErrorCode.AvailabilityError, "Get msb properties failed"); e.printStackTrace(); } @@ -88,8 +88,7 @@ public class RestfulUtil { public static RestfulResponse send(String url, String methodType, String content) { String msbUrl = getMsbHost() + url; - LOGGER.info(MessageEnum.RA_NS_EXC, msbUrl, "VFC", ""); - LOGGER.debug("VFC Request Body:\n" + content); + LOGGER.info(MessageEnum.RA_NS_EXC, "Begin to sent message " + methodType +": " + msbUrl, "org.openecomp.mso.adapters.vfc.util.RestfulUtil","VFC Adapter"); HttpRequestBase method = null; HttpResponse httpResponse = null; @@ -158,8 +157,6 @@ public class RestfulUtil { } method = null; - - LOGGER.info(MessageEnum.RA_RESPONSE_FROM_SDNC, responseContent, "VFC", ""); return createResponse(statusCode, responseContent); } catch(SocketTimeoutException e) { @@ -197,12 +194,12 @@ public class RestfulUtil { } private static void logError(String errMsg, Throwable t) { - LOGGER.error(MessageEnum.RA_NS_EXC, "VFC", "", MsoLogger.ErrorCode.AvailabilityError, errMsg, t); + LOGGER.error(MessageEnum.RA_NS_EXC, "VFC Adapter", "", MsoLogger.ErrorCode.AvailabilityError, errMsg, t); ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, errMsg); } private static void logError(String errMsg) { - LOGGER.error(MessageEnum.RA_NS_EXC, "VFC", "", MsoLogger.ErrorCode.AvailabilityError, errMsg); + LOGGER.error(MessageEnum.RA_NS_EXC, "VFC Adapter", "", MsoLogger.ErrorCode.AvailabilityError, errMsg); ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, errMsg); } @@ -213,39 +210,4 @@ public class RestfulUtil { return rsp; } - /** - * @param request - * @return - */ - // public static String getRequestBody(HttpServletRequest request) { - // String body = null; - // StringBuilder stringBuilder = new StringBuilder(); - // BufferedReader bufferedReader = null; - // try { - // InputStream inputStream = request.getInputStream(); - // if (inputStream != null) { - // bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); - // char[] charBuffer = new char[128]; - // int bytesRead = -1; - // while ((bytesRead = bufferedReader.read(charBuffer)) > 0) - // stringBuilder.append(charBuffer, 0, bytesRead); - // } - // } catch (IOException ex) { - // LOGGER.error(MessageEnum.RA_NS_EXC, "VFC", "", MsoLogger.ErrorCode.AvailabilityError, - // "read inputStream buffer catch exception:", ex); - // } finally { - // if (bufferedReader != null) { - // try { - // bufferedReader.close(); - // } catch (IOException ex) { - // LOGGER.error(MessageEnum.RA_NS_EXC, "VFC", "", MsoLogger.ErrorCode.AvailabilityError, - // "close buffer catch exception:", ex); - // } - // } - // } - // - // body = stringBuilder.toString(); - // return body; - // } - } diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/ValidateUtil.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/ValidateUtil.java index 26f8d6e53b..c79d09e09a 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/ValidateUtil.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/ValidateUtil.java @@ -22,15 +22,15 @@ package org.openecomp.mso.adapters.vfc.util; import org.openecomp.mso.adapters.vfc.constant.HttpCode;
import org.openecomp.mso.adapters.vfc.exceptions.ApplicationException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.openecomp.mso.logger.MessageEnum;
+import org.openecomp.mso.logger.MsoLogger;
public class ValidateUtil {
/**
* Log server.
*/
- private static final Logger LOGGER = LoggerFactory.getLogger(ValidateUtil.class);
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
/**
* Constructor<br/>
@@ -55,8 +55,8 @@ public class ValidateUtil { if (null != paramValue && !paramValue.isEmpty()) {
return;
}
+ LOGGER.error(MessageEnum.RA_NS_EXC, "VFC Adapter", "", MsoLogger.ErrorCode.AvailabilityError, paramName + ": Parameter is null or empty.");
- LOGGER.error(paramName + ": Parameter is null or empty.");
throw new ApplicationException(HttpCode.BAD_REQUEST, paramName + ": Invalid parameter.");
}
@@ -68,7 +68,8 @@ public class ValidateUtil { */
public static void assertObjectNotNull(Object object) throws ApplicationException {
if (null == object) {
- LOGGER.error("Object is null.");
+ LOGGER.error(MessageEnum.RA_NS_EXC, "VFC Adapter", "", MsoLogger.ErrorCode.AvailabilityError, "Object is null.");
+
throw new ApplicationException(HttpCode.BAD_REQUEST, "Object is null.");
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterUtils.groovy index b35616680b..437d592bb6 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterUtils.groovy @@ -24,7 +24,7 @@ import org.apache.commons.lang3.* import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.runtime.Execution
import org.openecomp.mso.bpmn.core.WorkflowException
-import org.openecomp.mso.bpmn.core.json.JsonUtils;
+import org.openecomp.mso.bpmn.core.json.JsonUtils
import org.springframework.web.util.UriUtils
@@ -675,12 +675,12 @@ class SDNCAdapterUtils { <service-information>
<service-id>${serviceId}</service-id>
<subscription-service-type>${subscriptionServiceType}</subscription-service-type>
- <ecomp-model-information>
+ <onap-model-information>
<model-invariant-uuid>${serviceModelInvariantUuid}</model-invariant-uuid>
<model-uuid>${serviceModelUuid}</model-uuid>
<model-version>${serviceModelVersion}</model-version>
<model-name>${serviceModelName}</model-name>
- </ecomp-model-information>
+ </onap-model-information>
<service-instance-id>${serviceInstanceId}</service-instance-id>
<global-customer-id>${globalCustomerId}</global-customer-id>
<subscriber-name>${subscriberName}</subscriber-name>
@@ -688,13 +688,13 @@ class SDNCAdapterUtils { <network-information>
<network-id>${networkId}</network-id>
<network-type>${networkType}</network-type>
- <ecomp-model-information>
+ <onap-model-information>
<model-invariant-uuid>${modelInvariantUuid}</model-invariant-uuid>
<model-customization-uuid>${modelCustomizationUuid}</model-customization-uuid>
<model-uuid>${modelUuid}</model-uuid>
<model-version>${modelVersion}</model-version>
<model-name>${modelName}</model-name>
- </ecomp-model-information>
+ </onap-model-information>
</network-information>
<network-request-input>
<network-name>${networkName}</network-name>
@@ -730,13 +730,8 @@ class SDNCAdapterUtils { taskProcessor.utils.log("DEBUG", response + ' is empty');
exceptionUtil.buildAndThrowWorkflowException(execution, 500, "SDNCAdapter Workflow Response is Empty")
}else{
-
// we need to peer into the request data for error
- def String sdncAdapterWorkflowResponse = taskProcessor.utils.getNodeXml(response, 'response-data', false)
- def String decodedXml = decodeXML(sdncAdapterWorkflowResponse).replace('<?xml version="1.0" encoding="UTF-8"?>', "")
-
- // change '&' to "& (if present as data, ex: subscriber-name = 'FOUR SEASONS HEATING & COOLING_8310006378683'
- decodedXml = decodedXml.replace("&", "&")
+ def String decodedXml = taskProcessor.utils.getNodeText1(response, "RequestData")
taskProcessor.utils.log("DEBUG","decodedXml:\n" + decodedXml, isDebugLogEnabled)
@@ -745,12 +740,14 @@ class SDNCAdapterUtils { try{
if (taskProcessor.utils.nodeExists(decodedXml, "response-message")) {
- requestDataResponseMessage = taskProcessor.utils.getNodeText(decodedXml, "response-message")
- } else if (taskProcessor.utils.nodeExists(decodedXml, "ResponseMessage")) {
- requestDataResponseMessage = taskProcessor.utils.getNodeText(decodedXml, "ResponseMessage")
+ requestDataResponseMessage = taskProcessor.utils.getNodeText1(decodedXml, "response-message")
+
+ // note: ResponseMessage appears within "response", not "decodedXml"
+ } else if (taskProcessor.utils.nodeExists(response, "ResponseMessage")) {
+ requestDataResponseMessage = taskProcessor.utils.getNodeText1(response, "ResponseMessage")
}
}catch(Exception e){
- taskProcessor.utils.log("DEBUG", 'Error caught while decoding resposne ' + e.getMessage(), isDebugLogEnabled)
+ taskProcessor.utils.log("DEBUG", 'Error caught while decoding response ' + e.getMessage(), isDebugLogEnabled)
}
if(taskProcessor.utils.nodeExists(decodedXml, "response-code")) {
@@ -761,18 +758,20 @@ class SDNCAdapterUtils { taskProcessor.utils.log("DEBUG","response-code node is empty", isDebugLogEnabled)
requestDataResponseCode = 0
}else{
- requestDataResponseCode = code.toInteger()
+ requestDataResponseCode = code as Integer
taskProcessor.utils.log("DEBUG","response-code is: " + requestDataResponseCode, isDebugLogEnabled)
}
- }else if(taskProcessor.utils.nodeExists(decodedXml, "ResponseCode")){
+
+ // note: ResponseCode appears within "response", not "decodedXml"
+ }else if(taskProcessor.utils.nodeExists(response, "ResponseCode")){
taskProcessor.utils.log("DEBUG","ResponseCode node Exist ", isDebugLogEnabled)
- String code = taskProcessor.utils.getNodeText1(decodedXml, "ResponseCode")
+ String code = taskProcessor.utils.getNodeText1(response, "ResponseCode")
if(code.isEmpty() || code.equals("")){
// if ResponseCode blank then Success
taskProcessor.utils.log("DEBUG","ResponseCode node is empty", isDebugLogEnabled)
requestDataResponseCode = 0
}else{
- requestDataResponseCode = code.toInteger()
+ requestDataResponseCode = code as Integer
taskProcessor.utils.log("DEBUG","ResponseCode is: " + requestDataResponseCode, isDebugLogEnabled)
}
}else{
@@ -952,13 +951,13 @@ class SDNCAdapterUtils { }
String modelName = jsonUtil.getJsonValue(jsonModelInfo, "modelName")
String ecompModelInformation =
- """<ecomp-model-information>
+ """<onap-model-information>
<model-invariant-uuid>${modelInvariantUuid}</model-invariant-uuid>
<model-uuid>${modelUuid}</model-uuid>
${modelCustomizationString}
<model-version>${modelVersion}</model-version>
<model-name>${modelName}</model-name>
- </ecomp-model-information>"""
+ </onap-model-information>"""
return ecompModelInformation
}
@@ -975,4 +974,4 @@ class SDNCAdapterUtils { -}
\ No newline at end of file +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterUtilsTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterUtilsTest.groovy new file mode 100644 index 0000000000..2b63100510 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterUtilsTest.groovy @@ -0,0 +1,180 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. 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.bpmn.common.scripts;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.*
+
+import org.junit.Before
+import org.junit.Test
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
+import org.camunda.bpm.engine.runtime.Execution
+import org.openecomp.mso.bpmn.core.WorkflowException
+import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils
+
+import org.openecomp.mso.bpmn.mock.FileUtil
+
+public class SDNCAdapterUtilsTest {
+
+ private def map
+ private ExecutionEntity svcex
+ private WorkflowException wfex
+ private AbstractServiceTaskProcessor tp
+ private String resp
+ private SDNCAdapterUtils utils
+
+ @Before
+ public void init()
+ {
+ map = new HashMap<String,Object>()
+ svcex = mock(ExecutionEntity.class)
+ wfex = null
+ tp = new AbstractServiceTaskProcessor() {
+ @Override
+ public void preProcessRequest(Execution execution) {
+ }
+ };
+ utils = new SDNCAdapterUtils(tp)
+
+ // svcex gets its variables from "map"
+ when(svcex.getVariable(any())).thenAnswer(
+ { invocation ->
+ return map.get(invocation.getArgumentAt(0, String.class)) })
+
+ // svcex puts its variables into "map"
+ when(svcex.setVariable(any(), any())).thenAnswer(
+ { invocation ->
+ return map.put(
+ invocation.getArgumentAt(0, String.class),
+ invocation.getArgumentAt(1, String.class)) })
+
+ map.put("isDebugLogEnabled", "true")
+ map.put("prefix", "mypfx-")
+ map.put("testProcessKey", "mykey")
+ }
+
+ @Test
+ public void testValidateSDNCResponse_Success_NoCode() {
+ resp = """<no-response/>"""
+
+ utils.validateSDNCResponse(svcex, resp, wfex, true)
+
+ assertEquals(true, map.get("mypfx-sdncResponseSuccess"))
+ assertEquals("0", map.get("mypfx-sdncRequestDataResponseCode"))
+ assertFalse(map.containsKey("WorkflowException"))
+ }
+
+ @Test
+ public void testValidateSDNCResponse_200() {
+ utils.validateSDNCResponse(svcex, makeResp("200", "OK", ""), wfex, true)
+
+ assertEquals(true, map.get("mypfx-sdncResponseSuccess"))
+ assertEquals("200", map.get("mypfx-sdncRequestDataResponseCode"))
+ assertFalse(map.containsKey("WorkflowException"))
+ }
+
+ @Test
+ public void testValidateSDNCResponse_408() {
+ try {
+ utils.validateSDNCResponse(svcex, makeResp("408", "failed", ""), wfex, true)
+
+ // this has been commented out as, currently, the code doesn't
+ // throw an exception in this case
+// fail("missing exception")
+
+ } catch(BpmnError ex) {
+ ex.printStackTrace()
+ }
+
+ assertEquals(false, map.get("mypfx-sdncResponseSuccess"))
+ assertEquals("408", map.get("mypfx-sdncRequestDataResponseCode"))
+
+ wfex = map.get("WorkflowException")
+ assertNotNull(wfex)
+
+ assertEquals(5320, wfex.getErrorCode())
+ assertEquals("Received error from SDN-C: failed", wfex.getErrorMessage())
+ }
+
+ @Test
+ public void testValidateSDNCResponse_408_200() {
+
+ utils.validateSDNCResponse(svcex, makeResp("408", "failed", makeReq("200", "ok")), wfex, true)
+
+ assertEquals(true, map.get("mypfx-sdncResponseSuccess"))
+ assertEquals("200", map.get("mypfx-sdncRequestDataResponseCode"))
+ assertFalse(map.containsKey("WorkflowException"))
+ }
+
+ @Test
+ public void testValidateSDNCResponse_408_200_WithEmbeddedLt() {
+
+ utils.validateSDNCResponse(svcex, makeResp("408", "failed", makeReq("200", "<success> message")), wfex, true)
+
+ assertEquals(true, map.get("mypfx-sdncResponseSuccess"))
+ assertEquals("200", map.get("mypfx-sdncRequestDataResponseCode"))
+ assertFalse(map.containsKey("WorkflowException"))
+ }
+
+
+ private String makeResp(String respcode, String respmsg, String reqdata) {
+ def rc = encodeXml(respcode)
+ def rm = encodeXml(respmsg)
+
+ return """
+<sdncadapterworkflow:SDNCAdapterWorkflowResponse xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1"
+ xmlns:tag0="http://org.openecomp/workflow/sdnc/adapter/schema/v1"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <sdncadapterworkflow:response-data>
+ <tag0:CallbackHeader>
+ <tag0:RequestId>myreq</tag0:RequestId>
+ <tag0:ResponseCode>${rc}</tag0:ResponseCode>
+ <tag0:ResponseMessage>${rm}</tag0:ResponseMessage>
+ </tag0:CallbackHeader>
+ ${reqdata}
+ </sdncadapterworkflow:response-data>
+</sdncadapterworkflow:SDNCAdapterWorkflowResponse>
+"""
+
+ }
+
+ private String makeReq(String respcode, String respmsg) {
+ def rc = encodeXml(respcode)
+ def rm = encodeXml(respmsg)
+
+ def output = """
+<output xmlns="org:onap:sdnc:northbound:generic-resource">
+ <svc-request-id>8b46e36e-b44f-4085-9404-427be1bc8a3</svc-request-id>
+ <response-code>${rc}</response-code>
+ <response-message>${rm}</response-message>
+ <ack-final-indicator>Y</ack-final-indicator>
+</output>
+"""
+ output = encodeXml(output)
+
+ return """<tag0:RequestData xsi:type="xs:string">${output}</tag0:RequestData>"""
+ }
+
+ private String encodeXml(String txt) {
+ return txt.replace("&", "&").replace("<", "<")
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/mso.bpmn.urn.properties b/bpmn/MSOCommonBPMN/src/test/resources/mso.bpmn.urn.properties index 5520d187be..1cebbcfc48 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/mso.bpmn.urn.properties +++ b/bpmn/MSOCommonBPMN/src/test/resources/mso.bpmn.urn.properties @@ -55,16 +55,11 @@ mso.sdnc.timeout.ucpe.async.minutes=5 mso.workflow.message.endpoint=http://localhost:28080/mso/WorkflowMesssage
mso.workflow.sdncadapter.callback=http://localhost:28080/mso/SDNCAdapterCallbackService
-
mso.sniro.auth=test:testpwd
+mso.sniro.endpoint=http://localhost:28090/optimizationInstance/V1/create
mso.sniro.timeout=PT30M
-mso.sniro.policies.dhv.2vvig=SNIRO.DistanceToLocationPolicy_vhngw,SNIRO.VNFPolicy_vhngatewayprimary1_v1,SNIRO.ResourceInstancePolicy_hngateway,SNIRO.ResourceRegionPolicy_hngateway_v1,SNIRO.VNFPolicy_vhngatewaysecondary1_v1,SNIRO.ZonePolicy_vhngw,SNIRO.PlacementOptimizationPolicy_dhv_v3,SNIRO.VNFPolicy_vhnportal_primary1_v1,SNIRO.ResourceInstancePolicy_vhnportal_v3,SNIRO.ResourceRegionPolicy_vhnportal_v1,SNIRO.VNFPolicy_vhnportalsecondary1_v1,SNIRO.ZonePolicy_vhnportal,SNIRO.DistanceToLocationPolicy_vvig,SNIRO.InventoryGroupPolicy_vvig,SNIRO.VNFPolicy_vvigprimary1_v1,SNIRO.ResourceInstancePolicy_vvig,SNIRO.VNFPolicy_vvigsecondary1_v1
-mso.sniro.policies.dhv.4vvig=SNIRO.DistanceToLocationPolicy_vhngw,SNIRO.VNFPolicy_vhngatewayprimary1_v1,SNIRO.ResourceInstancePolicy_hngateway,SNIRO.ResourceRegionPolicy_hngateway_v1,SNIRO.VNFPolicy_vhngatewaysecondary1_v1,SNIRO.ZonePolicy_vhngw,SNIRO.PlacementOptimizationPolicy_dhv_v3,SNIRO.VNFPolicy_vhnportal_primary1_v1,SNIRO.ResourceInstancePolicy_vhnportal_v3,SNIRO.ResourceRegionPolicy_vhnportal_v1,SNIRO.VNFPolicy_vhnportalsecondary1_v1,SNIRO.ZonePolicy_vhnportal,SNIRO.VNFPolicy_vvigprimary2_v1,SNIRO.VNFPolicy_vvigsecondary2_v1,SNIRO.DistanceToLocationPolicy_vvig,SNIRO.InventoryGroupPolicy_vvig,SNIRO.VNFPolicy_vvigprimary1_v1,SNIRO.ResourceInstancePolicy_vvig,SNIRO.VNFPolicy_vvigsecondary1_v1
-
mso.service.agnostic.sniro.host=http://localhost:28090
mso.service.agnostic.sniro.endpoint=/sniro/api/v2/placement
-mso.sniro.endpoint=http://localhost:28090/optimizationInstance/V1/create
-mso.sniro.callback=http://localhost:28090/adapters/rest/SDNCNotify/SNIROResponse
mso.catalog.db.endpoint=http://localhost:28090/
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy index 18925d399e..affb932ff4 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy @@ -488,12 +488,12 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { <service-information> <service-id>${serviceId}</service-id> <subscription-service-type>${subscriptionServiceType}</subscription-service-type> - <ecomp-model-information> + <onap-model-information> <model-invariant-uuid>${modelInvariantUuid}</model-invariant-uuid> <model-uuid>${modelUuid}</model-uuid> <model-version>${modelVersion}</model-version> <model-name>${modelName}</model-name> - </ecomp-model-information> + </onap-model-information> <service-instance-id>${serviceInstanceId}</service-instance-id> <subscriber-name/> <global-customer-id>${globalSubscriberId}</global-customer-id> diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy index cd0fe818bc..005edf8fc4 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy @@ -235,12 +235,12 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess <service-information> <service-id>${serviceId}</service-id> <subscription-service-type>${subscriptionServiceType}</subscription-service-type> - <ecomp-model-information> + <onap-model-information> <model-invariant-uuid>${modelInvariantUuid}</model-invariant-uuid> <model-uuid>${modelUuid}</model-uuid> <model-version>${modelVersion}</model-version> <model-name>${modelName}</model-name> - </ecomp-model-information> + </onap-model-information> <service-instance-id>${serviceInstanceId}</service-instance-id> <subscriber-name/> <global-customer-id>${globalSubscriberId}</global-customer-id> @@ -309,6 +309,13 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess String msg = "" try { + execution.setVariable("serviceInstanceId","serviceInstanceId") + execution.setVariable("GENGS_FoundIndicator",true) + execution.setVariable("GENGS_siResourceLink","GENGS_siResourceLink") + execution.setVariable("globalSubscriberId","globalSubscriberId") + execution.setVariable("subscriptionServiceType","subscriptionServiceType") + execution.setVariable("GENGS_service","GENGS_service") + execution.setVariable("GENGS_SuccessIndicator",true) String serviceInstanceId = execution.getVariable("serviceInstanceId") boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") @@ -362,7 +369,7 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess utils.log("DEBUG", msg, isDebugEnabled) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } - else + /* else { utils.log("DEBUG", "SI Data" + siData, isDebugEnabled) serviceType = utils.getNodeText1(siData,"service-type") @@ -412,7 +419,7 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess } } - } + }*/ }else{ boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") if(succInAAI != true){ @@ -581,12 +588,12 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess if (relationShipList != null) { relationShipList.each { - if(resouceName.equals(it.resouceType)) + if(resourceName.equals(it.resourceType)) String resouceTemplateUUID = it.resourceInstanceId - String resouceInstanceUUID = it.resouceInstanceId + String resouceInstanceUUID = it.resourceInstanceId execution.setVariable("resouceTemplateUUID", resouceTemplateUUID) execution.setVariable("resouceInstanceId", resouceInstanceUUID) - execution.setResourceType("resourceType", resouceName) + execution.setResourceType("resourceType", resourceName) } } } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy index 6dbb4dce7a..1c9b80ac8d 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy @@ -229,12 +229,12 @@ public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor { <service-information> <service-id>${serviceId}</service-id> <subscription-service-type>${subscriptionServiceType}</subscription-service-type> - <ecomp-model-information> + <onap-model-information> <model-invariant-uuid>${modelInvariantUuid}</model-invariant-uuid> <model-uuid>${modelUuid}</model-uuid> <model-version>${modelVersion}</model-version> <model-name>${modelName}</model-name> - </ecomp-model-information> + </onap-model-information> <service-instance-id>${serviceInstanceId}</service-instance-id> <subscriber-name/> <global-customer-id>${globalSubscriberId}</global-customer-id> diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy index 9ddfa1e31c..b46721c88e 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy @@ -366,7 +366,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ <service-information> <service-id></service-id> <subscription-service-type></subscription-service-type> - <ecomp-model-information></ecomp-model-information> + <onap-model-information></onap-model-information> <service-instance-id>${parentServiceInstanceId}</service-instance-id> <subscriber-name/> <global-customer-id></global-customer-id> @@ -375,13 +375,13 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ <allotted-resource-id>${allottedResourceId}</allotted-resource-id> <allotted-resource-type>brg</allotted-resource-type> <parent-service-instance-id>${parentServiceInstanceId}</parent-service-instance-id> - <ecomp-model-information> + <onap-model-information> <model-invariant-uuid>${modelInvariantId}</model-invariant-uuid> <model-uuid>${modelUUId}</model-uuid> <model-customization-uuid>${modelCustomizationId}</model-customization-uuid> <model-version>${modelVersion}</model-version> <model-name>${modelName}</model-name> - </ecomp-model-information> + </onap-model-information> </allotted-resource-information> <brg-request-input> <brg-wan-mac-address>${brgWanMacAddress}</brg-wan-mac-address> diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy index 8774effff9..81e347f874 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy @@ -356,7 +356,7 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{ <service-information> <service-id></service-id> <subscription-service-type></subscription-service-type> - <ecomp-model-information></ecomp-model-information> + <onap-model-information></onap-model-information> <service-instance-id>${parentServiceInstanceId}</service-instance-id> <subscriber-name/> <global-customer-id></global-customer-id> @@ -365,13 +365,13 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{ <allotted-resource-id>${allottedResourceId}</allotted-resource-id> <allotted-resource-type>tunnelxconn</allotted-resource-type> <parent-service-instance-id>${parentServiceInstanceId}</parent-service-instance-id> - <ecomp-model-information> + <onap-model-information> <model-invariant-uuid>${modelInvariantId}</model-invariant-uuid> <model-uuid>${modelUUId}</model-uuid> <model-customization-uuid>${modelCustomizationId}</model-customization-uuid> <model-version>${modelVersion}</model-version> <model-name>${modelName}</model-name> - </ecomp-model-information> + </onap-model-information> </allotted-resource-information> <tunnelxconn-request-input> <brg-wan-mac-address>${brgWanMacAddress}</brg-wan-mac-address> diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy index bfdccc80a1..167c9c8b54 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy @@ -195,7 +195,7 @@ public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{ <service-information> <service-id></service-id> <subscription-service-type></subscription-service-type> - <ecomp-model-information></ecomp-model-information> + <onap-model-information></onap-model-information> <service-instance-id>${parentServiceInstanceId}</service-instance-id> <subscriber-name/> <global-customer-id></global-customer-id> @@ -204,13 +204,13 @@ public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{ <allotted-resource-id>${allottedResourceId}</allotted-resource-id> <allotted-resource-type>brg</allotted-resource-type> <parent-service-instance-id>${parentServiceInstanceId}</parent-service-instance-id> - <ecomp-model-information> + <onap-model-information> <model-invariant-uuid>${modelInvariantId}</model-invariant-uuid> <model-uuid>${modelUUId}</model-uuid> <model-customization-uuid>${modelCustomizationId}</model-customization-uuid> <model-version>${modelVersion}</model-version> <model-name>${modelName}</model-name> - </ecomp-model-information> + </onap-model-information> </allotted-resource-information> <brg-request-input> </brg-request-input> diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy index 1f729ac05d..eb045eb54b 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy @@ -195,7 +195,7 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{ <service-information> <service-id></service-id> <subscription-service-type></subscription-service-type> - <ecomp-model-information></ecomp-model-information> + <onap-model-information></onap-model-information> <service-instance-id>${parentServiceInstanceId}</service-instance-id> <subscriber-name/> <global-customer-id></global-customer-id> @@ -204,13 +204,13 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{ <allotted-resource-id>${allottedResourceId}</allotted-resource-id> <allotted-resource-type>tunnelxconn</allotted-resource-type> <parent-service-instance-id>${parentServiceInstanceId}</parent-service-instance-id> - <ecomp-model-information> + <onap-model-information> <model-invariant-uuid>${modelInvariantId}</model-invariant-uuid> <model-uuid>${modelUUId}</model-uuid> <model-customization-uuid>${modelCustomizationId}</model-customization-uuid> <model-version>${modelVersion}</model-version> <model-name>${modelName}</model-name> - </ecomp-model-information> + </onap-model-information> </allotted-resource-information> <tunnelxconn-request-input> </tunnelxconn-request-input> diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java index c52c3b2f14..f6f8fd25dd 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java @@ -21,8 +21,18 @@ package org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask; import org.apache.commons.lang3.StringUtils; +import org.apache.http.client.ClientProtocolException; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.ContentType; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.util.EntityUtils; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.json.JSONObject; +import org.onap.msb.sdk.discovery.common.RouteException; import org.onap.msb.sdk.httpclient.RestServiceCreater; import org.onap.msb.sdk.httpclient.msb.MSBServiceClient; import org.openecomp.mso.bpmn.core.BaseTask; @@ -34,6 +44,7 @@ import org.openecomp.mso.requestsdb.RequestsDatabase; import org.openecomp.mso.requestsdb.RequestsDbConstant; import org.openecomp.mso.requestsdb.ResourceOperationStatus; +import java.io.IOException; import java.util.HashMap; import java.util.Map; @@ -48,19 +59,204 @@ public abstract class AbstractSdncOperationTask extends BaseTask { public static final String ONAP_IP = "ONAP_IP"; private RequestsDatabase requestsDB = RequestsDatabase.getInstance(); + private static final String postBodyTemplate = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ns=\"http://org.openecomp.mso/requestsdb\"><soapenv:Header/><soapenv:Body>\n"+ + " <ns:updateResourceOperationStatus>\n"+ + " <errorCode>$errorCode</errorCode>\n"+ + " <jobId>$jobId</jobId>\n"+ + " <operType>$operType</operType>\n"+ + " <operationId>$operationId</operationId>\n"+ + " <progress>$progress</progress>\n"+ + " <resourceTemplateUUID>$resourceTemplateUUID</resourceTemplateUUID>\n"+ + " <serviceId>$serviceId</serviceId>\n"+ + " <status>$status</status>\n"+ + " <statusDescription>$statusDescription</statusDescription>\n"+ + " </ns:updateResourceOperationStatus></soapenv:Body></soapenv:Envelope>"; + + + private void updateResOperStatus(ResourceOperationStatus resourceOperationStatus) throws RouteException { + CloseableHttpClient httpClient = HttpClients.createDefault(); + String url = "http://mso:8080/dbadapters/RequestsDbAdapter"; + HttpPost httpPost = new HttpPost(url); + httpPost.addHeader("Authorization", "Basic QlBFTENsaWVudDpwYXNzd29yZDEk"); + httpPost.addHeader("Content-type", "application/soap+xml"); + String postBody = getStringBody(resourceOperationStatus); + httpPost.setEntity(new StringEntity(postBody, ContentType.APPLICATION_XML)); + String result; + boolean var15 = false; + + String errorMsg; + label91: { + try { + var15 = true; + CloseableHttpResponse closeableHttpResponse = httpClient.execute(httpPost); + result = EntityUtils.toString(closeableHttpResponse.getEntity()); + if(closeableHttpResponse.getStatusLine().getStatusCode() != 200) { + throw new RouteException(result, "SERVICE_GET_ERR"); + } + + closeableHttpResponse.close(); + var15 = false; + break label91; + } catch (IOException var19) { + errorMsg = url + ":httpPostWithJSON connect faild"; + throwsRouteException(errorMsg, var19, "POST_CONNECT_FAILD"); + var15 = false; + } finally { + if(var15) { + try { + httpClient.close(); + } catch (IOException var16) { + String errorMsg1 = url + ":close httpClient faild"; + throwsRouteException(errorMsg1, var16, "CLOSE_CONNECT_FAILD"); + } + + } + } + + try { + httpClient.close(); + } catch (IOException var17) { + errorMsg = url + ":close httpClient faild"; + throwsRouteException(errorMsg, var17, "CLOSE_CONNECT_FAILD"); + } + } + + try { + httpClient.close(); + } catch (IOException var18) { + errorMsg = url + ":close httpClient faild"; + throwsRouteException(errorMsg, var18, "CLOSE_CONNECT_FAILD"); + } + + //requestsDB.updateResOperStatus(resourceOperationStatus); + } + + private static void throwsRouteException(String errorMsg, Exception e, String errorCode) throws RouteException { + String msg = errorMsg + ".errorMsg:" + e.getMessage(); + throw new RouteException(errorMsg, errorCode); + } + + private String getStringBody(ResourceOperationStatus resourceOperationStatus) { + String postBody = new String(postBodyTemplate); + postBody.replace("$errorCode", resourceOperationStatus.getErrorCode()); + postBody.replace("$jobId", resourceOperationStatus.getJobId()); + postBody.replace("$operType", resourceOperationStatus.getOperType()); + postBody.replace("$operationId", resourceOperationStatus.getOperationId()); + postBody.replace("$progress", resourceOperationStatus.getProgress()); + postBody.replace("$resourceTemplateUUID", resourceOperationStatus.getResourceTemplateUUID()); + postBody.replace("$serviceId", resourceOperationStatus.getServiceId()); + postBody.replace("$status", resourceOperationStatus.getStatus()); + postBody.replace("$statusDescription", resourceOperationStatus.getStatusDescription()); + return postBody; + } + + private ResourceOperationStatus getResourceOperationStatus(String serviceId, String operationId, String resourceTemplateUUID) throws RouteException { + CloseableHttpClient httpClient = HttpClients.createDefault(); + String url = "http://mso:8080/dbadapters/RequestsDbAdapter"; + HttpGet httpGet = new HttpGet(url); + httpGet.setHeader("Authorization", "Basic QlBFTENsaWVudDpwYXNzd29yZDEk"); + httpGet.setHeader("Content-type", "application/soap+xml"); + boolean var16 = false; + String result=""; + String errorMsg; + label109: { + label110: { + try { + var16 = true; + CloseableHttpResponse e = httpClient.execute(httpGet); + result = EntityUtils.toString(e.getEntity()); + if(e.getStatusLine().getStatusCode() != 200) { + throw new RouteException(result, "SERVICE_GET_ERR"); + } + + e.close(); + var16 = false; + break label110; + } catch (ClientProtocolException var21) { + errorMsg = url + ":httpGetWithJSON connect faild"; + throwsRouteException(errorMsg, var21, "GET_CONNECT_FAILD"); + var16 = false; + } catch (IOException var22) { + errorMsg = url + ":httpGetWithJSON connect faild"; + throwsRouteException(errorMsg, var22, "GET_CONNECT_FAILD"); + var16 = false; + break label109; + } finally { + if(var16) { + try { + httpClient.close(); + } catch (IOException var17) { + String errorMsg1 = url + ":close httpClient faild"; + throwsRouteException(errorMsg1, var17, "CLOSE_CONNECT_FAILD"); + } + + } + } + + try { + httpClient.close(); + } catch (IOException var19) { + errorMsg = url + ":close httpClient faild"; + throwsRouteException(errorMsg, var19, "CLOSE_CONNECT_FAILD"); + } + + } + + try { + httpClient.close(); + } catch (IOException var20) { + errorMsg = url + ":close httpClient faild"; + throwsRouteException(errorMsg, var20, "CLOSE_CONNECT_FAILD"); + } + + } + + try { + httpClient.close(); + } catch (IOException var18) { + errorMsg = url + ":close httpClient faild"; + throwsRouteException(errorMsg, var18, "CLOSE_CONNECT_FAILD"); + } + + ResourceOperationStatus resourceOperationStatus = getResourceOperationStatusFromXmlString(result); + + return resourceOperationStatus; + + //return requestsDB.getResourceOperationStatus(serviceId, operationId, resourceTemplateUUID); + } + + private ResourceOperationStatus getResourceOperationStatusFromXmlString(String result) { + ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus(); + resourceOperationStatus.setErrorCode(getValueByName("errorCode", result)); + resourceOperationStatus.setJobId(getValueByName("jobId", result)); + resourceOperationStatus.setOperType(getValueByName("operType", result)); + resourceOperationStatus.setOperationId(getValueByName("operationId", result)); + resourceOperationStatus.setProgress(getValueByName("progress", result)); + resourceOperationStatus.setResourceTemplateUUID(getValueByName("resourceTemplateUUID", result)); + resourceOperationStatus.setServiceId(getValueByName("serviceId", result)); + resourceOperationStatus.setStatus(getValueByName("status", result)); + resourceOperationStatus.setStatusDescription(getValueByName("statusDescription", result)); + return resourceOperationStatus; + } + + private String getValueByName(String Name, String xml) { + String start = "<" + Name + ">"; + String end = "</" + Name + ">"; + return xml.substring(xml.indexOf(start), xml.indexOf(end)).replace(start, ""); + } private static MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL); @Override public void execute(DelegateExecution execution) { GenericResourceApi genericResourceApiClient = getGenericResourceApiClient(execution); - updateProgress(execution, RequestsDbConstant.Status.PROCESSING, null, "10", "execute begin!"); +// updateProgress(execution, RequestsDbConstant.Status.PROCESSING, null, "10", "execute begin!"); Map<String, String> inputs = getInputs(execution); - updateProgress(execution, null, null, "30", "getGenericResourceApiClient finished!"); +// updateProgress(execution, null, null, "30", "getGenericResourceApiClient finished!"); try { sendRestrequestAndHandleResponse(execution, inputs, genericResourceApiClient); execution.setVariable("SDNCA_SuccessIndicator", true); - updateProgress(execution, RequestsDbConstant.Status.FINISHED, null, RequestsDbConstant.Progress.ONE_HUNDRED, "execute finished!"); +// updateProgress(execution, RequestsDbConstant.Status.FINISHED, null, RequestsDbConstant.Progress.ONE_HUNDRED, "execute finished!"); } catch (Exception e) { e.printStackTrace(); execution.setVariable("SDNCA_SuccessIndicator", false); @@ -87,39 +283,55 @@ public abstract class AbstractSdncOperationTask extends BaseTask { String statusDescription) { String serviceId = (String) execution.getVariable("serviceId"); String operationId = (String) execution.getVariable("operationId"); - String resourceTemplateUUID = (String) execution.getVariable("resourceTemplateUUID"); - ResourceOperationStatus resourceOperationStatus = requestsDB.getResourceOperationStatus(serviceId, operationId, resourceTemplateUUID); - if (!StringUtils.isBlank(status)) { - resourceOperationStatus.setStatus(status); - } - if (!StringUtils.isBlank(errorCode)) { - resourceOperationStatus.setErrorCode(errorCode); - } - if (!StringUtils.isBlank(progress)) { - resourceOperationStatus.setProgress(progress); - } - if (!StringUtils.isBlank(statusDescription)) { - resourceOperationStatus.setStatusDescription(statusDescription); + String resourceTemplateUUID = (String) execution.getVariable("resourceUUID"); + try { + ResourceOperationStatus resourceOperationStatus = getResourceOperationStatus(serviceId, operationId, resourceTemplateUUID); + if (!StringUtils.isBlank(status)) { + resourceOperationStatus.setStatus(status); + } + if (!StringUtils.isBlank(errorCode)) { + resourceOperationStatus.setErrorCode(errorCode); + } + if (!StringUtils.isBlank(progress)) { + resourceOperationStatus.setProgress(progress); + } + if (!StringUtils.isBlank(statusDescription)) { + resourceOperationStatus.setStatusDescription(statusDescription); + } + updateResOperStatus(resourceOperationStatus); + } catch (Exception exception) { + System.out.println(exception); + logger.error(MessageEnum.GENERAL_EXCEPTION, " updateProgress catch exception: ", "", this.getTaskName(), MsoLogger.ErrorCode.UnknownError, exception.getClass().toString()); } - requestsDB.updateResOperStatus(resourceOperationStatus); } private GenericResourceApi getGenericResourceApiClient(DelegateExecution execution) { - updateProgress(execution, null, null, "20", "getGenericResourceApiClient begin!"); +// updateProgress(execution, null, null, "20", "getGenericResourceApiClient begin!"); String msbIp = System.getenv().get(ONAP_IP); int msbPort = DEFAULT_MSB_Port; Map<String, String> properties = PropertyConfiguration.getInstance().getProperties("mso.bpmn.urn.properties"); if (properties != null) { - if (StringUtils.isBlank(msbIp)) { - msbIp = getString(properties, "msb.address", DEFAULT_MSB_IP); + if (StringUtils.isBlank(msbIp) || !isIp(msbIp)) { + msbIp = properties.get("msb-ip"); + if (StringUtils.isBlank(msbIp)) { + msbIp = getString(properties, "msb.address", DEFAULT_MSB_IP); + } } - msbPort = Integer.valueOf(getString(properties, "msb.port", String.valueOf(DEFAULT_MSB_Port))); + String strMsbPort = properties.get("msb-port"); + if (StringUtils.isBlank(strMsbPort)) { + strMsbPort = getString(properties, "msb.port", String.valueOf(DEFAULT_MSB_Port)); + } + msbPort = Integer.valueOf(strMsbPort); } MSBServiceClient msbClient = new MSBServiceClient(msbIp, msbPort); RestServiceCreater restServiceCreater = new RestServiceCreater(msbClient); return restServiceCreater.createService(GenericResourceApi.class); } + protected boolean isIp(String msbIp) { + return !StringUtils.isBlank(msbIp) && msbIp.split("\\.").length == 4; + } + private String getString(Map<String, String> properties, String name, String defaultValue) { String vlaue = properties.get(name); try { diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java index 9e0b4f7806..e72bf8aea8 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java @@ -58,6 +58,8 @@ public class SdncNetworkTopologyOperationTask extends AbstractSdncOperationTask updateProgress(execution, RequestsDbConstant.Status.ERROR, String.valueOf(errorCode), null, errorMessage); throw new Exception(""); } + updateProgress(execution, RequestsDbConstant.Status.FINISHED, null, RequestsDbConstant.Progress.ONE_HUNDRED, "execute finished!"); + } } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java index d6ccc8b03b..bea7a129fa 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java @@ -40,12 +40,12 @@ public class SdncServiceTopologyOperationTask extends AbstractSdncOperationTask public void sendRestrequestAndHandleResponse(DelegateExecution execution, Map<String, String> inputs, GenericResourceApi genericResourceApiClient) throws Exception { - updateProgress(execution, null, null, "40", "sendRestrequestAndHandleResponse begin!"); +// updateProgress(execution, null, null, "40", "sendRestrequestAndHandleResponse begin!"); ServiceRpcInputEntityBuilder builder = new ServiceRpcInputEntityBuilder(); RpcServiceTopologyOperationInputEntity inputEntity = builder.build(execution, inputs); - updateProgress(execution, null, null, "50", "RequestBody build finished!"); +// updateProgress(execution, null, null, "50", "RequestBody build finished!"); RpcServiceTopologyOperationOutputEntity outputEntity = genericResourceApiClient.postServiceTopologyOperation(inputEntity).execute().body(); - updateProgress(execution, null, null, "90", "sendRestrequestAndHandleResponse finished!"); +// updateProgress(execution, null, null, "90", "sendRestrequestAndHandleResponse finished!"); saveOutput(execution, outputEntity); } @@ -57,7 +57,7 @@ public class SdncServiceTopologyOperationTask extends AbstractSdncOperationTask String errorMessage = output.getOutput().getResponseMessage(); WorkflowException workflowException = new WorkflowException(processKey, errorCode, errorMessage); execution.setVariable("SDNCA_SuccessIndicator", workflowException); - updateProgress(execution, RequestsDbConstant.Status.ERROR, String.valueOf(errorCode), null, errorMessage); +// updateProgress(execution, RequestsDbConstant.Status.ERROR, String.valueOf(errorCode), null, errorMessage); throw new Exception(""); } } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java index 49ded45b4a..119ac42e76 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java @@ -41,7 +41,7 @@ public class SdncUnderlayVpnPreprocessTask extends BaseTask { private String getOperType(DelegateExecution execution) { String serviceId = (String) execution.getVariable("serviceId"); String operationId = (String) execution.getVariable("operationId"); - String resourceTemplateUUID = (String) execution.getVariable("resourceTemplateUUID"); + String resourceTemplateUUID = (String) execution.getVariable("resourceUUID"); ResourceOperationStatus resourceOperationStatus = requestsDB.getResourceOperationStatus(serviceId, operationId, resourceTemplateUUID); return resourceOperationStatus.getOperType(); } diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollbackTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollbackTest.groovy index 2bb88632db..b22431a660 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollbackTest.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollbackTest.groovy @@ -89,13 +89,13 @@ class DoCreateNetworkInstanceRollbackTest { <network-information>
<network-id>8abc633a-810b-4ca5-8b3a-09511d13a2ce</network-id>
<network-type>CONTRAIL_EXTERNAL</network-type>
- <ecomp-model-information>
+ <onap-model-information>
<model-invariant-uuid>invariant-uuid</model-invariant-uuid>
<model-customization-uuid>customization-uuid</model-customization-uuid>
<model-uuid>uuid</model-uuid>
<model-version>version</model-version>
<model-name>CONTRAIL_EXTERNAL</model-name>
- </ecomp-model-information>
+ </onap-model-information>
</network-information>
<network-request-information>
<network-id>8abc633a-810b-4ca5-8b3a-09511d13a2ce</network-id>
@@ -137,13 +137,13 @@ class DoCreateNetworkInstanceRollbackTest { <network-information>
<network-id>8abc633a-810b-4ca5-8b3a-09511d13a2ce</network-id>
<network-type>CONTRAIL_EXTERNAL</network-type>
- <ecomp-model-information>
+ <onap-model-information>
<model-invariant-uuid>invariant-uuid</model-invariant-uuid>
<model-customization-uuid>customization-uuid</model-customization-uuid>
<model-uuid>uuid</model-uuid>
<model-version>version</model-version>
<model-name>CONTRAIL_EXTERNAL</model-name>
- </ecomp-model-information>
+ </onap-model-information>
</network-information>
<network-request-information>
<network-id>8abc633a-810b-4ca5-8b3a-09511d13a2ce</network-id>
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstanceTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstanceTest.groovy index d0b87b3737..b45dd0bb4e 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstanceTest.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstanceTest.groovy @@ -2085,12 +2085,12 @@ String assignRpcSDNCRequest = <service-information>
<service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>
<subscription-service-type>MSO-dev-service-type</subscription-service-type>
- <ecomp-model-information>
+ <onap-model-information>
<model-invariant-uuid>fcc85cb0-ad74-45d7-a5a1-17c8744fdb71</model-invariant-uuid>
<model-uuid>36a3a8ea-49a6-4ac8-b06c-89a54544b9b6</model-uuid>
<model-version>1.0</model-version>
<model-name>HNGW Protected OAM</model-name>
- </ecomp-model-information>
+ </onap-model-information>
<service-instance-id>f70e927b-6087-4974-9ef8-c5e4d5847ca4</service-instance-id>
<global-customer-id>globalId_45678905678</global-customer-id>
<subscriber-name>MSO_1610_dev</subscriber-name>
@@ -2098,13 +2098,13 @@ String assignRpcSDNCRequest = <network-information>
<network-id>networkId</network-id>
<network-type>CONTRAIL_EXTERNAL</network-type>
- <ecomp-model-information>
+ <onap-model-information>
<model-invariant-uuid>sn5256d1-5a33-55df-13ab-12abad84e764</model-invariant-uuid>
<model-customization-uuid>sn5256d1-5a33-55df-13ab-12abad84e222</model-customization-uuid>
<model-uuid>sn5256d1-5a33-55df-13ab-12abad84e111</model-uuid>
<model-version>1</model-version>
<model-name>CONTRAIL_EXTERNAL</model-name>
- </ecomp-model-information>
+ </onap-model-information>
</network-information>
<network-request-input>
<network-name>MNS-25180-L-01-dmz_direct_net_1</network-name>
@@ -2139,12 +2139,12 @@ String activateSDNCRequest = <service-information>
<service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>
<subscription-service-type>MSO-dev-service-type</subscription-service-type>
- <ecomp-model-information>
+ <onap-model-information>
<model-invariant-uuid>fcc85cb0-ad74-45d7-a5a1-17c8744fdb71</model-invariant-uuid>
<model-uuid>36a3a8ea-49a6-4ac8-b06c-89a54544b9b6</model-uuid>
<model-version>1.0</model-version>
<model-name>HNGW Protected OAM</model-name>
- </ecomp-model-information>
+ </onap-model-information>
<service-instance-id>f70e927b-6087-4974-9ef8-c5e4d5847ca4</service-instance-id>
<global-customer-id>globalId_45678905678</global-customer-id>
<subscriber-name>MSO_1610_dev</subscriber-name>
@@ -2152,13 +2152,13 @@ String activateSDNCRequest = <network-information>
<network-id>networkId</network-id>
<network-type>CONTRAIL_EXTERNAL</network-type>
- <ecomp-model-information>
+ <onap-model-information>
<model-invariant-uuid>sn5256d1-5a33-55df-13ab-12abad84e764</model-invariant-uuid>
<model-customization-uuid>sn5256d1-5a33-55df-13ab-12abad84e222</model-customization-uuid>
<model-uuid>sn5256d1-5a33-55df-13ab-12abad84e111</model-uuid>
<model-version>1</model-version>
<model-name>CONTRAIL_EXTERNAL</model-name>
- </ecomp-model-information>
+ </onap-model-information>
</network-information>
<network-request-input>
<network-name>MNS-25180-L-01-dmz_direct_net_1</network-name>
@@ -2232,12 +2232,12 @@ String sdncRpcRollbackRequest = <service-information>
<service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>
<subscription-service-type>MSO-dev-service-type</subscription-service-type>
- <ecomp-model-information>
+ <onap-model-information>
<model-invariant-uuid>fcc85cb0-ad74-45d7-a5a1-17c8744fdb71</model-invariant-uuid>
<model-uuid>36a3a8ea-49a6-4ac8-b06c-89a54544b9b6</model-uuid>
<model-version>1.0</model-version>
<model-name>HNGW Protected OAM</model-name>
- </ecomp-model-information>
+ </onap-model-information>
<service-instance-id>f70e927b-6087-4974-9ef8-c5e4d5847ca4</service-instance-id>
<global-customer-id>globalId_45678905678</global-customer-id>
<subscriber-name>MSO_1610_dev</subscriber-name>
@@ -2245,13 +2245,13 @@ String sdncRpcRollbackRequest = <network-information>
<network-id>8abc633a-810b-4ca5-8b3a-09511d13a2ce</network-id>
<network-type>CONTRAIL_EXTERNAL</network-type>
- <ecomp-model-information>
+ <onap-model-information>
<model-invariant-uuid>sn5256d1-5a33-55df-13ab-12abad84e764</model-invariant-uuid>
<model-customization-uuid>sn5256d1-5a33-55df-13ab-12abad84e222</model-customization-uuid>
<model-uuid>sn5256d1-5a33-55df-13ab-12abad84e111</model-uuid>
<model-version>1</model-version>
<model-name>CONTRAIL_EXTERNAL</model-name>
- </ecomp-model-information>
+ </onap-model-information>
</network-information>
<network-request-input>
<network-name>MNS-25180-L-01-dmz_direct_net_1</network-name>
@@ -2286,12 +2286,12 @@ String sdncActivateRollbackRequest = <service-information>
<service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>
<subscription-service-type>MSO-dev-service-type</subscription-service-type>
- <ecomp-model-information>
+ <onap-model-information>
<model-invariant-uuid>fcc85cb0-ad74-45d7-a5a1-17c8744fdb71</model-invariant-uuid>
<model-uuid>36a3a8ea-49a6-4ac8-b06c-89a54544b9b6</model-uuid>
<model-version>1.0</model-version>
<model-name>HNGW Protected OAM</model-name>
- </ecomp-model-information>
+ </onap-model-information>
<service-instance-id>f70e927b-6087-4974-9ef8-c5e4d5847ca4</service-instance-id>
<global-customer-id>globalId_45678905678</global-customer-id>
<subscriber-name>MSO_1610_dev</subscriber-name>
@@ -2299,13 +2299,13 @@ String sdncActivateRollbackRequest = <network-information>
<network-id>8abc633a-810b-4ca5-8b3a-09511d13a2ce</network-id>
<network-type>CONTRAIL_EXTERNAL</network-type>
- <ecomp-model-information>
+ <onap-model-information>
<model-invariant-uuid>sn5256d1-5a33-55df-13ab-12abad84e764</model-invariant-uuid>
<model-customization-uuid>sn5256d1-5a33-55df-13ab-12abad84e222</model-customization-uuid>
<model-uuid>sn5256d1-5a33-55df-13ab-12abad84e111</model-uuid>
<model-version>1</model-version>
<model-name>CONTRAIL_EXTERNAL</model-name>
- </ecomp-model-information>
+ </onap-model-information>
</network-information>
<network-request-input>
<network-name>MNS-25180-L-01-dmz_direct_net_1</network-name>
@@ -2461,13 +2461,13 @@ String sdncAdapterWorkflowAssignResponse = <network-information>
<network-id>8abc633a-810b-4ca5-8b3a-09511d13a2ce</network-id>
<network-type>CONTRAIL_EXTERNAL</network-type>
- <ecomp-model-information>
+ <onap-model-information>
<model-invariant-uuid>invariant-uuid</model-invariant-uuid>
<model-customization-uuid>customization-uuid</model-customization-uuid>
<model-uuid>uuid</model-uuid>
<model-version>version</model-version>
<model-name>CONTRAIL_EXTERNAL</model-name>
- </ecomp-model-information>
+ </onap-model-information>
</network-information>
<network-request-information>
<network-id>8abc633a-810b-4ca5-8b3a-09511d13a2ce</network-id>
@@ -2508,13 +2508,13 @@ String sdncAdapterWorkflowAssignResponse = <network-information>
<network-id>8abc633a-810b-4ca5-8b3a-09511d13a2ce</network-id>
<network-type>CONTRAIL_EXTERNAL</network-type>
- <ecomp-model-information>
+ <onap-model-information>
<model-invariant-uuid>invariant-uuid</model-invariant-uuid>
<model-customization-uuid>customization-uuid</model-customization-uuid>
<model-uuid>uuid</model-uuid>
<model-version>version</model-version>
<model-name>CONTRAIL_EXTERNAL</model-name>
- </ecomp-model-information>
+ </onap-model-information>
</network-information>
<network-request-information>
<network-id>8abc633a-810b-4ca5-8b3a-09511d13a2ce</network-id>
@@ -3985,4 +3985,4 @@ String sdncAdapterWorkflowAssignResponse = return mockExecution
}
-}
\ No newline at end of file +} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceRollbackTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceRollbackTest.groovy index 96a84deb26..bdfd415440 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceRollbackTest.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceRollbackTest.groovy @@ -89,13 +89,13 @@ class DoDeleteNetworkInstanceRollbackTest { <network-information>
<network-id>8abc633a-810b-4ca5-8b3a-09511d13a2ce</network-id>
<network-type>CONTRAIL_EXTERNAL</network-type>
- <ecomp-model-information>
+ <onap-model-information>
<model-invariant-uuid>invariant-uuid</model-invariant-uuid>
<model-customization-uuid>customization-uuid</model-customization-uuid>
<model-uuid>uuid</model-uuid>
<model-version>version</model-version>
<model-name>CONTRAIL_EXTERNAL</model-name>
- </ecomp-model-information>
+ </onap-model-information>
</network-information>
<network-request-information>
<network-id>8abc633a-810b-4ca5-8b3a-09511d13a2ce</network-id>
@@ -136,13 +136,13 @@ class DoDeleteNetworkInstanceRollbackTest { <network-information>
<network-id>8abc633a-810b-4ca5-8b3a-09511d13a2ce</network-id>
<network-type>CONTRAIL_EXTERNAL</network-type>
- <ecomp-model-information>
+ <onap-model-information>
<model-invariant-uuid>invariant-uuid</model-invariant-uuid>
<model-customization-uuid>customization-uuid</model-customization-uuid>
<model-uuid>uuid</model-uuid>
<model-version>version</model-version>
<model-name>CONTRAIL_EXTERNAL</model-name>
- </ecomp-model-information>
+ </onap-model-information>
</network-information>
<network-request-information>
<network-id>8abc633a-810b-4ca5-8b3a-09511d13a2ce</network-id>
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceTest.groovy index 0f87b6400e..f1dbb4b768 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceTest.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceTest.groovy @@ -858,12 +858,12 @@ String aaiResponseWithRelationship = <service-information>
<service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>
<subscription-service-type>MSO-dev-service-type</subscription-service-type>
- <ecomp-model-information>
+ <onap-model-information>
<model-invariant-uuid>fcc85cb0-ad74-45d7-a5a1-17c8744fdb71</model-invariant-uuid>
<model-uuid>36a3a8ea-49a6-4ac8-b06c-89a54544b9b6</model-uuid>
<model-version>1.0</model-version>
<model-name>HNGW Protected OAM</model-name>
- </ecomp-model-information>
+ </onap-model-information>
<service-instance-id>f70e927b-6087-4974-9ef8-c5e4d5847ca4</service-instance-id>
<global-customer-id>globalId_45678905678</global-customer-id>
<subscriber-name/>
@@ -871,13 +871,13 @@ String aaiResponseWithRelationship = <network-information>
<network-id>networkId</network-id>
<network-type>CONTRAIL_EXTERNAL</network-type>
- <ecomp-model-information>
+ <onap-model-information>
<model-invariant-uuid>sn5256d1-5a33-55df-13ab-12abad84e764</model-invariant-uuid>
<model-customization-uuid>sn5256d1-5a33-55df-13ab-12abad84e222</model-customization-uuid>
<model-uuid>sn5256d1-5a33-55df-13ab-12abad84e111</model-uuid>
<model-version>1</model-version>
<model-name>CONTRAIL_EXTERNAL</model-name>
- </ecomp-model-information>
+ </onap-model-information>
</network-information>
<network-request-input>
<network-name>MNS-25180-L-01-dmz_direct_net_1</network-name>
@@ -912,12 +912,12 @@ String aaiResponseWithRelationship = <service-information>
<service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>
<subscription-service-type>MSO-dev-service-type</subscription-service-type>
- <ecomp-model-information>
+ <onap-model-information>
<model-invariant-uuid>fcc85cb0-ad74-45d7-a5a1-17c8744fdb71</model-invariant-uuid>
<model-uuid>36a3a8ea-49a6-4ac8-b06c-89a54544b9b6</model-uuid>
<model-version>1.0</model-version>
<model-name>HNGW Protected OAM</model-name>
- </ecomp-model-information>
+ </onap-model-information>
<service-instance-id>f70e927b-6087-4974-9ef8-c5e4d5847ca4</service-instance-id>
<global-customer-id>globalId_45678905678</global-customer-id>
<subscriber-name/>
@@ -925,13 +925,13 @@ String aaiResponseWithRelationship = <network-information>
<network-id>bdc5efe8-404a-409b-85f6-0dcc9eebae30</network-id>
<network-type>CONTRAIL_EXTERNAL</network-type>
- <ecomp-model-information>
+ <onap-model-information>
<model-invariant-uuid>sn5256d1-5a33-55df-13ab-12abad84e764</model-invariant-uuid>
<model-customization-uuid>sn5256d1-5a33-55df-13ab-12abad84e222</model-customization-uuid>
<model-uuid>sn5256d1-5a33-55df-13ab-12abad84e111</model-uuid>
<model-version>1</model-version>
<model-name>CONTRAIL_EXTERNAL</model-name>
- </ecomp-model-information>
+ </onap-model-information>
</network-information>
<network-request-input>
<network-name>MNS-25180-L-01-dmz_direct_net_1</network-name>
@@ -1926,4 +1926,4 @@ String sdncAdapterWorkflowFormattedResponse_404 = }
-}
\ No newline at end of file +} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollbackTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollbackTest.groovy index c97bedbac1..f4b1a87dd2 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollbackTest.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollbackTest.groovy @@ -88,13 +88,13 @@ class DoUpdateNetworkInstanceRollbackTest { <network-information>
<network-id>8abc633a-810b-4ca5-8b3a-09511d13a2ce</network-id>
<network-type>CONTRAIL_EXTERNAL</network-type>
- <ecomp-model-information>
+ <onap-model-information>
<model-invariant-uuid>invariant-uuid</model-invariant-uuid>
<model-customization-uuid>customization-uuid</model-customization-uuid>
<model-uuid>uuid</model-uuid>
<model-version>version</model-version>
<model-name>CONTRAIL_EXTERNAL</model-name>
- </ecomp-model-information>
+ </onap-model-information>
</network-information>
<network-request-information>
<network-id>8abc633a-810b-4ca5-8b3a-09511d13a2ce</network-id>
@@ -136,13 +136,13 @@ class DoUpdateNetworkInstanceRollbackTest { <network-information>
<network-id>8abc633a-810b-4ca5-8b3a-09511d13a2ce</network-id>
<network-type>CONTRAIL_EXTERNAL</network-type>
- <ecomp-model-information>
+ <onap-model-information>
<model-invariant-uuid>invariant-uuid</model-invariant-uuid>
<model-customization-uuid>customization-uuid</model-customization-uuid>
<model-uuid>uuid</model-uuid>
<model-version>version</model-version>
<model-name>CONTRAIL_EXTERNAL</model-name>
- </ecomp-model-information>
+ </onap-model-information>
</network-information>
<network-request-information>
<network-id>8abc633a-810b-4ca5-8b3a-09511d13a2ce</network-id>
@@ -312,4 +312,4 @@ class DoUpdateNetworkInstanceRollbackTest { return mockExecution
}
-}
\ No newline at end of file +} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceTest.groovy index fb44067b68..08088dd544 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceTest.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceTest.groovy @@ -1505,13 +1505,13 @@ String rollbackSDNCRequest = <network-information>
<network-id>8abc633a-810b-4ca5-8b3a-09511d13a2ce</network-id>
<network-type>CONTRAIL_EXTERNAL</network-type>
- <ecomp-model-information>
+ <onap-model-information>
<model-invariant-uuid>invariant-uuid</model-invariant-uuid>
<model-customization-uuid>customization-uuid</model-customization-uuid>
<model-uuid>uuid</model-uuid>
<model-version>version</model-version>
<model-name>CONTRAIL_EXTERNAL</model-name>
- </ecomp-model-information>
+ </onap-model-information>
</network-information>
<network-request-information>
<network-id>8abc633a-810b-4ca5-8b3a-09511d13a2ce</network-id>
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateSIRollbackTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateSIRollbackTest.java index 50cda81a58..852c8f922f 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateSIRollbackTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateSIRollbackTest.java @@ -136,12 +136,12 @@ public class DoCreateSIRollbackTest extends WorkflowTest { "<service-information>" + EOL +
"<service-id/>" + EOL +
"<subscription-service-type>123456789</subscription-service-type>" + EOL +
- "<ecomp-model-information>" + EOL +
+ "<onap-model-information>" + EOL +
"<model-invariant-uuid/>" + EOL +
"<model-uuid/>" + EOL +
"<model-version/>" + EOL +
"<model-name/>" + EOL +
- "</ecomp-model-information>" + EOL +
+ "</onap-model-information>" + EOL +
"<service-instance-id>MIS%252F1604%252F0026%252FSW_INTERNET</service-instance-id>" + EOL +
"<subscriber-name/>" + EOL +
"<global-customer-id>SDN-ETHERNET-INTERNET</global-customer-id>" + EOL +
@@ -174,12 +174,12 @@ public class DoCreateSIRollbackTest extends WorkflowTest { "<service-information>" + EOL +
"<service-id/>" + EOL +
"<subscription-service-type>123456789</subscription-service-type>" + EOL +
- "<ecomp-model-information>" + EOL +
+ "<onap-model-information>" + EOL +
"<model-invariant-uuid/>" + EOL +
"<model-uuid/>" + EOL +
"<model-version/>" + EOL +
"<model-name/>" + EOL +
- "</ecomp-model-information>" + EOL +
+ "</onap-model-information>" + EOL +
"<service-instance-id>MIS%252F1604%252F0026%252FSW_INTERNET</service-instance-id>" + EOL +
"<subscriber-name/>" + EOL +
"<global-customer-id>SDN-ETHERNET-INTERNET</global-customer-id>" + EOL +
@@ -196,4 +196,4 @@ public class DoCreateSIRollbackTest extends WorkflowTest { variables.put("rollbackData",rollbackData);
}
-}
\ No newline at end of file +} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryBRGCallback.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryBRGCallback.xml index d81b7e8f50..d47fbda01c 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryBRGCallback.xml +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryBRGCallback.xml @@ -1,12 +1,12 @@ <output xmlns="org:onap:sdnctl:vnf">
<brg-topology xmlns="org:onap:sdnctl:vnf">
- <ecomp-model-information>
+ <onap-model-information>
<model-invariant-uuid>36e20198-c67a-464b-96d0-aaa99eb2639e</model-invariant-uuid>
<model-uuid>5b9b15d0-5dd7-47dc-95b9-0440c340a3ba</model-uuid>
<model-version>1.0</model-version>
<model-name>BRGmodelname</model-name>
<model-customization-uuid>013bd784-9bca-4919-ae2f-ae57af27bad9</model-customization-uuid>
- </ecomp-model-information>
+ </onap-model-information>
<allotted-resource-identifiers>
<parent-service-instance-id>parent-service-instance-id</parent-service-instance-id>
<consuming-service-intance-id>consuming-service-instance-id</consuming-service-intance-id>
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryTXCCallback.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryTXCCallback.xml index f770ec6aff..9b201d9808 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryTXCCallback.xml +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryTXCCallback.xml @@ -1,12 +1,12 @@ <output xmlns="org:onap:sdnctl:vnf">
<tunnelxconn-topology xmlns="org:onap:sdnctl:vnf">
- <ecomp-model-information>
+ <onap-model-information>
<model-invariant-uuid>36e20198-c67a-464b-96d0-aaa99eb2639e</model-invariant-uuid>
<model-uuid>5b9b15d0-5dd7-47dc-95b9-0440c340a3ba</model-uuid>
<model-version>1.0</model-version>
<model-name>TXCmodelname</model-name>
<model-customization-uuid>013bd784-9bca-4919-ae2f-ae57af27bad9</model-customization-uuid>
- </ecomp-model-information>
+ </onap-model-information>
<allotted-resource-identifiers>
<parent-service-instance-id>parent-service-instance-id</parent-service-instance-id>
<consuming-service-intance-id>consuming-service-instance-id</consuming-service-intance-id>
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/SDNCTopologyQueryCallback.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/SDNCTopologyQueryCallback.xml index d81b7e8f50..d47fbda01c 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/SDNCTopologyQueryCallback.xml +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/SDNCTopologyQueryCallback.xml @@ -1,12 +1,12 @@ <output xmlns="org:onap:sdnctl:vnf">
<brg-topology xmlns="org:onap:sdnctl:vnf">
- <ecomp-model-information>
+ <onap-model-information>
<model-invariant-uuid>36e20198-c67a-464b-96d0-aaa99eb2639e</model-invariant-uuid>
<model-uuid>5b9b15d0-5dd7-47dc-95b9-0440c340a3ba</model-uuid>
<model-version>1.0</model-version>
<model-name>BRGmodelname</model-name>
<model-customization-uuid>013bd784-9bca-4919-ae2f-ae57af27bad9</model-customization-uuid>
- </ecomp-model-information>
+ </onap-model-information>
<allotted-resource-identifiers>
<parent-service-instance-id>parent-service-instance-id</parent-service-instance-id>
<consuming-service-intance-id>consuming-service-instance-id</consuming-service-intance-id>
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncActivateRollbackReq.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncActivateRollbackReq.xml index 6f86e0fb86..c86d9cf77f 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncActivateRollbackReq.xml +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncActivateRollbackReq.xml @@ -20,7 +20,7 @@ <service-information> <service-id></service-id> <subscription-service-type></subscription-service-type> - <ecomp-model-information></ecomp-model-information> + <onap-model-information></onap-model-information> <service-instance-id>MIS%252F1604%252F0026%252FSW_INTERNET</service-instance-id> <subscriber-name/> <global-customer-id></global-customer-id> @@ -29,13 +29,13 @@ <allotted-resource-id>arId-1</allotted-resource-id> <allotted-resource-type>brg</allotted-resource-type> <parent-service-instance-id>MIS%252F1604%252F0026%252FSW_INTERNET</parent-service-instance-id> - <ecomp-model-information> + <onap-model-information> <model-invariant-uuid></model-invariant-uuid> <model-uuid></model-uuid> <model-customization-uuid></model-customization-uuid> <model-version></model-version> <model-name></model-name> - </ecomp-model-information> + </onap-model-information> </allotted-resource-information> <brg-request-input> <source-network> diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncAssignRollbackReq.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncAssignRollbackReq.xml index 30d4c7ae49..4fe8bbcbde 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncAssignRollbackReq.xml +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncAssignRollbackReq.xml @@ -20,7 +20,7 @@ <service-information> <service-id></service-id> <subscription-service-type></subscription-service-type> - <ecomp-model-information></ecomp-model-information> + <onap-model-information></onap-model-information> <service-instance-id>MIS%252F1604%252F0026%252FSW_INTERNET</service-instance-id> <subscriber-name/> <global-customer-id></global-customer-id> @@ -29,13 +29,13 @@ <allotted-resource-id>arId-1</allotted-resource-id> <allotted-resource-type>brg</allotted-resource-type> <parent-service-instance-id>MIS%252F1604%252F0026%252FSW_INTERNET</parent-service-instance-id> - <ecomp-model-information> + <onap-model-information> <model-invariant-uuid></model-invariant-uuid> <model-uuid></model-uuid> <model-customization-uuid></model-customization-uuid> <model-version></model-version> <model-name></model-name> - </ecomp-model-information> + </onap-model-information> </allotted-resource-information> <brg-request-input> <source-network> diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncCreateRollbackReq.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncCreateRollbackReq.xml index e20850a7b9..7320038de4 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncCreateRollbackReq.xml +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncCreateRollbackReq.xml @@ -20,7 +20,7 @@ <service-information> <service-id></service-id> <subscription-service-type></subscription-service-type> - <ecomp-model-information></ecomp-model-information> + <onap-model-information></onap-model-information> <service-instance-id>MIS%252F1604%252F0026%252FSW_INTERNET</service-instance-id> <subscriber-name/> <global-customer-id></global-customer-id> @@ -29,13 +29,13 @@ <allotted-resource-id>arId-1</allotted-resource-id> <allotted-resource-type>brg</allotted-resource-type> <parent-service-instance-id>MIS%252F1604%252F0026%252FSW_INTERNET</parent-service-instance-id> - <ecomp-model-information> + <onap-model-information> <model-invariant-uuid></model-invariant-uuid> <model-uuid></model-uuid> <model-customization-uuid></model-customization-uuid> <model-version></model-version> <model-name></model-name> - </ecomp-model-information> + </onap-model-information> </allotted-resource-information> <brg-request-input> <source-network> diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/SDNCTopologyQueryCallback.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/SDNCTopologyQueryCallback.xml index f770ec6aff..9b201d9808 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/SDNCTopologyQueryCallback.xml +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/SDNCTopologyQueryCallback.xml @@ -1,12 +1,12 @@ <output xmlns="org:onap:sdnctl:vnf">
<tunnelxconn-topology xmlns="org:onap:sdnctl:vnf">
- <ecomp-model-information>
+ <onap-model-information>
<model-invariant-uuid>36e20198-c67a-464b-96d0-aaa99eb2639e</model-invariant-uuid>
<model-uuid>5b9b15d0-5dd7-47dc-95b9-0440c340a3ba</model-uuid>
<model-version>1.0</model-version>
<model-name>TXCmodelname</model-name>
<model-customization-uuid>013bd784-9bca-4919-ae2f-ae57af27bad9</model-customization-uuid>
- </ecomp-model-information>
+ </onap-model-information>
<allotted-resource-identifiers>
<parent-service-instance-id>parent-service-instance-id</parent-service-instance-id>
<consuming-service-intance-id>consuming-service-instance-id</consuming-service-intance-id>
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncActivateRollbackReq.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncActivateRollbackReq.xml index efec7eb001..6d2edbe9d6 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncActivateRollbackReq.xml +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncActivateRollbackReq.xml @@ -20,7 +20,7 @@ <service-information> <service-id></service-id> <subscription-service-type></subscription-service-type> - <ecomp-model-information></ecomp-model-information> + <onap-model-information></onap-model-information> <service-instance-id>MIS%252F1604%252F0026%252FSW_INTERNET</service-instance-id> <subscriber-name/> <global-customer-id></global-customer-id> @@ -29,13 +29,13 @@ <allotted-resource-id>arId-1</allotted-resource-id> <allotted-resource-type>tunnelxconn</allotted-resource-type> <parent-service-instance-id>MIS%252F1604%252F0026%252FSW_INTERNET</parent-service-instance-id> - <ecomp-model-information> + <onap-model-information> <model-invariant-uuid></model-invariant-uuid> <model-uuid></model-uuid> <model-customization-uuid></model-customization-uuid> <model-version></model-version> <model-name></model-name> - </ecomp-model-information> + </onap-model-information> </allotted-resource-information> <tunnelxconn-request-input> <source-network> diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncAssignRollbackReq.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncAssignRollbackReq.xml index 9f52758750..d33fadb427 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncAssignRollbackReq.xml +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncAssignRollbackReq.xml @@ -20,7 +20,7 @@ <service-information> <service-id></service-id> <subscription-service-type></subscription-service-type> - <ecomp-model-information></ecomp-model-information> + <onap-model-information></onap-model-information> <service-instance-id>MIS%252F1604%252F0026%252FSW_INTERNET</service-instance-id> <subscriber-name/> <global-customer-id></global-customer-id> @@ -29,13 +29,13 @@ <allotted-resource-id>arId-1</allotted-resource-id> <allotted-resource-type>tunnelxconn</allotted-resource-type> <parent-service-instance-id>MIS%252F1604%252F0026%252FSW_INTERNET</parent-service-instance-id> - <ecomp-model-information> + <onap-model-information> <model-invariant-uuid></model-invariant-uuid> <model-uuid></model-uuid> <model-customization-uuid></model-customization-uuid> <model-version></model-version> <model-name></model-name> - </ecomp-model-information> + </onap-model-information> </allotted-resource-information> <tunnelxconn-request-input> <source-network> diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncCreateRollbackReq.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncCreateRollbackReq.xml index 025195e326..4a90f1a573 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncCreateRollbackReq.xml +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncCreateRollbackReq.xml @@ -20,7 +20,7 @@ <service-information> <service-id></service-id> <subscription-service-type></subscription-service-type> - <ecomp-model-information></ecomp-model-information> + <onap-model-information></onap-model-information> <service-instance-id>MIS%252F1604%252F0026%252FSW_INTERNET</service-instance-id> <subscriber-name/> <global-customer-id></global-customer-id> @@ -29,13 +29,13 @@ <allotted-resource-id>arId-1</allotted-resource-id> <allotted-resource-type>tunnelxconn</allotted-resource-type> <parent-service-instance-id>MIS%252F1604%252F0026%252FSW_INTERNET</parent-service-instance-id> - <ecomp-model-information> + <onap-model-information> <model-invariant-uuid></model-invariant-uuid> <model-uuid></model-uuid> <model-customization-uuid></model-customization-uuid> <model-version></model-version> <model-name></model-name> - </ecomp-model-information> + </onap-model-information> </allotted-resource-information> <tunnelxconn-request-input> <source-network> diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModuleNoVnf.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModuleNoVnf.xml index 50a71c110e..13f675cd43 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModuleNoVnf.xml +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModuleNoVnf.xml @@ -5,13 +5,13 @@ <vf-module-type>vSAMP10aDEV::base::module-0</vf-module-type>
<vf-module-name>zmtn6nf-code-111_base_0</vf-module-name>
</vf-module-topology-identifier>
- <ecomp-model-information>
+ <onap-model-information>
<model-name>vSAMP10aDEV::base::module-0</model-name>
<model-customization-uuid>819ef122-ca19-4141-a61e-62922f8fc279</model-customization-uuid>
<model-version>ff2ae348-214a-11e7-93ae-92361f002673</model-version>
<model-invariant-uuid>3a97db99-c4bb-498a-a13a-38f65f1ced3d</model-invariant-uuid>
<model-uuid>ff2ae348-214a-11e7-93ae-92361f002673</model-uuid>
- </ecomp-model-information>
+ </onap-model-information>
<tenant>19123c2924c648eb8e42a3c1f14b7682</tenant>
<aic-cloud-region>mtn6</aic-cloud-region>
<aic-clli>AUSTTXGR</aic-clli>
@@ -78,4 +78,4 @@ </vms>
</vf-module-assignments>
</vf-module-topology>
-</output>
\ No newline at end of file +</output> diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVnf.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVnf.xml index bc2c7b9e63..dfb1986057 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVnf.xml +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVnf.xml @@ -9,13 +9,13 @@ <vnf-id>eac30f85-f61f-4c5f-862e-2c62f9e135de</vnf-id>
<vnf-type>null</vnf-type>
</vnf-topology-identifier-structure>
- <ecomp-model-information>
+ <onap-model-information>
<model-name>vSAMP10a_macro</model-name>
<model-customization-uuid>819ef122-ca19-4141-a61e-62922f8fc279</model-customization-uuid>
<model-version>1.0</model-version>
<model-invariant-uuid>ef176121-f02c-4dd3-927c-22131d48446b</model-invariant-uuid>
<model-uuid>ff2ae348-214a-11e7-93ae-92361f002672</model-uuid>
- </ecomp-model-information>
+ </onap-model-information>
<vnf-resource-assignments>
<vnf-networks>
<network-role>mog_exn</network-role>
@@ -79,4 +79,4 @@ <aic-cloud-region>mtn6</aic-cloud-region>
<aic-clli>AUSTTXGR</aic-clli>
</vnf-topology>
-</output>
\ No newline at end of file +</output> diff --git a/common/src/main/resources/ResourceAdapter.properties b/common/src/main/resources/ResourceAdapter.properties index 99952603ed..0dbbb3c936 100644 --- a/common/src/main/resources/ResourceAdapter.properties +++ b/common/src/main/resources/ResourceAdapter.properties @@ -331,7 +331,12 @@ RA_RECEIVE_WORKFLOW_MESSAGE=\ MSO-RA-5297I|\ Received Workflow Message: {0}|\ No resolution needed|\ - Received Workflow Message + Received Workflow Message +RA_NS_EXC=\ + MSO-RA-5298I|\ + VFC Adatper Message: {0}|\ + No resolution needed|\ + VFC Adatper Message RA_GENERAL_EXCEPTION_ARG=\ MSO-RA-9200E|\ Exception: {0}|\ diff --git a/docs/UUI-SO API Specification v0.1(1).docx b/docs/UUI-SO API Specification v0.1(1).docx Binary files differnew file mode 100644 index 0000000000..a6dfbd0b1a --- /dev/null +++ b/docs/UUI-SO API Specification v0.1(1).docx diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java index ecd0e4d4cc..c5827046d6 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java @@ -40,6 +40,7 @@ import javax.ws.rs.core.Response; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.codehaus.jackson.map.ObjectMapper; +import org.eclipse.jetty.io.RuntimeIOException; import org.hibernate.Session; import org.json.JSONObject; import org.openecomp.mso.apihandler.common.ErrorNumbers; @@ -67,6 +68,7 @@ import org.openecomp.mso.db.catalog.beans.ServiceRecipe; import org.openecomp.mso.logger.MessageEnum; import org.openecomp.mso.logger.MsoAlarmLogger; import org.openecomp.mso.logger.MsoLogger; +import org.openecomp.mso.properties.MsoDatabaseException; import org.openecomp.mso.requestsdb.InfraActiveRequests; import org.openecomp.mso.requestsdb.OperationStatus; import org.openecomp.mso.requestsdb.RequestsDatabase; @@ -761,7 +763,7 @@ public class E2EServiceInstances { } - private void createOperationStatusRecordForError(Action action, String requestId) { + private void createOperationStatusRecordForError(Action action, String requestId) throws MsoDatabaseException{ AbstractSessionFactoryManager requestsDbSessionFactoryManager = new RequestsDbSessionFactoryManager(); @@ -780,21 +782,24 @@ public class E2EServiceInstances { os.setResult("error"); os.setServiceId(requestId); os.setUserId(""); - os.setFinishedAt(new Timestamp(System.currentTimeMillis())); - os.setOperateAt(new Timestamp(System.currentTimeMillis())); + Timestamp startTimeStamp = new Timestamp (System.currentTimeMillis()); + Timestamp endTimeStamp = new Timestamp (System.currentTimeMillis()); + os.setFinishedAt(endTimeStamp); + os.setOperateAt(startTimeStamp); session.save(os); session.getTransaction().commit(); } catch (Exception e) { msoLogger.error (MessageEnum.APIH_DB_INSERT_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception when creation record request in Operation", e); + throw new MsoDatabaseException("Data did inserted in Operatus Status Table for failure", e); } finally { if (null != session) { session.close(); } } } - private void createOperationStatusRecord(String actionNm, String serviceId, String operationId) { + private void createOperationStatusRecord(String actionNm, String serviceId, String operationId) throws MsoDatabaseException{ AbstractSessionFactoryManager requestsDbSessionFactoryManager = new RequestsDbSessionFactoryManager(); @@ -814,14 +819,17 @@ public class E2EServiceInstances { os.setServiceId(serviceId); //TODO : to be updated... os.setUserId(""); - os.setFinishedAt(new Timestamp(System.currentTimeMillis())); - os.setOperateAt(new Timestamp(System.currentTimeMillis())); + Timestamp startTimeStamp = new Timestamp (System.currentTimeMillis()); + Timestamp endTimeStamp = new Timestamp (System.currentTimeMillis()); + os.setFinishedAt(endTimeStamp); + os.setOperateAt(startTimeStamp); session.save(os); session.getTransaction().commit(); } catch (Exception e) { msoLogger.error (MessageEnum.APIH_DB_INSERT_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception when creation record request in Operation", e); + throw new MsoDatabaseException("Data did inserted in Operatus Status Table", e); } finally { if (null != session) { session.close(); |