Fixed sdc-controller ingestion logic for cds values

sdc controller was not picking the cds values because
logic expected the values in the 'metadata' block however
the cds values exist in the 'input' block. Logic is modified
to look for values at the correct location.

Issue-ID: SO-3591
Signed-off-by: kuldipr <kuldip.rai@amdocs.com>
Change-Id: I59778fde00025e22446446df560b5f85bfda7469
Signed-off-by: kuldipr <kuldip.rai@amdocs.com>
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
index da7aad4..bc4434a 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
@@ -1471,13 +1471,30 @@
                 generateNamingValue = "true".equalsIgnoreCase(generateNaming);
             }
             service.setOnapGeneratedNaming(generateNamingValue);
-            service.setBlueprintName(serviceMetadata.getValue(CDS_MODEL_NAME));
-            service.setBlueprintVersion(serviceMetadata.getValue(CDS_MODEL_VERSION));
-            service.setSkipPostInstConf(Boolean.valueOf(serviceMetadata.getValue(SKIP_POST_INST_CONF)));
-            service.setControllerActor(serviceMetadata.getValue(CONTROLLER_ACTOR));
+
+            List<Input> serviceInputs = toscaResourceStructure.getSdcCsarHelper().getServiceInputs();
+            logger.debug("serviceInputs: {} " + serviceInputs);
+            if (!serviceInputs.isEmpty()) {
+                serviceInputs.forEach(input -> {
+                    if (CDS_MODEL_NAME.equalsIgnoreCase(input.getName())) {
+                        String value = input.getDefault() != null ? input.getDefault().toString() : null;
+                        service.setBlueprintName(value);
+                    }
+                    if (CDS_MODEL_VERSION.equalsIgnoreCase(input.getName())) {
+                        String value = input.getDefault() != null ? input.getDefault().toString() : null;
+                        service.setBlueprintVersion(value);
+                    }
+                    if (CONTROLLER_ACTOR.equalsIgnoreCase(input.getName())) {
+                        String value = input.getDefault() != null ? input.getDefault().toString() : null;
+                        service.setControllerActor(value);
+                    }
+                    if (SKIP_POST_INST_CONF.equalsIgnoreCase(input.getName())) {
+                        String value = input.getDefault() != null ? input.getDefault().toString() : "false";
+                        service.setSkipPostInstConf(Boolean.valueOf(value));
+                    }
+                });
+            }
         }
-
-
         toscaResourceStructure.setCatalogService(service);
         return service;
     }
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java
index e488211..bf327f5 100644
--- a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java
@@ -36,6 +36,7 @@
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
@@ -571,6 +572,36 @@
         doReturn(namingPolicy).when(metadata).getValue("namingPolicy");
         doReturn(ecompGeneratedNaming).when(metadata).getValue("ecompGeneratedNaming");
 
+        ISdcCsarHelper iSdcCsarHelper = mock(ISdcCsarHelper.class);
+        List<Input> serviceInputs = new ArrayList<Input>();
+
+        LinkedHashMap<String, Object> value = new LinkedHashMap<String, Object>();
+        value.put("controller_actor", "SO-REF-DATA");
+        value.put("type", "string");
+        Input input = new Input("controller_actor", value, null);
+        serviceInputs.add(0, input);
+
+        value = new LinkedHashMap<String, Object>();
+        value.put("cds_model_version", "v1.4.0");
+        value.put("type", "string");
+        input = new Input("cds_model_version", value, null);
+        serviceInputs.add(1, input);
+
+        value = new LinkedHashMap<String, Object>();
+        value.put("cds_model_name", "Blueprint140");
+        value.put("type", "string");
+        input = new Input("cds_model_name", value, null);
+        serviceInputs.add(2, input);
+
+        value = new LinkedHashMap<String, Object>();
+        value.put("skip_post_instantiation_configuration", "false");
+        value.put("type", "boolean");
+        input = new Input("skip_post_instantiation_configuration", value, null);
+        serviceInputs.add(3, input);
+
+        doReturn(iSdcCsarHelper).when(toscaResourceStructure).getSdcCsarHelper();
+        doReturn(serviceInputs).when(iSdcCsarHelper).getServiceInputs();
+
         Service service = toscaInstaller.createService(toscaResourceStructure, resourceStructure);
 
         assertNotNull(service);
diff --git a/asdc-controller/src/test/resources/download/service-pnfservice.csar b/asdc-controller/src/test/resources/download/service-pnfservice.csar
index 89d24a1..a026c7a 100644
--- a/asdc-controller/src/test/resources/download/service-pnfservice.csar
+++ b/asdc-controller/src/test/resources/download/service-pnfservice.csar
Binary files differ
diff --git a/asdc-controller/src/test/resources/download/service-vnfservice.csar b/asdc-controller/src/test/resources/download/service-vnfservice.csar
index 25d2ebd..1dcfb59 100644
--- a/asdc-controller/src/test/resources/download/service-vnfservice.csar
+++ b/asdc-controller/src/test/resources/download/service-vnfservice.csar
Binary files differ