summaryrefslogtreecommitdiffstats
path: root/bpmn/MSOInfrastructureBPMN/src
diff options
context:
space:
mode:
authorZhuoyao Huang <10112215@zte.com.cn>2017-11-15 21:54:04 +0800
committerZhuoyao Huang <10112215@zte.com.cn>2017-11-15 22:05:45 +0800
commit0900a8bed342b8667052367fe5e24f369f357bb1 (patch)
tree0288515bb3d8af6a52ff1541d8d3815588cd5924 /bpmn/MSOInfrastructureBPMN/src
parent3718d0e47b49e3449dc21bbb02f5ab38f2206da8 (diff)
fix updateProgressv1.1.0
Change-Id: I91d63cacc0d1a55c3b07703890adecd95ba9410d Issue-ID:SO-181 Signed-off-by: Zhuoyao Huang <10112215@zte.com.cn>
Diffstat (limited to 'bpmn/MSOInfrastructureBPMN/src')
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy4
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java21
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java6
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java3
4 files changed, 22 insertions, 12 deletions
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy
index b94db498bb..7e957be00a 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy
@@ -110,7 +110,7 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
String returnCode = apiResponse.getStatusCode()
String apiResponseAsString = apiResponse.getResponseBodyAsString()
String operationStatus = "error";
- if(returnCode== "200"){
+ if(returnCode== "200" || returnCode== "202"){
operationStatus = "finished"
}
execution.setVariable("operationStatus", operationStatus)
@@ -130,7 +130,7 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
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", jobId)
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 c6db924a20..823223fbd8 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
@@ -44,6 +44,7 @@ import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.Generic
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;
@@ -342,6 +343,8 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
logger.error("exception: AbstractSdncOperationTask.fail!:", e);
e.printStackTrace();
execution.setVariable("SDNCA_SuccessIndicator", false);
+ updateProgress(execution, RequestsDbConstant.Status.ERROR, null, "100", "sendRestrequestAndHandleResponse finished!");
+
}
logger.info("AbstractSdncOperationTask.execute end!");
}
@@ -350,16 +353,18 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
logger.info("AbstractSdncOperationTask.getInputs begin!");
Map<String, String> inputs = new HashMap<>();
String json = (String) execution.getVariable(SDCADAPTOR_INPUTS);
- JSONObject jsonObject = new JSONObject(json);
- JSONObject paras = jsonObject.getJSONObject("additionalParamForNs");
- Iterator<String> iterator = paras.keys();
- while (iterator.hasNext()) {
- String key = iterator.next();
- inputs.put(key, paras.getString(key));
- }
+ if (!StringUtils.isBlank(json)) {
+ JSONObject jsonObject = new JSONObject(json);
+ JSONObject paras = jsonObject.getJSONObject("additionalParamForNs");
+ Iterator<String> iterator = paras.keys();
+ while (iterator.hasNext()) {
+ String key = iterator.next();
+ inputs.put(key, paras.getString(key));
+ }
/* if (paras.keys().hasNext()) {
paras.keySet().stream().forEach(key -> inputs.put(key, paras.getString((String) key)));
}*/
+ }
logger.info("AbstractSdncOperationTask.getInputs end!");
return inputs;
}
@@ -375,8 +380,10 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
String statusDescription) {
logger.info("AbstractSdncOperationTask.updateProgress begin!");
String serviceId = (String) execution.getVariable("serviceId");
+ serviceId = StringUtils.isBlank(serviceId) ? (String) execution.getVariable("serviceInstanceId") : serviceId;
String operationId = (String) execution.getVariable("operationId");
String resourceTemplateUUID = (String) execution.getVariable("resourceUUID");
+ resourceTemplateUUID = StringUtils.isBlank(resourceTemplateUUID) ? (String) execution.getVariable("resourceTemplateId") : resourceTemplateUUID;
try {
ResourceOperationStatus resourceOperationStatus = getResourceOperationStatus(serviceId, operationId, resourceTemplateUUID);
if (!StringUtils.isBlank(status)) {
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 34cb4f1043..698f0c54dc 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
@@ -52,10 +52,10 @@ public class SdncNetworkTopologyOperationTask extends AbstractSdncOperationTask
Map<String, String> inputs,
GenericResourceApi genericResourceApiClient) throws Exception {
logger.info("SdncNetworkTopologyOperationTask.sendRestrequestAndHandleResponse begin!");
- updateProgress(execution, null, null, "40", "sendRestrequestAndHandleResponse begin!");
+ updateProgress(execution, RequestsDbConstant.Status.PROCESSING, null, "40", "sendRestrequestAndHandleResponse begin!");
NetworkRpcInputEntityBuilder builder = new NetworkRpcInputEntityBuilder();
RpcNetworkTopologyOperationInputEntity inputEntity = builder.build(execution, inputs);
- updateProgress(execution, null, null, "50", "RequestBody build finished!");
+ updateProgress(execution, RequestsDbConstant.Status.PROCESSING, null, "50", "RequestBody build finished!");
RpcNetworkTopologyOperationOutputEntity outputEntity;
if (!isSend2SdncDirectly()) {
outputEntity = genericResourceApiClient.postNetworkTopologyOperation
@@ -92,7 +92,7 @@ public class SdncNetworkTopologyOperationTask 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), "100", errorMessage);
logger.info("exception: SdncNetworkTopologyOperationTask.saveOutput fail!");
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 119ac42e76..869c7783ef 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
@@ -20,6 +20,7 @@
package org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask;
+import org.apache.commons.lang3.StringUtils;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.openecomp.mso.bpmn.core.BaseTask;
import org.openecomp.mso.requestsdb.RequestsDatabase;
@@ -40,8 +41,10 @@ public class SdncUnderlayVpnPreprocessTask extends BaseTask {
private String getOperType(DelegateExecution execution) {
String serviceId = (String) execution.getVariable("serviceId");
+ serviceId = StringUtils.isBlank(serviceId) ? (String) execution.getVariable("serviceInstanceId") : serviceId;
String operationId = (String) execution.getVariable("operationId");
String resourceTemplateUUID = (String) execution.getVariable("resourceUUID");
+ resourceTemplateUUID = StringUtils.isBlank(resourceTemplateUUID) ? (String) execution.getVariable("resourceTemplateId") : resourceTemplateUUID;
ResourceOperationStatus resourceOperationStatus = requestsDB.getResourceOperationStatus(serviceId, operationId, resourceTemplateUUID);
return resourceOperationStatus.getOperType();
}