From 0b906b0de95725879fd1cc7ad585d71c502eebd9 Mon Sep 17 00:00:00 2001 From: "Benjamin, Max (mb388a)" Date: Thu, 14 Mar 2019 16:02:18 -0400 Subject: 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) --- .../bbobjects/Configuration.java | 14 ++- .../servicedecomposition/bbobjects/VfModule.java | 9 +- .../bpmn/servicedecomposition/bbobjects/Vnfc.java | 131 +++++++++++++++++++++ .../entities/ConfigurationResourceKeys.java | 7 ++ .../servicedecomposition/tasks/BBInputSetup.java | 24 +++- .../tasks/BBInputSetupMapperLayer.java | 5 + .../tasks/BBInputSetupUtils.java | 5 + 7 files changed, 188 insertions(+), 7 deletions(-) create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vnfc.java (limited to 'bpmn/MSOCommonBPMN/src/main/java') 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 { @JsonProperty("metadata") private Metadata metadata; @JsonProperty("forwarder-evcs") - private List forwarderEvcs = new ArrayList(); + private List forwarderEvcs = new ArrayList<>(); @JsonProperty("evcs") - private List evcs = new ArrayList(); + private List 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 { public List getForwarderEvcs() { return forwarderEvcs; } + + public Vnfc getVnfc() { + return vnfc; + } + + public void setVnfc(Vnfc vnfc) { + this.vnfc = vnfc; + } public List 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 { @@ -59,6 +61,8 @@ public class VfModule implements Serializable, ShallowCopy { private Integer moduleIndex; @JsonProperty("selflink") private String selflink; + @JsonProperty("vnfcs") + private List vnfcs = new ArrayList<>(); @JsonProperty("model-info-vf-module") private ModelInfoVfModule modelInfoVfModule; @@ -122,6 +126,9 @@ public class VfModule implements Serializable, ShallowCopy { public void setCascaded(boolean cascaded) { this.cascaded = cascaded; } + public List 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 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 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); + } } -- cgit 1.2.3-korg