diff options
author | subhash kumar singh <subhash.kumar.singh@huawei.com> | 2018-04-24 08:53:39 +0000 |
---|---|---|
committer | subhash kumar singh <subhash.kumar.singh@huawei.com> | 2018-04-24 08:55:51 +0000 |
commit | e230d73d1af3131d0af3323bd9d2e7ab9722cd64 (patch) | |
tree | 834fcffb203d25d952e1a07f4d8da847a3b1fa7e /bpmn/MSOInfrastructureBPMN/src/main/groovy | |
parent | fa1d708ff89dd3ed4230142997eef1827a9cb949 (diff) |
Fix the variables in delete E2E workflow
Fix the variables in delete E2E workflow.
Change-Id: I23973d475ebc634f30bbb913d51b581c1222be7a
Issue-ID: SO-422
Signed-off-by: subhash kumar singh <subhash.kumar.singh@huawei.com>
Diffstat (limited to 'bpmn/MSOInfrastructureBPMN/src/main/groovy')
3 files changed, 28 insertions, 22 deletions
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 479e091345..9358537448 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 @@ -29,7 +29,6 @@ import org.openecomp.mso.bpmn.infrastructure.properties.BPMNProperties; import org.apache.http.HttpResponse import org.json.JSONArray import org.openecomp.mso.bpmn.common.recipe.BpmnRestClient -import org.openecomp.mso.bpmn.common.recipe.ResourceInput; import static org.apache.commons.lang3.StringUtils.*; import groovy.xml.XmlUtil @@ -44,6 +43,8 @@ import org.openecomp.mso.bpmn.core.WorkflowException import org.openecomp.mso.rest.APIResponse; import org.openecomp.mso.rest.RESTClient import org.openecomp.mso.rest.RESTConfig +import org.openecomp.mso.bpmn.common.recipe.ResourceInput +import com.fasterxml.jackson.databind.ObjectMapper import java.util.List; import java.util.UUID; @@ -74,19 +75,19 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { String msg = "" try { - serviceInstanceId = execution.getVariable("serviceInstanceId") - serviceInstanceName = execution.getVariable("serviceInstanceName") - callbackURL = execution.getVariable("sdncCallbackUrl") - requestId = execution.getVariable("msoRequestId") - serviceId = execution.getVariable("productFamilyId") - subscriptionServiceType = execution.getVariable("subscriptionServiceType") - globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String serviceInstanceName = execution.getVariable("serviceInstanceName") + String callbackURL = execution.getVariable("sdncCallbackUrl") + String requestId = execution.getVariable("msoRequestId") + String serviceId = execution.getVariable("productFamilyId") + String subscriptionServiceType = execution.getVariable("subscriptionServiceType") + String globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId String recipeParamsFromRequest = execution.getVariable("recipeParams") String serviceModelInfo = execution.getVariable("serviceModelInfo") - modelInvariantUuid = "" - modelVersion = "" - modelUuid = "" - modelName = "" + String modelInvariantUuid = "" + String modelVersion = "" + String modelUuid = "" + String modelName = "" if (!isBlank(serviceModelInfo)) { @@ -122,7 +123,7 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { serviceType = "" } - sdncRequestId = UUID.randomUUID().toString() + String sdncRequestId = UUID.randomUUID().toString() String recipeParamsFromWf = execution.getVariable("recipeParamXsd") @@ -140,12 +141,13 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { operationType = "delete" + operationType + "Instance" - if(StringUtils.containsIgnoreCase(resourceInputObj.getResourceInstanceName(), "overlay")){ + ResourceInput resourceInput = new ObjectMapper().readValue(execution.getVariable("resourceInput"), ResourceInput.class) + if(StringUtils.containsIgnoreCase(resourceInput.getResourceModelInfo().getModelName(), "overlay")){ //This will be resolved in R3. sdnc_svcAction ="deactivate" operationType = "DeActivateDCINetworkInstance" } - if(StringUtils.containsIgnoreCase(resourceInputObj.getResourceInstanceName(), "underlay")){ + if(StringUtils.containsIgnoreCase(resourceInput.getResourceModelInfo().getModelName(), "underlay")){ //This will be resolved in R3. operationType ="DeleteNetworkInstance" } @@ -195,8 +197,8 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { //def sdncRequestId2 = UUID.randomUUID().toString() //String sdncDeactivate = sdncDelete.replace(">delete<", ">deactivate<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<") execution.setVariable("sdncDelete", sdncDelete) - execution.setVariable("sdncDeactivate", sdncDeactivate) - utils.log("INFO","sdncDeactivate:\n" + sdncDeactivate, isDebugEnabled) +// execution.setVariable("sdncDeactivate", sdncDeactivate) +// utils.log("INFO","sdncDeactivate:\n" + sdncDeactivate, isDebugEnabled) utils.log("INFO","sdncDelete:\n" + sdncDelete, isDebugEnabled) } catch (BpmnError e) { diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy index 2efd86eb99..ec7370fea3 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy @@ -332,11 +332,11 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { utils.log("DEBUG", " ***** Inside prepareDecomposeService of create generic e2e service ***** ", isDebugEnabled) String modelInvariantUuid = execution.getVariable("model-invariant-id-original") String modelVersionId = execution.getVariable("model-version-id-original") - //here modelVersion is not set, we use modelUuid to decompose the service. + String serviceModelInfo = """{ "modelInvariantUuid":"${modelInvariantUuid}", - "modelUuid":"${modelVersionId}", - "modelVersion":"" + "modelUuid":"", + "modelVersion":"${modelVersionId}" }""" execution.setVariable("serviceModelInfo", serviceModelInfo) diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy index a7f461b973..0fcc41c58e 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy @@ -243,7 +243,7 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { JSONObject resourceRecipe = cutils.getResourceRecipe(execution, resourceUuid, action) String recipeUri = resourceRecipe.getString("orchestrationUri") int recipeTimeout = resourceRecipe.getInt("recipeTimeout") - String recipeParamXsd = resourceRecipe.get("paramXSD") + String recipeParamXsd = resourceRecipe.isNull("paramXSD") ? "" : resourceRecipe.get("paramXSD") Resource currentResource = execution.getVariable("currentResource") @@ -255,7 +255,11 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { modelInfo.setModelCustomizationUuid(currentResource.getModelInfo().getModelCustomizationUuid()) modelInfo.setModelUuid(currentResource.getModelInfo().getModelCustomizationUuid()) modelInfo.setModelInvariantUuid(currentResource.getModelInfo().getModelInvariantUuid()) - resourceInput.setServiceModelInfo(modelInfo) + modelInfo.setModelName(currentResource.getModelInfo().getModelName()) + modelInfo.setModelVersion(currentResource.getModelInfo().getModelVersion()) + modelInfo.setModelType(currentResource.getModelInfo().getModelType()) + modelInfo.setModelInstanceName(currentResource.getModelInfo().getModelInstanceName()) + resourceInput.setResourceModelInfo(modelInfo) resourceInput.setServiceType(serviceType) String recipeURL = BPMNProperties.getProperty("bpelURL", "http://mso:8080") + recipeUri |