summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib
diff options
context:
space:
mode:
authorAvi Ziv <avi.ziv@amdocs.com>2017-07-18 19:45:38 +0300
committerAvi Ziv <avi.ziv@amdocs.com>2017-07-18 19:45:38 +0300
commitb8e2faf476202b6ffe61bc3a9a37df1304881d40 (patch)
treef78b8c0517d8e16c5ae610bf8b49f68ea8a312a1 /openecomp-be/lib/openecomp-sdc-vendor-software-product-lib
parent75aacbbe1acf78fa53378f07f0a8c7769449a17e (diff)
[SDC] Onboarding 1710 rebase.
Change-Id: If3b6b81d221fde13908f1e8160db6f7d9433c535 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.java8
-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/dao/ComponentArtifactDao.java (renamed from openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/MibDao.java)17
-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/dao/ComputeDao.java21
-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/dao/ComputeDaoFactory.java12
-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/dao/DeploymentFlavorDao.java12
-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/dao/DeploymentFlavorDaoFactory.java11
-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/dao/ImageDao.java23
-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/dao/ImageDaoFactory.java11
-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/dao/MonitoringUploadDaoFactory.java (renamed from openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/MibDaoFactory.java)8
-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/dao/VendorSoftwareProductDao.java47
-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/dao/VendorSoftwareProductInfoDao.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/dao/type/ComponentEntity.java6
-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/dao/type/ComponentMonitoringUploadEntity.java (renamed from openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/MibEntity.java)17
-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/dao/type/ComputeEntity.java132
-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/dao/type/DeploymentFlavorEntity.java159
-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/dao/type/ImageEntity.java175
-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/dao/type/NicEntity.java4
-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/dao/type/VspDetails.java11
-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.java16
-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/impl/HeatFileAnalyzerRowDataImpl.java3
-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/types/composition/Component.java19
-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/types/composition/ComponentComputeAssociation.java22
-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/types/composition/ComponentData.java18
-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/types/composition/CompositionEntityType.java5
-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/types/composition/ComputeData.java52
-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/types/composition/DeploymentFlavor.java44
-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/types/composition/ExtractCompositionDataContext.java30
-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/types/composition/Image.java68
-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/types/composition/ImageData.java32
-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/types/composition/ImageFormat.java13
-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/types/composition/Nic.java17
-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/types/composition/VmSizing.java58
-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/types/questionnaire/component/compute/VmSizing.java27
-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/types/questionnaire/component/image/ImageDetails.java33
-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/types/schemagenerator/ComputeCompositionSchemaInput.java25
-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/types/schemagenerator/DeploymentFlavorCompositionSchemaInput.java39
-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/types/schemagenerator/ImageCompositionSchemaInput.java18
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/resources/factoryConfiguration.json5
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/pom.xml5
-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/dao/impl/ComputeDaoCassandraImpl.java120
-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/dao/impl/ComputeDaoFactoryImpl.java16
-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/dao/impl/DeploymentFlavorDaoCassandraImpl.java93
-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/dao/impl/DeploymentFlavorDaoFactoryImpl.java17
-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/dao/impl/ImageDaoFactoryImpl.java18
-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/dao/impl/ImageDaoImpl.java129
-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/dao/impl/MonitoringUploadDaoFactoryImpl.java (renamed from openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/MibDaoFactoryImpl.java)12
-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/dao/impl/VendorSoftwareProductDaoImpl.java123
-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/dao/impl/VendorSoftwareProductInfoDaoImpl.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/dao/impl/zusammen/ComponentArtifactDaoZusammenImpl.java (renamed from openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/MibDaoZusammenImpl.java)131
-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/dao/impl/zusammen/ComponentDaoZusammenImpl.java6
-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/dao/impl/zusammen/ComponentDependencyModelPropertyName.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/dao/impl/zusammen/ComputeDaoZusammenImpl.java251
-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/dao/impl/zusammen/DeploymentFlavorDaoZusammenImpl.java179
-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/dao/impl/zusammen/ElementType.java6
-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/dao/impl/zusammen/ImageDaoZusammenImpl.java252
-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/dao/impl/zusammen/StructureElement.java4
-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/dao/impl/zusammen/VendorSoftwareProductInfoDaoZusammenImpl.java19
-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.java64
-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/factory/impl/CompositionEntityDataManagerFactoryImpl.java14
-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.java108
-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.java132
-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/filedatastructuremodule/CandidateServiceImpl.java937
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ServiceModelDaoFactoryTest.java14
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/informationArtifact/impl/TxtInformationArtifactGeneratorImplTest.java7
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/pom.xml.versionsBackup22
67 files changed, 3501 insertions, 590 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
new file mode 100644
index 0000000000..67f6a45c0d
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/pom.xml.versionsBackup
@@ -0,0 +1,67 @@
+<?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 8b2470a525..42dd0086c7 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
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -37,8 +37,10 @@ public final class VendorSoftwareProductConstants {
public static final String NETWORK_NAME = "Network name";
public static final String COMPONENT_NAME = "ComponentData name";
public static final String NIC_NAME = "NIC name";
+ public static final String COMPUTE_NAME = "Compute name";
public static final String ORCHESTRATION_CANDIDATE_NAME = "Orchestration Candidate name";
//public static final String COMPONENT_ARTIFACT_NAME = "ComponentArtifact name";
-
+ public static final String DEPLOYMENT_FLAVOR_NAME = "Deployment Flavor name";
+ public static final String IMAGE_NAME = "Image 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/dao/MibDao.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ComponentArtifactDao.java
index 1efd21ccbf..88b5964114 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/MibDao.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ComponentArtifactDao.java
@@ -20,24 +20,25 @@
package org.openecomp.sdc.vendorsoftwareproduct.dao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.MibEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentMonitoringUploadEntity;
import org.openecomp.sdc.versioning.dao.VersionableDao;
import java.util.Collection;
import java.util.Optional;
-public interface MibDao extends VersionableDao {
+public interface ComponentArtifactDao extends VersionableDao {
- Optional<MibEntity> getByType(MibEntity entity);
+ Optional<ComponentMonitoringUploadEntity> getByType(ComponentMonitoringUploadEntity entity);
- void create(MibEntity entity);
+ void create(ComponentMonitoringUploadEntity entity);
- void delete(MibEntity entity);
+ void delete(ComponentMonitoringUploadEntity entity);
- Collection<MibEntity> list(MibEntity entity);
+ Collection<ComponentMonitoringUploadEntity> list(ComponentMonitoringUploadEntity entity);
- void deleteAll(MibEntity entity);
+ void deleteAll(ComponentMonitoringUploadEntity entity);
- Collection<MibEntity> listArtifacts(MibEntity entity);
+ Collection<ComponentMonitoringUploadEntity> listArtifacts(
+ ComponentMonitoringUploadEntity entity);
}
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/dao/ComputeDao.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ComputeDao.java
new file mode 100644
index 0000000000..46a7f0d155
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ComputeDao.java
@@ -0,0 +1,21 @@
+package org.openecomp.sdc.vendorsoftwareproduct.dao;
+
+import org.openecomp.core.dao.BaseDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComputeEntity;
+import org.openecomp.sdc.versioning.dao.VersionableDao;
+import org.openecomp.sdc.versioning.dao.types.Version;
+
+import java.util.Collection;
+
+public interface ComputeDao extends VersionableDao, BaseDao<ComputeEntity> {
+
+ Collection<ComputeEntity> listByVsp(String vspId, Version version);
+
+
+ void updateQuestionnaireData(String vspId, Version version, String componentId, String computeId,
+ String questionnaireData);
+ void deleteAll(String vspId, Version version);
+
+ ComputeEntity getQuestionnaireData(String vspId, Version version, String componentId,
+ String computeId);
+}
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/dao/ComputeDaoFactory.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ComputeDaoFactory.java
new file mode 100644
index 0000000000..daf04f17df
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ComputeDaoFactory.java
@@ -0,0 +1,12 @@
+package org.openecomp.sdc.vendorsoftwareproduct.dao;
+
+import org.openecomp.core.factory.api.AbstractComponentFactory;
+import org.openecomp.core.factory.api.AbstractFactory;
+
+public abstract class ComputeDaoFactory extends AbstractComponentFactory<ComputeDao> {
+
+
+ public static ComputeDaoFactory getInstance() {
+ return AbstractFactory.getInstance(ComputeDaoFactory.class);
+ }
+}
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/dao/DeploymentFlavorDao.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/DeploymentFlavorDao.java
new file mode 100644
index 0000000000..e27bddb881
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/DeploymentFlavorDao.java
@@ -0,0 +1,12 @@
+package org.openecomp.sdc.vendorsoftwareproduct.dao;
+
+
+import org.openecomp.core.dao.BaseDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.DeploymentFlavorEntity;
+import org.openecomp.sdc.versioning.dao.VersionableDao;
+import org.openecomp.sdc.versioning.dao.types.Version;
+
+public interface DeploymentFlavorDao extends VersionableDao, BaseDao<DeploymentFlavorEntity> {
+ void deleteAll(String vspId, Version version);
+}
+
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/dao/DeploymentFlavorDaoFactory.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/DeploymentFlavorDaoFactory.java
new file mode 100644
index 0000000000..796aa97457
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/DeploymentFlavorDaoFactory.java
@@ -0,0 +1,11 @@
+package org.openecomp.sdc.vendorsoftwareproduct.dao;
+
+
+import org.openecomp.core.factory.api.AbstractComponentFactory;
+import org.openecomp.core.factory.api.AbstractFactory;
+
+public abstract class DeploymentFlavorDaoFactory extends AbstractComponentFactory<DeploymentFlavorDao> {
+ public static DeploymentFlavorDaoFactory getInstance() {
+ return AbstractFactory.getInstance(DeploymentFlavorDaoFactory.class);
+ }
+}
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/dao/ImageDao.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ImageDao.java
new file mode 100644
index 0000000000..90e591918a
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ImageDao.java
@@ -0,0 +1,23 @@
+package org.openecomp.sdc.vendorsoftwareproduct.dao;
+
+
+import org.openecomp.core.dao.BaseDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ImageEntity;
+import org.openecomp.sdc.versioning.dao.VersionableDao;
+import org.openecomp.sdc.versioning.dao.types.Version;
+
+import java.util.Collection;
+
+public interface ImageDao extends VersionableDao, BaseDao<ImageEntity> {
+
+ void updateQuestionnaireData(String vspId, Version version, String componentId, String imageId,
+ String questionnaireData);
+
+
+ void deleteByVspId(String vspId, Version version);
+
+ Collection<ImageEntity> listByVsp(String vspId, Version version);
+
+ ImageEntity getQuestionnaireData(String vspId, Version version, String componentId,
+ String imageId);
+}
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/dao/ImageDaoFactory.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ImageDaoFactory.java
new file mode 100644
index 0000000000..503d44b14f
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ImageDaoFactory.java
@@ -0,0 +1,11 @@
+package org.openecomp.sdc.vendorsoftwareproduct.dao;
+
+import org.openecomp.core.factory.api.AbstractComponentFactory;
+import org.openecomp.core.factory.api.AbstractFactory;
+
+public abstract class ImageDaoFactory extends AbstractComponentFactory<ImageDao> {
+
+ public static ImageDaoFactory getInstance() {
+ return AbstractFactory.getInstance(ImageDaoFactory.class);
+ }
+}
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/dao/MibDaoFactory.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/MonitoringUploadDaoFactory.java
index 52c610caa6..b70b1a5245 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/MibDaoFactory.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/MonitoringUploadDaoFactory.java
@@ -23,10 +23,10 @@ package org.openecomp.sdc.vendorsoftwareproduct.dao;
import org.openecomp.core.factory.api.AbstractComponentFactory;
import org.openecomp.core.factory.api.AbstractFactory;
-public abstract class MibDaoFactory
- extends AbstractComponentFactory<MibDao> {
+public abstract class MonitoringUploadDaoFactory
+ extends AbstractComponentFactory<ComponentArtifactDao> {
- public static MibDaoFactory getInstance() {
- return AbstractFactory.getInstance(MibDaoFactory.class);
+ public static MonitoringUploadDaoFactory getInstance() {
+ return AbstractFactory.getInstance(MonitoringUploadDaoFactory.class);
}
}
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/dao/VendorSoftwareProductDao.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/VendorSoftwareProductDao.java
index 85262db208..48d1e1606a 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/VendorSoftwareProductDao.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/VendorSoftwareProductDao.java
@@ -22,8 +22,12 @@ package org.openecomp.sdc.vendorsoftwareproduct.dao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentDependencyModelEntity;
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.ProcessEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
import org.openecomp.sdc.versioning.dao.VersionableDao;
import org.openecomp.sdc.versioning.dao.types.Version;
@@ -33,6 +37,7 @@ import java.util.List;
public interface VendorSoftwareProductDao extends VersionableDao {
+ //VspDetails getVendorSoftwareProductInfo(VspDetails vspDetails);
Collection<ComponentEntity> listComponents(String vspId, Version version);
@@ -77,4 +82,46 @@ public interface VendorSoftwareProductDao extends VersionableDao {
Collection<ComponentDependencyModelEntity> listComponentDependencies(String vspId,Version
version);
+ void createDeploymentFlavor(DeploymentFlavorEntity deploymentFlavor);
+
+ Collection<DeploymentFlavorEntity> listDeploymentFlavors(String vspId, Version version);
+
+ DeploymentFlavorEntity getDeploymentFlavor(String vspId, Version version, String
+ deploymentFlavorId);
+ void deleteDeploymentFlavor(String vspId, Version version, String deploymentFlavorId);
+
+
+ void createImage(ImageEntity imageEntity);
+
+ Collection<ImageEntity> listImages(String vspId, Version version, String componentId);
+
+ ImageEntity getImage(String vspId, Version version, String componentId, String imageId);
+
+ Collection<ImageEntity> listImagesByVsp(String vspId, Version version);
+
+ void createCompute(ComputeEntity computeEntity);
+
+ Collection<ComputeEntity> listComputes(String vspId, Version version, String componentId);
+
+ Collection<ComputeEntity> listComputesByVsp(String vspId, Version version);
+
+ ComputeEntity getCompute(String vspId, Version version, String componentId, String
+ computeFlavorId);
+
+ void deleteImage(String vspId, Version version, String componentId, String imageId);
+
+ void updateDeploymentFlavor(DeploymentFlavorEntity deploymentFlavorEntity);
+
+ void updateImage(ImageEntity imageEntity);
+
+ void updateImageQuestionnaire(String vspId, Version activeVersion, String componentId,
+ String imageId, String questionnaireData);
+
+ void updateComputeQuestionnaire(String vspId, Version activeVersion, String componentId,
+ String computeId, String questionnaireData);
+
+ void updateCompute(ComputeEntity compute);
+
+ void deleteCompute(String vspId, Version version, String componentId, String computeFlavorId);
+
}
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/dao/VendorSoftwareProductInfoDao.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/VendorSoftwareProductInfoDao.java
index ffb0d5eca7..0481829ebd 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/VendorSoftwareProductInfoDao.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/VendorSoftwareProductInfoDao.java
@@ -37,4 +37,6 @@ public interface VendorSoftwareProductInfoDao extends VersionableDao, BaseDao<Vs
VspQuestionnaireEntity getQuestionnaire(String vspId, Version version);
void deleteAll(String vspId, Version version);
+
+ boolean isManual(String vspId, Version version);
}
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/dao/type/ComponentEntity.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ComponentEntity.java
index 602fd6d15c..3e4f44328a 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ComponentEntity.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ComponentEntity.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -38,7 +38,7 @@ import java.util.List;
@Table(keyspace = "dox", name = "vsp_component")
public class ComponentEntity implements CompositionEntity {
- private static final String ENTITY_TYPE = "Vendor Software Product Component";
+ public static final String ENTITY_TYPE = "Vendor Software Product Component";
@PartitionKey
@Column(name = "vsp_id")
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/dao/type/MibEntity.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ComponentMonitoringUploadEntity.java
index f057c1745a..2517b9bfab 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/MibEntity.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ComponentMonitoringUploadEntity.java
@@ -25,7 +25,7 @@ import com.datastax.driver.mapping.annotations.Column;
import com.datastax.driver.mapping.annotations.Frozen;
import com.datastax.driver.mapping.annotations.PartitionKey;
import com.datastax.driver.mapping.annotations.Table;
-import org.openecomp.core.enrichment.types.ArtifactType;
+import org.openecomp.core.enrichment.types.MonitoringUploadType;
import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.sdc.versioning.dao.types.VersionableEntity;
@@ -33,7 +33,7 @@ import java.io.Serializable;
import java.nio.ByteBuffer;
@Table(keyspace = "dox", name = "vsp_component_artifact")
-public class MibEntity implements VersionableEntity, Serializable {
+public class ComponentMonitoringUploadEntity implements VersionableEntity, Serializable {
public static final String ENTITY_TYPE = "Vendor Software Product Component Artifact";
@PartitionKey
@Column(name = "vsp_id")
@@ -46,7 +46,7 @@ public class MibEntity implements VersionableEntity, Serializable {
private String componentId;
@ClusteringColumn(value = 1)
@Column(name = "artifact_type")
- private ArtifactType type;
+ private MonitoringUploadType type;
@ClusteringColumn(value = 2)
@Column(name = "artifact_id")
private String id;
@@ -54,7 +54,7 @@ public class MibEntity implements VersionableEntity, Serializable {
private String artifactName;
private ByteBuffer artifact;
- public MibEntity() {
+ public ComponentMonitoringUploadEntity() {
}
@@ -66,7 +66,8 @@ public class MibEntity implements VersionableEntity, Serializable {
* @param componentId the component id
* @param id the id
*/
- public MibEntity(String vspId, Version version, String componentId, String id) {
+ public ComponentMonitoringUploadEntity(String vspId, Version version, String componentId,
+ String id) {
this.vspId = vspId;
this.version = version;
this.componentId = componentId;
@@ -131,17 +132,17 @@ public class MibEntity implements VersionableEntity, Serializable {
this.artifact = artifact;
}
- public ArtifactType getType() {
+ public MonitoringUploadType getType() {
return type;
}
- public void setType(ArtifactType type) {
+ public void setType(MonitoringUploadType type) {
this.type = type;
}
@Override
public String toString() {
- return "MibEntity{" +
+ return "ComponentMonitoringUploadEntity{" +
"vspId='" + vspId + '\'' +
", version=" + version +
", componentId='" + componentId + '\'' +
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/dao/type/ComputeEntity.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ComputeEntity.java
new file mode 100644
index 0000000000..e16aad22ed
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ComputeEntity.java
@@ -0,0 +1,132 @@
+package org.openecomp.sdc.vendorsoftwareproduct.dao.type;
+
+import com.datastax.driver.mapping.annotations.ClusteringColumn;
+import com.datastax.driver.mapping.annotations.Column;
+import com.datastax.driver.mapping.annotations.Frozen;
+import com.datastax.driver.mapping.annotations.PartitionKey;
+import com.datastax.driver.mapping.annotations.Table;
+import org.openecomp.core.utilities.json.JsonUtil;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityId;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityType;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComputeData;
+import org.openecomp.sdc.versioning.dao.types.Version;
+
+@Table(keyspace = "dox", name = "vsp_component_compute")
+public class ComputeEntity implements CompositionEntity {
+ public static final String ENTITY_TYPE = "Vendor Software Product Component Compute Flavor";
+
+ @PartitionKey
+ @Column(name = "vsp_id")
+ private String vspId;
+ @PartitionKey(value = 1)
+ @Frozen
+ private Version version;
+ @ClusteringColumn
+ @Column(name = "component_id")
+ private String componentId;
+ @ClusteringColumn(value = 1)
+ @Column(name = "compute_id")
+ private String id;
+ @Column(name = "composition_data")
+ private String compositionData;
+ @Column(name = "questionnaire_data")
+ private String questionnaireData;
+
+ public ComputeEntity(String vspId, Version version, String componentId, String id) {
+ this.vspId = vspId;
+ this.version = version;
+ this.componentId = componentId;
+ this.id = id;
+ }
+
+ public ComputeEntity() {
+ }
+
+ @Override
+ public String getEntityType() {
+ return ENTITY_TYPE;
+ }
+
+ @Override
+ public String getFirstClassCitizenId() {
+ return getVspId();
+ }
+
+ @Override
+ public String getId() {
+ return id;
+ }
+
+ @Override
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ @Override
+ public Version getVersion() {
+ return version;
+ }
+
+ @Override
+ public void setVersion(Version version) {
+ this.version = version;
+ }
+
+ @Override
+ public CompositionEntityType getType() {
+ return CompositionEntityType.compute;
+ }
+
+ @Override
+ public CompositionEntityId getCompositionEntityId() {
+ return new CompositionEntityId(getId(),
+ new CompositionEntityId(getComponentId(), new CompositionEntityId(getVspId(), null)));
+ }
+
+ @Override
+ public String getCompositionData() {
+ return compositionData;
+ }
+
+ @Override
+ public void setCompositionData(String compositionData) {
+ this.compositionData = compositionData;
+ }
+
+ @Override
+ public String getQuestionnaireData() {
+ return questionnaireData;
+ }
+
+ @Override
+ public void setQuestionnaireData(String questionnaireData) {
+ this.questionnaireData = questionnaireData;
+ }
+
+ public String getVspId() {
+ return vspId;
+ }
+
+ public void setVspId(String vspId) {
+ this.vspId = vspId;
+ }
+
+ public String getComponentId() {
+ return componentId;
+ }
+
+ public void setComponentId(String componentId) {
+ this.componentId = componentId;
+ }
+
+ public ComputeData getComputeCompositionData() {
+ return compositionData == null ? null
+ : JsonUtil.json2Object(compositionData, ComputeData.class);
+ }
+
+ public void setComputeCompositionData(ComputeData computeData){
+ this.compositionData = computeData == null ? null : JsonUtil.object2Json(computeData);
+ }
+
+
+}
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/dao/type/DeploymentFlavorEntity.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/DeploymentFlavorEntity.java
new file mode 100644
index 0000000000..b20e11077f
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/DeploymentFlavorEntity.java
@@ -0,0 +1,159 @@
+package org.openecomp.sdc.vendorsoftwareproduct.dao.type;
+
+import com.datastax.driver.mapping.annotations.*;
+import org.openecomp.core.utilities.json.JsonUtil;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityId;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityType;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.DeploymentFlavor;
+import org.openecomp.sdc.versioning.dao.types.Version;
+
+@Table(keyspace = "dox", name = "vsp_deployment_flavor")
+public class DeploymentFlavorEntity implements CompositionEntity{
+ private static final String ENTITY_TYPE = "Vendor Software Product Deployment Flavor";
+
+ @PartitionKey
+ @Column(name = "vsp_id")
+ private String vspId;
+ @PartitionKey(value = 1)
+ @Frozen
+ private Version version;
+ @ClusteringColumn
+ @Column(name = "deployment_flavor_id")
+ private String id;
+ @Column(name = "composition_data")
+ private String compositionData;
+ @Column(name = "questionnaire_data")
+ private String questionnaireData;
+
+
+ public DeploymentFlavorEntity(){
+
+ }
+
+ /**
+ * Instantiates a new DeploymentFlavor entity.
+ *
+ * @param vspId the vsp id
+ * @param version the version
+ * @param id the id
+ */
+ public DeploymentFlavorEntity(String vspId, Version version, String id) {
+ this.vspId = vspId;
+ this.version = version;
+ this.id = id;
+ }
+ @Override
+ public CompositionEntityType getType() {
+ return CompositionEntityType.deployment;
+ }
+
+ @Override
+ public CompositionEntityId getCompositionEntityId() {
+ return new CompositionEntityId(getId(), new CompositionEntityId(getVspId(), null));
+ }
+
+ @Override
+ public String getCompositionData() {
+ return compositionData;
+ }
+
+ @Override
+ public void setCompositionData(String compositionData) {
+ this.compositionData = compositionData;
+ }
+
+ @Override
+ public String getQuestionnaireData() {
+ return questionnaireData;
+ }
+
+ @Override
+ public void setQuestionnaireData(String questionnaireData) {
+ this.questionnaireData = questionnaireData;
+ }
+
+ public String getVspId() {
+ return vspId;
+ }
+
+ public void setVspId(String vspId) {
+ this.vspId = vspId;
+ }
+
+ @Override
+ public String getEntityType() {
+ return ENTITY_TYPE;
+ }
+
+ @Override
+ public String getFirstClassCitizenId() {
+ return getVspId();
+ }
+
+ @Override
+ public String getId() {
+ return id;
+ }
+
+ @Override
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ @Override
+ public Version getVersion() {
+ return version;
+ }
+
+ @Override
+ public void setVersion(Version version) {
+ this.version = version;
+ }
+
+ public DeploymentFlavor getDeploymentFlavorCompositionData() {
+ return compositionData == null ? null : JsonUtil.json2Object(compositionData, DeploymentFlavor.class);
+ }
+
+ public void setDeploymentFlavorCompositionData(DeploymentFlavor deploymentFlavor) {
+ this.compositionData = deploymentFlavor == null ? null : JsonUtil.object2Json(deploymentFlavor);
+ }
+
+ @Override
+ public int hashCode() {
+ int result = vspId != null ? vspId.hashCode() : 0;
+ result = 31 * result + (version != null ? version.hashCode() : 0);
+ result = 31 * result + (id != null ? id.hashCode() : 0);
+ result = 31 * result + (compositionData != null ? compositionData.hashCode() : 0);
+ result = 31 * result + (questionnaireData != null ? questionnaireData.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object == null || getClass() != object.getClass()) {
+ return false;
+ }
+
+ DeploymentFlavorEntity that = (DeploymentFlavorEntity) object;
+
+ if (vspId != null ? !vspId.equals(that.vspId) : that.vspId != null) {
+ return false;
+ }
+ if (version != null ? !version.equals(that.version) : that.version != null) {
+ return false;
+ }
+ if (id != null ? !id.equals(that.id) : that.id != null) {
+ return false;
+ }
+ if (compositionData != null ? !compositionData.equals(that.compositionData)
+ : that.compositionData != null) {
+ return false;
+ }
+ return questionnaireData != null ? questionnaireData.equals(that.questionnaireData)
+ : that.questionnaireData == null;
+
+ }
+} \ 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/dao/type/ImageEntity.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ImageEntity.java
new file mode 100644
index 0000000000..4950229486
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ImageEntity.java
@@ -0,0 +1,175 @@
+package org.openecomp.sdc.vendorsoftwareproduct.dao.type;
+
+import com.datastax.driver.mapping.annotations.ClusteringColumn;
+import com.datastax.driver.mapping.annotations.Column;
+import com.datastax.driver.mapping.annotations.Frozen;
+import com.datastax.driver.mapping.annotations.PartitionKey;
+import com.datastax.driver.mapping.annotations.Table;
+import org.openecomp.core.utilities.json.JsonUtil;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityId;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityType;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Image;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic;
+import org.openecomp.sdc.versioning.dao.types.Version;
+
+@Table(keyspace = "dox", name = "vsp_component_image")
+public class ImageEntity implements CompositionEntity {
+
+ private static final String ENTITY_TYPE = "Vendor Software Product Component Image";
+
+ @PartitionKey
+ @Column(name = "vsp_id")
+ private String vspId;
+ @PartitionKey(value = 1)
+ @Frozen
+ private Version version;
+ @ClusteringColumn
+ @Column(name = "component_id")
+ private String componentId;
+ @ClusteringColumn(value = 1)
+ @Column(name = "image_id")
+ private String id;
+ @Column(name = "composition_data")
+ private String compositionData;
+ @Column(name = "questionnaire_data")
+ private String questionnaireData;
+
+
+ public ImageEntity() {
+ }
+
+ /**
+ * Instantiates a new Image entity.
+ *
+ * @param vspId the vsp id
+ * @param version the version
+ * @param id the id
+ */
+ public ImageEntity(String vspId, Version version, String componentId, String id) {
+ this.vspId = vspId;
+ this.version = version;
+ this.componentId = componentId;
+ this.id = id;
+ }
+
+ public String getVspId() {
+ return vspId;
+ }
+
+ public void setVspId(String vspId) {
+ this.vspId = vspId;
+ }
+
+ public Version getVersion() {
+ return version;
+ }
+
+ public void setVersion(Version version) {
+ this.version = version;
+ }
+
+ public String getComponentId() {
+ return componentId;
+ }
+
+ public void setComponentId(String componentId) {
+ this.componentId = componentId;
+ }
+
+ @Override
+ public String getEntityType() {
+ return ENTITY_TYPE;
+ }
+
+ @Override
+ public String getFirstClassCitizenId() {
+ return getVspId();
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getQuestionnaireData() {
+ return questionnaireData;
+ }
+
+ public void setQuestionnaireData(String questionnaireData) {
+ this.questionnaireData = questionnaireData;
+ }
+
+ @Override
+ public CompositionEntityType getType() {
+ return CompositionEntityType.image;
+ }
+
+ @Override
+ public CompositionEntityId getCompositionEntityId() {
+ return new CompositionEntityId(getId(),
+ new CompositionEntityId(getComponentId(), new CompositionEntityId(getVspId(), null)));
+ }
+
+ public String getCompositionData() {
+ return compositionData;
+ }
+
+ public void setCompositionData(String compositionData) {
+ this.compositionData = compositionData;
+ }
+
+ public Image getImageCompositionData() {
+ return compositionData == null ? null : JsonUtil.json2Object(compositionData, Image.class);
+ }
+
+ public void setImageCompositionData(Image image) {
+ this.compositionData = image == null ? null : JsonUtil.object2Json(image);
+ }
+
+ @Override
+ public int hashCode() {
+ int result = vspId != null ? vspId.hashCode() : 0;
+ result = 31 * result + (version != null ? version.hashCode() : 0);
+ result = 31 * result + (componentId != null ? componentId.hashCode() : 0);
+ result = 31 * result + (id != null ? id.hashCode() : 0);
+ result = 31 * result + (compositionData != null ? compositionData.hashCode() : 0);
+ result = 31 * result + (questionnaireData != null ? questionnaireData.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object == null || getClass() != object.getClass()) {
+ return false;
+ }
+
+ ImageEntity imageEntity = (ImageEntity) object;
+
+ if (vspId != null ? !vspId.equals(imageEntity.vspId) : imageEntity.vspId != null) {
+ return false;
+ }
+ if (version != null ? !version.equals(imageEntity.version) : imageEntity.version != null) {
+ return false;
+ }
+ if (componentId != null ? !componentId.equals(imageEntity.componentId)
+ : imageEntity.componentId != null) {
+ return false;
+ }
+ if (id != null ? !id.equals(imageEntity.id) : imageEntity.id != null) {
+ return false;
+ }
+ if (compositionData != null ? !compositionData.equals(imageEntity.compositionData)
+ : imageEntity.compositionData != null) {
+ return false;
+ }
+ return questionnaireData != null ? questionnaireData.equals(imageEntity.questionnaireData)
+ : imageEntity.questionnaireData == null;
+
+ }
+}
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/dao/type/NicEntity.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/NicEntity.java
index 656693c14d..a954ada570 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/NicEntity.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/NicEntity.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
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/dao/type/VspDetails.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/VspDetails.java
index 0019bce477..2758e3dfe9 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/VspDetails.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/VspDetails.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -60,6 +60,7 @@ public class VspDetails implements VersionableEntity {
private Long writetimeMicroSeconds;
+ private String onboardingMethod;
public VspDetails() {
}
@@ -214,6 +215,12 @@ public class VspDetails implements VersionableEntity {
this.oldVersion = oldVersion;
}
+ public String getOnboardingMethod() {
+ return onboardingMethod;
+ }
+ public void setOnboardingMethod(String onboardingMethod) {
+ this.onboardingMethod = onboardingMethod;
+ }
@Override
public String toString() {
return String.format(
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 5bde801188..6c636fddf0 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
@@ -22,6 +22,9 @@ package org.openecomp.sdc.vendorsoftwareproduct.services.composition;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.CompositionEntity;
+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.NetworkEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Component;
@@ -74,4 +77,17 @@ public interface CompositionEntityDataManager {
NicEntity createNic(NicEntity nic);
+ public ComputeEntity createCompute(ComputeEntity compute);
+
+ public DeploymentFlavorEntity createDeploymentFlavor(DeploymentFlavorEntity deploymentFlavor);
+
+ public ImageEntity createImage(ImageEntity image);
+
+ public void saveComputesFlavorByComponent(String vspId, Version version, Component component, String
+ 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-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/HeatFileAnalyzerRowDataImpl.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/impl/HeatFileAnalyzerRowDataImpl.java
index d26942219f..f7ca6463cb 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/impl/HeatFileAnalyzerRowDataImpl.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/impl/HeatFileAnalyzerRowDataImpl.java
@@ -108,6 +108,9 @@ public class HeatFileAnalyzerRowDataImpl implements HeatFileAnalyzer {
}
analyzedZipHeatFiles.addNestedFiles(fetchFileNamesToReturn(nestedFilesNames,
foundHeatIdentifier));
+ if (Objects.nonNull(bfReader)) {
+ bfReader.close();
+ }
}
}
return analyzedZipHeatFiles;
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/types/composition/Component.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/Component.java
index b112ee2216..1e30144be3 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/Component.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/Component.java
@@ -25,6 +25,8 @@ import java.util.List;
public class Component {
private ComponentData data;
private List<Nic> nics;
+ private List<Image> images;
+ private List<ComputeData> compute;
public ComponentData getData() {
return data;
@@ -41,4 +43,21 @@ public class Component {
public void setNics(List<Nic> nics) {
this.nics = nics;
}
+
+ public List<Image> getImages() {
+ return images;
+ }
+
+ public void setImages(List<Image> images) {
+ this.images = images;
+ }
+
+ public List<ComputeData> getCompute() {
+ return compute;
+ }
+
+ public void setCompute(
+ List<ComputeData> compute) {
+ this.compute = compute;
+ }
}
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/types/composition/ComponentComputeAssociation.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ComponentComputeAssociation.java
new file mode 100644
index 0000000000..35e9bad9bd
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ComponentComputeAssociation.java
@@ -0,0 +1,22 @@
+package org.openecomp.sdc.vendorsoftwareproduct.types.composition;
+
+
+public class ComponentComputeAssociation {
+ private String componentId;
+ private String computeFlavorId;
+
+ public String getComponentId() {
+ return componentId;
+ }
+ public void setComponentId(String componentId) {
+ this.componentId = componentId;
+ }
+ public String getComputeFlavorId() {
+ return computeFlavorId;
+ }
+
+ public void setComputeFlavorId(String computeFlavorId) {
+ this.computeFlavorId = computeFlavorId;
+ }
+
+}
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/types/composition/ComponentData.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ComponentData.java
index 28d187ec69..ba06d42fea 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ComponentData.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ComponentData.java
@@ -25,6 +25,8 @@ public class ComponentData implements CompositionDataEntity {
private String description;
private String displayName;
private String vfcCode;
+ private String nfcCode;
+ private String nfcFunction;
public String getName() {
return name;
@@ -50,6 +52,22 @@ public class ComponentData implements CompositionDataEntity {
this.displayName = displayName;
}
+ public String getNfcCode() {
+ return nfcCode;
+ }
+
+ public void setNfcCode(String nfcCode) {
+ this.nfcCode = nfcCode;
+ }
+
+ public String getNfcFunction() {
+ return nfcFunction;
+ }
+
+ public void setNfcFunction(String nfcFunction) {
+ this.nfcFunction = nfcFunction;
+ }
+
@Override
public int hashCode() {
int result = name.hashCode();
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/types/composition/CompositionEntityType.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/CompositionEntityType.java
index 4695210de5..2b1ea16889 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/CompositionEntityType.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/CompositionEntityType.java
@@ -25,5 +25,8 @@ public enum CompositionEntityType {
vsp,
network,
component,
- nic
+ deployment,
+ image,
+ nic,
+ compute
}
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/types/composition/ComputeData.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ComputeData.java
new file mode 100644
index 0000000000..20ae5438de
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ComputeData.java
@@ -0,0 +1,52 @@
+package org.openecomp.sdc.vendorsoftwareproduct.types.composition;
+
+public class ComputeData implements CompositionDataEntity {
+ private String name;
+ private String description;
+
+ public ComputeData(){}
+
+ public ComputeData(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = name.hashCode();
+ result = 31 * result + (description != null ? description.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (!(object instanceof ComputeData)) {
+ return false;
+ }
+
+ ComputeData that = (ComputeData) object;
+
+ if (!name.equals(that.name)) {
+ return false;
+ }
+ return description != null ? description.equals(that.description): that.description == null;
+ }
+}
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/types/composition/DeploymentFlavor.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/DeploymentFlavor.java
new file mode 100644
index 0000000000..1c84db3cf8
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/DeploymentFlavor.java
@@ -0,0 +1,44 @@
+package org.openecomp.sdc.vendorsoftwareproduct.types.composition;
+
+
+import java.util.List;
+
+public class DeploymentFlavor implements CompositionDataEntity {
+ private String model;
+ private String description;
+ private String featureGroupId;
+ private List<ComponentComputeAssociation> componentComputeAssociations;
+
+ public String getModel() {
+ return model;
+ }
+
+ public void setModel(String model) {
+ this.model = model;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getFeatureGroupId() {
+ return featureGroupId;
+ }
+
+ public void setFeatureGroupId(String featureGroupId) {
+ this.featureGroupId = featureGroupId;
+ }
+
+ public List<ComponentComputeAssociation> getComponentComputeAssociations() {
+ return componentComputeAssociations;
+ }
+
+ public void setComponentComputeAssociations(List<ComponentComputeAssociation> componentComputeAssociations) {
+ this.componentComputeAssociations = componentComputeAssociations;
+ }
+
+}
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/types/composition/ExtractCompositionDataContext.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ExtractCompositionDataContext.java
index 6736512cee..3fce395f44 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ExtractCompositionDataContext.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ExtractCompositionDataContext.java
@@ -20,10 +20,6 @@
package org.openecomp.sdc.vendorsoftwareproduct.types.composition;
-import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Component;
-import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Network;
-import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic;
-
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@@ -35,6 +31,8 @@ public class ExtractCompositionDataContext {
private List<Network> networks = new ArrayList<>();
private List<Component> components = new ArrayList<>();
private Map<String, Nic> nics = new HashMap<>();
+ private Map<String, Image> images = new HashMap<>();
+ private Map<String, ComputeData> computes = new HashMap<>();
private Set<String> handledServiceTemplates = new HashSet<>();
private Set<String> createdComponents = new HashSet<>();
@@ -130,5 +128,29 @@ public class ExtractCompositionDataContext {
this.nics.put(nicId, nic);
}
+ public Map<String, Image> getImages() {
+ return images;
+ }
+
+ public void setImages(Map<String, Image> images) {
+ this.images = images;
+ }
+
+ public void addImage(String imageId, Image image) {
+ this.images.put(imageId, image);
+ }
+
+
+ public Map<String, ComputeData> getComputes() {
+ return computes;
+ }
+
+ public void setComputes(
+ Map<String, ComputeData> computes) {
+ this.computes = computes;
+ }
+ public void addCompute(String computeId, ComputeData computedata ){
+ this.computes.put(computeId,computedata);
+ }
}
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/types/composition/Image.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/Image.java
new file mode 100644
index 0000000000..d35501c7d1
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/Image.java
@@ -0,0 +1,68 @@
+package org.openecomp.sdc.vendorsoftwareproduct.types.composition;
+
+
+public class Image implements CompositionDataEntity {
+
+ private String fileName;
+ private String description;
+ /*private String version;
+ private String format;
+ private String md5;
+ //private String providedBy;*/
+
+ public Image(){
+ }
+
+ public Image(String fileName){
+ this.fileName=fileName;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /*public String getMd5() {
+ return md5;
+ }
+
+ public void setMd5(String md5) {
+ this.md5 = md5;
+ }
+
+ public String getFormat() {
+ return format;
+ }
+
+ public void setFormat(String format) {
+ this.format = format;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }*/
+
+ public String getFileName() {
+ return fileName;
+ }
+
+ public void setFileName(String fileName) {
+ this.fileName = fileName;
+ }
+
+ /*public String getProvidedBy() {
+ return providedBy;
+ }
+
+ public void setProvidedBy(String providedBy) {
+ this.providedBy = providedBy;
+ }*/
+
+}
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/types/composition/ImageData.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ImageData.java
new file mode 100644
index 0000000000..beb60f8767
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ImageData.java
@@ -0,0 +1,32 @@
+package org.openecomp.sdc.vendorsoftwareproduct.types.composition;
+
+public class ImageData implements CompositionDataEntity {
+
+ private String fileName;
+ private String description;
+
+ public ImageData(){
+
+ }
+
+ public ImageData(String fileName, String description) {
+ this.fileName = fileName;
+ this.description = description;
+ }
+
+ public String getFileName() {
+ return fileName;
+ }
+
+ public void setFileName(String fileName) {
+ this.fileName = fileName;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+}
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/types/composition/ImageFormat.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ImageFormat.java
new file mode 100644
index 0000000000..6e408170cd
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ImageFormat.java
@@ -0,0 +1,13 @@
+package org.openecomp.sdc.vendorsoftwareproduct.types.composition;
+
+public enum ImageFormat {
+ aki,
+ ami,
+ ari,
+ iso,
+ qcow2,
+ raw,
+ vdi,
+ vhd,
+ vmdk
+}
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/types/composition/Nic.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/Nic.java
index 24832951a8..f7c3911772 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/Nic.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/Nic.java
@@ -20,12 +20,14 @@
package org.openecomp.sdc.vendorsoftwareproduct.types.composition;
+
public class Nic implements CompositionDataEntity {
private String name;
private String description;
private String networkId;
private String networkName;
private NetworkType networkType;
+ private String networkDescription;
public String getName() {
return name;
@@ -67,12 +69,21 @@ public class Nic implements CompositionDataEntity {
this.networkType = networkType;
}
+ public String getNetworkDescription(){
+ return networkDescription;
+ }
+
+ public void setNetworkDescription(String networkDescription){
+ this.networkDescription=networkDescription;
+ }
+
@Override
public int hashCode() {
int result = name != null ? name.hashCode() : 0;
result = 31 * result + (description != null ? description.hashCode() : 0);
result = 31 * result + (networkId != null ? networkId.hashCode() : 0);
result = 31 * result + (networkType != null ? networkType.hashCode() : 0);
+ result = 31 * result + (networkDescription != null ? networkDescription.hashCode() : 0);
return result;
}
@@ -96,6 +107,12 @@ public class Nic implements CompositionDataEntity {
if (networkId != null ? !networkId.equals(nic.networkId) : nic.networkId != null) {
return false;
}
+ if (networkType != null ? !networkType.equals(nic.networkType) : nic.networkType != null) {
+ return false;
+ }
+ if (networkDescription != null ? !networkDescription.equals(nic.networkDescription) : nic.networkDescription != null) {
+ return false;
+ }
return networkType == nic.networkType;
}
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/types/composition/VmSizing.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/VmSizing.java
new file mode 100644
index 0000000000..b28469fcd4
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/VmSizing.java
@@ -0,0 +1,58 @@
+package org.openecomp.sdc.vendorsoftwareproduct.types.composition;
+
+public class VmSizing {
+ private int numOfCPUs;
+ private int fileSystemSizeGB;
+ private int persistentStorageVolumeSize;
+ private int ioOperationsPerSec;
+ private String cpuOverSubscriptionRatio;
+ private String memoryRAM;
+
+ public int getNumOfCPUs() {
+ return numOfCPUs;
+ }
+
+ public void setNumOfCPUs(int numOfCPUs) {
+ this.numOfCPUs = numOfCPUs;
+ }
+
+ public int getFileSystemSizeGB() {
+ return fileSystemSizeGB;
+ }
+
+ public void setFileSystemSizeGB(int fileSystemSizeGB) {
+ this.fileSystemSizeGB = fileSystemSizeGB;
+ }
+
+ public int getPersistentStorageVolumeSize() {
+ return persistentStorageVolumeSize;
+ }
+
+ public void setPersistentStorageVolumeSize(int persistentStorageVolumeSize) {
+ this.persistentStorageVolumeSize = persistentStorageVolumeSize;
+ }
+
+ public int getIoOperationsPerSec() {
+ return ioOperationsPerSec;
+ }
+
+ public void setIoOperationsPerSec(int ioOperationsPerSec) {
+ this.ioOperationsPerSec = ioOperationsPerSec;
+ }
+
+ public String getCpuOverSubscriptionRatio() {
+ return cpuOverSubscriptionRatio;
+ }
+
+ public void setCpuOverSubscriptionRatio(String cpuOverSubscriptionRatio) {
+ this.cpuOverSubscriptionRatio = cpuOverSubscriptionRatio;
+ }
+
+ public String getMemoryRAM() {
+ return memoryRAM;
+ }
+
+ public void setMemoryRAM(String memoryRAM) {
+ this.memoryRAM = memoryRAM;
+ }
+}
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/types/questionnaire/component/compute/VmSizing.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/questionnaire/component/compute/VmSizing.java
index 2ae7f48f33..fb4aaa61f1 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/questionnaire/component/compute/VmSizing.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/questionnaire/component/compute/VmSizing.java
@@ -20,14 +20,13 @@
package org.openecomp.sdc.vendorsoftwareproduct.types.questionnaire.component.compute;
-/**
- * Created by TALIO on 11/22/2016.
- */
public class VmSizing {
private int numOfCPUs;
- private int fileSystemSizeGB;
+ private String fileSystemSizeGB;
private int persistentStorageVolumeSize;
private int IOOperationsPerSec;
+ private String cpuOverSubscriptionRatio;
+ private String memoryRAM;
public int getNumOfCPUs() {
return numOfCPUs;
@@ -37,11 +36,11 @@ public class VmSizing {
this.numOfCPUs = numOfCPUs;
}
- public int getFileSystemSizeGB() {
+ public String getFileSystemSizeGB() {
return fileSystemSizeGB;
}
- public void setFileSystemSizeGB(int fileSystemSizeGB) {
+ public void setFileSystemSizeGB(String fileSystemSizeGB) {
this.fileSystemSizeGB = fileSystemSizeGB;
}
@@ -60,4 +59,20 @@ public class VmSizing {
public void setIOOperationsPerSec(int IOOperationsPerSec) {
this.IOOperationsPerSec = IOOperationsPerSec;
}
+
+ public String getCpuOverSubscriptionRatio() {
+ return cpuOverSubscriptionRatio;
+ }
+
+ public void setCpuOverSubscriptionRatio(String cpuOverSubscriptionRatio) {
+ this.cpuOverSubscriptionRatio = cpuOverSubscriptionRatio;
+ }
+
+ public String getMemoryRAM() {
+ return memoryRAM;
+ }
+
+ public void setMemoryRAM(String memoryRAM) {
+ this.memoryRAM = memoryRAM;
+ }
}
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/types/questionnaire/component/image/ImageDetails.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/questionnaire/component/image/ImageDetails.java
new file mode 100644
index 0000000000..d051370add
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/questionnaire/component/image/ImageDetails.java
@@ -0,0 +1,33 @@
+package org.openecomp.sdc.vendorsoftwareproduct.types.questionnaire.component.image;
+
+
+public class ImageDetails {
+
+ private String version;
+ private String format;
+ private String md5;
+
+ public String getMd5() {
+ return md5;
+ }
+
+ public void setMd5(String md5) {
+ this.md5 = md5;
+ }
+
+ public String getFormat() {
+ return format;
+ }
+
+ public void setFormat(String format) {
+ this.format = format;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+}
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/types/schemagenerator/ComputeCompositionSchemaInput.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/schemagenerator/ComputeCompositionSchemaInput.java
new file mode 100644
index 0000000000..4988ec92bf
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/schemagenerator/ComputeCompositionSchemaInput.java
@@ -0,0 +1,25 @@
+package org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator;
+
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComputeData;
+
+public class ComputeCompositionSchemaInput implements SchemaTemplateInput {
+
+ private boolean manual;
+ private ComputeData compute;
+
+ public boolean isManual() {
+ return manual;
+ }
+
+ public void setManual(boolean manual) {
+ this.manual = manual;
+ }
+
+ public ComputeData getCompute() {
+ return compute;
+ }
+
+ public void setCompute(ComputeData compute) {
+ this.compute = compute;
+ }
+}
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/types/schemagenerator/DeploymentFlavorCompositionSchemaInput.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/schemagenerator/DeploymentFlavorCompositionSchemaInput.java
new file mode 100644
index 0000000000..a82685e68a
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/schemagenerator/DeploymentFlavorCompositionSchemaInput.java
@@ -0,0 +1,39 @@
+package org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator;
+
+
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.DeploymentFlavor;
+
+import java.util.Collection;
+
+public class DeploymentFlavorCompositionSchemaInput implements SchemaTemplateInput {
+
+ private boolean manual;
+ private DeploymentFlavor deploymentFlavor;
+ private Collection<String> featureGroupIds;
+
+ public boolean isManual() {
+ return manual;
+ }
+
+ public void setManual(boolean manual) {
+ this.manual = manual;
+ }
+
+ public DeploymentFlavor getDeploymentFlavor() {
+ return deploymentFlavor;
+ }
+
+ public void setDeploymentFlavor(
+ DeploymentFlavor deploymentFlavor) {
+ this.deploymentFlavor = deploymentFlavor;
+ }
+
+ public Collection<String> getFeatureGroupIds() {
+ return featureGroupIds;
+ }
+
+ public void setFeatureGroupIds(Collection<String> featureGroupIds) {
+ this.featureGroupIds = featureGroupIds;
+ }
+
+}
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/types/schemagenerator/ImageCompositionSchemaInput.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/schemagenerator/ImageCompositionSchemaInput.java
new file mode 100644
index 0000000000..add08a7020
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/schemagenerator/ImageCompositionSchemaInput.java
@@ -0,0 +1,18 @@
+package org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator;
+
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Image;
+
+public class ImageCompositionSchemaInput implements SchemaTemplateInput {
+
+ public Image getImage() {
+ return image;
+ }
+
+ public void setImage(Image image) {
+ this.image = image;
+ }
+
+ private Image image;
+
+
+}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/resources/factoryConfiguration.json b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/resources/factoryConfiguration.json
index 85177c42c1..52c6119ae6 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/resources/factoryConfiguration.json
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/resources/factoryConfiguration.json
@@ -8,16 +8,19 @@
"org.openecomp.sdc.vendorsoftwareproduct.dao.PackageInfoDaoFactory": "org.openecomp.sdc.vendorsoftwareproduct.dao.impl.PackageInfoDaoFactoryImpl",
"org.openecomp.sdc.vendorsoftwareproduct.dao.NetworkDaoFactory": "org.openecomp.sdc.vendorsoftwareproduct.dao.impl.NetworkDaoFactoryImpl",
"org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDaoFactory": "org.openecomp.sdc.vendorsoftwareproduct.dao.impl.ComponentDaoFactoryImpl",
- "org.openecomp.sdc.vendorsoftwareproduct.dao.MibDaoFactory": "org.openecomp.sdc.vendorsoftwareproduct.dao.impl.MibDaoFactoryImpl",
+ "org.openecomp.sdc.vendorsoftwareproduct.dao.MonitoringUploadDaoFactory": "org.openecomp.sdc.vendorsoftwareproduct.dao.impl.MonitoringUploadDaoFactoryImpl",
"org.openecomp.sdc.vendorsoftwareproduct.dao.NicDaoFactory": "org.openecomp.sdc.vendorsoftwareproduct.dao.impl.NicDaoFactoryImpl",
"org.openecomp.sdc.vendorsoftwareproduct.dao.VspQuestionnaireDaoFactory": "org.openecomp.sdc.vendorsoftwareproduct.dao.impl.VspQuestionnaireDaoFactoryImpl",
"org.openecomp.sdc.vendorsoftwareproduct.dao.ProcessDaoFactory": "org.openecomp.sdc.vendorsoftwareproduct.dao.impl.ProcessDaoFactoryImpl",
"org.openecomp.sdc.vendorsoftwareproduct.dao.ProcessArtifactDaoFactory": "org.openecomp.sdc.vendorsoftwareproduct.dao.impl.ProcessArtifactDaoFactoryImpl",
+ "org.openecomp.sdc.vendorsoftwareproduct.dao.ImageDaoFactory": "org.openecomp.sdc.vendorsoftwareproduct.dao.impl.ImageDaoFactoryImpl",
"org.openecomp.sdc.vendorsoftwareproduct.factory.QuestionnnaireDataServiceFactory": "org.openecomp.sdc.vendorsoftwareproduct.factory.QuestionnaireDataServiceFactoryImpl",
"org.openecomp.sdc.vendorsoftwareproduct.factory.InformationArtifactGeneratorFactory":"org.openecomp.sdc.vendorsoftwareproduct.factory.InformationArtifactGeneratorFactoryImpl",
"org.openecomp.sdc.vendorsoftwareproduct.factory.CandidateServiceFactory": "org.openecomp.sdc.vendorsoftwareproduct.factory.impl.CandidateServiceFactoryImpl",
"org.openecomp.sdc.vendorsoftwareproduct.factory.CompositionDataExtractorFactory": "org.openecomp.sdc.vendorsoftwareproduct.factory.impl.CompositionDataExtractorFactoryImpl",
"org.openecomp.sdc.vendorsoftwareproduct.factory.CompositionEntityDataManagerFactory": "org.openecomp.sdc.vendorsoftwareproduct.factory.impl.CompositionEntityDataManagerFactoryImpl",
"org.openecomp.sdc.vendorsoftwareproduct.factory.ManifestCreatorFactory": "org.openecomp.sdc.vendorsoftwareproduct.factory.impl.ManifestCreatorFactoryImpl",
+ "org.openecomp.sdc.vendorsoftwareproduct.dao.DeploymentFlavorDaoFactory": "org.openecomp.sdc.vendorsoftwareproduct.dao.impl.DeploymentFlavorDaoFactoryImpl",
+ "org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDaoFactory": "org.openecomp.sdc.vendorsoftwareproduct.dao.impl.ComputeDaoFactoryImpl",
"org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDependencyModelDaoFactory": "org.openecomp.sdc.vendorsoftwareproduct.dao.impl.ComponentDependencyModelDaoFactoryImpl"
} \ No newline at end of file
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 1d6530b455..343f4aef62 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
@@ -14,6 +14,11 @@
<dependencies>
<dependency>
+ <groupId>org.openecomp.sdc.common</groupId>
+ <artifactId>openecomp-tosca-datatype</artifactId>
+ <version>${openecomp.sdc.common.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.openecomp.sdc</groupId>
<artifactId>openecomp-sdc-vendor-software-product-api</artifactId>
<version>${project.version}</version>
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
new file mode 100644
index 0000000000..634e0874ac
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/pom.xml.versionsBackup
@@ -0,0 +1,108 @@
+<?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/dao/impl/ComputeDaoCassandraImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComputeDaoCassandraImpl.java
new file mode 100644
index 0000000000..ba878c661e
--- /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/dao/impl/ComputeDaoCassandraImpl.java
@@ -0,0 +1,120 @@
+package org.openecomp.sdc.vendorsoftwareproduct.dao.impl;
+
+import com.datastax.driver.core.ResultSet;
+import com.datastax.driver.core.UDTValue;
+import com.datastax.driver.mapping.Mapper;
+import com.datastax.driver.mapping.Result;
+import com.datastax.driver.mapping.UDTMapper;
+import com.datastax.driver.mapping.annotations.Accessor;
+import com.datastax.driver.mapping.annotations.Query;
+import org.openecomp.core.dao.impl.CassandraBaseDao;
+import org.openecomp.core.nosqldb.api.NoSqlDb;
+import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComputeEntity;
+import org.openecomp.sdc.versioning.VersioningManagerFactory;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdc.versioning.types.UniqueValueMetadata;
+import org.openecomp.sdc.versioning.types.VersionableEntityMetadata;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+
+public class ComputeDaoCassandraImpl extends CassandraBaseDao<ComputeEntity> implements
+ ComputeDao {
+
+ private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
+ private static final Mapper<ComputeEntity> mapper =
+ noSqlDb.getMappingManager().mapper(ComputeEntity.class);
+ private static final ComputeAccessor accessor =
+ noSqlDb.getMappingManager().createAccessor(ComputeDaoCassandraImpl.ComputeAccessor.class);
+ private static final UDTMapper<Version> versionMapper =
+ noSqlDb.getMappingManager().udtMapper(Version.class);
+
+ @Override
+ public void registerVersioning(String versionableEntityType) {
+ VersionableEntityMetadata metadata = new VersionableEntityMetadata(
+ mapper.getTableMetadata().getName(),
+ mapper.getTableMetadata().getPartitionKey().get(0).getName(),
+ mapper.getTableMetadata().getPartitionKey().get(1).getName());
+
+
+ metadata.setUniqueValuesMetadata(Collections.singletonList(new UniqueValueMetadata(
+ VendorSoftwareProductConstants.UniqueValues.COMPUTE_NAME,
+ Arrays.asList("vsp_id", "version", "component_id", "name"))));
+
+ VersioningManagerFactory.getInstance().createInterface()
+ .register(versionableEntityType, metadata);
+ }
+
+ @Override
+ public Collection<ComputeEntity> list(ComputeEntity entity) {
+ return accessor.listByComponentId(entity.getVspId(),
+ versionMapper.toUDT(entity.getVersion()), entity.getComponentId()).all();
+ }
+
+ @Override
+ protected Mapper<ComputeEntity> getMapper() {
+ return mapper;
+ }
+
+ @Override
+ protected Object[] getKeys(ComputeEntity entity) {
+ return new Object[]{entity.getVspId(), versionMapper.toUDT(entity.getVersion()),
+ entity.getComponentId(), entity.getId()};
+ }
+
+ @Override
+ public Collection<ComputeEntity> listByVsp(String vspId, Version version) {
+ return accessor.listByVspId(vspId, versionMapper.toUDT(version)).all();
+ }
+
+ @Override
+ public void update(ComputeEntity entity) {
+ accessor.updateCompositionData(entity.getCompositionData(), entity.getVspId(), versionMapper
+ .toUDT(entity.getVersion()), entity.getComponentId(), entity.getId());
+ }
+
+ @Override
+ public void updateQuestionnaireData(String vspId, Version version, String componentId,
+ String computeId, String questionnaireData) {
+ accessor.updateQuestionnaireData(questionnaireData, vspId, versionMapper.toUDT(version),
+ componentId, computeId);
+ }
+
+ @Override
+ public void deleteAll(String vspId, Version version) {
+ accessor.deleteAll(vspId, version);
+ }
+
+ @Override
+ public ComputeEntity getQuestionnaireData(String vspId, Version version, String componentId,
+ String computeId) {
+ return null;
+ }
+
+ @Accessor
+ interface ComputeAccessor {
+
+ @Query("select * from vsp_component_compute where vsp_id=? and version=? and component_id=?")
+ Result<ComputeEntity> listByComponentId(String vspId, UDTValue version, String componentId);
+
+ @Query("select * from vsp_component_compute where vsp_id=? and version=?")
+ Result<ComputeEntity> listByVspId(String vspId, UDTValue version);
+
+ @Query("update vsp_component_compute set composition_data=? where vsp_id=? and version=?"
+ + " and component_id=? and compute_id=?")
+ ResultSet updateCompositionData(String compositionData, String vspId, UDTValue version,
+ String componentId, String computeId);
+
+ @Query("update vsp_component_compute set questionnaire_data=? where vsp_id=? and version=?"
+ + " and component_id=? and compute_id=?")
+ ResultSet updateQuestionnaireData(String questionnaireData, String vspId, UDTValue version,
+ String componentId, String computeId);
+
+ @Query("delete from vsp_component_compute where vsp_id=? and version=?")
+ ResultSet deleteAll(String vspId, Version version);
+ }
+}
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/dao/impl/ComputeDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComputeDaoFactoryImpl.java
new file mode 100644
index 0000000000..8221de3152
--- /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/dao/impl/ComputeDaoFactoryImpl.java
@@ -0,0 +1,16 @@
+package org.openecomp.sdc.vendorsoftwareproduct.dao.impl;
+
+import org.openecomp.core.zusammen.api.ZusammenAdaptorFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.ComputeDaoZusammenImpl;
+
+public class ComputeDaoFactoryImpl extends ComputeDaoFactory {
+ private static final ComputeDao INSTANCE = new ComputeDaoZusammenImpl(
+ ZusammenAdaptorFactory.getInstance().createInterface());
+
+ @Override
+ public ComputeDao createInterface() {
+ return INSTANCE;
+ }
+}
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/dao/impl/DeploymentFlavorDaoCassandraImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/DeploymentFlavorDaoCassandraImpl.java
new file mode 100644
index 0000000000..5831b582fc
--- /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/dao/impl/DeploymentFlavorDaoCassandraImpl.java
@@ -0,0 +1,93 @@
+package org.openecomp.sdc.vendorsoftwareproduct.dao.impl;
+
+import com.datastax.driver.core.ResultSet;
+import com.datastax.driver.core.UDTValue;
+import com.datastax.driver.mapping.Mapper;
+import com.datastax.driver.mapping.Result;
+import com.datastax.driver.mapping.UDTMapper;
+import com.datastax.driver.mapping.annotations.Accessor;
+import com.datastax.driver.mapping.annotations.Query;
+import org.openecomp.core.dao.impl.CassandraBaseDao;
+import org.openecomp.core.nosqldb.api.NoSqlDb;
+import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.DeploymentFlavorDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.DeploymentFlavorEntity;
+import org.openecomp.sdc.versioning.VersioningManagerFactory;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdc.versioning.types.UniqueValueMetadata;
+import org.openecomp.sdc.versioning.types.VersionableEntityMetadata;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+
+
+public class DeploymentFlavorDaoCassandraImpl extends CassandraBaseDao<DeploymentFlavorEntity> implements DeploymentFlavorDao {
+ private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
+ private static final Mapper<DeploymentFlavorEntity> mapper = noSqlDb.getMappingManager().mapper(DeploymentFlavorEntity.class);
+ private static final DeploymentFlavorAccessor accessor =
+ noSqlDb.getMappingManager().createAccessor(DeploymentFlavorAccessor.class);
+ private static final UDTMapper<Version> versionMapper =
+ noSqlDb.getMappingManager().udtMapper(Version.class);
+ @Override
+ protected Mapper<DeploymentFlavorEntity> getMapper() {
+ return mapper;
+ }
+
+ @Override
+ protected Object[] getKeys(DeploymentFlavorEntity entity) {
+ return new Object[]{entity.getVspId(), versionMapper.toUDT(entity.getVersion()),
+ entity.getId()};
+ }
+
+ @Override
+ public Collection<DeploymentFlavorEntity> list(DeploymentFlavorEntity entity) {
+ return accessor.list(entity.getVspId(), versionMapper.toUDT(entity.getVersion())).all();
+ }
+
+ @Override
+ public void update(DeploymentFlavorEntity entity) {
+ accessor.updateCompositionData(entity.getVspId(), versionMapper.toUDT(entity.getVersion()),
+ entity.getId(), entity.getCompositionData());
+ }
+
+ @Override
+ public void registerVersioning(String versionableEntityType) {
+ VersionableEntityMetadata metadata = new VersionableEntityMetadata(
+ mapper.getTableMetadata().getName(),
+ mapper.getTableMetadata().getPartitionKey().get(0).getName(),
+ mapper.getTableMetadata().getPartitionKey().get(1).getName());
+
+
+ metadata.setUniqueValuesMetadata(Collections.singletonList(new UniqueValueMetadata(
+ VendorSoftwareProductConstants.UniqueValues.DEPLOYMENT_FLAVOR_NAME,
+ Arrays.asList(mapper.getTableMetadata().getPartitionKey().get(0).getName(),
+ mapper.getTableMetadata().getPartitionKey().get(1).getName(), "name"))));
+
+ VersioningManagerFactory.getInstance().createInterface()
+ .register(versionableEntityType, metadata);
+ }
+
+ @Override
+ public void deleteAll(String vspId, Version version) {
+ accessor.deleteAll(vspId, version);
+ }
+
+ @Accessor
+ interface DeploymentFlavorAccessor {
+ @Query(
+ "select vsp_id, version, deployment_flavor_id, composition_data from vsp_deployment_flavor where vsp_id=?"
+ + " and version=?")
+ Result<DeploymentFlavorEntity> list(String vspId, UDTValue version);
+
+ @Query(
+ "insert into vsp_deployment_flavor (vsp_id, version, deployment_flavor_id, composition_data) values (?,?,?,?)")
+ ResultSet updateCompositionData(String vspId, UDTValue version, String id,
+ String compositionData);
+
+ @Query("delete from vsp_deployment_flavor where vsp_id=? and version=?")
+ ResultSet deleteAll(String vspId, Version version);
+
+ }
+}
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/dao/impl/DeploymentFlavorDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/DeploymentFlavorDaoFactoryImpl.java
new file mode 100644
index 0000000000..60a9e5e13e
--- /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/dao/impl/DeploymentFlavorDaoFactoryImpl.java
@@ -0,0 +1,17 @@
+package org.openecomp.sdc.vendorsoftwareproduct.dao.impl;
+
+import org.openecomp.core.zusammen.api.ZusammenAdaptorFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.DeploymentFlavorDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.DeploymentFlavorDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.DeploymentFlavorDaoZusammenImpl;
+
+
+public class DeploymentFlavorDaoFactoryImpl extends DeploymentFlavorDaoFactory{
+ private static final DeploymentFlavorDao INSTANCE = new DeploymentFlavorDaoZusammenImpl(
+ ZusammenAdaptorFactory.getInstance().createInterface());
+
+ @Override
+ public DeploymentFlavorDao createInterface() {
+ return INSTANCE;
+ }
+}
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/dao/impl/ImageDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ImageDaoFactoryImpl.java
new file mode 100644
index 0000000000..e4f13b3ee1
--- /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/dao/impl/ImageDaoFactoryImpl.java
@@ -0,0 +1,18 @@
+package org.openecomp.sdc.vendorsoftwareproduct.dao.impl;
+
+import org.openecomp.core.zusammen.api.ZusammenAdaptorFactory;
+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.impl.zusammen.ImageDaoZusammenImpl;
+
+public class ImageDaoFactoryImpl extends ImageDaoFactory {
+
+ private static final ImageDao INSTANCE = new ImageDaoZusammenImpl(
+ ZusammenAdaptorFactory.getInstance().createInterface());
+
+ @Override
+ public ImageDao createInterface() {
+ return INSTANCE;
+ }
+}
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/dao/impl/ImageDaoImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ImageDaoImpl.java
new file mode 100644
index 0000000000..24217830e4
--- /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/dao/impl/ImageDaoImpl.java
@@ -0,0 +1,129 @@
+package org.openecomp.sdc.vendorsoftwareproduct.dao.impl;
+
+import com.datastax.driver.core.ResultSet;
+import com.datastax.driver.core.UDTValue;
+import com.datastax.driver.mapping.Mapper;
+import com.datastax.driver.mapping.Result;
+import com.datastax.driver.mapping.UDTMapper;
+import com.datastax.driver.mapping.annotations.Accessor;
+import com.datastax.driver.mapping.annotations.Query;
+import org.openecomp.core.dao.impl.CassandraBaseDao;
+import org.openecomp.core.nosqldb.api.NoSqlDb;
+import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ImageDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ImageEntity;
+import org.openecomp.sdc.versioning.VersioningManagerFactory;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdc.versioning.types.UniqueValueMetadata;
+import org.openecomp.sdc.versioning.types.VersionableEntityMetadata;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+
+public class ImageDaoImpl extends CassandraBaseDao<ImageEntity> implements ImageDao {
+
+ private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
+ private static final Mapper<ImageEntity> mapper =
+ noSqlDb.getMappingManager().mapper(ImageEntity.class);
+ private static final ImageAccessor accessor =
+ noSqlDb.getMappingManager().createAccessor(ImageAccessor.class);
+ private static final UDTMapper<Version> versionMapper =
+ noSqlDb.getMappingManager().udtMapper(Version.class);
+
+ @Override
+ public void registerVersioning(String versionableEntityType) {
+
+ VersionableEntityMetadata metadata = new VersionableEntityMetadata(
+ mapper.getTableMetadata().getName(),
+ mapper.getTableMetadata().getPartitionKey().get(0).getName(),
+ mapper.getTableMetadata().getPartitionKey().get(1).getName());
+
+
+ metadata.setUniqueValuesMetadata(Collections.singletonList(new UniqueValueMetadata(
+ VendorSoftwareProductConstants.UniqueValues.IMAGE_NAME,
+ Arrays.asList("vsp_id", "version", "component_id", "name"))));
+
+ VersioningManagerFactory.getInstance().createInterface()
+ .register(versionableEntityType, metadata);
+ }
+
+ @Override
+ protected Mapper<ImageEntity> getMapper() {
+ return mapper;
+ }
+
+ @Override
+ protected Object[] getKeys(ImageEntity entity) {
+ return new Object[]{entity.getVspId(),
+ versionMapper.toUDT(entity.getVersion()), entity.getComponentId(), entity.getId() };
+ }
+
+ @Override
+ public Collection<ImageEntity> list(ImageEntity entity) {
+ return accessor.list(entity.getVspId(), versionMapper.toUDT(entity.getVersion()),
+ entity.getComponentId()).all();
+ }
+
+ @Override
+ public void update(ImageEntity entity) {
+ accessor.updateCompositionData(entity.getVspId(), versionMapper.toUDT(entity.getVersion()),
+ entity.getComponentId(), entity.getId(), entity.getCompositionData());
+ }
+
+ @Override
+ public void updateQuestionnaireData(String vspId, Version version, String componentId,
+ String imageId, String questionnaireData) {
+ accessor.updateQuestionnaireData(questionnaireData, vspId, versionMapper.toUDT(version),
+ componentId, imageId);
+ }
+
+ @Override
+ public void delete(ImageEntity entity) {
+ super.delete(entity);
+ }
+
+ @Override
+ public void deleteByVspId(String vspId, Version version) {
+ accessor.deleteByVspId(vspId, versionMapper.toUDT(version));
+ }
+
+ @Override
+ public Collection<ImageEntity> listByVsp(String vspId, Version version) {
+ return accessor.listByVspId(vspId, versionMapper.toUDT(version)).all();
+ }
+
+ @Override
+ public ImageEntity getQuestionnaireData(String vspId, Version version, String componentId,
+ String computeId) {
+ return null;
+ }
+
+ @Accessor
+ interface ImageAccessor {
+
+ @Query("select vsp_id, version, component_id, image_id, composition_data from "
+ + "vsp_component_image where vsp_id=? and version=? and component_id=?")
+ Result<ImageEntity> list(String vspId, UDTValue version, String componentId);
+
+ @Query(
+ "insert into vsp_component_image (vsp_id, version, component_id, image_id, "
+ + "composition_data) values (?,?,?,?,?)")
+ ResultSet updateCompositionData(String vspId, UDTValue version, String componentId, String id,
+ String compositionData);
+
+ @Query("update vsp_component_image set questionnaire_data=? where vsp_id=? and version=?"
+ + " and component_id=? and image_id=?")
+ ResultSet updateQuestionnaireData(String questionnaireData, String vspId, UDTValue version,
+ String componentId, String computeId);
+
+ @Query("delete from vsp_component_image where vsp_id=? and version=?")
+ ResultSet deleteByVspId(String vspId, UDTValue version);
+
+ @Query("select * from vsp_component_image where vsp_id=? and version=?")
+ Result<ImageEntity> listByVspId(String vspId, UDTValue version);
+
+ }
+
+}
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/dao/impl/MibDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/MonitoringUploadDaoFactoryImpl.java
index 923744bae7..fa6a0cbfc2 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/MibDaoFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/MonitoringUploadDaoFactoryImpl.java
@@ -21,16 +21,16 @@
package org.openecomp.sdc.vendorsoftwareproduct.dao.impl;
import org.openecomp.core.zusammen.api.ZusammenAdaptorFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.MibDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.MibDaoFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.MibDaoZusammenImpl;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentArtifactDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.MonitoringUploadDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.ComponentArtifactDaoZusammenImpl;
-public class MibDaoFactoryImpl extends MibDaoFactory {
- private static final MibDao INSTANCE = new MibDaoZusammenImpl(
+public class MonitoringUploadDaoFactoryImpl extends MonitoringUploadDaoFactory {
+ private static final ComponentArtifactDao INSTANCE = new ComponentArtifactDaoZusammenImpl(
ZusammenAdaptorFactory.getInstance().createInterface());
@Override
- public MibDao createInterface() {
+ public ComponentArtifactDao createInterface() {
return INSTANCE;
}
}
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/dao/impl/VendorSoftwareProductDaoImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VendorSoftwareProductDaoImpl.java
index 2251c2700e..bdd6677738 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VendorSoftwareProductDaoImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VendorSoftwareProductDaoImpl.java
@@ -35,8 +35,12 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDaoFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDependencyModelDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDependencyModelDaoFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.MibDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.MibDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.DeploymentFlavorDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.DeploymentFlavorDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ImageDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ImageDaoFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.NetworkDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.NetworkDaoFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDao;
@@ -52,6 +56,9 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDaoFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentDependencyModelEntity;
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.ProcessEntity;
import org.openecomp.sdc.versioning.dao.types.Version;
@@ -73,8 +80,6 @@ public class VendorSoftwareProductDaoImpl implements VendorSoftwareProductDao {
ComponentDaoFactory.getInstance().createInterface();
private static final NicDao nicDao = NicDaoFactory.getInstance().createInterface();
private static final ProcessDao processDao = ProcessDaoFactory.getInstance().createInterface();
- private static final MibDao
- MIB_DAO = MibDaoFactory.getInstance().createInterface();
private static final ServiceArtifactDaoInter
artifactDao = ServiceArtifactDaoFactory.getInstance().createInterface();
public static final ServiceTemplateDaoInter
@@ -87,6 +92,11 @@ public class VendorSoftwareProductDaoImpl implements VendorSoftwareProductDao {
ServiceModelDaoFactory.getInstance().createInterface();
private static final ComponentDependencyModelDao componentDependencyModelDao =
ComponentDependencyModelDaoFactory.getInstance().createInterface();
+ private static final DeploymentFlavorDao
+ deploymentFlavorDao = DeploymentFlavorDaoFactory.getInstance().createInterface();
+ private static final ImageDao imageDao = ImageDaoFactory.getInstance().createInterface();
+ private static final ComputeDao computeDao = ComputeDaoFactory.getInstance().createInterface();
+
@Override
public void registerVersioning(String versionableEntityType) {
@@ -97,6 +107,9 @@ public class VendorSoftwareProductDaoImpl implements VendorSoftwareProductDao {
processDao.registerVersioning(versionableEntityType);
orchestrationTemplateCandidateDataDao.registerVersioning(versionableEntityType);
componentDependencyModelDao.registerVersioning(versionableEntityType);
+ computeDao.registerVersioning(versionableEntityType);
+ deploymentFlavorDao.registerVersioning(versionableEntityType);
+ imageDao.registerVersioning(versionableEntityType);
}
@Override
@@ -226,4 +239,106 @@ public class VendorSoftwareProductDaoImpl implements VendorSoftwareProductDao {
return componentDependencyModelDao.list(new ComponentDependencyModelEntity(vspId, version,
null));
}
+
+ @Override
+ public void createDeploymentFlavor(DeploymentFlavorEntity deploymentFlavor) {
+ deploymentFlavorDao.create(deploymentFlavor);
+ }
+
+ @Override
+ public Collection<DeploymentFlavorEntity> listDeploymentFlavors(String vspId, Version version) {
+ return deploymentFlavorDao.list(new DeploymentFlavorEntity(vspId, version, null));
+ }
+
+ @Override
+ public DeploymentFlavorEntity getDeploymentFlavor(String vspId, Version version,
+ String deploymentFlavorId) {
+ return deploymentFlavorDao.get(new DeploymentFlavorEntity(vspId, version, deploymentFlavorId));
+ }
+
+ @Override
+ public void deleteDeploymentFlavor(String vspId, Version version, String deploymentFlavorId) {
+ deploymentFlavorDao.delete(new DeploymentFlavorEntity(vspId,version,
+ deploymentFlavorId));
+ }
+
+ @Override
+ public void createImage(ImageEntity imageEntity) {
+ imageDao.create(imageEntity);
+ }
+
+ @Override
+ public Collection<ImageEntity> listImages(String vspId, Version version, String componentId) {
+ return imageDao.list(new ImageEntity(vspId, version, componentId, null));
+ }
+
+ @Override
+ public ImageEntity getImage(String vspId, Version version, String componentId, String imageId) {
+ return imageDao.get(new ImageEntity(vspId, version, componentId, imageId));
+ }
+
+ @Override
+ public Collection<ImageEntity> listImagesByVsp(String vspId, Version version) {
+ return imageDao.listByVsp(vspId, version);
+ }
+
+ @Override
+ public void createCompute(ComputeEntity computeEntity) {
+ computeDao.create(computeEntity);
+ }
+
+ @Override
+ public Collection<ComputeEntity> listComputes(String vspId, Version version, String componentId) {
+ return computeDao.list(new ComputeEntity(vspId, version, componentId, null));
+ }
+
+ @Override
+ public Collection<ComputeEntity> listComputesByVsp(String vspId, Version version) {
+ return computeDao.listByVsp(vspId, version);
+ }
+
+ @Override
+ public ComputeEntity getCompute(String vspId, Version version, String componentId,
+ String computeFlavorId) {
+ return computeDao.get(new ComputeEntity(vspId, version, componentId, computeFlavorId));
+ }
+
+ @Override
+ public void deleteImage(String vspId, Version version, String componentId, String imageId) {
+ ImageEntity imageEntity = new ImageEntity(vspId, version, componentId, imageId);
+ imageDao.delete(imageEntity);
+ }
+
+ @Override
+ public void updateDeploymentFlavor(DeploymentFlavorEntity deploymentFlavorEntity) {
+ deploymentFlavorDao.update(deploymentFlavorEntity);
+ }
+
+ @Override
+ public void updateImage(ImageEntity imageEntity) {
+ imageDao.update(imageEntity);
+ }
+
+ @Override
+ public void updateImageQuestionnaire(String vspId, Version version, String componentId,
+ String imageId, String questionnaireData) {
+ imageDao.updateQuestionnaireData(vspId, version, componentId, imageId, questionnaireData);
+ }
+
+ @Override
+ public void updateComputeQuestionnaire(String vspId, Version version, String componentId,
+ String computeId, String questionnaireData) {
+ computeDao.updateQuestionnaireData(vspId, version, componentId, computeId, questionnaireData);
+ }
+
+ @Override
+ public void updateCompute(ComputeEntity compute) {
+ computeDao.update(compute);
+ }
+
+ @Override
+ public void deleteCompute(String vspId, Version version, String componentId, String
+ computeFlavorId) {
+ computeDao.delete(new ComputeEntity(vspId, version, componentId, computeFlavorId));
+ }
}
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/dao/impl/VendorSoftwareProductInfoDaoImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VendorSoftwareProductInfoDaoImpl.java
index 5a8635cf98..d9b629cc60 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VendorSoftwareProductInfoDaoImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VendorSoftwareProductInfoDaoImpl.java
@@ -98,6 +98,11 @@ public class VendorSoftwareProductInfoDaoImpl extends CassandraBaseDao<VspDetail
}
+ @Override
+ public boolean isManual(String vspId, Version version) {
+ return false;
+ }
+
@Accessor
interface VendorSoftwareProductInfoAccessor {
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/dao/impl/zusammen/MibDaoZusammenImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/ComponentArtifactDaoZusammenImpl.java
index d56db41cee..517f2fd19b 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/MibDaoZusammenImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/ComponentArtifactDaoZusammenImpl.java
@@ -7,12 +7,12 @@ import com.amdocs.zusammen.datatypes.Id;
import com.amdocs.zusammen.datatypes.SessionContext;
import com.amdocs.zusammen.datatypes.item.Action;
import com.amdocs.zusammen.datatypes.item.ElementContext;
-import org.openecomp.core.enrichment.types.ArtifactType;
+import org.openecomp.core.enrichment.types.MonitoringUploadType;
import org.openecomp.core.utilities.file.FileUtils;
import org.openecomp.core.zusammen.api.ZusammenAdaptor;
import org.openecomp.core.zusammen.api.ZusammenUtil;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.MibDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.MibEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentArtifactDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentMonitoringUploadEntity;
import org.openecomp.sdc.versioning.dao.types.Version;
import java.io.ByteArrayInputStream;
@@ -25,13 +25,13 @@ import java.util.stream.Collectors;
* @author Avrahamg.
* @since March 21, 2017
*/
-public class MibDaoZusammenImpl implements MibDao {
+public class ComponentArtifactDaoZusammenImpl implements ComponentArtifactDao {
private static final String ARTIFACT_NAME = "name";
private ZusammenAdaptor zusammenAdaptor;
- public MibDaoZusammenImpl(ZusammenAdaptor zusammenAdaptor) {
+ public ComponentArtifactDaoZusammenImpl(ZusammenAdaptor zusammenAdaptor) {
this.zusammenAdaptor = zusammenAdaptor;
}
@@ -41,25 +41,30 @@ public class MibDaoZusammenImpl implements MibDao {
}
@Override
- public Optional<MibEntity> getByType(MibEntity mibEntity) {
+ public Optional<ComponentMonitoringUploadEntity> getByType(
+ ComponentMonitoringUploadEntity componentMonitoringUploadEntity) {
SessionContext context = ZusammenUtil.createSessionContext();
- Id itemId = new Id(mibEntity.getVspId());
+ Id itemId = new Id(componentMonitoringUploadEntity.getVspId());
ElementContext elementContext = new ElementContext(itemId,
VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor),
- VspZusammenUtil.getVersionTag(mibEntity.getVersion()));
-
+ VspZusammenUtil.getVersionTag(componentMonitoringUploadEntity.getVersion()));
Optional<Element> mibsElement =
- zusammenAdaptor.getElementByName(context, elementContext, new Id(mibEntity
+ zusammenAdaptor.getElementByName(context, elementContext, new Id(
+ componentMonitoringUploadEntity
.getComponentId()), StructureElement.Mibs.toString());
if (mibsElement.isPresent()) {
- Optional<Element> mibElement = zusammenAdaptor
+ Optional<Element> monitoringElement = zusammenAdaptor
.getElementByName(context, elementContext, mibsElement.get().getElementId(),
- getMibStructuralElement(mibEntity.getType()).toString());
- if (mibElement.isPresent()) {
- mibEntity.setId(mibElement.get().getElementId().getValue());
- mibEntity.setArtifactName((String) mibElement.get().getInfo().getProperties().get(ARTIFACT_NAME));
- mibEntity.setArtifact(ByteBuffer.wrap(FileUtils.toByteArray(mibElement.get().getData())));
- return Optional.of(mibEntity);
+ getMonitoringStructuralElement(componentMonitoringUploadEntity.getType())
+ .toString());
+ if (monitoringElement.isPresent()) {
+ componentMonitoringUploadEntity.setId(monitoringElement.get().getElementId().getValue());
+ componentMonitoringUploadEntity
+ .setArtifactName(
+ (String) monitoringElement.get().getInfo().getProperties().get(ARTIFACT_NAME));
+ componentMonitoringUploadEntity
+ .setArtifact(ByteBuffer.wrap(FileUtils.toByteArray(monitoringElement.get().getData())));
+ return Optional.of(componentMonitoringUploadEntity);
}
}
@@ -67,44 +72,44 @@ public class MibDaoZusammenImpl implements MibDao {
}
@Override
- public void create(MibEntity mibEntity) {
- ZusammenElement mibElement = buildMibElement(mibEntity);
+ public void create(ComponentMonitoringUploadEntity entity) {
+ ZusammenElement mibElement = buildMibElement(entity);
ZusammenElement mibsElement =
VspZusammenUtil.buildStructuralElement(StructureElement.Mibs, null);
- ZusammenElement componentElement = buildComponentElement(mibEntity);
+ ZusammenElement componentElement = buildComponentElement(entity);
SessionContext context = ZusammenUtil.createSessionContext();
- Id itemId = new Id(mibEntity.getVspId());
+ Id itemId = new Id(entity.getVspId());
ElementContext elementContext = new ElementContext(itemId,
VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor));
Optional<Element> savedElement = zusammenAdaptor.saveElement(context, elementContext,
VspZusammenUtil.aggregateElements(componentElement, mibsElement, mibElement),
- "Create mib");
+ "Create monitoring upload");
savedElement.ifPresent(element ->
- mibEntity.setId(element.getSubElements().iterator().next()
+ entity.setId(element.getSubElements().iterator().next()
.getSubElements().iterator().next().getElementId().getValue()));
}
@Override
- public void delete(MibEntity mibEntity) {
+ public void delete(ComponentMonitoringUploadEntity componentMonitoringUploadEntity) {
ZusammenElement mibElement = new ZusammenElement();
- mibElement.setElementId(new Id(mibEntity.getId()));
+ mibElement.setElementId(new Id(componentMonitoringUploadEntity.getId()));
mibElement.setAction(Action.DELETE);
SessionContext context = ZusammenUtil.createSessionContext();
- Id itemId = new Id(mibEntity.getVspId());
+ Id itemId = new Id(componentMonitoringUploadEntity.getVspId());
ElementContext elementContext = new ElementContext(itemId,
VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor));
zusammenAdaptor.saveElement(context, elementContext, mibElement,
- String.format("Delete mib with id %s", mibEntity.getId()));
+ String.format("Delete mib with id %s", componentMonitoringUploadEntity.getId()));
}
@Override
- public Collection<MibEntity> list(MibEntity mib) {
+ public Collection<ComponentMonitoringUploadEntity> list(ComponentMonitoringUploadEntity mib) {
SessionContext context = ZusammenUtil.createSessionContext();
Id itemId = new Id(mib.getVspId());
ElementContext elementContext = new ElementContext(itemId,
@@ -120,14 +125,14 @@ public class MibDaoZusammenImpl implements MibDao {
}
@Override
- public void deleteAll(MibEntity mibEntity) {
+ public void deleteAll(ComponentMonitoringUploadEntity componentMonitoringUploadEntity) {
ZusammenElement mibsElement =
VspZusammenUtil.buildStructuralElement(StructureElement.Mibs, Action.DELETE);
- ZusammenElement componentElement = buildComponentElement(mibEntity);
+ ZusammenElement componentElement = buildComponentElement(componentMonitoringUploadEntity);
SessionContext context = ZusammenUtil.createSessionContext();
- Id itemId = new Id(mibEntity.getVspId());
+ Id itemId = new Id(componentMonitoringUploadEntity.getVspId());
ElementContext elementContext = new ElementContext(itemId,
VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor));
@@ -136,15 +141,17 @@ public class MibDaoZusammenImpl implements MibDao {
}
@Override
- public Collection<MibEntity> listArtifacts(MibEntity mib) {
+ public Collection<ComponentMonitoringUploadEntity> listArtifacts(
+ ComponentMonitoringUploadEntity monitoringUploadEntity) {
SessionContext context = ZusammenUtil.createSessionContext();
- Id itemId = new Id(mib.getVspId());
+ Id itemId = new Id(monitoringUploadEntity.getVspId());
ElementContext elementContext = new ElementContext(itemId,
VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor),
- VspZusammenUtil.getVersionTag(mib.getVersion()));
+ VspZusammenUtil.getVersionTag(monitoringUploadEntity.getVersion()));
final Optional<Element> elementByName =
- zusammenAdaptor.getElementByName(context, elementContext, new Id(mib.getComponentId()
+ zusammenAdaptor.getElementByName(context, elementContext,
+ new Id(monitoringUploadEntity.getComponentId()
), StructureElement.Mibs.name());
if(!elementByName.isPresent())
@@ -153,49 +160,65 @@ public class MibDaoZusammenImpl implements MibDao {
final Id elementId = elementByName.get().getElementId();
return zusammenAdaptor.listElementData(context, elementContext, elementId).stream()
.map(element ->
- buildMibEntity(element,mib)
+ buildMibEntity(element, monitoringUploadEntity)
).collect(Collectors.toList());
}
}
- private MibEntity buildMibEntity (Element element, MibEntity mib) {
- MibEntity createdMib = new MibEntity(mib.getVspId(), mib.getVersion(), mib.getComponentId(),
+ private ComponentMonitoringUploadEntity buildMibEntity(Element element,
+ ComponentMonitoringUploadEntity monitoringUploadEntity) {
+ final String componentId = monitoringUploadEntity.getComponentId();
+ ComponentMonitoringUploadEntity
+ createdMib = new ComponentMonitoringUploadEntity(monitoringUploadEntity.getVspId(),
+ monitoringUploadEntity.getVersion(),
+ componentId,
null);
createdMib.setArtifactName((String) element.getInfo().getProperties().get(ARTIFACT_NAME));
createdMib.setArtifact(ByteBuffer.wrap(FileUtils.toByteArray(element.getData())));
- createdMib.setType( ArtifactType.valueOf(element.getInfo().getName()));
+ createdMib.setType(MonitoringUploadType.valueOf(element.getInfo().getName()));
return createdMib;
}
- private ZusammenElement buildComponentElement(MibEntity mibEntity) {
+ private ZusammenElement buildComponentElement(
+ ComponentMonitoringUploadEntity componentMonitoringUploadEntity) {
ZusammenElement componentElement = new ZusammenElement();
- componentElement.setElementId(new Id(mibEntity.getComponentId()));
+ componentElement.setElementId(new Id(componentMonitoringUploadEntity.getComponentId()));
componentElement.setAction(Action.IGNORE);
return componentElement;
}
- private ZusammenElement buildMibElement(MibEntity mib) {
- ZusammenElement mibElement = VspZusammenUtil
- .buildStructuralElement(getMibStructuralElement(mib.getType()), Action.UPDATE);
- mibElement.getInfo().getProperties().put(ARTIFACT_NAME, mib.getArtifactName());
- mibElement.setData(new ByteArrayInputStream(mib.getArtifact().array()));
- return mibElement;
+ private ZusammenElement buildMibElement(ComponentMonitoringUploadEntity monitoringUploadEntity) {
+ ZusammenElement monitoringElement = VspZusammenUtil
+ .buildStructuralElement(getMonitoringStructuralElement(monitoringUploadEntity.getType()),
+ Action.UPDATE);
+ monitoringElement.getInfo().getProperties()
+ .put(ARTIFACT_NAME, monitoringUploadEntity.getArtifactName());
+ monitoringElement
+ .setData(new ByteArrayInputStream(monitoringUploadEntity.getArtifact().array()));
+ return monitoringElement;
}
- private MibEntity mapElementInfoToMib(String vspId, Version version, String componentId,
- ElementInfo elementInfo) {
- MibEntity mib = new MibEntity(vspId, version, componentId, elementInfo.getId().getValue());
- mib.setArtifactName((String) elementInfo.getInfo().getProperties().get(ARTIFACT_NAME));
- mib.setType(ArtifactType.valueOf(elementInfo.getInfo().getName()));
- return mib;
+ private ComponentMonitoringUploadEntity mapElementInfoToMib(String vspId, Version version,
+ String componentId,
+ ElementInfo elementInfo) {
+ ComponentMonitoringUploadEntity
+ monitoringUploadEntity = new ComponentMonitoringUploadEntity(vspId, version, componentId,
+ elementInfo.getId().getValue());
+ monitoringUploadEntity
+ .setArtifactName((String) elementInfo.getInfo().getProperties().get(ARTIFACT_NAME));
+ monitoringUploadEntity.setType(MonitoringUploadType.valueOf(elementInfo.getInfo().getName()));
+ return monitoringUploadEntity;
}
- private StructureElement getMibStructuralElement(ArtifactType type) {
+ private StructureElement getMonitoringStructuralElement(MonitoringUploadType type)
+ throws IllegalArgumentException {
switch (type) {
case SNMP_POLL:
return StructureElement.SNMP_POLL;
case SNMP_TRAP:
return StructureElement.SNMP_TRAP;
+ case VES_EVENTS:
+ return StructureElement.VES_EVENTS;
default:
throw new IllegalArgumentException();
}
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/dao/impl/zusammen/ComponentDaoZusammenImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/ComponentDaoZusammenImpl.java
index 8ef09ada7b..ed6a13d2a1 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/ComponentDaoZusammenImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/ComponentDaoZusammenImpl.java
@@ -215,7 +215,11 @@ public class ComponentDaoZusammenImpl implements ComponentDao {
componentQuestionnaireToZusammen(component.getQuestionnaireData(), Action.CREATE),
VspZusammenUtil.buildStructuralElement(StructureElement.Nics, Action.CREATE),
VspZusammenUtil.buildStructuralElement(StructureElement.Processes, Action.CREATE),
- VspZusammenUtil.buildStructuralElement(StructureElement.Mibs, Action.CREATE)));
+ VspZusammenUtil.buildStructuralElement(StructureElement.Mibs, Action.CREATE),
+ VspZusammenUtil.buildStructuralElement(StructureElement.Computes, Action.CREATE),
+ VspZusammenUtil.buildStructuralElement(StructureElement.Images, Action.CREATE)));
+
+
}
return componentElement;
}
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/dao/impl/zusammen/ComponentDependencyModelPropertyName.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/ComponentDependencyModelPropertyName.java
new file mode 100644
index 0000000000..426bb52452
--- /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/dao/impl/zusammen/ComponentDependencyModelPropertyName.java
@@ -0,0 +1,12 @@
+package org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen;
+
+/**
+ * Created by ayalaben on 5/16/2017
+ */
+public enum ComponentDependencyModelPropertyName {
+ id,
+ relation,
+ sourcecomponent_id,
+ targetcomponent_id,
+
+}
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/dao/impl/zusammen/ComputeDaoZusammenImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/ComputeDaoZusammenImpl.java
new file mode 100644
index 0000000000..aa4bab67df
--- /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/dao/impl/zusammen/ComputeDaoZusammenImpl.java
@@ -0,0 +1,251 @@
+package org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen;
+
+
+import com.amdocs.zusammen.adaptor.inbound.api.types.item.Element;
+import com.amdocs.zusammen.adaptor.inbound.api.types.item.ElementInfo;
+import com.amdocs.zusammen.adaptor.inbound.api.types.item.ZusammenElement;
+import com.amdocs.zusammen.datatypes.Id;
+import com.amdocs.zusammen.datatypes.SessionContext;
+import com.amdocs.zusammen.datatypes.item.Action;
+import com.amdocs.zusammen.datatypes.item.ElementContext;
+import com.amdocs.zusammen.datatypes.item.Info;
+import org.openecomp.core.utilities.file.FileUtils;
+import org.openecomp.core.zusammen.api.ZusammenAdaptor;
+import org.openecomp.core.zusammen.api.ZusammenUtil;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComputeEntity;
+import org.openecomp.sdc.versioning.dao.types.Version;
+
+import java.io.ByteArrayInputStream;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+public class ComputeDaoZusammenImpl implements ComputeDao {
+
+ private ZusammenAdaptor zusammenAdaptor;
+
+ public ComputeDaoZusammenImpl(ZusammenAdaptor zusammenAdaptor) {
+ this.zusammenAdaptor = zusammenAdaptor;
+ }
+
+ @Override
+ public void registerVersioning(String versionableEntityType) {
+ }
+
+ @Override
+ public Collection<ComputeEntity> list(ComputeEntity compute) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(compute.getVspId());
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor),
+ VspZusammenUtil.getVersionTag(compute.getVersion()));
+
+ return listComputes(context, elementContext, compute);
+ }
+
+ private Collection<ComputeEntity> listComputes(SessionContext context,
+ ElementContext elementContext, ComputeEntity compute) {
+ return zusammenAdaptor
+ .listElementsByName(context, elementContext, new Id(compute.getComponentId()),
+ StructureElement.Computes.name())
+ .stream().map(elementInfo -> mapElementInfoToCompute(
+ compute.getVspId(), compute.getVersion(), compute.getComponentId(), elementInfo))
+ .collect(Collectors.toList());
+ }
+
+ private static ComputeEntity mapElementInfoToCompute(String vspId, Version version,
+ String componentId, ElementInfo elementInfo) {
+ ComputeEntity componentEntity =
+ new ComputeEntity(vspId, version, componentId, elementInfo.getId().getValue());
+ componentEntity.setCompositionData(
+ elementInfo.getInfo().getProperty(ElementPropertyName.compositionData.name()));
+ return componentEntity;
+ }
+
+ @Override
+ public void create(ComputeEntity compute) {
+ ZusammenElement computeElement = computeToZusammen(compute, Action.CREATE);
+
+ ZusammenElement computesElement =
+ VspZusammenUtil.buildStructuralElement(StructureElement.Computes, null);
+ computesElement.setSubElements(Collections.singletonList(computeElement));
+
+ ZusammenElement componentElement = new ZusammenElement();
+ componentElement.setElementId(new Id(compute.getComponentId()));
+ componentElement.setAction(Action.IGNORE);
+ componentElement.setSubElements(Collections.singletonList(computesElement));
+
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(compute.getVspId());
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor));
+
+ Optional<Element> savedElement =
+ zusammenAdaptor.saveElement(context, elementContext, componentElement, "Create compute");
+ savedElement.ifPresent(element ->
+ compute.setId(element.getSubElements().iterator().next()
+ .getSubElements().iterator().next().getElementId().getValue()));
+ }
+
+ @Override
+ public void update(ComputeEntity compute) {
+ ZusammenElement computeElement = computeToZusammen(compute, Action.UPDATE);
+
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(compute.getVspId());
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor));
+ zusammenAdaptor.saveElement(context, elementContext, computeElement,
+ String.format("Update compute with id %s", compute.getId()));
+ }
+
+ @Override
+ public ComputeEntity get(ComputeEntity compute) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(compute.getVspId());
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor),
+ VspZusammenUtil.getVersionTag(compute.getVersion()));
+ Optional<Element> element = zusammenAdaptor.getElement(context, elementContext, compute.getId());
+
+ if (element.isPresent()) {
+ compute.setCompositionData(new String(FileUtils.toByteArray(element.get().getData())));
+ return compute;
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public void delete(ComputeEntity compute) {
+ ZusammenElement computeElement = new ZusammenElement();
+ computeElement.setElementId(new Id(compute.getId()));
+ computeElement.setAction(Action.DELETE);
+
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(compute.getVspId());
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor));
+ zusammenAdaptor.saveElement(context, elementContext, computeElement,
+ String.format("Delete compute with id %s", compute.getId()));
+ }
+
+ @Override
+ public ComputeEntity getQuestionnaireData(String vspId, Version version, String componentId,
+ String computeId) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(vspId);
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor),
+ VspZusammenUtil.getVersionTag(version));
+
+ return getQuestionnaire(context, elementContext,
+ new ComputeEntity(vspId, version, componentId, computeId));
+ }
+
+ private ComputeEntity getQuestionnaire(SessionContext context, ElementContext elementContext,
+ ComputeEntity compute) {
+ Optional<Element> questionnaireElement = zusammenAdaptor
+ .getElementByName(context, elementContext, new Id(compute.getId()),
+ StructureElement.Questionnaire.name());
+ return questionnaireElement.map(
+ element -> element.getData() == null
+ ? null
+ : new String(FileUtils.toByteArray(element.getData())))
+ .map(questionnaireData -> {
+ compute.setQuestionnaireData(questionnaireData);
+ return compute;
+ })
+ .orElse(null);
+ }
+
+ @Override
+ public void updateQuestionnaireData(String vspId, Version version, String componentId,
+ String computeId, String questionnaireData) {
+ ZusammenElement questionnaireElement =
+ computeQuestionnaireToZusammen(questionnaireData, Action.UPDATE);
+
+ ZusammenElement computeElement = new ZusammenElement();
+ computeElement.setAction(Action.IGNORE);
+ computeElement.setElementId(new Id(computeId));
+ computeElement.setSubElements(Collections.singletonList(questionnaireElement));
+
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(vspId);
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor));
+ zusammenAdaptor.saveElement(context, elementContext, computeElement, "Update compute "
+ + "questionnaire");
+ }
+
+ @Override
+ public Collection<ComputeEntity> listByVsp(String vspId, Version version) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(vspId);
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor),
+ VspZusammenUtil.getVersionTag(version));
+
+ Collection<ComponentEntity> components = ComponentDaoZusammenImpl
+ .listComponents(zusammenAdaptor, context, elementContext, vspId, version);
+
+ return components.stream()
+ .map(component ->
+ listComputes(context, elementContext,
+ new ComputeEntity(vspId, version, component.getId(), null)).stream()
+ .map(compute -> getQuestionnaire(context, elementContext, compute))
+ .collect(Collectors.toList()))
+ .flatMap(Collection::stream)
+ .collect(Collectors.toList());
+ }
+
+ @Override
+ public void deleteAll(String vspId, Version version) {
+ ZusammenElement computesElement =
+ VspZusammenUtil.buildStructuralElement(StructureElement.Computes, Action.DELETE);
+
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(vspId);
+ zusammenAdaptor.saveElement(context,
+ new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor)),
+ computesElement, "Delete all computes");
+ }
+
+ private ZusammenElement computeToZusammen(ComputeEntity compute, Action action) {
+ ZusammenElement computeElement = buildComputeElement(compute, action);
+ if (action == Action.CREATE) {
+ computeElement.setSubElements(Collections.singletonList(
+ computeQuestionnaireToZusammen(compute.getQuestionnaireData(), Action.CREATE)));
+ }
+ return computeElement;
+ }
+
+ private ZusammenElement computeQuestionnaireToZusammen(String questionnaireData,
+ Action action) {
+ ZusammenElement questionnaireElement =
+ VspZusammenUtil.buildStructuralElement(StructureElement.Questionnaire, action);
+ questionnaireElement.setData(new ByteArrayInputStream(questionnaireData.getBytes()));
+ return questionnaireElement;
+ }
+
+ private ZusammenElement buildComputeElement(ComputeEntity compute, Action action) {
+ ZusammenElement computeElement = new ZusammenElement();
+ computeElement.setAction(action);
+ if (compute.getId() != null) {
+ computeElement.setElementId(new Id(compute.getId()));
+ }
+ Info info = new Info();
+ info.addProperty(ElementPropertyName.type.name(), ElementType.Compute);
+ info.addProperty(ElementPropertyName.compositionData.name(), compute.getCompositionData());
+ computeElement.setInfo(info);
+ computeElement.setData(new ByteArrayInputStream(compute.getCompositionData().getBytes()));
+ return computeElement;
+ }
+
+
+
+}
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/dao/impl/zusammen/DeploymentFlavorDaoZusammenImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/DeploymentFlavorDaoZusammenImpl.java
new file mode 100644
index 0000000000..947bcc27e5
--- /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/dao/impl/zusammen/DeploymentFlavorDaoZusammenImpl.java
@@ -0,0 +1,179 @@
+package org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen;
+
+import com.amdocs.zusammen.adaptor.inbound.api.types.item.Element;
+import com.amdocs.zusammen.adaptor.inbound.api.types.item.ElementInfo;
+import com.amdocs.zusammen.adaptor.inbound.api.types.item.ZusammenElement;
+import com.amdocs.zusammen.datatypes.Id;
+import com.amdocs.zusammen.datatypes.SessionContext;
+import com.amdocs.zusammen.datatypes.item.Action;
+import com.amdocs.zusammen.datatypes.item.ElementContext;
+import com.amdocs.zusammen.datatypes.item.Info;
+import org.openecomp.core.utilities.file.FileUtils;
+import org.openecomp.core.zusammen.api.ZusammenAdaptor;
+import org.openecomp.core.zusammen.api.ZusammenUtil;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.DeploymentFlavorDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.DeploymentFlavorEntity;
+import org.openecomp.sdc.versioning.dao.types.Version;
+
+import java.io.ByteArrayInputStream;
+import java.util.Collection;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+public class DeploymentFlavorDaoZusammenImpl implements DeploymentFlavorDao {
+
+ private ZusammenAdaptor zusammenAdaptor;
+
+ public DeploymentFlavorDaoZusammenImpl(ZusammenAdaptor zusammenAdaptor) {
+ this.zusammenAdaptor = zusammenAdaptor;
+ }
+
+ @Override
+ public void registerVersioning(String versionableEntityType) {
+ }
+
+ @Override
+ public Collection<DeploymentFlavorEntity> list(DeploymentFlavorEntity deploymentFlavor) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(deploymentFlavor.getVspId());
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor),
+ VspZusammenUtil.getVersionTag(deploymentFlavor.getVersion()));
+
+ return listDeploymentFlavor(zusammenAdaptor, context, elementContext, deploymentFlavor.getVspId(),
+ deploymentFlavor.getVersion());
+ }
+
+ static Collection<DeploymentFlavorEntity> listDeploymentFlavor(ZusammenAdaptor zusammenAdaptor,
+ SessionContext context,
+ ElementContext elementContext,
+ String vspId, Version version) {
+ return zusammenAdaptor
+ .listElementsByName(context, elementContext, null, StructureElement.DeploymentFlavors.name())
+ .stream().map(elementInfo -> mapElementInfoToComponent(vspId, version, elementInfo))
+ .collect(Collectors.toList());
+ }
+
+ private static DeploymentFlavorEntity mapElementInfoToComponent(String vspId, Version version,
+ ElementInfo elementInfo) {
+ DeploymentFlavorEntity deploymentFlavorEntity =
+ new DeploymentFlavorEntity(vspId, version, elementInfo.getId().getValue());
+ deploymentFlavorEntity.setCompositionData(
+ elementInfo.getInfo().getProperty(ElementPropertyName.compositionData.name()));
+ return deploymentFlavorEntity;
+ }
+
+ @Override
+ public void create(DeploymentFlavorEntity deploymentFlavor) {
+ ZusammenElement deploymentFlavorElement = deploymentFlavorToZusammen(deploymentFlavor,
+ Action.CREATE);
+ ZusammenElement deploymentFlavorElements =
+ VspZusammenUtil.buildStructuralElement(StructureElement.DeploymentFlavors, null);
+ deploymentFlavorElements.getSubElements().add(deploymentFlavorElement);
+
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(deploymentFlavor.getVspId());
+ Optional<Element> savedElement = zusammenAdaptor.saveElement(context,
+ new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor)),
+ deploymentFlavorElements, "Create deloymentFlavor");
+ savedElement.ifPresent(element ->
+ deploymentFlavor.setId(element.getSubElements().iterator().next().getElementId()
+ .getValue()));
+ }
+
+ @Override
+ public void update(DeploymentFlavorEntity deploymentFlavor) {
+ ZusammenElement deploymentFlavorElement = deploymentFlavorToZusammen(deploymentFlavor,
+ Action.UPDATE);
+
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(deploymentFlavor.getVspId());
+ zusammenAdaptor.saveElement(context,
+ new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor)),
+ deploymentFlavorElement, String.format("Update deloymentFlavor with id %s",
+ deploymentFlavor.getId()));
+ }
+
+ @Override
+ public DeploymentFlavorEntity get(DeploymentFlavorEntity deploymentFlavor) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(deploymentFlavor.getVspId());
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor),
+ VspZusammenUtil.getVersionTag(deploymentFlavor.getVersion()));
+
+ Optional<Element> element =
+ zusammenAdaptor.getElement(context, elementContext, deploymentFlavor.getId());
+
+ if (element.isPresent()) {
+ deploymentFlavor.setCompositionData(new String(FileUtils.toByteArray(element.get()
+ .getData())));
+ return deploymentFlavor;
+ }
+ return null;
+ }
+
+ @Override
+ public void delete(DeploymentFlavorEntity deploymentFlavor) {
+ ZusammenElement componentElement = new ZusammenElement();
+ componentElement.setElementId(new Id(deploymentFlavor.getId()));
+ componentElement.setAction(Action.DELETE);
+
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(deploymentFlavor.getVspId());
+ zusammenAdaptor.saveElement(context,
+ new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor)),
+ componentElement, String.format("Delete deloymentFlavor with id %s",
+ deploymentFlavor.getId()));
+ }
+
+ @Override
+ public void deleteAll(String vspId, Version version) {
+ ZusammenElement deploymentFlavorsElement =
+ VspZusammenUtil.buildStructuralElement(StructureElement.DeploymentFlavors, Action.DELETE);
+
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(vspId);
+ zusammenAdaptor.saveElement(context,
+ new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor)),
+ deploymentFlavorsElement, "Delete all deploymentFlavors");
+ }
+
+ private ZusammenElement deploymentFlavorToZusammen(DeploymentFlavorEntity deploymentFlavor,
+ Action action) {
+ ZusammenElement deploymentFlavorElement = buildDeploymentFlavorElement
+ (deploymentFlavor, action);
+
+ return deploymentFlavorElement;
+ }
+
+ /*private ZusammenElement deplymentFlavorQuestionnaireToZusammen(String questionnaireData,
+ Action action) {
+ ZusammenElement questionnaireElement =
+ VspZusammenUtil.buildStructuralElement(StructureElement.Questionnaire, action);
+ questionnaireElement.setData(new ByteArrayInputStream(questionnaireData.getBytes()));
+ return questionnaireElement;
+ }*/
+
+ private ZusammenElement buildDeploymentFlavorElement(DeploymentFlavorEntity deploymentFlavor,
+ Action action) {
+ ZusammenElement deploymentFlavorElement = new ZusammenElement();
+ deploymentFlavorElement.setAction(action);
+ if (deploymentFlavor.getId() != null) {
+ deploymentFlavorElement.setElementId(new Id(deploymentFlavor.getId()));
+ }
+ Info info = new Info();
+ info.addProperty(ElementPropertyName.type.name(), ElementType.DeploymentFlavor);
+ info.addProperty(ElementPropertyName.compositionData.name(), deploymentFlavor
+ .getCompositionData());
+ deploymentFlavorElement.setInfo(info);
+ deploymentFlavorElement.setData(new ByteArrayInputStream(deploymentFlavor.getCompositionData()
+ .getBytes()));
+ return deploymentFlavorElement;
+ }
+
+}
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/dao/impl/zusammen/ElementType.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/ElementType.java
index b0313f5b14..9da0780f73 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/ElementType.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/ElementType.java
@@ -5,5 +5,9 @@ public enum ElementType {
Component,
Nic,
Process,
- LKG
+ Mib,
+ LKG,
+ Compute,
+ DeploymentFlavor,
+ Image
}
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/dao/impl/zusammen/ImageDaoZusammenImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/ImageDaoZusammenImpl.java
new file mode 100644
index 0000000000..d913b18956
--- /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/dao/impl/zusammen/ImageDaoZusammenImpl.java
@@ -0,0 +1,252 @@
+package org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen;
+
+
+import com.amdocs.zusammen.adaptor.inbound.api.types.item.Element;
+import com.amdocs.zusammen.adaptor.inbound.api.types.item.ElementInfo;
+import com.amdocs.zusammen.adaptor.inbound.api.types.item.ZusammenElement;
+import com.amdocs.zusammen.datatypes.Id;
+import com.amdocs.zusammen.datatypes.SessionContext;
+import com.amdocs.zusammen.datatypes.item.Action;
+import com.amdocs.zusammen.datatypes.item.ElementContext;
+import com.amdocs.zusammen.datatypes.item.Info;
+import org.openecomp.core.utilities.file.FileUtils;
+import org.openecomp.core.zusammen.api.ZusammenAdaptor;
+import org.openecomp.core.zusammen.api.ZusammenUtil;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ImageDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ImageEntity;
+import org.openecomp.sdc.versioning.dao.types.Version;
+
+import java.io.ByteArrayInputStream;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+public class ImageDaoZusammenImpl implements ImageDao {
+
+ private ZusammenAdaptor zusammenAdaptor;
+
+ public ImageDaoZusammenImpl(ZusammenAdaptor zusammenAdaptor) {
+ this.zusammenAdaptor = zusammenAdaptor;
+ }
+
+ @Override
+ public void registerVersioning(String versionableEntityType) {
+ }
+
+ @Override
+ public Collection<ImageEntity> list(ImageEntity image) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(image.getVspId());
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor),
+ VspZusammenUtil.getVersionTag(image.getVersion()));
+
+ return listImages(context, elementContext, image);
+ }
+
+ private Collection<ImageEntity> listImages(SessionContext context,
+ ElementContext elementContext, ImageEntity image) {
+ return zusammenAdaptor
+ .listElementsByName(context, elementContext, new Id(image.getComponentId()),
+ StructureElement.Images.name())
+ .stream().map(elementInfo -> mapElementInfoToImage(
+ image.getVspId(), image.getVersion(), image.getComponentId(), elementInfo))
+ .collect(Collectors.toList());
+ }
+
+ private static ImageEntity mapElementInfoToImage(String vspId, Version version,
+ String componentId, ElementInfo elementInfo) {
+ ImageEntity imageEntity =
+ new ImageEntity(vspId, version, componentId, elementInfo.getId().getValue());
+ imageEntity.setCompositionData(
+ elementInfo.getInfo().getProperty(ElementPropertyName.compositionData.name()));
+ return imageEntity;
+ }
+
+ @Override
+ public void create(ImageEntity image) {
+ ZusammenElement imageElement = imageToZusammen(image, Action.CREATE);
+
+ ZusammenElement imagesElement =
+ VspZusammenUtil.buildStructuralElement(StructureElement.Images, null);
+ imagesElement.setSubElements(Collections.singletonList(imageElement));
+
+ ZusammenElement componentElement = new ZusammenElement();
+ componentElement.setElementId(new Id(image.getComponentId()));
+ componentElement.setAction(Action.IGNORE);
+ componentElement.setSubElements(Collections.singletonList(imagesElement));
+
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(image.getVspId());
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor));
+
+ Optional<Element> savedElement =
+ zusammenAdaptor.saveElement(context, elementContext, componentElement, "Create image");
+ savedElement.ifPresent(element ->
+ image.setId(element.getSubElements().iterator().next()
+ .getSubElements().iterator().next().getElementId().getValue()));
+ }
+
+ @Override
+ public void update(ImageEntity image) {
+ ZusammenElement imageElement = imageToZusammen(image, Action.UPDATE);
+
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(image.getVspId());
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor));
+ zusammenAdaptor.saveElement(context, elementContext, imageElement,
+ String.format("Update image with id %s", image.getId()));
+ }
+
+ @Override
+ public ImageEntity get(ImageEntity image) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(image.getVspId());
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor),
+ VspZusammenUtil.getVersionTag(image.getVersion()));
+ Optional<Element> element = zusammenAdaptor.getElement(context, elementContext, image.getId());
+
+ if (element.isPresent()) {
+ image.setCompositionData(new String(FileUtils.toByteArray(element.get().getData())));
+ return image;
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public void delete(ImageEntity image) {
+ ZusammenElement imageElement = new ZusammenElement();
+ imageElement.setElementId(new Id(image.getId()));
+ imageElement.setAction(Action.DELETE);
+
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(image.getVspId());
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor));
+ zusammenAdaptor.saveElement(context, elementContext, imageElement,
+ String.format("Delete image with id %s", image.getId()));
+ }
+
+ @Override
+ public void deleteByVspId(String vspId, Version version) {
+ ZusammenElement imagesElement =
+ VspZusammenUtil.buildStructuralElement(StructureElement.Images, Action.DELETE);
+
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(vspId);
+ zusammenAdaptor.saveElement(context,
+ new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor)),
+ imagesElement, String.format("Delete all images with vsp id %s", vspId));
+ }
+
+ @Override
+ public Collection<ImageEntity> listByVsp(String vspId, Version version) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(vspId);
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor),
+ VspZusammenUtil.getVersionTag(version));
+
+ Collection<ComponentEntity> components = ComponentDaoZusammenImpl
+ .listComponents(zusammenAdaptor, context, elementContext, vspId, version);
+
+ return components.stream()
+ .map(component ->
+ listImages(context, elementContext,
+ new ImageEntity(vspId, version, component.getId(), null)).stream()
+ .map(image -> getQuestionnaire(context, elementContext, image))
+ .collect(Collectors.toList()))
+ .flatMap(Collection::stream)
+ .collect(Collectors.toList());
+ }
+
+ @Override
+ public ImageEntity getQuestionnaireData(String vspId, Version version, String componentId,
+ String imageId) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(vspId);
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor),
+ VspZusammenUtil.getVersionTag(version));
+
+ return getQuestionnaire(context, elementContext,
+ new ImageEntity(vspId, version, componentId, imageId));
+ }
+
+ private ImageEntity getQuestionnaire(SessionContext context, ElementContext elementContext,
+ ImageEntity image) {
+ Optional<Element> questionnaireElement = zusammenAdaptor
+ .getElementByName(context, elementContext, new Id(image.getId()),
+ StructureElement.Questionnaire.name());
+ return questionnaireElement.map(
+ element -> element.getData() == null
+ ? null
+ : new String(FileUtils.toByteArray(element.getData())))
+ .map(questionnaireData -> {
+ image.setQuestionnaireData(questionnaireData);
+ return image;
+ })
+ .orElse(null);
+ }
+
+ @Override
+ public void updateQuestionnaireData(String vspId, Version version, String componentId,
+ String imageId, String questionnaireData) {
+ ZusammenElement questionnaireElement =
+ imageQuestionnaireToZusammen(questionnaireData, Action.UPDATE);
+
+ ZusammenElement imageElement = new ZusammenElement();
+ imageElement.setAction(Action.IGNORE);
+ imageElement.setElementId(new Id(imageId));
+ imageElement.setSubElements(Collections.singletonList(questionnaireElement));
+
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(vspId);
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor));
+ zusammenAdaptor.saveElement(context, elementContext, imageElement, "Update image "
+ + "questionnaire");
+ }
+
+
+
+ private ZusammenElement imageToZusammen(ImageEntity image, Action action) {
+ ZusammenElement imageElement = buildImageElement(image, action);
+ if (action == Action.CREATE) {
+ imageElement.setSubElements(Collections.singletonList(
+ imageQuestionnaireToZusammen(image.getQuestionnaireData(), Action.CREATE)));
+ }
+ return imageElement;
+ }
+
+ private ZusammenElement imageQuestionnaireToZusammen(String questionnaireData,
+ Action action) {
+ ZusammenElement questionnaireElement =
+ VspZusammenUtil.buildStructuralElement(StructureElement.Questionnaire, action);
+ questionnaireElement.setData(new ByteArrayInputStream(questionnaireData.getBytes()));
+ return questionnaireElement;
+ }
+
+ private ZusammenElement buildImageElement(ImageEntity image, Action action) {
+ ZusammenElement imageElement = new ZusammenElement();
+ imageElement.setAction(action);
+ if (image.getId() != null) {
+ imageElement.setElementId(new Id(image.getId()));
+ }
+ Info info = new Info();
+ info.addProperty(ElementPropertyName.type.name(), ElementType.Image);
+ info.addProperty(ElementPropertyName.compositionData.name(), image.getCompositionData());
+ imageElement.setInfo(info);
+ imageElement.setData(new ByteArrayInputStream(image.getCompositionData().getBytes()));
+ return imageElement;
+ }
+
+
+}
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/dao/impl/zusammen/StructureElement.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/StructureElement.java
index 5d53741ebf..6f15f5cdee 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/StructureElement.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/StructureElement.java
@@ -15,6 +15,10 @@ public enum StructureElement {
Mibs,
SNMP_TRAP,
SNMP_POLL,
+ VES_EVENTS,
Questionnaire,
ComponentDependencies,
+ Computes,
+ Images,
+ DeploymentFlavors
}
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/dao/impl/zusammen/VendorSoftwareProductInfoDaoZusammenImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/VendorSoftwareProductInfoDaoZusammenImpl.java
index 65a41330a7..eef90d4742 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/VendorSoftwareProductInfoDaoZusammenImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/VendorSoftwareProductInfoDaoZusammenImpl.java
@@ -1,5 +1,6 @@
package org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen;
+import com.amdocs.zusammen.adaptor.inbound.api.types.item.ElementInfo;
import com.amdocs.zusammen.adaptor.inbound.api.types.item.ZusammenElement;
import com.amdocs.zusammen.datatypes.Id;
import com.amdocs.zusammen.datatypes.SessionContext;
@@ -21,6 +22,7 @@ import org.openecomp.sdc.versioning.types.VersionableEntityStoreType;
import java.io.ByteArrayInputStream;
import java.util.Collection;
import java.util.Date;
+import java.util.Optional;
import java.util.stream.Collectors;
public class VendorSoftwareProductInfoDaoZusammenImpl implements VendorSoftwareProductInfoDao {
@@ -148,6 +150,17 @@ public class VendorSoftwareProductInfoDaoZusammenImpl implements VendorSoftwareP
}
+ @Override
+ public boolean isManual(String vspId, Version version) {
+ final VspDetails vspDetails = get(new VspDetails(vspId, version));
+ if (vspDetails != null) {
+ if ("Manual".equals(vspDetails.getOnboardingMethod())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
private Info mapVspDetailsToZusammenItemInfo(VspDetails vspDetails) {
Info info = new Info();
info.setName(vspDetails.getName());
@@ -186,6 +199,7 @@ public class VendorSoftwareProductInfoDaoZusammenImpl implements VendorSoftwareP
info.addProperty(InfoPropertyName.licenseAgreement.name(), vspDetails.getLicenseAgreement());
info.addProperty(InfoPropertyName.featureGroups.name(), vspDetails.getFeatureGroups());
info.addProperty(InfoPropertyName.oldVersion.name(), vspDetails.getOldVersion());
+ info.addProperty(InfoPropertyName.onboardingMethod.name(), vspDetails.getOnboardingMethod());
}
private VspDetails mapInfoToVspDetails(String vspId, Version version, Info info,
@@ -208,6 +222,8 @@ public class VendorSoftwareProductInfoDaoZusammenImpl implements VendorSoftwareP
//Boolean oldVersion = ind == null || "true".equals( ind.toLowerCase());
vspDetails.setOldVersion(oldVersion);
+ vspDetails.setOnboardingMethod(info.getProperty(InfoPropertyName.onboardingMethod.name()));
+
return vspDetails;
}
@@ -222,7 +238,8 @@ public class VendorSoftwareProductInfoDaoZusammenImpl implements VendorSoftwareP
vendorVersion,
licenseAgreement,
featureGroups,
- oldVersion
+ oldVersion,
+ onboardingMethod
}
}
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 2a50f33349..5284b9a74f 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
@@ -27,6 +27,7 @@ public class VendorSoftwareProductErrorCodes {
public static final String VSP_NOT_FOUND = "VSP_NOT_FOUND";
public static final String VSP_INVALID = "VSP_INVALID";
+ public static final String VFC_INVALID = "VFC_INVALID";
public static final String FAILED_TO_CREATE_VSP = "FAILED_TO_CREATE_VSP";
public static final String UPLOAD_INVALID = "UPLOAD_INVALID";
@@ -46,7 +47,7 @@ public class VendorSoftwareProductErrorCodes {
public static final String TOSCA_INVALID_SUBSTITUTE_NODE_TEMPLATE =
"TOSCA_INVALID_SUBSTITUTE_NODE_TEMPLATE";
- public static final String MIB_UPLOAD_INVALID = "MIB_UPLOAD_INVALID";
+ public static final String MONITORING_UPLOAD_INVALID = "MONITORING_UPLOAD_INVALID";
public static final String ORCHESTRATION_NOT_FOUND = "ORCHESTRATION_NOT_FOUND";
@@ -59,4 +60,65 @@ public class VendorSoftwareProductErrorCodes {
public static final String SAME_SOURCE_TARGET_COMPONENT = "SAME_SOURCE_TARGET_COMPONENT";
+ public static final String VSP_ONBOARD_METHOD_UPDATE_NOT_ALLOWED =
+ "VSP_ONBOARD_METHOD_UPDATE_NOT_ALLOWED";
+
+ public static final String DUPLICATE_NIC_NAME_NOT_ALLOWED = "DUPLICATE_NIC_NAME_NOT_ALLOWED";
+
+ public static final String NULL_NETWORKID_NOT_ALLOWED = "NULL_NETWORKID_NOT_ALLOWED";
+
+ public static final String NETWORKID_NOT_ALLOWED_FOR_EXTERNAL_NETWORK =
+ "NETWORKID_NOT_ALLOWED_FOR_EXTERNAL_NETWORK";
+
+ public static final String VFC_ADD_NOT_ALLOWED_IN_HEAT_ONBOARDING =
+ "VFC_ADD_NOT_ALLOWED_IN_HEAT_ONBOARDING";
+ public static final String VSP_VFC_COUNT_EXCEED = "VSP_VFC_COUNT_EXCEED";
+ public static final String VSP_VFC_DUPLICATE_NAME = "VSP_VFC_DUPLICATE_NAME";
+ public static final String VSP_INVALID_ONBOARDING_METHOD = "VSP_INVALID_ONBOARDING_METHOD";
+ public static final String
+ ADD_NIC_NOT_ALLOWED_IN_HEAT_ONBOARDING = "ADD_NIC_NOT_ALLOWED_IN_HEAT_ONBOARDING";
+ public static final String NETWORK_DESCRIPTION_NOT_ALLOWED_FOR_INTERNAL_NETWORK
+ = "NETWORK_DESCRIPTION_NOT_ALLOWED_FOR_INTERNAL_NETWORK";
+
+ public static final String VFC_ATTRIBUTE_UPDATE_NOT_ALLOWED =
+ "VFC_ATTRIBUTE_UPDATE_NOT_ALLOWED";
+ public static final String NETWORK_TYPE_UPDATE_NOT_ALLOWED
+ = "NETWORK_TYPE_UPDATE_NOT_ALLOWED";
+ public static final String DELETE_NIC_NOT_ALLOWED = "DELETE_NIC_NOT_ALLOWED";
+
+ public static final String CREATE_DEPLOYMENT_FLAVOR_NOT_ALLOWED_IN_HEAT_ONBOARDING =
+ "CREATE_DEPLOYMENT_FLAVOR_NOT_ALLOWED_IN_HEAT_ONBOARDING";
+
+ public static final String DELETE_DEPLOYMENT_FLAVOR_NOT_ALLOWED_IN_HEAT_ONBOARDING =
+ "DELETE_DEPLOYMENT_FLAVOR_NOT_ALLOWED_IN_HEAT_ONBOARDING";
+
+ public static final String EDIT_DEPLOYMENT_FLAVOR_NOT_ALLOWED_IN_HEAT_ONBOARDING =
+ "EDIT_DEPLOYMENT_FLAVOR_NOT_ALLOWED_IN_HEAT_ONBOARDING";
+
+ public static final String FEATUREGROUP_REQUIRED_IN_DEPLOYMENT_FLAVOR =
+ "FEATUREGROUP_REQUIRED_IN_DEPLOYMENT_FLAVOR";
+
+ public static final String
+ 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 VFC_IMAGE_INVALID_FORMAT = "VFC_IMAGE_INVALID_FORMAT";
+ public static final String FEATURE_GROUP_NOT_EXIST_FOR_VSP = "FEATURE_GROUP_NOT_EXIST_FOR_VSP";
+
+ public static final String
+ ADD_COMPUTE_NOT_ALLOWED_IN_HEAT_ONBOARDING = "ADD_COMPUTE_NOT_ALLOWED_IN_HEAT_ONBOARDING";
+ public static final String VFC_COMPUTE_INVALID_FORMAT = "VFC_COMPUTE_INVALID_FORMAT";
+ public static final String UPDATE_COMPUTE_NOT_ALLOWED = "UPDATE_COMPUTE_NOT_ALLOWED";
+ public static final String
+ INVALID_COMPONENT_COMPUTE_ASSOCIATION = "INVALID_COMPONENT_COMPUTE_ASSOCIATION";
+ public static final String SAME_VFC_ASSOCIATION_MORE_THAN_ONCE_NOT_ALLOWED
+ = "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 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 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/factory/impl/CompositionEntityDataManagerFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/factory/impl/CompositionEntityDataManagerFactoryImpl.java
index 9383e41a40..393325d437 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/factory/impl/CompositionEntityDataManagerFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/factory/impl/CompositionEntityDataManagerFactoryImpl.java
@@ -21,8 +21,16 @@
package org.openecomp.sdc.vendorsoftwareproduct.factory.impl;
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.DeploymentFlavorDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.DeploymentFlavorDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ImageDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ImageDaoFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.NetworkDaoFactory;
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.VendorSoftwareProductInfoDaoFactory;
import org.openecomp.sdc.vendorsoftwareproduct.factory.CompositionEntityDataManagerFactory;
import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionEntityDataManager;
@@ -37,6 +45,10 @@ public class CompositionEntityDataManagerFactoryImpl extends CompositionEntityDa
VendorSoftwareProductInfoDaoFactory.getInstance().createInterface(),
ComponentDaoFactory.getInstance().createInterface(),
NicDaoFactory.getInstance().createInterface(),
- NetworkDaoFactory.getInstance().createInterface());
+ NetworkDaoFactory.getInstance().createInterface(),
+ ImageDaoFactory.getInstance().createInterface() ,
+ ComputeDaoFactory.getInstance().createInterface(),
+ DeploymentFlavorDaoFactory.getInstance().createInterface(),
+ VendorSoftwareProductDaoFactory.getInstance().createInterface());
}
}
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 d72a0dbe23..6b55ffc714 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
@@ -20,12 +20,13 @@
package org.openecomp.sdc.vendorsoftwareproduct.services.impl.composition;
+import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
-import org.openecomp.sdc.logging.api.Logger;
-import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.datatypes.error.ErrorLevel;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage;
import org.openecomp.sdc.logging.types.LoggerConstants;
@@ -47,12 +48,14 @@ import org.openecomp.sdc.tosca.errors.ToscaMissingSubstitutionMappingForReqCapEr
import org.openecomp.sdc.tosca.services.ToscaAnalyzerService;
import org.openecomp.sdc.tosca.services.ToscaConstants;
import org.openecomp.sdc.tosca.services.impl.ToscaAnalyzerServiceImpl;
-import org.openecomp.sdc.tosca.services.yamlutil.ToscaExtensionYamlUtil;
+import org.openecomp.sdc.tosca.services.ToscaExtensionYamlUtil;
import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionDataExtractor;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Component;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentData;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionData;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComputeData;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ExtractCompositionDataContext;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Image;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Network;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic;
@@ -60,7 +63,9 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.Optional;
+import java.util.stream.Collectors;
public class CompositionDataExtractorImpl implements CompositionDataExtractor {
@@ -293,6 +298,10 @@ public class CompositionDataExtractorImpl implements CompositionDataExtractor {
if (MapUtils.isEmpty(computeNodeTemplates)) {
return;
}
+ Map<String, List<String>> imageNodeTemplates = getComponentImages(computeNodeTemplates,
+ toscaServiceModel);
+ Map<String, List<String>> computeFlavorNodeTemplates =
+ getComponentComputeFlavor(computeNodeTemplates, toscaServiceModel);
Map<String, NodeTemplate> portNodeTemplates = toscaAnalyzerService
.getNodeTemplatesByType(serviceTemplate, ToscaNodeType.NATIVE_NETWORK_PORT,
toscaServiceModel);
@@ -306,14 +315,90 @@ public class CompositionDataExtractorImpl implements CompositionDataExtractor {
.filter(nodeType ->
!context.getCreatedComponents().contains(nodeType))
.forEach(nodeType -> extractComponent(serviceTemplate, computeToPortsConnection,
- computesGroupedByType, nodeType, context));
+ computesGroupedByType, imageNodeTemplates, computeFlavorNodeTemplates, nodeType,
+ context));
mdcDataDebugMessage.debugExitMessage(null);
}
+ private Map<String,List<String>> getComponentImages(Map<String, NodeTemplate>
+ computeNodeTemplates,
+ ToscaServiceModel toscaServiceModel) {
+ Map<String,List<String>> computeImages = new HashMap<>();
+ for (String component : computeNodeTemplates.keySet()) {
+ List<String> images = new ArrayList<>();
+ Map<String,Object> properties = computeNodeTemplates.get(component).getProperties();
+
+ List<Object> imagesList = properties.entrySet()
+ .stream()
+ .filter(map -> map.getKey().equals("image"))
+ .map(map -> map.getValue())
+ .collect(Collectors.toList());
+ for (Object obj : imagesList) {
+ if (obj instanceof String) {
+ images.add((String) obj);
+ } else {
+ HashMap<String,String> objMap = new ObjectMapper().convertValue(obj,HashMap.class);
+ images.add(getInputs(toscaServiceModel,objMap.get("get_input")));
+ }
+ }
+ computeImages.put(component,images);
+ }
+ return computeImages;
+ }
+
+ private Map<String,List<String>> getComponentComputeFlavor(Map<String, NodeTemplate>
+ computeNodeTemplates,
+ ToscaServiceModel toscaServiceModel) {
+ Map<String,List<String>> componentComputeFlavor = new HashMap<>();
+ for (String component : computeNodeTemplates.keySet()) {
+ List<String> computes = new ArrayList<>();
+ Map<String,Object> properties = computeNodeTemplates.get(component).getProperties();
+
+ List<Object> computessList = properties.entrySet()
+ .stream()
+ .filter(map -> map.getKey().equals("flavor"))
+ .map(map -> map.getValue())
+ .collect(Collectors.toList());
+ for (Object obj : computessList) {
+ if (obj instanceof String) {
+ computes.add((String) obj);
+ } else {
+ HashMap<String, String> objMap = new ObjectMapper().convertValue(obj, HashMap.class);
+ computes.add(getInputs(toscaServiceModel, objMap.get("get_input")));
+ }
+ }
+ componentComputeFlavor.put(component,computes);
+ }
+ return componentComputeFlavor;
+ }
+
+ private String getInputs(ToscaServiceModel toscaServiceModel, String inputValue) {
+ String mainTemplate = toscaServiceModel.getEntryDefinitionServiceTemplate();
+ List<ServiceTemplate> toscaServiceTemplates = toscaServiceModel.getServiceTemplates().entrySet()
+ .stream()
+ .filter(map -> map.getKey().equals(mainTemplate))
+ .map(map -> map.getValue())
+ .collect(Collectors.toList());
+ ServiceTemplate serviceTemplate = toscaServiceTemplates.get(0);
+
+ if (Objects.nonNull(serviceTemplate.getTopology_template())
+ && MapUtils.isNotEmpty(serviceTemplate.getTopology_template().getInputs())) {
+ for (Map.Entry<String, ParameterDefinition> inputEntry : serviceTemplate
+ .getTopology_template().getInputs().entrySet()) {
+ if (inputEntry.getKey().equals(inputValue)) {
+ return (String)inputEntry.getValue().get_default();
+ }
+ }
+ }
+ return inputValue;
+ }
+
private void extractComponent(ServiceTemplate serviceTemplate,
Map<String, List<String>> computeToPortsConnection,
Map<String, List<String>> computesGroupedByType,
+ Map<String, List<String>> imageList,
+ Map<String, List<String>> computeFlavorNodeTemplates,
String computeNodeType,
ExtractCompositionDataContext context) {
ComponentData component = new ComponentData();
@@ -325,14 +410,28 @@ public class CompositionDataExtractorImpl implements CompositionDataExtractor {
String computeId = computesGroupedByType.get(computeNodeType).get(0);
List<String> connectedPortIds = computeToPortsConnection.get(computeId);
+ List<String> images = imageList.get(computeId);
+ List<String> computeFlavors = computeFlavorNodeTemplates.get(computeId);
if (connectedPortIds != null) {
componentModel.setNics(new ArrayList<>());
+ componentModel.setImages(new ArrayList<>());
+ componentModel.setCompute(new ArrayList<>());
for (String portId : connectedPortIds) {
Nic port = extractPort(serviceTemplate, portId);
componentModel.getNics().add(port);
context.addNic(portId, port);
}
+ for (String image : images) {
+ Image img = new Image(image);
+ componentModel.getImages().add(img);
+ context.addImage(image, img);
+ }
+ for (String flavor : computeFlavors) {
+ ComputeData computeFlavor = new ComputeData(flavor);
+ componentModel.getCompute().add(computeFlavor);
+ context.addCompute(flavor,computeFlavor);
+ }
}
context.addComponent(componentModel);
context.getCreatedComponents().add(computeNodeType);
@@ -356,7 +455,6 @@ public class CompositionDataExtractorImpl implements CompositionDataExtractor {
}
}
-
private Map<String, List<String>> getNodeTemplatesGroupedByType(
Map<String, NodeTemplate> nodeTemplates) {
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 c33b2dd3b4..71f5fa1d41 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
@@ -22,6 +22,7 @@ package org.openecomp.sdc.vendorsoftwareproduct.services.impl.composition;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
+import org.openecomp.core.utilities.CommonMethods;
import org.openecomp.core.utilities.json.JsonSchemaDataGenerator;
import org.openecomp.core.utilities.json.JsonUtil;
import org.openecomp.sdc.common.errors.CoreException;
@@ -31,11 +32,18 @@ import org.openecomp.sdc.logging.api.Logger;
import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.DeploymentFlavorDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ImageDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.NetworkDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.CompositionEntity;
+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.NetworkEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
@@ -43,12 +51,17 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspQuestionnaireEntity;
import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionEntityDataManager;
import org.openecomp.sdc.vendorsoftwareproduct.services.schemagenerator.SchemaGenerator;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Component;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentComputeAssociation;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentData;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionData;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityId;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityType;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityValidationData;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComputeData;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.DeploymentFlavor;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Image;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Network;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.NetworkType;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic;
import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateContext;
import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateInput;
@@ -82,14 +95,25 @@ public class CompositionEntityDataManagerImpl implements CompositionEntityDataMa
private ComponentDao componentDao;
private NicDao nicDao;
private NetworkDao networkDao;
+ private ImageDao imageDao;
+ private ComputeDao computeDao;
+ private DeploymentFlavorDao deploymentFlavorDao;
+ private VendorSoftwareProductDao vendorSoftwareProductDao;
public CompositionEntityDataManagerImpl(VendorSoftwareProductInfoDao vspInfoDao,
ComponentDao componentDao,
- NicDao nicDao, NetworkDao networkDao) {
+ NicDao nicDao, NetworkDao networkDao,
+ ImageDao imageDao, ComputeDao computeDao,
+ DeploymentFlavorDao deploymentFlavorDao,
+ VendorSoftwareProductDao vendorSoftwareProductDao ) {
this.vspInfoDao = vspInfoDao;
this.componentDao = componentDao;
this.nicDao = nicDao;
this.networkDao = networkDao;
+ this.imageDao = imageDao;
+ this.computeDao = computeDao;
+ this.deploymentFlavorDao = deploymentFlavorDao;
+ this.vendorSoftwareProductDao = vendorSoftwareProductDao;
}
/**
@@ -200,6 +224,7 @@ 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);
}
@@ -269,6 +294,9 @@ public class CompositionEntityDataManagerImpl implements CompositionEntityDataMa
String componentId = createComponent(componentEntity).getId();
+ saveImagesByComponent(vspId, version, component, componentId);
+ saveComputesFlavorByComponent(vspId, version, component, componentId);
+
saveNicsByComponent(vspId, version, networkIdByName, component, componentId);
}
}
@@ -285,6 +313,8 @@ public class CompositionEntityDataManagerImpl implements CompositionEntityDataMa
nic.setNetworkId(networkIdByName.get(nic.getNetworkName()));
}
nic.setNetworkName(null);
+ //For heat flow set network type to be internal by default for NIC
+ nic.setNetworkType(NetworkType.Internal);
NicEntity nicEntity = new NicEntity(vspId, version, componentId, null);
nicEntity.setNicCompositionData(nic);
@@ -592,4 +622,104 @@ public class CompositionEntityDataManagerImpl implements CompositionEntityDataMa
return SchemaGenerator
.generate(schemaTemplateContext, compositionEntityType, schemaTemplateInput);
}
+
+ @Override
+ public DeploymentFlavorEntity createDeploymentFlavor(DeploymentFlavorEntity deploymentFlavor) {
+ mdcDataDebugMessage.debugEntryMessage(null, null);
+
+ deploymentFlavor.setId(CommonMethods.nextUuId());
+ deploymentFlavorDao.create(deploymentFlavor);
+ return deploymentFlavor;
+ }
+
+ @Override
+ public ImageEntity createImage(ImageEntity image) {
+ mdcDataDebugMessage.debugEntryMessage(null, null);
+
+ image.setId(CommonMethods.nextUuId());
+
+ image.setQuestionnaireData(
+ new JsonSchemaDataGenerator(SchemaGenerator
+ .generate(SchemaTemplateContext.questionnaire, CompositionEntityType.image, null))
+ .generateData());
+
+ imageDao.create(image);
+ mdcDataDebugMessage.debugExitMessage(null, null);
+ return image;
+ }
+
+ @Override
+ public ComputeEntity createCompute(ComputeEntity compute) {
+ mdcDataDebugMessage.debugEntryMessage("VSP id, component id", compute.getVspId(),
+ compute.getComponentId());
+
+ compute.setId(CommonMethods.nextUuId());
+ compute.setQuestionnaireData(
+ new JsonSchemaDataGenerator(SchemaGenerator
+ .generate(SchemaTemplateContext.questionnaire, CompositionEntityType.compute,
+ null)).generateData());
+
+ computeDao.create(compute);
+
+ mdcDataDebugMessage.debugExitMessage("VSP id, component id", compute.getVspId(),
+ compute.getComponentId());
+ return compute;
+ }
+
+ public void saveComputesFlavorByComponent(String vspId, Version version, Component component, String
+ componentId) {
+ if (CollectionUtils.isNotEmpty(component.getCompute())) {
+ for (ComputeData flavor : component.getCompute()) {
+ ComputeEntity computeEntity = new ComputeEntity(vspId, version, componentId, null);
+ computeEntity.setComputeCompositionData(flavor);
+ createCompute(computeEntity);
+ }
+ }
+ }
+
+ public void saveImagesByComponent(String vspId, Version version, Component component, String
+ componentId) {
+ if (CollectionUtils.isNotEmpty(component.getImages())) {
+ for (Image img : component.getImages()) {
+ ImageEntity imageEntity = new ImageEntity(vspId, version, componentId, null);
+ imageEntity.setImageCompositionData(img);
+ createImage(imageEntity);
+ }
+ }
+ }
+
+ 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/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/filedatastructuremodule/CandidateServiceImpl.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/filedatastructuremodule/CandidateServiceImpl.java
index e05c848452..6ccece1e76 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/filedatastructuremodule/CandidateServiceImpl.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/filedatastructuremodule/CandidateServiceImpl.java
@@ -71,553 +71,560 @@ import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream;
public class CandidateServiceImpl implements CandidateService {
- protected static final Logger logger = LoggerFactory.getLogger(CandidateServiceImpl.class);
- private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
+ protected static final Logger logger = LoggerFactory.getLogger(CandidateServiceImpl.class);
+ private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
- private CandidateServiceValidator candidateServiceValidator = new CandidateServiceValidator();
- private ManifestCreator manifestCreator;
- private OrchestrationTemplateCandidateDao orchestrationTemplateCandidateDataDao;
+ private CandidateServiceValidator candidateServiceValidator = new CandidateServiceValidator();
+ private ManifestCreator manifestCreator;
+ private OrchestrationTemplateCandidateDao orchestrationTemplateCandidateDataDao;
- public CandidateServiceImpl(ManifestCreator manifestCreator,
- OrchestrationTemplateCandidateDao orchestrationTemplateCandidateDataDao) {
- this.manifestCreator = manifestCreator;
- this.orchestrationTemplateCandidateDataDao = orchestrationTemplateCandidateDataDao;
+ public CandidateServiceImpl(ManifestCreator manifestCreator,
+ OrchestrationTemplateCandidateDao orchestrationTemplateCandidateDataDao) {
+ this.manifestCreator = manifestCreator;
+ this.orchestrationTemplateCandidateDataDao = orchestrationTemplateCandidateDataDao;
- }
+ }
- public CandidateServiceImpl() {
- }
+ public CandidateServiceImpl() {
+ }
- @Override
- public Optional<ErrorMessage> validateNonEmptyFileToUpload(InputStream heatFileToUpload) {
+ @Override
+ public Optional<ErrorMessage> validateNonEmptyFileToUpload(InputStream heatFileToUpload) {
- mdcDataDebugMessage.debugEntryMessage(null);
+ mdcDataDebugMessage.debugEntryMessage(null);
- if (Objects.isNull(heatFileToUpload)) {
- return Optional.of(new ErrorMessage(ErrorLevel.ERROR,
- Messages.NO_ZIP_FILE_WAS_UPLOADED_OR_ZIP_NOT_EXIST.getErrorMessage()));
- } else {
- try {
- int available = heatFileToUpload.available();
- if (available == 0) {
- mdcDataDebugMessage.debugExitMessage(null);
- return Optional.of(new ErrorMessage(ErrorLevel.ERROR,
- Messages.NO_ZIP_FILE_WAS_UPLOADED_OR_ZIP_NOT_EXIST.getErrorMessage()));
+ if (Objects.isNull(heatFileToUpload)) {
+ return Optional.of(new ErrorMessage(ErrorLevel.ERROR,
+ Messages.NO_ZIP_FILE_WAS_UPLOADED_OR_ZIP_NOT_EXIST.getErrorMessage()));
+ } else {
+ try {
+ int available = heatFileToUpload.available();
+ if (available == 0) {
+ mdcDataDebugMessage.debugExitMessage(null);
+ return Optional.of(new ErrorMessage(ErrorLevel.ERROR,
+ Messages.NO_ZIP_FILE_WAS_UPLOADED_OR_ZIP_NOT_EXIST.getErrorMessage()));
+ }
+ } catch (IOException e) {
+ mdcDataDebugMessage.debugExitMessage(null);
+ return Optional.of(new ErrorMessage(ErrorLevel.ERROR,
+ Messages.NO_ZIP_FILE_WAS_UPLOADED_OR_ZIP_NOT_EXIST.getErrorMessage()));
+ }
}
- } catch (IOException e) {
+
mdcDataDebugMessage.debugExitMessage(null);
- return Optional.of(new ErrorMessage(ErrorLevel.ERROR,
- Messages.NO_ZIP_FILE_WAS_UPLOADED_OR_ZIP_NOT_EXIST.getErrorMessage()));
- }
+ return Optional.empty();
}
- mdcDataDebugMessage.debugExitMessage(null);
- return Optional.empty();
- }
-
- @Override
- public Optional<ErrorMessage> validateRawZipData(byte[] uploadedFileData) {
- if (Objects.isNull(uploadedFileData)) {
- return Optional.of(new ErrorMessage(ErrorLevel.ERROR,
- Messages.NO_ZIP_FILE_WAS_UPLOADED_OR_ZIP_NOT_EXIST.getErrorMessage()));
- }
- return Optional.empty();
- }
-
- private String heatStructureTreeToFileDataStructure(HeatStructureTree tree,
- FileContentHandler zipContentMap,
- Map<String, List<ErrorMessage>> uploadErrors,
- AnalyzedZipHeatFiles analyzedZipHeatFiles)
- throws Exception {
- FilesDataStructure structure = new FilesDataStructure();
- Set<String> usedEnvFiles = new HashSet<>();
- addHeatsToFileDataStructure(tree, usedEnvFiles, structure, uploadErrors,
- analyzedZipHeatFiles);
- handleOtherResources(tree, usedEnvFiles, structure);
- FilesDataStructure fileDataStructureFromManifest =
- createFileDataStructureFromManifest(zipContentMap.getFileContent
- (SdcCommon.MANIFEST_NAME));
- List<String> structureArtifacts = structure.getArtifacts();
- structureArtifacts.addAll(fileDataStructureFromManifest.getArtifacts().stream().filter
- (artifact -> !structureArtifacts.contains(artifact)).collect((Collectors.toList())));
- handleArtifactsFromTree(tree, structure);
-
- return JsonUtil.object2Json(structure);
- }
-
- @Override
- public OrchestrationTemplateCandidateData createCandidateDataEntity(
- CandidateDataEntityTo candidateDataEntityTo, InputStream zipFileManifest,
- AnalyzedZipHeatFiles analyzedZipHeatFiles) throws Exception {
-
-
- mdcDataDebugMessage.debugEntryMessage(null);
-
- FileContentHandler zipContentMap = candidateDataEntityTo.getContentMap();
- FilesDataStructure filesDataStructure;
- String dataStructureJson;
-
- if (zipFileManifest != null) {
- // create data structure from manifest
- filesDataStructure = createFileDataStructureFromManifest(zipFileManifest);
- Set<String> zipFileList = zipContentMap.getFileList();
- balanceManifestFilesWithZipFiles(filesDataStructure,
- zipContentMap, analyzedZipHeatFiles);
- Set<String> filesDataStructureFiles = getFlatFileNames(filesDataStructure);
- filesDataStructure.getUnassigned().addAll(zipFileList.stream()
- .filter(fileName -> (!filesDataStructureFiles.contains(fileName) &&
- !filesDataStructure.getNested().contains(fileName) &&
- !fileName.equals(SdcCommon.MANIFEST_NAME)))
- .collect(Collectors.toList()));
- dataStructureJson = JsonUtil.object2Json(filesDataStructure);
- } else {
- // create data structure from based on naming convention
- dataStructureJson =
- heatStructureTreeToFileDataStructure(candidateDataEntityTo.getTree(), zipContentMap,
- candidateDataEntityTo.getErrors(), analyzedZipHeatFiles);
- }
-
- mdcDataDebugMessage.debugExitMessage(null);
- return new OrchestrationTemplateCandidateData(
- ByteBuffer.wrap(candidateDataEntityTo.getUploadedFileData()), dataStructureJson);
- }
-
- private void balanceManifestFilesWithZipFiles(
- FilesDataStructure filesDataStructure,
- FileContentHandler fileContentHandler, AnalyzedZipHeatFiles analyzedZipHeatFiles)
- throws Exception {
- Set<String> zipFileList = fileContentHandler.getFileList();
- filesDataStructure.getNested().addAll(analyzedZipHeatFiles.getNestedFiles());
- List<Module> modules = filesDataStructure.getModules();
- if (CollectionUtils.isEmpty(modules)) {
- return;
- }
-
- for (int i = 0; i < modules.size(); i++) {
- Module module = modules.get(i);
- if (!isFileExistInZipContains(zipFileList, module.getYaml())) {
- addFileToUnassigned(filesDataStructure, zipFileList, module.getEnv());
- addFileToUnassigned(filesDataStructure, zipFileList, module.getVol());
- addFileToUnassigned(filesDataStructure, zipFileList, module.getVolEnv());
- modules.remove(i--);
- } else if (Objects.nonNull(module.getVol()) && !zipFileList.contains(module.getVol())) {
- module.setVol(null);
- CollectionUtils.addIgnoreNull(filesDataStructure.getUnassigned(), module.getVolEnv());
- } else {
- if (filesDataStructure.getNested().contains(module.getYaml())) {
- moveModuleFileToNested(filesDataStructure, i--, module);
+ @Override
+ public Optional<ErrorMessage> validateRawZipData(byte[] uploadedFileData) {
+ if (Objects.isNull(uploadedFileData)) {
+ return Optional.of(new ErrorMessage(ErrorLevel.ERROR,
+ Messages.NO_ZIP_FILE_WAS_UPLOADED_OR_ZIP_NOT_EXIST.getErrorMessage()));
}
- }
+ return Optional.empty();
}
- }
- private void addFileToUnassigned(FilesDataStructure filesDataStructure, Set<String> zipFileList,
- String fileName) {
- if (isFileExistInZipContains(zipFileList, fileName)) {
- filesDataStructure.getUnassigned().add(fileName);
+ private String heatStructureTreeToFileDataStructure(HeatStructureTree tree,
+ FileContentHandler zipContentMap,
+ Map<String, List<ErrorMessage>> uploadErrors,
+ AnalyzedZipHeatFiles analyzedZipHeatFiles)
+ throws Exception {
+ FilesDataStructure structure = new FilesDataStructure();
+ Set<String> usedEnvFiles = new HashSet<>();
+ addHeatsToFileDataStructure(tree, usedEnvFiles, structure, uploadErrors,
+ analyzedZipHeatFiles);
+ handleOtherResources(tree, usedEnvFiles, structure);
+ FilesDataStructure fileDataStructureFromManifest =
+ createFileDataStructureFromManifest(zipContentMap.getFileContent
+ (SdcCommon.MANIFEST_NAME));
+ List<String> structureArtifacts = structure.getArtifacts();
+ structureArtifacts.addAll(fileDataStructureFromManifest.getArtifacts().stream().filter
+ (artifact -> !structureArtifacts.contains(artifact)).collect((Collectors.toList())));
+ handleArtifactsFromTree(tree, structure);
+
+ return JsonUtil.object2Json(structure);
}
- }
- private boolean isFileExistInZipContains(Set<String> zipFileList, String fileName) {
- return Objects.nonNull(fileName) && zipFileList.contains(fileName);
- }
+ @Override
+ public OrchestrationTemplateCandidateData createCandidateDataEntity(
+ CandidateDataEntityTo candidateDataEntityTo, InputStream zipFileManifest,
+ AnalyzedZipHeatFiles analyzedZipHeatFiles) throws Exception {
+
+
+ mdcDataDebugMessage.debugEntryMessage(null);
+
+ FileContentHandler zipContentMap = candidateDataEntityTo.getContentMap();
+ FilesDataStructure filesDataStructure;
+ String dataStructureJson;
+
+ if (zipFileManifest != null) {
+ // create data structure from manifest
+ filesDataStructure = createFileDataStructureFromManifest(zipFileManifest);
+ Set<String> zipFileList = zipContentMap.getFileList();
+ balanceManifestFilesWithZipFiles(filesDataStructure,
+ zipContentMap, analyzedZipHeatFiles);
+ Set<String> filesDataStructureFiles = getFlatFileNames(filesDataStructure);
+ filesDataStructure.getUnassigned().addAll(zipFileList.stream()
+ .filter(fileName -> (!filesDataStructureFiles.contains(fileName) &&
+ !filesDataStructure.getNested().contains(fileName) &&
+ !fileName.equals(SdcCommon.MANIFEST_NAME)))
+ .collect(Collectors.toList()));
+ dataStructureJson = JsonUtil.object2Json(filesDataStructure);
+ } else {
+ // create data structure from based on naming convention
+ dataStructureJson =
+ heatStructureTreeToFileDataStructure(candidateDataEntityTo.getTree(), zipContentMap,
+ candidateDataEntityTo.getErrors(), analyzedZipHeatFiles);
+ }
- private void moveModuleFileToNested(FilesDataStructure filesDataStructure, int i, Module module) {
- if (!filesDataStructure.getNested().contains(module.getYaml())) {
- filesDataStructure.getNested().add(module.getYaml());
+ mdcDataDebugMessage.debugExitMessage(null);
+ return new OrchestrationTemplateCandidateData(
+ ByteBuffer.wrap(candidateDataEntityTo.getUploadedFileData()), dataStructureJson);
}
- if (Objects.nonNull(module.getEnv())) {
- filesDataStructure.getNested().add(module.getEnv());
+
+ private void balanceManifestFilesWithZipFiles(
+ FilesDataStructure filesDataStructure,
+ FileContentHandler fileContentHandler, AnalyzedZipHeatFiles analyzedZipHeatFiles)
+ throws Exception {
+ Set<String> zipFileList = fileContentHandler.getFileList();
+ filesDataStructure.getNested().addAll(analyzedZipHeatFiles.getNestedFiles());
+ List<Module> modules = filesDataStructure.getModules();
+ if (CollectionUtils.isEmpty(modules)) {
+ return;
+ }
+
+ for (int i = 0; i < modules.size(); i++) {
+ Module module = modules.get(i);
+ if (!isFileExistInZipContains(zipFileList, module.getYaml())) {
+ addFileToUnassigned(filesDataStructure, zipFileList, module.getEnv());
+ addFileToUnassigned(filesDataStructure, zipFileList, module.getVol());
+ addFileToUnassigned(filesDataStructure, zipFileList, module.getVolEnv());
+ modules.remove(i--);
+ } else if (Objects.nonNull(module.getVol()) && !zipFileList.contains(module.getVol())) {
+ module.setVol(null);
+ CollectionUtils
+ .addIgnoreNull(filesDataStructure.getUnassigned(), module.getVolEnv());
+ } else {
+ if (filesDataStructure.getNested().contains(module.getYaml())) {
+ moveModuleFileToNested(filesDataStructure, i--, module);
+ }
+ }
+ }
}
- if (Objects.nonNull(module.getVol())) {
- filesDataStructure.getNested().add(module.getVol());
+
+ private void addFileToUnassigned(FilesDataStructure filesDataStructure, Set<String> zipFileList,
+ String fileName) {
+ if (isFileExistInZipContains(zipFileList, fileName)) {
+ filesDataStructure.getUnassigned().add(fileName);
+ }
}
- if (Objects.nonNull(module.getVolEnv())) {
- filesDataStructure.getNested().add(module.getVolEnv());
+
+ private boolean isFileExistInZipContains(Set<String> zipFileList, String fileName) {
+ return Objects.nonNull(fileName) && zipFileList.contains(fileName);
}
- filesDataStructure.getModules().remove(i);
- }
- private Set<String> getFlatFileNames(FilesDataStructure filesDataStructure) {
- Set<String> fileNames = new HashSet<>();
- if (!CollectionUtils.isEmpty(filesDataStructure.getModules())) {
- for (Module module : filesDataStructure.getModules()) {
- CollectionUtils.addIgnoreNull(fileNames, module.getEnv());
- CollectionUtils.addIgnoreNull(fileNames, module.getVol());
- CollectionUtils.addIgnoreNull(fileNames, module.getVolEnv());
- CollectionUtils.addIgnoreNull(fileNames, module.getYaml());
- }
+ private void moveModuleFileToNested(FilesDataStructure filesDataStructure, int i,
+ Module module) {
+ if (!filesDataStructure.getNested().contains(module.getYaml())) {
+ filesDataStructure.getNested().add(module.getYaml());
+ }
+ if (Objects.nonNull(module.getEnv())) {
+ filesDataStructure.getNested().add(module.getEnv());
+ }
+ if (Objects.nonNull(module.getVol())) {
+ filesDataStructure.getNested().add(module.getVol());
+ }
+ if (Objects.nonNull(module.getVolEnv())) {
+ filesDataStructure.getNested().add(module.getVolEnv());
+ }
+ filesDataStructure.getModules().remove(i);
}
- fileNames.addAll(filesDataStructure.getArtifacts().stream().collect(Collectors.toSet()));
- fileNames.addAll(filesDataStructure.getNested().stream().collect(Collectors.toSet()));
- fileNames.addAll(filesDataStructure.getUnassigned().stream().collect(Collectors.toSet()));
- return fileNames;
- }
+ private Set<String> getFlatFileNames(FilesDataStructure filesDataStructure) {
+ Set<String> fileNames = new HashSet<>();
+ if (!CollectionUtils.isEmpty(filesDataStructure.getModules())) {
+ for (Module module : filesDataStructure.getModules()) {
+ CollectionUtils.addIgnoreNull(fileNames, module.getEnv());
+ CollectionUtils.addIgnoreNull(fileNames, module.getVol());
+ CollectionUtils.addIgnoreNull(fileNames, module.getVolEnv());
+ CollectionUtils.addIgnoreNull(fileNames, module.getYaml());
+ }
+ }
+ fileNames.addAll(filesDataStructure.getArtifacts().stream().collect(Collectors.toSet()));
+ fileNames.addAll(filesDataStructure.getNested().stream().collect(Collectors.toSet()));
+ fileNames.addAll(filesDataStructure.getUnassigned().stream().collect(Collectors.toSet()));
+
+ return fileNames;
+ }
- private FilesDataStructure createFileDataStructureFromManifest(InputStream isManifestContent) {
+ private FilesDataStructure createFileDataStructureFromManifest(InputStream isManifestContent) {
+
+
+ mdcDataDebugMessage.debugEntryMessage(null);
+
+ ManifestContent manifestContent =
+ JsonUtil.json2Object(isManifestContent, ManifestContent.class);
+ FilesDataStructure structure = new FilesDataStructure();
+ for (FileData fileData : manifestContent.getData()) {
+ if (Objects.nonNull(fileData.getType()) &&
+ fileData.getType().equals(FileData.Type.HEAT)) {
+ Module module = new Module();
+ module.setYaml(fileData.getFile());
+ module.setIsBase(fileData.getBase());
+ addHeatDependenciesToModule(module, fileData.getData());
+ structure.getModules().add(module);
+ } else if (HeatFileAnalyzer.isYamlOrEnvFile(fileData.getFile()) &&
+ !FileData.Type.isArtifact(fileData.getType())) {
+ structure.getUnassigned().add(fileData.getFile());
+ } else {
+ structure.getArtifacts().add(fileData.getFile());
+ }
+ }
+ mdcDataDebugMessage.debugExitMessage(null);
+ return structure;
+ }
- mdcDataDebugMessage.debugEntryMessage(null);
+ private void addHeatDependenciesToModule(Module module, List<FileData> data) {
+ if (CollectionUtils.isEmpty(data)) {
+ return;
+ }
- ManifestContent manifestContent =
- JsonUtil.json2Object(isManifestContent, ManifestContent.class);
- FilesDataStructure structure = new FilesDataStructure();
- for (FileData fileData : manifestContent.getData()) {
- if (Objects.nonNull(fileData.getType()) && fileData.getType().equals(FileData.Type.HEAT)) {
- Module module = new Module();
- module.setYaml(fileData.getFile());
- module.setIsBase(fileData.getBase());
- addHeatDependenciesToModule(module, fileData.getData());
- structure.getModules().add(module);
- } else if (HeatFileAnalyzer.isYamlOrEnvFile(fileData.getFile()) &&
- !FileData.Type.isArtifact(fileData.getType())) {
- structure.getUnassigned().add(fileData.getFile());
- } else {
- structure.getArtifacts().add(fileData.getFile());
- }
- }
-
- mdcDataDebugMessage.debugExitMessage(null);
- return structure;
- }
-
- private void addHeatDependenciesToModule(Module module, List<FileData> data) {
- if (CollectionUtils.isEmpty(data)) {
- return;
- }
-
- for (FileData fileData : data) {
- if (fileData.getType().equals(FileData.Type.HEAT_ENV)) {
- module.setEnv(fileData.getFile());
- } else if (fileData.getType().equals(FileData.Type.HEAT_VOL))// must be volume
- {
- module.setVol(fileData.getFile());
- if (!CollectionUtils.isEmpty(fileData.getData())) {
- FileData volEnv = fileData.getData().get(0);
- if (volEnv.getType().equals(FileData.Type.HEAT_ENV)) {
- module.setVolEnv(volEnv.getFile());
- } else {
- throw new CoreException((new ErrorCode.ErrorCodeBuilder())
- .withMessage(Messages.ILLEGAL_MANIFEST.getErrorMessage())
- .withId(Messages.ILLEGAL_MANIFEST.getErrorMessage())
- .withCategory(ErrorCategory.APPLICATION).build());
- }
+ for (FileData fileData : data) {
+ if (fileData.getType().equals(FileData.Type.HEAT_ENV)) {
+ module.setEnv(fileData.getFile());
+ } else if (fileData.getType().equals(FileData.Type.HEAT_VOL))// must be volume
+ {
+ module.setVol(fileData.getFile());
+ if (!CollectionUtils.isEmpty(fileData.getData())) {
+ FileData volEnv = fileData.getData().get(0);
+ if (volEnv.getType().equals(FileData.Type.HEAT_ENV)) {
+ module.setVolEnv(volEnv.getFile());
+ } else {
+ throw new CoreException((new ErrorCode.ErrorCodeBuilder())
+ .withMessage(Messages.ILLEGAL_MANIFEST.getErrorMessage())
+ .withId(Messages.ILLEGAL_MANIFEST.getErrorMessage())
+ .withCategory(ErrorCategory.APPLICATION).build());
+ }
+ }
+ } else {
+ throw new CoreException((new ErrorCode.ErrorCodeBuilder())
+ .withMessage(Messages.FILE_TYPE_NOT_LEGAL.getErrorMessage())
+ .withId(Messages.FILE_TYPE_NOT_LEGAL.getErrorMessage())
+ .withCategory(ErrorCategory.APPLICATION).build());
+ }
}
- } else {
- throw new CoreException((new ErrorCode.ErrorCodeBuilder())
- .withMessage(Messages.FILE_TYPE_NOT_LEGAL.getErrorMessage())
- .withId(Messages.FILE_TYPE_NOT_LEGAL.getErrorMessage())
- .withCategory(ErrorCategory.APPLICATION).build());
- }
}
- }
- @Override
- public void updateCandidateUploadData(OrchestrationTemplateCandidateData uploadData,
- String itemId) {
- mdcDataDebugMessage.debugEntryMessage(null);
+ @Override
+ public void updateCandidateUploadData(OrchestrationTemplateCandidateData uploadData,
+ String itemId) {
+ mdcDataDebugMessage.debugEntryMessage(null);
- //vendorSoftwareProductDao.updateCandidateUploadData(uploadData);
- orchestrationTemplateCandidateDataDao.update(itemId, uploadData);
+ //vendorSoftwareProductDao.updateCandidateUploadData(uploadData);
+ orchestrationTemplateCandidateDataDao.update(itemId, uploadData);
- mdcDataDebugMessage.debugExitMessage(null);
- }
+ mdcDataDebugMessage.debugExitMessage(null);
+ }
- @Override
- public Optional<FilesDataStructure> getOrchestrationTemplateCandidateFileDataStructure(
- String vspId, Version version) {
+ @Override
+ public Optional<FilesDataStructure> getOrchestrationTemplateCandidateFileDataStructure(
+ String vspId, Version version) {
- mdcDataDebugMessage.debugEntryMessage("VSP Id", vspId);
+ mdcDataDebugMessage.debugEntryMessage("VSP Id", vspId);
- Optional<String> jsonFileDataStructure =
- orchestrationTemplateCandidateDataDao.getStructure(vspId, version);
+ Optional<String> jsonFileDataStructure =
+ orchestrationTemplateCandidateDataDao.getStructure(vspId, version);
- if (jsonFileDataStructure.isPresent()) {
- mdcDataDebugMessage.debugExitMessage("VSP Id", vspId);
- return Optional
- .of(JsonUtil.json2Object(jsonFileDataStructure.get(), FilesDataStructure.class));
- } else {
- mdcDataDebugMessage.debugExitMessage("VSP Id", vspId);
- return Optional.empty();
+ if (jsonFileDataStructure.isPresent()) {
+ mdcDataDebugMessage.debugExitMessage("VSP Id", vspId);
+ return Optional
+ .of(JsonUtil.json2Object(jsonFileDataStructure.get(), FilesDataStructure.class));
+ } else {
+ mdcDataDebugMessage.debugExitMessage("VSP Id", vspId);
+ return Optional.empty();
+ }
}
- }
- @Override
- public void updateOrchestrationTemplateCandidateFileDataStructure(String vspId, Version version,
- FilesDataStructure fileDataStructure) {
- OrchestrationTemplateCandidateDaoFactory.getInstance().createInterface()
- .updateStructure(vspId, version, fileDataStructure);
- }
+ @Override
+ public void updateOrchestrationTemplateCandidateFileDataStructure(String vspId, Version version,
+ FilesDataStructure fileDataStructure) {
+ OrchestrationTemplateCandidateDaoFactory.getInstance().createInterface()
+ .updateStructure(vspId, version, fileDataStructure);
+ }
- @Override
- public OrchestrationTemplateCandidateData getOrchestrationTemplateCandidate(String vspId,
- Version version) {
- mdcDataDebugMessage.debugEntryMessage("VSP Id", vspId);
- mdcDataDebugMessage.debugExitMessage("VSP Id", vspId);
+ @Override
+ public OrchestrationTemplateCandidateData getOrchestrationTemplateCandidate(String vspId,
+ Version version) {
+ mdcDataDebugMessage.debugEntryMessage("VSP Id", vspId);
+ mdcDataDebugMessage.debugExitMessage("VSP Id", vspId);
- return orchestrationTemplateCandidateDataDao.get(vspId, version);
- }
+ return orchestrationTemplateCandidateDataDao.get(vspId, version);
+ }
@Override
public String createManifest(VspDetails vspDetails, FilesDataStructure structure) {
- mdcDataDebugMessage.debugEntryMessage("VSP Id", vspDetails.getId());
+ mdcDataDebugMessage.debugEntryMessage("VSP Id", vspDetails.getId());
- Optional<ManifestContent> manifest = manifestCreator.createManifest(vspDetails, structure);
- if (!manifest.isPresent()) {
- throw new RuntimeException(Messages.CREATE_MANIFEST_FROM_ZIP.getErrorMessage());
+ Optional<ManifestContent> manifest = manifestCreator.createManifest(vspDetails, structure);
+ if (!manifest.isPresent()) {
+ throw new RuntimeException(Messages.CREATE_MANIFEST_FROM_ZIP.getErrorMessage());
+ }
+
+ mdcDataDebugMessage.debugExitMessage("VSP Id", vspDetails.getId());
+ return JsonUtil.object2Json(manifest.get());
}
- mdcDataDebugMessage.debugExitMessage("VSP Id", vspDetails.getId());
- return JsonUtil.object2Json(manifest.get());
- }
+ @Override
+ public Optional<ManifestContent> createManifest(VspDetails vspDetails,
+ FileContentHandler fileContentHandler,
+ AnalyzedZipHeatFiles analyzedZipHeatFiles) {
- @Override
- public Optional<ManifestContent> createManifest(VspDetails vspDetails,
- FileContentHandler fileContentHandler,
- AnalyzedZipHeatFiles analyzedZipHeatFiles) {
+ mdcDataDebugMessage.debugEntryMessage("VSP Id", vspDetails.getId());
- mdcDataDebugMessage.debugEntryMessage("VSP Id", vspDetails.getId());
+ mdcDataDebugMessage.debugExitMessage("VSP Id", vspDetails.getId());
+ return manifestCreator.createManifest(vspDetails, fileContentHandler, analyzedZipHeatFiles);
+ }
- mdcDataDebugMessage.debugExitMessage("VSP Id", vspDetails.getId());
- return manifestCreator.createManifest(vspDetails, fileContentHandler, analyzedZipHeatFiles);
- }
+ @Override
+ public Optional<ByteArrayInputStream> fetchZipFileByteArrayInputStream(String vspId,
+ OrchestrationTemplateCandidateData candidateDataEntity,
+ String manifest,
+ Map<String, List<ErrorMessage>> uploadErrors) {
+ byte[] file;
+ ByteArrayInputStream byteArrayInputStream = null;
+ try {
+ file = replaceManifestInZip(candidateDataEntity.getContentData(), manifest, vspId);
+ byteArrayInputStream = new ByteArrayInputStream(
+ Objects.isNull(file) ? candidateDataEntity.getContentData().array()
+ : file);
+ } catch (IOException e) {
+ ErrorMessage errorMessage =
+ new ErrorMessage(ErrorLevel.ERROR,
+ Messages.CANDIDATE_PROCESS_FAILED.getErrorMessage());
+ logger.error(errorMessage.getMessage(), e);
+ ErrorsUtil
+ .addStructureErrorToErrorMap(SdcCommon.UPLOAD_FILE, errorMessage, uploadErrors);
+ }
+ return Optional.ofNullable(byteArrayInputStream);
+ }
- @Override
- public Optional<ByteArrayInputStream> fetchZipFileByteArrayInputStream(String vspId,
- OrchestrationTemplateCandidateData candidateDataEntity,
- String manifest,
- Map<String, List<ErrorMessage>> uploadErrors) {
- byte[] file;
- ByteArrayInputStream byteArrayInputStream = null;
- try {
- file = replaceManifestInZip(candidateDataEntity.getContentData(), manifest, vspId);
- byteArrayInputStream = new ByteArrayInputStream(
- Objects.isNull(file) ? candidateDataEntity.getContentData().array()
- : file);
- } catch (IOException e) {
- ErrorMessage errorMessage =
- new ErrorMessage(ErrorLevel.ERROR, Messages.CANDIDATE_PROCESS_FAILED.getErrorMessage());
- logger.error(errorMessage.getMessage(), e);
- ErrorsUtil.addStructureErrorToErrorMap(SdcCommon.UPLOAD_FILE, errorMessage, uploadErrors);
- }
- return Optional.ofNullable(byteArrayInputStream);
- }
+ @Override
+ public byte[] replaceManifestInZip(ByteBuffer contentData, String manifest, String vspId)
+ throws IOException {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+ try (final ZipOutputStream zos = new ZipOutputStream(baos);
+ ZipInputStream zipStream = new ZipInputStream(
+ new ByteArrayInputStream(contentData.array()))) {
+ ZipEntry zipEntry;
+ boolean manifestWritten = false;
+ while ((zipEntry = zipStream.getNextEntry()) != null) {
+ if (!zipEntry.getName().equalsIgnoreCase(SdcCommon.MANIFEST_NAME)) {
+ ZipEntry loc_ze = new ZipEntry(zipEntry.getName());
+ zos.putNextEntry(loc_ze);
+ byte[] buf = new byte[1024];
+ int len;
+ while ((len = zipStream.read(buf)) > 0) {
+ zos.write(buf, 0, (len < buf.length) ? len : buf.length);
+ }
+ } else {
+ manifestWritten = true;
+ writeManifest(manifest, zos);
+ }
+ zos.closeEntry();
+ }
+ if (!manifestWritten) {
+ writeManifest(manifest, zos);
+ zos.closeEntry();
+ }
+ }
+ return baos.toByteArray();
+ }
- @Override
- public byte[] replaceManifestInZip(ByteBuffer contentData, String manifest, String vspId)
- throws IOException {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
- try (final ZipOutputStream zos = new ZipOutputStream(baos);
- ZipInputStream zipStream = new ZipInputStream(
- new ByteArrayInputStream(contentData.array()))) {
- ZipEntry zipEntry;
- boolean manifestWritten = false;
- while ((zipEntry = zipStream.getNextEntry()) != null) {
- if (!zipEntry.getName().equalsIgnoreCase(SdcCommon.MANIFEST_NAME)) {
- ZipEntry loc_ze = new ZipEntry(zipEntry.getName());
- zos.putNextEntry(loc_ze);
- byte[] buf = new byte[1024];
- int len;
- while ((len = zipStream.read(buf)) > 0) {
- zos.write(buf, 0, (len < buf.length) ? len : buf.length);
- }
- } else {
- manifestWritten = true;
- writeManifest(manifest, zos);
+ @Override
+ public Optional<List<ErrorMessage>> validateFileDataStructure(
+ FilesDataStructure filesDataStructure) {
+ return candidateServiceValidator.validateFileDataStructure(filesDataStructure);
+ }
+
+ private void writeManifest(String manifest, ZipOutputStream zos) throws IOException {
+ zos.putNextEntry(new ZipEntry(SdcCommon.MANIFEST_NAME));
+ try (InputStream manifestStream = new ByteArrayInputStream(
+ manifest.getBytes(StandardCharsets.UTF_8))) {
+ byte[] buf = new byte[1024];
+ int len;
+ while ((len = (manifestStream.read(buf))) > 0) {
+ zos.write(buf, 0, (len < buf.length) ? len : buf.length);
+ }
}
- zos.closeEntry();
- }
- if (!manifestWritten) {
- writeManifest(manifest, zos);
- zos.closeEntry();
- }
}
- return baos.toByteArray();
- }
- @Override
- public Optional<List<ErrorMessage>> validateFileDataStructure(
- FilesDataStructure filesDataStructure) {
- return candidateServiceValidator.validateFileDataStructure(filesDataStructure);
- }
-
- private void writeManifest(String manifest, ZipOutputStream zos) throws IOException {
- zos.putNextEntry(new ZipEntry(SdcCommon.MANIFEST_NAME));
- try (InputStream manifestStream = new ByteArrayInputStream(
- manifest.getBytes(StandardCharsets.UTF_8))) {
- byte[] buf = new byte[1024];
- int len;
- while ((len = (manifestStream.read(buf))) > 0) {
- zos.write(buf, 0, (len < buf.length) ? len : buf.length);
- }
- }
- }
-
- private void handleArtifactsFromTree(HeatStructureTree tree, FilesDataStructure structure) {
-
- if (Objects.isNull(tree) || Objects.isNull(tree.getArtifacts())) {
- return;
- }
-
- if (CollectionUtils.isNotEmpty(tree.getArtifacts())) {
- structure.getArtifacts().addAll(
- tree.getArtifacts()
- .stream()
- .map(Artifact::getFileName)
- .filter(fileName -> !structure.getArtifacts().contains(fileName))
- .collect(Collectors.toList()));
- }
- }
-
- private void handleOtherResources(HeatStructureTree tree, Set<String> usedEnvFiles,
- FilesDataStructure structure) {
- Set<HeatStructureTree> others = tree.getOther();
- if (Objects.isNull(others)) {
- return;
- }
-
- List<String> artifacts = new ArrayList<>();
- List<String> unassigned = new ArrayList<>();
- for (HeatStructureTree other : others) {
- if (HeatFileAnalyzer.isYamlOrEnvFile(other.getFileName())) {
- if (isEnvFileUsedByHeatFile(usedEnvFiles, other)) {
- continue;
+ private void handleArtifactsFromTree(HeatStructureTree tree, FilesDataStructure structure) {
+
+ if (Objects.isNull(tree) || Objects.isNull(tree.getArtifacts())) {
+ return;
+ }
+
+ if (CollectionUtils.isNotEmpty(tree.getArtifacts())) {
+ structure.getArtifacts().addAll(
+ tree.getArtifacts()
+ .stream()
+ .map(Artifact::getFileName)
+ .filter(fileName -> !structure.getArtifacts().contains(fileName))
+ .collect(Collectors.toList()));
}
- unassigned.add(other.getFileName());
- } else {
- artifacts.add(other.getFileName());
- }
- handleArtifactsFromTree(other, structure);
- }
- structure.getArtifacts().addAll(artifacts);
- structure.getUnassigned().addAll(unassigned);
- }
-
- private boolean isEnvFileUsedByHeatFile(Set<String> usedEnvFiles, HeatStructureTree other) {
- if (HeatFileAnalyzer.isEnvFile(other.getFileName())) {
- if (usedEnvFiles.contains(other.getFileName())) {
- return true;
- }
- }
- return false;
- }
-
- private void addHeatsToFileDataStructure(HeatStructureTree tree, Set<String> usedEnvFiles,
- FilesDataStructure structure,
- Map<String, List<ErrorMessage>> uploadErrors,
- AnalyzedZipHeatFiles analyzedZipHeatFiles)
- throws Exception {
- List<Module> modules = new ArrayList<>();
- Set<HeatStructureTree> heatsSet = tree.getHeat();
- if (Objects.isNull(heatsSet)) {
- return;
- }
- for (HeatStructureTree heat : heatsSet) {
- if (isFileBaseFile(heat.getFileName())) {
- handleSingleHeat(structure, modules, heat, uploadErrors);
- } else if (isFileModuleFile(heat.getFileName(), analyzedZipHeatFiles.getModuleFiles())) {
- handleSingleHeat(structure, modules, heat, uploadErrors);
- } else {
- structure.getUnassigned().add(heat.getFileName());
- addNestedToFileDataStructure(heat, structure);
- }
- if (!Objects.isNull(heat.getEnv())) {
- usedEnvFiles.add(heat.getEnv() == null ? null : heat.getEnv().getFileName());
- }
}
- structure.setModules(modules);
- }
+ private void handleOtherResources(HeatStructureTree tree, Set<String> usedEnvFiles,
+ FilesDataStructure structure) {
+ Set<HeatStructureTree> others = tree.getOther();
+ if (Objects.isNull(others)) {
+ return;
+ }
- private boolean isFileModuleFile(String fileName, Set<String> modulesFileNames) {
- return modulesFileNames.contains(fileName);
- }
+ List<String> artifacts = new ArrayList<>();
+ List<String> unassigned = new ArrayList<>();
+ for (HeatStructureTree other : others) {
+ if (HeatFileAnalyzer.isYamlOrEnvFile(other.getFileName())) {
+ if (isEnvFileUsedByHeatFile(usedEnvFiles, other)) {
+ continue;
+ }
+ unassigned.add(other.getFileName());
+ } else {
+ artifacts.add(other.getFileName());
+ }
+ handleArtifactsFromTree(other, structure);
+ }
+ structure.getArtifacts().addAll(artifacts);
+ structure.getUnassigned().addAll(unassigned);
+ }
- private boolean isFileBaseFile(String fileName) {
- return manifestCreator.isFileBaseFile(fileName);
- }
+ private boolean isEnvFileUsedByHeatFile(Set<String> usedEnvFiles, HeatStructureTree other) {
+ if (HeatFileAnalyzer.isEnvFile(other.getFileName())) {
+ if (usedEnvFiles.contains(other.getFileName())) {
+ return true;
+ }
+ }
+ return false;
+ }
- private void handleSingleHeat(FilesDataStructure structure, List<Module> modules,
- HeatStructureTree heat,
- Map<String, List<ErrorMessage>> uploadErrors) {
+ private void addHeatsToFileDataStructure(HeatStructureTree tree, Set<String> usedEnvFiles,
+ FilesDataStructure structure,
+ Map<String, List<ErrorMessage>> uploadErrors,
+ AnalyzedZipHeatFiles analyzedZipHeatFiles)
+ throws Exception {
+ List<Module> modules = new ArrayList<>();
+ Set<HeatStructureTree> heatsSet = tree.getHeat();
+ if (Objects.isNull(heatsSet)) {
+ return;
+ }
+ for (HeatStructureTree heat : heatsSet) {
+ if (isFileBaseFile(heat.getFileName())) {
+ handleSingleHeat(structure, modules, heat, uploadErrors);
+ } else if (isFileModuleFile(heat.getFileName(),
+ analyzedZipHeatFiles.getModuleFiles())) {
+ handleSingleHeat(structure, modules, heat, uploadErrors);
+ } else {
+ structure.getUnassigned().add(heat.getFileName());
+ addNestedToFileDataStructure(heat, structure);
+ }
+ if (!Objects.isNull(heat.getEnv())) {
+ usedEnvFiles.add(heat.getEnv() == null ? null : heat.getEnv().getFileName());
+ }
+ }
+ structure.setModules(modules);
+ }
- mdcDataDebugMessage.debugEntryMessage(null);
+ private boolean isFileModuleFile(String fileName, Set<String> modulesFileNames) {
+ return modulesFileNames.contains(fileName);
+ }
- Module module = new Module();
- module.setYaml(heat.getFileName());
- module.setIsBase(heat.getBase());
- addNestedToFileDataStructure(heat, structure);
- Set<HeatStructureTree> volumeSet = heat.getVolume();
- int inx = 0;
- if (Objects.nonNull(volumeSet)) {
- handleVolumes(module, volumeSet, structure, inx, uploadErrors);
+ private boolean isFileBaseFile(String fileName) {
+ return manifestCreator.isFileBaseFile(fileName);
}
- handleEnv(module, heat, false, structure);
- modules.add(module);
- mdcDataDebugMessage.debugExitMessage(null);
- }
+ private void handleSingleHeat(FilesDataStructure structure, List<Module> modules,
+ HeatStructureTree heat,
+ Map<String, List<ErrorMessage>> uploadErrors) {
- private void handleVolumes(Module module, Set<HeatStructureTree> volumeSet,
- FilesDataStructure structure, int inx,
- Map<String, List<ErrorMessage>> uploadErrors) {
+ mdcDataDebugMessage.debugEntryMessage(null);
- mdcDataDebugMessage.debugEntryMessage(null);
+ Module module = new Module();
+ module.setYaml(heat.getFileName());
+ module.setIsBase(heat.getBase());
+ addNestedToFileDataStructure(heat, structure);
+ Set<HeatStructureTree> volumeSet = heat.getVolume();
+ int inx = 0;
+ if (Objects.nonNull(volumeSet)) {
+ handleVolumes(module, volumeSet, structure, inx, uploadErrors);
+ }
+ handleEnv(module, heat, false, structure);
+ modules.add(module);
- for (HeatStructureTree volume : volumeSet) {
- if (inx++ > 0) {
- ErrorsUtil.addStructureErrorToErrorMap(SdcCommon.UPLOAD_FILE,
- new ErrorMessage(ErrorLevel.WARNING,
- Messages.MORE_THEN_ONE_VOL_FOR_HEAT.getErrorMessage()), uploadErrors);
- break;
- }
- handleArtifactsFromTree(volume, structure);
- module.setVol(volume.getFileName());
- handleEnv(module, volume, true, structure);
+ mdcDataDebugMessage.debugExitMessage(null);
}
- mdcDataDebugMessage.debugExitMessage(null);
- }
+ private void handleVolumes(Module module, Set<HeatStructureTree> volumeSet,
+ FilesDataStructure structure, int inx,
+ Map<String, List<ErrorMessage>> uploadErrors) {
- private void handleEnv(Module module, HeatStructureTree tree, boolean isVolEnv,
- FilesDataStructure structure) {
+ mdcDataDebugMessage.debugEntryMessage(null);
- mdcDataDebugMessage.debugEntryMessage(null);
+ for (HeatStructureTree volume : volumeSet) {
+ if (inx++ > 0) {
+ ErrorsUtil.addStructureErrorToErrorMap(SdcCommon.UPLOAD_FILE,
+ new ErrorMessage(ErrorLevel.WARNING,
+ Messages.MORE_THEN_ONE_VOL_FOR_HEAT.getErrorMessage()), uploadErrors);
+ break;
+ }
+ handleArtifactsFromTree(volume, structure);
+ module.setVol(volume.getFileName());
+ handleEnv(module, volume, true, structure);
+ }
- if (Objects.nonNull(tree.getEnv())) {
- if (isVolEnv) {
- module.setVolEnv(tree.getEnv().getFileName());
- } else {
- module.setEnv(tree.getEnv().getFileName());
- }
- handleArtifactsFromTree(tree.getEnv(), structure);
+ mdcDataDebugMessage.debugExitMessage(null);
}
- mdcDataDebugMessage.debugExitMessage(null);
- }
+ private void handleEnv(Module module, HeatStructureTree tree, boolean isVolEnv,
+ FilesDataStructure structure) {
+
+
+ mdcDataDebugMessage.debugEntryMessage(null);
+
+ if (Objects.nonNull(tree.getEnv())) {
+ if (isVolEnv) {
+ module.setVolEnv(tree.getEnv().getFileName());
+ } else {
+ module.setEnv(tree.getEnv().getFileName());
+ }
+ handleArtifactsFromTree(tree.getEnv(), structure);
+ }
- private void addNestedToFileDataStructure(HeatStructureTree heat, FilesDataStructure structure) {
- Set<HeatStructureTree> nestedSet = heat.getNested();
- if (Objects.isNull(nestedSet)) {
- return;
+ mdcDataDebugMessage.debugExitMessage(null);
}
- for (HeatStructureTree nested : nestedSet) {
- if (structure.getNested().contains(nested.getFileName())) {
- continue;
- }
- structure.getNested().add(nested.getFileName());
- if (CollectionUtils.isNotEmpty(nested.getArtifacts())) {
- handleArtifactsFromTree(nested, structure);
- }
- addNestedToFileDataStructure(nested, structure);
+
+ private void addNestedToFileDataStructure(HeatStructureTree heat,
+ FilesDataStructure structure) {
+ Set<HeatStructureTree> nestedSet = heat.getNested();
+ if (Objects.isNull(nestedSet)) {
+ return;
+ }
+ for (HeatStructureTree nested : nestedSet) {
+ if (structure.getNested().contains(nested.getFileName())) {
+ continue;
+ }
+ structure.getNested().add(nested.getFileName());
+ if (CollectionUtils.isNotEmpty(nested.getArtifacts())) {
+ handleArtifactsFromTree(nested, structure);
+ }
+ addNestedToFileDataStructure(nested, structure);
+ }
}
- }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ServiceModelDaoFactoryTest.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ServiceModelDaoFactoryTest.java
index 5cfe33ba90..fe42f6ccd3 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ServiceModelDaoFactoryTest.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ServiceModelDaoFactoryTest.java
@@ -23,6 +23,7 @@ package org.openecomp.sdc.vendorsoftwareproduct.dao;
import com.amdocs.zusammen.adaptor.inbound.api.types.item.Element;
import com.amdocs.zusammen.adaptor.inbound.api.types.item.ElementInfo;
import com.amdocs.zusammen.adaptor.inbound.api.types.item.ZusammenElement;
+import com.amdocs.zusammen.commons.health.data.HealthInfo;
import com.amdocs.zusammen.datatypes.Id;
import com.amdocs.zusammen.datatypes.SessionContext;
import com.amdocs.zusammen.datatypes.UserInfo;
@@ -32,15 +33,14 @@ import com.amdocs.zusammen.datatypes.item.Item;
import com.amdocs.zusammen.datatypes.item.ItemVersion;
import com.amdocs.zusammen.datatypes.item.ItemVersionData;
import com.amdocs.zusammen.datatypes.itemversion.Tag;
-import org.apache.commons.lang3.tuple.ImmutablePair;
import org.openecomp.core.utilities.CommonMethods;
import org.openecomp.core.utilities.file.FileContentHandler;
-import org.openecomp.core.utilities.yaml.YamlUtil;
import org.openecomp.core.zusammen.api.ZusammenAdaptor;
import org.openecomp.sdc.model.impl.zusammen.ServiceModelDaoZusammenImpl;
import org.openecomp.sdc.model.impl.zusammen.StructureElement;
import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate;
+import org.openecomp.sdc.tosca.services.YamlUtil;
import org.openecomp.sdc.versioning.dao.types.Version;
import org.testng.Assert;
import org.testng.annotations.Test;
@@ -239,6 +239,11 @@ public class ServiceModelDaoFactoryTest {
}
@Override
+ public Collection<HealthInfo> checkHealth(SessionContext context) {
+ return null;
+ }
+
+ @Override
public Id createItem(SessionContext context, Info info) {
return null;
}
@@ -278,6 +283,11 @@ public class ServiceModelDaoFactoryTest {
}
@Override
+ public String getVersion(SessionContext sessionContext) {
+ return null;
+ }
+
+ @Override
public Collection<Item> listItems(SessionContext context) {
return null;
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/informationArtifact/impl/TxtInformationArtifactGeneratorImplTest.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/informationArtifact/impl/TxtInformationArtifactGeneratorImplTest.java
index 6652c271ac..17064b3230 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/informationArtifact/impl/TxtInformationArtifactGeneratorImplTest.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/informationArtifact/impl/TxtInformationArtifactGeneratorImplTest.java
@@ -60,12 +60,6 @@ import static org.mockito.Matchers.anyString;
import static org.openecomp.sdc.vendorsoftwareproduct.informationArtifact.impl.TxtInformationArtifactConstants.HEADER;
import static org.openecomp.sdc.vendorsoftwareproduct.informationArtifact.impl.TxtInformationArtifactConstants.VFC_COMPUTE_CPU_OVER_SUBSCRIPTION;
-
-/**
- * @author KATYR
- * @since December 07, 2016
- */
-
public class TxtInformationArtifactGeneratorImplTest {
private static final String NETWORK_DESC = "\"network desc\"";
@@ -246,6 +240,7 @@ public class TxtInformationArtifactGeneratorImplTest {
featureGroups.add("one too many feature group");
featureGroups.add("the very last feature group");
vspDetails.setFeatureGroups(featureGroups);
+ vspDetails.setOnboardingMethod("HEAT");
return vspDetails;
}
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
new file mode 100644
index 0000000000..a1ee8d3985
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/pom.xml.versionsBackup
@@ -0,0 +1,22 @@
+<?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