diff --git a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/config/model/ResourceDictionaryUtilsTest.java b/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/config/model/ResourceDictionaryUtilsTest.java
new file mode 100644
index 0000000..1b3dc9c
--- /dev/null
+++ b/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/config/model/ResourceDictionaryUtilsTest.java
@@ -0,0 +1,216 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.config.model;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import org.junit.Assert;
+import org.junit.Test;
+import org.onap.ccsdk.config.model.data.PropertyDefinition;
+import org.onap.ccsdk.config.model.data.ResourceAssignment;
+import org.onap.ccsdk.config.model.data.dict.ResourceDefinition;
+import org.onap.ccsdk.config.model.data.dict.SourcesDefinition;
+import org.onap.ccsdk.config.model.data.dict.SourcesProperties;
+import org.onap.ccsdk.config.model.utils.ResourceDictionaryUtils;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+
+public class ResourceDictionaryUtilsTest {
+    private static EELFLogger logger = EELFManager.getInstance().getLogger(ResourceDictionaryUtilsTest.class);
+
+    @Test
+    public void validateSingleInputSource() {
+        try {
+            logger.info(" **************** Validating validateSingleInputSource *****************");
+            ResourceAssignment resourceAssignment = new ResourceAssignment();
+            resourceAssignment.setName("test-input-key");
+
+            PropertyDefinition propertyDefinition = new PropertyDefinition();
+            propertyDefinition.setType(ValidTypes.DATA_TYPE_STRING);
+
+            SourcesProperties sourcesProp = new SourcesProperties();
+            sourcesProp.setDependencies(Arrays.asList(new String[] {"vnf-id", "vnf-name"}));
+
+            SourcesDefinition sourceDef = new SourcesDefinition();
+            sourceDef.setProperties(sourcesProp);
+
+            HashMap<String, SourcesDefinition> sources = new HashMap<>();
+            sources.put("input", sourceDef);
+
+            ResourceDefinition resourceDefinition = new ResourceDefinition();
+            resourceDefinition.setProperty(propertyDefinition);
+            resourceDefinition.setSources(sources);
+
+            ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, resourceDefinition);
+
+            Assert.assertNotNull("Resource assignment input sourceName is missing ",
+                    resourceAssignment.getDictionarySource());
+            Assert.assertNotNull("Resource assignment input sourceName property is missing ",
+                    resourceAssignment.getProperty());
+            Assert.assertNotNull("Resource assignment input sourceName property type is missing ",
+                    resourceAssignment.getProperty().getType());
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Test
+    public void validateSingleDbSource() {
+        try {
+            logger.info(" **************** Validating validateSingleDbSource *****************");
+            ResourceAssignment resourceAssignment = new ResourceAssignment();
+            resourceAssignment.setName("test-db-key");
+
+            PropertyDefinition propertyDefinition = new PropertyDefinition();
+            propertyDefinition.setType(ValidTypes.DATA_TYPE_STRING);
+
+            SourcesProperties sourcesProp = new SourcesProperties();
+            sourcesProp.setDependencies(Arrays.asList(new String[] {"vnf-id", "vnf-name"}));
+
+            SourcesDefinition sourceDef = new SourcesDefinition();
+            sourceDef.setProperties(sourcesProp);
+
+            HashMap<String, SourcesDefinition> sources = new HashMap<>();
+            sources.put("db", sourceDef);
+
+            ResourceDefinition resourceDefinition = new ResourceDefinition();
+            resourceDefinition.setProperty(propertyDefinition);
+            resourceDefinition.setSources(sources);
+
+            ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, resourceDefinition);
+            Assert.assertNotNull("Resource assignment db sourceName sourceName is missing ",
+                    resourceAssignment.getDictionarySource());
+            Assert.assertNotNull("Resource assignment db sourceName sourceName property is missing ",
+                    resourceAssignment.getProperty());
+            Assert.assertNotNull("Resource assignment db sourceName sourceName property type is missing ",
+                    resourceAssignment.getProperty().getType());
+
+            Assert.assertNotNull("Resource assignment db dependecy is missing ", resourceAssignment.getDependencies());
+            Assert.assertEquals("Resource assignment db dependecy count mismatch ", 2,
+                    resourceAssignment.getDependencies().size());
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Test
+    public void validateMultiSource() {
+        try {
+            logger.info(" **************** Validating validateMultiSource *****************");
+            ResourceAssignment resourceAssignment = new ResourceAssignment();
+            resourceAssignment.setName("test-multi-key");
+
+            PropertyDefinition propertyDefinition = new PropertyDefinition();
+            propertyDefinition.setType(ValidTypes.DATA_TYPE_STRING);
+
+            SourcesProperties sourcesProp = new SourcesProperties();
+            sourcesProp.setDependencies(Arrays.asList(new String[] {"vnf-id", "vnf-name"}));
+
+            SourcesDefinition sourceDef = new SourcesDefinition();
+            sourceDef.setProperties(sourcesProp);
+
+            HashMap<String, SourcesDefinition> sources = new HashMap<>();
+            sources.put("input", sourceDef);
+            sources.put("mdsal", sourceDef);
+
+            ResourceDefinition resourceDefinition = new ResourceDefinition();
+            resourceDefinition.setProperty(propertyDefinition);
+            resourceDefinition.setSources(sources);
+
+            ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, resourceDefinition);
+            Assert.assertNotNull("Resource assignment db sourceName sourceName property is missing ",
+                    resourceAssignment.getProperty());
+            Assert.assertNotNull("Resource assignment db sourceName sourceName property type is missing ",
+                    resourceAssignment.getProperty().getType());
+            Assert.assertNull("Resource assignment multi sourceName sourceName definition is present ",
+                    resourceAssignment.getDictionarySource());
+            Assert.assertNull("Resource assignment  multi sourceName dependecy is present ",
+                    resourceAssignment.getDependencies());
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Test
+    public void testSourceDefault() {
+        logger.info(" **************** Validating testSourceDefault *****************");
+        ResourceAssignment resourceAssignment = new ResourceAssignment();
+        resourceAssignment.setName("test-input-key");
+
+        PropertyDefinition propertyDefinition = new PropertyDefinition();
+        propertyDefinition.setType(ValidTypes.DATA_TYPE_STRING);
+
+        SourcesProperties sourcesProp = new SourcesProperties();
+        sourcesProp.setDependencies(Arrays.asList(new String[] {"vnf-id", "vnf-name"}));
+
+        SourcesDefinition sourceDef = new SourcesDefinition();
+        sourceDef.setProperties(sourcesProp);
+
+        HashMap<String, SourcesDefinition> sources = new HashMap<>();
+        sources.put("default", sourceDef);
+
+        ResourceDefinition resourceDefinition = new ResourceDefinition();
+        resourceDefinition.setProperty(propertyDefinition);
+        resourceDefinition.setSources(sources);
+
+        ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, resourceDefinition);
+
+        Assert.assertNotNull("Resource assignment default sourceName is missing ",
+                resourceAssignment.getDictionarySource());
+        Assert.assertNotNull("Resource assignment default sourceName property is missing ",
+                resourceAssignment.getProperty());
+        Assert.assertNotNull("Resource assignment default sourceName property type is missing ",
+                resourceAssignment.getProperty().getType());
+    }
+
+    @Test
+    public void testSourceMdsal() {
+        logger.info(" **************** Validating testSourceMdsal *****************");
+        ResourceAssignment resourceAssignment = new ResourceAssignment();
+        resourceAssignment.setName("test-input-key");
+
+        PropertyDefinition propertyDefinition = new PropertyDefinition();
+        propertyDefinition.setType(ValidTypes.DATA_TYPE_STRING);
+
+        SourcesProperties sourcesProp = new SourcesProperties();
+        sourcesProp.setDependencies(Arrays.asList(new String[] {"vnf-id", "vnf-name"}));
+
+        SourcesDefinition sourceDef = new SourcesDefinition();
+        sourceDef.setProperties(sourcesProp);
+
+        HashMap<String, SourcesDefinition> sources = new HashMap<>();
+        sources.put("mdsal", sourceDef);
+
+        ResourceDefinition resourceDefinition = new ResourceDefinition();
+        resourceDefinition.setProperty(propertyDefinition);
+        resourceDefinition.setSources(sources);
+
+        ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, resourceDefinition);
+
+        Assert.assertNotNull("Resource assignment mdsal sourceName is missing ",
+                resourceAssignment.getDictionarySource());
+        Assert.assertNotNull("Resource assignment mdsal sourceName property is missing ",
+                resourceAssignment.getProperty());
+        Assert.assertNotNull("Resource assignment mdsal sourceName property type is missing ",
+                resourceAssignment.getProperty().getType());
+    }
+
+}
diff --git a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/config/model/utils/JsonParserUtilsTest.java b/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/config/model/utils/JsonParserUtilsTest.java
new file mode 100644
index 0000000..693c505
--- /dev/null
+++ b/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/config/model/utils/JsonParserUtilsTest.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.config.model.utils;
+
+import org.junit.Assert;
+import org.junit.Test;
+import com.fasterxml.jackson.databind.JsonNode;
+
+public class JsonParserUtilsTest {
+
+    @Test
+    public void testParse() {
+        final String jsonExample = "{\"key\":\"value\"}";
+
+        JsonNode rootJsonNode = JsonParserUtils.parse(jsonExample, "$");
+        Assert.assertEquals(jsonExample, rootJsonNode.toString());
+
+        JsonNode keyJsonNode = JsonParserUtils.parse(rootJsonNode, "$['key']");
+        Assert.assertEquals("value", keyJsonNode.asText());
+
+        Assert.assertEquals(jsonExample,
+                JsonParserUtils.parseNSet("{\"key\":\"NOT_VALUE\"}", "$['key']", keyJsonNode).toString());
+
+        rootJsonNode = JsonParserUtils.parse("{\"key\":\"NOT_VALUE\"}", "$");
+        Assert.assertEquals(jsonExample, JsonParserUtils.parseNSet(rootJsonNode, "$['key']", keyJsonNode).toString());
+    }
+
+}
diff --git a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/config/model/utils/JsonUtilsTest.java b/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/config/model/utils/JsonUtilsTest.java
new file mode 100644
index 0000000..5dd0fae
--- /dev/null
+++ b/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/config/model/utils/JsonUtilsTest.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.config.model.utils;
+
+import static org.junit.Assert.assertTrue;
+import org.junit.Test;
+import org.onap.ccsdk.config.model.ValidTypes;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.JsonNodeFactory;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
+public class JsonUtilsTest {
+
+    @Test
+    public void testPopulatePrimitiveValues() {
+        ObjectNode objectNode = JsonNodeFactory.instance.objectNode();
+        JsonUtils.populatePrimitiveValues("key1", "value", "", objectNode);
+        JsonUtils.populatePrimitiveValues("key2", true, ValidTypes.DATA_TYPE_BOOLEAN, objectNode);
+        JsonUtils.populatePrimitiveValues("key3", 1, ValidTypes.DATA_TYPE_INTEGER, objectNode);
+        JsonUtils.populatePrimitiveValues("key4", 1.1f, ValidTypes.DATA_TYPE_FLOAT, objectNode);
+        JsonUtils.populatePrimitiveValues("key5", "13213123131", ValidTypes.DATA_TYPE_TIMESTAMP, objectNode);
+
+        assertTrue("value".equals(objectNode.get("key1").asText()));
+        assertTrue(objectNode.get("key2").asBoolean());
+        assertTrue(objectNode.get("key3").asInt() == 1);
+        assertTrue(objectNode.get("key4").floatValue() == 1.1f);
+        assertTrue("13213123131".equals(objectNode.get("key5").asText()));
+    }
+
+    @Test
+    public void testPopulatePrimitiveValuesArrayNode() {
+        ArrayNode objectNode = JsonNodeFactory.instance.arrayNode();
+        JsonUtils.populatePrimitiveValues("value", "", objectNode);
+        JsonUtils.populatePrimitiveValues(true, ValidTypes.DATA_TYPE_BOOLEAN, objectNode);
+        JsonUtils.populatePrimitiveValues(1, ValidTypes.DATA_TYPE_INTEGER, objectNode);
+        JsonUtils.populatePrimitiveValues(1.1f, ValidTypes.DATA_TYPE_FLOAT, objectNode);
+        JsonUtils.populatePrimitiveValues("13213123131", ValidTypes.DATA_TYPE_TIMESTAMP, objectNode);
+
+        assertTrue(objectNode.size() == 5);
+    }
+
+    @Test
+    public void testPopulatePrimitiveDefaultValues() {
+        ObjectNode objectNode = JsonNodeFactory.instance.objectNode();
+        JsonUtils.populatePrimitiveDefaultValues("key1", "", objectNode);
+        JsonUtils.populatePrimitiveDefaultValues("key2", ValidTypes.DATA_TYPE_BOOLEAN, objectNode);
+        JsonUtils.populatePrimitiveDefaultValues("key3", ValidTypes.DATA_TYPE_INTEGER, objectNode);
+        JsonUtils.populatePrimitiveDefaultValues("key4", ValidTypes.DATA_TYPE_FLOAT, objectNode);
+
+        assertTrue("".equals(objectNode.get("key1").asText()));
+        assertTrue(objectNode.get("key2").asBoolean() == false);
+        assertTrue(objectNode.get("key3").asInt() == 0);
+        assertTrue(objectNode.get("key4").floatValue() == 0.0f);
+    }
+
+    @Test
+    public void testPopulatePrimitiveDefaultValuesForArrayNode() {
+        ArrayNode objectNode = JsonNodeFactory.instance.arrayNode();
+        JsonUtils.populatePrimitiveDefaultValuesForArrayNode("", objectNode);
+        JsonUtils.populatePrimitiveDefaultValuesForArrayNode(ValidTypes.DATA_TYPE_BOOLEAN, objectNode);
+        JsonUtils.populatePrimitiveDefaultValuesForArrayNode(ValidTypes.DATA_TYPE_INTEGER, objectNode);
+        JsonUtils.populatePrimitiveDefaultValuesForArrayNode(ValidTypes.DATA_TYPE_FLOAT, objectNode);
+
+        assertTrue(objectNode.size() == 4);
+    }
+
+    @Test
+    public void testPopulateJsonNodeValues() {
+        ObjectNode objectNode = JsonNodeFactory.instance.objectNode();
+        JsonUtils.populateJsonNodeValues("key1", JsonNodeFactory.instance.textNode("value"),
+                ValidTypes.DATA_TYPE_STRING, objectNode);
+        JsonUtils.populateJsonNodeValues("key2", JsonNodeFactory.instance.booleanNode(true),
+                ValidTypes.DATA_TYPE_BOOLEAN, objectNode);
+        JsonUtils.populateJsonNodeValues("key3", JsonNodeFactory.instance.numberNode(1), ValidTypes.DATA_TYPE_INTEGER,
+                objectNode);
+        JsonUtils.populateJsonNodeValues("key4", JsonNodeFactory.instance.numberNode(1.1f), ValidTypes.DATA_TYPE_FLOAT,
+                objectNode);
+        JsonUtils.populateJsonNodeValues("key5", JsonNodeFactory.instance.textNode("13213123131"),
+                ValidTypes.DATA_TYPE_TIMESTAMP, objectNode);
+        assertTrue(objectNode.get("key2").asBoolean());
+
+        assertTrue("value".equals(objectNode.get("key1").asText()));
+        assertTrue(objectNode.get("key2").asBoolean());
+        assertTrue(objectNode.get("key3").asInt() == 1);
+        assertTrue(objectNode.get("key4").floatValue() == 1.1f);
+        assertTrue("13213123131".equals(objectNode.get("key5").asText()));
+    }
+}
diff --git a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/config/model/utils/ResourceAssignmentUtilsTest.java b/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/config/model/utils/ResourceAssignmentUtilsTest.java
new file mode 100644
index 0000000..034d70d
--- /dev/null
+++ b/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/config/model/utils/ResourceAssignmentUtilsTest.java
@@ -0,0 +1,198 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.config.model.utils;
+
+import static org.junit.Assert.assertTrue;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.junit.Test;
+import org.onap.ccsdk.config.model.ConfigModelConstant;
+import org.onap.ccsdk.config.model.ConfigModelException;
+import org.onap.ccsdk.config.model.ValidTypes;
+import org.onap.ccsdk.config.model.data.PropertyDefinition;
+import org.onap.ccsdk.config.model.data.ResourceAssignment;
+import org.onap.ccsdk.config.model.data.dict.ResourceDefinition;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class ResourceAssignmentUtilsTest {
+
+    @Test
+    public void testGetArtifactNodeContent() {
+        String nodeTemplateName = "nodeTemplateNmae";
+        String templateContent = "content";
+        Map<String, Object> context = new HashMap<String, Object>();
+        context.put(ConfigModelConstant.PROPERTY_NODE_TEMPLATES_DOT + nodeTemplateName + ".content", templateContent);
+
+        String retrievedContent = ResourceAssignmentUtils.getArtifactNodeContent(nodeTemplateName, context);
+
+        assertTrue(templateContent.equals(retrievedContent));
+    }
+
+    @Test
+    public void testGetArtifactNodeMapping() {
+        String nodeTemplateName = "nodeTemplateNmae";
+        String templateContent = "[]";
+        Map<String, Object> context = new HashMap<String, Object>();
+        context.put(ConfigModelConstant.PROPERTY_NODE_TEMPLATES_DOT + nodeTemplateName + ".mapping", templateContent);
+
+        List<ResourceAssignment> map = ResourceAssignmentUtils.getArtifactNodeMapping(nodeTemplateName, context);
+        assertTrue(map.size() == 0);
+    }
+
+    @Test
+    public void testCleanContextTemplateNDictionaryKeys() {
+        String recipeName = "recipe";
+        Map<String, Object> componentContext = new HashMap<String, Object>();
+        componentContext.put(ConfigModelConstant.PROPERTY_ACTION_NAME, recipeName);
+        componentContext.put(ConfigModelConstant.PROPERTY_DICTIONARY_KEY_DOT + recipeName + ".", "value1");
+        componentContext.put(ConfigModelConstant.PROPERTY_RECIPE_KEY_DOT + recipeName + ".", "value2");
+        ResourceAssignmentUtils.cleanContextTemplateNDictionaryKeys(componentContext);
+
+        assertTrue(componentContext.size() == 1);
+    }
+
+    @Test
+    public void testGetDictionaryKeyValue() {
+        String recipeName = "recipe";
+        String dictionaryName = "dictionaryKey";
+        Map<String, Object> componentContext = new HashMap<String, Object>();
+        componentContext.put(ConfigModelConstant.PROPERTY_ACTION_NAME, recipeName);
+        componentContext.put(ConfigModelConstant.PROPERTY_DICTIONARY_KEY_DOT + recipeName + "." + dictionaryName,
+                "value1");
+        ResourceAssignment resourceAssignment = new ResourceAssignment();
+        resourceAssignment.setDictionaryName(dictionaryName);
+
+        String value = (String) ResourceAssignmentUtils.getDictionaryKeyValue(componentContext, resourceAssignment);
+        assertTrue("value1".equals(value));
+    }
+
+    @Test
+    public void testGetDictionaryKeyValueWithDictionaryDefinition() {
+        String recipeName = "recipe";
+        String dictionaryName = "dictionaryKey";
+        Map<String, Object> componentContext = new HashMap<String, Object>();
+        componentContext.put(ConfigModelConstant.PROPERTY_ACTION_NAME, recipeName);
+        componentContext.put(ConfigModelConstant.PROPERTY_DICTIONARY_KEY_DOT + recipeName + "." + dictionaryName,
+                "value1");
+        ResourceDefinition resourceDefinition = new ResourceDefinition();
+        resourceDefinition.setName(dictionaryName);
+
+        String value = (String) ResourceAssignmentUtils.getDictionaryKeyValue(componentContext, resourceDefinition);
+        assertTrue("value1".equals(value));
+    }
+
+    @Test
+    public void testGetTemplateKeyValue() {
+        String recipeName = "recipe";
+        String templateKeyName = "templateKey";
+        Map<String, Object> componentContext = new HashMap<String, Object>();
+        componentContext.put(ConfigModelConstant.PROPERTY_ACTION_NAME, recipeName);
+        componentContext.put(ConfigModelConstant.PROPERTY_RECIPE_KEY_DOT + recipeName + "." + templateKeyName,
+                "value1");
+        ResourceAssignment resourceAssignment = new ResourceAssignment();
+        resourceAssignment.setName(templateKeyName);
+
+        String value = (String) ResourceAssignmentUtils.getTemplateKeyValue(componentContext, resourceAssignment);
+        assertTrue("value1".equals(value));
+    }
+
+    @Test
+    public void testSetResourceDataValue() throws Exception {
+        String recipeName = "recipe";
+        Map<String, Object> componentContext = new HashMap<String, Object>();
+        componentContext.put(ConfigModelConstant.PROPERTY_ACTION_NAME, recipeName);
+
+        ResourceAssignment resourceAssignment = createResourceAssignment("name1", ValidTypes.DATA_TYPE_STRING, null);
+        Object value = "value";
+        ResourceAssignmentUtils.setResourceDataValue(componentContext, resourceAssignment, value);
+        assertTrue(value.equals(resourceAssignment.getProperty().getValue()));
+
+        resourceAssignment = createResourceAssignment("name1", ValidTypes.DATA_TYPE_INTEGER, null);
+        value = "1";
+        ResourceAssignmentUtils.setResourceDataValue(componentContext, resourceAssignment, value);
+        assertTrue((int) resourceAssignment.getProperty().getValue() == 1);
+
+        resourceAssignment = createResourceAssignment("name1", ValidTypes.DATA_TYPE_BOOLEAN, null);
+        value = "true";
+        ResourceAssignmentUtils.setResourceDataValue(componentContext, resourceAssignment, value);
+        assertTrue((boolean) resourceAssignment.getProperty().getValue());
+
+        resourceAssignment = createResourceAssignment("name1", ValidTypes.DATA_TYPE_FLOAT, null);
+        value = "1.1";
+        ResourceAssignmentUtils.setResourceDataValue(componentContext, resourceAssignment, value);
+        assertTrue((float) resourceAssignment.getProperty().getValue() == 1.1f);
+    }
+
+    @Test
+    public void testSetFailedResourceDataValue() throws Exception {
+        ResourceAssignment resourceAssignment = createResourceAssignment("name1", ValidTypes.DATA_TYPE_STRING, "value");
+        String message = "message";
+        ResourceAssignmentUtils.setFailedResourceDataValue(null, resourceAssignment, message);
+
+        assertTrue(message.equals(resourceAssignment.getMessage()));
+        assertTrue(ConfigModelConstant.STATUS_FAILURE.equals(resourceAssignment.getStatus()));
+    }
+
+    @Test(expected = ConfigModelException.class)
+    public void testAssertTemplateKeyValueNotNull() throws Exception {
+        Map<String, Object> componentContext = null;
+        ResourceAssignment resourceAssignment = createResourceAssignment("name1", ValidTypes.DATA_TYPE_STRING, "value");
+        ResourceAssignmentUtils.assertTemplateKeyValueNotNull(componentContext, resourceAssignment);
+    }
+
+    @Test
+    public void testGenerateResourceDataForAssignments() throws Exception {
+        List<ResourceAssignment> assignments = new ArrayList<ResourceAssignment>();
+        assignments.add(createResourceAssignment("name1", ValidTypes.DATA_TYPE_STRING, "string"));
+        assignments.add(createResourceAssignment("name2", ValidTypes.DATA_TYPE_BOOLEAN, true));
+        assignments.add(createResourceAssignment("name3", ValidTypes.DATA_TYPE_INTEGER, 1));
+        assignments.add(createResourceAssignment("name4", ValidTypes.DATA_TYPE_FLOAT, 1.1f));
+        assignments.add(createResourceAssignment("name5", ValidTypes.DATA_TYPE_TIMESTAMP, "1523908097735"));
+        assignments.add(createResourceAssignment("name6", "", new HashMap<String, String>()));
+        ResourceAssignmentUtils.generateResourceDataForAssignments(assignments);
+    }
+
+    public void testResourceAssignmentForNullEmptyValues() throws Exception {
+
+        ObjectMapper mapper = new ObjectMapper();
+        JsonNode raContent =
+                mapper.readTree(new File("src/test/resources/service_templates/ra-content-with-mising-value.json"));
+
+        List<ResourceAssignment> assignments =
+                mapper.readValue(raContent.toString(), new TypeReference<List<ResourceAssignment>>() {});
+
+        ResourceAssignmentUtils.generateResourceDataForAssignments(assignments);
+    }
+
+    private ResourceAssignment createResourceAssignment(String name, String dataType, Object value) {
+        PropertyDefinition property = new PropertyDefinition();
+        property.setType(dataType);
+        property.setValue(value);
+        property.setRequired(true);
+        ResourceAssignment ra = new ResourceAssignment();
+        ra.setName(name);
+        ra.setProperty(property);
+        return ra;
+    }
+
+}
diff --git a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/config/model/utils/ServiceTemplateUtilsTest.java b/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/config/model/utils/ServiceTemplateUtilsTest.java
new file mode 100644
index 0000000..5364ae9
--- /dev/null
+++ b/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/config/model/utils/ServiceTemplateUtilsTest.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.config.model.utils;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.junit.Assert;
+import org.junit.Test;
+import org.onap.ccsdk.config.model.data.ArtifactDefinition;
+import org.onap.ccsdk.config.model.data.CapabilityAssignment;
+import org.onap.ccsdk.config.model.data.NodeTemplate;
+
+public class ServiceTemplateUtilsTest {
+
+    ServiceTemplateUtils serviceTemplateUtils = new ServiceTemplateUtils();
+
+    @Test
+    public void testPopulateVnfNodeProperties() {
+        NodeTemplate nodeTemplate = createNodeTemplate();
+
+        String nodeTemplateKey = "nodeTemplateKey";
+        Map<String, String> context = new HashMap<String, String>();
+
+        Map<String, String> result =
+                serviceTemplateUtils.populateVnfNodeProperties(nodeTemplateKey, nodeTemplate, context, null);
+
+        Assert.assertTrue(result.size() > 0);
+    }
+
+    @Test
+    public void testPopulateNodeTemplateArtifacts() {
+        String nodeTemplateKey = "nodeTemplateKey";
+        NodeTemplate nodeTemplate = createNodeTemplate();
+        Map<String, String> context = new HashMap<String, String>();
+
+        Map<String, String> result =
+                serviceTemplateUtils.populateNodeTemplateArtifacts(nodeTemplateKey, nodeTemplate, context);
+
+        Assert.assertTrue(result.size() > 0);
+    }
+
+    private NodeTemplate createNodeTemplate() {
+        NodeTemplate nodeTemplate = new NodeTemplate();
+        Map<String, Object> properties = new HashMap<String, Object>();
+        properties.put("prop1", "value");
+        CapabilityAssignment capabilityAssignment = new CapabilityAssignment();
+        capabilityAssignment.setProperties(properties);
+        Map<String, CapabilityAssignment> capabilities = new HashMap<String, CapabilityAssignment>();
+        capabilities.put("key", capabilityAssignment);
+        nodeTemplate.setCapabilities(capabilities);
+
+        ArtifactDefinition artifactDefinition = new ArtifactDefinition();
+        artifactDefinition.setFile("file");
+        artifactDefinition.setDeployPath("deployPath");
+        artifactDefinition.setContent("content");
+        Map<String, ArtifactDefinition> artifacts = new HashMap<String, ArtifactDefinition>();
+        artifacts.put("artifactName1", artifactDefinition);
+        nodeTemplate.setArtifacts(artifacts);
+
+        return nodeTemplate;
+    }
+}
diff --git a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/config/model/utils/TransformationUtilsTest.java b/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/config/model/utils/TransformationUtilsTest.java
new file mode 100644
index 0000000..ca57e5f
--- /dev/null
+++ b/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/config/model/utils/TransformationUtilsTest.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.config.model.utils;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import java.util.HashMap;
+import java.util.Map;
+import org.junit.Test;
+import com.fasterxml.jackson.databind.JsonNode;
+
+public class TransformationUtilsTest {
+
+    @Test
+    public void testGetJson() {
+        Map<String, Object> configparameters = new HashMap<String, Object>();
+        configparameters.put("key", "value");
+        String json = TransformationUtils.getJson(configparameters);
+        assertTrue("{\"key\":\"value\"}".equals(json));
+    }
+
+    @Test
+    public void testGetJsonNodeForString() {
+        String content = "{\"key\":\"value\"}";
+        JsonNode jsonNodeForString = TransformationUtils.getJsonNodeForString(content);
+        assertNotNull(jsonNodeForString);
+    }
+
+    @Test
+    public void testGetMapfromJson() {
+        String content = "{\"key\":\"value\"}";
+        Map<String, Object> mapfromJson = TransformationUtils.getMapfromJson(content);
+        assertTrue(mapfromJson.size() == 1);
+        assertTrue("value".equals(mapfromJson.get("key")));
+    }
+
+    @Test
+    public void testGetMapfromJsonString() {
+        String content = "{\"key\":\"value\"}";
+        Map<String, Object> mapfromJson = TransformationUtils.getMapfromJsonString(content);
+        assertTrue(mapfromJson.size() == 1);
+        assertTrue("value".equals(mapfromJson.get("key")));
+    }
+
+    @Test
+    public void testConvertJson2RootProperties() throws Exception {
+        Map<String, String> context = new HashMap<String, String>();
+        String jsonContent = "{\"key\":\"value\"}";
+        Map<String, String> convertJson2RootProperties =
+                TransformationUtils.convertJson2RootProperties(context, jsonContent);
+        assertTrue(convertJson2RootProperties.size() == 1);
+        assertTrue("value".equals(convertJson2RootProperties.get("key")));
+    }
+
+    @SuppressWarnings("unchecked")
+    @Test
+    public void testGetJsonNodeAndTreeToValueAndConvertJson2Properties() throws Exception {
+        Map<String, String> configparameters = new HashMap<String, String>();
+        configparameters.put("key", "value");
+        JsonNode jsonNode = TransformationUtils.getJsonNode(configparameters);
+        assertNotNull(jsonNode);
+
+        Map<String, String> result = TransformationUtils.treeToValue(jsonNode, HashMap.class);
+        assertTrue("value".equals(result.get("key")));
+
+        result = TransformationUtils.convertJson2Properties(null, jsonNode, null);
+        assertTrue("value".equals(result.get("key")));
+    }
+
+    @Test
+    public void testGetJsonSchema() {
+        String jsonSchema = TransformationUtils.getJsonSchema(String.class);
+        assertNotNull(jsonSchema);
+    }
+}
diff --git a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/config/model/validator/ServiceTemplateValidationTest.java b/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/config/model/validator/ServiceTemplateValidationTest.java
new file mode 100644
index 0000000..5776b51
--- /dev/null
+++ b/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/config/model/validator/ServiceTemplateValidationTest.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.config.model.validator;
+
+import java.nio.charset.Charset;
+import org.apache.commons.io.IOUtils;
+import org.junit.Test;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+
+public class ServiceTemplateValidationTest {
+    private static EELFLogger logger = EELFManager.getInstance().getLogger(ServiceTemplateValidationTest.class);
+
+    @Test
+    public void validateServiceTemplate() {
+        try {
+            logger.info(" **************** Validating Default *****************");
+            String serviceTemplateContent = IOUtils.toString(ServiceTemplateValidationTest.class.getClassLoader()
+                    .getResourceAsStream("service_templates/default.json"), Charset.defaultCharset());
+            ServiceTemplateValidator serviceTemplateValidator = new ServiceTemplateValidator();
+            serviceTemplateValidator.validateServiceTemplate(serviceTemplateContent);
+            logger.info(" **************** Reqource Assignment *****************");
+            serviceTemplateContent = IOUtils.toString(ServiceTemplateValidationTest.class.getClassLoader()
+                    .getResourceAsStream("service_templates/resource_assignment.json"), Charset.defaultCharset());
+            serviceTemplateValidator.validateServiceTemplate(serviceTemplateContent);
+            logger.info(" **************** Activate Netconf *****************");
+            serviceTemplateContent = IOUtils.toString(ServiceTemplateValidationTest.class.getClassLoader()
+                    .getResourceAsStream("service_templates/download_config.json"), Charset.defaultCharset());
+            serviceTemplateValidator.validateServiceTemplate(serviceTemplateContent);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+    }
+
+}
diff --git a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/config/params/service/ComponentNodeTest.java b/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/config/params/service/ComponentNodeTest.java
new file mode 100644
index 0000000..d73a622
--- /dev/null
+++ b/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/config/params/service/ComponentNodeTest.java
@@ -0,0 +1,140 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.config.params.service;
+
+import static org.mockito.Matchers.any;
+import java.io.File;
+import java.nio.charset.Charset;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.sling.testing.mock.osgi.MockOsgi;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.stubbing.Answer;
+import org.onap.ccsdk.config.data.adaptor.domain.TransactionLog;
+import org.onap.ccsdk.config.data.adaptor.service.ConfigResourceService;
+import org.onap.ccsdk.config.model.ConfigModelConstant;
+import org.onap.ccsdk.config.model.service.ComponentNodeDelegate;
+import org.onap.ccsdk.config.model.service.ComponentNodeServiceImpl;
+import org.onap.ccsdk.config.model.service.ConfigModelService;
+import org.onap.ccsdk.config.model.service.ConfigModelServiceImpl;
+import org.onap.ccsdk.config.model.utils.TransformationUtils;
+import org.onap.ccsdk.config.rest.adaptor.service.ConfigRestAdaptorService;
+import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
+import org.onap.ccsdk.sli.core.sli.SvcLogicException;
+import org.osgi.framework.BundleContext;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+
+@RunWith(MockitoJUnitRunner.class)
+public class ComponentNodeTest {
+    private static EELFLogger logger = EELFManager.getInstance().getLogger(ComponentNodeTest.class);
+    @Mock
+    private ConfigResourceService configResourceService;
+
+    @Mock
+    private ConfigRestAdaptorService configRestAdaptorService;
+
+    BundleContext bundleContext = MockOsgi.newBundleContext();
+
+    @Before
+    public void before() {
+        MockitoAnnotations.initMocks(this);
+
+        MockComponentNode mockSvcLogicPlugin = new MockComponentNode();
+        bundleContext.registerService(MockComponentNode.class, mockSvcLogicPlugin, null);
+
+        try {
+            Mockito.doAnswer(new Answer<Void>() {
+                @Override
+                public Void answer(InvocationOnMock invocationOnMock) throws Throwable {
+                    Object[] args = invocationOnMock.getArguments();
+                    if (args != null) {
+                        logger.trace("Transaction info " + Arrays.asList(args));
+                    }
+                    return null;
+                }
+            }).when(configResourceService).save(any(TransactionLog.class));
+        } catch (SvcLogicException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+    }
+
+    @After
+    public void after() {
+
+    }
+
+    @Test
+    public void testProcess() {
+
+        try {
+            String serviceTemplateContent = FileUtils.readFileToString(
+                    new File("src/test/resources/componentnode/default.json"), Charset.defaultCharset());
+            ConfigModelService configModelService = new ConfigModelServiceImpl(configRestAdaptorService);
+
+            Map<String, String> map = new HashMap<>();
+            configModelService.convertServiceTemplate2Properties(serviceTemplateContent, map);
+
+            SvcLogicContext ctx = new SvcLogicContext();
+            map.forEach((name, value) -> {
+                if (StringUtils.isNotBlank(name) && StringUtils.isNotBlank(value)) {
+                    ctx.setAttribute(name, value);
+                }
+            });
+            ctx.setAttribute("vnf-id", "1234");
+
+            ComponentNodeServiceImpl componentNodeService =
+                    new ComponentNodeServiceImpl(bundleContext, configResourceService, configRestAdaptorService);
+
+            ComponentNodeDelegate componentNodeDelegate = new ComponentNodeDelegate(componentNodeService);
+            Map<String, String> inParams = new HashMap<>();
+            inParams.put(ConfigModelConstant.PROPERTY_SELECTOR, "generate-configuration");
+
+            componentNodeDelegate.process(inParams, ctx);
+            TransformationUtils.printMap(inParams);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+    }
+
+    @Test(expected = SvcLogicException.class)
+    public void testFailure() throws Exception {
+        ComponentNodeServiceImpl componentNodeService =
+                new ComponentNodeServiceImpl(bundleContext, configResourceService, configRestAdaptorService);
+        ComponentNodeDelegate componentNodeDelegate = new ComponentNodeDelegate(componentNodeService);
+
+        Map<String, String> inParams = new HashMap<String, String>();
+        inParams.put(ConfigModelConstant.PROPERTY_SELECTOR, "generate-configuration");
+        SvcLogicContext ctx = new SvcLogicContext();
+        componentNodeDelegate.process(inParams, ctx);
+    }
+}
diff --git a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/config/params/service/ConfigModelServiceTest.java b/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/config/params/service/ConfigModelServiceTest.java
new file mode 100644
index 0000000..77972a6
--- /dev/null
+++ b/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/config/params/service/ConfigModelServiceTest.java
@@ -0,0 +1,219 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.config.params.service;
+
+import static org.junit.Assert.fail;
+import java.io.File;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.commons.io.FileUtils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Matchers;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.ccsdk.config.model.ConfigModelConstant;
+import org.onap.ccsdk.config.model.data.ServiceTemplate;
+import org.onap.ccsdk.config.model.domain.ConfigModel;
+import org.onap.ccsdk.config.model.domain.ConfigModelContent;
+import org.onap.ccsdk.config.model.service.ConfigModelService;
+import org.onap.ccsdk.config.model.service.ConfigModelServiceImpl;
+import org.onap.ccsdk.config.rest.adaptor.service.ConfigRestAdaptorService;
+import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
+import org.onap.ccsdk.sli.core.sli.SvcLogicException;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+
+@RunWith(MockitoJUnitRunner.class)
+public class ConfigModelServiceTest {
+
+    private static EELFLogger logger = EELFManager.getInstance().getLogger(ConfigModelServiceTest.class);
+
+    @Mock
+    private ConfigRestAdaptorService configRestAdaptorService;
+
+    @Test
+    public void testConfigAssignmentInputOutputParams() throws Exception {
+
+        String fileContent = FileUtils.readFileToString(
+                new File("src/test/resources/service_templates/resource_assignment.json"), Charset.defaultCharset());
+
+        Map<String, String> context = new HashMap<>();
+        ConfigModelServiceImpl configModelServiceImpl = new ConfigModelServiceImpl(configRestAdaptorService);
+        context = configModelServiceImpl.convertServiceTemplate2Properties(fileContent, context);
+
+        Assert.assertNotNull("Failed to Prepare Context : ", context);
+
+        context.put("request-id", "12345");
+        context.put("vnf-id", "vnf12345");
+
+        Map<String, String> inparams = new HashMap<String, String>();
+        inparams.put(ConfigModelConstant.PROPERTY_SELECTOR, "resource-assignment");
+
+        SvcLogicContext inputContext = new SvcLogicContext();
+        context.forEach((name, value) -> {
+            inputContext.setAttribute(name, value);
+        });
+
+        // TransformationUtils.printProperty(inputContext.toProperties());
+
+        configModelServiceImpl.assignInParamsFromModel(inputContext, inparams);
+        Assert.assertNotNull("In Param is Null : ", inparams);
+        Assert.assertNotNull("Failed to get entity-id in Inparms : ", inparams.get("resource-id"));
+        Assert.assertEquals("Failed to get entity-id vlaue in Inparms ", String.valueOf("vnf12345"),
+                inparams.get("resource-id"));
+        Assert.assertNotNull("Failed to get request-id in Inparms : ", inparams.get("request-id"));
+        Assert.assertEquals("Failed to get request-id vlaue in Inparms ", String.valueOf("12345"),
+                inparams.get("request-id"));
+
+        configModelServiceImpl.assignOutParamsFromModel(inputContext, inparams);
+        logger.info("*************** Output Params *************");
+        // TransformationUtils.printProperty(inputContext.toProperties());
+
+    }
+
+    @Test
+    public void testConvertServiceTemplate2PropertiesComplex() throws Exception {
+        String fileContent = FileUtils.readFileToString(
+                new File("src/test/resources/service_templates/resource_assignment.json"), Charset.defaultCharset());
+
+        Map<String, String> context = new HashMap<>();
+        context.put("host-password", "1234");
+        context.put("host-ip-address", "[123.23.34.45, 123.23.34.45]");
+
+        ConfigModelServiceImpl configModelServiceImpl = new ConfigModelServiceImpl(configRestAdaptorService);
+        configModelServiceImpl.convertServiceTemplate2Properties(fileContent, context);
+
+        // TransformationUtils.printMap(context);
+
+        Map<String, String> inparams = new HashMap<String, String>();
+        inparams.put(ConfigModelConstant.PROPERTY_SELECTOR, "resource-assignment");
+        logger.info("Before Input Result: " + inparams);
+
+        SvcLogicContext inputContext = new SvcLogicContext();
+        context.forEach((name, value) -> {
+            inputContext.setAttribute(name, value);
+        });
+
+        configModelServiceImpl.assignInParamsFromModel(inputContext, inparams);
+        logger.info("----------Input Result: " + inparams);
+
+        inputContext.setAttribute("assignment-params", "default-assigned");
+        configModelServiceImpl.assignOutParamsFromModel(inputContext, inparams);
+
+        // TransformationUtils.printProperty(inputContext.toProperties());
+
+    }
+
+    @Test
+    public void testGetNodeTemplateContent() throws Exception {
+        String templateContent = "{\"id\":\"id\"}";
+        SvcLogicContext context = new SvcLogicContext();
+        context.setAttribute(ConfigModelConstant.PROPERTY_NODE_TEMPLATES_DOT + templateContent + ".content",
+                templateContent);
+
+        ConfigModelServiceImpl configModelServiceImpl = new ConfigModelServiceImpl(configRestAdaptorService);
+        String content = configModelServiceImpl.getNodeTemplateContent(context, templateContent);
+
+        Assert.assertEquals(content, templateContent);
+    }
+
+    @Test
+    public void testGetNodeTemplateMapping() throws Exception {
+        String templateContent = "{\"capabilities\":{\"mapping\":{\"properties\":{\"mapping\":[\"test\"]}}}}";
+        SvcLogicContext context = new SvcLogicContext();
+        context.setAttribute(ConfigModelConstant.PROPERTY_NODE_TEMPLATES_DOT + templateContent, templateContent);
+
+        ConfigModelServiceImpl configModelServiceImpl = new ConfigModelServiceImpl(configRestAdaptorService);
+        configModelServiceImpl.getNodeTemplateMapping(context, templateContent);
+        // Assert.assertEquals(content, templateContent);
+    }
+
+    @Test
+    public void testValidateServiceTemplate() throws Exception {
+        ConfigModelServiceImpl configModelServiceImpl = new ConfigModelServiceImpl(configRestAdaptorService);
+        ServiceTemplate serviceTemplate = new ServiceTemplate();
+
+        try {
+            configModelServiceImpl.validateServiceTemplate(null);
+            fail("Should have thrown exception");
+        } catch (SvcLogicException e) {
+        }
+
+        try {
+            configModelServiceImpl.validateServiceTemplate(serviceTemplate);
+            fail("Should have thrown exception");
+        } catch (SvcLogicException e) {
+        }
+
+        Map<String, String> metadata = new HashMap<String, String>();
+        metadata.put(ConfigModelConstant.SERVICE_TEMPLATE_KEY_ARTIFACT_AUTHOR, "author");
+        metadata.put(ConfigModelConstant.SERVICE_TEMPLATE_KEY_ARTIFACT_NAME, "name");
+        metadata.put(ConfigModelConstant.SERVICE_TEMPLATE_KEY_ARTIFACT_VERSION, "version");
+        serviceTemplate.setMetadata(metadata);
+
+        Assert.assertTrue(configModelServiceImpl.validateServiceTemplate(serviceTemplate));
+    }
+
+    @Test
+    public void testPrepareContext() throws Exception {
+        Mockito.when(configRestAdaptorService.getResource(Matchers.anyString(), Matchers.anyString(), Matchers.any()))
+                .thenReturn(createConfigModel());
+
+        String input = "{\"action-name\": \"resource-assignment-action\"}";
+        ConfigModelService configModelService = new ConfigModelServiceImpl(configRestAdaptorService);
+
+        Map<String, String> ctx =
+                configModelService.prepareContext(null, input, "serviceTemplateName", "serviceTemplateVersion");
+        Assert.assertEquals("resource-assignment-action", ctx.get(ConfigModelConstant.PROPERTY_ACTION_NAME));
+
+        ctx = configModelService.prepareContext(null, input, "{}");
+        Assert.assertEquals("resource-assignment-action", ctx.get(ConfigModelConstant.PROPERTY_ACTION_NAME));
+    }
+
+    @Test
+    public void testConvertServiceTemplate2Properties() throws Exception {
+        Map<String, String> metadata = new HashMap<String, String>();
+        metadata.put("key", "value");
+        ServiceTemplate serviceTemplate = new ServiceTemplate();
+        serviceTemplate.setMetadata(metadata);
+        Map<String, String> context = new HashMap<String, String>();
+
+        ConfigModelService configModelService = new ConfigModelServiceImpl(configRestAdaptorService);
+        Map<String, String> ctx = configModelService.convertServiceTemplate2Properties(serviceTemplate, context);
+
+        Assert.assertEquals("value", ctx.get("key"));
+    }
+
+    private ConfigModel createConfigModel() {
+        ConfigModel configModel = new ConfigModel();
+        List<ConfigModelContent> configModelContents = new ArrayList<ConfigModelContent>();
+        ConfigModelContent configModelContent = new ConfigModelContent();
+        configModelContent.setContentType(ConfigModelConstant.MODEL_CONTENT_TYPE_TOSCA_JSON);
+        configModelContent.setContent("{\"description\": \"description\"}");
+        configModelContents.add(configModelContent);
+        configModel.setConfigModelContents(configModelContents);
+        configModel.setPublished("Y");
+        return configModel;
+    }
+}
diff --git a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/config/params/service/ExpressionUtilsTest.java b/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/config/params/service/ExpressionUtilsTest.java
new file mode 100644
index 0000000..e72b053
--- /dev/null
+++ b/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/config/params/service/ExpressionUtilsTest.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.config.params.service;
+
+import java.io.File;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.commons.io.FileUtils;
+import org.junit.Test;
+import org.onap.ccsdk.config.model.utils.ExpressionUtils;
+import org.onap.ccsdk.config.model.utils.TransformationUtils;
+import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class ExpressionUtilsTest {
+    private static EELFLogger logger = EELFManager.getInstance().getLogger(ExpressionUtilsTest.class);
+
+    @Test
+    public void testProcessJsonExpression() throws Exception {
+        String fileContent = FileUtils.readFileToString(new File("src/test/resources/properties/default.json"),
+                Charset.defaultCharset());
+
+        SvcLogicContext context = new SvcLogicContext();
+        context.setAttribute("host-password", "1234");
+        context.setAttribute("host-ip-address", "[\"123.23.34.45\", \"123.23.34.45\"]");
+        context.setAttribute("loopback-default", "[\"Sample\", \"Brinda\"]");
+
+        Map<String, String> inparams = new HashMap<String, String>();
+        ExpressionUtils jsonExpressionUtils = new ExpressionUtils(context, inparams);
+        ObjectMapper mapper = new ObjectMapper();
+        JsonNode rootArray = mapper.readTree(fileContent);
+        jsonExpressionUtils.processJsonExpression(rootArray);
+
+    }
+
+    @Test
+    public void testJson2Property() throws Exception {
+        String fileContent = FileUtils.readFileToString(new File("src/test/resources/properties/convert.json"),
+                Charset.defaultCharset());
+
+        List<String> blockKeys = new ArrayList<String>();
+        blockKeys.add(
+                "interfaces.ResourceAssignmentService.operations.getResourceAssignment.inputs.assignment-mappings");
+        blockKeys.add("interfaces.ResourceAssignmentService.operations.getResourceAssignment.outputs");
+        blockKeys.add("type");
+
+        Map<String, String> workflowMap = new HashMap<>();
+        Map<String, String> propertyMap =
+                TransformationUtils.convertJson2Properties(workflowMap, fileContent, blockKeys);
+
+        TransformationUtils.printMap(propertyMap);
+
+    }
+
+}
diff --git a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/config/params/service/MockComponentNode.java b/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/config/params/service/MockComponentNode.java
new file mode 100644
index 0000000..00260c9
--- /dev/null
+++ b/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/config/params/service/MockComponentNode.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.config.params.service;
+
+import java.util.Map;
+import org.onap.ccsdk.config.model.service.ComponentNode;
+import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
+import org.onap.ccsdk.sli.core.sli.SvcLogicException;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+
+public class MockComponentNode implements ComponentNode {
+    private static EELFLogger logger = EELFManager.getInstance().getLogger(MockComponentNode.class);
+
+    @Override
+    public Boolean preCondition(Map<String, String> inParams, SvcLogicContext ctx, Map<String, Object> componentContext)
+            throws SvcLogicException {
+        logger.info("Received preCondition ");
+        componentContext.put("test-key", "test");
+        return true;
+    }
+
+    @Override
+    public void process(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
+
+    }
+
+    @Override
+    public void process(Map<String, String> inParams, SvcLogicContext ctx, Map<String, Object> componentContext)
+            throws SvcLogicException {
+        logger.info("Received Request " + componentContext);
+    }
+
+    @Override
+    public void preProcess(Map<String, String> inParams, SvcLogicContext ctx, Map<String, Object> componentContext)
+            throws SvcLogicException {
+        logger.info("Received preProcess ");
+
+    }
+
+    @Override
+    public void postProcess(Map<String, String> inParams, SvcLogicContext ctx, Map<String, Object> componentContext)
+            throws SvcLogicException {
+        logger.info("Received postProcess ");
+    }
+
+}
diff --git a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/config/params/service/ServiceTemplateCreateUtils.java b/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/config/params/service/ServiceTemplateCreateUtils.java
new file mode 100644
index 0000000..6bfa903
--- /dev/null
+++ b/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/config/params/service/ServiceTemplateCreateUtils.java
@@ -0,0 +1,295 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.config.params.service;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.onap.ccsdk.config.model.ConfigModelConstant;
+import org.onap.ccsdk.config.model.data.DataType;
+import org.onap.ccsdk.config.model.data.NodeTemplate;
+import org.onap.ccsdk.config.model.data.NodeType;
+import org.onap.ccsdk.config.model.data.ServiceTemplate;
+import org.onap.ccsdk.config.model.data.TopologyTemplate;
+import org.onap.ccsdk.config.model.data.dict.ResourceDefinition;
+import org.onap.ccsdk.config.model.utils.TransformationUtils;
+
+public class ServiceTemplateCreateUtils {
+
+    public void createNodeTypes(String serviceTemplateFileName) throws IOException {
+        if (StringUtils.isNotBlank(serviceTemplateFileName)) {
+            String fileContent =
+                    FileUtils.readFileToString(new File(serviceTemplateFileName), Charset.defaultCharset());
+            if (StringUtils.isNotBlank(fileContent)) {
+                // System.out.println("NodeTypeCreateUtils.createNodeTypes()" +fileContent );
+                ServiceTemplate serviceTemplate = TransformationUtils.readValue(fileContent, ServiceTemplate.class);
+
+                String formattedServiceTemplateContent = TransformationUtils.getJson(serviceTemplate, true);
+
+                FileUtils.writeStringToFile(new File("src/test/resources/service_templates/_default.json"),
+                        formattedServiceTemplateContent, Charset.defaultCharset());
+
+                createNetconfdownloadNodeTemplate(serviceTemplate);
+                createRestconfdownloadNodeTemplate(serviceTemplate);
+                // createResourceAssignmentNodeTemplate(serviceTemplate);
+                createVrrNodeTemplate(serviceTemplate);
+                createDictionarySchema();
+
+            }
+        }
+    }
+
+    public void createNodeTypes(ServiceTemplate serviceTemplate) throws IOException {
+
+        if (serviceTemplate != null && serviceTemplate.getNodeTypes() != null) {
+            serviceTemplate.getNodeTypes().forEach((nodeTypeKey, node_types) -> {
+
+                if (node_types != null && StringUtils.isNotBlank(node_types.getDerivedFrom())) {
+
+                    try {
+                        String fileName = "src/test/resources/node_types/";
+                        if (ConfigModelConstant.MODEL_TYPE_NODE_VNF.equalsIgnoreCase(node_types.getDerivedFrom())) {
+                            fileName = fileName + "vnf/" + nodeTypeKey + ".json";
+                        }
+                        if (ConfigModelConstant.MODEL_TYPE_NODE_DG.equalsIgnoreCase(node_types.getDerivedFrom())) {
+                            fileName = fileName + "dg/" + nodeTypeKey + ".json";
+                        }
+                        if (ConfigModelConstant.MODEL_TYPE_NODE_COMPONENT
+                                .equalsIgnoreCase(node_types.getDerivedFrom())) {
+                            fileName = fileName + "component/" + nodeTypeKey + ".json";
+                        }
+                        String content = TransformationUtils.getJson(node_types, true);
+                        FileUtils.write(new File(fileName), content, Charset.defaultCharset());
+                    } catch (IOException e) {
+                        e.printStackTrace();
+                    }
+
+                }
+                System.out.println("NodeTypeCreateUtils.createNodeTypes()" + nodeTypeKey);
+            });
+        }
+
+    }
+
+    public void createNetconfdownloadNodeTemplate(ServiceTemplate serviceTemplate) throws IOException {
+        if (serviceTemplate != null) {
+            ServiceTemplate workingServiceTemplate = new ServiceTemplate();
+            workingServiceTemplate.setMetadata(serviceTemplate.getMetadata());
+
+            Map<String, DataType> data_types = new HashMap<String, DataType>();
+            data_types.put("datatype-property", serviceTemplate.getDataTypes().get("datatype-property"));
+            data_types.put("datatype-resource-assignment",
+                    serviceTemplate.getDataTypes().get("datatype-resource-assignment"));
+            workingServiceTemplate.setDataTypes(data_types);
+
+            TopologyTemplate topology_template = new TopologyTemplate();
+            Map<String, NodeTemplate> node_templates = new HashMap<String, NodeTemplate>();
+
+            Map<String, NodeTemplate> node_Templates = serviceTemplate.getTopologyTemplate().getNodeTemplates();
+
+            node_templates.put("activate-action", node_Templates.get("activate-action"));
+            node_templates.put("base-config-template", node_Templates.get("base-config-template"));
+            node_templates.put("vrr-netconf-device", node_Templates.get("vrr-netconf-device"));
+            node_templates.put("get-netconf-config", node_Templates.get("get-netconf-config"));
+            node_templates.put("edit-netconf-config", node_Templates.get("edit-netconf-config"));
+            node_templates.put("transaction-netconf-baseconfig", node_Templates.get("transaction-netconf-baseconfig"));
+
+            topology_template.setNodeTemplates(node_templates);
+            topology_template.setInputs(serviceTemplate.getTopologyTemplate().getInputs());
+
+            Map<String, NodeType> node_types = new HashMap<String, NodeType>();
+            node_types.put("dg-activate-netconf", serviceTemplate.getNodeTypes().get("dg-activate-netconf"));
+            node_types.put("artifact-config-template", serviceTemplate.getNodeTypes().get("artifact-config-template"));
+            node_types.put("component-transaction-netconf",
+                    serviceTemplate.getNodeTypes().get("component-transaction-netconf"));
+            node_types.put("component-netconf-edit", serviceTemplate.getNodeTypes().get("component-netconf-edit"));
+            node_types.put("component-netconf-get", serviceTemplate.getNodeTypes().get("component-netconf-get"));
+            node_types.put("vnf-netconf-device", serviceTemplate.getNodeTypes().get("vnf-netconf-device"));
+
+            workingServiceTemplate.setNodeTypes(node_types);
+            workingServiceTemplate.setTopologyTemplate(topology_template);
+
+            String workingServiceTemplateContent = TransformationUtils.getJson(workingServiceTemplate, true);
+
+            FileUtils.writeStringToFile(new File("src/test/resources/service_templates/download_config.json"),
+                    workingServiceTemplateContent, Charset.defaultCharset());
+
+            File lcmFile = new File(
+                    "../../../adaptors/netconf-adaptor/provider/src/test/resources/service_templates/download_config.json");
+            FileUtils.writeStringToFile(lcmFile, workingServiceTemplateContent, Charset.defaultCharset());
+
+        }
+    }
+
+    public void createRestconfdownloadNodeTemplate(ServiceTemplate serviceTemplate) throws IOException {
+        if (serviceTemplate != null) {
+            ServiceTemplate workingServiceTemplate = new ServiceTemplate();
+            workingServiceTemplate.setMetadata(serviceTemplate.getMetadata());
+
+            Map<String, DataType> data_types = new HashMap<String, DataType>();
+            data_types.put("datatype-property", serviceTemplate.getDataTypes().get("datatype-property"));
+            data_types.put("datatype-resource-assignment",
+                    serviceTemplate.getDataTypes().get("datatype-resource-assignment"));
+            workingServiceTemplate.setDataTypes(data_types);
+
+            TopologyTemplate topology_template = new TopologyTemplate();
+            Map<String, NodeTemplate> node_templates = new HashMap<String, NodeTemplate>();
+
+            Map<String, NodeTemplate> node_Templates = serviceTemplate.getTopologyTemplate().getNodeTemplates();
+            node_templates.put("activate-restconf-action", node_Templates.get("activate-restconf-action"));
+            node_templates.put("base-config-template", node_Templates.get("base-config-template"));
+            node_templates.put("vrr-restconf-device", node_Templates.get("vrr-restconf-device"));
+            node_templates.put("edit-restconf-config", node_Templates.get("edit-restconf-config"));
+            node_templates.put("transaction-restconf-baseconfig",
+                    node_Templates.get("transaction-restconf-baseconfig"));
+
+            topology_template.setNodeTemplates(node_templates);
+            topology_template.setInputs(serviceTemplate.getTopologyTemplate().getInputs());
+
+            Map<String, NodeType> node_types = new HashMap<String, NodeType>();
+            node_types.put("dg-activate-restconf", serviceTemplate.getNodeTypes().get("dg-activate-restconf"));
+            node_types.put("artifact-config-template", serviceTemplate.getNodeTypes().get("artifact-config-template"));
+            node_types.put("component-transaction-restconf",
+                    serviceTemplate.getNodeTypes().get("component-transaction-restconf"));
+            node_types.put("component-restconf", serviceTemplate.getNodeTypes().get("component-restconf"));
+            node_types.put("vnf-restconf-device", serviceTemplate.getNodeTypes().get("vnf-restconf-device"));
+
+            workingServiceTemplate.setNodeTypes(node_types);
+            workingServiceTemplate.setTopologyTemplate(topology_template);
+
+            String workingServiceTemplateContent = TransformationUtils.getJson(workingServiceTemplate, true);
+
+            FileUtils.writeStringToFile(new File("src/test/resources/service_templates/restconf_download_config.json"),
+                    workingServiceTemplateContent, Charset.defaultCharset());
+
+            File lcmFile = new File(
+                    "../../../adaptors/netconf-adaptor/provider/src/test/resources/service_templates/restconf_download_config.json");
+            FileUtils.writeStringToFile(lcmFile, workingServiceTemplateContent, Charset.defaultCharset());
+
+        }
+
+    }
+
+    public void createResourceAssignmentNodeTemplate(ServiceTemplate serviceTemplate) throws IOException {
+        if (serviceTemplate != null) {
+            ServiceTemplate workingServiceTemplate = new ServiceTemplate();
+            workingServiceTemplate.setMetadata(serviceTemplate.getMetadata());
+
+            Map<String, DataType> data_types = new HashMap<String, DataType>();
+            data_types.put("datatype-property", serviceTemplate.getDataTypes().get("datatype-property"));
+            data_types.put("datatype-resource-assignment",
+                    serviceTemplate.getDataTypes().get("datatype-resource-assignment"));
+
+            workingServiceTemplate.setDataTypes(data_types);
+
+            TopologyTemplate topology_template = new TopologyTemplate();
+            Map<String, NodeTemplate> node_templates = new HashMap<String, NodeTemplate>();
+
+            Map<String, NodeTemplate> node_Templates = serviceTemplate.getTopologyTemplate().getNodeTemplates();
+
+            node_templates.put("base-config-template", node_Templates.get("base-config-template"));
+            node_templates.put("licence-template", node_Templates.get("licence-template"));
+
+            node_templates.put("resource-assignment-action", node_Templates.get("resource-assignment-action"));
+            node_templates.put("resource-assignment", node_Templates.get("resource-assignment"));
+
+            topology_template.setNodeTemplates(node_templates);
+            topology_template.setInputs(serviceTemplate.getTopologyTemplate().getInputs());
+
+            Map<String, NodeType> node_types = new HashMap<String, NodeType>();
+            node_types.put("artifact-config-template", serviceTemplate.getNodeTypes().get("artifact-config-template"));
+            node_types.put("dg-resource-assignment", serviceTemplate.getNodeTypes().get("dg-resource-assignment"));
+            node_types.put("component-resource-assignment",
+                    serviceTemplate.getNodeTypes().get("component-resource-assignment"));
+
+            workingServiceTemplate.setNodeTypes(node_types);
+            workingServiceTemplate.setTopologyTemplate(topology_template);
+
+            String workingServiceTemplateConmtent = TransformationUtils.getJson(workingServiceTemplate, true);
+
+            FileUtils.writeStringToFile(new File("src/test/resources/service_templates/resource_assignment.json"),
+                    workingServiceTemplateConmtent, Charset.defaultCharset());
+
+            File lcmFile = new File(
+                    "../../../northbound/selfservice-api/provider/src/test/resources/service_templates/resource_assignment.json");
+            FileUtils.writeStringToFile(lcmFile, workingServiceTemplateConmtent, Charset.defaultCharset());
+
+            File resourceAssignmetFile = new File(
+                    "../../../plugin/assignment/provider/src/test/resources/service_templates/resource_assignment.json");
+            FileUtils.writeStringToFile(resourceAssignmetFile, workingServiceTemplateConmtent,
+                    Charset.defaultCharset());
+
+            System.out.println("NodeTypeCreateUtils.createNodeTemplate() :" + workingServiceTemplateConmtent);
+        }
+
+    }
+
+    public void createVrrNodeTemplate(ServiceTemplate serviceTemplate) throws IOException {
+        if (serviceTemplate != null) {
+            ServiceTemplate workingServiceTemplate = new ServiceTemplate();
+            workingServiceTemplate.setMetadata(serviceTemplate.getMetadata());
+
+            TopologyTemplate topology_template = new TopologyTemplate();
+            Map<String, NodeTemplate> node_templates = new HashMap<String, NodeTemplate>();
+
+            Map<String, NodeTemplate> node_Templates = serviceTemplate.getTopologyTemplate().getNodeTemplates();
+
+            node_templates.put("resource-assignment-action", node_Templates.get("resource-assignment-action"));
+            node_templates.put("resource-assignment", node_Templates.get("resource-assignment"));
+
+            node_templates.put("activate-action", node_Templates.get("activate-action"));
+            node_templates.put("base-config-template", node_Templates.get("base-config-template"));
+            node_templates.put("licence-template", node_Templates.get("licence-template"));
+            node_templates.put("vrr-netconf-device", node_Templates.get("vrr-netconf-device"));
+            node_templates.put("get-netconf-config", node_Templates.get("get-netconf-config"));
+            node_templates.put("edit-netconf-config", node_Templates.get("edit-netconf-config"));
+            node_templates.put("transaction-netconf-baseconfig", node_Templates.get("transaction-netconf-baseconfig"));
+
+            topology_template.setNodeTemplates(node_templates);
+            topology_template.setInputs(serviceTemplate.getTopologyTemplate().getInputs());
+
+            workingServiceTemplate.setTopologyTemplate(topology_template);
+
+            String workingServiceTemplateContent = TransformationUtils.getJson(workingServiceTemplate, true);
+
+            FileUtils.writeStringToFile(new File("src/test/resources/service_templates/vrr_config.json"),
+                    workingServiceTemplateContent, Charset.defaultCharset());
+
+        }
+    }
+
+    public void createDictionarySchema() throws IOException {
+        String schema = TransformationUtils.getJsonSchema(ResourceDefinition.class);
+        FileUtils.writeStringToFile(new File("src/test/resources/dictionary/dictionary_schema.json"), schema,
+                Charset.defaultCharset());
+    }
+
+    public static void main(String[] args) {
+        try {
+            ServiceTemplateCreateUtils utils = new ServiceTemplateCreateUtils();
+            utils.createNodeTypes("src/test/resources/service_templates/default.json");
+        } catch (Exception e) {
+            // TODO: handle exception
+        }
+    }
+
+}
