diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceAssignmentProcessor.kt
index 1c5455f..e389f36 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceAssignmentProcessor.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceAssignmentProcessor.kt
@@ -17,24 +17,50 @@
 
 package org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.processor
 
+import com.fasterxml.jackson.databind.node.NullNode
+import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
 import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment
+import org.slf4j.LoggerFactory
 import org.springframework.stereotype.Service
 
 /**
  * DefaultResourceAssignmentProcessor
  *
- * @author Brinda Santh
+ * @author Kapil Singal
  */
 @Service("resource-assignment-processor-default")
 open class DefaultResourceAssignmentProcessor : ResourceAssignmentProcessor() {
 
+    private val logger = LoggerFactory.getLogger(DefaultResourceAssignmentProcessor::class.java)
+
     override fun getName(): String {
         return "resource-assignment-processor-default"
     }
 
-    override fun process(executionRequest: ResourceAssignment) {
+    override fun process(resourceAssignment: ResourceAssignment) {
+        try {
+            // Check if It has Input
+            var value: Any? = raRuntimeService.getInputValue(resourceAssignment.name)
+
+            // If value is null get it from default source
+            if (value == null || value is NullNode) {
+                logger.info("Looking for defaultValue as couldn't find value in input For template key (${resourceAssignment.name})")
+                value = resourceAssignment.property?.defaultValue
+            }
+
+            logger.info("For template key (${resourceAssignment.name}) setting value as ($value)")
+            ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, value)
+
+            // Check the value has populated for mandatory case
+            ResourceAssignmentUtils.assertTemplateKeyValueNotNull(resourceAssignment)
+        } catch (e: Exception) {
+            ResourceAssignmentUtils.setFailedResourceDataValue(resourceAssignment, e.message)
+            throw BluePrintProcessorException("Failed in template key ($resourceAssignment) assignments with: ${e.message}", e)
+        }
+
     }
 
-    override fun recover(runtimeException: RuntimeException, executionRequest: ResourceAssignment) {
+    override fun recover(runtimeException: RuntimeException, resourceAssignment: ResourceAssignment) {
     }
 }
\ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/PrimaryDataResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/PrimaryDataResourceAssignmentProcessor.kt
index 2b3270e..9427183 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/PrimaryDataResourceAssignmentProcessor.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/PrimaryDataResourceAssignmentProcessor.kt
@@ -33,7 +33,7 @@
 /**
  * PrimaryDataResourceAssignmentProcessor
  *
- * @author Brinda Santh
+ * @author Kapil Singal
  */
 @Service("resource-assignment-processor-primary-db")
 open class PrimaryDataResourceAssignmentProcessor(private val primaryDBLibGenericService: PrimaryDBLibGenericService)
@@ -54,27 +54,27 @@
             if (value != null && value !is NullNode) {
                 logger.info("primary-db source template key (${resourceAssignment.name}) found from input and value is ($value)")
                 ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, value)
-                return
-            }
-
-            val dName = resourceAssignment.dictionaryName
-            val dSource = resourceAssignment.dictionarySource
-            val resourceDefinition = resourceDictionaries[dName]
-                    ?: throw BluePrintProcessorException("couldn't get resource dictionary definition for $dName")
-            val resourceSource = resourceDefinition.sources[dSource]
-                    ?: throw BluePrintProcessorException("couldn't get resource definition $dName source($dSource)")
-            val resourceSourceProperties = checkNotNull(resourceSource.properties) { "failed to get source properties for $dName " }
-            val sourceProperties = JacksonUtils.getInstanceFromMap(resourceSourceProperties, DatabaseResourceSource::class.java)
-            val sql = checkNotNull(sourceProperties.query) { "failed to get request query for $dName under $dSource properties" }
-            val inputKeyMapping = checkNotNull(sourceProperties.inputKeyMapping) { "failed to get input-key-mappings for $dName under $dSource properties" }
-
-            logger.info("$dSource dictionary information : ($sql), ($inputKeyMapping), (${sourceProperties.outputKeyMapping})")
-
-            val rows = primaryDBLibGenericService.query(sql, populateNamedParameter(inputKeyMapping))
-            if (rows.isNullOrEmpty()) {
-                logger.warn("Failed to get $dSource result for dictionary name ($dName) the query ($sql)")
             } else {
-                processDBResults(resourceAssignment, sourceProperties, rows)
+                val dName = resourceAssignment.dictionaryName
+                val dSource = resourceAssignment.dictionarySource
+                val resourceDefinition = resourceDictionaries[dName]
+                        ?: throw BluePrintProcessorException("couldn't get resource dictionary definition for $dName")
+                val resourceSource = resourceDefinition.sources[dSource]
+                        ?: throw BluePrintProcessorException("couldn't get resource definition $dName source($dSource)")
+                val resourceSourceProperties = checkNotNull(resourceSource.properties) { "failed to get source properties for $dName " }
+                val sourceProperties = JacksonUtils.getInstanceFromMap(resourceSourceProperties, DatabaseResourceSource::class.java)
+
+                val sql = checkNotNull(sourceProperties.query) { "failed to get request query for $dName under $dSource properties" }
+                val inputKeyMapping = checkNotNull(sourceProperties.inputKeyMapping) { "failed to get input-key-mappings for $dName under $dSource properties" }
+
+                logger.info("$dSource dictionary information : ($sql), ($inputKeyMapping), (${sourceProperties.outputKeyMapping})")
+
+                val rows = primaryDBLibGenericService.query(sql, populateNamedParameter(inputKeyMapping))
+                if (rows.isNullOrEmpty()) {
+                    logger.warn("Failed to get $dSource result for dictionary name ($dName) the query ($sql)")
+                } else {
+                    populateResource(resourceAssignment, sourceProperties, rows)
+                }
             }
 
             // Check the value has populated for mandatory case
@@ -106,7 +106,7 @@
     }
 
     @Throws(BluePrintProcessorException::class)
-    private fun processDBResults(resourceAssignment: ResourceAssignment, sourceProperties: DatabaseResourceSource, rows: List<Map<String, Any>>) {
+    private fun populateResource(resourceAssignment: ResourceAssignment, sourceProperties: DatabaseResourceSource, rows: List<Map<String, Any>>) {
         val dName = resourceAssignment.dictionaryName
         val dSource = resourceAssignment.dictionarySource
         val type = nullToEmpty(resourceAssignment.property?.type)
@@ -115,21 +115,17 @@
         logger.info("Response processing type($type)")
 
         // Primitive Types
-        if (BluePrintTypes.validPrimitiveTypes().contains(type)) {
-            val dbColumnValue = rows[0][outputKeyMapping[dName]]
-            ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, dbColumnValue)
-        }
-        // Array Types
-        else if (BluePrintTypes.validCollectionTypes().contains(type)) {
-            lateinit var entrySchemaType: String
-            if (resourceAssignment.property?.entrySchema != null) {
-                entrySchemaType = nullToEmpty(resourceAssignment.property?.entrySchema?.type)
+        when(type) {
+            in BluePrintTypes.validPrimitiveTypes() -> {
+                val dbColumnValue = rows[0][outputKeyMapping[dName]]
+                logger.info("For template key (${resourceAssignment.name}) setting value as ($dbColumnValue)")
+                ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, dbColumnValue)
             }
-
-            if (checkNotEmptyOrThrow(entrySchemaType, "Entry schema is not defined for dictionary ($dName) info")) {
-                val arrayNode = JsonNodeFactory.instance.arrayNode()
+            in BluePrintTypes.validCollectionTypes() -> {
+                val entrySchemaType = returnNotEmptyOrThrow(resourceAssignment.property?.entrySchema?.type) { "Entry schema is not defined for dictionary ($dName) info" }
+                var arrayNode = JsonNodeFactory.instance.arrayNode()
                 rows.forEach {
-                    if (BluePrintTypes.validPrimitiveTypes().contains(entrySchemaType)) {
+                    if (entrySchemaType in BluePrintTypes.validPrimitiveTypes()) {
                         val dbColumnValue = it[outputKeyMapping[dName]]
                         // Add Array JSON
                         JacksonUtils.populatePrimitiveValues(dbColumnValue!!, entrySchemaType, arrayNode)
@@ -143,19 +139,22 @@
                         arrayNode.add(arrayChildNode)
                     }
                 }
+                logger.info("For template key (${resourceAssignment.name}) setting value as ($arrayNode)")
                 // Set the List of Complex Values
                 ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, arrayNode)
             }
-        } else {
-            // Complex Types
-            val row = rows[0]
-            val objectNode = JsonNodeFactory.instance.objectNode()
-            for (mapping in outputKeyMapping.entries) {
-                val dbColumnValue = checkNotNull(row[mapping.key])
-                val propertyTypeForDataType = ResourceAssignmentUtils.getPropertyType(raRuntimeService, type, mapping.key)
-                JacksonUtils.populatePrimitiveValues(mapping.key, dbColumnValue, propertyTypeForDataType, objectNode)
+            else -> {
+                // Complex Types
+                val row = rows[0]
+                var objectNode = JsonNodeFactory.instance.objectNode()
+                for (mapping in outputKeyMapping.entries) {
+                    val dbColumnValue = checkNotNull(row[mapping.key])
+                    val propertyTypeForDataType = ResourceAssignmentUtils.getPropertyType(raRuntimeService, type, mapping.key)
+                    JacksonUtils.populatePrimitiveValues(mapping.key, dbColumnValue, propertyTypeForDataType, objectNode)
+                }
+                logger.info("For template key (${resourceAssignment.name}) setting value as ($objectNode)")
+                ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, objectNode)
             }
-            ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, objectNode)
         }
     }
 
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/SimpleRestResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/SimpleRestResourceAssignmentProcessor.kt
index e05261d..f1a4dbb 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/SimpleRestResourceAssignmentProcessor.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/SimpleRestResourceAssignmentProcessor.kt
@@ -17,24 +17,146 @@
 
 package org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.processor
 
+import com.fasterxml.jackson.databind.node.ArrayNode
+import com.fasterxml.jackson.databind.node.JsonNodeFactory
+import com.fasterxml.jackson.databind.node.NullNode
+import com.fasterxml.jackson.databind.node.ObjectNode
+import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.RestResourceSource
+import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils
+import org.onap.ccsdk.apps.blueprintsprocessor.rest.service.BluePrintRestLibPropertyService
+import org.onap.ccsdk.apps.controllerblueprints.core.*
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
 import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDictionaryConstants
+import org.slf4j.LoggerFactory
 import org.springframework.stereotype.Service
 
 /**
  * SimpleRestResourceAssignmentProcessor
  *
- * @author Brinda Santh
+ * @author Kapil Singal
  */
-@Service("resource-assignment-processor-mdsal")
-open class SimpleRestResourceAssignmentProcessor : ResourceAssignmentProcessor() {
+@Service("resource-assignment-processor-primary-config-data")
+open class SimpleRestResourceAssignmentProcessor(private val blueprintRestLibPropertyService: BluePrintRestLibPropertyService)
+    : ResourceAssignmentProcessor() {
+
+    private val logger = LoggerFactory.getLogger(SimpleRestResourceAssignmentProcessor::class.java)
 
     override fun getName(): String {
-        return "resource-assignment-processor-mdsal"
+        return "resource-assignment-processor-primary-config-data"
     }
 
-    override fun process(executionRequest: ResourceAssignment) {
+    override fun process(resourceAssignment: ResourceAssignment) {
+        try {
+            validate(resourceAssignment)
+
+            // Check if It has Input
+            val value = raRuntimeService.getInputValue(resourceAssignment.name)
+            if (value != null && value !is NullNode) {
+                logger.info("primary-db source template key (${resourceAssignment.name}) found from input and value is ($value)")
+                ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, value)
+            } else {
+                val dName = resourceAssignment.dictionaryName
+                val dSource = resourceAssignment.dictionarySource
+                val resourceDefinition = resourceDictionaries[dName]
+                        ?: throw BluePrintProcessorException("couldn't get resource dictionary definition for $dName")
+                val resourceSource = resourceDefinition.sources[dSource]
+                        ?: throw BluePrintProcessorException("couldn't get resource definition $dName source($dSource)")
+                val resourceSourceProperties = checkNotNull(resourceSource.properties) { "failed to get source properties for $dName " }
+                val sourceProperties = JacksonUtils.getInstanceFromMap(resourceSourceProperties, RestResourceSource::class.java)
+
+                val urlPath = checkNotNull(sourceProperties.urlPath) { "failed to get request urlPath for $dName under $dSource properties" }
+                val path = nullToEmpty(sourceProperties.path)
+                val inputKeyMapping = checkNotNull(sourceProperties.inputKeyMapping) { "failed to get input-key-mappings for $dName under $dSource properties" }
+
+                logger.info("$dSource dictionary information : ($urlPath), ($inputKeyMapping), (${sourceProperties.outputKeyMapping})")
+
+                val restClientService = blueprintRestLibPropertyService.blueprintWebClientService("primary-config-data")
+                val response = restClientService.getResource(urlPath, String::class.java)
+                if (response.isNotBlank()) {
+                    logger.warn("Failed to get $dSource result for dictionary name ($dName) using urlPath ($urlPath)")
+                } else {
+                    populateResource(resourceAssignment, sourceProperties, response, path)
+                }
+            }
+            // Check the value has populated for mandatory case
+            ResourceAssignmentUtils.assertTemplateKeyValueNotNull(resourceAssignment)
+        } catch (e: Exception) {
+            ResourceAssignmentUtils.setFailedResourceDataValue(resourceAssignment, e.message)
+            throw BluePrintProcessorException("Failed in template key ($resourceAssignment) assignments with: ${e.message}", e)
+        }
     }
 
-    override fun recover(runtimeException: RuntimeException, executionRequest: ResourceAssignment) {
+    @Throws(BluePrintProcessorException::class)
+    private fun populateResource(resourceAssignment: ResourceAssignment, sourceProperties: RestResourceSource, restResponse: String, path: String) {
+        val dName = resourceAssignment.dictionaryName
+        val dSource = resourceAssignment.dictionarySource
+        val type = nullToEmpty(resourceAssignment.property?.type)
+        lateinit var entrySchemaType: String
+
+        val outputKeyMapping = checkNotNull(sourceProperties.outputKeyMapping) { "failed to get output-key-mappings for $dName under $dSource properties" }
+        logger.info("Response processing type($type)")
+
+        val responseNode = checkNotNull(JacksonUtils.jsonNode(restResponse).at(path)) { "Failed to find path ($path) in response ($restResponse)" }
+        logger.info("populating value for output mapping ($outputKeyMapping), from json ($responseNode)")
+
+
+        when (type) {
+            in BluePrintTypes.validPrimitiveTypes() -> {
+                logger.info("For template key (${resourceAssignment.name}) setting value as ($responseNode)")
+                ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, responseNode)
+            }
+            in BluePrintTypes.validCollectionTypes() -> {
+                // Array Types
+                entrySchemaType = returnNotEmptyOrThrow(resourceAssignment.property?.entrySchema?.type) { "Entry schema is not defined for dictionary ($dName) info" }
+                val arrayNode = responseNode as ArrayNode
+
+                if (entrySchemaType !in BluePrintTypes.validPrimitiveTypes()) {
+                    val responseArrayNode = responseNode.toList()
+                    for (responseSingleJsonNode in responseArrayNode) {
+                        val arrayChildNode = JsonNodeFactory.instance.objectNode()
+                        outputKeyMapping.map {
+                            val responseKeyValue = responseSingleJsonNode.get(it.key)
+                            val propertyTypeForDataType = ResourceAssignmentUtils.getPropertyType(raRuntimeService, entrySchemaType, it.key)
+                            logger.info("For List Type Resource: key (${it.key}), value ($responseKeyValue), type  ({$propertyTypeForDataType})")
+                            JacksonUtils.populateJsonNodeValues(it.value, responseKeyValue, propertyTypeForDataType, arrayChildNode)
+                        }
+                        arrayNode.add(arrayChildNode)
+                    }
+                }
+                logger.info("For template key (${resourceAssignment.name}) setting value as ($arrayNode)")
+                // Set the List of Complex Values
+                ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, arrayNode)
+            }
+            else -> {
+                // Complex Types
+                val objectNode = responseNode as ObjectNode
+                outputKeyMapping.map {
+                    val responseKeyValue = responseNode.get(it.key)
+                    val propertyTypeForDataType = ResourceAssignmentUtils.getPropertyType(raRuntimeService, entrySchemaType, it.key)
+                    logger.info("For List Type Resource: key (${it.key}), value ($responseKeyValue), type  ({$propertyTypeForDataType})")
+                    JacksonUtils.populateJsonNodeValues(it.value, responseKeyValue, propertyTypeForDataType, objectNode)
+                }
+
+                logger.info("For template key (${resourceAssignment.name}) setting value as ($objectNode)")
+                // Set the List of Complex Values
+                ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, objectNode)
+            }
+        }
     }
+
+    @Throws(BluePrintProcessorException::class)
+    private fun validate(resourceAssignment: ResourceAssignment) {
+        checkNotEmptyOrThrow(resourceAssignment.name, "resource assignment template key is not defined")
+        checkNotEmptyOrThrow(resourceAssignment.dictionaryName, "resource assignment dictionary name is not defined for template key (${resourceAssignment.name})")
+        checkEqualsOrThrow(ResourceDictionaryConstants.SOURCE_PRIMARY_CONFIG_DATA, resourceAssignment.dictionarySource) {
+            "resource assignment source is not ${ResourceDictionaryConstants.SOURCE_PRIMARY_CONFIG_DATA} but it is ${resourceAssignment.dictionarySource}"
+        }
+        checkNotEmptyOrThrow(resourceAssignment.dictionaryName, "resource assignment dictionary name is not defined for template key (${resourceAssignment.name})")
+    }
+
+    override fun recover(runtimeException: RuntimeException, resourceAssignment: ResourceAssignment) {
+    }
+
+
 }
\ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt
index 9a846d6..ef69eb5 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt
@@ -65,7 +65,7 @@
     fun testRegisteredSource() {
         val sources = resourceResolutionService.registeredResourceSources()
         assertNotNull(sources, "failed to get registered sources")
-        assertTrue(sources.containsAll(arrayListOf("input", "default", "primary-db", "mdsal")), "failed to get registered sources")
+        assertTrue(sources.containsAll(arrayListOf("input", "default", "primary-db", "primary-config-data")), "failed to get registered sources")
     }
 
     @Test
