aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtils.groovy15
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy4
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy65
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy21
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy136
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy11
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy11
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java26
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java9
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java3
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVcpeResCustService.bpmn4
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy81
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DeleteVcpeResCustServiceTest.groovy104
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRGTest.groovy6
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXCTest.groovy6
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getSI.xml36
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/serviceToDelete.xml36
17 files changed, 372 insertions, 202 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtils.groovy
index 94b423669d..06992455a2 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtils.groovy
@@ -59,6 +59,21 @@ class MsoUtils {
}
return nodes
}
+ /**
+ * Note: this uses XmlParser instead of XmlSlurper, thus it is not as
+ * efficient because it instantiates the whole DOM tree.
+ * @param xmlInput
+ * @param element
+ * @return a list of Nodes, or {@code null} if <i>xmlInput</i> is {@code null}
+ */
+ def getMultNodeObjects(xmlInput, element){
+ def nodes=null
+ if(xmlInput!=null){
+ def xml= new XmlParser().parseText(xmlInput)
+ nodes = xml.'**'.findAll{ node-> node.name() == element }
+ }
+ return nodes
+ }
def getNodeText1(xmlInput,element){
def rtn=null
if(xmlInput!=null){
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/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy
index 41663434db..9d9f0bb25a 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy
@@ -19,6 +19,7 @@ import org.springframework.web.util.UriUtils
import org.w3c.dom.Document
import org.w3c.dom.Element
import org.xml.sax.InputSource
+import static org.apache.commons.lang3.StringUtils.*
public class DoDeleteVfModuleFromVnf extends VfModuleBase {
@@ -118,19 +119,10 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
utils.logAudit("DoDeleteVfModuleFromVnf: AAI endPoint : " + endPoint)
try {
- RESTConfig config = new RESTConfig(endPoint);
- def responseData = ''
- def aaiRequestId = UUID.randomUUID().toString()
- RESTClient client = new RESTClient(config).
- addHeader('X-TransactionId', aaiRequestId).
- addHeader('X-FromAppId', 'MSO').
- addHeader('Content-Type', 'application/xml').
- addHeader('Accept','application/xml');
- logDebug('sending GET to AAI endpoint \'' + endPoint + '\'', isDebugLogEnabled)
- APIResponse response = client.httpGet()
utils.logAudit("DoDeleteVfModuleFromVnf: - invoking httpGet to AAI")
+ APIResponse response = aaiUriUtil.executeAAIGetCall(execution, endPoint)
- responseData = response.getResponseBodyAsString()
+ def responseData = response.getResponseBodyAsString()
execution.setVariable('DDVMFV_getVnfResponseCode', response.getStatusCode())
execution.setVariable('DDVMFV_getVnfResponse', responseData)
@@ -416,37 +408,28 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
execution.setVariable("DDVFMV_vnfVfModuleDeleteCompleted", true)
// Parse vnfOutputs for contrail network polcy FQDNs
- if (vnfResponse.contains("vfModuleOutputs")) {
- def vfModuleOutputsXml = utils.getNodeXml(vnfResponse, "vfModuleOutputs")
- InputSource source = new InputSource(new StringReader(vfModuleOutputsXml));
- DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
- docFactory.setNamespaceAware(true)
- DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
- Document outputsXml = docBuilder.parse(source)
-
- NodeList entries = outputsXml.getElementsByTagNameNS("*", "entry")
+ def vfModuleOutputsXml = utils.getNodeXml(vnfResponse, "vfModuleOutputs")
+ if(!isBlank(vfModuleOutputsXml)) {
+ vfModuleOutputsXml = utils.removeXmlNamespaces(vfModuleOutputsXml)
List contrailNetworkPolicyFqdnList = []
- for (int i = 0; i< entries.getLength(); i++) {
- Node node = entries.item(i)
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element element = (Element) node
- String key = element.getElementsByTagNameNS("*", "key").item(0).getTextContent()
- if (key.endsWith("contrail_network_policy_fqdn")) {
- String contrailNetworkPolicyFqdn = element.getElementsByTagNameNS("*", "value").item(0).getTextContent()
- logDebug("Obtained contrailNetworkPolicyFqdn: " + contrailNetworkPolicyFqdn, isDebugLogEnabled)
- contrailNetworkPolicyFqdnList.add(contrailNetworkPolicyFqdn)
- }
- else if (key.equals("oam_management_v4_address")) {
- String oamManagementV4Address = element.getElementsByTagNameNS("*", "value").item(0).getTextContent()
- logDebug("Obtained oamManagementV4Address: " + oamManagementV4Address, isDebugLogEnabled)
- execution.setVariable(Prefix + "oamManagementV4Address", oamManagementV4Address)
- }
- else if (key.equals("oam_management_v6_address")) {
- String oamManagementV6Address = element.getElementsByTagNameNS("*", "value").item(0).getTextContent()
- logDebug("Obtained oamManagementV6Address: " + oamManagementV6Address, isDebugLogEnabled)
- execution.setVariable(Prefix + "oamManagementV6Address", oamManagementV6Address)
- }
-
+ for(Node node: utils.getMultNodeObjects(vfModuleOutputsXml, "entry")) {
+ String key = utils.getChildNodeText(node, "key")
+ if(key == null) {
+
+ } else if (key.endsWith("contrail_network_policy_fqdn")) {
+ String contrailNetworkPolicyFqdn = utils.getChildNodeText(node, "value")
+ logDebug("Obtained contrailNetworkPolicyFqdn: " + contrailNetworkPolicyFqdn, isDebugLogEnabled)
+ contrailNetworkPolicyFqdnList.add(contrailNetworkPolicyFqdn)
+ }
+ else if (key.equals("oam_management_v4_address")) {
+ String oamManagementV4Address = utils.getChildNodeText(node, "value")
+ logDebug("Obtained oamManagementV4Address: " + oamManagementV4Address, isDebugLogEnabled)
+ execution.setVariable(Prefix + "oamManagementV4Address", oamManagementV4Address)
+ }
+ else if (key.equals("oam_management_v6_address")) {
+ String oamManagementV6Address = utils.getChildNodeText(node, "value")
+ logDebug("Obtained oamManagementV6Address: " + oamManagementV6Address, isDebugLogEnabled)
+ execution.setVariable(Prefix + "oamManagementV6Address", oamManagementV6Address)
}
}
if (!contrailNetworkPolicyFqdnList.isEmpty()) {
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy
index 703ea8be6d..dd6d4514bc 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy
@@ -343,6 +343,9 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
// VNFs
List<VnfResource> vnfList = serviceDecomposition.getServiceVnfs()
+ filterVnfs(vnfList)
+ serviceDecomposition.setServiceVnfs(vnfList)
+
execution.setVariable("vnfList", vnfList)
execution.setVariable("vnfListString", vnfList.toString())
@@ -372,6 +375,24 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
}
+
+ private void filterVnfs(List<VnfResource> vnfList) {
+ if(vnfList == null) {
+ return
+ }
+
+ // remove BRG & TXC from VNF list
+
+ Iterator<VnfResource> it = vnfList.iterator()
+ while(it.hasNext()) {
+ VnfResource vr = it.next()
+
+ String role = vr.getNfRole()
+ if(role == "BRG" || role == "TunnelXConn") {
+ it.remove()
+ }
+ }
+ }
public void prepareCreateAllottedResourceTXC(Execution execution) {
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy
index 77ef3f6fe0..16fb22a6d3 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy
@@ -30,6 +30,7 @@ import org.openecomp.mso.bpmn.core.json.JsonUtils
import org.openecomp.mso.bpmn.core.WorkflowException
import org.openecomp.mso.rest.APIResponse
import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.openecomp.mso.bpmn.common.scripts.AaiUtil
import java.util.UUID;
@@ -40,6 +41,7 @@ import org.json.JSONArray;
import org.apache.commons.lang3.*
import org.apache.commons.codec.binary.Base64;
import org.springframework.web.util.UriUtils;
+import static org.apache.commons.lang3.StringUtils.*
/**
* This groovy class supports the <class>DeleteVcpeResCustService.bpmn</class> process.
@@ -145,7 +147,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor {
execution.setVariable("tenantId", tenantId)
utils.log("DEBUG","tenantId: "+ tenantId, isDebugEnabled)
- String sdncVersion = "1702"
+ String sdncVersion = "1707"
execution.setVariable("sdncVersion", sdncVersion)
utils.log("DEBUG","sdncVersion: "+ sdncVersion, isDebugEnabled)
@@ -194,7 +196,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor {
public void prepareServiceDelete(Execution execution) {
def isDebugEnabled=execution.getVariable(DebugFlag)
- utils.log("DEBUG", " ***** Inside prepareServiceInstanceDelete() of DeleteVcpeResCustService ***** ", isDebugEnabled)
+ utils.log("DEBUG", " ***** Inside prepareServiceDelete() of DeleteVcpeResCustService ***** ", isDebugEnabled)
try {
@@ -214,81 +216,95 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor {
String serviceInstanceAaiRecord = execution.getVariable("GENGS_service");
utils.log("DEBUG", "serviceInstanceAaiRecord: "+serviceInstanceAaiRecord, isDebugEnabled)
+ serviceInstanceAaiRecord = utils.removeXmlNamespaces(serviceInstanceAaiRecord)
- // determine if AR needs to be deleted
- boolean DVRCS_TunnelXConn = false
- boolean DVRCS_BRG = false
- String TXC_allottedResourceId
- String BRG_allottedResourceId
- XmlParser xmlParser = new XmlParser()
- def groovy.util.Node siNode = xmlParser.parseText(serviceInstanceAaiRecord)
- def groovy.util.Node arList = utils.getChildNode(siNode, 'allotted-resources')
- if (arList != null) {
- def groovy.util.NodeList ars = utils.getIdenticalChildren(arList, 'allotted-resource')
- for (groovy.util.Node ar in ars) {
- def type = utils.getChildNodeText(ar, 'type')
- if ("TunnelXConn".equals(type)) {
+ def (TXC_found, TXC_id) = new Tuple(false, null)
+ def (BRG_found, BRG_id) = new Tuple(false, null)
+ List relatedVnfIdList = []
+
+ for(Node rel: utils.getMultNodeObjects(serviceInstanceAaiRecord, "relationship")) {
+ def relto = utils.getChildNodeText(rel, "related-to")
+ def relink = utils.getChildNodeText(rel, "related-link")
+ utils.log("DEBUG", "check: "+relto+" link: "+relink, isDebugEnabled)
+
+ if(isBlank(relto) || isBlank(relink)) {
+
+ } else if(relto == "generic-vnf") {
+ def id = relink.substring(relink.indexOf("/generic-vnf/")+13)
+ if(id.endsWith("/")) {
+ id = id.substring(0, id.length()-1)
+ }
+
+ relatedVnfIdList.add(id)
+
+ } else if(relto == "allotted-resource") {
+ def (type, id) = getAaiAr(execution, relink)
+
+ if(isBlank(type) || isBlank(id)) {
+
+ } else if(type == "TunnelXConn") {
utils.log("DEBUG","TunnelXConn AR found", isDebugEnabled)
- def id = utils.getChildNodeText(ar, 'id')
- if (id != null){
- DVRCS_TunnelXConn = true
- TXC_allottedResourceId = id
- }
- } else if ("BRG".equals(type)) {
- utils.log("DEBUG","FW AR found", isDebugEnabled)
- def id = utils.getChildNodeText(ar, 'id')
- if (id != null){
- DVRCS_BRG = true
- BRG_allottedResourceId = id
- }
+ TXC_found = true
+ TXC_id = id
+
+ } else if(type == "BRG") {
+ utils.log("DEBUG","BRG AR found", isDebugEnabled)
+ BRG_found = true
+ BRG_id = id
}
}
}
- execution.setVariable(Prefix+"TunnelXConn", DVRCS_TunnelXConn)
- utils.log("DEBUG", Prefix+"TunnelXConn : " + DVRCS_TunnelXConn, isDebugEnabled)
- execution.setVariable("TXC_allottedResourceId", TXC_allottedResourceId)
- utils.log("DEBUG", "TXC_allottedResourceId : " + TXC_allottedResourceId, isDebugEnabled)
- execution.setVariable(Prefix+"BRG", DVRCS_BRG)
- utils.log("DEBUG", Prefix+"BRG : " + DVRCS_BRG, isDebugEnabled)
- execution.setVariable("BRG_allottedResourceId", BRG_allottedResourceId)
- utils.log("DEBUG", "BRG_allottedResourceId : " + BRG_allottedResourceId, isDebugEnabled)
-
- String relationship = ""
- try {
- relationship = networkUtils.getFirstNodeXml(serviceInstanceAaiRecord, "relationship-list")
- } catch (Exception ex) {
- //no relationships found
- }
- utils.log("DEBUG", " relationship string - " + relationship, isDebugEnabled)
+ execution.setVariable(Prefix+"TunnelXConn", TXC_found)
+ execution.setVariable("TXC_allottedResourceId", TXC_id)
+ utils.log("DEBUG", "TXC_allottedResourceId: " + TXC_id, isDebugEnabled)
+
+ execution.setVariable(Prefix+"BRG", BRG_found)
+ execution.setVariable("BRG_allottedResourceId", BRG_id)
+ utils.log("DEBUG", "BRG_allottedResourceId: " + BRG_id, isDebugEnabled)
- int vnfsCount = 0
-
- if (relationship != null && relationship.length() > 0){
- relationship = relationship.trim().replace("tag0:","").replace(":tag0","")
-
- // Check if Network TableREf is present, then build a List of network policy
- List relatedVnfIdList = networkUtils.getRelatedVnfIdList(relationship)
- vnfsCount = relatedVnfIdList.size()
- execution.setVariable(Prefix+"vnfsCount", vnfsCount)
- utils.log("DEBUG", " "+Prefix+"vnfsCount : " + vnfsCount, isDebugEnabled)
+ int vnfsCount = relatedVnfIdList.size()
+ execution.setVariable(Prefix+"vnfsCount", vnfsCount)
+ utils.log("DEBUG", " "+Prefix+"vnfsCount : " + vnfsCount, isDebugEnabled)
+ if(vnfsCount > 0) {
execution.setVariable(Prefix+"relatedVnfIdList", relatedVnfIdList)
- } else {
- execution.setVariable(Prefix+"vnfsCount", 0)
- utils.log("DEBUG", " "+Prefix+"vnfsCount : " + vnfsCount, isDebugEnabled)
}
- utils.log("DEBUG", " ***** Completed prepareServiceInstanceDelete() of DeleteVcpeResCustService ***** ", isDebugEnabled)
+ utils.log("DEBUG", " ***** Completed prepareServiceDelete() of DeleteVcpeResCustService ***** ", isDebugEnabled)
} catch (BpmnError e){
throw e;
} catch (Exception ex) {
sendSyncError(execution)
- String exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. prepareServiceInstanceDelete() - " + ex.getMessage()
- utils.log("DEBUG", exceptionMessage, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ String exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. prepareServiceDelete() - " + ex.getMessage()
+ utils.log("DEBUG", exceptionMessage, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
}
+ private getAaiAr(Execution execution, String relink) {
+ def isDebugEnabled = execution.getVariable(DebugFlag)
+ AaiUtil aaiUtil = new AaiUtil(this)
+ String aaiEndpoint = execution.getVariable("URN_aai_endpoint") + relink
+
+ utils.log("DEBUG", "get AR info " + aaiEndpoint, isDebugEnabled)
+ APIResponse response = aaiUtil.executeAAIGetCall(execution, aaiEndpoint)
+
+ int responseCode = response.getStatusCode()
+ utils.log("DEBUG", "get AR info responseCode:" + responseCode, isDebugEnabled)
+
+ String aaiResponse = response.getResponseBodyAsString()
+ utils.log("DEBUG", "get AR info " + aaiResponse, isDebugEnabled)
+
+ if(responseCode < 200 || responseCode >= 300 || isBlank(aaiResponse)) {
+ return new Tuple2(null, null)
+ }
+
+ def type = utils.getNodeText1(aaiResponse, "type")
+ def id = utils.getNodeText1(aaiResponse, "id")
+
+ return new Tuple2(type, id)
+ }
+
// *******************************
//
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy
index 167c9c8b54..38ac23e5a1 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy
@@ -46,6 +46,9 @@ import static org.apache.commons.lang3.StringUtils.*
* @param - disableRollback - O ignored
* @param - failNotfound - O
* @param - serviceInstanceId
+ * @param - globalCustomerId - O
+ * @param - subscriptionServiceType - O
+ * @param - parentServiceInstanceId
* @param - allottedResourceId
*
* Outputs:
@@ -155,6 +158,8 @@ public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{
String allottedResourceId = execution.getVariable("allottedResourceId")
String serviceInstanceId = execution.getVariable("serviceInstanceId")
String parentServiceInstanceId = execution.getVariable("parentServiceInstanceId")
+ String globalCustomerId = execution.getVariable("globalCustomerId")
+ String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
String callbackUrl = execution.getVariable("sdncCallbackUrl")
String requestId = execution.getVariable("msoRequestId")
@@ -194,11 +199,11 @@ public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{
</request-information>
<service-information>
<service-id></service-id>
- <subscription-service-type></subscription-service-type>
+ <subscription-service-type>${subscriptionServiceType}</subscription-service-type>
<onap-model-information></onap-model-information>
- <service-instance-id>${parentServiceInstanceId}</service-instance-id>
+ <service-instance-id>${serviceInstanceId}</service-instance-id>
<subscriber-name/>
- <global-customer-id></global-customer-id>
+ <global-customer-id>${globalCustomerId}</global-customer-id>
</service-information>
<allotted-resource-information>
<allotted-resource-id>${allottedResourceId}</allotted-resource-id>
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy
index eb045eb54b..a5b7c1350d 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy
@@ -46,6 +46,9 @@ import static org.apache.commons.lang3.StringUtils.*
* @param - disableRollback - O ignored
* @param - failNotfound - O
* @param - serviceInstanceId
+ * @param - globalCustomerId - O
+ * @param - subscriptionServiceType - O
+ * @param - parentServiceInstanceId
* @param - allottedResourceId
*
* Outputs:
@@ -155,6 +158,8 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{
String allottedResourceId = execution.getVariable("allottedResourceId")
String serviceInstanceId = execution.getVariable("serviceInstanceId")
String parentServiceInstanceId = execution.getVariable("parentServiceInstanceId")
+ String globalCustomerId = execution.getVariable("globalCustomerId")
+ String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
String callbackUrl = execution.getVariable("sdncCallbackUrl")
String requestId = execution.getVariable("msoRequestId")
@@ -194,11 +199,11 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{
</request-information>
<service-information>
<service-id></service-id>
- <subscription-service-type></subscription-service-type>
+ <subscription-service-type>${subscriptionServiceType}</subscription-service-type>
<onap-model-information></onap-model-information>
- <service-instance-id>${parentServiceInstanceId}</service-instance-id>
+ <service-instance-id>${serviceInstanceId}</service-instance-id>
<subscriber-name/>
- <global-customer-id></global-customer-id>
+ <global-customer-id>${globalCustomerId}</global-customer-id>
</service-information>
<allotted-resource-information>
<allotted-resource-id>${allottedResourceId}</allotted-resource-id>
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 6ca93f7238..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;
@@ -330,9 +331,10 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
logger.info("AbstractSdncOperationTask.execute begin!");
GenericResourceApi genericResourceApiClient = getGenericResourceApiClient(execution);
// updateProgress(execution, RequestsDbConstant.Status.PROCESSING, null, "10", "execute begin!");
- Map<String, String> inputs = getInputs(execution);
-// updateProgress(execution, null, null, "30", "getGenericResourceApiClient finished!");
try {
+ Map<String, String> inputs = getInputs(execution);
+// updateProgress(execution, null, null, "30", "getGenericResourceApiClient finished!");
+
sendRestrequestAndHandleResponse(execution, inputs, genericResourceApiClient);
execution.setVariable("SDNCA_SuccessIndicator", true);
// updateProgress(execution, RequestsDbConstant.Status.FINISHED, null, RequestsDbConstant.Progress.ONE_HUNDRED, "execute finished!");
@@ -341,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!");
}
@@ -349,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;
}
@@ -374,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 e8bfcf5caa..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
@@ -65,6 +65,7 @@ public class SdncNetworkTopologyOperationTask extends AbstractSdncOperationTask
} else {
Send2SdncDirectly(HeaderUtil.DefaulAuth, inputEntity);
}
+ updateProgress(execution, RequestsDbConstant.Status.FINISHED, null, RequestsDbConstant.Progress.ONE_HUNDRED, "execute finished!");
logger.info("SdncNetworkTopologyOperationTask.sendRestrequestAndHandleResponse end!");
}
@@ -91,11 +92,11 @@ 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("");
}
- updateProgress(execution, RequestsDbConstant.Status.FINISHED, null, RequestsDbConstant.Progress.ONE_HUNDRED, "execute finished!");
+
logger.info("SdncNetworkTopologyOperationTask.saveOutput end!");
}
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();
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVcpeResCustService.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVcpeResCustService.bpmn
index 88c45afda2..e8b18e6dca 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVcpeResCustService.bpmn
+++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVcpeResCustService.bpmn
@@ -181,6 +181,8 @@ DeleteVcpeResCustService.prepareServiceDelete(execution)]]></bpmn2:script>
<camunda:in source="BRG_allottedResourceId" target="allottedResourceId" />
<camunda:out source="WorkflowException" target="WorkflowException" />
<camunda:out source="rolledBack" target="rolledBack" />
+ <camunda:in source="globalCustomerId" target="globalCustomerId" />
+ <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
</bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_05cjs89</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_0snq0kw</bpmn2:outgoing>
@@ -235,6 +237,8 @@ DeleteVcpeResCustService.prepareServiceDelete(execution)]]></bpmn2:script>
<camunda:in source="TXC_allottedResourceId" target="allottedResourceId" />
<camunda:out source="WorkflowException" target="WorkflowException" />
<camunda:out source="rolledBack" target="rolledBack" />
+ <camunda:in source="globalCustomerId" target="globalCustomerId" />
+ <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
</bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_0npvfo3</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_0et9p0i</bpmn2:outgoing>
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy
index f0645b2bc7..70050422ee 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy
@@ -370,7 +370,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase {
// @Ignore
public void processDecomposition() {
ExecutionEntity mex = setupMock()
- def svcdecomp = initProcessDecomposition(mex, true, true)
+ def svcdecomp = initProcessDecomposition(mex)
CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
CreateVcpeResCustService.processDecomposition(mex)
@@ -378,8 +378,8 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase {
verify(mex).getVariable(DBGFLAG)
verify(mex).setVariable("vnfList", svcdecomp.getServiceVnfs())
- verify(mex).setVariable("vnfListString", '[myvnf, myvnf2, myvnf3]')
- verify(mex).setVariable(Prefix+"VNFsCount", 3)
+ verify(mex).setVariable("vnfListString", '[myvnf]')
+ verify(mex).setVariable(Prefix+"VNFsCount", 1)
verify(mex).setVariable("vnfModelInfo", "mymodel")
verify(mex).setVariable("vnfModelInfoString", "mymodel")
@@ -389,7 +389,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase {
// @Ignore
public void processDecomposition_EmptyNet_EmptyVnf() {
ExecutionEntity mex = setupMock()
- def svcdecomp = initProcessDecomposition(mex, true, true)
+ def svcdecomp = initProcessDecomposition(mex)
when(svcdecomp.getServiceVnfs()).thenReturn(new LinkedList<VnfResource>())
@@ -410,7 +410,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase {
// @Ignore
public void processDecomposition_Ex() {
ExecutionEntity mex = setupMock()
- def svcdecomp = initProcessDecomposition(mex, true, true)
+ def svcdecomp = initProcessDecomposition(mex)
when(svcdecomp.getServiceVnfs()).thenThrow(new RuntimeException("expected exception"))
@@ -420,6 +420,35 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase {
}
+ // ***** filterVnfs *****
+
+ @Test
+ // @Ignore
+ public void filterVnfs() {
+ ExecutionEntity mex = setupMock()
+ def svcdecomp = initFilterVnfs(mex)
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+ CreateVcpeResCustService.processDecomposition(mex)
+
+ verify(mex).setVariable("vnfListString", '[myvnf3, myvnf5]')
+ }
+
+ @Test
+ // @Ignore
+ public void filterVnfs_Null() {
+ ExecutionEntity mex = setupMock()
+ def svcdecomp = initFilterVnfs(mex)
+
+ when(svcdecomp.getServiceVnfs()).thenReturn(null)
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+ CreateVcpeResCustService.processDecomposition(mex)
+
+ // nothing more to check, as long as it didn't throw an exception
+ }
+
+
// ***** prepareCreateAllottedResourceTXC *****
@Test
@@ -1034,13 +1063,30 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase {
when(mex.getVariable("serviceInstanceName")).thenReturn("sin")
}
- private ServiceDecomposition initProcessDecomposition(ExecutionEntity mex, boolean haveNet, boolean haveVnf) {
+ private ServiceDecomposition initProcessDecomposition(ExecutionEntity mex) {
+ List<VnfResource> vnflst = new LinkedList<>()
+ vnflst.add(makeVnf("", ""))
+ vnflst.add(makeVnf("2", "BRG"))
+ vnflst.add(makeVnf("3", "BRG"))
+
+ ServiceDecomposition svcdecomp = mock(ServiceDecomposition.class)
+ when(svcdecomp.getServiceVnfs()).thenReturn(vnflst)
+
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("serviceDecomposition")).thenReturn(svcdecomp)
+ when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
+ when(mex.getVariable("serviceInstanceName")).thenReturn("sin")
+
+ return svcdecomp
+ }
+
+ private ServiceDecomposition initFilterVnfs(ExecutionEntity mex) {
List<VnfResource> vnflst = new LinkedList<>()
- if(haveVnf) {
- vnflst.add(makeVnf(""))
- vnflst.add(makeVnf("2"))
- vnflst.add(makeVnf("3"))
- }
+ vnflst.add(makeVnf("", "BRG"))
+ vnflst.add(makeVnf("2", "TunnelXConn"))
+ vnflst.add(makeVnf("3", ""))
+ vnflst.add(makeVnf("4", "BRG"))
+ vnflst.add(makeVnf("5", "other"))
ServiceDecomposition svcdecomp = mock(ServiceDecomposition.class)
when(svcdecomp.getServiceVnfs()).thenReturn(vnflst)
@@ -1133,10 +1179,10 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase {
List<VnfResource> vnflst = new LinkedList<>()
- vnflst.add(makeVnf("A"))
- vnflst.add(makeVnf("B"))
- vnflst.add(makeVnf("C"))
- vnflst.add(makeVnf("D"))
+ vnflst.add(makeVnf("A", "BRG"))
+ vnflst.add(makeVnf("B", ""))
+ vnflst.add(makeVnf("C", ""))
+ vnflst.add(makeVnf("D", "TunnelXConn"))
when(mex.getVariable(DBGFLAG)).thenReturn("true")
when(mex.getVariable("createVcpeServiceRequest")).thenReturn(request)
@@ -1146,7 +1192,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase {
when(mex.getVariable("sdncVersion")).thenReturn("myvers")
}
- private VnfResource makeVnf(String id) {
+ private VnfResource makeVnf(String id, String role) {
ModelInfo mod = mock(ModelInfo.class)
VnfResource vnf = mock(VnfResource.class)
@@ -1154,8 +1200,9 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase {
when(vnf.toString()).thenReturn("myvnf"+id)
when(vnf.getModelInfo()).thenReturn(mod)
+ when(vnf.getNfRole()).thenReturn(role)
- return vnf
+ return vnf
}
private initValidateVnfCreate(ExecutionEntity mex) {
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DeleteVcpeResCustServiceTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DeleteVcpeResCustServiceTest.groovy
index fc53744b8b..65c9e456e4 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DeleteVcpeResCustServiceTest.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DeleteVcpeResCustServiceTest.groovy
@@ -94,23 +94,24 @@ class DeleteVcpeResCustServiceTest extends GroovyTestBase {
DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
DeleteVcpeResCustService.preProcessRequest(mex)
- verify(mex).getVariable(DBGFLAG)
- verify(mex).setVariable("prefix", Prefix)
- verify(mex).setVariable("DeleteVcpeResCustServiceRequest", request)
- verify(mex).setVariable("msoRequestId", "mri")
- verify(mex).setVariable("requestAction", "ra")
- verify(mex).setVariable("source", "VID")
- verify(mex).setVariable("globalSubscriberId", CUST)
- verify(mex).setVariable("globalCustomerId", CUST)
- verify(mex).setVariable("disableRollback", "false")
- verify(mex).setVariable("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb")
- verify(mex).setVariable("subscriptionServiceType", SVC)
+ verify(mex).getVariable(DBGFLAG)
- verify(mex).setVariable("lcpCloudRegionId", "mdt1")
- verify(mex).setVariable("tenantId", "8b1df54faa3b49078e3416e21370a3ba")
+ assertEquals(Prefix, map.get("prefix"))
+ assertEquals(request, map.get("DeleteVcpeResCustServiceRequest"))
+ assertEquals("mri", map.get("msoRequestId"))
+ assertEquals("ra", map.get("requestAction"))
+ assertEquals("VID", map.get("source"))
+ assertEquals(CUST, map.get("globalSubscriberId"))
+ assertEquals(CUST, map.get("globalCustomerId"))
+ assertEquals("false", map.get("disableRollback"))
+ assertEquals("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", map.get("productFamilyId"))
+ assertEquals(SVC, map.get("subscriptionServiceType"))
+
+ assertEquals("mdt1", map.get("lcpCloudRegionId"))
+ assertEquals("8b1df54faa3b49078e3416e21370a3ba", map.get("tenantId"))
+ assertEquals("1707", map.get("sdncVersion"))
+ assertEquals("service-instance", map.get("GENGS_type"))
assertEquals("""{"tenantId":"8b1df54faa3b49078e3416e21370a3ba","lcpCloudRegionId":"mdt1"}""", map.get("cloudConfiguration"))
- verify(mex).setVariable("sdncVersion", "1702")
- verify(mex).setVariable("GENGS_type", "service-instance")
assertTrue(map.containsKey(Prefix+"requestInfo"))
def reqinfo = map.get(Prefix+"requestInfo")
@@ -148,7 +149,7 @@ class DeleteVcpeResCustServiceTest extends GroovyTestBase {
verify(mex).setVariable("lcpCloudRegionId", "mdt1")
verify(mex).setVariable("tenantId", "8b1df54faa3b49078e3416e21370a3ba")
assertEquals("""{"tenantId":"8b1df54faa3b49078e3416e21370a3ba","lcpCloudRegionId":"mdt1"}""", map.get("cloudConfiguration"))
- verify(mex).setVariable("sdncVersion", "1702")
+ verify(mex).setVariable("sdncVersion", "1707")
verify(mex).setVariable("GENGS_type", "service-instance")
assertTrue(map.containsKey(Prefix+"requestInfo"))
@@ -258,16 +259,18 @@ class DeleteVcpeResCustServiceTest extends GroovyTestBase {
def map = setupMap(mex)
initPrepareServiceDelete(mex)
+ myMockGetAr("/aai/v11/anytxc", 200, "arGetTXCById.xml");
+ myMockGetAr("/aai/v11/anybrg", 200, "arGetBRGById.xml");
+ myMockGetAr("/aai/v11/other", 200, "arGetOtherById.xml");
+
DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
DeleteVcpeResCustService.prepareServiceDelete(mex)
-
- verify(mex).getVariable(DBGFLAG)
verify(mex).setVariable(Prefix+"TunnelXConn", true)
- assertEquals("txcA", map.get("TXC_allottedResourceId"))
+ assertEquals("ar-txcA", map.get("TXC_allottedResourceId"))
verify(mex).setVariable(Prefix+"BRG", true)
- assertEquals("brgB", map.get("BRG_allottedResourceId"))
+ assertEquals("ar-brgB", map.get("BRG_allottedResourceId"))
verify(mex).setVariable(Prefix+"vnfsCount", 2)
assertNotNull(map.get(Prefix+"relatedVnfIdList"))
@@ -353,9 +356,62 @@ class DeleteVcpeResCustServiceTest extends GroovyTestBase {
when(mex.getVariable("GENGS_FoundIndicator")).thenReturn(true)
when(mex.getVariable("mso-request-id")).thenReturn("mri")
when(mex.getVariable("DeleteVcpeResCustServiceRequest")).thenReturn(request)
+ when(mex.getVariable("URN_aai_endpoint")).thenReturn(aaiUriPfx)
when(mex.getVariable("GENGS_service")).thenReturn(FileUtil.readResourceFile("__files/VCPE/DeleteVcpeResCustService/serviceToDelete.xml"))
}
+ // ***** getAaiAr *****
+
+ @Test
+// @Ignore
+ public void getAaiAr() {
+ myMockGetAr("/myurl/ar1", 200, "arGetBRGById.xml");
+
+ ExecutionEntity mex = setupMock()
+ initGetAaiAr(mex)
+
+ DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+ def (type, id) = DeleteVcpeResCustService.getAaiAr(mex, "/myurl/ar1")
+
+ assertEquals("BRG", type)
+ assertEquals("ar-brgB", id)
+ }
+
+ @Test
+// @Ignore
+ public void getAaiAr_401() {
+ myMockGetAr("/myurl/ar1", 401, "arGetBRGById.xml");
+
+ ExecutionEntity mex = setupMock()
+ initGetAaiAr(mex)
+
+ DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+ def (type, id) = DeleteVcpeResCustService.getAaiAr(mex, "/myurl/ar1")
+
+ assertEquals(null, type)
+ assertEquals(null, id)
+ }
+
+ @Test
+// @Ignore
+ public void getAaiAr_EmptyResponse() {
+ myMockGetAr("/myurl/ar1", 200, "empty.txt");
+
+ ExecutionEntity mex = setupMock()
+ initGetAaiAr(mex)
+
+ DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+ def (type, id) = DeleteVcpeResCustService.getAaiAr(mex, "/myurl/ar1")
+
+ assertEquals(null, type)
+ assertEquals(null, id)
+ }
+
+ private void initGetAaiAr(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("URN_aai_endpoint")).thenReturn(aaiUriPfx)
+ }
+
// ***** prepareVnfAndModulesDelete *****
@Test
@@ -707,5 +763,13 @@ class DeleteVcpeResCustServiceTest extends GroovyTestBase {
private initProcessJavaException(ExecutionEntity mex) {
when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ }
+
+ private void myMockGetAr(String url, int status, String fileResp) {
+ stubFor(get(urlMatching(url))
+ .willReturn(aResponse()
+ .withStatus(status)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("VCPE/DeleteVcpeResCustService/" + fileResp)));
}
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRGTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRGTest.groovy
index f91a39c856..ec65347f5e 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRGTest.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRGTest.groovy
@@ -197,8 +197,10 @@ class DoDeleteAllottedResourceBRGTest extends GroovyTestBase {
assertTrue(result.indexOf("<sdncadapter:SvcAction>myact</") >= 0)
assertTrue(result.indexOf("<allotted-resource-id>ari</") >= 0)
assertTrue(result.indexOf("<sdncadapter:SvcInstanceId>sii</") >= 0)
- assertTrue(result.indexOf("<service-instance-id>psii</") >= 0)
+ assertTrue(result.indexOf("<service-instance-id>sii</") >= 0)
assertTrue(result.indexOf("<parent-service-instance-id>psii</") >= 0)
+ assertTrue(result.indexOf("<subscription-service-type>sst</") >= 0)
+ assertTrue(result.indexOf("<global-customer-id>gci</") >= 0)
assertTrue(result.indexOf("<sdncadapter:CallbackUrl>scu</") >= 0)
assertTrue(result.indexOf("<request-id>mri</") >= 0)
assertTrue(result.indexOf("<model-invariant-uuid/>") >= 0)
@@ -572,6 +574,8 @@ class DoDeleteAllottedResourceBRGTest extends GroovyTestBase {
when(mex.getVariable("allottedResourceId")).thenReturn("ari")
when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii")
+ when(mex.getVariable("subscriptionServiceType")).thenReturn("sst")
+ when(mex.getVariable("globalCustomerId")).thenReturn("gci")
when(mex.getVariable("sdncCallbackUrl")).thenReturn("scu")
when(mex.getVariable("msoRequestId")).thenReturn("mri")
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXCTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXCTest.groovy
index 97f714d98d..adf6313a2a 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXCTest.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXCTest.groovy
@@ -197,8 +197,10 @@ class DoDeleteAllottedResourceTXCTest extends GroovyTestBase {
assertTrue(result.indexOf("<sdncadapter:SvcAction>myact</") >= 0)
assertTrue(result.indexOf("<allotted-resource-id>ari</") >= 0)
assertTrue(result.indexOf("<sdncadapter:SvcInstanceId>sii</") >= 0)
- assertTrue(result.indexOf("<service-instance-id>psii</") >= 0)
+ assertTrue(result.indexOf("<service-instance-id>sii</") >= 0)
assertTrue(result.indexOf("<parent-service-instance-id>psii</") >= 0)
+ assertTrue(result.indexOf("<subscription-service-type>sst</") >= 0)
+ assertTrue(result.indexOf("<global-customer-id>gci</") >= 0)
assertTrue(result.indexOf("<sdncadapter:CallbackUrl>scu</") >= 0)
assertTrue(result.indexOf("<request-id>mri</") >= 0)
assertTrue(result.indexOf("<model-invariant-uuid/>") >= 0)
@@ -572,6 +574,8 @@ class DoDeleteAllottedResourceTXCTest extends GroovyTestBase {
when(mex.getVariable("allottedResourceId")).thenReturn("ari")
when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii")
+ when(mex.getVariable("subscriptionServiceType")).thenReturn("sst")
+ when(mex.getVariable("globalCustomerId")).thenReturn("gci")
when(mex.getVariable("sdncCallbackUrl")).thenReturn("scu")
when(mex.getVariable("msoRequestId")).thenReturn("mri")
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getSI.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getSI.xml
index 4f95ed2f19..e0511873b6 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getSI.xml
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getSI.xml
@@ -1,43 +1,35 @@
<service-instance>
<service-instance-id>MIS/1604/0026/SW_INTERNET</service-instance-id>
- <resource-version>123456789</resource-version>
-
- <allotted-resources>
- <allotted-resource>
- <type>TunnelXConn</type>
- <id>ar-txcA</id>
- </allotted-resource>
- <allotted-resource>
- <type>BRG</type>
- <id>ar-brgB</id>
- </allotted-resource>
- <allotted-resource>
- <type>other</type>
- <id>ar-otherC</id>
- </allotted-resource>
- </allotted-resources>
-
+ <resource-version>123456789</resource-version>
<relationship-list>
<relationship>
<related-to>generic-vnf</related-to>
- <related-link>https://aai-ext1.test.com:8443/aai/v7/generic-vnf/vnfX</related-link>
+ <related-link>/aai/v7/generic-vnf/vnfX</related-link>
</relationship>
<relationship>
<related-to>l3-network</related-to>
- <related-link>https://aai-ext1.test.com:8443/aai/v7/l3-network/netA</related-link>
+ <related-link>/aai/v7/l3-network/netA</related-link>
</relationship>
<relationship>
<related-to>generic-vnf</related-to>
- <related-link>https://aai-ext1.test.com:8443/aai/v7/generic-vnf/vnfY</related-link>
+ <related-link>/aai/v7/generic-vnf/vnfY</related-link>
</relationship>
<relationship>
<related-to>l3-network</related-to>
- <related-link>https://aai-ext1.test.com:8443/aai/v7/l3-network/netB</related-link>
+ <related-link>/aai/v7/l3-network/netB</related-link>
</relationship>
<relationship>
<related-to>l3-network</related-to>
- <related-link>https://aai-ext1.test.com:8443/aai/v7/l3-network/netC</related-link>
+ <related-link>/aai/v7/l3-network/netC</related-link>
+ </relationship>
+ <relationship>
+ <related-to>allotted-resource</related-to>
+ <related-link>/aai/v11/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/ar-txcA</related-link>
+ </relationship>
+ <relationship>
+ <related-to>allotted-resource</related-to>
+ <related-link>/aai/v11/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/ar-brgB</related-link>
</relationship>
</relationship-list>
</service-instance>
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/serviceToDelete.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/serviceToDelete.xml
index 6071c51b2d..8b8863e29c 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/serviceToDelete.xml
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/serviceToDelete.xml
@@ -1,38 +1,36 @@
<service xmlns="http://org.openecomp.aai.inventory/v9">
- <allotted-resources>
- <allotted-resource>
- <type>TunnelXConn</type>
- <id>txcA</id>
- </allotted-resource>
- <allotted-resource>
- <type>BRG</type>
- <id>brgB</id>
- </allotted-resource>
- <allotted-resource>
- <type>other</type>
- <id>otherC</id>
- </allotted-resource>
- </allotted-resources>
<relationship-list>
<relationship>
<related-to>generic-vnf</related-to>
- <related-link>https://aai-ext1.test.com:8443/aai/v7/generic-vnf/vnfX</related-link>
+ <related-link>/aai/v7/generic-vnf/vnfX</related-link>
</relationship>
<relationship>
<related-to>l3-network</related-to>
- <related-link>https://aai-ext1.test.com:8443/aai/v7/l3-network/netA</related-link>
+ <related-link>/aai/v7/l3-network/netA</related-link>
</relationship>
<relationship>
<related-to>generic-vnf</related-to>
- <related-link>https://aai-ext1.test.com:8443/aai/v7/generic-vnf/vnfY</related-link>
+ <related-link>/aai/v7/generic-vnf/vnfY/</related-link>
</relationship>
<relationship>
<related-to>l3-network</related-to>
- <related-link>https://aai-ext1.test.com:8443/aai/v7/l3-network/netB</related-link>
+ <related-link>/aai/v7/l3-network/netB</related-link>
</relationship>
<relationship>
<related-to>l3-network</related-to>
- <related-link>https://aai-ext1.test.com:8443/aai/v7/l3-network/netC</related-link>
+ <related-link>/aai/v7/l3-network/netC</related-link>
+ </relationship>
+ <relationship>
+ <related-to>allotted-resource</related-to>
+ <related-link>/aai/v11/anytxc</related-link>
+ </relationship>
+ <relationship>
+ <related-to>allotted-resource</related-to>
+ <related-link>/aai/v11/anybrg</related-link>
+ </relationship>
+ <relationship>
+ <related-to>allotted-resource</related-to>
+ <related-link>/aai/v11/other</related-link>
</relationship>
</relationship-list>
</service>