From b86a86fb01e9bb5c44098007a2e158d5b4fa17f0 Mon Sep 17 00:00:00 2001 From: c00149107 Date: Wed, 25 Apr 2018 17:19:13 +0800 Subject: Set Resource Recipe Time Out Val Set Resource Recipe Time Out Val Change-Id: I7f304465c71837ee37e5fa99a48ca14d97d8f91f Issue-ID: SO-587 Signed-off-by: c00149107 --- .../scripts/CreateSDNCNetworkResource.groovy | 22 +++++++++++++++++++++- .../scripts/CreateVFCNSResource.groovy | 9 ++++----- .../scripts/DeleteSDNCNetworkResource.groovy | 22 +++++++++++++++++++++- 3 files changed, 46 insertions(+), 7 deletions(-) (limited to 'bpmn/MSOInfrastructureBPMN/src/main/groovy/org') diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy index f265638423..43b32a4d85 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy @@ -67,7 +67,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { try { //get bpmn inputs from resource request. - String requestId = execution.getVariable("requestId") + String requestId = execution.getVariable("mso-request-id") String requestAction = execution.getVariable("requestAction") utils.log("INFO","The requestAction is: " + requestAction, isDebugEnabled) String recipeParamsFromRequest = execution.getVariable("recipeParams") @@ -318,4 +318,24 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { utils.log("INFO","response from sdnc, response code :" + responseCode + " response object :" + responseObj, isDebugEnabled) utils.log("INFO"," ***** Exit prepareSDNCRequest *****", isDebugEnabled) } + + public void sendSyncResponse (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled) + + try { + String operationStatus = "finished" + // RESTResponse for main flow + String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim() + utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + resourceOperationResp, isDebugEnabled) + sendWorkflowResponse(execution, 202, resourceOperationResp) + execution.setVariable("sentSyncResponse", true) + + } catch (Exception ex) { + String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," ***** Exit sendSyncResopnse *****", isDebugEnabled) + } } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy index 9f3910beed..5390ee92db 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy @@ -269,7 +269,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { utils.log("INFO", " ======== Started Execute AAI Put Process ======== ", isDebugEnabled) APIResponse apiResponse = null try{ - String uuid = utils.getRequestID() + String uuid = execution.getVariable("mso-request-id"); utils.log("INFO","Generated uuid is: " + uuid, isDebugEnabled) utils.log("INFO","URL to be used is: " + url, isDebugEnabled) String userName = execution.getVariable("URN_aai_auth") @@ -317,12 +317,11 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled) try { - String nsInstanceId = execution.getVariable("nsInstanceId") String operationStatus = execution.getVariable("operationStatus") // RESTResponse for main flow - String createVFCResourceRestRsp = """{"nsInstanceId":"${nsInstanceId}","operationStatus":"${operationStatus}"}""".trim() - utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + createVFCResourceRestRsp, isDebugEnabled) - sendWorkflowResponse(execution, 202, createVFCResourceRestRsp) + String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim() + utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + resourceOperationResp, isDebugEnabled) + sendWorkflowResponse(execution, 202, resourceOperationResp) execution.setVariable("sentSyncResponse", true) } catch (Exception ex) { diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy index 73230c6f21..447fa63baf 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy @@ -67,7 +67,7 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { try { //get bpmn inputs from resource request. - String requestId = execution.getVariable("requestId") + String requestId = execution.getVariable("mso-request-id") String requestAction = execution.getVariable("requestAction") utils.log("INFO","The requestAction is: " + requestAction, isDebugEnabled) String recipeParamsFromRequest = execution.getVariable("recipeParams") @@ -297,4 +297,24 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { utils.log("INFO","response from sdnc, response code :" + responseCode + " response object :" + responseObj, isDebugEnabled) utils.log("INFO"," ***** Exit prepareSDNCRequest *****", isDebugEnabled) } + + public void sendSyncResponse (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled) + + try { + String operationStatus = "finished" + // RESTResponse for main flow + String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim() + utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + resourceOperationResp, isDebugEnabled) + sendWorkflowResponse(execution, 202, resourceOperationResp) + execution.setVariable("sentSyncResponse", true) + + } catch (Exception ex) { + String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," ***** Exit sendSyncResopnse *****", isDebugEnabled) + } } -- cgit 1.2.3-korg