aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
authorsubhash kumar singh <subhash.kumar.singh@huawei.com>2019-05-21 07:06:24 +0000
committerGerrit Code Review <gerrit@onap.org>2019-05-21 07:06:24 +0000
commit832a7bc6114ef9f539fc172004d3d1c2c355dd62 (patch)
tree960443632a6d540ec85357f302ee1fbd83a976e9 /bpmn
parent6ccd240f9a6fa92939432eb43b66b28c2147945e (diff)
parent140cd9c29a4f1ab9aa9590f07ac6b653ca459ffa (diff)
Merge "Fix SDNC Resource creation workflow"
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceInput.java24
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/InstanceResourceList.java14
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy70
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy417
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy64
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSDNCNetworkResource.bpmn30
6 files changed, 400 insertions, 219 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceInput.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceInput.java
index 2bb024897c..33c48fbe44 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceInput.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceInput.java
@@ -84,6 +84,30 @@ public class ResourceInput {
@JsonProperty("operationType")
private String operationType;
+ @JsonProperty("vfModelInfo")
+ private ModelInfo vfModelInfo;
+
+
+ @JsonProperty("vnf-Id")
+ private String vnfId;
+
+ public String getVnfId() {
+ return vnfId;
+ }
+
+ public void setVnfId(String vnfId) {
+ this.vnfId = vnfId;
+ }
+
+ public ModelInfo getVfModelInfo() {
+ return vfModelInfo;
+ }
+
+ public void setVfModelInfo(ModelInfo vfModelInfo) {
+ this.vfModelInfo = vfModelInfo;
+ }
+
+
/**
* @return Returns the requestsInputs.
*/
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/InstanceResourceList.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/InstanceResourceList.java
index 71ea3b565b..e32a03dfa2 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/InstanceResourceList.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/InstanceResourceList.java
@@ -98,8 +98,6 @@ public class InstanceResourceList {
// ....}
// it will return sdwansiteresource_list
private static String getPrimaryKey(Resource resource) {
- String pk = "";
-
String resourceInput = "";
if (resource instanceof VnfResource) {
resourceInput = ((VnfResource) resource).getResourceInput();
@@ -111,10 +109,16 @@ public class InstanceResourceList {
Type type = new TypeToken<Map<String, String>>() {}.getType();
Map<String, String> map = gson.fromJson(resourceInput, type);
- Optional<String> pkOpt = map.values().stream().filter(e -> e.contains("[")).map(e -> e.replace("[", ""))
- .map(e -> e.split(",")[0]).findFirst();
+ if (map != null) {
+ Optional<String> pkOpt = map.values().stream().filter(e -> e.contains("[")).map(e -> e.replace("[", ""))
+ .map(e -> e.split(",")[0]).findFirst();
- return pkOpt.isPresent() ? pkOpt.get() : "";
+ return pkOpt.isPresent() ? pkOpt.get() : "";
+ } else {
+ // TODO: handle the case if VNF resource is not list
+ // e.g. { resourceInput
+ return "";
+ }
}
private static List<Resource> convertToInstanceResourceList(Map<String, List<List<GroupResource>>> normalizedReq,
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 f4bdde5e80..2d0b9e5a99 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
@@ -33,6 +33,7 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
+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.slf4j.Logger
@@ -52,7 +53,7 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
JsonUtils jsonUtil = new JsonUtils()
SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils()
-
+
MsoUtils msoUtils = new MsoUtils()
public void preProcessRequest(DelegateExecution execution) {
@@ -83,49 +84,17 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
}
String sdnc_svcAction = "activate"
- switch (resourceInputObj.getResourceModelInfo().getModelName()) {
- case ~/[\w\s\W]*SOTNConnectivity[\w\s\W]*/ :
- operationType = "SOTNConnectivity"
- break
-
- case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ :
- operationType = "SOTNAttachment"
- break
-
- case ~/[\w\s\W]*SiteVF[\w\s\W]*/ :
- operationType = "Site"
- break
-
- case ~/[\w\s\W]*deviceVF[\w\s\W]*/ :
- operationType = "SDWANDevice"
- execution.setVariable("isActivateRequired", "true")
- break
-
- case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ :
- operationType = "SDWANPort"
- execution.setVariable("isActivateRequired", "true")
- break
+ String sdnc_requestAction = UrnPropertiesReader.getVariable("resource-config." + resourceInputObj.resourceModelInfo.getModelName() +".operation-type")
+ String isActivateRequired = UrnPropertiesReader.getVariable("resource-config." + resourceInputObj.resourceModelInfo.getModelName() +".activation-required")
+ execution.setVariable("isActivateRequired", isActivateRequired)
- case ~/[\w\s\W]*SDWANConnectivity[\w\s\W]*/ :
- operationType = "SDWANConnectivity"
- break
-
- case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ :
- operationType = "SDWANAttachment"
- break
-
- default:
- break
- }
-
- String sdnc_requestAction = StringUtils.capitalize(sdnc_svcAction) + operationType +"Instance"
execution.setVariable(Prefix + "svcAction", sdnc_svcAction)
execution.setVariable(Prefix + "requestAction", sdnc_requestAction)
execution.setVariable(Prefix + "serviceInstanceId", resourceInputObj.getServiceInstanceId())
execution.setVariable("mso-request-id", requestId)
execution.setVariable("mso-service-instance-id", resourceInputObj.getServiceInstanceId())
} catch (BpmnError e) {
- throw e;
+ throw e
} catch (Exception ex){
String msg = "Exception in preProcessRequest " + ex.getMessage()
logger.debug(msg)
@@ -174,20 +143,20 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
}
String customizeResourceParam(String networkInputParametersJson) {
- List<Map<String, Object>> paramList = new ArrayList();
+ List<Map<String, Object>> paramList = new ArrayList()
JSONObject jsonObject = new JSONObject(networkInputParametersJson);
- Iterator iterator = jsonObject.keys();
+ Iterator iterator = jsonObject.keys()
while (iterator.hasNext()) {
- String key = iterator.next();
- HashMap<String, String> hashMap = new HashMap();
+ String key = iterator.next()
+ HashMap<String, String> hashMap = new HashMap()
hashMap.put("name", key);
hashMap.put("value", jsonObject.get(key))
paramList.add(hashMap)
}
- Map<String, List<Map<String, Object>>> paramMap = new HashMap();
- paramMap.put("param", paramList);
+ Map<String, List<Map<String, Object>>> paramMap = new HashMap()
+ paramMap.put("param", paramList)
- return new JSONObject(paramMap).toString();
+ return new JSONObject(paramMap).toString()
}
public void prepareSDNCRequest (DelegateExecution execution) {
@@ -224,11 +193,9 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
String netowrkInputParameters = XML.toString(new JSONObject(customizeResourceParam(networkInputParametersJson)))
// 1. prepare assign topology via SDNC Adapter SUBFLOW call
String sdncTopologyActivateRequest = ""
-
- 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]*/:
+ String modelType = resourceInputObj.getResourceModelInfo().getModelType()
+ switch (modelType) {
+ case "VNF" :
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">
@@ -286,8 +253,7 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
</aetgt:SDNCAdapterWorkflowRequest>""".trim()
break
- case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ :
- case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/:
+ case "GROUP" :
sdncTopologyActivateRequest =
"""<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
@@ -434,4 +400,4 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
}
logger.info("exited send sync Resp")
}
-}
+} \ No newline at end of file
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 6a5a9021b2..4c4b63101f 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,6 +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
@@ -39,6 +40,8 @@ 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
+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.AAIObjectPlurals
@@ -86,6 +89,7 @@ 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"
if(!StringUtils.isBlank(recipeParamsFromRequest)){
@@ -97,83 +101,18 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
operationType = jsonUtil.getJsonValue(recipeParamsFromWf, "operationType")
}
-
- //For sdnc, generate svc_action and request_action
String sdnc_svcAction = "create"
- switch (resourceInputObj.getResourceInstanceName()) {
-
- case ~/[\w\s\W]*overlay[\w\s\W]*/ :
- //This will be resolved in R3.
- sdnc_svcAction ="activate"
- operationType = "NCINetwork"
- break
-
- case ~/[\w\s\W]*underlay[\w\s\W]*/ :
- //This will be resolved in R3.
- operationType ="Network"
- break
-
- case ~/[\w\s\W]*SOTNConnectivity[\w\s\W]*/ :
- operationType = "SOTNConnectivity"
- execution.setVariable("isActivateRequired", "true")
- break
-
- case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ :
- operationType = "SOTNAttachment"
- execution.setVariable("isActivateRequired", "true")
- break
-
- case ~/[\w\s\W]*SiteVF[\w\s\W]*/ :
- operationType = "Site"
- execution.setVariable("isActivateRequired", "true")
- break
-
- case ~/[\w\s\W]*deviceVF[\w\s\W]*/ :
- operationType = "SDWANDevice"
- execution.setVariable("isActivateRequired", "true")
- break
-
- case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ :
- operationType = "SDWANPort"
- execution.setVariable("isActivateRequired", "true")
- break
-
- case ~/[\w\s\W]*SDWANConnectivity[\w\s\W]*/ :
- operationType = "SDWANConnectivity"
- execution.setVariable("isActivateRequired", "true")
- break
-
- case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ :
- operationType = "SDWANAttachment"
- execution.setVariable("isActivateRequired", "true")
- break
-
- case ~/[\w\s\W]*wanconnection[\w\s\W]*/ :
- execution.setVariable("isActivateRequired", "true")
- break
-
- case ~/[\w\s\W]*OLT[\w\s\W]*/ :
- operationType = "AccessConnectivity"
- execution.setVariable("isActivateRequired", "false")
- break
-
- case ~/[\w\s\W]*EdgeInternetProfile[\w\s\W]*/ :
- operationType = "InternetProfile"
- execution.setVariable("isActivateRequired", "false")
- break
+ String sdnc_requestAction = UrnPropertiesReader.getVariable("resource-config." + resourceInputObj.resourceModelInfo.getModelName() +".operation-type")
+ String isActivateRequired = UrnPropertiesReader.getVariable("resource-config." + resourceInputObj.resourceModelInfo.getModelName() +".activation-required")
+ execution.setVariable("isActivateRequired", isActivateRequired)
- default:
- break
- }
-
- String sdnc_requestAction = StringUtils.capitalize(sdnc_svcAction) + operationType +"Instance"
execution.setVariable(Prefix + "svcAction", sdnc_svcAction)
execution.setVariable(Prefix + "requestAction", sdnc_requestAction)
execution.setVariable(Prefix + "serviceInstanceId", resourceInputObj.getServiceInstanceId())
execution.setVariable("mso-request-id", requestId)
execution.setVariable("mso-service-instance-id", resourceInputObj.getServiceInstanceId())
} catch (BpmnError e) {
- throw e;
+ throw e
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
logger.debug(msg)
@@ -237,8 +176,8 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
String remoteId
List<Metadatum> metadatum = getMetaDatum(resourceInputObj.getGlobalSubscriberId(),
- resourceInputObj.getServiceType(),
- resourceInputObj.getServiceInstanceId())
+ resourceInputObj.getServiceType(),
+ resourceInputObj.getServiceInstanceId())
for(Metadatum datum: metadatum) {
if (datum.getMetaname().equalsIgnoreCase("cvlan")) {
cvlan = datum.getMetaval()
@@ -346,13 +285,13 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
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)
+ 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)
+ def parentServiceInstanceId = si.getServiceInstanceId()
+ execution.setVariable("parentServiceInstanceId", parentServiceInstanceId)
break
default:
@@ -399,12 +338,31 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
//here convert json string to xml string
String netowrkInputParameters = XML.toString(new JSONObject(customizeResourceParam(networkInputParametersJson)))
// 1. prepare assign topology via SDNC Adapter SUBFLOW call
- String sdncTopologyCreateRequest = ""
+ 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 (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]*/:
+ switch (modelType) {
+ case "VNF" :
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">
@@ -439,7 +397,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
<subscriber-name>${msoUtils.xmlEscape(globalCustomerId)}</subscriber-name>
</service-information>
<vnf-information>
- <vnf-id></vnf-id>
+ <vnf-id>${msoUtils.xmlEscape(vnfid)}</vnf-id>
<vnf-type></vnf-type>
<onap-model-information>
<model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid>
@@ -461,9 +419,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
</sdncadapterworkflow:SDNCRequestData>
</aetgt:SDNCAdapterWorkflowRequest>""".trim()
break
-
- case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ :
- case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ :
+ case "GROUP" :
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">
@@ -471,7 +427,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
<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:SvcOperation>network-topology-operation</sdncadapter:SvcOperation>
<sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl>
<sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction>
</sdncadapter:RequestHeader>
@@ -497,19 +453,22 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
<global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id>
<subscriber-name>${msoUtils.xmlEscape(globalCustomerId)}</subscriber-name>
</service-information>
- <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>
+ <vnf-information>
+ <model-invariant-uuid>${msoUtils.xmlEscape(vnfmodelInvariantUuid)}</model-invariant-uuid>
+ <model-customization-uuid>${msoUtils.xmlEscape(vnfmodelCustomizationUuid)}</model-customization-uuid>
+ <model-uuid>${msoUtils.xmlEscape(vnfmodelUuid)}</model-uuid>
+ <model-version>${msoUtils.xmlEscape(vnfmodelVersion)}</model-version>
+ <model-name>${msoUtils.xmlEscape(vnfmodelName)}</model-name>
+ </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>
<connection-attachment-request-input>
$netowrkInputParameters
</connection-attachment-request-input>
@@ -520,13 +479,70 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
// 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()
+
+
+ }
+
+
+
+
+ //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>${hdrRequestId}</sdncadapter:RequestId>
+ <sdncadapter:RequestId>${msoUtils.xmlEscape(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:SvcOperation>vnf-topology-operation</sdncadapter:SvcOperation>
<sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl>
<sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction>
</sdncadapter:RequestHeader>
@@ -550,8 +566,11 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
</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>
- <network-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>
@@ -559,13 +578,147 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
<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>
+ </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)
@@ -656,11 +809,8 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
String responseCode = execution.getVariable(Prefix + "sdncCreateReturnCode")
String responseObj = execution.getVariable(Prefix + "SuccessIndicator")
- def isActivateRequried = execution.getVariable("isActivateRequired")
- if (StringUtils.equalsIgnoreCase(isActivateRequried, "true")) {
- def instnaceId = getInstnaceId(execution)
- execution.setVariable("networkInstanceId", instnaceId)
- }
+ def instnaceId = getInstnaceId(execution)
+ execution.setVariable("resourceInstanceId", instnaceId)
logger.info("response from sdnc, response code :" + responseCode + " response object :" + responseObj)
logger.info(" ***** Exit prepareSDNCRequest *****")
@@ -673,24 +823,38 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
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]*/:
+
+ //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" :
val = response."response-data"."RequestData"."output"."vnf-response-information"."instance-id"
break
-
- case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ :
- case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/:
- val = response."response-data"."RequestData"."output"."connection-attachment-response-information"."instance-id"
+ case "GROUP":
+ val = response."response-data"."RequestData"."output"."vf-module-response-information"."instance-id"
break
-
- // for SDWANConnectivity and SOTNConnectivity and default:
default:
val = response."response-data"."RequestData"."output"."network-response-information"."instance-id"
break
}
-
return val.toString()
}
@@ -700,7 +864,8 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
try {
String operationStatus = "finished"
// RESTResponse for main flow
- String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim()
+ String vnfid=execution.getVariable("resourceInstanceId");
+ String resourceOperationResp = """{"operationStatus":"${operationStatus}","vnf-id":"${vnfid}"}""".trim()
logger.debug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp)
sendWorkflowResponse(execution, 202, resourceOperationResp)
execution.setVariable("sentSyncResponse", true)
@@ -712,4 +877,4 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
}
logger.debug(" ***** Exit sendSyncResponse *****")
}
-}
+} \ No newline at end of file
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 ea25904cf3..a303da9a8f 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
@@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -22,9 +22,15 @@
package org.onap.so.bpmn.infrastructure.scripts
+
+import com.google.common.reflect.TypeToken
+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
import org.apache.commons.lang3.StringUtils
import org.apache.http.HttpResponse
@@ -46,11 +52,12 @@ import org.onap.so.bpmn.common.resource.ResourceRequestBuilder
import org.slf4j.Logger
import org.slf4j.LoggerFactory
+import java.lang.reflect.Type
/**
* This groovy class supports the <class>DoCreateResources.bpmn</class> process.
- *
+ *
* Inputs:
* @param - msoRequestId
* @param - globalSubscriberId - O
@@ -58,7 +65,7 @@ import org.slf4j.LoggerFactory
* @param - serviceInstanceId
* @param - serviceInstanceName - O
* @param - serviceInputParams (should contain aic_zone for serviceTypes TRANSPORT,ATM)
- * @param - sdncVersion
+ * @param - sdncVersion
*
* @param - addResourceList
*
@@ -101,7 +108,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
public void sequenceResoure(DelegateExecution execution) {
logger.trace("Start sequenceResoure Process ")
-
+
String incomingRequest = execution.getVariable("uuiRequest")
String serviceModelUuid = jsonUtil.getJsonValue(incomingRequest,"service.serviceUuid")
@@ -114,10 +121,10 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
String serviceDecompose = execution.getVariable("serviceDecomposition")
String serviceModelName = jsonUtil.getJsonValue(serviceDecompose, "serviceResources.modelInfo.modelName")
- // get Sequence from properties
+ // get Sequence from properties
def resourceSequence = BPMNProperties.getResourceSequenceProp(serviceModelName)
- // get Sequence from csar(model)
+ // get Sequence from csar(model)
if(resourceSequence == null) {
resourceSequence = ResourceRequestBuilder.getResourceSequence(serviceModelUuid)
logger.info("Get Sequence from csar : " + resourceSequence)
@@ -254,21 +261,38 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
resourceInput.setResourceModelInfo(currentResource.getModelInfo())
resourceInput.getResourceModelInfo().setModelType(currentResource.getResourceType().toString())
ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
+
+ if (currentResource.getResourceType() == ResourceType.VNF) {
+ execution.setVariable("vfModelInfo", currentResource.getModelInfo())
+ }
+
+ resourceInput.setVfModelInfo(execution.getVariable("vfModelInfo") as ModelInfo)
+ String vnfId = execution.getVariable("vnf-id")
+ if (vnfId != null) {
+ resourceInput.setVnfId(vnfId)
+ }
+
+
resourceInput.setServiceModelInfo(serviceDecomposition.getModelInfo())
String incomingRequest = execution.getVariable("uuiRequest")
- //set the requestInputs from tempalte To Be Done
+ //set the requestInputs from template To Be Done
String uuiServiceParameters = jsonUtil.getJsonValue(incomingRequest, "service.parameters")
- Map<String, Object> currentVFData = (Map) execution.getVariable("currentVFData");
+
+ // current vfdata holds information for preparing input for resource
+ // e.g. it will hold
+ // { top_level_list_name, second_level_list_name, top_index, second_index, last processed node}
+ Map<String, Object> currentVFData = (Map) execution.getVariable("currentVFData")
+
if (null == currentVFData) {
- currentVFData = new HashMap<>();
+ currentVFData = new HashMap<>()
}
String resourceParameters = ResourceRequestBuilder.buildResourceRequestParameters(execution, currentResource, uuiServiceParameters, currentVFData)
resourceInput.setResourceParameters(resourceParameters)
resourceInput.setRequestsInputs(incomingRequest)
execution.setVariable("resourceInput", resourceInput.toString())
execution.setVariable("resourceModelUUID", resourceInput.getResourceModelInfo().getModelUuid())
- execution.setVariable("currentVFData",currentVFData);
+ execution.setVariable("currentVFData",currentVFData)
logger.trace("COMPLETED prepareResourceRecipeRequest Process ")
}
@@ -294,6 +318,22 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
BpmnRestClient bpmnRestClient = new BpmnRestClient()
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)
+ if(ResourceType.VNF == currentResource.getResourceType()) {
+ if (resp.getStatusLine().getStatusCode() > 199 && resp.getStatusLine().getStatusCode() < 300) {
+ String responseString = EntityUtils.toString(resp.getEntity(), "UTF-8")
+ if (responseString != null) {
+ Gson gson = new Gson()
+ Type type = new TypeToken<Map<String, String>>() {}.getType()
+ Map<String, Object> map = gson.fromJson(responseString, type)
+ Map<String, String> map1 = gson.fromJson(map.get("response"), type)
+ execution.setVariable("vnf-id",map1.get("vnf-id"))
+ }
+ }
+ }
} else {
String exceptionMessage = "Resource receipe is not found for resource modeluuid: " + resourceModelUUID
logger.trace(exceptionMessage)
@@ -313,4 +353,4 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
public void postConfigRequest(DelegateExecution execution){
//now do noting
}
-}
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSDNCNetworkResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSDNCNetworkResource.bpmn
index 8cde4f6c56..e5b361643f 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSDNCNetworkResource.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSDNCNetworkResource.bpmn
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.0.0">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.2.3">
<bpmn:process id="ActivateSDNCNetworkResource" name="ActivateSDNCNetworkResource" isExecutable="true">
<bpmn:startEvent id="createNS_StartEvent_activate" name="createNS_StartEvent">
<bpmn:outgoing>SequenceFlow_1c92ks3_activate</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:endEvent id="EndEvent_1x6k78c_activate" name="create SDNC call end">
- <bpmn:incoming>SequenceFlow_17md60u_activate</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_0ow44q0_activate</bpmn:incoming>
</bpmn:endEvent>
- <bpmn:sequenceFlow id="SequenceFlow_0ow44q0_activate" sourceRef="Task_023hred_activate" targetRef="ScriptTask_1g5zyi6_activate" />
+ <bpmn:sequenceFlow id="SequenceFlow_0ow44q0_activate" sourceRef="Task_023hred_activate" targetRef="EndEvent_1x6k78c_activate" />
<bpmn:scriptTask id="Task_023hred_activate" name="post SDNC activate call">
<bpmn:incoming>SequenceFlow_1vnx1pp_activate</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0ow44q0_activate</bpmn:outgoing>
@@ -54,14 +54,6 @@ dcsi.prepareUpdateAfterActivateSDNCResource(execution)</bpmn:script>
</bpmn:serviceTask>
<bpmn:sequenceFlow id="SequenceFlow_1jr6zi0_activate" sourceRef="Task_0uwlr22_activate" targetRef="ServiceTask_1cm8iwr_activate" />
<bpmn:sequenceFlow id="SequenceFlow_1vnx1pp_activate" sourceRef="ServiceTask_1cm8iwr_activate" targetRef="Task_023hred_activate" />
- <bpmn:scriptTask id="ScriptTask_1g5zyi6_activate" name="Send Sync Ack Response" scriptFormat="groovy">
- <bpmn:incoming>SequenceFlow_0ow44q0_activate</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_17md60u_activate</bpmn:outgoing>
- <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def csi = new ActivateSDNCNetworkResource()
-csi.sendSyncResponse(execution)</bpmn:script>
- </bpmn:scriptTask>
- <bpmn:sequenceFlow id="SequenceFlow_17md60u_activate" sourceRef="ScriptTask_1g5zyi6_activate" targetRef="EndEvent_1x6k78c_activate" />
<bpmn:sequenceFlow id="SequenceFlow_1c92ks3_activate" sourceRef="createNS_StartEvent_activate" targetRef="Task_13sx2bp_activate" />
<bpmn:scriptTask id="ScriptTask_1gih50a_activate" name="Prepare SDNC Actiate request" scriptFormat="groovy">
<bpmn:incoming>SequenceFlow_18l3crb_activate</bpmn:incoming>
@@ -96,14 +88,14 @@ dcsi.prepareSDNCRequest(execution)</bpmn:script>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c_activate">
- <dc:Bounds x="930" y="306" width="36" height="36" />
+ <dc:Bounds x="776" y="306" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="893" y="348" width="85" height="27" />
+ <dc:Bounds x="740" y="348" width="84" height="27" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0ow44q0_di" bpmnElement="SequenceFlow_0ow44q0_activate">
<di:waypoint x="694" y="324" />
- <di:waypoint x="765" y="324" />
+ <di:waypoint x="776" y="324" />
<bpmndi:BPMNLabel>
<dc:Bounds x="780.5" y="314" width="90" height="12" />
</bpmndi:BPMNLabel>
@@ -141,16 +133,6 @@ dcsi.prepareSDNCRequest(execution)</bpmn:script>
<dc:Bounds x="641" y="314" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ScriptTask_1g5zyi6_di" bpmnElement="ScriptTask_1g5zyi6_activate">
- <dc:Bounds x="765" y="284" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_17md60u_di" bpmnElement="SequenceFlow_17md60u_activate">
- <di:waypoint x="865" y="324" />
- <di:waypoint x="930" y="324" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="998" y="313" width="0" height="14" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1c92ks3_di" bpmnElement="SequenceFlow_1c92ks3_activate">
<di:waypoint x="-239" y="324" />
<di:waypoint x="-205" y="324" />