summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-infrastructure-common
diff options
context:
space:
mode:
authorSeshu Kumar M <seshu.kumar.m@huawei.com>2019-07-23 05:30:31 +0000
committerGerrit Code Review <gerrit@onap.org>2019-07-23 05:30:31 +0000
commit5184b28f6ec1170ae035ddd749d8bdf5b2064904 (patch)
tree41f5811c8b56094bb63ba1a784048ab384f4a253 /bpmn/so-bpmn-infrastructure-common
parentbbdb1c45a93194db2712d8c146e263a03737f25c (diff)
parentf4bf9e7ad4746fbec415c0ad34fa57f168840e30 (diff)
Merge "Enhanced List Level flow with backward support"
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-common')
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy90
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy14
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy354
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy58
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy21
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy124
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy101
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy52
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy42
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy1
10 files changed, 530 insertions, 327 deletions
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy
index 0338647ce7..30b5cc8567 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy
@@ -83,9 +83,14 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
//the operationType from worflow(first node) is highest priority.
operationType = jsonUtil.getJsonValue(recipeParamsFromWf, "operationType")
}
+ String operationTypeFromConfig = UrnPropertiesReader.getVariable("resource-config." + resourceInputObj.resourceModelInfo.getModelName() + ".operation-type")
+ if (StringUtils.isNotEmpty(operationTypeFromConfig)) {
+ // highest priority if operation type configured
+ operationType = operationTypeFromConfig
+ }
String sdnc_svcAction = "activate"
- String sdnc_requestAction = sdnc_svcAction.capitalize() + UrnPropertiesReader.getVariable("resource-config." + resourceInputObj.resourceModelInfo.getModelName() +".operation-type") + "Instance"
+ String sdnc_requestAction = sdnc_svcAction.capitalize() + operationType + "Instance"
execution.setVariable(Prefix + "svcAction", sdnc_svcAction)
execution.setVariable(Prefix + "requestAction", sdnc_requestAction)
@@ -194,24 +199,6 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
String sdncTopologyActivateRequest = ""
String modelType = resourceInputObj.getResourceModelInfo().getModelType()
- //When a new resource creation request reaches SO, the parent resources information needs to be provided
- //while creating the child resource.
- String vnfid = ""
- String vnfmodelInvariantUuid = ""
- String vnfmodelCustomizationUuid = ""
- String vnfmodelUuid = ""
- String vnfmodelVersion = ""
- String vnfmodelName = ""
- if(modelType.equalsIgnoreCase(ResourceType.GROUP.toString())) {
- vnfid = resourceInputObj.getVnfId()
- ModelInfo vfModelInfo = resourceInputObj.getVfModelInfo()
- vnfmodelInvariantUuid = vfModelInfo.getModelInvariantUuid()
- vnfmodelCustomizationUuid = vfModelInfo.getModelCustomizationUuid()
- vnfmodelUuid = vfModelInfo.getModelUuid()
- vnfmodelVersion = vfModelInfo.getModelVersion()
- vnfmodelName = vfModelInfo.getModelName()
- }
-
switch (modelType) {
case "VNF" :
sdncTopologyActivateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
@@ -272,6 +259,15 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
break
case "GROUP" :
+ //When a new resource creation request reaches SO, the parent resources information needs to be provided
+ //while creating the child resource.
+ String vnfid = resourceInputObj.getVnfId()
+ ModelInfo vfModelInfo = resourceInputObj.getVfModelInfo()
+ String vnfmodelInvariantUuid = vfModelInfo.getModelInvariantUuid()
+ String vnfmodelCustomizationUuid = vfModelInfo.getModelCustomizationUuid()
+ String vnfmodelUuid = vfModelInfo.getModelUuid()
+ String vnfmodelVersion = vfModelInfo.getModelVersion()
+ String vnfmodelName = vfModelInfo.getModelName()
sdncTopologyActivateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
@@ -335,6 +331,61 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
</aetgt:SDNCAdapterWorkflowRequest>""".trim()
break
+ // sdwanvpnattachment or sotnvpnattachment
+ case "ALLOTTED_RESOURCE" :
+ sdncTopologyActivateRequest =
+ """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
+ xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
+ xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
+ <sdncadapter:RequestHeader>
+ <sdncadapter:RequestId>${msoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId>
+ <sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
+ <sdncadapter:SvcAction>${msoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction>
+ <sdncadapter:SvcOperation>connection-attachment-topology-operation</sdncadapter:SvcOperation>
+ <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl>
+ <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction>
+ </sdncadapter:RequestHeader>
+ <sdncadapterworkflow:SDNCRequestData>
+ <request-information>
+ <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id>
+ <request-action>${msoUtils.xmlEscape(sdnc_requestAction)}</request-action>
+ <source>${msoUtils.xmlEscape(source)}</source>
+ <notification-url></notification-url>
+ <order-number></order-number>
+ <order-version></order-version>
+ </request-information>
+ <service-information>
+ <service-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-id>
+ <subscription-service-type>${msoUtils.xmlEscape(serviceType)}</subscription-service-type>
+ <onap-model-information>
+ <model-invariant-uuid>${msoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid>
+ <model-uuid>${msoUtils.xmlEscape(serviceModelUuid)}</model-uuid>
+ <model-version>${msoUtils.xmlEscape(serviceModelVersion)}</model-version>
+ <model-name>${msoUtils.xmlEscape(serviceModelName)}</model-name>
+ </onap-model-information>
+ <service-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
+ <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id>
+ </service-information>
+ <allotted-resource-information>
+ <allotted-resource-id>${msoUtils.xmlEscape(resourceInstanceId)}</allotted-resource-id>
+ <allotted-resource-type></allotted-resource-type>
+ <parent-service-instance-id>$parentServiceInstanceId</parent-service-instance-id>
+ <onap-model-information>
+ <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid>
+ <model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid>
+ <model-uuid>${msoUtils.xmlEscape(modelUuid)}</model-uuid>
+ <model-version>${msoUtils.xmlEscape(modelVersion)}</model-version>
+ <model-name>${msoUtils.xmlEscape(modelName)}</model-name>
+ </onap-model-information>
+ </allotted-resource-information>
+ <connection-attachment-request-input>
+ $netowrkInputParameters
+ </connection-attachment-request-input>
+ </sdncadapterworkflow:SDNCRequestData>
+ </aetgt:SDNCAdapterWorkflowRequest>""".trim()
+
+ break
+
// for SDWANConnectivity and SOTN Connectivity
default:
sdncTopologyActivateRequest =
@@ -371,7 +422,6 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
<global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id>
</service-information>
<network-information>
- <!-- TODO: to be filled by response from create -->
<network-id>${msoUtils.xmlEscape(resourceInstanceId)}</network-id>
<onap-model-information>
<model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid>
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy
index 1578f0f7c0..044f0b462b 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy
@@ -353,6 +353,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
// ExternalAPI message format
String externalId = execution.getVariable("resourceName")
+ String serviceType = execution.getVariable("serviceType")
String category = "E2E Service"
String description = "Service Order from SPPartner"
String requestedStartDate = utils.generateCurrentTimeInUtc()
@@ -360,7 +361,9 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
String priority = "1" // 0-4 0:highest
String subscriberId = execution.getVariable("globalSubscriberId")
String customerRole = "ONAPcustomer"
- String subscriberName = subscriberId
+ // Below SO will pass serviceType as subscriberName and externalAPI will use
+ // the same serviceType in another domain instead of model name
+ String subscriberName = serviceType
String referredType = "Consumer"
String orderItemId = "1"
String action = "add" //for create
@@ -401,7 +404,6 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
_requestInputs_ += ",\n" + externalAPIUtil.setTemplate(ExternalAPIUtil.RequestInputsTemplate, requestInputsMap)
requestInputsMap.clear()
- String serviceType = execution.getVariable("serviceType")
requestInputsMap.put("inputName", '"serviceType"')
requestInputsMap.put("inputValue", '"' + serviceType + '"')
_requestInputs_ += ",\n" + externalAPIUtil.setTemplate(ExternalAPIUtil.RequestInputsTemplate, requestInputsMap)
@@ -420,7 +422,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
String payload = externalAPIUtil.setTemplate(ExternalAPIUtil.PostServiceOrderRequestsTemplate, valueMap)
execution.setVariable(Prefix + "Payload", payload)
- logger.info("Exit " + prepare3rdONAPRequest)
+ logger.info(" ***** Exit prepare3rdONAPRequest *****")
}
public void doCreateE2ESIin3rdONAP(DelegateExecution execution) {
@@ -464,7 +466,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
logger.error("doCreateE2ESIin3rdONAP exception:" + e.getMessage())
}
- logger.info("Exit " + doCreateE2ESIin3rdONAP)
+ logger.info(" ***** Exit doCreateE2ESIin3rdONAP *****")
}
@@ -562,7 +564,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
execution.setVariable("statusDescription", "Get Create ServiceOrder Exception")
logger.error("getE2ESIProgressin3rdONAP exception:" + e.getMessage())
}
- logger.info("Exit " + getE2ESIProgressin3rdONAP)
+ logger.info(" ***** Exit getE2ESIProgressin3rdONAP *****")
}
/**
@@ -608,7 +610,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
logger.info(msg)
// throw new BpmnError("MSOWorkflowException")
}
- logger.info("Exit " + saveSPPartnerInAAI)
+ logger.info(" ***** Exit saveSPPartnerInAAI *****")
}
private void setProgressUpdateVariables(DelegateExecution execution, String body) {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy
index d431bdc3b4..b0419be7cb 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy
@@ -22,7 +22,7 @@
package org.onap.so.bpmn.infrastructure.scripts
-import com.google.gson.Gson
+
import org.apache.commons.lang3.*
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
@@ -32,11 +32,8 @@ import org.onap.aai.domain.yang.ServiceInstance
import org.onap.aai.domain.yang.ServiceInstances
import org.onap.aai.domain.yang.v13.Metadata
import org.onap.aai.domain.yang.v13.Metadatum
-import org.onap.aai.domain.yang.v13.Pnf
-import org.onap.aai.domain.yang.v13.Pnfs
import org.onap.so.bpmn.common.recipe.ResourceInput
import org.onap.so.bpmn.common.resource.ResourceRequestBuilder
-import org.onap.so.bpmn.common.scripts.AaiUtil
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
@@ -52,8 +49,6 @@ import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import static org.apache.commons.lang3.StringUtils.*
-
/**
* This groovy class supports the <class>CreateSDNCCNetworkResource.bpmn</class> process.
* flow for SDNC Network Resource Create
@@ -88,7 +83,6 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
//Deal with recipeParams
String recipeParamsFromWf = execution.getVariable("recipeParamXsd")
- String resourceName = resourceInputObj.getResourceInstanceName()
//For sdnc requestAction default is "createNetworkInstance"
String operationType = "Network"
@@ -100,9 +94,14 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
//the operationType from worflow(first node) is highest priority.
operationType = jsonUtil.getJsonValue(recipeParamsFromWf, "operationType")
}
+ String operationTypeFromConfig = UrnPropertiesReader.getVariable("resource-config." + resourceInputObj.resourceModelInfo.getModelName() + ".operation-type")
+ if (StringUtils.isNotEmpty(operationTypeFromConfig)) {
+ // highest priority if operation type configured
+ operationType = operationTypeFromConfig
+ }
String sdnc_svcAction = "create"
- String sdnc_requestAction = sdnc_svcAction.capitalize() + UrnPropertiesReader.getVariable("resource-config." + resourceInputObj.resourceModelInfo.getModelName() +".operation-type") + "Instance"
+ String sdnc_requestAction = sdnc_svcAction.capitalize() + operationType + "Instance"
String isActivateRequired = UrnPropertiesReader.getVariable("resource-config." + resourceInputObj.resourceModelInfo.getModelName() +".activation-required")
execution.setVariable("isActivateRequired", isActivateRequired)
@@ -278,27 +277,38 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ :
case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ :
// fill attachment TP in networkInputParamJson
- String customer = resourceInputObj.getGlobalSubscriberId()
- String serviceType = resourceInputObj.getServiceType()
-
def vpnName = StringUtils.containsIgnoreCase(modelName, "sotnvpnattachment") ? "sotnvpnattachmentvf_sotncondition_sotnVpnName" : "sdwanvpnattachmentvf_sdwancondition_sdwanVpnName"
- String parentServiceName = jsonUtil.getJsonValueForKey(resourceInputObj.getRequestsInputs(), vpnName)
-
- AAIResourcesClient client = new AAIResourcesClient()
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, customer, serviceType).queryParam("service-instance-name", parentServiceName)
- ServiceInstances sis = client.get(uri).asBean(ServiceInstances.class).get()
- ServiceInstance si = sis.getServiceInstance().get(0)
-
- def parentServiceInstanceId = si.getServiceInstanceId()
- execution.setVariable("parentServiceInstanceId", parentServiceInstanceId)
+ fillAttachmentTPInfo(resourceInputObj, modelName, execution, vpnName)
break
default:
+ // Special case for handling alloted resource types
+ // in case name is different as expected
+ if ("ALLOTTED_RESOURCE".equals(resourceInputObj.getResourceModelInfo().getModelType())) {
+ def vpnName = modelName + "_sotnVpnName"
+ fillAttachmentTPInfo(resourceInputObj, modelName, execution, vpnName)
+ }
break
}
return resourceInputObj
}
+ private void fillAttachmentTPInfo(ResourceInput resourceInputObj, String modelName, DelegateExecution execution, String vpnName) {
+ String customer = resourceInputObj.getGlobalSubscriberId()
+ String serviceType = resourceInputObj.getServiceType()
+
+ String parentServiceName = jsonUtil.getJsonValueForKey(resourceInputObj.getRequestsInputs(), vpnName)
+
+ AAIResourcesClient client = new AAIResourcesClient()
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, customer, serviceType).queryParam("service-instance-name", parentServiceName)
+ ServiceInstances sis = client.get(uri).asBean(ServiceInstances.class).get()
+ logger.debug("Fetched AAI ServiceInstances for the vpnName:" + vpnName + " is " + sis.getServiceInstance().toString())
+ ServiceInstance si = sis.getServiceInstance().get(0)
+
+ def parentServiceInstanceId = si.getServiceInstanceId()
+ execution.setVariable("parentServiceInstanceId", parentServiceInstanceId)
+ }
+
/**
* Pre Process the BPMN Flow Request
* Includes:
@@ -339,26 +349,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
// 1. prepare assign topology via SDNC Adapter SUBFLOW call
String sdncTopologyCreateRequest = "";
-
-
- //When a new resource creation request reaches SO, the parent resources information needs to be provided
- //while creating the child resource.
- String vnfid = ""
- String vnfmodelInvariantUuid = ""
- String vnfmodelCustomizationUuid = ""
- String vnfmodelUuid = ""
- String vnfmodelVersion = ""
- String vnfmodelName = ""
String modelType = resourceInputObj.getResourceModelInfo().getModelType()
- if(modelType.equalsIgnoreCase(ResourceType.GROUP.toString())) {
- vnfid = resourceInputObj.getVnfId()
- ModelInfo vfModelInfo = resourceInputObj.getVfModelInfo()
- vnfmodelInvariantUuid = vfModelInfo.getModelInvariantUuid()
- vnfmodelCustomizationUuid = vfModelInfo.getModelCustomizationUuid()
- vnfmodelUuid = vfModelInfo.getModelUuid()
- vnfmodelVersion = vfModelInfo.getModelVersion()
- vnfmodelName = vfModelInfo.getModelName()
- }
switch (modelType) {
case "VNF" :
@@ -418,6 +409,13 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
</aetgt:SDNCAdapterWorkflowRequest>""".trim()
break
case "GROUP" :
+ String vnfid = resourceInputObj.getVnfId()
+ ModelInfo vfModelInfo = resourceInputObj.getVfModelInfo()
+ String vnfmodelInvariantUuid = vfModelInfo.getModelInvariantUuid()
+ String vnfmodelCustomizationUuid = vfModelInfo.getModelCustomizationUuid()
+ String vnfmodelUuid = vfModelInfo.getModelUuid()
+ String vnfmodelVersion = vfModelInfo.getModelVersion()
+ String vnfmodelName = vfModelInfo.getModelName()
sdncTopologyCreateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
@@ -480,7 +478,62 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
</aetgt:SDNCAdapterWorkflowRequest>""".trim()
break
- // for SDWANConnectivity and SOTNConnectivity:
+ // sdwanvpnattachment or sotnvpnattachment
+ case "ALLOTTED_RESOURCE" :
+ sdncTopologyCreateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
+ xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
+ xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
+ <sdncadapter:RequestHeader>
+ <sdncadapter:RequestId>${msoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId>
+ <sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
+ <sdncadapter:SvcAction>${msoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction>
+ <sdncadapter:SvcOperation>connection-attachment-topology-operation</sdncadapter:SvcOperation>
+ <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl>
+ <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction>
+ </sdncadapter:RequestHeader>
+ <sdncadapterworkflow:SDNCRequestData>
+ <request-information>
+ <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id>
+ <request-action>${msoUtils.xmlEscape(sdnc_requestAction)}</request-action>
+ <source>${msoUtils.xmlEscape(source)}</source>
+ <notification-url></notification-url>
+ <order-number></order-number>
+ <order-version></order-version>
+ </request-information>
+ <service-information>
+ <service-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-id>
+ <subscription-service-type>${msoUtils.xmlEscape(serviceType)}</subscription-service-type>
+ <onap-model-information>
+ <model-invariant-uuid>${msoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid>
+ <model-uuid>${msoUtils.xmlEscape(serviceModelUuid)}</model-uuid>
+ <model-version>${msoUtils.xmlEscape(serviceModelVersion)}</model-version>
+ <model-name>${msoUtils.xmlEscape(serviceModelName)}</model-name>
+ </onap-model-information>
+ <service-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
+ <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id>
+ <subscriber-name>${msoUtils.xmlEscape(globalCustomerId)}</subscriber-name>
+ </service-information>
+ <allotted-resource-information>
+ <allotted-resource-id></allotted-resource-id>
+ <allotted-resource-type></allotted-resource-type>
+ <parent-service-instance-id>$parentServiceInstanceId</parent-service-instance-id>
+ <onap-model-information>
+ <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid>
+ <model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid>
+ <model-uuid>${msoUtils.xmlEscape(modelUuid)}</model-uuid>
+ <model-version>${msoUtils.xmlEscape(modelVersion)}</model-version>
+ <model-name>${msoUtils.xmlEscape(modelName)}</model-name>
+ </onap-model-information>
+ </allotted-resource-information>
+ <connection-attachment-request-input>
+ $netowrkInputParameters
+ </connection-attachment-request-input>
+ </sdncadapterworkflow:SDNCRequestData>
+ </aetgt:SDNCAdapterWorkflowRequest>""".trim()
+
+ break
+
+ // for SDWANConnectivity and SOTNConnectivity:
default:
sdncTopologyCreateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
@@ -532,198 +585,6 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
}
-
-
-
- //switch (modelName) {
- // case ~/[\w\s\W]*deviceVF[\w\s\W]*/
- // case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ :
- // case ~/[\w\s\W]*SiteVF[\w\s\W]*/:
- /* sdncTopologyCreateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
- xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
- xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
- <sdncadapter:RequestHeader>
- <sdncadapter:RequestId>${msoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId>
- <sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
- <sdncadapter:SvcAction>${msoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction>
- <sdncadapter:SvcOperation>vnf-topology-operation</sdncadapter:SvcOperation>
- <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl>
- <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction>
- </sdncadapter:RequestHeader>
- <sdncadapterworkflow:SDNCRequestData>
- <request-information>
- <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id>
- <request-action>${msoUtils.xmlEscape(sdnc_requestAction)}</request-action>
- <source>${msoUtils.xmlEscape(source)}</source>
- <notification-url></notification-url>
- <order-number></order-number>
- <order-version></order-version>
- </request-information>
- <service-information>
- <service-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-id>
- <subscription-service-type>${msoUtils.xmlEscape(serviceType)}</subscription-service-type>
- <onap-model-information>
- <model-invariant-uuid>${msoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid>
- <model-uuid>${msoUtils.xmlEscape(serviceModelUuid)}</model-uuid>
- <model-version>${msoUtils.xmlEscape(serviceModelVersion)}</model-version>
- <model-name>${msoUtils.xmlEscape(serviceModelName)}</model-name>
- </onap-model-information>
- <service-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
- <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id>
- <subscriber-name>${msoUtils.xmlEscape(globalCustomerId)}</subscriber-name>
- </service-information>
- <vnf-information>
- <vnf-id></vnf-id>
- <vnf-type></vnf-type>
- <onap-model-information>
- <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid>
- <model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid>
- <model-uuid>${msoUtils.xmlEscape(modelUuid)}</model-uuid>
- <model-version>${msoUtils.xmlEscape(modelVersion)}</model-version>
- <model-name>${msoUtils.xmlEscape(modelName)}</model-name>
- </onap-model-information>
- </vnf-information>
- <vnf-request-input>
- <vnf-input-parameters>
- $netowrkInputParameters
- </vnf-input-parameters>
- <request-version></request-version>
- <vnf-name></vnf-name>
- <vnf-networks>
- </vnf-networks>
- </vnf-request-input>
- </sdncadapterworkflow:SDNCRequestData>
- </aetgt:SDNCAdapterWorkflowRequest>""".trim()
-
-
- break
-
- //case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/
- //case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ :
- /* sdncTopologyCreateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
- xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
- xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
- <sdncadapter:RequestHeader>
- <sdncadapter:RequestId>${msoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId>
- <sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
- <sdncadapter:SvcAction>${msoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction>
- <sdncadapter:SvcOperation>connection-attachment-topology-operation</sdncadapter:SvcOperation>
- <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl>
- <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction>
- </sdncadapter:RequestHeader>
- <sdncadapterworkflow:SDNCRequestData>
- <request-information>
- <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id>
- <request-action>${msoUtils.xmlEscape(sdnc_requestAction)}</request-action>
- <source>${msoUtils.xmlEscape(source)}</source>
- <notification-url></notification-url>
- <order-number></order-number>
- <order-version></order-version>
- </request-information>
- <service-information>
- <service-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-id>
- <subscription-service-type>${msoUtils.xmlEscape(serviceType)}</subscription-service-type>
- <onap-model-information>
- <model-invariant-uuid>${msoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid>
- <model-uuid>${msoUtils.xmlEscape(serviceModelUuid)}</model-uuid>
- <model-version>${msoUtils.xmlEscape(serviceModelVersion)}</model-version>
- <model-name>${msoUtils.xmlEscape(serviceModelName)}</model-name>
- </onap-model-information>
- <service-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
- <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id>
- <subscriber-name>${msoUtils.xmlEscape(globalCustomerId)}</subscriber-name>
- </service-information><vnf-information>
- <vnf-id></vnf-id>
- <vnf-type></vnf-type>
- <onap-model-information>
- <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid>
- <model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid>
- <model-uuid>${msoUtils.xmlEscape(modelUuid)}</model-uuid>
- <model-version>${msoUtils.xmlEscape(modelVersion)}</model-version>
- <model-name>${msoUtils.xmlEscape(modelName)}</model-name>
- </onap-model-information>
- </vnf-information>
- <vnf-request-input>
- <vnf-input-parameters>
- $netowrkInputParameters
- </vnf-input-parameters>
- <request-version></request-version>
- <vnf-name></vnf-name>
- <vnf-networks>
- </vnf-networks>
- </vnf-request-input>
- <allotted-resource-information>
- <!-- TODO: to be filled as per the request input -->
- <allotted-resource-id></allotted-resource-id>
- <allotted-resource-type></allotted-resource-type>
- <parent-service-instance-id>$parentServiceInstanceId</parent-service-instance-id>
- <onap-model-information>
- <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid>
- <model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid>
- <model-uuid>${msoUtils.xmlEscape(modelUuid)}</model-uuid>
- <model-version>${msoUtils.xmlEscape(modelVersion)}</model-version>
- <model-name>${msoUtils.xmlEscape(modelName)}</model-name>
- </onap-model-information>
- </allotted-resource-information>
- <connection-attachment-request-input>
- $netowrkInputParameters
- </connection-attachment-request-input>
- </sdncadapterworkflow:SDNCRequestData>
- </aetgt:SDNCAdapterWorkflowRequest>""".trim()
- break
-
- // for SDWANConnectivity and SOTNConnectivity:
- default:
- sdncTopologyCreateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
- xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
- xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
- <sdncadapter:RequestHeader>
- <sdncadapter:RequestId>${hdrRequestId}</sdncadapter:RequestId>
- <sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
- <sdncadapter:SvcAction>${msoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction>
- <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation>
- <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl>
- <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction>
- </sdncadapter:RequestHeader>
- <sdncadapterworkflow:SDNCRequestData>
- <request-information>
- <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id>
- <request-action>${msoUtils.xmlEscape(sdnc_requestAction)}</request-action>
- <source>${msoUtils.xmlEscape(source)}</source>
- <notification-url></notification-url>
- <order-number></order-number>
- <order-version></order-version>
- </request-information>
- <service-information>
- <service-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-id>
- <subscription-service-type>${msoUtils.xmlEscape(serviceType)}</subscription-service-type>
- <onap-model-information>
- <model-invariant-uuid>${msoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid>
- <model-uuid>${msoUtils.xmlEscape(serviceModelUuid)}</model-uuid>
- <model-version>${msoUtils.xmlEscape(serviceModelVersion)}</model-version>
- <model-name>${msoUtils.xmlEscape(serviceModelName)}</model-name>
- </onap-model-information>
- <service-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
- <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id>
- </service-information>
- <network-information>
- <onap-model-information>
- <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid>
- <model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid>
- <model-uuid>${msoUtils.xmlEscape(modelUuid)}</model-uuid>
- <model-version>${msoUtils.xmlEscape(modelVersion)}</model-version>
- <model-name>${msoUtils.xmlEscape(modelName)}</model-name>
- </onap-model-information>
- </network-information>
- <network-request-input>
- <network-input-parameters>$netowrkInputParameters</network-input-parameters>
- </network-request-input>
- </sdncadapterworkflow:SDNCRequestData>
- </aetgt:SDNCAdapterWorkflowRequest>""".trim()
- }
-
- **/
-
String sndcTopologyCreateRequesAsString = utils.formatXml(sdncTopologyCreateRequest)
execution.setVariable("sdncAdapterWorkflowRequest", sndcTopologyCreateRequesAsString)
logger.debug("sdncAdapterWorkflowRequest - " + "\n" + sndcTopologyCreateRequesAsString)
@@ -813,40 +674,20 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
String responseCode = execution.getVariable(Prefix + "sdncCreateReturnCode")
String responseObj = execution.getVariable(Prefix + "SuccessIndicator")
- def instnaceId = getInstnaceId(execution)
+ def instnaceId = getInstanceId(execution)
execution.setVariable("resourceInstanceId", instnaceId)
logger.info("response from sdnc, response code :" + responseCode + " response object :" + responseObj)
logger.info(" ***** Exit prepareSDNCRequest *****")
}
- private def getInstnaceId(DelegateExecution execution) {
+ private def getInstanceId(DelegateExecution execution) {
def response = new XmlSlurper().parseText(execution.getVariable("CRENWKI_createSDNCResponse"))
ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(execution.getVariable(Prefix + "resourceInput"), ResourceInput.class)
String modelName = resourceInputObj.getResourceModelInfo().getModelName()
def val = ""
-
- //switch (modelName) {
- // case ~/[\w\s\W]*deviceVF[\w\s\W]*/ :
- // case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ :
- // case ~/[\w\s\W]*Site[\w\s\W]*/:
- // val = response."response-data"."RequestData"."output"."vnf-response-information"."instance-id"
- // break
-
- // case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ :
- // case ~/[\w\s\W]*sotnvpprepareUpdateAfterCreateSDNCResourcenattachment[\w\s\W]*/:
- // val = response."response-data"."RequestData"."output"."connection-attachment-response-information"."instance-id"
- // break
-
- // for SDWANConnectivity and SOTNConnectivity and default:
- // default:
- // val = response."response-data"."RequestData"."output"."network-response-information"."instance-id"
- // break
- //}
-
-
String modelType = resourceInputObj.getResourceModelInfo().getModelType()
switch (modelType) {
case "VNF" :
@@ -855,7 +696,12 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
case "GROUP":
val = response."response-data"."RequestData"."output"."vf-module-response-information"."instance-id"
break
+ case "ALLOTTED_RESOURCE":
+ // sdwanvpnattachment or sotnvpnattachment
+ val = response."response-data"."RequestData"."output"."connection-attachment-response-information"."instance-id"
+ break
default:
+ // SDWANConnectivity or SOTN Connectivity
val = response."response-data"."RequestData"."output"."network-response-information"."instance-id"
break
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy
index 3d62a6ca90..097a1be291 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy
@@ -118,6 +118,8 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor
String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId")
String source = execution.getVariable("source")
String sdnc_service_id = execution.getVariable(Prefix + "sdncServiceId")
+ String resourceInput = execution.getVariable("resourceInput")
+ String allotedParentServiceInstanceId = execution.getVariable("allotedParentServiceInstanceId")
ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class)
String serviceType = resourceInputObj.getServiceType()
String serviceModelInvariantUuid = resourceInputObj.getServiceModelInfo().getModelInvariantUuid()
@@ -268,6 +270,61 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor
</aetgt:SDNCAdapterWorkflowRequest>""".trim()
break
+ // sdwanvpnattachment or sotnvpnattachment
+ case "ALLOTTED_RESOURCE" :
+
+ sdncTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
+ xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
+ xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
+ <sdncadapter:RequestHeader>
+ <sdncadapter:RequestId>${msoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId>
+ <sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
+ <sdncadapter:SvcAction>${msoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction>
+ <sdncadapter:SvcOperation>connection-attachment-topology-operation</sdncadapter:SvcOperation>
+ <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl>
+ <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction>
+ </sdncadapter:RequestHeader>
+ <sdncadapterworkflow:SDNCRequestData>
+ <request-information>
+ <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id>
+ <request-action>${msoUtils.xmlEscape(sdnc_requestAction)}</request-action>
+ <source>${msoUtils.xmlEscape(source)}</source>
+ <notification-url></notification-url>
+ <order-number></order-number>
+ <order-version></order-version>
+ </request-information>
+ <service-information>
+ <service-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-id>
+ <subscription-service-type>${msoUtils.xmlEscape(serviceType)}</subscription-service-type>
+ <onap-model-information>
+ <model-invariant-uuid>${msoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid>
+ <model-uuid>${msoUtils.xmlEscape(serviceModelUuid)}</model-uuid>
+ <model-version>${msoUtils.xmlEscape(serviceModelVersion)}</model-version>
+ <model-name>${msoUtils.xmlEscape(serviceModelName)}</model-name>
+ </onap-model-information>
+ <service-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
+ <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id>
+ <subscriber-name></subscriber-name>
+ </service-information>
+ <allotted-resource-information>
+ <allotted-resource-id>$resourceInstnaceId</allotted-resource-id>
+ <allotted-resource-type></allotted-resource-type>
+ <parent-service-instance-id>$allotedParentServiceInstanceId</parent-service-instance-id>
+ <onap-model-information>
+ <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid>
+ <model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid>
+ <model-uuid>${msoUtils.xmlEscape(modelUuid)}</model-uuid>
+ <model-version>${msoUtils.xmlEscape(modelVersion)}</model-version>
+ <model-name>${msoUtils.xmlEscape(modelName)}</model-name>
+ </onap-model-information>
+ </allotted-resource-information>
+ <connection-attachment-request-input>
+ </connection-attachment-request-input>
+ </sdncadapterworkflow:SDNCRequestData>
+ </aetgt:SDNCAdapterWorkflowRequest>""".trim()
+
+ break
+
// for SDWANConnectivity and SOTNConnectivity:
default:
sdncTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
@@ -334,6 +391,7 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor
}
public void prepareUpdateAfterDeActivateSDNCResource(DelegateExecution execution) {
+ String resourceInput = execution.getVariable("resourceInput")
ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class)
String operType = resourceInputObj.getOperationType()
String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid()
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy
index 443c8f6616..64ae3dfbef 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy
@@ -217,6 +217,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
// ExternalAPI message format
String externalId = execution.getVariable("resourceName")
+ String serviceType = execution.getVariable("serviceType")
String category = "E2E Service"
String description = "Service Order from SPPartner"
String requestedStartDate = utils.generateCurrentTimeInUtc()
@@ -224,13 +225,14 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
String priority = "1" // 0-4 0:highest
String subscriberId = execution.getVariable("globalSubscriberId")
String customerRole = "ONAPcustomer"
- String subscriberName = subscriberId
+ // Below SO will pass serviceType as subscriberName and externalAPI will use
+ // the same serviceType in another domain instead of model name
+ String subscriberName = serviceType
String referredType = "Consumer"
String orderItemId = "1"
String action = "delete" //for delete
String serviceState = "active"
String serviceName = ""
- String serviceType = execution.getVariable("serviceType")
String serviceId = execution.getVariable(Prefix + "SppartnerId")
queryServicefrom3rdONAP(execution)
@@ -260,7 +262,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
String payload = externalAPIUtil.setTemplate(ExternalAPIUtil.PostServiceOrderRequestsTemplate, valueMap)
execution.setVariable(Prefix + "Payload", payload)
- logger.info( "Exit " + prepare3rdONAPRequest)
+ logger.info( "***** Exit prepare3rdONAPRequest *****")
}
private void queryServicefrom3rdONAP(DelegateExecution execution)
@@ -294,7 +296,8 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
{
logger.debug("Get Service Received a Good Response")
JSONArray responseList = new JSONArray(extApiResponse)
- for(JSONObject obj : responseList) {
+ for(int i=0; i< responseList.length(); i++) {
+ JSONObject obj = responseList.getJSONObject(i)
String svcId = obj.get("id")
if(StringUtils.equalsIgnoreCase(SppartnerServiceId, svcId)) {
JSONObject serviceSpecification = obj.get("serviceSpecification")
@@ -311,7 +314,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
}catch(Exception e) {
logger.error("queryServicefrom3rdONAP exception:" + e.getMessage())
}
- logger.info( "Exit " + queryServicefrom3rdONAP)
+ logger.info( "***** Exit queryServicefrom3rdONAP *****")
}
public void doDeleteE2ESIin3rdONAP(DelegateExecution execution) {
@@ -354,7 +357,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
}catch(Exception e) {
logger.error("doDeleteE2ESIin3rdONAP exception:" + e.getMessage())
}
- logger.info( "Exit " + doDeleteE2ESIin3rdONAP)
+ logger.info( "***** Exit doDeleteE2ESIin3rdONAP *****")
}
@@ -450,7 +453,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
execution.setVariable("statusDescription", "Get Delete ServiceOrder Exception")
logger.error("getE2ESIProgressin3rdONAP exception:" + e.getMessage())
}
- logger.info( "Exit " + getE2ESIProgressin3rdONAP)
+ logger.info( "***** Exit getE2ESIProgressin3rdONAP *****")
}
/**
@@ -495,7 +498,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
// throw new BpmnError("MSOWorkflowException")
}
- logger.info( "Exit " + getSPPartnerInAAI)
+ logger.info( "***** Exit getSPPartnerInAAI *****")
}
public void deleteSPPartnerInAAI(DelegateExecution execution) {
@@ -516,7 +519,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
}
- logger.info( "Exit " + deleteSPPartnerInAAI)
+ logger.info( "**** Exit deleteSPPartnerInAAI ****")
}
private void setProgressUpdateVariables(DelegateExecution execution, String body) {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy
index 49f0e14d17..7c8b7eb7cc 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy
@@ -25,6 +25,9 @@ package org.onap.so.bpmn.infrastructure.scripts
import org.apache.commons.lang3.*
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.aai.domain.yang.AllottedResource
+import org.onap.aai.domain.yang.Relationship
+import org.onap.aai.domain.yang.RelationshipData
import org.onap.so.bpmn.common.recipe.ResourceInput
import org.onap.so.bpmn.common.resource.ResourceRequestBuilder
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
@@ -35,9 +38,16 @@ import org.onap.so.bpmn.core.domain.ModelInfo
import org.onap.so.bpmn.core.domain.ResourceType
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.AAIResourcesClient
+import org.onap.so.client.aai.entities.AAIResultWrapper
+import org.onap.so.client.aai.entities.uri.AAIResourceUri
+import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.slf4j.Logger
import org.slf4j.LoggerFactory
+import javax.ws.rs.NotFoundException
+
import static org.apache.commons.lang3.StringUtils.*
/**
@@ -76,6 +86,27 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
//Deal with recipeParams
String recipeParamsFromWf = execution.getVariable("recipeParamXsd")
String resourceModelName = resourceInputObj.getResourceModelInfo().getModelName()
+ String resourceInstanceId = resourceInputObj.getResourceInstancenUuid()
+ String globalCustomerId = resourceInputObj.getGlobalSubscriberId()
+ String serviceType = resourceInputObj.getServiceType()
+ String serviceInstanceId = resourceInputObj.getServiceInstanceId()
+
+ // fetch parent instance id for allotted resources
+ String modelType = resourceInputObj.getResourceModelInfo().getModelType()
+ switch (modelType) {
+ // sdwanvpnattachment or sotnvpnattachment
+ case "ALLOTTED_RESOURCE":
+ String parentServiceId = fetchParentServiceInstance(globalCustomerId, serviceType, serviceInstanceId, resourceInstanceId)
+ if (null != parentServiceId) {
+ execution.setVariable("allotedParentServiceInstanceId", parentServiceId)
+ } else {
+ logger.warn("Alloted Resource ParentServiceInstanceId not found in AAI response for allotedId: " + resourceInstanceId)
+ }
+ break;
+ default:
+ break;
+ }
+
//For sdnc requestAction default is "NetworkInstance"
String operationType = "Network"
if(!StringUtils.isBlank(recipeParamsFromRequest) && "null" != recipeParamsFromRequest){
@@ -106,13 +137,47 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception ex){
- msg = "Exception in preProcessRequest " + ex.getMessage()
+ String msg = "Exception in preProcessRequest " + ex.getMessage()
logger.debug( msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
logger.info(" ***** Exit preProcessRequest *****")
}
+ private String fetchParentServiceInstance(String globalCustId, String serviceType, String serviceInstanceId, String allotedResourceId ) {
+ logger.trace("Entered fetchParentServiceInstance")
+ try {
+ String parentServiceId = "";
+ AAIResourcesClient resourceClient = new AAIResourcesClient();
+ AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.ALLOTTED_RESOURCE, globalCustId, serviceType, serviceInstanceId, allotedResourceId)
+ AAIResultWrapper aaiResult = resourceClient.get(serviceInstanceUri, NotFoundException.class)
+ Optional<AllottedResource> si = aaiResult.asBean(AllottedResource.class)
+ if((si.present) && (null != si.get().getRelationshipList()) && (null != si.get().getRelationshipList().getRelationship())) {
+ logger.debug("SI Data relationship-list exists")
+ List<Relationship> relationshipList = si.get().getRelationshipList().getRelationship()
+ for (Relationship relationship : relationshipList) {
+ String rt = relationship.getRelatedTo()
+ List<RelationshipData> rl_datas = relationship.getRelationshipData()
+ if(rt.equals("service-instance") ){
+ for (RelationshipData rl_data : rl_datas) {
+ String eKey = rl_data.getRelationshipKey()
+ String eValue = rl_data.getRelationshipValue()
+ if(eKey.equals("service-instance.service-instance-id") && (!eValue.equals(serviceInstanceId))){
+ return eValue
+ }
+ }
+ }
+ }
+ }
+
+ logger.trace("Exited fetchParentServiceInstance")
+ }catch(Exception e){
+ logger.debug("Error occured within deleteServiceInstance method: " + e)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Error occured during deleteServiceInstance from aai")
+ }
+ return null
+ }
+
/**
* Pre Process the BPMN Flow Request
* Includes:
@@ -135,6 +200,7 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
String sdnc_service_id = execution.getVariable(Prefix + "sdncServiceId")
String resourceInput = execution.getVariable(Prefix + "resourceInput")
logger.info("The resourceInput is: " + resourceInput)
+ String allotedParentServiceInstanceId = execution.getVariable("allotedParentServiceInstanceId")
ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class)
String serviceType = resourceInputObj.getServiceType()
String serviceModelInvariantUuid = resourceInputObj.getServiceModelInfo().getModelInvariantUuid()
@@ -285,7 +351,61 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
</aetgt:SDNCAdapterWorkflowRequest>""".trim()
break
- // for SDWANConnectivity and SOTNConnectivity:
+ // sdwanvpnattachment or sotnvpnattachment
+ case "ALLOTTED_RESOURCE" :
+ sdncTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
+ xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
+ xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
+ <sdncadapter:RequestHeader>
+ <sdncadapter:RequestId>${msoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId>
+ <sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
+ <sdncadapter:SvcAction>${msoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction>
+ <sdncadapter:SvcOperation>connection-attachment-topology-operation</sdncadapter:SvcOperation>
+ <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl>
+ <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction>
+ </sdncadapter:RequestHeader>
+ <sdncadapterworkflow:SDNCRequestData>
+ <request-information>
+ <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id>
+ <request-action>${msoUtils.xmlEscape(sdnc_requestAction)}</request-action>
+ <source>${msoUtils.xmlEscape(source)}</source>
+ <notification-url></notification-url>
+ <order-number></order-number>
+ <order-version></order-version>
+ </request-information>
+ <service-information>
+ <service-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-id>
+ <subscription-service-type>${msoUtils.xmlEscape(serviceType)}</subscription-service-type>
+ <onap-model-information>
+ <model-invariant-uuid>${msoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid>
+ <model-uuid>${msoUtils.xmlEscape(serviceModelUuid)}</model-uuid>
+ <model-version>${msoUtils.xmlEscape(serviceModelVersion)}</model-version>
+ <model-name>${msoUtils.xmlEscape(serviceModelName)}</model-name>
+ </onap-model-information>
+ <service-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
+ <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id>
+ <subscriber-name></subscriber-name>
+ </service-information>
+ <allotted-resource-information>
+ <allotted-resource-id>$resourceInstnaceId</allotted-resource-id>
+ <allotted-resource-type></allotted-resource-type>
+ <parent-service-instance-id>$allotedParentServiceInstanceId</parent-service-instance-id>
+ <onap-model-information>
+ <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid>
+ <model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid>
+ <model-uuid>${msoUtils.xmlEscape(modelUuid)}</model-uuid>
+ <model-version>${msoUtils.xmlEscape(modelVersion)}</model-version>
+ <model-name>${msoUtils.xmlEscape(modelName)}</model-name>
+ </onap-model-information>
+ </allotted-resource-information>
+ <connection-attachment-request-input>
+ </connection-attachment-request-input>
+ </sdncadapterworkflow:SDNCRequestData>
+ </aetgt:SDNCAdapterWorkflowRequest>""".trim()
+
+ break
+
+ // for SDWANConnectivity and SOTNConnectivity:
default:
sdncTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy
index a5a92b6b06..d9f9299616 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy
@@ -22,6 +22,9 @@
*/
package org.onap.so.bpmn.infrastructure.scripts
+import com.fasterxml.jackson.databind.ObjectMapper
+import com.fasterxml.jackson.databind.SerializationFeature
+
import org.onap.so.logger.LoggingAnchor
import org.onap.so.logger.ErrorCode;
@@ -31,6 +34,7 @@ import javax.ws.rs.NotFoundException
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.aai.domain.yang.Relationship
import org.onap.aai.domain.yang.ServiceInstance
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
@@ -291,6 +295,103 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
logger.trace("Exit createServiceInstance ")
}
+ public void createCustomRelationship(DelegateExecution execution) {
+ logger.trace("createCustomRelationship ")
+ String msg = ""
+ try {
+ String uuiRequest = execution.getVariable("uuiRequest")
+ String vpnName = isNeedProcessCustomRelationship(uuiRequest)
+
+ if(null != vpnName){
+ logger.debug("fetching resource-link information for the given sotnVpnName:"+vpnName)
+ // fetch the service instance to link the relationship
+ AAIResourcesClient client = new AAIResourcesClient()
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.NODES_QUERY).queryParam("search-node-type","service-instance").queryParam("filter","service-instance-name:EQUALS:"+vpnName)
+ AAIResultWrapper aaiResult = client.get(uri,NotFoundException.class)
+ Map<String, Object> result = aaiResult.asMap()
+ List<Object> resources =
+ (List<Object>) result.getOrDefault("result-data", Collections.emptyList());
+ if(resources.size()>0) {
+ String relationshipUrl = ((Map<String, Object>) resources.get(0)).get("resource-link")
+
+ final Relationship body = new Relationship();
+ body.setRelatedLink(relationshipUrl)
+
+ createRelationShipInAAI(execution, body)
+ } else {
+ logger.warn("No resource-link found for the given sotnVpnName:"+vpnName)
+ }
+
+ } else {
+ logger.error("VPNName not found in request input")
+ }
+
+
+
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception ex) {
+
+ msg = "Exception in DoCreateE2EServiceInstance.createCustomRelationship. " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.trace("Exit createCustomRelationship ")
+ }
+
+ private void createRelationShipInAAI(DelegateExecution execution, final Relationship relationship){
+ logger.trace("createRelationShipInAAI ")
+ String msg = ""
+ try {
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ AAIResourcesClient client = new AAIResourcesClient()
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("serviceType"), serviceInstanceId).relationshipAPI()
+ client.create(uri, relationship)
+
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception ex) {
+
+ msg = "Exception in DoCreateE2EServiceInstance.createRelationShipInAAI. " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.trace("Exit createRelationShipInAAI ")
+
+ }
+
+ private String isNeedProcessCustomRelationship(String uuiRequest) {
+ String requestInput = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs")
+ Map<String, String> requestInputObject = getJsonObject(requestInput, Map.class);
+ if (requestInputObject == null) {
+ return null;
+ }
+
+ Optional<Map.Entry> firstKey =
+ requestInputObject.entrySet()
+ .stream()
+ .filter({entry -> entry.getKey().toString().contains("_sotnVpnName")})
+ .findFirst()
+ if (firstKey.isPresent()) {
+ return firstKey.get().getValue()
+ }
+
+ return null
+ }
+
+ private static <T> T getJsonObject(String jsonstr, Class<T> type) {
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
+ try {
+ return mapper.readValue(jsonstr, type);
+ } catch (IOException e) {
+ logger.error("{} {} fail to unMarshal json", MessageEnum.RA_NS_EXC.toString(),
+ ErrorCode.BusinessProcesssError.getValue(), e);
+ }
+ return null;
+ }
+
+
/**
* Gets the service instance and its relationships from aai
*/
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy
index 587337b647..b1356b9fb6 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy
@@ -28,7 +28,6 @@ import com.google.gson.Gson
import org.apache.http.util.EntityUtils
import org.onap.so.bpmn.common.resource.InstanceResourceList
import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory
-import org.onap.so.bpmn.core.domain.GroupResource
import org.onap.so.bpmn.core.domain.ModelInfo
import org.onap.so.bpmn.core.domain.ResourceType
import org.onap.so.bpmn.infrastructure.properties.BPMNProperties
@@ -96,16 +95,6 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
logger.trace("Exit preProcessRequest ")
}
- // this method will convert resource list to instance_resource_list
- public void prepareInstanceResourceList(DelegateExecution execution) {
-
- String uuiRequest = execution.getVariable("uuiRequest")
- List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList")
- List<Resource> instanceResourceList = InstanceResourceList.getInstanceResourceList(sequencedResourceList, uuiRequest)
-
- execution.setVariable("instanceResourceList", instanceResourceList)
- }
-
public void sequenceResoure(DelegateExecution execution) {
logger.trace("Start sequenceResoure Process ")
@@ -134,23 +123,20 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
for (resourceType in resourceSequence) {
for (resource in addResourceList) {
if (StringUtils.containsIgnoreCase(resource.getModelInfo().getModelName(), resourceType)) {
- sequencedResourceList.add(resource)
+
// if resource type is vnfResource then check for groups also
// Did not use continue because if same model type is used twice
// then we would like to add it twice for processing
- // e.g. S{ V1{G1, G2, G1}} --> S{ V1{G1, G1, G2}}
- if (resource instanceof VnfResource) {
- if (resource.getGroupOrder() != null && !StringUtils.isEmpty(resource.getGroupOrder())) {
- String[] grpSequence = resource.getGroupOrder().split(",")
- for (String grpType in grpSequence) {
- for (GroupResource gResource in resource.getGroups()) {
- if (StringUtils.containsIgnoreCase(gResource.getModelInfo().getModelName(), grpType)) {
- sequencedResourceList.add(gResource)
- }
- }
- }
- }
+ // ex-1. S{ V1{G1, G2}} --> S{ V1{G1, G1, G2}}
+ // ex-2. S{ V1{G1, G2}} --> S{ V1{G1, G2, G2, G2} V1 {G1, G1, G2}}
+ if ((resource.getResourceType() == ResourceType.VNF) && (resource instanceof VnfResource)) {
+
+ // check the size of VNF/Group list from UUI
+ List<Resource> sequencedInstanceResourceList = InstanceResourceList.getInstanceResourceList((VnfResource) resource, incomingRequest)
+ sequencedResourceList.addAll(sequencedInstanceResourceList)
+ } else {
+ sequencedResourceList.add(resource)
}
if (resource instanceof NetworkResource) {
networkResourceList.add(resource)
@@ -167,7 +153,9 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
for (Resource rc : addResourceList){
if (rc instanceof VnfResource) {
- vnfResourceList.add(rc)
+ // check the size of VNF/Group list from UUI
+ List<Resource> sequencedGroupResourceList = InstanceResourceList.getInstanceResourceList((VnfResource) rc, incomingRequest)
+ vnfResourceList.addAll(sequencedGroupResourceList)
} else if (rc instanceof NetworkResource) {
networkResourceList.add(rc)
} else if (rc instanceof AllottedResource) {
@@ -216,8 +204,8 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
public void getCurrentResoure(DelegateExecution execution){
logger.trace("Start getCurrentResoure Process ")
def currentIndex = execution.getVariable("currentResourceIndex")
- List<Resource> instanceResourceList = execution.getVariable("instanceResourceList")
- Resource currentResource = instanceResourceList.get(currentIndex)
+ List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList")
+ Resource currentResource = sequencedResourceList.get(currentIndex)
execution.setVariable("resourceType", currentResource.getModelInfo().getModelName())
logger.info("Now we deal with resource:" + currentResource.getModelInfo().getModelName())
logger.trace("COMPLETED getCurrentResource Process ")
@@ -228,8 +216,8 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
def currentIndex = execution.getVariable("currentResourceIndex")
def nextIndex = currentIndex + 1
execution.setVariable("currentResourceIndex", nextIndex)
- List<Resource> instanceResourceList = execution.getVariable("instanceResourceList")
- if(nextIndex >= instanceResourceList.size()){
+ List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList")
+ if(nextIndex >= sequencedResourceList.size()){
execution.setVariable("allResourceFinished", "true")
}else{
execution.setVariable("allResourceFinished", "false")
@@ -256,7 +244,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
resourceInput.setOperationId(operationId)
resourceInput.setOperationType(operationType);
def currentIndex = execution.getVariable("currentResourceIndex")
- List<Resource> sequencedResourceList = execution.getVariable("instanceResourceList")
+ List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList")
Resource currentResource = sequencedResourceList.get(currentIndex)
resourceInput.setResourceModelInfo(currentResource.getModelInfo())
resourceInput.getResourceModelInfo().setModelType(currentResource.getResourceType().toString())
@@ -320,8 +308,8 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
HttpResponse resp = bpmnRestClient.post(recipeURL, requestId, recipeTimeOut, requestAction, serviceInstanceId, serviceType, resourceInput, recipeParamXsd)
def currentIndex = execution.getVariable("currentResourceIndex")
- List<Resource> instanceResourceList = execution.getVariable("instanceResourceList") as List<Resource>
- Resource currentResource = instanceResourceList.get(currentIndex)
+ List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList") as List<Resource>
+ Resource currentResource = sequencedResourceList.get(currentIndex)
if(ResourceType.VNF == currentResource.getResourceType()) {
if (resp.getStatusLine().getStatusCode() > 199 && resp.getStatusLine().getStatusCode() < 300) {
String responseString = EntityUtils.toString(resp.getEntity(), "UTF-8")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy
index e24597aab3..481a79a7ef 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy
@@ -58,9 +58,9 @@ import org.onap.so.utils.TargetEntity
import org.springframework.web.util.UriUtils
import javax.ws.rs.NotFoundException
+import javax.ws.rs.core.MediaType
import javax.ws.rs.core.Response
-
import static org.apache.commons.lang3.StringUtils.isBlank
/**
@@ -237,6 +237,9 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
)) {
jObj.put("resourceInstanceId", eValue)
}
+ else if (rt.equals("allotted-resource") && eKey.equals("allotted-resource.id")){
+ jObj.put("resourceInstanceId", eValue)
+ }
// for sp-partner and others
else if (eKey.endsWith("-id")) {
jObj.put("resourceInstanceId", eValue)
@@ -386,7 +389,10 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
URL url = new URL(serviceAaiPath)
HttpClient client = new HttpClientFactory().newXmlClient(url, TargetEntity.AAI)
-
+ client.addBasicAuthHeader(UrnPropertiesReader.getVariable("aai.auth", execution), UrnPropertiesReader.getVariable("mso.msoKey", execution))
+ client.addAdditionalHeader("X-FromAppId", "MSO")
+ client.addAdditionalHeader("X-TransactionId", utils.getRequestID())
+ client.setAcceptType(MediaType.APPLICATION_XML)
Response response = client.get()
int responseCode = response.getStatus()
@@ -413,12 +419,17 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
if(jObj.has("model-invariant-id")) {
modelInvariantId = jObj.get("model-invariant-id")
modelUuid = jObj.get("model-version-id")
- modelCustomizationId = jObj.get("model-customization-id")
+ if (jObj.has("model-customization-id")) {
+ modelCustomizationId = jObj.get("model-customization-id")
+ } else {
+ logger.info("resource customization id is not found for :" + url)
+ }
}
jObj.put("modelInvariantId", modelInvariantId)
jObj.put("modelVersionId", modelUuid)
jObj.put("modelCustomizationId", modelCustomizationId)
+ logger.info("resource detail from AAI:" + jObj)
}
else {
String exceptionMessage = "Get RelatedResource Received a Bad Response Code. Response Code is: " + responseCode
@@ -505,11 +516,12 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
String modelName = resource.getModelInfo().getModelName()
String modelCustomizationUuid = resource.getModelInfo().getModelCustomizationUuid()
+ String modelUuid = resource.getModelInfo().getModelUuid()
if (StringUtils.containsIgnoreCase(obj.get("resourceType"), modelName)) {
resource.setResourceId(obj.get("resourceInstanceId"))
//deleteRealResourceList.add(resource)
matches = true;
- } else if (modelCustomizationUuid.equals(obj.get("modelCustomizationId"))) {
+ } else if (modelCustomizationUuid.equals(obj.get("modelCustomizationId")) || modelUuid.equals(obj.get("model-version-id")) ) {
resource.setResourceId(obj.get("resourceInstanceId"))
resource.setResourceInstanceName(obj.get("resourceType"))
//deleteRealResourceList.add(resource)
@@ -624,4 +636,26 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
//to do
}
+ /**
+ * Deletes the service instance in aai
+ */
+ public void deleteServiceInstance(DelegateExecution execution) {
+ logger.trace("Entered deleteServiceInstance")
+ try {
+ String globalCustId = execution.getVariable("globalSubscriberId")
+ String serviceType = execution.getVariable("serviceType")
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+
+ AAIResourcesClient resourceClient = new AAIResourcesClient();
+ AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustId, serviceType, serviceInstanceId)
+ resourceClient.delete(serviceInstanceUri)
+
+ logger.trace("Exited deleteServiceInstance")
+ }catch(Exception e){
+ logger.debug("Error occured within deleteServiceInstance method: " + e)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Error occured during deleteServiceInstance from aai")
+ }
+ }
+
+
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy
index 2dcfcaa4f4..53c1e311e2 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy
@@ -271,6 +271,7 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor {
execution.setVariable("sequencedResourceList", sequencedResourceList)
execution.setVariable("parentVNF", parentVNF)
logger.debug("resourceSequence: " + resourceSequence)
+ logger.debug("delete resource sequence list : " + sequencedResourceList)
logger.debug(" ======== END sequenceResource Process ======== ")
}