aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2019-03-14 16:02:18 -0400
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2019-03-14 16:03:06 -0400
commit0b906b0de95725879fd1cc7ad585d71c502eebd9 (patch)
tree40a19fd268fe177e806afa69771b61a308046266 /bpmn
parentff8c5e9f78b46f29c08576393438e902ea6d8cd6 (diff)
Added vnfc support to BB layer
added vnfc to gbb for execute bb and bb layer enhance workflow action layer to handle vnfcs Change-Id: I0d39c3aefe66180ed6f2b75a0c946e07ca603261 Issue-ID: SO-1658 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Configuration.java14
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VfModule.java9
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vnfc.java131
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ConfigurationResourceKeys.java7
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java24
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java5
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java5
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java18
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn195
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java124
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java113
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java75
12 files changed, 484 insertions, 236 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Configuration.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Configuration.java
index bcff93c5af..748d37d6e4 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Configuration.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Configuration.java
@@ -62,9 +62,11 @@ public class Configuration implements Serializable, ShallowCopy<Configuration> {
@JsonProperty("metadata")
private Metadata metadata;
@JsonProperty("forwarder-evcs")
- private List<ForwarderEvc> forwarderEvcs = new ArrayList<ForwarderEvc>();
+ private List<ForwarderEvc> forwarderEvcs = new ArrayList<>();
@JsonProperty("evcs")
- private List<Evc> evcs = new ArrayList<Evc>();
+ private List<Evc> evcs = new ArrayList<>();
+ @JsonProperty("vnfc")
+ private Vnfc vnfc = new Vnfc();
@JsonProperty("model-info-configuration")
private ModelInfoConfiguration modelInfoConfiguration;
@@ -88,6 +90,14 @@ public class Configuration implements Serializable, ShallowCopy<Configuration> {
public List<ForwarderEvc> getForwarderEvcs() {
return forwarderEvcs;
}
+
+ public Vnfc getVnfc() {
+ return vnfc;
+ }
+
+ public void setVnfc(Vnfc vnfc) {
+ this.vnfc = vnfc;
+ }
public List<Evc> getEvcs() {
return evcs;
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VfModule.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VfModule.java
index 469bc991b4..ceca929806 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VfModule.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VfModule.java
@@ -21,19 +21,21 @@
package org.onap.so.bpmn.servicedecomposition.bbobjects;
import java.io.Serializable;
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import javax.persistence.Id;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.onap.so.bpmn.servicedecomposition.ShallowCopy;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
-import org.onap.so.bpmn.servicedecomposition.ShallowCopy;
@JsonRootName("vf-module")
public class VfModule implements Serializable, ShallowCopy<VfModule> {
@@ -59,6 +61,8 @@ public class VfModule implements Serializable, ShallowCopy<VfModule> {
private Integer moduleIndex;
@JsonProperty("selflink")
private String selflink;
+ @JsonProperty("vnfcs")
+ private List<Vnfc> vnfcs = new ArrayList<>();
@JsonProperty("model-info-vf-module")
private ModelInfoVfModule modelInfoVfModule;
@@ -122,6 +126,9 @@ public class VfModule implements Serializable, ShallowCopy<VfModule> {
public void setCascaded(boolean cascaded) {
this.cascaded = cascaded;
}
+ public List<Vnfc> getVnfcs() {
+ return vnfcs;
+ }
@Override
public boolean equals(final Object other) {
if (!(other instanceof VfModule)) {
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vnfc.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vnfc.java
new file mode 100644
index 0000000000..68caeb244f
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vnfc.java
@@ -0,0 +1,131 @@
+package org.onap.so.bpmn.servicedecomposition.bbobjects;
+
+import java.io.Serializable;
+
+import javax.persistence.Id;
+
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonRootName;
+
+@JsonRootName("vnfc")
+public class Vnfc implements Serializable {
+
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ @Id
+ @JsonProperty("vnfc-name")
+ private String vnfcName;
+ @JsonProperty("nfc-naming-code")
+ private String nfcNamingCode;
+ @JsonProperty("nfc-function")
+ private String nfcFunction;
+ @JsonProperty("prov-status")
+ private String provStatus;
+ @JsonProperty("orchestration-status")
+ private String orchestrationStatus;
+ @JsonProperty("ipaddress-v4-oam-vip")
+ private String ipaddressV4OamVip;
+ @JsonProperty("in-maint")
+ private String inMaint;
+ @JsonProperty("is-closed-loop-disabled")
+ private String isClosedLoopDisabled;
+ @JsonProperty("group-notation")
+ private String groupNotation;
+ @JsonProperty("model-invariant-id")
+ private String modelInvariantId;
+ @JsonProperty("model-version-id")
+ private String modelVersionId;
+ @JsonProperty("model-customization-id")
+ private String modelCustomizationId;
+
+ @Override
+ public boolean equals(final Object other) {
+ if (!(other instanceof Vnfc)) {
+ return false;
+ }
+ Vnfc castOther = (Vnfc) other;
+ return new EqualsBuilder().append(vnfcName, castOther.vnfcName).isEquals();
+ }
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(vnfcName).toHashCode();
+ }
+ public String getVnfcName() {
+ return vnfcName;
+ }
+ public void setVnfcName(String vnfcName) {
+ this.vnfcName = vnfcName;
+ }
+ public String getNfcNamingCode() {
+ return nfcNamingCode;
+ }
+ public void setNfcNamingCode(String nfcNamingCode) {
+ this.nfcNamingCode = nfcNamingCode;
+ }
+ public String getNfcFunction() {
+ return nfcFunction;
+ }
+ public void setNfcFunction(String nfcFunction) {
+ this.nfcFunction = nfcFunction;
+ }
+ public String getProvStatus() {
+ return provStatus;
+ }
+ public void setProvStatus(String provStatus) {
+ this.provStatus = provStatus;
+ }
+ public String getOrchestrationStatus() {
+ return orchestrationStatus;
+ }
+ public void setOrchestrationStatus(String orchestrationStatus) {
+ this.orchestrationStatus = orchestrationStatus;
+ }
+ public String getIpaddressV4OamVip() {
+ return ipaddressV4OamVip;
+ }
+ public void setIpaddressV4OamVip(String ipaddressV4OamVip) {
+ this.ipaddressV4OamVip = ipaddressV4OamVip;
+ }
+ public String getInMaint() {
+ return inMaint;
+ }
+ public void setInMaint(String inMaint) {
+ this.inMaint = inMaint;
+ }
+ public String getIsClosedLoopDisabled() {
+ return isClosedLoopDisabled;
+ }
+ public void setIsClosedLoopDisabled(String isClosedLoopDisabled) {
+ this.isClosedLoopDisabled = isClosedLoopDisabled;
+ }
+ public String getGroupNotation() {
+ return groupNotation;
+ }
+ public void setGroupNotation(String groupNotation) {
+ this.groupNotation = groupNotation;
+ }
+ public String getModelInvariantId() {
+ return modelInvariantId;
+ }
+ public void setModelInvariantId(String modelInvariantId) {
+ this.modelInvariantId = modelInvariantId;
+ }
+ public String getModelVersionId() {
+ return modelVersionId;
+ }
+ public void setModelVersionId(String modelVersionId) {
+ this.modelVersionId = modelVersionId;
+ }
+ public String getModelCustomizationId() {
+ return modelCustomizationId;
+ }
+ public void setModelCustomizationId(String modelCustomizationId) {
+ this.modelCustomizationId = modelCustomizationId;
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ConfigurationResourceKeys.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ConfigurationResourceKeys.java
index 8f0ced955c..00903ab782 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ConfigurationResourceKeys.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ConfigurationResourceKeys.java
@@ -31,6 +31,7 @@ public class ConfigurationResourceKeys implements Serializable{
private String vfModuleCustomizationUUID;
private String vnfResourceCustomizationUUID;
private String cvnfcCustomizationUUID;
+ private String vnfcName;
public String getVfModuleCustomizationUUID() {
return vfModuleCustomizationUUID;
@@ -50,6 +51,12 @@ public class ConfigurationResourceKeys implements Serializable{
public void setCvnfcCustomizationUUID(String cvnfcCustomizationUUID) {
this.cvnfcCustomizationUUID = cvnfcCustomizationUUID;
}
+ public String getVnfcName() {
+ return vnfcName;
+ }
+ public void setVnfcName(String vnfcName) {
+ this.vnfcName = vnfcName;
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
index c80cd3d2a0..76b24caf09 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
@@ -51,6 +51,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Tenant;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Vnfc;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
import org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
@@ -65,6 +66,7 @@ import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.Relationships;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResource;
@@ -333,10 +335,11 @@ public class BBInputSetup implements JavaDelegate {
relatedInstanceList, instanceName, vnfType, null);
} else if (modelType.equals(ModelType.vfModule)) {
if(bbName.contains("Configuration")) {
+ String configurationId = lookupKeyMap.get(ResourceKey.CONFIGURATION_ID);
ModelInfo configurationModelInfo = new ModelInfo();
configurationModelInfo.setModelCustomizationUuid(configurationKey);
populateConfiguration(configurationModelInfo, service, bbName, serviceInstance,
- lookupKeyMap, resourceId, instanceName, configurationResourceKeys);
+ lookupKeyMap, configurationId, instanceName, configurationResourceKeys);
} else {
lookupKeyMap.put(ResourceKey.VF_MODULE_ID, resourceId);
this.populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
@@ -381,10 +384,23 @@ public class BBInputSetup implements JavaDelegate {
serviceInstance.getConfigurations().add(configuration);
}
if(configuration != null) {
+ Vnfc vnfc = getVnfcToConfiguration(configurationResourceKeys.getVnfcName());
+ configuration.setVnfc(vnfc);
this.mapCatalogConfiguration(configuration, modelInfo, service, configurationResourceKeys);
}
}
+ protected Vnfc getVnfcToConfiguration(String vnfcName) {
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, vnfcName);
+ Optional<org.onap.aai.domain.yang.Vnfc> vnfcOp = bbInputSetupUtils.getAAIResourceDepthOne(uri).asBean(org.onap.aai.domain.yang.Vnfc.class);
+ if(vnfcOp.isPresent()) {
+ org.onap.aai.domain.yang.Vnfc vnfcAAI = vnfcOp.get();
+ return this.mapperLayer.mapAAIVnfc(vnfcAAI);
+ } else {
+ return null;
+ }
+ }
+
protected Configuration createConfiguration(Map<ResourceKey, String> lookupKeyMap,
String instanceName, String resourceId) {
lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, resourceId);
@@ -405,8 +421,8 @@ public class BBInputSetup implements JavaDelegate {
, vnfVfmoduleCvnfcConfigurationCustomization));
} else {
logger.debug("for Fabric configuration mapping by VF MODULE CUST UUID: " + configurationResourceKeys.getVfModuleCustomizationUUID());
- vnfVfmoduleCvnfcConfigurationCustomization = findVnfVfmoduleCvnfcConfigurationCustomization(configurationResourceKeys.getVfModuleCustomizationUUID(),
- configurationResourceKeys.getVnfResourceCustomizationUUID(), configurationResourceKeys.getCvnfcCustomizationUUID());
+ vnfVfmoduleCvnfcConfigurationCustomization = findVnfVfmoduleCvnfcConfigurationCustomization(configurationResourceKeys.getVnfResourceCustomizationUUID(),
+ configurationResourceKeys.getVfModuleCustomizationUUID(), configurationResourceKeys.getCvnfcCustomizationUUID());
if (vnfVfmoduleCvnfcConfigurationCustomization != null){
configuration.setModelInfoConfiguration(this.mapperLayer.mapCatalogConfigurationToConfiguration(vnfVfmoduleCvnfcConfigurationCustomization));
}
@@ -438,7 +454,7 @@ public class BBInputSetup implements JavaDelegate {
protected VnfVfmoduleCvnfcConfigurationCustomization findVnfVfmoduleCvnfcConfigurationCustomization(String vnfResourceCustomizationUUID,
String vfModuleCustomizationUUID, String cvnfcCustomizationUUID) {
- return bbInputSetupUtils.getVnfVfmoduleCvnfcConfigurationCustomizationByActionAndIsALaCarteAndRequestScopeAndCloudOwner(vnfResourceCustomizationUUID,
+ return bbInputSetupUtils.getVnfVfmoduleCvnfcConfigurationCustomizationByVnfCustomizationIdnAndVfModuleCustomizationIdAndCvnfcCustomizationId(vnfResourceCustomizationUUID,
vfModuleCustomizationUUID, cvnfcCustomizationUUID);
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java
index fac2e9b8c3..0a334cde6f 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java
@@ -55,6 +55,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Tenant;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Vnfc;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.generalobjects.License;
@@ -511,4 +512,8 @@ public class BBInputSetupMapperLayer {
CollectionNetworkResourceCustomization collectionNetworkResourceCust) {
return modelMapper.map(collectionNetworkResourceCust, NetworkResourceCustomization.class);
}
+
+ public Vnfc mapAAIVnfc(org.onap.aai.domain.yang.Vnfc vnfcAAI) {
+ return modelMapper.map(vnfcAAI, Vnfc.class);
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java
index a71c38f127..36a6bf37d9 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java
@@ -451,4 +451,9 @@ public class BBInputSetupUtils {
return Optional.of(volumeGroup);
}
}
+
+ public VnfVfmoduleCvnfcConfigurationCustomization getVnfVfmoduleCvnfcConfigurationCustomizationByVnfCustomizationIdnAndVfModuleCustomizationIdAndCvnfcCustomizationId(
+ String vnfResourceCustomizationUUID, String vfModuleCustomizationUUID, String cvnfcCustomizationUUID) {
+ return catalogDbClient.getVnfVfmoduleCvnfcConfigurationCustomizationByVnfCustomizationUuidAndVfModuleCustomizationUuidAndCvnfcCustomizationUuid(vnfResourceCustomizationUUID, vfModuleCustomizationUUID, cvnfcCustomizationUUID);
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
index 4b10d513d6..df9f2259a1 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
@@ -47,7 +47,6 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentMatchers;
-import org.mockito.ArgumentMatchers;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.Spy;
@@ -67,6 +66,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Vnfc;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys;
@@ -85,10 +85,8 @@ import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule;
import org.onap.so.client.aai.AAICommonObjectMapperProvider;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.entities.AAIResultWrapper;
-import org.onap.so.client.aai.entities.Relationships;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
-import org.onap.so.constants.Defaults;
import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResource;
import org.onap.so.db.catalog.beans.CollectionResourceCustomization;
@@ -1194,6 +1192,7 @@ public class BBInputSetupTest {
configuration.setConfigurationName("configurationName");
serviceInstance.getConfigurations().add(configuration);
String resourceId = "configurationId";
+ String vnfcName = "vnfcName";
// Mock service
Service service = mapper.readValue(
new File(RESOURCE_PATH + "CatalogDBService_getServiceInstanceNOAAIInput.json"), Service.class);
@@ -1207,9 +1206,12 @@ public class BBInputSetupTest {
configResourceKeys.setCvnfcCustomizationUUID("cvnfcCustomizationUUID");
configResourceKeys.setVfModuleCustomizationUUID("vfModuleCustomizationUUID");
configResourceKeys.setVnfResourceCustomizationUUID("vnfResourceCustomizationUUID");
+ configResourceKeys.setVnfcName(vnfcName);
+ Vnfc vnfc = new Vnfc();
+ vnfc.setVnfcName(vnfcName);
doNothing().when(SPY_bbInputSetup).mapCatalogConfiguration(configuration, modelInfo, service, configResourceKeys);
-
+ doReturn(vnfc).when(SPY_bbInputSetup).getVnfcToConfiguration(vnfcName);
SPY_bbInputSetup.populateConfiguration(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
instanceName, configResourceKeys);
verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration, modelInfo, service, configResourceKeys);
@@ -1264,6 +1266,7 @@ public class BBInputSetupTest {
configuration.setConfigurationName("configurationName");
serviceInstance.getConfigurations().add(configuration);
String resourceId = "configurationId";
+ String vnfcName = "vnfcName";
// Mock service
Service service = mapper.readValue(
new File(RESOURCE_PATH + "CatalogDBService_getServiceInstanceNOAAIInput.json"), Service.class);
@@ -1274,6 +1277,9 @@ public class BBInputSetupTest {
configResourceKeys.setCvnfcCustomizationUUID("cvnfcCustomizationUUID");
configResourceKeys.setVfModuleCustomizationUUID("vfModuleCustomizationUUID");
configResourceKeys.setVnfResourceCustomizationUUID("vnfResourceCustomizationUUID");
+ configResourceKeys.setVnfcName(vnfcName);
+ Vnfc vnfc = new Vnfc();
+ vnfc.setVnfcName(vnfcName);
VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization = new VnfVfmoduleCvnfcConfigurationCustomization();
ConfigurationResource configurationResource = new ConfigurationResource();
@@ -1282,7 +1288,7 @@ public class BBInputSetupTest {
vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationResource(configurationResource);
doReturn(null).when(SPY_bbInputSetup).findConfigurationResourceCustomization(modelInfo, service);
- doReturn(vnfVfmoduleCvnfcConfigurationCustomization).when(SPY_bbInputSetup).findVnfVfmoduleCvnfcConfigurationCustomization("vfModuleCustomizationUUID","vnfResourceCustomizationUUID","cvnfcCustomizationUUID");
+ doReturn(vnfc).when(SPY_bbInputSetup).getVnfcToConfiguration(vnfcName);
SPY_bbInputSetup.populateConfiguration(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
instanceName, configResourceKeys);
@@ -2707,4 +2713,4 @@ public class BBInputSetupTest {
assertEquals("Lookup Key Map populated with VolumeGroup Id", volumeGroupId, lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID));
}
-} \ No newline at end of file
+}
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn
index 81d3226037..2437476b59 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn
@@ -24,24 +24,23 @@
<camunda:in source="suppressRollback" target="suppressRollback" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_0mew9im</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_07h9d4y</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_1hsqed1</bpmn:outgoing>
</bpmn:callActivity>
<bpmn:sequenceFlow id="SequenceFlow_0mqrkxv" sourceRef="Task_SelectBB" targetRef="ServiceTask_0e2p0xs" />
<bpmn:serviceTask id="Task_SelectBB" name="Select BB" camunda:expression="${WorkflowActionBBTasks.selectBB(execution)}">
<bpmn:incoming>SequenceFlow_1atzsgn</bpmn:incoming>
- <bpmn:incoming>SequenceFlow_005hi8o</bpmn:incoming>
<bpmn:incoming>SequenceFlow_1tfizxf</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_1pnkpim</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0mqrkxv</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:exclusiveGateway id="ExclusiveGateway_Finished" default="SequenceFlow_01j184u">
- <bpmn:incoming>SequenceFlow_07h9d4y</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_1fftixk</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1m2eezj</bpmn:outgoing>
<bpmn:outgoing>SequenceFlow_0v588sm</bpmn:outgoing>
<bpmn:outgoing>SequenceFlow_11530ei</bpmn:outgoing>
<bpmn:outgoing>SequenceFlow_01j184u</bpmn:outgoing>
<bpmn:outgoing>SequenceFlow_0l7kaba</bpmn:outgoing>
</bpmn:exclusiveGateway>
- <bpmn:sequenceFlow id="SequenceFlow_07h9d4y" sourceRef="Call_ExecuteBB" targetRef="ExclusiveGateway_Finished" />
<bpmn:sequenceFlow id="SequenceFlow_1m2eezj" name="Completed = true" sourceRef="ExclusiveGateway_Finished" targetRef="ExclusiveGateway_isTopLevelFlowC">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("completed")==true&&execution.getVariable("isRollback")==false&&execution.getVariable("handlingCode")=="Success"}]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
@@ -114,10 +113,9 @@
<bpmn:sequenceFlow id="SequenceFlow_1p8yxu6" sourceRef="Task_AbortAndCallErrorHandling" targetRef="EndEvent_0lzz1ya" />
<bpmn:sequenceFlow id="SequenceFlow_1wb59ic" sourceRef="Task_SendSync" targetRef="Task_PreValidateWorkflow" />
<bpmn:sequenceFlow id="SequenceFlow_01j184u" sourceRef="ExclusiveGateway_Finished" targetRef="Task_0a31dkf" />
- <bpmn:sequenceFlow id="SequenceFlow_005hi8o" sourceRef="Task_0a31dkf" targetRef="Task_SelectBB" />
<bpmn:serviceTask id="Task_0a31dkf" name="Check Retry Status" camunda:expression="${WorkflowActionBBTasks.checkRetryStatus(execution)}">
<bpmn:incoming>SequenceFlow_01j184u</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_005hi8o</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_1pnkpim</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:exclusiveGateway id="ExclusiveGateway_isTopLevelFlow" name="Is Top-Level Flow?" default="SequenceFlow_0sckerv">
<bpmn:incoming>SequenceFlow_0vc9go9</bpmn:incoming>
@@ -187,6 +185,13 @@
<bpmn:incoming>SequenceFlow_1wb59ic</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1tfizxf</bpmn:outgoing>
</bpmn:serviceTask>
+ <bpmn:serviceTask id="ServiceTask_0lbkcyp" name="Post Processing Execute BB" camunda:expression="${WorkflowActionBBTasks.postProcessingExecuteBB(execution)}">
+ <bpmn:incoming>SequenceFlow_1hsqed1</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1fftixk</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1hsqed1" sourceRef="Call_ExecuteBB" targetRef="ServiceTask_0lbkcyp" />
+ <bpmn:sequenceFlow id="SequenceFlow_1fftixk" sourceRef="ServiceTask_0lbkcyp" targetRef="ExclusiveGateway_Finished" />
+ <bpmn:sequenceFlow id="SequenceFlow_1pnkpim" sourceRef="Task_0a31dkf" targetRef="Task_SelectBB" />
</bpmn:process>
<bpmn:error id="Error_0kd2o2a" name="java.lang.Exception" errorCode="java.lang.Exception" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
@@ -198,9 +203,9 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_1uv6erv_di" bpmnElement="End_WorkflowActionBB">
- <dc:Bounds x="1085" y="147" width="36" height="36" />
+ <dc:Bounds x="1304" y="147" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1094" y="127" width="18" height="12" />
+ <dc:Bounds x="1313" y="127" width="18" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_15s0okp_di" bpmnElement="SequenceFlow_15s0okp">
@@ -224,24 +229,17 @@
<dc:Bounds x="239" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ExclusiveGateway_0m1zt0q_di" bpmnElement="ExclusiveGateway_Finished" isMarkerVisible="true">
- <dc:Bounds x="692" y="95" width="50" height="50" />
+ <dc:Bounds x="911" y="95" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="676" y="42" width="0" height="0" />
+ <dc:Bounds x="850" y="42" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_07h9d4y_di" bpmnElement="SequenceFlow_07h9d4y">
- <di:waypoint xsi:type="dc:Point" x="660" y="120" />
- <di:waypoint xsi:type="dc:Point" x="692" y="120" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="676" y="99" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1m2eezj_di" bpmnElement="SequenceFlow_1m2eezj">
- <di:waypoint xsi:type="dc:Point" x="730" y="132" />
- <di:waypoint xsi:type="dc:Point" x="761" y="165" />
- <di:waypoint xsi:type="dc:Point" x="841" y="165" />
+ <di:waypoint xsi:type="dc:Point" x="949" y="132" />
+ <di:waypoint xsi:type="dc:Point" x="980" y="165" />
+ <di:waypoint xsi:type="dc:Point" x="1060" y="165" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="749" y="168" width="83" height="12" />
+ <dc:Bounds x="968" y="168" width="83" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_0kn8jt8_di" bpmnElement="Task_RetrieveBBExectuionList">
@@ -251,14 +249,14 @@
<dc:Bounds x="-132" y="-6" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_0wzh11j_di" bpmnElement="Task_UpdateRequestComplete">
- <dc:Bounds x="942" y="206" width="100" height="80" />
+ <dc:Bounds x="1161" y="206" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1pz6edz_di" bpmnElement="SequenceFlow_1pz6edz">
- <di:waypoint xsi:type="dc:Point" x="1042" y="246" />
- <di:waypoint xsi:type="dc:Point" x="1103" y="246" />
- <di:waypoint xsi:type="dc:Point" x="1103" y="183" />
+ <di:waypoint xsi:type="dc:Point" x="1261" y="246" />
+ <di:waypoint xsi:type="dc:Point" x="1322" y="246" />
+ <di:waypoint xsi:type="dc:Point" x="1322" y="183" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1027.5" y="231" width="90" height="0" />
+ <dc:Bounds x="1247" y="231" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="SubProcess_18226x4_di" bpmnElement="SubProcess_18226x4" isExpanded="true">
@@ -277,11 +275,11 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0v588sm_di" bpmnElement="SequenceFlow_0v588sm">
- <di:waypoint xsi:type="dc:Point" x="717" y="145" />
- <di:waypoint xsi:type="dc:Point" x="717" y="262" />
+ <di:waypoint xsi:type="dc:Point" x="936" y="145" />
+ <di:waypoint xsi:type="dc:Point" x="936" y="262" />
<di:waypoint xsi:type="dc:Point" x="339" y="262" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="597.5" y="272" width="73" height="12" />
+ <dc:Bounds x="769.202380952381" y="272" width="73" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1atzsgn_di" bpmnElement="SequenceFlow_1atzsgn">
@@ -302,29 +300,29 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_11530ei_di" bpmnElement="SequenceFlow_11530ei">
- <di:waypoint xsi:type="dc:Point" x="727" y="105" />
- <di:waypoint xsi:type="dc:Point" x="764" y="44" />
- <di:waypoint xsi:type="dc:Point" x="841" y="45" />
+ <di:waypoint xsi:type="dc:Point" x="946" y="105" />
+ <di:waypoint xsi:type="dc:Point" x="983" y="44" />
+ <di:waypoint xsi:type="dc:Point" x="1060" y="45" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="756" y="17.269982652857244" width="57" height="12" />
+ <dc:Bounds x="975" y="17" width="58" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_0jo36ez_di" bpmnElement="Task_AbortAndCallErrorHandling">
- <dc:Bounds x="957" y="-76" width="100" height="80" />
+ <dc:Bounds x="1176" y="-76" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_0lzz1ya_di" bpmnElement="EndEvent_0lzz1ya">
- <dc:Bounds x="1167" y="27" width="36" height="36" />
+ <dc:Bounds x="1386" y="27" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1176" y="67" width="18" height="12" />
+ <dc:Bounds x="1395" y="67" width="18" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1p8yxu6_di" bpmnElement="SequenceFlow_1p8yxu6">
- <di:waypoint xsi:type="dc:Point" x="1057" y="-36" />
- <di:waypoint xsi:type="dc:Point" x="1140" y="-36" />
- <di:waypoint xsi:type="dc:Point" x="1140" y="45" />
- <di:waypoint xsi:type="dc:Point" x="1167" y="45" />
+ <di:waypoint xsi:type="dc:Point" x="1276" y="-36" />
+ <di:waypoint xsi:type="dc:Point" x="1359" y="-36" />
+ <di:waypoint xsi:type="dc:Point" x="1359" y="45" />
+ <di:waypoint xsi:type="dc:Point" x="1386" y="45" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1155" y="4.5" width="0" height="0" />
+ <dc:Bounds x="1329" y="5" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1wb59ic_di" bpmnElement="SequenceFlow_1wb59ic">
@@ -337,24 +335,16 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_01j184u_di" bpmnElement="SequenceFlow_01j184u">
- <di:waypoint xsi:type="dc:Point" x="717" y="95" />
- <di:waypoint xsi:type="dc:Point" x="717" y="55" />
- <di:waypoint xsi:type="dc:Point" x="717" y="55" />
- <di:waypoint xsi:type="dc:Point" x="717" y="4" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="732" y="49" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_005hi8o_di" bpmnElement="SequenceFlow_005hi8o">
- <di:waypoint xsi:type="dc:Point" x="667" y="-36" />
- <di:waypoint xsi:type="dc:Point" x="289" y="-36" />
- <di:waypoint xsi:type="dc:Point" x="289" y="80" />
+ <di:waypoint xsi:type="dc:Point" x="936" y="95" />
+ <di:waypoint xsi:type="dc:Point" x="936" y="55" />
+ <di:waypoint xsi:type="dc:Point" x="936" y="55" />
+ <di:waypoint xsi:type="dc:Point" x="936" y="4" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="433" y="-51" width="90" height="0" />
+ <dc:Bounds x="906" y="49" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_1c1v3p1_di" bpmnElement="Task_0a31dkf">
- <dc:Bounds x="667" y="-76" width="100" height="80" />
+ <dc:Bounds x="886" y="-76" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ExclusiveGateway_0ptb1yi_di" bpmnElement="ExclusiveGateway_isTopLevelFlow" isMarkerVisible="true">
<dc:Bounds x="-228" y="95" width="50" height="50" />
@@ -378,68 +368,68 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ExclusiveGateway_001g41v_di" bpmnElement="ExclusiveGateway_isTopLevelFlowAbort" isMarkerVisible="true">
- <dc:Bounds x="841" y="20" width="50" height="50" />
+ <dc:Bounds x="1060" y="20" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="836" y="70" width="60" height="24" />
+ <dc:Bounds x="1055" y="70" width="61" height="24" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_02ksbt0_di" bpmnElement="SequenceFlow_02ksbt0">
- <di:waypoint xsi:type="dc:Point" x="866" y="20" />
- <di:waypoint xsi:type="dc:Point" x="866" y="-37" />
- <di:waypoint xsi:type="dc:Point" x="957" y="-37" />
+ <di:waypoint xsi:type="dc:Point" x="1085" y="20" />
+ <di:waypoint xsi:type="dc:Point" x="1085" y="-37" />
+ <di:waypoint xsi:type="dc:Point" x="1176" y="-37" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="872" y="-8.5" width="18" height="12" />
+ <dc:Bounds x="1091" y="-8" width="19" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1r570x3_di" bpmnElement="SequenceFlow_1r570x3">
- <di:waypoint xsi:type="dc:Point" x="891" y="45" />
- <di:waypoint xsi:type="dc:Point" x="1167" y="45" />
+ <di:waypoint xsi:type="dc:Point" x="1110" y="45" />
+ <di:waypoint xsi:type="dc:Point" x="1386" y="45" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1023" y="20" width="12" height="12" />
+ <dc:Bounds x="1242" y="20" width="12" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ExclusiveGateway_1er1kam_di" bpmnElement="ExclusiveGateway_isTopLevelFlowC" isMarkerVisible="true">
- <dc:Bounds x="841" y="140" width="50" height="50" />
+ <dc:Bounds x="1060" y="140" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="836" y="108" width="60" height="24" />
+ <dc:Bounds x="1055" y="108" width="61" height="24" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0x4urgp_di" bpmnElement="SequenceFlow_0x4urgp">
- <di:waypoint xsi:type="dc:Point" x="891" y="165" />
- <di:waypoint xsi:type="dc:Point" x="1001" y="165" />
- <di:waypoint xsi:type="dc:Point" x="1001" y="165" />
- <di:waypoint xsi:type="dc:Point" x="1085" y="165" />
+ <di:waypoint xsi:type="dc:Point" x="1110" y="165" />
+ <di:waypoint xsi:type="dc:Point" x="1220" y="165" />
+ <di:waypoint xsi:type="dc:Point" x="1220" y="165" />
+ <di:waypoint xsi:type="dc:Point" x="1304" y="165" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1037.2153846153847" y="140" width="12" height="12" />
+ <dc:Bounds x="1256" y="140" width="12" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="EndEvent_1q8eh5e_di" bpmnElement="End_RollbackFailed">
- <dc:Bounds x="940" y="347" width="36" height="36" />
+ <dc:Bounds x="1159" y="347" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="958" y="399" width="18" height="12" />
+ <dc:Bounds x="1177" y="399" width="18" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_11dlyzt_di" bpmnElement="SequenceFlow_11dlyzt">
<di:waypoint xsi:type="dc:Point" x="289" y="302" />
<di:waypoint xsi:type="dc:Point" x="289" y="368" />
- <di:waypoint xsi:type="dc:Point" x="741" y="368" />
+ <di:waypoint xsi:type="dc:Point" x="960" y="368" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="340.85361216730035" y="325" width="63" height="24" />
+ <dc:Bounds x="381.45685840707966" y="325" width="63" height="24" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_1h154rn_di" bpmnElement="Task_UpdateDb">
<dc:Bounds x="713" y="617" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_1t8n9gd_di" bpmnElement="Task_UpdateRequestToFailed">
- <dc:Bounds x="741" y="325" width="100" height="80" />
+ <dc:Bounds x="960" y="325" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0l7kaba_di" bpmnElement="SequenceFlow_0l7kaba">
- <di:waypoint xsi:type="dc:Point" x="723" y="139" />
- <di:waypoint xsi:type="dc:Point" x="757" y="252" />
- <di:waypoint xsi:type="dc:Point" x="797" y="252" />
- <di:waypoint xsi:type="dc:Point" x="797" y="325" />
+ <di:waypoint xsi:type="dc:Point" x="942" y="139" />
+ <di:waypoint xsi:type="dc:Point" x="976" y="252" />
+ <di:waypoint xsi:type="dc:Point" x="1016" y="252" />
+ <di:waypoint xsi:type="dc:Point" x="1016" y="325" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="739.7268586738111" y="255.4388401674105" width="52" height="24" />
+ <dc:Bounds x="959" y="255" width="52" height="24" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1edjl5x_di" bpmnElement="SequenceFlow_1edjl5x">
@@ -457,12 +447,12 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1ui67mc_di" bpmnElement="SequenceFlow_1ui67mc">
- <di:waypoint xsi:type="dc:Point" x="841" y="365" />
- <di:waypoint xsi:type="dc:Point" x="915" y="365" />
- <di:waypoint xsi:type="dc:Point" x="915" y="365" />
- <di:waypoint xsi:type="dc:Point" x="940" y="365" />
+ <di:waypoint xsi:type="dc:Point" x="1060" y="365" />
+ <di:waypoint xsi:type="dc:Point" x="1134" y="365" />
+ <di:waypoint xsi:type="dc:Point" x="1134" y="365" />
+ <di:waypoint xsi:type="dc:Point" x="1159" y="365" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="885" y="359" width="90" height="13" />
+ <dc:Bounds x="1104" y="359" width="90" height="13" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ExclusiveGateway_10q79b6_di" bpmnElement="ExclusiveGateway_10q79b6" isMarkerVisible="true">
@@ -541,11 +531,11 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0kf5sen_di" bpmnElement="SequenceFlow_0kf5sen">
- <di:waypoint xsi:type="dc:Point" x="866" y="190" />
- <di:waypoint xsi:type="dc:Point" x="866" y="246" />
- <di:waypoint xsi:type="dc:Point" x="942" y="246" />
+ <di:waypoint xsi:type="dc:Point" x="1085" y="190" />
+ <di:waypoint xsi:type="dc:Point" x="1085" y="246" />
+ <di:waypoint xsi:type="dc:Point" x="1161" y="246" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="872" y="217.6" width="18" height="12" />
+ <dc:Bounds x="1091" y="218" width="19" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1tfizxf_di" bpmnElement="SequenceFlow_1tfizxf">
@@ -560,6 +550,31 @@
<bpmndi:BPMNShape id="ServiceTask_0m5xr0e_di" bpmnElement="Task_PreValidateWorkflow">
<dc:Bounds x="80" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_0lbkcyp_di" bpmnElement="ServiceTask_0lbkcyp">
+ <dc:Bounds x="735" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1hsqed1_di" bpmnElement="SequenceFlow_1hsqed1">
+ <di:waypoint xsi:type="dc:Point" x="660" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="735" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="697.5" y="99" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1fftixk_di" bpmnElement="SequenceFlow_1fftixk">
+ <di:waypoint xsi:type="dc:Point" x="835" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="911" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="873" y="99" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1pnkpim_di" bpmnElement="SequenceFlow_1pnkpim">
+ <di:waypoint xsi:type="dc:Point" x="886" y="-36" />
+ <di:waypoint xsi:type="dc:Point" x="289" y="-36" />
+ <di:waypoint xsi:type="dc:Point" x="289" y="80" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="587.5" y="-57" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
index d87b11a1a6..aeffb0ecab 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
@@ -41,6 +41,7 @@ import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.L3Network;
import org.onap.aai.domain.yang.Relationship;
import org.onap.aai.domain.yang.ServiceInstance;
+import org.onap.aai.domain.yang.Vnfc;
import org.onap.aai.domain.yang.VolumeGroup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
@@ -51,8 +52,11 @@ import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup;
import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
import org.onap.so.client.aai.AAICommonObjectMapperProvider;
+import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.Relationships;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.orchestration.AAIConfigurationResources;
import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
@@ -199,7 +203,6 @@ public class WorkflowAction {
if (orchFlows == null || orchFlows.isEmpty()) {
orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte, cloudOwner, serviceType);
}
- orchFlows = filterOrchFlows(sIRequest, orchFlows, resourceType, execution);
String key = "";
ModelInfo modelInfo = sIRequest.getRequestDetails().getModelInfo();
if(modelInfo != null) {
@@ -211,16 +214,17 @@ public class WorkflowAction {
}
boolean isConfiguration = isConfiguration(orchFlows);
Resource resourceKey = new Resource(resourceType, key, aLaCarte);
- List<ExecuteBuildingBlock> configBuildingBlocks = getConfigBuildingBlocks(sIRequest, orchFlows, requestId, resourceKey, apiVersion, resourceId, requestAction, aLaCarte, vnfType,
- workflowResourceIds, requestDetails, isConfiguration);
+ if(isConfiguration && !requestAction.equalsIgnoreCase(CREATEINSTANCE)) {
+ List<ExecuteBuildingBlock> configBuildingBlocks = getConfigBuildingBlocks(sIRequest, orchFlows, requestId, resourceKey, apiVersion, resourceId, requestAction, aLaCarte, vnfType,
+ workflowResourceIds, requestDetails, execution);
+ flowsToExecute.addAll(configBuildingBlocks);
+ }
+ orchFlows = orchFlows.stream().filter(item -> !item.getFlowName().contains(FABRIC_CONFIGURATION)).collect(Collectors.toList());
for (OrchestrationFlow orchFlow : orchFlows) {
- if(!orchFlow.getFlowName().contains("Configuration")) {
- ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, resourceKey, apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, false);
- flowsToExecute.add(ebb);
- }
+ ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, resourceKey, apiVersion, resourceId,
+ requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, false);
+ flowsToExecute.add(ebb);
}
- flowsToExecute.addAll(configBuildingBlocks);
} else {
boolean foundRelated = false;
boolean containsService = false;
@@ -348,6 +352,26 @@ public class WorkflowAction {
}
}
+ protected <T> List<T> getRelatedResourcesInVfModule(String vnfId, String vfModuleId, Class<T> resultClass, AAIObjectType type) {
+ List<T> vnfcs = new ArrayList<>();
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId);
+ AAIResultWrapper vfModuleResultsWrapper = bbInputSetupUtils.getAAIResourceDepthOne(uri);
+ Optional<Relationships> relationshipsOp = vfModuleResultsWrapper.getRelationships();
+ if (!relationshipsOp.isPresent()) {
+ logger.debug("No relationships were found for vfModule in AAI");
+ } else {
+ Relationships relationships = relationshipsOp.get();
+ List<AAIResultWrapper> vnfcResultWrappers = relationships.getByType(type);
+ for(AAIResultWrapper vnfcResultWrapper : vnfcResultWrappers) {
+ Optional<T> vnfcOp = vnfcResultWrapper.asBean(resultClass);
+ if(vnfcOp.isPresent()) {
+ vnfcs.add(vnfcOp.get());
+ }
+ }
+ }
+ return vnfcs;
+ }
+
protected boolean isConfiguration(List<OrchestrationFlow> orchFlows) {
for(OrchestrationFlow flow : orchFlows) {
if(flow.getFlowName().contains("Configuration")) {
@@ -359,41 +383,56 @@ public class WorkflowAction {
protected List<ExecuteBuildingBlock> getConfigBuildingBlocks(ServiceInstancesRequest sIRequest, List<OrchestrationFlow> orchFlows, String requestId, Resource resourceKey,
String apiVersion, String resourceId, String requestAction, boolean aLaCarte, String vnfType,
- WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails, boolean isConfiguration) {
+ WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails, DelegateExecution execution) {
+ List<ExecuteBuildingBlock> flowsToExecuteConfigs = new ArrayList<>();
List<OrchestrationFlow> result = new ArrayList<>(orchFlows);
result = orchFlows.stream().filter(item -> item.getFlowName().contains(FABRIC_CONFIGURATION)).collect(Collectors.toList());
- String vnfCustomizationUUID = "";
- String vfModuleCustomizationUUID = sIRequest.getRequestDetails().getModelInfo().getModelCustomizationUuid();
- RelatedInstanceList[] relatedInstanceList = sIRequest.getRequestDetails().getRelatedInstanceList();
- if (relatedInstanceList != null) {
- for (RelatedInstanceList relatedInstList : relatedInstanceList) {
- RelatedInstance relatedInstance = relatedInstList.getRelatedInstance();
- if (relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf)) {
- vnfCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationUuid();
- }
- }
- }
+ String vnfId = workflowResourceIds.getVnfId();
+ String vfModuleId = workflowResourceIds.getVfModuleId();
- List<VnfVfmoduleCvnfcConfigurationCustomization> fabricCustomizations = traverseCatalogDbForConfiguration(vnfCustomizationUUID, vfModuleCustomizationUUID);
- List<ExecuteBuildingBlock> flowsToExecuteConfigs = new ArrayList<>();
- for(VnfVfmoduleCvnfcConfigurationCustomization fabricConfig : fabricCustomizations) {
-
- if (requestAction.equals(CREATEINSTANCE)) {
- workflowResourceIds.setConfigurationId(UUID.randomUUID().toString());
- } else {
- //TODO AAI lookup for configuration update/delete
- }
+ String vnfCustomizationUUID = bbInputSetupUtils.getAAIGenericVnf(vnfId).getModelCustomizationId();
+ String vfModuleCustomizationUUID = bbInputSetupUtils.getAAIVfModule(vnfId, vfModuleId).getModelCustomizationId();
+ List<org.onap.aai.domain.yang.Configuration> configurations = getRelatedResourcesInVfModule(vnfId, vfModuleId, org.onap.aai.domain.yang.Configuration.class, AAIObjectType.CONFIGURATION);
+
+ for(org.onap.aai.domain.yang.Configuration configuration : configurations) {
+ workflowResourceIds.setConfigurationId(configuration.getConfigurationId());
for(OrchestrationFlow orchFlow : result) {
resourceKey.setVfModuleCustomizationId(vfModuleCustomizationUUID);
- resourceKey.setCvnfModuleCustomizationId(fabricConfig.getCvnfcCustomization().getModelCustomizationUUID());
+ resourceKey.setCvnfModuleCustomizationId(configuration.getModelCustomizationId());
resourceKey.setVnfCustomizationId(vnfCustomizationUUID);
ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, resourceKey, apiVersion, resourceId,
requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, true);
+ String vnfcName = getVnfcNameForConfiguration(configuration);
+ if(vnfcName == null || vnfcName.isEmpty()) {
+ buildAndThrowException(execution, "Exception in create execution list " + ": VnfcName does not exist or is null while there is a configuration for the vfModule", new Exception("Vnfc and Configuration do not match"));
+ }
+ ebb.getConfigurationResourceKeys().setVnfcName(vnfcName);
flowsToExecuteConfigs.add(ebb);
}
}
return flowsToExecuteConfigs;
}
+
+ protected String getVnfcNameForConfiguration(org.onap.aai.domain.yang.Configuration configuration) {
+ AAIResultWrapper wrapper = new AAIResultWrapper(configuration);
+ Optional<Relationships> relationshipsOp = wrapper.getRelationships();
+ if (!relationshipsOp.isPresent()) {
+ logger.debug("No relationships were found for Configuration in AAI");
+ return null;
+ } else {
+ Relationships relationships = relationshipsOp.get();
+ List<AAIResultWrapper> vnfcResultWrappers = relationships.getByType(AAIObjectType.VNFC);
+ if(vnfcResultWrappers.size() > 1 || vnfcResultWrappers.isEmpty()) {
+ logger.debug("Too many vnfcs or no vnfc found that are related to configuration");
+ }
+ Optional<Vnfc> vnfcOp = vnfcResultWrappers.get(0).asBean(Vnfc.class);
+ if(vnfcOp.isPresent()) {
+ return vnfcOp.get().getVnfcName();
+ } else {
+ return null;
+ }
+ }
+ }
protected List<Resource> sortVfModulesByBaseFirst(List<Resource> vfModuleResources) {
int count = 0;
@@ -1159,29 +1198,6 @@ public class WorkflowAction {
}
return listToExecute;
}
-
- protected List<OrchestrationFlow> filterOrchFlows(ServiceInstancesRequest sIRequest, List<OrchestrationFlow> orchFlows, WorkflowType resourceType, DelegateExecution execution) {
- List<OrchestrationFlow> result = new ArrayList<>(orchFlows);
- String vnfCustomizationUUID = "";
- String vfModuleCustomizationUUID = sIRequest.getRequestDetails().getModelInfo().getModelCustomizationUuid();
- RelatedInstanceList[] relatedInstanceList = sIRequest.getRequestDetails().getRelatedInstanceList();
- if (relatedInstanceList != null) {
- for (RelatedInstanceList relatedInstList : relatedInstanceList) {
- RelatedInstance relatedInstance = relatedInstList.getRelatedInstance();
- if (relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf)) {
- vnfCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationUuid();
- }
- }
- }
-
- if (resourceType.equals(WorkflowType.VFMODULE)) {
- List<VnfVfmoduleCvnfcConfigurationCustomization> fabricCustomizations = traverseCatalogDbForConfiguration(vnfCustomizationUUID, vfModuleCustomizationUUID);
- if (fabricCustomizations.isEmpty()) {
- result = orchFlows.stream().filter(item -> !item.getFlowName().contains(FABRIC_CONFIGURATION)).collect(Collectors.toList());
- }
- }
- return result;
- }
protected void buildAndThrowException(DelegateExecution execution, String msg, Exception ex) {
logger.error(msg, ex);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
index 33a89e0b82..877a0dded7 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
@@ -22,18 +22,28 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks;
import java.sql.Timestamp;
import java.util.ArrayList;
-import java.util.Date;
import java.util.List;
import java.util.Optional;
+import java.util.UUID;
-import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.onap.aai.domain.yang.Vnfc;
import org.onap.so.bpmn.common.workflow.context.WorkflowCallbackResponse;
import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder;
-import org.onap.so.bpmn.core.WorkflowException;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
+import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.entities.AAIResultWrapper;
+import org.onap.so.client.aai.entities.Relationships;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.db.catalog.beans.CvnfcCustomization;
+import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization;
+import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.serviceinstancebeans.RequestReferences;
@@ -55,6 +65,9 @@ public class WorkflowActionBBTasks {
private static final String G_ALACARTE = "aLaCarte";
private static final String G_ACTION = "requestAction";
private static final String RETRY_COUNT = "retryCount";
+ private static final String FABRIC_CONFIGURATION = "FabricConfiguration";
+ private static final String ASSIGN_FABRIC_CONFIGURATION_BB = "AssignFabricConfigurationBB";
+ private static final String ACTIVATE_FABRIC_CONFIGURATION_BB = "ActivateFabricConfigurationBB";
protected String maxRetries = "mso.rainyDay.maxRetries";
private static final Logger logger = LoggerFactory.getLogger(WorkflowActionBBTasks.class);
@@ -66,6 +79,10 @@ public class WorkflowActionBBTasks {
private WorkflowActionBBFailure workflowActionBBFailure;
@Autowired
private Environment environment;
+ @Autowired
+ private BBInputSetupUtils bbInputSetupUtils;
+ @Autowired
+ private CatalogDbClient catalogDbClient;
public void selectBB(DelegateExecution execution) {
List<ExecuteBuildingBlock> flowsToExecute = (List<ExecuteBuildingBlock>) execution
@@ -281,10 +298,12 @@ public class WorkflowActionBBTasks {
int flowSize = rollbackFlows.size();
String handlingCode = (String) execution.getVariable("handlingCode");
- if(handlingCode.equals("RollbackToAssigned")){
+ if(handlingCode.equals("RollbackToAssigned") || handlingCode.equals("RollbackToCreated")){
for(int i = 0; i<flowSize; i++){
if(rollbackFlows.get(i).getBuildingBlock().getBpmnFlowName().contains("Unassign")){
rollbackFlows.remove(i);
+ } else if(rollbackFlows.get(i).getBuildingBlock().getBpmnFlowName().contains("Delete") && handlingCode.equals("RollbackToCreated")) {
+ rollbackFlows.remove(i);
}
}
}
@@ -331,4 +350,90 @@ public class WorkflowActionBBTasks {
workflowAction.buildAndThrowException(execution, "Failed to update Request db with instanceId");
}
}
+
+ public void postProcessingExecuteBB(DelegateExecution execution) {
+ List<ExecuteBuildingBlock> flowsToExecute = (List<ExecuteBuildingBlock>) execution
+ .getVariable("flowsToExecute");
+ String handlingCode = (String) execution.getVariable("handlingCode");
+ final boolean aLaCarte = (boolean) execution.getVariable(G_ALACARTE);
+ int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
+ ExecuteBuildingBlock ebb = flowsToExecute.get(currentSequence - 1);
+ String bbFlowName = ebb.getBuildingBlock().getBpmnFlowName();
+ if(bbFlowName.equalsIgnoreCase("ActivateVfModuleBB") && aLaCarte && handlingCode.equalsIgnoreCase("Success")) {
+ postProcessingExecuteBBActivateVfModule(execution, ebb, flowsToExecute);
+ }
+ }
+
+ protected void postProcessingExecuteBBActivateVfModule(DelegateExecution execution,
+ ExecuteBuildingBlock ebb, List<ExecuteBuildingBlock> flowsToExecute) {
+ try {
+ String vnfId = ebb.getWorkflowResourceIds().getVnfId();
+ String vfModuleId = ebb.getWorkflowResourceIds().getVfModuleId();
+ String vnfCustomizationUUID = bbInputSetupUtils.getAAIGenericVnf(vnfId).getModelCustomizationId();
+ String vfModuleCustomizationUUID = bbInputSetupUtils.getAAIVfModule(vnfId, vfModuleId).getModelCustomizationId();
+ List<Vnfc> vnfcs = workflowAction.getRelatedResourcesInVfModule(vnfId, vfModuleId, Vnfc.class, AAIObjectType.VNFC);
+ for(Vnfc vnfc : vnfcs) {
+ String modelCustomizationId = vnfc.getModelCustomizationId();
+ List<CvnfcCustomization> cvnfcCustomizations = catalogDbClient.getCvnfcCustomizationByVnfCustomizationUUIDAndVfModuleCustomizationUUID(vnfCustomizationUUID, vfModuleCustomizationUUID);
+ CvnfcCustomization cvnfcCustomization = null;
+ for(CvnfcCustomization cvnfc : cvnfcCustomizations) {
+ if(cvnfc.getModelCustomizationUUID().equalsIgnoreCase(modelCustomizationId)) {
+ cvnfcCustomization = cvnfc;
+ }
+ }
+ if(cvnfcCustomization != null) {
+ VnfVfmoduleCvnfcConfigurationCustomization fabricConfig = null;
+ for(VnfVfmoduleCvnfcConfigurationCustomization customization : cvnfcCustomization.getVnfVfmoduleCvnfcConfigurationCustomization()){
+ if(customization.getConfigurationResource().getToscaNodeType().contains(FABRIC_CONFIGURATION)){
+ if(fabricConfig == null) {
+ fabricConfig = customization;
+ } else {
+ throw new Exception("Multiple Fabric configs found for this vnfc");
+ }
+ }
+ }
+ if(fabricConfig != null) {
+ String configurationId = UUID.randomUUID().toString();
+ ConfigurationResourceKeys configurationResourceKeys = new ConfigurationResourceKeys();
+ configurationResourceKeys.setCvnfcCustomizationUUID(modelCustomizationId);
+ configurationResourceKeys.setVfModuleCustomizationUUID(vfModuleCustomizationUUID);
+ configurationResourceKeys.setVnfResourceCustomizationUUID(vnfCustomizationUUID);
+ configurationResourceKeys.setVnfcName(vnfc.getVnfcName());
+ ExecuteBuildingBlock assignConfigBB = getExecuteBBForConfig(ASSIGN_FABRIC_CONFIGURATION_BB, ebb, configurationId, configurationResourceKeys);
+ ExecuteBuildingBlock activateConfigBB = getExecuteBBForConfig(ACTIVATE_FABRIC_CONFIGURATION_BB, ebb, configurationId, configurationResourceKeys);
+ flowsToExecute.add(assignConfigBB);
+ flowsToExecute.add(activateConfigBB);
+ execution.setVariable("flowsToExecute", flowsToExecute);
+ execution.setVariable("completed", false);
+ }
+ } else {
+ logger.debug("No cvnfcCustomization found for customizationId: " + modelCustomizationId);
+ }
+ }
+ } catch (Exception e) {
+ String errorMessage = "Error occurred in post processing of Vf Module create";
+ execution.setVariable("handlingCode", "RollbackToCreated");
+ execution.setVariable("WorkflowActionErrorMessage", errorMessage);
+ logger.error(errorMessage, e);
+ }
+ }
+
+ protected ExecuteBuildingBlock getExecuteBBForConfig(String bbName, ExecuteBuildingBlock ebb, String configurationId, ConfigurationResourceKeys configurationResourceKeys) {
+ ExecuteBuildingBlock configBB = new ExecuteBuildingBlock();
+ BuildingBlock buildingBlock = new BuildingBlock();
+ buildingBlock.setBpmnFlowName(bbName);
+ buildingBlock.setMsoId(UUID.randomUUID().toString());
+ configBB.setaLaCarte(ebb.isaLaCarte());
+ configBB.setApiVersion(ebb.getApiVersion());
+ configBB.setRequestAction(ebb.getRequestAction());
+ configBB.setVnfType(ebb.getVnfType());
+ configBB.setRequestId(ebb.getRequestId());
+ configBB.setRequestDetails(ebb.getRequestDetails());
+ configBB.setBuildingBlock(buildingBlock);
+ WorkflowResourceIds workflowResourceIds = ebb.getWorkflowResourceIds();
+ workflowResourceIds.setConfigurationId(configurationId);
+ configBB.setWorkflowResourceIds(workflowResourceIds);
+ configBB.setConfigurationResourceKeys(configurationResourceKeys);
+ return configBB;
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java
index 8195cd58c0..5c083779be 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java
@@ -83,54 +83,6 @@ public class WorkflowActionUnitTest {
private WorkflowAction workflowAction;
@Test
- public void filterOrchFlowsHasFabricTest() {
-
- List<OrchestrationFlow> flows = createFlowList(
- "DeactivateFabricConfigurationBB",
- "flow x",
- "flow y",
- "ActivateFabricConfigurationBB",
- "flow z");
- doReturn(Arrays.asList("yes", "yes")).when(workflowAction).traverseCatalogDbForConfiguration(ArgumentMatchers.any(String.class), ArgumentMatchers.isNull());
-
- ServiceInstancesRequest sIRequest = new ServiceInstancesRequest();
- RequestDetails requestDetails = new RequestDetails();
- ModelInfo modelInfo = new ModelInfo();
- requestDetails.setModelInfo(modelInfo);
- RelatedInstance relatedInstance = new RelatedInstance();
- sIRequest.setRequestDetails(requestDetails);
-
- List<OrchestrationFlow> result = workflowAction.filterOrchFlows(sIRequest, flows, WorkflowType.VFMODULE, mock(DelegateExecution.class));
-
- assertThat(result, is(flows));
- }
-
- @Test
- public void filterOrchFlowNoFabricTest() {
- List<OrchestrationFlow> flows = createFlowList(
- "DeactivateFabricConfigurationBB",
- "flow x",
- "flow y",
- "ActivateFabricConfigurationBB",
- "flow z");
-
- ServiceInstancesRequest sIRequest = new ServiceInstancesRequest();
- RequestDetails requestDetails = new RequestDetails();
- ModelInfo modelInfo = new ModelInfo();
- modelInfo.setModelCustomizationUuid("");
- requestDetails.setModelInfo(modelInfo);
- sIRequest.setRequestDetails(requestDetails);
-
- List<OrchestrationFlow> result = workflowAction.filterOrchFlows(sIRequest, flows, WorkflowType.VFMODULE, mock(DelegateExecution.class));
- List<OrchestrationFlow> expected = createFlowList(
- "flow x",
- "flow y",
- "flow z");
-
- assertThat(result, is(expected));
- }
-
- @Test
public void traverseCatalogDbForConfigurationTest() {
CvnfcCustomization cvnfcCustomization = new CvnfcCustomization();
@@ -150,33 +102,6 @@ public class WorkflowActionUnitTest {
}
- @Test
- public void verifyFilterOrchInvocation() throws Exception {
- DelegateExecution execution = mock(DelegateExecution.class);
-
- when(execution.getVariable(eq("aLaCarte"))).thenReturn(true);
- when(execution.getVariable(eq("bpmnRequest"))).thenReturn(getJson("ServiceMacroAssign.json"));
- when(execution.getVariable(eq("requestUri"))).thenReturn("/v6/serviceInstances/123/vnfs/1234");
-
- OrchestrationFlow flow = new OrchestrationFlow();
- flow.setFlowName("flow x");
-
- List<OrchestrationFlow> flows = Arrays.asList(flow);
- doReturn(Arrays.asList(flow)).when(workflowAction).queryNorthBoundRequestCatalogDb(any(), any(), any(), anyBoolean(), any(), any());
- workflowAction.selectExecutionList(execution);
-
- verify(workflowAction, times(1)).filterOrchFlows(any(), eq(flows), any(), any());
-
- flow = new OrchestrationFlow();
- flow.setFlowName("flow y");
- flows = Arrays.asList(flow);
- when(execution.getVariable(eq("aLaCarte"))).thenReturn(false);
- workflowAction.selectExecutionList(execution);
-
- verify(workflowAction, never()).filterOrchFlows(any(), eq(flows), any(), any());
-
- }
-
private String getJson(String filename) throws IOException {
return new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + filename)));
}