fix query ns scale endless loop 35/49335/1
authorguanwenyao <guanwenyao@chinamobile.com>
Tue, 29 May 2018 10:04:08 +0000 (18:04 +0800)
committerguanwenyao <guanwenyao@chinamobile.com>
Tue, 29 May 2018 10:18:45 +0000 (18:18 +0800)
Issue-ID: SO-634

Change-Id: I79ac70be79345c966642dc5b99c25b4a39dc575d
Signed-off-by: guanwenyao <guanwenyao@chinamobile.com>
bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy

index 0e4aea0..321741b 100644 (file)
@@ -95,12 +95,11 @@ public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcess
      * scale NS task
      */
     public void scaleNetworkService(DelegateExecution execution) {
+        def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
 
         String saleNsRequest = execution.getVariable("reqBody")
         String[] nsReqStr = saleNsRequest.split("\\|")
 
-        def jobIdArray = ['jobId001', 'jobId002'] as String[]
-
         for (int i = 0; i < nsReqStr.length; i++) {
             JSONObject reqBodyJsonObj = new JSONObject(nsReqStr[i])
             String nsInstanceId = reqBodyJsonObj.getJSONObject("nsScaleParameters").getString("nsInstanceId")
@@ -114,11 +113,11 @@ public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcess
             String returnCode = apiResponse.getStatusCode()
             String aaiResponseAsString = apiResponse.getResponseBodyAsString()
             String jobId = "";
-            if (returnCode == "200") {
+            if (returnCode == "200" || returnCode == "202") {
                 jobId = jsonUtil.getJsonValue(aaiResponseAsString, "jobId")
             }
-
-            execution.setVariable("jobId", jobIdArray[i])
+            utils.log("INFO", "scaleNetworkService get a ns scale job Id:" + jobId, isDebugEnabled)
+            execution.setVariable("jobId", jobId)
 
             String isScaleFinished = ""