diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/CsarInfo.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/CsarInfo.java
index ce6d60b..58beecb 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/CsarInfo.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/CsarInfo.java
@@ -43,12 +43,14 @@
 import org.yaml.snakeyaml.Yaml;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
 import java.util.PriorityQueue;
 import java.util.Queue;
+import java.util.Set;
 import java.util.regex.Pattern;
 
 import static org.openecomp.sdc.be.components.impl.ImportUtils.ResultStatusEnum;
@@ -144,20 +146,25 @@
     @SuppressWarnings("unchecked")
     private void extractNodeTypeInfo(Map<String, NodeTypeInfo> nodeTypesInfo,
                                      List<Map.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())) {
+        if (isAServiceTemplate(entry.getKey())) {
+            if (isGlobalSubstitute(entry.getKey())) {
+                globalSubstitutes.add(entry);
+            } else {
                 Map<String, Object> mappedToscaTemplate = (Map<String, Object>) new Yaml().load(new String(entry.getValue()));
                 findToscaElement(mappedToscaTemplate, TypeUtils.ToscaTagNamesEnum.SUBSTITUTION_MAPPINGS, ToscaElementTypeEnum.MAP)
                     .right()
                     .on(sub->handleSubstitutionMappings(nodeTypesInfo, entry, mappedToscaTemplate, (Map<String, Object>)sub));
-            }else {
-                globalSubstitutes.add(entry);
             }
         }
     }
+    
+    private boolean isAServiceTemplate(final String filePath) {
+      return Pattern.compile(CsarUtils.SERVICE_TEMPLATE_PATH_PATTERN).matcher(filePath).matches();
+  }
 
     private ResultStatusEnum handleSubstitutionMappings(Map<String, NodeTypeInfo> nodeTypesInfo, Map.Entry<String, byte[]> entry, Map<String, Object> mappedToscaTemplate, Map<String, Object> substitutionMappings) {
-        if (substitutionMappings.containsKey(TypeUtils.ToscaTagNamesEnum.NODE_TYPE.getElementName())) {
+      final Set<String> nodeTypesDefinedInTemplate = findNodeTypesDefinedInTemplate(mappedToscaTemplate);  
+      if (substitutionMappings.containsKey(TypeUtils.ToscaTagNamesEnum.NODE_TYPE.getElementName()) && !nodeTypesDefinedInTemplate.contains(substitutionMappings.get(TypeUtils.ToscaTagNamesEnum.NODE_TYPE.getElementName()))) {
             NodeTypeInfo nodeTypeInfo = new NodeTypeInfo();
             nodeTypeInfo.setSubstitutionMapping(true);
             nodeTypeInfo.setType(
@@ -168,6 +175,17 @@
         }
         return ResultStatusEnum.OK;
     }
+    
+    @SuppressWarnings("unchecked")
+    private Set<String> findNodeTypesDefinedInTemplate(final Map<String, Object> mappedToscaTemplate) {     
+        final Either<Object, ResultStatusEnum> nodeTypesEither = findToscaElement(mappedToscaTemplate,
+                TypeUtils.ToscaTagNamesEnum.NODE_TYPES, ToscaElementTypeEnum.MAP);
+        if (nodeTypesEither.isLeft()) {
+            final Map<String, Object> nodeTypes = (Map<String, Object>) nodeTypesEither.left().value();
+            return nodeTypes.keySet();
+        }
+        return Collections.emptySet();
+    }
 
     private boolean isGlobalSubstitute(String fileName) {
         return fileName.equalsIgnoreCase(Constants.GLOBAL_SUBSTITUTION_TYPES_SERVICE_TEMPLATE)
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/csar/CsarInfoTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/csar/CsarInfoTest.java
index 62fd3f9..a28e2ef 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/csar/CsarInfoTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/csar/CsarInfoTest.java
@@ -75,14 +75,19 @@
     @Before
     public void setup() throws ZipException, URISyntaxException {
         // given
-        final File csarFile = new File(CsarInfoTest.class.getClassLoader().getResource(PAYLOAD_NAME).toURI());
-        final Map<String, byte[]> payload = ZipUtils.readZip(csarFile, false);
-        String mainTemplateContent = new String(payload.get(MAIN_TEMPLATE_NAME));
+        csarInfo = createCsarInfo(PAYLOAD_NAME, MAIN_TEMPLATE_NAME);
 
-        csarInfo = new CsarInfo(user, CSAR_UUID, payload, RESOURCE_NAME,
-                MAIN_TEMPLATE_NAME, mainTemplateContent, true);
         new ConfigurationManager(new FSConfigurationSource(ExternalConfiguration.getChangeListener(), "src/test/resources/config/catalog-be"));
     }
+    
+    private CsarInfo createCsarInfo(final String csarFileName, final String mainTemplateName) throws URISyntaxException, ZipException {
+      final File csarFile = new File(CsarInfoTest.class.getClassLoader().getResource(csarFileName).toURI());
+      final Map<String, byte[]> payload = ZipUtils.readZip(csarFile, false);
+      String mainTemplateContent = new String(payload.get(mainTemplateName));
+
+      return new CsarInfo(user, CSAR_UUID, payload, RESOURCE_NAME,
+              mainTemplateName, mainTemplateContent, true);
+  }
 
     @Test
     public void add2TimesTheSameNodeTest() {
@@ -151,4 +156,15 @@
         final Optional<String> softwareInformationPath = csarInfo.getSoftwareInformationPath();
         assertThat("The software information yaml path should not be present", softwareInformationPath.isPresent(), is(false));
     }
+    
+    @SuppressWarnings("unchecked")
+    @Test
+    public void testCreateCsarInfoEtsiVnf() throws URISyntaxException, ZipException {
+        final CsarInfo csarInfo = createCsarInfo("etsi_vnf.csar", "Definitions/MainServiceTemplate.yaml");
+        
+        final String nodeTypeInSubstitutionMapping = (String) ((Map<String, Object>)((Map<String, Object>)csarInfo.getMappedToscaMainTemplate().get("topology_template")).get("substitution_mappings")).get("node_type");
+        assertTrue(((Map<String, Object>) csarInfo.getMappedToscaMainTemplate().get("node_types")).containsKey(nodeTypeInSubstitutionMapping));
+        
+        assertTrue(csarInfo.extractNodeTypesInfo().isEmpty());
+    }
 }
diff --git a/catalog-be/src/test/resources/etsi_vnf.csar b/catalog-be/src/test/resources/etsi_vnf.csar
new file mode 100644
index 0000000..93e62bc
--- /dev/null
+++ b/catalog-be/src/test/resources/etsi_vnf.csar
Binary files differ
