Fix restricting valid values for ONAP service metadata 89/119989/1
authordavsad <david.sadlier@est.tech>
Mon, 29 Mar 2021 13:20:02 +0000 (14:20 +0100)
committerDavid Sadlier <david.sadlier@est.tech>
Mon, 29 Mar 2021 18:17:50 +0000 (18:17 +0000)
Issue-ID: SDC-3539

Signed-off-by: davsad <david.sadlier@est.tech>
Change-Id: I10658e29bc986f9fd9c5d5d6ce34d0bd02d70e11

catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java

index efb3f49..10d2130 100644 (file)
@@ -151,6 +151,7 @@ public class ToscaExportHandler {
     private static final String FAILED_TO_GET_DEFAULT_IMPORTS_CONFIGURATION = "convertToToscaTemplate - failed to get Default Imports section from configuration";
     private static final String NOT_SUPPORTED_COMPONENT_TYPE = "Not supported component type {}";
     private static final String NATIVE_ROOT = "tosca.nodes.Root";
+    private static final List<String> EXCLUDED_CATEGORY_SPECIFIC_METADATA = List.of("Service Function", "Service Role", "Naming Policy", "Service Type");
     private static final YamlUtil yamlUtil = new YamlUtil();
     private ApplicationDataTypeCache dataTypeCache;
     private ToscaOperationFacade toscaOperationFacade;
@@ -482,7 +483,8 @@ public class ToscaExportHandler {
                 log.debug(NOT_SUPPORTED_COMPONENT_TYPE, component.getComponentType());
         }
         for (final String key : component.getCategorySpecificMetadata().keySet()) {
-            toscaMetadata.put(key, component.getCategorySpecificMetadata().get(key));
+            if (!EXCLUDED_CATEGORY_SPECIFIC_METADATA.contains(key))
+                toscaMetadata.put(key, component.getCategorySpecificMetadata().get(key));
         }
         return toscaMetadata;
     }