aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib
diff options
context:
space:
mode:
authorAvi Ziv <AVIZI@amdocs.com>2017-07-26 17:37:57 +0300
committerAvi Ziv <avi.ziv@amdocs.com>2017-07-26 18:27:22 +0300
commit61070c9c6b665fdea79b3ccdfeafc3a6b50d262e (patch)
treedfe9c169cfac91d6c72ac9ff23375f2aafac6405 /openecomp-be/lib/openecomp-sdc-vendor-software-product-lib
parentb824a997e19f6ee9627cb1b1e124c756bd8183fc (diff)
[SDC] Full OnBoard health-check and NFoD support
Change-Id: I606f8a52c7e6d2bd5558f824957d890e552c5423 Signed-off-by: Avi Ziv <avi.ziv@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-vendor-software-product-lib')
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/pom.xml.versionsBackup67
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VendorSoftwareProductConstants.java2
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/composition/CompositionEntityDataManager.java2
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/pom.xml10
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/pom.xml.versionsBackup108
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/VendorSoftwareProductErrorCodes.java5
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/ManualVspDataCollectionService.java421
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionDataExtractorImpl.java12
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionEntityDataManagerImpl.java35
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/pom.xml.versionsBackup22
10 files changed, 446 insertions, 238 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/pom.xml.versionsBackup
deleted file mode 100644
index 67f6a45c0d..0000000000
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/pom.xml.versionsBackup
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="http://maven.apache.org/POM/4.0.0"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-vendor-software-product-lib</artifactId>
- <version>1.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>openecomp-sdc-vendor-software-product-api</artifactId>
- <version>1.0-SNAPSHOT</version>
-
-
- <dependencies>
- <dependency>
- <groupId>org.openecomp.core</groupId>
- <artifactId>openecomp-core-lib</artifactId>
- <type>pom</type>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.openecomp.core</groupId>
- <artifactId>openecomp-facade-core</artifactId>
- <version>1.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.openecomp.core</groupId>
- <artifactId>openecomp-nosqldb-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-versioning-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-translator-core</artifactId>
- <version>1.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-enrichment-api</artifactId>
- <version>1.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-model-core</artifactId>
- <version>1.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.freemarker</groupId>
- <artifactId>freemarker</artifactId>
- <version>2.3.25-incubating</version>
- </dependency>
- <dependency>
- <groupId>org.openecomp.core</groupId>
- <artifactId>openecomp-config-lib</artifactId>
- <version>1.0-SNAPSHOT</version>
- </dependency>
- </dependencies>
-
-
-</project> \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VendorSoftwareProductConstants.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VendorSoftwareProductConstants.java
index 42dd0086c7..8010c40023 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VendorSoftwareProductConstants.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VendorSoftwareProductConstants.java
@@ -29,7 +29,7 @@ public final class VendorSoftwareProductConstants {
public static final String INFORMATION_ARTIFACT_NAME = "VSP_%s_Information.txt";
public static final String UNSUPPORTED_OPERATION_ERROR =
"An error has occurred: Unsupported operation for 1707 release.";
-
+ public static final String NAME_PATTERN = "^[a-zA-Z0-9_]*$";
public final class UniqueValues {
public static final String VENDOR_SOFTWARE_PRODUCT_NAME = "Vendor Software Product name";
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/composition/CompositionEntityDataManager.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/composition/CompositionEntityDataManager.java
index 6c636fddf0..b77012e5cf 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/composition/CompositionEntityDataManager.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/composition/CompositionEntityDataManager.java
@@ -87,7 +87,5 @@ public interface CompositionEntityDataManager {
componentId);
public void saveImagesByComponent(String vspId, Version version, Component component, String
componentId);
- public void saveDeploymentFlavors(String vspId, Version version,
- CompositionData compositionData);
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/pom.xml b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/pom.xml
index 343f4aef62..afee456fc3 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/pom.xml
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/pom.xml
@@ -116,6 +116,16 @@
<artifactId>openecomp-tosca-datatype</artifactId>
<version>${openecomp.sdc.common.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-tosca-generator-api</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-vendor-license-api</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </dependency>
</dependencies>
<build>
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/pom.xml.versionsBackup
deleted file mode 100644
index 634e0874ac..0000000000
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/pom.xml.versionsBackup
+++ /dev/null
@@ -1,108 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="http://maven.apache.org/POM/4.0.0"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <artifactId>openecomp-sdc-vendor-software-product-core</artifactId>
- <version>1.0-SNAPSHOT</version>
-
- <parent>
- <groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-vendor-software-product-lib</artifactId>
- <version>1.0-SNAPSHOT</version>
- </parent>
-
- <dependencies>
- <dependency>
- <groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-vendor-software-product-api</artifactId>
- <version>1.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.openecomp.core</groupId>
- <artifactId>openecomp-nosqldb-api</artifactId>
- <version>1.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.freemarker</groupId>
- <artifactId>freemarker</artifactId>
- <version>2.3.23</version>
- </dependency>
- <dependency>
- <groupId>org.testng</groupId>
- <artifactId>testng</artifactId>
- <version>${testng.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.openecomp.core</groupId>
- <artifactId>openecomp-config-lib</artifactId>
- <version>1.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-model-impl</artifactId>
- <version>1.0-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.xmlgraphics</groupId>
- <artifactId>fop</artifactId>
- <version>2.1</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.dataformat</groupId>
- <artifactId>jackson-dataformat-xml</artifactId>
- <version>2.7.4</version>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <version>2.5</version>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- <version>1.10.19</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.12</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.openecomp.sdc.common</groupId>
- <artifactId>openecomp-configuration-management-core</artifactId>
- <version>1707.0.0-SNAPSHOT</version>
- <scope>runtime</scope>
- <exclusions>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.openecomp.sdc.common</groupId>
- <artifactId>openecomp-configuration-management-api</artifactId>
- <version>1707.0.0-SNAPSHOT</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.19.1</version>
- <configuration>
- <useSystemClassLoader>false</useSystemClassLoader>
- <redirectTestOutputToFile>true</redirectTestOutputToFile>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project> \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/VendorSoftwareProductErrorCodes.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/VendorSoftwareProductErrorCodes.java
index 5284b9a74f..d87059e89c 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/VendorSoftwareProductErrorCodes.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/VendorSoftwareProductErrorCodes.java
@@ -64,6 +64,7 @@ public class VendorSoftwareProductErrorCodes {
"VSP_ONBOARD_METHOD_UPDATE_NOT_ALLOWED";
public static final String DUPLICATE_NIC_NAME_NOT_ALLOWED = "DUPLICATE_NIC_NAME_NOT_ALLOWED";
+ public static final String NIC_NAME_FORMAT_NOT_ALLOWED = "NIC_NAME_FORMAT_NOT_ALLOWED";
public static final String NULL_NETWORKID_NOT_ALLOWED = "NULL_NETWORKID_NOT_ALLOWED";
@@ -102,6 +103,7 @@ public class VendorSoftwareProductErrorCodes {
ADD_IMAGE_NOT_ALLOWED_IN_HEAT_ONBOARDING = "ADD_IMAGE_NOT_ALLOWED_IN_HEAT_ONBOARDING";
public static final String DUPLICATE_IMAGE_NAME_NOT_ALLOWED = "DUPLICATE_IMAGE_NAME_NOT_ALLOWED";
+ public static final String IMAGE_NAME_FORMAT_NOT_ALLOWED = "IMAGE_NAME_FORMAT_NOT_ALLOWED";
public static final String VFC_IMAGE_INVALID_FORMAT = "VFC_IMAGE_INVALID_FORMAT";
public static final String FEATURE_GROUP_NOT_EXIST_FOR_VSP = "FEATURE_GROUP_NOT_EXIST_FOR_VSP";
@@ -115,8 +117,11 @@ public class VendorSoftwareProductErrorCodes {
= "SAME_VFC_ASSOCIATION_MORE_THAN_ONCE_NOT_ALLOWED";
public static final String DUPLICATE_DEPLOYMENT_FLAVOR_MODEL_NOT_ALLOWED
= "DUPLICATE_DEPLOYMENT_FLAVOR_MODEL_NOT_ALLOWED";
+ public static final String DEPLOYMENT_FLAVOR_NAME_FORMAT_NOT_ALLOWED =
+ "DEPLOYMENT_FLAVOR_NAME_FORMAT_NOT_ALLOWED";
public static final String INVALID_COMPUTE_FLAVOR_ID = "INVALID_COMPUTE_FLAVOR_ID";
public static final String DUPLICATE_COMPUTE_NAME_NOT_ALLOWED = "DUPLICATE_COMPUTE_NAME_NOT_ALLOWED";
+ public static final String COMPUTE_NAME_FORMAT_NOT_ALLOWED = "COMPUTE_NAME_FORMAT_NOT_ALLOWED";
public static final String DELETE_IMAGE_NOT_ALLOWED = "DELETE_IMAGE_NOT_ALLOWED";
public static final String UPDATE_IMAGE_NOT_ALLOWED = "UPDATE_IMAGE_NOT_ALLOWED";
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/ManualVspDataCollectionService.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/ManualVspDataCollectionService.java
new file mode 100644
index 0000000000..1499bccec2
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/ManualVspDataCollectionService.java
@@ -0,0 +1,421 @@
+package org.openecomp.sdc.vendorsoftwareproduct.services;
+
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang.StringUtils;
+import org.openecomp.core.utilities.json.JsonUtil;
+import org.openecomp.sdc.datatypes.error.ErrorLevel;
+import org.openecomp.sdc.generator.datatypes.tosca.ComputeFlavor;
+import org.openecomp.sdc.generator.datatypes.tosca.DeploymentFlavorModel;
+import org.openecomp.sdc.generator.datatypes.tosca.LicenseFlavor;
+import org.openecomp.sdc.generator.datatypes.tosca.MultiFlavorVfcImage;
+import org.openecomp.sdc.generator.datatypes.tosca.VendorInfo;
+import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage;
+import org.openecomp.sdc.logging.types.LoggerConstants;
+import org.openecomp.sdc.logging.types.LoggerErrorCode;
+import org.openecomp.sdc.logging.types.LoggerTragetServiceName;
+import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity;
+import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupModel;
+import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade;
+import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacadeFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ImageDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ImageDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComputeEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.DeploymentFlavorEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ImageEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentComputeAssociation;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentData;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.DeploymentFlavor;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Image;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic;
+import org.openecomp.sdc.vendorsoftwareproduct.types.questionnaire.component.compute.Compute;
+import org.openecomp.sdc.vendorsoftwareproduct.types.questionnaire.component.image.ImageDetails;
+import org.openecomp.sdc.versioning.dao.types.Version;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+
+
+public class ManualVspDataCollectionService {
+
+ private static final VendorSoftwareProductDao vendorSoftwareProductDao =
+ VendorSoftwareProductDaoFactory.getInstance().createInterface();
+ private static final VendorSoftwareProductInfoDao vendorSoftwareProductInfoDao =
+ VendorSoftwareProductInfoDaoFactory.getInstance().createInterface();
+ private static final ComputeDao computeDao =
+ ComputeDaoFactory.getInstance().createInterface();
+ private static final ImageDao imageDao =
+ ImageDaoFactory.getInstance().createInterface();
+ private static final ComponentDao componentDao =
+ ComponentDaoFactory.getInstance().createInterface();
+
+ private static final NicDao nicDao =
+ NicDaoFactory.getInstance().createInterface();
+ private static final VendorLicenseFacade vendorLicenseFacade =
+ VendorLicenseFacadeFactory.getInstance().createInterface();
+
+
+ /**
+ * Gets vendor name for the vsp.
+ *
+ * @param vspId the vsp id
+ * @param version the version
+ * @param user the user
+ * @return the release vendor name
+ */
+ public Optional<String> getReleaseVendor(String vspId, Version version, String user) {
+ String vendorName = null;
+ VspDetails vspDetails = vendorSoftwareProductInfoDao.get(new VspDetails(vspId, version));
+ if (Objects.nonNull(vspDetails)) {
+ vendorName = vspDetails.getVendorName();
+ }
+ return Optional.ofNullable(vendorName);
+ }
+
+ /**
+ * Gets the deployment flavor data for manually onboarded VSPs.
+ *
+ * @param vspId the vsp id
+ * @param version the version
+ * @param user the user
+ * @return the allowed flavors
+ */
+ public Map<String, DeploymentFlavorModel> getAllowedFlavors(String vspId, Version version,
+ String user) {
+ Map<String, DeploymentFlavorModel> allowedFlavors = new HashMap<>();
+ Collection<DeploymentFlavorEntity> deploymentFlavorEntities =
+ vendorSoftwareProductDao.listDeploymentFlavors(vspId, version);
+ if (CollectionUtils.isNotEmpty(deploymentFlavorEntities)) {
+ for (DeploymentFlavorEntity deploymentFlavorEntity : deploymentFlavorEntities) {
+ DeploymentFlavor deploymentFlavorCompositionData =
+ deploymentFlavorEntity.getDeploymentFlavorCompositionData();
+
+ VspDetails vspDetails = vendorSoftwareProductInfoDao.get(new VspDetails(vspId, version));
+ String vspVlmId;
+ Version vlmVersion;
+ if (Objects.nonNull(vspDetails)) {
+ vspVlmId = vspDetails.getVendorId();
+ vlmVersion = vspDetails.getVlmVersion();
+ if (StringUtils.isNotEmpty(vspVlmId)) {
+ DeploymentFlavorModel deploymentFlavorModel = new DeploymentFlavorModel();
+ String featureGroupId = deploymentFlavorCompositionData.getFeatureGroupId();
+ if (Objects.isNull(featureGroupId)) {
+ //No feature group associated with deployment flavor. So excluding this deployment
+ // flavor for Tosca model
+ continue;
+ }
+ //Gather and set License flavor info
+ LicenseFlavor licenseFlavor = getLicenseFlavor(featureGroupId);
+ deploymentFlavorModel.setLicense_flavor(licenseFlavor);
+ //Get sp_part_number
+ Optional<String> partNumber = getPartNumber(vspVlmId, vlmVersion, featureGroupId,
+ user);
+ partNumber.ifPresent(deploymentFlavorModel::setSp_part_number);
+ //Gather and set Vendor Info
+ String vendorModel = deploymentFlavorCompositionData.getModel();
+ Optional<VendorInfo> vendorInfo = getVendorInfo(vspVlmId, vendorModel, vlmVersion,
+ featureGroupId, user);
+ vendorInfo.ifPresent(deploymentFlavorModel::setVendor_info);
+ //Gather and set Compute info
+ List<ComponentComputeAssociation> componentComputeAssociations =
+ deploymentFlavorCompositionData.getComponentComputeAssociations();
+ if (CollectionUtils.isNotEmpty(componentComputeAssociations)) {
+ for (ComponentComputeAssociation componentComputeAssociation :
+ componentComputeAssociations) {
+ String componentId = componentComputeAssociation.getComponentId();
+ String computeFlavorId = componentComputeAssociation.getComputeFlavorId();
+ Optional<ComputeFlavor> computeFlavor =
+ getComputeFlavor(vspId, version, componentId, computeFlavorId, user);
+ computeFlavor.ifPresent(deploymentFlavorModel::setCompute_flavor);
+ }
+ }
+ partNumber.ifPresent(spPartNumber -> allowedFlavors.put(spPartNumber,
+ deploymentFlavorModel));
+ }
+ }
+ }
+ }
+ return allowedFlavors;
+ }
+
+ /**
+ * Gets the component image data for manually onboarded VSPs.
+ *
+ * @param vspId the vsp id
+ * @param version the version
+ * @param user the user
+ * @return the vsp component images
+ */
+ public Map<String, List<MultiFlavorVfcImage>> getVspComponentImages(String vspId,
+ Version version,
+ String user) {
+ Map<String, List<MultiFlavorVfcImage>> vspComponentImages = new HashMap<>();
+ Collection<DeploymentFlavorEntity> deploymentFlavorEntities =
+ vendorSoftwareProductDao.listDeploymentFlavors(vspId, version);
+ for (DeploymentFlavorEntity deploymentFlavorEntity : deploymentFlavorEntities) {
+ DeploymentFlavor deploymentFlavorCompositionData =
+ deploymentFlavorEntity.getDeploymentFlavorCompositionData();
+
+ List<ComponentComputeAssociation> componentComputeAssociations =
+ deploymentFlavorCompositionData.getComponentComputeAssociations();
+ if (CollectionUtils.isNotEmpty(componentComputeAssociations)) {
+ for (ComponentComputeAssociation componentComputeAssociation :
+ componentComputeAssociations) {
+ String componentId = componentComputeAssociation.getComponentId();
+ List<MultiFlavorVfcImage> componentImages =
+ getComponentImages(vspId, version, componentId, user);
+ if (CollectionUtils.isNotEmpty(componentImages)) {
+ vspComponentImages.put(componentId, componentImages);
+ }
+ }
+ }
+ }
+ return vspComponentImages;
+ }
+
+ /**
+ * Gets the component data for manually onboarded VSPs.
+ *
+ * @param vspId the vsp id
+ * @param version the version
+ * @param user the user
+ * @return the vsp components
+ */
+ public Map<String, String> getVspComponents(String vspId, Version version, String user) {
+ Map<String, String> componentIdNameMap = new HashMap<>();
+ Collection<DeploymentFlavorEntity> deploymentFlavorEntities =
+ vendorSoftwareProductDao.listDeploymentFlavors(vspId, version);
+ for (DeploymentFlavorEntity deploymentFlavorEntity : deploymentFlavorEntities) {
+ DeploymentFlavor deploymentFlavorCompositionData =
+ deploymentFlavorEntity.getDeploymentFlavorCompositionData();
+
+ List<ComponentComputeAssociation> componentComputeAssociations =
+ deploymentFlavorCompositionData.getComponentComputeAssociations();
+ if (CollectionUtils.isNotEmpty(componentComputeAssociations)) {
+ for (ComponentComputeAssociation componentComputeAssociation :
+ componentComputeAssociations) {
+ String componentId = componentComputeAssociation.getComponentId();
+ Optional<String> componentName = getComponentName(vspId, version, componentId, user);
+ componentName.ifPresent(name -> componentIdNameMap.put(componentId, name));
+ }
+ }
+ }
+ return componentIdNameMap;
+ }
+
+ /**
+ * Gets the NIC data for manually onboarded VSPs.
+ *
+ * @param vspId the vsp id
+ * @param version the version
+ * @param user the user
+ * @return the vsp component nics
+ */
+ public Map<String, List<Nic>> getVspComponentNics(String vspId, Version version, String user) {
+ Map<String, List<Nic>> vspComponentNics = new HashMap<>();
+ Collection<DeploymentFlavorEntity> deploymentFlavorEntities =
+ vendorSoftwareProductDao.listDeploymentFlavors(vspId, version);
+ if (CollectionUtils.isNotEmpty(deploymentFlavorEntities)) {
+ for (DeploymentFlavorEntity deploymentFlavorEntity : deploymentFlavorEntities) {
+ DeploymentFlavor deploymentFlavorCompositionData =
+ deploymentFlavorEntity.getDeploymentFlavorCompositionData();
+ if (Objects.nonNull(deploymentFlavorCompositionData)) {
+ List<ComponentComputeAssociation> componentComputeAssociations =
+ deploymentFlavorCompositionData.getComponentComputeAssociations();
+ if (CollectionUtils.isNotEmpty(componentComputeAssociations)) {
+ for (ComponentComputeAssociation componentComputeAssociation :
+ componentComputeAssociations) {
+ String componentId = componentComputeAssociation.getComponentId();
+ List<Nic> componentNics = getComponentNics(vspId, version, componentId, user);
+ if (CollectionUtils.isNotEmpty(componentNics)) {
+ vspComponentNics.put(componentId, componentNics);
+ }
+ }
+ }
+ }
+ }
+ }
+ return vspComponentNics;
+ }
+
+ private List<Nic> getComponentNics(String vspId, Version version, String componentId,
+ String user) {
+ List<Nic> componentNics = new ArrayList<>();
+ Collection<NicEntity> nics = nicDao.list(new NicEntity(vspId, version, componentId, null));
+ if (Objects.nonNull(nics)) {
+ for (NicEntity nic : nics) {
+ String nicId = nic.getId();
+ NicEntity nicEntity = nicDao.get(new NicEntity(vspId, version, componentId, nicId));
+ if (Objects.nonNull(nicEntity)
+ && Objects.nonNull(nicEntity.getCompositionData())) {
+ componentNics.add(nicEntity.getNicCompositionData());
+ }
+ }
+ }
+ return componentNics;
+ }
+
+ private LicenseFlavor getLicenseFlavor(String featureGroupId) {
+ LicenseFlavor licenseFlavor = new LicenseFlavor();
+ licenseFlavor.setFeature_group_uuid(featureGroupId);
+ return licenseFlavor;
+ }
+
+ private Optional<String> getPartNumber(String vlmId, Version version,
+ String featureGroupId, String user) {
+ FeatureGroupModel featureGroup = getFeatureGroup(vlmId, version, featureGroupId, user);
+ if (Objects.nonNull(featureGroup)) {
+ return Optional.ofNullable(featureGroup.getFeatureGroup().getPartNumber());
+ }
+ return Optional.empty();
+ }
+
+ private Optional<VendorInfo> getVendorInfo(String vlmId, String vendorModel, Version version,
+ String featureGroupId, String user) {
+ VendorInfo vendorInfo = null;
+ FeatureGroupModel featureGroup = getFeatureGroup(vlmId, version, featureGroupId, user);
+ if (Objects.nonNull(featureGroup)) {
+ //Process Feature group to get Manufacturer ref no.
+ String manufacturerReferenceNumber = featureGroup.getEntityManufacturerReferenceNumber();
+ vendorInfo = new VendorInfo();
+ vendorInfo.setVendor_model(vendorModel);
+ if (Objects.nonNull(manufacturerReferenceNumber)) {
+ vendorInfo.setManufacturer_reference_number(manufacturerReferenceNumber);
+ }
+ }
+ return Optional.ofNullable(vendorInfo);
+ }
+
+ private Optional<ComputeFlavor> getComputeFlavor(String vspId, Version version,
+ String componentId, String computeFlavorId,
+ String user) {
+ ComputeFlavor computeFlavor = null;
+ ComputeEntity computeQuestionnaire = null;
+ try {
+ computeQuestionnaire = computeDao.getQuestionnaireData(vspId, version, componentId,
+ computeFlavorId);
+ } catch (Exception ex) {
+ computeQuestionnaire = null;
+ MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API,
+ LoggerTragetServiceName.COLLECT_MANUAL_VSP_TOSCA_DATA, ErrorLevel.INFO.name(),
+ LoggerErrorCode.DATA_ERROR.getErrorCode(), "Failed to get compute questionnaire : "
+ + ex.getMessage());
+ }
+ if (Objects.nonNull(computeQuestionnaire)) {
+ String computeQuestionnaireData = computeQuestionnaire.getQuestionnaireData();
+ if (Objects.nonNull(computeQuestionnaireData)) {
+ Compute compute;
+ try {
+ compute = JsonUtil.json2Object(computeQuestionnaireData, Compute.class);
+ } catch (Exception ex) {
+ compute = null;
+ MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API,
+ LoggerTragetServiceName.COLLECT_MANUAL_VSP_TOSCA_DATA, ErrorLevel.INFO.name(),
+ LoggerErrorCode.DATA_ERROR.getErrorCode(), "Unable to parse compute questionnaire : "
+ + ex.getMessage());
+ }
+ if (Objects.nonNull(compute.getVmSizing())) {
+ computeFlavor = new ComputeFlavor();
+ if (Objects.nonNull(compute.getVmSizing().getNumOfCPUs())) {
+ computeFlavor.setNum_cpus(compute.getVmSizing().getNumOfCPUs());
+ }
+ if (Objects.nonNull(compute.getVmSizing().getFileSystemSizeGB())) {
+ computeFlavor.setDisk_size(compute.getVmSizing().getFileSystemSizeGB() + " GB");
+ }
+ if (Objects.nonNull(compute.getVmSizing().getMemoryRAM())) {
+ computeFlavor.setMem_size(compute.getVmSizing().getMemoryRAM());
+ }
+ }
+ }
+ }
+ return Optional.ofNullable(computeFlavor);
+ }
+
+ private FeatureGroupModel getFeatureGroup(String vlmId, Version version, String featureGroupId,
+ String user) {
+ FeatureGroupEntity fgInput = new FeatureGroupEntity();
+ fgInput.setVendorLicenseModelId(vlmId);
+ fgInput.setVersion(version);
+ fgInput.setId(featureGroupId);
+ return vendorLicenseFacade.getFeatureGroupModel(fgInput, user);
+ }
+
+ private Optional<String> getComponentName(String vspId, Version version, String componentId,
+ String user) {
+
+ ComponentEntity componentEntity =
+ componentDao.get(new ComponentEntity(vspId, version, componentId));
+ if (Objects.nonNull(componentEntity)
+ && Objects.nonNull(componentEntity.getComponentCompositionData())) {
+ ComponentData componentCompositionData = componentEntity.getComponentCompositionData();
+ return Optional.ofNullable(componentCompositionData.getDisplayName());
+ }
+ return Optional.empty();
+ }
+
+ private List<MultiFlavorVfcImage> getComponentImages(String vspId, Version version,
+ String componentId, String user) {
+ List<MultiFlavorVfcImage> multiFlavorVfcImages = new ArrayList<>();
+ MultiFlavorVfcImage multiFlavorVfcImage = null;
+ Collection<ImageEntity> componentImages =
+ vendorSoftwareProductDao.listImages(vspId, version, componentId);
+ if (Objects.nonNull(componentImages)) {
+ for (ImageEntity componentImage : componentImages) {
+ String imageId = componentImage.getId();
+ ImageEntity imageEntity = vendorSoftwareProductDao.getImage(vspId, version, componentId,
+ imageId);
+ ImageEntity imageQuestionnaireDataEntity = imageDao.getQuestionnaireData(vspId, version,
+ componentId, imageId);
+ Image imageCompositionData = imageEntity.getImageCompositionData();
+ if (Objects.nonNull(imageEntity)
+ && Objects.nonNull(imageQuestionnaireDataEntity)
+ && Objects.nonNull(imageCompositionData)) {
+ ImageDetails imageDetails;
+ try {
+ imageDetails = JsonUtil.json2Object(imageQuestionnaireDataEntity
+ .getQuestionnaireData(), ImageDetails.class);
+ } catch (Exception ex) {
+ imageDetails = null;
+ MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API,
+ LoggerTragetServiceName.COLLECT_MANUAL_VSP_TOSCA_DATA, ErrorLevel.INFO.name(),
+ LoggerErrorCode.DATA_ERROR.getErrorCode(), "Unable to parse image questionnaire : "
+ + ex.getMessage());
+ }
+ if (Objects.nonNull(imageDetails)
+ && Objects.nonNull(imageDetails.getVersion())) {
+ //Image version is used as a key for the image block
+ //So excluding the population if questionnaire data is absent or invalid
+ multiFlavorVfcImage = new MultiFlavorVfcImage();
+ multiFlavorVfcImage.setSoftware_version(imageDetails.getVersion());
+ if (Objects.nonNull(imageCompositionData.getFileName())) {
+ multiFlavorVfcImage.setFile_name(imageCompositionData.getFileName());
+ }
+ if (Objects.nonNull(imageDetails.getMd5())) {
+ multiFlavorVfcImage.setFile_hash(imageDetails.getMd5());
+ }
+ multiFlavorVfcImage.setFile_hash_type("md5");
+ multiFlavorVfcImages.add(multiFlavorVfcImage);
+ }
+ }
+ }
+ }
+ return multiFlavorVfcImages;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionDataExtractorImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionDataExtractorImpl.java
index 6b55ffc714..a16fea19ab 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionDataExtractorImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionDataExtractorImpl.java
@@ -338,7 +338,7 @@ public class CompositionDataExtractorImpl implements CompositionDataExtractor {
if (obj instanceof String) {
images.add((String) obj);
} else {
- HashMap<String,String> objMap = new ObjectMapper().convertValue(obj,HashMap.class);
+ Map<String,String> objMap = new ObjectMapper().convertValue(obj,Map.class);
images.add(getInputs(toscaServiceModel,objMap.get("get_input")));
}
}
@@ -364,7 +364,7 @@ public class CompositionDataExtractorImpl implements CompositionDataExtractor {
if (obj instanceof String) {
computes.add((String) obj);
} else {
- HashMap<String, String> objMap = new ObjectMapper().convertValue(obj, HashMap.class);
+ Map<String, String> objMap = new ObjectMapper().convertValue(obj, Map.class);
computes.add(getInputs(toscaServiceModel, objMap.get("get_input")));
}
}
@@ -387,7 +387,13 @@ public class CompositionDataExtractorImpl implements CompositionDataExtractor {
for (Map.Entry<String, ParameterDefinition> inputEntry : serviceTemplate
.getTopology_template().getInputs().entrySet()) {
if (inputEntry.getKey().equals(inputValue)) {
- return (String)inputEntry.getValue().get_default();
+ String value;
+ try {
+ value= (String) inputEntry.getValue().get_default();
+ } catch (Exception e) {
+ value = inputEntry.getValue().get_default().toString();
+ }
+ return value;
}
}
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionEntityDataManagerImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionEntityDataManagerImpl.java
index 71f5fa1d41..7d5d57dc37 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionEntityDataManagerImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionEntityDataManagerImpl.java
@@ -224,7 +224,6 @@ public class CompositionEntityDataManagerImpl implements CompositionEntityDataMa
Map<String, String> networkIdByName = saveNetworks(vspId, version, compositionData);
saveComponents(vspId, version, compositionData, networkIdByName);
- saveDeploymentFlavors(vspId, version, compositionData);
mdcDataDebugMessage.debugExitMessage(null);
}
@@ -688,38 +687,4 @@ public class CompositionEntityDataManagerImpl implements CompositionEntityDataMa
}
}
- public void saveDeploymentFlavors(String vspId, Version version,
- CompositionData compositionData) {
-
- mdcDataDebugMessage.debugEntryMessage(null, null);
-
- if (CollectionUtils.isNotEmpty(compositionData.getComponents())) {
- DeploymentFlavorEntity deploymentFlavorEntity = new DeploymentFlavorEntity(vspId, version,
- null);
- DeploymentFlavor deploymentFlavor = new DeploymentFlavor();
- VspDetails vendorSoftwareProductInfo =
- vspInfoDao.get(new VspDetails(vspId, version));
- if (vendorSoftwareProductInfo.getName() != null) {
- deploymentFlavor.setModel(vendorSoftwareProductInfo.getName());
- List<ComponentComputeAssociation> componentComputeAssociationList = new ArrayList<>();
- Collection<ComputeEntity> computes= vendorSoftwareProductDao.listComputesByVsp(vspId,
- version);
- for (ComputeEntity compute : computes) {
- ComponentComputeAssociation componentComputeAssociation = new
- ComponentComputeAssociation();
- if (compute.getComponentId() != null && compute.getId() != null){
- componentComputeAssociation.setComponentId(compute.getComponentId());
- componentComputeAssociation.setComputeFlavorId(compute.getId());
- componentComputeAssociationList.add(componentComputeAssociation);
- }
- }
- deploymentFlavor.setComponentComputeAssociations(componentComputeAssociationList);
- }
- deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavor);
- createDeploymentFlavor(deploymentFlavorEntity);
- }
-
- mdcDataDebugMessage.debugExitMessage(null, null);
- }
-
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/pom.xml.versionsBackup
deleted file mode 100644
index a1ee8d3985..0000000000
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/pom.xml.versionsBackup
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="http://maven.apache.org/POM/4.0.0"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <artifactId>openecomp-sdc-vendor-software-product-lib</artifactId>
- <packaging>pom</packaging>
-
- <parent>
- <groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-lib</artifactId>
- <version>1.0-SNAPSHOT</version>
- </parent>
-
-
- <modules>
- <module>openecomp-sdc-vendor-software-product-api</module>
- <module>openecomp-sdc-vendor-software-product-core</module>
- </modules>
-
-
-</project> \ No newline at end of file