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 --- .../mso/bpmn/common/recipe/BpmnRestClient.java | 9 +++-- .../bpmn/common/recipe/ResourceRecipeRequest.java | 18 +++++----- .../scripts/CreateSDNCNetworkResource.groovy | 22 ++++++++++++- .../scripts/CreateVFCNSResource.groovy | 9 +++-- .../scripts/DeleteSDNCNetworkResource.groovy | 22 ++++++++++++- .../process/CreateSDNCNetworkResource.bpmn | 30 +++++++++++++---- .../process/DeleteSDNCNetworkResource.bpmn | 38 ++++++++++++++++------ 7 files changed, 113 insertions(+), 35 deletions(-) diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnRestClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnRestClient.java index 1dc0451213..6a17d600cb 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnRestClient.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnRestClient.java @@ -58,13 +58,16 @@ public class BpmnRestClient { public static final String CAMUNDA_AUTH = "camundaAuth"; - private final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA"; + private static final String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA"; private static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory(); private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); private static boolean noProperties = true; + + //because for NS it will take a long time the time out of the resouce will be 2 hours. + private static final String DEFAULT_TIME_OUT = "7200"; public synchronized static MsoJavaProperties loadMsoProperties() { MsoJavaProperties msoProperties; @@ -174,8 +177,8 @@ public class BpmnRestClient { BpmnParam serviceInstanceIdInput = new BpmnParam(); BpmnParam serviceTypeInput = new BpmnParam(); BpmnParam recipeParamsInput = new BpmnParam(); - BpmnIntegerParam recipeTimeoutInput = new BpmnIntegerParam(); - recipeTimeoutInput.setValue(recipeTimeout); + BpmnParam recipeTimeoutInput = new BpmnParam(); + recipeTimeoutInput.setValue(DEFAULT_TIME_OUT); // host.setValue(parseURL()); requestIdInput.setValue(requestId); requestActionInput.setValue(requestAction); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/ResourceRecipeRequest.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/ResourceRecipeRequest.java index a1809fe754..ec60619dc6 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/ResourceRecipeRequest.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/ResourceRecipeRequest.java @@ -45,7 +45,7 @@ public class ResourceRecipeRequest { @JsonProperty("host") private BpmnParam host; - @JsonProperty("requestId") + @JsonProperty("mso-request-id") private BpmnParam requestId; @JsonProperty("requestAction") @@ -60,8 +60,8 @@ public class ResourceRecipeRequest { @JsonProperty("recipeParams") private BpmnParam recipeParams; - @JsonProperty("recipeTimeout") - private BpmnIntegerParam recipeTimeout; + @JsonProperty("mso-service-request-timeout") + private BpmnParam recipeTimeout; @JsonProperty("resourceInput") public BpmnParam getResourceInput() { @@ -83,12 +83,12 @@ public class ResourceRecipeRequest { this.host = host; } - @JsonProperty("requestId") + @JsonProperty("mso-request-id") public BpmnParam getRequestId() { return requestId; } - @JsonProperty("requestId") + @JsonProperty("mso-request-id") public void setRequestId(BpmnParam requestId) { this.requestId = requestId; } @@ -133,13 +133,13 @@ public class ResourceRecipeRequest { this.recipeParams = recipeParams; } - @JsonProperty("recipeTimeout") - public BpmnIntegerParam getRecipeTimeout() { + @JsonProperty("mso-service-request-timeout") + public BpmnParam getRecipeTimeout() { return recipeTimeout; } - @JsonProperty("recipeTimeout") - public void setRecipeTimeout(BpmnIntegerParam recipeTimeout) { + @JsonProperty("mso-service-request-timeout") + public void setRecipeTimeout(BpmnParam recipeTimeout) { this.recipeTimeout = recipeTimeout; } 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) + } } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateSDNCNetworkResource.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateSDNCNetworkResource.bpmn index 46555cf2d4..c074571265 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateSDNCNetworkResource.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateSDNCNetworkResource.bpmn @@ -14,7 +14,7 @@ def dcsi = new CreateSDNCNetworkResource() dcsi.prepareSDNCRequest(execution)]]> - SequenceFlow_0ow44q0 + SequenceFlow_17md60u @@ -31,7 +31,7 @@ dcsi.prepareSDNCRequest(execution)]]> SequenceFlow_1xk5xed - + SequenceFlow_1vnx1pp SequenceFlow_0ow44q0 @@ -117,6 +117,14 @@ dcsi.prepareUpdateAfterCreateSDNCResource(execution)]]> + + SequenceFlow_0ow44q0 + SequenceFlow_17md60u + + + @@ -145,9 +153,9 @@ dcsi.prepareUpdateAfterCreateSDNCResource(execution)]]> - + - + @@ -162,9 +170,9 @@ dcsi.prepareUpdateAfterCreateSDNCResource(execution)]]> - + - + @@ -235,6 +243,16 @@ dcsi.prepareUpdateAfterCreateSDNCResource(execution)]]> + + + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteSDNCNetworkResource.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteSDNCNetworkResource.bpmn index 7786299ab8..216b67a8bb 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteSDNCNetworkResource.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteSDNCNetworkResource.bpmn @@ -14,7 +14,7 @@ def dcsi = new DeleteSDNCNetworkResource() dcsi.prepareSDNCRequest(execution)]]> - SequenceFlow_0ow44q0 + SequenceFlow_15wux6a @@ -31,7 +31,7 @@ dcsi.prepareSDNCRequest(execution)]]> SequenceFlow_1xk5xed - + SequenceFlow_1vnx1pp SequenceFlow_0ow44q0 @@ -117,6 +117,14 @@ dcsi.prepareUpdateAfterDeleteSDNCResource(execution)]]> + + SequenceFlow_0ow44q0 + SequenceFlow_15wux6a + + + @@ -145,9 +153,9 @@ dcsi.prepareUpdateAfterDeleteSDNCResource(execution)]]> - + - + @@ -161,14 +169,14 @@ dcsi.prepareUpdateAfterDeleteSDNCResource(execution)]]> - - + + - + - + @@ -230,9 +238,19 @@ dcsi.prepareUpdateAfterDeleteSDNCResource(execution)]]> - + + + + + + + + + + + - + -- cgit 1.2.3-korg