aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCommonBPMN/src/main/java/org/onap
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2019-03-05 16:56:09 -0500
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2019-03-06 10:29:49 -0500
commita339f93a736c9503888d05e47d79b173229042fc (patch)
tree4b8f1f89e2d20e4f251422f8538bbe5fdb920bbd /bpmn/MSOCommonBPMN/src/main/java/org/onap
parent91426ec9f221e288ea3f54fa62030e6f17420b90 (diff)
improvements to audit inventory feature
Adjust test data to add tenant mapping Remove unused unit test already renamed Update logic, to pass hostname not pservername remove unused file that has been refactored Add project to ignore, remove class Address issues in comments on pull request Remove logging that is not needed, used UPdate BPMN to use Boolean Value, change timings Adjust BPMN to not hit deadlock scenario put error message in execution before checking rollback - removed extra code for vnf resource processing found in onap environment. Fix improper use of inclusive gateway causing deadlock Fix flakey unit tests from ONAP Remove qualifier on bean, as it breaks callbacks Adjust pom version of external camunda client Fix polling timers to be more reasonable Updated Junit test for delete vf module in onap. Changed auditInventoryNeeded variable to a boolean to prevent bpmn from erroring out in the event this variable is not found on the execution. Update logic to support writing of self link Change-Id: I2f784a0a58a09f303775282c9be6019031668570 Issue-ID: SO-1597 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/main/java/org/onap')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Tenant.java58
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/GeneralBuildingBlock.java11
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java22
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java9
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java2
5 files changed, 100 insertions, 2 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Tenant.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Tenant.java
new file mode 100644
index 0000000000..a23f85bae9
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Tenant.java
@@ -0,0 +1,58 @@
+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;
+
+public class Tenant implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -8704478668505531590L;
+ @Id
+ @JsonProperty("tenant-id")
+ private String tenantId;
+ @JsonProperty("tenant-name")
+ private String tenantName;
+ @JsonProperty("tenant-context")
+ private String tenantContext;
+
+ @Override
+ public boolean equals(final Object other) {
+ if (!(other instanceof Tenant)) {
+ return false;
+ }
+ Tenant castOther = (Tenant) other;
+ return new EqualsBuilder().append(tenantId, castOther.tenantId).isEquals();
+ }
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(tenantId).toHashCode();
+ }
+ public String getTenantId() {
+ return tenantId;
+ }
+ public void setTenantId(String tenantId) {
+ this.tenantId = tenantId;
+ }
+ public String getTenantName() {
+ return tenantName;
+ }
+ public void setTenantName(String tenantName) {
+ this.tenantName = tenantName;
+ }
+ public String getTenantContext() {
+ return tenantContext;
+ }
+ public void setTenantContext(String tenantContext) {
+ this.tenantContext = tenantContext;
+ }
+
+
+} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/GeneralBuildingBlock.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/GeneralBuildingBlock.java
index adea99c4f3..6d3be0f822 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/GeneralBuildingBlock.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/GeneralBuildingBlock.java
@@ -26,6 +26,7 @@ import java.util.Map;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Tenant;
import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
@@ -39,10 +40,20 @@ public class GeneralBuildingBlock implements Serializable {
private OrchestrationContext orchContext;
private Map<String, String> userInput;
private CloudRegion cloudRegion;
+ private Tenant tenant;
private Customer customer;
private ServiceInstance serviceInstance;
+
+ public Tenant getTenant() {
+ return tenant;
+ }
+
+ public void setTenant(Tenant tenant) {
+ this.tenant = tenant;
+ }
+
public CloudRegion getCloudRegion() {
return cloudRegion;
}
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 fb3094665e..77372bcd88 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
@@ -49,6 +49,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Project;
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.Tenant;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
import org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys;
@@ -831,7 +832,7 @@ public class BBInputSetup implements JavaDelegate {
}
protected GeneralBuildingBlock populateGBBWithSIAndAdditionalInfo(RequestDetails requestDetails,
- ServiceInstance serviceInstance, ExecuteBuildingBlock executeBB, String requestAction, Customer customer) {
+ ServiceInstance serviceInstance, ExecuteBuildingBlock executeBB, String requestAction, Customer customer) throws Exception {
GeneralBuildingBlock outputBB = new GeneralBuildingBlock();
OrchestrationContext orchContext = mapperLayer.mapOrchestrationContext(requestDetails);
RequestContext requestContext = mapperLayer.mapRequestContext(requestDetails);
@@ -840,9 +841,11 @@ public class BBInputSetup implements JavaDelegate {
org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = bbInputSetupUtils
.getCloudRegion(requestDetails.getCloudConfiguration());
CloudRegion cloudRegion = mapperLayer.mapCloudRegion(requestDetails.getCloudConfiguration(), aaiCloudRegion);
+ Tenant tenant = getTenant(requestDetails.getCloudConfiguration(), aaiCloudRegion);
outputBB.setOrchContext(orchContext);
outputBB.setRequestContext(requestContext);
outputBB.setCloudRegion(cloudRegion);
+ outputBB.setTenant(tenant);
if(customer == null){
Map<String, String> uriKeys = bbInputSetupUtils.getURIKeysFromServiceInstance(serviceInstance.getServiceInstanceId());
String globalCustomerId = uriKeys.get("global-customer-id");
@@ -857,6 +860,23 @@ public class BBInputSetup implements JavaDelegate {
return outputBB;
}
+ protected Tenant getTenant(CloudConfiguration cloudConfiguration, org.onap.aai.domain.yang.CloudRegion aaiCloudRegion) throws Exception {
+ Tenant tenant = new Tenant();
+ if(cloudConfiguration != null && cloudConfiguration.getTenantId() != null
+ && aaiCloudRegion != null && aaiCloudRegion.getTenants() != null) {
+ for(org.onap.aai.domain.yang.Tenant aaiTenant : aaiCloudRegion.getTenants().getTenant()) {
+ if(aaiTenant.getTenantId().equalsIgnoreCase(cloudConfiguration.getTenantId())) {
+ tenant = mapperLayer.mapTenant(aaiTenant);
+ }
+ }
+ if(tenant.getTenantId() == null || tenant.getTenantName() == null) {
+ throw new Exception("Invalid tenant information retrieved: tenantId = " + tenant.getTenantId()
+ + " tenantName = " + tenant.getTenantName());
+ }
+ }
+ return tenant;
+ }
+
protected ServiceSubscription getServiceSubscription(RequestDetails requestDetails, Customer customer) {
org.onap.aai.domain.yang.ServiceSubscription aaiServiceSubscription = bbInputSetupUtils
.getAAIServiceSubscription(customer.getGlobalCustomerId(),
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 108fd66488..a838ffdbae 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
@@ -53,6 +53,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.SegmentationAssignment;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
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.VolumeGroup;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
@@ -383,6 +384,14 @@ public class BBInputSetupMapperLayer {
modelMapper.map(aaiCloudRegion, cloudRegion);
return cloudRegion;
}
+
+ protected Tenant mapTenant(org.onap.aai.domain.yang.Tenant aaiTenant) {
+ Tenant tenant = new Tenant();
+ if(aaiTenant != null) {
+ modelMapper.map(aaiTenant, tenant);
+ }
+ return tenant;
+ }
protected Collection mapAAICollectionIntoCollection(org.onap.aai.domain.yang.Collection aaiCollection) {
Collection collection = new Collection();
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 b3b4559f1d..486164e75f 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
@@ -173,7 +173,7 @@ public class BBInputSetupUtils {
if (cloudRegionId != null && cloudOwner != null && !cloudRegionId.isEmpty() && !cloudOwner.isEmpty()) {
return injectionHelper.getAaiClient().get(CloudRegion.class,
AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudOwner,
- cloudRegionId)).orElse(null);
+ cloudRegionId).depth(Depth.TWO)).orElse(null);
} else {
return null;