fix capabilities
[sdc.git] / catalog-be / src / main / java / org / openecomp / sdc / be / components / impl / ResourceBusinessLogic.java
index d3492f8..b664efe 100644 (file)
@@ -23,7 +23,6 @@ package org.openecomp.sdc.be.components.impl;
 import static org.openecomp.sdc.be.tosca.CsarUtils.ARTIFACTS_PATH;
 import static org.openecomp.sdc.be.tosca.CsarUtils.VF_NODE_TYPE_ARTIFACTS_PATH_PATTERN;
 
-import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -44,7 +43,9 @@ import java.util.stream.Collectors;
 import javax.servlet.ServletContext;
 
 import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.collections.MapUtils;
+import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang3.tuple.ImmutablePair;
 import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic.ArtifactOperationEnum;
 import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic.ArtifactOperationInfo;
@@ -78,8 +79,10 @@ import org.openecomp.sdc.be.model.CapabilityDefinition;
 import org.openecomp.sdc.be.model.CapabilityTypeDefinition;
 import org.openecomp.sdc.be.model.Component;
 import org.openecomp.sdc.be.model.ComponentInstance;
+import org.openecomp.sdc.be.model.ComponentInstanceInput;
 import org.openecomp.sdc.be.model.ComponentInstanceProperty;
 import org.openecomp.sdc.be.model.ComponentParametersView;
+import org.openecomp.sdc.be.model.CsarInfo;
 import org.openecomp.sdc.be.model.DataTypeDefinition;
 import org.openecomp.sdc.be.model.GroupDefinition;
 import org.openecomp.sdc.be.model.GroupProperty;
@@ -89,6 +92,7 @@ import org.openecomp.sdc.be.model.InputDefinition;
 import org.openecomp.sdc.be.model.InterfaceDefinition;
 import org.openecomp.sdc.be.model.LifeCycleTransitionEnum;
 import org.openecomp.sdc.be.model.LifecycleStateEnum;
+import org.openecomp.sdc.be.model.NodeTypeInfo;
 import org.openecomp.sdc.be.model.Operation;
 import org.openecomp.sdc.be.model.ParsedToscaYamlInfo;
 import org.openecomp.sdc.be.model.PropertyDefinition;
@@ -107,16 +111,15 @@ import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache;
 import org.openecomp.sdc.be.model.category.CategoryDefinition;
 import org.openecomp.sdc.be.model.category.SubCategoryDefinition;
 import org.openecomp.sdc.be.model.heat.HeatParameterType;
+import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter;
 import org.openecomp.sdc.be.model.operations.api.ICacheMangerOperation;
 import org.openecomp.sdc.be.model.operations.api.ICapabilityTypeOperation;
 import org.openecomp.sdc.be.model.operations.api.IElementOperation;
-import org.openecomp.sdc.be.model.operations.api.IHeatParametersOperation;
 import org.openecomp.sdc.be.model.operations.api.IInterfaceLifecycleOperation;
 import org.openecomp.sdc.be.model.operations.api.IPropertyOperation;
 import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
 import org.openecomp.sdc.be.model.operations.impl.CsarOperation;
 import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter;
-import org.openecomp.sdc.be.model.operations.impl.InputsOperation;
 import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder;
 import org.openecomp.sdc.be.model.operations.utils.ComponentValidationUtils;
 import org.openecomp.sdc.be.model.tosca.ToscaPropertyType;
@@ -124,6 +127,7 @@ import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum;
 import org.openecomp.sdc.be.servlets.RepresentationUtils;
 import org.openecomp.sdc.be.tosca.CsarUtils;
 import org.openecomp.sdc.be.tosca.CsarUtils.NonMetaArtifactInfo;
+import org.openecomp.sdc.be.tosca.ToscaUtils;
 import org.openecomp.sdc.be.ui.model.UiComponentDataTransfer;
 import org.openecomp.sdc.be.user.IUserBusinessLogic;
 import org.openecomp.sdc.be.user.Role;
@@ -132,7 +136,6 @@ import org.openecomp.sdc.be.utils.CommonBeUtils;
 import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum;
 import org.openecomp.sdc.common.api.ArtifactTypeEnum;
 import org.openecomp.sdc.common.api.Constants;
-import org.openecomp.sdc.common.config.EcompErrorName;
 import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum;
 import org.openecomp.sdc.common.datastructure.FunctionalInterfaces;
 import org.openecomp.sdc.common.datastructure.Wrapper;
@@ -146,6 +149,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.context.WebApplicationContext;
 import org.yaml.snakeyaml.DumperOptions;
 import org.yaml.snakeyaml.Yaml;
+import org.yaml.snakeyaml.parser.ParserException;
 
 import com.google.gson.Gson;
 import com.google.gson.JsonElement;
@@ -202,18 +206,6 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
        @Autowired
        private InputsBusinessLogic inputsBusinessLogic;
 
-       @javax.annotation.Resource
-       private InputsOperation inputOperation;
-
-       // @Autowired
-       // private GroupOperation groupOperation;
-
-       @Autowired
-       private IHeatParametersOperation heatParametersOperation;
-
-       // @Autowired
-       // private IArtifactOperation artifactOperation;
-
        @Autowired
        private CompositionBusinessLogic compositionBusinessLogic;
 
@@ -289,8 +281,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
         * the method returns a list of all the resources that are certified, the returned resources are only abstract or only none abstract according to the given param
         *
         * @param getAbstract
-        * @param userId
-        *            TODO
+        * @param userId      TODO
         * @return
         */
        public Either<List<Resource>, ResponseFormat> getAllCertifiedResources(boolean getAbstract, HighestFilterEnum highestFilter, String userId) {
@@ -300,16 +291,16 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                }
                Boolean isHighest = null;
                switch (highestFilter) {
-                       case ALL:
-                               break;
-                       case HIGHEST_ONLY:
-                               isHighest = true;
-                               break;
-                       case NON_HIGHEST_ONLY:
-                               isHighest = false;
-                               break;
-                       default:
-                               break;
+               case ALL:
+                       break;
+               case HIGHEST_ONLY:
+                       isHighest = true;
+                       break;
+               case NON_HIGHEST_ONLY:
+                       isHighest = false;
+                       break;
+               default:
+                       break;
                }
                Either<List<Resource>, StorageOperationStatus> getResponse = toscaOperationFacade.getAllCertifiedResources(getAbstract, isHighest);
 
@@ -488,7 +479,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
        }
 
        private Either<Resource, ResponseFormat> updateResourceFromCsar(Resource oldRresource, Resource newRresource, User user, AuditingActionEnum updateResource, boolean inTransaction, Either<Map<String, byte[]>, StorageOperationStatus> csarUIPayload,
-                                                                                                                                       String csarUUID) {
+                       String csarUUID) {
 
                // check state
                if (LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT.equals(oldRresource.getLifecycleState())) {
@@ -499,7 +490,6 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                }
                String lockedResourceId = oldRresource.getUniqueId();
                List<ArtifactDefinition> createdArtifacts = new ArrayList<>();
-               List<ArtifactDefinition> nodeTypesNewCreatedArtifacts = new ArrayList<>();
 
                Either<Map<String, byte[]>, StorageOperationStatus> csar = null;
                if (csarUIPayload != null && csarUIPayload.left() != null && csarUIPayload.left().value() != null) {
@@ -535,30 +525,68 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                        return Either.right(lockResult.right().value());
                }
 
-               Either<Resource, ResponseFormat> result = null;
                String yamlFileName = toscaYamlCsarStatus.left().value().getKey();
-               Either<Map<String, Resource>, ResponseFormat> parseNodeTypeInfoYamlEither = null;
-               try {
-                       Either<ImmutablePair<Resource, ActionStatus>, ResponseFormat> prepareForUpdate = null;
-                       Resource preparedResource = null;
-                       Either<ParsedToscaYamlInfo, ResponseFormat> uploadComponentInstanceInfoMap = parseResourceInfoFromYaml(yamlFileName, newRresource, toscaYamlCsarStatus.left().value().getValue(), user);
+               String yamlFileContents = toscaYamlCsarStatus.left().value().getValue();
+               CsarInfo csarInfo = new CsarInfo(newRresource.getName(), user, csarUUID, csar.left().value(), yamlFileContents, true);
+               Map<String, NodeTypeInfo> nodeTypesInfo = extractNodeTypesInfo(csarInfo);
+               Either<Resource, ResponseFormat>  result = null;
+               
+               Either<Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>>, ResponseFormat> findNodeTypesArtifactsToHandleRes = findNodeTypesArtifactsToHandle(nodeTypesInfo, csarInfo, oldRresource);
+               if (findNodeTypesArtifactsToHandleRes.isRight()) {
+                       log.debug("failed to find node types for update with artifacts during import csar {}. ", csarInfo.getCsarUUID());
+                       result = Either.right(findNodeTypesArtifactsToHandleRes.right().value());
+                       return result;
+               }
+               Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>> nodeTypesArtifactsToHandle = findNodeTypesArtifactsToHandleRes.left().value();
+               try{
+                       result =  updateResourceFromYaml(oldRresource, newRresource, updateResource, createdArtifacts, isUpdateYaml, yamlFileName, yamlFileContents, csarInfo, nodeTypesInfo, nodeTypesArtifactsToHandle, null);
+               
+               } finally {
+                       if (result == null || result.isRight()) {
+                               log.warn("operation failed. do rollback");
+                               titanDao.rollback();
+                               if (!createdArtifacts.isEmpty()) {
+                                       StorageOperationStatus deleteFromEsRes = artifactsBusinessLogic.deleteAllComponentArtifactsIfNotOnGraph(createdArtifacts);
+                                       if (!deleteFromEsRes.equals(StorageOperationStatus.OK)) {
+                                               ActionStatus actionStatus = componentsUtils.convertFromStorageResponse(deleteFromEsRes);
+                                               result = Either.right(componentsUtils.getResponseFormat(actionStatus, oldRresource.getName()));
+                                       }
+                                       log.debug("component and all its artifacts were deleted, id = {}", oldRresource.getName());
+                               }
+                       } else {
+                               log.debug("operation success. do commit");
+                               titanDao.commit();
+                       }
+                       log.debug("unlock resource {}", lockedResourceId);
+                       graphLockOperation.unlockComponent(lockedResourceId, NodeTypeEnum.Resource);
+               }
+               return result;
+
+       }
+
+       private Either<Resource, ResponseFormat> updateResourceFromYaml(Resource oldRresource, Resource newRresource, AuditingActionEnum updateResource, List<ArtifactDefinition> createdArtifacts,
+                       boolean isUpdateYaml, String yamlFileName,      String yamlFileContent, CsarInfo csarInfo, Map<String, NodeTypeInfo> nodeTypesInfo,
+                       Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>> nodeTypesArtifactsToHandle, String nodeName) {
+               Either<Resource, ResponseFormat> result;
+               Either<Map<String, Resource>, ResponseFormat> parseNodeTypeInfoYamlEither;
+               boolean inTransaction = true;
+               boolean shouldLock = false;
+               
+                       Either<ImmutablePair<Resource, ActionStatus>, ResponseFormat> prepareForUpdate;
+                       Resource preparedResource;
+                       Either<ParsedToscaYamlInfo, ResponseFormat> uploadComponentInstanceInfoMap = parseResourceInfoFromYaml(yamlFileName, newRresource, yamlFileContent, csarInfo.getCreatedNodesToscaResourceNames(), nodeTypesInfo, nodeName);
                        if (uploadComponentInstanceInfoMap.isRight()) {
                                ResponseFormat responseFormat = uploadComponentInstanceInfoMap.right().value();
-                               componentsUtils.auditResource(responseFormat, user, newRresource, "", "", updateResource, null);
+                               componentsUtils.auditResource(responseFormat, csarInfo.getModifier(), newRresource, "", "", updateResource, null);
                                result = Either.right(responseFormat);
                                return result;
                        }
+                       
                        Map<String, UploadComponentInstanceInfo> instances = uploadComponentInstanceInfoMap.left().value().getInstances();
-                       Either<Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>>, ResponseFormat> findNodeTypesArtifactsToHandleRes = findNodeTypesArtifactsToHandle(csar.left().value(), csarUUID, yamlFileName, oldRresource, user, true, instances);
-                       if (findNodeTypesArtifactsToHandleRes.isRight()) {
-                               log.debug("failed to find node types for update with artifacts during import csar {}. ", csarUUID);
-                               result = Either.right(findNodeTypesArtifactsToHandleRes.right().value());
-                               return result;
-                       }
-                       Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>> nodeTypesArtifactsToHandle = findNodeTypesArtifactsToHandleRes.left().value();
+
                        if (isUpdateYaml || !nodeTypesArtifactsToHandle.isEmpty()) {
 
-                               prepareForUpdate = updateExistingResourceByImport(newRresource, oldRresource, user, true, false);
+                               prepareForUpdate = updateExistingResourceByImport(newRresource, oldRresource, csarInfo.getModifier(), inTransaction, shouldLock);
                                if (prepareForUpdate.isRight()) {
                                        log.debug("Failed to prepare resource for update : {}", prepareForUpdate.right().value());
                                        result = Either.right(prepareForUpdate.right().value());
@@ -566,39 +594,46 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                                }
                                preparedResource = prepareForUpdate.left().value().left;
 
-                               String yamlFileContents = toscaYamlCsarStatus.left().value().getValue();
-                               log.trace("YAML topology file found in CSAR, file name: {}, contents: {}", yamlFileName, yamlFileContents);
+                               log.trace("YAML topology file found in CSAR, file name: {}, contents: {}", yamlFileName, yamlFileContent);
+
+                               Either<Resource, ResponseFormat> genericResourceEither = handleResourceGenericType(preparedResource);
+                               if (genericResourceEither.isRight()) {
+                                       log.debug("failed to get resource generic type. status is {}", genericResourceEither.right().value());
+                                       ResponseFormat responseFormat = genericResourceEither.right().value();
+                                       componentsUtils.auditResource(genericResourceEither.right().value(), csarInfo.getModifier(), preparedResource, "", "", updateResource, null);
+                                       return Either.right(responseFormat);
+                               }
 
-                               parseNodeTypeInfoYamlEither = this.handleNodeTypes(yamlFileName, preparedResource, user, yamlFileContents, csar.left().value(), false, nodeTypesArtifactsToHandle, nodeTypesNewCreatedArtifacts);
+                               parseNodeTypeInfoYamlEither = this.handleNodeTypes(yamlFileName, preparedResource, yamlFileContent, shouldLock, nodeTypesArtifactsToHandle, createdArtifacts, nodeTypesInfo, csarInfo, nodeName);
                                if (parseNodeTypeInfoYamlEither.isRight()) {
                                        ResponseFormat responseFormat = parseNodeTypeInfoYamlEither.right().value();
-                                       componentsUtils.auditResource(responseFormat, user, preparedResource, "", "", updateResource, null);
+                                       componentsUtils.auditResource(responseFormat, csarInfo.getModifier(), preparedResource, "", "", updateResource, null);
                                        result = Either.right(responseFormat);
                                        return result;
                                }
 
                                Map<String, InputDefinition> inputs = uploadComponentInstanceInfoMap.left().value().getInputs();
-                               Either<Resource, ResponseFormat> createInputsOnResource = createInputsOnResource(preparedResource, user, inputs, true);
+                               Either<Resource, ResponseFormat> createInputsOnResource = createInputsOnResource(preparedResource, csarInfo.getModifier(), inputs, inTransaction);
                                if (createInputsOnResource.isRight()) {
                                        log.debug("failed to create resource inputs status is {}", createInputsOnResource.right().value());
                                        ResponseFormat responseFormat = createInputsOnResource.right().value();
-                                       componentsUtils.auditResource(createInputsOnResource.right().value(), user, preparedResource, "", "", updateResource, null);
+                                       componentsUtils.auditResource(createInputsOnResource.right().value(), csarInfo.getModifier(), preparedResource, "", "", updateResource, null);
                                        result = Either.right(responseFormat);
                                        return result;
                                }
                                preparedResource = createInputsOnResource.left().value();
 
-                               Either<Resource, ResponseFormat> createResourcesInstancesEither = createResourceInstances(user, yamlFileName, preparedResource, instances, true, false, parseNodeTypeInfoYamlEither.left().value());
+                               Either<Resource, ResponseFormat> createResourcesInstancesEither = createResourceInstances(csarInfo.getModifier(), yamlFileName, preparedResource, instances, inTransaction, shouldLock, csarInfo.getCreatedNodes());
                                if (createResourcesInstancesEither.isRight()) {
                                        log.debug("failed to create resource instances status is {}", createResourcesInstancesEither.right().value());
                                        ResponseFormat responseFormat = createResourcesInstancesEither.right().value();
-                                       componentsUtils.auditResource(createResourcesInstancesEither.right().value(), user, preparedResource, "", "", updateResource, null);
+                                       componentsUtils.auditResource(createResourcesInstancesEither.right().value(), csarInfo.getModifier(), preparedResource, "", "", updateResource, null);
                                        result = Either.right(responseFormat);
                                        return result;
                                }
                                preparedResource = createResourcesInstancesEither.left().value();
-
-                               createResourcesInstancesEither = createResourceInstancesRelations(user, yamlFileName, preparedResource, instances, true, false);
+                               
+                               createResourcesInstancesEither = createResourceInstancesRelations(csarInfo.getModifier(), yamlFileName, preparedResource, instances);
                                if (createResourcesInstancesEither.isRight()) {
                                        log.debug("failed to create relation between resource instances status is {}", createResourcesInstancesEither.right().value());
                                        result = Either.right(createResourcesInstancesEither.right().value());
@@ -620,7 +655,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                                } else {
                                        groups = uploadComponentInstanceInfoMap.left().value().getGroups();
                                }
-                               Either<Resource, ResponseFormat> updatedGroupsOnResource = updateGroupsOnResource(preparedResource, user, groups);
+                               Either<Resource, ResponseFormat> updatedGroupsOnResource = updateGroupsOnResource(preparedResource, csarInfo.getModifier(), groups);
                                if (updatedGroupsOnResource.isRight()) {
 
                                        return updatedGroupsOnResource;
@@ -628,7 +663,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                                preparedResource = updatedGroupsOnResource.left().value();
 
                        } else {
-                               Either<Resource, ResponseFormat> dataModelResponse = updateResourceMetadata(oldRresource.getUniqueId(), newRresource, user, oldRresource, false, true);
+                               Either<Resource, ResponseFormat> dataModelResponse = updateResourceMetadata(oldRresource.getUniqueId(), newRresource, csarInfo.getModifier(), oldRresource, shouldLock, inTransaction);
                                if (dataModelResponse.isRight()) {
                                        log.debug("failed to update resource metadata {}", dataModelResponse.right().value());
                                        result = Either.right(dataModelResponse.right().value());
@@ -637,67 +672,65 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                                preparedResource = dataModelResponse.left().value();
                        }
 
-                       Either<Resource, ResponseFormat> createdCsarArtifactsEither = handleCsarArtifacts(preparedResource, user, csarUUID, csar.left().value(), createdArtifacts,
-                                       artifactsBusinessLogic.new ArtifactOperationInfo(false, false, ArtifactOperationEnum.Update), false, true);
-                       if (createdCsarArtifactsEither.isRight()) {
-
-                               return createdCsarArtifactsEither;
+                       if(preparedResource.getResourceType() == ResourceTypeEnum.CVFC){
+                               if(nodeName != null && nodeTypesArtifactsToHandle.get(nodeName) != null && !nodeTypesArtifactsToHandle.get(nodeName).isEmpty()){
+                                       Either<List<ArtifactDefinition>, ResponseFormat> handleNodeTypeArtifactsRes = 
+                                                       handleNodeTypeArtifacts(preparedResource, nodeTypesArtifactsToHandle.get(nodeName), createdArtifacts, csarInfo.getModifier(), inTransaction, true);
+                                       if(handleNodeTypeArtifactsRes.isRight()){
+                                               return Either.right(handleNodeTypeArtifactsRes.right().value());
+                                       }
+                               }
+                       } else {
+                               Either<Resource, ResponseFormat> createdCsarArtifactsEither = handleVfCsarArtifacts(preparedResource, csarInfo, createdArtifacts,
+                                               artifactsBusinessLogic.new ArtifactOperationInfo(false, false, ArtifactOperationEnum.Update), shouldLock, inTransaction);
+                               log.trace("************* Finished to add artifacts from yaml {}", yamlFileName);
+                               if (createdCsarArtifactsEither.isRight()) {
+                                       return createdCsarArtifactsEither;
+                               }
+                               preparedResource = createdCsarArtifactsEither.left().value();
                        }
-                       preparedResource = createdCsarArtifactsEither.left().value();
 
-                       Either<List<ComponentInstance>, ResponseFormat> eitherSetPosition = compositionBusinessLogic.setPositionsForComponentInstances(preparedResource, user.getUserId());
+                       Either<List<ComponentInstance>, ResponseFormat> eitherSetPosition = compositionBusinessLogic.setPositionsForComponentInstances(preparedResource, csarInfo.getModifier().getUserId());
                        result = eitherSetPosition.isRight() ? Either.right(eitherSetPosition.right().value()) : Either.left(preparedResource);
 
                        return result;
 
-               } finally {
-                       if (result == null || result.isRight()) {
-                               log.warn("operation failed. do rollback");
-                               titanDao.rollback();
-                               if (!createdArtifacts.isEmpty() || !nodeTypesNewCreatedArtifacts.isEmpty()) {
-                                       createdArtifacts.addAll(nodeTypesNewCreatedArtifacts);
-                                       StorageOperationStatus deleteFromEsRes = artifactsBusinessLogic.deleteAllComponentArtifactsIfNotOnGraph(createdArtifacts);
-                                       if (!deleteFromEsRes.equals(StorageOperationStatus.OK)) {
-                                               ActionStatus actionStatus = componentsUtils.convertFromStorageResponse(deleteFromEsRes);
-                                               ResponseFormat responseFormat = componentsUtils.getResponseFormat(actionStatus, oldRresource.getName());
-                                       }
-                                       log.debug("component and all its artifacts were deleted, id = {}", oldRresource.getName());
-                               }
-                       } else {
-                               log.debug("operation success. do commit");
-                               titanDao.commit();
-                       }
-                       log.debug("unlock resource {}", lockedResourceId);
-                       graphLockOperation.unlockComponent(lockedResourceId, NodeTypeEnum.Resource);
+       }
+       private Either<Resource, ResponseFormat> handleResourceGenericType(Resource resource) {
+               Either<Resource, ResponseFormat> genericResourceEither = fetchAndSetDerivedFromGenericType(resource);
+               if (genericResourceEither.isRight()) {
+                       return genericResourceEither;
                }
-
+               if (resource.shouldGenerateInputs()) {
+                       generateInputsFromGenericTypeProperties(resource, genericResourceEither.left().value());
+               }
+               return genericResourceEither;
        }
 
-       private Either<Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>>, ResponseFormat> findNodeTypesArtifactsToHandle(Map<String, byte[]> csar, String csarUUID, String yamlFileName, Resource oldResource, User user,
-                                                                                                                                                                                                                                                                                boolean inTransaction, Map<String, UploadComponentInstanceInfo> uploadComponentInstanceInfoMap) {
+       private Either<Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>>, ResponseFormat> findNodeTypesArtifactsToHandle(Map<String, NodeTypeInfo> nodeTypesInfo, CsarInfo csarInfo, Resource oldResource) {
 
-               Map<String, List<ArtifactDefinition>> extractedVfcsArtifacts = CsarUtils.extractVfcsArtifactsFromCsar(csar);
+               Map<String, List<ArtifactDefinition>> extractedVfcsArtifacts = CsarUtils.extractVfcsArtifactsFromCsar(csarInfo.getCsar());
                Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>> nodeTypesArtifactsToHandle = new HashMap<>();
                Either<Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>>, ResponseFormat> nodeTypesArtifactsToHandleRes;
 
                try {
                        nodeTypesArtifactsToHandleRes = Either.left(nodeTypesArtifactsToHandle);
-                       List<ImmutablePair<ImmutablePair<String, List<String>>, String>> extractedVfcToscaNames = extractVfcToscaNames(csar, yamlFileName, oldResource.getSystemName(), uploadComponentInstanceInfoMap);
-                       validateNodeTypeIdentifiers(extractedVfcsArtifacts, extractedVfcToscaNames);
-                       Either<EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>, ResponseFormat> curNodeTypeArtifactsToHandleRes = null;
+                       Map<String, String> extractedVfcToscaNames = extractVfcToscaNames(nodeTypesInfo, oldResource.getName(), csarInfo);
+                       Either<EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>, ResponseFormat> curNodeTypeArtifactsToHandleRes;
                        EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>> curNodeTypeArtifactsToHandle = null;
-                       log.debug("Going to fetch node types for resource with name {} during import csar with UUID {}. ", oldResource.getName(), csarUUID);
+                       log.debug("Going to fetch node types for resource with name {} during import csar with UUID {}. ", oldResource.getName(), csarInfo.getCsarUUID());
 
-                       for (ImmutablePair<ImmutablePair<String, List<String>>, String> currVfcToscaNameEntry : extractedVfcToscaNames) {
+                       for (Entry<String, String> currVfcToscaNameEntry : extractedVfcToscaNames.entrySet()) {
                                String currVfcToscaName = currVfcToscaNameEntry.getValue();
+                               String currNamespace = currVfcToscaNameEntry.getKey();
                                log.debug("Going to fetch node type with tosca name {}. ", currVfcToscaName);
 
                                Either<Resource, StorageOperationStatus> curVfcRes = toscaOperationFacade.getLatestByToscaResourceName(currVfcToscaName);
                                Resource curNodeType = null;
                                if (curVfcRes.isRight() && curVfcRes.right().value() != StorageOperationStatus.NOT_FOUND) {
                                        log.debug("Error occured during fetching node type with tosca name {}, error: {}", currVfcToscaName, curVfcRes.right().value());
-                                       ResponseFormat responseFormat = componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(curVfcRes.right().value()), csarUUID);
-                                       componentsUtils.auditResource(responseFormat, user, oldResource, "", "", AuditingActionEnum.CREATE_RESOURCE, null);
+                                       ResponseFormat responseFormat = componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(curVfcRes.right().value()), csarInfo.getCsarUUID());
+                                       componentsUtils.auditResource(responseFormat, csarInfo.getModifier(), oldResource, "", "", AuditingActionEnum.CREATE_RESOURCE, null);
                                        nodeTypesArtifactsToHandleRes = Either.right(responseFormat);
                                        break;
                                } else if (curVfcRes.isLeft()) {
@@ -705,10 +738,8 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                                }
                                if (!MapUtils.isEmpty(extractedVfcsArtifacts)) {
                                        List<ArtifactDefinition> currArtifacts = new ArrayList<>();
-                                       for (String currNamespace : currVfcToscaNameEntry.getKey().getValue()) {
-                                               if (extractedVfcsArtifacts.containsKey(currNamespace)) {
-                                                       handleAndAddExtractedVfcsArtifacts(currArtifacts, extractedVfcsArtifacts.get(currNamespace));
-                                               }
+                                       if (extractedVfcsArtifacts.containsKey(currNamespace)) {
+                                               handleAndAddExtractedVfcsArtifacts(currArtifacts, extractedVfcsArtifacts.get(currNamespace));
                                        }
                                        curNodeTypeArtifactsToHandleRes = findNodeTypeArtifactsToHandle(curNodeType, currArtifacts);
                                        if (curNodeTypeArtifactsToHandleRes.isRight()) {
@@ -730,7 +761,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                                        }
                                }
                                if (MapUtils.isNotEmpty(curNodeTypeArtifactsToHandle)) {
-                                       nodeTypesArtifactsToHandle.put(currVfcToscaNameEntry.getKey().getKey(), curNodeTypeArtifactsToHandle);
+                                       nodeTypesArtifactsToHandle.put(currVfcToscaNameEntry.getKey(), curNodeTypeArtifactsToHandle);
                                }
                        }
                } catch (Exception e) {
@@ -741,22 +772,6 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                return nodeTypesArtifactsToHandleRes;
        }
 
-       private void validateNodeTypeIdentifiers(Map<String, List<ArtifactDefinition>> extractedVfcsArtifacts, List<ImmutablePair<ImmutablePair<String, List<String>>, String>> extractedVfcToscaNames) {
-               if (extractedVfcsArtifacts != null) {
-                       List<String> validIdentifiers = new ArrayList<>();
-                       if (extractedVfcToscaNames != null) {
-                               extractedVfcToscaNames.stream().forEach(pair -> {
-                                       validIdentifiers.addAll(pair.getKey().getValue());
-                                       validIdentifiers.add(pair.getKey().getKey());
-                               });
-                       }
-                       for (String curIdentifier : extractedVfcsArtifacts.keySet()) {
-                               if (validIdentifiers != null && !validIdentifiers.contains(curIdentifier))
-                                       log.warn("Warning - VFC identification {} provided in the Artifacts folder of the CSAR is not valid. ", curIdentifier);
-                       }
-               }
-       }
-
        private Either<EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>, ResponseFormat> findNodeTypeArtifactsToHandle(Resource curNodeType, List<ArtifactDefinition> extractedArtifacts) {
 
                Either<EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>, ResponseFormat> nodeTypeArtifactsToHandleRes = null;
@@ -784,7 +799,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                                                                if (!foundArtifact.getArtifactChecksum().equals(currNewArtifact.getArtifactChecksum())) {
                                                                        foundArtifact.setPayload(currNewArtifact.getPayloadData());
                                                                        foundArtifact.setPayloadData(Base64.encodeBase64String(currNewArtifact.getPayloadData()));
-                                                                       foundArtifact.setArtifactChecksum(GeneralUtility.calculateMD5ByByteArray(currNewArtifact.getPayloadData()));
+                                                                       foundArtifact.setArtifactChecksum(GeneralUtility.calculateMD5Base64EncodedByByteArray(currNewArtifact.getPayloadData()));
                                                                        artifactsToUpdate.add(foundArtifact);
                                                                }
                                                                existingArtifacts.remove(foundArtifact.getArtifactLabel());
@@ -868,8 +883,8 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
         * @param inTransaction
         * @return
         */
-       public Either<List<ArtifactDefinition>, ResponseFormat> handleNodeTypeArtifacts(Resource nodeTypeResource, Map<ArtifactOperationEnum, List<ArtifactDefinition>> nodeTypeArtifactsToHandle, List<ArtifactDefinition> vfcsNewCreatedArtifacts,
-                                                                                                                                                                       User user, boolean inTransaction) {
+       public Either<List<ArtifactDefinition>, ResponseFormat> handleNodeTypeArtifacts(Resource nodeTypeResource, Map<ArtifactOperationEnum, List<ArtifactDefinition>> nodeTypeArtifactsToHandle, List<ArtifactDefinition> createdArtifacts,
+                       User user, boolean inTransaction, boolean ignoreLifecycleState) {
                Either<List<ArtifactDefinition>, ResponseFormat> handleNodeTypeArtifactsRequestRes;
                Either<List<ArtifactDefinition>, ResponseFormat> handleNodeTypeArtifactsRes = null;
                Either<Resource, ResponseFormat> changeStateResponse;
@@ -887,14 +902,14 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                                List<ArtifactDefinition> curArtifactsToHandle = curOperationEntry.getValue();
                                if (curArtifactsToHandle != null && !curArtifactsToHandle.isEmpty()) {
                                        log.debug("************* Going to {} artifact to vfc {}", curOperation.name(), nodeTypeResource.getName());
-                                       handleNodeTypeArtifactsRequestRes = artifactsBusinessLogic.handleArtifactsRequestForInnerVfcComponent(curArtifactsToHandle, nodeTypeResource, user, vfcsNewCreatedArtifacts,
-                                                       artifactsBusinessLogic.new ArtifactOperationInfo(false, false, curOperation), false, inTransaction);
+                                       handleNodeTypeArtifactsRequestRes = artifactsBusinessLogic.handleArtifactsRequestForInnerVfcComponent(curArtifactsToHandle, nodeTypeResource, user, createdArtifacts,
+                                                       artifactsBusinessLogic.new ArtifactOperationInfo(false, ignoreLifecycleState, curOperation), false, inTransaction);
                                        if (handleNodeTypeArtifactsRequestRes.isRight()) {
                                                handleNodeTypeArtifactsRes = Either.right(handleNodeTypeArtifactsRequestRes.right().value());
                                                break;
                                        }
-                                       if (curOperation == ArtifactOperationEnum.Create) {
-                                               vfcsNewCreatedArtifacts.addAll(handleNodeTypeArtifactsRequestRes.left().value());
+                                       if (ArtifactOperationEnum.isCreateOrLink(curOperation)) {
+                                               createdArtifacts.addAll(handleNodeTypeArtifactsRequestRes.left().value());
                                        }
                                        handledNodeTypeArtifacts.addAll(handleNodeTypeArtifactsRequestRes.left().value());
                                }
@@ -910,92 +925,37 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                return handleNodeTypeArtifactsRes;
        }
 
-       @SuppressWarnings("unchecked")
-       private List<ImmutablePair<ImmutablePair<String, List<String>>, String>> extractVfcToscaNames(Map<String, byte[]> csar, String yamlFileName, String vfResourceName, Map<String, UploadComponentInstanceInfo> uploadComponentInstanceInfoMap) {
-               List<ImmutablePair<ImmutablePair<String, List<String>>, String>> vfcToscaNames = new ArrayList<>();
-               Map<String, Object> nodeTypes;
-               if (csar != null) {
-                       nodeTypes = new HashMap<>();
-                       putNodeTypesFromYaml(csar, yamlFileName, nodeTypes);
-                       putNodeTypesFromYaml(csar, Constants.GLOBAL_SUBSTITUTION_TYPES_SERVICE_TEMPLATE, nodeTypes);
-                       putNodeTypesFromYaml(csar, Constants.ABSTRACT_SUBSTITUTE_GLOBAL_TYPES_SERVICE_TEMPLATE, nodeTypes);
-                       Map<String,String> nestedServiceTemplatesMap = new HashMap<>();
-                       for(UploadComponentInstanceInfo ci : uploadComponentInstanceInfoMap.values()){
-                               if(ci.getProperties() != null && ci.getProperties().containsKey("service_template_filter")){
-                                       String tempName = CsarUtils.DEFINITIONS_PATH + ((Map<String, String>)ci.getProperties().get("service_template_filter").get(0).getValue()).get("substitute_service_template");
-                                       putNodeTypesFromYaml(csar,tempName, nodeTypes);
-                                       nestedServiceTemplatesMap.put(ci.getType(), tempName);
-                               }
-                       }
-
-                       if (!nodeTypes.isEmpty()) {
-                               Iterator<Entry<String, Object>> nodesNameEntry = nodeTypes.entrySet().iterator();
-                               while (nodesNameEntry.hasNext()) {
-                                       Entry<String, Object> nodeType = nodesNameEntry.next();
-                                       addVfcToscaNameFindSubstitutes(csar, vfResourceName, vfcToscaNames, nodeType.getKey(), nestedServiceTemplatesMap);
-                               }
+       private Map<String, String> extractVfcToscaNames(Map<String, NodeTypeInfo> nodeTypesInfo, String vfResourceName, CsarInfo csarInfo) {
+               Map<String, String> vfcToscaNames = new HashMap<>();
+                       
+               Map<String, Object> nodes = extractAllNodes(nodeTypesInfo, csarInfo);
+               if (!nodes.isEmpty()) {
+                       Iterator<Entry<String, Object>> nodesNameEntry = nodes.entrySet().iterator();
+                       while (nodesNameEntry.hasNext()) {
+                               Entry<String, Object> nodeType = nodesNameEntry.next();
+                               String toscaResourceName = buildNestedToscaResourceName(ResourceTypeEnum.VFC.name(), vfResourceName, nodeType.getKey());
+                               vfcToscaNames.put(nodeType.getKey(), toscaResourceName);
                        }
                }
-               return vfcToscaNames;
-       }
-
-       @SuppressWarnings("unchecked")
-       private void putNodeTypesFromYaml(Map<String, byte[]> csar, String yamlFileName, Map<String, Object> nodeTypes) {
-
-               if (csar.containsKey(yamlFileName)) {
-                       Map<String, Object> mappedToscaTemplate;
-                       Either<Map<String, Object>, ResultStatusEnum> eitherNodeTypes;
-                       mappedToscaTemplate = (Map<String, Object>) new Yaml().load(new String(csar.get(yamlFileName), StandardCharsets.UTF_8));
-                       eitherNodeTypes = ImportUtils.findFirstToscaMapElement(mappedToscaTemplate, ToscaTagNamesEnum.NODE_TYPES);
-                       if (eitherNodeTypes.isLeft()) {
-                               nodeTypes.putAll(eitherNodeTypes.left().value());
-                       }
+               for(NodeTypeInfo cvfc : nodeTypesInfo.values()){
+                       vfcToscaNames.put(cvfc.getType(), buildNestedToscaResourceName(ResourceTypeEnum.CVFC.name(), vfResourceName, cvfc.getType()));
                }
+               return vfcToscaNames;
        }
 
-       private void addVfcToscaNameFindSubstitutes(Map<String, byte[]> csar, String vfResourceName, List<ImmutablePair<ImmutablePair<String, List<String>>, String>> vfcToscaNames, String nodeTypeFullName, Map<String, String> nestedServiceTemplatesMap) {
-
-               String toscaResourceName = buildNestedVfcToscaResourceName(vfResourceName, nodeTypeFullName);
-               String nodeTypeTemplateYamlName =null;
-               if(nestedServiceTemplatesMap.containsKey(nodeTypeFullName)){
-                       nodeTypeTemplateYamlName = nestedServiceTemplatesMap.get(nodeTypeFullName);
-               }
-               List<String> relatedVfcsToscaNameSpaces = new ArrayList<>();
-               relatedVfcsToscaNameSpaces.add(buildNestedVfcToscaNamespace(nodeTypeFullName));
-               if (nodeTypeTemplateYamlName!=null && csar.containsKey(nodeTypeTemplateYamlName)) {
-                       addSubstituteToscaNamespacesRecursively(csar, nodeTypeTemplateYamlName, relatedVfcsToscaNameSpaces, nestedServiceTemplatesMap);
+       private Map<String, Object> extractAllNodes(Map<String, NodeTypeInfo> nodeTypesInfo, CsarInfo csarInfo) {
+               Map<String, Object> nodes = new HashMap<>();
+               for(NodeTypeInfo nodeTypeInfo: nodeTypesInfo.values()){
+                       extractNodeTypes(nodes, nodeTypeInfo.getMappedToscaTemplate());
                }
-               ImmutablePair<String, List<String>> toscaNameSpacesHierarchy = new ImmutablePair<>(nodeTypeFullName, relatedVfcsToscaNameSpaces);
-               vfcToscaNames.add(new ImmutablePair<>(toscaNameSpacesHierarchy, toscaResourceName));
+               extractNodeTypes(nodes, csarInfo.getMappedToscaMainTemplate());
+               return nodes;
        }
 
-       private void addSubstituteToscaNamespacesRecursively(Map<String, byte[]> csar, String yamlFileName, List<String> toscaNameSpaces, Map<String, String> nestedServiceTemplatesMap) {
-
-               Map<String, Object> nodeTypes = new HashMap<>();
-
-               if (csar.containsKey(yamlFileName)) {
-                       putNodeTypesFromYaml(csar, yamlFileName, nodeTypes);
-               }
-               if (!nodeTypes.isEmpty()) {
-                       Iterator<Entry<String, Object>> nodesNameEntry = nodeTypes.entrySet().iterator();
-                       while (nodesNameEntry.hasNext()) {
-                               Entry<String, Object> nodeType = nodesNameEntry.next();
-                               String nodeTypeFullName = nodeType.getKey();
-                               String toscaNameSpace = buildNestedVfcToscaNamespace(nodeTypeFullName);
-                               if (toscaNameSpaces.contains(toscaNameSpace)) {
-                                       break;
-                               }
-                               toscaNameSpaces.add(toscaNameSpace);
-
-                               String nodeTypeTemplateYamlName =null;
-                               if(nestedServiceTemplatesMap.containsKey(nodeTypeFullName)){
-                                       nodeTypeTemplateYamlName = nestedServiceTemplatesMap.get(nodeTypeFullName);
-                               }
-
-                               if (nodeTypeTemplateYamlName!=null && csar.containsKey(nodeTypeTemplateYamlName)) {
-                                       addSubstituteToscaNamespacesRecursively(csar, nodeTypeTemplateYamlName, toscaNameSpaces, nestedServiceTemplatesMap);
-                               }
-                       }
+       private void extractNodeTypes(Map<String, Object> nodes, Map<String, Object> mappedToscaTemplate) {
+               Either<Map<String, Object>, ResultStatusEnum> eitherNodeTypes = ImportUtils.findFirstToscaMapElement(mappedToscaTemplate, ToscaTagNamesEnum.NODE_TYPES);
+               if (eitherNodeTypes.isLeft()) {
+                       nodes.putAll(eitherNodeTypes.left().value());
                }
        }
 
@@ -1023,7 +983,15 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                String yamlFileName = toscaYamlCsarStatus.left().value().getKey();
                String yamlFileContents = toscaYamlCsarStatus.left().value().getValue();
                log.trace("YAML topology file found in CSAR, file name: {}, contents: {}", yamlFileName, yamlFileContents);
-               Either<Resource, ResponseFormat> createResourceFromYaml = createResourceFromYaml(resource, user, yamlFileContents, yamlFileName, csar.left().value(), csarUUID);
+
+               CsarInfo csarInfo = new CsarInfo(resource.getName(), user, csarUUID, csar.left().value(), yamlFileContents, false);
+               Map<String, NodeTypeInfo> nodeTypesInfo = extractNodeTypesInfo(csarInfo);
+               Either<Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>>, ResponseFormat> findNodeTypesArtifactsToHandleRes = findNodeTypesArtifactsToHandle(nodeTypesInfo, csarInfo, resource);
+               if (findNodeTypesArtifactsToHandleRes.isRight()) {
+                       log.debug("failed to find node types for update with artifacts during import csar {}. ", csarInfo.getCsarUUID());
+                       return Either.right(findNodeTypesArtifactsToHandleRes.right().value());
+               }
+               Either<Resource, ResponseFormat> createResourceFromYaml = createResourceFromYaml(resource, yamlFileContents, yamlFileName, nodeTypesInfo, csarInfo, findNodeTypesArtifactsToHandleRes.left().value(), true, false, null);
                if (createResourceFromYaml.isRight()) {
                        log.debug("Couldn't create resource from YAML");
                        return Either.right(createResourceFromYaml.right().value());
@@ -1034,6 +1002,89 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                return Either.left(vfResource);
        }
 
+       private Map<String, NodeTypeInfo> extractNodeTypesInfo(CsarInfo csarInfo) {
+               Map<String, NodeTypeInfo> nodeTypesInfo = new HashMap<>();
+               List<Entry<String, byte[]>> globalSubstitutes = new ArrayList<>();
+               for (Map.Entry<String, byte[]> entry : csarInfo.getCsar().entrySet()) {
+                       extractNodeTypeInfo(nodeTypesInfo, globalSubstitutes, entry);
+               }
+               if (CollectionUtils.isNotEmpty(globalSubstitutes)) {
+                       setDerivedFrom(nodeTypesInfo, globalSubstitutes);
+               }
+               markNestedVfc(csarInfo.getMappedToscaMainTemplate(), nodeTypesInfo);
+               return nodeTypesInfo;
+       }
+
+       @SuppressWarnings("unchecked")
+       private void setDerivedFrom(Map<String, NodeTypeInfo> nodeTypesInfo, List<Entry<String, byte[]>> globalSubstitutes) {
+               for (Map.Entry<String, byte[]> entry : globalSubstitutes) {
+                       String yamlFileContents = new String(entry.getValue());
+                       Map<String, Object> mappedToscaTemplate = (Map<String, Object>) new Yaml().load(yamlFileContents);
+                       Either<Object, ResultStatusEnum> nodeTypesEither = ImportUtils.findToscaElement(mappedToscaTemplate, ToscaTagNamesEnum.NODE_TYPES, ToscaElementTypeEnum.MAP);
+                       if (nodeTypesEither.isLeft()) {
+                               Map<String, Object> nodeTypes = (Map<String, Object>) nodeTypesEither.left().value();
+                               for (Entry<String, Object> nodeType : nodeTypes.entrySet()) {
+                                       Map<String, Object> nodeTypeMap = (Map<String, Object>) nodeType.getValue();
+                                       if (nodeTypeMap.containsKey(ToscaTagNamesEnum.DERIVED_FROM.getElementName())) {
+                                               if (nodeTypesInfo.containsKey(nodeType.getKey())) {
+                                                       NodeTypeInfo nodeTypeInfo = nodeTypesInfo.get(nodeType.getKey());
+                                                       List<String> derivedFrom = new ArrayList<>();
+                                                       derivedFrom.add((String) nodeTypeMap.get(ToscaTagNamesEnum.DERIVED_FROM.getElementName()));
+                                                       nodeTypeInfo.setDerivedFrom(derivedFrom);
+                                               }
+                                       }
+                               }
+                       }
+               }
+       }
+
+       @SuppressWarnings("unchecked")
+       private void extractNodeTypeInfo(Map<String, NodeTypeInfo> nodeTypesInfo,
+                       List<Entry<String, byte[]>> globalSubstitutes, Map.Entry<String, byte[]> entry) {
+               if (Pattern.compile(CsarUtils.SERVICE_TEMPLATE_PATH_PATTERN).matcher(entry.getKey()).matches()) {
+                       if (!isGlobalSubstitute(entry.getKey())) {
+                               String yamlFileContents = new String(entry.getValue());
+                               Map<String, Object> mappedToscaTemplate = (Map<String, Object>) new Yaml().load(yamlFileContents);
+                               Either<Object, ResultStatusEnum> substitutionMappingsEither = ImportUtils.findToscaElement(mappedToscaTemplate, ToscaTagNamesEnum.SUBSTITUTION_MAPPINGS, ToscaElementTypeEnum.MAP);
+                               if (substitutionMappingsEither.isLeft()) {
+                                       Map<String, Object> substitutionMappings = (Map<String, Object>) substitutionMappingsEither.left().value();
+                                       if (substitutionMappings.containsKey(ToscaTagNamesEnum.NODE_TYPE.getElementName())) {
+                                               NodeTypeInfo nodeTypeInfo = new NodeTypeInfo();
+                                               nodeTypeInfo.setType((String) substitutionMappings.get(ToscaTagNamesEnum.NODE_TYPE.getElementName()));
+                                               nodeTypeInfo.setTemplateFileName(entry.getKey());
+                                               nodeTypeInfo.setMappedToscaTemplate(mappedToscaTemplate);
+                                               nodeTypesInfo.put(nodeTypeInfo.getType(), nodeTypeInfo);
+                                       }
+                               }
+                       } else {
+                               globalSubstitutes.add(entry);
+                       }
+               }
+       }
+
+
+       @SuppressWarnings("unchecked")
+       private void markNestedVfc(Map<String, Object> mappedToscaTemplate, Map<String, NodeTypeInfo> nodeTypesInfo) {
+               Either<Object, ResultStatusEnum> nodeTemplatesEither = ImportUtils.findToscaElement(mappedToscaTemplate, ToscaTagNamesEnum.NODE_TEMPLATES, ToscaElementTypeEnum.MAP);
+               if (nodeTemplatesEither.isLeft()) {
+                       Map<String, Object> nodeTemplates = (Map<String, Object>) nodeTemplatesEither.left().value();
+                       for (Entry<String, Object> nodeTemplateEntry : nodeTemplates.entrySet()) {
+                               Map<String, Object> nodeTemplate = (Map<String, Object>) nodeTemplateEntry.getValue();
+                               if (nodeTemplate.containsKey(ToscaTagNamesEnum.TYPE.getElementName())) {
+                                       String type = (String) nodeTemplate.get(ToscaTagNamesEnum.TYPE.getElementName());
+                                       if (nodeTypesInfo.containsKey(type)) {
+                                               NodeTypeInfo nodeTypeInfo = nodeTypesInfo.get(type);
+                                               nodeTypeInfo.setNested(true);
+                                       }
+                               }
+                       }
+               }
+       }
+
+       private boolean isGlobalSubstitute(String fileName) {
+               return fileName.equalsIgnoreCase(Constants.GLOBAL_SUBSTITUTION_TYPES_SERVICE_TEMPLATE) || fileName.equalsIgnoreCase(Constants.ABSTRACT_SUBSTITUTE_GLOBAL_TYPES_SERVICE_TEMPLATE);
+       }
+
        private Either<ImmutablePair<String, String>, ResponseFormat> validateAndParseCsar(Resource resource, User user, String csarUUID, Either<Map<String, byte[]>, StorageOperationStatus> csar) {
                if (csar.isRight()) {
                        StorageOperationStatus value = csar.right().value();
@@ -1078,36 +1129,41 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                if (validateRes.isRight()) {
                        return Either.right(validateRes.right().value());
                }
-               // VF "derivedFrom" should be null (or ignored)
-               if (!resource.getResourceType().equals(ResourceTypeEnum.VF)) {
+               // VF / PNF "derivedFrom" should be null (or ignored)
+               if (ModelConverter.isAtomicComponent(resource)) {
                        Either<Boolean, ResponseFormat> validateDerivedFromNotEmpty = validateDerivedFromNotEmpty(user, resource, AuditingActionEnum.CREATE_RESOURCE);
                        if (validateDerivedFromNotEmpty.isRight()) {
                                return Either.right(validateDerivedFromNotEmpty.right().value());
                        }
                }
-               return validateResourceBeforeCreate(resource, user, AuditingActionEnum.CREATE_RESOURCE, inTransaction);
+               return validateResourceBeforeCreate(resource, user, AuditingActionEnum.CREATE_RESOURCE, inTransaction, null);
 
        }
-
-       public Either<Resource, ResponseFormat> createResourceFromYaml(Resource resource, User user, String topologyTemplateYaml, String yamlName, Map<String, byte[]> csar, String csarUUID) {
+//resource, yamlFileContents, yamlFileName, nodeTypesInfo,csarInfo, nodeTypesArtifactsToCreate, true, false, null
+       private Either<Resource, ResponseFormat> createResourceFromYaml(Resource resource, String topologyTemplateYaml, String yamlName,
+                       Map<String, NodeTypeInfo> nodeTypesInfo, CsarInfo csarInfo,
+                       Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>> nodeTypesArtifactsToCreate,
+                       boolean shouldLock, boolean inTransaction, String nodeName) {
 
                List<ArtifactDefinition> createdArtifacts = new ArrayList<ArtifactDefinition>();
                log.trace("************* createResourceFromYaml before parse yaml ");
-               Either<ParsedToscaYamlInfo, ResponseFormat> parseResourceInfoFromYamlEither = parseResourceInfoFromYaml(yamlName, resource, topologyTemplateYaml, user);
+               Either<ParsedToscaYamlInfo, ResponseFormat> parseResourceInfoFromYamlEither = parseResourceInfoFromYaml(yamlName, resource, topologyTemplateYaml, csarInfo.getCreatedNodesToscaResourceNames(), nodeTypesInfo, nodeName);
                if (parseResourceInfoFromYamlEither.isRight()) {
                        ResponseFormat responseFormat = parseResourceInfoFromYamlEither.right().value();
-                       componentsUtils.auditResource(responseFormat, user, resource, "", "", AuditingActionEnum.IMPORT_RESOURCE, null);
+                       componentsUtils.auditResource(responseFormat, csarInfo.getModifier(), resource, "", "", AuditingActionEnum.IMPORT_RESOURCE, null);
                        return Either.right(responseFormat);
                }
                log.trace("************* createResourceFromYaml after parse yaml ");
                ParsedToscaYamlInfo parsedToscaYamlInfo = parseResourceInfoFromYamlEither.left().value();
                log.debug("The parsed tosca yaml info is {}", parsedToscaYamlInfo);
                log.trace("************* createResourceFromYaml before create ");
-               Either<Resource, ResponseFormat> createdResourceResponse = createResourceAndRIsFromYaml(yamlName, resource, user, parsedToscaYamlInfo, AuditingActionEnum.IMPORT_RESOURCE, false, csarUUID, csar, createdArtifacts, topologyTemplateYaml);
+               Either<Resource, ResponseFormat> createdResourceResponse = createResourceAndRIsFromYaml(yamlName, resource, parsedToscaYamlInfo, 
+                               AuditingActionEnum.IMPORT_RESOURCE, false, createdArtifacts, topologyTemplateYaml,
+                               nodeTypesInfo, csarInfo, nodeTypesArtifactsToCreate, shouldLock, inTransaction, nodeName);
                log.trace("************* createResourceFromYaml after create ");
                if (createdResourceResponse.isRight()) {
                        ResponseFormat responseFormat = createdResourceResponse.right().value();
-                       componentsUtils.auditResource(responseFormat, user, resource, "", "", AuditingActionEnum.IMPORT_RESOURCE, null);
+                       componentsUtils.auditResource(responseFormat, csarInfo.getModifier(), resource, "", "", AuditingActionEnum.IMPORT_RESOURCE, null);
                        return Either.right(responseFormat);
                }
 
@@ -1115,47 +1171,159 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
 
        }
 
-       public Either<Map<String, Resource>, ResponseFormat> createResourcesFromYamlNodeTypesList(String yamlName, Resource resource, String resourceYml, User user, boolean needLock,
-                                                                                                                                                                                         Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>> nodeTypesArtifactsToHandle, List<ArtifactDefinition> nodeTypesNewCreatedArtifacts) {
-
-               Map<String, Object> mappedToscaTemplate = (Map<String, Object>) new Yaml().load(resourceYml);
+       public Either<Map<String, Resource>, ResponseFormat> createResourcesFromYamlNodeTypesList(String yamlName, Resource resource, Map<String, Object> mappedToscaTemplate, boolean needLock,
+                                                                                                                                                                                         Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>> nodeTypesArtifactsToHandle, List<ArtifactDefinition> nodeTypesNewCreatedArtifacts,
+                                                                                                                                                                                         Map<String, NodeTypeInfo> nodeTypesInfo, CsarInfo csarInfo) {
 
                Either<String, ResultStatusEnum> tosca_version = ImportUtils.findFirstToscaStringElement(mappedToscaTemplate, ToscaTagNamesEnum.TOSCA_VERSION);
                if (tosca_version.isRight()) {
                        ResponseFormat responseFormat = getComponentsUtils().getResponseFormat(ActionStatus.INVALID_TOSCA_TEMPLATE);
                        return Either.right(responseFormat);
                }
-
                Either<Map<String, Object>, ResultStatusEnum> eitherNodeTypes = ImportUtils.findFirstToscaMapElement(mappedToscaTemplate, ToscaTagNamesEnum.NODE_TYPES);
-
-               Map<String, Resource> nodeTypesResources = new HashMap<>();
-               Either<Map<String, Resource>, ResponseFormat> result = Either.left(nodeTypesResources);
-
+               Either<Map<String, Resource>, ResponseFormat> result = Either.left(csarInfo.getCreatedNodes());
                Map<String, Object> mapToConvert = new HashMap<String, Object>();
                mapToConvert.put(ToscaTagNamesEnum.TOSCA_VERSION.getElementName(), tosca_version.left().value());
-
+               Resource vfcCreated = null;
                if (eitherNodeTypes.isLeft()) {
-
                        Iterator<Entry<String, Object>> nodesNameValue = eitherNodeTypes.left().value().entrySet().iterator();
-
                        while (nodesNameValue.hasNext()) {
-
                                Entry<String, Object> nodeType = nodesNameValue.next();
                                Map<ArtifactOperationEnum, List<ArtifactDefinition>> nodeTypeArtifactsToHandle = nodeTypesArtifactsToHandle == null || nodeTypesArtifactsToHandle.isEmpty() ? null : nodeTypesArtifactsToHandle.get(nodeType.getKey());
-                               log.trace("************* Going to create node {}", nodeType.getKey());
-                               Either<ImmutablePair<Resource, ActionStatus>, ResponseFormat> resourceCreated = this.createNodeTypeResourceFromYaml(yamlName, nodeType, user, mapToConvert, resource, needLock, nodeTypeArtifactsToHandle, nodeTypesNewCreatedArtifacts);
-                               log.trace("************* finished to create node {}", nodeType.getKey());
-                               if (resourceCreated.isRight()) {
-                                       return Either.right(resourceCreated.right().value());
-                               }
-                               Resource vfcCreated = resourceCreated.left().value().getLeft();
 
-                               nodeTypesResources.put(nodeType.getKey(), vfcCreated);
+                               if (nodeTypesInfo.containsKey(nodeType.getKey())) {
+                                       log.trace("************* Going to handle nested vfc {}", nodeType.getKey());
+                                       Either<Resource, ResponseFormat> handleNeatedVfcYaml = handleNestedVfc(resource, nodeTypesArtifactsToHandle, nodeTypesNewCreatedArtifacts, nodeTypesInfo, csarInfo, nodeType.getKey());
+                                       log.trace("************* Finished to handle nested vfc {}", nodeType.getKey());
+                                       if (handleNeatedVfcYaml.isRight()) {
+                                               return Either.right(handleNeatedVfcYaml.right().value());
+                                       }
+                                       vfcCreated = handleNeatedVfcYaml.left().value();
+                               } else if(csarInfo.getCreatedNodesToscaResourceNames()!= null && !csarInfo.getCreatedNodesToscaResourceNames().containsKey(nodeType.getKey())){
+                                       log.trace("************* Going to create node {}", nodeType.getKey());
+                                       Either<ImmutablePair<Resource, ActionStatus>, ResponseFormat> resourceCreated = this.createNodeTypeResourceFromYaml(yamlName, nodeType, csarInfo.getModifier(), mapToConvert, resource, needLock, nodeTypeArtifactsToHandle, nodeTypesNewCreatedArtifacts, true, csarInfo);
+                                       log.debug("************* Finished to create node {}", nodeType.getKey());
+
+                                       if (resourceCreated.isRight()) {
+                                               return Either.right(resourceCreated.right().value());
+                                       }
+                                       vfcCreated = resourceCreated.left().value().getLeft();
+                                       csarInfo.getCreatedNodesToscaResourceNames().put(nodeType.getKey(),vfcCreated.getToscaResourceName());
+                               }
+                               if (vfcCreated != null) {
+                                       csarInfo.getCreatedNodes().put(nodeType.getKey(), vfcCreated);
+                               }
                                mapToConvert.remove(ToscaTagNamesEnum.NODE_TYPES.getElementName());
+                       }
+               }
+               return result;
+       }
+
+       private Either<Resource, ResponseFormat> handleNestedVfc(Resource resource, Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>> nodesArtifactsToHandle,
+                       List<ArtifactDefinition> createdArtifacts, Map<String, NodeTypeInfo> nodesInfo, CsarInfo csarInfo, String nodeName) {
+
+               Either<Resource, ResponseFormat> handleNestedVfcRes = Either.left(resource);
+               String yamlName = nodesInfo.get(nodeName).getTemplateFileName();
+               Map<String, Object> nestedVfcJsonMap = nodesInfo.get(nodeName).getMappedToscaTemplate();
+
+               log.debug("************* Going to create node types from yaml {}", yamlName);
+               Either<Map<String, Resource>, ResponseFormat> createNodeTypesRes =      createResourcesFromYamlNodeTypesList(yamlName, resource,
+                                               nestedVfcJsonMap, false, nodesArtifactsToHandle, createdArtifacts, nodesInfo, csarInfo);
+               if (createNodeTypesRes.isRight()) {
+                       log.debug("Failed to create node types from yaml {}. Status is {}", yamlName, createNodeTypesRes.right().value());
+                       return Either.right(createNodeTypesRes.right().value());
+               }
+               log.debug("************* Finished to create node types from yaml {}", yamlName);
+               
+               if (nestedVfcJsonMap.containsKey(ToscaTagNamesEnum.TOPOLOGY_TEMPLATE.getElementName())) {
+                       log.debug("************* Going to handle complex VFC from yaml {}", yamlName);
+                       handleNestedVfcRes = handleComplexVfc(resource, nodesArtifactsToHandle, createdArtifacts, nodesInfo, csarInfo, nodeName, yamlName);
+               }
+               return handleNestedVfcRes;
+       }
+
+       private Either<Resource, ResponseFormat> handleComplexVfc(Resource resource, Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>> nodesArtifactsToHandle, List<ArtifactDefinition> createdArtifacts,
+                       Map<String, NodeTypeInfo> nodesInfo, CsarInfo csarInfo, String nodeName, String yamlName) {
+               
+               Either<Resource, ResponseFormat> result = null;
+               Resource  oldComplexVfc = null;
+               Resource  newComplexVfc = null;
+               
+               Either<Resource, ResponseFormat> buildCvfcRes = buildValidComplexVfc(resource, csarInfo, nodeName, nodesInfo);
+               if(buildCvfcRes.isRight()){
+                       log.debug("Failed to validate complex VFC for node {}. ", nodeName);
+                       result = buildCvfcRes;
+               }
+               if(result == null){
+                       newComplexVfc = buildCvfcRes.left().value();
+                       Either<Resource, StorageOperationStatus> oldComplexVfcRes = toscaOperationFacade.getFullLatestComponentByToscaResourceName(newComplexVfc.getToscaResourceName());
+                       if(oldComplexVfcRes.isRight() && oldComplexVfcRes.right().value() != StorageOperationStatus.NOT_FOUND){
+                               log.debug("Failed to fetch previous complex VFC by tosca resource name {}. Status is {}. ", newComplexVfc.getToscaResourceName(), oldComplexVfcRes.right().value());
+                               result = Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR));
+                       } else if(oldComplexVfcRes.isLeft()){
+                               oldComplexVfc = oldComplexVfcRes.left().value();
+                       }
+               }
+               if(result == null){
+                       result = handleComplexVfc(nodesArtifactsToHandle, createdArtifacts, nodesInfo, csarInfo, nodeName, yamlName, oldComplexVfc, newComplexVfc);
+               }
+               if(result.isLeft()){
+                       newComplexVfc = result.left().value();
+                       csarInfo.getCreatedNodesToscaResourceNames().put(nodeName, newComplexVfc.getToscaResourceName());
+                       LifecycleChangeInfoWithAction lifecycleChangeInfo = new LifecycleChangeInfoWithAction("certification on import", LifecycleChanceActionEnum.CREATE_FROM_CSAR);
+                       log.debug("Going to certify cvfc {}. ", newComplexVfc.getName());
+                       result = propagateStateToCertified(csarInfo.getModifier(), newComplexVfc, lifecycleChangeInfo, true, false, true);
+                       if (result.isRight()) {
+                               log.debug("Failed to certify complex VFC resource {}. ", newComplexVfc.getName());
+                       }
+               }
+               if(result.isLeft()){
+                       csarInfo.getCreatedNodes().put(nodeName, result.left().value());
+                       csarInfo.getCvfcToCreateQueue().remove();
+               }
+               return result;
+       }
 
+       private Either<Resource, ResponseFormat> handleComplexVfc(Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>> nodesArtifactsToHandle, List<ArtifactDefinition> createdArtifacts, Map<String, NodeTypeInfo> nodesInfo,
+                       CsarInfo csarInfo, String nodeName, String yamlName, Resource oldComplexVfc, Resource newComplexVfc) {
+               
+               Either<Resource, ResponseFormat> handleComplexVfcRes;
+               Map<String, Object> mappedToscaTemplate = nodesInfo.get(nodeName).getMappedToscaTemplate();
+               String yamlContent =  new String(csarInfo.getCsar().get(yamlName));
+               Map<String, NodeTypeInfo> newNodeTypesInfo = nodesInfo.entrySet().stream().collect(Collectors.toMap(e -> e.getKey(), e -> e.getValue().getUnmarkedCopy()));
+               markNestedVfc(mappedToscaTemplate, newNodeTypesInfo);
+               if(oldComplexVfc == null){
+                       handleComplexVfcRes = createResourceFromYaml(newComplexVfc, yamlContent, yamlName, newNodeTypesInfo, csarInfo, nodesArtifactsToHandle, false, true, nodeName);
+                       if (handleComplexVfcRes.isRight()) {
+                               log.debug("Failed to create resource {} from YAML {}. ", newComplexVfc.getName(), yamlName);
+                       }
+               } else {
+                       handleComplexVfcRes = updateResourceFromYaml(oldComplexVfc, newComplexVfc, AuditingActionEnum.UPDATE_RESOURCE_METADATA, createdArtifacts, true, yamlContent, yamlName, csarInfo, newNodeTypesInfo, nodesArtifactsToHandle, nodeName);
+                       if (handleComplexVfcRes.isRight()) {
+                               log.debug("Failed to update resource {} from YAML {}. ", oldComplexVfc.getName(), yamlName);
                        }
                }
+               return handleComplexVfcRes;
+       }
 
+       private Either<Resource, ResponseFormat> buildValidComplexVfc(Resource resource, CsarInfo csarInfo, String nodeName, Map<String, NodeTypeInfo> nodesInfo) {
+               
+               Either<Resource, ResponseFormat> result = null;
+               Resource complexVfc = buildComplexVfcMetadata(resource, csarInfo, nodeName, nodesInfo);
+               log.debug("************* Going to validate complex VFC from yaml {}", complexVfc.getName());
+               
+               if(!csarInfo.getCvfcToCreateQueue().contains(nodeName)){
+                       csarInfo.getCvfcToCreateQueue().add(nodeName);
+               } else {
+                       log.debug("Failed to validate complex VFC {}. Loop detected, VSP {}. ",  complexVfc.getName(), csarInfo.getVfResourceName());
+                       result = Either.right(componentsUtils.getResponseFormat(ActionStatus.CFVC_LOOP_DETECTED, csarInfo.getVfResourceName(), complexVfc.getName()));
+               }
+               if(result == null){
+                       result = validateResourceBeforeCreate(complexVfc, csarInfo.getModifier(), AuditingActionEnum.IMPORT_RESOURCE, true, csarInfo);
+                       if(result.isRight()){
+                               log.debug("Failed to validate complex VFC {}. ", complexVfc.getName());
+                       }
+               }
                return result;
        }
 
@@ -1167,40 +1335,35 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
        }
 
        private Either<ImmutablePair<Resource, ActionStatus>, ResponseFormat> createNodeTypeResourceFromYaml(String yamlName, Entry<String, Object> nodeNameValue, User user, Map<String, Object> mapToConvert, Resource resourceVf, boolean needLock,
-                                                                                                                                                                                                                Map<ArtifactOperationEnum, List<ArtifactDefinition>> nodeTypeArtifactsToHandle, List<ArtifactDefinition> nodeTypesNewCreatedArtifacts) {
+                       Map<ArtifactOperationEnum, List<ArtifactDefinition>> nodeTypeArtifactsToHandle, List<ArtifactDefinition> nodeTypesNewCreatedArtifacts, boolean forceCertificationAllowed, CsarInfo csarInfo) {
 
                Either<UploadResourceInfo, ResponseFormat> resourceMetaData = fillResourceMetadata(yamlName, resourceVf, nodeNameValue.getKey(), user);
                if (resourceMetaData.isRight()) {
                        return Either.right(resourceMetaData.right().value());
                }
+               String singleVfcYaml = buildNodeTypeYaml(nodeNameValue, mapToConvert, resourceMetaData.left().value().getResourceType(), csarInfo.getVfResourceName());
 
+               Either<User, ResponseFormat> eitherCreator = validateUser(user, "CheckIn Resource", resourceVf, AuditingActionEnum.CHECKIN_RESOURCE, true);
+               if (eitherCreator.isRight()) {
+                       return Either.right(eitherCreator.right().value());
+               }
+               user = eitherCreator.left().value();
+
+               return this.createResourceFromNodeType(singleVfcYaml, resourceMetaData.left().value(), user, true, needLock, nodeTypeArtifactsToHandle, nodeTypesNewCreatedArtifacts, forceCertificationAllowed, csarInfo);
+       }
+
+       private String buildNodeTypeYaml(Entry<String, Object> nodeNameValue, Map<String, Object> mapToConvert, String nodeResourceType, String csarVfName) {
                // We need to create a Yaml from each node_types in order to create
                // resource from each node type using import normative flow.
                DumperOptions options = new DumperOptions();
                options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
                Yaml yaml = new Yaml(options);
 
-               Map<String, Object> singleVfc = new HashMap<>();
+               Map<String, Object> node = new HashMap<>();
+               node.put(buildNestedToscaResourceName(nodeResourceType, csarVfName, nodeNameValue.getKey()), nodeNameValue.getValue());
+               mapToConvert.put(ToscaTagNamesEnum.NODE_TYPES.getElementName(), node);
 
-               String actualName = this.getNodeTypeActualName(nodeNameValue.getKey());
-               if (!actualName.startsWith(Constants.ABSTRACT)) {
-                       actualName = "." + Constants.ABSTRACT + actualName;
-               }
-
-               // Setting tosca name
-               String toscaResourceName = ImportUtils.Constants.USER_DEFINED_RESOURCE_NAMESPACE_PREFIX + resourceMetaData.left().value().getResourceType().toLowerCase() + '.' + resourceVf.getSystemName() + actualName;
-               singleVfc.put(toscaResourceName, nodeNameValue.getValue());
-               mapToConvert.put(ToscaTagNamesEnum.NODE_TYPES.getElementName(), singleVfc);
-
-               String singleVfcYaml = yaml.dumpAsMap(mapToConvert);
-
-               Either<User, ResponseFormat> eitherCreator = validateUser(user, "CheckIn Resource", resourceVf, AuditingActionEnum.CHECKIN_RESOURCE, true);
-               if (eitherCreator.isRight()) {
-                       return Either.right(eitherCreator.right().value());
-               }
-               user = eitherCreator.left().value();
-
-               return this.createResourceFromNodeType(singleVfcYaml, resourceMetaData.left().value(), user, true, needLock, nodeTypeArtifactsToHandle, nodeTypesNewCreatedArtifacts);
+               return yaml.dumpAsMap(mapToConvert);
        }
 
        public Either<Boolean, ResponseFormat> validateResourceCreationFromNodeType(Resource resource, User creator) {
@@ -1213,25 +1376,25 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
        }
 
        public Either<ImmutablePair<Resource, ActionStatus>, ResponseFormat> createResourceFromNodeType(String nodeTypeYaml, UploadResourceInfo resourceMetaData, User creator, boolean isInTransaction, boolean needLock,
-                                                                                                                                                                                                       Map<ArtifactOperationEnum, List<ArtifactDefinition>> nodeTypeArtifactsToHandle, List<ArtifactDefinition> nodeTypesNewCreatedArtifacts) {
+                       Map<ArtifactOperationEnum, List<ArtifactDefinition>> nodeTypeArtifactsToHandle, List<ArtifactDefinition> nodeTypesNewCreatedArtifacts, boolean forceCertificationAllowed, CsarInfo csarInfo) {
 
                LifecycleChangeInfoWithAction lifecycleChangeInfo = new LifecycleChangeInfoWithAction("certification on import", LifecycleChanceActionEnum.CREATE_FROM_CSAR);
                Function<Resource, Either<Boolean, ResponseFormat>> validator = (resource) -> this.validateResourceCreationFromNodeType(resource, creator);
-               return this.resourceImportManager.importCertifiedResource(nodeTypeYaml, resourceMetaData, creator, validator, lifecycleChangeInfo, isInTransaction, true, needLock, nodeTypeArtifactsToHandle, nodeTypesNewCreatedArtifacts);
+               return this.resourceImportManager.importCertifiedResource(nodeTypeYaml, resourceMetaData, creator, validator, lifecycleChangeInfo, isInTransaction, true, needLock, nodeTypeArtifactsToHandle, nodeTypesNewCreatedArtifacts, forceCertificationAllowed, csarInfo);
        }
 
-       private Either<UploadResourceInfo, ResponseFormat> fillResourceMetadata(String yamlName, Resource resourceVf, String nodeTypeName, User user) {
+       private Either<UploadResourceInfo, ResponseFormat> fillResourceMetadata(String yamlName, Resource resourceVf, String nodeName, User user) {
                UploadResourceInfo resourceMetaData = new UploadResourceInfo();
 
                // validate nodetype name prefix
-               if (!nodeTypeName.startsWith(Constants.USER_DEFINED_RESOURCE_NAMESPACE_PREFIX)) {
-                       log.debug("invalid nodeTypeName:{} does not start with {}.", nodeTypeName, Constants.USER_DEFINED_RESOURCE_NAMESPACE_PREFIX);
-                       ResponseFormat responseFormat = getComponentsUtils().getResponseFormat(ActionStatus.INVALID_NODE_TEMPLATE, yamlName, resourceMetaData.getName(), nodeTypeName);
+               if (!nodeName.startsWith(Constants.USER_DEFINED_RESOURCE_NAMESPACE_PREFIX)) {
+                       log.debug("invalid nodeName:{} does not start with {}.", nodeName, Constants.USER_DEFINED_RESOURCE_NAMESPACE_PREFIX);
+                       ResponseFormat responseFormat = getComponentsUtils().getResponseFormat(ActionStatus.INVALID_NODE_TEMPLATE, yamlName, resourceMetaData.getName(), nodeName);
                        return Either.right(responseFormat);
                }
 
-               String actualName = this.getNodeTypeActualName(nodeTypeName);
-               String namePrefix = nodeTypeName.replace(actualName, "");
+               String actualName = this.getNodeTypeActualName(nodeName);
+               String namePrefix = nodeName.replace(actualName, "");
                String resourceType = namePrefix.substring(Constants.USER_DEFINED_RESOURCE_NAMESPACE_PREFIX.length());
 
                // if we import from csar, the node_type name can be
@@ -1243,7 +1406,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                // validating type
                if (!ResourceTypeEnum.containsName(resourceType.toUpperCase())) {
                        log.debug("invalid resourceType:{} the type is not one of the valide types:{}.", resourceType.toUpperCase(), ResourceTypeEnum.values());
-                       ResponseFormat responseFormat = getComponentsUtils().getResponseFormat(ActionStatus.INVALID_NODE_TEMPLATE, yamlName, resourceMetaData.getName(), nodeTypeName);
+                       ResponseFormat responseFormat = getComponentsUtils().getResponseFormat(ActionStatus.INVALID_NODE_TEMPLATE, yamlName, resourceMetaData.getName(), nodeName);
                        return Either.right(responseFormat);
                }
 
@@ -1278,20 +1441,69 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                return Either.left(resourceMetaData);
        }
 
-       private Either<Resource, ResponseFormat> createResourceAndRIsFromYaml(String yamlName, Resource resource, User user, ParsedToscaYamlInfo parsedToscaYamlInfo, AuditingActionEnum actionEnum, boolean isNormative, String csarUUID,
-                                                                                                                                                 Map<String, byte[]> csar, List<ArtifactDefinition> createdArtifacts, String topologyTemplateYaml) {
+       private Resource buildComplexVfcMetadata(Resource resourceVf, CsarInfo csarInfo, String nodeName, Map<String, NodeTypeInfo> nodesInfo) {
+               Resource cvfc = new Resource();
+               NodeTypeInfo nodeTypeInfo = nodesInfo.get(nodeName);
+               cvfc.setName(buildCvfcName(csarInfo.getVfResourceName(), nodeName));
+               cvfc.setNormalizedName(ValidationUtils.normaliseComponentName(cvfc.getName()));
+               cvfc.setSystemName(ValidationUtils.convertToSystemName(cvfc.getName()));
+               cvfc.setResourceType(ResourceTypeEnum.CVFC);
+               cvfc.setAbstract(true);
+               cvfc.setDerivedFrom(nodeTypeInfo.getDerivedFrom());
+               cvfc.setDescription(ImportUtils.Constants.CVFC_DESCRIPTION);
+               cvfc.setIcon(ImportUtils.Constants.DEFAULT_ICON);
+               cvfc.setContactId(csarInfo.getModifier().getUserId());
+               cvfc.setCreatorUserId(csarInfo.getModifier().getUserId());
+               cvfc.setVendorName(resourceVf.getVendorName());
+               cvfc.setVendorRelease(resourceVf.getVendorRelease());
+               cvfc.setResourceVendorModelNumber(resourceVf.getResourceVendorModelNumber());
+               cvfc.setToscaResourceName(buildNestedToscaResourceName(ResourceTypeEnum.CVFC.name(), csarInfo.getVfResourceName(), nodeName));
+               cvfc.setInvariantUUID(UniqueIdBuilder.buildInvariantUUID());
+               
+               List<String> tags = new ArrayList<>();
+               tags.add(cvfc.getName());
+               cvfc.setTags(tags);
+
+               CategoryDefinition category = new CategoryDefinition();
+               category.setName(ImportUtils.Constants.ABSTRACT_CATEGORY_NAME);
+               SubCategoryDefinition subCategory = new SubCategoryDefinition();
+               subCategory.setName(ImportUtils.Constants.ABSTRACT_SUBCATEGORY);
+               category.addSubCategory(subCategory);
+               List<CategoryDefinition> categories = new ArrayList<>();
+               categories.add(category);
+               cvfc.setCategories(categories);
+
+               cvfc.setVersion(ImportUtils.Constants.FIRST_NON_CERTIFIED_VERSION);
+               cvfc.setLifecycleState(ImportUtils.Constants.NORMATIVE_TYPE_LIFE_CYCLE_NOT_CERTIFIED_CHECKOUT);
+               cvfc.setHighestVersion(ImportUtils.Constants.NORMATIVE_TYPE_HIGHEST_VERSION);
+               
+               return cvfc;
+       }
+
+       private String buildCvfcName(String resourceVfName, String nodeName) {
+               String nameWithouNamespacePrefix = nodeName.substring(Constants.USER_DEFINED_RESOURCE_NAMESPACE_PREFIX.length());
+               String[] findTypes = nameWithouNamespacePrefix.split("\\.");
+               String resourceType = findTypes[0];
+               String resourceName = resourceVfName + "-" + nameWithouNamespacePrefix.substring(resourceType.length() + 1);
+               return  addCvfcSuffixToResourceName(resourceName);
+       }
+
+       private Either<Resource, ResponseFormat> createResourceAndRIsFromYaml(String yamlName, Resource resource, ParsedToscaYamlInfo parsedToscaYamlInfo, AuditingActionEnum actionEnum, boolean isNormative,
+                                                                                                                                                 List<ArtifactDefinition> createdArtifacts, String topologyTemplateYaml, Map<String, NodeTypeInfo> nodeTypesInfo,
+                                                                                                                                                 CsarInfo csarInfo, Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>> nodeTypesArtifactsToCreate,
+                                                                                                                                                 boolean shouldLock, boolean inTransaction, String nodeName) {
 
                boolean result = true;
-               boolean inTransaction = true;
-               Map<String, Resource> createdVfcs = new HashMap<>();
                List<ArtifactDefinition> nodeTypesNewCreatedArtifacts = new ArrayList<>();
-               Either<Boolean, ResponseFormat> lockResult = lockComponentByName(resource.getSystemName(), resource, "Create Resource");
-               if (lockResult.isRight()) {
-                       ResponseFormat responseFormat = lockResult.right().value();
-                       return Either.right(responseFormat);
-               }
-               log.debug("name is locked {} status = {}", resource.getSystemName(), lockResult);
 
+               if (shouldLock) {
+                       Either<Boolean, ResponseFormat> lockResult = lockComponentByName(resource.getSystemName(), resource, "Create Resource");
+                       if (lockResult.isRight()) {
+                               ResponseFormat responseFormat = lockResult.right().value();
+                               return Either.right(responseFormat);
+                       }
+                       log.debug("name is locked {} status = {}", resource.getSystemName(), lockResult);
+               }
                try {
                        log.trace("************* createResourceFromYaml before full create resource {}", yamlName);
                        Either<Resource, ResponseFormat> genericResourceEither = fetchAndSetDerivedFromGenericType(resource);
@@ -1299,7 +1511,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                                result = false;
                                return genericResourceEither;
                        }
-                       Either<Resource, ResponseFormat> createResourcesEither = createResourceTransaction(resource, user, isNormative, inTransaction);
+                       Either<Resource, ResponseFormat> createResourcesEither = createResourceTransaction(resource, csarInfo.getModifier(), isNormative, inTransaction);
                        log.trace("************* createResourceFromYaml after full create resource {}", yamlName);
                        if (createResourcesEither.isRight()) {
                                result = false;
@@ -1312,7 +1524,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                                generateInputsFromGenericTypeProperties(resource, genericResourceEither.left().value());
 
                        Map<String, InputDefinition> inputs = parsedToscaYamlInfo.getInputs();
-                       Either<Resource, ResponseFormat> createInputsOnResource = createInputsOnResource(resource, user, inputs, inTransaction);
+                       Either<Resource, ResponseFormat> createInputsOnResource = createInputsOnResource(resource, csarInfo.getModifier(), inputs, inTransaction);
                        if (createInputsOnResource.isRight()) {
                                result = false;
                                return createInputsOnResource;
@@ -1322,7 +1534,9 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
 
                        Map<String, UploadComponentInstanceInfo> uploadComponentInstanceInfoMap = parsedToscaYamlInfo.getInstances();
                        log.trace("************* Going to create nodes, RI's and Relations  from yaml {}", yamlName);
-                       createResourcesEither = createRIAndRelationsFromYaml(yamlName, resource, user, uploadComponentInstanceInfoMap, actionEnum, topologyTemplateYaml, csar, csarUUID, nodeTypesNewCreatedArtifacts, createdVfcs);
+
+                       createResourcesEither = createRIAndRelationsFromYaml(yamlName, resource, uploadComponentInstanceInfoMap, actionEnum, topologyTemplateYaml,
+                                       nodeTypesNewCreatedArtifacts, nodeTypesInfo, csarInfo, nodeTypesArtifactsToCreate, nodeName);
                        log.trace("************* Finished to create nodes, RI and Relation  from yaml {}", yamlName);
                        if (createResourcesEither.isRight()) {
                                result = false;
@@ -1345,7 +1559,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                        } else {
                                groups = parsedToscaYamlInfo.getGroups();
                        }
-                       Either<Resource, ResponseFormat> createGroupsOnResource = createGroupsOnResource(resource, user, groups);
+                       Either<Resource, ResponseFormat> createGroupsOnResource = createGroupsOnResource(resource, csarInfo.getModifier(), groups);
                        if (createGroupsOnResource.isRight()) {
                                result = false;
                                return createGroupsOnResource;
@@ -1354,43 +1568,54 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                        log.trace("************* Finished to add groups from yaml {}", yamlName);
 
                        log.trace("************* Going to add artifacts from yaml {}", yamlName);
-                       Either<Resource, ResponseFormat> createdCsarArtifactsEither = this.handleCsarArtifacts(resource, user, csarUUID, csar, createdArtifacts, artifactsBusinessLogic.new ArtifactOperationInfo(false, false, ArtifactOperationEnum.Create), false,
-                                       inTransaction);
-                       log.trace("************* Finished to add artifacts from yaml {}", yamlName);
-                       if (createdCsarArtifactsEither.isRight()) {
-                               result = false;
-                               return createdCsarArtifactsEither;
-                       }
 
-                       resource = createdCsarArtifactsEither.left().value();
+                       if(resource.getResourceType() == ResourceTypeEnum.CVFC){
+                               if(nodeTypesArtifactsToCreate.containsKey(nodeName) && nodeTypesArtifactsToCreate.get(nodeName) !=null && !nodeTypesArtifactsToCreate.get(nodeName).isEmpty()){
+                                       Either<List<ArtifactDefinition>, ResponseFormat> handleNodeTypeArtifactsRes = 
+                                                       handleNodeTypeArtifacts(resource, nodeTypesArtifactsToCreate.get(nodeName), nodeTypesNewCreatedArtifacts, csarInfo.getModifier(), true, false);
+                                       if(handleNodeTypeArtifactsRes.isRight()){
+                                               return Either.right(handleNodeTypeArtifactsRes.right().value());
+                                       }
+                               }
+                       } else {
+                               Either<Resource, ResponseFormat> createdCsarArtifactsEither = this.handleVfCsarArtifacts(resource, csarInfo, createdArtifacts, artifactsBusinessLogic.new ArtifactOperationInfo(false, false, ArtifactOperationEnum.Create), false,
+                                               inTransaction);
+                               log.trace("************* Finished to add artifacts from yaml {}", yamlName);
+                               if (createdCsarArtifactsEither.isRight()) {
+                                       result = false;
+                                       return createdCsarArtifactsEither;
+                               }
+                               resource = createdCsarArtifactsEither.left().value();
+                       }
                        ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.CREATED);
-                       componentsUtils.auditResource(responseFormat, user, resource, "", "", actionEnum, null);
+                       componentsUtils.auditResource(responseFormat, csarInfo.getModifier(), resource, "", "", actionEnum, null);
                        ASDCKpiApi.countCreatedResourcesKPI();
                        return Either.left(resource);
 
                } finally {
-                       if (!result) {
-                               log.warn("operation failed. do rollback");
-                               titanDao.rollback();
-                               if (!createdArtifacts.isEmpty() || !nodeTypesNewCreatedArtifacts.isEmpty()) {
-                                       createdArtifacts.addAll(nodeTypesNewCreatedArtifacts);
-                                       StorageOperationStatus deleteFromEsRes = artifactsBusinessLogic.deleteAllComponentArtifactsIfNotOnGraph(createdArtifacts);
-                                       if (!deleteFromEsRes.equals(StorageOperationStatus.OK)) {
-                                               ActionStatus actionStatus = componentsUtils.convertFromStorageResponse(deleteFromEsRes);
-                                               ResponseFormat responseFormat = componentsUtils.getResponseFormat(actionStatus, resource.getName());
+                       if (!inTransaction) {
+                               if (!result) {
+                                       log.warn("operation failed. do rollback");
+                                       titanDao.rollback();
+                                       if (!createdArtifacts.isEmpty() || !nodeTypesNewCreatedArtifacts.isEmpty()) {
+                                               createdArtifacts.addAll(nodeTypesNewCreatedArtifacts);
+                                               StorageOperationStatus deleteFromEsRes = artifactsBusinessLogic.deleteAllComponentArtifactsIfNotOnGraph(createdArtifacts);
+                                               if (!deleteFromEsRes.equals(StorageOperationStatus.OK)) {
+                                                       ActionStatus actionStatus = componentsUtils.convertFromStorageResponse(deleteFromEsRes);
+                                                       return Either.right(componentsUtils.getResponseFormat(actionStatus, resource.getName()));
+                                               }
+                                               log.debug("component and all its artifacts were deleted, id = {}", resource.getName());
                                        }
-                                       log.debug("component and all its artifacts were deleted, id = {}", resource.getName());
-                               }
 
-                       } else {
-                               log.debug("operation success. do commit");
-                               titanDao.commit();
+                               } else {
+                                       log.debug("operation success. do commit");
+                                       titanDao.commit();
+                               }
+                       }
+                       if (shouldLock) {
+                               graphLockOperation.unlockComponentByName(resource.getSystemName(), resource.getUniqueId(), NodeTypeEnum.Resource);
                        }
-
-                       graphLockOperation.unlockComponentByName(resource.getSystemName(), resource.getUniqueId(), NodeTypeEnum.Resource);
-
                }
-
        }
 
        private Either<Resource, ResponseFormat> createGroupsOnResource(Resource resource, User user, Map<String, GroupDefinition> groups) {
@@ -1432,7 +1657,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                        List<GroupDefinition> groupsToCreate = new ArrayList<GroupDefinition>();
                        if (groupsFromResource != null && !groupsFromResource.isEmpty()) {
                                for (GroupDefinition group : groupsAsList) {
-                                       Optional<GroupDefinition> op = groupsFromResource.stream().filter(p -> p.getName().equals(group.getName())).findAny();
+                                       Optional<GroupDefinition> op = groupsFromResource.stream().filter(p -> p.getName().equalsIgnoreCase(group.getName())).findAny();
                                        if (op.isPresent()) {
                                                GroupDefinition groupToUpdate = op.get();
                                                groupToUpdate.setMembers(group.getMembers());
@@ -1442,7 +1667,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                                        }
                                }
                                for (GroupDefinition group : groupsFromResource) {
-                                       Optional<GroupDefinition> op = groupsAsList.stream().filter(p -> p.getName().equals(group.getName())).findAny();
+                                       Optional<GroupDefinition> op = groupsAsList.stream().filter(p -> p.getName().equalsIgnoreCase(group.getName())).findAny();
                                        if (!op.isPresent() && (group.getArtifacts() == null || group.getArtifacts().isEmpty())) {
 
                                                groupsToDelete.add(group);
@@ -1450,7 +1675,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
 
                                }
                        } else
-                               groupsToCreate.addAll(groupsAsList);
+                       groupsToCreate.addAll(groupsAsList);
                        Either<List<GroupDefinition>, ResponseFormat> prepareGroups = null;
                        if (!groupsToCreate.isEmpty()) {
 
@@ -1492,11 +1717,12 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
        }
 
        private Either<Resource, ResponseFormat> createInputsOnResource(Resource resource, User user, Map<String, InputDefinition> inputs, boolean inTransaction) {
-               if (inputs != null && false == inputs.isEmpty()) {
+               List<InputDefinition> resourceProperties = resource.getInputs();
+               if ( (inputs != null && false == inputs.isEmpty()) || (resourceProperties != null && false == resourceProperties.isEmpty()) ) {
 
-                       Either<List<InputDefinition>, ResponseFormat> createGroups = inputsBusinessLogic.createInputsInGraph(inputs, resource, user, inTransaction);
-                       if (createGroups.isRight()) {
-                               return Either.right(createGroups.right().value());
+                       Either<List<InputDefinition>, ResponseFormat> createInputs = inputsBusinessLogic.createInputsInGraph(inputs, resource, user, inTransaction);
+                       if (createInputs.isRight()) {
+                               return Either.right(createInputs.right().value());
                        }
                } else {
                        return Either.left(resource);
@@ -1617,12 +1843,12 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                // Filtered Members Of Current Group containing only members which
                // are groups
                List<String> currGroupFilteredMembers = currGroupMembers.stream().
-                               // Keep Only Elements of type group and not Resource Instances
-                                               filter(innerGroupName -> allGroups.containsKey(innerGroupName)).
+               // Keep Only Elements of type group and not Resource Instances
+                               filter(innerGroupName -> allGroups.containsKey(innerGroupName)).
                                // Add Filtered Elements to main Set
-                                               peek(innerGroupName -> allGroupMembers.add(innerGroupName)).
+                               peek(innerGroupName -> allGroupMembers.add(innerGroupName)).
                                // Collect results
-                                               collect(Collectors.toList());
+                               collect(Collectors.toList());
 
                // Recursively call the method for all the filtered group members
                for (String innerGroupName : currGroupFilteredMembers) {
@@ -1648,35 +1874,33 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                if (!stop) {
                        final Set<String> allMembers = allGroups.get(groupName).getMembers().keySet();
                        Set<String> membersOfTypeGroup = allMembers.stream().
-                                       // Filter In Only Group members
-                                                       filter(innerGroupName -> allGroups.containsKey(innerGroupName)).
+                       // Filter In Only Group members
+                                       filter(innerGroupName -> allGroups.containsKey(innerGroupName)).
                                        // Collect
-                                                       collect(Collectors.toSet());
+                                       collect(Collectors.toSet());
                        stop = allGroupMembers.containsAll(membersOfTypeGroup);
                }
                return stop;
        }
 
-       private Either<Resource, ResponseFormat> createRIAndRelationsFromYaml(String yamlName, Resource resource, User user, Map<String, UploadComponentInstanceInfo> uploadComponentInstanceInfoMap, AuditingActionEnum actionEnum,
-                                                                                                                                                 String topologyTemplateYaml, Map<String, byte[]> csar, String csarUUID, List<ArtifactDefinition> nodeTypesNewCreatedArtifacts, Map<String, Resource> createdVfcs) {
+       private Either<Resource, ResponseFormat> createRIAndRelationsFromYaml(String yamlName, Resource resource, Map<String, UploadComponentInstanceInfo> uploadComponentInstanceInfoMap, AuditingActionEnum actionEnum,
+                                                                                                                                                 String topologyTemplateYaml, List<ArtifactDefinition> nodeTypesNewCreatedArtifacts,
+                                                                                                                                                 Map<String, NodeTypeInfo> nodeTypesInfo, CsarInfo csarInfo, Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>> nodeTypesArtifactsToCreate,
+                                                                                                                                                 String nodeName) {
 
                Either<Resource, ResponseFormat> result;
                Either<Resource, ResponseFormat> createResourcesInstancesEither;
 
-               Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>> nodeTypesArtifactsToCreate = findNodeTypeArtifactsToCreate(csar, yamlName, resource, uploadComponentInstanceInfoMap);
-
                log.debug("************* Going to create all nodes {}", yamlName);
-               Either<Map<String, Resource>, ResponseFormat> createdResourcesFromdNodeTypeMap = this.handleNodeTypes(yamlName, resource, user, topologyTemplateYaml, csar, false, nodeTypesArtifactsToCreate, nodeTypesNewCreatedArtifacts);
+               Either<Map<String, Resource>, ResponseFormat> createdResourcesFromdNodeTypeMap = this.handleNodeTypes(yamlName, resource, topologyTemplateYaml, false, nodeTypesArtifactsToCreate, nodeTypesNewCreatedArtifacts, nodeTypesInfo, csarInfo, nodeName);
                log.debug("************* Finished to create all nodes {}", yamlName);
                if (createdResourcesFromdNodeTypeMap.isRight()) {
                        log.debug("failed to resources from node types status is {}", createdResourcesFromdNodeTypeMap.right().value());
                        return Either.right(createdResourcesFromdNodeTypeMap.right().value());
                }
 
-               createdVfcs.putAll(createdResourcesFromdNodeTypeMap.left().value());
-
                log.debug("************* Going to create all resource instances {}", yamlName);
-               createResourcesInstancesEither = createResourceInstances(user, yamlName, resource, uploadComponentInstanceInfoMap, true, false, createdResourcesFromdNodeTypeMap.left().value());
+               createResourcesInstancesEither = createResourceInstances(csarInfo.getModifier(), yamlName, resource, uploadComponentInstanceInfoMap, true, false, csarInfo.getCreatedNodes());
 
                log.debug("************* Finished to create all resource instances {}", yamlName);
                if (createResourcesInstancesEither.isRight()) {
@@ -1686,7 +1910,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                }
                resource = createResourcesInstancesEither.left().value();
                log.debug("************* Going to create all relations {}", yamlName);
-               createResourcesInstancesEither = createResourceInstancesRelations(user, yamlName, resource, uploadComponentInstanceInfoMap, true, false);
+               createResourcesInstancesEither = createResourceInstancesRelations(csarInfo.getModifier(), yamlName, resource, uploadComponentInstanceInfoMap);
 
                log.debug("************* Finished to create all relations {}", yamlName);
 
@@ -1699,48 +1923,13 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                }
 
                log.debug("************* Going to create positions {}", yamlName);
-               Either<List<ComponentInstance>, ResponseFormat> eitherSetPosition = compositionBusinessLogic.setPositionsForComponentInstances(resource, user.getUserId());
+               Either<List<ComponentInstance>, ResponseFormat> eitherSetPosition = compositionBusinessLogic.setPositionsForComponentInstances(resource, csarInfo.getModifier().getUserId());
                log.debug("************* Finished to set positions {}", yamlName);
                result = eitherSetPosition.isRight() ? Either.right(eitherSetPosition.right().value()) : Either.left(resource);
 
                return result;
        }
 
-       private Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>> findNodeTypeArtifactsToCreate(Map<String, byte[]> csar, String yamlName, Resource resource, Map<String, UploadComponentInstanceInfo> uploadComponentInstanceInfoMap) {
-
-               Map<String, List<ArtifactDefinition>> extractedVfcsArtifacts = CsarUtils.extractVfcsArtifactsFromCsar(csar);
-               List<ImmutablePair<ImmutablePair<String, List<String>>, String>> extractedVfcToscaNames = extractVfcToscaNames(csar, yamlName, resource.getSystemName(), uploadComponentInstanceInfoMap);
-               validateNodeTypeIdentifiers(extractedVfcsArtifacts, extractedVfcToscaNames);
-               Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>> nodeTypesArtifactsToHandle = null;
-               if (!extractedVfcsArtifacts.isEmpty() && !extractedVfcToscaNames.isEmpty()) {
-                       for (ImmutablePair<ImmutablePair<String, List<String>>, String> currToscaNamePair : extractedVfcToscaNames) {
-                               EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>> curNodeTypeArtifacts = null;
-                               String currVfcToscaNamespace = currToscaNamePair.getKey().getKey();
-                               List<String> relatedVfcs = currToscaNamePair.getKey().getValue();
-                               List<ArtifactDefinition> currArtifactList = null;
-
-                               for (String currSubstitute : relatedVfcs) {
-                                       if (extractedVfcsArtifacts.containsKey(currSubstitute)) {
-                                               if (MapUtils.isEmpty(curNodeTypeArtifacts)) {
-                                                       curNodeTypeArtifacts = new EnumMap<>(ArtifactOperationEnum.class);
-                                                       currArtifactList = new ArrayList<>();
-                                                       curNodeTypeArtifacts.put(ArtifactOperationEnum.Create, currArtifactList);
-                                               } else {
-                                                       currArtifactList = curNodeTypeArtifacts.get(ArtifactOperationEnum.Create);
-                                               }
-                                               handleAndAddExtractedVfcsArtifacts(currArtifactList, extractedVfcsArtifacts.get(currSubstitute));
-                                       }
-                               }
-
-                               if (nodeTypesArtifactsToHandle == null) {
-                                       nodeTypesArtifactsToHandle = new HashMap<>();
-                               }
-                               nodeTypesArtifactsToHandle.put(currVfcToscaNamespace, curNodeTypeArtifacts);
-                       }
-               }
-               return nodeTypesArtifactsToHandle;
-       }
-
        private void handleAndAddExtractedVfcsArtifacts(List<ArtifactDefinition> vfcArtifacts, List<ArtifactDefinition> artifactsToAdd) {
                List<String> vfcArtifactNames = vfcArtifacts.stream().map(a -> a.getArtifactName()).collect(Collectors.toList());
                artifactsToAdd.stream().forEach(a -> {
@@ -1753,47 +1942,51 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
 
        }
 
-       private Either<Map<String, Resource>, ResponseFormat> handleNodeTypes(String yamlName, Resource resource, User user, String topologyTemplateYaml, Map<String, byte[]> csar, boolean needLock,
-                                                                                                                                                 Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>> nodeTypesArtifactsToHandle, List<ArtifactDefinition> nodeTypesNewCreatedArtifacts) {
-
-               Map<String, Resource> createdResourcesFromdNodeTypeMap = new HashMap<>();
-               Either<Map<String, Resource>, ResponseFormat> result = Either.left(createdResourcesFromdNodeTypeMap);
+       @SuppressWarnings("unchecked")
+       private Either<Map<String, Resource>, ResponseFormat> handleNodeTypes(String yamlName, Resource resource, String topologyTemplateYaml, boolean needLock,
+                                                                                                                                                Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>> nodeTypesArtifactsToHandle, List<ArtifactDefinition> nodeTypesNewCreatedArtifacts,
+                                                                                                                                                 Map<String, NodeTypeInfo> nodeTypesInfo, CsarInfo csarInfo, String nodeName) {
 
-               String yamlFileName = Constants.GLOBAL_SUBSTITUTION_TYPES_SERVICE_TEMPLATE;
+               Either<Map<String, Resource>, ResponseFormat> result = Either.left(csarInfo.getCreatedNodes());
+               for (Entry<String, NodeTypeInfo> nodeTypeEntry : nodeTypesInfo.entrySet()) {
+                       if (nodeTypeEntry.getValue().isNested()) {
 
-               if (csar != null && csar.containsKey(yamlFileName)) {
-                       byte[] yamlFileBytes = csar.get(yamlFileName);
-                       String globalTypesYaml = new String(yamlFileBytes, StandardCharsets.UTF_8);
-                       Either<Map<String, Resource>, ResponseFormat> createdNodeTypesFromGlobalTypesTemplateEither = this.createResourcesFromYamlNodeTypesList(yamlFileName, resource, globalTypesYaml, user, needLock, nodeTypesArtifactsToHandle,
-                                       nodeTypesNewCreatedArtifacts);
-                       if (createdNodeTypesFromGlobalTypesTemplateEither.isRight()) {
-                               ResponseFormat responseFormat = createdNodeTypesFromGlobalTypesTemplateEither.right().value();
-                               componentsUtils.auditResource(responseFormat, user, resource, "", "", AuditingActionEnum.IMPORT_RESOURCE, null);
-                               return Either.right(responseFormat);
+                               Either<Resource, ResponseFormat> createResourceFromYaml = handleNestedVfc(resource, nodeTypesArtifactsToHandle, 
+                                               nodeTypesNewCreatedArtifacts, nodeTypesInfo, csarInfo, nodeTypeEntry.getKey());
+                               log.trace("************* finished to create node {}", nodeTypeEntry.getKey());
+                               if (createResourceFromYaml.isRight()) {
+                                       return Either.right(createResourceFromYaml.right().value());
+                               }
                        }
-                       createdResourcesFromdNodeTypeMap.putAll(createdNodeTypesFromGlobalTypesTemplateEither.left().value());
                }
-
-               Either<Map<String, Resource>, ResponseFormat> createdNodeTypeFromMainTemplateEither = createResourcesFromYamlNodeTypesList(yamlName, resource, topologyTemplateYaml, user, needLock, nodeTypesArtifactsToHandle, nodeTypesNewCreatedArtifacts);
+       
+               Map<String, Object> mappedToscaTemplate = null;
+               if(StringUtils.isNotEmpty(nodeName) && MapUtils.isNotEmpty(nodeTypesInfo) && nodeTypesInfo.containsKey(nodeName)){
+                       mappedToscaTemplate = nodeTypesInfo.get(nodeName).getMappedToscaTemplate();
+               }
+               if(MapUtils.isEmpty(mappedToscaTemplate)){
+                       mappedToscaTemplate = (Map<String, Object>) new Yaml().load(topologyTemplateYaml);
+               }
+               
+               Either<Map<String, Resource>, ResponseFormat> createdNodeTypeFromMainTemplateEither = createResourcesFromYamlNodeTypesList(yamlName, resource, mappedToscaTemplate, needLock, nodeTypesArtifactsToHandle, 
+                               nodeTypesNewCreatedArtifacts, nodeTypesInfo, csarInfo);
                if (createdNodeTypeFromMainTemplateEither.isRight()) {
                        ResponseFormat responseFormat = createdNodeTypeFromMainTemplateEither.right().value();
-                       componentsUtils.auditResource(responseFormat, user, resource, "", "", AuditingActionEnum.IMPORT_RESOURCE, null);
+                       componentsUtils.auditResource(responseFormat, csarInfo.getModifier(), resource, "", "", AuditingActionEnum.IMPORT_RESOURCE, null);
                        return Either.right(responseFormat);
                }
 
-               createdResourcesFromdNodeTypeMap.putAll(createdNodeTypeFromMainTemplateEither.left().value());
-
                // add the created node types to the cache although they are not in the
                // graph.
-               createdResourcesFromdNodeTypeMap.values().stream().forEach(p -> cacheManagerOperation.storeComponentInCache(p, NodeTypeEnum.Resource));
+               csarInfo.getCreatedNodes().values().stream().forEach(p -> cacheManagerOperation.storeComponentInCache(p, NodeTypeEnum.Resource));
 
                return result;
        }
 
-       private Either<Resource, ResponseFormat> handleCsarArtifacts(Resource resource, User user, String csarUUID, Map<String, byte[]> csar, List<ArtifactDefinition> createdArtifacts, ArtifactOperationInfo artifactOperation, boolean shouldLock,
-                                                                                                                                boolean inTransaction) {
+       private Either<Resource, ResponseFormat> handleVfCsarArtifacts(Resource resource, CsarInfo csarInfo, List<ArtifactDefinition> createdArtifacts, ArtifactOperationInfo artifactOperation, boolean shouldLock,
+                       boolean inTransaction) {
 
-               if (csar != null) {
+               if (csarInfo.getCsar() != null) {
                        String vendorLicenseModelId = null;
                        String vfLicenseModelId = null;
 
@@ -1810,26 +2003,34 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
 
                        }
                        // Specific Behavior for license artifacts
-                       createOrUpdateSingleNonMetaArtifact(resource, user, csarUUID, csar, CsarUtils.ARTIFACTS_PATH + Constants.VENDOR_LICENSE_MODEL, Constants.VENDOR_LICENSE_MODEL, ArtifactTypeEnum.VENDOR_LICENSE.getType(), ArtifactGroupTypeEnum.DEPLOYMENT,
+                       createOrUpdateSingleNonMetaArtifact(resource, csarInfo, CsarUtils.ARTIFACTS_PATH + Constants.VENDOR_LICENSE_MODEL, Constants.VENDOR_LICENSE_MODEL, ArtifactTypeEnum.VENDOR_LICENSE.getType(), ArtifactGroupTypeEnum.DEPLOYMENT,
                                        Constants.VENDOR_LICENSE_LABEL, Constants.VENDOR_LICENSE_DISPLAY_NAME, Constants.VENDOR_LICENSE_DESCRIPTION, vendorLicenseModelId, artifactOperation, null, shouldLock, inTransaction);
-                       createOrUpdateSingleNonMetaArtifact(resource, user, csarUUID, csar, CsarUtils.ARTIFACTS_PATH + Constants.VF_LICENSE_MODEL, Constants.VF_LICENSE_MODEL, ArtifactTypeEnum.VF_LICENSE.getType(), ArtifactGroupTypeEnum.DEPLOYMENT,
+                       createOrUpdateSingleNonMetaArtifact(resource, csarInfo, CsarUtils.ARTIFACTS_PATH + Constants.VF_LICENSE_MODEL, Constants.VF_LICENSE_MODEL, ArtifactTypeEnum.VF_LICENSE.getType(), ArtifactGroupTypeEnum.DEPLOYMENT,
                                        Constants.VF_LICENSE_LABEL, Constants.VF_LICENSE_DISPLAY_NAME, Constants.VF_LICENSE_DESCRIPTION, vfLicenseModelId, artifactOperation, null, shouldLock, inTransaction);
 
-                       Either<Resource, ResponseFormat> eitherCreateResult = createOrUpdateNonMetaArtifacts(csarUUID, csar, resource, user, createdArtifacts, shouldLock, inTransaction, artifactOperation);
+                       Either<Resource, ResponseFormat> eitherCreateResult = createOrUpdateNonMetaArtifacts(csarInfo, resource, createdArtifacts, shouldLock, inTransaction, artifactOperation);
                        if (eitherCreateResult.isRight()) {
                                return Either.right(eitherCreateResult.right().value());
                        }
+                       Either<Resource, StorageOperationStatus> eitherGerResource = toscaOperationFacade.getToscaElement(resource.getUniqueId());
+                       if (eitherGerResource.isRight()) {
+                               ResponseFormat responseFormat = componentsUtils.getResponseFormatByResource(componentsUtils.convertFromStorageResponse(eitherGerResource.right().value()), resource);
+
+                               return Either.right(responseFormat);
 
-                       Either<ImmutablePair<String, String>, ResponseFormat> artifacsMetaCsarStatus = CsarValidationUtils.getArtifactsMeta(csar, csarUUID, componentsUtils);
+                       }
+                       resource = eitherGerResource.left().value();
+
+                       Either<ImmutablePair<String, String>, ResponseFormat> artifacsMetaCsarStatus = CsarValidationUtils.getArtifactsMeta(csarInfo.getCsar(), csarInfo.getCsarUUID(), componentsUtils);
                        if (artifacsMetaCsarStatus.isLeft()) {
 
                                String artifactsFileName = artifacsMetaCsarStatus.left().value().getKey();
                                String artifactsContents = artifacsMetaCsarStatus.left().value().getValue();
                                Either<Resource, ResponseFormat> createArtifactsFromCsar = Either.left(resource);
-                               if (artifactOperation.getArtifactOperationEnum() == ArtifactOperationEnum.Create)
-                                       createArtifactsFromCsar = createResourceArtifactsFromCsar(csarUUID, csar, resource, user, artifactsContents, artifactsFileName, createdArtifacts, shouldLock, inTransaction);
+                               if (ArtifactOperationEnum.isCreateOrLink(artifactOperation.getArtifactOperationEnum()))
+                                       createArtifactsFromCsar = createResourceArtifactsFromCsar(csarInfo, resource, artifactsContents, artifactsFileName, createdArtifacts, shouldLock, inTransaction);
                                else
-                                       createArtifactsFromCsar = updateResourceArtifactsFromCsar(csarUUID, csar, resource, user, artifactsContents, artifactsFileName, createdArtifacts, shouldLock, inTransaction);
+                                       createArtifactsFromCsar = updateResourceArtifactsFromCsar(csarInfo, resource, artifactsContents, artifactsFileName, createdArtifacts, shouldLock, inTransaction);
                                if (createArtifactsFromCsar.isRight()) {
                                        log.debug("Couldn't create artifacts from artifacts.meta");
                                        return Either.right(createArtifactsFromCsar.right().value());
@@ -1848,7 +2049,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                                         * Either.right(componentsUtils.getResponseFormat(actionStatus)); } } }
                                         */
                                        for (String artifactId : artifactsToDelete) {
-                                               Either<Either<ArtifactDefinition, Operation>, ResponseFormat> handleDelete = artifactsBusinessLogic.handleDelete(resource.getUniqueId(), artifactId, user, AuditingActionEnum.ARTIFACT_DELETE, ComponentTypeEnum.RESOURCE,
+                                               Either<Either<ArtifactDefinition, Operation>, ResponseFormat> handleDelete = artifactsBusinessLogic.handleDelete(resource.getUniqueId(), artifactId, csarInfo.getModifier(), AuditingActionEnum.ARTIFACT_DELETE, ComponentTypeEnum.RESOURCE,
                                                                resource, null, null, shouldLock, inTransaction);
                                                if (handleDelete.isRight()) {
                                                        log.debug("Couldn't delete  artifact {}", artifactId);
@@ -1869,18 +2070,18 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                return Either.left(resource);
        }
 
-       private Either<Boolean, ResponseFormat> createOrUpdateSingleNonMetaArtifact(Resource resource, User user, String csarUUID, Map<String, byte[]> csar, String artifactPath, String artifactFileName, String artifactType,
-                                                                                                                                                               ArtifactGroupTypeEnum artifactGroupType, String artifactLabel, String artifactDisplayName, String artifactDescription, String artifactId, ArtifactOperationInfo operation, List<ArtifactDefinition> createdArtifacts, boolean shouldLock,
-                                                                                                                                                               boolean inTransaction) {
+       private Either<Boolean, ResponseFormat> createOrUpdateSingleNonMetaArtifact(Resource resource, CsarInfo csarInfo, String artifactPath, String artifactFileName, String artifactType,
+                       ArtifactGroupTypeEnum artifactGroupType, String artifactLabel, String artifactDisplayName, String artifactDescription, String artifactId, ArtifactOperationInfo operation, List<ArtifactDefinition> createdArtifacts, boolean shouldLock,
+                       boolean inTransaction) {
                byte[] artifactFileBytes = null;
 
-               if (csar.containsKey(artifactPath)) {
-                       artifactFileBytes = csar.get(artifactPath);
+               if (csarInfo.getCsar().containsKey(artifactPath)) {
+                       artifactFileBytes = csarInfo.getCsar().get(artifactPath);
                }
                Either<Boolean, ResponseFormat> result = Either.left(true);
                if (operation.getArtifactOperationEnum() == ArtifactOperationEnum.Update || operation.getArtifactOperationEnum() == ArtifactOperationEnum.Delete) {
                        if (artifactId != null && !artifactId.isEmpty() && artifactFileBytes == null) {
-                               Either<Either<ArtifactDefinition, Operation>, ResponseFormat> handleDelete = artifactsBusinessLogic.handleDelete(resource.getUniqueId(), artifactId, user, AuditingActionEnum.ARTIFACT_DELETE, ComponentTypeEnum.RESOURCE, resource, null,
+                               Either<Either<ArtifactDefinition, Operation>, ResponseFormat> handleDelete = artifactsBusinessLogic.handleDelete(resource.getUniqueId(), artifactId, csarInfo.getModifier(), AuditingActionEnum.ARTIFACT_DELETE, ComponentTypeEnum.RESOURCE, resource, null,
                                                null, shouldLock, inTransaction);
                                if (handleDelete.isRight()) {
                                        result = Either.right(handleDelete.right().value());
@@ -1895,10 +2096,10 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                }
                if (artifactFileBytes != null) {
                        Map<String, Object> vendorLicenseModelJson = buildJsonForUpdateArtifact(artifactId, artifactFileName, artifactType, artifactGroupType, artifactLabel, artifactDisplayName, artifactDescription, artifactFileBytes, null);
-                       Either<Either<ArtifactDefinition, Operation>, ResponseFormat> eitherNonMetaArtifacts = createOrUpdateCsarArtifactFromJson(resource, user, vendorLicenseModelJson, operation, shouldLock, inTransaction);
+                       Either<Either<ArtifactDefinition, Operation>, ResponseFormat> eitherNonMetaArtifacts = createOrUpdateCsarArtifactFromJson(resource, csarInfo.getModifier(), vendorLicenseModelJson, operation, shouldLock, inTransaction);
                        addNonMetaCreatedArtifactsToSupportRollback(operation, createdArtifacts, eitherNonMetaArtifacts);
                        if (eitherNonMetaArtifacts.isRight()) {
-                               BeEcompErrorManager.getInstance().logInternalFlowError("UploadLicenseArtifact", "Failed to upload license artifact: " + artifactFileName + "With csar uuid: " + csarUUID, ErrorSeverity.WARNING);
+                               BeEcompErrorManager.getInstance().logInternalFlowError("UploadLicenseArtifact", "Failed to upload license artifact: " + artifactFileName + "With csar uuid: " + csarInfo.getCsarUUID(), ErrorSeverity.WARNING);
                                return Either.right(eitherNonMetaArtifacts.right().value());
                        }
                }
@@ -1906,7 +2107,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
        }
 
        private void addNonMetaCreatedArtifactsToSupportRollback(ArtifactOperationInfo operation, List<ArtifactDefinition> createdArtifacts, Either<Either<ArtifactDefinition, Operation>, ResponseFormat> eitherNonMetaArtifacts) {
-               if (operation.getArtifactOperationEnum() == ArtifactOperationEnum.Create && createdArtifacts != null && eitherNonMetaArtifacts.isLeft()) {
+               if (ArtifactOperationEnum.isCreateOrLink(operation.getArtifactOperationEnum()) && createdArtifacts != null && eitherNonMetaArtifacts.isLeft()) {
                        Either<ArtifactDefinition, Operation> eitherResult = eitherNonMetaArtifacts.left().value();
                        if (eitherResult.isLeft()) {
                                createdArtifacts.add(eitherResult.left().value());
@@ -1918,7 +2119,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
 
                String jsonStr = gson.toJson(json);
 
-               String origMd5 = GeneralUtility.calculateMD5ByString(jsonStr);
+               String origMd5 = GeneralUtility.calculateMD5Base64EncodedByString(jsonStr);
                ArtifactDefinition artifactDefinitionFromJson = RepresentationUtils.convertJsonToArtifactDefinition(jsonStr, ArtifactDefinition.class);
                String artifactUniqueId = artifactDefinitionFromJson == null ? null : artifactDefinitionFromJson.getUniqueId();
                Either<Either<ArtifactDefinition, Operation>, ResponseFormat> uploadArtifactToService = artifactsBusinessLogic.validateAndHandleArtifact(resource.getUniqueId(), ComponentTypeEnum.RESOURCE, operation, artifactUniqueId,
@@ -1929,13 +2130,13 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                return Either.left(uploadArtifactToService.left().value());
        }
 
-       public Either<Resource, ResponseFormat> updateResourceArtifactsFromCsar(String csarUUID, Map<String, byte[]> csar, Resource resource, User user, String artifactsMetaFile, String artifactsMetaFileName, List<ArtifactDefinition> createdNewArtifacts,
-                                                                                                                                                       boolean shouldLock, boolean inTransaction) {
+       public Either<Resource, ResponseFormat> updateResourceArtifactsFromCsar(CsarInfo csarInfo, Resource resource, String artifactsMetaFile, String artifactsMetaFileName, List<ArtifactDefinition> createdNewArtifacts,
+                       boolean shouldLock, boolean inTransaction) {
 
-               Either<Map<String, List<ArtifactTemplateInfo>>, ResponseFormat> parseResourceInfoFromYamlEither = parseResourceArtifactsInfoFromFile(resource, artifactsMetaFile, artifactsMetaFileName, user);
+               Either<Map<String, List<ArtifactTemplateInfo>>, ResponseFormat> parseResourceInfoFromYamlEither = parseResourceArtifactsInfoFromFile(resource, artifactsMetaFile, artifactsMetaFileName, csarInfo.getModifier());
                if (parseResourceInfoFromYamlEither.isRight()) {
                        ResponseFormat responseFormat = parseResourceInfoFromYamlEither.right().value();
-                       componentsUtils.auditResource(responseFormat, user, resource, "", "", AuditingActionEnum.IMPORT_RESOURCE, null);
+                       componentsUtils.auditResource(responseFormat, csarInfo.getModifier(), resource, "", "", AuditingActionEnum.IMPORT_RESOURCE, null);
                        return Either.right(responseFormat);
                }
 
@@ -1959,7 +2160,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                                        }
                                }
                        }
-                       return createResourceArtifacts(csarUUID, csar, resource, user, parseResourceInfoFromYamlEither.left().value(), AuditingActionEnum.CREATE_RESOURCE, createdNewArtifacts, shouldLock, inTransaction);
+                       return createResourceArtifacts(csarInfo, resource, parseResourceInfoFromYamlEither.left().value(), AuditingActionEnum.CREATE_RESOURCE, createdNewArtifacts, shouldLock, inTransaction);
                }
 
                // find master in group
@@ -1972,16 +2173,27 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                Map<ArtifactTemplateInfo, Set<ArtifactTemplateInfo>> parsedGroup = new HashMap<ArtifactTemplateInfo, Set<ArtifactTemplateInfo>>();
 
                for (List<ArtifactTemplateInfo> parsedGroupTemplateList : parsedArifactsCollection) {
+                       
                        for (ArtifactTemplateInfo parsedGroupTemplate : parsedGroupTemplateList) {
-                               parsedGroupTemplate.setGroupName("");
-                               Set<ArtifactTemplateInfo> parsedArtifactsNames = new HashSet<ArtifactTemplateInfo>();
-                               parsedArtifactsNames.add(parsedGroupTemplate);
-                               List<ArtifactTemplateInfo> relatedGroupTemplateList = parsedGroupTemplate.getRelatedArtifactsInfo();
-                               if (relatedGroupTemplateList != null && !relatedGroupTemplateList.isEmpty()) {
-                                       createArtifactsGroupSet(parsedGroupTemplateList, parsedArtifactsNames);
+                               if(parsedGroupTemplate.getGroupName() != null){
+                                       parsedGroupTemplate.setGroupName("");
+                                       Set<ArtifactTemplateInfo> parsedArtifactsNames = new HashSet<ArtifactTemplateInfo>();
+                                       parsedArtifactsNames.add(parsedGroupTemplate);
+                                       List<ArtifactTemplateInfo> relatedGroupTemplateList = parsedGroupTemplate.getRelatedArtifactsInfo();
+                                       if (relatedGroupTemplateList != null && !relatedGroupTemplateList.isEmpty()) {
+                                               createArtifactsGroupSet(parsedGroupTemplateList, parsedArtifactsNames);
+                                       }
+                                       parsedGroup.put(parsedGroupTemplate, parsedArtifactsNames);
+                               }else{
+                                       List<ArtifactTemplateInfo> arrtifacts = new ArrayList<ArtifactTemplateInfo>();
+                                       arrtifacts.add(parsedGroupTemplate);
+                                       Either<Resource, ResponseFormat> resStatus = createGroupDeploymentArtifactsFromCsar(csarInfo, resource, arrtifacts, createdNewArtifacts, createdDeplymentArtifactsAfterDelete, labelCounter, shouldLock, inTransaction);
+                                       if (resStatus.isRight())
+                                               return resStatus;
+                               
                                }
-                               parsedGroup.put(parsedGroupTemplate, parsedArtifactsNames);
                        }
+                       
                }
 
                ///////////////////////////////// find artifacts to
@@ -1989,13 +2201,12 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
 
                Set<ArtifactDefinition> artifactsToDelete = new HashSet<ArtifactDefinition>();
                Map<String, List<ArtifactDefinition>> groupToDelete = new HashMap<String, List<ArtifactDefinition>>();
-               Map<String, List<String>> dissocArtifactFromGroup = new HashMap<String, List<String>>();
 
                Set<ArtifactTemplateInfo> jsonMasterArtifacts = parsedGroup.keySet();
                Map<GroupDefinition, MergedArtifactInfo> mergedgroup = mergeGroupInUpdateFlow(groupArtifact, parsedGroup, artifactsToDelete, groupToDelete, jsonMasterArtifacts, createdDeplymentArtifactsAfterDelete);
 
                // Set<String> deletedArtifactsName = new HashSet<String>();
-               Either<List<ArtifactDefinition>, ResponseFormat> deletedArtifactsEither = deleteArtifactsInUpdateCsarFlow(resource, user, shouldLock, inTransaction, artifactsToDelete, groupToDelete);
+               Either<List<ArtifactDefinition>, ResponseFormat> deletedArtifactsEither = deleteArtifactsInUpdateCsarFlow(resource, csarInfo.getModifier(), shouldLock, inTransaction, artifactsToDelete, groupToDelete);
                if (deletedArtifactsEither.isRight()) {
                        log.debug("Failed to delete artifacts. Status is {} ", deletedArtifactsEither.right().value());
 
@@ -2022,8 +2233,8 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
 
                ////////////// dissociate, associate or create
                ////////////// artifacts////////////////////////////
-               Either<Resource, ResponseFormat> assDissotiateEither = associateAndDissociateArtifactsToGroup(csarUUID, csar, resource, user, createdNewArtifacts, labelCounter, shouldLock, inTransaction, createdDeplymentArtifactsAfterDelete,
-                                mergedgroup, deletedArtifacts);
+               Either<Resource, ResponseFormat> assDissotiateEither = associateAndDissociateArtifactsToGroup(csarInfo, resource, createdNewArtifacts, labelCounter, shouldLock, inTransaction, createdDeplymentArtifactsAfterDelete,
+                               mergedgroup, deletedArtifacts);
 
                if (assDissotiateEither.isRight()) {
                        log.debug("Failed to delete artifacts. Status is {} ", assDissotiateEither.right().value());
@@ -2041,7 +2252,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                }
 
                groups = resource.getGroups();
-               List<GroupDefinition> groupToUpdate = new ArrayList<>();
+
                // update vfModule names
                Set<GroupDefinition> groupForAssociateWithMembers = mergedgroup.keySet();
                if (groups != null && !groups.isEmpty()) {
@@ -2055,30 +2266,22 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                        ;
 
                        for (GroupDefinition updatedGroupDef : groupForAssociateWithMembers) {
-                               GroupDefinition group = null;
-                               Optional<GroupDefinition> opGr = groups.stream().filter(p -> p.getUniqueId().equals(updatedGroupDef.getUniqueId())).findAny();
-                               if (opGr.isPresent()) {
-                                       group = opGr.get();
-                                       groupToUpdate.add(group);
-                               }
-                               if (group != null) {
-                                       Map<String, String> members = new HashMap<String, String>();
-                                       Set<String> artifactsGroup = new HashSet<String>();
-                                       artifactsGroup.addAll(group.getArtifacts());
-                                       associateMembersToArtifacts(createdNewArtifacts, createdDeplymentArtifactsAfterDelete, heatGroups, artifactsGroup, members);
-                                       if (!members.isEmpty()) {
-                                               group.setMembers(members);
 
-                                       }
+                               if (updatedGroupDef.getMembers() != null && !updatedGroupDef.getMembers().isEmpty()) {
+                                       updatedGroupDef.getMembers().clear();
                                }
+                               Map<String, String> members = new HashMap<String, String>();
+                               Set<String> artifactsGroup = new HashSet<String>();
+                               artifactsGroup.addAll(updatedGroupDef.getArtifacts());
+                               associateMembersToArtifacts(createdNewArtifacts, createdDeplymentArtifactsAfterDelete, heatGroups, artifactsGroup, members);
+                               if (!members.isEmpty()) {
+                                       updatedGroupDef.setMembers(members);
+
+                               }
+
 
                        }
-                       /*
-                        * if (!groupToUpdate.isEmpty()) { Either<List<GroupDefinition>, ResponseFormat> assotiateGroupEither = groupBusinessLogic.associateMembersToGroup(resource.getUniqueId(), user.getUserId(), ComponentTypeEnum.RESOURCE, groupToUpdate, false,
-                        * true); if (assotiateGroupEither.isRight()) { log.debug("Failed to associate artifacts to groups. Status is {} ", assotiateGroupEither.right().value()); return Either.right(assotiateGroupEither.right().value());
-                        *
-                        * } }
-                        */
+
 
                }
 
@@ -2110,7 +2313,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                        if (validateGroupNamesRes.isRight()) {
                                return Either.right(validateGroupNamesRes.right().value());
                        }
-                       Either<Resource, ResponseFormat> resStatus = createGroupDeploymentArtifactsFromCsar(csarUUID, csar, resource, user, newArtifactsGroup, createdNewArtifacts, createdDeplymentArtifactsAfterDelete, labelCounter, shouldLock, inTransaction);
+                       Either<Resource, ResponseFormat> resStatus = createGroupDeploymentArtifactsFromCsar(csarInfo, resource, newArtifactsGroup, createdNewArtifacts, createdDeplymentArtifactsAfterDelete, labelCounter, shouldLock, inTransaction);
                        if (resStatus.isRight())
                                return resStatus;
                }
@@ -2141,7 +2344,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
        }
 
        private Either<List<ArtifactDefinition>, ResponseFormat> deleteArtifactsInUpdateCsarFlow(Resource resource, User user, boolean shouldLock, boolean inTransaction, Set<ArtifactDefinition> artifactsToDelete,
-                                                                                                                                                                                        Map<String, List<ArtifactDefinition>> groupToDelete) {
+                       Map<String, List<ArtifactDefinition>> groupToDelete) {
                List<ArtifactDefinition> deletedArtifacts = new ArrayList<ArtifactDefinition>();
                String resourceId = resource.getUniqueId();
                if (!artifactsToDelete.isEmpty()) {
@@ -2158,9 +2361,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                                         * deletedArtifacts.add(removeArifactFromGraph.left().value());
                                         */
 
-                               }
-
-                               else {
+                               } else {
                                        Either<Either<ArtifactDefinition, Operation>, ResponseFormat> handleDelete = artifactsBusinessLogic.handleDelete(resourceId, artifact.getUniqueId(), user, AuditingActionEnum.ARTIFACT_DELETE, ComponentTypeEnum.RESOURCE, resource,
                                                        null, null, shouldLock, inTransaction);
                                        if (handleDelete.isRight()) {
@@ -2193,8 +2394,8 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                return Either.left(deletedArtifacts);
        }
 
-       private Either<Resource, ResponseFormat> associateAndDissociateArtifactsToGroup(String csarUUID, Map<String, byte[]> csar, Resource resource, User user, List<ArtifactDefinition> createdNewArtifacts, int labelCounter, boolean shouldLock,
-                                                                                                                                                                       boolean inTransaction, List<ArtifactDefinition> createdDeplymentArtifactsAfterDelete, Map<GroupDefinition, MergedArtifactInfo> mergedgroup, List<ArtifactDefinition> deletedArtifacts) {
+       private Either<Resource, ResponseFormat> associateAndDissociateArtifactsToGroup(CsarInfo csarInfo, Resource resource, List<ArtifactDefinition> createdNewArtifacts, int labelCounter, boolean shouldLock,
+                       boolean inTransaction, List<ArtifactDefinition> createdDeplymentArtifactsAfterDelete, Map<GroupDefinition, MergedArtifactInfo> mergedgroup, List<ArtifactDefinition> deletedArtifacts) {
                Map<GroupDefinition, List<ArtifactTemplateInfo>> artifactsToAssotiate = new HashMap<GroupDefinition, List<ArtifactTemplateInfo>>();
                Map<GroupDefinition, List<ImmutablePair<ArtifactDefinition, ArtifactTemplateInfo>>> artifactsToUpdateMap = new HashMap<GroupDefinition, List<ImmutablePair<ArtifactDefinition, ArtifactTemplateInfo>>>();
                Either<Resource, ResponseFormat> resEither = Either.left(resource);
@@ -2211,7 +2412,6 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                        List<ArtifactTemplateInfo> newArtifactsInGroup = entry.getValue().getListToAssociateArtifactToGroup();
                        if (newArtifactsInGroup != null && !newArtifactsInGroup.isEmpty())
                                artifactsToAssotiate.put(entry.getKey(), newArtifactsInGroup);
-                       
 
                        List<ImmutablePair<ArtifactDefinition, ArtifactTemplateInfo>> artifactsToUpdate = entry.getValue().getListToUpdateArtifactInGroup();
                        if (artifactsToUpdate != null && !artifactsToUpdate.isEmpty())
@@ -2223,11 +2423,11 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                        for (Entry<GroupDefinition, List<ImmutablePair<ArtifactDefinition, ArtifactTemplateInfo>>> artifactsToUpdateEntry : artifactsToUpdateMap.entrySet()) {
                                List<ImmutablePair<ArtifactDefinition, ArtifactTemplateInfo>> artifactsToUpdateList = artifactsToUpdateEntry.getValue();
                                GroupDefinition groupToUpdate = artifactsToUpdateEntry.getKey();
-                               
+
                                for (ImmutablePair<ArtifactDefinition, ArtifactTemplateInfo> artifact : artifactsToUpdateList) {
                                        String prevUUID = artifact.getKey().getArtifactUUID();
                                        String prevId = artifact.getKey().getUniqueId();
-                                       Either<ArtifactDefinition, ResponseFormat> updateArtifactEither = updateDeploymentArtifactsFromCsar(csarUUID, csar, resource, user, artifact.getKey(), artifact.getValue(), updatedArtifacts,
+                                       Either<ArtifactDefinition, ResponseFormat> updateArtifactEither = updateDeploymentArtifactsFromCsar(csarInfo, resource, artifact.getKey(), artifact.getValue(), updatedArtifacts,
                                                        artifact.getRight().getRelatedArtifactsInfo(), shouldLock, inTransaction);
                                        if (updateArtifactEither.isRight()) {
                                                log.debug("failed to update artifacts. status is {}", updateArtifactEither.right().value());
@@ -2235,7 +2435,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                                                return resEither;
                                        }
                                        ArtifactDefinition artAfterUpdate = updateArtifactEither.left().value();
-                                       if ( !prevUUID.equals(artAfterUpdate.getArtifactUUID()) ||  !prevId.equals(artAfterUpdate.getUniqueId()) ){
+                                       if (!prevUUID.equals(artAfterUpdate.getArtifactUUID()) || !prevId.equals(artAfterUpdate.getUniqueId())) {
                                                groupToUpdate.getArtifacts().remove(prevId);
                                                groupToUpdate.getArtifactsUuid().remove(prevUUID);
                                                groupToUpdate.getArtifacts().add(artAfterUpdate.getUniqueId());
@@ -2245,11 +2445,10 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                        }
                }
 
-               List<GroupDefinition> associateArtifactGroup = new ArrayList<GroupDefinition>();
-
                for (Entry<GroupDefinition, List<ArtifactTemplateInfo>> associateEntry : artifactsToAssotiate.entrySet()) {
                        List<ArtifactTemplateInfo> associatedArtifact = associateEntry.getValue();
                        Set<String> arifactsUids = new HashSet<String>();
+                       Set<String> arifactsUuids = new HashSet<String>();
                        for (ArtifactTemplateInfo artifactTemplate : associatedArtifact) { // try
                                // to
                                // find
@@ -2260,6 +2459,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                                for (ArtifactDefinition createdArtifact : createdDeplymentArtifactsAfterDelete) {
                                        if (artifactTemplate.getFileName().equalsIgnoreCase(createdArtifact.getArtifactName())) {
                                                arifactsUids.add(createdArtifact.getUniqueId());
+                                               arifactsUuids.add(createdArtifact.getArtifactUUID());
                                                isCreate = false;
                                                String heatEnvId = checkAndGetHeatEnvId(createdArtifact);
                                                if (!heatEnvId.isEmpty()) {
@@ -2279,6 +2479,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                                        for (ArtifactDefinition createdNewArtifact : createdNewArtifacts) {
                                                if (artifactTemplate.getFileName().equalsIgnoreCase(createdNewArtifact.getArtifactName())) {
                                                        arifactsUids.add(createdNewArtifact.getUniqueId());
+                                                       arifactsUuids.add(createdNewArtifact.getArtifactUUID());
                                                        isCreate = false;
                                                        String heatEnvId = checkAndGetHeatEnvId(createdNewArtifact);
                                                        if (!heatEnvId.isEmpty()) {
@@ -2290,17 +2491,18 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                                }
 
                                if (isCreate) {
-                                       Either<ArtifactDefinition, ResponseFormat> createArtifactEither = createDeploymentArtifact(csarUUID, csar, resource, user, ARTIFACTS_PATH, artifactTemplate, createdNewArtifacts, labelCounter, shouldLock, inTransaction);
+                                       Either<ArtifactDefinition, ResponseFormat> createArtifactEither = createDeploymentArtifact(csarInfo, resource, ARTIFACTS_PATH, artifactTemplate, createdNewArtifacts, labelCounter, shouldLock, inTransaction);
                                        if (createArtifactEither.isRight()) {
                                                resEither = Either.right(createArtifactEither.right().value());
                                                return resEither;
                                        }
                                        ArtifactDefinition createdArtifact = createArtifactEither.left().value();
                                        arifactsUids.add(createdArtifact.getUniqueId());
+                                       arifactsUuids.add(createdArtifact.getArtifactUUID());
                                        ArtifactTypeEnum artifactType = ArtifactTypeEnum.findType(createdArtifact.getArtifactType());
                                        if (artifactType == ArtifactTypeEnum.HEAT || artifactType == ArtifactTypeEnum.HEAT_NET || artifactType == ArtifactTypeEnum.HEAT_VOL) {
                                                Either<ArtifactDefinition, ResponseFormat> createHeatEnvPlaceHolder = artifactsBusinessLogic.createHeatEnvPlaceHolder(createdArtifact, ArtifactsBusinessLogic.HEAT_VF_ENV_NAME, resource.getUniqueId(), NodeTypeEnum.Resource,
-                                                               resource.getName(), user, resource, null);
+                                                               resource.getName(), csarInfo.getModifier(), resource, null);
                                                if (createHeatEnvPlaceHolder.isRight()) {
                                                        return Either.right(createHeatEnvPlaceHolder.right().value());
                                                }
@@ -2313,11 +2515,9 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                        if (arifactsUids.size() > 0) {
                                List<String> artifactsToAssociate = new ArrayList<String>();
                                artifactsToAssociate.addAll(arifactsUids);
-                               GroupDefinition assotiateGroup = new GroupDefinition();
-                               assotiateGroup.setUniqueId(associateEntry.getKey().getUniqueId());
-                               assotiateGroup.setArtifacts(artifactsToAssociate);
-                               associateArtifactGroup.add(assotiateGroup);
-
+                               GroupDefinition assotiateGroup = associateEntry.getKey();
+                               assotiateGroup.getArtifacts().addAll(arifactsUids);
+                               assotiateGroup.getArtifactsUuid().addAll(arifactsUuids);
                        }
                }
 
@@ -2353,7 +2553,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
        }
 
        private Map<GroupDefinition, MergedArtifactInfo> mergeGroupInUpdateFlow(Map<GroupDefinition, Map<ArtifactDefinition, List<ArtifactDefinition>>> groupArtifact, Map<ArtifactTemplateInfo, Set<ArtifactTemplateInfo>> parsedGroup,
-                                                                                                                                                       Set<ArtifactDefinition> artifactsToDelete, Map<String, List<ArtifactDefinition>> groupToDelete, Set<ArtifactTemplateInfo> jsonMasterArtifacts, List<ArtifactDefinition> createdDeplymentArtifacts) {
+                       Set<ArtifactDefinition> artifactsToDelete, Map<String, List<ArtifactDefinition>> groupToDelete, Set<ArtifactTemplateInfo> jsonMasterArtifacts, List<ArtifactDefinition> createdDeplymentArtifacts) {
                Map<GroupDefinition, MergedArtifactInfo> mergedgroup = new HashMap<GroupDefinition, MergedArtifactInfo>();
                for (Entry<GroupDefinition, Map<ArtifactDefinition, List<ArtifactDefinition>>> groupListEntry : groupArtifact.entrySet()) {
                        Map<ArtifactDefinition, List<ArtifactDefinition>> createdArtifactMap = groupListEntry.getValue();
@@ -2364,6 +2564,21 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                                for (ArtifactDefinition artToDelete : listToDelete) {
                                        findArtifactToDelete(parsedGroup, artifactsToDelete, groupListEntry.getKey().getUniqueId(), artToDelete, createdDeplymentArtifacts);
                                }
+                               if (artifactsToDelete != null && !artifactsToDelete.isEmpty()) {
+                                       GroupDefinition group = groupListEntry.getKey();
+                                       for (ArtifactDefinition artifactDefinition : artifactsToDelete) {
+                                               if (CollectionUtils.isNotEmpty(group.getArtifacts()) && group.getArtifacts().contains(artifactDefinition.getUniqueId())) {
+                                                       group.getArtifacts().remove(artifactDefinition.getUniqueId());
+
+                                               }
+                                               if (CollectionUtils.isNotEmpty(group.getArtifactsUuid()) && group.getArtifactsUuid().contains(artifactDefinition.getArtifactUUID())) {
+                                                       group.getArtifactsUuid().remove(artifactDefinition.getArtifactUUID());
+
+                                               }
+                                       }
+
+                               }
+
                                for (ArtifactTemplateInfo jsonMasterArtifact : jsonMasterArtifacts) {
                                        if (maserArtifact.getArtifactName().equalsIgnoreCase(jsonMasterArtifact.getFileName())) {
                                                MergedArtifactInfo mergedGroup = new MergedArtifactInfo();
@@ -2384,34 +2599,8 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                return mergedgroup;
        }
 
-       private Set<String> findArtifactsNotInGroupToDelete(List<GroupDefinition> groups, List<ArtifactDefinition> createdDeplymentArtifactsAfterDelete) {
-               Set<String> artifactNotInGroupSet = new HashSet<String>();
-               for (ArtifactDefinition artifact : createdDeplymentArtifactsAfterDelete) {
-                       boolean needToDelete = true;
-                       if (artifact.getArtifactName().equalsIgnoreCase(Constants.VENDOR_LICENSE_MODEL) || artifact.getArtifactName().equalsIgnoreCase(Constants.VF_LICENSE_MODEL))
-                               continue;
-                       if (groups != null) {
-                               for (GroupDefinition group : groups) {
-                                       List<String> groupArtifactIds = group.getArtifacts();
-                                       if (groupArtifactIds == null || groupArtifactIds.isEmpty()) {
-                                               continue;
-                                       }
-                                       for (String groupArtifactid : groupArtifactIds) {
-                                               if (groupArtifactid.equalsIgnoreCase(artifact.getUniqueId()))
-                                                       needToDelete = false;
-
-                                       }
-
-                               }
-                       }
-                       if (needToDelete)
-                               artifactNotInGroupSet.add(artifact.getUniqueId());
-               }
-               return artifactNotInGroupSet;
-       }
-
        private void findArtifactToDelete(Map<ArtifactTemplateInfo, Set<ArtifactTemplateInfo>> parsedGroup, Set<ArtifactDefinition> artifactsToDelete, String deleteGroupId, ArtifactDefinition artifact,
-                                                                         List<ArtifactDefinition> createdDeplymentArtifacts) {
+                       List<ArtifactDefinition> createdDeplymentArtifacts) {
                boolean isNeedToDeleteArtifact = true;
                String artifactType = artifact.getArtifactType();
                ArtifactDefinition generatedFromArt = null;
@@ -2476,20 +2665,20 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                }
        }
 
-       public Either<Resource, ResponseFormat> createResourceArtifactsFromCsar(String csarUUID, Map<String, byte[]> csar, Resource resource, User user, String artifactsMetaFile, String artifactsMetaFileName, List<ArtifactDefinition> createdArtifacts,
-                                                                                                                                                       boolean shouldLock, boolean inTransaction) {
+       public Either<Resource, ResponseFormat> createResourceArtifactsFromCsar(CsarInfo csarInfo, Resource resource, String artifactsMetaFile, String artifactsMetaFileName, List<ArtifactDefinition> createdArtifacts,
+                       boolean shouldLock, boolean inTransaction) {
 
                log.debug("parseResourceArtifactsInfoFromFile start");
-               Either<Map<String, List<ArtifactTemplateInfo>>, ResponseFormat> parseResourceInfoFromYamlEither = parseResourceArtifactsInfoFromFile(resource, artifactsMetaFile, artifactsMetaFileName, user);
+               Either<Map<String, List<ArtifactTemplateInfo>>, ResponseFormat> parseResourceInfoFromYamlEither = parseResourceArtifactsInfoFromFile(resource, artifactsMetaFile, artifactsMetaFileName, csarInfo.getModifier());
                if (parseResourceInfoFromYamlEither.isRight()) {
                        ResponseFormat responseFormat = parseResourceInfoFromYamlEither.right().value();
-                       componentsUtils.auditResource(responseFormat, user, resource, "", "", AuditingActionEnum.IMPORT_RESOURCE, null);
+                       componentsUtils.auditResource(responseFormat, csarInfo.getModifier(), resource, "", "", AuditingActionEnum.IMPORT_RESOURCE, null);
                        return Either.right(responseFormat);
                }
                log.debug("parseResourceArtifactsInfoFromFile end");
 
                log.debug("createResourceArtifacts start");
-               Either<Resource, ResponseFormat> respStatus = createResourceArtifacts(csarUUID, csar, resource, user, parseResourceInfoFromYamlEither.left().value(), AuditingActionEnum.CREATE_RESOURCE, createdArtifacts, shouldLock, inTransaction);
+               Either<Resource, ResponseFormat> respStatus = createResourceArtifacts(csarInfo, resource, parseResourceInfoFromYamlEither.left().value(), AuditingActionEnum.CREATE_RESOURCE, createdArtifacts, shouldLock, inTransaction);
                if (respStatus.isRight()) {
                        return respStatus;
                }
@@ -2507,8 +2696,8 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
 
        }
 
-       private Either<Resource, ResponseFormat> createGroupDeploymentArtifactsFromCsar(String csarUUID, Map<String, byte[]> csar, Resource resource, User user, List<ArtifactTemplateInfo> artifactsTemplateList,
-                                                                                                                                                                       List<ArtifactDefinition> createdNewArtifacts, List<ArtifactDefinition> artifactsFromResource, int labelCounter, boolean shouldLock, boolean inTransaction) {
+       private Either<Resource, ResponseFormat> createGroupDeploymentArtifactsFromCsar(CsarInfo csarInfo, Resource resource, List<ArtifactTemplateInfo> artifactsTemplateList,
+                       List<ArtifactDefinition> createdNewArtifacts, List<ArtifactDefinition> artifactsFromResource, int labelCounter, boolean shouldLock, boolean inTransaction) {
                Either<Resource, ResponseFormat> resStatus = Either.left(resource);
                List<GroupDefinition> createdGroups = resource.getGroups();
                List<GroupDefinition> heatGroups = null;
@@ -2522,45 +2711,43 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                        Set<String> artifactsGroup = new HashSet<String>();
                        Set<String> artifactsUUIDGroup = new HashSet<String>();
 
-                       resStatus = createDeploymentArtifactsFromCsar(csarUUID, csar, resource, user, artifactsGroup, artifactsUUIDGroup, groupTemplateInfo, createdNewArtifacts, artifactsFromResource, labelCounter, shouldLock, inTransaction);
+                       resStatus = createDeploymentArtifactsFromCsar(csarInfo, resource, artifactsGroup, artifactsUUIDGroup, groupTemplateInfo, createdNewArtifacts, artifactsFromResource, labelCounter, shouldLock, inTransaction);
                        if (resStatus.isRight())
                                return resStatus;
-
-                       Map<String, String> members = new HashMap<String, String>();
-                       associateMembersToArtifacts(createdNewArtifacts, artifactsFromResource, heatGroups, artifactsGroup, members);
-
-                       List<String> artifactsList = new ArrayList<String>(artifactsGroup);
-                       List<String> artifactsUUIDList = new ArrayList<String>(artifactsUUIDGroup);
-
-                       GroupDefinition groupDefinition = new GroupDefinition();
-                       groupDefinition.setName(groupName);
-                       groupDefinition.setType(Constants.DEFAULT_GROUP_VF_MODULE);
-                       groupDefinition.setArtifacts(artifactsList);
-                       groupDefinition.setArtifactsUuid(artifactsUUIDList);
-
-                       if (!members.isEmpty())
-                               groupDefinition.setMembers(members);
-
-                       List<GroupProperty> properties = new ArrayList<GroupProperty>();
-                       GroupProperty prop = new GroupProperty();
-                       prop.setName(Constants.IS_BASE);
-                       prop.setValue(Boolean.toString(groupTemplateInfo.isBase()));
-                       properties.add(prop);
-                       
-                       List<ArtifactDefinition> createdArtifacts = new ArrayList<>();
-                       createdArtifacts.addAll(createdNewArtifacts);
-                       createdArtifacts.addAll(artifactsFromResource);
-                       Either<GroupTypeDefinition, StorageOperationStatus> getLatestGroupTypeRes = groupTypeOperation.getLatestGroupTypeByType(Constants.DEFAULT_GROUP_VF_MODULE, true);
-                       if (getLatestGroupTypeRes.isRight()) {
-                               return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(getLatestGroupTypeRes.right().value())));
+                       if(groupName != null && !groupName.isEmpty()){
+                               Map<String, String> members = new HashMap<String, String>();
+                               associateMembersToArtifacts(createdNewArtifacts, artifactsFromResource, heatGroups, artifactsGroup, members);
+       
+                               List<String> artifactsList = new ArrayList<String>(artifactsGroup);
+                               List<String> artifactsUUIDList = new ArrayList<String>(artifactsUUIDGroup);
+       
+                               GroupDefinition groupDefinition = new GroupDefinition();
+                               groupDefinition.setName(groupName);
+                               groupDefinition.setType(Constants.DEFAULT_GROUP_VF_MODULE);
+                               groupDefinition.setArtifacts(artifactsList);
+                               groupDefinition.setArtifactsUuid(artifactsUUIDList);
+       
+                               if (!members.isEmpty())
+                                       groupDefinition.setMembers(members);
+       
+                               List<GroupProperty> properties = new ArrayList<GroupProperty>();
+                               GroupProperty prop = new GroupProperty();
+                               prop.setName(Constants.IS_BASE);
+                               prop.setValue(Boolean.toString(groupTemplateInfo.isBase()));
+                               properties.add(prop);
+       
+                               List<ArtifactDefinition> createdArtifacts = new ArrayList<>();
+                               createdArtifacts.addAll(createdNewArtifacts);
+                               createdArtifacts.addAll(artifactsFromResource);
+                               Either<GroupTypeDefinition, StorageOperationStatus> getLatestGroupTypeRes = groupTypeOperation.getLatestGroupTypeByType(Constants.DEFAULT_GROUP_VF_MODULE, true);
+                               if (getLatestGroupTypeRes.isRight()) {
+                                       return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(getLatestGroupTypeRes.right().value())));
+                               }
+                               properties = createVfModuleAdditionalProperties(groupTemplateInfo.isBase(), groupName, properties, createdArtifacts, artifactsList, getLatestGroupTypeRes.left().value());
+                               groupDefinition.convertFromGroupProperties(properties); 
+                               
+                               needToAdd.add(groupDefinition);
                        }
-                       properties = createVfModuleAdditionalProperties(groupTemplateInfo.isBase(), groupName, properties, createdArtifacts, artifactsList, getLatestGroupTypeRes.left().value());
-                       groupDefinition.convertFromGroupProperties(properties);
-
-                       // Either<GroupDefinition, ResponseFormat> createGroup = groupBusinessLogic.createGroup(resource.getUniqueId(), user.getUserId(), ComponentTypeEnum.RESOURCE, groupDefinition, inTransaction);
-                       // if (createGroup.isRight())
-                       // return Either.right(createGroup.right().value());
-                       needToAdd.add(groupDefinition);
                }
                ComponentParametersView componentParametersView = new ComponentParametersView();
                componentParametersView.disableAll();
@@ -2574,15 +2761,15 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                }
                resource = component.left().value();
 
-               Either<List<GroupDefinition>, ResponseFormat> addGroups = groupBusinessLogic.addGroups(resource, user, ComponentTypeEnum.RESOURCE, needToAdd);
+               Either<List<GroupDefinition>, ResponseFormat> addGroups = groupBusinessLogic.addGroups(resource, csarInfo.getModifier(), ComponentTypeEnum.RESOURCE, needToAdd);
                if (addGroups.isRight())
                        return Either.right(addGroups.right().value());
 
                return resStatus;
        }
 
-       private Either<Resource, ResponseFormat> createDeploymentArtifactsFromCsar(String csarUUID, Map<String, byte[]> csar, Resource resource, User user, Set<String> artifactsGroup, Set<String> artifactsUUIDGroup,
-                                                                                                                                                          ArtifactTemplateInfo artifactTemplateInfo, List<ArtifactDefinition> createdArtifacts, List<ArtifactDefinition> artifactsFromResource, int labelCounter, boolean shoudLock, boolean inTransaction) {
+       private Either<Resource, ResponseFormat> createDeploymentArtifactsFromCsar(CsarInfo csarInfo, Resource resource, Set<String> artifactsGroup, Set<String> artifactsUUIDGroup,
+                       ArtifactTemplateInfo artifactTemplateInfo, List<ArtifactDefinition> createdArtifacts, List<ArtifactDefinition> artifactsFromResource, int labelCounter, boolean shoudLock, boolean inTransaction) {
                Either<Resource, ResponseFormat> resStatus = Either.left(resource);
                String artifactFileName = artifactTemplateInfo.getFileName();
                String artifactUid = "";
@@ -2630,7 +2817,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                // if not exist need to create
                if (!alreadyExist) {
 
-                       Either<ArtifactDefinition, ResponseFormat> newArtifactEither = createDeploymentArtifact(csarUUID, csar, resource, user, ARTIFACTS_PATH, artifactTemplateInfo, createdArtifacts, labelCounter, shoudLock, inTransaction);
+                       Either<ArtifactDefinition, ResponseFormat> newArtifactEither = createDeploymentArtifact(csarInfo, resource, ARTIFACTS_PATH, artifactTemplateInfo, createdArtifacts, labelCounter, shoudLock, inTransaction);
                        if (newArtifactEither.isRight()) {
                                resStatus = Either.right(newArtifactEither.right().value());
                                return resStatus;
@@ -2641,7 +2828,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                        ArtifactTypeEnum artifactType = ArtifactTypeEnum.findType(newArtifact.getArtifactType());
                        if (artifactType == ArtifactTypeEnum.HEAT || artifactType == ArtifactTypeEnum.HEAT_NET || artifactType == ArtifactTypeEnum.HEAT_VOL) {
                                Either<ArtifactDefinition, ResponseFormat> createHeatEnvPlaceHolder = artifactsBusinessLogic.createHeatEnvPlaceHolder(newArtifact, ArtifactsBusinessLogic.HEAT_VF_ENV_NAME, resource.getUniqueId(), NodeTypeEnum.Resource,
-                                               resource.getName(), user, resource, null);
+                                               resource.getName(), csarInfo.getModifier(), resource, null);
                                if (createHeatEnvPlaceHolder.isRight()) {
                                        return Either.right(createHeatEnvPlaceHolder.right().value());
                                }
@@ -2658,7 +2845,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                List<ArtifactTemplateInfo> relatedArtifacts = artifactTemplateInfo.getRelatedArtifactsInfo();
                if (relatedArtifacts != null) {
                        for (ArtifactTemplateInfo relatedArtifactTemplateInfo : relatedArtifacts) {
-                               resStatus = createDeploymentArtifactsFromCsar(csarUUID, csar, resource, user, artifactsGroup, artifactsUUIDGroup, relatedArtifactTemplateInfo, createdArtifacts, artifactsFromResource, labelCounter, shoudLock, inTransaction);
+                               resStatus = createDeploymentArtifactsFromCsar(csarInfo, resource, artifactsGroup, artifactsUUIDGroup, relatedArtifactTemplateInfo, createdArtifacts, artifactsFromResource, labelCounter, shoudLock, inTransaction);
                                if (resStatus.isRight())
                                        return resStatus;
                        }
@@ -2666,8 +2853,8 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                return resStatus;
        }
 
-       private Either<Resource, ResponseFormat> createResourceArtifacts(String csarUUID, Map<String, byte[]> csar, Resource resource, User user, Map<String, List<ArtifactTemplateInfo>> artifactsMap, AuditingActionEnum createResource,
-                                                                                                                                        List<ArtifactDefinition> createdArtifacts, boolean shouldLock, boolean inTransaction) {
+       private Either<Resource, ResponseFormat> createResourceArtifacts(CsarInfo csarInfo, Resource resource, Map<String, List<ArtifactTemplateInfo>> artifactsMap, AuditingActionEnum createResource,
+                       List<ArtifactDefinition> createdArtifacts, boolean shouldLock, boolean inTransaction) {
 
                Either<Resource, ResponseFormat> resStatus = Either.left(resource);
 
@@ -2675,7 +2862,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
 
                for (List<ArtifactTemplateInfo> groupTemplateList : arifactsCollection) {
                        if (groupTemplateList != null) {
-                               resStatus = createGroupDeploymentArtifactsFromCsar(csarUUID, csar, resource, user, groupTemplateList, createdArtifacts, 0, shouldLock, inTransaction);
+                               resStatus = createGroupDeploymentArtifactsFromCsar(csarInfo, resource, groupTemplateList, createdArtifacts, 0, shouldLock, inTransaction);
                                if (resStatus.isRight())
                                        return resStatus;
                        }
@@ -2685,8 +2872,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
 
        }
 
-       private Either<Resource, ResponseFormat> createOrUpdateNonMetaArtifacts(String csarUUID, Map<String, byte[]> csar, Resource resource, User user, List<ArtifactDefinition> createdArtifacts, boolean shouldLock, boolean inTransaction,
-                                                                                                                                                       ArtifactOperationInfo artifactOperation) {
+       private Either<Resource, ResponseFormat> createOrUpdateNonMetaArtifacts(CsarInfo csarInfo, Resource resource, List<ArtifactDefinition> createdArtifacts, boolean shouldLock, boolean inTransaction, ArtifactOperationInfo artifactOperation) {
 
                Either<Resource, ResponseFormat> resStatus = null;
                Map<String, Set<List<String>>> collectedWarningMessages = new HashMap<>();
@@ -2694,7 +2880,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                try {
                        List<NonMetaArtifactInfo> artifactPathAndNameList =
                                        // Stream of file paths contained in csar
-                                       csar.entrySet().stream()
+                                       csarInfo.getCsar().entrySet().stream()
                                                        // Filter in only VF artifact path location
                                                        .filter(e -> Pattern.compile(VF_NODE_TYPE_ARTIFACTS_PATH_PATTERN).matcher(e.getKey()).matches())
                                                        // Validate and add warnings
@@ -2706,13 +2892,19 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                                                        // collect to List
                                                        .collect(Collectors.toList());
 
+                       Either<Boolean, String> responseFormatEither = validateArtifactNames(artifactPathAndNameList);
+                       if (responseFormatEither.isRight()) {
+                               return Either.right(getComponentsUtils().getResponseFormatByArtifactId(ActionStatus.ARTIFACT_NAME_INVALID, responseFormatEither.right().value()));
+                       }
+
+
                        EnumMap<ArtifactOperationEnum, List<NonMetaArtifactInfo>> vfCsarArtifactsToHandle = null;
 
-                       if (artifactOperation.getArtifactOperationEnum() == ArtifactOperationEnum.Create) {
+                       if (ArtifactOperationEnum.isCreateOrLink(artifactOperation.getArtifactOperationEnum())) {
                                vfCsarArtifactsToHandle = new EnumMap<>(ArtifactOperationEnum.class);
                                vfCsarArtifactsToHandle.put(artifactOperation.getArtifactOperationEnum(), artifactPathAndNameList);
                        } else {
-                               Either<EnumMap<ArtifactOperationEnum, List<NonMetaArtifactInfo>>, ResponseFormat> findVfCsarArtifactsToHandleRes = findVfCsarArtifactsToHandle(resource, artifactPathAndNameList, user);
+                               Either<EnumMap<ArtifactOperationEnum, List<NonMetaArtifactInfo>>, ResponseFormat> findVfCsarArtifactsToHandleRes = findVfCsarArtifactsToHandle(resource, artifactPathAndNameList, csarInfo.getModifier());
 
                                if (findVfCsarArtifactsToHandleRes.isRight()) {
                                        resStatus = Either.right(findVfCsarArtifactsToHandleRes.right().value());
@@ -2728,15 +2920,15 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                                                        // Stream of artifacts to be created
                                                        currArtifactOperationPair.getValue().stream()
                                                                        // create each artifact
-                                                                       .map(e -> createOrUpdateSingleNonMetaArtifact(resource, user, csarUUID, csar, e.getPath(), e.getArtifactName(), e.getArtifactType().getType(), e.getArtifactGroupType(), e.getArtifactLabel(), e.getDisplayName(),
+                                                                       .map(e -> createOrUpdateSingleNonMetaArtifact(resource, csarInfo, e.getPath(), e.getArtifactName(), e.getArtifactType().getType(), e.getArtifactGroupType(), e.getArtifactLabel(), e.getDisplayName(),
                                                                                        CsarUtils.ARTIFACT_CREATED_FROM_CSAR, e.getArtifactUniqueId(), artifactsBusinessLogic.new ArtifactOperationInfo(false, false, currArtifactOperationPair.getKey()), createdArtifacts, shouldLock,
                                                                                        inTransaction))
                                                                        // filter in only error
                                                                        .filter(e -> e.isRight()).
                                                                        // Convert the error from either to ResponseFormat
-                                                                                       map(e -> e.right().value()).
+                                                                       map(e -> e.right().value()).
                                                                        // Check if an error occurred
-                                                                                       findAny();
+                                                                       findAny();
                                        // Error found on artifact Creation
                                        if (optionalCreateInDBError.isPresent()) {
                                                resStatus = Either.right(optionalCreateInDBError.get());
@@ -2756,6 +2948,17 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                return resStatus;
        }
 
+       private Either<Boolean, String> validateArtifactNames(List<NonMetaArtifactInfo> artifactPathAndNameList) {
+               Pattern englishNumbersAndUnderScoresOnly = Pattern.compile(CsarUtils.VALID_ENGLISH_ARTIFACT_NAME);
+               for (NonMetaArtifactInfo nonMetaArtifactInfo : artifactPathAndNameList) {
+                       if (!englishNumbersAndUnderScoresOnly.matcher(nonMetaArtifactInfo.getDisplayName()).matches()) {
+                               return Either.right(nonMetaArtifactInfo.getArtifactName());
+                       }
+               }
+               return Either.left(true);
+       }
+
+
        private Either<EnumMap<ArtifactOperationEnum, List<NonMetaArtifactInfo>>, ResponseFormat> findVfCsarArtifactsToHandle(Resource resource, List<NonMetaArtifactInfo> artifactPathAndNameList, User user) {
 
                List<ArtifactDefinition> existingArtifacts = new ArrayList<>();
@@ -2800,8 +3003,8 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                return result;
        }
 
-       private Either<Resource, ResponseFormat> createGroupDeploymentArtifactsFromCsar(String csarUUID, Map<String, byte[]> csar, Resource resource, User user, List<ArtifactTemplateInfo> artifactsTemplateList, List<ArtifactDefinition> createdArtifacts,
-                                                                                                                                                                       int labelCounter, boolean shouldLock, boolean inTransaction) {
+       private Either<Resource, ResponseFormat> createGroupDeploymentArtifactsFromCsar(CsarInfo csarInfo, Resource resource, List<ArtifactTemplateInfo> artifactsTemplateList, List<ArtifactDefinition> createdArtifacts,
+                       int labelCounter, boolean shouldLock, boolean inTransaction) {
                Either<Resource, ResponseFormat> resStatus = Either.left(resource);
                List<GroupDefinition> createdGroups = resource.getGroups();
                List<GroupDefinition> heatGroups = null;
@@ -2824,46 +3027,40 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                        Set<String> artifactsUUIDGroup = new HashSet<String>();
 
                        log.debug("createDeploymentArtifactsFromCsar start");
-                       resStatus = createDeploymentArtifactFromCsar(csarUUID, ARTIFACTS_PATH, csar, resource, user, artifactsGroup, artifactsUUIDGroup, groupTemplateInfo, createdArtifacts, labelCounter, shouldLock, inTransaction);
+                       resStatus = createDeploymentArtifactFromCsar(csarInfo, ARTIFACTS_PATH, resource, artifactsGroup, artifactsUUIDGroup, groupTemplateInfo, createdArtifacts, labelCounter, shouldLock, inTransaction);
                        log.debug("createDeploymentArtifactsFromCsar end");
                        if (resStatus.isRight())
                                return resStatus;
-
-                       Map<String, String> members = new HashMap<String, String>();
-                       associateMembersToArtifacts(createdArtifacts, null, heatGroups, artifactsGroup, members);
-
-                       List<String> artifactsList = new ArrayList<String>(artifactsGroup);
-                       List<String> artifactsUUIDList = new ArrayList<String>(artifactsUUIDGroup);
-
-                       GroupDefinition groupDefinition = new GroupDefinition();
-                       groupDefinition.setName(groupName);
-                       groupDefinition.setType(Constants.DEFAULT_GROUP_VF_MODULE);
-                       groupDefinition.setArtifacts(artifactsList);
-                       groupDefinition.setArtifactsUuid(artifactsUUIDList);
-
-                       if (!members.isEmpty())
-                               groupDefinition.setMembers(members);
-                       List<GroupProperty> properties = new ArrayList<GroupProperty>();
-                       GroupProperty prop = new GroupProperty();
-                       prop.setName(Constants.IS_BASE);
-                       prop.setValue(Boolean.toString(groupTemplateInfo.isBase()));
-                       properties.add(prop);
-                       Either<GroupTypeDefinition, StorageOperationStatus> getLatestGroupTypeRes = groupTypeOperation.getLatestGroupTypeByType(Constants.DEFAULT_GROUP_VF_MODULE, true);
-                       if (getLatestGroupTypeRes.isRight()) {
-                               return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(getLatestGroupTypeRes.right().value())));
+                       if(groupName != null && !groupName.isEmpty()){
+                               Map<String, String> members = new HashMap<String, String>();
+                               associateMembersToArtifacts(createdArtifacts, null, heatGroups, artifactsGroup, members);
+       
+                               List<String> artifactsList = new ArrayList<String>(artifactsGroup);
+                               List<String> artifactsUUIDList = new ArrayList<String>(artifactsUUIDGroup);
+       
+                               GroupDefinition groupDefinition = new GroupDefinition();
+                               groupDefinition.setName(groupName);
+                               groupDefinition.setType(Constants.DEFAULT_GROUP_VF_MODULE);
+                               groupDefinition.setArtifacts(artifactsList);
+                               groupDefinition.setArtifactsUuid(artifactsUUIDList);
+       
+                               if (!members.isEmpty())
+                                       groupDefinition.setMembers(members);
+                               List<GroupProperty> properties = new ArrayList<GroupProperty>();
+                               GroupProperty prop = new GroupProperty();
+                               prop.setName(Constants.IS_BASE);
+                               prop.setValue(Boolean.toString(groupTemplateInfo.isBase()));
+                               properties.add(prop);
+                               Either<GroupTypeDefinition, StorageOperationStatus> getLatestGroupTypeRes = groupTypeOperation.getLatestGroupTypeByType(Constants.DEFAULT_GROUP_VF_MODULE, true);
+                               if (getLatestGroupTypeRes.isRight()) {
+                                       return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(getLatestGroupTypeRes.right().value())));
+                               }
+                               properties = createVfModuleAdditionalProperties(groupTemplateInfo.isBase(), groupName, properties, createdArtifacts, artifactsList, getLatestGroupTypeRes.left().value());
+                               groupDefinition.convertFromGroupProperties(properties);
+                               log.debug("createGroup start");
+       
+                               needToCreate.add(groupDefinition);
                        }
-                       properties = createVfModuleAdditionalProperties(groupTemplateInfo.isBase(), groupName, properties, createdArtifacts, artifactsList, getLatestGroupTypeRes.left().value());
-                       groupDefinition.convertFromGroupProperties(properties);
-                       log.debug("createGroup start");
-
-                       // Since in these groups we handle only artifacts, then no need to
-                       // fetch component instances
-
-                       // Either<GroupDefinition, ResponseFormat> createGroup = groupBusinessLogic.createGroup(comp, user, ComponentTypeEnum.RESOURCE, groupDefinition, inTransaction);
-                       // log.debug("createGroup end");
-                       // if (createGroup.isRight())
-                       // return Either.right(createGroup.right().value());
-                       needToCreate.add(groupDefinition);
                }
 
                ComponentParametersView componentParametersView = new ComponentParametersView();
@@ -2879,7 +3076,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                        return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR));
                }
 
-               Either<List<GroupDefinition>, ResponseFormat> createGroups = groupBusinessLogic.addGroups(component.left().value(), user, ComponentTypeEnum.RESOURCE, needToCreate);
+               Either<List<GroupDefinition>, ResponseFormat> createGroups = groupBusinessLogic.addGroups(component.left().value(), csarInfo.getModifier(), ComponentTypeEnum.RESOURCE, needToCreate);
                if (createGroups.isRight()) {
                        return Either.right(createGroups.right().value());
                }
@@ -2964,7 +3161,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                                                String heatFileNAme = prop.getValue();
                                                if (null == heatFileNAme || heatFileNAme.isEmpty())
                                                        continue;
-                                               List<ArtifactDefinition> artifacts = new ArrayList();
+                                               List<ArtifactDefinition> artifacts = new ArrayList<ArtifactDefinition>();
                                                for (String artifactId : artifactsGroup) {
                                                        Optional<ArtifactDefinition> opArt = createdArtifacts.stream().filter(p -> p.getUniqueId().equals(artifactId)).findAny();
                                                        if (opArt.isPresent()) {
@@ -2988,8 +3185,8 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                }
        }
 
-       private Either<Resource, ResponseFormat> createDeploymentArtifactFromCsar(String csarUUID, String artifactPath, Map<String, byte[]> csar, Resource resource, User user, Set<String> artifactsGroup, Set<String> artifactsUUIDGroup,
-                                                                                                                                                         ArtifactTemplateInfo artifactTemplateInfo, List<ArtifactDefinition> createdArtifacts, int labelCounter, boolean shoudLock, boolean inTransaction) {
+       private Either<Resource, ResponseFormat> createDeploymentArtifactFromCsar(CsarInfo csarInfo, String artifactPath, Resource resource, Set<String> artifactsGroup, Set<String> artifactsUUIDGroup,
+                       ArtifactTemplateInfo artifactTemplateInfo, List<ArtifactDefinition> createdArtifacts, int labelCounter, boolean shoudLock, boolean inTransaction) {
                Either<Resource, ResponseFormat> resStatus = Either.left(resource);
                String artifactFileName = artifactTemplateInfo.getFileName();
                String artifactUid = "";
@@ -3015,7 +3212,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                // if not exist need to create
                if (!alreadyExist) {
 
-                       Either<ArtifactDefinition, ResponseFormat> newArtifactEither = createDeploymentArtifact(csarUUID, csar, resource, user, artifactPath, artifactTemplateInfo, createdArtifacts, labelCounter, shoudLock, inTransaction);
+                       Either<ArtifactDefinition, ResponseFormat> newArtifactEither = createDeploymentArtifact(csarInfo, resource, artifactPath, artifactTemplateInfo, createdArtifacts, labelCounter, shoudLock, inTransaction);
                        if (newArtifactEither.isRight()) {
                                resStatus = Either.right(newArtifactEither.right().value());
                                return resStatus;
@@ -3027,7 +3224,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                        ArtifactTypeEnum artifactType = ArtifactTypeEnum.findType(newArtifact.getArtifactType());
                        if (artifactType == ArtifactTypeEnum.HEAT || artifactType == ArtifactTypeEnum.HEAT_NET || artifactType == ArtifactTypeEnum.HEAT_VOL) {
                                Either<ArtifactDefinition, ResponseFormat> createHeatEnvPlaceHolder = artifactsBusinessLogic.createHeatEnvPlaceHolder(newArtifact, ArtifactsBusinessLogic.HEAT_VF_ENV_NAME, resource.getUniqueId(), NodeTypeEnum.Resource,
-                                               resource.getName(), user, resource, null);
+                                               resource.getName(), csarInfo.getModifier(), resource, null);
                                if (createHeatEnvPlaceHolder.isRight()) {
                                        return Either.right(createHeatEnvPlaceHolder.right().value());
                                }
@@ -3044,7 +3241,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                List<ArtifactTemplateInfo> relatedArtifacts = artifactTemplateInfo.getRelatedArtifactsInfo();
                if (relatedArtifacts != null) {
                        for (ArtifactTemplateInfo relatedArtifactTemplateInfo : relatedArtifacts) {
-                               resStatus = createDeploymentArtifactFromCsar(csarUUID, artifactPath, csar, resource, user, artifactsGroup, artifactsUUIDGroup, relatedArtifactTemplateInfo, createdArtifacts, labelCounter, shoudLock, inTransaction);
+                               resStatus = createDeploymentArtifactFromCsar(csarInfo, artifactPath, resource, artifactsGroup, artifactsUUIDGroup, relatedArtifactTemplateInfo, createdArtifacts, labelCounter, shoudLock, inTransaction);
                                if (resStatus.isRight())
                                        return resStatus;
                        }
@@ -3061,10 +3258,10 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                return artifactEnvUid;
        }
 
-       private Either<ArtifactDefinition, ResponseFormat> createDeploymentArtifact(String csarUUID, Map<String, byte[]> csar, Resource resource, User user, String artifactPath, ArtifactTemplateInfo artifactTemplateInfo,
-                                                                                                                                                               List<ArtifactDefinition> createdArtifacts, int labelCounter, boolean shoudLock, boolean inTransaction) {
+       private Either<ArtifactDefinition, ResponseFormat> createDeploymentArtifact(CsarInfo csarInfo, Resource resource, String artifactPath, ArtifactTemplateInfo artifactTemplateInfo,
+                       List<ArtifactDefinition> createdArtifacts, int labelCounter, boolean shoudLock, boolean inTransaction) {
                final String artifactFileName = artifactTemplateInfo.getFileName();
-               Either<ImmutablePair<String, byte[]>, ResponseFormat> artifactContententStatus = CsarValidationUtils.getArtifactsContent(csarUUID, csar, artifactPath + artifactFileName, artifactFileName, componentsUtils);
+               Either<ImmutablePair<String, byte[]>, ResponseFormat> artifactContententStatus = CsarValidationUtils.getArtifactsContent(csarInfo.getCsarUUID(), csarInfo.getCsar(), artifactPath + artifactFileName, artifactFileName, componentsUtils);
                if (artifactContententStatus.isRight()) {
                        return Either.right(artifactContententStatus.right().value());
                }
@@ -3072,7 +3269,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
 
                Map<String, Object> json = buildJsonForArtifact(artifactTemplateInfo, artifactContententStatus.left().value().getValue(), labelCounter);
 
-               Either<Either<ArtifactDefinition, Operation>, ResponseFormat> uploadArtifactToService = createOrUpdateCsarArtifactFromJson(resource, user, json, artifactsBusinessLogic.new ArtifactOperationInfo(false, false, ArtifactOperationEnum.Create),
+               Either<Either<ArtifactDefinition, Operation>, ResponseFormat> uploadArtifactToService = createOrUpdateCsarArtifactFromJson(resource, csarInfo.getModifier(), json, artifactsBusinessLogic.new ArtifactOperationInfo(false, false, ArtifactOperationEnum.Create),
                                shoudLock, inTransaction);
 
                if (uploadArtifactToService.isRight())
@@ -3081,7 +3278,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                ArtifactDefinition currentInfo = uploadArtifactToService.left().value().left().value();
                if (currentInfo.getHeatParameters() != null) {
 
-                       Either<ArtifactDefinition, ResponseFormat> updateEnvEither = updateHeatParamsFromCsar(resource, csarUUID, csar, artifactTemplateInfo, currentInfo, false);
+                       Either<ArtifactDefinition, ResponseFormat> updateEnvEither = updateHeatParamsFromCsar(resource, csarInfo, artifactTemplateInfo, currentInfo, false);
                        if (updateEnvEither.isRight()) {
                                log.debug("failed to update parameters to artifact {}", artifactFileName);
                                return Either.right(updateEnvEither.right().value());
@@ -3097,39 +3294,15 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
 
        }
 
-       private Either<ArtifactDefinition, ResponseFormat> createInformationalArtifact(String csarUUID, Map<String, byte[]> csar, Resource resource, User user, ArtifactTemplateInfo artifactTemplateInfo, int labelCounter, boolean shoudLock,
-                                                                                                                                                                  boolean inTransaction) {
-               final String artifactFileName = artifactTemplateInfo.getFileName();
-               String artifactPath = CsarUtils.ARTIFACTS_PATH + CsarUtils.INFORMATIONAL_ARTIFACTS + artifactFileName;
-               Either<ImmutablePair<String, byte[]>, ResponseFormat> artifactContententStatus = CsarValidationUtils.getArtifactsContent(csarUUID, csar, artifactPath, artifactFileName, componentsUtils);
-               if (artifactContententStatus.isRight())
-                       return Either.right(artifactContententStatus.right().value());
-
-               Map<String, Object> json = buildJsonForArtifact(artifactTemplateInfo, artifactContententStatus.left().value().getValue(), labelCounter);
-
-               Either<Either<ArtifactDefinition, Operation>, ResponseFormat> uploadArtifactToService = createOrUpdateCsarArtifactFromJson(resource, user, json, artifactsBusinessLogic.new ArtifactOperationInfo(false, false, ArtifactOperationEnum.Create),
-                               shoudLock, inTransaction);
-
-               if (uploadArtifactToService.isRight())
-                       return Either.right(uploadArtifactToService.right().value());
-
-               ArtifactDefinition currentInfo = uploadArtifactToService.left().value().left().value();
-
-               return Either.left(currentInfo);
-
-       }
-
-       private Either<ArtifactDefinition, ResponseFormat> updateDeploymentArtifactsFromCsar(String csarUUID, Map<String, byte[]> csar, Resource resource, User user, ArtifactDefinition oldArtifact, ArtifactTemplateInfo artifactTemplateInfo,
-                                                                                                                                                                                List<ArtifactDefinition> updatedArtifacts, List<ArtifactTemplateInfo> updatedRequiredArtifacts, boolean shouldLock, boolean inTransaction) {
+       private Either<ArtifactDefinition, ResponseFormat> updateDeploymentArtifactsFromCsar(CsarInfo csarInfo, Resource resource, ArtifactDefinition oldArtifact, ArtifactTemplateInfo artifactTemplateInfo,
+                       List<ArtifactDefinition> updatedArtifacts, List<ArtifactTemplateInfo> updatedRequiredArtifacts, boolean shouldLock, boolean inTransaction) {
 
                Either<ArtifactDefinition, ResponseFormat> resStatus = null;
                String artifactFileName = artifactTemplateInfo.getFileName();
-               String artifactUid = "";
 
                // check if artifacts already exist
                for (ArtifactDefinition updatedArtifact : updatedArtifacts) {
                        if (updatedArtifact.getArtifactName().equals(artifactFileName)) {
-                               artifactUid = updatedArtifact.getUniqueId();
                                if (!updatedArtifact.getArtifactType().equalsIgnoreCase(artifactTemplateInfo.getType())) {
                                        log.debug("Artifact with name {} and type {} already updated with type  {}", artifactFileName, artifactTemplateInfo.getType(), updatedArtifact.getArtifactType());
                                        BeEcompErrorManager.getInstance().logInternalDataError("Artifact  file is not in expected formatr, fileName " + artifactFileName, "Artifact internals are invalid", ErrorSeverity.ERROR);
@@ -3142,7 +3315,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
 
                }
 
-               Either<ImmutablePair<String, byte[]>, ResponseFormat> artifactContententStatus = CsarValidationUtils.getArtifactsContent(csarUUID, csar, CsarUtils.ARTIFACTS_PATH + artifactFileName, artifactFileName, componentsUtils);
+               Either<ImmutablePair<String, byte[]>, ResponseFormat> artifactContententStatus = CsarValidationUtils.getArtifactsContent(csarInfo.getCsarUUID(), csarInfo.getCsar(), CsarUtils.ARTIFACTS_PATH + artifactFileName, artifactFileName, componentsUtils);
                if (artifactContententStatus.isRight()) {
                        resStatus = Either.right(artifactContententStatus.right().value());
                        return resStatus;
@@ -3151,7 +3324,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                Map<String, Object> json = buildJsonForUpdateArtifact(oldArtifact.getUniqueId(), artifactFileName, oldArtifact.getArtifactType(), ArtifactGroupTypeEnum.DEPLOYMENT, oldArtifact.getArtifactLabel(), oldArtifact.getArtifactDisplayName(),
                                oldArtifact.getDescription(), artifactContententStatus.left().value().getRight(), updatedRequiredArtifacts);
 
-               Either<Either<ArtifactDefinition, Operation>, ResponseFormat> uploadArtifactToService = createOrUpdateCsarArtifactFromJson(resource, user, json, artifactsBusinessLogic.new ArtifactOperationInfo(false, false, ArtifactOperationEnum.Update),
+               Either<Either<ArtifactDefinition, Operation>, ResponseFormat> uploadArtifactToService = createOrUpdateCsarArtifactFromJson(resource, csarInfo.getModifier(), json, artifactsBusinessLogic.new ArtifactOperationInfo(false, false, ArtifactOperationEnum.Update),
                                shouldLock, inTransaction);
 
                if (uploadArtifactToService.isRight()) {
@@ -3160,7 +3333,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                }
                ArtifactDefinition currentInfo = uploadArtifactToService.left().value().left().value();
 
-               Either<ArtifactDefinition, ResponseFormat> updateEnvEither = updateHeatParamsFromCsar(resource, csarUUID, csar, artifactTemplateInfo, currentInfo, true);
+               Either<ArtifactDefinition, ResponseFormat> updateEnvEither = updateHeatParamsFromCsar(resource, csarInfo, artifactTemplateInfo, currentInfo, true);
                if (updateEnvEither.isRight()) {
                        log.debug("failed to update parameters to artifact {}", artifactFileName);
                        resStatus = Either.right(updateEnvEither.right().value());
@@ -3168,7 +3341,6 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                }
                // TODO evg update env time ( must be separate US for this!!!!)
 
-               artifactUid = updateEnvEither.left().value().getUniqueId();
                updatedArtifacts.add(updateEnvEither.left().value());
                resStatus = Either.left(updateEnvEither.left().value());
 
@@ -3176,11 +3348,11 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
 
        }
 
-       private Either<ArtifactDefinition, ResponseFormat> updateHeatParamsFromCsar(Resource resource, String csarUUID, Map<String, byte[]> csar, ArtifactTemplateInfo artifactTemplateInfo, ArtifactDefinition currentInfo, boolean isUpdateEnv) {
+       private Either<ArtifactDefinition, ResponseFormat> updateHeatParamsFromCsar(Resource resource, CsarInfo csarInfo, ArtifactTemplateInfo artifactTemplateInfo, ArtifactDefinition currentInfo, boolean isUpdateEnv) {
                Either<ArtifactDefinition, ResponseFormat> resStatus = Either.left(currentInfo);
                if (artifactTemplateInfo.getEnv() != null && !artifactTemplateInfo.getEnv().isEmpty()) {
 
-                       Either<ImmutablePair<String, byte[]>, ResponseFormat> artifactparamsStatus = CsarValidationUtils.getArtifactsContent(csarUUID, csar, CsarUtils.ARTIFACTS_PATH + artifactTemplateInfo.getEnv(), artifactTemplateInfo.getEnv(),
+                       Either<ImmutablePair<String, byte[]>, ResponseFormat> artifactparamsStatus = CsarValidationUtils.getArtifactsContent(csarInfo.getCsarUUID(), csarInfo.getCsar(), CsarUtils.ARTIFACTS_PATH + artifactTemplateInfo.getEnv(), artifactTemplateInfo.getEnv(),
                                        componentsUtils);
                        if (artifactparamsStatus.isRight()) {
                                resStatus = Either.right(artifactparamsStatus.right().value());
@@ -3216,7 +3388,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                                                                        resStatus = Either.right(responseFormat);
                                                                        return resStatus;
                                                                }
-                                                               currHeatParam.setCurrentValue(HeatParameterType.isValidType(currHeatParam.getType()).getConverter().convert(updatedParamValue, null, null));
+                                                               currHeatParam.setCurrentValue(paramType.getConverter().convert(updatedParamValue, null, null));
                                                                // newHeatEnvParams.add(currHeatParam);
                                                                break;
                                                        }
@@ -3292,7 +3464,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
        }
 
        private Map<String, Object> buildJsonForUpdateArtifact(String artifactId, String artifactName, String artifactType, ArtifactGroupTypeEnum artifactGroupType, String label, String displayName, String description, byte[] artifactContentent,
-                                                                                                                  List<ArtifactTemplateInfo> updatedRequiredArtifacts) {
+                       List<ArtifactTemplateInfo> updatedRequiredArtifacts) {
 
                Map<String, Object> json = new HashMap<String, Object>();
                if (artifactId != null && !artifactId.isEmpty())
@@ -3319,6 +3491,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                return json;
        }
 
+       @SuppressWarnings({ "unchecked", "static-access" })
        private Either<Map<String, List<ArtifactTemplateInfo>>, ResponseFormat> parseResourceArtifactsInfoFromFile(Resource resource, String artifactsMetaFile, String artifactFileName, User user) {
 
                try {
@@ -3359,7 +3532,8 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                                        return Either.right(componentsUtils.getResponseFormat(ActionStatus.CSAR_INVALID_FORMAT, artifactFileName));
 
                                }
-                               allGroups.addAll(artifactTemplateInfoList);
+                               if(!artifactsTypeKey.equalsIgnoreCase(ArtifactTemplateInfo.CSAR_ARTIFACT))
+                                       allGroups.addAll(artifactTemplateInfoList);
                                artifactsMap.put(artifactsTypeKey, artifactTemplateInfoList);
                        }
                        int counter = groupBusinessLogic.getNextVfModuleNameCounter(resource.getGroups());
@@ -3394,7 +3568,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                return Either.left(artifactTemplateInfoList);
        }
 
-       private Either<Resource, ResponseFormat> createResourceInstancesRelations(User user, String yamlName, Resource resource, Map<String, UploadComponentInstanceInfo> uploadResInstancesMap, boolean inTransaction, boolean needLock) {
+       private Either<Resource, ResponseFormat> createResourceInstancesRelations(User user, String yamlName, Resource resource, Map<String, UploadComponentInstanceInfo> uploadResInstancesMap) {
                log.debug("createResourceInstancesRelations try to create relations ");
                List<ComponentInstance> componentInstancesList = resource.getComponentInstances();
                if (uploadResInstancesMap == null) {
@@ -3418,23 +3592,27 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                if (allDataTypes.isRight()) {
                        TitanOperationStatus status = allDataTypes.right().value();
                        BeEcompErrorManager.getInstance().logInternalFlowError("UpdatePropertyValueOnComponentInstance", "Failed to update property value on instance. Status is " + status, ErrorSeverity.ERROR);
-                       ResponseFormat responseFormat = componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(status)), yamlName);
+                       return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(status)), yamlName));
 
                }
 
                Map<String, List<ComponentInstanceProperty>> instProperties = new HashMap<>();
                Map<ComponentInstance, Map<String, List<CapabilityDefinition>>> instCapabilties = new HashMap<>();
                Map<ComponentInstance, Map<String, List<RequirementDefinition>>> instRequirements = new HashMap<>();
+               Map<String, Map<String, ArtifactDefinition>> instDeploymentArtifacts = new HashMap<>();
                Map<String, Map<String, ArtifactDefinition>> instArtifacts = new HashMap<>();
                Map<String, List<PropertyDefinition>> instAttributes = new HashMap<>();
                Map<String, Resource> originCompMap = new HashMap<>();
                List<RequirementCapabilityRelDef> relations = new ArrayList<>();
 
+               Map<String, List<ComponentInstanceInput>> instInputs = new HashMap<>();
+
                for (Entry<String, UploadComponentInstanceInfo> entry : uploadResInstancesMap.entrySet()) {
+                       log.trace("Processing entry: {}", entry);
                        UploadComponentInstanceInfo uploadComponentInstanceInfo = entry.getValue();
                        ComponentInstance currentCompInstance = null;
                        for (ComponentInstance compInstance : componentInstancesList) {
-
+                               log.trace("Processing component instance: {}", compInstance);
                                if (compInstance.getName().equals(uploadComponentInstanceInfo.getName())) {
                                        currentCompInstance = compInstance;
                                        break;
@@ -3448,33 +3626,70 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                                return Either.right(responseFormat);
                        }
                        String resourceInstanceId = currentCompInstance.getUniqueId();
-                       Resource originResource = null;
+                       Resource originResource;
                        if (!originCompMap.containsKey(currentCompInstance.getComponentUid())) {
-                               Either<Resource, StorageOperationStatus> getPropertyRes = toscaOperationFacade.getToscaFullElement(currentCompInstance.getComponentUid());
-                               if (getPropertyRes.isRight()) {
-                                       log.debug("failed to find properties of resource {} status is {}", currentCompInstance.getComponentUid(), getPropertyRes);
-                                       ResponseFormat responseFormat = componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(getPropertyRes.right().value()), yamlName);
+                               Either<Resource, StorageOperationStatus> getOriginResourceRes = toscaOperationFacade.getToscaFullElement(currentCompInstance.getComponentUid());
+                               if (getOriginResourceRes.isRight()) {
+                                       log.debug("failed to fetch resource with uniqueId {} and tosca component name {} status is {}", currentCompInstance.getComponentUid(), currentCompInstance.getToscaComponentName(), getOriginResourceRes);
+                                       ResponseFormat responseFormat = componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(getOriginResourceRes.right().value()), yamlName);
                                        return Either.right(responseFormat);
                                }
-                               originResource = getPropertyRes.left().value();
+                               originResource = getOriginResourceRes.left().value();
                                originCompMap.put(originResource.getUniqueId(), originResource);
                        } else {
                                originResource = originCompMap.get(currentCompInstance.getComponentUid());
                        }
-                       if (originResource.getCapabilities() != null && !originResource.getCapabilities().isEmpty())
-                               instCapabilties.put(currentCompInstance, originResource.getCapabilities());
                        if (originResource.getRequirements() != null && !originResource.getRequirements().isEmpty())
                                instRequirements.put(currentCompInstance, originResource.getRequirements());
+                       if (MapUtils.isNotEmpty(originResource.getCapabilities())) {
+                               Map<String, List<CapabilityDefinition>> originCapabilities ;
+                               if (MapUtils.isNotEmpty(uploadComponentInstanceInfo.getCapabilities())) {
+                                       originCapabilities = new HashMap<>(); 
+                                       originResource.getCapabilities().entrySet().stream().forEach(e ->{
+                                               List<CapabilityDefinition> list =  e.getValue().stream().map(l -> new CapabilityDefinition(l)).collect(Collectors.toList()); 
+                                               originCapabilities.put(e.getKey(), list);
+                                       });
+                                       Map<String, Map<String, UploadPropInfo>> newPropertiesMap = new HashMap<>();
+                                       for(List<UploadCapInfo> capabilities : uploadComponentInstanceInfo.getCapabilities().values()){
+                                               for(UploadCapInfo capability :capabilities){
+                                                       if(CollectionUtils.isNotEmpty(capability.getProperties())){
+                                                               newPropertiesMap.put(capability.getName(), capability.getProperties().stream().collect(Collectors.toMap(p->p.getName(), p->p)));
+                                                       }
+                                               }
+                                       }
+                                       for (List<CapabilityDefinition> capabilities : originCapabilities.values()) {
+                                               List<CapabilityDefinition> filteredCapabilities = capabilities.stream().filter(c -> newPropertiesMap.containsKey(c.getName())).collect(Collectors.toList());
+                                               for(CapabilityDefinition cap : filteredCapabilities){
+                                                       Either<Boolean, ResponseFormat> updateRes = updatePropertyValues(cap.getProperties(),newPropertiesMap.get(cap.getName()), allDataTypes.left().value());
+                                                       if(updateRes.isRight()){
+                                                               log.debug("Failed to update capability properties of capability {} . Status is {}. ", cap.getName(), updateRes.right().value());
+                                                               return Either.right(updateRes.right().value());
+                                                       }
+                                               }
+                                       }
+                               }
+                               else{
+                                       originCapabilities = originResource.getCapabilities();
+                               }
+                               instCapabilties.put(currentCompInstance, originCapabilities);
+                       }
                        if (originResource.getDeploymentArtifacts() != null && !originResource.getDeploymentArtifacts().isEmpty())
-                               instArtifacts.put(resourceInstanceId, originResource.getDeploymentArtifacts());
+                               instDeploymentArtifacts.put(resourceInstanceId, originResource.getDeploymentArtifacts());
+                       if (originResource.getArtifacts() != null && !originResource.getArtifacts().isEmpty())
+                               instArtifacts.put(resourceInstanceId, originResource.getArtifacts());
                        if (originResource.getAttributes() != null && !originResource.getAttributes().isEmpty())
                                instAttributes.put(resourceInstanceId, originResource.getAttributes());
-
-                       ResponseFormat addPropertiesValueToRiRes = addPropertyValuesToRi(uploadComponentInstanceInfo, resource, originResource, currentCompInstance, yamlName, instProperties, allDataTypes.left().value());
-                       if (addPropertiesValueToRiRes.getStatus() != 200) {
-                               return Either.right(addPropertiesValueToRiRes);
+                       if (originResource.getResourceType() != ResourceTypeEnum.CVFC) {
+                               ResponseFormat addPropertiesValueToRiRes = addPropertyValuesToRi(uploadComponentInstanceInfo, resource, originResource, currentCompInstance, yamlName, instProperties, allDataTypes.left().value());
+                               if (addPropertiesValueToRiRes.getStatus() != 200) {
+                                       return Either.right(addPropertiesValueToRiRes);
+                               }
+                       } else {
+                               ResponseFormat addInputValueToRiRes = addInputsValuesToRi(uploadComponentInstanceInfo, resource, originResource, currentCompInstance, yamlName, instInputs, allDataTypes.left().value());
+                               if (addInputValueToRiRes.getStatus() != 200) {
+                                       return Either.right(addInputValueToRiRes);
+                               }
                        }
-
                }
 
                Either<Map<String, List<ComponentInstanceProperty>>, StorageOperationStatus> addPropToInst = toscaOperationFacade.associateComponentInstancePropertiesToComponent(instProperties, resource.getUniqueId());
@@ -3483,8 +3698,22 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                        ResponseFormat responseFormat = componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(addPropToInst.right().value()), yamlName);
                        return Either.right(responseFormat);
                }
-
-               StorageOperationStatus addArtToInst = toscaOperationFacade.associateArtifactToInstances(instArtifacts, resource.getUniqueId(), user);
+               if (instInputs != null && !instInputs.isEmpty()) {
+                       Either<Map<String, List<ComponentInstanceInput>>, StorageOperationStatus> addInputToInst = toscaOperationFacade.associateComponentInstanceInputsToComponent(instInputs, resource.getUniqueId());
+                       if (addInputToInst.isRight()) {
+                               log.debug("failed to associate inputs value of resource {} status is {}", resource.getUniqueId(), addInputToInst.right().value());
+                               ResponseFormat responseFormat = componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(addInputToInst.right().value()), yamlName);
+                               return Either.right(responseFormat);
+                       }
+               }
+               StorageOperationStatus addArtToInst = toscaOperationFacade.associateDeploymentArtifactsToInstances(instDeploymentArtifacts, resource.getUniqueId(), user);
+               if (addArtToInst != StorageOperationStatus.OK && addArtToInst != StorageOperationStatus.NOT_FOUND) {
+                       log.debug("failed to associate artifact of resource {} status is {}", resource.getUniqueId(), addArtToInst);
+                       ResponseFormat responseFormat = componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(addArtToInst), yamlName);
+                       return Either.right(responseFormat);
+               }
+               
+               addArtToInst = toscaOperationFacade.associateArtifactsToInstances(instArtifacts, resource.getUniqueId(), user);
                if (addArtToInst != StorageOperationStatus.OK && addArtToInst != StorageOperationStatus.NOT_FOUND) {
                        log.debug("failed to associate artifact of resource {} status is {}", resource.getUniqueId(), addArtToInst);
                        ResponseFormat responseFormat = componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(addArtToInst), yamlName);
@@ -3512,16 +3741,16 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                parametersView.setIgnoreCapabilities(false);
                parametersView.setIgnoreRequirements(false);
 
-               Either<Resource, StorageOperationStatus> eitherGerResource = toscaOperationFacade.getToscaElement(resource.getUniqueId(), parametersView);
+               Either<Resource, StorageOperationStatus> eitherGetResource = toscaOperationFacade.getToscaElement(resource.getUniqueId(), parametersView);
 
-               if (eitherGerResource.isRight()) {
-                       ResponseFormat responseFormat = componentsUtils.getResponseFormatByResource(componentsUtils.convertFromStorageResponse(eitherGerResource.right().value()), resource);
+               if (eitherGetResource.isRight()) {
+                       ResponseFormat responseFormat = componentsUtils.getResponseFormatByResource(componentsUtils.convertFromStorageResponse(eitherGetResource.right().value()), resource);
 
                        return Either.right(responseFormat);
 
                }
 
-               resource = eitherGerResource.left().value();
+               resource = eitherGetResource.left().value();
 
                for (Entry<String, UploadComponentInstanceInfo> entry : uploadResInstancesMap.entrySet()) {
                        UploadComponentInstanceInfo uploadComponentInstanceInfo = entry.getValue();
@@ -3554,23 +3783,123 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                        return Either.right(responseFormat);
                }
 
+               if(resource.getResourceType() == ResourceTypeEnum.CVFC){
+                       eitherGetResource = toscaOperationFacade.getToscaFullElement(resource.getUniqueId());
+                       if (eitherGetResource.isRight()) {
+                               ResponseFormat responseFormat = componentsUtils.getResponseFormatByResource(componentsUtils.convertFromStorageResponse(eitherGetResource.right().value()), resource);
+                               return Either.right(responseFormat);
+                       }
+                       eitherGetResource = updateCalculatedCapReqWithSubstitutionMappings(eitherGetResource.left().value(), uploadResInstancesMap);
+                       if (eitherGetResource.isRight()) {
+                               ResponseFormat responseFormat = componentsUtils.getResponseFormatByResource(componentsUtils.convertFromStorageResponse(eitherGetResource.right().value()), resource);
+                               return Either.right(responseFormat);
+                       }
+               }
+               
                log.debug("************* in create relations, getResource start");
-
-               eitherGerResource = toscaOperationFacade.getToscaElement(resource.getUniqueId());
+               eitherGetResource = toscaOperationFacade.getToscaElement(resource.getUniqueId());
                log.debug("************* in create relations, getResource end");
-               if (eitherGerResource.isRight()) {
-                       ResponseFormat responseFormat = componentsUtils.getResponseFormatByResource(componentsUtils.convertFromStorageResponse(eitherGerResource.right().value()), resource);
-
+               if (eitherGetResource.isRight()) {
+                       ResponseFormat responseFormat = componentsUtils.getResponseFormatByResource(componentsUtils.convertFromStorageResponse(eitherGetResource.right().value()), resource);
                        return Either.right(responseFormat);
+               }
+               return Either.left(eitherGetResource.left().value());
+       }
 
+       private Either<Boolean, ResponseFormat> updatePropertyValues(List<ComponentInstanceProperty> properties, Map<String, UploadPropInfo> newProperties, Map<String, DataTypeDefinition> allDataTypes) {
+               for(ComponentInstanceProperty property : properties){
+                       Either<String, StorageOperationStatus> updateRes = updatePropertyValue(property ,newProperties.get(property.getName()), allDataTypes);
+                       if(updateRes.isRight()){
+                               log.debug("Failed to update capability property {} . Status is {}. ", property.getName(), updateRes.right().value());
+                               return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(updateRes.right().value())));
+                       }
+               }
+               return Either.left(true);
+       }
+
+       private Either<String, StorageOperationStatus> updatePropertyValue(ComponentInstanceProperty property, UploadPropInfo propertyInfo, Map<String, DataTypeDefinition> allDataTypes) {
+               String value = null;
+               List<GetInputValueDataDefinition> getInputs = null;
+               boolean isValidate = true;
+               if (propertyInfo.getValue() != null) {
+                       getInputs = propertyInfo.getGet_input();
+                       isValidate = getInputs == null || getInputs.isEmpty();
+                       if (isValidate) {
+                               value = ImportUtils.getPropertyJsonStringValue(propertyInfo.getValue(), property.getType());
+                       } else
+                               value = ImportUtils.getPropertyJsonStringValue(propertyInfo.getValue(), ToscaTagNamesEnum.GET_INPUT.getElementName());
+               }
+               property.setValue(value);
+               return validatePropValueBeforeCreate(property, value, isValidate, null, allDataTypes);
+       }
+
+       private Either<Resource, StorageOperationStatus> updateCalculatedCapReqWithSubstitutionMappings(Resource resource, Map<String, UploadComponentInstanceInfo> uploadResInstancesMap) {
+               Either<Resource, StorageOperationStatus> updateRes = null;
+               Map<ComponentInstance, Map<String, List<CapabilityDefinition>>> updatedInstCapabilities = new HashMap<>();
+               Map<ComponentInstance, Map<String, List<RequirementDefinition>>> updatedInstRequirements = new HashMap<>();
+               StorageOperationStatus status = toscaOperationFacade.deleteAllCalculatedCapabilitiesRequirements( resource.getUniqueId());
+               if(status != StorageOperationStatus.OK && status != StorageOperationStatus.NOT_FOUND){
+                       log.debug("Failed to delete all calculated capabilities and requirements of resource {} upon update. Status is {}", resource.getUniqueId(), status);
+                       updateRes =  Either.right(status);
+               }
+               if(updateRes == null){
+                       fillUpdatedInstCapabilitiesRequirements(resource.getComponentInstances(), uploadResInstancesMap, updatedInstCapabilities, updatedInstRequirements);
+                       status = toscaOperationFacade.associateCalculatedCapReq(updatedInstCapabilities, updatedInstRequirements,  resource.getUniqueId());
+                       if (status != StorageOperationStatus.OK && status != StorageOperationStatus.NOT_FOUND) {
+                               log.debug("Failed to associate capabilities and requirementss of resource {}, updated according to a substitution mapping. Status is {}",  resource.getUniqueId(), status);
+                               updateRes = Either.right(status);
+                       }
+               }
+               if(updateRes == null){
+                       updateRes = Either.left(resource);
+               }
+               return updateRes;
+       }
+
+
+       private void fillUpdatedInstCapabilitiesRequirements(List<ComponentInstance> componentInstances, Map<String, UploadComponentInstanceInfo> uploadResInstancesMap,
+                       Map<ComponentInstance, Map<String, List<CapabilityDefinition>>> updatedInstCapabilities, Map<ComponentInstance, Map<String, List<RequirementDefinition>>> updatedInstRequirements) {
+               
+               componentInstances.stream().forEach( i -> {
+                       fillUpdatedInstCapabilities(updatedInstCapabilities, i, uploadResInstancesMap.get(i.getName()).getCapabilitiesNamesToUpdate());
+                       fillUpdatedInstRequirements(updatedInstRequirements, i, uploadResInstancesMap.get(i.getName()).getRequirementsNamesToUpdate());
+               });
+       }
+
+       private void fillUpdatedInstRequirements(Map<ComponentInstance, Map<String, List<RequirementDefinition>>> updatedInstRequirements, ComponentInstance instance, Map<String, String> requirementsNamesToUpdate) {
+               Map<String, List<RequirementDefinition>> updatedRequirements = new HashMap<>();
+               Set<String> updatedReqNames = new HashSet<>();
+               if(MapUtils.isNotEmpty(requirementsNamesToUpdate)){
+                       for (Map.Entry<String, List<RequirementDefinition>> requirements : instance.getRequirements().entrySet()) {
+                               updatedRequirements.put(requirements.getKey(), requirements.getValue().stream()
+                                               .filter(r -> requirementsNamesToUpdate.containsKey(r.getName()) && !updatedReqNames.contains(requirementsNamesToUpdate.get(r.getName())))
+                                               .map(r ->{r.setParentName(r.getName()); r.setName(requirementsNamesToUpdate.get(r.getName())); updatedReqNames.add(r.getName()); return r;})
+                                               .collect(Collectors.toList()));
+                       }
+               }
+               if(MapUtils.isNotEmpty(updatedRequirements)){
+                       updatedInstRequirements.put(instance, updatedRequirements);
+               }
+       }
+
+       private void fillUpdatedInstCapabilities(Map<ComponentInstance, Map<String, List<CapabilityDefinition>>> updatedInstCapabilties, ComponentInstance instance, Map<String, String> capabilitiesNamesToUpdate) {
+               Map<String, List<CapabilityDefinition>> updatedCapabilities = new HashMap<>();
+               Set<String> updatedCapNames = new HashSet<>();
+               if(MapUtils.isNotEmpty(capabilitiesNamesToUpdate)){
+                       for (Map.Entry<String, List<CapabilityDefinition>> requirements : instance.getCapabilities().entrySet()) {
+                               updatedCapabilities.put(requirements.getKey(), requirements.getValue().stream()
+                                               .filter(c -> capabilitiesNamesToUpdate.containsKey(c.getName()) && !updatedCapNames.contains(capabilitiesNamesToUpdate.get(c.getName())))
+                                               .map(c -> {c.setParentName(c.getName()); c.setName(capabilitiesNamesToUpdate.get(c.getName())); updatedCapNames.add(c.getName()); return c;})
+                                               .collect(Collectors.toList()));
+                       }
+               }
+               if(MapUtils.isNotEmpty(updatedCapabilities)){
+                       updatedInstCapabilties.put(instance, updatedCapabilities);
                }
-               return Either.left(eitherGerResource.left().value());
        }
 
        private ResponseFormat addRelationToRI(String yamlName, Resource resource, UploadComponentInstanceInfo nodesInfoValue, List<RequirementCapabilityRelDef> relations) {
                List<ComponentInstance> componentInstancesList = resource.getComponentInstances();
-               long totalCreateRel = 0;
-               long totalCreatePropVal = 0;
 
                UploadComponentInstanceInfo uploadComponentInstanceInfo = nodesInfoValue;
 
@@ -3593,108 +3922,204 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                }
                String resourceInstanceId = currentCompInstance.getUniqueId();
 
-               log.debug("************* addPropertyValuesToRi start");
-               long startAddProperty = System.currentTimeMillis();
-               log.debug("************* addPropertyValuesToRi end");
-               totalCreatePropVal += (System.currentTimeMillis() - startAddProperty);
                Map<String, List<UploadReqInfo>> regMap = uploadComponentInstanceInfo.getRequirements();
-               if (regMap == null) {
-                       ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.OK, yamlName);
-                       return responseFormat;
-               }
-               Iterator<Entry<String, List<UploadReqInfo>>> nodesRegValue = regMap.entrySet().iterator();
-
-               long startAddRelation = System.currentTimeMillis();
-
-               while (nodesRegValue.hasNext()) {
-                       Entry<String, List<UploadReqInfo>> nodesRegInfoEntry = nodesRegValue.next();
-
-                       List<UploadReqInfo> uploadRegInfoList = nodesRegInfoEntry.getValue();
-                       for (UploadReqInfo uploadRegInfo : uploadRegInfoList) {
-                               log.debug("Going to create  relation {}", uploadRegInfo.getName());
-                               String regName = uploadRegInfo.getName();
-                               String nodeCapName = uploadRegInfo.getNode();
-                               RequirementCapabilityRelDef regCapRelDef = new RequirementCapabilityRelDef();
-                               regCapRelDef.setFromNode(resourceInstanceId);
-                               log.debug("try to find available requirement {} ", regName);
-                               Either<RequirementDefinition, ResponseFormat> eitherReqStatus = findAviableRequiremen(regName, yamlName, uploadComponentInstanceInfo, currentCompInstance, uploadRegInfo.getCapabilityName());
-                               if (eitherReqStatus.isRight()) {
-                                       log.debug("failed to find available requirement {} status is {}", regName, eitherReqStatus.right().value());
-                                       return eitherReqStatus.right().value();
-                               }
-
-                               RequirementDefinition validReq = eitherReqStatus.left().value();
-                               List<RequirementAndRelationshipPair> reqAndRelationshipPairList = regCapRelDef.getRelationships();
-                               if (reqAndRelationshipPairList == null)
-                                       reqAndRelationshipPairList = new ArrayList<RequirementAndRelationshipPair>();
-                               RequirementAndRelationshipPair reqAndRelationshipPair = new RequirementAndRelationshipPair();
-                               reqAndRelationshipPair.setRequirement(regName);
-                               reqAndRelationshipPair.setRequirementOwnerId(validReq.getOwnerId());
-                               reqAndRelationshipPair.setRequirementUid(validReq.getUniqueId());
-                               RelationshipImpl relationship = new RelationshipImpl();
-                               relationship.setType(validReq.getCapability());
-                               reqAndRelationshipPair.setRelationships(relationship);
-
-                               ComponentInstance currentCapCompInstance = null;
-                               for (ComponentInstance compInstance : componentInstancesList) {
-                                       if (compInstance.getName().equals(uploadRegInfo.getNode())) {
-                                               currentCapCompInstance = compInstance;
-                                               break;
+
+               if (regMap != null) {
+                       Iterator<Entry<String, List<UploadReqInfo>>> nodesRegValue = regMap.entrySet().iterator();
+
+                       while (nodesRegValue.hasNext()) {
+                               Entry<String, List<UploadReqInfo>> nodesRegInfoEntry = nodesRegValue.next();
+
+                               List<UploadReqInfo> uploadRegInfoList = nodesRegInfoEntry.getValue();
+                               for (UploadReqInfo uploadRegInfo : uploadRegInfoList) {
+                                       log.debug("Going to create  relation {}", uploadRegInfo.getName());
+                                       String regName = uploadRegInfo.getName();
+                                       RequirementCapabilityRelDef regCapRelDef = new RequirementCapabilityRelDef();
+                                       regCapRelDef.setFromNode(resourceInstanceId);
+                                       log.debug("try to find available requirement {} ", regName);
+                                       Either<RequirementDefinition, ResponseFormat> eitherReqStatus = findAviableRequiremen(regName, yamlName, uploadComponentInstanceInfo, currentCompInstance, uploadRegInfo.getCapabilityName());
+                                       if (eitherReqStatus.isRight()) {
+                                               log.debug("failed to find available requirement {} status is {}", regName, eitherReqStatus.right().value());
+                                               return eitherReqStatus.right().value();
                                        }
-                               }
 
-                               if (currentCapCompInstance == null) {
-                                       log.debug("component instance  with name {}  in resource {} ", uploadRegInfo.getNode(), resource.getUniqueId());
-                                       BeEcompErrorManager.getInstance().logInternalDataError("component instance with name " + uploadRegInfo.getNode() + "  in resource {} ", resource.getUniqueId(), ErrorSeverity.ERROR);
-                                       ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.NOT_TOPOLOGY_TOSCA_TEMPLATE, yamlName);
-                                       return responseFormat;
-                               }
-                               regCapRelDef.setToNode(currentCapCompInstance.getUniqueId());
-                               log.debug("try to find aviable Capability  req name is {} ", validReq.getName());
-                               CapabilityDefinition aviableCapForRel = findAvailableCapabilityByTypeOrName(validReq, currentCapCompInstance, uploadRegInfo);
-                               if (aviableCapForRel == null) {
-                                       log.debug("aviable capability was not found. req name is {} component instance is {}", validReq.getName(), currentCapCompInstance.getUniqueId());
-                                       BeEcompErrorManager.getInstance().logInternalDataError("aviable capability was not found. req name is " + validReq.getName() + " component instance is " + currentCapCompInstance.getUniqueId(), resource.getUniqueId(),
-                                                       ErrorSeverity.ERROR);
-                                       ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.NOT_TOPOLOGY_TOSCA_TEMPLATE, yamlName);
-                                       return responseFormat;
-                               }
-                               reqAndRelationshipPair.setCapability(aviableCapForRel.getName());
-                               reqAndRelationshipPair.setCapabilityUid(aviableCapForRel.getUniqueId());
-                               reqAndRelationshipPair.setCapabilityOwnerId(aviableCapForRel.getOwnerId());
-                               reqAndRelationshipPairList.add(reqAndRelationshipPair);
-                               regCapRelDef.setRelationships(reqAndRelationshipPairList);
-                               relations.add(regCapRelDef);
+                                       RequirementDefinition validReq = eitherReqStatus.left().value();
+                                       List<RequirementAndRelationshipPair> reqAndRelationshipPairList = regCapRelDef.getRelationships();
+                                       if (reqAndRelationshipPairList == null)
+                                               reqAndRelationshipPairList = new ArrayList<RequirementAndRelationshipPair>();
+                                       RequirementAndRelationshipPair reqAndRelationshipPair = new RequirementAndRelationshipPair();
+                                       reqAndRelationshipPair.setRequirement(regName);
+                                       reqAndRelationshipPair.setRequirementOwnerId(validReq.getOwnerId());
+                                       reqAndRelationshipPair.setRequirementUid(validReq.getUniqueId());
+                                       RelationshipImpl relationship = new RelationshipImpl();
+                                       relationship.setType(validReq.getCapability());
+                                       reqAndRelationshipPair.setRelationships(relationship);
+
+                                       ComponentInstance currentCapCompInstance = null;
+                                       for (ComponentInstance compInstance : componentInstancesList) {
+                                               if (compInstance.getName().equals(uploadRegInfo.getNode())) {
+                                                       currentCapCompInstance = compInstance;
+                                                       break;
+                                               }
+                                       }
 
+                                       if (currentCapCompInstance == null) {
+                                               log.debug("The component instance  with name {} not found on resource {} ", uploadRegInfo.getNode(), resource.getUniqueId());
+                                               BeEcompErrorManager.getInstance().logInternalDataError("component instance with name " + uploadRegInfo.getNode() + "  in resource {} ", resource.getUniqueId(), ErrorSeverity.ERROR);
+                                               ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.NOT_TOPOLOGY_TOSCA_TEMPLATE, yamlName);
+                                               return responseFormat;
+                                       }
+                                       regCapRelDef.setToNode(currentCapCompInstance.getUniqueId());
+                                       log.debug("try to find aviable Capability  req name is {} ", validReq.getName());
+                                       CapabilityDefinition aviableCapForRel = findAvailableCapabilityByTypeOrName(validReq, currentCapCompInstance, uploadRegInfo);
+                                       if (aviableCapForRel == null) {
+                                               log.debug("aviable capability was not found. req name is {} component instance is {}", validReq.getName(), currentCapCompInstance.getUniqueId());
+                                               BeEcompErrorManager.getInstance().logInternalDataError("aviable capability was not found. req name is " + validReq.getName() + " component instance is " + currentCapCompInstance.getUniqueId(), resource.getUniqueId(),
+                                                               ErrorSeverity.ERROR);
+                                               ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.NOT_TOPOLOGY_TOSCA_TEMPLATE, yamlName);
+                                               return responseFormat;
+                                       }
+                                       reqAndRelationshipPair.setCapability(aviableCapForRel.getName());
+                                       reqAndRelationshipPair.setCapabilityUid(aviableCapForRel.getUniqueId());
+                                       reqAndRelationshipPair.setCapabilityOwnerId(aviableCapForRel.getOwnerId());
+                                       reqAndRelationshipPairList.add(reqAndRelationshipPair);
+                                       regCapRelDef.setRelationships(reqAndRelationshipPairList);
+                                       relations.add(regCapRelDef);
+                               }
                        }
-
+               } else if (resource.getResourceType() != ResourceTypeEnum.CVFC) {
+                       ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.OK, yamlName);
+                       return responseFormat;
                }
-               totalCreateRel += (System.currentTimeMillis() - startAddRelation);
-
                return componentsUtils.getResponseFormat(ActionStatus.OK);
        }
 
-       private ResponseFormat addPropertyValuesToRi(UploadComponentInstanceInfo uploadComponentInstanceInfo, Resource resource, Resource originResource, ComponentInstance currentCompInstance, String yamlName,
-                                                                                                Map<String, List<ComponentInstanceProperty>> instProperties, Map<String, DataTypeDefinition> allDataTypes) {
-
+       private ResponseFormat addInputsValuesToRi(UploadComponentInstanceInfo uploadComponentInstanceInfo, Resource resource, Resource originResource, ComponentInstance currentCompInstance, String yamlName,
+                       Map<String, List<ComponentInstanceInput>> instInputs, Map<String, DataTypeDefinition> allDataTypes) {
                Map<String, List<UploadPropInfo>> propMap = uploadComponentInstanceInfo.getProperties();
                if (propMap != null && propMap.size() > 0) {
-                       Map<String, PropertyDefinition> currPropertiesMap = new HashMap<String, PropertyDefinition>();
+                       Map<String, InputDefinition> currPropertiesMap = new HashMap<String, InputDefinition>();
 
-                       int index = 0;
-                       List<PropertyDefinition> listFromMap = originResource.getProperties();
+                       List<InputDefinition> listFromMap = originResource.getInputs();
                        if (listFromMap == null || listFromMap.isEmpty()) {
                                log.debug("failed to find properties ");
                                ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.PROPERTY_NOT_FOUND);
                                return responseFormat;
                        }
-                       for (PropertyDefinition prop : listFromMap) {
+                       for (InputDefinition prop : listFromMap) {
                                String propName = prop.getName();
                                if (!currPropertiesMap.containsKey(propName)) {
                                        currPropertiesMap.put(propName, prop);
                                }
                        }
-                       List<ComponentInstanceProperty> instPropList = new ArrayList<>();
+                       List<ComponentInstanceInput> instPropList = new ArrayList<>();
+                       for (List<UploadPropInfo> propertyList : propMap.values()) {
+
+                               UploadPropInfo propertyInfo = propertyList.get(0);
+                               String propName = propertyInfo.getName();
+                               if (!currPropertiesMap.containsKey(propName)) {
+                                       log.debug("failed to find property {} ", propName);
+                                       ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.PROPERTY_NOT_FOUND, propName);
+                                       return responseFormat;
+                               }
+                               InputDefinition curPropertyDef = currPropertiesMap.get(propName);
+                               ComponentInstanceInput property = null;
+
+                               String value = null;
+                               List<GetInputValueDataDefinition> getInputs = null;
+                               boolean isValidate = true;
+                               if (propertyInfo.getValue() != null) {
+                                       getInputs = propertyInfo.getGet_input();
+                                       isValidate = getInputs == null || getInputs.isEmpty();
+                                       if (isValidate) {
+                                               value = ImportUtils.getPropertyJsonStringValue(propertyInfo.getValue(), curPropertyDef.getType());
+                                       } else
+                                               value = ImportUtils.getPropertyJsonStringValue(propertyInfo.getValue(), ToscaTagNamesEnum.GET_INPUT.getElementName());
+                               }
+                               String innerType = null;
+                               property = new ComponentInstanceInput(curPropertyDef, value, null);
+
+                               Either<String, StorageOperationStatus> validatevalueEiter = validatePropValueBeforeCreate(property, value, isValidate, innerType, allDataTypes);
+                               if (validatevalueEiter.isRight()) {
+                                       return componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(validatevalueEiter.right().value()));
+                               }
+
+                               // String uniqueId = UniqueIdBuilder.buildResourceInstancePropertyValueUid(currentCompInstance.getComponentUid(), index++);
+                               // property.setUniqueId(uniqueId);
+                               property.setValue(validatevalueEiter.left().value());
+
+                               if (getInputs != null && !getInputs.isEmpty()) {
+                                       List<GetInputValueDataDefinition> getInputValues = new ArrayList<>();
+                                       for (GetInputValueDataDefinition getInput : getInputs) {
+                                               List<InputDefinition> inputs = resource.getInputs();
+                                               if (inputs == null || inputs.isEmpty()) {
+                                                       log.debug("Failed to add property {} to resource instance {}. Inputs list is empty ", property, currentCompInstance.getUniqueId());
+                                                       return componentsUtils.getResponseFormat(ActionStatus.INVALID_CONTENT);
+                                               }
+
+                                               Optional<InputDefinition> optional = inputs.stream().filter(p -> p.getName().equals(getInput.getInputName())).findAny();
+                                               if (!optional.isPresent()) {
+                                                       log.debug("Failed to find input {} ", getInput.getInputName());
+                                                       // @@TODO error message
+                                                       return componentsUtils.getResponseFormat(ActionStatus.INVALID_CONTENT);
+                                               }
+                                               InputDefinition input = optional.get();
+                                               getInput.setInputId(input.getUniqueId());
+                                               getInputValues.add(getInput);
+
+                                               GetInputValueDataDefinition getInputIndex = getInput.getGetInputIndex();
+                                               if (getInputIndex != null) {
+                                                       optional = inputs.stream().filter(p -> p.getName().equals(getInputIndex.getInputName())).findAny();
+                                                       if (!optional.isPresent()) {
+                                                               log.debug("Failed to find input {} ", getInputIndex.getInputName());
+                                                               // @@TODO error message
+                                                               return componentsUtils.getResponseFormat(ActionStatus.INVALID_CONTENT);
+                                                       }
+                                                       InputDefinition inputIndex = optional.get();
+                                                       getInputIndex.setInputId(inputIndex.getUniqueId());
+                                                       getInputValues.add(getInputIndex);
+                                               }
+                                       }
+                                       property.setGetInputValues(getInputValues);
+                               }
+                               instPropList.add(property);
+                               // delete overriden property
+                               currPropertiesMap.remove(property.getName());
+                       }
+                       // add rest of properties
+                       if (!currPropertiesMap.isEmpty()) {
+                               for (InputDefinition value : currPropertiesMap.values()) {
+                                       instPropList.add(new ComponentInstanceInput(value));
+                               }
+                       }
+                       instInputs.put(currentCompInstance.getUniqueId(), instPropList);
+               }
+               return componentsUtils.getResponseFormat(ActionStatus.OK);
+       }
+
+       private ResponseFormat addPropertyValuesToRi(UploadComponentInstanceInfo uploadComponentInstanceInfo, Resource resource, Resource originResource, ComponentInstance currentCompInstance, String yamlName,
+                                                                                                Map<String, List<ComponentInstanceProperty>> instProperties, Map<String, DataTypeDefinition> allDataTypes) {
+
+               Map<String, List<UploadPropInfo>> propMap = uploadComponentInstanceInfo.getProperties();
+               Map<String, PropertyDefinition> currPropertiesMap = new HashMap<String, PropertyDefinition>();
+
+               List<PropertyDefinition> listFromMap = originResource.getProperties();
+               if ((propMap != null && !propMap.isEmpty()) && (listFromMap == null || listFromMap.isEmpty())) {
+                       log.debug("failed to find properties ");
+                       ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.PROPERTY_NOT_FOUND);
+                       return responseFormat;
+               }
+               if(listFromMap == null || listFromMap.isEmpty()){
+                       return componentsUtils.getResponseFormat(ActionStatus.OK);
+               }
+               for (PropertyDefinition prop : listFromMap) {
+                       String propName = prop.getName();
+                       if (!currPropertiesMap.containsKey(propName)) {
+                               currPropertiesMap.put(propName, prop);
+                       }
+               }
+               List<ComponentInstanceProperty> instPropList = new ArrayList<>();
+               if (propMap != null && propMap.size() > 0) {
                        for (List<UploadPropInfo> propertyList : propMap.values()) {
 
                                UploadPropInfo propertyInfo = propertyList.get(0);
@@ -3770,14 +4195,14 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                                // delete overriden property
                                currPropertiesMap.remove(property.getName());
                        }
-                       // add rest of properties
-                       if (!currPropertiesMap.isEmpty()) {
-                               for (PropertyDefinition value : currPropertiesMap.values()) {
-                                       instPropList.add(new ComponentInstanceProperty(value));
-                               }
+               }
+               // add rest of properties
+               if (!currPropertiesMap.isEmpty()) {
+                       for (PropertyDefinition value : currPropertiesMap.values()) {
+                               instPropList.add(new ComponentInstanceProperty(value));
                        }
-                       instProperties.put(currentCompInstance.getUniqueId(), instPropList);
                }
+               instProperties.put(currentCompInstance.getUniqueId(), instPropList);
                return componentsUtils.getResponseFormat(ActionStatus.OK);
        }
 
@@ -3829,14 +4254,6 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                return cap;
        }
 
-       private RequirementAndRelationshipPair getReqRelPair(CapabilityDefinition cap) {
-               RequirementAndRelationshipPair relationPair = new RequirementAndRelationshipPair();
-               relationPair.setCapabilityUid(cap.getUniqueId());
-               relationPair.setCapability(cap.getName());
-               relationPair.setCapabilityOwnerId(cap.getOwnerId());
-               return relationPair;
-       }
-
        private CapabilityDefinition findAviableCapability(RequirementDefinition validReq, ComponentInstance currentCapCompInstance) {
                CapabilityDefinition aviableCapForRel = null;
                Map<String, List<CapabilityDefinition>> capMap = currentCapCompInstance.getCapabilities();
@@ -3939,9 +4356,23 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
        }
 
        @SuppressWarnings("unchecked")
-       public Either<ParsedToscaYamlInfo, ResponseFormat> parseResourceInfoFromYaml(String yamlFileName, Resource resource, String resourceYml, User user) {
+       public Either<ParsedToscaYamlInfo, ResponseFormat> parseResourceInfoFromYaml(String yamlFileName, Resource resource, String resourceYml, Map<String, String> createdNodesToscaResourceNames, Map<String, NodeTypeInfo> nodeTypesInfo, String nodeName) {
+
+               Map<String, Object> mappedToscaTemplate;
+               if(nodeTypesInfo != null && nodeName != null && nodeTypesInfo.containsKey(nodeName)){
+                       mappedToscaTemplate = nodeTypesInfo.get(nodeName).getMappedToscaTemplate();
+               }
+               else {
+                       try {
+                               //DE154502 Fail if duplicate key found in file
+                               mappedToscaTemplate = ImportUtils.loadYamlAsStrictMap(resourceYml);
 
-               Map<String, Object> mappedToscaTemplate = (Map<String, Object>) new Yaml().load(resourceYml);
+                       } catch(ParserException e) {
+                               log.error("Failed to load yaml file {}", yamlFileName, e);
+                               ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.TOSCA_PARSE_ERROR, yamlFileName, e.getMessage());
+                               return Either.right(responseFormat);
+                       }
+               }
                Either<Object, ResultStatusEnum> toscaElementEither = ImportUtils.findToscaElement(mappedToscaTemplate, ToscaTagNamesEnum.TOPOLOGY_TEMPLATE, ToscaElementTypeEnum.ALL);
                if (toscaElementEither.isRight()) {
                        ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.NOT_TOPOLOGY_TOSCA_TEMPLATE);
@@ -3954,7 +4385,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                        return Either.right(responseFormat);
                }
 
-               Either<Map<String, UploadComponentInstanceInfo>, ResponseFormat> uploadResInstancesEither = createResourcesInstanceInfoFromYaml(yamlFileName, mappedToscaTemplate, resource);
+               Either<Map<String, UploadComponentInstanceInfo>, ResponseFormat> uploadResInstancesEither = createResourcesInstanceInfoFromYaml(yamlFileName, mappedToscaTemplate, resource, createdNodesToscaResourceNames);
                if (uploadResInstancesEither.isRight()) {
                        ResponseFormat responseFormat = uploadResInstancesEither.right().value();
                        return Either.right(responseFormat);
@@ -3975,7 +4406,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
        }
 
        private Either<Resource, ResponseFormat> createResourceInstances(User user, String yamlName, Resource resource, Map<String, UploadComponentInstanceInfo> uploadResInstancesMap, boolean inTransaction, boolean needLock,
-                                                                                                                                        Map<String, Resource> nodeTypeNamespaceMap) {
+                       Map<String, Resource> nodeNamespaceMap) {
 
                Either<Resource, ResponseFormat> eitherResource = null;
                log.debug("createResourceInstances is {} - going to create resource instanse from CSAR", yamlName);
@@ -3986,8 +4417,8 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
 
                }
                Map<String, Resource> existingnodeTypeMap = new HashMap<>();
-               if (nodeTypeNamespaceMap != null && !nodeTypeNamespaceMap.isEmpty()) {
-                       nodeTypeNamespaceMap.entrySet().stream().forEach(x -> existingnodeTypeMap.put(x.getValue().getToscaResourceName(), x.getValue()));
+               if (nodeNamespaceMap != null && !nodeNamespaceMap.isEmpty()) {
+                       nodeNamespaceMap.entrySet().stream().forEach(x -> existingnodeTypeMap.put(x.getValue().getToscaResourceName(), x.getValue()));
                }
 
                Iterator<Entry<String, UploadComponentInstanceInfo>> nodesInfoValue = uploadResInstancesMap.entrySet().iterator();
@@ -4000,8 +4431,8 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                        // updating type if the type is node type name - we need to take the
                        // updated name
                        log.debug("*************Going to create  resource instances {}", uploadComponentInstanceInfo.getName());
-                       if (nodeTypeNamespaceMap.containsKey(uploadComponentInstanceInfo.getType())) {
-                               uploadComponentInstanceInfo.setType(nodeTypeNamespaceMap.get(uploadComponentInstanceInfo.getType()).getToscaResourceName());
+                       if (nodeNamespaceMap.containsKey(uploadComponentInstanceInfo.getType())) {
+                               uploadComponentInstanceInfo.setType(nodeNamespaceMap.get(uploadComponentInstanceInfo.getType()).getToscaResourceName());
                        }
 
                        eitherResource = validateResourceInstanceBeforeCreate(yamlName, uploadComponentInstanceInfo, existingnodeTypeMap);
@@ -4016,9 +4447,10 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
 
                        ComponentTypeEnum containerComponentType = resource.getComponentType();
                        NodeTypeEnum containerNodeType = containerComponentType.getNodeType();
-
-                       if (containerNodeType.equals(NodeTypeEnum.Resource) && uploadComponentInstanceInfo.getCapabilities() != null) {
-                               Either<Map<String, List<CapabilityDefinition>>, ResponseFormat> getValidComponentInstanceCapabilitiesRes = getValidComponentInstanceCapabilities(refResource.getCapabilities(), uploadComponentInstanceInfo.getCapabilities());
+                       
+                       if (containerNodeType.equals(NodeTypeEnum.Resource) && MapUtils.isNotEmpty(uploadComponentInstanceInfo.getCapabilities()) && MapUtils.isNotEmpty(refResource.getCapabilities())) {
+                               setCapabilityNamesTypes(refResource.getCapabilities(), uploadComponentInstanceInfo.getCapabilities());
+                               Either<Map<String, List<CapabilityDefinition>>, ResponseFormat> getValidComponentInstanceCapabilitiesRes = getValidComponentInstanceCapabilities(refResource.getUniqueId(), refResource.getCapabilities(), uploadComponentInstanceInfo.getCapabilities());
                                if (getValidComponentInstanceCapabilitiesRes.isRight()) {
                                        return Either.right(getValidComponentInstanceCapabilitiesRes.right().value());
                                } else {
@@ -4077,11 +4509,23 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                return Either.left(eitherGerResource.left().value());
        }
 
-       private Either<Resource, ResponseFormat> validateResourceInstanceBeforeCreate(String yamlName, UploadComponentInstanceInfo uploadComponentInstanceInfo, Map<String, Resource> nodeTypeNamespaceMap) {
+       private void setCapabilityNamesTypes(Map<String, List<CapabilityDefinition>> originCapabilities, Map<String, List<UploadCapInfo>> uploadedCapabilities) {
+               for(Entry<String, List<UploadCapInfo>> currEntry : uploadedCapabilities.entrySet()){
+                       if(originCapabilities.containsKey(currEntry.getKey())){
+                               currEntry.getValue().stream().forEach(cap -> cap.setType(currEntry.getKey()));
+                       }
+               }
+               for(Map.Entry<String, List<CapabilityDefinition>> capabilities : originCapabilities.entrySet()){
+                       capabilities.getValue().stream().forEach(cap -> {if(uploadedCapabilities.containsKey(cap.getName())){uploadedCapabilities.get(cap.getName()).stream().forEach(c -> {c.setName(cap.getName());c.setType(cap.getType());});};});
+               }
+               
+       }
+
+       private Either<Resource, ResponseFormat> validateResourceInstanceBeforeCreate(String yamlName, UploadComponentInstanceInfo uploadComponentInstanceInfo, Map<String, Resource> nodeNamespaceMap) {
                log.debug("validateResourceInstanceBeforeCreate - going to validate resource instance with name {} and type before create", uploadComponentInstanceInfo.getName(), uploadComponentInstanceInfo.getType());
                Resource refResource = null;
-               if (nodeTypeNamespaceMap.containsKey(uploadComponentInstanceInfo.getType())) {
-                       refResource = nodeTypeNamespaceMap.get(uploadComponentInstanceInfo.getType());
+               if (nodeNamespaceMap.containsKey(uploadComponentInstanceInfo.getType())) {
+                       refResource = nodeNamespaceMap.get(uploadComponentInstanceInfo.getType());
                } else {
                        Either<Resource, StorageOperationStatus> findResourceEither = toscaOperationFacade.getLatestCertifiedNodeTypeByToscaResourceName(uploadComponentInstanceInfo.getType());
                        if (findResourceEither.isRight()) {
@@ -4090,7 +4534,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                                return Either.right(responseFormat);
                        }
                        refResource = findResourceEither.left().value();
-                       nodeTypeNamespaceMap.put(refResource.getToscaResourceName(), refResource);
+                       nodeNamespaceMap.put(refResource.getToscaResourceName(), refResource);
                }
                String componentState = refResource.getComponentMetadataDefinition().getMetadataDataDefinition().getState();
                if (componentState.equals(LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT.name())) {
@@ -4098,32 +4542,36 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                        ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.ILLEGAL_COMPONENT_STATE, refResource.getComponentType().getValue(), refResource.getName(), componentState);
                        return Either.right(responseFormat);
                }
-               ResourceTypeEnum resourceTypeEnum = refResource.getResourceType();
-               if (resourceTypeEnum == ResourceTypeEnum.VF) {
-                       log.debug("validateResourceInstanceBeforeCreate -  ref resource type is  ", resourceTypeEnum);
+
+               if (!ModelConverter.isAtomicComponent(refResource) && refResource.getResourceType() != ResourceTypeEnum.CVFC) {
+                       log.debug("validateResourceInstanceBeforeCreate -  ref resource type is  ", refResource.getResourceType());
                        ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.INVALID_NODE_TEMPLATE, yamlName, uploadComponentInstanceInfo.getName(), uploadComponentInstanceInfo.getType());
                        return Either.right(responseFormat);
                }
                return Either.left(refResource);
        }
 
-       private Either<Map<String, UploadComponentInstanceInfo>, ResponseFormat> createResourcesInstanceInfoFromYaml(String yamlFileName, Map<String, Object> toscaJson, Resource resource) {
+       private Either<Map<String, UploadComponentInstanceInfo>, ResponseFormat> createResourcesInstanceInfoFromYaml(String yamlFileName, Map<String, Object> toscaJson, Resource resource, Map<String, String> createdNodesToscaResourceNames) {
                Map<String, UploadComponentInstanceInfo> moduleComponentInstances = new HashMap<String, UploadComponentInstanceInfo>();
+               Map<String, Object> substitutionMappings = null;
                Either<Map<String, UploadComponentInstanceInfo>, ResponseFormat> result = Either.left(moduleComponentInstances);
                Either<Map<String, Object>, ResultStatusEnum> eitherNodesTemlates = ImportUtils.findFirstToscaMapElement(toscaJson, ToscaTagNamesEnum.NODE_TEMPLATES);
+               Either<Map<String, Object>, ResultStatusEnum> eitherSubstitutionMappings = ImportUtils.findFirstToscaMapElement(toscaJson, ToscaTagNamesEnum.SUBSTITUTION_MAPPINGS);
+               if (eitherSubstitutionMappings.isLeft()) {
+                       substitutionMappings = eitherSubstitutionMappings.left().value();
+               }
                if (eitherNodesTemlates.isLeft()) {
                        Map<String, Object> jsonNodeTemplates = eitherNodesTemlates.left().value();
 
                        Iterator<Entry<String, Object>> nodesNameValue = jsonNodeTemplates.entrySet().iterator();
                        while (nodesNameValue.hasNext()) {
                                Entry<String, Object> nodeNameValue = nodesNameValue.next();
-                               Either<UploadComponentInstanceInfo, ResponseFormat> eitherNode = createModuleComponentInstanceInfo(nodeNameValue.getValue());
+                               Either<UploadComponentInstanceInfo, ResponseFormat> eitherNode = createModuleComponentInstanceInfo(nodeNameValue, substitutionMappings, createdNodesToscaResourceNames);
                                if (eitherNode.isRight()) {
                                        log.info("error when creating node template:{}, for resource:{}", nodeNameValue.getKey(), resource.getName());
                                        return Either.right(eitherNode.right().value());
                                } else {
                                        UploadComponentInstanceInfo uploadComponentInstanceInfo = eitherNode.left().value();
-                                       uploadComponentInstanceInfo.setName(nodeNameValue.getKey());
                                        moduleComponentInstances.put(nodeNameValue.getKey(), uploadComponentInstanceInfo);
                                }
 
@@ -4138,20 +4586,25 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                return result;
        }
 
-       private Either<UploadComponentInstanceInfo, ResponseFormat> createModuleComponentInstanceInfo(Object nodeTemplateJson) {
+       @SuppressWarnings("unchecked")
+       private Either<UploadComponentInstanceInfo, ResponseFormat> createModuleComponentInstanceInfo(Entry<String, Object> nodeTemplateJsonEntry, Map<String, Object> substitutionMappings, Map<String, String> createdNodesToscaResourceNames) {
 
                UploadComponentInstanceInfo nodeTemplateInfo = new UploadComponentInstanceInfo();
                Either<UploadComponentInstanceInfo, ResponseFormat> result = Either.left(nodeTemplateInfo);
-
+               nodeTemplateInfo.setName(nodeTemplateJsonEntry.getKey());
                try {
-                       if (nodeTemplateJson instanceof String) {
-                               String nodeTemplateJsonString = (String) nodeTemplateJson;
+                       if (nodeTemplateJsonEntry.getValue() instanceof String) {
+                               String nodeTemplateJsonString = (String) nodeTemplateJsonEntry.getValue();
                                nodeTemplateInfo.setType(nodeTemplateJsonString);
-                       } else if (nodeTemplateJson instanceof Map) {
-                               Map<String, Object> nodeTemplateJsonMap = (Map<String, Object>) nodeTemplateJson;
+                       } else if (nodeTemplateJsonEntry.getValue() instanceof Map) {
+                               Map<String, Object> nodeTemplateJsonMap = (Map<String, Object>) nodeTemplateJsonEntry.getValue();
                                // Type
                                if (nodeTemplateJsonMap.containsKey(ToscaTagNamesEnum.TYPE.getElementName())) {
-                                       nodeTemplateInfo.setType((String) nodeTemplateJsonMap.get(ToscaTagNamesEnum.TYPE.getElementName()));
+                                       String toscaResourceType = (String) nodeTemplateJsonMap.get(ToscaTagNamesEnum.TYPE.getElementName());
+                                       if (createdNodesToscaResourceNames.containsKey(toscaResourceType)) {
+                                               toscaResourceType = createdNodesToscaResourceNames.get(toscaResourceType);
+                                       }
+                                       nodeTemplateInfo.setType(toscaResourceType);
                                }
 
                                if (nodeTemplateJsonMap.containsKey(ToscaTagNamesEnum.REQUIREMENTS.getElementName())) {
@@ -4179,13 +4632,30 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                                                nodeTemplateInfo.setProperties(regResponse.left().value());
                                        }
                                }
+                               if (substitutionMappings != null) {
+                                       if (substitutionMappings.containsKey(ToscaTagNamesEnum.CAPABILITIES.getElementName())) {
+                                               Either<Map<String, String>, ResponseFormat> getCapNamesToUpdateRes = getNamesToUpdate(nodeTemplateInfo, (Map<String, List<String>>) substitutionMappings.get(ToscaTagNamesEnum.CAPABILITIES.getElementName()));
+                                               if (getCapNamesToUpdateRes.isRight())
+                                                       return Either.right(getCapNamesToUpdateRes.right().value());
+                                               if (getCapNamesToUpdateRes.left().value().size() > 0) {
+                                                       nodeTemplateInfo.setCapabilitiesNamesToUpdate(getCapNamesToUpdateRes.left().value());
+                                               }
+                                       }
+                                       if (substitutionMappings.containsKey(ToscaTagNamesEnum.REQUIREMENTS.getElementName())) {
+                                               Either<Map<String, String>, ResponseFormat> getReqNamesToUpdateRes = getNamesToUpdate(nodeTemplateInfo, (Map<String, List<String>>) substitutionMappings.get(ToscaTagNamesEnum.REQUIREMENTS.getElementName()));
+                                               if (getReqNamesToUpdateRes.isRight())
+                                                       return Either.right(getReqNamesToUpdateRes.right().value());
+                                               if (getReqNamesToUpdateRes.left().value().size() > 0) {
+                                                       nodeTemplateInfo.setRequirementsNamesToUpdate(getReqNamesToUpdateRes.left().value());
+                                               }
+                                       }
+                               }
                        } else {
 
                                result = Either.right(componentsUtils.getResponseFormat(ActionStatus.NOT_TOPOLOGY_TOSCA_TEMPLATE));
 
                        }
                } catch (Exception e) {
-                       BeEcompErrorManager.getInstance().processEcompError(EcompErrorName.BeSystemError, "Import Resource - create capability");
                        BeEcompErrorManager.getInstance().logBeSystemError("Import Resource - create capability");
                        log.debug("error when creating capability, message:{}", e.getMessage(), e);
                        result = Either.right(componentsUtils.getResponseFormat(ActionStatus.INVALID_YAML));
@@ -4194,6 +4664,19 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                return result;
        }
 
+       private Either<Map<String, String>, ResponseFormat> getNamesToUpdate(UploadComponentInstanceInfo nodeTemplateInfo, Map<String, List<String>> elements) {
+               Either<Map<String, String>, ResponseFormat> response;
+               try {
+                       Map<String, String> namesToUpdate = elements.entrySet().stream().filter(e -> e.getValue().get(0).equalsIgnoreCase(nodeTemplateInfo.getName())).collect(Collectors.toMap(e -> e.getValue().get(1), e -> e.getKey()));
+                       response = Either.left(namesToUpdate);
+               } catch (Exception e) {
+                       log.debug("The exception {} occured upon adding names to update for instance {} . ", e.getMessage(), nodeTemplateInfo.getName());
+                       response = Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR));
+               }
+               return response;
+       }
+
+       @SuppressWarnings("unchecked")
        private Either<Map<String, List<UploadPropInfo>>, ResponseFormat> createPropModuleFromYaml(Map<String, Object> nodeTemplateJsonMap) {
                Map<String, List<UploadPropInfo>> moduleProp = new HashMap<String, List<UploadPropInfo>>();
                Either<Map<String, List<UploadPropInfo>>, ResponseFormat> response = Either.left(moduleProp);
@@ -4206,21 +4689,21 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                                Object propValue = jsonPropObj.getValue();
 
                                if (valueContainsPattern(STR_REPLACE_PATTERN, propValue)) {
-                                       log.debug("Ignore property value {}.", propName);
+                                       log.trace("Ignore property value {}.", propName);
                                        continue;
                                }
 
                                if (valueContainsPattern(TOKEN_PATTERN, propValue)) {
-                                       log.debug("Ignore property value {}.", propName);
+                                       log.trace("Ignore property value {}.", propName);
                                        continue;
                                }
                                if (valueContainsPattern(GET_PROPERTY_PATTERN, propValue)) {
-                                       log.debug("Ignore property value {}.", propName);
+                                       log.trace("Ignore property value {}.", propName);
                                        continue;
                                }
 
                                if (valueContainsPattern(CONCAT_PATTERN, propValue)) {
-                                       log.debug("Ignore property value {}.", propName);
+                                       log.trace("Ignore property value {}.", propName);
                                        continue;
                                }
 
@@ -4267,6 +4750,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                return response;
        }
 
+       @SuppressWarnings("unchecked")
        private void createInputPropList(UploadPropInfo propertyDef, List<Object> propValueList) {
                for (Object objValue : propValueList) {
 
@@ -4300,6 +4784,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                }
        }
 
+       @SuppressWarnings("unchecked")
        private void createGetInputModuleFromMap(String propName, Map<String, Object> propValue, UploadPropInfo propertyDef) {
 
                if (propValue.containsKey(ToscaTagNamesEnum.GET_INPUT.getElementName())) {
@@ -4383,7 +4868,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                log.debug("valueContainsToken value is {}", propValue);
                boolean result = false;
                if (propValue != null) {
-                       log.debug("valueContainspattern value is {}", propValue.getClass());
+                       log.trace("valueContainspattern value is {}", propValue.getClass());
                        Matcher matcher = pattern.matcher(propValue.toString());
                        result = matcher.find();
                }
@@ -4391,74 +4876,108 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                return result;
 
        }
-
-       private Either<Map<String, List<UploadCapInfo>>, ResponseFormat> createCapModuleFromYaml(UploadComponentInstanceInfo nodeTemplateInfo, Map<String, Object> nodeTemplateJsonMap) {
-               Map<String, List<UploadCapInfo>> moduleCap = new HashMap<String, List<UploadCapInfo>>();
-               Either<Map<String, List<UploadCapInfo>>, ResponseFormat> response = Either.left(moduleCap);
-               Either<List<Object>, ResultStatusEnum> toscaRequirements = ImportUtils.findFirstToscaListElement(nodeTemplateJsonMap, ToscaTagNamesEnum.CAPABILITIES);
-               if (toscaRequirements.isLeft()) {
-                       List<Object> jsonCapabilities = toscaRequirements.left().value();
-
-                       for (Object jsonCapObj : jsonCapabilities) {
-                               // Requirement
-                               Map<String, Object> capJsonWrapper = (Map<String, Object>) jsonCapObj;
-                               String capName = capJsonWrapper.keySet().iterator().next();
-                               Either<UploadCapInfo, ResponseFormat> eitherCap = createModuleNodeTemplateCap(capJsonWrapper.get(capName));
+       @SuppressWarnings("unchecked")
+       private Either<Map<String, List<UploadReqInfo>>, ResponseFormat> createReqModuleFromYaml(UploadComponentInstanceInfo nodeTemplateInfo, Map<String, Object> nodeTemplateJsonMap) {
+               Map<String, List<UploadReqInfo>> moduleRequirements = new HashMap<String, List<UploadReqInfo>>();
+               Either<Map<String, List<UploadReqInfo>>, ResponseFormat> response = Either.left(moduleRequirements);
+               Either<List<Object>, ResultStatusEnum> requirementsListRes = ImportUtils.findFirstToscaListElement(nodeTemplateJsonMap, ToscaTagNamesEnum.REQUIREMENTS);
+               
+               if (requirementsListRes.isLeft()) {
+                       for (Object jsonReqObj : requirementsListRes.left().value()) {
+                               String reqName = ((Map<String, Object>) jsonReqObj).keySet().iterator().next();
+                               Object reqJson = ((Map<String, Object>) jsonReqObj).get(reqName);
+                               Either<UploadReqInfo, ResponseFormat> eitherCap = addModuleNodeTemplateReq(nodeTemplateInfo, moduleRequirements, reqJson, reqName);
                                if (eitherCap.isRight()) {
-                                       log.info("error when creating Requirement:{}, for node:{}", capName, nodeTemplateInfo);
                                        return Either.right(eitherCap.right().value());
-                               } else {
-                                       UploadCapInfo requirementDef = eitherCap.left().value();
-                                       requirementDef.setName(capName);
-                                       if (moduleCap.containsKey(capName)) {
-                                               moduleCap.get(capName).add(requirementDef);
-                                       } else {
-                                               List<UploadCapInfo> list = new ArrayList<UploadCapInfo>();
-                                               list.add(requirementDef);
-                                               moduleCap.put(capName, list);
+                               }
+                       }
+               } else {
+                       Either<Map<String,Object>, ResultStatusEnum> requirementsMapRes = ImportUtils.findFirstToscaMapElement(nodeTemplateJsonMap, ToscaTagNamesEnum.REQUIREMENTS);
+                       if (requirementsMapRes.isLeft()) {
+                               for (Map.Entry<String, Object>  entry: requirementsMapRes.left().value().entrySet()) {
+                                       String reqName = entry.getKey();
+                                       Object reqJson = entry.getValue();
+                                       Either<UploadReqInfo, ResponseFormat> eitherCap = addModuleNodeTemplateReq(nodeTemplateInfo, moduleRequirements, reqJson, reqName);
+                                       if (eitherCap.isRight()) {
+                                               return Either.right(eitherCap.right().value());
                                        }
-
                                }
                        }
-
                }
-
                return response;
        }
 
-       private Either<Map<String, List<UploadReqInfo>>, ResponseFormat> createReqModuleFromYaml(UploadComponentInstanceInfo nodeTemplateInfo, Map<String, Object> nodeTemplateJsonMap) {
-               Map<String, List<UploadReqInfo>> moduleRequirements = new HashMap<String, List<UploadReqInfo>>();
-               Either<Map<String, List<UploadReqInfo>>, ResponseFormat> response = Either.left(moduleRequirements);
-               Either<List<Object>, ResultStatusEnum> toscaRequirements = ImportUtils.findFirstToscaListElement(nodeTemplateJsonMap, ToscaTagNamesEnum.REQUIREMENTS);
-               if (toscaRequirements.isLeft()) {
-                       List<Object> jsonRequirements = toscaRequirements.left().value();
-
-                       for (Object jsonRequirementObj : jsonRequirements) {
-                               // Requirement
-                               Map<String, Object> requirementJsonWrapper = (Map<String, Object>) jsonRequirementObj;
-                               String requirementName = requirementJsonWrapper.keySet().iterator().next();
-                               Either<UploadReqInfo, ResponseFormat> eitherRequirement = createModuleNodeTemplateReg(requirementJsonWrapper.get(requirementName));
-                               if (eitherRequirement.isRight()) {
-                                       log.info("error when creating Requirement:{}, for node:{}", requirementName, nodeTemplateInfo);
-                                       return Either.right(eitherRequirement.right().value());
-                               } else {
-                                       UploadReqInfo requirementDef = eitherRequirement.left().value();
-                                       requirementDef.setName(requirementName);
-                                       if (moduleRequirements.containsKey(requirementName)) {
-                                               moduleRequirements.get(requirementName).add(requirementDef);
-                                       } else {
-                                               List<UploadReqInfo> list = new ArrayList<UploadReqInfo>();
-                                               list.add(requirementDef);
-                                               moduleRequirements.put(requirementName, list);
+       private Either<UploadReqInfo, ResponseFormat> addModuleNodeTemplateReq(UploadComponentInstanceInfo nodeTemplateInfo,Map<String, List<UploadReqInfo>> moduleRequirements, Object requirementJson, String requirementName) {
+               
+               Either<UploadReqInfo, ResponseFormat> eitherRequirement = createModuleNodeTemplateReg(requirementJson);
+               if (eitherRequirement.isRight()) {
+                       log.info("error when creating Requirement:{}, for node:{}", requirementName, nodeTemplateInfo);
+                       return Either.right(eitherRequirement.right().value());
+               } else {
+                       UploadReqInfo requirementDef = eitherRequirement.left().value();
+                       requirementDef.setName(requirementName);
+                       if (moduleRequirements.containsKey(requirementName)) {
+                               moduleRequirements.get(requirementName).add(requirementDef);
+                       } else {
+                               List<UploadReqInfo> list = new ArrayList<UploadReqInfo>();
+                               list.add(requirementDef);
+                               moduleRequirements.put(requirementName, list);
+                       }
+               }
+               return Either.left(eitherRequirement.left().value());
+       }
+       
+               @SuppressWarnings("unchecked")
+       private Either<Map<String, List<UploadCapInfo>>, ResponseFormat> createCapModuleFromYaml(UploadComponentInstanceInfo nodeTemplateInfo, Map<String, Object> nodeTemplateJsonMap) {
+               Map<String, List<UploadCapInfo>> moduleCap = new HashMap<>();
+               Either<Map<String, List<UploadCapInfo>>, ResponseFormat> response = Either.left(moduleCap);
+               Either<List<Object>, ResultStatusEnum> capabilitiesListRes = ImportUtils.findFirstToscaListElement(nodeTemplateJsonMap, ToscaTagNamesEnum.CAPABILITIES);
+               if (capabilitiesListRes.isLeft()) {
+                       for (Object jsonCapObj : capabilitiesListRes.left().value()) {
+                               String key = ((Map<String, Object>) jsonCapObj).keySet().iterator().next();
+                               Object capJson = ((Map<String, Object>) jsonCapObj).get(key);
+                               Either<UploadCapInfo, ResponseFormat> eitherCap = addModuleNodeTemplateCap(nodeTemplateInfo, moduleCap, capJson, key);
+                               if (eitherCap.isRight()) {
+                                       return Either.right(eitherCap.right().value());
+                               }
+                       }
+               } else {
+                       Either<Map<String,Object>, ResultStatusEnum> capabilitiesMapRes = ImportUtils.findFirstToscaMapElement(nodeTemplateJsonMap, ToscaTagNamesEnum.CAPABILITIES);
+                       if (capabilitiesMapRes.isLeft()) {
+                               for (Map.Entry<String, Object>  entry: capabilitiesMapRes.left().value().entrySet()) {
+                                       String capName = entry.getKey();
+                                       Object capJson = entry.getValue();
+                                       Either<UploadCapInfo, ResponseFormat> eitherCap = addModuleNodeTemplateCap(nodeTemplateInfo, moduleCap, capJson, capName);
+                                       if (eitherCap.isRight()) {
+                                               return Either.right(eitherCap.right().value());
                                        }
-
                                }
                        }
-
                }
                return response;
        }
 
+       private Either<UploadCapInfo, ResponseFormat> addModuleNodeTemplateCap(UploadComponentInstanceInfo nodeTemplateInfo, Map<String, List<UploadCapInfo>> moduleCap, Object capJson, String key) {
+               
+               Either<UploadCapInfo, ResponseFormat> eitherCap = createModuleNodeTemplateCap(capJson);
+               if (eitherCap.isRight()) {
+                       log.info("error when creating Capability:{}, for node:{}", key, nodeTemplateInfo);
+                       return Either.right(eitherCap.right().value());
+               } else {
+                       UploadCapInfo capabilityDef = eitherCap.left().value();
+                       capabilityDef.setKey(key);
+                       if (moduleCap.containsKey(key)) {
+                               moduleCap.get(key).add(capabilityDef);
+                       } else {
+                               List<UploadCapInfo> list = new ArrayList<UploadCapInfo>();
+                               list.add(capabilityDef);
+                               moduleCap.put(key, list);
+                       }
+               }
+               return Either.left( eitherCap.left().value());
+       }
+
+       @SuppressWarnings("unchecked")
        private Either<UploadCapInfo, ResponseFormat> createModuleNodeTemplateCap(Object capObject) {
                UploadCapInfo capTemplateInfo = new UploadCapInfo();
                Either<UploadCapInfo, ResponseFormat> result = Either.left(capTemplateInfo);
@@ -4493,10 +5012,10 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                                }
                        }
                }
-
                return result;
        }
 
+       @SuppressWarnings("unchecked")
        private Either<UploadReqInfo, ResponseFormat> createModuleNodeTemplateReg(Object regObject) {
 
                UploadReqInfo regTemplateInfo = new UploadReqInfo();
@@ -4516,33 +5035,31 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                                regTemplateInfo.setCapabilityName((String) nodeTemplateJsonMap.get(ToscaTagNamesEnum.CAPABILITY.getElementName()));
                        }
                }
-
                return result;
        }
 
-       public Either<Resource, ResponseFormat> propagateStateToCertified(User user, Resource resource, LifecycleChangeInfoWithAction lifecycleChangeInfo, boolean inTransaction, boolean needLock) {
+       public Either<Resource, ResponseFormat> propagateStateToCertified(User user, Resource resource, LifecycleChangeInfoWithAction lifecycleChangeInfo, boolean inTransaction, boolean needLock, boolean forceCertificationAllowed) {
+               
                Either<Resource, ResponseFormat> result = null;
-
-               // resource updated with checkout. certify the resource
-               if (resource.getLifecycleState().equals(LifecycleStateEnum.CERTIFIED)) {
-                       Either<Either<ArtifactDefinition, Operation>, ResponseFormat> eitherPopulated = populateToscaArtifacts(resource, user, false, inTransaction, needLock);
-                       result = eitherPopulated.isLeft() ? Either.left(resource) : Either.right(eitherPopulated.right().value());
-                       return result;
-               }
                try {
-                       result = lifecycleBusinessLogic.changeState(resource.getUniqueId(), user, LifeCycleTransitionEnum.CERTIFICATION_REQUEST, lifecycleChangeInfo, inTransaction, needLock);
-                       if (result.isLeft()) {
+                       if(resource.getLifecycleState() != LifecycleStateEnum.CERTIFIED && forceCertificationAllowed && lifecycleBusinessLogic.isFirstCertification(resource.getVersion())){
+                               result = nodeForceCertification(resource, user, lifecycleChangeInfo, inTransaction, needLock);
+                               if(result.isRight()){
+                                       return result;
+                               }
                                resource = result.left().value();
-                               result = lifecycleBusinessLogic.changeState(resource.getUniqueId(), user, LifeCycleTransitionEnum.START_CERTIFICATION, lifecycleChangeInfo, inTransaction, needLock);
                        }
-                       if (result.isLeft()) {
-                               resource = result.left().value();
-                               result = lifecycleBusinessLogic.changeState(resource.getUniqueId(), user, LifeCycleTransitionEnum.CERTIFY, lifecycleChangeInfo, inTransaction, needLock);
+                       if (resource.getLifecycleState() == LifecycleStateEnum.CERTIFIED) {
+                               Either<Either<ArtifactDefinition, Operation>, ResponseFormat> eitherPopulated = populateToscaArtifacts(resource, user, false, inTransaction, needLock);
+                               result = eitherPopulated.isLeft() ? Either.left(resource) : Either.right(eitherPopulated.right().value());
+                               return result;
                        }
-                       return result;
+                       return nodeFullCertification(resource.getUniqueId(), user, lifecycleChangeInfo, inTransaction, needLock);
+               } catch (Exception e) {
+                       log.debug("The exception {} has occured upon certification of resource {}. ", e.getMessage(), resource.getName());
+                       return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR));
                } finally {
                        if (result == null || result.isRight()) {
-                               BeEcompErrorManager.getInstance().processEcompError(EcompErrorName.BeSystemError, "Change LifecycleState - Certify");
                                BeEcompErrorManager.getInstance().logBeSystemError("Change LifecycleState - Certify");
                                if (inTransaction == false) {
                                        log.debug("operation failed. do rollback");
@@ -4555,6 +5072,21 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                }
        }
 
+       private Either<Resource, ResponseFormat> nodeFullCertification(String uniqueId, User user, LifecycleChangeInfoWithAction lifecycleChangeInfo, boolean inTransaction, boolean needLock) {
+               Either<Resource, ResponseFormat> result = lifecycleBusinessLogic.changeState(uniqueId, user, LifeCycleTransitionEnum.CERTIFICATION_REQUEST, lifecycleChangeInfo, inTransaction, needLock);
+               if (result.isLeft()) {
+                       result = lifecycleBusinessLogic.changeState(uniqueId, user, LifeCycleTransitionEnum.START_CERTIFICATION, lifecycleChangeInfo, inTransaction, needLock);
+               }
+               if (result.isLeft()) {
+                       result = lifecycleBusinessLogic.changeState(uniqueId, user, LifeCycleTransitionEnum.CERTIFY, lifecycleChangeInfo, inTransaction, needLock);
+               }
+               return result;
+       }
+
+       private Either<Resource, ResponseFormat> nodeForceCertification(Resource resource, User user, LifecycleChangeInfoWithAction lifecycleChangeInfo, boolean inTransaction, boolean needLock) {
+               return lifecycleBusinessLogic.forceResourceCertification(resource, user, lifecycleChangeInfo, inTransaction, needLock);
+       }
+
        /*
         * /**
         *
@@ -4565,7 +5097,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
         * createOrUpdateResourceByImport(resource, user, isNormative, false, needLock); }
         */
 
-       public Either<ImmutablePair<Resource, ActionStatus>, ResponseFormat> createOrUpdateResourceByImport(Resource resource, User user, boolean isNormative, boolean isInTransaction, boolean needLock) {
+       public Either<ImmutablePair<Resource, ActionStatus>, ResponseFormat> createOrUpdateResourceByImport(Resource resource, User user, boolean isNormative, boolean isInTransaction, boolean needLock, CsarInfo csarInfo) {
 
                // check if resource already exist
                Either<Resource, StorageOperationStatus> latestByName = toscaOperationFacade.getLatestByName(resource.getName());
@@ -4576,11 +5108,10 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
 
                        Either<Resource, StorageOperationStatus> latestByToscaName = toscaOperationFacade.getLatestByToscaResourceName(resource.getToscaResourceName());
                        if (latestByToscaName.isRight() && latestByToscaName.right().value().equals(StorageOperationStatus.NOT_FOUND))
-                               result = createResourceByImport(resource, user, isNormative, isInTransaction);
+                               result = createResourceByImport(resource, user, isNormative, isInTransaction, csarInfo);
 
                        else {
                                StorageOperationStatus status = latestByName.right().value();
-                               BeEcompErrorManager.getInstance().processEcompError(EcompErrorName.BeResourceMissingError, "Create / Update resource by import", resource.getName());
                                BeEcompErrorManager.getInstance().logBeComponentMissingError("Create / Update resource by import", ComponentTypeEnum.RESOURCE.getValue(), resource.getName());
                                log.debug("resource already exist {}. status={}", resource.getName(), status);
                                ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.RESOURCE_ALREADY_EXISTS);
@@ -4598,7 +5129,6 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                // error
                else {
                        StorageOperationStatus status = latestByName.right().value();
-                       BeEcompErrorManager.getInstance().processEcompError(EcompErrorName.BeResourceMissingError, "Create / Update resource by import", resource.getName());
                        log.debug("failed to get latest version of resource {}. status={}", resource.getName(), status);
                        ResponseFormat responseFormat = componentsUtils.getResponseFormatByResource(componentsUtils.convertFromStorageResponse(latestByName.right().value()), resource);
                        componentsUtils.auditResource(responseFormat, user, resource, "", "", AuditingActionEnum.IMPORT_RESOURCE, null);
@@ -4608,9 +5138,9 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
 
        }
 
-       private Either<ImmutablePair<Resource, ActionStatus>, ResponseFormat> createResourceByImport(Resource resource, User user, boolean isNormative, boolean isInTransaction) {
+       private Either<ImmutablePair<Resource, ActionStatus>, ResponseFormat> createResourceByImport(Resource resource, User user, boolean isNormative, boolean isInTransaction, CsarInfo csarInfo) {
                log.debug("resource with name {} does not exist. create new resource", resource.getName());
-               Either<Resource, ResponseFormat> response = validateResourceBeforeCreate(resource, user, AuditingActionEnum.IMPORT_RESOURCE, isInTransaction);
+               Either<Resource, ResponseFormat> response = validateResourceBeforeCreate(resource, user, AuditingActionEnum.IMPORT_RESOURCE, isInTransaction, csarInfo);
                if (response.isRight()) {
                        return Either.right(response.right().value());
                }
@@ -4659,6 +5189,11 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                                result = Either.right(validateFieldsResponse.right().value());
                                return result;
                        }
+                       
+                       validateFieldsResponse = validateCapabilityTypesCreate(user, getCapabilityTypeOperation(), newResource, AuditingActionEnum.IMPORT_RESOURCE, inTransaction);
+                       if (validateFieldsResponse.isRight()) {
+                               return Either.right(validateFieldsResponse.right().value());
+                       }
 
                        // contact info normalization
                        newResource.setContactId(newResource.getContactId().toLowerCase());
@@ -4710,7 +5245,6 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                        return result;
                } finally {
                        if (result == null || result.isRight()) {
-                               BeEcompErrorManager.getInstance().processEcompError(EcompErrorName.BeSystemError, "Change LifecycleState - Certify");
                                BeEcompErrorManager.getInstance().logBeSystemError("Change LifecycleState - Certify");
                                log.debug("operation failed. do rollback");
                                titanDao.rollback();
@@ -4748,6 +5282,10 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                        newResource.setVendorRelease(oldResource.getVendorRelease());
                }
 
+               if (newResource.getResourceVendorModelNumber() == null) {
+                       newResource.setResourceVendorModelNumber(oldResource.getResourceVendorModelNumber());
+               }
+
                if (newResource.getContactId() == null) {
                        newResource.setContactId(oldResource.getContactId());
                }
@@ -4769,7 +5307,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                return result;
        }
 
-       public Either<Resource, ResponseFormat> validateResourceBeforeCreate(Resource resource, User user, AuditingActionEnum actionEnum, boolean inTransaction) {
+       public Either<Resource, ResponseFormat> validateResourceBeforeCreate(Resource resource, User user, AuditingActionEnum actionEnum, boolean inTransaction, CsarInfo csarInfo) {
 
                Either<Boolean, ResponseFormat> eitherValidation = validateResourceFieldsBeforeCreate(user, resource, actionEnum, inTransaction);
                if (eitherValidation.isRight()) {
@@ -4792,12 +5330,19 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                resource.setCreatorUserId(user.getUserId());
                resource.setCreatorFullName(user.getFirstName() + " " + user.getLastName());
                resource.setContactId(resource.getContactId().toLowerCase());
-               if (resource.getResourceType().equals(ResourceTypeEnum.VF)) {
-                       resource.setToscaResourceName(CommonBeUtils.generateToscaResourceName(ResourceTypeEnum.VF.name(), resource.getSystemName()));
+               if (StringUtils.isEmpty(resource.getToscaResourceName()) && !ModelConverter.isAtomicComponent(resource)) {
+                       String resourceSystemName;
+                       if(csarInfo != null && StringUtils.isNotEmpty(csarInfo.getVfResourceName())){
+                               resourceSystemName = ValidationUtils.convertToSystemName(csarInfo.getVfResourceName());
+                       } else {
+                               resourceSystemName = resource.getSystemName();
+                       }
+                       resource.setToscaResourceName(CommonBeUtils.generateToscaResourceName(resource.getResourceType().name().toLowerCase(), resourceSystemName));
                }
 
                // Generate invariant UUID - must be here and not in operation since it
                // should stay constant during clone
+               // TODO
                String invariantUUID = UniqueIdBuilder.buildInvariantUUID();
                resource.setInvariantUUID(invariantUUID);
 
@@ -4826,10 +5371,8 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                                Either<InterfaceDefinition, StorageOperationStatus> eitherCapTypeFound = interfaceTypeOperation.getInterface(intType);
                                if (eitherCapTypeFound.isRight()) {
                                        if (eitherCapTypeFound.right().value() == StorageOperationStatus.NOT_FOUND) {
-                                               BeEcompErrorManager.getInstance().processEcompError(EcompErrorName.BeInterfaceMissingError, "Create Resource - validateLifecycleTypesCreate", intType);
                                                BeEcompErrorManager.getInstance().logBeGraphObjectMissingError("Create Resource - validateLifecycleTypesCreate", "Interface", intType);
                                                log.debug("Lifecycle Type: {} is required by resource: {} but does not exist in the DB", intType, resource.getName());
-                                               BeEcompErrorManager.getInstance().processEcompError(EcompErrorName.BeDaoSystemError, "Create Resource - validateLifecycleTypesCreate");
                                                BeEcompErrorManager.getInstance().logBeDaoSystemError("Create Resource - validateLifecycleTypesCreate");
                                                log.debug("request to data model failed with error: {}", eitherCapTypeFound.right().value().name());
                                        }
@@ -4862,7 +5405,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                if (resource.getRequirements() != null && resource.getRequirements().size() > 0) {
                        log.debug("validate capability Types Exist - requirements section");
                        for (String type : resource.getRequirements().keySet()) {
-                               eitherResult = validateCapabilityTypeExists(user, capabilityTypeOperation, resource, resource.getRequirements().get(type) , actionEnum, eitherResult, type, inTransaction);
+                               eitherResult = validateCapabilityTypeExists(user, capabilityTypeOperation, resource, resource.getRequirements().get(type), actionEnum, eitherResult, type, inTransaction);
                                if (eitherResult.isRight()) {
                                        return Either.right(eitherResult.right().value());
                                }
@@ -4872,24 +5415,22 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                return eitherResult;
        }
 
-       //@param typeObject- the object to which the validation is done
-       private Either<Boolean, ResponseFormat> validateCapabilityTypeExists(User user, ICapabilityTypeOperation capabilityTypeOperation, Resource resource, List validationObjects , AuditingActionEnum actionEnum, Either<Boolean, ResponseFormat> eitherResult, String type,
-                                                                                                                                                        boolean inTransaction) {
+       // @param typeObject- the object to which the validation is done
+       private Either<Boolean, ResponseFormat> validateCapabilityTypeExists(User user, ICapabilityTypeOperation capabilityTypeOperation, Resource resource, List<?> validationObjects, AuditingActionEnum actionEnum, Either<Boolean, ResponseFormat> eitherResult, String type,
+                                                                                                                                                boolean inTransaction) {
                Either<CapabilityTypeDefinition, StorageOperationStatus> eitherCapTypeFound = capabilityTypeOperation.getCapabilityType(type, inTransaction);
                if (eitherCapTypeFound.isRight()) {
                        if (eitherCapTypeFound.right().value() == StorageOperationStatus.NOT_FOUND) {
-                               BeEcompErrorManager.getInstance().processEcompError(EcompErrorName.BeCapabilityTypeMissingError, "Create Resource - validateCapabilityTypesCreate", type);
                                BeEcompErrorManager.getInstance().logBeGraphObjectMissingError("Create Resource - validateCapabilityTypesCreate", "Capability Type", type);
                                log.debug("Capability Type: {} is required by resource: {} but does not exist in the DB", type, resource.getName());
                                BeEcompErrorManager.getInstance().logBeDaoSystemError("Create Resource - validateCapabilityTypesCreate");
                        }
-                       BeEcompErrorManager.getInstance().processEcompError(EcompErrorName.BeDaoSystemError, "Create Resource - validateCapabilityTypesCreate");
                        log.debug("Trying to get capability type {} failed with error: {}", type, eitherCapTypeFound.right().value().name());
-                       ResponseFormat errorResponse =null;
-                       if (type!=null)
+                       ResponseFormat errorResponse = null;
+                       if (type != null)
                                errorResponse = componentsUtils.getResponseFormat(ActionStatus.MISSING_CAPABILITY_TYPE, type);
                        else
-                               errorResponse = componentsUtils.getResponseFormatByElement(ActionStatus.MISSING_CAPABILITY_TYPE, validationObjects );
+                               errorResponse = componentsUtils.getResponseFormatByElement(ActionStatus.MISSING_CAPABILITY_TYPE, validationObjects);
                        eitherResult = Either.right(errorResponse);
                        componentsUtils.auditResource(errorResponse, user, resource, "", "", actionEnum, null);
                }
@@ -4897,16 +5438,14 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
        }
 
        private Either<Boolean, ResponseFormat> validateCapabilityTypeExists(User user, ICapabilityTypeOperation capabilityTypeOperation, Resource resource, AuditingActionEnum actionEnum, Either<Boolean, ResponseFormat> eitherResult,
-                                                                                                                                                Entry<String, List<CapabilityDefinition>> typeEntry, boolean inTransaction) {
+                       Entry<String, List<CapabilityDefinition>> typeEntry, boolean inTransaction) {
                Either<CapabilityTypeDefinition, StorageOperationStatus> eitherCapTypeFound = capabilityTypeOperation.getCapabilityType(typeEntry.getKey(), inTransaction);
                if (eitherCapTypeFound.isRight()) {
                        if (eitherCapTypeFound.right().value() == StorageOperationStatus.NOT_FOUND) {
-                               BeEcompErrorManager.getInstance().processEcompError(EcompErrorName.BeCapabilityTypeMissingError, "Create Resource - validateCapabilityTypesCreate", typeEntry.getKey());
                                BeEcompErrorManager.getInstance().logBeGraphObjectMissingError("Create Resource - validateCapabilityTypesCreate", "Capability Type", typeEntry.getKey());
                                log.debug("Capability Type: {} is required by resource: {} but does not exist in the DB", typeEntry.getKey(), resource.getName());
                                BeEcompErrorManager.getInstance().logBeDaoSystemError("Create Resource - validateCapabilityTypesCreate");
                        }
-                       BeEcompErrorManager.getInstance().processEcompError(EcompErrorName.BeDaoSystemError, "Create Resource - validateCapabilityTypesCreate");
                        log.debug("Trying to get capability type {} failed with error: {}", typeEntry.getKey(), eitherCapTypeFound.right().value().name());
                        ResponseFormat errorResponse = componentsUtils.getResponseFormat(ActionStatus.MISSING_CAPABILITY_TYPE, typeEntry.getKey());
                        eitherResult = Either.right(errorResponse);
@@ -4960,17 +5499,14 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                }
                try {
                        if (resource.deriveFromGeneric()) {
-                               Either<Resource, ResponseFormat> genericResourceEither = fetchAndSetDerivedFromGenericType(resource);
+                               Either<Resource, ResponseFormat> genericResourceEither = handleResourceGenericType(resource);
                                if (genericResourceEither.isRight())
                                        return genericResourceEither;
-                               if (resource.shouldGenerateInputs())
-                                       generateInputsFromGenericTypeProperties(resource, genericResourceEither.left().value());
                        }
 
                        Either<Resource, ResponseFormat> respStatus = createResourceTransaction(resource, user, isNormative, inTransaction);
                        if (respStatus.isLeft()) {
-                               ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.CREATED);
-                               componentsUtils.auditResource(responseFormat, user, resource, "", "", actionEnum, additionalParams);
+                               auditCreateResource(user, respStatus.left().value(), actionEnum, additionalParams);
                                ASDCKpiApi.countCreatedResourcesKPI();
                        } else
                                componentsUtils.auditResource(respStatus.right().value(), user, resource, "", "", actionEnum, additionalParams);
@@ -4983,6 +5519,11 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                }
        }
 
+       private void auditCreateResource(User user, Resource persistedResource, AuditingActionEnum actionEnum, EnumMap<AuditingFieldsKeysEnum, Object> additionalParams) {
+               ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.CREATED);
+               componentsUtils.auditResource(responseFormat, user, persistedResource, "", "", actionEnum, additionalParams);
+       }
+
        private Either<Resource, ResponseFormat> createResourceTransaction(Resource resource, User user, boolean isNormative, boolean inTransaction) {
                // validate resource name uniqueness
                log.debug("validate resource name");
@@ -5010,7 +5551,8 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                        resource.setLifecycleState(LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
                        resource.setVersion(INITIAL_VERSION);
                        resource.setHighestVersion(true);
-                       resource.setAbstract(false);
+                       if (resource.getResourceType() != null && resource.getResourceType() != ResourceTypeEnum.CVFC)
+                               resource.setAbstract(false);
                }
 
                Either<Resource, StorageOperationStatus> createToscaElement = toscaOperationFacade.createToscaComponent(resource);
@@ -5074,6 +5616,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                resource.setDeploymentArtifacts(artifactMap);
        }
 
+       @SuppressWarnings("unchecked")
        private void setInformationalArtifactsPlaceHolder(Resource resource, User user) {
                Map<String, ArtifactDefinition> artifactMap = resource.getArtifacts();
                if (artifactMap == null) {
@@ -5081,6 +5624,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                }
                String resourceUniqueId = resource.getUniqueId();
                List<String> exludeResourceCategory = ConfigurationManager.getConfigurationManager().getConfiguration().getExcludeResourceCategory();
+               List<String> exludeResourceType = ConfigurationManager.getConfigurationManager().getConfiguration().getExcludeResourceType();
                Map<String, Object> informationalResourceArtifacts = ConfigurationManager.getConfigurationManager().getConfiguration().getInformationalResourceArtifacts();
                List<CategoryDefinition> categories = resource.getCategories();
                boolean isCreateArtifact = true;
@@ -5093,6 +5637,16 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                                }
                        }
 
+               }
+               if (isCreateArtifact && exludeResourceType != null) {
+                       String resourceType = resource.getResourceType().name();
+                       for (String type : exludeResourceType) {
+                               if (type.equalsIgnoreCase(resourceType)) {
+                                       isCreateArtifact = false;
+                                       break;
+                               }
+                       }
+
                }
 
                if (informationalResourceArtifacts != null && isCreateArtifact) {
@@ -5230,10 +5784,12 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
 
                // IResourceOperation dataModel = getResourceOperation();
                Either<Resource, StorageOperationStatus> storageStatus = toscaOperationFacade.getToscaElement(resourceId);
-
                if (storageStatus.isRight()) {
                        log.debug("failed to get resource by id {}", resourceId);
-                       return Either.right(componentsUtils.getResponseFormatByResource(componentsUtils.convertFromStorageResponse(storageStatus.right().value()), ""));
+                       return Either.right(componentsUtils.getResponseFormatByResource(componentsUtils.convertFromStorageResponse(storageStatus.right().value()), resourceId));
+               }
+               if(!(storageStatus.left().value() instanceof Resource)){
+                       return Either.right(componentsUtils.getResponseFormatByResource(componentsUtils.convertFromStorageResponse(StorageOperationStatus.NOT_FOUND), resourceId));
                }
                return Either.left(storageStatus.left().value());
 
@@ -5257,14 +5813,10 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
        /**
         * updateResourceMetadata
         *
-        * @param user
-        *            - modifier data (userId)
-        * @param inTransaction
-        *            TODO
-        * @param resourceIdToUpdate
-        *            - the resource identifier
+        * @param user               - modifier data (userId)
+        * @param inTransaction      TODO
+        * @param resourceIdToUpdate - the resource identifier
         * @param newResource
-        *
         * @return Either<Resource, responseFormat>
         */
        public Either<Resource, ResponseFormat> updateResourceMetadata(String resourceIdToUpdate, Resource newResource, Resource currentResource, User user, boolean inTransaction) {
@@ -5299,7 +5851,6 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                        // lock resource
                        StorageOperationStatus lockResult = graphLockOperation.lockComponent(resourceIdToUpdate, NodeTypeEnum.Resource);
                        if (!lockResult.equals(StorageOperationStatus.OK)) {
-                               BeEcompErrorManager.getInstance().processEcompError(EcompErrorName.BeFailedLockObjectError, "Upload Artifact - lock " + resourceIdToUpdate + ": " + NodeTypeEnum.Resource);
                                BeEcompErrorManager.getInstance().logBeFailedLockObjectError("Upload Artifact - lock ", NodeTypeEnum.Resource.getName(), resourceIdToUpdate);
                                log.debug("Failed to lock resource: {}, error - {}", resourceIdToUpdate, lockResult);
                                ResponseFormat responseFormat = componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(lockResult));
@@ -5315,7 +5866,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                        // list
                        // This code is not called from import resources, because of root
                        // VF "derivedFrom" should be null (or ignored)
-                       if (!currentResource.getResourceType().equals(ResourceTypeEnum.VF)) {
+                       if (ModelConverter.isAtomicComponent(currentResource)) {
                                Either<Boolean, ResponseFormat> derivedFromNotEmptyEither = validateDerivedFromNotEmpty(null, newResource, null);
                                if (derivedFromNotEmptyEither.isRight()) {
                                        log.debug("for updated resource {}, derived from field is empty", newResource.getName());
@@ -5357,7 +5908,54 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                }
        }
 
+       private Either<List<GroupDefinition>,Boolean> updateComponentGroupName(String replacePattern , String with ,List<GroupDefinition> oldGroup){
+               if ( oldGroup==null || with==null || replacePattern==null || with.isEmpty() || replacePattern.isEmpty()){
+                       if (log.isInfoEnabled())
+                               log.info("cannot update group name , invalid args -> replacePattern:{} , with:{} , oldGroup:{}" , replacePattern, with, oldGroup == null ? null : " < size : "+oldGroup.size()+" >" );
+                       return Either.right(false);
+               }
+               List<GroupDefinition> list = oldGroup.stream().map( group -> new GroupDefinition(group)).collect(Collectors.toList());
+               for ( GroupDefinition group : list) {
+                       if ( group!=null && group.isSamePrefix( replacePattern ) ){
+                               String prefix = group.getName().substring( 0, replacePattern.length() );
+                               String newGroupName = group.getName().replaceFirst(prefix , with);
+                               group.setName(newGroupName);
+                               //String newUid = group.getUniqueId().replaceFirst(prefix , with); //removing this will also change the unique id
+                               //group.setUniqueId(newUid);
+                       }
+               }
+               return Either.left(list);
+       }
+
+       private boolean isComponentNameChanged(Resource newResource,Resource oldResource){
+               if (newResource!=null &&  oldResource!=null){   //TODO - must protect all chain against null , use optional
+                       String futureName = newResource.getComponentMetadataDefinition().getMetadataDataDefinition().getName();
+                       String oldName = oldResource.getComponentMetadataDefinition().getMetadataDataDefinition().getName();
+                       return !oldName.equals(futureName);
+               }
+               return false;
+       }
+
        private Either<Resource, ResponseFormat> updateResourceMetadata(String resourceIdToUpdate, Resource newResource, User user, Resource currentResource, boolean shouldLock, boolean inTransaction) {
+               //region -> Update groups name for newResource
+               if ( isComponentNameChanged( currentResource , newResource) ){
+                       String replacePattern = Optional.ofNullable(    //get currentResource name from metadata
+                                       Optional.ofNullable( Optional.ofNullable( currentResource )
+                                                       .orElse(null).getComponentMetadataDefinition() )
+                                                       .orElse(null).getMetadataDataDefinition() )
+                                       .orElse(null).getName();
+                       String with = Optional.ofNullable(                              //get newResource name from metadata
+                                       Optional.ofNullable( Optional.ofNullable( newResource )
+                                                       .orElse(null).getComponentMetadataDefinition() )
+                                                       .orElse(null).getMetadataDataDefinition() )
+                                       .orElse(null).getName();
+                       if ( with != null  && replacePattern != null ){
+                               Either<List<GroupDefinition>,Boolean> result = updateComponentGroupName( replacePattern , with  ,currentResource.getGroups());
+                               if (result.isLeft())
+                                       newResource.setGroups( (List<GroupDefinition>)result.left().value() );
+                       }
+               }
+               //endregion
 
                Either<Boolean, ResponseFormat> validateResourceFields = validateResourceFieldsBeforeUpdate(currentResource, newResource, inTransaction);
                if (validateResourceFields.isRight()) {
@@ -5379,6 +5977,18 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                }
 
                log.debug("send resource {} to dao for update", newResource.getUniqueId());
+               if (newResource!=null && newResource.getGroups()!=null){
+                       for ( GroupDefinition group : newResource.getGroups() ){
+                               if (newResource.getComponentMetadataDefinition()!=null && newResource.getComponentMetadataDefinition().getMetadataDataDefinition()!=null)
+                               groupBusinessLogic.validateAndUpdateGroupMetadata(
+                                               newResource.getComponentMetadataDefinition().getMetadataDataDefinition().getUniqueId() ,
+                                               user,
+                                               ComponentTypeEnum.RESOURCE_INSTANCE,
+                                               group,
+                                               true ,
+                                               false) ;
+                       }
+               }
                Either<Resource, StorageOperationStatus> dataModelResponse = toscaOperationFacade.updateToscaElement(newResource);
 
                if (dataModelResponse.isRight()) {
@@ -5394,12 +6004,9 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
        /**
         * validateResourceFieldsBeforeCreate
         *
-        * @param user
-        *            - modifier data (userId)
-        * @param dataModel
-        *            - IResourceOperation for resource crud
-        * @param resource
-        *            - Resource object to validate
+        * @param user      - modifier data (userId)
+        * @param dataModel - IResourceOperation for resource crud
+        * @param resource  - Resource object to validate
         * @return Either<Boolean, ErrorResponse>
         */
        private Either<Boolean, ResponseFormat> validateResourceFieldsBeforeCreate(User user, Resource resource, AuditingActionEnum actionEnum, boolean inTransaction) {
@@ -5433,7 +6040,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                        return eitherValidation;
                }
 
-               // validate vendor name & release
+               // validate vendor name & release & model number
                log.debug("validate vendor name");
                eitherValidation = validateVendorName(user, resource, actionEnum);
                if (eitherValidation.isRight()) {
@@ -5446,6 +6053,12 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                        return eitherValidation;
                }
 
+               log.debug("validate resource vendor model number");
+               eitherValidation = validateResourceVendorModelNumber(user, resource, actionEnum);
+               if (eitherValidation.isRight()) {
+                       return eitherValidation;
+               }
+
                // validate contact info
                /*
                 * log.debug("validate contact info"); eitherValidation = validateContactIdContactId(user, resource, actionEnum); if (eitherValidation.isRight()) { return eitherValidation; }
@@ -5467,7 +6080,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
 
                // validate template (derived from)
                log.debug("validate derived from");
-               if (resource.getResourceType().equals(ResourceTypeEnum.VF)) {
+               if (!ModelConverter.isAtomicComponent(resource) && resource.getResourceType() != ResourceTypeEnum.CVFC) {
                        resource.setDerivedFrom(null);
                }
                eitherValidation = validateDerivedFromExist(user, resource, actionEnum);
@@ -5503,8 +6116,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
        /**
         * validateResourceFieldsBeforeUpdate
         *
-        * @param currentResource
-        *            - Resource object to validate
+        * @param currentResource - Resource object to validate
         * @return Either<Boolean, ErrorResponse>
         */
        private Either<Boolean, ResponseFormat> validateResourceFieldsBeforeUpdate(Resource currentResource, Resource updateInfoResource, boolean inTransaction) {
@@ -5543,6 +6155,13 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                        return eitherValidation;
                }
 
+               log.debug("validate resource vendor model number before update");
+               eitherValidation = validateResourceVendorModelNumber(currentResource, updateInfoResource);
+               if (eitherValidation.isRight()) {
+                       return eitherValidation;
+               }
+
+
                log.debug("validate vendor release before update");
                eitherValidation = validateVendorReleaseName(null, updateInfoResource, null);
                if (eitherValidation.isRight()) {
@@ -5681,10 +6300,23 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
         * return Either.left(true); }
         */
 
-       private Either<Boolean, ResponseFormat> validateResourceName(Resource currentResource, Resource updateInfoResource, boolean hasBeenCertified) {
+       private boolean isResourceNameEquals(Resource currentResource, Resource updateInfoResource) {
                String resourceNameUpdated = updateInfoResource.getName();
                String resourceNameCurrent = currentResource.getName();
-               if (!resourceNameCurrent.equals(resourceNameUpdated)) {
+               if (resourceNameCurrent.equals(resourceNameUpdated))
+                       return true;
+               // In case of CVFC type we should support the case of old VF with CVFC instances that were created without the "Cvfc" suffix
+               return (currentResource.getResourceType().equals(ResourceTypeEnum.CVFC)
+                               && resourceNameUpdated.equals(addCvfcSuffixToResourceName(resourceNameCurrent)));
+       }
+
+       private String addCvfcSuffixToResourceName(String resourceName) {
+               return resourceName+"Cvfc";
+       }
+
+       private Either<Boolean, ResponseFormat> validateResourceName(Resource currentResource, Resource updateInfoResource, boolean hasBeenCertified) {
+               String resourceNameUpdated = updateInfoResource.getName();
+               if (!isResourceNameEquals(currentResource, updateInfoResource)) {
                        if (!hasBeenCertified) {
                                Either<Boolean, ResponseFormat> validateResourceNameResponse = validateComponentName(null, updateInfoResource, null);
                                if (validateResourceNameResponse.isRight()) {
@@ -5747,6 +6379,19 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                return Either.left(true);
        }
 
+       private Either<Boolean, ResponseFormat> validateResourceVendorModelNumber(Resource currentResource, Resource updateInfoResource) {
+               String updatedResourceVendorModelNumber = updateInfoResource.getResourceVendorModelNumber();
+               String currentResourceVendorModelNumber = currentResource.getResourceVendorModelNumber();
+               if (!currentResourceVendorModelNumber.equals(updatedResourceVendorModelNumber)) {
+                       Either<Boolean, ResponseFormat> validateResourceVendorModelNumber = validateResourceVendorModelNumber(null, updateInfoResource, null);
+                       if (validateResourceVendorModelNumber.isRight()) {
+                               ResponseFormat errorResponse = validateResourceVendorModelNumber.right().value();
+                               return Either.right(errorResponse);
+                       }
+               }
+               return Either.left(true);
+       }
+
        private Either<Boolean, ResponseFormat> validateCategory(Resource currentResource, Resource updateInfoResource, boolean hasBeenCertified, boolean inTransaction) {
                Either<Boolean, ResponseFormat> validateCategoryName = validateCategory(null, updateInfoResource, null, inTransaction);
                if (validateCategoryName.isRight()) {
@@ -5818,16 +6463,13 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                Either<Boolean, StorageOperationStatus> dataModelResponse = toscaOperationFacade.validateToscaResourceNameExists(templateName);
                if (dataModelResponse.isRight()) {
                        StorageOperationStatus storageStatus = dataModelResponse.right().value();
-                       BeEcompErrorManager.getInstance().processEcompError(EcompErrorName.BeDaoSystemError, "Create Resource - validateDerivedFromExist");
                        BeEcompErrorManager.getInstance().logBeDaoSystemError("Create Resource - validateDerivedFromExist");
                        log.debug("request to data model failed with error: {}", storageStatus.name());
                        ResponseFormat responseFormat = componentsUtils.getResponseFormatByResource(componentsUtils.convertFromStorageResponse(storageStatus), resource);
                        log.trace("audit before sending response");
                        componentsUtils.auditResource(responseFormat, user, resource, "", "", actionEnum, null);
                        return Either.right(responseFormat);
-               }
-
-               else if (!dataModelResponse.left().value()) {
+               } else if (!dataModelResponse.left().value()) {
                        log.info("resource template with name: {}, does not exists", templateName);
                        ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.PARENT_RESOURCE_NOT_FOUND);
                        componentsUtils.auditResource(responseFormat, user, resource, "", "", actionEnum, null);
@@ -5942,7 +6584,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                        return Either.right(responseFormat);
                }
                if (subcategories.size() > 1) {
-                       log.debug("Must be only one sub ategory for resource");
+                       log.debug("Must be only one sub category for resource");
                        ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.RESOURCE_TOO_MUCH_SUBCATEGORIES);
                        return Either.right(responseFormat);
                }
@@ -6055,6 +6697,18 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
 
        }
 
+       private Either<Boolean, ResponseFormat> validateResourceVendorModelNumber(User user, Resource resource, AuditingActionEnum actionEnum) {
+               String resourceVendorModelNumber = resource.getResourceVendorModelNumber();
+               Either<Boolean, ResponseFormat> validateResourceVendorModelNumber = validateResourceVendorModelNumber(resourceVendorModelNumber);
+               if (validateResourceVendorModelNumber.isRight()) {
+                       ResponseFormat responseFormat = validateResourceVendorModelNumber.right().value();
+                       componentsUtils.auditResource(responseFormat, user, resource, "", "", actionEnum, null);
+               }
+               return validateResourceVendorModelNumber;
+
+       }
+
+
        private Either<Boolean, ResponseFormat> validateVendorName(String vendorName) {
                if (vendorName != null) {
                        if (!ValidationUtils.validateVendorNameLength(vendorName)) {
@@ -6075,6 +6729,26 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
 
        }
 
+       private Either<Boolean, ResponseFormat> validateResourceVendorModelNumber(String resourceVendorModelNumber) {
+               if (resourceVendorModelNumber.equals("")) {
+                       return Either.left(true);
+               } else {
+                       if (!ValidationUtils.validateResourceVendorModelNumberLength(resourceVendorModelNumber)) {
+                               log.info("resource vendor model number exceeds limit.");
+                               ResponseFormat errorResponse = componentsUtils.getResponseFormat(ActionStatus.RESOURCE_VENDOR_MODEL_NUMBER_EXCEEDS_LIMIT, "" + ValidationUtils.RESOURCE_VENDOR_MODEL_NUMBER_MAX_LENGTH);
+                               return Either.right(errorResponse);
+                       }
+                       // resource vendor model number is currently validated as vendor name
+                       if (!ValidationUtils.validateVendorName(resourceVendorModelNumber)) {
+                               log.info("resource vendor model number  is not valid.");
+                               ResponseFormat errorResponse = componentsUtils.getResponseFormat(ActionStatus.INVALID_RESOURCE_VENDOR_MODEL_NUMBER);
+                               return Either.right(errorResponse);
+                       }
+                       return Either.left(true);
+               }
+       }
+
+       
        /*
         * private Either<Boolean, ResponseFormat> validateDescriptionAndCleanup(User user, Resource resource, AuditingActionEnum actionEnum) { String description = resource.getDescription(); if (!ValidationUtils.validateStringNotEmpty(description)) {
         * log.debug("Resource description is empty"); ResponseFormat errorResponse = componentsUtils.getResponseFormat(ActionStatus. COMPONENT_MISSING_DESCRIPTION, ComponentTypeEnum.RESOURCE.getValue()); componentsUtils.auditResource(errorResponse,
@@ -6339,7 +7013,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                if (inputs.isRight()) {
                        String message = "Failed when creating inputs:  for resource:" + resource.getName();
                        BeEcompErrorManager.getInstance().logInternalFlowError("ImportResource", message, ErrorSeverity.INFO);
-                       Map<String, InputDefinition> resultMap = new HashMap();
+                       Map<String, InputDefinition> resultMap = new HashMap<>();
                        return Either.left(resultMap);
 
                }
@@ -6349,6 +7023,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                return result;
        }
 
+       @SuppressWarnings("unchecked")
        private Either<GroupDefinition, ResponseFormat> createGroupInfo(String groupName, Object groupTemplateJson) {
 
                GroupDefinition groupInfo = new GroupDefinition();
@@ -6358,14 +7033,12 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                try {
                        if (groupTemplateJson != null && groupTemplateJson instanceof Map) {
                                Map<String, Object> groupTemplateJsonMap = (Map<String, Object>) groupTemplateJson;
-                               // Type
-                               String groupType = null;
-                               if (groupTemplateJsonMap.containsKey(ToscaTagNamesEnum.TYPE.getElementName())) {
-                                       groupType = (String) groupTemplateJsonMap.get(ToscaTagNamesEnum.TYPE.getElementName());
+                               String groupType = (String) groupTemplateJsonMap.get(ToscaTagNamesEnum.TYPE.getElementName());
+                               if (!StringUtils.isEmpty(groupType)) {
                                        groupInfo.setType(groupType);
                                } else {
                                        log.debug("The 'type' member is not found under group {}", groupName);
-                                       result = Either.right(componentsUtils.getResponseFormat(ActionStatus.NOT_TOPOLOGY_TOSCA_TEMPLATE));
+                                       return Either.right(componentsUtils.getResponseFormat(ActionStatus.GROUP_MISSING_GROUP_TYPE, groupName));
                                }
 
                                if (groupTemplateJsonMap.containsKey(ToscaTagNamesEnum.DESCRIPTION.getElementName())) {
@@ -6383,8 +7056,8 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                                                        }
                                                        groupInfo.setMembers(membersLoaded);
                                                } else {
-                                                       log.debug("The 'type' member is not found under group {}", groupName);
-                                                       result = Either.right(componentsUtils.getResponseFormat(ActionStatus.NOT_TOPOLOGY_TOSCA_TEMPLATE));
+                                                       log.debug("The 'members' member is not of type list under group {}", groupName);
+                                                       return Either.right(componentsUtils.getResponseFormat(ActionStatus.NOT_TOPOLOGY_TOSCA_TEMPLATE));
                                                }
                                        }
                                }
@@ -6412,6 +7085,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                return result;
        }
 
+       @SuppressWarnings("unchecked")
        private Either<List<GroupProperty>, ResponseFormat> createPropertiesValueModuleFromYaml(Object properties, String groupName, String groupType) {
 
                List<GroupProperty> result = new ArrayList<>();
@@ -6423,7 +7097,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                Either<GroupTypeDefinition, StorageOperationStatus> groupTypeRes = groupTypeOperation.getLatestGroupTypeByType(groupType, true);
 
                if (groupTypeRes.isRight()) {
-                       return Either.right(componentsUtils.getResponseFormat(ActionStatus.GROUP_MISSING_GROUP_TYPE, groupType));
+                       return Either.right(componentsUtils.getResponseFormat(ActionStatus.GROUP_TYPE_IS_INVALID, groupType));
                }
 
                Map<String, PropertyDefinition> gtProperties = new HashMap<>();
@@ -6502,7 +7176,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                return null;
        }
 
-       private Either<Map<String, List<CapabilityDefinition>>, ResponseFormat> getValidComponentInstanceCapabilities(Map<String, List<CapabilityDefinition>> defaultCapabilities, Map<String, List<UploadCapInfo>> uploadedCapabilities) {
+       private Either<Map<String, List<CapabilityDefinition>>, ResponseFormat> getValidComponentInstanceCapabilities(String resourceId, Map<String, List<CapabilityDefinition>> defaultCapabilities, Map<String, List<UploadCapInfo>> uploadedCapabilities) {
                ResponseFormat responseFormat;
                Map<String, List<CapabilityDefinition>> validCapabilitiesMap = new HashMap<>();
 
@@ -6512,14 +7186,33 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                                responseFormat = componentsUtils.getResponseFormat(ActionStatus.MISSING_CAPABILITY_TYPE, capabilityType);
                                return Either.right(responseFormat);
                        } else {
-                               CapabilityDefinition delaultCapability = defaultCapabilities.get(capabilityType).get(0);
-                               Either<Boolean, String> validationRes = validateUniquenessUpdateUploadedComponentInstanceCapability(delaultCapability, uploadedCapabilitiesEntry.getValue().get(0));
-                               if (validationRes.isRight()) {
-                                       responseFormat = componentsUtils.getResponseFormat(ActionStatus.PROPERTY_NAME_ALREADY_EXISTS, validationRes.right().value());
+                               CapabilityDefinition defaultCapability;
+                               if(CollectionUtils.isNotEmpty(defaultCapabilities.get(capabilityType).get(0).getProperties())){
+                                       defaultCapability = defaultCapabilities.get(capabilityType).get(0);
+                               } else {
+                                       Either<Component, StorageOperationStatus> getFullComponentRes = toscaOperationFacade.getToscaFullElement(resourceId);
+                                       if(getFullComponentRes.isRight()){
+                                               log.debug("Failed to get full component {}. Status is {}. ", resourceId, getFullComponentRes.right().value());
+                                               responseFormat = componentsUtils.getResponseFormat(ActionStatus.COMPONENT_NOT_FOUND, resourceId);
+                                               return Either.right(responseFormat);
+                                       }
+                                       defaultCapability = getFullComponentRes.left().value().getCapabilities().get(capabilityType).get(0);
+                               }
+                               if(CollectionUtils.isEmpty(defaultCapability.getProperties()) && CollectionUtils.isNotEmpty(uploadedCapabilitiesEntry.getValue().get(0).getProperties())){
+                                       log.debug("Failed to validate capability {} of component {}. Property list is empty. ", defaultCapability.getName(), resourceId);
+                                       log.debug("Failed to update capability property values. Property list of fetched capability {} is empty. ", defaultCapability.getName());
+                                       responseFormat = componentsUtils.getResponseFormat(ActionStatus.PROPERTY_NOT_FOUND, resourceId);
                                        return Either.right(responseFormat);
                                }
+                               if(CollectionUtils.isNotEmpty(defaultCapability.getProperties()) && CollectionUtils.isNotEmpty(uploadedCapabilitiesEntry.getValue().get(0).getProperties())){
+                                       Either<Boolean, String> validationRes = validateUniquenessUpdateUploadedComponentInstanceCapability(defaultCapability, uploadedCapabilitiesEntry.getValue().get(0));
+                                       if (validationRes.isRight()) {
+                                               responseFormat = componentsUtils.getResponseFormat(ActionStatus.PROPERTY_NAME_ALREADY_EXISTS, validationRes.right().value());
+                                               return Either.right(responseFormat);
+                                       }
+                               }
                                List<CapabilityDefinition> validCapabilityList = new ArrayList<>();
-                               validCapabilityList.add(delaultCapability);
+                               validCapabilityList.add(defaultCapability);
                                validCapabilitiesMap.put(uploadedCapabilitiesEntry.getKey(), validCapabilityList);
                        }
                }
@@ -6552,7 +7245,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
        }
 
        private Either<EnumMap<ArtifactOperationEnum, List<NonMetaArtifactInfo>>, ResponseFormat> organizeVfCsarArtifactsByArtifactOperation(List<NonMetaArtifactInfo> artifactPathAndNameList, List<ArtifactDefinition> existingArtifactsToHandle,
-                                                                                                                                                                                                                                                                                Resource resource, User user) {
+                       Resource resource, User user) {
 
                EnumMap<ArtifactOperationEnum, List<NonMetaArtifactInfo>> nodeTypeArtifactsToHandle = new EnumMap<>(ArtifactOperationEnum.class);
                Wrapper<ResponseFormat> responseWrapper = new Wrapper<>();
@@ -6615,22 +7308,29 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                return nodeTypeArtifactsToHandleRes;
        }
 
-       private String buildNestedVfcToscaNamespace(String nodeTypeFullName) {
-
-               String actualName = this.getNodeTypeActualName(nodeTypeFullName);
-               return ImportUtils.Constants.USER_DEFINED_RESOURCE_NAMESPACE_PREFIX + ResourceTypeEnum.VFC.name().toLowerCase() + actualName;
-
-       }
 
-       private String buildNestedVfcToscaResourceName(String vfResourceName, String nodeTypeFullName) {
-               String toscaResourceName;
-               String nameWithouNamespacePrefix = getNodeTypeActualName(nodeTypeFullName);
-               if (nameWithouNamespacePrefix.startsWith(Constants.ABSTRACT)) {
-                       toscaResourceName = Constants.USER_DEFINED_RESOURCE_NAMESPACE_PREFIX + ResourceTypeEnum.VFC.name().toLowerCase() + '.' + vfResourceName + '.' + nameWithouNamespacePrefix;
+       private String buildNestedToscaResourceName(String nodeResourceType, String vfResourceName, String nodeTypeFullName) {
+               String actualType;
+               String actualVfName;
+               if(ResourceTypeEnum.CVFC.name().equals(nodeResourceType)){
+                       actualVfName = vfResourceName + ResourceTypeEnum.CVFC.name();
+                       actualType = ResourceTypeEnum.VFC.name();
+               } else {
+                       actualVfName = vfResourceName;
+                       actualType = nodeResourceType;
+               }
+               StringBuilder toscaResourceName = new StringBuilder(Constants.USER_DEFINED_RESOURCE_NAMESPACE_PREFIX);
+               String nameWithouNamespacePrefix = nodeTypeFullName.substring(Constants.USER_DEFINED_RESOURCE_NAMESPACE_PREFIX.length());
+               String[] findTypes = nameWithouNamespacePrefix.split("\\.");
+               String resourceType = findTypes[0];
+               String actualName =  nameWithouNamespacePrefix.substring(resourceType.length());        
+               
+               if (actualName.startsWith(Constants.ABSTRACT)) {
+                       toscaResourceName.append(resourceType.toLowerCase()).append('.').append(ValidationUtils.convertToSystemName(actualVfName));
                } else {
-                       toscaResourceName = Constants.USER_DEFINED_RESOURCE_NAMESPACE_PREFIX + ResourceTypeEnum.VFC.name().toLowerCase() + '.' + vfResourceName + '.' + Constants.ABSTRACT + nameWithouNamespacePrefix;
+                       toscaResourceName.append(actualType.toLowerCase()).append('.').append(ValidationUtils.convertToSystemName(actualVfName)).append('.').append(Constants.ABSTRACT);
                }
-               return toscaResourceName;
+               return toscaResourceName.append(actualName.toLowerCase()).toString();
        }
 
        public ICacheMangerOperation getCacheManagerOperation() {
@@ -6642,85 +7342,14 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
        }
 
        ///////////////////////////////////////// DataModel refactoring/////////////////////////////////////////////
-
-       /*
-        * /**
-        * 
-        * @deprecated Use {@link #createOrUpdateResourceByImport(Resource,User,boolean, boolean,boolean)} instead
-        */
-       /*
-        * public Either<ImmutablePair<Resource, ActionStatus>, ResponseFormat> createOrUpdateResourceByImport(Resource resource, User user, AuditingActionEnum auditingEnum, boolean isNormative, boolean needLock) { return
-        * createOrUpdateResourceByImport(resource, user, isNormative, false, needLock); }
-        */
-
-       public Either<ImmutablePair<Resource, ActionStatus>, ResponseFormat> createOrUpdateNodeTypeByImport(Resource resource, User user, boolean isNormative, boolean isInTransaction, boolean needLock) {
-
-               // check if resource already exist
-               Either<Resource, StorageOperationStatus> latestByName = toscaOperationFacade.getLatestByName(resource.getName());
-               Either<ImmutablePair<Resource, ActionStatus>, ResponseFormat> result = null;
-
-               // create
-               if (latestByName.isRight() && latestByName.right().value().equals(StorageOperationStatus.NOT_FOUND)) {
-
-                       Either<Resource, StorageOperationStatus> latestByToscaName = toscaOperationFacade.getLatestByToscaResourceName(resource.getToscaResourceName());
-                       if (latestByToscaName.isRight() && latestByToscaName.right().value().equals(StorageOperationStatus.NOT_FOUND))
-                               result = createNodeTypeByImport(resource, user, isNormative, isInTransaction);
-
-                       else {
-                               StorageOperationStatus status = latestByName.right().value();
-                               BeEcompErrorManager.getInstance().processEcompError(EcompErrorName.BeResourceMissingError, "Create / Update resource by import", resource.getName());
-                               BeEcompErrorManager.getInstance().logBeComponentMissingError("Create / Update resource by import", ComponentTypeEnum.RESOURCE.getValue(), resource.getName());
-                               log.debug("resource already exist {}. status={}", resource.getName(), status);
-                               ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.RESOURCE_ALREADY_EXISTS);
-                               componentsUtils.auditResource(responseFormat, user, resource, "", "", AuditingActionEnum.IMPORT_RESOURCE, null);
-                               result = Either.right(responseFormat);
-                       }
-
-               }
-
-               // update
-               else if (latestByName.isLeft()) {
-                       // result = updateExistingNodeTypeByImport(resource, latestByName.left().value(), user, isNormative, needLock);
-               }
-
-               // error
-               else {
-                       StorageOperationStatus status = latestByName.right().value();
-                       BeEcompErrorManager.getInstance().processEcompError(EcompErrorName.BeResourceMissingError, "Create / Update resource by import", resource.getName());
-                       log.debug("failed to get latest version of resource {}. status={}", resource.getName(), status);
-                       ResponseFormat responseFormat = componentsUtils.getResponseFormatByResource(componentsUtils.convertFromStorageResponse(latestByName.right().value()), resource);
-                       componentsUtils.auditResource(responseFormat, user, resource, "", "", AuditingActionEnum.IMPORT_RESOURCE, null);
-                       result = Either.right(responseFormat);
-               }
-               return result;
-
-       }
-
-       private Either<ImmutablePair<Resource, ActionStatus>, ResponseFormat> createNodeTypeByImport(Resource resource, User user, boolean isNormative, boolean isInTransaction) {
-               log.debug("resource with name {} does not exist. create new resource", resource.getName());
-               Either<Resource, ResponseFormat> response = validateResourceBeforeCreate(resource, user, AuditingActionEnum.IMPORT_RESOURCE, isInTransaction);
-               if (response.isRight()) {
-                       return Either.right(response.right().value());
-               }
-
-               Either<Resource, ResponseFormat> createResponse = createResourceByDao(resource, user, AuditingActionEnum.IMPORT_RESOURCE, isNormative, isInTransaction, null);
-               if (createResponse.isRight()) {
-                       return Either.right(createResponse.right().value());
-               } else {
-                       ImmutablePair<Resource, ActionStatus> resourcePair = new ImmutablePair<>(createResponse.left().value(), ActionStatus.CREATED);
-                       ASDCKpiApi.countImportResourcesKPI();
-                       return Either.left(resourcePair);
-
-               }
-       }
-
+       @Override
        public Either<UiComponentDataTransfer, ResponseFormat> getUiComponentDataTransferByComponentId(String resourceId, List<String> dataParamsToReturn) {
 
                ComponentParametersView paramsToRetuen = new ComponentParametersView(dataParamsToReturn);
                Either<Resource, StorageOperationStatus> resourceResultEither = toscaOperationFacade.getToscaElement(resourceId, paramsToRetuen);
 
                if (resourceResultEither.isRight()) {
-                       if(resourceResultEither.right().value().equals(StorageOperationStatus.NOT_FOUND)) {
+                       if (resourceResultEither.right().value().equals(StorageOperationStatus.NOT_FOUND)) {
                                log.debug("Failed to found resource with id {} ", resourceId);
                                Either.right(componentsUtils.getResponseFormat(ActionStatus.RESOURCE_NOT_FOUND, resourceId));
                        }
@@ -6733,5 +7362,20 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                UiComponentDataTransfer dataTransfer = UiComponentDataConverter.getUiDataTransferFromResourceByParams(resource, dataParamsToReturn);
                return Either.left(dataTransfer);
        }
+       @Override
+       public Either<Component, ActionStatus> shouldUpgradeToLatestDerived(Component clonedComponent) {
+               Resource resource = (Resource) clonedComponent;
+               if (ModelConverter.isAtomicComponent(resource.getResourceType())) {
+                       Either<Component, StorageOperationStatus> shouldUpgradeToLatestDerived = toscaOperationFacade.shouldUpgradeToLatestDerived(resource);
+                       if (shouldUpgradeToLatestDerived.isRight()) {
+                               return Either.right(componentsUtils.convertFromStorageResponse(shouldUpgradeToLatestDerived.right().value()));
+                       }
+                       return Either.left(shouldUpgradeToLatestDerived.left().value());
+               } else {
+                       return super.shouldUpgradeToLatestDerived(clonedComponent);
+               }
+       }
+
+
 
 }