Set Resource Recipe Time Out Val 37/44637/1
authorc00149107 <chenchuanyu@huawei.com>
Wed, 25 Apr 2018 09:19:13 +0000 (17:19 +0800)
committerc00149107 <chenchuanyu@huawei.com>
Wed, 25 Apr 2018 09:19:13 +0000 (17:19 +0800)
Set Resource Recipe Time Out Val

Change-Id: I7f304465c71837ee37e5fa99a48ca14d97d8f91f
Issue-ID: SO-587
Signed-off-by: c00149107 <chenchuanyu@huawei.com>
bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnRestClient.java
bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/ResourceRecipeRequest.java
bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy
bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy
bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy
bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateSDNCNetworkResource.bpmn
bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteSDNCNetworkResource.bpmn

index 1dc0451..6a17d60 100644 (file)
@@ -58,13 +58,16 @@ public class BpmnRestClient {
 \r
     public static final String CAMUNDA_AUTH = "camundaAuth";\r
 \r
-    private final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";\r
+    private static final  String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";\r
 \r
     private static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();\r
 \r
     private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);\r
 \r
     private static boolean noProperties = true;\r
+    \r
+    //because for NS it will take a long time the time out of the resouce will be 2 hours.\r
+    private static final String DEFAULT_TIME_OUT = "7200";\r
 \r
     public synchronized static MsoJavaProperties loadMsoProperties() {\r
         MsoJavaProperties msoProperties;\r
@@ -174,8 +177,8 @@ public class BpmnRestClient {
             BpmnParam serviceInstanceIdInput = new BpmnParam();\r
             BpmnParam serviceTypeInput = new BpmnParam();\r
             BpmnParam recipeParamsInput = new BpmnParam();\r
-            BpmnIntegerParam recipeTimeoutInput = new BpmnIntegerParam();\r
-            recipeTimeoutInput.setValue(recipeTimeout);\r
+            BpmnParam recipeTimeoutInput = new BpmnParam();\r
+            recipeTimeoutInput.setValue(DEFAULT_TIME_OUT);\r
             // host.setValue(parseURL());\r
             requestIdInput.setValue(requestId);\r
             requestActionInput.setValue(requestAction);\r
index a1809fe..ec60619 100644 (file)
@@ -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;
        }
 
index f265638..43b32a4 100644 (file)
@@ -67,7 +67,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
         try {           \r
             \r
             //get bpmn inputs from resource request.\r
-            String requestId = execution.getVariable("requestId")\r
+            String requestId = execution.getVariable("mso-request-id")\r
             String requestAction = execution.getVariable("requestAction")\r
             utils.log("INFO","The requestAction is: " + requestAction,  isDebugEnabled)\r
             String recipeParamsFromRequest = execution.getVariable("recipeParams")\r
@@ -318,4 +318,24 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
         utils.log("INFO","response from sdnc, response code :" + responseCode + "  response object :" + responseObj,  isDebugEnabled)\r
         utils.log("INFO"," ***** Exit prepareSDNCRequest *****",  isDebugEnabled)\r
     }\r
+    \r
+       public void sendSyncResponse (DelegateExecution execution) {\r
+               def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
+               utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled)\r
+\r
+               try {\r
+                       String operationStatus = "finished"\r
+                       // RESTResponse for main flow\r
+                       String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim()\r
+                       utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + resourceOperationResp, isDebugEnabled)\r
+                       sendWorkflowResponse(execution, 202, resourceOperationResp)\r
+                       execution.setVariable("sentSyncResponse", true)\r
+\r
+               } catch (Exception ex) {\r
+                       String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage()\r
+                       utils.log("DEBUG", msg, isDebugEnabled)\r
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)\r
+               }\r
+               utils.log("DEBUG"," ***** Exit sendSyncResopnse *****",  isDebugEnabled)\r
+       }\r
 }\r
index 9f3910b..5390ee9 100644 (file)
@@ -269,7 +269,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
         utils.log("INFO", " ======== Started Execute AAI Put Process ======== ",  isDebugEnabled) \r
         APIResponse apiResponse = null\r
         try{\r
-            String uuid = utils.getRequestID()\r
+            String uuid = execution.getVariable("mso-request-id");\r
             utils.log("INFO","Generated uuid is: " + uuid,  isDebugEnabled) \r
             utils.log("INFO","URL to be used is: " + url,  isDebugEnabled) \r
             String userName = execution.getVariable("URN_aai_auth")\r
@@ -317,12 +317,11 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
                utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled)\r
 \r
                try {\r
-                       String nsInstanceId = execution.getVariable("nsInstanceId")\r
                        String operationStatus = execution.getVariable("operationStatus")\r
                        // RESTResponse for main flow\r
-                       String createVFCResourceRestRsp = """{"nsInstanceId":"${nsInstanceId}","operationStatus":"${operationStatus}"}""".trim()\r
-                       utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + createVFCResourceRestRsp, isDebugEnabled)\r
-                       sendWorkflowResponse(execution, 202, createVFCResourceRestRsp)\r
+                       String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim()\r
+                       utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + resourceOperationResp, isDebugEnabled)\r
+                       sendWorkflowResponse(execution, 202, resourceOperationResp)\r
                        execution.setVariable("sentSyncResponse", true)\r
 \r
                } catch (Exception ex) {\r
index 73230c6..447fa63 100644 (file)
@@ -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)
+       }
 }
index 46555cf..c074571 100644 (file)
@@ -14,7 +14,7 @@ def dcsi = new CreateSDNCNetworkResource()
 dcsi.prepareSDNCRequest(execution)]]></bpmn:script>
     </bpmn:scriptTask>
     <bpmn:endEvent id="EndEvent_1x6k78c" name="create SDNC call end">
-      <bpmn:incoming>SequenceFlow_0ow44q0</bpmn:incoming>
+      <bpmn:incoming>SequenceFlow_17md60u</bpmn:incoming>
     </bpmn:endEvent>
     <bpmn:callActivity id="CallActivity_1600xlj" name="Call SDNC RSRC Create&#10; Adapter V1&#10;" calledElement="sdncAdapter">
       <bpmn:extensionElements>
@@ -31,7 +31,7 @@ dcsi.prepareSDNCRequest(execution)]]></bpmn:script>
       <bpmn:outgoing>SequenceFlow_1xk5xed</bpmn:outgoing>
     </bpmn:callActivity>
     <bpmn:sequenceFlow id="SequenceFlow_1xk5xed" sourceRef="CallActivity_1600xlj" targetRef="Task_0uwlr22" />
-    <bpmn:sequenceFlow id="SequenceFlow_0ow44q0" sourceRef="Task_023hred" targetRef="EndEvent_1x6k78c" />
+    <bpmn:sequenceFlow id="SequenceFlow_0ow44q0" sourceRef="Task_023hred" targetRef="ScriptTask_1g5zyi6" />
     <bpmn:scriptTask id="Task_023hred" name="post SDNC create call">
       <bpmn:incoming>SequenceFlow_1vnx1pp</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_0ow44q0</bpmn:outgoing>
@@ -117,6 +117,14 @@ dcsi.prepareUpdateAfterCreateSDNCResource(execution)]]></bpmn:script>
     </bpmn:serviceTask>
     <bpmn:sequenceFlow id="SequenceFlow_1jr6zi0" sourceRef="Task_0uwlr22" targetRef="ServiceTask_1cm8iwr" />
     <bpmn:sequenceFlow id="SequenceFlow_1vnx1pp" sourceRef="ServiceTask_1cm8iwr" targetRef="Task_023hred" />
+    <bpmn:scriptTask id="ScriptTask_1g5zyi6" name="Send Sync Ack Response" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0ow44q0</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_17md60u</bpmn:outgoing>
+      <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
+def csi = new  CreateSDNCNetworkResource()
+csi.sendSyncResponse(execution)]]></bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_17md60u" sourceRef="ScriptTask_1g5zyi6" targetRef="EndEvent_1x6k78c" />
   </bpmn:process>
   <bpmndi:BPMNDiagram id="BPMNDiagram_1">
     <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CreateSDNCNetworkResource">
@@ -145,9 +153,9 @@ dcsi.prepareUpdateAfterCreateSDNCResource(execution)]]></bpmn:script>
         <dc:Bounds x="313" y="89" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c">
-        <dc:Bounds x="875" y="317" width="36" height="36" />
+        <dc:Bounds x="1040" y="317" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="836" y="359" width="86" height="24" />
+          <dc:Bounds x="1004" y="359" width="81" height="28" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="CallActivity_1600xlj_di" bpmnElement="CallActivity_1600xlj">
@@ -162,9 +170,9 @@ dcsi.prepareUpdateAfterCreateSDNCResource(execution)]]></bpmn:script>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_0ow44q0_di" bpmnElement="SequenceFlow_0ow44q0">
         <di:waypoint xsi:type="dc:Point" x="795" y="335" />
-        <di:waypoint xsi:type="dc:Point" x="875" y="335" />
+        <di:waypoint xsi:type="dc:Point" x="856" y="335" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="790" y="314" width="90" height="12" />
+          <dc:Bounds x="780.5" y="314" width="90" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ScriptTask_0gyej62_di" bpmnElement="Task_023hred">
@@ -235,6 +243,16 @@ dcsi.prepareUpdateAfterCreateSDNCResource(execution)]]></bpmn:script>
           <dc:Bounds x="641" y="314" width="0" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ScriptTask_1g5zyi6_di" bpmnElement="ScriptTask_1g5zyi6">
+        <dc:Bounds x="856" y="295" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_17md60u_di" bpmnElement="SequenceFlow_17md60u">
+        <di:waypoint xsi:type="dc:Point" x="956" y="335" />
+        <di:waypoint xsi:type="dc:Point" x="1040" y="335" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="998" y="313" width="0" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
     </bpmndi:BPMNPlane>
   </bpmndi:BPMNDiagram>
 </bpmn:definitions>
index 7786299..216b67a 100644 (file)
@@ -14,7 +14,7 @@ def dcsi = new DeleteSDNCNetworkResource()
 dcsi.prepareSDNCRequest(execution)]]></bpmn:script>
     </bpmn:scriptTask>
     <bpmn:endEvent id="EndEvent_1x6k78c" name="delete SDNC call end">
-      <bpmn:incoming>SequenceFlow_0ow44q0</bpmn:incoming>
+      <bpmn:incoming>SequenceFlow_15wux6a</bpmn:incoming>
     </bpmn:endEvent>
     <bpmn:callActivity id="CallActivity_1600xlj" name="Call SDNC RSRC &#10; Adapter V1&#10;" calledElement="sdncAdapter">
       <bpmn:extensionElements>
@@ -31,7 +31,7 @@ dcsi.prepareSDNCRequest(execution)]]></bpmn:script>
       <bpmn:outgoing>SequenceFlow_1xk5xed</bpmn:outgoing>
     </bpmn:callActivity>
     <bpmn:sequenceFlow id="SequenceFlow_1xk5xed" sourceRef="CallActivity_1600xlj" targetRef="Task_0uwlr22" />
-    <bpmn:sequenceFlow id="SequenceFlow_0ow44q0" sourceRef="Task_023hred" targetRef="EndEvent_1x6k78c" />
+    <bpmn:sequenceFlow id="SequenceFlow_0ow44q0" sourceRef="Task_023hred" targetRef="ScriptTask_1emjxm2" />
     <bpmn:scriptTask id="Task_023hred" name="post SDNC delete call">
       <bpmn:incoming>SequenceFlow_1vnx1pp</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_0ow44q0</bpmn:outgoing>
@@ -117,6 +117,14 @@ dcsi.prepareUpdateAfterDeleteSDNCResource(execution)]]></bpmn:script>
     </bpmn:serviceTask>
     <bpmn:sequenceFlow id="SequenceFlow_1jr6zi0" sourceRef="Task_0uwlr22" targetRef="ServiceTask_1cm8iwr" />
     <bpmn:sequenceFlow id="SequenceFlow_1vnx1pp" sourceRef="ServiceTask_1cm8iwr" targetRef="Task_023hred" />
+    <bpmn:scriptTask id="ScriptTask_1emjxm2" name="Send Sync Ack Response" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0ow44q0</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_15wux6a</bpmn:outgoing>
+      <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
+def csi = new  DeleteSDNCNetworkResource()
+csi.sendSyncResponse(execution)]]></bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_15wux6a" sourceRef="ScriptTask_1emjxm2" targetRef="EndEvent_1x6k78c" />
   </bpmn:process>
   <bpmndi:BPMNDiagram id="BPMNDiagram_1">
     <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeleteSDNCNetworkResource">
@@ -145,9 +153,9 @@ dcsi.prepareUpdateAfterDeleteSDNCResource(execution)]]></bpmn:script>
         <dc:Bounds x="313" y="89" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c">
-        <dc:Bounds x="875" y="317" width="36" height="36" />
+        <dc:Bounds x="967" y="317" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="841" y="359" width="79" height="28" />
+          <dc:Bounds x="933" y="359" width="79" height="28" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="CallActivity_1600xlj_di" bpmnElement="CallActivity_1600xlj">
@@ -161,14 +169,14 @@ dcsi.prepareUpdateAfterDeleteSDNCResource(execution)]]></bpmn:script>
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_0ow44q0_di" bpmnElement="SequenceFlow_0ow44q0">
-        <di:waypoint xsi:type="dc:Point" x="795" y="335" />
-        <di:waypoint xsi:type="dc:Point" x="875" y="335" />
+        <di:waypoint xsi:type="dc:Point" x="735" y="335" />
+        <di:waypoint xsi:type="dc:Point" x="793" y="335" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="790" y="314" width="90" height="12" />
+          <dc:Bounds x="719" y="314" width="90" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ScriptTask_0gyej62_di" bpmnElement="Task_023hred">
-        <dc:Bounds x="695" y="295" width="100" height="80" />
+        <dc:Bounds x="635" y="295" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_0w2es8j_di" bpmnElement="SequenceFlow_0w2es8j">
         <di:waypoint xsi:type="dc:Point" x="90" y="129" />
@@ -230,9 +238,19 @@ dcsi.prepareUpdateAfterDeleteSDNCResource(execution)]]></bpmn:script>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_1vnx1pp_di" bpmnElement="SequenceFlow_1vnx1pp">
         <di:waypoint xsi:type="dc:Point" x="587" y="335" />
-        <di:waypoint xsi:type="dc:Point" x="695" y="335" />
+        <di:waypoint xsi:type="dc:Point" x="635" y="335" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="566" y="314" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ScriptTask_1emjxm2_di" bpmnElement="ScriptTask_1emjxm2">
+        <dc:Bounds x="793" y="295" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_15wux6a_di" bpmnElement="SequenceFlow_15wux6a">
+        <di:waypoint xsi:type="dc:Point" x="893" y="335" />
+        <di:waypoint xsi:type="dc:Point" x="967" y="335" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="641" y="314" width="0" height="12" />
+          <dc:Bounds x="930" y="313" width="0" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
     </bpmndi:BPMNPlane>