diff options
Diffstat (limited to 'bpmn/MSOInfrastructureBPMN/src/main/groovy')
4 files changed, 59 insertions, 65 deletions
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy index d4b853179c..d218adc279 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy @@ -81,36 +81,23 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor msg = "Input serviceInstanceId' is null"
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
-
- //String xmlRequestDetails = vidUtils.getJsonRequestDetailstoXml(siRequest)
- //execution.setVariable("requestDetails", xmlRequestDetails)
-
- //modelInfo
- String serviceModelInfo = jsonUtil.getJsonValue(siRequest, "requestDetails.modelInfo")
- if (isBlank(serviceModelInfo)) {
- msg = "Input serviceModelInfo is null"
- utils.log("DEBUG", msg, isDebugEnabled)
- } else
- {
- execution.setVariable("serviceModelInfo", serviceModelInfo)
- //utils.log("DEBUG", "modelInfo" + serviceModelInfo, isDebugEnabled)
- }
+
//requestInfo
- String productFamilyId = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.productFamilyId")
- if (isBlank(productFamilyId))
- {
- msg = "Input productFamilyId is null"
- utils.log("INFO", msg, isDebugEnabled)
- //exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else {
- execution.setVariable("productFamilyId", productFamilyId)
- }
- String source = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.source")
+// String productFamilyId = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.productFamilyId")
+// if (isBlank(productFamilyId))
+// {
+// msg = "Input productFamilyId is null"
+// utils.log("INFO", msg, isDebugEnabled)
+// //exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+// } else {
+// execution.setVariable("productFamilyId", productFamilyId)
+// }
+ String source = jsonUtil.getJsonValue(siRequest, "source")
execution.setVariable("source", source)
//subscriberInfo
- String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "requestDetails.subscriberInfo.globalSubscriberId")
+ String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "globalSubscriberId")
if (isBlank(globalSubscriberId)) {
msg = "Input globalSubscriberId' is null"
utils.log("INFO", msg, isDebugEnabled)
@@ -119,7 +106,7 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor }
//requestParameters
- String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.subscriptionServiceType")
+ String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "serviceType")
if (isBlank(subscriptionServiceType)) {
msg = "Input subscriptionServiceType is null"
utils.log("DEBUG", msg, isDebugEnabled)
@@ -127,29 +114,8 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor } else {
execution.setVariable("subscriptionServiceType", subscriptionServiceType)
}
-
- /*
- * Extracting User Parameters from incoming Request and converting into a Map
- */
- def jsonSlurper = new JsonSlurper()
- def jsonOutput = new JsonOutput()
-
- Map reqMap = jsonSlurper.parseText(siRequest)
-
- //InputParams
- def userParams = reqMap.requestDetails?.requestParameters?.userParams
-
- Map<String, String> inputMap = [:]
- if (userParams) {
- userParams.each {
- userParam -> inputMap.put(userParam.name, userParam.value.toString())
- }
- }
- execution.setVariable("operationType", "DELETE")
-
- utils.log("DEBUG", "User Input Parameters map: " + userParams.toString(), isDebugEnabled)
- execution.setVariable("serviceInputParams", inputMap)
+ execution.setVariable("operationType", "DELETE")
} catch (BpmnError e) {
throw e;
} catch (Exception ex){
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 1c8a5e70fe..98a1a43035 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 @@ -187,6 +187,11 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { } else { + InputSource source = new InputSource(new StringReader(siData)); + DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); + DocumentBuilder docBuilder = docFactory.newDocumentBuilder() + Document serviceXml = docBuilder.parse(source) + serviceXml.getDocumentElement().normalize() // get model invariant id // Get Template uuid and version if (utils.nodeExists(siData, "model-invariant-id") && utils.nodeExists(siData, "model-version-id") ) { @@ -203,13 +208,8 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { //Confirm there are no related service instances (vnf/network or volume) if (utils.nodeExists(siData, "relationship-list")) { utils.log("INFO", "SI Data relationship-list exists:", isDebugEnabled) - InputSource source = new InputSource(new StringReader(siData)); - DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); - DocumentBuilder docBuilder = docFactory.newDocumentBuilder() - Document serviceXml = docBuilder.parse(source) - serviceXml.getDocumentElement().normalize() //test(siData) - NodeList nodeList = serviceXml.getElementsByTagName("relationship") + NodeList nodeList = serviceXml.getElementsByTagName("relationship").item(0).getChildNodes() JSONArray jArray = new JSONArray() for (int x = 0; x < nodeList.getLength(); x++) { Node node = nodeList.item(x) @@ -225,12 +225,20 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { for (int i = 0; i < dataList.getLength(); i++) { Node dNode = dataList.item(i) if(dNode.getNodeName() == "relationship-data") { - Element rDataEle = (Element)dNode - def eKey = rDataEle.getElementsByTagName("relationship-key").item(0).getTextContent() - def eValue = rDataEle.getElementsByTagName("relationship-value").item(0).getTextContent() - if(eKey.equals("service-instance.service-instance-id")){ - jObj.put("resourceInstanceId", eValue) + + NodeList rdNodes = dNode.getChildNodes() + for(int j = 0; j < rdNodes.getLength(); j++) { + Node rdNode = rdNodes.item(j); + if (rdNode instanceof Element) { + Element rDataEle = (Element) rdNode + def eKey = rDataEle.getElementsByTagName("relationship-key").item(0).getTextContent() + def eValue = rDataEle.getElementsByTagName("relationship-value").item(0).getTextContent() + if (eKey.equals("service-instance.service-instance-id")) { + jObj.put("resourceInstanceId", eValue) + } + } } + } else if(dNode.getNodeName() == "related-to-property"){ Element rDataEle = (Element)dNode @@ -329,12 +337,13 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { try { utils.log("DEBUG", " ***** Inside prepareDecomposeService of create generic e2e service ***** ", isDebugEnabled) - String modelInvariantUuid = execution.getVariable("model-invariant-id") + 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":"${modelUuid}", - "modelVersion":"" + "modelUuid":"", + "modelVersion":"${modelVersionId}" }""" execution.setVariable("serviceModelInfo", serviceModelInfo) @@ -349,16 +358,18 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { public void postDecomposeService(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " ***** Inside processDecomposition() of create generic e2e service flow ***** ", isDebugEnabled) + utils.log("DEBUG", " ***** Inside processDecomposition() of delete generic e2e service flow ***** ", isDebugEnabled) try { ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") List<Resource> deleteResourceList = serviceDecomposition.getServiceResources() execution.setVariable("deleteResourceList", deleteResourceList) + execution.setVariable("resourceInstanceIDs", execution.getVariable("serviceRelationShip")) } catch (Exception ex) { String exceptionMessage = "Bpmn error encountered in create generic e2e service flow. processDecomposition() - " + ex.getMessage() utils.log("DEBUG", exceptionMessage, isDebugEnabled) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } + utils.log("DEBUG", " ***** exit processDecomposition() of delete generic e2e service flow ***** ", isDebugEnabled) } public void preInitResourcesOperStatus(DelegateExecution execution){ diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy index 7ded1946b4..023c80b3ba 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy @@ -211,7 +211,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { } catch (IOException ex) { String dataErrorMessage = " Unable to encode PO/SDNC user/password string - " + ex.getMessage() - utils.log("DEBUG", dataErrorMessage, , isDebugEnabled) + utils.log("DEBUG", dataErrorMessage, isDebugEnabled) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } 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 6c150df754..38dca886b4 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 @@ -41,6 +41,23 @@ import org.openecomp.mso.bpmn.infrastructure.properties.BPMNProperties import static org.apache.commons.lang3.StringUtils.isBlank import static org.apache.commons.lang3.StringUtils.isBlank + +/** + * input for script : + * msoRequestId + * isDebugLogEnabled + * globalSubscriberId + * serviceType + * serviceInstanceId + * URN_mso_workflow_sdncadapter_callback + * serviceInputParams + * deleteResourceList + * resourceInstanceIDs + * + * output from script: + * + */ + public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { String Prefix="DDR_" @@ -132,7 +149,7 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { List<String> resourceSequence = new ArrayList<String>() // get delete resource list and order list - List<Resource> delResourceList = execution.getVariable("delResourceList") + List<Resource> delResourceList = execution.getVariable("deleteResourceList") // existing resource list List<ServiceInstance> existResourceList = execution.getVariable("realNSRessources") |