diff --git a/openecomp-be/backend/openecomp-sdc-action-manager/pom.xml.versionsBackup b/openecomp-be/backend/openecomp-sdc-action-manager/pom.xml.versionsBackup
new file mode 100644
index 0000000..21cfd19
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-action-manager/pom.xml.versionsBackup
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         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-action-manager</artifactId>
+    <version>1.0-SNAPSHOT</version>
+    <dependencies>
+        <dependency>
+            <groupId>org.openecomp.core</groupId>
+            <artifactId>openecomp-utilities-lib</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.openecomp.sdc</groupId>
+            <artifactId>openecomp-sdc-validation-core</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.openecomp.core</groupId>
+            <artifactId>openecomp-nosqldb-core</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.testng</groupId>
+            <artifactId>testng</artifactId>
+            <version>6.9.10</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>RELEASE</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.dataformat</groupId>
+            <artifactId>jackson-dataformat-xml</artifactId>
+            <version>2.7.4</version>
+        </dependency>
+        <dependency>
+            <groupId>org.codehaus.woodstox</groupId>
+            <artifactId>woodstox-core-asl</artifactId>
+            <version>4.4.1</version>
+        </dependency>
+        <dependency>
+            <groupId>org.openecomp.sdc</groupId>
+            <artifactId>openecomp-sdc-action-core</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.openecomp.sdc</groupId>
+            <artifactId>openecomp-sdc-versioning-core</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.openecomp.sdc</groupId>
+            <artifactId>openecomp-sdc-logging-api</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.openecomp.sdc</groupId>
+            <artifactId>openecomp-sdc-logging-core</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+    </dependencies>
+
+    <parent>
+        <groupId>org.openecomp.sdc</groupId>
+        <artifactId>backend</artifactId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+
+
+</project>
\ No newline at end of file
diff --git a/openecomp-be/backend/openecomp-sdc-application-config-manager/pom.xml.versionsBackup b/openecomp-be/backend/openecomp-sdc-application-config-manager/pom.xml.versionsBackup
new file mode 100644
index 0000000..a9cc7a3
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-application-config-manager/pom.xml.versionsBackup
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         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>
+
+    <groupId>org.openecomp.sdc</groupId>
+    <artifactId>openecomp-sdc-application-config-manager</artifactId>
+    <version>1.0-SNAPSHOT</version>
+    <dependencies>
+        <dependency>
+            <groupId>org.openecomp.core</groupId>
+            <artifactId>openecomp-config-lib</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.testng</groupId>
+            <artifactId>testng</artifactId>
+            <version>6.9.10</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.openecomp.sdc</groupId>
+            <artifactId>openecomp-sdc-logging-core</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+    </dependencies>
+
+    <parent>
+        <groupId>org.openecomp.sdc</groupId>
+        <artifactId>backend</artifactId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+
+    
+</project>
\ No newline at end of file
diff --git a/openecomp-be/backend/openecomp-sdc-healthcheck-manager/pom.xml b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/pom.xml
new file mode 100644
index 0000000..ea105b1
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/pom.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         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>backend</artifactId>
+        <version>1.1.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>openecomp-sdc-healthcheck-manager</artifactId>
+    <version>1.1.0-SNAPSHOT</version>
+    <dependencies>
+        <dependency>
+            <groupId>org.openecomp.sdc.core</groupId>
+            <artifactId>openecomp-utilities-lib</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.openecomp.sdc</groupId>
+            <artifactId>openecomp-sdc-logging-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.openecomp.sdc</groupId>
+            <artifactId>openecomp-sdc-logging-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.openecomp.sdc.core</groupId>
+            <artifactId>openecomp-facade-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.openecomp.sdc</groupId>
+            <artifactId>activity-log-rest-types</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.openecomp.sdc</groupId>
+            <artifactId>activity-log-rest-types</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.openecomp.sdc.core</groupId>
+            <artifactId>openecomp-zusammen-core</artifactId>
+            <version>${project.version}</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>
+    </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <configuration>
+                    <archive>
+                        <manifest>
+                             <addDefaultImplementationEntries>
+                                true
+                            </addDefaultImplementationEntries>
+                        </manifest>
+                    </archive>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/MibManagerFactory.java b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/HealthCheckDao.java
similarity index 71%
copy from openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/MibManagerFactory.java
copy to openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/HealthCheckDao.java
index f25658b..947387b 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/MibManagerFactory.java
+++ b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/HealthCheckDao.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.
@@ -18,14 +18,9 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.openecomp.sdc.vendorsoftwareproduct;
+package org.openecomp.sdc.health;
 
-import org.openecomp.core.factory.api.AbstractComponentFactory;
-import org.openecomp.core.factory.api.AbstractFactory;
-
-public abstract class MibManagerFactory extends AbstractComponentFactory<MibManager> {
-
-  public static MibManagerFactory getInstance() {
-    return AbstractFactory.getInstance(MibManagerFactory.class);
-  }
+public interface HealthCheckDao {
+  boolean checkHealth() throws Exception;
+  String getVersion();
 }
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/MibManagerFactory.java b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/HealthCheckDaoFactory.java
similarity index 80%
copy from openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/MibManagerFactory.java
copy to openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/HealthCheckDaoFactory.java
index f25658b..387d24d 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/MibManagerFactory.java
+++ b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/HealthCheckDaoFactory.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.
@@ -18,14 +18,13 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.openecomp.sdc.vendorsoftwareproduct;
+package org.openecomp.sdc.health;
 
 import org.openecomp.core.factory.api.AbstractComponentFactory;
 import org.openecomp.core.factory.api.AbstractFactory;
 
-public abstract class MibManagerFactory extends AbstractComponentFactory<MibManager> {
-
-  public static MibManagerFactory getInstance() {
-    return AbstractFactory.getInstance(MibManagerFactory.class);
+public abstract class HealthCheckDaoFactory extends AbstractComponentFactory<HealthCheckDao> {
+  public static HealthCheckDaoFactory getInstance() {
+    return AbstractFactory.getInstance(HealthCheckDaoFactory.class);
   }
 }
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/MibManagerFactory.java b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/HealthCheckManager.java
similarity index 71%
copy from openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/MibManagerFactory.java
copy to openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/HealthCheckManager.java
index f25658b..0575d06 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/MibManagerFactory.java
+++ b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/HealthCheckManager.java
@@ -18,14 +18,12 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.openecomp.sdc.vendorsoftwareproduct;
+package org.openecomp.sdc.health;
 
-import org.openecomp.core.factory.api.AbstractComponentFactory;
-import org.openecomp.core.factory.api.AbstractFactory;
+import org.openecomp.sdc.health.data.HealthInfo;
 
-public abstract class MibManagerFactory extends AbstractComponentFactory<MibManager> {
+import java.util.Collection;
 
-  public static MibManagerFactory getInstance() {
-    return AbstractFactory.getInstance(MibManagerFactory.class);
-  }
+public interface HealthCheckManager {
+    Collection<HealthInfo> checkHealth();
 }
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/MibManagerFactory.java b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/HealthCheckManagerFactory.java
similarity index 79%
copy from openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/MibManagerFactory.java
copy to openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/HealthCheckManagerFactory.java
index f25658b..c376606 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/MibManagerFactory.java
+++ b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/HealthCheckManagerFactory.java
@@ -17,15 +17,14 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
-package org.openecomp.sdc.vendorsoftwareproduct;
+package org.openecomp.sdc.health;
 
 import org.openecomp.core.factory.api.AbstractComponentFactory;
 import org.openecomp.core.factory.api.AbstractFactory;
 
-public abstract class MibManagerFactory extends AbstractComponentFactory<MibManager> {
 
-  public static MibManagerFactory getInstance() {
-    return AbstractFactory.getInstance(MibManagerFactory.class);
-  }
+public abstract class HealthCheckManagerFactory extends AbstractComponentFactory<HealthCheckManager> {
+    public static HealthCheckManagerFactory getInstance() {
+        return AbstractFactory.getInstance(HealthCheckManagerFactory.class);
+    }
 }
diff --git a/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/data/HealthCheckResult.java b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/data/HealthCheckResult.java
new file mode 100644
index 0000000..3bb78aa
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/data/HealthCheckResult.java
@@ -0,0 +1,45 @@
+package org.openecomp.sdc.health.data;
+
+import java.util.Collection;
+
+/**
+ * {
+ "sdcVersion": "1702.0.83.37.1",
+
+ "componentsInfo": [
+ {
+ "healthCheckComponent": “<component name>",
+ "healthCheckStatus": “<UP / DOWN>",
+ "version": “<component version>",
+ "description": “<OK or error description>"
+ },
+ …..
+ ]
+ }
+
+ */
+public class HealthCheckResult {
+    String sdcVersion;
+    Collection<HealthInfo>  componentsInfo;
+
+    public HealthCheckResult() {
+    }
+
+    public String getSdcVersion() {
+        return sdcVersion;
+    }
+
+    public void setSdcVersion(String sdcVersion) {
+        this.sdcVersion = sdcVersion;
+    }
+
+    public Collection<HealthInfo> getComponentsInfo() {
+        return componentsInfo;
+    }
+
+    public void setComponentsInfo(Collection<HealthInfo> componentsInfo) {
+        this.componentsInfo = componentsInfo;
+    }
+
+
+}
diff --git a/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/data/HealthCheckStatus.java b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/data/HealthCheckStatus.java
new file mode 100644
index 0000000..a876128
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/data/HealthCheckStatus.java
@@ -0,0 +1,28 @@
+package org.openecomp.sdc.health.data;
+
+
+public enum HealthCheckStatus {
+    UP("UP"),
+    DOWN("DOWN");
+
+    private String name;
+
+    HealthCheckStatus(String name) {
+        this.name = name;
+    }
+
+
+    @Override
+    public String toString() {
+        return name;
+    }
+
+    public static final HealthCheckStatus toValue(String inVal){
+        for (HealthCheckStatus val : values()){
+            if (val.toString().equals(inVal)){
+                return val;
+            }
+        }
+        return null;
+    }
+}
diff --git a/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/data/HealthInfo.java b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/data/HealthInfo.java
new file mode 100644
index 0000000..6b005b0
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/data/HealthInfo.java
@@ -0,0 +1,73 @@
+package org.openecomp.sdc.health.data;
+
+/**
+ * {
+   "sdcVersion": "<SERVER_FULL_VERSION>"
+   "componentsInfo": [
+     {
+       "healthCheckComponent": "<COMPONENT_NAME>",
+       "healthCheckStatus": "<UP_OR_DOWN>",
+       "version": "<COMPONENT_VERSION>",
+       "description": "<OK_OR_ERROR_VERSION>"
+     }
+   ]
+ }
+ */
+public class HealthInfo {
+    private MonitoredModules healthCheckComponent;
+    private HealthCheckStatus healthCheckStatus;
+    private String version;
+    private String description;
+
+    public HealthInfo() {
+    }
+
+    public HealthInfo(MonitoredModules healthCheckComponent, HealthCheckStatus healthCheckStatus, String version, String description) {
+        this.healthCheckComponent = healthCheckComponent;
+        this.healthCheckStatus = healthCheckStatus;
+        this.version = version;
+        this.description = description;
+    }
+
+    public MonitoredModules getHealthCheckComponent() {
+        return healthCheckComponent;
+    }
+
+    public void setHealthCheckComponent(MonitoredModules healthCheckComponent) {
+        this.healthCheckComponent = healthCheckComponent;
+    }
+
+    public HealthCheckStatus getHealthCheckStatus() {
+        return healthCheckStatus;
+    }
+
+    public void setHealthCheckStatus(HealthCheckStatus healthCheckStatus) {
+        this.healthCheckStatus = healthCheckStatus;
+    }
+
+    public String getVersion() {
+        return version;
+    }
+
+    public void setVersion(String version) {
+        this.version = version;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    @Override
+    public String toString() {
+        return "HealthInfo{" +
+                "healthCheckComponent='" + healthCheckComponent + '\'' +
+                ", healthCheckStatus=" + healthCheckStatus +
+                ", version='" + version + '\'' +
+                ", description='" + description + '\'' +
+                '}';
+    }
+}
diff --git a/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/data/MonitoredModules.java b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/data/MonitoredModules.java
new file mode 100644
index 0000000..576f4c4
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/data/MonitoredModules.java
@@ -0,0 +1,28 @@
+package org.openecomp.sdc.health.data;
+
+
+public enum MonitoredModules {
+    BE("BE"), CAS("Cassandra"),
+    ZU("Zusammen");
+
+    private String name;
+
+    MonitoredModules(String name) {
+        this.name = name;
+    }
+
+
+    @Override
+    public String toString() {
+        return name;
+    }
+
+    public static final MonitoredModules toValue(String inVal) {
+        for (MonitoredModules val : values()) {
+            if (val.toString().equals(inVal)) {
+                return val;
+            }
+        }
+        return null;
+    }
+}
diff --git a/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/data/SiteMode.java b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/data/SiteMode.java
new file mode 100644
index 0000000..94d48d7
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/data/SiteMode.java
@@ -0,0 +1,27 @@
+package org.openecomp.sdc.health.data;
+
+
+public enum SiteMode {
+    Active("active"), NOT_ACTIVE("NotActive");
+
+    private String name;
+
+    SiteMode(String name) {
+        this.name = name;
+    }
+
+
+    @Override
+    public String toString() {
+        return name;
+    }
+
+    public static final SiteMode toValue(String inVal) {
+        for (SiteMode val : values()) {
+            if (val.toString().equals(inVal)) {
+                return val;
+            }
+        }
+        return null;
+    }
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/MibManagerFactory.java b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/impl/HealthCheckDaoFactoryImpl.java
similarity index 71%
copy from openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/MibManagerFactory.java
copy to openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/impl/HealthCheckDaoFactoryImpl.java
index f25658b..ec0931c 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/MibManagerFactory.java
+++ b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/impl/HealthCheckDaoFactoryImpl.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.
@@ -18,14 +18,19 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.openecomp.sdc.vendorsoftwareproduct;
+package org.openecomp.sdc.health.impl;
 
-import org.openecomp.core.factory.api.AbstractComponentFactory;
-import org.openecomp.core.factory.api.AbstractFactory;
 
-public abstract class MibManagerFactory extends AbstractComponentFactory<MibManager> {
+import org.openecomp.sdc.health.HealthCheckDao;
+import org.openecomp.sdc.health.HealthCheckDaoFactory;
 
-  public static MibManagerFactory getInstance() {
-    return AbstractFactory.getInstance(MibManagerFactory.class);
+public class HealthCheckDaoFactoryImpl
+    extends HealthCheckDaoFactory {
+  private static final HealthCheckDao INSTANCE =
+      new HealthCheckDaoImpl();
+
+  @Override
+  public HealthCheckDao createInterface() {
+    return INSTANCE;
   }
 }
diff --git a/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/impl/HealthCheckDaoImpl.java b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/impl/HealthCheckDaoImpl.java
new file mode 100644
index 0000000..f9b4215
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/impl/HealthCheckDaoImpl.java
@@ -0,0 +1,69 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.health.impl;
+
+
+import com.datastax.driver.core.ResultSet;
+import com.datastax.driver.core.exceptions.DriverException;
+import com.datastax.driver.mapping.annotations.Accessor;
+import com.datastax.driver.mapping.annotations.Query;
+import org.openecomp.core.nosqldb.api.NoSqlDb;
+import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
+import org.openecomp.sdc.health.HealthCheckDao;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
+
+public class HealthCheckDaoImpl implements HealthCheckDao {
+
+    private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
+
+    private static final CheckHealthAccessor accessor =
+            noSqlDb.getMappingManager().createAccessor(CheckHealthAccessor.class);
+    private static final Logger logger = LoggerFactory.getLogger(HealthCheckDaoImpl.class);
+
+    @Override
+    public boolean checkHealth() throws Exception {
+        try {
+            ResultSet resultSet = accessor.checkHealth();
+            return resultSet.getColumnDefinitions().contains("key");
+        } catch (DriverException ex) {
+            logger.error("Health check failure" + ex.getMessage(), ex);
+            throw ex;
+        } catch (Exception ex) {
+            logger.error("Health check failure" + ex.getMessage(), ex);
+            throw new Exception("Internal Error.");
+        }
+    }
+
+    @Override
+    public String getVersion() {
+        return noSqlDb.getVersion();
+    }
+
+    @Accessor
+    interface CheckHealthAccessor {
+
+        @Query("SELECT * FROM application_config LIMIT 1")
+        ResultSet checkHealth();
+
+    }
+
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/MibManagerFactory.java b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/impl/HealthCheckManagerFactoryImpl.java
similarity index 71%
copy from openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/MibManagerFactory.java
copy to openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/impl/HealthCheckManagerFactoryImpl.java
index f25658b..1da515f 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/MibManagerFactory.java
+++ b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/impl/HealthCheckManagerFactoryImpl.java
@@ -17,15 +17,17 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+package org.openecomp.sdc.health.impl;
 
-package org.openecomp.sdc.vendorsoftwareproduct;
+import org.openecomp.sdc.health.*;
 
-import org.openecomp.core.factory.api.AbstractComponentFactory;
-import org.openecomp.core.factory.api.AbstractFactory;
+public class HealthCheckManagerFactoryImpl extends HealthCheckManagerFactory {
+    private static final HealthCheckManager INSTANCE ;
 
-public abstract class MibManagerFactory extends AbstractComponentFactory<MibManager> {
+    static {
+        INSTANCE =  new HealthCheckManagerImpl();
+    }
 
-  public static MibManagerFactory getInstance() {
-    return AbstractFactory.getInstance(MibManagerFactory.class);
-  }
+    @Override
+    public HealthCheckManager createInterface() {return INSTANCE;}
 }
diff --git a/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/impl/HealthCheckManagerImpl.java b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/impl/HealthCheckManagerImpl.java
new file mode 100644
index 0000000..2ee1581
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/impl/HealthCheckManagerImpl.java
@@ -0,0 +1,134 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.health.impl;
+
+import com.amdocs.zusammen.commons.health.data.HealthInfo;
+import com.amdocs.zusammen.commons.health.data.HealthStatus;
+import com.amdocs.zusammen.datatypes.SessionContext;
+import org.openecomp.core.zusammen.api.ZusammenAdaptor;
+import org.openecomp.core.zusammen.api.ZusammenAdaptorFactory;
+import org.openecomp.core.zusammen.api.ZusammenUtil;
+import org.openecomp.sdc.health.HealthCheckManager;
+import org.openecomp.sdc.health.data.HealthCheckStatus;
+import org.openecomp.sdc.health.data.MonitoredModules;
+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.health.HealthCheckDao;
+import org.openecomp.sdc.health.HealthCheckDaoFactory;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.stream.Collectors;
+
+public class HealthCheckManagerImpl implements HealthCheckManager {
+
+    private static MdcDataDebugMessage mdcDataDebugMessage;
+    private HealthCheckDao healthCheckDao;
+
+    private static final Logger logger;
+
+    static {
+        mdcDataDebugMessage = new MdcDataDebugMessage();
+        logger = LoggerFactory.getLogger(HealthCheckManagerImpl.class);
+    }
+
+    public HealthCheckManagerImpl() {
+        healthCheckDao = HealthCheckDaoFactory.getInstance().createInterface();
+    }
+
+    public String getBEVersion() {
+        return this.getClass().getPackage().getImplementationVersion();
+    }
+
+    @Override
+    public Collection<org.openecomp.sdc.health.data.HealthInfo> checkHealth() {
+        org.openecomp.sdc.health.data.HealthInfo zeHealthInfo = null;
+        org.openecomp.sdc.health.data.HealthInfo beHealthInfo = new org.openecomp.sdc.health.data.HealthInfo(
+                MonitoredModules.BE, HealthCheckStatus.UP, getBEVersion(), "OK");
+        org.openecomp.sdc.health.data.HealthInfo cassandraHealthInfo = null;
+        String zVersion = "Unknown";
+        try {
+            SessionContext context = ZusammenUtil.createSessionContext();
+            ZusammenAdaptor zusammenAdaptor = ZusammenAdaptorFactory
+                    .getInstance().createInterface();
+            Collection<HealthInfo> zeHealthInfos = new ArrayList<>();
+            try {
+                zeHealthInfos = zusammenAdaptor.checkHealth(context);
+            } catch (Exception ex) {
+                logger.error(ex.getMessage(), ex);
+                zeHealthInfo = new org.openecomp.sdc.health.data.HealthInfo(
+                        MonitoredModules.ZU, HealthCheckStatus.DOWN,
+                        zVersion, ex.getMessage());
+            }
+            boolean cassandraHealth = false;
+            String description = "OK";
+            try {
+                cassandraHealth = healthCheckDao.checkHealth();
+            } catch (Exception ex) {
+                logger.error(ex.getMessage(), ex);
+                description = ex.getMessage();
+                cassandraHealthInfo = new org.openecomp.sdc.health.data.HealthInfo(
+                        MonitoredModules.CAS, HealthCheckStatus.DOWN, zVersion, ex.getMessage());
+            }
+            zVersion = zusammenAdaptor.getVersion(context);
+            if (cassandraHealthInfo == null) {
+                HealthCheckStatus status = cassandraHealth ? HealthCheckStatus.UP : HealthCheckStatus.DOWN;
+                if (!cassandraHealth){
+                    description = "Cassandra is not available";
+                }
+                cassandraHealthInfo = new org.openecomp.sdc.health.data.HealthInfo(MonitoredModules.CAS, status,
+                        healthCheckDao.getVersion(), description);
+            }
+            if (zeHealthInfo == null) {
+                List<HealthInfo> downHealth = zeHealthInfos.stream().
+                        filter(h -> h.getHealthStatus().equals(HealthStatus.DOWN)).
+                        collect(Collectors.toList());
+
+                if (downHealth.isEmpty()) {
+                    zeHealthInfo = new org.openecomp.sdc.health.data.HealthInfo(
+                            MonitoredModules.ZU, HealthCheckStatus.UP,
+                            zVersion, "OK");
+                } else {
+                    String desc = downHealth.stream().map(healthInfo -> healthInfo.getDescription())
+                            .collect(Collectors.joining(" , ", "[", "]"));
+                    zeHealthInfo = new org.openecomp.sdc.health.data.HealthInfo(
+                            MonitoredModules.ZU, HealthCheckStatus.DOWN,
+                            zVersion, desc);
+                }
+
+            }
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+            zeHealthInfo = new org.openecomp.sdc.health.data.HealthInfo(
+                    MonitoredModules.ZU, HealthCheckStatus.DOWN, zVersion, e.getMessage()
+            );
+            cassandraHealthInfo = new org.openecomp.sdc.health.data.HealthInfo(
+                    MonitoredModules.CAS, HealthCheckStatus.DOWN, zVersion, e.getMessage());
+        }
+        return Arrays.asList(zeHealthInfo, beHealthInfo, cassandraHealthInfo);
+    }
+
+
+}
+
diff --git a/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/resources/factoryConfiguration.json b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/resources/factoryConfiguration.json
new file mode 100644
index 0000000..e0da4d7
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/resources/factoryConfiguration.json
@@ -0,0 +1,4 @@
+{
+  "org.openecomp.sdc.health.HealthCheckManagerFactory": "org.openecomp.sdc.health.impl.HealthCheckManagerFactoryImpl",
+  "org.openecomp.sdc.health.HealthCheckDaoFactory": "org.openecomp.sdc.health.impl.HealthCheckDaoFactoryImpl"
+}
\ No newline at end of file
diff --git a/openecomp-be/backend/openecomp-sdc-validation-manager/pom.xml.versionsBackup b/openecomp-be/backend/openecomp-sdc-validation-manager/pom.xml.versionsBackup
new file mode 100644
index 0000000..4d678ad
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-validation-manager/pom.xml.versionsBackup
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         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-validation-manager</artifactId>
+    <version>1.0-SNAPSHOT</version>
+    <dependencies>
+        <dependency>
+            <groupId>org.openecomp.core</groupId>
+            <artifactId>openecomp-utilities-lib</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.openecomp.core</groupId>
+            <artifactId>openecomp-heat-lib</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.testng</groupId>
+            <artifactId>testng</artifactId>
+            <version>6.9.10</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>RELEASE</version>
+            <scope>test</scope>
+        </dependency>
+
+        <!--dependency>
+            <groupId>org.openecomp.sdc</groupId>
+            <artifactId>openecomp-sdc-translator-api</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency-->
+        <dependency>
+            <groupId>org.openecomp.sdc</groupId>
+            <artifactId>openecomp-sdc-translator-core</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.dataformat</groupId>
+            <artifactId>jackson-dataformat-xml</artifactId>
+            <version>2.7.4</version>
+        </dependency>
+        <dependency>
+            <groupId>org.codehaus.woodstox</groupId>
+            <artifactId>woodstox-core-asl</artifactId>
+            <version>4.4.1</version>
+        </dependency>
+        <dependency>
+            <groupId>org.openecomp.sdc</groupId>
+            <artifactId>openecomp-sdc-vendor-license-core</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.openecomp.sdc</groupId>
+            <artifactId>openecomp-sdc-validation-api</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.openecomp.core</groupId>
+            <artifactId>openecomp-common-lib</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+    </dependencies>
+
+
+    <parent>
+        <groupId>org.openecomp.sdc</groupId>
+        <artifactId>backend</artifactId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+
+    
+</project>
\ No newline at end of file
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/pom.xml b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/pom.xml
index ac39119..0a5f5b6 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/pom.xml
+++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/pom.xml
@@ -52,7 +52,7 @@
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
             <scope>test</scope>
-            <version>4.11</version>
+            <version>${junit.version}</version>
         </dependency>
         <dependency>
             <groupId>javax.el</groupId>
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/pom.xml.versionsBackup b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/pom.xml.versionsBackup
new file mode 100644
index 0000000..85b34a1
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/pom.xml.versionsBackup
@@ -0,0 +1,77 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         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>
+
+    <name>openecomp-sdc-vendor-license-manager</name>
+    <artifactId>openecomp-sdc-vendor-license-manager</artifactId>
+
+    <parent>
+        <artifactId>backend</artifactId>
+        <groupId>org.openecomp.sdc</groupId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.openecomp.sdc</groupId>
+            <artifactId>openecomp-sdc-vendor-license-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-all</artifactId>
+            <scope>test</scope>
+            <version>1.10.19</version>
+        </dependency>
+        <dependency>
+            <groupId>org.testng</groupId>
+            <artifactId>testng</artifactId>
+            <scope>test</scope>
+            <version>6.8.5</version>
+            <exclusions>
+                <exclusion>
+                    <artifactId>snakeyaml</artifactId>
+                    <groupId>org.yaml</groupId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+            <version>4.11</version>
+        </dependency>
+        <dependency>
+            <groupId>javax.el</groupId>
+            <artifactId>javax.el-api</artifactId>
+            <version>${javax.el-api.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.glassfish.web</groupId>
+            <artifactId>javax.el</artifactId>
+            <version>2.2.4</version>
+        </dependency>
+        <dependency>
+            <groupId>org.codehaus.woodstox</groupId>
+            <artifactId>woodstox-core-asl</artifactId>
+            <version>4.4.1</version>
+        </dependency>
+        <dependency>
+            <groupId>org.openecomp.sdc</groupId>
+            <artifactId>openecomp-sdc-vendor-software-product-manager</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.dataformat</groupId>
+            <artifactId>jackson-dataformat-xml</artifactId>
+            <version>2.7.4</version>
+        </dependency>
+        <!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
+        <dependency>
+            <groupId>commons-io</groupId>
+            <artifactId>commons-io</artifactId>
+            <version>${commons.io.version}</version>
+        </dependency>
+
+    </dependencies>
+</project>
\ No newline at end of file
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseManager.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseManager.java
index aa9fc0a..a76b9b8 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseManager.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseManager.java
@@ -26,7 +26,9 @@
 import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementEntity;
 import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementModel;
 import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity;
+import org.openecomp.sdc.vendorlicense.dao.types.LimitEntity;
 import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity;
+import org.openecomp.sdc.vendorlicense.errors.LimitErrorBuilder;
 import org.openecomp.sdc.vendorlicense.types.VersionedVendorLicenseModel;
 import org.openecomp.sdc.versioning.dao.types.Version;
 
@@ -109,4 +111,14 @@
 
   void deleteLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup, String user);
 
+  LimitEntity createLimit(LimitEntity limitEntity, String user);
+
+  Collection<LimitEntity> listLimits(String vlmId, Version version, String epLkgId, String user);
+
+  void deleteLimit(LimitEntity limitEntity, String user);
+
+  void updateLimit(LimitEntity limitEntity, String user);
+
+  LimitEntity getLimit(LimitEntity entitlementPool, String user);
+
 }
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/errors/LimitErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/errors/LimitErrorBuilder.java
new file mode 100644
index 0000000..4889b5a
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/errors/LimitErrorBuilder.java
@@ -0,0 +1,30 @@
+package org.openecomp.sdc.vendorlicense.errors;
+
+
+import org.openecomp.sdc.common.errors.ErrorCategory;
+import org.openecomp.sdc.common.errors.ErrorCode;
+
+public class LimitErrorBuilder {
+
+  private static final String LIMIT_INVALID_ATTR_VALUE_MSG = "The %s value doesn't meet the "
+      + "expected attribute value.";
+
+  private static final String DUPLICATE_LIMIT_NAME_NOT_ALLOWED_MSG =
+      "Invalid request, Limit with name %s already exists for type %s.";
+
+  public static ErrorCode getInvalidValueErrorBuilder(String attribute, String errorCode) {
+    ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+    builder.withId(errorCode);
+    builder.withCategory(ErrorCategory.APPLICATION);
+    builder.withMessage(String.format(LIMIT_INVALID_ATTR_VALUE_MSG, attribute));
+    return builder.build();
+  }
+
+  public static ErrorCode getDuplicateNameErrorbuilder(String name, String type) {
+    ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+    builder.withId(VendorLicenseErrorCodes.DUPLICATE_LIMIT_NAME_NOT_ALLOWED);
+    builder.withCategory(ErrorCategory.APPLICATION);
+    builder.withMessage(String.format(DUPLICATE_LIMIT_NAME_NOT_ALLOWED_MSG, name, type ));
+    return builder.build();
+  }
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerImpl.java
index eb559f2..622ff02 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerImpl.java
@@ -24,6 +24,8 @@
 import org.openecomp.sdc.activityLog.ActivityLogManager;
 import org.openecomp.sdc.activityLog.ActivityLogManagerFactory;
 import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity;
+import org.openecomp.sdc.common.errors.CoreException;
+import org.openecomp.sdc.common.errors.ErrorCode;
 import org.openecomp.sdc.datatypes.error.ErrorLevel;
 import org.openecomp.sdc.logging.api.Logger;
 import org.openecomp.sdc.logging.api.LoggerFactory;
@@ -32,6 +34,7 @@
 import org.openecomp.sdc.logging.types.LoggerConstants;
 import org.openecomp.sdc.logging.types.LoggerErrorCode;
 import org.openecomp.sdc.logging.types.LoggerErrorDescription;
+import org.openecomp.sdc.logging.types.LoggerServiceName;
 import org.openecomp.sdc.logging.types.LoggerTragetServiceName;
 import org.openecomp.sdc.vendorlicense.VendorLicenseConstants;
 import org.openecomp.sdc.vendorlicense.VendorLicenseManager;
@@ -43,6 +46,8 @@
 import org.openecomp.sdc.vendorlicense.dao.LicenseAgreementDaoFactory;
 import org.openecomp.sdc.vendorlicense.dao.LicenseKeyGroupDao;
 import org.openecomp.sdc.vendorlicense.dao.LicenseKeyGroupDaoFactory;
+import org.openecomp.sdc.vendorlicense.dao.LimitDao;
+import org.openecomp.sdc.vendorlicense.dao.LimitDaoFactory;
 import org.openecomp.sdc.vendorlicense.dao.VendorLicenseModelDao;
 import org.openecomp.sdc.vendorlicense.dao.VendorLicenseModelDaoFactory;
 import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity;
@@ -51,7 +56,11 @@
 import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementEntity;
 import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementModel;
 import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity;
+import org.openecomp.sdc.vendorlicense.dao.types.LimitEntity;
+import org.openecomp.sdc.vendorlicense.dao.types.LimitType;
 import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity;
+import org.openecomp.sdc.vendorlicense.errors.InvalidDateErrorBuilder;
+import org.openecomp.sdc.vendorlicense.errors.LimitErrorBuilder;
 import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade;
 import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacadeFactory;
 import org.openecomp.sdc.vendorlicense.types.VersionedVendorLicenseModel;
@@ -64,10 +73,14 @@
 import org.openecomp.sdc.versioning.types.VersionableEntityAction;
 import org.openecomp.sdcrests.activitylog.types.ActivityType;
 
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Optional;
 import java.util.Set;
 
 import static org.openecomp.sdc.vendorlicense.VendorLicenseConstants.VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE;
@@ -75,7 +88,7 @@
 public class VendorLicenseManagerImpl implements VendorLicenseManager {
   private static final VersioningManager versioningManager =
       VersioningManagerFactory.getInstance().createInterface();
-  private static final VendorLicenseFacade vendorLicenseFacade =
+  private VendorLicenseFacade vendorLicenseFacade =
       VendorLicenseFacadeFactory.getInstance().createInterface();
   private static final VendorLicenseModelDao vendorLicenseModelDao =
       VendorLicenseModelDaoFactory.getInstance().createInterface();
@@ -87,6 +100,9 @@
       EntitlementPoolDaoFactory.getInstance().createInterface();
   private static final LicenseKeyGroupDao licenseKeyGroupDao =
       LicenseKeyGroupDaoFactory.getInstance().createInterface();
+  private static final LimitDao limitDao =
+      LimitDaoFactory.getInstance().createInterface();
+
   private ActivityLogManager activityLogManager = ActivityLogManagerFactory.getInstance().createInterface();
   private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
   private static final Logger logger =
@@ -471,14 +487,110 @@
         .debugEntryMessage("VLM id", entitlementPool.getVendorLicenseModelId());
     mdcDataDebugMessage
         .debugExitMessage("VLM id", entitlementPool.getVendorLicenseModelId());
+    validateCreateDate(entitlementPool);
     return vendorLicenseFacade.createEntitlementPool(entitlementPool, user);
   }
 
+  private void validateCreateDate(EntitlementPoolEntity entitlementPool){
+    mdcDataDebugMessage.debugEntryMessage("Start date and end date", entitlementPool.getStartDate
+        ()+"   "+entitlementPool.getExpiryDate());
+
+    DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy'T'HH:mm:ss'Z'");
+
+    entitlementPool.setStartDate(entitlementPool.getStartDate() != null ? (entitlementPool
+        .getStartDate().trim().length() != 0 ? entitlementPool.getStartDate()+"T00:00:00Z"
+        : null) : null);
+    entitlementPool.setExpiryDate(entitlementPool.getExpiryDate() != null ? (entitlementPool
+        .getExpiryDate().trim().length() != 0 ? entitlementPool.getExpiryDate()+"T23:59:59Z"
+        : null) : null);
+
+    if(entitlementPool.getStartDate() != null && entitlementPool.getExpiryDate() != null) {
+      if (LocalDate.parse(entitlementPool.getStartDate(), formatter).atStartOfDay().isBefore
+          (LocalDate.now().atStartOfDay()) ||
+          LocalDate.parse(entitlementPool.getExpiryDate(), formatter).atStartOfDay()
+              .isEqual(LocalDate.now().atStartOfDay()) ||
+          LocalDate.parse(entitlementPool.getExpiryDate(), formatter)
+              .isBefore(LocalDate.parse(entitlementPool.getStartDate(), formatter))) {
+        MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+            LoggerTragetServiceName.VALIDATE_DATE_RANGE,ErrorLevel.ERROR.name(),
+            LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.INVALID_VALUE);
+        throw new CoreException(
+            new InvalidDateErrorBuilder(entitlementPool.getVendorLicenseModelId())
+                .build());
+      }
+    }
+
+    if(entitlementPool.getStartDate() != null && entitlementPool.getExpiryDate() == null) {
+      if (LocalDate.parse(entitlementPool.getStartDate(), formatter).atStartOfDay().isBefore
+          (LocalDate.now().atStartOfDay())) {
+        MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+            LoggerTragetServiceName.VALIDATE_DATE_RANGE,ErrorLevel.ERROR.name(),
+            LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.INVALID_VALUE);
+        throw new CoreException(
+            new InvalidDateErrorBuilder(entitlementPool.getVendorLicenseModelId())
+                .build());
+      }
+    }
+
+    if(entitlementPool.getStartDate() == null && entitlementPool.getExpiryDate() != null) {
+      MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+          LoggerTragetServiceName.VALIDATE_DATE_RANGE,ErrorLevel.ERROR.name(),
+          LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.INVALID_VALUE);
+      throw new CoreException(
+          new InvalidDateErrorBuilder(entitlementPool.getVendorLicenseModelId())
+              .build());
+
+    }
+
+    mdcDataDebugMessage.debugExitMessage(null,null);
+  }
+
+  private void validateUpdateDate(EntitlementPoolEntity entitlementPool){
+    mdcDataDebugMessage.debugEntryMessage("Start date and end date", entitlementPool.getStartDate
+        ()+"   "+entitlementPool.getExpiryDate());
+
+    DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy'T'HH:mm:ss'Z'");
+
+    entitlementPool.setStartDate(entitlementPool.getStartDate() != null ? (entitlementPool
+        .getStartDate().trim().length() != 0 ? entitlementPool.getStartDate()+"T00:00:00Z"
+        : null) : null);
+    entitlementPool.setExpiryDate(entitlementPool.getExpiryDate() != null ? (entitlementPool
+        .getExpiryDate().trim().length() != 0 ? entitlementPool.getExpiryDate()+"T23:59:59Z"
+        : null) : null);
+
+    if(entitlementPool.getStartDate() != null && entitlementPool.getExpiryDate() != null) {
+      if (LocalDate.parse(entitlementPool.getExpiryDate(), formatter).atStartOfDay()
+          .isEqual(LocalDate.parse(entitlementPool.getStartDate(), formatter).atStartOfDay()) ||
+          LocalDate.parse(entitlementPool.getExpiryDate(), formatter)
+              .isBefore(LocalDate.parse(entitlementPool.getStartDate(), formatter))) {
+        MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+            LoggerTragetServiceName.VALIDATE_DATE_RANGE,ErrorLevel.ERROR.name(),
+            LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.INVALID_VALUE);
+        throw new CoreException(
+            new InvalidDateErrorBuilder(entitlementPool.getVendorLicenseModelId())
+                .build());
+      }
+    }
+
+    if(entitlementPool.getStartDate() == null && entitlementPool.getExpiryDate() != null) {
+      MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+          LoggerTragetServiceName.VALIDATE_DATE_RANGE,ErrorLevel.ERROR.name(),
+          LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.INVALID_VALUE);
+      throw new CoreException(
+          new InvalidDateErrorBuilder(entitlementPool.getVendorLicenseModelId())
+              .build());
+
+    }
+
+    mdcDataDebugMessage.debugExitMessage(null,null);
+  }
+
   @Override
   public void updateEntitlementPool(EntitlementPoolEntity entitlementPool, String user) {
     mdcDataDebugMessage.debugEntryMessage("VLM id, EP id", entitlementPool
         .getVendorLicenseModelId(), entitlementPool.getId());
 
+    validateUpdateDate(entitlementPool);
     Version version = VersioningUtil.resolveVersion(entitlementPool.getVersion(),
         getVersionInfo(entitlementPool.getVendorLicenseModelId(), VersionableEntityAction.Write,
             user), user);
@@ -504,6 +616,18 @@
     VersioningUtil
         .validateEntityExistence(retrieved, entitlementPool, VendorLicenseModelEntity.ENTITY_TYPE);
 
+    DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy'T'HH:mm:ss'Z'");
+    DateTimeFormatter targetFormatter = DateTimeFormatter.ofPattern("MM/dd/yyyy");
+    if(retrieved.getStartDate() != null){
+      retrieved.setStartDate(LocalDate.parse(retrieved.getStartDate(),formatter).format
+          (targetFormatter));
+    }
+
+    if(retrieved.getExpiryDate() != null){
+      retrieved.setExpiryDate(LocalDate.parse(retrieved.getExpiryDate(),formatter).format
+          (targetFormatter));
+    }
+
     mdcDataDebugMessage.debugExitMessage("VLM id, EP id", entitlementPool
         .getVendorLicenseModelId(), entitlementPool.getId());
     return retrieved;
@@ -529,6 +653,8 @@
               referencingFeatureGroupId), entitlementPool.getId());
     }
 
+    deleteChildLimits(entitlementPool.getVendorLicenseModelId(), entitlementPool.getVersion(), entitlementPool.getId(), user);
+
     entitlementPoolDao.delete(entitlementPool);
 
     UniqueValueUtil.deleteUniqueValue(VendorLicenseConstants.UniqueValues.ENTITLEMENT_POOL_NAME,
@@ -542,6 +668,14 @@
         .getVendorLicenseModelId(), entitlementPool.getId());
   }
 
+  private void deleteChildLimits(String vlmId, Version version, String epLkgId, String user) {
+      Optional<Collection<LimitEntity>> limitEntities = Optional.ofNullable(
+              listLimits(vlmId, version, epLkgId, user));
+      limitEntities.ifPresent(entities->
+              entities.forEach(entity->
+                      deleteLimit(entity, user)));
+  }
+
   @Override
   public Collection<LicenseKeyGroupEntity> listLicenseKeyGroups(String vlmId, Version version,
                                                                 String user) {
@@ -617,6 +751,8 @@
               referencingFeatureGroupId), licenseKeyGroup.getId());
     }
 
+    deleteChildLimits(licenseKeyGroup.getVendorLicenseModelId(), licenseKeyGroup.getVersion(), licenseKeyGroup.getId(), user);
+
     licenseKeyGroupDao.delete(licenseKeyGroup);
 
     UniqueValueUtil.deleteUniqueValue(VendorLicenseConstants.UniqueValues.LICENSE_KEY_GROUP_NAME,
@@ -630,6 +766,124 @@
         .getVendorLicenseModelId(), licenseKeyGroup.getId());
   }
 
+  @Override
+  public LimitEntity createLimit(LimitEntity limit, String user) {
+    mdcDataDebugMessage
+        .debugEntryMessage("VLM id", limit.getVendorLicenseModelId(), "EP/LKGId", limit
+            .getEpLkgId());
+    mdcDataDebugMessage
+        .debugExitMessage("VLM id", limit.getVendorLicenseModelId(), "EP/LKGId", limit
+            .getEpLkgId());
+    validateLimit(limit, user);
+    return vendorLicenseFacade.createLimit(limit, user);
+  }
+
+  private void validateLimit(LimitEntity limit, String user) {
+    Version version = VersioningUtil.resolveVersion(limit.getVersion(),
+        getVersionInfo(limit.getVendorLicenseModelId(), VersionableEntityAction.Write,
+            user), user);
+    Collection<LimitEntity> limitList = listLimits(limit.getVendorLicenseModelId(),version
+        ,limit.getEpLkgId(), user);
+
+    if (!isLimitNameUnique(limitList,limit.getName(), limit.getType(), limit.getId())) {
+      final ErrorCode duplicateLimitNameErrorBuilder =
+           LimitErrorBuilder.getDuplicateNameErrorbuilder(limit.getName(), limit.getType().name());
+      MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+          LoggerServiceName.Create_LIMIT.toString(), ErrorLevel.ERROR.name(),
+          LoggerErrorCode.DATA_ERROR.getErrorCode(),
+          duplicateLimitNameErrorBuilder.message());
+      throw new CoreException(duplicateLimitNameErrorBuilder);
+    }
+  }
+
+  private boolean isLimitNameUnique(Collection<LimitEntity> limitList, String name, LimitType
+      type, String id) {
+    for (LimitEntity limit : limitList) {
+      if(limit.getName().equalsIgnoreCase(name) &&
+          limit.getType().name().equalsIgnoreCase(type.name())) {
+        if(id != null && limit.getId().equals(id)){
+          continue;
+        }
+        return false;
+      }
+    }
+    return true;
+  }
+
+  @Override
+  public Collection<LimitEntity> listLimits(String vlmId, Version version, String epLkgId,
+                                            String user) {
+    mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId, "EP/LKGId", epLkgId);
+    mdcDataDebugMessage.debugExitMessage("VLM id", vlmId, "EP/LKGId", epLkgId);
+    return vendorLicenseFacade.listLimits(vlmId, version, epLkgId, user);
+  }
+
+  @Override
+  public void deleteLimit(LimitEntity limitEntity, String user) {
+    mdcDataDebugMessage.debugEntryMessage("VLM id, EP id, Limit Id", limitEntity
+            .getVendorLicenseModelId(), limitEntity.getEpLkgId(), limitEntity.getId());
+
+    Version version = VersioningUtil.resolveVersion(limitEntity.getVersion(),
+            getVersionInfo(limitEntity.getVendorLicenseModelId(), VersionableEntityAction.Write,
+                    user), user);
+    limitEntity.setVersion(version);
+
+    if(!isLimitPresent(limitEntity)){
+      VersioningUtil
+          .validateEntityExistence(null, limitEntity, VendorLicenseModelEntity.ENTITY_TYPE);
+    }
+    LimitEntity retrieved = limitDao.get(limitEntity);
+    VersioningUtil
+            .validateEntityExistence(retrieved, limitEntity, VendorLicenseModelEntity.ENTITY_TYPE);
+
+    limitDao.delete(limitEntity);
+
+    vendorLicenseFacade.updateVlmLastModificationTime(limitEntity.getVendorLicenseModelId(),
+            limitEntity.getVersion());
+
+    mdcDataDebugMessage.debugExitMessage("VLM id, EP id, Limit Id", limitEntity
+            .getVendorLicenseModelId(), limitEntity.getEpLkgId(), limitEntity.getId());
+  }
+
+  @Override
+  public void updateLimit(LimitEntity limit, String user) {
+    mdcDataDebugMessage
+        .debugEntryMessage("VLM id", limit.getVendorLicenseModelId(), "EP/LKGId", limit
+            .getEpLkgId());
+    getLimit(limit,user);
+    validateLimit(limit, user);
+    vendorLicenseFacade.updateLimit(limit, user);
+    mdcDataDebugMessage
+        .debugExitMessage("VLM id", limit.getVendorLicenseModelId(), "EP/LKGId", limit
+            .getEpLkgId());
+  }
+
+  private boolean isLimitPresent(LimitEntity limit) {
+    return limitDao.isLimitPresent(limit);
+  }
+
+  @Override
+  public LimitEntity getLimit(LimitEntity limitEntity,
+                                                  String user) {
+    mdcDataDebugMessage.debugEntryMessage("VLM id", limitEntity.getVendorLicenseModelId(),
+        "EP/LKGId", limitEntity.getEpLkgId());
+
+    limitEntity.setVersion(VersioningUtil.resolveVersion(limitEntity.getVersion(),
+        getVersionInfo(limitEntity.getVendorLicenseModelId(), VersionableEntityAction.Read,
+            user), user));
+    if(!isLimitPresent(limitEntity)){
+      VersioningUtil
+          .validateEntityExistence(null, limitEntity, VendorLicenseModelEntity.ENTITY_TYPE);
+    }
+    LimitEntity retrieved = limitDao.get(limitEntity);
+    VersioningUtil
+        .validateEntityExistence(retrieved, limitEntity, VendorLicenseModelEntity.ENTITY_TYPE);
+
+    mdcDataDebugMessage.debugExitMessage("VLM id", limitEntity.getVendorLicenseModelId(),
+        "EP/LKGId", limitEntity.getEpLkgId());
+    return retrieved;
+  }
+
   private void addFeatureGroupsToLicenseAgreementRef(Set<String> featureGroupIds,
                                                      LicenseAgreementEntity licenseAgreement) {
     if (featureGroupIds != null) {
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/ArtifactTestUtils.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/ArtifactTestUtils.java
index 40ea59f..5d9729d 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/ArtifactTestUtils.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/ArtifactTestUtils.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.
@@ -126,12 +126,25 @@
   protected List featureGroupsforVlm3;
   protected LicenseAgreementEntity licenseAgreementVlm3;
 
+  public enum OnboardingMethod {
+    HEAT("HEAT"),
+    Manual("Manual");
+
+
+    OnboardingMethod(String method) {
+      this.method = method;
+    }
+
+    private  String method;
+  }
+
 
   protected static VspDetails createVspDetails(String id, Version version, String name, String desc,
                                                String vendorName, String vlm, String icon,
                                                String category, String subCategory,
                                                String licenseAgreement,
-                                               List<String> featureGroups) {
+                                               List<String> featureGroups,
+                                               String onboardingMethod) {
     VspDetails vspDetails = new VspDetails(id, version);
     vspDetails.setName(name);
     vspDetails.setDescription(desc);
@@ -142,6 +155,7 @@
     vspDetails.setVendorId(vlm);
     vspDetails.setLicenseAgreement(licenseAgreement);
     vspDetails.setFeatureGroups(featureGroups);
+    vspDetails.setOnboardingMethod(onboardingMethod);
     return vspDetails;
   }
 
@@ -238,7 +252,8 @@
         vendorLicenseFacade.getVersionInfo(vlm1Id, VersionableEntityAction.Read, "");
     vspDetails =
         createVspDetails(null, null, "VSP1_" + CommonMethods.nextUuId(), "Test-vsp", "vendorName",
-            vlm1Id, "icon", "category", "subCategory", la11Id, fgs);
+            vlm1Id, "icon", "category", "subCategory", la11Id, fgs, ArtifactTestUtils
+                .OnboardingMethod.HEAT.name());
 
     List<Version> finalVersions = versionInfo.getFinalVersions();
     Version finalVersion = finalVersions.get(1);
@@ -266,7 +281,8 @@
     vspDetailsVsp3 =
         createVspDetails(null, null, "VSP3_" + CommonMethods.nextUuId(), "VSP3",
             "vendorName",
-            vlm3Id, "icon", "category", "subCategory", licenceAgreementId, fgs);
+            vlm3Id, "icon", "category", "subCategory", licenceAgreementId, fgs, OnboardingMethod
+                .HEAT.name());
     VersionInfo versionInfo =
         vendorLicenseFacade.getVersionInfo(vlmToUse, VersionableEntityAction.Read, "");
 
@@ -383,7 +399,7 @@
     fgs.add(fg21Id);
     vsp2 =
         createVspDetails(null, null, "VSP2_" + CommonMethods.nextUuId(), "Test-vsp", "vendorName",
-            vlm2Id, "icon", "category", "subCategory", la21Id, fgs);
+            vlm2Id, "icon", "category", "subCategory", la21Id, fgs, OnboardingMethod.HEAT.name());
     vsp2 = vendorSoftwareProductManager.createVsp(vsp2, USER1);
   }
 
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/EntitlementPoolTest.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/EntitlementPoolTest.java
index 95e0e51..9b079de 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/EntitlementPoolTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/EntitlementPoolTest.java
@@ -17,38 +17,387 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-/*
+
 
 package org.openecomp.sdc.vendorlicense;
 
-import org.openecomp.core.util.UniqueValueUtil;
-import org.openecomp.core.utilities.CommonMethods;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.mockito.Spy;
 import org.openecomp.sdc.common.errors.CoreException;
 import org.openecomp.sdc.vendorlicense.dao.EntitlementPoolDao;
-import org.openecomp.sdc.vendorlicense.dao.EntitlementPoolDaoFactory;
-import org.openecomp.sdc.vendorlicense.dao.types.AggregationFunction;
-import org.openecomp.sdc.vendorlicense.dao.types.ChoiceOrOther;
-import org.openecomp.sdc.vendorlicense.dao.types.EntitlementMetric;
-import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity;
-import org.openecomp.sdc.vendorlicense.dao.types.EntitlementTime;
-import org.openecomp.sdc.vendorlicense.dao.types.MultiChoiceOrOther;
-import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope;
-import org.openecomp.sdc.vendorlicense.dao.types.ThresholdUnit;
+import org.openecomp.sdc.vendorlicense.dao.LimitDao;
+import org.openecomp.sdc.vendorlicense.dao.types.*;
+import org.openecomp.sdc.vendorlicense.errors.VendorLicenseErrorCodes;
+import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade;
 import org.openecomp.sdc.vendorlicense.impl.VendorLicenseManagerImpl;
 import org.openecomp.sdc.versioning.dao.types.Version;
 import org.openecomp.sdc.versioning.errors.VersioningErrorCodes;
+import org.openecomp.sdc.versioning.types.VersionInfo;
 import org.testng.Assert;
-import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
-import java.util.Collection;
-import java.util.Collections;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.Set;
 
+import static org.mockito.Matchers.anyObject;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.verify;
+
 public class EntitlementPoolTest {
 
-  private static final String USER1 = "epTestUser1";
+    //JUnit Test Cases using Mockito
+    private  final String USER1 = "epTestUser1";
+    private  final String EP1_NAME = "EP1 name";
+    private  final String LT1_NAME = "LT1 name";
+
+    @Mock
+    private VendorLicenseFacade vendorLicenseFacade;
+
+    @Mock
+    private EntitlementPoolDao entitlementPoolDao;
+    @Mock
+    private LimitDao limitDao;
+
+    @InjectMocks
+    @Spy
+    private VendorLicenseManagerImpl vendorLicenseManagerImpl;
+
+    public EntitlementPoolEntity createEntitlementPool(String vlmId, Version version,
+                                                       String name, String desc, int threshold,
+                                                       ThresholdUnit thresholdUnit,
+                                                       EntitlementMetric entitlementMetricChoice,
+                                                       String entitlementMetricOther,
+                                                       String increments,
+                                                       AggregationFunction aggregationFunctionChoice,
+                                                       String aggregationFunctionOther,
+                                                       Set<OperationalScope> operationalScopeChoices,
+                                                       String operationalScopeOther,
+                                                       EntitlementTime timeChoice,
+                                                       String timeOther, String sku) {
+        EntitlementPoolEntity entitlementPool = new EntitlementPoolEntity();
+        //entitlementPool.setVendorLicenseModelId(vlmId);
+        entitlementPool.setVersion(version);
+        entitlementPool.setName(name);
+        entitlementPool.setDescription(desc);
+        entitlementPool.setThresholdValue(threshold);
+        entitlementPool.setThresholdUnit(thresholdUnit);
+        entitlementPool
+                .setEntitlementMetric(new ChoiceOrOther<>(entitlementMetricChoice, entitlementMetricOther));
+        entitlementPool.setIncrements(increments);
+        entitlementPool.setAggregationFunction(
+                new ChoiceOrOther<>(aggregationFunctionChoice, aggregationFunctionOther));
+        entitlementPool.setOperationalScope(
+                new MultiChoiceOrOther<>(operationalScopeChoices, operationalScopeOther));
+        entitlementPool.setTime(new ChoiceOrOther<>(timeChoice, timeOther));
+        entitlementPool.setManufacturerReferenceNumber(sku);
+        return entitlementPool;
+    }
+
+    @BeforeMethod
+    public void setUp() throws Exception {
+        MockitoAnnotations.initMocks(this);
+    }
+
+    @Test
+    public void createTest() {
+        Set<OperationalScope> opScopeChoices;
+        opScopeChoices = new HashSet<>();
+        opScopeChoices.add(OperationalScope.Core);
+        opScopeChoices.add(OperationalScope.CPU);
+        opScopeChoices.add(OperationalScope.Network_Wide);
+        EntitlementPoolEntity ep2 =
+                createEntitlementPool("vlm1Id", null, EP1_NAME, "EP2 dec", 70, ThresholdUnit.Absolute,
+                        EntitlementMetric.Other, "exception metric2", "inc2", AggregationFunction.Average, null,
+                        opScopeChoices, null, EntitlementTime.Other, "time2", "sku2");
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy");
+        ep2.setStartDate(LocalDate.now().format(formatter));
+        ep2.setExpiryDate(LocalDate.now().plusDays(1L).format(formatter));
+
+        vendorLicenseManagerImpl.createEntitlementPool(ep2, USER1);
+    }
+
+    @Test
+    public void createWithInvalidStartExpiryDateTest() {
+        try {
+
+            Set<OperationalScope> opScopeChoices;
+            opScopeChoices = new HashSet<>();
+            opScopeChoices.add(OperationalScope.Core);
+            opScopeChoices.add(OperationalScope.CPU);
+            opScopeChoices.add(OperationalScope.Network_Wide);
+            EntitlementPoolEntity ep2 =
+                    createEntitlementPool("vlm2Id", null, EP1_NAME, "EP2 dec", 70, ThresholdUnit.Absolute,
+                            EntitlementMetric.Other, "exception metric2", "inc2", AggregationFunction.Average, null,
+                            opScopeChoices, null, EntitlementTime.Other, "time2", "sku2");
+            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy");
+            ep2.setStartDate(LocalDate.now().format(formatter));
+            ep2.setExpiryDate(LocalDate.now().minusDays(2L).format(formatter));
+            vendorLicenseManagerImpl.createEntitlementPool(ep2, USER1).getId();
+            Assert.fail();
+        } catch (CoreException exception) {
+            Assert.assertEquals(exception.code().id(), VendorLicenseErrorCodes.DATE_RANGE_INVALID);
+        }
+    }
+
+    @Test
+    public void createWithoutStartDateTest() {
+        try {
+
+            Set<OperationalScope> opScopeChoices;
+            opScopeChoices = new HashSet<>();
+            opScopeChoices.add(OperationalScope.Core);
+            opScopeChoices.add(OperationalScope.CPU);
+            opScopeChoices.add(OperationalScope.Network_Wide);
+            EntitlementPoolEntity ep2 =
+                    createEntitlementPool("vlm3Id", null, EP1_NAME, "EP2 dec", 70, ThresholdUnit.Absolute,
+                            EntitlementMetric.Other, "exception metric2", "inc2", AggregationFunction.Average, null,
+                            opScopeChoices, null, EntitlementTime.Other, "time2", "sku2");
+            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy");
+            ep2.setExpiryDate(LocalDate.now().plusDays(2L).format(formatter));
+            vendorLicenseManagerImpl.createEntitlementPool(ep2, USER1).getId();
+            Assert.fail();
+        } catch (CoreException exception) {
+            Assert.assertEquals(exception.code().id(), VendorLicenseErrorCodes.DATE_RANGE_INVALID);
+        }
+    }
+
+    @Test
+    public void createWithSameStartExpiryDateTest() {
+        try {
+
+            Set<OperationalScope> opScopeChoices;
+            opScopeChoices = new HashSet<>();
+            opScopeChoices.add(OperationalScope.Core);
+            opScopeChoices.add(OperationalScope.CPU);
+            opScopeChoices.add(OperationalScope.Network_Wide);
+            EntitlementPoolEntity ep2 =
+                    createEntitlementPool("vlm4Id", null, EP1_NAME, "EP2 dec", 70, ThresholdUnit.Absolute,
+                            EntitlementMetric.Other, "exception metric2", "inc2", AggregationFunction.Average, null,
+                            opScopeChoices, null, EntitlementTime.Other, "time2", "sku2");
+            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy");
+            ep2.setStartDate(LocalDate.now().format(formatter));
+            ep2.setExpiryDate(LocalDate.now().format(formatter));
+            vendorLicenseManagerImpl.createEntitlementPool(ep2, USER1).getId();
+            Assert.fail();
+        } catch (CoreException exception) {
+            Assert.assertEquals(exception.code().id(), VendorLicenseErrorCodes.DATE_RANGE_INVALID);
+        }
+    }
+
+    @Test
+    public void createUpdate() {
+        Set<OperationalScope> opScopeChoices;
+        opScopeChoices = new HashSet<>();
+        opScopeChoices.add(OperationalScope.Core);
+        opScopeChoices.add(OperationalScope.CPU);
+        opScopeChoices.add(OperationalScope.Network_Wide);
+        EntitlementPoolEntity ep2 =
+                createEntitlementPool("vlm1Id", null, EP1_NAME, "EP2 dec", 70, ThresholdUnit.Absolute,
+                        EntitlementMetric.Other, "exception metric2", "inc2", AggregationFunction.Average, null,
+                        opScopeChoices, null, EntitlementTime.Other, "time2", "sku2");
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy");
+        ep2.setStartDate(LocalDate.now().minusDays(3L).format(formatter));
+        ep2.setExpiryDate(LocalDate.now().minusDays(2L).format(formatter));
+        VersionInfo info = new VersionInfo();
+        Version version = new Version();
+        info.getViewableVersions().add(version);
+        info.setActiveVersion(version);
+        doReturn(info).when(vendorLicenseFacade).getVersionInfo(anyObject(),anyObject(),anyObject());
+
+        vendorLicenseManagerImpl.updateEntitlementPool(ep2, USER1);
+    }
+
+    @Test
+    public void updateWithInvalidStartExpiryDateTest() {
+        try {
+
+            Set<OperationalScope> opScopeChoices;
+            opScopeChoices = new HashSet<>();
+            opScopeChoices.add(OperationalScope.Core);
+            opScopeChoices.add(OperationalScope.CPU);
+            opScopeChoices.add(OperationalScope.Network_Wide);
+            EntitlementPoolEntity ep2 =
+                    createEntitlementPool("vlm2Id", null, EP1_NAME, "EP2 dec", 70, ThresholdUnit.Absolute,
+                            EntitlementMetric.Other, "exception metric2", "inc2", AggregationFunction.Average, null,
+                            opScopeChoices, null, EntitlementTime.Other, "time2", "sku2");
+            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy");
+            ep2.setStartDate(LocalDate.now().format(formatter));
+            ep2.setExpiryDate(LocalDate.now().minusDays(2L).format(formatter));
+            vendorLicenseManagerImpl.updateEntitlementPool(ep2, USER1);
+            Assert.fail();
+        } catch (CoreException exception) {
+            Assert.assertEquals(exception.code().id(), VendorLicenseErrorCodes.DATE_RANGE_INVALID);
+        }
+    }
+
+    @Test
+    public void updateWithoutStartDateTest() {
+        try {
+
+            Set<OperationalScope> opScopeChoices;
+            opScopeChoices = new HashSet<>();
+            opScopeChoices.add(OperationalScope.Core);
+            opScopeChoices.add(OperationalScope.CPU);
+            opScopeChoices.add(OperationalScope.Network_Wide);
+            EntitlementPoolEntity ep2 =
+                    createEntitlementPool("vlm3Id", null, EP1_NAME, "EP2 dec", 70, ThresholdUnit.Absolute,
+                            EntitlementMetric.Other, "exception metric2", "inc2", AggregationFunction.Average, null,
+                            opScopeChoices, null, EntitlementTime.Other, "time2", "sku2");
+            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy");
+            ep2.setExpiryDate(LocalDate.now().plusDays(2L).format(formatter));
+            vendorLicenseManagerImpl.updateEntitlementPool(ep2, USER1);
+            Assert.fail();
+        } catch (CoreException exception) {
+            Assert.assertEquals(exception.code().id(), VendorLicenseErrorCodes.DATE_RANGE_INVALID);
+        }
+    }
+
+    @Test
+    public void updateWithSameStartExpiryDateTest() {
+        try {
+
+            Set<OperationalScope> opScopeChoices;
+            opScopeChoices = new HashSet<>();
+            opScopeChoices.add(OperationalScope.Core);
+            opScopeChoices.add(OperationalScope.CPU);
+            opScopeChoices.add(OperationalScope.Network_Wide);
+            EntitlementPoolEntity ep2 =
+                    createEntitlementPool("vlm4Id", null, EP1_NAME, "EP2 dec", 70, ThresholdUnit.Absolute,
+                            EntitlementMetric.Other, "exception metric2", "inc2", AggregationFunction.Average, null,
+                            opScopeChoices, null, EntitlementTime.Other, "time2", "sku2");
+            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy");
+            ep2.setStartDate(LocalDate.now().format(formatter));
+            ep2.setExpiryDate(LocalDate.now().format(formatter));
+            vendorLicenseManagerImpl.updateEntitlementPool(ep2, USER1);
+            Assert.fail();
+        } catch (CoreException exception) {
+            Assert.assertEquals(exception.code().id(), VendorLicenseErrorCodes.DATE_RANGE_INVALID);
+        }
+    }
+
+    @Test
+    public void deleteEntitlementPoolTest() {
+        Set<OperationalScope> opScopeChoices;
+        opScopeChoices = new HashSet<>();
+        opScopeChoices.add(OperationalScope.Core);
+        opScopeChoices.add(OperationalScope.CPU);
+        opScopeChoices.add(OperationalScope.Network_Wide);
+
+        EntitlementPoolEntity entitlementPool =
+                createEntitlementPool("vlm1Id", null, EP1_NAME, "EP2 dec", 70, ThresholdUnit.Absolute,
+                        EntitlementMetric.Other, "exception metric2", "inc2", AggregationFunction.Average, null,
+                        opScopeChoices, null, EntitlementTime.Other, "time2", "sku2");
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy");
+        entitlementPool.setStartDate(LocalDate.now().format(formatter));
+        entitlementPool.setExpiryDate(LocalDate.now().plusDays(1L).format(formatter));
+
+        VersionInfo info = new VersionInfo();
+        Version version = new Version();
+        info.getViewableVersions().add(version);
+        info.setActiveVersion(version);
+        doReturn(info).when(vendorLicenseFacade).getVersionInfo(anyObject(),anyObject(),anyObject());
+
+        LimitEntity limitEntity = LimitTest.createLimitEntity(LT1_NAME,LimitType.Vendor,"string",version,
+                EntitlementMetric.Core,AggregationFunction.Average,10,EntitlementTime.Hour);
+
+        ArrayList<LimitEntity> limitEntityList = new ArrayList();
+        limitEntityList.add(limitEntity);
+
+        doReturn(entitlementPool).when(entitlementPoolDao).get(anyObject());
+        doReturn(limitEntityList).when(vendorLicenseFacade).listLimits(anyObject(), anyObject(), anyObject(), anyObject());
+        doReturn(true).when(limitDao).isLimitPresent(anyObject());
+        doReturn(limitEntity).when(limitDao).get(anyObject());
+        try {
+            Field limitField = VendorLicenseManagerImpl.class.getDeclaredField("limitDao");
+            limitField.setAccessible(true);
+            Field modifiersField = Field.class.getDeclaredField("modifiers");
+            modifiersField.setAccessible(true);
+            modifiersField.setInt(limitField, limitField.getModifiers() & ~Modifier.FINAL);
+            limitField.set(null, limitDao);
+
+            Field epField = VendorLicenseManagerImpl.class.getDeclaredField("entitlementPoolDao");
+            epField.setAccessible(true);
+            modifiersField = Field.class.getDeclaredField("modifiers");
+            modifiersField.setAccessible(true);
+            modifiersField.setInt(epField, epField.getModifiers() & ~Modifier.FINAL);
+            epField.set(null, entitlementPoolDao);
+        } catch(NoSuchFieldException | IllegalAccessException e)
+        {
+            Assert.fail();
+        }
+
+        vendorLicenseManagerImpl.deleteEntitlementPool(entitlementPool, USER1);
+
+        verify(limitDao).delete(anyObject());
+    }
+
+    @Test
+    public void deleteEntitlementPoolInvalidTest() {
+        try {
+            Set<OperationalScope> opScopeChoices;
+            opScopeChoices = new HashSet<>();
+            opScopeChoices.add(OperationalScope.Core);
+            opScopeChoices.add(OperationalScope.CPU);
+            opScopeChoices.add(OperationalScope.Network_Wide);
+
+            EntitlementPoolEntity entitlementPool =
+                createEntitlementPool("vlm1Id", null, EP1_NAME, "EP2 dec", 70, ThresholdUnit.Absolute,
+                    EntitlementMetric.Other, "exception metric2", "inc2", AggregationFunction.Average, null,
+                    opScopeChoices, null, EntitlementTime.Other, "time2", "sku2");
+            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy");
+            entitlementPool.setStartDate(LocalDate.now().format(formatter));
+            entitlementPool.setExpiryDate(LocalDate.now().plusDays(1L).format(formatter));
+
+            VersionInfo info = new VersionInfo();
+            Version version = new Version();
+            info.getViewableVersions().add(version);
+            info.setActiveVersion(version);
+            doReturn(info).when(vendorLicenseFacade).getVersionInfo(anyObject(),anyObject(),anyObject());
+
+            LimitEntity limitEntity = LimitTest.createLimitEntity(LT1_NAME,LimitType.Vendor,"string",version,
+                EntitlementMetric.Core,AggregationFunction.Average,10,EntitlementTime.Hour);
+
+            ArrayList<LimitEntity> limitEntityList = new ArrayList();
+            limitEntityList.add(limitEntity);
+
+            doReturn(entitlementPool).when(entitlementPoolDao).get(anyObject());
+            doReturn(limitEntityList).when(vendorLicenseFacade).listLimits(anyObject(), anyObject(), anyObject(), anyObject());
+            doReturn(false).when(limitDao).isLimitPresent(anyObject());
+
+            try {
+                Field limitField = VendorLicenseManagerImpl.class.getDeclaredField("limitDao");
+                limitField.setAccessible(true);
+                Field modifiersField = Field.class.getDeclaredField("modifiers");
+                modifiersField.setAccessible(true);
+                modifiersField.setInt(limitField, limitField.getModifiers() & ~Modifier.FINAL);
+                limitField.set(null, limitDao);
+
+                Field epField = VendorLicenseManagerImpl.class.getDeclaredField("entitlementPoolDao");
+                epField.setAccessible(true);
+                modifiersField = Field.class.getDeclaredField("modifiers");
+                modifiersField.setAccessible(true);
+                modifiersField.setInt(epField, epField.getModifiers() & ~Modifier.FINAL);
+                epField.set(null, entitlementPoolDao);
+            } catch(NoSuchFieldException | IllegalAccessException e)
+            {
+                Assert.fail();
+            }
+
+            vendorLicenseManagerImpl.deleteEntitlementPool(entitlementPool, USER1);
+        } catch (CoreException exception) {
+            Assert.assertEquals(exception.code().id(), VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND);
+        }
+    }
+
+ /* private static final String USER1 = "epTestUser1";
   private static final String USER2 = "epTestUser2";
   private static final String EP1_V01_DESC = "EP1 desc";
   private static final Version VERSION01 = new Version(0, 1);
@@ -91,7 +440,6 @@
     entitlementPool.setOperationalScope(
         new MultiChoiceOrOther<>(operationalScopeChoices, operationalScopeOther));
     entitlementPool.setTime(new ChoiceOrOther<>(timeChoice, timeOther));
-    entitlementPool.setManufacturerReferenceNumber(sku);
     return entitlementPool;
   }
 
@@ -109,8 +457,6 @@
     Assert.assertEquals(actual.getAggregationFunction(), expected.getAggregationFunction());
     Assert.assertEquals(actual.getOperationalScope(), expected.getOperationalScope());
     Assert.assertEquals(actual.getTime(), expected.getTime());
-    Assert.assertEquals(actual.getManufacturerReferenceNumber(),
-        expected.getManufacturerReferenceNumber());
   }
 
   @BeforeClass
@@ -294,6 +640,6 @@
       Assert.assertEquals(exception.code().id(), UniqueValueUtil.UNIQUE_VALUE_VIOLATION);
     }
   }
-
-}
 */
+}
+
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/FeatureGroupTest.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/FeatureGroupTest.java
index e41cfa9..41c4678 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/FeatureGroupTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/FeatureGroupTest.java
@@ -17,44 +17,142 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-/*
+
 
 package org.openecomp.sdc.vendorlicense;
 
-import org.openecomp.core.util.UniqueValueUtil;
-import org.openecomp.core.utilities.CommonMethods;
-import org.openecomp.sdc.common.errors.CoreException;
-import org.openecomp.sdc.vendorlicense.dao.types.AggregationFunction;
-import org.openecomp.sdc.vendorlicense.dao.types.EntitlementMetric;
-import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity;
-import org.openecomp.sdc.vendorlicense.dao.types.EntitlementTime;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.mockito.Spy;
+import org.openecomp.sdc.vendorlicense.dao.*;
 import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity;
-import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupModel;
-import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity;
-import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyType;
-import org.openecomp.sdc.vendorlicense.dao.types.MultiChoiceOrOther;
-import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope;
-import org.openecomp.sdc.vendorlicense.dao.types.ThresholdUnit;
 import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade;
-import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacadeFactory;
+import org.openecomp.sdc.vendorlicense.facade.impl.VendorLicenseFacadeImpl;
 import org.openecomp.sdc.vendorlicense.impl.VendorLicenseManagerImpl;
+import org.openecomp.sdc.versioning.VersioningManager;
 import org.openecomp.sdc.versioning.dao.types.Version;
 import org.testng.Assert;
+import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
 import java.util.HashSet;
-import java.util.List;
 import java.util.Set;
 
-*/
+import static org.mockito.Matchers.anyObject;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+
 /**
  * Created by KATYR on 4/10/2016
- *//*
+ */
 
 public class FeatureGroupTest {
+    //JUnit Test Cases using Mockito
+    private static final Version VERSION01 = new Version(0, 1);
+    private final String FG1_NAME = "FG1 name";
+
+    @Mock
+    private VendorLicenseModelDao vendorLicenseModelDao;
+
+    @Mock
+    private LicenseAgreementDao licenseAgreementDao;
+
+    @Mock
+    private FeatureGroupDao featureGroupDao;
+
+    @Mock
+    private EntitlementPoolDao entitlementPoolDao;
+
+    @Mock
+    private LicenseKeyGroupDao licenseKeyGroupDao;
+
+    @Mock
+    private VersioningManager versioningManager;
+
+    @InjectMocks
+    @Spy
+    private VendorLicenseManagerImpl vendorLicenseManagerImpl;
+
+    public FeatureGroupEntity updateFeatureGroup(String vlmId, Version version, String id, String name, String desc,
+                                                 String partNumber, String manufacturerReferenceNumber, Set<String>
+                                                         licenseKeyGroupIds, Set<String> entitlementPoolIds, Set<String>
+                                                         referencingLicenseAgreements){
+        FeatureGroupEntity featureGroup = new FeatureGroupEntity(vlmId, version, id);
+        featureGroup.setVendorLicenseModelId(vlmId);
+        featureGroup.setVersion(version);
+        featureGroup.setId(id);
+        featureGroup.setName(name);
+        featureGroup.setDescription(desc);
+        featureGroup.setPartNumber(partNumber);
+        //featureGroup.setManufacturerReferenceNumber(manufacturerReferenceNumber);
+        featureGroup.setLicenseKeyGroupIds(licenseKeyGroupIds);
+        featureGroup.setEntitlementPoolIds(entitlementPoolIds);
+        featureGroup.setReferencingLicenseAgreements(referencingLicenseAgreements);
+
+        return featureGroup;
+    }
+
+    @BeforeMethod
+    public void setUp() throws Exception{
+        MockitoAnnotations.initMocks(this);
+    }
+
+    @Test
+    public void testUpdate(){
+        Set<String> licenseKeyGroupIds;
+        licenseKeyGroupIds = new HashSet<>();
+        licenseKeyGroupIds.add("lkg1");
+
+        Set<String> entitlementPoolIds;
+        entitlementPoolIds = new HashSet<>();
+        entitlementPoolIds.add("ep1");
+
+        Set<String> referencingLicenseAgreements;
+        referencingLicenseAgreements = new HashSet<>();
+        referencingLicenseAgreements.add("la1");
+
+        FeatureGroupEntity featureGroupEntity = updateFeatureGroup("vlmId", VERSION01, "fgId", FG1_NAME, "fg1 desc",
+                "partNumber", "MRN", licenseKeyGroupIds, entitlementPoolIds,
+                referencingLicenseAgreements);
+
+        doReturn(featureGroupEntity).when(featureGroupDao).get(anyObject());
+
+        /*if(featureGroupEntity.getManufacturerReferenceNumber() != null)
+            featureGroupDao.update(featureGroupEntity);
+        verify(featureGroupDao).update(anyObject());*/
+    }
+
+    @Test
+    public void testUpdateWithoutManufacturingReferenceNumber(){
+        Set<String> licenseKeyGroupIds;
+        licenseKeyGroupIds = new HashSet<>();
+        licenseKeyGroupIds.add("lkg1");
+
+        Set<String> entitlementPoolIds;
+        entitlementPoolIds = new HashSet<>();
+        entitlementPoolIds.add("ep1");
+
+        Set<String> referencingLicenseAgreements;
+        referencingLicenseAgreements = new HashSet<>();
+        referencingLicenseAgreements.add("la1");
+
+        FeatureGroupEntity featureGroupEntity = updateFeatureGroup("vlmId", VERSION01, "fgId", FG1_NAME, "fg1 desc",
+                "partNumber", null, licenseKeyGroupIds, entitlementPoolIds,
+                referencingLicenseAgreements);
+
+        doReturn(featureGroupEntity).when(featureGroupDao).get(anyObject());
+
+        /*if(featureGroupEntity.getManufacturerReferenceNumber() != null)
+            featureGroupDao.update(featureGroupEntity);
+        verify(featureGroupDao, never()).update(anyObject());*/
+    }
+
+
+}
+
+/*
   protected static final Version VERSION01 = new Version(0, 1);
   protected static final String USER1 = "FeatureGroupTest_User1";
   protected static VendorLicenseManager vendorLicenseManager = new VendorLicenseManagerImpl();
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/LicenseKeyGroupTest.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/LicenseKeyGroupTest.java
index a12d9fc..782d93a 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/LicenseKeyGroupTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/LicenseKeyGroupTest.java
@@ -16,36 +16,177 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ============LICENSE_END=========================================================
- *//*
+ */
 
 
 package org.openecomp.sdc.vendorlicense;
 
-import org.openecomp.core.nosqldb.api.NoSqlDb;
-import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
-import org.openecomp.core.util.UniqueValueUtil;
-import org.openecomp.core.utilities.CommonMethods;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.mockito.Spy;
 import org.openecomp.sdc.common.errors.CoreException;
 import org.openecomp.sdc.vendorlicense.dao.LicenseKeyGroupDao;
-import org.openecomp.sdc.vendorlicense.dao.LicenseKeyGroupDaoFactory;
-import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity;
-import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyType;
-import org.openecomp.sdc.vendorlicense.dao.types.MultiChoiceOrOther;
-import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope;
+import org.openecomp.sdc.vendorlicense.dao.LimitDao;
+import org.openecomp.sdc.vendorlicense.dao.types.*;
+import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade;
 import org.openecomp.sdc.vendorlicense.impl.VendorLicenseManagerImpl;
 import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdc.versioning.errors.VersioningErrorCodes;
+import org.openecomp.sdc.versioning.types.VersionInfo;
 import org.testng.Assert;
-import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
-import java.util.Collection;
-import java.util.Collections;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.Set;
 
+import static org.mockito.Matchers.anyObject;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.verify;
+
 public class LicenseKeyGroupTest {
 
-  public static final String LKG1_NAME = "LKG1 name";
+    //JUnit Test Cases using Mockito
+    private  final String USER = "lkgTestUser";
+    private  final String LKG_NAME = "LKG name";
+    private  final String LT_NAME = "LT name";
+
+    @Mock
+    private VendorLicenseFacade vendorLicenseFacade;
+
+    @Mock
+    private LicenseKeyGroupDao licenseKeyGroupDao;
+    @Mock
+    private LimitDao limitDao;
+
+    @InjectMocks
+    @Spy
+    private VendorLicenseManagerImpl vendorLicenseManagerImpl;
+
+    @BeforeMethod
+    public void setUp() throws Exception {
+        MockitoAnnotations.initMocks(this);
+    }
+
+    private LicenseKeyGroupEntity createLicenseKeyGroup(LicenseKeyType type, Set<OperationalScope> operationalScopeChoices,
+                                                            String operationalScopeOther)
+    {
+        LicenseKeyGroupEntity licenseKeyGroupEntity = new LicenseKeyGroupEntity();
+        licenseKeyGroupEntity.setType(type);
+        licenseKeyGroupEntity.setOperationalScope(
+                new MultiChoiceOrOther<>(operationalScopeChoices, operationalScopeOther));
+        return licenseKeyGroupEntity;
+    }
+
+    @Test
+    public void deleteLicenseKeyGroupTest() {
+        Set<OperationalScope> opScopeChoices;
+        opScopeChoices = new HashSet<>();
+        opScopeChoices.add(OperationalScope.Core);
+        opScopeChoices.add(OperationalScope.CPU);
+        opScopeChoices.add(OperationalScope.Network_Wide);
+
+        LicenseKeyGroupEntity licenseKeyGroup =
+                createLicenseKeyGroup(LicenseKeyType.Unique, opScopeChoices, null);
+
+        VersionInfo info = new VersionInfo();
+        Version version = new Version();
+        info.getViewableVersions().add(version);
+        info.setActiveVersion(version);
+        doReturn(info).when(vendorLicenseFacade).getVersionInfo(anyObject(),anyObject(),anyObject());
+
+        LimitEntity limitEntity = LimitTest.createLimitEntity(LT_NAME,LimitType.Vendor,"string",version,
+                EntitlementMetric.Core,AggregationFunction.Average,10,EntitlementTime.Hour);
+
+        ArrayList<LimitEntity> limitEntityList = new ArrayList();
+        limitEntityList.add(limitEntity);
+
+        doReturn(licenseKeyGroup).when(licenseKeyGroupDao).get(anyObject());
+        doReturn(limitEntityList).when(vendorLicenseFacade).listLimits(anyObject(), anyObject(), anyObject(), anyObject());
+        doReturn(true).when(limitDao).isLimitPresent(anyObject());
+        doReturn(limitEntity).when(limitDao).get(anyObject());
+        try {
+            Field limitField = VendorLicenseManagerImpl.class.getDeclaredField("limitDao");
+            limitField.setAccessible(true);
+            Field modifiersField = Field.class.getDeclaredField("modifiers");
+            modifiersField.setAccessible(true);
+            modifiersField.setInt(limitField, limitField.getModifiers() & ~Modifier.FINAL);
+            limitField.set(null, limitDao);
+
+            Field lkgField = VendorLicenseManagerImpl.class.getDeclaredField("licenseKeyGroupDao");
+            lkgField.setAccessible(true);
+            modifiersField = Field.class.getDeclaredField("modifiers");
+            modifiersField.setAccessible(true);
+            modifiersField.setInt(lkgField, lkgField.getModifiers() & ~Modifier.FINAL);
+            lkgField.set(null, licenseKeyGroupDao);
+        } catch(NoSuchFieldException | IllegalAccessException e)
+        {
+            Assert.fail();
+        }
+
+        vendorLicenseManagerImpl.deleteLicenseKeyGroup(licenseKeyGroup, USER);
+
+        verify(limitDao).delete(anyObject());
+    }
+
+    @Test
+    public void deleteLicenseKeyGroupInvalidTest() {
+        try {
+            Set<OperationalScope> opScopeChoices;
+            opScopeChoices = new HashSet<>();
+            opScopeChoices.add(OperationalScope.Core);
+            opScopeChoices.add(OperationalScope.CPU);
+            opScopeChoices.add(OperationalScope.Network_Wide);
+
+            LicenseKeyGroupEntity licenseKeyGroup =
+                createLicenseKeyGroup(LicenseKeyType.Unique, opScopeChoices, null);
+
+            VersionInfo info = new VersionInfo();
+            Version version = new Version();
+            info.getViewableVersions().add(version);
+            info.setActiveVersion(version);
+            doReturn(info).when(vendorLicenseFacade).getVersionInfo(anyObject(),anyObject(),anyObject());
+
+            LimitEntity limitEntity = LimitTest.createLimitEntity(LT_NAME,LimitType.Vendor,"string",version,
+                EntitlementMetric.Core,AggregationFunction.Average,10,EntitlementTime.Hour);
+
+            ArrayList<LimitEntity> limitEntityList = new ArrayList();
+            limitEntityList.add(limitEntity);
+
+            doReturn(licenseKeyGroup).when(licenseKeyGroupDao).get(anyObject());
+            doReturn(limitEntityList).when(vendorLicenseFacade).listLimits(anyObject(), anyObject(), anyObject(), anyObject());
+            doReturn(false).when(limitDao).isLimitPresent(anyObject());
+
+            try {
+                Field limitField = VendorLicenseManagerImpl.class.getDeclaredField("limitDao");
+                limitField.setAccessible(true);
+                Field modifiersField = Field.class.getDeclaredField("modifiers");
+                modifiersField.setAccessible(true);
+                modifiersField.setInt(limitField, limitField.getModifiers() & ~Modifier.FINAL);
+                limitField.set(null, limitDao);
+
+                Field lkgField = VendorLicenseManagerImpl.class.getDeclaredField("licenseKeyGroupDao");
+                lkgField.setAccessible(true);
+                modifiersField = Field.class.getDeclaredField("modifiers");
+                modifiersField.setAccessible(true);
+                modifiersField.setInt(lkgField, lkgField.getModifiers() & ~Modifier.FINAL);
+                lkgField.set(null, licenseKeyGroupDao);
+            } catch(NoSuchFieldException | IllegalAccessException e)
+            {
+                Assert.fail();
+            }
+
+            vendorLicenseManagerImpl.deleteLicenseKeyGroup(licenseKeyGroup, USER);
+        } catch (CoreException exception) {
+            Assert.assertEquals(exception.code().id(), VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND);
+        }
+    }
+
+  /*public static final String LKG1_NAME = "LKG1 name";
   private static final Version VERSION01 = new Version(0, 1);
   private static final String USER1 = "user1";
   public static String vlm1Id;
@@ -179,6 +320,5 @@
   public void testCreateWithRemovedName() {
     testCreate(vlm1Id, LKG1_NAME);
   }
+  */
 }
-
-*/
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/LimitTest.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/LimitTest.java
new file mode 100644
index 0000000..a8d1ed9
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/LimitTest.java
@@ -0,0 +1,332 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.vendorlicense;
+
+import static org.mockito.Matchers.anyObject;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.verify;
+
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.mockito.Spy;
+import org.openecomp.sdc.common.errors.CoreException;
+import org.openecomp.sdc.vendorlicense.dao.LimitDao;
+import org.openecomp.sdc.vendorlicense.dao.types.AggregationFunction;
+import org.openecomp.sdc.vendorlicense.dao.types.EntitlementMetric;
+import org.openecomp.sdc.vendorlicense.dao.types.EntitlementTime;
+import org.openecomp.sdc.vendorlicense.dao.types.LimitEntity;
+import org.openecomp.sdc.vendorlicense.dao.types.LimitType;
+import org.openecomp.sdc.vendorlicense.errors.VendorLicenseErrorCodes;
+import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade;
+import org.openecomp.sdc.vendorlicense.impl.VendorLicenseManagerImpl;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdc.versioning.errors.VersioningErrorCodes;
+import org.openecomp.sdc.versioning.types.VersionInfo;
+import org.testng.Assert;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+
+import static org.mockito.Mockito.when;
+
+public class LimitTest {
+
+  private  final String USER1 = "limitTestUser1";
+  private  final String LT1_NAME = "LT1 name";
+
+  private static final String VLM_ID = "VLM_ID";
+  private static final Version VERSION = new Version(0, 1);
+  private static final String EPLKG_ID = "ID";
+  private static final String LIMIT1_ID = "limit1";
+  private static final String LIMIT2_ID = "limit2";
+
+  @Mock
+  private VendorLicenseFacade vendorLicenseFacade;
+
+  @Mock
+  private LimitDao limitDao;
+
+  @InjectMocks
+  @Spy
+  private VendorLicenseManagerImpl vendorLicenseManagerImpl;
+
+  public static LimitEntity createLimitEntity(String name, LimitType type, String description,
+                                       Version version, EntitlementMetric metric,
+                                       AggregationFunction aggregationFunction, int unit,
+                                       EntitlementTime time) {
+    LimitEntity limitEntity = new LimitEntity();
+    limitEntity.setName(name);
+    limitEntity.setType(type);
+    limitEntity.setDescription(description);
+    limitEntity.setVersion(version);
+    limitEntity.setMetric(metric);
+    limitEntity.setAggregationFunction(aggregationFunction);
+    limitEntity.setUnit(unit);
+    limitEntity.setTime(time);
+    return limitEntity;
+  }
+
+  @BeforeMethod
+  public void setUp() throws Exception {
+    MockitoAnnotations.initMocks(this);
+    try {
+      Field limitField = VendorLicenseManagerImpl.class.getDeclaredField("limitDao");
+      limitField.setAccessible(true);
+      Field modifiersField = Field.class.getDeclaredField("modifiers");
+      modifiersField.setAccessible(true);
+      modifiersField.setInt(limitField, limitField.getModifiers() & ~Modifier.FINAL);
+      limitField.set(null, limitDao);
+    } catch(NoSuchFieldException | IllegalAccessException e)
+    {
+      Assert.fail();
+    }
+  }
+
+  @Test
+  public void testUpdateLimit() {
+    Version version = new Version();
+    LimitEntity limitEntity1 = createLimitEntity(LT1_NAME,LimitType.Vendor,"string",version,
+        EntitlementMetric.Core,AggregationFunction.Average,10,EntitlementTime.Hour);
+    LimitEntity limitEntity2 = createLimitEntity(LT1_NAME,LimitType.Vendor,"string",version,
+        EntitlementMetric.Tokens,AggregationFunction.Peak,12,EntitlementTime.Month);
+    VersionInfo info = new VersionInfo();
+    info.getViewableVersions().add(version);
+    info.setActiveVersion(version);
+
+    doReturn(info).when(vendorLicenseFacade).getVersionInfo(anyObject(),anyObject(),anyObject());
+    doReturn(true).when(limitDao).isLimitPresent(anyObject());
+    doReturn(limitEntity1).when(limitDao).get(anyObject());
+
+    List<LimitEntity> limitEntityList = new ArrayList<>();
+    limitEntityList.add(limitEntity1);
+    limitEntityList.add(limitEntity2);
+    limitEntity1.setId("1234");
+    limitEntity2.setId("1234");
+    doReturn(limitEntityList).when(vendorLicenseFacade).listLimits(anyObject(),anyObject(),
+        anyObject(),anyObject());
+
+    vendorLicenseManagerImpl.updateLimit(limitEntity2,USER1);
+
+    verify(vendorLicenseFacade).updateLimit(anyObject(), anyObject());
+  }
+
+  @Test
+  public void testUpdateLimitErrorWithSameNameType() {
+    try {
+      Version version = new Version();
+      LimitEntity limitEntity1 = createLimitEntity(LT1_NAME,LimitType.Vendor,"string",version,
+          EntitlementMetric.Core,AggregationFunction.Average,10,EntitlementTime.Hour);
+      LimitEntity limitEntity2 = createLimitEntity(LT1_NAME,LimitType.Vendor,"string",version,
+          EntitlementMetric.Tokens,AggregationFunction.Peak,12,EntitlementTime.Month);
+      VersionInfo info = new VersionInfo();
+      info.getViewableVersions().add(version);
+      info.setActiveVersion(version);
+
+      doReturn(info).when(vendorLicenseFacade).getVersionInfo(anyObject(),anyObject(),anyObject());
+      doReturn(limitEntity1).when(limitDao).get(anyObject());
+
+      List<LimitEntity> limitEntityList = new ArrayList<>();
+      limitEntityList.add(limitEntity1);
+      limitEntityList.add(limitEntity2);
+      limitEntity1.setId("1234");
+      limitEntity2.setId("9632");
+      doReturn(limitEntityList).when(vendorLicenseFacade).listLimits(anyObject(),anyObject(),
+          anyObject(),anyObject());
+
+      vendorLicenseManagerImpl.updateLimit(limitEntity2,USER1);
+      Assert.fail();
+    } catch (CoreException exception) {
+      Assert.assertEquals(exception.code().id(),
+          VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND);
+    }
+  }
+
+  @Test
+  public void testDeleteLimit() {
+    Version version = new Version();
+    LimitEntity limitEntity = createLimitEntity(LT1_NAME,LimitType.Vendor,"string",version,
+            EntitlementMetric.Core,AggregationFunction.Average,10,EntitlementTime.Hour);
+    VersionInfo info = new VersionInfo();
+    info.getViewableVersions().add(version);
+    info.setActiveVersion(version);
+
+    doReturn(info).when(vendorLicenseFacade).getVersionInfo(anyObject(),anyObject(),anyObject());
+    doReturn(true).when(limitDao).isLimitPresent(anyObject());
+    doReturn(limitEntity).when(limitDao).get(anyObject());
+
+    List<LimitEntity> limitEntityList = new ArrayList<>();
+    limitEntityList.add(limitEntity);
+    limitEntity.setId("1234");
+
+    vendorLicenseManagerImpl.deleteLimit(limitEntity,LT1_NAME);
+
+    verify(vendorLicenseManagerImpl).deleteLimit(anyObject(), anyObject());
+  }
+
+  @Test
+  public void testUpdateLimitErrorWithInvalidId() {
+    try {
+      Version version = new Version();
+      LimitEntity limitEntity1 = createLimitEntity(LT1_NAME,LimitType.Vendor,"string",version,
+          EntitlementMetric.Core,AggregationFunction.Average,10,EntitlementTime.Hour);
+      LimitEntity limitEntity2 = createLimitEntity(LT1_NAME,LimitType.Vendor,"string",version,
+          EntitlementMetric.Tokens,AggregationFunction.Peak,12,EntitlementTime.Month);
+      VersionInfo info = new VersionInfo();
+      info.getViewableVersions().add(version);
+      info.setActiveVersion(version);
+
+      doReturn(info).when(vendorLicenseFacade).getVersionInfo(anyObject(),anyObject(),anyObject());
+      doReturn(null).when(limitDao).get(anyObject());
+
+      vendorLicenseManagerImpl.updateLimit(limitEntity2,USER1);
+      Assert.fail();
+    } catch (CoreException exception) {
+      Assert.assertEquals(exception.code().id(),
+          VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND);
+    }
+  }
+
+  @Test
+  public void testList() {
+    doReturn(Arrays.asList(
+        createLimit(VLM_ID, VERSION, EPLKG_ID, LIMIT1_ID),
+        createLimit(VLM_ID, VERSION, EPLKG_ID, LIMIT2_ID)))
+        .when(vendorLicenseFacade).listLimits(VLM_ID, VERSION, EPLKG_ID, USER1);
+
+    final Collection<LimitEntity> limits =
+        vendorLicenseManagerImpl.listLimits(VLM_ID, VERSION, EPLKG_ID, USER1);
+    Assert.assertEquals(limits.size(), 2);
+    for (LimitEntity limit : limits) {
+      Assert.assertEquals(limit.getName(),
+          LIMIT1_ID.equals(limit.getId()) ? LIMIT1_ID+" name" : LIMIT2_ID+" name" );
+    }
+  }
+
+  @Test
+  public void testCreateLimit() {
+    LimitEntity expected = createLimit(VLM_ID, VERSION, EPLKG_ID, LIMIT1_ID);
+    VersionInfo info = new VersionInfo();
+    info.getViewableVersions().add(VERSION);
+    info.setActiveVersion(VERSION);
+
+    doReturn(info).when(vendorLicenseFacade).getVersionInfo(anyObject(),anyObject(),anyObject());
+
+    vendorLicenseManagerImpl.createLimit(expected, USER1);
+    verify(vendorLicenseFacade).createLimit(expected,USER1);
+  }
+
+  @Test
+  public void testCreateWithDuplicateName() {
+    LimitEntity expected = createLimit(VLM_ID, VERSION, EPLKG_ID, LIMIT1_ID);
+    expected.setType(LimitType.Vendor);
+
+    LimitEntity expectedDiffName = createLimit(VLM_ID, VERSION, EPLKG_ID, LIMIT2_ID);
+    expectedDiffName.setName(LIMIT1_ID + " name");
+    expectedDiffName.setType(LimitType.Vendor);
+
+    List<LimitEntity> vfcImageList = new ArrayList<LimitEntity>();
+    vfcImageList.add(expectedDiffName);
+    doReturn(vfcImageList).when(vendorLicenseFacade).listLimits(anyObject(), anyObject(), anyObject(),
+        anyObject());
+
+    VersionInfo info = new VersionInfo();
+    info.getViewableVersions().add(VERSION);
+    info.setActiveVersion(VERSION);
+
+    doReturn(info).when(vendorLicenseFacade).getVersionInfo(anyObject(),anyObject(),anyObject());
+
+    try {
+      vendorLicenseManagerImpl.createLimit(expected, USER1);
+      Assert.fail();
+    }
+    catch (CoreException ex) {
+      Assert.assertEquals(ex.code().id(),
+          VendorLicenseErrorCodes.DUPLICATE_LIMIT_NAME_NOT_ALLOWED);
+    }
+  }
+
+  @Test
+  public void testGetNonExistingLimitId_negative() {
+    LimitEntity limit = createLimit(VLM_ID, VERSION, EPLKG_ID, "non existing limit id");
+    VersionInfo info = new VersionInfo();
+    info.getViewableVersions().add(VERSION);
+    info.setActiveVersion(VERSION);
+
+    doReturn(info).when(vendorLicenseFacade).getVersionInfo(anyObject(),anyObject(),anyObject());
+
+    try {
+      vendorLicenseManagerImpl.getLimit(limit , USER1);
+      Assert.fail();
+    } catch (CoreException exception) {
+      Assert.assertEquals(exception.code().id(), VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND);
+    }
+  }
+
+  @Test
+  public void testGet() {
+    LimitEntity expected = createLimit(VLM_ID, VERSION, EPLKG_ID, LIMIT1_ID);
+    expected.setType(LimitType.Vendor);
+    expected.setValue(100);
+    expected.setUnit(10);
+    expected.setAggregationFunction(AggregationFunction.Average);
+    expected.setMetric(EntitlementMetric.CPU);
+    expected.setTime(EntitlementTime.Day);
+
+    doReturn(true).when(limitDao).isLimitPresent(anyObject());
+    doReturn(expected).when(limitDao).get(anyObject());
+    VersionInfo info = new VersionInfo();
+    info.getViewableVersions().add(VERSION);
+    info.setActiveVersion(VERSION);
+
+    doReturn(info).when(vendorLicenseFacade).getVersionInfo(anyObject(),anyObject(),anyObject());
+
+    LimitEntity actual = createLimit(VLM_ID, VERSION, EPLKG_ID, LIMIT1_ID);
+    vendorLicenseManagerImpl.getLimit(actual, USER1);
+    Assert.assertEquals(actual.getId(), expected.getId());
+    Assert.assertEquals(actual.getName(), expected.getName());
+    Assert.assertEquals(actual.getUnit(), expected.getUnit());
+    Assert.assertEquals(actual.getValue(), expected.getValue());
+    Assert.assertEquals(actual.getAggregationFunction().name(), expected.getAggregationFunction()
+        .name());
+    Assert.assertEquals(actual.getMetric().name(), expected.getMetric().name());
+
+  }
+
+  static LimitEntity createLimit(String vlmId, Version version, String epLkgId, String limitId) {
+    LimitEntity limitEntity = new LimitEntity(vlmId, version, epLkgId, limitId);
+    limitEntity.setName(limitId + " name");
+    limitEntity.setDescription(limitId + " desc");
+    limitEntity.setVersion(version);
+    limitEntity.setMetric(EntitlementMetric.CPU);
+    limitEntity.setAggregationFunction(AggregationFunction.Average);
+    limitEntity.setUnit(10);
+    limitEntity.setTime(EntitlementTime.Day);
+    limitEntity.setValue(100);
+    return limitEntity;
+  }
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/VendorLicenseFacadeImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/VendorLicenseFacadeImplTest.java
new file mode 100644
index 0000000..58db488
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/VendorLicenseFacadeImplTest.java
@@ -0,0 +1,127 @@
+package org.openecomp.sdc.vendorlicense;
+
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.mockito.Spy;
+import org.openecomp.sdc.vendorlicense.dao.*;
+import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity;
+import org.openecomp.sdc.vendorlicense.facade.impl.VendorLicenseFacadeImpl;
+import org.openecomp.sdc.versioning.VersioningManager;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import static org.mockito.Matchers.anyObject;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+
+/**
+ * Created by diveshm on 7/3/2017.
+ */
+public class VendorLicenseFacadeImplTest {
+    //JUnit Test Cases using Mockito
+    private static final Version VERSION01 = new Version(0, 1);
+    private final String FG1_NAME = "FG1 name";
+
+    @Mock
+    private VendorLicenseModelDao vendorLicenseModelDao;
+
+    @Mock
+    private LicenseAgreementDao licenseAgreementDao;
+
+    @Mock
+    private FeatureGroupDao featureGroupDao;
+
+    @Mock
+    private EntitlementPoolDao entitlementPoolDao;
+
+    @Mock
+    private LicenseKeyGroupDao licenseKeyGroupDao;
+
+    @Mock
+    private VersioningManager versioningManager;
+
+    @InjectMocks
+    @Spy
+    private VendorLicenseFacadeImpl vendorLicenseFacadeImpl;
+
+    public FeatureGroupEntity createFeatureGroup(String vlmId, Version version, String id, String name, String desc,
+                                                 String partNumber, String manufacturerReferenceNumber, Set<String>
+                                                         licenseKeyGroupIds, Set<String> entitlementPoolIds, Set<String>
+                                                         referencingLicenseAgreements){
+        FeatureGroupEntity featureGroup = new FeatureGroupEntity(vlmId, version, id);
+        featureGroup.setVendorLicenseModelId(vlmId);
+        featureGroup.setVersion(version);
+        featureGroup.setId(id);
+        featureGroup.setName(name);
+        featureGroup.setDescription(desc);
+        featureGroup.setPartNumber(partNumber);
+        //featureGroup.setManufacturerReferenceNumber(manufacturerReferenceNumber);
+        featureGroup.setLicenseKeyGroupIds(licenseKeyGroupIds);
+        featureGroup.setEntitlementPoolIds(entitlementPoolIds);
+        featureGroup.setReferencingLicenseAgreements(referencingLicenseAgreements);
+
+        return featureGroup;
+    }
+
+    @BeforeMethod
+    public void setUp() throws Exception{
+        MockitoAnnotations.initMocks(this);
+    }
+
+    @Test
+    public void testCreate(){
+        Set<String> licenseKeyGroupIds;
+        licenseKeyGroupIds = new HashSet<>();
+        licenseKeyGroupIds.add("lkg1");
+
+        Set<String> entitlementPoolIds;
+        entitlementPoolIds = new HashSet<>();
+        entitlementPoolIds.add("ep1");
+
+        Set<String> referencingLicenseAgreements;
+        referencingLicenseAgreements = new HashSet<>();
+        referencingLicenseAgreements.add("la1");
+
+        FeatureGroupEntity featureGroupEntity = createFeatureGroup("vlmId", VERSION01, "fgId", FG1_NAME, "fg1 desc",
+                "partNumber", "MRN", licenseKeyGroupIds, entitlementPoolIds,
+                referencingLicenseAgreements);
+
+        doReturn(featureGroupEntity).when(featureGroupDao).get(anyObject());
+
+        /*if(featureGroupEntity.getManufacturerReferenceNumber() != null)
+            featureGroupDao.create(featureGroupEntity);
+        verify(featureGroupDao).create(anyObject());*/
+    }
+
+    @Test
+    public void testCreateWithoutManufacturerReferenceNumber(){
+        Set<String> licenseKeyGroupIds;
+        licenseKeyGroupIds = new HashSet<>();
+        licenseKeyGroupIds.add("lkg1");
+
+        Set<String> entitlementPoolIds;
+        entitlementPoolIds = new HashSet<>();
+        entitlementPoolIds.add("ep1");
+
+        Set<String> referencingLicenseAgreements;
+        referencingLicenseAgreements = new HashSet<>();
+        referencingLicenseAgreements.add("la1");
+
+        FeatureGroupEntity featureGroupEntity = createFeatureGroup("vlmId", VERSION01, "fgId", FG1_NAME, "fg1 desc",
+                "partNumber", null, licenseKeyGroupIds, entitlementPoolIds,
+                referencingLicenseAgreements);
+        doReturn(featureGroupEntity).when(featureGroupDao).get(anyObject());
+
+        /*if(featureGroupEntity.getManufacturerReferenceNumber() != null)
+            featureGroupDao.create(featureGroupEntity);
+
+        verify(featureGroupDao, never()).create(anyObject());*/
+
+    }
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/C36B4399FCB942B19D493F839CFA10E2_0_1_General_6E70545C4854465D82DBDB9BCBEF0FB5 b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/C36B4399FCB942B19D493F839CFA10E2_0_1_General_6E70545C4854465D82DBDB9BCBEF0FB5
new file mode 100644
index 0000000..58e6f9e
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/C36B4399FCB942B19D493F839CFA10E2_0_1_General_6E70545C4854465D82DBDB9BCBEF0FB5
@@ -0,0 +1 @@
+bla bla
\ No newline at end of file
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/VSPPackage.zip b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/VSPPackage.zip
new file mode 100644
index 0000000..ca55484
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/VSPPackage.zip
Binary files differ
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/pom.xml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/pom.xml
index ee779da..ba95d4a 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/pom.xml
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/pom.xml
@@ -15,6 +15,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.core</groupId>
             <artifactId>openecomp-utilities-lib</artifactId>
             <version>${project.version}</version>
@@ -170,6 +175,16 @@
             <artifactId>openecomp-sdc-activity-log-api</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.openecomp.sdc</groupId>
+            <artifactId>openecomp-sdc-tosca-generator-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.openecomp.sdc</groupId>
+            <artifactId>openecomp-sdc-tosca-generator-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
     </dependencies>
     <build>
         <plugins>
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/pom.xml.versionsBackup b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/pom.xml.versionsBackup
new file mode 100644
index 0000000..839a192
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/pom.xml.versionsBackup
@@ -0,0 +1,159 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         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-manager</artifactId>
+    <version>1.0-SNAPSHOT</version>
+    <dependencies>
+        <dependency>
+            <groupId>org.openecomp.core</groupId>
+            <artifactId>openecomp-utilities-lib</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.openecomp.core</groupId>
+            <artifactId>openecomp-nosqldb-core</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.openecomp.sdc</groupId>
+            <artifactId>openecomp-sdc-vendor-software-product-core</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.openecomp.core</groupId>
+            <artifactId>openecomp-heat-lib</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.openecomp.core</groupId>
+            <artifactId>openecomp-tosca-lib</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.testng</groupId>
+            <artifactId>testng</artifactId>
+            <version>6.9.10</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>RELEASE</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-all</artifactId>
+            <version>1.10.19</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.openecomp.sdc</groupId>
+            <artifactId>openecomp-sdc-translator-core</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.dataformat</groupId>
+            <artifactId>jackson-dataformat-xml</artifactId>
+            <version>2.7.4</version>
+        </dependency>
+        <dependency>
+            <groupId>org.codehaus.woodstox</groupId>
+            <artifactId>woodstox-core-asl</artifactId>
+            <version>4.4.1</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.openecomp.sdc</groupId>
+            <artifactId>openecomp-sdc-vendor-license-core</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.openecomp.sdc</groupId>
+            <artifactId>openecomp-sdc-enrichment-core</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.openecomp.sdc</groupId>
+            <artifactId>openecomp-sdc-validation-api</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.openecomp.sdc</groupId>
+            <artifactId>openecomp-sdc-validation-impl</artifactId>
+            <version>1.0-SNAPSHOT</version>
+            <scope>runtime</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.openecomp.sdc</groupId>
+            <artifactId>openecomp-sdc-enrichment-impl</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-io</groupId>
+            <artifactId>commons-io</artifactId>
+            <version>${commons.io.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.openecomp.sdc</groupId>
+            <artifactId>openecomp-sdc-model-impl</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.openecomp.sdc</groupId>
+            <artifactId>openecomp-sdc-validation-manager</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.openecomp.sdc</groupId>
+            <artifactId>openecomp-sdc-logging-core</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.openecomp.sdc</groupId>
+            <artifactId>openecomp-sdc-logging-api</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.openecomp.sdc</groupId>
+            <artifactId>openecomp-sdc-healing-core</artifactId>
+            <version>1.0-SNAPSHOT</version>
+            <scope>runtime</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.openecomp.sdc</groupId>
+            <artifactId>openecomp-sdc-healing-impl</artifactId>
+            <version>1.0-SNAPSHOT</version>
+            <scope>runtime</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.openecomp.sdc</groupId>
+            <artifactId>openecomp-sdc-healing-api</artifactId>
+            <version>1.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>
+
+    <parent>
+        <groupId>org.openecomp.sdc</groupId>
+        <artifactId>backend</artifactId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+
+
+</project>
\ No newline at end of file
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ComputeManager.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ComputeManager.java
new file mode 100644
index 0000000..65bceb9
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ComputeManager.java
@@ -0,0 +1,34 @@
+package org.openecomp.sdc.vendorsoftwareproduct;
+
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComputeEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse;
+import org.openecomp.sdc.vendorsoftwareproduct.types.ListComputeResponse;
+import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireResponse;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityValidationData;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComputeData;
+import org.openecomp.sdc.versioning.dao.types.Version;
+
+import java.util.Collection;
+
+public interface ComputeManager {
+
+  Collection<ListComputeResponse> listCompute(String vspId, Version version, String
+      componentId, String user);
+
+  ComputeEntity createCompute(ComputeEntity compute, String user);
+
+  CompositionEntityResponse<ComputeData> getCompute(String vspId, Version version, String
+      componentId, String computeFlavorId, String user);
+
+  QuestionnaireResponse getComputeQuestionnaire(String vspId, Version version, String
+      componentId, String computeFlavorId, String user);
+
+  void updateComputeQuestionnaire(String vspId, Version version, String componentId, String
+      computeId, String
+      questionnaireData, String user);
+
+  CompositionEntityValidationData updateCompute(ComputeEntity compute, String user);
+
+  void deleteCompute(String vspId, Version version,String componentId, String computeFlavorId,
+                     String user);
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ComputeManagerFactory.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ComputeManagerFactory.java
new file mode 100644
index 0000000..26b5bda
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ComputeManagerFactory.java
@@ -0,0 +1,11 @@
+package org.openecomp.sdc.vendorsoftwareproduct;
+
+import org.openecomp.core.factory.api.AbstractComponentFactory;
+import org.openecomp.core.factory.api.AbstractFactory;
+
+public abstract class ComputeManagerFactory extends AbstractComponentFactory<ComputeManager> {
+
+    public static ComputeManagerFactory getInstance() {
+      return AbstractFactory.getInstance(ComputeManagerFactory.class);
+    }
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/DeploymentFlavorManager.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/DeploymentFlavorManager.java
new file mode 100644
index 0000000..51ba2f4
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/DeploymentFlavorManager.java
@@ -0,0 +1,34 @@
+package org.openecomp.sdc.vendorsoftwareproduct;
+
+
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.DeploymentFlavorEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityValidationData;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.DeploymentFlavor;
+import org.openecomp.sdc.versioning.dao.types.Version;
+
+import java.util.Collection;
+
+public interface DeploymentFlavorManager {
+
+
+  DeploymentFlavorEntity createDeploymentFlavor(DeploymentFlavorEntity deploymentFlavorEntity,
+                                                String user);
+
+  Collection<DeploymentFlavorEntity> listDeploymentFlavors(String vspId, Version version,
+                                                           String user);
+
+  CompositionEntityResponse<DeploymentFlavor> getDeploymentFlavor(String vspId, Version version,
+                                                                  String deploymentFlavorId,
+                                                                  String user);
+
+  CompositionEntityResponse<DeploymentFlavor> getDeploymentFlavorSchema(String vspId, Version
+      version, String user);
+
+  void deleteDeploymentFlavor(String vspId, Version version, String deploymentFlavorId, String
+      user);
+
+  CompositionEntityValidationData updateDeploymentFlavor(DeploymentFlavorEntity
+                                                             deploymentFlavorEntity, String user);
+
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/DeploymentFlavorManagerFactory.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/DeploymentFlavorManagerFactory.java
new file mode 100644
index 0000000..a367057
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/DeploymentFlavorManagerFactory.java
@@ -0,0 +1,13 @@
+package org.openecomp.sdc.vendorsoftwareproduct;
+
+
+import org.openecomp.core.factory.api.AbstractComponentFactory;
+import org.openecomp.core.factory.api.AbstractFactory;
+
+public abstract class DeploymentFlavorManagerFactory extends
+    AbstractComponentFactory<DeploymentFlavorManager> {
+
+  public static DeploymentFlavorManagerFactory getInstance() {
+    return AbstractFactory.getInstance(DeploymentFlavorManagerFactory.class);
+  }
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ImageManager.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ImageManager.java
new file mode 100644
index 0000000..6bbfc0b
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ImageManager.java
@@ -0,0 +1,33 @@
+package org.openecomp.sdc.vendorsoftwareproduct;
+
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ImageEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse;
+import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireResponse;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityValidationData;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Image;
+import org.openecomp.sdc.versioning.dao.types.Version;
+
+import java.util.Collection;
+
+public interface ImageManager {
+  ImageEntity createImage(ImageEntity imageEntity, String user);
+
+  CompositionEntityResponse<Image> getImageSchema(String vspId, String user);
+
+  Collection<ImageEntity> listImages(String vspId, Version version, String componentId,
+                                     String user);
+
+  CompositionEntityResponse<Image> getImage(String vspId, Version version, String componentId,
+                                            String imageId, String user);
+
+  QuestionnaireResponse getImageQuestionnaire(String vspId, Version version, String
+      componentId, String imageId, String user);
+
+  void deleteImage(String vspId, Version version, String componentId, String imageId, String user);
+
+  CompositionEntityValidationData updateImage(ImageEntity imageEntity, String user);
+
+  void updateImageQuestionnaire(String vspId, Version version, String componentId, String imageId,
+                                String
+      questionnaireData, String user);
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ImageManagerFactory.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ImageManagerFactory.java
new file mode 100644
index 0000000..f844186
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ImageManagerFactory.java
@@ -0,0 +1,12 @@
+package org.openecomp.sdc.vendorsoftwareproduct;
+
+import org.openecomp.core.factory.api.AbstractComponentFactory;
+import org.openecomp.core.factory.api.AbstractFactory;
+
+public abstract class ImageManagerFactory extends AbstractComponentFactory<ImageManager> {
+
+  public static ImageManagerFactory getInstance() {
+    return AbstractFactory.getInstance(ImageManagerFactory.class);
+  }
+}
+
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ManualVspToscaManager.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ManualVspToscaManager.java
new file mode 100644
index 0000000..c9a5206
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ManualVspToscaManager.java
@@ -0,0 +1,12 @@
+package org.openecomp.sdc.vendorsoftwareproduct;
+
+import org.openecomp.sdc.generator.datatypes.tosca.VspModelInfo;
+import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
+import org.openecomp.sdc.versioning.dao.types.Version;
+
+public interface ManualVspToscaManager {
+
+  public VspModelInfo gatherVspInformation(String vspId, Version version, String user);
+
+  public ToscaServiceModel generateToscaModel(VspModelInfo vspModelInfo);
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/MibManager.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/MonitoringUploadsManager.java
similarity index 74%
rename from openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/MibManager.java
rename to openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/MonitoringUploadsManager.java
index 7d2db68..f5e34a0 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/MibManager.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/MonitoringUploadsManager.java
@@ -20,18 +20,19 @@
 
 package org.openecomp.sdc.vendorsoftwareproduct;
 
-import org.openecomp.core.enrichment.types.ArtifactType;
-import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.MibUploadStatus;
+import org.openecomp.core.enrichment.types.MonitoringUploadType;
+import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.MonitoringUploadStatus;
 import org.openecomp.sdc.versioning.dao.types.Version;
 
 import java.io.InputStream;
 
-public interface MibManager {
+public interface MonitoringUploadsManager {
   void delete(String vspId, Version version, String componentId,
-              ArtifactType artifactType, String user);
+              MonitoringUploadType monitoringUploadType, String user);
 
   void upload(InputStream object, String filename, String vspId, Version version,
-              String componentId, ArtifactType artifactType, String user);
+              String componentId, MonitoringUploadType monitoringUploadType, String user);
 
-  MibUploadStatus listFilenames(String vspId, Version version, String componentId, String user);
+  MonitoringUploadStatus listFilenames(String vspId, Version version, String componentId,
+                                       String user);
 }
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/MibManagerFactory.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/MonitoringUploadsManagerFactory.java
similarity index 81%
rename from openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/MibManagerFactory.java
rename to openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/MonitoringUploadsManagerFactory.java
index f25658b..eb4271b 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/MibManagerFactory.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/MonitoringUploadsManagerFactory.java
@@ -23,9 +23,10 @@
 import org.openecomp.core.factory.api.AbstractComponentFactory;
 import org.openecomp.core.factory.api.AbstractFactory;
 
-public abstract class MibManagerFactory extends AbstractComponentFactory<MibManager> {
+public abstract class MonitoringUploadsManagerFactory
+    extends AbstractComponentFactory<MonitoringUploadsManager> {
 
-  public static MibManagerFactory getInstance() {
-    return AbstractFactory.getInstance(MibManagerFactory.class);
+  public static MonitoringUploadsManagerFactory getInstance() {
+    return AbstractFactory.getInstance(MonitoringUploadsManagerFactory.class);
   }
 }
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VendorSoftwareProductManager.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VendorSoftwareProductManager.java
index 7e9a002..738e267 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VendorSoftwareProductManager.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VendorSoftwareProductManager.java
@@ -20,6 +20,7 @@
 
 package org.openecomp.sdc.vendorsoftwareproduct;
 
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComputeEntity;
 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.PackageInfo;
 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
 import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireResponse;
@@ -30,6 +31,7 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.util.Collection;
 import java.util.List;
 
 public interface  VendorSoftwareProductManager {
@@ -73,6 +75,7 @@
 
   File getInformationArtifact(String vspId, Version version, String user);
 
-
   String fetchValidationVsp(String user);
+
+  Collection<ComputeEntity> getComputeByVsp(String vspId, Version version, String user);
 }
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ComponentErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ComponentErrorBuilder.java
new file mode 100644
index 0000000..78d2ef8
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ComponentErrorBuilder.java
@@ -0,0 +1,21 @@
+package org.openecomp.sdc.vendorsoftwareproduct.errors;
+
+import org.openecomp.sdc.common.errors.ErrorCategory;
+import org.openecomp.sdc.common.errors.ErrorCode;
+
+
+public class ComponentErrorBuilder {
+
+  private static final String VFC_INVALID_MISSING_IMAGE_MSG =
+      "All VFC need to have atleast a single Image specified. Please fix the VFC Images and re-submit the VSP";
+
+
+  public static ErrorCode VfcMissingImageErrorBuilder() {
+    ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+    builder.withId(VendorSoftwareProductErrorCodes.VFC_INVALID);
+    builder.withCategory(ErrorCategory.APPLICATION);
+    builder
+        .withMessage(String.format(VFC_INVALID_MISSING_IMAGE_MSG));
+    return builder.build();
+  }
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DeleteNicErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DeleteNicErrorBuilder.java
new file mode 100644
index 0000000..3ecf6f1
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DeleteNicErrorBuilder.java
@@ -0,0 +1,18 @@
+package org.openecomp.sdc.vendorsoftwareproduct.errors;
+
+import org.openecomp.sdc.common.errors.ErrorCategory;
+import org.openecomp.sdc.common.errors.ErrorCode;
+
+public class DeleteNicErrorBuilder {
+    private static final String DELETE_NIC_NOT_ALLOWED_MSG =
+            "NIC cannot be deleted for VSPs onboarded with HEAT.";
+
+    public static ErrorCode getDeleteNicForHeatOnboardedVspErrorBuilder(){
+        ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+        builder.withId(VendorSoftwareProductErrorCodes.DELETE_NIC_NOT_ALLOWED);
+        builder.withCategory(ErrorCategory.APPLICATION);
+        builder.withMessage(String.format(DELETE_NIC_NOT_ALLOWED_MSG));
+        return builder.build();
+    }
+
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DeploymentFlavorErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DeploymentFlavorErrorBuilder.java
new file mode 100644
index 0000000..63d7165
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DeploymentFlavorErrorBuilder.java
@@ -0,0 +1,95 @@
+package org.openecomp.sdc.vendorsoftwareproduct.errors;
+
+
+import org.openecomp.sdc.common.errors.ErrorCategory;
+import org.openecomp.sdc.common.errors.ErrorCode;
+import org.openecomp.sdc.versioning.dao.types.Version;
+
+public class DeploymentFlavorErrorBuilder {
+    private static final String CREATE_DEPLOYMENT_FLAVOR_NOT_ALLOWED_IN_HEAT_ONBOARDING_MSG=
+            "Deployment Flavor cannot be added for VSPs onboarded with HEAT.";
+    private static final String FEATURE_GROUP_NOT_EXIST_FOR_VSP_MSG=
+        "Invalid request,Feature Group with Id %s does not exist for Vsp with Id %s and version " +
+            "%s.";
+    private static final String INVALID_COMPONENT_COMPUTE_ASSOCIATION_MSG
+        ="Invalid request,for valid association please provide ComponentId for Compute Flavor";
+    private static final String SAME_VFC_ASSOCIATION_MORE_THAN_ONCE_NOT_ALLOWED_MSG=
+        "Invalid Request,Same Vfc cannot be associated more than once.";
+    private static final String DUPLICATE_DEPLOYMENT_FLAVOR_MODEL_NOT_ALLOWED_MSG =
+        "Invalid request, Deployment Flavor with model %s already exists for Vsp with Id %s.";
+    private static final String INVALID_COMPUTE_FLAVOR_ID_MSG =
+        "Invalid request, Compute Flavor with Id %s does not exist for VFC with Id %s.";
+    private static final String INVALID_COMPONENT_COMPUTE_ASSOCIATION_ERROR_MSG="VSP cannot be " +
+        "submitted with an invalid Deployment Flavor. All Deployment Flavor should have atleast a VFC included with it's required Compute needs. Please fix the Deployment Flavor and re-submit the VSP.";
+
+    private static final String FEATUREGROUP_REQUIRED_IN_DEPLOYMENT_FLAVOR_MSG = "VSP cannot be " +
+        "submitted with an invalid Deployment Flavor. All Deployment Flavor should have " +
+        "FeatureGroup. Please fix the Deployment Flavor and re-submit the VSP.";
+
+    public static ErrorCode getAddDeploymentNotSupportedHeatOnboardErrorBuilder(){
+        ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+        builder.withId(VendorSoftwareProductErrorCodes.CREATE_DEPLOYMENT_FLAVOR_NOT_ALLOWED_IN_HEAT_ONBOARDING);
+        builder.withCategory(ErrorCategory.APPLICATION);
+        builder.withMessage(String.format(CREATE_DEPLOYMENT_FLAVOR_NOT_ALLOWED_IN_HEAT_ONBOARDING_MSG));
+        return builder.build();
+    }
+
+    public static ErrorCode getFeatureGroupNotexistErrorBuilder( String featureGroupId, String
+        VspId, Version activeVersion){
+        ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+        builder.withId(VendorSoftwareProductErrorCodes.FEATURE_GROUP_NOT_EXIST_FOR_VSP);
+        builder.withCategory(ErrorCategory.APPLICATION);
+        builder.withMessage(String.format(FEATURE_GROUP_NOT_EXIST_FOR_VSP_MSG,featureGroupId,
+            VspId,activeVersion.toString()));
+        return builder.build();
+    }
+
+    public static ErrorCode getDuplicateVfcAssociationErrorBuilder(){
+        ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+        builder.withId(VendorSoftwareProductErrorCodes.SAME_VFC_ASSOCIATION_MORE_THAN_ONCE_NOT_ALLOWED);
+        builder.withCategory(ErrorCategory.APPLICATION);
+        builder.withMessage(String.format(SAME_VFC_ASSOCIATION_MORE_THAN_ONCE_NOT_ALLOWED_MSG));
+        return builder.build();
+    }
+
+    public static ErrorCode getInvalidAssociationErrorBuilder(){
+        ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+        builder.withId(VendorSoftwareProductErrorCodes.INVALID_COMPONENT_COMPUTE_ASSOCIATION);
+        builder.withCategory(ErrorCategory.APPLICATION);
+        builder.withMessage(String.format(INVALID_COMPONENT_COMPUTE_ASSOCIATION_MSG));
+        return builder.build();
+    }
+
+    public static ErrorCode getDuplicateDeploymentFlavorModelErrorBuilder(String name, String vspId){
+        ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+        builder.withId(VendorSoftwareProductErrorCodes.DUPLICATE_DEPLOYMENT_FLAVOR_MODEL_NOT_ALLOWED);
+        builder.withCategory(ErrorCategory.APPLICATION);
+        builder.withMessage(String.format(DUPLICATE_DEPLOYMENT_FLAVOR_MODEL_NOT_ALLOWED_MSG,name,vspId));
+        return builder.build();
+    }
+    public static ErrorCode getInvalidComputeIdErrorBuilder( String computeFlavorId, String
+        vfcId){
+        ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+        builder.withId(VendorSoftwareProductErrorCodes.INVALID_COMPUTE_FLAVOR_ID);
+        builder.withCategory(ErrorCategory.APPLICATION);
+        builder.withMessage(String.format(INVALID_COMPUTE_FLAVOR_ID_MSG,computeFlavorId,
+            vfcId));
+        return builder.build();
+    }
+
+    public static ErrorCode getInvalidComponentComputeAssociationErrorBuilder(){
+        ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+        builder.withId(VendorSoftwareProductErrorCodes.INVALID_COMPONENT_COMPUTE_ASSOCIATION);
+        builder.withCategory(ErrorCategory.APPLICATION);
+        builder.withMessage(String.format(INVALID_COMPONENT_COMPUTE_ASSOCIATION_ERROR_MSG));
+        return builder.build();
+    }
+
+    public static ErrorCode getFeatureGroupMandatoryErrorBuilder(){
+        ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+        builder.withId(VendorSoftwareProductErrorCodes.FEATUREGROUP_REQUIRED_IN_DEPLOYMENT_FLAVOR);
+        builder.withCategory(ErrorCategory.APPLICATION);
+        builder.withMessage(String.format(FEATUREGROUP_REQUIRED_IN_DEPLOYMENT_FLAVOR_MSG));
+        return builder.build();
+    }
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DuplicateComputeInComponentErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DuplicateComputeInComponentErrorBuilder.java
new file mode 100644
index 0000000..b242b71
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DuplicateComputeInComponentErrorBuilder.java
@@ -0,0 +1,52 @@
+package org.openecomp.sdc.vendorsoftwareproduct.errors;
+
+import org.openecomp.sdc.common.errors.ErrorCategory;
+import org.openecomp.sdc.common.errors.ErrorCode;
+import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.UPDATE_COMPUTE_NOT_ALLOWED;
+
+
+public class DuplicateComputeInComponentErrorBuilder {
+
+  private static final String DUPLICATE_COMPUTE_NAME_NOT_ALLOWED_MSG =
+      "Invalid request, Compute with name %s already exists for component with ID %s.";
+  private static final String COMPUTE_HEAT_READONLY_ATTR_MSG = "Update of attribute %s not allowed "
+          + "for VSP onboarded via HEAT.";
+  private static final String COMPUTE_MANUAL_READONLY_ATTR_MSG = "Update of attribute %s not allowed "
+          + "for VSP onboarded manually.";
+
+
+  private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+
+  public DuplicateComputeInComponentErrorBuilder(String computeName, String componentId ){
+    builder.withId(VendorSoftwareProductErrorCodes.DUPLICATE_COMPUTE_NAME_NOT_ALLOWED);
+    builder.withCategory(ErrorCategory.APPLICATION);
+    builder.withMessage(String.format(DUPLICATE_COMPUTE_NAME_NOT_ALLOWED_MSG,computeName,
+        componentId));
+  }
+
+  /**
+   * Gets duplicate compute name error builder.
+   *
+   * @return the duplicate compute name error builder
+   */
+  public static ErrorCode getDuplicateComputeNameErrorBuilder(String computeName, String componenetId) {
+    ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+    builder.withId(VendorSoftwareProductErrorCodes.DUPLICATE_COMPUTE_NAME_NOT_ALLOWED);
+    builder.withCategory(ErrorCategory.APPLICATION);
+    builder.withMessage(String.format(DUPLICATE_COMPUTE_NAME_NOT_ALLOWED_MSG, computeName, componenetId ));
+    return builder.build();
+  }
+
+  public static ErrorCode getComputeHeatReadOnlyErrorBuilder(String name) {
+    ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+    builder.withId(UPDATE_COMPUTE_NOT_ALLOWED);
+    builder.withCategory(ErrorCategory.APPLICATION);
+    builder.withMessage(String.format(COMPUTE_HEAT_READONLY_ATTR_MSG, name));
+    return builder.build();
+  }
+
+
+  public ErrorCode build() {
+    return builder.build();
+  }
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DuplicateNicInComponentErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DuplicateNicInComponentErrorBuilder.java
new file mode 100644
index 0000000..741dddb
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DuplicateNicInComponentErrorBuilder.java
@@ -0,0 +1,22 @@
+package org.openecomp.sdc.vendorsoftwareproduct.errors;
+
+import org.openecomp.sdc.common.errors.ErrorCategory;
+import org.openecomp.sdc.common.errors.ErrorCode;
+
+public class DuplicateNicInComponentErrorBuilder {
+
+  private static final String DUPLICATE_NIC_NAME_NOT_ALLOWED_MSG =
+      "Invalid request, NIC with name %s already exist for component with ID %s.";
+
+  private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+
+  public DuplicateNicInComponentErrorBuilder(String nicName, String componentId ){
+    builder.withId(VendorSoftwareProductErrorCodes.DUPLICATE_NIC_NAME_NOT_ALLOWED);
+    builder.withCategory(ErrorCategory.APPLICATION);
+    builder.withMessage(String.format(DUPLICATE_NIC_NAME_NOT_ALLOWED_MSG,nicName,componentId));
+  }
+  public ErrorCode build() {
+    return builder.build();
+  }
+
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ImageErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ImageErrorBuilder.java
new file mode 100644
index 0000000..95bff60
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ImageErrorBuilder.java
@@ -0,0 +1,59 @@
+package org.openecomp.sdc.vendorsoftwareproduct.errors;
+
+import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.DUPLICATE_IMAGE_NAME_NOT_ALLOWED;
+
+import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.UPDATE_IMAGE_NOT_ALLOWED;
+import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.VFC_IMAGE_INVALID_FORMAT;
+
+import org.openecomp.sdc.common.errors.ErrorCategory;
+import org.openecomp.sdc.common.errors.ErrorCode;
+
+/**
+ * The Image error builder.
+ */
+public class ImageErrorBuilder {
+
+  private static final String VFC_IMAGE_DUPLICATE_NAME_MSG = "Invalid request, Image with name %s"
+      + " already exists for component with ID %s.";
+
+  private static final String IMAGE_INVALID_FORMAT_MSG = "The format value doesn't meet the "
+      + "expected attribute value.";
+
+  private static final String IMAGE_HEAT_READONLY_ATTR_MSG = "Update of attribute %s not allowed "
+      + "for VSP onboarded via HEAT.";
+
+
+  /**
+   * Gets duplicate image name error builder.
+   *
+   * @return the duplicate image name error builder
+   */
+  public static ErrorCode getDuplicateImageNameErrorBuilder(String imageName, String componenetId) {
+    ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+    builder.withId(DUPLICATE_IMAGE_NAME_NOT_ALLOWED);
+    builder.withCategory(ErrorCategory.APPLICATION);
+    builder.withMessage(String.format(VFC_IMAGE_DUPLICATE_NAME_MSG, imageName, componenetId ));
+    return builder.build();
+  }
+
+  /**
+   * Gets invalid image format error builder.
+   *
+   * @return the invalid image format error builder
+   */
+  public static ErrorCode getInvalidImageFormatErrorBuilder() {
+    ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+    builder.withId(VFC_IMAGE_INVALID_FORMAT);
+    builder.withCategory(ErrorCategory.APPLICATION);
+    builder.withMessage(String.format(IMAGE_INVALID_FORMAT_MSG));
+    return builder.build();
+  }
+
+  public static ErrorCode getImageHeatReadOnlyErrorBuilder(String name) {
+    ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+    builder.withId(UPDATE_IMAGE_NOT_ALLOWED);
+    builder.withCategory(ErrorCategory.APPLICATION);
+    builder.withMessage(String.format(IMAGE_HEAT_READONLY_ATTR_MSG, name));
+    return builder.build();
+  }
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/MibUploadErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/MonitoringUploadErrorBuilder.java
similarity index 78%
rename from openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/MibUploadErrorBuilder.java
rename to openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/MonitoringUploadErrorBuilder.java
index bffe805..5fc29d5 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/MibUploadErrorBuilder.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/MonitoringUploadErrorBuilder.java
@@ -24,11 +24,12 @@
 import org.openecomp.sdc.common.errors.ErrorCategory;
 import org.openecomp.sdc.versioning.dao.types.Version;
 
-import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.MIB_UPLOAD_INVALID;
+import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.MONITORING_UPLOAD_INVALID;
 
-public class MibUploadErrorBuilder extends BaseErrorBuilder {
+public class MonitoringUploadErrorBuilder extends BaseErrorBuilder {
   private static final String UPLOAD_INVALID_DETAILED_MSG =
-      "MIB uploaded for vendor software product with Id %s and version %s is invalid: %s";
+      "Monitoring file uploaded for vendor software product with Id %s and version %s is invalid:" +
+          " %s";
 
 
   /**
@@ -38,8 +39,9 @@
    * @param version                 the version
    * @param error                   the error
    */
-  public MibUploadErrorBuilder(String vendorSoftwareProductId, Version version, String error) {
-    getErrorCodeBuilder().withId(MIB_UPLOAD_INVALID);
+  public MonitoringUploadErrorBuilder(String vendorSoftwareProductId, Version version,
+                                      String error) {
+    getErrorCodeBuilder().withId(MONITORING_UPLOAD_INVALID);
     getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
     getErrorCodeBuilder().withMessage(String.format(UPLOAD_INVALID_DETAILED_MSG,
         vendorSoftwareProductId, version == null ? null : version.toString(), error));
@@ -50,8 +52,8 @@
    *
    * @param errorMessage the error message
    */
-  public MibUploadErrorBuilder(String errorMessage) {
-    getErrorCodeBuilder().withId(MIB_UPLOAD_INVALID);
+  public MonitoringUploadErrorBuilder(String errorMessage) {
+    getErrorCodeBuilder().withId(MONITORING_UPLOAD_INVALID);
     getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
     getErrorCodeBuilder().withMessage(errorMessage);
   }
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/NicInternalNetworkErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/NicInternalNetworkErrorBuilder.java
new file mode 100644
index 0000000..0850d2e
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/NicInternalNetworkErrorBuilder.java
@@ -0,0 +1,46 @@
+package org.openecomp.sdc.vendorsoftwareproduct.errors;
+
+import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.NETWORK_DESCRIPTION_NOT_ALLOWED_FOR_INTERNAL_NETWORK;
+import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.NETWORK_TYPE_UPDATE_NOT_ALLOWED;
+
+import org.openecomp.sdc.common.errors.ErrorCategory;
+import org.openecomp.sdc.common.errors.ErrorCode;
+
+public class NicInternalNetworkErrorBuilder {
+  private static final String NULL_NETWORKID_NOT_ALLOWED_MSG =
+      "Internal Networks are currently not supported for VSP created Manually, so please fix all the NIC to be of Type External and re-submit the VSP.";
+
+  private static final String NETWORK_DESCRIPTION_NOT_ALLOWED_FOR_INTERNAL_NETWORK_MSG =
+      "Invalid request, Network Description not allowed for Internal Networks";
+  private static final String NETWORK_TYPE_UPDATE_NOT_ALLOWED_MSG =
+          "Invalid request, Network Type Update not allowed for a Nic";
+
+
+  public static ErrorCode getNicNullNetworkIdInternalNetworkIdErrorBuilder(){
+    ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+    builder.withId(VendorSoftwareProductErrorCodes.NULL_NETWORKID_NOT_ALLOWED);
+    builder.withCategory(ErrorCategory.APPLICATION);
+    builder.withMessage(String.format(NULL_NETWORKID_NOT_ALLOWED_MSG));
+    return builder.build();
+  }
+
+
+  public static ErrorCode getNetworkDescriptionInternalNetworkErrorBuilder(){
+    ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+    builder.withId(NETWORK_DESCRIPTION_NOT_ALLOWED_FOR_INTERNAL_NETWORK);
+    builder.withCategory(ErrorCategory.APPLICATION);
+    builder.withMessage(String.format(NETWORK_DESCRIPTION_NOT_ALLOWED_FOR_INTERNAL_NETWORK_MSG));
+    return builder.build();
+  }
+
+
+  public static ErrorCode getNetworkTypeErrorBuilder(){
+    ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+    builder.withId(NETWORK_TYPE_UPDATE_NOT_ALLOWED);
+    builder.withCategory(ErrorCategory.APPLICATION);
+    builder.withMessage(String.format(NETWORK_TYPE_UPDATE_NOT_ALLOWED_MSG));
+    return builder.build();
+  }
+
+
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/NicNetworkIdNotAllowedExternalNetworkErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/NicNetworkIdNotAllowedExternalNetworkErrorBuilder.java
new file mode 100644
index 0000000..2d75f81
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/NicNetworkIdNotAllowedExternalNetworkErrorBuilder.java
@@ -0,0 +1,19 @@
+package org.openecomp.sdc.vendorsoftwareproduct.errors;
+
+import org.openecomp.sdc.common.errors.ErrorCategory;
+import org.openecomp.sdc.common.errors.ErrorCode;
+
+public class NicNetworkIdNotAllowedExternalNetworkErrorBuilder {
+  private static final String NETWORKID_NOT_ALLOWED_FOR_EXTERNAL_NETWORK_MSG =
+      "Invalid request,NetworkId not allowed for External Networks";
+  private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+  public NicNetworkIdNotAllowedExternalNetworkErrorBuilder(){
+    builder.withId(VendorSoftwareProductErrorCodes.NETWORKID_NOT_ALLOWED_FOR_EXTERNAL_NETWORK);
+    builder.withCategory(ErrorCategory.APPLICATION);
+    builder.withMessage(String.format(NETWORKID_NOT_ALLOWED_FOR_EXTERNAL_NETWORK_MSG));
+  }
+
+  public ErrorCode build() {
+    return builder.build();
+  }
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/NotSupportedHeatOnboardMethodErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/NotSupportedHeatOnboardMethodErrorBuilder.java
new file mode 100644
index 0000000..7801df8
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/NotSupportedHeatOnboardMethodErrorBuilder.java
@@ -0,0 +1,76 @@
+package org.openecomp.sdc.vendorsoftwareproduct.errors;
+
+import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.ADD_COMPUTE_NOT_ALLOWED_IN_HEAT_ONBOARDING;
+import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.ADD_IMAGE_NOT_ALLOWED_IN_HEAT_ONBOARDING;
+import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.ADD_NIC_NOT_ALLOWED_IN_HEAT_ONBOARDING;
+import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.DELETE_DEPLOYMENT_FLAVOR_NOT_ALLOWED_IN_HEAT_ONBOARDING;
+import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.DELETE_IMAGE_NOT_ALLOWED;
+import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.EDIT_DEPLOYMENT_FLAVOR_NOT_ALLOWED_IN_HEAT_ONBOARDING;
+
+import org.openecomp.sdc.common.errors.ErrorCategory;
+import org.openecomp.sdc.common.errors.ErrorCode;
+
+public class NotSupportedHeatOnboardMethodErrorBuilder {
+  private static final String ADD_NIC_NOT_ALLOWED_IN_HEAT_ONBOARDING_MSG =
+      "NIC cannot be added for VSPs onboarded with HEAT.";
+  private static final String ADD_COMPUTE_NOT_ALLOWED_IN_HEAT_ONBOARDING_MSG =
+      "Compute flavor cannot be added for VSPs onboarded with HEAT.";
+  private static final String IMAGE_ADD_NOT_ALLOWED_IN_HEAT_ONBOARDING_MSG =
+      "Image cannot be added for VSPs onboarded with HEAT.";
+  private static final String DELETE_IMAGE_NOT_ALLOWED_MSG =
+      "Image cannot be deleted for VSPs onboarded with HEAT.";
+  private static final String DELETE_DEPLOYMENT_FLAVOR_NOT_ALLOWED_MSG =
+          "Deployment Flavor cannot be deleted for VSPs onboarded with HEAT.";
+  private static final String EDIT_DEPLOYMENT_FLAVOR_NOT_ALLOWED_MSG =
+      "Deployment Flavor cannot be edited for VSPs onboarded with HEAT.";
+
+
+  public static ErrorCode getAddNicNotSupportedHeatOnboardMethodErrorBuilder() {
+    ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+    builder.withId(ADD_NIC_NOT_ALLOWED_IN_HEAT_ONBOARDING);
+    builder.withCategory(ErrorCategory.APPLICATION);
+    builder.withMessage(String.format(ADD_NIC_NOT_ALLOWED_IN_HEAT_ONBOARDING_MSG));
+    return builder.build();
+  }
+
+  public static ErrorCode getAddComputeNotSupportedHeatOnboardMethodErrorBuilder() {
+    ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+    builder.withId(ADD_COMPUTE_NOT_ALLOWED_IN_HEAT_ONBOARDING);
+    builder.withCategory(ErrorCategory.APPLICATION);
+    builder.withMessage(String.format(ADD_COMPUTE_NOT_ALLOWED_IN_HEAT_ONBOARDING_MSG));
+    return builder.build();
+  }
+
+  public static ErrorCode getAddImageNotSupportedHeatOnboardMethodErrorBuilder() {
+    ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+    builder.withId(ADD_IMAGE_NOT_ALLOWED_IN_HEAT_ONBOARDING);
+    builder.withCategory(ErrorCategory.APPLICATION);
+    builder.withMessage(String.format(IMAGE_ADD_NOT_ALLOWED_IN_HEAT_ONBOARDING_MSG));
+    return builder.build();
+  }
+
+  public static ErrorCode getDelImageNotSupportedHeatOnboardMethodErrorBuilder() {
+    ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+    builder.withId(DELETE_IMAGE_NOT_ALLOWED);
+    builder.withCategory(ErrorCategory.APPLICATION);
+    builder.withMessage(String.format(DELETE_IMAGE_NOT_ALLOWED_MSG));
+    return builder.build();
+  }
+
+  public static ErrorCode getDelDeploymentFlavorNotSupportedHeatOnboardMethodErrorBuilder() {
+    ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+    builder.withId(DELETE_DEPLOYMENT_FLAVOR_NOT_ALLOWED_IN_HEAT_ONBOARDING);
+    builder.withCategory(ErrorCategory.APPLICATION);
+    builder.withMessage(String.format(DELETE_DEPLOYMENT_FLAVOR_NOT_ALLOWED_MSG));
+    return builder.build();
+  }
+
+  public static ErrorCode getUpdateDfNotSupportedHeatOnboardMethodErrorBuilder() {
+    ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+    builder.withId(EDIT_DEPLOYMENT_FLAVOR_NOT_ALLOWED_IN_HEAT_ONBOARDING);
+    builder.withCategory(ErrorCategory.APPLICATION);
+    builder.withMessage(String.format(EDIT_DEPLOYMENT_FLAVOR_NOT_ALLOWED_MSG));
+    return builder.build();
+  }
+
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/OnboardingMethodErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/OnboardingMethodErrorBuilder.java
new file mode 100644
index 0000000..8aad900
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/OnboardingMethodErrorBuilder.java
@@ -0,0 +1,46 @@
+package org.openecomp.sdc.vendorsoftwareproduct.errors;
+
+import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes
+    .VSP_INVALID_ONBOARDING_METHOD;
+import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes
+    .VSP_ONBOARD_METHOD_UPDATE_NOT_ALLOWED;
+
+import org.openecomp.sdc.common.errors.ErrorCategory;
+import org.openecomp.sdc.common.errors.ErrorCode;
+
+/**
+ * The type Onboarding method error builder.
+ */
+public class OnboardingMethodErrorBuilder {
+
+  private static final String VSP_ONBOARD_METHOD_UPDATE_NOT_ALLOWED_MSG =
+      "onboardingMethod update is not allowed.";
+  private static final String VSP_INVALID_ONBOARDING_METHOD_MSG =
+      "The onboardingMethod value doesn't meet the expected attribute value.";
+
+  /**
+   * Gets onboarding update error.
+   *
+   * @return the onboarding update error
+   */
+  public static ErrorCode getOnboardingUpdateError() {
+    ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+    builder.withId(VSP_ONBOARD_METHOD_UPDATE_NOT_ALLOWED);
+    builder.withCategory(ErrorCategory.APPLICATION);
+    builder.withMessage(String.format(VSP_ONBOARD_METHOD_UPDATE_NOT_ALLOWED_MSG));
+    return builder.build();
+  }
+
+  /**
+   * Get invalid onboarding method error builder error code.
+   *
+   * @return the error code
+   */
+  public static ErrorCode getInvalidOnboardingMethodErrorBuilder() {
+    ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+    builder.withId(VSP_INVALID_ONBOARDING_METHOD);
+    builder.withCategory(ErrorCategory.APPLICATION);
+    builder.withMessage(String.format(VSP_INVALID_ONBOARDING_METHOD_MSG));
+    return builder.build();
+  }
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/VendorSoftwareProductInvalidErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/VendorSoftwareProductInvalidErrorBuilder.java
index 8fe2bfc..4a84c83 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/VendorSoftwareProductInvalidErrorBuilder.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/VendorSoftwareProductInvalidErrorBuilder.java
@@ -28,6 +28,8 @@
   private static final String VSP_INVALID_MSG =
       "Vendor software product with Id %s and version %s is invalid - does not contain "
           + "service model.";
+  private static final String VSP_INVALID_MISSING_DEPLOYMENT_FLAVOR_MSG ="VSP has to have a " +
+      "minimum of one Deployment Flavor defined for being able to be instantiated.Please add a Deployment Flavor and re-submit the VSP.";
   private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
 
   /**
@@ -36,14 +38,27 @@
    * @param vendorSoftwareProductId the vendor software product id
    * @param version                 the version
    */
-  public VendorSoftwareProductInvalidErrorBuilder(String vendorSoftwareProductId, Version version) {
+  public static ErrorCode VendorSoftwareProductMissingServiceModelErrorBuilder(String
+                                                                         vendorSoftwareProductId,
+                                                             Version version) {
+    ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
     builder.withId(VendorSoftwareProductErrorCodes.VSP_INVALID);
     builder.withCategory(ErrorCategory.APPLICATION);
     builder
         .withMessage(String.format(VSP_INVALID_MSG, vendorSoftwareProductId, version.toString()));
-  }
-
-  public ErrorCode build() {
     return builder.build();
   }
+
+  /**
+   * Instantiates a new Vendor software product invalid error builder.
+   */
+  public static ErrorCode VspMissingDeploymentFlavorErrorBuilder() {
+    ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+    builder.withId(VendorSoftwareProductErrorCodes.VSP_INVALID);
+    builder.withCategory(ErrorCategory.APPLICATION);
+    builder
+        .withMessage(String.format(VSP_INVALID_MISSING_DEPLOYMENT_FLAVOR_MSG));
+    return builder.build();
+  }
+
 }
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerFactoryImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerFactoryImpl.java
index a2aaf2f..05a088f 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerFactoryImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerFactoryImpl.java
@@ -24,6 +24,8 @@
 import org.openecomp.sdc.vendorsoftwareproduct.ComponentManagerFactory;
 import org.openecomp.sdc.vendorsoftwareproduct.NicManagerFactory;
 import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDaoFactory;
 import org.openecomp.sdc.vendorsoftwareproduct.factory.CompositionEntityDataManagerFactory;
 
 public class ComponentManagerFactoryImpl extends ComponentManagerFactory {
@@ -31,7 +33,8 @@
       new ComponentManagerImpl(
           ComponentDaoFactory.getInstance().createInterface(),
           CompositionEntityDataManagerFactory.getInstance().createInterface(),
-          NicManagerFactory.getInstance().createInterface()
+          NicManagerFactory.getInstance().createInterface(),
+          VendorSoftwareProductInfoDaoFactory.getInstance().createInterface()
       );
 
   @Override
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerImpl.java
index 75a5377..42c8d12 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerImpl.java
@@ -20,9 +20,13 @@
 
 package org.openecomp.sdc.vendorsoftwareproduct.impl;
 
+import static org.openecomp.sdc.tosca.datatypes.ToscaNodeType.VFC_NODE_TYPE_PREFIX;
+
 import org.apache.commons.collections4.CollectionUtils;
 import org.openecomp.core.utilities.json.JsonUtil;
 import org.openecomp.sdc.common.errors.CoreException;
+import org.openecomp.sdc.common.errors.ErrorCategory;
+import org.openecomp.sdc.common.errors.ErrorCode;
 import org.openecomp.sdc.datatypes.error.ErrorLevel;
 import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
 import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage;
@@ -32,9 +36,11 @@
 import org.openecomp.sdc.vendorsoftwareproduct.ComponentManager;
 import org.openecomp.sdc.vendorsoftwareproduct.NicManager;
 import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
 import org.openecomp.sdc.vendorsoftwareproduct.errors.CompositionEditNotAllowedErrorBuilder;
+import org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes;
 import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionEntityDataManager;
 import org.openecomp.sdc.vendorsoftwareproduct.services.schemagenerator.SchemaGenerator;
 import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse;
@@ -46,6 +52,7 @@
 import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.ComponentQuestionnaireSchemaInput;
 import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateContext;
 import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateInput;
+import org.openecomp.sdc.vendorsoftwareproduct.utils.VendorSoftwareProductUtils;
 import org.openecomp.sdc.versioning.VersioningUtil;
 import org.openecomp.sdc.versioning.dao.types.Version;
 
@@ -59,14 +66,16 @@
   private ComponentDao componentDao;
   private CompositionEntityDataManager compositionEntityDataManager;
   private NicManager nicManager;
+  private VendorSoftwareProductInfoDao vspInfoDao;
 
   public ComponentManagerImpl(
       ComponentDao componentDao,
       CompositionEntityDataManager compositionEntityDataManager,
-      NicManager nicManager) {
+      NicManager nicManager, VendorSoftwareProductInfoDao vspInfoDao) {
     this.componentDao = componentDao;
     this.compositionEntityDataManager = compositionEntityDataManager;
     this.nicManager = nicManager;
+    this.vspInfoDao = vspInfoDao;
   }
 
   @Override
@@ -79,7 +88,7 @@
   @Override
   public void deleteComponents(String vspId, Version version, String user) {
     mdcDataDebugMessage.debugEntryMessage("VSP id", vspId);
-    if (!isManual(vspId, version)) {
+    if (!vspInfoDao.isManual(vspId, version)) {
       MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
           LoggerTragetServiceName.DELETE_COMPONENT, ErrorLevel.ERROR.name(),
           LoggerErrorCode.PERMISSION_ERROR.getErrorCode(), "Can't delete component");
@@ -91,7 +100,7 @@
     mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
   }
 
-  @Override
+  /*@Override
   public ComponentEntity createComponent(ComponentEntity component, String user) {
     mdcDataDebugMessage.debugEntryMessage("VSP id", component.getId());
 
@@ -107,6 +116,91 @@
     //componentDao.updateVspLatestModificationTime(component.getVspId(), component.getVersion());
     mdcDataDebugMessage.debugExitMessage("VSP id", component.getId());
     return null;
+  }*/
+
+  @Override
+  public ComponentEntity createComponent(ComponentEntity component, String user) {
+    mdcDataDebugMessage.debugEntryMessage("VSP id", component.getId());
+    /*Version activeVersion =
+        getVersionInfo(component.getVspId(), VersionableEntityAction.Write, user)
+            .getActiveVersion();
+    component.setVersion(activeVersion);*/
+
+    final String VFC_ADD_NOT_ALLOWED_IN_HEAT_ONBOARDING_MSG =
+        "VFCs cannot be added for VSPs onboarded with HEAT.";
+
+    ComponentEntity createdComponent = null;
+
+    if (!vspInfoDao.isManual(component.getVspId(), component.getVersion())) {
+      MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+          LoggerTragetServiceName.CREATE_COMPONENT, ErrorLevel.ERROR.name(),
+          LoggerErrorCode.PERMISSION_ERROR.getErrorCode(), "Can't create component");
+      throw new CoreException(
+          new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION)
+              .withId(VendorSoftwareProductErrorCodes.VFC_ADD_NOT_ALLOWED_IN_HEAT_ONBOARDING)
+              .withMessage(VFC_ADD_NOT_ALLOWED_IN_HEAT_ONBOARDING_MSG).build());
+    } else {
+      validateComponentManual(component);
+      updateComponentName(component);
+      createdComponent = createComponent(component);
+    }
+
+    mdcDataDebugMessage.debugExitMessage("VSP id", component.getId());
+
+    return createdComponent;
+  }
+
+  private ComponentEntity createComponent(ComponentEntity component) {
+    return compositionEntityDataManager.createComponent(component);
+  }
+
+  private void updateComponentName(ComponentEntity component) {
+    final String NAME_PREFIX = VFC_NODE_TYPE_PREFIX + "heat.";
+    ComponentData data = component.getComponentCompositionData();
+    data.setName(NAME_PREFIX + data.getDisplayName());
+    component.setComponentCompositionData(data);
+  }
+
+  private void validateComponentManual(ComponentEntity component) {
+    final String VSP_VFC_COUNT_EXCEED_MSG = "Creation of only one VFC per "
+        + "VSP allowed.";
+
+    final String VSP_VFC_DUPLICATE_NAME_MSG = "VFC with specified name "
+        + "already present in given VSP.";
+
+    Collection<ComponentEntity> vspComponentList = listComponents(component.getVspId()
+        , component.getVersion(), null);
+    if (vspComponentList.size() >= 1) //1707 release only supports 1 VFC in VSP (manual creation)
+    {
+      MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+          LoggerTragetServiceName.CREATE_COMPONENT, ErrorLevel.ERROR.name(),
+          LoggerErrorCode.PERMISSION_ERROR.getErrorCode(), "Can't create component: "
+              + "vsp component count exceed");
+      throw new CoreException(
+          new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION)
+              .withId(VendorSoftwareProductErrorCodes.VSP_VFC_COUNT_EXCEED)
+              .withMessage(VSP_VFC_COUNT_EXCEED_MSG).build());
+    }
+    if (!isVfcNameUnique(vspComponentList,
+        component.getComponentCompositionData().getDisplayName())) {
+      MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+          LoggerTragetServiceName.CREATE_COMPONENT, ErrorLevel.ERROR.name(),
+          LoggerErrorCode.PERMISSION_ERROR.getErrorCode(), "Can't create component: "
+              + "vsp component duplicate name");
+      throw new CoreException(
+          new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION)
+              .withId(VendorSoftwareProductErrorCodes.VSP_VFC_DUPLICATE_NAME)
+              .withMessage(VSP_VFC_DUPLICATE_NAME_MSG).build());
+    }
+  }
+
+  private boolean isVfcNameUnique(Collection<ComponentEntity> component, String displayName) {
+    for (ComponentEntity comp : component) {
+      if (comp.getComponentCompositionData().getDisplayName().equalsIgnoreCase(displayName)) {
+        return false;
+      }
+    }
+    return true;
   }
 
   @Override
@@ -116,13 +210,19 @@
     ComponentEntity retrieved =
         getComponent(component.getVspId(), component.getVersion(), component.getId());
 
+    if (vspInfoDao.isManual(component.getVspId(), component.getVersion())) {
+      validateComponentUpdateManual(component, retrieved, user);
+    }
+
+
     ComponentCompositionSchemaInput schemaInput = new ComponentCompositionSchemaInput();
-    schemaInput.setManual(isManual(component.getVspId(), component.getVersion()));
+    schemaInput.setManual(vspInfoDao.isManual(component.getVspId(), component.getVersion()));
     schemaInput.setComponent(retrieved.getComponentCompositionData());
 
     CompositionEntityValidationData validationData = compositionEntityDataManager
         .validateEntity(component, SchemaTemplateContext.composition, schemaInput);
     if (CollectionUtils.isEmpty(validationData.getErrors())) {
+      updateComponentName(component);
       componentDao.update(component);
       //componentDao.updateVspLatestModificationTime(component.getVspId(), component.getVersion());
     }
@@ -132,6 +232,54 @@
     return validationData;
   }
 
+  private void validateComponentUpdateManual(ComponentEntity component, ComponentEntity
+      retrieved, String user) {
+    Collection<ComponentEntity> vspComponentList = listComponents(component.getVspId()
+        , component.getVersion(), user);
+    //Removing check from name as we will ignore passed value
+    // and re-genarate new name from displayName
+    //    List<String> invalidParameters = new LinkedList<>();
+    //    if (!component.getComponentCompositionData().getName().equals(retrieved
+    //        .getComponentCompositionData().getName())) {
+    //      invalidParameters.add(NAME);
+    //    }
+    //    if (!invalidParameters.isEmpty()) {
+    //      String msg = String.format(VFC_ATTRIBUTE_UPDATE_NOT_ALLOWED_MSG, StringUtils
+    //          .join(invalidParameters, ", "));
+    //      MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+    //          LoggerTragetServiceName.UPDATE_COMPONENT, ErrorLevel.ERROR.name(),
+    //          LoggerErrorCode.DATA_ERROR.getErrorCode(), msg);
+    //
+    //      throw new CoreException(
+    //          new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION)
+    //              .withId(VendorSoftwareProductErrorCodes.VFC_ATTRIBUTE_UPDATE_NOT_ALLOWED)
+    //              .withMessage(msg).build());
+    //    }
+
+    //VFC name should be unique within VSP
+    //Removing VFC with same ID from list to avoid self compare
+    for(ComponentEntity ce : vspComponentList) {
+      if (ce.getId().equals(component.getId())) {
+        vspComponentList.remove(ce);
+        break;
+      }
+    }
+    if (!isVfcNameUnique(vspComponentList,  component.getComponentCompositionData()
+        .getDisplayName())) {
+       final String VSP_VFC_DUPLICATE_NAME_MSG = "VFC with specified name "
+          + "already present in given VSP.";
+      MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+          LoggerTragetServiceName.UPDATE_COMPONENT, ErrorLevel.ERROR.name(),
+          LoggerErrorCode.PERMISSION_ERROR.getErrorCode(), "Component with same name already " +
+              "exists for specified VSP");
+      throw new CoreException(
+          new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION)
+              .withId(VendorSoftwareProductErrorCodes.VSP_VFC_DUPLICATE_NAME)
+              .withMessage(VSP_VFC_DUPLICATE_NAME_MSG).build());
+
+    }
+  }
+
   public CompositionEntityResponse<ComponentData> getComponent(String vspId, Version version,
                                                                String componentId, String user) {
     mdcDataDebugMessage.debugEntryMessage("VSP id, component id", vspId, componentId);
@@ -139,7 +287,7 @@
     ComponentData component = componentEntity.getComponentCompositionData();
 
     ComponentCompositionSchemaInput schemaInput = new ComponentCompositionSchemaInput();
-    schemaInput.setManual(isManual(vspId, version));
+    schemaInput.setManual(vspInfoDao.isManual(vspId, version));
     schemaInput.setComponent(component);
 
     CompositionEntityResponse<ComponentData> response = new CompositionEntityResponse<>();
@@ -155,7 +303,7 @@
   public void deleteComponent(String vspId, Version version, String componentId, String user) {
     mdcDataDebugMessage.debugEntryMessage("VSP id, component id", vspId, componentId);
 
-    if (!isManual(vspId, version)) {
+    if (!vspInfoDao.isManual(vspId, version)) {
       MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
           LoggerTragetServiceName.DELETE_COMPONENT, ErrorLevel.ERROR.name(),
           LoggerErrorCode.PERMISSION_ERROR.getErrorCode(), "Can't delete component");
@@ -228,7 +376,7 @@
             schemaInput);
   }
 
-  private boolean isManual(String vspId, Version version) {
+  /*private boolean isManual(String vspId, Version version) {
     return false;
-  }
+  }*/
 }
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerFactoryImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerFactoryImpl.java
new file mode 100644
index 0000000..71985fa
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerFactoryImpl.java
@@ -0,0 +1,27 @@
+package org.openecomp.sdc.vendorsoftwareproduct.impl;
+
+import org.openecomp.sdc.vendorsoftwareproduct.ComputeManager;
+import org.openecomp.sdc.vendorsoftwareproduct.ComputeManagerFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.DeploymentFlavorDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.factory.CompositionEntityDataManagerFactory;
+
+public class ComputeManagerFactoryImpl extends ComputeManagerFactory {
+
+  private static final ComputeManager INSTANCE =
+      new ComputeManagerImpl(
+          VendorSoftwareProductInfoDaoFactory.getInstance().createInterface(),
+          ComputeDaoFactory.getInstance().createInterface(),
+          CompositionEntityDataManagerFactory.getInstance().createInterface(),
+          DeploymentFlavorDaoFactory.getInstance().createInterface(),
+          ComponentDaoFactory.getInstance().createInterface()
+
+      );
+
+  @Override
+  public ComputeManager createInterface() {
+    return INSTANCE;
+  }
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImpl.java
new file mode 100644
index 0000000..a2d1d70
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImpl.java
@@ -0,0 +1,503 @@
+package org.openecomp.sdc.vendorsoftwareproduct.impl;
+
+
+import org.apache.commons.collections4.CollectionUtils;
+import org.openecomp.sdc.common.errors.CoreException;
+import org.openecomp.sdc.common.errors.ErrorCategory;
+import org.openecomp.sdc.common.errors.ErrorCode;
+import org.openecomp.sdc.datatypes.error.ErrorLevel;
+import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
+import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage;
+import org.openecomp.sdc.logging.types.LoggerConstants;
+import org.openecomp.sdc.logging.types.LoggerErrorCode;
+import org.openecomp.sdc.logging.types.LoggerTragetServiceName;
+import org.openecomp.sdc.vendorsoftwareproduct.ComputeManager;
+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.VendorSoftwareProductDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
+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.VspDetails;
+import org.openecomp.sdc.vendorsoftwareproduct.errors.DuplicateComputeInComponentErrorBuilder;
+import org.openecomp.sdc.vendorsoftwareproduct.errors.NotSupportedHeatOnboardMethodErrorBuilder;
+import org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes;
+import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionEntityDataManager;
+import org.openecomp.sdc.vendorsoftwareproduct.services.schemagenerator.SchemaGenerator;
+import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse;
+import org.openecomp.sdc.vendorsoftwareproduct.types.ListComputeResponse;
+import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireResponse;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentComputeAssociation;
+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.questionnaire.component.compute.Compute;
+import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.ComputeCompositionSchemaInput;
+import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateContext;
+import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateInput;
+import org.openecomp.sdc.vendorsoftwareproduct.utils.VendorSoftwareProductUtils;
+import org.openecomp.sdc.versioning.VersioningUtil;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdc.versioning.types.VersionableEntityAction;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+public class ComputeManagerImpl implements ComputeManager {
+
+  private static final MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
+  private ComputeDao computeDao;
+  private CompositionEntityDataManager compositionEntityDataManager;
+  private VendorSoftwareProductInfoDao vspInfoDao;
+  private DeploymentFlavorDao deploymentFlavorDao;
+  private ComponentDao componentDao;
+  private static final String MANUAL = "Manual";
+
+  public ComputeManagerImpl(
+      VendorSoftwareProductInfoDao vspInfoDao,
+      ComputeDao computeDao,
+      CompositionEntityDataManager compositionEntityDataManager,
+      DeploymentFlavorDao deploymentFlavorDao,
+      ComponentDao componentDao
+     ) {
+    this.computeDao = computeDao;
+    this.compositionEntityDataManager = compositionEntityDataManager;
+    this.vspInfoDao = vspInfoDao;
+    this.deploymentFlavorDao = deploymentFlavorDao;
+    this.componentDao = componentDao;
+  }
+
+  @Override
+  public ComputeEntity createCompute(ComputeEntity compute, String user) {
+    ComputeEntity createdCompute = null;
+    mdcDataDebugMessage.debugEntryMessage("VSP id, component id", compute.getVspId(),
+        compute.getComponentId());
+
+    /*Version activeVersion =
+        getVersionInfo(compute.getVspId(), VersionableEntityAction.Write, user).getActiveVersion();
+    compute.setVersion(activeVersion);*/
+    //if (!isManual(compute.getVspId(), activeVersion)) {
+    if (!vspInfoDao.isManual(compute.getVspId(), compute.getVersion())) {
+      ErrorCode onboardingMethodUpdateErrorCode = NotSupportedHeatOnboardMethodErrorBuilder
+          .getAddComputeNotSupportedHeatOnboardMethodErrorBuilder();
+      MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+          LoggerTragetServiceName.CREATE_COMPUTE, ErrorLevel.ERROR.name(),
+          LoggerErrorCode.PERMISSION_ERROR.getErrorCode(),
+          onboardingMethodUpdateErrorCode.message());
+      throw new CoreException(onboardingMethodUpdateErrorCode);
+    } else {
+      //validateComponentId(compute.getVspId(),compute.getVersion(),compute.getComponentId());
+      validateCompute(compute);
+      createdCompute = createCompute(compute);
+    }
+
+    mdcDataDebugMessage
+        .debugExitMessage("VSP id, component id", compute.getVspId(), compute.getComponentId());
+
+    return createdCompute;
+  }
+
+  private ComputeEntity createCompute(ComputeEntity compute) {
+
+    return compositionEntityDataManager.createCompute(compute);
+  }
+
+  private void validateCompute(ComputeEntity compute) {
+    Collection<ComputeEntity> vfcComputeList = listCompute(compute.getVspId(),compute.getVersion
+        (),compute.getComponentId());
+
+    if (!isComputeNameUnique(vfcComputeList,compute.getComputeCompositionData().getName())) {
+      final ErrorCode duplicateComputeInComponentErrorBuilder =
+          new DuplicateComputeInComponentErrorBuilder(compute.getComputeCompositionData().getName(),
+              compute.getComponentId()).build();
+      MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+          LoggerTragetServiceName.CREATE_COMPUTE, ErrorLevel.ERROR.name(),
+          LoggerErrorCode.DATA_ERROR.getErrorCode(),
+          duplicateComputeInComponentErrorBuilder.message());
+      throw new CoreException(duplicateComputeInComponentErrorBuilder);
+    }
+
+  }
+
+  private void validateComputeUpdate(ComputeEntity compute) {
+    Collection<ComputeEntity> vfcComputeList = listCompute(compute.getVspId(),compute.getVersion
+        (),compute.getComponentId());
+
+    for (ComputeEntity ce : vfcComputeList) {
+      if (ce.getId().equals(compute.getId())) {
+        vfcComputeList.remove(ce);
+        break;
+      }
+    }
+
+    if (!isComputeNameUnique(vfcComputeList,compute.getComputeCompositionData().getName())) {
+      final ErrorCode duplicateComputeInComponentErrorBuilder =
+          new DuplicateComputeInComponentErrorBuilder(compute.getComputeCompositionData().getName(),
+              compute.getComponentId()).build();
+      MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+          LoggerTragetServiceName.UPDATE_COMPUTE, ErrorLevel.ERROR.name(),
+          LoggerErrorCode.DATA_ERROR.getErrorCode(),
+          duplicateComputeInComponentErrorBuilder.message());
+      throw new CoreException(duplicateComputeInComponentErrorBuilder);
+    }
+
+  }
+
+  @Override
+  public Collection<ListComputeResponse> listCompute(String vspId, Version version,
+                                                     String componentId, String user) {
+
+    mdcDataDebugMessage.debugEntryMessage("VSP id, component id", vspId, componentId);
+    //validateComponentId(vspId, version, componentId);
+    ComputeEntity entity = new ComputeEntity(vspId, version, componentId, null);
+    Collection<ComputeEntity> computes = computeDao.list(entity);
+
+    Collection<ListComputeResponse> computeResponse =
+        getListComputeResponse(vspId, version, user, computes);
+    mdcDataDebugMessage.debugExitMessage("VSP id, component id", vspId, componentId);
+
+    return computeResponse;
+  }
+
+  private Collection<ListComputeResponse> getListComputeResponse(String vspId, Version version,
+                                                                 String user,
+                                                                 Collection<ComputeEntity> computes) {
+    Set<String> vspComputes = getComputeAssociatedWithDepFlavors(vspId, version, user);
+    Collection<ListComputeResponse> computeResponse = new ArrayList<ListComputeResponse>();
+    for(ComputeEntity computeEntity : computes) {
+      ListComputeResponse response = new ListComputeResponse();
+      response.setComputeEntity(computeEntity);
+      if(vspComputes.contains(computeEntity.getId())) {
+        response.setAssociatedWithDeploymentFlavor(true);
+      } else {
+        response.setAssociatedWithDeploymentFlavor(false);
+      }
+      computeResponse.add(response);
+    }
+    return computeResponse;
+  }
+
+  private Set<String> getComputeAssociatedWithDepFlavors(String vspId, Version version,
+                                                         String user) {
+    final Collection<DeploymentFlavorEntity> deploymentFlavorEntities =
+        deploymentFlavorDao.list(new DeploymentFlavorEntity(vspId, version, null));
+    Set<String> vspComputes = new HashSet<String>();
+    for(DeploymentFlavorEntity entity : deploymentFlavorEntities) {
+      final List<ComponentComputeAssociation> componentComputeAssociations =
+          entity.getDeploymentFlavorCompositionData().getComponentComputeAssociations();
+      if(componentComputeAssociations != null  && !componentComputeAssociations.isEmpty()) {
+        for(ComponentComputeAssociation association : componentComputeAssociations) {
+          vspComputes.add(association.getComputeFlavorId());
+        }
+      }
+    }
+    return vspComputes;
+  }
+
+  private boolean isComputeNameUnique(Collection<ComputeEntity> vfcComputeList, String name) {
+    for (ComputeEntity compute : vfcComputeList) {
+      if (compute.getComputeCompositionData().getName().equalsIgnoreCase(name)) {
+        return false;
+      }
+    }
+    return true;
+  }
+
+  private Collection<ComputeEntity> listCompute(String vspId, Version version,String componentId) {
+    Collection<ComputeEntity> computeEntities =
+        computeDao.list(new ComputeEntity(vspId, version, componentId, null));
+
+    return computeEntities;
+  }
+
+  @Override
+  public CompositionEntityResponse<ComputeData> getCompute(String vspId, Version version,
+                                                           String componentId,
+                                                           String computeFlavorId, String user) {
+    mdcDataDebugMessage.debugEntryMessage("VSP id, component id, compute id", vspId,
+        componentId, computeFlavorId);
+
+    /*version = VersioningUtil
+        .resolveVersion(version, getVersionInfo(vspId, VersionableEntityAction.Read, user));*/
+    ComputeEntity computeEntity = getCompute(vspId, version, componentId, computeFlavorId);
+    ComputeData compute = computeEntity.getComputeCompositionData();
+
+    ComputeCompositionSchemaInput schemaInput = new ComputeCompositionSchemaInput();
+    schemaInput.setManual(vspInfoDao.isManual(vspId, version));
+    schemaInput.setCompute(compute);
+
+    CompositionEntityResponse<ComputeData> response = new CompositionEntityResponse<>();
+    response.setId(computeFlavorId);
+    response.setData(compute);
+    response.setSchema(getComputeCompositionSchema(schemaInput));
+
+    mdcDataDebugMessage.debugExitMessage("VSP id, component id, compute id", vspId,
+        componentId, computeFlavorId);
+
+    return response;
+  }
+
+  private ComputeEntity getCompute(String vspId, Version version, String componentId, String
+      computeFlavorId) {
+    //validateComponentId(vspId,version,componentId);
+    ComputeEntity retrieved = computeDao.get(new ComputeEntity(vspId, version, componentId,
+        computeFlavorId));
+    VersioningUtil
+        .validateEntityExistence(retrieved, new ComputeEntity(vspId, version, componentId,
+            computeFlavorId), VspDetails.ENTITY_TYPE);
+    return retrieved;
+  }
+
+  /*private void validateComponentId(String vspId, Version version, String componentId) {
+    ComponentEntity retrivedComponent = componentDao.get(new ComponentEntity(vspId, version,
+        componentId));
+    VersioningUtil
+        .validateEntityExistence(retrivedComponent, new ComponentEntity(vspId, version,
+            componentId),VspDetails.ENTITY_TYPE);
+  }*/
+
+  @Override
+  public QuestionnaireResponse getComputeQuestionnaire(String vspId, Version version, String
+          componentId, String computeId, String user) {
+    mdcDataDebugMessage.debugEntryMessage("VSP id, componentId", vspId, componentId, computeId);
+
+    /*version = VersioningUtil
+        .resolveVersion(version, getVersionInfo(vspId, VersionableEntityAction.Read, user));*/
+    //validateComponentId(vspId,version,componentId);
+    QuestionnaireResponse questionnaireResponse = new QuestionnaireResponse();
+    //validateComponentId(vspId,version,componentId);
+    ComputeEntity computeQuestionnaire = computeDao.getQuestionnaireData(vspId, version, componentId, computeId);
+    VersioningUtil
+            .validateEntityExistence(computeQuestionnaire, new ComputeEntity(vspId, version, componentId,
+                    computeId), VspDetails.ENTITY_TYPE);
+    questionnaireResponse.setData(computeQuestionnaire.getQuestionnaireData());
+    questionnaireResponse.setSchema(getComputeQuestionnaireSchema(null));
+
+    mdcDataDebugMessage.debugExitMessage("VSP id, component id", vspId,
+            componentId, computeId);
+
+    return questionnaireResponse;
+  }
+
+
+  protected String getComputeQuestionnaireSchema(SchemaTemplateInput schemaInput) {
+    mdcDataDebugMessage.debugEntryMessage(null, null);
+
+    mdcDataDebugMessage.debugExitMessage(null, null);
+    return SchemaGenerator
+        .generate(SchemaTemplateContext.questionnaire, CompositionEntityType.compute,
+            schemaInput);
+  }
+
+
+  @Override
+  public void updateComputeQuestionnaire(String vspId, Version version, String componentId, String
+      computeId,
+                                         String questionnaireData, String user) {
+    mdcDataDebugMessage.debugEntryMessage("VSP id, component id, compute id", vspId,
+        componentId, computeId);
+
+    /*Version activeVersion =
+        getVersionInfo(vspId, VersionableEntityAction.Write, user).getActiveVersion();
+    getComponent(vspId, activeVersion, componentId);*/
+    ComputeEntity retrieved = computeDao.get(new ComputeEntity(vspId,version,componentId,
+        computeId));
+    VersioningUtil.validateEntityExistence(retrieved, new ComputeEntity(vspId, version,
+        componentId, computeId), VspDetails.ENTITY_TYPE);
+
+    computeDao.updateQuestionnaireData(vspId, version, componentId, computeId, questionnaireData);
+
+    mdcDataDebugMessage.debugExitMessage("VSP id, component id, compute id", vspId,
+        componentId, computeId);
+  }
+
+  @Override
+  public CompositionEntityValidationData updateCompute(ComputeEntity compute, String user) {
+    mdcDataDebugMessage
+            .debugEntryMessage("VSP id, component id", compute.getVspId(), compute.getComponentId(),
+                    compute.getId());
+
+    /*Version activeVersion =
+        getVersionInfo(image.getVspId(), VersionableEntityAction.Write, user).getActiveVersion();
+    image.setVersion(activeVersion);*/
+
+    ComputeEntity retrieved = getComputeEntity(compute.getVspId(), compute.getVersion(), compute.getComponentId(),
+            compute.getId());
+
+    if(!vspInfoDao.isManual(compute.getVspId(), compute.getVersion())) {
+      final ComputeData computeCompositionData = compute.getComputeCompositionData();
+      final String name = computeCompositionData.getName();
+      //final String format = computeCompositionData.getFormat();
+      validateHeatVspComputeUpdate("Name", name, retrieved.getComputeCompositionData()
+              .getName());
+      /*validateHeatVspComputeUpdate("format", format, retrieved.getComputeCompositionData()
+          .getFormat());*/
+    }
+
+    Collection<ComputeEntity> vfcComputeList = listComputes(compute.getVspId() ,
+            compute.getVersion(), compute.getComponentId());
+
+    //Set to null so that retrieved object is equal to one in list and gets removed.
+    retrieved.setQuestionnaireData(null);
+    vfcComputeList.remove(retrieved);
+    if(vspInfoDao.isManual(compute.getVspId(), compute.getVersion()))
+      validateVfcCompute(compute, vfcComputeList);
+
+    //Set format to default value in order to handle FTL validation when compute format is null
+    /*if(compute.getComputeCompositionData().getFormat() == null)
+      compute.getComputeCompositionData().setFormat(ComputeFormat.qcow2.name());*/
+
+    ComputeCompositionSchemaInput schemaInput = new ComputeCompositionSchemaInput();
+    schemaInput.setCompute(compute.getComputeCompositionData());
+
+    CompositionEntityValidationData validationData = compositionEntityDataManager
+            .validateEntity(compute, SchemaTemplateContext.composition, schemaInput);
+    if (CollectionUtils.isEmpty(validationData.getErrors())) {
+      computeDao.update(compute);
+    }
+
+    mdcDataDebugMessage
+            .debugExitMessage("VSP id, component id", compute.getVspId(), compute.getComponentId(),
+                    compute.getId());
+
+    return validationData;
+  }
+
+  private void validateHeatVspComputeUpdate(String name, String value, String retrivedValue) {
+
+    if(value != null && !value.equals(retrivedValue)) {
+
+      final ErrorCode updateHeatComputeErrorBuilder =
+              DuplicateComputeInComponentErrorBuilder.getComputeHeatReadOnlyErrorBuilder(name);
+
+      MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+              LoggerTragetServiceName.UPDATE_COMPUTE, ErrorLevel.ERROR.name(),
+              LoggerErrorCode.PERMISSION_ERROR.getErrorCode(),
+              updateHeatComputeErrorBuilder.message());
+      throw new CoreException(updateHeatComputeErrorBuilder);
+    }
+  }
+
+  private void validateVfcCompute(ComputeEntity compute, Collection<ComputeEntity> vfcComputeList) {
+    if (isComputeNameDuplicate(vfcComputeList,compute.getComputeCompositionData().getName(), compute.getId())) {
+      ErrorCode errorCode = DuplicateComputeInComponentErrorBuilder.getDuplicateComputeNameErrorBuilder(compute
+              .getComputeCompositionData().getName(), compute.getComponentId());
+
+      MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+              LoggerTragetServiceName.CREATE_COMPONENT, ErrorLevel.ERROR.name(),
+              errorCode.id(),errorCode.message());
+
+      throw new CoreException(errorCode);
+    }
+  }
+
+  private boolean isComputeNameDuplicate(Collection<ComputeEntity> computes, String name, String computeId) {
+    for (ComputeEntity compute : computes) {
+      if (compute.getComputeCompositionData().getName().equals(name) && !compute.getId().equals(computeId)) {
+        return true;
+      }
+    }
+    return false;
+  }
+
+
+  private ComputeEntity getComputeEntity(String vspId, Version version, String componentId,
+  String computeId) {
+      //validateComponentId(vspId,version,componentId);
+      ComputeEntity computeEntity = computeDao.get(new ComputeEntity(vspId, version, componentId, computeId));
+      VersioningUtil.validateEntityExistence(computeEntity, new ComputeEntity(vspId, version, componentId,
+      computeId), VspDetails.ENTITY_TYPE);
+      return computeEntity;
+      }
+
+  private Collection<ComputeEntity> listComputes(String vspId, Version version, String componentId) {
+    return computeDao.list(new ComputeEntity(vspId, version, componentId, null));
+  }
+
+  @Override
+  public void deleteCompute(String vspId, Version version, String componentId, String
+      computeFlavorId, String user) {
+    final String VSP_COMPOSITION_EDIT_NOT_ALLOWED_MSG =
+        "Composition entities may not be created / deleted for Vendor Software Product "
+            + "whose entities were uploaded";
+    mdcDataDebugMessage.debugEntryMessage("VSP id, component id, compute id", vspId,
+        componentId, computeFlavorId);
+
+    /*Version activeVersion =
+        getVersionInfo(vspId, VersionableEntityAction.Write, user).getActiveVersion();*/
+    if (!vspInfoDao.isManual(vspId, version)) {
+      MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+          LoggerTragetServiceName.DELETE_COMPUTE, ErrorLevel.ERROR.name(),
+          LoggerErrorCode.PERMISSION_ERROR.getErrorCode(), "Can't delete compute");
+      throw new CoreException(
+          new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION)
+              .withId(VendorSoftwareProductErrorCodes.VSP_COMPOSITION_EDIT_NOT_ALLOWED)
+              .withMessage(VSP_COMPOSITION_EDIT_NOT_ALLOWED_MSG).build());
+    }
+    ComputeEntity retrived = getCompute(vspId,version,componentId,computeFlavorId);
+    if (retrived != null){
+      deleteComputeFromDeploymentFlavors(vspId,version,computeFlavorId);
+      computeDao.delete(new ComputeEntity(vspId, version, componentId, computeFlavorId));
+    }
+
+    mdcDataDebugMessage.debugExitMessage("VSP id, component id, compute id", vspId,
+        componentId, computeFlavorId);
+  }
+
+  private void deleteComputeFromDeploymentFlavors(String vspId, Version activeVersion,
+                                                  String computeFlavorId) {
+    //Collection<DeploymentFlavorEntity> listDF = listDeploymentFlavors(vspId, activeVersion);
+    Collection<DeploymentFlavorEntity> listDF = deploymentFlavorDao.list(new DeploymentFlavorEntity
+        (vspId, activeVersion, null));
+    for(DeploymentFlavorEntity df : listDF) {
+      DeploymentFlavorEntity deploymentFlavorEntity=removeComputeFromDF(df, computeFlavorId);
+      if(deploymentFlavorEntity!=null)
+        deploymentFlavorDao.update(deploymentFlavorEntity);
+    }
+  }
+
+  private DeploymentFlavorEntity removeComputeFromDF(DeploymentFlavorEntity df, String
+      computeFlavorId) {
+    DeploymentFlavor flavor = df.getDeploymentFlavorCompositionData();
+    List<ComponentComputeAssociation> associations = flavor.getComponentComputeAssociations();
+    if (associations != null) {
+      List<ComponentComputeAssociation> updatedAssociations = new ArrayList<>();
+      for (ComponentComputeAssociation ca : associations) {
+        if (ca.getComputeFlavorId() != null && ca.getComputeFlavorId().equals(computeFlavorId)) {
+          ComponentComputeAssociation updateCaremoveCompute = new ComponentComputeAssociation();
+          updateCaremoveCompute.setComponentId(ca.getComponentId());
+          updatedAssociations.add(updateCaremoveCompute);
+        } else {
+          updatedAssociations.add(ca);
+        }
+      }
+      flavor.setComponentComputeAssociations(updatedAssociations);
+      df.setDeploymentFlavorCompositionData(flavor);
+      return df;
+    }
+    return null;
+  }
+
+  protected String getComputeCompositionSchema(SchemaTemplateInput schemaInput){
+    mdcDataDebugMessage.debugEntryMessage(null, null);
+    mdcDataDebugMessage.debugExitMessage(null, null);
+    return SchemaGenerator.generate(SchemaTemplateContext.composition, CompositionEntityType.compute, schemaInput);
+  }
+
+   /*boolean isManual(String vspId, Version version) {
+
+    VspDetails vsp = vspInfoDao.get(new VspDetails(vspId, version));
+    String onboardingMethod = vsp.getOnboardingMethod();
+    if (MANUAL.equals(onboardingMethod)) {
+      return true;
+    }
+    return false;
+  }*/
+
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerFactoryImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerFactoryImpl.java
new file mode 100644
index 0000000..aef8be1
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerFactoryImpl.java
@@ -0,0 +1,31 @@
+package org.openecomp.sdc.vendorsoftwareproduct.impl;
+
+
+import org.openecomp.sdc.vendorsoftwareproduct.DeploymentFlavorManager;
+import org.openecomp.sdc.vendorsoftwareproduct.DeploymentFlavorManagerFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.DeploymentFlavorDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.DeploymentFlavorDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.factory.CompositionEntityDataManagerFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionEntityDataManager;
+
+public class DeploymentFlavorManagerFactoryImpl extends DeploymentFlavorManagerFactory {
+
+  private static final DeploymentFlavorManager INSTANCE = new DeploymentFlavorManagerImpl(
+      VendorSoftwareProductInfoDaoFactory.getInstance().createInterface(),
+      DeploymentFlavorDaoFactory.getInstance().createInterface(),
+      CompositionEntityDataManagerFactory.getInstance().createInterface(),
+      ComponentDaoFactory.getInstance().createInterface(),
+      ComputeDaoFactory.getInstance().createInterface()
+  );
+
+  @Override
+  public DeploymentFlavorManager createInterface() {
+    return INSTANCE;
+  }
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImpl.java
new file mode 100644
index 0000000..7069d77
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImpl.java
@@ -0,0 +1,396 @@
+package org.openecomp.sdc.vendorsoftwareproduct.impl;
+
+import org.apache.commons.collections4.CollectionUtils;
+import org.openecomp.sdc.common.errors.CoreException;
+import org.openecomp.sdc.common.errors.ErrorCode;
+import org.openecomp.sdc.datatypes.error.ErrorLevel;
+import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
+import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage;
+import org.openecomp.sdc.logging.types.LoggerConstants;
+import org.openecomp.sdc.logging.types.LoggerErrorCode;
+import org.openecomp.sdc.logging.types.LoggerTragetServiceName;
+import org.openecomp.sdc.vendorsoftwareproduct.DeploymentFlavorManager;
+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.VendorSoftwareProductInfoDao;
+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.VspDetails;
+import org.openecomp.sdc.vendorsoftwareproduct.errors.DeploymentFlavorErrorBuilder;
+import org.openecomp.sdc.vendorsoftwareproduct.errors.NotSupportedHeatOnboardMethodErrorBuilder;
+import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionEntityDataManager;
+import org.openecomp.sdc.vendorsoftwareproduct.services.schemagenerator.SchemaGenerator;
+import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse;
+import org.openecomp.sdc.vendorsoftwareproduct.types.VersionedVendorSoftwareProductInfo;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentComputeAssociation;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityType;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityValidationData;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.DeploymentFlavor;
+import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.DeploymentFlavorCompositionSchemaInput;
+import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateContext;
+import org.openecomp.sdc.vendorsoftwareproduct.utils.VendorSoftwareProductUtils;
+import org.openecomp.sdc.versioning.VersioningUtil;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdc.versioning.types.VersionableEntityAction;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+public class DeploymentFlavorManagerImpl implements DeploymentFlavorManager {
+
+  private static final MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
+  private VendorSoftwareProductInfoDao vspInfoDao;
+  private DeploymentFlavorDao deploymentFlavorDao;
+  private CompositionEntityDataManager compositionEntityDataManager;
+  private  ComponentDao componentDao;
+  private ComputeDao computeDao;
+
+  public DeploymentFlavorManagerImpl(
+      VendorSoftwareProductInfoDao vspInfoDao,
+      DeploymentFlavorDao deploymentFlavorDao,
+      CompositionEntityDataManager compositionEntityDataManager,
+      ComponentDao componentDao,
+      ComputeDao computeDao
+
+  ) {
+
+    this.vspInfoDao = vspInfoDao;
+    this.deploymentFlavorDao = deploymentFlavorDao;
+    this.compositionEntityDataManager = compositionEntityDataManager;
+    this.componentDao = componentDao;
+    this.computeDao = computeDao;
+
+  }
+
+  @Override
+  public Collection<DeploymentFlavorEntity> listDeploymentFlavors(String vspId, Version version,
+                                                                  String user) {
+    mdcDataDebugMessage.debugEntryMessage("VSP id", vspId);
+    /*version = VersioningUtil
+        .resolveVersion(version, getVersionInfo(vspId, VersionableEntityAction.Read, user));*/
+
+    mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
+    return listDeploymentFlavors(vspId, version);
+  }
+
+  private Collection<DeploymentFlavorEntity> listDeploymentFlavors(String vspId, Version version) {
+    Collection<DeploymentFlavorEntity> deploymentFlavorEntities =
+        deploymentFlavorDao.list(new DeploymentFlavorEntity(vspId, version, null));
+    return deploymentFlavorEntities;
+  }
+
+  @Override
+  public DeploymentFlavorEntity createDeploymentFlavor(
+      DeploymentFlavorEntity deploymentFlavorEntity, String user) {
+    DeploymentFlavorEntity createDeploymentFlavor = null;
+    mdcDataDebugMessage.debugEntryMessage("VSP id ", deploymentFlavorEntity.getVspId());
+    /*Version activeVersion =
+        getVersionInfo(deploymentFlavorEntity.getVspId(), VersionableEntityAction.Write, user)
+            .getActiveVersion();
+    deploymentFlavorEntity.setVersion(activeVersion);*/
+
+    if (!vspInfoDao.isManual(deploymentFlavorEntity.getVspId(),
+        deploymentFlavorEntity.getVersion())) {
+      ErrorCode deploymentFlavorErrorBuilder = DeploymentFlavorErrorBuilder
+          .getAddDeploymentNotSupportedHeatOnboardErrorBuilder();
+      MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+          LoggerTragetServiceName.CREATE_DEPLOYMENT_FLAVOR, ErrorLevel.ERROR.name(),
+          LoggerErrorCode.PERMISSION_ERROR.getErrorCode(), deploymentFlavorErrorBuilder.message());
+      throw new CoreException(deploymentFlavorErrorBuilder);
+    } else {
+      validateDeploymentFlavor(deploymentFlavorEntity, user, deploymentFlavorEntity.getVersion());
+      createDeploymentFlavor =
+          compositionEntityDataManager.createDeploymentFlavor(deploymentFlavorEntity);
+    }
+    return createDeploymentFlavor;
+  }
+
+  private void validateDeploymentFlavor(DeploymentFlavorEntity deploymentFlavorEntity, String
+      user, Version activeVersion) {
+    //Validation for unique model.
+    Collection<DeploymentFlavorEntity> listDeploymentFlavors =
+        listDeploymentFlavors(deploymentFlavorEntity.getVspId(),
+            activeVersion);
+    isDeploymentFlavorModelDuplicate(deploymentFlavorEntity, listDeploymentFlavors);
+
+    List<String> featureGroups =
+        getFeatureGroupListForVsp(deploymentFlavorEntity.getVspId(), user, activeVersion);
+    String featureGroup = deploymentFlavorEntity.getDeploymentFlavorCompositionData()
+        .getFeatureGroupId();
+    if (featureGroup != null && featureGroup.trim().length()>0) {
+      if (isEmpty(featureGroups) || (!(validFeatureGroup(featureGroups, featureGroup)))) {
+        ErrorCode deploymentFlavorErrorBuilder = DeploymentFlavorErrorBuilder
+            .getFeatureGroupNotexistErrorBuilder(featureGroup, deploymentFlavorEntity.getVspId(),
+                activeVersion);
+        MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+            LoggerTragetServiceName.CREATE_DEPLOYMENT_FLAVOR, ErrorLevel.ERROR.name(),
+            LoggerErrorCode.DATA_ERROR.getErrorCode(), deploymentFlavorErrorBuilder.message());
+        throw new CoreException(deploymentFlavorErrorBuilder);
+      }
+    }
+
+    validateComponentComputeAssociation(deploymentFlavorEntity, activeVersion);
+  }
+
+  private void isDeploymentFlavorModelDuplicate(DeploymentFlavorEntity deploymentFlavorEntity,
+                                                Collection<DeploymentFlavorEntity> listDeploymentFlavors) {
+    listDeploymentFlavors.forEach(deploymentFlavor -> {
+      if (deploymentFlavorEntity.getDeploymentFlavorCompositionData().getModel().equalsIgnoreCase(
+          deploymentFlavor.getDeploymentFlavorCompositionData().getModel())) {
+        ErrorCode deploymentFlavorModelErrorBuilder = DeploymentFlavorErrorBuilder
+            .getDuplicateDeploymentFlavorModelErrorBuilder(
+                deploymentFlavorEntity.getDeploymentFlavorCompositionData().getModel(),
+                deploymentFlavorEntity.getVspId());
+        MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+            LoggerTragetServiceName.CREATE_DEPLOYMENT_FLAVOR, ErrorLevel.ERROR.name(),
+            LoggerErrorCode.DATA_ERROR.getErrorCode(), deploymentFlavorModelErrorBuilder.message());
+        throw new CoreException(deploymentFlavorModelErrorBuilder);
+      }
+    });
+  }
+
+  private List<String> getFeatureGroupListForVsp(String vspId,
+                                                 String user, Version activeVersion) {
+    /*VersionedVendorSoftwareProductInfo versionedVendorSoftwareProductInfo = getVspDetails(
+        vspId,activeVersion, user);
+    return versionedVendorSoftwareProductInfo.getVspDetails()
+        .getFeatureGroups();*/
+
+    final VspDetails vspDetails = vspInfoDao.get(new VspDetails(vspId, activeVersion));
+    return vspDetails.getFeatureGroups();
+  }
+
+  private boolean isEmpty(Collection coll) {
+    return (coll == null || coll.isEmpty());
+  }
+
+  private boolean validFeatureGroup(List<String> featureGroups, String featureGroupId) {
+    Iterator<String> iterator = featureGroups.iterator();
+    boolean valid = false;
+    while (iterator.hasNext()) {
+      String fgId = iterator.next().trim();
+      if (fgId.equals(featureGroupId)) {
+        valid = true;
+        break;
+      } else {
+        valid = false;
+      }
+    }
+    return valid;
+  }
+
+  private void validateComponentComputeAssociation(DeploymentFlavorEntity deploymentFlavorEntity,
+                                                   Version activeVersion) {
+    List<ComponentComputeAssociation> componentComputeAssociationList = deploymentFlavorEntity
+        .getDeploymentFlavorCompositionData().getComponentComputeAssociations();
+    List<String> vfcList = new ArrayList<>();
+    if (!isEmpty(componentComputeAssociationList)) {
+      componentComputeAssociationList.forEach(componentComputeAssociation -> {
+        if ((componentComputeAssociation.getComponentId() == null || componentComputeAssociation
+            .getComponentId().trim().length() == 0) &&
+            (componentComputeAssociation
+                .getComputeFlavorId() != null && componentComputeAssociation
+                .getComputeFlavorId().trim().length() > 0)) {
+          ErrorCode invalidAssociationErrorBuilder = DeploymentFlavorErrorBuilder
+              .getInvalidAssociationErrorBuilder();
+          MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+              LoggerTragetServiceName.CREATE_DEPLOYMENT_FLAVOR, ErrorLevel.ERROR.name(),
+              LoggerErrorCode.DATA_ERROR.getErrorCode(), invalidAssociationErrorBuilder.message());
+          throw new CoreException(invalidAssociationErrorBuilder);
+        } else if (componentComputeAssociation.getComponentId() != null &&
+            componentComputeAssociation.getComponentId().trim().length() > 0 ) {
+          ComponentEntity component = getComponent(deploymentFlavorEntity.getVspId(), activeVersion,
+              componentComputeAssociation.getComponentId());
+          if (componentComputeAssociation
+              .getComputeFlavorId() != null && componentComputeAssociation
+              .getComputeFlavorId().trim().length() > 0 ) {
+            ComputeEntity computeFlavor = computeDao.get(new ComputeEntity(deploymentFlavorEntity
+                    .getVspId(), activeVersion, componentComputeAssociation.getComponentId(),
+                componentComputeAssociation.getComputeFlavorId()));
+            if (computeFlavor == null) {
+              ErrorCode invalidComputeIdErrorBuilder = DeploymentFlavorErrorBuilder
+                  .getInvalidComputeIdErrorBuilder(componentComputeAssociation.getComputeFlavorId(),
+                      componentComputeAssociation.getComponentId());
+              MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+                  LoggerTragetServiceName.CREATE_DEPLOYMENT_FLAVOR, ErrorLevel.ERROR.name(),
+                  LoggerErrorCode.DATA_ERROR.getErrorCode(),
+                  invalidComputeIdErrorBuilder.message());
+              throw new CoreException(invalidComputeIdErrorBuilder);
+            }
+          }
+          vfcList.add(componentComputeAssociation.getComponentId());
+        }
+      });
+      Map<String, Integer> frequencyMapping = CollectionUtils.getCardinalityMap(vfcList);
+
+      for (Integer vfcCount : frequencyMapping.values()) {
+        if (vfcCount != 1) {
+          ErrorCode duplicateVfcAssociationErrorBuilder = DeploymentFlavorErrorBuilder
+              .getDuplicateVfcAssociationErrorBuilder();
+          MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+              LoggerTragetServiceName.CREATE_DEPLOYMENT_FLAVOR, ErrorLevel.ERROR.name(),
+              LoggerErrorCode.DATA_ERROR.getErrorCode(),
+              duplicateVfcAssociationErrorBuilder.message());
+          throw new CoreException(duplicateVfcAssociationErrorBuilder);
+        }
+      }
+    }
+  }
+
+  private ComponentEntity getComponent(String vspId, Version version, String componentId) {
+    ComponentEntity retrieved = componentDao.get(new ComponentEntity(vspId, version, componentId));
+    VersioningUtil
+        .validateEntityExistence(retrieved, new ComponentEntity(vspId, version, componentId),
+            VspDetails.ENTITY_TYPE);
+    return retrieved;
+  }
+
+  @Override
+  public CompositionEntityResponse<DeploymentFlavor> getDeploymentFlavor(String vspId,
+                                                                         Version version,
+                                                                         String deploymentFlavorId,
+                                                                         String user) {
+    mdcDataDebugMessage
+        .debugEntryMessage("VSP id, deployment flavor id", vspId, deploymentFlavorId);
+
+    /*version = VersioningUtil
+        .resolveVersion(version, getVersionInfo(vspId, VersionableEntityAction.Read, user));*/
+    DeploymentFlavorEntity deploymentFlavorEntity = getDeploymentFlavor(vspId,version,
+        deploymentFlavorId);
+    DeploymentFlavor deploymentFlavor = deploymentFlavorEntity.getDeploymentFlavorCompositionData();
+    DeploymentFlavorCompositionSchemaInput schemaInput = new
+        DeploymentFlavorCompositionSchemaInput();
+    schemaInput.setManual(vspInfoDao.isManual(vspId, version));
+    schemaInput.setDeploymentFlavor(deploymentFlavor);
+    List<String> featureGroups =
+        getFeatureGroupListForVsp(vspId, user, version);
+    schemaInput.setFeatureGroupIds(featureGroups);
+    CompositionEntityResponse<DeploymentFlavor> response = new CompositionEntityResponse<>();
+    response.setId(deploymentFlavorId);
+    response.setSchema((SchemaGenerator
+        .generate(SchemaTemplateContext.composition, CompositionEntityType.deployment,
+            schemaInput)));
+    response.setData(deploymentFlavor);
+    mdcDataDebugMessage
+        .debugExitMessage("VSP id, deployment flavor id ", vspId, deploymentFlavorId);
+
+    return response;
+  }
+
+  private DeploymentFlavorEntity getDeploymentFlavor(String vspId, Version version, String
+      deploymentFlavorId) {
+    DeploymentFlavorEntity retrieved = deploymentFlavorDao.get(new DeploymentFlavorEntity(vspId,
+        version, deploymentFlavorId));
+    VersioningUtil
+        .validateEntityExistence(retrieved, new DeploymentFlavorEntity(vspId, version,
+            deploymentFlavorId ), VspDetails.ENTITY_TYPE);
+    return retrieved;
+  }
+
+  @Override
+  public CompositionEntityResponse<DeploymentFlavor> getDeploymentFlavorSchema(String vspId,
+                                                                               Version version,
+                                                                               String user) {
+    /*version = VersioningUtil
+        .resolveVersion(version, getVersionInfo(vspId, VersionableEntityAction.Read, user));*/
+    DeploymentFlavorCompositionSchemaInput schemaInput= new
+        DeploymentFlavorCompositionSchemaInput();
+    schemaInput.setManual(vspInfoDao.isManual(vspId, version));
+    List<String> featureGroups =
+        getFeatureGroupListForVsp(vspId, user, version);
+    schemaInput.setFeatureGroupIds(featureGroups);
+    CompositionEntityResponse<DeploymentFlavor> response = new CompositionEntityResponse<>();
+    response.setSchema((SchemaGenerator
+        .generate(SchemaTemplateContext.composition, CompositionEntityType.deployment,
+            schemaInput)));
+    return response;
+  }
+
+  @Override
+  public void deleteDeploymentFlavor(String vspId, Version version, String deploymentFlavorId,
+                                     String user) {
+    mdcDataDebugMessage
+        .debugEntryMessage("VSP id, deployment flavor id", vspId, deploymentFlavorId);
+    /*Version activeVersion =
+        getVersionInfo(vspId, VersionableEntityAction.Write, user).getActiveVersion();*/
+    DeploymentFlavorEntity deploymentFlavorEntity = getDeploymentFlavor(vspId,version,
+        deploymentFlavorId);
+    if (!vspInfoDao.isManual(vspId, version)) {
+      final ErrorCode deleteDeploymentFlavorErrorBuilder =
+          NotSupportedHeatOnboardMethodErrorBuilder
+              .getDelDeploymentFlavorNotSupportedHeatOnboardMethodErrorBuilder();
+      MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+          LoggerTragetServiceName.DELETE_DEPLOYMENT_FLAVOR, ErrorLevel.ERROR.name(),
+          LoggerErrorCode.PERMISSION_ERROR.getErrorCode(),
+          deleteDeploymentFlavorErrorBuilder.message());
+      throw new CoreException(deleteDeploymentFlavorErrorBuilder);
+    }
+    if(deploymentFlavorEntity != null) {
+      deploymentFlavorDao.delete(new DeploymentFlavorEntity(vspId, version, deploymentFlavorId));
+
+    }
+    mdcDataDebugMessage
+        .debugExitMessage("VSP id, deployment flavor id", vspId, deploymentFlavorId);
+  }
+
+  public CompositionEntityValidationData updateDeploymentFlavor(DeploymentFlavorEntity
+                                                                    deploymentFlavorEntity, String user) {
+    mdcDataDebugMessage.debugEntryMessage("VSP id, deploymentFlavor id", deploymentFlavorEntity
+        .getVspId(), deploymentFlavorEntity.getId());
+    /*Version activeVersion =
+        getVersionInfo(deploymentFlavorEntity.getVspId(), VersionableEntityAction.Write, user)
+            .getActiveVersion();*/
+
+    if (!vspInfoDao.isManual(deploymentFlavorEntity.getVspId(),
+        deploymentFlavorEntity.getVersion())) {
+      final ErrorCode updateDeploymentFlavorErrorBuilder =
+          NotSupportedHeatOnboardMethodErrorBuilder
+              .getUpdateDfNotSupportedHeatOnboardMethodErrorBuilder();
+      MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+          LoggerTragetServiceName.UPDATE_DEPLOYMENT_FLAVOR, ErrorLevel.ERROR.name(),
+          LoggerErrorCode.PERMISSION_ERROR.getErrorCode(),
+          updateDeploymentFlavorErrorBuilder.message());
+      throw new CoreException(updateDeploymentFlavorErrorBuilder);
+    }
+    //deploymentFlavorEntity.setVersion(activeVersion);
+    DeploymentFlavorEntity retrieved =
+        getDeploymentFlavor(deploymentFlavorEntity.getVspId(), deploymentFlavorEntity.getVersion(),
+            deploymentFlavorEntity.getId());
+
+
+    Collection<DeploymentFlavorEntity> listDeploymentFlavors = listDeploymentFlavors
+        (deploymentFlavorEntity.getVspId(), deploymentFlavorEntity.getVersion());
+    listDeploymentFlavors.remove(retrieved);
+    isDeploymentFlavorModelDuplicate(deploymentFlavorEntity, listDeploymentFlavors);
+
+    //validateComponentComputeAssociation(deploymentFlavorEntity, activeVersion);
+    validateComponentComputeAssociation(deploymentFlavorEntity, deploymentFlavorEntity.getVersion());
+
+    DeploymentFlavorCompositionSchemaInput schemaInput = new
+        DeploymentFlavorCompositionSchemaInput();
+    schemaInput.setManual(vspInfoDao.isManual(deploymentFlavorEntity.getVspId(),
+        deploymentFlavorEntity.getVersion()));
+    schemaInput.setDeploymentFlavor(retrieved.getDeploymentFlavorCompositionData());
+
+    List<String> featureGroups =
+        getFeatureGroupListForVsp(deploymentFlavorEntity.getVspId(), user,
+            deploymentFlavorEntity.getVersion());
+    schemaInput.setFeatureGroupIds(featureGroups);
+
+    CompositionEntityValidationData validationData = compositionEntityDataManager
+        .validateEntity(deploymentFlavorEntity, SchemaTemplateContext.composition, schemaInput);
+    if (CollectionUtils.isEmpty(validationData.getErrors())) {
+      deploymentFlavorDao.update(deploymentFlavorEntity);
+    }
+
+    mdcDataDebugMessage.debugExitMessage("VSP id, deploymentFlavor id",
+        deploymentFlavorEntity.getVspId(), deploymentFlavorEntity.getId());
+    return validationData;
+  }
+
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerFactoryImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerFactoryImpl.java
new file mode 100644
index 0000000..9689615
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerFactoryImpl.java
@@ -0,0 +1,24 @@
+package org.openecomp.sdc.vendorsoftwareproduct.impl;
+
+
+import org.openecomp.sdc.vendorsoftwareproduct.ImageManager;
+import org.openecomp.sdc.vendorsoftwareproduct.ImageManagerFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ImageDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.factory.CompositionEntityDataManagerFactory;
+
+public class ImageManagerFactoryImpl extends ImageManagerFactory {
+
+  private static final ImageManager INSTANCE =
+      new ImageManagerImpl(
+          VendorSoftwareProductInfoDaoFactory.getInstance().createInterface(),
+          ImageDaoFactory.getInstance().createInterface(),
+          CompositionEntityDataManagerFactory.getInstance().createInterface()
+      );
+
+  @Override
+  public ImageManager createInterface() {
+    return INSTANCE;
+  }
+
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImpl.java
new file mode 100644
index 0000000..e180138
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImpl.java
@@ -0,0 +1,359 @@
+package org.openecomp.sdc.vendorsoftwareproduct.impl;
+
+
+import org.apache.commons.collections4.CollectionUtils;
+import org.openecomp.core.utilities.json.JsonUtil;
+import org.openecomp.sdc.common.errors.CoreException;
+import org.openecomp.sdc.common.errors.ErrorCode;
+import org.openecomp.sdc.datatypes.error.ErrorLevel;
+import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
+import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage;
+import org.openecomp.sdc.logging.types.LoggerConstants;
+import org.openecomp.sdc.logging.types.LoggerErrorCode;
+import org.openecomp.sdc.logging.types.LoggerTragetServiceName;
+import org.openecomp.sdc.vendorsoftwareproduct.ImageManager;
+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.VendorSoftwareProductInfoDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ImageEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
+import org.openecomp.sdc.vendorsoftwareproduct.errors.ImageErrorBuilder;
+import org.openecomp.sdc.vendorsoftwareproduct.errors.NotSupportedHeatOnboardMethodErrorBuilder;
+import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionEntityDataManager;
+import org.openecomp.sdc.vendorsoftwareproduct.services.schemagenerator.SchemaGenerator;
+import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse;
+import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireResponse;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityType;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityValidationData;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Image;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ImageFormat;
+import org.openecomp.sdc.vendorsoftwareproduct.types.questionnaire.component.image.ImageDetails;
+import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.ImageCompositionSchemaInput;
+import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateContext;
+import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateInput;
+import org.openecomp.sdc.vendorsoftwareproduct.utils.VendorSoftwareProductUtils;
+import org.openecomp.sdc.versioning.VersioningUtil;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdc.versioning.types.VersionableEntityAction;
+
+import java.util.Collection;
+
+public class ImageManagerImpl implements ImageManager {
+  private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
+  private VendorSoftwareProductInfoDao vspInfoDao;
+  private ImageDao imageDao;
+  private CompositionEntityDataManager compositionEntityDataManager;
+
+  public ImageManagerImpl(
+      VendorSoftwareProductInfoDao vspInfoDao,
+      ImageDao imageDao,
+      CompositionEntityDataManager compositionEntityDataManager
+
+  ) {
+
+    this.vspInfoDao = vspInfoDao;
+    this.imageDao = imageDao;
+    this.compositionEntityDataManager = compositionEntityDataManager;
+
+  }
+
+  @Override
+  public ImageEntity createImage(ImageEntity imageEntity, String user) {
+    /*Version activeVersion = getVersionInfo(imageEntity.getVspId(),
+        VersionableEntityAction.Write, user).getActiveVersion();
+
+    imageEntity.setVersion(activeVersion);*/
+    if (!vspInfoDao.isManual(imageEntity.getVspId(), imageEntity.getVersion())) {
+
+      ErrorCode errorCode = NotSupportedHeatOnboardMethodErrorBuilder
+          .getAddImageNotSupportedHeatOnboardMethodErrorBuilder();
+
+      MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+          LoggerTragetServiceName.CREATE_IMAGE, ErrorLevel.ERROR.name(),
+          errorCode.id(), errorCode.message());
+
+      throw new CoreException(errorCode);
+    }
+
+    Collection<ImageEntity> vfcImageList = listImages(imageEntity.getVspId() ,
+        imageEntity.getVersion(), imageEntity.getComponentId());
+    validateVfcImage(imageEntity, vfcImageList);
+    compositionEntityDataManager.createImage(imageEntity);
+    return imageEntity;
+  }
+
+  @Override
+  public Collection<ImageEntity> listImages(String vspId, Version version, String componentId,
+                                            String user) {
+    mdcDataDebugMessage.debugEntryMessage("VSP id", vspId);
+    Collection<ImageEntity> imageEntities = listImages(vspId, version, componentId);
+
+    mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
+
+    return imageEntities;
+  }
+
+  private Collection<ImageEntity> listImages(String vspId, Version version, String componentId) {
+    return imageDao.list(new ImageEntity(vspId, version, componentId, null));
+  }
+
+  @Override
+  public CompositionEntityResponse getImageSchema(String vspId, String user) {
+    mdcDataDebugMessage.debugEntryMessage("VSP id, image id", vspId);
+
+    CompositionEntityResponse<Image> response = new CompositionEntityResponse<>();
+    ImageCompositionSchemaInput inputSchema = new ImageCompositionSchemaInput();
+    Image image = new Image();
+    //image.setFormat(ImageFormat.qcow2.name());
+    inputSchema.setImage(image);
+    response.setSchema(getImageCompositionSchema(inputSchema));
+
+    mdcDataDebugMessage.debugExitMessage("VSP id, image id", vspId);
+    return response;
+  }
+
+  @Override
+  public CompositionEntityResponse<Image> getImage(String vspId, Version version, String
+      componentId, String imageId, String user) {
+
+    mdcDataDebugMessage.debugEntryMessage("VSP id, componentId, image id", vspId, componentId,
+        imageId);
+
+    /*version = VersioningUtil
+        .resolveVersion(version, getVersionInfo(vspId, VersionableEntityAction.Read, user));*/
+
+    ImageEntity imageEntity = getImageEntity(vspId, version, componentId, imageId);
+
+    Image image = imageEntity.getImageCompositionData();
+    //Set format to default value in order to handle FTL validation when image format is null
+    /*if(image.getFormat() == null)
+      image.setFormat(ImageFormat.qcow2.name());*/
+
+    ImageCompositionSchemaInput schemaInput = new ImageCompositionSchemaInput();
+    schemaInput.setImage(image);
+
+    CompositionEntityResponse<Image> response = new CompositionEntityResponse<>();
+    response.setId(imageId);
+    response.setData(image);
+    response.setSchema(getImageCompositionSchema(schemaInput));
+
+    mdcDataDebugMessage.debugExitMessage("VSP id, componentId, image id", vspId, componentId,
+        imageId);
+
+    return response;
+  }
+
+  @Override
+  public QuestionnaireResponse getImageQuestionnaire(String vspId, Version version, String
+      componentId, String imageId, String user) {
+    mdcDataDebugMessage.debugEntryMessage("VSP id", vspId);
+
+    /*version = VersioningUtil
+        .resolveVersion(version, getVersionInfo(vspId, VersionableEntityAction.Read, user));
+    validateComponentId(vspId,version,componentId);*/
+    QuestionnaireResponse questionnaireResponse = new QuestionnaireResponse();
+    //validateComponentId(vspId,version,componentId);
+
+    ImageEntity retrieved = imageDao.getQuestionnaireData(vspId, version, componentId, imageId);
+    VersioningUtil.validateEntityExistence(retrieved, new ImageEntity(vspId, version, componentId,
+            imageId), ComponentEntity.ENTITY_TYPE);
+    questionnaireResponse.setData(retrieved.getQuestionnaireData());
+    questionnaireResponse.setSchema(getImageQuestionnaireSchema(null));
+
+    mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
+
+    return questionnaireResponse;
+  }
+
+  @Override
+  public void deleteImage(String vspId, Version version, String componentId, String imageId, String
+      user) {
+    mdcDataDebugMessage
+        .debugEntryMessage("VSP id, component id", vspId, componentId, imageId);
+
+    /*Version activeVersion =
+        getVersionInfo(vspId, VersionableEntityAction.Write, user).getActiveVersion();
+    ComponentEntity component = getComponent(vspId, activeVersion, componentId);*/
+    ImageEntity imageEntity = getImageEntity(vspId, version, componentId, imageId);
+    if (!vspInfoDao.isManual(vspId, version)) {
+      final ErrorCode deleteImageErrorBuilder =
+          NotSupportedHeatOnboardMethodErrorBuilder
+              .getDelImageNotSupportedHeatOnboardMethodErrorBuilder();
+      MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+          LoggerTragetServiceName.DELETE_IMAGE, ErrorLevel.ERROR.name(),
+          LoggerErrorCode.PERMISSION_ERROR.getErrorCode(),
+          deleteImageErrorBuilder.message());
+      throw new CoreException(deleteImageErrorBuilder);
+    }
+    if (imageEntity != null) {
+      imageDao.delete(new ImageEntity(vspId, version, componentId, imageId));
+    }
+    mdcDataDebugMessage
+        .debugExitMessage("VSP id, component id", vspId, componentId, imageId);
+  }
+
+  private void validateHeatVspImageUpdate(String name, String value, String retrivedValue) {
+
+    if(value != null && !value.equals(retrivedValue)) {
+
+      final ErrorCode updateHeatImageErrorBuilder =
+          ImageErrorBuilder.getImageHeatReadOnlyErrorBuilder(name);
+
+      MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+          LoggerTragetServiceName.UPDATE_IMAGE, ErrorLevel.ERROR.name(),
+          LoggerErrorCode.PERMISSION_ERROR.getErrorCode(),
+          updateHeatImageErrorBuilder.message());
+      throw new CoreException(updateHeatImageErrorBuilder);
+    }
+  }
+
+  @Override
+  public CompositionEntityValidationData updateImage(ImageEntity image, String user) {
+    mdcDataDebugMessage
+        .debugEntryMessage("VSP id, component id", image.getVspId(), image.getComponentId(),
+            image.getId());
+
+    /*Version activeVersion =
+        getVersionInfo(image.getVspId(), VersionableEntityAction.Write, user).getActiveVersion();
+    image.setVersion(activeVersion);*/
+
+    ImageEntity retrieved = getImageEntity(image.getVspId(), image.getVersion(), image.getComponentId(),
+        image.getId());
+
+    if(!vspInfoDao.isManual(image.getVspId(), image.getVersion())) {
+      final Image imageCompositionData = image.getImageCompositionData();
+      final String fileName = imageCompositionData.getFileName();
+      //final String format = imageCompositionData.getFormat();
+      validateHeatVspImageUpdate("fileName", fileName, retrieved.getImageCompositionData()
+          .getFileName());
+      /*validateHeatVspImageUpdate("format", format, retrieved.getImageCompositionData()
+          .getFormat());*/
+    }
+
+    Collection<ImageEntity> vfcImageList = listImages(image.getVspId() ,
+        image.getVersion(), image.getComponentId());
+
+    //Set to null so that retrieved object is equal to one in list and gets removed.
+    retrieved.setQuestionnaireData(null);
+    vfcImageList.remove(retrieved);
+    validateVfcImage(image, vfcImageList);
+
+    //Set format to default value in order to handle FTL validation when image format is null
+    /*if(image.getImageCompositionData().getFormat() == null)
+      image.getImageCompositionData().setFormat(ImageFormat.qcow2.name());*/
+
+    ImageCompositionSchemaInput schemaInput = new ImageCompositionSchemaInput();
+    schemaInput.setImage(image.getImageCompositionData());
+
+    CompositionEntityValidationData validationData = compositionEntityDataManager
+        .validateEntity(image, SchemaTemplateContext.composition, schemaInput);
+    if (CollectionUtils.isEmpty(validationData.getErrors())) {
+      imageDao.update(image);
+    }
+
+    mdcDataDebugMessage
+        .debugExitMessage("VSP id, component id", image.getVspId(), image.getComponentId(),
+            image.getId());
+
+    return validationData;
+  }
+
+  @Override
+  public void updateImageQuestionnaire(String vspId, Version version, String componentId, String
+      imageId, String questionnaireData, String user) {
+    mdcDataDebugMessage.debugEntryMessage("VSP id, component id, imageId", vspId, componentId,
+        imageId);
+
+    getImageEntity(vspId, version, componentId, imageId);
+
+    /*Version activeVersion =
+        getVersionInfo(vspId, VersionableEntityAction.Write, user).getActiveVersion();
+
+    getComponent(vspId, activeVersion, componentId);*/
+
+    final ImageDetails image = JsonUtil.json2Object(questionnaireData, ImageDetails.class);
+    final String format = image.getFormat();
+    try {
+      if (format != null) {
+        final ImageFormat imageFormat = ImageFormat.valueOf(format);
+      }
+    } catch (IllegalArgumentException exception) {
+      ErrorCode errorCode = ImageErrorBuilder.getInvalidImageFormatErrorBuilder();
+      MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+          LoggerTragetServiceName.UPDATE_IMAGE, ErrorLevel.ERROR.name(),
+          errorCode.id(), errorCode.message() );
+      throw new CoreException(errorCode);
+    }
+
+    //Validate Format is read only for HEAT Onboarding
+    if (!vspInfoDao.isManual(vspId, version)) {
+      final QuestionnaireResponse imageQuestionnaire = getImageQuestionnaire(vspId, version,
+          componentId, imageId, user);
+      final String data = imageQuestionnaire.getData();
+      if (data != null) {
+        String retrivedFormat = JsonUtil.json2Object(data, ImageDetails.class).getFormat();
+        validateHeatVspImageUpdate("format", format, retrivedFormat);
+      }
+    }
+
+    imageDao.updateQuestionnaireData(vspId, version, componentId, imageId, questionnaireData);
+    mdcDataDebugMessage.debugExitMessage("VSP id, component id, imageId", vspId, componentId,
+        imageId);
+  }
+
+  private ImageEntity getImageEntity(String vspId, Version version, String componentId,
+                                     String imageId) {
+    //validateComponentId(vspId,version,componentId);
+
+    ImageEntity imageEntity = imageDao.get(new ImageEntity(vspId, version, componentId, imageId));
+
+    VersioningUtil.validateEntityExistence(imageEntity, new ImageEntity(vspId, version, componentId,
+        imageId), VspDetails.ENTITY_TYPE);
+    return imageEntity;
+  }
+
+
+  private boolean isImageNameDuplicate(Collection<ImageEntity> images, String fileName) {
+    for (ImageEntity image : images) {
+      if (image.getImageCompositionData().getFileName().equalsIgnoreCase(fileName)) {
+        return true;
+      }
+    }
+    return false;
+  }
+
+  private void validateVfcImage(ImageEntity image, Collection<ImageEntity> vfcImageList) {
+    if (isImageNameDuplicate(vfcImageList,image.getImageCompositionData().getFileName())) {
+      ErrorCode errorCode = ImageErrorBuilder.getDuplicateImageNameErrorBuilder(image
+          .getImageCompositionData().getFileName(), image.getComponentId());
+
+      MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+          LoggerTragetServiceName.CREATE_COMPONENT, ErrorLevel.ERROR.name(),
+          errorCode.id(),errorCode.message());
+
+      throw new CoreException(errorCode);
+    }
+  }
+
+  protected String getImageCompositionSchema(SchemaTemplateInput schemaInput) {
+    mdcDataDebugMessage.debugEntryMessage(null, null);
+    mdcDataDebugMessage.debugExitMessage(null, null);
+    return SchemaGenerator
+        .generate(SchemaTemplateContext.composition, CompositionEntityType.image,
+            schemaInput);
+  }
+
+  protected String getImageQuestionnaireSchema(SchemaTemplateInput schemaInput) {
+    mdcDataDebugMessage.debugEntryMessage(null, null);
+
+    mdcDataDebugMessage.debugExitMessage(null, null);
+    return SchemaGenerator
+        .generate(SchemaTemplateContext.questionnaire, CompositionEntityType.image,
+            schemaInput);
+  }
+
+
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImpl.java
new file mode 100644
index 0000000..ef33812
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImpl.java
@@ -0,0 +1,117 @@
+package org.openecomp.sdc.vendorsoftwareproduct.impl;
+
+import org.apache.commons.collections4.MapUtils;
+import org.openecomp.sdc.datatypes.error.ErrorLevel;
+import org.openecomp.sdc.datatypes.error.ErrorLevel;
+import org.openecomp.sdc.generator.core.services.ManualVspToscaGenerationService;
+import org.openecomp.sdc.generator.datatypes.tosca.DeploymentFlavorModel;
+import org.openecomp.sdc.generator.datatypes.tosca.MultiFlavorVfcImage;
+import org.openecomp.sdc.generator.datatypes.tosca.VspModelInfo;
+import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
+import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage;
+import org.openecomp.sdc.logging.types.LoggerConstants;
+import org.openecomp.sdc.logging.types.LoggerErrorCode;
+import org.openecomp.sdc.logging.types.LoggerTragetServiceName;
+import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
+import org.openecomp.sdc.vendorsoftwareproduct.ManualVspToscaManager;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic;
+import org.openecomp.sdc.vendorsoftwareproduct.utils.ManualVspDataCollectionService;
+import org.openecomp.sdc.versioning.dao.types.Version;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+
+public class ManualVspToscaManagerImpl implements ManualVspToscaManager {
+
+  private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
+
+  @Override
+  public VspModelInfo gatherVspInformation(String vspId, Version version, String user) {
+    mdcDataDebugMessage.debugEntryMessage(null, null);
+    ManualVspDataCollectionService
+        manualVspDataCollectionService = new ManualVspDataCollectionService();
+    VspModelInfo vspModelInfo = new VspModelInfo();
+    //Get Release Vendor Name
+    Optional<String> releaseVendor;
+    try {
+      releaseVendor = manualVspDataCollectionService.getReleaseVendor(vspId, version, user);
+    } catch (Exception ex) {
+      releaseVendor = Optional.empty();
+      MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API,
+          LoggerTragetServiceName.COLLECT_MANUAL_VSP_TOSCA_DATA, ErrorLevel.INFO.name(),
+          LoggerErrorCode.DATA_ERROR.getErrorCode(), "Release Vendor not found");
+    }
+    releaseVendor.ifPresent(vspModelInfo::setReleaseVendor);
+
+    //Get Allowed Deployment flavors information
+    Map<String, DeploymentFlavorModel> allowedFlavors;
+    try {
+      allowedFlavors = manualVspDataCollectionService.getAllowedFlavors(vspId, version, user);
+    } catch (Exception ex) {
+      MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API,
+          LoggerTragetServiceName.COLLECT_MANUAL_VSP_TOSCA_DATA, ErrorLevel.INFO.name(),
+          LoggerErrorCode.DATA_ERROR.getErrorCode(), "Unable to collect allowed flavors");
+      allowedFlavors = null;
+    }
+    if (MapUtils.isNotEmpty(allowedFlavors)) {
+      vspModelInfo.setAllowedFlavors(allowedFlavors);
+    }
+
+    //Get VFC Image information
+    Map<String, List<MultiFlavorVfcImage>> vspComponentImages;
+    try {
+      vspComponentImages =
+          manualVspDataCollectionService.getVspComponentImages(vspId, version, user);
+    } catch (Exception ex) {
+      MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API,
+          LoggerTragetServiceName.COLLECT_MANUAL_VSP_TOSCA_DATA, ErrorLevel.INFO.name(),
+          LoggerErrorCode.DATA_ERROR.getErrorCode(), "Unable to collect vsp component images");
+      vspComponentImages = null;
+    }
+    if (MapUtils.isNotEmpty(vspComponentImages)) {
+      vspModelInfo.setMultiFlavorVfcImages(vspComponentImages);
+    }
+
+    //Get VFC component information
+    Map<String, String> vspComponents;
+    try {
+      vspComponents = manualVspDataCollectionService.getVspComponents(vspId, version, user);
+    } catch (Exception ex) {
+      MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API,
+          LoggerTragetServiceName.COLLECT_MANUAL_VSP_TOSCA_DATA, ErrorLevel.INFO.name(),
+          LoggerErrorCode.DATA_ERROR.getErrorCode(), "Unable to collect vsp components");
+      vspComponents = null;
+    }
+    if (MapUtils.isNotEmpty(vspComponents)) {
+      vspModelInfo.setComponents(vspComponents);
+    }
+
+    //Get VSP component nic information
+    Map<String, List<Nic>> vspComponentNics;
+    try {
+      vspComponentNics = manualVspDataCollectionService.getVspComponentNics(vspId, version, user);
+    } catch (Exception ex) {
+      MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API,
+          LoggerTragetServiceName.COLLECT_MANUAL_VSP_TOSCA_DATA, ErrorLevel.INFO.name(),
+          LoggerErrorCode.DATA_ERROR.getErrorCode(), "Unable to collect vsp component nics");
+      vspComponentNics = null;
+    }
+    if (MapUtils.isNotEmpty(vspComponentNics)) {
+      vspModelInfo.setNics(vspComponentNics);
+    }
+
+    mdcDataDebugMessage.debugExitMessage(null, null);
+    return vspModelInfo;
+  }
+
+  @Override
+  public ToscaServiceModel generateToscaModel(VspModelInfo vspModelInfo) {
+    mdcDataDebugMessage.debugEntryMessage(null, null);
+    ManualVspToscaGenerationService vspToscaGenerator = new ManualVspToscaGenerationService();
+    ToscaServiceModel manualVspToscaServiceModel =
+        vspToscaGenerator.createManualVspToscaServiceModel(vspModelInfo);
+    mdcDataDebugMessage.debugExitMessage(null, null);
+    return manualVspToscaServiceModel;
+  }
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MibManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MibManagerImpl.java
deleted file mode 100644
index 185cfa0..0000000
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MibManagerImpl.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdc.vendorsoftwareproduct.impl;
-
-import org.apache.commons.collections4.MapUtils;
-import org.openecomp.core.enrichment.types.ArtifactType;
-import org.openecomp.core.utilities.CommonMethods;
-import org.openecomp.core.utilities.file.FileContentHandler;
-import org.openecomp.core.utilities.file.FileUtils;
-import org.openecomp.sdc.activityLog.ActivityLogManager;
-import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity;
-import org.openecomp.sdc.common.errors.CoreException;
-import org.openecomp.sdc.common.errors.Messages;
-import org.openecomp.sdc.common.utils.CommonUtil;
-import org.openecomp.sdc.datatypes.error.ErrorLevel;
-import org.openecomp.sdc.datatypes.error.ErrorMessage;
-import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
-import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage;
-import org.openecomp.sdc.logging.types.LoggerConstants;
-import org.openecomp.sdc.logging.types.LoggerErrorCode;
-import org.openecomp.sdc.logging.types.LoggerTragetServiceName;
-import org.openecomp.sdc.vendorsoftwareproduct.MibManager;
-import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.MibDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.MibEntity;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
-import org.openecomp.sdc.vendorsoftwareproduct.errors.MibUploadErrorBuilder;
-import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.MibUploadStatus;
-import org.openecomp.sdc.vendorsoftwareproduct.utils.VendorSoftwareProductUtils;
-import org.openecomp.sdc.versioning.dao.types.Version;
-import org.openecomp.sdc.versioning.errors.VersionableSubEntityNotFoundErrorBuilder;
-import org.openecomp.sdcrests.activitylog.types.ActivityType;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.ByteBuffer;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Optional;
-
-public class MibManagerImpl implements MibManager {
-  private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
-  private ActivityLogManager activityLogManager;
-  private MibDao mibDao;
-
-  public MibManagerImpl(MibDao mibDao,
-                        ActivityLogManager activityLogManager) {
-    this.mibDao = mibDao;
-
-    this.activityLogManager = activityLogManager;
-    mibDao.registerVersioning(
-        VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE);
-  }
-
-  @Override
-  public void delete(String vspId, Version version, String componentId,
-                     ArtifactType artifactType, String user) {
-    mdcDataDebugMessage.debugEntryMessage("VSP id, component id", vspId, componentId);
-
-    MibEntity mibEntity =
-        setValuesForComponentArtifactEntityUpload(vspId, version, null, componentId, null,
-            artifactType, null);
-    Optional<MibEntity> retrieved = mibDao.getByType(mibEntity);
-
-    if (!retrieved.isPresent()) {
-      throw new CoreException(new VersionableSubEntityNotFoundErrorBuilder(
-          mibEntity.getEntityType(),
-          artifactType.name(),
-          VspDetails.ENTITY_TYPE,
-          mibEntity.getFirstClassCitizenId(),
-          version).build());
-    }
-
-    mibDao.delete(retrieved.get());
-
-    mdcDataDebugMessage.debugExitMessage("VSP id, component id", vspId, componentId);
-  }
-
-  @Override
-  public void upload(InputStream object, String filename, String vspId,
-                     Version version, String componentId, ArtifactType artifactType,
-                     String user) {
-    mdcDataDebugMessage.debugEntryMessage("VSP id, component id", vspId, componentId);
-
-    if (object == null) {
-      MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
-          LoggerTragetServiceName.UPLOAD_MIB, ErrorLevel.ERROR.name(),
-          LoggerErrorCode.DATA_ERROR.getErrorCode(), "Invalid MIB zip file");
-      throw new CoreException(new MibUploadErrorBuilder(
-          Messages.NO_ZIP_FILE_WAS_UPLOADED_OR_ZIP_NOT_EXIST.getErrorMessage()).build());
-    } else {
-      Map<String, List<ErrorMessage>> errors = new HashMap<>();
-      try {
-        byte[] uploadedFileData = FileUtils.toByteArray(object);
-        validateMibZipContent(vspId, version, uploadedFileData, errors);
-        if (MapUtils.isNotEmpty(errors)) {
-          MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
-              LoggerTragetServiceName.UPLOAD_MIB, ErrorLevel.ERROR.name(),
-              LoggerErrorCode.DATA_ERROR.getErrorCode(), "Invalid MIB zip file");
-          throw new CoreException(
-              new MibUploadErrorBuilder(errors.values().iterator().next().get(0).getMessage())
-                  .build());
-        }
-
-        createArtifactInDatabase(vspId, version, filename, componentId, artifactType,
-            uploadedFileData);
-
-      } catch (Exception exception) {
-        MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
-            LoggerTragetServiceName.UPLOAD_MIB, ErrorLevel.ERROR.name(),
-            LoggerErrorCode.DATA_ERROR.getErrorCode(), "Invalid MIB zip file");
-        throw new CoreException(new MibUploadErrorBuilder(exception.getMessage()).build());
-      }
-    }
-
-    ActivityLogEntity activityLogEntity =
-        new ActivityLogEntity(vspId, String.valueOf(version.getMajor() + 1),
-            ActivityType.UPLOAD_ARTIFACT.toString(), user, true, "", "");
-    activityLogManager.addActionLog(activityLogEntity, user);
-
-
-    mdcDataDebugMessage.debugExitMessage("VSP id, component id", vspId, componentId);
-  }
-
-  private void createArtifactInDatabase(String vspId, Version version, String filename,
-                                        String componentId, ArtifactType artifactType,
-                                        byte[] uploadedFileData) {
-    String artifactId = CommonMethods.nextUuId();
-    MibEntity mibEntity =
-        setValuesForComponentArtifactEntityUpload(vspId, version, filename, componentId,
-            artifactId, artifactType, uploadedFileData);
-    mibDao.create(mibEntity);
-  }
-
-  @Override
-  public MibUploadStatus listFilenames(String vspId, Version version, String componentId,
-                                       String user) {
-    mdcDataDebugMessage.debugEntryMessage("VSP id, component id", vspId, componentId);
-
-    MibEntity current =
-        new MibEntity(vspId, version, componentId, null);
-
-    mdcDataDebugMessage.debugExitMessage("VSP id, component id", vspId, componentId);
-
-    return setMibUploadStatusValues(current);
-  }
-
-
-  private MibUploadStatus setMibUploadStatusValues(
-      MibEntity mibEntity) {
-    MibUploadStatus mibUploadStatus = new MibUploadStatus();
-
-    Collection<MibEntity> artifactNames =
-        mibDao.list(mibEntity);
-    Map<ArtifactType, String> artifactTypeToFilename =
-        VendorSoftwareProductUtils.filterNonTrapOrPollArtifacts(artifactNames);
-
-    if (MapUtils.isNotEmpty(artifactTypeToFilename)) {
-      if (artifactTypeToFilename.containsKey(ArtifactType.SNMP_TRAP)) {
-        mibUploadStatus.setSnmpTrap(artifactTypeToFilename.get(ArtifactType.SNMP_TRAP));
-      }
-      if (artifactTypeToFilename.containsKey(ArtifactType.SNMP_POLL)) {
-        mibUploadStatus.setSnmpPoll(artifactTypeToFilename.get(ArtifactType.SNMP_POLL));
-      }
-    }
-
-    return mibUploadStatus;
-  }
-
-  private MibEntity setValuesForComponentArtifactEntityUpload(
-      String vspId, Version version, String filename, String componentId, String artifactId,
-      ArtifactType artifactType, byte[] uploadedFileData) {
-
-    MibEntity mibEntity = new MibEntity();
-
-    mibEntity.setVspId(vspId);
-    mibEntity.setVersion(version);
-    mibEntity.setComponentId(componentId);
-    mibEntity.setId(artifactId);
-    mibEntity.setType(artifactType);
-    mibEntity.setArtifactName(filename);
-
-    if (Objects.nonNull(uploadedFileData)) {
-      mibEntity.setArtifact(ByteBuffer.wrap(uploadedFileData));
-    }
-
-    return mibEntity;
-  }
-
-  private void validateMibZipContent(String vspId, Version version, byte[] uploadedFileData,
-                                     Map<String, List<ErrorMessage>> errors) {
-    FileContentHandler contentMap;
-    try {
-      contentMap = CommonUtil.loadUploadFileContent(uploadedFileData);
-      VendorSoftwareProductUtils.validateContentZipData(contentMap, errors);
-    } catch (IOException exception) {
-      MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
-          LoggerTragetServiceName.VALIDATE_MIB, ErrorLevel.ERROR.name(),
-          LoggerErrorCode.DATA_ERROR.getErrorCode(), "Invalid MIB zip file");
-      throw new CoreException(
-          new MibUploadErrorBuilder(vspId, version, Messages.INVALID_ZIP_FILE.getErrorMessage())
-              .build());
-    }
-  }
-}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MibManagerFactoryImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerFactoryImpl.java
similarity index 69%
rename from openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MibManagerFactoryImpl.java
rename to openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerFactoryImpl.java
index 8c887e0..6569312 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MibManagerFactoryImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerFactoryImpl.java
@@ -21,17 +21,17 @@
 package org.openecomp.sdc.vendorsoftwareproduct.impl;
 
 import org.openecomp.sdc.activityLog.ActivityLogManagerFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.MibManager;
-import org.openecomp.sdc.vendorsoftwareproduct.MibManagerFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.MibDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.MonitoringUploadsManager;
+import org.openecomp.sdc.vendorsoftwareproduct.MonitoringUploadsManagerFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.MonitoringUploadDaoFactory;
 
-public class MibManagerFactoryImpl extends MibManagerFactory {
-  private static final MibManager INSTANCE =
-      new MibManagerImpl(MibDaoFactory.getInstance().createInterface(),
+public class MonitoringUploadsManagerFactoryImpl extends MonitoringUploadsManagerFactory {
+  private static final MonitoringUploadsManager INSTANCE =
+      new MonitoringUploadsManagerImpl(MonitoringUploadDaoFactory.getInstance().createInterface(),
           ActivityLogManagerFactory.getInstance().createInterface());
 
   @Override
-  public MibManager createInterface() {
+  public MonitoringUploadsManager createInterface() {
     return INSTANCE;
   }
 }
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerImpl.java
new file mode 100644
index 0000000..73558b4
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerImpl.java
@@ -0,0 +1,269 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.vendorsoftwareproduct.impl;
+
+import org.apache.commons.collections4.MapUtils;
+import org.openecomp.core.enrichment.types.MonitoringUploadType;
+import org.openecomp.core.utilities.CommonMethods;
+import org.openecomp.core.utilities.file.FileContentHandler;
+import org.openecomp.core.utilities.file.FileUtils;
+import org.openecomp.sdc.activityLog.ActivityLogManager;
+import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity;
+import org.openecomp.sdc.common.errors.CoreException;
+import org.openecomp.sdc.common.errors.Messages;
+import org.openecomp.sdc.common.utils.CommonUtil;
+import org.openecomp.sdc.common.utils.SdcCommon;
+import org.openecomp.sdc.datatypes.error.ErrorLevel;
+import org.openecomp.sdc.datatypes.error.ErrorMessage;
+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;
+import org.openecomp.sdc.logging.types.LoggerErrorCode;
+import org.openecomp.sdc.logging.types.LoggerErrorDescription;
+import org.openecomp.sdc.logging.types.LoggerTragetServiceName;
+import org.openecomp.sdc.vendorsoftwareproduct.MonitoringUploadsManager;
+import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentArtifactDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentMonitoringUploadEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
+import org.openecomp.sdc.vendorsoftwareproduct.errors.MonitoringUploadErrorBuilder;
+import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.MonitoringUploadStatus;
+import org.openecomp.sdc.vendorsoftwareproduct.utils.VendorSoftwareProductUtils;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdc.versioning.errors.VersionableSubEntityNotFoundErrorBuilder;
+import org.openecomp.sdcrests.activitylog.types.ActivityType;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.ByteBuffer;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+
+public class MonitoringUploadsManagerImpl implements MonitoringUploadsManager {
+  private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
+  private ActivityLogManager activityLogManager;
+  private ComponentArtifactDao componentArtifactDao;
+  private static final Logger logger =
+      LoggerFactory.getLogger(VendorSoftwareProductManagerImpl.class);
+
+  MonitoringUploadsManagerImpl(ComponentArtifactDao componentArtifactDao,
+                               ActivityLogManager activityLogManager) {
+    this.componentArtifactDao = componentArtifactDao;
+
+    this.activityLogManager = activityLogManager;
+    componentArtifactDao.registerVersioning(
+        VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE);
+  }
+
+  @Override
+  public void delete(String vspId, Version version, String componentId,
+                     MonitoringUploadType monitoringUploadType, String user) {
+    mdcDataDebugMessage.debugEntryMessage("VSP id, component id", vspId, componentId);
+
+    ComponentMonitoringUploadEntity componentMonitoringUploadEntity =
+        setValuesForComponentArtifactEntityUpload(vspId, version, null, componentId, null,
+            monitoringUploadType, null);
+    Optional<ComponentMonitoringUploadEntity> retrieved = componentArtifactDao.getByType(
+        componentMonitoringUploadEntity);
+
+    if (!retrieved.isPresent()) {
+      throw new CoreException(new VersionableSubEntityNotFoundErrorBuilder(
+          componentMonitoringUploadEntity.getEntityType(),
+          monitoringUploadType.name(),
+          VspDetails.ENTITY_TYPE,
+          componentMonitoringUploadEntity.getFirstClassCitizenId(),
+          version).build());
+    }
+
+    componentArtifactDao.delete(retrieved.get());
+
+    mdcDataDebugMessage.debugExitMessage("VSP id, component id", vspId, componentId);
+  }
+
+  @Override
+  public void upload(InputStream object, String filename, String vspId,
+                     Version version, String componentId,
+                     MonitoringUploadType type,
+                     String user) {
+    mdcDataDebugMessage.debugEntryMessage("VSP id, component id", vspId, componentId);
+
+    if (object == null) {
+      MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+          LoggerTragetServiceName.UPLOAD_MONITORING_FILE, ErrorLevel.ERROR.name(),
+          LoggerErrorCode.DATA_ERROR.getErrorCode(), "Invalid " + type
+              .toString() + " zip file");
+      throw new CoreException(new MonitoringUploadErrorBuilder(
+          Messages.NO_ZIP_FILE_WAS_UPLOADED_OR_ZIP_NOT_EXIST.getErrorMessage()).build());
+    } else {
+      Map<String, List<ErrorMessage>> errors = new HashMap<>();
+      try {
+        byte[] uploadedFileData = FileUtils.toByteArray(object);
+        final FileContentHandler upload =
+            validateZip(vspId, version, uploadedFileData, errors);
+        if (type.equals(MonitoringUploadType.VES_EVENTS)) {
+          validateVesEventUpload(upload, errors, vspId, version);
+        }
+        if (MapUtils.isNotEmpty(errors)) {
+          MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+              LoggerTragetServiceName.UPLOAD_MONITORING_FILE, ErrorLevel.ERROR.name(),
+              LoggerErrorCode.DATA_ERROR.getErrorCode(), "Invalid " + type
+                  .toString() + " zip file");
+          throw new CoreException(
+              new MonitoringUploadErrorBuilder(
+                  errors.values().iterator().next().get(0).getMessage())
+                  .build());
+        }
+
+        createArtifactInDatabase(vspId, version, filename, componentId, type,
+            uploadedFileData);
+
+      } catch (Exception exception) {
+        MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+            LoggerTragetServiceName.UPLOAD_MONITORING_FILE, ErrorLevel.ERROR.name(),
+            LoggerErrorCode.DATA_ERROR.getErrorCode(), "Invalid " + type.toString() + "zip file");
+        throw new CoreException(new MonitoringUploadErrorBuilder(exception.getMessage()).build());
+      }
+    }
+
+    ActivityLogEntity activityLogEntity =
+        new ActivityLogEntity(vspId, String.valueOf(version.getMajor() + 1),
+            ActivityType.UPLOAD_MONITORING_FILE.toString(), user, true, "", "");
+    activityLogManager.addActionLog(activityLogEntity, user);
+    logger.audit("Uploaded Monitoring File for component id:" + componentId + " ,vspId:" + vspId);
+
+
+    mdcDataDebugMessage.debugExitMessage("VSP id, component id", vspId, componentId);
+  }
+
+  private void validateVesEventUpload(FileContentHandler upload,
+                                      Map<String, List<ErrorMessage>> errors, String vspId,
+                                      Version version) {
+    if (!CommonUtil.validateAllFilesYml(upload)) {
+      ErrorMessage.ErrorMessageUtil.addMessage(SdcCommon.UPLOAD_FILE, errors)
+          .add(new ErrorMessage(ErrorLevel.ERROR,
+              Messages.VES_ZIP_SHOULD_CONTAIN_YML_ONLY.getErrorMessage()));
+      MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+          LoggerTragetServiceName.VALIDATE_MONITORING_FILE, ErrorLevel.ERROR.name(),
+          LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.INVALID_VES_FILE);
+      throw new CoreException(
+          new MonitoringUploadErrorBuilder(
+              Messages.VES_ZIP_SHOULD_CONTAIN_YML_ONLY.getErrorMessage())
+              .build());
+    }
+  }
+
+  private void createArtifactInDatabase(String vspId, Version version, String filename,
+                                        String componentId,
+                                        MonitoringUploadType type,
+                                        byte[] uploadedFileData) {
+    String artifactId = CommonMethods.nextUuId();
+    ComponentMonitoringUploadEntity componentMonitoringUploadEntity =
+        setValuesForComponentArtifactEntityUpload(vspId, version, filename, componentId,
+            artifactId, type, uploadedFileData);
+    componentArtifactDao.create(componentMonitoringUploadEntity);
+  }
+
+  @Override
+  public MonitoringUploadStatus listFilenames(String vspId, Version version, String componentId,
+                                              String user) {
+    mdcDataDebugMessage.debugEntryMessage("VSP id, component id", vspId, componentId);
+
+    ComponentMonitoringUploadEntity current =
+        new ComponentMonitoringUploadEntity(vspId, version, componentId, null);
+
+    mdcDataDebugMessage.debugExitMessage("VSP id, component id", vspId, componentId);
+
+    return setMonitoringUploadStatusValues(current);
+  }
+
+
+  private MonitoringUploadStatus setMonitoringUploadStatusValues(
+      ComponentMonitoringUploadEntity componentMonitoringUploadEntity) {
+    MonitoringUploadStatus monitoringUploadStatus = new MonitoringUploadStatus();
+
+    Collection<ComponentMonitoringUploadEntity> artifactNames =
+        componentArtifactDao.list(componentMonitoringUploadEntity);
+    Map<MonitoringUploadType, String> artifactTypeToFilename =
+        VendorSoftwareProductUtils.mapArtifactsByType(artifactNames);
+
+    if (MapUtils.isNotEmpty(artifactTypeToFilename)) {
+      if (artifactTypeToFilename.containsKey(MonitoringUploadType.SNMP_TRAP)) {
+        monitoringUploadStatus
+            .setSnmpTrap(artifactTypeToFilename.get(MonitoringUploadType.SNMP_TRAP));
+      }
+      if (artifactTypeToFilename.containsKey(MonitoringUploadType.SNMP_POLL)) {
+        monitoringUploadStatus
+            .setSnmpPoll(artifactTypeToFilename.get(MonitoringUploadType.SNMP_POLL));
+      }
+      if (artifactTypeToFilename.containsKey(MonitoringUploadType.VES_EVENTS)) {
+        monitoringUploadStatus
+            .setVesEvent(artifactTypeToFilename.get(MonitoringUploadType.VES_EVENTS));
+      }
+    }
+
+    return monitoringUploadStatus;
+  }
+
+  private ComponentMonitoringUploadEntity setValuesForComponentArtifactEntityUpload(
+      String vspId, Version version, String filename, String componentId, String artifactId,
+      MonitoringUploadType monitoringUploadType, byte[] uploadedFileData) {
+
+    ComponentMonitoringUploadEntity
+        entity = new ComponentMonitoringUploadEntity();
+
+    entity.setVspId(vspId);
+    entity.setVersion(version);
+    entity.setComponentId(componentId);
+    entity.setId(artifactId);
+    entity.setType(monitoringUploadType);
+    entity.setArtifactName(filename);
+
+    if (Objects.nonNull(uploadedFileData)) {
+      entity.setArtifact(ByteBuffer.wrap(uploadedFileData));
+    }
+
+    return entity;
+  }
+
+  private FileContentHandler validateZip(String vspId, Version version, byte[] uploadedFileData,
+                                         Map<String, List<ErrorMessage>> errors) {
+    FileContentHandler contentMap;
+    try {
+      contentMap = CommonUtil.validateAndUploadFileContent(uploadedFileData);
+      VendorSoftwareProductUtils.validateContentZipData(contentMap, errors);
+    } catch (IOException exception) {
+      MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+          LoggerTragetServiceName.VALIDATE_MONITORING_FILE, ErrorLevel.ERROR.name(),
+          LoggerErrorCode.DATA_ERROR.getErrorCode(), "Invalid Monitoring zip file");
+      throw new CoreException(
+          new MonitoringUploadErrorBuilder(vspId, version,
+              Messages.INVALID_ZIP_FILE.getErrorMessage())
+              .build());
+    }
+    return contentMap;
+  }
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerFactoryImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerFactoryImpl.java
index 1d91170..6110519 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerFactoryImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerFactoryImpl.java
@@ -24,6 +24,7 @@
 import org.openecomp.sdc.vendorsoftwareproduct.NicManager;
 import org.openecomp.sdc.vendorsoftwareproduct.NicManagerFactory;
 import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDaoFactory;
 import org.openecomp.sdc.vendorsoftwareproduct.factory.CompositionEntityDataManagerFactory;
 
 public class NicManagerFactoryImpl extends NicManagerFactory {
@@ -31,7 +32,8 @@
       new NicManagerImpl(
           NicDaoFactory.getInstance().createInterface(),
           CompositionEntityDataManagerFactory.getInstance().createInterface(),
-          NetworkManagerFactory.getInstance().createInterface());
+          NetworkManagerFactory.getInstance().createInterface(),
+          VendorSoftwareProductInfoDaoFactory.getInstance().createInterface());
 
   @Override
   public NicManager createInterface() {
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerImpl.java
index d73e0f5..b196b3f 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerImpl.java
@@ -22,6 +22,7 @@
 
 import org.apache.commons.collections4.CollectionUtils;
 import org.openecomp.sdc.common.errors.CoreException;
+import org.openecomp.sdc.common.errors.ErrorCode;
 import org.openecomp.sdc.datatypes.error.ErrorLevel;
 import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
 import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage;
@@ -31,20 +32,30 @@
 import org.openecomp.sdc.vendorsoftwareproduct.NetworkManager;
 import org.openecomp.sdc.vendorsoftwareproduct.NicManager;
 import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity;
 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity;
 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
 import org.openecomp.sdc.vendorsoftwareproduct.errors.CompositionEditNotAllowedErrorBuilder;
+import org.openecomp.sdc.vendorsoftwareproduct.errors.DeleteNicErrorBuilder;
+import org.openecomp.sdc.vendorsoftwareproduct.errors.DuplicateNicInComponentErrorBuilder;
+import org.openecomp.sdc.vendorsoftwareproduct.errors.NicInternalNetworkErrorBuilder;
+import org.openecomp.sdc.vendorsoftwareproduct.errors.NicNetworkIdNotAllowedExternalNetworkErrorBuilder;
+import org.openecomp.sdc.vendorsoftwareproduct.errors.NotSupportedHeatOnboardMethodErrorBuilder;
 import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionEntityDataManager;
 import org.openecomp.sdc.vendorsoftwareproduct.services.schemagenerator.SchemaGenerator;
 import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse;
 import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireResponse;
 import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityType;
 import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityValidationData;
+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.NicCompositionSchemaInput;
 import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateContext;
 import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateInput;
+import org.openecomp.sdc.vendorsoftwareproduct.utils.VendorSoftwareProductUtils;
 import org.openecomp.sdc.versioning.VersioningUtil;
 import org.openecomp.sdc.versioning.dao.types.Version;
 
@@ -58,13 +69,16 @@
   private NicDao nicDao;
   private CompositionEntityDataManager compositionEntityDataManager;
   private NetworkManager networkManager;
+  private  VendorSoftwareProductInfoDao vspInfoDao;
 
   public NicManagerImpl(NicDao nicDao,
                         CompositionEntityDataManager compositionEntityDataManager,
-                        NetworkManager networkManager) {
+                        NetworkManager networkManager,
+                        VendorSoftwareProductInfoDao vspInfoDao) {
     this.nicDao = nicDao;
     this.compositionEntityDataManager = compositionEntityDataManager;
     this.networkManager = networkManager;
+    this.vspInfoDao = vspInfoDao;
   }
 
   @Override
@@ -96,15 +110,21 @@
 
   @Override
   public NicEntity createNic(NicEntity nic, String user) {
+    NicEntity createdNic = null;
     mdcDataDebugMessage.debugEntryMessage("VSP id, component id", nic.getVspId(),
         nic.getComponentId());
 
-    if (!isManual(nic.getVspId(), nic.getVersion())) {
+    if (!vspInfoDao.isManual(nic.getVspId(), nic.getVersion())) {
+      ErrorCode onboardingMethodUpdateErrorCode = NotSupportedHeatOnboardMethodErrorBuilder
+          .getAddNicNotSupportedHeatOnboardMethodErrorBuilder();
       MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
           LoggerTragetServiceName.CREATE_NIC, ErrorLevel.ERROR.name(),
-          LoggerErrorCode.PERMISSION_ERROR.getErrorCode(), "Can't create nic");
-      throw new CoreException(
-          new CompositionEditNotAllowedErrorBuilder(nic.getVspId(), nic.getVersion()).build());
+          LoggerErrorCode.PERMISSION_ERROR.getErrorCode(),
+          onboardingMethodUpdateErrorCode.message());
+      throw new CoreException(onboardingMethodUpdateErrorCode);
+    } else {
+      validateNic(nic, user);
+      createdNic = createNic(nic);
     }
 
     //nicDao.updateVspLatestModificationTime(nic.getVspId(), nic.getVersion());
@@ -112,7 +132,63 @@
     mdcDataDebugMessage
         .debugExitMessage("VSP id, component id", nic.getVspId(), nic.getComponentId());
 
-    return null;
+    return createdNic;
+  }
+
+  private NicEntity createNic(NicEntity nic) {
+    return compositionEntityDataManager.createNic(nic);
+  }
+
+  private void validateNic(NicEntity nic, String user) {
+    Collection<NicEntity> listNics = listNics(nic.getVspId(), nic.getVersion(), nic
+        .getComponentId(), user);
+    String networkId = nic.getNicCompositionData().getNetworkId();
+    NetworkType networkType = nic.getNicCompositionData().getNetworkType();
+    String networkDescription = nic.getNicCompositionData().getNetworkDescription();
+    listNics.forEach(nicEntity -> {
+      Nic nicdata = nicEntity.getNicCompositionData();
+      if (nic.getNicCompositionData().getName().equalsIgnoreCase(nicdata.getName())) {
+        final ErrorCode duplicateNicInComponentErrorBuilder =
+            new DuplicateNicInComponentErrorBuilder(nic.getNicCompositionData().getName(),
+                nic.getComponentId()).build();
+        MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+            LoggerTragetServiceName.CREATE_NIC, ErrorLevel.ERROR.name(),
+            LoggerErrorCode.DATA_ERROR.getErrorCode(),
+            duplicateNicInComponentErrorBuilder.message());
+        throw new CoreException(duplicateNicInComponentErrorBuilder);
+      }
+
+    });
+
+    if (networkType.equals(NetworkType.Internal)) {
+      if (!(networkId == null || networkId.equals(""))) {
+        //NetworkEntity ne = getNetwork(nic.getVspId(), activeVersion, networkId);
+        final CompositionEntityResponse<Network> network =
+            networkManager.getNetwork(nic.getVspId(), nic.getVersion(), networkId,
+                user);
+      }
+
+      if (!(networkDescription == null || networkDescription.equals(""))) {
+        final ErrorCode nicNetworkDescriptionErrorBuilder =
+            new NicInternalNetworkErrorBuilder()
+                .getNetworkDescriptionInternalNetworkErrorBuilder();
+        MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+            LoggerTragetServiceName.CREATE_NIC, ErrorLevel.ERROR.name(),
+            LoggerErrorCode.DATA_ERROR.getErrorCode(), nicNetworkDescriptionErrorBuilder.message());
+        throw new CoreException(nicNetworkDescriptionErrorBuilder);
+      }
+
+    } else if (networkType.equals(NetworkType.External)) {
+      if (!(networkId == null || networkId.equals(""))) {
+        final ErrorCode nicNetworkIdNotAllowedExternalNetworkErrorBuilder =
+            new NicNetworkIdNotAllowedExternalNetworkErrorBuilder().build();
+        MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+            LoggerTragetServiceName.CREATE_NIC, ErrorLevel.ERROR.name(),
+            LoggerErrorCode.DATA_ERROR.getErrorCode(),
+            nicNetworkIdNotAllowedExternalNetworkErrorBuilder.message());
+        throw new CoreException(nicNetworkIdNotAllowedExternalNetworkErrorBuilder);
+      }
+    }
   }
 
   @Override
@@ -125,7 +201,7 @@
     Nic nic = nicEntity.getNicCompositionData();
 
     NicCompositionSchemaInput schemaInput = new NicCompositionSchemaInput();
-    schemaInput.setManual(isManual(vspId, version));
+    schemaInput.setManual(vspInfoDao.isManual(vspId, version));
     schemaInput.setNic(nic);
     Map<String, String> networksNameById = listNetworksNameById(vspId, version, user);
     nic.setNetworkName(networksNameById.get(nic.getNetworkId()));
@@ -157,15 +233,20 @@
     mdcDataDebugMessage
         .debugEntryMessage("VSP id, component id", vspId, componentId, nicId);
 
-    if (!isManual(vspId, version)) {
+    if (!vspInfoDao.isManual(vspId, version)) {
+      final ErrorCode deleteNicErrorBuilder =
+          new DeleteNicErrorBuilder().getDeleteNicForHeatOnboardedVspErrorBuilder();
       MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
           LoggerTragetServiceName.DELETE_NIC, ErrorLevel.ERROR.name(),
-          LoggerErrorCode.PERMISSION_ERROR.getErrorCode(), "Can't delete nic");
-      throw new CoreException(
-          new CompositionEditNotAllowedErrorBuilder(vspId, version).build());
+          LoggerErrorCode.PERMISSION_ERROR.getErrorCode(),
+          deleteNicErrorBuilder.message());
+      throw new CoreException(deleteNicErrorBuilder);
     }
 
-    //nicDao.updateVspLatestModificationTime(vspId, version);
+    NicEntity nicEntity = getNic(vspId, version, componentId, nicId);
+    if (nicEntity != null) {
+      nicDao.delete(nicEntity);
+    }
 
     mdcDataDebugMessage
         .debugExitMessage("VSP id, component id", vspId, componentId, nicId);
@@ -181,7 +262,7 @@
         getNic(nic.getVspId(), nic.getVersion(), nic.getComponentId(), nic.getId());
 
     NicCompositionSchemaInput schemaInput = new NicCompositionSchemaInput();
-    schemaInput.setManual(isManual(nic.getVspId(), nic.getVersion()));
+    schemaInput.setManual(vspInfoDao.isManual(nic.getVspId(), nic.getVersion()));
     schemaInput.setNic(retrieved.getNicCompositionData());
 
     CompositionEntityValidationData validationData = compositionEntityDataManager
@@ -244,7 +325,7 @@
   }
   // todo *************************** move to reusable place! *************************
 
-  private boolean isManual(String vspId, Version version) {
+  /*private boolean isManual(String vspId, Version version) {
     return false;
-  }
+  }*/
 }
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerFactoryImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerFactoryImpl.java
index 77d496f..b5464e5 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerFactoryImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerFactoryImpl.java
@@ -22,12 +22,11 @@
 
 import org.openecomp.core.model.dao.ServiceModelDaoFactory;
 import org.openecomp.sdc.activityLog.ActivityLogManagerFactory;
-import org.openecomp.sdc.activitylog.dao.ActivityLogDaoFactory;
 import org.openecomp.sdc.healing.factory.HealingManagerFactory;
 import org.openecomp.sdc.vendorsoftwareproduct.OrchestrationTemplateCandidateManager;
 import org.openecomp.sdc.vendorsoftwareproduct.OrchestrationTemplateCandidateManagerFactory;
 import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDaoFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.MibDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.MonitoringUploadDaoFactory;
 import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDaoFactory;
 import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDaoFactory;
 import org.openecomp.sdc.vendorsoftwareproduct.dao.ProcessDaoFactory;
@@ -51,7 +50,7 @@
           CompositionEntityDataManagerFactory.getInstance().createInterface(),
           NicDaoFactory.getInstance().createInterface(),
           ComponentDaoFactory.getInstance().createInterface(),
-          MibDaoFactory.getInstance().createInterface(),
+          MonitoringUploadDaoFactory.getInstance().createInterface(),
           ProcessDaoFactory.getInstance().createInterface(),
           ActivityLogManagerFactory.getInstance().createInterface());
 
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImpl.java
index 99a438f..959cf15 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImpl.java
@@ -19,14 +19,12 @@
  */
 
 package org.openecomp.sdc.vendorsoftwareproduct.impl;
-import static org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants.GENERAL_COMPONENT_ID;
-import static org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants.UniqueValues
-    .PROCESS_NAME;
+
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.collections4.MapUtils;
-import org.apache.xalan.xslt.Process;
 import org.openecomp.core.model.dao.ServiceModelDao;
 import org.openecomp.core.model.types.ServiceElement;
+import org.openecomp.core.translator.datatypes.TranslatorOutput;
 import org.openecomp.core.util.UniqueValueUtil;
 import org.openecomp.core.utilities.file.FileContentHandler;
 import org.openecomp.core.utilities.file.FileUtils;
@@ -55,14 +53,16 @@
 import org.openecomp.sdc.translator.services.heattotosca.HeatToToscaUtil;
 import org.openecomp.sdc.validation.util.ValidationManagerUtil;
 import org.openecomp.sdc.vendorsoftwareproduct.OrchestrationTemplateCandidateManager;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentArtifactDao;
 import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.MibDao;
 import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDao;
 import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDao;
 import org.openecomp.sdc.vendorsoftwareproduct.dao.ProcessDao;
 import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao;
 import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.MibEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentMonitoringUploadEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity;
 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateCandidateData;
 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity;
 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.UploadData;
@@ -79,24 +79,25 @@
 import org.openecomp.sdc.vendorsoftwareproduct.utils.VendorSoftwareProductUtils;
 import org.openecomp.sdc.versioning.dao.types.Version;
 import org.openecomp.sdcrests.activitylog.types.ActivityType;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity;
+
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.nio.ByteBuffer;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
-import java.util.Collection;
+
+import static org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants.GENERAL_COMPONENT_ID;
+import static org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants.UniqueValues.PROCESS_NAME;
 
 public class OrchestrationTemplateCandidateManagerImpl
     implements OrchestrationTemplateCandidateManager {
-  private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
   private static final Logger logger =
       LoggerFactory.getLogger(OrchestrationTemplateCandidateManagerImpl.class);
-
+  private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
   private VendorSoftwareProductDao vendorSoftwareProductDao;
   private VendorSoftwareProductInfoDao vspInfoDao;
   private OrchestrationTemplateDao orchestrationTemplateDataDao;
@@ -107,10 +108,27 @@
   private CompositionEntityDataManager compositionEntityDataManager;
   private NicDao nicDao;
   private ComponentDao componentDao;
-  private MibDao mibDao;
+  private ComponentArtifactDao componentArtifactDao;
   private ActivityLogManager activityLogManager;
   private ProcessDao processDao;
 
+  /**
+   * Instantiates a new Orchestration template candidate manager.
+   *
+   * @param vendorSoftwareProductDao     the vendor software product dao
+   * @param vspInfoDao                   the vsp info dao
+   * @param orchestrationTemplateDataDao the orchestration template data dao
+   * @param candidateService             the candidate service
+   * @param healingManager               the healing manager
+   * @param compositionDataExtractor     the composition data extractor
+   * @param serviceModelDao              the service model dao
+   * @param compositionEntityDataManager the composition entity data manager
+   * @param nicDao                       the nic dao
+   * @param componentDao                 the component dao
+   * @param componentArtifactDao                       the mib dao
+   * @param processDao                   the process dao
+   * @param activityLogManager           the activity log manager
+   */
   public OrchestrationTemplateCandidateManagerImpl(
       VendorSoftwareProductDao vendorSoftwareProductDao, VendorSoftwareProductInfoDao
       vspInfoDao,
@@ -121,7 +139,7 @@
       CompositionEntityDataManager compositionEntityDataManager,
       NicDao nicDao,
       ComponentDao componentDao,
-      MibDao mibDao,
+      ComponentArtifactDao componentArtifactDao,
       ProcessDao processDao,
       ActivityLogManager activityLogManager) {
     this.vendorSoftwareProductDao = vendorSoftwareProductDao;
@@ -134,7 +152,7 @@
     this.compositionEntityDataManager = compositionEntityDataManager;
     this.nicDao = nicDao;
     this.componentDao = componentDao;
-    this.mibDao = mibDao;
+    this.componentArtifactDao = componentArtifactDao;
     this.processDao = processDao;
     this.activityLogManager = activityLogManager;
   }
@@ -237,38 +255,43 @@
     String manifest = candidateService.createManifest(vspDetails, structure);
     fileContentMap.addFile(SdcCommon.MANIFEST_NAME, manifest.getBytes());
 
-    HeatStructureTree tree = createAndValidateHeatTree(response, fileContentMap);
-
     Optional<ByteArrayInputStream> zipByteArrayInputStream = candidateService
         .fetchZipFileByteArrayInputStream(vspId, candidateDataEntity, manifest, uploadErrors);
     if (!zipByteArrayInputStream.isPresent()) {
       return response;
     }
-    Map<String,String> componentsQustanniare = new HashMap<>();
-    Map<String, Map<String, String>> componentNicsQustanniare = new HashMap<>();
-    Map<String, Collection<MibEntity>> componentMIBList = new HashMap<>();
+
+    HeatStructureTree tree = createAndValidateHeatTree(response, fileContentMap);
+
+    Map<String, String> componentsQuestionnaire = new HashMap<>();
+    Map<String, Map<String, String>> componentNicsQuestionnaire = new HashMap<>();
+    Map<String, Collection<ComponentMonitoringUploadEntity>> componentMibList = new HashMap<>();
     Map<String, Collection<ProcessEntity>> processes = new HashMap<>();
     Map<String, ProcessEntity> processArtifact = new HashMap<>();
 
-    backupComponentsQuestionnaireBeforeDelete(vspId, version, componentsQustanniare,
-        componentNicsQustanniare, componentMIBList, processes, processArtifact);
+    backupComponentsQuestionnaireBeforeDelete(vspId, version, componentsQuestionnaire,
+        componentNicsQuestionnaire, componentMibList, processes, processArtifact);
 
     deleteUploadDataAndContent(vspId, version);
     saveHotData(vspId, version, zipByteArrayInputStream.get(), fileContentMap, tree);
 
-    ToscaServiceModel toscaServiceModel =
-        HeatToToscaUtil.loadAndTranslateTemplateData(fileContentMap)
-            .getToscaServiceModel();
+    TranslatorOutput translatorOutput =
+        HeatToToscaUtil.loadAndTranslateTemplateData(fileContentMap);
+    ToscaServiceModel toscaServiceModel = translatorOutput.getToscaServiceModel();
     if (toscaServiceModel != null) {
       serviceModelDao.storeServiceModel(vspId, version, toscaServiceModel);
+      //Extracting the compostion data from the output service model of the first phase of
+      // translation
       compositionEntityDataManager.saveCompositionData(vspId, version,
-          compositionDataExtractor.extractServiceCompositionData(toscaServiceModel));
-      retainComponentQuestionnaireData(vspId, version, componentsQustanniare,
-          componentNicsQustanniare, componentMIBList, processes, processArtifact);
+          compositionDataExtractor.extractServiceCompositionData(translatorOutput
+              .getNonUnifiedToscaServiceModel()));
+      retainComponentQuestionnaireData(vspId, version, componentsQuestionnaire,
+          componentNicsQuestionnaire, componentMibList, processes, processArtifact);
     }
     uploadFileResponse.addStructureErrors(uploadErrors);
 
-    ActivityLogEntity activityLogEntity = new ActivityLogEntity(vspId,  String.valueOf(version.getMajor()+1),
+    ActivityLogEntity activityLogEntity =
+        new ActivityLogEntity(vspId, String.valueOf(version.getMajor() + 1),
             ActivityType.UPLOAD_HEAT.toString(), user, true, "", "");
     activityLogManager.addActionLog(activityLogEntity, user);
 
@@ -367,9 +390,10 @@
 
   private void retainComponentQuestionnaireData(String vspId, Version activeVersion,
                                                 Map<String, String> componentsQustanniare,
-                                                Map<String, Map<String, String>> componentNicsQustanniare,
-                                                Map<String, Collection<MibEntity>> componentMIBList,
-                                                Map<String,Collection<ProcessEntity>> processes,
+                                                Map<String, Map<String, String>>
+                                                    componentNicsQustanniare,
+                                                Map<String, Collection<ComponentMonitoringUploadEntity>> componentMibList,
+                                                Map<String, Collection<ProcessEntity>> processes,
                                                 Map<String, ProcessEntity> processArtifact) {
     //VSP processes
     restoreProcess(vspId, activeVersion, GENERAL_COMPONENT_ID, GENERAL_COMPONENT_ID, processes,
@@ -378,27 +402,31 @@
         components = vendorSoftwareProductDao.listComponents(vspId, activeVersion);
     components.forEach(componentEntity -> {
       String componentName = componentEntity.getComponentCompositionData().getName();
-      if( componentsQustanniare.containsKey(componentName) ){
+      if (componentsQustanniare.containsKey(componentName)) {
         componentDao.updateQuestionnaireData(vspId, activeVersion,
-            componentEntity.getId(),componentsQustanniare.get(componentEntity.getComponentCompositionData()
+            componentEntity.getId(),
+            componentsQustanniare.get(componentEntity.getComponentCompositionData()
                 .getName()));
-        if( componentNicsQustanniare.containsKey(componentName) ){
-          Map<String, String> nicsQustanniare=componentNicsQustanniare.get(componentName);
+        if (componentNicsQustanniare.containsKey(componentName)) {
+          Map<String, String> nicsQustanniare = componentNicsQustanniare.get(componentName);
           Collection<NicEntity>
-              nics=nicDao.list(new NicEntity(vspId, activeVersion, componentEntity.getId(), null));
-              nics.forEach(nicEntity -> {
-            if(nicsQustanniare.containsKey(nicEntity.getNicCompositionData().getName())){
-              nicDao.updateQuestionnaireData(vspId, activeVersion,componentEntity.getId
-                  (),nicEntity.getId(),nicsQustanniare.get(nicEntity.getNicCompositionData().getName()));
+              nics =
+              nicDao.list(new NicEntity(vspId, activeVersion, componentEntity.getId(), null));
+          nics.forEach(nicEntity -> {
+            if (nicsQustanniare.containsKey(nicEntity.getNicCompositionData().getName())) {
+              nicDao.updateQuestionnaireData(vspId, activeVersion,
+                  componentEntity.getId(), nicEntity.getId(),
+                  nicsQustanniare.get(nicEntity.getNicCompositionData().getName()));
             }
           });
         }
-        //MIB
-        if(componentMIBList.containsKey(componentName)) {
-          Collection<MibEntity> mibList = componentMIBList.get(componentName);
+        //MIB //todo add for VES_EVENTS
+        if (componentMibList.containsKey(componentName)) {
+          Collection<ComponentMonitoringUploadEntity> mibList =
+              componentMibList.get(componentName);
           mibList.forEach(mib -> {
             mib.setComponentId(componentEntity.getId());
-            mibDao.create(mib);
+            componentArtifactDao.create(mib);
           });
         }
         //VFC processes
@@ -411,43 +439,47 @@
   private void backupComponentsQuestionnaireBeforeDelete(String vspId, Version activeVersion,
                                                          Map<String, String> componentsQustanniare,
                                                          Map<String, Map<String, String>>
-                                                             componentNicsQustanniare,
-                                                         Map<String, Collection<MibEntity>>
-                                                             componentMIBList,
-                                                         Map<String, Collection<ProcessEntity>> componentProcesses,
+                                                           componentNicsQustanniare,
+                                                         Map<String, Collection<ComponentMonitoringUploadEntity>>
+                                                           componentMibList,
+                                                         Map<String, Collection<ProcessEntity>>
+                                                             componentProcesses,
                                                          Map<String, ProcessEntity> processArtifact) {
     //backup VSP processes
     backupProcess(vspId, activeVersion, GENERAL_COMPONENT_ID, GENERAL_COMPONENT_ID,
-        componentProcesses,processArtifact);
-    Collection<ComponentEntity> componentsCompositionAndQuestionnaire= vendorSoftwareProductDao
+        componentProcesses, processArtifact);
+    Collection<ComponentEntity> componentsCompositionAndQuestionnaire = vendorSoftwareProductDao
         .listComponentsCompositionAndQuestionnaire(vspId,
             activeVersion);
-    componentsCompositionAndQuestionnaire.forEach(componentEntity ->{
-      String componentName=componentEntity.getComponentCompositionData().getName();
-      componentsQustanniare.put(componentName,componentEntity
+    componentsCompositionAndQuestionnaire.forEach(componentEntity -> {
+      String componentName = componentEntity.getComponentCompositionData().getName();
+      componentsQustanniare.put(componentName, componentEntity
           .getQuestionnaireData());
       Collection<NicEntity>
-          nics=nicDao.list(new NicEntity(vspId, activeVersion,componentEntity.getId(),null));
+          nics = nicDao.list(new NicEntity(vspId, activeVersion, componentEntity.getId(), null));
       //backup mib
-      Collection<MibEntity> componentMIB = mibDao.listArtifacts(new
-          MibEntity(vspId, activeVersion, componentEntity.getId(), null));
-      if(CollectionUtils.isNotEmpty(componentMIB)){
-        componentMIBList.put(componentName,componentMIB);
+      Collection<ComponentMonitoringUploadEntity> componentMib =
+          componentArtifactDao.listArtifacts(new
+              ComponentMonitoringUploadEntity(vspId, activeVersion, componentEntity.getId(),
+              null));
+      if(CollectionUtils.isNotEmpty(componentMib)){
+        componentMibList.put(componentName,componentMib);
       }
 
       //backup component processes
       backupProcess(vspId, activeVersion, componentEntity.getId(), componentName,
-          componentProcesses,processArtifact);
-      if(CollectionUtils.isNotEmpty(nics)) {
+          componentProcesses, processArtifact);
+      if (CollectionUtils.isNotEmpty(nics)) {
         Map<String, String> nicsQustanniare = new HashMap<>();
         nics.forEach(nicEntity -> {
-           NicEntity nic = nicDao.get(new NicEntity(vspId, activeVersion, componentEntity.getId(),
-           nicEntity.getId()));
-          NicEntity nicQuestionnaire = nicDao.getQuestionnaireData(vspId,activeVersion,
-              componentEntity.getId(),nicEntity.getId());
+          NicEntity nic = nicDao.get(new NicEntity(vspId, activeVersion, componentEntity.getId(),
+              nicEntity.getId()));
+          NicEntity nicQuestionnaire = nicDao.getQuestionnaireData(vspId, activeVersion,
+              componentEntity.getId(), nicEntity.getId());
 
           nicsQustanniare
-              .put(nicEntity.getNicCompositionData().getName(), nicQuestionnaire.getQuestionnaireData());
+              .put(nicEntity.getNicCompositionData().getName(),
+                  nicQuestionnaire.getQuestionnaireData());
         });
         componentNicsQustanniare.put(componentName, nicsQustanniare);
       }
@@ -456,17 +488,18 @@
 
   private void backupProcess(String vspId, Version activeVersion, String componentId,
                              String componentName, Map<String,
-                             Collection<ProcessEntity>> processes,
-                             Map<String,ProcessEntity> processArtifact){
+      Collection<ProcessEntity>> processes,
+                             Map<String, ProcessEntity> processArtifact) {
     Collection<ProcessEntity> processList = vendorSoftwareProductDao.listProcesses(vspId,
         activeVersion, componentId);
-    if(!processList.isEmpty()){
-      processes.put(componentName,processList);
+    if (!processList.isEmpty()) {
+      processes.put(componentName, processList);
       processList.forEach(process -> {
         //ProcessArtifactEntity artifact = vendorSoftwareProductDao.getProcessArtifact(vspId,
         //    activeVersion, componentId, process.getId());
-        ProcessEntity artifact = processDao.get(new ProcessEntity(vspId,activeVersion,componentId,process.getId()));
-        if(artifact.getArtifact()!=null) {
+        ProcessEntity artifact =
+            processDao.get(new ProcessEntity(vspId, activeVersion, componentId, process.getId()));
+        if (artifact.getArtifact() != null) {
           processArtifact.put(process.getId(), artifact);
         }
       });
@@ -474,9 +507,10 @@
   }
 
   private void restoreProcess(String vspId, Version activeVersion, String componentId,
-                              String componentName, Map<String, Collection<ProcessEntity>> processes,
-                              Map<String, ProcessEntity> processArtifact){
-    if(processes.containsKey(componentName)) {
+                              String componentName,
+                              Map<String, Collection<ProcessEntity>> processes,
+                              Map<String, ProcessEntity> processArtifact) {
+    if (processes.containsKey(componentName)) {
       Collection<ProcessEntity> processList = processes.get(componentName);
       processList.forEach(process -> {
         //Reatin VFC process
@@ -550,7 +584,7 @@
                                                         byte[] uploadedFileData) {
     FileContentHandler contentMap = null;
     try {
-      contentMap = CommonUtil.loadUploadFileContent(uploadedFileData);
+      contentMap = CommonUtil.validateAndUploadFileContent(uploadedFileData);
     } catch (IOException exception) {
       uploadFileResponse.addStructureError(
           SdcCommon.UPLOAD_FILE,
@@ -574,7 +608,7 @@
     return healingParams;
   }
 
-  public VspDetails getVspDetails(String vspId, Version version) {
+  private VspDetails getVspDetails(String vspId, Version version) {
     VspDetails vspDetails = vspInfoDao.get(new VspDetails(vspId, version));
     vspDetails.setValidationData(orchestrationTemplateDataDao.getValidationData(vspId, version));
     return vspDetails;
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ProcessManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ProcessManagerImpl.java
index 4fa67ff..339e05c 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ProcessManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ProcessManagerImpl.java
@@ -225,7 +225,7 @@
     vendorSoftwareProductDao.uploadProcessArtifact(vspId, version, componentId, processId, artifact,
             artifactFileName);
     ActivityLogEntity activityLogEntity = new ActivityLogEntity(vspId, String.valueOf(version.getMajor()+1),
-            ActivityType.UPLOAD_ARTIFACT.toString(), user, true, "", "");
+        ActivityType.UPLOAD_MONITORING_FILE.toString(), user, true, "", "");
     activityLogManager.addActionLog(activityLogEntity, user);
 
     mdcDataDebugMessage.debugExitMessage("VSP id, component id", vspId, componentId);
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java
index 9950445..0b48c33 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java
@@ -42,6 +42,7 @@
 import org.openecomp.sdc.common.utils.SdcCommon;
 import org.openecomp.sdc.datatypes.error.ErrorLevel;
 import org.openecomp.sdc.datatypes.error.ErrorMessage;
+import org.openecomp.sdc.generator.datatypes.tosca.VspModelInfo;
 import org.openecomp.sdc.healing.api.HealingManager;
 import org.openecomp.sdc.logging.api.Logger;
 import org.openecomp.sdc.logging.api.LoggerFactory;
@@ -56,8 +57,11 @@
 import org.openecomp.sdc.validation.util.ValidationManagerUtil;
 import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade;
 import org.openecomp.sdc.vendorlicense.licenseartifacts.VendorLicenseArtifactsService;
+import org.openecomp.sdc.vendorsoftwareproduct.ManualVspToscaManager;
 import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants;
 import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductManager;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.DeploymentFlavorDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDao;
 import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDao;
 import org.openecomp.sdc.vendorsoftwareproduct.dao.PackageInfoDao;
 import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao;
@@ -65,15 +69,22 @@
 import org.openecomp.sdc.vendorsoftwareproduct.dao.errors.VendorSoftwareProductNotFoundErrorBuilder;
 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.PackageInfo;
 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.UploadDataEntity;
 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspQuestionnaireEntity;
 import org.openecomp.sdc.vendorsoftwareproduct.errors.ComponentDependencyModelErrorBuilder;
+import org.openecomp.sdc.vendorsoftwareproduct.errors.ComponentErrorBuilder;
 import org.openecomp.sdc.vendorsoftwareproduct.errors.CreatePackageForNonFinalVendorSoftwareProductErrorBuilder;
+import org.openecomp.sdc.vendorsoftwareproduct.errors.DeploymentFlavorErrorBuilder;
 import org.openecomp.sdc.vendorsoftwareproduct.errors.FileCreationErrorBuilder;
 import org.openecomp.sdc.vendorsoftwareproduct.errors.InformationArtifactCreationErrorBuilder;
+import org.openecomp.sdc.vendorsoftwareproduct.errors.NicInternalNetworkErrorBuilder;
+import org.openecomp.sdc.vendorsoftwareproduct.errors.OnboardingMethodErrorBuilder;
 import org.openecomp.sdc.vendorsoftwareproduct.errors.PackageInvalidErrorBuilder;
 import org.openecomp.sdc.vendorsoftwareproduct.errors.PackageNotFoundErrorBuilder;
 import org.openecomp.sdc.vendorsoftwareproduct.errors.TranslationFileCreationErrorBuilder;
@@ -82,12 +93,18 @@
 import org.openecomp.sdc.vendorsoftwareproduct.informationArtifact.InformationArtifactGenerator;
 import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionEntityDataManager;
 import org.openecomp.sdc.vendorsoftwareproduct.services.schemagenerator.SchemaGenerator;
+import org.openecomp.sdc.vendorsoftwareproduct.types.ComponentValidationResult;
+import org.openecomp.sdc.vendorsoftwareproduct.types.DeploymentFlavorValidationResult;
 import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireResponse;
 import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireValidationResult;
 import org.openecomp.sdc.vendorsoftwareproduct.types.ValidationResponse;
 import org.openecomp.sdc.vendorsoftwareproduct.types.VersionedVendorSoftwareProductInfo;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentComputeAssociation;
 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.DeploymentFlavor;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.NetworkType;
 import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic;
 import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.ComponentQuestionnaireSchemaInput;
 import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateContext;
@@ -115,8 +132,10 @@
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.zip.ZipInputStream;
 import java.util.zip.ZipOutputStream;
 
@@ -141,8 +160,29 @@
   private InformationArtifactGenerator informationArtifactGenerator;
   private PackageInfoDao packageInfoDao;
   private ActivityLogManager activityLogManager;
+  private DeploymentFlavorDao deploymentFlavorDao;
+  private NicDao nicDao;
+  private ManualVspToscaManager manualVspToscaManager;
 
-
+  /**
+   * Instantiates a new Vendor software product manager.
+   *
+   * @param versioningManager            the versioning manager
+   * @param vendorSoftwareProductDao     the vendor software product dao
+   * @param orchestrationTemplateDataDao the orchestration template data dao
+   * @param vspInfoDao                   the vsp info dao
+   * @param vendorLicenseFacade          the vendor license facade
+   * @param serviceModelDao              the service model dao
+   * @param enrichedServiceModelDao      the enriched service model dao
+   * @param healingManager               the healing manager
+   * @param licenseArtifactsService      the license artifacts service
+   * @param compositionEntityDataManager the composition entity data manager
+   * @param informationArtifactGenerator the information artifact generator
+   * @param packageInfoDao               the package info dao
+   * @param activityLogManager           the activity log manager
+   * @param deploymentFlavorDao          the deployment flavor dao
+   * @param nicDao                       the nic dao
+   */
   public VendorSoftwareProductManagerImpl(
       VersioningManager versioningManager,
       VendorSoftwareProductDao vendorSoftwareProductDao,
@@ -155,7 +195,10 @@
       VendorLicenseArtifactsService licenseArtifactsService,
       InformationArtifactGenerator informationArtifactGenerator,
       PackageInfoDao packageInfoDao,
-      ActivityLogManager activityLogManager) {
+      ActivityLogManager activityLogManager,
+      DeploymentFlavorDao deploymentFlavorDao,
+      NicDao nicDao,
+      ManualVspToscaManager manualVspToscaManager) {
     this.versioningManager = versioningManager;
     this.vendorSoftwareProductDao = vendorSoftwareProductDao;
     this.orchestrationTemplateDao = orchestrationTemplateDataDao;
@@ -168,6 +211,9 @@
     this.informationArtifactGenerator = informationArtifactGenerator;
     this.packageInfoDao = packageInfoDao;
     this.activityLogManager = activityLogManager;
+    this.deploymentFlavorDao = deploymentFlavorDao;
+    this.nicDao = nicDao;
+    this.manualVspToscaManager = manualVspToscaManager;
 
     registerToVersioning();
   }
@@ -276,8 +322,20 @@
     validationResponse
         .setUploadDataErrors(validateUploadData(uploadData), LoggerServiceName.Submit_VSP,
             LoggerTragetServiceName.SUBMIT_VSP);
+
     validationResponse.setQuestionnaireValidationResult(
-        validateQuestionnaire(vspDetails.getId(), vspDetails.getVersion()));
+        validateQuestionnaire(vspDetails.getId(), vspDetails.getVersion(), vspDetails
+            .getOnboardingMethod()));
+
+    if (vspDetails.getOnboardingMethod().equals("Manual")) {
+      validationResponse.setDeploymentFlavorValidationResult(
+          deploymentFlavorValidation(vspDetails.getId(), vspDetails.getVersion()));
+      validationResponse.setComponentValidationResult(
+          componentValidation(vspDetails.getId(), vspDetails.getVersion()));
+      //Generate Tosca service model for Manual Onboarding flow
+      VspModelInfo vspModelInfo = manualVspToscaManager.gatherVspInformation(vspId, version, user);
+      serviceModel = manualVspToscaManager.generateToscaModel(vspModelInfo);
+    }
 
     validationResponse.setCompilationErrors(
         compile(vspId, vspDetails.getVersion(), serviceModel),
@@ -294,7 +352,6 @@
     }
 
     mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
-
     return validationResponse;
   }
 
@@ -310,43 +367,199 @@
     return dependencyTracker.isCyclicDependencyPresent();
   }
 
-  private static List<ErrorCode> validateCompletedVendorSoftwareProduct(
+  private DeploymentFlavorValidationResult deploymentFlavorValidation(String vspId,
+                                                                      Version version) {
+    mdcDataDebugMessage.debugEntryMessage("VSP id", vspId);
+    Set<CompositionEntityValidationData> validationData = new HashSet<>();
+    Collection<DeploymentFlavorEntity> deploymentFlavors =
+        vendorSoftwareProductDao.listDeploymentFlavors(vspId, version);
+    if (!CollectionUtils.isEmpty(deploymentFlavors)) {
+      deploymentFlavors.forEach(deploymentFlavor -> {
+        DeploymentFlavorEntity deployment = vendorSoftwareProductDao.getDeploymentFlavor(vspId,
+            version, deploymentFlavor.getId());
+        DeploymentFlavor deploymentlocalFlavor = deployment.getDeploymentFlavorCompositionData();
+        if (deploymentlocalFlavor != null) {
+          if (deploymentlocalFlavor.getFeatureGroupId() == null ) {
+            ErrorCode deploymentFlavorErrorBuilder = DeploymentFlavorErrorBuilder.
+                getFeatureGroupMandatoryErrorBuilder();
+            CompositionEntityValidationData compositionEntityValidationData = new
+                CompositionEntityValidationData(CompositionEntityType.deployment,
+                deploymentFlavor.getId());
+            compositionEntityValidationData.setEntityName(deploymentlocalFlavor.getModel());
+            List<String> errors = new ArrayList<>();
+            errors.add(deploymentFlavorErrorBuilder.message());
+            compositionEntityValidationData.setErrors(errors);
+            validationData.add(compositionEntityValidationData);
+          }
+          List<ComponentComputeAssociation> componetComputeAssociations = new ArrayList<>();
+          componetComputeAssociations = deploymentlocalFlavor.getComponentComputeAssociations();
+          if (CollectionUtils.isEmpty(componetComputeAssociations)) {
+            CompositionEntityValidationData compositionEntityValidationData = new
+                CompositionEntityValidationData(CompositionEntityType.deployment,deploymentFlavor
+                .getId());
+            compositionEntityValidationData.setEntityName(deployment
+                .getDeploymentFlavorCompositionData().getModel());
+            ErrorCode deploymentFlavorErrorBuilder = DeploymentFlavorErrorBuilder
+                .getInvalidComponentComputeAssociationErrorBuilder();
+            List<String> errors = new ArrayList<>();
+            errors.add(deploymentFlavorErrorBuilder.message());
+            compositionEntityValidationData.setErrors(errors);
+            validationData.add(compositionEntityValidationData);
+          } else {
+            componetComputeAssociations.forEach(componetComputeAssociation -> {
+              if (componetComputeAssociation == null
+                  || !(componetComputeAssociation.getComponentId() != null
+                      && componetComputeAssociation.getComputeFlavorId() != null)) {
+                CompositionEntityValidationData compositionEntityValidationData = new
+                    CompositionEntityValidationData(CompositionEntityType.deployment,
+                    deploymentFlavor.getId());
+                compositionEntityValidationData.setEntityName(deployment
+                    .getDeploymentFlavorCompositionData().getModel());
+                ErrorCode deploymentFlavorErrorBuilder = DeploymentFlavorErrorBuilder
+                    .getInvalidComponentComputeAssociationErrorBuilder();
+                List<String> errors = new ArrayList<>();
+                errors.add(deploymentFlavorErrorBuilder.message());
+                compositionEntityValidationData.setErrors(errors);
+                validationData.add(compositionEntityValidationData);
+              }
+            });
+          }
+        }
+      });
+    }
+    if (CollectionUtils.isEmpty(validationData)) {
+      return null;
+    }
+    DeploymentFlavorValidationResult deploymentFlavorValidationResult = new
+        DeploymentFlavorValidationResult(validationData);
+    return deploymentFlavorValidationResult;
+
+  }
+
+  private ComponentValidationResult componentValidation(String vspId, Version version) {
+    mdcDataDebugMessage.debugEntryMessage("VSP id", vspId);
+
+    Set<CompositionEntityValidationData> validationData = new HashSet<>();
+    Collection<ComponentEntity> components = vendorSoftwareProductDao.listComponents(vspId,version);
+    if (!CollectionUtils.isEmpty(components)) {
+      components.forEach(component -> {
+        validateImage(vspId, version, validationData, component);
+        validateNic(vspId, version, validationData, component);
+
+      });
+    }
+    if (CollectionUtils.isEmpty(validationData)) {
+      return null;
+    }
+    ComponentValidationResult componentValidationResult =
+        new ComponentValidationResult(validationData);
+    return componentValidationResult;
+  }
+
+  private void validateNic(String vspId, Version version,
+                           Set<CompositionEntityValidationData> validationData,
+                           ComponentEntity component) {
+    Collection<NicEntity> nics = nicDao.list(new NicEntity(vspId,version, component.getId(),null));
+    if (CollectionUtils.isNotEmpty(nics)) {
+      nics.forEach(nicEntity -> {
+        NicEntity nic = nicDao.get(new NicEntity(vspId, version, component.getId(),
+            nicEntity.getId()));
+        NetworkType networkType = nic.getNicCompositionData().getNetworkType();
+        String networkId = nic.getNicCompositionData().getNetworkId();
+        if (networkType.equals(NetworkType.Internal) && networkId == null) {
+          CompositionEntityValidationData compositionEntityValidationData = new
+              CompositionEntityValidationData(CompositionEntityType.nic, nic.getId());
+          compositionEntityValidationData.setEntityName(nic.getNicCompositionData().getName());
+          ErrorCode nicInternalNetworkErrorBuilder = NicInternalNetworkErrorBuilder
+              .getNicNullNetworkIdInternalNetworkIdErrorBuilder();
+          List<String> errors = new ArrayList<>();
+          errors.add(nicInternalNetworkErrorBuilder.message());
+          compositionEntityValidationData.setErrors(errors);
+          validationData.add(compositionEntityValidationData);
+        }
+      });
+    }
+  }
+
+  private void validateImage(String vspId, Version version,
+                             Set<CompositionEntityValidationData> validationData,
+                             ComponentEntity component) {
+    Collection<ImageEntity> images = vendorSoftwareProductDao.listImages(vspId,version,
+        component.getId());
+    if (CollectionUtils.isEmpty(images)) {
+      CompositionEntityValidationData compositionEntityValidationData = new
+          CompositionEntityValidationData(component.getType(),component.getId());
+      compositionEntityValidationData.setEntityName(component.getComponentCompositionData()
+          .getDisplayName());
+      ErrorCode vfcMissingImageErrorBuilder =
+          ComponentErrorBuilder.VfcMissingImageErrorBuilder();
+      List<String> errors = new ArrayList<>();
+      errors.add(vfcMissingImageErrorBuilder.message());
+      compositionEntityValidationData.setErrors(errors);
+      validationData.add(compositionEntityValidationData);
+    }
+  }
+
+
+
+  private List<ErrorCode> validateCompletedVendorSoftwareProduct(
       VspDetails vspDetails, UploadDataEntity uploadData, Object serviceModel) {
 
-    List<ErrorCode> errros = new ArrayList<>();
+    List<ErrorCode> errors = new ArrayList<>();
 
     if (vspDetails.getName() == null) {
-      errros.add(createMissingMandatoryFieldError("name"));
+      errors.add(createMissingMandatoryFieldError("name"));
     }
     if (vspDetails.getDescription() == null) {
-      errros.add(createMissingMandatoryFieldError("description"));
+      errors.add(createMissingMandatoryFieldError("description"));
     }
     if (vspDetails.getVendorId() == null) {
-      errros.add(createMissingMandatoryFieldError("vendor Id"));
-    }
-    if (vspDetails.getVlmVersion() == null) {
-      errros.add(createMissingMandatoryFieldError(
-          "licensing version (in the format of: {integer}.{integer})"));
+      errors.add(createMissingMandatoryFieldError("vendor Id"));
     }
     if (vspDetails.getCategory() == null) {
-      errros.add(createMissingMandatoryFieldError("category"));
+      errors.add(createMissingMandatoryFieldError("category"));
     }
     if (vspDetails.getSubCategory() == null) {
-      errros.add(createMissingMandatoryFieldError("sub category"));
+      errors.add(createMissingMandatoryFieldError("sub category"));
+    }
+    if (vspDetails.getOnboardingMethod().equals("Manual")) {
+      //Manual Onboarding specific validations
+      Collection<DeploymentFlavorEntity> deploymentFlavorEntities = vendorSoftwareProductDao
+          .listDeploymentFlavors(vspDetails.getId(), vspDetails.getVersion());
+      if (CollectionUtils.isEmpty(deploymentFlavorEntities) ) {
+        ErrorCode vspMissingDeploymentFlavorErrorBuilder =
+            VendorSoftwareProductInvalidErrorBuilder.VspMissingDeploymentFlavorErrorBuilder();
+        errors.add(vspMissingDeploymentFlavorErrorBuilder);
+      }
+      errors.addAll(validateMandatoryLicenseFields(vspDetails));
+    } else {
+      //Heat flow specific VSP validations
+      if (uploadData == null || uploadData.getContentData() == null || serviceModel == null) {
+        errors.add(VendorSoftwareProductInvalidErrorBuilder
+                .VendorSoftwareProductMissingServiceModelErrorBuilder(vspDetails.getId(),
+                    vspDetails.getVersion()));
+      }
+      if (vspDetails.getVlmVersion() != null || vspDetails.getLicenseAgreement() != null
+          || vspDetails.getFeatureGroups() != null) {
+        errors.addAll(validateMandatoryLicenseFields(vspDetails));
+      }
+    }
+    return errors.isEmpty() ? null : errors;
+  }
+
+  private List<ErrorCode> validateMandatoryLicenseFields(VspDetails vspDetails) {
+    List<ErrorCode> errors = new ArrayList<>();
+    if (vspDetails.getVlmVersion() == null) {
+      errors.add(createMissingMandatoryFieldError(
+          "licensing version (in the format of: {integer}.{integer})"));
     }
     if (vspDetails.getLicenseAgreement() == null) {
-      errros.add(createMissingMandatoryFieldError("license agreement"));
+      errors.add(createMissingMandatoryFieldError("license agreement"));
     }
     if (CollectionUtils.isEmpty(vspDetails.getFeatureGroups())) {
-      errros.add(createMissingMandatoryFieldError("feature groups"));
+      errors.add(createMissingMandatoryFieldError("feature groups"));
     }
-    if (uploadData == null || uploadData.getContentData() == null || serviceModel == null) {
-      errros.add(
-          new VendorSoftwareProductInvalidErrorBuilder(vspDetails.getId(), vspDetails.getVersion())
-              .build());
-    }
-
-    return errros.isEmpty() ? null : errros;
+    return errors;
   }
 
   private static ErrorCode createMissingMandatoryFieldError(String fieldName) {
@@ -498,6 +711,20 @@
     mdcDataDebugMessage.debugEntryMessage("VSP id", vspDetails.getId());
 
     VspDetails retrieved = vspInfoDao.get(vspDetails);
+    if (!retrieved.getOnboardingMethod().equals(vspDetails.getOnboardingMethod())) {
+      final ErrorCode onboardingMethodUpdateErrorCode = OnboardingMethodErrorBuilder
+          .getOnboardingUpdateError();
+
+      MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+          LoggerTragetServiceName.UPDATE_VSP, ErrorLevel.ERROR.name(),
+          LoggerErrorCode.DATA_ERROR.getErrorCode(), onboardingMethodUpdateErrorCode.message());
+
+      throw new CoreException(onboardingMethodUpdateErrorCode);
+    }
+
+    //If any existing feature group is removed from VSP which is also associated in DF then
+    //update DF to remove feature group associations.
+    updateDeploymentFlavor(vspDetails, user);
 
     updateUniqueName(retrieved.getName(), vspDetails.getName());
     vspDetails.setOldVersion(retrieved.getOldVersion());
@@ -508,6 +735,28 @@
     mdcDataDebugMessage.debugExitMessage("VSP id", vspDetails.getId());
   }
 
+  private void updateDeploymentFlavor(VspDetails vspDetails, String user) {
+    final List<String> featureGroups = vspDetails.getFeatureGroups();
+    if (featureGroups != null && !featureGroups.isEmpty() ) {
+      /*final Collection<DeploymentFlavorEntity> deploymentFlavorEntities =
+          listDeploymentFlavors(vspDetails.getId(), vspDetails.getVersion(), user);*/
+
+      final Collection<DeploymentFlavorEntity> deploymentFlavorEntities = deploymentFlavorDao
+          .list(new DeploymentFlavorEntity(vspDetails.getId(), vspDetails
+          .getVersion(), null));
+      for (DeploymentFlavorEntity deploymentFlavorEntity : deploymentFlavorEntities) {
+        final String featureGroupId =
+            deploymentFlavorEntity.getDeploymentFlavorCompositionData().getFeatureGroupId();
+        if ( !featureGroups.contains(featureGroupId)) {
+          DeploymentFlavor deploymentFlavorCompositionData =
+              deploymentFlavorEntity.getDeploymentFlavorCompositionData();
+          deploymentFlavorCompositionData.setFeatureGroupId(null);
+          vendorSoftwareProductDao.updateDeploymentFlavor(deploymentFlavorEntity);
+        }
+      }
+    }
+  }
+
 
   @Override
   public VspDetails getVsp(String vspId, Version version, String user) {
@@ -554,9 +803,12 @@
           Version finalVersion = checkinFinalVersion.calculateNextFinal();
           createPackage(vspId, finalVersion, user);
           return finalVersion;
-        } catch (IOException e) {
-          throw new Exception(e.getMessage());
+        } catch (IOException ex) {
+          throw new Exception(ex.getMessage());
         }
+      default:
+        //do nothing
+        break;
     }
     return versionInfo.getActiveVersion();
   }
@@ -798,15 +1050,9 @@
       return null;
     }
 
-    FileContentHandler fileContentMap = new FileContentHandler();
-
-    try {
-      fileContentMap =
-          CommonUtil.loadUploadFileContent(uploadData.getContentData().array());
-    } catch (Exception e){
-      ErrorMessage errorMessage = new ErrorMessage(ErrorLevel.ERROR, e.getMessage());
-      validationErrors.put("Upload file", Arrays.asList(errorMessage));
-    }
+    FileContentHandler fileContentMap =
+        CommonUtil.validateAndUploadFileContent(uploadData.getContentData().array());
+    //todo - check
     ValidationManager validationManager =
         ValidationManagerUtil.initValidationManager(fileContentMap);
     validationErrors.putAll(validationManager.validate());
@@ -824,7 +1070,8 @@
   }
 
 
-  private QuestionnaireValidationResult validateQuestionnaire(String vspId, Version version) {
+  private QuestionnaireValidationResult validateQuestionnaire(String vspId, Version version,
+                                                              String onboardingMethod) {
     mdcDataDebugMessage.debugEntryMessage("VSP id", vspId);
 
     // The apis of CompositionEntityDataManager used here are stateful!
@@ -854,6 +1101,14 @@
         new ComponentQuestionnaireSchemaInput(nicNamesByComponent.get(component.getId()),
             JsonUtil.json2Object(component.getQuestionnaireData(), Map.class))));
 
+    Collection<ComputeEntity> computes = vendorSoftwareProductDao.listComputesByVsp(vspId, version);
+    computes.forEach(compute -> compositionEntityDataManager.addEntity(compute, null));
+
+    if ("Manual".equals(onboardingMethod) ) {
+      Collection<ImageEntity> images = vendorSoftwareProductDao.listImagesByVsp(vspId, version);
+      images.forEach(image -> compositionEntityDataManager.addEntity(image, null));
+    }
+
     Map<CompositionEntityId, Collection<String>> errorsByEntityId =
         compositionEntityDataManager.validateEntitiesQuestionnaire();
     if (MapUtils.isNotEmpty(errorsByEntityId)) {
@@ -894,8 +1149,8 @@
       OutputStream out = new BufferedOutputStream(new FileOutputStream(infoArtifactFile));
       out.write(infoArtifactAsByteBuffer.array());
       out.close();
-    } catch (IOException e) {
-      throw new CoreException(new InformationArtifactCreationErrorBuilder(vspId).build(), e);
+    } catch (IOException ex) {
+      throw new CoreException(new InformationArtifactCreationErrorBuilder(vspId).build(), ex);
     }
 
     mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
@@ -917,4 +1172,10 @@
         VendorSoftwareProductConstants.UniqueValues.VENDOR_SOFTWARE_PRODUCT_NAME,
         oldVspName, newVspName);
   }
+
+  @Override
+  public Collection<ComputeEntity> getComputeByVsp(String vspId, Version version,
+                                                   String user) {
+    return vendorSoftwareProductDao.listComputesByVsp(vspId, version);
+  }
 }
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VspManagerFactoryImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VspManagerFactoryImpl.java
index 3751195..44c9d15 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VspManagerFactoryImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VspManagerFactoryImpl.java
@@ -28,11 +28,15 @@
 import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacadeFactory;
 import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductManager;
 import org.openecomp.sdc.vendorsoftwareproduct.VspManagerFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.DeploymentFlavorDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.DeploymentFlavorDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDaoFactory;
 import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDaoFactory;
 import org.openecomp.sdc.vendorsoftwareproduct.dao.PackageInfoDaoFactory;
 import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory;
 import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDaoFactory;
 import org.openecomp.sdc.vendorsoftwareproduct.factory.InformationArtifactGeneratorFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.DeploymentFlavor;
 import org.openecomp.sdc.versioning.VersioningManagerFactory;
 
 public class VspManagerFactoryImpl extends VspManagerFactory {
@@ -49,7 +53,10 @@
           VendorLicenseArtifactServiceFactory.getInstance().createInterface(),
           InformationArtifactGeneratorFactory.getInstance().createInterface(),
           PackageInfoDaoFactory.getInstance().createInterface(),
-          ActivityLogManagerFactory.getInstance().createInterface());
+          ActivityLogManagerFactory.getInstance().createInterface(),
+          DeploymentFlavorDaoFactory.getInstance().createInterface(),
+          NicDaoFactory.getInstance().createInterface(),
+          new ManualVspToscaManagerImpl());
 
   @Override
   public VendorSoftwareProductManager createInterface() {
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ComponentValidationResult.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ComponentValidationResult.java
new file mode 100644
index 0000000..8fa6551
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ComponentValidationResult.java
@@ -0,0 +1,24 @@
+package org.openecomp.sdc.vendorsoftwareproduct.types;
+
+
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityValidationData;
+
+import java.util.Set;
+
+public class ComponentValidationResult {
+  private boolean valid;
+  private Set<CompositionEntityValidationData> validationData;
+
+  public ComponentValidationResult(Set<CompositionEntityValidationData> validationData) {
+    this.validationData = validationData;
+    valid = validationData == null;
+  }
+
+  public boolean isValid() {
+    return valid;
+  }
+
+  public Set<CompositionEntityValidationData> getValidationData() {
+    return validationData;
+  }
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/DeploymentFlavorValidationResult.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/DeploymentFlavorValidationResult.java
new file mode 100644
index 0000000..6f02c98
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/DeploymentFlavorValidationResult.java
@@ -0,0 +1,25 @@
+package org.openecomp.sdc.vendorsoftwareproduct.types;
+
+
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityValidationData;
+
+import java.util.Set;
+
+public class DeploymentFlavorValidationResult {
+  private boolean valid;
+  private Set<CompositionEntityValidationData> validationData;
+
+  public DeploymentFlavorValidationResult(Set<CompositionEntityValidationData> validationData){
+    this.validationData = validationData;
+    valid = validationData == null;
+  }
+
+  public boolean isValid() {
+    return valid;
+  }
+
+  public Set<CompositionEntityValidationData> getValidationData() {
+    return validationData;
+  }
+
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ListComputeResponse.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ListComputeResponse.java
new file mode 100644
index 0000000..7306fe9
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ListComputeResponse.java
@@ -0,0 +1,28 @@
+package org.openecomp.sdc.vendorsoftwareproduct.types;
+
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComputeEntity;
+
+public class ListComputeResponse {
+
+  private ComputeEntity computeEntity;
+  private boolean associatedWithDeploymentFlavor;
+
+  public boolean isAssociatedWithDeploymentFlavor() {
+    return associatedWithDeploymentFlavor;
+  }
+
+  public void setAssociatedWithDeploymentFlavor(boolean associatedWithDeploymentFlavor) {
+    this.associatedWithDeploymentFlavor = associatedWithDeploymentFlavor;
+  }
+
+  public ComputeEntity getComputeEntity() {
+    return computeEntity;
+  }
+
+  public void setComputeEntity(
+      ComputeEntity computeEntity) {
+    this.computeEntity = computeEntity;
+  }
+
+
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ValidationResponse.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ValidationResponse.java
index eb03ba6..ea5bef1 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ValidationResponse.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ValidationResponse.java
@@ -22,10 +22,10 @@
 
 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.ErrorCode;
 import org.openecomp.sdc.datatypes.error.ErrorMessage;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
 import org.openecomp.sdc.logging.types.LoggerServiceName;
 import org.openecomp.sdc.vendorsoftwareproduct.utils.VendorSoftwareProductUtils;
 
@@ -41,6 +41,9 @@
   private Map<String, List<ErrorMessage>> uploadDataErrors;
   private Map<String, List<ErrorMessage>> compilationErrors;
   private QuestionnaireValidationResult questionnaireValidationResult;
+  private ComponentValidationResult componentValidationResult;
+  private DeploymentFlavorValidationResult deploymentFlavorValidationResult;
+
 
   public boolean isValid() {
     return valid;
@@ -67,6 +70,7 @@
     VendorSoftwareProductUtils.setErrorsIntoLogger(vspErrors, serviceName, targetServiceName);
   }
 
+
   public Collection<ErrorCode> getLicensingDataErrors() {
     return licensingDataErrors;
   }
@@ -145,4 +149,40 @@
   }
 
 
+  public ComponentValidationResult getComponentValidationResult() {
+    return componentValidationResult;
+  }
+
+  /**
+   * Sets Component validation result.
+   *
+   * @param componentValidationResult the Component validation result
+   */
+  public void setComponentValidationResult(
+      ComponentValidationResult componentValidationResult) {
+    this.componentValidationResult = componentValidationResult;
+    if (componentValidationResult != null && !componentValidationResult.isValid()) {
+      valid = false;
+    }
+  }
+
+
+  public DeploymentFlavorValidationResult getDeploymentFlavorValidationResult() {
+    return deploymentFlavorValidationResult;
+  }
+
+  /**
+   * Sets Deployment validation result.
+   *
+   * @param deploymentFlavorValidationResult the Deployment validation result
+   */
+  public void setDeploymentFlavorValidationResult(
+      DeploymentFlavorValidationResult deploymentFlavorValidationResult) {
+    this.deploymentFlavorValidationResult = deploymentFlavorValidationResult;
+    if (deploymentFlavorValidationResult != null && !deploymentFlavorValidationResult.isValid()) {
+      valid = false;
+    }
+  }
+
+
 }
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/schemagenerator/MibUploadStatus.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/schemagenerator/MonitoringUploadStatus.java
similarity index 79%
rename from openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/schemagenerator/MibUploadStatus.java
rename to openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/schemagenerator/MonitoringUploadStatus.java
index 046d530..ad604e8 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/schemagenerator/MibUploadStatus.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/schemagenerator/MonitoringUploadStatus.java
@@ -20,17 +20,21 @@
 
 package org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator;
 
-public class MibUploadStatus {
+public class MonitoringUploadStatus {
   private String snmpTrap;
   private String snmpPoll;
+  private String vesEvent;
 
 
-  public MibUploadStatus(String snmpTrap, String snmpPoll) {
+  //todo 1802 tech debt story : refactor this to be a map of type-filename
+
+
+  public MonitoringUploadStatus(String snmpTrap, String snmpPoll) {
     this.snmpTrap = snmpTrap;
     this.snmpPoll = snmpPoll;
   }
 
-  public MibUploadStatus() {
+  public MonitoringUploadStatus() {
   }
 
   public String getSnmpTrap() {
@@ -45,7 +49,17 @@
     return snmpPoll;
   }
 
+  public String getVesEvent() {
+    return vesEvent;
+  }
+
+  public void setVesEvent(String vesEvent) {
+    this.vesEvent = vesEvent;
+  }
+
   public void setSnmpPoll(String snmpPoll) {
     this.snmpPoll = snmpPoll;
+
+
   }
 }
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/utils/ManualVspDataCollectionService.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/utils/ManualVspDataCollectionService.java
new file mode 100644
index 0000000..981bfe9
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/utils/ManualVspDataCollectionService.java
@@ -0,0 +1,418 @@
+package org.openecomp.sdc.vendorsoftwareproduct.utils;
+
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang.StringUtils;
+import org.openecomp.core.utilities.json.JsonUtil;
+import org.openecomp.sdc.generator.datatypes.tosca.ComputeFlavor;
+import org.openecomp.sdc.generator.datatypes.tosca.DeploymentFlavorModel;
+import org.openecomp.sdc.generator.datatypes.tosca.LicenseFlavor;
+import org.openecomp.sdc.generator.datatypes.tosca.MultiFlavorVfcImage;
+import org.openecomp.sdc.generator.datatypes.tosca.VendorInfo;
+import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity;
+import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupModel;
+import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade;
+import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacadeFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.ComponentManager;
+import org.openecomp.sdc.vendorsoftwareproduct.ComponentManagerFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.ComputeManager;
+import org.openecomp.sdc.vendorsoftwareproduct.ComputeManagerFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.DeploymentFlavorManager;
+import org.openecomp.sdc.vendorsoftwareproduct.DeploymentFlavorManagerFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.ImageManager;
+import org.openecomp.sdc.vendorsoftwareproduct.ImageManagerFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.NicManager;
+import org.openecomp.sdc.vendorsoftwareproduct.NicManagerFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductManager;
+import org.openecomp.sdc.vendorsoftwareproduct.VspManagerFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.DeploymentFlavorEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ImageEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
+import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse;
+import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireResponse;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentComputeAssociation;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentData;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.DeploymentFlavor;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Image;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic;
+import org.openecomp.sdc.vendorsoftwareproduct.types.questionnaire.component.compute.Compute;
+import org.openecomp.sdc.vendorsoftwareproduct.types.questionnaire.component.image.ImageDetails;
+import org.openecomp.sdc.versioning.dao.types.Version;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+
+
+public class ManualVspDataCollectionService {
+
+  private static final DeploymentFlavorManager deploymentFlavorManager =
+      DeploymentFlavorManagerFactory.getInstance().createInterface();
+  private static final ComputeManager computeManager =
+      ComputeManagerFactory.getInstance().createInterface();
+  private static final ImageManager imageManager =
+      ImageManagerFactory.getInstance().createInterface();
+  private static final ComponentManager componentManager =
+      ComponentManagerFactory.getInstance().createInterface();
+  private static final VendorSoftwareProductManager vendorSoftwareProductManager =
+      VspManagerFactory.getInstance().createInterface();
+  private static final NicManager nicManager =
+      NicManagerFactory.getInstance().createInterface();
+  private static final VendorLicenseFacade vendorLicenseFacade =
+      VendorLicenseFacadeFactory.getInstance().createInterface();
+
+
+  /**
+   * Gets vendor name for the vsp.
+   *
+   * @param vspId   the vsp id
+   * @param version the version
+   * @param user    the user
+   * @return the release vendor name
+   */
+  public Optional<String> getReleaseVendor(String vspId, Version version, String user) {
+    String vendorName = null;
+    VspDetails vspDetails = vendorSoftwareProductManager.getVsp(vspId, version, user);
+    if (Objects.nonNull(vspDetails)) {
+      vendorName = vspDetails.getVendorName();
+    }
+    return Optional.ofNullable(vendorName);
+  }
+
+  /**
+   * Gets the deployment flavor data for manually onboarded VSPs.
+   *
+   * @param vspId   the vsp id
+   * @param version the version
+   * @param user    the user
+   * @return the allowed flavors
+   */
+  public Map<String, DeploymentFlavorModel> getAllowedFlavors(String vspId, Version version,
+                                                              String user) {
+    Map<String, DeploymentFlavorModel> allowedFlavors = new HashMap<>();
+    Collection<DeploymentFlavorEntity> deploymentFlavorEntities =
+        deploymentFlavorManager.listDeploymentFlavors(vspId, version, user);
+    if (CollectionUtils.isNotEmpty(deploymentFlavorEntities)) {
+      for (DeploymentFlavorEntity deploymentFlavorEntity : deploymentFlavorEntities) {
+        DeploymentFlavor deploymentFlavorCompositionData =
+            deploymentFlavorEntity.getDeploymentFlavorCompositionData();
+
+        VspDetails vspDetails = vendorSoftwareProductManager.getVsp(vspId, version, user);
+        String vspVlmId;
+        Version vlmVersion;
+        if (Objects.nonNull(vspDetails)) {
+          vspVlmId = vspDetails.getVendorId();
+          vlmVersion = vspDetails.getVlmVersion();
+          if (StringUtils.isNotEmpty(vspVlmId)) {
+            DeploymentFlavorModel deploymentFlavorModel = new DeploymentFlavorModel();
+            String featureGroupId = deploymentFlavorCompositionData.getFeatureGroupId();
+            if (Objects.isNull(featureGroupId)) {
+              //No feature group associated with deployment flavor. So excluding this deployment
+              // flavor for Tosca model
+              continue;
+            }
+            //Gather and set License flavor info
+            LicenseFlavor licenseFlavor = getLicenseFlavor(featureGroupId);
+            deploymentFlavorModel.setLicense_flavor(licenseFlavor);
+            //Get sp_part_number
+            Optional<String> partNumber = getPartNumber(vspVlmId, vlmVersion, featureGroupId,
+                user);
+            partNumber.ifPresent(deploymentFlavorModel::setSp_part_number);
+            //Gather and set Vendor Info
+            Optional<VendorInfo> vendorInfo = getVendorInfo(vspVlmId, vlmVersion, featureGroupId,
+                user);
+            vendorInfo.ifPresent(deploymentFlavorModel::setVendor_info);
+            //Gather and set Compute info
+            List<ComponentComputeAssociation> componentComputeAssociations =
+                deploymentFlavorCompositionData.getComponentComputeAssociations();
+            if (CollectionUtils.isNotEmpty(componentComputeAssociations)) {
+              for (ComponentComputeAssociation componentComputeAssociation :
+                  componentComputeAssociations) {
+                String componentId = componentComputeAssociation.getComponentId();
+                String computeFlavorId = componentComputeAssociation.getComputeFlavorId();
+                Optional<ComputeFlavor> computeFlavor =
+                    getComputeFlavor(vspId, version, componentId, computeFlavorId, user);
+                computeFlavor.ifPresent(deploymentFlavorModel::setCompute_flavor);
+              }
+            }
+            partNumber.ifPresent(spPartNumber -> allowedFlavors.put(spPartNumber,
+                deploymentFlavorModel));
+          }
+        }
+      }
+    }
+    return allowedFlavors;
+  }
+
+  /**
+   * Gets the component image data for manually onboarded VSPs.
+   *
+   * @param vspId   the vsp id
+   * @param version the version
+   * @param user    the user
+   * @return the vsp component images
+   */
+  public Map<String, List<MultiFlavorVfcImage>> getVspComponentImages(String vspId,
+                                                                      Version version,
+                                                                      String user) {
+    Map<String, List<MultiFlavorVfcImage>> vspComponentImages = new HashMap<>();
+    Collection<DeploymentFlavorEntity> deploymentFlavorEntities =
+        deploymentFlavorManager.listDeploymentFlavors(vspId, version, user);
+    for (DeploymentFlavorEntity deploymentFlavorEntity : deploymentFlavorEntities) {
+      DeploymentFlavor deploymentFlavorCompositionData =
+          deploymentFlavorEntity.getDeploymentFlavorCompositionData();
+
+      List<ComponentComputeAssociation> componentComputeAssociations =
+          deploymentFlavorCompositionData.getComponentComputeAssociations();
+      if (CollectionUtils.isNotEmpty(componentComputeAssociations)) {
+        for (ComponentComputeAssociation componentComputeAssociation :
+            componentComputeAssociations) {
+          String componentId = componentComputeAssociation.getComponentId();
+          List<MultiFlavorVfcImage> componentImages =
+              getComponentImages(vspId, version, componentId, user);
+          if (CollectionUtils.isNotEmpty(componentImages)) {
+            vspComponentImages.put(componentId, componentImages);
+          }
+        }
+      }
+    }
+    return vspComponentImages;
+  }
+
+  /**
+   * Gets the component data for manually onboarded VSPs.
+   *
+   * @param vspId   the vsp id
+   * @param version the version
+   * @param user    the user
+   * @return the vsp components
+   */
+  public Map<String, String> getVspComponents(String vspId, Version version, String user) {
+    Map<String, String> componentIdNameMap = new HashMap<>();
+    Collection<DeploymentFlavorEntity> deploymentFlavorEntities =
+        deploymentFlavorManager.listDeploymentFlavors(vspId, version, user);
+    for (DeploymentFlavorEntity deploymentFlavorEntity : deploymentFlavorEntities) {
+      DeploymentFlavor deploymentFlavorCompositionData =
+          deploymentFlavorEntity.getDeploymentFlavorCompositionData();
+
+      List<ComponentComputeAssociation> componentComputeAssociations =
+          deploymentFlavorCompositionData.getComponentComputeAssociations();
+      if (CollectionUtils.isNotEmpty(componentComputeAssociations)) {
+        for (ComponentComputeAssociation componentComputeAssociation :
+            componentComputeAssociations) {
+          String componentId = componentComputeAssociation.getComponentId();
+          Optional<String> componentName = getComponentName(vspId, version, componentId, user);
+          componentName.ifPresent(name -> componentIdNameMap.put(componentId, name));
+        }
+      }
+    }
+    return componentIdNameMap;
+  }
+
+  /**
+   * Gets the NIC data for manually onboarded VSPs.
+   *
+   * @param vspId   the vsp id
+   * @param version the version
+   * @param user    the user
+   * @return the vsp component nics
+   */
+  public Map<String, List<Nic>> getVspComponentNics(String vspId, Version version, String user) {
+    Map<String, List<Nic>> vspComponentNics = new HashMap<>();
+    Collection<DeploymentFlavorEntity> deploymentFlavorEntities =
+        deploymentFlavorManager.listDeploymentFlavors(vspId, version, user);
+    if (CollectionUtils.isNotEmpty(deploymentFlavorEntities)) {
+      for (DeploymentFlavorEntity deploymentFlavorEntity : deploymentFlavorEntities) {
+        DeploymentFlavor deploymentFlavorCompositionData =
+            deploymentFlavorEntity.getDeploymentFlavorCompositionData();
+        if (Objects.nonNull(deploymentFlavorCompositionData)) {
+          List<ComponentComputeAssociation> componentComputeAssociations =
+              deploymentFlavorCompositionData.getComponentComputeAssociations();
+          if (CollectionUtils.isNotEmpty(componentComputeAssociations)) {
+            for (ComponentComputeAssociation componentComputeAssociation :
+                componentComputeAssociations) {
+              String componentId = componentComputeAssociation.getComponentId();
+              List<Nic> componentNics = getComponentNics(vspId, version, componentId, user);
+              if (CollectionUtils.isNotEmpty(componentNics)) {
+                vspComponentNics.put(componentId, componentNics);
+              }
+            }
+          }
+        }
+      }
+    }
+    return vspComponentNics;
+  }
+
+  private List<Nic> getComponentNics(String vspId, Version version, String componentId,
+                                     String user) {
+    List<Nic> componentNics = new ArrayList<>();
+    Collection<NicEntity> nics = nicManager.listNics(vspId, version, componentId,  user);
+    if (Objects.nonNull(nics)) {
+      for (NicEntity nicEntity : nics) {
+        String nicId = nicEntity.getId();
+        CompositionEntityResponse<Nic> nicCompositionEntityResponse =
+            nicManager.getNic(vspId, version, componentId, nicId, user);
+        if (Objects.nonNull(nicCompositionEntityResponse)
+            && Objects.nonNull(nicCompositionEntityResponse.getData())) {
+          componentNics.add(nicCompositionEntityResponse.getData());
+        }
+      }
+    }
+    return componentNics;
+  }
+
+  private LicenseFlavor getLicenseFlavor(String featureGroupId) {
+    LicenseFlavor licenseFlavor = new LicenseFlavor();
+    licenseFlavor.setFeature_group_uuid(featureGroupId);
+    return licenseFlavor;
+  }
+
+  private Optional<String> getPartNumber(String vlmId, Version version,
+                                         String featureGroupId, String user) {
+    FeatureGroupModel featureGroup = getFeatureGroup(vlmId, version, featureGroupId, user);
+    if (Objects.nonNull(featureGroup)) {
+      return Optional.ofNullable(featureGroup.getFeatureGroup().getPartNumber());
+    }
+    return Optional.empty();
+  }
+
+  private Optional<VendorInfo> getVendorInfo(String vlmId, Version version,
+                                             String featureGroupId, String user) {
+    VendorInfo vendorInfo = null;
+    FeatureGroupModel featureGroup = getFeatureGroup(vlmId, version, featureGroupId, user);
+    if (Objects.nonNull(featureGroup)) {
+      //Process Feature group to get Manufacturer ref no.
+      String manufacturerReferenceNumber = featureGroup.getEntityManufacturerReferenceNumber();
+      vendorInfo = new VendorInfo();
+      vendorInfo.setVendor_model(vlmId);
+      if (Objects.nonNull(manufacturerReferenceNumber)) {
+        vendorInfo.setManufacturer_reference_number(manufacturerReferenceNumber);
+      }
+    }
+    return Optional.ofNullable(vendorInfo);
+  }
+
+  private Optional<ComputeFlavor> getComputeFlavor(String vspId, Version version,
+                                                   String componentId, String computeFlavorId,
+                                                   String user) {
+    ComputeFlavor computeFlavor = null;
+    QuestionnaireResponse computeQuestionnaire;
+    try {
+      computeQuestionnaire = computeManager.getComputeQuestionnaire(vspId, version, componentId,
+          computeFlavorId, user);
+    } catch (Exception ex) {
+      computeQuestionnaire = null;
+    }
+    if (Objects.nonNull(computeQuestionnaire)) {
+      String computeQuestionnaireData = computeQuestionnaire.getData();
+      if (Objects.nonNull(computeQuestionnaireData)) {
+        Compute compute;
+        try {
+          compute = JsonUtil.json2Object(computeQuestionnaireData, Compute.class);
+        } catch (Exception ex) {
+          compute = null;
+        }
+        if (Objects.nonNull(compute.getVmSizing())) {
+          computeFlavor = new ComputeFlavor();
+          if (Objects.nonNull(compute.getVmSizing().getNumOfCPUs())) {
+            computeFlavor.setNum_cpus(compute.getVmSizing().getNumOfCPUs());
+          }
+          if (Objects.nonNull(compute.getVmSizing().getFileSystemSizeGB())) {
+            computeFlavor.setDisk_size(compute.getVmSizing().getFileSystemSizeGB() + "GB");
+          }
+          if (Objects.nonNull(compute.getVmSizing().getMemoryRAM())) {
+            computeFlavor.setMem_size(compute.getVmSizing().getMemoryRAM() + "GB");
+          }
+        }
+      }
+    }
+    return Optional.ofNullable(computeFlavor);
+  }
+
+  private FeatureGroupModel getFeatureGroup(String vlmId, Version version, String featureGroupId,
+                                            String user) {
+    FeatureGroupEntity fgInput = new FeatureGroupEntity();
+    fgInput.setVendorLicenseModelId(vlmId);
+    fgInput.setVersion(version);
+    fgInput.setId(featureGroupId);
+    return vendorLicenseFacade.getFeatureGroupModel(fgInput, user);
+  }
+
+  private Optional<String> getComponentName(String vspId, Version version, String componentId,
+                                            String user) {
+    CompositionEntityResponse<ComponentData> component =
+        componentManager.getComponent(vspId, version, componentId, user);
+    if (Objects.nonNull(component.getData())) {
+      return Optional.ofNullable(component.getData().getDisplayName());
+    }
+    return Optional.empty();
+  }
+
+  private List<MultiFlavorVfcImage> getComponentImages(String vspId, Version version,
+                                                       String componentId, String user) {
+    List<MultiFlavorVfcImage> componentImages = new ArrayList<>();
+    MultiFlavorVfcImage multiFlavorVfcImage = null;
+    Collection<ImageEntity> imageEntities =
+        imageManager.listImages(vspId, version, componentId, user);
+    if (Objects.nonNull(imageEntities)) {
+      for (ImageEntity imageEntity : imageEntities) {
+        String imageId = imageEntity.getId();
+        QuestionnaireResponse imageQuestionnaire =
+            imageManager.getImageQuestionnaire(vspId, version, componentId, imageId, user);
+        CompositionEntityResponse<Image> imageCompositionData =
+            imageManager.getImage(vspId, version, componentId, imageId, user);
+        if (Objects.nonNull(imageQuestionnaire)
+            && Objects.nonNull(imageQuestionnaire.getData())
+            && Objects.nonNull(imageCompositionData)) {
+          ImageDetails imageDetails;
+          try {
+            imageDetails = JsonUtil.json2Object(imageQuestionnaire.getData(),
+                ImageDetails.class);
+          } catch (Exception ex) {
+            imageDetails = null;
+          }
+          if (Objects.nonNull(imageDetails)
+              && Objects.nonNull(imageDetails.getVersion())) {
+            //Image version is used as a key for the image block
+            //So excluding the population if questionnaire data is absent or invalid
+            multiFlavorVfcImage = new MultiFlavorVfcImage();
+            Image image = imageCompositionData.getData();
+            Optional<String> toscaImageFileName = getToscaImageFileName(image, imageDetails);
+            toscaImageFileName.ifPresent(multiFlavorVfcImage::setFile_name);
+            multiFlavorVfcImage.setSoftware_version(imageDetails.getVersion());
+            if (Objects.nonNull(imageDetails.getMd5())) {
+              multiFlavorVfcImage.setFile_hash(imageDetails.getMd5());
+            }
+            multiFlavorVfcImage.setFile_hash_type("md5");
+            componentImages.add(multiFlavorVfcImage);
+          }
+        }
+      }
+    }
+    return componentImages;
+  }
+
+  private Optional<String> getToscaImageFileName(Image image, ImageDetails imageDetails) {
+    String toscaImageFileName = null;
+    StringBuilder builder = new StringBuilder();
+    if (Objects.nonNull(image.getFileName())) {
+      builder.append(image.getFileName());
+      builder.append("-");
+      builder.append(imageDetails.getVersion());
+      if (Objects.nonNull(imageDetails.getFormat())) {
+        builder.append(".");
+        builder.append(imageDetails.getFormat());
+      }
+    }
+    toscaImageFileName = builder.toString();
+    if (toscaImageFileName.isEmpty()) {
+      return Optional.empty();
+    }
+    return Optional.ofNullable(toscaImageFileName);
+  }
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/utils/VendorSoftwareProductUtils.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/utils/VendorSoftwareProductUtils.java
index 3e7e83d..0852840 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/utils/VendorSoftwareProductUtils.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/utils/VendorSoftwareProductUtils.java
@@ -22,7 +22,7 @@
 
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.collections4.MapUtils;
-import org.openecomp.core.enrichment.types.ArtifactType;
+import org.openecomp.core.enrichment.types.MonitoringUploadType;
 import org.openecomp.core.utilities.file.FileContentHandler;
 import org.openecomp.sdc.common.errors.ErrorCode;
 import org.openecomp.sdc.common.errors.Messages;
@@ -35,7 +35,7 @@
 import org.openecomp.sdc.logging.types.LoggerConstants;
 import org.openecomp.sdc.logging.types.LoggerErrorDescription;
 import org.openecomp.sdc.logging.types.LoggerServiceName;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.MibEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentMonitoringUploadEntity;
 import org.openecomp.sdc.vendorsoftwareproduct.types.OrchestrationTemplateActionResponse;
 import org.slf4j.MDC;
 
@@ -47,6 +47,8 @@
 import java.util.Map;
 
 public class VendorSoftwareProductUtils {
+
+  private static final String MANUAL = "Manual";
   protected static Logger logger =
       (Logger) LoggerFactory.getLogger(VendorSoftwareProductUtils.class);
 
@@ -92,12 +94,7 @@
   public static void validateContentZipData(FileContentHandler contentMap,
                                             Map<String, List<ErrorMessage>> errors) {
     MDC.put(LoggerConstants.ERROR_DESCRIPTION, LoggerErrorDescription.INVALID_ZIP);
-    if (contentMap == null) {
-      ErrorMessage.ErrorMessageUtil.addMessage(SdcCommon.UPLOAD_FILE, errors).add(
-          new ErrorMessage(ErrorLevel.ERROR,
-              Messages.ZIP_SHOULD_NOT_CONTAIN_FOLDERS.getErrorMessage()));
-
-    } else if (contentMap.getFileList().size() == 0) {
+    if (contentMap.getFileList().size() == 0) {
       ErrorMessage.ErrorMessageUtil.addMessage(SdcCommon.UPLOAD_FILE, errors)
           .add(new ErrorMessage(ErrorLevel.ERROR, Messages.INVALID_ZIP_FILE.getErrorMessage()));
     }
@@ -105,27 +102,26 @@
 
 
   /**
-   * Filter non trap or poll artifacts map.
+   * Maps all artifacts by type.
    *
    * @param artifacts the artifacts
    * @return the map
    */
-  public static Map<ArtifactType, String> filterNonTrapOrPollArtifacts(
-      Collection<MibEntity> artifacts) {
-    Map<ArtifactType, String> artifactTypeToFilename = new HashMap<>();
+  public static Map<MonitoringUploadType, String> mapArtifactsByType(
+      Collection<ComponentMonitoringUploadEntity> artifacts) {
+    Map<MonitoringUploadType, String> artifactTypeToFilename = new HashMap<>();
 
-    for (MibEntity entity : artifacts) {
-      if (isTrapOrPoll(entity.getType())) {
-        artifactTypeToFilename.put(entity.getType(), entity.getArtifactName());
-      }
+    for (ComponentMonitoringUploadEntity entity : artifacts) {
+      artifactTypeToFilename.put(entity.getType(), entity.getArtifactName());
     }
 
     return artifactTypeToFilename;
   }
 
 
-  private static boolean isTrapOrPoll(ArtifactType type) {
-    return type.equals(ArtifactType.SNMP_POLL) || type.equals(ArtifactType.SNMP_TRAP);
+  private static boolean isTrapOrPoll(MonitoringUploadType type) {
+    return type.equals(MonitoringUploadType.SNMP_POLL) ||
+        type.equals(MonitoringUploadType.SNMP_TRAP);
   }
 
 
@@ -178,4 +174,13 @@
     }
   }
 
+  /*public static boolean isManual(String vspId, Version version, VendorSoftwareProductInfoDao
+      vspInfoDao) {
+    String onboardingMethod = vspInfoDao.get(new VspDetails(vspId, version)).getOnboardingMethod();
+    if (MANUAL.equals(onboardingMethod)) {
+      return true;
+    }
+    return false;
+  }*/
+
 }
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/resources/factoryConfiguration.json b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/resources/factoryConfiguration.json
index f736c8f..71d4293 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/resources/factoryConfiguration.json
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/resources/factoryConfiguration.json
@@ -5,7 +5,10 @@
   "org.openecomp.sdc.vendorsoftwareproduct.NicManagerFactory": "org.openecomp.sdc.vendorsoftwareproduct.impl.NicManagerFactoryImpl",
   "org.openecomp.sdc.vendorsoftwareproduct.OrchestrationTemplateCandidateManagerFactory": "org.openecomp.sdc.vendorsoftwareproduct.impl.OrchestrationTemplateCandidateManagerFactoryImpl",
   "org.openecomp.sdc.vendorsoftwareproduct.ProcessManagerFactory": "org.openecomp.sdc.vendorsoftwareproduct.impl.ProcessManagerFactoryImpl",
-  "org.openecomp.sdc.vendorsoftwareproduct.MibManagerFactory": "org.openecomp.sdc.vendorsoftwareproduct.impl.MibManagerFactoryImpl",
+  "org.openecomp.sdc.vendorsoftwareproduct.MonitoringUploadsManagerFactory": "org.openecomp.sdc.vendorsoftwareproduct.impl.MonitoringUploadsManagerFactoryImpl",
   "org.openecomp.sdc.vendorsoftwareproduct.ComponentDependencyModelManagerFactory": "org.openecomp.sdc.vendorsoftwareproduct.impl.ComponentDependencyModelManagerFactoryImpl",
-  "org.openecomp.sdc.vendorsoftwareproduct.factories.VspServiceFactory": "org.openecomp.sdc.vendorsoftwareproduct.factories.impl.VspServiceFactoryImpl"
+  "org.openecomp.sdc.vendorsoftwareproduct.factories.VspServiceFactory": "org.openecomp.sdc.vendorsoftwareproduct.factories.impl.VspServiceFactoryImpl",
+  "org.openecomp.sdc.vendorsoftwareproduct.ComputeManagerFactory": "org.openecomp.sdc.vendorsoftwareproduct.impl.ComputeManagerFactoryImpl",
+  "org.openecomp.sdc.vendorsoftwareproduct.DeploymentFlavorManagerFactory": "org.openecomp.sdc.vendorsoftwareproduct.impl.DeploymentFlavorManagerFactoryImpl",
+  "org.openecomp.sdc.vendorsoftwareproduct.ImageManagerFactory": "org.openecomp.sdc.vendorsoftwareproduct.impl.ImageManagerFactoryImpl"
 }
\ No newline at end of file
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/ComputeTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/ComputeTest.java
new file mode 100644
index 0000000..ab7a70b
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/ComputeTest.java
@@ -0,0 +1,293 @@
+package org.openecomp.sdc.vendorsoftwareproduct;
+
+import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.ADD_COMPUTE_NOT_ALLOWED_IN_HEAT_ONBOARDING;
+import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.DUPLICATE_COMPUTE_NAME_NOT_ALLOWED;
+
+import org.openecomp.core.utilities.CommonMethods;
+import org.openecomp.sdc.common.errors.CoreException;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory;
+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.VspDetails;
+import org.openecomp.sdc.vendorsoftwareproduct.impl.VendorSoftwareProductManagerImpl;
+import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse;
+import org.openecomp.sdc.vendorsoftwareproduct.types.ListComputeResponse;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentComputeAssociation;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentData;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComputeData;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.DeploymentFlavor;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdc.versioning.errors.VersioningErrorCodes;
+import org.testng.Assert;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+public class ComputeTest {
+
+  /*private static final String USER1 = "componentsTestUser1";
+  private static final String USER2 = "componentsTestUser2";
+  private static final Version VERSION01 = new Version(0, 1);
+  private static final VendorSoftwareProductManager vendorSoftwareProductManager =
+      new VendorSoftwareProductManagerImpl();
+  private static final VendorSoftwareProductDao vendorSoftwareProductDao =
+      VendorSoftwareProductDaoFactory
+          .getInstance().createInterface();
+
+  private static String vsp1Id;
+  private static String vsp2Id;
+  private static String comp1 = "{\"displayName\": \"VFC_Manual\", " +
+      "\"description\": \"desc manual\"}";
+  private static String compute1 = "{\"name\": \"Compute_A\", " +
+      "\"description\": \"desc manual compute\"}";
+  private static String computeDelete = "{\"name\": \"Compute_Delete\", " +
+      "\"description\": \"desc manual compute delete\"}";
+
+  private static String comp1Id;
+  private static String compute1Id;
+  private ComputeEntity createdCompute;
+
+  static ComponentEntity createComponent(String vspId, Version version, String compId) {
+    ComponentEntity componentEntity = new ComponentEntity(vspId, version, compId);
+    ComponentData compData = new ComponentData();
+    compData.setName(compId + " name");
+    compData.setDisplayName(compId + " display name");
+    compData.setDescription(compId + " desc");
+    componentEntity.setComponentCompositionData(compData);
+    vendorSoftwareProductDao.createComponent(componentEntity);
+    return componentEntity;
+  }
+
+  static ComputeEntity createComputeEntity(String vspId, String componentId, String data ){
+    ComputeEntity comp = new ComputeEntity();
+    comp.setVspId(vspId);
+    comp.setComponentId(componentId);
+    comp.setCompositionData(data);
+    return comp;
+  }
+
+  @BeforeClass
+  private void init() {
+    VspDetails
+        vsp1 = vendorSoftwareProductManager.createNewVsp(VSPCommon
+        .createVspDetails(null, null, "VSP_" + CommonMethods.nextUuId(), "Test-vsp1", "vendorName",
+            "vlm1Id", "icon", "category", "subCategory", "123", null,
+            VSPCommon.OnboardingMethod.HEAT.name()), USER1
+    );
+    vsp1Id = vsp1.getId(); //HEAT onboarded
+
+    VspDetails vsp2 = vendorSoftwareProductManager.createNewVsp(VSPCommon
+        .createVspDetails(null, null, "VSP_" + CommonMethods.nextUuId(), "Test-vsp3",
+            "vendorName",
+            "vlm1Id", "icon", "category", "subCategory", "123", null, VSPCommon
+                .OnboardingMethod.Manual.name()), USER1);
+    vsp2Id = vsp2.getId(); //MANUAL onboarded
+
+    ComponentEntity component = new ComponentEntity();
+    component.setVspId(vsp2Id);
+    component.setCompositionData(comp1);
+    ComponentEntity createdComp = vendorSoftwareProductManager.createComponent(component, USER1);
+    comp1Id = createdComp.getId();
+  }
+
+  @Test
+  public void testListWhenNone() {
+
+    final Collection<ListComputeResponse> listComputeResponses =
+        vendorSoftwareProductManager.listCompute(vsp2Id, null, comp1Id, USER1);
+    Assert.assertEquals(listComputeResponses.size(), 0);
+  }
+
+  @Test
+  public void testCreateComputeInHeatOnboardedVsp_negative() {
+    ComputeEntity comp = createComputeEntity(vsp1Id,comp1Id,compute1);
+    try {
+      createdCompute = vendorSoftwareProductManager.createCompute(comp, USER1);
+      Assert.fail();
+    }
+    catch(CoreException exception){
+      Assert.assertEquals(exception.code().id(),ADD_COMPUTE_NOT_ALLOWED_IN_HEAT_ONBOARDING);
+    }
+  }
+
+  @Test(dependsOnMethods = "testListWhenNone")
+  public void testCreateCompute() {
+    ComputeEntity comp = createComputeEntity(vsp2Id,comp1Id,compute1);
+
+    createdCompute = vendorSoftwareProductManager.createCompute(comp, USER1);
+    compute1Id = createdCompute.getId();
+    Assert.assertNotNull(compute1Id);
+    Assert.assertNotNull(createdCompute.getCompositionData());
+    Assert.assertNotNull(
+        vendorSoftwareProductManager.getCompute(vsp2Id, VERSION01, comp1Id,compute1Id,
+            USER1).getData());
+  }
+
+  @Test(dependsOnMethods = "testCreateCompute")
+  public void testCreateComputeNegative() {
+    ComputeEntity comp = createComputeEntity(vsp2Id,comp1Id,compute1);
+
+    try {
+      ComputeEntity createdCompute = vendorSoftwareProductManager.createCompute(comp, USER1);
+      Assert.fail();
+    }
+    catch (CoreException exception) {
+      Assert.assertEquals(exception.code().id(),DUPLICATE_COMPUTE_NAME_NOT_ALLOWED);
+    }
+  }
+
+  @Test
+  public void testGetNonExistingComponentId_negative() {
+    testGet_negative(vsp1Id, null, "non existing component id", compute1Id, USER1,
+        VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND);
+  }
+
+  @Test
+  public void testGetNonExistingVspId_negative() {
+    testGet_negative("non existing vsp id", null, comp1Id, compute1Id, USER1,
+        VersioningErrorCodes.VERSIONABLE_ENTITY_NOT_EXIST);
+  }
+
+  @Test
+  public void testGetNonExistingComputeId_negative() {
+    testGet_negative(vsp1Id, null, comp1Id, "non existing compute id", USER1,
+        VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND);
+  }
+
+  @Test(dependsOnMethods = "testCreateCompute")
+  public void testGetCompute() {
+    testGet(vsp2Id, VERSION01, comp1Id, compute1Id, USER1, createdCompute);
+  }
+
+
+  @Test(dependsOnMethods = "testCreateCompute")
+  public void testListCompute() {
+
+    final Collection<ListComputeResponse> actual =
+        vendorSoftwareProductManager.listCompute(vsp2Id, null, comp1Id, USER1);
+    Assert.assertEquals(actual.size(), 1);
+    actual.forEach(listComputeResponse -> {
+      Assert.assertEquals(listComputeResponse.isAssociatedWithDeploymentFlavor(), false);
+    } );
+  }
+
+
+  @Test(dependsOnMethods = "testListCompute")
+  public void testListComputeAssociatedWithDeployment() {
+
+    //Create DF and associate compute1Id CF to it
+    String deployment1Id = null;
+    DeploymentFlavorEntity deploymentFlavorEntity = new DeploymentFlavorEntity(vsp2Id,
+        VERSION01, deployment1Id);
+    DeploymentFlavor deploymentFlavor = new DeploymentFlavor();
+    deploymentFlavor.setModel("DF_testListComputeAssociatedWithDeployment");
+    deploymentFlavor.setDescription("creating a deployment flavor with compute flavor association");
+    ComponentComputeAssociation association = new ComponentComputeAssociation();
+    association.setComponentId(comp1Id);
+    association.setComputeFlavorId(compute1Id);
+    List<ComponentComputeAssociation> associations = new ArrayList<ComponentComputeAssociation>();
+    associations.add(association);
+    deploymentFlavor.setComponentComputeAssociations(associations);
+    deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavor);
+
+    DeploymentFlavorEntity createddeployment = vendorSoftwareProductManager.createDeploymentFlavor
+        (deploymentFlavorEntity, USER1);
+    Assert.assertEquals((createddeployment.getId() != null), true);
+    deployment1Id = createddeployment.getId();
+
+    final Collection<ListComputeResponse> actual =
+        vendorSoftwareProductManager.listCompute(vsp2Id, null, comp1Id, USER1);
+    Assert.assertEquals(actual.size(), 1);
+    actual.forEach(listComputeResponse -> {
+      Assert.assertEquals(listComputeResponse.isAssociatedWithDeploymentFlavor(), true);
+    } );
+  }
+
+  @Test
+  public void testUpdateNonExistingComponentId_negative() {
+    testUpdate_negative(vsp1Id, "non existing component id", USER1,
+        VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND);
+  }
+
+  @Test
+  public void testUpdateNonExistingVspId_negative() {
+    testUpdate_negative("non existing vsp id", comp1Id, USER1,
+        VersioningErrorCodes.VERSIONABLE_ENTITY_NOT_EXIST);
+  }
+
+  @Test
+  public void testDelete() {
+    ComputeEntity comp = createComputeEntity(vsp2Id,comp1Id,computeDelete);
+
+    ComputeEntity created = vendorSoftwareProductManager.createCompute(comp, USER1);
+
+    vendorSoftwareProductManager.deleteCompute(vsp2Id,comp1Id,created.getId(),USER1);
+    testGet_negative(vsp2Id,null, comp1Id, created.getId(),USER1,
+        VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND);
+  }
+
+  @Test
+  public void testDeleteNonExistingComputeId_negative() {
+    testDelete_negative(vsp2Id,comp1Id,"InvalidComputeId",USER1,
+        VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND);
+  }
+
+  @Test
+  public void testDeleteNonExistingComponentId_negative() {
+    testDelete_negative(vsp2Id,"InvalidComponentId",compute1Id,USER1,
+        VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND);
+  }
+
+  @Test
+  public void testDeleteNonExistingVspId_negative() {
+    testDelete_negative("InvalidVspId",comp1Id,compute1Id,USER1,
+        VersioningErrorCodes.VERSIONABLE_ENTITY_NOT_EXIST);
+  }
+
+  private void testGet(String vspId, Version version, String componentId, String computeId, String
+      user, ComputeEntity expected) {
+    CompositionEntityResponse<ComputeData>
+        response = vendorSoftwareProductManager.getCompute(vspId, null, componentId, computeId,
+        user);
+    Assert.assertEquals(response.getId(), expected.getId());
+    Assert.assertEquals(response.getData(), expected.getComputeCompositionData());
+    Assert.assertNotNull(response.getSchema());
+  }
+
+  private void testGet_negative(String vspId, Version version, String componentId, String computeId,
+                                String user, String expectedErrorCode) {
+    try {
+      vendorSoftwareProductManager.getCompute(vspId, version, componentId, computeId, user);
+      Assert.fail();
+    } catch (CoreException exception) {
+      Assert.assertEquals(exception.code().id(), expectedErrorCode);
+    }
+  }
+
+  private void testDelete_negative(String vspId, String componentId, String computeId, String user,
+                                   String expectedErrorCode){
+    try {
+      vendorSoftwareProductManager.deleteCompute(vspId, componentId, computeId, user);
+      Assert.fail();
+    }
+    catch(CoreException exception){
+      Assert.assertEquals(exception.code().id(), expectedErrorCode);
+    }
+  }
+
+  private void testUpdate_negative(String vspId, String componentId, String user,
+                                   String expectedErrorCode) {
+    try {
+      vendorSoftwareProductManager
+          .updateComponent(new ComponentEntity(vspId, null, componentId), user);
+      Assert.fail();
+    } catch (CoreException exception) {
+      Assert.assertEquals(exception.code().id(), expectedErrorCode);
+    }
+  }*/
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/DeploymentFlavorTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/DeploymentFlavorTest.java
new file mode 100644
index 0000000..e3fa0a8
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/DeploymentFlavorTest.java
@@ -0,0 +1,432 @@
+package org.openecomp.sdc.vendorsoftwareproduct;
+
+import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.CREATE_DEPLOYMENT_FLAVOR_NOT_ALLOWED_IN_HEAT_ONBOARDING;
+import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.DUPLICATE_DEPLOYMENT_FLAVOR_MODEL_NOT_ALLOWED;
+import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.FEATURE_GROUP_NOT_EXIST_FOR_VSP;
+import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.INVALID_COMPONENT_COMPUTE_ASSOCIATION;
+import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.INVALID_COMPUTE_FLAVOR_ID;
+import static org.openecomp.sdc.versioning.errors.VersioningErrorCodes.VERSIONABLE_ENTITY_NOT_EXIST;
+import static org.openecomp.sdc.versioning.errors.VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND;
+
+import org.openecomp.core.utilities.CommonMethods;
+import org.openecomp.sdc.common.errors.CoreException;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.DeploymentFlavorEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.impl.VendorSoftwareProductManagerImpl;
+import org.openecomp.sdc.vendorsoftwareproduct.services.schemagenerator.SchemaGenerator;
+import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentComputeAssociation;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityValidationData;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.DeploymentFlavor;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.testng.Assert;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+public class DeploymentFlavorTest {
+  /*private static final String USER1 = "deploymentTestUser1";
+  private static final String USER2 = "deploymentTestUser2";
+  private static final Version VERSION01 = new Version(0, 1);
+  private static final VendorSoftwareProductManager vendorSoftwareProductManager =
+      new VendorSoftwareProductManagerImpl();
+  private static final VendorSoftwareProductDao vendorSoftwareProductDao =
+      VendorSoftwareProductDaoFactory.getInstance().createInterface();
+
+  private static String vsp1Id;
+  private static String vsp2Id;
+  private static String vsp3Id;
+  private static String component11Id;
+  private static String component21Id;
+  private static String deployment1Id = "deployment1";
+  private static String deployment2Id = "deployment2";
+
+  @BeforeClass
+  private void init() {
+    List<String> featureGroups = new ArrayList<>();
+    featureGroups.add("fg01");
+    featureGroups.add("fg02");
+    vsp1Id = vendorSoftwareProductManager.createNewVsp(VSPCommon
+        .createVspDetails(null, null, "VSP_" + CommonMethods.nextUuId(), "Test-vsp1", "vendorName1",
+            "vlm1Id", "icon", "category", "subCategory", "123", featureGroups,
+            VSPCommon.OnboardingMethod.
+                Manual.name()), USER1).getId();
+    component11Id = ComponentsTest.createComponent(vsp1Id, VERSION01, "component11").getId();
+
+    vsp2Id = vendorSoftwareProductManager.createNewVsp(VSPCommon
+        .createVspDetails(null, null, "VSP_" + CommonMethods.nextUuId(), "Test-vsp2", "vendorName1",
+            "vlm1Id", "icon", "category", "subCategory", "123", null,
+            VSPCommon.OnboardingMethod.Manual.name()), USER1).getId();
+    component21Id = ComponentsTest.createComponent(vsp2Id, VERSION01, "component21").getId();
+
+    vsp3Id = vendorSoftwareProductManager.createNewVsp(VSPCommon
+        .createVspDetails(null, null, "VSP_" + CommonMethods.nextUuId(), "Test-vsp3forDeployment",
+            "vendorName1",
+            "vlm1Id", "icon", "category", "subCategory", "123", null,
+            VSPCommon.OnboardingMethod.HEAT.name()), USER1).getId();
+  }
+
+    static DeploymentFlavorEntity createDeploymentFlavor(String vspId, Version version, String deploymentFlavorId) {
+        DeploymentFlavorEntity deploymentFlavorEntity = new DeploymentFlavorEntity(vspId, version, deploymentFlavorId);
+        DeploymentFlavor deploymentFlavor = new DeploymentFlavor();
+        deploymentFlavor.setModel(deploymentFlavorId + " name");
+        deploymentFlavor.setDescription(deploymentFlavorId + " desc");
+        deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavor);
+        DeploymentFlavorEntity createdDeployment = vendorSoftwareProductManager
+                .createDeploymentFlavor(deploymentFlavorEntity, USER1);
+        deployment2Id = createdDeployment.getId();
+        return deploymentFlavorEntity;
+    }
+
+  @Test
+  public void testCreate() {
+    DeploymentFlavorEntity deploymentFlavorEntity =
+        new DeploymentFlavorEntity(vsp2Id, VERSION01, deployment1Id);
+    DeploymentFlavor deploymentFlavor = new DeploymentFlavor();
+    deploymentFlavor.setModel("TestDeploymentcreatewithoutFG");
+    deploymentFlavor.setDescription("creating a deployment flavor without any FG and any " +
+        "association");
+    deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavor);
+    DeploymentFlavorEntity createddeployment = vendorSoftwareProductManager.createDeploymentFlavor
+        (deploymentFlavorEntity, USER1);
+    Assert.assertEquals((createddeployment.getId() != null), true);
+    deployment1Id = createddeployment.getId();
+  }
+
+  @Test(dependsOnMethods = "testCreate")
+  public void testUniqueModelCreate() {
+    DeploymentFlavorEntity deploymentFlavorEntity =
+        new DeploymentFlavorEntity(vsp2Id, VERSION01, deployment1Id);
+    DeploymentFlavor deploymentFlavor = new DeploymentFlavor();
+    deploymentFlavor.setModel("TestDeploymentcreatewithoutFG");
+    deploymentFlavor.setDescription("creating a deployment flavor without any FG and any " +
+        "association");
+    deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavor);
+    try {
+      vendorSoftwareProductManager.createDeploymentFlavor
+          (deploymentFlavorEntity, USER1);
+    } catch (CoreException exception) {
+      Assert.assertEquals(exception.code().id(), DUPLICATE_DEPLOYMENT_FLAVOR_MODEL_NOT_ALLOWED);
+    }
+  }
+
+  @Test
+  public void testInvalidFeatureGroup() {
+    DeploymentFlavorEntity deploymentFlavorEntity =
+        new DeploymentFlavorEntity(vsp2Id, VERSION01, deployment1Id);
+    DeploymentFlavor deploymentFlavor = new DeploymentFlavor();
+    deploymentFlavor.setModel("TestInvalidFeatureGroup");
+    deploymentFlavor.setDescription("creating a deployment flavor with invalid FG and without any" +
+        " " +
+        "association");
+    deploymentFlavor.setFeatureGroupId("fg01");
+    deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavor);
+    try {
+      vendorSoftwareProductManager.createDeploymentFlavor
+          (deploymentFlavorEntity, USER1);
+    } catch (CoreException exception) {
+      Assert.assertEquals(exception.code().id(), FEATURE_GROUP_NOT_EXIST_FOR_VSP);
+    }
+  }
+
+  @Test
+  public void testInvalidAssociation() {
+    DeploymentFlavorEntity deploymentFlavorEntity =
+        new DeploymentFlavorEntity(vsp2Id, VERSION01, deployment1Id);
+    DeploymentFlavor deploymentFlavor = new DeploymentFlavor();
+    deploymentFlavor.setModel("testInvalidAssociation");
+    deploymentFlavor.setDescription("creating a deployment flavor with wrong association with " +
+        "null compute flavor id");
+    List<ComponentComputeAssociation> componentComputeAssociationList = new ArrayList<>();
+    ComponentComputeAssociation componentComputeAssociation = new ComponentComputeAssociation();
+    componentComputeAssociation.setComputeFlavorId("72138712");
+    componentComputeAssociationList.add(componentComputeAssociation);
+    deploymentFlavor.setComponentComputeAssociations(componentComputeAssociationList);
+    deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavor);
+    try {
+      vendorSoftwareProductManager.createDeploymentFlavor
+          (deploymentFlavorEntity, USER1);
+    } catch (CoreException exception) {
+      Assert.assertEquals(exception.code().id(), INVALID_COMPONENT_COMPUTE_ASSOCIATION);
+    }
+
+  }
+
+  @Test
+  public void testInvalidComputeFlavorIdAssociation() {
+    DeploymentFlavorEntity deploymentFlavorEntity =
+        new DeploymentFlavorEntity(vsp2Id, VERSION01, deployment1Id);
+    DeploymentFlavor deploymentFlavor = new DeploymentFlavor();
+    deploymentFlavor.setModel("testInvalidComputeFlavorIdAssociation");
+    deploymentFlavor.setDescription("creating a deployment flavor with wrong compute flavor id in" +
+        " assocation");
+    List<ComponentComputeAssociation> componentComputeAssociationList = new ArrayList<>();
+    ComponentComputeAssociation componentComputeAssociation = new ComponentComputeAssociation();
+    componentComputeAssociation.setComponentId(component21Id);
+    componentComputeAssociation.setComputeFlavorId("123123");
+    componentComputeAssociationList.add(componentComputeAssociation);
+    deploymentFlavor.setComponentComputeAssociations(componentComputeAssociationList);
+    deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavor);
+    try {
+      vendorSoftwareProductManager.createDeploymentFlavor
+          (deploymentFlavorEntity, USER1);
+    } catch (CoreException exception) {
+      Assert.assertEquals(exception.code().id(), INVALID_COMPUTE_FLAVOR_ID);
+    }
+
+  }
+
+  @Test
+  public void testInvalidVfcIdAssociation() {
+    DeploymentFlavorEntity deploymentFlavorEntity =
+        new DeploymentFlavorEntity(vsp2Id, VERSION01, deployment1Id);
+    DeploymentFlavor deploymentFlavor = new DeploymentFlavor();
+    deploymentFlavor.setModel("testInvalidVfcIdAssociation");
+    deploymentFlavor.setDescription("creating a deployment flavor with invalid vfcid association");
+    List<ComponentComputeAssociation> componentComputeAssociationList = new ArrayList<>();
+    ComponentComputeAssociation componentComputeAssociation = new ComponentComputeAssociation();
+    componentComputeAssociation.setComponentId("WRONGVFCID");
+    componentComputeAssociation.setComputeFlavorId("123123");
+    componentComputeAssociationList.add(componentComputeAssociation);
+    deploymentFlavor.setComponentComputeAssociations(componentComputeAssociationList);
+    deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavor);
+    try {
+      vendorSoftwareProductManager.createDeploymentFlavor
+          (deploymentFlavorEntity, USER1);
+    } catch (CoreException exception) {
+      Assert.assertEquals(exception.code().id(), VERSIONABLE_SUB_ENTITY_NOT_FOUND);
+    }
+  }
+
+  @Test
+  public void testNegativeforVspHeatOnboarded() {
+    DeploymentFlavorEntity deploymentFlavorEntity =
+        new DeploymentFlavorEntity(vsp3Id, VERSION01, deployment1Id);
+    DeploymentFlavor deploymentFlavor = new DeploymentFlavor();
+    deploymentFlavor.setModel("TestDeploymentcreatewithoutFG");
+    deploymentFlavor.setDescription("creating a deployment flavor for VSP onboarded with HEAT");
+    deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavor);
+    try {
+      vendorSoftwareProductManager.createDeploymentFlavor
+          (deploymentFlavorEntity, USER1);
+    } catch (CoreException exception) {
+      Assert.assertEquals(exception.code().id(),
+          CREATE_DEPLOYMENT_FLAVOR_NOT_ALLOWED_IN_HEAT_ONBOARDING);
+    }
+  }
+
+  @Test
+  public void testGetNegative_InvalidVspId(){
+      testGetNegative("InvalidVspId", VERSION01, deployment1Id, USER1, VERSIONABLE_ENTITY_NOT_EXIST);
+  }
+
+  @Test
+  public void testGetNegative_InvalidDeploymentFlavorId(){
+      testGetNegative(vsp1Id, VERSION01, deployment1Id, USER1, VERSIONABLE_SUB_ENTITY_NOT_FOUND);
+  }
+
+  @Test
+  public void testGet(){
+      DeploymentFlavorEntity expected = createDeploymentFlavor(vsp1Id, VERSION01,deployment2Id);
+      testGet(vsp1Id, VERSION01, deployment2Id, USER1, expected);
+  }
+
+  private void testGet(String vspId, Version version, String componentId, String user,
+                       DeploymentFlavorEntity expected) {
+      CompositionEntityResponse<DeploymentFlavor> response = vendorSoftwareProductManager
+              .getDeploymentFlavor(vspId, null, componentId, user);
+      Assert.assertEquals(response.getId(), expected.getId());
+      Assert.assertEquals(response.getData().getDescription(),
+              expected.getDeploymentFlavorCompositionData().getDescription());
+      Assert.assertEquals(response.getData().getModel(),
+              expected.getDeploymentFlavorCompositionData().getModel());
+      Assert.assertEquals(response.getData().getFeatureGroupId(),
+              expected.getDeploymentFlavorCompositionData().getFeatureGroupId());
+      Assert.assertEquals(response.getData().getComponentComputeAssociations(),
+              expected.getDeploymentFlavorCompositionData().getComponentComputeAssociations());
+      Assert.assertNotNull(response.getSchema());
+  }
+
+  private void testGetNegative(String vspId, Version version, String deploymentFlavorId, String User,
+                               String expectedErrorCode){
+      try{
+          vendorSoftwareProductManager.getDeploymentFlavor(vspId, version, deploymentFlavorId, User);
+          Assert.fail();
+      } catch (CoreException exception){
+          Assert.assertEquals(exception.code().id(), expectedErrorCode);
+      }
+  }
+
+  @Test
+  public void testUpdateNegative_InvalidVspId(){
+    DeploymentFlavorEntity deploymentFlavorEntity = new DeploymentFlavorEntity("InvalidVspId",
+            VERSION01,deployment2Id);
+    DeploymentFlavor deploymentFlavorData = new DeploymentFlavor();
+    deploymentFlavorData.setModel(deployment2Id);
+    deploymentFlavorData.setDescription("updating a deployment flavor with invalid VspId and without any" +
+            "association");
+    deploymentFlavorData.setFeatureGroupId("fg01");
+    deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavorData);
+
+    testUpdateNegative(deploymentFlavorEntity, USER1, VERSIONABLE_ENTITY_NOT_EXIST);
+  }
+
+  @Test
+  public void testUpdateNegative_InvalidDeploymentFlavorId(){
+    DeploymentFlavorEntity deploymentFlavorEntity = new DeploymentFlavorEntity(vsp1Id,
+            VERSION01,"InvalidDeploymentFlavorId");
+    testUpdateNegative(deploymentFlavorEntity, USER1, VERSIONABLE_SUB_ENTITY_NOT_FOUND);
+  }
+
+  @Test(dependsOnMethods = "testCreate")
+  public void testUpdateNegative_InvalidFeatureGroup(){
+    DeploymentFlavorEntity deploymentFlavorEntity = new DeploymentFlavorEntity(vsp2Id,
+            VERSION01,deployment1Id);
+    DeploymentFlavor deploymentFlavorData = new DeploymentFlavor();
+    deploymentFlavorData.setModel("TestDeploymentCreateWithoutFG");
+    deploymentFlavorData.setDescription("updating a deployment flavor with invalid FeatureGroupId and without any" +
+            "association");
+    deploymentFlavorData.setFeatureGroupId("fg01");
+    deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavorData);
+    String expectedError = "#/featureGroupId: "
+            +deploymentFlavorData.getFeatureGroupId()+" is not a valid value. Possible values: ";
+
+      final CompositionEntityValidationData validationData = vendorSoftwareProductManager
+              .updateDeploymentFlavor(deploymentFlavorEntity, USER1);
+      final Collection<String> errors = validationData.getErrors();
+      final Object[] objects = errors.toArray();
+      Assert.assertEquals(errors.size(), 1);
+      Assert.assertEquals(objects[0], expectedError);
+  }
+
+  @Test(dependsOnMethods = "testCreate")
+  public void testUpdateNegative_InvalidComputeFlavorIdAssociation(){
+    DeploymentFlavorEntity deploymentFlavorEntity = new DeploymentFlavorEntity(vsp2Id,
+            VERSION01,deployment1Id);
+    DeploymentFlavor deploymentFlavorData = new DeploymentFlavor();
+    deploymentFlavorData.setModel("TestDeploymentcreatewithInvalidComputFlavorId");
+    deploymentFlavorData.setDescription("updating a deployment flavor with wrong compute flavor id in" +
+            " assocation");
+    List<ComponentComputeAssociation> componentComputeAssociationList = new ArrayList<>();
+    ComponentComputeAssociation componentComputeAssociation = new ComponentComputeAssociation();
+    componentComputeAssociation.setComponentId(component21Id);
+    componentComputeAssociation.setComputeFlavorId("123123");
+    componentComputeAssociationList.add(componentComputeAssociation);
+    deploymentFlavorData.setComponentComputeAssociations(componentComputeAssociationList);
+    deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavorData);
+
+    testUpdateNegative(deploymentFlavorEntity, USER1, INVALID_COMPUTE_FLAVOR_ID);
+  }
+
+  @Test
+  public void testUpdate(){
+    //Creating a separate deployment flavor for testing deletion
+    DeploymentFlavorEntity deploymentFlavorEntity =
+            new DeploymentFlavorEntity(vsp1Id, VERSION01, deployment2Id);
+    DeploymentFlavor deploymentFlavor = new DeploymentFlavor();
+    deploymentFlavor.setModel("TestDeploymentCreateforUpdate");
+    deploymentFlavor.setDescription("creating a deployment flavor for updation");
+    deploymentFlavor.setFeatureGroupId("fg01");
+    deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavor);
+    DeploymentFlavorEntity createdDeployment = vendorSoftwareProductManager.createDeploymentFlavor
+            (deploymentFlavorEntity, USER1);
+    deployment2Id = createdDeployment.getId();
+
+    final DeploymentFlavor deploymentFlavorCompositionData = createdDeployment.getDeploymentFlavorCompositionData();
+    deploymentFlavorCompositionData.setModel("TestDeploymentCreateforUpdate"); //no change
+    deploymentFlavorCompositionData.setDescription("updating deployment flavor"); //allow change
+    deploymentFlavorCompositionData.setFeatureGroupId("fg01"); //no change
+    createdDeployment.setDeploymentFlavorCompositionData(deploymentFlavorCompositionData);
+
+    vendorSoftwareProductManager.updateDeploymentFlavor(createdDeployment, USER1);
+    CompositionEntityResponse<DeploymentFlavor> deploymentFlavorCompositionEntityResponse = vendorSoftwareProductManager
+            .getDeploymentFlavor(vsp1Id, VERSION01, deployment2Id, USER1);
+    final DeploymentFlavor data = deploymentFlavorCompositionEntityResponse.getData();
+
+    Assert.assertEquals(
+            data.getDescription(),createdDeployment.getDeploymentFlavorCompositionData().getDescription());
+  }
+
+  @Test
+  public void testUpdateVspWithNoFeatureGroup(){
+      //Creating a separate deployment flavor for testing deletion
+      DeploymentFlavorEntity deploymentFlavorEntity = new DeploymentFlavorEntity(vsp2Id, VERSION01, deployment1Id);
+      DeploymentFlavor deploymentFlavor = new DeploymentFlavor();
+      deploymentFlavor.setModel("TestDeploymentCreateforUpdate");
+      deploymentFlavor.setDescription("creating a deployment flavor for updation");
+      deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavor);
+      DeploymentFlavorEntity createdDeployment = vendorSoftwareProductManager
+              .createDeploymentFlavor(deploymentFlavorEntity, USER1);
+      deployment1Id = createdDeployment.getId();
+
+      final DeploymentFlavor deploymentFlavorCompositionData = createdDeployment.getDeploymentFlavorCompositionData();
+      deploymentFlavorCompositionData.setModel("TestDeploymentCreateforUpdate"); //no change
+      deploymentFlavorCompositionData.setDescription("updating deployment flavor"); //allow change
+      createdDeployment.setDeploymentFlavorCompositionData(deploymentFlavorCompositionData);
+
+      vendorSoftwareProductManager.updateDeploymentFlavor(createdDeployment, USER1);
+      CompositionEntityResponse<DeploymentFlavor> deploymentFlavorCompositionEntityResponse =
+              vendorSoftwareProductManager.getDeploymentFlavor(vsp2Id, VERSION01, deployment1Id, USER1);
+      final DeploymentFlavor data = deploymentFlavorCompositionEntityResponse.getData();
+
+      Assert.assertEquals(data.getDescription(),createdDeployment.getDeploymentFlavorCompositionData()
+              .getDescription());
+    }
+
+  private void testUpdateNegative(DeploymentFlavorEntity deploymentFlavorEntity, String user,
+                                   String expectedErrorCode) {
+    try {
+      vendorSoftwareProductManager
+              .updateDeploymentFlavor(deploymentFlavorEntity, user);
+      System.out.print("updated");
+      Assert.fail();
+    } catch (CoreException exception) {
+      Assert.assertEquals(exception.code().id(), expectedErrorCode);
+    }
+  }
+
+  @Test
+  public void testDelete(){
+      //Creating a separate deployment flavor for testing deletion
+      DeploymentFlavorEntity deploymentFlavorEntity =
+              new DeploymentFlavorEntity(vsp2Id, VERSION01, deployment2Id);
+      DeploymentFlavor deploymentFlavor = new DeploymentFlavor();
+      deploymentFlavor.setModel("TestDeploymentcreateWithoutFG");
+      deploymentFlavor.setDescription("creating a deployment flavor without any FG and any " +
+              "association");
+      deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavor);
+      DeploymentFlavorEntity createddeployment = vendorSoftwareProductManager.createDeploymentFlavor
+              (deploymentFlavorEntity, USER1);
+      deployment2Id = createddeployment.getId();
+      vendorSoftwareProductManager.deleteDeploymentFlavor(vsp2Id, deployment2Id, USER1);
+      testDeleteNegative(vsp2Id, deployment2Id, USER1,
+              VERSIONABLE_SUB_ENTITY_NOT_FOUND);
+  }
+
+  @Test
+  public void testDeleteNegative_InvalidVspId(){
+    testDeleteNegative("InvalidVspId", deployment2Id, USER1,
+            VERSIONABLE_ENTITY_NOT_EXIST);
+  }
+
+  @Test
+  public void testDeleteNegative_NonExistingDeploymentFlavorId(){
+    testDeleteNegative(vsp2Id, "NonExistingDeploymentFlavorId", USER1,
+            VERSIONABLE_SUB_ENTITY_NOT_FOUND);
+  }
+
+  private void testDeleteNegative(String vspId, String deploymentId, String user,
+                                   String expectedErrorCode) {
+    try {
+      vendorSoftwareProductManager
+              .deleteDeploymentFlavor(vspId, deploymentId, user);
+      Assert.fail();
+    } catch (CoreException exception) {
+      Assert.assertEquals(exception.code().id(), expectedErrorCode);
+    }
+  }*/
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/ImagesTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/ImagesTest.java
new file mode 100644
index 0000000..afd7975
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/ImagesTest.java
@@ -0,0 +1,463 @@
+package org.openecomp.sdc.vendorsoftwareproduct;
+
+import org.openecomp.core.utilities.CommonMethods;
+import org.openecomp.core.utilities.json.JsonUtil;
+import org.openecomp.sdc.common.errors.CoreException;
+import org.openecomp.sdc.common.errors.ErrorCode;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ImageEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
+import org.openecomp.sdc.vendorsoftwareproduct.errors.ImageErrorBuilder;
+import org.openecomp.sdc.vendorsoftwareproduct.errors.NotSupportedHeatOnboardMethodErrorBuilder;
+import org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes;
+import org.openecomp.sdc.vendorsoftwareproduct.impl.VendorSoftwareProductManagerImpl;
+import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse;
+import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireResponse;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Image;
+import org.openecomp.sdc.vendorsoftwareproduct.types.questionnaire.component.image.ImageDetails;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdc.versioning.errors.VersioningErrorCodes;
+import org.testng.Assert;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import java.util.Collection;
+
+public class ImagesTest {
+
+  /*private static final String USER1 = "imageTestUser1";
+  private static final String USER2 = "imageTestUser2";
+  private static final Version VERSION01 = new Version(0, 1);
+  private static final VendorSoftwareProductManager vendorSoftwareProductManager =
+      new VendorSoftwareProductManagerImpl();
+  private static final VendorSoftwareProductDao vendorSoftwareProductDao =
+      VendorSoftwareProductDaoFactory
+          .getInstance().createInterface();
+
+  private static String image1Id;
+
+
+  private static String comp1 = "{\"displayName\": \"VFC_Manual\", " +
+      "\"description\": \"desc manual\"}";
+
+  private static String vsp1Id;
+  private static String vsp2Id;
+  private static String vsp3Id;
+  private static String comp1Id;
+
+  private static String image2Id;
+
+  @BeforeClass
+  private void init() {
+    VspDetails
+        vsp1 = vendorSoftwareProductManager.createNewVsp(VSPCommon
+        .createVspDetails(null, null, "VSP_" + CommonMethods.nextUuId(), "Test-vsp1", "vendorName",
+            "vlm1Id", "icon", "category", "subCategory", "123", null,
+            VSPCommon.OnboardingMethod.Manual.name()), USER1
+        );
+    vsp1Id = vsp1.getId();
+
+    VspDetails vsp2 = vendorSoftwareProductManager.createNewVsp(VSPCommon
+        .createVspDetails(null, null, "VSP_" + CommonMethods.nextUuId(), "Test-vsp2", "vendorName",
+            "vlm1Id", "icon", "category", "subCategory", "123", null, VSPCommon.OnboardingMethod.
+                Manual.name()), USER1);
+    vsp2Id = vsp2.getId();
+
+    VspDetails vsp3 = vendorSoftwareProductManager.createNewVsp(VSPCommon
+        .createVspDetails(null, null, "VSP_" + CommonMethods.nextUuId(), "Test-vsp3",
+            "vendorName",
+            "vlm1Id", "icon", "category", "subCategory", "123", null, VSPCommon
+                .OnboardingMethod.HEAT.name()), USER1);
+    vsp3Id = vsp3.getId();
+
+    ComponentEntity comp = new ComponentEntity();
+    comp.setVspId(vsp2Id);
+    comp.setCompositionData(comp1);
+    ComponentEntity createdComp = vendorSoftwareProductManager.createComponent(comp, USER1);
+    comp1Id = createdComp.getId();
+  }
+
+  @Test
+  public void testListImagesNonExistingVspId_negative() {
+    testList_negative("non existing vsp id", null, image1Id, USER1,
+        VersioningErrorCodes.VERSIONABLE_ENTITY_NOT_EXIST,
+        "Versionable entity VendorSoftwareProduct with id non existing vsp id does not exist." );
+  }
+
+  @Test
+  public void testListImagesNonExistingVfcId_negative() {
+    testList_negative(vsp1Id, VERSION01, "444", USER1,
+        VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND,
+        "Vendor Software Product Component with Id 444 does not exist for Vendor Software Product "
+            + "with id "+vsp1Id+ " and version "+VERSION01);
+  }
+
+  @Test
+  public void testListImages() {
+    createImageEntity("media-vsrx-vmdisk-15.1X49-D40.6.aki", "aki");
+    createImageEntity("riverbed-15.1X49-D40.6.vdi", "vdi");
+    final Collection<ImageEntity> imageEntities =
+        vendorSoftwareProductManager.listImages(vsp2Id, VERSION01, comp1Id, USER1);
+    System.out.println("size::"+imageEntities.size());
+  }
+
+  @Test
+  public void testCreateNonExistingVspId_negative() {
+    testCreate_negative(new ImageEntity("non existing vsp id", null, null, null), USER1,
+        VersioningErrorCodes.VERSIONABLE_ENTITY_NOT_EXIST,
+        "Versionable entity VendorSoftwareProduct with id non existing vsp id does not exist.");
+  }
+
+  @Test
+  public void testCreateNonExistingVfcId_negative() {
+    testCreate_negative(new ImageEntity(vsp1Id, VERSION01, "222", null), USER1,
+        VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND,
+        "Vendor Software Product Component with Id 222 does not exist for Vendor Software Product "
+            + "with id "+vsp1Id + " and version "+VERSION01);
+  }
+
+  @Test(dependsOnMethods = "testUpdateNonExistingImageId_negative")
+  public void testCreateOnAvailableVsp_negative() {
+    vendorSoftwareProductManager.checkin(vsp1Id, USER1);
+    testCreate_negative(new ImageEntity(vsp1Id, null, null, null), USER1,
+        VersioningErrorCodes.EDIT_ON_UNLOCKED_ENTITY,
+        "Can not edit versionable entity VendorSoftwareProduct with id "+vsp1Id+ " since it is not"
+            + " checked out.");
+  }
+
+  @Test(dependsOnMethods = "testCreateOnAvailableVsp_negative")
+  public void testCreateOnVspOtherUser_negative() {
+    vendorSoftwareProductManager.checkout(vsp1Id, USER1);
+    testCreate_negative(new ImageEntity(vsp1Id, null, null, null), USER2,
+        VersioningErrorCodes.EDIT_ON_ENTITY_LOCKED_BY_OTHER_USER,
+        "Versionable entity VendorSoftwareProduct with id " +vsp1Id+
+            " can not be edited since it is locked by other user "+ USER1+ ".");
+  }
+
+  @Test(dependsOnMethods = "testCreateOnVspOtherUser_negative")
+  public void testOnUndoCheckoutImagesDeleted() {
+
+    ComponentEntity comp = new ComponentEntity();
+    comp.setVspId(vsp1Id);
+    comp.setCompositionData(comp1);
+    ComponentEntity createdComp = vendorSoftwareProductManager.createComponent(comp, USER1);
+    String compId = createdComp.getId();
+
+    vendorSoftwareProductManager.checkin(vsp1Id, USER1);
+    vendorSoftwareProductManager.checkout(vsp1Id, USER1);
+
+    for(int i = 1; i<=3; i++) {
+      ImageEntity imageEntity = new ImageEntity();
+      imageEntity.setVspId(vsp1Id);
+      imageEntity.setComponentId(compId);
+      Image image = new Image();
+      image.setFileName(i + "testimage.aki");
+      //image.setVersion("9.2.0");
+      image.setDescription("riverbed image");
+      //image.setFormat("aki");
+      //image.setMd5("233343DDDD");
+      imageEntity.setImageCompositionData(image);
+      ImageEntity createdImage = vendorSoftwareProductManager.createImage(imageEntity, USER1);
+    }
+
+    Collection<ImageEntity> imageEntities =
+        vendorSoftwareProductManager.listImages(vsp1Id, null, compId, USER1);
+
+    Assert.assertEquals(imageEntities.size(), 3);
+
+    vendorSoftwareProductManager.undoCheckout(vsp1Id, USER1);
+
+    imageEntities = vendorSoftwareProductManager.listImages(vsp1Id, null, compId, USER1);
+
+    Assert.assertEquals(imageEntities.size(), 0);
+  }
+
+  @Test
+  public void testCreateOnHeatVsp_negative() {
+    final ErrorCode addImageNotSupportedHeatOnboardMethodErrorBuilder =
+        NotSupportedHeatOnboardMethodErrorBuilder
+            .getAddImageNotSupportedHeatOnboardMethodErrorBuilder();
+    testCreate_negative(new ImageEntity(vsp3Id, null, null, null), USER1,
+        addImageNotSupportedHeatOnboardMethodErrorBuilder.id(),
+        addImageNotSupportedHeatOnboardMethodErrorBuilder.message()
+        );
+  }
+
+  @Test(dependsOnMethods = "testListImages")
+  public void testCreateImage() {
+    ImageEntity createdImage = createImageEntity("riverbed-WX-IMG-9.2.0.qcow2", "qcow2");
+    Assert.assertNotNull(image1Id);
+    Assert.assertNotNull(createdImage.getCompositionData());
+    Assert.assertNotNull(
+        vendorSoftwareProductManager.getImage(vsp2Id, VERSION01, comp1Id,image1Id,
+            USER1).getData());
+  }
+
+  @Test(dependsOnMethods = "testCreateImage")
+  public void testCreateDupImageNameForSameComponent_negative() {
+    ImageEntity createdImage = null;
+    try {
+      createdImage = createImageEntity("riverbed-WX-IMG-9.2.0.qcow2", "qcow2");
+      Assert.fail();
+    }
+    catch(CoreException exception) {
+      Assert.assertEquals(exception.code().id(), VendorSoftwareProductErrorCodes.
+          DUPLICATE_IMAGE_NAME_NOT_ALLOWED);
+      Assert.assertEquals(exception.getMessage(),
+          String.format("Invalid request, Image with name riverbed-WX-IMG-9.2.0.qcow2 already " +
+              "exists for component with ID "+comp1Id)+".");
+    }
+  }
+
+  @Test
+  public void testGet() {
+    ImageEntity createdImage = createImageEntity("read-riverbed-WX-IMG-9.2.0.qcow2", "qcow2");
+    testGet(vsp2Id, VERSION01, comp1Id, createdImage.getId(), USER1, createdImage);
+  }
+
+  @Test
+  public void testGetNonExistingVspId_negative() {
+    testGet_negative("non existing vsp id", null, null, image1Id, USER1,
+        VersioningErrorCodes.VERSIONABLE_ENTITY_NOT_EXIST,
+        "Versionable entity VendorSoftwareProduct with id non existing vsp id does not exist." );
+  }
+
+  @Test
+  public void testGetNonExistingVfcId_negative() {
+    testGet_negative(vsp1Id, VERSION01, "111", null, USER1,
+        VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND,
+        "Vendor Software Product Component with Id 111 does not exist for Vendor Software Product "
+            + "with id "+vsp1Id + " and version "+VERSION01);
+  }
+
+  @Test
+  public void testUpdateNonExistingVspId_negative() {
+    ImageEntity imageEntity = new ImageEntity("non existing vsp id", null, null, image1Id);
+
+    testUpdate_negative(imageEntity, USER1,
+        VersioningErrorCodes.VERSIONABLE_ENTITY_NOT_EXIST,
+        "Versionable entity VendorSoftwareProduct with id non existing vsp id does not exist." );
+  }
+
+  @Test(dependsOnMethods =  "testUpdateNonExistingVspId_negative")
+  public void testUpdateNonExistingVfcId_negative() {
+    ImageEntity imageEntity = new ImageEntity(vsp1Id, VERSION01, "111", null);
+
+    testUpdate_negative(imageEntity, USER1,
+        VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND,
+        "Vendor Software Product Component with Id 111 does not exist for Vendor Software Product "
+            + "with id "+vsp1Id + " and version "+VERSION01);
+  }
+
+  @Test(dependsOnMethods =  "testUpdateNonExistingVfcId_negative")
+  public void testUpdateNonExistingImageId_negative() {
+    ImageEntity imageEntity = new ImageEntity(vsp2Id, VERSION01, comp1Id, "222");
+
+    testUpdate_negative(imageEntity, USER1,
+        VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND,
+        "Vendor Software Product Component Image with Id 222 does not exist for Vendor " +
+            "Software Product with id "+vsp2Id+ " and version "+VERSION01 );
+  }
+
+  @Test(dependsOnMethods = "testCreateImage")
+  public void testUpdate() {
+    ImageEntity imageEntity = createImageEntity("testimage1","qcow2");
+    testGet(vsp2Id, VERSION01, comp1Id, imageEntity.getId(),USER1, imageEntity );
+
+    final Image imageCompositionData = imageEntity.getImageCompositionData();
+    //imageCompositionData.setVersion("10.0");
+    imageCompositionData.setDescription("updated image");
+
+    vendorSoftwareProductManager.updateImage(imageEntity, USER1);
+
+    testGet(vsp2Id, VERSION01, comp1Id, imageEntity.getId(),USER1, imageEntity );
+    image2Id = imageEntity.getId();
+  }
+
+  @Test(dependsOnMethods = "testUpdate")
+  public void testUpdateNegative_UniqueName() {
+    final CompositionEntityResponse<Image> image =
+        vendorSoftwareProductManager.getImage(vsp2Id, VERSION01, comp1Id,
+            image2Id, USER1);
+    final Image data = image.getData();
+
+    final Image imageCompositionData = data;
+    imageCompositionData.setFileName("riverbed-WX-IMG-9.2.0.qcow2");
+
+    ImageEntity entity = new ImageEntity(vsp2Id, VERSION01, comp1Id, image2Id );
+    entity.setImageCompositionData(imageCompositionData);
+    testUpdate_negative(entity, USER1, ImageErrorBuilder.getDuplicateImageNameErrorBuilder(
+        "riverbed-WX-IMG-9.2.0.qcow2", comp1Id).id()
+        ,ImageErrorBuilder.getDuplicateImageNameErrorBuilder("riverbed-WX-IMG-9.2.0.qcow2", comp1Id)
+            .message() );
+  }
+
+  @Test(dependsOnMethods = "testUpdateNegative_UniqueName")
+  public void testDeleteImage() {
+    CompositionEntityResponse<Image> image =
+        vendorSoftwareProductManager.getImage(vsp2Id, VERSION01, comp1Id, image2Id, USER1);
+
+    Assert.assertNotNull(image.getData());
+
+    vendorSoftwareProductManager.deleteImage(vsp2Id, comp1Id, image2Id, USER1);
+
+    testGet_negative(vsp2Id, VERSION01, comp1Id, image2Id, USER1,
+        VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND,
+        "Vendor Software Product Component Image with Id "+image2Id+ " does not exist for " +
+            "Vendor Software Product with id "+vsp2Id+ " and version "+VERSION01 );
+
+  }
+
+  @Test
+  public void testDeleteNonExistingVspId_negative() {
+    ImageEntity imageEntity = new ImageEntity("non existing vsp id", null, null, image1Id);
+
+    testDelete_negative(imageEntity, USER1,
+        VersioningErrorCodes.VERSIONABLE_ENTITY_NOT_EXIST,
+        "Versionable entity VendorSoftwareProduct with id non existing vsp id does not exist." );
+  }
+
+  @Test(dependsOnMethods =  "testDeleteNonExistingVspId_negative")
+  public void testDeleteNonExistingVfcId_negative() {
+    ImageEntity imageEntity = new ImageEntity(vsp1Id, VERSION01, "111", null);
+
+    testDelete_negative(imageEntity, USER1,
+        VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND,
+        "Vendor Software Product Component with Id 111 does not exist for Vendor Software Product "
+            + "with id "+vsp1Id + " and version "+VERSION01);
+  }
+
+  @Test(dependsOnMethods =  "testDeleteNonExistingVfcId_negative")
+  public void testDeleteNonExistingImageId_negative() {
+    ImageEntity imageEntity = new ImageEntity(vsp2Id, VERSION01, comp1Id, "222");
+
+    testDelete_negative(imageEntity, USER1,
+        VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND,
+        "Vendor Software Product Component Image with Id 222 does not exist for Vendor " +
+            "Software Product with id "+vsp2Id+ " and version "+VERSION01 );
+  }
+
+  @Test
+  public void testUpdateandGetQuestionnaire() {
+    ImageEntity imageEntity = createImageEntity("newimage_testUpdateandGetQuestionnaire.vdi","vdi");
+    vendorSoftwareProductManager.updateImageQuestionnaire(vsp2Id, comp1Id, imageEntity.getId(),
+        "{\"format\":\"vdi\",\"version\":\"1.2\",\"md5\":\"ssd3344\"}",
+        USER1);
+
+    final QuestionnaireResponse imageQuestionnaire =
+        vendorSoftwareProductManager.getImageQuestionnaire(vsp2Id, VERSION01, comp1Id,
+            imageEntity.getId(), USER1);
+
+    String imageDetails = imageQuestionnaire.getData();
+    Assert.assertEquals("vdi", JsonUtil.json2Object(imageDetails, ImageDetails.class).getFormat());
+    Assert.assertEquals("1.2", JsonUtil.json2Object(imageDetails, ImageDetails.class).getVersion());
+    Assert.assertEquals("ssd3344", JsonUtil.json2Object(imageDetails, ImageDetails.class).getMd5());
+  }
+
+  @Test
+  public void testUpdateQuestionnaireInvalidFormat_negative() {
+    ImageEntity imageEntity = createImageEntity("newimage.vdi","vdi");
+    try {
+      vendorSoftwareProductManager.updateImageQuestionnaire(vsp2Id, comp1Id, imageEntity.getId(),
+          "{\"format\":\"invalidformat\",\"version\":\"1.2\",\"md5\":\"ssd3344\"}",
+          USER1);
+      Assert.fail();
+    }
+    catch(CoreException exception) {
+      Assert.assertEquals(exception.code().id(), "VFC_IMAGE_INVALID_FORMAT");
+      Assert.assertEquals(exception.getMessage(), "The format value doesn't meet the expected "
+          + "attribute value.");
+    }
+  }
+
+  private ImageEntity createImageEntity(String fileName, String format) {
+    ImageEntity imageEntity = new ImageEntity();
+    imageEntity.setVspId(vsp2Id);
+    imageEntity.setComponentId(comp1Id);
+    Image image = new Image();
+    image.setFileName(fileName);
+    //image.setVersion("9.2.0");
+    image.setDescription("riverbed image");
+    //image.setFormat(format);
+    // image.setMd5("233343DDDD");
+    imageEntity.setImageCompositionData(image);
+
+    ImageEntity createdImage = vendorSoftwareProductManager.createImage(imageEntity, USER1);
+    image1Id = createdImage.getId();
+    return createdImage;
+  }
+
+  private void testGet(String vspId, Version version, String componentId, String imageId, String
+      user, ImageEntity expected) {
+    CompositionEntityResponse<Image>
+        response = vendorSoftwareProductManager.getImage(vspId, null, componentId, imageId, user);
+    Assert.assertEquals(response.getId(), expected.getId());
+    Assert.assertEquals(expected.getImageCompositionData().getFileName(), response.getData().
+        getFileName());
+    Assert.assertEquals(expected.getImageCompositionData().getDescription(), response.getData().
+        getDescription());
+    Assert.assertNotNull(response.getSchema());
+  }
+
+  private void testCreate_negative(ImageEntity image, String user,
+                                   String expectedErrorCode, String expectedErrorMsg) {
+    try {
+      vendorSoftwareProductManager.createImage(image, user);
+      Assert.fail();
+    } catch (CoreException exception) {
+      Assert.assertEquals(exception.code().id(), expectedErrorCode);
+      Assert.assertEquals(exception.getMessage(), expectedErrorMsg);
+    }
+  }
+
+  private void testGet_negative(String vspId, Version version, String componentId, String imageId,
+                                String user,
+                                String expectedErrorCode, String expectedErrorMsg) {
+    try {
+      vendorSoftwareProductManager.getImage(vspId, version, componentId, imageId, user);
+      Assert.fail();
+    } catch (CoreException exception) {
+      Assert.assertEquals(exception.code().id(), expectedErrorCode);
+      Assert.assertEquals(exception.getMessage(), expectedErrorMsg);
+    }
+  }
+
+  private void testList_negative(String vspId, Version version, String componentId, String user,
+                                 String expectedErrorCode, String expectedErrorMsg) {
+    try {
+      vendorSoftwareProductManager.listImages(vspId, version, componentId, user);
+      Assert.fail();
+    } catch (CoreException exception) {
+      Assert.assertEquals(exception.code().id(), expectedErrorCode);
+      Assert.assertEquals(exception.getMessage(), expectedErrorMsg);
+    }
+  }
+
+  private void testUpdate_negative(ImageEntity imageEntity,
+                                String user,
+                                String expectedErrorCode, String expectedErrorMsg) {
+    try {
+
+      vendorSoftwareProductManager.updateImage(imageEntity, user);
+      Assert.fail();
+    } catch (CoreException exception) {
+      Assert.assertEquals(exception.code().id(), expectedErrorCode);
+      Assert.assertEquals(exception.getMessage(), expectedErrorMsg);
+    }
+  }
+
+  private void testDelete_negative(ImageEntity imageEntity,
+                                   String user,
+                                   String expectedErrorCode, String expectedErrorMsg) {
+    try {
+
+      vendorSoftwareProductManager.updateImage(imageEntity, user);
+      Assert.fail();
+    } catch (CoreException exception) {
+      Assert.assertEquals(exception.code().id(), expectedErrorCode);
+      Assert.assertEquals(exception.getMessage(), expectedErrorMsg);
+    }
+  }*/
+}
\ No newline at end of file
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/VSPFullTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/VSPFullTest.java
index d4dea70..be2de13 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/VSPFullTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/VSPFullTest.java
@@ -20,43 +20,6 @@
 
 package org.openecomp.sdc.vendorsoftwareproduct;
 
-import org.apache.commons.collections4.MapUtils;
-import org.apache.commons.io.IOUtils;
-import org.openecomp.core.enrichment.types.ArtifactType;
-import org.openecomp.core.model.dao.EnrichedServiceModelDaoFactory;
-import org.openecomp.core.util.UniqueValueUtil;
-import org.openecomp.core.utilities.CommonMethods;
-import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
-import org.openecomp.sdc.tosca.datatypes.model.CapabilityDefinition;
-import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity;
-import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity;
-import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementEntity;
-import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade;
-import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacadeFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
-import org.openecomp.sdc.vendorsoftwareproduct.types.ValidationResponse;
-import org.openecomp.sdc.vendorsoftwareproduct.types.VersionedVendorSoftwareProductInfo;
-import org.openecomp.sdc.vendorsoftwareproduct.utils.VSPCommon;
-import org.openecomp.sdc.versioning.dao.types.Version;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-import java.util.stream.Collectors;
-
 public class VSPFullTest {
 /*
 
@@ -71,7 +34,7 @@
   private static VendorLicenseFacade vendorLicenseFacade =
       VendorLicenseFacadeFactory.getInstance().createInterface();
   private OrchestrationTemplateCandidateManager candidateManager;
-  private MibManager mibManager;
+  private MonitoringUploadsManager mibManager;
   private NicManager nicManager;
 
   @Test
@@ -106,7 +69,7 @@
     mibManager
         .upload(zis1, "MMSC.zip", vspId, VERSION01,
             components.iterator().next().getId(),
-            ArtifactType.SNMP_TRAP,
+            MonitoringUploadType.SNMP_TRAP,
             USER1);
 
     //check in
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerImplTest.java
index 34af0e6..7cfcb05 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerImplTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerImplTest.java
@@ -8,6 +8,7 @@
 import org.openecomp.sdc.common.errors.CoreException;
 import org.openecomp.sdc.vendorsoftwareproduct.NicManager;
 import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity;
 import org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes;
@@ -24,6 +25,7 @@
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 
@@ -47,6 +49,8 @@
   private CompositionEntityDataManager compositionEntityDataManagerMock;
   @Mock
   private NicManager nicManagerMock;
+  @Mock
+  private VendorSoftwareProductInfoDao vspInfoDao;
   @InjectMocks
   @Spy
   private ComponentManagerImpl componentManager;
@@ -95,25 +99,102 @@
 /*    @Test
     public void testCreate() {
         COMP1_ID = testCreate(VSP_ID);
-    }
-
-    private String testCreate(String VSP_ID) {
-        ComponentEntity expected = new ComponentEntity(VSP_ID, null, null);
-        ComponentData compData = new ComponentData();
-        compData.setName("comp1 name");
-        compData.setDescription("comp1 desc");
-        expected.setComponentCompositionData(compData);
-
-        ComponentEntity created = componentManager.createComponent(expected, USER);
-        Assert.assertNotNull(created);
-        expected.setId(created.getId());
-        expected.setVersion(VERSION);
-
-        ComponentEntity actual = componentDaoMock.getComponent(VSP_ID, VERSION, created.getId());
-
-        Assert.assertEquals(actual, expected);
-        return created.getId();
     }*/
+  @Test
+  public void testCreate() {
+    ComponentEntity expected = new ComponentEntity(VSP_ID, null, null);
+    ComponentData compData = new ComponentData();
+    compData.setName("comp1 name");
+    compData.setDescription("comp1 desc");
+    expected.setComponentCompositionData(compData);
+
+    doReturn(true).when(vspInfoDao).isManual(anyObject(),anyObject());
+    Collection<ComponentEntity> vspComponentList = new ArrayList<>();
+    doReturn(vspComponentList).when(componentDaoMock).list(anyObject());
+    doReturn(expected).when(compositionEntityDataManagerMock).createComponent(anyObject());
+
+    ComponentEntity created = componentManager.createComponent(expected, USER);
+    Assert.assertNotNull(created);
+    //expected.setId(created.getId());
+    //expected.setVersion(VERSION);
+
+    //ComponentEntity actual = componentDaoMock.getComponent(VSP_ID, VERSION, created.getId());
+
+    //Assert.assertEquals(actual, expected);
+    //return created.getId();
+  }
+
+  @Test
+  public void testCreateWithVspCompListMoreThanOne() {
+    ComponentEntity expected = new ComponentEntity(VSP_ID, null, null);
+    ComponentData compData = new ComponentData();
+    compData.setName("comp1 name");
+    compData.setDescription("comp1 desc");
+    expected.setComponentCompositionData(compData);
+
+    doReturn(true).when(vspInfoDao).isManual(anyObject(),anyObject());
+    Collection<ComponentEntity> vspComponentList = new ArrayList<>();
+    vspComponentList.add(expected);
+    doReturn(vspComponentList).when(componentDaoMock).list(anyObject());
+
+    try {
+      ComponentEntity created = componentManager.createComponent(expected, USER);
+    }  catch (CoreException exception) {
+      Assert.assertEquals("Creation of only one VFC per VSP allowed.", exception.code().message());
+      Assert.assertEquals(VendorSoftwareProductErrorCodes.VSP_VFC_COUNT_EXCEED,
+          exception.code().id());
+    }
+  }
+
+  @Test
+  public void testUpdateComp() {
+    ComponentEntity expected = new ComponentEntity(VSP_ID, null, COMP1_ID);
+    ComponentData compData = new ComponentData();
+    compData.setName("comp1 name");
+    compData.setDescription("comp1 desc");
+    expected.setComponentCompositionData(compData);
+
+    doReturn(expected).when(componentDaoMock).get(anyObject());
+    doReturn(true).when(vspInfoDao).isManual(anyObject(),anyObject());
+    Collection<ComponentEntity> vspComponentList = new ArrayList<>();
+    vspComponentList.add(expected);
+    doReturn(vspComponentList).when(componentDaoMock).list(anyObject());
+    doReturn(new CompositionEntityValidationData(null,null)).when(compositionEntityDataManagerMock)
+        .validateEntity(anyObject(),anyObject(),anyObject());
+
+    CompositionEntityValidationData created = componentManager.updateComponent(expected, USER);
+    Assert.assertNotNull(created);
+  }
+
+  @Test
+  public void testUpdateCompWithSameVfcDisplayName() {
+    ComponentEntity expected = new ComponentEntity(VSP_ID, null, COMP1_ID);
+    ComponentData compData = new ComponentData();
+    compData.setName("comp1 name");
+    compData.setDescription("comp1 desc");
+    compData.setDisplayName("comp1 displayname");
+    expected.setComponentCompositionData(compData);
+
+    doReturn(expected).when(componentDaoMock).get(anyObject());
+    doReturn(true).when(vspInfoDao).isManual(anyObject(),anyObject());
+    Collection<ComponentEntity> vspComponentList = new ArrayList<>();
+    vspComponentList.add(expected);
+    ComponentEntity expected2 = new ComponentEntity(VSP_ID+"2", null, COMP1_ID+"2");
+    expected2.setComponentCompositionData(compData);
+    vspComponentList.add(expected2);
+    doReturn(vspComponentList).when(componentDaoMock).list(anyObject());
+    doReturn(new CompositionEntityValidationData(null,null)).when(compositionEntityDataManagerMock)
+        .validateEntity(anyObject(),anyObject(),anyObject());
+
+    try {
+      CompositionEntityValidationData created = componentManager.updateComponent(expected, USER);
+    }  catch (CoreException exception) {
+      Assert.assertEquals("VFC with specified name already present in given VSP.",
+          exception.code().message());
+      Assert.assertEquals(VendorSoftwareProductErrorCodes.VSP_VFC_DUPLICATE_NAME,
+          exception.code().id());
+    }
+  }
 
 /*    @Test
     public void testCreateWithExistingName_negative() {
@@ -133,7 +214,7 @@
   @Test
   public void testCreateOnUploadVsp_negative() {
     testCreate_negative(new ComponentEntity(VSP_ID, VERSION, null), USER,
-        VendorSoftwareProductErrorCodes.VSP_COMPOSITION_EDIT_NOT_ALLOWED);
+        VendorSoftwareProductErrorCodes.VFC_ADD_NOT_ALLOWED_IN_HEAT_ONBOARDING);
   }
 
   @Test
@@ -159,6 +240,8 @@
     compData.setName(COMP1_ID + " name");                // no change
     compData.setDisplayName(COMP1_ID + " display name"); // no change
     compData.setVfcCode(COMP1_ID + " display name"); // no change
+    compData.setNfcCode(COMP1_ID + " display name"); // no change
+    compData.setNfcFunction(COMP1_ID + " display name"); // no change
     compData.setDescription(COMP1_ID + " desc updated"); // allowed change
     component.setComponentCompositionData(compData);
 
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImplTest.java
new file mode 100644
index 0000000..c8f473c
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImplTest.java
@@ -0,0 +1,377 @@
+package org.openecomp.sdc.vendorsoftwareproduct.impl;
+
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.mockito.Spy;
+import org.openecomp.sdc.common.errors.CoreException;
+import org.openecomp.sdc.common.errors.ValidationErrorBuilder;
+import org.openecomp.sdc.vendorsoftwareproduct.ComputeManager;
+import org.openecomp.sdc.vendorsoftwareproduct.NetworkManager;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.DeploymentFlavorDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.DeploymentFlavorEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComputeEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
+import org.openecomp.sdc.vendorsoftwareproduct.errors.DuplicateComputeInComponentErrorBuilder;
+import org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes;
+import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionEntityDataManager;
+import org.openecomp.sdc.vendorsoftwareproduct.services.schemagenerator.SchemaGenerator;
+import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse;
+import org.openecomp.sdc.vendorsoftwareproduct.types.ListComputeResponse;
+import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireResponse;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.*;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdc.versioning.errors.VersioningErrorCodes;
+import org.testng.Assert;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+
+import static org.mockito.Matchers.anyObject;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+/**
+ * Created by DIVESHM on 5/16/2017.
+ */
+
+
+public class ComputeManagerImplTest {
+
+    private static final String COMPUTE_NOT_EXIST_MSG =
+            "Vendor Software Product COMPUTE with Id compute1 does not exist for Vendor Software Product with " +
+                    "id VSP_ID and version 0.1";
+
+    private static final String USER = "computeTestUser";
+    private static final String VSP_ID = "VSP_ID";
+    private static final Version VERSION = new Version(0, 1);
+    private static final String COMPONENT_ID = "COMPONENT_ID";
+    private static final String COMPUTE1_ID = "compute1";
+    private static final String COMPUTE2_ID = "compute2";
+
+  @Mock
+  private ComputeDao computeDao;
+
+  @Mock
+  private CompositionEntityDataManager compositionEntityDataManagerMock;
+
+  @Mock
+  private NetworkManager networkManagerMock;
+
+  @Mock
+  private VendorSoftwareProductInfoDao vspInfoDao;
+
+  @Mock
+  private ComputeEntity computeEntity;
+
+  @Mock
+  private ListComputeResponse listComputeResponse;
+
+  @Mock
+  private DeploymentFlavorEntity deploymentFlavorEntity;
+
+  @Mock
+  private DeploymentFlavorDao deploymentFlavorDao;
+
+  @Mock
+  private ComponentComputeAssociation componentComputeAssociation;
+
+  @Mock
+  DeploymentFlavor deploymentFlavor;
+
+  @InjectMocks
+  @Spy
+  private ComputeManagerImpl computeManager;
+
+  @BeforeMethod
+  public void setUp() throws Exception {
+      MockitoAnnotations.initMocks(this);
+  }
+
+   @Test
+  public void testListWhenNone() {
+    Collection<ListComputeResponse> computes = computeManager.listCompute(VSP_ID, VERSION, COMPONENT_ID, USER);
+    Assert.assertEquals(computes.size(), 0);
+  }
+
+  @Test
+  public void testList(){
+      doReturn(Arrays.asList(
+        createCompute(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID),
+        createCompute(VSP_ID, VERSION, COMPONENT_ID, COMPUTE2_ID)))
+              .when(computeDao).list(anyObject());
+
+
+      Collection<ListComputeResponse> computes = computeManager.listCompute(VSP_ID, VERSION, COMPONENT_ID, USER);
+      Assert.assertEquals(computes.size(), 2);
+      for (ListComputeResponse compute : computes) {
+          Assert.assertEquals(compute.getComputeEntity().getComputeCompositionData().getName(),
+                  COMPUTE1_ID.equals(compute.getComputeEntity().getId())
+                          ? "compute1name"
+                          : "compute2name");
+      };
+  }
+
+    @Test
+    public void testCreateOnNotManualCompute_negative() {
+
+        testCreate_negative(new ComputeEntity(VSP_ID, VERSION, COMPONENT_ID, null), USER,
+                VendorSoftwareProductErrorCodes.ADD_COMPUTE_NOT_ALLOWED_IN_HEAT_ONBOARDING);
+    }
+
+    @Test
+    public void testCreateManualCompute() {
+        ComputeEntity expected = createCompute(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID);
+        doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject());
+        computeManager.createCompute(expected, USER);
+        verify(compositionEntityDataManagerMock).createCompute(expected);
+        verify(compositionEntityDataManagerMock).createCompute(expected);
+    }
+
+    @Test
+    public void testCreateManualImageWithDuplicateName() {
+        ComputeEntity expected = createCompute(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID);
+        doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject());
+
+        ComputeEntity expectedDiffName = createCompute(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID);
+        ComputeData computeData = expectedDiffName.getComputeCompositionData();
+        computeData.setName(COMPUTE1_ID + "Name");
+        expectedDiffName.setComputeCompositionData(computeData);
+        List<ComputeEntity> vfcImageList = new ArrayList<ComputeEntity>();
+        vfcImageList.add(expectedDiffName);
+        doReturn(vfcImageList).when(computeDao).list(anyObject());
+
+        try {
+            computeManager.createCompute(expected, USER);
+            Assert.fail();
+        }
+        catch (CoreException ex) {
+            Assert.assertEquals(VendorSoftwareProductErrorCodes.DUPLICATE_COMPUTE_NAME_NOT_ALLOWED,
+                    ex.code().id());
+        }
+    }
+
+
+    @Test
+    public void testUpdateNonExistingComputeId_negative() {
+
+        testUpdate_negative(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID, USER,
+                VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND);
+    }
+
+    @Test
+    public void testUpdateCompute() {
+        doReturn(createCompute(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID))
+                .when(computeDao).get(anyObject());
+
+        doReturn(new CompositionEntityValidationData(CompositionEntityType.compute, COMPUTE1_ID))
+                .when(compositionEntityDataManagerMock)
+                .validateEntity(anyObject(), anyObject(), anyObject());
+
+        ComputeEntity computeEntity = new ComputeEntity(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID);
+        ComputeData computeData = new ComputeData();
+        computeData.setName(COMPUTE1_ID + "name");
+        computeData.setDescription(COMPUTE1_ID + "desc updated");
+        computeEntity.setComputeCompositionData(computeData);
+
+        CompositionEntityValidationData validationData =
+                computeManager.updateCompute(computeEntity, USER);
+        Assert.assertTrue(validationData == null || validationData.getErrors() == null);
+        verify(computeDao).update(computeEntity);
+    }
+
+    @Test
+    public void testIllegalComputeUpdate() {
+        doReturn(createCompute(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID))
+                .when(computeDao).get(anyObject());
+
+        doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject());
+
+        CompositionEntityValidationData toBeReturned =
+                new CompositionEntityValidationData(CompositionEntityType.compute, COMPUTE1_ID);
+        toBeReturned.setErrors(Arrays.asList("error1", "error2"));
+        doReturn(toBeReturned)
+                .when(compositionEntityDataManagerMock)
+                .validateEntity(anyObject(), anyObject(), anyObject());
+
+        ComputeEntity computeEntity = new ComputeEntity(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID);
+        ComputeData computeData = new ComputeData();
+        computeData.setName(COMPUTE1_ID + " name updated");
+        computeData.setDescription(COMPUTE1_ID + " desc updated");
+        computeEntity.setComputeCompositionData(computeData);
+
+        CompositionEntityValidationData validationData = computeManager.updateCompute(computeEntity, USER);
+        Assert.assertNotNull(validationData);
+        Assert.assertEquals(validationData.getErrors().size(), 2);
+
+        verify(computeDao, never()).update(computeEntity);
+    }
+
+    @Test
+    public void testUpdateHEATComputeName() throws Exception {
+        doReturn(createCompute(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID))
+                .when(computeDao).get(anyObject());
+        ComputeEntity computeEntity = new ComputeEntity(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID);
+        ComputeData computeData = new ComputeData();
+        computeData.setName(COMPUTE1_ID + " name updated");
+        computeData.setDescription(COMPUTE1_ID + " desc updated");
+        computeEntity.setComputeCompositionData(computeData);
+
+        try {
+            computeManager.updateCompute(computeEntity, USER);
+        }
+        catch (CoreException ex) {
+            Assert.assertEquals(ex.code().id(), VendorSoftwareProductErrorCodes.UPDATE_COMPUTE_NOT_ALLOWED);
+        }
+
+    }
+
+    @Test
+    public void testUpdateManualComputeQuestionnaire() throws Exception {
+        String json = "{\"md5\" :\"FFDSD33SS\"}";
+        doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject());
+        doReturn(new ComputeEntity(null,null,null,null)).when(computeDao).get(anyObject());
+
+        computeManager.updateComputeQuestionnaire(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID, json, USER);
+        verify(computeDao).updateQuestionnaireData(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID, json);
+    }
+
+    @Test
+    public void testGetNonExistingComputeId_negative() {
+        testGet_negative(VSP_ID, VERSION, COMPONENT_ID, "non existing compute id", USER,
+                VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND);
+    }
+
+    @Test
+    public void testGet() {
+        ComputeEntity expected = createCompute(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID);
+        doReturn(expected).when(computeDao).get(anyObject());
+        String compositionSchema = "schema string";
+        doReturn(compositionSchema).when(computeManager).getComputeCompositionSchema(anyObject());
+
+        CompositionEntityResponse<ComputeData> response =
+                computeManager.getCompute(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID, USER);
+        Assert.assertEquals(response.getId(), expected.getId());
+        Assert.assertEquals(response.getData().getName(), expected.getComputeCompositionData().getName());
+        Assert.assertEquals(response.getData().getDescription(), expected.getComputeCompositionData().
+                getDescription());
+        Assert.assertEquals(response.getSchema(), compositionSchema);
+    }
+
+    @Test
+    public void testGetQuestionnaire() throws Exception {
+        ComputeEntity compute = new ComputeEntity(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID);
+        compute.setQuestionnaireData("{}");
+        doReturn(compute).when(computeDao).getQuestionnaireData(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID);
+
+        String schema = "schema string";
+
+
+        doReturn(schema).when(computeManager).getComputeQuestionnaireSchema(anyObject());
+
+        QuestionnaireResponse questionnaire =
+                computeManager.getComputeQuestionnaire(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID, USER);
+
+        Assert.assertNotNull(questionnaire);
+        Assert.assertEquals(questionnaire.getData(), compute.getQuestionnaireData());
+        Assert.assertEquals(questionnaire.getSchema(), schema);
+        Assert.assertNull(questionnaire.getErrorMessage());
+    }
+
+    @Test
+    public void testDeleteOnNotManualCompute() {
+        ComputeEntity expected = createCompute(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID);
+        doReturn(expected).when(computeDao).get(anyObject());
+        testDelete_negative(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID, USER,
+                VendorSoftwareProductErrorCodes.VSP_COMPOSITION_EDIT_NOT_ALLOWED);
+    }
+
+    @Test
+    public void testDeleteOnManualCompute() {
+        ComputeEntity expected = createCompute(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID);
+        doReturn(expected).when(computeDao).get(anyObject());
+        doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject());
+        computeManager.deleteCompute(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID, USER);
+        verify(computeDao).delete(anyObject());
+    }
+
+    @Test
+    public void testDeleteOnNotExistCompute() {
+        testDelete_negative(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID, USER,
+                VendorSoftwareProductErrorCodes.VSP_COMPOSITION_EDIT_NOT_ALLOWED);
+    }
+
+
+    private void testDelete_negative(String vspId, Version version, String componentId, String computeId,
+                                     String user,
+                                     String expectedErrorCode) {
+        try {
+            computeManager.deleteCompute(vspId, version, componentId, computeId, user);
+            Assert.fail();
+        } catch (CoreException exception) {
+            Assert.assertEquals(exception.code().id(), expectedErrorCode);
+        }
+    }
+
+    private void testGet_negative(String vspId, Version version, String componentId, String computeId,
+                                String user, String expectedErrorCode) {
+      try {
+          computeManager.getCompute(vspId, version, componentId, computeId, user);
+          Assert.fail();
+      } catch (CoreException exception) {
+          Assert.assertEquals(exception.code().id(), expectedErrorCode);
+      }
+  }
+
+    private void testList_negative(String vspId, Version version, String componentId, String user,
+                                   String expectedErrorCode, String expectedErrorMsg) {
+        try {
+            computeManager.listCompute(vspId, version, componentId, user);
+            Assert.fail();
+        } catch (CoreException exception) {
+            Assert.assertEquals(exception.code().id(), expectedErrorCode);
+            Assert.assertEquals(exception.getMessage(), expectedErrorMsg);
+        }
+    }
+
+
+
+    private void testUpdate_negative(String vspId, Version version, String componentId, String computeId,
+                                 String user, String expectedErrorCode) {
+  try {
+    computeManager.updateCompute(new ComputeEntity(vspId, version, componentId, computeId), user);
+    Assert.fail();
+  } catch (CoreException exception) {
+      Assert.assertEquals(exception.code().id(), expectedErrorCode);
+    }
+  }
+
+  private void testCreate_negative(ComputeEntity computeEntity1, String user, String expectedErrorCode) {
+        try {
+            computeManager.createCompute(computeEntity1, user);
+            Assert.fail();
+        } catch (CoreException exception) {
+            Assert.assertEquals(exception.code().id(), expectedErrorCode);
+        }
+    }
+
+  static ComputeEntity createCompute(String vspId, Version version, String compId, String computeId){
+      ComputeEntity computeEntity1 = new ComputeEntity(vspId, version, compId, computeId);
+      ComputeData computeData = new ComputeData();
+      computeData.setName(computeId+"name");
+      computeData.setDescription(computeId+"desc");
+      computeEntity1.setComputeCompositionData(computeData);
+      return computeEntity1;
+  }
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeplomentFlavorManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeplomentFlavorManagerImplTest.java
new file mode 100644
index 0000000..e082b25
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeplomentFlavorManagerImplTest.java
@@ -0,0 +1,409 @@
+package org.openecomp.sdc.vendorsoftwareproduct.impl;
+
+
+import static org.mockito.Matchers.anyObject;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.verify;
+
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.mockito.Spy;
+import org.openecomp.core.utilities.json.JsonUtil;
+import org.openecomp.sdc.common.errors.CoreException;
+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.VendorSoftwareProductInfoDao;
+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.VspDetails;
+import org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes;
+import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionEntityDataManager;
+import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse;
+import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireResponse;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Component;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentComputeAssociation;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityType;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityValidationData;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.DeploymentFlavor;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdc.versioning.errors.VersioningErrorCodes;
+import org.testng.Assert;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+
+public class DeplomentFlavorManagerImplTest {
+  private static final String USER = "depFlavorTestUser";
+  private static final String VSP_ID = "VSP_ID";
+  private static final Version VERSION = new Version(0, 1);
+  private static final String COMPONENT_ID = "COMPONENT_ID";
+  private static final String DF1_ID = "df1";
+  private static final String DF2_ID = "df2";
+
+  @Mock
+  private CompositionEntityDataManager compositionEntityDataManagerMock;
+  @Mock
+  private VendorSoftwareProductInfoDao vspInfoDao;
+  @Mock
+  DeploymentFlavorDao deploymentFlavorDaoMock;
+  @Mock
+  ComponentDao componentDaoMock;
+  @Mock
+  ComputeDao computeDaoMock;
+  @InjectMocks
+  @Spy
+  private DeploymentFlavorManagerImpl deploymentFlavorManager;
+
+  @BeforeMethod
+  public void setUp() throws Exception {
+    MockitoAnnotations.initMocks(this);
+  }
+
+  @Test
+  public void testListWhenNone() {
+    final Collection<DeploymentFlavorEntity> deploymentFlavorEntities =
+        deploymentFlavorManager.listDeploymentFlavors(VSP_ID, VERSION,  USER);
+    Assert.assertEquals(deploymentFlavorEntities.size(), 0);
+  }
+
+  @Test
+  public void testCreateOnNotManual_negative() {
+
+    testCreate_negative(new DeploymentFlavorEntity(VSP_ID, VERSION,  null), USER,
+        VendorSoftwareProductErrorCodes.CREATE_DEPLOYMENT_FLAVOR_NOT_ALLOWED_IN_HEAT_ONBOARDING);
+  }
+
+  @Test
+  public void testCreateManualDepFlavor() {
+    DeploymentFlavorEntity expected = createDeploymentFlavor(VSP_ID, VERSION,  DF1_ID);
+    doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject());
+
+    VspDetails vspDetails = new VspDetails(VSP_ID, VERSION);
+    doReturn(vspDetails).when(vspInfoDao).get(anyObject());
+
+    deploymentFlavorManager.createDeploymentFlavor(expected, USER);
+    verify(compositionEntityDataManagerMock).createDeploymentFlavor(expected);
+  }
+
+  @Test
+  public void testCreateManualDepFlavorWithDuplicateName() {
+    DeploymentFlavorEntity expected = createDeploymentFlavor(VSP_ID, VERSION, DF1_ID);
+    doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject());
+
+    DeploymentFlavorEntity expectedDiffName = createDeploymentFlavor(VSP_ID, VERSION, DF1_ID);
+    DeploymentFlavor deploymentFlavor = expectedDiffName.getDeploymentFlavorCompositionData();
+    deploymentFlavor.setModel(DF1_ID + " Name");
+    expectedDiffName.setDeploymentFlavorCompositionData(deploymentFlavor);
+    List<DeploymentFlavorEntity> list = new ArrayList<DeploymentFlavorEntity>();
+    list.add(expectedDiffName);
+    doReturn(list).when(deploymentFlavorDaoMock).list(anyObject());
+
+    try {
+      deploymentFlavorManager.createDeploymentFlavor(expected, USER);
+      Assert.fail();
+    }
+    catch (CoreException ex) {
+      Assert.assertEquals(VendorSoftwareProductErrorCodes.DUPLICATE_DEPLOYMENT_FLAVOR_MODEL_NOT_ALLOWED,
+          ex.code().id());
+    }
+  }
+
+  @Test
+  public void testCreateManualDepFlavorWithFGNotInVSP() {
+    DeploymentFlavorEntity expected = createDeploymentFlavor(VSP_ID, VERSION, DF1_ID);
+    final DeploymentFlavor deploymentFlavor =
+        JsonUtil.json2Object(expected.getCompositionData(), DeploymentFlavor.class);
+    deploymentFlavor.setFeatureGroupId("fg3");
+    expected.setCompositionData(JsonUtil.object2Json(deploymentFlavor));
+
+    doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject());
+
+    List<String> featureGrps = new ArrayList<String>();
+    featureGrps.add("fg1");
+    featureGrps.add("fg2");
+
+    VspDetails vspDetails = new VspDetails(VSP_ID, VERSION);
+    vspDetails.setFeatureGroups(featureGrps);
+    doReturn(vspDetails).when(vspInfoDao).get(anyObject());
+
+
+    try {
+      deploymentFlavorManager.createDeploymentFlavor(expected, USER);
+      Assert.fail();
+    }
+    catch (CoreException ex) {
+      Assert.assertEquals(VendorSoftwareProductErrorCodes.FEATURE_GROUP_NOT_EXIST_FOR_VSP,
+          ex.code().id());
+    }
+  }
+
+  @Test
+  public void testCreateManualDepFlavorWithNullCompInAssociation() {
+    DeploymentFlavorEntity expected = createDeploymentFlavor(VSP_ID, VERSION,  DF1_ID);
+    final DeploymentFlavor deploymentFlavor =
+        JsonUtil.json2Object(expected.getCompositionData(), DeploymentFlavor.class);
+    ComponentComputeAssociation association = new ComponentComputeAssociation();
+    association.setComponentId(null);
+    association.setComputeFlavorId("CF1");
+    List<ComponentComputeAssociation> list = new ArrayList<ComponentComputeAssociation>();
+    list.add(association);
+    deploymentFlavor.setComponentComputeAssociations(list);
+    expected.setCompositionData(JsonUtil.object2Json(deploymentFlavor));
+
+    doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject());
+
+    VspDetails vspDetails = new VspDetails(VSP_ID, VERSION);
+    doReturn(vspDetails).when(vspInfoDao).get(anyObject());
+
+    try {
+      deploymentFlavorManager.createDeploymentFlavor(expected, USER);
+    }
+    catch (CoreException ex) {
+      Assert.assertEquals(VendorSoftwareProductErrorCodes.INVALID_COMPONENT_COMPUTE_ASSOCIATION,
+          ex.code().id());
+      Assert.assertEquals("Invalid request,for valid association please provide ComponentId for Compute Flavor",
+          ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testCreateManualDepFlavorWithInvalidComputeInAssociation() {
+    DeploymentFlavorEntity expected = createDeploymentFlavor(VSP_ID, VERSION,  DF1_ID);
+    final DeploymentFlavor deploymentFlavor =
+        JsonUtil.json2Object(expected.getCompositionData(), DeploymentFlavor.class);
+    ComponentComputeAssociation association = new ComponentComputeAssociation();
+    association.setComponentId(COMPONENT_ID);
+    association.setComputeFlavorId("CF1");
+    List<ComponentComputeAssociation> list = new ArrayList<ComponentComputeAssociation>();
+    list.add(association);
+    deploymentFlavor.setComponentComputeAssociations(list);
+    expected.setCompositionData(JsonUtil.object2Json(deploymentFlavor));
+
+    doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject());
+
+    VspDetails vspDetails = new VspDetails(VSP_ID, VERSION);
+    doReturn(vspDetails).when(vspInfoDao).get(anyObject());
+
+    ComponentEntity component = new ComponentEntity(VSP_ID, VERSION, USER);
+    doReturn(component).when(componentDaoMock).get(anyObject());
+
+    doReturn(null).when(computeDaoMock).get(anyObject());
+
+    try {
+      deploymentFlavorManager.createDeploymentFlavor(expected, USER);
+    }
+    catch (CoreException ex) {
+      Assert.assertEquals(VendorSoftwareProductErrorCodes.INVALID_COMPUTE_FLAVOR_ID,
+          ex.code().id());
+    }
+  }
+
+  @Test
+  public void testCreateManualDepFlavorWithDuplicateVfcAssociation() {
+    DeploymentFlavorEntity expected = createDeploymentFlavor(VSP_ID, VERSION,  DF1_ID);
+    final DeploymentFlavor deploymentFlavor =
+        JsonUtil.json2Object(expected.getCompositionData(), DeploymentFlavor.class);
+    ComponentComputeAssociation association = new ComponentComputeAssociation();
+    association.setComponentId(COMPONENT_ID);
+    association.setComputeFlavorId("CF1");
+    List<ComponentComputeAssociation> list = new ArrayList<ComponentComputeAssociation>();
+    list.add(association);
+    list.add(association);
+    deploymentFlavor.setComponentComputeAssociations(list);
+    expected.setCompositionData(JsonUtil.object2Json(deploymentFlavor));
+
+    doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject());
+
+    VspDetails vspDetails = new VspDetails(VSP_ID, VERSION);
+    doReturn(vspDetails).when(vspInfoDao).get(anyObject());
+
+    ComponentEntity component = new ComponentEntity(VSP_ID, VERSION, USER);
+    doReturn(component).when(componentDaoMock).get(anyObject());
+
+    ComputeEntity computeEntity = new ComputeEntity(VSP_ID, VERSION, COMPONENT_ID, "CF1");
+    doReturn(computeEntity).when(computeDaoMock).get(anyObject());
+
+    try {
+      deploymentFlavorManager.createDeploymentFlavor(expected, USER);
+    }
+    catch (CoreException ex) {
+      Assert.assertEquals(VendorSoftwareProductErrorCodes.SAME_VFC_ASSOCIATION_MORE_THAN_ONCE_NOT_ALLOWED,
+          ex.code().id());
+    }
+  }
+
+  @Test
+  public void testList() {
+
+    doReturn(Arrays.asList(
+        createDeploymentFlavor(VSP_ID, VERSION,  DF1_ID),
+        createDeploymentFlavor(VSP_ID, VERSION,  DF2_ID)))
+        .when(deploymentFlavorDaoMock).list(anyObject());
+
+
+    final Collection<DeploymentFlavorEntity> deploymentFlavorEntities =
+        deploymentFlavorManager.listDeploymentFlavors(VSP_ID, VERSION,  USER);
+    Assert.assertEquals(deploymentFlavorEntities.size(), 2);
+    for (DeploymentFlavorEntity deploymentFlavorEntity : deploymentFlavorEntities) {
+      Assert.assertEquals(deploymentFlavorEntity.getDeploymentFlavorCompositionData().getModel()
+          , DF1_ID.equals(deploymentFlavorEntity.getId()) ? DF1_ID+" name" : DF2_ID+" name" );
+    }
+  }
+
+  @Test
+  public void testUpdateHeatDepFlavor() {
+    testUpdate_negative(VSP_ID, VERSION, DF1_ID, USER,
+        VendorSoftwareProductErrorCodes.EDIT_DEPLOYMENT_FLAVOR_NOT_ALLOWED_IN_HEAT_ONBOARDING);
+  }
+
+  @Test
+  public void testUpdateNonExistingManualDepFlavorId_negative() {
+    doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject());
+    testUpdate_negative(VSP_ID, VERSION, DF1_ID, USER,
+        VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND);
+  }
+
+  @Test
+  public void testManualUpdateDepFlavor() {
+    doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject());
+
+    doReturn(createDeploymentFlavor(VSP_ID, VERSION, DF1_ID))
+        .when(deploymentFlavorDaoMock).get(anyObject());
+
+    doReturn(new CompositionEntityValidationData(CompositionEntityType.image, DF1_ID))
+        .when(compositionEntityDataManagerMock)
+        .validateEntity(anyObject(), anyObject(), anyObject());
+
+    VspDetails vspDetails = new VspDetails(VSP_ID, VERSION);
+    doReturn(vspDetails).when(vspInfoDao).get(anyObject());
+
+    DeploymentFlavorEntity deploymentFlavorEntity = new DeploymentFlavorEntity(VSP_ID, VERSION, DF1_ID);
+    DeploymentFlavor deploymentFlavor = new DeploymentFlavor();
+    deploymentFlavor.setModel(DF1_ID + " name");
+    deploymentFlavor.setDescription(DF1_ID + " desc updated");
+    deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavor);
+
+    CompositionEntityValidationData validationData =
+        deploymentFlavorManager.updateDeploymentFlavor(deploymentFlavorEntity, USER);
+    Assert.assertTrue(validationData == null || validationData.getErrors() == null);
+    verify(deploymentFlavorDaoMock).update(deploymentFlavorEntity);
+  }
+
+  @Test
+  public void testGetNonExistingDepFlavorId_negative() {
+    testGet_negative(VSP_ID, VERSION, "non existing image id", USER,
+        VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND);
+  }
+
+  @Test
+  public void testGet() {
+    DeploymentFlavorEntity expected = createDeploymentFlavor(VSP_ID, VERSION, DF1_ID);
+    doReturn(expected).when(deploymentFlavorDaoMock).get(anyObject());
+
+    VspDetails vspDetails = new VspDetails(VSP_ID, VERSION);
+    doReturn(vspDetails).when(vspInfoDao).get(anyObject());
+
+    CompositionEntityResponse<DeploymentFlavor> response =
+        deploymentFlavorManager.getDeploymentFlavor(VSP_ID, VERSION, DF1_ID, USER);
+    Assert.assertEquals(response.getId(), expected.getId());
+    Assert.assertEquals(response.getData().getModel(), expected.getDeploymentFlavorCompositionData().
+        getModel());
+    Assert.assertEquals(response.getData().getDescription(), expected.getDeploymentFlavorCompositionData().
+        getDescription());
+  }
+
+  @Test
+  public void testDeleteDepFlavorOnHEAT() {
+    DeploymentFlavorEntity expected = createDeploymentFlavor(VSP_ID, VERSION, DF1_ID);
+    doReturn(expected).when(deploymentFlavorDaoMock).get(anyObject());
+    testDelete_negative(VSP_ID, VERSION,  DF1_ID, USER,
+        VendorSoftwareProductErrorCodes.DELETE_DEPLOYMENT_FLAVOR_NOT_ALLOWED_IN_HEAT_ONBOARDING);
+  }
+
+  @Test
+  public void testDeleteOnNotExistImage() {
+    testDelete_negative(VSP_ID, VERSION,  DF1_ID, USER,
+        VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND);
+  }
+
+  @Test
+  public void testDeleteOnManualImage() {
+    DeploymentFlavorEntity expected = createDeploymentFlavor(VSP_ID, VERSION, DF1_ID);
+    doReturn(expected).when(deploymentFlavorDaoMock).get(anyObject());
+    doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject());
+    deploymentFlavorManager.deleteDeploymentFlavor(VSP_ID, VERSION, DF1_ID, USER);
+    verify(deploymentFlavorDaoMock).delete(anyObject());
+  }
+
+  private void testList_negative(String vspId, Version version, String componentId, String user,
+                                 String expectedErrorCode, String expectedErrorMsg) {
+    try {
+      deploymentFlavorManager.listDeploymentFlavors(vspId, version, user);
+      Assert.fail();
+    } catch (CoreException exception) {
+      Assert.assertEquals(exception.code().id(), expectedErrorCode);
+      Assert.assertEquals(exception.getMessage(), expectedErrorMsg);
+    }
+  }
+
+  private void testCreate_negative(DeploymentFlavorEntity deploymentFlavorEntity, String user, String
+      expectedErrorCode) {
+    try {
+      deploymentFlavorManager.createDeploymentFlavor(deploymentFlavorEntity, user);
+      Assert.fail();
+    } catch (CoreException exception) {
+      Assert.assertEquals(exception.code().id(), expectedErrorCode);
+    }
+  }
+
+  private void testDelete_negative(String vspId, Version version, String deploymentFlavorId,
+                                   String user,
+                                   String expectedErrorCode) {
+    try {
+      deploymentFlavorManager.deleteDeploymentFlavor(vspId, version, deploymentFlavorId, user);
+      Assert.fail();
+    } catch (CoreException exception) {
+      Assert.assertEquals(exception.code().id(), expectedErrorCode);
+    }
+  }
+
+  static DeploymentFlavorEntity createDeploymentFlavor(String vspId, Version version, String deploymentFlavorId) {
+
+    DeploymentFlavorEntity deploymentFlavorEntity = new DeploymentFlavorEntity(vspId, version, deploymentFlavorId);
+    DeploymentFlavor deploymentFlavor = new DeploymentFlavor();
+    deploymentFlavor.setModel(deploymentFlavorId + " name");
+    deploymentFlavor.setDescription(deploymentFlavorId + " desc");
+
+    deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavor);
+    return deploymentFlavorEntity;
+  }
+
+  private void testUpdate_negative(String vspId, Version version, String
+      deploymentFlavorId, String user, String expectedErrorCode) {
+    try {
+      deploymentFlavorManager
+          .updateDeploymentFlavor(new DeploymentFlavorEntity(vspId, version, deploymentFlavorId), user);
+      Assert.fail();
+    } catch (CoreException exception) {
+      Assert.assertEquals(exception.code().id(), expectedErrorCode);
+    }
+  }
+
+  private void testGet_negative(String vspId, Version version, String deploymentFlavorId,
+                                String user, String expectedErrorCode) {
+    try {
+      deploymentFlavorManager.getDeploymentFlavor(vspId, version, deploymentFlavorId, user);
+      Assert.fail();
+    } catch (CoreException exception) {
+      Assert.assertEquals(exception.code().id(), expectedErrorCode);
+    }
+  }
+
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImplTest.java
new file mode 100644
index 0000000..ec676e5
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImplTest.java
@@ -0,0 +1,374 @@
+package org.openecomp.sdc.vendorsoftwareproduct.impl;
+
+
+import static org.mockito.Matchers.anyObject;
+import static org.mockito.Mockito.doReturn;
+
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.mockito.Spy;
+import org.openecomp.sdc.common.errors.CoreException;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ImageDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ImageEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes;
+import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionEntityDataManager;
+import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse;
+import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireResponse;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityType;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityValidationData;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Image;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdc.versioning.errors.VersioningErrorCodes;
+import org.testng.Assert;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+
+public class ImageManagerImplTest {
+
+  private static final String IMAGE_NOT_EXIST_MSG =
+      "Vendor Software Product Image with Id image1 does not exist for Vendor Software Product with" +
+          " " +
+          "id VSP_ID and version 0.1";
+
+  private static final String USER = "imageTestUser";
+  private static final String VSP_ID = "VSP_ID";
+  private static final Version VERSION = new Version(0, 1);
+  private static final String COMPONENT_ID = "COMPONENT_ID";
+  private static final String IMAGE1_ID = "image1";
+  private static final String IMAGE2_ID = "image2";
+
+  @Mock
+  private ImageDao imageDao;
+  @Mock
+  private CompositionEntityDataManager compositionEntityDataManagerMock;
+  @Mock
+  private VendorSoftwareProductInfoDao vspInfoDao;
+  @InjectMocks
+  @Spy
+  private ImageManagerImpl imageManager;
+
+  @BeforeMethod
+  public void setUp() throws Exception {
+    MockitoAnnotations.initMocks(this);
+  }
+
+  @Test
+  public void testListWhenNone() {
+    final Collection<ImageEntity> imageEntities =
+        imageManager.listImages(VSP_ID, VERSION, COMPONENT_ID, USER);
+    Assert.assertEquals(imageEntities.size(), 0);
+  }
+
+  @Test
+  public void testList() {
+
+    doReturn(Arrays.asList(
+        createImage(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID),
+        createImage(VSP_ID, VERSION, COMPONENT_ID, IMAGE2_ID)))
+        .when(imageDao).list(anyObject());
+
+
+    final Collection<ImageEntity> images =
+        imageManager.listImages(VSP_ID, VERSION, COMPONENT_ID, USER);
+    Assert.assertEquals(images.size(), 2);
+    for (ImageEntity image : images) {
+      Assert.assertEquals(image.getImageCompositionData().getFileName(),
+          IMAGE1_ID.equals(image.getId()) ? IMAGE1_ID+" name" : IMAGE2_ID+" name" );
+    }
+  }
+
+  @Test
+  public void testCreateOnNotManualImage_negative() {
+
+    testCreate_negative(new ImageEntity(VSP_ID, VERSION, COMPONENT_ID, null), USER,
+        VendorSoftwareProductErrorCodes.ADD_IMAGE_NOT_ALLOWED_IN_HEAT_ONBOARDING);
+  }
+
+  @Test
+  public void testCreateManualImage() {
+    ImageEntity expected = createImage(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID);
+    doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject());
+    imageManager.createImage(expected, USER);
+    verify(compositionEntityDataManagerMock).createImage(expected);
+    verify(compositionEntityDataManagerMock).createImage(expected);
+  }
+
+  @Test
+  public void testCreateManualImageWithDuplicateName() {
+    ImageEntity expected = createImage(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID);
+    doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject());
+
+    ImageEntity expectedDiffName = createImage(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID);
+    Image image = expectedDiffName.getImageCompositionData();
+    image.setFileName(IMAGE1_ID + " Name");
+    expectedDiffName.setImageCompositionData(image);
+    List<ImageEntity> vfcImageList = new ArrayList<ImageEntity>();
+    vfcImageList.add(expectedDiffName);
+    doReturn(vfcImageList).when(imageDao).list(anyObject());
+    try {
+      imageManager.createImage(expected, USER);
+      Assert.fail();
+    }
+    catch (CoreException ex) {
+      Assert.assertEquals(VendorSoftwareProductErrorCodes.DUPLICATE_IMAGE_NAME_NOT_ALLOWED,
+          ex.code().id());
+    }
+  }
+
+  @Test
+  public void testUpdateNonExistingImageId_negative() {
+    testUpdate_negative(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID, USER,
+        VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND);
+  }
+
+  @Test
+  public void testUpdateImage() {
+    doReturn(createImage(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID))
+        .when(imageDao).get(anyObject());
+
+    doReturn(new CompositionEntityValidationData(CompositionEntityType.image, IMAGE1_ID))
+        .when(compositionEntityDataManagerMock)
+        .validateEntity(anyObject(), anyObject(), anyObject());
+
+    ImageEntity imageEntity = new ImageEntity(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID);
+    Image imageData = new Image();
+    imageData.setFileName(IMAGE1_ID + " name");
+    imageData.setDescription(IMAGE1_ID + " desc updated");
+    imageEntity.setImageCompositionData(imageData);
+
+    CompositionEntityValidationData validationData =
+        imageManager.updateImage(imageEntity, USER);
+    Assert.assertTrue(validationData == null || validationData.getErrors() == null);
+    verify(imageDao).update(imageEntity);
+  }
+
+  @Test
+  public void testIllegalImageUpdate() {
+    doReturn(createImage(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID))
+        .when(imageDao).get(anyObject());
+
+    doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject());
+
+    CompositionEntityValidationData toBeReturned =
+        new CompositionEntityValidationData(CompositionEntityType.image, IMAGE1_ID);
+    toBeReturned.setErrors(Arrays.asList("error1", "error2"));
+    doReturn(toBeReturned)
+        .when(compositionEntityDataManagerMock)
+        .validateEntity(anyObject(), anyObject(), anyObject());
+
+    ImageEntity imageEntity = new ImageEntity(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID);
+    Image imageData = new Image();
+    imageData.setFileName(IMAGE1_ID + " name updated");
+    imageData.setDescription(IMAGE1_ID + " desc updated");
+    imageEntity.setImageCompositionData(imageData);
+
+    CompositionEntityValidationData validationData = imageManager.updateImage(imageEntity, USER);
+    Assert.assertNotNull(validationData);
+    Assert.assertEquals(validationData.getErrors().size(), 2);
+
+    verify(imageDao, never()).update(imageEntity);
+  }
+
+  @Test
+  public void testUpdateHEATImageFileName() throws Exception {
+    doReturn(createImage(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID))
+        .when(imageDao).get(anyObject());
+    ImageEntity imageEntity = new ImageEntity(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID);
+    Image imageData = new Image();
+    imageData.setFileName(IMAGE1_ID + " name updated");
+    imageData.setDescription(IMAGE1_ID + " desc updated");
+    imageEntity.setImageCompositionData(imageData);
+
+    try {
+      imageManager.updateImage(imageEntity, USER);
+    }
+    catch (CoreException ex) {
+      Assert.assertEquals(ex.code().id(), VendorSoftwareProductErrorCodes.UPDATE_IMAGE_NOT_ALLOWED);
+    }
+
+  }
+
+  @Test
+  public void testGetNonExistingImageId_negative() {
+    testGet_negative(VSP_ID, VERSION, COMPONENT_ID, "non existing image id", USER,
+        VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND);
+  }
+
+  @Test
+  public void testGet() {
+    ImageEntity expected = createImage(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID);
+    doReturn(expected).when(imageDao).get(anyObject());
+    String compositionSchema = "schema string";
+    doReturn(compositionSchema).when(imageManager).getImageCompositionSchema(anyObject());
+
+    CompositionEntityResponse<Image> response =
+        imageManager.getImage(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID, USER);
+    Assert.assertEquals(response.getId(), expected.getId());
+    Assert.assertEquals(response.getData().getFileName(), expected.getImageCompositionData().
+        getFileName());
+    Assert.assertEquals(response.getData().getDescription(), expected.getImageCompositionData().
+        getDescription());
+    Assert.assertEquals(response.getSchema(), compositionSchema);
+  }
+
+  @Test
+  public void testDeleteOnNotManualImage() {
+    ImageEntity expected = createImage(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID);
+    doReturn(expected).when(imageDao).get(anyObject());
+    testDelete_negative(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID, USER,
+        VendorSoftwareProductErrorCodes.DELETE_IMAGE_NOT_ALLOWED);
+  }
+
+  @Test
+  public void testDeleteOnNotExistImage() {
+    testDelete_negative(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID, USER,
+        VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND);
+  }
+
+  @Test
+  public void testDeleteOnManualImage() {
+    ImageEntity expected = createImage(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID);
+    doReturn(expected).when(imageDao).get(anyObject());
+    doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject());
+    imageManager.deleteImage(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID, USER);
+    verify(imageDao).delete(anyObject());
+  }
+
+  @Test
+  public void testGetQuestionnaire() throws Exception {
+    ImageEntity image = new ImageEntity(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID);
+    image.setQuestionnaireData("{}");
+    doReturn(image).when(imageDao).getQuestionnaireData(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID);
+
+    String schema = "schema string";
+    doReturn(schema).when(imageManager).getImageQuestionnaireSchema(anyObject());
+
+    QuestionnaireResponse questionnaire =
+        imageManager.getImageQuestionnaire(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID, USER);
+    Assert.assertNotNull(questionnaire);
+    Assert.assertEquals(questionnaire.getData(), image.getQuestionnaireData());
+    Assert.assertEquals(questionnaire.getSchema(), schema);
+    Assert.assertNull(questionnaire.getErrorMessage());
+  }
+
+  @Test
+  public void testUpdateManualImageQuestionnaire() throws Exception {
+    String json = "{\"md5\" :\"FFDSD33SS\"}";
+    doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject());
+    doReturn(new ImageEntity()).when(imageDao).get(anyObject());
+
+    imageManager.updateImageQuestionnaire(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID, json, USER);
+    verify(imageDao).updateQuestionnaireData(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID, json);
+  }
+
+  @Test
+  public void testUpdateHEATImageQuestionnaireWithFormat() throws Exception {
+    String json = "{\"format\" :\"qcow2\"}";
+    ImageEntity image = new ImageEntity(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID);
+    image.setQuestionnaireData(json);
+    doReturn(image).when(imageDao).get(anyObject());
+
+    doReturn(false).when(vspInfoDao).isManual(anyObject(), anyObject());
+    doReturn(image).when(imageDao).getQuestionnaireData(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID);
+
+    String updJson = "{\"format\" :\"aki\"}";
+    try {
+      imageManager.updateImageQuestionnaire(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID, updJson,
+          USER);
+      Assert.fail();
+    }
+    catch(CoreException ex) {
+      Assert.assertEquals(ex.code().id(), VendorSoftwareProductErrorCodes.UPDATE_IMAGE_NOT_ALLOWED);
+    }
+  }
+
+  @Test
+  public void testUpdateHEATImageQuestionnaireWithInvalidFormat() throws Exception {
+    String json = "{\"format\" :\"qcow2\"}";
+    ImageEntity image = new ImageEntity(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID);
+    image.setQuestionnaireData(json);
+    doReturn(image).when(imageDao).get(anyObject());
+
+    String updJson = "{\"format\" :\"a22\"}";
+    try {
+      imageManager.updateImageQuestionnaire(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID, updJson,
+          USER);
+      Assert.fail();
+    }
+    catch(CoreException ex) {
+      Assert.assertEquals(ex.code().id(), VendorSoftwareProductErrorCodes.VFC_IMAGE_INVALID_FORMAT);
+    }
+  }
+
+  private void testList_negative(String vspId, Version version, String componentId, String user,
+                                 String expectedErrorCode, String expectedErrorMsg) {
+    try {
+      imageManager.listImages(vspId, version, componentId, user);
+      Assert.fail();
+    } catch (CoreException exception) {
+      Assert.assertEquals(exception.code().id(), expectedErrorCode);
+      Assert.assertEquals(exception.getMessage(), expectedErrorMsg);
+    }
+  }
+
+  private void testCreate_negative(ImageEntity image, String user, String expectedErrorCode) {
+    try {
+      imageManager.createImage(image, user);
+      Assert.fail();
+    } catch (CoreException exception) {
+      Assert.assertEquals(exception.code().id(), expectedErrorCode);
+    }
+  }
+
+  private void testDelete_negative(String vspId, Version version, String componentId, String nicId,
+                                   String user,
+                                   String expectedErrorCode) {
+    try {
+      imageManager.deleteImage(vspId, version, componentId, nicId, user);
+      Assert.fail();
+    } catch (CoreException exception) {
+      Assert.assertEquals(exception.code().id(), expectedErrorCode);
+    }
+  }
+
+  static ImageEntity createImage(String vspId, Version version, String compId, String imageId) {
+    ImageEntity imageEntity = new ImageEntity(vspId, version, compId, imageId);
+    Image imageData = new Image();
+    imageData.setFileName(imageId + " name");
+    imageData.setDescription(imageId + " desc");
+    imageEntity.setImageCompositionData(imageData);
+    return imageEntity;
+  }
+
+  private void testUpdate_negative(String vspId, Version version, String componentId, String
+      imageId, String user, String expectedErrorCode) {
+    try {
+      imageManager.updateImage(new ImageEntity(vspId, version, componentId, imageId), user);
+      Assert.fail();
+    } catch (CoreException exception) {
+      Assert.assertEquals(exception.code().id(), expectedErrorCode);
+    }
+  }
+
+  private void testGet_negative(String vspId, Version version, String componentId, String imageId,
+                                String user, String expectedErrorCode) {
+    try {
+      imageManager.getImage(vspId, version, componentId, imageId, user);
+      Assert.fail();
+    } catch (CoreException exception) {
+      Assert.assertEquals(exception.code().id(), expectedErrorCode);
+    }
+  }
+
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImplTest.java
new file mode 100644
index 0000000..4bbbec1
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImplTest.java
@@ -0,0 +1,562 @@
+package org.openecomp.sdc.vendorsoftwareproduct.impl;
+
+import static org.openecomp.sdc.generator.util.GeneratorConstants.ALLOWED_FLAVORS_PROPERTY;
+import static org.openecomp.sdc.generator.util.GeneratorConstants.PORT_NODE_TEMPLATE_ID_SUFFIX;
+import static org.openecomp.sdc.tosca.services.ToscaConstants.BINDING_REQUIREMENT_ID;
+import static org.openecomp.sdc.tosca.services.ToscaConstants.COUNT_PROPERTY_NAME;
+import static org.openecomp.sdc.tosca.services.ToscaConstants.SERVICE_TEMPLATE_FILTER_PROPERTY_NAME;
+import static org.openecomp.sdc.tosca.services.ToscaConstants.SUBSTITUTE_SERVICE_TEMPLATE_PROPERTY_NAME;
+import static org.openecomp.sdc.translator.services.heattotosca.Constants.GLOBAL_SUBSTITUTION_TYPES_TEMPLATE_NAME;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openecomp.sdc.generator.core.utils.GeneratorUtils;
+import org.openecomp.sdc.generator.datatypes.tosca.ComputeFlavor;
+import org.openecomp.sdc.generator.datatypes.tosca.DeploymentFlavorModel;
+import org.openecomp.sdc.generator.datatypes.tosca.LicenseFlavor;
+import org.openecomp.sdc.generator.datatypes.tosca.MultiFlavorVfcImage;
+import org.openecomp.sdc.generator.datatypes.tosca.VendorInfo;
+import org.openecomp.sdc.generator.datatypes.tosca.VspModelInfo;
+import org.openecomp.sdc.generator.util.GeneratorConstants;
+import org.openecomp.sdc.tosca.datatypes.ToscaCapabilityType;
+import org.openecomp.sdc.tosca.datatypes.ToscaNodeType;
+import org.openecomp.sdc.tosca.datatypes.ToscaRelationshipType;
+import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
+import org.openecomp.sdc.tosca.datatypes.model.CapabilityDefinition;
+import org.openecomp.sdc.tosca.datatypes.model.NodeTemplate;
+import org.openecomp.sdc.tosca.datatypes.model.NodeType;
+import org.openecomp.sdc.tosca.datatypes.model.PropertyDefinition;
+import org.openecomp.sdc.tosca.datatypes.model.PropertyType;
+import org.openecomp.sdc.tosca.datatypes.model.RequirementAssignment;
+import org.openecomp.sdc.tosca.datatypes.model.RequirementDefinition;
+import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate;
+import org.openecomp.sdc.tosca.datatypes.model.SubstitutionMapping;
+import org.openecomp.sdc.tosca.services.ToscaConstants;
+import org.openecomp.sdc.tosca.services.ToscaUtil;
+import org.openecomp.sdc.tosca.services.impl.ToscaAnalyzerServiceImpl;
+import org.openecomp.sdc.vendorsoftwareproduct.ManualVspToscaManager;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class ManualVspToscaManagerImplTest {
+
+  private static final String COMPONENT_ID = "Component_id";
+  private static final String COMPONENT_NAME = "Component_name";
+  private static final String SP_PART_NUMBER_1 = "Part_number_123";
+  private static final String FEATURE_GROUP_ID_1 = "Feature_Group_id_1";
+  private static final String MANUFACTURER_REF_1 = "Manufacturer_Ref_1";
+  private static final String VENDOR_MODEL_1 = "VLM_1";
+  private static final int NUM_CPUS_1 = 1;
+  private static final String DISK_SIZE_1 = "2GB";
+  private static final String MEM_SIZE_1 = "8GB";
+
+  private static final String SP_PART_NUMBER_2 = "Part_number_345";
+  private static final String FEATURE_GROUP_ID_2 = "Feature_Group_id_2";
+  private static final String MANUFACTURER_REF_2 = "Manufacturer_Ref_2";
+  private static final String VENDOR_MODEL_2 = "VLM_2";
+  private static final int NUM_CPUS_2 = 4;
+  private static final String DISK_SIZE_2 = "3GB";
+  private static final String MEM_SIZE_2 = "2GB";
+
+  private static final String IMAGE_VERSION_1 = "3.16.1";
+  private static final String IMAGE_HASH_1 = "65edfgye3256hjutve";
+  private static final String IMAGE_FILE_NAME_1 = "image-file-name1";
+  private static final String IMAGE_FILE_FORMAT_1 = "qcow2";
+  private static final String IMAGE_VERSION_2 = "3.1.9";
+  private static final String IMAGE_HASH_2 = "84rtedfe3256hjutaw";
+  private static final String IMAGE_FILE_NAME_2 = "image-file-name1";
+  private static final String IMAGE_FILE_FORMAT_2 = "iso";
+
+  private ManualVspToscaManager manualVspToscaManager = new ManualVspToscaManagerImpl();
+
+  @Test
+  public void testGenerateToscaInvalidVspId() {
+    VspModelInfo emptyVspCollectedData = new VspModelInfo();
+    ToscaServiceModel toscaServiceModel =
+        manualVspToscaManager.generateToscaModel(emptyVspCollectedData);
+    Assert.assertNotNull(toscaServiceModel);
+    Assert.assertNotNull(toscaServiceModel.getServiceTemplates());
+    //Service model should contain only the packed global types
+    Assert.assertEquals(19, toscaServiceModel.getServiceTemplates().size());
+  }
+
+  @Test
+  public void testGenerateToscaNoComponent() {
+    VspModelInfo vspCollectedData = new VspModelInfo();
+    vspCollectedData.setReleaseVendor("Vendor-1");
+    vspCollectedData.setComponents(null);
+    vspCollectedData.setMultiFlavorVfcImages(null);
+    vspCollectedData.setAllowedFlavors(getDeploymentFlavorData());
+    vspCollectedData.setNics(getComponentNics());
+    ToscaServiceModel toscaServiceModel =
+        manualVspToscaManager.generateToscaModel(vspCollectedData);
+    Assert.assertNotNull(toscaServiceModel);
+    Assert.assertNotNull(toscaServiceModel.getServiceTemplates());
+    //Service model should contain only the packed global types
+    Assert.assertEquals(19, toscaServiceModel.getServiceTemplates().size());
+  }
+
+  @Test
+  public void testGenerateToscaReleaseVendorNotPresent() {
+    VspModelInfo vspCollectedData = new VspModelInfo();
+    vspCollectedData.setComponents(getComponentData());
+    vspCollectedData.setMultiFlavorVfcImages(getVfcImageData());
+    vspCollectedData.setAllowedFlavors(getDeploymentFlavorData());
+    vspCollectedData.setNics(getComponentNics());
+    ToscaServiceModel toscaServiceModel =
+        manualVspToscaManager.generateToscaModel(vspCollectedData);
+    Assert.assertNotNull(toscaServiceModel);
+    Assert.assertNotNull(toscaServiceModel.getServiceTemplates());
+    //Service model should contain only the packed global types
+    Assert.assertEquals(22, toscaServiceModel.getServiceTemplates().size());
+    Map<String, ServiceTemplate> serviceTemplates = toscaServiceModel.getServiceTemplates();
+    String entryDefinitionServiceTemplate = toscaServiceModel.getEntryDefinitionServiceTemplate();
+    ServiceTemplate mainServiceTemplate = serviceTemplates.get(entryDefinitionServiceTemplate);
+    Assert.assertNotNull(mainServiceTemplate);
+    Assert.assertNull(mainServiceTemplate.getMetadata().get("releaseVendor"));
+  }
+
+  @Test
+  public void testGenerateToscaNoImages() {
+    VspModelInfo vspCollectedData = new VspModelInfo();
+    vspCollectedData.setComponents(getComponentData());
+    vspCollectedData.setMultiFlavorVfcImages(null);
+    vspCollectedData.setAllowedFlavors(getDeploymentFlavorData());
+    vspCollectedData.setNics(getComponentNics());
+    ToscaServiceModel toscaServiceModel =
+        manualVspToscaManager.generateToscaModel(vspCollectedData);
+    Assert.assertNotNull(toscaServiceModel);
+    Assert.assertNotNull(toscaServiceModel.getServiceTemplates());
+    //Service model should contain only the packed global types
+    Assert.assertEquals(22, toscaServiceModel.getServiceTemplates().size());
+    Map<String, ServiceTemplate> serviceTemplates = toscaServiceModel.getServiceTemplates();
+    String entryDefinitionServiceTemplate = toscaServiceModel.getEntryDefinitionServiceTemplate();
+    ServiceTemplate mainServiceTemplate = serviceTemplates.get(entryDefinitionServiceTemplate);
+    Assert.assertNotNull(mainServiceTemplate);
+    String componentName = vspCollectedData.getComponents().get(COMPONENT_ID);
+    Assert.assertNull(mainServiceTemplate.getTopology_template().getNode_templates()
+        .get(componentName + GeneratorConstants.VFC_NODE_TEMPLATE_ID_SUFFIX)
+        .getProperties());
+  }
+
+  @Test
+  public void testGenerateToscaNoPorts() {
+    VspModelInfo vspCollectedData = new VspModelInfo();
+    vspCollectedData.setComponents(getComponentData());
+    vspCollectedData.setMultiFlavorVfcImages(getVfcImageData());
+    vspCollectedData.setAllowedFlavors(getDeploymentFlavorData());
+    vspCollectedData.setNics(null);
+    ToscaServiceModel toscaServiceModel =
+        manualVspToscaManager.generateToscaModel(vspCollectedData);
+    Assert.assertNotNull(toscaServiceModel);
+    Assert.assertNotNull(toscaServiceModel.getServiceTemplates());
+    //Service model should contain only the packed global types
+    Assert.assertEquals(22, toscaServiceModel.getServiceTemplates().size());
+    Map<String, ServiceTemplate> serviceTemplates = toscaServiceModel.getServiceTemplates();
+    String componentName = vspCollectedData.getComponents().get(COMPONENT_ID);
+    String substitutionServiceTemplateFileName =
+        componentName + GeneratorConstants.TOSCA_SERVICE_TEMPLATE_FILE_NAME_SUFFIX;
+    ServiceTemplate substitutionServiceTemplate =
+        serviceTemplates.get(substitutionServiceTemplateFileName);
+    Assert.assertNotNull(substitutionServiceTemplate);
+    //Only component node template should be present since there are no ports
+    Assert.assertEquals(1, substitutionServiceTemplate.getTopology_template().getNode_templates()
+        .size());
+  }
+
+  @Test
+  public void testGenerateToscaNoManufacturerRefNumAndFeatureGroup() {
+    VspModelInfo vspCollectedData = new VspModelInfo();
+    vspCollectedData.setReleaseVendor("Vendor-1");
+    vspCollectedData.setComponents(getComponentData());
+    vspCollectedData.setMultiFlavorVfcImages(getVfcImageData());
+    Map<String, DeploymentFlavorModel> deploymentFlavorData = getDeploymentFlavorData();
+    deploymentFlavorData.get(SP_PART_NUMBER_1).getVendor_info()
+        .setManufacturer_reference_number(null);
+    deploymentFlavorData.get(SP_PART_NUMBER_1).getLicense_flavor().setFeature_group_uuid(null);
+    vspCollectedData.setAllowedFlavors(deploymentFlavorData);
+    vspCollectedData.setNics(getComponentNics());
+    ToscaServiceModel toscaServiceModel =
+        manualVspToscaManager.generateToscaModel(vspCollectedData);
+    Assert.assertNotNull(toscaServiceModel);
+    Assert.assertNotNull(toscaServiceModel.getServiceTemplates());
+    //Service model should contain only the packed global types
+    Assert.assertEquals(22, toscaServiceModel.getServiceTemplates().size());
+    Map<String, ServiceTemplate> serviceTemplates = toscaServiceModel.getServiceTemplates();
+    String entryDefinitionServiceTemplate = toscaServiceModel.getEntryDefinitionServiceTemplate();
+    ServiceTemplate mainServiceTemplate = serviceTemplates.get(entryDefinitionServiceTemplate);
+    Assert.assertNotNull(mainServiceTemplate);
+    String componentName = vspCollectedData.getComponents().get(COMPONENT_ID);
+    Map<String, DeploymentFlavorModel> actualDeploymentFlavor = (Map<String, DeploymentFlavorModel>)
+        mainServiceTemplate.getTopology_template().getNode_templates()
+        .get(componentName + GeneratorConstants.VNF_CONFIG_NODE_TEMPLATE_ID_SUFFIX)
+        .getProperties().get(ALLOWED_FLAVORS_PROPERTY);
+    Assert.assertNull(actualDeploymentFlavor.get(SP_PART_NUMBER_1).getVendor_info()
+        .getManufacturer_reference_number());
+    Assert.assertNull(actualDeploymentFlavor.get(SP_PART_NUMBER_1).getLicense_flavor()
+        .getFeature_group_uuid());
+  }
+
+  @Test
+  public void testGenerateToscaNoDeploymentFlavor() {
+    VspModelInfo vspCollectedData = new VspModelInfo();
+    vspCollectedData.setReleaseVendor("Vendor-1");
+    vspCollectedData.setComponents(getComponentData());
+    vspCollectedData.setMultiFlavorVfcImages(getVfcImageData());
+    vspCollectedData.setAllowedFlavors(null);
+    vspCollectedData.setNics(getComponentNics());
+    ToscaServiceModel toscaServiceModel =
+        manualVspToscaManager.generateToscaModel(vspCollectedData);
+    Assert.assertNotNull(toscaServiceModel);
+    Assert.assertNotNull(toscaServiceModel.getServiceTemplates());
+    //Service model should contain only the packed global types
+    Assert.assertEquals(22, toscaServiceModel.getServiceTemplates().size());
+    Map<String, ServiceTemplate> serviceTemplates = toscaServiceModel.getServiceTemplates();
+    String entryDefinitionServiceTemplate = toscaServiceModel.getEntryDefinitionServiceTemplate();
+    ServiceTemplate mainServiceTemplate = serviceTemplates.get(entryDefinitionServiceTemplate);
+    Assert.assertNotNull(mainServiceTemplate);
+    String componentName = vspCollectedData.getComponents().get(COMPONENT_ID);
+    Assert.assertNull(mainServiceTemplate.getTopology_template().getNode_templates()
+        .get(componentName + GeneratorConstants.VNF_CONFIG_NODE_TEMPLATE_ID_SUFFIX)
+        .getProperties());
+  }
+
+  @Test
+  public void testGenerateToscaCompleteData() {
+    VspModelInfo vspCollectedData = new VspModelInfo();
+    vspCollectedData.setReleaseVendor("Vendor-1");
+    vspCollectedData.setComponents(getComponentData());
+    vspCollectedData.setMultiFlavorVfcImages(getVfcImageData());
+    vspCollectedData.setAllowedFlavors(getDeploymentFlavorData());
+    vspCollectedData.setNics(getComponentNics());
+    ToscaServiceModel toscaServiceModel =
+        manualVspToscaManager.generateToscaModel(vspCollectedData);
+    Assert.assertNotNull(toscaServiceModel);
+    Assert.assertNotNull(toscaServiceModel.getServiceTemplates());
+    //Service model should contain only the packed global types
+    Assert.assertEquals(22, toscaServiceModel.getServiceTemplates().size());
+    Map<String, ServiceTemplate> serviceTemplates = toscaServiceModel.getServiceTemplates();
+    String entryDefinitionServiceTemplate = toscaServiceModel.getEntryDefinitionServiceTemplate();
+    ServiceTemplate mainServiceTemplate = serviceTemplates.get(entryDefinitionServiceTemplate);
+    Assert.assertNotNull(mainServiceTemplate);
+    String componentName = vspCollectedData.getComponents().get(COMPONENT_ID);
+
+    Assert.assertNotNull(mainServiceTemplate.getTopology_template().getNode_templates()
+        .get(componentName + GeneratorConstants.VFC_NODE_TEMPLATE_ID_SUFFIX));
+    Assert.assertNotNull(mainServiceTemplate.getTopology_template().getNode_templates()
+        .get(componentName + GeneratorConstants.VNF_NODE_TEMPLATE_ID_SUFFIX));
+    //Validate vnf configuration node template
+    validateVnfConfigurationNodeTemplate(mainServiceTemplate, componentName);
+    //Validate vfc node template
+    validateVfcNodeTemplateinMainServiceTemplate(mainServiceTemplate, componentName);
+    //Validate vnf node template
+    validateVnfNodeTemplate(mainServiceTemplate, componentName);
+
+    //Validate substitution service template
+    ServiceTemplate substitutionServiceTemplate = toscaServiceModel.getServiceTemplates()
+        .get(componentName + GeneratorConstants.TOSCA_SERVICE_TEMPLATE_FILE_NAME_SUFFIX);
+    List<Nic> nics = vspCollectedData.getNics().get(COMPONENT_ID);
+    validateSubstitutionServiceTemplate(substitutionServiceTemplate, nics, componentName);
+
+    //Validate global substitution service template
+    ServiceTemplate globalSubstitutionServiceTemplate = toscaServiceModel.getServiceTemplates()
+        .get(ToscaUtil.getServiceTemplateFileName(GLOBAL_SUBSTITUTION_TYPES_TEMPLATE_NAME));
+    validateGlobalSubstitutionServiceTemplate(globalSubstitutionServiceTemplate, nics,
+        componentName);
+  }
+
+  private void validateVnfConfigurationNodeTemplate(ServiceTemplate mainServiceTemplate,
+                                                    String componentName) {
+    NodeTemplate vnfConfigNodeTemplate =
+        mainServiceTemplate.getTopology_template().getNode_templates()
+            .get(componentName + GeneratorConstants.VNF_CONFIG_NODE_TEMPLATE_ID_SUFFIX);
+    Assert.assertNotNull(vnfConfigNodeTemplate);
+    Assert.assertEquals(ToscaNodeType.VNF_CONFIG_NODE_TYPE, vnfConfigNodeTemplate.getType());
+    Map<String, DeploymentFlavorModel> allowedFlavors = (Map<String, DeploymentFlavorModel>)
+        vnfConfigNodeTemplate.getProperties().get(GeneratorConstants.ALLOWED_FLAVORS_PROPERTY);
+    Map<String, DeploymentFlavorModel> deploymentFlavorData = getDeploymentFlavorData();
+    Assert.assertNotNull(allowedFlavors);
+    Assert.assertEquals(deploymentFlavorData.size(), allowedFlavors.size());
+    Assert.assertEquals(deploymentFlavorData, allowedFlavors);
+  }
+
+  private void validateVfcNodeTemplateinMainServiceTemplate(ServiceTemplate mainServiceTemplate,
+                                                            String componentName) {
+    NodeTemplate vfcNodeTemplate =
+        mainServiceTemplate.getTopology_template().getNode_templates()
+            .get(componentName + GeneratorConstants.VFC_NODE_TEMPLATE_ID_SUFFIX);
+    Assert.assertNotNull(vfcNodeTemplate);
+    Assert.assertEquals(ToscaNodeType.MULTIFLAVOR_VFC_NODE_TYPE, vfcNodeTemplate.getType());
+    Map<String, MultiFlavorVfcImage> vfcImages = (Map<String, MultiFlavorVfcImage>)
+        vfcNodeTemplate.getProperties().get(GeneratorConstants.IMAGES_PROPERTY);
+    Assert.assertNotNull(vfcImages);
+    Assert.assertEquals(2, vfcImages.size());
+    MultiFlavorVfcImage image1 = vfcImages.get(IMAGE_VERSION_1);
+    MultiFlavorVfcImage expectedImage1 = getImageData(IMAGE_VERSION_1, IMAGE_HASH_1,
+        IMAGE_FILE_NAME_1, "md5", IMAGE_FILE_FORMAT_1);
+    Assert.assertEquals(expectedImage1, image1);
+    MultiFlavorVfcImage image2 = vfcImages.get(IMAGE_VERSION_2);
+    MultiFlavorVfcImage expectedImage2 = getImageData(IMAGE_VERSION_2, IMAGE_HASH_2,
+        IMAGE_FILE_NAME_2, "md5", IMAGE_FILE_FORMAT_2);
+    Assert.assertEquals(expectedImage2, image2);
+  }
+
+  private void validateVnfNodeTemplate(ServiceTemplate mainServiceTemplate,
+                                       String componentName) {
+    NodeTemplate vnfNodeTemplate =
+        mainServiceTemplate.getTopology_template().getNode_templates()
+            .get(componentName + GeneratorConstants.VNF_NODE_TEMPLATE_ID_SUFFIX);
+    Assert.assertNotNull(vnfNodeTemplate);
+    Assert.assertEquals(ToscaNodeType.MULTIDEPLOYMENTFLAVOR_NODE_TYPE + "." + componentName,
+        vnfNodeTemplate.getType());
+    Assert.assertNotNull(vnfNodeTemplate.getDirectives());
+    Assert.assertEquals(true, vnfNodeTemplate.getDirectives().contains(ToscaConstants
+        .NODE_TEMPLATE_DIRECTIVE_SUBSTITUTABLE));
+
+    Map<String, Object> serviceTemplateFilterProperty = (Map<String, Object>) vnfNodeTemplate
+        .getProperties().get(SERVICE_TEMPLATE_FILTER_PROPERTY_NAME);
+    Assert.assertNotNull(serviceTemplateFilterProperty);
+    String substituteServiceTemplate = serviceTemplateFilterProperty
+            .get(SUBSTITUTE_SERVICE_TEMPLATE_PROPERTY_NAME).toString();
+    String expectedServiceTemplateName = componentName + GeneratorConstants
+        .TOSCA_SERVICE_TEMPLATE_FILE_NAME_SUFFIX;
+    Assert.assertEquals(expectedServiceTemplateName, substituteServiceTemplate);
+    int count = (int) serviceTemplateFilterProperty.get(COUNT_PROPERTY_NAME);
+    Assert.assertEquals(1, count);
+  }
+
+  private void validateSubstitutionServiceTemplate(ServiceTemplate substitutionServiceTemplate,
+                                                   List<Nic> nics,
+                                                   String componentName) {
+    Assert.assertNotNull(substitutionServiceTemplate);
+    int expectedNumberOfNodeTemplates = nics.size() + 1; //1 component node template
+    Map<String, NodeTemplate> substitutionNodeTemplates =
+        substitutionServiceTemplate.getTopology_template().getNode_templates();
+    Assert.assertEquals(expectedNumberOfNodeTemplates, substitutionNodeTemplates.size());
+    NodeTemplate componentNodeTemplate = substitutionNodeTemplates.get(componentName);
+    Assert.assertNotNull(componentNodeTemplate);
+    Assert.assertEquals(ToscaNodeType.VFC_NODE_TYPE_PREFIX + componentName, componentNodeTemplate
+        .getType());
+    for (Nic nic : nics) {
+      String nicName = nic.getName();
+      NodeTemplate nicNodeTemplate =
+          substitutionNodeTemplates.get(nicName + PORT_NODE_TEMPLATE_ID_SUFFIX);
+      validateNicNodeTemplate(nicNodeTemplate, componentName);
+    }
+    SubstitutionMapping substitutionMappings =
+        substitutionServiceTemplate.getTopology_template().getSubstitution_mappings();
+    validateSubstitutionMappings(substitutionMappings, nics, componentName);
+  }
+
+  private void validateNicNodeTemplate(NodeTemplate nicNodeTemplate,
+                                       String componentName) {
+    Assert.assertNotNull(nicNodeTemplate);
+    Assert.assertEquals(ToscaNodeType.NETWORK_PORT, nicNodeTemplate.getType());
+    List<Map<String, RequirementAssignment>> nicNodeTemplateRequirements =
+        nicNodeTemplate.getRequirements();
+    Assert.assertNotNull(nicNodeTemplateRequirements);
+    Assert.assertEquals(1, nicNodeTemplateRequirements.size());
+    RequirementAssignment expectedRequirementAssignment = new RequirementAssignment();
+    expectedRequirementAssignment.setCapability(ToscaCapabilityType.NATIVE_NETWORK_BINDABLE);
+    expectedRequirementAssignment.setRelationship(ToscaRelationshipType.NATIVE_NETWORK_BINDS_TO);
+    expectedRequirementAssignment.setNode(componentName);
+    Assert.assertEquals(true, new ToscaAnalyzerServiceImpl()
+        .isRequirementExistInNodeTemplate(nicNodeTemplate, BINDING_REQUIREMENT_ID,
+            expectedRequirementAssignment));
+  }
+
+  private void validateSubstitutionMappings(SubstitutionMapping substitutionMappings,
+                                            List<Nic> nics,
+                                            String componentName) {
+    Assert.assertEquals(ToscaNodeType.MULTIDEPLOYMENTFLAVOR_NODE_TYPE + "." + componentName,
+        substitutionMappings.getNode_type());
+    Map<String, List<String>> capabilities = substitutionMappings.getCapabilities();
+    validateSubstitutionCapabilities(capabilities, componentName);
+    Map<String, List<String>> requirements = substitutionMappings.getRequirements();
+    validateSubstitutionRequirements(requirements, nics);
+  }
+
+  private void validateSubstitutionCapabilities(Map<String, List<String>> capabilities,
+                                                String componentName) {
+    List<String> supportedCapabilities = GeneratorUtils.supportedCapabilities;
+    Assert.assertEquals(supportedCapabilities.size(), capabilities.size());
+    for (String capability : supportedCapabilities) {
+      String expectedCapabilityId = capability + "_" + componentName;
+      Assert.assertEquals(true, capabilities.containsKey(expectedCapabilityId));
+      List<String> expectedCapabilityValue = new ArrayList<>(2);
+      expectedCapabilityValue.add(componentName);
+      expectedCapabilityValue.add(capability);
+      List<String> actualCapabilityValue = capabilities.get(expectedCapabilityId);
+      Assert.assertEquals(expectedCapabilityValue, actualCapabilityValue);
+    }
+  }
+
+  private void validateSubstitutionRequirements(Map<String, List<String>> requirements,
+                                                List<Nic> nics) {
+    List<String> supportedRequirements = GeneratorUtils.supportedRequirements;
+    for(Nic nic : nics) {
+      String nicNodeTemplateId = nic.getName() + PORT_NODE_TEMPLATE_ID_SUFFIX;
+      for (String requirement : supportedRequirements) {
+        String expectedRequirementId = requirement + "_" + nicNodeTemplateId;
+        Assert.assertEquals(true, requirements.containsKey(expectedRequirementId));
+        List<String> expectedRequirementValue = new ArrayList<>(2);
+        expectedRequirementValue.add(nicNodeTemplateId);
+        expectedRequirementValue.add(requirement);
+        List<String> actualRequirementValue = requirements.get(expectedRequirementId);
+        Assert.assertEquals(expectedRequirementValue, actualRequirementValue);
+      }
+    }
+  }
+
+  private void validateGlobalSubstitutionServiceTemplate(ServiceTemplate
+                                                                globalSubstitutionServiceTemplate,
+                                                         List<Nic> nics,
+                                                         String componentName) {
+    Assert.assertNotNull(globalSubstitutionServiceTemplate);
+    Map<String, NodeType> nodeTypes = globalSubstitutionServiceTemplate.getNode_types();
+    Assert.assertEquals(1, nodeTypes.size());
+    NodeType deploymentFlavorNodeType =
+        nodeTypes.get(ToscaNodeType.MULTIDEPLOYMENTFLAVOR_NODE_TYPE + "." + componentName);
+    Assert.assertNotNull(deploymentFlavorNodeType);
+    Map<String, PropertyDefinition> properties = deploymentFlavorNodeType.getProperties();
+    Assert.assertNotNull(properties);
+    PropertyDefinition numCpusProperty = properties.get(GeneratorConstants.NUM_CPUS);
+    Assert.assertNotNull(numCpusProperty);
+    Assert.assertEquals(PropertyType.INTEGER.getDisplayName(), numCpusProperty.getType());
+    Assert.assertEquals(true, numCpusProperty.getRequired());
+
+    PropertyDefinition diskSizeProperty = properties.get(GeneratorConstants.DISK_SIZE);
+    Assert.assertNotNull(diskSizeProperty);
+    Assert.assertEquals(PropertyType.SCALAR_UNIT_SIZE.getDisplayName(), diskSizeProperty.getType());
+    Assert.assertEquals(true, diskSizeProperty.getRequired());
+
+    PropertyDefinition memSizeProperty = properties.get(GeneratorConstants.MEM_SIZE);
+    Assert.assertNotNull(memSizeProperty);
+    Assert.assertEquals(PropertyType.SCALAR_UNIT_SIZE.getDisplayName(), memSizeProperty.getType());
+    Assert.assertEquals(true, memSizeProperty.getRequired());
+
+    List<Map<String, RequirementDefinition>> requirements =
+        deploymentFlavorNodeType.getRequirements();
+    List<String> supportedRequirements = GeneratorUtils.supportedRequirements;
+    for (Nic nic : nics) {
+      boolean found = false;
+      String nicNodeTemplateId = nic.getName() + PORT_NODE_TEMPLATE_ID_SUFFIX;
+      for (String requirementId : supportedRequirements) {
+        String expectedRequirementId = requirementId + "_" + nicNodeTemplateId;
+        for (Map<String, RequirementDefinition> requirement : requirements) {
+          if (requirement.containsKey(expectedRequirementId)) {
+            found = true;
+            break;
+          }
+        }
+      }
+      Assert.assertEquals(true, found);
+    }
+
+    Map<String, CapabilityDefinition> capabilities = deploymentFlavorNodeType.getCapabilities();
+    List<String> supportedCapabilities = GeneratorUtils.supportedCapabilities;
+    for (String capabilityId : supportedCapabilities) {
+      String expectedCapabilityId = capabilityId + "_" + componentName;
+      Assert.assertEquals (true, capabilities.containsKey(expectedCapabilityId));
+    }
+  }
+
+  private Map<String, String> getComponentData() {
+    Map<String, String> componentData = new HashMap<>();
+    componentData.put(COMPONENT_ID, COMPONENT_NAME);
+    return componentData;
+  }
+
+  private Map<String, List<MultiFlavorVfcImage>> getVfcImageData() {
+    Map<String, List<MultiFlavorVfcImage>> imageData = new HashMap<>();
+    List<MultiFlavorVfcImage> images = new ArrayList<>(2);
+    MultiFlavorVfcImage image1 = getImageData(IMAGE_VERSION_1, IMAGE_HASH_1, IMAGE_FILE_NAME_1,
+        "md5", IMAGE_FILE_FORMAT_1);
+    MultiFlavorVfcImage image2 = getImageData(IMAGE_VERSION_2, IMAGE_HASH_2, IMAGE_FILE_NAME_2,
+        "md5", IMAGE_FILE_FORMAT_2);
+    images.add(image1);
+    images.add(image2);
+    imageData.put(COMPONENT_ID, images);
+    return imageData;
+  }
+
+  private Map<String, DeploymentFlavorModel> getDeploymentFlavorData() {
+    Map<String, DeploymentFlavorModel> deploymentFlavorData = new HashMap<>();
+    ComputeFlavor computeFlavor1 = getComputeFlavorData(NUM_CPUS_1, DISK_SIZE_1, MEM_SIZE_1);
+    LicenseFlavor licenseFlavor1 = getLicenseFlavor(FEATURE_GROUP_ID_1);
+    VendorInfo vendorInfo1 = getVendorInfo(MANUFACTURER_REF_1, VENDOR_MODEL_1);
+    DeploymentFlavorModel deploymentFlavor1 = getDeploymentFlavorModel(SP_PART_NUMBER_1,
+        computeFlavor1, vendorInfo1, licenseFlavor1);
+
+    ComputeFlavor computeFlavor2 = getComputeFlavorData(NUM_CPUS_2, DISK_SIZE_2, MEM_SIZE_2);
+    LicenseFlavor licenseFlavor2 = getLicenseFlavor(FEATURE_GROUP_ID_2);
+    VendorInfo vendorInfo2 = getVendorInfo(MANUFACTURER_REF_2, VENDOR_MODEL_2);
+
+    DeploymentFlavorModel deploymentFlavor2 = getDeploymentFlavorModel(SP_PART_NUMBER_2,
+        computeFlavor2, vendorInfo2, licenseFlavor2);
+
+    deploymentFlavorData.put(SP_PART_NUMBER_1, deploymentFlavor1);
+    deploymentFlavorData.put(SP_PART_NUMBER_2, deploymentFlavor2);
+    return deploymentFlavorData;
+  }
+
+  private DeploymentFlavorModel getDeploymentFlavorModel(String spPartNumber, ComputeFlavor
+      computeFlavor, VendorInfo vendorInfo, LicenseFlavor licenseFlavor) {
+    DeploymentFlavorModel deploymentFlavor = new DeploymentFlavorModel();
+    deploymentFlavor.setSp_part_number(spPartNumber);
+    deploymentFlavor.setCompute_flavor(computeFlavor);
+    deploymentFlavor.setLicense_flavor(licenseFlavor);
+    deploymentFlavor.setVendor_info(vendorInfo);
+    return deploymentFlavor;
+  }
+
+  private ComputeFlavor getComputeFlavorData(int numCpus, String diskSize, String memSize ) {
+    ComputeFlavor computeFlavor = new ComputeFlavor();
+    computeFlavor.setNum_cpus(numCpus);
+    computeFlavor.setDisk_size(diskSize);
+    computeFlavor.setMem_size(memSize);
+    return computeFlavor;
+  }
+
+  private VendorInfo getVendorInfo(String manufacturerRefNumber, String vlmId) {
+    VendorInfo vendorInfo = new VendorInfo();
+    vendorInfo.setManufacturer_reference_number(manufacturerRefNumber);
+    vendorInfo.setVendor_model(vlmId);
+    return vendorInfo;
+  }
+
+  private LicenseFlavor getLicenseFlavor(String featureGroupId) {
+    LicenseFlavor licenseFlavor = new LicenseFlavor();
+    licenseFlavor.setFeature_group_uuid(featureGroupId);
+    return licenseFlavor;
+  }
+
+  private MultiFlavorVfcImage getImageData(String imageVersion, String fileHash, String fileName,
+                                           String fileHashType, String fileFormat) {
+    MultiFlavorVfcImage image = new MultiFlavorVfcImage();
+    image.setSoftware_version(imageVersion);
+    image.setFile_hash(fileHash);
+    image.setFile_hash_type(fileHashType);
+    image.setFile_name(fileName+"-"+IMAGE_VERSION_2+"."+fileFormat);
+    return image;
+  }
+
+  private Map<String, List<Nic>> getComponentNics() {
+    Map<String, List<Nic>> nicData = new HashMap<>();
+    List<Nic> nicList = new ArrayList<>(2);
+    Nic nic1 = new Nic();
+    nic1.setName("Nic_1");
+
+    Nic nic2 = new Nic();
+    nic2.setName("Nic_2");
+
+    nicList.add(nic1);
+    nicList.add(nic2);
+    nicData.put(COMPONENT_ID, nicList);
+    return nicData;
+  }
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MibManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MibManagerImplTest.java
deleted file mode 100644
index 54e979c..0000000
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MibManagerImplTest.java
+++ /dev/null
@@ -1,139 +0,0 @@
-package org.openecomp.sdc.vendorsoftwareproduct.impl;
-
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.core.enrichment.types.ArtifactType;
-import org.openecomp.sdc.common.errors.CoreException;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.MibDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.MibEntity;
-import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.MibUploadStatus;
-import org.openecomp.sdc.versioning.dao.types.Version;
-import org.testng.Assert;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Arrays;
-import java.util.Optional;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyObject;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.verify;
-
-public class MibManagerImplTest {
-
-  private static final String USER1 = "ComponentsUploadTestUser";
-  private static final String COMPONENT_ID = "COMPONENT_ID";
-  private static final String VSP_ID = "vspId";
-  private static final Version VERSION = new Version(0, 1);
-  private static final String trapFileName = "MMSC.zip";
-  private static final String pollFileName = "MNS OAM FW.zip";
-  private static final String notZipFileName = "notZipFile";
-  private static final String zipWithFoldersFileName = "zipFileWithFolder.zip";
-  private static final String emptyZipFileName = "emptyZip.zip";
-  private static final String ZIP_DIR = "/vspmanager/zips/";
-
-  @Mock
-  private VendorSoftwareProductDao vendorSoftwareProductDaoMock;
-  @Mock
-  private MibDao mibDaoMock;
-  @InjectMocks
-  private MibManagerImpl mibManager;
-
-  @BeforeMethod
-  public void setUp() throws Exception {
-    MockitoAnnotations.initMocks(this);
-  }
-
-  @Test(expectedExceptions = CoreException.class)
-  public void testUploadEmptyZip() {
-    InputStream zis = getFileInputStream(ZIP_DIR + emptyZipFileName);
-    mibManager.upload(zis, emptyZipFileName, VSP_ID, VERSION, COMPONENT_ID,
-        ArtifactType.SNMP_TRAP, USER1);
-  }
-
-  @Test
-  public void testUploadInvalidZip() {
-    URL url = this.getClass().getResource("/notZipFile");
-    try {
-      mibManager
-          .upload(url.openStream(), notZipFileName, VSP_ID, VERSION, COMPONENT_ID,
-              ArtifactType.SNMP_TRAP, USER1);
-      Assert.fail();
-    } catch (Exception exception) {
-      Assert.assertEquals(exception.getMessage(), "Invalid zip file");
-    }
-  }
-
-  @Test
-  public void testUploadZipWithFolders() {
-    InputStream zis = getFileInputStream(ZIP_DIR + zipWithFoldersFileName);
-
-    try {
-      mibManager
-          .upload(zis, zipWithFoldersFileName, VSP_ID, VERSION, COMPONENT_ID,
-              ArtifactType.SNMP_TRAP, USER1);
-      Assert.fail();
-    } catch (Exception exception) {
-      Assert.assertEquals(exception.getMessage(), "Zip file should not contain folders");
-    }
-  }
-
-
-  @Test
-  public void testListMibFilenames() {
-    MibEntity artifact1 =
-        new MibEntity(VSP_ID, VERSION, COMPONENT_ID, "artifact1");
-    artifact1.setType(ArtifactType.SNMP_TRAP);
-    artifact1.setArtifactName(trapFileName);
-
-    MibEntity artifact2 =
-        new MibEntity(VSP_ID, VERSION, COMPONENT_ID, "artifact2");
-    artifact2.setType(ArtifactType.SNMP_POLL);
-    artifact2.setArtifactName(pollFileName);
-
-    doReturn(Arrays.asList(artifact1, artifact2))
-        .when(mibDaoMock).list(anyObject());
-
-    MibUploadStatus mibUploadStatus =
-        mibManager.listFilenames(VSP_ID, VERSION, COMPONENT_ID, USER1);
-
-    Assert.assertEquals(mibUploadStatus.getSnmpTrap(), trapFileName);
-    Assert.assertEquals(mibUploadStatus.getSnmpPoll(), pollFileName);
-  }
-
-  @Test (expectedExceptions = CoreException.class)
-  public void testDeleteComponentMibWhenNone() {
-    doReturn(Optional.empty()).when(mibDaoMock).getByType(any());
-    mibManager.delete(VSP_ID, VERSION, COMPONENT_ID, ArtifactType.SNMP_POLL, USER1);
-
-    verify(mibDaoMock, never()).delete(anyObject());
-  }
-
-  @Test
-  public void testDeleteComponentMib() {
-    doReturn(Optional.of(new MibEntity(VSP_ID, VERSION, COMPONENT_ID, "artifactId"))).when
-        (mibDaoMock).getByType(anyObject());
-
-    mibManager.delete(VSP_ID, VERSION, COMPONENT_ID, ArtifactType.SNMP_POLL, USER1);
-
-    verify(mibDaoMock).delete(anyObject());
-  }
-
-
-  private InputStream getFileInputStream(String fileName) {
-    URL url = this.getClass().getResource(fileName);
-    try {
-      return url.openStream();
-    } catch (IOException exception) {
-      exception.printStackTrace();
-      return null;
-    }
-  }
-}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerImplTest.java
new file mode 100644
index 0000000..534c630
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerImplTest.java
@@ -0,0 +1,164 @@
+package org.openecomp.sdc.vendorsoftwareproduct.impl;
+
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.openecomp.core.enrichment.types.MonitoringUploadType;
+import org.openecomp.sdc.common.errors.CoreException;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentArtifactDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentMonitoringUploadEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.MonitoringUploadStatus;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.testng.Assert;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Arrays;
+import java.util.Optional;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyObject;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+
+public class MonitoringUploadsManagerImplTest {
+
+  private static final String USER1 = "ComponentsUploadTestUser";
+  private static final String COMPONENT_ID = "COMPONENT_ID";
+  private static final String VSP_ID = "vspId";
+  private static final Version VERSION = new Version(0, 1);
+  private static final String trapFileName = "MMSC.zip";
+  private static final String pollFileName = "MNS OAM FW.zip";
+  private static final String vesFileName = "vesTest-yml_only.zip";
+  private static final String invalidVesFileName = "invalid_ves_file.zip";
+  private static final String notZipFileName = "notZipFile";
+  private static final String zipWithFoldersFileName = "zipFileWithFolder.zip";
+  private static final String emptyZipFileName = "emptyZip.zip";
+  private static final String ZIP_DIR = "/vspmanager/zips/";
+
+  @Mock
+  private ComponentArtifactDao componentArtifactDaoMock;
+  @InjectMocks
+  private MonitoringUploadsManagerImpl moitoringUploadsManager;
+
+  @BeforeMethod
+  public void setUp() throws Exception {
+    MockitoAnnotations.initMocks(this);
+  }
+
+  @Test(expectedExceptions = CoreException.class)
+  public void testUploadEmptyZip() {
+    InputStream zis = getFileInputStream(ZIP_DIR + emptyZipFileName);
+    moitoringUploadsManager.upload(zis, emptyZipFileName, VSP_ID, VERSION, COMPONENT_ID,
+        MonitoringUploadType.SNMP_TRAP, USER1);
+  }
+
+  @Test
+  public void testUploadInvalidZip() {
+    URL url = this.getClass().getResource("/notZipFile");
+    try {
+      moitoringUploadsManager
+          .upload(url.openStream(), notZipFileName, VSP_ID, VERSION, COMPONENT_ID,
+              MonitoringUploadType.VES_EVENTS, USER1);
+      Assert.fail();
+    } catch (Exception exception) {
+      Assert.assertEquals(exception.getMessage(), "Invalid zip file");
+    }
+  }
+
+  @Test
+  public void testUploadZipWithFolders() {
+    InputStream zis = getFileInputStream(ZIP_DIR + zipWithFoldersFileName);
+
+    try {
+      moitoringUploadsManager
+          .upload(zis, zipWithFoldersFileName, VSP_ID, VERSION, COMPONENT_ID,
+              MonitoringUploadType.SNMP_TRAP, USER1);
+      Assert.fail();
+    } catch (Exception exception) {
+      Assert.assertEquals(exception.getMessage(), "Zip file should not contain folders");
+    }
+  }
+
+  @Test
+  public void testUploadVEsEventZipWithNonYamlFiles() {
+    InputStream zis = getFileInputStream(ZIP_DIR + invalidVesFileName);
+
+    try {
+      moitoringUploadsManager
+          .upload(zis, invalidVesFileName, VSP_ID, VERSION, COMPONENT_ID,
+              MonitoringUploadType.VES_EVENTS, USER1);
+      Assert.fail();
+    } catch (Exception exception) {
+      Assert.assertEquals(exception.getMessage(),
+          "Wrong VES EVENT Artifact was uploaded - all files contained in Artifact must be YAML " +
+              "files (using .yaml/.yml extensions)");
+    }
+  }
+
+
+  @Test
+  public void testListMonitoringFilenames() {
+    ComponentMonitoringUploadEntity artifact1 =
+        new ComponentMonitoringUploadEntity(VSP_ID, VERSION, COMPONENT_ID, "artifact1");
+    artifact1.setType(MonitoringUploadType.SNMP_TRAP);
+    artifact1.setArtifactName(trapFileName);
+
+    ComponentMonitoringUploadEntity artifact2 =
+        new ComponentMonitoringUploadEntity(VSP_ID, VERSION, COMPONENT_ID, "artifact2");
+    artifact2.setType(MonitoringUploadType.SNMP_POLL);
+    artifact2.setArtifactName(pollFileName);
+
+    ComponentMonitoringUploadEntity artifact3 =
+        new ComponentMonitoringUploadEntity(VSP_ID, VERSION, COMPONENT_ID, "artifact3");
+    artifact3.setType(MonitoringUploadType.VES_EVENTS);
+    artifact3.setArtifactName(vesFileName);
+
+    doReturn(Arrays.asList(artifact1, artifact2, artifact3))
+        .when(componentArtifactDaoMock).list(anyObject());
+
+    MonitoringUploadStatus monitoringUploadStatus =
+        moitoringUploadsManager.listFilenames(VSP_ID, VERSION, COMPONENT_ID, USER1);
+
+    Assert.assertEquals(monitoringUploadStatus.getSnmpTrap(), trapFileName);
+    Assert.assertEquals(monitoringUploadStatus.getSnmpPoll(), pollFileName);
+    Assert.assertEquals(monitoringUploadStatus.getVesEvent(), vesFileName);
+  }
+
+  @Test (expectedExceptions = CoreException.class)
+  public void testDeleteComponentMibWhenNone() {
+    doReturn(Optional.empty()).when(componentArtifactDaoMock).getByType(any());
+    moitoringUploadsManager
+        .delete(VSP_ID, VERSION, COMPONENT_ID, MonitoringUploadType.SNMP_POLL, USER1);
+
+    verify(componentArtifactDaoMock, never()).delete(anyObject());
+  }
+
+  @Test
+  public void testDeleteComponentMonitoringUpload() {
+    doReturn(Optional
+        .of(new ComponentMonitoringUploadEntity(VSP_ID, VERSION, COMPONENT_ID, "artifactId")))
+        .when
+            (componentArtifactDaoMock).getByType(anyObject());
+
+    moitoringUploadsManager
+        .delete(VSP_ID, VERSION, COMPONENT_ID, MonitoringUploadType.SNMP_POLL, USER1);
+
+    verify(componentArtifactDaoMock).delete(anyObject());
+  }
+
+
+  private InputStream getFileInputStream(String fileName) {
+    URL url = this.getClass().getResource(fileName);
+    try {
+      return url.openStream();
+    } catch (IOException exception) {
+      exception.printStackTrace();
+      return null;
+    }
+  }
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerImplTest.java
index a143fd3..b2cfba7 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerImplTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerImplTest.java
@@ -7,14 +7,17 @@
 import org.openecomp.sdc.common.errors.CoreException;
 import org.openecomp.sdc.vendorsoftwareproduct.NetworkManager;
 import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity;
 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
 import org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes;
 import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionEntityDataManager;
 import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse;
 import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireResponse;
 import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityType;
 import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityValidationData;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.NetworkType;
 import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic;
 import org.openecomp.sdc.versioning.dao.types.Version;
 import org.openecomp.sdc.versioning.errors.VersioningErrorCodes;
@@ -22,6 +25,7 @@
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 
@@ -29,6 +33,7 @@
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 
 public class NicManagerImplTest {
   private static final String NIC_NOT_EXIST_MSG =
@@ -50,6 +55,8 @@
   private CompositionEntityDataManager compositionEntityDataManagerMock;
   @Mock
   private NetworkManager networkManagerMock;
+  @Mock
+  private VendorSoftwareProductInfoDao vspInfoDao;
   @InjectMocks
   @Spy
   private NicManagerImpl nicManager;
@@ -87,6 +94,112 @@
     }
   }
 
+  @Test
+  public void testCreate() {
+    NicEntity nicEntity = createNic(VSP_ID, VERSION, COMPONENT_ID, NIC1_ID, NETWORK1_ID);
+    Nic nic = nicEntity.getNicCompositionData();
+    nic.setNetworkType(NetworkType.Internal);
+    nicEntity.setNicCompositionData(nic);
+    doReturn(true).when(vspInfoDao).isManual(anyObject(),anyObject());
+    Collection<NicEntity> nicEntities = new ArrayList<>();
+    doReturn(nicEntities).when(nicDao).list(anyObject());
+    doReturn(nicEntity).when(compositionEntityDataManagerMock).createNic(anyObject());
+
+    NicEntity created = nicManager.createNic(nicEntity,USER);
+    Assert.assertNotNull(created);
+  }
+
+  @Test
+  public void testCreateWithDupNicName() {
+    NicEntity nicEntity = createNic(VSP_ID, VERSION, COMPONENT_ID, NIC1_ID, NETWORK1_ID);
+    Nic nic = nicEntity.getNicCompositionData();
+    nic.setNetworkType(NetworkType.Internal);
+    nicEntity.setNicCompositionData(nic);
+    doReturn(true).when(vspInfoDao).isManual(anyObject(),anyObject());
+    Collection<NicEntity> nicEntities = new ArrayList<>();
+
+    NicEntity nicEntityDiffName = createNic(VSP_ID, VERSION, COMPONENT_ID, NIC1_ID, NETWORK1_ID);
+    Nic newNameNic = nicEntityDiffName.getNicCompositionData();
+    newNameNic.setName(NIC1_ID + " Name");
+    nicEntityDiffName.setNicCompositionData(newNameNic);
+    nicEntities.add(nicEntityDiffName);
+    doReturn(nicEntities).when(nicDao).list(anyObject());
+    doReturn(nicEntity).when(compositionEntityDataManagerMock).createNic(anyObject());
+
+    try {
+      NicEntity created = nicManager.createNic(nicEntity,USER);
+    }  catch (CoreException exception) {
+      Assert.assertEquals("Invalid request, NIC with name "+ nic.getName() +
+          " already exist for component with ID "+ nicEntity.getComponentId() +".",
+          exception.code().message());
+      Assert.assertEquals(VendorSoftwareProductErrorCodes.DUPLICATE_NIC_NAME_NOT_ALLOWED,
+          exception.code().id());
+    }
+  }
+
+  @Test
+  public void testCreateWithExternalNetworkType() {
+    NicEntity nicEntity = createNic(VSP_ID, VERSION, COMPONENT_ID, NIC1_ID, NETWORK1_ID);
+    Nic nic = nicEntity.getNicCompositionData();
+    nic.setNetworkType(NetworkType.External);
+    nicEntity.setNicCompositionData(nic);
+    doReturn(true).when(vspInfoDao).isManual(anyObject(),anyObject());
+    Collection<NicEntity> nicEntities = new ArrayList<>();
+    doReturn(nicEntities).when(nicDao).list(anyObject());
+    doReturn(nicEntity).when(compositionEntityDataManagerMock).createNic(anyObject());
+
+    try {
+      NicEntity created = nicManager.createNic(nicEntity,USER);
+    }  catch (CoreException exception) {
+      Assert.assertEquals("Invalid request,NetworkId not allowed for External Networks",
+          exception.code().message());
+      Assert.assertEquals(VendorSoftwareProductErrorCodes.NETWORKID_NOT_ALLOWED_FOR_EXTERNAL_NETWORK,
+          exception.code().id());
+    }
+  }
+
+  @Test
+  public void testCreateWithNetworkDesc() {
+    NicEntity nicEntity = createNic(VSP_ID, VERSION, COMPONENT_ID, NIC1_ID, NETWORK1_ID);
+    Nic nic = nicEntity.getNicCompositionData();
+    nic.setNetworkType(NetworkType.Internal);
+    nic.setNetworkDescription(NIC1_ID);
+    nicEntity.setNicCompositionData(nic);
+    doReturn(true).when(vspInfoDao).isManual(anyObject(),anyObject());
+    Collection<NicEntity> nicEntities = new ArrayList<>();
+    doReturn(nicEntities).when(nicDao).list(anyObject());
+    doReturn(nicEntity).when(compositionEntityDataManagerMock).createNic(anyObject());
+
+    try {
+      NicEntity created = nicManager.createNic(nicEntity,USER);
+    }  catch (CoreException exception) {
+      Assert.assertEquals("Invalid request, Network Description not allowed for Internal Networks",
+          exception.code().message());
+      Assert.assertEquals(VendorSoftwareProductErrorCodes
+          .NETWORK_DESCRIPTION_NOT_ALLOWED_FOR_INTERNAL_NETWORK,exception.code().id());
+    }
+  }
+
+  @Test
+  public void testDeleteNic() {
+    NicEntity nicEntity = createNic(VSP_ID, VERSION, COMPONENT_ID, NIC1_ID, NETWORK1_ID);
+    doReturn(true).when(vspInfoDao).isManual(anyObject(),anyObject());
+    doReturn(nicEntity).when(nicDao).get(anyObject());
+
+    nicManager.deleteNic(VSP_ID,new Version(0,1),COMPONENT_ID,NIC1_ID,USER);
+
+  }
+
+  @Test
+  public void testUpdateNicQuestionnaire() {
+    NicEntity nicEntity = createNic(VSP_ID, VERSION, COMPONENT_ID, NIC1_ID, NETWORK1_ID);
+
+    doReturn(nicEntity).when(nicDao).get(anyObject());
+
+    nicManager.updateNicQuestionnaire(VSP_ID,new Version(0,1),COMPONENT_ID,NIC1_ID,"Ques",USER);
+
+  }
+
 //    @Test(dependsOnMethods = "testListWhenNone")
 //    public void testCreate() {
 //        NIC1_ID = testCreate(VSP_ID, COMPONENT_ID, NETWORK1_ID, NETWORK1_ID.getNetworkCompositionData().getName());
@@ -122,7 +235,7 @@
   public void testCreateOnUploadVsp_negative() {
 
     testCreate_negative(new NicEntity(VSP_ID, VERSION, COMPONENT_ID, null), USER,
-        VendorSoftwareProductErrorCodes.VSP_COMPOSITION_EDIT_NOT_ALLOWED);
+        VendorSoftwareProductErrorCodes.ADD_NIC_NOT_ALLOWED_IN_HEAT_ONBOARDING);
   }
 
   @Test
@@ -230,7 +343,7 @@
   @Test
   public void testDeleteOnUploadVsp_negative() {
     testDelete_negative(VSP_ID, VERSION, COMPONENT_ID, NIC1_ID, USER,
-        VendorSoftwareProductErrorCodes.VSP_COMPOSITION_EDIT_NOT_ALLOWED);
+        VendorSoftwareProductErrorCodes.DELETE_NIC_NOT_ALLOWED);
   }
 
   @Test(expectedExceptions = CoreException.class,
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java
index 5a2f76b..f79a56b 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java
@@ -20,8 +20,6 @@
 
 package org.openecomp.sdc.vendorsoftwareproduct.impl;
 
-import org.apache.commons.lang3.tuple.ImmutablePair;
-import org.apache.commons.lang3.tuple.Pair;
 import org.mockito.ArgumentCaptor;
 import org.mockito.Captor;
 import org.mockito.InjectMocks;
@@ -29,7 +27,6 @@
 import org.mockito.MockitoAnnotations;
 import org.mockito.Spy;
 import org.openecomp.core.enrichment.factory.EnrichmentManagerFactory;
-import org.openecomp.core.enrichment.types.ArtifactType;
 import org.openecomp.core.factory.impl.AbstractFactoryBase;
 import org.openecomp.core.model.dao.EnrichedServiceModelDao;
 import org.openecomp.core.model.dao.ServiceModelDao;
@@ -48,7 +45,8 @@
 import org.openecomp.sdc.tosca.datatypes.model.CapabilityDefinition;
 import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade;
 import org.openecomp.sdc.vendorlicense.licenseartifacts.VendorLicenseArtifactsService;
-import org.openecomp.sdc.vendorsoftwareproduct.MibManager;
+import org.openecomp.sdc.vendorsoftwareproduct.ManualVspToscaManager;
+import org.openecomp.sdc.vendorsoftwareproduct.MonitoringUploadsManager;
 import org.openecomp.sdc.vendorsoftwareproduct.OrchestrationTemplateCandidateManager;
 import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants;
 import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDao;
@@ -105,9 +103,6 @@
 import static org.mockito.Mockito.verify;
 
 
-/**
- * Created by TALIO on 4/23/2016
- */
 public class VendorSoftwareProductManagerImplTest {
   private static final String INVALID_VERSION_MSG = "Invalid requested version.";
 
@@ -147,6 +142,8 @@
   private PackageInfoDao packageInfoDao;
   @Mock
   private VendorSoftwareProductInfoDao vspInfoDaoMock;
+  @Mock
+  private ManualVspToscaManager manualVspToscaManager;
 
 
   @Spy
@@ -154,7 +151,7 @@
   private VendorSoftwareProductManagerImpl vendorSoftwareProductManager;
 
   private OrchestrationTemplateCandidateManager candidateManager;
-  private MibManager mibManager;
+  private MonitoringUploadsManager monitoringUploadsManager;
 
   @Captor
   private ArgumentCaptor<ActivityLogEntity> activityLogEntityArg;
@@ -467,6 +464,7 @@
         VSP_ID, USER1, VersionableEntityAction.Read);
 
     VspDetails vsp = new VspDetails(VSP_ID, VERSION01);
+    vsp.setOnboardingMethod("Manual");
     doReturn(vsp).when(vspInfoDaoMock).get(anyObject());
 
     VspQuestionnaireEntity vspQuestionnaire = new VspQuestionnaireEntity(VSP_ID, VERSION01);
@@ -757,20 +755,21 @@
 
     return fileNames;
   }
-
+  /*
+  //Disabled for sonar null pointer issue for componentEntities
   private Pair<String, String> uploadMib(String vspId, String user, String filePath,
                                          String fileName) {
     List<ComponentEntity> componentEntities = null;
     //(List<ComponentEntity>) vendorSoftwareProductManager.listComponents(vspId, null, user);
-    mibManager.upload(getFileInputStream(filePath),
+    monitoringUploadsManager.upload(getFileInputStream(filePath),
         fileName, vspId,
-        VERSION01, componentEntities.get(0).getId(), ArtifactType.SNMP_POLL, user);
+        VERSION01, componentEntities.get(0).getId(), MonitoringUploadType.SNMP_POLL, user);
     //TODO: add validate of addActionLog() func call
 
     return new ImmutablePair<>(componentEntities.get(0).getId(),
         componentEntities.get(0).getComponentCompositionData()
             .getDisplayName());
-  }
+  }*/
 
   private void createPackageFromUpload(String vspId, String user, String filePath)
       throws IOException {
@@ -901,6 +900,7 @@
     vspDetails.setVlmVersion(new Version(1, 0));
     vspDetails.setLicenseAgreement(licenseAgreement);
     vspDetails.setFeatureGroups(featureGroups);
+    vspDetails.setOnboardingMethod("HEAT");
     return vspDetails;
   }
 
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/CandidateServiceImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/CandidateServiceImplTest.java
index 134dbfb..3d98ab7 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/CandidateServiceImplTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/CandidateServiceImplTest.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.
@@ -92,6 +92,8 @@
     vspDetails.setName("vspTest");
     vspDetails.setDescription("Test description");
     vspDetails.setVersion(new Version(0, 1));
+    //vspDetails.setOnboardingMethod(VSPCommon.OnboardingMethod.HEAT.name());
+    vspDetails.setOnboardingMethod("HEAT");
 
     FilesDataStructure structure = JsonUtil.json2Object(getExpectedJson(), FilesDataStructure.class);
 
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionDataExtractorImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionDataExtractorImplTest.java
index d6060e6..a85153e 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionDataExtractorImplTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionDataExtractorImplTest.java
@@ -26,7 +26,7 @@
 import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
 import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate;
 import org.openecomp.sdc.tosca.services.ToscaUtil;
-import org.openecomp.sdc.tosca.services.yamlutil.ToscaExtensionYamlUtil;
+import org.openecomp.sdc.tosca.services.ToscaExtensionYamlUtil;
 import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Component;
 import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionData;
 import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Network;
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/schemagenerator/SchemaGeneratorTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/schemagenerator/SchemaGeneratorTest.java
index fdbf400..33cf18c 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/schemagenerator/SchemaGeneratorTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/schemagenerator/SchemaGeneratorTest.java
@@ -252,12 +252,16 @@
   }
 
   @Test
-  public void testGenerateNicCompositionManual() {
+  public void testGenerateNicCompositionManual() {Nic nic = new Nic();
+    nic.setName("upload nic1 name");
+    nic.setDescription("upload nic1 desc");
+    nic.setNetworkType(NetworkType.Internal);
     NicCompositionSchemaInput input = new NicCompositionSchemaInput();
+
     input.setManual(true);
     input.setNetworkIds(
         Arrays.asList("manual networkId1", "manual networkId2", "manual networkId3"));
-
+    input.setNic(nic);
     String schema = SchemaGenerator
         .generate(SchemaTemplateContext.composition, CompositionEntityType.nic, input);
     validateSchema(schema);
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/HeatCleanup/HeatCleanupOnNewUploadTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/HeatCleanup/HeatCleanupOnNewUploadTest.java
index e1073db..4d925c0 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/HeatCleanup/HeatCleanupOnNewUploadTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/HeatCleanup/HeatCleanupOnNewUploadTest.java
@@ -72,7 +72,8 @@
 
     VspDetails vspDetails = vendorSoftwareProductManager.createVsp(VSPCommon
         .createVspDetails(null, null, "VSPTestEmpty", "Test-vsp-empty", "vendorName", "vlm1Id",
-            "icon", "category", "subCategory", "123", null), USER1);
+            "icon", "category", "subCategory", "123", null, VSPCommon.OnboardingMethod.HEAT.name()),
+        USER1);
     vspId = vspDetails.getId();
     vspActiveVersion = vspDetails.getVersion();
   }
@@ -106,7 +107,7 @@
     String componentId = components.get(0).getId();
 
     vendorSoftwareProductManager
-        .upload(mib, "vDNS.zip", vspId, componentId, ArtifactType.SNMP_TRAP, USER1);
+        .upload(mib, "vDNS.zip", vspId, componentId, MonitoringUploadType.SNMP_TRAP, USER1);
     vendorSoftwareProductManager
         .createProcess(new ProcessEntity(vspId, vspActiveVersion, componentId, null), USER1);
 
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/quesionnaire/invalidComponent.json b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/quesionnaire/invalidComponent.json
index 9b10297..be9e13a 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/quesionnaire/invalidComponent.json
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/quesionnaire/invalidComponent.json
@@ -6,9 +6,6 @@
       "drivers": ",Lz-m3R7iwRREmjBA3Ss6b0K8YBcH4SS66UJSG8OGTlaMs6Be"
     },
     "image": {
-      "ephemeralDiskSizePerVM": 8,
-      "format": "iso",
-      "bootDiskSizePerVM": 100,
       "providedBy": "Vendor"
     },
     "dnsConfiguration": "dolore adipisicing proident aute amet",
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/quesionnaire/schema/componentQuestionnaire.json b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/quesionnaire/schema/componentQuestionnaire.json
index e0bd377..7870df8 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/quesionnaire/schema/componentQuestionnaire.json
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/quesionnaire/schema/componentQuestionnaire.json
@@ -157,11 +157,12 @@
             "MemoryRAM": {
               "type": "string",
               "enum": [
+                "1 GB",
                 "2 GB",
                 "4 GB",
                 "8 GB"
               ],
-              "default": "2 GB"
+              "default": "1 GB"
             }
           },
           "additionalProperties": false
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/quesionnaire/validComponent.json b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/quesionnaire/validComponent.json
index 4e9e9aa..316d8c5 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/quesionnaire/validComponent.json
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/quesionnaire/validComponent.json
@@ -6,9 +6,6 @@
       "drivers": ",Lz-m3R7iwRREmjBA3Ss6b0K8YBcH4SS66UJSG8OGTlaMs6Be"
     },
     "image": {
-      "ephemeralDiskSizePerVM": 8,
-      "format": "iso",
-      "bootDiskSizePerVM": 100,
       "providedBy": "Vendor"
     },
     "dnsConfiguration": "dolore adipisicing proident aute amet",
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/vesTest-yml_only.zip b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/vesTest-yml_only.zip
new file mode 100644
index 0000000..8522252
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/vesTest-yml_only.zip
Binary files differ
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager/zips/invalid_ves_file.zip b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager/zips/invalid_ves_file.zip
new file mode 100644
index 0000000..d96a5b6
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager/zips/invalid_ves_file.zip
Binary files differ
diff --git a/openecomp-be/backend/pom.xml b/openecomp-be/backend/pom.xml
index f37d11b..6875769 100644
--- a/openecomp-be/backend/pom.xml
+++ b/openecomp-be/backend/pom.xml
@@ -22,6 +22,7 @@
         <module>openecomp-sdc-action-manager</module>
         <module>openecomp-sdc-application-config-manager</module>
         <module>openecomp-sdc-activity-log-manager</module>
+        <module>openecomp-sdc-healthcheck-manager</module>
     </modules>
 
     
diff --git a/openecomp-be/backend/pom.xml.versionsBackup b/openecomp-be/backend/pom.xml.versionsBackup
new file mode 100644
index 0000000..15ac71b
--- /dev/null
+++ b/openecomp-be/backend/pom.xml.versionsBackup
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         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>
+        <artifactId>openecomp-sdc</artifactId>
+        <groupId>org.openecomp.sdc</groupId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.openecomp.sdc</groupId>
+    <artifactId>backend</artifactId>
+    <packaging>pom</packaging>
+
+    <modules>
+        <module>openecomp-sdc-vendor-license-manager</module>
+        <module>openecomp-sdc-vendor-software-product-manager</module>
+        <module>openecomp-sdc-validation-manager</module>
+        <module>openecomp-sdc-action-manager</module>
+        <module>openecomp-sdc-application-config-manager</module>
+    </modules>
+
+    
+</project>
