Process CSAR

1. Handle Main service Template
2. keep copy of the onboarded package
3. Sonar fixes
Issue-ID: SDC-2153
Issue-ID: SDC-2112

Change-Id: I7f84d5d6d7a4c6eeed317a7ddd19b53272182fd8
Signed-off-by: bilal.iqbal <bilal.iqbal@est.tech>
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 4c8faf8..ebe100e 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/pom.xml
+++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/pom.xml
@@ -39,8 +39,8 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>org.testng</groupId>
-            <artifactId>testng</artifactId>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
             <scope>test</scope>
         </dependency>
         <dependency>
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 4183f79..f27e6c0 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
@@ -248,101 +248,73 @@
 
   @Override
   public EntitlementPoolEntity createEntitlementPool(EntitlementPoolEntity entitlementPool) {
-    entitlementPool.setStartDate(entitlementPool.getStartDate() != null ? (entitlementPool
-        .getStartDate().trim().length() != 0 ? entitlementPool.getStartDate() + EP_POOL_START_TIME
-        : null) : null);
-    entitlementPool.setExpiryDate(entitlementPool.getExpiryDate() != null ? (entitlementPool
-        .getExpiryDate().trim().length() != 0 ? entitlementPool.getExpiryDate() + EP_POOL_EXPIRY_TIME 
-        : null) : null);
-
+    entitlementPool.setStartDate(getDate(entitlementPool.getStartDate(), EP_POOL_START_TIME));
+    entitlementPool.setExpiryDate(getDate(entitlementPool.getExpiryDate(), EP_POOL_EXPIRY_TIME));
     validateCreateDate(entitlementPool.getStartDate(), entitlementPool.getExpiryDate(),
         entitlementPool.getVendorLicenseModelId());
     return vendorLicenseFacade.createEntitlementPool(entitlementPool);
   }
 
-  private void validateCreateDate(String startDate, String expiryDate,
-                                  String vendorLicenseModelId) {
-  LocalDate parsedStartDate = parseLocalDate(startDate);
-  LocalDate parsedExpiryDate = parseLocalDate(expiryDate);
-
-
-    validateIfStartAndExpiryDateIsNotNull(startDate, expiryDate,
-            vendorLicenseModelId, parsedStartDate, parsedExpiryDate);
-
-    if (startDate != null && expiryDate == null
-                      && parsedStartDate.atStartOfDay().isBefore
-          (LocalDate.now().atStartOfDay())) {
-        throw new CoreException(
-            new InvalidDateErrorBuilder(vendorLicenseModelId)
-                .build());
-    }
-
-    if (startDate == null && expiryDate != null) {
-      throw new CoreException(
-          new InvalidDateErrorBuilder(vendorLicenseModelId)
-              .build());
-
-    }
+  private String getDate(String date, String poolTime){
+    return date != null ? (!date.trim().isEmpty() ? date + poolTime: null) : null;
   }
 
-  private void validateIfStartAndExpiryDateIsNotNull(String startDate, String expiryDate,
-                                                     String vendorLicenseModelId,
-                                                     LocalDate parsedStartDate,
-                                                     LocalDate parsedExpiryDate) {
-    if (startDate != null && expiryDate != null
-            && isValidatStartAndExpiryDate(parsedStartDate, parsedExpiryDate)) {
+  private void validateCreateDate(String startDate, String expiryDate,
+                                  String vendorLicenseModelId) {
+    if(isNull(startDate, expiryDate) || isEmpty(startDate, expiryDate) ||
+            isInvalidStartEndDate(startDate, expiryDate)){
       throw new CoreException(
               new InvalidDateErrorBuilder(vendorLicenseModelId)
                       .build());
     }
   }
 
-  private boolean isValidatStartAndExpiryDate(LocalDate parsedStartDate,
-                                              LocalDate parsedExpiryDate) {
+  private boolean isInvalidStartEndDate(String startDate, String expiryDate) {
+    LocalDate parsedStartDate = parseLocalDate(startDate);
+    LocalDate parsedExpiryDate = parseLocalDate(expiryDate);
+
     return parsedStartDate.atStartOfDay().isBefore(LocalDate.now().atStartOfDay())
-    || parsedExpiryDate.atStartOfDay().isEqual(parsedStartDate.atStartOfDay())
-    || parsedExpiryDate.isBefore(parsedStartDate);
+            || parsedExpiryDate.atStartOfDay().isEqual(parsedStartDate.atStartOfDay())
+            || parsedExpiryDate.isBefore(parsedStartDate);
+  }
+
+  private boolean isEmpty(String startDate, String expiryDate) {
+    return startDate.isEmpty() || expiryDate.isEmpty();
+  }
+
+  private boolean isNull(String startDate, String expiryDate) {
+    return startDate == null || expiryDate == null;
   }
 
   private static LocalDate parseLocalDate(String date) {
-    if (date == null || date.isEmpty()) {
-      return null;
-    }
-
     return LocalDate.parse(date, FORMATTER );
   }
 
   private void validateUpdateDate(String startDate, String expiryDate,
                                   String vendorLicenseModelId) {
-    LocalDate parsedStartDate = parseLocalDate(startDate);
-    LocalDate parsedExpiryDate = parseLocalDate(expiryDate);
 
-    if (startDate != null && expiryDate != null
-            && (parsedExpiryDate.atStartOfDay()
-            .isEqual(parsedStartDate.atStartOfDay())
-            || parsedExpiryDate.isBefore(parsedStartDate ))) {
+    if(isNull(startDate, expiryDate) || isEmpty(startDate, expiryDate)
+     || isInvalidUpdateDate(startDate, expiryDate)){
       throw new CoreException(
               new InvalidDateErrorBuilder(vendorLicenseModelId)
                       .build());
     }
+  }
 
-    if (startDate == null && expiryDate != null) {
-      throw new CoreException(
-          new InvalidDateErrorBuilder(vendorLicenseModelId)
-              .build());
+  private boolean isInvalidUpdateDate(String startDate, String expiryDate) {
 
-    }
+    LocalDate parsedStartDate = parseLocalDate(startDate);
+    LocalDate parsedExpiryDate = parseLocalDate(expiryDate);
+
+    return parsedExpiryDate.atStartOfDay()
+            .isEqual(parsedStartDate.atStartOfDay())
+            || parsedExpiryDate.isBefore(parsedStartDate);
   }
 
   @Override
   public void updateEntitlementPool(EntitlementPoolEntity entitlementPool) {
-    entitlementPool.setStartDate(entitlementPool.getStartDate() != null ? (entitlementPool
-        .getStartDate().trim().length() != 0 ? entitlementPool.getStartDate() + EP_POOL_START_TIME
-        : null) : null);
-    entitlementPool.setExpiryDate(entitlementPool.getExpiryDate() != null ? (entitlementPool
-        .getExpiryDate().trim().length() != 0 ? entitlementPool.getExpiryDate() + EP_POOL_EXPIRY_TIME 
-        : null) : null);
-
+    entitlementPool.setStartDate(getDate(entitlementPool.getStartDate(), EP_POOL_START_TIME));
+    entitlementPool.setExpiryDate(getDate(entitlementPool.getExpiryDate(), EP_POOL_EXPIRY_TIME));
     validateUpdateDate(entitlementPool.getStartDate(), entitlementPool.getExpiryDate(),
         entitlementPool.getVendorLicenseModelId());
     vendorLicenseFacade.updateEntitlementPool(entitlementPool);
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
index 986e732..101ecde 100644
--- 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
@@ -16,6 +16,10 @@
 
 package org.openecomp.sdc.vendorlicense;
 
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
 import org.mockito.InjectMocks;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
@@ -31,11 +35,6 @@
 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.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -82,12 +81,12 @@
     return limitEntity;
   }
 
-  @BeforeMethod
+  @Before
   public void setUp() throws Exception {
     MockitoAnnotations.initMocks(this);
   }
 
-  @AfterMethod
+  @After
   public void tearDown(){
     vendorLicenseManagerImpl = null;
   }
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/EntitlementPoolTest.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/EntitlementPoolTest.java
index ca242f5..03be183 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/EntitlementPoolTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/EntitlementPoolTest.java
@@ -17,6 +17,10 @@
 
 package org.openecomp.sdc.vendorlicense.impl;
 
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
 import org.mockito.InjectMocks;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
@@ -28,11 +32,6 @@
 import org.openecomp.sdc.vendorlicense.errors.VendorLicenseErrorCodes;
 import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade;
 import org.openecomp.sdc.versioning.dao.types.Version;
-import org.testng.Assert;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
 import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
@@ -94,13 +93,13 @@
     return entitlementPool;
   }
 
-  @BeforeMethod
+  @Before
   public void setUp() throws Exception {
     MockitoAnnotations.initMocks(this);
   }
 
 
-  @AfterMethod
+  @After
   public void tearDown(){
     vendorLicenseManagerImpl = null;
   }
@@ -127,8 +126,7 @@
   }
 
 
-  @Test(expectedExceptions = CoreException.class, expectedExceptionsMessageRegExp = "Vendor " +
-      "license model with id vlm1_id has invalid date range.")
+  @Test(expected = CoreException.class)
   public void createWithInvalidStartExpiryDateTest() {
 
     Set<OperationalScope> opScopeChoices;
@@ -146,12 +144,11 @@
     ep2.setExpiryDate(LocalDate.now().minusDays(2L).format(formatter));
     ep2.setVendorLicenseModelId(vlm1_id);
     vendorLicenseManagerImpl.createEntitlementPool(ep2).getId();
-    Assert.fail();
+    Assert.fail("Vendor license model with id vlm1_id has invalid date range.");
 
   }
 
-  @Test(expectedExceptions = CoreException.class, expectedExceptionsMessageRegExp = "Vendor " +
-      "license model with id vlm1_id has invalid date range.")
+  @Test(expected = CoreException.class)
   public void createWithoutStartDateTest() {
 
     Set<OperationalScope> opScopeChoices;
@@ -168,12 +165,11 @@
     ep2.setExpiryDate(LocalDate.now().plusDays(2L).format(formatter));
     ep2.setVendorLicenseModelId(vlm1_id);
     vendorLicenseManagerImpl.createEntitlementPool(ep2).getId();
-    Assert.fail();
+    Assert.fail("Vendor license model with id vlm1_id has invalid date range.");
 
   }
 
-  @Test(expectedExceptions = CoreException.class, expectedExceptionsMessageRegExp = "Vendor " +
-      "license model with id vlm1_id has invalid date range.")
+  @Test(expected = CoreException.class)
   public void createWithSameStartExpiryDateTest() {
 
     Set<OperationalScope> opScopeChoices;
@@ -191,7 +187,7 @@
     ep2.setExpiryDate(LocalDate.now().format(formatter));
     ep2.setVendorLicenseModelId(vlm1_id);
     vendorLicenseManagerImpl.createEntitlementPool(ep2).getId();
-    Assert.fail();
+    Assert.fail("Vendor license model with id vlm1_id has invalid date range.");
   }
 
   @Test
@@ -214,8 +210,7 @@
     vendorLicenseManagerImpl.updateEntitlementPool(ep2);
   }
 
-  @Test(expectedExceptions = CoreException.class, expectedExceptionsMessageRegExp = "Vendor " +
-      "license model with id vlm1_id has invalid date range.")
+  @Test(expected = CoreException.class)
   public void updateWithInvalidStartExpiryDateTest() {
 
     Set<OperationalScope> opScopeChoices;
@@ -233,7 +228,7 @@
     ep2.setExpiryDate(LocalDate.now().minusDays(2L).format(formatter));
     ep2.setVendorLicenseModelId(vlm1_id);
     vendorLicenseManagerImpl.updateEntitlementPool(ep2);
-    Assert.fail();
+    Assert.fail("Vendor license model with id vlm1_id has invalid date range.");
 
   }
 
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/FeatureGroupTest.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/FeatureGroupTest.java
index b7636bb..ca37dcd 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/FeatureGroupTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/FeatureGroupTest.java
@@ -16,6 +16,10 @@
 
 package org.openecomp.sdc.vendorlicense.impl;
 
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
 import org.mockito.InjectMocks;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
@@ -28,11 +32,6 @@
 import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade;
 import org.openecomp.sdc.versioning.VersioningManager;
 import org.openecomp.sdc.versioning.dao.types.Version;
-import org.testng.Assert;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashSet;
@@ -87,7 +86,7 @@
   private VendorLicenseManagerImpl vendorLicenseManagerImpl;
 
 
-  @AfterMethod
+  @After
   public void tearDown(){
     vendorLicenseManagerImpl = null;
   }
@@ -114,7 +113,7 @@
     return featureGroup;
   }
 
-  @BeforeMethod
+  @Before
   public void setUp() throws Exception {
     MockitoAnnotations.initMocks(this);
   }
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/LicenseAgreementTest.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/LicenseAgreementTest.java
index 511ebb8..722343a 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/LicenseAgreementTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/LicenseAgreementTest.java
@@ -16,6 +16,10 @@
 
 package org.openecomp.sdc.vendorlicense.impl;
 
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
 import org.mockito.*;
 import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity;
 import org.openecomp.sdc.vendorlicense.VendorLicenseConstants;
@@ -27,12 +31,11 @@
 import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade;
 import org.openecomp.sdc.versioning.VersioningManager;
 import org.openecomp.sdc.versioning.dao.types.Version;
-import org.testng.Assert;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
 
 import static org.mockito.Matchers.anyObject;
 import static org.mockito.Mockito.*;
@@ -78,12 +81,12 @@
   private ArgumentCaptor<ActivityLogEntity> activityLogEntityArg;
 
 
-  @BeforeMethod
+  @Before
   public void setUp() throws Exception {
     MockitoAnnotations.initMocks(this);
   }
 
-  @AfterMethod
+  @After
   public void tearDown(){
     vendorLicenseManager = null;
   }
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/LicenseKeyGroupTest.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/LicenseKeyGroupTest.java
index c5076fd..d8e2959 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/LicenseKeyGroupTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/LicenseKeyGroupTest.java
@@ -17,6 +17,10 @@
 
 package org.openecomp.sdc.vendorlicense.impl;
 
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
 import org.mockito.InjectMocks;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
@@ -31,11 +35,6 @@
 import org.openecomp.sdc.vendorlicense.errors.VendorLicenseErrorCodes;
 import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade;
 import org.openecomp.sdc.versioning.dao.types.Version;
-import org.testng.Assert;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
 import java.time.LocalDate;
 import java.time.format.DateTimeFormatter;
 import java.util.Arrays;
@@ -73,12 +72,12 @@
   @Spy
   private VendorLicenseManagerImpl vendorLicenseManagerImpl;
 
-  @BeforeMethod
+  @Before
   public void setUp() throws Exception {
     MockitoAnnotations.initMocks(this);
   }
 
-  @AfterMethod
+  @After
   public void tearDown(){
     vendorLicenseManagerImpl = null;
   }
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseModelTest.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseModelTest.java
index b81c2e8..e072453 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseModelTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseModelTest.java
@@ -1,5 +1,8 @@
 package org.openecomp.sdc.vendorlicense.impl;
 
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
 import org.mockito.*;
 import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity;
 import org.openecomp.sdc.vendorlicense.VendorLicenseConstants;
@@ -8,9 +11,6 @@
 import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade;
 import org.openecomp.sdc.versioning.VersioningManager;
 import org.openecomp.sdc.versioning.dao.types.Version;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
 
 import static org.mockito.Matchers.any;
 import static org.mockito.Mockito.*;
@@ -59,12 +59,12 @@
   private ArgumentCaptor<ActivityLogEntity> activityLogEntityArg;
 
 
-  @BeforeMethod
+  @Before
   public void setUp() throws Exception {
     MockitoAnnotations.initMocks(this);
   }
 
-  @AfterMethod
+  @After
   public void tearDown(){
     vendorLicenseManager = null;
   }
@@ -121,7 +121,7 @@
     verify(vendorLicenseFacadeMcok).getVendorLicenseModel(vlm1_id, VERSION01);
   }
 
-  @Test(expectedExceptions = UnsupportedOperationException.class)
+  @Test(expected = UnsupportedOperationException.class)
   public void testDeleteVLMUnsupportedOperation() {
     vendorLicenseManager.deleteVendorLicenseModel(vlm1_id, null); // TODO: 8/13/2017
   }
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
index 1d8c0b4..58cb2cf 100644
--- 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
@@ -21,6 +21,8 @@
 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.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
 import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
 import org.openecomp.sdc.vendorsoftwareproduct.ManualVspToscaManager;
 import org.openecomp.sdc.vendorsoftwareproduct.services.ManualVspDataCollectionService;
@@ -33,6 +35,8 @@
 
 public class ManualVspToscaManagerImpl implements ManualVspToscaManager {
 
+  private static final Logger LOGGER = LoggerFactory.getLogger(ManualVspToscaManagerImpl.class);
+
   private final ManualVspDataCollectionService
       manualVspDataCollectionService = new ManualVspDataCollectionService();
 
@@ -45,6 +49,7 @@
       releaseVendor = manualVspDataCollectionService.getReleaseVendor(vspId, version);
     } catch (Exception ex) {
       releaseVendor = Optional.empty();
+      LOGGER.error("Failed to get release vendor: {}", ex.getMessage(), ex);
     }
     releaseVendor.ifPresent(vspModelInfo::setReleaseVendor);
 
@@ -54,6 +59,7 @@
       allowedFlavors = manualVspDataCollectionService.getAllowedFlavors(vspId, version);
     } catch (Exception ex) {
       allowedFlavors = null;
+      LOGGER.error("Failed to get allowed flavours: {}", ex.getMessage(), ex);
     }
     if (MapUtils.isNotEmpty(allowedFlavors)) {
       vspModelInfo.setAllowedFlavors(allowedFlavors);
@@ -66,6 +72,7 @@
           manualVspDataCollectionService.getVspComponentImages(vspId, version);
     } catch (Exception ex) {
       vspComponentImages = null;
+      LOGGER.error("Failed to get VSP components Images: {}", ex.getMessage(), ex);
     }
     if (MapUtils.isNotEmpty(vspComponentImages)) {
       vspModelInfo.setMultiFlavorVfcImages(vspComponentImages);
@@ -77,6 +84,7 @@
       vspComponents = manualVspDataCollectionService.getVspComponents(vspId, version);
     } catch (Exception ex) {
       vspComponents = null;
+      LOGGER.error("Failed to get VSP components: {}", ex.getMessage(), ex);
     }
     if (MapUtils.isNotEmpty(vspComponents)) {
       vspModelInfo.setComponents(vspComponents);
@@ -88,6 +96,7 @@
       vspComponentNics = manualVspDataCollectionService.getVspComponentNics(vspId, version);
     } catch (Exception ex) {
       vspComponentNics = null;
+      LOGGER.error("Failed to get VSP component NIC data: {}", ex.getMessage(), ex);
     }
     if (MapUtils.isNotEmpty(vspComponentNics)) {
       vspModelInfo.setNics(vspComponentNics);
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationUtil.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationUtil.java
index c78e000..3dfe3a2 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationUtil.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationUtil.java
@@ -36,6 +36,8 @@
 import org.openecomp.sdc.heat.datatypes.structure.ValidationStructureList;
 import org.openecomp.sdc.heat.services.tree.HeatTreeManager;
 import org.openecomp.sdc.heat.services.tree.HeatTreeManagerUtil;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
 import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
 import org.openecomp.sdc.vendorsoftwareproduct.CompositionEntityDataManager;
 import org.openecomp.sdc.vendorsoftwareproduct.CompositionEntityDataManagerFactory;
@@ -56,6 +58,7 @@
 
 public class OrchestrationUtil {
 
+  private static final Logger LOGGER = LoggerFactory.getLogger(OrchestrationUtil.class);
   public static final String ORCHESTRATION_CONFIG_NAMESPACE = "orchestration";
   public static final String ORCHESTRATION_IMPL_KEY = "orchestration_impl";
 
@@ -112,9 +115,12 @@
       uploadFileResponse.addStructureError(
           SdcCommon.UPLOAD_FILE,
           new ErrorMessage(ErrorLevel.ERROR, Messages.INVALID_ZIP_FILE.getErrorMessage()));
+      LOGGER.error("{}\n{}", Messages.INVALID_ZIP_FILE.getErrorMessage(),
+              exception.getMessage(), exception);
     } catch (CoreException coreException) {
       uploadFileResponse.addStructureError(
           SdcCommon.UPLOAD_FILE, new ErrorMessage(ErrorLevel.ERROR, coreException.getMessage()));
+      LOGGER.error(coreException.getMessage(), coreException);
     }
     return Optional.ofNullable(contentMap);
   }
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004MetaDirectoryValidator.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004MetaDirectoryValidator.java
index 49233c4..a76acf5 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004MetaDirectoryValidator.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004MetaDirectoryValidator.java
@@ -288,9 +288,9 @@
     }
 
     private boolean isPnfMetadata(Map<String, String> metadata) {
-        String metadataType = null;
+        String metadataType = "";
         for(String key: metadata.keySet()) {
-            if(metadataType == null){
+            if(metadataType.isEmpty()){
                  metadataType = key.contains(TOSCA_TYPE_PNF) ? TOSCA_TYPE_PNF : TOSCA_TYPE_VNF;
             }else if(!key.contains(metadataType)){
                 throw new InvalidManifestMetadataException(Messages.MANIFEST_METADATA_INVALID_ENTRY.getErrorMessage());
@@ -300,9 +300,9 @@
     }
 
     private void handleVnfMetadataEntries(Map<String, String> metadata) {
-        for (String requiredPnfEntry : MANIFEST_VNF_METADATA) {
-            if (!metadata.containsKey(requiredPnfEntry)) {
-                reportError(ErrorLevel.ERROR, String.format(Messages.MANIFEST_METADATA_MISSING_ENTRY.getErrorMessage(), requiredPnfEntry));
+        for (String requiredVnfEntry : MANIFEST_VNF_METADATA) {
+            if (!metadata.containsKey(requiredVnfEntry)) {
+                reportError(ErrorLevel.ERROR, String.format(Messages.MANIFEST_METADATA_MISSING_ENTRY.getErrorMessage(), requiredVnfEntry));
             }
         }
     }
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessCsarHandler.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessCsarHandler.java
index 28eb7f1..7be3eb9 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessCsarHandler.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessCsarHandler.java
@@ -18,12 +18,12 @@
 
 import org.apache.commons.collections4.MapUtils;
 import org.openecomp.core.impl.ToscaConverterImpl;
+import org.openecomp.core.impl.ToscaSolConverterImpl;
 import org.openecomp.core.utilities.file.FileContentHandler;
 import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
 import org.openecomp.core.validation.util.MessageContainerUtil;
 import org.openecomp.sdc.common.errors.CoreException;
-import org.openecomp.sdc.common.errors.ErrorCode;
-import org.openecomp.sdc.common.errors.GeneralErrorBuilder;
+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.heat.datatypes.structure.HeatStructureTree;
@@ -39,6 +39,8 @@
 import org.openecomp.sdc.vendorsoftwareproduct.factory.CandidateServiceFactory;
 import org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.OrchestrationUtil;
 import org.openecomp.sdc.vendorsoftwareproduct.services.filedatastructuremodule.CandidateService;
+import org.openecomp.sdc.vendorsoftwareproduct.services.impl.etsi.ETSIService;
+import org.openecomp.sdc.vendorsoftwareproduct.services.impl.etsi.ETSIServiceImpl;
 import org.openecomp.sdc.vendorsoftwareproduct.types.OrchestrationTemplateActionResponse;
 import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse;
 
@@ -46,12 +48,12 @@
 import java.io.IOException;
 import java.util.*;
 
-public class OrchestrationTemplateProcessCsarHandler
-    implements OrchestrationTemplateProcessHandler {
-  private static final Logger LOGGER = LoggerFactory
-          .getLogger(OrchestrationTemplateProcessCsarHandler.class);
-  private final CandidateService candidateService = CandidateServiceFactory
-          .getInstance().createInterface();
+public class OrchestrationTemplateProcessCsarHandler implements OrchestrationTemplateProcessHandler {
+
+  private static final Logger LOGGER = LoggerFactory.getLogger(OrchestrationTemplateProcessCsarHandler.class);
+  private static final String SDC_ONBOARDED_PACKAGE_DIR = "ONBOARDED_PACKAGE/";
+  private static final String EXT_SEPARATOR = ".";
+  private final CandidateService candidateService = CandidateServiceFactory.getInstance().createInterface();
   private final ToscaTreeManager toscaTreeManager = new ToscaTreeManager();
 
   @Override
@@ -69,8 +71,11 @@
         FileContentHandler fileContentHandler = fileContent.get();
         processCsar(vspDetails, fileContentHandler, candidateData, response);
       } catch (CoreException e) {
-        LOGGER.error(e.getMessage());
+        LOGGER.error(e.getMessage(), e);
         response.addErrorMessageToMap(e.code().id(), e.code().message(),ErrorLevel.ERROR);
+      }catch (IOException e){
+        LOGGER.error(e.getMessage(), e);
+        response.addErrorMessageToMap(SdcCommon.PROCESS_FILE, e.getMessage(), ErrorLevel.ERROR);
       }
     } else {
       if (!uploadFileResponse.getErrors().isEmpty()) {
@@ -83,7 +88,7 @@
   private void processCsar(VspDetails vspDetails,
                            FileContentHandler fileContentHandler,
                            OrchestrationTemplateCandidateData candidateData,
-                           OrchestrationTemplateActionResponse response) {
+                           OrchestrationTemplateActionResponse response) throws IOException{
     response.setFileNames(new ArrayList<>(fileContentHandler.getFileList()));
     Map<String, List<ErrorMessage>> errors = validateCsar(fileContentHandler);
     toscaTreeManager.createTree();
@@ -117,7 +122,15 @@
             .saveUploadData(vspDetails, candidateData, byteArrayInputStream,
             fileContentHandler, tree));
 
-    ToscaServiceModel toscaServiceModel = new ToscaConverterImpl().convert(fileContentHandler);
+    ETSIService etsiService = new ETSIServiceImpl();
+    ToscaServiceModel toscaServiceModel;
+    if(etsiService.isSol004WithToscaMetaDirectory(fileContentHandler)){
+      fileContentHandler.addFile(SDC_ONBOARDED_PACKAGE_DIR + candidateData.getFileName() +
+                      EXT_SEPARATOR + candidateData.getFileSuffix(), candidateData.getContentData().array());
+      toscaServiceModel = new ToscaSolConverterImpl().convert(fileContentHandler);
+    }else{
+      toscaServiceModel = new ToscaConverterImpl().convert(fileContentHandler);
+    }
     orchestrationUtil.saveServiceModel(vspDetails.getId(),
             vspDetails.getVersion(), toscaServiceModel,
         toscaServiceModel);
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/AbstractToscaConverter.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/AbstractToscaConverter.java
new file mode 100644
index 0000000..0fc65c1
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/AbstractToscaConverter.java
@@ -0,0 +1,466 @@
+/*
+ * -
+ *  * ============LICENSE_START=======================================================
+ *  *  Copyright (C) 2019  Nordix Foundation.
+ *  * ================================================================================
+ *  * 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.
+ *  *
+ *  * SPDX-License-Identifier: Apache-2.0
+ *  * ============LICENSE_END=========================================================
+ *
+ */
+
+package org.openecomp.core.impl;
+
+import org.apache.commons.collections.MapUtils;
+import org.onap.sdc.tosca.datatypes.model.ArtifactDefinition;
+import org.onap.sdc.tosca.datatypes.model.CapabilityAssignment;
+import org.onap.sdc.tosca.datatypes.model.Import;
+import org.onap.sdc.tosca.datatypes.model.NodeFilter;
+import org.onap.sdc.tosca.datatypes.model.NodeTemplate;
+import org.onap.sdc.tosca.datatypes.model.NodeType;
+import org.onap.sdc.tosca.datatypes.model.ParameterDefinition;
+import org.onap.sdc.tosca.datatypes.model.RequirementAssignment;
+import org.onap.sdc.tosca.datatypes.model.ServiceTemplate;
+import org.onap.sdc.tosca.datatypes.model.SubstitutionMapping;
+import org.openecomp.core.converter.ServiceTemplateReaderService;
+import org.openecomp.core.converter.ToscaConverter;
+import org.openecomp.core.converter.datatypes.Constants;
+import org.openecomp.core.converter.datatypes.CsarFileTypes;
+import org.openecomp.core.converter.errors.SubstitutionMappingsConverterErrorBuilder;
+import org.openecomp.core.impl.services.ServiceTemplateReaderServiceImpl;
+import org.openecomp.core.utilities.file.FileContentHandler;
+import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
+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.tosca.datatypes.ToscaServiceModel;
+import org.openecomp.sdc.tosca.services.DataModelUtil;
+import org.openecomp.sdc.tosca.services.ToscaUtil;
+import org.openecomp.sdc.translator.services.heattotosca.globaltypes.GlobalTypesGenerator;
+import org.yaml.snakeyaml.error.YAMLException;
+import java.io.File;
+import java.io.IOException;
+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;
+import java.util.regex.Pattern;
+
+import static org.openecomp.core.converter.datatypes.Constants.ONAP_INDEX;
+import static org.openecomp.core.converter.datatypes.Constants.capabilities;
+import static org.openecomp.core.converter.datatypes.Constants.definitionsDir;
+import static org.openecomp.core.converter.datatypes.Constants.globalStName;
+import static org.openecomp.core.converter.datatypes.Constants.globalSubstitution;
+import static org.openecomp.core.converter.datatypes.Constants.inputs;
+import static org.openecomp.core.converter.datatypes.Constants.mainStName;
+import static org.openecomp.core.converter.datatypes.Constants.nodeType;
+import static org.openecomp.core.converter.datatypes.Constants.openecompHeatIndex;
+import static org.openecomp.core.converter.datatypes.Constants.outputs;
+import static org.openecomp.core.converter.datatypes.Constants.requirements;
+import static org.openecomp.core.impl.GlobalSubstitutionServiceTemplate.GLOBAL_SUBSTITUTION_SERVICE_FILE_NAME;
+import static org.openecomp.core.impl.GlobalSubstitutionServiceTemplate.HEAT_INDEX_IMPORT_FILE;
+import static org.openecomp.core.impl.GlobalSubstitutionServiceTemplate.ONAP_INDEX_IMPORT_FILE;
+import static org.openecomp.sdc.tosca.csar.CSARConstants.TOSCA_META_ORIG_PATH_FILE_NAME;
+import static org.openecomp.sdc.tosca.csar.CSARConstants.TOSCA_META_PATH_FILE_NAME;
+
+public abstract class AbstractToscaConverter implements ToscaConverter {
+
+    @Override
+    public abstract ToscaServiceModel convert(FileContentHandler fileContentHandler) throws IOException;
+
+    protected void handleMetadataFile(Map<String, byte[]> csarFiles) {
+        byte[] bytes = csarFiles.remove(TOSCA_META_PATH_FILE_NAME);
+        if (bytes != null) {
+            csarFiles.put(TOSCA_META_ORIG_PATH_FILE_NAME, bytes);
+        }
+    }
+
+    protected void handleDefintionTemplate(String key, Map<String, byte[]> csarFiles,
+                                           GlobalSubstitutionServiceTemplate gsst) {
+        try {
+            ServiceTemplateReaderService readerService = new ServiceTemplateReaderServiceImpl(csarFiles.get(key));
+            Object nodeTypes = readerService.getNodeTypes();
+            if (nodeTypes instanceof Map) {
+                Map<String, NodeType> nodeTypeMap = (Map<String, NodeType>) nodeTypes;
+                gsst.appendNodes(nodeTypeMap);
+            }
+        } catch (YAMLException ye) {
+            throw new CoreException(new ErrorCode.ErrorCodeBuilder()
+                    .withMessage("Invalid YAML content in file " + key)
+                    .withCategory(ErrorCategory.APPLICATION).build(), ye);
+        }
+    }
+
+    protected String getConcreteArtifactFileName(String fileName){
+        int artifactIndex = fileName.indexOf(CsarFileTypes.Artifacts.name());
+        if(artifactIndex < 0){
+            return fileName;
+        }
+
+        int artifactDirectoryIndex =
+                artifactIndex + CsarFileTypes.Artifacts.name().length() + 1;
+        return fileName.substring(artifactDirectoryIndex);
+    }
+
+    protected void updateToscaServiceModel(ToscaServiceModel toscaServiceModel,
+                                           Map<String, ServiceTemplate> serviceTemplates,
+                                           FileContentHandler externalFilesHandler,
+                                           GlobalSubstitutionServiceTemplate globalSubstitutionServiceTemplate,
+                                           Map<String, byte[]> csarFiles, String entryDefinitionServiceTemplateName) {
+        Collection<ServiceTemplate> globalServiceTemplates =
+                GlobalTypesGenerator.getGlobalTypesServiceTemplate(OnboardingTypesEnum.CSAR).values();
+        addGlobalServiceTemplates(globalServiceTemplates, serviceTemplates);
+        toscaServiceModel.setServiceTemplates(serviceTemplates);
+        toscaServiceModel.setEntryDefinitionServiceTemplate(entryDefinitionServiceTemplateName);
+        externalFilesHandler.addFile(TOSCA_META_ORIG_PATH_FILE_NAME,
+                csarFiles.get(TOSCA_META_ORIG_PATH_FILE_NAME));
+        toscaServiceModel.setArtifactFiles(externalFilesHandler);
+
+        if(MapUtils.isNotEmpty(globalSubstitutionServiceTemplate.getNode_types())) {
+            serviceTemplates
+                    .put(GLOBAL_SUBSTITUTION_SERVICE_FILE_NAME, globalSubstitutionServiceTemplate);
+        }
+    }
+
+    private void addGlobalServiceTemplates(Collection<ServiceTemplate> globalServiceTemplates,
+                                           Map<String, ServiceTemplate> serviceTemplates) {
+        for (ServiceTemplate serviceTemplate : globalServiceTemplates) {
+            serviceTemplates.put(ToscaUtil.getServiceTemplateFileName(serviceTemplate), serviceTemplate);
+        }
+    }
+
+    protected void handleServiceTemplate(String serviceTemplateName,
+                                         String fileName, Map<String, byte[]> csarFiles,
+                                         Map<String, ServiceTemplate> serviceTemplates) {
+        Optional<ServiceTemplate> serviceTemplate =
+                getServiceTemplateFromCsar(fileName, csarFiles);
+        serviceTemplate.ifPresent(
+                serviceTemplateValue -> addServiceTemplate(serviceTemplateName, serviceTemplateValue,
+                        serviceTemplates));
+    }
+
+    private void addServiceTemplate(String serviceTemplateName,
+                                    ServiceTemplate serviceTemplate,
+                                    Map<String, ServiceTemplate> serviceTemplates) {
+        serviceTemplates.put(serviceTemplateName, serviceTemplate);
+    }
+
+    private Optional<ServiceTemplate> getServiceTemplateFromCsar(String fileName,
+                                                                 Map<String, byte[]> csarFiles) {
+        byte[] fileContent = csarFiles.get(fileName);
+        ServiceTemplate serviceTemplate = convertServiceTemplate(fileName, fileContent);
+
+        return Optional.of(serviceTemplate);
+    }
+
+    private ServiceTemplate convertServiceTemplate(String serviceTemplateName,
+                                                   byte[] fileContent) {
+        ServiceTemplate serviceTemplate = new ServiceTemplate();
+        try {
+            ServiceTemplateReaderService readerService =
+                    new ServiceTemplateReaderServiceImpl(fileContent);
+            convertMetadata(serviceTemplateName, serviceTemplate, readerService);
+            convertToscaVersion(serviceTemplate, readerService);
+            convertImports(serviceTemplate);
+            convertNodeTypes(serviceTemplate, readerService);
+            convertTopologyTemplate(serviceTemplate, readerService);
+
+        } catch (YAMLException ye) {
+            throw new CoreException(new ErrorCode.ErrorCodeBuilder()
+                    .withMessage("Invalid YAML content in file" + serviceTemplateName)
+                    .withCategory(ErrorCategory.APPLICATION).build(), ye);
+        }
+
+
+        return serviceTemplate;
+    }
+
+    private void convertToscaVersion(ServiceTemplate serviceTemplate,
+                                     ServiceTemplateReaderService readerService) {
+        Object toscaVersion = readerService.getToscaVersion();
+        serviceTemplate.setTosca_definitions_version((String) toscaVersion);
+    }
+
+    private void convertImports(ServiceTemplate serviceTemplate) {
+        serviceTemplate.setImports(new ArrayList<>());
+        serviceTemplate.getImports()
+                .add(createImportMap(openecompHeatIndex, HEAT_INDEX_IMPORT_FILE));
+        serviceTemplate.getImports().add(createImportMap(ONAP_INDEX, ONAP_INDEX_IMPORT_FILE));
+        serviceTemplate.getImports().add(createImportMap(globalSubstitution, globalStName));
+
+    }
+
+    private Map<String, Import> createImportMap(String key, String fileName) {
+        Map<String, Import> importMap = new HashMap<>();
+        Import anImport = new Import();
+        anImport.setFile(fileName);
+        importMap.put(key, anImport);
+
+        return importMap;
+    }
+
+    private void convertMetadata(String serviceTemplateName,
+                                 ServiceTemplate serviceTemplate,
+                                 ServiceTemplateReaderService readerService) {
+        Map<String, Object> metadataToConvert = (Map<String, Object>) readerService.getMetadata();
+        Map<String, String> finalMetadata = new HashMap<>();
+
+        if (MapUtils.isNotEmpty(metadataToConvert)) {
+            for (Map.Entry<String, Object> metadataEntry : metadataToConvert.entrySet()) {
+                if (Objects.isNull(metadataEntry.getValue()) ||
+                        !(metadataEntry.getValue() instanceof String)) {
+                    continue;
+                }
+                finalMetadata.put(metadataEntry.getKey(), (String) metadataEntry.getValue());
+            }
+        }
+
+        finalMetadata.put("template_name", getTemplateNameFromStName(serviceTemplateName));
+        serviceTemplate.setMetadata(finalMetadata);
+    }
+
+    private void convertNodeTypes(ServiceTemplate serviceTemplate, ServiceTemplateReaderService readerService) {
+        Map<String, Object> nodeTypes = readerService.getNodeTypes();
+        if (MapUtils.isEmpty(nodeTypes)) {
+            return;
+        }
+
+        for (Map.Entry<String, Object> nodeTypeEntry : nodeTypes.entrySet()) {
+            Optional<NodeType> nodeType = ToscaConverterUtil
+                    .createObjectFromClass(nodeTypeEntry.getKey(), nodeTypeEntry.getValue(),
+                            NodeType.class);
+
+            nodeType.ifPresent(nodeTypeValue -> DataModelUtil
+                    .addNodeType(serviceTemplate, nodeTypeEntry.getKey(), nodeTypeValue));
+        }
+    }
+
+    private void convertTopologyTemplate(ServiceTemplate serviceTemplate,
+                                         ServiceTemplateReaderService readerService) {
+
+        convertInputs(serviceTemplate, readerService);
+        convertNodeTemplates(serviceTemplate, readerService);
+        convertOutputs(serviceTemplate, readerService);
+        convertSubstitutionMappings(serviceTemplate, readerService);
+    }
+
+    private void convertInputs(ServiceTemplate serviceTemplate,
+                               ServiceTemplateReaderService readerService) {
+        Map<String, Object> inputs = readerService.getInputs();
+        addInputsOrOutputsToServiceTemplate(serviceTemplate, inputs, Constants.inputs);
+    }
+
+    private void convertOutputs(ServiceTemplate serviceTemplate,
+                                ServiceTemplateReaderService readerService) {
+        Map<String, Object> outputs = readerService.getOutputs();
+        addInputsOrOutputsToServiceTemplate(serviceTemplate, outputs, Constants.outputs);
+    }
+
+    private void addInputsOrOutputsToServiceTemplate(ServiceTemplate serviceTemplate,
+                                                     Map<String, Object> mapToConvert,
+                                                     String inputsOrOutputs) {
+        if (MapUtils.isEmpty(mapToConvert)) {
+            return;
+        }
+
+        for (Map.Entry<String, Object> entry : mapToConvert.entrySet()) {
+            Optional<ParameterDefinition> parameterDefinition =
+                    ToscaConverterUtil.createObjectFromClass(
+                            entry.getKey(), entry.getValue(), ParameterDefinition.class);
+
+            parameterDefinition.ifPresent(parameterDefinitionValue -> {
+                Optional<Object> defaultValue =
+                        ToscaConverterUtil.getDefaultValue(entry.getValue(), parameterDefinition.get());
+                defaultValue.ifPresent(parameterDefinitionValue::set_default);
+                addToServiceTemplateAccordingToSection(
+                        serviceTemplate, inputsOrOutputs, entry.getKey(), parameterDefinition.get());
+            });
+        }
+    }
+
+    private void addToServiceTemplateAccordingToSection(ServiceTemplate serviceTemplate,
+                                                        String inputsOrOutputs,
+                                                        String parameterId,
+                                                        ParameterDefinition parameterDefinition) {
+        if (inputsOrOutputs.equals(inputs)) {
+            DataModelUtil
+                    .addInputParameterToTopologyTemplate(serviceTemplate, parameterId, parameterDefinition);
+        } else if (inputsOrOutputs.equals(outputs)) {
+            DataModelUtil
+                    .addOutputParameterToTopologyTemplate(serviceTemplate, parameterId, parameterDefinition);
+        }
+    }
+
+    private void convertNodeTemplates(ServiceTemplate serviceTemplate,
+                                      ServiceTemplateReaderService readerService) {
+        Map<String, Object> nodeTemplates = readerService.getNodeTemplates();
+        if (MapUtils.isEmpty(nodeTemplates)) {
+            return;
+        }
+
+        for (Map.Entry<String, Object> nodeTemplateEntry : nodeTemplates.entrySet()) {
+            NodeTemplate nodeTemplate = convertNodeTemplate(nodeTemplateEntry.getValue());
+            DataModelUtil.addNodeTemplate(serviceTemplate, nodeTemplateEntry.getKey(), nodeTemplate);
+        }
+    }
+
+    private void convertSubstitutionMappings(ServiceTemplate serviceTemplate,
+                                             ServiceTemplateReaderService readerService) {
+        Map<String, Object> substitutionMappings = readerService.getSubstitutionMappings();
+        if (MapUtils.isEmpty(substitutionMappings)) {
+            return;
+        }
+        SubstitutionMapping substitutionMapping = convertSubstitutionMappings(substitutionMappings);
+        DataModelUtil.addSubstitutionMapping(serviceTemplate, substitutionMapping);
+    }
+
+    private SubstitutionMapping convertSubstitutionMappings(
+            Map<String, Object> substitutionMappings) {
+        SubstitutionMapping substitutionMapping = new SubstitutionMapping();
+
+        substitutionMapping.setNode_type((String) substitutionMappings.get(nodeType));
+        substitutionMapping.setCapabilities(
+                convertSubstitutionMappingsSections(capabilities, substitutionMappings.get(capabilities)));
+        substitutionMapping.setRequirements(
+                convertSubstitutionMappingsSections(requirements, substitutionMappings.get(requirements)));
+
+        return substitutionMapping;
+    }
+
+    private Map<String, List<String>> convertSubstitutionMappingsSections(String sectionName,
+                                                                          Object sectionToConvert) {
+
+        if (Objects.isNull(sectionToConvert)) {
+            return null;
+        }
+
+        if (!(sectionToConvert instanceof Map)) {
+            throw new CoreException(
+                    new SubstitutionMappingsConverterErrorBuilder(
+                            sectionName, sectionToConvert.getClass().getSimpleName()).build());
+        }
+
+        return convertSection(sectionToConvert);
+    }
+
+    private Map<String, List<String>> convertSection(Object sectionToConvert) {
+
+        Map<String, Object> sectionAsMap = (Map<String, Object>) sectionToConvert;
+        Map<String, List<String>> convertedSection = new HashMap<>();
+
+        if (MapUtils.isEmpty(sectionAsMap)) {
+            return null;
+        }
+
+        for (Map.Entry<String, Object> entry : sectionAsMap.entrySet()) {
+            if (entry.getValue() instanceof List) {
+                convertedSection.put(entry.getKey(), (List<String>) entry.getValue());
+            }
+        }
+
+        return convertedSection;
+    }
+
+    protected  CsarFileTypes getFileType(String fileName){
+        if (isMainServiceTemplate(fileName)) {
+            return CsarFileTypes.mainServiceTemplate;
+        } else if (isGlobalServiceTemplate(fileName)) {
+            return CsarFileTypes.globalServiceTemplate;
+        } else if (isDefinitions(fileName)) {
+            return CsarFileTypes.definitionsFile;
+        } else if (isMetadataFile(fileName)) {
+            return CsarFileTypes.toscaMetadata;
+        }
+        return CsarFileTypes.externalFile;
+    }
+
+    private NodeTemplate convertNodeTemplate(Object candidateNodeTemplate) {
+        NodeTemplate nodeTemplate = new NodeTemplate();
+
+        Map<String, Object> nodeTemplateAsMap = (Map<String, Object>) candidateNodeTemplate;
+        nodeTemplate.setArtifacts((Map<String, ArtifactDefinition>) nodeTemplateAsMap.get("artifacts"));
+        nodeTemplate.setAttributes((Map<String, Object>) nodeTemplateAsMap.get("attributes"));
+        nodeTemplate.setCopy((String) nodeTemplateAsMap.get("copy"));
+        nodeTemplate.setDescription((String) nodeTemplateAsMap.get("description"));
+        nodeTemplate.setDirectives((List<String>) nodeTemplateAsMap.get("directives"));
+        nodeTemplate.setInterfaces(
+                (Map<String, Object>) nodeTemplateAsMap.get("interfaces"));
+        nodeTemplate.setNode_filter((NodeFilter) nodeTemplateAsMap.get("node_filter"));
+        nodeTemplate.setProperties((Map<String, Object>) nodeTemplateAsMap.get("properties"));
+        nodeTemplate.setRequirements(
+                (List<Map<String, RequirementAssignment>>) nodeTemplateAsMap.get("requirements"));
+        nodeTemplate.setType((String) nodeTemplateAsMap.get("type"));
+        nodeTemplate.setCapabilities(
+                convertCapabilities((Map<String, Object>) nodeTemplateAsMap.get("capabilities")));
+
+        return nodeTemplate;
+    }
+
+    private Map<String, CapabilityAssignment> convertCapabilities(Map<String, Object> capabilities) {
+        if (MapUtils.isEmpty(capabilities)) {
+            return null;
+        }
+
+        Map<String, CapabilityAssignment> convertedCapabilities = new HashMap<>();
+        for (Map.Entry<String, Object> capabilityAssignmentEntry : capabilities.entrySet()) {
+            Optional<CapabilityAssignment> capabilityAssignment = ToscaConverterUtil.createObjectFromClass
+                    (capabilityAssignmentEntry.getKey(), capabilityAssignmentEntry.getValue(),
+                            CapabilityAssignment.class);
+
+            capabilityAssignment.ifPresent(capabilityAssignmentValue ->
+                    convertedCapabilities.put(capabilityAssignmentEntry.getKey(), capabilityAssignmentValue));
+
+        }
+        return convertedCapabilities;
+    }
+
+
+    protected boolean isMainServiceTemplate(String fileName) {
+        return fileName.endsWith(mainStName);
+    }
+
+    protected boolean isMetadataFile(String fileName) {
+        return fileName.equals(TOSCA_META_PATH_FILE_NAME);
+    }
+
+    protected boolean isGlobalServiceTemplate(String fileName) {
+        return fileName.endsWith(globalStName);
+    }
+
+    protected boolean isDefinitions(String fileName) {
+        return fileName.startsWith(definitionsDir);
+    }
+
+    private String getTemplateNameFromStName(String serviceTemplateName) {
+        String fileNameWithoutDirectories = getFileNameWithoutDirectories(serviceTemplateName);
+        return fileNameWithoutDirectories.split("ServiceTemplate")[0];
+    }
+
+    private String getFileNameWithoutDirectories(String serviceTemplateName) {
+        String fileNameWithoutDirectories;
+        if (serviceTemplateName.contains("/")) {
+            String[] split = serviceTemplateName.split("/");
+            fileNameWithoutDirectories = split[split.length - 1];
+        } else if (serviceTemplateName.contains(File.separator)) {
+            String[] split = serviceTemplateName.split(Pattern.quote(File.separator));
+            fileNameWithoutDirectories = split[split.length - 1];
+        } else {
+            fileNameWithoutDirectories = serviceTemplateName;
+        }
+        return fileNameWithoutDirectories;
+    }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaConverterImpl.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaConverterImpl.java
index 2d4acdc..01738c1 100644
--- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaConverterImpl.java
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaConverterImpl.java
@@ -16,479 +16,54 @@
 
 package org.openecomp.core.impl;
 
-import org.apache.commons.collections.MapUtils;
-import org.onap.sdc.tosca.datatypes.model.ArtifactDefinition;
-import org.onap.sdc.tosca.datatypes.model.CapabilityAssignment;
-import org.onap.sdc.tosca.datatypes.model.Import;
-import org.onap.sdc.tosca.datatypes.model.NodeFilter;
-import org.onap.sdc.tosca.datatypes.model.NodeTemplate;
-import org.onap.sdc.tosca.datatypes.model.NodeType;
-import org.onap.sdc.tosca.datatypes.model.ParameterDefinition;
-import org.onap.sdc.tosca.datatypes.model.RequirementAssignment;
 import org.onap.sdc.tosca.datatypes.model.ServiceTemplate;
-import org.onap.sdc.tosca.datatypes.model.SubstitutionMapping;
-import org.openecomp.core.converter.ServiceTemplateReaderService;
-import org.openecomp.core.converter.ToscaConverter;
-import org.openecomp.core.converter.datatypes.Constants;
 import org.openecomp.core.converter.datatypes.CsarFileTypes;
-import org.openecomp.core.converter.errors.SubstitutionMappingsConverterErrorBuilder;
-import org.openecomp.core.impl.services.ServiceTemplateReaderServiceImpl;
 import org.openecomp.core.utilities.file.FileContentHandler;
-import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
-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.tosca.datatypes.ToscaServiceModel;
-import org.openecomp.sdc.tosca.services.DataModelUtil;
-import org.openecomp.sdc.tosca.services.ToscaUtil;
-import org.openecomp.sdc.translator.services.heattotosca.globaltypes.GlobalTypesGenerator;
-import org.yaml.snakeyaml.error.YAMLException;
 
-import java.io.File;
-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;
-import java.util.regex.Pattern;
 
-import static org.openecomp.core.converter.datatypes.Constants.ONAP_INDEX;
-import static org.openecomp.core.converter.datatypes.Constants.capabilities;
-import static org.openecomp.core.converter.datatypes.Constants.inputs;
-import static org.openecomp.core.converter.datatypes.Constants.nodeType;
-import static org.openecomp.core.converter.datatypes.Constants.definitionsDir;
 import static org.openecomp.core.converter.datatypes.Constants.globalStName;
-import static org.openecomp.core.converter.datatypes.Constants.globalSubstitution;
 import static org.openecomp.core.converter.datatypes.Constants.mainStName;
-import static org.openecomp.core.converter.datatypes.Constants.openecompHeatIndex;
-import static org.openecomp.core.converter.datatypes.Constants.outputs;
-import static org.openecomp.core.converter.datatypes.Constants.requirements;
-import static org.openecomp.core.impl.GlobalSubstitutionServiceTemplate.GLOBAL_SUBSTITUTION_SERVICE_FILE_NAME;
-import static org.openecomp.core.impl.GlobalSubstitutionServiceTemplate.HEAT_INDEX_IMPORT_FILE;
-import static org.openecomp.core.impl.GlobalSubstitutionServiceTemplate.ONAP_INDEX_IMPORT_FILE;
-import static org.openecomp.sdc.tosca.csar.CSARConstants.TOSCA_META_ORIG_PATH_FILE_NAME;
-import static org.openecomp.sdc.tosca.csar.CSARConstants.TOSCA_META_PATH_FILE_NAME;
 
-public class ToscaConverterImpl implements ToscaConverter {
+public class ToscaConverterImpl extends AbstractToscaConverter {
 
   @Override
   public ToscaServiceModel convert(FileContentHandler fileContentHandler) {
-    Map<String, byte[]> csarFiles = new HashMap<>(fileContentHandler.getFiles());
-    ToscaServiceModel toscaServiceModel = new ToscaServiceModel();
-    Map<String, ServiceTemplate> serviceTemplates = new HashMap<>();
-    FileContentHandler artifacts = new FileContentHandler();
-    GlobalSubstitutionServiceTemplate gsst = new GlobalSubstitutionServiceTemplate();
-    for (Map.Entry<String, byte[]> fileEntry : csarFiles.entrySet()) {
-      CsarFileTypes fileType = getFileType(fileEntry.getKey());
-      switch (fileType) {
-        case mainServiceTemplate:
-          handleServiceTemplate(mainStName, fileEntry.getKey(), csarFiles, serviceTemplates);
-          break;
+      Map<String, byte[]> csarFiles = new HashMap<>(fileContentHandler.getFiles());
+      ToscaServiceModel toscaServiceModel = new ToscaServiceModel();
+      Map<String, ServiceTemplate> serviceTemplates = new HashMap<>();
+      FileContentHandler artifacts = new FileContentHandler();
+      GlobalSubstitutionServiceTemplate gsst = new GlobalSubstitutionServiceTemplate();
+      csarFiles.putAll(fileContentHandler.getFiles());
+      for (Map.Entry<String, byte[]> fileEntry : csarFiles.entrySet()) {
+          CsarFileTypes fileType = getFileType(fileEntry.getKey());
+          switch (fileType) {
+              case mainServiceTemplate:
+                  handleServiceTemplate(mainStName, fileEntry.getKey(), csarFiles, serviceTemplates);
+                  break;
 
-                case globalServiceTemplate:
-                    handleServiceTemplate(globalStName, fileEntry.getKey(), csarFiles, serviceTemplates);
-                    break;
+              case globalServiceTemplate:
+                  handleServiceTemplate(globalStName, fileEntry.getKey(), csarFiles, serviceTemplates);
+                  break;
 
-                case externalFile:
-                    artifacts.addFile(
-                        getConcreteArtifactFileName(fileEntry.getKey()), fileEntry.getValue());
-                    break;
+              case externalFile:
+                  artifacts.addFile(
+                          getConcreteArtifactFileName(fileEntry.getKey()), fileEntry.getValue());
+                  break;
 
-                case definitionsFile:
-                    handleDefintionTemplate(fileEntry.getKey(), csarFiles, gsst);
-                    break;
+              case definitionsFile:
+                  handleDefintionTemplate(fileEntry.getKey(), csarFiles, gsst);
+                  break;
 
-                default:
-                    break;
-            }
-        }
-        handleMetadataFile(csarFiles);
-        updateToscaServiceModel(toscaServiceModel, serviceTemplates, artifacts, gsst, csarFiles);
-        return toscaServiceModel;
-    }
-
-    private void handleMetadataFile(Map<String, byte[]> csarFiles) {
-        byte[] bytes = csarFiles.remove(TOSCA_META_PATH_FILE_NAME);
-        if (bytes != null) {
-            csarFiles.put(TOSCA_META_ORIG_PATH_FILE_NAME, bytes);
-        }
-    }
-
-    private void handleDefintionTemplate(String key, Map<String, byte[]> csarFiles,
-                                         GlobalSubstitutionServiceTemplate gsst) {
-        try {
-            ServiceTemplateReaderService readerService = new ServiceTemplateReaderServiceImpl(csarFiles.get(key));
-            Object nodeTypes = readerService.getNodeTypes();
-            if (nodeTypes instanceof Map) {
-                Map<String, NodeType> nodeTypeMap = (Map<String, NodeType>) nodeTypes;
-                gsst.appendNodes(nodeTypeMap);
-            }
-        } catch (YAMLException ye) {
-            throw new CoreException(new ErrorCode.ErrorCodeBuilder()
-                .withMessage("Invalid YAML content in file " + key)
-                .withCategory(ErrorCategory.APPLICATION).build(), ye);
-        }
-    }
-
-    private String getConcreteArtifactFileName(String fileName){
-        int artifactIndex = fileName.indexOf(CsarFileTypes.Artifacts.name());
-        if(artifactIndex < 0){
-            return fileName;
-        }
-
-        int artifactDirectoryIndex =
-            artifactIndex + CsarFileTypes.Artifacts.name().length() + 1;
-        return fileName.substring(artifactDirectoryIndex);
-    }
-
-    private void updateToscaServiceModel(ToscaServiceModel toscaServiceModel,
-                                         Map<String, ServiceTemplate> serviceTemplates,
-                                         FileContentHandler externalFilesHandler,
-                                         GlobalSubstitutionServiceTemplate globalSubstitutionServiceTemplate,
-                                         Map<String, byte[]> csarFiles) {
-        Collection<ServiceTemplate> globalServiceTemplates =
-            GlobalTypesGenerator.getGlobalTypesServiceTemplate(OnboardingTypesEnum.CSAR).values();
-        addGlobalServiceTemplates(globalServiceTemplates, serviceTemplates);
-        toscaServiceModel.setEntryDefinitionServiceTemplate(mainStName);
-        toscaServiceModel.setServiceTemplates(serviceTemplates);
-        externalFilesHandler.addFile(TOSCA_META_ORIG_PATH_FILE_NAME,
-            csarFiles.get(TOSCA_META_ORIG_PATH_FILE_NAME));
-        toscaServiceModel.setArtifactFiles(externalFilesHandler);
-
-        if(MapUtils.isNotEmpty(globalSubstitutionServiceTemplate.getNode_types())) {
-            serviceTemplates
-                .put(GLOBAL_SUBSTITUTION_SERVICE_FILE_NAME, globalSubstitutionServiceTemplate);
-        }
-    }
-
-    private void addGlobalServiceTemplates(Collection<ServiceTemplate> globalServiceTemplates,
-                                           Map<String, ServiceTemplate> serviceTemplates) {
-        for (ServiceTemplate serviceTemplate : globalServiceTemplates) {
-            serviceTemplates.put(ToscaUtil.getServiceTemplateFileName(serviceTemplate), serviceTemplate);
-        }
-    }
-
-    private void handleServiceTemplate(String serviceTemplateName,
-                                       String fileName, Map<String, byte[]> csarFiles,
-                                       Map<String, ServiceTemplate> serviceTemplates) {
-        Optional<ServiceTemplate> serviceTemplate =
-            getServiceTemplateFromCsar(fileName, csarFiles);
-        serviceTemplate.ifPresent(
-            serviceTemplateValue -> addServiceTemplate(serviceTemplateName, serviceTemplateValue,
-                serviceTemplates));
-    }
-
-    private void addServiceTemplate(String serviceTemplateName,
-                                    ServiceTemplate serviceTemplate,
-                                    Map<String, ServiceTemplate> serviceTemplates) {
-        serviceTemplates.put(serviceTemplateName, serviceTemplate);
-    }
-
-    private Optional<ServiceTemplate> getServiceTemplateFromCsar(String fileName,
-                                                                 Map<String, byte[]> csarFiles) {
-        byte[] fileContent = csarFiles.get(fileName);
-        ServiceTemplate serviceTemplate = convertServiceTemplate(fileName, fileContent);
-
-        return Optional.of(serviceTemplate);
-    }
-
-    private ServiceTemplate convertServiceTemplate(String serviceTemplateName,
-                                                   byte[] fileContent) {
-        ServiceTemplate serviceTemplate = new ServiceTemplate();
-        try {
-            ServiceTemplateReaderService readerService =
-                new ServiceTemplateReaderServiceImpl(fileContent);
-            convertMetadata(serviceTemplateName, serviceTemplate, readerService);
-            convertToscaVersion(serviceTemplate, readerService);
-            convertImports(serviceTemplate);
-            convertNodeTypes(serviceTemplate, readerService);
-            convertTopologyTemplate(serviceTemplate, readerService);
-
-        } catch (YAMLException ye) {
-            throw new CoreException(new ErrorCode.ErrorCodeBuilder()
-                .withMessage("Invalid YAML content in file" + serviceTemplateName)
-                .withCategory(ErrorCategory.APPLICATION).build(), ye);
-        }
-
-
-        return serviceTemplate;
-    }
-
-    private void convertToscaVersion(ServiceTemplate serviceTemplate,
-                                     ServiceTemplateReaderService readerService) {
-        Object toscaVersion = readerService.getToscaVersion();
-        serviceTemplate.setTosca_definitions_version((String) toscaVersion);
-    }
-
-    private void convertImports(ServiceTemplate serviceTemplate) {
-        serviceTemplate.setImports(new ArrayList<>());
-        serviceTemplate.getImports()
-            .add(createImportMap(openecompHeatIndex, HEAT_INDEX_IMPORT_FILE));
-        serviceTemplate.getImports().add(createImportMap(ONAP_INDEX, ONAP_INDEX_IMPORT_FILE));
-        serviceTemplate.getImports().add(createImportMap(globalSubstitution, globalStName));
-
-    }
-
-    private Map<String, Import> createImportMap(String key, String fileName) {
-        Map<String, Import> importMap = new HashMap<>();
-        Import anImport = new Import();
-        anImport.setFile(fileName);
-        importMap.put(key, anImport);
-
-        return importMap;
-    }
-
-    private void convertMetadata(String serviceTemplateName,
-                                 ServiceTemplate serviceTemplate,
-                                 ServiceTemplateReaderService readerService) {
-        Map<String, Object> metadataToConvert = (Map<String, Object>) readerService.getMetadata();
-        Map<String, String> finalMetadata = new HashMap<>();
-
-        if (MapUtils.isNotEmpty(metadataToConvert)) {
-            for (Map.Entry<String, Object> metadataEntry : metadataToConvert.entrySet()) {
-                if (Objects.isNull(metadataEntry.getValue()) ||
-                    !(metadataEntry.getValue() instanceof String)) {
-                    continue;
-                }
-                finalMetadata.put(metadataEntry.getKey(), (String) metadataEntry.getValue());
-            }
-        }
-
-        finalMetadata.put("template_name", getTemplateNameFromStName(serviceTemplateName));
-        serviceTemplate.setMetadata(finalMetadata);
-    }
-
-    private void convertNodeTypes(ServiceTemplate serviceTemplate, ServiceTemplateReaderService readerService) {
-        Map<String, Object> nodeTypes = readerService.getNodeTypes();
-        if (MapUtils.isEmpty(nodeTypes)) {
-            return;
-        }
-
-    for (Map.Entry<String, Object> nodeTypeEntry : nodeTypes.entrySet()) {
-      Optional<NodeType> nodeType = ToscaConverterUtil
-          .createObjectFromClass(nodeTypeEntry.getKey(), nodeTypeEntry.getValue(),
-              NodeType.class);
-
-      nodeType.ifPresent(nodeTypeValue -> DataModelUtil
-          .addNodeType(serviceTemplate, nodeTypeEntry.getKey(), nodeTypeValue));
-    }
-  }
-
-  private void convertTopologyTemplate(ServiceTemplate serviceTemplate,
-                                       ServiceTemplateReaderService readerService) {
-
-    convertInputs(serviceTemplate, readerService);
-    convertNodeTemplates(serviceTemplate, readerService);
-    convertOutputs(serviceTemplate, readerService);
-    convertSubstitutionMappings(serviceTemplate, readerService);
-  }
-
-  private void convertInputs(ServiceTemplate serviceTemplate,
-                             ServiceTemplateReaderService readerService) {
-    Map<String, Object> inputs = readerService.getInputs();
-    addInputsOrOutputsToServiceTemplate(serviceTemplate, inputs, Constants.inputs);
-  }
-
-  private void convertOutputs(ServiceTemplate serviceTemplate,
-                              ServiceTemplateReaderService readerService) {
-    Map<String, Object> outputs = readerService.getOutputs();
-    addInputsOrOutputsToServiceTemplate(serviceTemplate, outputs, Constants.outputs);
-  }
-
-  private void addInputsOrOutputsToServiceTemplate(ServiceTemplate serviceTemplate,
-                                                   Map<String, Object> mapToConvert,
-                                                   String inputsOrOutputs) {
-    if (MapUtils.isEmpty(mapToConvert)) {
-      return;
-    }
-
-    for (Map.Entry<String, Object> entry : mapToConvert.entrySet()) {
-      Optional<ParameterDefinition> parameterDefinition =
-          ToscaConverterUtil.createObjectFromClass(
-              entry.getKey(), entry.getValue(), ParameterDefinition.class);
-
-      parameterDefinition.ifPresent(parameterDefinitionValue -> {
-        Optional<Object> defaultValue =
-            ToscaConverterUtil.getDefaultValue(entry.getValue(), parameterDefinition.get());
-        defaultValue.ifPresent(parameterDefinitionValue::set_default);
-        addToServiceTemplateAccordingToSection(
-            serviceTemplate, inputsOrOutputs, entry.getKey(), parameterDefinition.get());
-      });
-    }
-  }
-
-    private void addToServiceTemplateAccordingToSection(ServiceTemplate serviceTemplate,
-                                                        String inputsOrOutputs,
-                                                        String parameterId,
-                                                        ParameterDefinition parameterDefinition) {
-        if (inputsOrOutputs.equals(inputs)) {
-            DataModelUtil
-                .addInputParameterToTopologyTemplate(serviceTemplate, parameterId, parameterDefinition);
-        } else if (inputsOrOutputs.equals(outputs)) {
-            DataModelUtil
-                .addOutputParameterToTopologyTemplate(serviceTemplate, parameterId, parameterDefinition);
-        }
-    }
-
-  private void convertNodeTemplates(ServiceTemplate serviceTemplate,
-                                    ServiceTemplateReaderService readerService) {
-    Map<String, Object> nodeTemplates = readerService.getNodeTemplates();
-    if (MapUtils.isEmpty(nodeTemplates)) {
-      return;
-    }
-
-    for (Map.Entry<String, Object> nodeTemplateEntry : nodeTemplates.entrySet()) {
-      NodeTemplate nodeTemplate = convertNodeTemplate(nodeTemplateEntry.getValue());
-      DataModelUtil.addNodeTemplate(serviceTemplate, nodeTemplateEntry.getKey(), nodeTemplate);
-    }
-  }
-
-  private void convertSubstitutionMappings(ServiceTemplate serviceTemplate,
-                                           ServiceTemplateReaderService readerService) {
-    Map<String, Object> substitutionMappings = readerService.getSubstitutionMappings();
-    if (MapUtils.isEmpty(substitutionMappings)) {
-      return;
-    }
-    SubstitutionMapping substitutionMapping = convertSubstitutionMappings(substitutionMappings);
-    DataModelUtil.addSubstitutionMapping(serviceTemplate, substitutionMapping);
-  }
-
-  private SubstitutionMapping convertSubstitutionMappings(
-      Map<String, Object> substitutionMappings) {
-    SubstitutionMapping substitutionMapping = new SubstitutionMapping();
-
-    substitutionMapping.setNode_type((String) substitutionMappings.get(nodeType));
-    substitutionMapping.setCapabilities(
-        convertSubstitutionMappingsSections(capabilities, substitutionMappings.get(capabilities)));
-    substitutionMapping.setRequirements(
-        convertSubstitutionMappingsSections(requirements, substitutionMappings.get(requirements)));
-
-    return substitutionMapping;
-  }
-
-  private Map<String, List<String>> convertSubstitutionMappingsSections(String sectionName,
-                                                                        Object sectionToConvert) {
-
-    if (Objects.isNull(sectionToConvert)) {
-      return null;
-    }
-
-    if (!(sectionToConvert instanceof Map)) {
-      throw new CoreException(
-          new SubstitutionMappingsConverterErrorBuilder(
-              sectionName, sectionToConvert.getClass().getSimpleName()).build());
-    }
-
-    return convertSection(sectionToConvert);
-  }
-
-  private Map<String, List<String>> convertSection(Object sectionToConvert) {
-
-    Map<String, Object> sectionAsMap = (Map<String, Object>) sectionToConvert;
-    Map<String, List<String>> convertedSection = new HashMap<>();
-
-    if (MapUtils.isEmpty(sectionAsMap)) {
-      return null;
-    }
-
-    for (Map.Entry<String, Object> entry : sectionAsMap.entrySet()) {
-      if (entry.getValue() instanceof List) {
-        convertedSection.put(entry.getKey(), (List<String>) entry.getValue());
+              default:
+                  break;
+          }
       }
+      handleMetadataFile(csarFiles);
+      updateToscaServiceModel(toscaServiceModel, serviceTemplates, artifacts, gsst, csarFiles, mainStName);
+      return toscaServiceModel;
     }
 
-    return convertedSection;
-  }
-
-  private CsarFileTypes getFileType(String fileName) {
-    if (isMainServiceTemplate(fileName)) {
-      return CsarFileTypes.mainServiceTemplate;
-    } else if (isGlobalServiceTemplate(fileName)) {
-      return CsarFileTypes.globalServiceTemplate;
-    } else if (isDefinitions(fileName)) {
-      return CsarFileTypes.definitionsFile;
-    } else if (isMetadataFile(fileName)) {
-      return CsarFileTypes.toscaMetadata;
-    }
-    return CsarFileTypes.externalFile;
-  }
-
-    private NodeTemplate convertNodeTemplate(Object candidateNodeTemplate) {
-        NodeTemplate nodeTemplate = new NodeTemplate();
-
-        Map<String, Object> nodeTemplateAsMap = (Map<String, Object>) candidateNodeTemplate;
-        nodeTemplate.setArtifacts((Map<String, ArtifactDefinition>) nodeTemplateAsMap.get("artifacts"));
-        nodeTemplate.setAttributes((Map<String, Object>) nodeTemplateAsMap.get("attributes"));
-        nodeTemplate.setCopy((String) nodeTemplateAsMap.get("copy"));
-        nodeTemplate.setDescription((String) nodeTemplateAsMap.get("description"));
-        nodeTemplate.setDirectives((List<String>) nodeTemplateAsMap.get("directives"));
-        nodeTemplate.setInterfaces(
-            (Map<String, Object>) nodeTemplateAsMap.get("interfaces"));
-        nodeTemplate.setNode_filter((NodeFilter) nodeTemplateAsMap.get("node_filter"));
-        nodeTemplate.setProperties((Map<String, Object>) nodeTemplateAsMap.get("properties"));
-        nodeTemplate.setRequirements(
-            (List<Map<String, RequirementAssignment>>) nodeTemplateAsMap.get("requirements"));
-        nodeTemplate.setType((String) nodeTemplateAsMap.get("type"));
-        nodeTemplate.setCapabilities(
-            convertCapabilities((Map<String, Object>) nodeTemplateAsMap.get("capabilities")));
-
-    return nodeTemplate;
-  }
-
-  private Map<String, CapabilityAssignment> convertCapabilities(Map<String, Object> capabilities) {
-    if (MapUtils.isEmpty(capabilities)) {
-      return null;
-    }
-
-    Map<String, CapabilityAssignment> convertedCapabilities = new HashMap<>();
-    for (Map.Entry<String, Object> capabilityAssignmentEntry : capabilities.entrySet()) {
-      Optional<CapabilityAssignment> capabilityAssignment = ToscaConverterUtil.createObjectFromClass
-          (capabilityAssignmentEntry.getKey(), capabilityAssignmentEntry.getValue(),
-              CapabilityAssignment.class);
-
-      capabilityAssignment.ifPresent(capabilityAssignmentValue ->
-          convertedCapabilities.put(capabilityAssignmentEntry.getKey(), capabilityAssignmentValue));
-
-    }
-    return convertedCapabilities;
-  }
-
-
-  private boolean isMainServiceTemplate(String fileName) {
-    return fileName.endsWith(mainStName);
-  }
-
-  private boolean isMetadataFile(String fileName) {
-    return fileName.equals(TOSCA_META_PATH_FILE_NAME);
-  }
-
-  private boolean isGlobalServiceTemplate(String fileName) {
-    return fileName.endsWith(globalStName);
-  }
-
-  private boolean isDefinitions(String fileName) {
-    return fileName.startsWith(definitionsDir);
-  }
-
-  private String getTemplateNameFromStName(String serviceTemplateName) {
-    String fileNameWithoutDirectories;
-    fileNameWithoutDirectories = getFileNameWithoutDirectories(serviceTemplateName);
-    return fileNameWithoutDirectories.split("ServiceTemplate")[0];
-  }
-
-  private String getFileNameWithoutDirectories(String serviceTemplateName) {
-    String fileNameWithoutDirectories;
-    if (serviceTemplateName.contains("/")) {
-      String[] split = serviceTemplateName.split("/");
-      fileNameWithoutDirectories = split[split.length - 1];
-    } else if (serviceTemplateName.contains(File.separator)) {
-      String[] split = serviceTemplateName.split(Pattern.quote(File.separator));
-      fileNameWithoutDirectories = split[split.length - 1];
-    } else {
-      fileNameWithoutDirectories = serviceTemplateName;
-    }
-    return fileNameWithoutDirectories;
-  }
 }
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaSolConverterImpl.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaSolConverterImpl.java
new file mode 100644
index 0000000..78a23f4
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaSolConverterImpl.java
@@ -0,0 +1,131 @@
+/*
+ * -
+ *  * ============LICENSE_START=======================================================
+ *  *  Copyright (C) 2019  Nordix Foundation.
+ *  * ================================================================================
+ *  * 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.
+ *  *
+ *  * SPDX-License-Identifier: Apache-2.0
+ *  * ============LICENSE_END=========================================================
+ *
+ */
+
+package org.openecomp.core.impl;
+
+import org.onap.sdc.tosca.datatypes.model.ServiceTemplate;
+import org.openecomp.core.converter.ServiceTemplateReaderService;
+import org.openecomp.core.impl.services.ServiceTemplateReaderServiceImpl;
+import org.openecomp.core.utilities.file.FileContentHandler;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
+import org.openecomp.sdc.tosca.csar.OnboardingToscaMetadata;
+import org.openecomp.sdc.tosca.csar.ToscaMetadata;
+import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import static org.openecomp.core.converter.datatypes.Constants.globalStName;
+import static org.openecomp.sdc.tosca.csar.CSARConstants.NON_FILE_IMPORT_ATTRIBUTES;
+import static org.openecomp.sdc.tosca.csar.CSARConstants.TOSCA_META_ENTRY_DEFINITIONS;
+import static org.openecomp.sdc.tosca.csar.CSARConstants.TOSCA_META_PATH_FILE_NAME;
+
+public class ToscaSolConverterImpl extends AbstractToscaConverter {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(ToscaSolConverterImpl.class);
+    private final Set<String> handledDefinitionFilesList = new HashSet<>();
+
+    @Override
+    public ToscaServiceModel convert(FileContentHandler fileContentHandler) throws IOException {
+        Map<String, byte[]> csarFiles = new HashMap<>(fileContentHandler.getFiles());
+        ToscaServiceModel toscaServiceModel = new ToscaServiceModel();
+        Map<String, ServiceTemplate> serviceTemplates = new HashMap<>();
+        FileContentHandler artifacts = new FileContentHandler();
+        GlobalSubstitutionServiceTemplate gsst = new GlobalSubstitutionServiceTemplate();
+        String mServiceDefinitionFileName = getMainServiceDefinitionFileName(fileContentHandler);
+        handleMainServiceTemplate(csarFiles, serviceTemplates, gsst, mServiceDefinitionFileName);
+        handleExternalArtifacts(csarFiles, serviceTemplates, artifacts);
+        handleMetadataFile(csarFiles);
+        updateToscaServiceModel(toscaServiceModel, serviceTemplates, artifacts, gsst, csarFiles, mServiceDefinitionFileName);
+        return toscaServiceModel;
+    }
+
+    private void handleMainServiceTemplate(Map<String, byte[]> csarFiles, Map<String, ServiceTemplate> serviceTemplates,
+                                           GlobalSubstitutionServiceTemplate gsst, String mServiceDefinitionFileName) {
+        handleServiceTemplate(mServiceDefinitionFileName, mServiceDefinitionFileName, csarFiles, serviceTemplates);
+        handleImportDefinitions(mServiceDefinitionFileName, csarFiles, mServiceDefinitionFileName.substring(0,
+                mServiceDefinitionFileName.lastIndexOf("/")), gsst);
+    }
+
+    private void handleExternalArtifacts(Map<String, byte[]> csarFiles, Map<String, ServiceTemplate> serviceTemplates, FileContentHandler artifacts) {
+        for(Map.Entry<String, byte[]> fileEntry: csarFiles.entrySet()){
+            if(!handledDefinitionFilesList.contains(fileEntry.getKey()) && !isMetadataFile(fileEntry.getKey())){
+                if(isGlobalServiceTemplate(fileEntry.getKey())){
+                    handleServiceTemplate(globalStName, fileEntry.getKey(), csarFiles, serviceTemplates);
+                }else{
+                    artifacts.addFile(
+                            getConcreteArtifactFileName(fileEntry.getKey()), fileEntry.getValue());
+                }
+            }
+        }
+    }
+
+    private void handleImportDefinitions(String fileName, Map<String,byte[]> csarFiles, String parentDir, GlobalSubstitutionServiceTemplate gsst) {
+        handledDefinitionFilesList.add(fileName);
+        ServiceTemplateReaderService readerService = new ServiceTemplateReaderServiceImpl(csarFiles.get(fileName));
+        List<Object> imports = (readerService).getImports();
+        for (Object o : imports) {
+            String importPath = getImportedFilePath(o, parentDir);
+            if (importPath != null && !handledDefinitionFilesList.contains(importPath)) {
+                handleDefintionTemplate(importPath, csarFiles, gsst);
+                if (importPath.contains("/")) {
+                    parentDir = importPath.substring(0, importPath.lastIndexOf("/"));
+                }
+                handleImportDefinitions(importPath, csarFiles, parentDir, gsst);
+            }
+        }
+        return;
+    }
+
+    private String getImportedFilePath(Object o, String parentDir){
+        if(o instanceof String){
+            String fileName = (String) o;
+            if(!fileName.contains("/")){
+                fileName = parentDir + "/" + fileName;
+            }
+            return fileName;
+        }else if(o instanceof Map){
+            Map<String, Object> o1 = (Map) o;
+            for(Map.Entry<String, Object> entry: o1.entrySet()){
+                if(NON_FILE_IMPORT_ATTRIBUTES.stream().noneMatch(attr -> entry.getKey().equals(attr))){
+                    getImportedFilePath(entry.getValue(), parentDir);
+                }
+            }
+        }
+        return null;
+    }
+
+    private String getMainServiceDefinitionFileName(FileContentHandler contentHandler) throws IOException {
+        try {
+            ToscaMetadata toscaMetadata = OnboardingToscaMetadata.parseToscaMetadataFile(
+                    contentHandler.getFileContent(TOSCA_META_PATH_FILE_NAME));
+            return toscaMetadata.getMetaEntries().get(TOSCA_META_ENTRY_DEFINITIONS);
+        }catch (IOException e){
+            LOGGER.error(e.getMessage(), e);
+            throw new IOException(e.getMessage());
+        }
+    }
+}
\ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/impl/ToscaSolConverterImplTest.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/impl/ToscaSolConverterImplTest.java
new file mode 100644
index 0000000..ad2e615
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/impl/ToscaSolConverterImplTest.java
@@ -0,0 +1,105 @@
+/*
+ * -
+ *  * ============LICENSE_START=======================================================
+ *  *  Copyright (C) 2019  Nordix Foundation.
+ *  * ================================================================================
+ *  * 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.
+ *  *
+ *  * SPDX-License-Identifier: Apache-2.0
+ *  * ============LICENSE_END=========================================================
+ *
+ */
+
+package org.openecomp.core.impl;
+
+import org.apache.commons.io.IOUtils;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.sdc.tosca.datatypes.model.ServiceTemplate;
+import org.openecomp.core.utilities.file.FileContentHandler;
+import org.openecomp.sdc.common.errors.CoreException;
+import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
+import java.util.Map;
+
+
+public class ToscaSolConverterImplTest {
+
+    private ToscaSolConverterImpl toscaSolConverter;
+    private FileContentHandler fileContentHandler;
+
+    @Before
+    public void setUp(){
+        toscaSolConverter = new ToscaSolConverterImpl();
+        fileContentHandler = new FileContentHandler();
+    }
+
+
+    @Test
+    public void testGivenSOL004WithMetadataDirectoryPackage_whenToscaSolConverterIsCalled_validToscaServiceModelIsReturned()
+            throws IOException{
+        fileContentHandler.addFile("TOSCA-Metadata/TOSCA.meta",
+                ("TOSCA-Meta-File-Version: 1.0\n " +
+                "CSAR-Version: 1.1\n" +
+                "Created-by: Ericsson\n" +
+                "Entry-Definitions: Definitions/Main.yaml\n" +
+                "Entry-Manifest: Main.mf\n" +
+                "Entry-Change-Log: Artifacts/ChangeLog.txt")
+                        .getBytes(StandardCharsets.UTF_8));
+
+        fileContentHandler.addFile("Definitions/Main.yaml", getFileResource("/toscaSOlConverter/Main.yaml"));
+        fileContentHandler.addFile("Main.mf", "".getBytes());
+        fileContentHandler.addFile("Definitions/sample_import1.yaml", getFileResource("/toscaSOlConverter/sample_import1.yaml"));
+        fileContentHandler.addFile("Definitions/sample_import2.yaml", getFileResource("/toscaSOlConverter/sample_import2.yaml"));
+        fileContentHandler.addFile("Artifacts/sample_import3.yaml", getFileResource("/toscaSOlConverter/sample_import3.yaml"));
+        fileContentHandler.addFile("Artifacts/sample_import4.yaml", getFileResource("/toscaSOlConverter/sample_import4.yaml"));
+        ToscaServiceModel toscaServiceModel = toscaSolConverter.convert(fileContentHandler);
+        FileContentHandler contentHandler = toscaServiceModel.getArtifactFiles();
+        Map<String, ServiceTemplate> serviceTemplateMap = toscaServiceModel.getServiceTemplates();
+        String entryDefinitionTemplateName = toscaServiceModel.getEntryDefinitionServiceTemplate();
+        Assert.assertTrue("Artifacts should contain external files", contentHandler.containsFile("Main.mf"));
+        Assert.assertTrue("Main service template should exist", serviceTemplateMap.containsKey("Definitions/Main.yaml"));
+        Assert.assertEquals("Entry Definition name should be same as passed in TOSCA.meta",
+                "Definitions/Main.yaml", entryDefinitionTemplateName);
+    }
+
+    @Test(expected = IOException.class)
+    public void testGivenMetaFileDoesNotExist_thenAnExceptionIsThrown() throws IOException{
+        toscaSolConverter.convert(fileContentHandler);
+    }
+
+    @Test(expected = CoreException.class)
+    public void testGivenInvalidServiceTemplate_thenAnExceptionIsThrown() throws IOException{
+
+        fileContentHandler.addFile("TOSCA-Metadata/TOSCA.meta",
+                ("TOSCA-Meta-File-Version: 1.0\n " +
+                        "CSAR-Version: 1.1\n" +
+                        "Created-by: Ericsson\n" +
+                        "Entry-Definitions: Definitions/Main.yaml\n" +
+                        "Entry-Manifest: Main.mf\n" +
+                        "Entry-Change-Log: Artifacts/ChangeLog.txt")
+                        .getBytes(StandardCharsets.UTF_8));
+
+        fileContentHandler.addFile("Definitions/Main.yaml", getFileResource("/toscaSOlConverter/invalidMainService.yaml"));
+        toscaSolConverter.convert(fileContentHandler);
+    }
+
+    private byte[] getFileResource(String filePath) throws IOException {
+        InputStream inputStream = ClassLoader.class.getClass().getResourceAsStream(filePath);
+        return IOUtils.toByteArray(inputStream);
+    }
+
+}
\ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/toscaSOlConverter/Main.yaml b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/toscaSOlConverter/Main.yaml
new file mode 100644
index 0000000..57b7724
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/toscaSOlConverter/Main.yaml
@@ -0,0 +1,9 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+metadata:
+  template_name: vCPE_vgw
+  template_version: "1.0"
+  template_author: onap
+description: vCPE_vgw
+
+imports:
+  - sample_import1.yaml
\ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/toscaSOlConverter/invalidMainService.yaml b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/toscaSOlConverter/invalidMainService.yaml
new file mode 100644
index 0000000..569d204
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/toscaSOlConverter/invalidMainService.yaml
@@ -0,0 +1,7 @@
+: tosca_simple_yaml_1_0
+
+  template_name: vCPE_vgw
+  template_version: "1.0"
+  template_author: onap
+
+description: vCPE_vgw
\ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/toscaSOlConverter/sample_import1.yaml b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/toscaSOlConverter/sample_import1.yaml
new file mode 100644
index 0000000..47d9b00
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/toscaSOlConverter/sample_import1.yaml
@@ -0,0 +1,5 @@
+tosca_definitions_version: tosca_simple_yaml_1_2
+description: ETSI NFV SOL 001 pnfd types definitions version 2.5.1
+
+imports:
+  - sample_import2.yaml
\ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/toscaSOlConverter/sample_import2.yaml b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/toscaSOlConverter/sample_import2.yaml
new file mode 100644
index 0000000..42816ee
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/toscaSOlConverter/sample_import2.yaml
@@ -0,0 +1,6 @@
+tosca_definitions_version: tosca_simple_yaml_1_2
+description: ETSI NFV SOL 001 pnfd types definitions version 2.5.1
+
+imports:
+  - sample_import2.yaml
+  - Artifacts/sample_import3.yaml
\ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/toscaSOlConverter/sample_import3.yaml b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/toscaSOlConverter/sample_import3.yaml
new file mode 100644
index 0000000..99eb46b
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/toscaSOlConverter/sample_import3.yaml
@@ -0,0 +1,5 @@
+tosca_definitions_version: tosca_simple_yaml_1_2
+description: ETSI NFV SOL 001 pnfd types definitions version 2.5.1
+
+imports:
+  - sample_import4.yaml
\ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/toscaSOlConverter/sample_import4.yaml b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/toscaSOlConverter/sample_import4.yaml
new file mode 100644
index 0000000..ccaa1ca
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/toscaSOlConverter/sample_import4.yaml
@@ -0,0 +1,6 @@
+tosca_definitions_version: tosca_simple_yaml_1_2
+description: ETSI NFV SOL 001 pnfd types definitions version 2.5.1
+
+imports:
+  - sample_import3.yaml
+